From steven.charles.davis@REDACTED Thu May 1 02:17:58 2014 From: steven.charles.davis@REDACTED (Steve Davis) Date: Wed, 30 Apr 2014 17:17:58 -0700 (PDT) Subject: [erlang-questions] Erlang, WSDL, SOAP. In-Reply-To: References: Message-ID: <97d34f5f-ddbb-4e5c-8517-4857d03fc8da@googlegroups.com> FWIW, My experience has been that the issues surrounding web services are not the WSDL but resolving other technologies that it uses: i.e. the resolution of namespace mapping and schema analysis. 1) It's pretty obvious that namespaces (aka packages, etc) introduce many indirection concerns (consider the earlier experiment in erlang with module "packages"). 2) The issue with xml schema seems to be the underlying DTD (heavily documented to note exceptions) and what is far worse, the use of "inheritance". If there was a fully resolved solution in erlang to both xmlns and xsd, then I suspect generic web services would not be at all difficult. (For another take on the subject, Joe Armstrong's UBF contains a strong argument for rethinking XML in general). My 2c /s On Tuesday, April 29, 2014 8:48:14 AM UTC-5, Max Lapshin wrote: > > > Hi. > > I'm writing Onvif implementation in Erlang and I experience pain (no, > wrong, it is PAIN) with handling all that nice XML, XPath, SOAP, WSDL > stuff with ad-hoc self-written implementations. > > > I have a very serious feeling that it is possible to write a generator of > boiler plate code that will translate funcall to SOAP XML packet and back. > > I've looked at this: https://github.com/campanja/detergent and haven't > found there authorization and exact routing code. > > Am I the only one who is suffering from this? > > Right now I need working soap client and later soap server. > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From john.ashmun@REDACTED Thu May 1 02:24:31 2014 From: john.ashmun@REDACTED (John R. Ashmun) Date: Wed, 30 Apr 2014 17:24:31 -0700 Subject: [erlang-questions] How to report a trivial wxErlang documentation error? Message-ID: I always download the Windows binaries for Erlang, and I have never used git -- I don't understand what a pull request is. At http://www.erlang.org/doc/man/wxEvtHandler.html#connect-2, there is a link labeled "EventType" (It's the second argument to wxEvtHandler:connect/2) which points, rather than to wxEventType( ) (the documentation for which appears not to exist), to http://www.erlang.org/doc/man/wxEvtHandler.html#connect-3 To find what I needed, which was the event type for a user's operating a wxButton, I used notepad to read a copy of wx.hrl to which I had added carriage returns, so I now know it's command_button_clicked. Regards, John Ashmun -------------- next part -------------- An HTML attachment was scrubbed... URL: From alex.arnon@REDACTED Thu May 1 15:51:03 2014 From: alex.arnon@REDACTED (Alex Arnon) Date: Thu, 1 May 2014 16:51:03 +0300 Subject: [erlang-questions] JInterface artifact in Maven Central - time for an update? Message-ID: Hi List, It seems that it is time to upload an up-to-date version of the "jinterface" artifact to Maven Central, in particular now that maps are supported. The latest version there is 1.5.6, uploaded on April 2012. Thanks! -------------- next part -------------- An HTML attachment was scrubbed... URL: From richard.youngkin@REDACTED Thu May 1 15:47:43 2014 From: richard.youngkin@REDACTED (Youngkin, Rich) Date: Thu, 1 May 2014 07:47:43 -0600 Subject: [erlang-questions] Supervision trees and child startup ordering In-Reply-To: <20140430191213.GE84891@ferdair.local> References: <20140430191213.GE84891@ferdair.local> Message-ID: Hi Fred, Thanks for the excellent response. This is very helpful and helped me understand exactly what it was I wanted to accomplish. Which was slightly different in important ways from what I thought I was doing. Thanks also for the fabulous book! Cheers, Rich On Wed, Apr 30, 2014 at 1:12 PM, Fred Hebert wrote: > Answers inline > > On 04/30, Youngkin, Rich wrote: > > Hi, > > > > I'm using a supervision tree to manage multiple sets of gen_servers. > I've > > got a situation where gen_servers in one supervision tree (e.g., Tree-B) > > are clients of gen_servers in another supervision tree (e.g., Tree-A). > I'd > > like Tree-A and all of it's children to complete their initialization > > processing before starting any of the children in Tree-B. > > > > [...] > > > > So given this diagram, A and its children 1,2 and 3 start and complete > > initialization before B and children 4 and 5 are started and complete > > initialization. Furthermore, initialization in this case means that in > > module:init/1 the child casts itself a message to complete > initialization. > > I recommand in this case that Root Supervisor adopts a 'rest_for_one' > strategy that will ensure that if Supervisor-A fails at any point during > run-time, Supervisor-B and its children are killed before the whole > structure is restarted. Otherwise, you may run into the issue of having > Supervisor-B's children run without A being present. > > > > During Child 4's initialization it calls a function on Child 1 (which has > > an init/1 implementation as described above). > > > > In reading http://www.erlang.org/doc/man/supervisor.html#start_link-2 I > > understand that Supervisor-A and all it's children will be started and > > available before Supervisor-B and its children are started. It's also my > > understanding that when a child casts itself a message in its init/1 > > function that that message is guaranteed to be the first message in its > > mailbox. Is my understanding of this correct and if so, is this a > > reasonable way to do what I'm trying to accomplish? > > > > Two things. > > 1. The message is guaranteed to be the first one in the mailbox *iff* > the process hasn't been registered before, or given its pid to anyone > who could send it a message. Usually, that's fine when using OTP. > 2. The init scheme you're going for will turn your boot sequence into an > asynchronous one -- it's possible children of B will be spawned while > children of A are still doing the handling of the initial message in > their handle function. > > The latter may be a valid choice if the resource started asynchronously > isn't always guaranteed to be available. Meaning that in this case, > you're guaranteeing that the client will be up, but not the connection. > > This is actually a very sane model for external resources, but you just > have to be aware you're implementing it :) > > See http://ferd.ca/it-s-about-the-guarantees.html for more details on > this. > > Regards, > Fred. > -------------- next part -------------- An HTML attachment was scrubbed... URL: From lloyd@REDACTED Thu May 1 18:23:32 2014 From: lloyd@REDACTED (Lloyd R. Prentice) Date: Thu, 1 May 2014 12:23:32 -0400 Subject: [erlang-questions] Is n2o viable? Message-ID: <5CD79A08-260F-40E7-A80E-10CECCD9973F@writersglen.com> Hello, n2o looks like a wonderful project. But there's so little how-to information on the web, and so little sign of community support, that I can't tell if it's a viable open-source project for any but the in-group. A week or so ago I sent an e-mail to Maxim expressing interest, but have yet to receive a response. I'd like to explore/evaluate this framework, but fear hitting a dead end. Is there anyone out there working with it and willing/interested in sharing their experience? Many thanks, LRP Sent from my iPad From maxim@REDACTED Thu May 1 19:54:14 2014 From: maxim@REDACTED (Maxim Sokhatsky) Date: Thu, 1 May 2014 20:54:14 +0300 Subject: [erlang-questions] Is n2o viable? In-Reply-To: <5CD79A08-260F-40E7-A80E-10CECCD9973F@writersglen.com> References: <5CD79A08-260F-40E7-A80E-10CECCD9973F@writersglen.com> Message-ID: Hello! Of course we have everything. IRC FeeeNode Channel 24/7: #n2o Public Logs: https://botbot.me/freenode/n2o/ N2O Handbook: http://synrc.com/framework/web/n2o/doc/book.pdf Live Commit History, Continuously in top 5-10 active Erlang Projects on Github. Our latest release 1.4 was drafter a week ago. We have three sample projects: ? ? ?1. One of them is Skyline (Sample Web Shop based on N2O) http://github.com/synrc/skyline ? ? ?2. Second is Countach (CMS written in N2O) http://github.com/synrc/countach ? ? ?3. Third is Erlang Continuous Integration Server http://github.com/voxoz/cycle Also we have tens of Nitrogen sites that could be easily converted to N2O We have Additional Satellite Projects: ? ? ?1. KVS Erlang Abstract Erlang Term Database (Riak/KAI/Mnesia) http://github.com/5HT/kvs_core ? ? ?2. SHEN Erlang JavaScript Compiler http://github.com/5HT/shen ? ? ?3. MQS RabbitMQ client library http://github.com/synrc/mqs ? ? ?4. FEEDS Feeds Server http://github.com/synrc/feeds Among known public users of N2O I could admit: https://github.com/crashkeeper https://github.com/kakaranet/games http://www.pearlpbx.com Along with more closed projects by https://github.com/Zert https://github.com/doxtop https://github.com/ymn https://github.com/m-2k https://github.com/b0oh https://github.com/proger Which forms a core community. Unfortunately haven't heard anything from you in my mailbox. Hope you will find what you are looking here. Maxim > n2o looks like a wonderful project. But there's so little how-to information on the web, and so little sign of community support, that I can't tell if it's a viable open-source project for any but the in-group. From co7eb@REDACTED Thu May 1 19:08:59 2014 From: co7eb@REDACTED (=?iso-8859-1?Q?Ivan_Carmenates_Garc=EDa?=) Date: Thu, 1 May 2014 13:08:59 -0400 Subject: [erlang-questions] Understanding ChicagoBoss model Message-ID: <001101cf6560$0cccd510$26667f30$@frcuba.co.cu> Hi all, I have some troubles with the CB ORM model, and I would love to know if there is at least one way to do something like follow: I have made a database model in postgres and when I tried to fix that model in the CB model I encounter with some inconvenient, first do I have obligatory to have and id for each table in the database? Including the many to many normalized relationship like this one or a model with more than one foreign keys %%% Module attributes definition. -module(user_friend_ships, [ Id, Users1Id, Users2Id ]). -compile(export_all). -belongs_to(users). When you compile it, it expects a field name called UsersId, even I tried to specify in the users model de custom fk and nothing expected happens. In the database I can have one fk called users_id that matches with one in the CB model, but the other? It need to have a different name!. -module(users, [ Id, Username, Password, PasswordOld, Status ]). -compile(export_all). -has({user_friend_ships, many, [{foreign_key, "users1_id"}]}). -has({user_friend_ships, many, [{foreign_key, "users2_id"}]}). The other thing is the obligatory id even for the many to many relationships. Best regards, Ivan. -------------- next part -------------- An HTML attachment was scrubbed... URL: From torben.hoffmann@REDACTED Thu May 1 22:01:08 2014 From: torben.hoffmann@REDACTED (Torben Hoffmann) Date: Thu, 01 May 2014 22:01:08 +0200 Subject: [erlang-questions] Erlang for exercism.io: The Fellowship of the Process Ring Message-ID: Hi fellow Erlangers! I call upon you in a time of great hope and opportunity!! Katrina Owen has created this wonderful thing called exercism.io, which allows people to do exercises in languages of their choice and get their solutions reviewed by people well versed in the language. First and foremost, we need a group of Erlangers to volunteer to nitpick the solutions people provide as per the contribution rules of exercism.io: https://github.com/exercism/exercism.io/blob/master/CONTRIBUTING.md#creating-a-new-language-track I will put myself forward as one of the valiant knights of the Erlang world, who will help people with feedback on their exercises as part of The Fellowship of the Process Ring. But, alas, one person is not enough. We need more to fight off all the evils of Mordor, so I hope that others will join my call. Apart from people willing to join the Fellowship we also need people to prepare new exercises for Erlang. Right now there are 13 exercises at https://github.com/exercism/xerlang, but we need more. The common list of exercises is at https://github.com/exercism/x-common where all the existing problems have been listed. For each of the exercises a test file is needed to test the solution. If you find that some cool exercise that could stifle even the bravest Hobbit is missing you can add a new one. I, for one, will try to add some exercises that helps people think concurrently. If you are interested, send me a mail and I will organise things with exercism.io. ?It's the job that's never started as takes longest to finish.? - J.R.R. Tolkien Cheers, Torben -- Torben Hoffmann CTO Erlang Solutions Ltd. Tel: +45 25 14 05 38 http://www.erlang-solutions.com From co7eb@REDACTED Thu May 1 21:21:02 2014 From: co7eb@REDACTED (=?iso-8859-1?Q?Ivan_Carmenates_Garc=EDa?=) Date: Thu, 1 May 2014 15:21:02 -0400 Subject: [erlang-questions] Understanding ChicagoBoss model Message-ID: <000501cf6572$7f496fb0$7ddc4f10$@frcuba.co.cu> Hi all, Well I incredible make magic and guess using the so ?wide? and ?well documented? CB documentation and make up myself for the case of many to many relationship with the same entity like user_friend_ship that have two foreign keys of the same user entity. Using ?belongs_to_users(user2). -module(user_friend_ships, [ Id, Users1Id, Users2Id ]). -compile(export_all). -belongs_to(users). -belongs_to_users(user2). But still have the non-useful id field thing in a many to many relation. Regards, Ivan. Hi all, I have some troubles with the CB ORM model, and I would love to know if there is at least one way to do something like follow: I have made a database model in postgres and when I tried to fix that model in the CB model I encounter with some inconvenient, first do I have obligatory to have and id for each table in the database? Including the many to many normalized relationship like this one or a model with more than one foreign keys %%% Module attributes definition. -module(user_friend_ships, [ Id, Users1Id, Users2Id ]). -compile(export_all). -belongs_to(users). When you compile it, it expects a field name called UsersId, even I tried to specify in the users model de custom fk and nothing expected happens. In the database I can have one fk called users_id that matches with one in the CB model, but the other? It need to have a different name!. -module(users, [ Id, Username, Password, PasswordOld, Status ]). -compile(export_all). -has({user_friend_ships, many, [{foreign_key, "users1_id"}]}). -has({user_friend_ships, many, [{foreign_key, "users2_id"}]}). The other thing is the obligatory id even for the many to many relationships. Best regards, Ivan. -------------- next part -------------- An HTML attachment was scrubbed... URL: From co7eb@REDACTED Thu May 1 21:53:30 2014 From: co7eb@REDACTED (=?iso-8859-1?Q?Ivan_Carmenates_Garc=EDa?=) Date: Thu, 1 May 2014 15:53:30 -0400 Subject: [erlang-questions] FW: Understanding ChicagoBoss model Message-ID: <000001cf6577$08fe9790$1afbc6b0$@frcuba.co.cu> Sorry my mistake this is the correct one instead of -belongs_to(users). -belongs_to_users(user1). -belongs_to_users(user2). Well I incredible make magic and guess using the so ?wide? and ?well documented? CB documentation and make up myself for the case of many to many relationship with the same entity like user_friend_ship that have two foreign keys of the same user entity. Using ?belongs_to_users(user2). -module(user_friend_ships, [ Id, Users1Id, Users2Id ]). -compile(export_all). -belongs_to(users). -belongs_to_users(user2). But still have the non-useful id field thing in a many to many relation. Regards, Ivan. Hi all, I have some troubles with the CB ORM model, and I would love to know if there is at least one way to do something like follow: I have made a database model in postgres and when I tried to fix that model in the CB model I encounter with some inconvenient, first do I have obligatory to have and id for each table in the database? Including the many to many normalized relationship like this one or a model with more than one foreign keys %%% Module attributes definition. -module(user_friend_ships, [ Id, Users1Id, Users2Id ]). -compile(export_all). -belongs_to(users). When you compile it, it expects a field name called UsersId, even I tried to specify in the users model de custom fk and nothing expected happens. In the database I can have one fk called users_id that matches with one in the CB model, but the other? It need to have a different name!. -module(users, [ Id, Username, Password, PasswordOld, Status ]). -compile(export_all). -has({user_friend_ships, many, [{foreign_key, "users1_id"}]}). -has({user_friend_ships, many, [{foreign_key, "users2_id"}]}). The other thing is the obligatory id even for the many to many relationships. Best regards, Ivan. -------------- next part -------------- An HTML attachment was scrubbed... URL: From lloyd@REDACTED Thu May 1 22:59:22 2014 From: lloyd@REDACTED (lloyd@REDACTED) Date: Thu, 1 May 2014 16:59:22 -0400 (EDT) Subject: [erlang-questions] =?utf-8?q?Is_n2o_viable=3F?= In-Reply-To: References: <5CD79A08-260F-40E7-A80E-10CECCD9973F@writersglen.com> Message-ID: <1398977962.425618609@apps.rackspace.com> Hi Maxim, Really impressive work! I must not have dug deep enough. Will do now. Many thanks, Lloyd -----Original Message----- From: "Maxim Sokhatsky" Sent: Thursday, May 1, 2014 1:54pm To: "Lloyd R. Prentice" , "Erlang Questions" Subject: RE: [erlang-questions] Is n2o viable? Hello! Of course we have everything. IRC FeeeNode Channel 24/7: #n2o Public Logs: https://botbot.me/freenode/n2o/ N2O Handbook: http://synrc.com/framework/web/n2o/doc/book.pdf Live Commit History, Continuously in top 5-10 active Erlang Projects on Github. Our latest release 1.4 was drafter a week ago. We have three sample projects: ? ? ?1. One of them is Skyline (Sample Web Shop based on N2O) http://github.com/synrc/skyline ? ? ?2. Second is Countach (CMS written in N2O) http://github.com/synrc/countach ? ? ?3. Third is Erlang Continuous Integration Server http://github.com/voxoz/cycle Also we have tens of Nitrogen sites that could be easily converted to N2O We have Additional Satellite Projects: ? ? ?1. KVS Erlang Abstract Erlang Term Database (Riak/KAI/Mnesia) http://github.com/5HT/kvs_core ? ? ?2. SHEN Erlang JavaScript Compiler http://github.com/5HT/shen ? ? ?3. MQS RabbitMQ client library http://github.com/synrc/mqs ? ? ?4. FEEDS Feeds Server http://github.com/synrc/feeds Among known public users of N2O I could admit: https://github.com/crashkeeper https://github.com/kakaranet/games http://www.pearlpbx.com Along with more closed projects by https://github.com/Zert https://github.com/doxtop https://github.com/ymn https://github.com/m-2k https://github.com/b0oh https://github.com/proger Which forms a core community. Unfortunately haven't heard anything from you in my mailbox. Hope you will find what you are looking here. Maxim > n2o looks like a wonderful project. But there's so little how-to information on the web, and so little sign of community support, that I can't tell if it's a viable open-source project for any but the in-group. From peppe@REDACTED Fri May 2 01:42:52 2014 From: peppe@REDACTED (Peter Andersson) Date: Fri, 2 May 2014 01:42:52 +0200 Subject: [erlang-questions] Help: ct_telnet_client memory overflow In-Reply-To: <201404231706500961033@gmail.com> References: <201404201300024160307@gmail.com>, <53561FE2.1050306@erlang.org> <201404231706500961033@gmail.com> Message-ID: <5362DBFC.4000604@erlang.org> Hi, I've looked into your problem now and it turns out to be a fairly complex one. The memory usage behavior you see is the result of a few separate problems: When you do cat on a very large file over telnet, the result is that the telnet client gets bombarded with loads of small TCP messages (will depend on your TCP configuration). The CT telnet client is not designed to handle this scenario (not well anyway), mainly because of these settings: gen_tcp:connect(Server, Port, [list,{packet,0}], Timeout) It means connections are active, i.e. the client process receives the messages as they come in without any means of controlling the flow. Messages actually get queued in the mailbox faster than they are processed. Also, the messages are received as lists, not as binaries. The combination here is lethal. Moreover, the client runs a search-and-copy operation on each message received, and the result gets buffered with previous messages in loopdata - a list. Every now and then, this buffer gets requested (get_data), at which point the list is reversed and copied to the requesting process, which in your case (according to the example you sent me) prints the data to file by means of io:format/3. That actually means sending a large list to the io server, which is yet another expensive copy operation. I'm also suspecting that the huge amount of small messages in the system causes the memory to become badly fragmented. Again, the nasty memory usage is caused by a combination of all these things, so here's what needs to be done: 1. The CT telnet client should receive binary TCP packets instead of lists so the data isn't copied, and so the loopdata list contains references instead of lists. 2. The TCP connection must be passive in order to avoid massive buffering. 3. The search-and-copy operation (check_msg/3) should be changed into a search-and-only-copy-if-necessary operation. 4. The get_data/1 function should return a binary rather than a list. 5. Write the data to file using the file server i/f (file) rather than io server i/f (io). To test this, I first modified ct_telnet_client according to #1 and #3 above. My first version would quickly run out of memory though because of an increased rate of incoming (now binary) packets (and no flow control), so I had to implement #2 as well to get it working. The result was then that I could process a ~30 Mb text file using 20 Mb RAM (the system total reported by observer). Linux top reported memory usage of max 55 Mb. The only possible workaround for you (that I can think of) that doesn't require any modifications of ct_telnet_client, is that you run split (also over telnet) to split up your large file first, then do cat on each part, one at a time. A very primitive form of flow control! :-) I haven't tested if this works well in practice. I will write a ticket on updating ct_telnet_client to be more efficient dealing with large amounts of data, but can't say when that fix will be officially released. In the meantime I can send you my experimental module to play around with further. Best regards, Peter Ericsson AB, Erlang/OTP yasoho@REDACTED wrote: > > Hi, Peter > > Our performance analysis discover the cause of the problem is not tail > recursion function loop(State, Sock, Acc)) to ct_telnet_client; > > Can you give me a advice How to modifiy it? thanks! > > > B.R > ------------------------------------------------------------------------ > yasoho@REDACTED > > > *From:* Peter Andersson > *Date:* 2014-04-22 15:53 > *To:* yasoho@REDACTED > *CC:* erlang-questions > *Subject:* Re: [erlang-questions] Help: ct_telnet_client memory > overflow > > Hi, > > Can you please tell me which Common Test version (or OTP version) > you're > running? (The CT telnet client got modified a bit from v1.7 to v1.8). > > Best regards, > Peter > > Ericsson AB, Erlang/OTP > > yasoho@REDACTED wrote: > > > > Hi, dear > > > > > > I use ct_telnet_client.erl, found that when a telnet command > returning > > message reaches 10MB, the Erlang process consumes memory up to > > 4~5GB, when the greater will memory overflow,. > > > > > > Can anybody help me, what is the cause? thanks a lot! > > > > > > B.R > > > ------------------------------------------------------------------------ > > yasoho@REDACTED > > > ------------------------------------------------------------------------ > > > > _______________________________________________ > > erlang-questions mailing list > > erlang-questions@REDACTED > > http://erlang.org/mailman/listinfo/erlang-questions > > > > From max.lapshin@REDACTED Fri May 2 07:31:53 2014 From: max.lapshin@REDACTED (Max Lapshin) Date: Fri, 2 May 2014 09:31:53 +0400 Subject: [erlang-questions] Possibly memory leak in R17 In-Reply-To: References: <20140418123352.GA68518@ferdair.local> Message-ID: Lukas, thank you a lot. I've added +MBacul 0 and everything is very stable now. Memory consumption back is normal, system is performing normally. Before I've added this problem was not only with memory usage. When server allocated 12 GB RAM, it was performing very badly. Can I help somehow else to enhance it? -------------- next part -------------- An HTML attachment was scrubbed... URL: From torben.hoffmann@REDACTED Fri May 2 09:21:54 2014 From: torben.hoffmann@REDACTED (Torben Hoffmann) Date: Fri, 02 May 2014 09:21:54 +0200 Subject: [erlang-questions] Visual Erlang notation v0.1.0 - feedback request Message-ID: Hi, As I have mentioned before I have been working on a visual notation for Erlang and although it is not complete yet I have received requests to release it anyway, so here goes... https://github.com/esl/visual_erlang One extra thing missing from the to-do list is state data for processes. I would like some feedback on how you feel the abstraction level is. The purpose of Visual Erlang is not to be able to specify every little detail of what happens in an Erlang program, but to give a way to describe the architecture. Once I have updated the Erlang Concurrency Patterns that Jesper and I have been working on to the new Visual Erlang notation we will release them as well. The original plan for the patterns was to use Object-Process Methodology as the notation, but I was adviced (and thanks for that) to invent an Erlang specific notation since OPM has some corners that hurts for Erlang. Right now the only way to draw Visual Erlang diagrams is by hand or use the LaTeX macros I have created, but since Visual Erlang has a 1:1 mapping between the visuals and a textual notation my hope is that we can create a tool that can create a diagram from the textual notation. Going even further I dream of having a tool that extracts the Visual Erlang notation from the code in an interactive manner, where the user can guide what to abstract and what to just leave totally out. Cheers, Torben -- Torben Hoffmann CTO Erlang Solutions Ltd. Tel: +45 25 14 05 38 http://www.erlang-solutions.com From alex@REDACTED Fri May 2 10:00:31 2014 From: alex@REDACTED (Alex Wilson) Date: Fri, 2 May 2014 18:00:31 +1000 Subject: [erlang-questions] e2qc, a 2Q NIF cache Message-ID: <4442AF66-C0CD-44BF-8A7D-C28128A2E8D7@cooperi.net> Hi all, I've put together an Erlang NIF library implementing the 2Q cache management algorithm (http://www.inf.fu-berlin.de/lehre/WS10/DBS-Tech/Reader/2QBufferManagement.pdf) with a focus on having a very simple-to-use API. I thought I might share it on this list in case anybody is interested and/or wants to make it break and tell me how they did it. :) The code is up on github under a BSD license. 2Q is a refinement of the classic LRU (Least-Recently-Used) cache management algorithm that achieves better hit rates with many common workloads -- especially those that benefit from rejection of sequential scans. In the worst case, it generally performs no worse than plain LRU and still retains much of its simplicity. Lookups in e2qc are done through a hash table (uthash, with Paul Hseih's hash function), and the cache structure is held in a pair of doubly-linked lists (see the paper for more info about the 2Q structure). Cache hits with e2qc can be zero-copy if using binaries for key and value (key is used as-is, the value in a resource binary). Also, updates to the cache lists and structure are asynchronous, deferred to a background thread -- all the updates get batched up together with the next eviction operation to minimise the time spent with locks held and avoid blocking the VM, rather than mutating the cache lists during a get or put operation. Its main claim to fame though is that using it is super simple: some_function(Input) -> do_slow_thing(Input). becomes some_function(Input) -> e2qc:cache(slow_thing, Input, fun() -> do_slow_thing(Input) end). and ta-da! your results are cached. No need to start a process for it or pass a handle around, no need to even provide any settings or configuration -- you can just add it wherever in your code. More details are in the README on github: https://github.com/arekinath/e2qc Thanks for your time! From lukas@REDACTED Fri May 2 11:10:49 2014 From: lukas@REDACTED (Lukas Larsson) Date: Fri, 2 May 2014 11:10:49 +0200 Subject: [erlang-questions] Possibly memory leak in R17 In-Reply-To: References: <20140418123352.GA68518@ferdair.local> Message-ID: On Fri, May 2, 2014 at 7:31 AM, Max Lapshin wrote: > > Before I've added this problem was not only with memory usage. When server > allocated 12 GB RAM, it was performing very badly. > > When you say performing badly, how do you notice this? increased latency? CPU load? I assume that is quite hard to setup a test system that replicates the behaviour? If it is not possible to simulate the problem a couple of additional measurements that would be helpful are: 1) Saving recon_alloc snapshots at regular intervals (every minute maybe) up until the system reaches the bad state. It should not add a noticeable overhead to the system, and is something I recommend most people to do anyways if this kind of thing were to happen. 2) Sending me a core file generated by either kill -ABRT $PID or through gdb https://sourceware.org/gdb/onlinedocs/gdb/Core-File-Generation.html, and the beam.smp (erts-6.0/bin/beam.smp) that you are running. We have a couple of ideas about what could cause the mbcs pool to behave this way, but can of course not be sure until we test the potential solutions. We would probably also need your help with testing when we have a solution in place as this is a behaviour we have not been able to reproduce in our tests. Lukas -------------- next part -------------- An HTML attachment was scrubbed... URL: From clw.geek@REDACTED Fri May 2 17:02:27 2014 From: clw.geek@REDACTED (Christy Watson) Date: Fri, 02 May 2014 11:02:27 -0400 Subject: [erlang-questions] Erlang, WSDL, SOAP. In-Reply-To: <97d34f5f-ddbb-4e5c-8517-4857d03fc8da@googlegroups.com> References: <97d34f5f-ddbb-4e5c-8517-4857d03fc8da@googlegroups.com> Message-ID: <5363B383.4030404@gmail.com> I'm an erlang newbe, but even with java ee and code generation based on a wsdl. The actual mapping to the objects must be done by the programmer, and is a mess. The wsdl concept is great, I just think the standard is to overly complicate the implementation. Remember all a wsdl is for is to say to the user of the service "if you send me __________ I'll send you ____________ back". So others have auto-generated themselves into a mess. Ask yourself what you really need to do to get from input to output, then map your algorithm... you'll probably end up with a much more efficient piece of software than an auto-generated jaxWS mess. On 04/30/2014 08:17 PM, Steve Davis wrote: > has been that the issues surrounding web services are not the WSDL but > resolving other technologies that it uses: i.e. the resolution of > namespace mapping and schema analysis. > > 1) It's pretty obvious that namespaces (aka packages, etc) introduce > many indirection concerns (consider the earlier experiment in erlang > with module "packages"). > > 2) The issue with xml schema seems to be the underlying DTD From g@REDACTED Fri May 2 17:53:58 2014 From: g@REDACTED (Garrett Smith) Date: Fri, 2 May 2014 10:53:58 -0500 Subject: [erlang-questions] Visual Erlang notation v0.1.0 - feedback request In-Reply-To: References: Message-ID: Hi Torben, On Fri, May 2, 2014 at 2:21 AM, Torben Hoffmann wrote: > Hi, > > As I have mentioned before I have been working on a visual notation for Erlang and > although it is not complete yet I have received requests to release it anyway, so > here goes... > > https://github.com/esl/visual_erlang > > One extra thing missing from the to-do list is state data for processes. > > I would like some feedback on how you feel the abstraction level is. > The purpose of Visual Erlang is not to be able to specify every little detail of what > happens in an Erlang program, but to give a way to describe the architecture. Love this! My hopefully constructive input though... I think you ought to be easier on folks who don't use fancy graphics editors :) I (and the folks I work with) tend to use Google presentations to put together visual diagrams. It's quite a handy program. Unfortunately you can't do a few things that you require: - Squiggly lines - Double lines But you can do: - Lots of different line endings (circles, squares, triangles) - Dashed lines - Dash-dotted lines - Thick and thin lines Unless you have a religious point of view when it comes to squiggles (I hear this is a thing) I'd recommend tweaking the symbols to widen the tent for drawing tools :) I also recommend putting together some PNGs and including them as images in the README so people can see what's going on at a glance from the github page without downloading the PDF. But this a nice to have. Can't wait for the Patterns In Erlang book! (But who's in the GoF?) Garrett From mahesh@REDACTED Fri May 2 18:16:05 2014 From: mahesh@REDACTED (Mahesh Paolini-Subramanya) Date: Fri, 2 May 2014 18:16:05 +0200 Subject: [erlang-questions] Visual Erlang notation v0.1.0 - feedback request In-Reply-To: References: Message-ID: Squiggly Lines in Google Presentations Hint: Line up a bunch-a squares, and used the "Curve" line tool. Cheers On Fri, May 2, 2014 at 5:53 PM, Garrett Smith wrote: > Hi Torben, > > On Fri, May 2, 2014 at 2:21 AM, Torben Hoffmann > wrote: > > Hi, > > > > As I have mentioned before I have been working on a visual notation for > Erlang and > > although it is not complete yet I have received requests to release it > anyway, so > > here goes... > > > > https://github.com/esl/visual_erlang > > > > One extra thing missing from the to-do list is state data for processes. > > > > I would like some feedback on how you feel the abstraction level is. > > The purpose of Visual Erlang is not to be able to specify every little > detail of what > > happens in an Erlang program, but to give a way to describe the > architecture. > > Love this! > > My hopefully constructive input though... I think you ought to be > easier on folks who don't use fancy graphics editors :) > > I (and the folks I work with) tend to use Google presentations to put > together visual diagrams. It's quite a handy program. Unfortunately > you can't do a few things that you require: > > - Squiggly lines > - Double lines > > But you can do: > > - Lots of different line endings (circles, squares, triangles) > - Dashed lines > - Dash-dotted lines > - Thick and thin lines > > Unless you have a religious point of view when it comes to squiggles > (I hear this is a thing) I'd recommend tweaking the symbols to widen > the tent for drawing tools :) > > I also recommend putting together some PNGs and including them as > images in the README so people can see what's going on at a glance > from the github page without downloading the PDF. But this a nice to > have. > > Can't wait for the Patterns In Erlang book! (But who's in the GoF?) > > Garrett > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > -- *Mahesh Paolini-Subramanya That tall bald Indian guy..* *Google+ | Blog | Twitter | LinkedIn * -------------- next part -------------- An HTML attachment was scrubbed... URL: From g@REDACTED Fri May 2 18:21:50 2014 From: g@REDACTED (Garrett Smith) Date: Fri, 2 May 2014 11:21:50 -0500 Subject: [erlang-questions] Visual Erlang notation v0.1.0 - feedback request In-Reply-To: References: Message-ID: Ahhh, okay - so yes, technically true. But not easy, so I'm calling that a #fail :P On Fri, May 2, 2014 at 11:16 AM, Mahesh Paolini-Subramanya wrote: > Squiggly Lines in Google Presentations > > Hint: Line up a bunch-a squares, and used the "Curve" line tool. > > Cheers > > > > On Fri, May 2, 2014 at 5:53 PM, Garrett Smith wrote: >> >> Hi Torben, >> >> On Fri, May 2, 2014 at 2:21 AM, Torben Hoffmann >> wrote: >> > Hi, >> > >> > As I have mentioned before I have been working on a visual notation for >> > Erlang and >> > although it is not complete yet I have received requests to release it >> > anyway, so >> > here goes... >> > >> > https://github.com/esl/visual_erlang >> > >> > One extra thing missing from the to-do list is state data for processes. >> > >> > I would like some feedback on how you feel the abstraction level is. >> > The purpose of Visual Erlang is not to be able to specify every little >> > detail of what >> > happens in an Erlang program, but to give a way to describe the >> > architecture. >> >> Love this! >> >> My hopefully constructive input though... I think you ought to be >> easier on folks who don't use fancy graphics editors :) >> >> I (and the folks I work with) tend to use Google presentations to put >> together visual diagrams. It's quite a handy program. Unfortunately >> you can't do a few things that you require: >> >> - Squiggly lines >> - Double lines >> >> But you can do: >> >> - Lots of different line endings (circles, squares, triangles) >> - Dashed lines >> - Dash-dotted lines >> - Thick and thin lines >> >> Unless you have a religious point of view when it comes to squiggles >> (I hear this is a thing) I'd recommend tweaking the symbols to widen >> the tent for drawing tools :) >> >> I also recommend putting together some PNGs and including them as >> images in the README so people can see what's going on at a glance >> from the github page without downloading the PDF. But this a nice to >> have. >> >> Can't wait for the Patterns In Erlang book! (But who's in the GoF?) >> >> Garrett >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://erlang.org/mailman/listinfo/erlang-questions > > > > > -- > Mahesh Paolini-Subramanya > That tall bald Indian guy.. > Google+ | Blog | Twitter | LinkedIn From matwey.kornilov@REDACTED Fri May 2 18:31:22 2014 From: matwey.kornilov@REDACTED (Matwey V. Kornilov) Date: Fri, 02 May 2014 20:31:22 +0400 Subject: [erlang-questions] Visual Erlang notation v0.1.0 - feedback request In-Reply-To: References: Message-ID: 02.05.2014 11:21, Torben Hoffmann ?????: > Hi, > > As I have mentioned before I have been working on a visual notation for Erlang and > although it is not complete yet I have received requests to release it anyway, so > here goes... > > https://github.com/esl/visual_erlang Looks like the Feynman diagrams... From lloyd@REDACTED Fri May 2 18:50:10 2014 From: lloyd@REDACTED (lloyd@REDACTED) Date: Fri, 2 May 2014 12:50:10 -0400 (EDT) Subject: [erlang-questions] ERROR while installing synrc/countach Message-ID: <1399049410.983522592@apps.rackspace.com> Hello, Just set out to install synrc/countach. make returned this error: lloyd@REDACTED:~/Erl/N2O/countach$ make ... Cloning into 'rest'... ==> cowboy (get-deps) Pulling cowlib from {git,"git://github.com/extend/cowlib.git","0.4.0"} Cloning into 'cowlib'... Pulling ranch from {git,"git://github.com/extend/ranch.git","0.9.0"} Cloning into 'ranch'... ==> cowlib (get-deps) ==> ranch (get-deps) ==> gproc (get-deps) ==> rest (get-deps) ERROR: Invalid dependency specification {bootstrap,".*", {git, "git://github.com/twbs/bootstrap.git", {tag,"v3.0.2"}}, [raw]} in /home/lloyd/Erl/N2O/countach/deps/n2o_bootstrap make: *** [get-deps] Error 1 Any suggestions how to get past this? Many thanks, LRP ********************************************* My books: THE GOSPEL OF ASHES http://thegospelofashes.com Strength is not enough. Do they have the courage and the cunning? Can they survive long enough to save the lives of millions? FREEIN' PANCHO http://freeinpancho.com A community of misfits help a troubled boy find his way AYA TAKEO http://ayatakeo.com Star-crossed love, war and power in an alternative universe Available through Amazon or by request from your favorite bookstore ********************************************** From pierrefenoll@REDACTED Fri May 2 18:53:15 2014 From: pierrefenoll@REDACTED (Pierre Fenoll) Date: Fri, 2 May 2014 18:53:15 +0200 Subject: [erlang-questions] ERROR while installing synrc/countach In-Reply-To: <1399049410.983522592@apps.rackspace.com> References: <1399049410.983522592@apps.rackspace.com> Message-ID: Try with this url [1] instead of git://github.com/twbs/bootstrap.git. I believe it is a repo's permissions issue. [1] https://github.com/twbs/bootstrap.git Cheers, -- Pierre Fenoll On 2 May 2014 18:50, wrote: > Hello, > > Just set out to install synrc/countach. make returned this error: > > lloyd@REDACTED:~/Erl/N2O/countach$ make > ... > Cloning into 'rest'... > ==> cowboy (get-deps) > Pulling cowlib from {git,"git://github.com/extend/cowlib.git","0.4.0"} > Cloning into 'cowlib'... > Pulling ranch from {git,"git://github.com/extend/ranch.git","0.9.0"} > Cloning into 'ranch'... > ==> cowlib (get-deps) > ==> ranch (get-deps) > ==> gproc (get-deps) > ==> rest (get-deps) > ERROR: Invalid dependency specification {bootstrap,".*", > {git, > "git:// > github.com/twbs/bootstrap.git", > {tag,"v3.0.2"}}, > [raw]} in > /home/lloyd/Erl/N2O/countach/deps/n2o_bootstrap > make: *** [get-deps] Error 1 > > > > > Any suggestions how to get past this? > > Many thanks, > > LRP > > > ********************************************* > My books: > > THE GOSPEL OF ASHES > http://thegospelofashes.com > > Strength is not enough. Do they have the courage > and the cunning? Can they survive long enough to > save the lives of millions? > > FREEIN' PANCHO > http://freeinpancho.com > > A community of misfits help a troubled boy find his way > > AYA TAKEO > http://ayatakeo.com > > Star-crossed love, war and power in an alternative > universe > > Available through Amazon or by request from your > favorite bookstore > > > ********************************************** > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From lloyd@REDACTED Fri May 2 19:02:26 2014 From: lloyd@REDACTED (lloyd@REDACTED) Date: Fri, 2 May 2014 13:02:26 -0400 (EDT) Subject: [erlang-questions] Crash dump while trying to install n2o Message-ID: <1399050146.02983180@apps.rackspace.com> Hello, Well, since I hit a wall trying to install synrc/countach, I set out to install n2o/samples following the directions here: 5HT/n2o. And here's the result: lloyd@REDACTED:~/Erl/N2O$ cd n2o lloyd@REDACTED:~/Erl/N2O/n2o$ cd samples lloyd@REDACTED:~/Erl/N2O/n2o/samples$ make && make console .... Compiled src/actions/action_wire.erl /home/lloyd/Erl/N2O/n2o/samples/deps/n2o/src/actions/action_jq.erl:5: Warning: variable 'F' is unused /home/lloyd/Erl/N2O/n2o/samples/deps/n2o/src/actions/action_jq.erl:11: Warning: variable 'A' shadowed in generate /home/lloyd/Erl/N2O/n2o/samples/deps/n2o/src/actions/action_jq.erl:15: Warning: variable 'F' is unused /home/lloyd/Erl/N2O/n2o/samples/deps/n2o/src/actions/action_jq.erl:22: Warning: variable 'F' is unused Compiled src/actions/action_jq.erl Compiled src/n2o_json.erl /home/lloyd/Erl/N2O/n2o/samples/deps/n2o/src/actions/action_event.erl:7: Warning: variable 'Actions' is unused Compiled src/actions/action_event.erl ... (and many more warnings as compilation continued) ... Compiled src/n2o_sup.erl /home/lloyd/Erl/N2O/n2o/samples/deps/n2o/src/elements/element_dtl.erl:8: Warning: variable 'File' is unused Compiled src/elements/element_dtl.erl ... Compiled priv/templates/index.html ==> apps (compile) ==> samples (compile) ./depman.erl kernel stdlib sasl sync gproc cowlib cowboy ranch erlydtl n2o n2o_sample > .applist ERL_LIBS=apps:deps erl -args_file rels/web/files/vm.args -config rels/web/files/sys.config -eval \ '[ok = application:ensure_started(A, permanent) || A <- Running Erlang [kernel,stdlib,sasl,sync,gproc,cowlib,crypto,ranch,cowboy,compiler,syntax_tools,erlydtl,n2o,n2o_sample]]' Erlang/OTP 17 [erts-6.0] [source] [64-bit] [smp:3:3] [async-threads:5] [hipe] [kernel-poll:true] Running Erlang {"init terminating in do_boot",{{badmatch,{error,{1,erl_parse,["syntax error before: ",["Erlang"]]}}},[{init,start_it,1,[]},{init,start_em,1,[]}]}} Crash dump was written to: erl_crash.dump init terminating in do_boot () make: *** [console] Error 1 lloyd@REDACTED:~/Erl/N2O/n2o/samples$ So, for now my journey into n2o is stalled until I can get past these installation issues. Any ideas? Many thanks, LRP ********************************************* My books: THE GOSPEL OF ASHES http://thegospelofashes.com Strength is not enough. Do they have the courage and the cunning? Can they survive long enough to save the lives of millions? FREEIN' PANCHO http://freeinpancho.com A community of misfits help a troubled boy find his way AYA TAKEO http://ayatakeo.com Star-crossed love, war and power in an alternative universe Available through Amazon or by request from your favorite bookstore ********************************************** From roger@REDACTED Fri May 2 20:01:03 2014 From: roger@REDACTED (Roger Lipscombe) Date: Fri, 2 May 2014 19:01:03 +0100 Subject: [erlang-questions] ERROR while installing synrc/countach In-Reply-To: References: <1399049410.983522592@apps.rackspace.com> Message-ID: You've got a version of rebar that doesn't support [raw]. Try a newer one. On 2 May 2014 17:53, Pierre Fenoll wrote: > Try with this url [1] instead of git://github.com/twbs/bootstrap.git. > I believe it is a repo's permissions issue. > > [1] https://github.com/twbs/bootstrap.git > > > Cheers, > -- > Pierre Fenoll > > > > On 2 May 2014 18:50, wrote: >> >> Hello, >> >> Just set out to install synrc/countach. make returned this error: >> >> lloyd@REDACTED:~/Erl/N2O/countach$ make >> ... >> Cloning into 'rest'... >> ==> cowboy (get-deps) >> Pulling cowlib from {git,"git://github.com/extend/cowlib.git","0.4.0"} >> Cloning into 'cowlib'... >> Pulling ranch from {git,"git://github.com/extend/ranch.git","0.9.0"} >> Cloning into 'ranch'... >> ==> cowlib (get-deps) >> ==> ranch (get-deps) >> ==> gproc (get-deps) >> ==> rest (get-deps) >> ERROR: Invalid dependency specification {bootstrap,".*", >> {git, >> >> "git://github.com/twbs/bootstrap.git", >> {tag,"v3.0.2"}}, >> [raw]} in >> /home/lloyd/Erl/N2O/countach/deps/n2o_bootstrap >> make: *** [get-deps] Error 1 >> >> >> >> >> Any suggestions how to get past this? >> >> Many thanks, >> >> LRP >> >> >> ********************************************* >> My books: >> >> THE GOSPEL OF ASHES >> http://thegospelofashes.com >> >> Strength is not enough. Do they have the courage >> and the cunning? Can they survive long enough to >> save the lives of millions? >> >> FREEIN' PANCHO >> http://freeinpancho.com >> >> A community of misfits help a troubled boy find his way >> >> AYA TAKEO >> http://ayatakeo.com >> >> Star-crossed love, war and power in an alternative >> universe >> >> Available through Amazon or by request from your >> favorite bookstore >> >> >> ********************************************** >> >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://erlang.org/mailman/listinfo/erlang-questions > > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > From lloyd@REDACTED Sat May 3 00:21:29 2014 From: lloyd@REDACTED (lloyd@REDACTED) Date: Fri, 2 May 2014 18:21:29 -0400 (EDT) Subject: [erlang-questions] ERROR while installing synrc/countach In-Reply-To: References: Message-ID: <1399069289.861532748@apps.rackspace.com> Hi Maxim, I've tried with both https://github.com/proger/rebar as suggested in countach GitHub page and with basho/rebar. We get well along in the compile stage but hit this: lloyd@REDACTED:~/Erl/N2O/countach$ make ... Compiled src/static_file.erl Compiled src/wf_render_elements.erl /home/lloyd/Erl/N2O/countach/deps/n2o/src/wf_render_actions.erl:12: Warning: variable 'A' is unused Compiled src/wf_render_actions.erl ==> n2o_bootstrap (compile) Compiled src/n2o_bootstrap_sup.erl /home/lloyd/Erl/N2O/countach/deps/n2o_bootstrap/include/wf.hrl:7: record carousel already defined /home/lloyd/Erl/N2O/countach/deps/n2o_bootstrap/include/wf.hrl:8: record accordion already defined /home/lloyd/Erl/N2O/countach/deps/n2o_bootstrap/include/wf.hrl:9: record slider already defined /home/lloyd/Erl/N2O/countach/deps/n2o_bootstrap/include/wf.hrl:12: record rtable already defined /home/lloyd/Erl/N2O/countach/deps/n2o_bootstrap/include/wf.hrl:13: record upload_state already defined /home/lloyd/Erl/N2O/countach/deps/n2o_bootstrap/include/wf.hrl:15: record upload already defined /home/lloyd/Erl/N2O/countach/deps/n2o_bootstrap/include/wf.hrl:16: record textboxlist already defined /home/lloyd/Erl/N2O/countach/deps/n2o_bootstrap/include/wf.hrl:17: record htmlbox already defined ERROR: compile failed while processing /home/lloyd/Erl/N2O/countach/deps/n2o_bootstrap: rebar_abort make: *** [compile] Error 1 Three questions: 1. I have the new rebar in my code path, but I also tried, as an experiment, placing it in countach$. Am I doing anything wrong here? 2. Compile seems to produce many warnings. Are these expected? Or symptomatic of some other problem? 3. How can I bring this puppy home? Thanks to all, Lloyd -----Original Message----- From: "Maxim Sokhatsky" Sent: Friday, May 2, 2014 4:44pm To: "lloyd@REDACTED" Subject: RE: ERROR while installing synrc/countach You are using wrong rebar. Yours doesn't raw keyword. Nothing with N2O here. Sent from my Lumia 920 ________________________________ From: lloyd@REDACTED Sent: ?5/?2/?2014 19:50 To: Erlang Questions Cc: Maxim Sokhatsky Subject: ERROR while installing synrc/countach Hello, Just set out to install synrc/countach. make returned this error: lloyd@REDACTED:~/Erl/N2O/countach$ make ... Cloning into 'rest'... ==> cowboy (get-deps) Pulling cowlib from {git,"git://github.com/extend/cowlib.git","0.4.0"} Cloning into 'cowlib'... Pulling ranch from {git,"git://github.com/extend/ranch.git","0.9.0"} Cloning into 'ranch'... ==> cowlib (get-deps) ==> ranch (get-deps) ==> gproc (get-deps) ==> rest (get-deps) ERROR: Invalid dependency specification {bootstrap,".*", {git, "git://github.com/twbs/bootstrap.git", {tag,"v3.0.2"}}, [raw]} in /home/lloyd/Erl/N2O/countach/deps/n2o_bootstrap make: *** [get-deps] Error 1 Any suggestions how to get past this? Many thanks, LRP ********************************************* My books: THE GOSPEL OF ASHES http://thegospelofashes.com Strength is not enough. Do they have the courage and the cunning? Can they survive long enough to save the lives of millions? FREEIN' PANCHO http://freeinpancho.com A community of misfits help a troubled boy find his way AYA TAKEO http://ayatakeo.com Star-crossed love, war and power in an alternative universe Available through Amazon or by request from your favorite bookstore ********************************************** From a.shneyderman@REDACTED Sat May 3 04:41:49 2014 From: a.shneyderman@REDACTED (Alex Shneyderman) Date: Fri, 2 May 2014 22:41:49 -0400 Subject: [erlang-questions] Unable to build hipe enabled VM on trusty. Message-ID: I am trying to build with hipe enabled and for some reason it does not work for me. The status line shows no hipe. I configure like so: ./configure --enable-hipe --enable-kernel-poll --enable-m64-build do a make and 22:41:02 alex@REDACTED > bin/erl Erlang R16B02 (erts-5.10.3) [source] [64-bit] [smp:8:8] [async-threads:10] [kernel-poll:false] Eshell V5.10.3 (abort with ^G) Any ideas on why this might be? Cheers, Alex. From steven.charles.davis@REDACTED Sat May 3 15:56:24 2014 From: steven.charles.davis@REDACTED (Steve Davis) Date: Sat, 3 May 2014 06:56:24 -0700 (PDT) Subject: [erlang-questions] Erlang, WSDL, SOAP. In-Reply-To: <5363B383.4030404@gmail.com> References: <97d34f5f-ddbb-4e5c-8517-4857d03fc8da@googlegroups.com> <5363B383.4030404@gmail.com> Message-ID: <8b4ae47a-6311-4539-91c6-aabeb87fa247@googlegroups.com> Hi Christy, That's pretty good advice for creating new web services. But then every implementation then becomes a new, custom design task. I was proposing that solving those two infrastructural problems (xmlns/xs) in a more generic way could make interoperability a little easier. I'd really like to "black box" the xml part into some standard transformation/codec and then largely forget about the details. That could I think do most of the heavy lifting with respect to creating direct replacements for existing services or creating clients to integrate with existing ones. It's certainly possible that I'm wrong about this. I suspect that java bindings end up looking like a mess because the data structures produced by xml are kind of inherently messy and over-complex already... so maybe any effort to create bindings is going to end up a mess? Regards, Steve On Friday, May 2, 2014 10:02:27 AM UTC-5, Christy Watson wrote: > > I'm an erlang newbe, but even with java ee and code generation based on > a wsdl. The actual mapping to the objects must be done by the > programmer, and is a mess. The wsdl concept is great, I just think the > standard is to overly complicate the implementation. Remember all a > wsdl is for is to say to the user of the service "if you send me > __________ I'll send you ____________ back". So others have > auto-generated themselves into a mess. Ask yourself what you really > need to do to get from input to output, then map your algorithm... > you'll probably end up with a much more efficient piece of software than > an auto-generated jaxWS mess. > > > On 04/30/2014 08:17 PM, Steve Davis wrote: > > has been that the issues surrounding web services are not the WSDL but > > resolving other technologies that it uses: i.e. the resolution of > > namespace mapping and schema analysis. > > > > 1) It's pretty obvious that namespaces (aka packages, etc) introduce > > many indirection concerns (consider the earlier experiment in erlang > > with module "packages"). > > > > 2) The issue with xml schema seems to be the underlying DTD > > _______________________________________________ > erlang-questions mailing list > erlang-q...@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From kostis@REDACTED Sat May 3 16:31:18 2014 From: kostis@REDACTED (Kostis Sagonas) Date: Sat, 03 May 2014 16:31:18 +0200 Subject: [erlang-questions] Unable to build hipe enabled VM on trusty. In-Reply-To: References: Message-ID: <5364FDB6.2010207@cs.ntua.gr> On 05/03/2014 04:41 AM, Alex Shneyderman wrote: > I am trying to build with hipe enabled and for some reason it does not > work for me. The status line shows no hipe. I configure like so: > > ./configure --enable-hipe --enable-kernel-poll --enable-m64-build > do a make > and > > 22:41:02 alex@REDACTED > bin/erl > Erlang R16B02 (erts-5.10.3) [source] [64-bit] [smp:8:8] > [async-threads:10] [kernel-poll:false] > > Any ideas on why this might be? I think something is not OK in your system. Under normal circumstances (i.e. on a properly set up system), at least on an x86_64/amd64-based machine running Ubuntu, HiPE will be enabled by default so you do not need the --enable-hipe flag. (And you would not need to specify --enable-m64-build either.) I recommend getting a fresh tar ball (*) and executing the following sequence of commands: ./otp_build autoconf ./configure make # add -j too if you want And tell us what happened. Kostis (*) By the way, why did you choose R16B02 instead of a newer system like R16B03-1 if not 17.0 ? From eriksoe@REDACTED Sat May 3 18:46:16 2014 From: eriksoe@REDACTED (=?UTF-8?Q?Erik_S=C3=B8e_S=C3=B8rensen?=) Date: Sat, 3 May 2014 18:46:16 +0200 Subject: [erlang-questions] Visual Erlang notation v0.1.0 - feedback request In-Reply-To: References: Message-ID: It looks good - and appears to incorporate appropriate Erlang idioms. I will try it out at the next whiteboard design discussion :-) There is one thing that bugs me, though: The representation of links as a dual monitor (or, equivalently, of monitors as one-way links). The notation has the nice property that to see which other processes are affected when a given process dies, you simply look for circles around that process. That's good. But there are several differences between monitors and links: - the relation is asymmetric; - link behaviour is affected by trap_exit, monitor behaviour isn't; - links propagate exits, monitors don't; - reason 'normal' is special to links (when not trap_exit'ed). (And of course, the message format is different.) All in all, I believe we might be better off with a slightly different notation for monitors - say, a single-line-with-circle. Am I making sufficient sense? /Erik Den 02/05/2014 09.22 skrev "Torben Hoffmann" < torben.hoffmann@REDACTED>: > Hi, > > As I have mentioned before I have been working on a visual notation for > Erlang and > although it is not complete yet I have received requests to release it > anyway, so > here goes... > > https://github.com/esl/visual_erlang > > One extra thing missing from the to-do list is state data for processes. > > I would like some feedback on how you feel the abstraction level is. > The purpose of Visual Erlang is not to be able to specify every little > detail of what > happens in an Erlang program, but to give a way to describe the > architecture. > > Once I have updated the Erlang Concurrency Patterns that Jesper and I have > been > working on to the new Visual Erlang notation we will release them as well. > > The original plan for the patterns was to use Object-Process Methodology > as the > notation, but I was adviced (and thanks for that) to invent an Erlang > specific > notation since OPM has some corners that hurts for Erlang. > > Right now the only way to draw Visual Erlang diagrams is by hand or use > the LaTeX > macros I have created, but since Visual Erlang has a 1:1 mapping between > the visuals > and a textual notation my hope is that we can create a tool that can > create a diagram > from the textual notation. > > Going even further I dream of having a tool that extracts the Visual > Erlang notation > from the code in an interactive manner, where the user can guide what to > abstract and > what to just leave totally out. > > Cheers, > Torben > -- > Torben Hoffmann > CTO > Erlang Solutions Ltd. > Tel: +45 25 14 05 38 > http://www.erlang-solutions.com > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From yoursurrogategod@REDACTED Sat May 3 23:37:58 2014 From: yoursurrogategod@REDACTED (Yves S. Garret) Date: Sat, 3 May 2014 17:37:58 -0400 Subject: [erlang-questions] How would I trace how an application runs across several processes? Message-ID: Hello, Recently I've started a book called "Handbook of Neuroevolution through Erlang". I love the book. However, when it comes to wrapping my head about the nuts and bolts of the code written in the book, I'm finding this to be a rather difficult thing to do. Basically, when I start up the project, I get about 10+ processes running. It's rather difficult for me to visualize in my head how they all communicate and get along. There are a lot of questions in my head along the lines of "If I wanted to change this input from an integer to an atom, would the app choke? Where would it fail? Why would it fail?". When you're writing an app with just one thread, this is -- comparatively -- easier to take apart. However, when you have multiple processes, the task seems to be exponentially increasing in complexity. My question is this: What strategies and tools do you use to look at existing code and figure out how it works? Secondly, I'm not terribly happy with the existing debugger in Erlang and would love to know more about how the Erlang VM works. What source should I look into? I've heard of a specific book, is it Joe Armstrong's Programming Erlang? I'm obviously new to the VM and would like to gain understanding of how it works over time. Thanks in advance, --Yves -------------- next part -------------- An HTML attachment was scrubbed... URL: From jpsiyu@REDACTED Sun May 4 05:45:08 2014 From: jpsiyu@REDACTED (=?GBK?B?zunLvNPu?=) Date: Sun, 4 May 2014 11:45:08 +0800 (CST) Subject: [erlang-questions] How would I trace how an application runs across several processes? In-Reply-To: References: Message-ID: <4c891452.dd38.145c555d833.Coremail.jpsiyu@163.com> I think the trace/3 and dbg:tracer() method will helps. They can show us which method was called. At 2014-05-04 05:37:58,"Yves S. Garret" wrote: Hello, Recently I've started a book called "Handbook of Neuroevolution through Erlang". I love the book. However, when it comes to wrapping my head about the nuts and bolts of the code written in the book, I'm finding this to be a rather difficult thing to do. Basically, when I start up the project, I get about 10+ processes running. It's rather difficult for me to visualize in my head how they all communicate and get along. There are a lot of questions in my head along the lines of "If I wanted to change this input from an integer to an atom, would the app choke? Where would it fail? Why would it fail?". When you're writing an app with just one thread, this is -- comparatively -- easier to take apart. However, when you have multiple processes, the task seems to be exponentially increasing in complexity. My question is this: What strategies and tools do you use to look at existing code and figure out how it works? Secondly, I'm not terribly happy with the existing debugger in Erlang and would love to know more about how the Erlang VM works. What source should I look into? I've heard of a specific book, is it Joe Armstrong's Programming Erlang? I'm obviously new to the VM and would like to gain understanding of how it works over time. Thanks in advance, --Yves -------------- next part -------------- An HTML attachment was scrubbed... URL: From jani.j.hakala@REDACTED Sun May 4 09:08:31 2014 From: jani.j.hakala@REDACTED (Jani Hakala) Date: Sun, 04 May 2014 10:08:31 +0300 Subject: [erlang-questions] Unable to build hipe enabled VM on trusty. In-Reply-To: (Alex Shneyderman's message of "Fri, 2 May 2014 22:41:49 -0400") References: Message-ID: <87bnverpg0.fsf@pingviini.dy.fi> Alex Shneyderman writes: > I am trying to build with hipe enabled and for some reason it does not > work for me. The status line shows no hipe. I configure like so: > > ./configure --enable-hipe --enable-kernel-poll --enable-m64-build > do a make > and > You could try issuing commands sudo apt-get build-dep erlang sudo apt-get install libwxgtk2.8-dev before building. I tested building deb-packages of OTP R16B03-1 on trusty, here is how I did it: sudo apt-get build-dep erlang sudo apt-get install build-essential sudo apt-get install fakeroot sudo apt-get install libwxgtk2.8-dev sudo apt-get install subversion svn checkout svn://svn.debian.org/svn/pkg-erlang/erlang/tags/1:16.b.3.1-dfsg-3~bpo70+1/ cd 1:16.b.3.1-dfsg-3~bpo70+1/ make -f debian/rules get-orig-source mv erlang_16.b.3.1-dfsg.orig.tar.xz .. cd .. tar xf erlang_16.b.3.1-dfsg.orig.tar.xz cd otp_src_R16B03-1 cp -r ../1:16.b.3.1-dfsg-3~bpo70+1/debian/ . dpkg-buildpackage -rfakeroot -uc -us Jani Hakala From lcastro@REDACTED Sun May 4 10:46:07 2014 From: lcastro@REDACTED (Laura M. Castro) Date: Sun, 4 May 2014 10:46:07 +0200 Subject: [erlang-questions] Final Call For Papers: Erlang Workshop 2014 Message-ID: Hello all, Please find below the Final Call for Papers for the Thirteenth ACM SIGPLAN Erlang Workshop. Apologies for any duplicates you may receive. FINAL CALL FOR PAPERS ==================== Thirteenth ACM SIGPLAN Erlang Workshop ----------------------------------------------------------- G?teborg, Sweden, September 5, 2014 Satellite event of the 19th ACM SIGPLAN International Conference on Functional Programming (ICFP 2014) September 1-3, 2014 http://www.erlang.org/workshop/2014 Erlang is a concurrent, distributed functional programming language aimed at systems with requirements of massive concurrency, soft real time response, fault tolerance, and high availability. It has been available as open source for 15 years, creating a community that actively contributes to its already existing rich set of libraries and applications. Originally created for telecom applications, its usage has spread to other domains including e-commerce, banking, databases, and computer telephony and messaging. Erlang programs are today among the largest applications written in any functional programming language. These applications offer new opportunities to evaluate functional programming and functional programming methods on a very large scale and suggest new problems for the research community to solve. This workshop will bring together the open source, academic, and industrial programming communities of Erlang. It will enable participants to familiarize themselves with recent developments on new techniques and tools tailored to Erlang, novel applications, draw lessons from users' experiences and identify research problems and common areas relevant to the practice of Erlang and functional programming. We invite three types of submissions. 1. Technical papers describing language extensions, critical discussions of the status quo, formal semantics of language constructs, program analysis and transformation, virtual machine extensions and compilation techniques, implementations and interfaces of Erlang in/with other languages, and new tools (profilers, tracers, debuggers, testing frameworks, etc.). The maximum length for technical papers is restricted to 12 pages. 2. Practice and application papers describing uses of Erlang in the "real-world", Erlang libraries for specific tasks, experiences from using Erlang in specific application domains, reusable programming idioms and elegant new ways of using Erlang to approach or solve a particular problem. The maximum length for the practice and application papers is restricted to 12 pages. Note that this is a maximum length; we welcome shorter papers also, and the program committee will evaluate all papers on an equal basis independent of their lengths. 3. Poster presentations describing topics related to the workshop goals. Each includes a maximum of 2 pages of the abstract and summary. Presentations in this category will be given an hour of shared simultaneous demonstration time. Workshop Co-Chairs ------------------ Laura M. Castro, University of A Coru?a, Spain Hans Svensson, QuviQ AB, Sweden Program Committee ----------------------------- (Note: the Workshop Co-Chairs are also committee members) Jesper L. Andersen, Erlang Solutions Ltd., UK Richard Carlsson, Klarna AB, Sweden Lars-?ke Fredlund, Universidad Polit?cnica de Madrid, Spain Fr?d H?bert, Heroku, USA Kostis Sagonas, Uppsala University, Sweden & NTUA, Greece Simon Thompson, University of Kent, UK Steve Vinoski, Basho Technologies, USA Philip Wadler, University of Edinburgh, UK Important Dates ----------------------- Submissions due: Sunday, 11 May, 2014 Author notification: Friday, 6 June, 2014 Final copy due: Sunday, 22 June, 2014 Workshop date: September 5, 2014 Instructions to authors -------------------------------- Papers must be submitted online via EasyChair (via the "Erlang2014" event). The submission page is https://www.easychair.org/conferences/?conf=erlang2014 Submitted papers should be in portable document format (PDF), formatted using the ACM SIGPLAN style guidelines. Each submission must adhere to SIGPLAN's republication policy. Violation risks summary rejection of the offending submission. Accepted papers will be published by the ACM and will appear in the ACM Digital Library. Paper submissions will be considered for poster submission in the case they are not accepted as full papers. Venue & Registration Details ------------------------------------------ For registration, please see the ICFP 2014 web site at: http://icfpconference.org/icfp2014/ Related Links -------------------- ICFP 2014 web site: http://www.icfpconference.org/icfp2014/ Past ACM SIGPLAN Erlang workshops: http://www.erlang.org/workshop/ Open Source Erlang: http://www.erlang.org/ EasyChair submission site: https://www.easychair.org/conferences/?conf=erlang2014 Author Information for SIGPLAN Conferences: http://www.sigplan.org/authorInformation.htm Atendee Information for SIGPLAN Events: http://www.sigplan.org/Resources/Policies/Anti-harassment -- Laura M. Castro Department of Computer Science Universidade da Coru?a (Spain) http://www.madsgroup.org/staff/laura From s.j.thompson@REDACTED Sun May 4 11:49:07 2014 From: s.j.thompson@REDACTED (Simon Thompson) Date: Sun, 4 May 2014 10:49:07 +0100 Subject: [erlang-questions] Fwd: SBLP 2014 new deadline References: <201405031440.s43EeLbG002505@easychair.org> Message-ID: CALL FOR PAPERS - NEW DEADLINE: May 23rd 18th Brazilian Symposium on Programming Languages (SBLP 2014) A member of CBSoft joint conference http://www.ic.ufal.br/evento/cbsoft2014/ to be held in Maceio, Brazil. SBLP happens on Thursday, Oct 2nd, and Friday, Oct 3rd. CBSoft dates are September 28, 2014 to October 3, 2014 This CFP is also available at the webpage of the event: http://www.ic.ufal.br/evento/cbsoft2014/en/call-for-papers-sblp.html IMPORTANT DATES Paper abstract submission: May 23rd, 2014 Full paper submission: May 23rd, 2014 Notification of acceptance: June 27th, 2014 Final papers due: July 11th, 2014 INTRODUCTION The 18th Brazilian Symposium on Programming Languages, SBLP 2014, will be held in Maceio, a beautiful city in the Northeastern part of Brazil. The conference will happen on October 2nd, and October 3rd, 2014. SBLP provides a venue for researchers and practitioners interested in the fundamental principles and innovations in the design and implementation of programming languages and systems. SBLP 2014 invites authors to contribute with technical papers related (but not limited) to: * Program generation and transformation, including domain-specific languages and model-driven development in the context of programming languages. * Programming paradigms and styles, including functional, object-oriented, aspect-oriented, scripting languages, real-time, service-oriented, multithreaded, parallel, and distributed programming. * Formal semantics and theoretical foundations, including denotational, operational, algebraic and categorical. * Program analysis and verification, including type systems, static analysis and abstract interpretation. * Programming language design and implementation, including new programming models, programming language environments, compilation and interpretation techniques. SUBMISSIONS Contributions should be written in Portuguese or English. Papers should fall into one of two different categories: full papers, with at most 15 pages, or short papers, with at most 5 pages. Accepted papers written in English will be published in a volume of Lecture Notes in Computer Science (LNCS), by Springer. For this reason, all papers must be prepared using the LNCS template, available at http://www.springer.com/computer/lncs?SGWID=0-164-6-793341-0. We encourage the submission of short papers reporting partial results of on-going master dissertations or doctoral theses. Submissions should be done through the SBLP 2014 page at EasyChair, which is available at http://www.easychair.org/conferences/?conf=sblp2014. As in previous editions, a journal's special issue, with selected papers from accepted contributions, is anticipated. Selected papers from the 2003 to the 2008 editions of SBLP were published in special issues of the Journal of Universal Computer Science, by Springer. The post-proceedings of SBLP from 2009 to 2012, also with selected papers from the conference, have been published as special issues of Science of Computer Programming, by Elsevier. KEYNOTE SPEAKERS Louis-Noel Pouchet, University of California Los Angeles Fabrice Rastello, INRIA PROGRAMME CHAIR Fernando Magno Quintao Pereira, UFMG PROGRAMME COMMITTEE Alberto Pardo, Universidad de la Republica Alex Garcia, IME Alvaro Moreira, Federal University of Rio Grande do Sul Andre Rauber Du Bois, Federal University of Pelotas Carlos Camar??o, Federal University of Minas Gerais Christiano Braga, Fluminense Federal University Fabio Mascarenhas, Federal University of Rio de Janeiro Fabrice Rastello, INRIA Fernando Pereira, Federal University of Minas Gerais Fernando Castor, Federal University of Pernambuco Francisco Carvalho-Junior, Federal University of Ceara Hans-Wolfgang Loidl, Heriot-Watt University Jeremy Singer University of Glasgow Jo??o Saraiva, University of Minho Joao F. Ferreira, Teesside University Louis-Noel Pouchet, University of California, Los Angeles Lucilia Figueiredo, Federal University of Ouro Preto Luis Barbosa, University of Minho Manuel A. Martins, University of Aveiro Marcello Bonsangue, Leiden University Marcelo Maia, Federal University of Uberlandia Marcelo D'Amorim, Federal University of Pernambuco Mariza Bigonha, Federal University of Minas Gerais Martin Musicante, Federal University of Rio Grande do Norte Noemi Rodriguez, PUC-Rio Peter Mosses, Swansea University Rafael Lins, Federal University of Pernambuco Renato Cerqueira, PUC-Rio Roberto Bigonha, Federal University of Minas Gerais Roberto Ierusalimschy PUC-Rio Rodrigo Geraldo, Federal University of Ouro Preto Sandro Rigo, State University of Campinas Sergio Medeiros, Federal University of Rio Grande do Norte Simon Thompson, University of Kent Varmo Vene, University of Tartu Zongyan Qiu Peking University Simon Thompson | Professor of Logic and Computation School of Computing | University of Kent | Canterbury, CT2 7NF, UK s.j.thompson@REDACTED | M +44 7986 085754 | W www.cs.kent.ac.uk/~sjt From n.oxyde@REDACTED Sun May 4 12:01:16 2014 From: n.oxyde@REDACTED (Anthony Ramine) Date: Sun, 4 May 2014 12:01:16 +0200 Subject: [erlang-questions] Making use of GitHub's issues Message-ID: <0B061C98-CDCF-4E7F-BD30-144D90FE638D@gmail.com> Hello, Some of you might know that I enjoy fixing compiler bugs and more generally hacking on OTP. I decided to make use of my Github?s fork?s issues to reference bugs I have yet to fix, bugs I have discovered and in a very short future any long-term thing that I am doing, like ?cond?, &&-generators or the Clang-like diagnostics I want to make. https://github.com/nox/otp/issues I hope this may increase the number of third-party contributors to OTP, or at least provide a way for people feeling adventurous to get involved. Regards, -- Anthony Ramine From vladdu55@REDACTED Sun May 4 13:50:39 2014 From: vladdu55@REDACTED (Vlad Dumitrescu) Date: Sun, 4 May 2014 13:50:39 +0200 Subject: [erlang-questions] Visual Erlang notation v0.1.0 - feedback request In-Reply-To: References: Message-ID: Hi Torben, This is a cool initiative and looks good for a first draft! There are always new requirements that pop up afterwards. Is there some documentation for the textual representation? regards, Vlad On Fri, May 2, 2014 at 9:21 AM, Torben Hoffmann < torben.hoffmann@REDACTED> wrote: > Hi, > > As I have mentioned before I have been working on a visual notation for > Erlang and > although it is not complete yet I have received requests to release it > anyway, so > here goes... > > https://github.com/esl/visual_erlang > > One extra thing missing from the to-do list is state data for processes. > > I would like some feedback on how you feel the abstraction level is. > The purpose of Visual Erlang is not to be able to specify every little > detail of what > happens in an Erlang program, but to give a way to describe the > architecture. > > Once I have updated the Erlang Concurrency Patterns that Jesper and I have > been > working on to the new Visual Erlang notation we will release them as well. > > The original plan for the patterns was to use Object-Process Methodology > as the > notation, but I was adviced (and thanks for that) to invent an Erlang > specific > notation since OPM has some corners that hurts for Erlang. > > Right now the only way to draw Visual Erlang diagrams is by hand or use > the LaTeX > macros I have created, but since Visual Erlang has a 1:1 mapping between > the visuals > and a textual notation my hope is that we can create a tool that can > create a diagram > from the textual notation. > > Going even further I dream of having a tool that extracts the Visual > Erlang notation > from the code in an interactive manner, where the user can guide what to > abstract and > what to just leave totally out. > > Cheers, > Torben > -- > Torben Hoffmann > CTO > Erlang Solutions Ltd. > Tel: +45 25 14 05 38 > http://www.erlang-solutions.com > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From torben.hoffmann@REDACTED Mon May 5 10:32:05 2014 From: torben.hoffmann@REDACTED (Torben Hoffmann) Date: Mon, 05 May 2014 10:32:05 +0200 Subject: [erlang-questions] Visual Erlang notation v0.1.0 - feedback request In-Reply-To: References: Message-ID: Garrett Smith writes: > Hi Torben, > > On Fri, May 2, 2014 at 2:21 AM, Torben Hoffmann > wrote: >> Hi, >> >> As I have mentioned before I have been working on a visual notation for Erlang and >> although it is not complete yet I have received requests to release it anyway, so >> here goes... >> >> https://github.com/esl/visual_erlang >> >> One extra thing missing from the to-do list is state data for processes. >> >> I would like some feedback on how you feel the abstraction level is. >> The purpose of Visual Erlang is not to be able to specify every little detail of what >> happens in an Erlang program, but to give a way to describe the architecture. > > Love this! > Thanks! > My hopefully constructive input though... I think you ought to be > easier on folks who don't use fancy graphics editors :) > That's the first time I have heard LaTeX being called a fancy graphics editor ;-) > I (and the folks I work with) tend to use Google presentations to put > together visual diagrams. It's quite a handy program. Unfortunately > you can't do a few things that you require: > > - Squiggly lines > - Double lines > > But you can do: > > - Lots of different line endings (circles, squares, triangles) > - Dashed lines > - Dash-dotted lines > - Thick and thin lines > > Unless you have a religious point of view when it comes to squiggles > (I hear this is a thing) I'd recommend tweaking the symbols to widen > the tent for drawing tools :) > I'm not religious about squiggles, but I had a reason for using squiggles for message passing: I want to encourage using module APIs to send messages around. It is rare that you need to send messages directly, so the symbol for that should stand out and the easy straight line be used for calling an API function. But I am very open to finding ways to make this distinction come out, so perhaps one could use dashed lines for message passing? Another criteria is that it should be easy to write the Visual Erlang diagrams on a whiteboard. I find squiggles easier than dashed lines, but that could be my preference - dashed lines are not impossible. Thick and thin lines are really hard on a whiteboard. I will ponder a bit over this in conjunction with some of the other feedback, so please follow this thread! > I also recommend putting together some PNGs and including them as > images in the README so people can see what's going on at a glance > from the github page without downloading the PDF. But this a nice to > have. > I didn't know that one could include PNGs in the README on github - do you have an example of how this is done? Very cool idea! > Can't wait for the Patterns In Erlang book! (But who's in the GoF?) > So far it is only a dynamic duo: Jesper and me. Gang of anything sounds so last century - need to find something cooler. Dynamic duo also has an oldish feel to it, mind you ;-) We will start with getting Erlang patterns documented - if it turns into something that people want in book form it might happen. Thanks for the feedback! Torben > Garrett -- Torben Hoffmann CTO Erlang Solutions Ltd. Tel: +45 25 14 05 38 http://www.erlang-solutions.com From torben.hoffmann@REDACTED Mon May 5 10:37:30 2014 From: torben.hoffmann@REDACTED (Torben Hoffmann) Date: Mon, 05 May 2014 10:37:30 +0200 Subject: [erlang-questions] Visual Erlang notation v0.1.0 - feedback request In-Reply-To: References: Message-ID: Vlad Dumitrescu writes: > Hi Torben, > > This is a cool initiative and looks good for a first draft! There are > always new requirements that pop up afterwards. > Thank you! I wanted to get some early indications instead of spending months in my ivory tower thinking about how to unleash greatness on the surface of the earth. Iterative releasing has a greater chance of going somewhere... at least I hope so. > Is there some documentation for the textual representation? > Not yet. Right now it is too much in a flux to write up a grammar for the textual representation. I feel that it is most important to get the visuals down with a rough draft of what the textual counter part should be and then we can move on to a more rigorous specification of the textual format. But I would be interested to hear what would be a good format for the grammar. Should it be an antrl grammar? Or a PEG for Neotoma? Or??? Cheers, Torben > regards, > Vlad > > > > On Fri, May 2, 2014 at 9:21 AM, Torben Hoffmann < > torben.hoffmann@REDACTED> wrote: > >> Hi, >> >> As I have mentioned before I have been working on a visual notation for >> Erlang and >> although it is not complete yet I have received requests to release it >> anyway, so >> here goes... >> >> https://github.com/esl/visual_erlang >> >> One extra thing missing from the to-do list is state data for processes. >> >> I would like some feedback on how you feel the abstraction level is. >> The purpose of Visual Erlang is not to be able to specify every little >> detail of what >> happens in an Erlang program, but to give a way to describe the >> architecture. >> >> Once I have updated the Erlang Concurrency Patterns that Jesper and I have >> been >> working on to the new Visual Erlang notation we will release them as well. >> >> The original plan for the patterns was to use Object-Process Methodology >> as the >> notation, but I was adviced (and thanks for that) to invent an Erlang >> specific >> notation since OPM has some corners that hurts for Erlang. >> >> Right now the only way to draw Visual Erlang diagrams is by hand or use >> the LaTeX >> macros I have created, but since Visual Erlang has a 1:1 mapping between >> the visuals >> and a textual notation my hope is that we can create a tool that can >> create a diagram >> from the textual notation. >> >> Going even further I dream of having a tool that extracts the Visual >> Erlang notation >> from the code in an interactive manner, where the user can guide what to >> abstract and >> what to just leave totally out. >> >> Cheers, >> Torben >> -- >> Torben Hoffmann >> CTO >> Erlang Solutions Ltd. >> Tel: +45 25 14 05 38 >> http://www.erlang-solutions.com >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://erlang.org/mailman/listinfo/erlang-questions >> -- Torben Hoffmann CTO Erlang Solutions Ltd. Tel: +45 25 14 05 38 http://www.erlang-solutions.com From torben.hoffmann@REDACTED Mon May 5 10:59:18 2014 From: torben.hoffmann@REDACTED (Torben Hoffmann) Date: Mon, 05 May 2014 10:59:18 +0200 Subject: [erlang-questions] Visual Erlang notation v0.1.0 - feedback request In-Reply-To: References: Message-ID: Erik S?e S?rensen writes: > It looks good - and appears to incorporate appropriate Erlang idioms. > I will try it out at the next whiteboard design discussion :-) > Great - let me know how that works! > There is one thing that bugs me, though: The representation of links as a > dual monitor (or, equivalently, of monitors as one-way links). > The notation has the nice property that to see which other processes are > affected when a given process dies, you simply look for circles around that > process. That's good. Thanks - that was the intention. > But there are several differences between monitors and links: > - the relation is asymmetric; > - link behaviour is affected by trap_exit, monitor behaviour isn't; > - links propagate exits, monitors don't; > - reason 'normal' is special to links (when not trap_exit'ed). > (And of course, the message format is different.) > You're right. I was unsure about how detailed this part should be, which was one of my reasons for seeking feedback sooner rather than later. > All in all, I believe we might be better off with a slightly different > notation for monitors - say, a single-line-with-circle. > > Am I making sufficient sense? > You are making a lot of sense. If I combine this with the request from Garrett, i.e., to make the notation more Google presentation friendly we could do this: * Use single line with open circle for monitors. * Use single line with filled circle for links. * Use single line with filled triangle style arrow head for spawn. * Use dashed lines with open triangle style arrow head for message passing. * Use dotted lines with open triangle style arrow head for exit signals. Still not sure if we need a special notation for dealing with exit signals that are being trapped. One could enforce that 'DOWN' has to be added to the message being passed when a process is trapping exits. Thoughts on all of this most welcome. Cheers, Torben > /Erik > Den 02/05/2014 09.22 skrev "Torben Hoffmann" < > torben.hoffmann@REDACTED>: > >> Hi, >> >> As I have mentioned before I have been working on a visual notation for >> Erlang and >> although it is not complete yet I have received requests to release it >> anyway, so >> here goes... >> >> https://github.com/esl/visual_erlang >> >> One extra thing missing from the to-do list is state data for processes. >> >> I would like some feedback on how you feel the abstraction level is. >> The purpose of Visual Erlang is not to be able to specify every little >> detail of what >> happens in an Erlang program, but to give a way to describe the >> architecture. >> >> Once I have updated the Erlang Concurrency Patterns that Jesper and I have >> been >> working on to the new Visual Erlang notation we will release them as well. >> >> The original plan for the patterns was to use Object-Process Methodology >> as the >> notation, but I was adviced (and thanks for that) to invent an Erlang >> specific >> notation since OPM has some corners that hurts for Erlang. >> >> Right now the only way to draw Visual Erlang diagrams is by hand or use >> the LaTeX >> macros I have created, but since Visual Erlang has a 1:1 mapping between >> the visuals >> and a textual notation my hope is that we can create a tool that can >> create a diagram >> from the textual notation. >> >> Going even further I dream of having a tool that extracts the Visual >> Erlang notation >> from the code in an interactive manner, where the user can guide what to >> abstract and >> what to just leave totally out. >> >> Cheers, >> Torben >> -- >> Torben Hoffmann >> CTO >> Erlang Solutions Ltd. >> Tel: +45 25 14 05 38 >> http://www.erlang-solutions.com >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://erlang.org/mailman/listinfo/erlang-questions >> -- Torben Hoffmann CTO Erlang Solutions Ltd. Tel: +45 25 14 05 38 http://www.erlang-solutions.com From vladdu55@REDACTED Mon May 5 11:15:26 2014 From: vladdu55@REDACTED (Vlad Dumitrescu) Date: Mon, 5 May 2014 11:15:26 +0200 Subject: [erlang-questions] Visual Erlang notation v0.1.0 - feedback request In-Reply-To: References: Message-ID: Hi, Just a thought that connects with the patterns discussion: linking to another process is usually permanent, that is we don't unlink from it. Process monitoring can be more dynamic. In any case, it is possible to have links/monitors that are dynamic and thus runtime properties. IMHO, one might want to handle these differently than the static ones. On the other hand, this might be an anti-pattern? regards, Vlad On Mon, May 5, 2014 at 10:59 AM, Torben Hoffmann < torben.hoffmann@REDACTED> wrote: > > Erik S?e S?rensen writes: > > > It looks good - and appears to incorporate appropriate Erlang idioms. > > I will try it out at the next whiteboard design discussion :-) > > > Great - let me know how that works! > > > There is one thing that bugs me, though: The representation of links as a > > dual monitor (or, equivalently, of monitors as one-way links). > > The notation has the nice property that to see which other processes are > > affected when a given process dies, you simply look for circles around > that > > process. That's good. > Thanks - that was the intention. > > But there are several differences between monitors and links: > > - the relation is asymmetric; > > - link behaviour is affected by trap_exit, monitor behaviour isn't; > > - links propagate exits, monitors don't; > > - reason 'normal' is special to links (when not trap_exit'ed). > > (And of course, the message format is different.) > > > You're right. I was unsure about how detailed this part should be, which > was one of > my reasons for seeking feedback sooner rather than later. > > > All in all, I believe we might be better off with a slightly different > > notation for monitors - say, a single-line-with-circle. > > > > Am I making sufficient sense? > > > You are making a lot of sense. > > If I combine this with the request from Garrett, i.e., to make the > notation more > Google presentation friendly we could do this: > * Use single line with open circle for monitors. > * Use single line with filled circle for links. > * Use single line with filled triangle style arrow head for spawn. > * Use dashed lines with open triangle style arrow head for message passing. > * Use dotted lines with open triangle style arrow head for exit signals. > > Still not sure if we need a special notation for dealing with exit signals > that are > being trapped. One could enforce that 'DOWN' has to be added to the > message being > passed when a process is trapping exits. > > Thoughts on all of this most welcome. > > Cheers, > Torben > > > > /Erik > > Den 02/05/2014 09.22 skrev "Torben Hoffmann" < > > torben.hoffmann@REDACTED>: > > > >> Hi, > >> > >> As I have mentioned before I have been working on a visual notation for > >> Erlang and > >> although it is not complete yet I have received requests to release it > >> anyway, so > >> here goes... > >> > >> https://github.com/esl/visual_erlang > >> > >> One extra thing missing from the to-do list is state data for processes. > >> > >> I would like some feedback on how you feel the abstraction level is. > >> The purpose of Visual Erlang is not to be able to specify every little > >> detail of what > >> happens in an Erlang program, but to give a way to describe the > >> architecture. > >> > >> Once I have updated the Erlang Concurrency Patterns that Jesper and I > have > >> been > >> working on to the new Visual Erlang notation we will release them as > well. > >> > >> The original plan for the patterns was to use Object-Process Methodology > >> as the > >> notation, but I was adviced (and thanks for that) to invent an Erlang > >> specific > >> notation since OPM has some corners that hurts for Erlang. > >> > >> Right now the only way to draw Visual Erlang diagrams is by hand or use > >> the LaTeX > >> macros I have created, but since Visual Erlang has a 1:1 mapping between > >> the visuals > >> and a textual notation my hope is that we can create a tool that can > >> create a diagram > >> from the textual notation. > >> > >> Going even further I dream of having a tool that extracts the Visual > >> Erlang notation > >> from the code in an interactive manner, where the user can guide what to > >> abstract and > >> what to just leave totally out. > >> > >> Cheers, > >> Torben > >> -- > >> Torben Hoffmann > >> CTO > >> Erlang Solutions Ltd. > >> Tel: +45 25 14 05 38 > >> http://www.erlang-solutions.com > >> _______________________________________________ > >> erlang-questions mailing list > >> erlang-questions@REDACTED > >> http://erlang.org/mailman/listinfo/erlang-questions > >> > > > -- > Torben Hoffmann > CTO > Erlang Solutions Ltd. > Tel: +45 25 14 05 38 > http://www.erlang-solutions.com > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From ok@REDACTED Mon May 5 12:21:19 2014 From: ok@REDACTED (ok@REDACTED) Date: Mon, 5 May 2014 22:21:19 +1200 Subject: [erlang-questions] Visual Erlang notation v0.1.0 - feedback request In-Reply-To: References: Message-ID: I am viewing visual_erlang.pdf in Acrobat Professional and most of the figures are missing the connecting lines you'd expect to find in them. This year I'm teaching part of a 4th year data base paper, where I'm talking about things like XML data bases and graph data bases, and part of a 4th year logic paper, where I'm talking about description logics (particularly EL and EL+), RDF, and OWL. In past years I have been extremely frustrated by graphical tools that I could not *program*, where I *knew* there was information in the graph but I couldn't get it out. So for me one of the essential feature of any "boxes and connectors" notation is that there has to be a defined way to map that to some sort of set of facts that I can write queries on. That is, it has to be more than pretty pictures. Turtle (RDF) is fine; SWI Prolog comes with a decent kit for loading/exporting/storing/querying RDF. Datalog is fine too. It might be OK to make it something that can be visually manipulated in 'dia', and define a mapping between dia file format and a semantic form. Thing is, *IF* this (or any other notation) is any good at revealing just enough relevant structure, then it ought to be possible to write "flaw detectors" to spot antipatterns. It would also be interesting to have the connections between this notation and other notations like SDL or especially Maurice Castro's visual notation for Erlang. (Anyone know what Maurice is up to these days?) My understanding is that in the early days of Erlang there was some pressure to tie it up with SDL, but it was found that there was a much clearer design notation for Erlang than SDL. I believe it was called Erlang... Of course the present file is just a beginning, but there is a certain "flavour" that already has me wondering. When I read other people's Erlang code, I practically ALWAYS find myself desperately searching for certain information I regard as really important for my understanding. "Desperately" because the information is often missing. And this graphical notation currently has no place for it, and it's not even clear that a graphical notation is appropriate. Yet it is something that Joe Armstrong has stressed the importance of, and built a toolkit to help in specifying and checking. It's the *PROTOCOLS* between the processes. By examining the source code of a module I can sometimes recover the protocol *as implemented*, but since people can make mistakes, that's not always the same thing as the protocol as *intended*. In my own code, I tend to write the protocol down in comments, but *sigh* (hang head) don't always keep it up to date as the code changes. And of course the protocol-as-implemented in a receive loop can be the union of two or more protocols. (For example, you might want a "management" protocol from a master to a worker but "clients" might be allowed to speak directly to the worker with a different protocol.) And of course part of a protocol might be implemented in a 'receive' and part of it in a 'case' somewhere else. *The* notation for specifying protocols has to be UBF (or some UBF variant). How can that be integrated with a visual notation? From aschultz@REDACTED Mon May 5 12:44:18 2014 From: aschultz@REDACTED (Andreas Schultz) Date: Mon, 5 May 2014 10:44:18 +0000 (UTC) Subject: [erlang-questions] Erlang, WSDL, SOAP. In-Reply-To: <8b4ae47a-6311-4539-91c6-aabeb87fa247@googlegroups.com> References: <97d34f5f-ddbb-4e5c-8517-4857d03fc8da@googlegroups.com> <5363B383.4030404@gmail.com> <8b4ae47a-6311-4539-91c6-aabeb87fa247@googlegroups.com> Message-ID: <1263446750.4181.1399286658076.JavaMail.zimbra@tpip.net> Hi, I haven't done anything with WDSL (yet), but what about the WSDL/SOAP support in yaws? Andreas ----- Original Message ----- > Hi Christy, > > That's pretty good advice for creating new web services. But then every > implementation then becomes a new, custom design task. I was proposing that > solving those two infrastructural problems (xmlns/xs) in a more generic way > could make interoperability a little easier. I'd really like to "black box" > the xml part into some standard transformation/codec and then largely forget > about the details. That could I think do most of the heavy lifting with > respect to creating direct replacements for existing services or creating > clients to integrate with existing ones. > > It's certainly possible that I'm wrong about this. I suspect that java > bindings end up looking like a mess because the data structures produced by > xml are kind of inherently messy and over-complex already... so maybe any > effort to create bindings is going to end up a mess? > > Regards, > Steve > > On Friday, May 2, 2014 10:02:27 AM UTC-5, Christy Watson wrote: > > I'm an erlang newbe, but even with java ee and code generation based on > a wsdl. The actual mapping to the objects must be done by the > programmer, and is a mess. The wsdl concept is great, I just think the > standard is to overly complicate the implementation. Remember all a > wsdl is for is to say to the user of the service "if you send me > __________ I'll send you ____________ back". So others have > auto-generated themselves into a mess. Ask yourself what you really > need to do to get from input to output, then map your algorithm... > you'll probably end up with a much more efficient piece of software than > an auto-generated jaxWS mess. > > > On 04/30/2014 08:17 PM, Steve Davis wrote: > > has been that the issues surrounding web services are not the WSDL but > > resolving other technologies that it uses: i.e. the resolution of > > namespace mapping and schema analysis. > > > > 1) It's pretty obvious that namespaces (aka packages, etc) introduce > > many indirection concerns (consider the earlier experiment in erlang > > with module "packages"). > > > > 2) The issue with xml schema seems to be the underlying DTD > > _______________________________________________ > erlang-questions mailing list > erlang-q...@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > -- -- Dipl. Inform. Andreas Schultz email: as@REDACTED phone: +49-391-819099-224 mobil: +49-170-2226073 ------------------- enabling your networks ------------------- Travelping GmbH phone: +49-391-819099229 Roentgenstr. 13 fax: +49-391-819099299 D-39108 Magdeburg email: info@REDACTED GERMANY web: http://www.travelping.com Company Registration: Amtsgericht Stendal Reg No.: HRB 10578 Geschaeftsfuehrer: Holger Winkelmann | VAT ID No.: DE236673780 -------------------------------------------------------------- From torben.hoffmann@REDACTED Mon May 5 13:11:38 2014 From: torben.hoffmann@REDACTED (Torben Hoffmann) Date: Mon, 05 May 2014 13:11:38 +0200 Subject: [erlang-questions] Visual Erlang notation v0.1.0 - feedback request In-Reply-To: References: Message-ID: ok@REDACTED writes: > I am viewing visual_erlang.pdf in Acrobat Professional > and most of the figures are missing the connecting lines > you'd expect to find in them. > That is most peculiar - I am using Skim, but opening in the free Adobe Reader shows no signs of errors. Are there any log files that states anything about my PDF being bad? > This year I'm teaching part of a 4th year data base paper, > where I'm talking about things like XML data bases and > graph data bases, and part of a 4th year logic paper, > where I'm talking about description logics (particularly > EL and EL+), RDF, and OWL. In past years I have been > extremely frustrated by graphical tools that I could not > *program*, where I *knew* there was information in the graph > but I couldn't get it out. > > So for me one of the essential feature of any "boxes and > connectors" notation is that there has to be a defined > way to map that to some sort of set of facts that I can > write queries on. That is, it has to be more than pretty > pictures. > > Turtle (RDF) is fine; SWI Prolog comes with a decent kit for > loading/exporting/storing/querying RDF. Datalog is fine too. > It might be OK to make it something that can be visually > manipulated in 'dia', and define a mapping between dia > file format and a semantic form. > > Thing is, *IF* this (or any other notation) is any good at > revealing just enough relevant structure, then it ought to > be possible to write "flaw detectors" to spot antipatterns. > I'm certainly for this kind of formalism, but I am not able to do it since my knowledge in this area is non-existent. Do you have pointers to some introduction texts that can help guide the design of the textual notation? And how to think about interrogating the information? > It would also be interesting to have the connections between > this notation and other notations like SDL or especially > Maurice Castro's visual notation for Erlang. (Anyone know > what Maurice is up to these days?) > Thanks for the pointer on Maurice's notation - I had no idea about that one. >From a brief read of it I think the main difference between that and Visual Erlang is that in Visual Erlang the API functions are attached outside the module/process instead of extending the rectangle for the process. > My understanding is that in the early days of Erlang there > was some pressure to tie it up with SDL, but it was found > that there was a much clearer design notation for Erlang > than SDL. I believe it was called Erlang... > That is part of the reason why I have not just gone with SDL. Another reason is that in SDL I am lacking a good way to capture links, monitors, which is key to understanding how an Erlang architecture works. SDL has an edge over Visual Erlang when it comes to capturing the flow of a protocol, so either Visual Erlang has to focus on that as well or one simply uses SDL or MSCs to capture that kind of information. What I have been missing, and what drives me to create Visual Erlang, is a way to capture how the supervision tree interacts with the functionality of the module/processes. Apart from being able to talk about what a process should be responsible for I am also aiming at getting to a point where I can interactively browse through a code base and uncover the architecture, while deciding which parts to hide through abstractions. That is a bit down the road, though. > Of course the present file is just a beginning, but there > is a certain "flavour" that already has me wondering. > > When I read other people's Erlang code, I practically > ALWAYS find myself desperately searching for certain > information I regard as really important for my understanding. > "Desperately" because the information is often missing. > And this graphical notation currently has no place for it, > and it's not even clear that a graphical notation is > appropriate. Yet it is something that Joe Armstrong has > stressed the importance of, and built a toolkit to help in > specifying and checking. > > It's the *PROTOCOLS* between the processes. > By examining the source code of a module I can sometimes > recover the protocol *as implemented*, but since people > can make mistakes, that's not always the same thing as > the protocol as *intended*. In my own code, I tend to > write the protocol down in comments, but *sigh* (hang > head) don't always keep it up to date as the code changes. > And of course the protocol-as-implemented in a receive > loop can be the union of two or more protocols. (For > example, you might want a "management" protocol from a > master to a worker but "clients" might be allowed to > speak directly to the worker with a different protocol.) > And of course part of a protocol might be implemented in > a 'receive' and part of it in a 'case' somewhere else. > > *The* notation for specifying protocols has to be UBF > (or some UBF variant). How can that be integrated with > a visual notation? Funny that you bring this up - there has just been an application for an EU grant (CoCo) to look at communication contracts between processes, which is very much about building on top of UBF and get something that captures the protocols in the same way specs capture types today. I'd love to get protocols covered as well, but I don't feel that squeezing them into Visual Erlang is the right approach. I have stolen some of the ideas from Object-Process Methodology (OPM). In OPM there is an explicit message flow semantics, but I do not find that particularly intuitive when trying to understand the protocols. As I said, SDL has more of the protocol stuff covered, but it is missing out on the supervision tree. I think that protocols has to be addressed orthogonal to the architecture captured in Visual Erlang. Preferably with some link between the two. Hopefully the CoCo project will shed some light on this. Thanks for the feedback! Torben -- Torben Hoffmann CTO Erlang Solutions Ltd. Tel: +45 25 14 05 38 http://www.erlang-solutions.com From torben.hoffmann@REDACTED Mon May 5 13:18:00 2014 From: torben.hoffmann@REDACTED (Torben Hoffmann) Date: Mon, 05 May 2014 13:18:00 +0200 Subject: [erlang-questions] Visual Erlang notation v0.1.0 - feedback request In-Reply-To: References: Message-ID: Vlad Dumitrescu writes: > Hi, > > Just a thought that connects with the patterns discussion: linking to > another process is usually permanent, that is we don't unlink from it. > Process monitoring can be more dynamic. In any case, it is possible to have > links/monitors that are dynamic and thus runtime properties. IMHO, one > might want to handle these differently than the static ones. On the other > hand, this might be an anti-pattern? > Ai, ai, ai! Dynamic linking/monitoring is far from trivial. The idiomatic danger of unlinking is that you can end up with processes that are no longer associated with the supervision tree of your application. In most cases you would probably have some na?ve link in the supervision tree and then add linking/monitoring from a different place in the tree to the processes you are interested in. Do you have a good example of where you use dynamic linking/monitoring that we could base the discussion on? I'd hate to provide notation for anti-patterns, but if we are missing something on the dynamic front then now is a good time to get it in. Cheers, Torben > regards, > Vlad > > > > On Mon, May 5, 2014 at 10:59 AM, Torben Hoffmann < > torben.hoffmann@REDACTED> wrote: > >> >> Erik S?e S?rensen writes: >> >> > It looks good - and appears to incorporate appropriate Erlang idioms. >> > I will try it out at the next whiteboard design discussion :-) >> > >> Great - let me know how that works! >> >> > There is one thing that bugs me, though: The representation of links as a >> > dual monitor (or, equivalently, of monitors as one-way links). >> > The notation has the nice property that to see which other processes are >> > affected when a given process dies, you simply look for circles around >> that >> > process. That's good. >> Thanks - that was the intention. >> > But there are several differences between monitors and links: >> > - the relation is asymmetric; >> > - link behaviour is affected by trap_exit, monitor behaviour isn't; >> > - links propagate exits, monitors don't; >> > - reason 'normal' is special to links (when not trap_exit'ed). >> > (And of course, the message format is different.) >> > >> You're right. I was unsure about how detailed this part should be, which >> was one of >> my reasons for seeking feedback sooner rather than later. >> >> > All in all, I believe we might be better off with a slightly different >> > notation for monitors - say, a single-line-with-circle. >> > >> > Am I making sufficient sense? >> > >> You are making a lot of sense. >> >> If I combine this with the request from Garrett, i.e., to make the >> notation more >> Google presentation friendly we could do this: >> * Use single line with open circle for monitors. >> * Use single line with filled circle for links. >> * Use single line with filled triangle style arrow head for spawn. >> * Use dashed lines with open triangle style arrow head for message passing. >> * Use dotted lines with open triangle style arrow head for exit signals. >> >> Still not sure if we need a special notation for dealing with exit signals >> that are >> being trapped. One could enforce that 'DOWN' has to be added to the >> message being >> passed when a process is trapping exits. >> >> Thoughts on all of this most welcome. >> >> Cheers, >> Torben >> >> >> > /Erik >> > Den 02/05/2014 09.22 skrev "Torben Hoffmann" < >> > torben.hoffmann@REDACTED>: >> > >> >> Hi, >> >> >> >> As I have mentioned before I have been working on a visual notation for >> >> Erlang and >> >> although it is not complete yet I have received requests to release it >> >> anyway, so >> >> here goes... >> >> >> >> https://github.com/esl/visual_erlang >> >> >> >> One extra thing missing from the to-do list is state data for processes. >> >> >> >> I would like some feedback on how you feel the abstraction level is. >> >> The purpose of Visual Erlang is not to be able to specify every little >> >> detail of what >> >> happens in an Erlang program, but to give a way to describe the >> >> architecture. >> >> >> >> Once I have updated the Erlang Concurrency Patterns that Jesper and I >> have >> >> been >> >> working on to the new Visual Erlang notation we will release them as >> well. >> >> >> >> The original plan for the patterns was to use Object-Process Methodology >> >> as the >> >> notation, but I was adviced (and thanks for that) to invent an Erlang >> >> specific >> >> notation since OPM has some corners that hurts for Erlang. >> >> >> >> Right now the only way to draw Visual Erlang diagrams is by hand or use >> >> the LaTeX >> >> macros I have created, but since Visual Erlang has a 1:1 mapping between >> >> the visuals >> >> and a textual notation my hope is that we can create a tool that can >> >> create a diagram >> >> from the textual notation. >> >> >> >> Going even further I dream of having a tool that extracts the Visual >> >> Erlang notation >> >> from the code in an interactive manner, where the user can guide what to >> >> abstract and >> >> what to just leave totally out. >> >> >> >> Cheers, >> >> Torben >> >> -- >> >> Torben Hoffmann >> >> CTO >> >> Erlang Solutions Ltd. >> >> Tel: +45 25 14 05 38 >> >> http://www.erlang-solutions.com >> >> _______________________________________________ >> >> erlang-questions mailing list >> >> erlang-questions@REDACTED >> >> http://erlang.org/mailman/listinfo/erlang-questions >> >> >> >> >> -- >> Torben Hoffmann >> CTO >> Erlang Solutions Ltd. >> Tel: +45 25 14 05 38 >> http://www.erlang-solutions.com >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://erlang.org/mailman/listinfo/erlang-questions >> -- Torben Hoffmann CTO Erlang Solutions Ltd. Tel: +45 25 14 05 38 http://www.erlang-solutions.com From vladdu55@REDACTED Mon May 5 13:29:35 2014 From: vladdu55@REDACTED (Vlad Dumitrescu) Date: Mon, 5 May 2014 13:29:35 +0200 Subject: [erlang-questions] Visual Erlang notation v0.1.0 - feedback request In-Reply-To: References: Message-ID: On Mon, May 5, 2014 at 1:18 PM, Torben Hoffmann < torben.hoffmann@REDACTED> wrote: > > Vlad Dumitrescu writes: > > Just a thought that connects with the patterns discussion: linking to > > another process is usually permanent, that is we don't unlink from it. > > Process monitoring can be more dynamic. In any case, it is possible to > have > > links/monitors that are dynamic and thus runtime properties. IMHO, one > > might want to handle these differently than the static ones. On the other > > hand, this might be an anti-pattern? > > > Ai, ai, ai! > > Dynamic linking/monitoring is far from trivial. > > The idiomatic danger of unlinking is that you can end up with processes > that are no > longer associated with the supervision tree of your application. > > In most cases you would probably have some na?ve link in the supervision > tree and > then add linking/monitoring from a different place in the tree to the > processes you > are interested in. > > Do you have a good example of where you use dynamic linking/monitoring > that we could > base the discussion on? > > I'd hate to provide notation for anti-patterns, but if we are missing > something on > the dynamic front then now is a good time to get it in. > > No, I don't have a full example at the moment. Of course, when using linking with supervision trees, then the linking should be static, i.e. for the lifetime of the process. I have in the past used linking outside supervision, but nowadays I would have used monitors instead. As a simplified example, let's take a tree of processes where parents monitor their children and the children their parents. When moving a child to another parent, the monitors will change. It might not be something that is used often in systems, but since it is a possibility, I think that the architecture description should have a way to describe it. Or it should be decided that such monitors have nothing to do in the architecture diagrams, which is perfectly acceptable IMHO. regards, Vlad -------------- next part -------------- An HTML attachment was scrubbed... URL: From andra.dinu@REDACTED Mon May 5 14:39:34 2014 From: andra.dinu@REDACTED (Andra Dinu) Date: Mon, 5 May 2014 14:39:34 +0200 (CEST) Subject: [erlang-questions] EUC 2014: All Speakers Up, Tutorials on 11 June, Early Bird Ends on 9 May In-Reply-To: <208183130.456534.1399293539121.JavaMail.zimbra@erlang-solutions.com> Message-ID: <1703568168.456598.1399293574852.JavaMail.zimbra@erlang-solutions.com> Hi all, Quick note to let you know that all the speakers at Erlang User Conference 9-10 June Stockholm are now published on the conference website. The event also includes a day of tutorials on 11 June ( http://www.erlang-factory.com/conference/show/conference-23/home/#tutorials ), to which all EUC delegates have free access. Stuart Bailey, CTO and Founder of Infoblox and Katie Miller, OpenShift Developer Advocate and Co-founder of Lambda Ladies will deliver the keynotes. Other speakers include ?Seven Languages in Seven Weeks? author Bruce Tate, co-designer of Haskell and QuickCheck John Hughes, O?Reilly author Erik Stenman, Rakuten lead technologist Yosuke Hara, Feuerlabs Co-founder and Developer Advocate Ulf Wiger and many more. http://www.erlang-factory.com/conference/show/conference-23/home/ Thanks, Andra -- Andra Dinu Community & Social ERLANG SOLUTIONS LTD New Loom House 101 Back Church Lane London, E1 1LU United Kingdom Tel +44(0)2076550344 Mob +44(0)7983484387 www.erlang-solutions.com From erlang@REDACTED Mon May 5 16:29:48 2014 From: erlang@REDACTED (Erik Reitsma) Date: Mon, 05 May 2014 16:29:48 +0200 Subject: [erlang-questions] Erlang/OTP 17.0 and android In-Reply-To: <53551EDE.1060104@ernovation.com> References: <53551EDE.1060104@ernovation.com> Message-ID: <5367A05C.2040707@ernovation.com> Hi all, Sorry for the delay, but I have now packaged 17.0 for Android. You can download the .apk from http://erlang.ernovation.com/files/Erlang4Android17.0.apk (It is no longer allowed to put new binaries on Google Code...) This apk is intended to be used with ScriptingLayer4Android (SL4), as before. You can download the zip file with Erlang itself directly for use outside SL4A from http://erlang.ernovation.com/files/erlang_17.0.zip The apk will download and install this for you... I have put the source at https://github.com/Ernovation/otp/tree/master. I had to make only some small modifications to handle the different location of the shell on Android, all my other modifications had already been put into the main OTP repository. I have removed the android package from the download and into an installable library. It now uses the '$handle_undefined_function'/2 introduced recently, otherwise it works as before. It is an interface to the API of SL4A which you can find here: https://code.google.com/p/android-scripting/wiki/ApiReference For example, you can show some text on the screen by calling android:makeToast("some text"). Kind regards, *Erik. On 04/21/2014 03:36 PM, Erik Reitsma wrote: > Hi all, > > I will update my Erlang4Android > (https://code.google.com/p/erlang4android/) to 17.0 soon (this week, I > hope). I have it working on my own device, I just need to add the > interface to the Android functions from Scripting Layer for Android > (SL4A). I want to use the $handle_undefined_function instead of > hacking the error handler as I did with the R16 version. > Most of the work I did for Erlang4Android is included in the official > release of 17.0, but not all (which I found out when I tried to run > the build without modifications). > > I see no need to root the device (for installing Erlang) if you use my > installer. > > Regards, > *Erik. > > On 04/21/2014 12:59 PM, Dmitry Kolesnikov wrote: >> Hello, >> >> There is a HOW TO docs. They covers build procedure and release >> preparation. However, there is not any silver bullet for deployment >> into device. If you are looking OTP deployment to high-end device >> then you might need to root it. I managed to deploy it into device >> using RnD mode and adb tool. What is your target device? >> >> Best Regards, >> Dmitry >>> -|-|-(*> >>> On 21 Apr 2014, at 13:10, Benoit Chesneau wrote: >>> >>> Is there any doc somewhere about the recent cross-platform android >>> build addition? How to use a builded Erlang on this platform? >>> >>> - benoit >>> >>> >>> >>> _______________________________________________ >>> erlang-questions mailing list >>> erlang-questions@REDACTED >>> http://erlang.org/mailman/listinfo/erlang-questions >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://erlang.org/mailman/listinfo/erlang-questions > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions From lloyd@REDACTED Mon May 5 17:26:19 2014 From: lloyd@REDACTED (Lloyd R. Prentice) Date: Mon, 5 May 2014 11:26:19 -0400 Subject: [erlang-questions] Visual Erlang notation v0.1.0 - feedback request In-Reply-To: References: Message-ID: It would be great to see the popular web servers and frameworks visually documented. Appreciate your thoughtful work. LRP Sent from my iPad > On May 5, 2014, at 4:32 AM, Torben Hoffmann wrote: > > > Garrett Smith writes: > >> Hi Torben, >> >> On Fri, May 2, 2014 at 2:21 AM, Torben Hoffmann >> wrote: >>> Hi, >>> >>> As I have mentioned before I have been working on a visual notation for Erlang and >>> although it is not complete yet I have received requests to release it anyway, so >>> here goes... >>> >>> https://github.com/esl/visual_erlang >>> >>> One extra thing missing from the to-do list is state data for processes. >>> >>> I would like some feedback on how you feel the abstraction level is. >>> The purpose of Visual Erlang is not to be able to specify every little detail of what >>> happens in an Erlang program, but to give a way to describe the architecture. >> >> Love this! >> > Thanks! > >> My hopefully constructive input though... I think you ought to be >> easier on folks who don't use fancy graphics editors :) >> > That's the first time I have heard LaTeX being called a fancy graphics editor ;-) > >> I (and the folks I work with) tend to use Google presentations to put >> together visual diagrams. It's quite a handy program. Unfortunately >> you can't do a few things that you require: >> >> - Squiggly lines >> - Double lines >> >> But you can do: >> >> - Lots of different line endings (circles, squares, triangles) >> - Dashed lines >> - Dash-dotted lines >> - Thick and thin lines >> >> Unless you have a religious point of view when it comes to squiggles >> (I hear this is a thing) I'd recommend tweaking the symbols to widen >> the tent for drawing tools :) >> > I'm not religious about squiggles, but I had a reason for using squiggles for message > passing: > I want to encourage using module APIs to send messages around. It is rare that you > need to send messages directly, so the symbol for that should stand out and the easy > straight line be used for calling an API function. > > But I am very open to finding ways to make this distinction come out, so perhaps one > could use dashed lines for message passing? > > Another criteria is that it should be easy to write the Visual Erlang diagrams on a > whiteboard. I find squiggles easier than dashed lines, but that could be my > preference - dashed lines are not impossible. > Thick and thin lines are really hard on a whiteboard. > > I will ponder a bit over this in conjunction with some of the other feedback, so > please follow this thread! > >> I also recommend putting together some PNGs and including them as >> images in the README so people can see what's going on at a glance >> from the github page without downloading the PDF. But this a nice to >> have. >> > I didn't know that one could include PNGs in the README on github - do you have an > example of how this is done? > Very cool idea! > >> Can't wait for the Patterns In Erlang book! (But who's in the GoF?) >> > So far it is only a dynamic duo: Jesper and me. > > Gang of anything sounds so last century - need to find something cooler. Dynamic duo > also has an oldish feel to it, mind you ;-) > > We will start with getting Erlang patterns documented - if it turns into something > that people want in book form it might happen. > > Thanks for the feedback! > Torben > >> Garrett > > > -- > Torben Hoffmann > CTO > Erlang Solutions Ltd. > Tel: +45 25 14 05 38 > http://www.erlang-solutions.com > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions From g@REDACTED Mon May 5 17:43:21 2014 From: g@REDACTED (Garrett Smith) Date: Mon, 5 May 2014 10:43:21 -0500 Subject: [erlang-questions] Visual Erlang notation v0.1.0 - feedback request In-Reply-To: References: Message-ID: On Mon, May 5, 2014 at 3:32 AM, Torben Hoffmann wrote: > > Garrett Smith writes: > >> My hopefully constructive input though... I think you ought to be >> easier on folks who don't use fancy graphics editors :) >> > That's the first time I have heard LaTeX being called a fancy graphics editor ;-) Not as fancy as my vi based SVG editor, but still fancy. >> I (and the folks I work with) tend to use Google presentations to put >> together visual diagrams. It's quite a handy program. Unfortunately >> you can't do a few things that you require: >> >> - Squiggly lines >> - Double lines >> >> But you can do: >> >> - Lots of different line endings (circles, squares, triangles) >> - Dashed lines >> - Dash-dotted lines >> - Thick and thin lines >> >> Unless you have a religious point of view when it comes to squiggles >> (I hear this is a thing) I'd recommend tweaking the symbols to widen >> the tent for drawing tools :) >> > I'm not religious about squiggles, but I had a reason for using squiggles for message > passing: > I want to encourage using module APIs to send messages around. It is rare that you > need to send messages directly, so the symbol for that should stand out and the easy > straight line be used for calling an API function. > > But I am very open to finding ways to make this distinction come out, so perhaps one > could use dashed lines for message passing? > > Another criteria is that it should be easy to write the Visual Erlang diagrams on a > whiteboard. I find squiggles easier than dashed lines, but that could be my > preference - dashed lines are not impossible. > Thick and thin lines are really hard on a whiteboard. Think of a dashed line as a squiggle turned 90 degrees - you can use the same hand motion. > I will ponder a bit over this in conjunction with some of the other feedback, so > please follow this thread! > >> I also recommend putting together some PNGs and including them as >> images in the README so people can see what's going on at a glance >> from the github page without downloading the PDF. But this a nice to >> have. >> > I didn't know that one could include PNGs in the README on github - do you have an > example of how this is done? > Very cool idea! https://github.com/gar1t/hello-torben/blob/master/README.md >> Can't wait for the Patterns In Erlang book! (But who's in the GoF?) Ah shucks, this was my overly dry and cynical humor. This Design Patterns [1] book by the so called gang of four made into my hands at a young age and I've been trying to repair my brain every since. > So far it is only a dynamic duo: Jesper and me. > > Gang of anything sounds so last century - need to find something cooler. Dynamic duo > also has an oldish feel to it, mind you ;-) > > We will start with getting Erlang patterns documented - if it turns into something > that people want in book form it might happen. Book or none, this is a great thread and if it picks up speed I think we'll start seeing helpful diagrams with a consistent syntax/semantic popping up in blog posts and, er, whiteboards :) Garrett [1] http://en.wikipedia.org/wiki/Design_Patterns From myers@REDACTED Mon May 5 20:59:11 2014 From: myers@REDACTED (Myers Carpenter) Date: Mon, 5 May 2014 14:59:11 -0400 Subject: [erlang-questions] DTLS Status and examples? Message-ID: Hello, I'm attempting to connect the data channel in webrtc to Erlang. You can read about my project here https://github.com/myers/exwebrtc . I'm trying to understand where the DTLS code in Erlang is currently and where I might be able to pitch in. I'm attempting to start a DTLS server and then connect to it via "openssl s_client" Here's the code so far -module(dtls_server). -export([start/0]). start() -> ssl:start(), {ok, _Socket} = dtls:listen(4499, [ {mode, binary}, {reuseaddr, true}, {certfile, "server.cert"}, {keyfile, "server.pkey"}, {active, true}, {ciphers, [{ecdhe_rsa, aes_128_cbc, sha}]} ]). If we try with no "ciphers" listed or if we try with that one cipher suite we get this error: 2> dtls_server:start(). ** exception error: no match of right hand side value {error, {options,{ciphers,[{ecdhe_rsa,aes_128_cbc,sha}]}}} in function dtls_server:start/0 (src/dtls_server.erl, line 7) Thanks, myers -------------- next part -------------- An HTML attachment was scrubbed... URL: From torben.hoffmann@REDACTED Mon May 5 20:53:29 2014 From: torben.hoffmann@REDACTED (Torben Hoffmann) Date: Mon, 05 May 2014 20:53:29 +0200 Subject: [erlang-questions] Visual Erlang notation v0.1.0 - feedback request In-Reply-To: References: Message-ID: Vlad Dumitrescu writes: > On Mon, May 5, 2014 at 1:18 PM, Torben Hoffmann < > torben.hoffmann@REDACTED> wrote: > >> >> Vlad Dumitrescu writes: >> > Just a thought that connects with the patterns discussion: linking to >> > another process is usually permanent, that is we don't unlink from it. >> > Process monitoring can be more dynamic. In any case, it is possible to >> have >> > links/monitors that are dynamic and thus runtime properties. IMHO, one >> > might want to handle these differently than the static ones. On the other >> > hand, this might be an anti-pattern? >> > >> Ai, ai, ai! >> >> Dynamic linking/monitoring is far from trivial. >> >> The idiomatic danger of unlinking is that you can end up with processes >> that are no >> longer associated with the supervision tree of your application. >> >> In most cases you would probably have some na?ve link in the supervision >> tree and >> then add linking/monitoring from a different place in the tree to the >> processes you >> are interested in. >> >> Do you have a good example of where you use dynamic linking/monitoring >> that we could >> base the discussion on? >> >> I'd hate to provide notation for anti-patterns, but if we are missing >> something on >> the dynamic front then now is a good time to get it in. >> >> > No, I don't have a full example at the moment. Of course, when using > linking with supervision trees, then the linking should be static, i.e. for > the lifetime of the process. I have in the past used linking outside > supervision, but nowadays I would have used monitors instead. > I tend to agree with you - links for the static structure of the supervision tree and then monitoring for the more dynamic things. If others have examples where dynamic linking makes sense, please speak up. > As a simplified example, let's take a tree of processes where parents > monitor their children and the children their parents. When moving a child > to another parent, the monitors will change. > > It might not be something that is used often in systems, but since it is a > possibility, I think that the architecture description should have a way to > describe it. Or it should be decided that such monitors have nothing to do > in the architecture diagrams, which is perfectly acceptable IMHO. > Monitors should definitely be part of the notation. See this manager-worker pattern: -------------- next part -------------- A non-text attachment was scrubbed... Name: Erlang-Patterns-P7.png Type: image/png Size: 53755 bytes Desc: not available URL: -------------- next part -------------- This is a static monitoring set-up, which is needed to solve this particular problem. The P process spawns a manager process which spawns the worker processes. Should one of the workers die the manager exits and process P, which is monitoring the manager, gets a down message due to it monitoring the manager. Right now I cannot come up with a good example where dynamic monitoring makes sense, so I would like to hear if others have one. Cheers, Torben > regards, > Vlad -- Torben Hoffmann CTO Erlang Solutions Ltd. Tel: +45 25 14 05 38 http://www.erlang-solutions.com From torben.hoffmann@REDACTED Mon May 5 21:00:13 2014 From: torben.hoffmann@REDACTED (Torben Hoffmann) Date: Mon, 05 May 2014 21:00:13 +0200 Subject: [erlang-questions] Visual Erlang notation v0.1.0 - feedback request In-Reply-To: References: Message-ID: Lloyd R. Prentice writes: > It would be great to see the popular web servers and frameworks visually documented. > Indeed - I will gladly assist anyone that ventures into these waters. > Appreciate your thoughtful work. > Thanks - with the inputs I'm getting I'm pretty sure that we can get something decent out of this! Cheers, Torben > LRP > > Sent from my iPad > >> On May 5, 2014, at 4:32 AM, Torben Hoffmann wrote: >> >> >> Garrett Smith writes: >> >>> Hi Torben, >>> >>> On Fri, May 2, 2014 at 2:21 AM, Torben Hoffmann >>> wrote: >>>> Hi, >>>> >>>> As I have mentioned before I have been working on a visual notation for Erlang and >>>> although it is not complete yet I have received requests to release it anyway, so >>>> here goes... >>>> >>>> https://github.com/esl/visual_erlang >>>> >>>> One extra thing missing from the to-do list is state data for processes. >>>> >>>> I would like some feedback on how you feel the abstraction level is. >>>> The purpose of Visual Erlang is not to be able to specify every little detail of what >>>> happens in an Erlang program, but to give a way to describe the architecture. >>> >>> Love this! >>> >> Thanks! >> >>> My hopefully constructive input though... I think you ought to be >>> easier on folks who don't use fancy graphics editors :) >>> >> That's the first time I have heard LaTeX being called a fancy graphics editor ;-) >> >>> I (and the folks I work with) tend to use Google presentations to put >>> together visual diagrams. It's quite a handy program. Unfortunately >>> you can't do a few things that you require: >>> >>> - Squiggly lines >>> - Double lines >>> >>> But you can do: >>> >>> - Lots of different line endings (circles, squares, triangles) >>> - Dashed lines >>> - Dash-dotted lines >>> - Thick and thin lines >>> >>> Unless you have a religious point of view when it comes to squiggles >>> (I hear this is a thing) I'd recommend tweaking the symbols to widen >>> the tent for drawing tools :) >>> >> I'm not religious about squiggles, but I had a reason for using squiggles for message >> passing: >> I want to encourage using module APIs to send messages around. It is rare that you >> need to send messages directly, so the symbol for that should stand out and the easy >> straight line be used for calling an API function. >> >> But I am very open to finding ways to make this distinction come out, so perhaps one >> could use dashed lines for message passing? >> >> Another criteria is that it should be easy to write the Visual Erlang diagrams on a >> whiteboard. I find squiggles easier than dashed lines, but that could be my >> preference - dashed lines are not impossible. >> Thick and thin lines are really hard on a whiteboard. >> >> I will ponder a bit over this in conjunction with some of the other feedback, so >> please follow this thread! >> >>> I also recommend putting together some PNGs and including them as >>> images in the README so people can see what's going on at a glance >>> from the github page without downloading the PDF. But this a nice to >>> have. >>> >> I didn't know that one could include PNGs in the README on github - do you have an >> example of how this is done? >> Very cool idea! >> >>> Can't wait for the Patterns In Erlang book! (But who's in the GoF?) >>> >> So far it is only a dynamic duo: Jesper and me. >> >> Gang of anything sounds so last century - need to find something cooler. Dynamic duo >> also has an oldish feel to it, mind you ;-) >> >> We will start with getting Erlang patterns documented - if it turns into something >> that people want in book form it might happen. >> >> Thanks for the feedback! >> Torben >> >>> Garrett >> >> >> -- >> Torben Hoffmann >> CTO >> Erlang Solutions Ltd. >> Tel: +45 25 14 05 38 >> http://www.erlang-solutions.com >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://erlang.org/mailman/listinfo/erlang-questions -- Torben Hoffmann CTO Erlang Solutions Ltd. Tel: +45 25 14 05 38 http://www.erlang-solutions.com From eriksoe@REDACTED Mon May 5 21:34:02 2014 From: eriksoe@REDACTED (=?UTF-8?Q?Erik_S=C3=B8e_S=C3=B8rensen?=) Date: Mon, 5 May 2014 21:34:02 +0200 Subject: [erlang-questions] Visual Erlang notation v0.1.0 - feedback request In-Reply-To: References: Message-ID: > Right now I cannot come up with a good example where dynamic monitoring makes sense, > so I would like to hear if others have one. I'm a bit surprised that no one else has mentioned this: dynamic monitoring takes place as part of a very wide-spread pattern: the gen_server call! Also, dynamic monitoring has its place in any form of publish-subscribe pattern (on the publisher end). And any forms of async calls. /Erik -------------- next part -------------- An HTML attachment was scrubbed... URL: From eriksoe@REDACTED Mon May 5 21:53:52 2014 From: eriksoe@REDACTED (=?UTF-8?Q?Erik_S=C3=B8e_S=C3=B8rensen?=) Date: Mon, 5 May 2014 21:53:52 +0200 Subject: [erlang-questions] Visual Erlang notation v0.1.0 - feedback request In-Reply-To: References: Message-ID: To elaborate and generalize: Dynamic monitoring has its place at least when one of the following is true: - one process has resources on behalf of another process, but should not itself be limited to the other process' s lifespan. - one process expects an answer (or several messages) from another process, and thus needs to be notified about that process' s demise. The first case is typical of server-side and the second of client-side behaviour in a client-server relationship, but both can of course happen in other circumstances as well. Den 05/05/2014 21.34 skrev "Erik S?e S?rensen" : > > > Right now I cannot come up with a good example where dynamic monitoring > makes sense, > > so I would like to hear if others have one. > > I'm a bit surprised that no one else has mentioned this: dynamic > monitoring takes place as part of a very wide-spread pattern: the > gen_server call! > > Also, dynamic monitoring has its place in any form of publish-subscribe > pattern (on the publisher end). And any forms of async calls. > > /Erik > -------------- next part -------------- An HTML attachment was scrubbed... URL: From lloyd@REDACTED Tue May 6 03:37:33 2014 From: lloyd@REDACTED (lloyd@REDACTED) Date: Mon, 5 May 2014 21:37:33 -0400 (EDT) Subject: [erlang-questions] Vim freezes when I try to close a *.erl file Message-ID: <1399340253.492321699@apps.rackspace.com> Hello, This is a new one on me. After many moons of faithful service, vim freezes up when it comes to saving *.erl files. No problem with other file extensions. I've rebooted, reinstalled vim--- all to no avail. Suspicious history: 1) Recently updated to Ubuntu 14.04 2) Recently started managing Erlang under kerl 3) Have been playing with Cowboy and websockets I've also had problems compiling n2o--- Throws crash-dump on very last step. May or may not be related problem. Why only *.erl files? Any thoughts on how to diagnose and fix this problem? Many thanks, LRP ********************************************* My books: THE GOSPEL OF ASHES http://thegospelofashes.com Strength is not enough. Do they have the courage and the cunning? Can they survive long enough to save the lives of millions? FREEIN' PANCHO http://freeinpancho.com A community of misfits help a troubled boy find his way AYA TAKEO http://ayatakeo.com Star-crossed love, war and power in an alternative universe Available through Amazon or by request from your favorite bookstore ********************************************** From kunthar@REDACTED Tue May 6 04:45:35 2014 From: kunthar@REDACTED (Gokhan Boranalp) Date: Tue, 6 May 2014 05:45:35 +0300 Subject: [erlang-questions] Vim freezes when I try to close a *.erl file In-Reply-To: <1399340253.492321699@apps.rackspace.com> References: <1399340253.492321699@apps.rackspace.com> Message-ID: do you use exuberant-ctags, check twice? did you check file system and disk? do you use any egzotic vim plugins? On Tue, May 6, 2014 at 4:37 AM, wrote: > Hello, > > This is a new one on me. After many moons of faithful service, vim freezes up when it comes to saving *.erl files. No problem with other file extensions. > > I've rebooted, reinstalled vim--- all to no avail. > > Suspicious history: > > 1) Recently updated to Ubuntu 14.04 > 2) Recently started managing Erlang under kerl > 3) Have been playing with Cowboy and websockets > > I've also had problems compiling n2o--- Throws crash-dump on very last step. May or may not be related problem. > > Why only *.erl files? Any thoughts on how to diagnose and fix this problem? > > Many thanks, > > LRP > > > > ********************************************* > My books: > > THE GOSPEL OF ASHES > http://thegospelofashes.com > > Strength is not enough. Do they have the courage > and the cunning? Can they survive long enough to > save the lives of millions? > > FREEIN' PANCHO > http://freeinpancho.com > > A community of misfits help a troubled boy find his way > > AYA TAKEO > http://ayatakeo.com > > Star-crossed love, war and power in an alternative > universe > > Available through Amazon or by request from your > favorite bookstore > > > ********************************************** > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions -- BR, \|/ Kunthar From wbin00@REDACTED Tue May 6 06:18:25 2014 From: wbin00@REDACTED (Bin Wang) Date: Tue, 6 May 2014 12:18:25 +0800 Subject: [erlang-questions] STM vs Actor Model? Message-ID: Hi, I'm coming up with this idea with STM. Please see how about this comparing to Erlang's way? In Erlang, actors communicate through messages. That is, a request is sent, and the actor do one of them at a time. But in STM way, all requests could be done at the same time. And then see if there are some conflicts. If so, undo and redo. It seems with high performance and less annoying than locks. So thinking about this kind of actor or object: it doesn't do only one request in the same time. But it will treat its methods as transactions. So multi processes to call its methods could be executed in the same time and the actor/object will not be blocked in the most of the time. --- Bin Wang From lloyd@REDACTED Tue May 6 06:19:37 2014 From: lloyd@REDACTED (lloyd@REDACTED) Date: Tue, 6 May 2014 00:19:37 -0400 (EDT) Subject: [erlang-questions] Vim freezes when I try to close a *.erl file In-Reply-To: References: <1399340253.492321699@apps.rackspace.com> Message-ID: <1399349977.185427481@apps.rackspace.com> Hi Gokhan, Found it! I deleted .vim and .vimrc and reinstalled vim. I can now edit *.erl files again. Since I had not changed any of my vim plugins (mainly vimerl), it seems likely that either the ubuntu or Erlang upgrades created incompatibilities. Gokhan, if you're ever in my neighborhood, or vice versa, I owe you a couple of rounds. Many thanks, Lloyd -----Original Message----- From: "Gokhan Boranalp" Sent: Monday, May 5, 2014 10:45pm To: "Lloyd Prentice" Cc: "Erlang" Subject: Re: [erlang-questions] Vim freezes when I try to close a *.erl file do you use exuberant-ctags, check twice? did you check file system and disk? do you use any egzotic vim plugins? On Tue, May 6, 2014 at 4:37 AM, wrote: > Hello, > > This is a new one on me. After many moons of faithful service, vim freezes up when it comes to saving *.erl files. No problem with other file extensions. > > I've rebooted, reinstalled vim--- all to no avail. > > Suspicious history: > > 1) Recently updated to Ubuntu 14.04 > 2) Recently started managing Erlang under kerl > 3) Have been playing with Cowboy and websockets > > I've also had problems compiling n2o--- Throws crash-dump on very last step. May or may not be related problem. > > Why only *.erl files? Any thoughts on how to diagnose and fix this problem? > > Many thanks, > > LRP > > > > ********************************************* > My books: > > THE GOSPEL OF ASHES > http://thegospelofashes.com > > Strength is not enough. Do they have the courage > and the cunning? Can they survive long enough to > save the lives of millions? > > FREEIN' PANCHO > http://freeinpancho.com > > A community of misfits help a troubled boy find his way > > AYA TAKEO > http://ayatakeo.com > > Star-crossed love, war and power in an alternative > universe > > Available through Amazon or by request from your > favorite bookstore > > > ********************************************** > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions -- BR, \|/ Kunthar From ok@REDACTED Tue May 6 07:22:27 2014 From: ok@REDACTED (Richard A. O'Keefe) Date: Tue, 6 May 2014 17:22:27 +1200 Subject: [erlang-questions] Visual Erlang notation v0.1.0 - feedback request In-Reply-To: References: Message-ID: On 5/05/2014, at 11:11 PM, Torben Hoffmann wrote: > ok@REDACTED writes: > >> I am viewing visual_erlang.pdf in Acrobat Professional >> and most of the figures are missing the connecting lines >> you'd expect to find in them. >> > That is most peculiar - I am using Skim, but opening in the free Adobe Reader shows > no signs of errors. > > Are there any log files that states anything about my PDF being bad? On my laptop, using Adobe Professional, the lines weren't there. On my desktop, using Preview, they are. Presumably a PDF version issue. Re figure 10: "Module my_mod has API f/N". Eh? "Application *Programming* Interface" (as opposed to "Application *Binary* Interface) is the whole set of source- level accessible operations provided by something. "f/N" is (a name for) a SINGLE FUNCTION. Why use three obscure and arguably inappropriate syllables "eh pee ai" when two clear appropriate syllables "funk shn" will do? The "API" of a module (if we want to embrace that ugly and confusing term at all) is the *whole* export set of the module. The text says "a diamond head from the module to the function" but figure 10 shows a connector that I cannot perceive as anything but pointing from the function to the module. Given that modules and functions have different kinds of names and different kinds of boxes, it's not clear that the direction of the link needs to be distinguished in yet a third way. As I shall argue shortly, we may need to include functions in a diagram that are NOT exported from a module. Figure 11 says "Module my_mod has instance P1" but while parametric modules do have instances, those instances are modules, not processes. No process is, and no process can be, an *instance* of a module. On the other hand, it is fair to say that a module *creates* a process. So some kind of ++========++ ?creates? _______ || module || ----------> (process) ++========++ ~~~~~~~ makes sense. (Note that the information flow is *from* the module *to* the process, so a data flow arrow goes this way around.) Amongst other things, for X to be an instance of Y, it has to be a special case of the *whole* of Y. But if a module contains two 'spawn' calls, how can that be? (This is in marked contrast to classes, where an object *is* an instance of the *whole* class; every part of the class is equally relevant to it.) I am not arguing against showing a relationship between a module and a process, just saying that the kind of relationship isn't recognisably an "instance" relationship. Actually, processes are NOT created by modules, processes are created by functions in modules. So we have ++========++ is-part-of +----------+ ?creates? _______ || module || <----------- | function | ----------> (process) ++========++ +----------+ ~~~~~~~ This distinction matters when a module contains more than one function that calls spawn. In this case, it is quite likely that the function that calls spawn will not be exported. We need to distinguish between a process p that is registered under the name 'p' and a process P that is just some process we're labelling in this diagram. And that means that using P1:my_mod is doubly worrisome: P1 is a *creation* of my_mod, not an *instance* of it, and my_mod is *not* a process registered under the name 'my_mod'. We turn to figure 14: "Process P1 has API f/n". In what sense does a process "have" a function? Consider a process P1 spawned in module M1 which exports f/n, but where P1 is currently executing in module M2, which also export f/n. Which f/n does P1 "have"? I honestly cannot understand this. When would you use it? Oh, figure 13 shows a ModuleProcess. What the heck is a ModuleProcess? (Sounds a bit like an instance of a synchronized class.) Staring hard at figure 15 and reading the text nearby over and over until the cotton wool is bursting from my head, I *think* figure 15 is supposed to mean module my_mod exports f/N and g/N. It creates a process P1 by some unspecified means. If you call f/N it will ignore P1 (although this is an argument from silence). If you call g/N it will do something with P1; it might send a message, it might kill it using erlang:exit/2, it might monkey with its flags using erlang:process_flag/3, it might suspend or resume it, I'm *not saying*). Is "a call to m:g/N may produce an effect in P" what is meant by "P _has_ g/N"? >> So for me one of the essential feature of any "boxes and >> connectors" notation is that there has to be a defined >> way to map that to some sort of set of facts that I can >> write queries on. That is, it has to be more than pretty >> pictures. >> >> Turtle (RDF) is fine; SWI Prolog comes with a decent kit for >> loading/exporting/storing/querying RDF. Datalog is fine too. >> It might be OK to make it something that can be visually >> manipulated in 'dia', and define a mapping between dia >> file format and a semantic form. >> >> Thing is, *IF* this (or any other notation) is any good at >> revealing just enough relevant structure, then it ought to >> be possible to write "flaw detectors" to spot antipatterns. >> > I'm certainly for this kind of formalism, but I am not able to do it since my > knowledge in this area is non-existent. You do not need to understand any particular formalism. Actually, that was the point of me mentioning several. What you need to have is a SEMANTICS which involves specifying the types of concepts and the relationships between them. If you know how to use a relational data base, *that* will do. Given that you have a diagram "process P has function f/N", represent that as process_function_arity (process_name, function_name, arity) 'P', 'f', N > Do you have pointers to some introduction texts that can help guide the design of the > textual notation? Ah, but I'm not talking about a textual notation! I'm asking for a *semantics*. I'm asking that a graphical notation should have an *abstract* equivalent as a set of facts (which could be RDF triples or rows in a relational data base or ...) and the names and meanings of the predicates in this abstract equivalent should be spelled out. How those facts are turned into text (if indeed they ever are) is comparatively unimportant. Let's take figure 15. module(my_mod). function('f/N', f, N). process_var('P1'). function('g/N', g, N). instance('P1', my_mod). has(my_mod, 'f/N'). has('P1', 'g/N'). Here we have facts like "module(Atom)" -- Atom is the name of a module -- and "process_var(Atom)" -- Atom is a variable name local to the current diagram which stands for a process and "function(Atom1, Atom2, Integer)" -- Atom1 is an arbitrary atom labelling a function box, Atom2 is the name of that function, and Arity is its arity" and "instance(Atom1, Atom2)" -- Atom1 is either a process node name or a process_var node name and Atom2 is a module name and that module creates that process-- and so on. It is quite unimportant whether it's written like that, or like (define-node '|my_mod| :type module) (define-node '|f/N| :type function) (define-node '|g/N| :type function) (define-node '|P1| :type process-var) (instance '|P1| '|my_mod|) (has '|my_mod| '|f/N|) (has '|P1| '|g/N|) or like Given any of these, it's trivial to produce the other two. What matters is the *semantics* these express. A human-readable textual notation is something else again, satisfying different design criteria. > > What I have been missing, and what drives me to create Visual Erlang, is a way to > capture how the supervision tree interacts with the functionality of the > module/processes. An example that illustrates precisely that would be create. > > Apart from being able to talk about what a process should be responsible for I am > also aiming at getting to a point where I can interactively browse through a code > base and uncover the architecture, while deciding which parts to hide through > abstractions. That is a bit down the road, though. I have been day-dreaming about a paper for an Erlang conference with the working title "Why can't I see the structure?". Let me briefly mention some annotations I've started using with Smalltalk: This method exists for compatibility with DIALECT. Don't blame *ME* for the interface. For reasons and examples, read their documentation. This method isn't really necessary; you could get the same result by using #SELECTOR but with more effort. If you're trying to understand this class, ignore this method for now. This method gets the same effect that combining SELECTOR and SELECTOR2 in the obvious way would. It might save time, save memory, or be legal when for technical reasons the separate parts wouldn't be. If you are trying to understand this class, ignore this method for now and look at the other two. This method isn't meant for normal use; it exists to support SELECTOR. If you want to understand this method, look at SELECTOR first. This is in addition to the grouping of methods into "categories" that is traditional in Smalltalk. When I look at a function in a module, I need to know WHAT does this function do? HOW does it do that? WHY does it exist? The thing that is systematically missing from things like UML is the WHY. I find that while UML _could_ tell me a great deal, in practice it _doesn't_ tell me anything I couldn't get from a cross-referencer. So if I am staring at a diagram showing a bunch of processes, I want to know WHY they are there. If there are two processes with a third managing them, is work being sent to them both, is one a hot standby for the other, are they using different algorithms so that one is serving as a cross-check for another, is one a high security version and one a low security version, or what? Arguably, when I know WHY processes exist, I should be able to figure out *whether* they should be linked. > Funny that you bring this up - there has just been an application for an EU grant > (CoCo) to look at communication contracts between processes, which is very much about > building on top of UBF and get something that captures the protocols in the same way > specs capture types today. > > I'd love to get protocols covered as well, but I don't feel that squeezing them into > Visual Erlang is the right approach. Look, instead of (Process_Var : module_name) the only change you need is to use (Process_Var : protocol_name) instead. Protocols really *are* "types for processes". The bulk of the information about the protocol could be in some other document, but *some* identification of the protocol belongs in the process box. There's arguably something else. UBF has the notion of a process being in a *state*. For that matter, Microsoft's Sing# language for the Singularity operating system has precisely the same notation built into its core syntax for channels. It isn't just instances of gen_fsm that have states. Maybe you could have (process) / \ <|state|> <|state|> or something. The way OPM puts states inside objects is a royal road to unreadability for non-trivial diagrams. > I have stolen some of the ideas from Object-Process Methodology (OPM). Hmm. The only thing I find more off-putting than "Holistic" in a book title is "Wholistic". If you thought OPM was a good starting point, then the idea of displaying UBF states in an Erlang notation should appeal. > Hopefully the CoCo project will shed some light on this. Well, there's a pretty strong glimmer right here. In UML, you have |instance name: class name|. The class name is *NOT* the name of whatever it is that creates the instance and it is NOT the name of the package that contains the 'new' expression. The logical application of that to Erlang is (process name: protocol name) as suggested above. protocol : process :: interface : object. I don't suppose the CoCo project want a long-distance collaborator (:-). There are at least three purposes a graphical notation may serve: (1) Design. For this, it is important that it should be very easy to *change* a diagram and there should be good tools to *check* it. (2) Code generation. Given a sufficiently detailed set of diagrams, you might want to generate (skeletal) code. This absolutely requires that the notation SCALE both up (to 100,000 line systems at least) and down. (3) Documentation. What this requires above all is readability. A central limitation on readability is that visual diagrams just *cannot* hold very much information. And *that* means that you have to have a multitude of overlapping diagrams and need good tools for flicking through dozens if not hundreds of diagrams, being able to specify what to look at by something information retrieval-ish and by something databasish. It's not clear to me that a notation designed for one of these purposes will be particularly good at the others. You know, I think the way to get started on something like this is not to work from the bottom up picking notation from elsewhere and adapting it, but to take something like Yaws or Cowboy and try to document *that*. Above all, it would not be possible to avoid the scale issue, and _that_, I think, is where a "visual" notation needs the most thought. From ok@REDACTED Tue May 6 07:39:23 2014 From: ok@REDACTED (Richard A. O'Keefe) Date: Tue, 6 May 2014 17:39:23 +1200 Subject: [erlang-questions] STM vs Actor Model? In-Reply-To: References: Message-ID: <691399CA-CA79-457A-90B5-81170B540ED5@cs.otago.ac.nz> On 6/05/2014, at 4:18 PM, Bin Wang wrote: > I'm coming up with this idea with STM. Please see how about this > comparing to Erlang's way? > > In Erlang, actors communicate through messages. That is, a request is > sent, and the actor do one of them at a time. Right. However, while the messages in an actor's mailbox are serialised, this places no constraints on what *other* actors are doing. > > But in STM way, all requests could be done at the same time. Well, sort of. > And then > see if there are some conflicts. This means that a transaction must have clear boundaries. > If so, undo and redo. It seems with > high performance and less annoying than locks. Well, maybe. The thing is that there is no prior bound on the number of times an (arbitrarily complicated!) transaction might have to be undone and redone. In a situation where locks would have had high contention, transactions will have high redoes. Modern STM systems are either done entirely in software, or in a rather delicate mix of hardware and software. STM works quite nicely in Haskell because the vast majority of memory references in Haskell are to logically immutable data; thanks to the types, the Haskell compiler can detect the tiny minority of stores that might need logging and undoing. Erlang, in contrast, does not need special hardware and does not need heavy duty compilation techniques to reduce STM overheads. Indeed, since the mailbox of an Erlang process is a queue, it *should* be possible to have an Erlang implementation where process to process communication does not involve locks. (After all, an entire operating system kernel has been built using lock-free data structures, so why not Erlang?) The thing is that transactional memory is a way of writing multithreaded imperative programs to run in a single address space. But what if you are writing a distributed program? > > So thinking about this kind of actor or object: it doesn't do only one > request in the same time. But it will treat its methods as > transactions. So multi processes to call its methods could be executed > in the same time and the actor/object will not be blocked in the most > of the time. I think the answer here is "show us a problem where you need that". From wbin00@REDACTED Tue May 6 07:54:10 2014 From: wbin00@REDACTED (Bin Wang) Date: Tue, 6 May 2014 13:54:10 +0800 Subject: [erlang-questions] STM vs Actor Model? In-Reply-To: <691399CA-CA79-457A-90B5-81170B540ED5@cs.otago.ac.nz> References: <691399CA-CA79-457A-90B5-81170B540ED5@cs.otago.ac.nz> Message-ID: Hi, Richard Thanks for the answer. One of the situation is like this: I have a chat service that would have many rooms. Each room have a limit of the max number of people. When a people comes, it will enter the room with the least people. I treat every person as an actor and the room manager as an actor. So every time the people enter or leave, it will ask and send request to the room manager to update its state. So the room manager seems to be a single point which may receive many requests. I'd like to see if STM could speed it up. And more, if it could speed things up in general. In distributed system, actors could send messages to each other. But while on the single machine, is it possible to don't just block the whole actor while we are requesting it for something? 2014-05-06 13:39 GMT+08:00 Richard A. O'Keefe : > > On 6/05/2014, at 4:18 PM, Bin Wang wrote: >> I'm coming up with this idea with STM. Please see how about this >> comparing to Erlang's way? >> >> In Erlang, actors communicate through messages. That is, a request is >> sent, and the actor do one of them at a time. > > Right. However, while the messages in an actor's mailbox are > serialised, this places no constraints on what *other* actors > are doing. >> >> But in STM way, all requests could be done at the same time. > > Well, sort of. > >> And then >> see if there are some conflicts. > > This means that a transaction must have clear boundaries. > >> If so, undo and redo. It seems with >> high performance and less annoying than locks. > > Well, maybe. The thing is that there is no prior bound on > the number of times an (arbitrarily complicated!) transaction > might have to be undone and redone. In a situation where > locks would have had high contention, transactions will have > high redoes. > > Modern STM systems are either done entirely in software, > or in a rather delicate mix of hardware and software. > > STM works quite nicely in Haskell because the vast majority > of memory references in Haskell are to logically immutable > data; thanks to the types, the Haskell compiler can detect > the tiny minority of stores that might need logging and undoing. > > Erlang, in contrast, does not need special hardware and does > not need heavy duty compilation techniques to reduce STM > overheads. Indeed, since the mailbox of an Erlang process > is a queue, it *should* be possible to have an Erlang > implementation where process to process communication does not > involve locks. (After all, an entire operating system kernel > has been built using lock-free data structures, so why not Erlang?) > > The thing is that transactional memory is a way of writing > multithreaded imperative programs to run in a single > address space. But what if you are writing a distributed > program? >> >> So thinking about this kind of actor or object: it doesn't do only one >> request in the same time. But it will treat its methods as >> transactions. So multi processes to call its methods could be executed >> in the same time and the actor/object will not be blocked in the most >> of the time. > > I think the answer here is "show us a problem where you need that". > > From schneider@REDACTED Tue May 6 10:27:08 2014 From: schneider@REDACTED (Schneider) Date: Tue, 06 May 2014 10:27:08 +0200 Subject: [erlang-questions] Newbie: at what point should an event handler be installed? Message-ID: <53689CDC.90707@xs4all.nl> Hi list, I have a very basic application with a supervisor started which starts a gen_fsm which handles some serial line data and a gen_event process which should log some of the serial line data to a mnesia table. I want to implement the logging to the mnesia table as an event handler. At what point does one install the event handler using gen_event:add_handler. Logging to the database is always on, but logging to the terminal is optional. Installing the handler at the application level after starting the supervisor works but does not feel right, nor does the supervisor. Could you give me some advice? Thanks. Frans From schneider@REDACTED Tue May 6 10:29:36 2014 From: schneider@REDACTED (Schneider) Date: Tue, 6 May 2014 10:29:36 +0200 Subject: [erlang-questions] Newbie: At what point should event handler be installed? Message-ID: <000001cf6905$50c42ae0$f24c80a0$@nl> Hi list, I have a very basic application with a supervisor started which starts a gen_fsm which handles some serial line data and a gen_event process which should log some of the serial line data to a mnesia table. I want to implement the logging to the mnesia table as an event handler. At what point does one install the event handler using gen_event:add_handler. Logging to the database is always on, but logging to the terminal is optional. Installing the handler at the application level after starting the supervisor works but does not feel right, nor does the supervisor. Could you give me some advice? Thanks. Frans -------------- next part -------------- An HTML attachment was scrubbed... URL: From torben.hoffmann@REDACTED Tue May 6 11:16:53 2014 From: torben.hoffmann@REDACTED (Torben Hoffmann) Date: Tue, 06 May 2014 11:16:53 +0200 Subject: [erlang-questions] Visual Erlang notation v0.1.0 - feedback request In-Reply-To: References: Message-ID: Hi Richard, Richard A. O'Keefe writes: > On 5/05/2014, at 11:11 PM, Torben Hoffmann wrote: >> ok@REDACTED writes: >> >>> I am viewing visual_erlang.pdf in Acrobat Professional >>> and most of the figures are missing the connecting lines >>> you'd expect to find in them. >>> >> That is most peculiar - I am using Skim, but opening in the free Adobe Reader shows >> no signs of errors. >> >> Are there any log files that states anything about my PDF being bad? > > On my laptop, using Adobe Professional, the lines weren't there. > On my desktop, using Preview, they are. > Presumably a PDF version issue. > Let's hope that the issue is localised - otherwise I will investigate further. > Re figure 10: "Module my_mod has API f/N". > Eh? "Application *Programming* Interface" (as opposed to > "Application *Binary* Interface) is the whole set of source- > level accessible operations provided by something. > "f/N" is (a name for) a SINGLE FUNCTION. > Why use three obscure and arguably inappropriate syllables > "eh pee ai" when two clear appropriate syllables "funk shn" will do? > The "API" of a module (if we want to embrace that ugly and > confusing term at all) is the *whole* export set of the module. > I agree. Very good point. I wanted to have a distinction between functions that are part of the API of the module and internal functions as well as the more abstract functionality. But this has an easy fix: we change the textual version to "Module my_mod has function f/N." Should the need for internal functions arise it can be stated as "Module my_mod has internal function f/N." > The text says "a diamond head from the module to the function" > but figure 10 shows a connector that I cannot perceive as > anything but pointing from the function to the module. > Given that modules and functions have different kinds of names > and different kinds of boxes, it's not clear that the direction > of the link needs to be distinguished in yet a third way. > I might have tried to steal too much from OPM in this case. I think you are right, modules, processes and functions have different boxes and when they are connected it is obvious what the meaning is. A connection from a module to a function means that the function is defined in the module. A connection from a process to a function just follows the extension of the module to the function, so same thing. A connection from a module to a process means that the process has been started (!) from the module. > As I shall argue shortly, we may need to include functions > in a diagram that are NOT exported from a module. > That was the intention all along - I should have made that more clear or have let you have access to my brain, but as Erlangers we sort of frown upon shared memory, right? ;-) > Figure 11 says "Module my_mod has instance P1" but while > parametric modules do have instances, those instances are > modules, not processes. No process is, and no process > can be, an *instance* of a module. On the other hand, it > is fair to say that a module *creates* a process. So > some kind of > > ++========++ ?creates? _______ > || module || ----------> (process) > ++========++ ~~~~~~~ > > makes sense. (Note that the information flow is *from* the > module *to* the process, so a data flow arrow goes this way > around.) > Excellent! That is a way better way of stating this relationship. The only problem with this proposal is that it is not my own idea!! > Amongst other things, for X to be an instance of Y, it > has to be a special case of the *whole* of Y. But if a > module contains two 'spawn' calls, how can that be? > (This is in marked contrast to classes, where an object > *is* an instance of the *whole* class; every part of the > class is equally relevant to it.) > Hmmm, I didn't expect that scenario... > I am not arguing against showing a relationship between > a module and a process, just saying that the kind of > relationship isn't recognisably an "instance" relationship. > Totally agree. My brain still has a bit too much OPM in it - your comments will help clear that out. > Actually, processes are NOT created by modules, > processes are created by functions in modules. > So we have > > ++========++ is-part-of +----------+ ?creates? _______ > || module || <----------- | function | ----------> (process) > ++========++ +----------+ ~~~~~~~ > > This distinction matters when a module contains more than one > function that calls spawn. In this case, it is quite likely > that the function that calls spawn will not be exported. > This is true, but when I reflect over how everyone I have worked with talks then there is a very strong connection between module and the processes created by typically one function in that module. When I talk about processed created by a function in my_mod I do refer to them as being my_mod's - that is the reasoning behind the notation. But my approach totally ignores the details of what function that is used to spawn the process and there can be cases where that is an issue. Visual Erlang has to be natural so I will propose that we get two notations for this. Module my_mod creates process P. #The spawing function is abstracted. Module my_mod has function f/N. Function f/N creates process P. Then the distinction can be made, but it is also possible to focus on the abstract relationship. > We need to distinguish between a process p that is > registered under the name 'p' and a process P that is > just some process we're labelling in this diagram. > Agreed - I hadn't gotten to that level of detail in the first draft. > And that means that using P1:my_mod is doubly worrisome: > P1 is a *creation* of my_mod, not an *instance* of it, > and my_mod is *not* a process registered under the name > 'my_mod'. > It is meant as a short hand for what I have now stated to be: Module my_mod creates process P. Will that work? Or is there a better way to represent this relationship? > We turn to figure 14: "Process P1 has API f/n". > In what sense does a process "have" a function? > Consider a process P1 spawned in module M1 which > exports f/n, but where P1 is currently executing > in module M2, which also export f/n. Which f/n > does P1 "have"? I honestly cannot understand > this. When would you use it? > I need to explain the context a bit better, fair point. f/N is a function in module my_mod that is used to interact with the process P1 created by the module my_mod. This comes back to the abstract way I explained above - this is simply how we talk about processes and "their" functions. Without this association of functions to processes one would have to make the message passing from the function called to the process explicit and that is cumbersome plus against the way many talk about processes. > Oh, figure 13 shows a ModuleProcess. What the heck > is a ModuleProcess? (Sounds a bit like an instance > of a synchronized class.) > :my_mod: on its own is supposed to designate a process called my_mod created by the module my_mod. It happens quite often that a module is implemented just to create one named process with the same name as the module, so I wanted a short and for that. I'm very open to different names and notation, but I want a short hand for this. > Staring hard at figure 15 and reading the text nearby > over and over until the cotton wool is bursting from > my head, I *think* figure 15 is supposed to mean > > module my_mod exports f/N and g/N. > It creates a process P1 by some unspecified means. > If you call f/N it will ignore P1 (although this > is an argument from silence). > If you call g/N it will do something with P1; > it might send a message, it might kill it > using erlang:exit/2, it might monkey with its > flags using erlang:process_flag/3, it might > suspend or resume it, I'm *not saying*). > > Is "a call to m:g/N may produce an effect in P" what > is meant by "P _has_ g/N"? > I think I have explained the bits involved in this above, so I hope that the intention behind this is now clear. With then new syntax: Module my_mod creates P1. Module my_mod has function f/N. Process P1 has function g/N. g/N is a function of the my_mod module that will be dealt with in the process P1. > >>> So for me one of the essential feature of any "boxes and >>> connectors" notation is that there has to be a defined >>> way to map that to some sort of set of facts that I can >>> write queries on. That is, it has to be more than pretty >>> pictures. >>> >>> Turtle (RDF) is fine; SWI Prolog comes with a decent kit for >>> loading/exporting/storing/querying RDF. Datalog is fine too. >>> It might be OK to make it something that can be visually >>> manipulated in 'dia', and define a mapping between dia >>> file format and a semantic form. >>> >>> Thing is, *IF* this (or any other notation) is any good at >>> revealing just enough relevant structure, then it ought to >>> be possible to write "flaw detectors" to spot antipatterns. >>> >> I'm certainly for this kind of formalism, but I am not able to do it since my >> knowledge in this area is non-existent. > > You do not need to understand any particular formalism. > Actually, that was the point of me mentioning several. > What you need to have is a SEMANTICS which involves > specifying the types of concepts and the relationships > between them. If you know how to use a relational > data base, *that* will do. > > Given that you have a diagram "process P has function f/N", > represent that as > process_function_arity (process_name, function_name, arity) > 'P', 'f', N > >> Do you have pointers to some introduction texts that can help guide the design of the >> textual notation? > > Ah, but I'm not talking about a textual notation! > I'm asking for a *semantics*. > I'm asking that a graphical notation should have > an *abstract* equivalent as a set of facts (which > could be RDF triples or rows in a relational data > base or ...) and the names and meanings of the > predicates in this abstract equivalent should be > spelled out. How those facts are turned into text > (if indeed they ever are) is comparatively unimportant. > > Let's take figure 15. > > module(my_mod). > function('f/N', f, N). > process_var('P1'). > function('g/N', g, N). > instance('P1', my_mod). > has(my_mod, 'f/N'). > has('P1', 'g/N'). > > Here we have facts like "module(Atom)" -- Atom is the name of a > module -- and "process_var(Atom)" -- Atom is a variable name > local to the current diagram which stands for a process and > "function(Atom1, Atom2, Integer)" -- Atom1 is an arbitrary > atom labelling a function box, Atom2 is the name of that > function, and Arity is its arity" and "instance(Atom1, Atom2)" > -- Atom1 is either a process node name or a process_var node > name and Atom2 is a module name and that module creates that > process-- and so on. > > It is quite unimportant whether it's written like that, > or like > (define-node '|my_mod| :type module) > (define-node '|f/N| :type function) > (define-node '|g/N| :type function) > (define-node '|P1| :type process-var) > (instance '|P1| '|my_mod|) > (has '|my_mod| '|f/N|) > (has '|P1| '|g/N|) > or like > > > > > > > > > > > Given any of these, it's trivial to produce the other two. > What matters is the *semantics* these express. > > A human-readable textual notation is something else again, > satisfying different design criteria. I get your point. It makes sense. I will try to add a semantic layer as well. In fact, it is probably best to define that first and then decide if a textual notation is needed. >> >> What I have been missing, and what drives me to create Visual Erlang, is a way to >> capture how the supervision tree interacts with the functionality of the >> module/processes. > > An example that illustrates precisely that would be create. It will be added - either in this document or in the Erlang Concurrency Patterns. >> >> Apart from being able to talk about what a process should be responsible for I am >> also aiming at getting to a point where I can interactively browse through a code >> base and uncover the architecture, while deciding which parts to hide through >> abstractions. That is a bit down the road, though. > > I have been day-dreaming about a paper for an Erlang conference > with the working title "Why can't I see the structure?". > > Let me briefly mention some annotations I've started using > with Smalltalk: > > > > This method exists for compatibility with DIALECT. > Don't blame *ME* for the interface. > For reasons and examples, read their documentation. > > > > This method isn't really necessary; you could get > the same result by using #SELECTOR but with more > effort. If you're trying to understand this class, > ignore this method for now. > > [for: #time|#space|#safety]> > > This method gets the same effect that combining > SELECTOR and SELECTOR2 in the obvious way would. > It might save time, save memory, or be legal when > for technical reasons the separate parts wouldn't be. > If you are trying to understand this class, > ignore this method for now and look at the other two. > > > > This method isn't meant for normal use; it exists > to support SELECTOR. If you want to understand > this method, look at SELECTOR first. > > This is in addition to the grouping of methods into "categories" > that is traditional in Smalltalk. > > When I look at a function in a module, I need to know > > WHAT does this function do? > HOW does it do that? > WHY does it exist? > > The thing that is systematically missing from things like UML > is the WHY. I find that while UML _could_ tell me a great > deal, in practice it _doesn't_ tell me anything I couldn't > get from a cross-referencer. > > So if I am staring at a diagram showing a bunch of processes, > I want to know WHY they are there. If there are two processes > with a third managing them, is work being sent to them both, > is one a hot standby for the other, are they using different > algorithms so that one is serving as a cross-check for another, > is one a high security version and one a low security version, > or what? > > Arguably, when I know WHY processes exist, I should be able > to figure out *whether* they should be linked. > That is a nice way of documenting it in the code. For my own needs I still desire to have an architectural diagram of a system to better understand the interactions. One still has to describe the WHY - that never goes away, not even with a pretty diagram. >> Funny that you bring this up - there has just been an application for an EU grant >> (CoCo) to look at communication contracts between processes, which is very much about >> building on top of UBF and get something that captures the protocols in the same way >> specs capture types today. >> >> I'd love to get protocols covered as well, but I don't feel that squeezing them into >> Visual Erlang is the right approach. > > Look, instead of > > (Process_Var : module_name) > > the only change you need is to use > > (Process_Var : protocol_name) > > instead. Protocols really *are* "types for processes". > The bulk of the information about the protocol could be in some > other document, but *some* identification of the protocol > belongs in the process box. > Hmmmm, that's an interesting way of approaching it. I have to think about how to fit this with the more structural view that Visual Erlang has right now. Both has its place, so I'd like to cover both. And your remark about the protocol to be in some other document actually lends itself quite nicely to getting both aspects integrated. > There's arguably something else. > > UBF has the notion of a process being in a *state*. > For that matter, Microsoft's Sing# language for the > Singularity operating system has precisely the same > notation built into its core syntax for channels. > > It isn't just instances of gen_fsm that have states. > > > Maybe you could have > > (process) > / \ > <|state|> <|state|> > > or something. The way OPM puts states inside objects is a royal > road to unreadability for non-trivial diagrams. > I have that in my paper notes - didn't get around to put them into the document yet. There will be no putting state inside processes! >> I have stolen some of the ideas from Object-Process Methodology (OPM). > > Hmm. The only thing I find more off-putting than "Holistic" > in a book title is "Wholistic". > > If you thought OPM was a good starting point, then the idea of > displaying UBF states in an Erlang notation should appeal. > Indeed - have shown that in hand written diagrams at conferences already. >> Hopefully the CoCo project will shed some light on this. > > Well, there's a pretty strong glimmer right here. > > In UML, you have |instance name: class name|. > The class name is *NOT* the name of whatever it is > that creates the instance and it is NOT the name > of the package that contains the 'new' expression. > The logical application of that to Erlang is > (process name: protocol name) as suggested above. > protocol : process :: interface : object. > That does not look too bad - will keep it in mind. > I don't suppose the CoCo project want a long-distance collaborator (:-). > Let's get the EU to approve the project first! But I, for one, would not object to having long-distance collaborators like you involved. I'm pretty sure the rest of the consortium is on the same page. > There are at least three purposes a graphical notation may serve: > > (1) Design. > > For this, it is important that it should be very easy to > *change* a diagram and there should be good tools to *check* it. > > (2) Code generation. > > Given a sufficiently detailed set of diagrams, you might > want to generate (skeletal) code. This absolutely requires > that the notation SCALE both up (to 100,000 line systems at > least) and down. > > (3) Documentation. > > What this requires above all is readability. > > A central limitation on readability is that visual > diagrams just *cannot* hold very much information. > And *that* means that you have to have a multitude > of overlapping diagrams and need good tools > for flicking through dozens if not hundreds of > diagrams, being able to specify what to look at by > something information retrieval-ish and by > something databasish. > > It's not clear to me that a notation designed for one of these > purposes will be particularly good at the others. > > You know, I think the way to get started on something like > this is not to work from the bottom up picking notation from > elsewhere and adapting it, but to take something like Yaws > or Cowboy and try to document *that*. Above all, it would > not be possible to avoid the scale issue, and _that_, I think, > is where a "visual" notation needs the most thought. It may come across as a bottom-up approach, but Jesper and I started out using OPM to describe Erlang Concurrency Patterns, which sort of worked, but then I was strongly advised to invent Visual Erlang by someone who had been down the OPM route with Erlang. So Visual Erlang is born out of a need to be able to express these concurrency patterns. I admit, that it is not something at scale, so there is a to-do on documenting something bigger before we reach v1.0.0. Right now I just want to close what to me is an obvious void on the architectural level and then take the next problem after that. Hope this makes sense. Thanks a lot for the very constructive and valuable feed-back - it is appreciated and will be used! Cheers, Torben -- Torben Hoffmann CTO Erlang Solutions Ltd. Tel: +45 25 14 05 38 http://www.erlang-solutions.com From ok@REDACTED Tue May 6 12:46:57 2014 From: ok@REDACTED (ok@REDACTED) Date: Tue, 6 May 2014 22:46:57 +1200 Subject: [erlang-questions] STM vs Actor Model? In-Reply-To: References: <691399CA-CA79-457A-90B5-81170B540ED5@cs.otago.ac.nz> Message-ID: <1c7cde6df975cccb2ab271c8dc12ccb4.squirrel@chasm.otago.ac.nz> > Thanks for the answer. One of the situation is like this: > > I have a chat service that would have many rooms. Each room have a > limit of the max number of people. When a people comes, it will enter > the room with the least people. I treat every person as an actor and > the room manager as an actor. So every time the people enter or leave, > it will ask and send request to the room manager to update its state. > > So the room manager seems to be a single point which may receive many > requests. I'd like to see if STM could speed it up. Observation 1: if the room manager is to know which is "the room with the least people", it *has* to be a serialisation point. Observation 2: you probably *don't* need to know what is the absolute best room. You just need not to pick bad rooms. So you could have M managers each managing N rooms. When a person arrives, it picks a random manager and asks it what room to go to. If a manager has no suitable rooms, it sends a "try another manager" response. This reduces the amount of traffic each manager has to handle by a factor of M. This is very likely *better* than TM would gives you. A slightly different design would have a meta-manager. Just as rooms tells their manager when their occupancy changes, so managers tell the meta-manager when their "close to overload" status changes. A manager with too little spare capacity delegates requests to the meta-manager, which forwards them to managers that aren't overloaded. This is just a rough sketch, but the key principle is "don't try to speed up contention points, *eliminate* them." > > And more, if it could speed things up in general. > > In distributed system, actors could send messages to each other. But > while on the single machine, is it possible to don't just block the > whole actor while we are requesting it for something? Message passing in Erlang is asynchronous. If process S sends a message to process R, S does not wait. If S wants a reply from R, it may have to wait for that, not because of anything about Erlang's implementation, but just because of the logic of the situation. Some Erlang processes exist in order to be serialisation points. Let me put it this way. I do want my phone to be able to receive and store text messages while I'm making a call. But I don't want it accepting a second call while I've already got one in progress. If two things can happen at the same time, they should be handled by two processes. It is certainly imaginable that ETS and DETS might benefit from some sort of lock-free or TM implementation underneath. And it is equally imaginable that there may be NIFs that should be doing something like that. There is an article on ETS and TM that you may find interesting: http://dl.acm.org/citation.cfm?id=2034658 From rtrlists@REDACTED Tue May 6 13:07:03 2014 From: rtrlists@REDACTED (Robert Raschke) Date: Tue, 6 May 2014 12:07:03 +0100 Subject: [erlang-questions] Newbie: at what point should an event handler be installed? In-Reply-To: <53689CDC.90707@xs4all.nl> References: <53689CDC.90707@xs4all.nl> Message-ID: Hi Frans, you would add the handler at the point you want it to start handling events. So, probably just before your fsm kicks off, I would have thought. You can have your supervisor be in charge of starting first your event manager and then your fsm, and have the start_link or init of your fsm add your event handler to the manager. I'm assuming your fsm is the place that produces the events and that they're reasonably specific to your app, so adding the handler there makes sense to me. Hope this helps, Robby On May 6, 2014 9:27 AM, "Schneider" wrote: > Hi list, > > I have a very basic application with a supervisor started which starts a > gen_fsm which handles some serial line data and a gen_event process which > should log some of the serial line data to a mnesia table. I want to > implement the logging to the mnesia table as an event handler. At what > point does one install the event handler using gen_event:add_handler. > Logging to the database is always on, but logging to the terminal is > optional. > Installing the handler at the application level after starting the > supervisor works but does not feel right, nor does the supervisor. > Could you give me some advice? > Thanks. > > Frans > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From ddosia@REDACTED Tue May 6 13:19:38 2014 From: ddosia@REDACTED (Daniil Churikov) Date: Tue, 6 May 2014 15:19:38 +0400 Subject: [erlang-questions] Separation code from data Message-ID: I used to work on a project where some parts of the system execution flow are configured through configs. Something like {app1, [ {callbacks, [ {Mod, Fun, Args}, ... ]} ]}. I found this is not obvious to understand how parts of the project are tied together in this conception. It reminds me how some of Java's application servers are configured through xml, it was always hard for me to find all places where I must put class name in order to satisfy it. This is rather silly question, but what pros and cons may be to do/not to do like this. -------------- next part -------------- An HTML attachment was scrubbed... URL: From jesper.louis.andersen@REDACTED Tue May 6 14:11:37 2014 From: jesper.louis.andersen@REDACTED (Jesper Louis Andersen) Date: Tue, 6 May 2014 14:11:37 +0200 Subject: [erlang-questions] STM vs Actor Model? In-Reply-To: <1c7cde6df975cccb2ab271c8dc12ccb4.squirrel@chasm.otago.ac.nz> References: <691399CA-CA79-457A-90B5-81170B540ED5@cs.otago.ac.nz> <1c7cde6df975cccb2ab271c8dc12ccb4.squirrel@chasm.otago.ac.nz> Message-ID: On Tue, May 6, 2014 at 12:46 PM, wrote: > Observation 2: you probably *don't* need to know what is the absolute > best room. You just need not to pick bad rooms. So you could have > M managers each managing N rooms. When a person arrives, it picks a > random manager and asks it what room to go to. If a manager has no > suitable rooms, it sends a "try another manager" response. This > reduces the amount of traffic each manager has to handle by a factor > of M. This is very likely *better* than TM would gives you. > Observation 3: if we can hash the picker in some way, we can do even better. Ask *some* of the managers randomly according to the hash of the picker. Choose the manager that gives the best answer. If a manager doesn't answer within a time frame, he is marked as overloaded and ignored. This provides fault tolerance in addition to the observations by Richard. -- J. -------------- next part -------------- An HTML attachment was scrubbed... URL: From vladdu55@REDACTED Tue May 6 15:09:38 2014 From: vladdu55@REDACTED (Vlad Dumitrescu) Date: Tue, 6 May 2014 15:09:38 +0200 Subject: [erlang-questions] Visual Erlang notation v0.1.0 - feedback request In-Reply-To: References: Message-ID: Hi! On Tue, May 6, 2014 at 11:16 AM, Torben Hoffmann < torben.hoffmann@REDACTED> wrote: > It may come across as a bottom-up approach, but Jesper and I started out > using OPM to > describe Erlang Concurrency Patterns, which sort of worked, but then I was > strongly > advised to invent Visual Erlang by someone who had been down the OPM route > with > Erlang. > > So Visual Erlang is born out of a need to be able to express these > concurrency > patterns. > I admit, that it is not something at scale, so there is a to-do on > documenting > something bigger before we reach v1.0.0. > > Right now I just want to close what to me is an obvious void on the > architectural > level and then take the next problem after that. > (just thinking out loud) It appears to me from the discussion so far that such a high-level architectural description of Erlang systems has two important usage categories that are not quite overlapping: A) describe and document existing systems and architectures B) open up for new and better ways to architect and orchestrate Erlang systems A involves among other things handling existing idioms (for example, when using gen_servers it is most often true that one can equate a process with a module, so it is reasonable to have a shortcut notation for that) B would include support for protocols and structural patterns, for example. Like it was noted before, it's probably difficult to have something that works well for both cases. A layered approach might work: a low-level notation that can handle anything, and a higher-level one that builds upon it. best regards, Vlad -------------- next part -------------- An HTML attachment was scrubbed... URL: From wbin00@REDACTED Tue May 6 15:12:45 2014 From: wbin00@REDACTED (Bin Wang) Date: Tue, 6 May 2014 21:12:45 +0800 Subject: [erlang-questions] STM vs Actor Model? In-Reply-To: References: <691399CA-CA79-457A-90B5-81170B540ED5@cs.otago.ac.nz> <1c7cde6df975cccb2ab271c8dc12ccb4.squirrel@chasm.otago.ac.nz> Message-ID: Thanks of all the answers! I learned a lot from "don't try to speed up contention points, *eliminate* them." The idea comes from Jesper hears a little like map-reduce for me. And for "block the actor", I didn't mean the messages passing are not asynced. But if we write a "handle_call" in a "gen_server" that takes a long time to compute things for example. Then the other requests behind this long time request are blocked (if it wants to get some information from the "gen_server"). From jesper.louis.andersen@REDACTED Tue May 6 15:23:42 2014 From: jesper.louis.andersen@REDACTED (Jesper Louis Andersen) Date: Tue, 6 May 2014 15:23:42 +0200 Subject: [erlang-questions] STM vs Actor Model? In-Reply-To: References: <691399CA-CA79-457A-90B5-81170B540ED5@cs.otago.ac.nz> <1c7cde6df975cccb2ab271c8dc12ccb4.squirrel@chasm.otago.ac.nz> Message-ID: On Tue, May 6, 2014 at 3:12 PM, Bin Wang wrote: > And for "block the actor", I didn't mean the messages passing are not > asynced. But if we write a "handle_call" in a "gen_server" that takes > a long time to compute things for example. Then the other requests > behind this long time request are blocked (if it wants to get some > information from the "gen_server"). > No. Not necessarily. You could return {noreply, State} in your handle_call/3 and then spawn a background worker to do the processing. When data comes back you can respond with gen_server:reply(From, Result). This avoids the "head of line blocking". -- J. -------------- next part -------------- An HTML attachment was scrubbed... URL: From lloyd@REDACTED Tue May 6 15:28:18 2014 From: lloyd@REDACTED (lloyd@REDACTED) Date: Tue, 6 May 2014 09:28:18 -0400 (EDT) Subject: [erlang-questions] Visual Erlang notation v0.1.0 - feedback request In-Reply-To: References: Message-ID: <1399382898.401830544@apps.rackspace.com> Hi Richard, Among many thoughtful comments and contributions, you've touched on a MAJOR documentation meta info oversight in all too many open-source projects: > WHAT does this function do? > HOW does it do that? > WHY does it exist? WHAT does this project do? HOW does it do that? WHY does it exist? (E.g., what problem does it solve?) The underlying question is, how much can the documentation author assume about the intended reader's level of knowledge? Too many authors assume far too much about the reader and his/her level of knowledge. We're all noobies at one time or another with respect to one software technology or another. And, as a life-long charter-member noobie, I can't tell you how many worthy open-source projects I've turned away from because I couldn't understand what in the hell was going on or why? From deep in Noobieville, I can't say how much I appreciate the fine ideas and thinking emerging in this thread. Best wishes, LRP -----Original Message----- From: "Richard A. O'Keefe" Sent: Tuesday, May 6, 2014 1:22am To: "Torben Hoffmann" Cc: "Erlang-Questions Questions" Subject: Re: [erlang-questions] Visual Erlang notation v0.1.0 - feedback request On 5/05/2014, at 11:11 PM, Torben Hoffmann wrote: > ok@REDACTED writes: > >> I am viewing visual_erlang.pdf in Acrobat Professional >> and most of the figures are missing the connecting lines >> you'd expect to find in them. >> > That is most peculiar - I am using Skim, but opening in the free Adobe Reader shows > no signs of errors. > > Are there any log files that states anything about my PDF being bad? On my laptop, using Adobe Professional, the lines weren't there. On my desktop, using Preview, they are. Presumably a PDF version issue. Re figure 10: "Module my_mod has API f/N". Eh? "Application *Programming* Interface" (as opposed to "Application *Binary* Interface) is the whole set of source- level accessible operations provided by something. "f/N" is (a name for) a SINGLE FUNCTION. Why use three obscure and arguably inappropriate syllables "eh pee ai" when two clear appropriate syllables "funk shn" will do? The "API" of a module (if we want to embrace that ugly and confusing term at all) is the *whole* export set of the module. The text says "a diamond head from the module to the function" but figure 10 shows a connector that I cannot perceive as anything but pointing from the function to the module. Given that modules and functions have different kinds of names and different kinds of boxes, it's not clear that the direction of the link needs to be distinguished in yet a third way. As I shall argue shortly, we may need to include functions in a diagram that are NOT exported from a module. Figure 11 says "Module my_mod has instance P1" but while parametric modules do have instances, those instances are modules, not processes. No process is, and no process can be, an *instance* of a module. On the other hand, it is fair to say that a module *creates* a process. So some kind of ++========++ ?creates? _______ || module || ----------> (process) ++========++ ~~~~~~~ makes sense. (Note that the information flow is *from* the module *to* the process, so a data flow arrow goes this way around.) Amongst other things, for X to be an instance of Y, it has to be a special case of the *whole* of Y. But if a module contains two 'spawn' calls, how can that be? (This is in marked contrast to classes, where an object *is* an instance of the *whole* class; every part of the class is equally relevant to it.) I am not arguing against showing a relationship between a module and a process, just saying that the kind of relationship isn't recognisably an "instance" relationship. Actually, processes are NOT created by modules, processes are created by functions in modules. So we have ++========++ is-part-of +----------+ ?creates? _______ || module || <----------- | function | ----------> (process) ++========++ +----------+ ~~~~~~~ This distinction matters when a module contains more than one function that calls spawn. In this case, it is quite likely that the function that calls spawn will not be exported. We need to distinguish between a process p that is registered under the name 'p' and a process P that is just some process we're labelling in this diagram. And that means that using P1:my_mod is doubly worrisome: P1 is a *creation* of my_mod, not an *instance* of it, and my_mod is *not* a process registered under the name 'my_mod'. We turn to figure 14: "Process P1 has API f/n". In what sense does a process "have" a function? Consider a process P1 spawned in module M1 which exports f/n, but where P1 is currently executing in module M2, which also export f/n. Which f/n does P1 "have"? I honestly cannot understand this. When would you use it? Oh, figure 13 shows a ModuleProcess. What the heck is a ModuleProcess? (Sounds a bit like an instance of a synchronized class.) Staring hard at figure 15 and reading the text nearby over and over until the cotton wool is bursting from my head, I *think* figure 15 is supposed to mean module my_mod exports f/N and g/N. It creates a process P1 by some unspecified means. If you call f/N it will ignore P1 (although this is an argument from silence). If you call g/N it will do something with P1; it might send a message, it might kill it using erlang:exit/2, it might monkey with its flags using erlang:process_flag/3, it might suspend or resume it, I'm *not saying*). Is "a call to m:g/N may produce an effect in P" what is meant by "P _has_ g/N"? >> So for me one of the essential feature of any "boxes and >> connectors" notation is that there has to be a defined >> way to map that to some sort of set of facts that I can >> write queries on. That is, it has to be more than pretty >> pictures. >> >> Turtle (RDF) is fine; SWI Prolog comes with a decent kit for >> loading/exporting/storing/querying RDF. Datalog is fine too. >> It might be OK to make it something that can be visually >> manipulated in 'dia', and define a mapping between dia >> file format and a semantic form. >> >> Thing is, *IF* this (or any other notation) is any good at >> revealing just enough relevant structure, then it ought to >> be possible to write "flaw detectors" to spot antipatterns. >> > I'm certainly for this kind of formalism, but I am not able to do it since my > knowledge in this area is non-existent. You do not need to understand any particular formalism. Actually, that was the point of me mentioning several. What you need to have is a SEMANTICS which involves specifying the types of concepts and the relationships between them. If you know how to use a relational data base, *that* will do. Given that you have a diagram "process P has function f/N", represent that as process_function_arity (process_name, function_name, arity) 'P', 'f', N > Do you have pointers to some introduction texts that can help guide the design of the > textual notation? Ah, but I'm not talking about a textual notation! I'm asking for a *semantics*. I'm asking that a graphical notation should have an *abstract* equivalent as a set of facts (which could be RDF triples or rows in a relational data base or ...) and the names and meanings of the predicates in this abstract equivalent should be spelled out. How those facts are turned into text (if indeed they ever are) is comparatively unimportant. Let's take figure 15. module(my_mod). function('f/N', f, N). process_var('P1'). function('g/N', g, N). instance('P1', my_mod). has(my_mod, 'f/N'). has('P1', 'g/N'). Here we have facts like "module(Atom)" -- Atom is the name of a module -- and "process_var(Atom)" -- Atom is a variable name local to the current diagram which stands for a process and "function(Atom1, Atom2, Integer)" -- Atom1 is an arbitrary atom labelling a function box, Atom2 is the name of that function, and Arity is its arity" and "instance(Atom1, Atom2)" -- Atom1 is either a process node name or a process_var node name and Atom2 is a module name and that module creates that process-- and so on. It is quite unimportant whether it's written like that, or like (define-node '|my_mod| :type module) (define-node '|f/N| :type function) (define-node '|g/N| :type function) (define-node '|P1| :type process-var) (instance '|P1| '|my_mod|) (has '|my_mod| '|f/N|) (has '|P1| '|g/N|) or like Given any of these, it's trivial to produce the other two. What matters is the *semantics* these express. A human-readable textual notation is something else again, satisfying different design criteria. > > What I have been missing, and what drives me to create Visual Erlang, is a way to > capture how the supervision tree interacts with the functionality of the > module/processes. An example that illustrates precisely that would be create. > > Apart from being able to talk about what a process should be responsible for I am > also aiming at getting to a point where I can interactively browse through a code > base and uncover the architecture, while deciding which parts to hide through > abstractions. That is a bit down the road, though. I have been day-dreaming about a paper for an Erlang conference with the working title "Why can't I see the structure?". Let me briefly mention some annotations I've started using with Smalltalk: This method exists for compatibility with DIALECT. Don't blame *ME* for the interface. For reasons and examples, read their documentation. This method isn't really necessary; you could get the same result by using #SELECTOR but with more effort. If you're trying to understand this class, ignore this method for now. This method gets the same effect that combining SELECTOR and SELECTOR2 in the obvious way would. It might save time, save memory, or be legal when for technical reasons the separate parts wouldn't be. If you are trying to understand this class, ignore this method for now and look at the other two. This method isn't meant for normal use; it exists to support SELECTOR. If you want to understand this method, look at SELECTOR first. This is in addition to the grouping of methods into "categories" that is traditional in Smalltalk. When I look at a function in a module, I need to know WHAT does this function do? HOW does it do that? WHY does it exist? The thing that is systematically missing from things like UML is the WHY. I find that while UML _could_ tell me a great deal, in practice it _doesn't_ tell me anything I couldn't get from a cross-referencer. So if I am staring at a diagram showing a bunch of processes, I want to know WHY they are there. If there are two processes with a third managing them, is work being sent to them both, is one a hot standby for the other, are they using different algorithms so that one is serving as a cross-check for another, is one a high security version and one a low security version, or what? Arguably, when I know WHY processes exist, I should be able to figure out *whether* they should be linked. > Funny that you bring this up - there has just been an application for an EU grant > (CoCo) to look at communication contracts between processes, which is very much about > building on top of UBF and get something that captures the protocols in the same way > specs capture types today. > > I'd love to get protocols covered as well, but I don't feel that squeezing them into > Visual Erlang is the right approach. Look, instead of (Process_Var : module_name) the only change you need is to use (Process_Var : protocol_name) instead. Protocols really *are* "types for processes". The bulk of the information about the protocol could be in some other document, but *some* identification of the protocol belongs in the process box. There's arguably something else. UBF has the notion of a process being in a *state*. For that matter, Microsoft's Sing# language for the Singularity operating system has precisely the same notation built into its core syntax for channels. It isn't just instances of gen_fsm that have states. Maybe you could have (process) / \ <|state|> <|state|> or something. The way OPM puts states inside objects is a royal road to unreadability for non-trivial diagrams. > I have stolen some of the ideas from Object-Process Methodology (OPM). Hmm. The only thing I find more off-putting than "Holistic" in a book title is "Wholistic". If you thought OPM was a good starting point, then the idea of displaying UBF states in an Erlang notation should appeal. > Hopefully the CoCo project will shed some light on this. Well, there's a pretty strong glimmer right here. In UML, you have |instance name: class name|. The class name is *NOT* the name of whatever it is that creates the instance and it is NOT the name of the package that contains the 'new' expression. The logical application of that to Erlang is (process name: protocol name) as suggested above. protocol : process :: interface : object. I don't suppose the CoCo project want a long-distance collaborator (:-). There are at least three purposes a graphical notation may serve: (1) Design. For this, it is important that it should be very easy to *change* a diagram and there should be good tools to *check* it. (2) Code generation. Given a sufficiently detailed set of diagrams, you might want to generate (skeletal) code. This absolutely requires that the notation SCALE both up (to 100,000 line systems at least) and down. (3) Documentation. What this requires above all is readability. A central limitation on readability is that visual diagrams just *cannot* hold very much information. And *that* means that you have to have a multitude of overlapping diagrams and need good tools for flicking through dozens if not hundreds of diagrams, being able to specify what to look at by something information retrieval-ish and by something databasish. It's not clear to me that a notation designed for one of these purposes will be particularly good at the others. You know, I think the way to get started on something like this is not to work from the bottom up picking notation from elsewhere and adapting it, but to take something like Yaws or Cowboy and try to document *that*. Above all, it would not be possible to avoid the scale issue, and _that_, I think, is where a "visual" notation needs the most thought. _______________________________________________ erlang-questions mailing list erlang-questions@REDACTED http://erlang.org/mailman/listinfo/erlang-questions From pierrefenoll@REDACTED Tue May 6 19:01:12 2014 From: pierrefenoll@REDACTED (Pierre Fenoll) Date: Tue, 6 May 2014 19:01:12 +0200 Subject: [erlang-questions] [ANN] OTP 17.0 on erldocs.com Message-ID: Hello! Erldocs, an alternative Erlang/OTP documentation and a doc generation tool has been updated! You will find documentation for Erlang/OTP release 17.0 at http://erldocs.com/ I have patched erldocs to be able to build the docs for 17.0-rc2 and 17.0 and was finally able to generate detailed specs information. For instance, here is the gb_sets page? - before: http://erldocs.com/R16B02/stdlib/gb_sets.html?i=1&search=gb_sets#add/2 - after: http://erldocs.com/17.0/stdlib/gb_sets.html?i=1&search=gb_sets#add/2 Still, there is an issue about missing include directories that inhibits my changes for some files: - The zip page before http://erldocs.com/R16B02/stdlib/zip.html?i=0&search=zip:cr#create/2 - ?and after: http://erldocs.com/17.0/stdlib/zip.html?i=0&search=zip:cre#create/2 (It is an ongoing work) As always, you'll find tarballs of the docs for different releases of OTP on erldocs.com. You can also build the docs for your own projects with the same tool hosted on GitHub: https://github.com/fenollp/erldocs Thanks to @daleharvey for this easy to maintain tool and to GitHub, hosting erldocs.com through gh-pages. I also want to thank those that sent patches, suggestions and bug reports. Cheers, -- Pierre Fenoll -------------- next part -------------- An HTML attachment was scrubbed... URL: From lists@REDACTED Tue May 6 19:27:24 2014 From: lists@REDACTED (Camille Troillard) Date: Tue, 6 May 2014 19:27:24 +0200 Subject: [erlang-questions] Serial device supervision strategy Message-ID: Hello, I am going back to Erlang after a bit of distraction, please excuse this rusty question. My application has to connect to a serial device which may or may not be plugged to the computer. It seemed a simple approach would be to try to connect to the device every seconds, and retry again until the connection is done. Ideally, I thought the design could be as follows: a gen_server (serial_endpoint) whose lifetime would be the same as the serial device?s connection is under supervision. If the serial_endpoint fails to start, then we try again a second later and so on. Likewise, if the connection is lost because the device is unplugged, the serial_endpoint dies, and we try again to start it a second later. Unfortunately, I don?t see how to achieve this restart strategy. Can someone help me find the right solution? Thank you in advance. Best Regards, Camille From dch@REDACTED Tue May 6 19:30:13 2014 From: dch@REDACTED (Dave Cottlehuber) Date: Tue, 6 May 2014 19:30:13 +0200 Subject: [erlang-questions] [ANN] OTP 17.0 on erldocs.com In-Reply-To: References: Message-ID: ? From: Pierre Fenoll pierrefenoll@REDACTED(mailto:pierrefenoll@REDACTED) Reply: Pierre Fenoll pierrefenoll@REDACTED(mailto:pierrefenoll@REDACTED) Date: 06. Mai 2014 at 19:01:47 To: erlang-questions@REDACTED Questions erlang-questions@REDACTED(mailto:erlang-questions@REDACTED) Subject: [erlang-questions] [ANN] OTP 17.0 on erldocs.com > Hello! > > Erldocs, an alternative Erlang/OTP documentation and a doc generation tool has been updated! > > You will find documentation for Erlang/OTP release 17.0 at http://erldocs.com/ > > I have patched erldocs to be able to build the docs for 17.0-rc2 and 17.0 > and was finally able to generate detailed specs information. > For instance, here is the gb_sets page? > before: http://erldocs.com/R16B02/stdlib/gb_sets.html?i=1&search=gb_sets#add/2 > after: http://erldocs.com/17.0/stdlib/gb_sets.html?i=1&search=gb_sets#add/2 > > > Still, there is an issue about missing include directories that inhibits my changes for some files: > > The zip page before http://erldocs.com/R16B02/stdlib/zip.html?i=0&search=zip:cr#create/2 > ?and after: http://erldocs.com/17.0/stdlib/zip.html?i=0&search=zip:cre#create/2 > > > (It is an ongoing work) > > As always, you'll find tarballs of the docs for different releases of OTP on erldocs.com(http://erldocs.com). > You can also build the docs for your own projects with the same tool hosted on GitHub: https://github.com/fenollp/erldocs > > Thanks to @daleharvey for this easy to maintain tool and to GitHub, hosting erldocs.com(http://erldocs.com) through gh-pages. > I also want to thank those that sent patches, suggestions and bug reports. > > Cheers, > -- > Pierre Fenoll > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions Thanks Pierre!! This is a huge help as always. -- Dave Cottlehuber dch@REDACTED Sent from my Couch -------------- next part -------------- An HTML attachment was scrubbed... URL: From anthonym@REDACTED Tue May 6 19:33:04 2014 From: anthonym@REDACTED (ANTHONY MOLINARO) Date: Tue, 6 May 2014 10:33:04 -0700 Subject: [erlang-questions] [ANN] OTP 17.0 on erldocs.com In-Reply-To: References: Message-ID: <0A27A730-A3D4-4B03-BE69-7B34CB1A6FBF@alumni.caltech.edu> It definitely looks better, but seems like it?s still not possible to show the old style spec?s like we used to? For instance, http://erldocs.com/R13B04/stdlib/lists.html?i=0&search=lists:#all/2 versus http://erldocs.com/17.0/stdlib/lists.html?i=0&search=lists:#all/2 IIRC there was some issue getting that to work which is unfortunate as it was super useful. Thanks for updating the docs, -Anthony On May 6, 2014, at 10:01 AM, Pierre Fenoll wrote: > Hello! > > Erldocs, an alternative Erlang/OTP documentation and a doc generation tool has been updated! > > You will find documentation for Erlang/OTP release 17.0 at http://erldocs.com/ > > I have patched erldocs to be able to build the docs for 17.0-rc2 and 17.0 > and was finally able to generate detailed specs information. > For instance, here is the gb_sets page? > before: http://erldocs.com/R16B02/stdlib/gb_sets.html?i=1&search=gb_sets#add/2 > after: http://erldocs.com/17.0/stdlib/gb_sets.html?i=1&search=gb_sets#add/2 > Still, there is an issue about missing include directories that inhibits my changes for some files: > > The zip page before http://erldocs.com/R16B02/stdlib/zip.html?i=0&search=zip:cr#create/2 > ?and after: http://erldocs.com/17.0/stdlib/zip.html?i=0&search=zip:cre#create/2 > (It is an ongoing work) > > As always, you'll find tarballs of the docs for different releases of OTP on erldocs.com. > You can also build the docs for your own projects with the same tool hosted on GitHub: https://github.com/fenollp/erldocs > > Thanks to @daleharvey for this easy to maintain tool and to GitHub, hosting erldocs.com through gh-pages. > I also want to thank those that sent patches, suggestions and bug reports. > > Cheers, > -- > Pierre Fenoll > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions -------------- next part -------------- An HTML attachment was scrubbed... URL: From jesper.louis.andersen@REDACTED Tue May 6 21:35:48 2014 From: jesper.louis.andersen@REDACTED (Jesper Louis Andersen) Date: Tue, 6 May 2014 21:35:48 +0200 Subject: [erlang-questions] Serial device supervision strategy In-Reply-To: References: Message-ID: On Tue, May 6, 2014 at 7:27 PM, Camille Troillard wrote: > Ideally, I thought the design could be as follows: a gen_server > (serial_endpoint) whose lifetime would be the same as the serial device?s > connection is under supervision. If the serial_endpoint fails to start, > then we try again a second later and so on. Likewise, if the connection is > lost because the device is unplugged, the serial_endpoint dies, and we try > again to start it a second later. Note that supervision and restarts are normally for unforseen errornous behaviour in applications. In your model, I would assume it is normal to have devices disconnecting and reconnecting. After all, there is a connector for the serial device and people might be yanking out the device now and then. This suggests that the disconnect is not an unforseen error, but rather a valid situation. This warrants handling it as part of the normal application flow and not as part of supervision fault handling. I tend to keep supervision and crashes as devices for handling things that you don't expect the application to do. Sometimes you *can* model things with processes marked as 'temporary' in the supervision trees and you don't care if such a process goes away since it is the normal behaviour of the application. First of all, I would consider if device monitoring and device handling has to live in the same process. They seem to be possible to decouple. So one process listens on device events and starts a handling process accordingly. If the device is disconnected, the handling process can be killed by the monitoring process. It also means that the cleanup in the event of a disconnected device is left to the monitor and not to the handler. Pursuing this idea has the advantage that you decouple device presence from the question of device protocol handling, making it pluggable, flexible and simpler to implement. As for a supervision tree: main_sup - one_for_all (perhaps one_for_rest) monitor - gen_server, permanent device_handler - gen_server, transient, started dynamically in the tree when device is present. The monitor should always run. It periodically checks connectivity on the serial port. When it detects a device attached, it spawns the device_handler. The transient rule makes sure that the device handler can stop in a normal fashion, should the device be gracefully disconnected. How does this system crash? If the monitor dies *unexpectedly*, we rip the device handler as well. If the device_handler dies, we restart the monitor as well. When the system restarts it will attempt to reconstruct a good state. You can play around with one_for_rest as a strategy if you want the device handler to be restartable without killing the monitor. This might not be perfect, but it is a start of a model. Feel free to ask more questions. -- J. -------------- next part -------------- An HTML attachment was scrubbed... URL: From mononcqc@REDACTED Tue May 6 21:45:27 2014 From: mononcqc@REDACTED (Fred Hebert) Date: Tue, 6 May 2014 15:45:27 -0400 Subject: [erlang-questions] Serial device supervision strategy In-Reply-To: References: Message-ID: <20140506194526.GG97686@ferdair.local> Hi Camille, In general, my view on these things is that supervision isn't about restarting, it's about rolling back to a known and stable state. What you restart to should be *guarantees* you are giving to any process that will start after yours. For example, if you start the client to the serial device, any piece of code you boot after that that depends on you has two possible scenarios: 1. The device is connected 2. The device isn't connected Now, from a user of your library, if you go the route of 'crash and restart every time', there is going to be what could be a 50% chance that when you try to ask the client to talk to the device, you get a crash for 'noproc' and everything blows up, or you actually get your connection. The approach I recommend in these cases is to think about what you want to guarantee to your users (I wrote in more detail on this at http://ferd.ca/it-s-about-the-guarantees.html) The gist of it is this: if you expect the serial device not to be connected a lot of times, it's likely nicer for your users if you bake that into your design. The guarantee then becomes 'I boot a client I can talk to'. That guarantee means you'll have to possible plan an interface where the client is free to return something like '{error, not_connected}' or something similar. You are then free to start a timer or leave it to the user to send a 'reconnect' message before proceeding with more requests. Otherwise, putting the connecting phase in the supervisor means that the connection being established is to be regarded as an invariant of your application: this application should not and cannot be booted if you haven't plugged the device into the serial port. This is desirable, for example, in cases such as local databases you know you want to be there on the local host, sending stuff to UDP ports, and so on. It is, essentially, what 'restarting to a known stable state' means. And if you can't do it, you can't run the app: the state is too unstable. What I'm getting at here is that what you're trying to do doesn't have an existing supervision strategy. You should rather decide whether the app should crash when the device isn't connected, or move the reconnection strategy to some specific callback of an OTP behavior, because it is to be expected to happen and should be handled with custom code (exponential backoff? on-demand retry?, etc.). This is a really important distinction and decision to make, and there have been countless high-use production services that crashed because developers who didn't (or couldn't) know better ended up declaring an unreliable connection as a guarantee they offer, when they can't actually do that. Regards, Fred. On 05/06, Camille Troillard wrote: > Hello, > > I am going back to Erlang after a bit of distraction, please excuse this rusty question. > > My application has to connect to a serial device which may or may not be plugged to the computer. > > It seemed a simple approach would be to try to connect to the device every seconds, and retry again until the connection is done. Ideally, I thought the design could be as follows: a gen_server (serial_endpoint) whose lifetime would be the same as the serial device?s connection is under supervision. If the serial_endpoint fails to start, then we try again a second later and so on. Likewise, if the connection is lost because the device is unplugged, the serial_endpoint dies, and we try again to start it a second later. > > Unfortunately, I don?t see how to achieve this restart strategy. > Can someone help me find the right solution? > > > Thank you in advance. > > Best Regards, > Camille > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions From lists@REDACTED Tue May 6 21:54:12 2014 From: lists@REDACTED (Camille Troillard) Date: Tue, 6 May 2014 21:54:12 +0200 Subject: [erlang-questions] Serial device supervision strategy In-Reply-To: <20140506194526.GG97686@ferdair.local> References: <20140506194526.GG97686@ferdair.local> Message-ID: Fred, Jesper, Thank you so much for your detailed answers. It makes a lot of sense now. Cam On 06 May 2014, at 21:45, Fred Hebert wrote: > Hi Camille, > > In general, my view on these things is that supervision isn't about > restarting, it's about rolling back to a known and stable state. > > What you restart to should be *guarantees* you are giving to any process > that will start after yours. For example, if you start the client to the > serial device, any piece of code you boot after that that depends on you > has two possible scenarios: > > 1. The device is connected > 2. The device isn't connected > > Now, from a user of your library, if you go the route of 'crash and > restart every time', there is going to be what could be a 50% chance > that when you try to ask the client to talk to the device, you get a > crash for 'noproc' and everything blows up, or you actually get your > connection. > > The approach I recommend in these cases is to think about what you want > to guarantee to your users (I wrote in more detail on this at > http://ferd.ca/it-s-about-the-guarantees.html) > > The gist of it is this: if you expect the serial device not to be > connected a lot of times, it's likely nicer for your users if you bake > that into your design. The guarantee then becomes 'I boot a client I can > talk to'. That guarantee means you'll have to possible plan an interface > where the client is free to return something like '{error, > not_connected}' or something similar. You are then free to start a timer > or leave it to the user to send a 'reconnect' message before proceeding > with more requests. > > Otherwise, putting the connecting phase in the supervisor means that the > connection being established is to be regarded as an invariant of your > application: this application should not and cannot be booted if you > haven't plugged the device into the serial port. This is desirable, for > example, in cases such as local databases you know you want to be there > on the local host, sending stuff to UDP ports, and so on. > > It is, essentially, what 'restarting to a known stable state' means. And > if you can't do it, you can't run the app: the state is too unstable. > > What I'm getting at here is that what you're trying to do doesn't have > an existing supervision strategy. You should rather decide whether the > app should crash when the device isn't connected, or move the > reconnection strategy to some specific callback of an OTP behavior, > because it is to be expected to happen and should be handled with custom > code (exponential backoff? on-demand retry?, etc.). > > This is a really important distinction and decision to make, and there > have been countless high-use production services that crashed because > developers who didn't (or couldn't) know better ended up declaring an > unreliable connection as a guarantee they offer, when they can't > actually do that. > > Regards, > Fred. > > On 05/06, Camille Troillard wrote: >> Hello, >> >> I am going back to Erlang after a bit of distraction, please excuse this rusty question. >> >> My application has to connect to a serial device which may or may not be plugged to the computer. >> >> It seemed a simple approach would be to try to connect to the device every seconds, and retry again until the connection is done. Ideally, I thought the design could be as follows: a gen_server (serial_endpoint) whose lifetime would be the same as the serial device?s connection is under supervision. If the serial_endpoint fails to start, then we try again a second later and so on. Likewise, if the connection is lost because the device is unplugged, the serial_endpoint dies, and we try again to start it a second later. >> >> Unfortunately, I don?t see how to achieve this restart strategy. >> Can someone help me find the right solution? >> >> >> Thank you in advance. >> >> Best Regards, >> Camille >> >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://erlang.org/mailman/listinfo/erlang-questions From ingela.andin@REDACTED Tue May 6 23:33:15 2014 From: ingela.andin@REDACTED (Ingela Andin) Date: Tue, 6 May 2014 23:33:15 +0200 Subject: [erlang-questions] DTLS Status and examples? In-Reply-To: References: Message-ID: Hi! 2014-05-05 20:59 GMT+02:00 Myers Carpenter : > Hello, > > I'm attempting to connect the data channel in webrtc to Erlang. You can > read about my project here https://github.com/myers/exwebrtc . > > I'm trying to understand where the DTLS code in Erlang is currently and > where I might be able to pitch in. > > DTLS is not yet runnable, as there is not yet a red thread through the code. dtls_connection.erl is the most incomplete module. It is the module that implements the finite state machine of the DTLS handshake, it correspondes to tls_connection.erl. In general tls_* implements TLS specific parts and dtls_* DTLS specific parts and ssl_* common parts. You could always do a test suite for DTLS that corresponds to ssl_to_openssl_SUITE.erl in the test directory. Once you have a test suite it is easier to try to fill in the gaps in dtls_* . > I'm attempting to start a DTLS server and then connect to it via "openssl > s_client" > > Here's the code so far > > -module(dtls_server). > -export([start/0]). > > start() -> > ssl:start(), > > {ok, _Socket} = dtls:listen(4499, [ > {mode, binary}, > {reuseaddr, true}, > {certfile, "server.cert"}, > {keyfile, "server.pkey"}, > {active, true}, > {ciphers, [{ecdhe_rsa, aes_128_cbc, sha}]} > ]). > > > Looks like something that should work when all pieces are in place. Regards Ingela Erlang/OTP team - Ericsson AB -------------- next part -------------- An HTML attachment was scrubbed... URL: From lloyd@REDACTED Wed May 7 00:03:26 2014 From: lloyd@REDACTED (lloyd@REDACTED) Date: Tue, 6 May 2014 18:03:26 -0400 (EDT) Subject: [erlang-questions] Erlang compilation travails Message-ID: <1399413806.787217691@apps.rackspace.com> Hello, I've been working my way up the Erlang learning curve for several years now quite cheerfully--- coding, installing, compiling, uninstalling, etc. But over the past several days my attempts to install n2o/samples have thrown crash dumps at the very last stages of compilation. Thinking the problem may be an hardware, OS, or Erlang installation issue, I moved to another box running Debian Wheezy. But on this box installation of rebar fails in the ./bootstrap step. Moved to second Debian box--- same issue. The only common denominator is and upgrade of Ubuntu to 14.04 on box one and installation of Erlang under kerl on all three boxes. Been at this all day trying to get to the root of the problem. Decided to go back to basics and COMPLETELY uninstall Erlang, rebar, and kerl from the first Debian box and reinstall Erlang and rebar from scratch. But here's the mystery: lloyd@REDACTED:~$ sudo apt-get --purge remove 'erlang*' lloyd@REDACTED:~$ sudo dpkg-query -l 'erlang*' dpkg-query: no packages found matching erlang* lloyd@REDACTED:~$ sudo dpkg-query -l kerl dpkg-query: no packages found matching kerl lloyd@REDACTED:~$ sudo dpkg-query -l rebar dpkg-query: no packages found matching rebar lloyd@REDACTED:~$ cd .kerl bash: cd: .kerl: No such file or directory lloyd@REDACTED:~$ whereis erlang erlang: lloyd@REDACTED:~$ whereis rebar rebar: lloyd@REDACTED:~$ whereis kerl kerl: lloyd@REDACTED:~$ cd /usr/local/bin lloyd@REDACTED:/usr/local/bin$ ls -l total 0 lloyd@REDACTED:~$ cd ~ lloyd@REDACTED:~$ erl Erlang/OTP 17 [erts-6.0] [source] [64-bit] [smp:2:2] [async-threads:10] [hipe] [kernel-poll:false] Eshell V6.0 (abort with ^G) 1> Yikes! After all that house-cleaning, erl still runs! So my question: In which dark corner of my directory tree is erl still lurking? Bonus question: Am I being a stupid dunderhead at somewhere along the line or my computers IPIO (Inate Perversion of Inanimate Objects) deamons? Help! Many thanks, LRP From comptekki@REDACTED Wed May 7 00:12:51 2014 From: comptekki@REDACTED (Wes James) Date: Tue, 6 May 2014 16:12:51 -0600 Subject: [erlang-questions] Erlang compilation travails In-Reply-To: <1399413806.787217691@apps.rackspace.com> References: <1399413806.787217691@apps.rackspace.com> Message-ID: On Tue, May 6, 2014 at 4:03 PM, wrote: > lloyd@REDACTED:~$ cd ~ > lloyd@REDACTED:~$ erl > Erlang/OTP 17 [erts-6.0] [source] [64-bit] [smp:2:2] [async-threads:10] > [hipe] [kernel-poll:false] > > Eshell V6.0 (abort with ^G) > 1> > > Yikes! After all that house-cleaning, erl still runs! > > So my question: In which dark corner of my directory tree is erl still > lurking? > > Bonus question: Am I being a stupid dunderhead at somewhere along the line > or my computers IPIO (Inate Perversion of Inanimate Objects) deamons? > > Help! > > Many thanks, > > LRP > try: $ which erl which uses your $PATH definition -wes -------------- next part -------------- An HTML attachment was scrubbed... URL: From overminddl1@REDACTED Wed May 7 00:12:54 2014 From: overminddl1@REDACTED (OvermindDL1) Date: Tue, 6 May 2014 16:12:54 -0600 Subject: [erlang-questions] Erlang compilation travails In-Reply-To: <1399413806.787217691@apps.rackspace.com> References: <1399413806.787217691@apps.rackspace.com> Message-ID: whereis erl whence erl Or some command like that should tell you where it is. On May 6, 2014 4:03 PM, wrote: > Hello, > > I've been working my way up the Erlang learning curve for several years > now quite cheerfully--- coding, installing, compiling, uninstalling, etc. > But over the past several days my attempts to install n2o/samples have > thrown crash dumps at the very last stages of compilation. > > Thinking the problem may be an hardware, OS, or Erlang installation issue, > I moved to another box running Debian Wheezy. But on this box installation > of rebar fails in the ./bootstrap step. Moved to second Debian box--- same > issue. > > The only common denominator is and upgrade of Ubuntu to 14.04 on box one > and installation of Erlang under kerl on all three boxes. > > Been at this all day trying to get to the root of the problem. Decided to > go back to basics and COMPLETELY uninstall Erlang, rebar, and kerl from the > first Debian box and reinstall Erlang and rebar from scratch. > > But here's the mystery: > > lloyd@REDACTED:~$ sudo apt-get --purge remove 'erlang*' > lloyd@REDACTED:~$ sudo dpkg-query -l 'erlang*' > dpkg-query: no packages found matching erlang* > lloyd@REDACTED:~$ sudo dpkg-query -l kerl > dpkg-query: no packages found matching kerl > lloyd@REDACTED:~$ sudo dpkg-query -l rebar > dpkg-query: no packages found matching rebar > lloyd@REDACTED:~$ cd .kerl > bash: cd: .kerl: No such file or directory > lloyd@REDACTED:~$ whereis erlang > erlang: > lloyd@REDACTED:~$ whereis rebar > rebar: > lloyd@REDACTED:~$ whereis kerl > kerl: > lloyd@REDACTED:~$ cd /usr/local/bin > lloyd@REDACTED:/usr/local/bin$ ls -l > total 0 > lloyd@REDACTED:~$ cd ~ > lloyd@REDACTED:~$ erl > Erlang/OTP 17 [erts-6.0] [source] [64-bit] [smp:2:2] [async-threads:10] > [hipe] [kernel-poll:false] > > Eshell V6.0 (abort with ^G) > 1> > > Yikes! After all that house-cleaning, erl still runs! > > So my question: In which dark corner of my directory tree is erl still > lurking? > > Bonus question: Am I being a stupid dunderhead at somewhere along the line > or my computers IPIO (Inate Perversion of Inanimate Objects) deamons? > > Help! > > Many thanks, > > LRP > > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From g@REDACTED Wed May 7 00:24:24 2014 From: g@REDACTED (Garrett Smith) Date: Tue, 6 May 2014 17:24:24 -0500 Subject: [erlang-questions] Erlang compilation travails In-Reply-To: <1399413806.787217691@apps.rackspace.com> References: <1399413806.787217691@apps.rackspace.com> Message-ID: On Tue, May 6, 2014 at 5:03 PM, wrote: > Hello, > > I've been working my way up the Erlang learning curve for several years now quite cheerfully--- coding, installing, compiling, uninstalling, etc. But over the past several days my attempts to install n2o/samples have thrown crash dumps at the very last stages of compilation. > > Thinking the problem may be an hardware, OS, or Erlang installation issue, I moved to another box running Debian Wheezy. But on this box installation of rebar fails in the ./bootstrap step. Moved to second Debian box--- same issue. > > The only common denominator is and upgrade of Ubuntu to 14.04 on box one and installation of Erlang under kerl on all three boxes. > > Been at this all day trying to get to the root of the problem. Decided to go back to basics and COMPLETELY uninstall Erlang, rebar, and kerl from the first Debian box and reinstall Erlang and rebar from scratch. > > But here's the mystery: > > lloyd@REDACTED:~$ sudo apt-get --purge remove 'erlang*' > lloyd@REDACTED:~$ sudo dpkg-query -l 'erlang*' > dpkg-query: no packages found matching erlang* > lloyd@REDACTED:~$ sudo dpkg-query -l kerl > dpkg-query: no packages found matching kerl > lloyd@REDACTED:~$ sudo dpkg-query -l rebar > dpkg-query: no packages found matching rebar > lloyd@REDACTED:~$ cd .kerl > bash: cd: .kerl: No such file or directory > lloyd@REDACTED:~$ whereis erlang > erlang: > lloyd@REDACTED:~$ whereis rebar > rebar: > lloyd@REDACTED:~$ whereis kerl > kerl: > lloyd@REDACTED:~$ cd /usr/local/bin > lloyd@REDACTED:/usr/local/bin$ ls -l > total 0 > lloyd@REDACTED:~$ cd ~ > lloyd@REDACTED:~$ erl > Erlang/OTP 17 [erts-6.0] [source] [64-bit] [smp:2:2] [async-threads:10] [hipe] [kernel-poll:false] > > Eshell V6.0 (abort with ^G) > 1> > > Yikes! After all that house-cleaning, erl still runs! > > So my question: In which dark corner of my directory tree is erl still lurking? > > Bonus question: Am I being a stupid dunderhead at somewhere along the line or my computers IPIO (Inate Perversion of Inanimate Objects) deamons? > > Help! It may be a pointless sacrifice to the Gods of Superstition -- there may in fact not be problem -- but lore has it that the system packages for Erlang are notoriously fickle, especially where Erlang is split up into dozens and dozens of dependent packages as they are for Ubuntu. I personally would not spend a single minute troubleshooting a problematic Ubuntu Erlang installation. Rather, I'd uninstall it and compile Erlang from source and use that version via "sudo make install". It takes a while, but I bet it takes a lot less time than figuring out the Ubuntu problem. This article from the nice folks at Basho will help you compile on Ubuntu: http://docs.basho.com/riak/latest/ops/building/installing/erlang/ But I could be wrong -- I'm just sayin' what I'd do here :) Garrett From lloyd@REDACTED Wed May 7 00:42:16 2014 From: lloyd@REDACTED (lloyd@REDACTED) Date: Tue, 6 May 2014 18:42:16 -0400 (EDT) Subject: [erlang-questions] Erlang compilation travails In-Reply-To: References: <1399413806.787217691@apps.rackspace.com> Message-ID: <1399416136.353218080@apps.rackspace.com> Hi Garrett, You're making more sense by the minute. Just tried to install rebar under my brand-spanking-new kerl Erlang installation on my Debian Wheezy box and ran into the same ol' same ol': lloyd@REDACTED:~/Erl/Tools$ cd rebar lloyd@REDACTED:~/Erl/Tools/rebar$ ./bootstrap Recompile: src/rebar Recompile: src/rebar_abnfc_compiler Recompile: src/rebar_app_utils Recompile: src/rebar_appups ... Recompile: src/rebar_upgrade Recompile: src/rebar_utils Recompile: src/rebar_xref Uncaught error in rebar_core: {'EXIT', {undef, [{crypto,start,[],[]}, {rebar,run_aux,2, [{file,"src/rebar.erl"},{line,165}]}, {rebar,main,1, [{file,"src/rebar.erl"},{line,58}]}, {erl_eval,do_apply,6, [{file,"erl_eval.erl"},{line,657}]}, {escript,eval_exprs,5, [{file,"escript.erl"},{line,865}]}, {erl_eval,local_func,5, [{file,"erl_eval.erl"},{line,544}]}, {escript,interpret,4, [{file,"escript.erl"},{line,781}]}, {escript,start,1, [{file,"escript.erl"},{line,276}]}]}} lloyd@REDACTED:~/Erl/Tools/rebar$ So, maybe it's not me after all, though I wouldn't discount. But, if indeed not due to my fuzzy-headed fumble-fingers then perhaps, at least, my tsuris will alert some packager that there's trouble on the farm. Thanks, Dude. Lloyd -----Original Message----- From: "Garrett Smith" Sent: Tuesday, May 6, 2014 6:24pm To: "Lloyd Prentice" Cc: "Erlang-Questions Questions" Subject: Re: [erlang-questions] Erlang compilation travails On Tue, May 6, 2014 at 5:03 PM, wrote: > Hello, > > I've been working my way up the Erlang learning curve for several years now quite cheerfully--- coding, installing, compiling, uninstalling, etc. But over the past several days my attempts to install n2o/samples have thrown crash dumps at the very last stages of compilation. > > Thinking the problem may be an hardware, OS, or Erlang installation issue, I moved to another box running Debian Wheezy. But on this box installation of rebar fails in the ./bootstrap step. Moved to second Debian box--- same issue. > > The only common denominator is and upgrade of Ubuntu to 14.04 on box one and installation of Erlang under kerl on all three boxes. > > Been at this all day trying to get to the root of the problem. Decided to go back to basics and COMPLETELY uninstall Erlang, rebar, and kerl from the first Debian box and reinstall Erlang and rebar from scratch. > > But here's the mystery: > > lloyd@REDACTED:~$ sudo apt-get --purge remove 'erlang*' > lloyd@REDACTED:~$ sudo dpkg-query -l 'erlang*' > dpkg-query: no packages found matching erlang* > lloyd@REDACTED:~$ sudo dpkg-query -l kerl > dpkg-query: no packages found matching kerl > lloyd@REDACTED:~$ sudo dpkg-query -l rebar > dpkg-query: no packages found matching rebar > lloyd@REDACTED:~$ cd .kerl > bash: cd: .kerl: No such file or directory > lloyd@REDACTED:~$ whereis erlang > erlang: > lloyd@REDACTED:~$ whereis rebar > rebar: > lloyd@REDACTED:~$ whereis kerl > kerl: > lloyd@REDACTED:~$ cd /usr/local/bin > lloyd@REDACTED:/usr/local/bin$ ls -l > total 0 > lloyd@REDACTED:~$ cd ~ > lloyd@REDACTED:~$ erl > Erlang/OTP 17 [erts-6.0] [source] [64-bit] [smp:2:2] [async-threads:10] [hipe] [kernel-poll:false] > > Eshell V6.0 (abort with ^G) > 1> > > Yikes! After all that house-cleaning, erl still runs! > > So my question: In which dark corner of my directory tree is erl still lurking? > > Bonus question: Am I being a stupid dunderhead at somewhere along the line or my computers IPIO (Inate Perversion of Inanimate Objects) deamons? > > Help! It may be a pointless sacrifice to the Gods of Superstition -- there may in fact not be problem -- but lore has it that the system packages for Erlang are notoriously fickle, especially where Erlang is split up into dozens and dozens of dependent packages as they are for Ubuntu. I personally would not spend a single minute troubleshooting a problematic Ubuntu Erlang installation. Rather, I'd uninstall it and compile Erlang from source and use that version via "sudo make install". It takes a while, but I bet it takes a lot less time than figuring out the Ubuntu problem. This article from the nice folks at Basho will help you compile on Ubuntu: http://docs.basho.com/riak/latest/ops/building/installing/erlang/ But I could be wrong -- I'm just sayin' what I'd do here :) Garrett From lloyd@REDACTED Wed May 7 01:16:19 2014 From: lloyd@REDACTED (lloyd@REDACTED) Date: Tue, 6 May 2014 19:16:19 -0400 (EDT) Subject: [erlang-questions] Erlang compilation travails In-Reply-To: References: <1399413806.787217691@apps.rackspace.com> Message-ID: <1399418179.689129447@apps.rackspace.com> Well, the mystery is more insidious than we thought. I scoured my Debian Wheezy system clean of all vestiges of Erlang and reinstalled from source. Went like a charm. Can even add 1 + 1 in erl. But... Encountered the same problem as previously reported while trying to compile rebar. My next step is to scour Erlang clean once again and install R16B. If that doesn't work... Then I'll try everything again on my second Debian Wheezy box. And if that doesn't work I'll... Well let's not go there. Best, Lloyd -----Original Message----- From: "Garrett Smith" Sent: Tuesday, May 6, 2014 6:24pm To: "Lloyd Prentice" Cc: "Erlang-Questions Questions" Subject: Re: [erlang-questions] Erlang compilation travails On Tue, May 6, 2014 at 5:03 PM, wrote: > Hello, > > I've been working my way up the Erlang learning curve for several years now quite cheerfully--- coding, installing, compiling, uninstalling, etc. But over the past several days my attempts to install n2o/samples have thrown crash dumps at the very last stages of compilation. > > Thinking the problem may be an hardware, OS, or Erlang installation issue, I moved to another box running Debian Wheezy. But on this box installation of rebar fails in the ./bootstrap step. Moved to second Debian box--- same issue. > > The only common denominator is and upgrade of Ubuntu to 14.04 on box one and installation of Erlang under kerl on all three boxes. > > Been at this all day trying to get to the root of the problem. Decided to go back to basics and COMPLETELY uninstall Erlang, rebar, and kerl from the first Debian box and reinstall Erlang and rebar from scratch. > > But here's the mystery: > > lloyd@REDACTED:~$ sudo apt-get --purge remove 'erlang*' > lloyd@REDACTED:~$ sudo dpkg-query -l 'erlang*' > dpkg-query: no packages found matching erlang* > lloyd@REDACTED:~$ sudo dpkg-query -l kerl > dpkg-query: no packages found matching kerl > lloyd@REDACTED:~$ sudo dpkg-query -l rebar > dpkg-query: no packages found matching rebar > lloyd@REDACTED:~$ cd .kerl > bash: cd: .kerl: No such file or directory > lloyd@REDACTED:~$ whereis erlang > erlang: > lloyd@REDACTED:~$ whereis rebar > rebar: > lloyd@REDACTED:~$ whereis kerl > kerl: > lloyd@REDACTED:~$ cd /usr/local/bin > lloyd@REDACTED:/usr/local/bin$ ls -l > total 0 > lloyd@REDACTED:~$ cd ~ > lloyd@REDACTED:~$ erl > Erlang/OTP 17 [erts-6.0] [source] [64-bit] [smp:2:2] [async-threads:10] [hipe] [kernel-poll:false] > > Eshell V6.0 (abort with ^G) > 1> > > Yikes! After all that house-cleaning, erl still runs! > > So my question: In which dark corner of my directory tree is erl still lurking? > > Bonus question: Am I being a stupid dunderhead at somewhere along the line or my computers IPIO (Inate Perversion of Inanimate Objects) deamons? > > Help! It may be a pointless sacrifice to the Gods of Superstition -- there may in fact not be problem -- but lore has it that the system packages for Erlang are notoriously fickle, especially where Erlang is split up into dozens and dozens of dependent packages as they are for Ubuntu. I personally would not spend a single minute troubleshooting a problematic Ubuntu Erlang installation. Rather, I'd uninstall it and compile Erlang from source and use that version via "sudo make install". It takes a while, but I bet it takes a lot less time than figuring out the Ubuntu problem. This article from the nice folks at Basho will help you compile on Ubuntu: http://docs.basho.com/riak/latest/ops/building/installing/erlang/ But I could be wrong -- I'm just sayin' what I'd do here :) Garrett From ryankbrown@REDACTED Wed May 7 01:21:05 2014 From: ryankbrown@REDACTED (Ryan Brown) Date: Tue, 6 May 2014 17:21:05 -0600 Subject: [erlang-questions] Best/recommended erlang client for cassandra? Message-ID: I'm looking to implement cassandra as, essentially, a replacement for mnesia in my erlang application. (Much research and battle woulds has resulted in this solution. Would be happy to discuss offline.) My question is regarding what is the "best" cassandra client library for erlang. For me, best is mainly defined as reasonably simple implementation and active development and support. cqerl? seestar? other? Thanks in advance! -------------- next part -------------- An HTML attachment was scrubbed... URL: From mahesh@REDACTED Wed May 7 02:39:05 2014 From: mahesh@REDACTED (Mahesh Paolini-Subramanya) Date: Tue, 6 May 2014 20:39:05 -0400 Subject: [erlang-questions] Best/recommended erlang client for cassandra? In-Reply-To: References: Message-ID: erlcql (https://github.com/rpt/erlcql) for CQL, and erlang_cassandra ( https://github.com/dieswaytoofast/erlang_cassandra) for thrift. Cheers p.s. Both pretty actively maintained, though I'd stay away from thrift if I were you... On Tue, May 6, 2014 at 7:21 PM, Ryan Brown wrote: > I'm looking to implement cassandra as, essentially, a replacement for > mnesia in my erlang application. (Much research and battle woulds has > resulted in this solution. Would be happy to discuss offline.) > > My question is regarding what is the "best" cassandra client library for > erlang. For me, best is mainly defined as reasonably simple implementation > and active development and support. > > cqerl? seestar? other? > > Thanks in advance! > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > > -- *Mahesh Paolini-Subramanya That tall bald Indian guy..* *Google+ | Blog | Twitter | LinkedIn * -------------- next part -------------- An HTML attachment was scrubbed... URL: From gumm@REDACTED Wed May 7 04:01:36 2014 From: gumm@REDACTED (Jesse Gumm) Date: Tue, 6 May 2014 21:01:36 -0500 Subject: [erlang-questions] Erlang compilation travails In-Reply-To: <1399418179.689129447@apps.rackspace.com> References: <1399413806.787217691@apps.rackspace.com> <1399418179.689129447@apps.rackspace.com> Message-ID: Garrett's definitely right about the Ubuntu Erlang package quagmire It's like someone heard that sharding is web scale so they decided to shard Erlang itself. Alternatively to compiling from source, the Erlang solutions packages for Ubuntu are great: https://www.erlang-solutions.com/downloads/download-erlang-otp -Jesse On Tue, May 6, 2014 at 6:16 PM, wrote: > Well, the mystery is more insidious than we thought. > > I scoured my Debian Wheezy system clean of all vestiges of Erlang and reinstalled from source. Went like a charm. Can even add 1 + 1 in erl. > > But... Encountered the same problem as previously reported while trying to compile rebar. > > My next step is to scour Erlang clean once again and install R16B. If that doesn't work... Then I'll try everything again on my second Debian Wheezy box. > > And if that doesn't work I'll... Well let's not go there. > > Best, > > Lloyd > > > -----Original Message----- > From: "Garrett Smith" > Sent: Tuesday, May 6, 2014 6:24pm > To: "Lloyd Prentice" > Cc: "Erlang-Questions Questions" > Subject: Re: [erlang-questions] Erlang compilation travails > > On Tue, May 6, 2014 at 5:03 PM, wrote: >> Hello, >> >> I've been working my way up the Erlang learning curve for several years now quite cheerfully--- coding, installing, compiling, uninstalling, etc. But over the past several days my attempts to install n2o/samples have thrown crash dumps at the very last stages of compilation. >> >> Thinking the problem may be an hardware, OS, or Erlang installation issue, I moved to another box running Debian Wheezy. But on this box installation of rebar fails in the ./bootstrap step. Moved to second Debian box--- same issue. >> >> The only common denominator is and upgrade of Ubuntu to 14.04 on box one and installation of Erlang under kerl on all three boxes. >> >> Been at this all day trying to get to the root of the problem. Decided to go back to basics and COMPLETELY uninstall Erlang, rebar, and kerl from the first Debian box and reinstall Erlang and rebar from scratch. >> >> But here's the mystery: >> >> lloyd@REDACTED:~$ sudo apt-get --purge remove 'erlang*' >> lloyd@REDACTED:~$ sudo dpkg-query -l 'erlang*' >> dpkg-query: no packages found matching erlang* >> lloyd@REDACTED:~$ sudo dpkg-query -l kerl >> dpkg-query: no packages found matching kerl >> lloyd@REDACTED:~$ sudo dpkg-query -l rebar >> dpkg-query: no packages found matching rebar >> lloyd@REDACTED:~$ cd .kerl >> bash: cd: .kerl: No such file or directory >> lloyd@REDACTED:~$ whereis erlang >> erlang: >> lloyd@REDACTED:~$ whereis rebar >> rebar: >> lloyd@REDACTED:~$ whereis kerl >> kerl: >> lloyd@REDACTED:~$ cd /usr/local/bin >> lloyd@REDACTED:/usr/local/bin$ ls -l >> total 0 >> lloyd@REDACTED:~$ cd ~ >> lloyd@REDACTED:~$ erl >> Erlang/OTP 17 [erts-6.0] [source] [64-bit] [smp:2:2] [async-threads:10] [hipe] [kernel-poll:false] >> >> Eshell V6.0 (abort with ^G) >> 1> >> >> Yikes! After all that house-cleaning, erl still runs! >> >> So my question: In which dark corner of my directory tree is erl still lurking? >> >> Bonus question: Am I being a stupid dunderhead at somewhere along the line or my computers IPIO (Inate Perversion of Inanimate Objects) deamons? >> >> Help! > > It may be a pointless sacrifice to the Gods of Superstition -- there > may in fact not be problem -- but lore has it that the system packages > for Erlang are notoriously fickle, especially where Erlang is split up > into dozens and dozens of dependent packages as they are for Ubuntu. > > I personally would not spend a single minute troubleshooting a > problematic Ubuntu Erlang installation. Rather, I'd uninstall it and > compile Erlang from source and use that version via "sudo make > install". It takes a while, but I bet it takes a lot less time than > figuring out the Ubuntu problem. > > This article from the nice folks at Basho will help you compile on Ubuntu: > > http://docs.basho.com/riak/latest/ops/building/installing/erlang/ > > But I could be wrong -- I'm just sayin' what I'd do here :) > > Garrett > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions -- Jesse Gumm Owner, Sigma Star Systems 414.940.4866 || sigma-star.com || @jessegumm From ok@REDACTED Wed May 7 05:30:36 2014 From: ok@REDACTED (Richard A. O'Keefe) Date: Wed, 7 May 2014 15:30:36 +1200 Subject: [erlang-questions] Erlang compilation travails In-Reply-To: References: <1399413806.787217691@apps.rackspace.com> <1399418179.689129447@apps.rackspace.com> Message-ID: <87728B32-986E-4FC3-9E23-6F81455F80DC@cs.otago.ac.nz> On 7/05/2014, at 2:01 PM, Jesse Gumm wrote: > > Alternatively to compiling from source, the Erlang solutions packages > for Ubuntu are great: > https://www.erlang-solutions.com/downloads/download-erlang-otp At that web site, I see R17 packages for Mac OS X 10.6.8 64-bit only Mac OS X 10.9 64-bit Mac OS X 10.9 32-bit I have a 10.6.8 laptop and it would be nice to run a 32-bit build on it. (I've had such trouble with Mail in 10.9 that I don't trust 10.9 at all.) From federico.carrone@REDACTED Wed May 7 03:07:42 2014 From: federico.carrone@REDACTED (Federico Carrone) Date: Tue, 6 May 2014 22:07:42 -0300 Subject: [erlang-questions] Best/recommended erlang client for cassandra? In-Reply-To: References: Message-ID: There is also seestar: https://github.com/iamaleksey/seestar I used it and work fine in general. But we had a few issues. We migrated from cassandra to another database so I don't remember anymore which issues we had with seestar. Regards. On Tue, May 6, 2014 at 9:39 PM, Mahesh Paolini-Subramanya < mahesh@REDACTED> wrote: > erlcql (https://github.com/rpt/erlcql) for CQL, and erlang_cassandra ( > https://github.com/dieswaytoofast/erlang_cassandra) for thrift. > > Cheers > > p.s. Both pretty actively maintained, though I'd stay away from thrift if > I were you... > > > On Tue, May 6, 2014 at 7:21 PM, Ryan Brown wrote: > >> I'm looking to implement cassandra as, essentially, a replacement for >> mnesia in my erlang application. (Much research and battle woulds has >> resulted in this solution. Would be happy to discuss offline.) >> >> My question is regarding what is the "best" cassandra client library for >> erlang. For me, best is mainly defined as reasonably simple implementation >> and active development and support. >> >> cqerl? seestar? other? >> >> Thanks in advance! >> >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://erlang.org/mailman/listinfo/erlang-questions >> >> > > > -- > > * Mahesh Paolini-Subramanya > That > tall bald Indian guy..* > * Google+ > | Blog | Twitter > | LinkedIn > * > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > > -- http://federicocarrone.com/ -------------- next part -------------- An HTML attachment was scrubbed... URL: From eajam@REDACTED Wed May 7 04:22:30 2014 From: eajam@REDACTED (Alex Alvarez) Date: Tue, 6 May 2014 22:22:30 -0400 Subject: [erlang-questions] Erlang compilation travails In-Reply-To: References: <1399413806.787217691@apps.rackspace.com> Message-ID: $ which erl or $ find / -name erl -print On 05/06/2014 06:12 PM, Wes James wrote: > On Tue, May 6, 2014 at 4:03 PM, > wrote: > > > > lloyd@REDACTED:~$ cd ~ > lloyd@REDACTED:~$ erl > Erlang/OTP 17 [erts-6.0] [source] [64-bit] [smp:2:2] > [async-threads:10] [hipe] [kernel-poll:false] > > Eshell V6.0 (abort with ^G) > 1> > > Yikes! After all that house-cleaning, erl still runs! > > So my question: In which dark corner of my directory tree is erl > still lurking? > > Bonus question: Am I being a stupid dunderhead at somewhere along > the line or my computers IPIO (Inate Perversion of Inanimate > Objects) deamons? > > Help! > > Many thanks, > > LRP > > > try: > > $ which erl > > which uses your $PATH definition > > > -wes > > > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions -------------- next part -------------- An HTML attachment was scrubbed... URL: From bob@REDACTED Wed May 7 06:31:02 2014 From: bob@REDACTED (Bob Ippolito) Date: Tue, 6 May 2014 21:31:02 -0700 Subject: [erlang-questions] Erlang compilation travails In-Reply-To: <1399416136.353218080@apps.rackspace.com> References: <1399413806.787217691@apps.rackspace.com> <1399416136.353218080@apps.rackspace.com> Message-ID: The thing that makes the most sense here is that you've included the stack trace. It says crypto can't start. My guess is that you didn't have OpenSSL headers installed when this Erlang was built. On Tuesday, May 6, 2014, wrote: > Hi Garrett, > > You're making more sense by the minute. > > Just tried to install rebar under my brand-spanking-new kerl Erlang > installation on my Debian Wheezy box and ran into the same ol' same ol': > > lloyd@REDACTED:~/Erl/Tools$ cd rebar > lloyd@REDACTED:~/Erl/Tools/rebar$ ./bootstrap > Recompile: src/rebar > Recompile: src/rebar_abnfc_compiler > Recompile: src/rebar_app_utils > Recompile: src/rebar_appups > ... > Recompile: src/rebar_upgrade > Recompile: src/rebar_utils > Recompile: src/rebar_xref > Uncaught error in rebar_core: {'EXIT', > {undef, > [{crypto,start,[],[]}, > {rebar,run_aux,2, > [{file,"src/rebar.erl"},{line,165}]}, > {rebar,main,1, > [{file,"src/rebar.erl"},{line,58}]}, > {erl_eval,do_apply,6, > [{file,"erl_eval.erl"},{line,657}]}, > {escript,eval_exprs,5, > [{file,"escript.erl"},{line,865}]}, > {erl_eval,local_func,5, > [{file,"erl_eval.erl"},{line,544}]}, > {escript,interpret,4, > [{file,"escript.erl"},{line,781}]}, > {escript,start,1, > [{file,"escript.erl"},{line,276}]}]}} > lloyd@REDACTED:~/Erl/Tools/rebar$ > > > So, maybe it's not me after all, though I wouldn't discount. But, if > indeed not due to my fuzzy-headed fumble-fingers then perhaps, at least, my > tsuris will alert some packager that there's trouble on the farm. > > Thanks, Dude. > > Lloyd > > > > -----Original Message----- > From: "Garrett Smith" > > Sent: Tuesday, May 6, 2014 6:24pm > To: "Lloyd Prentice" > > Cc: "Erlang-Questions Questions" > > > Subject: Re: [erlang-questions] Erlang compilation travails > > On Tue, May 6, 2014 at 5:03 PM, > > wrote: > > Hello, > > > > I've been working my way up the Erlang learning curve for several years > now quite cheerfully--- coding, installing, compiling, uninstalling, etc. > But over the past several days my attempts to install n2o/samples have > thrown crash dumps at the very last stages of compilation. > > > > Thinking the problem may be an hardware, OS, or Erlang installation > issue, I moved to another box running Debian Wheezy. But on this box > installation of rebar fails in the ./bootstrap step. Moved to second > Debian box--- same issue. > > > > The only common denominator is and upgrade of Ubuntu to 14.04 on box one > and installation of Erlang under kerl on all three boxes. > > > > Been at this all day trying to get to the root of the problem. Decided > to go back to basics and COMPLETELY uninstall Erlang, rebar, and kerl from > the first Debian box and reinstall Erlang and rebar from scratch. > > > > But here's the mystery: > > > > lloyd@REDACTED:~$ sudo apt-get --purge remove 'erlang*' > > lloyd@REDACTED:~$ sudo dpkg-query -l 'erlang*' > > dpkg-query: no packages found matching erlang* > > lloyd@REDACTED:~$ sudo dpkg-query -l kerl > > dpkg-query: no packages found matching kerl > > lloyd@REDACTED:~$ sudo dpkg-query -l rebar > > dpkg-query: no packages found matching rebar > > lloyd@REDACTED:~$ cd .kerl > > bash: cd: .kerl: No such file or directory > > lloyd@REDACTED:~$ whereis erlang > > erlang: > > lloyd@REDACTED:~$ whereis rebar > > rebar: > > lloyd@REDACTED:~$ whereis kerl > > kerl: > > lloyd@REDACTED:~$ cd /usr/local/bin > > lloyd@REDACTED:/usr/local/bin$ ls -l > > total 0 > > lloyd@REDACTED:~$ cd ~ > > lloyd@REDACTED:~$ erl > > Erlang/OTP 17 [erts-6.0] [source] [64-bit] [smp:2:2] [async-threads:10] > [hipe] [kernel-poll:false] > > > > Eshell V6.0 (abort with ^G) > > 1> > > > > Yikes! After all that house-cleaning, erl still runs! > > > > So my question: In which dark corner of my directory tree is erl still > lurking? > > > > Bonus question: Am I being a stupid dunderhead at somewhere along the > line or my computers IPIO (Inate Perversion of Inanimate Objects) deamons? > > > > Help! > > It may be a pointless sacrifice to the Gods of Superstition -- there > may in fact not be problem -- but lore has it that the system packages > for Erlang are notoriously fickle, especially where Erlang is split up > into dozens and dozens of dependent packages as they are for Ubuntu. > > I personally would not spend a single minute troubleshooting a > problematic Ubuntu Erlang installation. Rather, I'd uninstall it and > compile Erlang from source and use that version via "sudo make > install". It takes a while, but I bet it takes a lot less time than > figuring out the Ubuntu problem. > > This article from the nice folks at Basho will help you compile on Ubuntu: > > http://docs.basho.com/riak/latest/ops/building/installing/erlang/ > > But I could be wrong -- I'm just sayin' what I'd do here :) > > Garrett > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From kunthar@REDACTED Wed May 7 09:28:50 2014 From: kunthar@REDACTED (Gokhan Boranalp) Date: Wed, 7 May 2014 10:28:50 +0300 Subject: [erlang-questions] Erlang compilation travails In-Reply-To: References: <1399413806.787217691@apps.rackspace.com> <1399416136.353218080@apps.rackspace.com> Message-ID: See here: http://docs.basho.com/riak/latest/ops/building/installing/erlang/#Installing-on-GNU-Linux Use this command to install the required dependency packages: sudo apt-get install build-essential libncurses5-dev openssl libssl-dev fop xsltproc unixodbc-dev On Wed, May 7, 2014 at 7:31 AM, Bob Ippolito wrote: > The thing that makes the most sense here is that you've included the stack > trace. It says crypto can't start. My guess is that you didn't have OpenSSL > headers installed when this Erlang was built. > > On Tuesday, May 6, 2014, wrote: >> >> Hi Garrett, >> >> You're making more sense by the minute. >> >> Just tried to install rebar under my brand-spanking-new kerl Erlang >> installation on my Debian Wheezy box and ran into the same ol' same ol': >> >> lloyd@REDACTED:~/Erl/Tools$ cd rebar >> lloyd@REDACTED:~/Erl/Tools/rebar$ ./bootstrap >> Recompile: src/rebar >> Recompile: src/rebar_abnfc_compiler >> Recompile: src/rebar_app_utils >> Recompile: src/rebar_appups >> ... >> Recompile: src/rebar_upgrade >> Recompile: src/rebar_utils >> Recompile: src/rebar_xref >> Uncaught error in rebar_core: {'EXIT', >> {undef, >> [{crypto,start,[],[]}, >> {rebar,run_aux,2, >> [{file,"src/rebar.erl"},{line,165}]}, >> {rebar,main,1, >> [{file,"src/rebar.erl"},{line,58}]}, >> {erl_eval,do_apply,6, >> [{file,"erl_eval.erl"},{line,657}]}, >> {escript,eval_exprs,5, >> [{file,"escript.erl"},{line,865}]}, >> {erl_eval,local_func,5, >> [{file,"erl_eval.erl"},{line,544}]}, >> {escript,interpret,4, >> [{file,"escript.erl"},{line,781}]}, >> {escript,start,1, >> [{file,"escript.erl"},{line,276}]}]}} >> lloyd@REDACTED:~/Erl/Tools/rebar$ >> >> >> So, maybe it's not me after all, though I wouldn't discount. But, if >> indeed not due to my fuzzy-headed fumble-fingers then perhaps, at least, my >> tsuris will alert some packager that there's trouble on the farm. >> >> Thanks, Dude. >> >> Lloyd >> >> >> >> -----Original Message----- >> From: "Garrett Smith" >> Sent: Tuesday, May 6, 2014 6:24pm >> To: "Lloyd Prentice" >> Cc: "Erlang-Questions Questions" >> Subject: Re: [erlang-questions] Erlang compilation travails >> >> On Tue, May 6, 2014 at 5:03 PM, wrote: >> > Hello, >> > >> > I've been working my way up the Erlang learning curve for several years >> > now quite cheerfully--- coding, installing, compiling, uninstalling, etc. >> > But over the past several days my attempts to install n2o/samples have >> > thrown crash dumps at the very last stages of compilation. >> > >> > Thinking the problem may be an hardware, OS, or Erlang installation >> > issue, I moved to another box running Debian Wheezy. But on this box >> > installation of rebar fails in the ./bootstrap step. Moved to second Debian >> > box--- same issue. >> > >> > The only common denominator is and upgrade of Ubuntu to 14.04 on box one >> > and installation of Erlang under kerl on all three boxes. >> > >> > Been at this all day trying to get to the root of the problem. Decided >> > to go back to basics and COMPLETELY uninstall Erlang, rebar, and kerl from >> > the first Debian box and reinstall Erlang and rebar from scratch. >> > >> > But here's the mystery: >> > >> > lloyd@REDACTED:~$ sudo apt-get --purge remove 'erlang*' >> > lloyd@REDACTED:~$ sudo dpkg-query -l 'erlang*' >> > dpkg-query: no packages found matching erlang* >> > lloyd@REDACTED:~$ sudo dpkg-query -l kerl >> > dpkg-query: no packages found matching kerl >> > lloyd@REDACTED:~$ sudo dpkg-query -l rebar >> > dpkg-query: no packages found matching rebar >> > lloyd@REDACTED:~$ cd .kerl >> > bash: cd: .kerl: No such file or directory >> > lloyd@REDACTED:~$ whereis erlang >> > erlang: >> > lloyd@REDACTED:~$ whereis rebar >> > rebar: >> > lloyd@REDACTED:~$ whereis kerl >> > kerl: >> > lloyd@REDACTED:~$ cd /usr/local/bin >> > lloyd@REDACTED:/usr/local/bin$ ls -l >> > total 0 >> >> > lloyd@REDACTED:~$ cd ~ >> > lloyd@REDACTED:~$ erl >> > Erlang/OTP 17 [erts-6.0] [source] [64-bit] [smp:2:2] [async-threads:10] >> > [hipe] [kernel-poll:false] >> > >> > Eshell V6.0 (abort with ^G) >> > 1> >> > >> > Yikes! After all that house-cleaning, erl still runs! >> > >> > So my question: In which dark corner of my directory tree is erl still >> > lurking? >> > >> > Bonus question: Am I being a stupid dunderhead at somewhere along the >> > line or my computers IPIO (Inate Perversion of Inanimate Objects) deamons? >> > >> > Help! >> >> It may be a pointless sacrifice to the Gods of Superstition -- there >> may in fact not be problem -- but lore has it that the system packages >> for Erlang are notoriously fickle, especially where Erlang is split up >> into dozens and dozens of dependent packages as they are for Ubuntu. >> >> I personally would not spend a single minute troubleshooting a >> problematic Ubuntu Erlang installation. Rather, I'd uninstall it and >> compile Erlang from source and use that version via "sudo make >> install". It takes a while, but I bet it takes a lot less time than >> figuring out the Ubuntu problem. >> >> This article from the nice folks at Basho will help you compile on Ubuntu: >> >> http://docs.basho.com/riak/latest/ops/building/installing/erlang/ >> >> But I could be wrong -- I'm just sayin' what I'd do here :) >> >> Garrett >> >> >> >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://erlang.org/mailman/listinfo/erlang-questions > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > -- BR, \|/ Kunthar From alessandro.sivieri@REDACTED Wed May 7 11:58:51 2014 From: alessandro.sivieri@REDACTED (Alessandro Sivieri) Date: Wed, 7 May 2014 11:58:51 +0200 Subject: [erlang-questions] Problems with the Erlang grammar and yecc Message-ID: Hi, I was experimenting with yecc and the Erlang grammar (taken from stdlib sources), but I got immediately stuck. I wrote a very simple module (e.g., a module defining one single function), then I executed the following sequence of actions: * put the content of the module in a single string * tokenize it using erl_scan * parse it using the module generated by yecc If I follow this sequence of actions, I get the following error: {error,{2,erl_grammar,["syntax error before: ","'-'"]}} I think it gets stuck in the "export" definition, because if my module contains only the "module" definition, I get no errors. Any idea? -- Sivieri Alessandro alessandro.sivieri@REDACTED http://sivieri.wordpress.com/ -------------- next part -------------- An HTML attachment was scrubbed... URL: From vladdu55@REDACTED Wed May 7 12:08:29 2014 From: vladdu55@REDACTED (Vlad Dumitrescu) Date: Wed, 7 May 2014 12:08:29 +0200 Subject: [erlang-questions] Problems with the Erlang grammar and yecc In-Reply-To: References: Message-ID: Hi! The erl_parse.yrl grammar handles only one form at a time (the root symbol is 'form'). You have to split the input at 'dot' tokens and parse each of the resulting lists of tokens. I would recommend to use the erl_parse functions, they do some "massaging" of the tokens. regards, Vlad On Wed, May 7, 2014 at 11:58 AM, Alessandro Sivieri < alessandro.sivieri@REDACTED> wrote: > Hi, > > I was experimenting with yecc and the Erlang grammar (taken from stdlib > sources), but I got immediately stuck. > > I wrote a very simple module (e.g., a module defining one single > function), then I executed the following sequence of actions: > > * put the content of the module in a single string > * tokenize it using erl_scan > * parse it using the module generated by yecc > > If I follow this sequence of actions, I get the following error: > > {error,{2,erl_grammar,["syntax error before: ","'-'"]}} > > I think it gets stuck in the "export" definition, because if my module > contains only the "module" definition, I get no errors. > > Any idea? > > -- > Sivieri Alessandro > alessandro.sivieri@REDACTED > http://sivieri.wordpress.com/ > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From eddie_serban@REDACTED Wed May 7 10:04:39 2014 From: eddie_serban@REDACTED (Serban Eduard) Date: Wed, 7 May 2014 01:04:39 -0700 (PDT) Subject: [erlang-questions] Best/recommended erlang client for cassandra? In-Reply-To: References: Message-ID: <1399449879.59957.YahooMailNeo@web120206.mail.ne1.yahoo.com> Hi, I use cqerl, https://github.com/matehat/cqerl CQErl offers a simple Erlang interface to Cassandra using the latest CQL version (v3). The main features include: * Automatic (and configurable) connection pools using pooler * Batched queries * Variable bindings in CQL queries (named or not) * Automatic query reuse when including variable bindings * Collection types support * Tunable consistency level * Synchronous or asynchronous queries * Automatic compression (using lz4 or snappy if available) * SSL support * Pluggable authentication (as long as it's SASL-based) Regards, Eddie ? On Wednesday, May 7, 2014 6:53 AM, Federico Carrone wrote: There is also seestar:https://github.com/iamaleksey/seestar I used it and work fine in general. ?But we had a few issues. We migrated from cassandra to another database so I don't remember anymore which issues we had with seestar. Regards. On Tue, May 6, 2014 at 9:39 PM, Mahesh Paolini-Subramanya wrote: erlcql (https://github.com/rpt/erlcql) for CQL, and erlang_cassandra (https://github.com/dieswaytoofast/erlang_cassandra) for thrift. > > >Cheers > > >p.s. Both pretty actively maintained, though I'd stay away from thrift if I were you... > > > >On Tue, May 6, 2014 at 7:21 PM, Ryan Brown wrote: > >I'm looking to implement cassandra as, essentially, a replacement for mnesia in my erlang application. (Much research and battle woulds has resulted in this solution. Would be happy to discuss offline.) >> >> >>My question is regarding what is the "best" cassandra client library for erlang. For me, best is mainly defined as reasonably simple implementation and active development and support. >> >> >>cqerl? seestar? other? >> >> >>Thanks in advance! >>_______________________________________________ >>erlang-questions mailing list >>erlang-questions@REDACTED >>http://erlang.org/mailman/listinfo/erlang-questions >> >> > > > >-- > >Mahesh Paolini-Subramanya >That tall bald Indian guy.. > >Google+? |?Blog?? |?Twitter? |?LinkedIn >_______________________________________________ >erlang-questions mailing list >erlang-questions@REDACTED >http://erlang.org/mailman/listinfo/erlang-questions > > -- http://federicocarrone.com/ _______________________________________________ erlang-questions mailing list erlang-questions@REDACTED http://erlang.org/mailman/listinfo/erlang-questions -------------- next part -------------- An HTML attachment was scrubbed... URL: From lloyd@REDACTED Wed May 7 14:35:15 2014 From: lloyd@REDACTED (lloyd@REDACTED) Date: Wed, 7 May 2014 08:35:15 -0400 (EDT) Subject: [erlang-questions] Erlang compilation travails In-Reply-To: References: <1399413806.787217691@apps.rackspace.com> <1399416136.353218080@apps.rackspace.com> Message-ID: <1399466115.362512885@apps.rackspace.com> Yeah, Bob, you nailed it! Thank you! Thank you! I purged Erlang from one of my Debian Wheezy boxes, installed Erlang dependencies as suggested by http://docs.basho.com/riak/latest/ops/building/installing/erlang/, and re-installed Erlang 17.0 via kerl. Rebar compiled first time. n2o is still giving me grief--- stalls well into the compile following many many warnings. But I'll work on that a bit more today. Thanks again, Lloyd -----Original Message----- From: "Bob Ippolito" Sent: Wednesday, May 7, 2014 12:31am To: "lloyd@REDACTED" Cc: "Garrett Smith" , "Erlang-Questions Questions" Subject: Re: [erlang-questions] Erlang compilation travails The thing that makes the most sense here is that you've included the stack trace. It says crypto can't start. My guess is that you didn't have OpenSSL headers installed when this Erlang was built. On Tuesday, May 6, 2014, wrote: > Hi Garrett, > > You're making more sense by the minute. > > Just tried to install rebar under my brand-spanking-new kerl Erlang > installation on my Debian Wheezy box and ran into the same ol' same ol': > > lloyd@REDACTED:~/Erl/Tools$ cd rebar > lloyd@REDACTED:~/Erl/Tools/rebar$ ./bootstrap > Recompile: src/rebar > Recompile: src/rebar_abnfc_compiler > Recompile: src/rebar_app_utils > Recompile: src/rebar_appups > ... > Recompile: src/rebar_upgrade > Recompile: src/rebar_utils > Recompile: src/rebar_xref > Uncaught error in rebar_core: {'EXIT', > {undef, > [{crypto,start,[],[]}, > {rebar,run_aux,2, > [{file,"src/rebar.erl"},{line,165}]}, > {rebar,main,1, > [{file,"src/rebar.erl"},{line,58}]}, > {erl_eval,do_apply,6, > [{file,"erl_eval.erl"},{line,657}]}, > {escript,eval_exprs,5, > [{file,"escript.erl"},{line,865}]}, > {erl_eval,local_func,5, > [{file,"erl_eval.erl"},{line,544}]}, > {escript,interpret,4, > [{file,"escript.erl"},{line,781}]}, > {escript,start,1, > [{file,"escript.erl"},{line,276}]}]}} > lloyd@REDACTED:~/Erl/Tools/rebar$ > > > So, maybe it's not me after all, though I wouldn't discount. But, if > indeed not due to my fuzzy-headed fumble-fingers then perhaps, at least, my > tsuris will alert some packager that there's trouble on the farm. > > Thanks, Dude. > > Lloyd > > > > -----Original Message----- > From: "Garrett Smith" > > Sent: Tuesday, May 6, 2014 6:24pm > To: "Lloyd Prentice" > > Cc: "Erlang-Questions Questions" > > > Subject: Re: [erlang-questions] Erlang compilation travails > > On Tue, May 6, 2014 at 5:03 PM, > > wrote: > > Hello, > > > > I've been working my way up the Erlang learning curve for several years > now quite cheerfully--- coding, installing, compiling, uninstalling, etc. > But over the past several days my attempts to install n2o/samples have > thrown crash dumps at the very last stages of compilation. > > > > Thinking the problem may be an hardware, OS, or Erlang installation > issue, I moved to another box running Debian Wheezy. But on this box > installation of rebar fails in the ./bootstrap step. Moved to second > Debian box--- same issue. > > > > The only common denominator is and upgrade of Ubuntu to 14.04 on box one > and installation of Erlang under kerl on all three boxes. > > > > Been at this all day trying to get to the root of the problem. Decided > to go back to basics and COMPLETELY uninstall Erlang, rebar, and kerl from > the first Debian box and reinstall Erlang and rebar from scratch. > > > > But here's the mystery: > > > > lloyd@REDACTED:~$ sudo apt-get --purge remove 'erlang*' > > lloyd@REDACTED:~$ sudo dpkg-query -l 'erlang*' > > dpkg-query: no packages found matching erlang* > > lloyd@REDACTED:~$ sudo dpkg-query -l kerl > > dpkg-query: no packages found matching kerl > > lloyd@REDACTED:~$ sudo dpkg-query -l rebar > > dpkg-query: no packages found matching rebar > > lloyd@REDACTED:~$ cd .kerl > > bash: cd: .kerl: No such file or directory > > lloyd@REDACTED:~$ whereis erlang > > erlang: > > lloyd@REDACTED:~$ whereis rebar > > rebar: > > lloyd@REDACTED:~$ whereis kerl > > kerl: > > lloyd@REDACTED:~$ cd /usr/local/bin > > lloyd@REDACTED:/usr/local/bin$ ls -l > > total 0 > > lloyd@REDACTED:~$ cd ~ > > lloyd@REDACTED:~$ erl > > Erlang/OTP 17 [erts-6.0] [source] [64-bit] [smp:2:2] [async-threads:10] > [hipe] [kernel-poll:false] > > > > Eshell V6.0 (abort with ^G) > > 1> > > > > Yikes! After all that house-cleaning, erl still runs! > > > > So my question: In which dark corner of my directory tree is erl still > lurking? > > > > Bonus question: Am I being a stupid dunderhead at somewhere along the > line or my computers IPIO (Inate Perversion of Inanimate Objects) deamons? > > > > Help! > > It may be a pointless sacrifice to the Gods of Superstition -- there > may in fact not be problem -- but lore has it that the system packages > for Erlang are notoriously fickle, especially where Erlang is split up > into dozens and dozens of dependent packages as they are for Ubuntu. > > I personally would not spend a single minute troubleshooting a > problematic Ubuntu Erlang installation. Rather, I'd uninstall it and > compile Erlang from source and use that version via "sudo make > install". It takes a while, but I bet it takes a lot less time than > figuring out the Ubuntu problem. > > This article from the nice folks at Basho will help you compile on Ubuntu: > > http://docs.basho.com/riak/latest/ops/building/installing/erlang/ > > But I could be wrong -- I'm just sayin' what I'd do here :) > > Garrett > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > From alessandro.sivieri@REDACTED Wed May 7 14:44:15 2014 From: alessandro.sivieri@REDACTED (Alessandro Sivieri) Date: Wed, 7 May 2014 14:44:15 +0200 Subject: [erlang-questions] Problems with the Erlang grammar and yecc In-Reply-To: References: Message-ID: Hi, thanks for your help! On Wed, May 7, 2014 at 12:08 PM, Vlad Dumitrescu wrote: > Hi! > > The erl_parse.yrl grammar handles only one form at a time (the root symbol > is 'form'). You have to split the input at 'dot' tokens and parse each of > the resulting lists of tokens. I would recommend to use the erl_parse > functions, they do some "massaging" of the tokens. > > regards, > Vlad > > > > On Wed, May 7, 2014 at 11:58 AM, Alessandro Sivieri < > alessandro.sivieri@REDACTED> wrote: > >> Hi, >> >> I was experimenting with yecc and the Erlang grammar (taken from stdlib >> sources), but I got immediately stuck. >> >> I wrote a very simple module (e.g., a module defining one single >> function), then I executed the following sequence of actions: >> >> * put the content of the module in a single string >> * tokenize it using erl_scan >> * parse it using the module generated by yecc >> >> If I follow this sequence of actions, I get the following error: >> >> {error,{2,erl_grammar,["syntax error before: ","'-'"]}} >> >> I think it gets stuck in the "export" definition, because if my module >> contains only the "module" definition, I get no errors. >> >> Any idea? >> >> -- >> Sivieri Alessandro >> alessandro.sivieri@REDACTED >> http://sivieri.wordpress.com/ >> >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://erlang.org/mailman/listinfo/erlang-questions >> >> > -- Sivieri Alessandro alessandro.sivieri@REDACTED http://sivieri.wordpress.com/ -------------- next part -------------- An HTML attachment was scrubbed... URL: From roger@REDACTED Wed May 7 17:05:01 2014 From: roger@REDACTED (Roger Lipscombe) Date: Wed, 7 May 2014 16:05:01 +0100 Subject: [erlang-questions] cth_log_redirect crashes with timeout in application_controller? Message-ID: I'm seeing the following when I run Common Test (via ct:run_test/1) . How can I diagnose/fix it? ...stuff... =ERROR REPORT==== 7-May-2014::15:59:15 === ** gen_event handler cth_log_redirect crashed. ** Was installed in error_logger ** Last event was: {info_report,<0.30.0>, {<0.7.0>,std_info, [{application,asn1}, {exited,stopped}, {type,temporary}]}} ** When handler state == {eh_state,tc_log_async,imp_os_upgrade_SUITE, undefined,factory_imp_upgrades,false,false} ** Reason == {timeout,{gen_server,call, [application_controller, which_applications]}} =INFO REPORT==== 7-May-2014::15:59:15 === application: sasl exited: stopped type: temporary ...more normal-looking stuff... ...scary error report stuff, which I assume is caused by the crash in cth_log_redirect, rather than the cause of same... What would be causing application_controller:which_applications to timeout? Erlang R16B03, by the way. Thanks, Roger. From luca.favatella@REDACTED Wed May 7 17:16:25 2014 From: luca.favatella@REDACTED (Luca Favatella) Date: Wed, 7 May 2014 17:16:25 +0200 (CEST) Subject: [erlang-questions] cth_log_redirect crashes with timeout in application_controller? In-Reply-To: References: Message-ID: <898098572.521267.1399475785094.JavaMail.zimbra@erlang-solutions.com> ----- Original Message ----- > I'm seeing the following when I run Common Test (via ct:run_test/1) . > How can I diagnose/fix it? > > ...stuff... Hi Roger, What is the (CT) test doing just before the crash? Stopping an application? Regards Luca > =ERROR REPORT==== 7-May-2014::15:59:15 === > ** gen_event handler cth_log_redirect crashed. [...] > ...scary error report stuff, which I assume is caused by the crash in > cth_log_redirect, rather than the cause of same... > > What would be causing application_controller:which_applications to timeout? > > Erlang R16B03, by the way. From roger@REDACTED Wed May 7 17:36:38 2014 From: roger@REDACTED (Roger Lipscombe) Date: Wed, 7 May 2014 16:36:38 +0100 Subject: [erlang-questions] cth_log_redirect crashes with timeout in application_controller? In-Reply-To: <898098572.521267.1399475785094.JavaMail.zimbra@erlang-solutions.com> References: <898098572.521267.1399475785094.JavaMail.zimbra@erlang-solutions.com> Message-ID: On 7 May 2014 16:16, Luca Favatella wrote: > What is the (CT) test doing just before the crash? Stopping an application? Yes. I have 'my_application_utils:ensure_all_stopped(my_app)' in the end_per_testcase function, where ensure_all_stopped does basically the reverse of application:ensure_all_started. From rtrlists@REDACTED Wed May 7 17:37:19 2014 From: rtrlists@REDACTED (Robert Raschke) Date: Wed, 7 May 2014 16:37:19 +0100 Subject: [erlang-questions] cth_log_redirect crashes with timeout in application_controller? In-Reply-To: References: Message-ID: Hi Roger, I remember this happening to me a while ago. Unfortunately, I don't have access to my code until the weekend, so this is from memory. The direct issue you are seeing is that for some reason the log redirector wants to know which applications are running, but it's doing that while an application is shutting down. This creates a deadlock. But luckily you see this as timeout. If I remember correctly, I worked around this by explicitly disabling the logging before stopping applications. Maybe this will help you find your way a bit. Robby On May 7, 2014 4:05 PM, "Roger Lipscombe" wrote: > I'm seeing the following when I run Common Test (via ct:run_test/1) . > How can I diagnose/fix it? > > ...stuff... > > =ERROR REPORT==== 7-May-2014::15:59:15 === > ** gen_event handler cth_log_redirect crashed. > ** Was installed in error_logger > ** Last event was: {info_report,<0.30.0>, > {<0.7.0>,std_info, > [{application,asn1}, > {exited,stopped}, > {type,temporary}]}} > ** When handler state == {eh_state,tc_log_async,imp_os_upgrade_SUITE, > > undefined,factory_imp_upgrades,false,false} > ** Reason == {timeout,{gen_server,call, > [application_controller, > which_applications]}} > > =INFO REPORT==== 7-May-2014::15:59:15 === > application: sasl > exited: stopped > type: temporary > > ...more normal-looking stuff... > > ...scary error report stuff, which I assume is caused by the crash in > cth_log_redirect, rather than the cause of same... > > What would be causing application_controller:which_applications to timeout? > > Erlang R16B03, by the way. > > Thanks, > Roger. > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From roger@REDACTED Wed May 7 17:39:32 2014 From: roger@REDACTED (Roger Lipscombe) Date: Wed, 7 May 2014 16:39:32 +0100 Subject: [erlang-questions] cth_log_redirect crashes with timeout in application_controller? In-Reply-To: References: Message-ID: On 7 May 2014 16:37, Robert Raschke wrote: > The direct issue you are seeing is that for some reason the log redirector > wants to know which applications are running, but it's doing that while an > application is shutting down. This creates a deadlock. But luckily you see > this as timeout. That's pretty much what I figured was happening; nice to have it confirmed. > If I remember correctly, I worked around this by explicitly disabling the > logging before stopping applications. Any idea how to do that? Thanks, Roger. From luca.favatella@REDACTED Wed May 7 17:44:51 2014 From: luca.favatella@REDACTED (Luca Favatella) Date: Wed, 7 May 2014 17:44:51 +0200 (CEST) Subject: [erlang-questions] cth_log_redirect crashes with timeout in application_controller? In-Reply-To: References: Message-ID: <1101725221.522576.1399477491458.JavaMail.zimbra@erlang-solutions.com> ----- Original Message ----- > On 7 May 2014 16:37, Robert Raschke wrote: [...] > > If I remember correctly, I worked around this by explicitly disabling the > > logging before stopping applications. > > Any idea how to do that? error_logger:delete_report_handler(cth_log_redirect), my_application_utils:ensure_all_stopped(my_app), error_logger:add_report_handler(cth_log_redirect) Regards Luca From aschultz@REDACTED Wed May 7 18:38:25 2014 From: aschultz@REDACTED (Andreas Schultz) Date: Wed, 7 May 2014 16:38:25 +0000 (UTC) Subject: [erlang-questions] DTLS Status and examples? In-Reply-To: References: Message-ID: <994078241.14275.1399480705359.JavaMail.zimbra@tpip.net> Hi, ----- Original Message ----- > > Hi! > > 2014-05-05 20:59 GMT+02:00 Myers Carpenter < myers@REDACTED > : > > > > Hello, > > I'm attempting to connect the data channel in webrtc to Erlang. You can read > about my project here https://github.com/myers/exwebrtc . > > I'm trying to understand where the DTLS code in Erlang is currently and where > I might be able to pitch in. > > > DTLS is not yet runnable, as there is not yet a red thread through the code. > dtls_connection.erl is the most incomplete module. It is the module that > implements > the finite state machine of the DTLS handshake, it correspondes to > tls_connection.erl. In general tls_* implements TLS specific parts and > dtls_* DTLS specific parts and ssl_* common parts. Looking at dtls_connection.erl, it seems to me that it replicates to much functionality from tls_connection.erl. At the pure TLS FSM level, DTLS and TLS are almost identical. The only real difference here is the HELLO VERIFY request. The main difference is at the transport level. DTLS adds fragmentation and re-transmits for handshake records and an explicit record sequence number for encryption/decryption. To me it looks like the current dtls_* modules duplicate lots of the SSL record level FSM functions, when they IMHO should only abstract the differences in the transport level mapping. > You could always do a test suite for DTLS that corresponds to > ssl_to_openssl_SUITE.erl in the test directory. Once you have a test suite > it is easier to try to fill in the gaps in dtls_* . The pure connection oriented test can be converted with very little effort. The test that manually open a TCP connection are a bit harder. The real challenge will be to come up with exhaustive testes for packet loss, reordering and duplication. Andreas > > > > > > I'm attempting to start a DTLS server and then connect to it via "openssl > s_client" > > Here's the code so far > > -module(dtls_server). > -export([start/0]). > > start() -> > ssl:start(), > > {ok, _Socket} = dtls:listen(4499, [ > {mode, binary}, > {reuseaddr, true}, > {certfile, "server.cert"}, > {keyfile, "server.pkey"}, > {active, true}, > {ciphers, [{ecdhe_rsa, aes_128_cbc, sha}]} > ]). > > > > Looks like something that should work when all pieces are in place. > > Regards Ingela Erlang/OTP team - Ericsson AB > > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > -- -- Dipl. Inform. Andreas Schultz email: as@REDACTED phone: +49-391-819099-224 mobil: +49-170-2226073 ------------------- enabling your networks ------------------- Travelping GmbH phone: +49-391-819099229 Roentgenstr. 13 fax: +49-391-819099299 D-39108 Magdeburg email: info@REDACTED GERMANY web: http://www.travelping.com Company Registration: Amtsgericht Stendal Reg No.: HRB 10578 Geschaeftsfuehrer: Holger Winkelmann | VAT ID No.: DE236673780 -------------------------------------------------------------- From lloyd@REDACTED Wed May 7 20:18:57 2014 From: lloyd@REDACTED (lloyd@REDACTED) Date: Wed, 7 May 2014 14:18:57 -0400 (EDT) Subject: [erlang-questions] Erlang compilation travails Message-ID: <1399486737.58328575@apps.rackspace.com> Hello, Thanks to generous help from folks on this list, I'm moving back to system stability. But my experience raises several questions: 1) Given the issues that I've run into compiling a simple development environment, all of my inadvertent doing no doubt, what can I expect when I set out to deploy a production stack to multiple remote servers? 2) Are there best practices lurking in the unpublished lore of the Erlang community (or published for that matter) for dealing with the problem of keeping development and production systems service-fit and up-to-date? 3) Would Ansible help? 4) Does it make sense to consider development and deployment under Docker--- presuming it's production ready by the time I'm ready? 5) Is there a better way? Thanks again to all, Lloyd From bob@REDACTED Wed May 7 20:34:38 2014 From: bob@REDACTED (Bob Ippolito) Date: Wed, 7 May 2014 11:34:38 -0700 Subject: [erlang-questions] Erlang compilation travails In-Reply-To: <1399486737.58328575@apps.rackspace.com> References: <1399486737.58328575@apps.rackspace.com> Message-ID: The problems you've experienced would happen with many other platforms (such as Python or even C). You tried to compile something with optional dependencies that you needed but the dependencies weren't there at the time. The configure and build succeeded but didn't provide the features you needed so it ended up as failure. Nothing about this is Erlang lore, it's just general build/ops stuff. The only Erlang knowledge required to solve your issue was to know how to read an Erlang traceback (granted, these are kinda backwards and line-noisy at first glance), and to know that the crypto module depends on OpenSSL. Any way to enforce that the build system is in some specific configuration before you start building things is sufficient to keep things in working order. Ansible, Puppet, Chef, Nix, CFEngine, etc. are all reasonable solutions to this and make the environment easy enough to reproduce. A better way might be to use Erlang releases for deployment, where you would deploy an entirely self-sufficient Erlang environment to your servers. The build would happen in one place and the deployment servers would only need to have the shared libraries that the runtime needs (OpenSSL and a few other things) which are probably already installed in a stock distribution. This would make the filesystem isolation the Docker provides mostly irrelevant, but using containers might still make sense for other reasons (security, for example). On Wed, May 7, 2014 at 11:18 AM, wrote: > Hello, > > Thanks to generous help from folks on this list, I'm moving back to system > stability. But my experience raises several questions: > > 1) Given the issues that I've run into compiling a simple development > environment, all of my inadvertent doing no doubt, what can I expect when I > set out to deploy a production stack to multiple remote servers? > > 2) Are there best practices lurking in the unpublished lore of the Erlang > community (or published for that matter) for dealing with the problem of > keeping development and production systems service-fit and up-to-date? > > 3) Would Ansible help? > > 4) Does it make sense to consider development and deployment under > Docker--- presuming it's production ready by the time I'm ready? > > 5) Is there a better way? > > Thanks again to all, > > Lloyd > > > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From ingela.andin@REDACTED Wed May 7 20:38:23 2014 From: ingela.andin@REDACTED (Ingela Andin) Date: Wed, 7 May 2014 20:38:23 +0200 Subject: [erlang-questions] DTLS Status and examples? In-Reply-To: <994078241.14275.1399480705359.JavaMail.zimbra@tpip.net> References: <994078241.14275.1399480705359.JavaMail.zimbra@tpip.net> Message-ID: Hi! 2014-05-07 18:38 GMT+02:00 Andreas Schultz : > [...] > > > > DTLS is not yet runnable, as there is not yet a red thread through the > code. > > dtls_connection.erl is the most incomplete module. It is the module that > > implements > > the finite state machine of the DTLS handshake, it correspondes to > > tls_connection.erl. In general tls_* implements TLS specific parts and > > dtls_* DTLS specific parts and ssl_* common parts. > > Looking at dtls_connection.erl, it seems to me that it replicates to much > functionality > from tls_connection.erl. > > Did not say anything of it being finished. You should see it more as sketch. I have been refactoring in a lot in small steps, making sure that TLS is not is broken. And I do expect that there will be more refactoring. At the pure TLS FSM level, DTLS and TLS are almost identical. The only real > difference > here is the HELLO VERIFY request. > Well tls_connection and ssl_connection does not implement a pure handshake-FSMs, it also handles the user data, record- and alert protocols. > To me it looks like the current dtls_* modules duplicate lots of the SSL > record level > FSM functions, when they IMHO should only abstract the differences in the > transport > level mapping. > > I am sure there is still room for improvement, for our design two things are important. The connection process for TLS and DTLS shall be separate behaviour implementations so that a bug in one will not affect the other. We want to leave room for API functions that may be DTLS and/or TLS specific, and also we want to reuse as much as possible of the original SSL/TLS code. I have also tried to use a much as possible of your contributed code. And yes there are some design decisions left to make and some code that is there now that may be disregarded. > You could always do a test suite for DTLS that corresponds to > > ssl_to_openssl_SUITE.erl in the test directory. Once you have a test > suite > > it is easier to try to fill in the gaps in dtls_* . > > The pure connection oriented test can be converted with very little > effort. Yes sure they can, but it is still work that needs to be done and does not take zero time. It is just a start, but you need to start somewhere and once dtls_connection is more close to connection process implementation you can start a test driven approach of making it work. The test > that manually open a TCP connection are a bit harder. The real challenge > will be to > come up with exhaustive testes for packet loss, reordering and duplication. > Good testing is always a challenge ;) Regards Ingela Erlang/OTP team - Ericsson AB -------------- next part -------------- An HTML attachment was scrubbed... URL: From desired.mta@REDACTED Fri May 9 10:29:08 2014 From: desired.mta@REDACTED (=?UTF-8?B?TW90aWVqdXMgSmFrxaF0eXM=?=) Date: Fri, 09 May 2014 10:29:08 +0200 Subject: [erlang-questions] abstracting folsom, estatsd, exometer & co Message-ID: <536C91D4.8020003@gmail.com> Dear list, we are open-sourcing an internal library to release in EUC2014[1]. Currently it relies on estatsd (graphite) for instrumentation. We instrument the following: 1. incr. success/error of calls (different keys). 2. time spent doing a request (different keys). I want users with other instrumentation tools to be able to use it successfully, therefore I would rather not depend on estatsd. Alternative configuration comes to mind (Key :: [string()|atom()]) : 1. {success_callback, {M, F} :: fun((Key) -> ok)}. 2. {failure_callback, {M, F} :: fun((Key) -> ok)}. 3. {tc_callback, {M, F} :: fun((Key, ValueInMs) -> ok)}. Is it feasible? Is there a more elegant way? I would very much love something like error_logger: > error_logger:error_msg("Oops!"). How do you approach abstract instrumentation in a lean library? Regards, Motiejus [1]: http://www.erlang-factory.com/euc2014/motiejus-jaktys From n.oxyde@REDACTED Fri May 9 11:01:04 2014 From: n.oxyde@REDACTED (Anthony Ramine) Date: Fri, 9 May 2014 11:01:04 +0200 Subject: [erlang-questions] abstracting folsom, estatsd, exometer & co In-Reply-To: <536C91D4.8020003@gmail.com> References: <536C91D4.8020003@gmail.com> Message-ID: Please make a proper behaviour for this, passing closures for such long-lived things is asking for upgrade problems. -- Anthony Ramine Le 9 mai 2014 ? 10:29, Motiejus Jak?tys a ?crit : > I want users with other instrumentation tools to be able to use it > successfully, therefore I would rather not depend on estatsd. > > Alternative configuration comes to mind (Key :: [string()|atom()]) : > 1. {success_callback, {M, F} :: fun((Key) -> ok)}. > 2. {failure_callback, {M, F} :: fun((Key) -> ok)}. > 3. {tc_callback, {M, F} :: fun((Key, ValueInMs) -> ok)}. From lcastro@REDACTED Fri May 9 11:45:56 2014 From: lcastro@REDACTED (Laura M. Castro) Date: Fri, 9 May 2014 11:45:56 +0200 Subject: [erlang-questions] Erlang Workshop 2014: deadline extension Message-ID: Hello all, the PC has decided to extend the paper submission deadline for the 13th ACM SIGPLAN Erlang Workshop. Final dates are the following, no further extensions will be granted: Submissions due: Sunday, 18 May, 2014 [extended, final] Author notification: Friday, 12 June, 2014 [extended] Final copy due: Sunday, 22 June, 2014 [unchanged, ACM strict deadline] Workshop date: September 5, 2014 [unchanged] Apologies for any duplicates you may receive. FINAL CALL FOR PAPERS [deadline extension] =================================== Thirteenth ACM SIGPLAN Erlang Workshop ----------------------------------------------------------- G?teborg, Sweden, September 5, 2014 Satellite event of the 19th ACM SIGPLAN International Conference on Functional Programming (ICFP 2014) September 1-3, 2014 http://www.erlang.org/workshop/2014 Erlang is a concurrent, distributed functional programming language aimed at systems with requirements of massive concurrency, soft real time response, fault tolerance, and high availability. It has been available as open source for 15 years, creating a community that actively contributes to its already existing rich set of libraries and applications. Originally created for telecom applications, its usage has spread to other domains including e-commerce, banking, databases, and computer telephony and messaging. Erlang programs are today among the largest applications written in any functional programming language. These applications offer new opportunities to evaluate functional programming and functional programming methods on a very large scale and suggest new problems for the research community to solve. This workshop will bring together the open source, academic, and industrial programming communities of Erlang. It will enable participants to familiarize themselves with recent developments on new techniques and tools tailored to Erlang, novel applications, draw lessons from users' experiences and identify research problems and common areas relevant to the practice of Erlang and functional programming. We invite three types of submissions. 1. Technical papers describing language extensions, critical discussions of the status quo, formal semantics of language constructs, program analysis and transformation, virtual machine extensions and compilation techniques, implementations and interfaces of Erlang in/with other languages, and new tools (profilers, tracers, debuggers, testing frameworks, etc.). The maximum length for technical papers is restricted to 12 pages. 2. Practice and application papers describing uses of Erlang in the "real-world", Erlang libraries for specific tasks, experiences from using Erlang in specific application domains, reusable programming idioms and elegant new ways of using Erlang to approach or solve a particular problem. The maximum length for the practice and application papers is restricted to 12 pages. Note that this is a maximum length; we welcome shorter papers also, and the program committee will evaluate all papers on an equal basis independent of their lengths. 3. Poster presentations describing topics related to the workshop goals. Each includes a maximum of 2 pages of the abstract and summary. Presentations in this category will be given an hour of shared simultaneous demonstration time. Workshop Co-Chairs ------------------ Laura M. Castro, University of A Coru?a, Spain Hans Svensson, QuviQ AB, Sweden Program Committee ----------------------------- (Note: the Workshop Co-Chairs are also committee members) Jesper L. Andersen, Erlang Solutions Ltd., UK Richard Carlsson, Klarna AB, Sweden Lars-?ke Fredlund, Universidad Polit?cnica de Madrid, Spain Fr?d H?bert, Heroku, USA Kostis Sagonas, Uppsala University, Sweden & NTUA, Greece Simon Thompson, University of Kent, UK Steve Vinoski, Basho Technologies, USA Philip Wadler, University of Edinburgh, UK Instructions to authors -------------------------------- Papers must be submitted online via EasyChair (via the "Erlang2014" event). The submission page is https://www.easychair.org/conferences/?conf=erlang2014 Submitted papers should be in portable document format (PDF), formatted using the ACM SIGPLAN style guidelines. Each submission must adhere to SIGPLAN's republication policy. Violation risks summary rejection of the offending submission. Accepted papers will be published by the ACM and will appear in the ACM Digital Library. Paper submissions will be considered for poster submission in the case they are not accepted as full papers. Venue & Registration Details ------------------------------------------ For registration, please see the ICFP 2014 web site at: http://icfpconference.org/icfp2014/ Related Links -------------------- ICFP 2014 web site: http://www.icfpconference.org/icfp2014/ Past ACM SIGPLAN Erlang workshops: http://www.erlang.org/workshop/ Open Source Erlang: http://www.erlang.org/ EasyChair submission site: https://www.easychair.org/conferences/?conf=erlang2014 Author Information for SIGPLAN Conferences: http://www.sigplan.org/authorInformation.htm Atendee Information for SIGPLAN Events: http://www.sigplan.org/Resources/Policies/Anti-harassment -- Laura M. Castro Department of Computer Science Universidade da Coru?a (Spain) http://www.madsgroup.org/staff/laura From ulf@REDACTED Fri May 9 14:00:11 2014 From: ulf@REDACTED (Ulf Wiger) Date: Fri, 9 May 2014 14:00:11 +0200 Subject: [erlang-questions] abstracting folsom, estatsd, exometer & co In-Reply-To: <536C91D4.8020003@gmail.com> References: <536C91D4.8020003@gmail.com> Message-ID: exometer is already an abstraction layer on top of e.g. folsom, allowing you to use folsom metrics, native exometer metrics, or plug in your own. I?d be happy to hear what specific functionality you need that cannot currently be provided via exometer. BR, Ulf W On 09 May 2014, at 10:29, Motiejus Jak?tys wrote: > Dear list, > > we are open-sourcing an internal library to release in EUC2014[1]. > Currently it relies on estatsd (graphite) for instrumentation. > > We instrument the following: > 1. incr. success/error of calls (different keys). > 2. time spent doing a request (different keys). > > I want users with other instrumentation tools to be able to use it > successfully, therefore I would rather not depend on estatsd. > > Alternative configuration comes to mind (Key :: [string()|atom()]) : > 1. {success_callback, {M, F} :: fun((Key) -> ok)}. > 2. {failure_callback, {M, F} :: fun((Key) -> ok)}. > 3. {tc_callback, {M, F} :: fun((Key, ValueInMs) -> ok)}. > > Is it feasible? Is there a more elegant way? I would very much love > something like error_logger: > >> error_logger:error_msg("Oops!"). > > How do you approach abstract instrumentation in a lean library? > > Regards, > Motiejus > > [1]: http://www.erlang-factory.com/euc2014/motiejus-jaktys > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions Ulf Wiger, Co-founder & Developer Advocate, Feuerlabs Inc. http://feuerlabs.com From desired.mta@REDACTED Fri May 9 15:18:22 2014 From: desired.mta@REDACTED (=?UTF-8?B?TW90aWVqdXMgSmFrxaF0eXM=?=) Date: Fri, 09 May 2014 15:18:22 +0200 Subject: [erlang-questions] abstracting folsom, estatsd, exometer & co In-Reply-To: References: <536C91D4.8020003@gmail.com> Message-ID: <536CD59E.5090100@gmail.com> 2014.05.09 14:00, Ulf Wiger ra??: > exometer is already an abstraction layer on top of e.g. folsom, > allowing you to use folsom metrics, native exometer metrics, or plug > in your own. > > I?d be happy to hear what specific functionality you need that cannot > currently be provided via exometer. By instrumenting using Exometer, this library would: 1. Assume the application is using Exometer. 2. Pull in 10 dependencies (look at Exometer's rebar.config!) for the application. I understand Exometer is superior over all these in the subject line, but I don't want to force users (and us) to use it (or change to it) just because. I want to provide easy hooks to log in their way, most likely estatsd directly (our current projects) or Exometer (our new projects). It's now standard to log to lager these days, but in libraries that do one thing well I still prefer error_logger. For the same reason of choice. Motiejus From ulf@REDACTED Fri May 9 15:34:26 2014 From: ulf@REDACTED (Ulf Wiger) Date: Fri, 9 May 2014 15:34:26 +0200 Subject: [erlang-questions] abstracting folsom, estatsd, exometer & co In-Reply-To: <536CD59E.5090100@gmail.com> References: <536C91D4.8020003@gmail.com> <536CD59E.5090100@gmail.com> Message-ID: <69600EA4-AF6F-467C-AD2C-6E449DB0A140@feuerlabs.com> On 09 May 2014, at 15:18, Motiejus Jak?tys wrote: > By instrumenting using Exometer, this library would: > 1. Assume the application is using Exometer. > 2. Pull in 10 dependencies (look at Exometer's rebar.config!) for the > application. Yes, well, it would be nice if rebar could introduce some good support for conditional dependencies. For example, you don?t need: - afunix, if you don?t plan to use the collectd reporter - bear and folsom, if you don?t want to use folsom - exo, if you don?t use the graphite reporter - netlink, if you don?t plan to use the experimental netlink probe edown and meck are only used for docs and testing. That?s of course the problem with trying to make a generic abstraction layer that?s still complete enough and broad enough to attract a community: you eventually have to tie yourself to some libraries (like lager), and simply accept that it will not be the preferred flavor for everyone. BR, Ulf W Ulf Wiger, Co-founder & Developer Advocate, Feuerlabs Inc. http://feuerlabs.com From max.lapshin@REDACTED Fri May 9 16:48:35 2014 From: max.lapshin@REDACTED (Max Lapshin) Date: Fri, 9 May 2014 18:48:35 +0400 Subject: [erlang-questions] crypto:block_decrypt doesn't return ivec Message-ID: I'm implementing Apple HLS SAMPLE-AES decryption and according to their spec, it is required to decrypt different blocks independently. But specs are written for fun, so it is required to take ivec from decrypt process and use it in next decrypt. crypto:block_decrypt(aes_cbc128,....) returns only decrypted text and looses ivec: ret_ptr = enif_make_new_binary(env, data_bin.size, &ret); memcpy(ivec, ivec_bin.data, 16); /* writable copy */ AES_cbc_encrypt(data_bin.data, ret_ptr, data_bin.size, &aes_key, ivec, i); CONSUME_REDS(env,data_bin); return ret; modified ivec is lost. So I cannot reuse it and I need to cut all parts for decrypting, glue them together and then split back. Why modified ivec is ignored? Is it possible to modify api in some way that it would be possible to fix it and return ivec also? -------------- next part -------------- An HTML attachment was scrubbed... URL: From mattevans123@REDACTED Fri May 9 17:21:24 2014 From: mattevans123@REDACTED (Matthew Evans) Date: Fri, 9 May 2014 11:21:24 -0400 Subject: [erlang-questions] OSE module Message-ID: Hi, Looking at the latest documentation I noticed that there is a new OSE module. We are using ENEAs LINX on Linux (effectively OSE for Linux). I was wondering if this would be compatible? At the moment we rely on NIFs to handle Linx messages. Thanks Matt -------------- next part -------------- An HTML attachment was scrubbed... URL: From lukas@REDACTED Fri May 9 17:39:18 2014 From: lukas@REDACTED (Lukas Larsson) Date: Fri, 9 May 2014 17:39:18 +0200 Subject: [erlang-questions] OSE module In-Reply-To: References: Message-ID: Hello, I don't know how the Linux linx api works, but I doubt the ose module would work on linux without rewriting most of the underlying linked-in driver from scratch. Especially the parts that has to do with reacting to signals being sent to the Erlang VM. Lukas On Fri, May 9, 2014 at 5:21 PM, Matthew Evans wrote: > Hi, > > Looking at the latest documentation I noticed that there is a new OSE > module. We are using ENEAs LINX on Linux (effectively OSE for Linux). I was > wondering if this would be compatible? At the moment we rely on NIFs to > handle Linx messages. > > Thanks > > Matt > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From eshikafe@REDACTED Fri May 9 17:43:43 2014 From: eshikafe@REDACTED (austin aigbe) Date: Fri, 9 May 2014 16:43:43 +0100 Subject: [erlang-questions] Erlang For Visual Studio 2013 Ultimate Message-ID: Hi, Is there any Visual Studio 2013 Ultimate plugin for Erlang development? Thanks. Austin -------------- next part -------------- An HTML attachment was scrubbed... URL: From jeromer@REDACTED Fri May 9 19:37:30 2014 From: jeromer@REDACTED (=?ISO-8859-1?Q?J=E9r=F4me=20Renard?=) Date: Fri, 09 May 2014 19:37:30 +0200 Subject: [erlang-questions] Crash with +debug_info flag Message-ID: <1399657050.8382.115607581.5D4B5A6D@webmail.messagingengine.com> Hello, I have a weird problem when using the +debug_info flag + common tests. I use erlang.mk with the following flags: ERLC_OPTS ?= -Werror +debug_info +warn_export_all +warn_export_vars +warn_shadow_vars +warn_obsolete_guard +'{parse_transform, lager_transform}' If I run make test_xxxxx, common test crashes with the following error: 19:29:47.073 [error] CRASH REPORT Process <0.425.0> with 0 neighbours exited with reason: no match of right hand value nomatch in csv_reader:init/2 line 103 in gen_server:init_it/6 line 328 If I remove the +debug_info flag, all the tests passes but obsviously nothing is cover compiled. It seems to only happen with the following app: - https://github.com/maxlapshin/csv_reader According to the crash message, there is something wrong with csv_reader:init which breaks gen_server:init_it. But csv_reader is not a gen_server so why is gen_server:init_it called ? Thanks in advance for your help. :) -- J?r?me From essen@REDACTED Fri May 9 23:15:29 2014 From: essen@REDACTED (=?UTF-8?B?TG/Dr2MgSG9ndWlu?=) Date: Fri, 09 May 2014 23:15:29 +0200 Subject: [erlang-questions] Crash with +debug_info flag In-Reply-To: <1399657050.8382.115607581.5D4B5A6D@webmail.messagingengine.com> References: <1399657050.8382.115607581.5D4B5A6D@webmail.messagingengine.com> Message-ID: <536D4571.7000206@ninenines.eu> On 05/09/2014 07:37 PM, J?r?me Renard wrote: > According to the crash message, there is something wrong with > csv_reader:init which breaks gen_server:init_it. But csv_reader is not a > gen_server so why is gen_server:init_it called ? To answer this particularly, gen_server:init_it is the one calling csv_reader:init so it's normal. I would try to output Tot to see what's different between +debug_info and without and submit a bug to erlang-bugs if it turns out something fishy is going on. -- Lo?c Hoguin http://ninenines.eu From joerg.maushake@REDACTED Sat May 10 16:58:24 2014 From: joerg.maushake@REDACTED (=?UTF-8?Q?=22J=C3=B6rg_Maushake=22?=) Date: Sat, 10 May 2014 16:58:24 +0200 Subject: [erlang-questions] windows multicast Message-ID: An HTML attachment was scrubbed... URL: From kunthar@REDACTED Sat May 10 17:18:43 2014 From: kunthar@REDACTED (Gokhan Boranalp) Date: Sat, 10 May 2014 18:18:43 +0300 Subject: [erlang-questions] windows multicast In-Reply-To: References: Message-ID: Restart your computer. On Sat, May 10, 2014 at 5:58 PM, "J?rg Maushake" wrote: > Hi list, > I am using erlang on windows 7. > > When i start a multicast (the code is from nodefinder) like so: > Opts = [ { active, true }, > { ip, {230, 0, 0, 1} }, > { add_membership, { {230, 0, 0, 1}, { 0, 0, 0, 0 } } }, > { multicast_loop, true }, > { reuseaddr, true }, > list > ], > { ok, RecvSocket } = gen_udp:open (4321, Opts), > > i get this {error,eaddrnotavail} > > Removing the tuple { ip, {230, 0, 0, 1} } from Opts seems to work! > But when i then start another node on the same machine the error i get is: > {error,eaddrinuse} > > (The multicast group and port works with java ) > > Any suggestions ? > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > -- BR, \|/ Kunthar From joerg.maushake@REDACTED Sat May 10 21:37:30 2014 From: joerg.maushake@REDACTED (=?UTF-8?Q?=22J=C3=B6rg_Maushake=22?=) Date: Sat, 10 May 2014 21:37:30 +0200 Subject: [erlang-questions] windows multicast In-Reply-To: References: , Message-ID: An HTML attachment was scrubbed... URL: From sergej.jurecko@REDACTED Sun May 11 07:55:23 2014 From: sergej.jurecko@REDACTED (Sergej Jurecko) Date: Sun, 11 May 2014 07:55:23 +0200 Subject: [erlang-questions] windows multicast In-Reply-To: References: , Message-ID: <9C7C51F8-3138-419C-B4E3-F0FBF0C1FC6A@gmail.com> Multicast in erlang is kind of weird. I actually have slightly different code for different platforms. This is code from r14 days. I?m not sure if it works any differently now, but I did have issues finding the right combination of parameters to get it to work. Nothing worked universally across all platforms. Mc = multicast address Src = source ip of local interface Windows: {ok, SockSrc} = gen_udp:open(Port, [{reuseaddr,true}, {ip, Src}, {multicast_ttl, 1}, {multicast_loop, false}, binary]), inet:setopts(SockSrc, [{add_membership, {Mc, Src}}]); linux,freebsd: {ok, SockSrc} = gen_udp:open(Port, [{reuseaddr,true}, {ip, {0,0,0,0}}, {add_membership, {Mc, Src}},{active,true}, binary,{recbuf, 1024*1024}]); osx: {ok, SockSrc} = gen_udp:open(Port, [{reuseaddr,true}, {ip, Mc}, {multicast_ttl, 1}, {multicast_loop, false},{recbuf, 1024*1024}, binary]), inet:setopts(SockSrc, [{add_membership, {Mc, {0,0,0,0}}}]) Sergej On 10 May 2014, at 21:37, J?rg Maushake wrote: > Restarting windows does not change anything. > I deployed the code to macbook where it works. > It seems to be a windows issue > otp_release: R16B03-1 > > Gesendet: Samstag, 10. Mai 2014 um 17:18 Uhr > Von: "Gokhan Boranalp" > An: "J?rg Maushake" > Cc: Erlang > Betreff: Re: [erlang-questions] windows multicast > Restart your computer. > > On Sat, May 10, 2014 at 5:58 PM, "J?rg Maushake" wrote: > > Hi list, > > I am using erlang on windows 7. > > > > When i start a multicast (the code is from nodefinder) like so: > > Opts = [ { active, true }, > > { ip, {230, 0, 0, 1} }, > > { add_membership, { {230, 0, 0, 1}, { 0, 0, 0, 0 } } }, > > { multicast_loop, true }, > > { reuseaddr, true }, > > list > > ], > > { ok, RecvSocket } = gen_udp:open (4321, Opts), > > > > i get this {error,eaddrnotavail} > > > > Removing the tuple { ip, {230, 0, 0, 1} } from Opts seems to work! > > But when i then start another node on the same machine the error i get is: > > {error,eaddrinuse} > > > > (The multicast group and port works with java ) > > > > Any suggestions ? > > > > _______________________________________________ > > erlang-questions mailing list > > erlang-questions@REDACTED > > http://erlang.org/mailman/listinfo/erlang-questions > > > > > > -- > BR, > \|/ Kunthar > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions -------------- next part -------------- An HTML attachment was scrubbed... URL: From semmitmondo@REDACTED Sun May 11 09:29:20 2014 From: semmitmondo@REDACTED (semmit mondo) Date: Sun, 11 May 2014 09:29:20 +0200 (CEST) Subject: [erlang-questions] mutable state Message-ID: Hi, I'm working on a project that tries to bring a mutable state, OO language to theBEAM. I believe this isn't impossible, but would like to ask your opinion on howto map certain OO constructs to Erlang, and how to bypass immutable stateconstraints. (Yes, I know that this sounds stupid, but that's what I need.) The fundamentals of that I want to do is to be able to have two references toan object, and when I change the object using one of my references, the view ofthe object should change with the other ref. I would like to represent these thingsin Erlang/BEAM as low level as possible. One of my first ideas is that let's useErlang variables (or BEAM registres) to hold a reference to a tuple that representsan object. Ref1 = {object, Class, InstanceVariables}. Ref2 = Ref1. Instancevariables is a dict (gb_tree, of whatever), but the problem is that I justcan't update the dict without creating a completely new dict and a new tuple.So, whatever I do with Ref1, I won't see anything changing with Ref2. Is therea way to get out of this trap? I guess the tuple resides on the heap and it consistsof 3 pointers to it's three members. It I could update the third pointer in thattuple, that could solve my problem. Is there somethong like setelement/3, thatupdates an existing tuple in place? I know that this is exactly what Erlang wantsto avoid, bu again, in order to port other languages to BEAM, at some point I haveto bypass immutable state somehow. I know about process dictionaries. That is really a great thing for those who want todo something like me. The only problem is that it's only a single dictionary, but Ineed at least one mutable hash/dict per object in order to hold mutable state. Another ide of mine is to represent object references with unique IDs (just numbers,or Refs) in a tuple like {ref, 2763456} or {ref, make_ref()}. This allows me to havereferences to the same object on different places in the code, while I can use theprocess dictionary to hold all my ob! jects by refs as keys. This allows me everything Iwant. The only problem is that this way I lose the ability to use the built-in GC of BEAM.Even if I drop all the references to an object, the process dictionary will hold them andprevent automatic garbage collection to work for me. My other concern is that therecan be a very large number of objects and maybe process dictionaries aren'tdesigned for this, and therefore they aren't efficient enough for the job. However,I don't know about any other way to achieve what I want. ETS tables looked promising for the first sight, but even having one single ETS tableper process is something considered a bad practise. So I guess they are not theright solution for my problem. Any idea how can I have an in-place updatable dicts on the heap? Or how to doOO object representation better? Are there other things similar to the processdictionaries that can hold mutable state? THX -------------- next part -------------- An HTML attachment was scrubbed... URL: From norton@REDACTED Sun May 11 12:20:55 2014 From: norton@REDACTED (Joseph Wayne Norton) Date: Sun, 11 May 2014 19:20:55 +0900 Subject: [erlang-questions] mutable state In-Reply-To: References: Message-ID: <893BF701-7177-4E91-9FAD-2C1CC5EC1F1F@lovely.email.ne.jp> You can try using a NIF object that acts as an environment for your objects. The NIF object and it's associated terms will be garbage collected when the NIF object is no longer referenced by the Erlang VM. There is such a mechanism for an implementation of Scheme on the Erlang VM. http://the-concurrent-schemer.github.io/scm-doc/ http://the-concurrent-schemer.github.io/scm-doc/contributors.html#getting_started Try the above getting started link to see an example that uses such a NIF object. The code for the environment resource can be found here: https://github.com/the-concurrent-schemer/scm/blob/dev/src/scmi_env.erl https://github.com/the-concurrent-schemer/scm/blob/dev/c_src/scmi_env.cc There is an underlying issue if these NIF objects are long lived with many mutable states ... there is currently no GC for the old values held in the NIF's environment. Mileage will vary! On 2014/05/11, at 16:29, semmit mondo wrote: > Hi, > > I'm working on a project that tries to bring a mutable state, OO language to the > BEAM. I believe this isn't impossible, but would like to ask your opinion on how > to map certain OO constructs to Erlang, and how to bypass immutable state > constraints. (Yes, I know that this sounds stupid, but that's what I need.) > > The fundamentals of that I want to do is to be able to have two references to > an object, and when I change the object using one of my references, the view of > the object should change with the other ref. I would like to represent these things > in Erlang/BEAM as low level as possible. One of my first ideas is that let's use > Erlang variables (or BEAM registres) to hold a reference to a tuple that represents > an object. > > Ref1 = {object, Class, InstanceVariables}. > Ref2 = Ref1. > > Instancevariables is a dict (gb_tree, of whatever), but the problem is that I just > can't update the dict without creating a completely new dict and a new tuple. > So, whatever I do with Ref1, I won't see anything changing with Ref2. Is there > a way to get out of this trap? I guess the tuple resides on the heap and it consists > of 3 pointers to it's three members. It I could update the third pointer in that > tuple, that could solve my problem. Is there somethong like setelement/3, that > updates an existing tuple in place? I know that this is exactly what Erlang wants > to avoid, bu again, in order to port other languages to BEAM, at some point I have > to bypass immutable state somehow. > > I know about process dictionaries. That is really a great thing for those who want to > do something like me. The only problem is that it's only a single dictionary, but I > need at least one mutable hash/dict per object in order to hold mutable state. > > Another ide of mine is to represent object references with unique IDs (just numbers, > or Refs) in a tuple like {ref, 2763456} or {ref, make_ref()}. This allows me to have > references to the same object on different places in the code, while I can use the > process dictionary to hold all my objects by refs as keys. This allows me everything I > want. The only problem is that this way I lose the ability to use the built-in GC of BEAM. > Even if I drop all the references to an object, the process dictionary will hold them and > prevent automatic garbage collection to work for me. My other concern is that there > can be a very large number of objects and maybe process dictionaries aren't > designed for this, and therefore they aren't efficient enough for the job. However, > I don't know about any other way to achieve what I want. > > ETS tables looked promising for the first sight, but even having one single ETS table > per process is something considered a bad practise. So I guess they are not the > right solution for my problem. > > Any idea how can I have an in-place updatable dicts on the heap? Or how to do > OO object representation better? Are there other things similar to the process > dictionaries that can hold mutable state? > > THX > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions From n.oxyde@REDACTED Sun May 11 13:12:19 2014 From: n.oxyde@REDACTED (Anthony Ramine) Date: Sun, 11 May 2014 13:12:19 +0200 Subject: [erlang-questions] update_counter on steroids In-Reply-To: <64245B5A-B63D-4C0C-A62F-80884C696524@feuerlabs.com> References: <64245B5A-B63D-4C0C-A62F-80884C696524@feuerlabs.com> Message-ID: Hello Ulf, Not what you asked for, but I implemented ets:update_counter/4 which takes a default value yesterday: ets:new(counters, [set,named_table]), 1 = ets:update_counter(counters, c1, 1, {c1,1}), 3 = ets:update_counter(counters, c1, 2, {c1,1}), [{c1,3}] = ets:tab2list(counters). Regards, https://github.com/erlang/otp/pull/362 -- Anthony Ramine Le 7 ao?t 2013 ? 13:39, Ulf Wiger a ?crit : > > There was some discussion recently on teaching update_counter some new tricks. > > Here is a suggestion: > > Right now, the function takes (Tab, Key, UpOp | [UpOp]), where > UpOp ::== {Pos, Incr} | {Pos, Incr, Threshold, WrapTo} > > I'd like to save the result of an operation in a temporary variable. > > An atomic reset, for example. (let's say counter c1 has the value 17): > > ets:update_counter(counters, c1, [{2, 0, '$1'}, {2, {'-', '$1'}}]) -> > [17, 0] > > (Increment by 0 means we read the existing value, just like today). > > Why use this instead of simply ets:insert/2? Well, for one thing, we get the old value back, so it's an atomic read-reset. > > Sum counter: > > ets:update_counter(counters, c2, [{2,0,'$1'}, {3,0,'$2'}, {4, {'+', '$1', '$2'}}]) > > Wrap with parameterized threshold and reset value: > > ets:update_counter(counters, c3, [{3,0,'$1'}, {4,0,'$2'}, {2, Incr, '$1', '$2'}]) > > This assumes the following changes: > > - A number of temp variables, like in match specs. > - A 3-tuple {Pos, Incr, SaveTo}, where SaveTo is a variable name (e.g. '$1') > - A 5-tuple {Pos, Incr, Threshold, WrapTo, SaveTo} > - The possibility to use, wherever an integer() is expected > VariableName | {UnaryOp, VariableName} | {BinaryOp, Var1, Var2} > > We could also use this to e.g. store a value together with an increment operation. A reset with timestamp: > > TS = timestamp(), % in milliseconds > ets:update_counter(counters, c4, [{2, 0, '$1'}, {2, {'-', '$1'}, {3, 0, '$2'}, {3, {'-', TS, '$2'}}]) > > ?a bit bizarre perhaps, but still. > > Comments? > > BR, > Ulf W > > > Ulf Wiger, Co-founder & Developer Advocate, Feuerlabs Inc. > http://feuerlabs.com > > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions From overminddl1@REDACTED Sun May 11 13:27:50 2014 From: overminddl1@REDACTED (OvermindDL1) Date: Sun, 11 May 2014 05:27:50 -0600 Subject: [erlang-questions] mutable state In-Reply-To: <893BF701-7177-4E91-9FAD-2C1CC5EC1F1F@lovely.email.ne.jp> References: <893BF701-7177-4E91-9FAD-2C1CC5EC1F1F@lovely.email.ne.jp> Message-ID: On May 11, 2014 4:21 AM, "Joseph Wayne Norton" wrote: > > > You can try using a NIF object that acts as an environment for your objects. The NIF object and it's associated terms will be garbage collected when the NIF object is no longer referenced by the Erlang VM. > > There is such a mechanism for an implementation of Scheme on the Erlang VM. > > http://the-concurrent-schemer.github.io/scm-doc/ > http://the-concurrent-schemer.github.io/scm-doc/contributors.html#getting_started > > Try the above getting started link to see an example that uses such a NIF object. The code for the environment resource can be found here: > > https://github.com/the-concurrent-schemer/scm/blob/dev/src/scmi_env.erl > https://github.com/the-concurrent-schemer/scm/blob/dev/c_src/scmi_env.cc > > There is an underlying issue if these NIF objects are long lived with many mutable states ... there is currently no GC for the old values held in the NIF's environment. Mileage will vary! > > > On 2014/05/11, at 16:29, semmit mondo wrote: > > > Hi, > > > > I'm working on a project that tries to bring a mutable state, OO language to the > > BEAM. I believe this isn't impossible, but would like to ask your opinion on how > > to map certain OO constructs to Erlang, and how to bypass immutable state > > constraints. (Yes, I know that this sounds stupid, but that's what I need.) > > > > The fundamentals of that I want to do is to be able to have two references to > > an object, and when I change the object using one of my references, the view of > > the object should change with the other ref. I would like to represent these things > > in Erlang/BEAM as low level as possible. One of my first ideas is that let's use > > Erlang variables (or BEAM registres) to hold a reference to a tuple that represents > > an object. > > > > Ref1 = {object, Class, InstanceVariables}. > > Ref2 = Ref1. > > > > Instancevariables is a dict (gb_tree, of whatever), but the problem is that I just > > can't update the dict without creating a completely new dict and a new tuple. > > So, whatever I do with Ref1, I won't see anything changing with Ref2. Is there > > a way to get out of this trap? I guess the tuple resides on the heap and it consists > > of 3 pointers to it's three members. It I could update the third pointer in that > > tuple, that could solve my problem. Is there somethong like setelement/3, that > > updates an existing tuple in place? I know that this is exactly what Erlang wants > > to avoid, bu again, in order to port other languages to BEAM, at some point I have > > to bypass immutable state somehow. > > > > I know about process dictionaries. That is really a great thing for those who want to > > do something like me. The only problem is that it's only a single dictionary, but I > > need at least one mutable hash/dict per object in order to hold mutable state. > > > > Another ide of mine is to represent object references with unique IDs (just numbers, > > or Refs) in a tuple like {ref, 2763456} or {ref, make_ref()}. This allows me to have > > references to the same object on different places in the code, while I can use the > > process dictionary to hold all my objects by refs as keys. This allows me everything I > > want. The only problem is that this way I lose the ability to use the built-in GC of BEAM. > > Even if I drop all the references to an object, the process dictionary will hold them and > > prevent automatic garbage collection to work for me. My other concern is that there > > can be a very large number of objects and maybe process dictionaries aren't > > designed for this, and therefore they aren't efficient enough for the job. However, > > I don't know about any other way to achieve what I want. > > > > ETS tables looked promising for the first sight, but even having one single ETS table > > per process is something considered a bad practise. So I guess they are not the > > right solution for my problem. > > > > Any idea how can I have an in-place updatable dicts on the heap? Or how to do > > OO object representation better? Are there other things similar to the process > > dictionaries that can hold mutable state? > > > > THX > > > > Why not just represent the objects as an actor per instance, that is what the actor pattern is for, send messages to mutate or query state. _______________________________________________ > > erlang-questions mailing list > > erlang-questions@REDACTED > > http://erlang.org/mailman/listinfo/erlang-questions > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions -------------- next part -------------- An HTML attachment was scrubbed... URL: From sergej.jurecko@REDACTED Sun May 11 13:30:33 2014 From: sergej.jurecko@REDACTED (Sergej Jurecko) Date: Sun, 11 May 2014 13:30:33 +0200 Subject: [erlang-questions] windows multicast In-Reply-To: References: , , <9C7C51F8-3138-419C-B4E3-F0FBF0C1FC6A@gmail.com> Message-ID: <39C004AF-A986-4372-A402-B6D1236171C2@gmail.com> You probably can?t listen on the same port from two erlang instances. Sergej On 11 May 2014, at 13:25, J?rg Maushake wrote: > Thank You for this detailled reply. > Does your windows code work on two nodes started on one machine? > On my machine im still getting eaddrinuse when trying to run the code in two nodes. > I did the following, to verify the code used for windows: > > Mc = {230, 0, 0, 1}, > Src = {192,168,2,101}, > %% 1> inet:getiflist(). > %% {ok,["169.254.82.58","192.168.2.101","127.0.0.1"]} > %% 2> > Opts = [ { active, true }, > { ip, Src }, > { multicast_loop, true }, > { reuseaddr, true }, > list > ], > { ok, RecvSocket } = gen_udp:open (Port, Opts), > inet:setopts(RecvSocket, [{ add_membership, { Mc, Src }}]), > > And it works when starting a node. But when starting another node (on the same maching) im still getting > Address in use: > > !! eaddrinuse > > im using R16B03-1 > > >> Gesendet: Sonntag, 11. Mai 2014 um 07:55 Uhr >> Von: "Sergej Jurecko" >> An: "J?rg Maushake" >> Cc: "Gokhan Boranalp" , Erlang >> Betreff: Re: [erlang-questions] windows multicast >> >> Multicast in erlang is kind of weird. >> I actually have slightly different code for different platforms. This is code from r14 days. I?m not sure if it works any differently now, but I did have issues finding the right combination of parameters to get it to work. Nothing worked universally across all platforms. >> >> Mc = multicast address >> Src = source ip of local interface >> >> Windows: >> {ok, SockSrc} = gen_udp:open(Port, [{reuseaddr,true}, {ip, Src}, {multicast_ttl, 1}, {multicast_loop, false}, binary]), >> inet:setopts(SockSrc, [{add_membership, {Mc, Src}}]); >> >> linux,freebsd: >> >> {ok, SockSrc} = gen_udp:open(Port, [{reuseaddr,true}, {ip, {0,0,0,0}}, {add_membership, {Mc, Src}},{active,true}, binary,{recbuf, 1024*1024}]); >> >> osx: >> >> {ok, SockSrc} = gen_udp:open(Port, [{reuseaddr,true}, {ip, Mc}, {multicast_ttl, 1}, {multicast_loop, false},{recbuf, 1024*1024}, binary]), >> inet:setopts(SockSrc, [{add_membership, {Mc, {0,0,0,0}}}]) >> >> >> Sergej >> >> On 10 May 2014, at 21:37, J?rg Maushake wrote: >> >>> Restarting windows does not change anything. >>> I deployed the code to macbook where it works. >>> It seems to be a windows issue >>> otp_release: R16B03-1 >>> >>> Gesendet: Samstag, 10. Mai 2014 um 17:18 Uhr >>> Von: "Gokhan Boranalp" >>> An: "J?rg Maushake" >>> Cc: Erlang >>> Betreff: Re: [erlang-questions] windows multicast >>> Restart your computer. >>> >>> On Sat, May 10, 2014 at 5:58 PM, "J?rg Maushake" wrote: >>>> Hi list, >>>> I am using erlang on windows 7. >>>> >>>> When i start a multicast (the code is from nodefinder) like so: >>>> Opts = [ { active, true }, >>>> { ip, {230, 0, 0, 1} }, >>>> { add_membership, { {230, 0, 0, 1}, { 0, 0, 0, 0 } } }, >>>> { multicast_loop, true }, >>>> { reuseaddr, true }, >>>> list >>>> ], >>>> { ok, RecvSocket } = gen_udp:open (4321, Opts), >>>> >>>> i get this {error,eaddrnotavail} >>>> >>>> Removing the tuple { ip, {230, 0, 0, 1} } from Opts seems to work! >>>> But when i then start another node on the same machine the error i get is: >>>> {error,eaddrinuse} >>>> >>>> (The multicast group and port works with java ) >>>> >>>> Any suggestions ? >>>> >>>> _______________________________________________ >>>> erlang-questions mailing list >>>> erlang-questions@REDACTED >>>> http://erlang.org/mailman/listinfo/erlang-questions >>>> >>> >>> >>> >>> -- >>> BR, >>> \|/ Kunthar >>> _______________________________________________ >>> erlang-questions mailing list >>> erlang-questions@REDACTED >>> http://erlang.org/mailman/listinfo/erlang-questions >> >> From ulf@REDACTED Sun May 11 13:52:10 2014 From: ulf@REDACTED (Ulf Wiger) Date: Sun, 11 May 2014 13:52:10 +0200 Subject: [erlang-questions] update_counter on steroids In-Reply-To: References: <64245B5A-B63D-4C0C-A62F-80884C696524@feuerlabs.com> Message-ID: Hi Anthony, That?s certainly a function that many erlangers have had to implement over and over. :) And of course, having to write it in Erlang by combining several operation into a non-atomic function introduces some problems of its own. BR, Ulf W On 11 May 2014, at 13:12, Anthony Ramine wrote: > Hello Ulf, > > Not what you asked for, but I implemented ets:update_counter/4 which takes a default value yesterday: > > ets:new(counters, [set,named_table]), > 1 = ets:update_counter(counters, c1, 1, {c1,1}), > 3 = ets:update_counter(counters, c1, 2, {c1,1}), > [{c1,3}] = ets:tab2list(counters). > > Regards, > > https://github.com/erlang/otp/pull/362 > > -- > Anthony Ramine > > Le 7 ao?t 2013 ? 13:39, Ulf Wiger a ?crit : > >> >> There was some discussion recently on teaching update_counter some new tricks. >> >> Here is a suggestion: >> >> Right now, the function takes (Tab, Key, UpOp | [UpOp]), where >> UpOp ::== {Pos, Incr} | {Pos, Incr, Threshold, WrapTo} >> >> I'd like to save the result of an operation in a temporary variable. >> >> An atomic reset, for example. (let's say counter c1 has the value 17): >> >> ets:update_counter(counters, c1, [{2, 0, '$1'}, {2, {'-', '$1'}}]) -> >> [17, 0] >> >> (Increment by 0 means we read the existing value, just like today). >> >> Why use this instead of simply ets:insert/2? Well, for one thing, we get the old value back, so it's an atomic read-reset. >> >> Sum counter: >> >> ets:update_counter(counters, c2, [{2,0,'$1'}, {3,0,'$2'}, {4, {'+', '$1', '$2'}}]) >> >> Wrap with parameterized threshold and reset value: >> >> ets:update_counter(counters, c3, [{3,0,'$1'}, {4,0,'$2'}, {2, Incr, '$1', '$2'}]) >> >> This assumes the following changes: >> >> - A number of temp variables, like in match specs. >> - A 3-tuple {Pos, Incr, SaveTo}, where SaveTo is a variable name (e.g. '$1') >> - A 5-tuple {Pos, Incr, Threshold, WrapTo, SaveTo} >> - The possibility to use, wherever an integer() is expected >> VariableName | {UnaryOp, VariableName} | {BinaryOp, Var1, Var2} >> >> We could also use this to e.g. store a value together with an increment operation. A reset with timestamp: >> >> TS = timestamp(), % in milliseconds >> ets:update_counter(counters, c4, [{2, 0, '$1'}, {2, {'-', '$1'}, {3, 0, '$2'}, {3, {'-', TS, '$2'}}]) >> >> ?a bit bizarre perhaps, but still. >> >> Comments? >> >> BR, >> Ulf W >> >> >> Ulf Wiger, Co-founder & Developer Advocate, Feuerlabs Inc. >> http://feuerlabs.com >> >> >> >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://erlang.org/mailman/listinfo/erlang-questions > Ulf Wiger, Co-founder & Developer Advocate, Feuerlabs Inc. http://feuerlabs.com From joerg.maushake@REDACTED Sun May 11 13:25:52 2014 From: joerg.maushake@REDACTED (=?UTF-8?Q?=22J=C3=B6rg_Maushake=22?=) Date: Sun, 11 May 2014 13:25:52 +0200 Subject: [erlang-questions] windows multicast In-Reply-To: <9C7C51F8-3138-419C-B4E3-F0FBF0C1FC6A@gmail.com> References: , , <9C7C51F8-3138-419C-B4E3-F0FBF0C1FC6A@gmail.com> Message-ID: Thank You for this detailled reply. Does your windows code work on two nodes started on one machine? On my machine im still getting eaddrinuse when trying to run the code in two nodes. I did the following, to verify the code used for windows: Mc = {230, 0, 0, 1}, Src = {192,168,2,101}, %% 1> inet:getiflist(). %% {ok,["169.254.82.58","192.168.2.101","127.0.0.1"]} %% 2> Opts = [ { active, true }, { ip, Src }, { multicast_loop, true }, { reuseaddr, true }, list ], { ok, RecvSocket } = gen_udp:open (Port, Opts), inet:setopts(RecvSocket, [{ add_membership, { Mc, Src }}]), And it works when starting a node. But when starting another node (on the same maching) im still getting Address in use: !! eaddrinuse im using R16B03-1 > Gesendet: Sonntag, 11. Mai 2014 um 07:55 Uhr > Von: "Sergej Jurecko" > An: "J?rg Maushake" > Cc: "Gokhan Boranalp" , Erlang > Betreff: Re: [erlang-questions] windows multicast > > Multicast in erlang is kind of weird. > I actually have slightly different code for different platforms. This is code from r14 days. I?m not sure if it works any differently now, but I did have issues finding the right combination of parameters to get it to work. Nothing worked universally across all platforms. > > Mc = multicast address > Src = source ip of local interface > > Windows: > {ok, SockSrc} = gen_udp:open(Port, [{reuseaddr,true}, {ip, Src}, {multicast_ttl, 1}, {multicast_loop, false}, binary]), > inet:setopts(SockSrc, [{add_membership, {Mc, Src}}]); > > linux,freebsd: > > {ok, SockSrc} = gen_udp:open(Port, [{reuseaddr,true}, {ip, {0,0,0,0}}, {add_membership, {Mc, Src}},{active,true}, binary,{recbuf, 1024*1024}]); > > osx: > > {ok, SockSrc} = gen_udp:open(Port, [{reuseaddr,true}, {ip, Mc}, {multicast_ttl, 1}, {multicast_loop, false},{recbuf, 1024*1024}, binary]), > inet:setopts(SockSrc, [{add_membership, {Mc, {0,0,0,0}}}]) > > > Sergej > > On 10 May 2014, at 21:37, J?rg Maushake wrote: > > > Restarting windows does not change anything. > > I deployed the code to macbook where it works. > > It seems to be a windows issue > > otp_release: R16B03-1 > > > > Gesendet: Samstag, 10. Mai 2014 um 17:18 Uhr > > Von: "Gokhan Boranalp" > > An: "J?rg Maushake" > > Cc: Erlang > > Betreff: Re: [erlang-questions] windows multicast > > Restart your computer. > > > > On Sat, May 10, 2014 at 5:58 PM, "J?rg Maushake" wrote: > > > Hi list, > > > I am using erlang on windows 7. > > > > > > When i start a multicast (the code is from nodefinder) like so: > > > Opts = [ { active, true }, > > > { ip, {230, 0, 0, 1} }, > > > { add_membership, { {230, 0, 0, 1}, { 0, 0, 0, 0 } } }, > > > { multicast_loop, true }, > > > { reuseaddr, true }, > > > list > > > ], > > > { ok, RecvSocket } = gen_udp:open (4321, Opts), > > > > > > i get this {error,eaddrnotavail} > > > > > > Removing the tuple { ip, {230, 0, 0, 1} } from Opts seems to work! > > > But when i then start another node on the same machine the error i get is: > > > {error,eaddrinuse} > > > > > > (The multicast group and port works with java ) > > > > > > Any suggestions ? > > > > > > _______________________________________________ > > > erlang-questions mailing list > > > erlang-questions@REDACTED > > > http://erlang.org/mailman/listinfo/erlang-questions > > > > > > > > > > > -- > > BR, > > \|/ Kunthar > > _______________________________________________ > > erlang-questions mailing list > > erlang-questions@REDACTED > > http://erlang.org/mailman/listinfo/erlang-questions > > From n.oxyde@REDACTED Sun May 11 14:34:17 2014 From: n.oxyde@REDACTED (Anthony Ramine) Date: Sun, 11 May 2014 14:34:17 +0200 Subject: [erlang-questions] update_counter on steroids In-Reply-To: References: <64245B5A-B63D-4C0C-A62F-80884C696524@feuerlabs.com> Message-ID: <9940B1B8-0911-498D-838E-9B48EFBBF77C@gmail.com> Indeed. And now we can have 4-ary BIFs. :p I plan to implement ets:take_all_objects(Table) which would empty out a table and return all its rows. Would you have a use for such a thing too? Regards, -- Anthony Ramine Le 11 mai 2014 ? 13:52, Ulf Wiger a ?crit : > > Hi Anthony, > > That?s certainly a function that many erlangers have had to implement over and over. :) > > And of course, having to write it in Erlang by combining several operation into a non-atomic function introduces some problems of its own. > > BR, > Ulf W > > On 11 May 2014, at 13:12, Anthony Ramine wrote: > >> Hello Ulf, >> >> Not what you asked for, but I implemented ets:update_counter/4 which takes a default value yesterday: >> >> ets:new(counters, [set,named_table]), >> 1 = ets:update_counter(counters, c1, 1, {c1,1}), >> 3 = ets:update_counter(counters, c1, 2, {c1,1}), >> [{c1,3}] = ets:tab2list(counters). >> >> Regards, >> >> https://github.com/erlang/otp/pull/362 >> >> -- >> Anthony Ramine >> >> Le 7 ao?t 2013 ? 13:39, Ulf Wiger a ?crit : >> >>> >>> There was some discussion recently on teaching update_counter some new tricks. >>> >>> Here is a suggestion: >>> >>> Right now, the function takes (Tab, Key, UpOp | [UpOp]), where >>> UpOp ::== {Pos, Incr} | {Pos, Incr, Threshold, WrapTo} >>> >>> I'd like to save the result of an operation in a temporary variable. >>> >>> An atomic reset, for example. (let's say counter c1 has the value 17): >>> >>> ets:update_counter(counters, c1, [{2, 0, '$1'}, {2, {'-', '$1'}}]) -> >>> [17, 0] >>> >>> (Increment by 0 means we read the existing value, just like today). >>> >>> Why use this instead of simply ets:insert/2? Well, for one thing, we get the old value back, so it's an atomic read-reset. >>> >>> Sum counter: >>> >>> ets:update_counter(counters, c2, [{2,0,'$1'}, {3,0,'$2'}, {4, {'+', '$1', '$2'}}]) >>> >>> Wrap with parameterized threshold and reset value: >>> >>> ets:update_counter(counters, c3, [{3,0,'$1'}, {4,0,'$2'}, {2, Incr, '$1', '$2'}]) >>> >>> This assumes the following changes: >>> >>> - A number of temp variables, like in match specs. >>> - A 3-tuple {Pos, Incr, SaveTo}, where SaveTo is a variable name (e.g. '$1') >>> - A 5-tuple {Pos, Incr, Threshold, WrapTo, SaveTo} >>> - The possibility to use, wherever an integer() is expected >>> VariableName | {UnaryOp, VariableName} | {BinaryOp, Var1, Var2} >>> >>> We could also use this to e.g. store a value together with an increment operation. A reset with timestamp: >>> >>> TS = timestamp(), % in milliseconds >>> ets:update_counter(counters, c4, [{2, 0, '$1'}, {2, {'-', '$1'}, {3, 0, '$2'}, {3, {'-', TS, '$2'}}]) >>> >>> ?a bit bizarre perhaps, but still. >>> >>> Comments? >>> >>> BR, >>> Ulf W >>> >>> >>> Ulf Wiger, Co-founder & Developer Advocate, Feuerlabs Inc. >>> http://feuerlabs.com >>> >>> >>> >>> _______________________________________________ >>> erlang-questions mailing list >>> erlang-questions@REDACTED >>> http://erlang.org/mailman/listinfo/erlang-questions >> > > Ulf Wiger, Co-founder & Developer Advocate, Feuerlabs Inc. > http://feuerlabs.com > > > From joerg.maushake@REDACTED Sun May 11 22:27:17 2014 From: joerg.maushake@REDACTED (=?UTF-8?Q?=22J=C3=B6rg_Maushake=22?=) Date: Sun, 11 May 2014 22:27:17 +0200 Subject: [erlang-questions] windows multicast In-Reply-To: <39C004AF-A986-4372-A402-B6D1236171C2@gmail.com> References: , , <9C7C51F8-3138-419C-B4E3-F0FBF0C1FC6A@gmail.com> , <39C004AF-A986-4372-A402-B6D1236171C2@gmail.com> Message-ID: yes with windows (in contrast to osx) multiple nodes calling gen_udp:open targeting one local interface of the machine dont work { reuseaddr, true } seems to be ignored. Is is an erlang bug? The bug: gen_udp:open ignores { reuseaddr, true } under windows Across two windows boxes one node on each works jm > Gesendet: Sonntag, 11. Mai 2014 um 13:30 Uhr > Von: "Sergej Jurecko" > An: "J?rg Maushake" > Cc: "Gokhan Boranalp" , Erlang > Betreff: Re: [erlang-questions] windows multicast > > You probably can?t listen on the same port from two erlang instances. > > Sergej > > On 11 May 2014, at 13:25, J?rg Maushake wrote: > > > Thank You for this detailled reply. > > Does your windows code work on two nodes started on one machine? > > On my machine im still getting eaddrinuse when trying to run the code in two nodes. > > I did the following, to verify the code used for windows: > > > > Mc = {230, 0, 0, 1}, > > Src = {192,168,2,101}, > > %% 1> inet:getiflist(). > > %% {ok,["169.254.82.58","192.168.2.101","127.0.0.1"]} > > %% 2> > > Opts = [ { active, true }, > > { ip, Src }, > > { multicast_loop, true }, > > { reuseaddr, true }, > > list > > ], > > { ok, RecvSocket } = gen_udp:open (Port, Opts), > > inet:setopts(RecvSocket, [{ add_membership, { Mc, Src }}]), > > > > And it works when starting a node. But when starting another node (on the same maching) im still getting > > Address in use: > > > > !! eaddrinuse > > > > im using R16B03-1 > > > > > >> Gesendet: Sonntag, 11. Mai 2014 um 07:55 Uhr > >> Von: "Sergej Jurecko" > >> An: "J?rg Maushake" > >> Cc: "Gokhan Boranalp" , Erlang > >> Betreff: Re: [erlang-questions] windows multicast > >> > >> Multicast in erlang is kind of weird. > >> I actually have slightly different code for different platforms. This is code from r14 days. I?m not sure if it works any differently now, but I did have issues finding the right combination of parameters to get it to work. Nothing worked universally across all platforms. > >> > >> Mc = multicast address > >> Src = source ip of local interface > >> > >> Windows: > >> {ok, SockSrc} = gen_udp:open(Port, [{reuseaddr,true}, {ip, Src}, {multicast_ttl, 1}, {multicast_loop, false}, binary]), > >> inet:setopts(SockSrc, [{add_membership, {Mc, Src}}]); > >> > >> linux,freebsd: > >> > >> {ok, SockSrc} = gen_udp:open(Port, [{reuseaddr,true}, {ip, {0,0,0,0}}, {add_membership, {Mc, Src}},{active,true}, binary,{recbuf, 1024*1024}]); > >> > >> osx: > >> > >> {ok, SockSrc} = gen_udp:open(Port, [{reuseaddr,true}, {ip, Mc}, {multicast_ttl, 1}, {multicast_loop, false},{recbuf, 1024*1024}, binary]), > >> inet:setopts(SockSrc, [{add_membership, {Mc, {0,0,0,0}}}]) > >> > >> > >> Sergej > >> > >> On 10 May 2014, at 21:37, J?rg Maushake wrote: > >> > >>> Restarting windows does not change anything. > >>> I deployed the code to macbook where it works. > >>> It seems to be a windows issue > >>> otp_release: R16B03-1 > >>> > >>> Gesendet: Samstag, 10. Mai 2014 um 17:18 Uhr > >>> Von: "Gokhan Boranalp" > >>> An: "J?rg Maushake" > >>> Cc: Erlang > >>> Betreff: Re: [erlang-questions] windows multicast > >>> Restart your computer. > >>> > >>> On Sat, May 10, 2014 at 5:58 PM, "J?rg Maushake" wrote: > >>>> Hi list, > >>>> I am using erlang on windows 7. > >>>> > >>>> When i start a multicast (the code is from nodefinder) like so: > >>>> Opts = [ { active, true }, > >>>> { ip, {230, 0, 0, 1} }, > >>>> { add_membership, { {230, 0, 0, 1}, { 0, 0, 0, 0 } } }, > >>>> { multicast_loop, true }, > >>>> { reuseaddr, true }, > >>>> list > >>>> ], > >>>> { ok, RecvSocket } = gen_udp:open (4321, Opts), > >>>> > >>>> i get this {error,eaddrnotavail} > >>>> > >>>> Removing the tuple { ip, {230, 0, 0, 1} } from Opts seems to work! > >>>> But when i then start another node on the same machine the error i get is: > >>>> {error,eaddrinuse} > >>>> > >>>> (The multicast group and port works with java ) > >>>> > >>>> Any suggestions ? > >>>> > >>>> _______________________________________________ > >>>> erlang-questions mailing list > >>>> erlang-questions@REDACTED > >>>> http://erlang.org/mailman/listinfo/erlang-questions > >>>> > >>> > >>> > >>> > >>> -- > >>> BR, > >>> \|/ Kunthar > >>> _______________________________________________ > >>> erlang-questions mailing list > >>> erlang-questions@REDACTED > >>> http://erlang.org/mailman/listinfo/erlang-questions > >> > >> > > From ok@REDACTED Mon May 12 00:16:24 2014 From: ok@REDACTED (ok@REDACTED) Date: Mon, 12 May 2014 10:16:24 +1200 Subject: [erlang-questions] mutable state In-Reply-To: References: Message-ID: > Hi, I'm working on a project that tries to bring a mutable state, OO > language to the BEAM. I believe this isn't impossible, but would like > to ask your opinion on how to map certain OO constructs to Erlang, and how > to bypass immutable state constraints. If it were possible for you to do so, you would wreck the garbage collector, which would be a Very Bad Thing. Two obvious things to try are - the (per-)process dictionary - ETS tables. As for the (per-)process dictionary, each Erlang process has what is in effect a hash table mapping immutable values to immutable values. So you could map {Object_Reference, Slot_Name} keys to arbitrary *immutable* values. ETS tables let you do the same thing on a larger scale and visible to multiple processes. > The only problem is > that it's only a single dictionary, but I need at least one mutable > hash/dict per object in order to hold mutable state. No, you don't. You need a replaceable slot per *field*. And {Object_Reference, Field_Name} pairs give you exactly that. And of course using the per-process dictionary does NOT lose you the Erlang GC. Why would it? From ahmad@REDACTED Mon May 12 02:20:02 2014 From: ahmad@REDACTED (Ahmad Baitalmal) Date: Sun, 11 May 2014 17:20:02 -0700 Subject: [erlang-questions] noproc gen_server cowboy Message-ID: Hi, Im going crazy trying to solve this. Works on my Mac, but when I copy to a linux router (OpenWRT, R17, cowboy 0.9.0) it give me the error below. Is this a cowboy or erlang gen_server issue? I tried http, same result. So it's not an ssl issue. I can't tell what the error is... % --------------------- This is my app code that starts cowboy -module(onion_app). -behavior(application). -export([start/2]). -export([stop/0]). -export([stop/1]). -include("common.hrl"). start(_Type, _Args) -> application:start(cowboy), Dispatch = cowboy_router:compile([ {'_', [ {"/", cowboy_static, {priv_file, onion ,"index.html"}}, {"/[...]", cowboy_static, {priv_dir, onion , ""}} ]} ]), RootDir = code:root_dir(), Port = 443, cowboy:start_https(my_https_listener, 10,[ {port, Port}, {certfile, RootDir ++ "/ssl/onion.crt"}, {keyfile, RootDir ++ "/ssl/onion.key"} ], [ {env, [{dispatch, Dispatch}]} ] ) onion_sup:start_link(). stop(_State) -> ok. % --------------------- I'm getting this error :( Exec: /mnt/sda1/onion/erts-6.0/bin/erlexec -boot /mnt/sda1/onion/releases/1/onion -env ERL_LIBS /mnt/sda1/onion/releases/1/lib -config /mnt/sda1/onion/releases/1/sys.config -args_file /mnt/sda1/onion/releases/1/vm.args -- console =INFO REPORT==== 11-May-2014::03:45:55 === application: onion exited: {bad_return, {{onion_app,start,[normal,[]]}, {'EXIT', {noproc, {gen_server,call, [ranch_sup, {start_child, {{ranch_listener_sup,my_https_listener}, {ranch_listener_sup,start_link, [my_https_listener,10,ranch_ssl, [{port,443}, {certfile,"/mnt/sda1/onion/ssl/onion.crt"}, {keyfile,"/mnt/sda1/onion/ssl/onion.key"}], cowboy_protocol, [{env, [{dispatch, [{'_',[], [{[],[],cowboy_static, {priv_file,onion,"index.html"}}, {[<<"tomato">>,'...'],[],tomato,[tomato]}, {['...'], [],cowboy_static, {priv_dir,onion,[]}}]}]}]}]]}, permanent,5000,supervisor, [ranch_listener_sup]}}, infinity]}}}}} type: permanent Eshell V6.0 (abort with ^G) (onion@REDACTED)1> {"Kernel pid terminated",application_controller,"{application_start_failure,onion,{bad_return,{{onion_app,start,[normal,[]]},{'EXIT',{noproc,{gen_server,call,[ranch_sup,{start_child,{{ranch_listener_sup,my_https_listener},{ranch_listener_sup,start_link,[my_https_listener,10,ranch_ssl,[{port,443},{certfile,\"/mnt/sda1/onion/ssl/onion.crt\"},{keyfile,\"/mnt/sda1/onion/ssl/onion.key\"}],cowboy_protocol,[{env,[{dispatch,[{'_',[],[{[],[],cowboy_static,{priv_file,onion,\"index.html\"}},{['...'],[],cowboy_static,{priv_dir,onion,[]}}]}]}]}]]},permanent,5000,supervisor,[ranch_listener_sup]}},infinity]}}}}}}"} Thanks, -- Ahmad ___________ 650.539.9395 Sent from my iPhon -------------- next part -------------- An HTML attachment was scrubbed... URL: From ok@REDACTED Mon May 12 06:59:24 2014 From: ok@REDACTED (ok@REDACTED) Date: Mon, 12 May 2014 16:59:24 +1200 Subject: [erlang-questions] mutable state In-Reply-To: References: Message-ID: <1fd040a33b25267abbcf80d88c44bb82.squirrel@chasm.otago.ac.nz> On second thought, the obvious and natural way to model objects in Erlang is as processes. An object executes loop(Var1, Var2, ..., Varn) -> receive {selector,Arg...} -> do some stuff, loop(Var1', Var2', ..., Varn') ; ... end. This is pretty much what Hewitt's actors did, and pretty much what an early version of Smalltalk did. You get objects with identity and state; you get synchronous and asynchronous message sends; you get *distributed* objects. The one thing you do not get is classes, although delegation is easy to arrange. However, inheritance is simply a way of *writing* OO programs; there doesn't have to be anything analogous to inheritance happening at run time. (Come to think of it, you *could* have classes and inheritance.) From essen@REDACTED Mon May 12 07:32:50 2014 From: essen@REDACTED (=?UTF-8?B?TG/Dr2MgSG9ndWlu?=) Date: Mon, 12 May 2014 07:32:50 +0200 Subject: [erlang-questions] noproc gen_server cowboy In-Reply-To: References: Message-ID: <53705D02.3010207@ninenines.eu> You didn't start the cowboy dependencies, I'm not sure how it could have worked on your Mac. Cowboy requires crypto, cowlib and ranch to be started to run. Try application:ensure_all_started(cowboy) instead and it'll do that for you. On 05/12/2014 02:20 AM, Ahmad Baitalmal wrote: > Hi, > Im going crazy trying to solve this. > > Works on my Mac, but when I copy to a linux router (OpenWRT, R17, cowboy > 0.9.0) it give me the error below. > Is this a cowboy or erlang gen_server issue? > I tried http, same result. So it's not an ssl issue. I can't tell what > the error is... > > > % --------------------- This is my app code that starts cowboy > -module(onion_app). > -behavior(application). > -export([start/2]). > -export([stop/0]). > -export([stop/1]). > -include("common.hrl"). > > start(_Type, _Args) -> > application:start(cowboy), > Dispatch = cowboy_router:compile([ > {'_', [ > {"/", cowboy_static, {priv_file, onion ,"index.html"}}, > {"/[...]", cowboy_static, {priv_dir, onion , ""}} > ]} > ]), > RootDir = code:root_dir(), > Port = 443, > cowboy:start_https(my_https_listener, 10,[ > {port, Port}, > {certfile, RootDir ++ "/ssl/onion.crt"}, > {keyfile, RootDir ++ "/ssl/onion.key"} > ], > [ > {env, [{dispatch, Dispatch}]} > ] > ) > onion_sup:start_link(). > stop(_State) -> > ok. > > > % --------------------- I'm getting this error :( > Exec: /mnt/sda1/onion/erts-6.0/bin/erlexec -boot > /mnt/sda1/onion/releases/1/onion -env ERL_LIBS > /mnt/sda1/onion/releases/1/lib -config > /mnt/sda1/onion/releases/1/sys.config -args_file > /mnt/sda1/onion/releases/1/vm.args -- console > > =INFO REPORT==== 11-May-2014::03:45:55 === > application: onion > exited: {bad_return, > {{onion_app,start,[normal,[]]}, > {'EXIT', > {noproc, > {gen_server,call, > [ranch_sup, > {start_child, > {{ranch_listener_sup,my_https_listener}, > {ranch_listener_sup,start_link, > [my_https_listener,10,ranch_ssl, > [{port,443}, > {certfile,"/mnt/sda1/onion/ssl/onion.crt"}, > {keyfile,"/mnt/sda1/onion/ssl/onion.key"}], > cowboy_protocol, > [{env, > [{dispatch, > [{'_',[], > [{[],[],cowboy_static, > {priv_file,onion,"index.html"}}, > {[<<"tomato">>,'...'],[],tomato,[tomato]}, > {['...'], > [],cowboy_static, > {priv_dir,onion,[]}}]}]}]}]]}, > permanent,5000,supervisor, > [ranch_listener_sup]}}, > infinity]}}}}} > type: permanent > Eshell V6.0 (abort with ^G) > (onion@REDACTED)1> {"Kernel pid > terminated",application_controller,"{application_start_failure,onion,{bad_return,{{onion_app,start,[normal,[]]},{'EXIT',{noproc,{gen_server,call,[ranch_sup,{start_child,{{ranch_listener_sup,my_https_listener},{ranch_listener_sup,start_link,[my_https_listener,10,ranch_ssl,[{port,443},{certfile,\"/mnt/sda1/onion/ssl/onion.crt\"},{keyfile,\"/mnt/sda1/onion/ssl/onion.key\"}],cowboy_protocol,[{env,[{dispatch,[{'_',[],[{[],[],cowboy_static,{priv_file,onion,\"index.html\"}},{['...'],[],cowboy_static,{priv_dir,onion,[]}}]}]}]}]]},permanent,5000,supervisor,[ranch_listener_sup]}},infinity]}}}}}}"} > > > Thanks, > > -- > Ahmad > ___________ > 650.539.9395 > > Sent from my iPhon > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > -- Lo?c Hoguin http://ninenines.eu From Tobias.Schlager@REDACTED Mon May 12 11:04:54 2014 From: Tobias.Schlager@REDACTED (Tobias Schlager) Date: Mon, 12 May 2014 09:04:54 +0000 Subject: [erlang-questions] windows multicast In-Reply-To: References: , , <9C7C51F8-3138-419C-B4E3-F0FBF0C1FC6A@gmail.com> , <39C004AF-A986-4372-A402-B6D1236171C2@gmail.com>, Message-ID: <12F2115FD1CCEE4294943B2608A18FA3011E6E4ECD@MAIL01.win.lbaum.eu> I would not consider this a problem of Erlang. AFAIK, the behaviour of 'SO_REUSEADDR' for UDP sockets is highly OS dependent. If I remember correctly, on Linux, SO_REUSEADDR 'steals' the incoming traffic from the process that previously opened the port. Thus, the previous process will no longer get incoming packets on that port. Regards Tobias ________________________________________ Von: erlang-questions-bounces@REDACTED [erlang-questions-bounces@REDACTED]" im Auftrag von ""J?rg Maushake" [joerg.maushake@REDACTED] Gesendet: Sonntag, 11. Mai 2014 22:27 An: Sergej Jurecko Cc: Erlang Betreff: Re: [erlang-questions] windows multicast yes with windows (in contrast to osx) multiple nodes calling gen_udp:open targeting one local interface of the machine dont work { reuseaddr, true } seems to be ignored. Is is an erlang bug? The bug: gen_udp:open ignores { reuseaddr, true } under windows Across two windows boxes one node on each works jm > Gesendet: Sonntag, 11. Mai 2014 um 13:30 Uhr > Von: "Sergej Jurecko" > An: "J?rg Maushake" > Cc: "Gokhan Boranalp" , Erlang > Betreff: Re: [erlang-questions] windows multicast > > You probably can?t listen on the same port from two erlang instances. > > Sergej > > On 11 May 2014, at 13:25, J?rg Maushake wrote: > > > Thank You for this detailled reply. > > Does your windows code work on two nodes started on one machine? > > On my machine im still getting eaddrinuse when trying to run the code in two nodes. > > I did the following, to verify the code used for windows: > > > > Mc = {230, 0, 0, 1}, > > Src = {192,168,2,101}, > > %% 1> inet:getiflist(). > > %% {ok,["169.254.82.58","192.168.2.101","127.0.0.1"]} > > %% 2> > > Opts = [ { active, true }, > > { ip, Src }, > > { multicast_loop, true }, > > { reuseaddr, true }, > > list > > ], > > { ok, RecvSocket } = gen_udp:open (Port, Opts), > > inet:setopts(RecvSocket, [{ add_membership, { Mc, Src }}]), > > > > And it works when starting a node. But when starting another node (on the same maching) im still getting > > Address in use: > > > > !! eaddrinuse > > > > im using R16B03-1 > > > > > >> Gesendet: Sonntag, 11. Mai 2014 um 07:55 Uhr > >> Von: "Sergej Jurecko" > >> An: "J?rg Maushake" > >> Cc: "Gokhan Boranalp" , Erlang > >> Betreff: Re: [erlang-questions] windows multicast > >> > >> Multicast in erlang is kind of weird. > >> I actually have slightly different code for different platforms. This is code from r14 days. I?m not sure if it works any differently now, but I did have issues finding the right combination of parameters to get it to work. Nothing worked universally across all platforms. > >> > >> Mc = multicast address > >> Src = source ip of local interface > >> > >> Windows: > >> {ok, SockSrc} = gen_udp:open(Port, [{reuseaddr,true}, {ip, Src}, {multicast_ttl, 1}, {multicast_loop, false}, binary]), > >> inet:setopts(SockSrc, [{add_membership, {Mc, Src}}]); > >> > >> linux,freebsd: > >> > >> {ok, SockSrc} = gen_udp:open(Port, [{reuseaddr,true}, {ip, {0,0,0,0}}, {add_membership, {Mc, Src}},{active,true}, binary,{recbuf, 1024*1024}]); > >> > >> osx: > >> > >> {ok, SockSrc} = gen_udp:open(Port, [{reuseaddr,true}, {ip, Mc}, {multicast_ttl, 1}, {multicast_loop, false},{recbuf, 1024*1024}, binary]), > >> inet:setopts(SockSrc, [{add_membership, {Mc, {0,0,0,0}}}]) > >> > >> > >> Sergej > >> > >> On 10 May 2014, at 21:37, J?rg Maushake wrote: > >> > >>> Restarting windows does not change anything. > >>> I deployed the code to macbook where it works. > >>> It seems to be a windows issue > >>> otp_release: R16B03-1 > >>> > >>> Gesendet: Samstag, 10. Mai 2014 um 17:18 Uhr > >>> Von: "Gokhan Boranalp" > >>> An: "J?rg Maushake" > >>> Cc: Erlang > >>> Betreff: Re: [erlang-questions] windows multicast > >>> Restart your computer. > >>> > >>> On Sat, May 10, 2014 at 5:58 PM, "J?rg Maushake" wrote: > >>>> Hi list, > >>>> I am using erlang on windows 7. > >>>> > >>>> When i start a multicast (the code is from nodefinder) like so: > >>>> Opts = [ { active, true }, > >>>> { ip, {230, 0, 0, 1} }, > >>>> { add_membership, { {230, 0, 0, 1}, { 0, 0, 0, 0 } } }, > >>>> { multicast_loop, true }, > >>>> { reuseaddr, true }, > >>>> list > >>>> ], > >>>> { ok, RecvSocket } = gen_udp:open (4321, Opts), > >>>> > >>>> i get this {error,eaddrnotavail} > >>>> > >>>> Removing the tuple { ip, {230, 0, 0, 1} } from Opts seems to work! > >>>> But when i then start another node on the same machine the error i get is: > >>>> {error,eaddrinuse} > >>>> > >>>> (The multicast group and port works with java ) > >>>> > >>>> Any suggestions ? > >>>> > >>>> _______________________________________________ > >>>> erlang-questions mailing list > >>>> erlang-questions@REDACTED > >>>> http://erlang.org/mailman/listinfo/erlang-questions > >>>> > >>> > >>> > >>> > >>> -- > >>> BR, > >>> \|/ Kunthar > >>> _______________________________________________ > >>> erlang-questions mailing list > >>> erlang-questions@REDACTED > >>> http://erlang.org/mailman/listinfo/erlang-questions > >> > >> > > _______________________________________________ erlang-questions mailing list erlang-questions@REDACTED http://erlang.org/mailman/listinfo/erlang-questions From magnus.mueller@REDACTED Mon May 12 09:32:28 2014 From: magnus.mueller@REDACTED (Magnus Mueller) Date: Mon, 12 May 2014 07:32:28 +0000 Subject: [erlang-questions] Vim freezes when I try to close a *.erl file In-Reply-To: <1399349977.185427481@apps.rackspace.com> References: <1399340253.492321699@apps.rackspace.com> <1399349977.185427481@apps.rackspace.com> Message-ID: <468e801d2ba84761a884d01a35bba0ad@DBXPR03MB511.eurprd03.prod.outlook.com> Hey Lloyd, I ran into similar problems with vimerl before, see [1]. The problem was, if I remember it correctly, related to a bug in R16B02 or R16B03, which should be fixed in newer versions. The workaround for vimerl was to comment out `-mode(compile)` in `indent/erlang_indent.erl`. Magnus [1] https://github.com/jimenezrick/vimerl/pull/45 -----Urspr?ngliche Nachricht----- Von: erlang-questions-bounces@REDACTED [mailto:erlang-questions-bounces@REDACTED] Im Auftrag von lloyd@REDACTED Gesendet: Dienstag, 6. Mai 2014 06:20 An: Gokhan Boranalp Cc: Erlang Betreff: Re: [erlang-questions] Vim freezes when I try to close a *.erl file Hi Gokhan, Found it! I deleted .vim and .vimrc and reinstalled vim. I can now edit *.erl files again. Since I had not changed any of my vim plugins (mainly vimerl), it seems likely that either the ubuntu or Erlang upgrades created incompatibilities. Gokhan, if you're ever in my neighborhood, or vice versa, I owe you a couple of rounds. Many thanks, Lloyd -----Original Message----- From: "Gokhan Boranalp" Sent: Monday, May 5, 2014 10:45pm To: "Lloyd Prentice" Cc: "Erlang" Subject: Re: [erlang-questions] Vim freezes when I try to close a *.erl file do you use exuberant-ctags, check twice? did you check file system and disk? do you use any egzotic vim plugins? On Tue, May 6, 2014 at 4:37 AM, wrote: > Hello, > > This is a new one on me. After many moons of faithful service, vim freezes up when it comes to saving *.erl files. No problem with other file extensions. > > I've rebooted, reinstalled vim--- all to no avail. > > Suspicious history: > > 1) Recently updated to Ubuntu 14.04 > 2) Recently started managing Erlang under kerl > 3) Have been playing with Cowboy and websockets > > I've also had problems compiling n2o--- Throws crash-dump on very last step. May or may not be related problem. > > Why only *.erl files? Any thoughts on how to diagnose and fix this problem? > > Many thanks, > > LRP > > > > ********************************************* > My books: > > THE GOSPEL OF ASHES > http://thegospelofashes.com > > Strength is not enough. Do they have the courage and the cunning? Can > they survive long enough to save the lives of millions? > > FREEIN' PANCHO > http://freeinpancho.com > > A community of misfits help a troubled boy find his way > > AYA TAKEO > http://ayatakeo.com > > Star-crossed love, war and power in an alternative universe > > Available through Amazon or by request from your favorite bookstore > > > ********************************************** > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions -- BR, \|/ Kunthar _______________________________________________ erlang-questions mailing list erlang-questions@REDACTED http://erlang.org/mailman/listinfo/erlang-questions From jay@REDACTED Mon May 12 12:47:57 2014 From: jay@REDACTED (Jay Nelson) Date: Mon, 12 May 2014 03:47:57 -0700 Subject: [erlang-questions] update_counter on steroids Message-ID: <3BE96D56-DCE1-4865-AA35-82948015DCE5@duomark.com> Anthony Ramine writes: > I plan to implement ets:take_all_objects(Table) which would empty out a table and return all its rows. Would you have a use for such a thing too? In https://github.com/duomark/epocxy I implement a FIFO queue using array semantics in an ets table in the file ets_buffer.erl. Reading everything in the queue could take advantage of ets:take_all_objects(Table, Key_Pattern). I use metadata tagged entries so that I can have multiple FIFO queues in a single ets table (or an ets table may hold just one queue, but have a single metadata row). For example, an ets_buffer might contain the following rows: {ets_buffer, {meta, my_fifo_queue}, ?} % Meta-info with pointers to FIFO queue {buffer_data, {my_fifo_queue, 15}, timestamp, {mydata, 23}} {buffer_data, {my_fifo_queue, 16}, timestamp, {mydata, 43}} {buffer_data, {my_fifo_queue, 17}, ?} I would want to read all the #buffer_data{key={my_fifo_queue, ?_?}} records and have them removed to return all items in the queue. I use an ordered_set ets table. [ For my case, this will not actually be sufficient, because I would need to reset the pointers in the metadata record and that operation would not be atomic with the take_all, but I suspect this sort of key partitioning is a common occurrence and would be needed in many other situations. ] Off the top of my head though, using an ordered_set ets table as if it were an orddict could be a handy way to sort windows of transactions: 1) Concurrently insert transactions from throughout a server 2) Periodically call ets:take_all_objects Every period you get a sorted set of the transactions that occurred. Things like folsom could probably benefit from this approach. If you insert different types of transactions you would want to apply the match spec pattern trick to the take_all (and could then use different period windows for different transaction types). jay From olivier.boudeville@REDACTED Mon May 12 15:36:54 2014 From: olivier.boudeville@REDACTED (Olivier BOUDEVILLE) Date: Mon, 12 May 2014 15:36:54 +0200 Subject: [erlang-questions] mutable state In-Reply-To: <1fd040a33b25267abbcf80d88c44bb82.squirrel@chasm.otago.ac.nz> References: <1fd040a33b25267abbcf80d88c44bb82.squirrel@chasm.otago.ac.nz> Message-ID: Hello all, Sorry for this shameless plug, but there is at least one option very similar to what is mentioned in the various exchanges: WOOPER ( http://ceylan.sourceforge.net/main/documentation/wooper/). State management, some kind of polymorphism and multiple inheritance are provided. This version is pretty ancient, but we can share more recent versions thereof (still in the 1.x branch) that we use on a daily basis and are rather satisfactory despite their simplicity. Maybe a bit later we will be able to share the versions in the newer WOOPER 2.x branch, based on a parse-transform and maps, adding passive instances (term-based, instead of process-based), featuring attribute and method qualifiers, inheritance-aware build system, a bit of tooling (to generate UML-like diagrams), etc. Hope this helps, Best regards, Olivier. --------------------------- Olivier Boudeville EDF R&D : 1, avenue du G?n?ral de Gaulle, 92140 Clamart, France D?partement SINETICS, groupe ASICS (I2A), bureau B-226 Office : +33 1 47 65 59 58 / Mobile : +33 6 16 83 37 22 / Fax : +33 1 47 65 27 13 ok@REDACTED Envoy? par : erlang-questions-bounces@REDACTED 12/05/2014 07:00 A ok@REDACTED cc erlang-questions@REDACTED Objet Re: [erlang-questions] mutable state On second thought, the obvious and natural way to model objects in Erlang is as processes. An object executes loop(Var1, Var2, ..., Varn) -> receive {selector,Arg...} -> do some stuff, loop(Var1', Var2', ..., Varn') ; ... end. This is pretty much what Hewitt's actors did, and pretty much what an early version of Smalltalk did. You get objects with identity and state; you get synchronous and asynchronous message sends; you get *distributed* objects. The one thing you do not get is classes, although delegation is easy to arrange. However, inheritance is simply a way of *writing* OO programs; there doesn't have to be anything analogous to inheritance happening at run time. (Come to think of it, you *could* have classes and inheritance.) _______________________________________________ erlang-questions mailing list erlang-questions@REDACTED http://erlang.org/mailman/listinfo/erlang-questions Ce message et toutes les pi?ces jointes (ci-apr?s le 'Message') sont ?tablis ? l'intention exclusive des destinataires et les informations qui y figurent sont strictement confidentielles. Toute utilisation de ce Message non conforme ? sa destination, toute diffusion ou toute publication totale ou partielle, est interdite sauf autorisation expresse. Si vous n'?tes pas le destinataire de ce Message, il vous est interdit de le copier, de le faire suivre, de le divulguer ou d'en utiliser tout ou partie. Si vous avez re?u ce Message par erreur, merci de le supprimer de votre syst?me, ainsi que toutes ses copies, et de n'en garder aucune trace sur quelque support que ce soit. Nous vous remercions ?galement d'en avertir imm?diatement l'exp?diteur par retour du message. Il est impossible de garantir que les communications par messagerie ?lectronique arrivent en temps utile, sont s?curis?es ou d?nu?es de toute erreur ou virus. ____________________________________________________ This message and any attachments (the 'Message') are intended solely for the addressees. The information contained in this Message is confidential. Any use of information contained in this Message not in accord with its purpose, any dissemination or disclosure, either whole or partial, is prohibited except formal approval. If you are not the addressee, you may not copy, forward, disclose or use any part of it. If you have received this message in error, please delete it and all copies from your system and notify the sender immediately by return message. E-mail communication cannot be guaranteed to be timely secure, error or virus-free. -------------- next part -------------- An HTML attachment was scrubbed... URL: From lloyd@REDACTED Mon May 12 16:40:48 2014 From: lloyd@REDACTED (lloyd@REDACTED) Date: Mon, 12 May 2014 10:40:48 -0400 (EDT) Subject: [erlang-questions] Vim freezes when I try to close a *.erl file In-Reply-To: <468e801d2ba84761a884d01a35bba0ad@DBXPR03MB511.eurprd03.prod.outlook.com> References: <1399340253.492321699@apps.rackspace.com> <1399349977.185427481@apps.rackspace.com> <468e801d2ba84761a884d01a35bba0ad@DBXPR03MB511.eurprd03.prod.outlook.com> Message-ID: <1399905648.044520367@apps.rackspace.com> Hey, Magnus, I'll give that a try. Maybe I can reinstall vimerl after all. Thank you. All the best, Lloyd -----Original Message----- From: "Magnus Mueller" Sent: Monday, May 12, 2014 3:32am To: "lloyd@REDACTED" Cc: "Erlang" Subject: AW: [erlang-questions] Vim freezes when I try to close a *.erl file Hey Lloyd, I ran into similar problems with vimerl before, see [1]. The problem was, if I remember it correctly, related to a bug in R16B02 or R16B03, which should be fixed in newer versions. The workaround for vimerl was to comment out `-mode(compile)` in `indent/erlang_indent.erl`. Magnus [1] https://github.com/jimenezrick/vimerl/pull/45 -----Urspr?ngliche Nachricht----- Von: erlang-questions-bounces@REDACTED [mailto:erlang-questions-bounces@REDACTED] Im Auftrag von lloyd@REDACTED Gesendet: Dienstag, 6. Mai 2014 06:20 An: Gokhan Boranalp Cc: Erlang Betreff: Re: [erlang-questions] Vim freezes when I try to close a *.erl file Hi Gokhan, Found it! I deleted .vim and .vimrc and reinstalled vim. I can now edit *.erl files again. Since I had not changed any of my vim plugins (mainly vimerl), it seems likely that either the ubuntu or Erlang upgrades created incompatibilities. Gokhan, if you're ever in my neighborhood, or vice versa, I owe you a couple of rounds. Many thanks, Lloyd -----Original Message----- From: "Gokhan Boranalp" Sent: Monday, May 5, 2014 10:45pm To: "Lloyd Prentice" Cc: "Erlang" Subject: Re: [erlang-questions] Vim freezes when I try to close a *.erl file do you use exuberant-ctags, check twice? did you check file system and disk? do you use any egzotic vim plugins? On Tue, May 6, 2014 at 4:37 AM, wrote: > Hello, > > This is a new one on me. After many moons of faithful service, vim freezes up when it comes to saving *.erl files. No problem with other file extensions. > > I've rebooted, reinstalled vim--- all to no avail. > > Suspicious history: > > 1) Recently updated to Ubuntu 14.04 > 2) Recently started managing Erlang under kerl > 3) Have been playing with Cowboy and websockets > > I've also had problems compiling n2o--- Throws crash-dump on very last step. May or may not be related problem. > > Why only *.erl files? Any thoughts on how to diagnose and fix this problem? > > Many thanks, > > LRP > > > > ********************************************* > My books: > > THE GOSPEL OF ASHES > http://thegospelofashes.com > > Strength is not enough. Do they have the courage and the cunning? Can > they survive long enough to save the lives of millions? > > FREEIN' PANCHO > http://freeinpancho.com > > A community of misfits help a troubled boy find his way > > AYA TAKEO > http://ayatakeo.com > > Star-crossed love, war and power in an alternative universe > > Available through Amazon or by request from your favorite bookstore > > > ********************************************** > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions -- BR, \|/ Kunthar _______________________________________________ erlang-questions mailing list erlang-questions@REDACTED http://erlang.org/mailman/listinfo/erlang-questions From eriksoe@REDACTED Mon May 12 16:58:39 2014 From: eriksoe@REDACTED (=?UTF-8?Q?Erik_S=C3=B8e_S=C3=B8rensen?=) Date: Mon, 12 May 2014 16:58:39 +0200 Subject: [erlang-questions] mutable state In-Reply-To: References: Message-ID: It loses the GC in the sense (also explained in the OP) that the GC cannot detect when an object reference is no longer in use and then respond to that by cleaning up the process dictionary. Indeed, while emulating objects with mutable state can be done in a number of ways in Erlang (using process dict / ETS / processes / resource binaries), getting GC into the picture appears to be the trickier part. There is only (afaik) one reference-tracing mechanism in Erlang - the heap GC - and that one works only with immutable state. (Elaborating on what OK said about wrecking the garbage collector by going behind the VM's back and modifying existing tuples etc.: The Erlang GC is a generational GC which takes advantage of the fact that old objects can never refer to younger ones. That invariant makes generational GC easyish to implement, but breaking that invariant would make the VM crashyish.) In short - the question is interesting, but Erlang does not supply GC-for-mutable-objects, so in any case you'd have to bring that - whether a reference-counting or tracing GC. 2014-05-12 0:16 GMT+02:00 : > > Hi, I'm working on a project that tries to bring a mutable state, OO > > language to the BEAM. I believe this isn't impossible, but would > like > > to ask your opinion on how to map certain OO constructs to Erlang, and > how > > to bypass immutable state constraints. > > If it were possible for you to do so, you would wreck the garbage > collector, which would be a Very Bad Thing. > > Two obvious things to try are > - the (per-)process dictionary > - ETS tables. > As for the (per-)process dictionary, each Erlang process > has what is in effect a hash table mapping immutable values > to immutable values. So you could map > {Object_Reference, Slot_Name} keys > to arbitrary *immutable* values. > ETS tables let you do the same thing on a larger scale and > visible to multiple processes. > > The only problem is > > that it's only a single dictionary, but I need at least one mutable > > hash/dict per object in order to hold mutable state. > > No, you don't. You need a replaceable slot per *field*. > And {Object_Reference, Field_Name} pairs give you exactly that. > > And of course using the per-process dictionary does NOT lose you > the Erlang GC. Why would it? > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From roger@REDACTED Mon May 12 17:58:02 2014 From: roger@REDACTED (Roger Lipscombe) Date: Mon, 12 May 2014 16:58:02 +0100 Subject: [erlang-questions] Vim freezes when I try to close a *.erl file In-Reply-To: <1399905648.044520367@apps.rackspace.com> References: <1399340253.492321699@apps.rackspace.com> <1399349977.185427481@apps.rackspace.com> <468e801d2ba84761a884d01a35bba0ad@DBXPR03MB511.eurprd03.prod.outlook.com> <1399905648.044520367@apps.rackspace.com> Message-ID: A data point: I'm using vimerl with gvim 7.3, with Erlang R16B03-1, on Linux Mint and OS X, and I don't recall seeing any problems caused by vimerl hanging. It's worth noting, however, that I'm using syntastic with syntaxerl, rather than vimerl's syntax checker (although this would appear to be unrelated to Magnus's comment about erlang_indent.erl). My vimrc is on github: https://github.com/rlipscombe/vimrc, specifically this bit: " Using syntastic; disable vimerl's syntax checker: let g:erlang_show_errors = 0 " For erlang (not escript) files, tell syntastic to use syntaxerl (which has " to be in $PATH to work). au BufEnter *.erl let b:syntastic_checkers=['syntaxerl'] But, as I say, this is syntax-checking, which might not be your problem... On 12 May 2014 15:40, wrote: > Hey, Magnus, > > I'll give that a try. Maybe I can reinstall vimerl after all. > > Thank you. > > All the best, > > Lloyd > > -----Original Message----- > From: "Magnus Mueller" > Sent: Monday, May 12, 2014 3:32am > To: "lloyd@REDACTED" > Cc: "Erlang" > Subject: AW: [erlang-questions] Vim freezes when I try to close a *.erl file > > Hey Lloyd, > > I ran into similar problems with vimerl before, see [1]. The problem was, if I remember it correctly, related to a bug in R16B02 or R16B03, which should be fixed in newer versions. > > The workaround for vimerl was to comment out `-mode(compile)` in `indent/erlang_indent.erl`. > > Magnus > > [1] https://github.com/jimenezrick/vimerl/pull/45 > > -----Urspr?ngliche Nachricht----- > Von: erlang-questions-bounces@REDACTED [mailto:erlang-questions-bounces@REDACTED] Im Auftrag von lloyd@REDACTED > Gesendet: Dienstag, 6. Mai 2014 06:20 > An: Gokhan Boranalp > Cc: Erlang > Betreff: Re: [erlang-questions] Vim freezes when I try to close a *.erl file > > Hi Gokhan, > > Found it! > > I deleted .vim and .vimrc and reinstalled vim. I can now edit *.erl files again. > > Since I had not changed any of my vim plugins (mainly vimerl), it seems likely that either the ubuntu or Erlang upgrades created incompatibilities. > > Gokhan, if you're ever in my neighborhood, or vice versa, I owe you a couple of rounds. > > Many thanks, > > Lloyd > > -----Original Message----- > From: "Gokhan Boranalp" > Sent: Monday, May 5, 2014 10:45pm > To: "Lloyd Prentice" > Cc: "Erlang" > Subject: Re: [erlang-questions] Vim freezes when I try to close a *.erl file > > do you use exuberant-ctags, check twice? > did you check file system and disk? > do you use any egzotic vim plugins? > > On Tue, May 6, 2014 at 4:37 AM, wrote: >> Hello, >> >> This is a new one on me. After many moons of faithful service, vim freezes up when it comes to saving *.erl files. No problem with other file extensions. >> >> I've rebooted, reinstalled vim--- all to no avail. >> >> Suspicious history: >> >> 1) Recently updated to Ubuntu 14.04 >> 2) Recently started managing Erlang under kerl >> 3) Have been playing with Cowboy and websockets >> >> I've also had problems compiling n2o--- Throws crash-dump on very last step. May or may not be related problem. >> >> Why only *.erl files? Any thoughts on how to diagnose and fix this problem? >> >> Many thanks, >> >> LRP >> >> >> >> ********************************************* >> My books: >> >> THE GOSPEL OF ASHES >> http://thegospelofashes.com >> >> Strength is not enough. Do they have the courage and the cunning? Can >> they survive long enough to save the lives of millions? >> >> FREEIN' PANCHO >> http://freeinpancho.com >> >> A community of misfits help a troubled boy find his way >> >> AYA TAKEO >> http://ayatakeo.com >> >> Star-crossed love, war and power in an alternative universe >> >> Available through Amazon or by request from your favorite bookstore >> >> >> ********************************************** >> >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://erlang.org/mailman/listinfo/erlang-questions > > > > -- > BR, > \|/ Kunthar > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions From roger@REDACTED Mon May 12 18:02:13 2014 From: roger@REDACTED (Roger Lipscombe) Date: Mon, 12 May 2014 17:02:13 +0100 Subject: [erlang-questions] cth_log_redirect crashes with timeout in application_controller? In-Reply-To: <1101725221.522576.1399477491458.JavaMail.zimbra@erlang-solutions.com> References: <1101725221.522576.1399477491458.JavaMail.zimbra@erlang-solutions.com> Message-ID: On 7 May 2014 16:44, Luca Favatella wrote: > ----- Original Message ----- >> On 7 May 2014 16:37, Robert Raschke wrote: > [...] >> > If I remember correctly, I worked around this by explicitly disabling the >> > logging before stopping applications. > [...] I seem to have fixed the problem by one (or possibly both) of two things: 1. explicitly not stopping sasl when shutting down my application. That is: for ensure_all_stopped, I don't stop kernel, stdlib, sasl or lager. 2. I also set {sasl_error_logger, false} in my CT app.config file. From pablo.polvorin@REDACTED Mon May 12 19:55:51 2014 From: pablo.polvorin@REDACTED (Pablo Polvorin) Date: Mon, 12 May 2014 14:55:51 -0300 Subject: [erlang-questions] update_counter on steroids In-Reply-To: <9940B1B8-0911-498D-838E-9B48EFBBF77C@gmail.com> References: <64245B5A-B63D-4C0C-A62F-80884C696524@feuerlabs.com> <9940B1B8-0911-498D-838E-9B48EFBBF77C@gmail.com> Message-ID: On 11 May 2014 09:34, Anthony Ramine wrote: > Indeed. > > And now we can have 4-ary BIFs. :p > > I plan to implement ets:take_all_objects(Table) which would empty out a > table and return all its rows. Would you have a use for such a thing too? > I do. On one system I've a table holding many different counters, that are periodically flushed to an external system. Without the atomic take_all_objects/1, I'm retrieving all and then iterating and subtracting to all keys the values that I've just read.. btw, ets:update_counter/4 with default value will simplify it a lot too, thanks! > > Regards, > > -- > Anthony Ramine > > Le 11 mai 2014 ? 13:52, Ulf Wiger a ?crit : > > > > > Hi Anthony, > > > > That?s certainly a function that many erlangers have had to implement > over and over. :) > > > > And of course, having to write it in Erlang by combining several > operation into a non-atomic function introduces some problems of its own. > > > > BR, > > Ulf W > > > > On 11 May 2014, at 13:12, Anthony Ramine wrote: > > > >> Hello Ulf, > >> > >> Not what you asked for, but I implemented ets:update_counter/4 which > takes a default value yesterday: > >> > >> ets:new(counters, [set,named_table]), > >> 1 = ets:update_counter(counters, c1, 1, {c1,1}), > >> 3 = ets:update_counter(counters, c1, 2, {c1,1}), > >> [{c1,3}] = ets:tab2list(counters). > >> > >> Regards, > >> > >> https://github.com/erlang/otp/pull/362 > >> > >> -- > >> Anthony Ramine > >> > >> Le 7 ao?t 2013 ? 13:39, Ulf Wiger a ?crit : > >> > >>> > >>> There was some discussion recently on teaching update_counter some new > tricks. > >>> > >>> Here is a suggestion: > >>> > >>> Right now, the function takes (Tab, Key, UpOp | [UpOp]), where > >>> UpOp ::== {Pos, Incr} | {Pos, Incr, Threshold, WrapTo} > >>> > >>> I'd like to save the result of an operation in a temporary variable. > >>> > >>> An atomic reset, for example. (let's say counter c1 has the value 17): > >>> > >>> ets:update_counter(counters, c1, [{2, 0, '$1'}, {2, {'-', '$1'}}]) -> > >>> [17, 0] > >>> > >>> (Increment by 0 means we read the existing value, just like today). > >>> > >>> Why use this instead of simply ets:insert/2? Well, for one thing, we > get the old value back, so it's an atomic read-reset. > >>> > >>> Sum counter: > >>> > >>> ets:update_counter(counters, c2, [{2,0,'$1'}, {3,0,'$2'}, {4, {'+', > '$1', '$2'}}]) > >>> > >>> Wrap with parameterized threshold and reset value: > >>> > >>> ets:update_counter(counters, c3, [{3,0,'$1'}, {4,0,'$2'}, {2, Incr, > '$1', '$2'}]) > >>> > >>> This assumes the following changes: > >>> > >>> - A number of temp variables, like in match specs. > >>> - A 3-tuple {Pos, Incr, SaveTo}, where SaveTo is a variable name > (e.g. '$1') > >>> - A 5-tuple {Pos, Incr, Threshold, WrapTo, SaveTo} > >>> - The possibility to use, wherever an integer() is expected > >>> VariableName | {UnaryOp, VariableName} | {BinaryOp, Var1, Var2} > >>> > >>> We could also use this to e.g. store a value together with an > increment operation. A reset with timestamp: > >>> > >>> TS = timestamp(), % in milliseconds > >>> ets:update_counter(counters, c4, [{2, 0, '$1'}, {2, {'-', '$1'}, {3, > 0, '$2'}, {3, {'-', TS, '$2'}}]) > >>> > >>> ?a bit bizarre perhaps, but still. > >>> > >>> Comments? > >>> > >>> BR, > >>> Ulf W > >>> > >>> > >>> Ulf Wiger, Co-founder & Developer Advocate, Feuerlabs Inc. > >>> http://feuerlabs.com > >>> > >>> > >>> > >>> _______________________________________________ > >>> erlang-questions mailing list > >>> erlang-questions@REDACTED > >>> http://erlang.org/mailman/listinfo/erlang-questions > >> > > > > Ulf Wiger, Co-founder & Developer Advocate, Feuerlabs Inc. > > http://feuerlabs.com > > > > > > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > -- Pablo Polvorin ProcessOne -------------- next part -------------- An HTML attachment was scrubbed... URL: From n.oxyde@REDACTED Mon May 12 20:12:06 2014 From: n.oxyde@REDACTED (Anthony Ramine) Date: Mon, 12 May 2014 20:12:06 +0200 Subject: [erlang-questions] update_counter on steroids In-Reply-To: References: <64245B5A-B63D-4C0C-A62F-80884C696524@feuerlabs.com> <9940B1B8-0911-498D-838E-9B48EFBBF77C@gmail.com> Message-ID: <626F30D3-3629-4C8E-AF99-796F85A9A591@gmail.com> Well, it sounds like we are all implementing a statsd-like system of some sort. :) -- Anthony Ramine Le 12 mai 2014 ? 19:55, Pablo Polvorin a ?crit : > I do. On one system I've a table holding many different counters, that are periodically flushed to an external system. Without the atomic take_all_objects/1, I'm retrieving all and then iterating and subtracting to all keys the values that I've just read.. > btw, ets:update_counter/4 with default value will simplify it a lot too, thanks! From trapexit@REDACTED Mon May 12 21:28:15 2014 From: trapexit@REDACTED (Antonio SJ Musumeci) Date: Mon, 12 May 2014 15:28:15 -0400 Subject: [erlang-questions] update_counter on steroids In-Reply-To: <626F30D3-3629-4C8E-AF99-796F85A9A591@gmail.com> References: <64245B5A-B63D-4C0C-A62F-80884C696524@feuerlabs.com> <9940B1B8-0911-498D-838E-9B48EFBBF77C@gmail.com> <626F30D3-3629-4C8E-AF99-796F85A9A591@gmail.com> Message-ID: https://github.com/trapexit/otp/tree/feature/ets_lookup_and_delete https://github.com/trapexit/otp/tree/feature/ets_pop_first_last *https://github.com/trapexit/otp/tree/feature/ets_swap * Similar to the previously mentioned... A while back I worked on these but forgot to try and push them upstream. I thought I had done an a select and delete which returned the values removed but I can't seem to find it. On Mon, May 12, 2014 at 2:12 PM, Anthony Ramine wrote: > Well, it sounds like we are all implementing a statsd-like system of some > sort. :) > > -- > Anthony Ramine > > Le 12 mai 2014 ? 19:55, Pablo Polvorin a > ?crit : > > > I do. On one system I've a table holding many different counters, > that are periodically flushed to an external system. Without the atomic > take_all_objects/1, I'm retrieving all and then iterating and subtracting > to all keys the values that I've just read.. > > btw, ets:update_counter/4 with default value will simplify it a lot > too, thanks! > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From joerg.maushake@REDACTED Mon May 12 21:54:39 2014 From: joerg.maushake@REDACTED (=?UTF-8?Q?=22J=C3=B6rg_Maushake=22?=) Date: Mon, 12 May 2014 21:54:39 +0200 Subject: [erlang-questions] windows multicast In-Reply-To: <12F2115FD1CCEE4294943B2608A18FA3011E6E4ECD@MAIL01.win.lbaum.eu> References: , , <9C7C51F8-3138-419C-B4E3-F0FBF0C1FC6A@gmail.com> , <39C004AF-A986-4372-A402-B6D1236171C2@gmail.com>, , <12F2115FD1CCEE4294943B2608A18FA3011E6E4ECD@MAIL01.win.lbaum.eu> Message-ID: Ok, important to know this, good advice, so the solution needs to deal with those variants > Gesendet: Montag, 12. Mai 2014 um 11:04 Uhr > Von: "Tobias Schlager" > An: Erlang > Betreff: Re: [erlang-questions] windows multicast > > I would not consider this a problem of Erlang. AFAIK, the behaviour of 'SO_REUSEADDR' for UDP sockets is highly OS dependent. > > If I remember correctly, on Linux, SO_REUSEADDR 'steals' the incoming traffic from the process that previously opened the port. Thus, the previous process will no longer get incoming packets on that port. > > Regards > Tobias > > ________________________________________ > Von: erlang-questions-bounces@REDACTED [erlang-questions-bounces@REDACTED]" im Auftrag von ""J?rg Maushake" [joerg.maushake@REDACTED] > Gesendet: Sonntag, 11. Mai 2014 22:27 > An: Sergej Jurecko > Cc: Erlang > Betreff: Re: [erlang-questions] windows multicast > > yes with windows (in contrast to osx) multiple nodes calling gen_udp:open targeting one local interface > of the machine dont work > { reuseaddr, true } seems to be ignored. > > Is is an erlang bug? The bug: gen_udp:open ignores { reuseaddr, true } under windows > > Across two windows boxes one node on each works > jm > > > Gesendet: Sonntag, 11. Mai 2014 um 13:30 Uhr > > Von: "Sergej Jurecko" > > An: "J?rg Maushake" > > Cc: "Gokhan Boranalp" , Erlang > > Betreff: Re: [erlang-questions] windows multicast > > > > You probably can?t listen on the same port from two erlang instances. > > > > Sergej > > > > On 11 May 2014, at 13:25, J?rg Maushake wrote: > > > > > Thank You for this detailled reply. > > > Does your windows code work on two nodes started on one machine? > > > On my machine im still getting eaddrinuse when trying to run the code in two nodes. > > > I did the following, to verify the code used for windows: > > > > > > Mc = {230, 0, 0, 1}, > > > Src = {192,168,2,101}, > > > %% 1> inet:getiflist(). > > > %% {ok,["169.254.82.58","192.168.2.101","127.0.0.1"]} > > > %% 2> > > > Opts = [ { active, true }, > > > { ip, Src }, > > > { multicast_loop, true }, > > > { reuseaddr, true }, > > > list > > > ], > > > { ok, RecvSocket } = gen_udp:open (Port, Opts), > > > inet:setopts(RecvSocket, [{ add_membership, { Mc, Src }}]), > > > > > > And it works when starting a node. But when starting another node (on the same maching) im still getting > > > Address in use: > > > > > > !! eaddrinuse > > > > > > im using R16B03-1 > > > > > > > > >> Gesendet: Sonntag, 11. Mai 2014 um 07:55 Uhr > > >> Von: "Sergej Jurecko" > > >> An: "J?rg Maushake" > > >> Cc: "Gokhan Boranalp" , Erlang > > >> Betreff: Re: [erlang-questions] windows multicast > > >> > > >> Multicast in erlang is kind of weird. > > >> I actually have slightly different code for different platforms. This is code from r14 days. I?m not sure if it works any differently now, but I did have issues finding the right combination of parameters to get it to work. Nothing worked universally across all platforms. > > >> > > >> Mc = multicast address > > >> Src = source ip of local interface > > >> > > >> Windows: > > >> {ok, SockSrc} = gen_udp:open(Port, [{reuseaddr,true}, {ip, Src}, {multicast_ttl, 1}, {multicast_loop, false}, binary]), > > >> inet:setopts(SockSrc, [{add_membership, {Mc, Src}}]); > > >> > > >> linux,freebsd: > > >> > > >> {ok, SockSrc} = gen_udp:open(Port, [{reuseaddr,true}, {ip, {0,0,0,0}}, {add_membership, {Mc, Src}},{active,true}, binary,{recbuf, 1024*1024}]); > > >> > > >> osx: > > >> > > >> {ok, SockSrc} = gen_udp:open(Port, [{reuseaddr,true}, {ip, Mc}, {multicast_ttl, 1}, {multicast_loop, false},{recbuf, 1024*1024}, binary]), > > >> inet:setopts(SockSrc, [{add_membership, {Mc, {0,0,0,0}}}]) > > >> > > >> > > >> Sergej > > >> > > >> On 10 May 2014, at 21:37, J?rg Maushake wrote: > > >> > > >>> Restarting windows does not change anything. > > >>> I deployed the code to macbook where it works. > > >>> It seems to be a windows issue > > >>> otp_release: R16B03-1 > > >>> > > >>> Gesendet: Samstag, 10. Mai 2014 um 17:18 Uhr > > >>> Von: "Gokhan Boranalp" > > >>> An: "J?rg Maushake" > > >>> Cc: Erlang > > >>> Betreff: Re: [erlang-questions] windows multicast > > >>> Restart your computer. > > >>> > > >>> On Sat, May 10, 2014 at 5:58 PM, "J?rg Maushake" wrote: > > >>>> Hi list, > > >>>> I am using erlang on windows 7. > > >>>> > > >>>> When i start a multicast (the code is from nodefinder) like so: > > >>>> Opts = [ { active, true }, > > >>>> { ip, {230, 0, 0, 1} }, > > >>>> { add_membership, { {230, 0, 0, 1}, { 0, 0, 0, 0 } } }, > > >>>> { multicast_loop, true }, > > >>>> { reuseaddr, true }, > > >>>> list > > >>>> ], > > >>>> { ok, RecvSocket } = gen_udp:open (4321, Opts), > > >>>> > > >>>> i get this {error,eaddrnotavail} > > >>>> > > >>>> Removing the tuple { ip, {230, 0, 0, 1} } from Opts seems to work! > > >>>> But when i then start another node on the same machine the error i get is: > > >>>> {error,eaddrinuse} > > >>>> > > >>>> (The multicast group and port works with java ) > > >>>> > > >>>> Any suggestions ? > > >>>> > > >>>> _______________________________________________ > > >>>> erlang-questions mailing list > > >>>> erlang-questions@REDACTED > > >>>> http://erlang.org/mailman/listinfo/erlang-questions > > >>>> > > >>> > > >>> > > >>> > > >>> -- > > >>> BR, > > >>> \|/ Kunthar > > >>> _______________________________________________ > > >>> erlang-questions mailing list > > >>> erlang-questions@REDACTED > > >>> http://erlang.org/mailman/listinfo/erlang-questions > > >> > > >> > > > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > From n.oxyde@REDACTED Mon May 12 22:15:03 2014 From: n.oxyde@REDACTED (Anthony Ramine) Date: Mon, 12 May 2014 22:15:03 +0200 Subject: [erlang-questions] update_counter on steroids In-Reply-To: References: <64245B5A-B63D-4C0C-A62F-80884C696524@feuerlabs.com> <9940B1B8-0911-498D-838E-9B48EFBBF77C@gmail.com> <626F30D3-3629-4C8E-AF99-796F85A9A591@gmail.com> Message-ID: Interesting. By the way, I used the verb ?take? because of lists:keytake/3. -- Anthony Ramine Le 12 mai 2014 ? 21:28, Antonio SJ Musumeci a ?crit : > https://github.com/trapexit/otp/tree/feature/ets_lookup_and_delete From ahmad@REDACTED Tue May 13 01:10:22 2014 From: ahmad@REDACTED (Ahmad Baitalmal) Date: Mon, 12 May 2014 16:10:22 -0700 Subject: [erlang-questions] noproc gen_server cowboy In-Reply-To: <53705D02.3010207@ninenines.eu> References: <53705D02.3010207@ninenines.eu> Message-ID: Thanks Lo?c, It now runs and I can connect. I thought I read somewhere that relx automatically started the related apps. I guess it doesn't always. There is something wrong still, I'm getting this error for all files in the browser. net::ERR_CONTENT_LENGTH_MISMATCH I checked the headers and cowboy is reporting the header "*Content-Length:* 458453399216374" for a file that is only 104K. Could this be a problem with cowboy running on a little-endian machine (mipsel)? Thanks, On Sun, May 11, 2014 at 10:32 PM, Lo?c Hoguin wrote: > You didn't start the cowboy dependencies, I'm not sure how it could have > worked on your Mac. Cowboy requires crypto, cowlib and ranch to be started > to run. Try application:ensure_all_started(cowboy) instead and it'll do > that for you. > > > On 05/12/2014 02:20 AM, Ahmad Baitalmal wrote: > >> Hi, >> Im going crazy trying to solve this. >> >> Works on my Mac, but when I copy to a linux router (OpenWRT, R17, cowboy >> 0.9.0) it give me the error below. >> Is this a cowboy or erlang gen_server issue? >> I tried http, same result. So it's not an ssl issue. I can't tell what >> the error is... >> >> >> % --------------------- This is my app code that starts cowboy >> -module(onion_app). >> -behavior(application). >> -export([start/2]). >> -export([stop/0]). >> -export([stop/1]). >> -include("common.hrl"). >> >> start(_Type, _Args) -> >> application:start(cowboy), >> Dispatch = cowboy_router:compile([ >> {'_', [ >> {"/", cowboy_static, {priv_file, onion ,"index.html"}}, >> {"/[...]", cowboy_static, {priv_dir, onion , ""}} >> ]} >> ]), >> RootDir = code:root_dir(), >> Port = 443, >> cowboy:start_https(my_https_listener, 10,[ >> {port, Port}, >> {certfile, RootDir ++ "/ssl/onion.crt"}, >> {keyfile, RootDir ++ "/ssl/onion.key"} >> ], >> [ >> {env, [{dispatch, Dispatch}]} >> ] >> ) >> onion_sup:start_link(). >> stop(_State) -> >> ok. >> >> >> % --------------------- I'm getting this error :( >> Exec: /mnt/sda1/onion/erts-6.0/bin/erlexec -boot >> /mnt/sda1/onion/releases/1/onion -env ERL_LIBS >> /mnt/sda1/onion/releases/1/lib -config >> /mnt/sda1/onion/releases/1/sys.config -args_file >> /mnt/sda1/onion/releases/1/vm.args -- console >> >> =INFO REPORT==== 11-May-2014::03:45:55 === >> application: onion >> exited: {bad_return, >> {{onion_app,start,[normal,[]]}, >> {'EXIT', >> {noproc, >> {gen_server,call, >> [ranch_sup, >> {start_child, >> {{ranch_listener_sup,my_https_listener}, >> {ranch_listener_sup,start_link, >> [my_https_listener,10,ranch_ssl, >> [{port,443}, >> {certfile,"/mnt/sda1/onion/ssl/onion.crt"}, >> {keyfile,"/mnt/sda1/onion/ssl/onion.key"}], >> cowboy_protocol, >> [{env, >> [{dispatch, >> [{'_',[], >> [{[],[],cowboy_static, >> {priv_file,onion,"index.html"}}, >> {[<<"tomato">>,'...'],[],tomato,[tomato]}, >> {['...'], >> [],cowboy_static, >> {priv_dir,onion,[]}}]}]}]}]]}, >> permanent,5000,supervisor, >> [ranch_listener_sup]}}, >> infinity]}}}}} >> type: permanent >> Eshell V6.0 (abort with ^G) >> (onion@REDACTED)1> {"Kernel pid >> terminated",application_controller,"{application_ >> start_failure,onion,{bad_return,{{onion_app,start,[ >> normal,[]]},{'EXIT',{noproc,{gen_server,call,[ranch_sup,{ >> start_child,{{ranch_listener_sup,my_https_listener},{ranch_ >> listener_sup,start_link,[my_https_listener,10,ranch_ssl,[{ >> port,443},{certfile,\"/mnt/sda1/onion/ssl/onion.crt\"},{ >> keyfile,\"/mnt/sda1/onion/ssl/onion.key\"}],cowboy_protocol, >> [{env,[{dispatch,[{'_',[],[{[],[],cowboy_static,{priv_file, >> onion,\"index.html\"}},{['...'],[],cowboy_static,{priv_dir, >> onion,[]}}]}]}]}]]},permanent,5000,supervisor,[ranch_ >> listener_sup]}},infinity]}}}}}}"} >> >> >> Thanks, >> >> -- >> Ahmad >> ___________ >> 650.539.9395 >> >> Sent from my iPhon >> >> >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://erlang.org/mailman/listinfo/erlang-questions >> >> > -- > Lo?c Hoguin > http://ninenines.eu > -- Ahmad ___________ 650.539.9395 Sent from my iPhone -------------- next part -------------- An HTML attachment was scrubbed... URL: From zxq9@REDACTED Mon May 12 14:48:38 2014 From: zxq9@REDACTED (zxq9) Date: Mon, 12 May 2014 21:48:38 +0900 Subject: [erlang-questions] mutable state In-Reply-To: <1fd040a33b25267abbcf80d88c44bb82.squirrel@chasm.otago.ac.nz> References: <1fd040a33b25267abbcf80d88c44bb82.squirrel@chasm.otago.ac.nz> Message-ID: <11783043.CtGqJ09BQc@jalapeno> On Monday 12 May 2014 16:59:24 ok@REDACTED wrote: > On second thought, the obvious and natural way to model > objects in Erlang is as processes. > > An object executes > > loop(Var1, Var2, ..., Varn) -> > receive > {selector,Arg...} -> > do some stuff, > loop(Var1', Var2', ..., Varn') > ; ... > end. > > This is pretty much what Hewitt's actors did, and pretty much > what an early version of Smalltalk did. > > You get objects with identity and state; you get synchronous > and asynchronous message sends; you get *distributed* objects. > The one thing you do not get is classes, although delegation is > easy to arrange. > > However, inheritance is simply a way of *writing* OO programs; > there doesn't have to be anything analogous to inheritance > happening at run time. > > (Come to think of it, you *could* have classes and inheritance.) Considering that a C++/Java style class is a higher-order function that returns a struct of functions, basic types and pointers to other structs (with a bit of syntactic sugar to very lightly abstract this fact away and a truckload of marketing rhetoric to make it seem more special than it is), and that Alan Kay's definition of "Object-Oriented" was something he hoped would eventually include every object getting its own address (even URL and/or IP address!)... it is hard for me to feel that the typical crop of "OOP" languages aren't actually a special category of syntactially contorted functional languages, and that Erlang is in fact one of the extremely rare truly Object Oriented ones (by Kay's original definition, not, say, Gosling's). Oddly, ever since I realized this I've become better at languages like Python and Java, don't mentally shutdown when I read C that implements C++-style OOP, and now can more quickly identify situations where Erlang is either The Right Thing or a mental minefield. All that said, I really think the OP is barking up the wrong tree, trying to force something that already does what he wants to do it in the way he thinks it should rather than the way it was designed. It reminds me of attempts I periodically come across at things like implementing type-inference systems within Python frameworks or writing an entire imperative program within a single huge I/O monad in Haskell. From Tobias.Schlager@REDACTED Tue May 13 09:08:37 2014 From: Tobias.Schlager@REDACTED (Tobias Schlager) Date: Tue, 13 May 2014 07:08:37 +0000 Subject: [erlang-questions] windows multicast In-Reply-To: References: , , <9C7C51F8-3138-419C-B4E3-F0FBF0C1FC6A@gmail.com> , <39C004AF-A986-4372-A402-B6D1236171C2@gmail.com>, , <12F2115FD1CCEE4294943B2608A18FA3011E6E4ECD@MAIL01.win.lbaum.eu>, Message-ID: <12F2115FD1CCEE4294943B2608A18FA3011E6E6003@MAIL01.win.lbaum.eu> If you're looking for a UDP-based tool to discover and connect nodes (multicast/broadcast) you might find this one useful https://github.com/schlagert/bootstrap It is able to handle multiple nodes per host. Regards Tobias ________________________________________ Von: "J?rg Maushake" [joerg.maushake@REDACTED] Gesendet: Montag, 12. Mai 2014 21:54 An: Tobias Schlager Cc: Erlang Betreff: Aw: Re: [erlang-questions] windows multicast Ok, important to know this, good advice, so the solution needs to deal with those variants > Gesendet: Montag, 12. Mai 2014 um 11:04 Uhr > Von: "Tobias Schlager" > An: Erlang > Betreff: Re: [erlang-questions] windows multicast > > I would not consider this a problem of Erlang. AFAIK, the behaviour of 'SO_REUSEADDR' for UDP sockets is highly OS dependent. > > If I remember correctly, on Linux, SO_REUSEADDR 'steals' the incoming traffic from the process that previously opened the port. Thus, the previous process will no longer get incoming packets on that port. > > Regards > Tobias > > ________________________________________ > Von: erlang-questions-bounces@REDACTED [erlang-questions-bounces@REDACTED]" im Auftrag von ""J?rg Maushake" [joerg.maushake@REDACTED] > Gesendet: Sonntag, 11. Mai 2014 22:27 > An: Sergej Jurecko > Cc: Erlang > Betreff: Re: [erlang-questions] windows multicast > > yes with windows (in contrast to osx) multiple nodes calling gen_udp:open targeting one local interface > of the machine dont work > { reuseaddr, true } seems to be ignored. > > Is is an erlang bug? The bug: gen_udp:open ignores { reuseaddr, true } under windows > > Across two windows boxes one node on each works > jm > > > Gesendet: Sonntag, 11. Mai 2014 um 13:30 Uhr > > Von: "Sergej Jurecko" > > An: "J?rg Maushake" > > Cc: "Gokhan Boranalp" , Erlang > > Betreff: Re: [erlang-questions] windows multicast > > > > You probably can?t listen on the same port from two erlang instances. > > > > Sergej > > > > On 11 May 2014, at 13:25, J?rg Maushake wrote: > > > > > Thank You for this detailled reply. > > > Does your windows code work on two nodes started on one machine? > > > On my machine im still getting eaddrinuse when trying to run the code in two nodes. > > > I did the following, to verify the code used for windows: > > > > > > Mc = {230, 0, 0, 1}, > > > Src = {192,168,2,101}, > > > %% 1> inet:getiflist(). > > > %% {ok,["169.254.82.58","192.168.2.101","127.0.0.1"]} > > > %% 2> > > > Opts = [ { active, true }, > > > { ip, Src }, > > > { multicast_loop, true }, > > > { reuseaddr, true }, > > > list > > > ], > > > { ok, RecvSocket } = gen_udp:open (Port, Opts), > > > inet:setopts(RecvSocket, [{ add_membership, { Mc, Src }}]), > > > > > > And it works when starting a node. But when starting another node (on the same maching) im still getting > > > Address in use: > > > > > > !! eaddrinuse > > > > > > im using R16B03-1 > > > > > > > > >> Gesendet: Sonntag, 11. Mai 2014 um 07:55 Uhr > > >> Von: "Sergej Jurecko" > > >> An: "J?rg Maushake" > > >> Cc: "Gokhan Boranalp" , Erlang > > >> Betreff: Re: [erlang-questions] windows multicast > > >> > > >> Multicast in erlang is kind of weird. > > >> I actually have slightly different code for different platforms. This is code from r14 days. I?m not sure if it works any differently now, but I did have issues finding the right combination of parameters to get it to work. Nothing worked universally across all platforms. > > >> > > >> Mc = multicast address > > >> Src = source ip of local interface > > >> > > >> Windows: > > >> {ok, SockSrc} = gen_udp:open(Port, [{reuseaddr,true}, {ip, Src}, {multicast_ttl, 1}, {multicast_loop, false}, binary]), > > >> inet:setopts(SockSrc, [{add_membership, {Mc, Src}}]); > > >> > > >> linux,freebsd: > > >> > > >> {ok, SockSrc} = gen_udp:open(Port, [{reuseaddr,true}, {ip, {0,0,0,0}}, {add_membership, {Mc, Src}},{active,true}, binary,{recbuf, 1024*1024}]); > > >> > > >> osx: > > >> > > >> {ok, SockSrc} = gen_udp:open(Port, [{reuseaddr,true}, {ip, Mc}, {multicast_ttl, 1}, {multicast_loop, false},{recbuf, 1024*1024}, binary]), > > >> inet:setopts(SockSrc, [{add_membership, {Mc, {0,0,0,0}}}]) > > >> > > >> > > >> Sergej > > >> > > >> On 10 May 2014, at 21:37, J?rg Maushake wrote: > > >> > > >>> Restarting windows does not change anything. > > >>> I deployed the code to macbook where it works. > > >>> It seems to be a windows issue > > >>> otp_release: R16B03-1 > > >>> > > >>> Gesendet: Samstag, 10. Mai 2014 um 17:18 Uhr > > >>> Von: "Gokhan Boranalp" > > >>> An: "J?rg Maushake" > > >>> Cc: Erlang > > >>> Betreff: Re: [erlang-questions] windows multicast > > >>> Restart your computer. > > >>> > > >>> On Sat, May 10, 2014 at 5:58 PM, "J?rg Maushake" wrote: > > >>>> Hi list, > > >>>> I am using erlang on windows 7. > > >>>> > > >>>> When i start a multicast (the code is from nodefinder) like so: > > >>>> Opts = [ { active, true }, > > >>>> { ip, {230, 0, 0, 1} }, > > >>>> { add_membership, { {230, 0, 0, 1}, { 0, 0, 0, 0 } } }, > > >>>> { multicast_loop, true }, > > >>>> { reuseaddr, true }, > > >>>> list > > >>>> ], > > >>>> { ok, RecvSocket } = gen_udp:open (4321, Opts), > > >>>> > > >>>> i get this {error,eaddrnotavail} > > >>>> > > >>>> Removing the tuple { ip, {230, 0, 0, 1} } from Opts seems to work! > > >>>> But when i then start another node on the same machine the error i get is: > > >>>> {error,eaddrinuse} > > >>>> > > >>>> (The multicast group and port works with java ) > > >>>> > > >>>> Any suggestions ? > > >>>> > > >>>> _______________________________________________ > > >>>> erlang-questions mailing list > > >>>> erlang-questions@REDACTED > > >>>> http://erlang.org/mailman/listinfo/erlang-questions > > >>>> > > >>> > > >>> > > >>> > > >>> -- > > >>> BR, > > >>> \|/ Kunthar > > >>> _______________________________________________ > > >>> erlang-questions mailing list > > >>> erlang-questions@REDACTED > > >>> http://erlang.org/mailman/listinfo/erlang-questions > > >> > > >> > > > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > From eriksoe@REDACTED Tue May 13 09:42:17 2014 From: eriksoe@REDACTED (=?UTF-8?Q?Erik_S=C3=B8e_S=C3=B8rensen?=) Date: Tue, 13 May 2014 09:42:17 +0200 Subject: [erlang-questions] mutable state In-Reply-To: <11783043.CtGqJ09BQc@jalapeno> References: <1fd040a33b25267abbcf80d88c44bb82.squirrel@chasm.otago.ac.nz> <11783043.CtGqJ09BQc@jalapeno> Message-ID: I agree. The question, as so often before, is: what do you *really* want to achieve? As they say, you can write COBOL in any language. And perhaps it is possible to implement a tracing garbage collector on top of Erlang so as to get objects with mutable state. But it would be wise to address the deeper "why?" in earnest before you do so. Den 13/05/2014 05.50 skrev "zxq9" : > On Monday 12 May 2014 16:59:24 ok@REDACTED wrote: > > On second thought, the obvious and natural way to model > > objects in Erlang is as processes. > > > > An object executes > > > > loop(Var1, Var2, ..., Varn) -> > > receive > > {selector,Arg...} -> > > do some stuff, > > loop(Var1', Var2', ..., Varn') > > ; ... > > end. > > > > This is pretty much what Hewitt's actors did, and pretty much > > what an early version of Smalltalk did. > > > > You get objects with identity and state; you get synchronous > > and asynchronous message sends; you get *distributed* objects. > > The one thing you do not get is classes, although delegation is > > easy to arrange. > > > > However, inheritance is simply a way of *writing* OO programs; > > there doesn't have to be anything analogous to inheritance > > happening at run time. > > > > (Come to think of it, you *could* have classes and inheritance.) > > Considering that a C++/Java style class is a higher-order function that > returns a struct of functions, basic types and pointers to other structs > (with > a bit of syntactic sugar to very lightly abstract this fact away and a > truckload of marketing rhetoric to make it seem more special than it is), > and > that Alan Kay's definition of "Object-Oriented" was something he hoped > would > eventually include every object getting its own address (even URL and/or IP > address!)... it is hard for me to feel that the typical crop of "OOP" > languages aren't actually a special category of syntactially contorted > functional languages, and that Erlang is in fact one of the extremely rare > truly Object Oriented ones (by Kay's original definition, not, say, > Gosling's). > > Oddly, ever since I realized this I've become better at languages like > Python > and Java, don't mentally shutdown when I read C that implements C++-style > OOP, > and now can more quickly identify situations where Erlang is either The > Right > Thing or a mental minefield. > > All that said, I really think the OP is barking up the wrong tree, trying > to > force something that already does what he wants to do it in the way he > thinks > it should rather than the way it was designed. It reminds me of attempts I > periodically come across at things like implementing type-inference systems > within Python frameworks or writing an entire imperative program within a > single huge I/O monad in Haskell. > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From eriksoe@REDACTED Tue May 13 10:13:28 2014 From: eriksoe@REDACTED (=?UTF-8?Q?Erik_S=C3=B8e_S=C3=B8rensen?=) Date: Tue, 13 May 2014 10:13:28 +0200 Subject: [erlang-questions] noproc gen_server cowboy In-Reply-To: References: <53705D02.3010207@ninenines.eu> Message-ID: It's not just a reverse-endian'ed size... 458453399216374 = 0x'0001'A0F6'0001'A0F6 -- weird duplication... (0x1A0F6 = 106742 = 104.2KB, so that part fits.) 2014-05-13 1:10 GMT+02:00 Ahmad Baitalmal : > Thanks Lo?c, > > It now runs and I can connect. I thought I read somewhere that relx > automatically started the related apps. I guess it doesn't always. > > There is something wrong still, I'm getting this error for all files in > the browser. > net::ERR_CONTENT_LENGTH_MISMATCH > > I checked the headers and cowboy is reporting the header " > *Content-Length:* 458453399216374" for a file that is only 104K. > > Could this be a problem with cowboy running on a little-endian machine > (mipsel)? > > Thanks, > > > On Sun, May 11, 2014 at 10:32 PM, Lo?c Hoguin wrote: > >> You didn't start the cowboy dependencies, I'm not sure how it could have >> worked on your Mac. Cowboy requires crypto, cowlib and ranch to be started >> to run. Try application:ensure_all_started(cowboy) instead and it'll do >> that for you. >> >> >> On 05/12/2014 02:20 AM, Ahmad Baitalmal wrote: >> >>> Hi, >>> Im going crazy trying to solve this. >>> >>> Works on my Mac, but when I copy to a linux router (OpenWRT, R17, cowboy >>> 0.9.0) it give me the error below. >>> Is this a cowboy or erlang gen_server issue? >>> I tried http, same result. So it's not an ssl issue. I can't tell what >>> the error is... >>> >>> >>> % --------------------- This is my app code that starts cowboy >>> -module(onion_app). >>> -behavior(application). >>> -export([start/2]). >>> -export([stop/0]). >>> -export([stop/1]). >>> -include("common.hrl"). >>> >>> start(_Type, _Args) -> >>> application:start(cowboy), >>> Dispatch = cowboy_router:compile([ >>> {'_', [ >>> {"/", cowboy_static, {priv_file, onion ,"index.html"}}, >>> {"/[...]", cowboy_static, {priv_dir, onion , ""}} >>> ]} >>> ]), >>> RootDir = code:root_dir(), >>> Port = 443, >>> cowboy:start_https(my_https_listener, 10,[ >>> {port, Port}, >>> {certfile, RootDir ++ "/ssl/onion.crt"}, >>> {keyfile, RootDir ++ "/ssl/onion.key"} >>> ], >>> [ >>> {env, [{dispatch, Dispatch}]} >>> ] >>> ) >>> onion_sup:start_link(). >>> stop(_State) -> >>> ok. >>> >>> >>> % --------------------- I'm getting this error :( >>> Exec: /mnt/sda1/onion/erts-6.0/bin/erlexec -boot >>> /mnt/sda1/onion/releases/1/onion -env ERL_LIBS >>> /mnt/sda1/onion/releases/1/lib -config >>> /mnt/sda1/onion/releases/1/sys.config -args_file >>> /mnt/sda1/onion/releases/1/vm.args -- console >>> >>> =INFO REPORT==== 11-May-2014::03:45:55 === >>> application: onion >>> exited: {bad_return, >>> {{onion_app,start,[normal,[]]}, >>> {'EXIT', >>> {noproc, >>> {gen_server,call, >>> [ranch_sup, >>> {start_child, >>> {{ranch_listener_sup,my_https_listener}, >>> {ranch_listener_sup,start_link, >>> [my_https_listener,10,ranch_ssl, >>> [{port,443}, >>> {certfile,"/mnt/sda1/onion/ssl/onion.crt"}, >>> {keyfile,"/mnt/sda1/onion/ssl/onion.key"}], >>> cowboy_protocol, >>> [{env, >>> [{dispatch, >>> [{'_',[], >>> [{[],[],cowboy_static, >>> {priv_file,onion,"index.html"}}, >>> {[<<"tomato">>,'...'],[],tomato,[tomato]}, >>> {['...'], >>> [],cowboy_static, >>> {priv_dir,onion,[]}}]}]}]}]]}, >>> permanent,5000,supervisor, >>> [ranch_listener_sup]}}, >>> infinity]}}}}} >>> type: permanent >>> Eshell V6.0 (abort with ^G) >>> (onion@REDACTED)1> {"Kernel pid >>> terminated",application_controller,"{application_ >>> start_failure,onion,{bad_return,{{onion_app,start,[ >>> normal,[]]},{'EXIT',{noproc,{gen_server,call,[ranch_sup,{ >>> start_child,{{ranch_listener_sup,my_https_listener},{ranch_ >>> listener_sup,start_link,[my_https_listener,10,ranch_ssl,[{ >>> port,443},{certfile,\"/mnt/sda1/onion/ssl/onion.crt\"},{ >>> keyfile,\"/mnt/sda1/onion/ssl/onion.key\"}],cowboy_protocol, >>> [{env,[{dispatch,[{'_',[],[{[],[],cowboy_static,{priv_file, >>> onion,\"index.html\"}},{['...'],[],cowboy_static,{priv_dir, >>> onion,[]}}]}]}]}]]},permanent,5000,supervisor,[ranch_ >>> listener_sup]}},infinity]}}}}}}"} >>> >>> >>> Thanks, >>> >>> -- >>> Ahmad >>> ___________ >>> 650.539.9395 >>> >>> Sent from my iPhon >>> >>> >>> _______________________________________________ >>> erlang-questions mailing list >>> erlang-questions@REDACTED >>> http://erlang.org/mailman/listinfo/erlang-questions >>> >>> >> -- >> Lo?c Hoguin >> http://ninenines.eu >> > > > > -- > Ahmad > ___________ > 650.539.9395 > > Sent from my iPhone > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From schneider@REDACTED Tue May 13 14:16:06 2014 From: schneider@REDACTED (Schneider) Date: Tue, 13 May 2014 14:16:06 +0200 Subject: [erlang-questions] application:start() works but -s command line switch crashes Message-ID: <000001cf6ea5$1e2f0190$5a8d04b0$@nl> Hi list, Starting my application from the command line with -s gives an error $ erl -sname rpi2 -pa ebin/ -pa deps/*/ebin/ -s othost Erlang/OTP 17 [erts-6.0] [source-07b8f44] [async-threads:10] [kernel-poll:false] {"init terminating in do_boot",{undef,[{othost,start,[],[]},{init,start_it,1,[]},{init,start_em,1, []}]}} Crash dump was written to: erl_crash.dump init terminating in do_boot () Starting the application like this works fine: $ erl -sname rpi2 -pa ebin/ -pa deps/*/ebin/ Erlang/OTP 17 [erts-6.0] [source-07b8f44] [async-threads:10] [kernel-poll:false] Eshell V6.0 (abort with ^G) (rpi2@REDACTED)1> application:start(othost). What is going wrong here? Thanks Frans -------------- next part -------------- An HTML attachment was scrubbed... URL: From Tobias.Schlager@REDACTED Tue May 13 14:20:55 2014 From: Tobias.Schlager@REDACTED (Tobias Schlager) Date: Tue, 13 May 2014 12:20:55 +0000 Subject: [erlang-questions] application:start() works but -s command line switch crashes In-Reply-To: <000001cf6ea5$1e2f0190$5a8d04b0$@nl> References: <000001cf6ea5$1e2f0190$5a8d04b0$@nl> Message-ID: <12F2115FD1CCEE4294943B2608A18FA3011E6E6098@MAIL01.win.lbaum.eu> Your module doesn't seem to export the function start/0? Be aware of the fact, that '-s othost' calls 'othost:start()' not 'application:start(othost)'. Regards Tobias ________________________________ Von: erlang-questions-bounces@REDACTED [erlang-questions-bounces@REDACTED]" im Auftrag von "Schneider [schneider@REDACTED] Gesendet: Dienstag, 13. Mai 2014 14:16 An: erlang-questions@REDACTED Betreff: [erlang-questions] application:start() works but -s command line switch crashes Hi list, Starting my application from the command line with ?s gives an error $ erl -sname rpi2 -pa ebin/ -pa deps/*/ebin/ -s othost Erlang/OTP 17 [erts-6.0] [source-07b8f44] [async-threads:10] [kernel-poll:false] {"init terminating in do_boot",{undef,[{othost,start,[],[]},{init,start_it,1,[]},{init,start_em,1,[]}]}} Crash dump was written to: erl_crash.dump init terminating in do_boot () Starting the application like this works fine: $ erl -sname rpi2 -pa ebin/ -pa deps/*/ebin/ Erlang/OTP 17 [erts-6.0] [source-07b8f44] [async-threads:10] [kernel-poll:false] Eshell V6.0 (abort with ^G) (rpi2@REDACTED)1> application:start(othost). What is going wrong here? Thanks Frans -------------- next part -------------- An HTML attachment was scrubbed... URL: From bengt.kleberg@REDACTED Tue May 13 14:25:11 2014 From: bengt.kleberg@REDACTED (Bengt Kleberg) Date: Tue, 13 May 2014 14:25:11 +0200 Subject: [erlang-questions] application:start() works but -s command line switch crashes In-Reply-To: <000001cf6ea5$1e2f0190$5a8d04b0$@nl> References: <000001cf6ea5$1e2f0190$5a8d04b0$@nl> Message-ID: <1399983912.4639.9.camel@sekic1152.rnd.ki.sw.ericsson.se> Greetings, "-s mod" is for mod:start/0, not the argument to application:start/1. bengt On Tue, 2014-05-13 at 14:16 +0200, Schneider wrote: > Hi list, > > > > Starting my application from the command line with ?s gives an error > > > > $ erl -sname rpi2 -pa ebin/ -pa deps/*/ebin/ -s othost > > Erlang/OTP 17 [erts-6.0] [source-07b8f44] [async-threads:10] > [kernel-poll:false] > > > > {"init terminating in > do_boot",{undef,[{othost,start,[],[]},{init,start_it,1,[]},{init,start_em,1,[]}]}} > > > > Crash dump was written to: erl_crash.dump > > init terminating in do_boot () > > > > Starting the application like this works fine: > > > > $ erl -sname rpi2 -pa ebin/ -pa deps/*/ebin/ > > Erlang/OTP 17 [erts-6.0] [source-07b8f44] [async-threads:10] > [kernel-poll:false] > > > > Eshell V6.0 (abort with ^G) > > (rpi2@REDACTED)1> application:start(othost). > > > > What is going wrong here? > > > > Thanks > > Frans > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions From daniel.goertzen@REDACTED Tue May 13 16:30:19 2014 From: daniel.goertzen@REDACTED (Daniel Goertzen) Date: Tue, 13 May 2014 09:30:19 -0500 Subject: [erlang-questions] map external term format change? Message-ID: Did the external term format for maps change in between v17 pre-releases and the final release? I wrote some maps to an mnesia table using a pre-release, and now reading them back using 17.0 all the keys and values are randomly redistributed (some keys are values and vice versa, but some are on the correct side of the "=>" ). Or could something else be at work here? Anyway, the data wasn't valuable so I'm going to replace it and keep an eye on things. Thanks, Dan. -------------- next part -------------- An HTML attachment was scrubbed... URL: From sverker.eriksson@REDACTED Tue May 13 17:10:36 2014 From: sverker.eriksson@REDACTED (Sverker Eriksson) Date: Tue, 13 May 2014 17:10:36 +0200 Subject: [erlang-questions] map external term format change? In-Reply-To: References: Message-ID: <537235EC.7020102@erix.ericsson.se> Yes: OTP-11782 == erts == The external format for Maps has changed in a way that is not compatible with the format used in OTP 17.0-rc1 and OTP 17.0-rc2. /Sverker, Erlang/OTP On 05/13/2014 04:30 PM, Daniel Goertzen wrote: > Did the external term format for maps change in between v17 pre-releases > and the final release? > > I wrote some maps to an mnesia table using a pre-release, and now reading > them back using 17.0 all the keys and values are randomly redistributed > (some keys are values and vice versa, but some are on the correct side of > the "=>" ). > > Or could something else be at work here? > > Anyway, the data wasn't valuable so I'm going to replace it and keep an eye > on things. > > Thanks, > Dan. > > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions -------------- next part -------------- An HTML attachment was scrubbed... URL: From ahmad@REDACTED Wed May 14 00:02:28 2014 From: ahmad@REDACTED (Ahmad Baitalmal) Date: Tue, 13 May 2014 15:02:28 -0700 Subject: [erlang-questions] noproc gen_server cowboy In-Reply-To: References: <53705D02.3010207@ninenines.eu> Message-ID: <3CE80112-FA7E-4F0F-8E66-F84B61B3A10C@bitbuilder.com> Thanks Erik, I did a bit more digging, The call for file:read_file_info in cowboy_static.erl is returning this: {ok,{file_info,15990163246731,regular,read_write, {{2014,5,13},{20,51,46}}, {{2014,5,9},{19,57,47}}, {{2014,5,13},{19,46,18}}, 33188,1,2049,0,1704124,0,0}} The file is only 3723 bytes. I verified this also on an erl shell. Same result. So it looks like something is up in kernel-3.0/file.erl when running on a mipsel chip. Everything else is working, except for this file size issue. Oh and the body is empty. For now, I plan on using an onresponse hook to load up the file and fix the content-length as it goes out. :( Not ideal... ______________ Ahmad Baitalmal CEO & Co-Founder BitBuilder.com 650.539.9401 On May 13, 2014, at 1:13 AM, Erik S?e S?rensen wrote: > It's not just a reverse-endian'ed size... > 458453399216374 = 0x'0001'A0F6'0001'A0F6 -- weird duplication... > (0x1A0F6 = 106742 = 104.2KB, so that part fits.) > > > 2014-05-13 1:10 GMT+02:00 Ahmad Baitalmal : > Thanks Lo?c, > > It now runs and I can connect. I thought I read somewhere that relx automatically started the related apps. I guess it doesn't always. > > There is something wrong still, I'm getting this error for all files in the browser. > net::ERR_CONTENT_LENGTH_MISMATCH > > I checked the headers and cowboy is reporting the header "Content-Length: 458453399216374" for a file that is only 104K. > > Could this be a problem with cowboy running on a little-endian machine (mipsel)? > > Thanks, > > > On Sun, May 11, 2014 at 10:32 PM, Lo?c Hoguin wrote: > You didn't start the cowboy dependencies, I'm not sure how it could have worked on your Mac. Cowboy requires crypto, cowlib and ranch to be started to run. Try application:ensure_all_started(cowboy) instead and it'll do that for you. > > > On 05/12/2014 02:20 AM, Ahmad Baitalmal wrote: > Hi, > Im going crazy trying to solve this. > > Works on my Mac, but when I copy to a linux router (OpenWRT, R17, cowboy > 0.9.0) it give me the error below. > Is this a cowboy or erlang gen_server issue? > I tried http, same result. So it's not an ssl issue. I can't tell what > the error is... > > > % --------------------- This is my app code that starts cowboy > -module(onion_app). > -behavior(application). > -export([start/2]). > -export([stop/0]). > -export([stop/1]). > -include("common.hrl"). > > start(_Type, _Args) -> > application:start(cowboy), > Dispatch = cowboy_router:compile([ > {'_', [ > {"/", cowboy_static, {priv_file, onion ,"index.html"}}, > {"/[...]", cowboy_static, {priv_dir, onion , ""}} > ]} > ]), > RootDir = code:root_dir(), > Port = 443, > cowboy:start_https(my_https_listener, 10,[ > {port, Port}, > {certfile, RootDir ++ "/ssl/onion.crt"}, > {keyfile, RootDir ++ "/ssl/onion.key"} > ], > [ > {env, [{dispatch, Dispatch}]} > ] > ) > onion_sup:start_link(). > stop(_State) -> > ok. > > > % --------------------- I'm getting this error :( > Exec: /mnt/sda1/onion/erts-6.0/bin/erlexec -boot > /mnt/sda1/onion/releases/1/onion -env ERL_LIBS > /mnt/sda1/onion/releases/1/lib -config > /mnt/sda1/onion/releases/1/sys.config -args_file > /mnt/sda1/onion/releases/1/vm.args -- console > > =INFO REPORT==== 11-May-2014::03:45:55 === > application: onion > exited: {bad_return, > {{onion_app,start,[normal,[]]}, > {'EXIT', > {noproc, > {gen_server,call, > [ranch_sup, > {start_child, > {{ranch_listener_sup,my_https_listener}, > {ranch_listener_sup,start_link, > [my_https_listener,10,ranch_ssl, > [{port,443}, > {certfile,"/mnt/sda1/onion/ssl/onion.crt"}, > {keyfile,"/mnt/sda1/onion/ssl/onion.key"}], > cowboy_protocol, > [{env, > [{dispatch, > [{'_',[], > [{[],[],cowboy_static, > {priv_file,onion,"index.html"}}, > {[<<"tomato">>,'...'],[],tomato,[tomato]}, > {['...'], > [],cowboy_static, > {priv_dir,onion,[]}}]}]}]}]]}, > permanent,5000,supervisor, > [ranch_listener_sup]}}, > infinity]}}}}} > type: permanent > Eshell V6.0 (abort with ^G) > (onion@REDACTED)1> {"Kernel pid > terminated",application_controller,"{application_start_failure,onion,{bad_return,{{onion_app,start,[normal,[]]},{'EXIT',{noproc,{gen_server,call,[ranch_sup,{start_child,{{ranch_listener_sup,my_https_listener},{ranch_listener_sup,start_link,[my_https_listener,10,ranch_ssl,[{port,443},{certfile,\"/mnt/sda1/onion/ssl/onion.crt\"},{keyfile,\"/mnt/sda1/onion/ssl/onion.key\"}],cowboy_protocol,[{env,[{dispatch,[{'_',[],[{[],[],cowboy_static,{priv_file,onion,\"index.html\"}},{['...'],[],cowboy_static,{priv_dir,onion,[]}}]}]}]}]]},permanent,5000,supervisor,[ranch_listener_sup]}},infinity]}}}}}}"} > > > Thanks, > > -- > Ahmad > ___________ > 650.539.9395 > > Sent from my iPhon > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > > > -- > Lo?c Hoguin > http://ninenines.eu > > > > -- > Ahmad > ___________ > 650.539.9395 > > Sent from my iPhone > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From wallentin.dahlberg@REDACTED Wed May 14 02:36:15 2014 From: wallentin.dahlberg@REDACTED (=?UTF-8?Q?Bj=C3=B6rn=2DEgil_Dahlberg?=) Date: Wed, 14 May 2014 02:36:15 +0200 Subject: [erlang-questions] noproc gen_server cowboy In-Reply-To: <3CE80112-FA7E-4F0F-8E66-F84B61B3A10C@bitbuilder.com> References: <53705D02.3010207@ninenines.eu> <3CE80112-FA7E-4F0F-8E66-F84B61B3A10C@bitbuilder.com> Message-ID: Oh no .. trouble in paradise. I see the same duplication problem here (nice catch Erik), 1> <> = <<15990163246731:64>>, {I1,I2}. {3723,3723} Which leads me to think there is a problem in int efile_fileinfo(...) with the highs and lows. 2014-05-14 0:02 GMT+02:00 Ahmad Baitalmal : > Thanks Erik, > > I did a bit more digging, The call for file:read_file_info in > cowboy_static.erl is returning this: > > {ok,{file_info,15990163246731,regular,read_write, > {{2014,5,13},{20,51,46}}, > {{2014,5,9},{19,57,47}}, > {{2014,5,13},{19,46,18}}, > 33188,1,2049,0,1704124,0,0}} > > The file is only 3723 bytes. I verified this also on an erl shell. Same > result. > > So it looks like something is up in kernel-3.0/file.erl when running on a > mipsel chip. > > Everything else is working, except for this file size issue. Oh and the > body is empty. > > For now, I plan on using an onresponse hook to load up the file and fix > the content-length as it goes out. :( Not ideal... > > ______________ > *Ahmad Baitalmal* > *CEO & Co-Founder* > *BitBuilder.com * > 650.539.9401 > > On May 13, 2014, at 1:13 AM, Erik S?e S?rensen wrote: > > It's not just a reverse-endian'ed size... > 458453399216374 = 0x'0001'A0F6'0001'A0F6 -- weird duplication... > (0x1A0F6 = 106742 = 104.2KB, so that part fits.) > > > 2014-05-13 1:10 GMT+02:00 Ahmad Baitalmal : > >> Thanks Lo?c, >> >> It now runs and I can connect. I thought I read somewhere that relx >> automatically started the related apps. I guess it doesn't always. >> >> There is something wrong still, I'm getting this error for all files in >> the browser. >> net::ERR_CONTENT_LENGTH_MISMATCH >> >> I checked the headers and cowboy is reporting the header " >> *Content-Length:* 458453399216374" for a file that is only 104K. >> >> Could this be a problem with cowboy running on a little-endian machine >> (mipsel)? >> >> Thanks, >> >> >> On Sun, May 11, 2014 at 10:32 PM, Lo?c Hoguin wrote: >> >>> You didn't start the cowboy dependencies, I'm not sure how it could have >>> worked on your Mac. Cowboy requires crypto, cowlib and ranch to be started >>> to run. Try application:ensure_all_started(cowboy) instead and it'll do >>> that for you. >>> >>> >>> On 05/12/2014 02:20 AM, Ahmad Baitalmal wrote: >>> >>>> Hi, >>>> Im going crazy trying to solve this. >>>> >>>> Works on my Mac, but when I copy to a linux router (OpenWRT, R17, cowboy >>>> 0.9.0) it give me the error below. >>>> Is this a cowboy or erlang gen_server issue? >>>> I tried http, same result. So it's not an ssl issue. I can't tell what >>>> the error is... >>>> >>>> >>>> % --------------------- This is my app code that starts cowboy >>>> -module(onion_app). >>>> -behavior(application). >>>> -export([start/2]). >>>> -export([stop/0]). >>>> -export([stop/1]). >>>> -include("common.hrl"). >>>> >>>> start(_Type, _Args) -> >>>> application:start(cowboy), >>>> Dispatch = cowboy_router:compile([ >>>> {'_', [ >>>> {"/", cowboy_static, {priv_file, onion ,"index.html"}}, >>>> {"/[...]", cowboy_static, {priv_dir, onion , ""}} >>>> ]} >>>> ]), >>>> RootDir = code:root_dir(), >>>> Port = 443, >>>> cowboy:start_https(my_https_listener, 10,[ >>>> {port, Port}, >>>> {certfile, RootDir ++ "/ssl/onion.crt"}, >>>> {keyfile, RootDir ++ "/ssl/onion.key"} >>>> ], >>>> [ >>>> {env, [{dispatch, Dispatch}]} >>>> ] >>>> ) >>>> onion_sup:start_link(). >>>> stop(_State) -> >>>> ok. >>>> >>>> >>>> % --------------------- I'm getting this error :( >>>> Exec: /mnt/sda1/onion/erts-6.0/bin/erlexec -boot >>>> /mnt/sda1/onion/releases/1/onion -env ERL_LIBS >>>> /mnt/sda1/onion/releases/1/lib -config >>>> /mnt/sda1/onion/releases/1/sys.config -args_file >>>> /mnt/sda1/onion/releases/1/vm.args -- console >>>> >>>> =INFO REPORT==== 11-May-2014::03:45:55 === >>>> application: onion >>>> exited: {bad_return, >>>> {{onion_app,start,[normal,[]]}, >>>> {'EXIT', >>>> {noproc, >>>> {gen_server,call, >>>> [ranch_sup, >>>> {start_child, >>>> {{ranch_listener_sup,my_https_listener}, >>>> {ranch_listener_sup,start_link, >>>> [my_https_listener,10,ranch_ssl, >>>> [{port,443}, >>>> {certfile,"/mnt/sda1/onion/ssl/onion.crt"}, >>>> {keyfile,"/mnt/sda1/onion/ssl/onion.key"}], >>>> cowboy_protocol, >>>> [{env, >>>> [{dispatch, >>>> [{'_',[], >>>> [{[],[],cowboy_static, >>>> {priv_file,onion,"index.html"}}, >>>> {[<<"tomato">>,'...'],[], >>>> tomato,[tomato]}, >>>> {['...'], >>>> [],cowboy_static, >>>> {priv_dir,onion,[]}}]}]}]}]]}, >>>> permanent,5000,supervisor, >>>> [ranch_listener_sup]}}, >>>> infinity]}}}}} >>>> type: permanent >>>> Eshell V6.0 (abort with ^G) >>>> (onion@REDACTED)1> {"Kernel pid >>>> terminated",application_controller,"{application_ >>>> start_failure,onion,{bad_return,{{onion_app,start,[ >>>> normal,[]]},{'EXIT',{noproc,{gen_server,call,[ranch_sup,{ >>>> start_child,{{ranch_listener_sup,my_https_listener},{ranch_ >>>> listener_sup,start_link,[my_https_listener,10,ranch_ssl,[{ >>>> port,443},{certfile,\"/mnt/sda1/onion/ssl/onion.crt\"},{ >>>> keyfile,\"/mnt/sda1/onion/ssl/onion.key\"}],cowboy_protocol, >>>> [{env,[{dispatch,[{'_',[],[{[],[],cowboy_static,{priv_file, >>>> onion,\"index.html\"}},{['...'],[],cowboy_static,{priv_dir, >>>> onion,[]}}]}]}]}]]},permanent,5000,supervisor,[ranch_ >>>> listener_sup]}},infinity]}}}}}}"} >>>> >>>> >>>> Thanks, >>>> >>>> -- >>>> Ahmad >>>> ___________ >>>> 650.539.9395 >>>> >>>> Sent from my iPhon >>>> >>>> >>>> _______________________________________________ >>>> erlang-questions mailing list >>>> erlang-questions@REDACTED >>>> http://erlang.org/mailman/listinfo/erlang-questions >>>> >>>> >>> -- >>> Lo?c Hoguin >>> http://ninenines.eu >>> >> >> >> >> -- >> Ahmad >> ___________ >> 650.539.9395 >> >> Sent from my iPhone >> >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://erlang.org/mailman/listinfo/erlang-questions >> >> > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From ahmad@REDACTED Wed May 14 05:57:04 2014 From: ahmad@REDACTED (Ahmad Baitalmal) Date: Tue, 13 May 2014 20:57:04 -0700 Subject: [erlang-questions] noproc gen_server cowboy In-Reply-To: References: <53705D02.3010207@ninenines.eu> <3CE80112-FA7E-4F0F-8E66-F84B61B3A10C@bitbuilder.com> Message-ID: Bj?rn, What kind of arch are you running on? I'm running on a Ralink RT3052 (MIPS 24KEc V4.12). On Tue, May 13, 2014 at 5:36 PM, Bj?rn-Egil Dahlberg < wallentin.dahlberg@REDACTED> wrote: > Oh no .. trouble in paradise. > > I see the same duplication problem here (nice catch Erik), > > 1> <> = <<15990163246731:64>>, {I1,I2}. > {3723,3723} > > Which leads me to think there is a problem in int efile_fileinfo(...) with > the highs and lows. > > > > > > > 2014-05-14 0:02 GMT+02:00 Ahmad Baitalmal : > > Thanks Erik, >> >> I did a bit more digging, The call for file:read_file_info in >> cowboy_static.erl is returning this: >> >> {ok,{file_info,15990163246731,regular,read_write, >> {{2014,5,13},{20,51,46}}, >> {{2014,5,9},{19,57,47}}, >> {{2014,5,13},{19,46,18}}, >> 33188,1,2049,0,1704124,0,0}} >> >> The file is only 3723 bytes. I verified this also on an erl shell. Same >> result. >> >> So it looks like something is up in kernel-3.0/file.erl when running on a >> mipsel chip. >> >> Everything else is working, except for this file size issue. Oh and the >> body is empty. >> >> For now, I plan on using an onresponse hook to load up the file and fix >> the content-length as it goes out. :( Not ideal... >> >> ______________ >> *Ahmad Baitalmal* >> *CEO & Co-Founder* >> *BitBuilder.com * >> 650.539.9401 >> >> On May 13, 2014, at 1:13 AM, Erik S?e S?rensen wrote: >> >> It's not just a reverse-endian'ed size... >> 458453399216374 = 0x'0001'A0F6'0001'A0F6 -- weird duplication... >> (0x1A0F6 = 106742 = 104.2KB, so that part fits.) >> >> >> 2014-05-13 1:10 GMT+02:00 Ahmad Baitalmal : >> >>> Thanks Lo?c, >>> >>> It now runs and I can connect. I thought I read somewhere that relx >>> automatically started the related apps. I guess it doesn't always. >>> >>> There is something wrong still, I'm getting this error for all files in >>> the browser. >>> net::ERR_CONTENT_LENGTH_MISMATCH >>> >>> I checked the headers and cowboy is reporting the header " >>> *Content-Length:* 458453399216374" for a file that is only 104K. >>> >>> Could this be a problem with cowboy running on a little-endian machine >>> (mipsel)? >>> >>> Thanks, >>> >>> >>> On Sun, May 11, 2014 at 10:32 PM, Lo?c Hoguin wrote: >>> >>>> You didn't start the cowboy dependencies, I'm not sure how it could >>>> have worked on your Mac. Cowboy requires crypto, cowlib and ranch to be >>>> started to run. Try application:ensure_all_started(cowboy) instead and >>>> it'll do that for you. >>>> >>>> >>>> On 05/12/2014 02:20 AM, Ahmad Baitalmal wrote: >>>> >>>>> Hi, >>>>> Im going crazy trying to solve this. >>>>> >>>>> Works on my Mac, but when I copy to a linux router (OpenWRT, R17, >>>>> cowboy >>>>> 0.9.0) it give me the error below. >>>>> Is this a cowboy or erlang gen_server issue? >>>>> I tried http, same result. So it's not an ssl issue. I can't tell what >>>>> the error is... >>>>> >>>>> >>>>> % --------------------- This is my app code that starts cowboy >>>>> -module(onion_app). >>>>> -behavior(application). >>>>> -export([start/2]). >>>>> -export([stop/0]). >>>>> -export([stop/1]). >>>>> -include("common.hrl"). >>>>> >>>>> start(_Type, _Args) -> >>>>> application:start(cowboy), >>>>> Dispatch = cowboy_router:compile([ >>>>> {'_', [ >>>>> {"/", cowboy_static, {priv_file, onion ,"index.html"}}, >>>>> {"/[...]", cowboy_static, {priv_dir, onion , ""}} >>>>> ]} >>>>> ]), >>>>> RootDir = code:root_dir(), >>>>> Port = 443, >>>>> cowboy:start_https(my_https_listener, 10,[ >>>>> {port, Port}, >>>>> {certfile, RootDir ++ "/ssl/onion.crt"}, >>>>> {keyfile, RootDir ++ "/ssl/onion.key"} >>>>> ], >>>>> [ >>>>> {env, [{dispatch, Dispatch}]} >>>>> ] >>>>> ) >>>>> onion_sup:start_link(). >>>>> stop(_State) -> >>>>> ok. >>>>> >>>>> >>>>> % --------------------- I'm getting this error :( >>>>> Exec: /mnt/sda1/onion/erts-6.0/bin/erlexec -boot >>>>> /mnt/sda1/onion/releases/1/onion -env ERL_LIBS >>>>> /mnt/sda1/onion/releases/1/lib -config >>>>> /mnt/sda1/onion/releases/1/sys.config -args_file >>>>> /mnt/sda1/onion/releases/1/vm.args -- console >>>>> >>>>> =INFO REPORT==== 11-May-2014::03:45:55 === >>>>> application: onion >>>>> exited: {bad_return, >>>>> {{onion_app,start,[normal,[]]}, >>>>> {'EXIT', >>>>> {noproc, >>>>> {gen_server,call, >>>>> [ranch_sup, >>>>> {start_child, >>>>> {{ranch_listener_sup,my_https_listener}, >>>>> {ranch_listener_sup,start_link, >>>>> [my_https_listener,10,ranch_ssl, >>>>> [{port,443}, >>>>> {certfile,"/mnt/sda1/onion/ssl/onion.crt"}, >>>>> {keyfile,"/mnt/sda1/onion/ssl/onion.key"}], >>>>> cowboy_protocol, >>>>> [{env, >>>>> [{dispatch, >>>>> [{'_',[], >>>>> [{[],[],cowboy_static, >>>>> {priv_file,onion,"index.html"}}, >>>>> {[<<"tomato">>,'...'],[], >>>>> tomato,[tomato]}, >>>>> {['...'], >>>>> [],cowboy_static, >>>>> {priv_dir,onion,[]}}]}]}]}]]}, >>>>> permanent,5000,supervisor, >>>>> [ranch_listener_sup]}}, >>>>> infinity]}}}}} >>>>> type: permanent >>>>> Eshell V6.0 (abort with ^G) >>>>> (onion@REDACTED)1> {"Kernel pid >>>>> terminated",application_controller,"{application_ >>>>> start_failure,onion,{bad_return,{{onion_app,start,[ >>>>> normal,[]]},{'EXIT',{noproc,{gen_server,call,[ranch_sup,{ >>>>> start_child,{{ranch_listener_sup,my_https_listener},{ranch_ >>>>> listener_sup,start_link,[my_https_listener,10,ranch_ssl,[{ >>>>> port,443},{certfile,\"/mnt/sda1/onion/ssl/onion.crt\"},{ >>>>> keyfile,\"/mnt/sda1/onion/ssl/onion.key\"}],cowboy_protocol, >>>>> [{env,[{dispatch,[{'_',[],[{[],[],cowboy_static,{priv_file, >>>>> onion,\"index.html\"}},{['...'],[],cowboy_static,{priv_dir, >>>>> onion,[]}}]}]}]}]]},permanent,5000,supervisor,[ranch_ >>>>> listener_sup]}},infinity]}}}}}}"} >>>>> >>>>> >>>>> Thanks, >>>>> >>>>> -- >>>>> Ahmad >>>>> ___________ >>>>> 650.539.9395 >>>>> >>>>> Sent from my iPhon >>>>> >>>>> >>>>> _______________________________________________ >>>>> erlang-questions mailing list >>>>> erlang-questions@REDACTED >>>>> http://erlang.org/mailman/listinfo/erlang-questions >>>>> >>>>> >>>> -- >>>> Lo?c Hoguin >>>> http://ninenines.eu >>>> >>> >>> >>> >>> -- >>> Ahmad >>> ___________ >>> 650.539.9395 >>> >>> Sent from my iPhone >>> >>> _______________________________________________ >>> erlang-questions mailing list >>> erlang-questions@REDACTED >>> http://erlang.org/mailman/listinfo/erlang-questions >>> >>> >> >> >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://erlang.org/mailman/listinfo/erlang-questions >> >> > -- Ahmad ___________ 650.539.9395 Sent from my iPhone -------------- next part -------------- An HTML attachment was scrubbed... URL: From vladdu55@REDACTED Wed May 14 11:28:48 2014 From: vladdu55@REDACTED (Vlad Dumitrescu) Date: Wed, 14 May 2014 11:28:48 +0200 Subject: [erlang-questions] literal character syntax Message-ID: Hi! I would like to make a suggestion regarding the accepted literal characters syntax. At the moment, any character following a $ is accepted as itself. I find it very confusing when these characters are whitespace or control chars and my suggestion is to refuse these literals. Most of them have escaped representations and the others should be written as integers anyway. What do you think? Is anyone using these in a meaningful way? best regards, Vlad -------------- next part -------------- An HTML attachment was scrubbed... URL: From sean@REDACTED Wed May 14 16:10:34 2014 From: sean@REDACTED (Sean Cribbs) Date: Wed, 14 May 2014 09:10:34 -0500 Subject: [erlang-questions] literal character syntax In-Reply-To: References: Message-ID: They are incredibly useful in pattern-matching simple string arguments. e.g. case erlang:system_info(version) of [$5, $., $1, $0 | _ ] -> ok; _ -> fail end On Wed, May 14, 2014 at 4:28 AM, Vlad Dumitrescu wrote: > Hi! > > I would like to make a suggestion regarding the accepted literal > characters syntax. At the moment, any character following a $ is accepted > as itself. I find it very confusing when these characters are whitespace or > control chars and my suggestion is to refuse these literals. Most of them > have escaped representations and the others should be written as integers > anyway. > > What do you think? Is anyone using these in a meaningful way? > > best regards, > Vlad > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > > -- Sean Cribbs Software Engineer Basho Technologies, Inc. http://basho.com/ -------------- next part -------------- An HTML attachment was scrubbed... URL: From mononcqc@REDACTED Wed May 14 16:15:37 2014 From: mononcqc@REDACTED (Fred Hebert) Date: Wed, 14 May 2014 10:15:37 -0400 Subject: [erlang-questions] literal character syntax In-Reply-To: References: Message-ID: <20140514141535.GF1684@ferdair.local> I think the argument here is specifically about whitespace characters. For example, using: starts_with([$ | _]) -> space; starts_with([$ | _]) -> tab; starts_with([$ |_]) -> newline. Is currently allowed, but it is arguably clearer to use: starts_with([$\s | _]) -> space; starts_with([$\t | _]) -> tab. starts_with([$\n | _]) -> newline. Vlad here recommends deprecating the former case, while recommending the latter form. I would tend to agree for the sake of readability, but would like a regular deprecation cycle with warnings explaining the recommended changes ("The $ form is being deprecated, replace with $\s" or something). Regards, Fred. On 05/14, Sean Cribbs wrote: > They are incredibly useful in pattern-matching simple string arguments. e.g. > > case erlang:system_info(version) of > [$5, $., $1, $0 | _ ] -> ok; > _ -> fail > end > > > On Wed, May 14, 2014 at 4:28 AM, Vlad Dumitrescu wrote: > > > Hi! > > > > I would like to make a suggestion regarding the accepted literal > > characters syntax. At the moment, any character following a $ is accepted > > as itself. I find it very confusing when these characters are whitespace or > > control chars and my suggestion is to refuse these literals. Most of them > > have escaped representations and the others should be written as integers > > anyway. > > > > What do you think? Is anyone using these in a meaningful way? > > > > best regards, > > Vlad > > > > > > _______________________________________________ > > erlang-questions mailing list > > erlang-questions@REDACTED > > http://erlang.org/mailman/listinfo/erlang-questions > > > > > > > -- > Sean Cribbs > Software Engineer > Basho Technologies, Inc. > http://basho.com/ > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions From egil@REDACTED Wed May 14 16:32:08 2014 From: egil@REDACTED (=?ISO-8859-1?Q?Bj=F6rn-Egil_Dahlberg?=) Date: Wed, 14 May 2014 16:32:08 +0200 Subject: [erlang-questions] literal character syntax In-Reply-To: <20140514141535.GF1684@ferdair.local> References: <20140514141535.GF1684@ferdair.local> Message-ID: <53737E68.9050809@erlang.org> On 2014-05-14 16:15, Fred Hebert wrote: > I think the argument here is specifically about whitespace characters. > > For example, using: > > starts_with([$ | _]) -> space; > starts_with([$ | _]) -> tab; > starts_with([$ > |_]) -> newline. > > Is currently allowed, but it is arguably clearer to use: > > starts_with([$\s | _]) -> space; > starts_with([$\t | _]) -> tab. > starts_with([$\n | _]) -> newline. > > Vlad here recommends deprecating the former case, while recommending the > latter form. > > I would tend to agree for the sake of readability, but would like a > regular deprecation cycle with warnings explaining the recommended > changes ("The $ form is being deprecated, replace with $\s" or > something). I like this proposal. I don't know how fast we could remove $ , $ , etc (earliest 19?) but we could certainly emit irritating deprecation warnings that make people want to fix their code. // Bj?rn-Egil > > Regards, > Fred. > > On 05/14, Sean Cribbs wrote: >> They are incredibly useful in pattern-matching simple string arguments. e.g. >> >> case erlang:system_info(version) of >> [$5, $., $1, $0 | _ ] -> ok; >> _ -> fail >> end >> >> >> On Wed, May 14, 2014 at 4:28 AM, Vlad Dumitrescu wrote: >> >>> Hi! >>> >>> I would like to make a suggestion regarding the accepted literal >>> characters syntax. At the moment, any character following a $ is accepted >>> as itself. I find it very confusing when these characters are whitespace or >>> control chars and my suggestion is to refuse these literals. Most of them >>> have escaped representations and the others should be written as integers >>> anyway. >>> >>> What do you think? Is anyone using these in a meaningful way? >>> >>> best regards, >>> Vlad >>> >>> >>> _______________________________________________ >>> erlang-questions mailing list >>> erlang-questions@REDACTED >>> http://erlang.org/mailman/listinfo/erlang-questions >>> >>> >> >> -- >> Sean Cribbs >> Software Engineer >> Basho Technologies, Inc. >> http://basho.com/ >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://erlang.org/mailman/listinfo/erlang-questions > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > > From magnus@REDACTED Wed May 14 16:41:15 2014 From: magnus@REDACTED (Magnus Henoch) Date: Wed, 14 May 2014 15:41:15 +0100 Subject: [erlang-questions] literal character syntax In-Reply-To: (Sean Cribbs's message of "Wed, 14 May 2014 09:10:34 -0500") References: Message-ID: Sean Cribbs writes: > They are incredibly useful in pattern-matching simple string arguments. e.g. > > case erlang:system_info(version) of > [$5, $., $1, $0 | _ ] -> ok; > _ -> fail > end In this case, you could in fact write it like this instead: case erlang:system_info(version) of "5.10" ++ _ -> ok; _ -> fail end Regards, Magnus From k.petrauskas@REDACTED Wed May 14 16:45:52 2014 From: k.petrauskas@REDACTED (Karolis Petrauskas) Date: Wed, 14 May 2014 17:45:52 +0300 Subject: [erlang-questions] literal character syntax In-Reply-To: References: Message-ID: Never saw a contruct like this. Can you explain this syntax in more details? Karolis On Wed, May 14, 2014 at 5:41 PM, Magnus Henoch wrote: > Sean Cribbs writes: > > > They are incredibly useful in pattern-matching simple string arguments. > e.g. > > > > case erlang:system_info(version) of > > [$5, $., $1, $0 | _ ] -> ok; > > _ -> fail > > end > > In this case, you could in fact write it like this instead: > > case erlang:system_info(version) of > "5.10" ++ _ -> ok; > _ -> fail > end > > Regards, > Magnus > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jesper.louis.andersen@REDACTED Wed May 14 16:49:31 2014 From: jesper.louis.andersen@REDACTED (Jesper Louis Andersen) Date: Wed, 14 May 2014 16:49:31 +0200 Subject: [erlang-questions] literal character syntax In-Reply-To: References: Message-ID: On Wed, May 14, 2014 at 4:45 PM, Karolis Petrauskas wrote: > Never saw a contruct like this. Can you explain this syntax in more > details? It is a match on the head. See http://www.erlang.org/doc/reference_manual/expressions.html#id77958 and the "String prefix" section. -- J. -------------- next part -------------- An HTML attachment was scrubbed... URL: From jesper.louis.andersen@REDACTED Wed May 14 16:52:37 2014 From: jesper.louis.andersen@REDACTED (Jesper Louis Andersen) Date: Wed, 14 May 2014 16:52:37 +0200 Subject: [erlang-questions] literal character syntax In-Reply-To: <53737E68.9050809@erlang.org> References: <20140514141535.GF1684@ferdair.local> <53737E68.9050809@erlang.org> Message-ID: On Wed, May 14, 2014 at 4:32 PM, Bj?rn-Egil Dahlberg wrote: > I like this proposal. > > I don't know how fast we could remove $ , $ , etc (earliest 19?) but we > could certainly emit irritating deprecation warnings that make people want > to fix their code. > +1 I like the $\n notation and I use that from time to time, but indeed, '$ ' is just confusing, especially if programming with a variable width font in which case it is really hard to determine what is happening. I'd like to see this cleanup happen. -- J. -------------- next part -------------- An HTML attachment was scrubbed... URL: From k.petrauskas@REDACTED Wed May 14 16:53:02 2014 From: k.petrauskas@REDACTED (Karolis Petrauskas) Date: Wed, 14 May 2014 17:53:02 +0300 Subject: [erlang-questions] literal character syntax In-Reply-To: References: Message-ID: Thanks! Really useful. I had skipped it somehow. Karolis On Wed, May 14, 2014 at 5:49 PM, Jesper Louis Andersen < jesper.louis.andersen@REDACTED> wrote: > > On Wed, May 14, 2014 at 4:45 PM, Karolis Petrauskas < > k.petrauskas@REDACTED> wrote: > >> Never saw a contruct like this. Can you explain this syntax in more >> details? > > > It is a match on the head. > > See http://www.erlang.org/doc/reference_manual/expressions.html#id77958and the "String prefix" section. > > > -- > J. > -------------- next part -------------- An HTML attachment was scrubbed... URL: From vladdu55@REDACTED Wed May 14 17:31:33 2014 From: vladdu55@REDACTED (Vlad Dumitrescu) Date: Wed, 14 May 2014 17:31:33 +0200 Subject: [erlang-questions] literal character syntax In-Reply-To: <53737E68.9050809@erlang.org> References: <20140514141535.GF1684@ferdair.local> <53737E68.9050809@erlang.org> Message-ID: Hi! Of course there should be a proper deprecation cycle, it's a braking change. I've been looking very briefly at where would these checks be made and I'd say that it probably should be in the preprocessor. However, the scanner already interprets the literals and the only way to know how the value was specified in the source is by having the scanner return the text and it's not a very good idea to always do that (memory usage could increase dramatically). A solution would be to let the character tokens always include the text, but this potentially breaks code that assumes there is no text attribute if it wasn't requested. On the other hand, the attributes are specified as an opaque data type and should be accessed with attribute_info and token_info, so maybe we could get away with that? If yes, I will start working on it. If not, I welcome other suggestions. regards, Vlad On Wed, May 14, 2014 at 4:32 PM, Bj?rn-Egil Dahlberg wrote: > On 2014-05-14 16:15, Fred Hebert wrote: > >> I think the argument here is specifically about whitespace characters. >> >> For example, using: >> >> starts_with([$ | _]) -> space; >> starts_with([$ | _]) -> tab; >> starts_with([$ >> |_]) -> newline. >> >> Is currently allowed, but it is arguably clearer to use: >> >> starts_with([$\s | _]) -> space; >> starts_with([$\t | _]) -> tab. >> starts_with([$\n | _]) -> newline. >> >> Vlad here recommends deprecating the former case, while recommending the >> latter form. >> >> I would tend to agree for the sake of readability, but would like a >> regular deprecation cycle with warnings explaining the recommended >> changes ("The $ form is being deprecated, replace with $\s" or >> something). >> > I like this proposal. > > I don't know how fast we could remove $ , $ , etc (earliest 19?) but we > could certainly emit irritating deprecation warnings that make people want > to fix their code. > > // Bj?rn-Egil > > > > >> Regards, >> Fred. >> >> On 05/14, Sean Cribbs wrote: >> >>> They are incredibly useful in pattern-matching simple string arguments. >>> e.g. >>> >>> case erlang:system_info(version) of >>> [$5, $., $1, $0 | _ ] -> ok; >>> _ -> fail >>> end >>> >>> >>> On Wed, May 14, 2014 at 4:28 AM, Vlad Dumitrescu >>> wrote: >>> >>> Hi! >>>> >>>> I would like to make a suggestion regarding the accepted literal >>>> characters syntax. At the moment, any character following a $ is >>>> accepted >>>> as itself. I find it very confusing when these characters are >>>> whitespace or >>>> control chars and my suggestion is to refuse these literals. Most of >>>> them >>>> have escaped representations and the others should be written as >>>> integers >>>> anyway. >>>> >>>> What do you think? Is anyone using these in a meaningful way? >>>> >>>> best regards, >>>> Vlad >>>> >>>> >>>> _______________________________________________ >>>> erlang-questions mailing list >>>> erlang-questions@REDACTED >>>> http://erlang.org/mailman/listinfo/erlang-questions >>>> >>>> >>>> >>> -- >>> Sean Cribbs >>> Software Engineer >>> Basho Technologies, Inc. >>> http://basho.com/ >>> _______________________________________________ >>> erlang-questions mailing list >>> erlang-questions@REDACTED >>> http://erlang.org/mailman/listinfo/erlang-questions >>> >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://erlang.org/mailman/listinfo/erlang-questions >> >> >> > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From erlang@REDACTED Wed May 14 22:26:52 2014 From: erlang@REDACTED (Joe Armstrong) Date: Wed, 14 May 2014 22:26:52 +0200 Subject: [erlang-questions] erlang performance Message-ID: Hello, I'd like a have a rough idea of the average number of memory fetches and stores per Beam instruction and per Erlang reduction. Does anybody have any measurements for the number of memory fetches and stores for different beam instructions and for the average number of beam instructions per erlang reduction. (memory means physical RAM - not erlang garbage collected memory) Cheers /Joe -------------- next part -------------- An HTML attachment was scrubbed... URL: From lukas@REDACTED Thu May 15 10:07:46 2014 From: lukas@REDACTED (Lukas Larsson) Date: Thu, 15 May 2014 10:07:46 +0200 Subject: [erlang-questions] erlang performance In-Reply-To: References: Message-ID: Hello, On Wed, May 14, 2014 at 10:26 PM, Joe Armstrong wrote: > > I'd like a have a rough idea of the average number of memory fetches and > stores per Beam instruction and per Erlang reduction. > > I recently did some digging into optimizing the code for the emulator and created a tool that extracts the c-code and assembler output for each instruction in beam. I did the checks for both PowerPC[1] and x86[2]. From this you should be able to parse out how many fetches and stores each instruction does. I don't know how many instructions there normally is per function, but if you just take some random code and use erts_debug:df(Module) you will get a file with one instruction per line and then you can extrapolate. I'm not sure what kind of performance indicator this will be though as you have to know the cache hit rate and memory latency as well to judge how long time each instruction takes. Also normally I've found that an Erlang application spends about 50% of it's time executing code outside the emulator loop (ets, gc, bifs etc). Lukas [1]: https://dl.dropboxusercontent.com/u/6250179/asm_comparison_ppc.html(download file for css to work, the new part is after some optimizations I did for ppc only) [2]: https://dl.dropboxusercontent.com/u/6250179/asm_x86.html (download file for css to work) -------------- next part -------------- An HTML attachment was scrubbed... URL: From roger@REDACTED Thu May 15 10:40:54 2014 From: roger@REDACTED (Roger Lipscombe) Date: Thu, 15 May 2014 09:40:54 +0100 Subject: [erlang-questions] Calling a function when a dbg call trace is hit? Message-ID: I'm attempting to track down a problem in our Erlang server, which is caused by a particular client. My idea was this: 1. Add dbg:tpl on all processes to match the "hello" call from this particular client (it sends its identity in the call). This would be fairly lightweight. 2. (somehow) when that triggers, add some more dbg:tpl traces on that specific process, across a selection of interesting modules. So, I guess I've got a bunch of questions: - Can I call arbitrary code when a dbg call trace is hit? Can that code install more dbg hooks? - It appears that all traces apply to all processes included in the session? Can I have more than one dbg session, such that I match one call in all processes, but more calls in a specific process? Or am I barking up the wrong tree, and there's a better way to do this? Thanks, Roger. From roger@REDACTED Thu May 15 11:18:01 2014 From: roger@REDACTED (Roger Lipscombe) Date: Thu, 15 May 2014 10:18:01 +0100 Subject: [erlang-questions] dbg:fun2ms and matching any arity? Message-ID: This answer on StackOverflow -- http://stackoverflow.com/a/1954980/8446 -- gives an example of tracing return values: dbg:tpl(M, F, A, [{'_', [], [{return_trace}]}]). That match spec is scary, so I was looking at dbg:fun2ms: Here's a single parameter: 14> dbg:fun2ms(fun(['_']) -> return_trace() end). [{['_'],[],[{return_trace}]}] Here's two parameters: 15> dbg:fun2ms(fun(['_', '_']) -> return_trace() end). [{['_','_'],[],[{return_trace}]}] But when I attempt to match _any_ parameters: 16> dbg:fun2ms(fun('_') -> return_trace() end). Error: dbg:fun2ms requires fun with single variable or list parameter {error,transform_error} Or no parameters: 17> dbg:fun2ms(fun([]) -> return_trace() end). Error: dbg:fun2ms requires fun with single variable or list parameter {error,transform_error} ... I get errors. Is it possible to get dbg:fun2ms to generate the match spec in the SO answer? Or is there not a 1:1 fidelity between what tracing will accept and what fun2ms will generate? Cheers, Roger. From tty.erlang@REDACTED Thu May 15 12:00:39 2014 From: tty.erlang@REDACTED (T Ty) Date: Thu, 15 May 2014 11:00:39 +0100 Subject: [erlang-questions] dbg:fun2ms and matching any arity? In-Reply-To: References: Message-ID: dbg:fun2ms(fun(_X) -> return_trace() end). might be what you are looking for. On Thu, May 15, 2014 at 10:18 AM, Roger Lipscombe wrote: > This answer on StackOverflow -- > http://stackoverflow.com/a/1954980/8446 -- gives an example of tracing > return values: > > dbg:tpl(M, F, A, [{'_', [], [{return_trace}]}]). > > That match spec is scary, so I was looking at dbg:fun2ms: > > Here's a single parameter: > 14> dbg:fun2ms(fun(['_']) -> return_trace() end). > [{['_'],[],[{return_trace}]}] > > Here's two parameters: > 15> dbg:fun2ms(fun(['_', '_']) -> return_trace() end). > [{['_','_'],[],[{return_trace}]}] > > But when I attempt to match _any_ parameters: > > 16> dbg:fun2ms(fun('_') -> return_trace() end). > Error: dbg:fun2ms requires fun with single variable or list parameter > {error,transform_error} > > Or no parameters: > > 17> dbg:fun2ms(fun([]) -> return_trace() end). > Error: dbg:fun2ms requires fun with single variable or list parameter > {error,transform_error} > > ... I get errors. > > Is it possible to get dbg:fun2ms to generate the match spec in the SO > answer? Or is there not a 1:1 fidelity between what tracing will > accept and what fun2ms will generate? > > Cheers, > Roger. > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From zxq9@REDACTED Thu May 15 12:17:02 2014 From: zxq9@REDACTED (zxq9) Date: Thu, 15 May 2014 19:17:02 +0900 Subject: [erlang-questions] literal character syntax In-Reply-To: <20140514141535.GF1684@ferdair.local> References: <20140514141535.GF1684@ferdair.local> Message-ID: <1419556.oXnLqJ1Ur6@jalapeno> On Wednesday 14 May 2014 10:15:37 Fred Hebert wrote: > I think the argument here is specifically about whitespace characters. > > For example, using: > > starts_with([$ | _]) -> space; > starts_with([$ | _]) -> tab; > starts_with([$ > > |_]) -> newline. > > Is currently allowed, but it is arguably clearer to use: > > starts_with([$\s | _]) -> space; > starts_with([$\t | _]) -> tab. > starts_with([$\n | _]) -> newline. > > Vlad here recommends deprecating the former case, while recommending the > latter form. > > I would tend to agree for the sake of readability, but would like a > regular deprecation cycle with warnings explaining the recommended > changes ("The $ form is being deprecated, replace with $\s" or > something). I can understand the argument about it being confusing, otoh, special casing something in the language implementation (the whitespace literals VS every other literal) to explicitly disallow them when there is a text-readable way of expressing this already (the escape characters) seems like step in the wrong direction. The current implementation is entirely consistent, is not confusing in editors/highlight modes which are trained to point out literal whitespace, and the readability issue really boils down to clean coding conventions VS trying to make the language implementation force a clean coding convention which may not fit all cases/editors/communities. If emacs/vi/fooedit evolve in the future to the point our conception of "whitespace" changes even a little, this will be seen as an awkward wart lingering in the language. I can't think of a case of coding convention VS implementation-imposed discipline where "imposed discipline" was a good idea unless it was central to the design of the language to begin with. My 2c. From jesper.louis.andersen@REDACTED Thu May 15 12:25:02 2014 From: jesper.louis.andersen@REDACTED (Jesper Louis Andersen) Date: Thu, 15 May 2014 12:25:02 +0200 Subject: [erlang-questions] erlang performance In-Reply-To: References: Message-ID: On Thu, May 15, 2014 at 10:07 AM, Lukas Larsson wrote: > Also normally I've found that an Erlang application spends about 50% of > it's time executing code outside the emulator loop (ets, gc, bifs etc). Many of my programs spend about 20% time in beam_emu.c as witnessed by e.g., linux 'perf' tool or pmcstat(8) on Freebsd. My thought was around doing sampling by using pmcstat and then running a benchmark with an instruction mix to get an idea of how much time is spent. Nowadays, I am more interested in memory access patterns when optimizing for speed - but I rarely optimize for speed. Most programs are fast enough from the get go in many cases. -- J. -------------- next part -------------- An HTML attachment was scrubbed... URL: From tony@REDACTED Thu May 15 12:33:26 2014 From: tony@REDACTED (Tony Rogvall) Date: Thu, 15 May 2014 12:33:26 +0200 Subject: [erlang-questions] erlang performance In-Reply-To: References: Message-ID: <1EA60BD5-3D3F-4CEE-80B1-AA0E40A9B183@rogvall.se> This is fantastics work. Really nice. For Joe may I suggest to use the github.com/tonyrog/beam (or similar), a beam emulator written in Erlang, and perform simulations instead. The number of registers and memory cache size and speed will vary anyway. With a simulator you can change all parameters without getting your hands dirty :-) The beam emulator is not complete and do/will only cover the external instructions. That does not stop anyone from implementing the loader and the internal instructions as well. /Tony On 15 maj 2014, at 10:07, Lukas Larsson wrote: > Hello, > > On Wed, May 14, 2014 at 10:26 PM, Joe Armstrong wrote: > > I'd like a have a rough idea of the average number of memory fetches and > stores per Beam instruction and per Erlang reduction. > > > I recently did some digging into optimizing the code for the emulator and created a tool that extracts the c-code and assembler output for each instruction in beam. I did the checks for both PowerPC[1] and x86[2]. From this you should be able to parse out how many fetches and stores each instruction does. I don't know how many instructions there normally is per function, but if you just take some random code and use erts_debug:df(Module) you will get a file with one instruction per line and then you can extrapolate. > > I'm not sure what kind of performance indicator this will be though as you have to know the cache hit rate and memory latency as well to judge how long time each instruction takes. Also normally I've found that an Erlang application spends about 50% of it's time executing code outside the emulator loop (ets, gc, bifs etc). > > Lukas > > [1]: https://dl.dropboxusercontent.com/u/6250179/asm_comparison_ppc.html (download file for css to work, the new part is after some optimizations I did for ppc only) > [2]: https://dl.dropboxusercontent.com/u/6250179/asm_x86.html (download file for css to work) > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions "Installing applications can lead to corruption over time. Applications gradually write over each other's libraries, partial upgrades occur, user and system errors happen, and minute changes may be unnoticeable and difficult to fix" -------------- next part -------------- An HTML attachment was scrubbed... URL: From n.oxyde@REDACTED Thu May 15 12:36:43 2014 From: n.oxyde@REDACTED (Anthony Ramine) Date: Thu, 15 May 2014 12:36:43 +0200 Subject: [erlang-questions] literal character syntax In-Reply-To: <1419556.oXnLqJ1Ur6@jalapeno> References: <20140514141535.GF1684@ferdair.local> <1419556.oXnLqJ1Ur6@jalapeno> Message-ID: $ gg -i "stupid emacs" -- \*.erl lib/compiler/src/cerl.erl:994: io_lib:write_string(atom_name(Node), $'). %' stupid Emacs. lib/compiler/src/core_scan.erl:96:string_thing($') -> "atom"; %' stupid emacs lib/compiler/src/core_scan.erl:97:string_thing($") -> "string". %" stupid emacs lib/dialyzer/test/opaque_SUITE_data/src/modules/opaque_erl_scan.erl:313:string_thing($') -> "atom"; %' Stupid Emacs lib/dialyzer/test/options1_SUITE_data/src/compiler/cerl.erl:843: io_lib:write_string(atom_name(Node), $'). %' stupi lib/edoc/src/edoc_wiki.erl:238:expand_triple([$', $', $' | Cs], L, As, _L0) -> % ' stupid emacs lib/hipe/cerl/erl_types.erl:4798: true -> io_lib:write_string(atom_to_list(X), $'); % stupid emacs ' lib/stdlib/src/erl_scan.erl:331:string_thing($') -> "atom"; %' Stupid Emacs lib/syntax_tools/src/erl_prettypr.erl:1011: lay_string_1([$" | S2], L - W + 1, W)) %" stupid emacs The whole point of Erlang was always to make silly things quite hard to do. Allowing a literal newline is a silly thing to do that can be forbidden easily. Claiming that tools currently work correctly is irrelevant, and also wrong. And why would that be related to editors anyway? What do you mean by ? our conception of whitespace ?? How can that change? Whitespace is whitespace. I also have troubles understanding how Erlang doesn?t already impose *A LOT* of things. -- Anthony Ramine Le 15 mai 2014 ? 12:17, zxq9 a ?crit : > On Wednesday 14 May 2014 10:15:37 Fred Hebert wrote: >> I think the argument here is specifically about whitespace characters. >> >> For example, using: >> >> starts_with([$ | _]) -> space; >> starts_with([$ | _]) -> tab; >> starts_with([$ >> >> |_]) -> newline. >> >> Is currently allowed, but it is arguably clearer to use: >> >> starts_with([$\s | _]) -> space; >> starts_with([$\t | _]) -> tab. >> starts_with([$\n | _]) -> newline. >> >> Vlad here recommends deprecating the former case, while recommending the >> latter form. >> >> I would tend to agree for the sake of readability, but would like a >> regular deprecation cycle with warnings explaining the recommended >> changes ("The $ form is being deprecated, replace with $\s" or >> something). > > I can understand the argument about it being confusing, otoh, special casing > something in the language implementation (the whitespace literals VS every > other literal) to explicitly disallow them when there is a text-readable way > of expressing this already (the escape characters) seems like step in the > wrong direction. > > The current implementation is entirely consistent, is not confusing in > editors/highlight modes which are trained to point out literal whitespace, and > the readability issue really boils down to clean coding conventions VS trying > to make the language implementation force a clean coding convention which may > not fit all cases/editors/communities. If emacs/vi/fooedit evolve in the future > to the point our conception of "whitespace" changes even a little, this will > be seen as an awkward wart lingering in the language. I can't think of a case > of coding convention VS implementation-imposed discipline where "imposed > discipline" was a good idea unless it was central to the design of the > language to begin with. > > My 2c. > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions From vladdu55@REDACTED Thu May 15 12:41:35 2014 From: vladdu55@REDACTED (Vlad Dumitrescu) Date: Thu, 15 May 2014 12:41:35 +0200 Subject: [erlang-questions] literal character syntax In-Reply-To: <1419556.oXnLqJ1Ur6@jalapeno> References: <20140514141535.GF1684@ferdair.local> <1419556.oXnLqJ1Ur6@jalapeno> Message-ID: Hi! On Thu, May 15, 2014 at 12:17 PM, zxq9 wrote: > > starts_with([$ | _]) -> space; > > starts_with([$ | _]) -> tab; > > starts_with([$ > > |_]) -> newline. > > > > Vlad here recommends deprecating the former case, > > > > I can understand the argument about it being confusing, otoh, special > casing > something in the language implementation (the whitespace literals VS every > other literal) to explicitly disallow them when there is a text-readable > way > of expressing this already (the escape characters) seems like step in the > wrong direction. > > The current implementation is entirely consistent, is not confusing in > editors/highlight modes which are trained to point out literal whitespace, > and > the readability issue really boils down to clean coding conventions VS > trying > to make the language implementation force a clean coding convention which > may > not fit all cases/editors/communities. If emacs/vi/fooedit evolve in the > future > to the point our conception of "whitespace" changes even a little, this > will > be seen as an awkward wart lingering in the language. I can't think of a > case > of coding convention VS implementation-imposed discipline where "imposed > discipline" was a good idea unless it was central to the design of the > language to begin with. > The problem is that file diffs usually don't have this feature. (Not to mention paper printouts, if anyone still use those :-). Also, most editors can show spaces, tabs and newlines in a "visible" way, but the syntax allows any control character and I'm not sure all editors will display for example $^C. Also, "cat f.erl" might behave strangely if there are control characters (I remember a long time ago all OTP files had ^L between function definitions...) Also, one must not use editor features/plugins that automatically replace tabs with spaces or the other way around. Some editors do that everywhere, not just at the beginning of the line. regards, Vlad -------------- next part -------------- An HTML attachment was scrubbed... URL: From vladdu55@REDACTED Thu May 15 12:54:22 2014 From: vladdu55@REDACTED (Vlad Dumitrescu) Date: Thu, 15 May 2014 12:54:22 +0200 Subject: [erlang-questions] observer app against older nodes Message-ID: Hi! If I run observer from 17.0 in distributed mode and there are some R16 or R15 nodes, is everything going to work? There are some incompatibilities listed in v1.0 (between R15 and R16?), but I'm not sure how to try out all of them. Hopefully there's an easy answer from the devs :-) regards, Vlad -------------- next part -------------- An HTML attachment was scrubbed... URL: From roger@REDACTED Thu May 15 13:14:22 2014 From: roger@REDACTED (Roger Lipscombe) Date: Thu, 15 May 2014 12:14:22 +0100 Subject: [erlang-questions] Calling a function when a dbg call trace is hit? In-Reply-To: References: Message-ID: On 15 May 2014 11:08, T Ty wrote: > I'm trying to understand what you mean by "It appears that all traces apply > to all processes included in the session?" Let me clarify: If I set up a trace for a particular function, for all processes: dbg:tpl(foo, bar, '_', []). dbg:p(all, c). ...there doesn't seem to be a way to concurrently trace _more_ functions but only for a particular process: dbg:tpl(quux, '_', []). dbg:p(pid(0,321,0), c). ...at the same time. In other words, having two dbg "sessions" active at once. From roger@REDACTED Thu May 15 13:15:32 2014 From: roger@REDACTED (Roger Lipscombe) Date: Thu, 15 May 2014 12:15:32 +0100 Subject: [erlang-questions] dbg:fun2ms and matching any arity? In-Reply-To: References: Message-ID: On 15 May 2014 11:00, T Ty wrote: > dbg:fun2ms(fun(_X) -> return_trace() end). > > might be what you are looking for. > Yes. Thanks. From publicityifl@REDACTED Thu May 15 11:56:06 2014 From: publicityifl@REDACTED (publicityifl@REDACTED) Date: Thu, 15 May 2014 02:56:06 -0700 (PDT) Subject: [erlang-questions] First call for papers IFL 2014 Message-ID: <53748f36.48ae0e0a.17e2.34d1@mx.google.com> Hello, Please, find below the first call for papers for IFL 2014. Please forward these to anyone you think may be interested. Apologies for any duplicates you may receive. best regards, Jurriaan Hage Publicity Chair of IFL --- CALL FOR PAPERS 26th SYMPOSIUM ON IMPLEMENTATION AND APPLICATION OF FUNCTIONAL LANGUAGES - IFL 2014 NORTHEASTERN UNIVERSITY/BOSTON, USA OCTOBER 1-3, 2014 http://ifl2014.github.io We are pleased to announce that the 26th edition of the IFL series will be held at Northeastern University in Boston, USA. The symposium will be held from 1st to 3rd of October 2014. Scope ----- The goal of the IFL symposia is to bring together researchers actively engaged in the implementation and application of functional and function-based programming languages. IFL 2014 will be a venue for researchers to present and discuss new ideas and concepts, work in progress, and publication-ripe results related to the implementation and application of functional languages and function-based programming. Following the IFL tradition, IFL 2014 will use a post-symposium review process to produce the formal proceedings. All participants of IFL 2014 are invited to submit either a draft paper or an extended abstract describing work to be presented at the symposium. At no time may work submitted to IFL be simultaneously submitted to other venues; submissions must adhere to ACM SIGPLAN's republication policy: http://www.sigplan.org/Resources/Policies/Republication The submissions will be screened by the program committee chair to make sure they are within the scope of IFL, and will appear in the draft proceedings distributed at the symposium. Submissions appearing in the draft proceedings are not peer-reviewed publications. Hence, publications that appear only in the draft proceedings do not count as publication for the ACM SIGPLAN republication policy. After the symposium, authors will be given the opportunity to incorporate the feedback from discussions at the symposium and will be invited to submit a revised full article for the formal review process. From the revised submissions, the program committee will select papers for the formal proceedings considering their correctness, novelty, originality, relevance, significance, and clarity. Submission Details ------------------ Submission deadline draft papers: September 1 Notification of acceptance for presentation: September 5 Early registration deadline: September 10 Late registration deadline: September 17 Submission deadline for pre-symposium proceedings: September 24 26th IFL Symposium: October 1-3 Submission deadline for post-symposium proceedings: December 15 Notification of acceptance for post-symposium proceedings: January 31 2015 Camera-ready version for post-symposium proceedings: March 15 2015 Prospective authors are encouraged to submit papers or extended abstracts to be published in the draft proceedings and to present them at the symposium. All contributions must be written in English. Papers must adhere to the standard ACM two columns conference format. For the pre-symposium proceedings we adopt a 'weak' page limit of 12 pages. For the post-symposium proceedings the page limit of 12 pages is firm. A suitable document template for LaTeX can be found at: http://www.acm.org/sigs/sigplan/authorInformation.htm Topics ------ IFL welcomes submissions describing practical and theoretical work as well as submissions describing applications and tools in the context of functional programming. If you are not sure whether your work is appropriate for IFL 2014, please contact the PC chair at samth@REDACTED Topics of interest include, but are not limited to: - language concepts - type systems, type checking, type inferencing - compilation techniques - staged compilation - run-time function specialization - run-time code generation - partial evaluation - (abstract) interpretation - metaprogramming - generic programming - automatic program generation - array processing - concurrent/parallel programming - concurrent/parallel program execution - embedded systems - web applications - (embedded) domain specific languages - security - novel memory management techniques - run-time profiling performance measurements - debugging and tracing - virtual/abstract machine architectures - validation, verification of functional programs - tools and programming techniques - (industrial) applications Peter Landin Prize ------------------ The Peter Landin Prize is awarded to the best paper presented at the symposium every year. The honoured article is selected by the program committee based on the submissions received for the formal review process. The prize carries a cash award equivalent to 150 Euros. Programme committee ------------------- Sam Tobin-Hochstadt, Indiana University (Chair) Rinus Plasmeijer, Radboud University Nijmegen (Co-Chair) Atze Dijkstra, Utrecht University Colin Runciman, University of York Graham Hutton, University of Nottingham Mary Sheeran, Chalmers University of Technology Patricia Johann, Appalachian State University Matthew Fluet, Rochester Institute of Technology Josef Svenningsson, Chalmers University of Technology Malgorzata Biernacka, University of Wroclaw Peter Achten, Radboud Univerity Nijmegen Laura Castro, University of A Coru?a Hai Paul Liu, Intel Labs Kathryn Gray, Cambridge University Lars Bergstrom, Mozilla Research Lindsey Kuper, Indiana University Nicolas Wu, Oxford T. Stephen Strickland, University of Maryland Xavier Clerc, INRIA Venue ----- The 26th IFL will be held in association with the College of Computer and Information Science at Northeastern University. It can be reached quickly and easily by public transport. From kianseong@REDACTED Thu May 15 12:00:50 2014 From: kianseong@REDACTED (Low Kian Seong) Date: Thu, 15 May 2014 18:00:50 +0800 Subject: [erlang-questions] How do you do these operations in Erlang Message-ID: How do you do the following in idiomatic Erlang: "sha1sum " or "md5sum " ? Thanks in advance. [image: Low Kian Seong on about.me] Low Kian Seong about.me/lowkianseong -------------- next part -------------- An HTML attachment was scrubbed... URL: From roger@REDACTED Thu May 15 13:17:25 2014 From: roger@REDACTED (Roger Lipscombe) Date: Thu, 15 May 2014 12:17:25 +0100 Subject: [erlang-questions] BSON parsing? Message-ID: We're using https://github.com/mongodb/bson-erlang for parsing BSON, and I've found a bug to do with the way it parses floating point numbers. Is there a more recent/better fork of this project? Or is there an alternative BSON parser we should look at? Thanks, Roger. From roger@REDACTED Thu May 15 13:32:58 2014 From: roger@REDACTED (Roger Lipscombe) Date: Thu, 15 May 2014 12:32:58 +0100 Subject: [erlang-questions] BSON parsing? In-Reply-To: References: Message-ID: Ah, it turns out that the bug is to do with NaN. The binary in question is <<0,0,0,0,0,0,248,127>>. If I feed the hex representation (0x7ff80000) to http://www.h-schmidt.net/FloatConverter/IEEE754.html, it tells me is NaN. Does Erlang actually have a representation of NaN? And, if so, why is bson-erlang not using it? Thanks, Roger. On 15 May 2014 12:17, Roger Lipscombe wrote: > We're using https://github.com/mongodb/bson-erlang for parsing BSON, > and I've found a bug to do with the way it parses floating point > numbers. > > Is there a more recent/better fork of this project? Or is there an > alternative BSON parser we should look at? > > Thanks, > Roger. From essen@REDACTED Thu May 15 13:35:57 2014 From: essen@REDACTED (=?UTF-8?B?TG/Dr2MgSG9ndWlu?=) Date: Thu, 15 May 2014 13:35:57 +0200 Subject: [erlang-questions] BSON parsing? In-Reply-To: References: Message-ID: <5374A69D.6000109@ninenines.eu> Erlang doesn't have a representation for NaN, +infinity and -infinity. They should probably be represented as atoms instead. On 05/15/2014 01:32 PM, Roger Lipscombe wrote: > Ah, it turns out that the bug is to do with NaN. The binary in > question is <<0,0,0,0,0,0,248,127>>. If I feed the hex representation > (0x7ff80000) to http://www.h-schmidt.net/FloatConverter/IEEE754.html, > it tells me is NaN. > > Does Erlang actually have a representation of NaN? And, if so, why is > bson-erlang not using it? > > Thanks, > Roger. > > On 15 May 2014 12:17, Roger Lipscombe wrote: >> We're using https://github.com/mongodb/bson-erlang for parsing BSON, >> and I've found a bug to do with the way it parses floating point >> numbers. >> >> Is there a more recent/better fork of this project? Or is there an >> alternative BSON parser we should look at? >> >> Thanks, >> Roger. > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > -- Lo?c Hoguin http://ninenines.eu From magnus@REDACTED Thu May 15 13:42:09 2014 From: magnus@REDACTED (Magnus Henoch) Date: Thu, 15 May 2014 12:42:09 +0100 Subject: [erlang-questions] How do you do these operations in Erlang In-Reply-To: (Low Kian Seong's message of "Thu, 15 May 2014 18:00:50 +0800") References: Message-ID: Low Kian Seong writes: > How do you do the following in idiomatic Erlang: > > "sha1sum " or "md5sum " ? Read the file with file:read_file/1: {ok, Data} = file:read_file(".emacs"). And compute the hash with crypto:hash/2: crypto:hash(md5, Data). <<242,65,189,209,115,49,139,159,101,115,231,221,109,5,100,186>> crypto:hash(sha, Data). <<100,125,41,225,227,121,228,249,229,155,129,191,170,223,82,239,16,205,233,106>> See the crypto documentation for more details: http://erlang.org/doc/man/crypto.html#hash-2 Regards, Magnus From kostis@REDACTED Thu May 15 14:38:54 2014 From: kostis@REDACTED (Kostis Sagonas) Date: Thu, 15 May 2014 14:38:54 +0200 Subject: [erlang-questions] literal character syntax In-Reply-To: References: <20140514141535.GF1684@ferdair.local> <1419556.oXnLqJ1Ur6@jalapeno> Message-ID: <5374B55E.80507@cs.ntua.gr> On 05/15/2014 12:36 PM, Anthony Ramine wrote: > $ gg -i "stupid emacs" -- \*.erl > lib/compiler/src/cerl.erl:994: io_lib:write_string(atom_name(Node), $'). %' stupid Emacs. > lib/compiler/src/core_scan.erl:96:string_thing($') -> "atom"; %' stupid emacs > lib/compiler/src/core_scan.erl:97:string_thing($") -> "string". %" stupid emacs > lib/dialyzer/test/opaque_SUITE_data/src/modules/opaque_erl_scan.erl:313:string_thing($') -> "atom"; %' Stupid Emacs > lib/dialyzer/test/options1_SUITE_data/src/compiler/cerl.erl:843: io_lib:write_string(atom_name(Node), $'). %' stupi > lib/edoc/src/edoc_wiki.erl:238:expand_triple([$', $', $' | Cs], L, As, _L0) -> % ' stupid emacs > lib/hipe/cerl/erl_types.erl:4798: true -> io_lib:write_string(atom_to_list(X), $'); % stupid emacs ' > lib/stdlib/src/erl_scan.erl:331:string_thing($') -> "atom"; %' Stupid Emacs > lib/syntax_tools/src/erl_prettypr.erl:1011: lay_string_1([$" | S2], L - W + 1, W)) %" stupid emacs I may be slow today, but I really do not understand how the above is related to what the original subject asked for. The above that you point out shows a current limitation/stupidity of the emacs-mode file, not of Erlang, right? (Again, I repeat, I may be failing to see your point...) [Aside: Just for my information, is there some escape-like way of writing the single quote character?] > The whole point of Erlang was always to make silly things quite hard to do. I am not so sure this was the whole point of Erlang. In my mind at least the whole point of Erlang was to ease concurrent and/or fault-tolerant programming which are VERY hard in the first place, not to make anything (no matter how silly it may be) harder. Kostis From rich.neswold@REDACTED Thu May 15 14:49:34 2014 From: rich.neswold@REDACTED (Rich Neswold) Date: Thu, 15 May 2014 07:49:34 -0500 Subject: [erlang-questions] literal character syntax In-Reply-To: <5374B55E.80507@cs.ntua.gr> References: <20140514141535.GF1684@ferdair.local> <1419556.oXnLqJ1Ur6@jalapeno> <5374B55E.80507@cs.ntua.gr> Message-ID: On Thu, May 15, 2014 at 7:38 AM, Kostis Sagonas wrote: > On 05/15/2014 12:36 PM, Anthony Ramine wrote: >> >> $ gg -i "stupid emacs" -- \*.erl > > I may be slow today, but I really do not understand how the above is related > to what the original subject asked for. I believe Mr. Ramine was disagreeing with zxq9's assertion that it's "not confusing in editors/highlight modes which are trained to point out literal whitespace". He pointed out more than a few places in the Erlang source in which the $literal syntax confuses the editor's highlighting. -- Rich From carlsson.richard@REDACTED Thu May 15 15:06:25 2014 From: carlsson.richard@REDACTED (Richard Carlsson) Date: Thu, 15 May 2014 15:06:25 +0200 Subject: [erlang-questions] literal character syntax In-Reply-To: <5374B55E.80507@cs.ntua.gr> References: <20140514141535.GF1684@ferdair.local> <1419556.oXnLqJ1Ur6@jalapeno> <5374B55E.80507@cs.ntua.gr> Message-ID: <5374BBD1.5010008@gmail.com> On 2014-05-15 14:38 , Kostis Sagonas wrote: > [Aside: Just for my information, is there some escape-like way of > writing the single quote character?] The backslash works on any character. If there's no special meaning, as for \n, \t, etc., it just uses the character verbatim (including the backslash itself). Hence, $\' == $', '\'' is the atom containing one single-quote, and "\\" is the string containing a single backslash. This could be used to get around problems in some editors (though it seems to me that Emacs does the right thing anyway with $' these days). Btw., the \s for space was my contribution, way back when Barklund was working on the Standard Erlang draft. I always thought that it was a bad idea to use invisible characters for potentially important details. E.g., in C, a space literal is ' ' (unless you want to write it in octal as '\040'). /Richard From lukas@REDACTED Thu May 15 15:17:03 2014 From: lukas@REDACTED (Lukas Larsson) Date: Thu, 15 May 2014 15:17:03 +0200 Subject: [erlang-questions] Calling a function when a dbg call trace is hit? In-Reply-To: References: Message-ID: Hello Roger, That is not possible to do right now. It is a limitation placed on the tracing facilities of Erlang due to performance reasons. That restriction could be lifted in the future, but it is quite difficult to do while still keeping about the same performance and memory footprint that tracing has today. Lukas On Thu, May 15, 2014 at 1:14 PM, Roger Lipscombe wrote: > On 15 May 2014 11:08, T Ty wrote: > > I'm trying to understand what you mean by "It appears that all traces > apply > > to all processes included in the session?" > > Let me clarify: > > If I set up a trace for a particular function, for all processes: > > dbg:tpl(foo, bar, '_', []). > dbg:p(all, c). > > ...there doesn't seem to be a way to concurrently trace _more_ > functions but only for a particular process: > > dbg:tpl(quux, '_', []). > dbg:p(pid(0,321,0), c). > > ...at the same time. In other words, having two dbg "sessions" active at > once. > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From alanrevans@REDACTED Thu May 15 19:37:44 2014 From: alanrevans@REDACTED (Alan Evans) Date: Thu, 15 May 2014 18:37:44 +0100 Subject: [erlang-questions] Problem compiling CAMEL v2 ASN.1 files Message-ID: <5374FB68.1060809@gmail.com> Hello everyone, I don't suppose anyone out there has a set of 3GPP CAMEL ASN.1 files that the erlang asn compiler can compile and export an enc_InitialDP() function? I've been going around and around in circles all day trying to get this work but I'm failing miserably. My current problem is that the initialDP OPERATION in CAP-gsmSSF-gsmSCF-ops-args.asn is a parametrised type. The Erlang asn compiler docs state: "Note that the compiler does not generate encode/decode functions for parameterized types, but only for the instances of the parameterized types" I can't for the life of me figure out how to create an instance from this. Many thanks in advance. AlanE -------------- next part -------------- An HTML attachment was scrubbed... URL: From drormein@REDACTED Thu May 15 19:48:47 2014 From: drormein@REDACTED (Dror Mein) Date: Thu, 15 May 2014 10:48:47 -0700 (PDT) Subject: [erlang-questions] attach detach from running node via script Message-ID: <1400176127.23236.YahooMailNeo@web126705.mail.ne1.yahoo.com> Hi all, I'm looking for a way to attach run several erlang commands and detach from a running node with a script, and print results in the end. I've tried escript and bash, but I don't know how to script ^D out of it. If anyone has a better Idea, I'm willing to listen. -------------- next part -------------- An HTML attachment was scrubbed... URL: From drormein@REDACTED Thu May 15 19:58:50 2014 From: drormein@REDACTED (Dror Mein) Date: Thu, 15 May 2014 10:58:50 -0700 (PDT) Subject: [erlang-questions] node crashes without any indication Message-ID: <1400176730.64511.YahooMailNeo@web126702.mail.ne1.yahoo.com> hi all, One of my nodes has crashed (twice several hours apart), and I don't know why. I don't see any reason for it to crash and crash.log file is empty. (I'm using lager) I'm trying to look at observer on the node, but it appears that memory and utilization is steady. Does any one have more tools to look at crashing nodes?? -------------- next part -------------- An HTML attachment was scrubbed... URL: From ok@REDACTED Fri May 16 00:44:53 2014 From: ok@REDACTED (Richard A. O'Keefe) Date: Fri, 16 May 2014 10:44:53 +1200 Subject: [erlang-questions] BSON parsing? In-Reply-To: <5374A69D.6000109@ninenines.eu> References: <5374A69D.6000109@ninenines.eu> Message-ID: <1D6F99F2-8CA1-42E2-BEE2-F1FFF467CF80@cs.otago.ac.nz> On 15/05/2014, at 11:35 PM, Lo?c Hoguin wrote: > Erlang doesn't have a representation for NaN, +infinity and -infinity. Does anyone know why? I've used Smalltalk systems which say "If non-IEEE arithmetic was good enough for Granddad, it's good enough for me. SNIFF!" and Smalltalk systems which say "Standard since 1985, available everywhere, even on IBM z/Series, what earthly excuse could there be for NOT presenting IEEE arithmetic?" And the ones that don't hide infinities and NaNs turn out to be easier to use. Why? Well, if I have straightforward numeric code, I'm going to write it so that infinities and NaNs don't happen, so the only downside to being nonstandard is the extra run-time cost. But in fact very little numeric code is _that_ straightforward. Using a Smalltalk that respects the standard, I can take working numeric code in C or Fortran and convert it with very little effort and it will do the SAME thing. Using a Smalltalk that does not respect the standard, I have to analyse every operation to make sure that it will work. In fact my own Smalltalk library includes some vectorised operations on specialised arrays, and it really would NOT be safe to switch from an Array that happens to hold FloatE objects to a FloatEArray if the arithmetic could be different in any way. Conversely, if I have some numeric code written in Erlang, it would be nice to be able to translate it to C and link it in. But making floating point semantics *different* in Erlang and C makes this rather dangerous. Is Erlang running these days on *any* hardware platform that doesn't have IEEE arithmetic? From cabo@REDACTED Fri May 16 01:09:25 2014 From: cabo@REDACTED (Carsten Bormann) Date: Fri, 16 May 2014 01:09:25 +0200 Subject: [erlang-questions] BSON parsing? In-Reply-To: <5374A69D.6000109@ninenines.eu> References: <5374A69D.6000109@ninenines.eu> Message-ID: <46748EA5-5E4D-4F48-A9B8-47B0DFD07FCC@tzi.org> On 15 May 2014, at 13:35, Lo?c Hoguin wrote: > Erlang doesn't have a representation for NaN, +infinity and -infinity. They should probably be represented as atoms instead. Ran into the same limitation with excbor. I used tuples to represent them, to keep the three values related: def decode_non_finite(0, 0), do: {CBOR.Tag, :float, :inf} def decode_non_finite(1, 0), do: {CBOR.Tag, :float, :"-inf"} def decode_non_finite(_, _), do: {CBOR.Tag, :float, :nan} (where the two parameters are the sign and the mantissa). Gr??e, Carsten From bengt.kleberg@REDACTED Fri May 16 07:12:51 2014 From: bengt.kleberg@REDACTED (Bengt Kleberg) Date: Fri, 16 May 2014 07:12:51 +0200 Subject: [erlang-questions] attach detach from running node via script In-Reply-To: <1400176127.23236.YahooMailNeo@web126705.mail.ne1.yahoo.com> References: <1400176127.23236.YahooMailNeo@web126705.mail.ne1.yahoo.com> Message-ID: <1400217171.4639.5.camel@sekic1152.rnd.ki.sw.ericsson.se> Greetings, Have you looked at using escript? bengt On Thu, 2014-05-15 at 10:48 -0700, Dror Mein wrote: > Hi all, > I'm looking for a way to attach run several erlang commands and detach > from a running node with a script, and print results in the end. > I've tried escript and bash, but I don't know how to script ^D out of > it. > If anyone has a better Idea, I'm willing to listen. > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions From kianseong@REDACTED Fri May 16 08:58:11 2014 From: kianseong@REDACTED (Low Kian Seong) Date: Fri, 16 May 2014 14:58:11 +0800 Subject: [erlang-questions] Questions about zip Message-ID: First of all sorry, I am a beginner and the docs are a bit confusing to me. Can someone tell me what is wrong with this? 2> zip:zip_open('dome.zip', [{'cwd': <<'/home/lowks/Downloads'>>}]) 2> . * 1: illegal expression also The second one gives back ok, but when I check the zip file is still compressed. 4> zip:zip_open("dome.zip"). {ok,<0.40.0>} Some help is greatlly appreciated. Thanks. [image: Low Kian Seong on about.me] Low Kian Seong about.me/lowkianseong -------------- next part -------------- An HTML attachment was scrubbed... URL: From hugo@REDACTED Fri May 16 09:05:04 2014 From: hugo@REDACTED (Hugo Mills) Date: Fri, 16 May 2014 08:05:04 +0100 Subject: [erlang-questions] Questions about zip In-Reply-To: References: Message-ID: <20140516070504.GB25467@carfax.org.uk> On Fri, May 16, 2014 at 02:58:11PM +0800, Low Kian Seong wrote: > First of all sorry, I am a beginner and the docs are a bit confusing to me. > Can someone tell me what is wrong with this? > > 2> zip:zip_open('dome.zip', [{'cwd': <<'/home/lowks/Downloads'>>}]) > 2> . > * 1: illegal expression You have a very strong python accent. :) '' is for quoting atoms. You need "" to quote strings. In addition, the tuple separator (after cwd) is , not : Hugo. > also The second one gives back ok, but when I check the zip file is still > compressed. > > 4> zip:zip_open("dome.zip"). > {ok,<0.40.0>} > > > Some help is greatlly appreciated. Thanks. > > [image: Low Kian Seong on about.me] > > Low Kian Seong > about.me/lowkianseong > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions -- === Hugo Mills: hugo@REDACTED carfax.org.uk | darksatanic.net | lug.org.uk === PGP key: 65E74AC0 from wwwkeys.eu.pgp.net or http://www.carfax.org.uk --- A gentleman doesn't do damage unless he's paid for it. --- -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 811 bytes Desc: Digital signature URL: From erlangdlf@REDACTED Fri May 16 09:07:08 2014 From: erlangdlf@REDACTED (deng lifen) Date: Fri, 16 May 2014 15:07:08 +0800 Subject: [erlang-questions] Questions about zip In-Reply-To: References: Message-ID: <05AFEAD9-4D8C-40C3-A2B6-2F902FC9A1E1@gmail.com> try this: zip:zip_open('dome.zip', [{'cwd', <<'/home/lowks/Downloads'>>}]). ? 2014?5?16??14:58?Low Kian Seong ??? > First of all sorry, I am a beginner and the docs are a bit confusing to me. Can someone tell me what is wrong with this? > > 2> zip:zip_open('dome.zip', [{'cwd': <<'/home/lowks/Downloads'>>}]) > 2> . > * 1: illegal expression > > also The second one gives back ok, but when I check the zip file is still compressed. > > 4> zip:zip_open("dome.zip"). > {ok,<0.40.0>} > > > Some help is greatlly appreciated. Thanks. > > > > Low Kian Seong > about.me/lowkianseong > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions deng lifen erlangdlf@REDACTED -------------- next part -------------- An HTML attachment was scrubbed... URL: From tty.erlang@REDACTED Fri May 16 09:09:28 2014 From: tty.erlang@REDACTED (T Ty) Date: Fri, 16 May 2014 08:09:28 +0100 Subject: [erlang-questions] attach detach from running node via script In-Reply-To: <1400217171.4639.5.camel@sekic1152.rnd.ki.sw.ericsson.se> References: <1400176127.23236.YahooMailNeo@web126705.mail.ne1.yahoo.com> <1400217171.4639.5.camel@sekic1152.rnd.ki.sw.ericsson.se> Message-ID: 1. Write an Erlang module to do exactly what you want with an exported "start/0" function. Within the module use rpc:call or rpc:multicall or rpc:cast. Use bash to call "erl -sname oam -hidden -s modulename". Or escript to do the same. 2. Elixir. Elixir. Elixir. Consider using Elixir. For sys admin related tasks my current general advice is to use Elixir. On Fri, May 16, 2014 at 6:12 AM, Bengt Kleberg wrote: > Greetings, > > Have you looked at using escript? > > > bengt > > On Thu, 2014-05-15 at 10:48 -0700, Dror Mein wrote: > > Hi all, > > I'm looking for a way to attach run several erlang commands and detach > > from a running node with a script, and print results in the end. > > I've tried escript and bash, but I don't know how to script ^D out of > > it. > > If anyone has a better Idea, I'm willing to listen. > > > > > > _______________________________________________ > > erlang-questions mailing list > > erlang-questions@REDACTED > > http://erlang.org/mailman/listinfo/erlang-questions > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From bengt.kleberg@REDACTED Fri May 16 09:12:11 2014 From: bengt.kleberg@REDACTED (Bengt Kleberg) Date: Fri, 16 May 2014 09:12:11 +0200 Subject: [erlang-questions] Questions about zip In-Reply-To: References: Message-ID: <1400224331.4639.10.camel@sekic1152.rnd.ki.sw.ericsson.se> Greetings, In Erlang a ' means that the item is an atom. You probably want " to indicate a string. Also, it would help if you explained the result you expected. Take zip:zip_open/2. It will give you a handle, not unzip anything. bengt On Fri, 2014-05-16 at 14:58 +0800, Low Kian Seong wrote: > First of all sorry, I am a beginner and the docs are a bit confusing > to me. Can someone tell me what is wrong with this? > > 2> zip:zip_open('dome.zip', [{'cwd': <<'/home/lowks/Downloads'>>}]) > 2> . > * 1: illegal expression > > > also The second one gives back ok, but when I check the zip file is > still compressed. > > 4> zip:zip_open("dome.zip"). > {ok,<0.40.0>} > > > > Some help is greatlly appreciated. Thanks. > > Low Kian Seong on > about.me > > Low Kian Seong > about.me/lowkianseong > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions From roger@REDACTED Fri May 16 09:26:09 2014 From: roger@REDACTED (Roger Lipscombe) Date: Fri, 16 May 2014 08:26:09 +0100 Subject: [erlang-questions] BSON parsing? In-Reply-To: <5374A69D.6000109@ninenines.eu> References: <5374A69D.6000109@ninenines.eu> Message-ID: On 15 May 2014 12:35, Lo?c Hoguin wrote: > Erlang doesn't have a representation for NaN, +infinity and -infinity. They > should probably be represented as atoms instead. As it happens, I'm merely passing them through from one IEEE754-supporting process to another. It's an unfortunate side-effect of our protocol that they get unpacked on the way. I've forked bson-erlang and added a representation for these extras so that they make it through with full fidelity -- bear in mind that there's more than one valid representation of NaN :-) Now, if I had to actually _work_ with the numbers in Erlang, that might be painful, but it'll do for us, for now. It further turns out that JSON _doesn't_ support +Inf, -Inf or NaN, either, apparently. From carlsson.richard@REDACTED Fri May 16 09:33:52 2014 From: carlsson.richard@REDACTED (Richard Carlsson) Date: Fri, 16 May 2014 09:33:52 +0200 Subject: [erlang-questions] BSON parsing? In-Reply-To: <1D6F99F2-8CA1-42E2-BEE2-F1FFF467CF80@cs.otago.ac.nz> References: <5374A69D.6000109@ninenines.eu> <1D6F99F2-8CA1-42E2-BEE2-F1FFF467CF80@cs.otago.ac.nz> Message-ID: <5375BF60.9080906@gmail.com> On 2014-05-16 00:44 , Richard A. O'Keefe wrote: > > On 15/05/2014, at 11:35 PM, Lo?c Hoguin wrote: > >> Erlang doesn't have a representation for NaN, +infinity and -infinity. > > Does anyone know why? The only reason I can recall hearing (ages ago) was something along the lines of NaNs and infinities not being something that Ericsson wanted to deal with in telecom switches. I guess we'll have to ask Joe or Robert if they remember. On the other hand, it would probably be straightforward to change the behaviour, and I can't see that a lot of code would break. There could be a flag to erl for backwards compatibility. EEP, anyone? /Richard From erlangdlf@REDACTED Fri May 16 09:33:53 2014 From: erlangdlf@REDACTED (deng lifen) Date: Fri, 16 May 2014 15:33:53 +0800 Subject: [erlang-questions] Questions about zip In-Reply-To: References: <05AFEAD9-4D8C-40C3-A2B6-2F902FC9A1E1@gmail.com> Message-ID: <8A1F3898-98E0-4220-A585-D6408BCC07E0@gmail.com> 1> zip:zip_open("dome.zip", [{cwd, <<"/home/lowks/Downloads">>}]). ? 2014?5?16??15:22?Low Kian Seong ??? > I got this: > > 6> zip:zip_open('dome.zip', [{'cwd', <<'/home/lowks/Downloads'>>}]). > ** exception error: bad argument > > > > > > Low Kian Seong > about.me/lowkianseong > > > > On Fri, May 16, 2014 at 3:07 PM, deng lifen wrote: > try this: > > zip:zip_open('dome.zip', [{'cwd', <<'/home/lowks/Downloads'>>}]). > > > ? 2014?5?16??14:58?Low Kian Seong ??? > >> First of all sorry, I am a beginner and the docs are a bit confusing to me. Can someone tell me what is wrong with this? >> >> 2> zip:zip_open('dome.zip', [{'cwd': <<'/home/lowks/Downloads'>>}]) >> 2> . >> * 1: illegal expression >> >> also The second one gives back ok, but when I check the zip file is still compressed. >> >> 4> zip:zip_open("dome.zip"). >> {ok,<0.40.0>} >> >> >> Some help is greatlly appreciated. Thanks. >> >> >> >> Low Kian Seong >> about.me/lowkianseong >> >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://erlang.org/mailman/listinfo/erlang-questions > > deng lifen > erlangdlf@REDACTED > > > > deng lifen erlangdlf@REDACTED -------------- next part -------------- An HTML attachment was scrubbed... URL: From erlangdlf@REDACTED Fri May 16 09:44:59 2014 From: erlangdlf@REDACTED (deng lifen) Date: Fri, 16 May 2014 15:44:59 +0800 Subject: [erlang-questions] Questions about zip In-Reply-To: References: <05AFEAD9-4D8C-40C3-A2B6-2F902FC9A1E1@gmail.com> <8A1F3898-98E0-4220-A585-D6408BCC07E0@gmail.com> Message-ID: <0351A8A1-E980-4DFE-A054-B90350E3A48D@gmail.com> http://www.erlang.org/doc/man/zip.html#zip_list_dir-1 ? 2014?5?16??15:39?Low Kian Seong ??? > It's better now, I get this: > > 1> zip:zip_open("dome.zip", [{cwd, <<"/home/lowks/Downloads">>}]). > {ok,<0.34.0>} > > but where is the unzipped content anyway ? > > > > > Low Kian Seong > about.me/lowkianseong > > > > On Fri, May 16, 2014 at 3:33 PM, deng lifen wrote: > > 1> zip:zip_open("dome.zip", [{cwd, <<"/home/lowks/Downloads">>}]). > > > ? 2014?5?16??15:22?Low Kian Seong ??? > >> I got this: >> >> 6> zip:zip_open('dome.zip', [{'cwd', <<'/home/lowks/Downloads'>>}]). >> ** exception error: bad argument >> >> >> >> >> >> Low Kian Seong >> about.me/lowkianseong >> >> >> >> On Fri, May 16, 2014 at 3:07 PM, deng lifen wrote: >> try this: >> >> zip:zip_open('dome.zip', [{'cwd', <<'/home/lowks/Downloads'>>}]). >> >> >> ? 2014?5?16??14:58?Low Kian Seong ??? >> >>> First of all sorry, I am a beginner and the docs are a bit confusing to me. Can someone tell me what is wrong with this? >>> >>> 2> zip:zip_open('dome.zip', [{'cwd': <<'/home/lowks/Downloads'>>}]) >>> 2> . >>> * 1: illegal expression >>> >>> also The second one gives back ok, but when I check the zip file is still compressed. >>> >>> 4> zip:zip_open("dome.zip"). >>> {ok,<0.40.0>} >>> >>> >>> Some help is greatlly appreciated. Thanks. >>> >>> >>> >>> Low Kian Seong >>> about.me/lowkianseong >>> >>> _______________________________________________ >>> erlang-questions mailing list >>> erlang-questions@REDACTED >>> http://erlang.org/mailman/listinfo/erlang-questions >> >> deng lifen >> erlangdlf@REDACTED >> >> >> >> > > deng lifen > erlangdlf@REDACTED > > > > deng lifen erlangdlf@REDACTED -------------- next part -------------- An HTML attachment was scrubbed... URL: From kianseong@REDACTED Fri May 16 09:22:27 2014 From: kianseong@REDACTED (Low Kian Seong) Date: Fri, 16 May 2014 15:22:27 +0800 Subject: [erlang-questions] Questions about zip In-Reply-To: <05AFEAD9-4D8C-40C3-A2B6-2F902FC9A1E1@gmail.com> References: <05AFEAD9-4D8C-40C3-A2B6-2F902FC9A1E1@gmail.com> Message-ID: I got this: 6> zip:zip_open('dome.zip', [{'cwd', <<'/home/lowks/Downloads'>>}]). ** exception error: bad argument [image: Low Kian Seong on about.me] Low Kian Seong about.me/lowkianseong On Fri, May 16, 2014 at 3:07 PM, deng lifen wrote: > try this: > > zip:zip_open('dome.zip', [{'cwd', <<'/home/lowks/Downloads'>>}]). > > > ? 2014?5?16??14:58?Low Kian Seong ??? > > First of all sorry, I am a beginner and the docs are a bit confusing to > me. Can someone tell me what is wrong with this? > > 2> zip:zip_open('dome.zip', [{'cwd': <<'/home/lowks/Downloads'>>}]) > 2> . > * 1: illegal expression > > also The second one gives back ok, but when I check the zip file is still > compressed. > > 4> zip:zip_open("dome.zip"). > {ok,<0.40.0>} > > > Some help is greatlly appreciated. Thanks. > > [image: Low Kian Seong on about.me] > > Low Kian Seong > about.me/lowkianseong > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > > > deng lifen > erlangdlf@REDACTED > > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From kianseong@REDACTED Fri May 16 09:39:18 2014 From: kianseong@REDACTED (Low Kian Seong) Date: Fri, 16 May 2014 15:39:18 +0800 Subject: [erlang-questions] Questions about zip In-Reply-To: <8A1F3898-98E0-4220-A585-D6408BCC07E0@gmail.com> References: <05AFEAD9-4D8C-40C3-A2B6-2F902FC9A1E1@gmail.com> <8A1F3898-98E0-4220-A585-D6408BCC07E0@gmail.com> Message-ID: It's better now, I get this: 1> zip:zip_open("dome.zip", [{cwd, <<"/home/lowks/Downloads">>}]). {ok,<0.34.0>} but where is the unzipped content anyway ? [image: Low Kian Seong on about.me] Low Kian Seong about.me/lowkianseong On Fri, May 16, 2014 at 3:33 PM, deng lifen wrote: > > 1> zip:zip_open("dome.zip", [{cwd, <<"/home/lowks/Downloads">>}]). > > > ? 2014?5?16??15:22?Low Kian Seong ??? > > I got this: > > 6> zip:zip_open('dome.zip', [{'cwd', <<'/home/lowks/Downloads'>>}]). > ** exception error: bad argument > > > > [image: Low Kian Seong on about.me] > > Low Kian Seong > about.me/lowkianseong > > > > On Fri, May 16, 2014 at 3:07 PM, deng lifen wrote: > >> try this: >> >> zip:zip_open('dome.zip', [{'cwd', <<'/home/lowks/Downloads'>>}]). >> >> >> ? 2014?5?16??14:58?Low Kian Seong ??? >> >> First of all sorry, I am a beginner and the docs are a bit confusing to >> me. Can someone tell me what is wrong with this? >> >> 2> zip:zip_open('dome.zip', [{'cwd': <<'/home/lowks/Downloads'>>}]) >> 2> . >> * 1: illegal expression >> >> also The second one gives back ok, but when I check the zip file is still >> compressed. >> >> 4> zip:zip_open("dome.zip"). >> {ok,<0.40.0>} >> >> >> Some help is greatlly appreciated. Thanks. >> >> [image: Low Kian Seong on about.me] >> >> Low Kian Seong >> about.me/lowkianseong >> >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://erlang.org/mailman/listinfo/erlang-questions >> >> >> deng lifen >> erlangdlf@REDACTED >> >> >> >> > > deng lifen > erlangdlf@REDACTED > > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From kianseong@REDACTED Fri May 16 10:24:11 2014 From: kianseong@REDACTED (Low Kian Seong) Date: Fri, 16 May 2014 16:24:11 +0800 Subject: [erlang-questions] Questions about zip In-Reply-To: <0351A8A1-E980-4DFE-A054-B90350E3A48D@gmail.com> References: <05AFEAD9-4D8C-40C3-A2B6-2F902FC9A1E1@gmail.com> <8A1F3898-98E0-4220-A585-D6408BCC07E0@gmail.com> <0351A8A1-E980-4DFE-A054-B90350E3A48D@gmail.com> Message-ID: Thank you very much well, for the benefit of others that might be following this thread, let me give a full example of unzipping the "dome.zip" file: 10> {ok, ZipHandle2}=zip:zip_open("dome.zip", [{cwd, <<"/home/lowks/Downloads">>}]). {ok,<0.60.0>} 13> zip:zip_get(ZipHandle3). {ok,[<<"/home/lowks/Downloads/dome.csv">>]} When you check in '/home/lowks/Downloads/' you will see that the 'dome.zip' has been unzipped. the 'zip.zip_get(ZipHandle3).' can be run as many times as you want. Finally to close it, do this: 14> zip:zip_close(ZipHandle3). ok Thanks for the answers. [image: Low Kian Seong on about.me] Low Kian Seong about.me/lowkianseong On Fri, May 16, 2014 at 3:44 PM, deng lifen wrote: > http://www.erlang.org/doc/man/zip.html#zip_list_dir-1 > > > ? 2014?5?16??15:39?Low Kian Seong ??? > > It's better now, I get this: > > 1> zip:zip_open("dome.zip", [{cwd, <<"/home/lowks/Downloads">>}]). > {ok,<0.34.0>} > > but where is the unzipped content anyway ? > > > [image: Low Kian Seong on about.me] > > Low Kian Seong > about.me/lowkianseong > > > > On Fri, May 16, 2014 at 3:33 PM, deng lifen wrote: > >> >> 1> zip:zip_open("dome.zip", [{cwd, <<"/home/lowks/Downloads">>}]). >> >> >> ? 2014?5?16??15:22?Low Kian Seong ??? >> >> I got this: >> >> 6> zip:zip_open('dome.zip', [{'cwd', <<'/home/lowks/Downloads'>>}]). >> ** exception error: bad argument >> >> >> >> [image: Low Kian Seong on about.me] >> >> Low Kian Seong >> about.me/lowkianseong >> >> >> >> On Fri, May 16, 2014 at 3:07 PM, deng lifen wrote: >> >>> try this: >>> >>> zip:zip_open('dome.zip', [{'cwd', <<'/home/lowks/Downloads'>>}]). >>> >>> >>> ? 2014?5?16??14:58?Low Kian Seong ??? >>> >>> First of all sorry, I am a beginner and the docs are a bit confusing to >>> me. Can someone tell me what is wrong with this? >>> >>> 2> zip:zip_open('dome.zip', [{'cwd': <<'/home/lowks/Downloads'>>}]) >>> 2> . >>> * 1: illegal expression >>> >>> also The second one gives back ok, but when I check the zip file is >>> still compressed. >>> >>> 4> zip:zip_open("dome.zip"). >>> {ok,<0.40.0>} >>> >>> >>> Some help is greatlly appreciated. Thanks. >>> >>> [image: Low Kian Seong on about.me] >>> >>> Low Kian Seong >>> about.me/lowkianseong >>> >>> _______________________________________________ >>> erlang-questions mailing list >>> erlang-questions@REDACTED >>> http://erlang.org/mailman/listinfo/erlang-questions >>> >>> >>> deng lifen >>> erlangdlf@REDACTED >>> >>> >>> >>> >> >> deng lifen >> erlangdlf@REDACTED >> >> >> >> > > deng lifen > erlangdlf@REDACTED > > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From thomasl_erlang@REDACTED Fri May 16 10:57:27 2014 From: thomasl_erlang@REDACTED (Thomas Lindgren) Date: Fri, 16 May 2014 01:57:27 -0700 (PDT) Subject: [erlang-questions] BSON parsing? In-Reply-To: <1D6F99F2-8CA1-42E2-BEE2-F1FFF467CF80@cs.otago.ac.nz> References: <5374A69D.6000109@ninenines.eu> <1D6F99F2-8CA1-42E2-BEE2-F1FFF467CF80@cs.otago.ac.nz> Message-ID: <1400230647.69745.YahooMailNeo@web140103.mail.bf1.yahoo.com> On the positive side, doing "dirty" floating point like current Erlang means you don't have to manage or keep up with the strange cruft and corner cases of a rabbit hole far from the erlang core, so I can sort of see the (f.) point. Yet ultimately I consider it a mistaken design choice. Being dirty, you don't have to think about things like NaNs, infinities, denormalized numbers, fp according to?ISO/IEC 9899:TC3 Section 7.6, tracking the evolution of fp standards or what to do about "SEE ALSO ?? ? fenv(3), feclearexcept(3), fegetenv(3), fegetexceptflag(3), feholdexcept(3), ? ? ?fesetenv(3), feraiseexcept(3), fesetexceptflag(3), feraiseexcept(3), feupdateenv(3)" (Any choice you make beyond providing that is probably a liability.) Nevertheless, IEEE arithmetic is the standard and I think we'd at least want to represent and operate on standard floating point.? Best, Thomas On Friday, May 16, 2014 12:44 AM, Richard A. O'Keefe wrote: > > > >On 15/05/2014, at 11:35 PM, Lo?c Hoguin wrote: > >> Erlang doesn't have a representation for NaN, +infinity and -infinity. > >Does anyone know why? > >I've used Smalltalk systems which say "If non-IEEE arithmetic >was good enough for Granddad, it's good enough for me.? SNIFF!" >and Smalltalk systems which say "Standard since 1985, available >everywhere, even on IBM z/Series, what earthly excuse could >there be for NOT presenting IEEE arithmetic?" > >And the ones that don't hide infinities and NaNs turn out to be >easier to use. > >Why? > >Well, if I have straightforward numeric code, I'm going to >write it so that infinities and NaNs don't happen, so the >only downside to being nonstandard is the extra run-time cost. >But in fact very little numeric code is _that_ straightforward. >Using a Smalltalk that respects the standard, I can take working >numeric code in C or Fortran and convert it with very little >effort and it will do the SAME thing.? Using a Smalltalk that >does not respect the standard, I have to analyse every >operation to make sure that it will work. > >In fact my own Smalltalk library includes some vectorised >operations on specialised arrays, and it really would NOT >be safe to switch from an Array that happens to hold >FloatE objects to a FloatEArray if the arithmetic could be >different in any way. > >Conversely, if I have some numeric code written in Erlang, >it would be nice to be able to translate it to C and link >it in.? But making floating point semantics *different* in >Erlang and C makes this rather dangerous. > >Is Erlang running these days on *any* hardware platform >that doesn't have IEEE arithmetic? > > >_______________________________________________ >erlang-questions mailing list >erlang-questions@REDACTED >http://erlang.org/mailman/listinfo/erlang-questions > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From thomasl_erlang@REDACTED Fri May 16 10:59:22 2014 From: thomasl_erlang@REDACTED (Thomas Lindgren) Date: Fri, 16 May 2014 01:59:22 -0700 (PDT) Subject: [erlang-questions] BSON parsing? In-Reply-To: <1400230647.69745.YahooMailNeo@web140103.mail.bf1.yahoo.com> References: <5374A69D.6000109@ninenines.eu> <1D6F99F2-8CA1-42E2-BEE2-F1FFF467CF80@cs.otago.ac.nz> <1400230647.69745.YahooMailNeo@web140103.mail.bf1.yahoo.com> Message-ID: <1400230762.39816.YahooMailNeo@web140106.mail.bf1.yahoo.com> Those who need to store or pass around NaNs and infinities today can hold their noses and keep the raw floats as binaries. Hardly ideal, but it gets the job done. Best, Thomas On , Thomas Lindgren wrote: > > >On the positive side, doing "dirty" floating point like current Erlang means you don't have to manage or keep up with the strange cruft and corner cases of a rabbit hole far from the erlang core, so I can sort of see the (f.) point. Yet ultimately I consider it a mistaken design choice. > > >Being dirty, you don't have to think about things like NaNs, infinities, denormalized numbers, fp according to?ISO/IEC 9899:TC3 Section 7.6, tracking the evolution of fp standards or what to do about > > >"SEE ALSO >?? ? fenv(3), feclearexcept(3), fegetenv(3), fegetexceptflag(3), feholdexcept(3), >? ? ?fesetenv(3), feraiseexcept(3), fesetexceptflag(3), feraiseexcept(3), feupdateenv(3)" > > >(Any choice you make beyond providing that is probably a liability.) > > >Nevertheless, IEEE arithmetic is the standard and I think we'd at least want to represent and operate on standard floating point.? > > >Best, > >Thomas >On Friday, May 16, 2014 12:44 AM, Richard A. O'Keefe wrote: > > >> >> >> >>On 15/05/2014, at 11:35 PM, Lo?c Hoguin wrote: >> >>> Erlang doesn't have a representation for NaN, +infinity and -infinity. >> >>Does anyone know why? >> >>I've used Smalltalk systems which say "If non-IEEE arithmetic >>was good enough for Granddad, it's good enough for me.? SNIFF!" >>and Smalltalk systems which say "Standard since 1985, available >>everywhere, even on IBM z/Series, what earthly excuse could >>there be for NOT presenting IEEE arithmetic?" >> >>And the ones that don't hide infinities and NaNs turn out to be >>easier to use. >> >>Why? >> >>Well, if I have straightforward numeric code, I'm going to >>write it so that infinities and NaNs don't happen, so the >>only downside to being nonstandard is the extra run-time cost. >>But in fact very little numeric code is _that_ straightforward. >>Using a Smalltalk that respects the standard, I can take working >>numeric code in C or Fortran and convert it with very little >>effort and it will do the SAME thing.? Using a Smalltalk that >>does not respect the standard, I have to analyse every >>operation to make sure that it will work. >> >>In fact my own Smalltalk library includes some vectorised >>operations on specialised arrays, and it really would NOT >>be safe to switch from an Array that happens to hold >>FloatE objects to a FloatEArray if the arithmetic could be >>different in any way. >> >>Conversely, if I have some numeric code written in Erlang, >>it would be nice to be able to translate it to C and link >>it in.? But making floating point semantics *different* in >>Erlang and C makes this rather dangerous. >> >>Is Erlang running these days on *any* hardware platform >>that doesn't have IEEE arithmetic? >> >> >>_______________________________________________ >>erlang-questions mailing list >>erlang-questions@REDACTED >>http://erlang.org/mailman/listinfo/erlang-questions >> >> > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From ok@REDACTED Fri May 16 12:56:57 2014 From: ok@REDACTED (Richard A. O'Keefe) Date: Fri, 16 May 2014 22:56:57 +1200 Subject: [erlang-questions] BSON parsing? In-Reply-To: <1400230762.39816.YahooMailNeo@web140106.mail.bf1.yahoo.com> References: <5374A69D.6000109@ninenines.eu> <1D6F99F2-8CA1-42E2-BEE2-F1FFF467CF80@cs.otago.ac.nz> <1400230647.69745.YahooMailNeo@web140103.mail.bf1.yahoo.com> <1400230762.39816.YahooMailNeo@web140106.mail.bf1.yahoo.com> Message-ID: On 16/05/2014, at 8:59 PM, Thomas Lindgren wrote: > Those who need to store or pass around NaNs and infinities today can hold their noses and keep the raw floats as binaries. Hardly ideal, but it gets the job done. For "storing or passing around" floating point values, you can keep them *all* as binaries. The problem is *computation*. IEEE arithmetic is weird, but it is weird for good reason. Admittedly JSON doesn't provide any official way to notate ?Infinity, but then JSON has very little in the way of semantics for numbers anyway. Someone wanting to send Infinity might well send 1.0e400, and they'd be surprised and dismayed to get an exception instead of an Infinity. From alanrevans@REDACTED Fri May 16 16:18:05 2014 From: alanrevans@REDACTED (Alan Evans) Date: Fri, 16 May 2014 15:18:05 +0100 Subject: [erlang-questions] Problem compiling CAMEL v2 ASN.1 files - SOLVED In-Reply-To: <5374FB68.1060809@gmail.com> References: <5374FB68.1060809@gmail.com> Message-ID: <53761E1D.2060603@gmail.com> SUCCESS The trick was to remove all the PARAMETER-BOUND stuff and then use IN-CS1-datatypes.asn rather than CAP-datatypes.asn After that there was only a little bit of tweaking and now I have an erl file that exports all the CAMEL Operations. Don't know if it works yet but it's very encouraging. If anyone needs the asn files drop me a line, I'll be happy to share. Regards AlanE On 15/05/2014 06:37:PM, Alan Evans wrote: > Hello everyone, > > I don't suppose anyone out there has a set of 3GPP CAMEL ASN.1 files > that the erlang asn compiler can compile and export an enc_InitialDP() > function? > I've been going around and around in circles all day trying to get > this work but I'm failing miserably. > > My current problem is that the initialDP OPERATION in > CAP-gsmSSF-gsmSCF-ops-args.asn is a parametrised type. > > The Erlang asn compiler docs state: > "Note that the compiler does not generate encode/decode functions for > parameterized types, but only for the instances of the parameterized > types" > > I can't for the life of me figure out how to create an instance from this. > > Many thanks in advance. > > AlanE -------------- next part -------------- An HTML attachment was scrubbed... URL: From zxq9@REDACTED Fri May 16 16:30:51 2014 From: zxq9@REDACTED (zxq9) Date: Fri, 16 May 2014 23:30:51 +0900 Subject: [erlang-questions] literal character syntax In-Reply-To: References: <1419556.oXnLqJ1Ur6@jalapeno> Message-ID: <4432439.UmNban0FWi@jalapeno> On Thursday 15 May 2014 12:36:43 you wrote: > $ gg -i "stupid emacs" -- \*.erl > lib/compiler/src/cerl.erl:994: io_lib:write_string(atom_name(Node), $'). > %' stupid Emacs. lib/compiler/src/core_scan.erl:96:string_thing($') -> > "atom"; %' stupid emacs > lib/compiler/src/core_scan.erl:97:string_thing($") -> "string". %" stupid > emacs > lib/dialyzer/test/opaque_SUITE_data/src/modules/opaque_erl_scan.erl:313:str > ing_thing($') -> "atom"; %' Stupid Emacs > lib/dialyzer/test/options1_SUITE_data/src/compiler/cerl.erl:843: > io_lib:write_string(atom_name(Node), $'). %' stupi > lib/edoc/src/edoc_wiki.erl:238:expand_triple([$', $', $' | Cs], L, As, _L0) > -> % ' stupid emacs lib/hipe/cerl/erl_types.erl:4798: true -> > io_lib:write_string(atom_to_list(X), $'); % stupid emacs ' > lib/stdlib/src/erl_scan.erl:331:string_thing($') -> "atom"; %' Stupid > Emacs lib/syntax_tools/src/erl_prettypr.erl:1011: > lay_string_1([$" | S2], L - W + 1, W)) %" stupid emacs Some work in the emacs mode calling? > The whole point of Erlang was always to make silly things quite hard to do. > Allowing a literal newline is a silly thing to do that can be forbidden > easily. Claiming that tools currently work correctly is irrelevant, and > also wrong. And why would that be related to editors anyway? Some tools work well, other don't. That is a tooling issue, not a language one. The tooling argument will never satisfy me, especially when it is centered around a single language mode in a single editor no matter how popular. In my experience most flaws that tend to matter are inherent in the coder's conception or the project at hand (standards or lack of them), hence my point about coding practices trumping tooling and syntactic rules in all cases. > What do you mean by ? our conception of whitespace ?? How can that change? > Whitespace is whitespace. No. "Whitespace" means a whole slew of things, including, in this case, "non printable characters". "Whitespace" and "non-printable characters" are uselessly broad definitions in the days of unicode Erlang. Were you taught how to write a space in school? How about how to write a tab? Columnar delimitation? How large is a space in a file? Is that a property of the character or the way in which it is displayed? Is whitespace even a "character (set)"? Where I live kids actually are taught precisely how large a space is supposed to be in handwritten text -- but only when writing Kana/Kanji (and this difference extends to source files -- double-width space is a pain to find the codepoint for, but its different than a normal ASCII space). Back when most of us started with computers we were subject to whatever monospace fonts could print in ASCII in an arbitrarily delimited screen mode. Most of us still code that way. But some terminals don't use monospace, some editors let you use "printer" fonts, some delimit tabs in something radically different than the size of N-spaces, etc. There are a huge number of interpretations of what "whitespace" means -- just ask a typesetter. If our conception of the meaning of "whitespace" in source changes even a little then this outlawing of whitespace literals will likely appear backward (but fortunately undoable without breaking backward compatibility in the way the change under consideration will). Vlad brought up an excellent point about some editors which automatically replace spaces with tabs and vice-versa. This is an issue in several communities (Python, for example), and one that has been well addressed by coding practices, not language restrictions. It is also a tooling issue, not a language one. > I also have troubles understanding how Erlang doesn?t already impose *A LOT* > of things. I don't really see Erlang as a language that imposes discipline on the programmer. I do see a lot of other languages trying to impose discipline on programmers and failing marvelously for the simple reason that it will always be possible to write obfuscated or old-fashioned bad code. My intention was to point out that while using "$ " or "$ " is a stupid thing to do in most cases when "$\s" and "$\t" are available as alternatives, this is a tribal/coder issue not a problem inherent in the language waiting for a parsing solution. Should certain types of guards be similarly disallowed when pattern matches are clearly more readable? How about other situations where equivalent representations are available, but one is clearly more expressive by the standards of the people who frequent this list (but perhaps not all others)? Sound coding practices trump syntax rules. If we agree that coding practices are usually more tribal/situational than they are provably superior, then I think its rather obvious that instead of tweaking the parser to introduce a backward-incompatible change in the language implementation (or definition!) the proper thing to do is note that the "standard" way to note non-printable characters is with backslash escapes, perhaps by amending http://www.erlang.se/doc/programming_rules.shtml. This leaves the option for projects operating under different constraints with different tooling to do things appropriate for themselves. It seems like the general feeling is to impose a new restriction in the language. Its not a game-changer either way, but I wanted to present a case for not introducing special-case rules that outlaw a rather broader category of characters than the OP may have realized in one very specific circumstance -- just to make sure this is thoroughly considered before someone spends time tinkering with the parser yet again. From essen@REDACTED Fri May 16 16:35:49 2014 From: essen@REDACTED (=?UTF-8?B?TG/Dr2MgSG9ndWlu?=) Date: Fri, 16 May 2014 16:35:49 +0200 Subject: [erlang-questions] literal character syntax In-Reply-To: <53737E68.9050809@erlang.org> References: <20140514141535.GF1684@ferdair.local> <53737E68.9050809@erlang.org> Message-ID: <53762245.1090608@ninenines.eu> On 05/14/2014 04:32 PM, Bj?rn-Egil Dahlberg wrote: > On 2014-05-14 16:15, Fred Hebert wrote: >> I think the argument here is specifically about whitespace characters. >> >> For example, using: >> >> starts_with([$ | _]) -> space; >> starts_with([$ | _]) -> tab; >> starts_with([$ >> |_]) -> newline. >> >> Is currently allowed, but it is arguably clearer to use: >> >> starts_with([$\s | _]) -> space; >> starts_with([$\t | _]) -> tab. >> starts_with([$\n | _]) -> newline. >> >> Vlad here recommends deprecating the former case, while recommending the >> latter form. >> >> I would tend to agree for the sake of readability, but would like a >> regular deprecation cycle with warnings explaining the recommended >> changes ("The $ form is being deprecated, replace with $\s" or >> something). > I like this proposal. > > I don't know how fast we could remove $ , $ , etc (earliest 19?) but > we could certainly emit irritating deprecation warnings that make people > want to fix their code. Considering the feedback so far and not everyone being happy about it, how about just leaving it in, but add a normal warning and enable it by default? By the way, how does $ behave when used with a unicode character? -- Lo?c Hoguin http://ninenines.eu From cabo@REDACTED Fri May 16 16:42:52 2014 From: cabo@REDACTED (Carsten Bormann) Date: Fri, 16 May 2014 16:42:52 +0200 Subject: [erlang-questions] literal character syntax In-Reply-To: <53762245.1090608@ninenines.eu> References: <20140514141535.GF1684@ferdair.local> <53737E68.9050809@erlang.org> <53762245.1090608@ninenines.eu> Message-ID: <1932C147-71CA-4AB3-A798-4F1BA5BE77A2@tzi.org> On 16 May 2014, at 16:35, Lo?c Hoguin wrote: > unicode character (I think you mean non-ASCII character, but with the unfortunate detour of Erlang into Latin-1-land maybe you mean non-ISO-8859-1-character. All characters that Erlang can process are Unicode characters, including ASCII and Latin-1 characters.) It just works (for single-codepoint characters*), not for composites). $ erl Erlang/OTP 17 [erts-6.0] [source] [64-bit] [smp:8:8] [async-threads:10] [hipe] [kernel-poll:false] [dtrace] Eshell V6.0 (abort with ^G) 1> $??. 128163 2> Gr??e, Carsten *) Characters don?t actually exist, only strings do, but that is a long story. From egil@REDACTED Fri May 16 16:43:29 2014 From: egil@REDACTED (=?ISO-8859-1?Q?Bj=F6rn-Egil_Dahlberg?=) Date: Fri, 16 May 2014 16:43:29 +0200 Subject: [erlang-questions] noproc gen_server cowboy In-Reply-To: References: <53705D02.3010207@ninenines.eu> <3CE80112-FA7E-4F0F-8E66-F84B61B3A10C@bitbuilder.com> Message-ID: <53762411.8080304@erlang.org> I thought I would report here whats happening in this particular case. The problem is the following code: in $ERL_TOP/erts/emulator/drivers/unix/unix_efile.c:497-502 ... #if SIZEOF_OFF_T == 4 pInfo->size_high = 0; #else pInfo->size_high = (Uint32)(statbuf.st_size >> 32); // <- there it is #endif pInfo->size_low = (Uint32)statbuf.st_size; ... This piece of code expects struct stat.st_size to be of type off_t. I don't know if I can count on the man-page being correct when declaring that stat st_size is of type off_t? Is it always the correct .. probably a bad assumption. If sizeof(off_t) is 8 (e.g. not 4), this will be executed, pInfo->size_high = (Uint32)(statbuf.st_size >> 32) but if sizeof(statbuf.st_size) is 4 then we have a problem sincestatbuf.st_size >> 32 will result in an undefined behaviour. In this case it will do nothing and happily copy down the value in high. Hence the 32-bit duplication seen up in the shell from file:read_file_info/1. // Bj?rn-Egil On 2014-05-14 05:57, Ahmad Baitalmal wrote: > Bj?rn, > What kind of arch are you running on? > > I'm running on a Ralink RT3052 (MIPS 24KEc V4.12). > > > On Tue, May 13, 2014 at 5:36 PM, Bj?rn-Egil Dahlberg > > > wrote: > > Oh no .. trouble in paradise. > > I see the same duplication problem here (nice catch Erik), > > 1> <> = <<15990163246731:64>>, {I1,I2}. > {3723,3723} > > Which leads me to think there is a problem in int > efile_fileinfo(...) with the highs and lows. > > > > > > > 2014-05-14 0:02 GMT+02:00 Ahmad Baitalmal >: > > Thanks Erik, > > I did a bit more digging, The call for file:read_file_info in > cowboy_static.erl is returning this: > > {ok,{file_info,15990163246731,regular,read_write, > {{2014,5,13},{20,51,46}}, > {{2014,5,9},{19,57,47}}, > {{2014,5,13},{19,46,18}}, > 33188,1,2049,0,1704124,0,0}} > > The file is only 3723 bytes. I verified this also on an erl > shell. Same result. > > So it looks like something is up in kernel-3.0/file.erl when > running on a mipsel chip. > > Everything else is working, except for this file size issue. > Oh and the body is empty. > > For now, I plan on using an onresponse hook to load up the > file and fix the content-length as it goes out. :( Not ideal... > > ______________ > *Ahmad Baitalmal* > *CEO & Co-Founder* > *BitBuilder.com * > 650.539.9401 > > On May 13, 2014, at 1:13 AM, Erik S?e S?rensen > > wrote: > >> It's not just a reverse-endian'ed size... >> 458453399216374 = 0x'0001'A0F6'0001'A0F6 -- weird duplication... >> (0x1A0F6 = 106742 = 104.2KB, so that part fits.) >> >> >> 2014-05-13 1:10 GMT+02:00 Ahmad Baitalmal >> >: >> >> Thanks Lo?c, >> >> It now runs and I can connect. I thought I read somewhere >> that relx automatically started the related apps. I guess >> it doesn't always. >> >> There is something wrong still, I'm getting this error >> for all files in the browser. >> net::ERR_CONTENT_LENGTH_MISMATCH >> >> I checked the headers and cowboy is reporting the header >> "*Content-Length:* 458453399216374" for a file that is >> only 104K. >> >> Could this be a problem with cowboy running on a >> little-endian machine (mipsel)? >> >> Thanks, >> >> >> On Sun, May 11, 2014 at 10:32 PM, Lo?c Hoguin >> > wrote: >> >> You didn't start the cowboy dependencies, I'm not >> sure how it could have worked on your Mac. Cowboy >> requires crypto, cowlib and ranch to be started to >> run. Try application:ensure_all_started(cowboy) >> instead and it'll do that for you. >> >> >> On 05/12/2014 02:20 AM, Ahmad Baitalmal wrote: >> >> Hi, >> Im going crazy trying to solve this. >> >> Works on my Mac, but when I copy to a linux >> router (OpenWRT, R17, cowboy >> 0.9.0) it give me the error below. >> Is this a cowboy or erlang gen_server issue? >> I tried http, same result. So it's not an ssl >> issue. I can't tell what >> the error is... >> >> >> % --------------------- This is my app code that >> starts cowboy >> -module(onion_app). >> -behavior(application). >> -export([start/2]). >> -export([stop/0]). >> -export([stop/1]). >> -include("common.hrl"). >> >> start(_Type, _Args) -> >> application:start(cowboy), >> Dispatch = cowboy_router:compile([ >> {'_', [ >> {"/", cowboy_static, {priv_file, onion >> ,"index.html"}}, >> {"/[...]", cowboy_static, {priv_dir, onion , ""}} >> ]} >> ]), >> RootDir = code:root_dir(), >> Port = 443, >> cowboy:start_https(my_https_listener, 10,[ >> {port, Port}, >> {certfile, RootDir ++ "/ssl/onion.crt"}, >> {keyfile, RootDir ++ "/ssl/onion.key"} >> ], >> [ >> {env, [{dispatch, Dispatch}]} >> ] >> ) >> onion_sup:start_link(). >> stop(_State) -> >> ok. >> >> >> % --------------------- I'm getting this error :( >> Exec: /mnt/sda1/onion/erts-6.0/bin/erlexec -boot >> /mnt/sda1/onion/releases/1/onion -env ERL_LIBS >> /mnt/sda1/onion/releases/1/lib -config >> /mnt/sda1/onion/releases/1/sys.config -args_file >> /mnt/sda1/onion/releases/1/vm.args -- console >> >> =INFO REPORT==== 11-May-2014::03:45:55 === >> application: onion >> exited: {bad_return, >> {{onion_app,start,[normal,[]]}, >> {'EXIT', >> {noproc, >> {gen_server,call, >> [ranch_sup, >> {start_child, >> {{ranch_listener_sup,my_https_listener}, >> {ranch_listener_sup,start_link, >> [my_https_listener,10,ranch_ssl, >> [{port,443}, >> {certfile,"/mnt/sda1/onion/ssl/onion.crt"}, >> {keyfile,"/mnt/sda1/onion/ssl/onion.key"}], >> cowboy_protocol, >> [{env, >> [{dispatch, >> [{'_',[], >> [{[],[],cowboy_static, >> {priv_file,onion,"index.html"}}, >> {[<<"tomato">>,'...'],[],tomato,[tomato]}, >> {['...'], >> [],cowboy_static, >> {priv_dir,onion,[]}}]}]}]}]]}, >> permanent,5000,supervisor, >> [ranch_listener_sup]}}, >> infinity]}}}}} >> type: permanent >> Eshell V6.0 (abort with ^G) >> (onion@REDACTED)1> {"Kernel pid >> terminated",application_controller,"{application_start_failure,onion,{bad_return,{{onion_app,start,[normal,[]]},{'EXIT',{noproc,{gen_server,call,[ranch_sup,{start_child,{{ranch_listener_sup,my_https_listener},{ranch_listener_sup,start_link,[my_https_listener,10,ranch_ssl,[{port,443},{certfile,\"/mnt/sda1/onion/ssl/onion.crt\"},{keyfile,\"/mnt/sda1/onion/ssl/onion.key\"}],cowboy_protocol,[{env,[{dispatch,[{'_',[],[{[],[],cowboy_static,{priv_file,onion,\"index.html\"}},{['...'],[],cowboy_static,{priv_dir,onion,[]}}]}]}]}]]},permanent,5000,supervisor,[ranch_listener_sup]}},infinity]}}}}}}"} >> >> >> Thanks, >> >> -- >> Ahmad >> ___________ >> 650.539.9395 >> >> Sent from my iPhon >> >> >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> >> http://erlang.org/mailman/listinfo/erlang-questions >> >> >> -- >> Lo?c Hoguin >> http://ninenines.eu >> >> >> >> >> -- >> Ahmad >> ___________ >> 650.539.9395 >> >> Sent from my iPhone >> >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> >> http://erlang.org/mailman/listinfo/erlang-questions >> >> > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > > > > > > -- > Ahmad > ___________ > 650.539.9395 > > Sent from my iPhone > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions -------------- next part -------------- An HTML attachment was scrubbed... URL: From vladdu55@REDACTED Fri May 16 16:43:35 2014 From: vladdu55@REDACTED (Vlad Dumitrescu) Date: Fri, 16 May 2014 16:43:35 +0200 Subject: [erlang-questions] literal character syntax In-Reply-To: <53762245.1090608@ninenines.eu> References: <20140514141535.GF1684@ferdair.local> <53737E68.9050809@erlang.org> <53762245.1090608@ninenines.eu> Message-ID: On Fri, May 16, 2014 at 4:35 PM, Lo?c Hoguin wrote: > By the way, how does $ behave when used with a unicode character? It woks as expected: 4> $?. 1406 /Vlad -------------- next part -------------- An HTML attachment was scrubbed... URL: From icfp.publicity@REDACTED Fri May 16 22:26:46 2014 From: icfp.publicity@REDACTED (David Van Horn) Date: Fri, 16 May 2014 16:26:46 -0400 Subject: [erlang-questions] ICFP 2014 Student Research Competition: Call for Submissions Message-ID: ====================================================================== CALL FOR SUBMISSION SRC@REDACTED 2014 Gothenburg, Sweden 1-3 September 2014 http://www.icfpconference.org/icfp2014/src.html Co-located with the International Conference on Functional Programming (ICFP 2014) ====================================================================== Student Research Competition ------------------------ This year ICFP will host a Student Research Competition where undergraduate and postgraduate students can present posters. The SRC at the ICFP 2014 consists of three rounds: Extended abstract round: All students are encouraged to submit an extended abstract outlining their research (800 words). Poster session at ICFP 2014: Based on the abstracts, a panel of judges will select the most promising entrants to participate in the poster session which will take place at ICFP. Students who make it to this round will be eligible for some travel support to attend the conference. In the poster session, students will have the opportunity to present their work to the judges, who will select three finalists in each category* (graduate/undergraduate) to advance to the next round. ICFP presentation: The last round will consist of an oral presentation at the ICFP to compete for the final awards in each category. Prizes ----- * Both the top three graduate and the top three undergraduate winners will receive prizes of $500, $300, and $200, respectively. * All six winners will receive award medals and a two-year complimentary ACM student membership, including a subscription to ACM???s Digital Library. * The names of the winners will be posted on the SRC web site. * The overall first place winner of the SRC will be invited to participate in the ACM SRC Grand Finals, an on-line round of competitions among the winners of other conference-hosted SRCs. * Grand Finalists and their advisors will be invited to the Annual ACM Awards Banquet for an all-expenses-paid trip, where they will be recognized for their accomplishments along with other prestigious ACM award winners, including the winner of the Turing Award (also known as the Nobel Prize of Computing). * The top three graduate Grand Finalists will receive an additional $500, $300, and $200. Likewise, the top three undergraduate Grand Finalists will receive an additional $500, $300, and $200. All six Grand Finalists will receive Grand Finalist certificates. * The ACM, Microsoft Research, and our industrial partners provide financial support for students attending the SRC. You can find more information about this on the ACM website. Eligibility -------- The SRC is open to both undergraduate (not in a PhD programme) and graduate students (in a PhD programme). Upon submission, entrants must be enrolled as a student at their universities, and are ACM student members. Furthermore, there are some constraints on what kind of work may be submitted. Previously published work: Submissions should consist of original work (not yet accepted for publication). If the work is a continuation of previously published work, the submission should focus on the contribution over what has already been published. We encourage students to see this as an opportunity to get early feedback and exposure for the work they plan to submit to the next ICFP or POPL. Collaborative work: Students are encouraged to submit work they have been conducting in collaboration with others, including advisors, internship mentors, or other students. However, submissions are individual, so they must focus on the contributions of the student. Submission Details --------------- Each submission should include the student author???s name, institutional affiliation, e-mail address, and postal address; research advisor???s name; ACM student member number; category (undergraduate or graduate); research title; and an extended abstract addressing the following: * Problem and Motivation: Clearly state the problem being addressed and explain the reasons for seeking a solution to this problem. * Background and Related Work: Describe the specialized (but pertinent) background necessary to appreciate the work. Include references to the literature where appropriate, and briefly explain where your work departs from that done by others. * Approach and Uniqueness: Describe your approach in attacking the problem and clearly state how your approach is novel. * Results and Contributions: Clearly show how the results of your work contribute to computer science and explain the significance of those results. The abstract must describe the student???s individual research and must be authored solely by the student. If the work is collaborative with others and/or part of a larger group project, the abstract should make clear what the student???s role was and should focus on that portion of the work. The extended abstract must not exceed 800 words and must not be longer than 2 pages. The reference list does not count towards these limits. To submit an abstract, please register through the submission page and follow the instructions. Abstracts submitted after the deadline may be considered at the committee's discretion, but only after decisions have been made on all abstracts submitted before the deadline. If you have any problems, don't hesitate to contact the competition chair. Important Dates ------------- * Deadline for submission: 29 June * Notification of acceptance: 14 July Selection Committee ---------------- Jeremy Gibbons, University of Oxford Andrew Kennedy, Microsoft Research Cambridge Matthieu Sozeau, INRIA Paris Sam Tobin-Hochstadt, Indiana University Meng Wang, Chalmers University of Technology (Chair) Stephanie Weirich, University of Pennsylvania Transport of your poster ------------------- You can either bring your poster on your own to the conference or mail it to the local organizers: Attn.: Meng Wang Chalmers University of Technology Department of Computer Science and Engineering SE-412 96 G?teborg, Sweden If you choose to mail, please make sure that the poster will arrive at the latest on 30th August 2014. From mallen@REDACTED Fri May 16 23:48:04 2014 From: mallen@REDACTED (Mark Allen) Date: Fri, 16 May 2014 16:48:04 -0500 Subject: [erlang-questions] gen_leader status Message-ID: Is https://github.com/chenyu468/gen_leader_revival the "best" repo for a leader election behavior? Is there a better (more up-to-date) fork of this or some other implementation that we should consider instead? Thanks. Mark From cmeiklejohn@REDACTED Sat May 17 03:41:57 2014 From: cmeiklejohn@REDACTED (Chris Meiklejohn) Date: Fri, 16 May 2014 21:41:57 -0400 Subject: [erlang-questions] gen_leader status In-Reply-To: References: Message-ID: I wasn't aware of any that provided a proven correct implementation, but that might have changed since I last researched it last year. - Chris On Fri, May 16, 2014 at 5:48 PM, Mark Allen wrote: > Is https://github.com/chenyu468/gen_leader_revival the "best" repo for a > leader election behavior? > > Is there a better (more up-to-date) fork of this or some other > implementation that we should consider instead? > > Thanks. > > Mark > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions From vladdu55@REDACTED Sat May 17 11:38:39 2014 From: vladdu55@REDACTED (Vlad Dumitrescu) Date: Sat, 17 May 2014 11:38:39 +0200 Subject: [erlang-questions] warnings for "not recommended" usage of language constructs Message-ID: Hi all, Related to my previous post about literal whitespace characters, I wonder if it might be a solution acceptable to most (all?) people to add compiler options to control if such usage will emit warnings or not. This way one can choose to go on as before or to get informed when there are controversial constructs in the code. At the moment I have two suggestions for such constructs: - literal whitespace characters - "ill-behaved" macros best regards, Vlad -------------- next part -------------- An HTML attachment was scrubbed... URL: From vladdu55@REDACTED Sat May 17 11:52:24 2014 From: vladdu55@REDACTED (Vlad Dumitrescu) Date: Sat, 17 May 2014 11:52:24 +0200 Subject: [erlang-questions] EEP process Message-ID: Hi, I went looking through the list of EEPs today and found out that there are several that I didn't know about, there have been no discussions about them. Some are old, but there is no resolution about them. Some have been implemented, but are not listed as such. Is there an official "EEP review board"? How often are EEPs reviewed? Should there be an automated (tri-monthly?) message to the eep mailing list listing the status of all current EEPs and drafts? This can work as a gentle reminder to EEP champions to try to get community comments about their drafts so that they can be accepted or rejected. Should there be a new status for an EEP with the meaning "this is all well, we like/want it, but we need a reference implementation"? Maybe someone else than the champion feels like stepping in and provide a reference implementation. best regards, Vlad -------------- next part -------------- An HTML attachment was scrubbed... URL: From adelzhang@REDACTED Sat May 17 11:50:37 2014 From: adelzhang@REDACTED (Adel Zhang) Date: Sat, 17 May 2014 17:50:37 +0800 Subject: [erlang-questions] erlang assembly code reference Message-ID: Compiler would generate assembly code with 'S' option. Is there erlang assembly code reference? From zxq9@REDACTED Sat May 17 15:58:23 2014 From: zxq9@REDACTED (zxq9) Date: Sat, 17 May 2014 22:58:23 +0900 Subject: [erlang-questions] warnings for "not recommended" usage of language constructs In-Reply-To: References: Message-ID: <5978892.qp1yM9FWPQ@jalapeno> On Saturday 17 May 2014 11:38:39 Vlad Dumitrescu wrote: > Hi all, > > Related to my previous post about literal whitespace characters, I wonder > if it might be a solution acceptable to most (all?) people to add compiler > options to control if such usage will emit warnings or not. This way one > can choose to go on as before or to get informed when there are > controversial constructs in the code. > > At the moment I have two suggestions for such constructs: > > - literal whitespace characters > - "ill-behaved" macros The more information we can get from the environment (build tools, compiler, runtime, etc.) the better. Warnings, build status, dead code locations, etc. The more the better. This is especially true in controversial cases like the literal whitespace one that could so easily go unnoticed. I'm particularly fond of having the option of a logically independent lint- type pre-processing step that checks if code is conforming to whatever the community canon is and raises warnings (or interrupts the build, etc.) before the compiler gets a hold of the code. The reason I like this way more than making everything a compiler warning is that it leaves the compiler implementation logically dependent only on the language definition, and the linting process free to embrace as much arbitrary knowledge from the community as the implementers have time for. It also leaves the option of different linters/rules to be inserted in that step instead of only leaving room for the One True Way and drastically limits the size of the compiler manpage by preventing compiler option proliferation over time. From zxq9@REDACTED Sat May 17 16:03:54 2014 From: zxq9@REDACTED (zxq9) Date: Sat, 17 May 2014 23:03:54 +0900 Subject: [erlang-questions] EEP process In-Reply-To: References: Message-ID: <3666726.duSDdvFHgL@jalapeno> On Saturday 17 May 2014 11:52:24 Vlad Dumitrescu wrote: > Hi, > > I went looking through the list of EEPs today and found out that there are > several that I didn't know about, there have been no discussions about > them. Some are old, but there is no resolution about them. Some have been > implemented, but are not listed as such. > > Is there an official "EEP review board"? How often are EEPs reviewed? > > Should there be an automated (tri-monthly?) message to the eep mailing list > listing the status of all current EEPs and drafts? This can work as a > gentle reminder to EEP champions to try to get community comments about > their drafts so that they can be accepted or rejected. > > Should there be a new status for an EEP with the meaning "this is all well, > we like/want it, but we need a reference implementation"? Maybe someone > else than the champion feels like stepping in and provide a reference > implementation. This can be done in an issue-tracking system, of course, but that can have its own unexpected consequences within an open community. Because the EEP process is a bit mysterious to newcomers they don't litter the zone of discourse with frivolous suggestions. OTOH, because the process is a bit opaque EEPs get lost in the ether and progress is slow unless some issue of major concern (or an issue from a major concern) catches a bunch of eyes at once. I don't think there is even an easily sortable list of EEPs by status/date/etc... ? From vladdu55@REDACTED Sat May 17 17:03:54 2014 From: vladdu55@REDACTED (Vlad Dumitrescu) Date: Sat, 17 May 2014 17:03:54 +0200 Subject: [erlang-questions] warnings for "not recommended" usage of language constructs In-Reply-To: <5978892.qp1yM9FWPQ@jalapeno> References: <5978892.qp1yM9FWPQ@jalapeno> Message-ID: Hi! On Sat, May 17, 2014 at 3:58 PM, zxq9 wrote: > On Saturday 17 May 2014 11:38:39 Vlad Dumitrescu wrote: > > Related to my previous post about literal whitespace characters, I wonder > > if it might be a solution acceptable to most (all?) people to add > compiler > > options to control if such usage will emit warnings or not. This way one > > can choose to go on as before or to get informed when there are > > controversial constructs in the code. > > > > At the moment I have two suggestions for such constructs: > > > > - literal whitespace characters > > - "ill-behaved" macros > > The more information we can get from the environment (build tools, > compiler, > runtime, etc.) the better. Warnings, build status, dead code locations, > etc. > The more the better. This is especially true in controversial cases like > the > literal whitespace one that could so easily go unnoticed. > > I'm particularly fond of having the option of a logically independent lint- > type pre-processing step that checks if code is conforming to whatever the > community canon is and raises warnings (or interrupts the build, etc.) > before > the compiler gets a hold of the code. The reason I like this way more than > making everything a compiler warning is that it leaves the compiler > implementation logically dependent only on the language definition, and the > linting process free to embrace as much arbitrary knowledge from the > community > as the implementers have time for. It also leaves the option of different > linters/rules to be inserted in that step instead of only leaving room for > the > One True Way and drastically limits the size of the compiler manpage by > preventing compiler option proliferation over time. > The linter is already separated from the compiler, it is called as a separate stepfrom the compile proper. It's good idea to make it modular, so that linting steps can be added even by third parties. The current implementation looks like it just goes through the different checks sequentially, so it shouldn't be a huge amount of work to extract the steps to separate modules. I can look into it. regards, Vlad -------------- next part -------------- An HTML attachment was scrubbed... URL: From vladdu55@REDACTED Sat May 17 17:22:39 2014 From: vladdu55@REDACTED (Vlad Dumitrescu) Date: Sat, 17 May 2014 17:22:39 +0200 Subject: [erlang-questions] EEP process In-Reply-To: <3666726.duSDdvFHgL@jalapeno> References: <3666726.duSDdvFHgL@jalapeno> Message-ID: Hi, On Sat, May 17, 2014 at 4:03 PM, zxq9 wrote: > I don't think there is even an easily sortable list of EEPs by > status/date/etc... ? > Good idea. It would be a useful first step to list in the table on http://www.erlang.org/eeps/ even the submission date and the date it was last updated. It is unwieldy to check the Github repo for each file. At the moment, the list seems out of date, at least eep 37 and 43 should get an updated status. Anyway, what I am after is how to know if an EEP that hasn't got any update since 2011 is going to lead somewhere or not. Is it something we want and then what is missing to get it accepted? Is it not desireable or it will be handled differently or it collides with other features, then please have it rejected. Of course, I can ask on the mailing list, but I feel that if there is an official status site, it should be updated and if the review process is stalled, then at least that should be stated. regards, Vlad -------------- next part -------------- An HTML attachment was scrubbed... URL: From vladdu55@REDACTED Sat May 17 17:30:47 2014 From: vladdu55@REDACTED (Vlad Dumitrescu) Date: Sat, 17 May 2014 17:30:47 +0200 Subject: [erlang-questions] warnings for "not recommended" usage of language constructs In-Reply-To: <53777E82.40204@cs.ntua.gr> References: <5978892.qp1yM9FWPQ@jalapeno> <53777E82.40204@cs.ntua.gr> Message-ID: Hi! On Sat, May 17, 2014 at 5:21 PM, Kostis Sagonas wrote: > On 05/17/2014 05:03 PM, Vlad Dumitrescu wrote: > >> The current implementation looks like it just goes through the different >> checks sequentially, so it shouldn't be a huge amount of work to extract >> the steps to separate modules. >> > > Please don't. This is a terrible idea. Among other reasons, there is no > point in further polluting the module name space. > > Kostis > Ok, I can agree with that. Then the plug-in checkers should be functions and the default ones could still be located in erl_lint. The reason I said modules was that in the general case a plug-in may have multiple API/SPI entry points and in Erlang the only structure above functions is a module. I can imagine having the concept of modules separated from that of a source code file (i.e. dynamic modules) and those could be applied here, but I feel that is a discussion that I am not ready for at this moment. regards, Vlad -------------- next part -------------- An HTML attachment was scrubbed... URL: From vladdu55@REDACTED Sat May 17 17:33:20 2014 From: vladdu55@REDACTED (Vlad Dumitrescu) Date: Sat, 17 May 2014 17:33:20 +0200 Subject: [erlang-questions] integrating inter-process protocol checkers Message-ID: Hi, I was thinking today (obvious from the number of mails to the list :-) ) and was considering how great idea protocol checkers are and wondered why they aren't used and popularized more. One of the possible reasons is that in order to be able to use them everywhere, one has to use a specific architecture: with middleman processes in front of every server process. This is somewhat clunky, introducing elements that are not related to the application domain. Besides, it makes it difficult to add them to existing applications. So I wondered: what if one could create and use these proxy processes automatically? What if the VM is started in a special mode where all spawns are creating proxies that the process name registry knows about and plug in protocol checkers (or other useful middlemen)? Then the application code could be structured without having to consider unrelated infrastructure details. best regards, Vlad -------------- next part -------------- An HTML attachment was scrubbed... URL: From ates@REDACTED Sat May 17 20:33:50 2014 From: ates@REDACTED (Artem Teslenko) Date: Sat, 17 May 2014 21:33:50 +0300 Subject: [erlang-questions] Problem compiling CAMEL v2 ASN.1 files - SOLVED In-Reply-To: <53761E1D.2060603@gmail.com> References: <5374FB68.1060809@gmail.com> <53761E1D.2060603@gmail.com> Message-ID: <5377AB8E.60808@ipv6.dp.ua> Hello, I've uploaded a set of specs(TCAP, MAP, CAMEL) used by me: https://github.com/ates/ss7specs Hope this will be useful. On 05/16/2014 05:18 PM, Alan Evans wrote: > SUCCESS > > The trick was to remove all the PARAMETER-BOUND stuff and then use > IN-CS1-datatypes.asn rather than CAP-datatypes.asn > After that there was only a little bit of tweaking and now I have an > erl file that exports all the CAMEL Operations. > Don't know if it works yet but it's very encouraging. > > If anyone needs the asn files drop me a line, I'll be happy to share. > > Regards > AlanE > > On 15/05/2014 06:37:PM, Alan Evans wrote: >> Hello everyone, >> >> I don't suppose anyone out there has a set of 3GPP CAMEL ASN.1 files >> that the erlang asn compiler can compile and export an >> enc_InitialDP() function? >> I've been going around and around in circles all day trying to get >> this work but I'm failing miserably. >> >> My current problem is that the initialDP OPERATION in >> CAP-gsmSSF-gsmSCF-ops-args.asn is a parametrised type. >> >> The Erlang asn compiler docs state: >> "Note that the compiler does not generate encode/decode functions for >> parameterized types, but only for the instances of the parameterized >> types" >> >> I can't for the life of me figure out how to create an instance from >> this. >> >> Many thanks in advance. >> >> AlanE > > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions -------------- next part -------------- An HTML attachment was scrubbed... URL: From adelzhang@REDACTED Sun May 18 06:20:08 2014 From: adelzhang@REDACTED (Adel Zhang) Date: Sun, 18 May 2014 12:20:08 +0800 Subject: [erlang-questions] difference between "," and "andalso" in guards Message-ID: hi, I am currently reading "learnyousomeerlang". In "Syntax in Functions" chapter "guards" section, Fred said Note: I've compared , and ; in guards to the operators andalso and orelse. They're not exactly the same, though. The former pair will catch exceptions as they happen while the latter won't. What this means is that if there is an error thrown in the first part of the guard X >= N; N >= 0, the second part can still be evaluated and the guard might succeed; if an error was thrown in the first part of X >= N orelse N >= 0, the second part will also be skipped and the whole guard will fail. So I write a codesnippet: -module(g). -export ([right_age/1, right_age_2/1, right_age_3/1]). right_age(X) when X >= 16, X =< 104 -> true; right_age(_) -> false. right_age_2(X) when (X >= 16) andalso (X =< 104) -> true; right_age_2(_) -> false. right_age_3(X) when (X >= 16) and (X =< 104) -> true; right_age_3(_) -> false. And compile with 'S' option to get the assembly code as follow: {function, right_age, 1, 2}. {label,1}. {line,[{location,"g.erl",4}]}. {func_info,{atom,g},{atom,right_age},1}. {label,2}. {test,is_ge,{f,3},[{x,0},{integer,16}]}. {test,is_ge,{f,3},[{integer,104},{x,0}]}. {move,{atom,true},{x,0}}. return. {label,3}. {move,{atom,false},{x,0}}. return. {function, right_age_2, 1, 5}. {label,4}. {line,[{location,"g.erl",10}]}. {func_info,{atom,g},{atom,right_age_2},1}. {label,5}. {test,is_ge,{f,6},[{x,0},{integer,16}]}. {test,is_ge,{f,6},[{integer,104},{x,0}]}. {move,{atom,true},{x,0}}. return. {label,6}. {move,{atom,false},{x,0}}. return. {function, right_age_3, 1, 8}. {label,7}. {line,[{location,"g.erl",15}]}. {func_info,{atom,g},{atom,right_age_3},1}. {label,8}. {test,is_ge,{f,9},[{x,0},{integer,16}]}. {test,is_ge,{f,9},[{integer,104},{x,0}]}. {move,{atom,true},{x,0}}. return. {label,9}. {move,{atom,false},{x,0}}. return. Apparently the three version right_age function assembly code are almost same. It confuse me totally. 1) can assembly code tell the function behaviour difference? 2) what does {f,6} {x,0} in assembly code mean? 3) how can I verify Fred's statement? From bob@REDACTED Sun May 18 07:12:18 2014 From: bob@REDACTED (Bob Ippolito) Date: Sat, 17 May 2014 22:12:18 -0700 Subject: [erlang-questions] difference between ", " and "andalso" in guards In-Reply-To: References: Message-ID: I think you'll have a hard time showing the difference between comma and andalso, but you can demonstrate it with semicolon and orelse. These two functions have different semantics: right_age(X) when hd(X) >= 16; X =< 104 -> true; right_age(_) -> false. right_age_2(X) when hd(X) >= 16 orelse X =< 104 -> true; right_age_2(_) -> false. 1) The assembly code can of course tell the difference, in this case you can see the jumps are different. 2) The {f, N} refers to a {label, N}. I believe the {x, N} refers to something like a register. I've never spent much time trying to understand this assembly though. 3) See above :) The assembly code is different for these two versions, you can see how the first one does a second test if the bif fails but the latter immediately returns false when the bif fails. -bob On Sat, May 17, 2014 at 9:20 PM, Adel Zhang wrote: > hi, I am currently reading "learnyousomeerlang". In "Syntax in Functions" > chapter "guards" section, Fred said > > > Note: I've compared , and ; in guards to the operators andalso and orelse. > They're not exactly the same, though. The former pair will catch exceptions > as they happen while the latter won't. What this means is that if there is > an error thrown in the first part of the guard X >= N; N >= 0, the second > part can still be evaluated and the guard might succeed; if an error was > thrown in the first part of X >= N orelse N >= 0, the second part will also > be skipped and the whole guard will fail. > > > So I write a codesnippet: > > -module(g). > -export ([right_age/1, right_age_2/1, right_age_3/1]). > > right_age(X) when X >= 16, X =< 104 -> > true; > right_age(_) -> > false. > > > right_age_2(X) when (X >= 16) andalso (X =< 104) -> > true; > right_age_2(_) -> > false. > > right_age_3(X) when (X >= 16) and (X =< 104) -> > true; > right_age_3(_) -> > false. > > > And compile with 'S' option to get the assembly code as follow: > > {function, right_age, 1, 2}. > {label,1}. > {line,[{location,"g.erl",4}]}. > {func_info,{atom,g},{atom,right_age},1}. > {label,2}. > {test,is_ge,{f,3},[{x,0},{integer,16}]}. > {test,is_ge,{f,3},[{integer,104},{x,0}]}. > {move,{atom,true},{x,0}}. > return. > {label,3}. > {move,{atom,false},{x,0}}. > return. > > > {function, right_age_2, 1, 5}. > {label,4}. > {line,[{location,"g.erl",10}]}. > {func_info,{atom,g},{atom,right_age_2},1}. > {label,5}. > {test,is_ge,{f,6},[{x,0},{integer,16}]}. > {test,is_ge,{f,6},[{integer,104},{x,0}]}. > {move,{atom,true},{x,0}}. > return. > {label,6}. > {move,{atom,false},{x,0}}. > return. > > > {function, right_age_3, 1, 8}. > {label,7}. > {line,[{location,"g.erl",15}]}. > {func_info,{atom,g},{atom,right_age_3},1}. > {label,8}. > {test,is_ge,{f,9},[{x,0},{integer,16}]}. > {test,is_ge,{f,9},[{integer,104},{x,0}]}. > {move,{atom,true},{x,0}}. > return. > {label,9}. > {move,{atom,false},{x,0}}. > return. > > > > Apparently the three version right_age function assembly code are almost > same. It confuse me totally. > > 1) can assembly code tell the function behaviour difference? > 2) what does {f,6} {x,0} in assembly code mean? > 3) how can I verify Fred's statement? > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From ok@REDACTED Mon May 19 01:02:00 2014 From: ok@REDACTED (Richard A. O'Keefe) Date: Mon, 19 May 2014 11:02:00 +1200 Subject: [erlang-questions] difference between ", " and "andalso" in guards In-Reply-To: References: Message-ID: <9F9729D5-8CF8-4F66-A55D-95ADB86E9952@cs.otago.ac.nz> On 18/05/2014, at 4:20 PM, Adel Zhang wrote: > hi, I am currently reading "learnyousomeerlang". In "Syntax in Functions" chapter "guards" section, Fred said > > > Note: I've compared , and ; in guards to the operators andalso and orelse. They're not exactly the same, though. The former pair will catch exceptions as they happen while the latter won't. This is seriously misleading. The difference between X > Y , X < Z and X > Y andalso X < Z with respect to exceptions has NOTHING TO DO with whether it's comma or andalso. The right semantic model is that it is the tests X > Y and X < Z themselves which change. If a guard test would have raised an exception, that turns into a simple failure of the guard test. Example: 1> F1 = fun (X) when X+1 > 2 -> ok ; (_) -> oops end. 2> F2 = fun (X) -> B = (X + 1 > 2), if B -> ok ; true -> oops end end. 3> F1(snark). oops 4> F2(snark). ** exited: {badarith,...} ** This being so, "," never gets to *see* an exception, so how could it catch one? You can't verify Fred's statement, because it isn't true. "," and ";" no more catch exceptions than "->" does. From pierrefenoll@REDACTED Mon May 19 01:18:29 2014 From: pierrefenoll@REDACTED (Pierre Fenoll) Date: Mon, 19 May 2014 01:18:29 +0200 Subject: [erlang-questions] difference between ", " and "andalso" in guards In-Reply-To: <9F9729D5-8CF8-4F66-A55D-95ADB86E9952@cs.otago.ac.nz> References: <9F9729D5-8CF8-4F66-A55D-95ADB86E9952@cs.otago.ac.nz> Message-ID: May I quote IRC on this one, if that can help? 21:53 < captain_fur>| in guards what is the difference between or/; and/, 21:54 < captain_fur>| what do people usually use, do they mean the same thing syntactically 21:54 < nox>| captain_furious: no 21:55 < nox>| ;, or and orelse are all different 21:55 < DeadZen>| and and and also andalso 21:55 -!- supertramp [~Alexander@REDACTED] has quit [Ping timeout: 245 seconds] 21:55 -!- hiyosi [~skip_it@REDACTED] has quit [Ping timeout: 264 seconds] 21:55 < nox>| captain_furious: "BadGuard; true", "true; BadGuard" and "true orelse BadGuard" will all succeed 21:56 < nox>| err 21:56 < darkthink>| :) @ DeadZen 21:56 < nox>| nah, that's right 21:56 < captain_fur>| i have only ever used ,/;/orelse andalso 21:56 < captain_fur>| never plain and/or 21:56 < nox>| then, "BadGuard orelse true", "BadGuard or true", "true or BadGuard" will all fail 21:56 < captain_fur>| i am doing a talk and so wondered what the difference was 21:56 < nox>| A; B is compiled to the following Core: 21:57 < nox>| (Core-like) 21:57 < nox>| "try A of true -> true; _ -> false catch _ -> false end orelse B" 21:57 < nox>| now you are confused because guards don't fail and no try are allowed in guards 21:58 < nox>| but they are allowed in Core guards, and guards *can* fail, the failures must just be silenced to false 21:58 -!- troutwine_away is now known as troutwine 21:58 -!- asabil [uid11150@REDACTED/web/irccloud.com/x-nkbqvyqukslcpbvg] has joined #erlang 22:00 < captain_fur>| hmmm ok 22:00 < nox>| so "length(X) =:= 3; true" succeeds for all X 22:00 < nox>| and "length(X) =:= 3 orelse true" doesn't 22:01 < captain_fur>| short circuit 22:01 < nox>| orelse shortcircuits too 22:01 -!- PavelSh [~pavelsh@REDACTED] has joined #erlang 22:01 < nox>| but it doesn't shortcircuit the nonbooleanness or the crash of its first argument 22:01 < nox>| while ; does 22:02 < nox>| if X is not a list, the ; guard will succeeds anyway and the orelse one won't 22:03 < captain_fur>| ok Cheers, -- Pierre Fenoll On 19 May 2014 01:02, Richard A. O'Keefe wrote: > > On 18/05/2014, at 4:20 PM, Adel Zhang wrote: > > > hi, I am currently reading "learnyousomeerlang". In "Syntax in > Functions" chapter "guards" section, Fred said > > > > > > Note: I've compared , and ; in guards to the operators andalso and > orelse. They're not exactly the same, though. The former pair will catch > exceptions as they happen while the latter won't. > > > This is seriously misleading. > > The difference between X > Y , X < Z > and X > Y andalso X < Z > with respect to exceptions has NOTHING TO DO with whether > it's comma or andalso. The right semantic model is that > it is the tests X > Y and X < Z themselves which change. > If a guard test would have raised an exception, that > turns into a simple failure of the guard test. > > Example: > > 1> F1 = fun (X) when X+1 > 2 -> ok ; (_) -> oops end. > 2> F2 = fun (X) -> B = (X + 1 > 2), if B -> ok ; true -> oops end end. > 3> F1(snark). > oops > 4> F2(snark). > ** exited: {badarith,...} ** > > This being so, "," never gets to *see* an exception, > so how could it catch one? > > You can't verify Fred's statement, because it isn't true. > "," and ";" no more catch exceptions than "->" does. > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From mononcqc@REDACTED Mon May 19 02:59:28 2014 From: mononcqc@REDACTED (Fred Hebert) Date: Sun, 18 May 2014 17:59:28 -0700 Subject: [erlang-questions] difference between ", " and "andalso" in guards In-Reply-To: <9F9729D5-8CF8-4F66-A55D-95ADB86E9952@cs.otago.ac.nz> References: <9F9729D5-8CF8-4F66-A55D-95ADB86E9952@cs.otago.ac.nz> Message-ID: <20140519005927.GN1684@ferdair.local> On 05/19, Richard A. O'Keefe wrote: > > > This is seriously misleading. > > The difference between X > Y , X < Z > and X > Y andalso X < Z > with respect to exceptions has NOTHING TO DO with whether > it's comma or andalso. The right semantic model is that > it is the tests X > Y and X < Z themselves which change. > If a guard test would have raised an exception, that > turns into a simple failure of the guard test. > > Example: > > 1> F1 = fun (X) when X+1 > 2 -> ok ; (_) -> oops end. > 2> F2 = fun (X) -> B = (X + 1 > 2), if B -> ok ; true -> oops end end. > 3> F1(snark). > oops > 4> F2(snark). > ** exited: {badarith,...} ** > > This being so, "," never gets to *see* an exception, > so how could it catch one? > > You can't verify Fred's statement, because it isn't true. > "," and ";" no more catch exceptions than "->" does. > There is no practical difference between ',' and 'andalso' in any way, because as you mentioned, an exception would turn into a failure of the guard test no matter which one is used. This would be the same no matter what the implementation as far as I can tell. For ';' and 'orelse', there is a practical difference. They don't properly 'catch' exceptions, but when learning Erlang I've found the explanation I used in LYSE useful and practically applicable (which is why I put it in the book). Of course you can look at the assembler or even at the result of fun2ms to see an example of the practical difference: 1> ets:fun2ms(fun(X) when hd(X) > 0 orelse true -> ok end). [{'$1',[{'orelse',{'>',{hd,'$1'},0},true}],[ok]}] 2> ets:fun2ms(fun(X) when hd(X) > 0; true -> ok end). [{'$1',[{'>',{hd,'$1'},0}],[ok]}, {'$1',[true],[ok]}] Showing an example interpretation where the clauses are entirely disjoint and more equivalent to two different function clauses than a logical operator when observed that way. The same way calling the function: f([]) -> a; f(_) -> b. as f([]) doesn't result in the first clause 'catching' a badmatch exception, the ';' doesn't end up catching exceptions either. It's just that I personally found the simple rule I put in LYSE to be good enough and understandable. The other comparison point I used in the text was 'nesting' with parentheses: > However (there is always a 'however'), only andalso and orelse can be > nested inside guards. This means (A orelse B) andalso C is a valid > guard, while (A; B), C is not. Given their different use, the best > strategy is often to mix them as necessary. I believe I ended up grouping ',' and ';', 'andalso' and 'orelse', and 'and' and 'or' (that's a confusing sentence) in the explanations of this chapter because they just fit well together in pairs. That did end up suggesting ',' catches exceptions, while it clearly shouldn't. People are of course free to question the method I used there and to disagree with it. I won't be debating it in much detail because, as I said, I felt entirely satisfied with the method I used to explain it, and felt it is more easily understandable than going into the details of how everything gets compiled lower down. LYSE probably papers over a lot of issues in that manner, especially in the earlier chapters. That's both a result of me writing the book as the entire learning experience was still fresh in my mind (and I reported things as they made sense to me back then), and not wanting to get into details before people are even able to compile code. I'm hoping, for the benefit of their own learning experience, that readers who feel like getting a more formal approach to learning Erlang likely wouldn't pick the book with the weird squid and badly written title over the other alternatives. Hopefully I can't be accused of false representation on the book's cover and tone. I'm also hoping people are generally satisfied with LYSE, but of course, there's no guarantee, and the errata of the book[1] only proves I am able to make a ton of mistakes. Regards, Fred. [1] http://www.nostarch.com/erlang#updates (click on 'show updates') From mononcqc@REDACTED Mon May 19 03:07:27 2014 From: mononcqc@REDACTED (Fred Hebert) Date: Sun, 18 May 2014 18:07:27 -0700 Subject: [erlang-questions] difference between ", " and "andalso" in guards In-Reply-To: <20140519005927.GN1684@ferdair.local> References: <9F9729D5-8CF8-4F66-A55D-95ADB86E9952@cs.otago.ac.nz> <20140519005927.GN1684@ferdair.local> Message-ID: <20140519010726.GO1684@ferdair.local> On 05/18, Fred Hebert wrote: > The same way calling the > function: > > f([]) -> a; > f(_) -> b. > > as f([]) doesn't result in the first clause 'catching' a badmatch > exception, the ';' doesn't end up catching exceptions either. I totally meant 'calling ... as f({})' here. Sorry. - Fred. From lloyd@REDACTED Mon May 19 05:52:46 2014 From: lloyd@REDACTED (Lloyd R. Prentice) Date: Sun, 18 May 2014 23:52:46 -0400 Subject: [erlang-questions] Storing images Message-ID: <76C6CCCF-45AF-4587-AECD-5A863D456AC3@writersglen.com> Hello, Suppose I anticipate unknown thousands of records, each containing meta-data associated with an image. Each image averages, say, 100KB. Retrieval is by key and queries on the meta data. Retrieval predominates over insert. Reliability and speed of access are high on the requirements list. I'm considering Riak. But... Questions: - Would it be best practice to store the each image in its associated record or would it be better to store the images separately in, say, directories or in a separate distributed file system such as leoFS? - Is there a better solution altogether? Many thanks, LRP Sent from my iPad From ok@REDACTED Mon May 19 07:50:11 2014 From: ok@REDACTED (Richard A. O'Keefe) Date: Mon, 19 May 2014 17:50:11 +1200 Subject: [erlang-questions] literal character syntax In-Reply-To: <4432439.UmNban0FWi@jalapeno> References: <1419556.oXnLqJ1Ur6@jalapeno> <4432439.UmNban0FWi@jalapeno> Message-ID: <585722C8-A318-4D09-8BD9-446B482EA68F@cs.otago.ac.nz> On 17/05/2014, at 2:30 AM, zxq9 wrote: > No. "Whitespace" means a whole slew of things, including, in this case, "non > printable characters". "Whitespace" and "non-printable characters" are > uselessly broad definitions in the days of unicode Erlang. Ah, Unicode! Unicode 6.3 has 18 characters in category Zs. (ZERO WIDTH SPACE isn't a Zs any more, it's a Cf. However MONGOLIAN VOWEL SEPARATOR and MEDIUM MATHEMATICAL SPACE have made up for the loss.) The following code fragment is a list containing a series of character literals separated by commas. Each comma is followed by a plain old U+0020 space. One of the other spaces is also this kind of space, but all the spaces that do not follow a comma are *different* characters. [$ , $ , $?, $?, $?, $?, $?, $?, $?] How I got these was by writing the following program: #include #include #include static void foo(int c, int flag) { putwc('$', stdout); putwc(c, stdout); if (flag) putwc(',', stdout), putwc(' ', stdout); else putwc(']', stdout), putwc('\n', stdout); } int main(void) { setlocale(LC_CTYPE, "en_NZ.UTF-8"); fwide(stdout, 1); putwc('[', stdout); foo(0x0020, 1); foo(0x00A0, 1); foo(0x2002, 1); foo(0x2003, 1); foo(0x2004, 1); foo(0x2007, 1); foo(0x202F, 1); foo(0x205F, 1); foo(0x3000, 0); return 0; } I wrote the output to a file, verified with od(1) that the file contained the bytes it was supposed to, opened that file in TextEdit, and copied-and-pasted the line to Mail. I've attached a copy of the file with the different spaces so that you can view it in your preferred editor to see if you can tell the difference. In Mail I cannot, in TextEdit I cannot, in Aquamacs I can if I look really closely. All that Unicode has done for us here is to make ($ ) *more* dangerous than it already was. (And this is without considering the 145 'Cf' characters in Unicode 6.3, amongst which TAB and LF may be found. The thought of someone innocently copying a "character" from a file and dropping it in just after a $ sign without realising that the "character" is a sequence beginning with a language tag or a digit shape selector does *not* appeal.) -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: spaces.txt URL: -------------- next part -------------- > > Were you taught how to write a space in school? Yes. > How about how to write a tab? Not me personally, but the students who took typing, yes. > Columnar delimitation? How large is a space in a file? With Unicode, isn't the answer *always* "it depends"? > > It seems like the general feeling is to impose a new restriction in the > language. Its not a game-changer either way, but I wanted to present a case > for not introducing special-case rules that outlaw a rather broader category > of characters than the OP may have realized in one very specific circumstance > -- just to make sure this is thoroughly considered before someone spends time > tinkering with the parser yet again. I *DO* want to make a case for reporting a warning for *ALL* characters that do not result in a visible mark. And I think the example above makes that case very strongly. From huss01@REDACTED Mon May 19 10:33:11 2014 From: huss01@REDACTED (=?ISO-8859-1?Q?H=E5kan_Huss?=) Date: Mon, 19 May 2014 10:33:11 +0200 Subject: [erlang-questions] difference between ", " and "andalso" in guards In-Reply-To: <20140519005927.GN1684@ferdair.local> References: <9F9729D5-8CF8-4F66-A55D-95ADB86E9952@cs.otago.ac.nz> <20140519005927.GN1684@ferdair.local> Message-ID: Isn't the easiest way to explain the difference between E1; E2 and E1 orelse E2 is that the former is two guards combined with ; while the latter is one guard containing an orelse operator. If E1 would give an exception, E1 fails in the first case, and the next guard is evaluated. In the second case, if E1 would give an exception the (only) guard fails. /H?kan 2014-05-19 2:59 GMT+02:00 Fred Hebert : > On 05/19, Richard A. O'Keefe wrote: > > > > > > This is seriously misleading. > > > > The difference between X > Y , X < Z > > and X > Y andalso X < Z > > with respect to exceptions has NOTHING TO DO with whether > > it's comma or andalso. The right semantic model is that > > it is the tests X > Y and X < Z themselves which change. > > If a guard test would have raised an exception, that > > turns into a simple failure of the guard test. > > > > Example: > > > > 1> F1 = fun (X) when X+1 > 2 -> ok ; (_) -> oops end. > > 2> F2 = fun (X) -> B = (X + 1 > 2), if B -> ok ; true -> oops end end. > > 3> F1(snark). > > oops > > 4> F2(snark). > > ** exited: {badarith,...} ** > > > > This being so, "," never gets to *see* an exception, > > so how could it catch one? > > > > You can't verify Fred's statement, because it isn't true. > > "," and ";" no more catch exceptions than "->" does. > > > > There is no practical difference between ',' and 'andalso' in any way, > because as you mentioned, an exception would turn into a failure of the > guard test no matter which one is used. This would be the same no matter > what the implementation as far as I can tell. > > For ';' and 'orelse', there is a practical difference. They don't > properly 'catch' exceptions, but when learning Erlang I've found the > explanation I used in LYSE useful and practically applicable (which is > why I put it in the book). > > Of course you can look at the assembler or even at the result of fun2ms > to see an example of the practical difference: > > 1> ets:fun2ms(fun(X) when hd(X) > 0 orelse true -> ok end). > [{'$1',[{'orelse',{'>',{hd,'$1'},0},true}],[ok]}] > 2> ets:fun2ms(fun(X) when hd(X) > 0; true -> ok end). > [{'$1',[{'>',{hd,'$1'},0}],[ok]}, > {'$1',[true],[ok]}] > > Showing an example interpretation where the clauses are entirely > disjoint and more equivalent to two different function clauses than a > logical operator when observed that way. The same way calling the > function: > > f([]) -> a; > f(_) -> b. > > as f([]) doesn't result in the first clause 'catching' a badmatch > exception, the ';' doesn't end up catching exceptions either. It's just > that I personally found the simple rule I put in LYSE to be good enough > and understandable. > > The other comparison point I used in the text was 'nesting' with > parentheses: > > > However (there is always a 'however'), only andalso and orelse can be > > nested inside guards. This means (A orelse B) andalso C is a valid > > guard, while (A; B), C is not. Given their different use, the best > > strategy is often to mix them as necessary. > > I believe I ended up grouping ',' and ';', 'andalso' and 'orelse', and > 'and' and 'or' (that's a confusing sentence) in the explanations of this > chapter because they just fit well together in pairs. That did end up > suggesting ',' catches exceptions, while it clearly shouldn't. > > People are of course free to question the method I used there and to > disagree with it. I won't be debating it in much detail because, as I > said, I felt entirely satisfied with the method I used to explain it, > and felt it is more easily understandable than going into the details of > how everything gets compiled lower down. > > LYSE probably papers over a lot of issues in that manner, especially in > the earlier chapters. That's both a result of me writing the book as the > entire learning experience was still fresh in my mind (and I reported > things as they made sense to me back then), and not wanting to get into > details before people are even able to compile code. > > I'm hoping, for the benefit of their own learning experience, that > readers who feel like getting a more formal approach to learning Erlang > likely wouldn't pick the book with the weird squid and badly written > title over the other alternatives. Hopefully I can't be accused of false > representation on the book's cover and tone. > > I'm also hoping people are generally satisfied with LYSE, but of course, > there's no guarantee, and the errata of the book[1] only proves I am able > to make a ton of mistakes. > > Regards, > Fred. > > [1] http://www.nostarch.com/erlang#updates (click on 'show updates') > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From suraj.kumar@REDACTED Mon May 19 10:50:05 2014 From: suraj.kumar@REDACTED (Suraj Kumar) Date: Mon, 19 May 2014 14:20:05 +0530 Subject: [erlang-questions] Code complexity and encapsulation Message-ID: Hi, I'm attempting to build a system whose engineering challenges will classically benefit from the so-called Object-Oriented Programming paradigm: Specifically, that of encapsulation. However, the real complexity of the problem is that there are going to be millions of objects 'existent in space and time' simultaneously. The problem domain is analogous to a drawing system: There is a 2D 'canvas onto which several different types of 'shape objects' can be fit into. Once they are all placed on the canvas, it is required that the canvas gets to know all the shapes which seem to coincide with point P (x, y co-ordinates) (or must do similar natured querying of all the shapes without being aware of their details). To find this, the canvas has to ask each shape, in an agnostic/implementation-independent way, whether the object "is_on_point (x,y)". Thus far, I've gone about modeling each 'shape' as one 'record' in Erlang. I've written some 'utility' functions to determine types of various records. I've also written boilerplate logic in the 'canvas' class to check types and then call appropriate functions. I've also introduced a major convention hell which new programmers will have to understand if they want to add a new type of shape to the system. Is there a cleaner way of modeling this? Should I be using OTP instead of looking for a way to do this in native Erlang? If yes, what would you suggest is a good supervisor/worker-process model so that such encapusulation and complexity can be achieved? Any examples I can look at? Regards, -Suraj -- An Onion is the Onion skin and the Onion under the skin until the Onion Skin without any Onion underneath. -- _____________________________________________________________ The information contained in this communication is intended solely for the use of the individual or entity to whom it is addressed and others authorized to receive it. It may contain confidential or legally privileged information. If you are not the intended recipient you are hereby notified that any disclosure, copying, distribution or taking any action in reliance on the contents of this information is strictly prohibited and may be unlawful. If you have received this communication in error, please notify us immediately by responding to this email and then delete it from your system. The firm is neither liable for the proper and complete transmission of the information contained in this communication nor for any delay in its receipt. -------------- next part -------------- An HTML attachment was scrubbed... URL: From dmkolesnikov@REDACTED Mon May 19 10:57:12 2014 From: dmkolesnikov@REDACTED (Dmitry Kolesnikov) Date: Mon, 19 May 2014 11:57:12 +0300 Subject: [erlang-questions] Storing images In-Reply-To: <76C6CCCF-45AF-4587-AECD-5A863D456AC3@writersglen.com> References: <76C6CCCF-45AF-4587-AECD-5A863D456AC3@writersglen.com> Message-ID: <920ED0A5-2386-47D2-B452-989DB732F3E6@gmail.com> Hello, The access pattern for images and it?s meta-data is different. They have different TTL properties and caching hierarchy. Therefore, storing images and its meta-data inside single record is not good idea. You are absolutely right that distributed binary storage for images shall be separated from metadata storage. The best solution depends on many factors including your hosting requirements, CDN vendors, costs, etc... I would use Riak for meta-data but AWS S3 + CloudFront for binary content. Best Regards, Dmitry On 19 May 2014, at 06:52, Lloyd R. Prentice wrote: > Hello, > > Suppose I anticipate unknown thousands of records, each containing meta-data associated with an image. Each image averages, say, 100KB. Retrieval is by key and queries on the meta data. Retrieval predominates over insert. Reliability and speed of access are high on the requirements list. > > I'm considering Riak. But... > > Questions: > > - Would it be best practice to store the each image in its associated record or would it be better to store the images separately in, say, directories or in a separate distributed file system such as leoFS? > > - Is there a better solution altogether? > > Many thanks, > > LRP > > Sent from my iPad > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions From jesper.louis.andersen@REDACTED Mon May 19 11:33:38 2014 From: jesper.louis.andersen@REDACTED (Jesper Louis Andersen) Date: Mon, 19 May 2014 11:33:38 +0200 Subject: [erlang-questions] Code complexity and encapsulation In-Reply-To: References: Message-ID: On Mon, May 19, 2014 at 10:50 AM, Suraj Kumar wrote: > Thus far, I've gone about modeling each 'shape' as one 'record' in Erlang. > I've written some 'utility' functions to determine types of various > records. I've also written boilerplate logic in the 'canvas' class to check > types and then call appropriate functions. I've also introduced a major > convention hell which new programmers will have to understand if they want > to add a new type of shape to the system. The reason this works in the OO paradigm is because once you have a Shape S, then calling S.is_on_point(X, Y) lets S reflect on its own shape and answer the question. In Erlang, we can model this with is_on_point(#shape_a{...}, X,Y) -> ...; is_on_point(#shape_b{...}, X,Y) -> ... but this leads to trouble. Naturally, the is_on_point function has to be extended all the time. So make a shape describe itself: -record(shape, { repr %% Underlying actual representation, any Erlang term is_on_point :: fun( ( term() ) -> boolean()) }). so: is_on_point(#shape { is_on_point = IOP, repr = Repr }) -> IOP(Repr). Alternatively, pack up a module in the record, essentially modelling existential types: -record(shape, { repr, mod :: atom() }). is_on_point(#shape { mod = M, repr = R}) -> Mod:is_on_point(R). You are essentially (manually) reimplementing the Subtyping/Open recursion in Erlang directly with this method. The latter variant can use a behaviour to make sure the interface is complete. But I wouldn't really do that, it leads to code which is a maintenance burden. However, it may be possible to model this differently by dualizing everything. Rather than thinking in shapes, you might be able to think in "sets of points with additional information". This means that the code can always use the set-of-points ignoring the meta-data. In functional settings, this inversion often yields better data models in the long run. One trick is to be able to call: Mod:as_set_of_points(V) for some value V being constructed by Mod and then represent this as -record(sop, { underlying = V, points = [...] }). So you can get back your old V by simply doing SOP#sop.underlying. Persistence helps a great deal here since having an extra "copy" of V is free and now you can work with V as if it were a set of points. Smarter algorithms would also cleverly cull away stuff when you "cast" the V as another representation so you have to search fewer points, etc. This solution is somewhat like a view-type for the type of V. I guess we will be able to help you better if we know the real data to be modeled. -- J. -------------- next part -------------- An HTML attachment was scrubbed... URL: From cobus.carstens@REDACTED Mon May 19 12:07:21 2014 From: cobus.carstens@REDACTED (Cobus Carstens) Date: Mon, 19 May 2014 03:07:21 -0700 (PDT) Subject: [erlang-questions] Code complexity and encapsulation In-Reply-To: References: Message-ID: Have a look at R-trees: http://en.wikipedia.org/wiki/R-tree Regards, C On Monday, 19 May 2014 10:50:05 UTC+2, Suraj Kumar wrote: > > Hi, > > I'm attempting to build a system whose engineering challenges will > classically benefit from the so-called Object-Oriented Programming > paradigm: Specifically, that of encapsulation. However, the real complexity > of the problem is that there are going to be millions of objects 'existent > in space and time' simultaneously. > > The problem domain is analogous to a drawing system: There is a 2D 'canvas > onto which several different types of 'shape objects' can be fit into. Once > they are all placed on the canvas, it is required that the canvas gets to > know all the shapes which seem to coincide with point P (x, y co-ordinates) > (or must do similar natured querying of all the shapes without being aware > of their details). To find this, the canvas has to ask each shape, in an > agnostic/implementation-independent way, whether the object "is_on_point > (x,y)". > > Thus far, I've gone about modeling each 'shape' as one 'record' in Erlang. > I've written some 'utility' functions to determine types of various > records. I've also written boilerplate logic in the 'canvas' class to check > types and then call appropriate functions. I've also introduced a major > convention hell which new programmers will have to understand if they want > to add a new type of shape to the system. > > > Is there a cleaner way of modeling this? Should I be using OTP instead of > looking for a way to do this in native Erlang? If yes, what would you > suggest is a good supervisor/worker-process model so that such > encapusulation and complexity can be achieved? Any examples I can look at? > > Regards, > > -Suraj > > -- > An Onion is the Onion skin and the Onion under the skin until the Onion > Skin without any Onion underneath. > > > _____________________________________________________________ > The information contained in this communication is intended solely for the > use of the individual or entity to whom it is addressed and others > authorized to receive it. It may contain confidential or legally privileged > information. If you are not the intended recipient you are hereby notified > that any disclosure, copying, distribution or taking any action in reliance > on the contents of this information is strictly prohibited and may be > unlawful. If you have received this communication in error, please notify > us immediately by responding to this email and then delete it from your > system. The firm is neither liable for the proper and complete transmission > of the information contained in this communication nor for any delay in its > receipt. -------------- next part -------------- An HTML attachment was scrubbed... URL: From zxq9@REDACTED Mon May 19 13:44:18 2014 From: zxq9@REDACTED (zxq9) Date: Mon, 19 May 2014 20:44:18 +0900 Subject: [erlang-questions] literal character syntax In-Reply-To: <585722C8-A318-4D09-8BD9-446B482EA68F@cs.otago.ac.nz> References: <4432439.UmNban0FWi@jalapeno> <585722C8-A318-4D09-8BD9-446B482EA68F@cs.otago.ac.nz> Message-ID: <2273021.IQHK081l8t@jalapeno> On Monday 19 May 2014 17:50:11 Richard A. O'Keefe wrote: > All that Unicode has done for us here is to make ($ ) > *more* dangerous than it already was. (And this is without > considering the 145 'Cf' characters in Unicode 6.3, amongst > which TAB and LF may be found. The thought of someone > innocently copying a "character" from a file and dropping > it in just after a $ sign without realising that the "character" > is a sequence beginning with a language tag or a digit shape > selector does *not* appeal.) Thank you for the thorough response. It appears this will eventually be made into a warning not a language rule. Leaving it unaddressed would have left leave some weird, dangerous corner cases for human plain-text code readers (which is probably most of us at the moment) as illustrated by your example above. This will leave those who occasionally use things like double-width spaces in code free to do so (not an uncommon practice in CJK-target programs; hopefully with a comment to explain what it is!) while clearly notifying anyone building such a project of its presence. From rich.neswold@REDACTED Mon May 19 14:57:59 2014 From: rich.neswold@REDACTED (Rich Neswold) Date: Mon, 19 May 2014 07:57:59 -0500 Subject: [erlang-questions] integrating inter-process protocol checkers In-Reply-To: References: Message-ID: On Sat, May 17, 2014 at 10:33 AM, Vlad Dumitrescu wrote: > I was thinking today (obvious from the number of mails to the list :-) ) and > was considering how great idea protocol checkers are and wondered why they > aren't used and popularized more. Protocol checkers are wonderful. > One of the possible reasons is that in order to be able to use them > everywhere, one has to use a specific architecture: with middleman processes > in front of every server process. This is somewhat clunky, introducing > elements that are not related to the application domain. Besides, it makes > it difficult to add them to existing applications. A colleague and I have developed a protocol compiler which takes a protocol specification file and generates source code to marshal/unmarshal the messages. It's very similar to Google's protobuf idea and we seriously considered using their's, but there were some requirements at Fermilab which it didn't meet, so we rolled our own. We support C++, Java, Objective-C and Erlang (which are all used in our Control System) and we also target Python and OCaml (which are experimental.) We don't use middleware: each generator uses the target language's method of choice to prep an outgoing message. So, for example, the C++ code will write to a stream; the Erlang code builds a binary (which can then be sent to a socket.); etc. The generated code for each target language validates the messages and will only succeed if every required field is present and is of the correct type and in range. Handling protocols, before this tool was created, was tedious and error-prone. Now adding features is a breeze and we regularly add or refactor protocol messages. -- Rich From vladdu55@REDACTED Mon May 19 15:03:18 2014 From: vladdu55@REDACTED (Vlad Dumitrescu) Date: Mon, 19 May 2014 15:03:18 +0200 Subject: [erlang-questions] literal character syntax In-Reply-To: <2273021.IQHK081l8t@jalapeno> References: <4432439.UmNban0FWi@jalapeno> <585722C8-A318-4D09-8BD9-446B482EA68F@cs.otago.ac.nz> <2273021.IQHK081l8t@jalapeno> Message-ID: To sum up the issue of literal whitespace, nobody had anything against adding warnings pointing out the existence of such literals. I will try to implement it, but as I mentioned before, the only way to detect these literals at the linter level is by checking the text of the tokens. We don't want to always return the text for all tokens, so I have to find a special solution for this case. I see two alternatives: return the text for literal character tokens either always or only when the compiler option is set. The first way uses a bit more memory (but not much, as there are relatively few literal characters in source code). The second way won't work for compile:forms unless the scanning was done with the 'text' option. Adding this option means adding complexity to the code. My inclination is to go for always returning the text for literal chars. The code remains simpler at the price of (if I am counting correctly) 6 words per instance of a literal char. The only real problem could be if some code assumes that if no options are sent to the scanner, the attribute list includes no text. I would say that this is the wrong thing to do anyway, but for the sake of compatibility it means that we should be able to control this with a (global) option... best regards, Vlad -------------- next part -------------- An HTML attachment was scrubbed... URL: From thomasl_erlang@REDACTED Mon May 19 15:47:54 2014 From: thomasl_erlang@REDACTED (Thomas Lindgren) Date: Mon, 19 May 2014 06:47:54 -0700 (PDT) Subject: [erlang-questions] difference between ", " and "andalso" in guards In-Reply-To: References: <9F9729D5-8CF8-4F66-A55D-95ADB86E9952@cs.otago.ac.nz> <20140519005927.GN1684@ferdair.local> Message-ID: <1400507274.89520.YahooMailNeo@web140101.mail.bf1.yahoo.com> I've heard this explanation before, and it probably explains how it's implemented, but I think it easily leads to confusion. (Much like the rest of Erlang's booleans, unfortunately.)? I'd prefer this, which perhaps should be an EEP:? Define guards as (restricted) boolean expressions connected by "," and ";". Disjunctions ";" should furthermore be permitted to be nested with conjunctions ",", which I believe is not the case today. The boolean expressions are known as tests (e.g., "is_integer(X)" or "length(hd(A)) > 0" and are taken from the currently well-known collection of guard tests. So, the guard grammar is this: G ::= G1, G2 | G1 ; G2 | T where T is a test. Conjunction binds tighter than disjunction and both are associative, so the syntax is nearly the same as what we have today.?As an example, and?in contrast with today, "G1, (G2 ; G3), G4" is a valid guard if G1 to G4 are valid guards (which may themselves contain "," and ";" if so desired). Conjunction "," means logical AND, while disjunction ";" means logical OR. AND/OR are lazily evaluated left to right. Thus, in the grammar above, G1 is evaluated before G2, and G2 is not evaluated unless required.? Tests T that fail/crash or do not return a boolean are treated as if they evaluate to false. (Subexpressions can of course evaluate to non-booleans. If a subexpression crashes during evaluation, the whole test fails.)? Finally, if the guard of a clause evaluates to false, the clause head fails and evaluation moves on to try to match the next clause. In this approach, andalso/orelse/and/or can possibly be permitted as tests (or subexpressions of tests), but I'd suggest to not allow them in guard contexts since they lead to the (needless) ambiguities discussed above. (Other connectives like negation and implication could also be allowed, as well as more powerful tests, but I'll leave that for future work.) Best, Thomas On Monday, May 19, 2014 10:33 AM, H?kan Huss wrote: > > >Isn't the easiest way to explain the difference between E1; E2 and E1 orelse E2 is that the former is two guards combined with ; while the latter is one guard containing an orelse operator. If E1 would give an exception, E1 fails in the first case, and the next guard is evaluated. In the second case, if E1 would give an exception the (only) guard fails. > >/H?kan > > > > >2014-05-19 2:59 GMT+02:00 Fred Hebert : > >On 05/19, Richard A. O'Keefe wrote: >>> >>> >>> This is seriously misleading. >>> >>> The difference between ?X > Y , X < Z >>> and X > Y andalso X < Z >>> with respect to exceptions has NOTHING TO DO with whether >>> it's comma or andalso. ?The right semantic model is that >>> it is the tests X > Y and X < Z themselves which change. >>> If a guard test would have raised an exception, that >>> turns into a simple failure of the guard test. >>> >>> Example: >>> >>> 1> F1 = fun (X) when X+1 > 2 -> ok ; (_) -> oops end. >>> 2> F2 = fun (X) -> B = (X + 1 > 2), if B -> ok ; true -> oops end end. >>> 3> F1(snark). >>> oops >>> 4> F2(snark). >>> ** exited: {badarith,...} ** >>> >>> This being so, "," never gets to *see* an exception, >>> so how could it catch one? >>> >>> You can't verify Fred's statement, because it isn't true. >>> "," and ";" no more catch exceptions than "->" does. >>> >> >>There is no practical difference between ',' and 'andalso' in any way, >>because as you mentioned, an exception would turn into a failure of the >>guard test no matter which one is used. This would be the same no matter >>what the implementation as far as I can tell. >> >>For ';' and 'orelse', there is a practical difference. They don't >>properly 'catch' exceptions, but when learning Erlang I've found the >>explanation I used in LYSE useful and practically applicable (which is >>why I put it in the book). >> >>Of course you can look at the assembler or even at the result of fun2ms >>to see an example of the practical difference: >> >>1> ets:fun2ms(fun(X) when hd(X) > 0 orelse true -> ok end). >>[{'$1',[{'orelse',{'>',{hd,'$1'},0},true}],[ok]}] >>2> ets:fun2ms(fun(X) when hd(X) > 0; true -> ok end). >>[{'$1',[{'>',{hd,'$1'},0}],[ok]}, >>?{'$1',[true],[ok]}] >> >>Showing an example interpretation where the clauses are entirely >>disjoint and more equivalent to two different function clauses than a >>logical operator when observed that way. The same way calling the >>function: >> >>f([]) -> a; >>f(_) -> b. >> >>as f([]) doesn't result in the first clause 'catching' a badmatch >>exception, the ';' doesn't end up catching exceptions either. It's just >>that I personally found the simple rule I put in LYSE to be good enough >>and understandable. >> >>The other comparison point I used in the text was 'nesting' with >>parentheses: >> >>> However (there is always a 'however'), only andalso and orelse can be >>> nested inside guards. This means (A orelse B) andalso C is a valid >>> guard, while (A; B), C is not. Given their different use, the best >>> strategy is often to mix them as necessary. >> >>I believe I ended up grouping ',' and ';', 'andalso' and 'orelse', and >>'and' and 'or' (that's a confusing sentence) in the explanations of this >>chapter because they just fit well together in pairs. That did end up >>suggesting ',' catches exceptions, while it clearly shouldn't. >> >>People are of course free to question the method I used there and to >>disagree with it. I won't be debating it in much detail because, as I >>said, I felt entirely satisfied with the method I used to explain it, >>and felt it is more easily understandable than going into the details of >>how everything gets compiled lower down. >> >>LYSE probably papers over a lot of issues in that manner, especially in >>the earlier chapters. That's both a result of me writing the book as the >>entire learning experience was still fresh in my mind (and I reported >>things as they made sense to me back then), and not wanting to get into >>details before people are even able to compile code. >> >>I'm hoping, for the benefit of their own learning experience, that >>readers who feel like getting a more formal approach to learning Erlang >>likely wouldn't pick the book with the weird squid and badly written >>title over the other alternatives. Hopefully I can't be accused of false >>representation on the book's cover and tone. >> >>I'm also hoping people are generally satisfied with LYSE, but of course, >>there's no guarantee, and the errata of the book[1] only proves I am able >>to make a ton of mistakes. >> >>Regards, >>Fred. >> >>[1] http://www.nostarch.com/erlang#updates (click on 'show updates') >> >>_______________________________________________ >>erlang-questions mailing list >>erlang-questions@REDACTED >>http://erlang.org/mailman/listinfo/erlang-questions >> > > >_______________________________________________ >erlang-questions mailing list >erlang-questions@REDACTED >http://erlang.org/mailman/listinfo/erlang-questions > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From lloyd@REDACTED Mon May 19 16:18:56 2014 From: lloyd@REDACTED (Lloyd R. Prentice) Date: Mon, 19 May 2014 10:18:56 -0400 Subject: [erlang-questions] Storing images In-Reply-To: <920ED0A5-2386-47D2-B452-989DB732F3E6@gmail.com> References: <76C6CCCF-45AF-4587-AECD-5A863D456AC3@writersglen.com> <920ED0A5-2386-47D2-B452-989DB732F3E6@gmail.com> Message-ID: Thank you, Dimitry. Sent from my iPad > On May 19, 2014, at 4:57 AM, Dmitry Kolesnikov wrote: > > Hello, > > The access pattern for images and it?s meta-data is different. > They have different TTL properties and caching hierarchy. > > Therefore, storing images and its meta-data inside single record is not good idea. > You are absolutely right that distributed binary storage for images shall be separated from metadata storage. > > The best solution depends on many factors including your hosting requirements, CDN vendors, costs, etc... > > I would use Riak for meta-data but AWS S3 + CloudFront for binary content. > > > Best Regards, > Dmitry > > >> On 19 May 2014, at 06:52, Lloyd R. Prentice wrote: >> >> Hello, >> >> Suppose I anticipate unknown thousands of records, each containing meta-data associated with an image. Each image averages, say, 100KB. Retrieval is by key and queries on the meta data. Retrieval predominates over insert. Reliability and speed of access are high on the requirements list. >> >> I'm considering Riak. But... >> >> Questions: >> >> - Would it be best practice to store the each image in its associated record or would it be better to store the images separately in, say, directories or in a separate distributed file system such as leoFS? >> >> - Is there a better solution altogether? >> >> Many thanks, >> >> LRP >> >> Sent from my iPad >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://erlang.org/mailman/listinfo/erlang-questions > From lists@REDACTED Mon May 19 18:50:01 2014 From: lists@REDACTED (Camille Troillard) Date: Mon, 19 May 2014 18:50:01 +0200 Subject: [erlang-questions] gen_event identifier Message-ID: Hello, Two gen_event handlers are disambiguated by using {Module, Id} as the Handler parameters of gen_event:add_handler/3. I would like to know how I can get access to the Id part from within a Module:handle_event/2 callback. Is it possible? Thanks! Best, Cam From ulf@REDACTED Mon May 19 20:03:16 2014 From: ulf@REDACTED (Ulf Wiger) Date: Mon, 19 May 2014 20:03:16 +0200 Subject: [erlang-questions] gen_event identifier In-Reply-To: References: Message-ID: <0A47A147-8C20-495C-9CB3-62CA7E5F2DFA@feuerlabs.com> When calling gen_event:add_handler(EventMgr, {Module, Id}, Args), pass along Id as part of Args, and store it in the handler state. BR, Ulf W On 19 May 2014, at 18:50, Camille Troillard wrote: > Hello, > > Two gen_event handlers are disambiguated by using {Module, Id} as the Handler parameters of gen_event:add_handler/3. > > I would like to know how I can get access to the Id part from within a Module:handle_event/2 callback. Is it possible? > > Thanks! > > > Best, > Cam > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions Ulf Wiger, Co-founder & Developer Advocate, Feuerlabs Inc. http://feuerlabs.com From g@REDACTED Mon May 19 20:34:25 2014 From: g@REDACTED (Garrett Smith) Date: Mon, 19 May 2014 13:34:25 -0500 Subject: [erlang-questions] Storing images In-Reply-To: <76C6CCCF-45AF-4587-AECD-5A863D456AC3@writersglen.com> References: <76C6CCCF-45AF-4587-AECD-5A863D456AC3@writersglen.com> Message-ID: On Sun, May 18, 2014 at 10:52 PM, Lloyd R. Prentice wrote: > Hello, > > Suppose I anticipate unknown thousands of records But what do you have to deal with *now*? > each containing meta-data associated with an image. Each image averages, say, 100KB. Retrieval is by key and queries on the meta data. Retrieval predominates over insert. Reliability and speed of access are high on the requirements list. > > I'm considering Riak. But... You'll learn a lot about Riak, but not necessarily the problem that you're trying to solve *now* :) > - Would it be best practice to store the each image in its associated record or would it be better to store the images separately in, say, directories or in a separate distributed file system such as leoFS? It's fun to learn about file systems, but what do you need right *now* :) I realize it's a dreadfully boring, but consider possibly more direct paths to getting things to work: - Store everything, metadata + binary payload as an Erlang tuple in dets (you can judge if the 2GB limit is a problem - this would give you ~ 20K entries) - If the 2GB limit makes you squeamish, store the tuple as an Erlang encoded binary in something like LevelDB (which is solidly supported now thanks to Basho's work) - Store the images in a directory with the metadata stored as formatted Elang terms (easy to write, easy to read) in text files alongside the images (e.g. 0000001.jpg + 0000001.meta) You add an index on top of any of these to improve performance, but this is an optimization. I like to run full scans just to see how fast my computer is. For "thousands" I wouldn't worry until you see a problem. Consider this solution temporary until you need to change it -- who knows, the direct approach just might live longer than you think. And if you do need to change the system, you'll have a lot more data to help in your next steps. I'm not trying to second guess your requirements -- you know them best. But I find it can be helpful to look closely at the stupider options as well as the fancier ones. Garrett From cabo@REDACTED Mon May 19 22:01:25 2014 From: cabo@REDACTED (Carsten Bormann) Date: Mon, 19 May 2014 22:01:25 +0200 Subject: [erlang-questions] BSON parsing? In-Reply-To: <1400230647.69745.YahooMailNeo@web140103.mail.bf1.yahoo.com> References: <5374A69D.6000109@ninenines.eu> <1D6F99F2-8CA1-42E2-BEE2-F1FFF467CF80@cs.otago.ac.nz> <1400230647.69745.YahooMailNeo@web140103.mail.bf1.yahoo.com> Message-ID: <835896FD-EB6E-4B27-900E-1743032F3743@tzi.org> On 16 May 2014, at 10:57, Thomas Lindgren wrote: > Being dirty, you don't have to think about things like NaNs, infinities, denormalized numbers, fp according to ISO/IEC 9899:TC3 Section 7.6, tracking the evolution of fp standards or what to do about You certainly have to think about denormalized numbers in Erlang if you care about your floating point values. (You don?t get non-finites, you get exceptions instead. Do do get silent underflows.) Much of the complexity*) of C?s support for floating point comes from *not* simply assuming IEEE 754. Fixing that can simplify floating point so much. (Of course it also means you cannot take advantage as much of some weird non-754 floating point capability your target system might have. It seems pretty clear to me which of these considerations would win for a language like Erlang from a 2014+ point of view.) Gr??e, Carsten *) (Much of the rest of the complexity comes from not having exceptions available as a language construct.) From joerg.maushake@REDACTED Mon May 19 23:59:25 2014 From: joerg.maushake@REDACTED (=?UTF-8?Q?=22J=C3=B6rg_Maushake=22?=) Date: Mon, 19 May 2014 23:59:25 +0200 Subject: [erlang-questions] windows multicast In-Reply-To: <12F2115FD1CCEE4294943B2608A18FA3011E6E6003@MAIL01.win.lbaum.eu> References: , , <9C7C51F8-3138-419C-B4E3-F0FBF0C1FC6A@gmail.com> , <39C004AF-A986-4372-A402-B6D1236171C2@gmail.com>, , <12F2115FD1CCEE4294943B2608A18FA3011E6E4ECD@MAIL01.win.lbaum.eu>, , <12F2115FD1CCEE4294943B2608A18FA3011E6E6003@MAIL01.win.lbaum.eu> Message-ID: An HTML attachment was scrubbed... URL: From steven.charles.davis@REDACTED Tue May 20 00:05:22 2014 From: steven.charles.davis@REDACTED (Steve Davis) Date: Mon, 19 May 2014 15:05:22 -0700 (PDT) Subject: [erlang-questions] difference between ", " and "andalso" in guards In-Reply-To: References: Message-ID: I can't imagine an output difference. Shouldn't "," =:= "andalso" and ";" =:= "orelse". The difference appears to be a performance optimization - where would the "orelse shortcut" be incorrect? (Could be I'm underthinking this)... On Saturday, May 17, 2014 11:20:08 PM UTC-5, Adel Zhang wrote: > > hi, I am currently reading "learnyousomeerlang". In "Syntax in Functions" > > chapter "guards" section, Fred said > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From lloyd@REDACTED Tue May 20 00:35:39 2014 From: lloyd@REDACTED (lloyd@REDACTED) Date: Mon, 19 May 2014 18:35:39 -0400 (EDT) Subject: [erlang-questions] Storing images In-Reply-To: References: <76C6CCCF-45AF-4587-AECD-5A863D456AC3@writersglen.com> Message-ID: <1400538939.87554482@apps.rackspace.com> Hi Garrett, Walk before I run? Point well taken. Best wishes, Lloyd -----Original Message----- From: "Garrett Smith" Sent: Monday, May 19, 2014 2:34pm To: "Lloyd R. Prentice" Cc: "Erlang-Questions Questions" Subject: Re: [erlang-questions] Storing images On Sun, May 18, 2014 at 10:52 PM, Lloyd R. Prentice wrote: > Hello, > > Suppose I anticipate unknown thousands of records But what do you have to deal with *now*? > each containing meta-data associated with an image. Each image averages, say, 100KB. Retrieval is by key and queries on the meta data. Retrieval predominates over insert. Reliability and speed of access are high on the requirements list. > > I'm considering Riak. But... You'll learn a lot about Riak, but not necessarily the problem that you're trying to solve *now* :) > - Would it be best practice to store the each image in its associated record or would it be better to store the images separately in, say, directories or in a separate distributed file system such as leoFS? It's fun to learn about file systems, but what do you need right *now* :) I realize it's a dreadfully boring, but consider possibly more direct paths to getting things to work: - Store everything, metadata + binary payload as an Erlang tuple in dets (you can judge if the 2GB limit is a problem - this would give you ~ 20K entries) - If the 2GB limit makes you squeamish, store the tuple as an Erlang encoded binary in something like LevelDB (which is solidly supported now thanks to Basho's work) - Store the images in a directory with the metadata stored as formatted Elang terms (easy to write, easy to read) in text files alongside the images (e.g. 0000001.jpg + 0000001.meta) You add an index on top of any of these to improve performance, but this is an optimization. I like to run full scans just to see how fast my computer is. For "thousands" I wouldn't worry until you see a problem. Consider this solution temporary until you need to change it -- who knows, the direct approach just might live longer than you think. And if you do need to change the system, you'll have a lot more data to help in your next steps. I'm not trying to second guess your requirements -- you know them best. But I find it can be helpful to look closely at the stupider options as well as the fancier ones. Garrett From nem@REDACTED Tue May 20 00:44:35 2014 From: nem@REDACTED (Geoff Cant) Date: Mon, 19 May 2014 15:44:35 -0700 Subject: [erlang-questions] gen_leader status In-Reply-To: References: Message-ID: I re-implemented the Async Bully algorithm a couple of years ago - the code is here: https://github.com/ngmoco/gl_async_bully It's probably only useful as a reference - it had one production deployment, but contains shortcomings such as not being able to modify the set of candidate nodes while online. I am personally dubious of the correctness of all the Erlang leader election libraries I'm aware of, for either code quality issues or lack of quickcheck tests - having tried to implement this I now understand how hard it is to get right. My own implementation lacks tests and I include it in the list of implementations I'm dubious of :) Even the academic literature on distributed leader election seems pretty light, or leaves important operational concerns (such as modifying the candidate node set) unspecified; when you add these operations to the protocol, you're no-longer running the algorithm that was proved correct in the paper. Cheers, -- Geoff Cant On 2014-05-16, at 14:48 , Mark Allen wrote: > Is https://github.com/chenyu468/gen_leader_revival the "best" repo for a > leader election behavior? > > Is there a better (more up-to-date) fork of this or some other > implementation that we should consider instead? > > Thanks. > > Mark > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions From bob@REDACTED Tue May 20 00:48:36 2014 From: bob@REDACTED (Bob Ippolito) Date: Mon, 19 May 2014 15:48:36 -0700 Subject: [erlang-questions] difference between ", " and "andalso" in guards In-Reply-To: References: Message-ID: It's not really a performance optimization, it's a difference in semantics. This function in pseudo-erlang: f(X) when A(X); B(X) -> Y(X); f(X) -> Z(X). Is operationally equivalent to this one: f(X) when A(X) -> Y(X); f(X) when B(X) -> Y(X); f(X) -> Z(X). Using orelse behaves differently, it doesn't treat the arguments quite so independently. 1> (fun () when hd([]) orelse true -> ok end)(). ** exception error: no function clause matching erl_eval:'-inside-an-interpreted-fun-'() 2> (fun () when hd([]); true -> ok end)(). ok On Mon, May 19, 2014 at 3:05 PM, Steve Davis wrote: > I can't imagine an output difference. Shouldn't "," =:= "andalso" and ";" > =:= "orelse". > > The difference appears to be a performance optimization - where would the > "orelse shortcut" be incorrect? > > (Could be I'm underthinking this)... > > > On Saturday, May 17, 2014 11:20:08 PM UTC-5, Adel Zhang wrote: >> >> hi, I am currently reading "learnyousomeerlang". In "Syntax in Functions" >> >> chapter "guards" section, Fred said >> >> >> > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From ok@REDACTED Tue May 20 01:00:15 2014 From: ok@REDACTED (Richard A. O'Keefe) Date: Tue, 20 May 2014 11:00:15 +1200 Subject: [erlang-questions] Code complexity and encapsulation In-Reply-To: References: Message-ID: On 19/05/2014, at 8:50 PM, Suraj Kumar wrote: > > The problem domain is analogous to a drawing system: There is a 2D 'canvas onto which several different types of 'shape objects' can be fit into. Once they are all placed on the canvas, it is required that the canvas gets to know all the shapes which seem to coincide with point P (x, y co-ordinates) (or must do similar natured querying of all the shapes without being aware of their details). To find this, the canvas has to ask each shape, in an agnostic/implementation-independent way, whether the object "is_on_point (x,y)". ARGH! No! Please don't do that! There is an abundance of 2D spatial indexing structures. Have an "index". Each "object" tells the index what its shape is. The "canvas" asks the index its spatial questions. We are talking about the difference between "millions" and the logarithm of "millions". 2*21/21 is roughly 10**5. Getting the canvas to ask each object "do you overlap this point" is just going to be insanely slow compared with what you could do. From mjtruog@REDACTED Tue May 20 01:58:27 2014 From: mjtruog@REDACTED (Michael Truog) Date: Mon, 19 May 2014 16:58:27 -0700 Subject: [erlang-questions] difference between ", " and "andalso" in guards In-Reply-To: References: Message-ID: <537A9AA3.1020100@gmail.com> The semantics have been mentioned as different. However, it seems like people haven't mentioned a practical aspect, which is and/or/andalso/orelse can be nested with parenthesis within a guard, but ;/, are always top-level and unable to be nested. That may be a helpful way of thinking about it. On 05/17/2014 09:20 PM, Adel Zhang wrote: > hi, I am currently reading "learnyousomeerlang". In "Syntax in Functions" chapter "guards" section, Fred said > > > Note: I've compared , and ; in guards to the operators andalso and orelse. They're not exactly the same, though. The former pair will catch exceptions as they happen while the latter won't. What this means is that if there is an error thrown in the first part of the guard X >= N; N >= 0, the second part can still be evaluated and the guard might succeed; if an error was thrown in the first part of X >= N orelse N >= 0, the second part will also be skipped and the whole guard will fail. > > > So I write a codesnippet: > > -module(g). > -export ([right_age/1, right_age_2/1, right_age_3/1]). > > right_age(X) when X >= 16, X =< 104 -> > true; > right_age(_) -> > false. > > > right_age_2(X) when (X >= 16) andalso (X =< 104) -> > true; > right_age_2(_) -> > false. > > right_age_3(X) when (X >= 16) and (X =< 104) -> > true; > right_age_3(_) -> > false. > > > And compile with 'S' option to get the assembly code as follow: > > {function, right_age, 1, 2}. > {label,1}. > {line,[{location,"g.erl",4}]}. > {func_info,{atom,g},{atom,right_age},1}. > {label,2}. > {test,is_ge,{f,3},[{x,0},{integer,16}]}. > {test,is_ge,{f,3},[{integer,104},{x,0}]}. > {move,{atom,true},{x,0}}. > return. > {label,3}. > {move,{atom,false},{x,0}}. > return. > > > {function, right_age_2, 1, 5}. > {label,4}. > {line,[{location,"g.erl",10}]}. > {func_info,{atom,g},{atom,right_age_2},1}. > {label,5}. > {test,is_ge,{f,6},[{x,0},{integer,16}]}. > {test,is_ge,{f,6},[{integer,104},{x,0}]}. > {move,{atom,true},{x,0}}. > return. > {label,6}. > {move,{atom,false},{x,0}}. > return. > > > {function, right_age_3, 1, 8}. > {label,7}. > {line,[{location,"g.erl",15}]}. > {func_info,{atom,g},{atom,right_age_3},1}. > {label,8}. > {test,is_ge,{f,9},[{x,0},{integer,16}]}. > {test,is_ge,{f,9},[{integer,104},{x,0}]}. > {move,{atom,true},{x,0}}. > return. > {label,9}. > {move,{atom,false},{x,0}}. > return. > > > > Apparently the three version right_age function assembly code are almost same. It confuse me totally. > > 1) can assembly code tell the function behaviour difference? > 2) what does {f,6} {x,0} in assembly code mean? > 3) how can I verify Fred's statement? > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > From jinni.park@REDACTED Tue May 20 04:50:38 2014 From: jinni.park@REDACTED (Park, Sungjin) Date: Tue, 20 May 2014 11:50:38 +0900 Subject: [erlang-questions] integrating inter-process protocol checkers In-Reply-To: References: Message-ID: Rich, are you willing to share your achievement in public? On Mon, May 19, 2014 at 9:57 PM, Rich Neswold wrote: > On Sat, May 17, 2014 at 10:33 AM, Vlad Dumitrescu > wrote: > > I was thinking today (obvious from the number of mails to the list :-) ) > and > > was considering how great idea protocol checkers are and wondered why > they > > aren't used and popularized more. > > Protocol checkers are wonderful. > > > One of the possible reasons is that in order to be able to use them > > everywhere, one has to use a specific architecture: with middleman > processes > > in front of every server process. This is somewhat clunky, introducing > > elements that are not related to the application domain. Besides, it > makes > > it difficult to add them to existing applications. > > A colleague and I have developed a protocol compiler which takes a > protocol specification file and generates source code to > marshal/unmarshal the messages. It's very similar to Google's protobuf > idea and we seriously considered using their's, but there were some > requirements at Fermilab which it didn't meet, so we rolled our own. > We support C++, Java, Objective-C and Erlang (which are all used in > our Control System) and we also target Python and OCaml (which are > experimental.) > > We don't use middleware: each generator uses the target language's > method of choice to prep an outgoing message. So, for example, the C++ > code will write to a stream; the Erlang code builds a binary (which > can then be sent to a socket.); etc. > > The generated code for each target language validates the messages and > will only succeed if every required field is present and is of the > correct type and in range. Handling protocols, before this tool was > created, was tedious and error-prone. Now adding features is a breeze > and we regularly add or refactor protocol messages. > > -- > Rich > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > -- Park, Sungjin ------------------------------------------------------------------------------------------------------------------- Peculiar travel suggestions are dancing lessons from god. -- The Books of Bokonon ------------------------------------------------------------------------------------------------------------------- -------------- next part -------------- An HTML attachment was scrubbed... URL: From ok@REDACTED Tue May 20 07:34:36 2014 From: ok@REDACTED (ok@REDACTED) Date: Tue, 20 May 2014 17:34:36 +1200 Subject: [erlang-questions] difference between ", " and "andalso" in guards In-Reply-To: References: Message-ID: > Using orelse behaves differently, it doesn't treat the arguments quite so > independently. > > 1> (fun () when hd([]) orelse true -> ok end)(). > ** exception error: no function clause matching > erl_eval:'-inside-an-interpreted-fun-'() > 2> (fun () when hd([]); true -> ok end)(). > ok > Is this deliberate? It looks very like a bug. It is hard to imagine this distinction being *useful*. The right thing to do would have been to allow , and ; to be nested in guards. *Sigh*. From ok@REDACTED Tue May 20 07:43:56 2014 From: ok@REDACTED (ok@REDACTED) Date: Tue, 20 May 2014 17:43:56 +1200 Subject: [erlang-questions] difference between ", " and "andalso" in guards In-Reply-To: References: Message-ID: Can we put this simply? Inside a guard, if there is an exception anywhere in a guard test, the entire test is taken as false. (G1 , G2) and (G1 ; G2) contain guard tests but are not guard tests themselves. (G1 andalso G2) and (G1 orelse G2) contain guard tests are *are* guard tests themselves: a failure in in G1 or G2 fails the *whole* guard test. Or to put it even more simply: 'andalso' and 'orelse' are transparent to exception failure, while ',' and ';' and '->' are not. From vladdu55@REDACTED Tue May 20 08:51:39 2014 From: vladdu55@REDACTED (Vlad Dumitrescu) Date: Tue, 20 May 2014 08:51:39 +0200 Subject: [erlang-questions] integrating inter-process protocol checkers In-Reply-To: References: Message-ID: Hi Rich, On Mon, May 19, 2014 at 2:57 PM, Rich Neswold wrote: > On Sat, May 17, 2014 at 10:33 AM, Vlad Dumitrescu > wrote: > > I was thinking today (obvious from the number of mails to the list :-) ) > and > > was considering how great idea protocol checkers are and wondered why > they > > aren't used and popularized more. > > Protocol checkers are wonderful. > > > One of the possible reasons is that in order to be able to use them > > everywhere, one has to use a specific architecture: with middleman > processes > > in front of every server process. This is somewhat clunky, introducing > > elements that are not related to the application domain. Besides, it > makes > > it difficult to add them to existing applications. > > A colleague and I have developed a protocol compiler which takes a > protocol specification file and generates source code to > marshal/unmarshal the messages. It's very similar to Google's protobuf > idea and we seriously considered using their's, but there were some > requirements at Fermilab which it didn't meet, so we rolled our own. > We support C++, Java, Objective-C and Erlang (which are all used in > our Control System) and we also target Python and OCaml (which are > experimental.) > > We don't use middleware: each generator uses the target language's > method of choice to prep an outgoing message. So, for example, the C++ > code will write to a stream; the Erlang code builds a binary (which > can then be sent to a socket.); etc. > > The generated code for each target language validates the messages and > will only succeed if every required field is present and is of the > correct type and in range. Handling protocols, before this tool was > created, was tedious and error-prone. Now adding features is a breeze > and we regularly add or refactor protocol messages. > Generating the code for marshalling from a protocol specification is very useful too, but I think it falls short in some areas. A marshaller is always needed and if it is generated from a higher-level description, it is less prone to errors. However, it is local to the endpoint of the connection and knows only of the messages it handles. In order to make sense of what's happening in a system, one needs to gather information from all these stubs and put it together, which is difficult to do 'live'. A proxy process knows about all messages going back and forth, their timing and order. It can even hold state and issue warnings/errors right away based on the whole conversation going on. A server process could have a single proxy in front of it, handling all connections from clients, or there could be one proxy per client connection, making it an implementation of channels. The latter is probably more difficult to implement transparently (if possible at all). regards, Vlad -------------- next part -------------- An HTML attachment was scrubbed... URL: From davidnwelton@REDACTED Tue May 20 11:07:48 2014 From: davidnwelton@REDACTED (David Welton) Date: Tue, 20 May 2014 11:07:48 +0200 Subject: [erlang-questions] Jinterface receiveRPC bug? In-Reply-To: <5049CD8B.9060907@gmail.com> References: <5049CD8B.9060907@gmail.com> Message-ID: Hi, Did you ever figure this out? We're observing some similar behavior that's a bit odd. I'm not the one following the Java code, so I will have to ask for some details, but our Java guy is complaining about getting null back as well. It's likely to have something to do with having both receiveRPC and other code that also does a receive... at least that's my intuition. Any guidance on this? On Fri, Sep 7, 2012 at 12:33 PM, Damian Dobroczy?ski wrote: > Hi list! > > We've found irritating problem with jinterface (R15B01): from time to time > "receiveRPC()" method returns "null" instead of > sensible value. After short digging we've found such scenario: > > ... sendRPC/receiveRPC > [java] erlang Jinterface says: I got: '{rex,['node102@REDACTED']}' > > ... sendRPC/receiveRPC > [java] erlang Jinterface says: I got: '{rex,{jpg,#Bin<32162>}}' > > ... sendRPC/receiveRPC > [java] erlang Jinterface says: I got: '{rex,['node102@REDACTED']}' > > ... sendRPC/receiveRPC > [java] erlang Jinterface says: I got: > '{'$gen_call',{#Pid,#Ref},{is_auth,'node106@REDACTED'}}' > > ... > > (we've changed "receiveRPC" method to produce log entries) > > "{rex, ...} messages are OK. The last one is suprising. Is it proper > behavior? I mean, does a Java node receive occasionally "is_auth" messages > (I think they are related somehow to net_kernel module) ? "node6" IS the > node we're connected to. > > -- D. > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > -- David N. Welton http://www.welton.it/davidw/ http://www.dedasys.com/ From vladdu55@REDACTED Tue May 20 11:21:46 2014 From: vladdu55@REDACTED (Vlad Dumitrescu) Date: Tue, 20 May 2014 11:21:46 +0200 Subject: [erlang-questions] Jinterface receiveRPC bug? In-Reply-To: References: <5049CD8B.9060907@gmail.com> Message-ID: Hi! The documentation for receiveRPC states: * Receive an RPC reply from the remote Erlang node. This convenience * function receives a message from the remote node, and expects it to have * the following format: * *
     * { rex, Term }
     * 
* * @return the second element of the tuple if the received message is a * two-tuple, otherwise null. No further error checking is * performed. So it receives whatever message is in the queue and if it's looking like a 'rex' response, it retruns the value; otherwise it returns null. So yes, sometimes the returned value may be null. I usually create a mailbox for each rex request sent - that way it can only receive one message. The method doesn't even check that the first element is the atom 'rex', which can result in other kind of errors. This I would categorize as a bug. regards, Vlad On Tue, May 20, 2014 at 11:07 AM, David Welton wrote: > Hi, > > Did you ever figure this out? We're observing some similar behavior > that's a bit odd. I'm not the one following the Java code, so I will > have to ask for some details, but our Java guy is complaining about > getting null back as well. > > It's likely to have something to do with having both receiveRPC and > other code that also does a receive... at least that's my intuition. > > Any guidance on this? > > On Fri, Sep 7, 2012 at 12:33 PM, Damian Dobroczy?ski > wrote: > > Hi list! > > > > We've found irritating problem with jinterface (R15B01): from time to > time > > "receiveRPC()" method returns "null" instead of > > sensible value. After short digging we've found such scenario: > > > > ... sendRPC/receiveRPC > > [java] erlang Jinterface says: I got: '{rex,['node102@REDACTED']}' > > > > ... sendRPC/receiveRPC > > [java] erlang Jinterface says: I got: '{rex,{jpg,#Bin<32162>}}' > > > > ... sendRPC/receiveRPC > > [java] erlang Jinterface says: I got: '{rex,['node102@REDACTED']}' > > > > ... sendRPC/receiveRPC > > [java] erlang Jinterface says: I got: > > '{'$gen_call',{#Pid >,#Ref},{is_auth,'node106@REDACTED'}}' > > > > ... > > > > (we've changed "receiveRPC" method to produce log entries) > > > > "{rex, ...} messages are OK. The last one is suprising. Is it proper > > behavior? I mean, does a Java node receive occasionally "is_auth" > messages > > (I think they are related somehow to net_kernel module) ? "node6" IS the > > node we're connected to. > > > > -- D. > > > > > > _______________________________________________ > > erlang-questions mailing list > > erlang-questions@REDACTED > > http://erlang.org/mailman/listinfo/erlang-questions > > > > > > -- > David N. Welton > > http://www.welton.it/davidw/ > > http://www.dedasys.com/ > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From davidnwelton@REDACTED Tue May 20 11:40:57 2014 From: davidnwelton@REDACTED (David Welton) Date: Tue, 20 May 2014 11:40:57 +0200 Subject: [erlang-questions] Jinterface receiveRPC bug? In-Reply-To: References: <5049CD8B.9060907@gmail.com> Message-ID: Hi, > So it receives whatever message is in the queue and if it's looking like a > 'rex' response, it retruns the value; otherwise it returns null. Yes, we had just dug that out ourselves: if another message turns up, it blows up. > So yes, > sometimes the returned value may be null. I usually create a mailbox for > each rex request sent - that way it can only receive one message. Ok, we'll look into that. Thank you! The "obvious" thing from an Erlang point of view would be a selective receive, but I don't really see that in a quick glance at the docs, and if you're suggesting mailboxes, I take it that's the best way. > The method doesn't even check that the first element is the atom 'rex', > which can result in other kind of errors. This I would categorize as a bug. Indeed. This method should have a warning that there's a very real risk that it will consume other messages and just return a null. Thanks -- David N. Welton http://www.welton.it/davidw/ http://www.dedasys.com/ From vladdu55@REDACTED Tue May 20 11:49:06 2014 From: vladdu55@REDACTED (Vlad Dumitrescu) Date: Tue, 20 May 2014 11:49:06 +0200 Subject: [erlang-questions] Jinterface receiveRPC bug? In-Reply-To: References: <5049CD8B.9060907@gmail.com> Message-ID: On Tue, May 20, 2014 at 11:40 AM, David Welton wrote: > The "obvious" thing from an > Erlang point of view would be a selective receive, but I don't really > see that in a quick glance at the docs, and if you're suggesting > mailboxes, I take it that's the best way. > JInterface is pretty simple. Implementing selective receive would be quite a job and I guess the code would look ugly as hell (constructing terms is not nice with jinterface). Maybe Java 8's lambda expressions could make it a bit prettier, but I wouldn't bet on that. There are a few Java libraries that extend the functionality, among which erlide has its own. I am planning to extract selected parts and publish them separately and even submit them to OTP, maybe jinterface in v18 will look better... regards, Vlad -------------- next part -------------- An HTML attachment was scrubbed... URL: From dominik_pawlak@REDACTED Tue May 20 15:45:13 2014 From: dominik_pawlak@REDACTED (Dominik Pawlak) Date: Tue, 20 May 2014 14:45:13 +0100 (BST) Subject: [erlang-questions] SNMP usm discovery Message-ID: <1400593513.39879.YahooMailNeo@web172001.mail.ir2.yahoo.com> I'm trying to find a way to perform a snmpEngineID discovery process as defined in RFC3414 chapter 4 in a manager. The process is pretty simple: you send a v3, usm Request message with security level: noAuthNoPriv, empty user name, endineID and varbinds. The agent then sends a report containing his engineID. I tried registering agent with empty or no security name defined, but when I try to send the Request message I get: snmpm:register_agent("u", "a", [{engine_id,[]},{address,[x,x,x,x]},{version,v3},{sec_model,usm},{sec_name,""},{sec_level,noAuthNoPriv}]). snmpm:sync_get("u", "a", "auth", [], 1000). {error,{send_failed,1440625960,unknownSecurityName}} =ERROR REPORT==== 20-May-2014::11:12:57 === [ snmp : manager : snmpm_mpd : <0.55.0> ] MPD: CONFIG ERROR: unknownSecurityName (message: {message,'version-3', ????????????????????????????????????????????????? {v3_hdr,996332938,484, ?????????????????????????????????????????????????? [4], ?????????????????????????????????????????????????? 3,undefined,undefined}, ????????????????????????????????????????????????? [48,24,4,0,4,4,97,117,116, ?????????????????????????????????????????????????? 104,160,14,2,4,85,222,53, ?????????????????????????????????????????????????? 40,2,1,0,2,1,0,48,0]}) I also tried registering a usm user with an empty (one space) name: snmpm:register_usm_user(" ", " ", [{sec_name, "initial"}]). snmpm:register_agent("u", "a", [{engine_id, " "},{address,[x,x,x,x]},{version,v3},{sec_model,usm},{sec_name,"initial"},{sec_level,noAuthNoPriv}]). This time the message is sent, and the agent does respond with a message containing his engineID, but this information is not provided to the snmpm_user module: =INFO REPORT==== 20-May-2014::12:21:45 === SNMPM default user callback received handle_error: ?? ReqId:??? -1 ?? Reason:?? {failed_processing_message, ???????????????? {securityError,usmStatsUnknownEngineIDs}} ?? UserData: undefined {error,{timeout,1440625963}} What is the proper way of doing this? -- Cheers, Dominik Pawlak -------------- next part -------------- An HTML attachment was scrubbed... URL: From magnus@REDACTED Tue May 20 16:08:24 2014 From: magnus@REDACTED (Magnus Henoch) Date: Tue, 20 May 2014 15:08:24 +0100 Subject: [erlang-questions] literal character syntax References: <1419556.oXnLqJ1Ur6@jalapeno> <4432439.UmNban0FWi@jalapeno> Message-ID: zxq9 writes: > On Thursday 15 May 2014 12:36:43 you wrote: >> $ gg -i "stupid emacs" -- \*.erl >> lib/compiler/src/cerl.erl:994: io_lib:write_string(atom_name(Node), $'). >> %' stupid Emacs. lib/compiler/src/core_scan.erl:96:string_thing($') -> >> "atom"; %' stupid emacs >> lib/compiler/src/core_scan.erl:97:string_thing($") -> "string". %" stupid >> emacs >> lib/dialyzer/test/opaque_SUITE_data/src/modules/opaque_erl_scan.erl:313:str >> ing_thing($') -> "atom"; %' Stupid Emacs >> lib/dialyzer/test/options1_SUITE_data/src/compiler/cerl.erl:843: >> io_lib:write_string(atom_name(Node), $'). %' stupi >> lib/edoc/src/edoc_wiki.erl:238:expand_triple([$', $', $' | Cs], L, As, _L0) >> -> % ' stupid emacs lib/hipe/cerl/erl_types.erl:4798: true -> >> io_lib:write_string(atom_to_list(X), $'); % stupid emacs ' >> lib/stdlib/src/erl_scan.erl:331:string_thing($') -> "atom"; %' Stupid >> Emacs lib/syntax_tools/src/erl_prettypr.erl:1011: >> lay_string_1([$" | S2], L - W + 1, W)) %" stupid emacs > > Some work in the emacs mode calling? Most of these issues are fixed in the current version of erlang.el. While looking through the Erlang/OTP sources, I found only two instances of code with character literals that erlang-mode doesn't highlight correctly. From lib/compiler/src/core_scan.erl: pre_scan($', Cs, SoFar, Pos) -> pre_string(Cs, $', '\'', Pos, [$'|SoFar], Pos); pre_scan({'\'',Sp}, Cs, SoFar, Pos) -> %Re-entering quoted atom pre_string(Cs, $', '\'', Sp, SoFar, Pos); pre_scan($", Cs, SoFar, Pos) -> pre_string(Cs, $", '"', Pos, [$"|SoFar], Pos); And from lib/gs/src/gstk_editor.erl: p_index({Line, lineend}) -> [$",gstk:to_ascii(Line), ".1 lineend",$"]; It appears that it gets confused when there is a string or a quoted atom earlier on the line. This follows from the regexps used for font-lock-syntactic-keywords in erlang.el. They attempt to "disable" the escaping function of the dollar sign when it is inside a string, but do so somewhat na?vely. Regards, Magnus From mallen@REDACTED Tue May 20 17:16:13 2014 From: mallen@REDACTED (Mark Allen) Date: Tue, 20 May 2014 10:16:13 -0500 Subject: [erlang-questions] gen_leader status In-Reply-To: References: Message-ID: OK, thanks for the info - I know Joe Blomstedt has been working on leader elections in the context of the paxos implementation on top of Riak. Maybe that code could eventually be sifted out into its own library. Until then we will have to use something else. Maybe a distributed lock - has anyone used Ulf's locks library in production? Thanks. Mark On 5/19/14 5:44 PM, "Geoff Cant" wrote: >I re-implemented the Async Bully algorithm a couple of years ago - the >code is here: https://github.com/ngmoco/gl_async_bully > >It's probably only useful as a reference - it had one production >deployment, but contains shortcomings such as not being able to modify >the set of candidate nodes while online. > >I am personally dubious of the correctness of all the Erlang leader >election libraries I'm aware of, for either code quality issues or lack >of quickcheck tests - having tried to implement this I now understand how >hard it is to get right. My own implementation lacks tests and I include >it in the list of implementations I'm dubious of :) > >Even the academic literature on distributed leader election seems pretty >light, or leaves important operational concerns (such as modifying the >candidate node set) unspecified; when you add these operations to the >protocol, you're no-longer running the algorithm that was proved correct >in the paper. > >Cheers, >-- >Geoff Cant > >On 2014-05-16, at 14:48 , Mark Allen wrote: > >> Is https://github.com/chenyu468/gen_leader_revival the "best" repo for a >> leader election behavior? >> >> Is there a better (more up-to-date) fork of this or some other >> implementation that we should consider instead? >> >> Thanks. >> >> Mark >> >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://erlang.org/mailman/listinfo/erlang-questions > > > > > From ulf@REDACTED Tue May 20 18:43:30 2014 From: ulf@REDACTED (Ulf Wiger) Date: Tue, 20 May 2014 18:43:30 +0200 Subject: [erlang-questions] gen_leader status In-Reply-To: References: Message-ID: <40663F60-0EE9-4C94-8575-CCFF5D5132D1@feuerlabs.com> On 20 May 2014, at 17:16, Mark Allen wrote: > Maybe a distributed lock - has > anyone used Ulf's locks library in production? I?d also like to know that. :) (It?s ok to email me privately) I?m giving ?locks? quite a bit of love myself, not just because I?m fixing to give a talk about it at the EUC. I?m running some fairly large database tests with complex locking patterns (not distributed, though). The gproc_dist test suite also passes on the uw-locks_leader branch. When I?m personally ready to use it in anger, I?ll make an announcement. That?s not to say that I consider it useless now. :) BR, Ulf W Ulf Wiger, Co-founder & Developer Advocate, Feuerlabs Inc. http://feuerlabs.com From rik.ribbers@REDACTED Tue May 20 22:01:52 2014 From: rik.ribbers@REDACTED (Rik Ribbers) Date: Tue, 20 May 2014 22:01:52 +0200 Subject: [erlang-questions] Error with ./rebar generate: "erlsom: Application version clash. Multiple directories contains version \"1.2.1\" Message-ID: Hello, As a Erlang newbie I run into this error when using ./rebar generate ==> rel (generate) ERROR: generate failed while processing /home/rik/workspaces/git/myapplication/rel: {'EXIT',{{badmatch,{error,"erlsom: Application version clash. Multiple directories contains version \"1.2.1\"."}}, I've included my reltool.config and my rebar.config. Any help is appreciated. Kind regards, Rik Ribbers -- reltool.config {sys, [ {lib_dirs, [".."]}, {erts, [{mod_cond, derived}, {app_file, strip}]}, {app_file, strip}, {rel, "myapplication_node", "1", [ kernel, stdlib, sasl, appmon, asn1, crypto, epgsql_pool, epgsql, erlsom, myapplication ]}, {boot_rel, "myapplication_node"}, {profile, embedded}, {incl_cond, exclude}, {excl_archive_filters, [".*"]}, %% Do not archive built libs {excl_sys_filters, ["^bin/(?!start_clean.boot)", "^erts.*/bin/(dialyzer|typer)", "^erts.*/(doc|info|include|lib|man|src)"]}, {excl_app_filters, ["\.gitignore"]}, {app, hipe, [{incl_cond, exclude}]}, {app, kernel, [{incl_cond, include}]}, {app, stdlib, [{incl_cond, include}]}, {app, sasl, [{incl_cond, include}]}, {app, appmon, [{incl_cond, include}]}, {app, asn1, [{incl_cond, include}]}, {app, crypto, [{incl_cond, include}]}, {app, epgsql, [{incl_cond, include},{lib_dir,"../deps/epgsql"}]}, {app, epgsql_pool, [{mod_cond, app}, {incl_cond, include},{lib_dir, "../deps/epgsql_pool"}]}, {app, erlsom, [{incl_cond, include},{lib_dir,"../deps/erlsom"}]}, {app, myapplication, [{mod_cond, app}, {incl_cond, include},{lib_dir,".."}]} ]}. {target_dir, "myapplication_node"}. {overlay, [ {mkdir, "log/sasl"}, {copy, "files/erl", "\{\{erts_vsn\}\}/bin/erl"}, {copy, "files/nodetool", "\{\{erts_vsn\}\}/bin/nodetool"}, {copy, "myapplication_node/bin/start_clean.boot", "\{\{erts_vsn\}\}/bin/start_clean.boot"}, {copy, "files/myapplication_node", "bin/myapplication_node"}, {copy, "files/myapplication_node.cmd", "bin/myapplication_node.cmd"}, {copy, "files/start_erl.cmd", "bin/start_erl.cmd"}, --- rebar.config {sub_dirs,["rel"]}. {erl_opts, [debug_info,{i,"deps/erlsom/include"}]}. {deps_dir, ["deps"]}. {deps, [ {epgsql, ".*", {git, "https://github.com/wg/epgsql.git"}}, {epgsql_pool, ".*", {git, " https://github.com/josephwecker/epgsql_pool.git"}}, {erlsom, ".*", {git, "https://github.com/willemdj/erlsom.git"}} ]}. -------------- next part -------------- An HTML attachment was scrubbed... URL: From erlang@REDACTED Tue May 20 22:31:50 2014 From: erlang@REDACTED (Joe Armstrong) Date: Tue, 20 May 2014 22:31:50 +0200 Subject: [erlang-questions] Storing images In-Reply-To: <76C6CCCF-45AF-4587-AECD-5A863D456AC3@writersglen.com> References: <76C6CCCF-45AF-4587-AECD-5A863D456AC3@writersglen.com> Message-ID: I think you need to provide more data. - how many images ("unknown" thousands is not very precise) - how big is the meta data? I note you say thousands not millions. Say unknown = 100 then you have 100K images 100K images @ 100K per image = 10^10 Bytes = 10 GBytes (= tiny) Assume the meta data is small say 100Bytes/image then the meta data is 10^5 * 100 = 10^7 Bytes = 10 MB (= tiny) If you have a machine with 1GB of memory this is 1% of total memory. I'd Make sure the meta data is small, ie no tags in it and possible compressed and store the lot in RAM you could use an ets table or a custom binary. You can store a heck of a lot of meta data in a GB and a heck of a lot of images in a TB so I'd keep the meta data in RAM and the image data on disk. If you intend to use a SSD you could keep everything on disk Start with the simplest possible correct solution and measure. You'll be amazed what you can do with ets tables and a GB of RAM Cheers /Joe On Mon, May 19, 2014 at 5:52 AM, Lloyd R. Prentice wrote: > Hello, > > Suppose I anticipate unknown thousands of records, each containing > meta-data associated with an image. Each image averages, say, 100KB. > Retrieval is by key and queries on the meta data. Retrieval predominates > over insert. Reliability and speed of access are high on the requirements > list. > > I'm considering Riak. But... > > Questions: > > - Would it be best practice to store the each image in its associated > record or would it be better to store the images separately in, say, > directories or in a separate distributed file system such as leoFS? > > - Is there a better solution altogether? > > Many thanks, > > LRP > > Sent from my iPad > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From lloyd@REDACTED Tue May 20 23:13:23 2014 From: lloyd@REDACTED (lloyd@REDACTED) Date: Tue, 20 May 2014 17:13:23 -0400 (EDT) Subject: [erlang-questions] Storing images In-Reply-To: References: <76C6CCCF-45AF-4587-AECD-5A863D456AC3@writersglen.com> Message-ID: <1400620403.98941604@apps.rackspace.com> Thank you, Joe, I get carried away with all the choices. The simplicity and logic of this approach is comforting. All the best, Lloyd -----Original Message----- From: "Joe Armstrong" Sent: Tuesday, May 20, 2014 4:31pm To: "Lloyd R. Prentice" Cc: "Erlang-Questions Questions" Subject: Re: [erlang-questions] Storing images I think you need to provide more data. - how many images ("unknown" thousands is not very precise) - how big is the meta data? I note you say thousands not millions. Say unknown = 100 then you have 100K images 100K images @ 100K per image = 10^10 Bytes = 10 GBytes (= tiny) Assume the meta data is small say 100Bytes/image then the meta data is 10^5 * 100 = 10^7 Bytes = 10 MB (= tiny) If you have a machine with 1GB of memory this is 1% of total memory. I'd Make sure the meta data is small, ie no tags in it and possible compressed and store the lot in RAM you could use an ets table or a custom binary. You can store a heck of a lot of meta data in a GB and a heck of a lot of images in a TB so I'd keep the meta data in RAM and the image data on disk. If you intend to use a SSD you could keep everything on disk Start with the simplest possible correct solution and measure. You'll be amazed what you can do with ets tables and a GB of RAM Cheers /Joe On Mon, May 19, 2014 at 5:52 AM, Lloyd R. Prentice wrote: > Hello, > > Suppose I anticipate unknown thousands of records, each containing > meta-data associated with an image. Each image averages, say, 100KB. > Retrieval is by key and queries on the meta data. Retrieval predominates > over insert. Reliability and speed of access are high on the requirements > list. > > I'm considering Riak. But... > > Questions: > > - Would it be best practice to store the each image in its associated > record or would it be better to store the images separately in, say, > directories or in a separate distributed file system such as leoFS? > > - Is there a better solution altogether? > > Many thanks, > > LRP > > Sent from my iPad > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > From dszoboszlay@REDACTED Wed May 21 09:39:40 2014 From: dszoboszlay@REDACTED (=?iso-8859-1?Q?D=E1niel_Szoboszlay?=) Date: Wed, 21 May 2014 09:39:40 +0200 Subject: [erlang-questions] SNMP usm discovery In-Reply-To: <1400593513.39879.YahooMailNeo@web172001.mail.ir2.yahoo.com> References: <1400593513.39879.YahooMailNeo@web172001.mail.ir2.yahoo.com> Message-ID: Hi, I think the agent will perform the discovery automatically, so you need to configure it with the actual security level and user name, password etc. that can be used to access the agent. There?s a nice example here on how to set up and use a v3 agent + manager pair: http://erlangcentral.org/wiki/index.php?title=SNMP_Quick_Start The empty user name is not used anywhere explicitly, discovery happens behind the scenes. Regards, Daniel On 2014 May 20, at 15:45 , Dominik Pawlak wrote: > I'm trying to find a way to perform a snmpEngineID discovery process as defined in RFC3414 chapter 4 in a manager. > > The process is pretty simple: you send a v3, usm Request message with security level: noAuthNoPriv, empty user name, endineID and varbinds. The agent then sends a report containing his engineID. > > I tried registering agent with empty or no security name defined, but when I try to send the Request message I get: > snmpm:register_agent("u", "a", [{engine_id,[]},{address,[x,x,x,x]},{version,v3},{sec_model,usm},{sec_name,""},{sec_level,noAuthNoPriv}]). > snmpm:sync_get("u", "a", "auth", [], 1000). > > {error,{send_failed,1440625960,unknownSecurityName}} > =ERROR REPORT==== 20-May-2014::11:12:57 === > [ snmp : manager : snmpm_mpd : <0.55.0> ] > MPD: CONFIG ERROR: unknownSecurityName (message: {message,'version-3', > {v3_hdr,996332938,484, > [4], > 3,undefined,undefined}, > [48,24,4,0,4,4,97,117,116, > 104,160,14,2,4,85,222,53, > 40,2,1,0,2,1,0,48,0]}) > > I also tried registering a usm user with an empty (one space) name: > snmpm:register_usm_user(" ", " ", [{sec_name, "initial"}]). > snmpm:register_agent("u", "a", [{engine_id, " "},{address,[x,x,x,x]},{version,v3},{sec_model,usm},{sec_name,"initial"},{sec_level,noAuthNoPriv}]). > > This time the message is sent, and the agent does respond with a message containing his engineID, but this information is not provided to the snmpm_user module: > > =INFO REPORT==== 20-May-2014::12:21:45 === > SNMPM default user callback received handle_error: > ReqId: -1 > Reason: {failed_processing_message, > {securityError,usmStatsUnknownEngineIDs}} > UserData: undefined > {error,{timeout,1440625963}} > > What is the proper way of doing this? > -- > Cheers, > Dominik Pawlak > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions -------------- next part -------------- An HTML attachment was scrubbed... URL: From dszoboszlay@REDACTED Wed May 21 09:50:27 2014 From: dszoboszlay@REDACTED (=?iso-8859-1?Q?D=E1niel_Szoboszlay?=) Date: Wed, 21 May 2014 09:50:27 +0200 Subject: [erlang-questions] Error with ./rebar generate: "erlsom: Application version clash. Multiple directories contains version \"1.2.1\" In-Reply-To: References: Message-ID: <61DD512E-B789-4E63-BE2C-5035810B985B@gmail.com> Hi, The error message means the erlsom application was found in multiple directories. I guess the lib_dir option in {app, erlsom, [{incl_cond, include},{lib_dir,"../deps/erlsom"}]} confuses reltool (you normally don?t need this option for dependencies, rebar tells reltool where to find them), or maybe there?s an other copy at ../erlsom (as you declare .. as a lib_dir in reltool.config)? Regards. Daniel On 2014 May 20, at 22:01 , Rik Ribbers wrote: > Hello, > > As a Erlang newbie I run into this error when using ./rebar generate > > ==> rel (generate) > ERROR: generate failed while processing /home/rik/workspaces/git/myapplication/rel: {'EXIT',{{badmatch,{error,"erlsom: Application version clash. Multiple directories contains version \"1.2.1\"."}}, > > I've included my reltool.config and my rebar.config. Any help is appreciated. > > Kind regards, > Rik Ribbers > > -- reltool.config > > {sys, [ > {lib_dirs, [".."]}, > {erts, [{mod_cond, derived}, {app_file, strip}]}, > {app_file, strip}, > {rel, "myapplication_node", "1", > [ > kernel, > stdlib, > sasl, > appmon, > asn1, > crypto, > epgsql_pool, > epgsql, > erlsom, > myapplication > ]}, > {boot_rel, "myapplication_node"}, > {profile, embedded}, > {incl_cond, exclude}, > {excl_archive_filters, [".*"]}, %% Do not archive built libs > {excl_sys_filters, ["^bin/(?!start_clean.boot)", > "^erts.*/bin/(dialyzer|typer)", > "^erts.*/(doc|info|include|lib|man|src)"]}, > {excl_app_filters, ["\.gitignore"]}, > {app, hipe, [{incl_cond, exclude}]}, > {app, kernel, [{incl_cond, include}]}, > {app, stdlib, [{incl_cond, include}]}, > {app, sasl, [{incl_cond, include}]}, > {app, appmon, [{incl_cond, include}]}, > {app, asn1, [{incl_cond, include}]}, > {app, crypto, [{incl_cond, include}]}, > {app, epgsql, [{incl_cond, include},{lib_dir,"../deps/epgsql"}]}, > {app, epgsql_pool, [{mod_cond, app}, {incl_cond, include},{lib_dir, "../deps/epgsql_pool"}]}, > {app, erlsom, [{incl_cond, include},{lib_dir,"../deps/erlsom"}]}, > {app, myapplication, [{mod_cond, app}, {incl_cond, include},{lib_dir,".."}]} > ]}. > > {target_dir, "myapplication_node"}. > > {overlay, [ > {mkdir, "log/sasl"}, > {copy, "files/erl", "\{\{erts_vsn\}\}/bin/erl"}, > {copy, "files/nodetool", "\{\{erts_vsn\}\}/bin/nodetool"}, > {copy, "myapplication_node/bin/start_clean.boot", > "\{\{erts_vsn\}\}/bin/start_clean.boot"}, > {copy, "files/myapplication_node", "bin/myapplication_node"}, > {copy, "files/myapplication_node.cmd", "bin/myapplication_node.cmd"}, > {copy, "files/start_erl.cmd", "bin/start_erl.cmd"}, > > --- rebar.config > > {sub_dirs,["rel"]}. > > {erl_opts, [debug_info,{i,"deps/erlsom/include"}]}. > > {deps_dir, ["deps"]}. > > {deps, [ > {epgsql, ".*", {git, "https://github.com/wg/epgsql.git"}}, > {epgsql_pool, ".*", {git, "https://github.com/josephwecker/epgsql_pool.git"}}, > {erlsom, ".*", {git, "https://github.com/willemdj/erlsom.git"}} > ]}. > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions -------------- next part -------------- An HTML attachment was scrubbed... URL: From adelzhang@REDACTED Wed May 21 12:01:15 2014 From: adelzhang@REDACTED (Adel Zhang) Date: Wed, 21 May 2014 18:01:15 +0800 Subject: [erlang-questions] check which scheduler process is running on Message-ID: hi, erlang:system_info(scheduler_id) can get the scheduler id that the calling process is running on. But if I only have the pid, how can I know the scheduler id? From tony@REDACTED Wed May 21 13:07:11 2014 From: tony@REDACTED (Tony Rogvall) Date: Wed, 21 May 2014 13:07:11 +0200 Subject: [erlang-questions] check which scheduler process is running on In-Reply-To: References: Message-ID: <5239B0D8-3E16-4751-9DCD-FA429D84EAD7@rogvall.se> I think you can not really know if the process is actually executing unless the Pid =:= self(). Any thoughts about that ? /Tony On 21 maj 2014, at 12:01, Adel Zhang wrote: > hi, > > erlang:system_info(scheduler_id) can get the scheduler id that the calling process is running on. But if I only have the pid, how can I know the scheduler id? > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions "Installing applications can lead to corruption over time. Applications gradually write over each other's libraries, partial upgrades occur, user and system errors happen, and minute changes may be unnoticeable and difficult to fix" -------------- next part -------------- An HTML attachment was scrubbed... URL: From sverker.eriksson@REDACTED Wed May 21 14:18:55 2014 From: sverker.eriksson@REDACTED (Sverker Eriksson) Date: Wed, 21 May 2014 14:18:55 +0200 Subject: [erlang-questions] check which scheduler process is running on In-Reply-To: <5239B0D8-3E16-4751-9DCD-FA429D84EAD7@rogvall.se> References: <5239B0D8-3E16-4751-9DCD-FA429D84EAD7@rogvall.se> Message-ID: <537C99AF.2030006@erix.ericsson.se> and... processes are in general not bound to a specific scheduler. Which means erlang:system_info(scheduler_id) returns the scheduler the process *was* running on. /Sverker, Erlang/OTP On 05/21/2014 01:07 PM, Tony Rogvall wrote: > I think you can not really know if the process is actually executing unless > the Pid =:= self(). Any thoughts about that ? > > /Tony > > > On 21 maj 2014, at 12:01, Adel Zhang wrote: > >> hi, >> >> erlang:system_info(scheduler_id) can get the scheduler id that the calling process is running on. But if I only have the pid, how can I know the scheduler id? >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://erlang.org/mailman/listinfo/erlang-questions > "Installing applications can lead to corruption over time. Applications gradually write over each other's libraries, partial upgrades occur, user and system errors happen, and minute changes may be unnoticeable and difficult to fix" > > > > > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions -------------- next part -------------- An HTML attachment was scrubbed... URL: From dominik_pawlak@REDACTED Wed May 21 15:26:28 2014 From: dominik_pawlak@REDACTED (Dominik Pawlak) Date: Wed, 21 May 2014 14:26:28 +0100 (BST) Subject: [erlang-questions] SNMP usm discovery In-Reply-To: References: <1400593513.39879.YahooMailNeo@web172001.mail.ir2.yahoo.com> Message-ID: <1400678788.51906.YahooMailNeo@web172002.mail.ir2.yahoo.com> Actually in that example user name and engineID are given in configuration files for both agent and manager. User name is 'simple_user' and engineID is 'agent's engine'. So there is no discovery there, the manager has engineID hard coded in his configuration. I am only developing the manager node, the agents are on third party devices. -- Cheers, Dominik On Wednesday, 21 May 2014, 9:40, D?niel Szoboszlay wrote: Hi, I think the agent will perform the discovery automatically, so you need to configure it with the actual security level and user name, password etc. that can be used to access the agent. There?s a nice example here on how to set up and use a v3 agent + manager pair:?http://erlangcentral.org/wiki/index.php?title=SNMP_Quick_Start?The empty user name is not used anywhere explicitly, discovery happens behind the scenes. Regards, Daniel On 2014 May 20, at 15:45 , Dominik Pawlak wrote: I'm trying to find a way to perform a snmpEngineID discovery process as defined in RFC3414 chapter 4 in a manager. > >The process is pretty simple: you send a v3, usm Request message with security level: noAuthNoPriv, empty user name, endineID and varbinds. The agent then sends a report containing his engineID. > >I tried registering agent with empty or no security name defined, but when I try to send the Request message I get: >snmpm:register_agent("u", "a", [{engine_id,[]},{address,[x,x,x,x]},{version,v3},{sec_model,usm},{sec_name,""},{sec_level,noAuthNoPriv}]). >snmpm:sync_get("u", "a", "auth", [], 1000). > >{error,{send_failed,1440625960,unknownSecurityName}} >=ERROR REPORT==== 20-May-2014::11:12:57 === >[ snmp : manager : snmpm_mpd : <0.55.0> ] >MPD: CONFIG ERROR: unknownSecurityName (message: {message,'version-3', >????????????????????????????????????????????????? {v3_hdr,996332938,484, >?????????????????????????????????????????????????? [4], >?????????????????????????????????????????????????? 3,undefined,undefined}, >????????????????????????????????????????????????? [48,24,4,0,4,4,97,117,116, >?????????????????????????????????????????????????? 104,160,14,2,4,85,222,53, >?????????????????????????????????????????????????? 40,2,1,0,2,1,0,48,0]}) > >I also tried registering a usm user with an empty (one space) name: >snmpm:register_usm_user(" ", " ", [{sec_name, "initial"}]). >snmpm:register_agent("u", "a", [{engine_id, " "},{address,[x,x,x,x]},{version,v3},{sec_model,usm},{sec_name,"initial"},{sec_level,noAuthNoPriv}]). > >This time the message is sent, and the agent does respond with a message containing his engineID, but this information is not provided to the snmpm_user module: > >=INFO REPORT==== 20-May-2014::12:21:45 === >SNMPM default user callback received handle_error: >?? ReqId:??? -1 >?? Reason:?? {failed_processing_message, >???????????????? {securityError,usmStatsUnknownEngineIDs}} >?? UserData: undefined >{error,{timeout,1440625963}} > >What is the proper way of doing this? > >-- Cheers, Dominik Pawlak_______________________________________________ >erlang-questions mailing list >erlang-questions@REDACTED >http://erlang.org/mailman/listinfo/erlang-questions > _______________________________________________ erlang-questions mailing list erlang-questions@REDACTED http://erlang.org/mailman/listinfo/erlang-questions -------------- next part -------------- An HTML attachment was scrubbed... URL: From roger@REDACTED Wed May 21 15:44:20 2014 From: roger@REDACTED (Roger Lipscombe) Date: Wed, 21 May 2014 14:44:20 +0100 Subject: [erlang-questions] exometer: per-client connection counts Message-ID: I'm wondering if exometer can help me with the following problem: Clients to our server are supposed to stay connected for a reasonable length of time. We're seeing some clients connecting and disconnecting repeatedly very quickly. It's difficult to see this in the log file, so I'm wondering whether exometer (or similar) could help. What I'm looking for is a way to push a 'client #42 connected' event, and have these grouped by client ID, and aggregated over, say, a 30 second window. Then, if I saw more than say, 20 connection events from a particular client within the most-recent window, I could log that as a warning. Is this something that exometer (+graphite) can do? If so, does anyone have an example of how to do it? We're also playing with having a diagnostics UI -- something like the RabbitMQ admin UI -- it'd be nice to display the top 20 offenders. Is this something that exometer (or something else) could help with? Alternatively, we're already using folsom+folsomite+graphite. Could I do this using those? Thanks, Roger. From per@REDACTED Wed May 21 15:45:31 2014 From: per@REDACTED (Per Hedeland) Date: Wed, 21 May 2014 15:45:31 +0200 (CEST) Subject: [erlang-questions] SHA-256/512 password hashing Message-ID: <201405211345.s4LDjV5i070288@pluto.hedeland.org> Hi, Surely someone has already implemented the SHA-256- and SHA-512-based password hashing algorithms used by current libc crypt(3) implementations, as specified in http://www.akkadia.org/drepper/SHA-crypt.txt, in Erlang, and is willing to share the result? I didn't succeed with google... --Per Hedeland From dmkolesnikov@REDACTED Wed May 21 15:49:22 2014 From: dmkolesnikov@REDACTED (Dmitry Kolesnikov) Date: Wed, 21 May 2014 16:49:22 +0300 Subject: [erlang-questions] SHA-256/512 password hashing In-Reply-To: <201405211345.s4LDjV5i070288@pluto.hedeland.org> References: <201405211345.s4LDjV5i070288@pluto.hedeland.org> Message-ID: <63D31957-C304-4984-83F9-8313B856B5F9@gmail.com> Hello, This is part of crypto http://erlang.org/doc/man/crypto.html hash_algorithms() = md5 | ripemd160 | sha | sha224 | sha256 | sha384 | sha512 e.g. crypto:hash(sha256, <>). - Dmitry On 21 May 2014, at 16:45, Per Hedeland wrote: > Hi, > > Surely someone has already implemented the SHA-256- and SHA-512-based > password hashing algorithms used by current libc crypt(3) implementations, > as specified in http://www.akkadia.org/drepper/SHA-crypt.txt, in Erlang, > and is willing to share the result? I didn't succeed with google... > > --Per Hedeland > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions From per@REDACTED Wed May 21 15:53:53 2014 From: per@REDACTED (Per Hedeland) Date: Wed, 21 May 2014 15:53:53 +0200 (CEST) Subject: [erlang-questions] SHA-256/512 password hashing In-Reply-To: <63D31957-C304-4984-83F9-8313B856B5F9@gmail.com> Message-ID: <201405211353.s4LDrre9070459@pluto.hedeland.org> Dmitry Kolesnikov wrote: > >This is part of crypto Thanks, I know where to find SHA-256 and SHA-512, that's not what the question was about - i.e. it's a matter of what you hash and how. See the link. --Per From roger@REDACTED Wed May 21 16:12:18 2014 From: roger@REDACTED (Roger Lipscombe) Date: Wed, 21 May 2014 15:12:18 +0100 Subject: [erlang-questions] How do I tell whether a process is using proc_lib? Message-ID: Specifically, if I call sys:get_state(Pid) on a process that's not using proc_lib, and that process doesn't deal with {system, get_state} messages, it'll crash with a case_clause in loop (or whatever). This is a bad thing. Can I tell that a process is a proc_lib process (or a gen_server, gen_fsm, etc.) before accidentally killing it? Thanks, Roger. From dszoboszlay@REDACTED Wed May 21 16:45:20 2014 From: dszoboszlay@REDACTED (=?iso-8859-1?Q?D=E1niel_Szoboszlay?=) Date: Wed, 21 May 2014 16:45:20 +0200 Subject: [erlang-questions] How do I tell whether a process is using proc_lib? In-Reply-To: References: Message-ID: <65020E5A-E221-45BF-9932-EE4322C55F6B@gmail.com> Observer already implemented such a check: https://github.com/erlang/otp/blob/maint/lib/observer/src/observer_procinfo.erl#L287-L295 BR, Daniel On 2014 May 21, at 16:12 , Roger Lipscombe wrote: > Specifically, if I call sys:get_state(Pid) on a process that's not > using proc_lib, and that process doesn't deal with {system, get_state} > messages, it'll crash with a case_clause in loop (or whatever). > > This is a bad thing. Can I tell that a process is a proc_lib process > (or a gen_server, gen_fsm, etc.) before accidentally killing it? > > Thanks, > Roger. > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions From roger@REDACTED Wed May 21 16:48:50 2014 From: roger@REDACTED (Roger Lipscombe) Date: Wed, 21 May 2014 15:48:50 +0100 Subject: [erlang-questions] How do I tell whether a process is using proc_lib? In-Reply-To: <65020E5A-E221-45BF-9932-EE4322C55F6B@gmail.com> References: <65020E5A-E221-45BF-9932-EE4322C55F6B@gmail.com> Message-ID: On 21 May 2014 15:45, D?niel Szoboszlay wrote: > Observer already implemented such a check: > https://github.com/erlang/otp/blob/maint/lib/observer/src/observer_procinfo.erl#L287-L295 Perfect, thanks. From dszoboszlay@REDACTED Wed May 21 17:20:15 2014 From: dszoboszlay@REDACTED (=?iso-8859-1?Q?D=E1niel_Szoboszlay?=) Date: Wed, 21 May 2014 17:20:15 +0200 Subject: [erlang-questions] SNMP usm discovery In-Reply-To: <1400678788.51906.YahooMailNeo@web172002.mail.ir2.yahoo.com> References: <1400593513.39879.YahooMailNeo@web172001.mail.ir2.yahoo.com> <1400678788.51906.YahooMailNeo@web172002.mail.ir2.yahoo.com> Message-ID: I see. Unfortunately it looks like you can perform a discovery from an agent, but the discovery code for the manager is commented out in the sources. It doesn?t mean it?s impossible (at least I think in NETSim we had an Erlang manager that could connect to arbitrary agents), but I don?t know the details. I?d suggest to turn on logging to see where do things go wrong and maybe to implement a custom user module for the agent, hopefully it will get enough data from the reply PDU to continue. BR, Daniel On 2014 May 21, at 15:26 , Dominik Pawlak wrote: > Actually in that example user name and engineID are given in configuration files for both agent and manager. User name is 'simple_user' and engineID is 'agent's engine'. So there is no discovery there, the manager has engineID hard coded in his configuration. I am only developing the manager node, the agents are on third party devices. > > -- > Cheers, > Dominik > > On Wednesday, 21 May 2014, 9:40, D?niel Szoboszlay wrote: > > > Hi, > > I think the agent will perform the discovery automatically, so you need to configure it with the actual security level and user name, password etc. that can be used to access the agent. > > There?s a nice example here on how to set up and use a v3 agent + manager pair: http://erlangcentral.org/wiki/index.php?title=SNMP_Quick_Start The empty user name is not used anywhere explicitly, discovery happens behind the scenes. > > Regards, > Daniel > > On 2014 May 20, at 15:45 , Dominik Pawlak wrote: > >> I'm trying to find a way to perform a snmpEngineID discovery process as defined in RFC3414 chapter 4 in a manager. >> >> The process is pretty simple: you send a v3, usm Request message with security level: noAuthNoPriv, empty user name, endineID and varbinds. The agent then sends a report containing his engineID. >> >> I tried registering agent with empty or no security name defined, but when I try to send the Request message I get: >> snmpm:register_agent("u", "a", [{engine_id,[]},{address,[x,x,x,x]},{version,v3},{sec_model,usm},{sec_name,""},{sec_level,noAuthNoPriv}]). >> snmpm:sync_get("u", "a", "auth", [], 1000). >> >> {error,{send_failed,1440625960,unknownSecurityName}} >> =ERROR REPORT==== 20-May-2014::11:12:57 === >> [ snmp : manager : snmpm_mpd : <0.55.0> ] >> MPD: CONFIG ERROR: unknownSecurityName (message: {message,'version-3', >> {v3_hdr,996332938,484, >> [4], >> 3,undefined,undefined}, >> [48,24,4,0,4,4,97,117,116, >> 104,160,14,2,4,85,222,53, >> 40,2,1,0,2,1,0,48,0]}) >> >> I also tried registering a usm user with an empty (one space) name: >> snmpm:register_usm_user(" ", " ", [{sec_name, "initial"}]). >> snmpm:register_agent("u", "a", [{engine_id, " "},{address,[x,x,x,x]},{version,v3},{sec_model,usm},{sec_name,"initial"},{sec_level,noAuthNoPriv}]). >> >> This time the message is sent, and the agent does respond with a message containing his engineID, but this information is not provided to the snmpm_user module: >> >> =INFO REPORT==== 20-May-2014::12:21:45 === >> SNMPM default user callback received handle_error: >> ReqId: -1 >> Reason: {failed_processing_message, >> {securityError,usmStatsUnknownEngineIDs}} >> UserData: undefined >> {error,{timeout,1440625963}} >> >> What is the proper way of doing this? >> -- >> Cheers, >> Dominik Pawlak >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://erlang.org/mailman/listinfo/erlang-questions > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From a.shneyderman@REDACTED Wed May 21 17:30:15 2014 From: a.shneyderman@REDACTED (Alex Shneyderman) Date: Wed, 21 May 2014 11:30:15 -0400 Subject: [erlang-questions] exometer: per-client connection counts In-Reply-To: References: Message-ID: > > > Is this something that exometer (or something else) could help with? > > Alternatively, we're already using folsom+folsomite+graphite. Could I > do this using those? > yes, you can: 5> folsom_metrics:new_counter(<<"test.0">>). 6> folsom_metrics:notify(<<"test.0">>, {inc, 1}). 7> folsom_metrics:notify(<<"test.0">>, {inc, 1}). 8> folsom_metrics:notify(<<"test.0">>, {inc, 1}). 9> folsom_metrics:get_metric_value(<<"test.0">>). 3 10> folsom_metrics:new_counter(<<"test.0">>). {error,<<"test.0">>,metric_already_exists} 11> folsom_metrics:get_metric_value(<<"test.0">>). 3 so if you know how to identify your clients it is pretty easy to collect the stats with graphite you can qury for "test.*" to get all the counts You can do pretty much teh same thing with exometer. Cheers, Alex. -------------- next part -------------- An HTML attachment was scrubbed... URL: From roger@REDACTED Wed May 21 17:39:27 2014 From: roger@REDACTED (Roger Lipscombe) Date: Wed, 21 May 2014 16:39:27 +0100 Subject: [erlang-questions] exometer: per-client connection counts In-Reply-To: References: Message-ID: On 21 May 2014 16:30, Alex Shneyderman wrote: > > yes, you can: > > [snip] Thanks, that helps. My question here, I guess then, is: how do I get these values to expire? Or how to window them? I'd like to track the count over each of the last 10 minutes, say. From a.shneyderman@REDACTED Wed May 21 17:45:06 2014 From: a.shneyderman@REDACTED (Alex Shneyderman) Date: Wed, 21 May 2014 11:45:06 -0400 Subject: [erlang-questions] exometer: per-client connection counts In-Reply-To: References: Message-ID: I do not think there is an automatic way of recycling but you can do: folsom_metrics:delete_metric(Name) keep the names and ttl in ets table some place or in expiration process's state and clean the expired stats with the delete method above. On Wed, May 21, 2014 at 11:39 AM, Roger Lipscombe wrote: > On 21 May 2014 16:30, Alex Shneyderman wrote: > > > > yes, you can: > > > > [snip] > > Thanks, that helps. > > My question here, I guess then, is: how do I get these values to > expire? Or how to window them? I'd like to track the count over each > of the last 10 minutes, say. > -------------- next part -------------- An HTML attachment was scrubbed... URL: From g@REDACTED Wed May 21 17:57:05 2014 From: g@REDACTED (Garrett Smith) Date: Wed, 21 May 2014 10:57:05 -0500 Subject: [erlang-questions] Erlang Survey Message-ID: If you have an opinion about Erlang, I'd like your help. I'd like ten minutes of your time to share your thoughts on a handful of Erlang related questions: https://www.surveymonkey.com/s/on-erlang-questions I'll be presenting the results of this research in June at the Erlang User Conference in Stockholm. Anything published will be be 100% anonymous, so you can express your thoughts candidly. My motivation for this research is to collect data related to Erlang adoption. We've had a number of threads on this mailing list that have been deemed by some as "bike shedding", or focusing on issues that the community feels to be non-essential. This survey is an opportunity to provide input on what you think is important. I believe a more scientific approach will provide solid data points for the community. Thanks in advance for your time and input here! Garrett From mononcqc@REDACTED Wed May 21 18:48:11 2014 From: mononcqc@REDACTED (Fred Hebert) Date: Wed, 21 May 2014 09:48:11 -0700 Subject: [erlang-questions] SHA-256/512 password hashing In-Reply-To: <201405211353.s4LDrre9070459@pluto.hedeland.org> References: <63D31957-C304-4984-83F9-8313B856B5F9@gmail.com> <201405211353.s4LDrre9070459@pluto.hedeland.org> Message-ID: <20140521164810.GB12577@ferdair.local> On 05/21, Per Hedeland wrote: > > Thanks, I know where to find SHA-256 and SHA-512, that's not what the > question was about - i.e. it's a matter of what you hash and how. See > the link. > > --Per I know you asked for SHA, and this might be an external requirement you can do nothing about. However, in the possibility you can choose the technology you want there, I'd like to possibly recommend erlpass (https://github.com/ferd/erlpass) which uses bcrypt to encapsulate common password operations, and should be safer. Sorry if that ends up not being helpful, Fred. From davidnwelton@REDACTED Wed May 21 18:49:29 2014 From: davidnwelton@REDACTED (David Welton) Date: Wed, 21 May 2014 18:49:29 +0200 Subject: [erlang-questions] Curious: disparate net_ticktime's Message-ID: What does having different net_ticktimes on different nodes cause problems? In my case they are all on localhost and respond within a millisecond, so it's not that they aren't responding. It's not a problem to set them to the same value, I'm just curious why it causes such hiccups. -- David N. Welton http://www.welton.it/davidw/ http://www.dedasys.com/ From ulf@REDACTED Wed May 21 19:02:23 2014 From: ulf@REDACTED (Ulf Wiger) Date: Wed, 21 May 2014 19:02:23 +0200 Subject: [erlang-questions] exometer: per-client connection counts In-Reply-To: References: Message-ID: <08AEDA76-81FE-48BD-85CD-A862B1481E73@feuerlabs.com> One thing I have recently added to exometer is ?auto-create templates?. Basically, they are the same templates that exometer had before, but now complemented with the function exometer:update_or_create(Name, Value). The function will update the metric, if it exists, or otherwise look for a suitable template, create the metric, and then update it. The idea is to be able to maintain metrics for different sessions without necessarily knowing their identity. A name could e.g. look like: [my_app, clients, 42, connect] and a suitable metric type might be a ?spiral', which maintains the value for the last minute as well as the total. Example template, example stored in a file, exometer_defaults.script: %% -*- erlang-indent-level: 4; indent-tabs-mode: nil -*- [ {[my_app, clients, '_?, connect], spiral, []} ]. You could do the same thing with folsom, although the code for setup and update would look slightly different. Also, with folsom, the spiral window is hard-coded to a minute, whereas in exometer, you can specify it. Exometer is easier to extend with custom metrics and has a fairly ambitious ?function? metric, which allows you to call just about any function and either do limited pattern-matching, or even interpret code, in order to convert the results into a metric value. But it sounds like you have a working setup already. Perhaps better to stick to that? BR, Ulf W On 21 May 2014, at 15:44, Roger Lipscombe wrote: > I'm wondering if exometer can help me with the following problem: > > Clients to our server are supposed to stay connected for a reasonable > length of time. We're seeing some clients connecting and disconnecting > repeatedly very quickly. It's difficult to see this in the log file, > so I'm wondering whether exometer (or similar) could help. > > What I'm looking for is a way to push a 'client #42 connected' event, > and have these grouped by client ID, and aggregated over, say, a 30 > second window. Then, if I saw more than say, 20 connection events from > a particular client within the most-recent window, I could log that as > a warning. > > Is this something that exometer (+graphite) can do? If so, does anyone > have an example of how to do it? > > We're also playing with having a diagnostics UI -- something like the > RabbitMQ admin UI -- it'd be nice to display the top 20 offenders. > > Is this something that exometer (or something else) could help with? > > Alternatively, we're already using folsom+folsomite+graphite. Could I > do this using those? > > Thanks, > Roger. > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions Ulf Wiger, Co-founder & Developer Advocate, Feuerlabs Inc. http://feuerlabs.com From ulf@REDACTED Wed May 21 19:08:35 2014 From: ulf@REDACTED (Ulf Wiger) Date: Wed, 21 May 2014 19:08:35 +0200 Subject: [erlang-questions] Curious: disparate net_ticktime's In-Reply-To: References: Message-ID: The way the net_tick works is that each node commits to sending at least the frequency of messages derived from net_ticktime (the detection time for four lost ticks, if memory serves). The receiving end will need at least one message within (net_ticktime)/4 milliseconds, or it will time out. After 4 consecutive timeouts, it declares the other node unreachable, without actually verifying that it is there (it will have sent ticks, and they may have arrived, but it doesn?t check that). This means that if there is no traffic between the nodes, there may be problems if one node sends ticks at a lower frequency than that expected by the other nodes. BR, Ulf W On 21 May 2014, at 18:49, David Welton wrote: > What does having different net_ticktimes on different nodes cause problems? > > In my case they are all on localhost and respond within a millisecond, > so it's not that they aren't responding. > > It's not a problem to set them to the same value, I'm just curious why > it causes such hiccups. > > -- > David N. Welton > > http://www.welton.it/davidw/ > > http://www.dedasys.com/ > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions Ulf Wiger, Co-founder & Developer Advocate, Feuerlabs Inc. http://feuerlabs.com From ulf@REDACTED Wed May 21 19:10:32 2014 From: ulf@REDACTED (Ulf Wiger) Date: Wed, 21 May 2014 19:10:32 +0200 Subject: [erlang-questions] How do I tell whether a process is using proc_lib? In-Reply-To: References: Message-ID: <67780C99-2A91-4F53-9B23-6A39DFF046FE@feuerlabs.com> As an aside, it?s considered Good Karma to discard unknown messages, partly for this reason. BR, Ulf W On 21 May 2014, at 16:12, Roger Lipscombe wrote: > Specifically, if I call sys:get_state(Pid) on a process that's not > using proc_lib, and that process doesn't deal with {system, get_state} > messages, it'll crash with a case_clause in loop (or whatever). > > This is a bad thing. Can I tell that a process is a proc_lib process > (or a gen_server, gen_fsm, etc.) before accidentally killing it? > > Thanks, > Roger. > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions Ulf Wiger, Co-founder & Developer Advocate, Feuerlabs Inc. http://feuerlabs.com From per@REDACTED Wed May 21 21:33:06 2014 From: per@REDACTED (Per Hedeland) Date: Wed, 21 May 2014 21:33:06 +0200 (CEST) Subject: [erlang-questions] SHA-256/512 password hashing In-Reply-To: <20140521164810.GB12577@ferdair.local> Message-ID: <201405211933.s4LJX6an078748@pluto.hedeland.org> Fred Hebert wrote: > >I know you asked for SHA, and this might be an external requirement you >can do nothing about. However, in the possibility you can choose the >technology you want there, I'd like to possibly recommend erlpass >(https://github.com/ferd/erlpass) which uses bcrypt to encapsulate >common password operations, and should be safer. > >Sorry if that ends up not being helpful, Thanks anyway, but no, compatibility with libc crypt(3) is a requirement. It's actually pretty trivial to transcribe Drepper's 22-step specification of the algorithm to Erlang, just boring and error-prone - which is why I hoped that someone else had already done it.:-) --Per From rik.ribbers@REDACTED Wed May 21 20:31:43 2014 From: rik.ribbers@REDACTED (Rik Ribbers) Date: Wed, 21 May 2014 20:31:43 +0200 Subject: [erlang-questions] Error with ./rebar generate: "erlsom: Application version clash. Multiple directories contains version \"1.2.1\" In-Reply-To: References: Message-ID: Hello Brian, The problem was indeed that I installed erlsom manually before I got to into rebar, removing it solved the problem. Thank you for your reply. However after solving this and adding a few more dependancies I am stuck again on adding ssl...the error is : ERROR: Unexpected error: {'EXIT', {{badmatch, {error, {1, [99,112,58,32,99,97,110,110,111,116,32, 115,116,97,116,32,226,128,152,47,104, 111,109,101,47,114,105,107,47,119,111, 114,107,115,112,97,99,101,115,47,68, 73,69,47,103,105,116,47,100,105,101, 47,101,112,112,115,101,114,118,101, 114,47,114,101,108,47,101,112,112,95, 110,111,100,101,47,98,105,110,47,115, 116,97,114,116,95,99,108,101,97,110, 46,98,111,111,116,226,128,153,58,32, 78,111,32,115,117,99,104,32,102,105, 108,101,32,111,114,32,100,105,114,101, 99,116,111,114,121,10]}}}, [{rebar_file_utils,cp_r,2, Any pointer would be appreciated. Kind regards Rik Ribbers On Wed, May 21, 2014 at 12:17 AM, Brian H. Ward wrote: > Make sure the library in question is not installed in your Erlang lib > directory (where you installed Erlang). We used to install our software > into the lib directory to make patching easier; bit couldn't do a rebar > generate while those libraries were installed. > On May 20, 2014 4:30 PM, "Rik Ribbers" wrote: > >> Hello, >> >> As a Erlang newbie I run into this error when using ./rebar generate >> >> ==> rel (generate) >> ERROR: generate failed while processing >> /home/rik/workspaces/git/myapplication/rel: >> {'EXIT',{{badmatch,{error,"erlsom: Application version clash. Multiple >> directories contains version \"1.2.1\"."}}, >> >> I've included my reltool.config and my rebar.config. Any help is >> appreciated. >> >> Kind regards, >> Rik Ribbers >> >> -- reltool.config >> >> {sys, [ >> {lib_dirs, [".."]}, >> {erts, [{mod_cond, derived}, {app_file, strip}]}, >> {app_file, strip}, >> {rel, "myapplication_node", "1", >> [ >> kernel, >> stdlib, >> sasl, >> appmon, >> asn1, >> crypto, >> epgsql_pool, >> epgsql, >> erlsom, >> myapplication >> ]}, >> {boot_rel, "myapplication_node"}, >> {profile, embedded}, >> {incl_cond, exclude}, >> {excl_archive_filters, [".*"]}, %% Do not archive built libs >> {excl_sys_filters, ["^bin/(?!start_clean.boot)", >> "^erts.*/bin/(dialyzer|typer)", >> "^erts.*/(doc|info|include|lib|man|src)"]}, >> {excl_app_filters, ["\.gitignore"]}, >> {app, hipe, [{incl_cond, exclude}]}, >> {app, kernel, [{incl_cond, include}]}, >> {app, stdlib, [{incl_cond, include}]}, >> {app, sasl, [{incl_cond, include}]}, >> {app, appmon, [{incl_cond, include}]}, >> {app, asn1, [{incl_cond, include}]}, >> {app, crypto, [{incl_cond, include}]}, >> {app, epgsql, [{incl_cond, include},{lib_dir,"../deps/epgsql"}]}, >> {app, epgsql_pool, [{mod_cond, app}, {incl_cond, >> include},{lib_dir, "../deps/epgsql_pool"}]}, >> {app, erlsom, [{incl_cond, include},{lib_dir,"../deps/erlsom"}]}, >> {app, myapplication, [{mod_cond, app}, {incl_cond, >> include},{lib_dir,".."}]} >> ]}. >> >> {target_dir, "myapplication_node"}. >> >> {overlay, [ >> {mkdir, "log/sasl"}, >> {copy, "files/erl", "\{\{erts_vsn\}\}/bin/erl"}, >> {copy, "files/nodetool", "\{\{erts_vsn\}\}/bin/nodetool"}, >> {copy, "myapplication_node/bin/start_clean.boot", >> "\{\{erts_vsn\}\}/bin/start_clean.boot"}, >> {copy, "files/myapplication_node", "bin/myapplication_node"}, >> {copy, "files/myapplication_node.cmd", >> "bin/myapplication_node.cmd"}, >> {copy, "files/start_erl.cmd", "bin/start_erl.cmd"}, >> >> --- rebar.config >> >> {sub_dirs,["rel"]}. >> >> {erl_opts, [debug_info,{i,"deps/erlsom/include"}]}. >> >> {deps_dir, ["deps"]}. >> >> {deps, [ >> {epgsql, ".*", {git, "https://github.com/wg/epgsql.git"}}, >> {epgsql_pool, ".*", {git, " >> https://github.com/josephwecker/epgsql_pool.git"}}, >> {erlsom, ".*", {git, "https://github.com/willemdj/erlsom.git"}} >> ]}. >> >> >> >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://erlang.org/mailman/listinfo/erlang-questions >> >> -------------- next part -------------- An HTML attachment was scrubbed... URL: From tuncer.ayaz@REDACTED Wed May 21 22:26:39 2014 From: tuncer.ayaz@REDACTED (Tuncer Ayaz) Date: Wed, 21 May 2014 22:26:39 +0200 Subject: [erlang-questions] Error with ./rebar generate: "erlsom: Application version clash. Multiple directories contains version \"1.2.1\" In-Reply-To: References: Message-ID: On 5/21/14, Rik Ribbers wrote: > Hello Brian, > > The problem was indeed that I installed erlsom manually before I got > to into rebar, removing it solved the problem. Thank you for your > reply. > > However after solving this and adding a few more dependancies I am > stuck again on adding ssl...the error is : > > ERROR: Unexpected error: {'EXIT', > {{badmatch, > {error, > {1, > > [99,112,58,32,99,97,110,110,111,116,32, [...] > 108,101,32,111,114,32,100,105,114,101, > 99,116,111,114,121,10]}}}, > [{rebar_file_utils,cp_r,2, > > > Any pointer would be appreciated. Hi Rik, if you update to rebar 2.3.0 or newer, you'll get a proper error message instead of a badmatch. From fritchie@REDACTED Thu May 22 05:27:17 2014 From: fritchie@REDACTED (Scott Lystig Fritchie) Date: Wed, 21 May 2014 22:27:17 -0500 Subject: [erlang-questions] Curious: disparate net_ticktime's In-Reply-To: Message of "Wed, 21 May 2014 19:08:35 +0200." Message-ID: <32808.1400729237@snookles.snookles.com> Ulf Wiger wrote: uw> This means that if there is no traffic between the nodes, there may uw> be problems if one node sends ticks at a lower frequency than that uw> expected by the other nodes. AFAIK, this can also be tickled by a very large message sent between nodes and the network is "slow enough"(*). The inet_drv driver may be busy transferring data in the middle of that message, but that busy-ness does not affect the ticktime ticker thingie. -Scott (*) It might be that 1Gbit/sec Ethernet or 100Mbit/sec Ethernet is just too slow to transfer a 3 Gbyte Erlang term(**). Or you've been bitten by a congested network that's dropping packets. Or something else. (**) This has never, ever, accidentally happened in a Riak cluster, oh, heavens, no. From abdoo.mahran@REDACTED Thu May 22 07:48:28 2014 From: abdoo.mahran@REDACTED (Abd El-Fattah Mahran) Date: Thu, 22 May 2014 08:48:28 +0300 Subject: [erlang-questions] Erlang CAPv2 Implementation Message-ID: hi all, There is any implementation for CAPv2 written in Erlang? Thanks Best Regards, Abd El-Fattah Mahran http://www.linkedin.com/in/abdoomahran -------------- next part -------------- An HTML attachment was scrubbed... URL: From thomasl_erlang@REDACTED Thu May 22 08:28:01 2014 From: thomasl_erlang@REDACTED (Thomas Lindgren) Date: Wed, 21 May 2014 23:28:01 -0700 (PDT) Subject: [erlang-questions] BSON parsing? In-Reply-To: <835896FD-EB6E-4B27-900E-1743032F3743@tzi.org> References: <5374A69D.6000109@ninenines.eu> <1D6F99F2-8CA1-42E2-BEE2-F1FFF467CF80@cs.otago.ac.nz> <1400230647.69745.YahooMailNeo@web140103.mail.bf1.yahoo.com> <835896FD-EB6E-4B27-900E-1743032F3743@tzi.org> Message-ID: <1400740081.86312.YahooMailNeo@web163605.mail.gq1.yahoo.com> Hi Carsten, Alas, I'm really thinking of just IEEE 754 standard fp.?My point about dragging up these usually somewhat obscure issues in IEEE 754 is that managing all of this introduces some complexity by itself. But I think Erlang ought to have support for doing it (as well as sensible defaults). You should be able to (1) compliantly detect and work with all the various special IEEE fp values and classes in Erlang, and you should be able to (2) manage the various flags that control IEEE fp behaviour, again in Erlang and probably also on the command line. Here's what CMU Common Lisp does about floats:?http://www.umiacs.umd.edu/~resnik/ling645_sp2002/cmu_manual/node15.html Common Lisp is usually conscientious about these things, so that might be another good, more high-level, starting point for what features are needed (but possibly needs updating due to subsequent fp standards evolution).? Best, Thomas -------------- next part -------------- An HTML attachment was scrubbed... URL: From anders.otp@REDACTED Thu May 22 08:57:48 2014 From: anders.otp@REDACTED (Anders Svensson) Date: Thu, 22 May 2014 08:57:48 +0200 Subject: [erlang-questions] diameter_sctp problem In-Reply-To: References: Message-ID: On Tue, Jan 21, 2014 at 5:42 PM, Anders Svensson wrote: > Hi Sharmilla. > > On Tue, Jan 21, 2014 at 2:29 PM, Sharmila Pillai > wrote: >> Hi Anders, >> >> No, I am not setting the stream identifier explicitly. The SID in the >> request is 10 and the diameter module seems to put that in the response as >> well? > > Indeed it does, which is just plain wrong. It's the fact that you have > a more inbound streams than outbound streams that causes you to run > into the fault. You can work around it when replying to a request by > explicitly setting transport_data = undefined in a diameter_packet > record containing the answer message. > > A fix should make its way to github by next week. Thanks for the report. The "fix" in 17.0 is broken unfortunately. More broken than it was in fact, and the test case that should have noticed turns out not to exist. Both problems will be fixed (in the proper sense) in 17.1. Anders > > /Anders, Erlang/OTP > > >> >> regards, >> Sharmila. >> >> >> On Tue, Jan 21, 2014 at 12:15 PM, Anders Svensson >> wrote: >>> >>> Hi Sharmilla. >>> >>> On Tue, Jan 21, 2014 at 10:21 AM, Sharmila Pillai >>> wrote: >>> > Hi, >>> > >>> > I'm encountering an error when using DIAMETER over SCTP. >>> > >>> > I turned on dbg tracing, and this is what I see. >>> > >>> > (<0.527.0>) call >>> > >>> > diameter_sctp:send(10,Bin,{transport,<0.526.0>,accept,#Port<0.10834>,96747,undefined,{16,10},2}) >>> >>> The stream identifier here (first argument) looks to be equal to the >>> number of outbound streams, which is 1 more than the maximal stream >>> identifier. Are you setting the stream identifier explicitly when >>> sending? >>> >>> /Anders, Erlang/OTP >>> >>> >>> > (<0.527.0>) call diameter_sctp:send(#Port<0.10834>,96747,10,Bin) >>> > (<0.527.0>) call diameter_sctp:x({send,einval}) >>> > (<0.527.0>) exception_from {diameter_sctp,x,1} >>> > {exit,{shutdown,{send,einval}}} >>> > (<0.527.0>) exception_from {diameter_sctp,send,4} >>> > {exit,{shutdown,{send,einval}}} >>> > (<0.527.0>) exception_from {diameter_sctp,send,3} >>> > {exit,{shutdown,{send,einval}}} >>> > (<0.527.0>) exception_from {diameter_sctp,send,2} >>> > {exit,{shutdown,{send,einval}}} >>> > (<0.527.0>) exception_from {diameter_sctp,transition,2} >>> > {exit,{shutdown,{send,einval}}} >>> > (<0.527.0>) exception_from {diameter_sctp,t,2} >>> > {exit,{shutdown,{send,einval}}} >>> > (<0.527.0>) exception_from {diameter_sctp,handle_info,2} >>> > {exit,{shutdown,{send,einval}}} >>> > (<0.527.0>) call >>> > >>> > diameter_sctp:terminate({shutdown,{send,einval}},{transport,<0.526.0>,accept,#Port<0.10834>,96747,undefined,{16,10},2}) >>> > (<0.527.0>) call diameter_sctp:close(#Port<0.10834>,96747) >>> > (<0.527.0>) returned from diameter_sctp:close/2 -> ok >>> > (<0.527.0>) returned from diameter_sctp:terminate/2 -> ok >>> > (<0.315.0>) call >>> > >>> > diameter_sctp:handle_info({'DOWN',#Ref<0.0.0.47966>,process,<0.527.0>,{shutdown,{send,einval}}},{listener,#Ref<0.0.0.1361>,#Port<0.4307>,2,786532, >>> > >>> > I'm not sure why {error, einval} is being returned when a response is >>> > being >>> > sent on the SCTP connection. If I look at the packet capture, it looks >>> > like >>> > an SCTP SHUTDOWN is being sent back. Any pointers please? >>> > >>> > Thanks, >>> > Sharmila >>> > >>> > >>> > _______________________________________________ >>> > erlang-questions mailing list >>> > erlang-questions@REDACTED >>> > http://erlang.org/mailman/listinfo/erlang-questions >>> > >> >> From davidnwelton@REDACTED Thu May 22 10:06:36 2014 From: davidnwelton@REDACTED (David Welton) Date: Thu, 22 May 2014 10:06:36 +0200 Subject: [erlang-questions] Curious: disparate net_ticktime's In-Reply-To: References: Message-ID: > The way the net_tick works is that each node commits to sending at least the frequency of messages derived from net_ticktime (the detection time for four lost ticks, if memory serves). The receiving end will need at least one message within (net_ticktime)/4 milliseconds, or it will time out. After 4 consecutive timeouts, it declares the other node unreachable, without actually verifying that it is there (it will have sent ticks, and they may have arrived, but it doesn?t check that). Aha... this could probably be added to in the docs. I'm sure I'm not the only one with a mental model of the node sending those ticks as pings every net_ticktime / 4 and expecting a pong back, or something like that. It's more like "everyone on the network better be sending me ticks with this frequency, and if they aren't, they are dead!" Thank you -- David N. Welton http://www.welton.it/davidw/ http://www.dedasys.com/ From max.lapshin@REDACTED Thu May 22 10:49:34 2014 From: max.lapshin@REDACTED (Max Lapshin) Date: Thu, 22 May 2014 12:49:34 +0400 Subject: [erlang-questions] Module t breaks TAB in shell in 17.0 Message-ID: (flussonic@REDACTED)1> mpegts_alloc:*** ERROR: Shell process terminated! *** 12:41:45.092 emulator Error in process <0.3772.3> on node ' flussonic@REDACTED' with exit value: {badarg,[{erlang,get_module_info,[t],[]},{t,module_info,0,[]},{edlin_expand,expand_function_name,2,[{file,"edlin_expand.erl"},{line,53}]},{group,get_line1,4,[{file,"group.erl"},{line,541}]},{group,get_chars_loop,8,[{file,"group.... Here is what is happening: I type mpegts_alloc: and then press TAB. After this I see this message. Module mpegts_alloc is very specific: https://gist.github.com/maxlapshin/5531424 When I ask to autocomplete binary: functions, it works ok. Something broken in this module mpegts_alloc? -------------- next part -------------- An HTML attachment was scrubbed... URL: From tony@REDACTED Thu May 22 11:34:57 2014 From: tony@REDACTED (Tony Rogvall) Date: Thu, 22 May 2014 11:34:57 +0200 Subject: [erlang-questions] Curious: disparate net_ticktime's In-Reply-To: <32808.1400729237@snookles.snookles.com> References: <32808.1400729237@snookles.snookles.com> Message-ID: <9F321CA8-1018-43EB-A0C5-0BD09E42881C@rogvall.se> On 22 maj 2014, at 05:27, Scott Lystig Fritchie wrote: > Ulf Wiger wrote: > > uw> This means that if there is no traffic between the nodes, there may > uw> be problems if one node sends ticks at a lower frequency than that > uw> expected by the other nodes. > > AFAIK, this can also be tickled by a very large message sent between > nodes and the network is "slow enough"(*). The inet_drv driver may be > busy transferring data in the middle of that message, but that busy-ness > does not affect the ticktime ticker thingie. > That should really be fixed. Why ticking if there is traffic going on between nodes? Looking in dist_util.erl there is plenty of code trying to cope with that situation. I guess if the send kernel buffers are large and the link is weak that may happend anyway. Or ? /Tony > -Scott > > (*) It might be that 1Gbit/sec Ethernet or 100Mbit/sec Ethernet is just > too slow to transfer a 3 Gbyte Erlang term(**). Or you've been bitten > by a congested network that's dropping packets. Or something else. > > (**) This has never, ever, accidentally happened in a Riak cluster, oh, > heavens, no. > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions "Installing applications can lead to corruption over time. Applications gradually write over each other's libraries, partial upgrades occur, user and system errors happen, and minute changes may be unnoticeable and difficult to fix" -------------- next part -------------- An HTML attachment was scrubbed... URL: From tty.erlang@REDACTED Thu May 22 11:53:17 2014 From: tty.erlang@REDACTED (T Ty) Date: Thu, 22 May 2014 10:53:17 +0100 Subject: [erlang-questions] Curious: disparate net_ticktime's In-Reply-To: <32808.1400729237@snookles.snookles.com> References: <32808.1400729237@snookles.snookles.com> Message-ID: I've notice this with Mnesia nodes as well when restarting a Mnesia node while under heavy load. It is one of the gotcha that usually appears in production. Ethernet bonding heh. On Thu, May 22, 2014 at 4:27 AM, Scott Lystig Fritchie < fritchie@REDACTED> wrote: > > AFAIK, this can also be tickled by a very large message sent between > nodes and the network is "slow enough"(*). The inet_drv driver may be > busy transferring data in the middle of that message, but that busy-ness > does not affect the ticktime ticker thingie. > > -Scott > > (*) It might be that 1Gbit/sec Ethernet or 100Mbit/sec Ethernet is just > too slow to transfer a 3 Gbyte Erlang term(**). Or you've been bitten > by a congested network that's dropping packets. Or something else. > > (**) This has never, ever, accidentally happened in a Riak cluster, oh, > heavens, no. > ______________________________________________ > -------------- next part -------------- An HTML attachment was scrubbed... URL: From martin@REDACTED Thu May 22 15:28:48 2014 From: martin@REDACTED (=?UTF-8?Q?Martin_Sch=C3=BCrrer?=) Date: Thu, 22 May 2014 15:28:48 +0200 Subject: [erlang-questions] net_adm:ping_list/1 and the scary comment above it Message-ID: Was looking through the Erlang/OTP source yesterday and found net_adm:ping_list/1 which isn't documented but has a really scary comment: https://github.com/erlang/otp/blob/maint/lib/kernel/src/net_adm.erl#L117-L132 %% A common situation in "life" is to have a configuration file with a list %% of nodes, and then at startup, all nodes in the list are ping'ed %% this can lead to no end of troubles if two disconnected nodes %% simultaneously ping each other. %% Use this function in order to do it safely. %% It assumes a working global.erl which ensures a fully %% connected network. %% Had the erlang runtime system been able to fully cope with %% the possibility of two simultaneous (unix) connects, this function would %% merley be lists:map({net_adm, ping}, [], Nodelist). %% It is also assumed, that the same (identical) Nodelist is given to all %% nodes which are to perform this call (possibly simultaneously). %% Even this code has a flaw, and that is the case where two %% nodes simultaneously and without *any* other already %% running nodes execute this code. :-( It's been in there since at least R13B03 when Erlang moved to git. Can someone enlighten me if I should take that warning seriously? Kind regards, Martin Schuerrer -------------- next part -------------- An HTML attachment was scrubbed... URL: From rich.neswold@REDACTED Thu May 22 21:44:25 2014 From: rich.neswold@REDACTED (Rich Neswold) Date: Thu, 22 May 2014 14:44:25 -0500 Subject: [erlang-questions] List comprehension question In-Reply-To: References: Message-ID: On Thu, Jan 16, 2014 at 10:39 AM, Rich Neswold wrote: > This morning I became aware of a (powerful) feature of list > comprehensions. Take the following example: > > [ X + Y || {X, Y} <- L]. > > If we set L to [{1,2}, ok, {1,3}], we get the result [3,4] instead of > a pattern match exception (as I was expecting.) This means that list > comprehensions give you a "free" lists:filter/2 in the generator > expressions! So having learned about the filtering abilities of comprehensions, I stumbled upon another way to use it effectively. I have a list of data that needs to be transformed, but some of resulting data is pulled from a lookup table (I'm using gb_trees.) I can do the following (please ignore the short variable names; I'm trying to emphasis the generators and filters): [{{S, NC}, SF} || {S, C} <- Reqs, case gb_trees:lookup({S, C}, T) of {value, {NC, SF}} -> true; none -> false end] It would be much nicer to use pattern matching and use the comprehension's ability to treat bad matches as a filter. But I can't replace the case statement above with: [{{S, NC}, SF} || {S, C} <- Reqs, {value, {NC, SF}} = gb_trees:lookup({S, C}, T)] However, I can do this: [{{S, NC}, SF} || {S, C} <- Reqs, {value, {NC, SF}} <- [gb_trees:lookup({S, C}, T)]] Wrap the function in a single element array and now you have a generator! Now I can add more filters or more generators to it. I don't know how many people already use this trick, but I thought it might of use to others. -- Rich -------------- next part -------------- An HTML attachment was scrubbed... URL: From eriksoe@REDACTED Thu May 22 22:29:27 2014 From: eriksoe@REDACTED (=?UTF-8?Q?Erik_S=C3=B8e_S=C3=B8rensen?=) Date: Thu, 22 May 2014 22:29:27 +0200 Subject: [erlang-questions] Module t breaks TAB in shell in 17.0 In-Reply-To: References: Message-ID: I wonder if that module_info function has been through some parse transform - or was the module generated through some other non-standard means? Den 22/05/2014 10.49 skrev "Max Lapshin" : > (flussonic@REDACTED)1> mpegts_alloc:*** ERROR: Shell process terminated! > *** > 12:41:45.092 emulator Error in process <0.3772.3> on node ' > flussonic@REDACTED' with exit value: > {badarg,[{erlang,get_module_info,[t],[]},{t,module_info,0,[]},{edlin_expand,expand_function_name,2,[{file,"edlin_expand.erl"},{line,53}]},{group,get_line1,4,[{file,"group.erl"},{line,541}]},{group,get_chars_loop,8,[{file,"group.... > > > Here is what is happening: I type mpegts_alloc: and then press TAB. > After this I see this message. > > Module mpegts_alloc is very specific: > https://gist.github.com/maxlapshin/5531424 > > When I ask to autocomplete binary: functions, it works ok. > > Something broken in this module mpegts_alloc? > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From wallentin.dahlberg@REDACTED Thu May 22 23:17:41 2014 From: wallentin.dahlberg@REDACTED (=?UTF-8?Q?Bj=C3=B6rn=2DEgil_Dahlberg?=) Date: Thu, 22 May 2014 23:17:41 +0200 Subject: [erlang-questions] Module t breaks TAB in shell in 17.0 In-Reply-To: References: Message-ID: You have to fix the code: {function, module_info, 0, 4}. {label,3}. {line,[]}. {func_info,{atom,t},{atom,module_info},0}. {label,4}. {move,{atom,t},{x,0}}. {line,[]}. {call_ext_only,1,{extfunc,erlang,get_module_info,1}}. {function, module_info, 1, 6}. {label,5}. {line,[]}. {func_info,{atom,t},{atom,module_info},1}. {label,6}. {move,{x,0},{x,1}}. {move,{atom,t},{x,0}}. {line,[]}. {call_ext_only,2,{extfunc,erlang,get_module_info,2}}. Change {atom,t} to your actual module name. // Bj?rn-Egil 2014-05-22 10:49 GMT+02:00 Max Lapshin : > (flussonic@REDACTED)1> mpegts_alloc:*** ERROR: Shell process terminated! > *** > 12:41:45.092 emulator Error in process <0.3772.3> on node ' > flussonic@REDACTED' with exit value: > {badarg,[{erlang,get_module_info,[t],[]},{t,module_info,0,[]},{edlin_expand,expand_function_name,2,[{file,"edlin_expand.erl"},{line,53}]},{group,get_line1,4,[{file,"group.erl"},{line,541}]},{group,get_chars_loop,8,[{file,"group.... > > > Here is what is happening: I type mpegts_alloc: and then press TAB. > After this I see this message. > > Module mpegts_alloc is very specific: > https://gist.github.com/maxlapshin/5531424 > > When I ask to autocomplete binary: functions, it works ok. > > Something broken in this module mpegts_alloc? > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From csaba.hoch@REDACTED Thu May 22 21:01:36 2014 From: csaba.hoch@REDACTED (Csaba Hoch) Date: Thu, 22 May 2014 21:01:36 +0200 (CEST) Subject: [erlang-questions] [ANN] Elarm (Erlang alarm library) In-Reply-To: <194718730.904077.1400785234678.JavaMail.zimbra@erlang-solutions.com> Message-ID: <810813099.904079.1400785296561.JavaMail.zimbra@erlang-solutions.com> Hi, I would like to announce a new Erlang alarm library called Elarm (https://github.com/esl/elarm). Elarm is an Alarm Manager for Erlang. It is designed to be easy to include in an Erlang based system and easy to use: ok = elarm:raise(partition_full, "/dev/hda2", [{level,90}]) # raise an alarm ok = elarm:clear(partition_full, "/dev/hda2") # clear the alarm Elarm stores the alarms on the node (in ets by default, but the backend can be changed). This makes it easier for the node to have a REST/SNMP/web/etc. interface that shows the node's alarms, since those interfaces can ask Elarm for the list of alarms, which will include the alarm state (new or acknowledged), severity, and quite a few other fields: -record(alarm, { alarm_id :: alarm_id(), % e.g. 'partition_full' alarm_type :: alarm_type(), % e.g. 'environment' src :: alarm_src(), % e.g. "/dev/hda2" event_time = calendar:universal_time() :: timestamp(), event_id :: event_id(), severity = indeterminate :: severity(), probable_cause = <<"">> :: probable_cause(), proposed_repair_action = <<"">> :: proposed_repair_action(), description = <<"">> :: description(), additional_information :: additional_information(), % e.g. [{level,90}] correlated_events = [] :: [event_id()], % not used yet comments = [] :: comments(), trend :: trend(), % not used yet threshold :: undefined | threshold(), % not used yet state = new :: alarm_state(), ack_info :: ack_info() }). The alarm_type, severity, probable_cause, proposed_repair_action and description fields can be filled in by the alarm configuration. (I.e. the developer or operator can say in advance that the partition_full+"/dev/hda2" alarm should have 'environment' alarm type, 'major' severity, etc.) The code is available on GitHub, together with the README that describes the further features (including acknowledging and commenting alarms, and subscribing to them): https://github.com/esl/elarm We hope that Elarm becomes the de facto alarming application in the Erlang world and we will certainly do all we can to make it as good as possible. Elarm is in part funded by the RELEASE project (http://release-project.eu/), which is an EU FP7 STREP (287510) project that aims to scale the radical concurrency-oriented programming paradigm to build reliable general-purpose software, such as server-based systems, on massively parallel machines. Regards, Csaba From max.lapshin@REDACTED Fri May 23 06:07:43 2014 From: max.lapshin@REDACTED (Max Lapshin) Date: Fri, 23 May 2014 08:07:43 +0400 Subject: [erlang-questions] Module t breaks TAB in shell in 17.0 In-Reply-To: References: Message-ID: uh, thanks. My failure. On Fri, May 23, 2014 at 1:17 AM, Bj?rn-Egil Dahlberg < wallentin.dahlberg@REDACTED> wrote: > You have to fix the code: > > {function, module_info, 0, 4}. > {label,3}. > {line,[]}. > {func_info,{atom,t},{atom,module_info},0}. > {label,4}. > {move,{atom,t},{x,0}}. > {line,[]}. > {call_ext_only,1,{extfunc,erlang,get_module_info,1}}. > > > > {function, module_info, 1, 6}. > {label,5}. > {line,[]}. > {func_info,{atom,t},{atom,module_info},1}. > {label,6}. > {move,{x,0},{x,1}}. > {move,{atom,t},{x,0}}. > {line,[]}. > {call_ext_only,2,{extfunc,erlang,get_module_info,2}}. > > Change {atom,t} to your actual module name. > > // Bj?rn-Egil > > > > 2014-05-22 10:49 GMT+02:00 Max Lapshin : > >> (flussonic@REDACTED)1> mpegts_alloc:*** ERROR: Shell process >> terminated! *** >> 12:41:45.092 emulator Error in process <0.3772.3> on node ' >> flussonic@REDACTED' with exit value: >> {badarg,[{erlang,get_module_info,[t],[]},{t,module_info,0,[]},{edlin_expand,expand_function_name,2,[{file,"edlin_expand.erl"},{line,53}]},{group,get_line1,4,[{file,"group.erl"},{line,541}]},{group,get_chars_loop,8,[{file,"group.... >> >> >> Here is what is happening: I type mpegts_alloc: and then press TAB. >> After this I see this message. >> >> Module mpegts_alloc is very specific: >> https://gist.github.com/maxlapshin/5531424 >> >> When I ask to autocomplete binary: functions, it works ok. >> >> Something broken in this module mpegts_alloc? >> >> >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://erlang.org/mailman/listinfo/erlang-questions >> >> > -------------- next part -------------- An HTML attachment was scrubbed... URL: From Ola.Backstrom@REDACTED Fri May 23 10:30:30 2014 From: Ola.Backstrom@REDACTED (=?iso-8859-1?Q?Ola__B=E4ckstr=F6m?=) Date: Fri, 23 May 2014 08:30:30 +0000 Subject: [erlang-questions] Elarm (Erlang alarm library) In-Reply-To: <810813099.904079.1400785296561.JavaMail.zimbra@erlang-solutions.com> References: <194718730.904077.1400785234678.JavaMail.zimbra@erlang-solutions.com> <810813099.904079.1400785296561.JavaMail.zimbra@erlang-solutions.com> Message-ID: This alarm lib looks interesting! One quick question: gproc is used in the module elarm_summary_sup.erl. Is that really needed? Couldn't a simple named supervisor be used? In that case would the alarm library not have any dependencies apart from Erlang/OTP. Regards, /Ola -----Original Message----- From: erlang-questions-bounces@REDACTED [mailto:erlang-questions-bounces@REDACTED] On Behalf Of Csaba Hoch Sent: den 22 maj 2014 21:02 To: erlang-questions@REDACTED Subject: [erlang-questions] [ANN] Elarm (Erlang alarm library) Hi, I would like to announce a new Erlang alarm library called Elarm (https://github.com/esl/elarm). Elarm is an Alarm Manager for Erlang. It is designed to be easy to include in an Erlang based system and easy to use: ok = elarm:raise(partition_full, "/dev/hda2", [{level,90}]) # raise an alarm ok = elarm:clear(partition_full, "/dev/hda2") # clear the alarm Elarm stores the alarms on the node (in ets by default, but the backend can be changed). This makes it easier for the node to have a REST/SNMP/web/etc. interface that shows the node's alarms, since those interfaces can ask Elarm for the list of alarms, which will include the alarm state (new or acknowledged), severity, and quite a few other fields: -record(alarm, { alarm_id :: alarm_id(), % e.g. 'partition_full' alarm_type :: alarm_type(), % e.g. 'environment' src :: alarm_src(), % e.g. "/dev/hda2" event_time = calendar:universal_time() :: timestamp(), event_id :: event_id(), severity = indeterminate :: severity(), probable_cause = <<"">> :: probable_cause(), proposed_repair_action = <<"">> :: proposed_repair_action(), description = <<"">> :: description(), additional_information :: additional_information(), % e.g. [{level,90}] correlated_events = [] :: [event_id()], % not used yet comments = [] :: comments(), trend :: trend(), % not used yet threshold :: undefined | threshold(), % not used yet state = new :: alarm_state(), ack_info :: ack_info() }). The alarm_type, severity, probable_cause, proposed_repair_action and description fields can be filled in by the alarm configuration. (I.e. the developer or operator can say in advance that the partition_full+"/dev/hda2" alarm should have 'environment' alarm type, 'major' severity, etc.) The code is available on GitHub, together with the README that describes the further features (including acknowledging and commenting alarms, and subscribing to them): https://github.com/esl/elarm We hope that Elarm becomes the de facto alarming application in the Erlang world and we will certainly do all we can to make it as good as possible. Elarm is in part funded by the RELEASE project (http://release-project.eu/), which is an EU FP7 STREP (287510) project that aims to scale the radical concurrency-oriented programming paradigm to build reliable general-purpose software, such as server-based systems, on massively parallel machines. Regards, Csaba _______________________________________________ erlang-questions mailing list erlang-questions@REDACTED http://erlang.org/mailman/listinfo/erlang-questions From csaba.hoch@REDACTED Fri May 23 14:37:48 2014 From: csaba.hoch@REDACTED (Csaba Hoch) Date: Fri, 23 May 2014 14:37:48 +0200 Subject: [erlang-questions] Elarm (Erlang alarm library) In-Reply-To: References: <194718730.904077.1400785234678.JavaMail.zimbra@erlang-solutions.com> <810813099.904079.1400785296561.JavaMail.zimbra@erlang-solutions.com> Message-ID: <9AC3B911-397E-4508-8062-6EB31936F1F6@erlang-solutions.com> Hi Ola, That's a good point. The reason for using gproc instead of erlang:register is that the former accepts any term, not only atoms. Even though the typical elarm usage will probably be to have one elarm server on one node, it is possible to create new elarm servers dynamically. If we simply used erlang:register for the elarm_summary_sum process of each elarm server, we would have needed to dynamically generate atoms, which is usually not a good idea. The simplest thing to do here was to use gproc. That said, afterwards we added an elarm_registry module, which stores the pids of all elarm servers on the node. That could be used instead of gproc. Also, thanks to Anthony, we now have a ticket to discuss this question :) https://github.com/esl/elarm/issues/19 Csaba On 2014 May 23, at 10:30, Ola B?ckstr?m wrote: > This alarm lib looks interesting! > > One quick question: gproc is used in the module elarm_summary_sup.erl. Is that really needed? Couldn't a simple named supervisor be used? In that case would the alarm library not have any dependencies apart from Erlang/OTP. > > Regards, > /Ola > > -----Original Message----- > From: erlang-questions-bounces@REDACTED [mailto:erlang-questions-bounces@REDACTED] On Behalf Of Csaba Hoch > Sent: den 22 maj 2014 21:02 > To: erlang-questions@REDACTED > Subject: [erlang-questions] [ANN] Elarm (Erlang alarm library) > > Hi, > > I would like to announce a new Erlang alarm library called Elarm (https://github.com/esl/elarm). > > Elarm is an Alarm Manager for Erlang. It is designed to be easy to include in an Erlang based system and easy to use: > > ok = elarm:raise(partition_full, "/dev/hda2", [{level,90}]) # raise an alarm > ok = elarm:clear(partition_full, "/dev/hda2") # clear the alarm > > Elarm stores the alarms on the node (in ets by default, but the backend can be changed). This makes it easier for the node to have a REST/SNMP/web/etc. interface that shows the node's alarms, since those interfaces can ask Elarm for the list of alarms, which will include the alarm state (new or acknowledged), severity, and quite a few other > fields: > > -record(alarm, { > alarm_id :: alarm_id(), % e.g. 'partition_full' > alarm_type :: alarm_type(), % e.g. 'environment' > src :: alarm_src(), % e.g. "/dev/hda2" > event_time = calendar:universal_time() :: timestamp(), > event_id :: event_id(), > severity = indeterminate :: severity(), > probable_cause = <<"">> :: probable_cause(), > proposed_repair_action = <<"">> :: proposed_repair_action(), > description = <<"">> :: description(), > additional_information :: additional_information(), % e.g. [{level,90}] > correlated_events = [] :: [event_id()], % not used yet > comments = [] :: comments(), > trend :: trend(), % not used yet > threshold :: undefined | threshold(), % not used yet > state = new :: alarm_state(), > ack_info :: ack_info() > }). > > The alarm_type, severity, probable_cause, proposed_repair_action and description fields can be filled in by the alarm configuration. (I.e. > the developer or operator can say in advance that the partition_full+"/dev/hda2" alarm should have 'environment' alarm type, 'major' severity, etc.) > > The code is available on GitHub, together with the README that describes the further features (including acknowledging and commenting alarms, and subscribing to them): https://github.com/esl/elarm > > We hope that Elarm becomes the de facto alarming application in the Erlang world and we will certainly do all we can to make it as good as possible. > > Elarm is in part funded by the RELEASE project (http://release-project.eu/), which is an EU FP7 STREP (287510) project that aims to scale the radical concurrency-oriented programming paradigm to build reliable general-purpose software, such as server-based systems, on massively parallel machines. > > Regards, > Csaba > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions From g@REDACTED Fri May 23 16:09:37 2014 From: g@REDACTED (Garrett Smith) Date: Fri, 23 May 2014 09:09:37 -0500 Subject: [erlang-questions] Erlang Survey, Part II (Friends and Enemies) Message-ID: Thanks to everyone who took the time to provide feedback via the Erlang Survey. The quality of input is simply stunning and a testimony to the Erlang community at large. But I have another request. Would you please ask one or two colleagues who may have constructive thoughts on Erlang to fill out the survey? Here's the link they should use: https://www.surveymonkey.com/s/on-erlang Perhaps they've spent time investigating Erlang but have not quite pushed through to adopt it -- or perhaps they're just brilliant people who always have valuable insight into language and adoption. We need to hear from friends and enemies alike! This is a very important phase for this project. If we don't seriously engage those outside the Erlang community, we're at risk for and "echo chamber" effect (bias). It's essential that we collect feedback from a wide spectrum. Thanks again for your investment of time here! Garrett P.S. If can help spread the word via Twitter, please feel free to retweet: https://twitter.com/gar1t/status/469841950536126464 From eshikafe@REDACTED Fri May 23 17:31:43 2014 From: eshikafe@REDACTED (austin aigbe) Date: Fri, 23 May 2014 16:31:43 +0100 Subject: [erlang-questions] ODBC Connection Error to MS Access Database file (.mdb) Message-ID: Hi, How do I use the odbc module to connect to an access database file on my PC? The connect function gives me the following error: 4> odbc:connect("Driver={Microsoft Access Driver (*.mdb)};DBQ=mml_dump_20140523.mdb",[]). {error,odbc_not_started} Thanks. BR, Austin -------------- next part -------------- An HTML attachment was scrubbed... URL: From sean@REDACTED Fri May 23 18:44:59 2014 From: sean@REDACTED (Sean Cribbs) Date: Fri, 23 May 2014 10:44:59 -0600 Subject: [erlang-questions] ODBC Connection Error to MS Access Database file (.mdb) In-Reply-To: References: Message-ID: It's saying you need to start the 'odbc' application: application:start(odbc). On Fri, May 23, 2014 at 9:31 AM, austin aigbe wrote: > Hi, > > How do I use the odbc module to connect to an access database file on my > PC? > The connect function gives me the following error: > > 4> odbc:connect("Driver={Microsoft Access Driver > (*.mdb)};DBQ=mml_dump_20140523.mdb",[]). > {error,odbc_not_started} > > Thanks. > > BR, > Austin > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > > -- Sean Cribbs Software Engineer Basho Technologies, Inc. http://basho.com/ -------------- next part -------------- An HTML attachment was scrubbed... URL: From josh.rubyist@REDACTED Fri May 23 20:22:40 2014 From: josh.rubyist@REDACTED (Josh Adams) Date: Fri, 23 May 2014 13:22:40 -0500 Subject: [erlang-questions] net_adm:ping_list/1 and the scary comment above it In-Reply-To: References: Message-ID: > > > Can someone enlighten me if I should take that warning seriously? > > Kind regards, > Martin Schuerrer > I'd love to know the answer too. Surely it can't be accurate, but if so it should surely be rm'ed as well right? -Josh -------------- next part -------------- An HTML attachment was scrubbed... URL: From co7eb@REDACTED Fri May 23 22:03:43 2014 From: co7eb@REDACTED (=?iso-8859-1?Q?Ivan_Carmenates_Garc=EDa?=) Date: Fri, 23 May 2014 16:03:43 -0400 Subject: [erlang-questions] Chicago Boss Array Fields in Models Message-ID: <002e01cf76c2$1b1afc00$5150f400$@frcuba.co.cu> Hi every one, I was wondering how CB treats the database array fields, If I have for example a postgres script like this one: CREATE TABLE users ( id PRIMARY KEY, name varchar(50), emails varchar(50) [] ) In CB a model like this: -module(users, [Id, Name, Emails]). So I have inserted a record in the database and it looks as follow: Id name emails 1 Will {will@REDACTED , will89@REDACTED, will2014@REDACTED} When I do a bossdb:find(users, []) for the field emails I got <<"{will@REDACTED, will89@REDACTED, will2014@REDACTED}">> My question is obviously, WTF??? Sorry about that!! How can I parse that!!! To a nicely, normal, pretty, good syntax of CB. Even I tried from the view to get the value and the value I got is {will@REDACTED , will89@REDACTED, will2014@REDACTED} in the view test_array('GET', []) -> L = boss_db:find(test, []), [{_, _, Emails} | R] = L, {ok, [{emails, Emails}]}. For the view
    {% if emails %} {{ emails }} {% else %}
  • Nothing to do.
  • {% endif %}
Best regards, Ivan. -------------- next part -------------- An HTML attachment was scrubbed... URL: From mjtruog@REDACTED Fri May 23 23:49:44 2014 From: mjtruog@REDACTED (Michael Truog) Date: Fri, 23 May 2014 14:49:44 -0700 Subject: [erlang-questions] IPC and peer communication between erlang and native application In-Reply-To: <42469c65-47f1-4f9b-90c5-ac44a5a52520@googlegroups.com> References: <42469c65-47f1-4f9b-90c5-ac44a5a52520@googlegroups.com> Message-ID: <537FC278.6050006@gmail.com> You can use a cnode if you want the c/c++ to act like a distributed Erlang node, but that would be for normal LAN usage (no high latency) and it would be a hidden node (not a normal visible node that everyone is connected to). I have CloudI (http://cloudi.org) which creates separate sockets for each thread used in c/c++ source code (for each OS process spawned), but the OS processes are managed like an Erlang port is managed, by the Erlang VM. If you need something independent completely, you can just do a normal separate protocol with c/c++ clients connecting to an Erlang server, using msgpack or something similar for the protocol. It just depends on what is required. (it is generally better to send emails to erlang-questions@REDACTED, the erlang-programming@REDACTED emails get lost often due to google plus issues) On 05/23/2014 01:19 PM, James wrote: > > I need to pass messages between an erlang application and a native program, existing as peers rather than either being the subordinate of the other. > There is some documentation on ports, but these are all erlang applications that call subordinate native applications to do something like computation. > > I know I could use tcp sockets, but I am not sure that fits our needs. > > If some people could offer some recommendations, I would appreciate it. > > I am also looking at a message brokerage framework like rabbitmq, but it seems that the message passing between erlang applications is limited to erlang. > An example of passing messages between erlang and c/c++ applications would certainly be great. > > Much thanks. > # james > > -- > Remember to send a copy to erlang (dot) questions (at) erlang (dot) org when posting. > --- > You received this message because you are subscribed to the Google Groups "Erlang Programming" group. > To unsubscribe from this group and stop receiving emails from it, send an email to erlang-programming+unsubscribe@REDACTED . > To post to this group, send email to erlang-programming@REDACTED . > Visit this group at http://groups.google.com/group/erlang-programming. > For more options, visit https://groups.google.com/d/optout. -------------- next part -------------- An HTML attachment was scrubbed... URL: From eshikafe@REDACTED Sat May 24 12:17:41 2014 From: eshikafe@REDACTED (austin aigbe) Date: Sat, 24 May 2014 11:17:41 +0100 Subject: [erlang-questions] ODBC Connection Error to MS Access Database file (.mdb) In-Reply-To: References: Message-ID: I have the ODBC driver installed but I get the IM002 error. What could be wrong? 5> application:start(odbc). ok 6> odbc:connect("Driver={Microsoft Access Driver (*.mdb)};DBQ=mml_dump_20140523.mdb",[]). {error,"[Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified SQLSTATE IS: IM002 Connection to database failed."} 7> On Fri, May 23, 2014 at 5:44 PM, Sean Cribbs wrote: > It's saying you need to start the 'odbc' application: > > application:start(odbc). > > > On Fri, May 23, 2014 at 9:31 AM, austin aigbe wrote: > >> Hi, >> >> How do I use the odbc module to connect to an access database file on my >> PC? >> The connect function gives me the following error: >> >> 4> odbc:connect("Driver={Microsoft Access Driver >> (*.mdb)};DBQ=mml_dump_20140523.mdb",[]). >> {error,odbc_not_started} >> >> Thanks. >> >> BR, >> Austin >> >> >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://erlang.org/mailman/listinfo/erlang-questions >> >> > > > -- > Sean Cribbs > Software Engineer > Basho Technologies, Inc. > http://basho.com/ > -------------- next part -------------- An HTML attachment was scrubbed... URL: From n.oxyde@REDACTED Sat May 24 14:30:59 2014 From: n.oxyde@REDACTED (Anthony Ramine) Date: Sat, 24 May 2014 14:30:59 +0200 Subject: [erlang-questions] net_adm:ping_list/1 and the scary comment above it In-Reply-To: References: Message-ID: <6C54BA3C-9C5A-49B6-883C-D532743D85B9@gmail.com> It was already in R6B-0. -- Anthony Ramine Le 22 mai 2014 ? 15:28, Martin Sch?rrer a ?crit : > It's been in there since at least R13B03 when Erlang moved to git. > From rtrlists@REDACTED Sun May 25 11:25:54 2014 From: rtrlists@REDACTED (Robert Raschke) Date: Sun, 25 May 2014 10:25:54 +0100 Subject: [erlang-questions] ODBC Connection Error to MS Access Database file (.mdb) In-Reply-To: References: Message-ID: As far as I remember, there are four different places in MS land where DSNs and drivers are defined: 32-bit system and user, 64-bit system and user. And I think the Erlang odbc module needs the 32-bit system one. This is from memory, so things could have moved on. But I would recommend you try checking the drivers by explicitly running the 32-bit odbc driver manager. HTH, Robby On May 24, 2014 11:18 AM, "austin aigbe" wrote: > I have the ODBC driver installed but I get the IM002 error. What could be > wrong? > > > 5> application:start(odbc). > ok > 6> odbc:connect("Driver={Microsoft Access Driver > (*.mdb)};DBQ=mml_dump_20140523.mdb",[]). > {error,"[Microsoft][ODBC Driver Manager] Data source name not found and no > default driver specified SQLSTATE IS: IM002 Connection to database failed."} > 7> > > > > > On Fri, May 23, 2014 at 5:44 PM, Sean Cribbs wrote: > >> It's saying you need to start the 'odbc' application: >> >> application:start(odbc). >> >> >> On Fri, May 23, 2014 at 9:31 AM, austin aigbe wrote: >> >>> Hi, >>> >>> How do I use the odbc module to connect to an access database file on my >>> PC? >>> The connect function gives me the following error: >>> >>> 4> odbc:connect("Driver={Microsoft Access Driver >>> (*.mdb)};DBQ=mml_dump_20140523.mdb",[]). >>> {error,odbc_not_started} >>> >>> Thanks. >>> >>> BR, >>> Austin >>> >>> >>> _______________________________________________ >>> erlang-questions mailing list >>> erlang-questions@REDACTED >>> http://erlang.org/mailman/listinfo/erlang-questions >>> >>> >> >> >> -- >> Sean Cribbs >> Software Engineer >> Basho Technologies, Inc. >> http://basho.com/ >> > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From aseigo@REDACTED Sun May 25 18:50:26 2014 From: aseigo@REDACTED (Aaron J. Seigo) Date: Sun, 25 May 2014 18:50:26 +0200 Subject: [erlang-questions] IPC and peer communication between erlang and native application In-Reply-To: <537FC278.6050006@gmail.com> References: <42469c65-47f1-4f9b-90c5-ac44a5a52520@googlegroups.com> <537FC278.6050006@gmail.com> Message-ID: <7223670.09x6WyC9pQ@freedom> On Friday, May 23, 2014 14:49:44 Michael Truog wrote: > > erlang. An example of passing messages between erlang and c/c++ > > applications would certainly be great. have you considered zeromq? there are a couple of erlang modules available (erlzmq2, czmq) with different performance/stability characteristics, and zeromq for C/C++ is (obviously) supported very very well. -- Aaron J. Seigo -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 198 bytes Desc: This is a digitally signed message part. URL: From dmkolesnikov@REDACTED Mon May 26 10:50:17 2014 From: dmkolesnikov@REDACTED (Dmitry Kolesnikov) Date: Mon, 26 May 2014 11:50:17 +0300 Subject: [erlang-questions] List comprehension question In-Reply-To: References: Message-ID: Hello, Your fist suggestion fails in shell with * 1: variable 'NC' unsafe in 'case' (line 2) The last suggestion with two generators looks pretty cool. I?ve got an impression that its complexity is N * log(N). This technique has not been highlighted anywhere in Erlang documentation :-( Thanks for sharing Best Regards, Dmitry On 22 May 2014, at 22:44, Rich Neswold wrote: > On Thu, Jan 16, 2014 at 10:39 AM, Rich Neswold wrote: > > This morning I became aware of a (powerful) feature of list > > comprehensions. Take the following example: > > > > [ X + Y || {X, Y} <- L]. > > > > If we set L to [{1,2}, ok, {1,3}], we get the result [3,4] instead of > > a pattern match exception (as I was expecting.) This means that list > > comprehensions give you a "free" lists:filter/2 in the generator > > expressions! > > So having learned about the filtering abilities of comprehensions, I stumbled upon another way to use it effectively. > > I have a list of data that needs to be transformed, but some of resulting data is pulled from a lookup table (I'm using gb_trees.) I can do the following (please ignore the short variable names; I'm trying to emphasis the generators and filters): > > [{{S, NC}, SF} || {S, C} <- Reqs, > case gb_trees:lookup({S, C}, T) of > {value, {NC, SF}} -> true; > none -> false > end] > It would be much nicer to use pattern matching and use the comprehension's ability to treat bad matches as a filter. But I can't replace the case statement above with: > > [{{S, NC}, SF} || {S, C} <- Reqs, > {value, {NC, SF}} = gb_trees:lookup({S, C}, T)] > > However, I can do this: > > [{{S, NC}, SF} || {S, C} <- Reqs, > {value, {NC, SF}} <- [gb_trees:lookup({S, C}, T)]] > > Wrap the function in a single element array and now you have a generator! Now I can add more filters or more generators to it. > > I don't know how many people already use this trick, but I thought it might of use to others. > > -- > Rich > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions -------------- next part -------------- An HTML attachment was scrubbed... URL: From bjorn@REDACTED Mon May 26 11:56:02 2014 From: bjorn@REDACTED (=?UTF-8?Q?Bj=C3=B6rn_Gustavsson?=) Date: Mon, 26 May 2014 11:56:02 +0200 Subject: [erlang-questions] net_adm:ping_list/1 and the scary comment above it In-Reply-To: References: Message-ID: On Thu, May 22, 2014 at 3:28 PM, Martin Sch?rrer wrote: > Was looking through the Erlang/OTP source yesterday and found > net_adm:ping_list/1 which isn't documented but has a really scary comment: > > https://github.com/erlang/otp/blob/maint/lib/kernel/src/net_adm.erl#L117-L132 > > %% A common situation in "life" is to have a configuration file with a list > %% of nodes, and then at startup, all nodes in the list are ping'ed > %% this can lead to no end of troubles if two disconnected nodes > %% simultaneously ping each other. > %% Use this function in order to do it safely. > %% It assumes a working global.erl which ensures a fully > %% connected network. > %% Had the erlang runtime system been able to fully cope with > %% the possibility of two simultaneous (unix) connects, this function would > %% merley be lists:map({net_adm, ping}, [], Nodelist). > %% It is also assumed, that the same (identical) Nodelist is given to all > %% nodes which are to perform this call (possibly simultaneously). > %% Even this code has a flaw, and that is the case where two > %% nodes simultaneously and without *any* other already > %% running nodes execute this code. :-( > > It's been in there since at least R13B03 when Erlang moved to git. I haven't checked, but I think I saw the comment in R1 too. > Can someone enlighten me if I should take that warning seriously? I think that all bugs having to do with simultaneous connects have been fixed a long time ago. /Bjorn -- Bj?rn Gustavsson, Erlang/OTP, Ericsson AB From n.oxyde@REDACTED Mon May 26 13:02:38 2014 From: n.oxyde@REDACTED (Anthony Ramine) Date: Mon, 26 May 2014 13:02:38 +0200 Subject: [erlang-questions] List comprehension question In-Reply-To: References: Message-ID: <6197E56D-FEAF-4534-B78B-C915F06005AE@gmail.com> That would change semantics of existing programs, no thanks. I do have plans to implement Pat ?= Expr filters, though, not reusing the matching operator ?=?. -- Anthony Ramine Le 22 mai 2014 ? 21:44, Rich Neswold a ?crit : > It would be much nicer to use pattern matching and use the comprehension's ability to treat bad matches as a filter. But I can't replace the case statement above with: > > [{{S, NC}, SF} || {S, C} <- Reqs, > {value, {NC, SF}} = gb_trees:lookup({S, C}, T)] From ransomr@REDACTED Mon May 26 18:48:54 2014 From: ransomr@REDACTED (Ransom Richardson) Date: Mon, 26 May 2014 16:48:54 +0000 Subject: [erlang-questions] [ANN] fprofx - fprof extended to include suspend and GC time Message-ID: <1401122933337.65053@talko.com> https://github.com/talko/fprofx I've extended fprof to include two additional columns - suspend time and GC time. I've found this very useful when profiling operations that involve multiple processes. fprofx also includes an updated version of erlgrind that works with the new output format and can remove suspend time. -------------- next part -------------- An HTML attachment was scrubbed... URL: From n.oxyde@REDACTED Tue May 27 11:16:41 2014 From: n.oxyde@REDACTED (Anthony Ramine) Date: Tue, 27 May 2014 11:16:41 +0200 Subject: [erlang-questions] [ANN] fprofx - fprof extended to include suspend and GC time In-Reply-To: <1401122933337.65053@talko.com> References: <1401122933337.65053@talko.com> Message-ID: <337C6155-6E4B-4CD8-8F69-EA2C35C8B88D@gmail.com> Could you submit this as an OTP patch? -- Anthony Ramine Le 26 mai 2014 ? 18:48, Ransom Richardson a ?crit : > https://github.com/talko/fprofx > > I've extended fprof to include two additional columns - suspend time and GC time. I've found this very useful when profiling operations that involve multiple processes. fprofx also includes an updated version of erlgrind that works with the new output format and can remove suspend time. > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions From solomon.wzs@REDACTED Tue May 27 12:05:29 2014 From: solomon.wzs@REDACTED (Solomon) Date: Tue, 27 May 2014 18:05:29 +0800 Subject: [erlang-questions] Problem of post the data with httpc Message-ID: Hi. When I use curl post the data to mochiweb like this: curl http://192.168.1.1 -d "hello" I could call Req:parse_post() to get the data like [{"hello",[]}], and call Req:recv_body() to get the data like <<"hello">>. When I use httpc post the data to mochiweb like this: httpc:request(post, {"http://192.168.1..1", [], [], "hello"}, [], []) I could call Req:recv_body() to get the data like <<"hello">>, but when I call Req:parse_post(), it return []. How should I post data with httpc like curl? Regards, Solomon -------------- next part -------------- An HTML attachment was scrubbed... URL: From bombadil@REDACTED Tue May 27 12:32:30 2014 From: bombadil@REDACTED (Manuel A. Rubio "Bombadil") Date: Tue, 27 May 2014 13:32:30 +0300 Subject: [erlang-questions] Chicago Boss Array Fields in Models In-Reply-To: <002e01cf76c2$1b1afc00$5150f400$@frcuba.co.cu> References: <002e01cf76c2$1b1afc00$5150f400$@frcuba.co.cu> Message-ID: <044a0428ae6c0151536b8fc4f16d4c28@bosqueviejo.net> Hi Ivan, I think arrays is not well supported for retrieve information from postgres, I afraid, if you go to a psql terminal and run a simple: SELECT emails FROM users; You realise the output is the same that you get with boss_db. Perhaps you should normalice the data, create another table for emails and another model using -has or -belongs instead. Another solution is create a parser for that and in the model, use a specific function to get the data parsed. But I think this is more complex to do. Regards. Manuel Rubio. El 2014-05-23 23:03, Ivan Carmenates Garc?a escribi?: > Hi every one, > > I was wondering how CB treats the database array fields, > > If I have for example a postgres script like this one: > > CREATE TABLE users ( > > id PRIMARY KEY, > > name varchar(50), > > emails varchar(50) [] > > ) > > In CB a model like this: > > -module(users, [Id, Name, Emails]). > > So I have inserted a record in the database and it looks as follow: > > Id name emails > > 1 Will {will@REDACTED, will89@REDACTED, will2014@REDACTED} > > When I do a bossdb:find(users, []) for the field emails I got <<"{will@REDACTED, will89@REDACTED, will2014@REDACTED}">> > > My question is obviously, WTF??? Sorry about that!! How can I parse that!!! To a nicely, normal, pretty, good syntax of CB. > > Even I tried from the view to get the value and the value I got is {will@REDACTED, will89@REDACTED, will2014@REDACTED} in the view > > test_array('GET', []) -> > > L = boss_db:find(test, []), > > [{_, _, Emails} | R] = L, > > {ok, [{emails, Emails}]}. > > For the view > >
    > > {% if emails %} > > {{ emails }} > > {% else %} > >
  • Nothing to do.
  • > > {% endif %} > >
> > Best regards, > > Ivan. > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions [1] Links: ------ [1] http://erlang.org/mailman/listinfo/erlang-questions -------------- next part -------------- An HTML attachment was scrubbed... URL: From erlang@REDACTED Tue May 27 12:58:24 2014 From: erlang@REDACTED (Joe Armstrong) Date: Tue, 27 May 2014 12:58:24 +0200 Subject: [erlang-questions] finding the nearest key in a key-value table Message-ID: What's the best data structure to support a "nearest key" operation? I want a data structure that supports the following operations: new() -> NewTree insert(Key, Value, Tree) -> NewTree delete(Key, Tree) -> NewTree nearest(Key, N, Tree) -> [{Key1,Val1},{Key2,Val2} ...]. Keys are 20 byte binaries, values are 6 byte binaries The maximum number of keys of Key-Value pairs is 10 million. nearest(Key, N, Tree) returns the N nearest items to Key in the tree "near" means that the keys are near to each other. Often the key I want will not be in the tree, so I want nearby keys. The nearness measure is just the "distance" between the two keys (ie the nearest N keys to the given key if the keys were to be sorted) Are there any Erlang libraries that do this? /Joe -------------- next part -------------- An HTML attachment was scrubbed... URL: From dmkolesnikov@REDACTED Tue May 27 13:23:03 2014 From: dmkolesnikov@REDACTED (Dmitry Kolesnikov) Date: Tue, 27 May 2014 14:23:03 +0300 Subject: [erlang-questions] finding the nearest key in a key-value table In-Reply-To: References: Message-ID: Hello, r-tree / kd-tree might be use-full for you to handle ?nearest? lookup. however, I am not aware of efficient implementation on Erlang. Another, the best possible ?available? option for your problem domain is sorted trees. It gives you log N complexity. If the key distance is multi-dimentional then z-ordered curve technique would help you to cluster ?nearby? keys. You might take a look into my modification of gb_trees that allows to execute range queries (via iterator). https://github.com/fogfish/feta/blob/master/src/gbt.erl Therefore, nearest key lookup becomes a range lookup according criteria of your application. nearest(Key, N, Tree) -> iterator_to_list( gbt:range(key_to_range(Key, N), Tree) ,[] ). iterator_to_list(Iter0, Acc) -> case gbt:iterator(Iter) of none -> lists:reverse(Acc); {Key, Val, Iter} -> iterator_to_list(Iter, [{Key, Val}|Acc]) end. I?ve notice that 10M key might be large for Erlang data structures (e.g. I am trying to limit gb_trees to 1 - 2M in my apps) if you have many writes. Therefore, you might convert you lookup table to ets but same techniques is applicable to search nearest keys. Best Regards, Dmitry On 27 May 2014, at 13:58, Joe Armstrong wrote: > > What's the best data structure to support a "nearest key" operation? > > I want a data structure that supports the following operations: > > new() -> NewTree > > insert(Key, Value, Tree) -> NewTree > > delete(Key, Tree) -> NewTree > > nearest(Key, N, Tree) -> [{Key1,Val1},{Key2,Val2} ...]. > > Keys are 20 byte binaries, values are 6 byte binaries > > The maximum number of keys of Key-Value pairs is 10 million. > > nearest(Key, N, Tree) returns the N nearest items to Key in the tree > > "near" means that the keys are near to each other. Often the key I want will not > be in the tree, so I want nearby keys. The nearness measure is just the > "distance" between the two keys (ie the nearest N keys to the given key if the keys were to > be sorted) > > Are there any Erlang libraries that do this? > > /Joe > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions From tony@REDACTED Tue May 27 13:26:12 2014 From: tony@REDACTED (Tony Rogvall) Date: Tue, 27 May 2014 13:26:12 +0200 Subject: [erlang-questions] finding the nearest key in a key-value table In-Reply-To: References: Message-ID: <4C231C92-196B-4D09-A142-E94856A5494F@rogvall.se> What about an ets ordered set table? /Tony On 27 maj 2014, at 12:58, Joe Armstrong wrote: > > What's the best data structure to support a "nearest key" operation? > > I want a data structure that supports the following operations: > > new() -> NewTree > > insert(Key, Value, Tree) -> NewTree > > delete(Key, Tree) -> NewTree > > nearest(Key, N, Tree) -> [{Key1,Val1},{Key2,Val2} ...]. > > Keys are 20 byte binaries, values are 6 byte binaries > > The maximum number of keys of Key-Value pairs is 10 million. > > nearest(Key, N, Tree) returns the N nearest items to Key in the tree > > "near" means that the keys are near to each other. Often the key I want will not > be in the tree, so I want nearby keys. The nearness measure is just the > "distance" between the two keys (ie the nearest N keys to the given key if the keys were to > be sorted) > > Are there any Erlang libraries that do this? > > /Joe > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions "Installing applications can lead to corruption over time. Applications gradually write over each other's libraries, partial upgrades occur, user and system errors happen, and minute changes may be unnoticeable and difficult to fix" -------------- next part -------------- An HTML attachment was scrubbed... URL: From rich.neswold@REDACTED Tue May 27 13:35:50 2014 From: rich.neswold@REDACTED (Rich Neswold) Date: Tue, 27 May 2014 06:35:50 -0500 Subject: [erlang-questions] List comprehension question In-Reply-To: <6197E56D-FEAF-4534-B78B-C915F06005AE@gmail.com> References: <6197E56D-FEAF-4534-B78B-C915F06005AE@gmail.com> Message-ID: On Mon, May 26, 2014 at 6:02 AM, Anthony Ramine wrote: > That would change semantics of existing programs, no thanks. > How? > I do have plans to implement Pat ?= Expr filters, though, not reusing the > matching operator ?=?. That would be nice. Until then, we can use the single-element generator trick. -- Rich -------------- next part -------------- An HTML attachment was scrubbed... URL: From rich.neswold@REDACTED Tue May 27 13:40:04 2014 From: rich.neswold@REDACTED (Rich Neswold) Date: Tue, 27 May 2014 06:40:04 -0500 Subject: [erlang-questions] List comprehension question In-Reply-To: References: Message-ID: On Mon, May 26, 2014 at 3:50 AM, Dmitry Kolesnikov wrote: > Hello, > > Your fist suggestion fails in shell with > * 1: variable 'NC' unsafe in 'case' (line 2) > Yes, the compiler isn't smart enough to realize the false case will prevent further evaluation. It's a false warning. > The last suggestion with two generators looks pretty cool. > I?ve got an impression that its complexity is N * log(N). > Why N * log(N)? With two generators, the complexity is O(N * M), but M, in this case, is 1 so it should still be very close to O(N). I'm glad you found the method useful, though. -- Rich -------------- next part -------------- An HTML attachment was scrubbed... URL: From erlang@REDACTED Tue May 27 14:10:28 2014 From: erlang@REDACTED (Joe Armstrong) Date: Tue, 27 May 2014 14:10:28 +0200 Subject: [erlang-questions] finding the nearest key in a key-value table In-Reply-To: <4C231C92-196B-4D09-A142-E94856A5494F@rogvall.se> References: <4C231C92-196B-4D09-A142-E94856A5494F@rogvall.se> Message-ID: On Tue, May 27, 2014 at 1:26 PM, Tony Rogvall wrote: > What about an ets ordered set table? > How? - the problem is the key I lookup are not in the table Suppose I insert keys 1, 46, 218, 345, 578, 6541, 14671, .... And I lookup a key 400 - this is not in the list - I'd like ets:nearest(400, Tab) to return the key 354 entry - but there is no ets:nearest ... /Joe > > /Tony > > On 27 maj 2014, at 12:58, Joe Armstrong wrote: > > > What's the best data structure to support a "nearest key" operation? > > I want a data structure that supports the following operations: > > new() -> NewTree > > insert(Key, Value, Tree) -> NewTree > > delete(Key, Tree) -> NewTree > > nearest(Key, N, Tree) -> [{Key1,Val1},{Key2,Val2} ...]. > > Keys are 20 byte binaries, values are 6 byte binaries > > The maximum number of keys of Key-Value pairs is 10 million. > > nearest(Key, N, Tree) returns the N nearest items to Key in the tree > > "near" means that the keys are near to each other. Often the key I want > will not > be in the tree, so I want nearby keys. The nearness measure is just the > "distance" between the two keys (ie the nearest N keys to the given key if > the keys were to > be sorted) > > Are there any Erlang libraries that do this? > > /Joe > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > > > "Installing applications can lead to corruption over time. Applications > gradually write over each other's libraries, partial upgrades occur, user > and system errors happen, and minute changes may be unnoticeable and > difficult to fix" > > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jesper.louis.andersen@REDACTED Tue May 27 14:12:35 2014 From: jesper.louis.andersen@REDACTED (Jesper Louis Andersen) Date: Tue, 27 May 2014 14:12:35 +0200 Subject: [erlang-questions] finding the nearest key in a key-value table In-Reply-To: References: <4C231C92-196B-4D09-A142-E94856A5494F@rogvall.se> Message-ID: Use ets:next/1 and ets:prev/1 to expand a window from your target key. They work even if the initial key is not in the window. This should be fairly easy to implement for the 1d case. For higher-dimensional cases, k,d-trees is a favorite of mine. On Tue, May 27, 2014 at 2:10 PM, Joe Armstrong wrote: > > > On Tue, May 27, 2014 at 1:26 PM, Tony Rogvall wrote: > >> What about an ets ordered set table? >> > > How? - the problem is the key I lookup are not in the table > > Suppose I insert keys > > 1, 46, 218, 345, 578, 6541, 14671, .... > > And I lookup a key 400 - this is not in the list - I'd like > ets:nearest(400, Tab) to return > the key 354 entry - but there is no ets:nearest ... > > /Joe > > > >> >> /Tony >> >> On 27 maj 2014, at 12:58, Joe Armstrong wrote: >> >> >> What's the best data structure to support a "nearest key" operation? >> >> I want a data structure that supports the following operations: >> >> new() -> NewTree >> >> insert(Key, Value, Tree) -> NewTree >> >> delete(Key, Tree) -> NewTree >> >> nearest(Key, N, Tree) -> [{Key1,Val1},{Key2,Val2} ...]. >> >> Keys are 20 byte binaries, values are 6 byte binaries >> >> The maximum number of keys of Key-Value pairs is 10 million. >> >> nearest(Key, N, Tree) returns the N nearest items to Key in the tree >> >> "near" means that the keys are near to each other. Often the key I >> want will not >> be in the tree, so I want nearby keys. The nearness measure is just the >> "distance" between the two keys (ie the nearest N keys to the given key >> if the keys were to >> be sorted) >> >> Are there any Erlang libraries that do this? >> >> /Joe >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://erlang.org/mailman/listinfo/erlang-questions >> >> >> "Installing applications can lead to corruption over time. Applications >> gradually write over each other's libraries, partial upgrades occur, user >> and system errors happen, and minute changes may be unnoticeable and >> difficult to fix" >> >> >> >> > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > > -- J. -------------- next part -------------- An HTML attachment was scrubbed... URL: From erlang@REDACTED Tue May 27 14:27:27 2014 From: erlang@REDACTED (Joe Armstrong) Date: Tue, 27 May 2014 14:27:27 +0200 Subject: [erlang-questions] finding the nearest key in a key-value table In-Reply-To: References: <4C231C92-196B-4D09-A142-E94856A5494F@rogvall.se> Message-ID: You mean test() -> E = ets:new(test, [ordered_set]), ets:insert(E, [{1,a}, {22,b}, {32,c}, {47,d}, {55,e}, {97,f}]), N = ets:next(E, 40), P = ets:prev(E, 40), {N,P}. Seems to work - so to find the K nearest I just iterate prev and next keeping track of which direction I have to move - very nice. I had assumed that ets:next needed a pre-existing key in the table to perform a next or prev operation. Problem solved - very neatly Thanks /Joe On Tue, May 27, 2014 at 2:12 PM, Jesper Louis Andersen < jesper.louis.andersen@REDACTED> wrote: > Use ets:next/1 and ets:prev/1 to expand a window from your target key. > They work even if the initial key is not in the window. This should be > fairly easy to implement for the 1d case. For higher-dimensional cases, > k,d-trees is a favorite of mine. > > > > On Tue, May 27, 2014 at 2:10 PM, Joe Armstrong wrote: > >> >> >> On Tue, May 27, 2014 at 1:26 PM, Tony Rogvall wrote: >> >>> What about an ets ordered set table? >>> >> >> How? - the problem is the key I lookup are not in the table >> >> Suppose I insert keys >> >> 1, 46, 218, 345, 578, 6541, 14671, .... >> >> And I lookup a key 400 - this is not in the list - I'd like >> ets:nearest(400, Tab) to return >> the key 354 entry - but there is no ets:nearest ... >> >> /Joe >> >> >> >>> >>> /Tony >>> >>> On 27 maj 2014, at 12:58, Joe Armstrong wrote: >>> >>> >>> What's the best data structure to support a "nearest key" operation? >>> >>> I want a data structure that supports the following operations: >>> >>> new() -> NewTree >>> >>> insert(Key, Value, Tree) -> NewTree >>> >>> delete(Key, Tree) -> NewTree >>> >>> nearest(Key, N, Tree) -> [{Key1,Val1},{Key2,Val2} ...]. >>> >>> Keys are 20 byte binaries, values are 6 byte binaries >>> >>> The maximum number of keys of Key-Value pairs is 10 million. >>> >>> nearest(Key, N, Tree) returns the N nearest items to Key in the tree >>> >>> "near" means that the keys are near to each other. Often the key I >>> want will not >>> be in the tree, so I want nearby keys. The nearness measure is just the >>> "distance" between the two keys (ie the nearest N keys to the given key >>> if the keys were to >>> be sorted) >>> >>> Are there any Erlang libraries that do this? >>> >>> /Joe >>> _______________________________________________ >>> erlang-questions mailing list >>> erlang-questions@REDACTED >>> http://erlang.org/mailman/listinfo/erlang-questions >>> >>> >>> "Installing applications can lead to corruption over time. Applications >>> gradually write over each other's libraries, partial upgrades occur, user >>> and system errors happen, and minute changes may be unnoticeable and >>> difficult to fix" >>> >>> >>> >>> >> >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://erlang.org/mailman/listinfo/erlang-questions >> >> > > > -- > J. > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jesper.louis.andersen@REDACTED Tue May 27 14:30:25 2014 From: jesper.louis.andersen@REDACTED (Jesper Louis Andersen) Date: Tue, 27 May 2014 14:30:25 +0200 Subject: [erlang-questions] finding the nearest key in a key-value table In-Reply-To: References: <4C231C92-196B-4D09-A142-E94856A5494F@rogvall.se> Message-ID: On Tue, May 27, 2014 at 2:27 PM, Joe Armstrong wrote: > Seems to work - so to find the K nearest I just iterate prev and next > keeping track of > which direction I have to move - very nice. > Yes. Coincidentally, this is also the approach taken by the fastest knapsack solver in existence, together with a dynamic programming table. But I digress :) -- J. -------------- next part -------------- An HTML attachment was scrubbed... URL: From kostis@REDACTED Tue May 27 14:39:50 2014 From: kostis@REDACTED (Kostis Sagonas) Date: Tue, 27 May 2014 14:39:50 +0200 Subject: [erlang-questions] finding the nearest key in a key-value table In-Reply-To: References: Message-ID: <53848796.5030601@cs.ntua.gr> On 05/27/2014 12:58 PM, Joe Armstrong wrote: > What's the best data structure to support a "nearest key" operation? > > I want a data structure that supports the following operations: > > new() -> NewTree > > insert(Key, Value, Tree) -> NewTree > > delete(Key, Tree) -> NewTree > > nearest(Key, N, Tree) -> [{Key1,Val1},{Key2,Val2} ...]. > > Keys are 20 byte binaries, values are 6 byte binaries > > The maximum number of keys of Key-Value pairs is 10 million. > > nearest(Key, N, Tree) returns the N nearest items to Key in the tree > > "near" means that the keys are near to each other. Often the key I > want will not > be in the tree, so I want nearby keys. The nearness measure is just the > "distance" between the two keys (ie the nearest N keys to the given key > if the keys were to > be sorted) > > Are there any Erlang libraries that do this? Joe, You have not really told us the most interesting aspect of your requirements. (Although one would be tempted to make an educated guess knowing you.) Do you want your data structure to be concurrent or not? If you want a concurrent such data structure, I am afraid you need to do something (much) more complicated than the code you posted a while ago... Kostis Incidentally, we have done some very recent work on measuring the scalability (or lack thereof) of concurrent ETS tables of type ordered_set and propose to base the implementation on a different, much more scalable data structure which dynamically adapts to contention. To those interested, we can send a paper privately. From erlang@REDACTED Tue May 27 14:55:15 2014 From: erlang@REDACTED (Joe Armstrong) Date: Tue, 27 May 2014 14:55:15 +0200 Subject: [erlang-questions] finding the nearest key in a key-value table In-Reply-To: <53848796.5030601@cs.ntua.gr> References: <53848796.5030601@cs.ntua.gr> Message-ID: On Tue, May 27, 2014 at 2:39 PM, Kostis Sagonas wrote: > On 05/27/2014 12:58 PM, Joe Armstrong wrote: > >> What's the best data structure to support a "nearest key" operation? >> >> I want a data structure that supports the following operations: >> >> new() -> NewTree >> >> insert(Key, Value, Tree) -> NewTree >> >> delete(Key, Tree) -> NewTree >> >> nearest(Key, N, Tree) -> [{Key1,Val1},{Key2,Val2} ...]. >> >> Keys are 20 byte binaries, values are 6 byte binaries >> >> The maximum number of keys of Key-Value pairs is 10 million. >> >> nearest(Key, N, Tree) returns the N nearest items to Key in the tree >> >> "near" means that the keys are near to each other. Often the key I >> want will not >> be in the tree, so I want nearby keys. The nearness measure is just the >> "distance" between the two keys (ie the nearest N keys to the given key >> if the keys were to >> be sorted) >> >> Are there any Erlang libraries that do this? >> > > Joe, > > You have not really told us the most interesting aspect of your > requirements. (Although one would be tempted to make an educated guess > knowing you.) > Now why would anybody want to put 20 byte binaries in a hash table and find the K nearest hits :-) > > Do you want your data structure to be concurrent or not? > Sequential access is fine for now > > If you want a concurrent such data structure, I am afraid you need to do > something (much) more complicated than the code you posted a while ago... > > > Kostis > > > > Incidentally, we have done some very recent work on measuring the > scalability (or lack thereof) of concurrent ETS tables of type ordered_set > and propose to base the implementation on a different, much more scalable > data structure which dynamically adapts to contention. To those > interested, we can send a paper privately. > Yes please :-) > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jan.chochol@REDACTED Tue May 27 14:54:04 2014 From: jan.chochol@REDACTED (Jan Chochol) Date: Tue, 27 May 2014 14:54:04 +0200 Subject: [erlang-questions] Dialyzer and opaque types Message-ID: Hello, We run in some problems with Dialyzer and opaque types. Our problem can be simulated by two modules: cat a.erl << EOF -module(a). -export([a/1]). -opaque opq() :: {term()}. -export_type([opq/0]). -spec a(atom() | binary() | opq()) -> opq(). a(X) -> {a2(X)}. a2({X}) -> X; a2(X) when is_atom(X) -> X; a2(X) when is_binary(X) -> list_to_atom(binary_to_list(X)). EOF cat b.erl << EOF -module(b). -export([b/1]). b(X) -> a:a(X). EOF When we generate PLT (using Erlang 16B03-1), and analyse it, we found, that info / contract for b:b/1 is not correctly created. Info for a:a/1: [{c,union,[{c,atom,any,unknown},{c,binary,[8,0],unknown},none,none,none,none, {c,tuple,[any],{1,any}},none,none,none],unknown}] -> {{c,tuple,[any],{1,any}} In other words: [atom() | binary() | {any()}] -> {any()} Which corresponds to the specification. Info for b:b/1: [{c,union,[{c,atom,any,unknown},{c,binary,[8,0],unknown},none,none,none,none,none,none,none,none],unknown}] -> {{c,opaque,[{opaque,a,opq,[],{c,tuple,[any],{1,any}}}],unknown} In other words: [atom() | binary()] -> a:opq() Which is wrong as it is missing possible argument of type a:opq(). When analysing problem I found this piece of code in lib/hipe/cerl/erl_types.erl: inf_union(U1, U2, opaque) -> %%--------------------------------------------------------------------- %% Under Testing %%---------------------------------------------------------------------- %% OpaqueFun = %% fun(Union1, Union2) -> %% [_,_,_,_,_,_,_,_,Opaque,_] = Union1, %% [A,B,F,I,L,N,T,M,_,_R] = Union2, %% List = [A,B,F,I,L,N,T,M], %% case [T || T <- List, t_inf(T, Opaque, opaque) =/= ?none] of %% [] -> ?none; %% _ -> Opaque %% end %% end, %% O1 = OpaqueFun(U1, U2), %% O2 = OpaqueFun(U2, U1), %% Union = inf_union(U1, U2, 0, [], opaque), %% t_sup([O1, O2, Union]); inf_union(U1, U2, 0, [], opaque); If we uncommented these lines, result of Dialyzer seems correct: [{c,union,[{c,atom,any,unknown},{c,binary,[8,0],unknown},none,none,none,none,none,none,{c,opaque,[{opaque,a,opq,[],{c,tuple,[any],{1,any}}}],unknown},none],unknown}] -> {{c,opaque,[{opaque,a,opq,[],{c,tuple,[any],{1,any}}}],unknown} In other words: [atom() | binary() | a:opq()] -> a:opq() Which is correct. According to git log, this part of code did not change since R13B03 (first git commit). My question is - is it still testing code? Can it be considered stable enough? >From my point of view, it removes false positive warning from Dialyzer (and seems enough correct from my point of view), but I am not sure, whether it can break something other. Regards, Jan Chochol From jesper.louis.andersen@REDACTED Tue May 27 14:56:41 2014 From: jesper.louis.andersen@REDACTED (Jesper Louis Andersen) Date: Tue, 27 May 2014 14:56:41 +0200 Subject: [erlang-questions] finding the nearest key in a key-value table In-Reply-To: References: <53848796.5030601@cs.ntua.gr> Message-ID: On Tue, May 27, 2014 at 2:55 PM, Joe Armstrong wrote: > Now why would anybody want to put 20 byte binaries in a hash table and > find the K nearest hits :-) Distributed Hash Table rings ;) -- J. -------------- next part -------------- An HTML attachment was scrubbed... URL: From dmkolesnikov@REDACTED Tue May 27 15:00:14 2014 From: dmkolesnikov@REDACTED (Dmitry Kolesnikov) Date: Tue, 27 May 2014 16:00:14 +0300 Subject: [erlang-questions] finding the nearest key in a key-value table In-Reply-To: References: <53848796.5030601@cs.ntua.gr> Message-ID: <357359DF-966F-4681-9ACF-AFA00979F0DE@gmail.com> On 27 May 2014, at 15:56, Jesper Louis Andersen wrote: > > On Tue, May 27, 2014 at 2:55 PM, Joe Armstrong wrote: > Now why would anybody want to put 20 byte binaries in a hash table and find the K nearest hits :-) > > Distributed Hash Table rings ;) In this case, k-bucket is the right data structure to keep nodes. > > -- > J. > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions -------------- next part -------------- An HTML attachment was scrubbed... URL: From donpedrothird@REDACTED Tue May 27 15:08:42 2014 From: donpedrothird@REDACTED (Evgeny M) Date: Tue, 27 May 2014 06:08:42 -0700 (PDT) Subject: [erlang-questions] finding the nearest key in a key-value table In-Reply-To: References: Message-ID: There's a library which could be used for this task with minor modifications https://github.com/brigadier/bisect/blob/master/src/bisect.erl have a look on the floor() function Just a standard binary search over large binary blob. If Key not found just step back the position from the last seek operation and copy the binary to the end. ???????, 27 ??? 2014 ?., 14:58:36 UTC+4 ???????????? Joe Armstrong ???????: > > > What's the best data structure to support a "nearest key" operation? > > I want a data structure that supports the following operations: > > new() -> NewTree > > insert(Key, Value, Tree) -> NewTree > > delete(Key, Tree) -> NewTree > > nearest(Key, N, Tree) -> [{Key1,Val1},{Key2,Val2} ...]. > > Keys are 20 byte binaries, values are 6 byte binaries > > The maximum number of keys of Key-Value pairs is 10 million. > > nearest(Key, N, Tree) returns the N nearest items to Key in the tree > > "near" means that the keys are near to each other. Often the key I want > will not > be in the tree, so I want nearby keys. The nearness measure is just the > "distance" between the two keys (ie the nearest N keys to the given key if > the keys were to > be sorted) > > Are there any Erlang libraries that do this? > > /Joe > -------------- next part -------------- An HTML attachment was scrubbed... URL: From erlang@REDACTED Tue May 27 15:12:34 2014 From: erlang@REDACTED (Joe Armstrong) Date: Tue, 27 May 2014 15:12:34 +0200 Subject: [erlang-questions] finding the nearest key in a key-value table In-Reply-To: <357359DF-966F-4681-9ACF-AFA00979F0DE@gmail.com> References: <53848796.5030601@cs.ntua.gr> <357359DF-966F-4681-9ACF-AFA00979F0DE@gmail.com> Message-ID: You mean K as in Kademlia ? - I thought about this In Kademlia K is 20 so we store 20 IPs per bit of a 160 bit sha1 hash ie 3200 IPs this takes 12.8KB When a bucket if full (in Kademlia) we throw away the least recently active entry in the bucket concerned- it seems to me that there is no reason to throw away anything until we have a really large number of machines. If there we 10M machine we'd need 40MB to store the IPs which is still << 1GB - in other words a DHT with 10M machines only needs a 40MB cache of IPs ... /Joe On Tue, May 27, 2014 at 3:00 PM, Dmitry Kolesnikov wrote: > > On 27 May 2014, at 15:56, Jesper Louis Andersen < > jesper.louis.andersen@REDACTED> wrote: > > > On Tue, May 27, 2014 at 2:55 PM, Joe Armstrong wrote: > >> Now why would anybody want to put 20 byte binaries in a hash table and >> find the K nearest hits :-) > > > Distributed Hash Table rings ;) > > > In this case, k-bucket is the right data structure to keep nodes. > > > > -- > J. > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From mononcqc@REDACTED Tue May 27 15:15:53 2014 From: mononcqc@REDACTED (Fred Hebert) Date: Tue, 27 May 2014 09:15:53 -0400 Subject: [erlang-questions] List comprehension question In-Reply-To: References: Message-ID: <20140527131552.GD13660@ferdair.local> On 05/22, Rich Neswold wrote: > On Thu, Jan 16, 2014 at 10:39 AM, Rich Neswold > wrote: > However, I can do this: > > [{{S, NC}, SF} || {S, C} <- Reqs, > {value, {NC, SF}} <- [gb_trees:lookup({S, C}, T)]] > > Wrap the function in a single element array and now you have a generator! > Now I can add more filters or more generators to it. > > I don't know how many people already use this trick, but I thought it might > of use to others. > > -- > Rich I used this form before in libraries like bertconf: https://github.com/ferd/bertconf/blob/master/src/bertconf_bert_loader.erl#L50-L52 https://github.com/ferd/bertconf/blob/master/src/bertconf_bert_loader.erl#L93-L94 My experience has been that it has caused more confusion in readers than anything, and I have since then tried to keep that stuff to the strict minimum usage possible. It's a neat trick, but tricks tend to surprise people. Regards, Fred. From rich.neswold@REDACTED Tue May 27 15:25:54 2014 From: rich.neswold@REDACTED (Rich Neswold) Date: Tue, 27 May 2014 08:25:54 -0500 Subject: [erlang-questions] List comprehension question In-Reply-To: <20140527131552.GD13660@ferdair.local> References: <20140527131552.GD13660@ferdair.local> Message-ID: On Tue, May 27, 2014 at 8:15 AM, Fred Hebert wrote: > On 05/22, Rich Neswold wrote: > > I don't know how many people already use this trick, but I thought it > might > > of use to others. > > I used this form before in libraries like bertconf: > > > https://github.com/ferd/bertconf/blob/master/src/bertconf_bert_loader.erl#L50-L52 > > https://github.com/ferd/bertconf/blob/master/src/bertconf_bert_loader.erl#L93-L94 > > My experience has been that it has caused more confusion in readers than > anything, and I have since then tried to keep that stuff to the strict > minimum usage possible. > > It's a neat trick, but tricks tend to surprise people. > I agree that tricky and "cute" code should be avoided. The example was illustrating the technique. My real-world code greatly simplified the number of lines, so I felt it was a win. Even your first example, if expanded, would require two case statements and some way to tie the resulting values back into the list. The comprehension is much cleaner. Thanks for the feedback and for your examples! -- Rich -------------- next part -------------- An HTML attachment was scrubbed... URL: From dmkolesnikov@REDACTED Tue May 27 15:26:37 2014 From: dmkolesnikov@REDACTED (Dmitry Kolesnikov) Date: Tue, 27 May 2014 16:26:37 +0300 Subject: [erlang-questions] finding the nearest key in a key-value table In-Reply-To: References: <53848796.5030601@cs.ntua.gr> <357359DF-966F-4681-9ACF-AFA00979F0DE@gmail.com> Message-ID: <1E061D8A-6C64-4ACC-AF46-3D7870449B4E@gmail.com> Yes, I mean k-buckets from Kademlia. From my perspective, a node eviction policy is an application specific task. I see reasons why 20 is chosen for Kademlia but any one can choose other eviction methods using memory limits or something else. I?ve used gb_trees + lists (using keyXXX methods) to implement k-bucket with k=20. The read/write access time was acceptable for me. However, some other data structure is required to implement it for scalable k. Maybe nested trees or dict / tree symbiosis. - Dmitry On 27 May 2014, at 16:12, Joe Armstrong wrote: > You mean K as in Kademlia ? - I thought about this > In Kademlia K is 20 so we store 20 IPs per bit of a 160 bit sha1 hash ie 3200 IPs this takes 12.8KB > > When a bucket if full (in Kademlia) we throw away the least recently active entry in the bucket concerned- it seems to me that > there is no reason to throw away anything until we have a really large number of machines. > > If there we 10M machine we'd need 40MB to store the IPs which is still << 1GB - in other words a DHT > with 10M machines only needs a 40MB cache of IPs ... > > /Joe > > > > On Tue, May 27, 2014 at 3:00 PM, Dmitry Kolesnikov wrote: > > On 27 May 2014, at 15:56, Jesper Louis Andersen wrote: > >> >> On Tue, May 27, 2014 at 2:55 PM, Joe Armstrong wrote: >> Now why would anybody want to put 20 byte binaries in a hash table and find the K nearest hits :-) >> >> Distributed Hash Table rings ;) > > In this case, k-bucket is the right data structure to keep nodes. > > >> >> -- >> J. >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://erlang.org/mailman/listinfo/erlang-questions > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From n.oxyde@REDACTED Tue May 27 15:28:32 2014 From: n.oxyde@REDACTED (Anthony Ramine) Date: Tue, 27 May 2014 15:28:32 +0200 Subject: [erlang-questions] List comprehension question In-Reply-To: References: <6197E56D-FEAF-4534-B78B-C915F06005AE@gmail.com> Message-ID: <9373A784-0857-4895-85C7-2BED9323BC32@gmail.com> The comprehension [ X || X <- List, true = foo(X) ] is currently valid and will crash if foo(X) doesn?t return true. Changing this would change the semantics of a certain class of filters, which are, albeit of dubious usefulness, nonetheless currently valid. -- Anthony Ramine Le 27 mai 2014 ? 13:35, Rich Neswold a ?crit : > How? > From n.oxyde@REDACTED Tue May 27 15:29:54 2014 From: n.oxyde@REDACTED (Anthony Ramine) Date: Tue, 27 May 2014 15:29:54 +0200 Subject: [erlang-questions] List comprehension question In-Reply-To: References: Message-ID: The compiler?s smartness is irrelevant here, any name not appearing in all clauses is unsafe. Even if the compiler could prove that the culprit clauses aren?t ever evaluated when linting, it would still report this as an error. -- Anthony Ramine Le 27 mai 2014 ? 13:40, Rich Neswold a ?crit : > Yes, the compiler isn't smart enough to realize the false case will prevent further evaluation. It's a false warning. > From n.oxyde@REDACTED Tue May 27 15:32:58 2014 From: n.oxyde@REDACTED (Anthony Ramine) Date: Tue, 27 May 2014 15:32:58 +0200 Subject: [erlang-questions] Dialyzer and opaque types In-Reply-To: References: Message-ID: I find the idea of unions involving opaque types highly confusing. -- Anthony Ramine Le 27 mai 2014 ? 14:54, Jan Chochol a ?crit : > -spec a(atom() | binary() | opq()) -> opq(). From erlang@REDACTED Tue May 27 15:37:33 2014 From: erlang@REDACTED (Joe Armstrong) Date: Tue, 27 May 2014 15:37:33 +0200 Subject: [erlang-questions] finding the nearest key in a key-value table In-Reply-To: <1E061D8A-6C64-4ACC-AF46-3D7870449B4E@gmail.com> References: <53848796.5030601@cs.ntua.gr> <357359DF-966F-4681-9ACF-AFA00979F0DE@gmail.com> <1E061D8A-6C64-4ACC-AF46-3D7870449B4E@gmail.com> Message-ID: I just tried a simple experiment I made a 1M table of random IP adresses. Assume we ask the 20 nearest machines where there 20 nearest machine are this is 20 RPCs and we put the results (400 of them) back in the table to update the table with 400 entries and find the twenty nearest in the table took 10ms with a very naive ordered_sets lookup. This is fast enough for now ... /Joe On Tue, May 27, 2014 at 3:26 PM, Dmitry Kolesnikov wrote: > Yes, I mean k-buckets from Kademlia. > From my perspective, a node eviction policy is an application specific > task. > I see reasons why 20 is chosen for Kademlia but any one can choose other > eviction methods using memory limits or something else. > > I?ve used gb_trees + lists (using keyXXX methods) to implement k-bucket > with k=20. > The read/write access time was acceptable for me. However, some other data > structure > is required to implement it for scalable k. Maybe nested trees or dict / > tree symbiosis. > > - Dmitry > > > > On 27 May 2014, at 16:12, Joe Armstrong wrote: > > You mean K as in Kademlia ? - I thought about this > In Kademlia K is 20 so we store 20 IPs per bit of a 160 bit sha1 hash ie > 3200 IPs this takes 12.8KB > > When a bucket if full (in Kademlia) we throw away the least recently > active entry in the bucket concerned- it seems to me that > there is no reason to throw away anything until we have a really large > number of machines. > > If there we 10M machine we'd need 40MB to store the IPs which is still << > 1GB - in other words a DHT > with 10M machines only needs a 40MB cache of IPs ... > > /Joe > > > > On Tue, May 27, 2014 at 3:00 PM, Dmitry Kolesnikov > wrote: > >> >> On 27 May 2014, at 15:56, Jesper Louis Andersen < >> jesper.louis.andersen@REDACTED> wrote: >> >> >> On Tue, May 27, 2014 at 2:55 PM, Joe Armstrong wrote: >> >>> Now why would anybody want to put 20 byte binaries in a hash table and >>> find the K nearest hits :-) >> >> >> Distributed Hash Table rings ;) >> >> >> In this case, k-bucket is the right data structure to keep nodes. >> >> >> >> -- >> J. >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://erlang.org/mailman/listinfo/erlang-questions >> >> >> > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From ransomr@REDACTED Tue May 27 15:38:41 2014 From: ransomr@REDACTED (Ransom Richardson) Date: Tue, 27 May 2014 13:38:41 +0000 Subject: [erlang-questions] [ANN] fprofx - fprof extended to include suspend and GC time In-Reply-To: <337C6155-6E4B-4CD8-8F69-EA2C35C8B88D@gmail.com> References: <1401122933337.65053@talko.com>, <337C6155-6E4B-4CD8-8F69-EA2C35C8B88D@gmail.com> Message-ID: <1401197921175.65808@talko.com> Yes, if the OTP team is interested. But there is a lot of documentation (including examples) that would need to be updated and I'm not sure when I'll have the time to get to that. Ransom ________________________________________ From: Anthony Ramine Sent: Tuesday, May 27, 2014 5:16 AM To: Ransom Richardson Cc: erlang-questions@REDACTED Subject: Re: [erlang-questions] [ANN] fprofx - fprof extended to include suspend and GC time Could you submit this as an OTP patch? -- Anthony Ramine Le 26 mai 2014 ? 18:48, Ransom Richardson a ?crit : > https://github.com/talko/fprofx > > I've extended fprof to include two additional columns - suspend time and GC time. I've found this very useful when profiling operations that involve multiple processes. fprofx also includes an updated version of erlgrind that works with the new output format and can remove suspend time. > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions From bchesneau@REDACTED Tue May 27 16:32:07 2014 From: bchesneau@REDACTED (Benoit Chesneau) Date: Tue, 27 May 2014 16:32:07 +0200 Subject: [erlang-questions] Fwd: Re: finding the nearest key in a key-value table In-Reply-To: References: Message-ID: ---------- Forwarded message ---------- From: "Benoit Chesneau" Date: May 27, 2014 4:31 PM Subject: Re: [erlang-questions] finding the nearest key in a key-value table To: "Dmitry Kolesnikov" Cc: On May 27, 2014 1:23 PM, "Dmitry Kolesnikov" wrote: > > Hello, > > r-tree / kd-tree might be use-full for you to handle ?nearest? lookup. > however, I am not aware of efficient implementation on Erlang. > here is an implementation of an rtree in erlang. not sure how much efficient it is but it works. > Another, the best possible ?available? option for your problem domain is sorted trees. > It gives you log N complexity. If the key distance is multi-dimentional then z-ordered > curve technique would help you to cluster ?nearby? keys. > > You might take a look into my modification of gb_trees that allows to execute range queries (via iterator). > https://github.com/fogfish/feta/blob/master/src/gbt.erl > > Therefore, nearest key lookup becomes a range lookup according criteria of your application. > > nearest(Key, N, Tree) -> > iterator_to_list( > gbt:range(key_to_range(Key, N), Tree) > ,[] > ). > > iterator_to_list(Iter0, Acc) -> > case gbt:iterator(Iter) of > none -> > lists:reverse(Acc); > {Key, Val, Iter} -> > iterator_to_list(Iter, [{Key, Val}|Acc]) > end. > > I?ve notice that 10M key might be large for Erlang data structures (e.g. I am trying to limit gb_trees to 1 - 2M in my apps) if you have many writes. Therefore, you might convert you lookup table to ets but same techniques is applicable to search nearest keys. > > Best Regards, > Dmitry > > > > On 27 May 2014, at 13:58, Joe Armstrong wrote: > > > > > What's the best data structure to support a "nearest key" operation? > > > > I want a data structure that supports the following operations: > > > > new() -> NewTree > > > > insert(Key, Value, Tree) -> NewTree > > > > delete(Key, Tree) -> NewTree > > > > nearest(Key, N, Tree) -> [{Key1,Val1},{Key2,Val2} ...]. > > > > Keys are 20 byte binaries, values are 6 byte binaries > > > > The maximum number of keys of Key-Value pairs is 10 million. > > > > nearest(Key, N, Tree) returns the N nearest items to Key in the tree > > > > "near" means that the keys are near to each other. Often the key I want will not > > be in the tree, so I want nearby keys. The nearness measure is just the > > "distance" between the two keys (ie the nearest N keys to the given key if the keys were to > > be sorted) > > > > Are there any Erlang libraries that do this? > > > > /Joe > > _______________________________________________ > > erlang-questions mailing list > > erlang-questions@REDACTED > > http://erlang.org/mailman/listinfo/erlang-questions > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions -------------- next part -------------- An HTML attachment was scrubbed... URL: From rtrlists@REDACTED Tue May 27 17:06:36 2014 From: rtrlists@REDACTED (Robert Raschke) Date: Tue, 27 May 2014 16:06:36 +0100 Subject: [erlang-questions] Problem of post the data with httpc In-Reply-To: References: Message-ID: Hi Solomon, I think you're just missing the Content-Length header. And for real work, you'll also want to pass in the Content-Type. Also, if I remember correctly, the parse_post function expects x-www-form-urlencoded data in the body, whereas recv_body just gives you whatever is there as a binary. Robby On May 27, 2014 11:05 AM, "Solomon" wrote: > Hi. > > When I use curl post the data to mochiweb like this: > > curl http://192.168.1.1 -d "hello" > > I could call Req:parse_post() to get the data like [{"hello",[]}], and > call Req:recv_body() to get the data like <<"hello">>. > > When I use httpc post the data to mochiweb like this: > > httpc:request(post, {"http://192.168.1..1", [], [], "hello"}, [], []) > > I could call Req:recv_body() to get the data like <<"hello">>, but when I > call Req:parse_post(), it return []. > > How should I post data with httpc like curl? > > Regards, > Solomon > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From tuncer.ayaz@REDACTED Tue May 27 19:03:43 2014 From: tuncer.ayaz@REDACTED (Tuncer Ayaz) Date: Tue, 27 May 2014 19:03:43 +0200 Subject: [erlang-questions] Should 17.0.2 advertise erts-6.0.1 or erts-6.0.2? Message-ID: Is it in line with the new versioning policy that both 17.0.1 and 17.0.2 advertise erts-6.0.1? Shouldn't 17.0.2 have erts-6.0.2? From sverker.eriksson@REDACTED Tue May 27 19:22:05 2014 From: sverker.eriksson@REDACTED (Sverker Eriksson) Date: Tue, 27 May 2014 19:22:05 +0200 Subject: [erlang-questions] Should 17.0.2 advertise erts-6.0.1 or erts-6.0.2? In-Reply-To: References: Message-ID: <5384C9BD.5030801@erix.ericsson.se> There is no strict one-to-one mapping between OTP and erts version numbers. OTP 17.0.2 contains no changes to erts and has therefore the same erts version as 17.0.1. /Sverker On 05/27/2014 07:03 PM, Tuncer Ayaz wrote: > Is it in line with the new versioning policy that both 17.0.1 and > 17.0.2 advertise erts-6.0.1? Shouldn't 17.0.2 have erts-6.0.2? > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > > From lukas@REDACTED Tue May 27 19:22:10 2014 From: lukas@REDACTED (Lukas Larsson) Date: Tue, 27 May 2014 19:22:10 +0200 Subject: [erlang-questions] Should 17.0.2 advertise erts-6.0.1 or erts-6.0.2? In-Reply-To: References: Message-ID: On Tue, May 27, 2014 at 7:03 PM, Tuncer Ayaz wrote: > Is it in line with the new versioning policy that both 17.0.1 and > 17.0.2 advertise erts-6.0.1? Shouldn't 17.0.2 have erts-6.0.2? > Application versions are only bumped when something is changed in them. In 17.0.2 there was no change to erts and thus that version number has not been bumped. Lukas -------------- next part -------------- An HTML attachment was scrubbed... URL: From tuncer.ayaz@REDACTED Tue May 27 19:26:09 2014 From: tuncer.ayaz@REDACTED (Tuncer Ayaz) Date: Tue, 27 May 2014 19:26:09 +0200 Subject: [erlang-questions] Should 17.0.2 advertise erts-6.0.1 or erts-6.0.2? In-Reply-To: <5384C9BD.5030801@erix.ericsson.se> References: <5384C9BD.5030801@erix.ericsson.se> Message-ID: On 5/27/14, Sverker Eriksson wrote: > There is no strict one-to-one mapping between OTP and erts version numbers. > > OTP 17.0.2 contains no changes to erts and has therefore the same erts > version as 17.0.1. Thanks, that makes sense. > On 05/27/2014 07:03 PM, Tuncer Ayaz wrote: > > Is it in line with the new versioning policy that both 17.0.1 and > > 17.0.2 advertise erts-6.0.1? Shouldn't 17.0.2 have erts-6.0.2? From tuncer.ayaz@REDACTED Tue May 27 19:30:03 2014 From: tuncer.ayaz@REDACTED (Tuncer Ayaz) Date: Tue, 27 May 2014 19:30:03 +0200 Subject: [erlang-questions] Should 17.0.2 advertise erts-6.0.1 or erts-6.0.2? In-Reply-To: References: Message-ID: On 5/27/14, Lukas Larsson wrote: > On Tue, May 27, 2014 at 7:03 PM, Tuncer Ayaz wrote: > > > Is it in line with the new versioning policy that both 17.0.1 and > > 17.0.2 advertise erts-6.0.1? Shouldn't 17.0.2 have erts-6.0.2? > > > > Application versions are only bumped when something is changed in > them. In 17.0.2 there was no change to erts and thus that version > number has not been bumped. It appears that I haven't fully memorized the new policy (yet) :). Releases like 17.0.2 weren't public in the past, so we didn't see a release that doesn't modify erts. Thanks for the explanation. From eriksoe@REDACTED Tue May 27 21:18:00 2014 From: eriksoe@REDACTED (=?UTF-8?Q?Erik_S=C3=B8e_S=C3=B8rensen?=) Date: Tue, 27 May 2014 21:18:00 +0200 Subject: [erlang-questions] List comprehension question In-Reply-To: <6197E56D-FEAF-4534-B78B-C915F06005AE@gmail.com> References: <6197E56D-FEAF-4534-B78B-C915F06005AE@gmail.com> Message-ID: Den 26/05/2014 13.02 skrev "Anthony Ramine" : > > That would change semantics of existing programs, no thanks. > > I do have plans to implement Pat ?= Expr filters, though, not reusing the matching operator ?=?. Sounds great - I never got past looking at the existing compiler code. What's your plan (if you have one)? As I remember it, an extension of Kernel Erlang is necessary... > > -- > Anthony Ramine > > Le 22 mai 2014 ? 21:44, Rich Neswold a ?crit : > > > It would be much nicer to use pattern matching and use the comprehension's ability to treat bad matches as a filter. But I can't replace the case statement above with: > > > > [{{S, NC}, SF} || {S, C} <- Reqs, > > {value, {NC, SF}} = gb_trees:lookup({S, C}, T)] > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions -------------- next part -------------- An HTML attachment was scrubbed... URL: From overminddl1@REDACTED Tue May 27 22:08:45 2014 From: overminddl1@REDACTED (OvermindDL1) Date: Tue, 27 May 2014 14:08:45 -0600 Subject: [erlang-questions] Fwd: Re: finding the nearest key in a key-value table In-Reply-To: References: Message-ID: On May 27, 2014 8:32 AM, "Benoit Chesneau" wrote: > > ---------- Forwarded message ---------- > From: "Benoit Chesneau" > Date: May 27, 2014 4:31 PM > Subject: Re: [erlang-questions] finding the nearest key in a key-value table > To: "Dmitry Kolesnikov" > Cc: > > > On May 27, 2014 1:23 PM, "Dmitry Kolesnikov" wrote: > > > > Hello, > > > > r-tree / kd-tree might be use-full for you to handle ?nearest? lookup. > > however, I am not aware of efficient implementation on Erlang. > > > > here is an implementation of an rtree in erlang. not sure how much efficient it is but it works. > > > Another, the best possible ?available? option for your problem domain is sorted trees. > > It gives you log N complexity. If the key distance is multi-dimentional then z-ordered > > curve technique would help you to cluster ?nearby? keys. > > > > You might take a look into my modification of gb_trees that allows to execute range queries (via iterator). > > https://github.com/fogfish/feta/blob/master/src/gbt.erl > > > > Therefore, nearest key lookup becomes a range lookup according criteria of your application. > > > > nearest(Key, N, Tree) -> > > iterator_to_list( > > gbt:range(key_to_range(Key, N), Tree) > > ,[] > > ). > > > > iterator_to_list(Iter0, Acc) -> > > case gbt:iterator(Iter) of > > none -> > > lists:reverse(Acc); > > {Key, Val, Iter} -> > > iterator_to_list(Iter, [{Key, Val}|Acc]) > > end. > > > > I?ve notice that 10M key might be large for Erlang data structures (e.g. I am trying to limit gb_trees to 1 - 2M in my apps) if you have many writes. Therefore, you might convert you lookup table to ets but same techniques is applicable to search nearest keys. > > > > Best Regards, > > Dmitry > > > > > > > > On 27 May 2014, at 13:58, Joe Armstrong wrote: > > > > > > > > What's the best data structure to support a "nearest key" operation? > > > > > > I want a data structure that supports the following operations: > > > > > > new() -> NewTree > > > > > > insert(Key, Value, Tree) -> NewTree > > > > > > delete(Key, Tree) -> NewTree > > > > > > nearest(Key, N, Tree) -> [{Key1,Val1},{Key2,Val2} ...]. > > > > > > Keys are 20 byte binaries, values are 6 byte binaries > > > > > > The maximum number of keys of Key-Value pairs is 10 million. > > > > > > nearest(Key, N, Tree) returns the N nearest items to Key in the tree > > > > > > "near" means that the keys are near to each other. Often the key I want will not > > > be in the tree, so I want nearby keys. The nearness measure is just the > > > "distance" between the two keys (ie the nearest N keys to the given key if the keys were to > > > be sorted) > > > > > > Are there any Erlang libraries that do this? > > > > > > /Joe > > > Unsure how efficient you could make it in erlang, pretty efficient I think, it sounds like what you want is a Patricia Trie. It by default gets the node you ask for or the nearest matching one with the longest prefix of whatever accuracy you wish, a minor change could just have it go down nearby existing nodes to get the nearest match instead of just the matching based on prefix, especially if you statically know the length of the binaries. _______________________________________________ > > > erlang-questions mailing list > > > erlang-questions@REDACTED > > > http://erlang.org/mailman/listinfo/erlang-questions > > > > _______________________________________________ > > erlang-questions mailing list > > erlang-questions@REDACTED > > http://erlang.org/mailman/listinfo/erlang-questions > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From n.oxyde@REDACTED Tue May 27 22:13:39 2014 From: n.oxyde@REDACTED (Anthony Ramine) Date: Tue, 27 May 2014 22:13:39 +0200 Subject: [erlang-questions] List comprehension question In-Reply-To: References: <6197E56D-FEAF-4534-B78B-C915F06005AE@gmail.com> Message-ID: No, I am talking about comprehensions? filters only. Comprehensions are compiled away in v3_core. I cleaned the code in 17.0 [1] so now adding new stuff is simpler, for example && generators [2]. [1] https://github.com/erlang/otp/pull/220 [2] https://github.com/nox/otp/commit/d063d60536c52a9405e19f0ad78780c480c14ebf#diff-1 -- Anthony Ramine Le 27 mai 2014 ? 21:18, Erik S?e S?rensen a ?crit : > Sounds great - I never got past looking at the existing compiler code. > What's your plan (if you have one)? > As I remember it, an extension of Kernel Erlang is necessary... From jay@REDACTED Wed May 28 02:47:06 2014 From: jay@REDACTED (Jay Nelson) Date: Tue, 27 May 2014 17:47:06 -0700 Subject: [erlang-questions] finding the nearest key in a key-value table Message-ID: <03FE5692-2D42-409B-9009-F6451BB0DECD@duomark.com> Evgeny wrote: > There's a library which could be used for this task with minor modifications > https://github.com/brigadier/bisect/blob/master/src/bisect.erl bisect allows only fixed length property names. Kresten did a variant that allows variable length property names at https://github.com/krestenkrab/vbisect The nice thing is that these put the dictionary in a single binary so it can be easily passed around and read concurrently, which is especially efficient on multicore machines because of the shared binary heap. Updates require producing a new binary and distributing it, so they are geared more towards read-many usage. jay From mjtruog@REDACTED Wed May 28 05:01:26 2014 From: mjtruog@REDACTED (Michael Truog) Date: Tue, 27 May 2014 20:01:26 -0700 Subject: [erlang-questions] Fwd: Re: finding the nearest key in a key-value table In-Reply-To: References: Message-ID: <53855186.80405@gmail.com> On 05/27/2014 01:08 PM, OvermindDL1 wrote: > > Unsure how efficient you could make it in erlang, pretty efficient I think, it sounds like what you want is a Patricia Trie. It by default gets the node you ask for or the nearest matching one with the longest prefix of whatever accuracy you wish, a minor change could just have it go down nearby existing nodes to get the nearest match instead of just the matching based on prefix, especially if you statically know the length of the binaries. > > ____________________________________ > Code for a patricia trie is here https://github.com/okeuday/trie . The source code is more efficient with string() (list of integer) usage, but the same code works with binaries with the separate btrie module (with macro magic). There isn't any nearest functions, but instead functions that match using a string pattern that contains "*" wildcard characters and functions that use a prefix to find similar keys. The nearest function shouldn't be hard to implement, if that was pursued. From qrilka@REDACTED Wed May 28 09:07:30 2014 From: qrilka@REDACTED (Kirill Zaborsky) Date: Wed, 28 May 2014 11:07:30 +0400 Subject: [erlang-questions] Hidden binaries Message-ID: Hello, I have recently found some memory "leak" in our application. Leak is in quotes because memory load seems to be constant under constant load. But the problem is that I see some extra binaries for which there are no signs in process_info. In production we use our fork of OTP16BR3-1 (including some number of httpc fixes) but it looks like that behaviour could be reproduced locally on my machine with OTP 17. I have tried to get any hints from recon but with not success. The problem could be seen from the following Erlang shell lines: ------------- (node@REDACTED)87> recon:bin_leak(20),erlang:memory(). [{total,30574120}, {processes,6765096}, {processes_used,6738520}, {system,23809024}, {atom,662409}, {atom_used,652067}, {binary,145760}, {code,16742599}, {ets,1037976}] (node@REDACTED)88> lists:sum([N||{P1,N,B}<-[{P,lists:sum([S||{_,S,_}<-B]),B} || {P,{binary,B}} <- [{Pid,(catch process_info(Pid,binary))} || Pid <- processes()]]]). 17671 (node@REDACTED)89> ------------- As you see erlang:memory/0 shows 146k of memory used by binaries but erlang:process_info/2 shows information only about 18k Is there any way I could find out where the missing 128k of memory is? Is it possible to get all binaries contents without gowing to some low-level tools like gdb (I'm not quite familiar with it yet)? Possibly there are some system-level binaries? In production I see not kilobytes but hunderds of megabytes and sometimes it leads even to OOM crashes. I run Gentoo on my desktop and in production we use Ubuntu Precise. Thanks for any advice. Best regards, Kirill Zaborsky -------------- next part -------------- An HTML attachment was scrubbed... URL: From lukas@REDACTED Wed May 28 10:26:41 2014 From: lukas@REDACTED (Lukas Larsson) Date: Wed, 28 May 2014 10:26:41 +0200 Subject: [erlang-questions] Hidden binaries In-Reply-To: References: Message-ID: Hello, Binaries can also be present in ets objects and messages in processes' message queues. I'm sure there are some other places as well, but those should be the major ones. I know of no easy way (with gdb or otherwise) to get information if this is the case. Lukas On Wed, May 28, 2014 at 9:07 AM, Kirill Zaborsky wrote: > Hello, > I have recently found some memory "leak" in our application. Leak is in > quotes because memory load seems to be constant under constant load. But > the problem is that I see some extra binaries for which there are no signs > in process_info. > In production we use our fork of OTP16BR3-1 (including some number of > httpc fixes) but it looks like that behaviour could be reproduced locally > on my machine with OTP 17. > I have tried to get any hints from recon but with not success. > The problem could be seen from the following Erlang shell lines: > ------------- > (node@REDACTED)87> recon:bin_leak(20),erlang:memory(). > [{total,30574120}, > {processes,6765096}, > {processes_used,6738520}, > {system,23809024}, > {atom,662409}, > {atom_used,652067}, > {binary,145760}, > {code,16742599}, > {ets,1037976}] > (node@REDACTED)88> > lists:sum([N||{P1,N,B}<-[{P,lists:sum([S||{_,S,_}<-B]),B} || {P,{binary,B}} > <- [{Pid,(catch process_info(Pid,binary))} || Pid <- processes()]]]). > 17671 > (node@REDACTED)89> > ------------- > As you see erlang:memory/0 shows 146k of memory used by binaries but > erlang:process_info/2 shows information only about 18k > Is there any way I could find out where the missing 128k of memory is? > Is it possible to get all binaries contents without gowing to some > low-level tools like gdb (I'm not quite familiar with it yet)? > Possibly there are some system-level binaries? > In production I see not kilobytes but hunderds of megabytes and sometimes > it leads even to OOM crashes. > I run Gentoo on my desktop and in production we use Ubuntu Precise. > Thanks for any advice. > > Best regards, > Kirill Zaborsky > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From rtrlists@REDACTED Wed May 28 11:16:06 2014 From: rtrlists@REDACTED (Robert Raschke) Date: Wed, 28 May 2014 10:16:06 +0100 Subject: [erlang-questions] Hidden binaries In-Reply-To: References: Message-ID: Hi Kirill, is there any chance you are using binary:split to smash a larger binary into pieces for further processing, thinking that the big thing will go away asap? If yes, then I can recommend reading https://blog.heroku.com/archives/2013/11/7/logplex-down-the-rabbit-hole , especially from section "I Just Keep On Bleeding and I Won't Die" onwards. Naive summary (reality is a bit more discerning :-) : when you have refs into a larger binary, the large binary won't get gc'ed, and you need to jump through some hoops to get rid of it. HTH, Robby On May 28, 2014 8:07 AM, "Kirill Zaborsky" wrote: > Hello, > I have recently found some memory "leak" in our application. Leak is in > quotes because memory load seems to be constant under constant load. But > the problem is that I see some extra binaries for which there are no signs > in process_info. > In production we use our fork of OTP16BR3-1 (including some number of > httpc fixes) but it looks like that behaviour could be reproduced locally > on my machine with OTP 17. > I have tried to get any hints from recon but with not success. > The problem could be seen from the following Erlang shell lines: > ------------- > (node@REDACTED)87> recon:bin_leak(20),erlang:memory(). > [{total,30574120}, > {processes,6765096}, > {processes_used,6738520}, > {system,23809024}, > {atom,662409}, > {atom_used,652067}, > {binary,145760}, > {code,16742599}, > {ets,1037976}] > (node@REDACTED)88> > lists:sum([N||{P1,N,B}<-[{P,lists:sum([S||{_,S,_}<-B]),B} || {P,{binary,B}} > <- [{Pid,(catch process_info(Pid,binary))} || Pid <- processes()]]]). > 17671 > (node@REDACTED)89> > ------------- > As you see erlang:memory/0 shows 146k of memory used by binaries but > erlang:process_info/2 shows information only about 18k > Is there any way I could find out where the missing 128k of memory is? > Is it possible to get all binaries contents without gowing to some > low-level tools like gdb (I'm not quite familiar with it yet)? > Possibly there are some system-level binaries? > In production I see not kilobytes but hunderds of megabytes and sometimes > it leads even to OOM crashes. > I run Gentoo on my desktop and in production we use Ubuntu Precise. > Thanks for any advice. > > Best regards, > Kirill Zaborsky > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jesper.louis.andersen@REDACTED Wed May 28 11:17:03 2014 From: jesper.louis.andersen@REDACTED (Jesper Louis Andersen) Date: Wed, 28 May 2014 11:17:03 +0200 Subject: [erlang-questions] Hidden binaries In-Reply-To: References: Message-ID: On Wed, May 28, 2014 at 10:26 AM, Lukas Larsson wrote: > Binaries can also be present in ets objects and messages in processes' > message queues. I'm sure there are some other places as well, but those > should be the major ones. This is a common case. Say you have a binary of size 1024 bytes and you pick out an identifier in it which is 8 bytes. The identifier is now a sub-binary which keeps the large binary around. If you stick the identifier somewhere, you will be "wasting" 1024-8 bytes. The solution is to explicitly put a binary:copy/1 in place to "lift out" the small identifier. -- J. -------------- next part -------------- An HTML attachment was scrubbed... URL: From essen@REDACTED Wed May 28 11:40:07 2014 From: essen@REDACTED (=?UTF-8?B?TG/Dr2MgSG9ndWlu?=) Date: Wed, 28 May 2014 11:40:07 +0200 Subject: [erlang-questions] Hidden binaries In-Reply-To: References: Message-ID: <5385AEF7.6020601@ninenines.eu> On 05/28/2014 11:17 AM, Jesper Louis Andersen wrote: > > On Wed, May 28, 2014 at 10:26 AM, Lukas Larsson > > wrote: > > Binaries can also be present in ets objects and messages in > processes' message queues. I'm sure there are some other places as > well, but those should be the major ones. > > > This is a common case. Say you have a binary of size 1024 bytes and you > pick out an identifier in it which is 8 bytes. The identifier is now a > sub-binary which keeps the large binary around. If you stick the > identifier somewhere, you will be "wasting" 1024-8 bytes. Actually, and correct me if I'm wrong, but the sub binary optimization breaks when you stick the identifier somewhere, so it ends up being copied automatically. -- Lo?c Hoguin http://ninenines.eu From jesper.louis.andersen@REDACTED Wed May 28 11:42:02 2014 From: jesper.louis.andersen@REDACTED (Jesper Louis Andersen) Date: Wed, 28 May 2014 11:42:02 +0200 Subject: [erlang-questions] Hidden binaries In-Reply-To: <5385AEF7.6020601@ninenines.eu> References: <5385AEF7.6020601@ninenines.eu> Message-ID: On Wed, May 28, 2014 at 11:40 AM, Lo?c Hoguin wrote: > Actually, and correct me if I'm wrong, but the sub binary optimization > breaks when you stick the identifier somewhere, so it ends up being copied > automatically. This happens if you send the binary in a message to another process. But AFAIK it won't happen if storing the binary in ETS. -- J. -------------- next part -------------- An HTML attachment was scrubbed... URL: From qrilka@REDACTED Wed May 28 11:56:02 2014 From: qrilka@REDACTED (Kirill Zaborsky) Date: Wed, 28 May 2014 13:56:02 +0400 Subject: [erlang-questions] Hidden binaries In-Reply-To: References: Message-ID: Thanks a lot, Lukas. I was suspecting something like that but forgot to check it somehow. It looks you are right here and problem seems to be in ssl_otp_session_cache table - we started do a lot of ssl requests. Regards, Kirill. 2014-05-28 12:26 GMT+04:00 Lukas Larsson : > Hello, > > Binaries can also be present in ets objects and messages in processes' > message queues. I'm sure there are some other places as well, but those > should be the major ones. > > I know of no easy way (with gdb or otherwise) to get information if this > is the case. > > Lukas > On Wed, May 28, 2014 at 9:07 AM, Kirill Zaborsky wrote: > >> Hello, >> I have recently found some memory "leak" in our application. Leak is in >> quotes because memory load seems to be constant under constant load. But >> the problem is that I see some extra binaries for which there are no signs >> in process_info. >> In production we use our fork of OTP16BR3-1 (including some number of >> httpc fixes) but it looks like that behaviour could be reproduced locally >> on my machine with OTP 17. >> I have tried to get any hints from recon but with not success. >> The problem could be seen from the following Erlang shell lines: >> ------------- >> (node@REDACTED)87> recon:bin_leak(20),erlang:memory(). >> [{total,30574120}, >> {processes,6765096}, >> {processes_used,6738520}, >> {system,23809024}, >> {atom,662409}, >> {atom_used,652067}, >> {binary,145760}, >> {code,16742599}, >> {ets,1037976}] >> (node@REDACTED)88> >> lists:sum([N||{P1,N,B}<-[{P,lists:sum([S||{_,S,_}<-B]),B} || {P,{binary,B}} >> <- [{Pid,(catch process_info(Pid,binary))} || Pid <- processes()]]]). >> 17671 >> (node@REDACTED)89> >> ------------- >> As you see erlang:memory/0 shows 146k of memory used by binaries but >> erlang:process_info/2 shows information only about 18k >> Is there any way I could find out where the missing 128k of memory is? >> Is it possible to get all binaries contents without gowing to some >> low-level tools like gdb (I'm not quite familiar with it yet)? >> Possibly there are some system-level binaries? >> In production I see not kilobytes but hunderds of megabytes and sometimes >> it leads even to OOM crashes. >> I run Gentoo on my desktop and in production we use Ubuntu Precise. >> Thanks for any advice. >> >> Best regards, >> Kirill Zaborsky >> >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://erlang.org/mailman/listinfo/erlang-questions >> >> > -------------- next part -------------- An HTML attachment was scrubbed... URL: From bjorn@REDACTED Wed May 28 12:35:38 2014 From: bjorn@REDACTED (=?UTF-8?Q?Bj=C3=B6rn_Gustavsson?=) Date: Wed, 28 May 2014 12:35:38 +0200 Subject: [erlang-questions] Hidden binaries In-Reply-To: References: <5385AEF7.6020601@ninenines.eu> Message-ID: On Wed, May 28, 2014 at 11:42 AM, Jesper Louis Andersen wrote: > > On Wed, May 28, 2014 at 11:40 AM, Lo?c Hoguin wrote: >> >> Actually, and correct me if I'm wrong, but the sub binary optimization >> breaks when you stick the identifier somewhere, so it ends up being copied >> automatically. > > > This happens if you send the binary in a message to another process. But > AFAIK it won't happen if storing the binary in ETS. > I think there is some confusion about here about the different binary optimizations. Sub-binaries are created when a binary is matched using bit syntax or split_binary/2. There will never be any automatic conversion from a sub binary to a copy of binary data referenced by the sub-binary. There is an compiler-based optimization that will delay creation of a sub-binary to optimize loops that do binary matching. Instead of creating a new sub-binary for every iteration of the loop, the internal match state structure used for binary matching is kept in the loop. As soon as the loop is exited, the match state will be converted to a real sub-binary. There is another optimization when appending to binaries. When a binary is appended to, i.e. if you write <> it is assumed that the program will append to the resulting binary again and will therefore allocate empty space at the end of the binary. If the binary is sent to another process or stored in an ETS table, the extra space is deallocated and the binary is no longer marked as appendable. That optimization is done entirely in the run-time system. /Bjorn -- Bj?rn Gustavsson, Erlang/OTP, Ericsson AB From lists@REDACTED Wed May 28 17:15:49 2014 From: lists@REDACTED (Camille Troillard) Date: Wed, 28 May 2014 17:15:49 +0200 Subject: [erlang-questions] gproc:monitor(Key, follow) Message-ID: <26E61099-5F16-4C45-90AE-5F8F3F90794C@tuli.pe> Hello, I would like to take action when a name gets registered under gproc. I understood I could call gproc:monitor(Key, follow) during initialization but my process does not get notified of the name availability. Therefore I had to replace that call to gproc:nb_wait, and then monitor the process in the callback handler. I wish I could follow the former approach. Can someone explain the usage pattern of gproc:monitor(_, follow)? I am trying to understand why this would not work. Thanks! Camille From rvirding@REDACTED Wed May 28 17:38:46 2014 From: rvirding@REDACTED (Robert Virding) Date: Wed, 28 May 2014 17:38:46 +0200 Subject: [erlang-questions] List comprehension question In-Reply-To: References: <6197E56D-FEAF-4534-B78B-C915F06005AE@gmail.com> Message-ID: If you can add ?= to comprehensions then it should be a small step to adding it to cond. Nudge nudge. Wink wink. :-) Robert On 27 May 2014 22:13, Anthony Ramine wrote: > No, I am talking about comprehensions? filters only. Comprehensions are > compiled away in v3_core. > > I cleaned the code in 17.0 [1] so now adding new stuff is simpler, for > example && generators [2]. > > [1] https://github.com/erlang/otp/pull/220 > [2] > https://github.com/nox/otp/commit/d063d60536c52a9405e19f0ad78780c480c14ebf#diff-1 > > -- > Anthony Ramine > > Le 27 mai 2014 ? 21:18, Erik S?e S?rensen a ?crit : > > > Sounds great - I never got past looking at the existing compiler code. > > What's your plan (if you have one)? > > As I remember it, an extension of Kernel Erlang is necessary... > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From n.oxyde@REDACTED Wed May 28 18:39:50 2014 From: n.oxyde@REDACTED (Anthony Ramine) Date: Wed, 28 May 2014 18:39:50 +0200 Subject: [erlang-questions] List comprehension question In-Reply-To: References: <6197E56D-FEAF-4534-B78B-C915F06005AE@gmail.com> Message-ID: Cond would need to be finished before adding ?= to them. :) https://github.com/nox/otp/commit/da6fdc77ba347aba770df7c533010eb23c483bd8 -- Anthony Ramine Le 28 mai 2014 ? 17:38, Robert Virding a ?crit : > If you can add ?= to comprehensions then it should be a small step to adding it to cond. Nudge nudge. Wink wink. :-) > > Robert > > > > On 27 May 2014 22:13, Anthony Ramine wrote: > No, I am talking about comprehensions? filters only. Comprehensions are compiled away in v3_core. > > I cleaned the code in 17.0 [1] so now adding new stuff is simpler, for example && generators [2]. > > [1] https://github.com/erlang/otp/pull/220 > [2] https://github.com/nox/otp/commit/d063d60536c52a9405e19f0ad78780c480c14ebf#diff-1 > > -- > Anthony Ramine > > Le 27 mai 2014 ? 21:18, Erik S?e S?rensen a ?crit : > > > Sounds great - I never got past looking at the existing compiler code. > > What's your plan (if you have one)? > > As I remember it, an extension of Kernel Erlang is necessary... > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > From lists@REDACTED Wed May 28 18:04:16 2014 From: lists@REDACTED (Camille Troillard) Date: Wed, 28 May 2014 18:04:16 +0200 Subject: [erlang-questions] gproc:monitor(Key, follow) In-Reply-To: <26E61099-5F16-4C45-90AE-5F8F3F90794C@tuli.pe> References: <26E61099-5F16-4C45-90AE-5F8F3F90794C@tuli.pe> Message-ID: OK, so it seems gproc:monitor(Key, follow) works, however if the name is already registered the message {gproc, registered, Ref, Key} is not sent. I would have expected the message to be sent since {gproc, unreg, Ref, Key} is sent when the name is not registered. Is this a bug? On 28 May 2014, at 17:15, Camille Troillard wrote: > Hello, > > I would like to take action when a name gets registered under gproc. > > I understood I could call gproc:monitor(Key, follow) during initialization but my process does not get notified of the name availability. Therefore I had to replace that call to gproc:nb_wait, and then monitor the process in the callback handler. I wish I could follow the former approach. > > Can someone explain the usage pattern of gproc:monitor(_, follow)? > I am trying to understand why this would not work. > Thanks! > > Camille > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions From daniel.goertzen@REDACTED Wed May 28 21:19:11 2014 From: daniel.goertzen@REDACTED (Daniel Goertzen) Date: Wed, 28 May 2014 14:19:11 -0500 Subject: [erlang-questions] dirty nif and enif_make_badarg() Message-ID: I am trying to write a dirty nif and am following the directions from http://www.erlang.org/doc/man/erl_nif.html Exceprt: "A dirty NIF may not invoke the enif_make_badargto raise an exception. If it wishes to return an exception, the dirty NIF should pass a regular result indicating the exception details to its finalizer, and allow the finalizer to raise the exception on its behalf." So I am doing this; here is my finalizer.... // cached atoms ERL_NIF_TERM badarg; static ERL_NIF_TERM badarg_finalizer(ErlNifEnv* env, ERL_NIF_TERM term) { if(term == badarg) return enif_make_badarg(env); else return term; } ... and I end up with the exception context of the finalizer and not the nif as desired... 5> generate_rsa:generate_rsa_key(abc, 65537). entering generate_rsa_key_nif entering generate_rsa_key_nif_dirty entering badarg_finalizer ** exception error: bad argument in function generate_rsa:generate_rsa_key_nif/2 called as generate_rsa:generate_rsa_key_nif(badarg,18446744072346624528) *!!! should be (abc,65537)* in call from generate_rsa:generate_rsa_key/2 (src/generate_rsa.erl, line 25) The documentation implies I can provide the "exception details", but enif_make_badarg() doesn't offer any extra parameters. Is there some other way to set the "exception details"? Thanks, Dan. -------------- next part -------------- An HTML attachment was scrubbed... URL: From vinoski@REDACTED Wed May 28 21:46:57 2014 From: vinoski@REDACTED (Steve Vinoski) Date: Wed, 28 May 2014 15:46:57 -0400 Subject: [erlang-questions] dirty nif and enif_make_badarg() In-Reply-To: References: Message-ID: On Wed, May 28, 2014 at 3:19 PM, Daniel Goertzen wrote: > I am trying to write a dirty nif and am following the directions from > http://www.erlang.org/doc/man/erl_nif.html > > Exceprt: > "A dirty NIF may not invoke the enif_make_badargto raise an exception. If it wishes to return an exception, the dirty NIF > should pass a regular result indicating the exception details to its > finalizer, and allow the finalizer to raise the exception on its behalf." > > So I am doing this; here is my finalizer.... > > > // cached atoms > ERL_NIF_TERM badarg; > > static ERL_NIF_TERM badarg_finalizer(ErlNifEnv* env, ERL_NIF_TERM term) > { > if(term == badarg) > return enif_make_badarg(env); > else > return term; > } > > ... and I end up with the exception context of the finalizer and not the > nif as desired... > > > 5> generate_rsa:generate_rsa_key(abc, 65537). > entering generate_rsa_key_nif > entering generate_rsa_key_nif_dirty > entering > badarg_finalizer > > ** exception error: bad argument > in function generate_rsa:generate_rsa_key_nif/2 > called as > generate_rsa:generate_rsa_key_nif(badarg,18446744072346624528) *!!! > should be (abc,65537)* > in call from generate_rsa:generate_rsa_key/2 (src/generate_rsa.erl, > line 25) > > > The documentation implies I can provide the "exception details", but > enif_make_badarg() doesn't offer any extra parameters. Is there some other > way to set the "exception details"? > "Exception details" here is just general, meaning whatever kinds of error information you want the finalizer to return. A NIF can raise only badarg via enif_make_badarg(), and there's no way for it to control any parameters associated with the exception. You might instead consider wrapping the NIF function with an actual Erlang function in your module, treating the NIF like an internal (non-exported) function, having the finalizer return an error tuple containing relevant information, and letting Erlang raise an exception based on that info. --steve -------------- next part -------------- An HTML attachment was scrubbed... URL: From daniel.goertzen@REDACTED Wed May 28 22:51:30 2014 From: daniel.goertzen@REDACTED (Daniel Goertzen) Date: Wed, 28 May 2014 15:51:30 -0500 Subject: [erlang-questions] dirty nif and enif_make_badarg() In-Reply-To: References: Message-ID: Thanks, that's what I will do then. PS, the dirty schedulers are working very well for me. I ran a cpu-bound nif that took about an hour, and the rest of the Erlang system just kept on ticking. On Wed, May 28, 2014 at 2:46 PM, Steve Vinoski wrote: > > > > On Wed, May 28, 2014 at 3:19 PM, Daniel Goertzen < > daniel.goertzen@REDACTED> wrote: > >> I am trying to write a dirty nif and am following the directions from >> http://www.erlang.org/doc/man/erl_nif.html >> >> Exceprt: >> "A dirty NIF may not invoke the enif_make_badargto raise an exception. If it wishes to return an exception, the dirty NIF >> should pass a regular result indicating the exception details to its >> finalizer, and allow the finalizer to raise the exception on its behalf." >> >> So I am doing this; here is my finalizer.... >> >> >> // cached atoms >> ERL_NIF_TERM badarg; >> >> static ERL_NIF_TERM badarg_finalizer(ErlNifEnv* env, ERL_NIF_TERM term) >> { >> if(term == badarg) >> return enif_make_badarg(env); >> else >> return term; >> } >> >> ... and I end up with the exception context of the finalizer and not the >> nif as desired... >> >> >> 5> generate_rsa:generate_rsa_key(abc, 65537). >> entering generate_rsa_key_nif >> entering generate_rsa_key_nif_dirty >> entering >> badarg_finalizer >> >> ** exception error: bad argument >> in function generate_rsa:generate_rsa_key_nif/2 >> called as >> generate_rsa:generate_rsa_key_nif(badarg,18446744072346624528) *!!! >> should be (abc,65537)* >> in call from generate_rsa:generate_rsa_key/2 (src/generate_rsa.erl, >> line 25) >> >> >> The documentation implies I can provide the "exception details", but >> enif_make_badarg() doesn't offer any extra parameters. Is there some other >> way to set the "exception details"? >> > > "Exception details" here is just general, meaning whatever kinds of error > information you want the finalizer to return. A NIF can raise only badarg > via enif_make_badarg(), and there's no way for it to control any parameters > associated with the exception. You might instead consider wrapping the NIF > function with an actual Erlang function in your module, treating the NIF > like an internal (non-exported) function, having the finalizer return an > error tuple containing relevant information, and letting Erlang raise an > exception based on that info. > > --steve > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jesper.louis.andersen@REDACTED Wed May 28 23:19:20 2014 From: jesper.louis.andersen@REDACTED (Jesper Louis Andersen) Date: Wed, 28 May 2014 23:19:20 +0200 Subject: [erlang-questions] dirty nif and enif_make_badarg() In-Reply-To: References: Message-ID: In some of the code I've written, I opted to check for bad arguments before scheduling the job on the dirty scheduler. This means that you don't move the call to the dirty scheduler unless you know it will run. But I like Steve's suggestion to check as much as possible in the Erlang VM as well. On Wed, May 28, 2014 at 10:51 PM, Daniel Goertzen wrote: > Thanks, that's what I will do then. > > PS, the dirty schedulers are working very well for me. I ran a cpu-bound > nif that took about an hour, and the rest of the Erlang system just kept on > ticking. > > > On Wed, May 28, 2014 at 2:46 PM, Steve Vinoski wrote: > >> >> >> >> On Wed, May 28, 2014 at 3:19 PM, Daniel Goertzen < >> daniel.goertzen@REDACTED> wrote: >> >>> I am trying to write a dirty nif and am following the directions from >>> http://www.erlang.org/doc/man/erl_nif.html >>> >>> Exceprt: >>> "A dirty NIF may not invoke the enif_make_badargto raise an exception. If it wishes to return an exception, the dirty NIF >>> should pass a regular result indicating the exception details to its >>> finalizer, and allow the finalizer to raise the exception on its behalf." >>> >>> So I am doing this; here is my finalizer.... >>> >>> >>> // cached atoms >>> ERL_NIF_TERM badarg; >>> >>> static ERL_NIF_TERM badarg_finalizer(ErlNifEnv* env, ERL_NIF_TERM term) >>> { >>> if(term == badarg) >>> return enif_make_badarg(env); >>> else >>> return term; >>> } >>> >>> ... and I end up with the exception context of the finalizer and not the >>> nif as desired... >>> >>> >>> 5> generate_rsa:generate_rsa_key(abc, 65537). >>> entering generate_rsa_key_nif >>> entering generate_rsa_key_nif_dirty >>> entering >>> badarg_finalizer >>> >>> ** exception error: bad argument >>> in function generate_rsa:generate_rsa_key_nif/2 >>> called as >>> generate_rsa:generate_rsa_key_nif(badarg,18446744072346624528) *!!! >>> should be (abc,65537)* >>> in call from generate_rsa:generate_rsa_key/2 (src/generate_rsa.erl, >>> line 25) >>> >>> >>> The documentation implies I can provide the "exception details", but >>> enif_make_badarg() doesn't offer any extra parameters. Is there some other >>> way to set the "exception details"? >>> >> >> "Exception details" here is just general, meaning whatever kinds of error >> information you want the finalizer to return. A NIF can raise only badarg >> via enif_make_badarg(), and there's no way for it to control any parameters >> associated with the exception. You might instead consider wrapping the NIF >> function with an actual Erlang function in your module, treating the NIF >> like an internal (non-exported) function, having the finalizer return an >> error tuple containing relevant information, and letting Erlang raise an >> exception based on that info. >> >> --steve >> > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > > -- J. -------------- next part -------------- An HTML attachment was scrubbed... URL: From ulf@REDACTED Thu May 29 10:33:51 2014 From: ulf@REDACTED (Ulf Wiger) Date: Thu, 29 May 2014 10:33:51 +0200 Subject: [erlang-questions] gproc:monitor(Key, follow) In-Reply-To: References: <26E61099-5F16-4C45-90AE-5F8F3F90794C@tuli.pe> Message-ID: In this sense, gproc:monitor/2 works like erlang:monitor/2, which also stays silent if the object is alive and well. Perhaps the easiest thing to do is to simply look up the name right after calling monitor()? BR, Ulf W 2014-05-28 18:04 GMT+02:00 Camille Troillard : > OK, so it seems gproc:monitor(Key, follow) works, however if the name is > already registered the message {gproc, registered, Ref, Key} is not sent. I > would have expected the message to be sent since {gproc, unreg, Ref, Key} > is sent when the name is not registered. Is this a bug? > > > On 28 May 2014, at 17:15, Camille Troillard wrote: > > > Hello, > > > > I would like to take action when a name gets registered under gproc. > > > > I understood I could call gproc:monitor(Key, follow) during > initialization but my process does not get notified of the name > availability. Therefore I had to replace that call to gproc:nb_wait, and > then monitor the process in the callback handler. I wish I could follow the > former approach. > > > > Can someone explain the usage pattern of gproc:monitor(_, follow)? > > I am trying to understand why this would not work. > > Thanks! > > > > Camille > > _______________________________________________ > > erlang-questions mailing list > > erlang-questions@REDACTED > > http://erlang.org/mailman/listinfo/erlang-questions > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From lists@REDACTED Thu May 29 14:09:27 2014 From: lists@REDACTED (Camille Troillard) Date: Thu, 29 May 2014 14:09:27 +0200 Subject: [erlang-questions] gproc:monitor(Key, follow) In-Reply-To: References: <26E61099-5F16-4C45-90AE-5F8F3F90794C@tuli.pe> Message-ID: Hello Ulf, On 29 May 2014, at 10:33, Ulf Wiger wrote: > In this sense, gproc:monitor/2 works like erlang:monitor/2, which also stays silent if the object is alive and well. That makes sense. > Perhaps the easiest thing to do is to simply look up the name right after calling monitor()? Yes I could do that, though I wished I only had a single place where I act on the registration notifications. So I could use nb_wait, but there is a small discrepancy where its callback signature {gproc, Ref, registered, {Key, Pid, Value}} is not the same as the one of monitor {gproc, registered, Ref, Key}. Maybe there was a good reason for this, unfortunately this prevents me from having a unified notification of a process coming up. Thank you. Cam > 2014-05-28 18:04 GMT+02:00 Camille Troillard : > OK, so it seems gproc:monitor(Key, follow) works, however if the name is already registered the message {gproc, registered, Ref, Key} is not sent. I would have expected the message to be sent since {gproc, unreg, Ref, Key} is sent when the name is not registered. Is this a bug? > > > On 28 May 2014, at 17:15, Camille Troillard wrote: > > > Hello, > > > > I would like to take action when a name gets registered under gproc. > > > > I understood I could call gproc:monitor(Key, follow) during initialization but my process does not get notified of the name availability. Therefore I had to replace that call to gproc:nb_wait, and then monitor the process in the callback handler. I wish I could follow the former approach. > > > > Can someone explain the usage pattern of gproc:monitor(_, follow)? > > I am trying to understand why this would not work. > > Thanks! > > > > Camille > > _______________________________________________ > > erlang-questions mailing list > > erlang-questions@REDACTED > > http://erlang.org/mailman/listinfo/erlang-questions > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From ulf@REDACTED Thu May 29 15:32:53 2014 From: ulf@REDACTED (Ulf Wiger) Date: Thu, 29 May 2014 15:32:53 +0200 Subject: [erlang-questions] gproc:monitor(Key, follow) In-Reply-To: References: <26E61099-5F16-4C45-90AE-5F8F3F90794C@tuli.pe> Message-ID: Have you looked at gproc_monitor:subscribe/1. Supposedly it does what you want. BR, Ulf W On 29 May 2014, at 14:09, Camille Troillard wrote: > Hello Ulf, > > > On 29 May 2014, at 10:33, Ulf Wiger wrote: > >> In this sense, gproc:monitor/2 works like erlang:monitor/2, which also stays silent if the object is alive and well. > > That makes sense. > > >> Perhaps the easiest thing to do is to simply look up the name right after calling monitor()? > > Yes I could do that, though I wished I only had a single place where I act on the registration notifications. > > So I could use nb_wait, but there is a small discrepancy where its callback signature {gproc, Ref, registered, {Key, Pid, Value}} is not the same as the one of monitor {gproc, registered, Ref, Key}. Maybe there was a good reason for this, unfortunately this prevents me from having a unified notification of a process coming up. > > > Thank you. > Cam > > >> 2014-05-28 18:04 GMT+02:00 Camille Troillard : >> OK, so it seems gproc:monitor(Key, follow) works, however if the name is already registered the message {gproc, registered, Ref, Key} is not sent. I would have expected the message to be sent since {gproc, unreg, Ref, Key} is sent when the name is not registered. Is this a bug? >> >> >> On 28 May 2014, at 17:15, Camille Troillard wrote: >> >> > Hello, >> > >> > I would like to take action when a name gets registered under gproc. >> > >> > I understood I could call gproc:monitor(Key, follow) during initialization but my process does not get notified of the name availability. Therefore I had to replace that call to gproc:nb_wait, and then monitor the process in the callback handler. I wish I could follow the former approach. >> > >> > Can someone explain the usage pattern of gproc:monitor(_, follow)? >> > I am trying to understand why this would not work. >> > Thanks! >> > >> > Camille >> > _______________________________________________ >> > erlang-questions mailing list >> > erlang-questions@REDACTED >> > http://erlang.org/mailman/listinfo/erlang-questions >> >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://erlang.org/mailman/listinfo/erlang-questions >> > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions -------------- next part -------------- An HTML attachment was scrubbed... URL: From lists@REDACTED Thu May 29 15:50:28 2014 From: lists@REDACTED (Camille Troillard) Date: Thu, 29 May 2014 15:50:28 +0200 Subject: [erlang-questions] gproc:monitor(Key, follow) In-Reply-To: References: <26E61099-5F16-4C45-90AE-5F8F3F90794C@tuli.pe> Message-ID: On 29 May 2014, at 15:32, Ulf Wiger wrote: > Have you looked at gproc_monitor:subscribe/1. Supposedly it does what you want. Ahhh, beautiful this is exactly what I need. Read the fine documentation they say... Thanks Ulf. Cam > On 29 May 2014, at 14:09, Camille Troillard wrote: > >> Hello Ulf, >> >> >> On 29 May 2014, at 10:33, Ulf Wiger wrote: >> >>> In this sense, gproc:monitor/2 works like erlang:monitor/2, which also stays silent if the object is alive and well. >> >> That makes sense. >> >> >>> Perhaps the easiest thing to do is to simply look up the name right after calling monitor()? >> >> Yes I could do that, though I wished I only had a single place where I act on the registration notifications. >> >> So I could use nb_wait, but there is a small discrepancy where its callback signature {gproc, Ref, registered, {Key, Pid, Value}} is not the same as the one of monitor {gproc, registered, Ref, Key}. Maybe there was a good reason for this, unfortunately this prevents me from having a unified notification of a process coming up. >> >> >> Thank you. >> Cam >> >> >>> 2014-05-28 18:04 GMT+02:00 Camille Troillard : >>> OK, so it seems gproc:monitor(Key, follow) works, however if the name is already registered the message {gproc, registered, Ref, Key} is not sent. I would have expected the message to be sent since {gproc, unreg, Ref, Key} is sent when the name is not registered. Is this a bug? >>> >>> >>> On 28 May 2014, at 17:15, Camille Troillard wrote: >>> >>> > Hello, >>> > >>> > I would like to take action when a name gets registered under gproc. >>> > >>> > I understood I could call gproc:monitor(Key, follow) during initialization but my process does not get notified of the name availability. Therefore I had to replace that call to gproc:nb_wait, and then monitor the process in the callback handler. I wish I could follow the former approach. >>> > >>> > Can someone explain the usage pattern of gproc:monitor(_, follow)? >>> > I am trying to understand why this would not work. >>> > Thanks! >>> > >>> > Camille >>> > _______________________________________________ >>> > erlang-questions mailing list >>> > erlang-questions@REDACTED >>> > http://erlang.org/mailman/listinfo/erlang-questions >>> >>> _______________________________________________ >>> erlang-questions mailing list >>> erlang-questions@REDACTED >>> http://erlang.org/mailman/listinfo/erlang-questions >>> >> >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From ivan@REDACTED Thu May 29 16:07:01 2014 From: ivan@REDACTED (Ivan Uemlianin) Date: Thu, 29 May 2014 15:07:01 +0100 Subject: [erlang-questions] What does Prompt in io:get_line/2 do? Message-ID: <53873F05.6080608@llaisdy.com> Dear All Quick question! In io:get_line(IoDevice, Prompt), what is the point of Prompt? Just using a random atom seems to work fine. 1> {ok,F} = file:open("data.txt",[read, {encoding, utf8}]). {ok,<0.36.0>} 2> io:get_line(F, x). "first line\n" 3> io:get_line(F, y). "second line\n" % ... etc Thanks Ivan -- ============================================================ Ivan A. Uemlianin PhD Llaisdy Speech Technology Research and Development ivan@REDACTED www.llaisdy.com llaisdy.wordpress.com github.com/llaisdy www.linkedin.com/in/ivanuemlianin festina lente ============================================================ From roger@REDACTED Thu May 29 16:24:53 2014 From: roger@REDACTED (Roger Lipscombe) Date: Thu, 29 May 2014 15:24:53 +0100 Subject: [erlang-questions] What does Prompt in io:get_line/2 do? In-Reply-To: <53873F05.6080608@llaisdy.com> References: <53873F05.6080608@llaisdy.com> Message-ID: 1> io:get_line(standard_io, foo). foohaskgjdhgsdg "haskgjdhgsdg\n" 2> io:get_line(standard_io, enter_something). enter_somethingsdgdsgsgsad "sdgdsgsgsad\n" 3> io:get_line(standard_io, 'meh>'). meh>fdasfhjdgfsadg "fdasfhjdgfsadg\n" On 29 May 2014 15:07, Ivan Uemlianin wrote: > Dear All > > Quick question! > > In io:get_line(IoDevice, Prompt), what is the point of Prompt? Just using a > random atom seems to work fine. > > 1> {ok,F} = file:open("data.txt",[read, {encoding, utf8}]). > {ok,<0.36.0>} > 2> io:get_line(F, x). > "first line\n" > 3> io:get_line(F, y). > "second line\n" > % ... etc > > Thanks > > Ivan > > > -- > ============================================================ > Ivan A. Uemlianin PhD > Llaisdy > Speech Technology Research and Development > > ivan@REDACTED > www.llaisdy.com > llaisdy.wordpress.com > github.com/llaisdy > www.linkedin.com/in/ivanuemlianin > > festina lente > ============================================================ > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions From ivan@REDACTED Thu May 29 16:35:13 2014 From: ivan@REDACTED (Ivan Uemlianin) Date: Thu, 29 May 2014 15:35:13 +0100 Subject: [erlang-questions] What does Prompt in io:get_line/2 do? In-Reply-To: References: <53873F05.6080608@llaisdy.com> Message-ID: <538745A1.3060301@llaisdy.com> Aha thanks. Special atoms. Also standard_error. Ivan On 29/05/2014 15:24, Roger Lipscombe wrote: > 1> io:get_line(standard_io, foo). > foohaskgjdhgsdg > "haskgjdhgsdg\n" > 2> io:get_line(standard_io, enter_something). > enter_somethingsdgdsgsgsad > "sdgdsgsgsad\n" > 3> io:get_line(standard_io, 'meh>'). > meh>fdasfhjdgfsadg > "fdasfhjdgfsadg\n" > > On 29 May 2014 15:07, Ivan Uemlianin wrote: >> Dear All >> >> Quick question! >> >> In io:get_line(IoDevice, Prompt), what is the point of Prompt? Just using a >> random atom seems to work fine. >> >> 1> {ok,F} = file:open("data.txt",[read, {encoding, utf8}]). >> {ok,<0.36.0>} >> 2> io:get_line(F, x). >> "first line\n" >> 3> io:get_line(F, y). >> "second line\n" >> % ... etc >> >> Thanks >> >> Ivan >> >> >> -- >> ============================================================ >> Ivan A. Uemlianin PhD >> Llaisdy >> Speech Technology Research and Development >> >> ivan@REDACTED >> www.llaisdy.com >> llaisdy.wordpress.com >> github.com/llaisdy >> www.linkedin.com/in/ivanuemlianin >> >> festina lente >> ============================================================ >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://erlang.org/mailman/listinfo/erlang-questions -- ============================================================ Ivan A. Uemlianin PhD Llaisdy Speech Technology Research and Development ivan@REDACTED www.llaisdy.com llaisdy.wordpress.com github.com/llaisdy www.linkedin.com/in/ivanuemlianin festina lente ============================================================ From forum1942@REDACTED Fri May 30 08:47:54 2014 From: forum1942@REDACTED (Igor Nesterov) Date: Fri, 30 May 2014 10:47:54 +0400 Subject: [erlang-questions] blowfish CFB mode in Crypto application Message-ID: <5388299A.7080609@palmoid.com> Hi, I'm using block_encrypt function from crypto application with blowfish cipher in CFB mode and find that block_encrypt doesn't allow to continue sequential encryption in this mode. Underlying BF_cfb64_encrypt function changes parameters iv and num, so they can be passed to the next call.And bf_cfb64_crypt from C part of crypto application doesn't pass those parameters back to erlang side, so it's impossible to obtain new parameters for the new call. Is there another solution exists? Or it's better to make patch? Igor From hans.bolinder@REDACTED Fri May 30 10:26:53 2014 From: hans.bolinder@REDACTED (Hans Bolinder) Date: Fri, 30 May 2014 08:26:53 +0000 Subject: [erlang-questions] Dialyzer and opaque types In-Reply-To: References: Message-ID: <56466BD70414EA48969B4064696CF28C037F00D0@ESESSMB207.ericsson.se> [Jan Chochol:] > We run in some problems with Dialyzer and opaque types. > Our problem can be simulated by two modules: ... > When analysing problem I found this piece of code in > lib/hipe/cerl/erl_types.erl: > > inf_union(U1, U2, opaque) -> ... > According to git log, this part of code did not change since R13B03 Many--but not all--problems with opaque types were fixed in 17.0. erl_types is one of the modules that were modified quite a lot. Your example works with 17.0, as far as I can see. Best regards, Hans Bolinder, Erlang/OTP team, Ericsson From davidnwelton@REDACTED Fri May 30 10:57:04 2014 From: davidnwelton@REDACTED (David Welton) Date: Fri, 30 May 2014 10:57:04 +0200 Subject: [erlang-questions] Chicago Boss Array Fields in Models In-Reply-To: <044a0428ae6c0151536b8fc4f16d4c28@bosqueviejo.net> References: <002e01cf76c2$1b1afc00$5150f400$@frcuba.co.cu> <044a0428ae6c0151536b8fc4f16d4c28@bosqueviejo.net> Message-ID: > I think arrays is not well supported for retrieve information from postgres, > I afraid, if you go to a psql terminal and run a simple: > > SELECT emails FROM users; You can get the raw data out without much trouble: create table foo (emails varchar[]); insert into foo (emails) values ('{"a", "b", "c"}'); boss_db:execute("select * from foo", []). {ok,[{column,<<"emails">>,{array,varchar},-1,-1,1}], [{[<<"a">>,<<"b">>,<<"c">>]}]} Keep in mind that, with Chicago Boss and Postgres boss_db:execute("select * from foo", []). uses a different underlying function than boss_db:execute("select * from foo") With the latter returning mostly binaries. > You realise the output is the same that you get with boss_db. Perhaps you > should normalice the data, create another table for emails and another model > using -has or -belongs instead. Normalizing the data might be a good idea in any case. -- David N. Welton http://www.welton.it/davidw/ http://www.dedasys.com/ From davidnwelton@REDACTED Fri May 30 11:09:44 2014 From: davidnwelton@REDACTED (David Welton) Date: Fri, 30 May 2014 11:09:44 +0200 Subject: [erlang-questions] Conditional configuration? Message-ID: Chicago Boss copies a handy idea from Rails, which copied it from somewhere else in turn: having different "environments", such as development, production and testing. Is it possible to conditionally do things in an Erlang configuration file? I get the impression it is not. What I'd like to accomplish: {lager, [{error_logger_hwm, 100}, {handlers, [{lager_console_backend, info}, {lager_syslog_backend, ["gsd_web", daemon, info, {lager_default_formatter, [date, " ", time, " [", severity, "] ", module, " ", pid, " ", message, "\n"]} ]}, %% ^^^^^ only in production mode {lager_file_backend, [{file, "log/error.log"}, {level, error}]}, {lager_file_backend, [{file, "log/console.log"}, {level, info}, {formatter, lager_default_formatter}, {formatter_config, [date, " ", time, " [", severity, "] ", module, " ", pid, " ", message, "\n"]} ]} ]} %% ^^^^ runs only in development mod ]} Ideas on how to best accomplish this? Thanks -- David N. Welton http://www.welton.it/davidw/ http://www.dedasys.com/ From tuncer.ayaz@REDACTED Fri May 30 11:44:59 2014 From: tuncer.ayaz@REDACTED (Tuncer Ayaz) Date: Fri, 30 May 2014 11:44:59 +0200 Subject: [erlang-questions] Conditional configuration? In-Reply-To: References: Message-ID: On 5/30/14, David Welton wrote: > Chicago Boss copies a handy idea from Rails, which copied it from > somewhere else in turn: having different "environments", such as > development, production and testing. > > Is it possible to conditionally do things in an Erlang configuration > file? I get the impression it is not. > [...] > > Ideas on how to best accomplish this? Have you considered file:script? http://www.erlang.org/doc/man/file.html#script-1 From davidnwelton@REDACTED Fri May 30 11:48:07 2014 From: davidnwelton@REDACTED (David Welton) Date: Fri, 30 May 2014 11:48:07 +0200 Subject: [erlang-questions] Conditional configuration? In-Reply-To: References: Message-ID: > Have you considered file:script? > > http://www.erlang.org/doc/man/file.html#script-1 That'd probably require some hackering of Chicago Boss itself. Not out of the question, but not quite as easy as I'd hoped for, either! -- David N. Welton http://www.welton.it/davidw/ http://www.dedasys.com/ From jan.chochol@REDACTED Fri May 30 12:44:03 2014 From: jan.chochol@REDACTED (Jan Chochol) Date: Fri, 30 May 2014 12:44:03 +0200 Subject: [erlang-questions] Dialyzer and opaque types In-Reply-To: <56466BD70414EA48969B4064696CF28C037F00D0@ESESSMB207.ericsson.se> References: <56466BD70414EA48969B4064696CF28C037F00D0@ESESSMB207.ericsson.se> Message-ID: Thanks for idea - I will try our use case with R17, and I will let you know. Regards, Jan Chochol On Fri, May 30, 2014 at 10:26 AM, Hans Bolinder wrote: > [Jan Chochol:] > >> We run in some problems with Dialyzer and opaque types. >> Our problem can be simulated by two modules: > ... >> When analysing problem I found this piece of code in >> lib/hipe/cerl/erl_types.erl: >> >> inf_union(U1, U2, opaque) -> > ... >> According to git log, this part of code did not change since R13B03 > > Many--but not all--problems with opaque types were fixed in 17.0. > erl_types is one of the modules that were modified quite a lot. > > Your example works with 17.0, as far as I can see. > > Best regards, > > Hans Bolinder, Erlang/OTP team, Ericsson > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions From roger@REDACTED Fri May 30 13:09:06 2014 From: roger@REDACTED (Roger Lipscombe) Date: Fri, 30 May 2014 12:09:06 +0100 Subject: [erlang-questions] Conditional configuration? In-Reply-To: References: Message-ID: You can provide different config files by using the -config switch. We use this to have a different configuration for each environment. Unfortunately, this leads to a lot of duplication in the config files. You can also provide multiple configuration files to the erlang runtime. Later ones will override earlier ones, but at a fairly coarse granularity. See http://www.erlang.org/doc/man/config.html for details. We've been looking at cuttlefish (https://github.com/basho/cuttlefish/), which allows sysctl-syntax configuration files, and seems like it will allow more fine-grained merging of configuration files at startup. The point of that being that you'd have base.config, dev.config, and (potentially) machine.config files which would overlay on each-other. On 30 May 2014 10:48, David Welton wrote: >> Have you considered file:script? >> >> http://www.erlang.org/doc/man/file.html#script-1 > > That'd probably require some hackering of Chicago Boss itself. Not > out of the question, but not quite as easy as I'd hoped for, either! > > -- > David N. Welton > > http://www.welton.it/davidw/ > > http://www.dedasys.com/ > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions From roger@REDACTED Fri May 30 13:28:19 2014 From: roger@REDACTED (Roger Lipscombe) Date: Fri, 30 May 2014 12:28:19 +0100 Subject: [erlang-questions] Supervisor tree width? Message-ID: I'm concerned that the top-level supervisor in one of our applications has too many children. It has about 15 children, which are only vaguely related to each other. What's a good rule-of-thumb for whether a supervisor tree is too wide? Or too deep? Or am I thinking on the wrong level here? Thanks, Roger. From jan.chochol@REDACTED Fri May 30 14:29:36 2014 From: jan.chochol@REDACTED (Jan Chochol) Date: Fri, 30 May 2014 14:29:36 +0200 Subject: [erlang-questions] Dialyzer and opaque types In-Reply-To: References: <56466BD70414EA48969B4064696CF28C037F00D0@ESESSMB207.ericsson.se> Message-ID: Hello, I tried running Dialyzer for our code base with OTP R17.0.1, and it works fine (and it also finds some new bugs in our specs). I consider this issue solved. Thanks for help, Jan Chochol On Fri, May 30, 2014 at 12:44 PM, Jan Chochol wrote: > Thanks for idea - I will try our use case with R17, and I will let you know. > > Regards, > Jan Chochol > > On Fri, May 30, 2014 at 10:26 AM, Hans Bolinder > wrote: >> [Jan Chochol:] >> >>> We run in some problems with Dialyzer and opaque types. >>> Our problem can be simulated by two modules: >> ... >>> When analysing problem I found this piece of code in >>> lib/hipe/cerl/erl_types.erl: >>> >>> inf_union(U1, U2, opaque) -> >> ... >>> According to git log, this part of code did not change since R13B03 >> >> Many--but not all--problems with opaque types were fixed in 17.0. >> erl_types is one of the modules that were modified quite a lot. >> >> Your example works with 17.0, as far as I can see. >> >> Best regards, >> >> Hans Bolinder, Erlang/OTP team, Ericsson >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://erlang.org/mailman/listinfo/erlang-questions From dmkolesnikov@REDACTED Fri May 30 15:02:39 2014 From: dmkolesnikov@REDACTED (Dmitry Kolesnikov) Date: Fri, 30 May 2014 16:02:39 +0300 Subject: [erlang-questions] Supervisor tree width? In-Reply-To: References: Message-ID: <0908DD8B-C362-4E7A-B954-0552FF9B6719@gmail.com> I?ll be trivial to say that design of supervisor tree is an application specific. One lesson learned is that supervision it?s about the guarantees. Take a look into Fred?s post http://ferd.ca/it-s-about-the-guarantees.html Personally, I?am splitting an application to smaller functional units with own supervisors per unit. If an unit design needs 15 children then I see no issue to have them. However, if 15 children do not have any relations each other then I am combining them to guaranty deterministic application state after failure. Best Regards, Dmitry On 30 May 2014, at 14:28, Roger Lipscombe wrote: > I'm concerned that the top-level supervisor in one of our applications > has too many children. It has about 15 children, which are only > vaguely related to each other. > > What's a good rule-of-thumb for whether a supervisor tree is too wide? > Or too deep? Or am I thinking on the wrong level here? > > Thanks, > Roger. > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions From co7eb@REDACTED Fri May 30 16:21:13 2014 From: co7eb@REDACTED (=?iso-8859-1?Q?Ivan_Carmenates_Garc=EDa?=) Date: Fri, 30 May 2014 10:21:13 -0400 Subject: [erlang-questions] Chicago Boss Array Fields in Models In-Reply-To: References: <002e01cf76c2$1b1afc00$5150f400$@frcuba.co.cu> <044a0428ae6c0151536b8fc4f16d4c28@bosqueviejo.net> Message-ID: <003901cf7c12$6d492740$47db75c0$@frcuba.co.cu> Hi David, thanks for answer me. Okay, in the case of arrays maybe I could normalize even more the database to include new tables for the arrayed fields, but what about execute? I mean, when I need to make more complex queries to the database like using many tables in the query with many filters, then I will have in the result all the records of all the tables mixed, that is fine for me still, because I can intentionality extract the values from the result and make a proplist with the values to pass it to the template like this: {ok, [{result, [{name, Name}, {post, Post }]}]}, to access from the template in this way: result.name, result.post. But still it is a little bit awkward to extract the nice values from the result of an execute, could be over there a function that translate that result to a nice proplist? Ex: if boss_db:execute/1 returns a list of columns with its names and types and a list of values, a proplist could be made as a kind of return value from execute, the proplist will have the following structure, from the execute result: [{column,<<"id">>,int4,4,-1,0}, {column,<<"username">>,varchar,-1,29,0}, {column,<<"email">>,varchar,-1,259,0}, {column,<<"password">>,varchar,-1,259,0}, {column,<<"password_old">>,varchar,-1,259,0}, {column,<<"activated">>,bool,1,-1,0}, {column,<<"activation_token">>,varchar,-1,259,0}, {column,<<"activation_token_created_date">>,timestamp,8,-1, 0}], [{<<"2">>,<<"john">>,<<"john@REDACTED">>, <<"55f5d08a12e5c9857c45c05be7ae468a">>, <<"55f5d08a12e5c9857c45c05be7ae468a">>,<<"f">>, <<"97cc79a8ea3d1ddbcc35dd82016056359b489412">>, <<"2014-05-26 15:09:34">>}]} Second value of each line tuple is the field name and the key in the proplist, And the corresponded value is the value of the key in the proplist. [{id, "2"}, {username, "john"}, {email, " john@REDACTED"}, {password , "55f5d08a12e5c9857c45c05be7ae468a"}, {password_old, "55f5d08a12e5c9857c45c05be7ae468a"}, {activated, "true"}, {activation_token, "97cc79a8ea3d1ddbcc35dd82016056359b489412"}, {activation_token_created_date, "2014-05-26 15:09:34"}] Of cource the proplist values and keys without any ugly binary format. Best regards, Ivan. -----Mensaje original----- De: erlang-questions-bounces@REDACTED [mailto:erlang-questions-bounces@REDACTED] En nombre de David Welton Enviado el: viernes, 30 de mayo de 2014 04:57 a.m. Para: Manuel A. Rubio Bombadil CC: Erlang Questions Asunto: Re: [erlang-questions] Chicago Boss Array Fields in Models > I think arrays is not well supported for retrieve information from > postgres, I afraid, if you go to a psql terminal and run a simple: > > SELECT emails FROM users; You can get the raw data out without much trouble: create table foo (emails varchar[]); insert into foo (emails) values ('{"a", "b", "c"}'); boss_db:execute("select * from foo", []). {ok,[{column,<<"emails">>,{array,varchar},-1,-1,1}], [{[<<"a">>,<<"b">>,<<"c">>]}]} Keep in mind that, with Chicago Boss and Postgres boss_db:execute("select * from foo", []). uses a different underlying function than boss_db:execute("select * from foo") With the latter returning mostly binaries. > You realise the output is the same that you get with boss_db. Perhaps > you should normalice the data, create another table for emails and > another model using -has or -belongs instead. Normalizing the data might be a good idea in any case. -- David N. Welton http://www.welton.it/davidw/ http://www.dedasys.com/ _______________________________________________ erlang-questions mailing list erlang-questions@REDACTED http://erlang.org/mailman/listinfo/erlang-questions From roger@REDACTED Fri May 30 17:02:30 2014 From: roger@REDACTED (Roger Lipscombe) Date: Fri, 30 May 2014 16:02:30 +0100 Subject: [erlang-questions] Reporting gen_server timings Message-ID: We're using poolboy and pgsql. I'd like to report (to graphite; we're using folsomite) the time taken for the gen_server and database calls. When you use poolboy, you provide it with a worker (usually a gen_server), and call it like this: poolboy:transaction(?POOL, fun(W) -> gen_server:call(W, {equery, Stmt}) end). I'd like to instrument this -- without having to add too much wrapper code -- such that I get measurements of: - How long the overall transaction took. - How much of that was spent waiting for poolboy to get an available worker. - How much of that was spent waiting on the database. I could decorate the code with timer:tc calls everywhere, but that gets ugly really quickly. Is there a better way? Thanks, Roger. From dmkolesnikov@REDACTED Fri May 30 17:15:45 2014 From: dmkolesnikov@REDACTED (Dmitry Kolesnikov) Date: Fri, 30 May 2014 18:15:45 +0300 Subject: [erlang-questions] fast tuple sorting Message-ID: <9D283B66-92FD-4912-A197-05FCF526EE42@gmail.com> Hello, I need to sort a list of tuples {integer(), float()} within 6 ms. the lists:keysort(1, X) is not fast enough for me. I am able to meet the hard requirement only if the list size about 10K tuples. However, my application needs to sort lists of 50K tuples or so. I doubt that any other sort algorithm implemented in Erlang would solve my issue. Parallel sort would not help at all because production system would run parallel requests of lists sorting. I am starting to think of offloading the sorting to NIF. Any thought? Best Regards, Dmitry From mononcqc@REDACTED Fri May 30 17:29:24 2014 From: mononcqc@REDACTED (Fred Hebert) Date: Fri, 30 May 2014 11:29:24 -0400 Subject: [erlang-questions] fast tuple sorting In-Reply-To: <9D283B66-92FD-4912-A197-05FCF526EE42@gmail.com> References: <9D283B66-92FD-4912-A197-05FCF526EE42@gmail.com> Message-ID: <20140530152923.GA7746@ferdair.local> What do you need the sorting for? On 05/30, Dmitry Kolesnikov wrote: > Hello, > > I need to sort a list of tuples {integer(), float()} within 6 ms. the lists:keysort(1, X) is not fast enough for me. I am able to meet the hard requirement only if the list size about 10K tuples. However, my application needs to sort lists of 50K tuples or so. > > I doubt that any other sort algorithm implemented in Erlang would solve my issue. Parallel sort would not help at all because production system would run parallel requests of lists sorting. I am starting to think of offloading the sorting to NIF. > > Any thought? > > Best Regards, > Dmitry > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions From bob@REDACTED Fri May 30 17:35:38 2014 From: bob@REDACTED (Bob Ippolito) Date: Fri, 30 May 2014 08:35:38 -0700 Subject: [erlang-questions] fast tuple sorting In-Reply-To: <9D283B66-92FD-4912-A197-05FCF526EE42@gmail.com> References: <9D283B66-92FD-4912-A197-05FCF526EE42@gmail.com> Message-ID: Why does it have to be a list? Why not store it in a gb_tree instead, this way it's sorted as you build it. Another alternative would be to use an ordered_set ets table. On Fri, May 30, 2014 at 8:15 AM, Dmitry Kolesnikov wrote: > Hello, > > I need to sort a list of tuples {integer(), float()} within 6 ms. the > lists:keysort(1, X) is not fast enough for me. I am able to meet the hard > requirement only if the list size about 10K tuples. However, my application > needs to sort lists of 50K tuples or so. > > I doubt that any other sort algorithm implemented in Erlang would solve my > issue. Parallel sort would not help at all because production system would > run parallel requests of lists sorting. I am starting to think of > offloading the sorting to NIF. > > Any thought? > > Best Regards, > Dmitry > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From sean@REDACTED Fri May 30 18:01:22 2014 From: sean@REDACTED (Sean Cribbs) Date: Fri, 30 May 2014 11:01:22 -0500 Subject: [erlang-questions] Reporting gen_server timings In-Reply-To: References: Message-ID: It looks like folsom (which it looks like folsomite wraps, correct me if I'm wrong), will do this for you already: https://github.com/boundary/folsom/blob/master/src/folsom_metrics.erl#L210 You'll still have to wrap those calls with instrumentation. However, you could also write your own wrapper function just once, maybe something like this: pool_instrument(Pool, Fun, TotalMetric, CheckoutMetric, InternalMetric) -> folsom:histogram_timed_update(TotalMetric, fun pool_instrument/4, [Pool, Fun, CheckoutMetric, InternalMetric]). pool_instrument(Pool, Fun, CheckoutMetric, InternalMetric) -> Worker = folsom:histogram_timed_update(CheckoutMetric, poolboy, checkout, [Pool, true, Timeout]), try folsom:histogram_timed_update(InternalMetric, Fun, [Worker]) after ok = poolboy:checkin(Pool, Worker) end. On Fri, May 30, 2014 at 10:02 AM, Roger Lipscombe wrote: > We're using poolboy and pgsql. I'd like to report (to graphite; we're > using folsomite) the time taken for the gen_server and database calls. > > When you use poolboy, you provide it with a worker (usually a > gen_server), and call it like this: > > poolboy:transaction(?POOL, fun(W) -> gen_server:call(W, {equery, > Stmt}) end). > > I'd like to instrument this -- without having to add too much wrapper > code -- such that I get measurements of: > > - How long the overall transaction took. > - How much of that was spent waiting for poolboy to get an available > worker. > - How much of that was spent waiting on the database. > > I could decorate the code with timer:tc calls everywhere, but that > gets ugly really quickly. Is there a better way? > > Thanks, > Roger. > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > -- Sean Cribbs Software Engineer Basho Technologies, Inc. http://basho.com/ -------------- next part -------------- An HTML attachment was scrubbed... URL: From dmkolesnikov@REDACTED Fri May 30 18:02:49 2014 From: dmkolesnikov@REDACTED (Dmitry Kolesnikov) Date: Fri, 30 May 2014 19:02:49 +0300 Subject: [erlang-questions] fast tuple sorting In-Reply-To: References: <9D283B66-92FD-4912-A197-05FCF526EE42@gmail.com> Message-ID: <6CBC4EAF-43DE-44B8-9304-0B664F762A85@gmail.com> Hello, gb_trees is even slower then lists. I am getting 50K data points and appends them two lists in 13ms + sorting 60ms. Same size job of gb_trees construction takes about 132ms. ETS is a good point, I overlook it and this seems to be a good replacement for NIF burden. However, I need to run up to 2500 concurrent requests on single very powerful node. I guess a single ETS would be bottleneck especially when you need evicts data. ETS table per request sound an interesting approach ;-) - Dmitry On 30 May 2014, at 18:35, Bob Ippolito wrote: > Why does it have to be a list? Why not store it in a gb_tree instead, this way it's sorted as you build it. Another alternative would be to use an ordered_set ets table. > > > > On Fri, May 30, 2014 at 8:15 AM, Dmitry Kolesnikov wrote: > Hello, > > I need to sort a list of tuples {integer(), float()} within 6 ms. the lists:keysort(1, X) is not fast enough for me. I am able to meet the hard requirement only if the list size about 10K tuples. However, my application needs to sort lists of 50K tuples or so. > > I doubt that any other sort algorithm implemented in Erlang would solve my issue. Parallel sort would not help at all because production system would run parallel requests of lists sorting. I am starting to think of offloading the sorting to NIF. > > Any thought? > > Best Regards, > Dmitry > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From sean@REDACTED Fri May 30 18:03:53 2014 From: sean@REDACTED (Sean Cribbs) Date: Fri, 30 May 2014 11:03:53 -0500 Subject: [erlang-questions] fast tuple sorting In-Reply-To: References: <9D283B66-92FD-4912-A197-05FCF526EE42@gmail.com> Message-ID: Not sure it's going to be any better than ets or gb_trees, but I implemented Okasaki's binomial heap: https://github.com/seancribbs/eunit_formatters/blob/master/src/binomial_heap.erl It has cheap insertion, and you can adjust the comparator function to convert it between min/max forms. On Fri, May 30, 2014 at 10:35 AM, Bob Ippolito wrote: > Why does it have to be a list? Why not store it in a gb_tree instead, this > way it's sorted as you build it. Another alternative would be to use an > ordered_set ets table. > > > > On Fri, May 30, 2014 at 8:15 AM, Dmitry Kolesnikov > wrote: > >> Hello, >> >> I need to sort a list of tuples {integer(), float()} within 6 ms. the >> lists:keysort(1, X) is not fast enough for me. I am able to meet the hard >> requirement only if the list size about 10K tuples. However, my application >> needs to sort lists of 50K tuples or so. >> >> I doubt that any other sort algorithm implemented in Erlang would solve >> my issue. Parallel sort would not help at all because production system >> would run parallel requests of lists sorting. I am starting to think of >> offloading the sorting to NIF. >> >> Any thought? >> >> Best Regards, >> Dmitry >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://erlang.org/mailman/listinfo/erlang-questions >> > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > > -- Sean Cribbs Software Engineer Basho Technologies, Inc. http://basho.com/ -------------- next part -------------- An HTML attachment was scrubbed... URL: From dmkolesnikov@REDACTED Fri May 30 18:25:38 2014 From: dmkolesnikov@REDACTED (Dmitry Kolesnikov) Date: Fri, 30 May 2014 19:25:38 +0300 Subject: [erlang-questions] fast tuple sorting In-Reply-To: References: <9D283B66-92FD-4912-A197-05FCF526EE42@gmail.com> Message-ID: I?ve used a normal heap but it does not differ to much from gb_tree as you said. Insert is log(N) as gb_tree but actually run-time was faster about 79ms vs 132ms but I think this is due re-balance. I can try binomial_heap but I am really doubt it would be fast enough. - Dmitry On 30 May 2014, at 19:03, Sean Cribbs wrote: > Not sure it's going to be any better than ets or gb_trees, but I implemented Okasaki's binomial heap: https://github.com/seancribbs/eunit_formatters/blob/master/src/binomial_heap.erl > > It has cheap insertion, and you can adjust the comparator function to convert it between min/max forms. > > > On Fri, May 30, 2014 at 10:35 AM, Bob Ippolito wrote: > Why does it have to be a list? Why not store it in a gb_tree instead, this way it's sorted as you build it. Another alternative would be to use an ordered_set ets table. > > > > On Fri, May 30, 2014 at 8:15 AM, Dmitry Kolesnikov wrote: > Hello, > > I need to sort a list of tuples {integer(), float()} within 6 ms. the lists:keysort(1, X) is not fast enough for me. I am able to meet the hard requirement only if the list size about 10K tuples. However, my application needs to sort lists of 50K tuples or so. > > I doubt that any other sort algorithm implemented in Erlang would solve my issue. Parallel sort would not help at all because production system would run parallel requests of lists sorting. I am starting to think of offloading the sorting to NIF. > > Any thought? > > Best Regards, > Dmitry > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > > > > > -- > Sean Cribbs > Software Engineer > Basho Technologies, Inc. > http://basho.com/ -------------- next part -------------- An HTML attachment was scrubbed... URL: From sean@REDACTED Fri May 30 18:39:00 2014 From: sean@REDACTED (Sean Cribbs) Date: Fri, 30 May 2014 11:39:00 -0500 Subject: [erlang-questions] fast tuple sorting In-Reply-To: References: <9D283B66-92FD-4912-A197-05FCF526EE42@gmail.com> Message-ID: Yes, I doubt it as well, with 50K tuples it might become near-useless simply from copying/memory pressure. The tradeoff with the binomial heap is it is more expensive to take from it, but is cheap to merge. I have found it most useful for "Top N" sorts of operations, where N is small but the candidate set is somewhat larger. On Fri, May 30, 2014 at 11:25 AM, Dmitry Kolesnikov wrote: > I?ve used a normal heap but it does not differ to much from gb_tree as you > said. > Insert is log(N) as gb_tree but actually run-time was faster about 79ms vs > 132ms but I think this is due re-balance. > > I can try binomial_heap but I am really doubt it would be fast enough. > > - Dmitry > > On 30 May 2014, at 19:03, Sean Cribbs wrote: > > Not sure it's going to be any better than ets or gb_trees, but I > implemented Okasaki's binomial heap: > https://github.com/seancribbs/eunit_formatters/blob/master/src/binomial_heap.erl > > It has cheap insertion, and you can adjust the comparator function to > convert it between min/max forms. > > > On Fri, May 30, 2014 at 10:35 AM, Bob Ippolito wrote: > >> Why does it have to be a list? Why not store it in a gb_tree instead, >> this way it's sorted as you build it. Another alternative would be to use >> an ordered_set ets table. >> >> >> >> On Fri, May 30, 2014 at 8:15 AM, Dmitry Kolesnikov < >> dmkolesnikov@REDACTED> wrote: >> >>> Hello, >>> >>> I need to sort a list of tuples {integer(), float()} within 6 ms. the >>> lists:keysort(1, X) is not fast enough for me. I am able to meet the hard >>> requirement only if the list size about 10K tuples. However, my application >>> needs to sort lists of 50K tuples or so. >>> >>> I doubt that any other sort algorithm implemented in Erlang would solve >>> my issue. Parallel sort would not help at all because production system >>> would run parallel requests of lists sorting. I am starting to think of >>> offloading the sorting to NIF. >>> >>> Any thought? >>> >>> Best Regards, >>> Dmitry >>> _______________________________________________ >>> erlang-questions mailing list >>> erlang-questions@REDACTED >>> http://erlang.org/mailman/listinfo/erlang-questions >>> >> >> >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://erlang.org/mailman/listinfo/erlang-questions >> >> > > > -- > Sean Cribbs > Software Engineer > Basho Technologies, Inc. > http://basho.com/ > > > -- Sean Cribbs Software Engineer Basho Technologies, Inc. http://basho.com/ -------------- next part -------------- An HTML attachment was scrubbed... URL: From max.lapshin@REDACTED Fri May 30 21:14:33 2014 From: max.lapshin@REDACTED (Max Lapshin) Date: Fri, 30 May 2014 23:14:33 +0400 Subject: [erlang-questions] fast tuple sorting In-Reply-To: References: <9D283B66-92FD-4912-A197-05FCF526EE42@gmail.com> Message-ID: Dmitry, maybe you can tell a bit about your task? What are these tuples? Where do you get them from? -------------- next part -------------- An HTML attachment was scrubbed... URL: From lloyd@REDACTED Fri May 30 21:56:46 2014 From: lloyd@REDACTED (lloyd@REDACTED) Date: Fri, 30 May 2014 15:56:46 -0400 (EDT) Subject: [erlang-questions] How to return all records in dets Message-ID: <1401479806.358332223@apps.rackspace.com> Hello, I'm cross-eyed from looking at match specifications. All I want to do is list all records in my small dets table. I once ran across a very neat query to accomplish that, but for the life can't Google it up. Can some kind soul give me a query that works? Many thanks, LRP From shayan@REDACTED Fri May 30 22:03:27 2014 From: shayan@REDACTED (Shayan Pooya) Date: Fri, 30 May 2014 16:03:27 -0400 Subject: [erlang-questions] File operations on slave nodes Message-ID: Hello, Is there a good way to perform file operations on a slave node's filesystem using the "file" module? At the moment, Disco uses prim_file module for all such operations which results in some inconvenience and is not documented. For example, for changing the permissions of a file on an slave, we have to use: prim_file:write_file_info(Path, #file_info{mode = 8#755}) instead of the same function in the file module. Someone on the irc channel mentioned using the raw option. However, this option does not cover all of the cases (for example there is no equivalent for prim_file:make_dir(Name)). Is there a better way? I found this thread ( https://groups.google.com/forum/#!topic/erlang-programming/iRN984TufcA) which is asking the same question six years ago but there was no good answers). Regards -------------- next part -------------- An HTML attachment was scrubbed... URL: From ulf@REDACTED Fri May 30 22:08:00 2014 From: ulf@REDACTED (Ulf Wiger) Date: Fri, 30 May 2014 22:08:00 +0200 Subject: [erlang-questions] How to return all records in dets In-Reply-To: <1401479806.358332223@apps.rackspace.com> References: <1401479806.358332223@apps.rackspace.com> Message-ID: <55299FC7-0BAC-4ADC-8050-FB73E2333FFA@feuerlabs.com> ets:tab2list(Tab). ets:select(Tab, [{?_?, [], [?$_?]}]). ets:select(Tab, ets:fun2ms(fun(X) -> X end). ets:match_object(Tab, ?_?) BR, Ulf W On 30 May 2014, at 21:56, lloyd@REDACTED wrote: > Hello, > > I'm cross-eyed from looking at match specifications. All I want to do is list all records in my small dets table. I once ran across a very neat query to accomplish that, but for the life can't Google it up. > > Can some kind soul give me a query that works? > > Many thanks, > > LRP > > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions Ulf Wiger, Co-founder & Developer Advocate, Feuerlabs Inc. http://feuerlabs.com From ulf@REDACTED Fri May 30 22:11:56 2014 From: ulf@REDACTED (Ulf Wiger) Date: Fri, 30 May 2014 22:11:56 +0200 Subject: [erlang-questions] How to return all records in dets In-Reply-To: <55299FC7-0BAC-4ADC-8050-FB73E2333FFA@feuerlabs.com> References: <1401479806.358332223@apps.rackspace.com> <55299FC7-0BAC-4ADC-8050-FB73E2333FFA@feuerlabs.com> Message-ID: <36E24B46-8B16-4CD9-B31B-7590AFA57D32@feuerlabs.com> Sorry, you said ?dets?. :) No matter, substitute ?dets:? for ?ets:? in all places except for ets:fun2ms/1. BR, Ulf W On 30 May 2014, at 22:08, Ulf Wiger wrote: > > ets:tab2list(Tab). > > ets:select(Tab, [{?_?, [], [?$_?]}]). > > ets:select(Tab, ets:fun2ms(fun(X) -> X end). > > ets:match_object(Tab, ?_?) > > BR, > Ulf W > > On 30 May 2014, at 21:56, lloyd@REDACTED wrote: > >> Hello, >> >> I'm cross-eyed from looking at match specifications. All I want to do is list all records in my small dets table. I once ran across a very neat query to accomplish that, but for the life can't Google it up. >> >> Can some kind soul give me a query that works? >> >> Many thanks, >> >> LRP >> >> >> >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://erlang.org/mailman/listinfo/erlang-questions > > Ulf Wiger, Co-founder & Developer Advocate, Feuerlabs Inc. > http://feuerlabs.com > > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions Ulf Wiger, Co-founder & Developer Advocate, Feuerlabs Inc. http://feuerlabs.com From lloyd@REDACTED Fri May 30 22:46:22 2014 From: lloyd@REDACTED (lloyd@REDACTED) Date: Fri, 30 May 2014 16:46:22 -0400 (EDT) Subject: [erlang-questions] How to return all records in dets In-Reply-To: <55299FC7-0BAC-4ADC-8050-FB73E2333FFA@feuerlabs.com> References: <1401479806.358332223@apps.rackspace.com> <55299FC7-0BAC-4ADC-8050-FB73E2333FFA@feuerlabs.com> Message-ID: <1401482782.944320796@apps.rackspace.com> Hi Ulf, No cigar. First I tried in Erlang shell: (nitrogen@REDACTED)36> visitor_store:open_visitor_db(). dets opened: visitors void (nitrogen@REDACTED)37> dets:tab2list(visitors). ** exception error: undefined function dets:tab2list/1 (I'm running R17.0; noticed that tab2list/1 is not in docs. We do have to_ets/1, but I haven't tried that yet.) (nitrogen@REDACTED)38> dets:select(visitors, [{'_',[], ['$_']}]). ** exception error: bad argument in function dets:select/2 called as dets:select(visitors,[{'_',[],['$_']}]) (Maybe my typo, but I can't see it.) (nitrogen@REDACTED)39> dets:match_object(visitors, '_'). ** exception error: bad argument in function dets:match_object/2 called as dets:match_object(visitors,'_') So I created some functions: dump_visitors() -> dets:tab2list(visitors). dump_visitors1() -> dets:select(visitors, [{'_', [], ['$_']}]). dump_visitors2() -> dets:match_object(visitors, '_'). And called them in the shell: (nitrogen@REDACTED)40> l(visitor_store). {module,visitor_store} (nitrogen@REDACTED)41> visitor_store:dump_visitors(). ** exception error: undefined function dets:tab2list/1 (nitrogen@REDACTED)42> visitor_store:dump_visitors1(). ** exception error: bad argument in function dets:select/2 called as dets:select(visitors,[{'_',[],['$_']}]) (nitrogen@REDACTED)43> visitor_store:dump_visitors2(). ** exception error: bad argument in function dets:match_object/2 called as dets:match_object(visitors,'_') I feel like I'm jinxed. Thanks, Lloyd -----Original Message----- From: "Ulf Wiger" Sent: Friday, May 30, 2014 4:08pm To: lloyd@REDACTED Cc: "erlang questions" Subject: Re: [erlang-questions] How to return all records in dets ets:tab2list(Tab). ets:select(Tab, [{?_?, [], [?$_?]}]). ets:select(Tab, ets:fun2ms(fun(X) -> X end). ets:match_object(Tab, ?_?) BR, Ulf W On 30 May 2014, at 21:56, lloyd@REDACTED wrote: > Hello, > > I'm cross-eyed from looking at match specifications. All I want to do is list all records in my small dets table. I once ran across a very neat query to accomplish that, but for the life can't Google it up. > > Can some kind soul give me a query that works? > > Many thanks, > > LRP > > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions Ulf Wiger, Co-founder & Developer Advocate, Feuerlabs Inc. http://feuerlabs.com From ulf@REDACTED Fri May 30 22:51:53 2014 From: ulf@REDACTED (Ulf Wiger) Date: Fri, 30 May 2014 22:51:53 +0200 Subject: [erlang-questions] How to return all records in dets In-Reply-To: <1401482782.944320796@apps.rackspace.com> References: <1401479806.358332223@apps.rackspace.com> <55299FC7-0BAC-4ADC-8050-FB73E2333FFA@feuerlabs.com> <1401482782.944320796@apps.rackspace.com> Message-ID: <96D97A6A-2181-4822-8BBC-B935B603B6C3@feuerlabs.com> Yes, sorry about the tab2list/1 error. I see now that I didn?t actually verify that one. But? 17> dets:open_file("d", []). {ok,"d"} 18> dets:insert("d", [{a,1},{b,2}]). ok 19> dets:select("d", ets:fun2ms(fun(X) -> X end)). [{b,2},{a,1}] 20> dets:select("d", ets:fun2ms(fun(X) -> X end)). [{b,2},{a,1}] 21> dets:match_object("d",'_'). [{b,2},{a,1}] Are you sure your open function actually names the dets table ?visitors?? BR, Ulf W On 30 May 2014, at 22:46, lloyd@REDACTED wrote: > Hi Ulf, > > No cigar. > > First I tried in Erlang shell: > > (nitrogen@REDACTED)36> visitor_store:open_visitor_db(). > dets opened: visitors > void > (nitrogen@REDACTED)37> dets:tab2list(visitors). > ** exception error: undefined function dets:tab2list/1 > > (I'm running R17.0; noticed that tab2list/1 is not in docs. We do have to_ets/1, but I haven't tried that yet.) > > > (nitrogen@REDACTED)38> dets:select(visitors, [{'_',[], ['$_']}]). > ** exception error: bad argument > in function dets:select/2 > called as dets:select(visitors,[{'_',[],['$_']}]) > > (Maybe my typo, but I can't see it.) > > (nitrogen@REDACTED)39> dets:match_object(visitors, '_'). > ** exception error: bad argument > in function dets:match_object/2 > called as dets:match_object(visitors,'_') > > So I created some functions: > > dump_visitors() -> > dets:tab2list(visitors). > > dump_visitors1() -> > dets:select(visitors, [{'_', [], ['$_']}]). > > dump_visitors2() -> > dets:match_object(visitors, '_'). > > And called them in the shell: > > (nitrogen@REDACTED)40> l(visitor_store). > {module,visitor_store} > > (nitrogen@REDACTED)41> visitor_store:dump_visitors(). > ** exception error: undefined function dets:tab2list/1 > > (nitrogen@REDACTED)42> visitor_store:dump_visitors1(). > ** exception error: bad argument > in function dets:select/2 > called as dets:select(visitors,[{'_',[],['$_']}]) > > (nitrogen@REDACTED)43> visitor_store:dump_visitors2(). > ** exception error: bad argument > in function dets:match_object/2 > called as dets:match_object(visitors,'_') > > I feel like I'm jinxed. > > Thanks, > > Lloyd > > > > > -----Original Message----- > From: "Ulf Wiger" > Sent: Friday, May 30, 2014 4:08pm > To: lloyd@REDACTED > Cc: "erlang questions" > Subject: Re: [erlang-questions] How to return all records in dets > > > ets:tab2list(Tab). > > ets:select(Tab, [{?_?, [], [?$_?]}]). > > ets:select(Tab, ets:fun2ms(fun(X) -> X end). > > ets:match_object(Tab, ?_?) > > BR, > Ulf W > > On 30 May 2014, at 21:56, lloyd@REDACTED wrote: > >> Hello, >> >> I'm cross-eyed from looking at match specifications. All I want to do is list all records in my small dets table. I once ran across a very neat query to accomplish that, but for the life can't Google it up. >> >> Can some kind soul give me a query that works? >> >> Many thanks, >> >> LRP >> >> >> >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://erlang.org/mailman/listinfo/erlang-questions > > Ulf Wiger, Co-founder & Developer Advocate, Feuerlabs Inc. > http://feuerlabs.com > > > > > Ulf Wiger, Co-founder & Developer Advocate, Feuerlabs Inc. http://feuerlabs.com From g@REDACTED Fri May 30 22:56:33 2014 From: g@REDACTED (Garrett Smith) Date: Fri, 30 May 2014 15:56:33 -0500 Subject: [erlang-questions] How to return all records in dets In-Reply-To: <1401482782.944320796@apps.rackspace.com> References: <1401479806.358332223@apps.rackspace.com> <55299FC7-0BAC-4ADC-8050-FB73E2333FFA@feuerlabs.com> <1401482782.944320796@apps.rackspace.com> Message-ID: Llyod, your first error -- the call to tab2list -- is foobaring the dets file reference. The dets process is linked to the shell process on open_file, so when the shell process crashes as a result of this call to tab2list, every call after that will raise bad argument. The trick here is to *never* make a mistake in the shell :) (Just re-open the table and the subsequent calls will work) On Fri, May 30, 2014 at 3:46 PM, wrote: > Hi Ulf, > > No cigar. > > First I tried in Erlang shell: > > (nitrogen@REDACTED)36> visitor_store:open_visitor_db(). > dets opened: visitors > void > (nitrogen@REDACTED)37> dets:tab2list(visitors). > ** exception error: undefined function dets:tab2list/1 > > (I'm running R17.0; noticed that tab2list/1 is not in docs. We do have to_ets/1, but I haven't tried that yet.) > > > (nitrogen@REDACTED)38> dets:select(visitors, [{'_',[], ['$_']}]). > ** exception error: bad argument > in function dets:select/2 > called as dets:select(visitors,[{'_',[],['$_']}]) > > (Maybe my typo, but I can't see it.) > > (nitrogen@REDACTED)39> dets:match_object(visitors, '_'). > ** exception error: bad argument > in function dets:match_object/2 > called as dets:match_object(visitors,'_') > > So I created some functions: > > dump_visitors() -> > dets:tab2list(visitors). > > dump_visitors1() -> > dets:select(visitors, [{'_', [], ['$_']}]). > > dump_visitors2() -> > dets:match_object(visitors, '_'). > > And called them in the shell: > > (nitrogen@REDACTED)40> l(visitor_store). > {module,visitor_store} > > (nitrogen@REDACTED)41> visitor_store:dump_visitors(). > ** exception error: undefined function dets:tab2list/1 > > (nitrogen@REDACTED)42> visitor_store:dump_visitors1(). > ** exception error: bad argument > in function dets:select/2 > called as dets:select(visitors,[{'_',[],['$_']}]) > > (nitrogen@REDACTED)43> visitor_store:dump_visitors2(). > ** exception error: bad argument > in function dets:match_object/2 > called as dets:match_object(visitors,'_') > > I feel like I'm jinxed. > > Thanks, > > Lloyd > > > > > -----Original Message----- > From: "Ulf Wiger" > Sent: Friday, May 30, 2014 4:08pm > To: lloyd@REDACTED > Cc: "erlang questions" > Subject: Re: [erlang-questions] How to return all records in dets > > > ets:tab2list(Tab). > > ets:select(Tab, [{?_?, [], [?$_?]}]). > > ets:select(Tab, ets:fun2ms(fun(X) -> X end). > > ets:match_object(Tab, ?_?) > > BR, > Ulf W > > On 30 May 2014, at 21:56, lloyd@REDACTED wrote: > >> Hello, >> >> I'm cross-eyed from looking at match specifications. All I want to do is list all records in my small dets table. I once ran across a very neat query to accomplish that, but for the life can't Google it up. >> >> Can some kind soul give me a query that works? >> >> Many thanks, >> >> LRP >> >> >> >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://erlang.org/mailman/listinfo/erlang-questions > > Ulf Wiger, Co-founder & Developer Advocate, Feuerlabs Inc. > http://feuerlabs.com > > > > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions From lloyd@REDACTED Fri May 30 22:58:12 2014 From: lloyd@REDACTED (lloyd@REDACTED) Date: Fri, 30 May 2014 16:58:12 -0400 (EDT) Subject: [erlang-questions] How to return all records in dets In-Reply-To: <96D97A6A-2181-4822-8BBC-B935B603B6C3@feuerlabs.com> References: <1401479806.358332223@apps.rackspace.com> <55299FC7-0BAC-4ADC-8050-FB73E2333FFA@feuerlabs.com> <1401482782.944320796@apps.rackspace.com> <96D97A6A-2181-4822-8BBC-B935B603B6C3@feuerlabs.com> Message-ID: <1401483492.266617595@apps.rackspace.com> Ah, I misspoke. I forgot to open the db in the functions. So the following worked: dump_visitors1() -> open_visitor_db(), List = dets:select(visitors, [{'_', [], ['$_']}]), close_visitor_db(), List. dump_visitors2() -> open_visitor_db(), List = dets:match_object(visitors, '_'), close_visitor_db(), List. Thank you so much for your patience, Ulf. I'd love to write a noobie friendly tutorial if someone could mentor me through it. Best wishes, Lloyd -----Original Message----- From: "Ulf Wiger" Sent: Friday, May 30, 2014 4:51pm To: lloyd@REDACTED Cc: "erlang questions" Subject: Re: [erlang-questions] How to return all records in dets Yes, sorry about the tab2list/1 error. I see now that I didn?t actually verify that one. But? 17> dets:open_file("d", []). {ok,"d"} 18> dets:insert("d", [{a,1},{b,2}]). ok 19> dets:select("d", ets:fun2ms(fun(X) -> X end)). [{b,2},{a,1}] 20> dets:select("d", ets:fun2ms(fun(X) -> X end)). [{b,2},{a,1}] 21> dets:match_object("d",'_'). [{b,2},{a,1}] Are you sure your open function actually names the dets table ?visitors?? BR, Ulf W On 30 May 2014, at 22:46, lloyd@REDACTED wrote: > Hi Ulf, > > No cigar. > > First I tried in Erlang shell: > > (nitrogen@REDACTED)36> visitor_store:open_visitor_db(). > dets opened: visitors > void > (nitrogen@REDACTED)37> dets:tab2list(visitors). > ** exception error: undefined function dets:tab2list/1 > > (I'm running R17.0; noticed that tab2list/1 is not in docs. We do have to_ets/1, but I haven't tried that yet.) > > > (nitrogen@REDACTED)38> dets:select(visitors, [{'_',[], ['$_']}]). > ** exception error: bad argument > in function dets:select/2 > called as dets:select(visitors,[{'_',[],['$_']}]) > > (Maybe my typo, but I can't see it.) > > (nitrogen@REDACTED)39> dets:match_object(visitors, '_'). > ** exception error: bad argument > in function dets:match_object/2 > called as dets:match_object(visitors,'_') > > So I created some functions: > > dump_visitors() -> > dets:tab2list(visitors). > > dump_visitors1() -> > dets:select(visitors, [{'_', [], ['$_']}]). > > dump_visitors2() -> > dets:match_object(visitors, '_'). > > And called them in the shell: > > (nitrogen@REDACTED)40> l(visitor_store). > {module,visitor_store} > > (nitrogen@REDACTED)41> visitor_store:dump_visitors(). > ** exception error: undefined function dets:tab2list/1 > > (nitrogen@REDACTED)42> visitor_store:dump_visitors1(). > ** exception error: bad argument > in function dets:select/2 > called as dets:select(visitors,[{'_',[],['$_']}]) > > (nitrogen@REDACTED)43> visitor_store:dump_visitors2(). > ** exception error: bad argument > in function dets:match_object/2 > called as dets:match_object(visitors,'_') > > I feel like I'm jinxed. > > Thanks, > > Lloyd > > > > > -----Original Message----- > From: "Ulf Wiger" > Sent: Friday, May 30, 2014 4:08pm > To: lloyd@REDACTED > Cc: "erlang questions" > Subject: Re: [erlang-questions] How to return all records in dets > > > ets:tab2list(Tab). > > ets:select(Tab, [{?_?, [], [?$_?]}]). > > ets:select(Tab, ets:fun2ms(fun(X) -> X end). > > ets:match_object(Tab, ?_?) > > BR, > Ulf W > > On 30 May 2014, at 21:56, lloyd@REDACTED wrote: > >> Hello, >> >> I'm cross-eyed from looking at match specifications. All I want to do is list all records in my small dets table. I once ran across a very neat query to accomplish that, but for the life can't Google it up. >> >> Can some kind soul give me a query that works? >> >> Many thanks, >> >> LRP >> >> >> >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://erlang.org/mailman/listinfo/erlang-questions > > Ulf Wiger, Co-founder & Developer Advocate, Feuerlabs Inc. > http://feuerlabs.com > > > > > Ulf Wiger, Co-founder & Developer Advocate, Feuerlabs Inc. http://feuerlabs.com From lloyd@REDACTED Fri May 30 22:59:43 2014 From: lloyd@REDACTED (lloyd@REDACTED) Date: Fri, 30 May 2014 16:59:43 -0400 (EDT) Subject: [erlang-questions] How to return all records in dets In-Reply-To: References: <1401479806.358332223@apps.rackspace.com> <55299FC7-0BAC-4ADC-8050-FB73E2333FFA@feuerlabs.com> <1401482782.944320796@apps.rackspace.com> Message-ID: <1401483583.174617403@apps.rackspace.com> Thanks, Garrett. I stumbled on it as noted in my post to Ulf a moment ago. So much to keep in mind. All the best, L. -----Original Message----- From: "Garrett Smith" Sent: Friday, May 30, 2014 4:56pm To: "Lloyd Prentice" Cc: "Ulf Wiger" , "erlang questions" Subject: Re: [erlang-questions] How to return all records in dets Llyod, your first error -- the call to tab2list -- is foobaring the dets file reference. The dets process is linked to the shell process on open_file, so when the shell process crashes as a result of this call to tab2list, every call after that will raise bad argument. The trick here is to *never* make a mistake in the shell :) (Just re-open the table and the subsequent calls will work) On Fri, May 30, 2014 at 3:46 PM, wrote: > Hi Ulf, > > No cigar. > > First I tried in Erlang shell: > > (nitrogen@REDACTED)36> visitor_store:open_visitor_db(). > dets opened: visitors > void > (nitrogen@REDACTED)37> dets:tab2list(visitors). > ** exception error: undefined function dets:tab2list/1 > > (I'm running R17.0; noticed that tab2list/1 is not in docs. We do have to_ets/1, but I haven't tried that yet.) > > > (nitrogen@REDACTED)38> dets:select(visitors, [{'_',[], ['$_']}]). > ** exception error: bad argument > in function dets:select/2 > called as dets:select(visitors,[{'_',[],['$_']}]) > > (Maybe my typo, but I can't see it.) > > (nitrogen@REDACTED)39> dets:match_object(visitors, '_'). > ** exception error: bad argument > in function dets:match_object/2 > called as dets:match_object(visitors,'_') > > So I created some functions: > > dump_visitors() -> > dets:tab2list(visitors). > > dump_visitors1() -> > dets:select(visitors, [{'_', [], ['$_']}]). > > dump_visitors2() -> > dets:match_object(visitors, '_'). > > And called them in the shell: > > (nitrogen@REDACTED)40> l(visitor_store). > {module,visitor_store} > > (nitrogen@REDACTED)41> visitor_store:dump_visitors(). > ** exception error: undefined function dets:tab2list/1 > > (nitrogen@REDACTED)42> visitor_store:dump_visitors1(). > ** exception error: bad argument > in function dets:select/2 > called as dets:select(visitors,[{'_',[],['$_']}]) > > (nitrogen@REDACTED)43> visitor_store:dump_visitors2(). > ** exception error: bad argument > in function dets:match_object/2 > called as dets:match_object(visitors,'_') > > I feel like I'm jinxed. > > Thanks, > > Lloyd > > > > > -----Original Message----- > From: "Ulf Wiger" > Sent: Friday, May 30, 2014 4:08pm > To: lloyd@REDACTED > Cc: "erlang questions" > Subject: Re: [erlang-questions] How to return all records in dets > > > ets:tab2list(Tab). > > ets:select(Tab, [{?_?, [], [?$_?]}]). > > ets:select(Tab, ets:fun2ms(fun(X) -> X end). > > ets:match_object(Tab, ?_?) > > BR, > Ulf W > > On 30 May 2014, at 21:56, lloyd@REDACTED wrote: > >> Hello, >> >> I'm cross-eyed from looking at match specifications. All I want to do is list all records in my small dets table. I once ran across a very neat query to accomplish that, but for the life can't Google it up. >> >> Can some kind soul give me a query that works? >> >> Many thanks, >> >> LRP >> >> >> >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://erlang.org/mailman/listinfo/erlang-questions > > Ulf Wiger, Co-founder & Developer Advocate, Feuerlabs Inc. > http://feuerlabs.com > > > > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions From g@REDACTED Fri May 30 23:00:15 2014 From: g@REDACTED (Garrett Smith) Date: Fri, 30 May 2014 16:00:15 -0500 Subject: [erlang-questions] How to return all records in dets In-Reply-To: References: <1401479806.358332223@apps.rackspace.com> <55299FC7-0BAC-4ADC-8050-FB73E2333FFA@feuerlabs.com> <1401482782.944320796@apps.rackspace.com> Message-ID: Llyoid, I misspoke. It's spelled fubar: http://www.urbandictionary.com/define.php?term=fubar On Fri, May 30, 2014 at 3:56 PM, Garrett Smith wrote: > Llyod, your first error -- the call to tab2list -- is foobaring the > dets file reference. The dets process is linked to the shell process > on open_file, so when the shell process crashes as a result of this > call to tab2list, every call after that will raise bad argument. > > The trick here is to *never* make a mistake in the shell :) > > (Just re-open the table and the subsequent calls will work) > > On Fri, May 30, 2014 at 3:46 PM, wrote: >> Hi Ulf, >> >> No cigar. >> >> First I tried in Erlang shell: >> >> (nitrogen@REDACTED)36> visitor_store:open_visitor_db(). >> dets opened: visitors >> void >> (nitrogen@REDACTED)37> dets:tab2list(visitors). >> ** exception error: undefined function dets:tab2list/1 >> >> (I'm running R17.0; noticed that tab2list/1 is not in docs. We do have to_ets/1, but I haven't tried that yet.) >> >> >> (nitrogen@REDACTED)38> dets:select(visitors, [{'_',[], ['$_']}]). >> ** exception error: bad argument >> in function dets:select/2 >> called as dets:select(visitors,[{'_',[],['$_']}]) >> >> (Maybe my typo, but I can't see it.) >> >> (nitrogen@REDACTED)39> dets:match_object(visitors, '_'). >> ** exception error: bad argument >> in function dets:match_object/2 >> called as dets:match_object(visitors,'_') >> >> So I created some functions: >> >> dump_visitors() -> >> dets:tab2list(visitors). >> >> dump_visitors1() -> >> dets:select(visitors, [{'_', [], ['$_']}]). >> >> dump_visitors2() -> >> dets:match_object(visitors, '_'). >> >> And called them in the shell: >> >> (nitrogen@REDACTED)40> l(visitor_store). >> {module,visitor_store} >> >> (nitrogen@REDACTED)41> visitor_store:dump_visitors(). >> ** exception error: undefined function dets:tab2list/1 >> >> (nitrogen@REDACTED)42> visitor_store:dump_visitors1(). >> ** exception error: bad argument >> in function dets:select/2 >> called as dets:select(visitors,[{'_',[],['$_']}]) >> >> (nitrogen@REDACTED)43> visitor_store:dump_visitors2(). >> ** exception error: bad argument >> in function dets:match_object/2 >> called as dets:match_object(visitors,'_') >> >> I feel like I'm jinxed. >> >> Thanks, >> >> Lloyd >> >> >> >> >> -----Original Message----- >> From: "Ulf Wiger" >> Sent: Friday, May 30, 2014 4:08pm >> To: lloyd@REDACTED >> Cc: "erlang questions" >> Subject: Re: [erlang-questions] How to return all records in dets >> >> >> ets:tab2list(Tab). >> >> ets:select(Tab, [{?_?, [], [?$_?]}]). >> >> ets:select(Tab, ets:fun2ms(fun(X) -> X end). >> >> ets:match_object(Tab, ?_?) >> >> BR, >> Ulf W >> >> On 30 May 2014, at 21:56, lloyd@REDACTED wrote: >> >>> Hello, >>> >>> I'm cross-eyed from looking at match specifications. All I want to do is list all records in my small dets table. I once ran across a very neat query to accomplish that, but for the life can't Google it up. >>> >>> Can some kind soul give me a query that works? >>> >>> Many thanks, >>> >>> LRP >>> >>> >>> >>> _______________________________________________ >>> erlang-questions mailing list >>> erlang-questions@REDACTED >>> http://erlang.org/mailman/listinfo/erlang-questions >> >> Ulf Wiger, Co-founder & Developer Advocate, Feuerlabs Inc. >> http://feuerlabs.com >> >> >> >> >> >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://erlang.org/mailman/listinfo/erlang-questions From rvirding@REDACTED Fri May 30 23:41:44 2014 From: rvirding@REDACTED (Robert Virding) Date: Fri, 30 May 2014 23:41:44 +0200 Subject: [erlang-questions] Fwd: Trace bug? In-Reply-To: References: Message-ID: I tried this with erlang-bugs. Can anyone here help me with this? Robert ---------- Forwarded message ---------- From: Robert Virding Date: 27 May 2014 17:45 Subject: Trace bug? To: erlang-bugs We have discovered strange behaviour when tracing message sends. We turn on tracing message send for a process. In R16 and 17 it seems like there is no trace message when sending to a registered process name, while sending to a pid generates a trace message as it should. In R15 however you get a trace message both sending to a registered name and hen sending to a pid. Is this a bug or is it a new undocumented feature? As an example I include simple program in which worker sends a message to a registered server and the server replies by sending the worker pid. Here are outputs when running in 17: Erlang/OTP 17 [erts-6.0] [source-07b8f44] [64-bit] [smp:4:4] [async-threads:10] [hipe] [kernel-poll:false] [dtrace] Eshell V6.0 (abort with ^G) 1> c(trace_procs). {ok,trace_procs} 2> trace_procs:start(). trace_procs 7 Server: '<0.39.0>' trace_procs 10 Worker: '<0.40.0>' trace_procs 34 Message: '{trace,<0.39.0>,send,answer,<0.40.0>}' trace_procs 34 Message: '{trace,<0.39.0>,send,answer,<0.40.0>}' trace_procs 34 Message: '{trace,<0.39.0>,send,answer,<0.40.0>}' trace_procs 34 Message: '{trace,<0.39.0>,send,answer,<0.40.0>}' trace_procs 34 Message: '{trace,<0.39.0>,send,answer,<0.40.0>}' and in R15: Erlang R15B03 (erts-5.9.3.1) [source] [64-bit] [smp:4:4] [async-threads:0] [hipe] [kernel-poll:false] Eshell V5.9.3.1 (abort with ^G) 1> c(trace_procs). {ok,trace_procs} 2> trace_procs:start(). trace_procs 7 Server: '<0.38.0>' trace_procs 10 Worker: '<0.39.0>' trace_procs 34 Message: '{trace,<0.39.0>,send,{request,<0.39.0>},server}' trace_procs 34 Message: '{trace,<0.38.0>,send,answer,<0.39.0>}' trace_procs 34 Message: '{trace,<0.39.0>,send,{request,<0.39.0>},server}' trace_procs 34 Message: '{trace,<0.38.0>,send,answer,<0.39.0>}' trace_procs 34 Message: '{trace,<0.39.0>,send,{request,<0.39.0>},server}' trace_procs 34 Message: '{trace,<0.38.0>,send,answer,<0.39.0>}' trace_procs 34 Message: '{trace,<0.39.0>,send,{request,<0.39.0>},server}' What gives? Robert -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: trace_procs.erl Type: text/x-erlang Size: 896 bytes Desc: not available URL: From rvirding@REDACTED Fri May 30 23:46:07 2014 From: rvirding@REDACTED (Robert Virding) Date: Fri, 30 May 2014 23:46:07 +0200 Subject: [erlang-questions] What does Prompt in io:get_line/2 do? In-Reply-To: <538745A1.3060301@llaisdy.com> References: <53873F05.6080608@llaisdy.com> <538745A1.3060301@llaisdy.com> Message-ID: The prompt can be anything. It is ignored when sending input requests to devices for which prompting has no meaning, for example files. It is there to preserve the API. Robert On 29 May 2014 16:35, Ivan Uemlianin wrote: > Aha thanks. Special atoms. Also standard_error. > > Ivan > > > On 29/05/2014 15:24, Roger Lipscombe wrote: > >> 1> io:get_line(standard_io, foo). >> foohaskgjdhgsdg >> "haskgjdhgsdg\n" >> 2> io:get_line(standard_io, enter_something). >> enter_somethingsdgdsgsgsad >> "sdgdsgsgsad\n" >> 3> io:get_line(standard_io, 'meh>'). >> meh>fdasfhjdgfsadg >> "fdasfhjdgfsadg\n" >> >> On 29 May 2014 15:07, Ivan Uemlianin wrote: >> >>> Dear All >>> >>> Quick question! >>> >>> In io:get_line(IoDevice, Prompt), what is the point of Prompt? Just >>> using a >>> random atom seems to work fine. >>> >>> 1> {ok,F} = file:open("data.txt",[read, {encoding, utf8}]). >>> {ok,<0.36.0>} >>> 2> io:get_line(F, x). >>> "first line\n" >>> 3> io:get_line(F, y). >>> "second line\n" >>> % ... etc >>> >>> Thanks >>> >>> Ivan >>> >>> >>> -- >>> ============================================================ >>> Ivan A. Uemlianin PhD >>> Llaisdy >>> Speech Technology Research and Development >>> >>> ivan@REDACTED >>> www.llaisdy.com >>> llaisdy.wordpress.com >>> github.com/llaisdy >>> www.linkedin.com/in/ivanuemlianin >>> >>> festina lente >>> ============================================================ >>> _______________________________________________ >>> erlang-questions mailing list >>> erlang-questions@REDACTED >>> http://erlang.org/mailman/listinfo/erlang-questions >>> >> > -- > ============================================================ > Ivan A. Uemlianin PhD > Llaisdy > Speech Technology Research and Development > > ivan@REDACTED > www.llaisdy.com > llaisdy.wordpress.com > github.com/llaisdy > www.linkedin.com/in/ivanuemlianin > > festina lente > ============================================================ > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jay@REDACTED Sat May 31 06:03:54 2014 From: jay@REDACTED (Jay Nelson) Date: Fri, 30 May 2014 21:03:54 -0700 Subject: [erlang-questions] Reporting gen_server timings Message-ID: <24D91470-4EC5-4D65-A4EC-54AFAC754F25@duomark.com> The other suggestions are probably more direct and easier to integrate with Poolboy since you want to record the time waiting for available workers, but I have a library called Epocxy (https://github.com/duomark/epocxy) which includes ring buffers in ets. It is easy to use those to record timings concurrently. There is also a concurrency control (cxy_ctl.erl) module which automatically times executions (it uses a ring buffer which overwrites older values continuously, so you always have a window into the last N executions). You can either use concurrency, or set the concurrency configuration to ?none? and get synchronous inline execution but still have the timings recorded. When spawning, you get a timing for the initialization time and the execution time, but the times are not recorded until the spawn execution completes or fails. If you can arrange the init of a newly spawned request to block until a worker is available, you should automatically get both timings you want. jay From fritchie@REDACTED Sat May 31 07:03:48 2014 From: fritchie@REDACTED (Scott Lystig Fritchie) Date: Sat, 31 May 2014 00:03:48 -0500 Subject: [erlang-questions] How to return all records in dets In-Reply-To: Message of "Fri, 30 May 2014 15:56:33 CDT." Message-ID: <2898.1401512628@snookles.snookles.com> Garrett Smith wrote: gs> The trick here is to *never* make a mistake in the shell :) Or, prepend your commands at the shell CLI with "catch". Something like: Bad = "yo, I cause pain". {ok, D} = dets:open_file(...). catch dets:lookup(Bad, my_key). catch dets:lookup(D, my_key). ... would prevent using the bad DETS table name from a cascade that kills the shell CLI process than then closes the DETS table so that the second lookup() attempt also fails. -Scott From vinoski@REDACTED Sat May 31 16:20:01 2014 From: vinoski@REDACTED (Steve Vinoski) Date: Sat, 31 May 2014 10:20:01 -0400 Subject: [erlang-questions] How to return all records in dets In-Reply-To: <2898.1401512628@snookles.snookles.com> References: <2898.1401512628@snookles.snookles.com> Message-ID: On Sat, May 31, 2014 at 1:03 AM, Scott Lystig Fritchie < fritchie@REDACTED> wrote: > Garrett Smith wrote: > > gs> The trick here is to *never* make a mistake in the shell :) > > Or, prepend your commands at the shell CLI with "catch". Something > like: > > Bad = "yo, I cause pain". > {ok, D} = dets:open_file(...). > catch dets:lookup(Bad, my_key). > catch dets:lookup(D, my_key). > > ... would prevent using the bad DETS table name from a cascade that > kills the shell CLI process than then closes the DETS table so that the > second lookup() attempt also fails. Or use the big hammer, catch_exception(true): 1> catch_exception(true). false 2> Bad = "yo, I cause pain". "yo, I cause pain" 3> {ok, D} = dets:open_file(...). {ok,...} 4> dets:lookup(Bad, my_key). * exception error: bad argument in function dets:lookup/2 called as dets:lookup("yo, I cause pain",my_key) 5> dets:insert(D, {my_key, foo}). ok 6> dets:lookup(D, my_key). [{my_key,foo}] catch_exception(true) is really handy for these kinds of cases, including working with sockets in the shell. --steve -------------- next part -------------- An HTML attachment was scrubbed... URL: From lloyd@REDACTED Sat May 31 16:21:58 2014 From: lloyd@REDACTED (lloyd@REDACTED) Date: Sat, 31 May 2014 10:21:58 -0400 (EDT) Subject: [erlang-questions] How to return all records in dets In-Reply-To: <2898.1401512628@snookles.snookles.com> References: <2898.1401512628@snookles.snookles.com> Message-ID: <1401546118.12536376@apps.rackspace.com> Nice tip! Thank you. Lloyd -----Original Message----- From: "Scott Lystig Fritchie" Sent: Saturday, May 31, 2014 1:03am To: "Garrett Smith" Cc: "Lloyd Prentice" , "erlang questions" Subject: Re: [erlang-questions] How to return all records in dets Garrett Smith wrote: gs> The trick here is to *never* make a mistake in the shell :) Or, prepend your commands at the shell CLI with "catch". Something like: Bad = "yo, I cause pain". {ok, D} = dets:open_file(...). catch dets:lookup(Bad, my_key). catch dets:lookup(D, my_key). ... would prevent using the bad DETS table name from a cascade that kills the shell CLI process than then closes the DETS table so that the second lookup() attempt also fails. -Scott From lloyd@REDACTED Sat May 31 16:27:40 2014 From: lloyd@REDACTED (lloyd@REDACTED) Date: Sat, 31 May 2014 10:27:40 -0400 (EDT) Subject: [erlang-questions] How to return all records in dets In-Reply-To: References: <2898.1401512628@snookles.snookles.com> Message-ID: <1401546460.78868850@apps.rackspace.com> Thanks all, You've definitely taken me a step deeper into understanding Erlang. Best, Lloyd -----Original Message----- From: "Steve Vinoski" Sent: Saturday, May 31, 2014 10:20am To: "Scott Lystig Fritchie" Cc: "erlang questions" Subject: Re: [erlang-questions] How to return all records in dets _______________________________________________ erlang-questions mailing list erlang-questions@REDACTED http://erlang.org/mailman/listinfo/erlang-questions On Sat, May 31, 2014 at 1:03 AM, Scott Lystig Fritchie < fritchie@REDACTED> wrote: > Garrett Smith wrote: > > gs> The trick here is to *never* make a mistake in the shell :) > > Or, prepend your commands at the shell CLI with "catch". Something > like: > > Bad = "yo, I cause pain". > {ok, D} = dets:open_file(...). > catch dets:lookup(Bad, my_key). > catch dets:lookup(D, my_key). > > ... would prevent using the bad DETS table name from a cascade that > kills the shell CLI process than then closes the DETS table so that the > second lookup() attempt also fails. Or use the big hammer, catch_exception(true): 1> catch_exception(true). false 2> Bad = "yo, I cause pain". "yo, I cause pain" 3> {ok, D} = dets:open_file(...). {ok,...} 4> dets:lookup(Bad, my_key). * exception error: bad argument in function dets:lookup/2 called as dets:lookup("yo, I cause pain",my_key) 5> dets:insert(D, {my_key, foo}). ok 6> dets:lookup(D, my_key). [{my_key,foo}] catch_exception(true) is really handy for these kinds of cases, including working with sockets in the shell. --steve From erlang@REDACTED Sat May 31 19:53:35 2014 From: erlang@REDACTED (Joe Armstrong) Date: Sat, 31 May 2014 19:53:35 +0200 Subject: [erlang-questions] How to return all records in dets In-Reply-To: <1401479806.358332223@apps.rackspace.com> References: <1401479806.358332223@apps.rackspace.com> Message-ID: The thing to Google for is "dets man erlang" - which should get you the man page (even better is to store the man pages locally and do "erl -man dets") You want to "list" all records (I'm not sure what list means here - it might mean "print" or "make a list of"). To make a list of all records you could say: dets:foldl(fun(X, L) -> [X|L] end, [], Name) (Most collections - ie dets, ets, dict, etc. offer some kind of fold operation that traverses all objects in the collection) To print all records dets:traverse(Name, fun(X) -> io:format("~p~n",[X]), continue end) No need to worry about match specifications. The best place to start is usually by reading the man pages. Now that Erlang is is becoming popular you'll find a lot of incorrect solutions to problems posted on stackoverlow. Best approach is 0) ask an expert 1) read the man pages for the module, in question 2) experiment with the functions in the man pages in the shell 3) ask/tell this list if the manual pages are ambiguous or incomprehensible 4) search Google/stackoverflow Cheers /Joe On Fri, May 30, 2014 at 9:56 PM, wrote: > Hello, > > I'm cross-eyed from looking at match specifications. All I want to do is > list all records in my small dets table. I once ran across a very neat > query to accomplish that, but for the life can't Google it up. > > Can some kind soul give me a query that works? > > Many thanks, > > LRP > > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From lloyd@REDACTED Sat May 31 20:44:21 2014 From: lloyd@REDACTED (lloyd@REDACTED) Date: Sat, 31 May 2014 14:44:21 -0400 (EDT) Subject: [erlang-questions] How to return all records in dets In-Reply-To: References: <1401479806.358332223@apps.rackspace.com> Message-ID: <1401561861.18413033@apps.rackspace.com> Hi Joe, I've resorted to approach 0 many times and much appreciate the generous help I've received from the community. Indeed, response from the author of my Erlang bible is particularly awesome. I hope one day to be competent enough to play it forward. I also spend a great deal of time in the Erlang man pages. Problem is that I'm one of those soft-headed liberal arts types. So, I often find the man pages near incomprehensible (and not only Erlang). Yes, I perhaps should have taken more math classes to grasp the elegant concision. But my mind doesn't seem to be wired that way. I can't tell you how many times I've looked at the foldl/n docs and tried to understand what the hell is going on. I get the general drift, but can't bring it down to useful code. There's just too much inside-baseball. As a self-taught-from-books-and-web Erlang aspirant, I find concrete examples and well-written tutorials most helpful. This gives me leverage to apply your approach 3. In general, the concepts of Erlang are simple enough once I grasp them. In fact, I marvel at the pragmatic elegance. Your books provide particularly lucid explications. But the man pages? My how I wish I had the time and chops to write a parallel set for noobies. Indeed, would it be helpful if I walked through and commented on the man doc items that give me headaches? Many thanks again for your kind help, Lloyd -----Original Message----- From: "Joe Armstrong" Sent: Saturday, May 31, 2014 1:53pm To: "Lloyd Prentice" Cc: "Erlang-Questions Questions" Subject: Re: [erlang-questions] How to return all records in dets The thing to Google for is "dets man erlang" - which should get you the man page (even better is to store the man pages locally and do "erl -man dets") You want to "list" all records (I'm not sure what list means here - it might mean "print" or "make a list of"). To make a list of all records you could say: dets:foldl(fun(X, L) -> [X|L] end, [], Name) (Most collections - ie dets, ets, dict, etc. offer some kind of fold operation that traverses all objects in the collection) To print all records dets:traverse(Name, fun(X) -> io:format("~p~n",[X]), continue end) No need to worry about match specifications. The best place to start is usually by reading the man pages. Now that Erlang is is becoming popular you'll find a lot of incorrect solutions to problems posted on stackoverlow. Best approach is 0) ask an expert 1) read the man pages for the module, in question 2) experiment with the functions in the man pages in the shell 3) ask/tell this list if the manual pages are ambiguous or incomprehensible 4) search Google/stackoverflow Cheers /Joe On Fri, May 30, 2014 at 9:56 PM, wrote: > Hello, > > I'm cross-eyed from looking at match specifications. All I want to do is > list all records in my small dets table. I once ran across a very neat > query to accomplish that, but for the life can't Google it up. > > Can some kind soul give me a query that works? > > Many thanks, > > LRP > > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions >