From anthonym@REDACTED Thu Dec 1 00:06:31 2011 From: anthonym@REDACTED (Anthony Molinaro) Date: Wed, 30 Nov 2011 15:06:31 -0800 Subject: [erlang-questions] Chinese whisper problem In-Reply-To: References: Message-ID: <20111130230631.GA26092@alumni.caltech.edu> On Fri, Nov 25, 2011 at 04:18:09PM +0100, Joe Armstrong wrote: > I guess you all know about Chinese whispers. > > You send a whispered message round a circle and see if you get the same > message back. > > The computer variant is as follows: > > Send a complex data structure round a circle, and see if you get the same > message back. Sorry I'm late to the party with this one, but was out of town for a bit. I have used thrift, protobuffs and lwes to do binary multi-language message exchange, which is not quite the whispers problem but close. They all contain serializers and deserializers and each support different sorts of things. Thrift is mainly meant for RPC, so if all you want is a binary serialization format, it's a bit tricky (mostly in erlang, less so in java), in that you have to create a memory serializer and construct the terms then do a term_to_binary on them, to get a binary you could do what you want with. On the other hand it supports many languages (include erlang and javascript), and several protocols (sockets and http being the most common). It can have fairly complex structures like maps (which become dict's in erlang), lists, different sized ints, floats, etc. Protobufs also off fairly complex structures (although not maps, you sort of have to do those yourself with repeated structures which will become lists of records, so not quite as useful), as well as strings, ints, floats and binary data. It does not include any RPC based mechanism, and you basically get serializers/deserializers which get/give binaries, so you can use it with whatever you want. Riak uses this as its faster interface via a socket and I've implemented server to server communication over HTTP which is easy. LWES (http://lwes.github.com/) is a system and protocol I first developed in 1998 and which was open sourced in 2008. It's mostly meant for passing maps in a fire and forget fashion over UDP (or multicast UDP), it's a bit bulkier on the wire than thrift and protobuffs as the serialization format is self describing (key names are sent along with values). It also only has support in java for floats and arrays (but those will probably make their way into the other languages as time permits). It currently has native bindings for C, erlang, java, and .Net, as well as SWIG based bindings for perl, python and ruby. It's a great system for quickly passing maps between different programming languages where you can afford to loose some data here or there. Also, unlike thrift/protobuff it does not require any precompilation of modules. While we don't have a javascript version yet, we may be developing one soon (although it most likely won't be able to do UDP from a javascript client which is unfortunate). LWES is extremely stable and has been in production systems serving trillions of events for almost 13 years (every penny ever made by Goto/Overture/Yahoo's search advertising system was via lwes). I've used all three of these systems in production web systems so can attest that they all work and at large scale (ten's of thousands to hundred's of thousands of requests per second). I've not used Bert, BSON, Avro, MessagePack or Etch all of which do similiar things but offer slightly different feature sets. Hope that helps, -Anthony -- ------------------------------------------------------------------------ Anthony Molinaro From sunwood360@REDACTED Thu Dec 1 01:41:51 2011 From: sunwood360@REDACTED (envelopes envelopes) Date: Wed, 30 Nov 2011 16:41:51 -0800 Subject: [erlang-questions] Chinese whisper problem In-Reply-To: <20111130230631.GA26092@alumni.caltech.edu> References: <20111130230631.GA26092@alumni.caltech.edu> Message-ID: I remember there is also messagepack that supports erlang, It has good performance. In addition, there is Avro. On Nov 30, 2011 3:07 PM, "Anthony Molinaro" wrote: > On Fri, Nov 25, 2011 at 04:18:09PM +0100, Joe Armstrong wrote: > > I guess you all know about Chinese whispers. > > > > You send a whispered message round a circle and see if you get the same > > message back. > > > > The computer variant is as follows: > > > > Send a complex data structure round a circle, and see if you get the same > > message back. > > Sorry I'm late to the party with this one, but was out of town for a bit. > > I have used thrift, protobuffs and lwes to do binary multi-language > message exchange, which is not quite the whispers problem but close. > They all contain serializers and deserializers and each support different > sorts of things. > > Thrift is mainly meant for RPC, so if all you want is a binary > serialization > format, it's a bit tricky (mostly in erlang, less so in java), in that you > have to create a memory serializer and construct the terms then do a > term_to_binary on them, to get a binary you could do what you want with. > On the other hand it supports many languages (include erlang and > javascript), > and several protocols (sockets and http being the most common). It can > have > fairly complex structures like maps (which become dict's in erlang), lists, > different sized ints, floats, etc. > > Protobufs also off fairly complex structures (although not maps, you sort > of > have to do those yourself with repeated structures which will become lists > of records, so not quite as useful), as well as strings, ints, floats and > binary data. It does not include any RPC based mechanism, and you > basically > get serializers/deserializers which get/give binaries, so you can use it > with whatever you want. Riak uses this as its faster interface via a > socket > and I've implemented server to server communication over HTTP which is > easy. > > LWES (http://lwes.github.com/) is a system and protocol I first developed > in 1998 and which was open sourced in 2008. It's mostly meant for passing > maps in a fire and forget fashion over UDP (or multicast UDP), it's a bit > bulkier on the wire than thrift and protobuffs as the serialization format > is self describing (key names are sent along with values). It also only > has support in java for floats and arrays (but those will probably make > their way into the other languages as time permits). It currently > has native bindings for C, erlang, java, and .Net, as well as SWIG based > bindings for perl, python and ruby. It's a great system for quickly > passing maps between different programming languages where you can afford > to loose some data here or there. Also, unlike thrift/protobuff it does > not require any precompilation of modules. While we don't have a > javascript > version yet, we may be developing one soon (although it most likely won't > be able to do UDP from a javascript client which is unfortunate). LWES > is extremely stable and has been in production systems serving trillions > of events for almost 13 years (every penny ever made by > Goto/Overture/Yahoo's > search advertising system was via lwes). > > I've used all three of these systems in production web systems so can > attest > that they all work and at large scale (ten's of thousands to hundred's of > thousands of requests per second). > > I've not used Bert, BSON, Avro, MessagePack or Etch all of which do > similiar things but offer slightly different feature sets. > > Hope that helps, > > -Anthony > > -- > ------------------------------------------------------------------------ > Anthony Molinaro > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From fireflyc@REDACTED Thu Dec 1 03:05:37 2011 From: fireflyc@REDACTED (=?GB2312?B?0M/JrQ==?=) Date: Thu, 1 Dec 2011 10:05:37 +0800 Subject: [erlang-questions] Chinese whisper problem In-Reply-To: References: <20111130230631.GA26092@alumni.caltech.edu> Message-ID: protobufs, thrift and other "human-readable binary protocol" is the best choice,small message packets,decoding and encoding fast speed is fast. 2011/12/1 envelopes envelopes > I remember there is also messagepack that supports erlang, It has good > performance. > > In addition, there is Avro. > On Nov 30, 2011 3:07 PM, "Anthony Molinaro" > wrote: > >> On Fri, Nov 25, 2011 at 04:18:09PM +0100, Joe Armstrong wrote: >> > I guess you all know about Chinese whispers. >> > >> > You send a whispered message round a circle and see if you get the same >> > message back. >> > >> > The computer variant is as follows: >> > >> > Send a complex data structure round a circle, and see if you get the >> same >> > message back. >> >> Sorry I'm late to the party with this one, but was out of town for a bit. >> >> I have used thrift, protobuffs and lwes to do binary multi-language >> message exchange, which is not quite the whispers problem but close. >> They all contain serializers and deserializers and each support different >> sorts of things. >> >> Thrift is mainly meant for RPC, so if all you want is a binary >> serialization >> format, it's a bit tricky (mostly in erlang, less so in java), in that you >> have to create a memory serializer and construct the terms then do a >> term_to_binary on them, to get a binary you could do what you want with. >> On the other hand it supports many languages (include erlang and >> javascript), >> and several protocols (sockets and http being the most common). It can >> have >> fairly complex structures like maps (which become dict's in erlang), >> lists, >> different sized ints, floats, etc. >> >> Protobufs also off fairly complex structures (although not maps, you sort >> of >> have to do those yourself with repeated structures which will become lists >> of records, so not quite as useful), as well as strings, ints, floats and >> binary data. It does not include any RPC based mechanism, and you >> basically >> get serializers/deserializers which get/give binaries, so you can use it >> with whatever you want. Riak uses this as its faster interface via a >> socket >> and I've implemented server to server communication over HTTP which is >> easy. >> >> LWES (http://lwes.github.com/) is a system and protocol I first developed >> in 1998 and which was open sourced in 2008. It's mostly meant for passing >> maps in a fire and forget fashion over UDP (or multicast UDP), it's a bit >> bulkier on the wire than thrift and protobuffs as the serialization format >> is self describing (key names are sent along with values). It also only >> has support in java for floats and arrays (but those will probably make >> their way into the other languages as time permits). It currently >> has native bindings for C, erlang, java, and .Net, as well as SWIG based >> bindings for perl, python and ruby. It's a great system for quickly >> passing maps between different programming languages where you can afford >> to loose some data here or there. Also, unlike thrift/protobuff it does >> not require any precompilation of modules. While we don't have a >> javascript >> version yet, we may be developing one soon (although it most likely won't >> be able to do UDP from a javascript client which is unfortunate). LWES >> is extremely stable and has been in production systems serving trillions >> of events for almost 13 years (every penny ever made by >> Goto/Overture/Yahoo's >> search advertising system was via lwes). >> >> I've used all three of these systems in production web systems so can >> attest >> that they all work and at large scale (ten's of thousands to hundred's of >> thousands of requests per second). >> >> I've not used Bert, BSON, Avro, MessagePack or Etch all of which do >> similiar things but offer slightly different feature sets. >> >> Hope that helps, >> >> -Anthony >> >> -- >> ------------------------------------------------------------------------ >> Anthony Molinaro >> _______________________________________________ >> 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 > > -- ??blog http://blog.sina.com.cn/xingsen -------------- next part -------------- An HTML attachment was scrubbed... URL: From barcojie@REDACTED Thu Dec 1 08:02:11 2011 From: barcojie@REDACTED (Barco You) Date: Thu, 1 Dec 2011 15:02:11 +0800 Subject: [erlang-questions] function flush/0 undefined Message-ID: It's strange that when I compile a module with flush() in some functions I got error: function flush/0 undefined, but the flush() can be executed in the erl shell. What's wrong with my program. BRs, Barco -------------- next part -------------- An HTML attachment was scrubbed... URL: From gleber.p@REDACTED Thu Dec 1 08:09:49 2011 From: gleber.p@REDACTED (Gleb Peregud) Date: Thu, 1 Dec 2011 08:09:49 +0100 Subject: [erlang-questions] function flush/0 undefined In-Reply-To: References: Message-ID: On Thu, Dec 1, 2011 at 08:02, Barco You wrote: > It's strange that when I compile a module with flush() in some functions I > got error:?function flush/0 undefined, but the flush() can be executed in > the erl shell. > > What's wrong with my program. Actually flush/0 is defined in module shell_default.erl (which calls c:flush/0), which also has all functions, which are shown when you invoke "help()." in the shell. They are imported to the shell, so you can invoke them without module name. From joelr1@REDACTED Thu Dec 1 13:59:42 2011 From: joelr1@REDACTED (Joel Reymont) Date: Thu, 1 Dec 2011 12:59:42 +0000 Subject: [erlang-questions] try to find the crash report (a challenge) Message-ID: <66CA15C5-7C44-4589-B870-18E24370011D@gmail.com> https://github.com/wagerlabs/mod_crash This is a super-simple httpd plugin module that crashes. I cannot find the crash report, can you? Help! -------------------------------------------------------------------------- - for hire: mac osx device driver ninja, kernel extensions and usb drivers ---------------------+------------+--------------------------------------- http://wagerlabs.com | @wagerlabs | http://www.linkedin.com/in/joelreymont ---------------------+------------+--------------------------------------- From joelr1@REDACTED Thu Dec 1 14:17:58 2011 From: joelr1@REDACTED (Joel Reymont) Date: Thu, 1 Dec 2011 13:17:58 +0000 Subject: [erlang-questions] problem with inets httpd? (was Re: try to find the crash report (a challenge)) In-Reply-To: <66CA15C5-7C44-4589-B870-18E24370011D@gmail.com> References: <66CA15C5-7C44-4589-B870-18E24370011D@gmail.com> Message-ID: <7F0B433D-7221-4A56-89E7-5B70D8E44DF9@gmail.com> Could this be a problem with the supervision tree of inets? -------------------------------------------------------------------------- - for hire: mac osx device driver ninja, kernel extensions and usb drivers ---------------------+------------+--------------------------------------- http://wagerlabs.com | @wagerlabs | http://www.linkedin.com/in/joelreymont ---------------------+------------+--------------------------------------- From yrashk@REDACTED Thu Dec 1 14:34:49 2011 From: yrashk@REDACTED (Yurii Rashkovskii) Date: Thu, 1 Dec 2011 05:34:49 -0800 (PST) Subject: [erlang-questions] try to find the crash report (a challenge) In-Reply-To: <66CA15C5-7C44-4589-B870-18E24370011D@gmail.com> References: <66CA15C5-7C44-4589-B870-18E24370011D@gmail.com> Message-ID: <10500247.369.1322746489974.JavaMail.geo-discussion-forums@prfi36> The problem is in httpd. httpd_request_handler has this: PROCESSED = (catch Module:Function([Data | Args])), so it will swallow your crash. Besides, the case statement right after that seems to be fairly wrong. It has an all-catch clause NewMFA, and it assumes PROCESSED is a new MFA if it is nothing that matched before. That means, an EXIT tuple will be treated as a new MFA. Unless I'm missing something, this is just wrong. -------------- next part -------------- An HTML attachment was scrubbed... URL: From joelr1@REDACTED Thu Dec 1 14:36:26 2011 From: joelr1@REDACTED (Joel Reymont) Date: Thu, 1 Dec 2011 13:36:26 +0000 Subject: [erlang-questions] try to find the crash report (a challenge) In-Reply-To: <10500247.369.1322746489974.JavaMail.geo-discussion-forums@prfi36> References: <66CA15C5-7C44-4589-B870-18E24370011D@gmail.com> <10500247.369.1322746489974.JavaMail.geo-discussion-forums@prfi36> Message-ID: <81EEBC7D-D2CD-4F6F-AC1A-7FB209C31D0D@gmail.com> You can get the crash reports in /tmp/error.log (in my case). This works if the list of httpd modules is set to [mod_log, mod_crash]. There's still nothing shown via regular SASL channels. On Dec 1, 2011, at 1:34 PM, Yurii Rashkovskii wrote: > The problem is in httpd. httpd_request_handler has this: > > PROCESSED = (catch Module:Function([Data | Args])), > > so it will swallow your crash. Besides, the case statement right after that seems to be fairly wrong. It has an all-catch clause NewMFA, and it assumes PROCESSED is a new MFA if it is nothing that matched before. That means, an EXIT tuple will be treated as a new MFA. Unless I'm missing something, this is just wrong. -------------------------------------------------------------------------- - for hire: mac osx device driver ninja, kernel extensions and usb drivers ---------------------+------------+--------------------------------------- http://wagerlabs.com | @wagerlabs | http://www.linkedin.com/in/joelreymont ---------------------+------------+--------------------------------------- From andre@REDACTED Thu Dec 1 14:49:48 2011 From: andre@REDACTED (Andre Nathan) Date: Thu, 01 Dec 2011 11:49:48 -0200 Subject: [erlang-questions] ei_connect fails sometimes with EIO In-Reply-To: <1322562357.10096.1.camel@andre> References: <1322246603.3752.8.camel@andre> <1322562357.10096.1.camel@andre> Message-ID: <1322747388.2705.4.camel@andre> On Tue, 2011-11-29 at 08:25 -0200, Andre Nathan wrote: > On Tue, 2011-11-29 at 17:20 +0800, Wei Cao wrote: > > I had similar problems before, when I read user information inside > > mnesia database > > times to times from a proxy written in C. Each time, I acquire a > > connection via ei_connect() > > and close it after user info is read. > > Interesting, that's exactly what I'm doing... > > I'll try your patch and report back. This, together with the fix to use unique node names made the errors go away. Maybe this patch could be sent upstream? Thanks! Andre From joelr1@REDACTED Thu Dec 1 16:07:23 2011 From: joelr1@REDACTED (Joel Reymont) Date: Thu, 1 Dec 2011 15:07:23 +0000 Subject: [erlang-questions] cowboy options via application config Message-ID: <8875EE33-2921-43D8-9C60-F31B5BED9CD9@gmail.com> Is there a way to pass options to cowboy listeners via the application's config file, e.g. rebar's sys.config? In the code below, I'd rather have the transport, port, key file and password in a config file. Thanks, Joel --- cowboy:start_listener(http, 100, cowboy_tcp_transport, [{port, 8080}], cowboy_http_protocol, [{dispatch, Dispatch}] ), cowboy:start_listener(https, 100, cowboy_ssl_transport, [ {port, 8443}, {certfile, "priv/ssl/cert.pem"}, {keyfile, "priv/ssl/key.pem"}, {password, "cowboy"}], cowboy_http_protocol, [{dispatch, Dispatch}] ), -------------------------------------------------------------------------- - for hire: mac osx device driver ninja, kernel extensions and usb drivers ---------------------+------------+--------------------------------------- http://wagerlabs.com | @wagerlabs | http://www.linkedin.com/in/joelreymont ---------------------+------------+--------------------------------------- From bob@REDACTED Thu Dec 1 17:03:11 2011 From: bob@REDACTED (Bob Ippolito) Date: Thu, 1 Dec 2011 08:03:11 -0800 Subject: [erlang-questions] cowboy options via application config In-Reply-To: <8875EE33-2921-43D8-9C60-F31B5BED9CD9@gmail.com> References: <8875EE33-2921-43D8-9C60-F31B5BED9CD9@gmail.com> Message-ID: You could just call the appropriate application module functions to get the data from keys in your app's config. On Thursday, December 1, 2011, Joel Reymont wrote: > Is there a way to pass options to cowboy listeners via the application's config file, e.g. rebar's sys.config? > > In the code below, I'd rather have the transport, port, key file and password in a config file. > > Thanks, Joel > > --- > > cowboy:start_listener(http, 100, > cowboy_tcp_transport, [{port, 8080}], > cowboy_http_protocol, [{dispatch, Dispatch}] > ), > cowboy:start_listener(https, 100, > cowboy_ssl_transport, [ > {port, 8443}, {certfile, "priv/ssl/cert.pem"}, > {keyfile, "priv/ssl/key.pem"}, {password, "cowboy"}], > cowboy_http_protocol, [{dispatch, Dispatch}] > ), > > -------------------------------------------------------------------------- > - for hire: mac osx device driver ninja, kernel extensions and usb drivers > ---------------------+------------+--------------------------------------- > http://wagerlabs.com | @wagerlabs | http://www.linkedin.com/in/joelreymont > ---------------------+------------+--------------------------------------- > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From chad@REDACTED Thu Dec 1 17:17:13 2011 From: chad@REDACTED (Chad Phillips -- Apartment Lines) Date: Thu, 1 Dec 2011 08:17:13 -0800 Subject: [erlang-questions] ODBC to Erlang data mapping problem on OS X Message-ID: According to http://www.erlang.org/doc/apps/odbc/databases.html#type, the SQL_WVARCHAR ODBC data type should be translated by Erlang's ODBC driver to "Unicode binary encoded as UTF16 little endian." This works as expected on Linux, but I'm having issues on OS X, where it appears it's getting translated to UTF32 little endian, instead of UTF16 little endian. I'm using Erlang R14B04 on both machines, with the exact same database table, does anybody have an idea why this might be occurring, and how to remedy it? Additional info below for those interested. Thanks! Chad TABLE ON BOTH ARCHITECTURES: CREATE TABLE `foo` ( `bar` varchar(255) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8; LINUX ERLANG SESSION: (alaem@REDACTED)1> odbc:start(). ok (alaem@REDACTED)2> {ok, Ref} = odbc:connect("DSN=testing;Option=3", []). {ok,<0.90.0>} (alaem@REDACTED)3> odbc:describe_table(Ref, "foo"). {ok,[{"bar",{sql_wvarchar,255}}]} (alaem@REDACTED)4> odbc:select_count(Ref, "SELECT * FROM foo"). {ok,1} (alaem@REDACTED)5> {selected, Columns, [{Bar}]} = odbc:next(Ref). {selected,["bar"],[{<<98,0,97,0,122,0>>}]} (alaem@REDACTED)6> unicode:characters_to_list(Bar, {utf16, little}). "baz" (alaem@REDACTED)7> unicode:characters_to_list(Bar, {utf32, little}). {error,[],<<98,0,97,0,122,0>>} OS X ERLANG SESSION: (alaem@REDACTED)1> odbc:start(). ok (alaem@REDACTED)2> {ok, Ref} = odbc:connect("DSN=testing;Option=3", []). {ok,<0.90.0>} (alaem@REDACTED)3> odbc:describe_table(Ref, "foo"). {ok,[{"bar",{sql_wvarchar,255}}]} (alaem@REDACTED)4> odbc:select_count(Ref, "SELECT * FROM foo"). {ok,1} (alaem@REDACTED)5> {selected, Columns, [{Bar}]} = odbc:next(Ref). {selected,["bar"],[{<<98,0,0,0,97,0,0,0,122,0,0,0>>}]} (alaem@REDACTED)6> unicode:characters_to_list(Bar, {utf16, little}). [98,0,97,0,122,0] (alaem@REDACTED)7> unicode:characters_to_list(Bar, {utf32, little}). "baz" From joelr1@REDACTED Thu Dec 1 17:19:32 2011 From: joelr1@REDACTED (Joel Reymont) Date: Thu, 1 Dec 2011 16:19:32 +0000 Subject: [erlang-questions] cowboy options via application config In-Reply-To: References: <8875EE33-2921-43D8-9C60-F31B5BED9CD9@gmail.com> Message-ID: <7BAC2B2B-715E-4977-873B-91D9279B892A@gmail.com> That's what I ended up doing, thanks! On Dec 1, 2011, at 4:03 PM, Bob Ippolito wrote: > You could just call the appropriate application module functions to get the data from keys in your app's config. -------------------------------------------------------------------------- - for hire: mac osx device driver ninja, kernel extensions and usb drivers ---------------------+------------+--------------------------------------- http://wagerlabs.com | @wagerlabs | http://www.linkedin.com/in/joelreymont ---------------------+------------+--------------------------------------- From dmercer@REDACTED Thu Dec 1 18:20:08 2011 From: dmercer@REDACTED (David Mercer) Date: Thu, 1 Dec 2011 11:20:08 -0600 Subject: [erlang-questions] Accessing SSAS From Erlang Message-ID: <00ff01ccb04d$7b0b4bd0$7121e370$@com> I use the odbc module to access the SQL Server relational database, but my Google-fu is not strong enough to figure out how access the SQL Server Analysis Services side of the database. I would like to be able to connect and execute MDX and XMLA commands on an SSAS 2008 instance. Does anyone have any ideas as to how to do this? Please advise. Thank-you. Cheers, DBM -------------- next part -------------- An HTML attachment was scrubbed... URL: From comptekki@REDACTED Thu Dec 1 18:37:11 2011 From: comptekki@REDACTED (Wes James) Date: Thu, 1 Dec 2011 10:37:11 -0700 Subject: [erlang-questions] Accessing SSAS From Erlang In-Reply-To: <00ff01ccb04d$7b0b4bd0$7121e370$@com> References: <00ff01ccb04d$7b0b4bd0$7121e370$@com> Message-ID: Does this help? http://msdn.microsoft.com/en-us/library/ms159219.aspx -wes On Thu, Dec 1, 2011 at 10:20 AM, David Mercer wrote: > I use the odbc module to access the SQL Server relational database, but my > Google-fu is not strong enough to figure out how access the SQL Server > Analysis Services side of the database.? I would like to be able to connect > and execute MDX and XMLA commands on an SSAS 2008 instance.? Does anyone > have any ideas as to how to do this?? Please advise.? Thank-you. > > > > Cheers, > > > > DBM > > > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > From comptekki@REDACTED Thu Dec 1 18:38:21 2011 From: comptekki@REDACTED (Wes James) Date: Thu, 1 Dec 2011 10:38:21 -0700 Subject: [erlang-questions] Accessing SSAS From Erlang In-Reply-To: <00ff01ccb04d$7b0b4bd0$7121e370$@com> References: <00ff01ccb04d$7b0b4bd0$7121e370$@com> Message-ID: or maybe...: http://www.ssas-info.com/analysis-services-faq/27-mdx/51-can-i-execute-mdx-query-from-sql-server-openquery-addlinkedserver -wes On Thu, Dec 1, 2011 at 10:20 AM, David Mercer wrote: > I use the odbc module to access the SQL Server relational database, but my > Google-fu is not strong enough to figure out how access the SQL Server > Analysis Services side of the database.? I would like to be able to connect > and execute MDX and XMLA commands on an SSAS 2008 instance.? Does anyone > have any ideas as to how to do this?? Please advise.? Thank-you. > > > > Cheers, > > > > DBM > > > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > From robert.virding@REDACTED Fri Dec 2 05:21:54 2011 From: robert.virding@REDACTED (Robert Virding) Date: Fri, 02 Dec 2011 04:21:54 -0000 (GMT) Subject: [erlang-questions] Erlounge in Melbourne this week? In-Reply-To: Message-ID: <60837e6a-a5e3-424b-90ff-e7c50c4c370a@knuth> A big thanks to those who could make it, I had a good time. Robert ----- Original Message ----- > The suggestion is that we meet at Beer Deluxe in Federation Square. I > have to meet a guy (business) at around 17.30. It shouldn't take > long so for me some time after 18.15. How does this suit people? > > You can call me on my mobile +46702605355. > > Robert > > ----- Original Message ----- > > +1. > > > > This would be fantastic. Where are all the Melburnians? > > > > I've tried to contact those I know of but it seems they're all > > unavailable > > :( > > > > Surely I'm not the only one?? > > > > - Edmond - > > > > > > On Mon, 28 Nov 2011 15:34:36 +1100, Robert Virding > > wrote: > > > > > I am in Melbourne this week for the YOW Australia conference and > > > an > > > erlang course. Anyone interested in having an Erlounge on > > > Wednesday > > > 30/11 evening for some erlang talk and beer? > > > > > > Robert > > > _______________________________________________ > > > erlang-questions mailing list > > > erlang-questions@REDACTED > > > http://erlang.org/mailman/listinfo/erlang-questions > > > > > > -- > > Using Opera's revolutionary e-mail client: > > http://www.opera.com/mail/ > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > From kostis@REDACTED Fri Dec 2 08:05:01 2011 From: kostis@REDACTED (Kostis Sagonas) Date: Fri, 02 Dec 2011 09:05:01 +0200 Subject: [erlang-questions] Dialyzer from the Erlang API In-Reply-To: References: Message-ID: <4ED8789D.2090409@cs.ntua.gr> On 11/27/11 23:21, Eric Merritt wrote: > Guys, > > I have a quick and hopefully easy question. Running dialyzer from the > Erlang API seems to take significantly longer and use significantly > more CPU then running it from the compiled 'dialyzer' executable with > the same options, or ostensibly what should be the same options. It > might be that calling dialyzer from the API does not invoke the native > code compilation that happens when called from the command line. Thats > supposition on my part, but its all I can think of that might be > causing this problem. In any case, it would be very good to know why > this might be and perhaps a way to get similar behaviour from the two > methods. It was neither quick nor easy question to answer. I've tried to reproduce this but I've failed miserably :-( In retrospect, I should not have bothered to spend time on this as you give no information: no Erlang version and platform that you use, no code base on which this happens, etc. If you are still experiencing the behaviour you are describing, please send (perhaps off-list) an example that can be used to investigate this. Kostis From roberto@REDACTED Fri Dec 2 08:58:22 2011 From: roberto@REDACTED (Roberto Ostinelli) Date: Thu, 1 Dec 2011 23:58:22 -0800 Subject: [erlang-questions] cassandra Message-ID: dear list, is anyone working on a *real* cassandra client? i've looked around but all i found were sparse examples and a simple client which hasn't commits since last march. r. -------------- next part -------------- An HTML attachment was scrubbed... URL: From arjan@REDACTED Fri Dec 2 09:52:44 2011 From: arjan@REDACTED (Arjan Scherpenisse) Date: Fri, 02 Dec 2011 09:52:44 +0100 Subject: [erlang-questions] binary_to_term strangeness Message-ID: <4ED891DC.9060000@scherpenisse.net> Hi list, In the zotonic project I've stumbled on a strange issue that maybe rings a bell with someone on this list. Basically, we have some term_to_binary encoded data in the database that can no longer be decoded. it seems that somewhere an encoded binary is 2 bytes longer than its length. A full discussion can be found here: https://github.com/zotonic/zotonic/issues/272 The binary was encoded either with R13B03, R14B03 or R14B04 (the site's has database moved across different servers) In these releases, has anything been changed to the binary encoding/decoding of terms? Thanks, Arjan -- Arjan Scherpenisse ----- New media art, research, development arjan@REDACTED +31641322599 - http://scherpenisse.net From barcojie@REDACTED Fri Dec 2 10:30:54 2011 From: barcojie@REDACTED (Barco You) Date: Fri, 2 Dec 2011 17:30:54 +0800 Subject: [erlang-questions] illegal guard expression for IF illegal guard expression for "if" Message-ID: Why does the following expression got "illegal guard expression" when compiling: X = 0.5, if random:uniform() < X -> %error reported for this line good; true -> bad end. But if I change it to following expression, it's ok: X = 0.5, Ran = random:uniform(), if Ran < X -> good; true -> bad end. BRs, Barco -------------- next part -------------- An HTML attachment was scrubbed... URL: From spawn.think@REDACTED Fri Dec 2 10:38:28 2011 From: spawn.think@REDACTED (Ahmed Omar) Date: Fri, 2 Dec 2011 10:38:28 +0100 Subject: [erlang-questions] illegal guard expression for IF illegal guard expression for "if" In-Reply-To: References: Message-ID: Because "the guard expression must be guaranteed to be free of side effects" http://www.erlang.org/doc/reference_manual/expressions.html#id201090 So you are not allowed to have a function call there, except for allowed BIFs that satisfy that condition On Fri, Dec 2, 2011 at 10:30 AM, Barco You wrote: > Why does the following expression got "illegal guard expression" when > compiling: > X = 0.5, > if > random:uniform() < X -> %error reported for this line > good; > true -> > bad > end. > > But if I change it to following expression, it's ok: > X = 0.5, > Ran = random:uniform(), > if > Ran < X -> > good; > true -> > bad > end. > > BRs, > Barco > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > > -- Best Regards, - Ahmed Omar http://nl.linkedin.com/in/adiaa Follow me on twitter @spawn_think -------------- next part -------------- An HTML attachment was scrubbed... URL: From bengt.kleberg@REDACTED Fri Dec 2 10:40:00 2011 From: bengt.kleberg@REDACTED (Bengt Kleberg) Date: Fri, 2 Dec 2011 10:40:00 +0100 Subject: [erlang-questions] illegal guard expression for IF illegal guard expression for "if" In-Reply-To: References: Message-ID: <1322818800.5083.38.camel@seasc1137> Greetings, In 'if' you are only allowed guard expressions. They are here: http://www.erlang.org/doc/reference_manual/expressions.html#id201090 (7.24 Guard Sequences) bengt On Fri, 2011-12-02 at 10:30 +0100, Barco You wrote: > Why does the following expression got "illegal guard expression" when > compiling: > X = 0.5, > if > random:uniform() < X -> %error reported for this line > good; > true -> > bad > end. > > > But if I change it to following expression, it's ok: > X = 0.5, > Ran = random:uniform(), > if > Ran < X -> > good; > true -> > bad > end. > > > BRs, > Barco From ulf@REDACTED Fri Dec 2 10:49:29 2011 From: ulf@REDACTED (Ulf Wiger) Date: Fri, 2 Dec 2011 10:49:29 +0100 Subject: [erlang-questions] illegal guard expression for IF illegal guard expression for "if" In-Reply-To: References: Message-ID: <27F05039-5256-4617-9A05-C48AE04240B1@feuerlabs.com> On 2 Dec 2011, at 10:38, Ahmed Omar wrote: > Because "the guard expression must be guaranteed to be free of side effects" > http://www.erlang.org/doc/reference_manual/expressions.html#id201090 > So you are not allowed to have a function call there, except for allowed BIFs that satisfy that condition Yes, and not only does this mean that only a limited set of functions are allowed as guard functions, random:uniform() _does_ have side effects, since it updates the seed in the process dictionary. BR, Ulf W > > On Fri, Dec 2, 2011 at 10:30 AM, Barco You wrote: > Why does the following expression got "illegal guard expression" when compiling: > X = 0.5, > if > random:uniform() < X -> %error reported for this line > good; > true -> > bad > end. > > But if I change it to following expression, it's ok: > X = 0.5, > Ran = random:uniform(), > if > Ran < X -> > good; > true -> > bad > end. > > BRs, > Barco > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > > > > > -- > Best Regards, > - Ahmed Omar > http://nl.linkedin.com/in/adiaa > Follow me on twitter > @spawn_think > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions -------------- next part -------------- An HTML attachment was scrubbed... URL: From cgsmcmlxxv@REDACTED Fri Dec 2 10:50:49 2011 From: cgsmcmlxxv@REDACTED (CGS) Date: Fri, 02 Dec 2011 10:50:49 +0100 Subject: [erlang-questions] illegal guard expression for IF illegal guard expression for "if" In-Reply-To: References: Message-ID: <4ED89F79.6090607@gmail.com> Hi, To put in simple words for better understanding, you can have only constant variables withing the guard expression. That means, in your case, if in the first branch you use again random:uniform(), the second branch condition can report an inaccurate result. Alternatively, you can use case statement: case (random:uniform()<0.5) of true -> good; false -> bad end I hope this answer will help you. CGS On 12/02/2011 10:30 AM, Barco You wrote: > Why does the following expression got "illegal guard expression" when > compiling: > X = 0.5, > if > random:uniform() < X -> %error reported for this line > good; > true -> > bad > end. > > But if I change it to following expression, it's ok: > X = 0.5, > Ran = random:uniform(), > if > Ran < X -> > good; > true -> > bad > end. > > BRs, > Barco > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions -------------- next part -------------- An HTML attachment was scrubbed... URL: From barcojie@REDACTED Fri Dec 2 10:56:20 2011 From: barcojie@REDACTED (Barco You) Date: Fri, 2 Dec 2011 17:56:20 +0800 Subject: [erlang-questions] illegal guard expression for IF illegal guard expression for "if" In-Reply-To: <4ED89F79.6090607@gmail.com> References: <4ED89F79.6090607@gmail.com> Message-ID: Hi CGS, I can't understand your statement --- " if in the first branch you use again random:uniform(), the second branch condition can report an inaccurate result." Could you please make it clearer? Thanks! Hi Others, Why functions with side effect can not be in the guard expressions? Thank you! Barco On Fri, Dec 2, 2011 at 5:50 PM, CGS wrote: > ** > Hi, > > To put in simple words for better understanding, you can have only > constant variables withing the guard expression. That means, in your case, > if in the first branch you use again random:uniform(), the second branch > condition can report an inaccurate result. > > Alternatively, you can use case statement: > > case (random:uniform()<0.5) of > true -> good; > false -> bad > end > > I hope this answer will help you. > > CGS > > > > > On 12/02/2011 10:30 AM, Barco You wrote: > > Why does the following expression got "illegal guard expression" when > compiling: > X = 0.5, > if > random:uniform() < X -> %error reported for this line > good; > true -> > bad > end. > > But if I change it to following expression, it's ok: > X = 0.5, > Ran = random:uniform(), > if > Ran < X -> > good; > true -> > bad > end. > > BRs, > Barco > > > _______________________________________________ > erlang-questions mailing listerlang-questions@REDACTED://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 ebegumisa@REDACTED Fri Dec 2 10:57:47 2011 From: ebegumisa@REDACTED (Edmond Begumisa) Date: Fri, 02 Dec 2011 20:57:47 +1100 Subject: [erlang-questions] Erlounge in Melbourne this week? In-Reply-To: <60837e6a-a5e3-424b-90ff-e7c50c4c370a@knuth> References: <60837e6a-a5e3-424b-90ff-e7c50c4c370a@knuth> Message-ID: No, thank _you_. It was a very educative evening. Hope you can make it down again soon. - Edmond - On Fri, 02 Dec 2011 15:21:54 +1100, Robert Virding wrote: > A big thanks to those who could make it, I had a good time. > > Robert > > ----- Original Message ----- >> The suggestion is that we meet at Beer Deluxe in Federation Square. I >> have to meet a guy (business) at around 17.30. It shouldn't take >> long so for me some time after 18.15. How does this suit people? >> >> You can call me on my mobile +46702605355. >> >> Robert >> >> ----- Original Message ----- >> > +1. >> > >> > This would be fantastic. Where are all the Melburnians? >> > >> > I've tried to contact those I know of but it seems they're all >> > unavailable >> > :( >> > >> > Surely I'm not the only one?? >> > >> > - Edmond - >> > >> > >> > On Mon, 28 Nov 2011 15:34:36 +1100, Robert Virding >> > wrote: >> > >> > > I am in Melbourne this week for the YOW Australia conference and >> > > an >> > > erlang course. Anyone interested in having an Erlounge on >> > > Wednesday >> > > 30/11 evening for some erlang talk and beer? >> > > >> > > Robert >> > > _______________________________________________ >> > > erlang-questions mailing list >> > > erlang-questions@REDACTED >> > > http://erlang.org/mailman/listinfo/erlang-questions >> > >> > >> > -- >> > Using Opera's revolutionary e-mail client: >> > http://www.opera.com/mail/ >> > >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://erlang.org/mailman/listinfo/erlang-questions >> -- Using Opera's revolutionary e-mail client: http://www.opera.com/mail/ From spawn.think@REDACTED Fri Dec 2 11:03:28 2011 From: spawn.think@REDACTED (Ahmed Omar) Date: Fri, 2 Dec 2011 11:03:28 +0100 Subject: [erlang-questions] try to find the crash report (a challenge) In-Reply-To: <81EEBC7D-D2CD-4F6F-AC1A-7FB209C31D0D@gmail.com> References: <66CA15C5-7C44-4589-B870-18E24370011D@gmail.com> <10500247.369.1322746489974.JavaMail.geo-discussion-forums@prfi36> <81EEBC7D-D2CD-4F6F-AC1A-7FB209C31D0D@gmail.com> Message-ID: Well, there won't be crash report anywhere because inets does catch the exception in httpd_resonse.erl On Thu, Dec 1, 2011 at 2:36 PM, Joel Reymont wrote: > You can get the crash reports in /tmp/error.log (in my case). > > This works if the list of httpd modules is set to [mod_log, mod_crash]. > > There's still nothing shown via regular SASL channels. > > On Dec 1, 2011, at 1:34 PM, Yurii Rashkovskii wrote: > > > The problem is in httpd. httpd_request_handler has this: > > > > PROCESSED = (catch Module:Function([Data | Args])), > > > > so it will swallow your crash. Besides, the case statement right after > that seems to be fairly wrong. It has an all-catch clause NewMFA, and it > assumes PROCESSED is a new MFA if it is nothing that matched before. That > means, an EXIT tuple will be treated as a new MFA. Unless I'm missing > something, this is just wrong. > > -------------------------------------------------------------------------- > - for hire: mac osx device driver ninja, kernel extensions and usb drivers > ---------------------+------------+--------------------------------------- > http://wagerlabs.com | @wagerlabs | http://www.linkedin.com/in/joelreymont > ---------------------+------------+--------------------------------------- > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > -- Best Regards, - Ahmed Omar http://nl.linkedin.com/in/adiaa Follow me on twitter @spawn_think -------------- next part -------------- An HTML attachment was scrubbed... URL: From spawn.think@REDACTED Fri Dec 2 11:04:57 2011 From: spawn.think@REDACTED (Ahmed Omar) Date: Fri, 2 Dec 2011 11:04:57 +0100 Subject: [erlang-questions] problem with inets httpd? (was Re: try to find the crash report (a challenge)) In-Reply-To: <7F0B433D-7221-4A56-89E7-5B70D8E44DF9@gmail.com> References: <66CA15C5-7C44-4589-B870-18E24370011D@gmail.com> <7F0B433D-7221-4A56-89E7-5B70D8E44DF9@gmail.com> Message-ID: No. It's just that the exception is caught in httpd_response.erl traverse_modules(ModData,[Module|Rest]) -> ?hdrd("traverse modules", [{callback_module, Module}]), case (catch apply(Module, do, [ModData])) of On Thu, Dec 1, 2011 at 2:17 PM, Joel Reymont wrote: > Could this be a problem with the supervision tree of inets? > > -------------------------------------------------------------------------- > - for hire: mac osx device driver ninja, kernel extensions and usb drivers > ---------------------+------------+--------------------------------------- > http://wagerlabs.com | @wagerlabs | http://www.linkedin.com/in/joelreymont > ---------------------+------------+--------------------------------------- > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > -- Best Regards, - Ahmed Omar http://nl.linkedin.com/in/adiaa Follow me on twitter @spawn_think -------------- next part -------------- An HTML attachment was scrubbed... URL: From cgsmcmlxxv@REDACTED Fri Dec 2 11:06:18 2011 From: cgsmcmlxxv@REDACTED (CGS) Date: Fri, 02 Dec 2011 11:06:18 +0100 Subject: [erlang-questions] illegal guard expression for IF illegal guard expression for "if" In-Reply-To: References: <4ED89F79.6090607@gmail.com> Message-ID: <4ED8A31A.2020700@gmail.com> If statement is not a block statement (to fix the variables values at the entrance of the statement) in Erlang. That means, if an uniform:random() value (say, 0.4) is used for checking the first branch condition and the value is changed within the branch (say, 0.7), then you enter a paradox related to if the function should be considered for the first or the second branch. To avoid this, Erlang requires an assurance that the compared values do not change while processing the if statement. CGS On 12/02/2011 10:56 AM, Barco You wrote: > Hi CGS, > > I can't understand your statement --- " if in the first branch you use > again random:uniform(), the second branch condition can report an > inaccurate result." Could you please make it clearer? Thanks! > > Hi Others, > > Why functions with side effect can not be in the guard expressions? > > > Thank you! > Barco > > On Fri, Dec 2, 2011 at 5:50 PM, CGS > wrote: > > Hi, > > To put in simple words for better understanding, you can have only > constant variables withing the guard expression. That means, in > your case, if in the first branch you use again random:uniform(), > the second branch condition can report an inaccurate result. > > Alternatively, you can use case statement: > > case (random:uniform()<0.5) of > true -> good; > false -> bad > end > > I hope this answer will help you. > > CGS > > > > > On 12/02/2011 10:30 AM, Barco You wrote: >> Why does the following expression got "illegal guard expression" >> when compiling: >> X = 0.5, >> if >> random:uniform() < X -> %error reported for this line >> good; >> true -> >> bad >> end. >> >> But if I change it to following expression, it's ok: >> X = 0.5, >> Ran = random:uniform(), >> if >> Ran < X -> >> good; >> true -> >> bad >> end. >> >> BRs, >> Barco >> >> >> _______________________________________________ >> 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 spawn.think@REDACTED Fri Dec 2 11:12:39 2011 From: spawn.think@REDACTED (Ahmed Omar) Date: Fri, 2 Dec 2011 11:12:39 +0100 Subject: [erlang-questions] try to find the crash report (a challenge) In-Reply-To: References: <66CA15C5-7C44-4589-B870-18E24370011D@gmail.com> <10500247.369.1322746489974.JavaMail.geo-discussion-forums@prfi36> <81EEBC7D-D2CD-4F6F-AC1A-7FB209C31D0D@gmail.com> Message-ID: And what you get in error.log is just a formatted message after catching the exception case (catch apply(Module, do, [ModData])) of {'EXIT', Reason} -> ?hdrd("traverse modules - exit", [{reason, Reason}]), String = lists:flatten( io_lib:format("traverse exit from apply: ~p:do => ~n~p", [Module, Reason])), On Fri, Dec 2, 2011 at 11:03 AM, Ahmed Omar wrote: > Well, there won't be crash report anywhere because inets does catch the > exception in httpd_resonse.erl > > > On Thu, Dec 1, 2011 at 2:36 PM, Joel Reymont wrote: > >> You can get the crash reports in /tmp/error.log (in my case). >> >> This works if the list of httpd modules is set to [mod_log, mod_crash]. >> >> There's still nothing shown via regular SASL channels. >> >> On Dec 1, 2011, at 1:34 PM, Yurii Rashkovskii wrote: >> >> > The problem is in httpd. httpd_request_handler has this: >> > >> > PROCESSED = (catch Module:Function([Data | Args])), >> > >> > so it will swallow your crash. Besides, the case statement right after >> that seems to be fairly wrong. It has an all-catch clause NewMFA, and it >> assumes PROCESSED is a new MFA if it is nothing that matched before. That >> means, an EXIT tuple will be treated as a new MFA. Unless I'm missing >> something, this is just wrong. >> >> -------------------------------------------------------------------------- >> - for hire: mac osx device driver ninja, kernel extensions and usb drivers >> ---------------------+------------+--------------------------------------- >> http://wagerlabs.com | @wagerlabs | >> http://www.linkedin.com/in/joelreymont >> ---------------------+------------+--------------------------------------- >> >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://erlang.org/mailman/listinfo/erlang-questions >> > > > > -- > Best Regards, > - Ahmed Omar > http://nl.linkedin.com/in/adiaa > Follow me on twitter > @spawn_think > > -- Best Regards, - Ahmed Omar http://nl.linkedin.com/in/adiaa Follow me on twitter @spawn_think -------------- next part -------------- An HTML attachment was scrubbed... URL: From cgsmcmlxxv@REDACTED Fri Dec 2 11:18:07 2011 From: cgsmcmlxxv@REDACTED (CGS) Date: Fri, 02 Dec 2011 11:18:07 +0100 Subject: [erlang-questions] illegal guard expression for IF illegal guard expression for "if" In-Reply-To: <4ED8A31A.2020700@gmail.com> References: <4ED89F79.6090607@gmail.com> <4ED8A31A.2020700@gmail.com> Message-ID: <4ED8A5DF.70301@gmail.com> Just to make it clearer: The second condition is equivalent with the expression: "if the value of random:uniform() is greater or equal to 0.5 then report 'bad'". In this case, if you entered with value 0.4 in the first branch and modified it to 0.7 in the first branch, the second branch should be executed as well. That is against the if statement purpose which should report only one branch at the time as valid. Therefore, Erlang requires for the compared values to be constant during the if statement processing. CGS On 12/02/2011 11:06 AM, CGS wrote: > If statement is not a block statement (to fix the variables values at > the entrance of the statement) in Erlang. That means, if an > uniform:random() value (say, 0.4) is used for checking the first > branch condition and the value is changed within the branch (say, > 0.7), then you enter a paradox related to if the function should be > considered for the first or the second branch. To avoid this, Erlang > requires an assurance that the compared values do not change while > processing the if statement. > > CGS > > > > On 12/02/2011 10:56 AM, Barco You wrote: >> Hi CGS, >> >> I can't understand your statement --- " if in the first branch you >> use again random:uniform(), the second branch condition can report an >> inaccurate result." Could you please make it clearer? Thanks! >> >> Hi Others, >> >> Why functions with side effect can not be in the guard expressions? >> >> >> Thank you! >> Barco >> >> On Fri, Dec 2, 2011 at 5:50 PM, CGS > > wrote: >> >> Hi, >> >> To put in simple words for better understanding, you can have >> only constant variables withing the guard expression. That means, >> in your case, if in the first branch you use again >> random:uniform(), the second branch condition can report an >> inaccurate result. >> >> Alternatively, you can use case statement: >> >> case (random:uniform()<0.5) of >> true -> good; >> false -> bad >> end >> >> I hope this answer will help you. >> >> CGS >> >> >> >> >> On 12/02/2011 10:30 AM, Barco You wrote: >>> Why does the following expression got "illegal guard expression" >>> when compiling: >>> X = 0.5, >>> if >>> random:uniform() < X -> %error reported for this line >>> good; >>> true -> >>> bad >>> end. >>> >>> But if I change it to following expression, it's ok: >>> X = 0.5, >>> Ran = random:uniform(), >>> if >>> Ran < X -> >>> good; >>> true -> >>> bad >>> end. >>> >>> BRs, >>> Barco >>> >>> >>> _______________________________________________ >>> 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 kruber@REDACTED Fri Dec 2 11:26:56 2011 From: kruber@REDACTED (Nico Kruber) Date: Fri, 02 Dec 2011 11:26:56 +0100 Subject: [erlang-questions] performance drop in R15A? In-Reply-To: <2086353.lGPuiOpM5q@csr-pc40.zib.de> References: <1359554.YeRYZETzs8@csr-pc40.zib.de> <2086353.lGPuiOpM5q@csr-pc40.zib.de> Message-ID: <4458388.uS11NqXNlV@csr-pc40.zib.de> Tonight, I ran the tests with an erlang checkout from around 16:00 yesterday (erlang-otp-OTP_R15A-126-g0290bed.tar.gz). This includes the fix Bj?rn-Egil was referring to, i.e. 'rickard/pix-mutex/OTP-9723'. Following are the results or our "make bench" of Scalaris: ** transactions/s , i.e. "wall clock throughput : xxx" ** R14B04: ~950, R15A (ge21ff9b): ~800, R15A (g0290bed): ~635 ** latency, i.e. "wall clock avg. latency: xxx ms" **: R14B04: ~42ms, R15A (ge21ff9b): ~50ms, R15A (g0290bed): ~60ms Note: This "make bench" command sets up a Scalaris ring consisting of 4 nodes, each in a single VM. They all communicate through tcp. Additionally, we also measure our performance through our Java-API which accesses Erlang via JInterface using "SCALARIS_BENCHMARKS="100 6 9 15 18" make java-bench" ** number of transactions per second for "Benchmark incrementing an integer key (read+write):" R14B04: ~310, R15A (ge21ff9b): ~200, R15A (g0290bed): ~140 I saw some new bug fixes for the scheduler in the recent commits, but with the checkout from 6971b96 (just now), the results are still the same as with g0290bed :( Regards, Nico On Wednesday 30 November 2011 17:05:29 Nico Kruber wrote: > thank you > We'll try again tomorrow > > Nico > > On Wednesday 30 November 2011 16:30:05 Lukas Larsson wrote: > > Hello! > > > > I was able to verify you findings on my machine for R14B04 and R15A. The > > problem is however fixed (I even get a 15% throughput improvement on > > your > > bench) in our latest internal master which will be pushed to github > > later > > this evening. So if you could pull the latest from github tomorrow and > > verify my findings that would be great! > > > > Lukas > > > > On Wed, Nov 30, 2011 at 11:36 AM, Nico Kruber wrote: > > > Is it possible, that some debug option is on by default in the R15A > > > tagged git > > > checkout? > > > We build the source using the following commands (on a x86_64 system > > > with 8 cores): > > > > > > ./otp_build autoconf > > > ./configure --prefix=/home/buildbot/apps/erlang-R15A > > > make > > > make install > > > > > > and then compiled our application > > > (http://code.google.com/p/scalaris/) > > > using > > > R15A. > > > > > > With our internal benchmarks ("make bench") showed a drop of around > > > 15% > > > in performance compared to R14B04. We were actually hoping for an > > > increased performance reading about the memory allocation > > > improvements... > > > > > > Is there some switch (during configuration or build) influencing the > > > performance? > > > > > > output of R14B04 erl: > > > ------------------------------------------------------------ > > > Erlang R14B04 (erts-5.8.5) [source] [64-bit] [smp:8:8] [rq:8] > > > [async- > > > threads:0] [hipe] [kernel-poll:false] > > > > > > Eshell V5.8.5 (abort with ^G) > > > 1> > > > ------------------------------------------------------------ > > > > > > output of R15A erl: > > > ------------------------------------------------------------ > > > Erlang R15A (erts-5.9.pre) [source] [64-bit] [smp:8:8] [rq:8] > > > [async- > > > threads:0] [hipe] [kernel-poll:false] > > > > > > Eshell V5.9.pre (abort with ^G) > > > 1> > > > ------------------------------------------------------------ > > > > > > > > > Regards > > > Nico Kruber -------------- 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 gleber.p@REDACTED Fri Dec 2 15:06:11 2011 From: gleber.p@REDACTED (Gleb Peregud) Date: Fri, 2 Dec 2011 15:06:11 +0100 Subject: [erlang-questions] Logger which truncates too big terms Message-ID: Hello ist There was a discussion about a logger which replaces SASL logging handlers and makes sure that the system isn't crashed due to too big state of a crashing process? Can you please point me to that project/mail, because my Google-fu is failing me. Best regards, Gleb Peregud From desired.mta@REDACTED Fri Dec 2 15:25:24 2011 From: desired.mta@REDACTED (Motiejus =?utf-8?Q?Jak=C5=A1tys?=) Date: Fri, 2 Dec 2011 14:25:24 +0000 Subject: [erlang-questions] Logger which truncates too big terms In-Reply-To: References: Message-ID: <20111202142524.GA6172@jakstys.lt> On Fri, Dec 02, 2011 at 03:06:11PM +0100, Gleb Peregud wrote: > Hello ist > > There was a discussion about a logger which replaces SASL logging > handlers and makes sure that the system isn't crashed due to too big > state of a crashing process? Can you please point me to that > project/mail, because my Google-fu is failing me. > Lager: http://basho.com/blog/technical/2011/07/20/Introducing-Lager-A-New-Logging-Framework-for-ErlangOTP/ Motiejus From barcojie@REDACTED Fri Dec 2 15:42:46 2011 From: barcojie@REDACTED (Barco You) Date: Fri, 2 Dec 2011 22:42:46 +0800 Subject: [erlang-questions] illegal guard expression for IF illegal guard expression for "if" In-Reply-To: <4ED8A5DF.70301@gmail.com> References: <4ED89F79.6090607@gmail.com> <4ED8A31A.2020700@gmail.com> <4ED8A5DF.70301@gmail.com> Message-ID: Ooooh! Maybe I understand now! It means that if the first branch is not satisfied, saying get 0.7, then random:uniform() would be evaluated again in the second branch and it possible to get a value less than 0.5, which then makes a paradox. Right? In the contrast, with case statement, the condition is only evaluated once no matter whichever branch would be satisfied. How smart erlang is, and how amazing you erlangers are! Barco On Dec 2, 2011 6:18 PM, "CGS" wrote: > ** > Just to make it clearer: > > The second condition is equivalent with the expression: "if the value of > random:uniform() is greater or equal to 0.5 then report 'bad'". In this > case, if you entered with value 0.4 in the first branch and modified it to > 0.7 in the first branch, the second branch should be executed as well. That > is against the if statement purpose which should report only one branch at > the time as valid. Therefore, Erlang requires for the compared values to be > constant during the if statement processing. > > CGS > > > > On 12/02/2011 11:06 AM, CGS wrote: > > If statement is not a block statement (to fix the variables values at the > entrance of the statement) in Erlang. That means, if an uniform:random() > value (say, 0.4) is used for checking the first branch condition and the > value is changed within the branch (say, 0.7), then you enter a paradox > related to if the function should be considered for the first or the second > branch. To avoid this, Erlang requires an assurance that the compared > values do not change while processing the if statement. > > CGS > > > > On 12/02/2011 10:56 AM, Barco You wrote: > > Hi CGS, > > I can't understand your statement --- " if in the first branch you use > again random:uniform(), the second branch condition can report an > inaccurate result." Could you please make it clearer? Thanks! > > Hi Others, > > Why functions with side effect can not be in the guard expressions? > > > Thank you! > Barco > > On Fri, Dec 2, 2011 at 5:50 PM, CGS wrote: > >> Hi, >> >> To put in simple words for better understanding, you can have only >> constant variables withing the guard expression. That means, in your case, >> if in the first branch you use again random:uniform(), the second branch >> condition can report an inaccurate result. >> >> Alternatively, you can use case statement: >> >> case (random:uniform()<0.5) of >> true -> good; >> false -> bad >> end >> >> I hope this answer will help you. >> >> CGS >> >> >> >> >> On 12/02/2011 10:30 AM, Barco You wrote: >> >> Why does the following expression got "illegal guard expression" when >> compiling: >> X = 0.5, >> if >> random:uniform() < X -> %error reported for this line >> good; >> true -> >> bad >> end. >> >> But if I change it to following expression, it's ok: >> X = 0.5, >> Ran = random:uniform(), >> if >> Ran < X -> >> good; >> true -> >> bad >> end. >> >> BRs, >> Barco >> >> >> _______________________________________________ >> erlang-questions mailing listerlang-questions@REDACTED://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 max.lapshin@REDACTED Fri Dec 2 16:02:03 2011 From: max.lapshin@REDACTED (Max Lapshin) Date: Fri, 2 Dec 2011 18:02:03 +0300 Subject: [erlang-questions] Logger which truncates too big terms In-Reply-To: <20111202142524.GA6172@jakstys.lt> References: <20111202142524.GA6172@jakstys.lt> Message-ID: No logger can reduce messages with current state of OTP. https://github.com/erlyvideo/erlyvideo/blob/master/apps/erlyvideo/src/core/gen_server_ems.erl#L747 this is where you need to move to protect your system from silly OOM while printing error message. From dmercer@REDACTED Fri Dec 2 16:13:26 2011 From: dmercer@REDACTED (David Mercer) Date: Fri, 2 Dec 2011 09:13:26 -0600 Subject: [erlang-questions] Accessing SSAS From Erlang In-Reply-To: References: <00ff01ccb04d$7b0b4bd0$7121e370$@com> Message-ID: <004f01ccb104$f36a7e90$da3f7bb0$@com> Thanks, Wes. I ended up using OPENQUERY. It seems that SSAS has a proprietary wire format, so it can't really be accessed by anything other than .NET. Not even Java. > -----Original Message----- > From: Wes James [mailto:comptekki@REDACTED] > Sent: Thursday, December 01, 2011 11:38 AM > To: David Mercer > Cc: erlang-questions@REDACTED > Subject: Re: [erlang-questions] Accessing SSAS From Erlang > > or maybe...: > > http://www.ssas-info.com/analysis-services-faq/27-mdx/51-can-i-execute- > mdx-query-from-sql-server-openquery-addlinkedserver > > -wes > > On Thu, Dec 1, 2011 at 10:20 AM, David Mercer > wrote: > > I use the odbc module to access the SQL Server relational database, > but my > > Google-fu is not strong enough to figure out how access the SQL > Server > > Analysis Services side of the database.? I would like to be able to > connect > > and execute MDX and XMLA commands on an SSAS 2008 instance.? Does > anyone > > have any ideas as to how to do this?? Please advise.? Thank-you. > > > > > > > > Cheers, > > > > > > > > DBM > > > > > > > > > > _______________________________________________ > > erlang-questions mailing list > > erlang-questions@REDACTED > > http://erlang.org/mailman/listinfo/erlang-questions > > From freza@REDACTED Fri Dec 2 16:34:33 2011 From: freza@REDACTED (Jachym Holecek) Date: Fri, 2 Dec 2011 10:34:33 -0500 Subject: [erlang-questions] [ANN] audit_log-2.5.0 In-Reply-To: <20111023230825.GA24396@circlewave.net> References: <20111023230825.GA24396@circlewave.net> Message-ID: <20111202153433.GA22755@circlewave.net> Hi, FYI location changed for maintainer's convenience, so: > Homepage: https://github.com/eeltd/audit_log https://github.com/freza/audit_log > Source: git clone git://github.com/eeltd/audit_log.git git clone git://github.com/freza/audit_log.git BR, -- Jachym From freza@REDACTED Fri Dec 2 16:38:59 2011 From: freza@REDACTED (Jachym Holecek) Date: Fri, 2 Dec 2011 10:38:59 -0500 Subject: [erlang-questions] Logger which truncates too big terms In-Reply-To: References: <20111202142524.GA6172@jakstys.lt> Message-ID: <20111202153859.GA6582@circlewave.net> # Max Lapshin 2011-12-02: > No logger can reduce messages with current state of OTP. Nor is it sensible logger's job to inspect or modify messages in any way. Just send them to backing store with minimum hassle and make best effort to minimize runtime impact on the caller. IMHO. > https://github.com/erlyvideo/erlyvideo/blob/master/apps/erlyvideo/src/core/gen_server_ems.erl#L747 > > this is where you need to move to protect your system from silly OOM > while printing error message. Yep, that's the right thing to do -- message originator is responsible for what the message looks like. To a logger it's just a data blob decorated with originator identity, or something else telling it where that message belongs. IMHO. BR, -- Jachym From wsanchez@REDACTED Fri Dec 2 16:39:52 2011 From: wsanchez@REDACTED (Alexander) Date: Fri, 2 Dec 2011 07:39:52 -0800 (PST) Subject: [erlang-questions] ESASL Message-ID: <1322840392930-4147616.post@n4.nabble.com> How can I use ESASL ?? Can any recomend me a manual ?? -- View this message in context: http://erlang.2086793.n4.nabble.com/ESASL-tp4147616p4147616.html Sent from the Erlang Questions mailing list archive at Nabble.com. From andrew@REDACTED Fri Dec 2 16:55:42 2011 From: andrew@REDACTED (Andrew Thompson) Date: Fri, 2 Dec 2011 10:55:42 -0500 Subject: [erlang-questions] Logger which truncates too big terms In-Reply-To: References: <20111202142524.GA6172@jakstys.lt> Message-ID: <20111202155542.GA5624@hijacked.us> On Fri, Dec 02, 2011 at 06:02:03PM +0300, Max Lapshin wrote: > No logger can reduce messages with current state of OTP. > > https://github.com/erlyvideo/erlyvideo/blob/master/apps/erlyvideo/src/core/gen_server_ems.erl#L747 > > this is where you need to move to protect your system from silly OOM > while printing error message. In an ideal world yes, you'd do it here. Happily, passing a large term around and formatting it as a string are 2 different things, and you can at least mitigate some of the damage by truncating it downstream. As regards modifying log messages, lager does do a significant amount of that, I agree. However, I didn't do that lightly, it was done so the logger can't ever crash the node, and to provide more human-readable log messages based on the ones output from SASL, for customers using an erlang service who aren't erlang programmers themselves (the original log messages are also preserved, just in a different file). Lager just meets the needs we had at basho for riak logging in production, there's plenty of alternatives with other design decisions/tradeoffs, but it's worked out very well for us so far. Andrew From rtrlists@REDACTED Fri Dec 2 17:13:28 2011 From: rtrlists@REDACTED (Robert Raschke) Date: Fri, 2 Dec 2011 16:13:28 +0000 Subject: [erlang-questions] Logger which truncates too big terms In-Reply-To: <20111202153859.GA6582@circlewave.net> References: <20111202142524.GA6172@jakstys.lt> <20111202153859.GA6582@circlewave.net> Message-ID: On Fri, Dec 2, 2011 at 3:38 PM, Jachym Holecek wrote: > # Max Lapshin 2011-12-02: > > No logger can reduce messages with current state of OTP. > > Nor is it sensible logger's job to inspect or modify messages in any > way. Just send them to backing store with minimum hassle and make > best effort to minimize runtime impact on the caller. IMHO. > > > > https://github.com/erlyvideo/erlyvideo/blob/master/apps/erlyvideo/src/core/gen_server_ems.erl#L747 > > > > this is where you need to move to protect your system from silly OOM > > while printing error message. > > Yep, that's the right thing to do -- message originator is responsible > for what the message looks like. To a logger it's just a data blob > decorated with originator identity, or something else telling it > where that message belongs. IMHO. > > BR, > -- Jachym > > Weeell, I think there is good cause for splitting logging into two parts: 1. creating log entries and 2. presenting them for human consumption. Doing this means that you can forget about any pretty-printing of log messages at the point of their creation. Such, rather heavy, processing can be deferred to the point of actually reading the log. The latter usually being done off line anyway. I've started doing this by only ever logging lists of terms (using the error_logger), always providing the module that is logging as part of this list. I also have a modified rb (report browser) that will call a module's format_log/1 function (if it exists) to take the logged list of terms and return a pretty string. Finally, a good design pattern for OTP behaviour implementations is to keep the state small! If you need to remember big data, there's a whole bunch of libs to help with that. (I've not run into log size difficulties with ets, dets, or mnesia. Anyone know of any?) /Robby -------------- next part -------------- An HTML attachment was scrubbed... URL: From dang@REDACTED Fri Dec 2 17:21:51 2011 From: dang@REDACTED (Daniel Goertzen) Date: Fri, 2 Dec 2011 10:21:51 -0600 Subject: [erlang-questions] Linux device driver communication with Erlang node In-Reply-To: <20111129232343.GA4779@jakstys.lt> References: <20111129232343.GA4779@jakstys.lt> Message-ID: Sanya is correct. You would need to write a device driver that implements the block device interface and also provides a conduit to userspace; probably a character device node which Erlang could read and write. After being spoiled by Erlang, writing linux device drivers in C will make you want to rip your hair out. :) Incidentally, people abuse the existing NBD client driver to write their own userspace block devices. You could easily do the same without having to touch kernel code at all. Dan. On Tue, Nov 29, 2011 at 5:23 PM, Motiejus Jak?tys wrote: > Hello, > > I am thinking of a way for Linux kernel driver to communicate with > Erlang node. The purpose is send binary blobs and have some logic: > * The blob has been ack'ed by erlang node > * Some business operation has been completed with the blob (by node) > > C node seems to be the perfect match. Is there anything I should know > before starting messing around? Any possible gotchas running Erlang node > in kernel space? Has anybody tried that? > > What I am trying to do > ====================== > > I am thinking of implementing NBD stack with Erlang and C. NBD server is > easy (100% userspace), the client is more tricky, since device driver > code has to be kernel space. > > NBD-client would consist of two parts: > * nbd.c that implements block device interface and talks to Erlang node > * Erlang node that communicates with another Erlang node nbd-server > (which does the "business" part with the blob -- writes to disk) > > RFC > === > > For me distinction between "client" and "server" is unclear in the > tutorial: http://www.erlang.org/doc/tutorial/cnode.html Could somebody > explain it from the higher perspective? > > I have never mixed C and Erlang before, and would appreciate some light > on C nodes generally. What is a C node from the system point of view? > Does it use sockets, pipes? What OS processes/threads does it spawn? > > Many thanks, > Motiejus > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > -- *Daniel Goertzen Senior Software Engineer *-- *Network Integrity Systems *We Bring Security To Light(tm) 1937 Tate Blvd. SE Hickory, North Carolina 28602 Phone: 828.610.4596 Fax: 828.322.5294 Network Integrity Systems' INTERCEPTOR(tm) Optical Network Security System is a Smart-PDS(tm) that ensures superior protection and cost effectiveness of classified networks. For more information, visit our website at: www.networkintegritysystems.com <*http://www.networkintegritysystems.com*> __________________________________________ INTERCEPTOR(tm) Optical Network Security System is made in the USA for the USA. Although not an export controlled item, because of the role it plays in the assurance of the safety and integrity of National Security Information, Network Integrity Systems (NIS) is committed to compliance with the U.S. Export Administration Act. Accordingly, NIS will not ship INTERCEPTOR products to certain foreign government end users without U.S. government approval and will refuse transactions with individuals or entities that have been denied export privileges. -------------- next part -------------- An HTML attachment was scrubbed... URL: From freza@REDACTED Fri Dec 2 17:38:50 2011 From: freza@REDACTED (Jachym Holecek) Date: Fri, 2 Dec 2011 11:38:50 -0500 Subject: [erlang-questions] Logger which truncates too big terms In-Reply-To: <20111202155542.GA5624@hijacked.us> References: <20111202142524.GA6172@jakstys.lt> <20111202155542.GA5624@hijacked.us> Message-ID: <20111202163850.GA25697@circlewave.net> Hi Andrew, I didn't mean to be critical of lager in particular, just trying to share what I've learned from some previous logging framework effort (Hmm, I'm possibly repeating myself on that). My views are admittedly skewed by the need to handle *huge* volumes of traffic of almost arbitrary shapes: sometimes it's CSV for later postprocessing, sometimes just raw terms prefixed by timestamp, other times they're warm a fuzzy user-friendly texts etc. Using plain iolists as message format and basically just a thin wrapper on top of IO driver came out as natural fit for those needs (after shooting myself in the foot endlessly for a few weeks with excessive creativity ;-). # Andrew Thompson 2011-12-02: > As regards modifying log messages, lager does do a significant amount of > that, I agree. However, I didn't do that lightly, it was done so the > logger can't ever crash the node, and to provide more human-readable > log messages based on the ones output from SASL, for customers using an > erlang service who aren't erlang programmers themselves (the original > log messages are also preserved, just in a different file). Yep, that's a prefectly legitimate goal, and I like SASL's message format too. I'd advise that you do all the formatting from caller's context and stay in safe distance from gen_event, if at all possible. But perhaps you can't do that without replacing error_logger module first (something I've meant to do, using audit_log as backend, but can't seem to get around to it). And perhaps you already do some of that, I haven't studied lager's codebase in any great detail yet. Also, perhaps your system has an upper bound on log volumes and you know in advance you can afford centralized processing... > Lager just meets the needs we had at basho for riak logging in > production, there's plenty of alternatives with other design > decisions/tradeoffs, but it's worked out very well for us so far. Sure, can't question that. I suppose there's a religious question of general attitude towards addressing project requirements -- my take I suppose is (not without exceptions) to produce a minimalist solution to the core issue, and than polish up the rough edges with some amount of application-specific adaptation code... BR, -- Jachym From robert.virding@REDACTED Fri Dec 2 17:53:58 2011 From: robert.virding@REDACTED (Robert Virding) Date: Fri, 02 Dec 2011 16:53:58 -0000 (GMT) Subject: [erlang-questions] Erlounge in Brisbane next week In-Reply-To: <94808105-9d87-459a-8e96-99deca67e9b5@knuth> Message-ID: I will be in Brisbane next week for the YOW Australia conference and an OTP course. Anyone interested in having an Erlounge one evening later on in the week for some erlang talk and beer? Robert From wsanchez@REDACTED Fri Dec 2 18:28:06 2011 From: wsanchez@REDACTED (=?ISO-8859-1?Q?Winston_S=E1nchez?=) Date: Fri, 2 Dec 2011 12:28:06 -0500 Subject: [erlang-questions] ESASL Message-ID: How can I use ESASL ?? Can any recomend me a manual ?? -------------- next part -------------- An HTML attachment was scrubbed... URL: From freza@REDACTED Fri Dec 2 19:30:05 2011 From: freza@REDACTED (Jachym Holecek) Date: Fri, 2 Dec 2011 13:30:05 -0500 Subject: [erlang-questions] Logger which truncates too big terms In-Reply-To: References: <20111202142524.GA6172@jakstys.lt> <20111202153859.GA6582@circlewave.net> Message-ID: <20111202183005.GA4235@circlewave.net> # Robert Raschke 2011-12-02: > On Fri, Dec 2, 2011 at 3:38 PM, Jachym Holecek wrote: > > # Max Lapshin 2011-12-02: > > > No logger can reduce messages with current state of OTP. > > > > Nor is it sensible logger's job to inspect or modify messages in any > > way. Just send them to backing store with minimum hassle and make > > best effort to minimize runtime impact on the caller. IMHO. > > > > > > > https://github.com/erlyvideo/erlyvideo/blob/master/apps/erlyvideo/src/core/gen_server_ems.erl#L747 > > > > > > this is where you need to move to protect your system from silly OOM > > > while printing error message. > > > > Yep, that's the right thing to do -- message originator is responsible > > for what the message looks like. To a logger it's just a data blob > > decorated with originator identity, or something else telling it > > where that message belongs. IMHO. > > Weeell, I think there is good cause for splitting logging into two parts: > 1. creating log entries and 2. presenting them for human consumption. Well, in principle that's a conceivable way to see things, however being an old UN*X-head I'm of the firm religious belief that logs should be ASCII text files, and I'm sure Operations would share that view. :-) > Doing this means that you can forget about any pretty-printing of log > messages at the point of their creation. Such, rather heavy, processing can > be deferred to the point of actually reading the log. The latter usually > being done off line anyway. But how heavy it is remains under your control. Pragmatic approach to log layout (when you can afford it) and embracing iolists from the start lower the price. You still need to be careful and sometimes move logging out of busy path and such, but that's a hard fact of nature the way I see it... Also, I prefer logs to be readily available right after the fact, already in their final shape, and inspectable with standard tools (as imperfect as they might be, I'd personally rather avoid reinventing them -- I miss grep especially dearly every time I'm confronted with binary SASL logs). > I've started doing this by only ever logging lists of terms (using the > error_logger), always providing the module that is logging as part of this > list. I also have a modified rb (report browser) that will call a module's > format_log/1 function (if it exists) to take the logged list of terms and > return a pretty string. This introduces an opportunity for mismatch between actual log format and what the format_log/1 callback thinks, one that will be undetected until RB is started, no? Also, doesn't this dictate that logs only be analysed wherever you have full code of faulty node available? Such as *not* from your laptop in the middle of a business trip without access to deployment/development machines? Also, how well does this work with gigabytes of logged events when you need to analyze and fix the issue ASAP because every minute of downtime/fault is valued at roughly your annual salary? I have no trouble believing logs in some binary format could be a good choice for some particular problem domain, but I've never come across one of those in practice... BR, -- Jachym From dmercer@REDACTED Fri Dec 2 20:23:08 2011 From: dmercer@REDACTED (David Mercer) Date: Fri, 2 Dec 2011 13:23:08 -0600 Subject: [erlang-questions] Accessing SSAS From Erlang In-Reply-To: References: <00ff01ccb04d$7b0b4bd0$7121e370$@com> <004f01ccb104$f36a7e90$da3f7bb0$@com> Message-ID: <007c01ccb127$d3d8e670$7b8ab350$@com> I shall have to look into that. What I read yesterday was that it was some sort of proprietary wrapper over TCP, but certainly this seems to indicate otherwise. Maybe the page I was looking at was old or something. When I get the chance, I might give it whirl. In the meantime, I'm using OPENQUERY, so my urgency is lost. Thanks! Cheers, DBM From: Tim Watson [mailto:watson.timothy@REDACTED] Sent: Friday, December 02, 2011 10:58 AM To: David Mercer Subject: Re: [erlang-questions] Accessing SSAS From Erlang I thought that SSAS used the TDS protocol, no? On 2 December 2011 15:13, David Mercer wrote: Thanks, Wes. I ended up using OPENQUERY. It seems that SSAS has a proprietary wire format, so it can't really be accessed by anything other than .NET. Not even Java. > -----Original Message----- > From: Wes James [mailto:comptekki@REDACTED] > Sent: Thursday, December 01, 2011 11:38 AM > To: David Mercer > Cc: erlang-questions@REDACTED > Subject: Re: [erlang-questions] Accessing SSAS From Erlang > > or maybe...: > > http://www.ssas-info.com/analysis-services-faq/27-mdx/51-can-i-execute- > mdx-query-from-sql-server-openquery-addlinkedserver > > -wes > > On Thu, Dec 1, 2011 at 10:20 AM, David Mercer > wrote: > > I use the odbc module to access the SQL Server relational database, > but my > > Google-fu is not strong enough to figure out how access the SQL > Server > > Analysis Services side of the database. I would like to be able to > connect > > and execute MDX and XMLA commands on an SSAS 2008 instance. Does > anyone > > have any ideas as to how to do this? Please advise. Thank-you. > > > > > > > > Cheers, > > > > > > > > DBM > > > > > > > > > > _______________________________________________ > > 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 watson.timothy@REDACTED Fri Dec 2 20:47:35 2011 From: watson.timothy@REDACTED (Tim Watson) Date: Fri, 2 Dec 2011 19:47:35 +0000 Subject: [erlang-questions] Accessing SSAS From Erlang In-Reply-To: <007c01ccb127$d3d8e670$7b8ab350$@com> References: <00ff01ccb04d$7b0b4bd0$7121e370$@com> <004f01ccb104$f36a7e90$da3f7bb0$@com> <007c01ccb127$d3d8e670$7b8ab350$@com> Message-ID: On 2 December 2011 19:23, David Mercer wrote: > I shall have to look into that. What I read yesterday was that it was > some sort of proprietary wrapper over TCP, but certainly this < > http://msdn.microsoft.com/en-us/library/ee320606.aspx> seems to indicate > otherwise. Maybe the page I was looking at was old or something. When I > get the chance, I might give it whirl. In the meantime, I?m using > OPENQUERY, so my urgency is lost. Thanks!**** > > ** ** > > Cool, well it looks like TDS is just for SQL Server and SSAS uses SOAP+XMLA. Seems a bit verbose for a data access protocol, but there you have it. -------------- next part -------------- An HTML attachment was scrubbed... URL: From watson.timothy@REDACTED Fri Dec 2 20:58:04 2011 From: watson.timothy@REDACTED (Tim Watson) Date: Fri, 2 Dec 2011 19:58:04 +0000 Subject: [erlang-questions] Instrumentation Message-ID: There have been a few conversations about instrumentation libraries on the list, and I've been experimenting with the features Ulf recently added to parse_trans. I've worked up a simple annotations library, that let's you put attributes/annotations on specific functions and attach behaviour to them in the form of an implementation module. The current framework is very crude and relies on a compile time parse transform, though obviously it'll be relatively trivial to implement runtime code changes as well. The purpose of this prototyping was to play around with some of the ideas in Aspect Oriented Programming, and the library allows you to write code that executes before, after or around an annotated function. This is done without macros, which feels a bit neater to me than the approach used in erlang-web. In addition to the library, I've made a small reference project which implements a simple function memoization annotation using ets as a cache. The implementation of the annotation itself is very simple: -module(memoize). -annotation('function'). %% scoped to functions -export([init/1]). -export([around_advice/4]). init(Module) -> ets:new(Module, [ordered_set, public, named_table, {write_concurrency,true}, {read_concurrency,true}, compressed]), ok. around_advice(_A, M, F, Inputs) -> case ets:lookup(M, {F, Inputs}) of [] -> Result = annotation:call_advised(M, F, Inputs), true = ets:insert_new(M, {{F, Inputs}, Result}), Result; [{_, Memoized}] -> Memoized end. And the usage of the annotation is very simple too: -module(fib_mem). -export([start_memoize/0, fib/1]). -include_lib("annotations/include/annotations.hrl"). start_memoize() -> memoize:init(?MODULE). -memoize(ets). fib(0) -> 0; fib(1) -> 1; fib(N) -> fib(N - 1) + fib(N - 2). -------------------- As I said, the implementation is very crude but I hope that the concepts will trigger some discussion about whether this is a useful contribution and in what directions it ought to go. Code is here: https://github.com/hyperthunk/annotations Memoize is here: https://github.com/nebularis/memoize -------------- next part -------------- An HTML attachment was scrubbed... URL: From desired.mta@REDACTED Fri Dec 2 22:31:42 2011 From: desired.mta@REDACTED (Motiejus =?utf-8?Q?Jak=C5=A1tys?=) Date: Fri, 2 Dec 2011 21:31:42 +0000 Subject: [erlang-questions] Linux device driver communication with Erlang node In-Reply-To: References: <20111129232343.GA4779@jakstys.lt> Message-ID: <20111202213141.GA4437@jakstys.lt> On Fri, Dec 02, 2011 at 10:21:51AM -0600, Daniel Goertzen wrote: > Sanya is correct. > > You would need to write a device driver that implements the block device > interface and also provides a conduit to userspace; probably a character > device node which Erlang could read and write. After being spoiled by > Erlang, writing linux device drivers in C will make you want to rip your > hair out. :) Yes, I get it. So it's quite clear that it will not be a C node. It will be either home-made port driver, or wrapped in Erl_interface. I will have a look. > Incidentally, people abuse the existing NBD client driver to write their > own userspace block devices. You could easily do the same without having > to touch kernel code at all. But as far as I see nbd-client.c sets up the socket: 262 void finish_sock(int sock, int nbd, int swap) { 263 if (ioctl(nbd, NBD_SET_SOCK, sock) < 0) drivers/block/nbd.c fetches the socket: 602 case NBD_SET_SOCK: { and sends/receives packets to the nbd server: 191 result = kernel_sendmsg(sock, &msg, &iov, 1, size); 195 result = kernel_recvmsg(sock, &msg, &iov, 1, size, 196 msg.msg_flags); Transferring data from kernel to nbd-client.c would not make sense, because it would make +2 context switches per buffer while sending data. How it would work then: 1) userspace calls write(), and sends data to kernel-space 2) kernel driver nbd.c sends data to nbd-client.c (again to userspace) 3) nbd-client.c sends the blob to kernel space to send it to NIC Now second step is skipped. Mentioning NBD was misleading here... It would be better to name it "ErlBD". Since I will implement neither nbd client, nor server. Just the idea is similar. Thanks for help, now I have an image how it should look like. For the curious: https://github.com/Motiejus/ErlBD Motiejus From wsanchez@REDACTED Fri Dec 2 22:56:50 2011 From: wsanchez@REDACTED (=?ISO-8859-1?Q?Winston_S=E1nchez?=) Date: Fri, 2 Dec 2011 16:56:50 -0500 Subject: [erlang-questions] Active Directory Message-ID: I'm new at erlang programing, I need to know if is possible exchange messages with active directory with erlang's module. thanks for your attention -------------- next part -------------- An HTML attachment was scrubbed... URL: From jwatte@REDACTED Fri Dec 2 23:36:17 2011 From: jwatte@REDACTED (Jon Watte) Date: Fri, 2 Dec 2011 14:36:17 -0800 Subject: [erlang-questions] rebar -- how do I get useful error messages Message-ID: Generally, I will start an editor in the working directory of the top of my source tree. The source tree contains "apps" and "rel," where "apps" contains my different apps plus dependencies like mochiweb. I have a makefile that just does "rebar compile" for the default action. unfortunately, when I do this, the paths that come out of the compiler error messages does not contain the "apps" directory or the name of the actual app. For example, if I have an error in the file "apps/myapp/src/somefile.erl" then the error message will say "src/somefile.erl:44: some error here." THIS, in turn, breaks the go-to-compile-error logic for the editor -- it cannot find the file in question. I can string-substitute the output of rebar to tack on "apps/" in front, but without the actual application, that's not good enough, and I don't easily know which app name to also tack on. So -- how do you guys solve this? Jumping to compile errors in the editor is one of those basics that nobody really wants to live without, so I can't imagine that an entire community is living without... Sincerely, jw -- Americans might object: there is no way we would sacrifice our living standards for the benefit of people in the rest of the world. Nevertheless, whether we get there willingly or not, we shall soon have lower consumption rates, because our present rates are unsustainable. -------------- next part -------------- An HTML attachment was scrubbed... URL: From steven.charles.davis@REDACTED Sat Dec 3 01:48:10 2011 From: steven.charles.davis@REDACTED (Steve Davis) Date: Fri, 2 Dec 2011 16:48:10 -0800 (PST) Subject: [erlang-questions] Active Directory In-Reply-To: References: Message-ID: <6db0d17e-af88-4ddb-a5b1-86df69aa8a00@o13g2000vbo.googlegroups.com> Hi Winston, This answer will not be directly helpful, and it's quite possible that someone else has done a lot of the work towards this capability within the (very helpful) community here. So please take my answer within the spirit it is meant. For sure it is possible to do this in Erlang. (Unless a programming language has a severe defect, it is always possible to do something with software :). The question is, how much effort will it take to achieve it? Well, I don't know of an Erlang application that implements an easy API for this particular functionality. But AFAIK active directory is essentially LDAP, and (obviously) communicates over TCP sockets. If you have a good definition of the protocol used, then Erlang's binary/ bit syntax does make it relatively painless to implement a binary protocol, and gives you excellent control over socket communications. Definitely the binary/bit syntax is worth exploring as it is one of the great strengths of the language. This feature of Erlang will likely not meet your immediate need, but you'd be surprised at how quickly something like that can be done in Erlang compared to, say, an imperative language. Others here may be able to provide APIs/port drivers written with Erlang/OTP that get you closer with the AD and save some effort. Meantime, I wish you luck and enjoyment in your journey with Erlang and OTP :) /s On Dec 2, 3:56?pm, Winston S?nchez wrote: > I'm new at erlang programing, I need to know if is possible exchange > messages with active directory with erlang's module. > thanks for your attention > > _______________________________________________ > erlang-questions mailing list > erlang-questi...@REDACTED://erlang.org/mailman/listinfo/erlang-questions From carlsson.richard@REDACTED Sat Dec 3 02:18:10 2011 From: carlsson.richard@REDACTED (Richard Carlsson) Date: Sat, 03 Dec 2011 02:18:10 +0100 Subject: [erlang-questions] Active Directory In-Reply-To: <6db0d17e-af88-4ddb-a5b1-86df69aa8a00@o13g2000vbo.googlegroups.com> References: <6db0d17e-af88-4ddb-a5b1-86df69aa8a00@o13g2000vbo.googlegroups.com> Message-ID: <4ED978D2.8030105@gmail.com> On 12/03/2011 01:48 AM, Steve Davis wrote: > Hi Winston, > > This answer will not be directly helpful, and it's quite possible that > someone else has done a lot of the work towards this capability within > the (very helpful) community here. So please take my answer within the > spirit it is meant. > > For sure it is possible to do this in Erlang. (Unless a programming > language has a severe defect, it is always possible to do something > with software :). > > The question is, how much effort will it take to achieve it? > > Well, I don't know of an Erlang application that implements an easy > API for this particular functionality. But AFAIK active directory is > essentially LDAP, and (obviously) communicates over TCP sockets. If > you have a good definition of the protocol used, then Erlang's binary/ > bit syntax does make it relatively painless to implement a binary > protocol, and gives you excellent control over socket communications. > Definitely the binary/bit syntax is worth exploring as it is one of > the great strengths of the language. This feature of Erlang will > likely not meet your immediate need, but you'd be surprised at how > quickly something like that can be done in Erlang compared to, say, an > imperative language. > > Others here may be able to provide APIs/port drivers written with > Erlang/OTP that get you closer with the AD and save some effort. Maybe this will help: https://github.com/etnt/eldap /Richard > Meantime, I wish you luck and enjoyment in your journey with Erlang > and OTP :) > > /s > > On Dec 2, 3:56 pm, Winston S?nchez wrote: >> I'm new at erlang programing, I need to know if is possible exchange >> messages with active directory with erlang's module. >> thanks for your attention >> >> _______________________________________________ >> erlang-questions mailing list >> erlang-questi...@REDACTED://erlang.org/mailman/listinfo/erlang-questions > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions From zabrane3@REDACTED Sat Dec 3 08:32:32 2011 From: zabrane3@REDACTED (Zabrane Mickael) Date: Sat, 3 Dec 2011 08:32:32 +0100 Subject: [erlang-questions] cassandra In-Reply-To: References: Message-ID: <696BBCD5-C9D7-4EF3-922B-E93595BEC503@gmail.com> https://github.com/lpgauth/cassanderl.git Regards, Zabrane On Dec 2, 2011, at 8:58 AM, Roberto Ostinelli wrote: > dear list, > > is anyone working on a *real* cassandra client? i've looked around but all i found were sparse examples and a simple client which hasn't commits since last march. > > r. > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions From watson.timothy@REDACTED Sat Dec 3 16:31:56 2011 From: watson.timothy@REDACTED (Tim Watson) Date: Sat, 3 Dec 2011 15:31:56 +0000 Subject: [erlang-questions] rebar -- how do I get useful error messages In-Reply-To: References: Message-ID: On 2 December 2011 22:36, Jon Watte wrote: > unfortunately, when I do this, the paths that come out of the compiler > error messages does not contain the "apps" directory or the name of the > actual app. For example, if I have an error in the file > "apps/myapp/src/somefile.erl" then the error message will say > "src/somefile.erl:44: some error here." > THIS, in turn, breaks the go-to-compile-error logic for the editor -- it > cannot find the file in question. I can string-substitute the output of > rebar to tack on "apps/" in front, but without the actual application, > that's not good enough, and I don't easily know which app name to also tack > on. > > So -- how do you guys solve this? Jumping to compile errors in the editor > is one of those basics that nobody really wants to live without, so I can't > imagine that an entire community is living without... > > I think rebar is not the source of the shortened error message here, but rather the error message is being generated by the `compile' module itself. The rebar_erlc_compiler does pass on the 'report' option to compile:file/2, but this just prints out warnings and errors. The reason that the error message only contains the 'src' directory is that rebar changes into subdirectories (using file:set_cwd/1) before processing them. If you wanted to annotate the errors, you'd need to patch rebar_erlc_compiler and do something like: case compile:file(Source, [return_errors|Opts]) of {ok, _} -> ok; {error, Errors, _} -> [ ?ERROR("~s: ~s", [filename:absname(File), compile:format_error(Err)]) || {F, Err} <- Errors ], ?ABORT("Compilation failed!~n", []) end; The place you'd need to make that change is here: https://github.com/basho/rebar/blob/master/src/rebar_erlc_compiler.erl#L258 HTH. BTW I have no idea whether or not this would make it into rebar, nor if it's even the best approach. There may be far better ways of doing this, so I'd suggest discussion on the rebar mailing list as a next step, unless you're happy maintaining your own fork. Cheers, Tim -------------- next part -------------- An HTML attachment was scrubbed... URL: From sigmastar@REDACTED Sat Dec 3 22:05:06 2011 From: sigmastar@REDACTED (Jesse Gumm) Date: Sat, 3 Dec 2011 15:05:06 -0600 Subject: [erlang-questions] reltool not copying erl_interface Message-ID: Hello everyone, This is a followup to a post I made a few months ago[1], which was probably too and meandering for anyone to read (I struggle with brevity). The short version is that for the life of me, I cannot find a way to force the erl_interface dir to get copied with reltool. There are reltool options for forcing an app to get copied, but erl_interface isn't an app (ie, doesn't have a .app file). Anyone have any thoughts on this? Thanks in advance, -Jesse [1] http://erlang.org/pipermail/erlang-questions/2011-October/061923.html -- Jesse Gumm Sigma Star Systems 414.940.4866 gumm@REDACTED http://www.sigma-star.com From dmkolesnikov@REDACTED Sun Dec 4 08:46:48 2011 From: dmkolesnikov@REDACTED (Dmitry Kolesnikov) Date: Sun, 4 Dec 2011 09:46:48 +0200 Subject: [erlang-questions] reltool not copying erl_interface In-Reply-To: References: Message-ID: <485D1480-BEE3-4309-809F-5D42282CBACD@gmail.com> Hello Jesse, I've been using GNU auto tools to manage and build erlang projects. It gives you a flexibility to mix both erlang and native code. In terms of release management, systools is not flexible as I wish thus a two pass processing of tar ball is required but this is straight forward with GNU make. - Dmitry On 3.12.2011, at 23.05, Jesse Gumm wrote: > Hello everyone, > > This is a followup to a post I made a few months ago[1], which was > probably too and meandering for anyone to read (I struggle with > brevity). > > The short version is that for the life of me, I cannot find a way to > force the erl_interface dir to get copied with reltool. > > There are reltool options for forcing an app to get copied, but > erl_interface isn't an app (ie, doesn't have a .app file). > > Anyone have any thoughts on this? > > Thanks in advance, > > -Jesse > > [1] http://erlang.org/pipermail/erlang-questions/2011-October/061923.html > > -- > Jesse Gumm > Sigma Star Systems > 414.940.4866 > gumm@REDACTED > http://www.sigma-star.com > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions From barcojie@REDACTED Sun Dec 4 09:51:28 2011 From: barcojie@REDACTED (Barco You) Date: Sun, 4 Dec 2011 16:51:28 +0800 Subject: [erlang-questions] illegal guard expression for IF illegal guard expression for "if" In-Reply-To: References: <4ED89F79.6090607@gmail.com> <4ED8A31A.2020700@gmail.com> <4ED8A5DF.70301@gmail.com> Message-ID: But, if explaining in this way it has nothing to do with side-effect. It's just because the guard expression is stochastic rather than deterministic. If having a deterministic function in the 'if' guard expression, we still get 'illegal guard expression'. According to the document provided by some guys in previous mails, the foundamental reason is that the erlang VM does not make sure whether a function in the guard expression has side-effect. So, I hope to know why functions with side-effect can not be the guard expression. Thank you all! Barco On Dec 2, 2011 10:42 PM, "Barco You" wrote: > Ooooh! Maybe I understand now! > > It means that if the first branch is not satisfied, saying get 0.7, then > random:uniform() would be evaluated again in the second branch and it > possible to get a value less than 0.5, which then makes a paradox. Right? > > In the contrast, with case statement, the condition is only evaluated once > no matter whichever branch would be satisfied. > > How smart erlang is, and how amazing you erlangers are! > > Barco > On Dec 2, 2011 6:18 PM, "CGS" wrote: > >> ** >> Just to make it clearer: >> >> The second condition is equivalent with the expression: "if the value of >> random:uniform() is greater or equal to 0.5 then report 'bad'". In this >> case, if you entered with value 0.4 in the first branch and modified it to >> 0.7 in the first branch, the second branch should be executed as well. That >> is against the if statement purpose which should report only one branch at >> the time as valid. Therefore, Erlang requires for the compared values to be >> constant during the if statement processing. >> >> CGS >> >> >> >> On 12/02/2011 11:06 AM, CGS wrote: >> >> If statement is not a block statement (to fix the variables values at the >> entrance of the statement) in Erlang. That means, if an uniform:random() >> value (say, 0.4) is used for checking the first branch condition and the >> value is changed within the branch (say, 0.7), then you enter a paradox >> related to if the function should be considered for the first or the second >> branch. To avoid this, Erlang requires an assurance that the compared >> values do not change while processing the if statement. >> >> CGS >> >> >> >> On 12/02/2011 10:56 AM, Barco You wrote: >> >> Hi CGS, >> >> I can't understand your statement --- " if in the first branch you use >> again random:uniform(), the second branch condition can report an >> inaccurate result." Could you please make it clearer? Thanks! >> >> Hi Others, >> >> Why functions with side effect can not be in the guard expressions? >> >> >> Thank you! >> Barco >> >> On Fri, Dec 2, 2011 at 5:50 PM, CGS wrote: >> >>> Hi, >>> >>> To put in simple words for better understanding, you can have only >>> constant variables withing the guard expression. That means, in your case, >>> if in the first branch you use again random:uniform(), the second branch >>> condition can report an inaccurate result. >>> >>> Alternatively, you can use case statement: >>> >>> case (random:uniform()<0.5) of >>> true -> good; >>> false -> bad >>> end >>> >>> I hope this answer will help you. >>> >>> CGS >>> >>> >>> >>> >>> On 12/02/2011 10:30 AM, Barco You wrote: >>> >>> Why does the following expression got "illegal guard expression" when >>> compiling: >>> X = 0.5, >>> if >>> random:uniform() < X -> %error reported for this line >>> good; >>> true -> >>> bad >>> end. >>> >>> But if I change it to following expression, it's ok: >>> X = 0.5, >>> Ran = random:uniform(), >>> if >>> Ran < X -> >>> good; >>> true -> >>> bad >>> end. >>> >>> BRs, >>> Barco >>> >>> >>> _______________________________________________ >>> erlang-questions mailing listerlang-questions@REDACTED://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 Sun Dec 4 10:17:37 2011 From: ulf@REDACTED (Ulf Wiger) Date: Sun, 4 Dec 2011 10:17:37 +0100 Subject: [erlang-questions] illegal guard expression for IF illegal guard expression for "if" In-Reply-To: References: <4ED89F79.6090607@gmail.com> <4ED8A31A.2020700@gmail.com> <4ED8A5DF.70301@gmail.com> Message-ID: <5B4A13ED-8CA4-40A8-9501-04A785A6C7DF@feuerlabs.com> You should see guards as an extension of pattern matching. If a guard function would have side-effects, the overall evaluation would most likely not be deterministic, and - most importantly perhaps - would be extremely difficult to understand and reason about. Ideally, the function should also be O(1), although a few O(N) guards, like length/1, are also allowed. For this reason, programmers can normally regard pattern-matching as extremely efficient, and use it extensively, trusting that the compiler will do a good job optimizing it. It is correct that the compiler is not able to determine, at present, whether a function is referentially transparent. It also cannot determine the complexity of a function. BR, Ulf W On 4 Dec 2011, at 09:51, Barco You wrote: > But, if explaining in this way it has nothing to do with side-effect. It's just because the guard expression is stochastic rather than deterministic. > > If having a deterministic function in the 'if' guard expression, we still get 'illegal guard expression'. According to the document provided by some guys in previous mails, the foundamental reason is that the erlang VM does not make sure whether a function in the guard expression has side-effect. > > So, I hope to know why functions with side-effect can not be the guard expression. > > Thank you all! > Barco > > On Dec 2, 2011 10:42 PM, "Barco You" wrote: > Ooooh! Maybe I understand now! > > It means that if the first branch is not satisfied, saying get 0.7, then random:uniform() would be evaluated again in the second branch and it possible to get a value less than 0.5, which then makes a paradox. Right? > > In the contrast, with case statement, the condition is only evaluated once no matter whichever branch would be satisfied. > > How smart erlang is, and how amazing you erlangers are! > > Barco > > On Dec 2, 2011 6:18 PM, "CGS" wrote: > Just to make it clearer: > > The second condition is equivalent with the expression: "if the value of random:uniform() is greater or equal to 0.5 then report 'bad'". In this case, if you entered with value 0.4 in the first branch and modified it to 0.7 in the first branch, the second branch should be executed as well. That is against the if statement purpose which should report only one branch at the time as valid. Therefore, Erlang requires for the compared values to be constant during the if statement processing. > > CGS > > > > On 12/02/2011 11:06 AM, CGS wrote: >> >> If statement is not a block statement (to fix the variables values at the entrance of the statement) in Erlang. That means, if an uniform:random() value (say, 0.4) is used for checking the first branch condition and the value is changed within the branch (say, 0.7), then you enter a paradox related to if the function should be considered for the first or the second branch. To avoid this, Erlang requires an assurance that the compared values do not change while processing the if statement. >> >> CGS >> >> >> >> On 12/02/2011 10:56 AM, Barco You wrote: >>> >>> Hi CGS, >>> >>> I can't understand your statement --- " if in the first branch you use again random:uniform(), the second branch condition can report an inaccurate result." Could you please make it clearer? Thanks! >>> >>> Hi Others, >>> >>> Why functions with side effect can not be in the guard expressions? >>> >>> >>> Thank you! >>> Barco >>> >>> On Fri, Dec 2, 2011 at 5:50 PM, CGS wrote: >>> Hi, >>> >>> To put in simple words for better understanding, you can have only constant variables withing the guard expression. That means, in your case, if in the first branch you use again random:uniform(), the second branch condition can report an inaccurate result. >>> >>> Alternatively, you can use case statement: >>> >>> case (random:uniform()<0.5) of >>> true -> good; >>> false -> bad >>> end >>> >>> I hope this answer will help you. >>> >>> CGS >>> >>> >>> >>> >>> On 12/02/2011 10:30 AM, Barco You wrote: >>>> Why does the following expression got "illegal guard expression" when compiling: >>>> X = 0.5, >>>> if >>>> random:uniform() < X -> %error reported for this line >>>> good; >>>> true -> >>>> bad >>>> end. >>>> >>>> But if I change it to following expression, it's ok: >>>> X = 0.5, >>>> Ran = random:uniform(), >>>> if >>>> Ran < X -> >>>> good; >>>> true -> >>>> bad >>>> end. >>>> >>>> BRs, >>>> Barco >>>> >>>> _______________________________________________ >>>> 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 gumm@REDACTED Sun Dec 4 21:06:34 2011 From: gumm@REDACTED (Jesse Gumm) Date: Sun, 4 Dec 2011 14:06:34 -0600 Subject: [erlang-questions] reltool not copying erl_interface In-Reply-To: <485D1480-BEE3-4309-809F-5D42282CBACD@gmail.com> References: <485D1480-BEE3-4309-809F-5D42282CBACD@gmail.com> Message-ID: Hi, I realize, of course, that I can do workarounds to this issue (and so far my workaround has been a modified rebar), but my concern is that I believe this *should* be something that is properly handled by reltool, at the very least when using {profile,development}. Anyone else can shed some light on this? -Jesse On Sun, Dec 4, 2011 at 1:46 AM, Dmitry Kolesnikov wrote: > Hello Jesse, > > I've been using GNU auto tools to manage and build erlang projects. It gives you a flexibility to mix both erlang and native code. In terms of release management, systools is not flexible as I wish thus a two pass processing of tar ball is required but this is straight forward with GNU make. > > - Dmitry > > On 3.12.2011, at 23.05, Jesse Gumm wrote: > >> Hello everyone, >> >> This is a followup to a post I made a few months ago[1], which was >> probably too and meandering for anyone to read (I struggle with >> brevity). >> >> The short version is that for the life of me, I cannot find a way to >> force the erl_interface dir to get copied with reltool. >> >> There are reltool options for forcing an app to get copied, but >> erl_interface isn't an app (ie, doesn't have a .app file). >> >> Anyone have any thoughts on this? >> >> Thanks in advance, >> >> -Jesse >> >> [1] http://erlang.org/pipermail/erlang-questions/2011-October/061923.html >> >> -- >> Jesse Gumm >> Sigma Star Systems >> 414.940.4866 >> gumm@REDACTED >> http://www.sigma-star.com >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://erlang.org/mailman/listinfo/erlang-questions -- Jesse Gumm Sigma Star Systems 414.940.4866 gumm@REDACTED http://www.sigma-star.com From watson.timothy@REDACTED Sun Dec 4 21:40:54 2011 From: watson.timothy@REDACTED (Tim Watson) Date: Sun, 4 Dec 2011 20:40:54 +0000 Subject: [erlang-questions] reltool not copying erl_interface In-Reply-To: References: <485D1480-BEE3-4309-809F-5D42282CBACD@gmail.com> Message-ID: Can't shed any light on the reltool issue, but if you're customising your rebar build, you should probably just use a plugin instead of a customised rebar binary. A plugin makes this very simple (and can be distributed across multiple projects if you package it as a mini-library). -module(fix_rel_plugin). -export([post_generate/2]). post_generate(Config, _) -> Path = code:lib_dir(erl_interface), rebar_file_utils:cp_r(Path, filename:join([rebar_utils:get_cwd(), "myproject", "lib", filename:basename(Path)])), ok. %% rebar.config {plugins, [fix_rel_plugin]}. At least until reltool gets fixed or the problem better diagnosed you don't have to maintain a custom rebar fork/branch that way. On 4 December 2011 20:06, Jesse Gumm wrote: > Hi, > > I realize, of course, that I can do workarounds to this issue (and so > far my workaround has been a modified rebar), but my concern is that I > believe this *should* be something that is properly handled by > reltool, at the very least when using {profile,development}. > > Anyone else can shed some light on this? > > -Jesse > > On Sun, Dec 4, 2011 at 1:46 AM, Dmitry Kolesnikov > wrote: > > Hello Jesse, > > > > I've been using GNU auto tools to manage and build erlang projects. It > gives you a flexibility to mix both erlang and native code. In terms of > release management, systools is not flexible as I wish thus a two pass > processing of tar ball is required but this is straight forward with GNU > make. > > > > - Dmitry > > > > On 3.12.2011, at 23.05, Jesse Gumm wrote: > > > >> Hello everyone, > >> > >> This is a followup to a post I made a few months ago[1], which was > >> probably too and meandering for anyone to read (I struggle with > >> brevity). > >> > >> The short version is that for the life of me, I cannot find a way to > >> force the erl_interface dir to get copied with reltool. > >> > >> There are reltool options for forcing an app to get copied, but > >> erl_interface isn't an app (ie, doesn't have a .app file). > >> > >> Anyone have any thoughts on this? > >> > >> Thanks in advance, > >> > >> -Jesse > >> > >> [1] > http://erlang.org/pipermail/erlang-questions/2011-October/061923.html > >> > >> -- > >> Jesse Gumm > >> Sigma Star Systems > >> 414.940.4866 > >> gumm@REDACTED > >> http://www.sigma-star.com > >> _______________________________________________ > >> erlang-questions mailing list > >> erlang-questions@REDACTED > >> http://erlang.org/mailman/listinfo/erlang-questions > > > > -- > Jesse Gumm > Sigma Star Systems > 414.940.4866 > gumm@REDACTED > http://www.sigma-star.com > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From gumm@REDACTED Sun Dec 4 22:07:26 2011 From: gumm@REDACTED (Jesse Gumm) Date: Sun, 4 Dec 2011 15:07:26 -0600 Subject: [erlang-questions] reltool not copying erl_interface In-Reply-To: References: <485D1480-BEE3-4309-809F-5D42282CBACD@gmail.com> Message-ID: Thanks Tim, that's definitely a much more elegant solution than maintaining my hacky fork, thanks for the insight. I'll play around with this and see if this doesn't work for my immediate needs at least as a better (hopefully temporary) workaround to the reltool issue. -Jesse On Sun, Dec 4, 2011 at 2:40 PM, Tim Watson wrote: > Can't shed any light on the reltool issue, but if you're customising your > rebar build, you should probably just use a plugin instead of a customised > rebar binary. A plugin makes this very simple (and can be distributed across > multiple projects if you package it as a mini-library). > > -module(fix_rel_plugin). > -export([post_generate/2]). > > post_generate(Config, _) -> > ? ? Path =?code:lib_dir(erl_interface), > ? ? rebar_file_utils:cp_r(Path, > ? ? ? ? filename:join([rebar_utils:get_cwd(), "myproject", "lib", > ? ? ? ? ? ? filename:basename(Path)])), > ? ? ok. > > %% rebar.config > {plugins, [fix_rel_plugin]}. > > At least until reltool gets fixed or the problem better diagnosed you don't > have to maintain a custom rebar fork/branch that way. > > > On 4 December 2011 20:06, Jesse Gumm wrote: >> >> Hi, >> >> I realize, of course, that I can do workarounds to this issue (and so >> far my workaround has been a modified rebar), but my concern is that I >> believe this *should* be something that is properly handled by >> reltool, at the very least when using {profile,development}. >> >> Anyone else can shed some light on this? >> >> -Jesse >> >> On Sun, Dec 4, 2011 at 1:46 AM, Dmitry Kolesnikov >> wrote: >> > Hello Jesse, >> > >> > I've been using GNU auto tools to manage and build erlang projects. It >> > gives you a flexibility to mix both erlang and native code. In terms of >> > release management, systools is not flexible as I wish thus a two pass >> > processing of tar ball is required but this is straight forward with GNU >> > make. >> > >> > - Dmitry >> > >> > On 3.12.2011, at 23.05, Jesse Gumm wrote: >> > >> >> Hello everyone, >> >> >> >> This is a followup to a post I made a few months ago[1], which was >> >> probably too and meandering for anyone to read (I struggle with >> >> brevity). >> >> >> >> The short version is that for the life of me, I cannot find a way to >> >> force the erl_interface dir to get copied with reltool. >> >> >> >> There are reltool options for forcing an app to get copied, but >> >> erl_interface isn't an app (ie, doesn't have a .app file). >> >> >> >> Anyone have any thoughts on this? >> >> >> >> Thanks in advance, >> >> >> >> -Jesse >> >> >> >> [1] >> >> http://erlang.org/pipermail/erlang-questions/2011-October/061923.html >> >> >> >> -- >> >> Jesse Gumm >> >> Sigma Star Systems >> >> 414.940.4866 >> >> gumm@REDACTED >> >> http://www.sigma-star.com >> >> _______________________________________________ >> >> erlang-questions mailing list >> >> erlang-questions@REDACTED >> >> http://erlang.org/mailman/listinfo/erlang-questions >> >> >> >> -- >> Jesse Gumm >> Sigma Star Systems >> 414.940.4866 >> gumm@REDACTED >> http://www.sigma-star.com >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://erlang.org/mailman/listinfo/erlang-questions > > -- Jesse Gumm Sigma Star Systems 414.940.4866 gumm@REDACTED http://www.sigma-star.com From ok@REDACTED Mon Dec 5 00:41:25 2011 From: ok@REDACTED (Richard O'Keefe) Date: Mon, 5 Dec 2011 12:41:25 +1300 Subject: [erlang-questions] Instrumentation In-Reply-To: References: Message-ID: On 3/12/2011, at 8:58 AM, Tim Watson wrote: > The purpose of this prototyping was to play around with some of the ideas in Aspect Oriented Programming, and the library allows you to write code that executes before, after or around an annotated function. TOPS-20 Interlisp, 1981, chapter 19: ADVISING. I'm fairly confident the advice package was mainly the work of Warren Teitelman. Designed and implemented by Warren Teitelman. If you start with (LAMBDA arguments body) advising gives you (LAMBDA arguments (PROG (!VALUE) (SETQ !VALUE (PROG NIL before-advice-1 ... before-advice-n (RETURN body))) after-advice-1 ... after-advice-m (RETURN !VALUE))) except that the versions of PROG, SETQ, and VALUE used are special ones so that macros cannot clobber them. (ADVISE function [when [where]] what) function is the function to advise, it could be a name or (f-1 IN f-2), or some other things; when is BEFORE, AFTER, or AROUND; where is LAST, BOTTOM, or END (put after existing advice, FIRST or TOP (put before existing advice), or an editor command; what is the code to be run, and for AROUND advice it may include a * as an expression, showing where the existing code is to be plugged. It is important to give credit for ideas where it is really due. It is possible that someone else may have had the advice package idea before Warren Teitelman and the rest of the INTERLISP crew, but it's the first publication of the idea I've ever seen, and long predates all the hoopla about Aspect-Oriented Programming. (As indeed does Erik Sandewall's writing about what he called 'insertive programming'.) Before, after, and around advice is very handy, especially for debugging. I'm delighted to see it becoming available for Erlang. But credit where credit's due, eh? From wsanchez@REDACTED Mon Dec 5 02:09:50 2011 From: wsanchez@REDACTED (=?ISO-8859-1?Q?Winston_S=E1nchez?=) Date: Sun, 4 Dec 2011 20:09:50 -0500 Subject: [erlang-questions] Active Directory In-Reply-To: <4ED978D2.8030105@gmail.com> References: <6db0d17e-af88-4ddb-a5b1-86df69aa8a00@o13g2000vbo.googlegroups.com> <4ED978D2.8030105@gmail.com> Message-ID: thanks for you answer I'll check your advice and sorry for my late answer, I've reading about esasl that use gsasl and i don't know how to use that tool. Please if you have a example about that one, you'll help me so much 2011/12/2 Richard Carlsson > On 12/03/2011 01:48 AM, Steve Davis wrote: > >> Hi Winston, >> >> This answer will not be directly helpful, and it's quite possible that >> someone else has done a lot of the work towards this capability within >> the (very helpful) community here. So please take my answer within the >> spirit it is meant. >> >> For sure it is possible to do this in Erlang. (Unless a programming >> language has a severe defect, it is always possible to do something >> with software :). >> >> The question is, how much effort will it take to achieve it? >> >> Well, I don't know of an Erlang application that implements an easy >> API for this particular functionality. But AFAIK active directory is >> essentially LDAP, and (obviously) communicates over TCP sockets. If >> you have a good definition of the protocol used, then Erlang's binary/ >> bit syntax does make it relatively painless to implement a binary >> protocol, and gives you excellent control over socket communications. >> Definitely the binary/bit syntax is worth exploring as it is one of >> the great strengths of the language. This feature of Erlang will >> likely not meet your immediate need, but you'd be surprised at how >> quickly something like that can be done in Erlang compared to, say, an >> imperative language. >> >> Others here may be able to provide APIs/port drivers written with >> Erlang/OTP that get you closer with the AD and save some effort. >> > > Maybe this will help: > https://github.com/etnt/eldap > > /Richard > > > Meantime, I wish you luck and enjoyment in your journey with Erlang >> and OTP :) >> >> /s >> >> On Dec 2, 3:56 pm, Winston S?nchez wrote: >> >>> I'm new at erlang programing, I need to know if is possible exchange >>> messages with active directory with erlang's module. >>> thanks for your attention >>> >>> ______________________________**_________________ >>> erlang-questions mailing list >>> erlang-questi...@REDACTED**orghttp://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 barcojie@REDACTED Mon Dec 5 02:44:56 2011 From: barcojie@REDACTED (Barco You) Date: Mon, 5 Dec 2011 09:44:56 +0800 Subject: [erlang-questions] illegal guard expression for IF illegal guard expression for "if" In-Reply-To: <5B4A13ED-8CA4-40A8-9501-04A785A6C7DF@feuerlabs.com> References: <4ED89F79.6090607@gmail.com> <4ED8A31A.2020700@gmail.com> <4ED8A5DF.70301@gmail.com> <5B4A13ED-8CA4-40A8-9501-04A785A6C7DF@feuerlabs.com> Message-ID: Hi Ulf, Thank you a lot for your insightful explanation! BRs, Barco On Sun, Dec 4, 2011 at 5:17 PM, Ulf Wiger wrote: > You should see guards as an extension of pattern matching. > > If a guard function would have side-effects, the overall evaluation would > most likely not be deterministic, and - most importantly perhaps - would be > extremely difficult to understand and reason about. Ideally, the function > should also be O(1), although a few O(N) guards, like length/1, are also > allowed. For this reason, programmers can normally regard pattern-matching > as extremely efficient, and use it extensively, trusting that the compiler > will do a good job optimizing it. > > It is correct that the compiler is not able to determine, at present, > whether a function is referentially transparent. It also cannot determine > the complexity of a function. > > BR, > Ulf W > > On 4 Dec 2011, at 09:51, Barco You wrote: > > But, if explaining in this way it has nothing to do with side-effect. It's > just because the guard expression is stochastic rather than deterministic. > > If having a deterministic function in the 'if' guard expression, we still > get 'illegal guard expression'. According to the document provided by some > guys in previous mails, the foundamental reason is that the erlang VM does > not make sure whether a function in the guard expression has side-effect. > > So, I hope to know why functions with side-effect can not be the guard > expression. > > Thank you all! > Barco > On Dec 2, 2011 10:42 PM, "Barco You" wrote: > >> Ooooh! Maybe I understand now! >> >> It means that if the first branch is not satisfied, saying get 0.7, then >> random:uniform() would be evaluated again in the second branch and it >> possible to get a value less than 0.5, which then makes a paradox. Right? >> >> In the contrast, with case statement, the condition is only evaluated >> once no matter whichever branch would be satisfied. >> >> How smart erlang is, and how amazing you erlangers are! >> >> Barco >> On Dec 2, 2011 6:18 PM, "CGS" wrote: >> >>> ** >>> Just to make it clearer: >>> >>> The second condition is equivalent with the expression: "if the value of >>> random:uniform() is greater or equal to 0.5 then report 'bad'". In this >>> case, if you entered with value 0.4 in the first branch and modified it to >>> 0.7 in the first branch, the second branch should be executed as well. That >>> is against the if statement purpose which should report only one branch at >>> the time as valid. Therefore, Erlang requires for the compared values to be >>> constant during the if statement processing. >>> >>> CGS >>> >>> >>> >>> On 12/02/2011 11:06 AM, CGS wrote: >>> >>> If statement is not a block statement (to fix the variables values at >>> the entrance of the statement) in Erlang. That means, if an >>> uniform:random() value (say, 0.4) is used for checking the first branch >>> condition and the value is changed within the branch (say, 0.7), then you >>> enter a paradox related to if the function should be considered for the >>> first or the second branch. To avoid this, Erlang requires an assurance >>> that the compared values do not change while processing the if statement. >>> >>> CGS >>> >>> >>> >>> On 12/02/2011 10:56 AM, Barco You wrote: >>> >>> Hi CGS, >>> >>> I can't understand your statement --- " if in the first branch you use >>> again random:uniform(), the second branch condition can report an >>> inaccurate result." Could you please make it clearer? Thanks! >>> >>> Hi Others, >>> >>> Why functions with side effect can not be in the guard expressions? >>> >>> >>> Thank you! >>> Barco >>> >>> On Fri, Dec 2, 2011 at 5:50 PM, CGS wrote: >>> >>>> Hi, >>>> >>>> To put in simple words for better understanding, you can have only >>>> constant variables withing the guard expression. That means, in your case, >>>> if in the first branch you use again random:uniform(), the second branch >>>> condition can report an inaccurate result. >>>> >>>> Alternatively, you can use case statement: >>>> >>>> case (random:uniform()<0.5) of >>>> true -> good; >>>> false -> bad >>>> end >>>> >>>> I hope this answer will help you. >>>> >>>> CGS >>>> >>>> >>>> >>>> >>>> On 12/02/2011 10:30 AM, Barco You wrote: >>>> >>>> Why does the following expression got "illegal guard expression" when >>>> compiling: >>>> X = 0.5, >>>> if >>>> random:uniform() < X -> %error reported for this line >>>> good; >>>> true -> >>>> bad >>>> end. >>>> >>>> But if I change it to following expression, it's ok: >>>> X = 0.5, >>>> Ran = random:uniform(), >>>> if >>>> Ran < X -> >>>> good; >>>> true -> >>>> bad >>>> end. >>>> >>>> BRs, >>>> Barco >>>> >>>> >>>> _______________________________________________ >>>> erlang-questions mailing listerlang-questions@REDACTED://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 ok@REDACTED Mon Dec 5 02:50:54 2011 From: ok@REDACTED (Richard O'Keefe) Date: Mon, 5 Dec 2011 14:50:54 +1300 Subject: [erlang-questions] illegal guard expression for IF illegal guard expression for "if" In-Reply-To: References: <4ED89F79.6090607@gmail.com> <4ED8A31A.2020700@gmail.com> <4ED8A5DF.70301@gmail.com> Message-ID: The essential point is that guards are part of pattern matching, and that to make pattern matching efficient you want the compiler to be able to move stuff around a fair bit. Now consider f(X, Y) when g(X), X > 0 -> ... This has the *same* meaning and effect as f(X, Y) when X > 0, g(X) -> ... but it wouldn't have if g(_) could be an arbitrary function. Back when I was still at RMIT I proposed stealing an idea from NU Prolog, which had ":- pure " declarations to inform the compiler that had no side effects &c. That's not quite strong enough: for a guard expression we want to know that it is pure and *bounded*. In the presence of bignum arithmetic, "bounded" is a little hard to define, but "time and temporary workspace polynominal in the inputs" gets close. Abstract patterns turn out to provide *exactly* the right mixture of expressiveness to handle most I-wish-I-could-call-this-in-a-guard needs and limitation to make it safe. From dan@REDACTED Mon Dec 5 03:57:43 2011 From: dan@REDACTED (Daniel Dormont) Date: Sun, 4 Dec 2011 21:57:43 -0500 Subject: [erlang-questions] illegal guard expression for IF illegal guard expression for "if" In-Reply-To: References: <4ED89F79.6090607@gmail.com> <4ED8A31A.2020700@gmail.com> <4ED8A5DF.70301@gmail.com> Message-ID: In my experience with Erlang so far, this is perhaps the weirdest feature for me from a language standpoint. I understand the motivations, but at least from where I sit, it's a weird mental leap from there to "we allow these few functions, but not others." In fact, not even all of the allowed functions are "pure" in the sense that, say, a Haskell programmer would recognize. I'm specifically thinking of node/0 and self/0. Still, I put this in the category of things not to worry about, just accept and move on. What are abstract patterns? dan On Sun, Dec 4, 2011 at 8:50 PM, Richard O'Keefe wrote: > The essential point is that guards are part of pattern matching, > and that to make pattern matching efficient you want the compiler > to be able to move stuff around a fair bit. ?Now consider > > f(X, Y) when g(X), X > 0 -> ... > > This has the *same* meaning and effect as > > f(X, Y) when X > 0, g(X) -> ... > > but it wouldn't have if g(_) could be an arbitrary function. > > Back when I was still at RMIT I proposed stealing an idea from > NU Prolog, which had ":- pure " declarations to > inform the compiler that had no side effects &c. > That's not quite strong enough: ?for a guard expression we want > to know that it is pure and *bounded*. ?In the presence of bignum > arithmetic, "bounded" is a little hard to define, but > "time and temporary workspace polynominal in the inputs" gets close. > > Abstract patterns turn out to provide *exactly* the right mixture of > expressiveness to handle most I-wish-I-could-call-this-in-a-guard > needs and limitation to make it safe. > > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions From spawn.think@REDACTED Mon Dec 5 11:20:49 2011 From: spawn.think@REDACTED (Ahmed Omar) Date: Mon, 5 Dec 2011 11:20:49 +0100 Subject: [erlang-questions] [ANN] Join us for the 1st ErlanG+ Hangout With Joe Armstrong Message-ID: Date : Thursday, 7th December 2011 Time : 7 PM (GMT) It's FREE, Just +1 the post and we will be expecting yo https://plus.google.com/108730584872406072872/posts/LcxLf5JeFxK Erlang on Google+ http://gplus.to/Erlang -- Best Regards, - Ahmed Omar http://nl.linkedin.com/in/adiaa Follow me on twitter @spawn_think -------------- next part -------------- An HTML attachment was scrubbed... URL: From watson.timothy@REDACTED Mon Dec 5 11:34:14 2011 From: watson.timothy@REDACTED (Tim Watson) Date: Mon, 5 Dec 2011 10:34:14 +0000 Subject: [erlang-questions] Instrumentation In-Reply-To: References: Message-ID: On 4 December 2011 23:41, Richard O'Keefe wrote: > > On 3/12/2011, at 8:58 AM, Tim Watson wrote: > > The purpose of this prototyping was to play around with some of the > ideas in Aspect Oriented Programming, and the library allows you to write > code that executes before, after or around an annotated function. > > > TOPS-20 Interlisp, 1981, chapter 19: ADVISING. > I'm fairly confident the advice package was mainly > the work of Warren Teitelman. > Designed and implemented by Warren Teitelman. > If you start with > (LAMBDA arguments body) > advising gives you > (LAMBDA arguments (PROG (!VALUE) > (SETQ !VALUE (PROG NIL > before-advice-1 > ... > before-advice-n > (RETURN body))) > after-advice-1 > ... > after-advice-m > (RETURN !VALUE))) > except that the versions of PROG, SETQ, and VALUE used are > special ones so that macros cannot clobber them. > > (ADVISE function [when [where]] what) > function is the function to advise, it could be a name > or (f-1 IN f-2), or some other things; > when is BEFORE, AFTER, or AROUND; > where is LAST, BOTTOM, or END (put after existing > advice, FIRST or TOP (put before existing advice), > or an editor command; > what is the code to be run, and for AROUND advice it > may include a * as an expression, showing where the > existing code is to be plugged. > > It is important to give credit for ideas where it is really due. > It is possible that someone else may have had the advice package > idea before Warren Teitelman and the rest of the INTERLISP crew, > but it's the first publication of the idea I've ever seen, and > long predates all the hoopla about Aspect-Oriented Programming. > (As indeed does Erik Sandewall's writing about what he called > 'insertive programming'.) > > Before, after, and around advice is very handy, especially for > debugging. I'm delighted to see it becoming available for > Erlang. But credit where credit's due, eh? > > Richard, absolutely. I've never pretended to be an inventor, but rather someone capable of looking at other people's inventions and applying them to interesting problems to produce (hopefully) useful solutions. To be perfectly honest, I'd never heard of INTERLISP (I am just a young'un though) and AOP is simply the name for this *stuff* that I'm familiar with. Thanks for sharing the proper context around this - I now have some serious lunchtime reading to do! :) The quote about having "a * as an expression" is very interesting, as I think having the ability to bind annotations/advice to modules/functions declaratively could be very useful. I wondered if match specifications would be the way to go for this, but I'm hoping some further feedback from the community can help cement my thinking about how best to do it. Cheers, Tim -------------- next part -------------- An HTML attachment was scrubbed... URL: From michal.ptaszek@REDACTED Mon Dec 5 12:08:16 2011 From: michal.ptaszek@REDACTED (=?utf-8?Q?Micha=C5=82?= Ptaszek) Date: Mon, 05 Dec 2011 11:08:16 -0000 (GMT) Subject: [erlang-questions] Instrumentation In-Reply-To: Message-ID: Hi Tim, you might want to take a look at ennotation: it's something I've derived from erlang-web, but which has been reimplemented from scratch. https://github.com/paulgray/ennotation Best regards, Michal Ptaszek ----- Original Message ----- > There have been a few conversations about instrumentation libraries > on the > list, and I've been experimenting with the features Ulf recently > added to > parse_trans. I've worked up a simple annotations library, that let's > you > put attributes/annotations on specific functions and attach behaviour > to > them in the form of an implementation module. The current framework > is very > crude and relies on a compile time parse transform, though obviously > it'll > be relatively trivial to implement runtime code changes as well. > > The purpose of this prototyping was to play around with some of the > ideas > in Aspect Oriented Programming, and the library allows you to write > code > that executes before, after or around an annotated function. This is > done > without macros, which feels a bit neater to me than the approach used > in > erlang-web. In addition to the library, I've made a small reference > project > which implements a simple function memoization annotation using ets > as a > cache. The implementation of the annotation itself is very simple: > > -module(memoize). > -annotation('function'). %% scoped to functions > -export([init/1]). > -export([around_advice/4]). > > init(Module) -> > ets:new(Module, [ordered_set, public, named_table, > {write_concurrency,true}, > {read_concurrency,true}, compressed]), > ok. > > around_advice(_A, M, F, Inputs) -> > case ets:lookup(M, {F, Inputs}) of > [] -> > Result = annotation:call_advised(M, F, Inputs), > true = ets:insert_new(M, {{F, Inputs}, Result}), > Result; > [{_, Memoized}] -> > Memoized > end. > > And the usage of the annotation is very simple too: > > -module(fib_mem). > -export([start_memoize/0, fib/1]). > -include_lib("annotations/include/annotations.hrl"). > > start_memoize() -> > memoize:init(?MODULE). > > -memoize(ets). > fib(0) -> 0; > fib(1) -> 1; > fib(N) -> fib(N - 1) + fib(N - 2). > > -------------------- > > As I said, the implementation is very crude but I hope that the > concepts > will trigger some discussion about whether this is a useful > contribution > and in what directions it ought to go. > > Code is here: https://github.com/hyperthunk/annotations > Memoize is here: https://github.com/nebularis/memoize > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > From spawn.think@REDACTED Mon Dec 5 12:47:59 2011 From: spawn.think@REDACTED (Ahmed Omar) Date: Mon, 5 Dec 2011 12:47:59 +0100 Subject: [erlang-questions] [ANN] Join us for the 1st ErlanG+ Hangout With Joe Armstrong In-Reply-To: References: Message-ID: Sorry for the typo, Thursday 8th December 2011 On Mon, Dec 5, 2011 at 11:20 AM, Ahmed Omar wrote: > Date : Thursday, 7th December 2011 > Time : 7 PM (GMT) > It's FREE, Just +1 the post and we will be expecting yo > https://plus.google.com/108730584872406072872/posts/LcxLf5JeFxK > > Erlang on Google+ > http://gplus.to/Erlang > -- > Best Regards, > - Ahmed Omar > http://nl.linkedin.com/in/adiaa > Follow me on twitter > @spawn_think > > -- Best Regards, - Ahmed Omar http://nl.linkedin.com/in/adiaa Follow me on twitter @spawn_think -------------- next part -------------- An HTML attachment was scrubbed... URL: From watson.timothy@REDACTED Mon Dec 5 13:14:42 2011 From: watson.timothy@REDACTED (Tim Watson) Date: Mon, 5 Dec 2011 12:14:42 +0000 Subject: [erlang-questions] Instrumentation In-Reply-To: References: Message-ID: Hi Michal, I did look at ennotation, it was one of those places I found inspiration! :) One of the things I wanted to do was move away from macros towards module attributes instead. These are discoverable at runtime (using Mod:module_info/1) which makes them available for other tools to use as well. I also find reading a module annotation a bit easier on the eye than a macro, although obviously that's just a personal preference. I also preserve the original code (by renaming and re-exporting the function), which means that during tracing, debugging, logging, etc - the module in which the originating code lives (i.e., the annotation callback module vs the annotated production code) is preserved, which I find preferable. Another thing I wanted to do (which I mentioned in the previous post) is provide match specification based mappings between annotations and code, and to provide an API for runtime code instrumentation as well as the option of doing it at compile time with a parse transform. As you've built a conceptually very similar framework (which is much more mature than my effort) I would be very keen to hear your thoughts about whether declarative weaving/advising might be useful! Cheers, Tim On 5 December 2011 11:08, Micha? Ptaszek < michal.ptaszek@REDACTED> wrote: > Hi Tim, > > you might want to take a look at ennotation: it's > something I've derived from erlang-web, but which has > been reimplemented from scratch. > > https://github.com/paulgray/ennotation > > Best regards, > Michal Ptaszek > > > ----- Original Message ----- > > There have been a few conversations about instrumentation libraries > > on the > > list, and I've been experimenting with the features Ulf recently > > added to > > parse_trans. I've worked up a simple annotations library, that let's > > you > > put attributes/annotations on specific functions and attach behaviour > > to > > them in the form of an implementation module. The current framework > > is very > > crude and relies on a compile time parse transform, though obviously > > it'll > > be relatively trivial to implement runtime code changes as well. > > > > The purpose of this prototyping was to play around with some of the > > ideas > > in Aspect Oriented Programming, and the library allows you to write > > code > > that executes before, after or around an annotated function. This is > > done > > without macros, which feels a bit neater to me than the approach used > > in > > erlang-web. In addition to the library, I've made a small reference > > project > > which implements a simple function memoization annotation using ets > > as a > > cache. The implementation of the annotation itself is very simple: > > > > -module(memoize). > > -annotation('function'). %% scoped to functions > > -export([init/1]). > > -export([around_advice/4]). > > > > init(Module) -> > > ets:new(Module, [ordered_set, public, named_table, > > {write_concurrency,true}, > > {read_concurrency,true}, compressed]), > > ok. > > > > around_advice(_A, M, F, Inputs) -> > > case ets:lookup(M, {F, Inputs}) of > > [] -> > > Result = annotation:call_advised(M, F, Inputs), > > true = ets:insert_new(M, {{F, Inputs}, Result}), > > Result; > > [{_, Memoized}] -> > > Memoized > > end. > > > > And the usage of the annotation is very simple too: > > > > -module(fib_mem). > > -export([start_memoize/0, fib/1]). > > -include_lib("annotations/include/annotations.hrl"). > > > > start_memoize() -> > > memoize:init(?MODULE). > > > > -memoize(ets). > > fib(0) -> 0; > > fib(1) -> 1; > > fib(N) -> fib(N - 1) + fib(N - 2). > > > > -------------------- > > > > As I said, the implementation is very crude but I hope that the > > concepts > > will trigger some discussion about whether this is a useful > > contribution > > and in what directions it ought to go. > > > > Code is here: https://github.com/hyperthunk/annotations > > Memoize is here: https://github.com/nebularis/memoize > > > > _______________________________________________ > > 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 Mon Dec 5 13:28:40 2011 From: rtrlists@REDACTED (Robert Raschke) Date: Mon, 5 Dec 2011 12:28:40 +0000 Subject: [erlang-questions] Logger which truncates too big terms In-Reply-To: <20111202183005.GA4235@circlewave.net> References: <20111202142524.GA6172@jakstys.lt> <20111202153859.GA6582@circlewave.net> <20111202183005.GA4235@circlewave.net> Message-ID: Hi Jachym, On Fri, Dec 2, 2011 at 6:30 PM, Jachym Holecek wrote: > # Robert Raschke 2011-12-02: > > Weeell, I think there is good cause for splitting logging into two parts: > > 1. creating log entries and 2. presenting them for human consumption. > > Well, in principle that's a conceivable way to see things, however being > an old UN*X-head I'm of the firm religious belief that logs should be > ASCII text files, and I'm sure Operations would share that view. :-) > Yeah, I think if our dev had started in unix land, things would be similar. But stuff grew mostly ad-hoc in the Windows universe. And the operations people are pretty much all on the applications side of things, not sys admins. > > Doing this means that you can forget about any pretty-printing of log > > messages at the point of their creation. Such, rather heavy, processing > can > > be deferred to the point of actually reading the log. The latter usually > > being done off line anyway. > > But how heavy it is remains under your control. Pragmatic approach to > log layout (when you can afford it) and embracing iolists from the start > lower the price. You still need to be careful and sometimes move logging > out of busy path and such, but that's a hard fact of nature the way I see > it... > > Also, I prefer logs to be readily available right after the fact, already > in their final shape, and inspectable with standard tools (as imperfect as > they might be, I'd personally rather avoid reinventing them -- I miss grep > especially dearly every time I'm confronted with binary SASL logs). > Dumping logs to text is available at any point from the app itself (regardless of current state of the system, running or not). I have default batch scripts to do that. Interestingly, since the logging itself is always at debug level, the dumping to text is where you specify what level of detail you require. So, very often I'll look at info and error messages first, before deciding to drill down into the debug level. Since the logging uses the standard error_logger_mf functionality, I do sometimes run into the trouble of configuring the right size of the rotating log. I've had cases where the load was so high that a 200 MB total log would only hold an hours worth of logging. But then, that was sized before I knew what would be thrown at the application. > > I've started doing this by only ever logging lists of terms (using the > > error_logger), always providing the module that is logging as part of > this > > list. I also have a modified rb (report browser) that will call a > module's > > format_log/1 function (if it exists) to take the logged list of terms and > > return a pretty string. > > This introduces an opportunity for mismatch between actual log format > and what the format_log/1 callback thinks, one that will be undetected > until RB is started, no? Also, doesn't this dictate that logs only be > analysed wherever you have full code of faulty node available? Such as > *not* from your laptop in the middle of a business trip without access > to deployment/development machines? Also, how well does this work with > gigabytes of logged events when you need to analyze and fix the issue > ASAP because every minute of downtime/fault is valued at roughly your > annual salary? > > I have no trouble believing logs in some binary format could be a good > choice for some particular problem domain, but I've never come across > one of those in practice... > The fallback in the RB is to present the log just as it would without the format_log/1 callback. So, yes, sometimes a change in the logging code will result in un-pretty log reading output. But that usually only happens during development, not in production. For offline viewing, all I need is the ZIPed up log folder (error_logger_mf logs ZIP up rather dramatically) and a local copy of the app. I am currently experimenting with further event handlers registered beside the standard error_logger_mf_dir I am currently using. This allows me to provide further logs to go elsewhere. Doing this requires a bit of care though, as I don't want to accidentally introduce a lot of overhead in the logging phase. I've got a webmachine resource that simply scrolls the log messages as they come. And I'm pretty sure I'll be looking at the syslog logger soon, as well as a Windows Event logger (which we already use from Lua, but not yet from Erlang directly). Further bits of work are on the RB side, where I am probably looking at providing some kind of web based viewer. I especially want to expose the RB grep functionality more. All this talk about logging, makes me think I should start a blog article. /Robby -------------- next part -------------- An HTML attachment was scrubbed... URL: From kruber@REDACTED Mon Dec 5 15:14:42 2011 From: kruber@REDACTED (Nico Kruber) Date: Mon, 05 Dec 2011 15:14:42 +0100 Subject: [erlang-questions] performance drop in R15A? In-Reply-To: <4458388.uS11NqXNlV@csr-pc40.zib.de> References: <1359554.YeRYZETzs8@csr-pc40.zib.de> <2086353.lGPuiOpM5q@csr-pc40.zib.de> <4458388.uS11NqXNlV@csr-pc40.zib.de> Message-ID: <1789335.0VPehH53Ub@csr-pc40.zib.de> Is there any news on this? The performance drop of the recent R15 checkout compared to R14B04 in our application is now at _30%_ compared to a drop of "only" 15% in R15A! Nico On Friday 02 December 2011 11:26:56 Nico Kruber wrote: > Tonight, I ran the tests with an erlang checkout from around 16:00 yesterday > (erlang-otp-OTP_R15A-126-g0290bed.tar.gz). > This includes the fix Bj?rn-Egil was referring to, > i.e. 'rickard/pix-mutex/OTP-9723'. > > > Following are the results or our "make bench" of Scalaris: > > ** transactions/s , i.e. "wall clock throughput : xxx" ** > R14B04: ~950, R15A (ge21ff9b): ~800, R15A (g0290bed): ~635 > > ** latency, i.e. "wall clock avg. latency: xxx ms" **: > R14B04: ~42ms, R15A (ge21ff9b): ~50ms, R15A (g0290bed): ~60ms > > > Note: This "make bench" command sets up a Scalaris ring consisting of 4 > nodes, each in a single VM. They all communicate through tcp. > > > Additionally, we also measure our performance through our Java-API which > accesses Erlang via JInterface using > "SCALARIS_BENCHMARKS="100 6 9 15 18" make java-bench" > > ** number of transactions per second for "Benchmark incrementing an > integer key (read+write):" > R14B04: ~310, R15A (ge21ff9b): ~200, R15A (g0290bed): ~140 > > > I saw some new bug fixes for the scheduler in the recent commits, but with > the checkout from 6971b96 (just now), the results are still the same as > with g0290bed :( > > > > Regards, > Nico > > On Wednesday 30 November 2011 17:05:29 Nico Kruber wrote: > > thank you > > We'll try again tomorrow > > > > Nico > > > > On Wednesday 30 November 2011 16:30:05 Lukas Larsson wrote: > > > Hello! > > > > > > I was able to verify you findings on my machine for R14B04 and R15A. > > > The problem is however fixed (I even get a 15% throughput > > > improvement on your > > > bench) in our latest internal master which will be pushed to github > > > later > > > this evening. So if you could pull the latest from github tomorrow > > > and > > > verify my findings that would be great! > > > > > > Lukas > > > > > > On Wed, Nov 30, 2011 at 11:36 AM, Nico Kruber wrote: > > > > Is it possible, that some debug option is on by default in the > > > > R15A > > > > tagged git > > > > checkout? > > > > We build the source using the following commands (on a x86_64 > > > > system > > > > with 8 cores): > > > > > > > > ./otp_build autoconf > > > > ./configure --prefix=/home/buildbot/apps/erlang-R15A > > > > make > > > > make install > > > > > > > > and then compiled our application > > > > (http://code.google.com/p/scalaris/) > > > > using > > > > R15A. > > > > > > > > With our internal benchmarks ("make bench") showed a drop of > > > > around > > > > 15% > > > > in performance compared to R14B04. We were actually hoping for > > > > an > > > > increased performance reading about the memory allocation > > > > improvements... > > > > > > > > Is there some switch (during configuration or build) influencing > > > > the > > > > performance? > > > > > > > > output of R14B04 erl: > > > > ------------------------------------------------------------ > > > > Erlang R14B04 (erts-5.8.5) [source] [64-bit] [smp:8:8] [rq:8] > > > > [async- > > > > threads:0] [hipe] [kernel-poll:false] > > > > > > > > Eshell V5.8.5 (abort with ^G) > > > > 1> > > > > ------------------------------------------------------------ > > > > > > > > output of R15A erl: > > > > ------------------------------------------------------------ > > > > Erlang R15A (erts-5.9.pre) [source] [64-bit] [smp:8:8] [rq:8] > > > > [async- > > > > threads:0] [hipe] [kernel-poll:false] > > > > > > > > Eshell V5.9.pre (abort with ^G) > > > > 1> > > > > ------------------------------------------------------------ > > > > > > > > > > > > Regards > > > > Nico Kruber -------------- 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 zabrane3@REDACTED Mon Dec 5 15:22:02 2011 From: zabrane3@REDACTED (Zabrane Mickael) Date: Mon, 5 Dec 2011 15:22:02 +0100 Subject: [erlang-questions] Dialyzer error when generating PLT on OSX 10.6.8 - R14B04 Message-ID: Hi guys, I got the following error message when generating PLT using R14B04: dialyzer: Could not get abstract code for file: /usr/lib/erlang/lib/erts-5.8.5/ebin/prim_file.beam (please recompile it with +debug_info) I've installed R14B04 from source with debug information turned on using: ERLCFLAGS="+debug_info" CFLAGS="-g". Help please !!! Kostis? Regards, Zabrane From kostis@REDACTED Mon Dec 5 15:38:37 2011 From: kostis@REDACTED (Kostis Sagonas) Date: Mon, 05 Dec 2011 15:38:37 +0100 Subject: [erlang-questions] Dialyzer error when generating PLT on OSX 10.6.8 - R14B04 In-Reply-To: References: Message-ID: <4EDCD76D.4070308@cs.ntua.gr> On 12/05/2011 03:22 PM, Zabrane Mickael wrote: > Hi guys, > > I got the following error message when generating PLT using R14B04: > > dialyzer: Could not get abstract code for file: /usr/lib/erlang/lib/erts-5.8.5/ebin/prim_file.beam (please recompile it with +debug_info) > > I've installed R14B04 from source with debug information turned on using: > ERLCFLAGS="+debug_info" CFLAGS="-g". > > Help please !!! Kostis? I am not sure what's happening... Under normal circumstances, the +debug_info flag is added by default for all OTP files and everything works OK even for the erts modules which are preloaded. Perhaps try again without setting ERLCFLAGS ?? Kostis From hm@REDACTED Mon Dec 5 15:41:02 2011 From: hm@REDACTED (=?ISO-8859-1?Q?H=E5kan_Mattsson?=) Date: Mon, 5 Dec 2011 15:41:02 +0100 Subject: [erlang-questions] reltool not copying erl_interface In-Reply-To: References: Message-ID: There are several possible solutions to this: - Add ebin-directories to erl_interface and jinterface in order to make reltool think that these "non-Erlang" applications also are Erlang applications. Do also add an .app file in order to avoid reltool warnings. - Change reltool_server:app_dirs2/3 so directories that are lacking the ebin sub directory also will be regarded as applications. The reltool warning for missing .app-files should be suppressed if the ebin-directory is missing. - Add an extra OverrideSpec argument to reltool:eval_target_spec/3 and reltool:create_target/2. The new argument should be a target_spec() that overrides parts of the ordinary TargetSpec. Such an OverrideSpec argument could then be used to copy extra files that reltool normally would not include in the generated target. Any takers for a contribution? /H?kan On Sat, Dec 3, 2011 at 10:05 PM, Jesse Gumm wrote: > Hello everyone, > > This is a followup to a post I made a few months ago[1], which was > probably too and meandering for anyone to read (I struggle with > brevity). > > The short version is that for the life of me, I cannot find a way to > force the erl_interface dir to get copied with reltool. > > There are reltool options for forcing an app to get copied, but > erl_interface isn't an app (ie, doesn't have a .app file). > > Anyone have any thoughts on this? > > Thanks in advance, > > -Jesse > > [1] http://erlang.org/pipermail/erlang-questions/2011-October/061923.html > > -- > Jesse Gumm > Sigma Star Systems > 414.940.4866 > gumm@REDACTED > http://www.sigma-star.com > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions From zabrane3@REDACTED Mon Dec 5 15:55:31 2011 From: zabrane3@REDACTED (Zabrane Mickael) Date: Mon, 5 Dec 2011 15:55:31 +0100 Subject: [erlang-questions] Dialyzer error when generating PLT on OSX 10.6.8 - R14B04 In-Reply-To: <4EDCD76D.4070308@cs.ntua.gr> References: <4EDCD76D.4070308@cs.ntua.gr> Message-ID: <98EB2905-0D90-4A05-8B3C-9ECC34F5D460@gmail.com> > I am not sure what's happening... Under normal circumstances, the +debug_info flag is added by default for all OTP files and everything works OK even for the erts modules which are preloaded. > > Perhaps try again without setting ERLCFLAGS ?? Thanks Kostis. Worked now ! Regards, Zabrane From jwatte@REDACTED Mon Dec 5 19:56:54 2011 From: jwatte@REDACTED (Jon Watte) Date: Mon, 5 Dec 2011 10:56:54 -0800 Subject: [erlang-questions] rebar -- how do I get useful error messages In-Reply-To: References: Message-ID: > > The reason that the error message only contains the 'src' directory is > that rebar changes into subdirectories That's why I think rebar *is* the source of the messages being not-useful :-) For now, I'm using a simple Make rule that expresses dependencies between apps/*/ebin/*.beam and apps/*/src/*.erl, and *.hrl files, using (make) pattern matching, and calling erlc directly. This gives me usable error messages. But I can't believe nobody else already got bitten by this! I'll go check the rebar community. But having to join and unjoin lists just for particular errors gets old after a while :-/ Sincerely, jw -- Americans might object: there is no way we would sacrifice our living standards for the benefit of people in the rest of the world. Nevertheless, whether we get there willingly or not, we shall soon have lower consumption rates, because our present rates are unsustainable. On Sat, Dec 3, 2011 at 7:31 AM, Tim Watson wrote: > On 2 December 2011 22:36, Jon Watte wrote: > >> unfortunately, when I do this, the paths that come out of the compiler >> error messages does not contain the "apps" directory or the name of the >> actual app. For example, if I have an error in the file >> "apps/myapp/src/somefile.erl" then the error message will say >> "src/somefile.erl:44: some error here." >> THIS, in turn, breaks the go-to-compile-error logic for the editor -- it >> cannot find the file in question. I can string-substitute the output of >> rebar to tack on "apps/" in front, but without the actual application, >> that's not good enough, and I don't easily know which app name to also tack >> on. >> >> So -- how do you guys solve this? Jumping to compile errors in the editor >> is one of those basics that nobody really wants to live without, so I can't >> imagine that an entire community is living without... >> >> > I think rebar is not the source of the shortened error message here, > but rather the error message is being generated by the `compile' module > itself. The rebar_erlc_compiler does pass on the 'report' option to > compile:file/2, but this just prints out warnings and errors. The reason > that the error message only contains the 'src' directory is that rebar > changes into subdirectories (using file:set_cwd/1) before processing them. > If you wanted to annotate the errors, you'd need to patch > rebar_erlc_compiler and do something like: > > case compile:file(Source, [return_errors|Opts]) of > {ok, _} -> ok; > {error, Errors, _} -> > [ ?ERROR("~s: ~s", [filename:absname(File), > compile:format_error(Err)]) || {F, Err} <- Errors ], > ?ABORT("Compilation failed!~n", []) > end; > > The place you'd need to make that change is here: > https://github.com/basho/rebar/blob/master/src/rebar_erlc_compiler.erl#L258 > > HTH. BTW I have no idea whether or not this would make it into rebar, nor > if it's even the best approach. There may be far better ways of doing this, > so I'd suggest discussion on the rebar mailing list as a next step, unless > you're happy maintaining your own fork. > > Cheers, > > Tim > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jwatte@REDACTED Mon Dec 5 20:00:15 2011 From: jwatte@REDACTED (Jon Watte) Date: Mon, 5 Dec 2011 11:00:15 -0800 Subject: [erlang-questions] illegal guard expression for IF illegal guard expression for "if" In-Reply-To: <5B4A13ED-8CA4-40A8-9501-04A785A6C7DF@feuerlabs.com> References: <4ED89F79.6090607@gmail.com> <4ED8A31A.2020700@gmail.com> <4ED8A5DF.70301@gmail.com> <5B4A13ED-8CA4-40A8-9501-04A785A6C7DF@feuerlabs.com> Message-ID: Note that, even if a function is NOW side effect free, if it's referenced using module:function syntax, it may later acquire side effects. Sincerely, jw -- Americans might object: there is no way we would sacrifice our living standards for the benefit of people in the rest of the world. Nevertheless, whether we get there willingly or not, we shall soon have lower consumption rates, because our present rates are unsustainable. On Sun, Dec 4, 2011 at 1:17 AM, Ulf Wiger wrote: > You should see guards as an extension of pattern matching. > > If a guard function would have side-effects, the overall evaluation would > most likely not be deterministic, and - most importantly perhaps - would be > extremely difficult to understand and reason about. Ideally, the function > should also be O(1), although a few O(N) guards, like length/1, are also > allowed. For this reason, programmers can normally regard pattern-matching > as extremely efficient, and use it extensively, trusting that the compiler > will do a good job optimizing it. > > It is correct that the compiler is not able to determine, at present, > whether a function is referentially transparent. It also cannot determine > the complexity of a function. > > BR, > Ulf W > > On 4 Dec 2011, at 09:51, Barco You wrote: > > But, if explaining in this way it has nothing to do with side-effect. It's > just because the guard expression is stochastic rather than deterministic. > > If having a deterministic function in the 'if' guard expression, we still > get 'illegal guard expression'. According to the document provided by some > guys in previous mails, the foundamental reason is that the erlang VM does > not make sure whether a function in the guard expression has side-effect. > > So, I hope to know why functions with side-effect can not be the guard > expression. > > Thank you all! > Barco > On Dec 2, 2011 10:42 PM, "Barco You" wrote: > >> Ooooh! Maybe I understand now! >> >> It means that if the first branch is not satisfied, saying get 0.7, then >> random:uniform() would be evaluated again in the second branch and it >> possible to get a value less than 0.5, which then makes a paradox. Right? >> >> In the contrast, with case statement, the condition is only evaluated >> once no matter whichever branch would be satisfied. >> >> How smart erlang is, and how amazing you erlangers are! >> >> Barco >> On Dec 2, 2011 6:18 PM, "CGS" wrote: >> >>> ** >>> Just to make it clearer: >>> >>> The second condition is equivalent with the expression: "if the value of >>> random:uniform() is greater or equal to 0.5 then report 'bad'". In this >>> case, if you entered with value 0.4 in the first branch and modified it to >>> 0.7 in the first branch, the second branch should be executed as well. That >>> is against the if statement purpose which should report only one branch at >>> the time as valid. Therefore, Erlang requires for the compared values to be >>> constant during the if statement processing. >>> >>> CGS >>> >>> >>> >>> On 12/02/2011 11:06 AM, CGS wrote: >>> >>> If statement is not a block statement (to fix the variables values at >>> the entrance of the statement) in Erlang. That means, if an >>> uniform:random() value (say, 0.4) is used for checking the first branch >>> condition and the value is changed within the branch (say, 0.7), then you >>> enter a paradox related to if the function should be considered for the >>> first or the second branch. To avoid this, Erlang requires an assurance >>> that the compared values do not change while processing the if statement. >>> >>> CGS >>> >>> >>> >>> On 12/02/2011 10:56 AM, Barco You wrote: >>> >>> Hi CGS, >>> >>> I can't understand your statement --- " if in the first branch you use >>> again random:uniform(), the second branch condition can report an >>> inaccurate result." Could you please make it clearer? Thanks! >>> >>> Hi Others, >>> >>> Why functions with side effect can not be in the guard expressions? >>> >>> >>> Thank you! >>> Barco >>> >>> On Fri, Dec 2, 2011 at 5:50 PM, CGS wrote: >>> >>>> Hi, >>>> >>>> To put in simple words for better understanding, you can have only >>>> constant variables withing the guard expression. That means, in your case, >>>> if in the first branch you use again random:uniform(), the second branch >>>> condition can report an inaccurate result. >>>> >>>> Alternatively, you can use case statement: >>>> >>>> case (random:uniform()<0.5) of >>>> true -> good; >>>> false -> bad >>>> end >>>> >>>> I hope this answer will help you. >>>> >>>> CGS >>>> >>>> >>>> >>>> >>>> On 12/02/2011 10:30 AM, Barco You wrote: >>>> >>>> Why does the following expression got "illegal guard expression" when >>>> compiling: >>>> X = 0.5, >>>> if >>>> random:uniform() < X -> %error reported for this line >>>> good; >>>> true -> >>>> bad >>>> end. >>>> >>>> But if I change it to following expression, it's ok: >>>> X = 0.5, >>>> Ran = random:uniform(), >>>> if >>>> Ran < X -> >>>> good; >>>> true -> >>>> bad >>>> end. >>>> >>>> BRs, >>>> Barco >>>> >>>> >>>> _______________________________________________ >>>> erlang-questions mailing listerlang-questions@REDACTED://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 > > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From daniel@REDACTED Mon Dec 5 20:21:08 2011 From: daniel@REDACTED (Daniel Luna) Date: Mon, 5 Dec 2011 14:21:08 -0500 Subject: [erlang-questions] illegal guard expression for IF illegal guard expression for "if" In-Reply-To: References: <4ED89F79.6090607@gmail.com> <4ED8A31A.2020700@gmail.com> <4ED8A5DF.70301@gmail.com> <5B4A13ED-8CA4-40A8-9501-04A785A6C7DF@feuerlabs.com> Message-ID: On top of that, note that calling a function with M:F syntax is not side effect free in itself. It might or might not call the code loader (or rather the undefined function handler, which in turn calls the code loader). So even if allowing for user defined functions they would have to be defined locally to be side effect free. /Daniel On 5 December 2011 14:00, Jon Watte wrote: > Note that, even if a function is NOW side effect free, if it's referenced > using module:function syntax, it may later acquire side effects. > Sincerely, > jw > > -- > Americans might object: there is no way we would sacrifice our living > standards for the benefit of people in the rest of the world. Nevertheless, > whether we get there willingly or not, we shall soon have lower consumption > rates, because our present rates are unsustainable. > > > > On Sun, Dec 4, 2011 at 1:17 AM, Ulf Wiger wrote: >> >> You should see guards as an extension of pattern matching. >> If a guard function would have side-effects, the overall evaluation would >> most likely not be deterministic, and - most importantly perhaps - would be >> extremely difficult to understand and reason about. Ideally, the function >> should also be O(1), although a few O(N) guards, like length/1, are also >> allowed. For this reason, programmers can normally regard pattern-matching >> as extremely efficient, and use it extensively, trusting that the compiler >> will do a good job optimizing it. >> It is correct that the compiler is not able to determine, at present, >> whether a function is referentially transparent. It also cannot determine >> the complexity of a function. >> BR, >> Ulf W >> On 4 Dec 2011, at 09:51, Barco You wrote: >> >> But, if explaining in this way it has nothing to do with side-effect. It's >> just because the guard expression is stochastic rather than deterministic. >> >> If having a deterministic function in the 'if' guard expression, we still >> get 'illegal guard expression'. According to the document provided by some >> guys in previous mails, the foundamental reason is that the erlang VM does >> not make sure whether a function in the guard expression has side-effect. >> >> So, I hope to know why functions with side-effect can not be the guard >> expression. >> >> Thank you all! >> Barco >> >> On Dec 2, 2011 10:42 PM, "Barco You" wrote: >>> >>> Ooooh! Maybe I understand now! >>> >>> It means that if the first branch is not satisfied, saying get 0.7, then >>> random:uniform() would be evaluated again in the second branch and it >>> possible to get a value less than 0.5, which then makes a paradox. Right? >>> >>> In the contrast, with case statement, the condition is only evaluated >>> once no matter whichever branch would be satisfied. >>> >>> How smart erlang is, and how amazing you erlangers are! >>> >>> Barco >>> >>> On Dec 2, 2011 6:18 PM, "CGS" wrote: >>>> >>>> Just to make it clearer: >>>> >>>> The second condition is equivalent with the expression: "if the value of >>>> random:uniform() is greater or equal to 0.5 then report 'bad'". In this >>>> case, if you entered with value 0.4 in the first branch and modified it to >>>> 0.7 in the first branch, the second branch should be executed as well. That >>>> is against the if statement purpose which should report only one branch at >>>> the time as valid. Therefore, Erlang requires for the compared values to be >>>> constant during the if statement processing. >>>> >>>> CGS >>>> >>>> >>>> >>>> On 12/02/2011 11:06 AM, CGS wrote: >>>> >>>> If statement is not a block statement (to fix the variables values at >>>> the entrance of the statement) in Erlang. That means, if an uniform:random() >>>> value (say, 0.4) is used for checking the first branch condition and the >>>> value is changed within the branch (say, 0.7), then you enter a paradox >>>> related to if the function should be considered for the first or the second >>>> branch. To avoid this, Erlang requires an assurance that the compared values >>>> do not change while processing the if statement. >>>> >>>> CGS >>>> >>>> >>>> >>>> On 12/02/2011 10:56 AM, Barco You wrote: >>>> >>>> Hi CGS, >>>> I can't understand your statement --- "?if in the first branch you use >>>> again random:uniform(), the second branch condition can report an inaccurate >>>> result." ?Could you please make it clearer? Thanks! >>>> Hi Others, >>>> Why functions with side effect can not be in the guard expressions? >>>> >>>> Thank you! >>>> Barco >>>> >>>> On Fri, Dec 2, 2011 at 5:50 PM, CGS wrote: >>>>> >>>>> Hi, >>>>> >>>>> To put in simple words for better understanding, you can have only >>>>> constant variables withing the guard expression. That means, in your case, >>>>> if in the first branch you use again random:uniform(), the second branch >>>>> condition can report an inaccurate result. >>>>> >>>>> Alternatively, you can use case statement: >>>>> >>>>> case (random:uniform()<0.5) of >>>>> ???? true -> good; >>>>> ???? false -> bad >>>>> end >>>>> >>>>> I hope this answer will help you. >>>>> >>>>> CGS >>>>> >>>>> >>>>> >>>>> On 12/02/2011 10:30 AM, Barco You wrote: >>>>> >>>>> Why does the following expression got "illegal guard expression" when >>>>> compiling: >>>>> X = 0.5, >>>>> if >>>>> ? ? random:uniform() < X -> ? ? ?%error reported for this line >>>>> ? ? ? ? ? ?good; >>>>> ? ? true -> >>>>> ? ? ? ? ? ?bad >>>>> end. >>>>> But if I change it to following expression, it's ok: >>>>> X = 0.5, >>>>> Ran =?random:uniform(), >>>>> if >>>>> ? ? Ran < X -> >>>>> ? ? ? ? ? ?good; >>>>> ? ? true -> >>>>> ? ? ? ? ? ?bad >>>>> end. >>>>> BRs, >>>>> Barco >>>>> >>>>> _______________________________________________ >>>>> 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 >> >> >> _______________________________________________ >> 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 ok@REDACTED Tue Dec 6 00:08:24 2011 From: ok@REDACTED (Richard O'Keefe) Date: Tue, 6 Dec 2011 12:08:24 +1300 Subject: [erlang-questions] illegal guard expression for IF illegal guard expression for "if" In-Reply-To: References: <4ED89F79.6090607@gmail.com> <4ED8A31A.2020700@gmail.com> <4ED8A5DF.70301@gmail.com> Message-ID: <518129F9-E516-4995-9C64-AA788BFB68E1@cs.otago.ac.nz> On 5/12/2011, at 3:57 PM, Daniel Dormont wrote: > In my experience with Erlang so far, this is perhaps the weirdest > feature for me from a language standpoint. I understand the > motivations, but at least from where I sit, it's a weird mental leap > from there to "we allow these few functions, but not others." In old Erlang, it was a lot clearer: the things that were allowed in guards were almost all things that were not allowed anywhere else. For example X < Y was allowed as a guard but not as an expression. To this day, I stick with "," and ";" in guards, reserving "andalso" and "orelse" for expressions (and trying to avoid those). > In fact, > not even all of the allowed functions are "pure" in the sense that, > say, a Haskell programmer would recognize. I'm specifically thinking > of node/0 and self/0. self() cannot change in a process. I don't believe node() can change either, but I could be wrong. > What are abstract patterns? Functions are abstractions of expressions. Abstract patterns are abstractions of patterns. For example, suppose you often want to match [{opt,X}]. Then you will one day be able to write #one_opt(X) -> [{opt,X}]. and then use #one_opt(X) wherever you would have written the pattern. The proposal has been around for years, but the OTP team have always had more urgent maddened grizzly bears to stun. From barcojie@REDACTED Tue Dec 6 03:24:00 2011 From: barcojie@REDACTED (Barco You) Date: Tue, 6 Dec 2011 10:24:00 +0800 Subject: [erlang-questions] illegal guard expression for IF illegal guard expression for "if" In-Reply-To: <518129F9-E516-4995-9C64-AA788BFB68E1@cs.otago.ac.nz> References: <4ED89F79.6090607@gmail.com> <4ED8A31A.2020700@gmail.com> <4ED8A5DF.70301@gmail.com> <518129F9-E516-4995-9C64-AA788BFB68E1@cs.otago.ac.nz> Message-ID: >For example, suppose you often want to match [{opt,X}]. >Then you will one day be able to write > > #one_opt(X) -> [{opt,X}]. Your 'abstract pattern' looks like macro! On Tue, Dec 6, 2011 at 7:08 AM, Richard O'Keefe wrote: > > On 5/12/2011, at 3:57 PM, Daniel Dormont wrote: > > > In my experience with Erlang so far, this is perhaps the weirdest > > feature for me from a language standpoint. I understand the > > motivations, but at least from where I sit, it's a weird mental leap > > from there to "we allow these few functions, but not others." > > In old Erlang, it was a lot clearer: the things that were allowed in > guards were almost all things that were not allowed anywhere else. > For example X < Y was allowed as a guard but not as an expression. > > To this day, I stick with "," and ";" in guards, reserving > "andalso" and "orelse" for expressions (and trying to avoid those). > > > In fact, > > not even all of the allowed functions are "pure" in the sense that, > > say, a Haskell programmer would recognize. I'm specifically thinking > > of node/0 and self/0. > > self() cannot change in a process. > I don't believe node() can change either, but I could be wrong. > > > What are abstract patterns? > > Functions are abstractions of expressions. > Abstract patterns are abstractions of patterns. > > For example, suppose you often want to match [{opt,X}]. > Then you will one day be able to write > > #one_opt(X) -> [{opt,X}]. > > and then use #one_opt(X) wherever you would have written the pattern. > The proposal has been around for years, but the OTP team have always > had more urgent maddened grizzly bears to stun. > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From andrzej.sliwa@REDACTED Tue Dec 6 12:04:34 2011 From: andrzej.sliwa@REDACTED (Andrzej Sliwa) Date: Tue, 6 Dec 2011 12:04:34 +0100 Subject: [erlang-questions] -spec for OTP Message-ID: <9F5AAD31-260C-4369-82FF-E4C5E0996296@i-tool.eu> Hi, do you know guys where I can find -specs for application and other OTP behaviors (I mean callbacks & api specifications)? this is weird that we see on many presentations about start using specs in modern erlang code, but there is no specs in OTP behaviors :D Z pozdrowieniami / Mit freundlichen Gr??en / Best Regards Andrzej ?liwa -------------- next part -------------- An HTML attachment was scrubbed... URL: From kostis@REDACTED Tue Dec 6 12:28:38 2011 From: kostis@REDACTED (Kostis Sagonas) Date: Tue, 06 Dec 2011 12:28:38 +0100 Subject: [erlang-questions] -spec for OTP In-Reply-To: <9F5AAD31-260C-4369-82FF-E4C5E0996296@i-tool.eu> References: <9F5AAD31-260C-4369-82FF-E4C5E0996296@i-tool.eu> Message-ID: <4EDDFC66.1020400@cs.ntua.gr> On 12/06/2011 12:04 PM, Andrzej Sliwa wrote: > Hi, > > do you know guys where I can find -specs for application and other OTP > behaviors (I mean callbacks & api specifications)? > this is weird that we see on many presentations about start using specs > in modern erlang code, but there is no specs in OTP behaviors :D Callback specs for OTP behaviours is a language addition that will appear in the upcoming R15 release (scheduled for mid December). There is a new attribute called -callback that specifies types that behaviour callbacks are supposed to have. Given such information, one does not need to specify a behaviour_info/1 function anymore (at least as far as callbacks are concerned) since the compiler has been adapted to automatically generate this function. In addition, the dialyzer tool has been adapted to check behaviours. As I wrote, this is coming in an OTP near you really soon now. In the meantime, if you are interested in this you can get a copy of the pre-release of R15 (from github) and see all behaviour modules containing such callback attributes and/or read the following paper: Typed callbacks for more robust behaviours http://dl.acm.org/citation.cfm?id=2034660 Kostis From ulf@REDACTED Tue Dec 6 12:59:17 2011 From: ulf@REDACTED (Ulf Wiger) Date: Tue, 6 Dec 2011 12:59:17 +0100 Subject: [erlang-questions] -spec for OTP In-Reply-To: <4EDDFC66.1020400@cs.ntua.gr> References: <9F5AAD31-260C-4369-82FF-E4C5E0996296@i-tool.eu> <4EDDFC66.1020400@cs.ntua.gr> Message-ID: Kostis, Perhaps you could ponder how e.g. the function gen_server:enter_loop/[3,4,5] works in the context of callback specs. One of the reasons for having this function is to be able to send an explicit ack from the init callback, and then continue with a blocking operation [1]. One can then call gen_server:enter_loop() to give control to the main loop. However, this function doesn't return, so it seems to violate the behavior specs. I would like to see an extended return value from init, e.g. {cont, Cont, State}, along the lines of case catch Mod:init(Args) of {cont, Cont, State} -> proc_lib:init_ack(Starter, {ok, self()}), NewState = Cont(State), loop(Parent, Name, NewState, Mod, infinity, Debug); ? end This seems more regular from a typing point of view. BR, Ulf W [1] See e.g. http://groups.google.com/group/erlang-programming/browse_thread/thread/70209d4c2bf2dac3/8c85937c309ab81b?lnk=gst&q=enter_loop+ulf#8c85937c309ab81b On 6 Dec 2011, at 12:28, Kostis Sagonas wrote: > On 12/06/2011 12:04 PM, Andrzej Sliwa wrote: >> Hi, >> >> do you know guys where I can find -specs for application and other OTP >> behaviors (I mean callbacks & api specifications)? >> this is weird that we see on many presentations about start using specs >> in modern erlang code, but there is no specs in OTP behaviors :D > > Callback specs for OTP behaviours is a language addition that will appear in the upcoming R15 release (scheduled for mid December). > > There is a new attribute called -callback that specifies types that behaviour callbacks are supposed to have. Given such information, one does not need to specify a behaviour_info/1 function anymore (at least as far as callbacks are concerned) since the compiler has been adapted to automatically generate this function. In addition, the dialyzer tool has been adapted to check behaviours. > > As I wrote, this is coming in an OTP near you really soon now. In the meantime, if you are interested in this you can get a copy of the pre-release of R15 (from github) and see all behaviour modules containing such callback attributes and/or read the following paper: > > Typed callbacks for more robust behaviours > http://dl.acm.org/citation.cfm?id=2034660 > > Kostis > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions -------------- next part -------------- An HTML attachment was scrubbed... URL: From daniel.widgren@REDACTED Tue Dec 6 13:12:42 2011 From: daniel.widgren@REDACTED (Daniel Widgren) Date: Tue, 6 Dec 2011 13:12:42 +0100 Subject: [erlang-questions] ct_ssh Message-ID: Hi! I'm trying to use ct_ssh to test different machines to send commands to them. My module looks like this. -module(ssht). -export([connect/1, session_open/2, send_cmd/1, session_close/2, disconnect/1]). connect(Site) -> timer:sleep(1000), ct:get_config(Site), case ct_ssh:connect(Site, ssh) of {ok, A} -> A; {error, _} -> timer:sleep(50000), connect(Site) end. session_open(A, Timeout) -> {ok, B} = ct_ssh:session_open(A, Timeout), B. send_cmd(Command) -> ct:log(log, "COMMAND: ~p", [Command]), A = connect(ts), B = session_open(A, infinity), {_,Data} = ct_ssh:send_and_receive(A,B, Command), session_close(A,B), disconnect(A), ct:log(log, "~s",[Data]), case Data of "cli: /tmp/cli: No such file or directory\n" -> send_cmd(Command); _ -> Data end. session_close(A, B) -> ct_ssh:session_close(A, B). disconnect(A) -> ct_ssh:disconnect(A). Right now send_cmd does more then it should do. But the idea is that I want it to connect to a device, send a command using stream/tunnel. I can't use exec function for the environment that I'm using. So my idea was to create a connection and stream the commando in some way to the device. But now I get a timeout from ct_ssh:send_and_receive. I'm using R14B04. regards, Daniel From zabrane3@REDACTED Tue Dec 6 14:28:13 2011 From: zabrane3@REDACTED (Zabrane Mickael) Date: Tue, 6 Dec 2011 14:28:13 +0100 Subject: [erlang-questions] Facebook API for Erlang Message-ID: <14C09090-B9A5-4DD1-82B0-9F37C2609898@gmail.com> Hi guys, Is there an "open source" Facebook API for Erlang somewhere (github or ...)? Regards, Zabrane From spawn.think@REDACTED Tue Dec 6 15:50:24 2011 From: spawn.think@REDACTED (Ahmed Omar) Date: Tue, 6 Dec 2011 15:50:24 +0100 Subject: [erlang-questions] Facebook API for Erlang In-Reply-To: <14C09090-B9A5-4DD1-82B0-9F37C2609898@gmail.com> References: <14C09090-B9A5-4DD1-82B0-9F37C2609898@gmail.com> Message-ID: https://github.com/ngerakines/erlang_facebook On Tue, Dec 6, 2011 at 2:28 PM, Zabrane Mickael wrote: > Hi guys, > > Is there an "open source" Facebook API for Erlang somewhere (github or > ...)? > > Regards, > Zabrane > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > -- Best Regards, - Ahmed Omar http://nl.linkedin.com/in/adiaa Follow me on twitter @spawn_think -------------- next part -------------- An HTML attachment was scrubbed... URL: From erlangsiri@REDACTED Tue Dec 6 16:30:32 2011 From: erlangsiri@REDACTED (Siri Hansen) Date: Tue, 6 Dec 2011 16:30:32 +0100 Subject: [erlang-questions] acceptor loops and hot code swapping In-Reply-To: References: Message-ID: Hi Roberto! Sorry for the very late answer - maybe you have already solved this and moved on... Anyway - for the code swap to actually take effect, you must, as you suggest, do a fully qualified call to your loop - i.e. put ?MODULE in front of the call. This will make sure that after a new version of your module has been loaded, the next call to the loop function will execute the new code. If you should use a timeout in your loop or not depends, I guess, on how often you get incoming TCP connections. You will experience problems if you happen to purge and load your module twice without the fully qualified call to the loop function being executed in between. The reason for this is that your process will be killed by the code server if it is still running old code at the time of your purge. Example A - expected flow: 1) start your process with mod vsn 1 => vsn 1 is now 'current'. There is no 'old' code. 2) compile and load mod vsn 2 => vsn 2 is now 'current' and vsn 1 is 'old', but your process is still running vsn 1 3) force ?MODULE:loop in your process => your process now runs vsn 2, and vsn 1 is still 'old' 4) purge mod => vsn 1 is removed, your process still running vsn 2. 5) load mod vsn 3 => vsn 3 is now 'current' and vsn 2 is 'old'. process runs vsn 2. etc... Example B - forced purge which kills your process: 1) start your process with mod vsn 1 => vsn 1 is now 'current'. There is no 'old' code. 2) compile and load mod vsn 2 => vsn 2 is now 'current' and vsn 1 is 'old', but your process is still running vsn 1 3) purge mod (without doing a fully qualified function call first) => code_server tries to remove vsn 1, but since it is still running in your process, your process will be killed!!! ... So - timing out the acceptor should be to prevent this type of problem... Regarding system events: If you have your process hanging in a supervisor tree, you want to use the release_handler (or similar) for upgrading, and you might want to change the process state in any way during upgrade - then you should handle the change_code system event, i.e. implement the system_code_change callback. I hope this was of some use... Regards /siri 2011/11/30 Roberto Ostinelli > dear list, > > i've got a process that has been started by a supervisor with > proc_lib:spawn_link/3. > > this process is mainly listening on new incoming TCP connections using > gen_tcp:accept (or the SSL equivalent), with a timeout set to infinity. > when a new connection gets requested, the acceptor process spawns a new > process which will handle this new connection, and then it returns to > listening for new connection requests. > > what is the best way to ensure that the listening acceptor process gets > updated on hot code swapping? do i just need to add a the ?MODULE macro in > front of the calls that get back to the acceptor loop, i.e. > ?MODULE:acceptor_loop? should i actually timeout the acceptor? is there any > particular system event i should be catching? > > any input warmly welcome. > > thank you, > > r. > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From zabrane3@REDACTED Tue Dec 6 16:52:25 2011 From: zabrane3@REDACTED (Zabrane Mickael) Date: Tue, 6 Dec 2011 16:52:25 +0100 Subject: [erlang-questions] Facebook API for Erlang In-Reply-To: References: <14C09090-B9A5-4DD1-82B0-9F37C2609898@gmail.com> Message-ID: <8F0EAF3F-BAA4-4328-9860-2B405BCD5BE1@gmail.com> Thanks Ahmed. On Dec 6, 2011, at 3:50 PM, Ahmed Omar wrote: > https://github.com/ngerakines/erlang_facebook Even if a bit old, it'll certainly do the job ! Regards, Zabrane -------------- next part -------------- An HTML attachment was scrubbed... URL: From zabrane3@REDACTED Tue Dec 6 16:56:02 2011 From: zabrane3@REDACTED (Zabrane Mickael) Date: Tue, 6 Dec 2011 16:56:02 +0100 Subject: [erlang-questions] Facebook API for Erlang In-Reply-To: References: <14C09090-B9A5-4DD1-82B0-9F37C2609898@gmail.com> Message-ID: <0938D844-9DC8-44CA-BA3F-D54A5E84E571@gmail.com> Thanks Ahmed. On Dec 6, 2011, at 3:50 PM, Ahmed Omar wrote: > https://github.com/ngerakines/erlang_facebook Even if a bit old, it'll certainly do the job ! Regards, Zabrane -------------- next part -------------- An HTML attachment was scrubbed... URL: From emeka_1978@REDACTED Tue Dec 6 19:47:46 2011 From: emeka_1978@REDACTED (emeka okafor) Date: Tue, 6 Dec 2011 10:47:46 -0800 (PST) Subject: [erlang-questions] SASL Message-ID: <1323197266.9017.YahooMailNeo@web114218.mail.gq1.yahoo.com> hi everybody, erlang newbie here. I am having a hard time telling my erlang application to pick up the sasl configuration that i pass through command line arguments. I created a release and am able to start the application with "bin/werl ?-AppName -config sasl.config. The config i am using is from joe's book "programming erlang": %% rotating log and minimal tty [{sasl, [ {sasl_error_logger, false}, %% define the parameters of the rotating log %% the log file directory {error_logger_mf_dir,"/home/joe/error_logs" }, %% # bytes per logfile {error_logger_mf_maxbytes,10485760}, % 10 MB %% maximum number of logfiles {error_logger_mf_maxfiles, 10} ]}].?? No directory is created and if i create one then no logs are written in it; when i excute sys:get_status(error_logger), i can see that "error_logger_mf_dir" is not listed. What am i doing wrong? -------------- next part -------------- An HTML attachment was scrubbed... URL: From ok@REDACTED Tue Dec 6 21:21:44 2011 From: ok@REDACTED (Richard O'Keefe) Date: Wed, 7 Dec 2011 09:21:44 +1300 Subject: [erlang-questions] illegal guard expression for IF illegal guard expression for "if" In-Reply-To: References: <4ED89F79.6090607@gmail.com> <4ED8A31A.2020700@gmail.com> <4ED8A5DF.70301@gmail.com> <518129F9-E516-4995-9C64-AA788BFB68E1@cs.otago.ac.nz> Message-ID: <958B9E99-0B41-4265-AD7B-E17B5557E2A5@cs.otago.ac.nz> On 6/12/2011, at 3:24 PM, Barco You wrote: > >For example, suppose you often want to match [{opt,X}]. > >Then you will one day be able to write > > > > #one_opt(X) -> [{opt,X}]. > > > Your 'abstract pattern' looks like macro! No more than any function does. The syntax and semantics are fully checked at the point of declaration; patterns can use abstract patterns from modules not yet written let alone loaded; and while it was never part of the original design, because there wasn't a type system then, it would be perfectly possible to give abstract patterns types, e.g. -spec #one_opt(X) -> [{'opt',X)}]. Try doing _that_ with a macro. From zerthurd@REDACTED Wed Dec 7 07:31:42 2011 From: zerthurd@REDACTED (Maxim Treskin) Date: Wed, 7 Dec 2011 13:31:42 +0700 Subject: [erlang-questions] Best practices in gen_fsm usage Message-ID: Hello During years of work with Erlang/OTP I had many troubles with gen_fsm and me not alone. A number of people who I know have the same troubles. Here some of them: 1. gen_fsm incompatible with gen_server. We cannot use synchronous call from gen_server for gen_fsm because it different. 2. Two different actions: send_event ? send_all_state_event with different handlers. Why? If we want to send message to FSM, we just send message to process without knowledge of its internal state-related issues, right? 3. For complex protocols and when one message emits almost equal actions in various process states, code of gen_fsm-process becomes pumpkinized. Every time I start writing a new gen_fsm module, I think that this time the code will not become pumpkinized, but this wrong. Large number of pattern matching with records in events and internal state of process in various state handlers makes code duplicated and unreadable. Is there any best practices in gen_fsm usage? May be I and other people uses gen_fsm improperly? Great Thanks -- Maxim Treskin -------------- next part -------------- An HTML attachment was scrubbed... URL: From thomasl_erlang@REDACTED Wed Dec 7 08:49:42 2011 From: thomasl_erlang@REDACTED (Thomas Lindgren) Date: Tue, 6 Dec 2011 23:49:42 -0800 (PST) Subject: [erlang-questions] Best practices in gen_fsm usage In-Reply-To: References: Message-ID: <1323244182.2928.YahooMailNeo@web111408.mail.gq1.yahoo.com> >________________________________ > From: Maxim Treskin ... > >1. gen_fsm incompatible with gen_server. We cannot use synchronous call from gen_server for gen_fsm because it different. >2. Two different actions: send_event ? send_all_state_event with different handlers. Why? If we want to send message to FSM, we just send message to process without knowledge of its internal state-related issues, right? >3. For complex protocols and when one message emits almost equal actions in various process states, code of gen_fsm-process becomes pumpkinized.?Every time I start writing a new gen_fsm module, I think that this time the code will not become pumpkinized, but this wrong. Large number of pattern matching with records in events and internal state of process in various state handlers makes code duplicated and unreadable. > > >Is there any best practices in gen_fsm usage? May be I and other people uses gen_fsm improperly? > Regarding points 1 and 2: My favorite approach to using gen_fsm, gen_server etc is to define all the calls to the server/fsm/... as an API, often in the server module itself. The client then just uses these API functions, while it's the job of the provider module to wrangle the raw gen_* calls. Best, Thomas From zerthurd@REDACTED Wed Dec 7 08:56:01 2011 From: zerthurd@REDACTED (Maxim Treskin) Date: Wed, 7 Dec 2011 14:56:01 +0700 Subject: [erlang-questions] Best practices in gen_fsm usage In-Reply-To: <1323244182.2928.YahooMailNeo@web111408.mail.gq1.yahoo.com> References: <1323244182.2928.YahooMailNeo@web111408.mail.gq1.yahoo.com> Message-ID: On 7 December 2011 14:49, Thomas Lindgren wrote: > >________________________________ > > > From: Maxim Treskin > ... > > > >1. gen_fsm incompatible with gen_server. We cannot use synchronous call > from gen_server for gen_fsm because it different. > >2. Two different actions: send_event ? send_all_state_event with > different handlers. Why? If we want to send message to FSM, we just send > message to process without knowledge of its internal state-related issues, > right? > >3. For complex protocols and when one message emits almost equal actions > in various process states, code of gen_fsm-process becomes > pumpkinized. Every time I start writing a new gen_fsm module, I think that > this time the code will not become pumpkinized, but this wrong. Large > number of pattern matching with records in events and internal state of > process in various state handlers makes code duplicated and unreadable. > > > > > >Is there any best practices in gen_fsm usage? May be I and other people > uses gen_fsm improperly? > > > > Regarding points 1 and 2: My favorite approach to using gen_fsm, > gen_server etc is to define all the calls to the server/fsm/... as an API, > often in the server module itself. The client then just uses these API > functions, while it's the job of the provider module to wrangle the raw > gen_* calls. > > Yes, this solution is acceptable, but it is yet another redundant layer of abstraction. > Best, > Thomas > -- Maxim Treskin -------------- next part -------------- An HTML attachment was scrubbed... URL: From vances@REDACTED Wed Dec 7 09:00:17 2011 From: vances@REDACTED (Vance Shipley) Date: Wed, 7 Dec 2011 13:30:17 +0530 Subject: [erlang-questions] Best practices in gen_fsm usage In-Reply-To: References: Message-ID: <20111207080015.GP298@aluminum.motivity.ca> On Wed, Dec 07, 2011 at 01:31:42PM +0700, Maxim Treskin wrote: } 1. gen_fsm incompatible with gen_server. We cannot use synchronous call } from gen_server for gen_fsm because it different. Are you suggesting that you should be able to write: Reply = Module:call(Ref, Request) Where Ref is a reference to either a gen_server a or gen_fsm? You still need to use the correct module. I don't see how much that helps you over: Reply = case Module of gen_server -> gen_server:call(Ref, Request); gen_fsm -> gen_fsm:sync_send_event(Ref, Request) end } 2. Two different actions: send_event ? send_all_state_event with different } handlers. Why? If we want to send message to FSM, we just send message to } process without knowledge of its internal state-related issues, right? When you call gen_fsm:send_event/2 to send an event the function StateName/2 in your callback module will be called for any state. You don't need to use send_all_state_event/2 at all. If you do it is processed in your callback module's handle_event/3 function and not the individual state's event handler StateName/2. } 3. For complex protocols and when one message emits almost equal actions in } various process states, code of gen_fsm-process becomes pumpkinized. Every } time I start writing a new gen_fsm module, I think that this time the code } will not become pumpkinized, but this wrong. Large number of pattern } matching with records in events and internal state of process in various } state handlers makes code duplicated and unreadable. How can it be any other way? You say "_almost_ equal actions in _various_ process states". So it's not all states and not the same action. Therefore you need to uniquely handle events in states. } Is there any best practices in gen_fsm usage? May be I and other people } uses gen_fsm improperly? Obviously putting common processing in seperate functions and calling them from the state handlers is the way to handle 3. If you still have a problem with 1 or 2 you might want to just simply send messages ('Ref ! Request') and handle them in gen_server:handle_info/2 and gen_fsm:handle_info/3. If you are still unsatisfied you could implement your own FSM behaviour in place of gen_fsm. You may find this thread interesting: http://erlang.org/pipermail/erlang-questions/2005-April/015097.html -- -Vance From max.lapshin@REDACTED Wed Dec 7 09:06:43 2011 From: max.lapshin@REDACTED (Max Lapshin) Date: Wed, 7 Dec 2011 11:06:43 +0300 Subject: [erlang-questions] Best practices in gen_fsm usage In-Reply-To: <1323244182.2928.YahooMailNeo@web111408.mail.gq1.yahoo.com> References: <1323244182.2928.YahooMailNeo@web111408.mail.gq1.yahoo.com> Message-ID: On Wed, Dec 7, 2011 at 10:49 AM, Thomas Lindgren wrote: >>________________________________ > Regarding points 1 and 2: My favorite approach to using gen_fsm, gen_server etc is to define all the calls to the server/fsm/... as an API, often in the server module itself. The client then just uses these API functions, while it's the job of the provider module to wrangle the raw gen_* calls. > Your solution doesn't work in real life. I pass pid of process to the handler, that makes gen_server calls (through some wrapper) and while this process is gen_server, I get duck typing and everything works. If process is gen_fsm, that this schema breaks and I need to pass explicit type of this process: module where to call wrappers from. Everything is going to be very complicated, but I refuse and delete gen_fsm as useless code. From zerthurd@REDACTED Wed Dec 7 09:13:59 2011 From: zerthurd@REDACTED (Maxim Treskin) Date: Wed, 7 Dec 2011 15:13:59 +0700 Subject: [erlang-questions] Best practices in gen_fsm usage In-Reply-To: <20111207080015.GP298@aluminum.motivity.ca> References: <20111207080015.GP298@aluminum.motivity.ca> Message-ID: On 7 December 2011 15:00, Vance Shipley wrote: > On Wed, Dec 07, 2011 at 01:31:42PM +0700, Maxim Treskin wrote: > } 1. gen_fsm incompatible with gen_server. We cannot use synchronous call > } from gen_server for gen_fsm because it different. > > Are you suggesting that you should be able to write: > > Reply = Module:call(Ref, Request) > > Where Ref is a reference to either a gen_server a or gen_fsm? > You still need to use the correct module. I don't see how much > that helps you over: > > Reply = case Module of > gen_server -> > gen_server:call(Ref, Request); > gen_fsm -> > gen_fsm:sync_send_event(Ref, Request) > end > > So I need to pass behaviour with pid() of process to client. > } 2. Two different actions: send_event ? send_all_state_event with > different > } handlers. Why? If we want to send message to FSM, we just send message > to > } process without knowledge of its internal state-related issues, right? > > When you call gen_fsm:send_event/2 to send an event the function > StateName/2 in your callback module will be called for any state. > You don't need to use send_all_state_event/2 at all. If you do > it is processed in your callback module's handle_event/3 function > and not the individual state's event handler StateName/2. > > } 3. For complex protocols and when one message emits almost equal > actions in > } various process states, code of gen_fsm-process becomes pumpkinized. > Every > } time I start writing a new gen_fsm module, I think that this time the > code > } will not become pumpkinized, but this wrong. Large number of pattern > } matching with records in events and internal state of process in various > } state handlers makes code duplicated and unreadable. > > How can it be any other way? You say "_almost_ equal actions in > _various_ process states". So it's not all states and not the same > action. Therefore you need to uniquely handle events in states. > > Putting state name in #state{name = StateName} of gen_server gives necessary result. We can do handle_call(#request{... large pattern matching ...} = Request, From, #state{name = StateName, ... another pattern matching...} = State) -> do_smth..., case StateName of %% State specific code .... end, do_yet_another_smth..., {reply, Result, State} instead of copies `large pattern matching` Request with State if we use gen_fsm. > } Is there any best practices in gen_fsm usage? May be I and other people > } uses gen_fsm improperly? > > Obviously putting common processing in seperate functions and calling > them from the state handlers is the way to handle 3. > > If you still have a problem with 1 or 2 you might want to just simply > send messages ('Ref ! Request') and handle them in > gen_server:handle_info/2 and gen_fsm:handle_info/3. > > If you are still unsatisfied you could implement your own FSM > behaviour in place of gen_fsm. You may find this thread interesting: > > http://erlang.org/pipermail/erlang-questions/2005-April/015097.html > > -- > -Vance > > -- Maxim Treskin -------------- next part -------------- An HTML attachment was scrubbed... URL: From vances@REDACTED Wed Dec 7 10:27:19 2011 From: vances@REDACTED (Vance Shipley) Date: Wed, 7 Dec 2011 14:57:19 +0530 Subject: [erlang-questions] Best practices in gen_fsm usage In-Reply-To: References: <20111207080015.GP298@aluminum.motivity.ca> Message-ID: <20111207092718.GR298@aluminum.motivity.ca> On Wed, Dec 07, 2011 at 03:13:59PM +0700, Maxim Treskin wrote: } So I need to pass behaviour with pid() of process to client. Either that or use an accessor as Thomas described. } Putting state name in #state{name = StateName} of gen_server gives } necessary result. Sure, go ahead and do that. The gen_fsm behaviour is a tool to help you implement communicating finite state machines which is a common design pattern encountered in the real world. If you are working with FSMs but have no understanding of that you will simply have a harder time conceptualizing the problem and it's solutions. On the other hand if you do understand the theory you can then make an informed decision on an implementation. The fact is that if you tried to implement an FSM decribed in 50 pages of SDL you'd get lost pretty soon using a gen_server. Or not ... it's just syntactic sugar. -- -Vance From max.lapshin@REDACTED Wed Dec 7 10:40:03 2011 From: max.lapshin@REDACTED (Max Lapshin) Date: Wed, 7 Dec 2011 12:40:03 +0300 Subject: [erlang-questions] Best practices in gen_fsm usage In-Reply-To: <20111207092718.GR298@aluminum.motivity.ca> References: <20111207080015.GP298@aluminum.motivity.ca> <20111207092718.GR298@aluminum.motivity.ca> Message-ID: On Wed, Dec 7, 2011 at 12:27 PM, Vance Shipley wrote: > Sure, go ahead and do that. ?The gen_fsm behaviour is a tool to > help you implement communicating finite state machines which is gen_fsm is not about finite state machines. Please, read definition of this term before repeating these words. It is mathematical term, that has some specific properties, that has nothing to do with gen_fsm api. > a common design pattern encountered in the real world. ?If you > are working with FSMs but have no understanding of that you will > simply have a harder time conceptualizing the problem and it's > solutions. ?On the other hand if you do understand the theory you > can then make an informed decision on an implementation. > > The fact is that if you tried to implement an FSM decribed in 50 > pages of SDL you'd get lost pretty soon using a gen_server. ?Or > not ... it's just syntactic sugar. > It is exactly what Treskin was talking about. Show example of code, which is better built on gen_fsm, than on gen_server. From erlangsiri@REDACTED Wed Dec 7 10:54:46 2011 From: erlangsiri@REDACTED (Siri Hansen) Date: Wed, 7 Dec 2011 10:54:46 +0100 Subject: [erlang-questions] SASL In-Reply-To: References: <1323197266.9017.YahooMailNeo@web114218.mail.gq1.yahoo.com> Message-ID: sorry - forgot to copy the list... 2011/12/7 Siri Hansen > Hi Emeka! > > First of all, to check if the application environment variables are set > for sasl, you can call application:get_all_env(sasl). This will show if the > problem is that the variables are not set at all, or if there might be > something else. Note that the sasl application must be started here. Also, > the error logger directory should exist before starting sasl. > > I'm guessing that your real problem is that werl can not read the > directory "/home/joe/error_logs". Try to do > file:list_dir("/home/joe/error_logs") to verify this. I think you need to > change the value to "c:/cygwin/home/joe/error_logs". > > Regards > /siri > > 2011/12/6 emeka okafor > >> hi everybody, >> erlang newbie here. I am having a hard time telling my erlang application >> to pick up the sasl configuration that i pass through command line >> arguments. >> I created a release and am able to start the application with "*bin/werl >> -AppName -config sasl.config*. The config i am using is from joe's book >> "programming erlang": >> >> *%% rotating log and minimal tty* >> *[{sasl, [* >> *{sasl_error_logger, false},* >> *%% define the parameters of the rotating log* >> *%% the log file directory* >> *{error_logger_mf_dir,"/home/joe/error_logs" },* >> *%% # bytes per logfile* >> *{error_logger_mf_maxbytes,10485760}, % 10 MB* >> *%% maximum number of logfiles* >> *{error_logger_mf_maxfiles, 10}* >> *]}]. * >> * >> * >> No directory is created and if i create one then no logs are written in >> it; when i excute sys:get_status(error_logger), i can see that >> "error_logger_mf_dir" is not listed. >> What am i doing wrong? >> >> _______________________________________________ >> 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 Wed Dec 7 10:58:00 2011 From: ulf@REDACTED (Ulf Wiger) Date: Wed, 7 Dec 2011 10:58:00 +0100 Subject: [erlang-questions] Best practices in gen_fsm usage In-Reply-To: References: <20111207080015.GP298@aluminum.motivity.ca> <20111207092718.GR298@aluminum.motivity.ca> Message-ID: <627EB1EB-082B-41D8-B033-2F7EE84316BE@feuerlabs.com> On 7 Dec 2011, at 10:40, Max Lapshin wrote: > On Wed, Dec 7, 2011 at 12:27 PM, Vance Shipley wrote: >> Sure, go ahead and do that. The gen_fsm behaviour is a tool to >> help you implement communicating finite state machines which is > > gen_fsm is not about finite state machines. Please, read definition of > this term before repeating these words. > It is mathematical term, that has some specific properties, that has > nothing to do with gen_fsm api. This is a fairly narrow view. Finite State Machine is the commonly accepted name for the kind of model gen_fsm implements, and also what the 'fsm' part of the name stands for. If you read the Wikipedia article on FSMs, you will find references to both UML and SDL state machines (http://en.wikipedia.org/wiki/Finite-state_machine#SDL_state_machines) (SDL is now a subset of UML). You can also read up on Finite State Machines in SDL here: http://dtl.unimelb.edu.au/R/QQY97C1UTY254K3D1KPGXVP69M4V9G98R72NNCU48VJ54RDDDH-01973?func=dbin-jump-full&object_id=264093&local_base=GEN01&pds_handle=GUEST (The examples described there can be mapped 1:1 to gen_fsm). BR, Ulf W > >> a common design pattern encountered in the real world. If you >> are working with FSMs but have no understanding of that you will >> simply have a harder time conceptualizing the problem and it's >> solutions. On the other hand if you do understand the theory you >> can then make an informed decision on an implementation. >> >> The fact is that if you tried to implement an FSM decribed in 50 >> pages of SDL you'd get lost pretty soon using a gen_server. Or >> not ... it's just syntactic sugar. >> > > It is exactly what Treskin was talking about. Show example of code, > which is better built on gen_fsm, than on gen_server. > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions From mononcqc@REDACTED Wed Dec 7 13:58:05 2011 From: mononcqc@REDACTED (Fred Hebert) Date: Wed, 7 Dec 2011 07:58:05 -0500 Subject: [erlang-questions] Best practices in gen_fsm usage In-Reply-To: References: <20111207080015.GP298@aluminum.motivity.ca> <20111207092718.GR298@aluminum.motivity.ca> Message-ID: I submit to you my trade_fsm system as described in my Rage Against the Finite-State Machines chapter ( http://learnyousomeerlang.com/finite-state-machines) http://learnyousomeerlang.com/static/erlang/trade_fsm.erl Another one would be a player process I've got for Process Quest: http://learnyousomeerlang.com/static/erlang/processquest/apps/processquest-1.0.0/src/pq_player.erlthat one is a bit weird because it's a standalone process that sends itself the events it needs to move forward. While there's no doubt it would be possible to do with a gen_server, I doubt it would be much cleaner or easier to read or as self-descriptive written that way. Using a gen_fsm makes it more obvious how the process is supposed to behave, in my opinion. On Wed, Dec 7, 2011 at 4:40 AM, Max Lapshin wrote: > > > It is exactly what Treskin was talking about. Show example of code, > which is better built on gen_fsm, than on gen_server. > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From sam@REDACTED Wed Dec 7 14:41:45 2011 From: sam@REDACTED (Samuel Elliott) Date: Wed, 7 Dec 2011 13:41:45 +0000 Subject: [erlang-questions] Best practices in gen_fsm usage In-Reply-To: References: <1323244182.2928.YahooMailNeo@web111408.mail.gq1.yahoo.com> Message-ID: On Wed, Dec 7, 2011 at 7:56 AM, Maxim Treskin wrote: > > On 7 December 2011 14:49, Thomas Lindgren wrote: >> >> >________________________________ >> >> > From: Maxim Treskin >> ... >> > >> >1. gen_fsm incompatible with gen_server. We cannot use synchronous call >> > from gen_server for gen_fsm because it different. >> >2. Two different actions: send_event ? send_all_state_event with >> > different handlers. Why? If we want to send message to FSM, we just send >> > message to process without knowledge of its internal state-related issues, >> > right? >> >3. For complex protocols and when one message emits almost equal actions >> > in various process states, code of gen_fsm-process becomes >> > pumpkinized.?Every time I start writing a new gen_fsm module, I think that >> > this time the code will not become pumpkinized, but this wrong. Large number >> > of pattern matching with records in events and internal state of process in >> > various state handlers makes code duplicated and unreadable. >> > >> > >> >Is there any best practices in gen_fsm usage? May be I and other people >> > uses gen_fsm improperly? >> > >> >> Regarding points 1 and 2: My favorite approach to using gen_fsm, >> gen_server etc is to define all the calls to the server/fsm/... as an API, >> often in the server module itself. The client then just uses these API >> functions, while it's the job of the provider module to wrangle the raw >> gen_* calls. >> > Yes, this solution is acceptable, but it is yet another redundant layer of > abstraction. Just because we are functional programmers doesn't mean we should throw away encapsulation. I *love* this method, because it completely hides the fact I'm using gen_fsm - which after all is only an implementation detail, and shouldn't matter more than that. In fact in Hypernumbers, I think almost every single gen_server or gen_fsm has an official API of functions that call into gen_*:call(), but without ever invoking that directly. (Yes they do cope with the fact that there might be multiple processes all using the same callback modules). Sam > >> >> Best, >> Thomas > > > > > -- > Maxim Treskin > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > -- Samuel Elliott sam@REDACTED http://lenary.co.uk/ +44 (0)7891 993 664 From rtrlists@REDACTED Wed Dec 7 16:12:24 2011 From: rtrlists@REDACTED (Robert Raschke) Date: Wed, 7 Dec 2011 15:12:24 +0000 Subject: [erlang-questions] SASL In-Reply-To: <1323197266.9017.YahooMailNeo@web114218.mail.gq1.yahoo.com> References: <1323197266.9017.YahooMailNeo@web114218.mail.gq1.yahoo.com> Message-ID: On Tue, Dec 6, 2011 at 6:47 PM, emeka okafor wrote: > hi everybody, > erlang newbie here. I am having a hard time telling my erlang application > to pick up the sasl configuration that i pass through command line > arguments. > I created a release and am able to start the application with "*bin/werl > -AppName -config sasl.config*. The config i am using is from joe's book > "programming erlang": > > *%% rotating log and minimal tty* > *[{sasl, [* > *{sasl_error_logger, false},* > *%% define the parameters of the rotating log* > *%% the log file directory* > *{error_logger_mf_dir,"/home/joe/error_logs" },* > *%% # bytes per logfile* > *{error_logger_mf_maxbytes,10485760}, % 10 MB* > *%% maximum number of logfiles* > *{error_logger_mf_maxfiles, 10}* > *]}]. * > * > * > No directory is created and if i create one then no logs are written in > it; when i excute sys:get_status(error_logger), i can see that > "error_logger_mf_dir" is not listed. > What am i doing wrong? > > The -config option expects a name without the .config extension, as that gets added by the system. So, try simply -config sasl . And yes, the directory for the log must pre-exist. Robby -------------- next part -------------- An HTML attachment was scrubbed... URL: From max.lapshin@REDACTED Wed Dec 7 18:04:00 2011 From: max.lapshin@REDACTED (Max Lapshin) Date: Wed, 7 Dec 2011 20:04:00 +0300 Subject: [erlang-questions] Best practices in gen_fsm usage In-Reply-To: <33151719-9161-4a9e-aafc-61471a629cac@knuth> References: <33151719-9161-4a9e-aafc-61471a629cac@knuth> Message-ID: On Wed, Dec 7, 2011 at 6:50 PM, Adam Lindberg wrote: > > What exactly is the use case for being able to contact a process that implements either gen_server or gen_fsm via a standard API? I've never come across a use case where processes of different "types" needed to be mixed. If you really, really have to have that, you could implement a common interface via the handle_info/2 callbacks. You haven't met. I have. > > - Either your process runs code that is based on gen_fsm, then you use a wrapper API that converts calls to corresponding gen_fsm calls (just as Thomas suggested). > What for? I have never ever seen any _production_ code, which is better with gen_fsm. Thanks to Fred for study examples, but they are study examples. Ulf told something about SDL, but I really don't know what is SDL. I beleive that there may be situation, when gen_fsm is convenient. But I ask only to show example of such code. From ulf@REDACTED Wed Dec 7 18:24:48 2011 From: ulf@REDACTED (Ulf Wiger) Date: Wed, 7 Dec 2011 18:24:48 +0100 Subject: [erlang-questions] Best practices in gen_fsm usage In-Reply-To: References: <33151719-9161-4a9e-aafc-61471a629cac@knuth> Message-ID: <01F34AC4-97BF-43C8-9D12-CA47B791DF94@feuerlabs.com> On 7 Dec 2011, at 18:04, Max Lapshin wrote: > Ulf told something about SDL, but I really don't know what is SDL. SDL = Specification and Description Language, is a ITU-T standard language for describing systems of communicating state machines. This was used much in Telecoms, and in real-time systems design, often together with Message Sequence Charts (MSC), to produce high-level systems architecture diagrams. SDL also extends down into programming with SDL/PR, but we can ignore that. ASN.1 - a loosely related data description layer - is however still quite relevant. In the great UML:ification, SDL was absorbed into UML. Before that, it became more and more object-oriented. Still, the earlier versions are actually fairly decent for describing erlang-based systems. In fact, it was once shown that a system described in SDL could be mapped 1:1 over to Erlang. This has not been done much, since it was also easy to demonstrate that the same system could be more easily described in Erlang in the first place (although such a description would lose many of the qualities of a good system architecture description). Here is a tutorial of sdl88. The link jumps directly into something that ought to look familiar: http://www.sdl-forum.org/sdl88tutorial/4.ProcessCommunication/4.1_Signal_input_queue.htm Here's another overview: http://www.cs.nthu.edu.tw/~tanghome/SDTDoc/introsdl.html BR, Ulf W -------------- next part -------------- An HTML attachment was scrubbed... URL: From unexplained@REDACTED Wed Dec 7 21:02:14 2011 From: unexplained@REDACTED (Michael Stellar) Date: Thu, 8 Dec 2011 03:02:14 +0700 Subject: [erlang-questions] failed to build docs on windows Message-ID: When i am attempting build docs with make docs in windows, it seems escript failed to translate unix based path in cygwin, the make docs return this error PATH=/home/Michael/otp_src_R14B04/bin:${PATH} escript /home/Michael/otp_src_R14B04/lib/erl_docgen/priv/bin/xref_mod_app.escript -topdir /home/Michael/otp_src_R14B04 -outfile /home/Michael/otp_src_R14B04/make/win32/mod2app.xml Makefile:416: recipe for target `mod2app' failed I already have erlang, fop, xsltproc in my path, the erlang binaries already successfully built in this cygwin setup which is based on the guide, does it's not really possible to build docs on windows ?. From gumm@REDACTED Wed Dec 7 21:42:59 2011 From: gumm@REDACTED (Jesse Gumm) Date: Wed, 7 Dec 2011 14:42:59 -0600 Subject: [erlang-questions] reltool not copying erl_interface In-Reply-To: References: Message-ID: Thanks Hakan for the direction. I'd be happy to take a crack at it. -Jesse 2011/12/5 H?kan Mattsson : > There are several possible solutions to this: > > - Add ebin-directories to erl_interface and jinterface in order to make > ?reltool think that these "non-Erlang" applications also are Erlang > ?applications. Do also add an .app file in order to avoid reltool warnings. > > - Change reltool_server:app_dirs2/3 so directories that are lacking the > ?ebin sub directory also will be regarded as applications. The reltool > ?warning for missing .app-files should be suppressed if the ebin-directory > ?is missing. > > - Add an extra OverrideSpec argument to reltool:eval_target_spec/3 and > ?reltool:create_target/2. The new argument should be a target_spec() > ?that overrides parts of the ordinary TargetSpec. Such an OverrideSpec > ?argument could then be used to copy extra files that reltool normally > ?would not include in the generated target. > > Any takers for a contribution? > > /H?kan > > On Sat, Dec 3, 2011 at 10:05 PM, Jesse Gumm wrote: >> Hello everyone, >> >> This is a followup to a post I made a few months ago[1], which was >> probably too and meandering for anyone to read (I struggle with >> brevity). >> >> The short version is that for the life of me, I cannot find a way to >> force the erl_interface dir to get copied with reltool. >> >> There are reltool options for forcing an app to get copied, but >> erl_interface isn't an app (ie, doesn't have a .app file). >> >> Anyone have any thoughts on this? >> >> Thanks in advance, >> >> -Jesse >> >> [1] http://erlang.org/pipermail/erlang-questions/2011-October/061923.html >> >> -- >> Jesse Gumm >> Sigma Star Systems >> 414.940.4866 >> gumm@REDACTED >> http://www.sigma-star.com >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://erlang.org/mailman/listinfo/erlang-questions -- Jesse Gumm Sigma Star Systems 414.940.4866 gumm@REDACTED http://www.sigma-star.com From mononcqc@REDACTED Wed Dec 7 23:21:13 2011 From: mononcqc@REDACTED (Fred Hebert) Date: Wed, 7 Dec 2011 17:21:13 -0500 Subject: [erlang-questions] Best practices in gen_fsm usage In-Reply-To: References: <33151719-9161-4a9e-aafc-61471a629cac@knuth> Message-ID: On Wed, Dec 7, 2011 at 12:04 PM, Max Lapshin wrote: > > I have never ever seen any _production_ code, which is better with > gen_fsm. Thanks to Fred for study examples, but they are study > examples. > > I beleive that there may be situation, when gen_fsm is convenient. But > I ask only to show example of such code. > > Fortunately this isn't a hockey game, because the moving goal posts would make it quite hard to score a goal ;) If I make a website using my code and then make it public, does it become production code? Are there other hidden criteria? -------------- next part -------------- An HTML attachment was scrubbed... URL: From torben.lehoff@REDACTED Wed Dec 7 23:26:26 2011 From: torben.lehoff@REDACTED (Torben Hoffmann) Date: Wed, 07 Dec 2011 23:26:26 +0100 Subject: [erlang-questions] Best practices in gen_fsm usage In-Reply-To: <01F34AC4-97BF-43C8-9D12-CA47B791DF94@feuerlabs.com> References: <33151719-9161-4a9e-aafc-61471a629cac@knuth> <01F34AC4-97BF-43C8-9D12-CA47B791DF94@feuerlabs.com> Message-ID: <4EDFE812.4000604@gmail.com> Adding to the SDL wagon: I have had to implement the Q.SIG standard and with a little thought it is possible to get Erlang code that is almost 1:1 with the SDL diagrams - there is a little example in the EUC 2010 presentation by Raghav Karol and me where we have one function call for each box in the SDL diagrams. That makes it very easy to debug the code in the rare case that one has done something wrong ;-) But for creation of new software where there is no SDL specification of the protocols there is no real benefits of creating SDL before coding. For that I think that Object Process Methodology (used lightly) and Message Sequence Charts are better ways of structuring your high level thoughts. Cheers, Torben On 7/12/11 18:24 , Ulf Wiger wrote: > > On 7 Dec 2011, at 18:04, Max Lapshin wrote: > >> Ulf told something about SDL, but I really don't know what is SDL. > > SDL = Specification and Description Language, is a ITU-T standard > language for describing systems of communicating state machines. This > was used much in Telecoms, and in real-time systems design, often > together with Message Sequence Charts (MSC), to produce high-level > systems architecture diagrams. > > SDL also extends down into programming with SDL/PR, but we can ignore > that. ASN.1 - a loosely related data description layer - is however > still quite relevant. > > In the great UML:ification, SDL was absorbed into UML. Before that, it > became more and more object-oriented. Still, the earlier versions are > actually fairly decent for describing erlang-based systems. In fact, > it was once shown that a system described in SDL could be mapped 1:1 > over to Erlang. This has not been done much, since it was also easy to > demonstrate that the same system could be more easily described in > Erlang in the first place (although such a description would lose many > of the qualities of a good system architecture description). > > Here is a tutorial of sdl88. The link jumps directly into something > that ought to look familiar: > > http://www.sdl-forum.org/sdl88tutorial/4.ProcessCommunication/4.1_Signal_input_queue.htm > > Here's another overview: > http://www.cs.nthu.edu.tw/~tanghome/SDTDoc/introsdl.html > > > BR, > Ulf W > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions -------------- next part -------------- An HTML attachment was scrubbed... URL: From andrew@REDACTED Wed Dec 7 23:31:20 2011 From: andrew@REDACTED (Andrew Thompson) Date: Wed, 7 Dec 2011 17:31:20 -0500 Subject: [erlang-questions] Best practices in gen_fsm usage In-Reply-To: References: <33151719-9161-4a9e-aafc-61471a629cac@knuth> Message-ID: <20111207223120.GC10804@hijacked.us> On Wed, Dec 07, 2011 at 05:21:13PM -0500, Fred Hebert wrote: > On Wed, Dec 7, 2011 at 12:04 PM, Max Lapshin wrote: > > > > > I have never ever seen any _production_ code, which is better with > > gen_fsm. Thanks to Fred for study examples, but they are study > > examples. > > > > I beleive that there may be situation, when gen_fsm is convenient. But > > I ask only to show example of such code. > > Riak makes extensive use of FSMs in lots of places. A good example is the put fsm: https://github.com/basho/riak_kv/blob/master/src/riak_kv_put_fsm.erl It's a FSM that models the states involved in writing a key to the database. Of course, you *could* write this as a gen_server, but you'd lose quite a bit of clarity. Andrew From emeka_1978@REDACTED Thu Dec 8 09:22:58 2011 From: emeka_1978@REDACTED (eigenfunction) Date: Thu, 8 Dec 2011 00:22:58 -0800 (PST) Subject: [erlang-questions] SASL In-Reply-To: References: <1323197266.9017.YahooMailNeo@web114218.mail.gq1.yahoo.com> Message-ID: You guys save my life. Removing the extension ".config" did the trick. Thanks a lot. On 7 Dez., 16:12, Robert Raschke wrote: > On Tue, Dec 6, 2011 at 6:47 PM, emeka okafor wrote: > > hi everybody, > > erlang newbie here. I am having a hard time telling my erlang application > > to pick up the sasl configuration that i pass through command line > > arguments. > > I created a release and am able to start the application with "*bin/werl > > ?-AppName -config sasl.config*. The config i am using is from joe's book > > "programming erlang": > > > *%% rotating log and minimal tty* > > *[{sasl, [* > > *{sasl_error_logger, false},* > > *%% define the parameters of the rotating log* > > *%% the log file directory* > > *{error_logger_mf_dir,"/home/joe/error_logs" },* > > *%% # bytes per logfile* > > *{error_logger_mf_maxbytes,10485760}, % 10 MB* > > *%% maximum number of logfiles* > > *{error_logger_mf_maxfiles, 10}* > > *]}]. ?* > > * > > * > > No directory is created and if i create one then no logs are written in > > it; when i excute sys:get_status(error_logger), i can see that > > "error_logger_mf_dir" is not listed. > > What am i doing wrong? > > The -config option expects a name without the .config extension, as that > gets added by the system. So, try simply -config sasl . And yes, the > directory for the log must pre-exist. > > Robby > > _______________________________________________ > erlang-questions mailing list > erlang-questi...@REDACTED://erlang.org/mailman/listinfo/erlang-questions From albin.stigo@REDACTED Thu Dec 8 11:27:39 2011 From: albin.stigo@REDACTED (=?ISO-8859-1?Q?Albin_Stig=F6?=) Date: Thu, 8 Dec 2011 11:27:39 +0100 Subject: [erlang-questions] Building small erlang vm suitable for bundle with app. Message-ID: Hi, I'm quite new to Erlang and this list so I hope I'm posting in the right place? I would like to use Erlang code (couchdb) in an Mac OS X app I'm developing and I would like to bundle it with my app. Exactly like the Mac OS X version of Wings3D is bundling a version of erlang. I was wondering if someone kind provide me with some ideas of how to compile a smaller version of the Erlang VM without the developing tools etc? Cheers, Albin From spawn.think@REDACTED Thu Dec 8 11:55:30 2011 From: spawn.think@REDACTED (Ahmed Omar) Date: Thu, 8 Dec 2011 11:55:30 +0100 Subject: [erlang-questions] Building small erlang vm suitable for bundle with app. In-Reply-To: References: Message-ID: Hi Albin, Yes it's the right place :) What you are looking for is releases. You can create a release and include the erlang runtime system (erts) executables within it. You can also include any erlang app you have, like couchdb. For more information about that i suggest you take a look at : http://www.erlang.org/doc/design_principles/release_structure.html http://learnyousomeerlang.com/release-is-the-word On Thu, Dec 8, 2011 at 11:27 AM, Albin Stig? wrote: > Hi, > > I'm quite new to Erlang and this list so I hope I'm posting in the right > place? > > I would like to use Erlang code (couchdb) in an Mac OS X app I'm > developing and I would like to bundle it with my app. Exactly like the > Mac OS X version of Wings3D is bundling a version of erlang. > > I was wondering if someone kind provide me with some ideas of how to > compile a smaller version of the Erlang VM without the developing > tools etc? > > Cheers, > Albin > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > -- Best Regards, - Ahmed Omar http://nl.linkedin.com/in/adiaa Follow me on twitter @spawn_think -------------- next part -------------- An HTML attachment was scrubbed... URL: From joelr1@REDACTED Thu Dec 8 15:01:13 2011 From: joelr1@REDACTED (Joel Reymont) Date: Thu, 8 Dec 2011 15:01:13 +0100 Subject: [erlang-questions] ssl error when using ibrowse Message-ID: <934C03D39E6A4D1EAA8E72EB9ABE03BA@gmail.com> Does this ring a bell? SSL: connection: ./ssl_connection.erl:1646:Fatal error: illegal parameter All I'm doing is issuing a request to Amazon AWS with {is_ssl, true}. Thanks, Joel --- http://twitter.com/wagerlabs From chandrashekhar.mullaparthi@REDACTED Thu Dec 8 15:43:36 2011 From: chandrashekhar.mullaparthi@REDACTED (Chandru) Date: Thu, 8 Dec 2011 14:43:36 +0000 Subject: [erlang-questions] ssl error when using ibrowse In-Reply-To: <934C03D39E6A4D1EAA8E72EB9ABE03BA@gmail.com> References: <934C03D39E6A4D1EAA8E72EB9ABE03BA@gmail.com> Message-ID: Joel, Which version of Erlang/OTP? Chandru On 8 December 2011 14:01, Joel Reymont wrote: > Does this ring a bell? > > SSL: connection: ./ssl_connection.erl:1646:Fatal error: illegal parameter > > All I'm doing is issuing a request to Amazon AWS with {is_ssl, true}. > > Thanks, Joel > > --- > http://twitter.com/wagerlabs > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From dmkolesnikov@REDACTED Thu Dec 8 16:58:39 2011 From: dmkolesnikov@REDACTED (Dmitry Kolesnikov) Date: Thu, 8 Dec 2011 17:58:39 +0200 Subject: [erlang-questions] Building small erlang vm suitable for bundle with app. In-Reply-To: References: Message-ID: <56379D23-F0D3-433F-83EA-E6D316E6D383@gmail.com> Hi, Yes, release is the right thing. Just keep in mind that your release would contain platform dependent VM. If you create it on mac then you cannot run it on Linux. Thus you would need to run Linux in VirtualBox on your Mac to assemble a distributable releases. On 8.12.2011, at 12.55, Ahmed Omar wrote: > Hi Albin, > Yes it's the right place :) > What you are looking for is releases. You can create a release and include the erlang runtime system (erts) executables within it. You can also include any erlang app you have, like couchdb. > > For more information about that i suggest you take a look at : > http://www.erlang.org/doc/design_principles/release_structure.html > http://learnyousomeerlang.com/release-is-the-word > > On Thu, Dec 8, 2011 at 11:27 AM, Albin Stig? wrote: > Hi, > > I'm quite new to Erlang and this list so I hope I'm posting in the right place? > > I would like to use Erlang code (couchdb) in an Mac OS X app I'm > developing and I would like to bundle it with my app. Exactly like the > Mac OS X version of Wings3D is bundling a version of erlang. > > I was wondering if someone kind provide me with some ideas of how to > compile a smaller version of the Erlang VM without the developing > tools etc? > > Cheers, > Albin > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > > > > -- > Best Regards, > - Ahmed Omar > http://nl.linkedin.com/in/adiaa > Follow me on twitter > @spawn_think > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions -------------- next part -------------- An HTML attachment was scrubbed... URL: From watson.timothy@REDACTED Thu Dec 8 18:04:19 2011 From: watson.timothy@REDACTED (Tim Watson) Date: Thu, 8 Dec 2011 17:04:19 +0000 Subject: [erlang-questions] Building small erlang vm suitable for bundle with app. In-Reply-To: <56379D23-F0D3-433F-83EA-E6D316E6D383@gmail.com> References: <56379D23-F0D3-433F-83EA-E6D316E6D383@gmail.com> Message-ID: We do something similar to build parallel OTP for different architectures, although our packaging system assembles the release for the system you run it on, and then overwrites any native artefacts of the VM (i.e., shared object files and headers) for the target OS/architecture if required. This seems to work fine, although it's worth baring in mind that some releases include other stuff besides erts that is platform dependant. On 8 December 2011 15:58, Dmitry Kolesnikov wrote: > Hi, > > Yes, release is the right thing. > Just keep in mind that your release would contain platform dependent VM. > If you create it on mac then you cannot run it on Linux. Thus you would > need to run Linux in VirtualBox on your Mac to assemble a distributable > releases. > > > On 8.12.2011, at 12.55, Ahmed Omar wrote: > > Hi Albin, > Yes it's the right place :) > What you are looking for is releases. You can create a release and include > the erlang runtime system (erts) executables within it. You can also > include any erlang app you have, like couchdb. > > For more information about that i suggest you take a look at : > > http://www.erlang.org/doc/design_principles/release_structure.html > > http://learnyousomeerlang.com/release-is-the-word > > On Thu, Dec 8, 2011 at 11:27 AM, Albin Stig? < > albin.stigo@REDACTED> wrote: > >> Hi, >> >> I'm quite new to Erlang and this list so I hope I'm posting in the right >> place? >> >> I would like to use Erlang code (couchdb) in an Mac OS X app I'm >> developing and I would like to bundle it with my app. Exactly like the >> Mac OS X version of Wings3D is bundling a version of erlang. >> >> I was wondering if someone kind provide me with some ideas of how to >> compile a smaller version of the Erlang VM without the developing >> tools etc? >> >> Cheers, >> Albin >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> >> http://erlang.org/mailman/listinfo/erlang-questions >> > > > > -- > Best Regards, > - Ahmed Omar > http://nl.linkedin.com/in/adiaa > Follow me on twitter > @spawn_think > > _______________________________________________ > 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 dmkolesnikov@REDACTED Thu Dec 8 19:15:43 2011 From: dmkolesnikov@REDACTED (dmitry kolesnikov) Date: Thu, 8 Dec 2011 20:15:43 +0200 Subject: [erlang-questions] inet:getstat() for SslSocket Message-ID: Hello, Are there any method to gather ssl socket statistic similar to inet:getstat()? or retrive/map SslSocket into original TCP/IP one? - Dmitry -------------- next part -------------- An HTML attachment was scrubbed... URL: From b.nicholson@REDACTED Thu Dec 8 21:48:59 2011 From: b.nicholson@REDACTED (Barry Nicholson) Date: Thu, 08 Dec 2011 14:48:59 -0600 Subject: [erlang-questions] ssl error when using ibrowse In-Reply-To: <934C03D39E6A4D1EAA8E72EB9ABE03BA@gmail.com> References: <934C03D39E6A4D1EAA8E72EB9ABE03BA@gmail.com> Message-ID: <4EE122BB.6090803@niceng.com> Joel: Do you have any example code? No bells are ringing right now. Thanks Barry On 12/8/11 8:01 AM, Joel Reymont wrote: > Does this ring a bell? > > SSL: connection: ./ssl_connection.erl:1646:Fatal error: illegal parameter > > All I'm doing is issuing a request to Amazon AWS with {is_ssl, true}. > > Thanks, Joel > > --- > http://twitter.com/wagerlabs > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions From spawn.think@REDACTED Thu Dec 8 22:32:06 2011 From: spawn.think@REDACTED (Ahmed Omar) Date: Thu, 8 Dec 2011 22:32:06 +0100 Subject: [erlang-questions] [ANN] Join us for the 1st ErlanG+ Hangout With Joe Armstrong In-Reply-To: References: Message-ID: If you missed the hangout, you can still watch the recording! http://livestre.am/1au6K On Mon, Dec 5, 2011 at 12:47 PM, Ahmed Omar wrote: > Sorry for the typo, Thursday 8th December 2011 > > > On Mon, Dec 5, 2011 at 11:20 AM, Ahmed Omar wrote: > >> Date : Thursday, 7th December 2011 >> Time : 7 PM (GMT) >> It's FREE, Just +1 the post and we will be expecting yo >> https://plus.google.com/108730584872406072872/posts/LcxLf5JeFxK >> >> Erlang on Google+ >> http://gplus.to/Erlang >> -- >> Best Regards, >> - Ahmed Omar >> http://nl.linkedin.com/in/adiaa >> Follow me on twitter >> @spawn_think >> >> > > > -- > Best Regards, > - Ahmed Omar > http://nl.linkedin.com/in/adiaa > Follow me on twitter > @spawn_think > > -- Best Regards, - Ahmed Omar http://nl.linkedin.com/in/adiaa Follow me on twitter @spawn_think -------------- next part -------------- An HTML attachment was scrubbed... URL: From smith.winston.101@REDACTED Fri Dec 9 00:22:41 2011 From: smith.winston.101@REDACTED (Winston Smith) Date: Thu, 8 Dec 2011 18:22:41 -0500 Subject: [erlang-questions] Enabling HiPE for ARMv7 (armv7l) ? Message-ID: Building R14B04 on an ARMv7 (ARM Cortex A8 I think) works fine, but HiPE is not enabled. ?It seems that in $ERL_TOP/erts/configure there's a case statement (around line 5258 in R14B04) that checks the CPU type which it gets from ac_cv_host which comes from config.sub. ?However, the case statement only seems to support ARMv5: case $chk_arch_ in ? ?sun4u) ? ? ?ARCH=ultrasparc;; ? ?sparc64) ? ?ARCH=sparc64;; ? ?sun4v) ? ? ?ARCH=ultrasparc;; ? ?i86pc) ? ? ?ARCH=x86;; ? ?i386) ? ? ? ARCH=x86;; ? ?i486) ? ? ? ARCH=x86;; ? ?i586) ? ? ? ARCH=x86;; ? ?i686) ? ? ? ARCH=x86;; ? ?x86_64) ? ? ARCH=amd64;; ? ?amd64) ? ? ?ARCH=amd64;; ? ?macppc) ? ? ARCH=ppc;; ? ?ppc) ? ? ? ?ARCH=ppc;; ? ?ppc64) ? ? ?ARCH=ppc64;; ? ?"Power Macintosh") ?ARCH=ppc;; ? ?armv5b) ? ? ARCH=arm;; ? ?armv5teb) ? ARCH=arm;; ? ?armv5tel) ? ARCH=arm;; ? ?tile) ? ? ? ARCH=tile;; ? ?*) ? ? ? ? ?ARCH=noarch;; esac The output of uname -m is: armv7l Later, HiPE gets enabled (or disabled) in the following construct: ? ? ? ?case "$ARCH-$OPSYS" in ? ? ? ? ? ?x86-linux|amd64-linux|x86-darwin*|amd64-darwin*|ppc-linux|ppc64-linux|ppc-darwin|arm-linux|amd64-freebsd|x86-freebsd|x86-sol2|amd64-sol2|ultrasparc-linux) ? ? ? ? ? ? ? ?enable_hipe=yes ? ? ? ? ? ? ? ?;; Is this just an omission on the case $chk_arch statement? ?Or is the HiPE support for ARM truly limited to ARMv5; if so, what is the reason/what needs to be done to support ARMv7? Thanks in advance! W. From avinash@REDACTED Fri Dec 9 05:41:10 2011 From: avinash@REDACTED (Avinash Dhumane) Date: Fri, 9 Dec 2011 10:11:10 +0530 Subject: [erlang-questions] OPL on Erlang (Was earlier "RE:Best practices in gen_fsm usage") In-Reply-To: <4EDFE812.4000604@gmail.com> References: <33151719-9161-4a9e-aafc-61471a629cac@knuth> <01F34AC4-97BF-43C8-9D12-CA47B791DF94@feuerlabs.com> <4EDFE812.4000604@gmail.com> Message-ID: <001e01ccb62c$c88e3180$59aa9480$@com> >>>> From: erlang-questions-bounces@REDACTED [mailto:erlang-questions-bounces@REDACTED] On Behalf Of Torben Hoffmann I think that Object Process Methodology (used lightly) and Message Sequence Charts are better ways of structuring your high level thoughts. >>>> Hi Torben, Found a reflection of my voice in you! I am contemplating to compile a specification of what a system is and does as stated using OPM/OPL, into (and run on) an Erlang AOS (Application Operating System, as Joe puts it!). There is some "impedance" mismatch between the "symbols" (ideas) of OPL and Erlang, though in spirit, I (want to) believe that Erlang AOS is a perfect (i.e. isomorphic) vehicle for materializing a "OPL system". To give some examples: 1) A "process" of OPM is not an "Erlang process" - well, yes & no! 2) Moreover, an "OPM object" needs to find an expression in "Erlang process" - again, yes & no! 3) OPM maintains the duality of "objects and processes", whereas Erlang wants to see every_thing_ as a "process". 4) For OPM, "objects" are the things that are shaped and take shape, and "processes" are the things that shape the objects - i.e. "shape" is both a verb and noun. In Erlang, what gets shaped is also a process, and what shapes is obviously a process. 5) I am not confident enough to say something on "state" in OPM and "state" in Erlang. My present view of world is as shown (& determined) by classic C with Unix-IPC. I don't know other worlds. I haven't made much of progress in Erlang AOS either, beyond few readings of Joe's thesis paper. I am currently stuck on integrating the spirit of OPM/OPL and spirit of Erlang AOS. Is there some work going around in OPM and Erlang that can help me unlock spiritually? Or, may I receive some help from you on how you materialize a OPM-thought system into an Erlang system? Some directions are good enough - I know otherwise this is a topic of a full volume. Thank you Kind regards Avinash -------------- next part -------------- An HTML attachment was scrubbed... URL: From chandrashekhar.mullaparthi@REDACTED Fri Dec 9 07:34:14 2011 From: chandrashekhar.mullaparthi@REDACTED (Chandru) Date: Fri, 9 Dec 2011 06:34:14 +0000 Subject: [erlang-questions] ssl error when using ibrowse In-Reply-To: <934C03D39E6A4D1EAA8E72EB9ABE03BA@gmail.com> References: <934C03D39E6A4D1EAA8E72EB9ABE03BA@gmail.com> Message-ID: Works for me with R14B04 9> ibrowse:send_req("https://aws.amazon.com", [], get, [], [{is_ssl, true}, {ssl_options, []}]). {ok,"200", [{"Date","Fri, 09 Dec 2011 06:33:22 GMT"}, {"Server","Server"}, {"x-amz-id-1","1VHDH8K71KTRESE80SZB"}, {"x-amz-id-2", "zO6F45ahRCxnfpm1PjJs5Pt0h1uJ2fY2XaekDN1MaCw="}, {"Cache-Control","max-age=0"}, {"Expires","Fri, 09 Dec 2011 06:33:22 GMT"}, {"Content-Type","text/html; charset=UTF-8"}, {"Set-cookie", "session-id-time=2082758401l; path=/; domain=.amazon.com; expires=Tue Jan 01 00:00:01 2036 GMT"}, {"Set-cookie", "session-id=184-9444067-7177623; path=/; domain=.amazon.com; expires=Tue Jan 01 00:00:01 2036 GMT"}, {"Vary","User-Agent"}, {"Transfer-Encoding","chunked"}], [10,10,32,32,60,33,68,79,67,84,89,80,69,32,72,84,77,76,32, 80,85,66,76,73,67|...]} cheers Chandru On 8 December 2011 14:01, Joel Reymont wrote: > Does this ring a bell? > > SSL: connection: ./ssl_connection.erl:1646:Fatal error: illegal parameter > > All I'm doing is issuing a request to Amazon AWS with {is_ssl, true}. > > Thanks, Joel > > --- > http://twitter.com/wagerlabs > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From joelr1@REDACTED Fri Dec 9 09:41:55 2011 From: joelr1@REDACTED (Joel Reymont) Date: Fri, 9 Dec 2011 09:41:55 +0100 Subject: [erlang-questions] can't make this shit up Message-ID: <-3191245770365971185@unknownmsgid> Spent some time trying to figure out the internal Erlang errors with SSL and ibrowse. Switched to lhttpc and spent a few hours trying to figure out the signature mismatch that Amazon was complaining about. Switched to httpc and everything started working. Can't make this shit up! P.S. This is in no way a complaint about ibrowse or lhttpc. I hold myself responsible. --- http://twitter.com/wagerlabs From ingela.andin@REDACTED Fri Dec 9 09:46:40 2011 From: ingela.andin@REDACTED (Ingela Andin) Date: Fri, 9 Dec 2011 09:46:40 +0100 Subject: [erlang-questions] inet:getstat() for SslSocket In-Reply-To: References: Message-ID: Hi! At the moment there are no API-functions to do that, I will put it on the todo list for future development (too late for R15B). Of course there are ways to retrive the tcp/ip-socket that could be used as a workaround (but that would be a hack). Regards Ingela Erlang/OTP team - Ericsson AB 2011/12/8, dmitry kolesnikov : > Hello, > > Are there any method to gather ssl socket statistic similar to > inet:getstat()? > or > retrive/map SslSocket into original TCP/IP one? > > > - Dmitry > From joelr1@REDACTED Fri Dec 9 09:51:19 2011 From: joelr1@REDACTED (Joel Reymont) Date: Fri, 9 Dec 2011 09:51:19 +0100 Subject: [erlang-questions] ssl_esock gone wild Message-ID: <-3215875437551849738@unknownmsgid> I seem to have multiple ssl_esock binaries running the CPU to 100%. This is R14B4. What could be the reason? --- http://twitter.com/wagerlabs From spawn.think@REDACTED Fri Dec 9 10:20:15 2011 From: spawn.think@REDACTED (Ahmed Omar) Date: Fri, 9 Dec 2011 10:20:15 +0100 Subject: [erlang-questions] ssl_esock gone wild In-Reply-To: <-3215875437551849738@unknownmsgid> References: <-3215875437551849738@unknownmsgid> Message-ID: Similar problems were reported before, it should be solved in R15 using the new ssl implementation http://groups.google.com/group/erlang-programming/browse_thread/thread/1bf9dd3d61abc865?pli=1 On Fri, Dec 9, 2011 at 9:51 AM, Joel Reymont wrote: > I seem to have multiple ssl_esock binaries running the CPU to 100%. > > This is R14B4. > > What could be the reason? > > --- > http://twitter.com/wagerlabs > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > -- Best Regards, - Ahmed Omar http://nl.linkedin.com/in/adiaa Follow me on twitter @spawn_think -------------- next part -------------- An HTML attachment was scrubbed... URL: From kenneth.lundin@REDACTED Fri Dec 9 10:47:55 2011 From: kenneth.lundin@REDACTED (Kenneth Lundin) Date: Fri, 9 Dec 2011 10:47:55 +0100 Subject: [erlang-questions] ssl_esock gone wild In-Reply-To: <-3215875437551849738@unknownmsgid> References: <-3215875437551849738@unknownmsgid> Message-ID: ssl_esock is used by the old ssl implementation which is not used by default in R14B04. We really don't recommend the use of old_ssl. In R15B the old ssl will be removed completely so the ssl_esock will not be part of the release anymore. /Kenneth, Erlang/OTP Ericsson On 12/9/11, Joel Reymont wrote: > I seem to have multiple ssl_esock binaries running the CPU to 100%. > > This is R14B4. > > What could be the reason? > > --- > http://twitter.com/wagerlabs > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > From bourinov@REDACTED Fri Dec 9 11:56:11 2011 From: bourinov@REDACTED (Max Bourinov) Date: Fri, 9 Dec 2011 13:56:11 +0300 Subject: [erlang-questions] can't make this shit up In-Reply-To: <-3191245770365971185@unknownmsgid> References: <-3191245770365971185@unknownmsgid> Message-ID: Hi Joel, The same story we have some while ago. httpc does it's job very well and I don't see a reason to use ibrowse after all. Best regards, Max On Fri, Dec 9, 2011 at 11:41 AM, Joel Reymont wrote: > Spent some time trying to figure out the internal Erlang errors with > SSL and ibrowse. > > Switched to lhttpc and spent a few hours trying to figure out the > signature mismatch that Amazon was complaining about. > > Switched to httpc and everything started working. > > Can't make this shit up! > > P.S. This is in no way a complaint about ibrowse or lhttpc. I hold > myself responsible. > > --- > http://twitter.com/wagerlabs > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From watson.timothy@REDACTED Fri Dec 9 11:59:49 2011 From: watson.timothy@REDACTED (Tim Watson) Date: Fri, 9 Dec 2011 10:59:49 +0000 Subject: [erlang-questions] can't make this shit up In-Reply-To: References: <-3191245770365971185@unknownmsgid> Message-ID: On 9 December 2011 10:56, Max Bourinov wrote: > Hi Joel, > > The same story we have some while ago. httpc does it's job very well and I > don't see a reason to use ibrowse after all. > > The one thing that httpc doesn't do is allow https traffic through a proxy. This means that you can't, for example, use it to access github behind a corporate firewall. If this was fixed, I'd revert back to httpc. Given that ibrowse *does* allow this, I can't imagine that it's impossible to make it work in httpc. -------------- next part -------------- An HTML attachment was scrubbed... URL: From kenneth.lundin@REDACTED Fri Dec 9 12:09:56 2011 From: kenneth.lundin@REDACTED (Kenneth Lundin) Date: Fri, 9 Dec 2011 12:09:56 +0100 Subject: [erlang-questions] performance drop in R15A? In-Reply-To: <1789335.0VPehH53Ub@csr-pc40.zib.de> References: <1359554.YeRYZETzs8@csr-pc40.zib.de> <2086353.lGPuiOpM5q@csr-pc40.zib.de> <4458388.uS11NqXNlV@csr-pc40.zib.de> <1789335.0VPehH53Ub@csr-pc40.zib.de> Message-ID: On 12/5/11, Nico Kruber wrote: > Is there any news on this? > > The performance drop of the recent R15 checkout compared to R14B04 in our > application is now at _30%_ compared to a drop of "only" 15% in R15A! > When working with R15B we are of course performing a number of bencmarks to keep track of the performance. Whe always strive to improve general performance in each release AND OUR BENCHMARKS INDICATE THAT R15B IS FASTER IN GENERAL THAN R14B04. It is however always possible that some specific operations or combinations of operations get slower while others are optimized. Regarding the findings for this particular application we think the reason for slowdown is a very frequent but non typical usage pattern that now becomes visible as a performance bottleneck. / Kenneth, Erlang/OTP Ericsson > > Nico > > > On Friday 02 December 2011 11:26:56 Nico Kruber wrote: >> Tonight, I ran the tests with an erlang checkout from around 16:00 >> yesterday >> (erlang-otp-OTP_R15A-126-g0290bed.tar.gz). >> This includes the fix Bj?rn-Egil was referring to, >> i.e. 'rickard/pix-mutex/OTP-9723'. >> >> >> Following are the results or our "make bench" of Scalaris: >> >> ** transactions/s , i.e. "wall clock throughput : xxx" ** >> R14B04: ~950, R15A (ge21ff9b): ~800, R15A (g0290bed): ~635 >> >> ** latency, i.e. "wall clock avg. latency: xxx ms" **: >> R14B04: ~42ms, R15A (ge21ff9b): ~50ms, R15A (g0290bed): ~60ms >> >> >> Note: This "make bench" command sets up a Scalaris ring consisting of 4 >> nodes, each in a single VM. They all communicate through tcp. >> >> >> Additionally, we also measure our performance through our Java-API which >> accesses Erlang via JInterface using >> "SCALARIS_BENCHMARKS="100 6 9 15 18" make java-bench" >> >> ** number of transactions per second for "Benchmark incrementing an >> integer key (read+write):" >> R14B04: ~310, R15A (ge21ff9b): ~200, R15A (g0290bed): ~140 >> >> >> I saw some new bug fixes for the scheduler in the recent commits, but with >> the checkout from 6971b96 (just now), the results are still the same as >> with g0290bed :( >> >> >> >> Regards, >> Nico >> >> On Wednesday 30 November 2011 17:05:29 Nico Kruber wrote: >> > thank you >> > We'll try again tomorrow >> > >> > Nico >> > >> > On Wednesday 30 November 2011 16:30:05 Lukas Larsson wrote: >> > > Hello! >> > > >> > > I was able to verify you findings on my machine for R14B04 and R15A. >> > > The problem is however fixed (I even get a 15% throughput >> > > improvement on your >> > > bench) in our latest internal master which will be pushed to github >> > > later >> > > this evening. So if you could pull the latest from github tomorrow >> > > and >> > > verify my findings that would be great! >> > > >> > > Lukas >> > > >> > > On Wed, Nov 30, 2011 at 11:36 AM, Nico Kruber wrote: >> > > > Is it possible, that some debug option is on by default in the >> > > > R15A >> > > > tagged git >> > > > checkout? >> > > > We build the source using the following commands (on a x86_64 >> > > > system >> > > > with 8 cores): >> > > > >> > > > ./otp_build autoconf >> > > > ./configure --prefix=/home/buildbot/apps/erlang-R15A >> > > > make >> > > > make install >> > > > >> > > > and then compiled our application >> > > > (http://code.google.com/p/scalaris/) >> > > > using >> > > > R15A. >> > > > >> > > > With our internal benchmarks ("make bench") showed a drop of >> > > > around >> > > > 15% >> > > > in performance compared to R14B04. We were actually hoping for >> > > > an >> > > > increased performance reading about the memory allocation >> > > > improvements... >> > > > >> > > > Is there some switch (during configuration or build) influencing >> > > > the >> > > > performance? >> > > > >> > > > output of R14B04 erl: >> > > > ------------------------------------------------------------ >> > > > Erlang R14B04 (erts-5.8.5) [source] [64-bit] [smp:8:8] [rq:8] >> > > > [async- >> > > > threads:0] [hipe] [kernel-poll:false] >> > > > >> > > > Eshell V5.8.5 (abort with ^G) >> > > > 1> >> > > > ------------------------------------------------------------ >> > > > >> > > > output of R15A erl: >> > > > ------------------------------------------------------------ >> > > > Erlang R15A (erts-5.9.pre) [source] [64-bit] [smp:8:8] [rq:8] >> > > > [async- >> > > > threads:0] [hipe] [kernel-poll:false] >> > > > >> > > > Eshell V5.9.pre (abort with ^G) >> > > > 1> >> > > > ------------------------------------------------------------ >> > > > >> > > > >> > > > Regards >> > > > Nico Kruber From ingela.andin@REDACTED Fri Dec 9 12:15:57 2011 From: ingela.andin@REDACTED (Ingela Andin) Date: Fri, 9 Dec 2011 12:15:57 +0100 Subject: [erlang-questions] can't make this shit up In-Reply-To: References: <-3191245770365971185@unknownmsgid> Message-ID: Hi! It is on the todo list for httpc. It is only a question of priorities. If sombody would like it faster than we can manage to get it on the top of our priority-list feel free to contribute. Regards Ingela Erlang/OTP team - Ericsson AB 2011/12/9, Tim Watson : > On 9 December 2011 10:56, Max Bourinov wrote: > >> Hi Joel, >> >> The same story we have some while ago. httpc does it's job very well and I >> don't see a reason to use ibrowse after all. >> >> > The one thing that httpc doesn't do is allow https traffic through a proxy. > This means that you can't, for example, use it to access github behind a > corporate firewall. If this was fixed, I'd revert back to httpc. Given that > ibrowse *does* allow this, I can't imagine that it's impossible to make it > work in httpc. > From dmkolesnikov@REDACTED Fri Dec 9 13:26:22 2011 From: dmkolesnikov@REDACTED (dmitry kolesnikov) Date: Fri, 9 Dec 2011 14:26:22 +0200 Subject: [erlang-questions] inet:getstat() for SslSocket In-Reply-To: References: Message-ID: Hello, Thank you for response! I see... R15B sounds good, thanks for that! In mean while hack might be acceptable. I have been trying to find internal API how to map SslSocket to TCP/IP but did not succeed. Any hints? Best Regards, Dmitry On Fri, Dec 9, 2011 at 10:46 AM, Ingela Andin wrote: > Hi! > > At the moment there are no API-functions to do that, I will put it on > the todo list for future development (too late for R15B). Of course > there are ways to retrive the tcp/ip-socket that could be used as a > workaround (but that would be a hack). > > Regards Ingela Erlang/OTP team - Ericsson AB > > 2011/12/8, dmitry kolesnikov : > > Hello, > > > > Are there any method to gather ssl socket statistic similar to > > inet:getstat()? > > or > > retrive/map SslSocket into original TCP/IP one? > > > > > > - Dmitry > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From joelr1@REDACTED Fri Dec 9 14:24:37 2011 From: joelr1@REDACTED (Joel Reymont) Date: Fri, 9 Dec 2011 14:24:37 +0100 Subject: [erlang-questions] snmp wrapper for folsom Message-ID: <8644101596B14B979630F2E0625CD0AF@gmail.com> Has anyone written a SNMP wrapper for Folsom or knows of such a beast? Thanks, Joel --- Hardcore Mac and Linux development http://www.linkedin.com/in/joelreymont Embedded, firmware and device drivers From ingela.andin@REDACTED Fri Dec 9 14:52:12 2011 From: ingela.andin@REDACTED (Ingela Andin) Date: Fri, 9 Dec 2011 14:52:12 +0100 Subject: [erlang-questions] inet:getstat() for SslSocket In-Reply-To: References: Message-ID: Hi! 2011/12/9, dmitry kolesnikov : > Hello, > > Thank you for response! > > I see... R15B sounds good, thanks for that! In mean while hack might be > acceptable. I said that it was to late for R15B we have already freezed the code for R15B, but proably for R15B-01 but no promises. > I have been trying to find internal API how to map SslSocket to TCP/IP but > did not succeed. > Any hints? I will send the hitnt to privatly. Regards Ingela Erlang/OTP team - Ericsson AB From smith.winston.101@REDACTED Fri Dec 9 14:56:32 2011 From: smith.winston.101@REDACTED (Winston Smith) Date: Fri, 9 Dec 2011 08:56:32 -0500 Subject: [erlang-questions] Enabling HiPE for ARMv7 (armv7l) ? In-Reply-To: <20193.53423.783899.49907@pilspetsen.it.uu.se> References: <20193.53423.783899.49907@pilspetsen.it.uu.se> Message-ID: On Fri, Dec 9, 2011 at 4:11 AM, Mikael Pettersson wrote: > HiPE's ARM support predates the existence of ARMv7 and even ARMv6 was not > wide-spread at the time -- I've only recently been able to acquire post-v5 > hardware decent(*) enough to use as a development and build machine. > > The ARMv5 code we use in the runtime system or generate from the compiler > should work as-is on v7, with the following caveats: > - big-endian won't work and I have no plans of making it work, the fault > ?for that lies on ARM who changed their big-endian mode to be, well, > ?obscenely backwards (remember FPA and its endianess issues?) > - only softfloat is supported, hard VFP or Neon instructions aren't generated > - only ARM is supported, Thumb-1 or Thumb-2 instructions aren't generated > ?(given that HiPE is about performance, that's entirely reasonable IMO) > - v6/v7 additions to the ARM ISA aren't utilized, I'm thinking in particular > ?about the "load large immediate" instructions that v6 added > > In theory I think that adding "armv7l" (or however the Linux kernel announces > v7-a profile processors) to erts/configure{.in,} should just work. I did add this and I was in fact able to build Erlang with HiPE enabled for ARMv7. I tried compiling a module as follows: c(mytest, [native, {hipe, verbose}]). It printed out the right stuff and I was able to run the code (although I don't know if actually ran the native code, or just the regular beam bytecode). As an aside, I did have some problems with cross compiling this though for a different, [smaller] A8 board. It failed at the points where it wants to generate the hipe_literals.h for plain/smp and the hipe_literals.hrl; as you know, it creates versions of executable hipe_mkliterals that it invokes to generate these files. Of course in a cross compilation environment, this doesn't work as it needs to run hipe_mkliterals on the target (host), not the build system. Fortunately, it was easy enough to copy hipe_mkliterals to the target board, invoke it and copy back the resulting hipe_literals.{h|hrl} files into place and restart the build each time it failed this way. I don't know how you can automate this for a cross compile (perhaps with scp/ssh). Thanks for the info! W. From ingela.andin@REDACTED Fri Dec 9 15:05:35 2011 From: ingela.andin@REDACTED (Ingela Andin) Date: Fri, 9 Dec 2011 15:05:35 +0100 Subject: [erlang-questions] ODBC to Erlang data mapping problem on OS X In-Reply-To: References: Message-ID: Hi! Sound like a problem in the odbc-driver (if I remember correctly iodbc is the name of the most common driver on MAC) sql_wvarchar is defined to be Unicode encoded as UTF16 little endian. Regards Ingela Erlang/OTP team - Ericsson AB 2011/12/1, Chad Phillips -- Apartment Lines : > According to http://www.erlang.org/doc/apps/odbc/databases.html#type, the > SQL_WVARCHAR ODBC data type should be translated by Erlang's ODBC driver to > "Unicode binary encoded as UTF16 little endian." > > This works as expected on Linux, but I'm having issues on OS X, where it > appears it's getting translated to UTF32 little endian, instead of UTF16 > little endian. > > I'm using Erlang R14B04 on both machines, with the exact same database > table, does anybody have an idea why this might be occurring, and how to > remedy it? > > Additional info below for those interested. > > Thanks! > > Chad > > TABLE ON BOTH ARCHITECTURES: > > CREATE TABLE `foo` ( > `bar` varchar(255) NOT NULL > ) ENGINE=InnoDB DEFAULT CHARSET=utf8; > > > LINUX ERLANG SESSION: > > (alaem@REDACTED)1> odbc:start(). > ok > (alaem@REDACTED)2> {ok, Ref} = odbc:connect("DSN=testing;Option=3", []). > {ok,<0.90.0>} > (alaem@REDACTED)3> odbc:describe_table(Ref, "foo"). > {ok,[{"bar",{sql_wvarchar,255}}]} > (alaem@REDACTED)4> odbc:select_count(Ref, "SELECT * FROM foo"). > {ok,1} > (alaem@REDACTED)5> {selected, Columns, [{Bar}]} = odbc:next(Ref). > {selected,["bar"],[{<<98,0,97,0,122,0>>}]} > (alaem@REDACTED)6> unicode:characters_to_list(Bar, {utf16, little}). > "baz" > (alaem@REDACTED)7> unicode:characters_to_list(Bar, {utf32, little}). > {error,[],<<98,0,97,0,122,0>>} > > OS X ERLANG SESSION: > > (alaem@REDACTED)1> odbc:start(). > ok > (alaem@REDACTED)2> {ok, Ref} = odbc:connect("DSN=testing;Option=3", []). > {ok,<0.90.0>} > (alaem@REDACTED)3> odbc:describe_table(Ref, "foo"). > {ok,[{"bar",{sql_wvarchar,255}}]} > (alaem@REDACTED)4> odbc:select_count(Ref, "SELECT * FROM foo"). > {ok,1} > (alaem@REDACTED)5> {selected, Columns, [{Bar}]} = odbc:next(Ref). > {selected,["bar"],[{<<98,0,0,0,97,0,0,0,122,0,0,0>>}]} > (alaem@REDACTED)6> unicode:characters_to_list(Bar, {utf16, little}). > [98,0,97,0,122,0] > (alaem@REDACTED)7> unicode:characters_to_list(Bar, {utf32, little}). > "baz" > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > From tomas.abrahamsson@REDACTED Fri Dec 9 16:01:38 2011 From: tomas.abrahamsson@REDACTED (Tomas Abrahamsson) Date: Fri, 9 Dec 2011 16:01:38 +0100 Subject: [erlang-questions] performance drop in R15A? In-Reply-To: (Kenneth Lundin's message of "Fri, 9 Dec 2011 12:09:56 +0100") References: <1359554.YeRYZETzs8@csr-pc40.zib.de> <2086353.lGPuiOpM5q@csr-pc40.zib.de> <4458388.uS11NqXNlV@csr-pc40.zib.de> <1789335.0VPehH53Ub@csr-pc40.zib.de> Message-ID: Nico Kruber wrote: NK>>>>>> With our internal benchmarks ("make bench") showed a drop of NK>>>>>> around 15% in performance compared to R14B04. [...] NK>> The performance drop of the recent R15 checkout compared to R14B04 in our NK>> application is now at _30%_ compared to a drop of "only" 15% in R15A! Kenneth Lundin wrote: KL> When working with R15B we are of course performing a number of KL> bencmarks to keep track of the performance. KL> KL> Whe always strive to improve general performance in each release AND KL> OUR BENCHMARKS INDICATE THAT R15B IS FASTER IN GENERAL THAN R14B04. KL> KL> It is however always possible that some specific operations or KL> combinations of operations get slower while others are optimized. Hi, we're currently prototyping an simulator for mobile telephony. Performance is one of our main goals, so we've been measuring with both R14B04, R15A.pre and with OTP from github. We, too, have seen a performance drop similar to what Nico has observed, although not as drastic. We try to start a number of UEs, each UE is a few processes passing a sequence of messages back and forth, then we measure how many UEs a certain machine can handle, given a fixed rate of how often they sould pass the messages. This is what we've seen (higher number means better performance): - R14B04: 12200 - R15A.pre: 11800 (== git rev e21ff9b) - git rev 6971b96: 11500 The workload for the processes consists of NAS TLV encoding and decoding (bit/binary manipulations), a fair bit of ASN.1 encoding and decoding, and some ciphering/deciphering using the crypto lib. KL> Regarding the findings for this particular application we think the KL> reason for slowdown is a very frequent but non typical usage pattern KL> that now becomes visible as a performance bottleneck. It might well be that our usage pattern, is a bit away from normal (currently, we hope so, but we fear it might not be!) We'll arrange to send the source code for our benchmark off-list, in case you would want to repeat it. BRs Tomas From dan@REDACTED Fri Dec 9 17:39:54 2011 From: dan@REDACTED (Daniel Dormont) Date: Fri, 9 Dec 2011 11:39:54 -0500 Subject: [erlang-questions] "Can't set long node name" on Ubuntu using erl -name without suffix Message-ID: Hi everyone, I am just now starting to get into using long node names in my Erlang setup, running R14B02 on Ubuntu 11.10. Due to the way some of the internal scripts for Ejabberd are written, it would be convenient if I can start nodes using 'erl -name foo' without having to put anything after the @ sign. On some of my machines this works fine, but on others I get the error: {error_logger,{{2011,12,9},{11,38,2}},"Can't set long node name!\nPlease check your configuration\n",[]} What does this mean and what can I do about it? Dan From comptekki@REDACTED Fri Dec 9 17:53:43 2011 From: comptekki@REDACTED (Wes James) Date: Fri, 9 Dec 2011 09:53:43 -0700 Subject: [erlang-questions] "Can't set long node name" on Ubuntu using erl -name without suffix In-Reply-To: References: Message-ID: On Fri, Dec 9, 2011 at 9:39 AM, Daniel Dormont wrote: > Hi everyone, > > I am just now starting to get into using long node names in my Erlang > setup, running R14B02 on Ubuntu 11.10. Due to the way some of the > internal scripts for Ejabberd are written, it would be convenient if I > can start nodes using 'erl -name foo' without having to put anything > after the @ sign. On some of my machines this works fine, but on > others I get the error: > You will need to use -sname with that short name and the nodes will only be available on the same subnet. -name requires the full node@REDACTED -wes From dan@REDACTED Fri Dec 9 18:56:46 2011 From: dan@REDACTED (Daniel Dormont) Date: Fri, 9 Dec 2011 12:56:46 -0500 Subject: [erlang-questions] "Can't set long node name" on Ubuntu using erl -name without suffix In-Reply-To: References: Message-ID: On Fri, Dec 9, 2011 at 11:53 AM, Wes James wrote: > On Fri, Dec 9, 2011 at 9:39 AM, Daniel Dormont wrote: >> Hi everyone, >> >> I am just now starting to get into using long node names in my Erlang >> setup, running R14B02 on Ubuntu 11.10. Due to the way some of the >> internal scripts for Ejabberd are written, it would be convenient if I >> can start nodes using 'erl -name foo' without having to put anything >> after the @ sign. On some of my machines this works fine, but on >> others I get the error: >> > > You will need to use -sname with that short name and the nodes will > only be available on the same subnet. > > -name requires the full node@REDACTED > Perhaps it's an unexpected or undocumented feature, but this is not true. For example, on one of my Amazon EC2 machines just now I ran 'erl -name foo' and got the following: Erlang R13B03 (erts-5.7.4) [source] [64-bit] [rq:1] [async-threads:0] [hipe] [kernel-poll:false] Eshell V5.7.4 (abort with ^G) (foo@REDACTED)1> no issues. > -wes From dan@REDACTED Fri Dec 9 20:08:26 2011 From: dan@REDACTED (Daniel Dormont) Date: Fri, 9 Dec 2011 14:08:26 -0500 Subject: [erlang-questions] "Can't set long node name" on Ubuntu using erl -name without suffix In-Reply-To: References: Message-ID: A little more experimentation revealed that the problem was that the system returned no FQDN for itself, as indicated for example by 'hostname -f'. A little /etc/hosts manipulation fixed that, and all was well. dan On Fri, Dec 9, 2011 at 12:56 PM, Daniel Dormont wrote: > On Fri, Dec 9, 2011 at 11:53 AM, Wes James wrote: >> On Fri, Dec 9, 2011 at 9:39 AM, Daniel Dormont wrote: >>> Hi everyone, >>> >>> I am just now starting to get into using long node names in my Erlang >>> setup, running R14B02 on Ubuntu 11.10. Due to the way some of the >>> internal scripts for Ejabberd are written, it would be convenient if I >>> can start nodes using 'erl -name foo' without having to put anything >>> after the @ sign. On some of my machines this works fine, but on >>> others I get the error: >>> >> >> You will need to use -sname with that short name and the nodes will >> only be available on the same subnet. >> >> -name requires the full node@REDACTED >> > > Perhaps it's an unexpected or undocumented feature, but this is not > true. For example, on one of my Amazon EC2 machines just now I ran > 'erl -name foo' and got the following: > > Erlang R13B03 (erts-5.7.4) [source] [64-bit] [rq:1] [async-threads:0] > [hipe] [kernel-poll:false] > > Eshell V5.7.4 ?(abort with ^G) > (foo@REDACTED)1> > > no issues. > >> -wes From comptekki@REDACTED Fri Dec 9 21:37:07 2011 From: comptekki@REDACTED (Wes James) Date: Fri, 9 Dec 2011 13:37:07 -0700 Subject: [erlang-questions] [ANN] Erlang Computer Systems Management CONSole (or ECSMCons) Message-ID: I would like to announce ECSMCons. Why was this developed? I have used other systems management suites to help manage a student computer lab, but the experience was very disappointing. One day I was contemplating the message passing capabilities of Erlang and thought, what if I had a web interface that talked to an Erlang back-end via web sockets to send messages to the workstations to do things. ECSMCons is a result of this. The following is from the top of the README at the github.com repo: -------------------------------------------------------------------------------------------- Erlang Computer Systems Management CONSole (or ECSMCons) Version 1.0 ECSMCons is an Erlang based client/server computer systems management console in which a web browser (with websockets support) is used to manage computer systems. Features: Server Operations that can be performed on the client from the server: Reboot, shutdown, restart or stop erlang service, ping, wake-on-lan, when Faronics Deep Freeze is available: freeze, thaw and get status copy file to client and run command on client. When the All command check box is selected, then only the checked workstations will have that command done on them. Restrict access based on IP address and username/password (both configurable in ecsmcons.conf). Client The client periodically sends messages to the server to indicate whether the system is "Up" and which user is logged in. It also does the command processing sent from the server. -------------------------------------------------------------------------------------------- For more details the project can be found here: https://github.com/comptekki/ecsmcons Thanks, -wes From corticalcomputer@REDACTED Fri Dec 9 22:13:11 2011 From: corticalcomputer@REDACTED (G.S.) Date: Fri, 9 Dec 2011 16:13:11 -0500 Subject: [erlang-questions] Is the Pteracuda project dead? Message-ID: Hello, I'm finally returning back to the use of Pteracuda for vector multiplication. But have been unable to get a hold of anyone using it. Does anyone know if the Pteracuda project by Kevin Smith has bee abandoned? Has anyone started using it (No one seemed to use it half a year ago, has anyone started?). The GitHub for Pteracuda does not seem to have been updated in a while... Regards, -Gene -------------- next part -------------- An HTML attachment was scrubbed... URL: From kevin@REDACTED Fri Dec 9 23:39:39 2011 From: kevin@REDACTED (Kevin Smith) Date: Fri, 9 Dec 2011 17:39:39 -0500 Subject: [erlang-questions] Is the Pteracuda project dead? In-Reply-To: References: Message-ID: It was meant as a proof of concept to illustrate what was possible w/CUDA and Erlang. I've changed jobs since that presentation and haven't had enough spare time to resume development. --Kevin On Dec 9, 2011, at 4:13 PM, G.S. wrote: > Hello, > > I'm finally returning back to the use of Pteracuda for vector multiplication. But have been unable to get a hold of anyone using it. Does anyone know if the Pteracuda project by Kevin Smith has bee abandoned? Has anyone started using it (No one seemed to use it half a year ago, has anyone started?). The GitHub for Pteracuda does not seem to have been updated in a while... > > Regards, > -Gene > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions From torben.lehoff@REDACTED Fri Dec 9 23:42:39 2011 From: torben.lehoff@REDACTED (Torben Hoffmann) Date: Fri, 09 Dec 2011 23:42:39 +0100 Subject: [erlang-questions] OPL on Erlang (Was earlier "RE:Best practices in gen_fsm usage") In-Reply-To: <001e01ccb62c$c88e3180$59aa9480$@com> References: <33151719-9161-4a9e-aafc-61471a629cac@knuth> <01F34AC4-97BF-43C8-9D12-CA47B791DF94@feuerlabs.com> <4EDFE812.4000604@gmail.com> <001e01ccb62c$c88e3180$59aa9480$@com> Message-ID: <4EE28EDF.9040503@gmail.com> Hi Avinash! On 9/12/11 5:41 , Avinash Dhumane wrote: > > >>>> > > *From:*erlang-questions-bounces@REDACTED > [mailto:erlang-questions-bounces@REDACTED] *On Behalf Of *Torben > Hoffmann > > I think that Object Process Methodology (used lightly) and Message > Sequence Charts are better ways of structuring your high level thoughts. > > >>>> > > Hi Torben, > > Found a reflection of my voice in you! > I had a hope that there was life out there... ;-) > > I am contemplating to compile a specification of what a system is and > does as stated using OPM/OPL, into (and run on) an Erlang AOS > (Application Operating System, as Joe puts it!). > > There is some "impedance" mismatch between the "symbols" (ideas) of > OPL and Erlang, though in spirit, I (want to) believe that Erlang AOS > is a perfect (i.e. isomorphic) vehicle for materializing a "OPL system". > I concur - I think OPM/OPL's way of describing systems fits very with the way Joe refers to Erlang... the most object oriented language out there!! The major hurdle to get past when using OPM as an Erlanger is that processes in OPM does not map to the Erlang processes as you also state it. > > To give some examples: > > 1) A "process" of OPM is not an "Erlang process" -- well, yes & no! > > 2) Moreover, an "OPM object" needs to find an expression in "Erlang > process" -- again, yes & no! > > 3) OPM maintains the duality of "objects and processes", whereas > Erlang wants to see every_thing_ as a "process". > > 4) For OPM, "objects" are the things that are shaped and take shape, > and "processes" are the things that shape the objects -- i.e. "shape" > is both a verb and noun. In Erlang, what gets shaped is also a > process, and what shapes is obviously a process. > > 5) I am not confident enough to say something on "state" in OPM and > "state" in Erlang. > I am not 100% in agreement with the way you map things here. Let's start with "OPM object" which I think is best represented as an Erlang process - I seem to recall that Joe also uses this "mapping" when refering to Erlang as an object-oriented language. "OPM processes" are functions in Erlang - when there are no side-effects for an argument to a function then the "OPM process" consumes the object. With side-effects in play the "OPM process" merely affects the "OPM object". It might be that there is a lot of talk about that everything in Erlang is processes, but the functions are there too and they play a significant r?le regardless of how you view the language. State - in my interpretation - maps almost directly how state of an Erlang process is handled. > > My present view of world is as shown (& determined) by classic C with > Unix-IPC. I don't know other worlds. I haven't made much of progress > in Erlang AOS either, beyond few readings of Joe's thesis paper. > Code a few programs and you will begin to see the world with different eyes... I promise!! > I am currently stuck on integrating the spirit of OPM/OPL and spirit > of Erlang AOS. > > Is there some work going around in OPM and Erlang that can help me > unlock spiritually? > Not that I am aware of - you could talk to Dov about it. I discussed a few things with him some years ago, but I did not have enough time on my hands to explore the topic further. > > Or, may I receive some help from you on how you materialize a > OPM-thought system into an Erlang system? Some directions are good > enough -- I know otherwise this is a topic of a full volume. > If you have a simple OPM example then you can send it to me on- or off-line and then I will outline how I would map it to Erlang following the general observations I made above. That exercise will be interesting. At the moment I am using a small subset of OPM to document the interactions between the entities of the systems I am developing. Just objects and processes since that is enough to convey the major points of the architecture - if I had to use UML or similar I would have to do at least two diagrams in order to get both some static and dynamic structure conveyed. But please fire away and then I will help you get some more Erlang semantics under your skin - I must guide aspiring Erlangers in order to keep my ordination as Erlang Priest ;-) Cheers, Torben > > Thank you > > Kind regards > > Avinash > > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions -------------- next part -------------- An HTML attachment was scrubbed... URL: From emeka_1978@REDACTED Sat Dec 10 00:35:31 2011 From: emeka_1978@REDACTED (eigenfunction) Date: Fri, 9 Dec 2011 15:35:31 -0800 (PST) Subject: [erlang-questions] [ANN] Join us for the 1st ErlanG+ Hangout With Joe Armstrong In-Reply-To: References: Message-ID: I missed it. That hangout was aaaaaaawesome. Its sad that to post a comment, you required to log in through facebook. I am not a facebook person. Anyway, i loved it. Thank you very much indeed. On Dec 8, 10:32?pm, Ahmed Omar wrote: > If you missed the hangout, you can still watch the recording!http://livestre.am/1au6K > > > > > > > > > > On Mon, Dec 5, 2011 at 12:47 PM, Ahmed Omar wrote: > > Sorry for the typo, Thursday 8th December 2011 > > > On Mon, Dec 5, 2011 at 11:20 AM, Ahmed Omar wrote: > > >> Date : Thursday, 7th December 2011 > >> Time : 7 PM (GMT) > >> It's FREE, Just +1 the post and we will be expecting yo > >>https://plus.google.com/108730584872406072872/posts/LcxLf5JeFxK > > >> Erlang on Google+ > >>http://gplus.to/Erlang > >> ?-- > >> Best Regards, > >> - Ahmed Omar > >>http://nl.linkedin.com/in/adiaa > >> Follow me on twitter > >> @spawn_think > > > -- > > Best Regards, > > - Ahmed Omar > >http://nl.linkedin.com/in/adiaa > > Follow me on twitter > > @spawn_think > > -- > Best Regards, > - Ahmed Omarhttp://nl.linkedin.com/in/adiaa > Follow me on twitter > @spawn_think > > _______________________________________________ > erlang-questions mailing list > erlang-questi...@REDACTED://erlang.org/mailman/listinfo/erlang-questions From per@REDACTED Sat Dec 10 00:45:35 2011 From: per@REDACTED (Per Hedeland) Date: Sat, 10 Dec 2011 00:45:35 +0100 (CET) Subject: [erlang-questions] "Can't set long node name" on Ubuntu using erl -name without suffix In-Reply-To: Message-ID: <201112092345.pB9NjZNP052103@pluto.hedeland.org> Daniel Dormont wrote: > >On Fri, Dec 9, 2011 at 11:53 AM, Wes James wrote: >> On Fri, Dec 9, 2011 at 9:39 AM, Daniel Dormont wrote: >>> Hi everyone, >>> >>> I am just now starting to get into using long node names in my Erlang >>> setup, running R14B02 on Ubuntu 11.10. Due to the way some of the >>> internal scripts for Ejabberd are written, it would be convenient if I >>> can start nodes using 'erl -name foo' without having to put anything >>> after the @ sign. On some of my machines this works fine, but on >>> others I get the error: >>> >> >> You will need to use -sname with that short name and the nodes will >> only be available on the same subnet. >> >> -name requires the full node@REDACTED >> > >Perhaps it's an unexpected or undocumented feature, but this is not >true. You are quite correct - actually the fact that you *can* give node@REDACTED to either of -name or -sname is an undocumented (and perhaps unexpected) feature.:-) Just Read The Fine erl(1) Man page, it is quite clear that you are supposed to give only the 'node' part, and that the runtime system is supposed to append the rest. But sometimes things don't work as they are supposed to (as in your case before you fixed it), in which case giving node@REDACTED can be a workaround. (And of course the 'foo' in 'erl -name foo' is neither long nor short, the length refers to the part *after* the '@'.) --Per Hedeland From spawn.think@REDACTED Sat Dec 10 01:28:31 2011 From: spawn.think@REDACTED (Ahmed Omar) Date: Sat, 10 Dec 2011 01:28:31 +0100 Subject: [erlang-questions] [ANN] Join us for the 1st ErlanG+ Hangout With Joe Armstrong In-Reply-To: References: Message-ID: Thanks for the feedback :) The video is also on Google+ now : https://plus.google.com/photos/108730584872406072872/albums/5684284170310829889 On Sat, Dec 10, 2011 at 12:35 AM, eigenfunction wrote: > I missed it. That hangout was aaaaaaawesome. Its sad that to post a > comment, you required to log in through facebook. I am not a facebook > person. Anyway, i loved it. Thank you very much indeed. > > On Dec 8, 10:32 pm, Ahmed Omar wrote: > > If you missed the hangout, you can still watch the recording! > http://livestre.am/1au6K > > > > > > > > > > > > > > > > > > > > On Mon, Dec 5, 2011 at 12:47 PM, Ahmed Omar > wrote: > > > Sorry for the typo, Thursday 8th December 2011 > > > > > On Mon, Dec 5, 2011 at 11:20 AM, Ahmed Omar > wrote: > > > > >> Date : Thursday, 7th December 2011 > > >> Time : 7 PM (GMT) > > >> It's FREE, Just +1 the post and we will be expecting yo > > >>https://plus.google.com/108730584872406072872/posts/LcxLf5JeFxK > > > > >> Erlang on Google+ > > >>http://gplus.to/Erlang > > >> -- > > >> Best Regards, > > >> - Ahmed Omar > > >>http://nl.linkedin.com/in/adiaa > > >> Follow me on twitter > > >> @spawn_think > > > > > -- > > > Best Regards, > > > - Ahmed Omar > > >http://nl.linkedin.com/in/adiaa > > > Follow me on twitter > > > @spawn_think > > > > -- > > Best Regards, > > - Ahmed Omarhttp://nl.linkedin.com/in/adiaa > > Follow me on twitter > > @spawn_think > > > > _______________________________________________ > > erlang-questions mailing list > > erlang-questi...@REDACTED:// > erlang.org/mailman/listinfo/erlang-questions > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > -- Best Regards, - Ahmed Omar http://nl.linkedin.com/in/adiaa Follow me on twitter @spawn_think -------------- next part -------------- An HTML attachment was scrubbed... URL: From kruber@REDACTED Sat Dec 10 02:23:28 2011 From: kruber@REDACTED (Nico Kruber) Date: Sat, 10 Dec 2011 02:23:28 +0100 Subject: [erlang-questions] "Can't set long node name" on Ubuntu using erl -name without suffix In-Reply-To: <201112092345.pB9NjZNP052103@pluto.hedeland.org> References: <201112092345.pB9NjZNP052103@pluto.hedeland.org> Message-ID: <82720311.d5XR0IZf0b@nico-pc> Just let me point out, that 'erl -name foo@REDACTED' or some other IP address of the server also works. This can sometimes be a good alternative to the hostname. Regards, Nico Kruber On Saturday 10 December 2011 00:45:35 Per Hedeland wrote: > Daniel Dormont wrote: > >On Fri, Dec 9, 2011 at 11:53 AM, Wes James wrote: > >> On Fri, Dec 9, 2011 at 9:39 AM, Daniel Dormont wrote: > >>> Hi everyone, > >>> > >>> I am just now starting to get into using long node names in my > >>> Erlang > >>> setup, running R14B02 on Ubuntu 11.10. Due to the way some of the > >>> internal scripts for Ejabberd are written, it would be convenient if > >>> I > >>> can start nodes using 'erl -name foo' without having to put anything > >>> after the @ sign. On some of my machines this works fine, but on > >> > >>> others I get the error: > >> You will need to use -sname with that short name and the nodes will > >> only be available on the same subnet. > >> > >> -name requires the full node@REDACTED > > > >Perhaps it's an unexpected or undocumented feature, but this is not > >true. > > You are quite correct - actually the fact that you *can* give node@REDACTED > to either of -name or -sname is an undocumented (and perhaps unexpected) > feature.:-) Just Read The Fine erl(1) Man page, it is quite clear that > you are supposed to give only the 'node' part, and that the runtime > system is supposed to append the rest. But sometimes things don't work > as they are supposed to (as in your case before you fixed it), in which > case giving node@REDACTED can be a workaround. > > (And of course the 'foo' in 'erl -name foo' is neither long nor short, > the length refers to the part *after* the '@'.) > > --Per Hedeland > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions -------------- 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 jozsef.berces@REDACTED Sat Dec 10 06:16:26 2011 From: jozsef.berces@REDACTED (=?iso-8859-1?Q?J=F3zsef_B=E9rces?=) Date: Sat, 10 Dec 2011 06:16:26 +0100 Subject: [erlang-questions] zip implode Message-ID: <3717CEF51B134A4F8073627839A9DF4120FCA35E87@ESESSCMS0353.eemea.ericsson.se> Hi, As I see the OTP built-in zip supports only deflated and stored content. Has anyone implemented zip extract for imploded content? Is there any idea how to do it easily? Thanks, Jozsef -------------- next part -------------- An HTML attachment was scrubbed... URL: From comptekki@REDACTED Sat Dec 10 06:30:15 2011 From: comptekki@REDACTED (Wes James) Date: Fri, 9 Dec 2011 22:30:15 -0700 Subject: [erlang-questions] zip implode In-Reply-To: <3717CEF51B134A4F8073627839A9DF4120FCA35E87@ESESSCMS0353.eemea.ericsson.se> References: <3717CEF51B134A4F8073627839A9DF4120FCA35E87@ESESSCMS0353.eemea.ericsson.se> Message-ID: Will unzip work that's here: http://www.erlang.org/doc/man/zip.html -wes On Fri, Dec 9, 2011 at 10:16 PM, J?zsef B?rces wrote: > Hi, > > As I see the OTP built-in zip supports only deflated and stored content. Has > anyone implemented zip extract for imploded content? Is there any idea how > to do it easily? > > Thanks, > Jozsef > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > From boris.muehmer@REDACTED Sat Dec 10 08:36:47 2011 From: boris.muehmer@REDACTED (=?UTF-8?Q?Boris_M=C3=BChmer?=) Date: Sat, 10 Dec 2011 08:36:47 +0100 Subject: [erlang-questions] [erlang-bugs] erlang/odbc <-> ms-sql error with 'uniqueidentifiers' (aka GUIDs): ODBC_UNSUPPORTED_TYPE In-Reply-To: <4EE221AD.7050100@erix.ericsson.se> References: <4EE221AD.7050100@erix.ericsson.se> Message-ID: Well, maybe I will be able to do such a user-contribution, because either I get it running, find another way to access the Microsoft SQL server from Erlang, or drop Erlang/OTP (nothing I want to do). I started to have a closer look at "odbcserver.c". My first success was to get a SELECT query with a GUID "working". My question now is: what would be the "best" Erlang representation for a GUID? The C structure behind a GUID is (found in "sqltypes.h"): typedef struct tagSQLGUID { DWORD Data1; WORD Data2; WORD Data3; BYTE Data4[ 8 ]; } SQLGUID; For my 1st hack I used the following statements to transform this struct to an Erlang tuple: psg = (SQLGUID*)column.buffer; ei_x_encode_tuple_header(&dynamic_buffer(state), 4); ei_x_encode_ulong(&dynamic_buffer(state), psg->Data1); ei_x_encode_ulong(&dynamic_buffer(state), psg->Data2); ei_x_encode_ulong(&dynamic_buffer(state), psg->Data3); ei_x_encode_tuple_header(&dynamic_buffer(state), 8); for(i=0; i<8; i++){ ei_x_encode_char(&dynamic_buffer(state), psg->Data4[i]); } For example, this conversion results in: 19BCB12A-E6D1-4E58-A841-30F794C614FA => {{431796522,59089,20056,{168,65,48,247,148,198,20,250}} 703F9C47-F1B9-407E-847D-34840AC1E346 => {1883216967,61881,16510,{132,125,52,132,10,193,227,70}} Somewhat odd to see how the C struct looks and how Microsoft "displays" a GUID. Should the Erlang representation be changed? Currently, I don't care about how it is displayed; of course it would be nice to see something more similar to the Microsoft way, on the other hand, it must't be converted back in the c-driver. Would be a bit-string better? Or just use a 128 Bit value? I really like to get some input on this. - boris 2011/12/9 Ingela Anderton Andin : > Hi! > > It seems to be a missing feature. Support for the data_type SQL_GUID is not > implemented. > I do not think it would be all that hard to implement but will not be highly > prioritized by Ericsson. > Maybe somebody would like to make a user-contribution?! You should start > looking at the > funtion encode_data_type in odbcserver.c > > Regards Ingela Erlang/OTP team - Ericsson AB > > Boris M?hmer wrote: >> >> I try to connect to one of our companies Microsoft SQL databases using >> Erlang/OTP R14B04 running on an Ubuntu 10.04 64 Bit installation >> (using the FreeTDS drivers from the Ubuntu repositories). >> >> The problem I have is, that the Erlang ODBC module can't handle >> 'uniqueidentifier' (aka GUID) fields in tables. For example a 'select >> *' doesn't work, but when I only select the non-uniqueidentifier >> fields from the same table it works. >> >> On the other hand, when I use the "isql" (commandline-)tool with the >> same ODBC connection, I don't get any errors. >> >> So I would say that something within the Erlang ODBC module is broken >> (I believe it is in "odbcserver.c"). >> >> Is this a known bug, or did I miss anything? >> >> >> Regards, >> Boris >> _______________________________________________ >> erlang-bugs mailing list >> erlang-bugs@REDACTED >> http://erlang.org/mailman/listinfo/erlang-bugs >> >> > > From dangud@REDACTED Sat Dec 10 09:23:41 2011 From: dangud@REDACTED (Dan Gudmundsson) Date: Sat, 10 Dec 2011 09:23:41 +0100 Subject: [erlang-questions] Is the Pteracuda project dead? In-Reply-To: References: Message-ID: Why not use OpenCL from https://github.com/tonyrog/cl That's what I'm using for wings3D. (for hardware subdivision, and rendering). Platform and Hardware independent, drivers exist for both Intel CPU's and modern gfx cards on all platforms. I don't understand the push for CUDA, please explain. /Dan On Fri, Dec 9, 2011 at 11:39 PM, Kevin Smith wrote: > It was meant as a proof of concept to illustrate what was possible w/CUDA and Erlang. I've changed jobs since that presentation and haven't had enough spare time to resume development. > > --Kevin > On Dec 9, 2011, at 4:13 PM, G.S. wrote: > >> Hello, >> >> I'm finally returning back to the use of Pteracuda for vector multiplication. But have been unable to get a hold of anyone using it. Does anyone know if the Pteracuda project by Kevin Smith has bee abandoned? Has anyone started using it (No one seemed to use it half a year ago, has anyone started?). The GitHub for Pteracuda does not seem to have been updated in a while... >> >> Regards, >> -Gene >> _______________________________________________ >> 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 watson.timothy@REDACTED Sat Dec 10 12:10:19 2011 From: watson.timothy@REDACTED (Tim Watson) Date: Sat, 10 Dec 2011 11:10:19 +0000 Subject: [erlang-questions] can't make this shit up In-Reply-To: References: <-3191245770365971185@unknownmsgid> Message-ID: Hi Ingela, When it is a high enough priority for me, I'll write a patch if it's not already happened. Strangely the code appears to be already there but commented out in httpc_handler.erl, but I haven't the time to dig through what it does. Maybe I'll uncomment it, recompile and see if it works when I'm in work on Monday. :) On 9 December 2011 11:15, Ingela Andin wrote: > Hi! > > It is on the todo list for httpc. It is only a question of priorities. > If sombody would like > it faster than we can manage to get it on the top of our priority-list > feel free to contribute. > > Regards Ingela Erlang/OTP team - Ericsson AB > > 2011/12/9, Tim Watson : > > On 9 December 2011 10:56, Max Bourinov wrote: > > > >> Hi Joel, > >> > >> The same story we have some while ago. httpc does it's job very well > and I > >> don't see a reason to use ibrowse after all. > >> > >> > > The one thing that httpc doesn't do is allow https traffic through a > proxy. > > This means that you can't, for example, use it to access github behind a > > corporate firewall. If this was fixed, I'd revert back to httpc. Given > that > > ibrowse *does* allow this, I can't imagine that it's impossible to make > it > > work in httpc. > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From meetprashant007@REDACTED Sat Dec 10 15:20:06 2011 From: meetprashant007@REDACTED (Prashant Sharma) Date: Sat, 10 Dec 2011 19:50:06 +0530 Subject: [erlang-questions] Is the Pteracuda project dead? In-Reply-To: References: Message-ID: This is really nice was looking for this. Cuda is pushed by nvidia for the same reason it has more libraries etc.. , while i love standardization and multi platform support of opencl. On Sat, Dec 10, 2011 at 1:53 PM, Dan Gudmundsson wrote: > Why not use OpenCL from https://github.com/tonyrog/cl > > That's what I'm using for wings3D. (for hardware subdivision, and rendering). > Platform and Hardware independent, drivers exist for both Intel CPU's > and modern gfx cards on all platforms. > > I don't understand the push for CUDA, please explain. > > /Dan > > On Fri, Dec 9, 2011 at 11:39 PM, Kevin Smith wrote: >> It was meant as a proof of concept to illustrate what was possible w/CUDA and Erlang. I've changed jobs since that presentation and haven't had enough spare time to resume development. >> >> --Kevin >> On Dec 9, 2011, at 4:13 PM, G.S. wrote: >> >>> Hello, >>> >>> I'm finally returning back to the use of Pteracuda for vector multiplication. But have been unable to get a hold of anyone using it. Does anyone know if the Pteracuda project by Kevin Smith has bee abandoned? Has anyone started using it (No one seemed to use it half a year ago, has anyone started?). The GitHub for Pteracuda does not seem to have been updated in a while... >>> >>> Regards, >>> -Gene >>> _______________________________________________ >>> 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 -- Prashant Sharma Development Engineer Pramati Technologies Begumpet "Hare Krishna" From emeka_1978@REDACTED Sat Dec 10 22:41:24 2011 From: emeka_1978@REDACTED (eigenfunction) Date: Sat, 10 Dec 2011 13:41:24 -0800 (PST) Subject: [erlang-questions] Erlang web framework Message-ID: Hi everybody, i would loke to get my feet wet into erlang web development so i wanted to ask: what is the state of erlang web frameworks? i did google a little bit and found a couple of interesting projects. But having written some web applications in webobjects before, security is paramount for me. I have been playing with "scala lift" lately and wanted to know if the erlang community has something of the sort, i mean easy ajax + html component security. Or something in the line of smaltalk seaside. Thank you very much indeed. From tristan.sloughter@REDACTED Sat Dec 10 23:06:46 2011 From: tristan.sloughter@REDACTED (Tristan Sloughter) Date: Sat, 10 Dec 2011 16:06:46 -0600 Subject: [erlang-questions] Erlang web framework In-Reply-To: References: Message-ID: I've tried pretty much every Erlang web framework (some more than others). Could you explain what you mean about Lift's security, 'ajax+html component security'? The main frameworks are: ChicagoBoss (Railish), Nitrogen (evet-based architecture), Zotonic (a CMS/framework in my opinion, they may just say CMS), Erlang Web (the one I have least played with but does seem the most OTP fitting) and Erlyweb. I haven't personally been happy with building full projects in any of these (though Zotonic has been GREAT for projects that just need a CMS like my wedding website, and Chicago BOSS looks great for MVC style Erlang web development) and now I'm doing my own which is based on Webmachine and Batman.js with security based on resource access control using Seresye ( https://github.com/afiniate/seresye) and an Erlang security framework Genbu. So the idea is the client is built completely in Batman.js and communicates (JSON) with the Webmachine based RESTful interface of the backend (which I am greatly simplifying the necessary steps needed to build). And then all security on the backend is based on the idea of writing a rules engine with Seresye which will be simplified for web resource/db use as part of Genbu (which I am moving all web session, authentication logic from Maru to). I hope to have the pieces for Genbu and Maru and an example, for others to start using it, committed tomorrow or sometime this week, but http://claimstrade.github.com/maru/ is the "idea" -- well its more than an idea I am building this while building a real business on top of it. So it is taking what I find I need as I build the business and then adding it to the framework, or taking out and moving to the framework. Also is based on a couple years of Webmachine based web development and what I saw went wrong in some cases as we did so. That said, and even though this is an Erlang list so I hope I'm not yelled at :), I have to also point you at Opa (http://opalang.org/) because I really like it for building sites. And it is very secure and statically typed (even your frontend code is compiled and type checked!). Tristan On Sat, Dec 10, 2011 at 3:41 PM, eigenfunction wrote: > Hi everybody, i would loke to get my feet wet into erlang web > development so i wanted to ask: what is the state of erlang web > frameworks? i did google a little bit and found a couple of > interesting projects. But having written some web applications in > webobjects before, security is paramount for me. I have been playing > with "scala lift" lately and wanted to know if the erlang community > has something of the sort, i mean easy ajax + html component security. > Or something in the line of smaltalk seaside. Thank you very much > indeed. > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From emeka_1978@REDACTED Sat Dec 10 23:42:24 2011 From: emeka_1978@REDACTED (eigenfunction) Date: Sat, 10 Dec 2011 14:42:24 -0800 (PST) Subject: [erlang-questions] Erlang web framework In-Reply-To: References: Message-ID: On Dec 10, 11:06?pm, Tristan Sloughter wrote: > I've tried pretty much every Erlang web framework (some more than others). > > Could you explain what you mean about Lift's security, 'ajax+html component > security'? I am talking about security in the sense of the "Open Web Application Security Project (OWASP)". My time with webobjects development taught me that securing web applications is extremely difficult, so that when the web-framework can do it automatically, it is a great win for everybody. Webobjects, seaside, and lift uses some type of identifier for all dynamically generated html components, which makes them inherently secure, compared to the stateless web applications, against things like XSS attacks or session replay attacks. > The main frameworks are: ChicagoBoss (Railish), Nitrogen (evet-based > architecture), Zotonic (a CMS/framework in my opinion, they may just say > CMS), Erlang Web (the one I have least played with but does seem the most > OTP fitting) and Erlyweb. > > I haven't personally been happy with building full projects in any of these > (though Zotonic has been GREAT for projects that just need a CMS like my > wedding website, and Chicago BOSS looks great for MVC style Erlang web > development) and now I'm doing my own which is based on Webmachine and > Batman.js with security based on resource access control using Seresye (https://github.com/afiniate/seresye) and an Erlang security framework > Genbu. > > So the idea is the client is built completely in Batman.js and communicates > (JSON) with the Webmachine based RESTful interface of the backend (which I > am greatly simplifying the necessary steps needed to build). And then all > security on the backend is based on the idea of writing a rules engine with > Seresye which will be simplified for web resource/db use as part of Genbu > (which I am moving all web session, authentication logic from Maru to). > > I hope to have the pieces for Genbu and Maru and an example, for others to > start using it, committed tomorrow or sometime this week, but > http://claimstrade.github.com/maru/is the "idea" -- well its more than an > idea I am building this while building a real business on top of it. So it > is taking what I find I need as I build the business and then adding it to > the framework, or taking out and moving to the framework. Also is based on > a couple years of Webmachine based web development and what I saw went > wrong in some cases as we did so. I find the idea quite interesting and will check that out. > That said, and even though this is an Erlang list so I hope I'm not yelled > at :), I have to also point you at Opa (http://opalang.org/) because I > really like it for building sites. And it is very secure > and statically typed (even your frontend code is compiled and type > checked!). I have done some ocaml when i was at the university and liked OPA when i first saw it. But i tried some of the examples and it was not working. That turned me off. Might check that again later. Thank you. From romanshestakov@REDACTED Sat Dec 10 23:45:26 2011 From: romanshestakov@REDACTED (Roman Shestakov) Date: Sat, 10 Dec 2011 22:45:26 +0000 (GMT) Subject: [erlang-questions] dialyzer crash Message-ID: <1323557126.9821.YahooMailNeo@web25404.mail.ukl.yahoo.com> hello, I am having a problem with running dialyzer, it started crashing with? the following err.: bash-3.2$ dialyzer -Wno_return --plt ~/.ec_master_dialyzer_plt ebin ? Checking whether the PLT /Users/romanshestakov/.ec_master_dialyzer_plt is up-to-date... yes ? Compiling some key modules to native code... done in 1m26.60s ? Proceeding with analysis...{"init terminating in do_boot",{function_clause,[{dialyzer,message_to_string,["Unexpected multiple opaque types"]},{dialyzer,format_warning,2},{dialyzer_cl,'-print_warnings/1-lc$^0/1-0-',2},{dialyzer_cl,'-print_warnings/1-lc$^0/1-0-',2},{dialyzer_cl,print_warnings,1},{dialyzer_cl,return_value,2},{dialyzer_cl,do_analysis,4},{dialyzer,'-cl/1-fun-0-',1}]}} Crash dump was written to: erl_crash.dump init terminating in do_boot () I am using Erlang R14B04 (erts-5.8.5) what would be the best way to isolate the offending code? I tried to run dialyzer on each beam file in my ebin separately, everything works, the crash seems to be only happening when I run against the entire ebin folder. Regards, Roman -------------- next part -------------- An HTML attachment was scrubbed... URL: From tristan.sloughter@REDACTED Sun Dec 11 01:37:51 2011 From: tristan.sloughter@REDACTED (Tristan Sloughter) Date: Sat, 10 Dec 2011 18:37:51 -0600 Subject: [erlang-questions] Erlang web framework In-Reply-To: References: Message-ID: > > My time with webobjects development taught me that securing web > applications is extremely difficult, so that when the web-framework can > do it automatically, it is a great win for everybody. Can't agree more. I really liked with Opa that SQL Injection and XSS were taken care of. Of course, I know it can't be perfect on stopping XSS attacks but its still very nice to have that built in. Like I wrote a little project Opado without caring about security since I was just learning at the time. And of course people tried, as you can see form name examples here http://opado.org/admin (takes a bit of time to load), but Opa catches it. And you can't have SQL injection if you don't use any SQL :) So Maru won't have to worry about SQL injection... but XSS I'm not sure what to do about yet and some other things I'm not sure what to do about yet. Besides the obvious things like using SSL for everything so sessions can't be stolen and I run through CloudFlare. I'd love to be able to say security was a major feature of Maru, especially since I'm basing my business on this technology, haha, so if you have any suggestions from your experience please let me know and any resources links would be great -- we can take that off list. And I hope Genbu (the apps where the security will be actually implemented for users, sessions, resource control rules, etc) will be able to be used in other frameworks to have a nice core secure and community tested Erlang set of apps for this that can be used by any framework or webserver. Sort of like Apache Shiro. But i tried some of the examples and it was not working. You should definitely give it another shot. Maybe the new version S4 will work easier for you. I found it simple to start with as it just compiles to a single binary that you run, not having to worry with starting any services or installing other dependencies (unless you want distribution, in which case you need HAProxy). Tristan -------------- next part -------------- An HTML attachment was scrubbed... URL: From ngocdaothanh@REDACTED Sun Dec 11 01:46:30 2011 From: ngocdaothanh@REDACTED (Ngoc Dao) Date: Sun, 11 Dec 2011 09:46:30 +0900 Subject: [erlang-questions] Erlang web framework In-Reply-To: References: Message-ID: I have used many web frameworks of both Erlang and Scala. The Erlang framework closest to Lift (http://liftweb.net/) is Nitrogen (http://nitrogenproject.com/). And after using Nitrogen, if you want a Scala framework similar to Nitrogen: https://github.com/ngocdaothanh/xitrum From rexxe98@REDACTED Sun Dec 11 02:50:41 2011 From: rexxe98@REDACTED (Andrew Berman) Date: Sat, 10 Dec 2011 17:50:41 -0800 Subject: [erlang-questions] Erlang web framework In-Reply-To: References: Message-ID: I'm doing something similar to Tristan. I'm using Webmachine in the backend which houses all the db, business, and security logic and using SpineJS and CoffeeScript for my front-end which communicates with Webmachine using JSON. After writing a web app this way, I have to say that it is more difficult than most prepackaged frameworks, however, it allows you a complete separation of concern, forces you to really think about your security, and also forces you to focus on a solid, usable REST API. The cool thing is that you are using your own REST API and if you're looking for an API for your service/web app, you can find and fix any pain points that someone else might encounter using your API. Unlike Tristan, however, I separated all my sessioning into a completely separate web app from the main Webmachine web app. I saw the Webmachine app as something I wanted to keep as a completely standalone service and so I basically wrote an intermediate app using Misultin which proxies messages from the front-end to Webmachine adding any necessary authentication tokens, dealing with sessions, and any web security features. As for web security, this is built into my Misultin app and I followed this guide: http://guides.rubyonrails.org/security.html. It's pretty easy to implement them yourself. I haven't used Opa, but I have used NodeJS and I was very tempted to use it for the intermediate app. You might want to look at Express for NodeJS if you're looking for more of a framework. Hope this helps, Andrew On Sat, Dec 10, 2011 at 2:06 PM, Tristan Sloughter < tristan.sloughter@REDACTED> wrote: > I've tried pretty much every Erlang web framework (some more than others). > > Could you explain what you mean about Lift's security, 'ajax+html > component security'? > > The main frameworks are: ChicagoBoss (Railish), Nitrogen (evet-based > architecture), Zotonic (a CMS/framework in my opinion, they may just say > CMS), Erlang Web (the one I have least played with but does seem the most > OTP fitting) and Erlyweb. > > I haven't personally been happy with building full projects in any of > these (though Zotonic has been GREAT for projects that just need a CMS like > my wedding website, and Chicago BOSS looks great for MVC style Erlang web > development) and now I'm doing my own which is based on Webmachine and > Batman.js with security based on resource access control using Seresye ( > https://github.com/afiniate/seresye) and an Erlang security framework > Genbu. > > So the idea is the client is built completely in Batman.js and > communicates (JSON) with the Webmachine based RESTful interface of the > backend (which I am greatly simplifying the necessary steps needed to > build). And then all security on the backend is based on the idea of > writing a rules engine with Seresye which will be simplified for web > resource/db use as part of Genbu (which I am moving all web session, > authentication logic from Maru to). > > I hope to have the pieces for Genbu and Maru and an example, for others to > start using it, committed tomorrow or sometime this week, but > http://claimstrade.github.com/maru/ is the "idea" -- well its more than > an idea I am building this while building a real business on top of it. So > it is taking what I find I need as I build the business and then adding it > to the framework, or taking out and moving to the framework. Also is based > on a couple years of Webmachine based web development and what I saw went > wrong in some cases as we did so. > > That said, and even though this is an Erlang list so I hope I'm not yelled > at :), I have to also point you at Opa (http://opalang.org/) because I > really like it for building sites. And it is very secure > and statically typed (even your frontend code is compiled and type > checked!). > > Tristan > > On Sat, Dec 10, 2011 at 3:41 PM, eigenfunction wrote: > >> Hi everybody, i would loke to get my feet wet into erlang web >> development so i wanted to ask: what is the state of erlang web >> frameworks? i did google a little bit and found a couple of >> interesting projects. But having written some web applications in >> webobjects before, security is paramount for me. I have been playing >> with "scala lift" lately and wanted to know if the erlang community >> has something of the sort, i mean easy ajax + html component security. >> Or something in the line of smaltalk seaside. Thank you very much >> indeed. >> _______________________________________________ >> 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 tristan.sloughter@REDACTED Sun Dec 11 03:06:36 2011 From: tristan.sloughter@REDACTED (Tristan Sloughter) Date: Sat, 10 Dec 2011 20:06:36 -0600 Subject: [erlang-questions] Erlang web framework In-Reply-To: References: Message-ID: Hmmm, I am going to have to look at Misultin closer. For some reason I thought it was another webserver not something to sit above Webmachine, I may just use that for Maru. And I agree it is more difficult than prepackaged frameworks. That is why I'm making maru. It will make json->record, record->json, save/edit to database, with using -extend you can easily make a RESTful resource for some maru_model (generated with a parse transform from a record (with types). Basically if you just wanted to have a model X and be able to GET/PUSH/PULL/DELETE it right away all that can be done by just creating the model file with the record and the resource file that calls to maru_web_base. I'll be making tools like "maru gen model X" to create these modules of course. Also I'll be adding support for associations (-belongsTo(), -hasMany()) soon. Right now its coded but has to be generalized out of my production app to maru. Its based on how Batman.js handles associations, but that just means the form of the JSON they send, nothing special or out of the ordinary. Tristan On Sat, Dec 10, 2011 at 7:50 PM, Andrew Berman wrote: > I'm doing something similar to Tristan. I'm using Webmachine in the > backend which houses all the db, business, and security logic and using > SpineJS and CoffeeScript for my front-end which communicates with > Webmachine using JSON. After writing a web app this way, I have to say > that it is more difficult than most prepackaged frameworks, however, it > allows you a complete separation of concern, forces you to really think > about your security, and also forces you to focus on a solid, usable REST > API. The cool thing is that you are using your own REST API and if you're > looking for an API for your service/web app, you can find and fix any pain > points that someone else might encounter using your API. > > Unlike Tristan, however, I separated all my sessioning into a completely > separate web app from the main Webmachine web app. I saw the Webmachine > app as something I wanted to keep as a completely standalone service and so > I basically wrote an intermediate app using Misultin which proxies messages > from the front-end to Webmachine adding any necessary authentication > tokens, dealing with sessions, and any web security features. As for web > security, this is built into my Misultin app and I followed this guide: > http://guides.rubyonrails.org/security.html. It's pretty easy to > implement them yourself. > > I haven't used Opa, but I have used NodeJS and I was very tempted to use > it for the intermediate app. You might want to look at Express for NodeJS > if you're looking for more of a framework. > > Hope this helps, > > Andrew > > > On Sat, Dec 10, 2011 at 2:06 PM, Tristan Sloughter < > tristan.sloughter@REDACTED> wrote: > >> I've tried pretty much every Erlang web framework (some more than >> others). >> >> Could you explain what you mean about Lift's security, 'ajax+html >> component security'? >> >> The main frameworks are: ChicagoBoss (Railish), Nitrogen (evet-based >> architecture), Zotonic (a CMS/framework in my opinion, they may just say >> CMS), Erlang Web (the one I have least played with but does seem the most >> OTP fitting) and Erlyweb. >> >> I haven't personally been happy with building full projects in any of >> these (though Zotonic has been GREAT for projects that just need a CMS like >> my wedding website, and Chicago BOSS looks great for MVC style Erlang web >> development) and now I'm doing my own which is based on Webmachine and >> Batman.js with security based on resource access control using Seresye ( >> https://github.com/afiniate/seresye) and an Erlang security framework >> Genbu. >> >> So the idea is the client is built completely in Batman.js and >> communicates (JSON) with the Webmachine based RESTful interface of the >> backend (which I am greatly simplifying the necessary steps needed to >> build). And then all security on the backend is based on the idea of >> writing a rules engine with Seresye which will be simplified for web >> resource/db use as part of Genbu (which I am moving all web session, >> authentication logic from Maru to). >> >> I hope to have the pieces for Genbu and Maru and an example, for others >> to start using it, committed tomorrow or sometime this week, but >> http://claimstrade.github.com/maru/ is the "idea" -- well its more than >> an idea I am building this while building a real business on top of it. So >> it is taking what I find I need as I build the business and then adding it >> to the framework, or taking out and moving to the framework. Also is based >> on a couple years of Webmachine based web development and what I saw went >> wrong in some cases as we did so. >> >> That said, and even though this is an Erlang list so I hope I'm not >> yelled at :), I have to also point you at Opa (http://opalang.org/) >> because I really like it for building sites. And it is very secure >> and statically typed (even your frontend code is compiled and type >> checked!). >> >> Tristan >> >> On Sat, Dec 10, 2011 at 3:41 PM, eigenfunction wrote: >> >>> Hi everybody, i would loke to get my feet wet into erlang web >>> development so i wanted to ask: what is the state of erlang web >>> frameworks? i did google a little bit and found a couple of >>> interesting projects. But having written some web applications in >>> webobjects before, security is paramount for me. I have been playing >>> with "scala lift" lately and wanted to know if the erlang community >>> has something of the sort, i mean easy ajax + html component security. >>> Or something in the line of smaltalk seaside. Thank you very much >>> indeed. >>> _______________________________________________ >>> 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 tristan.sloughter@REDACTED Sun Dec 11 03:40:03 2011 From: tristan.sloughter@REDACTED (Tristan Sloughter) Date: Sat, 10 Dec 2011 20:40:03 -0600 Subject: [erlang-questions] Erlang web framework In-Reply-To: References: Message-ID: Andrew, do you have an example of using it as an intermediate between the frontend and Webmachine? I was just looking through your examples and couldn't find one and was hoping too. Because yes, I have Webmachine call out while handling the request session information and authentication and wanted to give your way a shot. Thanks, Tristan On Sat, Dec 10, 2011 at 7:50 PM, Andrew Berman wrote: > I'm doing something similar to Tristan. I'm using Webmachine in the > backend which houses all the db, business, and security logic and using > SpineJS and CoffeeScript for my front-end which communicates with > Webmachine using JSON. After writing a web app this way, I have to say > that it is more difficult than most prepackaged frameworks, however, it > allows you a complete separation of concern, forces you to really think > about your security, and also forces you to focus on a solid, usable REST > API. The cool thing is that you are using your own REST API and if you're > looking for an API for your service/web app, you can find and fix any pain > points that someone else might encounter using your API. > > Unlike Tristan, however, I separated all my sessioning into a completely > separate web app from the main Webmachine web app. I saw the Webmachine > app as something I wanted to keep as a completely standalone service and so > I basically wrote an intermediate app using Misultin which proxies messages > from the front-end to Webmachine adding any necessary authentication > tokens, dealing with sessions, and any web security features. As for web > security, this is built into my Misultin app and I followed this guide: > http://guides.rubyonrails.org/security.html. It's pretty easy to > implement them yourself. > > I haven't used Opa, but I have used NodeJS and I was very tempted to use > it for the intermediate app. You might want to look at Express for NodeJS > if you're looking for more of a framework. > > Hope this helps, > > Andrew > > > On Sat, Dec 10, 2011 at 2:06 PM, Tristan Sloughter < > tristan.sloughter@REDACTED> wrote: > >> I've tried pretty much every Erlang web framework (some more than >> others). >> >> Could you explain what you mean about Lift's security, 'ajax+html >> component security'? >> >> The main frameworks are: ChicagoBoss (Railish), Nitrogen (evet-based >> architecture), Zotonic (a CMS/framework in my opinion, they may just say >> CMS), Erlang Web (the one I have least played with but does seem the most >> OTP fitting) and Erlyweb. >> >> I haven't personally been happy with building full projects in any of >> these (though Zotonic has been GREAT for projects that just need a CMS like >> my wedding website, and Chicago BOSS looks great for MVC style Erlang web >> development) and now I'm doing my own which is based on Webmachine and >> Batman.js with security based on resource access control using Seresye ( >> https://github.com/afiniate/seresye) and an Erlang security framework >> Genbu. >> >> So the idea is the client is built completely in Batman.js and >> communicates (JSON) with the Webmachine based RESTful interface of the >> backend (which I am greatly simplifying the necessary steps needed to >> build). And then all security on the backend is based on the idea of >> writing a rules engine with Seresye which will be simplified for web >> resource/db use as part of Genbu (which I am moving all web session, >> authentication logic from Maru to). >> >> I hope to have the pieces for Genbu and Maru and an example, for others >> to start using it, committed tomorrow or sometime this week, but >> http://claimstrade.github.com/maru/ is the "idea" -- well its more than >> an idea I am building this while building a real business on top of it. So >> it is taking what I find I need as I build the business and then adding it >> to the framework, or taking out and moving to the framework. Also is based >> on a couple years of Webmachine based web development and what I saw went >> wrong in some cases as we did so. >> >> That said, and even though this is an Erlang list so I hope I'm not >> yelled at :), I have to also point you at Opa (http://opalang.org/) >> because I really like it for building sites. And it is very secure >> and statically typed (even your frontend code is compiled and type >> checked!). >> >> Tristan >> >> On Sat, Dec 10, 2011 at 3:41 PM, eigenfunction wrote: >> >>> Hi everybody, i would loke to get my feet wet into erlang web >>> development so i wanted to ask: what is the state of erlang web >>> frameworks? i did google a little bit and found a couple of >>> interesting projects. But having written some web applications in >>> webobjects before, security is paramount for me. I have been playing >>> with "scala lift" lately and wanted to know if the erlang community >>> has something of the sort, i mean easy ajax + html component security. >>> Or something in the line of smaltalk seaside. Thank you very much >>> indeed. >>> _______________________________________________ >>> 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 rexxe98@REDACTED Sun Dec 11 06:44:45 2011 From: rexxe98@REDACTED (Andrew Berman) Date: Sat, 10 Dec 2011 21:44:45 -0800 Subject: [erlang-questions] Erlang web framework In-Reply-To: References: Message-ID: Tristan, I don't have code I can share with you as it's closed source, but, basically, I think of my Webmachine layer as a completely separate application from my website. Essentially it solely provides an API to handle all the business logic. As such, my front-end (i.e. the website) is now free to worry solely about the front-end and can be written using any framework or language you want. With that in mind, I am writing a very AJAX-centric and HTML5 app so the front-end logic resides in the JavaScript (which I write in CoffeeScript). However, because my API layer has security built into it, the front-end must provide credentials to use the API. I don't want to store those credentials in the JavaScript and I didn't want to use HTML5 sessionStorage to store secure data, so I put Misultin between the two. So, Misultin acts as a proxy server of sorts. A request comes in, if it is a login URL or logout URL or any other "special" URL that needs additional processing, I have Misultin take care of it. Otherwise, Misultin just forwards the request on to Webmachine and then forwards the response back to the front-end. Misultin also takes care of the sessioning on login and logout (I do this manually) and on all other requests by adding the proper auth info to the Authentication header (I'm using OAuth 2). So if you look here: https://github.com/ostinelli/misultin/blob/master/examples/misultin_rest.erlyou can see an example of how you can intercept specific URLs and then a general function to capture the other URLs. So when a request comes in, I do my processing and then use httpc to make a request to the API layer. Then I take the result and just return it in the Misultin function. Does that make sense? --Andrew On Sat, Dec 10, 2011 at 6:40 PM, Tristan Sloughter < tristan.sloughter@REDACTED> wrote: > Andrew, do you have an example of using it as an intermediate between the > frontend and Webmachine? I was just looking through your examples and > couldn't find one and was hoping too. Because yes, I have Webmachine call > out while handling the request session information and authentication and > wanted to give your way a shot. > > Thanks, > Tristan > > On Sat, Dec 10, 2011 at 7:50 PM, Andrew Berman wrote: > >> I'm doing something similar to Tristan. I'm using Webmachine in the >> backend which houses all the db, business, and security logic and using >> SpineJS and CoffeeScript for my front-end which communicates with >> Webmachine using JSON. After writing a web app this way, I have to say >> that it is more difficult than most prepackaged frameworks, however, it >> allows you a complete separation of concern, forces you to really think >> about your security, and also forces you to focus on a solid, usable REST >> API. The cool thing is that you are using your own REST API and if you're >> looking for an API for your service/web app, you can find and fix any pain >> points that someone else might encounter using your API. >> >> Unlike Tristan, however, I separated all my sessioning into a completely >> separate web app from the main Webmachine web app. I saw the Webmachine >> app as something I wanted to keep as a completely standalone service and so >> I basically wrote an intermediate app using Misultin which proxies messages >> from the front-end to Webmachine adding any necessary authentication >> tokens, dealing with sessions, and any web security features. As for web >> security, this is built into my Misultin app and I followed this guide: >> http://guides.rubyonrails.org/security.html. It's pretty easy to >> implement them yourself. >> >> I haven't used Opa, but I have used NodeJS and I was very tempted to use >> it for the intermediate app. You might want to look at Express for NodeJS >> if you're looking for more of a framework. >> >> Hope this helps, >> >> Andrew >> >> >> On Sat, Dec 10, 2011 at 2:06 PM, Tristan Sloughter < >> tristan.sloughter@REDACTED> wrote: >> >>> I've tried pretty much every Erlang web framework (some more than >>> others). >>> >>> Could you explain what you mean about Lift's security, 'ajax+html >>> component security'? >>> >>> The main frameworks are: ChicagoBoss (Railish), Nitrogen (evet-based >>> architecture), Zotonic (a CMS/framework in my opinion, they may just say >>> CMS), Erlang Web (the one I have least played with but does seem the most >>> OTP fitting) and Erlyweb. >>> >>> I haven't personally been happy with building full projects in any of >>> these (though Zotonic has been GREAT for projects that just need a CMS like >>> my wedding website, and Chicago BOSS looks great for MVC style Erlang web >>> development) and now I'm doing my own which is based on Webmachine and >>> Batman.js with security based on resource access control using Seresye ( >>> https://github.com/afiniate/seresye) and an Erlang security framework >>> Genbu. >>> >>> So the idea is the client is built completely in Batman.js and >>> communicates (JSON) with the Webmachine based RESTful interface of the >>> backend (which I am greatly simplifying the necessary steps needed to >>> build). And then all security on the backend is based on the idea of >>> writing a rules engine with Seresye which will be simplified for web >>> resource/db use as part of Genbu (which I am moving all web session, >>> authentication logic from Maru to). >>> >>> I hope to have the pieces for Genbu and Maru and an example, for others >>> to start using it, committed tomorrow or sometime this week, but >>> http://claimstrade.github.com/maru/ is the "idea" -- well its more than >>> an idea I am building this while building a real business on top of it. So >>> it is taking what I find I need as I build the business and then adding it >>> to the framework, or taking out and moving to the framework. Also is based >>> on a couple years of Webmachine based web development and what I saw went >>> wrong in some cases as we did so. >>> >>> That said, and even though this is an Erlang list so I hope I'm not >>> yelled at :), I have to also point you at Opa (http://opalang.org/) >>> because I really like it for building sites. And it is very secure >>> and statically typed (even your frontend code is compiled and type >>> checked!). >>> >>> Tristan >>> >>> On Sat, Dec 10, 2011 at 3:41 PM, eigenfunction wrote: >>> >>>> Hi everybody, i would loke to get my feet wet into erlang web >>>> development so i wanted to ask: what is the state of erlang web >>>> frameworks? i did google a little bit and found a couple of >>>> interesting projects. But having written some web applications in >>>> webobjects before, security is paramount for me. I have been playing >>>> with "scala lift" lately and wanted to know if the erlang community >>>> has something of the sort, i mean easy ajax + html component security. >>>> Or something in the line of smaltalk seaside. Thank you very much >>>> indeed. >>>> _______________________________________________ >>>> 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 tristan.sloughter@REDACTED Sun Dec 11 06:49:31 2011 From: tristan.sloughter@REDACTED (Tristan Sloughter) Date: Sat, 10 Dec 2011 23:49:31 -0600 Subject: [erlang-questions] Erlang web framework In-Reply-To: References: Message-ID: Ah ok, yes, that makes sense. I'll give this a look. Thanks. On Sat, Dec 10, 2011 at 11:44 PM, Andrew Berman wrote: > Tristan, > > I don't have code I can share with you as it's closed source, but, > basically, I think of my Webmachine layer as a completely separate > application from my website. Essentially it solely provides an API to > handle all the business logic. As such, my front-end (i.e. the website) is > now free to worry solely about the front-end and can be written using any > framework or language you want. With that in mind, I am writing a very > AJAX-centric and HTML5 app so the front-end logic resides in the JavaScript > (which I write in CoffeeScript). However, because my API layer has > security built into it, the front-end must provide credentials to use the > API. I don't want to store those credentials in the JavaScript and I > didn't want to use HTML5 sessionStorage to store secure data, so I put > Misultin between the two. So, Misultin acts as a proxy server of sorts. A > request comes in, if it is a login URL or logout URL or any other "special" > URL that needs additional processing, I have Misultin take care of it. > Otherwise, Misultin just forwards the request on to Webmachine and then > forwards the response back to the front-end. Misultin also takes care of > the sessioning on login and logout (I do this manually) and on all other > requests by adding the proper auth info to the Authentication header (I'm > using OAuth 2). > > So if you look here: > https://github.com/ostinelli/misultin/blob/master/examples/misultin_rest.erlyou can see an example of how you can intercept specific URLs and then a > general function to capture the other URLs. So when a request comes in, I > do my processing and then use httpc to make a request to the API layer. > Then I take the result and just return it in the Misultin function. > > Does that make sense? > > --Andrew > > On Sat, Dec 10, 2011 at 6:40 PM, Tristan Sloughter < > tristan.sloughter@REDACTED> wrote: > >> Andrew, do you have an example of using it as an intermediate between the >> frontend and Webmachine? I was just looking through your examples and >> couldn't find one and was hoping too. Because yes, I have Webmachine call >> out while handling the request session information and authentication and >> wanted to give your way a shot. >> >> Thanks, >> Tristan >> >> On Sat, Dec 10, 2011 at 7:50 PM, Andrew Berman wrote: >> >>> I'm doing something similar to Tristan. I'm using Webmachine in the >>> backend which houses all the db, business, and security logic and using >>> SpineJS and CoffeeScript for my front-end which communicates with >>> Webmachine using JSON. After writing a web app this way, I have to say >>> that it is more difficult than most prepackaged frameworks, however, it >>> allows you a complete separation of concern, forces you to really think >>> about your security, and also forces you to focus on a solid, usable REST >>> API. The cool thing is that you are using your own REST API and if you're >>> looking for an API for your service/web app, you can find and fix any pain >>> points that someone else might encounter using your API. >>> >>> Unlike Tristan, however, I separated all my sessioning into a completely >>> separate web app from the main Webmachine web app. I saw the Webmachine >>> app as something I wanted to keep as a completely standalone service and so >>> I basically wrote an intermediate app using Misultin which proxies messages >>> from the front-end to Webmachine adding any necessary authentication >>> tokens, dealing with sessions, and any web security features. As for web >>> security, this is built into my Misultin app and I followed this guide: >>> http://guides.rubyonrails.org/security.html. It's pretty easy to >>> implement them yourself. >>> >>> I haven't used Opa, but I have used NodeJS and I was very tempted to use >>> it for the intermediate app. You might want to look at Express for NodeJS >>> if you're looking for more of a framework. >>> >>> Hope this helps, >>> >>> Andrew >>> >>> >>> On Sat, Dec 10, 2011 at 2:06 PM, Tristan Sloughter < >>> tristan.sloughter@REDACTED> wrote: >>> >>>> I've tried pretty much every Erlang web framework (some more than >>>> others). >>>> >>>> Could you explain what you mean about Lift's security, 'ajax+html >>>> component security'? >>>> >>>> The main frameworks are: ChicagoBoss (Railish), Nitrogen (evet-based >>>> architecture), Zotonic (a CMS/framework in my opinion, they may just say >>>> CMS), Erlang Web (the one I have least played with but does seem the most >>>> OTP fitting) and Erlyweb. >>>> >>>> I haven't personally been happy with building full projects in any of >>>> these (though Zotonic has been GREAT for projects that just need a CMS like >>>> my wedding website, and Chicago BOSS looks great for MVC style Erlang web >>>> development) and now I'm doing my own which is based on Webmachine and >>>> Batman.js with security based on resource access control using Seresye ( >>>> https://github.com/afiniate/seresye) and an Erlang security framework >>>> Genbu. >>>> >>>> So the idea is the client is built completely in Batman.js and >>>> communicates (JSON) with the Webmachine based RESTful interface of the >>>> backend (which I am greatly simplifying the necessary steps needed to >>>> build). And then all security on the backend is based on the idea of >>>> writing a rules engine with Seresye which will be simplified for web >>>> resource/db use as part of Genbu (which I am moving all web session, >>>> authentication logic from Maru to). >>>> >>>> I hope to have the pieces for Genbu and Maru and an example, for others >>>> to start using it, committed tomorrow or sometime this week, but >>>> http://claimstrade.github.com/maru/ is the "idea" -- well its more >>>> than an idea I am building this while building a real business on top of >>>> it. So it is taking what I find I need as I build the business and then >>>> adding it to the framework, or taking out and moving to the framework. Also >>>> is based on a couple years of Webmachine based web development and what I >>>> saw went wrong in some cases as we did so. >>>> >>>> That said, and even though this is an Erlang list so I hope I'm not >>>> yelled at :), I have to also point you at Opa (http://opalang.org/) >>>> because I really like it for building sites. And it is very secure >>>> and statically typed (even your frontend code is compiled and type >>>> checked!). >>>> >>>> Tristan >>>> >>>> On Sat, Dec 10, 2011 at 3:41 PM, eigenfunction wrote: >>>> >>>>> Hi everybody, i would loke to get my feet wet into erlang web >>>>> development so i wanted to ask: what is the state of erlang web >>>>> frameworks? i did google a little bit and found a couple of >>>>> interesting projects. But having written some web applications in >>>>> webobjects before, security is paramount for me. I have been playing >>>>> with "scala lift" lately and wanted to know if the erlang community >>>>> has something of the sort, i mean easy ajax + html component security. >>>>> Or something in the line of smaltalk seaside. Thank you very much >>>>> indeed. >>>>> _______________________________________________ >>>>> 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 chad@REDACTED Sun Dec 11 07:52:00 2011 From: chad@REDACTED (Chad Phillips -- Apartment Lines) Date: Sat, 10 Dec 2011 22:52:00 -0800 Subject: [erlang-questions] ODBC to Erlang data mapping problem on OS X In-Reply-To: References: Message-ID: Found the problem. It's a bug in the configure scripts located in lib/odbc of the Erlang source code, which hard code '-liodbc' when $host_os is darwin -- this prevents anyone from being able to properly link against a unixODBC install on OS X, which needs '-lodbc' instead. In my case, via MacPorts, this apparently meant it was using the MacPorts unixODBC headers, but linking against the default OS X iODBC lib, which I'm guessing is what led to the weird behavior I was seeing. I've created a patch for the MacPorts version of Erlang, but I'm pretty autoconf clueless, so all it does is hard code '-lodbc' in place of '-liodbc', which is clearly not the right upstream solution. ;) If there's anything else I can do to help fix this bug, please let me know. Thanks, Chad -------------- next part -------------- A non-text attachment was scrubbed... Name: patch-lib_odbc_configure Type: application/octet-stream Size: 1847 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: patch-lib_odbc_configure.in Type: application/octet-stream Size: 529 bytes Desc: not available URL: -------------- next part -------------- On Dec 9, 2011, at 6:05 AM, Ingela Andin wrote: > Hi! > > Sound like a problem in the odbc-driver (if I remember correctly iodbc > is the name of the most common driver on MAC) sql_wvarchar is defined > to be Unicode encoded as UTF16 little endian. > > Regards Ingela Erlang/OTP team - Ericsson AB > > > > 2011/12/1, Chad Phillips -- Apartment Lines : >> According to http://www.erlang.org/doc/apps/odbc/databases.html#type, the >> SQL_WVARCHAR ODBC data type should be translated by Erlang's ODBC driver to >> "Unicode binary encoded as UTF16 little endian." >> >> This works as expected on Linux, but I'm having issues on OS X, where it >> appears it's getting translated to UTF32 little endian, instead of UTF16 >> little endian. >> >> I'm using Erlang R14B04 on both machines, with the exact same database >> table, does anybody have an idea why this might be occurring, and how to >> remedy it? >> >> Additional info below for those interested. >> >> Thanks! >> >> Chad >> >> TABLE ON BOTH ARCHITECTURES: >> >> CREATE TABLE `foo` ( >> `bar` varchar(255) NOT NULL >> ) ENGINE=InnoDB DEFAULT CHARSET=utf8; >> >> >> LINUX ERLANG SESSION: >> >> (alaem@REDACTED)1> odbc:start(). >> ok >> (alaem@REDACTED)2> {ok, Ref} = odbc:connect("DSN=testing;Option=3", []). >> {ok,<0.90.0>} >> (alaem@REDACTED)3> odbc:describe_table(Ref, "foo"). >> {ok,[{"bar",{sql_wvarchar,255}}]} >> (alaem@REDACTED)4> odbc:select_count(Ref, "SELECT * FROM foo"). >> {ok,1} >> (alaem@REDACTED)5> {selected, Columns, [{Bar}]} = odbc:next(Ref). >> {selected,["bar"],[{<<98,0,97,0,122,0>>}]} >> (alaem@REDACTED)6> unicode:characters_to_list(Bar, {utf16, little}). >> "baz" >> (alaem@REDACTED)7> unicode:characters_to_list(Bar, {utf32, little}). >> {error,[],<<98,0,97,0,122,0>>} >> >> OS X ERLANG SESSION: >> >> (alaem@REDACTED)1> odbc:start(). >> ok >> (alaem@REDACTED)2> {ok, Ref} = odbc:connect("DSN=testing;Option=3", []). >> {ok,<0.90.0>} >> (alaem@REDACTED)3> odbc:describe_table(Ref, "foo"). >> {ok,[{"bar",{sql_wvarchar,255}}]} >> (alaem@REDACTED)4> odbc:select_count(Ref, "SELECT * FROM foo"). >> {ok,1} >> (alaem@REDACTED)5> {selected, Columns, [{Bar}]} = odbc:next(Ref). >> {selected,["bar"],[{<<98,0,0,0,97,0,0,0,122,0,0,0>>}]} >> (alaem@REDACTED)6> unicode:characters_to_list(Bar, {utf16, little}). >> [98,0,97,0,122,0] >> (alaem@REDACTED)7> unicode:characters_to_list(Bar, {utf32, little}). >> "baz" >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://erlang.org/mailman/listinfo/erlang-questions >> From emeka_1978@REDACTED Sun Dec 11 12:03:57 2011 From: emeka_1978@REDACTED (eigenfunction) Date: Sun, 11 Dec 2011 03:03:57 -0800 (PST) Subject: [erlang-questions] Erlang web framework In-Reply-To: References: Message-ID: <66b72476-436a-45ac-b40c-430591b587c9@q16g2000yqn.googlegroups.com> If i understood correctly, you have a clean separation between the client and the server. I think this type of application are even more difficult to sercure, because you have to think twice before you implement any type of action that might modify something on the server side. The Spring framework used to use the argument of scalability of stateless applications as a selling point in the java world. But as we all know, stateful applications scales as well. Apple uses WEbobjects, some other people use Tapestry, wicket, lift, smalltalk seaside. They all scale and they have the benefit that that they are almost secure by default, i mean they are very resistant to the attacks described by the OWASP. My problems with them: tomcat, jboss, maven, scala versioning, build time,jpa,jdo,pojo,hibernate and the list goes on. I believe erlang has a great potential in this area, since its easy to buld self contained erlang applications and the otp is definitly killing it. > And you can't have SQL injection if you don't use any SQL :) > > So Maru won't have to worry about SQL injection... but XSS I'm not sure > what to do about yet and some other things I'm not sure what to do about > yet. Besides the obvious things like using SSL for everything so sessions > can't be stolen and I run through CloudFlare. > > I'd love to be able to say security was a major feature of Maru, especially > since I'm basing my business on this technology, haha, so if you have any > suggestions from your experience please let me know and any resources links > would be great -- we can take that off list. All the links and buttons that can excute an action on the server are associated with an identification number which is a combination of server session id + request number+some automatic generated guid+some other thing. If you have time, take a look at seaside. Of course your solution is completely different, since you are aiming for rich client javascript. But to be honest with you, i would rather have my javascript generated automtically. I have written javascript some years ago and it is fun as long as your application is not big enough. One day, i forgot to put "var" in front of a variable name and the app would just always crash, it took me one week to catch that. I would not touch js again to write anything more than let's say 300 loc. From tristan.sloughter@REDACTED Sun Dec 11 16:14:38 2011 From: tristan.sloughter@REDACTED (Tristan Sloughter) Date: Sun, 11 Dec 2011 09:14:38 -0600 Subject: [erlang-questions] Erlang web framework In-Reply-To: <66b72476-436a-45ac-b40c-430591b587c9@q16g2000yqn.googlegroups.com> References: <66b72476-436a-45ac-b40c-430591b587c9@q16g2000yqn.googlegroups.com> Message-ID: > > All the links and buttons that can excute an action on the server are > associated > with an identification number which is a combination of server session > id + request number+some automatic > generated guid+some other thing But to be honest with you, i would rather > have my javascript generated automtically. I have written javascript > some years ago and it is fun as long as your application > is not big enough. I think for Erlang you should definitely checkout Nitrogen. It seems to fit best what you are looking for as an Erlang framework. And as a story about Javascript and Opa, when I was first working with Opa I noticed the compiler would catch simple mistakes in what would be generated into html/javascript that I knew if I had been doing myself in Javascript I would not have found till testing in the browser and having to pull up firebug and debug. Static typing with javascript degeneration and an XHTML datatype (the compile catches if you are missing an end tag ) is just amazing for productivity and stabability. And while it still has many of the same problems as Javascript, I use Coffeescript for everything now, which is muuuch better. Tristan -------------- next part -------------- An HTML attachment was scrubbed... URL: From mjtruog@REDACTED Mon Dec 12 03:12:26 2011 From: mjtruog@REDACTED (Michael Truog) Date: Sun, 11 Dec 2011 18:12:26 -0800 Subject: [erlang-questions] [ANN] CloudI 0.1.9 Released Message-ID: <4EE5630A.5020305@gmail.com> Download from http://sourceforge.net/projects/cloudi/files/0.1.9a/cloudi-0.1.9.tar.gz/download CloudI is currently alpha and in-test. 0.2.0 will be the beta release, so 0.1.9 includes the major changes before the beta release. Beginning with 0.2.0, there will be separate git release/development branches and tag usage, to keep releases stable, and semantic versioning will be used (http://semver.org/). This release does include changes to the callback function signatures, so it is backwards-incompatible because of the addition of request priorities and request_info/response_info. The request_info and response_info data is used to hold key/value request meta data and currently is used for the HTTP header information for incoming HTTP requests. The request priorities use 0 as the default request priority, -128 as the highest priority and 127 as the lowest priority. Many of the other changes are summarized below: * A C++ object oriented interface for the CloudI API (cloudi.hpp) now exists that provides integration for class member function pointers, to make C++ service implementation simpler. * recv_async now will return the oldest response when passed a null UUID. If you prefer receiving a random response (quicker), the behavior can be changed in cloudi_constants.hrl, with RECV_ASYNC_STRATEGY. * All CloudI API implementations now use unbuffered stderr/stdout streams, so that the cloudi.log gets the output as quickly as possible. All critical error handling within the CloudI API now throws an exception (Java, Ruby, Python) or returns a valid CloudI return value (C, C++). * The CloudI Job API now has additions to modify the Erlang code search paths, dynamically change the loglevel, and restart a job. * Fixes to ensure that 2GB is supported as the maximum total request size, when using a job with the tcp protocol. * Fixes and additions to support the usage of the forward function within the CloudI API. The forward functionality now uses a small decrement of the request timeout to prevent infinite requests. * The CloudI logger will now prevent any service from causing a system failure when the service floods the logger with requests (due to a misbehaving service). The CloudI log output ("var/log/cloudi/cloudi.log") can now be rotated (i.e., with logrotated) without any special configuration. * HTTP methods are now used as suffixes on service destinations by default. * ACL bug fixed for complex destinations. * JSON-RPC version bug fixed. * msg_size test added to test larger message handling with forward CloudI API usage. * http_req test now utilizes all supported CloudI API languages. * hexpi test now utilizes the C++ CloudI API. Anyone with questions, comments, ideas, suggestions, criticisms, or concerns is welcome to send email. Thanks, Michael -------------- next part -------------- An HTML attachment was scrubbed... URL: From ingela.andin@REDACTED Mon Dec 12 09:42:05 2011 From: ingela.andin@REDACTED (Ingela Andin) Date: Mon, 12 Dec 2011 09:42:05 +0100 Subject: [erlang-questions] can't make this shit up In-Reply-To: References: <-3191245770365971185@unknownmsgid> Message-ID: Hi! Well that code is quite old, I wrote it several years ago when I was trying to implement the https through a proxy feature but back then the ssl application did not have the upgrade capability. I commented it out as I expected to be able to uncomment it once the ssl application was fixed. I would be very suprised if it worked with out some adjustments, and I am not sure it is compleat. And to make a long story short the ssl application had many problems and I spent the last couple of years making a better ssl application. Regards Ingela Erlang/OTP team - Ericsson AB 2011/12/10, Tim Watson : > Hi Ingela, > > When it is a high enough priority for me, I'll write a patch if it's not > already happened. Strangely the code appears to be already there but > commented out in httpc_handler.erl, but I haven't the time to dig through > what it does. Maybe I'll uncomment it, recompile and see if it works when > I'm in work on Monday. :) > > On 9 December 2011 11:15, Ingela Andin wrote: > >> Hi! >> >> It is on the todo list for httpc. It is only a question of priorities. >> If sombody would like >> it faster than we can manage to get it on the top of our priority-list >> feel free to contribute. >> >> Regards Ingela Erlang/OTP team - Ericsson AB >> >> 2011/12/9, Tim Watson : >> > On 9 December 2011 10:56, Max Bourinov wrote: >> > >> >> Hi Joel, >> >> >> >> The same story we have some while ago. httpc does it's job very well >> and I >> >> don't see a reason to use ibrowse after all. >> >> >> >> >> > The one thing that httpc doesn't do is allow https traffic through a >> proxy. >> > This means that you can't, for example, use it to access github behind a >> > corporate firewall. If this was fixed, I'd revert back to httpc. Given >> that >> > ibrowse *does* allow this, I can't imagine that it's impossible to make >> it >> > work in httpc. >> > >> > From ingela@REDACTED Mon Dec 12 12:18:50 2011 From: ingela@REDACTED (Ingela Anderton Andin) Date: Mon, 12 Dec 2011 12:18:50 +0100 Subject: [erlang-questions] [erlang-bugs] erlang/odbc <-> ms-sql error with 'uniqueidentifiers' (aka GUIDs): ODBC_UNSUPPORTED_TYPE In-Reply-To: References: <4EE221AD.7050100@erix.ericsson.se> Message-ID: <4EE5E31A.3080606@erix.ericsson.se> Hi! I probably am not the best person to comment on this as I do not use SQL-databases very much and do not know how GUIDs are used. Maybe someone else can help me out? Generally if you should convert the value it would probably be easier to do the conversion in the erlang-code and always let the c-code get what it expects. Regards Ingela Erlang/OTP-team -Ericsson AB Boris M?hmer wrote: > Well, maybe I will be able to do such a user-contribution, because > either I get it running, find another way to access the Microsoft SQL > server from Erlang, or drop Erlang/OTP (nothing I want to do). > > I started to have a closer look at "odbcserver.c". My first success > was to get a SELECT query with a GUID "working". > > My question now is: what would be the "best" Erlang representation for a GUID? > > The C structure behind a GUID is (found in "sqltypes.h"): > typedef struct tagSQLGUID > { > DWORD Data1; > WORD Data2; > WORD Data3; > BYTE Data4[ 8 ]; > } SQLGUID; > > For my 1st hack I used the following statements to transform this > struct to an Erlang tuple: > psg = (SQLGUID*)column.buffer; > ei_x_encode_tuple_header(&dynamic_buffer(state), 4); > ei_x_encode_ulong(&dynamic_buffer(state), psg->Data1); > ei_x_encode_ulong(&dynamic_buffer(state), psg->Data2); > ei_x_encode_ulong(&dynamic_buffer(state), psg->Data3); > ei_x_encode_tuple_header(&dynamic_buffer(state), 8); > for(i=0; i<8; i++){ > ei_x_encode_char(&dynamic_buffer(state), psg->Data4[i]); > } > > For example, this conversion results in: > 19BCB12A-E6D1-4E58-A841-30F794C614FA => > {{431796522,59089,20056,{168,65,48,247,148,198,20,250}} > > 703F9C47-F1B9-407E-847D-34840AC1E346 => > {1883216967,61881,16510,{132,125,52,132,10,193,227,70}} > > Somewhat odd to see how the C struct looks and how Microsoft "displays" a GUID. > > Should the Erlang representation be changed? Currently, I don't care > about how it is displayed; of course it would be nice to see something > more similar to the Microsoft way, on the other hand, it must't be > converted back in the c-driver. Would be a bit-string better? Or just > use a 128 Bit value? > > I really like to get some input on this. > > > - boris > > > 2011/12/9 Ingela Anderton Andin : > >> Hi! >> >> It seems to be a missing feature. Support for the data_type SQL_GUID is not >> implemented. >> I do not think it would be all that hard to implement but will not be highly >> prioritized by Ericsson. >> Maybe somebody would like to make a user-contribution?! You should start >> looking at the >> funtion encode_data_type in odbcserver.c >> >> Regards Ingela Erlang/OTP team - Ericsson AB >> >> Boris M?hmer wrote: >> >>> I try to connect to one of our companies Microsoft SQL databases using >>> Erlang/OTP R14B04 running on an Ubuntu 10.04 64 Bit installation >>> (using the FreeTDS drivers from the Ubuntu repositories). >>> >>> The problem I have is, that the Erlang ODBC module can't handle >>> 'uniqueidentifier' (aka GUID) fields in tables. For example a 'select >>> *' doesn't work, but when I only select the non-uniqueidentifier >>> fields from the same table it works. >>> >>> On the other hand, when I use the "isql" (commandline-)tool with the >>> same ODBC connection, I don't get any errors. >>> >>> So I would say that something within the Erlang ODBC module is broken >>> (I believe it is in "odbcserver.c"). >>> >>> Is this a known bug, or did I miss anything? >>> >>> >>> Regards, >>> Boris >>> _______________________________________________ >>> erlang-bugs mailing list >>> erlang-bugs@REDACTED >>> http://erlang.org/mailman/listinfo/erlang-bugs >>> >>> >>> >> > _______________________________________________ > erlang-bugs mailing list > erlang-bugs@REDACTED > http://erlang.org/mailman/listinfo/erlang-bugs > > From spawn.think@REDACTED Mon Dec 12 13:11:28 2011 From: spawn.think@REDACTED (Ahmed Omar) Date: Mon, 12 Dec 2011 13:11:28 +0100 Subject: [erlang-questions] dialyzer crash In-Reply-To: <1323557126.9821.YahooMailNeo@web25404.mail.ukl.yahoo.com> References: <1323557126.9821.YahooMailNeo@web25404.mail.ukl.yahoo.com> Message-ID: I'm not a dialyzer expert, but the crash could be a bug in dialyzer or typer. (some problem with formatting warnings) could you try running with --raw option? On Sat, Dec 10, 2011 at 11:45 PM, Roman Shestakov < romanshestakov@REDACTED> wrote: > hello, > > I am having a problem with running dialyzer, it started crashing with the > following err.: > > bash-3.2$ dialyzer -Wno_return --plt ~/.ec_master_dialyzer_plt ebin > Checking whether the PLT /Users/romanshestakov/.ec_master_dialyzer_plt > is up-to-date... yes > Compiling some key modules to native code... done in 1m26.60s > Proceeding with analysis...{"init terminating in > do_boot",{function_clause,[{dialyzer,message_to_string,["Unexpected > multiple opaque > types"]},{dialyzer,format_warning,2},{dialyzer_cl,'-print_warnings/1-lc$^0/1-0-',2},{dialyzer_cl,'-print_warnings/1-lc$^0/1-0-',2},{dialyzer_cl,print_warnings,1},{dialyzer_cl,return_value,2},{dialyzer_cl,do_analysis,4},{dialyzer,'-cl/1-fun-0-',1}]}} > > Crash dump was written to: erl_crash.dump > init terminating in do_boot () > > I am using Erlang R14B04 (erts-5.8.5) > > what would be the best way to isolate the offending code? > I tried to run dialyzer on each beam file in my ebin separately, > everything works, the crash seems to be only happening when I run against > the entire ebin folder. > > Regards, Roman > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > > -- Best Regards, - Ahmed Omar http://nl.linkedin.com/in/adiaa Follow me on twitter @spawn_think -------------- next part -------------- An HTML attachment was scrubbed... URL: From hynek@REDACTED Mon Dec 12 15:14:57 2011 From: hynek@REDACTED (Hynek Vychodil) Date: Mon, 12 Dec 2011 15:14:57 +0100 Subject: [erlang-questions] [erlang-bugs] erlang/odbc <-> ms-sql error with 'uniqueidentifiers' (aka GUIDs): ODBC_UNSUPPORTED_TYPE In-Reply-To: <4EE5E31A.3080606@erix.ericsson.se> References: <4EE221AD.7050100@erix.ericsson.se> <4EE5E31A.3080606@erix.ericsson.se> Message-ID: Hi, So in other words keep it in binary and split as needed? ei_x_encode_binary(&dynamic_buffer(state), (const void *)column.buffer, sizeof(SQLGUID)); and in erlang you can do what you want. I think GUID is mostly used as opaque reference like ref in erlang so I would also prefer let it be as binary. It is simple, fast and least memory consuming. Regards Hynek On Mon, Dec 12, 2011 at 12:18 PM, Ingela Anderton Andin wrote: > Hi! > > I probably ?am not the best person to comment on this as I do not use > SQL-databases very much and do not know how GUIDs are used. ?Maybe someone > else can help me out? Generally if you should convert ?the value it would > probably be easier to do the conversion in the erlang-code and always let > the c-code get what it expects. > > Regards Ingela Erlang/OTP-team ?-Ericsson AB > > > Boris M?hmer wrote: >> >> Well, maybe I will be able to do such a user-contribution, because >> either I get it running, find another way to access the Microsoft SQL >> server from Erlang, or drop Erlang/OTP (nothing I want to do). >> >> I started to have a closer look at "odbcserver.c". My first success >> was to get a SELECT query with a GUID "working". >> >> My question now is: what would be the "best" Erlang representation for a >> GUID? >> >> The C structure behind a GUID is (found in "sqltypes.h"): >> ? ?typedef struct ?tagSQLGUID >> ? ?{ >> ? ? ? ?DWORD Data1; >> ? ? ? ?WORD Data2; >> ? ? ? ?WORD Data3; >> ? ? ? ?BYTE Data4[ 8 ]; >> ? ?} SQLGUID; >> >> For my 1st hack I used the following statements to transform this >> struct to an Erlang tuple: >> ? ? ? ?psg = (SQLGUID*)column.buffer; >> ? ? ? ?ei_x_encode_tuple_header(&dynamic_buffer(state), 4); >> ? ? ? ?ei_x_encode_ulong(&dynamic_buffer(state), psg->Data1); >> ? ? ? ?ei_x_encode_ulong(&dynamic_buffer(state), psg->Data2); >> ? ? ? ?ei_x_encode_ulong(&dynamic_buffer(state), psg->Data3); >> ? ? ? ?ei_x_encode_tuple_header(&dynamic_buffer(state), 8); >> ? ? ? ?for(i=0; i<8; i++){ >> ? ? ? ? ? ?ei_x_encode_char(&dynamic_buffer(state), psg->Data4[i]); >> ? ? ? ?} >> >> For example, this conversion results in: >> ? ?19BCB12A-E6D1-4E58-A841-30F794C614FA => >> ? ? ? ?{{431796522,59089,20056,{168,65,48,247,148,198,20,250}} >> >> ? ?703F9C47-F1B9-407E-847D-34840AC1E346 => >> ? ? ? ?{1883216967,61881,16510,{132,125,52,132,10,193,227,70}} >> >> Somewhat odd to see how the C struct looks and how Microsoft "displays" a >> GUID. >> >> Should the Erlang representation be changed? Currently, I don't care >> about how it is displayed; of course it would be nice to see something >> more similar to the Microsoft way, on the other hand, it must't be >> converted back in the c-driver. Would be a bit-string better? Or just >> use a 128 Bit value? >> >> I really like to get some input on this. >> >> >> ?- boris >> >> >> 2011/12/9 Ingela Anderton Andin : >> >>> >>> Hi! >>> >>> It seems to be a missing feature. Support for the data_type SQL_GUID is >>> not >>> implemented. >>> I do not think it would be all that hard to implement but will not be >>> highly >>> prioritized by Ericsson. >>> Maybe somebody would like to make a user-contribution?! You should start >>> looking at the >>> funtion encode_data_type in odbcserver.c >>> >>> Regards Ingela Erlang/OTP team - Ericsson AB >>> >>> Boris M?hmer wrote: >>> >>>> >>>> I try to connect to one of our companies Microsoft SQL databases using >>>> Erlang/OTP R14B04 running on an Ubuntu 10.04 64 Bit installation >>>> (using the FreeTDS drivers from the Ubuntu repositories). >>>> >>>> The problem I have is, that the Erlang ODBC module can't handle >>>> 'uniqueidentifier' (aka GUID) fields in tables. For example a 'select >>>> *' doesn't work, but when I only select the non-uniqueidentifier >>>> fields from the same table it works. >>>> >>>> On the other hand, when I use the "isql" (commandline-)tool with the >>>> same ODBC connection, I don't get any errors. >>>> >>>> So I would say that something within the Erlang ODBC module is broken >>>> (I believe it is in "odbcserver.c"). >>>> >>>> Is this a known bug, or did I miss anything? >>>> >>>> >>>> Regards, >>>> Boris >>>> _______________________________________________ >>>> erlang-bugs mailing list >>>> erlang-bugs@REDACTED >>>> http://erlang.org/mailman/listinfo/erlang-bugs >>>> >>>> >>>> >>> >>> >> >> _______________________________________________ >> erlang-bugs mailing list >> erlang-bugs@REDACTED >> http://erlang.org/mailman/listinfo/erlang-bugs >> >> > > > _______________________________________________ > erlang-bugs mailing list > erlang-bugs@REDACTED > http://erlang.org/mailman/listinfo/erlang-bugs From robert.virding@REDACTED Mon Dec 12 16:20:18 2011 From: robert.virding@REDACTED (Robert Virding) Date: Mon, 12 Dec 2011 15:20:18 -0000 (GMT) Subject: [erlang-questions] Best practices in gen_fsm usage In-Reply-To: Message-ID: Of course, you don't NEED gen_fsm as you can always carry an extra field in the loop data which indicates which state you are in. You can also flip that and say you don't really NEED gen_server as this is just a gen_fsm with one state. The point is that using one or the other more clearly shows your intent and is therefore a Good Thing (tm). I think this is also the with using send_all_state_event, it is an event which is allowed in all states. Of course, you can add a clause to each state function to handle that event, but using the send_all_state_event better shows the intent. I don't really see why you would not wrap the actual gen_fsm:send_event/2 call in a user API, as you would do with gen_server:call/2. If you can hide the detail of the actual request being sent then you most often should do that. Robert ----- Original Message ----- > On Wed, Dec 7, 2011 at 6:50 PM, Adam Lindberg > wrote: > > > > > What exactly is the use case for being able to contact a process > > that implements either gen_server or gen_fsm via a standard API? > > I've never come across a use case where processes of different > > "types" needed to be mixed. If you really, really have to have > > that, you could implement a common interface via the handle_info/2 > > callbacks. > > You haven't met. I have. > > > > > - Either your process runs code that is based on gen_fsm, then you > > use a wrapper API that converts calls to corresponding gen_fsm > > calls (just as Thomas suggested). > > > > What for? > > I have never ever seen any _production_ code, which is better with > gen_fsm. Thanks to Fred for study examples, but they are study > examples. > > Ulf told something about SDL, but I really don't know what is SDL. > > I beleive that there may be situation, when gen_fsm is convenient. > But > I ask only to show example of such code. > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > From boris.muehmer@REDACTED Mon Dec 12 19:42:51 2011 From: boris.muehmer@REDACTED (=?UTF-8?Q?Boris_M=C3=BChmer?=) Date: Mon, 12 Dec 2011 19:42:51 +0100 Subject: [erlang-questions] [erlang-bugs] erlang/odbc <-> ms-sql error with 'uniqueidentifiers' (aka GUIDs): ODBC_UNSUPPORTED_TYPE In-Reply-To: References: <4EE221AD.7050100@erix.ericsson.se> <4EE5E31A.3080606@erix.ericsson.se> Message-ID: I did a quick test using the "binary" en-/decode routines: actually *I* prefer the results to my first attempt! Thank You very much for Your suggestions Hynek! I will do (or add) some more (unit-)tests, before I will submit a patch. Hopefully I don't run into too much trouble, now. Regards, Boris 2011/12/12 Hynek Vychodil : > Hi, > > So in other words keep it in binary and split as needed? > > ei_x_encode_binary(&dynamic_buffer(state), (const void > *)column.buffer, sizeof(SQLGUID)); > > and in erlang you can do what you want. I think GUID is mostly used as > opaque reference like ref in erlang so I would also prefer let it be > as binary. It is simple, fast and least memory consuming. > > Regards > Hynek > > On Mon, Dec 12, 2011 at 12:18 PM, Ingela Anderton Andin > wrote: >> Hi! >> >> I probably ?am not the best person to comment on this as I do not use >> SQL-databases very much and do not know how GUIDs are used. ?Maybe someone >> else can help me out? Generally if you should convert ?the value it would >> probably be easier to do the conversion in the erlang-code and always let >> the c-code get what it expects. >> >> Regards Ingela Erlang/OTP-team ?-Ericsson AB >> >> >> Boris M?hmer wrote: >>> >>> Well, maybe I will be able to do such a user-contribution, because >>> either I get it running, find another way to access the Microsoft SQL >>> server from Erlang, or drop Erlang/OTP (nothing I want to do). >>> >>> I started to have a closer look at "odbcserver.c". My first success >>> was to get a SELECT query with a GUID "working". >>> >>> My question now is: what would be the "best" Erlang representation for a >>> GUID? >>> >>> The C structure behind a GUID is (found in "sqltypes.h"): >>> ? ?typedef struct ?tagSQLGUID >>> ? ?{ >>> ? ? ? ?DWORD Data1; >>> ? ? ? ?WORD Data2; >>> ? ? ? ?WORD Data3; >>> ? ? ? ?BYTE Data4[ 8 ]; >>> ? ?} SQLGUID; >>> >>> For my 1st hack I used the following statements to transform this >>> struct to an Erlang tuple: >>> ? ? ? ?psg = (SQLGUID*)column.buffer; >>> ? ? ? ?ei_x_encode_tuple_header(&dynamic_buffer(state), 4); >>> ? ? ? ?ei_x_encode_ulong(&dynamic_buffer(state), psg->Data1); >>> ? ? ? ?ei_x_encode_ulong(&dynamic_buffer(state), psg->Data2); >>> ? ? ? ?ei_x_encode_ulong(&dynamic_buffer(state), psg->Data3); >>> ? ? ? ?ei_x_encode_tuple_header(&dynamic_buffer(state), 8); >>> ? ? ? ?for(i=0; i<8; i++){ >>> ? ? ? ? ? ?ei_x_encode_char(&dynamic_buffer(state), psg->Data4[i]); >>> ? ? ? ?} >>> >>> For example, this conversion results in: >>> ? ?19BCB12A-E6D1-4E58-A841-30F794C614FA => >>> ? ? ? ?{{431796522,59089,20056,{168,65,48,247,148,198,20,250}} >>> >>> ? ?703F9C47-F1B9-407E-847D-34840AC1E346 => >>> ? ? ? ?{1883216967,61881,16510,{132,125,52,132,10,193,227,70}} >>> >>> Somewhat odd to see how the C struct looks and how Microsoft "displays" a >>> GUID. >>> >>> Should the Erlang representation be changed? Currently, I don't care >>> about how it is displayed; of course it would be nice to see something >>> more similar to the Microsoft way, on the other hand, it must't be >>> converted back in the c-driver. Would be a bit-string better? Or just >>> use a 128 Bit value? >>> >>> I really like to get some input on this. >>> >>> >>> ?- boris >>> >>> >>> 2011/12/9 Ingela Anderton Andin : >>> >>>> >>>> Hi! >>>> >>>> It seems to be a missing feature. Support for the data_type SQL_GUID is >>>> not >>>> implemented. >>>> I do not think it would be all that hard to implement but will not be >>>> highly >>>> prioritized by Ericsson. >>>> Maybe somebody would like to make a user-contribution?! You should start >>>> looking at the >>>> funtion encode_data_type in odbcserver.c >>>> >>>> Regards Ingela Erlang/OTP team - Ericsson AB >>>> >>>> Boris M?hmer wrote: >>>> >>>>> >>>>> I try to connect to one of our companies Microsoft SQL databases using >>>>> Erlang/OTP R14B04 running on an Ubuntu 10.04 64 Bit installation >>>>> (using the FreeTDS drivers from the Ubuntu repositories). >>>>> >>>>> The problem I have is, that the Erlang ODBC module can't handle >>>>> 'uniqueidentifier' (aka GUID) fields in tables. For example a 'select >>>>> *' doesn't work, but when I only select the non-uniqueidentifier >>>>> fields from the same table it works. >>>>> >>>>> On the other hand, when I use the "isql" (commandline-)tool with the >>>>> same ODBC connection, I don't get any errors. >>>>> >>>>> So I would say that something within the Erlang ODBC module is broken >>>>> (I believe it is in "odbcserver.c"). >>>>> >>>>> Is this a known bug, or did I miss anything? >>>>> >>>>> >>>>> Regards, >>>>> Boris >>>>> _______________________________________________ >>>>> erlang-bugs mailing list >>>>> erlang-bugs@REDACTED >>>>> http://erlang.org/mailman/listinfo/erlang-bugs >>>>> >>>>> >>>>> >>>> >>>> >>> >>> _______________________________________________ >>> erlang-bugs mailing list >>> erlang-bugs@REDACTED >>> http://erlang.org/mailman/listinfo/erlang-bugs >>> >>> >> >> >> _______________________________________________ >> erlang-bugs mailing list >> erlang-bugs@REDACTED >> http://erlang.org/mailman/listinfo/erlang-bugs From gianfranco.alongi@REDACTED Mon Dec 12 19:44:58 2011 From: gianfranco.alongi@REDACTED (Gianfranco Alongi) Date: Mon, 12 Dec 2011 19:44:58 +0100 Subject: [erlang-questions] Best practices in gen_fsm usage In-Reply-To: References: Message-ID: Agreeing totally with Robert here. You should aim at making the underlying implementation transparent to the user (9 times out of 10 this is myself). This is a timeless good Software Engineering practice, you can keep the API to the user and change the implementation from gen_fsm to gen_server and your own homebrewn solution with ets tables and whatnot. /G On Mon, Dec 12, 2011 at 4:20 PM, Robert Virding wrote: > Of course, you don't NEED gen_fsm as you can always carry an extra field in the loop data which indicates which state you are in. You can also flip that and say you don't really NEED gen_server as this is just a gen_fsm with one state. > > The point is that using one or the other more clearly shows your intent and is therefore a Good Thing (tm). > > I think this is also the with using send_all_state_event, it is an event which is allowed in all states. Of course, you can add a clause to each state function to handle that event, but using the send_all_state_event better shows the intent. > > I don't really see why you would not wrap the actual gen_fsm:send_event/2 call in a user API, as you would do with gen_server:call/2. If you can hide the detail of the actual request being sent then you most often should do that. > > Robert > > ----- Original Message ----- >> On Wed, Dec 7, 2011 at 6:50 PM, Adam Lindberg >> wrote: >> >> > >> > What exactly is the use case for being able to contact a process >> > that implements either gen_server or gen_fsm via a standard API? >> > I've never come across a use case where processes of different >> > "types" needed to be mixed. If you really, really have to have >> > that, you could implement a common interface via the handle_info/2 >> > callbacks. >> >> You haven't met. I have. >> >> > >> > - Either your process runs code that is based on gen_fsm, then you >> > use a wrapper API that converts calls to corresponding gen_fsm >> > calls (just as Thomas suggested). >> > >> >> What for? >> >> I have never ever seen any _production_ code, which is better with >> gen_fsm. Thanks to Fred for study examples, but they are study >> examples. >> >> Ulf told something about SDL, but I really don't know what is SDL. >> >> I beleive that there may be situation, when gen_fsm is convenient. >> But >> I ask only to show example of such code. >> _______________________________________________ >> 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 boris.muehmer@REDACTED Mon Dec 12 22:10:09 2011 From: boris.muehmer@REDACTED (=?UTF-8?Q?Boris_M=C3=BChmer?=) Date: Mon, 12 Dec 2011 22:10:09 +0100 Subject: [erlang-questions] [erlang-bugs] erlang/odbc <-> ms-sql error with 'uniqueidentifiers' (aka GUIDs): ODBC_UNSUPPORTED_TYPE In-Reply-To: References: <4EE221AD.7050100@erix.ericsson.se> <4EE5E31A.3080606@erix.ericsson.se> Message-ID: After switching to the "binary" version I did some tests with parameterized queries and updates. The following statements do work on my setup: odbc:start(). ConnString = "DSN=erltest;UID=erluser;PWD=erlpass". {ok, Ref} = odbc:connect(ConnString, []). odbc:describe_table(Ref, "account"). odbc:sql_query(Ref, "SELECT * FROM account"). Result = odbc:sql_query(Ref, "SELECT * FROM account WHERE firstname = 'Boris'"). {selected, _, [Row]} = Result. {Id, _, _, _, _, _, _, _} = Row. odbc:param_query(Ref, "SELECT * FROM account WHERE id = ?", [{sql_guid, [Id]}]). odbc:param_query(Ref, "UPDATE account SET lastname = 'Muehmer' WHERE id = ?", [{sql_guid, [Id]}]). odbc:disconnect(Ref). odbc:stop(). The current changes are "visible" in my github otp fork "odbc_SQL_GUID_fix": https://github.com/bsmr/otp/compare/master...odbc_SQL_GUID_fix Primary things to do: a complete CRUD (unit-)test. Current open issues: in C I added preprocessor macros like "#if (ODBCVER >= 0x0350)". Should I add similar statements to the Erlang code? Is there a non-manual way to keep C-header files and erlang code in-sync? Regards, Boris 2011/12/12 Boris M?hmer : > I did a quick test using the "binary" en-/decode routines: actually > *I* prefer the results to my first attempt! Thank You very much for > Your suggestions Hynek! > > I will do (or add) some more (unit-)tests, before I will submit a > patch. Hopefully I don't run into too much trouble, now. > > > Regards, > Boris > > > > 2011/12/12 Hynek Vychodil : >> Hi, >> >> So in other words keep it in binary and split as needed? >> >> ei_x_encode_binary(&dynamic_buffer(state), (const void >> *)column.buffer, sizeof(SQLGUID)); >> >> and in erlang you can do what you want. I think GUID is mostly used as >> opaque reference like ref in erlang so I would also prefer let it be >> as binary. It is simple, fast and least memory consuming. >> >> Regards >> Hynek >> >> On Mon, Dec 12, 2011 at 12:18 PM, Ingela Anderton Andin >> wrote: >>> Hi! >>> >>> I probably ?am not the best person to comment on this as I do not use >>> SQL-databases very much and do not know how GUIDs are used. ?Maybe someone >>> else can help me out? Generally if you should convert ?the value it would >>> probably be easier to do the conversion in the erlang-code and always let >>> the c-code get what it expects. >>> >>> Regards Ingela Erlang/OTP-team ?-Ericsson AB >>> >>> >>> Boris M?hmer wrote: >>>> >>>> Well, maybe I will be able to do such a user-contribution, because >>>> either I get it running, find another way to access the Microsoft SQL >>>> server from Erlang, or drop Erlang/OTP (nothing I want to do). >>>> >>>> I started to have a closer look at "odbcserver.c". My first success >>>> was to get a SELECT query with a GUID "working". >>>> >>>> My question now is: what would be the "best" Erlang representation for a >>>> GUID? >>>> >>>> The C structure behind a GUID is (found in "sqltypes.h"): >>>> ? ?typedef struct ?tagSQLGUID >>>> ? ?{ >>>> ? ? ? ?DWORD Data1; >>>> ? ? ? ?WORD Data2; >>>> ? ? ? ?WORD Data3; >>>> ? ? ? ?BYTE Data4[ 8 ]; >>>> ? ?} SQLGUID; >>>> >>>> For my 1st hack I used the following statements to transform this >>>> struct to an Erlang tuple: >>>> ? ? ? ?psg = (SQLGUID*)column.buffer; >>>> ? ? ? ?ei_x_encode_tuple_header(&dynamic_buffer(state), 4); >>>> ? ? ? ?ei_x_encode_ulong(&dynamic_buffer(state), psg->Data1); >>>> ? ? ? ?ei_x_encode_ulong(&dynamic_buffer(state), psg->Data2); >>>> ? ? ? ?ei_x_encode_ulong(&dynamic_buffer(state), psg->Data3); >>>> ? ? ? ?ei_x_encode_tuple_header(&dynamic_buffer(state), 8); >>>> ? ? ? ?for(i=0; i<8; i++){ >>>> ? ? ? ? ? ?ei_x_encode_char(&dynamic_buffer(state), psg->Data4[i]); >>>> ? ? ? ?} >>>> >>>> For example, this conversion results in: >>>> ? ?19BCB12A-E6D1-4E58-A841-30F794C614FA => >>>> ? ? ? ?{{431796522,59089,20056,{168,65,48,247,148,198,20,250}} >>>> >>>> ? ?703F9C47-F1B9-407E-847D-34840AC1E346 => >>>> ? ? ? ?{1883216967,61881,16510,{132,125,52,132,10,193,227,70}} >>>> >>>> Somewhat odd to see how the C struct looks and how Microsoft "displays" a >>>> GUID. >>>> >>>> Should the Erlang representation be changed? Currently, I don't care >>>> about how it is displayed; of course it would be nice to see something >>>> more similar to the Microsoft way, on the other hand, it must't be >>>> converted back in the c-driver. Would be a bit-string better? Or just >>>> use a 128 Bit value? >>>> >>>> I really like to get some input on this. >>>> >>>> >>>> ?- boris >>>> >>>> >>>> 2011/12/9 Ingela Anderton Andin : >>>> >>>>> >>>>> Hi! >>>>> >>>>> It seems to be a missing feature. Support for the data_type SQL_GUID is >>>>> not >>>>> implemented. >>>>> I do not think it would be all that hard to implement but will not be >>>>> highly >>>>> prioritized by Ericsson. >>>>> Maybe somebody would like to make a user-contribution?! You should start >>>>> looking at the >>>>> funtion encode_data_type in odbcserver.c >>>>> >>>>> Regards Ingela Erlang/OTP team - Ericsson AB >>>>> >>>>> Boris M?hmer wrote: >>>>> >>>>>> >>>>>> I try to connect to one of our companies Microsoft SQL databases using >>>>>> Erlang/OTP R14B04 running on an Ubuntu 10.04 64 Bit installation >>>>>> (using the FreeTDS drivers from the Ubuntu repositories). >>>>>> >>>>>> The problem I have is, that the Erlang ODBC module can't handle >>>>>> 'uniqueidentifier' (aka GUID) fields in tables. For example a 'select >>>>>> *' doesn't work, but when I only select the non-uniqueidentifier >>>>>> fields from the same table it works. >>>>>> >>>>>> On the other hand, when I use the "isql" (commandline-)tool with the >>>>>> same ODBC connection, I don't get any errors. >>>>>> >>>>>> So I would say that something within the Erlang ODBC module is broken >>>>>> (I believe it is in "odbcserver.c"). >>>>>> >>>>>> Is this a known bug, or did I miss anything? >>>>>> >>>>>> >>>>>> Regards, >>>>>> Boris >>>>>> _______________________________________________ >>>>>> erlang-bugs mailing list >>>>>> erlang-bugs@REDACTED >>>>>> http://erlang.org/mailman/listinfo/erlang-bugs >>>>>> >>>>>> >>>>>> >>>>> >>>>> >>>> >>>> _______________________________________________ >>>> erlang-bugs mailing list >>>> erlang-bugs@REDACTED >>>> http://erlang.org/mailman/listinfo/erlang-bugs >>>> >>>> >>> >>> >>> _______________________________________________ >>> erlang-bugs mailing list >>> erlang-bugs@REDACTED >>> http://erlang.org/mailman/listinfo/erlang-bugs From steven.charles.davis@REDACTED Tue Dec 13 01:44:37 2011 From: steven.charles.davis@REDACTED (Steve Davis) Date: Mon, 12 Dec 2011 16:44:37 -0800 (PST) Subject: [erlang-questions] Best practices in gen_fsm usage In-Reply-To: References: Message-ID: <00cd8600-b5a5-44e8-8263-375a8c5080a6@a17g2000yqj.googlegroups.com> Often, I find myself starting with gen_fsm then veering back to a gen_server which "manages" a module of pure state callbacks... so I'm making it a personal target to understand why that is. I'm feeling (and I could be wrong) that there's a piece missing from the picture here, and it seems my experience is not totally isolated (esp. wrt the OP). /s On Dec 12, 9:20?am, Robert Virding wrote: > Of course, you don't NEED gen_fsm as you can always carry an extra field in the loop data which indicates which state you are in. You can also flip that and say you don't really NEED gen_server as this is just a gen_fsm with one state. From steven.charles.davis@REDACTED Tue Dec 13 02:49:33 2011 From: steven.charles.davis@REDACTED (Steve Davis) Date: Mon, 12 Dec 2011 17:49:33 -0800 (PST) Subject: [erlang-questions] Best practices in gen_fsm usage In-Reply-To: <20111207223120.GC10804@hijacked.us> References: <33151719-9161-4a9e-aafc-61471a629cac@knuth> <20111207223120.GC10804@hijacked.us> Message-ID: <78cdc228-8e01-426c-9940-766417d74dc6@32g2000yqp.googlegroups.com> This source looks (to me) like a major workaround rather than a clean fsm example... Just me? /s On Dec 7, 4:31?pm, Andrew Thompson wrote: > Riak makes extensive use of FSMs in lots of places. A good example is the > put fsm: > > https://github.com/basho/riak_kv/blob/master/src/riak_kv_put_fsm.erl From i3text@REDACTED Tue Dec 13 04:15:02 2011 From: i3text@REDACTED (wrp) Date: Mon, 12 Dec 2011 19:15:02 -0800 (PST) Subject: [erlang-questions] Building small erlang vm suitable for bundle with app. In-Reply-To: References: Message-ID: On Dec 8, 2:55?am, Ahmed Omar wrote: > What you are looking for is releases. You can create a release and include > the erlang runtime system (erts) executables within it. > For more information about that i suggest you take a look at... The methods described at http://learnyousomeerlang.com/release-is-the-word use systools and reltool, which result in rather large distributables. "...with systools...the files are a bit large. The whole release takes over 20 MB on disk..." "...Some of our more general releases would weigh in at over 35 MB. The one described above is reduced to less than 20 MB [with reltool}... The size is still fairly large though. That's because of ERTS, which itself takes 18.5 MB.""" However, http://www.erlang.org/faq/implementations.html says "A 2 MB stripped Erlang system can include the beam emulator and almost all of the stdlib, sasl, kernel, inets and runtime_tools libraries, provided the libraries are compiled without debugging information and are compressed..." Are there detailed directions anywhere on building such small distributables? From bchesneau@REDACTED Tue Dec 13 08:15:16 2011 From: bchesneau@REDACTED (Benoit Chesneau) Date: Tue, 13 Dec 2011 08:15:16 +0100 Subject: [erlang-questions] Building small erlang vm suitable for bundle with app. In-Reply-To: References: Message-ID: On Thursday, December 8, 2011, Albin Stig? wrote: > Hi, > > I'm quite new to Erlang and this list so I hope I'm posting in the right place? > > I would like to use Erlang code (couchdb) in an Mac OS X app I'm > developing and I would like to bundle it with my app. Exactly like the > Mac OS X version of Wings3D is bundling a version of erlang. > > I was wondering if someone kind provide me with some ideas of how to > compile a smaller version of the Erlang VM without the developing > tools etc? > > Cheers, > Albin > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > Hi albin, You can use the rebared version of couchdb I've wroitten to do that. It create a full Erlang release that you can eventually customize: http://github.com/refuge/rcouch & rebar template: http://github.com/refuge/rcouch_template hope it helps, -beno?t -------------- next part -------------- An HTML attachment was scrubbed... URL: From steven.charles.davis@REDACTED Tue Dec 13 09:38:51 2011 From: steven.charles.davis@REDACTED (Steve Davis) Date: Tue, 13 Dec 2011 00:38:51 -0800 (PST) Subject: [erlang-questions] Best practices in gen_fsm usage In-Reply-To: <78cdc228-8e01-426c-9940-766417d74dc6@32g2000yqp.googlegroups.com> References: <33151719-9161-4a9e-aafc-61471a629cac@knuth> <20111207223120.GC10804@hijacked.us> <78cdc228-8e01-426c-9940-766417d74dc6@32g2000yqp.googlegroups.com> Message-ID: I'd like to retract the statement below. The module in question is indeed a good example of the use of gen_fsm, and "major workaround" is a total overstatement of my sense of the "something missing". I need to figure out why I end up with a gen_server after starting out with a gen_fsm, and then may have something more fruitful to say. On Dec 12, 7:49?pm, Steve Davis wrote: > This source looks (to me) like a major workaround rather than a clean > fsm example... > > Just me? > > /s > > On Dec 7, 4:31?pm, Andrew Thompson wrote:> Riak makes extensive use of FSMs in lots of places. A good example is the > > put fsm: > > >https://github.com/basho/riak_kv/blob/master/src/riak_kv_put_fsm.erl > > _______________________________________________ > erlang-questions mailing list > erlang-questi...@REDACTED://erlang.org/mailman/listinfo/erlang-questions From gustav.simonsson@REDACTED Tue Dec 13 09:59:34 2011 From: gustav.simonsson@REDACTED (Gustav Simonsson) Date: Tue, 13 Dec 2011 08:59:34 -0000 (GMT) Subject: [erlang-questions] Building small erlang vm suitable for bundle with app. In-Reply-To: Message-ID: <81f1931c-eaf6-45e7-b0ea-d3b52b2baa7f@knuth> Hi! This is a scrappy half-completed bash script I used to generate a small Erlang release. It's something I hope can eventually grow into a more general and stable tool for generating Erlang releases. It does contain some useful things for reducing the size of an Erlang release. Also thanks to Adam Lindberg for helping out with it. https://github.com/Gustav-Simonsson/Stripped-Erlang/blob/master/minimal_erlang.sh Regards, Gustav Simonsson Sent from my PC ----- Original Message ----- From: "Albin Stig?" To: erlang-questions@REDACTED Sent: Thursday, December 8, 2011 11:27:39 AM Subject: [erlang-questions] Building small erlang vm suitable for bundle with app. Hi, I'm quite new to Erlang and this list so I hope I'm posting in the right place? I would like to use Erlang code (couchdb) in an Mac OS X app I'm developing and I would like to bundle it with my app. Exactly like the Mac OS X version of Wings3D is bundling a version of erlang. I was wondering if someone kind provide me with some ideas of how to compile a smaller version of the Erlang VM without the developing tools etc? Cheers, Albin _______________________________________________ erlang-questions mailing list erlang-questions@REDACTED http://erlang.org/mailman/listinfo/erlang-questions From vances@REDACTED Tue Dec 13 10:33:56 2011 From: vances@REDACTED (Vance Shipley) Date: Tue, 13 Dec 2011 15:03:56 +0530 Subject: [erlang-questions] Best practices in gen_fsm usage In-Reply-To: References: <33151719-9161-4a9e-aafc-61471a629cac@knuth> <20111207223120.GC10804@hijacked.us> <78cdc228-8e01-426c-9940-766417d74dc6@32g2000yqp.googlegroups.com> Message-ID: <20111213093354.GA298@aluminum.motivity.ca> On Tue, Dec 13, 2011 at 12:38:51AM -0800, Steve Davis wrote: } I need to figure out why I end up with a gen_server after starting } out with a gen_fsm, and then may have something more fruitful to say. One good reason to migrate a gen_fsm to gen_server is that it becomes clear that it has no unique states. In my experience it is much more common to migrate a gen_server to a gen_fsm as it becomes clear that there are unique states. The following provides a contrived example. Start with a gen_server: -module(foo_server). -export([init/1, handle_call/3]). -behaviour(gen_server). -record(state, {sap}). init(_Args) -> {ok, #state{}}. handle_call(bind, From, State) -> SAP = bind(), {reply, ok, State#state{sap = SAP}}; handle_call(get, From, #state{sap = SAP} = State) -> Got = get(SAP), {reply, Got, State}. Later realize that binding may take time and have varying results: -module(foo_fsm). -export([init/1, idle/3, binding/2, bound/3]). -behaviour(gen_fsm). -record(statedata, {sap, from}). init(_Args) -> {ok, idle, #statedata{}}. idle(bind, From, Statedata) -> bind(), {next_state, binding, Statedata#statedata{from = From}}. binding({error, Reason}, #statedata{from = From} = Statedata) -> gen_fsm:reply(From, {error, Reason}), {next_state, idle, #statedata{}}; binding(SAP, #statedata{from = From} = Statedata) -> gen_fsm:reply(From, ok), {next_state, bound, Statedata#statedata{sap = SAP}}. bound(get, From, #statedata{sap = SAP} = Statedata) -> Got = get(SAP), {reply, Got, bound, Statedata}. -- -Vance From ingela.andin@REDACTED Tue Dec 13 11:47:10 2011 From: ingela.andin@REDACTED (Ingela Andin) Date: Tue, 13 Dec 2011 11:47:10 +0100 Subject: [erlang-questions] [erlang-bugs] erlang/odbc <-> ms-sql error with 'uniqueidentifiers' (aka GUIDs): ODBC_UNSUPPORTED_TYPE In-Reply-To: References: <4EE221AD.7050100@erix.ericsson.se> <4EE5E31A.3080606@erix.ericsson.se> Message-ID: I think that you should only need the #if-def in decode_params that should return FALSE if (ODBCVER >= 0x0350) is not fullfilled and erlang will get a "param_badarg"-error. Regards Ingela Erlang/OTP - team Ericsson AB 2011/12/12, Boris M?hmer : > After switching to the "binary" version I did some tests with > parameterized queries and updates. > > The following statements do work on my setup: > odbc:start(). > ConnString = "DSN=erltest;UID=erluser;PWD=erlpass". > {ok, Ref} = odbc:connect(ConnString, []). > odbc:describe_table(Ref, "account"). > odbc:sql_query(Ref, "SELECT * FROM account"). > Result = odbc:sql_query(Ref, "SELECT * FROM account WHERE > firstname = 'Boris'"). > {selected, _, [Row]} = Result. > {Id, _, _, _, _, _, _, _} = Row. > odbc:param_query(Ref, "SELECT * FROM account WHERE id = ?", > [{sql_guid, [Id]}]). > odbc:param_query(Ref, "UPDATE account SET lastname = 'Muehmer' > WHERE id = ?", [{sql_guid, [Id]}]). > odbc:disconnect(Ref). > odbc:stop(). > > The current changes are "visible" in my github otp fork "odbc_SQL_GUID_fix": > https://github.com/bsmr/otp/compare/master...odbc_SQL_GUID_fix > > Primary things to do: a complete CRUD (unit-)test. > > Current open issues: in C I added preprocessor macros like "#if > (ODBCVER >= 0x0350)". Should I add similar statements to the Erlang > code? Is there a non-manual way to keep C-header files and erlang code > in-sync? > > > Regards, > Boris > > 2011/12/12 Boris M?hmer : >> I did a quick test using the "binary" en-/decode routines: actually >> *I* prefer the results to my first attempt! Thank You very much for >> Your suggestions Hynek! >> >> I will do (or add) some more (unit-)tests, before I will submit a >> patch. Hopefully I don't run into too much trouble, now. >> >> >> Regards, >> Boris >> >> >> >> 2011/12/12 Hynek Vychodil : >>> Hi, >>> >>> So in other words keep it in binary and split as needed? >>> >>> ei_x_encode_binary(&dynamic_buffer(state), (const void >>> *)column.buffer, sizeof(SQLGUID)); >>> >>> and in erlang you can do what you want. I think GUID is mostly used as >>> opaque reference like ref in erlang so I would also prefer let it be >>> as binary. It is simple, fast and least memory consuming. >>> >>> Regards >>> Hynek >>> >>> On Mon, Dec 12, 2011 at 12:18 PM, Ingela Anderton Andin >>> wrote: >>>> Hi! >>>> >>>> I probably ?am not the best person to comment on this as I do not use >>>> SQL-databases very much and do not know how GUIDs are used. ?Maybe >>>> someone >>>> else can help me out? Generally if you should convert ?the value it >>>> would >>>> probably be easier to do the conversion in the erlang-code and always >>>> let >>>> the c-code get what it expects. >>>> >>>> Regards Ingela Erlang/OTP-team ?-Ericsson AB >>>> >>>> >>>> Boris M?hmer wrote: >>>>> >>>>> Well, maybe I will be able to do such a user-contribution, because >>>>> either I get it running, find another way to access the Microsoft SQL >>>>> server from Erlang, or drop Erlang/OTP (nothing I want to do). >>>>> >>>>> I started to have a closer look at "odbcserver.c". My first success >>>>> was to get a SELECT query with a GUID "working". >>>>> >>>>> My question now is: what would be the "best" Erlang representation for >>>>> a >>>>> GUID? >>>>> >>>>> The C structure behind a GUID is (found in "sqltypes.h"): >>>>> ? ?typedef struct ?tagSQLGUID >>>>> ? ?{ >>>>> ? ? ? ?DWORD Data1; >>>>> ? ? ? ?WORD Data2; >>>>> ? ? ? ?WORD Data3; >>>>> ? ? ? ?BYTE Data4[ 8 ]; >>>>> ? ?} SQLGUID; >>>>> >>>>> For my 1st hack I used the following statements to transform this >>>>> struct to an Erlang tuple: >>>>> ? ? ? ?psg = (SQLGUID*)column.buffer; >>>>> ? ? ? ?ei_x_encode_tuple_header(&dynamic_buffer(state), 4); >>>>> ? ? ? ?ei_x_encode_ulong(&dynamic_buffer(state), psg->Data1); >>>>> ? ? ? ?ei_x_encode_ulong(&dynamic_buffer(state), psg->Data2); >>>>> ? ? ? ?ei_x_encode_ulong(&dynamic_buffer(state), psg->Data3); >>>>> ? ? ? ?ei_x_encode_tuple_header(&dynamic_buffer(state), 8); >>>>> ? ? ? ?for(i=0; i<8; i++){ >>>>> ? ? ? ? ? ?ei_x_encode_char(&dynamic_buffer(state), psg->Data4[i]); >>>>> ? ? ? ?} >>>>> >>>>> For example, this conversion results in: >>>>> ? ?19BCB12A-E6D1-4E58-A841-30F794C614FA => >>>>> ? ? ? ?{{431796522,59089,20056,{168,65,48,247,148,198,20,250}} >>>>> >>>>> ? ?703F9C47-F1B9-407E-847D-34840AC1E346 => >>>>> ? ? ? ?{1883216967,61881,16510,{132,125,52,132,10,193,227,70}} >>>>> >>>>> Somewhat odd to see how the C struct looks and how Microsoft "displays" >>>>> a >>>>> GUID. >>>>> >>>>> Should the Erlang representation be changed? Currently, I don't care >>>>> about how it is displayed; of course it would be nice to see something >>>>> more similar to the Microsoft way, on the other hand, it must't be >>>>> converted back in the c-driver. Would be a bit-string better? Or just >>>>> use a 128 Bit value? >>>>> >>>>> I really like to get some input on this. >>>>> >>>>> >>>>> ?- boris >>>>> >>>>> >>>>> 2011/12/9 Ingela Anderton Andin : >>>>> >>>>>> >>>>>> Hi! >>>>>> >>>>>> It seems to be a missing feature. Support for the data_type SQL_GUID >>>>>> is >>>>>> not >>>>>> implemented. >>>>>> I do not think it would be all that hard to implement but will not be >>>>>> highly >>>>>> prioritized by Ericsson. >>>>>> Maybe somebody would like to make a user-contribution?! You should >>>>>> start >>>>>> looking at the >>>>>> funtion encode_data_type in odbcserver.c >>>>>> >>>>>> Regards Ingela Erlang/OTP team - Ericsson AB >>>>>> >>>>>> Boris M?hmer wrote: >>>>>> >>>>>>> >>>>>>> I try to connect to one of our companies Microsoft SQL databases >>>>>>> using >>>>>>> Erlang/OTP R14B04 running on an Ubuntu 10.04 64 Bit installation >>>>>>> (using the FreeTDS drivers from the Ubuntu repositories). >>>>>>> >>>>>>> The problem I have is, that the Erlang ODBC module can't handle >>>>>>> 'uniqueidentifier' (aka GUID) fields in tables. For example a 'select >>>>>>> *' doesn't work, but when I only select the non-uniqueidentifier >>>>>>> fields from the same table it works. >>>>>>> >>>>>>> On the other hand, when I use the "isql" (commandline-)tool with the >>>>>>> same ODBC connection, I don't get any errors. >>>>>>> >>>>>>> So I would say that something within the Erlang ODBC module is broken >>>>>>> (I believe it is in "odbcserver.c"). >>>>>>> >>>>>>> Is this a known bug, or did I miss anything? >>>>>>> >>>>>>> >>>>>>> Regards, >>>>>>> Boris >>>>>>> _______________________________________________ >>>>>>> erlang-bugs mailing list >>>>>>> erlang-bugs@REDACTED >>>>>>> http://erlang.org/mailman/listinfo/erlang-bugs >>>>>>> >>>>>>> >>>>>>> >>>>>> >>>>>> >>>>> >>>>> _______________________________________________ >>>>> erlang-bugs mailing list >>>>> erlang-bugs@REDACTED >>>>> http://erlang.org/mailman/listinfo/erlang-bugs >>>>> >>>>> >>>> >>>> >>>> _______________________________________________ >>>> erlang-bugs mailing list >>>> erlang-bugs@REDACTED >>>> http://erlang.org/mailman/listinfo/erlang-bugs > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > From max.lapshin@REDACTED Tue Dec 13 12:20:07 2011 From: max.lapshin@REDACTED (Max Lapshin) Date: Tue, 13 Dec 2011 14:20:07 +0300 Subject: [erlang-questions] fd is larger than the largest allowed fd=1023 Message-ID: =ERROR REPORT==== 13-Dec-2011::15:19:24 === driver_select(0x0000000000000138, 1024, ERL_DRV_WRITE ERL_DRV_USE, 1) by tcp_inet driver #Port<0.9528> failed: fd=1024 is larger than the largest allowed fd=1023 What does it mean and how should I deal with it? From max.lapshin@REDACTED Tue Dec 13 12:22:00 2011 From: max.lapshin@REDACTED (Max Lapshin) Date: Tue, 13 Dec 2011 03:22:00 -0800 (PST) Subject: [erlang-questions] fd is larger than the largest allowed fd=1023 In-Reply-To: References: Message-ID: <28121303.465.1323775320422.JavaMail.geo-discussion-forums@yqfk19> It is Mac OS X 10.6 Snow Leopard. Should I just switch to Linux? -------------- next part -------------- An HTML attachment was scrubbed... URL: From ingela.andin@REDACTED Tue Dec 13 12:23:20 2011 From: ingela.andin@REDACTED (Ingela Andin) Date: Tue, 13 Dec 2011 12:23:20 +0100 Subject: [erlang-questions] ODBC to Erlang data mapping problem on OS X In-Reply-To: References: Message-ID: Hi! If think this ought to do it, as iodbc is the default and if you specify something it will not be iodbc but rather odbc. If you mac users out there think I am missing something please let me know! --- a/lib/odbc/configure.in +++ b/lib/odbc/configure.in @@ -135,12 +135,12 @@ AC_SUBST(TARGET_FLAGS) if test ! -d "$with_odbc" || test "$with_odbc" = "yes"; then ODBC_LIB= -L"/usr/lib" ODBC_INCLUDE="-I/usr/lib/include" + AC_CHECK_LIB(iodbc, SQLAllocHandle,[ODBC_LIB="$ODBC_LIB -liodbc"; odbc_lib_link_success=yes]) else ODBC_LIB=-L"$with_odbc/lib" ODBC_INCLUDE="-I$with_odbc/include" + AC_CHECK_LIB(odbc, SQLAllocHandle,[ODBC_LIB="$ODBC_LIB -lodbc"; odbc_lib_link_success=yes]) fi - - AC_CHECK_LIB(iodbc, SQLAllocHandle,[ODBC_LIB="$ODBC_LIB -liodbc"; odbc_lib_link_success=yes]) ;; win32|cygwin) TARGET_FLAGS="-DWIN32" Regards Ingela Erlang/OTP team - Ericsson AB 2011/12/11, Chad Phillips -- Apartment Lines : > Found the problem. It's a bug in the configure scripts located in lib/odbc > of the Erlang source code, which hard code '-liodbc' when $host_os is darwin > -- this prevents anyone from being able to properly link against a unixODBC > install on OS X, which needs '-lodbc' instead. > > In my case, via MacPorts, this apparently meant it was using the MacPorts > unixODBC headers, but linking against the default OS X iODBC lib, which I'm > guessing is what led to the weird behavior I was seeing. > > I've created a patch for the MacPorts version of Erlang, but I'm pretty > autoconf clueless, so all it does is hard code '-lodbc' in place of > '-liodbc', which is clearly not the right upstream solution. ;) > > If there's anything else I can do to help fix this bug, please let me know. > > Thanks, > > Chad > > From elinsn@REDACTED Tue Dec 13 12:25:20 2011 From: elinsn@REDACTED (Sergey Yelin) Date: Tue, 13 Dec 2011 15:25:20 +0400 Subject: [erlang-questions] fd is larger than the largest allowed fd=1023 In-Reply-To: References: Message-ID: <5C01AFD7-C7EF-45AA-BE9A-9651B2B1B040@gmail.com> It's possible you have limit to 1024 open descriptors in your system. What does ulimit -n returns? On Dec 13, 2011, at 3:20 PM, Max Lapshin wrote: > =ERROR REPORT==== 13-Dec-2011::15:19:24 === > driver_select(0x0000000000000138, 1024, ERL_DRV_WRITE ERL_DRV_USE, 1) > by tcp_inet driver #Port<0.9528> failed: fd=1024 is larger than the > largest allowed fd=1023 > > > What does it mean and how should I deal with it? > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions From joelr1@REDACTED Tue Dec 13 12:26:28 2011 From: joelr1@REDACTED (Joel Reymont) Date: Tue, 13 Dec 2011 11:26:28 +0000 Subject: [erlang-questions] =?utf-8?q?fd_is_larger_than_the_largest_allowe?= =?utf-8?q?d_fd=3D1023?= In-Reply-To: <28121303.465.1323775320422.JavaMail.geo-discussion-forums@yqfk19> References: <28121303.465.1323775320422.JavaMail.geo-discussion-forums@yqfk19> Message-ID: <9B420D82DDC54DF0979C55C0CECC9150@gmail.com> Yes, do switch, you'll get higher performance overall. Alternatively, look up a long related thread a few weeks ago and hack around the limit: 1) Save old epmd. 2) Modify __DARWIN_FD_SETSIZE in /usr/include/sys/_structs.h and make it, say, 16384. 3) Recompile Erlang. 4) Restore old epmd since it can't handle more than 1024 fds. --- Hardcore embedded Linux development http://www.linkedin.com/in/joelreymont Debugging, firmware and device drivers On Tuesday, December 13, 2011 at 11:22 AM, Max Lapshin wrote: > It is Mac OS X 10.6 Snow Leopard. > > Should I just switch to Linux? > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED (mailto:erlang-questions@REDACTED) > http://erlang.org/mailman/listinfo/erlang-questions From cgsmcmlxxv@REDACTED Tue Dec 13 12:27:10 2011 From: cgsmcmlxxv@REDACTED (CGS) Date: Tue, 13 Dec 2011 12:27:10 +0100 Subject: [erlang-questions] fd is larger than the largest allowed fd=1023 In-Reply-To: References: Message-ID: <4EE7368E.3090004@gmail.com> I don't know if it will help, but you can try to add `+P 10000 -env ERL_MAX_PORTS 10000' to your erl command (fd = file descriptor = 1024 by default; it should be increased by what I gave you - in the example I gave you, you increase to 10k). CGS On 12/13/2011 12:20 PM, Max Lapshin wrote: > =ERROR REPORT==== 13-Dec-2011::15:19:24 === > driver_select(0x0000000000000138, 1024, ERL_DRV_WRITE ERL_DRV_USE, 1) > by tcp_inet driver #Port<0.9528> failed: fd=1024 is larger than the > largest allowed fd=1023 > > > What does it mean and how should I deal with it? > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions From joelr1@REDACTED Tue Dec 13 12:28:29 2011 From: joelr1@REDACTED (Joel Reymont) Date: Tue, 13 Dec 2011 11:28:29 +0000 Subject: [erlang-questions] erlcloud s3 example Message-ID: <480A03238FC849D9AC47B8E022EF412B@gmail.com> Does anyone have an example of how to use erlcloud [1] with S3? I cannot figure out how to feed it the Amazon AWS credentials. Thanks, Joel [1] https://github.com/nivertech/erlcloud --- Hardcore embedded Linux development http://www.linkedin.com/in/joelreymont Debugging, firmware and device drivers From max.lapshin@REDACTED Tue Dec 13 12:30:10 2011 From: max.lapshin@REDACTED (Max Lapshin) Date: Tue, 13 Dec 2011 14:30:10 +0300 Subject: [erlang-questions] fd is larger than the largest allowed fd=1023 In-Reply-To: <4EE7368E.3090004@gmail.com> References: <4EE7368E.3090004@gmail.com> Message-ID: Mac OS is just for tests, my work laptop. If I need to recompile, than I'll just launch some instances =) From qoocku@REDACTED Tue Dec 13 17:17:40 2011 From: qoocku@REDACTED (=?UTF-8?B?RGFtaWFuIERvYnJvY3p5xYRza2k=?=) Date: Tue, 13 Dec 2011 17:17:40 +0100 Subject: [erlang-questions] Error compiling the latest git repo Message-ID: <4EE77AA4.30105@gmail.com> Hi list. I've obtained such error while compiling Erlang from the freshest github otp repo ("master" branch): ... erlc -W +debug_info +inline -o../ebin hipe_rtl.erl {"init terminating in do_boot",{'cannot get bootfile','start_clean.boot'}} What is the possible reason? -- D. From tomas.abrahamsson@REDACTED Tue Dec 13 18:24:24 2011 From: tomas.abrahamsson@REDACTED (Tomas Abrahamsson) Date: Tue, 13 Dec 2011 18:24:24 +0100 Subject: [erlang-questions] performance drop in R15A? In-Reply-To: (Tomas Abrahamsson's message of "Fri, 9 Dec 2011 16:01:38 +0100") References: <1359554.YeRYZETzs8@csr-pc40.zib.de> <2086353.lGPuiOpM5q@csr-pc40.zib.de> <4458388.uS11NqXNlV@csr-pc40.zib.de> <1789335.0VPehH53Ub@csr-pc40.zib.de> Message-ID: Nico Kruber wrote: NK>>>>>>> With our internal benchmarks ("make bench") showed a drop of NK>>>>>>> around 15% in performance compared to R14B04. [...] Kenneth Lundin wrote: KL>> When working with R15B we are of course performing a number of KL>> bencmarks to keep track of the performance. KL>> KL>> Whe always strive to improve general performance in each release AND KL>> OUR BENCHMARKS INDICATE THAT R15B IS FASTER IN GENERAL THAN R14B04. KL>> KL>> It is however always possible that some specific operations or KL>> combinations of operations get slower while others are optimized. I wrote: TA> We, too, have seen a performance drop similar to what TA> Nico has observed [...] Hi again, (replying to self ... hmm :) ) well, anyway, status update: we've further developed our prototype a bit, experimented a bit with various scheduler bind settings and also a bit with erlang process communication patterns, and now it seems that the performance of R15A for our protoype is well on par with R14B04. We can no longer say that R15 is slower. (We haven't tracked down exactly why we earlier saw R15 to be slower, but we don't see it anymore.) BRs Tomas From mail@REDACTED Tue Dec 13 18:26:09 2011 From: mail@REDACTED (Tim Fletcher) Date: Tue, 13 Dec 2011 09:26:09 -0800 (PST) Subject: [erlang-questions] erlcloud s3 example In-Reply-To: <480A03238FC849D9AC47B8E022EF412B@gmail.com> References: <480A03238FC849D9AC47B8E022EF412B@gmail.com> Message-ID: <4230e80e-d769-428c-b5e2-cd5f824733ca@i6g2000vbe.googlegroups.com> > Does anyone have an example of how to use erlcloud [1] with S3? > I cannot figure out how to feed it the Amazon AWS credentials. Looks like it loads credentials from the environment by default, so you would have to set AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY. Alternatively you can set the config manually, something like this: -include("erlcloud_aws.hrl"). ... put(aws_config, #aws_config{access_key_id=AccessKeyID, secret_access_key=SecretAccessKey}), Then for example: erlcloud_s3:list_buckets(). Hope that helps. Tim From joelr1@REDACTED Tue Dec 13 18:31:39 2011 From: joelr1@REDACTED (Joel Reymont) Date: Tue, 13 Dec 2011 17:31:39 +0000 Subject: [erlang-questions] erlcloud s3 example In-Reply-To: <4230e80e-d769-428c-b5e2-cd5f824733ca@i6g2000vbe.googlegroups.com> References: <480A03238FC849D9AC47B8E022EF412B@gmail.com> <4230e80e-d769-428c-b5e2-cd5f824733ca@i6g2000vbe.googlegroups.com> Message-ID: Thanks Tim! I fixed this in my fork of erlcloud at http://github.com/wagerlabs/erlcloud. --- Hardcore embedded Linux development http://www.linkedin.com/in/joelreymont Debugging, firmware and device drivers On Tuesday, December 13, 2011 at 5:26 PM, Tim Fletcher wrote: > > Does anyone have an example of how to use erlcloud [1] with S3? > > I cannot figure out how to feed it the Amazon AWS credentials. > > > > Looks like it loads credentials from the environment by default, so > you would have to set AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY. > > Alternatively you can set the config manually, something like this: > > -include("erlcloud_aws.hrl"). > > ... > > put(aws_config, #aws_config{access_key_id=AccessKeyID, > secret_access_key=SecretAccessKey}), > > Then for example: > > erlcloud_s3:list_buckets(). > > Hope that helps. > > Tim > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED (mailto:erlang-questions@REDACTED) > http://erlang.org/mailman/listinfo/erlang-questions From laforge@REDACTED Tue Dec 13 18:37:51 2011 From: laforge@REDACTED (Harald Welte) Date: Tue, 13 Dec 2011 18:37:51 +0100 Subject: [erlang-questions] hierarchical behaviour doesn't seem to work ? Message-ID: <20111213173751.GE10252@prithivi.gnumonks.org> Hi! I am trying to get some code to work, but I have the feeling that hierarchical/netsted 'behaviour' doens't really work quite well. Let's assume I want to defined a behaviour, which in turn is derived from gen_server. The name of the module is "my_behaviour". It exports the required "behaviour_info/1" function, and implements all the gen_server call-backs. Then, I'm creating an actual program, let's call it "client". "client.erl" states "-behaviour(my_behaviour)" and implements the required call-backs of my_behaviour. However, now if the runtime delivers something like a gen_server method such as gen_cast/gen_call, etc., it tries to call client:handle_cast() instead of the my_behaviour:handle_cast(). And since client:handle_cast() is not defined, it will crash the process. Is this really the intended behaviour (sic) of behaviour? To me, it seems most logical that you would want to implement levels of common functionality in a behaviour, and "sub-class" a number of different implementations off such a behaviour. And since all of it should be OTP compliant, that custom behaviour itself would be based on some OTP behaviour like gen_server, gen_fsm, etc. Any comments? Am I misunderstanding something here? Thanks! -- - Harald Welte http://laforge.gnumonks.org/ ============================================================================ "Privacy in residential applications is a desirable marketing option." (ETSI EN 300 175-7 Ch. A6) From fernando.benavides@REDACTED Tue Dec 13 18:47:27 2011 From: fernando.benavides@REDACTED (Fernando "Brujo" Benavides) Date: Tue, 13 Dec 2011 14:47:27 -0300 Subject: [erlang-questions] hierarchical behaviour doesn't seem to work ? In-Reply-To: <20111213173751.GE10252@prithivi.gnumonks.org> References: <20111213173751.GE10252@prithivi.gnumonks.org> Message-ID: <7CAC22C4-8E94-45F7-9896-3A3F06B4C523@inakanetworks.com> Hi, I think it basically depends on how do you define your my_behaviour module. This is an example of a module that implements gen_server but defines its own behaviour (called itweep). You can see there the gen_server is started using itweep as the callback module, but itweep is started using the desired callback module (in your case, client), for instance: start(Mod, Args, Options) -> ? gen_server:start(?MODULE, {Mod, Args, User, Password, StreamTimeout}, OtherOptions). That way, the gen_server uses itweep callback functions, but itweep itself uses client callback functions. Hope this helps, Cheers! On 13/12/2011, at 14:37, Harald Welte wrote: > Hi! > > I am trying to get some code to work, but I have the feeling that > hierarchical/netsted 'behaviour' doens't really work quite well. > > Let's assume I want to defined a behaviour, which in turn is derived > from gen_server. The name of the module is "my_behaviour". It exports > the required "behaviour_info/1" function, and implements all the > gen_server call-backs. > > Then, I'm creating an actual program, let's call it "client". > "client.erl" states "-behaviour(my_behaviour)" and implements the > required call-backs of my_behaviour. > > However, now if the runtime delivers something like a gen_server method > such as gen_cast/gen_call, etc., it tries to call client:handle_cast() > instead of the my_behaviour:handle_cast(). And since > client:handle_cast() is not defined, it will crash the process. > > Is this really the intended behaviour (sic) of behaviour? > > To me, it seems most logical that you would want to implement levels of > common functionality in a behaviour, and "sub-class" a number of different > implementations off such a behaviour. And since all of it should be OTP > compliant, that custom behaviour itself would be based on some OTP > behaviour like gen_server, gen_fsm, etc. > > Any comments? Am I misunderstanding something here? Thanks! > -- > - Harald Welte http://laforge.gnumonks.org/ > ============================================================================ > "Privacy in residential applications is a desirable marketing option." > (ETSI EN 300 175-7 Ch. A6) > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions ____________________________ Fernando "Brujo" Benavides fernando.benavides@REDACTED -------------- next part -------------- An HTML attachment was scrubbed... URL: From jsmastropiero@REDACTED Tue Dec 13 19:49:08 2011 From: jsmastropiero@REDACTED (Claudio A. Costagliola Fiedler) Date: Tue, 13 Dec 2011 15:49:08 -0300 Subject: [erlang-questions] Cannot build R14B04 in Solaris 10 with libatomic_ops In-Reply-To: References: Message-ID: Hi, I've been unsuccesfully tying to build OTP in this platform, using the Sun Studio compiler (cc). I'm not been able to configure the build, because the configure script fails when it looks up for a usable libatomic_ops installation. Such library has been successfully built and is available for OTP building process. The configure command: ./configure CC='cc' ERL_TOP='' --prefix= --enable-threads --enable-smp-support --enable-hipe --enable-native-libs --enable-shared-zlib --with-libatomic_ops= The output: . . . checking for sched_yield... no checking for sched_yield in -lrt... yes checking whether sched_yield() returns an int... yes checking for pthread_yield... no checking for pthread_rwlock_init... yes checking for pthread_rwlockattr_setkind_np... no checking for pthread_attr_setguardsize... yes checking for Linux futexes... no checking for GCC atomic operations... no checking for a usable libatomic_ops implementation... no configure: error: No usable libatomic_ops implementation found configure: error: /bin/bash '/produccion/tmmprov2/claudio/temp/otp_src_R14B04/erts/configure' failed for erts Any help would be appreciated. Regards, -- Claudio A. Costagliola Fiedler -------------- next part -------------- An HTML attachment was scrubbed... URL: From lukas@REDACTED Tue Dec 13 20:50:48 2011 From: lukas@REDACTED (Lukas Larsson) Date: Tue, 13 Dec 2011 20:50:48 +0100 Subject: [erlang-questions] Error compiling the latest git repo In-Reply-To: <4EE77AA4.30105@gmail.com> References: <4EE77AA4.30105@gmail.com> Message-ID: git clean -Xfd . export ERL_TOP=/path/to/repo ./otp_build setup -a That little script usually solves all my compile issues. If that does not help you probably have some issue with your toolchain. Lukas On Dec 13, 2011 5:17 PM, "Damian Dobroczy?ski" wrote: > Hi list. > > I've obtained such error while compiling Erlang from the freshest github > otp repo ("master" branch): > > ... > erlc -W +debug_info +inline -o../ebin hipe_rtl.erl > {"init terminating in do_boot",{'cannot get bootfile','start_clean.boot'}} > > What is the possible reason? > > -- D. > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jsmastropiero@REDACTED Tue Dec 13 21:28:09 2011 From: jsmastropiero@REDACTED (Claudio A. Costagliola Fiedler) Date: Tue, 13 Dec 2011 17:28:09 -0300 Subject: [erlang-questions] Cannot build R14B04 in Solaris 10 with libatomic_ops In-Reply-To: References: Message-ID: Hi, I've been unsuccesfully tying to build OTP in this platform, using the Sun Studio compiler (cc). I'm not been able to configure the build, because the configure script fails when it looks up for a usable libatomic_ops installation. Such library has been successfully built and is available for OTP building process. The configure command: ./configure CC='cc' ERL_TOP='' --prefix= --enable-threads --enable-smp-support --enable-hipe --enable-native-libs --enable-shared-zlib --with-libatomic_ops= The output: . . . checking for sched_yield... no checking for sched_yield in -lrt... yes checking whether sched_yield() returns an int... yes checking for pthread_yield... no checking for pthread_rwlock_init... yes checking for pthread_rwlockattr_setkind_np... no checking for pthread_attr_setguardsize... yes checking for Linux futexes... no checking for GCC atomic operations... no checking for a usable libatomic_ops implementation... no configure: error: No usable libatomic_ops implementation found configure: error: /bin/bash '/produccion/tmmprov2/claudio/temp/otp_src_R14B04/erts/configure' failed for erts Any help would be appreciated. Regards, -- Claudio A. Costagliola Fiedler -------------- next part -------------- An HTML attachment was scrubbed... URL: From spawn.think@REDACTED Tue Dec 13 22:10:53 2011 From: spawn.think@REDACTED (Ahmed Omar) Date: Tue, 13 Dec 2011 22:10:53 +0100 Subject: [erlang-questions] Another Erlang Hangout Message-ID: Dear All, We will have another Erlang video hangout this week, come and join us! https://plus.google.com/b/108730584872406072872/108730584872406072872/posts/2iimRUh6SAq +Max Bourinov would like to shortly present a project done by his team and will be looking for feedback! Of course other questions and discussions are welcome if time permits! (You can post questions in advance by commenting on this post, or on twitter using hashtag #erlanghangout) Date: Thursday 15th December Time: 7pm GMT -- Best Regards, - Ahmed Omar http://nl.linkedin.com/in/adiaa Follow me on twitter @spawn_think -------------- next part -------------- An HTML attachment was scrubbed... URL: From torben.lehoff@REDACTED Tue Dec 13 23:30:46 2011 From: torben.lehoff@REDACTED (Torben Hoffmann) Date: Tue, 13 Dec 2011 23:30:46 +0100 Subject: [erlang-questions] How do I start gproc in a global way? Message-ID: <4EE7D216.4040707@gmail.com> Hi, I am trying to do a gproc:reg({n,g,somename}), but all I get for Christmas is: CRASH REPORT Process <0.944.0> with 0 neighbours crashed with reason: {local_only,[{gproc,reg,2},{sb_coordinator,init,1},{gen_server,init_it,6},{proc_lib,init_p_do_apply,3}]} I guess that gproc has to be started with some global mindset before I can use global names, but I cannot figure out how to provide that argument. I am using rebar so my second guess is that I need to change my apps .app.src file and put the correct thing into the env list. I have tried to read the documentation, but I have so far failed to figure out how to do this and google has not been kind to me tonight. Any advice is most welcome! Cheers, Torben From ulf@REDACTED Wed Dec 14 00:10:54 2011 From: ulf@REDACTED (Ulf Wiger) Date: Wed, 14 Dec 2011 00:10:54 +0100 Subject: [erlang-questions] How do I start gproc in a global way? In-Reply-To: <4EE7D216.4040707@gmail.com> References: <4EE7D216.4040707@gmail.com> Message-ID: <52D55884-77AF-484A-9AB7-0D55B8F60ED4@feuerlabs.com> The answer is in the code? https://github.com/uwiger/gproc/blob/master/src/gproc_sup.erl#L44 That is, use e.g. erl -gproc gproc_dist Opts where the simplest setting is -gproc gproc_dist all https://github.com/uwiger/gproc/blob/master/src/gproc_dist.erl#L71 You can set Opts to all | Nodes | {Nodes, GenLeaderOpts} What GenLeaderOpts are depends a litre bit on which gen_leader you use. As gen_leader doesn't handle net splits, you should ensure that nodes connect _before_ you start gproc_dist. BR, Ulf W On 13 Dec 2011, at 23:30, Torben Hoffmann wrote: > Hi, > > I am trying to do a gproc:reg({n,g,somename}), but all I get for Christmas is: > > CRASH REPORT Process <0.944.0> with 0 neighbours crashed with reason: {local_only,[{gproc,reg,2},{sb_coordinator,init,1},{gen_server,init_it,6},{proc_lib,init_p_do_apply,3}]} > > I guess that gproc has to be started with some global mindset before I can use global names, but I cannot figure out how to provide that argument. > > I am using rebar so my second guess is that I need to change my apps .app.src file and put the correct thing into the env list. > > I have tried to read the documentation, but I have so far failed to figure out how to do this and google has not been kind to me tonight. > > Any advice is most welcome! > > Cheers, > Torben > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions From chad@REDACTED Wed Dec 14 00:17:13 2011 From: chad@REDACTED (Chad Phillips -- Apartment Lines) Date: Tue, 13 Dec 2011 15:17:13 -0800 Subject: [erlang-questions] ODBC to Erlang data mapping problem on OS X In-Reply-To: References: Message-ID: <7B35E375-3459-4FA3-8AD0-66A006DD4F1B@apartmentlines.com> i've applied this patch to the R14B04 source code, re-ran autoconf from within lib/odbc to generate an updated configure script, then ran './configure --with-odbc=/opt/local' from the top level of the source. however, i'm getting this: ODBC library - link check failed list of related symbols from the lib: nm /opt/local/lib/libodbc.dylib | grep SQLAllocHandle 0000000000002050 T _SQLAllocHandle 0000000000002070 T _SQLAllocHandleStd 0000000000000ea0 t ___SQLAllocHandle autoconf version: autoconf (GNU Autoconf) 2.68 oddly enough, running './configure --with-odbc=yes' properly finds the iODBC library, so i'm not really sure what's wrong here, but something definitely is not working as planned. :) chad On Dec 13, 2011, at 3:23 AM, Ingela Andin wrote: > Hi! > > If think this ought to do it, as iodbc is the default and if you > specify something it > will not be iodbc but rather odbc. If you mac users out there think I > am missing something > please let me know! > > --- a/lib/odbc/configure.in > +++ b/lib/odbc/configure.in > @@ -135,12 +135,12 @@ AC_SUBST(TARGET_FLAGS) > if test ! -d "$with_odbc" || test "$with_odbc" = "yes"; then > ODBC_LIB= -L"/usr/lib" > ODBC_INCLUDE="-I/usr/lib/include" > + AC_CHECK_LIB(iodbc, > SQLAllocHandle,[ODBC_LIB="$ODBC_LIB -liodbc"; > odbc_lib_link_success=yes]) > else > ODBC_LIB=-L"$with_odbc/lib" > ODBC_INCLUDE="-I$with_odbc/include" > + AC_CHECK_LIB(odbc, > SQLAllocHandle,[ODBC_LIB="$ODBC_LIB -lodbc"; > odbc_lib_link_success=yes]) > fi > - > - AC_CHECK_LIB(iodbc, > SQLAllocHandle,[ODBC_LIB="$ODBC_LIB -liodbc"; > odbc_lib_link_success=yes]) > ;; > win32|cygwin) > TARGET_FLAGS="-DWIN32" > > Regards Ingela Erlang/OTP team - Ericsson AB > > > 2011/12/11, Chad Phillips -- Apartment Lines : >> Found the problem. It's a bug in the configure scripts located in lib/odbc >> of the Erlang source code, which hard code '-liodbc' when $host_os is darwin >> -- this prevents anyone from being able to properly link against a unixODBC >> install on OS X, which needs '-lodbc' instead. >> >> In my case, via MacPorts, this apparently meant it was using the MacPorts >> unixODBC headers, but linking against the default OS X iODBC lib, which I'm >> guessing is what led to the weird behavior I was seeing. >> >> I've created a patch for the MacPorts version of Erlang, but I'm pretty >> autoconf clueless, so all it does is hard code '-lodbc' in place of >> '-liodbc', which is clearly not the right upstream solution. ;) >> >> If there's anything else I can do to help fix this bug, please let me know. >> >> Thanks, >> >> Chad >> >> From barcojie@REDACTED Wed Dec 14 04:59:10 2011 From: barcojie@REDACTED (Barco You) Date: Wed, 14 Dec 2011 11:59:10 +0800 Subject: [erlang-questions] [ANN] Erlang Computer Systems Management CONSole (or ECSMCons) In-Reply-To: References: Message-ID: Does it manage the Erlang VM? or the physical computer on which erlang-vm is running? Regards, Barco On Sat, Dec 10, 2011 at 4:37 AM, Wes James wrote: > I would like to announce ECSMCons. Why was this developed? I have > used other systems management suites to help manage a student computer > lab, but the experience was very disappointing. > > One day I was contemplating the message passing capabilities of Erlang > and thought, what if I had a web interface that talked to an Erlang > back-end via web sockets to send messages to the workstations to do > things. ECSMCons is a result of this. > > The following is from the top of the README at the github.com repo: > > > -------------------------------------------------------------------------------------------- > Erlang Computer Systems Management CONSole (or ECSMCons) > Version 1.0 > > ECSMCons is an Erlang based client/server computer systems > management console in which a web browser (with websockets > support) is used to manage computer systems. > > Features: > > Server > > Operations that can be performed on the client from the server: > > Reboot, shutdown, restart or stop erlang service, ping, wake-on-lan, > when Faronics Deep Freeze is available: freeze, thaw and get status > copy file to client and run command on client. When the All command > check box is selected, then only the checked workstations will have > that command done on them. Restrict access based on IP address and > username/password (both configurable in ecsmcons.conf). > > Client > > The client periodically sends messages to the server to indicate > whether the system is "Up" and which user is logged in. It also > does the command processing sent from the server. > > > -------------------------------------------------------------------------------------------- > > For more details the project can be found here: > > https://github.com/comptekki/ecsmcons > > Thanks, > > -wes > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From comptekki@REDACTED Wed Dec 14 06:13:02 2011 From: comptekki@REDACTED (Wes James) Date: Tue, 13 Dec 2011 22:13:02 -0700 Subject: [erlang-questions] [ANN] Erlang Computer Systems Management CONSole (or ECSMCons) In-Reply-To: References: Message-ID: It is for managing the computer. For instance, with my student computer lab of 60+ windows 7 (25 dual boot OS X Lion), I can view each lab with a set of workstations then work on each workstation individually or as a set if the checkbox on the workstation and on the "all" command, i.e. copy a file All command will copy a file to all workstations or if checked will copy only to checked workstations, and so forth. An example: I copied the update of chrome 16 to to about 5-6 workstations at a time to work around the students in a lab today. After I run the Copy all, I then run the Com All which then installs chrome on each system. Each of these is a selection on chrome then a click on the command on the console (web browser view of the lab). This process is done by running misultin in websocket mode and commands in the browser send data to the websocket which is sent to an erlang program waiting for commands which can send commands to all the workstations that have an erlang program waiting for commands, but every 60 seconds is sending data back to the erlang program which talks to the web socket which updates the consol about systems that are up and who is logged in. With this data on the console (web browser page) there are javascript routines that can tell me if a system has logged in users or not, counts the users in each lab, has a total for all labs and will tell me if the same user is logged in to more than one machine - students aren't supposed to be sharing their accounts ;) -wes On Tue, Dec 13, 2011 at 8:59 PM, Barco You wrote: > Does it manage the Erlang VM? or the physical computer on which erlang-vm is > running? > > > Regards, > Barco > > On Sat, Dec 10, 2011 at 4:37 AM, Wes James wrote: >> >> I would like to announce ECSMCons. ?Why was this developed? ?I have >> used other systems management suites to help manage a student computer >> lab, but the experience was very disappointing. >> >> One day I was contemplating the message passing capabilities of Erlang >> and thought, what if I had a web interface that talked to an Erlang >> back-end via web sockets to send messages to the workstations to do >> things. ?ECSMCons is a result of this. >> >> The following is from the top of the README at the github.com repo: >> >> >> -------------------------------------------------------------------------------------------- >> Erlang Computer Systems Management CONSole (or ECSMCons) >> Version 1.0 >> >> ECSMCons is an Erlang based client/server computer systems >> management console in which a web browser (with websockets >> support) is used to manage computer systems. >> >> Features: >> >> Server >> >> Operations that can be performed on the client from the server: >> >> Reboot, shutdown, restart or stop erlang service, ping, wake-on-lan, >> when Faronics Deep Freeze is available: freeze, thaw and get status >> copy file to client and run command on client. ?When the All command >> check box is selected, then only the checked workstations will have >> that command done on them. Restrict access based on IP address and >> username/password (both configurable in ecsmcons.conf). >> >> Client >> >> The client periodically sends messages to the server to indicate >> whether the system is "Up" and which user is logged in. ?It also >> does the command processing sent from the server. >> >> >> -------------------------------------------------------------------------------------------- >> >> For more details the project can be found here: >> >> https://github.com/comptekki/ecsmcons >> >> Thanks, >> >> -wes >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://erlang.org/mailman/listinfo/erlang-questions > > From barcojie@REDACTED Wed Dec 14 06:19:58 2011 From: barcojie@REDACTED (Barco You) Date: Wed, 14 Dec 2011 13:19:58 +0800 Subject: [erlang-questions] [ANN] Erlang Computer Systems Management CONSole (or ECSMCons) In-Reply-To: References: Message-ID: Sounds nice! I'll try it to manage my CDN nodes ... On Wed, Dec 14, 2011 at 1:13 PM, Wes James wrote: > It is for managing the computer. For instance, with my student > computer lab of 60+ windows 7 (25 dual boot OS X Lion), I can view > each lab with a set of workstations then work on each workstation > individually or as a set if the checkbox on the workstation and on the > "all" command, i.e. copy a file All command will copy a file to all > workstations or if checked will copy only to checked workstations, and > so forth. > > An example: I copied the update of chrome 16 to to about 5-6 > workstations at a time to work around the students in a lab today. > After I run the Copy all, I then run the Com All which then installs > chrome on each system. Each of these is a selection on chrome then a > click on the command on the console (web browser view of the lab). > > This process is done by running misultin in websocket mode and > commands in the browser send data to the websocket which is sent to an > erlang program waiting for commands which can send commands to all the > workstations that have an erlang program waiting for commands, but > every 60 seconds is sending data back to the erlang program which > talks to the web socket which updates the consol about systems that > are up and who is logged in. With this data on the console (web > browser page) there are javascript routines that can tell me if a > system has logged in users or not, counts the users in each lab, has a > total for all labs and will tell me if the same user is logged in to > more than one machine - students aren't supposed to be sharing their > accounts ;) > > -wes > > On Tue, Dec 13, 2011 at 8:59 PM, Barco You wrote: > > Does it manage the Erlang VM? or the physical computer on which > erlang-vm is > > running? > > > > > > Regards, > > Barco > > > > On Sat, Dec 10, 2011 at 4:37 AM, Wes James wrote: > >> > >> I would like to announce ECSMCons. Why was this developed? I have > >> used other systems management suites to help manage a student computer > >> lab, but the experience was very disappointing. > >> > >> One day I was contemplating the message passing capabilities of Erlang > >> and thought, what if I had a web interface that talked to an Erlang > >> back-end via web sockets to send messages to the workstations to do > >> things. ECSMCons is a result of this. > >> > >> The following is from the top of the README at the github.com repo: > >> > >> > >> > -------------------------------------------------------------------------------------------- > >> Erlang Computer Systems Management CONSole (or ECSMCons) > >> Version 1.0 > >> > >> ECSMCons is an Erlang based client/server computer systems > >> management console in which a web browser (with websockets > >> support) is used to manage computer systems. > >> > >> Features: > >> > >> Server > >> > >> Operations that can be performed on the client from the server: > >> > >> Reboot, shutdown, restart or stop erlang service, ping, wake-on-lan, > >> when Faronics Deep Freeze is available: freeze, thaw and get status > >> copy file to client and run command on client. When the All command > >> check box is selected, then only the checked workstations will have > >> that command done on them. Restrict access based on IP address and > >> username/password (both configurable in ecsmcons.conf). > >> > >> Client > >> > >> The client periodically sends messages to the server to indicate > >> whether the system is "Up" and which user is logged in. It also > >> does the command processing sent from the server. > >> > >> > >> > -------------------------------------------------------------------------------------------- > >> > >> For more details the project can be found here: > >> > >> https://github.com/comptekki/ecsmcons > >> > >> Thanks, > >> > >> -wes > >> _______________________________________________ > >> erlang-questions mailing list > >> erlang-questions@REDACTED > >> http://erlang.org/mailman/listinfo/erlang-questions > > > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From dmkolesnikov@REDACTED Wed Dec 14 06:48:09 2011 From: dmkolesnikov@REDACTED (Dmitry Kolesnikov) Date: Wed, 14 Dec 2011 07:48:09 +0200 Subject: [erlang-questions] hierarchical behaviour doesn't seem to work ? In-Reply-To: <20111213173751.GE10252@prithivi.gnumonks.org> References: <20111213173751.GE10252@prithivi.gnumonks.org> Message-ID: Hi, If you are trying to achieve a "polymorphism" then nested behaviours is not a right thing. It is very difficult to justify when use nested behaviours when not. As an example I have implemented a plugin interface via nested behaviour but it could be done through other way around. Dmitry On 13.12.2011, at 19.37, Harald Welte wrote: > Hi! > > I am trying to get some code to work, but I have the feeling that > hierarchical/netsted 'behaviour' doens't really work quite well. > > Let's assume I want to defined a behaviour, which in turn is derived > from gen_server. The name of the module is "my_behaviour". It exports > the required "behaviour_info/1" function, and implements all the > gen_server call-backs. > > Then, I'm creating an actual program, let's call it "client". > "client.erl" states "-behaviour(my_behaviour)" and implements the > required call-backs of my_behaviour. > > However, now if the runtime delivers something like a gen_server method > such as gen_cast/gen_call, etc., it tries to call client:handle_cast() > instead of the my_behaviour:handle_cast(). And since > client:handle_cast() is not defined, it will crash the process. > > Is this really the intended behaviour (sic) of behaviour? > > To me, it seems most logical that you would want to implement levels of > common functionality in a behaviour, and "sub-class" a number of different > implementations off such a behaviour. And since all of it should be OTP > compliant, that custom behaviour itself would be based on some OTP > behaviour like gen_server, gen_fsm, etc. > > Any comments? Am I misunderstanding something here? Thanks! > -- > - Harald Welte http://laforge.gnumonks.org/ > ============================================================================ > "Privacy in residential applications is a desirable marketing option." > (ETSI EN 300 175-7 Ch. A6) > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions From vances@REDACTED Wed Dec 14 08:55:40 2011 From: vances@REDACTED (Vance Shipley) Date: Wed, 14 Dec 2011 13:25:40 +0530 Subject: [erlang-questions] hierarchical behaviour doesn't seem to work ? In-Reply-To: <20111213173751.GE10252@prithivi.gnumonks.org> References: <20111213173751.GE10252@prithivi.gnumonks.org> Message-ID: <20111214075539.GB298@aluminum.motivity.ca> Harald, I wrote a howto article on this a few years ago: http://www.trapexit.org/Cascading_Behaviours On Tue, Dec 13, 2011 at 06:37:51PM +0100, Harald Welte wrote: } However, now if the runtime delivers something like a gen_server method } such as gen_cast/gen_call, etc., it tries to call client:handle_cast() } instead of the my_behaviour:handle_cast(). And since } client:handle_cast() is not defined, it will crash the process. Yes, you need to define these functions in your module. Your client may extend these itself and/or pass them on to my_bahaviour. } Is this really the intended behaviour (sic) of behaviour? Yes. } To me, it seems most logical that you would want to implement levels of } common functionality in a behaviour, and "sub-class" a number of different } implementations off such a behaviour. And since all of it should be OTP } compliant, that custom behaviour itself would be based on some OTP } behaviour like gen_server, gen_fsm, etc. } } Any comments? Am I misunderstanding something here? Thanks! Cascading behaviours wasn't anticipated in the design and, aside from me, very few people have used that design pattern. -- -Vance From dmkolesnikov@REDACTED Wed Dec 14 09:22:03 2011 From: dmkolesnikov@REDACTED (dmitry kolesnikov) Date: Wed, 14 Dec 2011 10:22:03 +0200 Subject: [erlang-questions] Building small erlang vm suitable for bundle with app. In-Reply-To: <81f1931c-eaf6-45e7-b0ea-d3b52b2baa7f@knuth> References: <81f1931c-eaf6-45e7-b0ea-d3b52b2baa7f@knuth> Message-ID: Hi, I have not yet spent too much time to investigate how to build 2MB self-sustainable package but systools gives me about 14MB with possible reduction to 7 - 9MB on debian 64bit. as an example *.rel package contains following libraries: {kernel, "2.14.5"}, {stdlib, "1.17.5"}, {sasl, "2.1.10"}, {crypto, "2.0.4"}, {public_key, "0.13"}, {ssl, "4.1.6"}, {inets, "5.7.1"}, {compiler, "4.7.5"}, {syntax_tools, "1.6.7.1"}, {xmerl, "1.2.10"}, {mochiweb, "2.3.0"} ... systools:make_tar($$n, [{erts, code:root_dir()}]) %% do not put any extra dirs here most heavy components are VM by itself -rwxr-xr-x 1 kolesnik wheel 7.7M Oct 19 20:53 beam -rwxr-xr-x 1 kolesnik wheel 9.6M Oct 19 20:53 beam.smp - Dmitry On Tue, Dec 13, 2011 at 10:59 AM, Gustav Simonsson < gustav.simonsson@REDACTED> wrote: > > Hi! > > This is a scrappy half-completed bash script I used to generate > a small Erlang release. It's something I hope can eventually grow > into a more general and stable tool for generating Erlang releases. > > It does contain some useful things for reducing the size of an > Erlang release. > > Also thanks to Adam Lindberg for helping out with it. > > > https://github.com/Gustav-Simonsson/Stripped-Erlang/blob/master/minimal_erlang.sh > > Regards, > Gustav Simonsson > > Sent from my PC > > ----- Original Message ----- > From: "Albin Stig?" > To: erlang-questions@REDACTED > Sent: Thursday, December 8, 2011 11:27:39 AM > Subject: [erlang-questions] Building small erlang vm suitable for bundle > with app. > > Hi, > > I'm quite new to Erlang and this list so I hope I'm posting in the right > place? > > I would like to use Erlang code (couchdb) in an Mac OS X app I'm > developing and I would like to bundle it with my app. Exactly like the > Mac OS X version of Wings3D is bundling a version of erlang. > > I was wondering if someone kind provide me with some ideas of how to > compile a smaller version of the Erlang VM without the developing > tools etc? > > Cheers, > Albin > _______________________________________________ > 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 gustav.simonsson@REDACTED Wed Dec 14 09:41:42 2011 From: gustav.simonsson@REDACTED (Gustav Simonsson) Date: Wed, 14 Dec 2011 08:41:42 -0000 (GMT) Subject: [erlang-questions] Building small erlang vm suitable for bundle with app. In-Reply-To: Message-ID: Yes, you can remove either the SMP or the non-SMP beam depending on your target architecture. Also the only things you need to just run Erlang is ERTS and the stdlib and kernel libs. If you want to reduce the disk usage as much as possibly you can read on methods in chapter 3.2 and results in chapter 5.1 in the following thesis: http://urn.kb.se/resolve?urn=urn:nbn:se:uu:diva-156435 Regards, Gustav Simonsson Sent from my PC ----- Original Message ----- From: "dmitry kolesnikov" To: "Gustav Simonsson" , "Albin Stig?" Cc: erlang-questions@REDACTED Sent: Wednesday, 14 December, 2011 9:22:03 AM Subject: Re: [erlang-questions] Building small erlang vm suitable for bundle with app. Hi, I have not yet spent too much time to investigate how to build 2MB self-sustainable package but systools gives me about 14MB with possible reduction to 7 - 9MB on debian 64bit. as an example *.rel package contains following libraries: {kernel, "2.14.5"}, {stdlib, "1.17.5"}, {sasl, "2.1.10"}, {crypto, "2.0.4"}, {public_key, "0.13"}, {ssl, "4.1.6"}, {inets, "5.7.1"}, {compiler, "4.7.5"}, {syntax_tools, "1.6.7.1"}, {xmerl, "1.2.10"}, {mochiweb, "2.3.0"} ... systools:make_tar($$n, [{erts, code:root_dir()}]) %% do not put any extra dirs here most heavy components are VM by itself -rwxr-xr-x 1 kolesnik wheel 7.7M Oct 19 20:53 beam -rwxr-xr-x 1 kolesnik wheel 9.6M Oct 19 20:53 beam.smp - Dmitry On Tue, Dec 13, 2011 at 10:59 AM, Gustav Simonsson < gustav.simonsson@REDACTED > wrote: Hi! This is a scrappy half-completed bash script I used to generate a small Erlang release. It's something I hope can eventually grow into a more general and stable tool for generating Erlang releases. It does contain some useful things for reducing the size of an Erlang release. Also thanks to Adam Lindberg for helping out with it. https://github.com/Gustav-Simonsson/Stripped-Erlang/blob/master/minimal_erlang.sh Regards, Gustav Simonsson Sent from my PC ----- Original Message ----- From: "Albin Stig?" < albin.stigo@REDACTED > To: erlang-questions@REDACTED Sent: Thursday, December 8, 2011 11:27:39 AM Subject: [erlang-questions] Building small erlang vm suitable for bundle with app. Hi, I'm quite new to Erlang and this list so I hope I'm posting in the right place? I would like to use Erlang code (couchdb) in an Mac OS X app I'm developing and I would like to bundle it with my app. Exactly like the Mac OS X version of Wings3D is bundling a version of erlang. I was wondering if someone kind provide me with some ideas of how to compile a smaller version of the Erlang VM without the developing tools etc? Cheers, Albin _______________________________________________ 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.henoch@REDACTED Wed Dec 14 10:14:55 2011 From: magnus.henoch@REDACTED (Magnus Henoch) Date: Wed, 14 Dec 2011 09:14:55 -0000 (GMT) Subject: [erlang-questions] Cannot build R14B04 in Solaris 10 with libatomic_ops In-Reply-To: Message-ID: <25654fa5-5fa9-4c33-81c1-0c47206c9bef@knuth> > checking for a usable libatomic_ops implementation... no > configure: error: No usable libatomic_ops implementation found > configure: error: /bin/bash > '/produccion/tmmprov2/claudio/temp/otp_src_R14B04/erts/configure' > failed for erts Could you post the relevant bits of erts/config.log? You should be able to find the messages above, as well as details about why it didn't consider your libatomic_ops to be usable. -- Magnus Henoch Erlang Solutions Ltd http://www.erlang-solutions.com/ From attila.r.nohl@REDACTED Wed Dec 14 10:35:11 2011 From: attila.r.nohl@REDACTED (Attila Rajmund Nohl) Date: Wed, 14 Dec 2011 10:35:11 +0100 Subject: [erlang-questions] hierarchical behaviour doesn't seem to work ? In-Reply-To: <20111213173751.GE10252@prithivi.gnumonks.org> References: <20111213173751.GE10252@prithivi.gnumonks.org> Message-ID: 2011/12/13, Harald Welte : [...] > To me, it seems most logical that you would want to implement levels of > common functionality in a behaviour, and "sub-class" a number of different > implementations off such a behaviour. And since all of it should be OTP > compliant, that custom behaviour itself would be based on some OTP > behaviour like gen_server, gen_fsm, etc. > > Any comments? Am I misunderstanding something here? Thanks! With behaviours you can "inherit" interface, but can't implement implementation. My rather nasty solution in similar cases was to put the common (in your case, the handle_call) code into a header file and include this file in the modules. This way I could avoid code duplication. From gleber.p@REDACTED Wed Dec 14 11:23:29 2011 From: gleber.p@REDACTED (Gleb Peregud) Date: Wed, 14 Dec 2011 11:23:29 +0100 Subject: [erlang-questions] Any Erlang GIS software out there? In-Reply-To: <8C4FC719-ADD5-419D-BACF-13584FBD3EE1@alumni.caltech.edu> References: <20110915160650.GB1632@alumni.caltech.edu> <8C4FC719-ADD5-419D-BACF-13584FBD3EE1@alumni.caltech.edu> Message-ID: We are actually developing GIS software using Erlang - for example we did implement map server (WFS), tiling server (TMS/WMS), routing server and we are working on a geocoding server at the moment. Feel free to contact me if you have any questions about usage of Erlang in GIS. From qoocku@REDACTED Wed Dec 14 12:51:28 2011 From: qoocku@REDACTED (=?UTF-8?B?RGFtaWFuIERvYnJvY3p5xYRza2k=?=) Date: Wed, 14 Dec 2011 12:51:28 +0100 Subject: [erlang-questions] Error compiling the latest git repo In-Reply-To: References: <4EE77AA4.30105@gmail.com> Message-ID: <4EE88DC0.1050508@gmail.com> Dnia wto, 13 gru 2011, 20:50:48 Lukas Larsson pisze: > git clean -Xfd . > export ERL_TOP=/path/to/repo > ./otp_build setup -a > > That little script usually solves all my compile issues. If that does > not help you probably have some issue with your toolchain. > > Lukas Thnx for advice. The commands unfortunately did not help AND my autoconf tool is in version 2.68 (as it should be for Ubuntu 11.10) which gives me a warning at the beginning. BUT no such things (I mean the compilation error) had happend before while compiling R15Apre for example. Something changed since R15A.pre? -- D. > > On Dec 13, 2011 5:17 PM, "Damian Dobroczy?ski" > wrote: > > Hi list. > > I've obtained such error while compiling Erlang from the freshest > github > otp repo ("master" branch): > > ... > erlc -W +debug_info +inline -o../ebin hipe_rtl.erl > {"init terminating in do_boot",{'cannot get > bootfile','start_clean.boot'}} > > What is the possible reason? > > -- D. > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > From desired.mta@REDACTED Wed Dec 14 13:15:44 2011 From: desired.mta@REDACTED (Motiejus =?utf-8?Q?Jak=C5=A1tys?=) Date: Wed, 14 Dec 2011 14:15:44 +0200 Subject: [erlang-questions] Error compiling the latest git repo In-Reply-To: <4EE88DC0.1050508@gmail.com> References: <4EE77AA4.30105@gmail.com> <4EE88DC0.1050508@gmail.com> Message-ID: <20111214121544.GA19931@jakstys.lt> On Wed, Dec 14, 2011 at 12:51:28PM +0100, Damian Dobroczy?ski wrote: > Dnia wto, 13 gru 2011, 20:50:48 Lukas Larsson pisze: > > git clean -Xfd . > > export ERL_TOP=/path/to/repo > > ./otp_build setup -a > > > > That little script usually solves all my compile issues. If that does > > not help you probably have some issue with your toolchain. > > > > Lukas > > Thnx for advice. > > The commands unfortunately did not help AND my autoconf tool is in > version 2.68 (as it should be for Ubuntu 11.10) which gives me a > warning at the beginning. BUT no such things (I mean the compilation > error) had happend before while compiling R15Apre for example. > Something changed since R15A.pre? If I were you, I would bisect Erlang and find commit that makes the installation fail. $ git help bisect Regards Motiejus Jak?tys From dave@REDACTED Wed Dec 14 13:17:27 2011 From: dave@REDACTED (Dave Cottlehuber) Date: Wed, 14 Dec 2011 13:17:27 +0100 Subject: [erlang-questions] Any Erlang GIS software out there? In-Reply-To: <20110915160650.GB1632@alumni.caltech.edu> References: <20110915160650.GB1632@alumni.caltech.edu> Message-ID: On 15 September 2011 18:06, Anthony Molinaro wrote: > Hi, > > ?I'm interested in doing some reverse geocoding (taking lat/long and > getting nearby cities). ?While looking around I've not seen any GIS > related software written in erlang. ?So just wondering if I'm missing > anything? ?Anyone written any GIS related software in Erlang? > > Thanks, > > -Anthony Hi Anthony GeoCouch https://github.com/couchbase/geocouch by Volker Mische is a popular erlang extension to CouchDB that does GIS stuff such as bounding box queries. You would need to have the list of interesting stuff such as cities in the Couch DB already. A+ Dave From langxianzhe@REDACTED Wed Dec 14 13:30:17 2011 From: langxianzhe@REDACTED (=?GB2312?B?wMnPzM7k?=) Date: Wed, 14 Dec 2011 20:30:17 +0800 Subject: [erlang-questions] [Erlang][Request] Invoke C funtion in Erlang Message-ID: hi, I using nif mehod to Invoke C funtion in Erlang. come code? 1, char *y; if (!enif_get_string(env, argv[0], y, *sizeof(y)*, ERL_NIF_LATIN1)) I input "123456" args, but only return "123". 2,char *y; if (!enif_get_string(env, argv[0], y, *10*, ERL_NIF_LATIN1)) this only appear Segmentation fault I have no idea. Please help me. Thanks. >From jason. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gleber.p@REDACTED Wed Dec 14 13:37:17 2011 From: gleber.p@REDACTED (Gleb Peregud) Date: Wed, 14 Dec 2011 13:37:17 +0100 Subject: [erlang-questions] [Erlang][Request] Invoke C funtion in Erlang In-Reply-To: References: Message-ID: 2011/12/14 ??? : > hi, > I using nif mehod to Invoke C funtion in Erlang. > come code? > 1, > char *y; > if (!enif_get_string(env, argv[0], y, sizeof(y), ERL_NIF_LATIN1)) > > I input "123456" args, but only return "123". > > 2,char *y; > if (!enif_get_string(env, argv[0], y, 10, ERL_NIF_LATIN1)) > > this only appear Segmentation fault > > I have no idea. > Please help me. > > Thanks. > From jason. "char *y" is actually just a pointer, so sizeof(y) returns 4, which is a size of the pointer. Since you don't know how long is the string, you should prepare a big enough buffer to receive it. So try the following code: #define MAXBUFLEN 1024 char y[MAXBUFLEN]; if (enif_get_string(env, argv[0], y, MAXBUFLEN, ERL_NIF_LATIN1) < 1) return enif_make_badarg(env); From jsmastropiero@REDACTED Wed Dec 14 13:50:17 2011 From: jsmastropiero@REDACTED (Claudio A. Costagliola Fiedler) Date: Wed, 14 Dec 2011 09:50:17 -0300 Subject: [erlang-questions] Cannot build R14B04 in Solaris 10 with libatomic_ops In-Reply-To: <25654fa5-5fa9-4c33-81c1-0c47206c9bef@knuth> References: <25654fa5-5fa9-4c33-81c1-0c47206c9bef@knuth> Message-ID: Magnus, Here they are: configure:10588: checking for a usable libatomic_ops implementation configure:10630: cc -o conftest -g -I/produccion/tmmprov2/claudio/temp/otp_src_R14B04/erts/sparc-sun-solaris2.10 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D_THREAD_SAFE -D_REENTRANT -DPOSIX_THREADS -D_POSIX_PTHREAD_SEMANTICS -I/produccion/tmmprov2/lutils/include conftest.c -ldl -lm -lpthread -lkstat >&5 "conftest.c", line 45: warning: implicit function declaration: AO_compare_and_swap_full Undefined first referenced symbol in file AO_compare_and_swap_full conftest.o AO_test_and_set_full conftest.o ld: fatal: symbol referencing errors. No output written to conftest configure:10636: $? = 1 configure: failed program was: | /* confdefs.h. */ | | #define PACKAGE_NAME "" | #define PACKAGE_TARNAME "" | #define PACKAGE_VERSION "" | #define PACKAGE_STRING "" | #define PACKAGE_BUGREPORT "" | #define STDC_HEADERS 1 | #define HAVE_SYS_TYPES_H 1 | #define HAVE_SYS_STAT_H 1 | #define HAVE_STDLIB_H 1 | #define HAVE_STRING_H 1 | #define HAVE_MEMORY_H 1 | #define HAVE_STRINGS_H 1 | #define HAVE_INTTYPES_H 1 | #define HAVE_STDINT_H 1 | #define HAVE_UNISTD_H 1 | #define SIZEOF_VOID_P 4 | #define HAVE_LIBM 1 | #define HAVE_LIBDL 1 | #define HAVE_PTHREAD_H 1 | #define HAVE_KSTAT 1 | #define ETHR_PTHREADS 1 | #define ETHR_HAVE_PTHREAD_H 1 | #define ETHR_HAVE_SCHED_H 1 | #define ETHR_HAVE_SYS_TIME_H 1 | #define ETHR_TIME_WITH_SYS_TIME 1 | #define ETHR_HAVE_PTHREAD_SPIN_LOCK 1 | #define ETHR_HAVE_SCHED_YIELD 1 | #define ETHR_SCHED_YIELD_RET_INT 1 | #define ETHR_HAVE_PTHREAD_ATTR_SETGUARDSIZE 1 | /* end confdefs.h. */ | #include "atomic_ops.h" | int | main () | { | | volatile AO_t x; | AO_t y; | int z; | | AO_nop_full(); | AO_store(&x, (AO_t) 0); | z = AO_load(&x); | z = AO_compare_and_swap_full(&x, (AO_t) 0, (AO_t) 1); | | ; | return 0; | } configure:10660: result: no configure:11125: error: No usable libatomic_ops implementation found I also have tried to build erlang in this platform without libatomic_ops, hoping the build used the native atomic operations available in Solaris 10, but this also failed. Erlang doesn't use them and try to use libatomic_ops instead. ?Maybe this is because I'm using cc compiler instead of gcc? Regards, On Wed, Dec 14, 2011 at 6:14 AM, Magnus Henoch < magnus.henoch@REDACTED> wrote: > > checking for a usable libatomic_ops implementation... no > > configure: error: No usable libatomic_ops implementation found > > configure: error: /bin/bash > > '/produccion/tmmprov2/claudio/temp/otp_src_R14B04/erts/configure' > > failed for erts > > Could you post the relevant bits of erts/config.log? You should be able > to find the messages above, as well as details about why it didn't > consider your libatomic_ops to be usable. > > -- > Magnus Henoch > Erlang Solutions Ltd > http://www.erlang-solutions.com/ > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > -- Claudio A. Costagliola Fiedler -------------- next part -------------- An HTML attachment was scrubbed... URL: From langxianzhe@REDACTED Wed Dec 14 14:11:17 2011 From: langxianzhe@REDACTED (=?GB2312?B?wMnPzM7k?=) Date: Wed, 14 Dec 2011 21:11:17 +0800 Subject: [erlang-questions] [Erlang][Request] Invoke C funtion in Erlang In-Reply-To: References: Message-ID: Thanks Gleb Peregud. Your are right. But a new request is come on. I input list [1,7,0,9] as parameter. Ii only return [1,7]. The [0,9] is lose. Maybe the '0' elment as a NUL in C. What should i do . Thanks 8>complex6:get_name([1,7,0,9]). [1,7] 9> 2011/12/14 Gleb Peregud > 2011/12/14 ??? : > > hi, > > I using nif mehod to Invoke C funtion in Erlang. > > come code? > > 1, > > char *y; > > if (!enif_get_string(env, argv[0], y, sizeof(y), ERL_NIF_LATIN1)) > > > > I input "123456" args, but only return "123". > > > > 2,char *y; > > if (!enif_get_string(env, argv[0], y, 10, ERL_NIF_LATIN1)) > > > > this only appear Segmentation fault > > > > I have no idea. > > Please help me. > > > > Thanks. > > From jason. > > "char *y" is actually just a pointer, so sizeof(y) returns 4, which is > a size of the pointer. Since you don't know how long is the string, > you should prepare a big enough buffer to receive it. So try the > following code: > > #define MAXBUFLEN 1024 > > char y[MAXBUFLEN]; > if (enif_get_string(env, argv[0], y, MAXBUFLEN, ERL_NIF_LATIN1) < 1) > return enif_make_badarg(env); > -------------- next part -------------- An HTML attachment was scrubbed... URL: From gleber.p@REDACTED Wed Dec 14 14:23:16 2011 From: gleber.p@REDACTED (Gleb Peregud) Date: Wed, 14 Dec 2011 14:23:16 +0100 Subject: [erlang-questions] [Erlang][Request] Invoke C funtion in Erlang In-Reply-To: References: Message-ID: 2011/12/14 ??? : > Thanks Gleb Peregud. > > Your are right. But a new request is come on. I input list [1,7,0,9] as > parameter. Ii only return [1,7]. The [0,9] is lose. Maybe the '0' elment as > a?NUL in C. > What ?should i do . > > Thanks > > 8>complex6:get_name([1,7,0,9]). > [1,7] > 9> Most probably enif_get_string does copy all four bytes to the buffer, but enif_make_string treats NUL as termination mark of a string. Try using enif_make_string_len instead. On the other side it looks like you are interested in a binary-like data, instead of a string-like data. You can make use of the following code: ErlNifBinary input; if(!enif_inspect_iolist_as_binary(env, argv[0], &input)) { return enif_make_badarg(env); } As the result of this: input.data - will contain pointer to a memory, where all bytes from argument are stored input.size - size of that memory area Also it's worth noting that this will work for both lists (with integers less than 256) and binaries, and for any nested combinations of them. From kenneth.lundin@REDACTED Wed Dec 14 16:03:18 2011 From: kenneth.lundin@REDACTED (Kenneth Lundin) Date: Wed, 14 Dec 2011 16:03:18 +0100 Subject: [erlang-questions] Erlang/OTP R15B has been released Message-ID: Erlang/OTP R15B has been released. This is a new major release of Erlang/OTP This is a release with many interesting new features: *Highlights: * - Line number and filename information are now included in exception backtraces. This information will be pretty-printed in the shell and used in crash reports etc. In practice it will be much easier to find where something failed. - The driver interface has been changed to enable 64-bit aware drivers. Most importantly the return types for ErlDrvEntry callbacks 'call' and 'control' has been changed which require drivers to be changed. - New in this release is the support for 64 bit Windows. - CommonTest hooks are now in a final supported version. - There is a new GUI tool in the observer application which integrates pman, etop, appmon and tv into one tool. The tool does also contain functions for activating tracing in an easy way. - The Erlang distribution can now be run over the new SSL implementation. You can find the README file with more detailed info at http://www.erlang.org/download/otp_src_R15B.readme You can download the full source distribution from http://www.erlang.org/download/otp_src_R15B.tar.gz http://www.erlang.org/download/otp_src_R15B.readme (this file) Note: To unpack the TAR archive you need a GNU TAR compatible program. For installation instructions please read the README that is part of the distribution. The Windows binary distribution can be downloaded from http://www.erlang.org/download/otp_win32_R15B.exe http://www.erlang.org/download/otp_win64_R15B.exe On-line documentation can be found at http://www.erlang.org/doc/. You can also download the complete HTML documentation or the Unix manual files http://www.erlang.org/download/otp_doc_html_R15B.tar.gz http://www.erlang.org/download/otp_doc_man_R15B.tar.gz We also want to thank those that sent us patches, suggestions and bug reports, The OTP Team at Ericsson -------------- next part -------------- An HTML attachment was scrubbed... URL: From kenneth.lundin@REDACTED Wed Dec 14 16:22:50 2011 From: kenneth.lundin@REDACTED (Kenneth Lundin) Date: Wed, 14 Dec 2011 16:22:50 +0100 Subject: [erlang-questions] Erlang/OTP R15B has been released (now with correct README link) Message-ID: Erlang/OTP R15B has been released. This is a new major release of Erlang/OTP This is a release with many interesting new features: *Highlights: * - Line number and filename information are now included in exception backtraces. This information will be pretty-printed in the shell and used in crash reports etc. In practice it will be much easier to find where something failed. - The driver interface has been changed to enable 64-bit aware drivers. Most importantly the return types for ErlDrvEntry callbacks 'call' and 'control' has been changed which require drivers to be changed. - New in this release is the support for 64 bit Windows. - CommonTest hooks are now in a final supported version. - There is a new GUI tool in the observer application which integrates pman, etop, appmon and tv into one tool. The tool does also contain functions for activating tracing in an easy way. - The Erlang distribution can now be run over the new SSL implementation. You can find the README file with more detailed info at http://www.erlang.org/download/otp_src_R15B.readme You can download the full source distribution from http://www.erlang.org/download/otp_src_R15B.tar.gz http://www.erlang.org/download/otp_src_R15B.readme (this file) Note: To unpack the TAR archive you need a GNU TAR compatible program. For installation instructions please read the README that is part of the distribution. The Windows binary distribution can be downloaded from http://www.erlang.org/download/otp_win32_R15B.exe http://www.erlang.org/download/otp_win64_R15B.exe On-line documentation can be found at http://www.erlang.org/doc/. You can also download the complete HTML documentation or the Unix manual files http://www.erlang.org/download/otp_doc_html_R15B.tar.gz http://www.erlang.org/download/otp_doc_man_R15B.tar.gz We also want to thank those that sent us patches, suggestions and bug reports, The OTP Team at Ericsson -------------- next part -------------- An HTML attachment was scrubbed... URL: From andrew@REDACTED Wed Dec 14 17:11:45 2011 From: andrew@REDACTED (Andrew Thompson) Date: Wed, 14 Dec 2011 11:11:45 -0500 Subject: [erlang-questions] Erlang/OTP R15B has been released (now with correct README link) In-Reply-To: References: Message-ID: <20111214161145.GI13603@hijacked.us> On Wed, Dec 14, 2011 at 04:22:50PM +0100, Kenneth Lundin wrote: > Erlang/OTP R15B has been released. > Good news, but I'm curious as to why there wasn't an offical R15A release like normal? The 'A' releases were good for findings bugs before the stable version landed and I'd gotten in the habit of not really testing a new major release until the A release was out. Andrew From max.lapshin@REDACTED Wed Dec 14 17:18:30 2011 From: max.lapshin@REDACTED (Max Lapshin) Date: Wed, 14 Dec 2011 19:18:30 +0300 Subject: [erlang-questions] fd is larger than the largest allowed fd=1023 In-Reply-To: <9B420D82DDC54DF0979C55C0CECC9150@gmail.com> References: <28121303.465.1323775320422.JavaMail.geo-discussion-forums@yqfk19> <9B420D82DDC54DF0979C55C0CECC9150@gmail.com> Message-ID: On Tue, Dec 13, 2011 at 2:26 PM, Joel Reymont wrote: > Yes, do switch, you'll get higher performance overall. > > Alternatively, look up a long related thread a few weeks ago and hack around the limit: > > 1) Save old epmd. > > 2) Modify __DARWIN_FD_SETSIZE in /usr/include/sys/_structs.h and make it, say, 16384. > > 3) Recompile Erlang. > > 4) Restore old epmd since it can't handle more than 1024 fds. What for to restore old epmd, it it will not open more than 1024 fds? It is erlang node, that opens many descriptors. From langxianzhe@REDACTED Wed Dec 14 17:25:11 2011 From: langxianzhe@REDACTED (=?GB2312?B?wMnPzM7k?=) Date: Thu, 15 Dec 2011 00:25:11 +0800 Subject: [erlang-questions] [Erlang][Request] Invoke C funtion in Erlang In-Reply-To: References: Message-ID: hi, Gleb Peregud, Thanks to your help. My quest is solved. 56 ErlNifBinary input; 57 if(!enif_inspect_iolist_as_binary(env, argv[0], &input)) { 58 return enif_make_badarg(env); 59 } 60 char *y="yy"; 61 unsigned char* a=input.data; 62 int i=0; 63 //test 64 while(i > 2011/12/14 ??? : > > Thanks Gleb Peregud. > > > > Your are right. But a new request is come on. I input list [1,7,0,9] as > > parameter. Ii only return [1,7]. The [0,9] is lose. Maybe the '0' elment > as > > a NUL in C. > > What should i do . > > > > Thanks > > > > 8>complex6:get_name([1,7,0,9]). > > [1,7] > > 9> > > Most probably enif_get_string does copy all four bytes to the buffer, > but enif_make_string treats NUL as termination mark of a string. Try > using enif_make_string_len instead. > > On the other side it looks like you are interested in a binary-like > data, instead of a string-like data. You can make use of the following > code: > > ErlNifBinary input; > if(!enif_inspect_iolist_as_binary(env, argv[0], &input)) { > return enif_make_badarg(env); > } > > As the result of this: > input.data - will contain pointer to a memory, where all bytes from > argument are stored > input.size - size of that memory area > > Also it's worth noting that this will work for both lists (with > integers less than 256) and binaries, and for any nested combinations > of them. > -------------- next part -------------- An HTML attachment was scrubbed... URL: From gumm@REDACTED Wed Dec 14 17:41:22 2011 From: gumm@REDACTED (Jesse Gumm) Date: Wed, 14 Dec 2011 10:41:22 -0600 Subject: [erlang-questions] Erlang/OTP R15B has been released (now with correct README link) In-Reply-To: <20111214161145.GI13603@hijacked.us> References: <20111214161145.GI13603@hijacked.us> Message-ID: Hi! There was an R15A release pushed out on Nov 22 and announced on erlang-questions. http://bit.ly/sZgZzT -Jesse -- Jesse Gumm Owner, Sigma Star Systems 414.940.4866 www.sigma-star.com @jessegumm On Dec 14, 2011 10:11 AM, "Andrew Thompson" wrote: > On Wed, Dec 14, 2011 at 04:22:50PM +0100, Kenneth Lundin wrote: > > Erlang/OTP R15B has been released. > > > Good news, but I'm curious as to why there wasn't an offical R15A > release like normal? The 'A' releases were good for findings bugs before > the stable version landed and I'd gotten in the habit of not really > testing a new major release until the A release was out. > > Andrew > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From kruber@REDACTED Wed Dec 14 17:41:33 2011 From: kruber@REDACTED (Nico Kruber) Date: Wed, 14 Dec 2011 17:41:33 +0100 Subject: [erlang-questions] performance drop in R15A? In-Reply-To: References: <1359554.YeRYZETzs8@csr-pc40.zib.de> <1789335.0VPehH53Ub@csr-pc40.zib.de> Message-ID: <1936941.jsKPmCgjmJ@csr-pc40.zib.de> ok, I did some profiling and made some optimisations but the differences between R15B (git checkout from master just now) and R14B04 are still the same: First the results of the calls to bench:quorum_read(10, 50000) (best of three) ------------------------------------------------------------ | R14B04 | R15B | time surplus ------------------------------------------------------------ timer:tc, smp8:8 | 22484619| 26641737| +18% timer:tc, smp4:4 | 34009785| 35963489| + 6% timer:tc, smp2:2 | 32863428| 34102038| + 4% timer:tc, smpoff | 53805419| 54214795| + 1% ------------------------------------------------------------ It seems there is some lock-contention or some other problem with smp in our case which hasn't been there before. I also observed that the results using R15B vary quite much, especially with smp8:8 (see below for an example). R14B04 is more stable among different test runs. But still, even without smp, R15B is slower than R14B04 :( Lukas suggested to run fprof to a bit deeper and maybe find the function taking longer in R15 than in R14B04. Although it was helpful in finding some hot spots, it did however not help with this problem. Following are the totals reported by fprof (if you like, I can send the complete logs - didn't want to send too much to the mailing list though). ------------------------------------------------------------ | R14B04 | R15B | time surplus ------------------------------------------------------------ fprof, CNT, smp8:8 | 7723796| 7722635| n/a fprof, ACC, smp8:8 | 98239| 85477| -13% fprof, OWN, smp8:8 | 300534| 264018| -12% ------------------------------------------------------------ As you can see, according to fprof, R15B should be faster (but it isn't!). I assume that some function calls are not reported by fprof (e.g. I did not see erlang:length/1). Is there some way to include them again in order to analyse further? Maybe suspend or garbage_collect are not in ACC or OWN? But even here, R15B wastes less time as you can see in the table below. ---------------------------------------------------------- | R14B04 | R15B | ---------------------------------------------------------- fprof, suspend, smp8:8 | 9.8421e+06| 8.51855e+06| fprof, garbage_collect, smp8:8 | 1315| 794| ---------------------------------------------------------- We do rely quite much on the process dictionary (erlang:put and erlang:get) which you might see as an "non-typical usage pattern" for erlang. However, if I switch to ets instead, performance of bench:quorum_read(10, 50000) for R15B does not change and for R14B04 decreases by about 7%. Everything else I would consider "typical use" - or at least I'm not aware of anything untypical. I hope, someone can help to further analyse the problem. I did everything I could think of and are stuck now. Is other real-world software also affected? E.g. testing couchdb would be nice. Regards Nico Kruber %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% how to re-produce the values %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% I'm using scalaris from http://code.google.com/p/scalaris/ ./configure && make ================ R15B =============== -------------------------------- ./bin/firstnode.sh Erlang R15B (erts-5.9) [source] [64-bit] [smp:8:8] [async-threads:0] [hipe] [kernel-poll:false] timer:tc(bench, quorum_read, [10, 50000]). {33764932,ok} % 1st try {26641737,ok} % 2nd try {27575975,ok} % 3rd try -------------------------------- ./bin/firstnode.sh "+S4:4" Erlang R15B (erts-5.9) [source] [64-bit] [smp:4:4] [async-threads:0] [hipe] [kernel-poll:false] timer:tc(bench, quorum_read, [10, 50000]). {35963489,ok} % 1st try {36332156,ok} % 2nd try {37295819,ok} % 3rd try -------------------------------- ./bin/firstnode.sh "+S2:2" Erlang R15B (erts-5.9) [source] [64-bit] [smp:2:2] [async-threads:0] [hipe] [kernel-poll:false] timer:tc(bench, quorum_read, [10, 50000]). {34102038,ok} % 1st try {34379052,ok} % 2nd try {34416173,ok} % 3rd try -------------------------------- ./bin/firstnode.sh "-smp disable" Erlang R15B (erts-5.9) [source] [64-bit] [async-threads:0] [hipe] [kernel-poll:false] timer:tc(bench, quorum_read, [10, 50000]). {54214795,ok} % 1st try {55210947,ok} % 2nd try {54537194,ok} % 3rd try ================ R14B04 =============== -------------------------------- ./bin/firstnode.sh Erlang R14B04 (erts-5.8.5) [source] [64-bit] [smp:8:8] [rq:8] [async-threads:0] [hipe] [kernel-poll:false] timer:tc(bench, quorum_read, [10, 50000]). {22598819,ok} % 1st try {22706185,ok} % 2nd try {22484619,ok} % 3rd try -------------------------------- ./bin/firstnode.sh "+S4:4" Erlang R14B04 (erts-5.8.5) [source] [64-bit] [smp:4:4] [rq:4] [async-threads:0] [hipe] [kernel-poll:false] timer:tc(bench, quorum_read, [10, 50000]). {35482368,ok} % 1st try {34009785,ok} % 2nd try {34527203,ok} % 3rd try -------------------------------- ./bin/firstnode.sh "+S2:2" Erlang R14B04 (erts-5.8.5) [source] [64-bit] [smp:2:2] [rq:2] [async-threads:0] [hipe] [kernel-poll:false] timer:tc(bench, quorum_read, [10, 50000]). {33590356,ok} % 1st try {33192033,ok} % 2nd try {32863428,ok} % 3rd try -------------------------------- ./bin/firstnode.sh "-smp disable" Erlang R14B04 (erts-5.8.5) [source] [64-bit] [rq:1] [async-threads:0] [hipe] [kernel-poll:false] timer:tc(bench, quorum_read, [10, 50000]). {53805419,ok} % 1st try {54054538,ok} % 2nd try {54066521,ok} % 3rd try fprof runs: ./bin/firstnode.sh fprof:trace([start, {procs, processes()}]). bench:quorum_read(10, 1000). fprof:trace(stop). fprof:profile(). fprof:analyse([{dest, "test.R15B.fprof.log"}]). % or R14B04 respectively > cat test.R14B04.fprof.log |grep suspend|cut -d',' -f3 | awk '{s+=$1} END {print s}' 9.8421e+06 > cat test.R15B.fprof.log |grep suspend|cut -d',' -f3 | awk '{s+=$1} END {print s}' 8.51855e+06 > cat test.R14B04.fprof.log |grep garbage_collect|cut -d',' -f3 | awk '{s+=$1} END {print s}' 1315.33 > cat test.R15B.fprof.log |grep garbage_collect|cut -d',' -f3 | awk '{s+=$1} END {print s}' 794.956 On Friday 09 December 2011 12:09:56 Kenneth Lundin wrote: > On 12/5/11, Nico Kruber wrote: > > Is there any news on this? > > > > The performance drop of the recent R15 checkout compared to R14B04 in > > our > > application is now at _30%_ compared to a drop of "only" 15% in R15A! > > When working with R15B we are of course performing a number of > bencmarks to keep track of the performance. > > Whe always strive to improve general performance in each release AND > OUR BENCHMARKS INDICATE THAT R15B IS FASTER IN GENERAL THAN R14B04. > > It is however always possible that some specific operations or > combinations of operations get slower while others are optimized. > > Regarding the findings for this particular application we think the > reason for slowdown is a very frequent but non typical usage pattern > that now becomes visible as a performance bottleneck. > > > / Kenneth, Erlang/OTP Ericsson -------------- 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 kenneth.lundin@REDACTED Wed Dec 14 17:48:38 2011 From: kenneth.lundin@REDACTED (Kenneth Lundin) Date: Wed, 14 Dec 2011 17:48:38 +0100 Subject: [erlang-questions] Erlang/OTP R15B has been released (now with correct README link) In-Reply-To: <20111214161145.GI13603@hijacked.us> References: <20111214161145.GI13603@hijacked.us> Message-ID: Hi Andrew, It is a lot of extra work to make an A release and because of that we decided to replace the A release with the same intention but just tagged in the git repository at GitHub. We announced that and asked for feedback which we also got to some extent. Of course the release process can and will be improved for the next occation but I think we will continue this way but maybe announcing it better. /Regards Kenneth On Wed, Dec 14, 2011 at 5:11 PM, Andrew Thompson wrote: > On Wed, Dec 14, 2011 at 04:22:50PM +0100, Kenneth Lundin wrote: > > Erlang/OTP R15B has been released. > > > Good news, but I'm curious as to why there wasn't an offical R15A > release like normal? The 'A' releases were good for findings bugs before > the stable version landed and I'd gotten in the habit of not really > testing a new major release until the A release was out. > > Andrew > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From zabrane3@REDACTED Wed Dec 14 17:51:32 2011 From: zabrane3@REDACTED (Zabrane Mickael) Date: Wed, 14 Dec 2011 17:51:32 +0100 Subject: [erlang-questions] Erlang/OTP R15B has been released In-Reply-To: References: Message-ID: Hi guys, Just installed R15B on OSX (10.6.8). When running dialyzer (which worked fine R14B04) on a production code, I got this error: dialyzer: Unknown dialyzer warning option: behaviours Regards Zabrane On Dec 14, 2011, at 4:03 PM, Kenneth Lundin wrote: > Erlang/OTP R15B has been released. > > This is a new major release of Erlang/OTP > > This is a release with many interesting new features: > Highlights: > > Line number and filename information are now included in exception backtraces. This information will be pretty-printed in the shell and used in crash reports etc. In practice it will be much easier to find where something failed. > The driver interface has been changed to enable 64-bit aware drivers. Most importantly the return types for ErlDrvEntry callbacks 'call' and 'control' has been changed which require drivers to be changed. > New in this release is the support for 64 bit Windows. > CommonTest hooks are now in a final supported version. > There is a new GUI tool in the observer application which integrates pman, etop, appmon and tv into one tool. The tool does also contain functions for activating tracing in an easy way. > The Erlang distribution can now be run over the new SSL implementation. > You can find the README file with more detailed info at > > http://www.erlang.org/download/otp_src_R15B.readme > > You can download the full source distribution from > > http://www.erlang.org/download/otp_src_R15B.tar.gz > http://www.erlang.org/download/otp_src_R15B.readme (this file) > > Note: To unpack the TAR archive you need a GNU TAR compatible program. > > For installation instructions please read the README that is part of > the distribution. > > The Windows binary distribution can be downloaded from > > http://www.erlang.org/download/otp_win32_R15B.exe > http://www.erlang.org/download/otp_win64_R15B.exe > > > On-line documentation can be found at http://www.erlang.org/doc/. > You can also download the complete HTML documentation or the Unix manual files > > http://www.erlang.org/download/otp_doc_html_R15B.tar.gz > http://www.erlang.org/download/otp_doc_man_R15B.tar.gz > > We also want to thank those that sent us patches, suggestions and bug reports, > > The OTP Team at Ericsson > > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions -------------- next part -------------- An HTML attachment was scrubbed... URL: From qoocku@REDACTED Wed Dec 14 17:58:23 2011 From: qoocku@REDACTED (=?UTF-8?B?RGFtaWFuIERvYnJvY3p5xYRza2k=?=) Date: Wed, 14 Dec 2011 17:58:23 +0100 Subject: [erlang-questions] Somebody please correct my -callback understanding Message-ID: <4EE8D5AF.2000501@gmail.com> Hi list! I have a module "a" defining callback "c": -module (a). -callback c (integer()) -> integer(). Now, I have callback module "b" implementing invalid (non-comforming the a:c/1 spec) callback "c": -module (b). -behavior (a). -export ([c/1]). c (A) when is_atom(A) -> A. Now, I dialyze both modules: $ dialyze -n --src a.erl b.erl which outputs: Proceeding with analysis... done in 0m0.64s done (passed successfully) What I've expected is the dialyzer warning about invalid b:c/1 function (something about breaking the contract for c/1). Am I right? -- D. From kostis@REDACTED Wed Dec 14 18:01:27 2011 From: kostis@REDACTED (Kostis Sagonas) Date: Wed, 14 Dec 2011 19:01:27 +0200 Subject: [erlang-questions] Erlang/OTP R15B has been released In-Reply-To: References: Message-ID: <4EE8D667.8070209@cs.ntua.gr> On 12/14/11 18:51, Zabrane Mickael wrote: > Hi guys, > > Just installed R15B on OSX (10.6.8). > > When running dialyzer (which worked fine R14B04) on a production code, > I got this error: > > *dialyzer*: Unknown dialyzer warning option: *behaviours* This option is now on by default, so there is no need to specify it. In contrast, there is a new option to turn off these warnings if you do not want them: -Wno_behaviours Suppress warnings about behaviour callbacks which drift from the published recommended interfaces. Kostis PS. It's of course not a big deal, but it's a bit of a pity that behaviour callbacks was not listed in the R15B release highlights... It's a language addition after all, which had to wait for quite a long time in order to be included in a major instead of some minor release. From kennethstone@REDACTED Wed Dec 14 18:05:10 2011 From: kennethstone@REDACTED (Kenny Stone) Date: Wed, 14 Dec 2011 11:05:10 -0600 Subject: [erlang-questions] Erlang/OTP R15B has been released In-Reply-To: <4EE8D667.8070209@cs.ntua.gr> References: <4EE8D667.8070209@cs.ntua.gr> Message-ID: How do "behaviour callbacks" differ from the way it used to work? Kenny On Wed, Dec 14, 2011 at 11:01 AM, Kostis Sagonas wrote: > On 12/14/11 18:51, Zabrane Mickael wrote: > >> Hi guys, >> >> Just installed R15B on OSX (10.6.8). >> >> When running dialyzer (which worked fine R14B04) on a production code, >> I got this error: >> >> *dialyzer*: Unknown dialyzer warning option: *behaviours* >> > > This option is now on by default, so there is no need to specify it. > > In contrast, there is a new option to turn off these warnings if you do > not want them: > > -Wno_behaviours > Suppress warnings about behaviour callbacks which drift from the > published recommended interfaces. > > > Kostis > > PS. It's of course not a big deal, but it's a bit of a pity that behaviour > callbacks was not listed in the R15B release highlights... It's a language > addition after all, which had to wait for quite a long time in order to be > included in a major instead of some minor release. > > ______________________________**_________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/**listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From zabrane3@REDACTED Wed Dec 14 18:04:20 2011 From: zabrane3@REDACTED (Zabrane Mickael) Date: Wed, 14 Dec 2011 18:04:20 +0100 Subject: [erlang-questions] Erlang/OTP R15B has been released In-Reply-To: <4EE8D667.8070209@cs.ntua.gr> References: <4EE8D667.8070209@cs.ntua.gr> Message-ID: <8E827758-734C-462C-91D4-B3F7A46B85F2@gmail.com> > This option is now on by default, so there is no need to specify it. > > In contrast, there is a new option to turn off these warnings if you do not want them: > > -Wno_behaviours > Suppress warnings about behaviour callbacks which drift from the > published recommended interfaces. Thanks. > PS. It's of course not a big deal, but it's a bit of a pity that behaviour callbacks was not listed in the R15B release highlights... It's a language addition after all, which had to wait for quite a long time in order to be included in a major instead of some minor release. I was waiting for that feature. Well done guys !!! Regards, Zabrane From richardprideauxevans@REDACTED Wed Dec 14 18:08:55 2011 From: richardprideauxevans@REDACTED (Richard Evans) Date: Wed, 14 Dec 2011 17:08:55 +0000 Subject: [erlang-questions] How to handle 'GET' in latest version of misultin Message-ID: Hey guys, In a previous version of misultin (0.8 and earlier version of 0.9), I was doing this kind of thing to get files: handle('GET', [], Req) -> Req:file("../../../client/SplashScreen.html"); handle('GET', ["js", X], Req) -> Req:file("../../../client/js/"++X); but this no longer seems to be working with the latest version of misultin. e.g. it complains Error in process <0.64.0> with exit value: {undef,[{misultin_http,request,[{c,<0.35.0>,<0.37.0>,24594,8080,30000,4194304,2000,false,#Fun,true,#Fun,true,['draft-hybi-17','draft-hybi-10','draft-hixie-76'],undefined,false,true,false},{req,#Port<0.981>,http,{127,0,0,1},58496,undefined,close,undefined,{1,1},undefined,undefined,[],[],<<0 bytes>>... Does anybody know how things have changed and what I need to modify? thanks, Richard From laforge@REDACTED Wed Dec 14 18:36:32 2011 From: laforge@REDACTED (Harald Welte) Date: Wed, 14 Dec 2011 18:36:32 +0100 Subject: [erlang-questions] hierarchical behaviour doesn't seem to work ? In-Reply-To: <20111214075539.GB298@aluminum.motivity.ca> References: <20111213173751.GE10252@prithivi.gnumonks.org> <20111214075539.GB298@aluminum.motivity.ca> Message-ID: <20111214173632.GI27642@prithivi.gnumonks.org> Hi Vance, On Wed, Dec 14, 2011 at 01:25:40PM +0530, Vance Shipley wrote: > I wrote a howto article on this a few years ago: > > http://www.trapexit.org/Cascading_Behaviours ah, i see. > Yes, you need to define these functions in your module. Your > client may extend these itself and/or pass them on to my_bahaviour. I've meanwhile found a solution to solve the problem. I was thinking the "wrong way around". What I need to do is I need to call gen_server:start_link(), and tell in the init arguments which specific implementation it should use (my_behaviour), which then needs to get passed the name of the actual module (client) into its init() argument list. > Cascading behaviours wasn't anticipated in the design and, aside > from me, very few people have used that design pattern. At least when it comes to public Erlang code, it seems like that. And yes, the question was in fact related to signerl and the way how tcap_tco_server extends gen_server, and my osmo_sccp_tcap then provides the callbacks to tcap_tco_server. Things seem to be coming along quite OK for remotely-initiated transactions. I'm now working on locally-initiated transactions, where TC-BEGIN is coming from the TCAP user side. I hope to have signerl/TCAP working fully in the next two weeks. Regards, Harald -- - Harald Welte http://laforge.gnumonks.org/ ============================================================================ "Privacy in residential applications is a desirable marketing option." (ETSI EN 300 175-7 Ch. A6) From qoocku@REDACTED Wed Dec 14 19:11:37 2011 From: qoocku@REDACTED (=?UTF-8?B?RGFtaWFuIERvYnJvY3p5xYRza2k=?=) Date: Wed, 14 Dec 2011 19:11:37 +0100 Subject: [erlang-questions] Somebody please correct my -callback understanding In-Reply-To: <4EE8D5AF.2000501@gmail.com> References: <4EE8D5AF.2000501@gmail.com> Message-ID: <4EE8E6D9.1060004@gmail.com> W dniu 14.12.2011 17:58, Damian Dobroczy?ski pisze: > Hi list! > > I have a module "a" defining callback "c": > > -module (a). > -callback c (integer()) -> integer(). > > Now, I have callback module "b" implementing invalid (non-comforming the > a:c/1 spec) callback "c": > > -module (b). > -behavior (a). > -export ([c/1]). > > c (A) when is_atom(A) -> > A. > > Now, I dialyze both modules: > > $ dialyze -n --src a.erl b.erl > > which outputs: > > Proceeding with analysis... done in 0m0.64s > done (passed successfully) > > What I've expected is the dialyzer warning about invalid b:c/1 function > (something about breaking the contract for c/1). Am I right? > > -- D. Wow, It's a miracle! I've just found the answer and (what I understand) a bug. IT IS "-behavior (...)" which is perfectly understood by the compiler but not by by the dialyzer! Dialyzer expects "-behaviour (...)" (note the different spelling). -- D. From daniel@REDACTED Wed Dec 14 19:38:33 2011 From: daniel@REDACTED (Daniel Luna) Date: Wed, 14 Dec 2011 13:38:33 -0500 Subject: [erlang-questions] Somebody please correct my -callback understanding In-Reply-To: <4EE8E6D9.1060004@gmail.com> References: <4EE8D5AF.2000501@gmail.com> <4EE8E6D9.1060004@gmail.com> Message-ID: 2011/12/14 Damian Dobroczy?ski : > Wow, It's a miracle! I've just found the answer and (what I understand) > a bug. IT IS "-behavior (...)" which is perfectly understood by the > compiler but not by by the dialyzer! Dialyzer expects "-behaviour (...)" > (note the different spelling). This is not a bug. Erlang has always used 'behaviour' (and 'behaviour_info'). See http://en.wikipedia.org/wiki/American_and_British_English_spelling_differences#-our.2C_-or As a side note, Erlang allows for any user defined elements starting with -. If you for example add the following line to your code -my_own_local_thing(whatever_data). then this is fully legal Erlang, and its effect is seen if you run Module:module_info() [... {attributes,[{behaviour,[supervisor]}, {my_own_local_thing,[whatever_data]}]}, ...] Cheers, Daniel From qoocku@REDACTED Wed Dec 14 19:52:17 2011 From: qoocku@REDACTED (=?UTF-8?B?RGFtaWFuIERvYnJvY3p5xYRza2k=?=) Date: Wed, 14 Dec 2011 19:52:17 +0100 Subject: [erlang-questions] Somebody please correct my -callback understanding In-Reply-To: References: <4EE8D5AF.2000501@gmail.com> <4EE8E6D9.1060004@gmail.com> Message-ID: <4EE8F061.7040503@gmail.com> Dnia ?ro, 14 gru 2011, 19:38:33 Daniel Luna pisze: > 2011/12/14 Damian Dobroczy?ski : >> Wow, It's a miracle! I've just found the answer and (what I understand) >> a bug. IT IS "-behavior (...)" which is perfectly understood by the >> compiler but not by by the dialyzer! Dialyzer expects "-behaviour (...)" >> (note the different spelling). > > This is not a bug. Erlang has always used 'behaviour' (and > 'behaviour_info'). See > http://en.wikipedia.org/wiki/American_and_British_English_spelling_differences#-our.2C_-or > > As a side note, Erlang allows for any user defined elements starting with -. > > If you for example add the following line to your code > > -my_own_local_thing(whatever_data). > > then this is fully legal Erlang, and its effect is seen if you run > Module:module_info() > > [... > {attributes,[{behaviour,[supervisor]}, > {my_own_local_thing,[whatever_data]}]}, > ...] > > Cheers, > > Daniel >From Erlang Reference Manual: """ -behaviour(Behaviour). The atom Behaviour gives the name of the behaviour, which can be a user defined behaviour or one of the OTP standard behaviours gen_server, gen_fsm, gen_event or supervisor. The spelling behavior is also accepted."""" <--- HERE It's a bug. Besides as I mentioned, the compiler perfectly understand the attribute "-behavior" giving me warnings about missing callbacks. So, compiler understand and behave correctly with "-behavior" - dialyzer don't. (Unfortunately (or maybe not) my code if full of "behaviors" ;) just because it is accepted and understood not even deprecated). -- D. From qoocku@REDACTED Wed Dec 14 20:00:20 2011 From: qoocku@REDACTED (=?UTF-8?B?RGFtaWFuIERvYnJvY3p5xYRza2k=?=) Date: Wed, 14 Dec 2011 20:00:20 +0100 Subject: [erlang-questions] Somebody please correct my -callback understanding In-Reply-To: <4EE8F061.7040503@gmail.com> References: <4EE8D5AF.2000501@gmail.com> <4EE8E6D9.1060004@gmail.com> <4EE8F061.7040503@gmail.com> Message-ID: <4EE8F244.8080207@gmail.com> Dnia ?ro, 14 gru 2011, 19:52:17 Damian Dobroczy?ski pisze: > Dnia ?ro, 14 gru 2011, 19:38:33 Daniel Luna pisze: >> 2011/12/14 Damian Dobroczy?ski : >>> Wow, It's a miracle! I've just found the answer and (what I understand) >>> a bug. IT IS "-behavior (...)" which is perfectly understood by the >>> compiler but not by by the dialyzer! Dialyzer expects "-behaviour (...)" >>> (note the different spelling). >> >> This is not a bug. Erlang has always used 'behaviour' (and >> 'behaviour_info'). See >> http://en.wikipedia.org/wiki/American_and_British_English_spelling_differences#-our.2C_-or >> >> As a side note, Erlang allows for any user defined elements starting with -. >> >> If you for example add the following line to your code >> >> -my_own_local_thing(whatever_data). >> >> then this is fully legal Erlang, and its effect is seen if you run >> Module:module_info() >> >> [... >> {attributes,[{behaviour,[supervisor]}, >> {my_own_local_thing,[whatever_data]}]}, >> ...] >> >> Cheers, >> >> Daniel > > From Erlang Reference Manual: > > """ > -behaviour(Behaviour). > > The atom Behaviour gives the name of the behaviour, which can be a user > defined behaviour or one of the OTP standard behaviours gen_server, > gen_fsm, gen_event or supervisor. > > The spelling behavior is also accepted."""" <--- HERE > > It's a bug. Besides as I mentioned, the compiler perfectly understand > the attribute "-behavior" giving me warnings about missing callbacks. > So, compiler understand and behave correctly with "-behavior" - > dialyzer don't. > > (Unfortunately (or maybe not) my code if full of "behaviors" ;) just > because it is accepted and understood not even deprecated). > > -- D. > I've just looked into "Erlang. Programming" by Cesarini & Thompson (2009), page 271, an example of gen_server (usr.el listining): (...) -behavior(gen_server). (...) Well, thats enough for me to be completely comvinced it's not a weird thing to write "-behavior (...)". I think it's in common, especially for Americans. -- D. From daniel@REDACTED Wed Dec 14 20:03:39 2011 From: daniel@REDACTED (Daniel Luna) Date: Wed, 14 Dec 2011 14:03:39 -0500 Subject: [erlang-questions] Somebody please correct my -callback understanding In-Reply-To: <4EE8F244.8080207@gmail.com> References: <4EE8D5AF.2000501@gmail.com> <4EE8E6D9.1060004@gmail.com> <4EE8F061.7040503@gmail.com> <4EE8F244.8080207@gmail.com> Message-ID: 2011/12/14 Damian Dobroczy?ski : > Dnia ?ro, 14 gru 2011, 19:52:17 Damian Dobroczy?ski pisze: >> Dnia ?ro, 14 gru 2011, 19:38:33 Daniel Luna pisze: >>> 2011/12/14 Damian Dobroczy?ski : >>>> Wow, It's a miracle! I've just found the answer and (what I understand) >>>> a bug. IT IS "-behavior (...)" which is perfectly understood by the >>>> compiler but not by by the dialyzer! Dialyzer expects "-behaviour (...)" >>>> (note the different spelling). >>> >>> This is not a bug. ?Erlang has always used 'behaviour' (and >>> 'behaviour_info'). ?See >>> http://en.wikipedia.org/wiki/American_and_British_English_spelling_differences#-our.2C_-or >>> >>> As a side note, Erlang allows for any user defined elements starting with -. >>> >>> If you for example add the following line to your code >>> >>> -my_own_local_thing(whatever_data). >>> >>> then this is fully legal Erlang, and its effect is seen if you run >>> Module:module_info() >>> >>> [... >>> {attributes,[{behaviour,[supervisor]}, >>> ? ? ? ? ? ? ? {my_own_local_thing,[whatever_data]}]}, >>> ...] >>> >>> Cheers, >>> >>> Daniel >> >> From Erlang Reference Manual: >> >> """ >> -behaviour(Behaviour). >> >> The atom Behaviour gives the name of the behaviour, which can be a user >> defined behaviour or one of the OTP standard behaviours gen_server, >> gen_fsm, gen_event or supervisor. >> >> The spelling behavior is also accepted."""" <--- HERE >> >> It's a bug. Besides as I mentioned, the compiler perfectly understand >> the attribute "-behavior" giving me warnings about missing callbacks. >> So, compiler understand and behave correctly with "-behavior" - >> dialyzer don't. >> >> (Unfortunately (or maybe not) my code if full of "behaviors" ;) just >> because it is accepted and understood not even deprecated). >> >> -- D. >> > > I've just looked into "Erlang. Programming" by Cesarini & Thompson > (2009), page 271, an example of gen_server (usr.el listining): > > (...) > -behavior(gen_server). > (...) > > > Well, thats enough for me to be completely comvinced it's not a weird > thing to write "-behavior (...)". I think it's in common, especially > for Americans. You're right. My bad. Cheers From ulf@REDACTED Wed Dec 14 20:07:55 2011 From: ulf@REDACTED (Ulf Wiger) Date: Wed, 14 Dec 2011 20:07:55 +0100 Subject: [erlang-questions] Somebody please correct my -callback understanding In-Reply-To: <4EE8E6D9.1060004@gmail.com> References: <4EE8D5AF.2000501@gmail.com> <4EE8E6D9.1060004@gmail.com> Message-ID: <3AA33CE9-0648-4989-81A4-50F2BA9D9465@feuerlabs.com> If memory serves, the behavior/behaviour dichotomy was initially my fault. I wrote the first prototype for user-defined behaviors, and no one noticed that I had used American spelling, until it was pointed out much later, after the official release. :) BR, Ulf W On 14 Dec 2011, at 19:11, Damian Dobroczy?ski wrote: > Wow, It's a miracle! I've just found the answer and (what I understand) > a bug. IT IS "-behavior (...)" which is perfectly understood by the > compiler but not by by the dialyzer! Dialyzer expects "-behaviour (...)" > (note the different spelling). > > -- D. > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions From essen@REDACTED Wed Dec 14 22:05:37 2011 From: essen@REDACTED (=?ISO-8859-1?Q?Lo=EFc_Hoguin?=) Date: Wed, 14 Dec 2011 22:05:37 +0100 Subject: [erlang-questions] Erlang/OTP R15B has been released In-Reply-To: References: Message-ID: <4EE90FA1.3060305@dev-extend.eu> On 12/14/2011 04:03 PM, Kenneth Lundin wrote: > Erlang/OTP R15B has been released. Thanks for all the hard work that came into this! -- Lo?c Hoguin Dev:Extend From joelr1@REDACTED Wed Dec 14 22:18:41 2011 From: joelr1@REDACTED (Joel Reymont) Date: Wed, 14 Dec 2011 21:18:41 +0000 Subject: [erlang-questions] parsing dates Message-ID: Is there a function somewhere to parse a date like this: 2008-06-30T00:00:00.000Z Thanks, Joel --- Hardcore embedded Linux development http://www.linkedin.com/in/joelreymont Device drivers, firmware and debugging From steve@REDACTED Wed Dec 14 22:20:48 2011 From: steve@REDACTED (Steve Strong) Date: Wed, 14 Dec 2011 22:20:48 +0100 Subject: [erlang-questions] parsing dates In-Reply-To: References: Message-ID: <51FD419B7C71445C94236ADCC333DCBE@srstrong.com> I use something like: <> = list_to_binary(Date) from there, it's trivial to return a datetime() tuple. Cheers, Steve -- Steve Strong @srstrong Sent with Sparrow (http://www.sparrowmailapp.com/?sig) On Wednesday, 14 December 2011 at 22:18, Joel Reymont wrote: > Is there a function somewhere to parse a date like this: > > 2008-06-30T00:00:00.000Z > > Thanks, Joel > > --- > Hardcore embedded Linux development > http://www.linkedin.com/in/joelreymont > Device drivers, firmware and debugging > > > > > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED (mailto:erlang-questions@REDACTED) > http://erlang.org/mailman/listinfo/erlang-questions > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From max.lapshin@REDACTED Wed Dec 14 22:32:32 2011 From: max.lapshin@REDACTED (Max Lapshin) Date: Thu, 15 Dec 2011 00:32:32 +0300 Subject: [erlang-questions] Erlang/OTP R15B has been released In-Reply-To: <4EE90FA1.3060305@dev-extend.eu> References: <4EE90FA1.3060305@dev-extend.eu> Message-ID: Just installed. Thanks! From anders.nygren@REDACTED Wed Dec 14 23:08:36 2011 From: anders.nygren@REDACTED (Anders Nygren) Date: Wed, 14 Dec 2011 16:08:36 -0600 Subject: [erlang-questions] parsing dates In-Reply-To: References: Message-ID: Is this to primitive? > Date="2008-06-30T00:00:00.000Z". "2008-06-30T00:00:00.000Z" > io_lib:fread("~d-~d-~dT~d:~d:~d.~dZ",Date). {ok,[2008,6,30,0,0,0,0],[]} /Anders On Wed, Dec 14, 2011 at 3:18 PM, Joel Reymont wrote: > Is there a function somewhere to parse a date like this: > > 2008-06-30T00:00:00.000Z > > ? ?Thanks, Joel > > --- > Hardcore embedded Linux development > http://www.linkedin.com/in/joelreymont > Device drivers, firmware and debugging > > > > > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions From max.lapshin@REDACTED Wed Dec 14 23:48:11 2011 From: max.lapshin@REDACTED (Max Lapshin) Date: Thu, 15 Dec 2011 01:48:11 +0300 Subject: [erlang-questions] Non-blocking send in erlang: how to save memory when send one content to many people Message-ID: I'm sending live stream to 4000+ users. Stream is saved in memory (in shared ETS table, in binaries) in chunks 500 KBytes each. Client comes and asks for next chunk. If I write server in C (or with linked-in driver), I whould just manage common shared circular buffer from which I will send data and remember client position in this buffer. If client is too slow to read from this buffer, it is disconnected and forgotten. Such approach give ability to save memory and not to copy it in buffers and driver queues. Is it possible to have something like this in erlang? Currently, I've got limits around 3 GBit/s from one erlang node on loopback interface and I want to raise this limit. When traffic comes to this limit, memory begins very fast growing and when it reaches limits of RAM, massive disconnects happen. This is why I think, that I should save memory first without trying to write linked-in tcp driver =) From lukas@REDACTED Thu Dec 15 00:23:34 2011 From: lukas@REDACTED (Lukas Larsson) Date: Thu, 15 Dec 2011 00:23:34 +0100 Subject: [erlang-questions] Non-blocking send in erlang: how to save memory when send one content to many people In-Reply-To: References: Message-ID: You might be interested in the new (R15B) file:sendfile function, if having the data on disc is an option. On Dec 14, 2011 11:48 PM, "Max Lapshin" wrote: > I'm sending live stream to 4000+ users. > > Stream is saved in memory (in shared ETS table, in binaries) in chunks > 500 KBytes each. > > Client comes and asks for next chunk. > > If I write server in C (or with linked-in driver), I whould just > manage common shared circular buffer from which I will send data and > remember > client position in this buffer. If client is too slow to read from > this buffer, it is disconnected and forgotten. > > Such approach give ability to save memory and not to copy it in > buffers and driver queues. > > Is it possible to have something like this in erlang? > > Currently, I've got limits around 3 GBit/s from one erlang node on > loopback interface and I want to raise this limit. > When traffic comes to this limit, memory begins very fast growing and > when it reaches limits of RAM, massive disconnects happen. > This is why I think, that I should save memory first without trying to > write linked-in tcp driver =) > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From max.lapshin@REDACTED Thu Dec 15 00:35:23 2011 From: max.lapshin@REDACTED (Max Lapshin) Date: Thu, 15 Dec 2011 02:35:23 +0300 Subject: [erlang-questions] Non-blocking send in erlang: how to save memory when send one content to many people In-Reply-To: References: Message-ID: On Thu, Dec 15, 2011 at 2:23 AM, Lukas Larsson wrote: > You might be interested in the new (R15B) file:sendfile function, if having > the data on disc is an option. > I think, that something like vmsplice may be an option. I see in sources of file, that prim_inet:getfd is no here (yes, I know that it is undocumented =) and that is why I may use some weird tricks with optimizing. sendfile is a bad option because: 1) I need to serve from memory 2) I need to serve several thousands of connections. Threads are not the way to go. However, I think that I will need to patch efile_drv for using something like vmsplice From max.lapshin@REDACTED Thu Dec 15 00:39:50 2011 From: max.lapshin@REDACTED (Max Lapshin) Date: Thu, 15 Dec 2011 02:39:50 +0300 Subject: [erlang-questions] Non-blocking send in erlang: how to save memory when send one content to many people In-Reply-To: References: Message-ID: So, I think that proper behaviour for sending 1 megabyte of data is: 1) increment ref counter for binary in driver 2) replace writev with vmsplice for linux 3) release binary when data is transmitted I need to check if this really works and helps. From matthias@REDACTED Thu Dec 15 01:35:17 2011 From: matthias@REDACTED (Matthias Lang) Date: Thu, 15 Dec 2011 01:35:17 +0100 Subject: [erlang-questions] Building small erlang vm suitable for bundle with app. In-Reply-To: References: Message-ID: <20111215003517.GA15174@corelatus.se> On Monday, December 12, wrp wrote: > However, http://www.erlang.org/faq/implementations.html says > > "A 2 MB stripped Erlang system can include the beam emulator and > almost all of the stdlib, sasl, kernel, inets and runtime_tools > libraries, provided the libraries are compiled without debugging > information and are compressed..." > > Are there detailed directions anywhere on building such small > distributables? That part of the FAQ was written about 10 years ago, when erts was smaller than it is today. It's still possible to get below 3M without pulling wild tricks, e.g. on an ARM system I have # du 24 ./bin 1019 ./lib 1480 ./erts-5.8.4/bin 1480 ./erts-5.8.4 2523 . Full list of files below. The shrinking is done by judicious use of 'rm', plus this hack: http://erlang.org/pipermail/erlang-questions/2011-June/059489.html Matt -------------------- # ls -lR .: drwxrwxr-x 2 root root 0 Dec 13 16:03 bin drwxr-xr-x 3 root root 0 Dec 13 16:03 erts-5.8.4 drwxr-xr-x 2 root root 0 Dec 13 16:03 lib ./bin: -rwxr-xr-x 1 root root 857 Dec 12 15:00 erl lrwxrwxrwx 1 root root 25 Dec 13 16:03 run_erl -> ../erts-5.8.4/bin/run_erl lrwxrwxrwx 1 root root 6 Dec 13 16:03 run_test -> ct_run -rwxr-xr-x 1 root root 1159 Dec 12 15:00 start -rw-r--r-- 1 root root 5372 Dec 12 15:00 start.boot -rw-r--r-- 1 root root 6350 Dec 12 15:00 start.script -rwxr-xr-x 1 root root 1259 Dec 12 15:00 start_erl -rw-r--r-- 1 root root 6535 Dec 12 15:00 start_sasl.boot lrwxrwxrwx 1 root root 24 Dec 13 16:03 to_erl -> ../erts-5.8.4/bin/to_erl ./erts-5.8.4: drwxr-xr-x 2 root root 0 Dec 13 16:03 bin ./erts-5.8.4/bin: -rwxr-xr-x 1 root root 1411656 Dec 12 15:00 beam -rwxr-xr-x 1 root root 9304 Dec 12 15:00 child_setup -rwxr-xr-x 1 root root 857 Dec 12 15:00 erl -rwxr-xr-x 1 root root 35168 Dec 12 15:00 erlexec -rwxr-xr-x 1 root root 32624 Dec 12 15:00 inet_gethost -rwxr-xr-x 1 root root 16068 Dec 12 15:00 run_erl -rwxr-xr-x 1 root root 7980 Dec 12 15:00 to_erl ./lib: -rw-rw-r-- 1 root root 63577 Dec 12 15:00 erts-5.8.4.ez -rw-rw-r-- 1 root root 311423 Dec 12 15:00 kernel-2.14.4.ez -rw-rw-r-- 1 root root 39390 Dec 12 15:00 sasl-2.1.9.4.ez -rw-rw-r-- 1 root root 628179 Dec 12 15:00 stdlib-1.17.4.ez From jwatte@REDACTED Thu Dec 15 02:13:42 2011 From: jwatte@REDACTED (Jon Watte) Date: Wed, 14 Dec 2011 17:13:42 -0800 Subject: [erlang-questions] Non-blocking send in erlang: how to save memory when send one content to many people In-Reply-To: References: Message-ID: We regularly have a hundred thousand sockets open, and an Erlang process per socket. We don't do high throughput I/O to each of those clients, but Erlang processes are *not* operating system level threads. Also, binaries on the heap are shared across processes, if they are bigger than some limitation -- I think it's 64 bytes. Thus, you COULD have some process that pre-loads files into binaries. Then, when a socket connects and asks for data, you ask for that binary from that process, and then write that binary to the socket. One Erlang process per socket. This would be a super simple implementation and probably very robust. I don't know if it will scale to the I/O throughput that you request, but it certainly would have a chance to do so. Sincerely, jw -- Americans might object: there is no way we would sacrifice our living standards for the benefit of people in the rest of the world. Nevertheless, whether we get there willingly or not, we shall soon have lower consumption rates, because our present rates are unsustainable. On Wed, Dec 14, 2011 at 3:35 PM, Max Lapshin wrote: > On Thu, Dec 15, 2011 at 2:23 AM, Lukas Larsson > wrote: > > You might be interested in the new (R15B) file:sendfile function, if > having > > the data on disc is an option. > > > > I think, that something like vmsplice may be an option. I see in > sources of file, that prim_inet:getfd is no here (yes, I know that it > is undocumented =) > and that is why I may use some weird tricks with optimizing. > > sendfile is a bad option because: > 1) I need to serve from memory > 2) I need to serve several thousands of connections. Threads are not > the way to go. > > However, I think that I will need to patch efile_drv for using > something like vmsplice > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From roberto@REDACTED Thu Dec 15 02:31:27 2011 From: roberto@REDACTED (Roberto Ostinelli) Date: Wed, 14 Dec 2011 17:31:27 -0800 Subject: [erlang-questions] How to handle 'GET' in latest version of misultin In-Reply-To: References: Message-ID: hi richard, that's not the latest version of misultin, it's HEAD in git and it's 0.9-dev. this relates to a bug which has already been fixed. i would suggest to use appropriate github issues to signal these and other misultin-related bugs. thank you, r. On Wed, Dec 14, 2011 at 9:08 AM, Richard Evans < richardprideauxevans@REDACTED> wrote: > Hey guys, > > In a previous version of misultin (0.8 and earlier version of 0.9), I > was doing this kind of > thing to get files: > > handle('GET', [], Req) -> > Req:file("../../../client/SplashScreen.html"); > > handle('GET', ["js", X], Req) -> > Req:file("../../../client/js/"++X); > > > but this no longer seems to be working with the latest version of misultin. > > e.g. it complains Error in process <0.64.0> with exit value: > > {undef,[{misultin_http,request,[{c,<0.35.0>,<0.37.0>,24594,8080,30000,4194304,2000,false,#Fun,true,#Fun,true,['draft-hybi-17','draft-hybi-10','draft-hixie-76'],undefined,false,true,false},{req,#Port<0.981>,http,{127,0,0,1},58496,undefined,close,undefined,{1,1},undefined,undefined,[],[],<<0 > bytes>>... > > > Does anybody know how things have changed and what I need to modify? > > thanks, > Richard > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From vances@REDACTED Thu Dec 15 04:44:20 2011 From: vances@REDACTED (Vance Shipley) Date: Thu, 15 Dec 2011 09:14:20 +0530 Subject: [erlang-questions] hierarchical behaviour doesn't seem to work ? In-Reply-To: <20111214173632.GI27642@prithivi.gnumonks.org> References: <20111213173751.GE10252@prithivi.gnumonks.org> <20111214075539.GB298@aluminum.motivity.ca> <20111214173632.GI27642@prithivi.gnumonks.org> Message-ID: <20111215034419.GE298@aluminum.motivity.ca> On Wed, Dec 14, 2011 at 06:36:32PM +0100, Harald Welte wrote: } > Cascading behaviours wasn't anticipated in the design and, aside } > from me, very few people have used that design pattern. } } At least when it comes to public Erlang code, it seems like that. I did use it in my LAPD protocol implementation to interface to a lower layer transport provider: http://lapderl.googlecode.com } I hope to have signerl/TCAP working fully in the next two weeks. Excellent, I am so happy to see that project coming to fruition. -- -Vance From bchesneau@REDACTED Thu Dec 15 07:28:50 2011 From: bchesneau@REDACTED (Benoit Chesneau) Date: Thu, 15 Dec 2011 07:28:50 +0100 Subject: [erlang-questions] Erlang/OTP R15B has been released (now with correct README link) In-Reply-To: References: Message-ID: On Wed, Dec 14, 2011 at 4:22 PM, Kenneth Lundin wrote: > Erlang/OTP R15B has been released. > > This is a new major release of Erlang/OTP > > This is a release with many interesting new features: > > Highlights: > > Line number and filename information are now included in exception > backtraces. This information will be pretty-printed in the shell and used in > crash reports etc. In practice it will be much easier to find where > something failed. > The driver interface has been changed to enable 64-bit aware drivers. Most > importantly the return types for ErlDrvEntry callbacks 'call' and 'control' > has been changed which require drivers to be changed. > New in this release is the support for 64 bit? Windows. > CommonTest hooks are now in a final supported version. > There is a new GUI tool in the observer application which integrates pman, > etop, appmon and tv into one tool. The tool does also contain functions for > activating tracing in an easy way. > The Erlang distribution can now be run over the new SSL implementation. > > You can find the README file with more detailed info at > > http://www.erlang.org/download/otp_src_R15B.readme > > You can download the full source distribution from > > ??http://www.erlang.org/download/otp_src_R15B.tar.gz > ??http://www.erlang.org/download/otp_src_R15B.readme?(this file) > > Note: To unpack the TAR archive you need a GNU TAR compatible program. > > For installation instructions please read the README that is part of > the distribution. > > The Windows binary distribution can be downloaded from > > ??http://www.erlang.org/download/otp_win32_R15B.exe > ??http://www.erlang.org/download/otp_win64_R15B.exe > > > On-line documentation can be found at?http://www.erlang.org/doc/. > You can also download the complete HTML documentation or the Unix manual > files > > ??http://www.erlang.org/download/otp_doc_html_R15B.tar.gz > ??http://www.erlang.org/download/otp_doc_man_R15B.tar.gz > > We also want to thank those that sent us patches, suggestions and bug > reports, > > The OTP Team at Ericsson > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > Is the bug with openssl on macosx lion fixed on this release? - beno?t From jack@REDACTED Thu Dec 15 08:00:37 2011 From: jack@REDACTED (Jack Moffitt) Date: Thu, 15 Dec 2011 00:00:37 -0700 Subject: [erlang-questions] Erlang/OTP R15B has been released In-Reply-To: <4EE8D667.8070209@cs.ntua.gr> References: <4EE8D667.8070209@cs.ntua.gr> Message-ID: > PS. It's of course not a big deal, but it's a bit of a pity that behaviour > callbacks was not listed in the R15B release highlights... It's a language > addition after all, which had to wait for quite a long time in order to be > included in a major instead of some minor release. I can't seem to find any mention of it in the README either. Would you mind pointing us to some documentation of this new feature? It sounds interesting. jack. From rapsey@REDACTED Thu Dec 15 08:55:19 2011 From: rapsey@REDACTED (Rapsey) Date: Thu, 15 Dec 2011 08:55:19 +0100 Subject: [erlang-questions] Non-blocking send in erlang: how to save memory when send one content to many people In-Reply-To: References: Message-ID: My streaming server is in Erlang and uses this approach. Though a linked in driver is not a good idea. I started with a linked in driver but it was pretty much impossible to get it really stable. With NIFs you can use resources for sockets and stream buffers. They work beautifully. I have a NIF thread that listens on kqueue/epoll and communicates with a gen_server. Sockets are resources. Communication from NIFs to gen_server is simple since enif_send exists, communication from gen_server to the NIF thread is done by pipes (global library read pipe and write pipe). The Erlang process that is responsible for sending data to the sockets holds a resource to the stream buffer and a list of socket resources. So the actual loop that sends the data is in Erlang and it calls a NIF with buffer and socket resource on every iteration. Sergej On Wed, Dec 14, 2011 at 11:48 PM, Max Lapshin wrote: > I'm sending live stream to 4000+ users. > > Stream is saved in memory (in shared ETS table, in binaries) in chunks > 500 KBytes each. > > Client comes and asks for next chunk. > > If I write server in C (or with linked-in driver), I whould just > manage common shared circular buffer from which I will send data and > remember > client position in this buffer. If client is too slow to read from > this buffer, it is disconnected and forgotten. > > Such approach give ability to save memory and not to copy it in > buffers and driver queues. > > Is it possible to have something like this in erlang? > > Currently, I've got limits around 3 GBit/s from one erlang node on > loopback interface and I want to raise this limit. > When traffic comes to this limit, memory begins very fast growing and > when it reaches limits of RAM, massive disconnects happen. > This is why I think, that I should save memory first without trying to > write linked-in tcp driver =) > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From zabrane3@REDACTED Thu Dec 15 09:00:05 2011 From: zabrane3@REDACTED (Zabrane Mickael) Date: Thu, 15 Dec 2011 09:00:05 +0100 Subject: [erlang-questions] Non-blocking send in erlang: how to save memory when send one content to many people In-Reply-To: References: Message-ID: <735A690F-7B68-470A-8E95-8174B873D290@gmail.com> Hi Sergej, On Dec 15, 2011, at 8:55 AM, Rapsey wrote: > My streaming server is in Erlang and uses this approach. Though a linked in driver is not a good idea. I started with a linked in driver but it was pretty much impossible to get it really stable. With NIFs you can use resources for sockets and stream buffers. They work beautifully. Very interesting approcah. > I have a NIF thread that listens on kqueue/epoll and communicates with a gen_server. Sockets are resources. 1 thread NIF per core? > Communication from NIFs to gen_server is simple since enif_send exists, communication from gen_server to the NIF thread is done by pipes (global library read pipe and write pipe). Could you please elaborae further on how communication is made from Erlang to NIF (the read/write pipe)? Regards, Zabrane > The Erlang process that is responsible for sending data to the sockets holds a resource to the stream buffer and a list of socket resources. So the actual loop that sends the data is in Erlang and it calls a NIF with buffer and socket resource on every iteration. > > > Sergej > > On Wed, Dec 14, 2011 at 11:48 PM, Max Lapshin wrote: > I'm sending live stream to 4000+ users. > > Stream is saved in memory (in shared ETS table, in binaries) in chunks > 500 KBytes each. > > Client comes and asks for next chunk. > > If I write server in C (or with linked-in driver), I whould just > manage common shared circular buffer from which I will send data and > remember > client position in this buffer. If client is too slow to read from > this buffer, it is disconnected and forgotten. > > Such approach give ability to save memory and not to copy it in > buffers and driver queues. > > Is it possible to have something like this in erlang? > > Currently, I've got limits around 3 GBit/s from one erlang node on > loopback interface and I want to raise this limit. > When traffic comes to this limit, memory begins very fast growing and > when it reaches limits of RAM, massive disconnects happen. > This is why I think, that I should save memory first without trying to > write linked-in tcp driver =) > _______________________________________________ > 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 cyg.cao@REDACTED Thu Dec 15 09:18:03 2011 From: cyg.cao@REDACTED (Wei) Date: Thu, 15 Dec 2011 00:18:03 -0800 (PST) Subject: [erlang-questions] parsing dates In-Reply-To: References: Message-ID: see jlib:datetime_string_to_timestamp/1 in ejabberd On Dec 15, 5:18?am, Joel Reymont wrote: > Is there a function somewhere to parse a date like this: > > 2008-06-30T00:00:00.000Z > > ? ? Thanks, Joel > > --- > Hardcore embedded Linux developmenthttp://www.linkedin.com/in/joelreymont > Device drivers, firmware and debugging > > _______________________________________________ > erlang-questions mailing list > erlang-questi...@REDACTED://erlang.org/mailman/listinfo/erlang-questions From rapsey@REDACTED Thu Dec 15 09:26:16 2011 From: rapsey@REDACTED (Rapsey) Date: Thu, 15 Dec 2011 09:26:16 +0100 Subject: [erlang-questions] Non-blocking send in erlang: how to save memory when send one content to many people In-Reply-To: <735A690F-7B68-470A-8E95-8174B873D290@gmail.com> References: <735A690F-7B68-470A-8E95-8174B873D290@gmail.com> Message-ID: On Thu, Dec 15, 2011 at 9:00 AM, Zabrane Mickael wrote: > I have a NIF thread that listens on kqueue/epoll and communicates with a > gen_server. Sockets are resources. > > > 1 thread NIF per core? > > All that the NIF thread does is accept connections and reads from sockets. I see no need to have more than 1. > Communication from NIFs to gen_server is simple since enif_send exists, > communication from gen_server to the NIF thread is done by pipes (global > library read pipe and write pipe). > > > Could you please elaborae further on how communication is made from Erlang > to NIF (the read/write pipe)? > > On thread initialization the pipes get created and read pipe is placed in epoll/kqueue. Write pipe is from erlang to NIF, and read pipe is for NIF to read that data. I have a simple struct: typedef struct kqmsg { char what; int fd; ErlNifPid pid; void* data; }kqmsg; So I just fill up this struct with whatever info is required and do: write(pipe_write,&msg,sizeof(struct kqmsg) As for sockets, I do not use prim_inet:getfd, sockets are completely separate from gen_tcp. The NIF thread keeps the socket FD until it reads the first buffer from it. Once this happens it creates a socket resource, then sends the binary and socket with enif_send to the Erlang process that is in charge of deciding what to do with it. Sergej -------------- next part -------------- An HTML attachment was scrubbed... URL: From lukas@REDACTED Thu Dec 15 10:21:43 2011 From: lukas@REDACTED (Lukas Larsson) Date: Thu, 15 Dec 2011 10:21:43 +0100 Subject: [erlang-questions] Erlang/OTP R15B has been released In-Reply-To: References: <4EE8D667.8070209@cs.ntua.gr> Message-ID: OTP-9621 is the ticket number relating to this change. OTP-9621 Add '-callback' attributes in stdlib's behaviours Replace the behaviour_info(callbacks) export in stdlib's behaviours with -callback' attributes for all the callbacks. Update the documentation with information on the callback attribute Automatically generate 'behaviour_info' function from '-callback' attributes 'behaviour_info(callbacks)' is a special function that is defined in a module which describes a behaviour and returns a list of its callbacks. This function is now automatically generated using the '-callback' specs. An error is returned by lint if user defines both '-callback' attributes and the behaviour_info/1 function. If no type info is needed for a callback use a generic spec for it. Add '-callback' attribute to language syntax Behaviours may define specs for their callbacks using the familiar spec syntax, replacing the '-spec' keyword with '-callback'. Simple lint checks are performed to ensure that no callbacks are defined twice and all types referred are declared. These attributes can be then used by tools to provide documentation to the behaviour or find discrepancies in the callback definitions in the callback module. Add callback specs into 'application' module in kernel Add callback specs to tftp module following internet documentation Add callback specs to inets_service module following possibly deprecated comments Lukas On Thu, Dec 15, 2011 at 8:00 AM, Jack Moffitt wrote: > > > PS. It's of course not a big deal, but it's a bit of a pity that behaviour > > callbacks was not listed in the R15B release highlights... It's a language > > addition after all, which had to wait for quite a long time in order to be > > included in a major instead of some minor release. > > I can't seem to find any mention of it in the README either. Would you > mind pointing us to some documentation of this new feature? It sounds > interesting. > > jack. > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions From gopienko@REDACTED Thu Dec 15 10:35:30 2011 From: gopienko@REDACTED (Andrew Gopienko) Date: Thu, 15 Dec 2011 16:35:30 +0700 Subject: [erlang-questions] Building small erlang vm suitable for bundle with app. In-Reply-To: References: <81f1931c-eaf6-45e7-b0ea-d3b52b2baa7f@knuth> Message-ID: Hi, You can also strip the executables and erlang beams (beam_lib:strip*). -rwxr-xr-x 1 tdx tdx 1942300 2011-12-15 13:29 beam* -rwxr-xr-x 1 tdx tdx 2134876 2011-12-15 13:29 beam.smp* Andrew Gopienko 2011/12/14 dmitry kolesnikov > Hi, > > I have not yet spent too much time to investigate how to build 2MB > self-sustainable package but systools gives me about 14MB with possible > reduction to 7 - 9MB on debian 64bit. > > as an example *.rel package contains following libraries: > {kernel, "2.14.5"}, > {stdlib, "1.17.5"}, > {sasl, "2.1.10"}, > {crypto, "2.0.4"}, > {public_key, "0.13"}, > {ssl, "4.1.6"}, > {inets, "5.7.1"}, > {compiler, "4.7.5"}, > {syntax_tools, "1.6.7.1"}, > {xmerl, "1.2.10"}, > {mochiweb, "2.3.0"} > ... > > systools:make_tar($$n, [{erts, code:root_dir()}]) %% do not put any extra > dirs here > > most heavy components are VM by itself > -rwxr-xr-x 1 kolesnik wheel 7.7M Oct 19 20:53 beam > -rwxr-xr-x 1 kolesnik wheel 9.6M Oct 19 20:53 beam.smp > > - Dmitry > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From qoocku@REDACTED Thu Dec 15 10:52:15 2011 From: qoocku@REDACTED (=?UTF-8?B?RGFtaWFuIERvYnJvY3p5xYRza2k=?=) Date: Thu, 15 Dec 2011 10:52:15 +0100 Subject: [erlang-questions] Erlang/OTP R15B has been released In-Reply-To: References: <4EE8D667.8070209@cs.ntua.gr> Message-ID: <4EE9C34F.10207@gmail.com> W dniu 15.12.2011 10:21, Lukas Larsson pisze: > OTP-9621 is the ticket number relating to this change. > > OTP-9621 Add '-callback' attributes in stdlib's behaviours > > Replace the behaviour_info(callbacks) export in stdlib's > behaviours with -callback' attributes for all the callbacks. > Update the documentation with information on the callback > attribute Automatically generate 'behaviour_info' function > from '-callback' attributes > > 'behaviour_info(callbacks)' is a special function that is > defined in a module which describes a behaviour and returns a > list of its callbacks. > > This function is now automatically generated using the > '-callback' specs. An error is returned by lint if user > defines both '-callback' attributes and the behaviour_info/1 > function. If no type info is needed for a callback use a > generic spec for it. Add '-callback' attribute to language > syntax > > Behaviours may define specs for their callbacks using the > familiar spec syntax, replacing the '-spec' keyword with > '-callback'. Simple lint checks are performed to ensure that > no callbacks are defined twice and all types referred are > declared. > > These attributes can be then used by tools to provide > documentation to the behaviour or find discrepancies in the > callback definitions in the callback module. > > Add callback specs into 'application' module in kernel Add > callback specs to tftp module following internet > documentation Add callback specs to inets_service module > following possibly deprecated comments > > > Lukas > > On Thu, Dec 15, 2011 at 8:00 AM, Jack Moffitt wrote: >> >>> PS. It's of course not a big deal, but it's a bit of a pity that behaviour >>> callbacks was not listed in the R15B release highlights... It's a language >>> addition after all, which had to wait for quite a long time in order to be >>> included in a major instead of some minor release. >> >> I can't seem to find any mention of it in the README either. Would you >> mind pointing us to some documentation of this new feature? It sounds >> interesting. >> >> jack. Just be aware of dialyzer "feature" which is it recognizes only "-behavioUr" attribute spelling not "-behaviOr" - if you have some of the latter you end up cleaning your code from "-behavior" replacing with "-behaviour" or manually fix the code in dialyzer_behaviors.erl file, line 78 and recompile. -- D. From gordon@REDACTED Thu Dec 15 11:01:40 2011 From: gordon@REDACTED (Gordon Guthrie) Date: Thu, 15 Dec 2011 10:01:40 +0000 Subject: [erlang-questions] parsing dates In-Reply-To: References: Message-ID: Dale Harvey's dh_date module does a lot of date parsing and formatting: https://github.com/daleharvey/dh_date Gordon On 14 December 2011 21:18, Joel Reymont wrote: > Is there a function somewhere to parse a date like this: > > 2008-06-30T00:00:00.000Z > > ? ?Thanks, Joel > > --- > Hardcore embedded Linux development > http://www.linkedin.com/in/joelreymont > Device drivers, firmware and debugging > > > > > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions -- Gordon Guthrie CEO hypernumbers http://hypernumbers.com t: hypernumbers +44 7776 251669 From aronisstav@REDACTED Thu Dec 15 11:03:45 2011 From: aronisstav@REDACTED (Stavros Aronis) Date: Thu, 15 Dec 2011 02:03:45 -0800 (PST) Subject: [erlang-questions] Somebody please correct my -callback understanding In-Reply-To: <3AA33CE9-0648-4989-81A4-50F2BA9D9465@feuerlabs.com> References: <4EE8D5AF.2000501@gmail.com> <4EE8E6D9.1060004@gmail.com> <3AA33CE9-0648-4989-81A4-50F2BA9D9465@feuerlabs.com> Message-ID: <11336984.366.1323943426001.JavaMail.geo-discussion-forums@yqcp19> Hi Damian, you are correct to point out that this is an omission on Dialyzer's part. I will send a patch for this soon. Stavros -------------- next part -------------- An HTML attachment was scrubbed... URL: From qoocku@REDACTED Thu Dec 15 11:08:08 2011 From: qoocku@REDACTED (=?UTF-8?B?RGFtaWFuIERvYnJvY3p5xYRza2k=?=) Date: Thu, 15 Dec 2011 11:08:08 +0100 Subject: [erlang-questions] Somebody please correct my -callback understanding In-Reply-To: <11336984.366.1323943426001.JavaMail.geo-discussion-forums@yqcp19> References: <4EE8D5AF.2000501@gmail.com> <4EE8E6D9.1060004@gmail.com> <3AA33CE9-0648-4989-81A4-50F2BA9D9465@feuerlabs.com> <11336984.366.1323943426001.JavaMail.geo-discussion-forums@yqcp19> Message-ID: <4EE9C708.1050808@gmail.com> Dnia czw, 15 gru 2011, 11:03:45 Stavros Aronis pisze: > Hi Damian, > > you are correct to point out that this is an omission on Dialyzer's > part. I will send a patch for this soon. > > Stavros Thanx. B.regards, D. From kostis@REDACTED Thu Dec 15 11:39:52 2011 From: kostis@REDACTED (Kostis Sagonas) Date: Thu, 15 Dec 2011 11:39:52 +0100 Subject: [erlang-questions] Erlang/OTP R15B has been released In-Reply-To: References: <4EE8D667.8070209@cs.ntua.gr> Message-ID: <4EE9CE78.8000203@cs.ntua.gr> On 12/14/2011 06:05 PM, Kenny Stone wrote: > How do "behaviour callbacks" differ from the way it used to work? In a nutshell, behaviour callbacks allow behaviour modules to specify (using a formal language, instead of just in comments) the names and types of all functions that callback modules should implement. This information can then be processed by dialyzer (but in the future presumably also by other tools, e.g. edoc) to check conformance of a callback module with what the behaviour module expects and warn the user for errors that may exist. The syntax of -callback attributes is the same as that of -spec attributes. The main difference is that -callback attributes refer to functions that do not belong to the module containing them (and cannot be found in its code) but to the callback module(s). Note the callback module can provide more specific implementations of what the behaviour module expects. For example, a gen_server expects that the callback module exports an init/1 function. In R15B, the relevant callback attribute reads: -callback init(Args :: term()) -> {ok, State :: term()} | {ok, State :: term(), timeout() | hibernate} | {stop, Reason :: term()} | ignore. but a specific callback module may decide to provide an init function that accepts an empty list as Args and only returns {ok, State}. Thus, in the callback module, one may want to provide the following spec: -spec init([]) -> {ok, state()}. for some locally defined state() type. Kostis PS. We'll try to add this in Section 1.2 of the OTP Design Principles User's Guide. Currently, some of this info has been added in a weird place of the Guide that is hard to find... Apologies for this. From rapsey@REDACTED Thu Dec 15 12:12:49 2011 From: rapsey@REDACTED (Rapsey) Date: Thu, 15 Dec 2011 12:12:49 +0100 Subject: [erlang-questions] Non-blocking send in erlang: how to save memory when send one content to many people In-Reply-To: References: <735A690F-7B68-470A-8E95-8174B873D290@gmail.com> Message-ID: On Thu, Dec 15, 2011 at 11:48 AM, Zabrane Mickael wrote: > > On thread initialization the pipes get created and read pipe is placed > in epoll/kqueue. Write pipe is from erlang to NIF, and read pipe is for NIF > to read that data. I have a simple struct: > > typedef struct kqmsg > > { > > char what; > > int fd; > > ErlNifPid pid; > > void* data; > > }kqmsg; > > So I just fill up this struct with whatever info is required and do: > write(pipe_write,&msg,sizeof(struct kqmsg) > > > > As for sockets, I do not use prim_inet:getfd, sockets are completely > separate from gen_tcp. The NIF thread keeps the socket FD until it reads > the first buffer from it. Once this happens it creates a socket resource, > then sends the binary and socket with enif_send to the Erlang process that > is in charge of deciding what to do with it. > > > Does this approach "really" increase performances of your server? > In the live streaming use case absolutely. HTTP is half-duplex. Once the server receives all the headers, it does not need to listen on that socket anymore. This means there is no need to keep the socket in the NIF listen thread and all you are doing is periodic write's on the FD from the stream buffer. This is where the real optimization is. Maintaining one circular buffer and just looping sockets over it and doing writes. On my servers traffic goes through haproxy on port 80. Once there is a good amount of users on the server, haproxy actually uses more CPU than my streaming server. Sergej -------------- next part -------------- An HTML attachment was scrubbed... URL: From zabrane3@REDACTED Thu Dec 15 12:46:27 2011 From: zabrane3@REDACTED (Zabrane Mickael) Date: Thu, 15 Dec 2011 12:46:27 +0100 Subject: [erlang-questions] Non-blocking send in erlang: how to save memory when send one content to many people In-Reply-To: References: <735A690F-7B68-470A-8E95-8174B873D290@gmail.com> Message-ID: <6F429D36-57D8-45A5-BCE6-3966629A1E85@gmail.com> > > In the live streaming use case absolutely. HTTP is half-duplex. Once the server receives all the headers, it does not need to listen on that socket anymore. This means there is no need to keep the socket in the NIF listen thread and all you are doing is periodic write's on the FD from the stream buffer. This is where the real optimization is. Maintaining one circular buffer and just looping sockets over it and doing writes. > On my servers traffic goes through haproxy on port 80. Once there is a good amount of users on the server, haproxy actually uses more CPU than my streaming server. Makes sense now. Thanks Sergej Regards, Zabrane From gumm@REDACTED Thu Dec 15 13:15:36 2011 From: gumm@REDACTED (Jesse Gumm) Date: Thu, 15 Dec 2011 06:15:36 -0600 Subject: [erlang-questions] parsing dates In-Reply-To: References: Message-ID: Write, I did not know about this. I had my own little homegrown date parser, but this is way more comprehensive. Very cool, thank you. -Jesse -- Jesse Gumm Owner, Sigma Star Systems 414.940.4866 www.sigma-star.com @jessegumm On Dec 15, 2011 4:01 AM, "Gordon Guthrie" wrote: > Dale Harvey's dh_date module does a lot of date parsing and formatting: > https://github.com/daleharvey/dh_date > > Gordon > > On 14 December 2011 21:18, Joel Reymont wrote: > > Is there a function somewhere to parse a date like this: > > > > 2008-06-30T00:00:00.000Z > > > > Thanks, Joel > > > > --- > > Hardcore embedded Linux development > > http://www.linkedin.com/in/joelreymont > > Device drivers, firmware and debugging > > > > > > > > > > > > > > _______________________________________________ > > erlang-questions mailing list > > erlang-questions@REDACTED > > http://erlang.org/mailman/listinfo/erlang-questions > > > > -- > Gordon Guthrie > CEO hypernumbers > > http://hypernumbers.com > t: hypernumbers > +44 7776 251669 > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From gumm@REDACTED Thu Dec 15 13:17:23 2011 From: gumm@REDACTED (Jesse Gumm) Date: Thu, 15 Dec 2011 06:17:23 -0600 Subject: [erlang-questions] parsing dates In-Reply-To: References: Message-ID: Wow at the auto correct fail there. First word should have been "Wow", not "write". -- Jesse Gumm Owner, Sigma Star Systems 414.940.4866 www.sigma-star.com @jessegumm On Dec 15, 2011 6:15 AM, "Jesse Gumm" wrote: > Write, I did not know about this. I had my own little homegrown date > parser, but this is way more comprehensive. Very cool, thank you. > > -Jesse > > -- > Jesse Gumm > Owner, Sigma Star Systems > 414.940.4866 > www.sigma-star.com > @jessegumm > On Dec 15, 2011 4:01 AM, "Gordon Guthrie" wrote: > >> Dale Harvey's dh_date module does a lot of date parsing and formatting: >> https://github.com/daleharvey/dh_date >> >> Gordon >> >> On 14 December 2011 21:18, Joel Reymont wrote: >> > Is there a function somewhere to parse a date like this: >> > >> > 2008-06-30T00:00:00.000Z >> > >> > Thanks, Joel >> > >> > --- >> > Hardcore embedded Linux development >> > http://www.linkedin.com/in/joelreymont >> > Device drivers, firmware and debugging >> > >> > >> > >> > >> > >> > >> > _______________________________________________ >> > erlang-questions mailing list >> > erlang-questions@REDACTED >> > http://erlang.org/mailman/listinfo/erlang-questions >> >> >> >> -- >> Gordon Guthrie >> CEO hypernumbers >> >> http://hypernumbers.com >> t: hypernumbers >> +44 7776 251669 >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://erlang.org/mailman/listinfo/erlang-questions >> > -------------- next part -------------- An HTML attachment was scrubbed... URL: From gordon@REDACTED Thu Dec 15 13:22:07 2011 From: gordon@REDACTED (Gordon Guthrie) Date: Thu, 15 Dec 2011 12:22:07 +0000 Subject: [erlang-questions] parsing dates In-Reply-To: References: Message-ID: Yeah, his aim was to make a standard module like the corresponding PHP library that could handle the RFC date formats in HTTP and stuff... Its a nice sweet little library - should be a standard library really, I think. Gordon On 15 December 2011 12:15, Jesse Gumm wrote: > Write, I did not know about this. I had my own little homegrown date parser, > but this is way more comprehensive. Very cool, thank you. > > -Jesse > > -- > Jesse Gumm > Owner, Sigma Star Systems > 414.940.4866 > www.sigma-star.com > @jessegumm > > On Dec 15, 2011 4:01 AM, "Gordon Guthrie" wrote: >> >> Dale Harvey's dh_date module does a lot of date parsing and formatting: >> https://github.com/daleharvey/dh_date >> >> Gordon >> >> On 14 December 2011 21:18, Joel Reymont wrote: >> > Is there a function somewhere to parse a date like this: >> > >> > 2008-06-30T00:00:00.000Z >> > >> > ? ?Thanks, Joel >> > >> > --- >> > Hardcore embedded Linux development >> > http://www.linkedin.com/in/joelreymont >> > Device drivers, firmware and debugging >> > >> > >> > >> > >> > >> > >> > _______________________________________________ >> > erlang-questions mailing list >> > erlang-questions@REDACTED >> > http://erlang.org/mailman/listinfo/erlang-questions >> >> >> >> -- >> Gordon Guthrie >> CEO hypernumbers >> >> http://hypernumbers.com >> t: hypernumbers >> +44 7776 251669 >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://erlang.org/mailman/listinfo/erlang-questions -- Gordon Guthrie CEO hypernumbers http://hypernumbers.com t: hypernumbers +44 7776 251669 From ericbmerritt@REDACTED Thu Dec 15 15:53:30 2011 From: ericbmerritt@REDACTED (Eric B Merritt) Date: Thu, 15 Dec 2011 09:53:30 -0500 Subject: [erlang-questions] parsing dates In-Reply-To: References: Message-ID: <1323960810.2364.5.camel@localhost.localdomain> With Dale's concent and approval, I made some parsing and testing improvements and moved this into erlware_commons (whose point is to be an extension to the stdlib) it is here -> https://github.com/erlware/erlware_commons/blob/master/src/ec_date.erl On Thu, 2011-12-15 at 12:22 +0000, Gordon Guthrie wrote: > Yeah, his aim was to make a standard module like the corresponding PHP > library that could handle the RFC date formats in HTTP and stuff... > > Its a nice sweet little library - should be a standard library really, I think. > > Gordon > > On 15 December 2011 12:15, Jesse Gumm wrote: > > Write, I did not know about this. I had my own little homegrown date parser, > > but this is way more comprehensive. Very cool, thank you. > > > > -Jesse > > > > -- > > Jesse Gumm > > Owner, Sigma Star Systems > > 414.940.4866 > > www.sigma-star.com > > @jessegumm > > > > On Dec 15, 2011 4:01 AM, "Gordon Guthrie" wrote: > >> > >> Dale Harvey's dh_date module does a lot of date parsing and formatting: > >> https://github.com/daleharvey/dh_date > >> > >> Gordon > >> > >> On 14 December 2011 21:18, Joel Reymont wrote: > >> > Is there a function somewhere to parse a date like this: > >> > > >> > 2008-06-30T00:00:00.000Z > >> > > >> > Thanks, Joel > >> > > >> > --- > >> > Hardcore embedded Linux development > >> > http://www.linkedin.com/in/joelreymont > >> > Device drivers, firmware and debugging > >> > > >> > > >> > > >> > > >> > > >> > > >> > _______________________________________________ > >> > erlang-questions mailing list > >> > erlang-questions@REDACTED > >> > http://erlang.org/mailman/listinfo/erlang-questions > >> > >> > >> > >> -- > >> Gordon Guthrie > >> CEO hypernumbers > >> > >> http://hypernumbers.com > >> t: hypernumbers > >> +44 7776 251669 > >> _______________________________________________ > >> erlang-questions mailing list > >> erlang-questions@REDACTED > >> http://erlang.org/mailman/listinfo/erlang-questions > > > From sgolovan@REDACTED Thu Dec 15 16:44:41 2011 From: sgolovan@REDACTED (Sergei Golovan) Date: Thu, 15 Dec 2011 19:44:41 +0400 Subject: [erlang-questions] R15B changes erl_driver API Message-ID: Hi! Appears that erl_driver API has been changed in R15B. The following change in erts/emulator/beam/erl_bif_ddll.c (R15B with respect to R14B04) ----------------------------------------------------------------------------------------- } switch (dp->extended_marker) { - case 0: - /* - * This may be an old driver that has been recompiled. If so, - * at least the fields that existed in extended driver version - * 1.0 should be zero. If not, a it is a bad driver. We cannot - * be completely certain that this is a valid driver but this is - * the best we can do with old drivers... - */ - if (dp->major_version != 0 - || dp->minor_version != 0 - || dp->driver_flags != 0 - || dp->handle2 != NULL - || dp->process_exit != NULL) { - /* Old driver; needs to be recompiled... */ - return ERL_DE_LOAD_ERROR_INCORRECT_VERSION; - } - break; case ERL_DRV_EXTENDED_MARKER: if (ERL_DRV_EXTENDED_MAJOR_VERSION != dp->major_version || ERL_DRV_EXTENDED_MINOR_VERSION < dp->minor_version) { ----------------------------------------------------------------------------------------- makes R15B return error "incorrect driver version" for so-called old drivers (which don't initialize fields extended_marker, major_version and minor_version in their ErlDrvEntry structure, or initialize them as zeros). As a consequence 1) documentation became incorrect (at least http://www.erlang.org/doc/man/driver_entry.html where extended_marker is still allowed to be 0); 2) example from http://www.erlang.org/doc/tutorial/c_portdriver.html doesn't work anymore; 3) many existing applications break (YAWS and ejabberd definitely, I suspect many others too, because example in tutorial don't use extended_marker). So, will this change be permanent (the documentation and all applications are to be fixed), or this change will be considered too disruptive and old drivers will be allowed back in R15B01? (By the way, the error message is a bit misleading, especially after the driver was recompiled using R15B.) Cheers! -- Sergei Golovan From vinoski@REDACTED Thu Dec 15 17:46:07 2011 From: vinoski@REDACTED (Steve Vinoski) Date: Thu, 15 Dec 2011 11:46:07 -0500 Subject: [erlang-questions] R15B changes erl_driver API In-Reply-To: References: Message-ID: On Thu, Dec 15, 2011 at 10:44 AM, Sergei Golovan wrote: > > 3) many existing applications break (YAWS and ejabberd definitely, I > suspect many others too, because example in tutorial don't use > extended_marker). Yaws is already fixed on master at github: https://github.com/klacke/yaws . --steve From kenneth.lundin@REDACTED Thu Dec 15 18:38:39 2011 From: kenneth.lundin@REDACTED (Kenneth Lundin) Date: Thu, 15 Dec 2011 18:38:39 +0100 Subject: [erlang-questions] R15B changes erl_driver API In-Reply-To: References: Message-ID: Den 15 dec 2011 16:45 skrev "Sergei Golovan" : > > Hi! > > Appears that erl_driver API has been changed in R15B. The following > change in erts/emulator/beam/erl_bif_ddll.c (R15B with respect to > R14B04) > This should be no surprise since it is clearly mentioned in the release highlights and in the Readme file. It is also in the documentation, but as you point out there might be some remaining issues there, thanks for that. The change imicrotonal and will stay like this. We thought it was better to require the use of version number in drivers so that we can detect old drivers and refuse loading them, rather than just trying to run which might result in strange errors later during runtime. > ---- ... /Kenneth, Erlang/OTP Ericsson -------------- next part -------------- An HTML attachment was scrubbed... URL: From andrew@REDACTED Thu Dec 15 18:42:00 2011 From: andrew@REDACTED (Andrew Thompson) Date: Thu, 15 Dec 2011 12:42:00 -0500 Subject: [erlang-questions] parsing dates In-Reply-To: <1323960810.2364.5.camel@localhost.localdomain> References: <1323960810.2364.5.camel@localhost.localdomain> Message-ID: <20111215174159.GJ13603@hijacked.us> On Thu, Dec 15, 2011 at 09:53:30AM -0500, Eric B Merritt wrote: > With Dale's concent and approval, I made some parsing and testing > improvements and moved this into erlware_commons (whose point is to be > an extension to the stdlib) it is here -> > https://github.com/erlware/erlware_commons/blob/master/src/ec_date.erl So I can't list it as a rebar dep anymore without pulling down a whole bunch of extraneous code, or maintaining my own fork of dh_date? Also, why does the README for erlware commons talk about some expert system stuff, if its supposed to be an 'extension to the erlang stdlib'? Andrew From sgolovan@REDACTED Thu Dec 15 18:44:03 2011 From: sgolovan@REDACTED (Sergei Golovan) Date: Thu, 15 Dec 2011 21:44:03 +0400 Subject: [erlang-questions] R15B changes erl_driver API In-Reply-To: References: Message-ID: On Thu, Dec 15, 2011 at 9:38 PM, Kenneth Lundin wrote: >> > This should be no surprise since it is clearly mentioned in the release > highlights and in the Readme file. It is also in the documentation, but as > you point out there might be some remaining issues there, thanks for that. > The change imicrotonal and will stay like this. We thought it was better to > require the use of version number in drivers so that we can detect old > drivers and refuse loading them, rather than just trying to run which might > result in strange errors later during runtime. I must've missed this in highlights. Ok then, lets fix the applications. Cheers! -- Sergei Golovan From zabrane3@REDACTED Thu Dec 15 19:32:31 2011 From: zabrane3@REDACTED (Zabrane Mickael) Date: Thu, 15 Dec 2011 19:32:31 +0100 Subject: [erlang-questions] R15B changes erl_driver API In-Reply-To: References: Message-ID: Hi guys, After installing R15B (OSX 10.6.8), this module no longer works for me: https://github.com/alexeyr/erlang-sqlite3 I got the following error: [...] SUPERVISOR REPORT==== 15-Dec-2011::19:27:52 === Supervisor: {local,reactiv_sup} Context: start_error Reason: {{badmatch,{error,"Error loading sqlite3_drv_darwin_64: Driver compiled with incorrect version of erl_driver.h"}}, The driver seems to include the MAJOR/MINOR markers: https://github.com/alexeyr/erlang-sqlite3/blob/master/c_src/sqlite3_drv.c Any Help? Regards, Zabrane On Dec 15, 2011, at 6:38 PM, Kenneth Lundin wrote: > > Den 15 dec 2011 16:45 skrev "Sergei Golovan" : > > > > Hi! > > > > Appears that erl_driver API has been changed in R15B. The following > > change in erts/emulator/beam/erl_bif_ddll.c (R15B with respect to > > R14B04) > > > This should be no surprise since it is clearly mentioned in the release highlights and in the Readme file. It is also in the documentation, but as you point out there might be some remaining issues there, thanks for that. > The change imicrotonal and will stay like this. We thought it was better to require the use of version number in drivers so that we can detect old drivers and refuse loading them, rather than just trying to run which might result in strange errors later during runtime. > > > ---- > > ... > /Kenneth, Erlang/OTP Ericsson > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions -------------- next part -------------- An HTML attachment was scrubbed... URL: From sgolovan@REDACTED Thu Dec 15 19:40:23 2011 From: sgolovan@REDACTED (Sergei Golovan) Date: Thu, 15 Dec 2011 22:40:23 +0400 Subject: [erlang-questions] R15B changes erl_driver API In-Reply-To: References: Message-ID: On Thu, Dec 15, 2011 at 10:32 PM, Zabrane Mickael wrote: > Hi guys, > > After installing R15B (OSX 10.6.8), this module no longer works for me: > https://github.com/alexeyr/erlang-sqlite3 > > I got the following error: > [...] > SUPERVISOR REPORT==== 15-Dec-2011::19:27:52 === > ? ? ?Supervisor: {local,reactiv_sup} > ? ? ?Context: ? ?start_error > ? ? ?Reason: ? ? {{badmatch,{error,"Error loading sqlite3_drv_darwin_64: > Driver compiled with incorrect version of erl_driver.h"}}, > > The driver seems to include the MAJOR/MINOR markers: > https://github.com/alexeyr/erlang-sqlite3/blob/master/c_src/sqlite3_drv.c > > Any Help? You must rebuild it with Erlang R15B to work. Cheers! -- Sergei Golovan From zabrane3@REDACTED Thu Dec 15 19:39:33 2011 From: zabrane3@REDACTED (Zabrane Mickael) Date: Thu, 15 Dec 2011 19:39:33 +0100 Subject: [erlang-questions] R15B changes erl_driver API In-Reply-To: References: Message-ID: <2C1A4997-4FD2-40CE-BFE9-1A394B7D830D@gmail.com> Of course, that's what I did first before posting this error. On Dec 15, 2011, at 7:40 PM, Sergei Golovan wrote: > On Thu, Dec 15, 2011 at 10:32 PM, Zabrane Mickael wrote: >> Hi guys, >> >> After installing R15B (OSX 10.6.8), this module no longer works for me: >> https://github.com/alexeyr/erlang-sqlite3 >> >> I got the following error: >> [...] >> SUPERVISOR REPORT==== 15-Dec-2011::19:27:52 === >> Supervisor: {local,reactiv_sup} >> Context: start_error >> Reason: {{badmatch,{error,"Error loading sqlite3_drv_darwin_64: >> Driver compiled with incorrect version of erl_driver.h"}}, >> >> The driver seems to include the MAJOR/MINOR markers: >> https://github.com/alexeyr/erlang-sqlite3/blob/master/c_src/sqlite3_drv.c >> >> Any Help? > > You must rebuild it with Erlang R15B to work. > > Cheers! > -- > Sergei Golovan From spawn.think@REDACTED Thu Dec 15 23:05:25 2011 From: spawn.think@REDACTED (Ahmed Omar) Date: Thu, 15 Dec 2011 23:05:25 +0100 Subject: [erlang-questions] Summary for 2nd Erlang Hangout Message-ID: In our 2nd Erlang Hangout, +Max Bourinov presented a project done by his team. The project is a MMOG (massively multiplayer online game). The presentation was followed by discussions about some challanges they had and future work they are planning, and some advices they needed. You can watch it recorded here: (you can skip 1st 7 mins, we were waiting for everyone to get ready :) ) https://plus.google.com/b/108730584872406072872/photos/108730584872406072872/albums/5684284170310829889/5686472356141745090 If you are interested, post your ideas for the next hangouts. It could be about anything erlangish! https://plus.google.com/b/108730584872406072872/108730584872406072872/posts/7srJatpzeMr -- Best Regards, - Ahmed Omar http://nl.linkedin.com/in/adiaa Follow me on twitter @spawn_think -------------- next part -------------- An HTML attachment was scrubbed... URL: From bernie@REDACTED Fri Dec 16 00:44:48 2011 From: bernie@REDACTED (Bernie Duggan) Date: Fri, 16 Dec 2011 10:44:48 +1100 Subject: [erlang-questions] BEAM file forwards/backwards compatibility Message-ID: Hi all, A thread from earlier this year makes it clear that BEAM files are what I'll call "forwards compatible" for, nominally, 2 major versions. For example, beams compiles with R9 will run on R10 and R11. All great. My question, then, is what about "backwards compatibility"? Empirically, it appears that even minor release difference (compiled on R14B04 and attempting to run on R14B03) are enough to cause a file to be unable to be loaded , producing the error: {'cannot load',,get_file} Is this actually the expected behaviour, or should I be looking elsewhere for the cause of this problem? (If it's expected, no big deal, just as long as I know :)). Cheers, Bernard From yoursurrogategod@REDACTED Fri Dec 16 00:56:43 2011 From: yoursurrogategod@REDACTED (Yves S. Garret) Date: Thu, 15 Dec 2011 18:56:43 -0500 Subject: [erlang-questions] Erlang wallpaper Message-ID: Hey all. I was thinking today. Django and CakePHP have their own wallpapers, why shouldn't Erlang? Is there a 1600 x 1200 PNG somewhere that I can use on my computer, that, preferably has a nice big E in the middle? -------------- next part -------------- An HTML attachment was scrubbed... URL: From comptekki@REDACTED Fri Dec 16 04:43:07 2011 From: comptekki@REDACTED (Wes James) Date: Thu, 15 Dec 2011 20:43:07 -0700 Subject: [erlang-questions] Erlang wallpaper In-Reply-To: References: Message-ID: Maybe you could work with the one on this page: http://commons.wikimedia.org/w/index.php?title=Special%3ASearch&search=erlang -wes On Thu, Dec 15, 2011 at 4:56 PM, Yves S. Garret wrote: > Hey all. > > ? ?I was thinking today. ?Django and CakePHP have their own wallpapers, why > shouldn't Erlang? ?Is there a 1600 x 1200 PNG somewhere that I can use on my > computer, that, preferably has a nice big E in the middle? > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > From robert.virding@REDACTED Fri Dec 16 07:04:32 2011 From: robert.virding@REDACTED (Robert Virding) Date: Fri, 16 Dec 2011 06:04:32 -0000 (GMT) Subject: [erlang-questions] hierarchical behaviour doesn't seem to work ? In-Reply-To: <20111214173632.GI27642@prithivi.gnumonks.org> Message-ID: <242e9ab4-37fe-4ec3-87c6-4d91143f9e26@knuth> I include an example of how this can be done taken from one of our courses. It implements a behaviour which is a GS server built on top gen_server and provides a more specialised callback interface similar to the normal gen_server one. I hope this will help show how it can be done. Robert ----- Original Message ----- > Hi Vance, > > On Wed, Dec 14, 2011 at 01:25:40PM +0530, Vance Shipley wrote: > > > I wrote a howto article on this a few years ago: > > > > http://www.trapexit.org/Cascading_Behaviours > > ah, i see. > > > Yes, you need to define these functions in your module. Your > > client may extend these itself and/or pass them on to my_bahaviour. > > I've meanwhile found a solution to solve the problem. I was > thinking > the "wrong way around". What I need to do is I need to call > gen_server:start_link(), and tell in the init arguments which > specific > implementation it should use (my_behaviour), which then needs to get > passed the name of the actual module (client) into its init() > argument > list. > > > Cascading behaviours wasn't anticipated in the design and, aside > > from me, very few people have used that design pattern. > > At least when it comes to public Erlang code, it seems like that. > > And yes, the question was in fact related to signerl and the way how > tcap_tco_server extends gen_server, and my osmo_sccp_tcap then > provides > the callbacks to tcap_tco_server. > > Things seem to be coming along quite OK for remotely-initiated > transactions. I'm now working on locally-initiated transactions, > where > TC-BEGIN is coming from the TCAP user side. I hope to have > signerl/TCAP > working fully in the next two weeks. > > Regards, > Harald > -- > - Harald Welte > http://laforge.gnumonks.org/ > ============================================================================ > "Privacy in residential applications is a desirable marketing > option." > (ETSI EN 300 175-7 > Ch. A6) > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- A non-text attachment was scrubbed... Name: gen_gs_server.erl Type: text/x-erlang Size: 8251 bytes Desc: not available URL: From zabrane3@REDACTED Fri Dec 16 08:30:03 2011 From: zabrane3@REDACTED (Zabrane Mickael) Date: Fri, 16 Dec 2011 08:30:03 +0100 Subject: [erlang-questions] R15B changes erl_driver API In-Reply-To: References: Message-ID: <6A0EF1C0-1DE6-4115-B478-FB3BA24DE5C5@gmail.com> Hi Andrew, Works now ... may thanks. I've also copied the package author. Regards, Zabrane On Dec 16, 2011, at 7:39 AM, Andrew Tunnell-Jones wrote: > On Fri, Dec 16, 2011 at 5:32 AM, Zabrane Mickael wrote: >> >> After installing R15B (OSX 10.6.8), this module no longer works for me: >> https://github.com/alexeyr/erlang-sqlite3 >> >> I got the following error: >> [...] >> SUPERVISOR REPORT==== 15-Dec-2011::19:27:52 === >> Supervisor: {local,reactiv_sup} >> Context: start_error >> Reason: {{badmatch,{error,"Error loading sqlite3_drv_darwin_64: >> Driver compiled with incorrect version of erl_driver.h"}}, >> >> The driver seems to include the MAJOR/MINOR markers: >> https://github.com/alexeyr/erlang-sqlite3/blob/master/c_src/sqlite3_drv.c >> >> Any Help? >> > > Line 27 should have ERL_DRV_EXTENDED_MINOR_VERSION in place of > ERL_DRV_EXTENDED_MAJOR_VERSION. > > ? Andrew From bgustavsson@REDACTED Fri Dec 16 09:09:31 2011 From: bgustavsson@REDACTED (=?UTF-8?Q?Bj=C3=B6rn_Gustavsson?=) Date: Fri, 16 Dec 2011 09:09:31 +0100 Subject: [erlang-questions] BEAM file forwards/backwards compatibility In-Reply-To: References: Message-ID: On Fri, Dec 16, 2011 at 12:44 AM, Bernie Duggan wrote: > Hi all, > A thread from earlier this year makes it clear that BEAM files are > what I'll call "forwards compatible" for, nominally, 2 major versions. > For example, beams compiles with R9 will run on R10 and R11. All > great. > My question, then, is what about "backwards compatibility"? > Empirically, it appears that even minor release difference (compiled > on R14B04 and attempting to run on R14B03) are enough to cause a file > to be unable to be loaded , producing the error: > > {'cannot load',,get_file} > > Is this actually the expected behaviour, or should I be looking > elsewhere for the cause of this problem? (If it's expected, no big > deal, just as long as I know :)). > It is not the expected behavior. We generally try to avoid introducing incompatibilities in the BEAM format in minor releases. In this case, the error message indicates that there was a problem reading the BEAM file from the disk, not a problem loading the BEAM code. My guess is that something is wrong with the boot script or code paths. -- Bj?rn Gustavsson, Erlang/OTP, Ericsson AB From alexey.v.romanov@REDACTED Fri Dec 16 10:25:22 2011 From: alexey.v.romanov@REDACTED (Alexey Romanov) Date: Fri, 16 Dec 2011 12:25:22 +0300 Subject: [erlang-questions] R15B changes erl_driver API In-Reply-To: <6A0EF1C0-1DE6-4115-B478-FB3BA24DE5C5@gmail.com> References: <6A0EF1C0-1DE6-4115-B478-FB3BA24DE5C5@gmail.com> Message-ID: D'oh! Thanks, fixed now. Yours, Alexey Romanov On Fri, Dec 16, 2011 at 11:30 AM, Zabrane Mickael wrote: > Hi Andrew, > > Works now ... may thanks. > I've also copied the package author. > > Regards, > Zabrane > > On Dec 16, 2011, at 7:39 AM, Andrew Tunnell-Jones wrote: > >> On Fri, Dec 16, 2011 at 5:32 AM, Zabrane Mickael wrote: >>> >>> After installing R15B (OSX 10.6.8), this module no longer works for me: >>> https://github.com/alexeyr/erlang-sqlite3 >>> >>> I got the following error: >>> [...] >>> SUPERVISOR REPORT==== 15-Dec-2011::19:27:52 === >>> ? ? ?Supervisor: {local,reactiv_sup} >>> ? ? ?Context: ? ?start_error >>> ? ? ?Reason: ? ? {{badmatch,{error,"Error loading sqlite3_drv_darwin_64: >>> Driver compiled with incorrect version of erl_driver.h"}}, >>> >>> The driver seems to include the MAJOR/MINOR markers: >>> https://github.com/alexeyr/erlang-sqlite3/blob/master/c_src/sqlite3_drv.c >>> >>> Any Help? >>> >> >> Line 27 should have ERL_DRV_EXTENDED_MINOR_VERSION in place of >> ERL_DRV_EXTENDED_MAJOR_VERSION. >> >> ? Andrew > > From sverker@REDACTED Fri Dec 16 14:46:43 2011 From: sverker@REDACTED (Sverker Eriksson) Date: Fri, 16 Dec 2011 14:46:43 +0100 Subject: [erlang-questions] R15B changes erl_driver API In-Reply-To: References: Message-ID: <4EEB4BC3.9070909@erix.ericsson.se> > You must rebuild it with Erlang R15B to work. > Not just rebuild: http://www.erlang.org/doc/man/erl_driver.html#rewrites_for_64_bits /Sverker, Erlang/OTP From spawn.think@REDACTED Fri Dec 16 16:19:27 2011 From: spawn.think@REDACTED (Ahmed Omar) Date: Fri, 16 Dec 2011 16:19:27 +0100 Subject: [erlang-questions] Summary for 2nd Erlang Hangout In-Reply-To: References: Message-ID: If the link for the recorded hangout doesn't work for you, you can watch it on livestream http://livestre.am/1bbZx On Thu, Dec 15, 2011 at 11:05 PM, Ahmed Omar wrote: > In our 2nd Erlang Hangout, +Max Bourinov presented > a project done by his team. The project is a MMOG (massively multiplayer > online game). The presentation was followed by discussions about some > challanges they had and future work they are planning, and some advices > they needed. > > You can watch it recorded here: (you can skip 1st 7 mins, we were waiting > for everyone to get ready :) ) > > https://plus.google.com/b/108730584872406072872/photos/108730584872406072872/albums/5684284170310829889/5686472356141745090 > > If you are interested, post your ideas for the next hangouts. It could be > about anything erlangish! > > https://plus.google.com/b/108730584872406072872/108730584872406072872/posts/7srJatpzeMr > -- > Best Regards, > - Ahmed Omar > http://nl.linkedin.com/in/adiaa > Follow me on twitter > @spawn_think > > -- Best Regards, - Ahmed Omar http://nl.linkedin.com/in/adiaa Follow me on twitter @spawn_think -------------- next part -------------- An HTML attachment was scrubbed... URL: From yoursurrogategod@REDACTED Fri Dec 16 16:23:16 2011 From: yoursurrogategod@REDACTED (Yves S. Garret) Date: Fri, 16 Dec 2011 10:23:16 -0500 Subject: [erlang-questions] Can't compile R15B succesfully Message-ID: Have an Ubuntu 11.04 distro. This is my config command: ./configure --with-ssl --with-javac --enable-hipe --enable-sctp --enable-kernel-poll --enable-smp-support And this is the error that I get when I compile: http://bin.cakephp.org/view/1393314736 If you need more info, let me know. I always seem to have an issue with wx historically. Any insights? -------------- next part -------------- An HTML attachment was scrubbed... URL: From lukas@REDACTED Fri Dec 16 16:29:56 2011 From: lukas@REDACTED (Lukas Larsson) Date: Fri, 16 Dec 2011 16:29:56 +0100 Subject: [erlang-questions] Can't compile R15B succesfully In-Reply-To: References: Message-ID: Could be because you are compiling with wx-2.9 and not wx-2.8 which afair is the latest stable wx release. Lukas On Fri, Dec 16, 2011 at 4:23 PM, Yves S. Garret wrote: > Have an Ubuntu 11.04 distro. > > This is my config command: > ./configure --with-ssl --with-javac --enable-hipe --enable-sctp > --enable-kernel-poll --enable-smp-support > > And this is the error that I get when I compile: > http://bin.cakephp.org/view/1393314736 > > If you need more info, let me know.? I always seem to have an issue with wx > historically.? Any insights? > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > From michal.niec@REDACTED Fri Dec 16 16:31:14 2011 From: michal.niec@REDACTED (Michal Niec) Date: Fri, 16 Dec 2011 16:31:14 +0100 Subject: [erlang-questions] R15B binary packages for CentOS, Debian, Fedora, Mac, Ubuntu and Windows Message-ID: Hi, You can find our Erlang R15B packages for CentOS 6, Mac OS X Snow Leopard and Lion, Debian 6, Ubuntu 11.04, Fedora 15 and Windows 7 at http://www.erlang-solutions.com/section/132/download-erlang-otp (and we are extending the list). Best Regards, Michal Niec -------------- next part -------------- An HTML attachment was scrubbed... URL: From comptekki@REDACTED Fri Dec 16 16:55:44 2011 From: comptekki@REDACTED (Wes James) Date: Fri, 16 Dec 2011 08:55:44 -0700 Subject: [erlang-questions] R15B binary packages for CentOS, Debian, Fedora, Mac, Ubuntu and Windows In-Reply-To: References: Message-ID: On os x lion, were you able to get wx compiled in to it? Thanks, -wes On Fri, Dec 16, 2011 at 8:31 AM, Michal Niec wrote: > Hi, > > You can find our Erlang R15B packages for CentOS 6, Mac OS X Snow Leopard > and Lion, Debian 6, Ubuntu 11.04, Fedora 15 and Windows 7 > at?http://www.erlang-solutions.com/section/132/download-erlang-otp?(and we > are extending the list). > > Best Regards, > Michal Niec > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > From yoursurrogategod@REDACTED Fri Dec 16 17:20:08 2011 From: yoursurrogategod@REDACTED (Yves S. Garret) Date: Fri, 16 Dec 2011 11:20:08 -0500 Subject: [erlang-questions] Can't compile R15B succesfully In-Reply-To: References: Message-ID: Thanks. Going back to 2.8 worked. It compiled fine, make install worked and when I fired up erlang with erl, no errors. On Fri, Dec 16, 2011 at 10:33 AM, Yves S. Garret wrote: > You're right, I did use 2.9. I'll try 2.8. Should I uninstall 2.9 > somehow? > > This is my configure that I used: > ./configure --with-libpng --with-opengl --enable-mousewheel --enable-stl > > > On Fri, Dec 16, 2011 at 10:29 AM, Lukas Larsson < > lukas@REDACTED> wrote: > >> Could be because you are compiling with wx-2.9 and not wx-2.8 which >> afair is the latest stable wx release. >> >> Lukas >> >> On Fri, Dec 16, 2011 at 4:23 PM, Yves S. Garret >> wrote: >> > Have an Ubuntu 11.04 distro. >> > >> > This is my config command: >> > ./configure --with-ssl --with-javac --enable-hipe --enable-sctp >> > --enable-kernel-poll --enable-smp-support >> > >> > And this is the error that I get when I compile: >> > http://bin.cakephp.org/view/1393314736 >> > >> > If you need more info, let me know. I always seem to have an issue >> with wx >> > historically. Any insights? >> > >> > _______________________________________________ >> > erlang-questions mailing list >> > erlang-questions@REDACTED >> > http://erlang.org/mailman/listinfo/erlang-questions >> > >> > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From aidanhs@REDACTED Fri Dec 16 19:25:29 2011 From: aidanhs@REDACTED (Aidan Hobson Sayers) Date: Fri, 16 Dec 2011 18:25:29 +0000 Subject: [erlang-questions] Erlang wallpaper In-Reply-To: References: Message-ID: If you prefer a blurry logo to a pixelated one, it vectorised and scaled up acceptably after a quick attempt - http://dl.dropbox.com/u/4496620/erlang_logo_large.png (2048x1741) Aidan On 16/12/2011 03:43, Wes James wrote: > Maybe you could work with the one on this page: > > http://commons.wikimedia.org/w/index.php?title=Special%3ASearch&search=erlang > > -wes > > On Thu, Dec 15, 2011 at 4:56 PM, Yves S. Garret > wrote: >> Hey all. >> >> I was thinking today. Django and CakePHP have their own wallpapers, why >> shouldn't Erlang? Is there a 1600 x 1200 PNG somewhere that I can use on my >> computer, that, preferably has a nice big E in the middle? >> >> _______________________________________________ >> 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 romanshestakov@REDACTED Fri Dec 16 19:29:14 2011 From: romanshestakov@REDACTED (Roman Shestakov) Date: Fri, 16 Dec 2011 18:29:14 +0000 (GMT) Subject: [erlang-questions] is it possible to make rebar generate cover analysis both for eunit and ct tests? Message-ID: <1324060154.56580.YahooMailNeo@web25408.mail.ukl.yahoo.com> hello, for one of my projects I use both eunit and ct tests. But looks like option{cover_enabled, true} in rebar.config works only for eunit tests. Is this expected? I run my tests with makefile with these two commands. ??? $(REBAR) skip_deps=true eunit ??? $(REBAR) ct ?Ideally I would like to? see cover analysis for both ct and eunit tests on the same report, is this possible? Regards, Roman -------------- next part -------------- An HTML attachment was scrubbed... URL: From magnus.klaar@REDACTED Fri Dec 16 19:33:55 2011 From: magnus.klaar@REDACTED (Magnus Klaar) Date: Fri, 16 Dec 2011 19:33:55 +0100 Subject: [erlang-questions] is it possible to make rebar generate cover analysis both for eunit and ct tests? In-Reply-To: <1324060154.56580.YahooMailNeo@web25408.mail.ukl.yahoo.com> References: <1324060154.56580.YahooMailNeo@web25408.mail.ukl.yahoo.com> Message-ID: Hi! In order to enable the coverage log for the rebar ct command you must add the following config file the root of your application directory. Replace cowboy with the application(s) you want to generate coverage logs for. https://github.com/extend/cowboy/blob/master/cover.spec MVH Magnus On Fri, Dec 16, 2011 at 7:29 PM, Roman Shestakov wrote: > hello, > > for one of my projects I use both eunit and ct tests. But looks like > option{cover_enabled, true} in rebar.config works only for eunit tests. Is > this expected? > > I run my tests with makefile with these two commands. > > $(REBAR) skip_deps=true eunit > $(REBAR) ct > > Ideally I would like to see cover analysis for both ct and eunit tests > on the same report, is this possible? > > Regards, Roman > > _______________________________________________ > 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 Fri Dec 16 19:45:51 2011 From: a.shneyderman@REDACTED (Alex Shneyderman) Date: Fri, 16 Dec 2011 19:45:51 +0100 Subject: [erlang-questions] Summary for 2nd Erlang Hangout In-Reply-To: References: Message-ID: Hi, Ahmed! I have a question about the information that you guys exchanged (links to articles/sites/blogs/etc) during the conversation. Do you have it transcripted somewhere? Quality of some of the portions of the sound is not ideal, so it is a bit hard to figure out what exactly to google. In particular I was interested about the article by Ulf Wiger. But in general it would be great if you have these things posted along side the video of the hangout. Cheers & thanks, Alex. On Fri, Dec 16, 2011 at 4:19 PM, Ahmed Omar wrote: > If the link for the recorded hangout doesn't work for you, you can watch it > on livestream > http://livestre.am/1bbZx > > > On Thu, Dec 15, 2011 at 11:05 PM, Ahmed Omar wrote: >> >> In our 2nd Erlang Hangout,?+Max Bourinov?presented a project done by his >> team. The project is a MMOG (massively multiplayer online game). The >> presentation was followed by discussions about some challanges they had and >> future work they are planning, and some advices they needed. >> >> You can watch it recorded here: (you can skip 1st 7 mins, we were waiting >> for everyone to get ready :) ) >> >> https://plus.google.com/b/108730584872406072872/photos/108730584872406072872/albums/5684284170310829889/5686472356141745090 >> >> If you are interested, post your ideas for the next hangouts. It could be >> about anything erlangish! >> >> https://plus.google.com/b/108730584872406072872/108730584872406072872/posts/7srJatpzeMr >> -- >> Best Regards, >> - Ahmed Omar >> http://nl.linkedin.com/in/adiaa >> Follow me on twitter >> @spawn_think >> > > > > -- > Best Regards, > - Ahmed Omar > http://nl.linkedin.com/in/adiaa > Follow me on twitter > @spawn_think > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > From emeka_1978@REDACTED Fri Dec 16 21:18:52 2011 From: emeka_1978@REDACTED (eigenfunction) Date: Fri, 16 Dec 2011 12:18:52 -0800 (PST) Subject: [erlang-questions] Summary for 2nd Erlang Hangout In-Reply-To: References: Message-ID: <1467946d-5cc7-4b3d-bfd7-ec4a05c5f8e3@s26g2000yqd.googlegroups.com> Once again, awesome video. I like the format, specially the discussions. I was having a hard time reading the code snippet being discussed on though. Once again, thank you. On Dec 16, 4:19?pm, Ahmed Omar wrote: > If the link for the recorded hangout doesn't work for you, you can watch it > on livestreamhttp://livestre.am/1bbZx > > > > > > > > > > On Thu, Dec 15, 2011 at 11:05 PM, Ahmed Omar wrote: > > In our 2nd Erlang Hangout, +Max Bourinov presented > > a project done by his team. The project is a MMOG (massively multiplayer > > online game). The presentation was followed by discussions about some > > challanges they had and future work they are planning, and some advices > > they needed. > > > You can watch it recorded here: (you can skip 1st 7 mins, we were waiting > > for everyone to get ready :) ) > > >https://plus.google.com/b/108730584872406072872/photos/10873058487240... > > > If you are interested, post your ideas for the next hangouts. It could be > > about anything erlangish! > > >https://plus.google.com/b/108730584872406072872/108730584872406072872... > > -- > > Best Regards, > > - Ahmed Omar > >http://nl.linkedin.com/in/adiaa > > Follow me on twitter > > @spawn_think > > -- > Best Regards, > - Ahmed Omarhttp://nl.linkedin.com/in/adiaa > Follow me on twitter > @spawn_think > > _______________________________________________ > erlang-questions mailing list > erlang-questi...@REDACTED://erlang.org/mailman/listinfo/erlang-questions From gumm@REDACTED Fri Dec 16 21:18:38 2011 From: gumm@REDACTED (Jesse Gumm) Date: Fri, 16 Dec 2011 14:18:38 -0600 Subject: [erlang-questions] parsing dates In-Reply-To: <20111215174159.GJ13603@hijacked.us> References: <1323960810.2364.5.camel@localhost.localdomain> <20111215174159.GJ13603@hijacked.us> Message-ID: Sure you can, the existence of ec_date doesn't negate the existence of dh_date. If you want all the spiffy changes in ec_date without pulling all of the ec libraries, you can always do a patch and submit a pull request to Dale and see what happens there. -Jesse > So I can't list it as a rebar dep anymore without pulling down a whole > bunch of extraneous code, or maintaining my own fork of dh_date? -- Jesse Gumm Sigma Star Systems 414.940.4866 gumm@REDACTED http://www.sigma-star.com From comptekki@REDACTED Fri Dec 16 21:48:27 2011 From: comptekki@REDACTED (Wes James) Date: Fri, 16 Dec 2011 13:48:27 -0700 Subject: [erlang-questions] R15B binary packages for CentOS, Debian, Fedora, Mac, Ubuntu and Windows In-Reply-To: References: Message-ID: Ok - thx. -wes On Fri, Dec 16, 2011 at 11:35 AM, Michal Niec wrote: > No. wx module is still not supported on 64bit Mac OS X. > > Best Regards, > Michal Niec > > On 16 Dec 2011, at 16:55, Wes James wrote: > >> On os x lion, were you able to get wx compiled in to it? >> >> Thanks, >> >> -wes >> >> On Fri, Dec 16, 2011 at 8:31 AM, Michal Niec >> wrote: >>> Hi, >>> >>> You can find our Erlang R15B packages for CentOS 6, Mac OS X Snow Leopard >>> and Lion, Debian 6, Ubuntu 11.04, Fedora 15 and Windows 7 >>> at http://www.erlang-solutions.com/section/132/download-erlang-otp (and we >>> are extending the list). >>> >>> Best Regards, >>> Michal Niec >>> >>> _______________________________________________ >>> erlang-questions mailing list >>> erlang-questions@REDACTED >>> http://erlang.org/mailman/listinfo/erlang-questions >>> > From spawn.think@REDACTED Fri Dec 16 22:44:48 2011 From: spawn.think@REDACTED (Ahmed Omar) Date: Fri, 16 Dec 2011 22:44:48 +0100 Subject: [erlang-questions] Summary for 2nd Erlang Hangout In-Reply-To: References: Message-ID: Hi Alex, I have updated the post on google+ with relevant links (including the paper about JOBS by Ulf Wiger) https://plus.google.com/b/108730584872406072872/108730584872406072872/posts/VhDfzoJvKcs Hope this covers your needs :) On Fri, Dec 16, 2011 at 7:45 PM, Alex Shneyderman wrote: > Hi, Ahmed! > > I have a question about the information that you guys exchanged (links > to articles/sites/blogs/etc) during the conversation. Do you have it > transcripted somewhere? Quality of some of the portions of the sound > is not ideal, so it is a bit hard to figure out what exactly to > google. In particular I was interested about the article by Ulf Wiger. > But in general it would be great if you have these things posted along > side the video of the hangout. > > Cheers & thanks, > Alex. > > On Fri, Dec 16, 2011 at 4:19 PM, Ahmed Omar wrote: > > If the link for the recorded hangout doesn't work for you, you can watch > it > > on livestream > > http://livestre.am/1bbZx > > > > > > On Thu, Dec 15, 2011 at 11:05 PM, Ahmed Omar > wrote: > >> > >> In our 2nd Erlang Hangout, +Max Bourinov presented a project done by his > >> team. The project is a MMOG (massively multiplayer online game). The > >> presentation was followed by discussions about some challanges they had > and > >> future work they are planning, and some advices they needed. > >> > >> You can watch it recorded here: (you can skip 1st 7 mins, we were > waiting > >> for everyone to get ready :) ) > >> > >> > https://plus.google.com/b/108730584872406072872/photos/108730584872406072872/albums/5684284170310829889/5686472356141745090 > >> > >> If you are interested, post your ideas for the next hangouts. It could > be > >> about anything erlangish! > >> > >> > https://plus.google.com/b/108730584872406072872/108730584872406072872/posts/7srJatpzeMr > >> -- > >> Best Regards, > >> - Ahmed Omar > >> http://nl.linkedin.com/in/adiaa > >> Follow me on twitter > >> @spawn_think > >> > > > > > > > > -- > > Best Regards, > > - Ahmed Omar > > http://nl.linkedin.com/in/adiaa > > Follow me on twitter > > @spawn_think > > > > > > _______________________________________________ > > erlang-questions mailing list > > erlang-questions@REDACTED > > http://erlang.org/mailman/listinfo/erlang-questions > > > -- Best Regards, - Ahmed Omar http://nl.linkedin.com/in/adiaa Follow me on twitter @spawn_think -------------- next part -------------- An HTML attachment was scrubbed... URL: From spawn.think@REDACTED Fri Dec 16 22:47:32 2011 From: spawn.think@REDACTED (Ahmed Omar) Date: Fri, 16 Dec 2011 22:47:32 +0100 Subject: [erlang-questions] Summary for 2nd Erlang Hangout In-Reply-To: <1467946d-5cc7-4b3d-bfd7-ec4a05c5f8e3@s26g2000yqd.googlegroups.com> References: <1467946d-5cc7-4b3d-bfd7-ec4a05c5f8e3@s26g2000yqd.googlegroups.com> Message-ID: Thanks! We will try next time to save some type of transcript of written chats ;) For now, check the post on google+ again, it contains most of the references exchanged in the talk and some more that are related to discussion. On Fri, Dec 16, 2011 at 9:18 PM, eigenfunction wrote: > Once again, awesome video. I like the format, specially the > discussions. I was having a hard time reading the code snippet being > discussed on though. > Once again, thank you. > > On Dec 16, 4:19 pm, Ahmed Omar wrote: > > If the link for the recorded hangout doesn't work for you, you can watch > it > > on livestreamhttp://livestre.am/1bbZx > > > > > > > > > > > > > > > > > > > > On Thu, Dec 15, 2011 at 11:05 PM, Ahmed Omar > wrote: > > > In our 2nd Erlang Hangout, +Max Bourinov< > https://plus.google.com/116947110740326793297> presented > > > a project done by his team. The project is a MMOG (massively > multiplayer > > > online game). The presentation was followed by discussions about some > > > challanges they had and future work they are planning, and some advices > > > they needed. > > > > > You can watch it recorded here: (you can skip 1st 7 mins, we were > waiting > > > for everyone to get ready :) ) > > > > >https://plus.google.com/b/108730584872406072872/photos/10873058487240. > .. > > > > > If you are interested, post your ideas for the next hangouts. It could > be > > > about anything erlangish! > > > > >https://plus.google.com/b/108730584872406072872/108730584872406072872. > .. > > > -- > > > Best Regards, > > > - Ahmed Omar > > >http://nl.linkedin.com/in/adiaa > > > Follow me on twitter > > > @spawn_think > > > > -- > > Best Regards, > > - Ahmed Omarhttp://nl.linkedin.com/in/adiaa > > Follow me on twitter > > @spawn_think > > > > _______________________________________________ > > erlang-questions mailing list > > erlang-questi...@REDACTED:// > erlang.org/mailman/listinfo/erlang-questions > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > -- Best Regards, - Ahmed Omar http://nl.linkedin.com/in/adiaa Follow me on twitter @spawn_think -------------- next part -------------- An HTML attachment was scrubbed... URL: From mononcqc@REDACTED Fri Dec 16 23:33:27 2011 From: mononcqc@REDACTED (Fred Hebert) Date: Fri, 16 Dec 2011 17:33:27 -0500 Subject: [erlang-questions] Summary for 2nd Erlang Hangout In-Reply-To: References: Message-ID: I can't exactly remember what link I gave for the paper from Ulf, but it was the same document as this one: https://github.com/esl/jobs/blob/master/doc/erlang07g-wiger.pdf?raw=true . Enjoy. On Fri, Dec 16, 2011 at 1:45 PM, Alex Shneyderman wrote: > Hi, Ahmed! > > I have a question about the information that you guys exchanged (links > to articles/sites/blogs/etc) during the conversation. Do you have it > transcripted somewhere? Quality of some of the portions of the sound > is not ideal, so it is a bit hard to figure out what exactly to > google. In particular I was interested about the article by Ulf Wiger. > But in general it would be great if you have these things posted along > side the video of the hangout. > > Cheers & thanks, > Alex. > > On Fri, Dec 16, 2011 at 4:19 PM, Ahmed Omar wrote: > > If the link for the recorded hangout doesn't work for you, you can watch > it > > on livestream > > http://livestre.am/1bbZx > > > > > > On Thu, Dec 15, 2011 at 11:05 PM, Ahmed Omar > wrote: > >> > >> In our 2nd Erlang Hangout, +Max Bourinov presented a project done by his > >> team. The project is a MMOG (massively multiplayer online game). The > >> presentation was followed by discussions about some challanges they had > and > >> future work they are planning, and some advices they needed. > >> > >> You can watch it recorded here: (you can skip 1st 7 mins, we were > waiting > >> for everyone to get ready :) ) > >> > >> > https://plus.google.com/b/108730584872406072872/photos/108730584872406072872/albums/5684284170310829889/5686472356141745090 > >> > >> If you are interested, post your ideas for the next hangouts. It could > be > >> about anything erlangish! > >> > >> > https://plus.google.com/b/108730584872406072872/108730584872406072872/posts/7srJatpzeMr > >> -- > >> Best Regards, > >> - Ahmed Omar > >> http://nl.linkedin.com/in/adiaa > >> Follow me on twitter > >> @spawn_think > >> > > > > > > > > -- > > Best Regards, > > - Ahmed Omar > > http://nl.linkedin.com/in/adiaa > > Follow me on twitter > > @spawn_think > > > > > > _______________________________________________ > > 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 igarai@REDACTED Fri Dec 16 23:40:00 2011 From: igarai@REDACTED (=?UTF-8?B?ScOxYWtpIEdhcmF5?=) Date: Fri, 16 Dec 2011 19:40:00 -0300 Subject: [erlang-questions] Implementing a loop that quits on an external event. Message-ID: Hello everyone, Short story: how could I implement a loop that can quit on an external event using the OTP behaviours? One option I can think of is a gen_fsm that has a transition to the current state, and sends itself a message at the end of the transition. Another is having two processes, one watching for the external event or message, and when it occurs sets some sort of shared variable, e.g. in an ETS table, while another executes the loop and checks whether the shared variable was set to 'quit'. Any other options? Problems with these? Existing examples of this situation? how is this usually done? Long story: You have a dream^W game, a small multi-agent simulator. You have an environment, which is the state of the world. Agents are gen_servers, you give them a percept and ask for an action. Actions modify the world. During one iteration of the simulation loop, it tells each agent what it perceives and asks what action it will perform, and then applies the action's effects on the environment state. The environment simulator is a gen_fsm. It has (among others), two states: paused, and running. When paused, if it receives a 'run' message, it transitions to the running state. If it receives a 'quit' message, it stops. When running, if it receives a 'pause' message, it switches to the paused state. Also when running, it "runs the simulation". Now, the 'running' state shouldn't have to wait each iteration for input to continue on to the next simulation iteration. I can think of two ways to do this: 1. An 'epsilon transition', that is, a transition that fires without input to the FSM. The simulator gen_fsm could send_event 'run' to itself, at the end of each iteration. Every time it receives a 'run' message, one iteration of the simulation cycle is executed. 2. Outsource the main loop to another process. The gen_fsm in the running state now waits for the 'pause' message, and when received, signals the other process running the tight loop. The 'signal' could be a message: the looping process has a receive with a timeout of 0, every time it checks if there is no message it continues the cycle. Or it could be some shared state, e.g. something in an ETS table, In the first case, I can imagine the gen_fsm executing an iteration, and simulatenously the pause event is received. At the end, it sends itself the 'run' message, and transitions to the 'paused' state. A spurious message is left in the queue, possibly messing things up later on. Also, waiting for a message, even one you "just sent", may possibly take longer than expected than just comparing a value, or even executing a receive statement with a timeout of 0. In the second case, shared state, and a more complicated design. Am I overthinking? many thanks in advanced, I?aki Garay. From dale@REDACTED Sat Dec 17 00:24:51 2011 From: dale@REDACTED (Dale Harvey) Date: Fri, 16 Dec 2011 23:24:51 +0000 Subject: [erlang-questions] parsing dates In-Reply-To: References: <1323960810.2364.5.camel@localhost.localdomain> <20111215174159.GJ13603@hijacked.us> Message-ID: Sorry missed this Yeh I sent a message to Eric to see if those patched to ec_date could go back upstream for people who arent using the full commons library, if anyone else wants to do that Ill be happy to merge, I may try if I get some time. I just wanted to mention I dont think this belongs in otp, I do however thing it should be a $ magic-erlang-package-manager-distributed-with-erlang install dh_date away though :) Cheers Dale On 16 December 2011 20:18, Jesse Gumm wrote: > Sure you can, the existence of ec_date doesn't negate the existence of > dh_date. If you want all the spiffy changes in ec_date without > pulling all of the ec libraries, you can always do a patch and submit > a pull request to Dale and see what happens there. > > -Jesse > > > So I can't list it as a rebar dep anymore without pulling down a whole > > bunch of extraneous code, or maintaining my own fork of dh_date? > > > -- > Jesse Gumm > Sigma Star Systems > 414.940.4866 > gumm@REDACTED > http://www.sigma-star.com > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From wiener.guy@REDACTED Sat Dec 17 20:42:44 2011 From: wiener.guy@REDACTED (Guy Wiener) Date: Sat, 17 Dec 2011 21:42:44 +0200 Subject: [erlang-questions] Share a room at POPL / PADL? Message-ID: Hello everyone, A somewhat off-topic question: Is anyone coming to the POPL and/or PADL conferences next month? I'm looking to share a room on the conference hotel, since I'm the only representative from my lab. Thanks, Guy Wiener, Dept. of Computer Science and Applied Math, Weizmann Institute for Science -------------- next part -------------- An HTML attachment was scrubbed... URL: From wiener.guy@REDACTED Sat Dec 17 21:13:05 2011 From: wiener.guy@REDACTED (Guy Wiener) Date: Sat, 17 Dec 2011 22:13:05 +0200 Subject: [erlang-questions] OPL on Erlang (Was earlier "RE:Best practices in gen_fsm usage") In-Reply-To: <4EE28EDF.9040503@gmail.com> References: <33151719-9161-4a9e-aafc-61471a629cac@knuth> <01F34AC4-97BF-43C8-9D12-CA47B791DF94@feuerlabs.com> <4EDFE812.4000604@gmail.com> <001e01ccb62c$c88e3180$59aa9480$@com> <4EE28EDF.9040503@gmail.com> Message-ID: Hello Torben, Avinash, Sorry to join into the discussion late, but enthusiastically, nevertheless. I actually worked on OPM-to-Erlang transformation some time ago. Unfortunately, it wasn't published, but I included some of the examples in my PhD dissertation. I still got some of the supporting material: - A Prolog implementation of OPL, that allows writing OPL paragraphs and querying/transforming them directly as Prolog programs. It's very useful for this kind of works. Also generates OPD as Graphvis Dot files. - An Erlang to Prolog, and vice versa, translator, using the Erlang abstract form. Can be used with the above framework. - I should have my notes on transforming OPL to Erlang somewhere - If you're interested, I'll attach it in a direct e-mail. In any case, I'll be really interesting in contributing to the discussion! Best, Guy Wiener. On Sat, Dec 10, 2011 at 12:42 AM, Torben Hoffmann wrote: > Hi Avinash! > > > On 9/12/11 5:41 , Avinash Dhumane wrote: > > >>>>** ** > > *From:* erlang-questions-bounces@REDACTED [ > mailto:erlang-questions-bounces@REDACTED] > *On Behalf Of *Torben Hoffmann > > **** > > I think that Object Process Methodology (used lightly) and Message > Sequence Charts are better ways of structuring your high level thoughts.** > ** > > >>>>** ** > > ** ** > > Hi Torben,**** > > ** ** > > Found a reflection of my voice in you! > > I had a hope that there was life out there... ;-) > > **** > > ** ** > > I am contemplating to compile a specification of what a system is and does > as stated using OPM/OPL, into (and run on) an Erlang AOS (Application > Operating System, as Joe puts it!). **** > > ** ** > > There is some ?impedance? mismatch between the ?symbols? (ideas) of OPL > and Erlang, though in spirit, I (want to) believe that Erlang AOS is a > perfect (i.e. isomorphic) vehicle for materializing a ?OPL system?. > > I concur - I think OPM/OPL's way of describing systems fits very with the > way Joe refers to Erlang... the most object oriented language out there!! > > The major hurdle to get past when using OPM as an Erlanger is that > processes in OPM does not map to the Erlang processes as you also state it. > > To give some examples:**** > > 1) A ?process? of OPM is not an ?Erlang process? ? well, yes & no! **** > > 2) Moreover, an ?OPM object? needs to find an expression in ?Erlang > process? ? again, yes & no! **** > > 3) OPM maintains the duality of ?objects and processes?, whereas Erlang > wants to see every_thing_ as a ?process?. **** > > 4) For OPM, ?objects? are the things that are shaped and take shape, and > ?processes? are the things that shape the objects ? i.e. ?shape? is both a > verb and noun. In Erlang, what gets shaped is also a process, and what > shapes is obviously a process.**** > > 5) I am not confident enough to say something on ?state? in OPM and > ?state? in Erlang.**** > > I am not 100% in agreement with the way you map things here. > > Let's start with "OPM object" which I think is best represented as an > Erlang process - I seem to recall that Joe also uses this "mapping" when > refering to Erlang as an object-oriented language. > > "OPM processes" are functions in Erlang - when there are no side-effects > for an argument to a function then the "OPM process" consumes the object. > With side-effects in play the "OPM process" merely affects the "OPM object". > > It might be that there is a lot of talk about that everything in Erlang is > processes, but the functions are there too and they play a significant r?le > regardless of how you view the language. > > State - in my interpretation - maps almost directly how state of an Erlang > process is handled. > > ** ** > > My present view of world is as shown (& determined) by classic C with > Unix-IPC. I don?t know other worlds. I haven?t made much of progress in > Erlang AOS either, beyond few readings of Joe?s thesis paper. > > Code a few programs and you will begin to see the world with different > eyes... I promise!! > > > **** > > ** ** > > I am currently stuck on integrating the spirit of OPM/OPL and spirit of > Erlang AOS. **** > > ** ** > > Is there some work going around in OPM and Erlang that can help me unlock > spiritually? > > Not that I am aware of - you could talk to Dov about it. I discussed a few > things with him some years ago, but I did not have enough time on my hands > to explore the topic further. > > Or, may I receive some help from you on how you materialize a > OPM-thought system into an Erlang system? Some directions are good enough ? > I know otherwise this is a topic of a full volume. > > If you have a simple OPM example then you can send it to me on- or > off-line and then I will outline how I would map it to Erlang following the > general observations I made above. That exercise will be interesting. > > At the moment I am using a small subset of OPM to document the > interactions between the entities of the systems I am developing. Just > objects and processes since that is enough to convey the major points of > the architecture - if I had to use UML or similar I would have to do at > least two diagrams in order to get both some static and dynamic structure > conveyed. > > But please fire away and then I will help you get some more Erlang > semantics under your skin - I must guide aspiring Erlangers in order to > keep my ordination as Erlang Priest ;-) > > Cheers, > Torben > > **** > > ** ** > > Thank you**** > > ** ** > > Kind regards**** > > ** ** > > Avinash**** > > > _______________________________________________ > erlang-questions mailing listerlang-questions@REDACTED://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 igarai@REDACTED Sun Dec 18 06:12:57 2011 From: igarai@REDACTED (=?UTF-8?B?ScOxYWtpIEdhcmF5?=) Date: Sun, 18 Dec 2011 02:12:57 -0300 Subject: [erlang-questions] Implementing a loop that quits on an external event. In-Reply-To: References: Message-ID: On Fri, Dec 16, 2011 at 19:40, I?aki Garay wrote: > Hello everyone, > > Short story: > how could I implement a loop that can quit on an external event using > the OTP behaviours? > One option I can think of is a gen_fsm that has a transition to the > current state, and sends itself a message at the end of the > transition. > Another is having two processes, one watching for the external event > or message, and when it occurs sets some sort of shared variable, e.g. > in an ETS table, while another executes the loop and checks whether > the shared variable was set to 'quit'. > Any other options? > Problems with these? > Existing examples of this situation? > how is this usually done? > > Long story: > You have a dream^W game, a small multi-agent simulator. > You have an environment, which is the state of the world. > Agents are gen_servers, you give them a percept and ask for an action. > Actions modify the world. > During ?one iteration of the simulation loop, it tells each agent what > it perceives and asks what action it will perform, and then applies > the action's effects on the environment state. > > The environment simulator is a gen_fsm. > It has (among others), two states: paused, and running. > > When paused, if it receives a 'run' message, it transitions to the > running state. > If it receives a 'quit' message, it stops. > > When running, if it receives a 'pause' message, it switches to the paused state. > Also when running, it "runs the simulation". > > Now, the 'running' state shouldn't have to wait each iteration for > input to continue on to the next simulation iteration. > I can think of two ways to do this: > > 1. An 'epsilon transition', that is, a transition that fires without > input to the FSM. > The simulator gen_fsm could send_event 'runtime' to itself, at the end of > each iteration. > Every time it receives a 'run' message, one ittimeeration of the > simulation cycle is executed. > > 2. Outsource the main loop to another process. > The gen_fsm in the running state now waits for the 'pause' message, > and when received, signals the other process running the tight loop. > The 'signal' could be a message: the looping process has a receive > with a timeout of 0, every time it checks if there is no message it > continues the cycle. > Or it could be some shared state, e.g. something in an ETS table, > > In the first case, I can imagine the gen_fsm executing an iteration, > and simulatenously the pause event is received. > At the end, it sends itself the 'run' message, and transitions to the > 'paused' state. > A spurious message is left in the queue, possibly messing things up later on. > Also, waiting for a message, even one you "just sent", may possibly > take longer than expected than just comparing a value, or even > executing a receive statement with a timeout of 0. > > In the second case, shared state, and a more complicated design. > > Am I overthinking? Yes I was. > > many thanks in advanced, > I?aki Garay. I found a nice (and I suppose) correct way, and will reply to my own email for posterity. I'm terribly vexed when I find those forums posts or emails marked as [SOLVED] and the answer is not explained. :) The solution, as usual, is to RTFM. The documentation for gen_fsm module states in the callback functions section that the function Module:StateName(Event, StateData) should return Result, where Result = {next_state,NextStateName,NewStateData} | {next_state,NextStateName,NewStateData,Timeout} | {next_state,NextStateName,NewStateData,hibernate} | {stop,Reason,NewStateData} If a Timeout is specified in the result, the FSM will transition to NextStateName, and after Timeout the FSM will call the function with the same name as the NextStateName. So to implement a loop in the FSM, i.e. a self-transition to the current state after no time, one can do: current_state(timeout, State) -> {next_state, current_state, State, 0}; To break out of the loop, simple use another transition: current_state(break, State) -> {next_state, another_state, State}. Simple and elegant :) I can't see how the problems I thought of earlier apply to this. One gotcha is that one must remember to add the timeout to any other transition that moves to the looping state. Following is a small example which can be run in the shell, hopefully helpful to other beginners. %% fsm.erl :begin code example % The fsm state will be a single number indicating how many transitions have been executed, starting at 0. % Two states, running and paused. -module(fsm). -compile([export_all]). start() -> gen_fsm:start({local,?MODULE}, ?MODULE, 0, []). % type less in the shell. run() -> gen_fsm:send_event(?MODULE, run). pause() -> gen_fsm:send_event(?MODULE, pause). quit() -> gen_fsm:send_event(?MODULE, quit). % The FSM starts in the paused state. init(0) -> {ok, paused, 0}. terminate(normal, _StateName, _StateData) -> ok. % Each transition will print the current state, the input received, and the state. % The timeout is set to 1000 to give us time to type in the shell without the FSM transitioning hundreds of thousands of times. paused(quit, State) -> io:format("paused : quit : ~p~n", [State]), {stop, normal, State}; % We must remember to add the timeout to any other transition that moves to the looping state. paused(run, State) -> io:format("paused : run : ~p~n", [State]), {next_state, running, State + 1, 1000}. running(pause, State) -> io:format("running : pause : ~p~n", [State]), {next_state, paused, State + 1}; running(timeout, State) -> io:format("running : timeout : ~p~n", [State]), {next_state, running, State + 1, 1000}. %% end code example %% begin shell example Erlang R14B04 (erts-5.8.5) [source] [smp:2:2] [rq:2] [async-threads:0] [hipe] [kernel-poll:false] Eshell V5.8.5 (abort with ^G) 1> fsm:start(). {ok,<0.34.0>} 2> fsm:run(). paused : run : 0 ok running : timeout : 1 running : timeout : 2 running : timeout : 3 running : timeout : 4 3> fsm:pause(). running : pause : 5 ok 4> fsm:run(). paused : run : 6 ok running : timeout : 7 running : timeout : 8 running : timeout : 9 5> fsm:pause(). running : pause : 10 ok 6> fsm:quit(). paused : quit : 11 ok %% end shell example criticism & guidance welcome, I?aki Garay. From steve@REDACTED Sun Dec 18 12:18:45 2011 From: steve@REDACTED (Steve Strong) Date: Sun, 18 Dec 2011 12:18:45 +0100 Subject: [erlang-questions] Rebar - adding deps with nested apps Message-ID: Hi, I've had a google and a look through the archives but can't find a good answer to my problem. I've got a project that contains multiple apps, structured like this: proj1 apps app1 app2 this is built and release using rebar, and it all works great. I've then got another project which wants to reference proj1 as a dependency, using: {deps, [{'proj1', ".*", {git, git_url, "HEAD"}} this successfully pulls proj1 from git into the deps directory, but it then fails since rebar tries to look for a proj1.app file. Can rebar pull down a dependency like this, and if so what should the config look like? If not, I'll delve into the source and try to add support - are there any opinions as to how this should be structured? The easiest way looks to be to add additional logic into the failure path of rebar_deps:is_app_available to recurse into the directory tree seeking out .app files and returning a list of them. I've not yet looked beyond is_app_available and it's immediate callers - are there any other areas that would be impacted by such a change? Or is it just a really bad idea? Cheers, Steve -- Steve Strong @srstrong Sent with Sparrow (http://www.sparrowmailapp.com/?sig) -------------- next part -------------- An HTML attachment was scrubbed... URL: From freeakk@REDACTED Sun Dec 18 12:34:52 2011 From: freeakk@REDACTED (Michael Uvarov) Date: Sun, 18 Dec 2011 14:34:52 +0300 Subject: [erlang-questions] erl_nif environment in the load() function Message-ID: Hello, There is code as example: https://github.com/beerriot/icu4e/blob/master/c_src/ustring.c I have few questions: 1. How long is env's lifetime in the load(...)? Will the env be erased after the call or after module unloading? 2. Is this code valid? ERL_NIF_TERM ustring_endian(ErlNifEnv* env, int argc, const ERL_NIF_TERM argv[]) { return ATOM_ENDIAN; } Is the next construction better? return enif_make_copy(env, ATOM_ENDIAN); -------------- next part -------------- An HTML attachment was scrubbed... URL: From freeakk@REDACTED Sun Dec 18 12:46:16 2011 From: freeakk@REDACTED (Michael Uvarov) Date: Sun, 18 Dec 2011 14:46:16 +0300 Subject: [erlang-questions] Real life applications as code examples Message-ID: Hello, Are there open-source applications which use: - NIFs; - versions of modules; - hot code swapping; - common tests / PropEr. -- Best regards, Uvarov Michael -------------- next part -------------- An HTML attachment was scrubbed... URL: From max.lapshin@REDACTED Sun Dec 18 12:52:29 2011 From: max.lapshin@REDACTED (Max Lapshin) Date: Sun, 18 Dec 2011 14:52:29 +0300 Subject: [erlang-questions] Real life applications as code examples In-Reply-To: References: Message-ID: https://github.com/erlyvideo/h264 From emeka_1978@REDACTED Sun Dec 18 19:56:28 2011 From: emeka_1978@REDACTED (eigenfunction) Date: Sun, 18 Dec 2011 10:56:28 -0800 (PST) Subject: [erlang-questions] erlang package manager Message-ID: <0187e794-3de5-4e66-aa89-c613931e6fe3@u5g2000vbd.googlegroups.com> Hi everybody, I have been doing some erlang programming recently and have always generated the release manually and never really used neither rebar nor sinan. It seems like most people in the community have settled for rebar. Before i spend the next couple of days playing with those tools, can someone pls give me a quick recap on the differences between both? Thank you very much indeed. From watson.timothy@REDACTED Mon Dec 19 02:44:50 2011 From: watson.timothy@REDACTED (Tim Watson) Date: Mon, 19 Dec 2011 01:44:50 +0000 Subject: [erlang-questions] erlang package manager In-Reply-To: <0187e794-3de5-4e66-aa89-c613931e6fe3@u5g2000vbd.googlegroups.com> References: <0187e794-3de5-4e66-aa89-c613931e6fe3@u5g2000vbd.googlegroups.com> Message-ID: On 18 December 2011 18:56, eigenfunction wrote: > Hi everybody, > I have been doing some erlang programming recently and have always > generated the release manually and never really used neither rebar nor > sinan. It seems like most people in the community have settled for > rebar. Before i spend the next couple of days playing with those > tools, can someone pls give me a quick recap on the differences > between both? > > In terms of building your code, there isn't much difference really. In terms of package management, there's a big difference. The Erlware tool chain relies on a custom repository that holds binary (i.e., pre-built) artefacts and fetches the right ones for your system (based on OTP/erts version, OS, etc) - this is a good thing IMHO as I like just grabbing a thing once and not having to worry about the build steps, incompatibilities in build config, etc. The down side of the Erlware stack is that it hasn't been heavily adopted, so not that many of the libs/apps you want are available through the package manager. There are ways around this, but it's put me off to date. Now rebar on the other hand, doesn't do *package management* as such. It has a facility for fetching dependencies from the internet using version control tools (git, mercurial, subversion, bazaar) and puts these into a local build folder. All the commands you run at the top level basically recurse into the dependencies folder(s), so running `rebar get-deps compile` will fetch the stuff the build config needs and compile everything. There are other tools out there that do package management of sorts, agner probably being the most heavily adopted, but also there is sutro and epm. Of these, only agner integrates with rebar. There appears to be an effort by the erlware guys to produce another package manager that supports rebar and sinan based builds - they have repos on github and I'm sure will comment on this. There is also meant to be a successor to cean coming out soon, which will probably be quite similar in spirit (support numerous build tools and/or dependency management strategies) but we heard about it on the list some time ago and it hasn't materialised yet - see http://erlang.org/pipermail/erlang-questions/2011-June/059195.html. I do hope that the major players will collaborate if only to standardise their configuration handling, as it'd be nice to *write once, install using anything* as it were. I have been considering hacking together an alternative dependency manager for rebar, but I'm waiting to see if cean 2.0 comes out soon and how well it is adopted (or whether it will fetch stuff from alternative locations besides the main artefact repository). Hope that's a useful start - I'm sure lots of others will pipe up about this as it's a popular topic. -------------- next part -------------- An HTML attachment was scrubbed... URL: From vances@REDACTED Mon Dec 19 06:14:24 2011 From: vances@REDACTED (Vance Shipley) Date: Mon, 19 Dec 2011 10:44:24 +0530 Subject: [erlang-questions] Erlang wallpaper In-Reply-To: References: Message-ID: <20111219051423.GL298@aluminum.motivity.ca> Ten years ago there was a large collection of logo images on erlang.org: http://erlang.org/pipermail/erlang-questions/2001-September/003699.html It would be nice to have a replacement on the new web site. On Thu, Dec 15, 2011 at 06:56:43PM -0500, Yves S. Garret wrote: } I was thinking today. Django and CakePHP have their own wallpapers, why } shouldn't Erlang? Is there a 1600 x 1200 PNG somewhere that I can use on } my computer, that, preferably has a nice big E in the middle? -- -Vance From kunthar@REDACTED Mon Dec 19 06:50:36 2011 From: kunthar@REDACTED (Kunthar) Date: Mon, 19 Dec 2011 07:50:36 +0200 Subject: [erlang-questions] Erlang wallpaper In-Reply-To: <20111219051423.GL298@aluminum.motivity.ca> References: <20111219051423.GL298@aluminum.motivity.ca> Message-ID: I think it is time to say, logo seems like a really old fashioned one. Maybe there would be a logo contest to see new ideas? On Mon, Dec 19, 2011 at 7:14 AM, Vance Shipley wrote: > Ten years ago there was a large collection of logo images on erlang.org: > > ? http://erlang.org/pipermail/erlang-questions/2001-September/003699.html > > It would be nice to have a replacement on the new web site. > > On Thu, Dec 15, 2011 at 06:56:43PM -0500, Yves S. Garret wrote: > } ? ? I was thinking today. ?Django and CakePHP have their own wallpapers, why > } ?shouldn't Erlang? ?Is there a 1600 x 1200 PNG somewhere that I can use on > } ?my computer, that, preferably has a nice big E in the middle? > > -- > ? ? ? ?-Vance > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions -- BR, \|/ Kunthar From Tobias.Schlager@REDACTED Mon Dec 19 09:18:39 2011 From: Tobias.Schlager@REDACTED (Tobias Schlager) Date: Mon, 19 Dec 2011 08:18:39 +0000 Subject: [erlang-questions] erlang package manager In-Reply-To: References: <0187e794-3de5-4e66-aa89-c613931e6fe3@u5g2000vbd.googlegroups.com>, Message-ID: <12F2115FD1CCEE4294943B2608A18FA3E4D443@MAIL01.win.lbaum.eu> Hi, if your looking for package management and you're already familiar with apache maven the maven-erlang-plugin could be useful. Especially if you already have a continuous integration infrastructure you want to reuse. * http://erlang-plugin.sourceforge.net/ Tobias Von: erlang-questions-bounces@REDACTED [erlang-questions-bounces@REDACTED]" im Auftrag von "Tim Watson [watson.timothy@REDACTED] Gesendet: Montag, 19. Dezember 2011 02:44 Bis: eigenfunction Cc: erlang-questions@REDACTED Betreff: Re: [erlang-questions] erlang package manager On 18 December 2011 18:56, eigenfunction wrote: Hi everybody, I have been doing some erlang programming recently and have always generated the release manually and never really used neither rebar nor sinan. It seems like most people in the community have settled for rebar. Before i spend the next couple of days playing with those tools, can someone pls give me a quick recap on the differences between both? In terms of building your code, there isn't much difference really. In terms of package management, there's a big difference. The Erlware tool chain relies on a custom repository that holds binary (i.e., pre-built) artefacts and fetches the right ones for your system (based on OTP/erts version, OS, etc) - this is a good thing IMHO as I like just grabbing a thing once and not having to worry about the build steps, incompatibilities in build config, etc. The down side of the Erlware stack is that it hasn't been heavily adopted, so not that many of the libs/apps you want are available through the package manager. There are ways around this, but it's put me off to date. Now rebar on the other hand, doesn't do *package management* as such. It has a facility for fetching dependencies from the internet using version control tools (git, mercurial, subversion, bazaar) and puts these into a local build folder. All the commands you run at the top level basically recurse into the dependencies folder(s), so running `rebar get-deps compile` will fetch the stuff the build config needs and compile everything. There are other tools out there that do package management of sorts, agner probably being the most heavily adopted, but also there is sutro and epm. Of these, only agner integrates with rebar. There appears to be an effort by the erlware guys to produce another package manager that supports rebar and sinan based builds - they have repos on github and I'm sure will comment on this. There is also meant to be a successor to cean coming out soon, which will probably be quite similar in spirit (support numerous build tools and/or dependency management strategies) but we heard about it on the list some time ago and it hasn't materialised yet - see http://erlang.org/pipermail/erlang-questions/2011-June/059195.html. I do hope that the major players will collaborate if only to standardise their configuration handling, as it'd be nice to *write once, install using anything* as it were. I have been considering hacking together an alternative dependency manager for rebar, but I'm waiting to see if cean 2.0 comes out soon and how well it is adopted (or whether it will fetch stuff from alternative locations besides the main artefact repository). Hope that's a useful start - I'm sure lots of others will pipe up about this as it's a popular topic. From emeka_1978@REDACTED Mon Dec 19 10:36:15 2011 From: emeka_1978@REDACTED (eigenfunction) Date: Mon, 19 Dec 2011 01:36:15 -0800 (PST) Subject: [erlang-questions] erlang_port Message-ID: <143df567-a488-4d6e-850f-c44b1544a8e8@o14g2000vbo.googlegroups.com> I am trying to control a window os process with erlang. Can someone explain this to me: os:cmd("start www.yahoo.com") is working; erlang_port({spawn,"start www.yahoo.com"},[exit_status]) is not working and throws an exception error: enoent. Thx. From mapandfold@REDACTED Mon Dec 19 11:18:07 2011 From: mapandfold@REDACTED (Justus) Date: Mon, 19 Dec 2011 18:18:07 +0800 Subject: [erlang-questions] source file encoding Message-ID: Hi all, Strings must be in the ISO-latin-1 character set. I remember that errors will be reported if other characters occurring in a .erl file when compiling. But when trying R15B, it looks that values beyond ISO-latin-1 are also accepted. So now, we can use UTF8 without BOM encoding, and with the help of ct_expand, I managed to say "hello world" in Chinese literally. I wonder is there any plan add Unicode support in string- and character-literals? -compile({parse_transform, ct_expand}). -define(STR(S), ct_expand:term(unicode:characters_to_list(list_to_binary(S)))). hello_world() -> S = ?STR("??, ??"), io:format("~ts~n", [S]). -- Best Regards, Justus From watson.timothy@REDACTED Mon Dec 19 11:48:29 2011 From: watson.timothy@REDACTED (Tim Watson) Date: Mon, 19 Dec 2011 10:48:29 +0000 Subject: [erlang-questions] erlang package manager In-Reply-To: <12F2115FD1CCEE4294943B2608A18FA3E4D443@MAIL01.win.lbaum.eu> References: <0187e794-3de5-4e66-aa89-c613931e6fe3@u5g2000vbd.googlegroups.com> <12F2115FD1CCEE4294943B2608A18FA3E4D443@MAIL01.win.lbaum.eu> Message-ID: On 19 December 2011 08:18, Tobias Schlager wrote: > Hi, > > if your looking for package management and you're already familiar with > apache maven the maven-erlang-plugin could be useful. Especially if you > already have a continuous integration infrastructure you want to reuse. > > * http://erlang-plugin.sourceforge.net/ > > Tobias > > Ooh yes, I forgot about that one. It actually looks very feature complete, though of course one has to get used to writing poms (or build a parent pom to inherit from). Tobias, do you know if there is an archetype for generating the initial project structure and whether or not the plugin understands the concept of releases? We use maven heavily for Java/Scala at work and although we use rebar to build erlang code, we package stuff up according to maven principles and deploy into a maven repo (actually using Sonatype's Nexus artefact repository). This works very well despite multiple build systems in the mix and automated deployments are relatively easy when you've got a binary artefact repository to pull from. -------------- next part -------------- An HTML attachment was scrubbed... URL: From rtrlists@REDACTED Mon Dec 19 12:25:07 2011 From: rtrlists@REDACTED (Robert Raschke) Date: Mon, 19 Dec 2011 11:25:07 +0000 Subject: [erlang-questions] erlang_port In-Reply-To: <143df567-a488-4d6e-850f-c44b1544a8e8@o14g2000vbo.googlegroups.com> References: <143df567-a488-4d6e-850f-c44b1544a8e8@o14g2000vbo.googlegroups.com> Message-ID: On Mon, Dec 19, 2011 at 9:36 AM, eigenfunction wrote: > I am trying to control a window os process with erlang. Can someone > explain this to me: > os:cmd("start www.yahoo.com") is working; > erlang_port({spawn,"start www.yahoo.com"},[exit_status]) is not > working and throws an exception error: enoent. > Thx. > > Try this: erlang:open_port({spawn,"cmd /c start www.yahoo.com"},[exit_status]). The "start" command is a windows command shell builtin, not an executable. So you have to run it in a shell, which os:cmd/1 does automatically for you, but erlang:open_port/2 doesn't. And enoent in this context means that the exe named "start" could not be found. Have fun, Robby -------------- next part -------------- An HTML attachment was scrubbed... URL: From mononcqc@REDACTED Mon Dec 19 13:13:22 2011 From: mononcqc@REDACTED (Fred Hebert) Date: Mon, 19 Dec 2011 07:13:22 -0500 Subject: [erlang-questions] Erlang wallpaper In-Reply-To: References: <20111219051423.GL298@aluminum.motivity.ca> Message-ID: I think the logo is very nice and aged well. Plus I'd fear the kind of web 2.0 stuff we'd likely get from an open contest, but that's all about personal preferences. On Mon, Dec 19, 2011 at 12:50 AM, Kunthar wrote: > I think it is time to say, logo seems like a really old fashioned one. > Maybe there would be a logo contest to see new ideas? > > > > On Mon, Dec 19, 2011 at 7:14 AM, Vance Shipley wrote: > > Ten years ago there was a large collection of logo images on erlang.org: > > > > > http://erlang.org/pipermail/erlang-questions/2001-September/003699.html > > > > It would be nice to have a replacement on the new web site. > > > > On Thu, Dec 15, 2011 at 06:56:43PM -0500, Yves S. Garret wrote: > > } I was thinking today. Django and CakePHP have their own > wallpapers, why > > } shouldn't Erlang? Is there a 1600 x 1200 PNG somewhere that I can > use on > > } my computer, that, preferably has a nice big E in the middle? > > > > -- > > -Vance > > _______________________________________________ > > 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 attila.r.nohl@REDACTED Mon Dec 19 13:57:25 2011 From: attila.r.nohl@REDACTED (Attila Rajmund Nohl) Date: Mon, 19 Dec 2011 13:57:25 +0100 Subject: [erlang-questions] Dialyzing strategy Message-ID: Hello! I have a rather large Erlang product and want to run dialyzer on it. This product consists of around 100 functional blocks. There is a dependency between the function blocks and I can't swear there's no circular dependency between some of the blocks, unfortunately. This dependency is multi-level, i.e. function block A depends on B which in turn depends on C, etc. Moreover, some blocks contain multiple modules with the same name. They are not loaded simultaneously in the runtime system (or at least the shadowing is designed), but it means that I can't dialyze the function blocks simply. The other problem is the size of the product - the 32 bit dialyzer run out of 4 GB memory when I tried to run it on more than a couple of function blocks simultaneously. I haven't tried to run dialyzer on the whole product, I guess that the 16 GB physical memory would be not enough either. So how shall I run dialyzer on this product? Our currently method is that I identified a couple of "base" function blocks. The other function blocks depend on these base blocks and also these base blocks do not contain duplicated module names. In our nightly tests I first build one PLT from these all "base" function blocks and also from some of the OTP applications. Then for each of the remainder function blocks I build a PLT from the unique modules and from the previously created "base" PLT. Then finally I dun dialyzer on the duplicated modules with the PLT created in the previous step. In each nightly test new PLTs are built. My problem with this approach is that it takes quite a long time, around three hours or more. The ideal solution would be to incorporate dialyzer to our build process. I would like to get the dialyzer warnings around the same time I get the compilation warnings. Or at least when the function block is built. Because running dialyzer takes a lot more time than building code, I'm thinking about having a separate PLT file for each function block that is rebuild when a new file is committed into the repository. Then these PLT files could be used by the individual developers to check their code before committing. How would you run dialyzer on this kind of product? How do you run dialyzer on your product? From emeka_1978@REDACTED Mon Dec 19 14:49:16 2011 From: emeka_1978@REDACTED (eigenfunction) Date: Mon, 19 Dec 2011 05:49:16 -0800 (PST) Subject: [erlang-questions] erlang_port In-Reply-To: References: <143df567-a488-4d6e-850f-c44b1544a8e8@o14g2000vbo.googlegroups.com> Message-ID: <827a0baa-06ef-499d-8bbf-dad7cd2f044d@cs7g2000vbb.googlegroups.com> Thank you so much. Now i can go back to doing real work. On Dec 19, 12:25?pm, Robert Raschke wrote: > On Mon, Dec 19, 2011 at 9:36 AM, eigenfunction wrote: > > I am trying to control a window os process with erlang. Can someone > > explain this to me: > > os:cmd("startwww.yahoo.com") is working; > > erlang_port({spawn,"startwww.yahoo.com"},[exit_status]) ?is not > > working and throws an exception error: enoent. > > Thx. > > Try this: > > erlang:open_port({spawn,"cmd /c startwww.yahoo.com"},[exit_status]). > > The "start" command is a windows command shell builtin, not an executable. > So you have to run it in a shell, which os:cmd/1 does automatically for > you, but erlang:open_port/2 doesn't. And enoent in this context means that > the exe named "start" could not be found. > > Have fun, > Robby > > _______________________________________________ > erlang-questions mailing list > erlang-questi...@REDACTED://erlang.org/mailman/listinfo/erlang-questions From sverker@REDACTED Mon Dec 19 15:03:47 2011 From: sverker@REDACTED (Sverker Eriksson) Date: Mon, 19 Dec 2011 15:03:47 +0100 Subject: [erlang-questions] erl_nif environment in the load() function In-Reply-To: References: Message-ID: <4EEF4443.6000500@erix.ericsson.se> Michael Uvarov wrote: > Hello, > > There is code as example: > https://github.com/beerriot/icu4e/blob/master/c_src/ustring.c > > I have few questions: > 1. How long is env's lifetime in the load(...)? Will the env be erased > after the call or after module unloading? > All environments passed as argument from VM are only valid until the call returns. > 2. Is this code valid? > > ERL_NIF_TERM ustring_endian(ErlNifEnv* env, int argc, > const ERL_NIF_TERM argv[]) { > return ATOM_ENDIAN; > } > > Is the next construction better? > > return enif_make_copy(env, ATOM_ENDIAN); > > Normally the lifetime of a term is determined by its environment. However, atoms are an exception to this rule, which allows you to prefabricate atoms in static variables. This exceptions is undocumented but widely used (by myself included in crypto). There is a small risk that an introduction of atom garbage collection in some non predictable future release will have to break this feature. The "super correct" way to return atoms is to either * call enif_make_atom() every time you want to return an atom * prefabricate atoms with enif_alloc_env() and enif_make_atom() in load() and then copy them with enif_make_copy() to the right environments. Both of these will cost performance, I don't know which one is worse. The best solution would be to come up with an addition to the erl_nif interface that would both give good performance and be future proof. /Sverker, Erlang/OTP From yoursurrogategod@REDACTED Mon Dec 19 15:22:26 2011 From: yoursurrogategod@REDACTED (Yves S. Garret) Date: Mon, 19 Dec 2011 09:22:26 -0500 Subject: [erlang-questions] Erlang wallpaper In-Reply-To: References: <20111219051423.GL298@aluminum.motivity.ca> Message-ID: I have to disagree as well. The current logo is just peachy for me. If there is a contest just to see what comes up, fine, but I think the current one still looks pretty chic. On Mon, Dec 19, 2011 at 7:13 AM, Fred Hebert wrote: > I think the logo is very nice and aged well. Plus I'd fear the kind of web > 2.0 stuff we'd likely get from an open contest, but that's all about > personal preferences. > > > On Mon, Dec 19, 2011 at 12:50 AM, Kunthar wrote: > >> I think it is time to say, logo seems like a really old fashioned one. >> Maybe there would be a logo contest to see new ideas? >> >> >> >> On Mon, Dec 19, 2011 at 7:14 AM, Vance Shipley >> wrote: >> > Ten years ago there was a large collection of logo images on erlang.org >> : >> > >> > >> http://erlang.org/pipermail/erlang-questions/2001-September/003699.html >> > >> > It would be nice to have a replacement on the new web site. >> > >> > On Thu, Dec 15, 2011 at 06:56:43PM -0500, Yves S. Garret wrote: >> > } I was thinking today. Django and CakePHP have their own >> wallpapers, why >> > } shouldn't Erlang? Is there a 1600 x 1200 PNG somewhere that I can >> use on >> > } my computer, that, preferably has a nice big E in the middle? >> > >> > -- >> > -Vance >> > _______________________________________________ >> > 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 jesper.louis.andersen@REDACTED Mon Dec 19 16:06:03 2011 From: jesper.louis.andersen@REDACTED (Jesper Louis Andersen) Date: Mon, 19 Dec 2011 16:06:03 +0100 Subject: [erlang-questions] Erlang wallpaper In-Reply-To: References: <20111219051423.GL298@aluminum.motivity.ca> Message-ID: <4EEF52DB.7010407@erlang-solutions.com> On 12/19/11 3:22 PM, Yves S. Garret wrote: > I have to disagree as well. The current logo is just peachy for me. > If there is a contest just to see what comes up, fine, but I think > the current one still looks pretty chic. Good logos are timeless. Good logos look good when printed in color and in black&white. Look at the logo of Google for instance: They change the logo slightly so it looks "modern" but the basic outline and style is still the same. Take a look at http://www.instantshift.com/2009/01/29/20-corporate-brand-logo-evolution/ for an example of how to do this correctly over time. -- Jesper Louis Andersen Erlang Solutions, DK From witeman.g@REDACTED Mon Dec 19 16:21:14 2011 From: witeman.g@REDACTED (Zheng Zhibin) Date: Mon, 19 Dec 2011 23:21:14 +0800 Subject: [erlang-questions] Erlang wallpaper In-Reply-To: <4EEF52DB.7010407@erlang-solutions.com> References: <20111219051423.GL298@aluminum.motivity.ca> <4EEF52DB.7010407@erlang-solutions.com> Message-ID: http://commons.wikimedia.org/wiki/File:Viverra_zibetha_Schreber.jpg I like some kind of this type of logo for Erlang! Some Guru please work on it ^_^ Best Regards, Witeman ? 2011-12-19???11:06? Jesper Louis Andersen ??? > On 12/19/11 3:22 PM, Yves S. Garret wrote: >> I have to disagree as well. The current logo is just peachy for me. If there is a contest just to see what comes up, fine, but I think the current one still looks pretty chic. > > Good logos are timeless. > Good logos look good when printed in color and in black&white. > > Look at the logo of Google for instance: They change the logo slightly so it looks "modern" but the basic outline and style is still the same. Take a look at > > http://www.instantshift.com/2009/01/29/20-corporate-brand-logo-evolution/ > > for an example of how to do this correctly over time. > > -- > Jesper Louis Andersen > Erlang Solutions, DK > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions From uberdeveloper001@REDACTED Mon Dec 19 16:29:12 2011 From: uberdeveloper001@REDACTED (Ubermensch) Date: Mon, 19 Dec 2011 20:59:12 +0530 Subject: [erlang-questions] Proposal for new Q&A site in Stack Exchange Message-ID: Hi friends, I have proposed a Q&A site for Concurrent, Distributed and Parallel programming in Stack Exchange. Proposed site I believe this would benefit all new and experienced users to this paradigm in general and Erlang in particular. Require support to put the site in beta -- Ubermensch -------------- next part -------------- An HTML attachment was scrubbed... URL: From comptekki@REDACTED Mon Dec 19 17:30:48 2011 From: comptekki@REDACTED (Wes James) Date: Mon, 19 Dec 2011 09:30:48 -0700 Subject: [erlang-questions] Proposal for new Q&A site in Stack Exchange In-Reply-To: References: Message-ID: Is it an advantage or disadvantage to have more places to post questions? If it goes there, then people here won't see it (at least immediately). I'd rather people come to this list and post their questions so they can be seen first hand. If questions are put on this proposed site or say stackoverflow, they may not be seen for some time until someone does a search that makes a hit on that question and then decides to answer. That's not saying questions won't go unanswered on this list either. me dos centavos -wes On Mon, Dec 19, 2011 at 8:29 AM, Ubermensch wrote: > Hi friends, > I have proposed a Q&A site for Concurrent, Distributed and Parallel > programming in Stack Exchange. > Proposed site > > > I believe this would benefit all new and experienced users to this paradigm > in general and Erlang in particular. Require support to put the site in beta > > -- > Ubermensch > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > From emeka_1978@REDACTED Mon Dec 19 17:45:16 2011 From: emeka_1978@REDACTED (eigenfunction) Date: Mon, 19 Dec 2011 08:45:16 -0800 (PST) Subject: [erlang-questions] erlang package manager In-Reply-To: References: <0187e794-3de5-4e66-aa89-c613931e6fe3@u5g2000vbd.googlegroups.com> Message-ID: <271fbb49-f6de-4688-a737-64d713d8d291@z17g2000vbe.googlegroups.com> Thank you for the detailed break down.?After playing with sinan and rebar, i tend to like sinan more. Of course, my view might change as i become more experience with the tool. I have tried to stay away from maven, since java build tools usually give me nightmares. But since you use rebar and package your stuff maven style, i am going to bring maven back into the equation since i already know how it works. On Dec 19, 2:44?am, Tim Watson wrote: > On 18 December 2011 18:56, eigenfunction wrote: > > > Hi everybody, > > I have been doing some erlang programming recently and have always > > generated the release manually and never really used neither rebar nor > > sinan. It seems like most people in the community have settled for > > rebar. Before i spend the next couple of days playing with those > > tools, can someone pls give me a quick recap on the differences > > between both? > > In terms of building your code, there isn't much difference really. In > terms of package management, there's a big difference. The Erlware tool > chain relies on a custom repository that holds binary (i.e., pre-built) > artefacts and fetches the right ones for your system (based on OTP/erts > version, OS, etc) - this is a good thing IMHO as I like just grabbing a > thing once and not having to worry about the build steps, incompatibilities > in build config, etc. The down side of the Erlware stack is that it hasn't > been heavily adopted, so not that many of the libs/apps you want are > available through the package manager. There are ways around this, but it's > put me off to date. > > Now rebar on the other hand, doesn't do *package management* as such. It > has a facility for fetching dependencies from the internet using version > control tools (git, mercurial, subversion, bazaar) and puts these into a > local build folder. All the commands you run at the top level basically > recurse into the dependencies folder(s), so running `rebar get-deps > compile` will fetch the stuff the build config needs and compile everything. > > There are other tools out there that do package management of sorts, agner > probably being the most heavily adopted, but also there is sutro and epm. > Of these, only agner integrates with rebar. > > There appears to be an effort by the erlware guys to produce another > package manager that supports rebar and sinan based builds - they have > repos on github and I'm sure will comment on this. > > There is also meant to be a successor to cean coming out soon, which will > probably be quite similar in spirit (support numerous build tools and/or > dependency management strategies) but we heard about it on the list some > time ago and it hasn't materialised yet - seehttp://erlang.org/pipermail/erlang-questions/2011-June/059195.html. I do > hope that the major players will collaborate if only to standardise their > configuration handling, as it'd be nice to *write once, install using > anything* as it were. > > I have been considering hacking together an alternative dependency manager > for rebar, but I'm waiting to see if cean 2.0 comes out soon and how well > it is adopted (or whether it will fetch stuff from alternative locations > besides the main artefact repository). > > Hope that's a useful start - I'm sure lots of others will pipe up about > this as it's a popular topic. > > _______________________________________________ > erlang-questions mailing list > erlang-questi...@REDACTED://erlang.org/mailman/listinfo/erlang-questions From tristan.sloughter@REDACTED Mon Dec 19 18:40:52 2011 From: tristan.sloughter@REDACTED (Tristan Sloughter) Date: Mon, 19 Dec 2011 11:40:52 -0600 Subject: [erlang-questions] Webmachine Binary Request Strings Message-ID: This may be better on a Webmachine questions list. But I thought I'd ask here first since it may be that someone working on one of the other Erlang web servers, besides Mochiweb, has worked on moving Webmachine to use that server. The reason I say that is, Webmachine currently relies on Mochiweb which passes lists instead of binary strings for requests. While the req_body of a request is given as a binary the path_info and query string is dealt with as lists. While I would think there could be a performance hit due to this my main reason to ask for alternatives is that dealing with JSON representations on the backend require converting the lists to binaries for processing every time. There has been https://github.com/mochi/mochiweb/pull/38 but its clear at the end of the discussion its not a change that will be happening to mochiweb anytime soon. So is there work on Webmachine backed by Cowboy or another Erlang web server? Thanks, Tristan -------------- next part -------------- An HTML attachment was scrubbed... URL: From ulf@REDACTED Mon Dec 19 19:14:07 2011 From: ulf@REDACTED (Ulf Wiger) Date: Mon, 19 Dec 2011 19:14:07 +0100 Subject: [erlang-questions] honoring SKIP files during make release_tests Message-ID: <57FC8384-CCF5-48DF-B92D-55BB569FF09B@feuerlabs.com> Perhaps I'm just not seeing the secret way to do this, but it seems to me that if I put a SKIP file inside an OTP app directory, this should have effect also on the 'make release_tests' action. The thing is, if some of the applications have been skipped during 'make', there isn't much point in running the tests - also, in some cases, even compiling the tests will fail. I made the following dirty change in Makefile.in: $(TEST_DIRS): if test -f $@/../SKIP ; then \ echo "=== Skipping $@, reason:" ; \ cat $@/../SKIP ; \ echo "===" ; \ else \ if test -f $@/Makefile; then \ (cd $@; $(MAKE) TESTROOT=$(TESTSUITE_ROOT) release_tests) || exit $$?; \ fi \ fi I'm sure someone who loves makefile editing more than I could clean this up a little. Anyway, it works. I can run 'make release_tests', and the apps that contain SKIP files are, in fact, skipped. BR, Ulf W From freeakk@REDACTED Mon Dec 19 19:42:55 2011 From: freeakk@REDACTED (Michael Uvarov) Date: Mon, 19 Dec 2011 21:42:55 +0300 Subject: [erlang-questions] source file encoding In-Reply-To: References: Message-ID: This works in R14B03 too. -------------- next part -------------- An HTML attachment was scrubbed... URL: From freeakk@REDACTED Mon Dec 19 19:48:12 2011 From: freeakk@REDACTED (Michael Uvarov) Date: Mon, 19 Dec 2011 21:48:12 +0300 Subject: [erlang-questions] erl_nif environment in the load() function In-Reply-To: <4EEF4443.6000500@erix.ericsson.se> References: <4EEF4443.6000500@erix.ericsson.se> Message-ID: Thank you for your help. Additional function around returned atoms localized required in the future changes in my code. -------------- next part -------------- An HTML attachment was scrubbed... URL: From magnus.klaar@REDACTED Mon Dec 19 20:50:32 2011 From: magnus.klaar@REDACTED (Magnus Klaar) Date: Mon, 19 Dec 2011 20:50:32 +0100 Subject: [erlang-questions] Webmachine Binary Request Strings In-Reply-To: References: Message-ID: Hi! Cowboy currently includes an experimental webmachine-like interface. The first commit of this module should explain some of the key differences from webmachine. If i remember the history of this module the intial estimate for the time needed to decouple webmachine from mochiweb _and_ refactor webmachine to support both binaries and lists everywhere was greater than the time needed to just add the difference between the two to cowboy. https://github.com/extend/cowboy/commit/aab1587a4b3d8f0c3d92a2083227527d51109980 If you're interested in a MVH Magnus On Mon, Dec 19, 2011 at 6:40 PM, Tristan Sloughter < tristan.sloughter@REDACTED> wrote: > This may be better on a Webmachine questions list. But I thought I'd ask > here first since it may be that someone working on one of the other Erlang > web servers, besides Mochiweb, has worked on moving Webmachine to use that > server. > > The reason I say that is, Webmachine currently relies on Mochiweb which > passes lists instead of binary strings for requests. While the req_body of > a request is given as a binary the path_info and query string is dealt with > as lists. While I would think there could be a performance hit due to this > my main reason to ask for alternatives is that dealing with JSON > representations on the backend require converting the lists to binaries for > processing every time. > > There has been https://github.com/mochi/mochiweb/pull/38 but its clear at > the end of the discussion its not a change that will be happening to > mochiweb anytime soon. > > So is there work on Webmachine backed by Cowboy or another Erlang web > server? > > Thanks, > Tristan > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From tristan.sloughter@REDACTED Mon Dec 19 21:24:42 2011 From: tristan.sloughter@REDACTED (Tristan Sloughter) Date: Mon, 19 Dec 2011 14:24:42 -0600 Subject: [erlang-questions] Webmachine Binary Request Strings In-Reply-To: References: Message-ID: Interesting. Sucks that webmachine is so tied to mochi and mochi so tied to lists, haha. But I'll give this a look. Tristan On Mon, Dec 19, 2011 at 1:50 PM, Magnus Klaar wrote: > Hi! > > Cowboy currently includes an experimental webmachine-like interface. The > first commit of this module should explain some of the key differences from > webmachine. If i remember the history of this module the intial estimate > for the time needed to decouple webmachine from mochiweb _and_ refactor > webmachine to support both binaries and lists everywhere was greater than > the time needed to just add the difference between the two to cowboy. > > > https://github.com/extend/cowboy/commit/aab1587a4b3d8f0c3d92a2083227527d51109980 > > If you're interested in a > > MVH Magnus > > On Mon, Dec 19, 2011 at 6:40 PM, Tristan Sloughter < > tristan.sloughter@REDACTED> wrote: > >> This may be better on a Webmachine questions list. But I thought I'd ask >> here first since it may be that someone working on one of the other Erlang >> web servers, besides Mochiweb, has worked on moving Webmachine to use that >> server. >> >> The reason I say that is, Webmachine currently relies on Mochiweb which >> passes lists instead of binary strings for requests. While the req_body of >> a request is given as a binary the path_info and query string is dealt with >> as lists. While I would think there could be a performance hit due to this >> my main reason to ask for alternatives is that dealing with JSON >> representations on the backend require converting the lists to binaries for >> processing every time. >> >> There has been https://github.com/mochi/mochiweb/pull/38 but its clear >> at the end of the discussion its not a change that will be happening to >> mochiweb anytime soon. >> >> So is there work on Webmachine backed by Cowboy or another Erlang web >> server? >> >> Thanks, >> Tristan >> >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://erlang.org/mailman/listinfo/erlang-questions >> >> > -------------- next part -------------- An HTML attachment was scrubbed... URL: From magnus.klaar@REDACTED Mon Dec 19 22:04:42 2011 From: magnus.klaar@REDACTED (Magnus Klaar) Date: Mon, 19 Dec 2011 22:04:42 +0100 Subject: [erlang-questions] Webmachine Binary Request Strings In-Reply-To: References: Message-ID: Hi! Sorry for including only the first half of that last sentence. It was meant to address this reply in advance, kind of. If you're interesting in using it i recommend at least going through the commit log for this module and the issue tracker for the project on github to see what has been fixed between the initial version and the current version, at the time of writing this it's not an unreasonable amount. It'll give you a better view of what parts of it has been vetted for practical use. There is already a small group of active users and contributors on IRC (#erlang #erlounge on freenode) if you're interested in participating. MVH Magnus On Mon, Dec 19, 2011 at 9:24 PM, Tristan Sloughter < tristan.sloughter@REDACTED> wrote: > Interesting. Sucks that webmachine is so tied to mochi and mochi so tied > to lists, haha. But I'll give this a look. > > Tristan > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From rexxe98@REDACTED Mon Dec 19 22:16:10 2011 From: rexxe98@REDACTED (Andrew Berman) Date: Mon, 19 Dec 2011 13:16:10 -0800 Subject: [erlang-questions] Webmachine Binary Request Strings In-Reply-To: References: Message-ID: There was talk on one of the mailing lists about using something like SimpleBridge (https://github.com/nitrogen/simple_bridge) so that the use of a web server could be independent of Webmachine's logic, which IMO is the best solution. I don't think anyone did anything about it, but for some reason, SimpleBridge has Webmachine support, which doesn't make sense logically to me since Webmachine is a toolkit and not a web server. I use Webmachine and love what it does for me, but the code seems overly complicated with a heavy reliance on Mochiweb and uses parameterized modules (an unsupported feature of Erlang), so I would actually be more inclined to start a new project which is influenced by Webmachine but corrects all the issues with it and makes it a bit more flexible and modern (would love for Webmachine to support PATCH for example and something like Socket.IO). I'd be happy to help out with such a project if anyone is interested in starting one. --Andrew On Mon, Dec 19, 2011 at 12:24 PM, Tristan Sloughter < tristan.sloughter@REDACTED> wrote: > Interesting. Sucks that webmachine is so tied to mochi and mochi so tied > to lists, haha. But I'll give this a look. > > Tristan > > > On Mon, Dec 19, 2011 at 1:50 PM, Magnus Klaar wrote: > >> Hi! >> >> Cowboy currently includes an experimental webmachine-like interface. The >> first commit of this module should explain some of the key differences from >> webmachine. If i remember the history of this module the intial estimate >> for the time needed to decouple webmachine from mochiweb _and_ refactor >> webmachine to support both binaries and lists everywhere was greater than >> the time needed to just add the difference between the two to cowboy. >> >> >> https://github.com/extend/cowboy/commit/aab1587a4b3d8f0c3d92a2083227527d51109980 >> >> If you're interested in a >> >> MVH Magnus >> >> On Mon, Dec 19, 2011 at 6:40 PM, Tristan Sloughter < >> tristan.sloughter@REDACTED> wrote: >> >>> This may be better on a Webmachine questions list. But I thought I'd ask >>> here first since it may be that someone working on one of the other Erlang >>> web servers, besides Mochiweb, has worked on moving Webmachine to use that >>> server. >>> >>> The reason I say that is, Webmachine currently relies on Mochiweb which >>> passes lists instead of binary strings for requests. While the req_body of >>> a request is given as a binary the path_info and query string is dealt with >>> as lists. While I would think there could be a performance hit due to this >>> my main reason to ask for alternatives is that dealing with JSON >>> representations on the backend require converting the lists to binaries for >>> processing every time. >>> >>> There has been https://github.com/mochi/mochiweb/pull/38 but its clear >>> at the end of the discussion its not a change that will be happening to >>> mochiweb anytime soon. >>> >>> So is there work on Webmachine backed by Cowboy or another Erlang web >>> server? >>> >>> Thanks, >>> Tristan >>> >>> _______________________________________________ >>> 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 essen@REDACTED Mon Dec 19 22:27:13 2011 From: essen@REDACTED (=?ISO-8859-1?Q?Lo=EFc_Hoguin?=) Date: Mon, 19 Dec 2011 22:27:13 +0100 Subject: [erlang-questions] Webmachine Binary Request Strings In-Reply-To: References: Message-ID: <4EEFAC31.80404@dev-extend.eu> SimpleBridge is nice, but it doesn't solve the OP's issue, which is that all the lists are being converted to binary when encoding into JSON, so he wants a binary webmachine to avoid converting from lists to binary all the time. I believe the implementation added to Cowboy recently does what the OP needs. On the other hand it's definitely tied to Cowboy and that should be taken into consideration when deciding what to use. It's also still considered experimental, although I've had good reports so far. Now if there was a SimpleBinaryBridge project it could be more suitable for his purpose, but afaik only Cowboy is full binary so far (only accepting (io)lists as output data). And of course adding Cowboy to SimpleBridge would just be a binary_to_list fest and would remove half the advantages of using that server so it's a bit of a dead end there. On 12/19/2011 10:16 PM, Andrew Berman wrote: > There was talk on one of the mailing lists about using something like > SimpleBridge (https://github.com/nitrogen/simple_bridge) so that the use > of a web server could be independent of Webmachine's logic, which IMO is > the best solution. I don't think anyone did anything about it, but for > some reason, SimpleBridge has Webmachine support, which doesn't make > sense logically to me since Webmachine is a toolkit and not a web server. > > I use Webmachine and love what it does for me, but the code seems overly > complicated with a heavy reliance on Mochiweb and uses parameterized > modules (an unsupported feature of Erlang), so I would actually be more > inclined to start a new project which is influenced by Webmachine but > corrects all the issues with it and makes it a bit more flexible and > modern (would love for Webmachine to support PATCH for example and > something like Socket.IO). I'd be happy to help out with such a project > if anyone is interested in starting one. > > --Andrew > > On Mon, Dec 19, 2011 at 12:24 PM, Tristan Sloughter > > wrote: > > Interesting. Sucks that webmachine is so tied to mochi and mochi so > tied to lists, haha. But I'll give this a look. > > Tristan > > > On Mon, Dec 19, 2011 at 1:50 PM, Magnus Klaar > > wrote: > > Hi! > > Cowboy currently includes an experimental webmachine-like > interface. The first commit of this module should explain some > of the key differences from webmachine. If i remember the > history of this module the intial estimate for the time needed > to decouple webmachine from mochiweb _and_ refactor webmachine > to support both binaries and lists everywhere was greater than > the time needed to just add the difference between the two to > cowboy. > > https://github.com/extend/cowboy/commit/aab1587a4b3d8f0c3d92a2083227527d51109980 > > If you're interested in a > > MVH Magnus > > On Mon, Dec 19, 2011 at 6:40 PM, Tristan Sloughter > > wrote: > > This may be better on a Webmachine questions list. But I > thought I'd ask here first since it may be that someone > working on one of the other Erlang web servers, besides > Mochiweb, has worked on moving Webmachine to use that server. > > The reason I say that is, Webmachine currently relies on > Mochiweb which passes lists instead of binary strings for > requests. While the req_body of a request is given as a > binary the path_info and query string is dealt with as > lists. While I would think there could be a performance hit > due to this my main reason to ask for alternatives is that > dealing with JSON representations on the backend require > converting the lists to binaries for processing every time. > > There has been https://github.com/mochi/mochiweb/pull/38 but > its clear at the end of the discussion its not a change that > will be happening to mochiweb anytime soon. > > So is there work on Webmachine backed by Cowboy or another > Erlang web server? > > Thanks, > Tristan > > _______________________________________________ > 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 -- Lo?c Hoguin Dev:Extend From rexxe98@REDACTED Mon Dec 19 22:34:35 2011 From: rexxe98@REDACTED (Andrew Berman) Date: Mon, 19 Dec 2011 13:34:35 -0800 Subject: [erlang-questions] Webmachine Binary Request Strings In-Reply-To: <4EEFAC31.80404@dev-extend.eu> References: <4EEFAC31.80404@dev-extend.eu> Message-ID: Ah, yes, I agree we would need a SimpleBridgeBinary and then go the opposite way if a web server doesn't support binary (binary_to_list). I don't think that would be too difficult to implement. The Webmachine decision core is the more difficult part but not too difficult as it has been implemented in many other languages which might make the decisioning a bit easier to follow. On Mon, Dec 19, 2011 at 1:27 PM, Lo?c Hoguin wrote: > SimpleBridge is nice, but it doesn't solve the OP's issue, which is that > all the lists are being converted to binary when encoding into JSON, so he > wants a binary webmachine to avoid converting from lists to binary all the > time. I believe the implementation added to Cowboy recently does what the > OP needs. On the other hand it's definitely tied to Cowboy and that should > be taken into consideration when deciding what to use. It's also still > considered experimental, although I've had good reports so far. > > Now if there was a SimpleBinaryBridge project it could be more suitable > for his purpose, but afaik only Cowboy is full binary so far (only > accepting (io)lists as output data). And of course adding Cowboy to > SimpleBridge would just be a binary_to_list fest and would remove half the > advantages of using that server so it's a bit of a dead end there. > > > On 12/19/2011 10:16 PM, Andrew Berman wrote: > >> There was talk on one of the mailing lists about using something like >> SimpleBridge (https://github.com/nitrogen/**simple_bridge) >> so that the use >> of a web server could be independent of Webmachine's logic, which IMO is >> the best solution. I don't think anyone did anything about it, but for >> some reason, SimpleBridge has Webmachine support, which doesn't make >> sense logically to me since Webmachine is a toolkit and not a web server. >> >> I use Webmachine and love what it does for me, but the code seems overly >> complicated with a heavy reliance on Mochiweb and uses parameterized >> modules (an unsupported feature of Erlang), so I would actually be more >> inclined to start a new project which is influenced by Webmachine but >> corrects all the issues with it and makes it a bit more flexible and >> modern (would love for Webmachine to support PATCH for example and >> something like Socket.IO). I'd be happy to help out with such a project >> if anyone is interested in starting one. >> >> --Andrew >> >> On Mon, Dec 19, 2011 at 12:24 PM, Tristan Sloughter >> >> >> wrote: >> >> Interesting. Sucks that webmachine is so tied to mochi and mochi so >> tied to lists, haha. But I'll give this a look. >> >> Tristan >> >> >> On Mon, Dec 19, 2011 at 1:50 PM, Magnus Klaar >> > wrote: >> >> Hi! >> >> Cowboy currently includes an experimental webmachine-like >> interface. The first commit of this module should explain some >> of the key differences from webmachine. If i remember the >> history of this module the intial estimate for the time needed >> to decouple webmachine from mochiweb _and_ refactor webmachine >> to support both binaries and lists everywhere was greater than >> the time needed to just add the difference between the two to >> cowboy. >> >> https://github.com/extend/**cowboy/commit/** >> aab1587a4b3d8f0c3d92a208322752**7d51109980 >> >> If you're interested in a >> >> MVH Magnus >> >> On Mon, Dec 19, 2011 at 6:40 PM, Tristan Sloughter >> > >> >> wrote: >> >> This may be better on a Webmachine questions list. But I >> thought I'd ask here first since it may be that someone >> working on one of the other Erlang web servers, besides >> Mochiweb, has worked on moving Webmachine to use that server. >> >> The reason I say that is, Webmachine currently relies on >> Mochiweb which passes lists instead of binary strings for >> requests. While the req_body of a request is given as a >> binary the path_info and query string is dealt with as >> lists. While I would think there could be a performance hit >> due to this my main reason to ask for alternatives is that >> dealing with JSON representations on the backend require >> converting the lists to binaries for processing every time. >> >> There has been https://github.com/mochi/**mochiweb/pull/38but >> its clear at the end of the discussion its not a change that >> will be happening to mochiweb anytime soon. >> >> So is there work on Webmachine backed by Cowboy or another >> Erlang web server? >> >> Thanks, >> Tristan >> >> ______________________________**_________________ >> erlang-questions mailing list >> erlang-questions@REDACTED > erlang.org > >> >> 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 >> > > > -- > Lo?c Hoguin > Dev:Extend > -------------- next part -------------- An HTML attachment was scrubbed... URL: From essen@REDACTED Mon Dec 19 22:39:34 2011 From: essen@REDACTED (=?UTF-8?B?TG/Dr2MgSG9ndWlu?=) Date: Mon, 19 Dec 2011 22:39:34 +0100 Subject: [erlang-questions] Webmachine Binary Request Strings In-Reply-To: References: <4EEFAC31.80404@dev-extend.eu> Message-ID: <4EEFAF16.2040201@dev-extend.eu> You can check out my implementation here for Cowboy: https://github.com/extend/cowboy/blob/master/src/cowboy_http_rest.erl Clean straightforward code was one of the big goals of this work. It has few differences with Webmachine, but people have been converting resources from Webmachine to Cowboy without much pain. And Cowboy already had a dispatcher so it was really just a matter of writing the decision code. Of course I'm open to any comment you may have about it, good or bad. On 12/19/2011 10:34 PM, Andrew Berman wrote: > Ah, yes, I agree we would need a SimpleBridgeBinary and then go the > opposite way if a web server doesn't support binary (binary_to_list). I > don't think that would be too difficult to implement. The Webmachine > decision core is the more difficult part but not too difficult as it > has been implemented in many other languages which might make the > decisioning a bit easier to follow. > > On Mon, Dec 19, 2011 at 1:27 PM, Lo?c Hoguin > wrote: > > SimpleBridge is nice, but it doesn't solve the OP's issue, which is > that all the lists are being converted to binary when encoding into > JSON, so he wants a binary webmachine to avoid converting from lists > to binary all the time. I believe the implementation added to Cowboy > recently does what the OP needs. On the other hand it's definitely > tied to Cowboy and that should be taken into consideration when > deciding what to use. It's also still considered experimental, > although I've had good reports so far. > > Now if there was a SimpleBinaryBridge project it could be more > suitable for his purpose, but afaik only Cowboy is full binary so > far (only accepting (io)lists as output data). And of course adding > Cowboy to SimpleBridge would just be a binary_to_list fest and would > remove half the advantages of using that server so it's a bit of a > dead end there. > > > On 12/19/2011 10:16 PM, Andrew Berman wrote: > > There was talk on one of the mailing lists about using something > like > SimpleBridge (https://github.com/nitrogen/__simple_bridge > ) so that the use > of a web server could be independent of Webmachine's logic, > which IMO is > the best solution. I don't think anyone did anything about it, > but for > some reason, SimpleBridge has Webmachine support, which doesn't make > sense logically to me since Webmachine is a toolkit and not a > web server. > > I use Webmachine and love what it does for me, but the code > seems overly > complicated with a heavy reliance on Mochiweb and uses parameterized > modules (an unsupported feature of Erlang), so I would actually > be more > inclined to start a new project which is influenced by > Webmachine but > corrects all the issues with it and makes it a bit more flexible and > modern (would love for Webmachine to support PATCH for example and > something like Socket.IO). I'd be happy to help out with such a > project > if anyone is interested in starting one. > > --Andrew > > On Mon, Dec 19, 2011 at 12:24 PM, Tristan Sloughter > > >> wrote: > > Interesting. Sucks that webmachine is so tied to mochi and > mochi so > tied to lists, haha. But I'll give this a look. > > Tristan > > > On Mon, Dec 19, 2011 at 1:50 PM, Magnus Klaar > > __>> wrote: > > Hi! > > Cowboy currently includes an experimental webmachine-like > interface. The first commit of this module should > explain some > of the key differences from webmachine. If i remember the > history of this module the intial estimate for the time > needed > to decouple webmachine from mochiweb _and_ refactor > webmachine > to support both binaries and lists everywhere was > greater than > the time needed to just add the difference between the > two to > cowboy. > > https://github.com/extend/__cowboy/commit/__aab1587a4b3d8f0c3d92a208322752__7d51109980 > > > If you're interested in a > > MVH Magnus > > On Mon, Dec 19, 2011 at 6:40 PM, Tristan Sloughter > > >> wrote: > > This may be better on a Webmachine questions list. But I > thought I'd ask here first since it may be that someone > working on one of the other Erlang web servers, besides > Mochiweb, has worked on moving Webmachine to use > that server. > > The reason I say that is, Webmachine currently relies on > Mochiweb which passes lists instead of binary > strings for > requests. While the req_body of a request is given as a > binary the path_info and query string is dealt with as > lists. While I would think there could be a > performance hit > due to this my main reason to ask for alternatives > is that > dealing with JSON representations on the backend require > converting the lists to binaries for processing > every time. > > There has been > https://github.com/mochi/__mochiweb/pull/38 > but > its clear at the end of the discussion its not a > change that > will be happening to mochiweb anytime soon. > > So is there work on Webmachine backed by Cowboy or > another > Erlang web server? > > Thanks, > Tristan > > _________________________________________________ > 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 > > > > > -- > Lo?c Hoguin > Dev:Extend > > -- Lo?c Hoguin Dev:Extend From rexxe98@REDACTED Mon Dec 19 22:57:15 2011 From: rexxe98@REDACTED (Andrew Berman) Date: Mon, 19 Dec 2011 13:57:15 -0800 Subject: [erlang-questions] Webmachine Binary Request Strings In-Reply-To: <4EEFAF16.2040201@dev-extend.eu> References: <4EEFAC31.80404@dev-extend.eu> <4EEFAF16.2040201@dev-extend.eu> Message-ID: A bit off topic, but have you ever considered adding support for something like Socket.IO (adding a TCP handler to support their JavaScript)? I think it's going to be a while before WebSockets is going to be able to be used across the web and I think Socket.IO is a great bridge until that time comes. On Mon, Dec 19, 2011 at 1:39 PM, Lo?c Hoguin wrote: > You can check out my implementation here for Cowboy: > https://github.com/extend/**cowboy/blob/master/src/cowboy_**http_rest.erl > > Clean straightforward code was one of the big goals of this work. It has > few differences with Webmachine, but people have been converting resources > from Webmachine to Cowboy without much pain. And Cowboy already had a > dispatcher so it was really just a matter of writing the decision code. > > Of course I'm open to any comment you may have about it, good or bad. > > > On 12/19/2011 10:34 PM, Andrew Berman wrote: > >> Ah, yes, I agree we would need a SimpleBridgeBinary and then go the >> opposite way if a web server doesn't support binary (binary_to_list). I >> don't think that would be too difficult to implement. The Webmachine >> decision core is the more difficult part but not too difficult as it >> has been implemented in many other languages which might make the >> decisioning a bit easier to follow. >> >> On Mon, Dec 19, 2011 at 1:27 PM, Lo?c Hoguin > > wrote: >> >> SimpleBridge is nice, but it doesn't solve the OP's issue, which is >> that all the lists are being converted to binary when encoding into >> JSON, so he wants a binary webmachine to avoid converting from lists >> to binary all the time. I believe the implementation added to Cowboy >> recently does what the OP needs. On the other hand it's definitely >> tied to Cowboy and that should be taken into consideration when >> deciding what to use. It's also still considered experimental, >> although I've had good reports so far. >> >> Now if there was a SimpleBinaryBridge project it could be more >> suitable for his purpose, but afaik only Cowboy is full binary so >> far (only accepting (io)lists as output data). And of course adding >> Cowboy to SimpleBridge would just be a binary_to_list fest and would >> remove half the advantages of using that server so it's a bit of a >> dead end there. >> >> >> On 12/19/2011 10:16 PM, Andrew Berman wrote: >> >> There was talk on one of the mailing lists about using something >> like >> SimpleBridge (https://github.com/nitrogen/_**_simple_bridge >> >) >> so that the use >> >> of a web server could be independent of Webmachine's logic, >> which IMO is >> the best solution. I don't think anyone did anything about it, >> but for >> some reason, SimpleBridge has Webmachine support, which doesn't >> make >> sense logically to me since Webmachine is a toolkit and not a >> web server. >> >> I use Webmachine and love what it does for me, but the code >> seems overly >> complicated with a heavy reliance on Mochiweb and uses >> parameterized >> modules (an unsupported feature of Erlang), so I would actually >> be more >> inclined to start a new project which is influenced by >> Webmachine but >> corrects all the issues with it and makes it a bit more flexible >> and >> modern (would love for Webmachine to support PATCH for example and >> something like Socket.IO). I'd be happy to help out with such a >> project >> if anyone is interested in starting one. >> >> --Andrew >> >> On Mon, Dec 19, 2011 at 12:24 PM, Tristan Sloughter >> > >> > >> >> >> >>> >> wrote: >> >> Interesting. Sucks that webmachine is so tied to mochi and >> mochi so >> tied to lists, haha. But I'll give this a look. >> >> Tristan >> >> >> On Mon, Dec 19, 2011 at 1:50 PM, Magnus Klaar >> >> > >> __>> wrote: >> >> Hi! >> >> Cowboy currently includes an experimental webmachine-like >> interface. The first commit of this module should >> explain some >> of the key differences from webmachine. If i remember the >> history of this module the intial estimate for the time >> needed >> to decouple webmachine from mochiweb _and_ refactor >> webmachine >> to support both binaries and lists everywhere was >> greater than >> the time needed to just add the difference between the >> two to >> cowboy. >> >> https://github.com/extend/__**cowboy/commit/__** >> aab1587a4b3d8f0c3d92a208322752**__7d51109980 >> >> > aab1587a4b3d8f0c3d92a208322752**7d51109980 >> > >> >> If you're interested in a >> >> MVH Magnus >> >> On Mon, Dec 19, 2011 at 6:40 PM, Tristan Sloughter >> >> > >> >> >> >>> >> wrote: >> >> This may be better on a Webmachine questions list. But >> I >> thought I'd ask here first since it may be that someone >> working on one of the other Erlang web servers, besides >> Mochiweb, has worked on moving Webmachine to use >> that server. >> >> The reason I say that is, Webmachine currently relies >> on >> Mochiweb which passes lists instead of binary >> strings for >> requests. While the req_body of a request is given as a >> binary the path_info and query string is dealt with as >> lists. While I would think there could be a >> performance hit >> due to this my main reason to ask for alternatives >> is that >> dealing with JSON representations on the backend >> require >> converting the lists to binaries for processing >> every time. >> >> There has been >> https://github.com/mochi/__**mochiweb/pull/38 >> >> > >> but >> its clear at the end of the discussion its not a >> change that >> will be happening to mochiweb anytime soon. >> >> So is there work on Webmachine backed by Cowboy or >> another >> Erlang web server? >> >> Thanks, >> Tristan >> >> ______________________________**___________________ >> >> 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 >> >> >> > >> >> >> >> -- >> Lo?c Hoguin >> Dev:Extend >> >> >> > > -- > Lo?c Hoguin > Dev:Extend > -------------- next part -------------- An HTML attachment was scrubbed... URL: From essen@REDACTED Mon Dec 19 23:02:46 2011 From: essen@REDACTED (=?UTF-8?B?TG/Dr2MgSG9ndWlu?=) Date: Mon, 19 Dec 2011 23:02:46 +0100 Subject: [erlang-questions] Webmachine Binary Request Strings In-Reply-To: References: <4EEFAC31.80404@dev-extend.eu> <4EEFAF16.2040201@dev-extend.eu> Message-ID: <4EEFB486.1020205@dev-extend.eu> Working on this: https://github.com/extend/bullet Needs more work on the JS side (perhaps taking from socket.io-like projects later on) and documentation, but it works pretty well and is in production already. It's a bit different as it builds something upon websocket's design, it's more of an "always connected" websocket. On 12/19/2011 10:57 PM, Andrew Berman wrote: > A bit off topic, but have you ever considered adding support for > something like Socket.IO (adding a TCP handler to support their > JavaScript)? I think it's going to be a while before WebSockets is > going to be able to be used across the web and I think Socket.IO is a > great bridge until that time comes. > > On Mon, Dec 19, 2011 at 1:39 PM, Lo?c Hoguin > wrote: > > You can check out my implementation here for Cowboy: > https://github.com/extend/__cowboy/blob/master/src/cowboy___http_rest.erl > > > Clean straightforward code was one of the big goals of this work. It > has few differences with Webmachine, but people have been converting > resources from Webmachine to Cowboy without much pain. And Cowboy > already had a dispatcher so it was really just a matter of writing > the decision code. > > Of course I'm open to any comment you may have about it, good or bad. > > > On 12/19/2011 10:34 PM, Andrew Berman wrote: > > Ah, yes, I agree we would need a SimpleBridgeBinary and then go the > opposite way if a web server doesn't support binary > (binary_to_list). I > don't think that would be too difficult to implement. The > Webmachine > decision core is the more difficult part but not too difficult > as it > has been implemented in many other languages which might make the > decisioning a bit easier to follow. > > On Mon, Dec 19, 2011 at 1:27 PM, Lo?c Hoguin > > >> wrote: > > SimpleBridge is nice, but it doesn't solve the OP's issue, > which is > that all the lists are being converted to binary when > encoding into > JSON, so he wants a binary webmachine to avoid converting > from lists > to binary all the time. I believe the implementation added > to Cowboy > recently does what the OP needs. On the other hand it's > definitely > tied to Cowboy and that should be taken into consideration when > deciding what to use. It's also still considered experimental, > although I've had good reports so far. > > Now if there was a SimpleBinaryBridge project it could be more > suitable for his purpose, but afaik only Cowboy is full > binary so > far (only accepting (io)lists as output data). And of course > adding > Cowboy to SimpleBridge would just be a binary_to_list fest > and would > remove half the advantages of using that server so it's a > bit of a > dead end there. > > > On 12/19/2011 10:16 PM, Andrew Berman wrote: > > There was talk on one of the mailing lists about using > something > like > SimpleBridge > (https://github.com/nitrogen/____simple_bridge > > >) so that the use > > of a web server could be independent of Webmachine's logic, > which IMO is > the best solution. I don't think anyone did anything > about it, > but for > some reason, SimpleBridge has Webmachine support, which > doesn't make > sense logically to me since Webmachine is a toolkit and > not a > web server. > > I use Webmachine and love what it does for me, but the code > seems overly > complicated with a heavy reliance on Mochiweb and uses > parameterized > modules (an unsupported feature of Erlang), so I would > actually > be more > inclined to start a new project which is influenced by > Webmachine but > corrects all the issues with it and makes it a bit more > flexible and > modern (would love for Webmachine to support PATCH for > example and > something like Socket.IO). I'd be happy to help out > with such a > project > if anyone is interested in starting one. > > --Andrew > > On Mon, Dec 19, 2011 at 12:24 PM, Tristan Sloughter > > > > __gm__ail.com > > >>> wrote: > > Interesting. Sucks that webmachine is so tied to > mochi and > mochi so > tied to lists, haha. But I'll give this a look. > > Tristan > > > On Mon, Dec 19, 2011 at 1:50 PM, Magnus Klaar > > __> > > > __>__>> wrote: > > Hi! > > Cowboy currently includes an experimental > webmachine-like > interface. The first commit of this module should > explain some > of the key differences from webmachine. If i > remember the > history of this module the intial estimate for > the time > needed > to decouple webmachine from mochiweb _and_ refactor > webmachine > to support both binaries and lists everywhere was > greater than > the time needed to just add the difference > between the > two to > cowboy. > > https://github.com/extend/____cowboy/commit/____aab1587a4b3d8f0c3d92a208322752____7d51109980 > > > > > > If you're interested in a > > MVH Magnus > > On Mon, Dec 19, 2011 at 6:40 PM, Tristan Sloughter > > > > __gm__ail.com > > >>> wrote: > > This may be better on a Webmachine questions > list. But I > thought I'd ask here first since it may be > that someone > working on one of the other Erlang web > servers, besides > Mochiweb, has worked on moving Webmachine to use > that server. > > The reason I say that is, Webmachine > currently relies on > Mochiweb which passes lists instead of binary > strings for > requests. While the req_body of a request is > given as a > binary the path_info and query string is > dealt with as > lists. While I would think there could be a > performance hit > due to this my main reason to ask for > alternatives > is that > dealing with JSON representations on the > backend require > converting the lists to binaries for processing > every time. > > There has been > https://github.com/mochi/____mochiweb/pull/38 > > > > but > its clear at the end of the discussion its not a > change that > will be happening to mochiweb anytime soon. > > So is there work on Webmachine backed by > Cowboy or > another > Erlang web server? > > Thanks, > Tristan > > > ___________________________________________________ > > erlang-questions mailing list > erlang-questions@REDACTED > > > __erl__ang.org > >> > > http://erlang.org/mailman/____listinfo/erlang-questions > > > > > > > > ___________________________________________________ > > erlang-questions mailing list > erlang-questions@REDACTED > > > __erl__ang.org > >> > > http://erlang.org/mailman/____listinfo/erlang-questions > > > > > > > > ___________________________________________________ > > erlang-questions mailing list > erlang-questions@REDACTED > > > http://erlang.org/mailman/____listinfo/erlang-questions > > > > > > > > -- > Lo?c Hoguin > Dev:Extend > > > > > -- > Lo?c Hoguin > Dev:Extend > > -- Lo?c Hoguin Dev:Extend From rexxe98@REDACTED Mon Dec 19 23:05:23 2011 From: rexxe98@REDACTED (Andrew Berman) Date: Mon, 19 Dec 2011 14:05:23 -0800 Subject: [erlang-questions] Webmachine Binary Request Strings In-Reply-To: <4EEFB486.1020205@dev-extend.eu> References: <4EEFAC31.80404@dev-extend.eu> <4EEFAF16.2040201@dev-extend.eu> <4EEFB486.1020205@dev-extend.eu> Message-ID: Awesome! On Mon, Dec 19, 2011 at 2:02 PM, Lo?c Hoguin wrote: > Working on this: > https://github.com/extend/**bullet > > Needs more work on the JS side (perhaps taking from socket.io-like > projects later on) and documentation, but it works pretty well and is in > production already. > > It's a bit different as it builds something upon websocket's design, it's > more of an "always connected" websocket. > > > On 12/19/2011 10:57 PM, Andrew Berman wrote: > >> A bit off topic, but have you ever considered adding support for >> something like Socket.IO (adding a TCP handler to support their >> JavaScript)? I think it's going to be a while before WebSockets is >> going to be able to be used across the web and I think Socket.IO is a >> great bridge until that time comes. >> >> On Mon, Dec 19, 2011 at 1:39 PM, Lo?c Hoguin > > wrote: >> >> You can check out my implementation here for Cowboy: >> https://github.com/extend/__**cowboy/blob/master/src/cowboy_** >> __http_rest.erl >> >> > http_rest.erl >> > >> >> Clean straightforward code was one of the big goals of this work. It >> has few differences with Webmachine, but people have been converting >> resources from Webmachine to Cowboy without much pain. And Cowboy >> already had a dispatcher so it was really just a matter of writing >> the decision code. >> >> Of course I'm open to any comment you may have about it, good or bad. >> >> >> On 12/19/2011 10:34 PM, Andrew Berman wrote: >> >> Ah, yes, I agree we would need a SimpleBridgeBinary and then go the >> opposite way if a web server doesn't support binary >> (binary_to_list). I >> don't think that would be too difficult to implement. The >> Webmachine >> decision core is the more difficult part but not too difficult >> as it >> has been implemented in many other languages which might make the >> decisioning a bit easier to follow. >> >> On Mon, Dec 19, 2011 at 1:27 PM, Lo?c Hoguin >> >> >> wrote: >> >> SimpleBridge is nice, but it doesn't solve the OP's issue, >> which is >> that all the lists are being converted to binary when >> encoding into >> JSON, so he wants a binary webmachine to avoid converting >> from lists >> to binary all the time. I believe the implementation added >> to Cowboy >> recently does what the OP needs. On the other hand it's >> definitely >> tied to Cowboy and that should be taken into consideration when >> deciding what to use. It's also still considered experimental, >> although I've had good reports so far. >> >> Now if there was a SimpleBinaryBridge project it could be more >> suitable for his purpose, but afaik only Cowboy is full >> binary so >> far (only accepting (io)lists as output data). And of course >> adding >> Cowboy to SimpleBridge would just be a binary_to_list fest >> and would >> remove half the advantages of using that server so it's a >> bit of a >> dead end there. >> >> >> On 12/19/2011 10:16 PM, Andrew Berman wrote: >> >> There was talk on one of the mailing lists about using >> something >> like >> SimpleBridge >> (https://github.com/nitrogen/_**___simple_bridge >> >> > >> >> >> >>) >> so that the use >> >> of a web server could be independent of Webmachine's logic, >> which IMO is >> the best solution. I don't think anyone did anything >> about it, >> but for >> some reason, SimpleBridge has Webmachine support, which >> doesn't make >> sense logically to me since Webmachine is a toolkit and >> not a >> web server. >> >> I use Webmachine and love what it does for me, but the code >> seems overly >> complicated with a heavy reliance on Mochiweb and uses >> parameterized >> modules (an unsupported feature of Erlang), so I would >> actually >> be more >> inclined to start a new project which is influenced by >> Webmachine but >> corrects all the issues with it and makes it a bit more >> flexible and >> modern (would love for Webmachine to support PATCH for >> example and >> something like Socket.IO). I'd be happy to help out >> with such a >> project >> if anyone is interested in starting one. >> >> --Andrew >> >> On Mon, Dec 19, 2011 at 12:24 PM, Tristan Sloughter >> >> > >> >> >> >> >> > __g**m__ail.com < >> http://gmail.com> >> >> >> >> >>>> >> wrote: >> >> Interesting. Sucks that webmachine is so tied to >> mochi and >> mochi so >> tied to lists, haha. But I'll give this a look. >> >> Tristan >> >> >> On Mon, Dec 19, 2011 at 1:50 PM, Magnus Klaar >> >> > >__> >> >> >> > __>__>> wrote: >> >> Hi! >> >> Cowboy currently includes an experimental >> webmachine-like >> interface. The first commit of this module should >> explain some >> of the key differences from webmachine. If i >> remember the >> history of this module the intial estimate for >> the time >> needed >> to decouple webmachine from mochiweb _and_ refactor >> webmachine >> to support both binaries and lists everywhere was >> greater than >> the time needed to just add the difference >> between the >> two to >> cowboy. >> >> https://github.com/extend/____**cowboy/commit/____** >> aab1587a4b3d8f0c3d92a208322752**____7d51109980 >> > aab1587a4b3d8f0c3d92a208322752**__7d51109980 >> > >> >> >> > aab1587a4b3d8f0c3d92a208322752**__7d51109980 >> > aab1587a4b3d8f0c3d92a208322752**7d51109980 >> >> >> >> If you're interested in a >> >> MVH Magnus >> >> On Mon, Dec 19, 2011 at 6:40 PM, Tristan Sloughter >> > >> > >> >> >> >> >> > __g**m__ail.com < >> http://gmail.com> >> >> >> >> >>>> >> wrote: >> >> This may be better on a Webmachine questions >> list. But I >> thought I'd ask here first since it may be >> that someone >> working on one of the other Erlang web >> servers, besides >> Mochiweb, has worked on moving Webmachine to >> use >> that server. >> >> The reason I say that is, Webmachine >> currently relies on >> Mochiweb which passes lists instead of binary >> strings for >> requests. While the req_body of a request is >> given as a >> binary the path_info and query string is >> dealt with as >> lists. While I would think there could be a >> performance hit >> due to this my main reason to ask for >> alternatives >> is that >> dealing with JSON representations on the >> backend require >> converting the lists to binaries for processing >> every time. >> >> There has been >> https://github.com/mochi/____**mochiweb/pull/38 >> >> > >> >> >> >> >> >> but >> its clear at the end of the discussion its not >> a >> change that >> will be happening to mochiweb anytime soon. >> >> So is there work on Webmachine backed by >> Cowboy or >> another >> Erlang web server? >> >> Thanks, >> Tristan >> >> >> ______________________________**_____________________ >> >> >> erlang-questions mailing list >> erlang-questions@REDACTED >> > >> >> >> >> >> > __er**l__ang.org < >> http://erlang.org> >> >> >> >>> >> >> http://erlang.org/mailman/____**listinfo/erlang-questions >> >> > >> >> >> >> >> >> >> >> >> ______________________________**_____________________ >> >> >> erlang-questions mailing list >> erlang-questions@REDACTED >> > >> >> >> >> >> > __er**l__ang.org < >> http://erlang.org> >> >> >> >>> >> >> http://erlang.org/mailman/____**listinfo/erlang-questions >> >> > >> >> >> >> >> >> >> >> >> ______________________________**_____________________ >> >> >> erlang-questions mailing list >> erlang-questions@REDACTED >> > >> >> >> >> >> http://erlang.org/mailman/____**listinfo/erlang-questions >> >> > >> >> >> >> >> >> >> >> >> >> -- >> Lo?c Hoguin >> Dev:Extend >> >> >> >> >> -- >> Lo?c Hoguin >> Dev:Extend >> >> >> > > -- > Lo?c Hoguin > Dev:Extend > -------------- next part -------------- An HTML attachment was scrubbed... URL: From steven.charles.davis@REDACTED Tue Dec 20 00:58:04 2011 From: steven.charles.davis@REDACTED (Steve Davis) Date: Mon, 19 Dec 2011 15:58:04 -0800 (PST) Subject: [erlang-questions] Webmachine Binary Request Strings In-Reply-To: References: Message-ID: <84642f8f-fb58-4ca3-9afa-d51cd3e1e73e@h13g2000vbn.googlegroups.com> It's long been a tenet of mine that the underlying issue here is with the representation of "strings" in the platform. Using a text representation of binaries would save a considerable amount of pain across the platform and for the applications written over it. Erlang/ OTP (IMHO) should let go of the "a string is just a list of integers" and go for a consistent api support of text as binaries. Many words and hours would be saved if this were to happen. It would also be easy to shed the "erlang is crap at strings" meme that is a result of the current decision and api approach I do not think that this criticism is one based on the platform's true capability when text is presented and manipulated as binaries. In fact, it can and should be viewed as a strength. /s On Dec 19, 2:24?pm, Tristan Sloughter wrote: > Interesting. Sucks that webmachine is so tied to mochi and mochi so tied to > lists, haha. But I'll give this a look. > > Tristan > > On Mon, Dec 19, 2011 at 1:50 PM, Magnus Klaar wrote: > > > > > > > > > Hi! > > > Cowboy currently includes an experimental webmachine-like interface. The > > first commit of this module should explain some of the key differences from > > webmachine. If i remember the history of this module the intial estimate > > for the time needed to decouple webmachine from mochiweb _and_ refactor > > webmachine to support both binaries and lists everywhere was greater than > > the time needed to just add the difference between the two to cowboy. > > >https://github.com/extend/cowboy/commit/aab1587a4b3d8f0c3d92a20832275... > > > If you're interested in a > > > MVH Magnus > > > On Mon, Dec 19, 2011 at 6:40 PM, Tristan Sloughter < > > tristan.slough...@REDACTED> wrote: > > >> This may be better on a Webmachine questions list. But I thought I'd ask > >> here first since it may be that someone working on one of the other Erlang > >> web servers, besides Mochiweb, has worked on moving Webmachine to use that > >> server. > > >> The reason I say that is, Webmachine currently relies on Mochiweb which > >> passes lists instead of binary strings for requests. While the req_body of > >> a request is given as a binary the path_info and query string is dealt with > >> as lists. While I would think there could be a performance hit due to this > >> my main reason to ask for alternatives is that dealing with JSON > >> representations on the backend require converting the lists to binaries for > >> processing every time. > > >> There has beenhttps://github.com/mochi/mochiweb/pull/38but its clear > >> at the end of the discussion its not a change that will be happening to > >> mochiweb anytime soon. > > >> So is there work on Webmachine backed by Cowboy or another Erlang web > >> server? > > >> Thanks, > >> Tristan > > >> _______________________________________________ > >> erlang-questions mailing list > >> erlang-questi...@REDACTED > >>http://erlang.org/mailman/listinfo/erlang-questions > > > > _______________________________________________ > erlang-questions mailing list > erlang-questi...@REDACTED://erlang.org/mailman/listinfo/erlang-questions From steven.charles.davis@REDACTED Tue Dec 20 01:39:50 2011 From: steven.charles.davis@REDACTED (Steve Davis) Date: Mon, 19 Dec 2011 16:39:50 -0800 (PST) Subject: [erlang-questions] Erlang wallpaper In-Reply-To: <4EEF52DB.7010407@erlang-solutions.com> References: <20111219051423.GL298@aluminum.motivity.ca> <4EEF52DB.7010407@erlang-solutions.com> Message-ID: <5330d7d7-116c-4c43-b81d-871e43a9ff1b@p16g2000yqd.googlegroups.com> See png image, and notes with a suggestion at: https://github.com/komone/logo ... a thought :) /s On Dec 19, 9:06?am, Jesper Louis Andersen wrote: > On 12/19/11 3:22 PM, Yves S. Garret wrote: > > > I have to disagree as well. ?The current logo is just peachy for me. > > ?If there is a contest just to see what comes up, fine, but I think > > the current one still looks pretty chic. > > Good logos are timeless. > Good logos look good when printed in color and in black&white. > > Look at the logo of Google for instance: They change the logo slightly > so it looks "modern" but the basic outline and style is still the same. > Take a look at > > http://www.instantshift.com/2009/01/29/20-corporate-brand-logo-evolut... > > for an example of how to do this correctly over time. > > -- > Jesper Louis Andersen > ? ?Erlang Solutions, DK > > _______________________________________________ > erlang-questions mailing list > erlang-questi...@REDACTED://erlang.org/mailman/listinfo/erlang-questions From garret.smith@REDACTED Tue Dec 20 01:56:02 2011 From: garret.smith@REDACTED (Garret Smith) Date: Mon, 19 Dec 2011 16:56:02 -0800 Subject: [erlang-questions] Automated testing of a distributed application Message-ID: I just finished setting up an automated test suite for my distributed application using the common_test "Large Scale Testing" support. It was rough, but *almost* works. It starts up 2 local nodes, starts my app on both nodes, runs a few test cases from my suite on node1, a second batch of cases on node2, then yet another batch of cases on node1. The test cases are designed to work by contacting the distributed app on node1, modifying it's state through the API, then contacting the app on node2 to verify that the state changes are reflected there, then repeating from the perspective of node2. sample test spec, invoked with ct_master:run/1 {logdir, "../logs"}. {alias, testdir, "."}. {init, [n1, n2], {node_start, [{erl_flags, "-pa ../../ebin"}, {monitor_master, true}]}}. {merge_tests, false}. {cases, n1, testdir, distributed_SUITE, [create_table, insert_1]}. {cases, n2, testdir, distributed_SUITE, [read_1, update_2]}. {cases, n1, testdir, distributed_SUITE, [read_2]}. Now that my basic setup using ct_master is working, I notice that sometimes the tests fail because I cannot depend on the batches being executed in sequence. ct_master executes the test cases in parallel on the two nodes. I could continue down this path by adding synchronization somehow, but I feel that I am not really using ct_master in the way it was intended. Has anyone on the list had experience writing an automated test suite where the SUT is a single app running on a cluster of nodes? Were you able to do this with common_test, or did you end up rolling your own framework? Thanks! -Garret Smith -------------- next part -------------- An HTML attachment was scrubbed... URL: From liudanyun@REDACTED Tue Dec 20 03:21:57 2011 From: liudanyun@REDACTED (DanYun Liu) Date: Tue, 20 Dec 2011 10:21:57 +0800 Subject: [erlang-questions] Proposal for new Q&A site in Stack Exchange In-Reply-To: References: Message-ID: I think a public site will involve more people to CDP, but not only "erlang man". On Tue, Dec 20, 2011 at 12:30 AM, Wes James wrote: > Is it an advantage or disadvantage to have more places to post > questions? If it goes there, then people here won't see it (at least > immediately). I'd rather people come to this list and post their > questions so they can be seen first hand. If questions are put on > this proposed site or say stackoverflow, they may not be seen for some > time until someone does a search that makes a hit on that question and > then decides to answer. That's not saying questions won't go > unanswered on this list either. > > me dos centavos > > -wes > > On Mon, Dec 19, 2011 at 8:29 AM, Ubermensch > wrote: > > Hi friends, > > I have proposed a Q&A site for Concurrent, Distributed and Parallel > > programming in Stack Exchange. > > Proposed site > > > > > > I believe this would benefit all new and experienced users to this > paradigm > > in general and Erlang in particular. Require support to put the site in > beta > > > > -- > > Ubermensch > > > > > > _______________________________________________ > > 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 > -- Pursuit the freedom of the soul. -------------- next part -------------- An HTML attachment was scrubbed... URL: From Tobias.Schlager@REDACTED Tue Dec 20 08:56:59 2011 From: Tobias.Schlager@REDACTED (Tobias Schlager) Date: Tue, 20 Dec 2011 07:56:59 +0000 Subject: [erlang-questions] erlang package manager In-Reply-To: References: <0187e794-3de5-4e66-aa89-c613931e6fe3@u5g2000vbd.googlegroups.com> <12F2115FD1CCEE4294943B2608A18FA3E4D443@MAIL01.win.lbaum.eu>, Message-ID: <12F2115FD1CCEE4294943B2608A18FA3E4E56A@MAIL01.win.lbaum.eu> Hi, I have to admit that the maven-erlang-plugin is - by far - not as feature-rich as rebar, but it has everything you need to build/package standard application and release projects. Regarding your questions: >do you know if there is an archetype for generating the initial project structure and whether or not the plugin understands the concept of releases? There's no archetype for new projects. I'm not a big fan of archetypes since I always end up fixing the generated pom by hand. Project setup is done with a 'setup' goal. So writing a minimal pom is the way to start. A minimal pom is listed on the plugin website. Simply place the edited pom in an empty directory and call 'mvn erlang:setup'. Yes, the plugin can also handle erlang releases. The plugin knows three different project types (aka packagingType). erlang-std projects packages erlang applications using the standard erlang directory layout recommended at the erlang website. The packaging type erlang-otp packages erlang applications using the standard maven directory layout. Finally, erlang-rel projects will package erlang releases (release_handler compatible .tar.gz archives). While application projects actually contain code and other appication data, the erlang-rel project only contains the erlang .rel file, the sys.config and the release relup file. The needed application code will be pulled from the repository and the building erlang (backend) node. appup and relup files can also be generated using the released projects available at the repository. There's lots of documentation on the website, as well as some workflow examples. The 'erlang:run' and 'erlang:upload' goals really come in handy, we use them a lot during development. Tobias Von: Tim Watson [watson.timothy@REDACTED] Gesendet: Montag, 19. Dezember 2011 11:48 Bis: Tobias Schlager Cc: eigenfunction; erlang-questions@REDACTED Betreff: Re: [erlang-questions] erlang package manager On 19 December 2011 08:18, Tobias Schlager wrote: Hi, if your looking for package management and you're already familiar with apache maven the maven-erlang-plugin could be useful. Especially if you already have a continuous integration infrastructure you want to reuse. * http://erlang-plugin.sourceforge.net/ Tobias Ooh yes, I forgot about that one. It actually looks very feature complete, though of course one has to get used to writing poms (or build a parent pom to inherit from). Tobias, do you know if there is an archetype for generating the initial project structure and whether or not the plugin understands the concept of releases? We use maven heavily for Java/Scala at work and although we use rebar to build erlang code, we package stuff up according to maven principles and deploy into a maven repo (actually using Sonatype's Nexus artefact repository). This works very well despite multiple build systems in the mix and automated deployments are relatively easy when you've got a binary artefact repository to pull from. From prof3ta@REDACTED Tue Dec 20 09:29:57 2011 From: prof3ta@REDACTED (Roberto Aloi) Date: Tue, 20 Dec 2011 09:29:57 +0100 Subject: [erlang-questions] Proposal for new Q&A site in Stack Exchange In-Reply-To: References: Message-ID: Hi, The purpose of a Q&A website is different from the one of a mailing list. I believe the two means are actually complementary. If you have a practical, answerable, question which can have a definite answer, you should prefer a Q&A website, where finding solutions is easier and answers are more concise and straight to the point. If your question is subjective or vague, a proposal for a new project, or it regards the organization of an event, then a mailing list is probably your place. The real problem here is if a *new* Q&A website is needed. You could simply subscribe to the "erlang", "functional-programming" and similar tags on Stack Overflow and reach the same objective that you're trying to achieve. I myself created a proposal for an Erlang Q&A long time ago, which died silently, marked as a duplicate of Stack Overflow. In retrospection, whoever voted the proposal as a duplicate, was probably right. My 2p to the discussion. Cheers, Roberto From uberdeveloper001@REDACTED Tue Dec 20 10:27:12 2011 From: uberdeveloper001@REDACTED (uberdeveloper) Date: Tue, 20 Dec 2011 01:27:12 -0800 (PST) Subject: [erlang-questions] Proposal for new Q&A site in Stack Exchange In-Reply-To: References: Message-ID: Three things to be noted by friend 1) I believe more than the language its the mindset of the developer that needs to be changed to try concurrent programming. If I am programming in Erlang, I am definitely going to post my questions here but what if I want to program concurrently but don't know what to do(I can still post here but I think Q&A is better) 2) Multi-core architecture is hitting the peak but still most of the applications don't use even 4 cores (forget nodes). I also researched a few computer courses offered in colleges(not an extensive research) and found Distributed, Parallel computing isn't thought critically. So I believe a Q&A site would bring more awareness and increased user- base 3) Finally the important part of your question. Psychologically, developers tend to get berserk when we talk about the benefits of a particular language, operating system or even a text editor and it starts a whole series of language wars. And also I believe though Erlang is not the right fit for traditional heavy-weight applications such as number-crunching, signal processing but would be great for message exchange. To put more clearly, Erlang's distributed abilities would be better used in a MapReduce situation that could gel well with existing applications (which most of the developers tend to disagree with). The entire gamut of multi-processing may be entrusted to Erlang while the logic may reside with each developer's programming language of choice(this needs a debate, would post as a discussion today in SE). Already questions tagged with erlang in Stack Overflow is just around a 1% and many developers think it as just an another language. Also, we adopted Erlang because we wanted to program concurrently and not because we know Erlang, we started program concurrently (that's how I feel). So the need for the hour is to develop CDP programming and Erlang would play a major part in it (That's why I put my first post here) And for your previous proposal, this may also fail. But a quote to remember To win, all you need to do is get up one more time than you fall down. Thanks to all for taking the time to write and also request to post sample questions in the new Q&A site On Dec 20, 1:29?pm, Roberto Aloi wrote: > Hi, > > The purpose of a Q&A website is different from the one of a mailing > list. I believe the two means are actually complementary. > > If you have a practical, answerable, question which can have a > definite answer, you should prefer a Q&A website, where finding > solutions is easier and ?answers are more concise and straight to the > point. > > If your question is subjective or vague, a proposal for a new project, > or it regards the organization of an event, then a mailing list is > probably your place. > > The real problem here is if a *new* Q&A website is needed. You could > simply subscribe to the "erlang", "functional-programming" and similar > tags on Stack Overflow and reach the same objective that you're trying > to achieve. I myself created a proposal for an Erlang Q&A long time > ago, which died silently, marked as a duplicate of Stack Overflow. In > retrospection, whoever voted the proposal as a duplicate, was probably > right. > > My 2p to the discussion. > > Cheers, > > Roberto > _______________________________________________ > erlang-questions mailing list > erlang-questi...@REDACTED://erlang.org/mailman/listinfo/erlang-questions From mabrek@REDACTED Tue Dec 20 10:27:18 2011 From: mabrek@REDACTED (mabrek) Date: Tue, 20 Dec 2011 13:27:18 +0400 Subject: [erlang-questions] best ways to discover jinterface mailbox from erlang? Message-ID: Hello. We have one application written in Java and need call it's methods from Erlang. We use global to discover erlang services but jinterface mailbox can't be registered in such way. Gproc doesn't seem to work with jinterface either. It looks like it's possible to register jinterface mailbox via pg2, haven't tried it yet. What is the best way to make jinterface mailbox discoverable from erlang? Regards, Anton Lebedevich. From gleber.p@REDACTED Tue Dec 20 10:27:35 2011 From: gleber.p@REDACTED (Gleb Peregud) Date: Tue, 20 Dec 2011 10:27:35 +0100 Subject: [erlang-questions] SQL Relay bindings Message-ID: Hello everyone Has anyone seen or worked on bindings for SQL Relay[1]? It seems to be a pretty nice project, which may solve few problems for users who need access to different RDBMS in one project. There's a basic Erlang "binding" using port (with communication over stdin/stdout), but I believe it is very simple and it's speed may not be very good. Best, Gleb Peregud 1: http://sqlrelay.sourceforge.net/ From carlsson.richard@REDACTED Tue Dec 20 13:00:01 2011 From: carlsson.richard@REDACTED (Richard Carlsson) Date: Tue, 20 Dec 2011 13:00:01 +0100 Subject: [erlang-questions] source file encoding In-Reply-To: References: Message-ID: <4EF078C1.9090105@gmail.com> On 12/19/2011 11:18 AM, Justus wrote: > Hi all, > > Strings must be in the ISO-latin-1 character set. I remember that > errors will be reported if other characters occurring in a .erl file > when compiling. > > But when trying R15B, it looks that values beyond ISO-latin-1 are also > accepted. So now, we can use UTF8 without BOM encoding, and with the > help of ct_expand, I managed to say "hello world" in Chinese > literally. > > I wonder is there any plan add Unicode support in string- and > character-literals? > > -compile({parse_transform, ct_expand}). > > -define(STR(S), ct_expand:term(unicode:characters_to_list(list_to_binary(S)))). > > hello_world() -> > S = ?STR("??, ??"), > io:format("~ts~n", [S]). > The code that you wrote is actually the following: S = ?STR("?? ???, ??????"), Even if your editor shows you chinese characters and saves the file as utf-8, Erlang still treats the input as Latin-1. (All byte sequences are valid latin-1, so there is no foolproof way of separating utf-8 files from latin-1 files automatically). To understand where things go can wrong if you start saving source files as utf-8, consider the following two modules: module(m1). ... Pid ! "Micka?l", ... module(m2). ... receive "Micka?l" -> ok end ... Assume that the first is saved with Latin-1 and the second with UTF-8. Even though they may look the same to your eyes (because your editor hides the difference) the code in the second file is really waiting for the following string, and the program will not work: receive "Micka\303\253l" -> ok end /Richard From rtrlists@REDACTED Tue Dec 20 13:02:40 2011 From: rtrlists@REDACTED (Robert Raschke) Date: Tue, 20 Dec 2011 12:02:40 +0000 Subject: [erlang-questions] best ways to discover jinterface mailbox from erlang? In-Reply-To: References: Message-ID: On Tue, Dec 20, 2011 at 9:27 AM, mabrek wrote: > Hello. > > We have one application written in Java and need call it's methods > from Erlang. We use global to discover erlang services but jinterface > mailbox can't be registered in such way. Gproc doesn't seem to work > with jinterface either. It looks like it's possible to register > jinterface mailbox via pg2, haven't tried it yet. > > What is the best way to make jinterface mailbox discoverable from erlang? > > Regards, > Anton Lebedevich. > I don't think there is any way other than explicit information exchange to find the name of a Jinterface Mbox. If you are starting the Java Node from within Erlang, then you could simply pass in the name for your Mbox and use it. Another way would be for the Java Node code to explicitly register the Mbox name using RPC ( http://www.erlang.org/doc/apps/jinterface/jinterface_users_guide.html#id61657) to whatever registration mechanism you're using on the Erlang side. Robby -------------- next part -------------- An HTML attachment was scrubbed... URL: From raviraj555@REDACTED Tue Dec 20 13:29:49 2011 From: raviraj555@REDACTED (raviraj555) Date: Tue, 20 Dec 2011 04:29:49 -0800 (PST) Subject: [erlang-questions] ** exception error: bad argument in function ets:lookup_element/3 Message-ID: Hi All, I m new in Erlang, when i do the mongodb connection it get connected successfully but if run any query inside function i m getting following error hello_ ** exception error: bad argument in function ets:lookup_element/3 called as ets:lookup_element(mongodb_app,oid_machineprocid,2) in call from mongodb_app:gen_objectid/0 in call from mongo:assign_id/1 in call from lists:map/2 in call from mongo:insert_all/2 in call from mongo:insert/2 in call from mongo:do/5 in call from art:run/0 for reference this is my code run() -> application:start(mongodb), {ok, Conn} = mongo:connect({localhost, 27017}), {ok, Docs} = mongo:do (safe, master, Conn, test, fun() -> io:fwrite("hello_"), mongo:delete (foo, {}), mongo:insert (foo, {x,1, y,2}), mongo:find (foo, {x,1}) end), mongo:disconnect (Conn). From mabrek@REDACTED Tue Dec 20 13:38:36 2011 From: mabrek@REDACTED (mabrek) Date: Tue, 20 Dec 2011 16:38:36 +0400 Subject: [erlang-questions] best ways to discover jinterface mailbox from erlang? In-Reply-To: References: Message-ID: On Tue, Dec 20, 2011 at 4:02 PM, Robert Raschke wrote: > On Tue, Dec 20, 2011 at 9:27 AM, mabrek wrote: >> >> We have one application written in Java and need call it's methods >> from Erlang. We use global to discover erlang services but jinterface >> mailbox can't be registered in such way. Gproc doesn't seem to work >> with jinterface either. It looks like it's possible to register >> jinterface mailbox via pg2, haven't tried it yet. >> >> What is the best way to make jinterface mailbox discoverable from erlang? > > I don't think there is any way other than explicit information exchange to > find the name of a Jinterface Mbox. > > If you are starting the Java Node from within Erlang, then you could simply > pass in the name for your Mbox and use it. > > Another way would be for the Java Node code to explicitly register the Mbox > name using RPC > (http://www.erlang.org/doc/apps/jinterface/jinterface_users_guide.html#id61657) > to whatever registration mechanism you're using on the Erlang side. Yes, I'm going to follow this way (register pid of java mbox by rpc to erlang node). The problem is that existing registration solutions that I know don't work with non-erlang nodes. Gproc registers calling process (temporary in case of rpc), global allows only one pid per name (we need several java instances of service), pg2 tries to monitor pid, fails for jinterface. Regards, Anton Lebedevich From lukas@REDACTED Tue Dec 20 13:47:29 2011 From: lukas@REDACTED (Lukas Larsson) Date: Tue, 20 Dec 2011 13:47:29 +0100 Subject: [erlang-questions] Automated testing of a distributed application In-Reply-To: References: Message-ID: Hello! The ct_master module is not really meant to test distributed applications, but rather to distribute your tests. It helps you when you have 1000 tests to run, but can only finish 500 per day and you need to run all of them each day. When testing distributed application with common_test, I use the ct_slave (or just even slave) module and configure slaves to be started on node X and Y and then run test suites on node Z which trigger test behavior either through rpc or SIP och whatever interface you want to test. Serializing test calls and making sure that no test cases interfere with each other I do in the testcase and suite as I would with a non-distributed application. Lukas On Tue, Dec 20, 2011 at 1:56 AM, Garret Smith wrote: > I just finished setting up an automated test suite for my distributed > application using the common_test "Large Scale Testing" support.? It was > rough, but *almost* works.? It starts up 2 local nodes, starts my app on > both nodes, runs a few test cases from my suite on node1, a second batch of > cases on node2, then yet another batch of cases on node1. > > The test cases are designed to work by contacting the distributed app on > node1, modifying it's state through the API, then contacting the app on > node2 to verify that the state changes are reflected there, then repeating > from the perspective of node2. > > sample test spec, invoked with ct_master:run/1 > > {logdir, "../logs"}. > > {alias, testdir, "."}. > > {init, [n1, n2], {node_start, [{erl_flags, "-pa ../../ebin"}, > {monitor_master, true}]}}. > > {merge_tests, false}. > > {cases, n1, testdir, distributed_SUITE, [create_table, insert_1]}. > {cases, n2, testdir, distributed_SUITE, [read_1, update_2]}. > {cases, n1, testdir, distributed_SUITE, [read_2]}. > > > > Now that my basic setup using ct_master is working, I notice that sometimes > the tests fail because I cannot depend on the batches being executed in > sequence.? ct_master executes the test cases in parallel on the two nodes. > I could continue down this path by adding synchronization somehow, but I > feel that I am not really using ct_master in the way it was intended. > > Has anyone on the list had experience writing an automated test suite where > the SUT is a single app running on a cluster of nodes?? Were you able to do > this with common_test, or did you end up rolling your own framework? > > Thanks! > > -Garret Smith > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > From jesper.louis.andersen@REDACTED Tue Dec 20 14:04:29 2011 From: jesper.louis.andersen@REDACTED (Jesper Louis Andersen) Date: Tue, 20 Dec 2011 14:04:29 +0100 Subject: [erlang-questions] ** exception error: bad argument in function ets:lookup_element/3 In-Reply-To: References: Message-ID: <4EF087DD.9040509@erlang-solutions.com> On 12/20/11 1:29 PM, raviraj555 wrote: > Hi All, > I m new in Erlang, when i do the mongodb connection it get connected > successfully but if run any query inside function i m getting > following error > > hello_ > ** exception error: bad argument > in function ets:lookup_element/3 > called as ets:lookup_element(mongodb_app,oid_machineprocid,2) > in call from mongodb_app:gen_objectid/0 > in call from mongo:assign_id/1 > in call from lists:map/2 > in call from mongo:insert_all/2 > in call from mongo:insert/2 > in call from mongo:do/5 > in call from art:run/0 The problem is that ets:lookup_element/3 returns badarg because something you passed to that function is not valid. Most likely, the problem is that there is no 'mongodb_app' ETS table created. My guess is that you need to application:start(mongodb) or something such which will initialize the table correctly. In other words the mongodb application has some initialization assumption which has not been run yet. Hope this helps! -- Jesper Louis Andersen Erlang Solutions Ltd., Copenhagen, DK From malotte@REDACTED Tue Dec 20 14:22:02 2011 From: malotte@REDACTED (=?iso-8859-1?Q?Malotte_Westman_L=F6nne?=) Date: Tue, 20 Dec 2011 14:22:02 +0100 Subject: [erlang-questions] Overloaded function specification and edoc Message-ID: <8337448D-9387-4150-8CC9-B61E5E81CC2F@malotte.net> Hi, When running edoc on an overloaded function specification only the first part shows up in the resulting html-file. Am I doing something wrong or is it a bug? CODE: -spec init(read | write, Pid::pid(), Entry::#app_entry{}, BufSize::integer(), LLevel::integer()) -> {ok, Buf::#co_data_buf{}} | {ok, Mref::reference(), Buf::#co_data_buf{}} | {error, Error::atom()}; (read | write, Dict::term(), Entry::#dict_entry{}, BufSize::integer(), LLevel::integer()) -> {ok, Buf::#co_data_buf{}} | {error, Error::atom()}. EDOC: init/5 init(Access::read | write, Pid::pid(), Entry::#app_entry{}, BufSize::integer(), LLevel::integer()) -> {ok, Buf::#co_data_buf{}} | {ok, Mref::reference(), Buf::#co_data_buf{}} | {error, Error::atom()} Regards, Malotte From joelr1@REDACTED Tue Dec 20 16:31:53 2011 From: joelr1@REDACTED (Joel Reymont) Date: Tue, 20 Dec 2011 15:31:53 +0000 Subject: [erlang-questions] guards when using dialyzer Message-ID: Assuming you are an active user of Dialyzer, do you find yourself using function guards more or less? I'm wondering if it makes sense to lean heavily on guards when Dialyzer will catch possible issues. --- Hardcore embedded Linux development http://www.linkedin.com/in/joelreymont Device drivers, firmware and debugging From yoursurrogategod@REDACTED Tue Dec 20 17:38:52 2011 From: yoursurrogategod@REDACTED (Yves S. Garret) Date: Tue, 20 Dec 2011 11:38:52 -0500 Subject: [erlang-questions] Unit testing Message-ID: Hi all, Recently I started working on unit testing for CakePHP and this got met wondering, what unit testing apps are there for Erlang? I've found these sources: 1. http://www.erlang.org/doc/apps/eunit/chapter.html 2. http://armstrongonsoftware.blogspot.com/2009/01/micro-lightweight-unit-testing.html Anything else? Does anyone know if any Erlang programming books out there cover this topic in some detail? -------------- next part -------------- An HTML attachment was scrubbed... URL: From crusso@REDACTED Tue Dec 20 17:40:50 2011 From: crusso@REDACTED (Claudio Russo) Date: Tue, 20 Dec 2011 16:40:50 +0000 Subject: [erlang-questions] PADL 2012 Final Call for Participation Message-ID: <88D1F4047EA9A2468BCC6B743186880F642A0AD9@DB3EX14MBXC311.europe.corp.microsoft.com> Final Call for Participation ============================ 14th International Symposium on Practical Aspects of Declarative Languages (PADL 2012) http://research.microsoft.com/~crusso/padl12 Philadelphia, Pennsylvania, USA, January 23-24, 2012 Co-located with ACM POPL'12 You are cordially invited to PADL'12. PADL is a forum for researchers and practitioners to present original work emphasizing novel applications and implementation techniques for all forms of declarative concepts, including functional, logic and constraints. PADL'12 is sponsored by Association for Logic Programming with cooperation of ACM SIGPLAN and support by Microsoft Research. Registration ============ To register for PADL'12, please follow the instructions at: https://regmaster3.com/2012conf/POPL12/register.php The early registration deadline is December 24, 2011. The registration fee will cover a copy of the symposium proceedings, refreshments, and an informal dinner. Hotel Information ================= PADL will be co-located with POPL at the Sheraton Society Hill Hotel in Philadelphia. Please visit POPL's web site to make reservations at the special conference rate. Program ======= The symposium will include invited talks by Boon Thau Loo and Don Stewart, and 19 technical papers selected from 41 submissions. The preliminary program is as follows: Invited Talk (9:00-10:00) * Boon Thau Loo Recent Advances in Declarative Networking Break (10:00-10:30) Session 1: Applications (10:30-12:00) * Mayer Goldberg and Guy Wiener A Declarative Approach for Software Modeling * Sergio Antoy and Michael Hanus Contracts and Specifications for Functional Logic Programming * Pedro M. Martins, Julie A. McCann and Susan Eisenbach The Environment as an Argument Lunch (not provided) (12:00-13:30) Session 2: Logic Programming (13:30-15:30) * Yuliya Lierler, Shaden Smith, Mirek Truszczynski and Alex Westlund Weighted-Sequence Problem: ASP vs CASP and Declarative vs Problem-Oriented Solving * Marcello Balduccini and Yuliya Lierler Practical and Methodological Aspects of the Use of Cutting-Edge ASP Tools * Christian Theil Have and Henning Christiansen Efficient tabling of structured data using indexing and program transformation * Dario Campagna, Beata Sarna-Starosta and Tom Schrijvers Optimizing Inequality Joins in Datalog with Approximated Constraint Propagation Break (15:30-16:00) Session 3: Parallelism and Concurrency (16:00-17:30) * Elvira Albert, Puri Arenas and Miguel Gomez-Zamalloa Symbolic Execution of Concurrent Objects in CLP * Pablo Chico De Guzm??n, Amadeo Casas, Manuel Carro and Manuel Hermenegildo A Segment-Swapping Approach for Executing Trapped Computations * Michael Lesniak Palovca: Describing and Executing Graph Algorithms in Haskell Informal PADL Dinner (Place: TBA) Tuesday, January 24, 2012 Breakfast (8:00-9:00) Invited Talk (9:00-10:00) * Don Stewart Make Things Now! Pragmatic Functional Programming in Haskell Break (10:00-10:30) Session 4: Domain Specific Languages I (10:30-12:00) * Kenny Zhu, Kathleen Fisher and David Walker LearnPADS++: Incremental Inference of Ad Hoc Data Formats * Jeroen Bransen, Arie Middelkoop, Atze Dijkstra and S. Doaitse Swierstra The Kennedy-Warren algorithm revisited: ordering Attribute Grammars * Nicholas Coleman Distributed Policy Specification and Interpretation with Classified Advertisements Lunch (not provided) (12:00-13:30) Session 5: Domain Specific Languages II (13:30-15:30) * Andy Gill and Bowe Neuenschwander Handshaking in Kansas Lava using Patch Logic * Daniel Winograd-Cort, Hai Liu and Paul Hudak Virtualizing Real-World Objects in FRP * Edwin Brady and Kevin Hammond Resource-safe Systems Programming with Embedded Domain Specific Languages * David Broman and Henrik Nilsson Node-Based Connection Semantics for Equation-Based Object-Oriented Modeling Languages Break (15:30-16:00) Session 6: Numerics (16:00-17:00) * Paul Tarau A Declarative Specification of Tree-based Symbolic Arithmetic Computations * Vincent St-Amour, Sam Tobin-Hochstadt, Matthew Flatt and Matthias Felleisen Typing the Numeric Tower From yoursurrogategod@REDACTED Tue Dec 20 17:43:54 2011 From: yoursurrogategod@REDACTED (Yves S. Garret) Date: Tue, 20 Dec 2011 11:43:54 -0500 Subject: [erlang-questions] Unit testing In-Reply-To: References: Message-ID: Oh and if anyone has personal experience and personal inputs on this subject, that would be awesome and I would love to hear your inputs especially. After doing software development and learning about the software development process, I've found that -- given the general unreliability of software nowadays -- some (any?) form of testing is highly prized in the software development process. On Tue, Dec 20, 2011 at 11:38 AM, Yves S. Garret wrote: > Hi all, > > Recently I started working on unit testing for CakePHP and this got met > wondering, what unit testing apps are there for Erlang? > > I've found these sources: > > 1. http://www.erlang.org/doc/apps/eunit/chapter.html > 2. > http://armstrongonsoftware.blogspot.com/2009/01/micro-lightweight-unit-testing.html > > > Anything else? Does anyone know if any Erlang programming books out > there cover this topic in some detail? > -------------- next part -------------- An HTML attachment was scrubbed... URL: From ryanmolden@REDACTED Tue Dec 20 17:45:44 2011 From: ryanmolden@REDACTED (Ryan Molden) Date: Tue, 20 Dec 2011 08:45:44 -0800 Subject: [erlang-questions] Are newlines significant in Erlang grammar? Message-ID: I have been playing around with making a lexer/parser for Erlang using boost::spirit and using the YRL from lib\stdlib-1.17.5\src\erl_parse.yrl as my grammar. It isn't specifically called out there (or anywhere else I can find), but I assume that newlines are significant and implied as input terminators? For instance the following is accepted by the compiler (ignore the meaninglessness/infinite recursion of blah) -module .foo. blah(F)->blah(F-1). However, if I put it all on one line, like so: -module .foo.blah(F)->blah(F-1). it is not accepted. It seems to be because .foo.blah is being parsed as a single instance of expr_900, which is defined as expr_900 -> '.' atom expr_900 -> expr_900 '.' atom expr_900 -> expr_max I am fine treating newlines as input terminators but it isn't clear which non-terminals require the presence of a newline and which don't. Ryan -------------- next part -------------- An HTML attachment was scrubbed... URL: From anthonym@REDACTED Tue Dec 20 17:55:47 2011 From: anthonym@REDACTED (Anthony Molinaro) Date: Tue, 20 Dec 2011 08:55:47 -0800 Subject: [erlang-questions] Any Erlang GIS software out there? In-Reply-To: References: <20110915160650.GB1632@alumni.caltech.edu> Message-ID: <20111220165547.GA35295@alumni.caltech.edu> On Wed, Dec 14, 2011 at 01:17:27PM +0100, Dave Cottlehuber wrote: > On 15 September 2011 18:06, Anthony Molinaro > wrote: > > ?I'm interested in doing some reverse geocoding (taking lat/long and > > getting nearby cities). ?While looking around I've not seen any GIS > > related software written in erlang. ?So just wondering if I'm missing > > anything? ?Anyone written any GIS related software in Erlang? > > GeoCouch https://github.com/couchbase/geocouch by Volker Mische is a > popular erlang extension to CouchDB that does GIS stuff such as > bounding box queries. You would need to have the list of interesting > stuff such as cities in the Couch DB already. Thanks for the pointer, but the trick is the interesting stuff, which AFAIK is not readily available (ie, city bounding box data is not easily available, even country data is not readily available as far as I can tell). I ended up solving this issue by using a nearest neighbor type of setup, where I had the latitude and longitude of a number of cities (about 60K cities), so created an ets table which I could query using a bounding box around the current latitude and longitude then calculating the distance to all the points in the box and minimizing. The nice thing about this is its very fast, is very little code and easily fits in memory on a box. Cheers, -Anthony -- ------------------------------------------------------------------------ Anthony Molinaro From dan@REDACTED Tue Dec 20 17:57:18 2011 From: dan@REDACTED (Daniel Dormont) Date: Tue, 20 Dec 2011 11:57:18 -0500 Subject: [erlang-questions] Are newlines significant in Erlang grammar? In-Reply-To: References: Message-ID: Are newlines different from any other whitespace? The following works: -module .foo. blah(F)->blah(F-1). dan On Tue, Dec 20, 2011 at 11:45 AM, Ryan Molden wrote: > I have been playing around with making a lexer/parser for Erlang using > boost::spirit and using the YRL from lib\stdlib-1.17.5\src\erl_parse.yrl as > my grammar. It isn't specifically called out there (or anywhere else I can > find), but I assume that newlines are significant and implied as input > terminators? > > For instance the following is accepted by the compiler (ignore the > meaninglessness/infinite recursion of blah) > > -module .foo. > blah(F)->blah(F-1). > > However, if I put it all on one line, like so: > > -module .foo.blah(F)->blah(F-1). > > it is not accepted. It seems to be because .foo.blah is being parsed as a > single instance of expr_900, which is defined as > > > expr_900 -> '.' atom > expr_900 -> expr_900 '.' atom > expr_900 -> expr_max > > I am fine treating newlines as input terminators but it isn't clear which > non-terminals require the presence of a newline and which don't. > > Ryan > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From kennethstone@REDACTED Tue Dec 20 17:59:20 2011 From: kennethstone@REDACTED (Kenny Stone) Date: Tue, 20 Dec 2011 10:59:20 -0600 Subject: [erlang-questions] Unit testing In-Reply-To: References: Message-ID: http://erlcode.wordpress.com/ The Erlang books that I've read don't do a great job covering testing. Kenny On Tue, Dec 20, 2011 at 10:43 AM, Yves S. Garret wrote: > Oh and if anyone has personal experience and personal inputs on this > subject, that would be awesome and I would love to hear your inputs > especially. After doing software development and learning about the > software development process, I've found that -- given the general > unreliability of software nowadays -- some (any?) form of testing is highly > prized in the software development process. > > On Tue, Dec 20, 2011 at 11:38 AM, Yves S. Garret < > yoursurrogategod@REDACTED> wrote: > >> Hi all, >> >> Recently I started working on unit testing for CakePHP and this got >> met wondering, what unit testing apps are there for Erlang? >> >> I've found these sources: >> >> 1. http://www.erlang.org/doc/apps/eunit/chapter.html >> 2. >> http://armstrongonsoftware.blogspot.com/2009/01/micro-lightweight-unit-testing.html >> >> >> Anything else? Does anyone know if any Erlang programming books out >> there cover this topic in some detail? >> > > > _______________________________________________ > 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 Dec 20 18:04:20 2011 From: mononcqc@REDACTED (Fred Hebert) Date: Tue, 20 Dec 2011 12:04:20 -0500 Subject: [erlang-questions] Are newlines significant in Erlang grammar? In-Reply-To: References: Message-ID: It can be any whitespace, not necessarily new lines. On Tue, Dec 20, 2011 at 11:45 AM, Ryan Molden wrote: > I have been playing around with making a lexer/parser for Erlang using > boost::spirit and using the YRL from lib\stdlib-1.17.5\src\erl_parse.yrl as > my grammar. It isn't specifically called out there (or anywhere else I can > find), but I assume that newlines are significant and implied as input > terminators? > > For instance the following is accepted by the compiler (ignore the > meaninglessness/infinite recursion of blah) > > -module .foo. > blah(F)->blah(F-1). > > However, if I put it all on one line, like so: > > -module .foo.blah(F)->blah(F-1). > > it is not accepted. It seems to be because .foo.blah is being parsed as a > single instance of expr_900, which is defined as > > > expr_900 -> '.' atom > expr_900 -> expr_900 '.' atom > expr_900 -> expr_max > > I am fine treating newlines as input terminators but it isn't clear which > non-terminals require the presence of a newline and which don't. > > Ryan > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From bourinov@REDACTED Tue Dec 20 18:16:47 2011 From: bourinov@REDACTED (Max Bourinov) Date: Tue, 20 Dec 2011 21:16:47 +0400 Subject: [erlang-questions] Unit testing In-Reply-To: References: Message-ID: <-4917108352954888802@unknownmsgid> Yves, we use eunit. It does it's job very well. Please, describe your requirements and tell why eunit is not enough for you for further help. To my xp Eunit is great thing that works very well. Sent from my iPhone On 20.12.2011, at 20:59, Kenny Stone wrote: http://erlcode.wordpress.com/ The Erlang books that I've read don't do a great job covering testing. Kenny On Tue, Dec 20, 2011 at 10:43 AM, Yves S. Garret wrote: > Oh and if anyone has personal experience and personal inputs on this > subject, that would be awesome and I would love to hear your inputs > especially. After doing software development and learning about the > software development process, I've found that -- given the general > unreliability of software nowadays -- some (any?) form of testing is highly > prized in the software development process. > > On Tue, Dec 20, 2011 at 11:38 AM, Yves S. Garret < > yoursurrogategod@REDACTED> wrote: > >> Hi all, >> >> Recently I started working on unit testing for CakePHP and this got >> met wondering, what unit testing apps are there for Erlang? >> >> I've found these sources: >> >> 1. http://www.erlang.org/doc/apps/eunit/chapter.html >> 2. >> http://armstrongonsoftware.blogspot.com/2009/01/micro-lightweight-unit-testing.html >> >> >> Anything else? Does anyone know if any Erlang programming books out >> there cover this topic in some detail? >> > > > _______________________________________________ > 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 gianfranco.alongi@REDACTED Tue Dec 20 18:18:32 2011 From: gianfranco.alongi@REDACTED (Gianfranco Alongi) Date: Tue, 20 Dec 2011 18:18:32 +0100 Subject: [erlang-questions] Unit testing In-Reply-To: References: Message-ID: In general, I would advice you to start from the start on this http://erlcode.wordpress.com/2010/08/30/erlang-eunit-introduction/ and go on in accordance to the dates. Cheers G On Tue, Dec 20, 2011 at 5:59 PM, Kenny Stone wrote: > http://erlcode.wordpress.com/ > > The Erlang books that I've read don't do a great job covering testing. > > Kenny > > On Tue, Dec 20, 2011 at 10:43 AM, Yves S. Garret > wrote: >> >> Oh and if anyone has personal experience and personal inputs on this >> subject, that would be awesome and I would love to hear your inputs >> especially. ?After doing software development and learning about the >> software development process, I've found that -- given the general >> unreliability of software nowadays -- some (any?) form of testing is highly >> prized in the software development process. >> >> On Tue, Dec 20, 2011 at 11:38 AM, Yves S. Garret >> wrote: >>> >>> Hi all, >>> >>> ? ?Recently I started working on unit testing for CakePHP and this got >>> met wondering, what unit testing apps are there for Erlang? >>> >>> ? ?I've found these sources: >>> >>> http://www.erlang.org/doc/apps/eunit/chapter.html >>> >>> http://armstrongonsoftware.blogspot.com/2009/01/micro-lightweight-unit-testing.html >>> >>> >>> ? ?Anything else? ?Does anyone know if any Erlang programming books out >>> there cover this topic in some detail? >> >> >> >> _______________________________________________ >> 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 yoursurrogategod@REDACTED Tue Dec 20 18:24:29 2011 From: yoursurrogategod@REDACTED (Yves S. Garret) Date: Tue, 20 Dec 2011 12:24:29 -0500 Subject: [erlang-questions] Unit testing In-Reply-To: References: Message-ID: Thanks Gianfranco. Max, I'm curious what Erlang unit testing tools there are. I like writing code in Erlang, but don't get a chance to do that professionally and had that light-bulb-moment when I was working on something else that needs unit testing. On Tue, Dec 20, 2011 at 12:18 PM, Gianfranco Alongi < gianfranco.alongi@REDACTED> wrote: > In general, I would advice you to start from the start on this > > http://erlcode.wordpress.com/2010/08/30/erlang-eunit-introduction/ > > and go on in accordance to the dates. > > Cheers > G > > On Tue, Dec 20, 2011 at 5:59 PM, Kenny Stone > wrote: > > http://erlcode.wordpress.com/ > > > > The Erlang books that I've read don't do a great job covering testing. > > > > Kenny > > > > On Tue, Dec 20, 2011 at 10:43 AM, Yves S. Garret > > wrote: > >> > >> Oh and if anyone has personal experience and personal inputs on this > >> subject, that would be awesome and I would love to hear your inputs > >> especially. After doing software development and learning about the > >> software development process, I've found that -- given the general > >> unreliability of software nowadays -- some (any?) form of testing is > highly > >> prized in the software development process. > >> > >> On Tue, Dec 20, 2011 at 11:38 AM, Yves S. Garret > >> wrote: > >>> > >>> Hi all, > >>> > >>> Recently I started working on unit testing for CakePHP and this got > >>> met wondering, what unit testing apps are there for Erlang? > >>> > >>> I've found these sources: > >>> > >>> http://www.erlang.org/doc/apps/eunit/chapter.html > >>> > >>> > http://armstrongonsoftware.blogspot.com/2009/01/micro-lightweight-unit-testing.html > >>> > >>> > >>> Anything else? Does anyone know if any Erlang programming books out > >>> there cover this topic in some detail? > >> > >> > >> > >> _______________________________________________ > >> 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 mjtruog@REDACTED Tue Dec 20 18:30:22 2011 From: mjtruog@REDACTED (Michael Truog) Date: Tue, 20 Dec 2011 09:30:22 -0800 Subject: [erlang-questions] best ways to discover jinterface mailbox from erlang? In-Reply-To: References: Message-ID: <4EF0C62E.8080908@gmail.com> On 12/20/2011 01:27 AM, mabrek wrote: > Hello. > > We have one application written in Java and need call it's methods > from Erlang. We use global to discover erlang services but jinterface > mailbox can't be registered in such way. Gproc doesn't seem to work > with jinterface either. It looks like it's possible to register > jinterface mailbox via pg2, haven't tried it yet. > > What is the best way to make jinterface mailbox discoverable from erlang? > > Regards, > Anton Lebedevich CloudI (http://cloudi.org) uses a module similar to pg2 to queue messages to Java through jinterface as Erlang ports (instead of cnodes). So, it should provide the functionality you are looking for. From ryanmolden@REDACTED Tue Dec 20 18:33:32 2011 From: ryanmolden@REDACTED (Ryan Molden) Date: Tue, 20 Dec 2011 09:33:32 -0800 Subject: [erlang-questions] Are newlines significant in Erlang grammar? In-Reply-To: References: Message-ID: Sure, but I was trying to avoid sprinking [\t\r\n ]* tokens everywhere throughout my grammar. My lexer currently ignores whitespace outside of comments and string literals and my parser works off the tokens my lexer produces. If what you are saying is correct it sounds like I can't do that, which means my parser's grammar explodes with tons of 'oh and there can be whitespace here, or needs to be whitespace here' kind of tokens :( Ryan On Tue, Dec 20, 2011 at 9:04 AM, Fred Hebert wrote: > It can be any whitespace, not necessarily new lines. > > On Tue, Dec 20, 2011 at 11:45 AM, Ryan Molden wrote: > >> I have been playing around with making a lexer/parser for Erlang using >> boost::spirit and using the YRL from lib\stdlib-1.17.5\src\erl_parse.yrl as >> my grammar. It isn't specifically called out there (or anywhere else I can >> find), but I assume that newlines are significant and implied as input >> terminators? >> >> For instance the following is accepted by the compiler (ignore the >> meaninglessness/infinite recursion of blah) >> >> -module .foo. >> blah(F)->blah(F-1). >> >> However, if I put it all on one line, like so: >> >> -module .foo.blah(F)->blah(F-1). >> >> it is not accepted. It seems to be because .foo.blah is being parsed as a >> single instance of expr_900, which is defined as >> >> >> expr_900 -> '.' atom >> expr_900 -> expr_900 '.' atom >> expr_900 -> expr_max >> >> I am fine treating newlines as input terminators but it isn't clear which >> non-terminals require the presence of a newline and which don't. >> >> Ryan >> >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://erlang.org/mailman/listinfo/erlang-questions >> >> > -------------- next part -------------- An HTML attachment was scrubbed... URL: From bchesneau@REDACTED Tue Dec 20 18:40:26 2011 From: bchesneau@REDACTED (Benoit Chesneau) Date: Tue, 20 Dec 2011 18:40:26 +0100 Subject: [erlang-questions] Any Erlang GIS software out there? In-Reply-To: <20111220165547.GA35295@alumni.caltech.edu> References: <20110915160650.GB1632@alumni.caltech.edu> <20111220165547.GA35295@alumni.caltech.edu> Message-ID: On Tue, Dec 20, 2011 at 5:55 PM, Anthony Molinaro wrote: > > On Wed, Dec 14, 2011 at 01:17:27PM +0100, Dave Cottlehuber wrote: >> On 15 September 2011 18:06, Anthony Molinaro >> wrote: >> > ?I'm interested in doing some reverse geocoding (taking lat/long and >> > getting nearby cities). ?While looking around I've not seen any GIS >> > related software written in erlang. ?So just wondering if I'm missing >> > anything? ?Anyone written any GIS related software in Erlang? >> >> GeoCouch https://github.com/couchbase/geocouch by Volker Mische is a >> popular erlang extension to CouchDB that does GIS stuff such as >> bounding box queries. You would need to have the list of interesting >> stuff such as cities in the Couch DB already. > > Thanks for the pointer, but the trick is the interesting stuff, which > AFAIK is not readily available (ie, city bounding box data is not > easily available, even country data is not readily available as far > as I can tell). ?I ended up solving this issue by using a nearest > neighbor type of setup, where I had the latitude and longitude of a > number of cities (about 60K cities), so created an ets table which > I could query using a bounding box around the current latitude and > longitude then calculating the distance to all the points in the box > and minimizing. ?The nice thing about this is its very fast, is very > little code and easily fits in memory on a box. > > Cheers, > > -Anthony > > anything available somewhere that we could see? It sounds interresting. Someone added knn recently to geocouch: https://github.com/tsauerwein/geocouch/commit/512e67111916bfaa1192f6c1229bdf4989d84192 - beno?t From vladdu55@REDACTED Tue Dec 20 18:46:02 2011 From: vladdu55@REDACTED (Vlad Dumitrescu) Date: Tue, 20 Dec 2011 18:46:02 +0100 Subject: [erlang-questions] Are newlines significant in Erlang grammar? In-Reply-To: References: Message-ID: Hi, On Tue, Dec 20, 2011 at 18:33, Ryan Molden wrote: > Sure, but I was trying to avoid sprinking [\t\r\n ]* tokens everywhere > throughout my grammar. My lexer currently ignores whitespace outside of > comments and string literals and my parser works off the tokens my lexer > produces. > > If what you are saying is correct it sounds like I can't do that, which > means my parser's grammar explodes with tons of 'oh and there can be > whitespace here, or needs to be whitespace here' kind of tokens :( The issue here is that the dot is ambiguous and the rule is that a dot followed by whitespace is the 'dot' token, while a dot followed directly by an atom is an 'expr900' or more precisely a part of a "packaged" atom. It is tricky that for example ".a .b .c" is a single atom, ie whitespace is allowed before the dot but not after. Personally I would vote for changing the package name separator (or even remove the current package support, as it has been experimental for many years and there are grave issues with it). regards, Vlad From magnus.klaar@REDACTED Tue Dec 20 18:54:49 2011 From: magnus.klaar@REDACTED (Magnus Klaar) Date: Tue, 20 Dec 2011 18:54:49 +0100 Subject: [erlang-questions] Unit testing In-Reply-To: References: Message-ID: Hi! Didn't see a mention of it yet. LYSE has a really good chapter on EUnit. http://learnyousomeerlang.com/eunit MVH Magnus On Tue, Dec 20, 2011 at 6:24 PM, Yves S. Garret wrote: > Thanks Gianfranco. > > Max, I'm curious what Erlang unit testing tools there are. I like writing > code in Erlang, but don't get a chance to do that professionally and had > that light-bulb-moment when I was working on something else that needs unit > testing. > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From garret.smith@REDACTED Tue Dec 20 19:04:41 2011 From: garret.smith@REDACTED (Garret Smith) Date: Tue, 20 Dec 2011 10:04:41 -0800 Subject: [erlang-questions] Automated testing of a distributed application In-Reply-To: References: Message-ID: Thank you Lukas! That was the realization I was coming to about common_test that you said perfectly: it's for distributing tests, not testing distributed applications. Looks like I'll be writing the infrastructure myself. At least I have the slave and rpc modules to help me out. -Garret On Tue, Dec 20, 2011 at 4:47 AM, Lukas Larsson wrote: > Hello! > > The ct_master module is not really meant to test distributed > applications, but rather to distribute your tests. It helps you when > you have 1000 tests to run, but can only finish 500 per day and you > need to run all of them each day. > > When testing distributed application with common_test, I use the > ct_slave (or just even slave) module and configure slaves to be > started on node X and Y and then run test suites on node Z which > trigger test behavior either through rpc or SIP och whatever interface > you want to test. Serializing test calls and making sure that no test > cases interfere with each other I do in the testcase and suite as I > would with a non-distributed application. > > Lukas > > On Tue, Dec 20, 2011 at 1:56 AM, Garret Smith > wrote: > > I just finished setting up an automated test suite for my distributed > > application using the common_test "Large Scale Testing" support. It was > > rough, but *almost* works. It starts up 2 local nodes, starts my app on > > both nodes, runs a few test cases from my suite on node1, a second batch > of > > cases on node2, then yet another batch of cases on node1. > > > > The test cases are designed to work by contacting the distributed app on > > node1, modifying it's state through the API, then contacting the app on > > node2 to verify that the state changes are reflected there, then > repeating > > from the perspective of node2. > > > > sample test spec, invoked with ct_master:run/1 > > > > {logdir, "../logs"}. > > > > {alias, testdir, "."}. > > > > {init, [n1, n2], {node_start, [{erl_flags, "-pa ../../ebin"}, > > {monitor_master, true}]}}. > > > > {merge_tests, false}. > > > > {cases, n1, testdir, distributed_SUITE, [create_table, insert_1]}. > > {cases, n2, testdir, distributed_SUITE, [read_1, update_2]}. > > {cases, n1, testdir, distributed_SUITE, [read_2]}. > > > > > > > > Now that my basic setup using ct_master is working, I notice that > sometimes > > the tests fail because I cannot depend on the batches being executed in > > sequence. ct_master executes the test cases in parallel on the two > nodes. > > I could continue down this path by adding synchronization somehow, but I > > feel that I am not really using ct_master in the way it was intended. > > > > Has anyone on the list had experience writing an automated test suite > where > > the SUT is a single app running on a cluster of nodes? Were you able to > do > > this with common_test, or did you end up rolling your own framework? > > > > Thanks! > > > > -Garret Smith > > > > _______________________________________________ > > erlang-questions mailing list > > erlang-questions@REDACTED > > http://erlang.org/mailman/listinfo/erlang-questions > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From dan@REDACTED Tue Dec 20 19:33:18 2011 From: dan@REDACTED (Daniel Dormont) Date: Tue, 20 Dec 2011 13:33:18 -0500 Subject: [erlang-questions] Are newlines significant in Erlang grammar? In-Reply-To: References: Message-ID: Actually that's an interesting point. Is there really no other place in the Erlang grammar where whitespace is required? My gut instinct tells me there must be a few, because every language has a few right? I mean, if nothing else to separate two identifiers? But thinking a little more, I realize Erlang doesn't have "identifiers" in the sense most other languages do and even then, there's always some sort of punctuation. Is this period business the only exception? dan On Tue, Dec 20, 2011 at 12:33 PM, Ryan Molden wrote: > Sure, but I was trying to avoid sprinking [\t\r\n ]* tokens everywhere > throughout my grammar. My lexer currently ignores whitespace outside of > comments and string literals and my parser works off the tokens my lexer > produces. > > If what you are saying is correct it sounds like I can't do that, which > means my parser's grammar explodes with tons of 'oh and there can be > whitespace here, or needs to be whitespace here' kind of tokens :( > Ryan > On Tue, Dec 20, 2011 at 9:04 AM, Fred Hebert wrote: > >> It can be any whitespace, not necessarily new lines. >> >> On Tue, Dec 20, 2011 at 11:45 AM, Ryan Molden wrote: >> >>> I have been playing around with making a lexer/parser for Erlang using >>> boost::spirit and using the YRL from lib\stdlib-1.17.5\src\erl_parse.yrl as >>> my grammar. It isn't specifically called out there (or anywhere else I can >>> find), but I assume that newlines are significant and implied as input >>> terminators? >>> >>> For instance the following is accepted by the compiler (ignore the >>> meaninglessness/infinite recursion of blah) >>> >>> -module .foo. >>> blah(F)->blah(F-1). >>> >>> However, if I put it all on one line, like so: >>> >>> -module .foo.blah(F)->blah(F-1). >>> >>> it is not accepted. It seems to be because .foo.blah is being parsed as >>> a single instance of expr_900, which is defined as >>> >>> >>> expr_900 -> '.' atom >>> expr_900 -> expr_900 '.' atom >>> expr_900 -> expr_max >>> >>> I am fine treating newlines as input terminators but it isn't clear >>> which non-terminals require the presence of a newline and which don't. >>> >>> Ryan >>> >>> _______________________________________________ >>> 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 demeshchuk@REDACTED Tue Dec 20 20:12:37 2011 From: demeshchuk@REDACTED (Dmitry Demeshchuk) Date: Tue, 20 Dec 2011 23:12:37 +0400 Subject: [erlang-questions] Ability to add app directories explicitly for reltool Message-ID: Hello, Siri and everyone. Recently I've been trying to start using OTP releases in our projects with help of rebar. However, I faced the following problem. Rebar expects that *all* Erlang code resides in some directory (generally, "deps" folder) or several directories. This is a reltool strict requirement, as far as I understand. Unlike, Riak, all our applications have the following directory structure: . .. deps/ ebin/ include/ priv/ src/ So, we pull some libraries (and sometimes smaller applications) as deps, but the main application's code resides in the root application folder. And there's no way to make reltool include this code into the generated release, or at least I don't see it. For now, there are 2 ways for me to solve this without affecting reltool itself: 1. For all apps, make another repository that just pulls our application and all its deps, so the actual application code resides in the deps/ dir as well, and generate the release package from it. However, this seems like an overhead to me. Moreover, this isn't convenient for development. 2. I made a hack that creates symlinks in the deps/ dir, so that it seems to reltool that the core application actually resides in the deps/ folder, so it's included into the release. Obviously, this is kinda ugly and potentially buggy, forget total Windows incompatibility. Initially, this was a pull request to rebar but after some thinking me and one of rebar's maintainers agreed that it's better to make this code a rebar plugin. So, as you can see, both of the solutions aren't perfect. The ideal way I can see is an ability to set explicit app directories in reltool.config, like: {explicit_app_dirs, ["/apps/myapp1"]}. Probably, it won't make any other use besides the problem I'm describing here, but at least it's quite general and doesn't seem like a hack. Maybe there's a better way that I didn't come up with. Or maybe reltool can do what I want, and I just don't know about such an ability. This seems like a very useful feature. I know that many people use just the same directory structure in their projects. Also, rebar maintainers already gave me their +1 to this. I'll be glad to work on the patch if we come up with a good solution. Thank you. -- Best regards, Dmitry Demeshchuk From garret.smith@REDACTED Tue Dec 20 20:25:17 2011 From: garret.smith@REDACTED (Garret Smith) Date: Tue, 20 Dec 2011 11:25:17 -0800 Subject: [erlang-questions] Ability to add app directories explicitly for reltool In-Reply-To: References: Message-ID: My rebar/reltool setup is doing close to what you describe as the "ideal" way. Relevant project structure is: apps/ app1 app2 deps/ rel/ reltool.config My rebar.config looks like: {lib_dirs, ["apps"]}. {sub_dirs, [ "apps/app1", "apps/app2", "rel"]}. {deps, [...]}. My reltool.config looks like (cut-n-pasted pieces here): {sys, [ {lib_dirs, ["../apps", "../deps"]}, {rel, "start", "1", [ app1, app2, dependent_app1, dependent_app1 ]}, {rel, "start_clean", "", [ kernel, stdlib ]}, {app, app1, [{incl_cond, include}]}, {app, app1, [{incl_cond, include}]}, {app, dependent_app1, [{incl_cond, include}]}, {app, dependent_app2, [{incl_cond, include}]} }. With this setup, rebar & reltool take the apps under apps/ and deps/ and creates a target release for me. Is this what you are looking for? -Garret On Tue, Dec 20, 2011 at 11:12 AM, Dmitry Demeshchuk wrote: > Hello, Siri and everyone. > > Recently I've been trying to start using OTP releases in our projects > with help of rebar. However, I faced the following problem. > > Rebar expects that *all* Erlang code resides in some directory > (generally, "deps" folder) or several directories. This is a reltool > strict requirement, as far as I understand. Unlike, Riak, all our > applications have the following directory structure: > > . > .. > deps/ > ebin/ > include/ > priv/ > src/ > > So, we pull some libraries (and sometimes smaller applications) as > deps, but the main application's code resides in the root application > folder. And there's no way to make reltool include this code into the > generated release, or at least I don't see it. > > For now, there are 2 ways for me to solve this without affecting reltool > itself: > > 1. For all apps, make another repository that just pulls our > application and all its deps, so the actual application code resides > in the deps/ dir as well, and generate the release package from it. > However, this seems like an overhead to me. Moreover, this isn't > convenient for development. > > 2. I made a hack that creates symlinks in the deps/ dir, so that it > seems to reltool that the core application actually resides in the > deps/ folder, so it's included into the release. Obviously, this is > kinda ugly and potentially buggy, forget total Windows > incompatibility. Initially, this was a pull request to rebar but after > some thinking me and one of rebar's maintainers agreed that it's > better to make this code a rebar plugin. > > So, as you can see, both of the solutions aren't perfect. The ideal > way I can see is an ability to set explicit app directories in > reltool.config, like: > > {explicit_app_dirs, ["/apps/myapp1"]}. > > Probably, it won't make any other use besides the problem I'm > describing here, but at least it's quite general and doesn't seem like > a hack. Maybe there's a better way that I didn't come up with. Or > maybe reltool can do what I want, and I just don't know about such an > ability. > > This seems like a very useful feature. I know that many people use > just the same directory structure in their projects. Also, rebar > maintainers already gave me their +1 to this. I'll be glad to work on > the patch if we come up with a good solution. > > Thank you. > > > -- > Best regards, > Dmitry Demeshchuk > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From beastlifeisgood@REDACTED Tue Dec 20 20:35:11 2011 From: beastlifeisgood@REDACTED (Am Ro) Date: Tue, 20 Dec 2011 14:35:11 -0500 Subject: [erlang-questions] How to retrieve pid() of process that owns a tcp socket? Message-ID: Any ideas? From grimlog@REDACTED Tue Dec 20 20:38:30 2011 From: grimlog@REDACTED (Michael Schreckenbauer) Date: Tue, 20 Dec 2011 20:38:30 +0100 Subject: [erlang-questions] Any Erlang GIS software out there? In-Reply-To: <20111220165547.GA35295@alumni.caltech.edu> References: <20110915160650.GB1632@alumni.caltech.edu> <20111220165547.GA35295@alumni.caltech.edu> Message-ID: <2471368.pDhvtmTXDo@pc> Hi, Am Dienstag, 20. Dezember 2011, 08:55:47 schrieb Anthony Molinaro: > On Wed, Dec 14, 2011 at 01:17:27PM +0100, Dave Cottlehuber wrote: > > On 15 September 2011 18:06, Anthony Molinaro > > > > wrote: > > > I'm interested in doing some reverse geocoding (taking lat/long and > > > getting nearby cities). While looking around I've not seen any GIS > > > related software written in erlang. So just wondering if I'm > > > missing > > > anything? Anyone written any GIS related software in Erlang? > > > > GeoCouch https://github.com/couchbase/geocouch by Volker Mische is a > > popular erlang extension to CouchDB that does GIS stuff such as > > bounding box queries. You would need to have the list of interesting > > stuff such as cities in the Couch DB already. > > Thanks for the pointer, but the trick is the interesting stuff, which > AFAIK is not readily available (ie, city bounding box data is not > easily available, even country data is not readily available as far > as I can tell). we use openstreetmap for this. eg. http://nominatim.openstreetmap.org/?q=stockholm,se&format=xml ... > Cheers, > -Anthony Best, Michael From vinoski@REDACTED Tue Dec 20 21:29:36 2011 From: vinoski@REDACTED (Steve Vinoski) Date: Tue, 20 Dec 2011 15:29:36 -0500 Subject: [erlang-questions] How to retrieve pid() of process that owns a tcp socket? In-Reply-To: References: Message-ID: On Tue, Dec 20, 2011 at 2:35 PM, Am Ro wrote: > Any ideas? http://www.erlang.org/doc/man/erlang.html#port_info-1 erlang:port_info(Socket, connected). --steve From lukas@REDACTED Tue Dec 20 22:30:24 2011 From: lukas@REDACTED (Lukas Larsson) Date: Tue, 20 Dec 2011 22:30:24 +0100 Subject: [erlang-questions] Automated testing of a distributed application In-Reply-To: References: Message-ID: The reason why there is no specific test support for distributed apps is partly because ct is mainly used to do black box tests of embedded applications which need a completely different and much much bigger architecture than you normal Erlang application. Also if you have a lot of test suites I would recommend writing a ct hook which starts and monitors slaves throughout the tests and maybe restart the applications when a test fails. There are a lot of great things which you can do with ct if you just take the time to dig below the surface. Let me know if you have any other questions or issues! Lukas On Dec 20, 2011 7:04 PM, "Garret Smith" wrote: > Thank you Lukas! > > That was the realization I was coming to about common_test that you said > perfectly: it's for distributing tests, not testing distributed > applications. > > Looks like I'll be writing the infrastructure myself. At least I have the > slave and rpc modules to help me out. > > -Garret > > > On Tue, Dec 20, 2011 at 4:47 AM, Lukas Larsson > wrote: > >> Hello! >> >> The ct_master module is not really meant to test distributed >> applications, but rather to distribute your tests. It helps you when >> you have 1000 tests to run, but can only finish 500 per day and you >> need to run all of them each day. >> >> When testing distributed application with common_test, I use the >> ct_slave (or just even slave) module and configure slaves to be >> started on node X and Y and then run test suites on node Z which >> trigger test behavior either through rpc or SIP och whatever interface >> you want to test. Serializing test calls and making sure that no test >> cases interfere with each other I do in the testcase and suite as I >> would with a non-distributed application. >> >> Lukas >> >> On Tue, Dec 20, 2011 at 1:56 AM, Garret Smith >> wrote: >> > I just finished setting up an automated test suite for my distributed >> > application using the common_test "Large Scale Testing" support. It was >> > rough, but *almost* works. It starts up 2 local nodes, starts my app on >> > both nodes, runs a few test cases from my suite on node1, a second >> batch of >> > cases on node2, then yet another batch of cases on node1. >> > >> > The test cases are designed to work by contacting the distributed app on >> > node1, modifying it's state through the API, then contacting the app on >> > node2 to verify that the state changes are reflected there, then >> repeating >> > from the perspective of node2. >> > >> > sample test spec, invoked with ct_master:run/1 >> > >> > {logdir, "../logs"}. >> > >> > {alias, testdir, "."}. >> > >> > {init, [n1, n2], {node_start, [{erl_flags, "-pa ../../ebin"}, >> > {monitor_master, true}]}}. >> > >> > {merge_tests, false}. >> > >> > {cases, n1, testdir, distributed_SUITE, [create_table, insert_1]}. >> > {cases, n2, testdir, distributed_SUITE, [read_1, update_2]}. >> > {cases, n1, testdir, distributed_SUITE, [read_2]}. >> > >> > >> > >> > Now that my basic setup using ct_master is working, I notice that >> sometimes >> > the tests fail because I cannot depend on the batches being executed in >> > sequence. ct_master executes the test cases in parallel on the two >> nodes. >> > I could continue down this path by adding synchronization somehow, but I >> > feel that I am not really using ct_master in the way it was intended. >> > >> > Has anyone on the list had experience writing an automated test suite >> where >> > the SUT is a single app running on a cluster of nodes? Were you able >> to do >> > this with common_test, or did you end up rolling your own framework? >> > >> > Thanks! >> > >> > -Garret Smith >> > >> > _______________________________________________ >> > 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 zabrane3@REDACTED Tue Dec 20 22:46:57 2011 From: zabrane3@REDACTED (Zabrane Mickael) Date: Tue, 20 Dec 2011 22:46:57 +0100 Subject: [erlang-questions] Automated testing of a distributed application In-Reply-To: References: Message-ID: Hi Lukas, Do you have any (working) code snippet to share about CT Hooks? Regards, Zabrane On Dec 20, 2011, at 10:30 PM, Lukas Larsson wrote: > The reason why there is no specific test support for distributed apps is partly because ct is mainly used to do black box tests of embedded applications which need a completely different and much much bigger architecture than you normal Erlang application. > > Also if you have a lot of test suites I would recommend writing a ct hook which starts and monitors slaves throughout the tests and maybe restart the applications when a test fails. > > There are a lot of great things which you can do with ct if you just take the time to dig below the surface. Let me know if you have any other questions or issues! > > Lukas > > On Dec 20, 2011 7:04 PM, "Garret Smith" wrote: > Thank you Lukas! > > That was the realization I was coming to about common_test that you said perfectly: it's for distributing tests, not testing distributed applications. > > Looks like I'll be writing the infrastructure myself. At least I have the slave and rpc modules to help me out. > > -Garret > > > On Tue, Dec 20, 2011 at 4:47 AM, Lukas Larsson wrote: > Hello! > > The ct_master module is not really meant to test distributed > applications, but rather to distribute your tests. It helps you when > you have 1000 tests to run, but can only finish 500 per day and you > need to run all of them each day. > > When testing distributed application with common_test, I use the > ct_slave (or just even slave) module and configure slaves to be > started on node X and Y and then run test suites on node Z which > trigger test behavior either through rpc or SIP och whatever interface > you want to test. Serializing test calls and making sure that no test > cases interfere with each other I do in the testcase and suite as I > would with a non-distributed application. > > Lukas > > On Tue, Dec 20, 2011 at 1:56 AM, Garret Smith wrote: > > I just finished setting up an automated test suite for my distributed > > application using the common_test "Large Scale Testing" support. It was > > rough, but *almost* works. It starts up 2 local nodes, starts my app on > > both nodes, runs a few test cases from my suite on node1, a second batch of > > cases on node2, then yet another batch of cases on node1. > > > > The test cases are designed to work by contacting the distributed app on > > node1, modifying it's state through the API, then contacting the app on > > node2 to verify that the state changes are reflected there, then repeating > > from the perspective of node2. > > > > sample test spec, invoked with ct_master:run/1 > > > > {logdir, "../logs"}. > > > > {alias, testdir, "."}. > > > > {init, [n1, n2], {node_start, [{erl_flags, "-pa ../../ebin"}, > > {monitor_master, true}]}}. > > > > {merge_tests, false}. > > > > {cases, n1, testdir, distributed_SUITE, [create_table, insert_1]}. > > {cases, n2, testdir, distributed_SUITE, [read_1, update_2]}. > > {cases, n1, testdir, distributed_SUITE, [read_2]}. > > > > > > > > Now that my basic setup using ct_master is working, I notice that sometimes > > the tests fail because I cannot depend on the batches being executed in > > sequence. ct_master executes the test cases in parallel on the two nodes. > > I could continue down this path by adding synchronization somehow, but I > > feel that I am not really using ct_master in the way it was intended. > > > > Has anyone on the list had experience writing an automated test suite where > > the SUT is a single app running on a cluster of nodes? Were you able to do > > this with common_test, or did you end up rolling your own framework? > > > > Thanks! > > > > -Garret Smith > > > > _______________________________________________ > > 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 lukas@REDACTED Tue Dec 20 23:02:18 2011 From: lukas@REDACTED (Lukas Larsson) Date: Tue, 20 Dec 2011 23:02:18 +0100 Subject: [erlang-questions] Automated testing of a distributed application In-Reply-To: References: Message-ID: Here are some, there is also an example in the documentation for hooks: http://erlang.org/doc/apps/common_test/ct_hooks_chapter.html#id77379 https://github.com/erlang/otp/blob/master/lib/common_test/src/cth_log_redirect.erl https://github.com/erlang/otp/blob/master/lib/test_server/src/ts_install_cth.erl https://github.com/garazdawi/cth_tools/tree/master/src all modules names *_cth.erl in https://github.com/erlang/otp/tree/master/lib/common_test/test/ct_hooks_SUITE_data/cth/tests Lukas On Tue, Dec 20, 2011 at 10:46 PM, Zabrane Mickael wrote: > Hi Lukas, > > Do you have any (working) code snippet to share about CT Hooks? > > Regards, > Zabrane > > On Dec 20, 2011, at 10:30 PM, Lukas Larsson wrote: > > The reason why there is no specific test support for distributed apps is > partly because ct is mainly used to do black box tests of embedded > applications which need a completely different and much much bigger > architecture than you normal Erlang application. > > Also if you have a lot of test suites I would recommend writing a ct hook > which starts and monitors slaves throughout the tests and maybe restart the > applications when a test fails. > > There are a lot of great things which you can do with ct if you just take > the time to dig below the surface. Let me know if you have any other > questions or issues! > > Lukas > > On Dec 20, 2011 7:04 PM, "Garret Smith" wrote: >> >> Thank you Lukas! >> >> That was the realization I was coming to about common_test that you said >> perfectly: it's for distributing tests, not testing distributed >> applications. >> >> Looks like I'll be writing the infrastructure myself.? At least I have the >> slave and rpc modules to help me out. >> >> -Garret >> >> >> On Tue, Dec 20, 2011 at 4:47 AM, Lukas Larsson >> wrote: >>> >>> Hello! >>> >>> The ct_master module is not really meant to test distributed >>> applications, but rather to distribute your tests. It helps you when >>> you have 1000 tests to run, but can only finish 500 per day and you >>> need to run all of them each day. >>> >>> When testing distributed application with common_test, I use the >>> ct_slave (or just even slave) module and configure slaves to be >>> started on node X and Y and then run test suites on node Z which >>> trigger test behavior either through rpc or SIP och whatever interface >>> you want to test. Serializing test calls and making sure that no test >>> cases interfere with each other I do in the testcase and suite as I >>> would with a non-distributed application. >>> >>> Lukas >>> >>> On Tue, Dec 20, 2011 at 1:56 AM, Garret Smith >>> wrote: >>> > I just finished setting up an automated test suite for my distributed >>> > application using the common_test "Large Scale Testing" support.? It >>> > was >>> > rough, but *almost* works.? It starts up 2 local nodes, starts my app >>> > on >>> > both nodes, runs a few test cases from my suite on node1, a second >>> > batch of >>> > cases on node2, then yet another batch of cases on node1. >>> > >>> > The test cases are designed to work by contacting the distributed app >>> > on >>> > node1, modifying it's state through the API, then contacting the app on >>> > node2 to verify that the state changes are reflected there, then >>> > repeating >>> > from the perspective of node2. >>> > >>> > sample test spec, invoked with ct_master:run/1 >>> > >>> > {logdir, "../logs"}. >>> > >>> > {alias, testdir, "."}. >>> > >>> > {init, [n1, n2], {node_start, [{erl_flags, "-pa ../../ebin"}, >>> > {monitor_master, true}]}}. >>> > >>> > {merge_tests, false}. >>> > >>> > {cases, n1, testdir, distributed_SUITE, [create_table, insert_1]}. >>> > {cases, n2, testdir, distributed_SUITE, [read_1, update_2]}. >>> > {cases, n1, testdir, distributed_SUITE, [read_2]}. >>> > >>> > >>> > >>> > Now that my basic setup using ct_master is working, I notice that >>> > sometimes >>> > the tests fail because I cannot depend on the batches being executed in >>> > sequence.? ct_master executes the test cases in parallel on the two >>> > nodes. >>> > I could continue down this path by adding synchronization somehow, but >>> > I >>> > feel that I am not really using ct_master in the way it was intended. >>> > >>> > Has anyone on the list had experience writing an automated test suite >>> > where >>> > the SUT is a single app running on a cluster of nodes?? Were you able >>> > to do >>> > this with common_test, or did you end up rolling your own framework? >>> > >>> > Thanks! >>> > >>> > -Garret Smith >>> > >>> > _______________________________________________ >>> > 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 > > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > From zabrane3@REDACTED Tue Dec 20 23:07:01 2011 From: zabrane3@REDACTED (Zabrane Mickael) Date: Tue, 20 Dec 2011 23:07:01 +0100 Subject: [erlang-questions] Automated testing of a distributed application In-Reply-To: References: Message-ID: <198999E9-862F-432E-BF01-C7B83C0B1CB3@gmail.com> Thanks a lot man. On Dec 20, 2011, at 11:02 PM, Lukas Larsson wrote: > Here are some, there is also an example in the documentation for > hooks: http://erlang.org/doc/apps/common_test/ct_hooks_chapter.html#id77379 > > https://github.com/erlang/otp/blob/master/lib/common_test/src/cth_log_redirect.erl > https://github.com/erlang/otp/blob/master/lib/test_server/src/ts_install_cth.erl > https://github.com/garazdawi/cth_tools/tree/master/src > > all modules names *_cth.erl in > https://github.com/erlang/otp/tree/master/lib/common_test/test/ct_hooks_SUITE_data/cth/tests > > Lukas From jws@REDACTED Wed Dec 21 00:39:51 2011 From: jws@REDACTED (Jeff Schultz) Date: Wed, 21 Dec 2011 10:39:51 +1100 Subject: [erlang-questions] Are newlines significant in Erlang grammar? In-Reply-To: References: Message-ID: <20111220233951.GA6833@mulga.csse.unimelb.edu.au> On Tue, Dec 20, 2011 at 01:33:18PM -0500, Daniel Dormont wrote: > Actually that's an interesting point. Is there really no other place in the > Erlang grammar where whitespace is required? My gut instinct tells me there > must be a few, because every language has a few right? I mean, if nothing > else to separate two identifiers? But thinking a little more, I realize > Erlang doesn't have "identifiers" in the sense most other languages do and > even then, there's always some sort of punctuation. Is this period business > the only exception? Erlang has operators that are alphabetic. X orelse Y really does need the whitespace. And 1.5 is not the same thing as 1 . 5. Handling whitespace is a job for the lexer. Just ensure that the '.' sequence produces an end-of-term token instead of some dot token and treat other unquoted whitespace as a token terminator. Jeff Schultz From norton@REDACTED Wed Dec 21 00:41:04 2011 From: norton@REDACTED (Joseph Norton) Date: Wed, 21 Dec 2011 08:41:04 +0900 Subject: [erlang-questions] Unit testing In-Reply-To: References: Message-ID: <14C7BD11-34CC-450A-AE9F-D0A027D4D5BB@lovely.email.ne.jp> I'd recommend to use QuickCheck (http://www.quviq.com/) and/or PropEr (http://proper.softlab.ntua.gr/) for testing Erlang and non-Erlang applications. Just in case no one else has mentioned either of these tools to you. Joseph Norton On Dec 21, 2011, at 1:43 AM, Yves S. Garret wrote: > Oh and if anyone has personal experience and personal inputs on this subject, that would be awesome and I would love to hear your inputs especially. After doing software development and learning about the software development process, I've found that -- given the general unreliability of software nowadays -- some (any?) form of testing is highly prized in the software development process. > > On Tue, Dec 20, 2011 at 11:38 AM, Yves S. Garret wrote: > Hi all, > > Recently I started working on unit testing for CakePHP and this got met wondering, what unit testing apps are there for Erlang? > > I've found these sources: > http://www.erlang.org/doc/apps/eunit/chapter.html > http://armstrongonsoftware.blogspot.com/2009/01/micro-lightweight-unit-testing.html > > Anything else? Does anyone know if any Erlang programming books out there cover this topic in some detail? > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions -------------- next part -------------- An HTML attachment was scrubbed... URL: From dan@REDACTED Wed Dec 21 00:51:40 2011 From: dan@REDACTED (Daniel Dormont) Date: Tue, 20 Dec 2011 18:51:40 -0500 Subject: [erlang-questions] Are newlines significant in Erlang grammar? In-Reply-To: <20111220233951.GA6833@mulga.csse.unimelb.edu.au> References: <20111220233951.GA6833@mulga.csse.unimelb.edu.au> Message-ID: On Tue, Dec 20, 2011 at 6:39 PM, Jeff Schultz wrote: > On Tue, Dec 20, 2011 at 01:33:18PM -0500, Daniel Dormont wrote: > > Actually that's an interesting point. Is there really no other place in > the > > Erlang grammar where whitespace is required? My gut instinct tells me > there > > must be a few, because every language has a few right? I mean, if nothing > > else to separate two identifiers? But thinking a little more, I realize > > Erlang doesn't have "identifiers" in the sense most other languages do > and > > even then, there's always some sort of punctuation. Is this period > business > > the only exception? > > Erlang has operators that are alphabetic. X orelse Y really does > need the whitespace. And 1.5 is not the same thing as 1 . 5. > > Ah of course. I knew I was missing something. Just a brain fart. > Handling whitespace is a job for the lexer. Just ensure that the '.' > sequence produces an end-of-term token instead of some > dot token and treat other unquoted whitespace as a token terminator. > > > Jeff Schultz > -------------- next part -------------- An HTML attachment was scrubbed... URL: From ok@REDACTED Wed Dec 21 01:14:07 2011 From: ok@REDACTED (Richard O'Keefe) Date: Wed, 21 Dec 2011 13:14:07 +1300 Subject: [erlang-questions] Proposal for new Q&A site in Stack Exchange In-Reply-To: References: Message-ID: <67F2DB17-13E7-4DD7-B568-EB1F4195D4E4@cs.otago.ac.nz> On 20/12/2011, at 10:27 PM, uberdeveloper wrote: > 2) Multi-core architecture is hitting the peak but still most of the > applications don't use even 4 cores (forget nodes). I also researched > a few computer courses offered in colleges(not an extensive research) > and found Distributed, Parallel computing isn't thought critically. I'm a bit puzzled by this. I run a 4th year concurrent programming paper with the ultimate aim of getting some of the concepts pushed earlier. I'm careful to distinguish between parallel computing (using e.g., OpenMP or Cilk, where the number of active threads is an aspect of *implementation*, not an aspect of *design*) and concurrent programming, where process structure is part of the design and often part of the modelling phase. I'm also careful to distinguish between distributed computing (which brings in issues of network reliability and of security) and concurrent programming as such. When I think about all the "middleware" issues in designing distributed systems I get dizzy contemplating all that I'm not able to fit in... So what would "thought critically" involved? I am very keen to improve my paper, I *know* it has a long way to go. There was a number-crunching system done in Erlang, using binaries with embedded tags to hold Matlab-like arrays. Come to think of it, the computer algebra system I've been using lately, SAGE, is written in Python, and delegates to a variety of back ends. From steven.charles.davis@REDACTED Wed Dec 21 01:41:42 2011 From: steven.charles.davis@REDACTED (Steve Davis) Date: Tue, 20 Dec 2011 16:41:42 -0800 (PST) Subject: [erlang-questions] Unit testing In-Reply-To: References: Message-ID: I suspect that the reason testing is less extensively covered in erlang is that it's generally easier (less involved) to accomplish. For apps with little internal state, a simple test() method is usually considered enough (if you look at what people actually do). As the system gains more internal state, people move to eunit, quicktest, test_server etc. It all depends on what's really necessary in practice (rather than observing some notional consideration of required ceremony which, in many circumstances, may be a total waste of everyone's time). /s On Dec 20, 10:38?am, "Yves S. Garret" wrote: > Hi all, > > ? ?Recently I started working on unit testing for CakePHP and this got met > wondering, what unit testing apps are there for Erlang? > > ? ?I've found these sources: > > ? ?1.http://www.erlang.org/doc/apps/eunit/chapter.html > ? ?2. > ? ?http://armstrongonsoftware.blogspot.com/2009/01/micro-lightweight-uni... > > ? ?Anything else? ?Does anyone know if any Erlang programming books out > there cover this topic in some detail? > > _______________________________________________ > erlang-questions mailing list > erlang-questi...@REDACTED://erlang.org/mailman/listinfo/erlang-questions From steven.charles.davis@REDACTED Wed Dec 21 01:43:39 2011 From: steven.charles.davis@REDACTED (Steve Davis) Date: Tue, 20 Dec 2011 16:43:39 -0800 (PST) Subject: [erlang-questions] Unit testing In-Reply-To: References: Message-ID: <353f3ab7-1758-4370-b1d5-d697dc71e7ea@h4g2000yqk.googlegroups.com> wow did i really say test() "method" -- i have spent far too much of my day in java today. On Dec 20, 6:41?pm, Steve Davis wrote: > I suspect that the reason testing is less extensively covered in > erlang is that it's generally easier (less involved) to accomplish. > > For apps with little internal state, a simple test() method is usually > considered enough (if you look at what people actually do). > > As the system gains more internal state, people move to eunit, > quicktest, test_server etc. > > It all depends on what's really necessary in practice (rather than > observing some notional consideration of required ceremony which, in > many circumstances, may be a total waste of everyone's time). > > /s > > On Dec 20, 10:38?am, "Yves S. Garret" > wrote: > > > > > > > > > Hi all, > > > ? ?Recently I started working on unit testing for CakePHP and this got met > > wondering, what unit testing apps are there for Erlang? > > > ? ?I've found these sources: > > > ? ?1.http://www.erlang.org/doc/apps/eunit/chapter.html > > ? ?2. > > ? ?http://armstrongonsoftware.blogspot.com/2009/01/micro-lightweight-uni... > > > ? ?Anything else? ?Does anyone know if any Erlang programming books out > > there cover this topic in some detail? > > > _______________________________________________ > > erlang-questions mailing list > > erlang-questi...@REDACTED://erlang.org/mailman/listinfo/erlang-questions > > _______________________________________________ > erlang-questions mailing list > erlang-questi...@REDACTED://erlang.org/mailman/listinfo/erlang-questions From dave@REDACTED Wed Dec 21 02:23:06 2011 From: dave@REDACTED (David Goehrig) Date: Tue, 20 Dec 2011 20:23:06 -0500 Subject: [erlang-questions] Unit testing In-Reply-To: References: Message-ID: On Dec 20, 2011, at 11:43 AM, "Yves S. Garret" wrote: -- given the general unreliability of software nowadays -- some (any?) form of testing is highly prized in the software development process. --- Well, we use a combination of eunit, some adhoc load generators, and pathogical random event generator scripts. None of this really matters though if you don't properly identify the problem you are solving and characterize the production behavior. Software testing does little in my experience but confirm apriori bias and serve to limit refactoring necessary for proper engineering. If you find yourself hesitating to write an alternative implementation to test a theory, you've written too many tests. If you program follow contract based programming practices, and test only well defined interfaces (and not internal details, also referred to as black box testing) you'll get more bang for your buck. But this usually requires versioning all of your API calls. Hope this helps Dave From chandrashekhar.mullaparthi@REDACTED Wed Dec 21 03:23:36 2011 From: chandrashekhar.mullaparthi@REDACTED (Chandru) Date: Wed, 21 Dec 2011 02:23:36 +0000 Subject: [erlang-questions] Fail fast Message-ID: Hello everyone, I've just had a failure in one of my live services because an erlang node ran out of memory (caused by a traffic spike). Restart mechanisms exist to restart the node, but the node took a long time to die because it was writing a large erl_crash.dump file, and then there was a 7GB core dump. Is there a quicker way to fail? I'm thinking of disabling core dumps entirely on the box. What else can I do? A configuration option on the node to only produce a summary erl_crash.dump would be nice. The most useful things for me in a crash dump usually are the slogan at the top, and the message queue lengths of each process. In this particular case, the slogan would've told me all that I needed to know. Chandru -------------- next part -------------- An HTML attachment was scrubbed... URL: From comptekki@REDACTED Wed Dec 21 04:45:19 2011 From: comptekki@REDACTED (Wes James) Date: Tue, 20 Dec 2011 20:45:19 -0700 Subject: [erlang-questions] got wx working with R15B on OS X Lion Message-ID: How to get wx working in Erlang R15B on OS X Lion. (this is one way, maybe there are others??) 1. install mac ports ( http://www.macports.org/ ) 2. run: sudo port -f install wxwidgets 3. in .bashrc add: export LDFLAGS='-L/opt/local/lib' export CPPFLAGS='-I/opt/local/include' export LD_LIBRARY_PATH=/opt/local/lib export LD_INCLUDE_PATH=/opt/local/include 4. download Erlang R15B from erlang.org or git clone https://github.com/erlang/otp.git 5. in the src folder run: ./otp_build autoconf ./configure make make install (maybe one of the otp_buld options does these three installing in /usr/local ??) 6. run erl 7. run wx:demo(). to check if it runs I saw that there is a mac port of R14B04 that I was going to try next here: http://www.macports.org/ports.php?by=category&substr=erlang But R15B is working now, but with this error when running programs: 2011-12-20 20:26:25.547 beam.smp[28373:e0b] CFURLCreateWithString was passed this invalid URL string: '/Syst\ em/Library/CoreServices/CommonCocoaPanels.bundle' (a file system path instead of an URL string). The URL cre\ ated will not work with most file URL functions. CFURLCreateWithFileSystemPath or CFURLCreateWithFileSystemP\ athRelativeToBase should be used instead. The wx gui debugger is so much better than the xwindow version on OS X Lion. The worst thing was the pin-wheel of death when a window was resized from the bottom right corner. The only resize that would work was clicking on the green maximize button at the top left of a window. -wes From zabrane3@REDACTED Wed Dec 21 08:34:11 2011 From: zabrane3@REDACTED (Zabrane Mickael) Date: Wed, 21 Dec 2011 08:34:11 +0100 Subject: [erlang-questions] Fail fast In-Reply-To: References: Message-ID: > Is there a quicker way to fail? I'm thinking of disabling core dumps entirely on the box. I didn't know that core dumps could be disabled. How? Regards, Zabrane -------------- next part -------------- An HTML attachment was scrubbed... URL: From chandrashekhar.mullaparthi@REDACTED Wed Dec 21 09:31:54 2011 From: chandrashekhar.mullaparthi@REDACTED (Chandru) Date: Wed, 21 Dec 2011 08:31:54 +0000 Subject: [erlang-questions] Fail fast In-Reply-To: References: Message-ID: man coreadm cheers Chandru On 21 December 2011 07:34, Zabrane Mickael wrote: > Is there a quicker way to fail? I'm thinking of disabling core dumps > entirely on the box. > > > I didn't know that *core dumps* could be disabled. How? > > Regards, > Zabrane > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From kuleshovmail@REDACTED Wed Dec 21 10:30:57 2011 From: kuleshovmail@REDACTED (Alexander Kuleshov) Date: Wed, 21 Dec 2011 15:30:57 +0600 Subject: [erlang-questions] Some questions about dialyzer Message-ID: Hello, I run dialyzer for my project. I got: test.erl:97: The created fun has no local return In 97 line i have: List = lists:filter(fun(X) -> {_, _, SomeBoolFlag} = X, SomeBoolFlag == false end, TestList) And also i have message like: test.erl:161: Function test_func/2 will never be called But i have some test_func calls in my code in current file. What's wrong? Thank you. -------------- next part -------------- An HTML attachment was scrubbed... URL: From zabrane3@REDACTED Wed Dec 21 10:58:53 2011 From: zabrane3@REDACTED (Zabrane Mickael) Date: Wed, 21 Dec 2011 10:58:53 +0100 Subject: [erlang-questions] Fail fast In-Reply-To: References: Message-ID: I was expecting and Erlang way to do it. I found this: http://stackoverflow.com/questions/1412365/erlang-how-to-disable-crash-dump-core-dump-generation Regards, Zabrane On Dec 21, 2011, at 9:31 AM, Chandru wrote: > man coreadm > > cheers > Chandru > > On 21 December 2011 07:34, Zabrane Mickael wrote: >> Is there a quicker way to fail? I'm thinking of disabling core dumps entirely on the box. > > I didn't know that core dumps could be disabled. How? > > Regards, > Zabrane > > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions -------------- next part -------------- An HTML attachment was scrubbed... URL: From xavier@REDACTED Wed Dec 21 11:25:03 2011 From: xavier@REDACTED (Xavier Maillard) Date: Wed, 21 Dec 2011 11:25:03 +0100 Subject: [erlang-questions] Erlang Shell History: enabled. In-Reply-To: References: Message-ID: Hi Fred, On Mon, 21 Nov 2011 13:23:25 -0500, Fred Hebert wrote: > last week I was on a bus after work and decided to keep on going with a > small project started at the EUC hackathon -- adding shell history to the > Erlang shell. Sounds like a pretty useful thing ! > I'm presenting the result of the quick hack: > https://github.com/ferd/erlang-history [ ... SNIP ... ] > Let me know what you think of it. Also: enjoy! I have tried it here but here is what I got as soon as I press the UP and DOWN key: =ERROR REPORT==== 21-Dec-2011::00:34:01 === Error in process <0.67.0> with exit value: {undef,[{edlin,current_line,[{line,"1> ",{[],[]},none}]},{group,get_line1,4},{group,get_chars_loop,8},{group,io_request,5},{group,server_loop,3}]} THis happens on a slackware GNU/linux system with Erlang R13. Is it supposed to work with any Erlang OTP release ? Regards /Xavier From aronisstav@REDACTED Wed Dec 21 12:12:25 2011 From: aronisstav@REDACTED (Stavros Aronis) Date: Wed, 21 Dec 2011 03:12:25 -0800 (PST) Subject: [erlang-questions] Some questions about dialyzer In-Reply-To: References: Message-ID: <30431219.73.1324465945941.JavaMail.geo-discussion-forums@vbjs5> Using only the provided code I cannot reproduce this issue. The following module passes the analysis without warnings. -module(test). -export([test/1]). test(TestList) -> lists:filter(fun(X) -> {_, _, SomeBoolFlag} = X, SomeBoolFlag == false end, TestList). Stavros -------------- next part -------------- An HTML attachment was scrubbed... URL: From carlsson.richard@REDACTED Wed Dec 21 12:13:16 2011 From: carlsson.richard@REDACTED (Richard Carlsson) Date: Wed, 21 Dec 2011 12:13:16 +0100 Subject: [erlang-questions] Fail fast In-Reply-To: References: Message-ID: <4EF1BF4C.1010507@gmail.com> On 2011-12-21 03:23, Chandru wrote: > Hello everyone, > > I've just had a failure in one of my live services because an erlang > node ran out of memory (caused by a traffic spike). Restart mechanisms > exist to restart the node, but the node took a long time to die because > it was writing a large erl_crash.dump file, and then there was a 7GB > core dump. > > Is there a quicker way to fail? I'm thinking of disabling core dumps > entirely on the box. What else can I do? A configuration option on the > node to only produce a summary erl_crash.dump would be nice. The most > useful things for me in a crash dump usually are the slogan at the top, > and the message queue lengths of each process. In this particular case, > the slogan would've told me all that I needed to know. > > Chandru Apart from limiting the size of core dumps in the OS, you can set the ERL_CRASH_DUMP* environment variables described at the bottom of the manual page for erl (http://www.erlang.org/doc/man/erl.html) to get some control over the Erlang crash dumps. /Richard From joelr1@REDACTED Wed Dec 21 12:26:14 2011 From: joelr1@REDACTED (Joel Reymont) Date: Wed, 21 Dec 2011 11:26:14 +0000 Subject: [erlang-questions] Some questions about dialyzer In-Reply-To: References: Message-ID: <5BB93E603802434182F21A18294C21F3@gmail.com> You may have an issue in some calls to the function on line 97. Dialyze may have figured out that you are not returning the right tuple for some instance of X. --- Hardcore embedded Linux development http://www.linkedin.com/in/joelreymont Device drivers, firmware and debugging On Wednesday, December 21, 2011 at 9:30 AM, Alexander Kuleshov wrote: > Hello, > > I run dialyzer for my project. I got: > test.erl:97: The created fun has no local return > > In 97 line i have: > > List = lists:filter(fun(X) -> {_, _, SomeBoolFlag} = X, > SomeBoolFlag == false > end, > TestList) > > And also i have message like: > > test.erl:161: Function test_func/2 will never be called > > But i have some test_func calls in my code in current file. > > What's wrong? > > Thank you. > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED (mailto:erlang-questions@REDACTED) > http://erlang.org/mailman/listinfo/erlang-questions From chandrashekhar.mullaparthi@REDACTED Wed Dec 21 12:34:43 2011 From: chandrashekhar.mullaparthi@REDACTED (Chandru) Date: Wed, 21 Dec 2011 11:34:43 +0000 Subject: [erlang-questions] Fail fast In-Reply-To: <4EF1BF4C.1010507@gmail.com> References: <4EF1BF4C.1010507@gmail.com> Message-ID: On 21 December 2011 11:13, Richard Carlsson wrote: > On 2011-12-21 03:23, Chandru wrote: > >> Hello everyone, >> >> I've just had a failure in one of my live services because an erlang >> node ran out of memory (caused by a traffic spike). Restart mechanisms >> exist to restart the node, but the node took a long time to die because >> it was writing a large erl_crash.dump file, and then there was a 7GB >> core dump. >> >> Is there a quicker way to fail? I'm thinking of disabling core dumps >> entirely on the box. What else can I do? A configuration option on the >> node to only produce a summary erl_crash.dump would be nice. The most >> useful things for me in a crash dump usually are the slogan at the top, >> and the message queue lengths of each process. In this particular case, >> the slogan would've told me all that I needed to know. >> >> Chandru >> > > Apart from limiting the size of core dumps in the OS, you can set the > ERL_CRASH_DUMP* environment variables described at the bottom of the > manual page for erl (http://www.erlang.org/doc/**man/erl.html) > to get some control over the Erlang crash dumps. > > That is very useful, thank you. I wasn't aware of that option. cheers Chandru -------------- next part -------------- An HTML attachment was scrubbed... URL: From bourinov@REDACTED Wed Dec 21 13:26:17 2011 From: bourinov@REDACTED (Max Bourinov) Date: Wed, 21 Dec 2011 15:26:17 +0300 Subject: [erlang-questions] Suggestions for easy to use super stable lightweight http server? Message-ID: Hi Erlangers, I am looking for easy to use super stable lightweight http server that supports https. I want to use it for facebook credit stuff integration. It won't be intended to serve normal http traffic like pages etc. I have to be able to configure app path, so it will be called like this: http(s)://host:port/some/path/here/ I thought about webmachine since we use it, but it is too much for my task. Any other suggestions with links? Best regards, Max -------------- next part -------------- An HTML attachment was scrubbed... URL: From mononcqc@REDACTED Wed Dec 21 13:27:26 2011 From: mononcqc@REDACTED (Fred Hebert) Date: Wed, 21 Dec 2011 07:27:26 -0500 Subject: [erlang-questions] Erlang Shell History: enabled. In-Reply-To: References: Message-ID: I've only tested it with R14B03+, none of the prior versions. It apparently doesn't work with older ones. The OS should make no difference as the 'global' module doesn't have anything to do with non-Erlang languages. I don't have older versions of Erlang installed anymore, and unless someone sends in a patch that makes everything play nice, I don't think I'll support it. On Wed, Dec 21, 2011 at 5:25 AM, Xavier Maillard wrote: > Hi Fred, > > On Mon, 21 Nov 2011 13:23:25 -0500, Fred Hebert > wrote: > > > last week I was on a bus after work and decided to keep on going with a > > small project started at the EUC hackathon -- adding shell history to the > > Erlang shell. > > Sounds like a pretty useful thing ! > > > I'm presenting the result of the quick hack: > > https://github.com/ferd/erlang-history > > [ ... SNIP ... ] > > > Let me know what you think of it. Also: enjoy! > > I have tried it here but here is what I got as soon as I press the UP > and DOWN key: > > =ERROR REPORT==== 21-Dec-2011::00:34:01 === > Error in process <0.67.0> with exit value: > {undef,[{edlin,current_line,[{line,"1> > > ",{[],[]},none}]},{group,get_line1,4},{group,get_chars_loop,8},{group,io_request,5},{group,server_loop,3}]} > > THis happens on a slackware GNU/linux system with Erlang R13. Is it > supposed to work with any Erlang OTP release ? > > Regards > > /Xavier > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From bourinov@REDACTED Wed Dec 21 13:33:49 2011 From: bourinov@REDACTED (Max Bourinov) Date: Wed, 21 Dec 2011 15:33:49 +0300 Subject: [erlang-questions] Erlang Shell History: enabled. In-Reply-To: References: Message-ID: Finally it is here! Horray! Best regards, Max On Wed, Dec 21, 2011 at 3:27 PM, Fred Hebert wrote: > I've only tested it with R14B03+, none of the prior versions. It > apparently doesn't work with older ones. The OS should make no difference > as the 'global' module doesn't have anything to do with non-Erlang > languages. > > I don't have older versions of Erlang installed anymore, and unless > someone sends in a patch that makes everything play nice, I don't think > I'll support it. > > On Wed, Dec 21, 2011 at 5:25 AM, Xavier Maillard wrote: > >> Hi Fred, >> >> On Mon, 21 Nov 2011 13:23:25 -0500, Fred Hebert >> wrote: >> >> > last week I was on a bus after work and decided to keep on going with a >> > small project started at the EUC hackathon -- adding shell history to >> the >> > Erlang shell. >> >> Sounds like a pretty useful thing ! >> >> > I'm presenting the result of the quick hack: >> > https://github.com/ferd/erlang-history >> >> [ ... SNIP ... ] >> >> > Let me know what you think of it. Also: enjoy! >> >> I have tried it here but here is what I got as soon as I press the UP >> and DOWN key: >> >> =ERROR REPORT==== 21-Dec-2011::00:34:01 === >> Error in process <0.67.0> with exit value: >> {undef,[{edlin,current_line,[{line,"1> >> >> ",{[],[]},none}]},{group,get_line1,4},{group,get_chars_loop,8},{group,io_request,5},{group,server_loop,3}]} >> >> THis happens on a slackware GNU/linux system with Erlang R13. Is it >> supposed to work with any Erlang OTP release ? >> >> Regards >> >> /Xavier >> >> > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From joelr1@REDACTED Wed Dec 21 13:41:04 2011 From: joelr1@REDACTED (Joel Reymont) Date: Wed, 21 Dec 2011 12:41:04 +0000 Subject: [erlang-questions] Suggestions for easy to use super stable lightweight http server? In-Reply-To: References: Message-ID: <9F76B2D0C7824ADF9AA1269041C7E34F@gmail.com> Did you look at built-in httpd? --- Hardcore embedded Linux development http://www.linkedin.com/in/joelreymont Device drivers, firmware and debugging On Wednesday, December 21, 2011 at 12:26 PM, Max Bourinov wrote: > Hi Erlangers, > > I am looking for easy to use super stable lightweight http server that supports https. I want to use it for facebook credit stuff integration. It won't be intended to serve normal http traffic like pages etc. I have to be able to configure app path, so it will be called like this: http(s)://host:port/some/path/here/ > > I thought about webmachine since we use it, but it is too much for my task. Any other suggestions with links? > > Best regards, > Max > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED (mailto:erlang-questions@REDACTED) > http://erlang.org/mailman/listinfo/erlang-questions From bourinov@REDACTED Wed Dec 21 14:17:55 2011 From: bourinov@REDACTED (Max Bourinov) Date: Wed, 21 Dec 2011 16:17:55 +0300 Subject: [erlang-questions] Suggestions for easy to use super stable lightweight http server? In-Reply-To: <9F76B2D0C7824ADF9AA1269041C7E34F@gmail.com> References: <9F76B2D0C7824ADF9AA1269041C7E34F@gmail.com> Message-ID: Thank you for your feedback. I think I will stick with: https://github.com/ostinelli/misultin Best regards, Max On Wed, Dec 21, 2011 at 3:41 PM, Joel Reymont wrote: > Did you look at built-in httpd? > > --- > Hardcore embedded Linux development > http://www.linkedin.com/in/joelreymont > Device drivers, firmware and debugging > > > > > > > On Wednesday, December 21, 2011 at 12:26 PM, Max Bourinov wrote: > > > Hi Erlangers, > > > > I am looking for easy to use super stable lightweight http server that > supports https. I want to use it for facebook credit stuff integration. It > won't be intended to serve normal http traffic like pages etc. I have to be > able to configure app path, so it will be called like this: > http(s)://host:port/some/path/here/ > > > > I thought about webmachine since we use it, but it is too much for my > task. Any other suggestions with links? > > > > Best regards, > > Max > > > > > > _______________________________________________ > > erlang-questions mailing list > > erlang-questions@REDACTED (mailto:erlang-questions@REDACTED) > > http://erlang.org/mailman/listinfo/erlang-questions > > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From zabrane3@REDACTED Wed Dec 21 14:24:03 2011 From: zabrane3@REDACTED (Zabrane Mickael) Date: Wed, 21 Dec 2011 14:24:03 +0100 Subject: [erlang-questions] Suggestions for easy to use super stable lightweight http server? In-Reply-To: References: <9F76B2D0C7824ADF9AA1269041C7E34F@gmail.com> Message-ID: <71ED113F-89BD-4E7E-8B03-B0F206541DDC@gmail.com> On Dec 21, 2011, at 2:17 PM, Max Bourinov wrote: > Thank you for your feedback. > I think I will stick with: https://github.com/ostinelli/misultin I STRONGLY suggest you cowboy: https://github.com/extend/cowboy A rock solid "Small, fast, modular HTTP server and socket acceptor pool" -------------- next part -------------- An HTML attachment was scrubbed... URL: From bourinov@REDACTED Wed Dec 21 14:34:51 2011 From: bourinov@REDACTED (Max Bourinov) Date: Wed, 21 Dec 2011 16:34:51 +0300 Subject: [erlang-questions] Suggestions for easy to use super stable lightweight http server? In-Reply-To: <71ED113F-89BD-4E7E-8B03-B0F206541DDC@gmail.com> References: <9F76B2D0C7824ADF9AA1269041C7E34F@gmail.com> <71ED113F-89BD-4E7E-8B03-B0F206541DDC@gmail.com> Message-ID: Yeh... Cowboy sounds good, but it has two days old commits on http request functions. This seems not very cool to me... I really afraid to take it to production. Best regards, Max On Wed, Dec 21, 2011 at 4:24 PM, Zabrane Mickael wrote: > > On Dec 21, 2011, at 2:17 PM, Max Bourinov wrote: > > Thank you for your feedback. > I think I will stick with: https://github.com/ostinelli/misultin > > > I STRONGLY suggest you *cowboy*: > https://github.com/extend/cowboy > > A rock solid "Small, fast, modular HTTP server and socket acceptor pool" > -------------- next part -------------- An HTML attachment was scrubbed... URL: From bourinov@REDACTED Wed Dec 21 14:42:06 2011 From: bourinov@REDACTED (Max Bourinov) Date: Wed, 21 Dec 2011 16:42:06 +0300 Subject: [erlang-questions] Suggestions for easy to use super stable lightweight http server? In-Reply-To: References: <9F76B2D0C7824ADF9AA1269041C7E34F@gmail.com> <71ED113F-89BD-4E7E-8B03-B0F206541DDC@gmail.com> Message-ID: And again, after deep consideration webmachine won. Best regards, Max On Wed, Dec 21, 2011 at 4:34 PM, Max Bourinov wrote: > Yeh... Cowboy sounds good, but it has two days old commits on http request > functions. This seems not very cool to me... I really afraid to take it to > production. > > Best regards, > Max > > > > > On Wed, Dec 21, 2011 at 4:24 PM, Zabrane Mickael wrote: > >> >> On Dec 21, 2011, at 2:17 PM, Max Bourinov wrote: >> >> Thank you for your feedback. >> I think I will stick with: https://github.com/ostinelli/misultin >> >> >> I STRONGLY suggest you *cowboy*: >> https://github.com/extend/cowboy >> >> A rock solid "Small, fast, modular HTTP server and socket acceptor pool" >> > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From zabrane3@REDACTED Wed Dec 21 14:39:12 2011 From: zabrane3@REDACTED (Zabrane Mickael) Date: Wed, 21 Dec 2011 14:39:12 +0100 Subject: [erlang-questions] Suggestions for easy to use super stable lightweight http server? In-Reply-To: References: <9F76B2D0C7824ADF9AA1269041C7E34F@gmail.com> <71ED113F-89BD-4E7E-8B03-B0F206541DDC@gmail.com> Message-ID: On Dec 21, 2011, at 2:34 PM, Max Bourinov wrote: > Yeh... Cowboy sounds good, but it has two days old commits on http request functions. Cowboy is actively maintained, that's why. I don't think the changes will break anything. > This seems not very cool to me... I really afraid to take it to production. Maybe Essen (cowboy's author) can comment on that. Regards, Zabrane -------------- next part -------------- An HTML attachment was scrubbed... URL: From thomas.burdick@REDACTED Wed Dec 21 15:01:22 2011 From: thomas.burdick@REDACTED (Tom Burdick) Date: Wed, 21 Dec 2011 08:01:22 -0600 Subject: [erlang-questions] Suggestions for easy to use super stable lightweight http server? In-Reply-To: References: <9F76B2D0C7824ADF9AA1269041C7E34F@gmail.com> <71ED113F-89BD-4E7E-8B03-B0F206541DDC@gmail.com> Message-ID: I've been using cowboy for close to 3 months now for a project. Nothing I've written has had to change. That doesn't mean there is any guarantee things won't change (it isn't 1.x yet after all right?) but I'd say cowboy's api is relatively stable at this point. Loic would know best though! If you like webmachine cowboy has the rest logic from webmachine in it now written in plain english. See cowboy_http_rest.erl. You can pretty much take the webmachine documentation and apply it to cowboy with a few differences. Its also about 2-3x faster in my experience. -Tom On Wed, Dec 21, 2011 at 7:39 AM, Zabrane Mickael wrote: > > On Dec 21, 2011, at 2:34 PM, Max Bourinov wrote: > > Yeh... Cowboy sounds good, but it has two days old commits on http request > functions. > > > Cowboy is actively maintained, that's why. > I don't think the changes will break anything. > > This seems not very cool to me... I really afraid to take it to production. > > > Maybe Essen (cowboy's author) can comment on that. > > Regards, > Zabrane > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > From erlangsiri@REDACTED Wed Dec 21 15:46:26 2011 From: erlangsiri@REDACTED (Siri Hansen) Date: Wed, 21 Dec 2011 15:46:26 +0100 Subject: [erlang-questions] noproc file_server_2 when trying to load boot file In-Reply-To: References: <20111022151836.GE10336@jakstys.lt> Message-ID: Corrected for R15B01 /siri 2011/10/24 Siri Hansen > I agree - systools:make_script should not create the boot file given this > rel file. I'll add a ticket for future implementation. If anyone out there > feels like doing the job, it will be much appreciated (and probably happen > faster). > /siri > > 2011/10/22 Tristan Sloughter > >> I fixed it... My release file was wrong. I had each app listed like: >> >> {kernel,"2.14.5",load}, >> >> But once for each app I removed the ', load' and so just had: >> >> {kernel,"2.14.5",load}, >> >> It works fine. Odd that systools:make_script creates a boot file fine >> though if it can't run it. >> >> Thanks. >> >> >> 2011/10/22 Tristan Sloughter >> >>> And I do see it loaded if I just run 'erl': >>> >>> 1> regs(). >>> >>> ** Registered procs on node nonode@REDACTED ** >>> Name Pid Initial Call >>> Reds Msgs >>> application_controlle <0.6.0> erlang:apply/2 >>> 437 0 >>> code_server <0.19.0> erlang:apply/2 >>> 270601 0 >>> erl_prim_loader <0.3.0> erlang:apply/2 >>> 324250 0 >>> error_logger <0.5.0> gen_event:init_it/6 >>> 220 0 >>> file_server_2 <0.18.0> file_server:init/1 >>> 85 0 >>> global_group <0.17.0> global_group:init/1 >>> 59 0 >>> global_name_server <0.12.0> global:init/1 >>> 50 0 >>> inet_db <0.15.0> inet_db:init/1 >>> 251 0 >>> init <0.0.0> otp_ring0:start/2 >>> 2614 0 >>> kernel_safe_sup <0.28.0> supervisor:kernel/1 >>> 58 0 >>> kernel_sup <0.10.0> supervisor:kernel/1 >>> 1562 0 >>> rex <0.11.0> rpc:init/1 >>> 35 0 >>> standard_error <0.21.0> erlang:apply/2 >>> 9 0 >>> standard_error_sup <0.20.0> supervisor_bridge:standar >>> 41 0 >>> user <0.24.0> group:server/3 >>> 36 0 >>> user_drv <0.23.0> user_drv:server/2 >>> 450 0 >>> >>> 2011/10/22 Tristan Sloughter >>> >>>> Nevermind, file_server module registeres as file_server_2: >>>> >>>> -define(FILE_SERVER, file_server_2). % Registered name >>>> >>>> >>>> 2011/10/22 Tristan Sloughter >>>> >>>>> Though I can point out I actually have no file_server_2... >>>>> >>>>> find ~/otp/ -name *file_server* >>>>> /home/dotcloud/otp/lib/kernel-2.14.4/src/file_server.erl >>>>> /home/dotcloud/otp/lib/kernel-2.14.4/ebin/file_server.beam >>>>> /home/dotcloud/otp/lib/kernel-2.14.5/src/file_server.erl >>>>> /home/dotcloud/otp/lib/kernel-2.14.5/ebin/file_server.beam >>>>> >>>>> Hmm.. >>>>> >>>>> 2011/10/22 Tristan Sloughter >>>>> >>>>>> Right, there isn't much I can do in that respect though since I can't >>>>>> get into a shell when loading the boot file. >>>>>> >>>>>> Thanks, >>>>>> Tristan >>>>>> >>>>>> >>>>>> 2011/10/22 Motiejus Jak?tys >>>>>> >>>>>>> On Sat, Oct 22, 2011 at 10:11:39AM -0500, Tristan Sloughter wrote: >>>>>>> > I have a .rel file and successfully create the boot/script files >>>>>>> with >>>>>>> > systools:make_script but when I try to load the boot file it >>>>>>> crashes with an >>>>>>> > error I can't find reference too anywhere online. Does anyone have >>>>>>> an idea >>>>>>> > on what might be wrong? >>>>>>> > >>>>>>> > $ erl >>>>>>> > Erlang R14B04 (erts-5.8.5) [source] [64-bit] [smp:4:4] [rq:4] >>>>>>> > [async-threads:0] [kernel-poll:false] >>>>>>> > >>>>>>> > Eshell V5.8.5 (abort with ^G) >>>>>>> > 1> systools:make_script("ctdemo", [local]). >>>>>>> > ok >>>>>>> > 2> q(). >>>>>>> > ok >>>>>>> > >>>>>>> > $ erl -boot ctdemo >>>>>>> > {"init terminating in >>>>>>> > >>>>>>> do_boot",{noproc,{gen_server,call,[file_server_2,{open,"./.erlang",[read]},infinity]}}} >>>>>>> >>>>>>> In a nutshell, gen_server is complaining that process file_server_2 >>>>>>> is >>>>>>> not running. >>>>>>> >>>>>>> Check application:loaded_applications(), global_registered_names(), >>>>>>> appmon:start() for troubleshooting. >>>>>>> >>>>>>> Hope this helps >>>>>>> >>>>>>> Motiejus >>>>>>> >>>>>> >>>>>> >>>>> >>>> >>> >> >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://erlang.org/mailman/listinfo/erlang-questions >> >> > -------------- next part -------------- An HTML attachment was scrubbed... URL: From sam@REDACTED Wed Dec 21 15:49:31 2011 From: sam@REDACTED (Samuel Elliott) Date: Wed, 21 Dec 2011 14:49:31 +0000 Subject: [erlang-questions] Suggestions for easy to use super stable lightweight http server? In-Reply-To: References: <9F76B2D0C7824ADF9AA1269041C7E34F@gmail.com> <71ED113F-89BD-4E7E-8B03-B0F206541DDC@gmail.com> Message-ID: An article I wrote a while ago (but I believe it's still current) enumerating erlang's http library offerings. I hope that it is useful: http://lenary.co.uk/erlang/2011/08/erlang-web-libraries/ Sam On Wed, Dec 21, 2011 at 2:01 PM, Tom Burdick wrote: > I've been using cowboy for close to 3 months now for a project. > Nothing I've written has had to change. That doesn't mean there is any > guarantee things won't change (it isn't 1.x yet after all right?) but > I'd say cowboy's api is relatively stable at this point. Loic would > know best though! > > If you like webmachine cowboy has the rest logic from webmachine in it > now written in plain english. See cowboy_http_rest.erl. You can pretty > much take the webmachine documentation and apply it to cowboy with a > few differences. Its also about 2-3x faster in my experience. > > -Tom > > On Wed, Dec 21, 2011 at 7:39 AM, Zabrane Mickael wrote: >> >> On Dec 21, 2011, at 2:34 PM, Max Bourinov wrote: >> >> Yeh... Cowboy sounds good, but it has two days old commits on http request >> functions. >> >> >> Cowboy is actively maintained, that's why. >> I don't think the changes will break anything. >> >> This seems not very cool to me... I really afraid to take it to production. >> >> >> Maybe Essen (cowboy's author) can comment on that. >> >> Regards, >> Zabrane >> >> >> _______________________________________________ >> 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 -- Samuel Elliott sam@REDACTED http://lenary.co.uk/ +44 (0)7891 993 664 From wsanchez@REDACTED Wed Dec 21 15:51:58 2011 From: wsanchez@REDACTED (=?ISO-8859-1?Q?Winston_S=E1nchez?=) Date: Wed, 21 Dec 2011 09:51:58 -0500 Subject: [erlang-questions] Scheme Erlang's develop Message-ID: Can anybody help me recommend me a good scheme for Erlang's develop?? . Something like UML or what type of scheme can I use. Thanks. -------------- next part -------------- An HTML attachment was scrubbed... URL: From anders.nygren@REDACTED Wed Dec 21 16:00:47 2011 From: anders.nygren@REDACTED (Anders Nygren) Date: Wed, 21 Dec 2011 09:00:47 -0600 Subject: [erlang-questions] mnesia crashing in mnesia_log:add_recs Message-ID: Hi We have a system that crashed because it ran out of diskspace. After after removing some files we are not able to start it again. Mnesia keeps crashing with the errors shown below. Any advice on how to get out of this? /Anders Red Hat Enterprise Linux Server release 6.1 (Santiago) Erlang R14B03 (erts-5.8.4) [source] [64-bit] [smp:8:8] [rq:8] [async-threads:0] [hipe] [kernel-poll:false] mnesia 4.4.19 Mnesia(lnp@REDACTED): {load_dcl,schedule} repaired, lost 82 bad bytes =ERROR REPORT==== 21-Dec-2011::09:51:19 === Error in process <0.179.0> on node 'lnp@REDACTED' with exit value: {function_clause,[{mnesia_log ,add_recs,[[{{schedule,{{2011,12,21},{11,11,0}}},{schedule,{{2011,12,21},{11,11,0}}},'\000\000 \000PbW'},{{schedule,{{2011,12,21},{11,12,0}}},{schedule,{{2011,12,21},{11,12,0}},undefined},w rite},{{schedule,{{2011,12,21},{11,12,0}}},{schedule,{{2011,12,21},{11,12,0}}},delete},{{sched ule,{... =ERROR REPORT==== 21-Dec-2011::09:51:23 === Mnesia(lnp@REDACTED): ** ERROR ** (core dumped to file: "/opt/lnp/bin/MnesiaCore.lnp@REDACTED _479083_327855") ** FATAL ** Loader crashed: {function_clause, [{mnesia_log,add_recs, [[{{schedule,{{2011,12,21},{11,11,0}}}, {schedule,{{2011,12,21},{11,11,0}}}, '\000\000\000PbW'}, {{schedule,{{2011,12,21},{11,12,0}}}, {schedule, {{2011,12,21},{11,12,0}}, undefined}, write}, {{schedule,{{2011,12,21},{11,12,0}}}, {schedule,{{2011,12,21},{11,12,0}}}, delete}, {{schedule,{{2011,12,21},{11,13,0}}}, {schedule, {{2011,12,21},{11,13,0}}, undefined}, write}], 42]}, {mnesia_log,insert_logchunk,3}, {mnesia_log,load_dcl,2}, {mnesia_loader,do_get_disc_copy2,4}, {mnesia_controller,disc_load_table,3}, {mnesia_controller,'-load_and_reply/2-fun-0-', 2}]} From dgud@REDACTED Wed Dec 21 16:12:27 2011 From: dgud@REDACTED (Dan Gudmundsson) Date: Wed, 21 Dec 2011 16:12:27 +0100 Subject: [erlang-questions] mnesia crashing in mnesia_log:add_recs In-Reply-To: References: Message-ID: Sounds like a good time to restart from the backup? If you have another node running with an active copy of the table, you can just delete the file schedule.dcl and restart, mnesia will pick up the data anyway from the running node. /Dan On Wed, Dec 21, 2011 at 4:00 PM, Anders Nygren wrote: > Hi > We have a system that crashed because it ran out of diskspace. After > after removing some > files we are not able to start it again. Mnesia keeps crashing with > the errors shown below. > > Any advice on how to get out of this? > > /Anders > > Red Hat Enterprise Linux Server release 6.1 (Santiago) > > Erlang R14B03 (erts-5.8.4) [source] [64-bit] [smp:8:8] [rq:8] > [async-threads:0] [hipe] [kernel-poll:false] > mnesia 4.4.19 > > Mnesia(lnp@REDACTED): {load_dcl,schedule} repaired, lost 82 bad bytes > > =ERROR REPORT==== 21-Dec-2011::09:51:19 === > Error in process <0.179.0> on node 'lnp@REDACTED' with exit value: > {function_clause,[{mnesia_log > ,add_recs,[[{{schedule,{{2011,12,21},{11,11,0}}},{schedule,{{2011,12,21},{11,11,0}}},'\000\000 > \000PbW'},{{schedule,{{2011,12,21},{11,12,0}}},{schedule,{{2011,12,21},{11,12,0}},undefined},w > rite},{{schedule,{{2011,12,21},{11,12,0}}},{schedule,{{2011,12,21},{11,12,0}}},delete},{{sched > ule,{... > > > =ERROR REPORT==== 21-Dec-2011::09:51:23 === > Mnesia(lnp@REDACTED): ** ERROR ** (core dumped to file: > "/opt/lnp/bin/MnesiaCore.lnp@REDACTED > _479083_327855") > ?** FATAL ** Loader crashed: {function_clause, > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?[{mnesia_log,add_recs, > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?[[{{schedule,{{2011,12,21},{11,11,0}}}, > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? {schedule,{{2011,12,21},{11,11,0}}}, > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? '\000\000\000PbW'}, > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?{{schedule,{{2011,12,21},{11,12,0}}}, > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? {schedule, > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?{{2011,12,21},{11,12,0}}, > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?undefined}, > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? write}, > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?{{schedule,{{2011,12,21},{11,12,0}}}, > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? {schedule,{{2011,12,21},{11,12,0}}}, > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? delete}, > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?{{schedule,{{2011,12,21},{11,13,0}}}, > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? {schedule, > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?{{2011,12,21},{11,13,0}}, > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?undefined}, > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? write}], > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? 42]}, > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? {mnesia_log,insert_logchunk,3}, > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? {mnesia_log,load_dcl,2}, > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? {mnesia_loader,do_get_disc_copy2,4}, > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? {mnesia_controller,disc_load_table,3}, > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? {mnesia_controller,'-load_and_reply/2-fun-0-', > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?2}]} > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions From uberdeveloper001@REDACTED Wed Dec 21 16:31:27 2011 From: uberdeveloper001@REDACTED (Ubermensch) Date: Wed, 21 Dec 2011 21:01:27 +0530 Subject: [erlang-questions] Proposal for new Q&A site in Stack Exchange In-Reply-To: <67F2DB17-13E7-4DD7-B568-EB1F4195D4E4@cs.otago.ac.nz> References: <67F2DB17-13E7-4DD7-B568-EB1F4195D4E4@cs.otago.ac.nz> Message-ID: Can you kindly quote what part of my response is puzzling. Multi-core architecture is peaking (so it haven't peaked yet, that's right) and I am extremely sorry that taught has replace thought (typo). Discussing the focal point, I believe the present calibre of CDP programming and its popularity is not in tune with the hardware growth. You rightly pointed out the difference between Concurrent, Distributed and Parallel programming but this difference is not understood by all of the present developers. Regarding my comment about educational institutions, a lot of institutions teach them in a rather monotonic, too much theoretical way (that's my perception) so that its seen as an arcane science. Also, even a lot of new programs leave concurrency to the OS, let alone support for distributed. I am thinking of creating an open source generic research framework , actually a public grid of desktop computers, with rich queries, simulations and fast data analysis using existing python scientific libraries.(Similar to SAGE but with support for more databases, NumPy GUI and a model builder. Thinking on the idea, would do some writing in 15 days ) My main purpose is to decentralize research and High Power Computing from business organizations to the common user and when I went searching, I found a lot of developers awfully short of these concepts. That's why I proposed a Q&A site. To be blatantly honest, I am just a beginner in hands-on programming (I have a decent knowledge about ERP implementations and some basic theoretical computer science) Would require a lot of help from like-minded people like you. It would be better if you could suggest me a few books and a starting list of things. I am now reading Distributed Computing by George Coulouris, have finished a basic book on Parallel Processing, Google Map Reduce papers and Hadoop and a lot of other articles (mostly related to practical implementation of these systems rather than their creation). Also, can you suggest me what and how simulation models and other research data are analyzed by institutions or suggest some resource Thanks for taking the time to write in and would be better if I can add you to your friends list. On Wed, Dec 21, 2011 at 5:44 AM, Richard O'Keefe wrote: > > On 20/12/2011, at 10:27 PM, uberdeveloper wrote: > > 2) Multi-core architecture is hitting the peak but still most of the > > applications don't use even 4 cores (forget nodes). I also researched > > a few computer courses offered in colleges(not an extensive research) > > and found Distributed, Parallel computing isn't thought critically. > > I'm a bit puzzled by this. I run a 4th year concurrent programming > paper with the ultimate aim of getting some of the concepts pushed > earlier. I'm careful to distinguish between parallel computing > (using e.g., OpenMP or Cilk, where the number of active threads is > an aspect of *implementation*, not an aspect of *design*) and > concurrent programming, where process structure is part of the > design and often part of the modelling phase. I'm also careful to > distinguish between distributed computing (which brings in issues > of network reliability and of security) and concurrent programming > as such. > > When I think about all the "middleware" issues in designing distributed > systems I get dizzy contemplating all that I'm not able to fit in... > > So what would "thought critically" involved? I am very keen to improve > my paper, I *know* it has a long way to go. > > There was a number-crunching system done in Erlang, using binaries with > embedded tags to hold Matlab-like arrays. Come to think of it, the > computer algebra system I've been using lately, SAGE, is written in > Python, and delegates to a variety of back ends. > > -- Ubermensch -------------- next part -------------- An HTML attachment was scrubbed... URL: From bourinov@REDACTED Wed Dec 21 16:44:15 2011 From: bourinov@REDACTED (Max Bourinov) Date: Wed, 21 Dec 2011 18:44:15 +0300 Subject: [erlang-questions] base64:decode fails on facebook base64 encoded strings Message-ID: Hi guys, Does anybody knows why base64:decode fails on strings like this: eyJhbGdvcml0aG0iOiJITUFDLVNIQTI1NiIsImNyZWRpdHMiOnsib3JkZXJfZGV0YWlscyI6IntcIm9yZGVyX2lkXCI6Mjg1NTAwMDgxNTAxMTU4LFwiYnV5ZXJcIjoxMDI3NDE5NzkzLFwiYXBwXCI6MTY4MzExOTc2NTgwNDUwLFwicmVjZWl2ZXJcIjoxMDI3NDE5NzkzLFwiYW1vdW50XCI6MSxcInVwZGF0ZV90aW1lXCI6MTMyNDQ3OTA3NixcInRpbWVfcGxhY2VkXCI6MTMyNDQ3OTA3NCxcImRhdGFcIjpcIlwiLFwiaXRlbXNcIjpbe1wiaXRlbV9pZFwiOlwiMFwiLFwidGl0bGVcIjpcIkEgRmFjZWJvb2sgSGF0XCIsXCJkZXNjcmlwdGlvblwiOlwiVGhlIGNvb2xlc3QgaGF0IHlvdSd2ZSBldmVyIHNlZW4uXCIsXCJpbWFnZV91cmxcIjpcImh0dHA6XFxcL1xcXC93d3cuZmFjZWJvb2suY29tXFxcL2ltYWdlc1xcXC9naWZ0c1xcXC83NDAucG5nXCIsXCJwcm9kdWN0X3VybFwiOlwiaHR0cDpcXFwvXFxcL3d3dy5mYWNlYm9vay5jb21cXFwvaW1hZ2VzXFxcL2dpZnRzXFxcLzc0MC5wbmdcIixcInByaWNlXCI6MSxcImRhdGFcIjpcIlwifV0sXCJzdGF0dXNcIjpcInBsYWNlZFwifSIsInN0YXR1cyI6InBsYWNlZCIsIm9yZGVyX2lkIjoyODU1MDAwODE1MDExNTgsInRlc3RfbW9kZSI6MX0sImV4cGlyZXMiOjEzMjQ0ODMyMDAsImlzc3VlZF9hdCI6MTMyNDQ3OTA3Niwib2F1dGhfdG9rZW4iOiJBQUFDWkFGQ1pCVFZXSUJBQzBhYkhWb3dLRWdTVHVOQ3ZDYjRTR21hWkE4STdYc3Z0bXBZZU1hTWx3clNia0U5dkxKTHRldUdraWpNakh4aVpBVWY5am9RcG9aQ3ZWYW9YVUN6N21zU3Bjb0FuWGhKRDVRU0lRIiwidXNlciI6eyJjb3VudHJ5IjoicnUiLCJsb2NhbGUiOiJlbl9VUyIsImFnZSI6eyJtaW4iOjIxfX0sInVzZXJfaWQiOiIxMDI3NDE5NzkzIn0 You can easily decode it with online tool like this: http://www.motobit.com/util/base64-decoder-encoder.asp But lovely Erlang says: ** exception error: no function clause matching base64:decode("Jye", [133,177,157,189,201,165,209,161,180,136,232,137,33,53,5,12, 181,77,33,4,200,212,216,136,176,137,141|...]) in function base64:decode/1 Seems something wrong with pattern matching or what could it be? And most interesting question - how to find a proper work around? Best regards, Max -------------- next part -------------- An HTML attachment was scrubbed... URL: From heinz@REDACTED Wed Dec 21 16:45:41 2011 From: heinz@REDACTED (Heinz N. Gies) Date: Wed, 21 Dec 2011 16:45:41 +0100 Subject: [erlang-questions] Suggestions for easy to use super stable lightweight http server? In-Reply-To: References: <9F76B2D0C7824ADF9AA1269041C7E34F@gmail.com> <71ED113F-89BD-4E7E-8B03-B0F206541DDC@gmail.com> Message-ID: <94664D6F-4834-4020-B2D1-3D5B5416069D@licenser.net> I can double that, cowboy is pretty stable, the changes in the file were AFAIK only improvements to the interface that extended the functionality not change it. Also that said I was using misultin before (admitedly a pretty old version like 6 month old) and updating broke my entire code to a point where migrating was less effort. -- Heinz N. Gies heinz@REDACTED http://licenser.net On Dec 21, 2011, at 15:01, Tom Burdick wrote: > I've been using cowboy for close to 3 months now for a project. > Nothing I've written has had to change. That doesn't mean there is any > guarantee things won't change (it isn't 1.x yet after all right?) but > I'd say cowboy's api is relatively stable at this point. Loic would > know best though! > > If you like webmachine cowboy has the rest logic from webmachine in it > now written in plain english. See cowboy_http_rest.erl. You can pretty > much take the webmachine documentation and apply it to cowboy with a > few differences. Its also about 2-3x faster in my experience. > > -Tom > > On Wed, Dec 21, 2011 at 7:39 AM, Zabrane Mickael wrote: >> >> On Dec 21, 2011, at 2:34 PM, Max Bourinov wrote: >> >> Yeh... Cowboy sounds good, but it has two days old commits on http request >> functions. >> >> >> Cowboy is actively maintained, that's why. >> I don't think the changes will break anything. >> >> This seems not very cool to me... I really afraid to take it to production. >> >> >> Maybe Essen (cowboy's author) can comment on that. >> >> Regards, >> Zabrane >> >> >> _______________________________________________ >> 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 heinz@REDACTED Wed Dec 21 16:52:19 2011 From: heinz@REDACTED (Heinz N. Gies) Date: Wed, 21 Dec 2011 16:52:19 +0100 Subject: [erlang-questions] base64:decode fails on facebook base64 encoded strings In-Reply-To: References: Message-ID: <7A1E31B9-3399-4A5D-AF59-FB1D56E918A5@licenser.net> The reason is that the text is wrong, it misses a tailing '=' character to come to the correct size. The encoded text is expected to be a multiple of 4 bytes in size if your encoded text is 'too short' for that it is supposed to be filled wiht '=' try base64:encode("a") for example :) -- Heinz N. Gies heinz@REDACTED http://licenser.net On Dec 21, 2011, at 16:44, Max Bourinov wrote: > Hi guys, > > Does anybody knows why base64:decode fails on strings like this: > > eyJhbGdvcml0aG0iOiJITUFDLVNIQTI1NiIsImNyZWRpdHMiOnsib3JkZXJfZGV0YWlscyI6IntcIm9yZGVyX2lkXCI6Mjg1NTAwMDgxNTAxMTU4LFwiYnV5ZXJcIjoxMDI3NDE5NzkzLFwiYXBwXCI6MTY4MzExOTc2NTgwNDUwLFwicmVjZWl2ZXJcIjoxMDI3NDE5NzkzLFwiYW1vdW50XCI6MSxcInVwZGF0ZV90aW1lXCI6MTMyNDQ3OTA3NixcInRpbWVfcGxhY2VkXCI6MTMyNDQ3OTA3NCxcImRhdGFcIjpcIlwiLFwiaXRlbXNcIjpbe1wiaXRlbV9pZFwiOlwiMFwiLFwidGl0bGVcIjpcIkEgRmFjZWJvb2sgSGF0XCIsXCJkZXNjcmlwdGlvblwiOlwiVGhlIGNvb2xlc3QgaGF0IHlvdSd2ZSBldmVyIHNlZW4uXCIsXCJpbWFnZV91cmxcIjpcImh0dHA6XFxcL1xcXC93d3cuZmFjZWJvb2suY29tXFxcL2ltYWdlc1xcXC9naWZ0c1xcXC83NDAucG5nXCIsXCJwcm9kdWN0X3VybFwiOlwiaHR0cDpcXFwvXFxcL3d3dy5mYWNlYm9vay5jb21cXFwvaW1hZ2VzXFxcL2dpZnRzXFxcLzc0MC5wbmdcIixcInByaWNlXCI6MSxcImRhdGFcIjpcIlwifV0sXCJzdGF0dXNcIjpcInBsYWNlZFwifSIsInN0YXR1cyI6InBsYWNlZCIsIm9yZGVyX2lkIjoyODU1MDAwODE1MDExNTgsInRlc3RfbW9kZSI6MX0sImV4cGlyZXMiOjEzMjQ0ODMyMDAsImlzc3VlZF9hdCI6MTMyNDQ3OTA3Niwib2F1dGhfdG9rZW4iOiJBQUFDWkFGQ1pCVFZXSUJBQzBhYkhWb3dLRWdTVHVOQ3ZDYjRTR21hWkE4STdYc3Z0bXBZZU1hTWx3clNia0U5dkxKTHRldUdraWpNakh4aVpBVWY5am9RcG9aQ3ZWYW9YVUN6N21zU3Bjb0FuWGhKRDVRU0lRIiwidXNlciI6eyJjb3VudHJ5IjoicnUiLCJsb2NhbGUiOiJlbl9VUyIsImFnZSI6eyJtaW4iOjIxfX0sInVzZXJfaWQiOiIxMDI3NDE5NzkzIn0 > > You can easily decode it with online tool like this: http://www.motobit.com/util/base64-decoder-encoder.asp > > But lovely Erlang says: > > ** exception error: no function clause matching base64:decode("Jye", > [133,177,157,189,201,165,209,161,180,136,232,137,33,53,5,12, > 181,77,33,4,200,212,216,136,176,137,141|...]) > in function base64:decode/1 > > Seems something wrong with pattern matching or what could it be? And most interesting question - how to find a proper work around? > > > Best regards, > Max > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions -------------- next part -------------- An HTML attachment was scrubbed... URL: From heinz@REDACTED Wed Dec 21 16:54:30 2011 From: heinz@REDACTED (Heinz N. Gies) Date: Wed, 21 Dec 2011 16:54:30 +0100 Subject: [erlang-questions] base64:decode fails on facebook base64 encoded strings In-Reply-To: References: Message-ID: <2158D152-D690-4DC1-9E40-7C9D79A24D56@licenser.net> As an addition look closely at the decoding on the webside, it also fails the last two characters are missing unless you add the missing '=' to the base64 encoded data. Regards, Heinz -- Heinz N. Gies heinz@REDACTED http://licenser.net On Dec 21, 2011, at 16:44, Max Bourinov wrote: > Hi guys, > > Does anybody knows why base64:decode fails on strings like this: > > eyJhbGdvcml0aG0iOiJITUFDLVNIQTI1NiIsImNyZWRpdHMiOnsib3JkZXJfZGV0YWlscyI6IntcIm9yZGVyX2lkXCI6Mjg1NTAwMDgxNTAxMTU4LFwiYnV5ZXJcIjoxMDI3NDE5NzkzLFwiYXBwXCI6MTY4MzExOTc2NTgwNDUwLFwicmVjZWl2ZXJcIjoxMDI3NDE5NzkzLFwiYW1vdW50XCI6MSxcInVwZGF0ZV90aW1lXCI6MTMyNDQ3OTA3NixcInRpbWVfcGxhY2VkXCI6MTMyNDQ3OTA3NCxcImRhdGFcIjpcIlwiLFwiaXRlbXNcIjpbe1wiaXRlbV9pZFwiOlwiMFwiLFwidGl0bGVcIjpcIkEgRmFjZWJvb2sgSGF0XCIsXCJkZXNjcmlwdGlvblwiOlwiVGhlIGNvb2xlc3QgaGF0IHlvdSd2ZSBldmVyIHNlZW4uXCIsXCJpbWFnZV91cmxcIjpcImh0dHA6XFxcL1xcXC93d3cuZmFjZWJvb2suY29tXFxcL2ltYWdlc1xcXC9naWZ0c1xcXC83NDAucG5nXCIsXCJwcm9kdWN0X3VybFwiOlwiaHR0cDpcXFwvXFxcL3d3dy5mYWNlYm9vay5jb21cXFwvaW1hZ2VzXFxcL2dpZnRzXFxcLzc0MC5wbmdcIixcInByaWNlXCI6MSxcImRhdGFcIjpcIlwifV0sXCJzdGF0dXNcIjpcInBsYWNlZFwifSIsInN0YXR1cyI6InBsYWNlZCIsIm9yZGVyX2lkIjoyODU1MDAwODE1MDExNTgsInRlc3RfbW9kZSI6MX0sImV4cGlyZXMiOjEzMjQ0ODMyMDAsImlzc3VlZF9hdCI6MTMyNDQ3OTA3Niwib2F1dGhfdG9rZW4iOiJBQUFDWkFGQ1pCVFZXSUJBQzBhYkhWb3dLRWdTVHVOQ3ZDYjRTR21hWkE4STdYc3Z0bXBZZU1hTWx3clNia0U5dkxKTHRldUdraWpNakh4aVpBVWY5am9RcG9aQ3ZWYW9YVUN6N21zU3Bjb0FuWGhKRDVRU0lRIiwidXNlciI6eyJjb3VudHJ5IjoicnUiLCJsb2NhbGUiOiJlbl9VUyIsImFnZSI6eyJtaW4iOjIxfX0sInVzZXJfaWQiOiIxMDI3NDE5NzkzIn0 > > You can easily decode it with online tool like this: http://www.motobit.com/util/base64-decoder-encoder.asp > > But lovely Erlang says: > > ** exception error: no function clause matching base64:decode("Jye", > [133,177,157,189,201,165,209,161,180,136,232,137,33,53,5,12, > 181,77,33,4,200,212,216,136,176,137,141|...]) > in function base64:decode/1 > > Seems something wrong with pattern matching or what could it be? And most interesting question - how to find a proper work around? > > > Best regards, > Max > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions -------------- next part -------------- An HTML attachment was scrubbed... URL: From bourinov@REDACTED Wed Dec 21 17:03:06 2011 From: bourinov@REDACTED (Max Bourinov) Date: Wed, 21 Dec 2011 19:03:06 +0300 Subject: [erlang-questions] base64:decode fails on facebook base64 encoded strings In-Reply-To: <2158D152-D690-4DC1-9E40-7C9D79A24D56@licenser.net> References: <2158D152-D690-4DC1-9E40-7C9D79A24D56@licenser.net> Message-ID: You are right! Thank you! Best regards, Max On Wed, Dec 21, 2011 at 6:54 PM, Heinz N. Gies wrote: > As an addition look closely at the decoding on the webside, it also fails > the last two characters are missing unless you add the missing '=' to the > base64 encoded data. > > Regards, > Heinz > > -- > Heinz N. Gies > heinz@REDACTED > http://licenser.net > > On Dec 21, 2011, at 16:44, Max Bourinov wrote: > > Hi guys, > > Does anybody knows why base64:decode fails on strings like this: > > > eyJhbGdvcml0aG0iOiJITUFDLVNIQTI1NiIsImNyZWRpdHMiOnsib3JkZXJfZGV0YWlscyI6IntcIm9yZGVyX2lkXCI6Mjg1NTAwMDgxNTAxMTU4LFwiYnV5ZXJcIjoxMDI3NDE5NzkzLFwiYXBwXCI6MTY4MzExOTc2NTgwNDUwLFwicmVjZWl2ZXJcIjoxMDI3NDE5NzkzLFwiYW1vdW50XCI6MSxcInVwZGF0ZV90aW1lXCI6MTMyNDQ3OTA3NixcInRpbWVfcGxhY2VkXCI6MTMyNDQ3OTA3NCxcImRhdGFcIjpcIlwiLFwiaXRlbXNcIjpbe1wiaXRlbV9pZFwiOlwiMFwiLFwidGl0bGVcIjpcIkEgRmFjZWJvb2sgSGF0XCIsXCJkZXNjcmlwdGlvblwiOlwiVGhlIGNvb2xlc3QgaGF0IHlvdSd2ZSBldmVyIHNlZW4uXCIsXCJpbWFnZV91cmxcIjpcImh0dHA6XFxcL1xcXC93d3cuZmFjZWJvb2suY29tXFxcL2ltYWdlc1xcXC9naWZ0c1xcXC83NDAucG5nXCIsXCJwcm9kdWN0X3VybFwiOlwiaHR0cDpcXFwvXFxcL3d3dy5mYWNlYm9vay5jb21cXFwvaW1hZ2VzXFxcL2dpZnRzXFxcLzc0MC5wbmdcIixcInByaWNlXCI6MSxcImRhdGFcIjpcIlwifV0sXCJzdGF0dXNcIjpcInBsYWNlZFwifSIsInN0YXR1cyI6InBsYWNlZCIsIm9yZGVyX2lkIjoyODU1MDAwODE1MDExNTgsInRlc3RfbW9kZSI6MX0sImV4cGlyZXMiOjEzMjQ0ODMyMDAsImlzc3VlZF9hdCI6MTMyNDQ3OTA3Niwib2F1dGhfdG9rZW4iOiJBQUFDWkFGQ1pCVFZXSUJBQzBhYkhWb3dLRWdTVHVOQ3ZDYjRTR21hWkE4STdYc3Z0bXBZZU1hTWx3clNia0U5dkxKTHRldUdraWpNakh4aVpBVWY5am9RcG9aQ3ZWYW9YVUN6N21zU3Bjb0FuWGhKRDVRU0lRIiwidXNlciI6eyJjb3VudHJ5IjoicnUiLCJsb2NhbGUiOiJlbl9VUyIsImFnZSI6eyJtaW4iOjIxfX0sInVzZXJfaWQiOiIxMDI3NDE5NzkzIn0 > > You can easily decode it with online tool like this: > http://www.motobit.com/util/base64-decoder-encoder.asp > > But lovely Erlang says: > > ** exception error: no function clause matching base64:decode("Jye", > > [133,177,157,189,201,165,209,161,180,136,232,137,33,53,5,12, > > 181,77,33,4,200,212,216,136,176,137,141|...]) > in function base64:decode/1 > > Seems something wrong with pattern matching or what could it be? And most > interesting question - how to find a proper work around? > > > Best regards, > Max > > > _______________________________________________ > 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 xma@REDACTED Wed Dec 21 17:29:00 2011 From: xma@REDACTED (Xavier Maillard) Date: Wed, 21 Dec 2011 17:29:00 +0100 Subject: [erlang-questions] Erlang Shell History: enabled. In-Reply-To: References: Message-ID: Hi Fred, On Wed, 21 Dec 2011 07:27:26 -0500, Fred Hebert wrote: > I've only tested it with R14B03+, none of the prior versions. It apparently > doesn't work with older ones. The OS should make no difference as the > 'global' module doesn't have anything to do with non-Erlang languages. > > I don't have older versions of Erlang installed anymore, and unless someone > sends in a patch that makes everything play nice, I don't think I'll > support it. I will try to figure out how I can /fix/ this for R13 users. P.S: I have not tested this on my R14 box, yet. /Xavier From ericbmerritt@REDACTED Wed Dec 21 17:36:57 2011 From: ericbmerritt@REDACTED (Eric Merritt) Date: Wed, 21 Dec 2011 11:36:57 -0500 Subject: [erlang-questions] The Core Erlang AST via cerl.erl and Sequence returns from functions Message-ID: Guys, I am currently targeting the Erlang VM for a custom language via core erlang as defined in cerl.erl on R15B. I have run into an interesting issue. In a Let form (cerl:c_let) if I have a sequence of c_vars on the Variable arguement and c_apply (on a function that returns a c_values) in the Argument argument then the erlang compiler exits with an 'error'. However, if I have a c_values directly as the Argument argument the compiler will compile the form. Either I am understanding something incorrectly or this is a bug in the cerl compiler. I am hoping one of the folks that is knowledgeable on the subject can help out. In short the following works: cerl:c_let([cerl:c_var(x0), cerl:c_var(x1)], cerl:c_values([cerl:c_int(0), cerl:c_int(1)]), cerl:c_atom(foo)) while this does not: cerl:c_let([cerl:c_var(x0), cerl:c_var(x1)], cerl:c_apply(cerl:c_fname(my_fun, 0), []), cerl:c_atom(foo)). This was typed from memory, but should be accurate. It is annoying that all the compiler gives me is the atom 'error', not even a stack trace. It makes things more or less impossible to decipher, it just becomes a game of poke and prod. In any case, thanks for your consideration, Eric From roberto@REDACTED Wed Dec 21 18:26:24 2011 From: roberto@REDACTED (Roberto Ostinelli) Date: Wed, 21 Dec 2011 09:26:24 -0800 Subject: [erlang-questions] Suggestions for easy to use super stable lightweight http server? In-Reply-To: <94664D6F-4834-4020-B2D1-3D5B5416069D@licenser.net> References: <9F76B2D0C7824ADF9AA1269041C7E34F@gmail.com> <71ED113F-89BD-4E7E-8B03-B0F206541DDC@gmail.com> <94664D6F-4834-4020-B2D1-3D5B5416069D@licenser.net> Message-ID: hi, misultin author here. misultin has *never* broken backwards compatibility. can you please support such a harsh statement with an example on how upgrading "broke your entire code"? that might be helpful. thank you. r. On Wed, Dec 21, 2011 at 7:45 AM, Heinz N. Gies wrote: > I can double that, > cowboy is pretty stable, the changes in the file were AFAIK only > improvements to the interface that extended the functionality not change > it. Also that said I was using misultin before (admitedly a pretty old > version like 6 month old) and updating broke my entire code to a point > where migrating was less effort. > -- > -------------- next part -------------- An HTML attachment was scrubbed... URL: From bourinov@REDACTED Wed Dec 21 18:46:17 2011 From: bourinov@REDACTED (Max Bourinov) Date: Wed, 21 Dec 2011 21:46:17 +0400 Subject: [erlang-questions] Suggestions for easy to use super stable lightweight http server? In-Reply-To: References: <9F76B2D0C7824ADF9AA1269041C7E34F@gmail.com> <71ED113F-89BD-4E7E-8B03-B0F206541DDC@gmail.com> <94664D6F-4834-4020-B2D1-3D5B5416069D@licenser.net> Message-ID: <-3218789174950718636@unknownmsgid> Hi Roberto, That statement was not about misultin but about our approach in general. Please, don't take it personaly. Actually I like API of misultin. We will use webmachie only because we have experience with it. So, if something will go wrong in one place something similar should be expected everywhere and if everything is alright there are much less chances that something will go wrong because of less code involved in the service delivery process. This is what I believe in. So, I promise if there are any problems with web interface in my project, misultin will be the man and I will write about in this mail list. Sent from my iPhone On 21.12.2011, at 21:26, Roberto Ostinelli wrote: hi, misultin author here. misultin has *never* broken backwards compatibility. can you please support such a harsh statement with an example on how upgrading "broke your entire code"? that might be helpful. thank you. r. On Wed, Dec 21, 2011 at 7:45 AM, Heinz N. Gies wrote: > I can double that, > cowboy is pretty stable, the changes in the file were AFAIK only > improvements to the interface that extended the functionality not change > it. Also that said I was using misultin before (admitedly a pretty old > version like 6 month old) and updating broke my entire code to a point > where migrating was less effort. > -- > _______________________________________________ erlang-questions mailing list erlang-questions@REDACTED http://erlang.org/mailman/listinfo/erlang-questions -------------- next part -------------- An HTML attachment was scrubbed... URL: From august.schwartzwald@REDACTED Wed Dec 21 20:21:35 2011 From: august.schwartzwald@REDACTED (August Schwartzwald) Date: Wed, 21 Dec 2011 20:21:35 +0100 Subject: [erlang-questions] Newbie question about line endings Message-ID: Hi, I started to learn Erlang about a month ago. I really like it and think that with some more practice it will become a both unique and powerful tool in my growing box of programming languages. However, there is one thing about it that I find extremely annoying: The line endings. I currently know 5 programing languages, they have either 0 (python) or 1 way to end lines (usually the ';' character). Erlang totally stands out here and requires that lines are ended in one of 4 different ways. Did some googling without finding any good reason to why the language works in this way. Can anyone here explain this? Thanks From essen@REDACTED Wed Dec 21 20:27:50 2011 From: essen@REDACTED (=?ISO-8859-1?Q?Lo=EFc_Hoguin?=) Date: Wed, 21 Dec 2011 20:27:50 +0100 Subject: [erlang-questions] Newbie question about line endings In-Reply-To: References: Message-ID: <4EF23336.7000000@dev-extend.eu> Erlang functions are beautiful sentences that reply to questions given in the form of arguments through a structurally correct list of statements (elements separated by , ) and branching (elements separated by ; ). , and ; are separators, that's why you don't have one at the last element, and the dot is the end of the sentence. On 12/21/2011 08:21 PM, August Schwartzwald wrote: > Hi, > > I started to learn Erlang about a month ago. I really like it and think > that with some more practice it will become a both unique and powerful > tool in my growing box of programming languages. However, there is one > thing about it that I find extremely annoying: The line endings. > I currently know 5 programing languages, they have either 0 (python) or > 1 way to end lines (usually the ';' character). Erlang totally stands > out here and requires that lines are ended in one of 4 different ways. > > Did some googling without finding any good reason to why the language > works in this way. Can anyone here explain this? > > Thanks > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions -- Lo?c Hoguin Dev:Extend From mononcqc@REDACTED Wed Dec 21 21:40:21 2011 From: mononcqc@REDACTED (Fred Hebert) Date: Wed, 21 Dec 2011 15:40:21 -0500 Subject: [erlang-questions] Newbie question about line endings In-Reply-To: References: Message-ID: The simple answer is 'because Prolog did it that way first'. I have written http://ferd.ca/on-erlang-s-syntax.html to give 2-3 different options on how to read Erlang's line endings in a way that makes sense. Note that considering them 'line ending' is a mistake in the first place. ',' and ';' are separators (they go in-between expressions or constructs, not after them). Only '.' terminates 'forms', which are function declarations and module attributes '-KeyWord(Args)', and expressions in the shell. On Wed, Dec 21, 2011 at 2:21 PM, August Schwartzwald < august.schwartzwald@REDACTED> wrote: > Hi, > > I started to learn Erlang about a month ago. I really like it and think > that with some more practice it will become a both unique and powerful tool > in my growing box of programming languages. However, there is one thing > about it that I find extremely annoying: The line endings. > I currently know 5 programing languages, they have either 0 (python) or 1 > way to end lines (usually the ';' character). Erlang totally stands out > here and requires that lines are ended in one of 4 different ways. > > Did some googling without finding any good reason to why the language > works in this way. Can anyone here explain this? > > Thanks > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From carlsson.richard@REDACTED Wed Dec 21 21:45:31 2011 From: carlsson.richard@REDACTED (Richard Carlsson) Date: Wed, 21 Dec 2011 21:45:31 +0100 Subject: [erlang-questions] The Core Erlang AST via cerl.erl and Sequence returns from functions In-Reply-To: References: Message-ID: <4EF2456B.3060600@gmail.com> On 2011-12-21 17:36, Eric Merritt wrote: > Guys, > > I am currently targeting the Erlang VM for a custom language via core > erlang as defined in cerl.erl on R15B. I have run into an interesting > issue. In a Let form (cerl:c_let) if I have a sequence of c_vars on > the Variable arguement and c_apply (on a function that returns a > c_values) in the Argument argument then the erlang compiler exits with > an 'error'. However, if I have a c_values directly as the Argument > argument the compiler will compile the form. Either I am understanding > something incorrectly or this is a bug in the cerl compiler. I am > hoping one of the folks that is knowledgeable on the subject can help > out. In short the following works: > > cerl:c_let([cerl:c_var(x0), cerl:c_var(x1)], > cerl:c_values([cerl:c_int(0), cerl:c_int(1)]), cerl:c_atom(foo)) > > while this does not: > > cerl:c_int(1)])> > > cerl:c_let([cerl:c_var(x0), cerl:c_var(x1)], > cerl:c_apply(cerl:c_fname(my_fun, 0), []), cerl:c_atom(foo)). Intuitively (and without consulting the source code or my old papers on Core Erlang), I'd say that the latter should work. However, the OTP compiler doesn't try to be complete with respect to all possible Core Erlang programs - it only bothers to implement what's needed to handle code that's first been translated from (full) Erlang. So if you start generating arbitrary but legal Core Erlang, you may run into corner cases (in this case, it seems that multiple return values aren't handled as they ought to be). See if you can find the problem in the compiler - as Calvin's dad used to say, "it builds character". :-) /Richard From zabrane3@REDACTED Wed Dec 21 21:58:16 2011 From: zabrane3@REDACTED (Zabrane Mickael) Date: Wed, 21 Dec 2011 21:58:16 +0100 Subject: [erlang-questions] erlang:error/1 clarification? In-Reply-To: <4EF23336.7000000@dev-extend.eu> References: <4EF23336.7000000@dev-extend.eu> Message-ID: <12D38E66-FFC6-4929-9D98-39927C7D1A5B@gmail.com> Hi, a. On OSX (R14B04 or R15B) 1> erlang:error(badarith). ** exception error: bad argument in an arithmetic expression 2> erlang:error(badarg). ** exception error: bad argument b. On Linux (R14B04) 1> erlang:error(badarith). ** exception error: bad argument in an arithmetic expression in function apply/2 2> erlang:error(badarg). ** exception error: bad argument in function apply/2 Why the error messages are different between OSX and Linux? Regards, Zabrane -------------- next part -------------- An HTML attachment was scrubbed... URL: From roberto@REDACTED Wed Dec 21 22:16:25 2011 From: roberto@REDACTED (Roberto Ostinelli) Date: Wed, 21 Dec 2011 13:16:25 -0800 Subject: [erlang-questions] Suggestions for easy to use super stable lightweight http server? In-Reply-To: <-3218789174950718636@unknownmsgid> References: <9F76B2D0C7824ADF9AA1269041C7E34F@gmail.com> <71ED113F-89BD-4E7E-8B03-B0F206541DDC@gmail.com> <94664D6F-4834-4020-B2D1-3D5B5416069D@licenser.net> <-3218789174950718636@unknownmsgid> Message-ID: On Wed, Dec 21, 2011 at 9:46 AM, Max Bourinov wrote: > Hi Roberto, > > That statement was not about misultin but about our approach in general. > Please, don't take it personaly. Actually I like API of misultin. > > We will use webmachie only because we have experience with it. So, if > something will go wrong in one place something similar should be expected > everywhere and if everything is alright there are much less chances that > something will go wrong because of less code involved in the service > delivery process. This is what I believe in. > > So, I promise if there are any problems with web interface in my project, > misultin will be the man and I will write about in this mail list. > Hi Max, I think you misunderstood me, I was not referring to your email. A library choice is obviously in developer's hands, who choose one for its features, performance, code usability, and such. I think only good things of webmachine, mochiweb, yaws, and cowboy. Instead, I was referring to Heinz [snippet of his email]: On Wed, Dec 21, 2011 at 7:45 AM, Heinz N. Gies wrote: > I was using misultin before (admitedly a pretty old version like 6 month > old) and updating broke my entire code to a point where migrating was less > effort. I've dedicated a lot of attention in not breaking backwards compatibility on misultin. Since AFAIK Heinz did not file any issues regarding this (I do realize that actually contributing to an open source project is much more time consuming than just plain stating opinions on a mailing list), I'm just curious to have some feedback on how that could happen, should Heinz be willing to share that information with me. I just don't like receiving public criticism of my work in this way, as I always hope to get constructive criticism. Otherwise, I might as well just keep my source closed, for that matters. r. -------------- next part -------------- An HTML attachment was scrubbed... URL: From xma@REDACTED Wed Dec 21 22:58:22 2011 From: xma@REDACTED (Xavier Maillard) Date: Wed, 21 Dec 2011 22:58:22 +0100 Subject: [erlang-questions] Erlang Shell History: enabled. In-Reply-To: References: Message-ID: On Wed, 21 Dec 2011 15:33:49 +0300, Max Bourinov wrote: > Finally it is here! Horray! Same here with R14 (I should take time to upgrade my computer from time to time... :D). Anyway, I confirm, this is just AWESOME ! Good job Fred ! /Xavier From ericbmerritt@REDACTED Wed Dec 21 23:05:50 2011 From: ericbmerritt@REDACTED (Eric B Merritt) Date: Wed, 21 Dec 2011 17:05:50 -0500 Subject: [erlang-questions] erlang package manager In-Reply-To: References: <0187e794-3de5-4e66-aa89-c613931e6fe3@u5g2000vbd.googlegroups.com> Message-ID: <1324505150.17562.4.camel@localhost.localdomain> Hello all, I am one of the maintainers of erlware and the principle sinan guy, see responses inline. > In terms of building your code, there isn't much difference really. In > terms of package management, there's a big difference. The Erlware > tool chain relies on a custom repository that holds binary (i.e., > pre-built) artefacts and fetches the right ones for your system (based > on OTP/erts version, OS, etc) - this is a good thing IMHO as I like > just grabbing a thing once and not having to worry about the build > steps, incompatibilities in build config, etc. The down side of the > Erlware stack is that it hasn't been heavily adopted, so not that many > of the libs/apps you want are available through the package manager. > There are ways around this, but it's put me off to date. We have actually deprecated the package management side of the tool chain. Sinan is now delivered was an escript and does not rely on faxien at all. Not that that is sinan relies on the dependencies to be available in on your system in either the normal place or user configurable one. How you get them down is 100% up to you. It will probably stay that way until a clear winner in the package management space appears. > > Now rebar on the other hand, doesn't do *package management* as such. > It has a facility for fetching dependencies from the internet using > version control tools (git, mercurial, subversion, bazaar) and puts > these into a local build folder. All the commands you run at the top > level basically recurse into the dependencies folder(s), so running > `rebar get-deps compile` will fetch the stuff the build config needs > and compile everything. > > > There are other tools out there that do package management of sorts, > agner probably being the most heavily adopted, but also there is sutro > and epm. Of these, only agner integrates with rebar. > > > There appears to be an effort by the erlware guys to produce another > package manager that supports rebar and sinan based builds - they have > repos on github and I'm sure will comment on this. There where a few exploratory efforts in that direction before we deprecated the package management side of things. However, it just did not seem worthwhile. > > There is also meant to be a successor to cean coming out soon, which > will probably be quite similar in spirit (support numerous build tools > and/or dependency management strategies) but we heard about it on the > list some time ago and it hasn't materialised yet - > see http://erlang.org/pipermail/erlang-questions/2011-June/059195.html. I do hope that the major players will collaborate if only to standardise their configuration handling, as it'd be nice to *write once, install using anything* as it were. > > > I have been considering hacking together an alternative dependency > manager for rebar, but I'm waiting to see if cean 2.0 comes out soon > and how well it is adopted (or whether it will fetch stuff from > alternative locations besides the main artefact repository). > > > Hope that's a useful start - I'm sure lots of others will pipe up > about this as it's a popular topic. > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions From ericbmerritt@REDACTED Wed Dec 21 23:06:59 2011 From: ericbmerritt@REDACTED (Eric B Merritt) Date: Wed, 21 Dec 2011 17:06:59 -0500 Subject: [erlang-questions] erlang package manager In-Reply-To: <271fbb49-f6de-4688-a737-64d713d8d291@z17g2000vbe.googlegroups.com> References: <0187e794-3de5-4e66-aa89-c613931e6fe3@u5g2000vbd.googlegroups.com> <271fbb49-f6de-4688-a737-64d713d8d291@z17g2000vbe.googlegroups.com> Message-ID: <1324505219.17562.5.camel@localhost.localdomain> I am really interested in feedback on Sinan the latest sinan. Let me know if you run into issues and what those issues might be. Thanks, Eric On Mon, 2011-12-19 at 08:45 -0800, eigenfunction wrote: > Thank you for the detailed break down. After playing with sinan and > rebar, > i tend to like sinan more. Of course, my view might change as i > become > more experience with the tool. I have tried to stay away from maven, > since java build tools usually give me nightmares. But since you use > rebar > and package your stuff maven style, i am going to bring maven back > into the equation since > i already know how it works. > > > On Dec 19, 2:44 am, Tim Watson wrote: > > On 18 December 2011 18:56, eigenfunction wrote: > > > > > Hi everybody, > > > I have been doing some erlang programming recently and have always > > > generated the release manually and never really used neither rebar nor > > > sinan. It seems like most people in the community have settled for > > > rebar. Before i spend the next couple of days playing with those > > > tools, can someone pls give me a quick recap on the differences > > > between both? > > > > In terms of building your code, there isn't much difference really. In > > terms of package management, there's a big difference. The Erlware tool > > chain relies on a custom repository that holds binary (i.e., pre-built) > > artefacts and fetches the right ones for your system (based on OTP/erts > > version, OS, etc) - this is a good thing IMHO as I like just grabbing a > > thing once and not having to worry about the build steps, incompatibilities > > in build config, etc. The down side of the Erlware stack is that it hasn't > > been heavily adopted, so not that many of the libs/apps you want are > > available through the package manager. There are ways around this, but it's > > put me off to date. > > > > Now rebar on the other hand, doesn't do *package management* as such. It > > has a facility for fetching dependencies from the internet using version > > control tools (git, mercurial, subversion, bazaar) and puts these into a > > local build folder. All the commands you run at the top level basically > > recurse into the dependencies folder(s), so running `rebar get-deps > > compile` will fetch the stuff the build config needs and compile everything. > > > > There are other tools out there that do package management of sorts, agner > > probably being the most heavily adopted, but also there is sutro and epm. > > Of these, only agner integrates with rebar. > > > > There appears to be an effort by the erlware guys to produce another > > package manager that supports rebar and sinan based builds - they have > > repos on github and I'm sure will comment on this. > > > > There is also meant to be a successor to cean coming out soon, which will > > probably be quite similar in spirit (support numerous build tools and/or > > dependency management strategies) but we heard about it on the list some > > time ago and it hasn't materialised yet - seehttp://erlang.org/pipermail/erlang-questions/2011-June/059195.html. I do > > hope that the major players will collaborate if only to standardise their > > configuration handling, as it'd be nice to *write once, install using > > anything* as it were. > > > > I have been considering hacking together an alternative dependency manager > > for rebar, but I'm waiting to see if cean 2.0 comes out soon and how well > > it is adopted (or whether it will fetch stuff from alternative locations > > besides the main artefact repository). > > > > Hope that's a useful start - I'm sure lots of others will pipe up about > > this as it's a popular topic. > > > > _______________________________________________ > > erlang-questions mailing list > > erlang-questi...@REDACTED://erlang.org/mailman/listinfo/erlang-questions > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions From ericbmerritt@REDACTED Wed Dec 21 23:09:01 2011 From: ericbmerritt@REDACTED (Eric B Merritt) Date: Wed, 21 Dec 2011 17:09:01 -0500 Subject: [erlang-questions] The Core Erlang AST via cerl.erl and Sequence returns from functions In-Reply-To: <4EF2456B.3060600@gmail.com> References: <4EF2456B.3060600@gmail.com> Message-ID: <1324505341.17562.6.camel@localhost.localdomain> Richard, Thanks, Its good to know that its not me misunderstanding things. I will see if I can dig into the compiler here in the next couple of days and submit a patch to the patches list. Eric On Wed, 2011-12-21 at 21:45 +0100, Richard Carlsson wrote: > On 2011-12-21 17:36, Eric Merritt wrote: > > Guys, > > > > I am currently targeting the Erlang VM for a custom language via core > > erlang as defined in cerl.erl on R15B. I have run into an interesting > > issue. In a Let form (cerl:c_let) if I have a sequence of c_vars on > > the Variable arguement and c_apply (on a function that returns a > > c_values) in the Argument argument then the erlang compiler exits with > > an 'error'. However, if I have a c_values directly as the Argument > > argument the compiler will compile the form. Either I am understanding > > something incorrectly or this is a bug in the cerl compiler. I am > > hoping one of the folks that is knowledgeable on the subject can help > > out. In short the following works: > > > > cerl:c_let([cerl:c_var(x0), cerl:c_var(x1)], > > cerl:c_values([cerl:c_int(0), cerl:c_int(1)]), cerl:c_atom(foo)) > > > > while this does not: > > > > > cerl:c_int(1)])> > > > > cerl:c_let([cerl:c_var(x0), cerl:c_var(x1)], > > cerl:c_apply(cerl:c_fname(my_fun, 0), []), cerl:c_atom(foo)). > > Intuitively (and without consulting the source code or my old papers on > Core Erlang), I'd say that the latter should work. However, the OTP > compiler doesn't try to be complete with respect to all possible Core > Erlang programs - it only bothers to implement what's needed to handle > code that's first been translated from (full) Erlang. So if you start > generating arbitrary but legal Core Erlang, you may run into corner > cases (in this case, it seems that multiple return values aren't handled > as they ought to be). See if you can find the problem in the compiler - > as Calvin's dad used to say, "it builds character". :-) > > /Richard > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions From xavier@REDACTED Wed Dec 21 23:46:38 2011 From: xavier@REDACTED (Xavier Maillard) Date: Wed, 21 Dec 2011 23:46:38 +0100 Subject: [erlang-questions] Erlang wallpaper In-Reply-To: References: Message-ID: On Fri, 16 Dec 2011 18:25:29 +0000, Aidan Hobson Sayers wrote: > If you prefer a blurry logo to a pixelated one, it vectorised and scaled > up acceptably after a quick attempt - > http://dl.dropbox.com/u/4496620/erlang_logo_large.png (2048x1741) It looks pretty good here. Thank you /Xavier From xavier@REDACTED Wed Dec 21 23:56:01 2011 From: xavier@REDACTED (Xavier Maillard) Date: Wed, 21 Dec 2011 23:56:01 +0100 Subject: [erlang-questions] Erlang wallpaper In-Reply-To: References: <20111219051423.GL298@aluminum.motivity.ca> Message-ID: On Mon, 19 Dec 2011 07:13:22 -0500, Fred Hebert wrote: > I think the logo is very nice and aged well. I agree with you. It still looks pretty /modern/. I do not see any reason to change it for something more modern. /Xavier From zabrane3@REDACTED Thu Dec 22 00:52:41 2011 From: zabrane3@REDACTED (Zabrane Mickael) Date: Thu, 22 Dec 2011 00:52:41 +0100 Subject: [erlang-questions] Continuous Integration and Release Management for Erlang projects Message-ID: Hi, Is there something equivalent to: Bambou: http://www.atlassian.com/software/bamboo/ or Jenkins: http://jenkins-ci.org/ for Erlang projects! Regards, Zabrane -------------- next part -------------- An HTML attachment was scrubbed... URL: From zabrane3@REDACTED Thu Dec 22 01:13:17 2011 From: zabrane3@REDACTED (Zabrane Mickael) Date: Thu, 22 Dec 2011 01:13:17 +0100 Subject: [erlang-questions] Continuous Integration and Release Management for Erlang projects In-Reply-To: References: Message-ID: <8F9DBD3E-F6CD-4ECB-A451-4516DAE5B871@gmail.com> I found Travis CI which seems to support Erlang: http://about.travis-ci.org/docs/user/languages/erlang/ The etorrent project is already there: http://travis-ci.org/#!/jlouis/etorrent I'd like to know if you could share your experience (etorrent) guys? Regards, Zabrane On Dec 22, 2011, at 12:52 AM, Zabrane Mickael wrote: > Hi, > > Is there something equivalent to: > Bambou: http://www.atlassian.com/software/bamboo/ > or > Jenkins: http://jenkins-ci.org/ > > for Erlang projects! > > Regards, > Zabrane > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions -------------- next part -------------- An HTML attachment was scrubbed... URL: From jwatte@REDACTED Thu Dec 22 01:19:26 2011 From: jwatte@REDACTED (Jon Watte) Date: Wed, 21 Dec 2011 16:19:26 -0800 Subject: [erlang-questions] Continuous Integration and Release Management for Erlang projects In-Reply-To: <8F9DBD3E-F6CD-4ECB-A451-4516DAE5B871@gmail.com> References: <8F9DBD3E-F6CD-4ECB-A451-4516DAE5B871@gmail.com> Message-ID: Most integration servers will simply allow you to trigger scripts when commits are made in source control, and then check the exit status of that script for success/failure. We use the buildbot project for all of our build automation at IMVU, which spans half a dozen languages, including Erlang. The script is basically "svn update" followed by "make test-all" so all the Erlang-specific work happens in the make system. Sincerely, jw -- Americans might object: there is no way we would sacrifice our living standards for the benefit of people in the rest of the world. Nevertheless, whether we get there willingly or not, we shall soon have lower consumption rates, because our present rates are unsustainable. On Wed, Dec 21, 2011 at 4:13 PM, Zabrane Mickael wrote: > I found *Travis CI* which seems to support Erlang: > http://about.travis-ci.org/docs/user/languages/erlang/ > > The *etorrent* project is already there: > http://travis-ci.org/#!/jlouis/etorrent > > I'd like to know if you could share your experience (*etorrent*) guys? > > Regards, > Zabrane > > > On Dec 22, 2011, at 12:52 AM, Zabrane Mickael wrote: > > Hi, > > Is there something equivalent to: > *Bambou*: http://www.atlassian.com/software/bamboo/ > or > *Jenkins*: http://jenkins-ci.org/ > > for Erlang projects! > > Regards, > Zabrane > > _______________________________________________ > 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 zabrane3@REDACTED Thu Dec 22 01:21:58 2011 From: zabrane3@REDACTED (Zabrane Mickael) Date: Thu, 22 Dec 2011 01:21:58 +0100 Subject: [erlang-questions] Continuous Integration and Release Management for Erlang projects In-Reply-To: References: <8F9DBD3E-F6CD-4ECB-A451-4516DAE5B871@gmail.com> Message-ID: <40ED2210-F517-4FEB-8F74-633252353F75@gmail.com> Hi John, Thanks for sharing. Is buildbot easy to use, easy to install, and fast? We're looking for something in this spirit. N.B: unfortunately, Travis-CI seems to be usable only online. Regards, Zabrane On Dec 22, 2011, at 1:19 AM, Jon Watte wrote: > Most integration servers will simply allow you to trigger scripts when commits are made in source control, and then check the exit status of that script for success/failure. > > We use the buildbot project for all of our build automation at IMVU, which spans half a dozen languages, including Erlang. The script is basically "svn update" followed by "make test-all" so all the Erlang-specific work happens in the make system. > > Sincerely, > > jw > > > -- > Americans might object: there is no way we would sacrifice our living standards for the benefit of people in the rest of the world. Nevertheless, whether we get there willingly or not, we shall soon have lower consumption rates, because our present rates are unsustainable. > > > > On Wed, Dec 21, 2011 at 4:13 PM, Zabrane Mickael wrote: > I found Travis CI which seems to support Erlang: > http://about.travis-ci.org/docs/user/languages/erlang/ > > The etorrent project is already there: > http://travis-ci.org/#!/jlouis/etorrent > > I'd like to know if you could share your experience (etorrent) guys? > > Regards, > Zabrane > > > On Dec 22, 2011, at 12:52 AM, Zabrane Mickael wrote: > >> Hi, >> >> Is there something equivalent to: >> Bambou: http://www.atlassian.com/software/bamboo/ >> or >> Jenkins: http://jenkins-ci.org/ >> >> for Erlang projects! >> >> Regards, >> Zabrane >> >> _______________________________________________ >> 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 demeshchuk@REDACTED Thu Dec 22 06:50:47 2011 From: demeshchuk@REDACTED (Dmitry Demeshchuk) Date: Thu, 22 Dec 2011 09:50:47 +0400 Subject: [erlang-questions] Ability to add app directories explicitly for reltool In-Reply-To: References: Message-ID: Hi, Garret. Thanks, didn't think about the problem this way. This is much easier than making a rebar plugin :) Still, it clearly seems like a workaround too. Generally, you have one core application and multiple dependencies in a project, or at least so tells me my experience. These dependencies may be either independent applications (gproc, gen_bunny or whatever) or module libraries. (Of course, there are some exceptions of such a scheme, modern Riak for example, but there aren't many of them) And this is exactly why most of the open-source projects have the same directory structure as I described in my first email. Putting source code into another directory is not a big deal, of course, but it's slightly less convenient and more confusing. We can force these projects to do "git mkdir && git mv && git commit" (not a big deal, would take less than a minute), or even to do nothing (how many people like and use OTP upgrades?). Or we can add to reltool an ability to understand their projects structure, and structure of future 1000 projects. On Tue, Dec 20, 2011 at 11:25 PM, Garret Smith wrote: > My rebar/reltool setup is doing close to what you describe as the "ideal" > way. > > Relevant project structure is: > > apps/ > ??? app1 > ??? app2 > > deps/ > ? ? > > rel/ > ??? reltool.config > > My rebar.config looks like: > {lib_dirs, ["apps"]}. > > {sub_dirs, [ > ??????? "apps/app1", > ??????? "apps/app2", > ??????? "rel"]}. > > {deps, [...]}. > > My reltool.config looks like (cut-n-pasted pieces here): > > {sys, [ > ?????? {lib_dirs, ["../apps", "../deps"]}, > ?????? {rel, "start", "1", > ??????? [ > ???????? app1, > ???????? app2, > ???????? dependent_app1, > ???????? dependent_app1 > ??????? ]}, > ?????? {rel, "start_clean", "", > ??????? [ > ???????? kernel, > ???????? stdlib > ??????? ]}, > ?????? {app, app1, [{incl_cond, include}]}, > ?????? {app, app1, [{incl_cond, include}]}, > ?????? {app, dependent_app1, [{incl_cond, include}]}, > ?????? {app, dependent_app2, [{incl_cond, include}]} > }. > > > With this setup, rebar & reltool take the apps under apps/ and deps/ and > creates a target release for me. > > Is this what you are looking for? > > -Garret > > On Tue, Dec 20, 2011 at 11:12 AM, Dmitry Demeshchuk > wrote: >> >> Hello, Siri and everyone. >> >> Recently I've been trying to start using OTP releases in our projects >> with help of rebar. However, I faced the following problem. >> >> Rebar expects that *all* Erlang code resides in some directory >> (generally, "deps" folder) or several directories. This is a reltool >> strict requirement, as far as I understand. Unlike, Riak, all our >> applications have the following directory structure: >> >> . >> .. >> deps/ >> ebin/ >> include/ >> priv/ >> src/ >> >> So, we pull some libraries (and sometimes smaller applications) as >> deps, but the main application's code resides in the root application >> folder. And there's no way to make reltool include this code into the >> generated release, or at least I don't see it. >> >> For now, there are 2 ways for me to solve this without affecting reltool >> itself: >> >> 1. For all apps, make another repository that just pulls our >> application and all its deps, so the actual application code resides >> in the deps/ dir as well, and generate the release package from it. >> However, this seems like an overhead to me. Moreover, this isn't >> convenient for development. >> >> 2. I made a hack that creates symlinks in the deps/ dir, so that it >> seems to reltool that the core application actually resides in the >> deps/ folder, so it's included into the release. Obviously, this is >> kinda ugly and potentially buggy, forget total Windows >> incompatibility. Initially, this was a pull request to rebar but after >> some thinking me and one of rebar's maintainers agreed that it's >> better to make this code a rebar plugin. >> >> So, as you can see, both of the solutions aren't perfect. The ideal >> way I can see is an ability to set explicit app directories in >> reltool.config, like: >> >> {explicit_app_dirs, ["/apps/myapp1"]}. >> >> Probably, it won't make any other use besides the problem I'm >> describing here, but at least it's quite general and doesn't seem like >> a hack. Maybe there's a better way that I didn't come up with. Or >> maybe reltool can do what I want, and I just don't know about such an >> ability. >> >> This seems like a very useful feature. I know that many people use >> just the same directory structure in their projects. Also, rebar >> maintainers already gave me their +1 to this. I'll be glad to work on >> the patch if we come up with a good solution. >> >> Thank you. >> >> >> -- >> Best regards, >> Dmitry Demeshchuk >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://erlang.org/mailman/listinfo/erlang-questions > > -- Best regards, Dmitry Demeshchuk From jack@REDACTED Thu Dec 22 07:07:04 2011 From: jack@REDACTED (Jack Moffitt) Date: Wed, 21 Dec 2011 23:07:04 -0700 Subject: [erlang-questions] Continuous Integration and Release Management for Erlang projects In-Reply-To: References: Message-ID: > Jenkins:?http://jenkins-ci.org/ > > for Erlang projects! Jenkins works easily with Erlang, basically no configuration needed. It essentially just runs whatever commands you specify to build and test the code, and it's quite easy to tell it to run rebar or make or whatever you fancy. We use it (and its Github plugins) everyday to do continuous integration of code at Grey Area. jack. From bourinov@REDACTED Thu Dec 22 07:34:42 2011 From: bourinov@REDACTED (Max Bourinov) Date: Thu, 22 Dec 2011 09:34:42 +0300 Subject: [erlang-questions] Suggestions for easy to use super stable lightweight http server? In-Reply-To: References: <9F76B2D0C7824ADF9AA1269041C7E34F@gmail.com> <71ED113F-89BD-4E7E-8B03-B0F206541DDC@gmail.com> <94664D6F-4834-4020-B2D1-3D5B5416069D@licenser.net> <-3218789174950718636@unknownmsgid> Message-ID: Hi Roberto, I agree with you. I know what does it involves to manage open source project. I do really appreciate with you do for community. Best regards, Max On Thu, Dec 22, 2011 at 12:16 AM, Roberto Ostinelli wrote: > On Wed, Dec 21, 2011 at 9:46 AM, Max Bourinov wrote: > >> Hi Roberto, >> >> That statement was not about misultin but about our approach in general. >> Please, don't take it personaly. Actually I like API of misultin. >> >> We will use webmachie only because we have experience with it. So, if >> something will go wrong in one place something similar should be expected >> everywhere and if everything is alright there are much less chances that >> something will go wrong because of less code involved in the service >> delivery process. This is what I believe in. >> >> So, I promise if there are any problems with web interface in my project, >> misultin will be the man and I will write about in this mail list. >> > > > Hi Max, > > I think you misunderstood me, I was not referring to your email. A library > choice is obviously in developer's hands, who choose one for its features, > performance, code usability, and such. I think only good things of > webmachine, mochiweb, yaws, and cowboy. > > Instead, I was referring to Heinz [snippet of his email]: > > On Wed, Dec 21, 2011 at 7:45 AM, Heinz N. Gies wrote: > >> I was using misultin before (admitedly a pretty old version like 6 month >> old) and updating broke my entire code to a point where migrating was less >> effort. > > > > I've dedicated a lot of attention in not breaking backwards compatibility > on misultin. Since AFAIK Heinz did not file any issues regarding this (I do > realize that actually contributing to an open source project is much more > time consuming than just plain stating opinions on a mailing list), I'm > just curious to have some feedback on how that could happen, should Heinz > be willing to share that information with me. > > I just don't like receiving public criticism of my work in this way, as I > always hope to get constructive criticism. Otherwise, I might as well just > keep my source closed, for that matters. > > r. > -------------- next part -------------- An HTML attachment was scrubbed... URL: From kostis@REDACTED Thu Dec 22 08:17:26 2011 From: kostis@REDACTED (Kostis Sagonas) Date: Thu, 22 Dec 2011 09:17:26 +0200 Subject: [erlang-questions] Some questions about dialyzer In-Reply-To: <4EF26B4B.40104@cs.ntua.gr> References: <4EF26B4B.40104@cs.ntua.gr> Message-ID: <4EF2D986.5010403@cs.ntua.gr> On 12/21/11 11:30, Alexander Kuleshov wrote: > Hello, > > I run dialyzer for my project. I got: > test.erl:97: The created fun has no local return > > In 97 line i have: > > List = lists:filter(fun(X) -> {_, _, SomeBoolFlag} = X, > SomeBoolFlag == false > end, > TestList) > > And also i have message like: > > test.erl:161: Function test_func/2 will never be called > > But i have some test_func calls in my code in current file. > > What's wrong? As others wrote, you do not provide enough information for others to help you. My guess is that dialyzer has discovered that your TestList contains data structures other than 3-tuples so it discovers that the matching will fail. But let me also comment on your filter function. Do you really want to write: fun(X) -> {_, _, SomeBoolFlag} = X, SomeBoolFlag == false end instead of: fun({_, _, SomeBoolFlag}) -> SomeBoolFlag == false end which seems (to me at least) more sane? Kostis From bourinov@REDACTED Thu Dec 22 08:52:02 2011 From: bourinov@REDACTED (Max Bourinov) Date: Thu, 22 Dec 2011 10:52:02 +0300 Subject: [erlang-questions] Continuous Integration and Release Management for Erlang projects In-Reply-To: References: Message-ID: I just saw a message from Roberto Aloi (Author of tryerlang.org) A Continuous integration server built on top of Jenkins and Hubot, brought to you by GitHub:https://github.com/github/janky/tree/master/lib/janky Maybe this what you are looking for? Best regards, Max On Thu, Dec 22, 2011 at 9:07 AM, Jack Moffitt wrote: > > Jenkins: http://jenkins-ci.org/ > > > > for Erlang projects! > > Jenkins works easily with Erlang, basically no configuration needed. > It essentially just runs whatever commands you specify to build and > test the code, and it's quite easy to tell it to run rebar or make or > whatever you fancy. > > We use it (and its Github plugins) everyday to do continuous > integration of code at Grey Area. > > jack. > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From watson.timothy@REDACTED Thu Dec 22 09:41:16 2011 From: watson.timothy@REDACTED (Tim Watson) Date: Thu, 22 Dec 2011 08:41:16 +0000 Subject: [erlang-questions] Continuous Integration and Release Management for Erlang projects In-Reply-To: <8F9DBD3E-F6CD-4ECB-A451-4516DAE5B871@gmail.com> References: <8F9DBD3E-F6CD-4ECB-A451-4516DAE5B871@gmail.com> Message-ID: On 22 December 2011 00:13, Zabrane Mickael wrote: > I found *Travis CI* which seems to support Erlang: > http://about.travis-ci.org/docs/user/languages/erlang/ > > The *etorrent* project is already there: > http://travis-ci.org/#!/jlouis/etorrent > > I'd like to know if you could share your experience (*etorrent*) guys? > > I have nothing to do with etorrent, but I do have a number of smaller projects that are on travis and it works fine. Funnily enough, I'm just bootstrapping a couple more small projects to put up there. -------------- next part -------------- An HTML attachment was scrubbed... URL: From watson.timothy@REDACTED Thu Dec 22 09:42:22 2011 From: watson.timothy@REDACTED (Tim Watson) Date: Thu, 22 Dec 2011 08:42:22 +0000 Subject: [erlang-questions] Continuous Integration and Release Management for Erlang projects In-Reply-To: <40ED2210-F517-4FEB-8F74-633252353F75@gmail.com> References: <8F9DBD3E-F6CD-4ECB-A451-4516DAE5B871@gmail.com> <40ED2210-F517-4FEB-8F74-633252353F75@gmail.com> Message-ID: On 22 December 2011 00:21, Zabrane Mickael wrote: > Hi John, > > Thanks for sharing. > Is *buildbot* easy to use, easy to install, and fast? > We're looking for something in this spirit. > > N.B: unfortunately, *Travis-CI* seems to be usable only online. > > Is that really the case? I could be completely mistaken, but it looks a lot like you can download the rails application and fire it up yourself, given that it's build servers are virtual images. -------------- next part -------------- An HTML attachment was scrubbed... URL: From jesper.louis.andersen@REDACTED Thu Dec 22 10:21:29 2011 From: jesper.louis.andersen@REDACTED (Jesper Louis Andersen) Date: Thu, 22 Dec 2011 10:21:29 +0100 Subject: [erlang-questions] Continuous Integration and Release Management for Erlang projects In-Reply-To: <8F9DBD3E-F6CD-4ECB-A451-4516DAE5B871@gmail.com> References: <8F9DBD3E-F6CD-4ECB-A451-4516DAE5B871@gmail.com> Message-ID: <4EF2F699.60000@erlang-solutions.com> On 12/22/11 1:13 AM, Zabrane Mickael wrote: > I found *Travis CI* which seems to support Erlang: > http://about.travis-ci.org/docs/user/languages/erlang/ > > The *etorrent* project is already there: > http://travis-ci.org/#!/jlouis/etorrent > > > I'd like to know if you could share your experience (*etorrent*) guys? > We have pretty good experience with it. There has been some bumps and rocks thrown at us while using it, but it is alpha software, so expect this to be a test drive rather than a "real" thing. Going forward, for Open Source software, this is the right tool for the job. There is no reason as to why you should keep your own infrastructure to do build tests and such. The only nag I have is that it is somebody else who pays for the resource usage at Amazon - when money is tied into free projects like that, bad things tend to happen. Before Travis CI, Magnus Klaar did a jenkins setup that also worked very well for us. Note also, that we do two things more w.r.t builds: We have an IRC channel (#etorrent on Freenode) and in that channel there are two bots lurking ... one from CIA which mentions all commits made to the github repository and one that logs on from Travis whenever a build is either passing or failing. That way, you have an easy backlog of project developments present all the time in your IRC client. Persistent presence in the channel is done by either running a long-running irssi in a screen session on some machine, or by using the, rather excellent, irccloud.com service. -- Jesper Louis Andersen Erlang Solutions Ltd., Copenhagen, DK -------------- next part -------------- An HTML attachment was scrubbed... URL: From zabrane3@REDACTED Thu Dec 22 10:26:55 2011 From: zabrane3@REDACTED (Zabrane Mickael) Date: Thu, 22 Dec 2011 10:26:55 +0100 Subject: [erlang-questions] Continuous Integration and Release Management for Erlang projects In-Reply-To: <4EF2F699.60000@erlang-solutions.com> References: <8F9DBD3E-F6CD-4ECB-A451-4516DAE5B871@gmail.com> <4EF2F699.60000@erlang-solutions.com> Message-ID: <8AF0062C-7047-43A6-AAAF-8E32D3D22AAC@gmail.com> Hi Jesper, Thanks for these feedback. > Before Travis CI, Magnus Klaar did a jenkins setup that also worked very well for us. Is the setup for Jenkins available somewhere? Regards, Zabrane From august.schwartzwald@REDACTED Thu Dec 22 13:23:36 2011 From: august.schwartzwald@REDACTED (August Schwartzwald) Date: Thu, 22 Dec 2011 13:23:36 +0100 Subject: [erlang-questions] Newbie question about line endings In-Reply-To: References: Message-ID: I guess I'll digest your blog post for some time and see what comes out of it. It's maybe just because I have never seen anything like it before that I'm suspicious. :) Thanks! 2011/12/21 Fred Hebert > The simple answer is 'because Prolog did it that way first'. I have > written http://ferd.ca/on-erlang-s-syntax.html to give 2-3 different > options on how to read Erlang's line endings in a way that makes sense. > Note that considering them 'line ending' is a mistake in the first place. > ',' and ';' are separators (they go in-between expressions or constructs, > not after them). Only '.' terminates 'forms', which are function > declarations and module attributes '-KeyWord(Args)', and expressions in the > shell. > > On Wed, Dec 21, 2011 at 2:21 PM, August Schwartzwald < > august.schwartzwald@REDACTED> wrote: > >> Hi, >> >> I started to learn Erlang about a month ago. I really like it and think >> that with some more practice it will become a both unique and powerful tool >> in my growing box of programming languages. However, there is one thing >> about it that I find extremely annoying: The line endings. >> I currently know 5 programing languages, they have either 0 (python) or 1 >> way to end lines (usually the ';' character). Erlang totally stands out >> here and requires that lines are ended in one of 4 different ways. >> >> Did some googling without finding any good reason to why the language >> works in this way. Can anyone here explain this? >> >> Thanks >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://erlang.org/mailman/listinfo/erlang-questions >> > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From systemio@REDACTED Thu Dec 22 13:30:26 2011 From: systemio@REDACTED (=?UTF-8?B?c3lzdGVtaW8gc3lzdGVtaW8=?=) Date: Thu, 22 Dec 2011 16:30:26 +0400 Subject: [erlang-questions] =?utf-8?q?wxTaskBarIcon?= Message-ID: who knows if wxTaskBarIcon will be supported in the wxErlang in the future? or how can i create system tray icon in the win using latest Erlang release ? Thx From erlang@REDACTED Thu Dec 22 14:30:59 2011 From: erlang@REDACTED (Joe Armstrong) Date: Thu, 22 Dec 2011 14:30:59 +0100 Subject: [erlang-questions] Newbie question about line endings In-Reply-To: References: Message-ID: On Wed, Dec 21, 2011 at 8:21 PM, August Schwartzwald < august.schwartzwald@REDACTED> wrote: > Hi, > > I started to learn Erlang about a month ago. I really like it and think > that with some more practice it will become a both unique and powerful tool > in my growing box of programming languages. However, there is one thing > about it that I find extremely annoying: The line endings. > I currently know 5 programing languages, they have either 0 (python) or 1 > way to end lines (usually the ';' character). Erlang totally stands out > here and requires that lines are ended in one of 4 different ways. > > Did some googling without finding any good reason to why the language > works in this way. Can anyone here explain this? > There is no such ting as a "Line" in Erlang. Everything is a "form" so there are no line ending only form endings. A form is ended by a top-level "dot whitescape". Dot is a period "." white space is a blank,tab,newline or comment. Comments start with "%" and are terminated by a newline Top level means dot-whitespace is not contained inside a string, a quoted atom or a comment. The dot-whitespace convention came from Prolog, this is because Erlang was first implemented in Prolog. I don't really know why this convention was adopted in Prolog - but it might have been done to simplify error handling. If you get a parse error in a form the parser wants to recover in some way. In Erlang/Prolog the strategy for error recovery is extremely simple, if you get a parse error in a form the parser just reports the error and goes to the next form - what constitutes a form can be seen easily by only looking at the stream of tokens generated by the tokeniser. This make recovering from parse errors very simple. Dot-whitespace can be viewed as a synchronizing token for the purposes of error recovery during parsing of incorrect forms. The easiest was to think of a form, is that it's like a sentence in English. In your mail which posed this question, you ended most sentences with dot whitespace (the exception was ? as a terminator), so Erlang forms are just like English sentences. Just like in English semicolons are "long range" operators and separate clauses; whereas commas separate short range constructs. Cheers /Joe > > Thanks > ______________________________**_________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/**listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From steven.charles.davis@REDACTED Thu Dec 22 16:31:55 2011 From: steven.charles.davis@REDACTED (Steve Davis) Date: Thu, 22 Dec 2011 07:31:55 -0800 (PST) Subject: [erlang-questions] wxTaskBarIcon In-Reply-To: References: Message-ID: <005d4336-4d8a-467e-a913-ded20a1aa193@l29g2000yqf.googlegroups.com> Keep an eye on when wxWidgets version 2.9 is considered the "stable" release by wxwidgets.org. I believe that wx erlang uses the latest "stable" release, which is currently 2.8.12. I would expect that (probably Dan) will update wx to 2.9.x soon after that happens. /s On Dec 22, 6:30?am, systemio systemio wrote: > who knows if wxTaskBarIcon will be supported in the wxErlang in the future? or how can i create system tray icon in the win using latest Erlang release ? > Thx > _______________________________________________ > erlang-questions mailing list > erlang-questi...@REDACTED://erlang.org/mailman/listinfo/erlang-questions From magnus.klaar@REDACTED Thu Dec 22 19:19:40 2011 From: magnus.klaar@REDACTED (Magnus Klaar) Date: Thu, 22 Dec 2011 19:19:40 +0100 Subject: [erlang-questions] Continuous Integration and Release Management for Erlang projects In-Reply-To: <8AF0062C-7047-43A6-AAAF-8E32D3D22AAC@gmail.com> References: <8F9DBD3E-F6CD-4ECB-A451-4516DAE5B871@gmail.com> <4EF2F699.60000@erlang-solutions.com> <8AF0062C-7047-43A6-AAAF-8E32D3D22AAC@gmail.com> Message-ID: Hi! The configuration got lost when i relocated my server to the city dump and switched laptop, I didn't see a future need for either copy of the configuration and scripts. Jenkins is quite easy to set up for simple builds, in that setup we added "prototype" project for etorrent and made a copy for each platform and erlang release we were interested in, the copy was assigned to build at a matching slave (the slaves each ran a build slave process to receive the jobs). Now that we have kerl, it's a lot easier to pull that off. MVH Magnus On Thu, Dec 22, 2011 at 10:26 AM, Zabrane Mickael wrote: > Hi Jesper, > > Thanks for these feedback. > > > Before Travis CI, Magnus Klaar did a jenkins setup that also worked very > well for us. > > Is the setup for Jenkins available somewhere? > > Regards, > Zabrane > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From mattevans123@REDACTED Thu Dec 22 19:53:47 2011 From: mattevans123@REDACTED (Matthew Evans) Date: Thu, 22 Dec 2011 13:53:47 -0500 Subject: [erlang-questions] Continuous Integration and Release Management for Erlang projects In-Reply-To: References: Message-ID: Hi, I've actually used Elastic Bamboo myself for Erlang projects (using Maven with the Erlang plugin as the project management tool).SendThe key is that Atlassian is very much a Java shop. So what I did was to create an EBS that is mounted as a volume to the Elastic Bamboo instance. The EBS contains the Erlang runtime and build (erlc). See:http://confluence.atlassian.com/display/BAMBOO/Configuring+Elastic+Instances+to+use+the+EBS You should then be able to get your Erlang projects working just fine. Matt From: zabrane3@REDACTED Date: Thu, 22 Dec 2011 00:52:41 +0100 To: erlang-questions@REDACTED Subject: [erlang-questions] Continuous Integration and Release Management for Erlang projects Hi, Is there something equivalent to:Bambou: http://www.atlassian.com/software/bamboo/orJenkins: http://jenkins-ci.org/ for Erlang projects! Regards,Zabrane _______________________________________________ erlang-questions mailing list erlang-questions@REDACTED http://erlang.org/mailman/listinfo/erlang-questions -------------- next part -------------- An HTML attachment was scrubbed... URL: From zabrane3@REDACTED Thu Dec 22 21:31:44 2011 From: zabrane3@REDACTED (Zabrane Mickael) Date: Thu, 22 Dec 2011 21:31:44 +0100 Subject: [erlang-questions] Continuous Integration and Release Management for Erlang projects In-Reply-To: References: <8F9DBD3E-F6CD-4ECB-A451-4516DAE5B871@gmail.com> <4EF2F699.60000@erlang-solutions.com> <8AF0062C-7047-43A6-AAAF-8E32D3D22AAC@gmail.com> Message-ID: <78A2C44A-201A-4F17-8944-6BAE271C96FD@gmail.com> Thanks guys for these useful feedbacks. Jenkins seems to be the way to go for me. It's well documented and there's an O'reilly book "Jenkins: The Definitive Guide (2011)" available: http://www.amazon.com/Jenkins-Definitive-John-Ferguson-Smart/dp/1449305350 Regards, Zabrane On Dec 22, 2011, at 7:19 PM, Magnus Klaar wrote: > Hi! > > The configuration got lost when i relocated my server to the city dump and switched laptop, I didn't see a future need for either copy of the configuration and scripts. Jenkins is quite easy to set up for simple builds, in that setup we added "prototype" project for etorrent and made a copy for each platform and erlang release we were interested in, the copy was assigned to build at a matching slave (the slaves each ran a build slave process to receive the jobs). Now that we have kerl, it's a lot easier to pull that off. > > MVH Magnus > > On Thu, Dec 22, 2011 at 10:26 AM, Zabrane Mickael wrote: > Hi Jesper, > > Thanks for these feedback. > > > Before Travis CI, Magnus Klaar did a jenkins setup that also worked very well for us. > > Is the setup for Jenkins available somewhere? > > Regards, > Zabrane > > _______________________________________________ > 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 Thu Dec 22 23:03:32 2011 From: jesper.louis.andersen@REDACTED (Jesper Louis Andersen) Date: Thu, 22 Dec 2011 23:03:32 +0100 Subject: [erlang-questions] Some questions about dialyzer In-Reply-To: References: Message-ID: <4EF3A934.6050004@erlang-solutions.com> On 12/21/11 10:30 AM, Alexander Kuleshov wrote: > And also i have message like: > > test.erl:161: Function test_func/2 will never be called > > But i have some test_func calls in my code in current file. This usually means that the dialyzer has analyzed your code with the conclusion that even if your code contains calls to this function, other things limit the control flow in ways which means that these call sites can never be invoked. Thus it reports that your function never gets called. It is often the case that some other dialyzer error it found is the culprit. Suppose a call chain f() -> g() -> h() where the dialyzer finds that f() will always fail before calling g(). Then h() is not reachable and the above error type will be reported. Now, fixing the problem around the f function will then make the error go away since now the chain is "enabled". Note that the dialyzer is pretty powerful in what it finds. Since it is a very powerful static analyzer it can often close down entire control flow paths in your code based upon factually possible values that may flow along *other* paths. A call that looks benign, with no errors reported for it, may actually constrain the data flow in your program in such a way that the dialyzer sees the error/mistake on your part. The hard part about the dialyzer is to understand what the error messages *mean*. Not literally what the contents of the error message are, that is usually pretty clear, but rather, what the semantics of your program were that provoked that error. But when you begin to understand how it finds mistakes and what it reports it becomes an indispensable tool for weeding :) -- Jesper Louis Andersen Erlang Solutions Ltd., Copenhagen, DK From jesper.louis.andersen@REDACTED Thu Dec 22 23:13:06 2011 From: jesper.louis.andersen@REDACTED (Jesper Louis Andersen) Date: Thu, 22 Dec 2011 23:13:06 +0100 Subject: [erlang-questions] Unit testing In-Reply-To: <14C7BD11-34CC-450A-AE9F-D0A027D4D5BB@lovely.email.ne.jp> References: <14C7BD11-34CC-450A-AE9F-D0A027D4D5BB@lovely.email.ne.jp> Message-ID: <4EF3AB72.6020506@erlang-solutions.com> On 12/21/11 12:41 AM, Joseph Norton wrote: > I'd recommend to use QuickCheck (http://www.quviq.com/) and/or PropEr > (http://proper.softlab.ntua.gr/) for testing Erlang and non-Erlang > applications. Just in case no one else has mentioned either of these > tools to you. > We use PropEr in etorrent currently. We were using QuickCheck until Magnus Klaar changed us to PropEr. We run PropEr from eunit actually, just because it is easier to hook into the tool chain. But this is for internal testing of individual modules. The other tool we use it Common Test (ct) which is a bit more involved to set up. We use it to spawn a small local BitTorrent network and test that our application can communicate with itself and a foreign BitTorrent client. This tend to weed out many problems right away. The advantage of Erlang is that you can use it through ct to control other applications while you are running tests. So my approach would be: Internal test => eunit, Large scale blackbox test => CommonTest. And finally, use PropEr or QuickCheck for writing the test cases so you can automatically generate a couple 1000 tests and get your system properly tested. -- Jesper Louis Andersen Erlang Solutions Ltd., Copenhagen, DK -------------- next part -------------- An HTML attachment was scrubbed... URL: From jwatte@REDACTED Fri Dec 23 03:03:20 2011 From: jwatte@REDACTED (Jon Watte) Date: Thu, 22 Dec 2011 18:03:20 -0800 Subject: [erlang-questions] Fail fast In-Reply-To: References: Message-ID: If there was a proper supervision hierarchy all the way up to the "root" of the application, why would this happen? Wouldn't the supervisors just kill off whatever process ends up not being able to allocate memory, and thus clean up? (Perhaps kicking off users at the same time) If it fails far enough up, wouldn't it basically reset the erl environment to "scratch" ? Or would that be expecting too much from the supervision hierarchy? Sincerely, jw -- Americans might object: there is no way we would sacrifice our living standards for the benefit of people in the rest of the world. Nevertheless, whether we get there willingly or not, we shall soon have lower consumption rates, because our present rates are unsustainable. On Tue, Dec 20, 2011 at 6:23 PM, Chandru < chandrashekhar.mullaparthi@REDACTED> wrote: > Hello everyone, > > I've just had a failure in one of my live services because an erlang node > ran out of memory (caused by a traffic spike). Restart mechanisms exist to > restart the node, but the node took a long time to die because it was > writing a large erl_crash.dump file, and then there was a 7GB core dump. > > Is there a quicker way to fail? I'm thinking of disabling core dumps > entirely on the box. What else can I do? A configuration option on the node > to only produce a summary erl_crash.dump would be nice. The most useful > things for me in a crash dump usually are the slogan at the top, and the > message queue lengths of each process. In this particular case, the slogan > would've told me all that I needed to know. > > Chandru > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From zabrane3@REDACTED Fri Dec 23 07:30:51 2011 From: zabrane3@REDACTED (Zabrane Mickael) Date: Fri, 23 Dec 2011 07:30:51 +0100 Subject: [erlang-questions] Dialyzer question Message-ID: Hi Kostis, hi guys, I'd like to express the following intention in my specification: -spec foo() -> [byte(), byte(), byte()] foo() -> ... return [26, 55, 127]. ... return [0, 13, 255]. foo/0 must returns a list of exactly 3 bytes(). Dialyzer complains about that. My actual solution isn't accurate: -spec foo() -> [byte()] foo() -> ... return [26, 55, 127]. ... return [0, 13, 255]. Any hint please? Regards, Zabrane -------------- next part -------------- An HTML attachment was scrubbed... URL: From kostis@REDACTED Fri Dec 23 08:16:40 2011 From: kostis@REDACTED (Kostis Sagonas) Date: Fri, 23 Dec 2011 09:16:40 +0200 Subject: [erlang-questions] Dialyzer question In-Reply-To: References: Message-ID: <4EF42AD8.7070302@cs.ntua.gr> On 12/23/11 08:30, Zabrane Mickael wrote: > Hi Kostis, hi guys, > > I'd like to express the following intention in my specification: > > -spec foo() -> [byte(), byte(), byte()] > foo() -> > ... > return [26, 55, 127]. > ... > return [0, 13, 255]. > > *foo/0 must returns a list of exactly 3 bytes().* > > Dialyzer complains about that. My actual solution isn't accurate: > -spec foo() -> [byte()] > foo() -> > ... > return [26, 55, 127]. > ... > return [0, 13, 255]. > > Any hint please? As you note, the type language currently cannot accurately express what you want. But, out of curiosity, why do you want to use lists instead of tuples for something like that? I doubt there is a good reason for this... Kostis From zabrane3@REDACTED Fri Dec 23 08:20:58 2011 From: zabrane3@REDACTED (Zabrane Mickael) Date: Fri, 23 Dec 2011 08:20:58 +0100 Subject: [erlang-questions] Dialyzer question In-Reply-To: <4EF42AD8.7070302@cs.ntua.gr> References: <4EF42AD8.7070302@cs.ntua.gr> Message-ID: On Dec 23, 2011, at 8:16 AM, Kostis Sagonas wrote: > On 12/23/11 08:30, Zabrane Mickael wrote: >> Hi Kostis, hi guys, >> >> I'd like to express the following intention in my specification: >> >> -spec foo() -> [byte(), byte(), byte()] >> foo() -> >> ... >> return [26, 55, 127]. >> ... >> return [0, 13, 255]. >> >> *foo/0 must returns a list of exactly 3 bytes().* >> >> Dialyzer complains about that. My actual solution isn't accurate: >> -spec foo() -> [byte()] >> foo() -> >> ... >> return [26, 55, 127]. >> ... >> return [0, 13, 255]. >> >> Any hint please? > > As you note, the type language currently cannot accurately express what you want. OK. > But, out of curiosity, why do you want to use lists instead of tuples for something like that? I doubt there is a good reason for this... You're right Kostis. I'll change the interface to tuple instead of list. Thanks again ... Regards, Zabrane -------------- next part -------------- An HTML attachment was scrubbed... URL: From chandrashekhar.mullaparthi@REDACTED Fri Dec 23 08:44:49 2011 From: chandrashekhar.mullaparthi@REDACTED (Chandru) Date: Fri, 23 Dec 2011 07:44:49 +0000 Subject: [erlang-questions] Fail fast In-Reply-To: References: Message-ID: No, if BEAM cannot allocate more memory, the node just dies. In case you are interested, this handling of OOM condition has been discussed on the mailing list in the past. Supervision hierarchies don't help in this case. cheers Chandru On 23 December 2011 02:03, Jon Watte wrote: > If there was a proper supervision hierarchy all the way up to the "root" > of the application, why would this happen? Wouldn't the supervisors just > kill off whatever process ends up not being able to allocate memory, and > thus clean up? (Perhaps kicking off users at the same time) If it fails far > enough up, wouldn't it basically reset the erl environment to "scratch" ? > Or would that be expecting too much from the supervision hierarchy? > > Sincerely, > > jw > > > -- > Americans might object: there is no way we would sacrifice our living > standards for the benefit of people in the rest of the world. Nevertheless, > whether we get there willingly or not, we shall soon have lower consumption > rates, because our present rates are unsustainable. > > > > On Tue, Dec 20, 2011 at 6:23 PM, Chandru < > chandrashekhar.mullaparthi@REDACTED> wrote: > >> Hello everyone, >> >> I've just had a failure in one of my live services because an erlang node >> ran out of memory (caused by a traffic spike). Restart mechanisms exist to >> restart the node, but the node took a long time to die because it was >> writing a large erl_crash.dump file, and then there was a 7GB core dump. >> >> Is there a quicker way to fail? I'm thinking of disabling core dumps >> entirely on the box. What else can I do? A configuration option on the node >> to only produce a summary erl_crash.dump would be nice. The most useful >> things for me in a crash dump usually are the slogan at the top, and the >> message queue lengths of each process. In this particular case, the slogan >> would've told me all that I needed to know. >> >> Chandru >> >> >> _______________________________________________ >> 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 Dec 23 11:00:32 2011 From: bengt.kleberg@REDACTED (Bengt Kleberg) Date: Fri, 23 Dec 2011 11:00:32 +0100 Subject: [erlang-questions] clarify: Dialyzer error/warinng for ssl_accept Message-ID: <1324634432.8394.21.camel@seasc1137> Greetings, To get working code we need to keep 'ok', but can we at the same time persuade Dialyzer not to complain? There are some emails that discuss the problem with Dialyzer error/warning for ssl_accept. They seem to concentrate upon the changed behaviour of ssl_accept/1 in different Erlang versions. So fist things first: We are running Erlang R14B01 (erts-5.8.2) [smp:2:2] [rq:2] [async-threads:0] [kernel-poll:false] Our code looks like this: case ssl:ssl_accept(Socket) of ok -> ... {error, Error} -> end Dialyzer says: sip_transport.erl:2207: The pattern 'ok' can never match the type {'error',_} | {'ok',{'sslsocket',_,_}} bengt From kostis@REDACTED Fri Dec 23 12:18:46 2011 From: kostis@REDACTED (Kostis Sagonas) Date: Fri, 23 Dec 2011 13:18:46 +0200 Subject: [erlang-questions] clarify: Dialyzer error/warinng for ssl_accept In-Reply-To: <1324634432.8394.21.camel@seasc1137> References: <1324634432.8394.21.camel@seasc1137> Message-ID: <4EF46396.4030202@cs.ntua.gr> On 12/23/11 12:00, Bengt Kleberg wrote: > Greetings, > > To get working code we need to keep 'ok', but can we at the same time > persuade Dialyzer not to complain? > > There are some emails that discuss the problem with Dialyzer > error/warning for ssl_accept. They seem to concentrate upon the changed > behaviour of ssl_accept/1 in different Erlang versions. So fist things > first: > We are running Erlang R14B01 (erts-5.8.2) [smp:2:2] [rq:2] > [async-threads:0] [kernel-poll:false] > > Our code looks like this: > case ssl:ssl_accept(Socket) of > ok -> > ... > {error, Error} -> > end > > Dialyzer says: > sip_transport.erl:2207: The pattern 'ok' can never match the type > {'error',_} | {'ok',{'sslsocket',_,_}} There is no way to pursuade dialyzer not to complain without modifying the sources of R14B01. If you want to do something like this, first check what the specs of the 'ssl' module specify and if the problem does not go away then check whether the wrong information is somewhere in erl_types.erl. Kostis From dangud@REDACTED Fri Dec 23 13:15:36 2011 From: dangud@REDACTED (Dan Gudmundsson) Date: Fri, 23 Dec 2011 13:15:36 +0100 Subject: [erlang-questions] wxTaskBarIcon In-Reply-To: <005d4336-4d8a-467e-a913-ded20a1aa193@l29g2000yqf.googlegroups.com> References: <005d4336-4d8a-467e-a913-ded20a1aa193@l29g2000yqf.googlegroups.com> Message-ID: Is wxTaskBarIcon 2.9 only? Otherwise new functionality is easily added. I add classes when I need them or they are requested. Yes I don't want to require 2.9 yet, it is not classified as a stable api yet, and until it is I do not want base erlang's wx api upon that. /Dan On Thu, Dec 22, 2011 at 4:31 PM, Steve Davis wrote: > Keep an eye on when wxWidgets version 2.9 is considered the "stable" > release by wxwidgets.org. I believe that wx erlang uses the latest > "stable" release, which is currently 2.8.12. I would expect that > (probably Dan) will update wx to 2.9.x soon after that happens. > > /s > > On Dec 22, 6:30?am, systemio systemio wrote: >> who knows if wxTaskBarIcon will be supported in the wxErlang in the future? or how can i create system tray icon in the win using latest Erlang release ? >> Thx >> _______________________________________________ >> erlang-questions mailing list >> erlang-questi...@REDACTED://erlang.org/mailman/listinfo/erlang-questions > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions From gleber.p@REDACTED Fri Dec 23 13:17:56 2011 From: gleber.p@REDACTED (Gleb Peregud) Date: Fri, 23 Dec 2011 13:17:56 +0100 Subject: [erlang-questions] wxTaskBarIcon In-Reply-To: References: <005d4336-4d8a-467e-a913-ded20a1aa193@l29g2000yqf.googlegroups.com> Message-ID: On Fri, Dec 23, 2011 at 13:15, Dan Gudmundsson wrote: > Is wxTaskBarIcon 2.9 only? > Otherwise new functionality is easily added. > I add classes when I need them or they are requested. It seems to be present in 2.8 too (I haven't checked the code): http://docs.wxwidgets.org/2.8/wx_wxtaskbaricon.html From dangud@REDACTED Fri Dec 23 14:44:16 2011 From: dangud@REDACTED (Dan Gudmundsson) Date: Fri, 23 Dec 2011 14:44:16 +0100 Subject: [erlang-questions] wxTaskBarIcon In-Reply-To: References: <005d4336-4d8a-467e-a913-ded20a1aa193@l29g2000yqf.googlegroups.com> Message-ID: Okidoki, added to tasklist for R15B01 I will take a look at it. /Dan On Fri, Dec 23, 2011 at 1:17 PM, Gleb Peregud wrote: > On Fri, Dec 23, 2011 at 13:15, Dan Gudmundsson wrote: >> Is wxTaskBarIcon 2.9 only? >> Otherwise new functionality is easily added. >> I add classes when I need them or they are requested. > > It seems to be present in 2.8 too (I haven't checked the code): > > http://docs.wxwidgets.org/2.8/wx_wxtaskbaricon.html From fernando.benavides@REDACTED Fri Dec 23 15:17:28 2011 From: fernando.benavides@REDACTED (Fernando "Brujo" Benavides) Date: Fri, 23 Dec 2011 11:17:28 -0300 Subject: [erlang-questions] =?windows-1252?q?A_suggested_improvement_for_-?= =?windows-1252?q?extends=28=85=29?= Message-ID: <2206D0E7-328F-41A7-AF02-4271CB3101D1@inakanetworks.com> Hi fellows, Today I found myself writing a couple of modules with shared behavior (and what I mean by that is that except for an all/0 function with a different implementation in each module, the rest of their code is copy-pasted in each one of them). So, I said to myself: "This is a great place to use -extends!" And then I found myself in the following situation: --------------- parent.erl --------------- -module(parent). -export([run/0, module/0, a_value/0]). run() -> io:format("Module: ~p~nA Value: ~p~n", [module(), a_value()]). module() -> ?MODULE. a_value() -> parent_value ------------------------------------------ ----------------- child.erl -------------- -module(child). -extends(parent). -export([module/0, a_value/0]). module() -> ?MODULE. a_value() -> child_value. ------------------------------------------ ----------------- console ---------------- 2> parent:run(). Module: parent A Value: parent_value ok 3> child:run(). Module: parent A Value: parent_value ok ------------------------------------------ It would've been a lot nicer to see different results, as follows... ----------------- console ---------------- 2> parent:run(). Module: parent A Value: parent_value ok 3> child:run(). Module: child A Value: child_value ok ------------------------------------------ In other words, I would like the ?MODULE macro to somehow respect inheritance (I know it may be difficult but I don't think it's impossible, right?) and/or functions to have a more OOP-like behavior, where if called from child module any overridden function that's called is used in its overridden version. Just a suggestion :) Cheers! ____________________________ Fernando "Brujo" Benavides fernando.benavides@REDACTED -------------- next part -------------- An HTML attachment was scrubbed... URL: From zabrane3@REDACTED Fri Dec 23 15:18:20 2011 From: zabrane3@REDACTED (Zabrane Mickael) Date: Fri, 23 Dec 2011 15:18:20 +0100 Subject: [erlang-questions] guards when using dialyzer In-Reply-To: References: Message-ID: <7128FAC8-C6A6-49EE-83CE-BE54BC3AB773@gmail.com> Could someone advise on that (see below) please? What are the best pratices? Thanks. Regards, Zabrane On Dec 20, 2011, at 4:31 PM, Joel Reymont wrote: > Assuming you are an active user of Dialyzer, do you find yourself using function guards more or less? > > I'm wondering if it makes sense to lean heavily on guards when Dialyzer will catch possible issues. > > --- > Hardcore embedded Linux development > http://www.linkedin.com/in/joelreymont > Device drivers, firmware and debugging > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions From mattevans123@REDACTED Fri Dec 23 15:41:10 2011 From: mattevans123@REDACTED (Matthew Evans) Date: Fri, 23 Dec 2011 09:41:10 -0500 Subject: [erlang-questions] Fail fast In-Reply-To: References: , , Message-ID: The ability to handle this is a "feature" that I think is missing from Erlang. The VM and the language is very stable, but the fact that a single, poorly behaving, process can cause the VM to die is pretty undesirable. I had a bug in a "logging" process where an ETS table wasn't getting purged properly. It grew and grew eventually bringing down the entire VM due to an OOM condition. This process wasn't significant to the operation of the system, (and if I wanted it to be I would've written a supervisor to manage it), yet it killed a critical service. My personal wish would be the ability to optionally apply limits to a process when it is spawned (memory, ets table sizes, message queue would be a good start). When one or more of the limits are exceeded the process can be killed (and then trapped/supervised if needed). It would make the VM more stable, and would also assist in debugging (since it would be easy to see in the sasl logs what happened without needing to look at a crash dump). One From: chandrashekhar.mullaparthi@REDACTED Date: Fri, 23 Dec 2011 07:44:49 +0000 To: jwatte@REDACTED CC: erlang-questions@REDACTED Subject: Re: [erlang-questions] Fail fast No, if BEAM cannot allocate more memory, the node just dies. In case you are interested, this handling of OOM condition has been discussed on the mailing list in the past. Supervision hierarchies don't help in this case. cheers Chandru On 23 December 2011 02:03, Jon Watte wrote: If there was a proper supervision hierarchy all the way up to the "root" of the application, why would this happen? Wouldn't the supervisors just kill off whatever process ends up not being able to allocate memory, and thus clean up? (Perhaps kicking off users at the same time) If it fails far enough up, wouldn't it basically reset the erl environment to "scratch" ? Or would that be expecting too much from the supervision hierarchy? Sincerely, jw -- Americans might object: there is no way we would sacrifice our living standards for the benefit of people in the rest of the world. Nevertheless, whether we get there willingly or not, we shall soon have lower consumption rates, because our present rates are unsustainable. On Tue, Dec 20, 2011 at 6:23 PM, Chandru wrote: Hello everyone, I've just had a failure in one of my live services because an erlang node ran out of memory (caused by a traffic spike). Restart mechanisms exist to restart the node, but the node took a long time to die because it was writing a large erl_crash.dump file, and then there was a 7GB core dump. Is there a quicker way to fail? I'm thinking of disabling core dumps entirely on the box. What else can I do? A configuration option on the node to only produce a summary erl_crash.dump would be nice. The most useful things for me in a crash dump usually are the slogan at the top, and the message queue lengths of each process. In this particular case, the slogan would've told me all that I needed to know. Chandru _______________________________________________ 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 mattevans123@REDACTED Fri Dec 23 15:44:58 2011 From: mattevans123@REDACTED (Matthew Evans) Date: Fri, 23 Dec 2011 09:44:58 -0500 Subject: [erlang-questions] Fail fast In-Reply-To: References: , , Message-ID: Email got sent too soon..... The ability to handle this is a "feature" that I think is missing from Erlang. The VM and the language is very stable, but the fact that a single, poorly behaving, process can cause the VM to die is pretty undesirable. I had a bug in a "logging" process where an ETS table wasn't getting purged properly. It grew and grew eventually bringing down the entire VM due to an OOM condition. This process wasn't significant to the operation of the system, (and if I wanted it to be I would've written a supervisor to manage it), yet it killed a critical service. My personal wish would be the ability to optionally apply limits to a process when it is spawned (memory, ets table sizes, message queue would be a good start). When one or more of the limits are exceeded the process can be killed (and then trapped/supervised if needed). It would make the VM more stable, and would also assist in debugging (since it would be easy to see in the sasl logs what happened without needing to look at a crash dump). One other advantage of this is the ability to assist in testing, having the limits set temporarily to find possible memory hogs and issues with head of line blocking (message queues growing too much). Those limits would be removed for production. An option like that would, IMO, be a useful addition to the language. Cheers Matt From: chandrashekhar.mullaparthi@REDACTED Date: Fri, 23 Dec 2011 07:44:49 +0000 To: jwatte@REDACTED CC: erlang-questions@REDACTED Subject: Re: [erlang-questions] Fail fast No, if BEAM cannot allocate more memory, the node just dies. In case you are interested, this handling of OOM condition has been discussed on the mailing list in the past. Supervision hierarchies don't help in this case. cheers Chandru On 23 December 2011 02:03, Jon Watte wrote: If there was a proper supervision hierarchy all the way up to the "root" of the application, why would this happen? Wouldn't the supervisors just kill off whatever process ends up not being able to allocate memory, and thus clean up? (Perhaps kicking off users at the same time) If it fails far enough up, wouldn't it basically reset the erl environment to "scratch" ? Or would that be expecting too much from the supervision hierarchy? Sincerely, jw -- Americans might object: there is no way we would sacrifice our living standards for the benefit of people in the rest of the world. Nevertheless, whether we get there willingly or not, we shall soon have lower consumption rates, because our present rates are unsustainable. On Tue, Dec 20, 2011 at 6:23 PM, Chandru wrote: Hello everyone, I've just had a failure in one of my live services because an erlang node ran out of memory (caused by a traffic spike). Restart mechanisms exist to restart the node, but the node took a long time to die because it was writing a large erl_crash.dump file, and then there was a 7GB core dump. Is there a quicker way to fail? I'm thinking of disabling core dumps entirely on the box. What else can I do? A configuration option on the node to only produce a summary erl_crash.dump would be nice. The most useful things for me in a crash dump usually are the slogan at the top, and the message queue lengths of each process. In this particular case, the slogan would've told me all that I needed to know. Chandru _______________________________________________ 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 mononcqc@REDACTED Fri Dec 23 16:11:56 2011 From: mononcqc@REDACTED (Fred Hebert) Date: Fri, 23 Dec 2011 10:11:56 -0500 Subject: [erlang-questions] =?utf-8?q?A_suggested_improvement_for_-extends?= =?utf-8?b?KOKApik=?= In-Reply-To: <2206D0E7-328F-41A7-AF02-4271CB3101D1@inakanetworks.com> References: <2206D0E7-328F-41A7-AF02-4271CB3101D1@inakanetworks.com> Message-ID: The inheritance you see, is, as far as I know, just about redirecting calls. Let's say I have 2 modules, parent and child, where child extends parent. What happens is that when a call to child:some_function() fails because 'some_function/0' doesn't exist in child, the function is directly called as 'parent:some_function()' instead. Because of this, the macro cannot respect inheritance. It's simply a hack. The macro is a compile-time item while the -extends dispatching is a run-time mechanism. The feature you want would also have complex implications when it comes to code reloading: what if I change 'parent' and recompile it, reload it, without changing the child module? In general, I would advise against using -extends except when you know you really need it (i.e.: reimplementing a new AccessMod for Mnesia, where you have dozens and dozens of callbacks and you might want to only change one of them, while keeping the rest intact). What you want to do could instead be accomplished with a .hrl file. Just save -export([run/0, module/0, a_value/0]). run() -> io:format("Module: ~p~nA Value: ~p~n", [module(), a_value()]). module() -> ?MODULE. a_value() -> parent_value And then include that .hrl file in any module you want to have this (-include("my_file.hrl").). The ?MODULE macro will be supported fine in that place, and you will avoid all the issues of having local vs. remote calls. This is much easier and a lot less surprising for people using your code. On Fri, Dec 23, 2011 at 9:17 AM, Fernando "Brujo" Benavides < fernando.benavides@REDACTED> wrote: > Hi fellows, > > Today I found myself writing a couple of modules with shared behavior (and > what I mean by that is that except for an all/0 function with a different > implementation in each module, the rest of their code is copy-pasted in > each one of them). So, I said to myself: "This is a great place to use > -extends!" > > And then I found myself in the following situation: > > --------------- parent.erl --------------- > -module(parent). > > -export([run/0, module/0, a_value/0]). > > run() -> > io:format("Module: ~p~nA Value: ~p~n", [module(), a_value()]). > > module() -> ?MODULE. > > a_value() -> parent_value > ------------------------------------------ > > ----------------- child.erl -------------- > -module(child). > > -extends(parent). > > -export([module/0, a_value/0]). > > module() -> ?MODULE. > > a_value() -> child_value. > ------------------------------------------ > > ----------------- console ---------------- > 2> parent:run(). > Module: parent > A Value: parent_value > ok > 3> child:run(). > Module: parent > A Value: parent_value > ok > ------------------------------------------ > > It would've been a lot nicer to see different results, as follows... > > ----------------- console ---------------- > 2> parent:run(). > Module: parent > A Value: parent_value > ok > 3> child:run(). > Module: child > A Value: child_value > ok > ------------------------------------------ > > In other words, I would like the ?MODULE macro to somehow respect > inheritance (I know it may be difficult but I don't think it's impossible, > right?) and/or functions to have a more OOP-like behavior, where if called > from child module any overridden function that's called is used in its > overridden version. > > Just a suggestion :) > > Cheers! > *____________________________* > *Fernando "Brujo" Benavides* > fernando.benavides@REDACTED > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From fernando.benavides@REDACTED Fri Dec 23 16:22:24 2011 From: fernando.benavides@REDACTED (Fernando "Brujo" Benavides) Date: Fri, 23 Dec 2011 12:22:24 -0300 Subject: [erlang-questions] =?windows-1252?q?A_suggested_improvement_for_-?= =?windows-1252?q?extends=28=85=29?= In-Reply-To: References: <2206D0E7-328F-41A7-AF02-4271CB3101D1@inakanetworks.com> Message-ID: Ha! Super tricky, but I like your solution and it is similar to the way I would implement -extends: I would include all non-overridden parent functions in child.erl at compile time, but I get your point about code-reloading, I haven't thought about that. Thanks! On 23/12/2011, at 12:11, Fred Hebert wrote: > The inheritance you see, is, as far as I know, just about redirecting calls. Let's say I have 2 modules, parent and child, where child extends parent. > > What happens is that when a call to child:some_function() fails because 'some_function/0' doesn't exist in child, the function is directly called as 'parent:some_function()' instead. Because of this, the macro cannot respect inheritance. It's simply a hack. The macro is a compile-time item while the -extends dispatching is a run-time mechanism. > > The feature you want would also have complex implications when it comes to code reloading: what if I change 'parent' and recompile it, reload it, without changing the child module? > > In general, I would advise against using -extends except when you know you really need it (i.e.: reimplementing a new AccessMod for Mnesia, where you have dozens and dozens of callbacks and you might want to only change one of them, while keeping the rest intact). > > What you want to do could instead be accomplished with a .hrl file. Just save > > -export([run/0, module/0, a_value/0]). > > run() -> > io:format("Module: ~p~nA Value: ~p~n", [module(), a_value()]). > > module() -> ?MODULE. > > a_value() -> parent_value > > And then include that .hrl file in any module you want to have this (-include("my_file.hrl").). The ?MODULE macro will be supported fine in that place, and you will avoid all the issues of having local vs. remote calls. This is much easier and a lot less surprising for people using your code. > > > On Fri, Dec 23, 2011 at 9:17 AM, Fernando "Brujo" Benavides wrote: > Hi fellows, > > Today I found myself writing a couple of modules with shared behavior (and what I mean by that is that except for an all/0 function with a different implementation in each module, the rest of their code is copy-pasted in each one of them). So, I said to myself: "This is a great place to use -extends!" > > And then I found myself in the following situation: > > --------------- parent.erl --------------- > -module(parent). > > -export([run/0, module/0, a_value/0]). > > run() -> > io:format("Module: ~p~nA Value: ~p~n", [module(), a_value()]). > > module() -> ?MODULE. > > a_value() -> parent_value > ------------------------------------------ > > ----------------- child.erl -------------- > -module(child). > > -extends(parent). > > -export([module/0, a_value/0]). > > module() -> ?MODULE. > > a_value() -> child_value. > ------------------------------------------ > > ----------------- console ---------------- > 2> parent:run(). > Module: parent > A Value: parent_value > ok > 3> child:run(). > Module: parent > A Value: parent_value > ok > ------------------------------------------ > > It would've been a lot nicer to see different results, as follows... > > ----------------- console ---------------- > 2> parent:run(). > Module: parent > A Value: parent_value > ok > 3> child:run(). > Module: child > A Value: child_value > ok > ------------------------------------------ > > In other words, I would like the ?MODULE macro to somehow respect inheritance (I know it may be difficult but I don't think it's impossible, right?) and/or functions to have a more OOP-like behavior, where if called from child module any overridden function that's called is used in its overridden version. > > Just a suggestion :) > > Cheers! > ____________________________ > Fernando "Brujo" Benavides > fernando.benavides@REDACTED > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > > ____________________________ Fernando "Brujo" Benavides fernando.benavides@REDACTED -------------- next part -------------- An HTML attachment was scrubbed... URL: From essen@REDACTED Fri Dec 23 16:32:26 2011 From: essen@REDACTED (=?ISO-8859-1?Q?Lo=EFc_Hoguin?=) Date: Fri, 23 Dec 2011 16:32:26 +0100 Subject: [erlang-questions] guards when using dialyzer In-Reply-To: References: Message-ID: <4EF49F0A.1060903@dev-extend.eu> Guards help Dialyzer because Dialyzer can see whether the call will succeed more easily than without. For example, if you receive a message {msg, Variable}, Dialyzer will think Variable is of type any(). It is because you then add a guard that Dialyzer is able to know whether Variable is an integer() or something else, and then can pinpoint errors more precisely. Another important thing is that guards let you crash sooner, which is generally what you want, crash at the remote ends of the system, not in the core. On 12/20/2011 04:31 PM, Joel Reymont wrote: > Assuming you are an active user of Dialyzer, do you find yourself using function guards more or less? > > I'm wondering if it makes sense to lean heavily on guards when Dialyzer will catch possible issues. > > --- > Hardcore embedded Linux development > http://www.linkedin.com/in/joelreymont > Device drivers, firmware and debugging > > > > > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions -- Lo?c Hoguin Dev:Extend From chandrashekhar.mullaparthi@REDACTED Fri Dec 23 18:04:21 2011 From: chandrashekhar.mullaparthi@REDACTED (Chandru) Date: Fri, 23 Dec 2011 17:04:21 +0000 Subject: [erlang-questions] Fail fast In-Reply-To: References: Message-ID: Yes, I agree. I asked for "bounded message queues" a long time ago, but I got voted down :( http://erlang.org/pipermail/erlang-questions/2008-June/035517.html Chandru On 23 December 2011 14:44, Matthew Evans wrote: > Email got sent too soon..... > > > The ability to handle this is a "feature" that I think is missing from > Erlang. The VM and the language is very stable, but the fact that a single, > poorly behaving, process can cause the VM to die is pretty undesirable. I > had a bug in a "logging" process where an ETS table wasn't getting purged > properly. It grew and grew eventually bringing down the entire VM due to an > OOM condition. This process wasn't significant to the operation of the > system, (and if I wanted it to be I would've written a supervisor to manage > it), yet it killed a critical service. > > > My personal wish would be the ability to optionally apply limits to a > process when it is spawned (memory, ets table sizes, message queue would be > a good start). When one or more of the limits are exceeded the process can > be killed (and then trapped/supervised if needed). It would make the VM > more stable, and would also assist in debugging (since it would be easy to > see in the sasl logs what happened without needing to look at a crash > dump). One other advantage of this is the ability to assist in testing, > having the limits set temporarily to find possible memory hogs and issues > with head of line blocking (message queues growing too much). Those limits > would be removed for production. > > > An option like that would, IMO, be a useful addition to the language. > > > Cheers > > > Matt > > ------------------------------ > From: chandrashekhar.mullaparthi@REDACTED > Date: Fri, 23 Dec 2011 07:44:49 +0000 > To: jwatte@REDACTED > CC: erlang-questions@REDACTED > Subject: Re: [erlang-questions] Fail fast > > No, if BEAM cannot allocate more memory, the node just dies. In case you > are interested, this handling of OOM condition has been discussed on the > mailing list in the past. Supervision hierarchies don't help in this case. > > cheers > Chandru > > On 23 December 2011 02:03, Jon Watte wrote: > > If there was a proper supervision hierarchy all the way up to the "root" > of the application, why would this happen? Wouldn't the supervisors just > kill off whatever process ends up not being able to allocate memory, and > thus clean up? (Perhaps kicking off users at the same time) If it fails far > enough up, wouldn't it basically reset the erl environment to "scratch" ? > Or would that be expecting too much from the supervision hierarchy? > > Sincerely, > > jw > > > -- > Americans might object: there is no way we would sacrifice our living > standards for the benefit of people in the rest of the world. Nevertheless, > whether we get there willingly or not, we shall soon have lower consumption > rates, because our present rates are unsustainable. > > > > On Tue, Dec 20, 2011 at 6:23 PM, Chandru < > chandrashekhar.mullaparthi@REDACTED> wrote: > > Hello everyone, > > I've just had a failure in one of my live services because an erlang node > ran out of memory (caused by a traffic spike). Restart mechanisms exist to > restart the node, but the node took a long time to die because it was > writing a large erl_crash.dump file, and then there was a 7GB core dump. > > Is there a quicker way to fail? I'm thinking of disabling core dumps > entirely on the box. What else can I do? A configuration option on the node > to only produce a summary erl_crash.dump would be nice. The most useful > things for me in a crash dump usually are the slogan at the top, and the > message queue lengths of each process. In this particular case, the slogan > would've told me all that I needed to know. > > Chandru > > > _______________________________________________ > 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 tony@REDACTED Fri Dec 23 18:32:32 2011 From: tony@REDACTED (Tony Rogvall) Date: Fri, 23 Dec 2011 18:32:32 +0100 Subject: [erlang-questions] Fail fast In-Reply-To: References: Message-ID: Hi! If you are really, really interested in these kind of thing then maybe you could have a look in github.com/tonyrog/otp in the branch limits. It basically implements som new options to spawn_opt to set up resource limits like: max_memory max_time max_cpu max_reductions max_processes max_ports max_tables max_message_queue_len limits are inherited by spawned process and some of the resources are shared among the spawn processes to form a kind of resource group. The implementation is experimental and was made in order to demonstrate the features for the OTP group. Time for an EEP? Flavors of max_message_queue_len could be let sender crash, receiver crash, sender block (not so erlangish: drop head of message queue , drop tail of message queue ) /Tony On 23 dec 2011, at 18:04, Chandru wrote: > Yes, I agree. I asked for "bounded message queues" a long time ago, but I got voted down :( > > http://erlang.org/pipermail/erlang-questions/2008-June/035517.html > > Chandru > > On 23 December 2011 14:44, Matthew Evans wrote: > Email got sent too soon..... > > > > The ability to handle this is a "feature" that I think is missing from Erlang. The VM and the language is very stable, but the fact that a single, poorly behaving, process can cause the VM to die is pretty undesirable. I had a bug in a "logging" process where an ETS table wasn't getting purged properly. It grew and grew eventually bringing down the entire VM due to an OOM condition. This process wasn't significant to the operation of the system, (and if I wanted it to be I would've written a supervisor to manage it), yet it killed a critical service. > > > > My personal wish would be the ability to optionally apply limits to a process when it is spawned (memory, ets table sizes, message queue would be a good start). When one or more of the limits are exceeded the process can be killed (and then trapped/supervised if needed). It would make the VM more stable, and would also assist in debugging (since it would be easy to see in the sasl logs what happened without needing to look at a crash dump). One other advantage of this is the ability to assist in testing, having the limits set temporarily to find possible memory hogs and issues with head of line blocking (message queues growing too much). Those limits would be removed for production. > > > > An option like that would, IMO, be a useful addition to the language. > > > > Cheers > > > > Matt > > > From: chandrashekhar.mullaparthi@REDACTED > Date: Fri, 23 Dec 2011 07:44:49 +0000 > To: jwatte@REDACTED > CC: erlang-questions@REDACTED > Subject: Re: [erlang-questions] Fail fast > > No, if BEAM cannot allocate more memory, the node just dies. In case you are interested, this handling of OOM condition has been discussed on the mailing list in the past. Supervision hierarchies don't help in this case. > > cheers > Chandru > > On 23 December 2011 02:03, Jon Watte wrote: > If there was a proper supervision hierarchy all the way up to the "root" of the application, why would this happen? Wouldn't the supervisors just kill off whatever process ends up not being able to allocate memory, and thus clean up? (Perhaps kicking off users at the same time) If it fails far enough up, wouldn't it basically reset the erl environment to "scratch" ? Or would that be expecting too much from the supervision hierarchy? > > Sincerely, > > jw > > > -- > Americans might object: there is no way we would sacrifice our living standards for the benefit of people in the rest of the world. Nevertheless, whether we get there willingly or not, we shall soon have lower consumption rates, because our present rates are unsustainable. > > > > On Tue, Dec 20, 2011 at 6:23 PM, Chandru wrote: > Hello everyone, > > I've just had a failure in one of my live services because an erlang node ran out of memory (caused by a traffic spike). Restart mechanisms exist to restart the node, but the node took a long time to die because it was writing a large erl_crash.dump file, and then there was a 7GB core dump. > > Is there a quicker way to fail? I'm thinking of disabling core dumps entirely on the box. What else can I do? A configuration option on the node to only produce a summary erl_crash.dump would be nice. The most useful things for me in a crash dump usually are the slogan at the top, and the message queue lengths of each process. In this particular case, the slogan would've told me all that I needed to know. > > Chandru > > > _______________________________________________ > 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 "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 max.lapshin@REDACTED Fri Dec 23 19:15:09 2011 From: max.lapshin@REDACTED (Max Lapshin) Date: Fri, 23 Dec 2011 21:15:09 +0300 Subject: [erlang-questions] Fail fast In-Reply-To: References: Message-ID: Yes. It is well known and often discussed problem. Erlang VM can be coredumped by process and error_logger is the most often reason to fail. From dave@REDACTED Fri Dec 23 19:23:32 2011 From: dave@REDACTED (Dave Cottlehuber) Date: Fri, 23 Dec 2011 19:23:32 +0100 Subject: [erlang-questions] wxTaskBarIcon In-Reply-To: References: <005d4336-4d8a-467e-a913-ded20a1aa193@l29g2000yqf.googlegroups.com> Message-ID: On 23 December 2011 14:44, Dan Gudmundsson wrote: > Okidoki, added to tasklist for R15B01 > > I will take a look at it. > > /Dan +1 for that Dan. Please let me know if you would like it tested. A+ Dave From calvi88@REDACTED Fri Dec 23 19:34:47 2011 From: calvi88@REDACTED (Adrian Campos) Date: Fri, 23 Dec 2011 18:34:47 +0000 Subject: [erlang-questions] erl_syntax:comment with erl_prettypr error Message-ID: Hello, I have been trying to create an abstract syntax tree with a comment, but once the tree is correctly formed and I try to print it with erl_prettypr:format(Tree) I get this error: 5> C = erl_syntax:comment("comm").{tree,comment,{attr,0,[],none},{comment,none,"comm"}}6> erl_prettypr:format(C).** exception error: no function clause matching prettypr:strwidth(99,1) in function prettypr:string/1 in call from prettypr:text/1 in call from erl_prettypr:stack_comment_lines/1 in call from erl_prettypr:lay_2/2 in call from erl_prettypr:format/2 My question is: is this error a prettypr bug? or am I doing something wrong using erl_prettypr:format withot any options besides the Tree? Thank you -------------- next part -------------- An HTML attachment was scrubbed... URL: From mattevans123@REDACTED Fri Dec 23 19:37:25 2011 From: mattevans123@REDACTED (Matthew Evans) Date: Fri, 23 Dec 2011 13:37:25 -0500 Subject: [erlang-questions] Fail fast In-Reply-To: References: , Message-ID: Thanks, I might take a look at that. Subject: Re: [erlang-questions] Fail fast From: tony@REDACTED Date: Fri, 23 Dec 2011 18:32:32 +0100 CC: mattevans123@REDACTED; erlang-questions@REDACTED To: chandrashekhar.mullaparthi@REDACTED Hi! If you are really, really interested in these kind of thing then maybe you could have a look in github.com/tonyrog/otp in the branch limits. It basically implements som new options to spawn_opt to set up resource limits like: max_memorymax_timemax_cpumax_reductionsmax_processesmax_portsmax_tablesmax_message_queue_len limits are inherited by spawned process and some of the resources are shared among the spawn processes to form a kind of resource group. The implementation is experimental and was made in order to demonstrate the features for the OTP group. Time for an EEP? Flavors of max_message_queue_len could be let sender crash, receiver crash, sender block(not so erlangish: drop head of message queue , drop tail of message queue ) /Tony On 23 dec 2011, at 18:04, Chandru wrote:Yes, I agree. I asked for "bounded message queues" a long time ago, but I got voted down :( http://erlang.org/pipermail/erlang-questions/2008-June/035517.html Chandru On 23 December 2011 14:44, Matthew Evans wrote: Email got sent too soon..... The ability to handle this is a "feature" that I think is missing from Erlang. The VM and the language is very stable, but the fact that a single, poorly behaving, process can cause the VM to die is pretty undesirable. I had a bug in a "logging" process where an ETS table wasn't getting purged properly. It grew and grew eventually bringing down the entire VM due to an OOM condition. This process wasn't significant to the operation of the system, (and if I wanted it to be I would've written a supervisor to manage it), yet it killed a critical service. My personal wish would be the ability to optionally apply limits to a process when it is spawned (memory, ets table sizes, message queue would be a good start). When one or more of the limits are exceeded the process can be killed (and then trapped/supervised if needed). It would make the VM more stable, and would also assist in debugging (since it would be easy to see in the sasl logs what happened without needing to look at a crash dump). One other advantage of this is the ability to assist in testing, having the limits set temporarily to find possible memory hogs and issues with head of line blocking (message queues growing too much). Those limits would be removed for production. An option like that would, IMO, be a useful addition to the language. Cheers Matt From: chandrashekhar.mullaparthi@REDACTED Date: Fri, 23 Dec 2011 07:44:49 +0000 To: jwatte@REDACTED CC: erlang-questions@REDACTED Subject: Re: [erlang-questions] Fail fast No, if BEAM cannot allocate more memory, the node just dies. In case you are interested, this handling of OOM condition has been discussed on the mailing list in the past. Supervision hierarchies don't help in this case. cheers Chandru On 23 December 2011 02:03, Jon Watte wrote: If there was a proper supervision hierarchy all the way up to the "root" of the application, why would this happen? Wouldn't the supervisors just kill off whatever process ends up not being able to allocate memory, and thus clean up? (Perhaps kicking off users at the same time) If it fails far enough up, wouldn't it basically reset the erl environment to "scratch" ? Or would that be expecting too much from the supervision hierarchy? Sincerely, jw -- Americans might object: there is no way we would sacrifice our living standards for the benefit of people in the rest of the world. Nevertheless, whether we get there willingly or not, we shall soon have lower consumption rates, because our present rates are unsustainable. On Tue, Dec 20, 2011 at 6:23 PM, Chandru wrote: Hello everyone, I've just had a failure in one of my live services because an erlang node ran out of memory (caused by a traffic spike). Restart mechanisms exist to restart the node, but the node took a long time to die because it was writing a large erl_crash.dump file, and then there was a 7GB core dump. Is there a quicker way to fail? I'm thinking of disabling core dumps entirely on the box. What else can I do? A configuration option on the node to only produce a summary erl_crash.dump would be nice. The most useful things for me in a crash dump usually are the slogan at the top, and the message queue lengths of each process. In this particular case, the slogan would've told me all that I needed to know. Chandru _______________________________________________ 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 "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 ulf@REDACTED Fri Dec 23 19:50:18 2011 From: ulf@REDACTED (Ulf Wiger) Date: Fri, 23 Dec 2011 19:50:18 +0100 Subject: [erlang-questions] obsolete comment in mnesia? Message-ID: <45C3F55F-B913-4CEF-BD92-0E388D1FB5C7@feuerlabs.com> I found this in mnesia_schema.erl during some of my Christmas code browsing: read_nodes() -> %% Ensure that we access the intended Mnesia %% directory. This function may not be called %% during startup since it will cause the %% application_controller to get into deadlock case mnesia_lib:ensure_loaded(?APPLICATION) of ok -> ? end. As far as I can tell, there is absolutely no risk of deadlock, but I recall a time, a looong time ago, when application:loaded_applications() was actually implemented as a gen_server:call(), and calling it during application start would result in a deadlock. If memory serves, this was corrected sometime around 1996-97... Is there something else I'm missing, or would it be ok to remove this comment? BR, Ulf W From chandrashekhar.mullaparthi@REDACTED Fri Dec 23 19:57:12 2011 From: chandrashekhar.mullaparthi@REDACTED (Chandru) Date: Fri, 23 Dec 2011 18:57:12 +0000 Subject: [erlang-questions] Fail fast In-Reply-To: References: Message-ID: Thanks Tony, I will take a look. regards, Chandru On 23 December 2011 17:32, Tony Rogvall wrote: > Hi! > > If you are really, really interested in these kind of thing then maybe you > could have a look in > github.com/tonyrog/otp in the branch limits. > > It basically implements som new options to spawn_opt to set up resource > limits like: > > max_memory > max_time > max_cpu > max_reductions > max_processes > max_ports > max_tables > max_message_queue_len > > limits are inherited by spawned process and some of the resources are > shared among the spawn processes to form a kind of resource group. > > The implementation is experimental and was made in order to demonstrate > the > features for the OTP group. Time for an EEP? > > Flavors of max_message_queue_len could be let sender crash, receiver > crash, sender block > (not so erlangish: drop head of message queue , drop tail of message queue > ) > > > /Tony > > > On 23 dec 2011, at 18:04, Chandru wrote: > > Yes, I agree. I asked for "bounded message queues" a long time ago, but I > got voted down :( > > http://erlang.org/pipermail/erlang-questions/2008-June/035517.html > > Chandru > > On 23 December 2011 14:44, Matthew Evans wrote: > >> Email got sent too soon..... >> >> >> The ability to handle this is a "feature" that I think is missing from >> Erlang. The VM and the language is very stable, but the fact that a single, >> poorly behaving, process can cause the VM to die is pretty undesirable. I >> had a bug in a "logging" process where an ETS table wasn't getting purged >> properly. It grew and grew eventually bringing down the entire VM due to an >> OOM condition. This process wasn't significant to the operation of the >> system, (and if I wanted it to be I would've written a supervisor to manage >> it), yet it killed a critical service. >> >> >> My personal wish would be the ability to optionally apply limits to a >> process when it is spawned (memory, ets table sizes, message queue would be >> a good start). When one or more of the limits are exceeded the process can >> be killed (and then trapped/supervised if needed). It would make the VM >> more stable, and would also assist in debugging (since it would be easy to >> see in the sasl logs what happened without needing to look at a crash >> dump). One other advantage of this is the ability to assist in testing, >> having the limits set temporarily to find possible memory hogs and issues >> with head of line blocking (message queues growing too much). Those limits >> would be removed for production. >> >> >> An option like that would, IMO, be a useful addition to the language. >> >> >> Cheers >> >> >> Matt >> >> ------------------------------ >> From: chandrashekhar.mullaparthi@REDACTED >> Date: Fri, 23 Dec 2011 07:44:49 +0000 >> To: jwatte@REDACTED >> CC: erlang-questions@REDACTED >> Subject: Re: [erlang-questions] Fail fast >> >> No, if BEAM cannot allocate more memory, the node just dies. In case you >> are interested, this handling of OOM condition has been discussed on the >> mailing list in the past. Supervision hierarchies don't help in this case. >> >> cheers >> Chandru >> >> On 23 December 2011 02:03, Jon Watte wrote: >> >> If there was a proper supervision hierarchy all the way up to the "root" >> of the application, why would this happen? Wouldn't the supervisors just >> kill off whatever process ends up not being able to allocate memory, and >> thus clean up? (Perhaps kicking off users at the same time) If it fails far >> enough up, wouldn't it basically reset the erl environment to "scratch" ? >> Or would that be expecting too much from the supervision hierarchy? >> >> Sincerely, >> >> jw >> >> >> -- >> Americans might object: there is no way we would sacrifice our living >> standards for the benefit of people in the rest of the world. Nevertheless, >> whether we get there willingly or not, we shall soon have lower consumption >> rates, because our present rates are unsustainable. >> >> >> >> On Tue, Dec 20, 2011 at 6:23 PM, Chandru < >> chandrashekhar.mullaparthi@REDACTED> wrote: >> >> Hello everyone, >> >> I've just had a failure in one of my live services because an erlang node >> ran out of memory (caused by a traffic spike). Restart mechanisms exist to >> restart the node, but the node took a long time to die because it was >> writing a large erl_crash.dump file, and then there was a 7GB core dump. >> >> Is there a quicker way to fail? I'm thinking of disabling core dumps >> entirely on the box. What else can I do? A configuration option on the node >> to only produce a summary erl_crash.dump would be nice. The most useful >> things for me in a crash dump usually are the slogan at the top, and the >> message queue lengths of each process. In this particular case, the slogan >> would've told me all that I needed to know. >> >> Chandru >> >> >> _______________________________________________ >> 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 > > > "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 ulf@REDACTED Fri Dec 23 19:57:43 2011 From: ulf@REDACTED (Ulf Wiger) Date: Fri, 23 Dec 2011 19:57:43 +0100 Subject: [erlang-questions] obsolete comment in mnesia? In-Reply-To: <45C3F55F-B913-4CEF-BD92-0E388D1FB5C7@feuerlabs.com> References: <45C3F55F-B913-4CEF-BD92-0E388D1FB5C7@feuerlabs.com> Message-ID: <1C516406-EA2F-4AC1-8D8A-705085F627FD@feuerlabs.com> Ah, the call to application:load(mnesia) which came later? Still, it won't deadlock, since application:start(mnesia) will always result in the application being loaded first. BR, Ulf W On 23 Dec 2011, at 19:50, Ulf Wiger wrote: > > I found this in mnesia_schema.erl during some of my Christmas code browsing: > > read_nodes() -> > %% Ensure that we access the intended Mnesia > %% directory. This function may not be called > %% during startup since it will cause the > %% application_controller to get into deadlock > case mnesia_lib:ensure_loaded(?APPLICATION) of > ok -> > ? > end. > > > As far as I can tell, there is absolutely no risk of deadlock, but I recall a time, a looong time ago, when application:loaded_applications() was actually implemented as a gen_server:call(), and calling it during application start would result in a deadlock. If memory serves, this was corrected sometime around 1996-97... > > Is there something else I'm missing, or would it be ok to remove this comment? > > BR, > Ulf W > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions From carlsson.richard@REDACTED Fri Dec 23 20:48:45 2011 From: carlsson.richard@REDACTED (Richard Carlsson) Date: Fri, 23 Dec 2011 20:48:45 +0100 Subject: [erlang-questions] erl_syntax:comment with erl_prettypr error In-Reply-To: References: Message-ID: <4EF4DB1D.60603@gmail.com> On 12/23/2011 07:34 PM, Adrian Campos wrote: > Hello, > > I have been trying to create an abstract syntax tree with a comment, but > once the tree is correctly formed and I try to print it with > erl_prettypr:format(Tree) I get this error: > > /5> C = erl_syntax:comment("comm")./ > /{tree,comment,{attr,0,[],none},{comment,none,"comm"}}/ > /6> erl_prettypr:format(C)./ > /** exception error: no function clause matching prettypr:strwidth(99,1)/ > /in function prettypr:string/1/ > /in call from prettypr:text/1/ > /in call from erl_prettypr:stack_comment_lines/1/ > /in call from erl_prettypr:lay_2/2/ > /in call from erl_prettypr:format/2/ > > My question is: is this error a prettypr bug? or am I doing something > wrong using erl_prettypr:format withot any options besides the Tree? When you construct the comment, you have to give it a list of lines of text, not just a single string. For example: C1 = erl_syntax:comment(["comm"]). C2 = erl_syntax:comment(["comm line 1", "comm line 2"]). /Richard From zabrane3@REDACTED Fri Dec 23 22:10:47 2011 From: zabrane3@REDACTED (Zabrane Mickael) Date: Fri, 23 Dec 2011 22:10:47 +0100 Subject: [erlang-questions] Fail fast In-Reply-To: References: Message-ID: <73566F3C-67B2-4947-98E6-61AC387A9532@gmail.com> Fantastic Tony. Any chance to see these features officially integrated one day ... OTP folks? Regards, Zabrane On Dec 23, 2011, at 6:32 PM, Tony Rogvall wrote: > Hi! > > If you are really, really interested in these kind of thing then maybe you could have a look in > github.com/tonyrog/otp in the branch limits. > > It basically implements som new options to spawn_opt to set up resource limits like: > > max_memory > max_time > max_cpu > max_reductions > max_processes > max_ports > max_tables > max_message_queue_len > > limits are inherited by spawned process and some of the resources are > shared among the spawn processes to form a kind of resource group. > > The implementation is experimental and was made in order to demonstrate the > features for the OTP group. Time for an EEP? > > Flavors of max_message_queue_len could be let sender crash, receiver crash, sender block > (not so erlangish: drop head of message queue , drop tail of message queue ) > > > /Tony > > > On 23 dec 2011, at 18:04, Chandru wrote: > >> Yes, I agree. I asked for "bounded message queues" a long time ago, but I got voted down :( >> >> http://erlang.org/pipermail/erlang-questions/2008-June/035517.html >> >> Chandru >> >> On 23 December 2011 14:44, Matthew Evans wrote: >> Email got sent too soon..... >> >> >> >> The ability to handle this is a "feature" that I think is missing from Erlang. The VM and the language is very stable, but the fact that a single, poorly behaving, process can cause the VM to die is pretty undesirable. I had a bug in a "logging" process where an ETS table wasn't getting purged properly. It grew and grew eventually bringing down the entire VM due to an OOM condition. This process wasn't significant to the operation of the system, (and if I wanted it to be I would've written a supervisor to manage it), yet it killed a critical service. >> >> >> >> My personal wish would be the ability to optionally apply limits to a process when it is spawned (memory, ets table sizes, message queue would be a good start). When one or more of the limits are exceeded the process can be killed (and then trapped/supervised if needed). It would make the VM more stable, and would also assist in debugging (since it would be easy to see in the sasl logs what happened without needing to look at a crash dump). One other advantage of this is the ability to assist in testing, having the limits set temporarily to find possible memory hogs and issues with head of line blocking (message queues growing too much). Those limits would be removed for production. >> >> >> >> An option like that would, IMO, be a useful addition to the language. >> >> >> >> Cheers >> >> >> >> Matt >> >> >> From: chandrashekhar.mullaparthi@REDACTED >> Date: Fri, 23 Dec 2011 07:44:49 +0000 >> To: jwatte@REDACTED >> CC: erlang-questions@REDACTED >> Subject: Re: [erlang-questions] Fail fast >> >> No, if BEAM cannot allocate more memory, the node just dies. In case you are interested, this handling of OOM condition has been discussed on the mailing list in the past. Supervision hierarchies don't help in this case. >> >> cheers >> Chandru >> >> On 23 December 2011 02:03, Jon Watte wrote: >> If there was a proper supervision hierarchy all the way up to the "root" of the application, why would this happen? Wouldn't the supervisors just kill off whatever process ends up not being able to allocate memory, and thus clean up? (Perhaps kicking off users at the same time) If it fails far enough up, wouldn't it basically reset the erl environment to "scratch" ? Or would that be expecting too much from the supervision hierarchy? >> >> Sincerely, >> >> jw >> >> >> -- >> Americans might object: there is no way we would sacrifice our living standards for the benefit of people in the rest of the world. Nevertheless, whether we get there willingly or not, we shall soon have lower consumption rates, because our present rates are unsustainable. >> >> >> >> On Tue, Dec 20, 2011 at 6:23 PM, Chandru wrote: >> Hello everyone, >> >> I've just had a failure in one of my live services because an erlang node ran out of memory (caused by a traffic spike). Restart mechanisms exist to restart the node, but the node took a long time to die because it was writing a large erl_crash.dump file, and then there was a 7GB core dump. >> >> Is there a quicker way to fail? I'm thinking of disabling core dumps entirely on the box. What else can I do? A configuration option on the node to only produce a summary erl_crash.dump would be nice. The most useful things for me in a crash dump usually are the slogan at the top, and the message queue lengths of each process. In this particular case, the slogan would've told me all that I needed to know. >> >> Chandru >> >> >> _______________________________________________ >> 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 > > "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 carlsson.richard@REDACTED Fri Dec 23 23:09:00 2011 From: carlsson.richard@REDACTED (Richard Carlsson) Date: Fri, 23 Dec 2011 23:09:00 +0100 Subject: [erlang-questions] towards a unified dict api Message-ID: <4EF4FBFC.5060307@gmail.com> A thing I've been tinkering with on and off for years is making a unified API for dictionaries in Erlang (dict, orddict, gb_trees, ets, dets). This requires figuring out a set of function names and calling conventions that are mostly familiar but which don't already have a conflicting definition in one or more of the modules involved. In the end I went for using most of the dict module API unchanged, with some new synonyms, and a number of additional useful functions. I also made the dict module define a new 'dict' behaviour (even though it's just an interface rather than a complete behaviour). One particular detail is that gb_trees (with its user-unfriendly name and rather different calling conventions) can now quite simply be used through the dict module as an ordered variant of dict, and you can pretend you never heard of the gb_trees module unless you want to use one of its specially implementation-dependent functions. An ordered dict can be created through dict:new([ordered_set]). This also resolved some major problems with clashing function definitions. The code (based on the OTP maint branch) can be found here: https://github.com/richcarl/otp/tree/dict-api The quickest way of having a look at the suggested API is to follow this link and scroll down to see the behaviour callback: https://github.com/richcarl/otp/blob/dict-api/lib/stdlib/src/dict.erl Reactions, suggestions, and test pilots are most welcome. I'm not ready to write an EEP until I feel the API is good enough. Things still on the TODO-list are: updating the docs for ets and dets, figuring out a good set of iterator functions, and maybe include QLC table/1/2 functions and match/select functions in the API. And then the same kind of unified API should be made for sets and probably also for sequences. A Good Yule to y'all, /Richard From ryanmolden@REDACTED Fri Dec 23 23:24:37 2011 From: ryanmolden@REDACTED (Ryan Molden) Date: Fri, 23 Dec 2011 14:24:37 -0800 Subject: [erlang-questions] Are newlines significant in Erlang grammar? In-Reply-To: <20111220233951.GA6833@mulga.csse.unimelb.edu.au> References: <20111220233951.GA6833@mulga.csse.unimelb.edu.au> Message-ID: On Tue, Dec 20, 2011 at 3:39 PM, Jeff Schultz wrote: > On Tue, Dec 20, 2011 at 01:33:18PM -0500, Daniel Dormont wrote: > > Actually that's an interesting point. Is there really no other place in > the > > Erlang grammar where whitespace is required? My gut instinct tells me > there > > must be a few, because every language has a few right? I mean, if nothing > > else to separate two identifiers? But thinking a little more, I realize > > Erlang doesn't have "identifiers" in the sense most other languages do > and > > even then, there's always some sort of punctuation. Is this period > business > > the only exception? > > Erlang has operators that are alphabetic. X orelse Y really does > need the whitespace. And 1.5 is not the same thing as 1 . 5. > > Handling whitespace is a job for the lexer. Just ensure that the '.' > sequence produces an end-of-term token instead of some > dot token and treat other unquoted whitespace as a token terminator. > > > Jeff Schultz > That did the trick, thanks! Had to massage some regular expressions in my lexer but it seems to be working properly now. Ryan -------------- next part -------------- An HTML attachment was scrubbed... URL: From mononcqc@REDACTED Sat Dec 24 00:04:11 2011 From: mononcqc@REDACTED (Fred Hebert) Date: Fri, 23 Dec 2011 18:04:11 -0500 Subject: [erlang-questions] towards a unified dict api In-Reply-To: <4EF4FBFC.5060307@gmail.com> References: <4EF4FBFC.5060307@gmail.com> Message-ID: On Fri, Dec 23, 2011 at 5:09 PM, Richard Carlsson < carlsson.richard@REDACTED> wrote: > A thing I've been tinkering with on and off for years is making a unified > API for dictionaries in Erlang (dict, orddict, gb_trees, ets, dets). This > requires figuring out a set of function names and calling conventions that > are mostly familiar but which don't already have a conflicting definition > in one or more of the modules involved. > > In the end I went for using most of the dict module API unchanged, with > some new synonyms, and a number of additional useful functions. I also made > the dict module define a new 'dict' behaviour (even though it's just an > interface rather than a complete behaviour). > > One particular detail is that gb_trees (with its user-unfriendly name and > rather different calling conventions) can now quite simply be used through > the dict module as an ordered variant of dict, and you can pretend you > never heard of the gb_trees module unless you want to use one of its > specially implementation-dependent functions. An ordered dict can be > created through dict:new([ordered_set]). This also resolved some major > problems with clashing function definitions. > The code (based on the OTP maint branch) can be found here: > > https://github.com/richcarl/otp/tree/dict-api > > The quickest way of having a look at the suggested API is to follow this > link and scroll down to see the behaviour callback: > > https://github.com/richcarl/otp/blob/dict-api/lib/stdlib/src/dict.erl > > > Reactions, suggestions, and test pilots are most welcome. I'm not ready to > write an EEP until I feel the API is good enough. Things still on the > TODO-list are: updating the docs for ets and dets, figuring out a good set > of iterator functions, and maybe include QLC table/1/2 functions and > match/select functions in the API. And then the same kind of unified API > should be made for sets and probably also for sequences. > I'm wondering how that changes impact modules like 'sets', 'ordsets' and 'gb_sets', where ordsets were based on the same data structure as orddict, sets the same as dict, and gb_sets were based on gb_trees' structure. There was some kind of general relationship between all these modules that is now being lost. Otherwise, that sounds good. > > A Good Yule to y'all, > > /Richard > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From rexxe98@REDACTED Sat Dec 24 01:43:47 2011 From: rexxe98@REDACTED (Andrew Berman) Date: Fri, 23 Dec 2011 16:43:47 -0800 Subject: [erlang-questions] towards a unified dict api In-Reply-To: <4EF4FBFC.5060307@gmail.com> References: <4EF4FBFC.5060307@gmail.com> Message-ID: I like this idea. Coming from Java, I'm used to interfaces and abstract classes whereby Set, Map, List, etc. implementations can share the same basic API except if you need to use something specific to that implementation. So, basically you want to mimicking the behavior of the Map interface which has multiple implementations below it of HashMap, TreeMap, etc. I think it greatly simplifies usage and makes switching between implementations far easier. The same can/should be done with sets too, no? On Fri, Dec 23, 2011 at 2:09 PM, Richard Carlsson < carlsson.richard@REDACTED> wrote: > A thing I've been tinkering with on and off for years is making a unified > API for dictionaries in Erlang (dict, orddict, gb_trees, ets, dets). This > requires figuring out a set of function names and calling conventions that > are mostly familiar but which don't already have a conflicting definition > in one or more of the modules involved. > > In the end I went for using most of the dict module API unchanged, with > some new synonyms, and a number of additional useful functions. I also made > the dict module define a new 'dict' behaviour (even though it's just an > interface rather than a complete behaviour). > > One particular detail is that gb_trees (with its user-unfriendly name and > rather different calling conventions) can now quite simply be used through > the dict module as an ordered variant of dict, and you can pretend you > never heard of the gb_trees module unless you want to use one of its > specially implementation-dependent functions. An ordered dict can be > created through dict:new([ordered_set]). This also resolved some major > problems with clashing function definitions. > > The code (based on the OTP maint branch) can be found here: > > https://github.com/richcarl/**otp/tree/dict-api > > The quickest way of having a look at the suggested API is to follow this > link and scroll down to see the behaviour callback: > > https://github.com/richcarl/**otp/blob/dict-api/lib/stdlib/**src/dict.erl > > > Reactions, suggestions, and test pilots are most welcome. I'm not ready to > write an EEP until I feel the API is good enough. Things still on the > TODO-list are: updating the docs for ets and dets, figuring out a good set > of iterator functions, and maybe include QLC table/1/2 functions and > match/select functions in the API. And then the same kind of unified API > should be made for sets and probably also for sequences. > > A Good Yule to y'all, > > /Richard > ______________________________**_________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/**listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From ericbmerritt@REDACTED Sat Dec 24 03:26:31 2011 From: ericbmerritt@REDACTED (Eric Merritt) Date: Fri, 23 Dec 2011 21:26:31 -0500 Subject: [erlang-questions] towards a unified dict api In-Reply-To: References: <4EF4FBFC.5060307@gmail.com> Message-ID: When Torben and I did signatures (something akin to java interfaces) last year for erlware_commons we went through the same process. You can see the dictionary signature here https://github.com/erlware/erlware_commons/blob/master/src/ec_dictionary.erl which contains what we came up with along those lines. signatures are our attempt to provide, standard interfaces that are friendly to tools like dialyzer and xref. The best part about them is they don't require language changes. On Fri, Dec 23, 2011 at 7:43 PM, Andrew Berman wrote: > I like this idea. Coming from Java, I'm used to interfaces and abstract > classes whereby Set, Map, List, etc. implementations can share the same > basic API except if you need to use something specific to that > implementation. ?So, basically you want to mimicking the behavior of the Map > interface which has multiple implementations below it of HashMap, TreeMap, > etc. ?I think it greatly simplifies usage and makes switching between > implementations far easier. ?The same can/should be done with sets too, no? > > On Fri, Dec 23, 2011 at 2:09 PM, Richard Carlsson > wrote: >> >> A thing I've been tinkering with on and off for years is making a unified >> API for dictionaries in Erlang (dict, orddict, gb_trees, ets, dets). This >> requires figuring out a set of function names and calling conventions that >> are mostly familiar but which don't already have a conflicting definition in >> one or more of the modules involved. >> >> In the end I went for using most of the dict module API unchanged, with >> some new synonyms, and a number of additional useful functions. I also made >> the dict module define a new 'dict' behaviour (even though it's just an >> interface rather than a complete behaviour). >> >> One particular detail is that gb_trees (with its user-unfriendly name and >> rather different calling conventions) can now quite simply be used through >> the dict module as an ordered variant of dict, and you can pretend you never >> heard of the gb_trees module unless you want to use one of its specially >> implementation-dependent functions. An ordered dict can be created through >> dict:new([ordered_set]). This also resolved some major problems with >> clashing function definitions. >> >> The code (based on the OTP maint branch) can be found here: >> >> https://github.com/richcarl/otp/tree/dict-api >> >> The quickest way of having a look at the suggested API is to follow this >> link and scroll down to see the behaviour callback: >> >> https://github.com/richcarl/otp/blob/dict-api/lib/stdlib/src/dict.erl >> >> >> Reactions, suggestions, and test pilots are most welcome. I'm not ready to >> write an EEP until I feel the API is good enough. Things still on the >> TODO-list are: updating the docs for ets and dets, figuring out a good set >> of iterator functions, and maybe include QLC table/1/2 functions and >> match/select functions in the API. And then the same kind of unified API >> should be made for sets and probably also for sequences. >> >> A Good Yule to y'all, >> >> ?/Richard >> _______________________________________________ >> 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 > T From ericbmerritt@REDACTED Sat Dec 24 03:27:52 2011 From: ericbmerritt@REDACTED (Eric Merritt) Date: Fri, 23 Dec 2011 21:27:52 -0500 Subject: [erlang-questions] The Core Erlang AST via cerl.erl and Sequence returns from functions In-Reply-To: <1324505341.17562.6.camel@localhost.localdomain> References: <4EF2456B.3060600@gmail.com> <1324505341.17562.6.camel@localhost.localdomain> Message-ID: Richard, Just a quick follow up. How do you actually debug modules in the standard libraries? The debugger refuses to step into sticky dirs, of which kernel and stardard lib are. Thanks, Eric On Wed, Dec 21, 2011 at 5:09 PM, Eric B Merritt wrote: > Richard, > > ?Thanks, Its good to know that its not me misunderstanding things. I > will see if I can dig into the compiler here in the next couple of days > and submit a patch to the patches list. > > Eric > > On Wed, 2011-12-21 at 21:45 +0100, Richard Carlsson wrote: >> On 2011-12-21 17:36, Eric Merritt wrote: >> > Guys, >> > >> > I am currently targeting the Erlang VM for a custom language via core >> > erlang as defined in cerl.erl on R15B. I have run into an interesting >> > issue. In a Let form (cerl:c_let) if I have a sequence of c_vars on >> > the Variable arguement and c_apply (on a function that returns a >> > c_values) in the Argument argument then the erlang compiler exits with >> > an 'error'. However, if I have a c_values directly as the Argument >> > argument the compiler will compile the form. Either I am understanding >> > something incorrectly or this is a bug in the cerl compiler. I am >> > hoping one of the folks that is knowledgeable on the subject can help >> > out. In short the following works: >> > >> > ? ? ?cerl:c_let([cerl:c_var(x0), cerl:c_var(x1)], >> > cerl:c_values([cerl:c_int(0), cerl:c_int(1)]), cerl:c_atom(foo)) >> > >> > while this does not: >> > >> > ? ? ?> > cerl:c_int(1)])> >> > >> > ? ? ?cerl:c_let([cerl:c_var(x0), cerl:c_var(x1)], >> > cerl:c_apply(cerl:c_fname(my_fun, 0), []), cerl:c_atom(foo)). >> >> Intuitively (and without consulting the source code or my old papers on >> Core Erlang), I'd say that the latter should work. However, the OTP >> compiler doesn't try to be complete with respect to all possible Core >> Erlang programs - it only bothers to implement what's needed to handle >> code that's first been translated from (full) Erlang. So if you start >> generating arbitrary but legal Core Erlang, you may run into corner >> cases (in this case, it seems that multiple return values aren't handled >> as they ought to be). See if you can find the problem in the compiler - >> as Calvin's dad used to say, "it builds character". :-) >> >> ? ? ?/Richard >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://erlang.org/mailman/listinfo/erlang-questions > > From gianfranco.alongi@REDACTED Sat Dec 24 10:31:20 2011 From: gianfranco.alongi@REDACTED (Gianfranco Alongi) Date: Sat, 24 Dec 2011 10:31:20 +0100 Subject: [erlang-questions] The Core Erlang AST via cerl.erl and Sequence returns from functions In-Reply-To: References: <4EF2456B.3060600@gmail.com> <1324505341.17562.6.camel@localhost.localdomain> Message-ID: Have not tried this yet (in the midst of christmas setup) - but try with code:unstick_dir ? http://www.erlang.org/doc/man/code.html#unstick_dir-1 /G On Sat, Dec 24, 2011 at 3:27 AM, Eric Merritt wrote: > Richard, > > ?Just a quick follow up. How do you actually debug modules in the > standard libraries? The debugger refuses to step into sticky dirs, of > which kernel and stardard lib are. > > Thanks, > Eric > > On Wed, Dec 21, 2011 at 5:09 PM, Eric B Merritt wrote: >> Richard, >> >> ?Thanks, Its good to know that its not me misunderstanding things. I >> will see if I can dig into the compiler here in the next couple of days >> and submit a patch to the patches list. >> >> Eric >> >> On Wed, 2011-12-21 at 21:45 +0100, Richard Carlsson wrote: >>> On 2011-12-21 17:36, Eric Merritt wrote: >>> > Guys, >>> > >>> > I am currently targeting the Erlang VM for a custom language via core >>> > erlang as defined in cerl.erl on R15B. I have run into an interesting >>> > issue. In a Let form (cerl:c_let) if I have a sequence of c_vars on >>> > the Variable arguement and c_apply (on a function that returns a >>> > c_values) in the Argument argument then the erlang compiler exits with >>> > an 'error'. However, if I have a c_values directly as the Argument >>> > argument the compiler will compile the form. Either I am understanding >>> > something incorrectly or this is a bug in the cerl compiler. I am >>> > hoping one of the folks that is knowledgeable on the subject can help >>> > out. In short the following works: >>> > >>> > ? ? ?cerl:c_let([cerl:c_var(x0), cerl:c_var(x1)], >>> > cerl:c_values([cerl:c_int(0), cerl:c_int(1)]), cerl:c_atom(foo)) >>> > >>> > while this does not: >>> > >>> > ? ? ?>> > cerl:c_int(1)])> >>> > >>> > ? ? ?cerl:c_let([cerl:c_var(x0), cerl:c_var(x1)], >>> > cerl:c_apply(cerl:c_fname(my_fun, 0), []), cerl:c_atom(foo)). >>> >>> Intuitively (and without consulting the source code or my old papers on >>> Core Erlang), I'd say that the latter should work. However, the OTP >>> compiler doesn't try to be complete with respect to all possible Core >>> Erlang programs - it only bothers to implement what's needed to handle >>> code that's first been translated from (full) Erlang. So if you start >>> generating arbitrary but legal Core Erlang, you may run into corner >>> cases (in this case, it seems that multiple return values aren't handled >>> as they ought to be). See if you can find the problem in the compiler - >>> as Calvin's dad used to say, "it builds character". :-) >>> >>> ? ? ?/Richard >>> _______________________________________________ >>> 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 ulf@REDACTED Sat Dec 24 10:51:32 2011 From: ulf@REDACTED (Ulf Wiger) Date: Sat, 24 Dec 2011 10:51:32 +0100 Subject: [erlang-questions] The Core Erlang AST via cerl.erl and Sequence returns from functions In-Reply-To: References: <4EF2456B.3060600@gmail.com> <1324505341.17562.6.camel@localhost.localdomain> Message-ID: <27C4E1F3-85CA-4137-A0F5-A8972B4F89C9@feuerlabs.com> ?or simply add the -nostick flag to the command line. BR, Ulf W On 24 Dec 2011, at 10:31, Gianfranco Alongi wrote: > Have not tried this yet (in the midst of christmas setup) - but try > with code:unstick_dir ? > > http://www.erlang.org/doc/man/code.html#unstick_dir-1 > > /G > > On Sat, Dec 24, 2011 at 3:27 AM, Eric Merritt wrote: >> Richard, >> >> Just a quick follow up. How do you actually debug modules in the >> standard libraries? The debugger refuses to step into sticky dirs, of >> which kernel and stardard lib are. >> >> Thanks, >> Eric >> >> On Wed, Dec 21, 2011 at 5:09 PM, Eric B Merritt wrote: >>> Richard, >>> >>> Thanks, Its good to know that its not me misunderstanding things. I >>> will see if I can dig into the compiler here in the next couple of days >>> and submit a patch to the patches list. >>> >>> Eric >>> >>> On Wed, 2011-12-21 at 21:45 +0100, Richard Carlsson wrote: >>>> On 2011-12-21 17:36, Eric Merritt wrote: >>>>> Guys, >>>>> >>>>> I am currently targeting the Erlang VM for a custom language via core >>>>> erlang as defined in cerl.erl on R15B. I have run into an interesting >>>>> issue. In a Let form (cerl:c_let) if I have a sequence of c_vars on >>>>> the Variable arguement and c_apply (on a function that returns a >>>>> c_values) in the Argument argument then the erlang compiler exits with >>>>> an 'error'. However, if I have a c_values directly as the Argument >>>>> argument the compiler will compile the form. Either I am understanding >>>>> something incorrectly or this is a bug in the cerl compiler. I am >>>>> hoping one of the folks that is knowledgeable on the subject can help >>>>> out. In short the following works: >>>>> >>>>> cerl:c_let([cerl:c_var(x0), cerl:c_var(x1)], >>>>> cerl:c_values([cerl:c_int(0), cerl:c_int(1)]), cerl:c_atom(foo)) >>>>> >>>>> while this does not: >>>>> >>>>> >>>> cerl:c_int(1)])> >>>>> >>>>> cerl:c_let([cerl:c_var(x0), cerl:c_var(x1)], >>>>> cerl:c_apply(cerl:c_fname(my_fun, 0), []), cerl:c_atom(foo)). >>>> >>>> Intuitively (and without consulting the source code or my old papers on >>>> Core Erlang), I'd say that the latter should work. However, the OTP >>>> compiler doesn't try to be complete with respect to all possible Core >>>> Erlang programs - it only bothers to implement what's needed to handle >>>> code that's first been translated from (full) Erlang. So if you start >>>> generating arbitrary but legal Core Erlang, you may run into corner >>>> cases (in this case, it seems that multiple return values aren't handled >>>> as they ought to be). See if you can find the problem in the compiler - >>>> as Calvin's dad used to say, "it builds character". :-) >>>> >>>> /Richard >>>> _______________________________________________ >>>> 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 kenneth.lundin@REDACTED Sat Dec 24 11:40:50 2011 From: kenneth.lundin@REDACTED (Kenneth Lundin) Date: Sat, 24 Dec 2011 11:40:50 +0100 Subject: [erlang-questions] Fail fast In-Reply-To: <73566F3C-67B2-4947-98E6-61AC387A9532@gmail.com> References: <73566F3C-67B2-4947-98E6-61AC387A9532@gmail.com> Message-ID: We have been discussing things like this for several years now. But like a coincidence we have in our plans that something should happen in this area during the year. Cannot be more specific, yet. Kenneth Erlang/OTP Ericsson Den 23 dec 2011 22:14 skrev "Zabrane Mickael" : > Fantastic Tony. > > Any chance to see these features officially integrated one day ... OTP > folks? > > Regards, > Zabrane > > On Dec 23, 2011, at 6:32 PM, Tony Rogvall wrote: > > Hi! > > If you are really, really interested in these kind of thing then maybe you > could have a look in > github.com/tonyrog/otp in the branch limits. > > It basically implements som new options to spawn_opt to set up resource > limits like: > > max_memory > max_time > max_cpu > max_reductions > max_processes > max_ports > max_tables > max_message_queue_len > > limits are inherited by spawned process and some of the resources are > shared among the spawn processes to form a kind of resource group. > > The implementation is experimental and was made in order to demonstrate > the > features for the OTP group. Time for an EEP? > > Flavors of max_message_queue_len could be let sender crash, receiver > crash, sender block > (not so erlangish: drop head of message queue , drop tail of message queue > ) > > > /Tony > > > On 23 dec 2011, at 18:04, Chandru wrote: > > Yes, I agree. I asked for "bounded message queues" a long time ago, but I > got voted down :( > > http://erlang.org/pipermail/erlang-questions/2008-June/035517.html > > Chandru > > On 23 December 2011 14:44, Matthew Evans wrote: > >> Email got sent too soon..... >> >> >> The ability to handle this is a "feature" that I think is missing from >> Erlang. The VM and the language is very stable, but the fact that a single, >> poorly behaving, process can cause the VM to die is pretty undesirable. I >> had a bug in a "logging" process where an ETS table wasn't getting purged >> properly. It grew and grew eventually bringing down the entire VM due to an >> OOM condition. This process wasn't significant to the operation of the >> system, (and if I wanted it to be I would've written a supervisor to manage >> it), yet it killed a critical service. >> >> >> My personal wish would be the ability to optionally apply limits to a >> process when it is spawned (memory, ets table sizes, message queue would be >> a good start). When one or more of the limits are exceeded the process can >> be killed (and then trapped/supervised if needed). It would make the VM >> more stable, and would also assist in debugging (since it would be easy to >> see in the sasl logs what happened without needing to look at a crash >> dump). One other advantage of this is the ability to assist in testing, >> having the limits set temporarily to find possible memory hogs and issues >> with head of line blocking (message queues growing too much). Those limits >> would be removed for production. >> >> >> An option like that would, IMO, be a useful addition to the language. >> >> >> Cheers >> >> >> Matt >> >> ------------------------------ >> From: chandrashekhar.mullaparthi@REDACTED >> Date: Fri, 23 Dec 2011 07:44:49 +0000 >> To: jwatte@REDACTED >> CC: erlang-questions@REDACTED >> Subject: Re: [erlang-questions] Fail fast >> >> No, if BEAM cannot allocate more memory, the node just dies. In case you >> are interested, this handling of OOM condition has been discussed on the >> mailing list in the past. Supervision hierarchies don't help in this case. >> >> cheers >> Chandru >> >> On 23 December 2011 02:03, Jon Watte wrote: >> >> If there was a proper supervision hierarchy all the way up to the "root" >> of the application, why would this happen? Wouldn't the supervisors just >> kill off whatever process ends up not being able to allocate memory, and >> thus clean up? (Perhaps kicking off users at the same time) If it fails far >> enough up, wouldn't it basically reset the erl environment to "scratch" ? >> Or would that be expecting too much from the supervision hierarchy? >> >> Sincerely, >> >> jw >> >> >> -- >> Americans might object: there is no way we would sacrifice our living >> standards for the benefit of people in the rest of the world. Nevertheless, >> whether we get there willingly or not, we shall soon have lower consumption >> rates, because our present rates are unsustainable. >> >> >> >> On Tue, Dec 20, 2011 at 6:23 PM, Chandru < >> chandrashekhar.mullaparthi@REDACTED> wrote: >> >> Hello everyone, >> >> I've just had a failure in one of my live services because an erlang node >> ran out of memory (caused by a traffic spike). Restart mechanisms exist to >> restart the node, but the node took a long time to die because it was >> writing a large erl_crash.dump file, and then there was a 7GB core dump. >> >> Is there a quicker way to fail? I'm thinking of disabling core dumps >> entirely on the box. What else can I do? A configuration option on the node >> to only produce a summary erl_crash.dump would be nice. The most useful >> things for me in a crash dump usually are the slogan at the top, and the >> message queue lengths of each process. In this particular case, the slogan >> would've told me all that I needed to know. >> >> Chandru >> >> >> _______________________________________________ >> 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 > > > "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 > > > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From zabrane3@REDACTED Sat Dec 24 11:42:34 2011 From: zabrane3@REDACTED (Zabrane Mickael) Date: Sat, 24 Dec 2011 11:42:34 +0100 Subject: [erlang-questions] Fail fast In-Reply-To: References: <73566F3C-67B2-4947-98E6-61AC387A9532@gmail.com> Message-ID: <36D234AA-7166-474C-A6AD-39D9273AB477@gmail.com> Great news for 2012 ;-) Regards, Zabrane On Dec 24, 2011, at 11:40 AM, Kenneth Lundin wrote: > We have been discussing things like this for several years now. But like a coincidence we have in our plans that something should happen in this area during the year. > Cannot be more specific, yet. > > Kenneth Erlang/OTP Ericsson > > Den 23 dec 2011 22:14 skrev "Zabrane Mickael" : > Fantastic Tony. > > Any chance to see these features officially integrated one day ... OTP folks? > > Regards, > Zabrane > > On Dec 23, 2011, at 6:32 PM, Tony Rogvall wrote: > >> Hi! >> >> If you are really, really interested in these kind of thing then maybe you could have a look in >> github.com/tonyrog/otp in the branch limits. >> >> It basically implements som new options to spawn_opt to set up resource limits like: >> >> max_memory >> max_time >> max_cpu >> max_reductions >> max_processes >> max_ports >> max_tables >> max_message_queue_len >> >> limits are inherited by spawned process and some of the resources are >> shared among the spawn processes to form a kind of resource group. >> >> The implementation is experimental and was made in order to demonstrate the >> features for the OTP group. Time for an EEP? >> >> Flavors of max_message_queue_len could be let sender crash, receiver crash, sender block >> (not so erlangish: drop head of message queue , drop tail of message queue ) >> >> >> /Tony >> >> >> On 23 dec 2011, at 18:04, Chandru wrote: >> >>> Yes, I agree. I asked for "bounded message queues" a long time ago, but I got voted down :( >>> >>> http://erlang.org/pipermail/erlang-questions/2008-June/035517.html >>> >>> Chandru >>> >>> On 23 December 2011 14:44, Matthew Evans wrote: >>> Email got sent too soon..... >>> >>> >>> >>> The ability to handle this is a "feature" that I think is missing from Erlang. The VM and the language is very stable, but the fact that a single, poorly behaving, process can cause the VM to die is pretty undesirable. I had a bug in a "logging" process where an ETS table wasn't getting purged properly. It grew and grew eventually bringing down the entire VM due to an OOM condition. This process wasn't significant to the operation of the system, (and if I wanted it to be I would've written a supervisor to manage it), yet it killed a critical service. >>> >>> >>> >>> My personal wish would be the ability to optionally apply limits to a process when it is spawned (memory, ets table sizes, message queue would be a good start). When one or more of the limits are exceeded the process can be killed (and then trapped/supervised if needed). It would make the VM more stable, and would also assist in debugging (since it would be easy to see in the sasl logs what happened without needing to look at a crash dump). One other advantage of this is the ability to assist in testing, having the limits set temporarily to find possible memory hogs and issues with head of line blocking (message queues growing too much). Those limits would be removed for production. >>> >>> >>> >>> An option like that would, IMO, be a useful addition to the language. >>> >>> >>> >>> Cheers >>> >>> >>> >>> Matt >>> >>> >>> From: chandrashekhar.mullaparthi@REDACTED >>> Date: Fri, 23 Dec 2011 07:44:49 +0000 >>> To: jwatte@REDACTED >>> CC: erlang-questions@REDACTED >>> Subject: Re: [erlang-questions] Fail fast >>> >>> No, if BEAM cannot allocate more memory, the node just dies. In case you are interested, this handling of OOM condition has been discussed on the mailing list in the past. Supervision hierarchies don't help in this case. >>> >>> cheers >>> Chandru >>> >>> On 23 December 2011 02:03, Jon Watte wrote: >>> If there was a proper supervision hierarchy all the way up to the "root" of the application, why would this happen? Wouldn't the supervisors just kill off whatever process ends up not being able to allocate memory, and thus clean up? (Perhaps kicking off users at the same time) If it fails far enough up, wouldn't it basically reset the erl environment to "scratch" ? Or would that be expecting too much from the supervision hierarchy? >>> >>> Sincerely, >>> >>> jw >>> >>> >>> -- >>> Americans might object: there is no way we would sacrifice our living standards for the benefit of people in the rest of the world. Nevertheless, whether we get there willingly or not, we shall soon have lower consumption rates, because our present rates are unsustainable. >>> >>> >>> >>> On Tue, Dec 20, 2011 at 6:23 PM, Chandru wrote: >>> Hello everyone, >>> >>> I've just had a failure in one of my live services because an erlang node ran out of memory (caused by a traffic spike). Restart mechanisms exist to restart the node, but the node took a long time to die because it was writing a large erl_crash.dump file, and then there was a 7GB core dump. >>> >>> Is there a quicker way to fail? I'm thinking of disabling core dumps entirely on the box. What else can I do? A configuration option on the node to only produce a summary erl_crash.dump would be nice. The most useful things for me in a crash dump usually are the slogan at the top, and the message queue lengths of each process. In this particular case, the slogan would've told me all that I needed to know. >>> >>> Chandru >>> >>> >>> _______________________________________________ >>> 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 >> >> "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 > > > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From steven.charles.davis@REDACTED Sat Dec 24 13:59:05 2011 From: steven.charles.davis@REDACTED (Steve Davis) Date: Sat, 24 Dec 2011 04:59:05 -0800 (PST) Subject: [erlang-questions] wxTaskBarIcon In-Reply-To: References: <005d4336-4d8a-467e-a913-ded20a1aa193@l29g2000yqf.googlegroups.com> Message-ID: <34089f4c-e804-47a1-8fae-3b5bd7f89388@p13g2000yqd.googlegroups.com> My omission -- I made an assumption that since wxTaskBarIcon wasn't in wxe yet, and I had seen the class in 2.9, that it wasn't in 2.8 -- wrong! Apologies for the misdirection. Dan, if you are taking requests... can you add wxStyledTextCtrl_SetEdgeMode (the related GetEdgeMode and other edge calls are there)? Also, it would be excellent if the wxStyledTextCtrl_Annotation* calls were exposed. I'm not 100% sure they are there in wx 2.8 as it's hard to find the docs for STC in 2.8, but they seem to have been on the Scintilla interface for some years and are definitely in the STC for wx 2.9. Best, /s On Dec 23, 7:44?am, Dan Gudmundsson wrote: > Okidoki, added to tasklist for R15B01 > > I will take a look at it. > > /Dan > > On Fri, Dec 23, 2011 at 1:17 PM, Gleb Peregud wrote: > > On Fri, Dec 23, 2011 at 13:15, Dan Gudmundsson wrote: > >> Is wxTaskBarIcon 2.9 only? > >> Otherwise new functionality is easily added. > >> I add classes when I need them or they are requested. > > > It seems to be present in 2.8 too (I haven't checked the code): > > >http://docs.wxwidgets.org/2.8/wx_wxtaskbaricon.html > > _______________________________________________ > erlang-questions mailing list > erlang-questi...@REDACTED://erlang.org/mailman/listinfo/erlang-questions From meetprashant007@REDACTED Sat Dec 24 14:29:58 2011 From: meetprashant007@REDACTED (Prashant Sharma) Date: Sat, 24 Dec 2011 18:59:58 +0530 Subject: [erlang-questions] Http Load balancer in erlang. Message-ID: Hi all, Christmas greetings. I was wondering, if there is a http load balancer writtern which support dynamic configuration (that is configuring with-out restarting.) -- Prashant Sharma Development Engineer Pramati Technologies Begumpet "Hare Krishna" From mattevans123@REDACTED Sat Dec 24 16:12:47 2011 From: mattevans123@REDACTED (Matthew Evans) Date: Sat, 24 Dec 2011 10:12:47 -0500 Subject: [erlang-questions] Fail fast In-Reply-To: References: , , , , , , <73566F3C-67B2-4947-98E6-61AC387A9532@gmail.com>, Message-ID: That's awesome. Looking forward to seeing it. Date: Sat, 24 Dec 2011 11:40:50 +0100 From: kenneth.lundin@REDACTED To: zabrane3@REDACTED CC: erlang-questions@REDACTED Subject: Re: [erlang-questions] Fail fast We have been discussing things like this for several years now. But like a coincidence we have in our plans that something should happen in this area during the year. Cannot be more specific, yet. Kenneth Erlang/OTP Ericsson Den 23 dec 2011 22:14 skrev "Zabrane Mickael" : Fantastic Tony. Any chance to see these features officially integrated one day ... OTP folks? Regards,Zabrane On Dec 23, 2011, at 6:32 PM, Tony Rogvall wrote: Hi! If you are really, really interested in these kind of thing then maybe you could have a look in github.com/tonyrog/otp in the branch limits. It basically implements som new options to spawn_opt to set up resource limits like: max_memorymax_timemax_cpumax_reductionsmax_processesmax_portsmax_tablesmax_message_queue_len limits are inherited by spawned process and some of the resources are shared among the spawn processes to form a kind of resource group. The implementation is experimental and was made in order to demonstrate the features for the OTP group. Time for an EEP? Flavors of max_message_queue_len could be let sender crash, receiver crash, sender block(not so erlangish: drop head of message queue , drop tail of message queue ) /Tony On 23 dec 2011, at 18:04, Chandru wrote: Yes, I agree. I asked for "bounded message queues" a long time ago, but I got voted down :( http://erlang.org/pipermail/erlang-questions/2008-June/035517.html Chandru On 23 December 2011 14:44, Matthew Evans wrote: Email got sent too soon..... The ability to handle this is a "feature" that I think is missing from Erlang. The VM and the language is very stable, but the fact that a single, poorly behaving, process can cause the VM to die is pretty undesirable. I had a bug in a "logging" process where an ETS table wasn't getting purged properly. It grew and grew eventually bringing down the entire VM due to an OOM condition. This process wasn't significant to the operation of the system, (and if I wanted it to be I would've written a supervisor to manage it), yet it killed a critical service. My personal wish would be the ability to optionally apply limits to a process when it is spawned (memory, ets table sizes, message queue would be a good start). When one or more of the limits are exceeded the process can be killed (and then trapped/supervised if needed). It would make the VM more stable, and would also assist in debugging (since it would be easy to see in the sasl logs what happened without needing to look at a crash dump). One other advantage of this is the ability to assist in testing, having the limits set temporarily to find possible memory hogs and issues with head of line blocking (message queues growing too much). Those limits would be removed for production. An option like that would, IMO, be a useful addition to the language. Cheers Matt From: chandrashekhar.mullaparthi@REDACTED Date: Fri, 23 Dec 2011 07:44:49 +0000 To: jwatte@REDACTED CC: erlang-questions@REDACTED Subject: Re: [erlang-questions] Fail fast No, if BEAM cannot allocate more memory, the node just dies. In case you are interested, this handling of OOM condition has been discussed on the mailing list in the past. Supervision hierarchies don't help in this case. cheers Chandru On 23 December 2011 02:03, Jon Watte wrote: If there was a proper supervision hierarchy all the way up to the "root" of the application, why would this happen? Wouldn't the supervisors just kill off whatever process ends up not being able to allocate memory, and thus clean up? (Perhaps kicking off users at the same time) If it fails far enough up, wouldn't it basically reset the erl environment to "scratch" ? Or would that be expecting too much from the supervision hierarchy? Sincerely, jw -- Americans might object: there is no way we would sacrifice our living standards for the benefit of people in the rest of the world. Nevertheless, whether we get there willingly or not, we shall soon have lower consumption rates, because our present rates are unsustainable. On Tue, Dec 20, 2011 at 6:23 PM, Chandru wrote: Hello everyone, I've just had a failure in one of my live services because an erlang node ran out of memory (caused by a traffic spike). Restart mechanisms exist to restart the node, but the node took a long time to die because it was writing a large erl_crash.dump file, and then there was a 7GB core dump. Is there a quicker way to fail? I'm thinking of disabling core dumps entirely on the box. What else can I do? A configuration option on the node to only produce a summary erl_crash.dump would be nice. The most useful things for me in a crash dump usually are the slogan at the top, and the message queue lengths of each process. In this particular case, the slogan would've told me all that I needed to know. Chandru _______________________________________________ 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 "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 _______________________________________________ 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 zabrane3@REDACTED Sat Dec 24 19:37:36 2011 From: zabrane3@REDACTED (Zabrane Mickael) Date: Sat, 24 Dec 2011 19:37:36 +0100 Subject: [erlang-questions] How to efficiently set the bit at position Index to 1 in a binary? Message-ID: Hi folks, Here's my code: %%-------------------------------------------------------------------- %% @doc Set the bit at position Index to 1 in the binary Bin. %% @end %%-------------------------------------------------------------------- -spec set(Bin :: binary(), Index :: non_neg_integer()) -> binary(). set(<<1:1, _/bits>> = Bin, 0) -> Bin; set(<<0:1, Rest/bits>>, 0) -> <<1:1, Rest/bits>>; set(Bin, Index) when Index > 0 -> Before = Index - 1, <> = Bin, <>. After compiling, I'm getting the following warnings: src/foo.erl:248: Warning: INFO: the '=' operator will prevent delayed sub binary optimization src/foo.erl:248: Warning: INFO: the '=' operator will prevent delayed sub binary optimization src/foo.erl:250: Warning: NOT OPTIMIZED: sub binary is used or returned src/foo.erl:254: Warning: NOT OPTIMIZED: sub binary is used or returned What's the best/optimized solution and how to get rid of these warnings? Regards, Zabrane -------------- next part -------------- An HTML attachment was scrubbed... URL: From freza@REDACTED Sat Dec 24 20:17:24 2011 From: freza@REDACTED (Jachym Holecek) Date: Sat, 24 Dec 2011 14:17:24 -0500 Subject: [erlang-questions] How to efficiently set the bit at position Index to 1 in a binary? In-Reply-To: References: Message-ID: <20111224191724.GA15597@circlewave.net> # Zabrane Mickael 2011-12-24: > Hi folks, > > Here's my code: > > %%-------------------------------------------------------------------- > %% @doc Set the bit at position Index to 1 in the binary Bin. > %% @end > %%-------------------------------------------------------------------- > -spec set(Bin :: binary(), Index :: non_neg_integer()) -> binary(). > set(<<1:1, _/bits>> = Bin, 0) -> > Bin; > set(<<0:1, Rest/bits>>, 0) -> > <<1:1, Rest/bits>>; > set(Bin, Index) when Index > 0 -> > Before = Index - 1, > <> = Bin, > <>. > > > After compiling, I'm getting the following warnings: > src/foo.erl:248: Warning: INFO: the '=' operator will prevent delayed sub binary optimization > src/foo.erl:248: Warning: INFO: the '=' operator will prevent delayed sub binary optimization > src/foo.erl:250: Warning: NOT OPTIMIZED: sub binary is used or returned > src/foo.erl:254: Warning: NOT OPTIMIZED: sub binary is used or returned > > What's the best/optimized solution and how to get rid of these warnings? Binary matching is *much* more powerful than what it looks like at first: -module(a). -export([a/2]). a(N, B) -> fun (<>) -> <> end(B). The compiler refuses the saner form (doing the binary match in a/1's head directly) quoting the delusion that N isn't bound at that point... pity. Have fun, -- Jachym From zabrane3@REDACTED Sat Dec 24 22:52:12 2011 From: zabrane3@REDACTED (Zabrane Mickael) Date: Sat, 24 Dec 2011 22:52:12 +0100 Subject: [erlang-questions] How to efficiently set the bit at position Index to 1 in a binary? In-Reply-To: <20111224191724.GA15597@circlewave.net> References: <20111224191724.GA15597@circlewave.net> Message-ID: Your trick is simply awesome Jachym ;-) Regards, Zabrane On Dec 24, 2011, at 8:17 PM, Jachym Holecek wrote: > # Zabrane Mickael 2011-12-24: >> Hi folks, >> >> Here's my code: >> >> %%-------------------------------------------------------------------- >> %% @doc Set the bit at position Index to 1 in the binary Bin. >> %% @end >> %%-------------------------------------------------------------------- >> -spec set(Bin :: binary(), Index :: non_neg_integer()) -> binary(). >> set(<<1:1, _/bits>> = Bin, 0) -> >> Bin; >> set(<<0:1, Rest/bits>>, 0) -> >> <<1:1, Rest/bits>>; >> set(Bin, Index) when Index > 0 -> >> Before = Index - 1, >> <> = Bin, >> <>. >> >> >> After compiling, I'm getting the following warnings: >> src/foo.erl:248: Warning: INFO: the '=' operator will prevent delayed sub binary optimization >> src/foo.erl:248: Warning: INFO: the '=' operator will prevent delayed sub binary optimization >> src/foo.erl:250: Warning: NOT OPTIMIZED: sub binary is used or returned >> src/foo.erl:254: Warning: NOT OPTIMIZED: sub binary is used or returned >> >> What's the best/optimized solution and how to get rid of these warnings? > > Binary matching is *much* more powerful than what it looks like at first: > > -module(a). > -export([a/2]). > > a(N, B) -> > fun (<>) -> > <> > end(B). > > The compiler refuses the saner form (doing the binary match in a/1's head > directly) quoting the delusion that N isn't bound at that point... pity. > > Have fun, > -- Jachym From zabrane3@REDACTED Sat Dec 24 23:22:37 2011 From: zabrane3@REDACTED (Zabrane Mickael) Date: Sat, 24 Dec 2011 23:22:37 +0100 Subject: [erlang-questions] How to efficiently set the bit at position Index to 1 in a binary? In-Reply-To: <20111224191724.GA15597@circlewave.net> References: <20111224191724.GA15597@circlewave.net> Message-ID: <4DD3A808-98E6-44B6-A87B-152536E455D7@gmail.com> One last thing. > a(N, B) -> > fun (<>) -> % THIS IS LINE 266 > <> > end(B). How to disable the following warning only for this function: src/foo.erl:266: Warning: NOT OPTIMIZED: sub binary is used or returned is there a way to do it by using -compile(...) directive? Regards, Zabrane On Dec 24, 2011, at 8:17 PM, Jachym Holecek wrote: > # Zabrane Mickael 2011-12-24: >> Hi folks, >> >> Here's my code: >> >> %%-------------------------------------------------------------------- >> %% @doc Set the bit at position Index to 1 in the binary Bin. >> %% @end >> %%-------------------------------------------------------------------- >> -spec set(Bin :: binary(), Index :: non_neg_integer()) -> binary(). >> set(<<1:1, _/bits>> = Bin, 0) -> >> Bin; >> set(<<0:1, Rest/bits>>, 0) -> >> <<1:1, Rest/bits>>; >> set(Bin, Index) when Index > 0 -> >> Before = Index - 1, >> <> = Bin, >> <>. >> >> >> After compiling, I'm getting the following warnings: >> src/foo.erl:248: Warning: INFO: the '=' operator will prevent delayed sub binary optimization >> src/foo.erl:248: Warning: INFO: the '=' operator will prevent delayed sub binary optimization >> src/foo.erl:250: Warning: NOT OPTIMIZED: sub binary is used or returned >> src/foo.erl:254: Warning: NOT OPTIMIZED: sub binary is used or returned >> >> What's the best/optimized solution and how to get rid of these warnings? > > Binary matching is *much* more powerful than what it looks like at first: > > -module(a). > -export([a/2]). > > a(N, B) -> > fun (<>) -> > <> > end(B). > > The compiler refuses the saner form (doing the binary match in a/1's head > directly) quoting the delusion that N isn't bound at that point... pity. > > Have fun, > -- Jachym -------------- next part -------------- An HTML attachment was scrubbed... URL: From anthonym@REDACTED Sun Dec 25 00:02:16 2011 From: anthonym@REDACTED (Anthony Molinaro) Date: Sat, 24 Dec 2011 15:02:16 -0800 Subject: [erlang-questions] Any Erlang GIS software out there? In-Reply-To: References: <20110915160650.GB1632@alumni.caltech.edu> <20111220165547.GA35295@alumni.caltech.edu> Message-ID: <20111224230216.GA46276@alumni.caltech.edu> On Tue, Dec 20, 2011 at 06:40:26PM +0100, Benoit Chesneau wrote: > > > > Thanks for the pointer, but the trick is the interesting stuff, which > > AFAIK is not readily available (ie, city bounding box data is not > > easily available, even country data is not readily available as far > > as I can tell). ?I ended up solving this issue by using a nearest > > neighbor type of setup, where I had the latitude and longitude of a > > number of cities (about 60K cities), so created an ets table which > > I could query using a bounding box around the current latitude and > > longitude then calculating the distance to all the points in the box > > and minimizing. ?The nice thing about this is its very fast, is very > > little code and easily fits in memory on a box. > > > anything available somewhere that we could see? It sounds interresting. Not at the moment the data we use is purchased, so the code is not too useful. I might try to import some lat/long data from somewhere else and put it out there at some point. To describe it in a bit more depth, I have an ets table with entries {Lat, Lon, Geo}, which is ordered. Then given a lat/long pair as input I then do several ets:lookup/2, ets:prev/2, and ets:next/2 to get all entries within a box around the input (I use a 0.2 degree on a side box). I tried using a match spec and ets:match but it ended up being slower than getting the values myself. Once I have the list of locations in the box, I use the equirectangular approximation in a foldl to find the distance to the point nearest the given point. It's fast (about 0.1 milliseconds on average) with about 60000 entries in the ets table. > Someone added knn recently to geocouch: > > https://github.com/tsauerwein/geocouch/commit/512e67111916bfaa1192f6c1229bdf4989d84192 That's interesting, it seems like it uses straight euclidean distance calculation, so will have bit more error than equirectangular approximation (which itself has error, but is cheaper than more correct distance calculations). However, for knn that probably only matters for points in the far north or far south. Anyway, if I ever end with something I can share I will definitely post it. Happy Holidays, -Anthony -- ------------------------------------------------------------------------ Anthony Molinaro From therevoltingx@REDACTED Sun Dec 25 03:02:28 2011 From: therevoltingx@REDACTED (Miguel Morales) Date: Sat, 24 Dec 2011 18:02:28 -0800 Subject: [erlang-questions] EDoc - Generate Docs For Private Functions Message-ID: Hi All, I'm starting to use edoc to document an existing erlang code base. The easiest way I've found is to add a doc target to my Makefile that does the following: DOC_OPTS={{private,true}, {todo,true}, def,{version,\"${VERSION}\"}} erl -pa ./ebin -noshell -eval "edoc:application(${APPNAME}, \".\", [${DOC_OPTS}])." -s init stop However, there is no html documentation generated for modules that don't explicitly export its functions. I see in the documentation edoc:get_doc which takes an options tuple but I'm not sure what the best way to use this with the existing makefile by adding the least amount of code. That's why I was hoping that edoc:application would honor the {private, true} flag. Any hints or ideas? Thanks for any help. -- ~ Jeremiah:9:23-24 Android 2D MMORPG: http://solrpg.com/,?http://www.youtube.com/user/revoltingx From carlsson.richard@REDACTED Sun Dec 25 11:30:28 2011 From: carlsson.richard@REDACTED (Richard Carlsson) Date: Sun, 25 Dec 2011 11:30:28 +0100 Subject: [erlang-questions] EDoc - Generate Docs For Private Functions In-Reply-To: References: Message-ID: <4EF6FB44.7020309@gmail.com> On 12/25/2011 03:02 AM, Miguel Morales wrote: > Hi All, > > I'm starting to use edoc to document an existing erlang code base. > The easiest way I've found is to add a doc target to my Makefile that > does the following: > > DOC_OPTS={{private,true}, {todo,true}, def,{version,\"${VERSION}\"}} > erl -pa ./ebin -noshell -eval "edoc:application(${APPNAME}, \".\", > [${DOC_OPTS}])." -s init stop > > However, there is no html documentation generated for modules that > don't explicitly export its functions. I have problems understanding this statement. Are you using -compile(export_all) instead of -export(...)? In that case, don't do that. If it's generated code, then generate the export lists as well. /Richard > I see in the documentation edoc:get_doc which takes an options tuple > but I'm not sure what the best way to use this with the existing > makefile by adding the least amount of code. That's why I was hoping > that edoc:application would honor the {private, true} flag. > > Any hints or ideas? > > Thanks for any help. > > -- > ~ Jeremiah:9:23-24 > Android 2D MMORPG: http://solrpg.com/, http://www.youtube.com/user/revoltingx > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions From therevoltingx@REDACTED Sun Dec 25 11:50:22 2011 From: therevoltingx@REDACTED (Miguel Morales) Date: Sun, 25 Dec 2011 02:50:22 -0800 Subject: [erlang-questions] EDoc - Generate Docs For Private Functions In-Reply-To: <4EF6FB44.7020309@gmail.com> References: <4EF6FB44.7020309@gmail.com> Message-ID: Indeed I'm using -compile(export_all). I did this to quickly develop the modules, but now I'm going over the modules to document them and clean them up. However, I would like to document all functions, including private functions. As per this thread: http://forum.trapexit.org/viewtopic.php?p=20207&sid=343e222874c9a34b228a122638fa2d73 It seems that edoc can generate docs for private functions even if I use export_all: If you just use export_all to tweak the behaviour of edoc, > then try using the 'private' option instead. I was hoping to auto-generate docs for all functions automatically and then go back and document their specs and what not. But if I have to use export then it'll just be a bit more tedious, but not really a big deal. I was just hoping that the option tuple for application:.. would recognize the option. Thanks. On Sun, Dec 25, 2011 at 2:30 AM, Richard Carlsson < carlsson.richard@REDACTED> wrote: > On 12/25/2011 03:02 AM, Miguel Morales wrote: >> >> Hi All, >> >> I'm starting to use edoc to document an existing erlang code base. >> The easiest way I've found is to add a doc target to my Makefile that >> does the following: >> >> DOC_OPTS={{private,true}, {todo,true}, def,{version,\"${VERSION}\"}} >> erl -pa ./ebin -noshell -eval "edoc:application(${APPNAME}, \".\", >> [${DOC_OPTS}])." -s init stop >> >> However, there is no html documentation generated for modules that >> don't explicitly export its functions. > > > I have problems understanding this statement. Are you using > -compile(export_all) instead of -export(...)? In that case, don't do that. > If it's generated code, then generate the export lists as well. > > /Richard > >> I see in the documentation edoc:get_doc which takes an options tuple >> but I'm not sure what the best way to use this with the existing >> makefile by adding the least amount of code. That's why I was hoping >> that edoc:application would honor the {private, true} flag. >> >> Any hints or ideas? >> >> Thanks for any help. >> >> -- >> ~ Jeremiah:9:23-24 >> Android 2D MMORPG: http://solrpg.com/, >> http://www.youtube.com/user/revoltingx >> _______________________________________________ >> 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 -- ~ Jeremiah:9:23-24 Android 2D MMORPG: http://solrpg.com/, http://www.youtube.com/user/revoltingx -------------- next part -------------- An HTML attachment was scrubbed... URL: From zabrane3@REDACTED Sun Dec 25 17:03:04 2011 From: zabrane3@REDACTED (Zabrane Mickael) Date: Sun, 25 Dec 2011 17:03:04 +0100 Subject: [erlang-questions] is the compiler smart enough to ... Message-ID: <1A5C6F0F-1A85-4A56-BECD-49BB9FB6D6E9@gmail.com> Hi guys, Suppose this function: foo(Bin) -> Bin. Is the compiler smart enough to inline it without telling him explicitly to do so (i.e -inline ...)? Regards, Zabrane From carlsson.richard@REDACTED Sun Dec 25 06:00:16 2011 From: carlsson.richard@REDACTED (Richard Carlsson) Date: Sun, 25 Dec 2011 06:00:16 +0100 Subject: [erlang-questions] is the compiler smart enough to ... In-Reply-To: <1A5C6F0F-1A85-4A56-BECD-49BB9FB6D6E9@gmail.com> References: <1A5C6F0F-1A85-4A56-BECD-49BB9FB6D6E9@gmail.com> Message-ID: <4EF6ADE0.8090402@gmail.com> On 2011-12-25 17:03, Zabrane Mickael wrote: > Hi guys, > > Suppose this function: > foo(Bin) -> > Bin. > > Is the compiler smart enough to inline it without telling him explicitly to do so (i.e -inline ...)? No, the beam compiler currently does no inlining at all by default. You have to specify +inline on the command line or -compile(inline) in the module. (Now that line number information is included in exceptions, inlining could perhaps be turned on by default. Previously, it could make error messages confusing by pointing to the function where the code was inlined rather than to the actual source code function.) /Richard From hm@REDACTED Sun Dec 25 19:04:07 2011 From: hm@REDACTED (=?ISO-8859-1?Q?H=E5kan_Mattsson?=) Date: Sun, 25 Dec 2011 19:04:07 +0100 Subject: [erlang-questions] obsolete comment in mnesia? In-Reply-To: <45C3F55F-B913-4CEF-BD92-0E388D1FB5C7@feuerlabs.com> References: <45C3F55F-B913-4CEF-BD92-0E388D1FB5C7@feuerlabs.com> Message-ID: On Fri, Dec 23, 2011 at 7:50 PM, Ulf Wiger wrote: > > I found this in mnesia_schema.erl during some of my Christmas code browsing: > > read_nodes() -> > ? ?%% Ensure that we access the intended Mnesia > ? ?%% directory. This function may not be called > ? ?%% during startup since it will cause the > ? ?%% application_controller to get into deadlock > ? ?case mnesia_lib:ensure_loaded(?APPLICATION) of > ? ? ? ?ok -> > ? ? ? ? ? ?? > ? end. > > > As far as I can tell, there is absolutely no risk of deadlock, but I recall a time, a > looong time ago, when application:loaded_applications() was actually implemented > as a gen_server:call(), and calling it during application start would result in a > deadlock. If memory serves, this was corrected sometime around 1996-97... I added the comment after I encountered an actual deadlock in Mnesia. It was probably sometime during 1996 or 1997. > Is there something else I'm missing, or would it be ok to remove this comment? Remove the comment iff it is wrong. /H?kan From hm@REDACTED Sun Dec 25 19:08:44 2011 From: hm@REDACTED (=?ISO-8859-1?Q?H=E5kan_Mattsson?=) Date: Sun, 25 Dec 2011 19:08:44 +0100 Subject: [erlang-questions] Fail fast In-Reply-To: References: <73566F3C-67B2-4947-98E6-61AC387A9532@gmail.com> Message-ID: The revival of Safe Erlang! /H?kan On Sat, Dec 24, 2011 at 11:40 AM, Kenneth Lundin wrote: > We have been discussing things like this for several years now. But like a > coincidence we have in our plans that something should happen in this area > during the year. > Cannot be more specific, yet. > > Kenneth Erlang/OTP Ericsson > > Den 23 dec 2011 22:14 skrev "Zabrane Mickael" : >> >> Fantastic Tony. >> >> Any chance to see these features officially integrated one day ... OTP >> folks? >> >> Regards, >> Zabrane >> >> On Dec 23, 2011, at 6:32 PM, Tony Rogvall wrote: >> >> Hi! >> >> If you are really, really interested in these kind of thing then maybe you >> could have a look in >> github.com/tonyrog/otp in the branch limits. >> >> It basically implements som new options to spawn_opt to set up resource >> limits like: >> >> max_memory >> max_time >> max_cpu >> max_reductions >> max_processes >> max_ports >> max_tables >> max_message_queue_len >> >> limits are inherited by spawned process and some of the resources are >> shared among the spawn processes to form a kind of resource group. >> >> The implementation is experimental and was made in order to demonstrate >> the >> features for the OTP group. Time for an EEP? >> >> Flavors of max_message_queue_len could be let sender crash, receiver >> crash, sender block >> (not so erlangish: drop head of message queue , drop tail of message queue >> ) >> >> >> /Tony >> >> >> On 23 dec 2011, at 18:04, Chandru wrote: >> >> Yes, I agree. I asked for "bounded message queues" a long time ago, but I >> got voted down :( >> >> http://erlang.org/pipermail/erlang-questions/2008-June/035517.html >> >> Chandru >> >> On 23 December 2011 14:44, Matthew Evans wrote: >>> >>> Email got sent too soon..... >>> >>> >>> The ability to handle this is a "feature" that I think is missing from >>> Erlang. The VM and the language is very stable, but the fact that a single, >>> poorly behaving, process can cause the VM to die is pretty undesirable. I >>> had a bug in a "logging" process where an ETS table wasn't getting purged >>> properly. It grew and grew eventually bringing down the entire VM due to an >>> OOM condition. This process wasn't significant to the operation of the >>> system, (and if I wanted it to be I would've written a supervisor to manage >>> it), yet it killed a critical service. >>> >>> >>> My personal wish would be the ability to optionally apply limits to a >>> process when it is spawned (memory, ets table sizes, message queue would be >>> a good start). When one or more of the limits are exceeded the process can >>> be killed (and then trapped/supervised if needed). It would make the VM more >>> stable, and would also assist in debugging (since it would be easy to see in >>> the sasl logs what happened without needing to look at a crash dump). One >>> other advantage of this is the ability to assist in testing, having the >>> limits set temporarily to find possible memory hogs and issues with head of >>> line blocking (message queues growing too much). Those limits would be >>> removed for production. >>> >>> >>> An option like that would, IMO, be a useful addition to the language. >>> >>> >>> Cheers >>> >>> >>> Matt >>> >>> >>> ________________________________ >>> From: chandrashekhar.mullaparthi@REDACTED >>> Date: Fri, 23 Dec 2011 07:44:49 +0000 >>> To: jwatte@REDACTED >>> CC: erlang-questions@REDACTED >>> Subject: Re: [erlang-questions] Fail fast >>> >>> No, if BEAM cannot allocate more memory, the node just dies. In case you >>> are interested, this handling of OOM condition has been discussed on the >>> mailing list in the past. Supervision hierarchies don't help in this case. >>> >>> cheers >>> Chandru >>> >>> On 23 December 2011 02:03, Jon Watte wrote: >>> >>> If there was a proper supervision hierarchy all the way up to the "root" >>> of the application, why would this happen? Wouldn't the supervisors just >>> kill off whatever process ends up not being able to allocate memory, and >>> thus clean up? (Perhaps kicking off users at the same time) If it fails far >>> enough up, wouldn't it basically reset the erl environment to "scratch" ? Or >>> would that be expecting too much ?from the supervision hierarchy? >>> >>> Sincerely, >>> >>> jw >>> >>> >>> -- >>> Americans might object: there is no way we would sacrifice our living >>> standards for the benefit of people in the rest of the world. Nevertheless, >>> whether we get there willingly or not, we shall soon have lower consumption >>> rates, because our present rates are unsustainable. >>> >>> >>> >>> On Tue, Dec 20, 2011 at 6:23 PM, Chandru >>> wrote: >>> >>> Hello everyone, >>> >>> I've just had a failure in one of my live services because an erlang node >>> ran out of memory (caused by a traffic spike). Restart mechanisms exist to >>> restart the node, but the node took a long time to die because it was >>> writing a large erl_crash.dump file, and then there was a 7GB core dump. >>> >>> Is there a quicker way to fail? I'm thinking of disabling core dumps >>> entirely on the box. What else can I do? A configuration option on the node >>> to only produce a summary erl_crash.dump would be nice. The most useful >>> things for me in a crash dump usually are the slogan at the top, and the >>> message queue lengths of each process. In this particular case, the slogan >>> would've told me all that I needed to know. >>> >>> Chandru >>> >>> >>> _______________________________________________ >>> 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 >> >> >> "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 >> >> >> >> >> _______________________________________________ >> 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 torben.lehoff@REDACTED Sun Dec 25 20:19:20 2011 From: torben.lehoff@REDACTED (Torben Hoffmann) Date: Sun, 25 Dec 2011 20:19:20 +0100 Subject: [erlang-questions] How to efficiently set the bit at position Index to 1 in a binary? In-Reply-To: <20111224191724.GA15597@circlewave.net> References: <20111224191724.GA15597@circlewave.net> Message-ID: <4EF77738.6050902@gmail.com> However you can write things like this: set(N, Bin) -> a(list_to_binary([<>, Bin])). a(<>) -> << L/bits, 1:1, R/bits >>. And this works like a charm. It is a very common pattern in tele-communication protocols to have a length for a part of the message inside the bigger message, so it is not surprising that the binary patterns can deal with it. In fact this "weirdness" is described in $4.6 of the bit_syntax documentation - http://www.erlang.org/doc/programming_examples/bit_syntax.html Following that you can write it like: set2(N, Bin) -> <> = Bin, <>. And this compiles on R14B3 without any warnings (I know, ought to update, but haven't had time yet...) Cheers, Torben On 24/12/11 20:17 , Jachym Holecek wrote: > # Zabrane Mickael 2011-12-24: >> Hi folks, >> >> Here's my code: >> >> %%-------------------------------------------------------------------- >> %% @doc Set the bit at position Index to 1 in the binary Bin. >> %% @end >> %%-------------------------------------------------------------------- >> -spec set(Bin :: binary(), Index :: non_neg_integer()) -> binary(). >> set(<<1:1, _/bits>> = Bin, 0) -> >> Bin; >> set(<<0:1, Rest/bits>>, 0) -> >> <<1:1, Rest/bits>>; >> set(Bin, Index) when Index> 0 -> >> Before = Index - 1, >> <> = Bin, >> <>. >> >> >> After compiling, I'm getting the following warnings: >> src/foo.erl:248: Warning: INFO: the '=' operator will prevent delayed sub binary optimization >> src/foo.erl:248: Warning: INFO: the '=' operator will prevent delayed sub binary optimization >> src/foo.erl:250: Warning: NOT OPTIMIZED: sub binary is used or returned >> src/foo.erl:254: Warning: NOT OPTIMIZED: sub binary is used or returned >> >> What's the best/optimized solution and how to get rid of these warnings? > Binary matching is *much* more powerful than what it looks like at first: > > -module(a). > -export([a/2]). > > a(N, B) -> > fun (<>) -> > <> > end(B). > > The compiler refuses the saner form (doing the binary match in a/1's head > directly) quoting the delusion that N isn't bound at that point... pity. > > Have fun, > -- Jachym > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions From zabrane3@REDACTED Sun Dec 25 21:15:19 2011 From: zabrane3@REDACTED (Zabrane Mickael) Date: Sun, 25 Dec 2011 21:15:19 +0100 Subject: [erlang-questions] is the compiler smart enough to ... In-Reply-To: <4EF6ADE0.8090402@gmail.com> References: <1A5C6F0F-1A85-4A56-BECD-49BB9FB6D6E9@gmail.com> <4EF6ADE0.8090402@gmail.com> Message-ID: Thanks Richard Regards, Zabrane On Dec 25, 2011, at 6:00 AM, Richard Carlsson wrote: > On 2011-12-25 17:03, Zabrane Mickael wrote: >> Hi guys, >> >> Suppose this function: >> foo(Bin) -> >> Bin. >> >> Is the compiler smart enough to inline it without telling him explicitly to do so (i.e -inline ...)? > > No, the beam compiler currently does no inlining at all by default. You have to specify +inline on the command line or -compile(inline) in the module. (Now that line number information is included in exceptions, inlining could perhaps be turned on by default. Previously, it could make error messages confusing by pointing to the function where the code was inlined rather than to the actual source code function.) > > /Richard > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions From mrtndimitrov@REDACTED Sun Dec 25 22:15:21 2011 From: mrtndimitrov@REDACTED (Martin Dimitrov) Date: Sun, 25 Dec 2011 23:15:21 +0200 Subject: [erlang-questions] is the compiler smart enough to ... In-Reply-To: <4EF6ADE0.8090402@gmail.com> References: <1A5C6F0F-1A85-4A56-BECD-49BB9FB6D6E9@gmail.com> <4EF6ADE0.8090402@gmail.com> Message-ID: <4EF79269.4000907@gmail.com> > ...Now that line number information is included in exceptions... > Sorry for being out of topic but is there another option for turning this feature on except compiling the modules with the smart exceptions package? Thanks, Martin From jesper.louis.andersen@REDACTED Sun Dec 25 22:57:54 2011 From: jesper.louis.andersen@REDACTED (Jesper Louis Andersen) Date: Sun, 25 Dec 2011 22:57:54 +0100 Subject: [erlang-questions] is the compiler smart enough to ... In-Reply-To: <4EF79269.4000907@gmail.com> References: <1A5C6F0F-1A85-4A56-BECD-49BB9FB6D6E9@gmail.com> <4EF6ADE0.8090402@gmail.com> <4EF79269.4000907@gmail.com> Message-ID: <4EF79C62.8090202@erlang-solutions.com> On 12/25/11 10:15 PM, Martin Dimitrov wrote: > Sorry for being out of topic but is there another option for turning > this feature on except compiling the modules with the smart exceptions > package? Yes! Use R15B - which among other nice things has line numbers in stack traces for exceptions and so on. -- Jesper Louis Andersen Erlang Solutions Ltd., Copenhagen, DK From zabrane3@REDACTED Sun Dec 25 23:47:05 2011 From: zabrane3@REDACTED (Zabrane Mickael) Date: Sun, 25 Dec 2011 23:47:05 +0100 Subject: [erlang-questions] How to efficiently set the bit at position Index to 1 in a binary? In-Reply-To: <4EF77738.6050902@gmail.com> References: <20111224191724.GA15597@circlewave.net> <4EF77738.6050902@gmail.com> Message-ID: <7F78CA94-583E-4E42-BC7A-7C2096CBC26D@gmail.com> On Dec 25, 2011, at 8:19 PM, Torben Hoffmann wrote: > Following that you can write it like: > set2(N, Bin) -> > <> = Bin, % LINE 271 > <>. on my machine (R15B, R14B04), the warning is still reported. src/foo.erl:271: Warning: NOT OPTIMIZED: sub binary is used or returned Regards, Zabrane -------------- next part -------------- An HTML attachment was scrubbed... URL: From magnus.klaar@REDACTED Mon Dec 26 01:57:45 2011 From: magnus.klaar@REDACTED (Magnus Klaar) Date: Mon, 26 Dec 2011 01:57:45 +0100 Subject: [erlang-questions] How to efficiently set the bit at position Index to 1 in a binary? In-Reply-To: <7F78CA94-583E-4E42-BC7A-7C2096CBC26D@gmail.com> References: <20111224191724.GA15597@circlewave.net> <4EF77738.6050902@gmail.com> <7F78CA94-583E-4E42-BC7A-7C2096CBC26D@gmail.com> Message-ID: Hi! Why are you obsessing about creating a sub-binary in this case? A sub-binary is _not_ a full copy of a binary, it's just a binary that's pointing into another binary. It's not very expensive. The only time you have any reason to go through great troubles to optimize this away is when the compiler cannot optimize a match operation that you perform on each iteration over a binary of unknown length. MVH Magnius On Sun, Dec 25, 2011 at 11:47 PM, Zabrane Mickael wrote: > > On Dec 25, 2011, at 8:19 PM, Torben Hoffmann wrote: > > Following that you can write it like: > set2(N, Bin) -> > <> = Bin, % LINE 271 > > <>. > > > on my machine (R15B, R14B04), the warning is still reported. > src/foo.erl:271: Warning: NOT OPTIMIZED: sub binary is used or returned > > Regards, > Zabrane > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From zabrane3@REDACTED Mon Dec 26 05:38:09 2011 From: zabrane3@REDACTED (Zabrane Mickael) Date: Mon, 26 Dec 2011 05:38:09 +0100 Subject: [erlang-questions] How to efficiently set the bit at position Index to 1 in a binary? In-Reply-To: References: <20111224191724.GA15597@circlewave.net> <4EF77738.6050902@gmail.com> <7F78CA94-583E-4E42-BC7A-7C2096CBC26D@gmail.com> Message-ID: <81E0ECBD-50AD-46DA-B36F-F1F4875AEE0A@gmail.com> Much clear to me now. There's no recursion in set/2, so I can live with that :-) On Dec 26, 2011, at 1:57 AM, Magnus Klaar wrote: > Hi! > > Why are you obsessing about creating a sub-binary in this case? A sub-binary is _not_ a full copy of a binary, it's just a binary that's pointing into another binary. It's not very expensive. The only time you have any reason to go through great troubles to optimize this away is when the compiler cannot optimize a match operation that you perform on each iteration over a binary of unknown length. > > MVH Magnius > > On Sun, Dec 25, 2011 at 11:47 PM, Zabrane Mickael wrote: > > On Dec 25, 2011, at 8:19 PM, Torben Hoffmann wrote: > >> Following that you can write it like: >> set2(N, Bin) -> >> <> = Bin, % LINE 271 >> >> <>. > > > on my machine (R15B, R14B04), the warning is still reported. > src/foo.erl:271: Warning: NOT OPTIMIZED: sub binary is used or returned > > Regards, > Zabrane > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions -------------- next part -------------- An HTML attachment was scrubbed... URL: From mrtndimitrov@REDACTED Mon Dec 26 14:54:20 2011 From: mrtndimitrov@REDACTED (Martin Dimitrov) Date: Mon, 26 Dec 2011 15:54:20 +0200 Subject: [erlang-questions] xmerl simple form Message-ID: <4EF87C8C.1050500@gmail.com> Hello, There is an example in the user's guide (http://www1.erlang.org/doc/apps/xmerl/xmerl_ug.html#id58936) of how to export to XML format a structure in the so called 'simple form'. Is there a method to parse XML document to this 'simple form'? Regards, Martin From robert.virding@REDACTED Mon Dec 26 15:14:16 2011 From: robert.virding@REDACTED (Robert Virding) Date: Mon, 26 Dec 2011 14:14:16 -0000 (GMT) Subject: [erlang-questions] The Core Erlang AST via cerl.erl and Sequence returns from functions In-Reply-To: <1324505341.17562.6.camel@localhost.localdomain> Message-ID: <71a9e94d-3d9c-4469-a3ab-acc366bce536@knuth> I do the same in LFE, compile LFE code down to Core as it is a much simpler language to work with than Erlang. However, I do not use the cerl module but instead use the Core record definitions in core_parse.hrl directly. The code becomes more compact and easier to read. I think. I only have some wrapper functions for very common cases. Your example does not work because you have a list of variables in the let which requires that you have a corresponding #c_values{} record as a "value". Robert ----- Original Message ----- > Richard, > > Thanks, Its good to know that its not me misunderstanding things. I > will see if I can dig into the compiler here in the next couple of > days > and submit a patch to the patches list. > > Eric > > On Wed, 2011-12-21 at 21:45 +0100, Richard Carlsson wrote: > > On 2011-12-21 17:36, Eric Merritt wrote: > > > Guys, > > > > > > I am currently targeting the Erlang VM for a custom language via > > > core > > > erlang as defined in cerl.erl on R15B. I have run into an > > > interesting > > > issue. In a Let form (cerl:c_let) if I have a sequence of c_vars > > > on > > > the Variable arguement and c_apply (on a function that returns a > > > c_values) in the Argument argument then the erlang compiler exits > > > with > > > an 'error'. However, if I have a c_values directly as the > > > Argument > > > argument the compiler will compile the form. Either I am > > > understanding > > > something incorrectly or this is a bug in the cerl compiler. I am > > > hoping one of the folks that is knowledgeable on the subject can > > > help > > > out. In short the following works: > > > > > > cerl:c_let([cerl:c_var(x0), cerl:c_var(x1)], > > > cerl:c_values([cerl:c_int(0), cerl:c_int(1)]), cerl:c_atom(foo)) > > > > > > while this does not: > > > > > > > > cerl:c_values([cerl:c_int(0), > > > cerl:c_int(1)])> > > > > > > cerl:c_let([cerl:c_var(x0), cerl:c_var(x1)], > > > cerl:c_apply(cerl:c_fname(my_fun, 0), []), cerl:c_atom(foo)). > > > > Intuitively (and without consulting the source code or my old > > papers on > > Core Erlang), I'd say that the latter should work. However, the OTP > > compiler doesn't try to be complete with respect to all possible > > Core > > Erlang programs - it only bothers to implement what's needed to > > handle > > code that's first been translated from (full) Erlang. So if you > > start > > generating arbitrary but legal Core Erlang, you may run into corner > > cases (in this case, it seems that multiple return values aren't > > handled > > as they ought to be). See if you can find the problem in the > > compiler - > > as Calvin's dad used to say, "it builds character". :-) > > > > /Richard > > _______________________________________________ > > 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 ericbmerritt@REDACTED Mon Dec 26 15:33:53 2011 From: ericbmerritt@REDACTED (Eric B Merritt) Date: Mon, 26 Dec 2011 09:33:53 -0500 Subject: [erlang-questions] The Core Erlang AST via cerl.erl and Sequence returns from functions In-Reply-To: <71a9e94d-3d9c-4469-a3ab-acc366bce536@knuth> References: <71a9e94d-3d9c-4469-a3ab-acc366bce536@knuth> Message-ID: <1324910033.19384.37.camel@localhost.localdomain> Robert, Thats the same conclusion I came to. I assumed though that an expression that returned a #c_values would work as well as a direct #c_values. I actually don't see much use in only supporting only a direct mapping unless the purpose is solely to allow binding multiple variables in a single expression. Actually, that may be exactly it. Eric On Mon, 2011-12-26 at 14:14 +0000, Robert Virding wrote: > I do the same in LFE, compile LFE code down to Core as it is a much simpler language to work with than Erlang. However, I do not use the cerl module but instead use the Core record definitions in core_parse.hrl directly. The code becomes more compact and easier to read. I think. I only have some wrapper functions for very common cases. > > Your example does not work because you have a list of variables in the let which requires that you have a corresponding #c_values{} record as a "value". > > Robert > > ----- Original Message ----- > > Richard, > > > > Thanks, Its good to know that its not me misunderstanding things. I > > will see if I can dig into the compiler here in the next couple of > > days > > and submit a patch to the patches list. > > > > Eric > > > > On Wed, 2011-12-21 at 21:45 +0100, Richard Carlsson wrote: > > > On 2011-12-21 17:36, Eric Merritt wrote: > > > > Guys, > > > > > > > > I am currently targeting the Erlang VM for a custom language via > > > > core > > > > erlang as defined in cerl.erl on R15B. I have run into an > > > > interesting > > > > issue. In a Let form (cerl:c_let) if I have a sequence of c_vars > > > > on > > > > the Variable arguement and c_apply (on a function that returns a > > > > c_values) in the Argument argument then the erlang compiler exits > > > > with > > > > an 'error'. However, if I have a c_values directly as the > > > > Argument > > > > argument the compiler will compile the form. Either I am > > > > understanding > > > > something incorrectly or this is a bug in the cerl compiler. I am > > > > hoping one of the folks that is knowledgeable on the subject can > > > > help > > > > out. In short the following works: > > > > > > > > cerl:c_let([cerl:c_var(x0), cerl:c_var(x1)], > > > > cerl:c_values([cerl:c_int(0), cerl:c_int(1)]), cerl:c_atom(foo)) > > > > > > > > while this does not: > > > > > > > > > > > cerl:c_values([cerl:c_int(0), > > > > cerl:c_int(1)])> > > > > > > > > cerl:c_let([cerl:c_var(x0), cerl:c_var(x1)], > > > > cerl:c_apply(cerl:c_fname(my_fun, 0), []), cerl:c_atom(foo)). > > > > > > Intuitively (and without consulting the source code or my old > > > papers on > > > Core Erlang), I'd say that the latter should work. However, the OTP > > > compiler doesn't try to be complete with respect to all possible > > > Core > > > Erlang programs - it only bothers to implement what's needed to > > > handle > > > code that's first been translated from (full) Erlang. So if you > > > start > > > generating arbitrary but legal Core Erlang, you may run into corner > > > cases (in this case, it seems that multiple return values aren't > > > handled > > > as they ought to be). See if you can find the problem in the > > > compiler - > > > as Calvin's dad used to say, "it builds character". :-) > > > > > > /Richard > > > _______________________________________________ > > > 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 rapsey@REDACTED Mon Dec 26 16:20:06 2011 From: rapsey@REDACTED (Rapsey) Date: Mon, 26 Dec 2011 16:20:06 +0100 Subject: [erlang-questions] xmerl simple form In-Reply-To: <4EF87C8C.1050500@gmail.com> References: <4EF87C8C.1050500@gmail.com> Message-ID: I use this: parsexml(I,O) when is_binary(I) -> parsexml(tolist(I),O); parsexml(InputXml,Opt) -> try {Xml,_} = xmerl_scan:string(InputXml, [{space,normalize},{encoding,"utf-8"},{validation,off}|Opt]), strip_whitespace(xmerl_lib:simplify_element(Xml)) of Res -> Res catch error:_X -> io:format("~p", [_X]), false end. strip_whitespace({El,Attr,Children}) -> NChild = lists:filter(fun(X) -> case X of " " -> false; _ -> true end end,Children), Ch = lists:map(fun(X) -> strip_whitespace(X) end,NChild), {El,Attr,Ch}; strip_whitespace(String) -> String. Sergej On Mon, Dec 26, 2011 at 2:54 PM, Martin Dimitrov wrote: > Hello, > > There is an example in the user's guide > (http://www1.erlang.org/doc/apps/xmerl/xmerl_ug.html#id58936) of how to > export to XML format a structure in the so called 'simple form'. > Is there a method to parse XML document to this 'simple form'? > > Regards, > > Martin > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From mrtndimitrov@REDACTED Mon Dec 26 17:12:39 2011 From: mrtndimitrov@REDACTED (Martin Dimitrov) Date: Mon, 26 Dec 2011 18:12:39 +0200 Subject: [erlang-questions] xmerl simple form In-Reply-To: References: <4EF87C8C.1050500@gmail.com> Message-ID: <4EF89CF7.4020303@gmail.com> Hello Sergej, Thanks for sharing this code. I cannot find documentation for the xmerl_lib module? What does simplify_element/1 do? Regards, Martin On 12/26/2011 5:20 PM, Rapsey wrote: > I use this: > > parsexml(I,O) when is_binary(I) -> > parsexml(tolist(I),O); > parsexml(InputXml,Opt) -> > try {Xml,_} = xmerl_scan:string(InputXml, > [{space,normalize},{encoding,"utf-8"},{validation,off}|Opt]), > strip_whitespace(xmerl_lib:simplify_element(Xml)) of > Res -> > Res > catch > error:_X -> > io:format("~p", [_X]), > false > end. > > strip_whitespace({El,Attr,Children}) -> > NChild = lists:filter(fun(X) -> > case X of > " " -> false; > _ -> true > end > end,Children), > Ch = lists:map(fun(X) -> strip_whitespace(X) end,NChild), > {El,Attr,Ch}; > strip_whitespace(String) -> > String. > > > > Sergej > > On Mon, Dec 26, 2011 at 2:54 PM, Martin Dimitrov wrote: > >> Hello, >> >> There is an example in the user's guide >> (http://www1.erlang.org/doc/apps/xmerl/xmerl_ug.html#id58936) of how to >> export to XML format a structure in the so called 'simple form'. >> Is there a method to parse XML document to this 'simple form'? >> >> Regards, >> >> Martin >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://erlang.org/mailman/listinfo/erlang-questions >> From roberto@REDACTED Tue Dec 27 02:10:21 2011 From: roberto@REDACTED (Roberto Ostinelli) Date: Mon, 26 Dec 2011 17:10:21 -0800 Subject: [erlang-questions] gen_tcp:recv/3 timeout Message-ID: dear list, when calling gen_tcp:recv/3 by specifying a length and a timeout, when will {error, timeout} be a response? Is it: 1. when no bytes are received for a period longer than the specified Timeout 2. when the number of bytes specified in Length is not received within Timeout if 2, what is the best solution to actually *not* have a recv/3 timeout while receiving bytes at a very low pace (for instance on very slow connections)? thank you, r. -------------- next part -------------- An HTML attachment was scrubbed... URL: From meetprashant007@REDACTED Tue Dec 27 05:47:25 2011 From: meetprashant007@REDACTED (Prashant Sharma) Date: Tue, 27 Dec 2011 10:17:25 +0530 Subject: [erlang-questions] Http Load balancer in erlang. In-Reply-To: References: Message-ID: Thanks chan, I had no idea about its existence until now, was wondering it has not been touched for last 11 years though. -P On Mon, Dec 26, 2011 at 8:57 PM, chan sisowath wrote: > hi, > you should check?http://eddie.sourceforge.net/what.html > > > 2011/12/24 Prashant Sharma >> >> Hi all, >> >> Christmas greetings. >> >> I was wondering, if there is a http load balancer writtern which >> support dynamic configuration (that is configuring with-out >> restarting.) >> >> -- >> Prashant Sharma >> Development Engineer >> Pramati Technologies >> Begumpet >> >> "Hare Krishna" >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://erlang.org/mailman/listinfo/erlang-questions > > -- Prashant Sharma Development Engineer Pramati Technologies Begumpet "Hare Krishna" From rapsey@REDACTED Tue Dec 27 08:44:16 2011 From: rapsey@REDACTED (Rapsey) Date: Tue, 27 Dec 2011 08:44:16 +0100 Subject: [erlang-questions] xmerl simple form In-Reply-To: <4EF89CF7.4020303@gmail.com> References: <4EF87C8C.1050500@gmail.com> <4EF89CF7.4020303@gmail.com> Message-ID: Turn xml structure into that simple form. Lists of tuples. Sergej On Mon, Dec 26, 2011 at 5:12 PM, Martin Dimitrov wrote: > Hello Sergej, > > Thanks for sharing this code. I cannot find documentation for the > xmerl_lib module? What does simplify_element/1 do? > > Regards, > > Martin > > On 12/26/2011 5:20 PM, Rapsey wrote: > > I use this: > > > > parsexml(I,O) when is_binary(I) -> > > parsexml(tolist(I),O); > > parsexml(InputXml,Opt) -> > > try {Xml,_} = xmerl_scan:string(InputXml, > > [{space,normalize},{encoding,"utf-8"},{validation,off}|Opt]), > > strip_whitespace(xmerl_lib:simplify_element(Xml)) of > > Res -> > > Res > > catch > > error:_X -> > > io:format("~p", [_X]), > > false > > end. > > > > strip_whitespace({El,Attr,Children}) -> > > NChild = lists:filter(fun(X) -> > > case X of > > " " -> false; > > _ -> true > > end > > end,Children), > > Ch = lists:map(fun(X) -> strip_whitespace(X) end,NChild), > > {El,Attr,Ch}; > > strip_whitespace(String) -> > > String. > > > > > > > > Sergej > > > > On Mon, Dec 26, 2011 at 2:54 PM, Martin Dimitrov >wrote: > > > >> Hello, > >> > >> There is an example in the user's guide > >> (http://www1.erlang.org/doc/apps/xmerl/xmerl_ug.html#id58936) of how to > >> export to XML format a structure in the so called 'simple form'. > >> Is there a method to parse XML document to this 'simple form'? > >> > >> Regards, > >> > >> Martin > >> _______________________________________________ > >> erlang-questions mailing list > >> erlang-questions@REDACTED > >> http://erlang.org/mailman/listinfo/erlang-questions > >> > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From zabrane3@REDACTED Tue Dec 27 09:10:02 2011 From: zabrane3@REDACTED (Zabrane Mickael) Date: Tue, 27 Dec 2011 09:10:02 +0100 Subject: [erlang-questions] Http Load balancer in erlang. In-Reply-To: References: Message-ID: <92CF9042-7170-43B2-AA05-8AEEDFA2BB7D@gmail.com> + the technical documentation is missing from: http://eddie.sourceforge.net/techrep.html is it available elsewhere? Regards, Zabrane On Dec 27, 2011, at 5:47 AM, Prashant Sharma wrote: > Thanks chan, I had no idea about its existence until now, was > wondering it has not been touched for last 11 years though. > > -P > > On Mon, Dec 26, 2011 at 8:57 PM, chan sisowath wrote: >> hi, >> you should check http://eddie.sourceforge.net/what.html >> >> >> 2011/12/24 Prashant Sharma >>> >>> Hi all, >>> >>> Christmas greetings. >>> >>> I was wondering, if there is a http load balancer writtern which >>> support dynamic configuration (that is configuring with-out >>> restarting.) >>> >>> -- >>> Prashant Sharma >>> Development Engineer >>> Pramati Technologies >>> Begumpet >>> >>> "Hare Krishna" >>> _______________________________________________ >>> erlang-questions mailing list >>> erlang-questions@REDACTED >>> http://erlang.org/mailman/listinfo/erlang-questions >> >> > > > > -- > Prashant Sharma > Development Engineer > Pramati Technologies > Begumpet > > "Hare Krishna" > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions -------------- next part -------------- An HTML attachment was scrubbed... URL: From alessandro.sivieri@REDACTED Tue Dec 27 12:53:55 2011 From: alessandro.sivieri@REDACTED (Alessandro Sivieri) Date: Tue, 27 Dec 2011 12:53:55 +0100 Subject: [erlang-questions] R15B on Ubuntu 11.10 Message-ID: Hi all, as usual, I have ported the Erlang packages from Debian Experimental to Ubuntu 11.10, and published them on my PPA [1]; IWFM, but I cannot assure that it will work for you too :) [1] http://sivieri.wordpress.com/2011/12/27/erlang-r15b-for-ubuntu-11-10/ -- Sivieri Alessandro alessandro.sivieri@REDACTED http://sivieri.wordpress.com/ -------------- next part -------------- An HTML attachment was scrubbed... URL: From spawn.think@REDACTED Tue Dec 27 14:21:58 2011 From: spawn.think@REDACTED (Ahmed Omar) Date: Tue, 27 Dec 2011 14:21:58 +0100 Subject: [erlang-questions] gen_tcp:recv/3 timeout In-Reply-To: References: Message-ID: It's number On Tue, Dec 27, 2011 at 2:10 AM, Roberto Ostinelli wrote: > dear list, > > when calling gen_tcp:recv/3 by specifying a length and a timeout, when > will {error, timeout} be a response? Is it: > > 1. when no bytes are received for a period longer than the specified > Timeout > 2. when the number of bytes specified in Length is not received within > Timeout > > if 2, what is the best solution to actually *not* have a recv/3 timeout > while receiving bytes at a very low pace (for instance on very slow > connections)? > > thank you, > > r. > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > > -- Best Regards, - Ahmed Omar http://nl.linkedin.com/in/adiaa Follow me on twitter @spawn_think -------------- next part -------------- An HTML attachment was scrubbed... URL: From spawn.think@REDACTED Tue Dec 27 14:27:58 2011 From: spawn.think@REDACTED (Ahmed Omar) Date: Tue, 27 Dec 2011 14:27:58 +0100 Subject: [erlang-questions] gen_tcp:recv/3 timeout In-Reply-To: References: Message-ID: Sorry hit the send button too early! It's number 2 I think some solutions would be : 1) receive smaller N of bytes with a smaller timeout, and loop (accumulate your timeout) or 2) use {active, once} and receive messages on your own pace. (control when to timeout) On Tue, Dec 27, 2011 at 2:21 PM, Ahmed Omar wrote: > It's number > > On Tue, Dec 27, 2011 at 2:10 AM, Roberto Ostinelli wrote: > >> dear list, >> >> when calling gen_tcp:recv/3 by specifying a length and a timeout, when >> will {error, timeout} be a response? Is it: >> >> 1. when no bytes are received for a period longer than the specified >> Timeout >> 2. when the number of bytes specified in Length is not received within >> Timeout >> >> if 2, what is the best solution to actually *not* have a recv/3 timeout >> while receiving bytes at a very low pace (for instance on very slow >> connections)? >> >> thank you, >> >> r. >> >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://erlang.org/mailman/listinfo/erlang-questions >> >> > > > -- > Best Regards, > - Ahmed Omar > http://nl.linkedin.com/in/adiaa > Follow me on twitter > @spawn_think > > -- Best Regards, - Ahmed Omar http://nl.linkedin.com/in/adiaa Follow me on twitter @spawn_think -------------- next part -------------- An HTML attachment was scrubbed... URL: From magnus.klaar@REDACTED Tue Dec 27 16:52:45 2011 From: magnus.klaar@REDACTED (Magnus Klaar) Date: Tue, 27 Dec 2011 16:52:45 +0100 Subject: [erlang-questions] gen_tcp:recv/3 timeout In-Reply-To: References: Message-ID: Hi! gen_tcp:recv(..., N, M) returns {error, timeout} if N bytes has not been received after M milliseconds. If less bytes are available the call will _not_ succeed. If you are receiving data at a slow rate specifying 0 as the length is preferrable because the call will return whatever data is available at the time. If there is no data available it will wait and timeout if no data has been received after M milliseconds. If you don't want to timeout at all when doing this, specify infinity as the timout value. MVH Magnus On Tue, Dec 27, 2011 at 2:10 AM, Roberto Ostinelli wrote: > dear list, > > when calling gen_tcp:recv/3 by specifying a length and a timeout, when > will {error, timeout} be a response? Is it: > > 1. when no bytes are received for a period longer than the specified > Timeout > 2. when the number of bytes specified in Length is not received within > Timeout > > if 2, what is the best solution to actually *not* have a recv/3 timeout > while receiving bytes at a very low pace (for instance on very slow > connections)? > > thank you, > > r. > -------------- next part -------------- An HTML attachment was scrubbed... URL: From roberto@REDACTED Tue Dec 27 17:39:25 2011 From: roberto@REDACTED (Roberto Ostinelli) Date: Tue, 27 Dec 2011 08:39:25 -0800 Subject: [erlang-questions] gen_tcp:recv/3 timeout In-Reply-To: References: Message-ID: thank you very much klaar, and everyone for this clarification. r. On Tue, Dec 27, 2011 at 7:52 AM, Magnus Klaar wrote: > Hi! > > gen_tcp:recv(..., N, M) returns {error, timeout} if N bytes has not been > received after M milliseconds. If less bytes are available the call will > _not_ succeed. If you are receiving data at a slow rate specifying 0 as the > length is preferrable because the call will return whatever data is > available at the time. If there is no data available it will wait and > timeout if no data has been received after M milliseconds. If you don't > want to timeout at all when doing this, specify infinity as the timout > value. > > MVH Magnus > -------------- next part -------------- An HTML attachment was scrubbed... URL: From tome.wave@REDACTED Tue Dec 27 19:21:14 2011 From: tome.wave@REDACTED (ricardo_bcl) Date: Tue, 27 Dec 2011 10:21:14 -0800 (PST) Subject: [erlang-questions] high performance cache In-Reply-To: References: Message-ID: <1325010074498-4237845.post@n4.nabble.com> After searching for this, I decided to implement a very simple cache mechanism using ETS: https://github.com/ricardobcl/ETScache For now, it only controls the number of elements in cache, because it's faster and it did what I wanted, but can be easily modified to prune it terms of bytes. Senthilkumar Peelikkampatti wrote > > Hi, > > I am looking for LRU caching framework in Erlang with thresholds to > control > the amount of data written to it. I explored memcached Erlang derivatives > and ETS based solutions but not sure about which way to go. Please share > your experience using caching framework. I am not looking for distributed > cache. > > -- > Regards, > Senthilkumar Peelikkampatti, > -- View this message in context: http://erlang.2086793.n4.nabble.com/high-performance-cache-tp2526348p4237845.html Sent from the Erlang Questions mailing list archive at Nabble.com. From tome.wave@REDACTED Tue Dec 27 19:22:56 2011 From: tome.wave@REDACTED (ricardo_bcl) Date: Tue, 27 Dec 2011 10:22:56 -0800 (PST) Subject: [erlang-questions] Best way to implement a simple cache In-Reply-To: <3F36CDB2-757D-4204-920C-4B1307AC1DFB@gmail.com> References: <3F36CDB2-757D-4204-920C-4B1307AC1DFB@gmail.com> Message-ID: <1325010176642-4237850.post@n4.nabble.com> I decided to implement a very simple cache mechanism using ETS: https://github.com/ricardobcl/ETScache For now, it only controls the number of elements in cache, because it's faster and it did what I wanted, but can be easily modified to prune it terms of bytes. Jan Vincent Liwanag wrote > > Hi guys, > > I wanted your take on how to implement a simple small key-value cache, > maybe holding around a few hundred tuples. The thing is, I don't want > the cache to be consuming all my memory so that entries in the cache > expires if it isn't read for some time or some maximum size is met. > > Jan Vincent Liwanag > jvliwanag@ > > > > > > ________________________________________________________________ > erlang-questions mailing list. See http://www.erlang.org/faq.html > erlang-questions (at) erlang.org > -- View this message in context: http://erlang.2086793.n4.nabble.com/Best-way-to-implement-a-simple-cache-tp2118502p4237850.html Sent from the Erlang Questions mailing list archive at Nabble.com. From zabrane3@REDACTED Tue Dec 27 19:48:43 2011 From: zabrane3@REDACTED (Zabrane Mickael) Date: Tue, 27 Dec 2011 19:48:43 +0100 Subject: [erlang-questions] Best way to implement a simple cache In-Reply-To: <1325010176642-4237850.post@n4.nabble.com> References: <3F36CDB2-757D-4204-920C-4B1307AC1DFB@gmail.com> <1325010176642-4237850.post@n4.nabble.com> Message-ID: <40DA78DD-7232-48DF-8916-FFB168D08727@gmail.com> save your time: https://github.com/cliffmoon/cherly Regards, Zabrane On Dec 27, 2011, at 7:22 PM, ricardo_bcl wrote: > I decided to implement a very simple cache mechanism using ETS: > > https://github.com/ricardobcl/ETScache > > For now, it only controls the number of elements in cache, because it's > faster and it did what I wanted, but can be easily modified to prune it > terms of bytes. > > > Jan Vincent Liwanag wrote >> >> Hi guys, >> >> I wanted your take on how to implement a simple small key-value cache, >> maybe holding around a few hundred tuples. The thing is, I don't want >> the cache to be consuming all my memory so that entries in the cache >> expires if it isn't read for some time or some maximum size is met. >> >> Jan Vincent Liwanag >> jvliwanag@ >> >> >> >> >> >> ________________________________________________________________ >> erlang-questions mailing list. See http://www.erlang.org/faq.html >> erlang-questions (at) erlang.org >> > > -- > View this message in context: http://erlang.2086793.n4.nabble.com/Best-way-to-implement-a-simple-cache-tp2118502p4237850.html > Sent from the Erlang Questions mailing list archive at Nabble.com. > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions -------------- next part -------------- An HTML attachment was scrubbed... URL: From baryluk@REDACTED Tue Dec 27 23:30:48 2011 From: baryluk@REDACTED (Witold Baryluk) Date: Tue, 27 Dec 2011 23:30:48 +0100 Subject: [erlang-questions] IEEE-754 subnormals parsing and handling problems and bugs Message-ID: <20111227223048.GE11045@smp.if.uj.edu.pl> Hello, I found problem when parsing small numbers 1> list_to_float("0."++lists:duplicate(322, $0)++"1"). 1.0e-323 2> list_to_float("0."++lists:duplicate(323, $0)++"1"). 0.0 This is contrasting difference to the handling of big numbers 3> list_to_float("1"++lists:duplicate(308, $0)++".0"). 1.0e308 4> list_to_float("1"++lists:duplicate(309, $0)++".0"). ** exception error: bad argument in function list_to_float/1 called as list_to_float("1000000...[lots of zeros removed]......000000000.0") Example 2, shourly should throw error. But actually example 1 also, becaus it create so called subnormal numbers (aka denormal numbers, underflow value). Take look at this two examples: 5> list_to_float("0."++lists:duplicate(322, $0)++"123456789"). 1.0e-323 6> list_to_float("0."++lists:duplicate(300, $0)++"123456789"). 1.23456789e-301 One can check how arithmetic exception handling is working here: 7> 1.0e200 * 1.0e200. ** exception error: bad argument in an arithmetic expression in operator */2 called as 1.0e200 * 1.0e200 but this doesn't happen for small numbers 8> 0.123456789e-300. 1.23456789e-301 9> 0.123456789e-400. 0.0 10> 0.123456789e-320. 1.235e-321 11> 0.123456789e-100 * 0.123456789e-100. 1.524157875019052e-202 12> 0.123456789e-200 * 0.123456789e-200. 0.0 Why infinities are trapped, but subnormals not? Because there is no good syntax for NaNs and Infinites, but there is for subnormals and zero? As of speed in fact subnormal processing is much more slower, than infinities. This means, that for example adding lots of numbers near 1.0e-320 can be few times slower, than normal numbers. Other oprations, like square root, trigonometry or multiplications can have even bigger performance impact. 13> timer:tc(lists, sum, [lists:duplicate(1000000, 0.1e-200)]). {164756,1.0000000000056682e-195} 14> timer:tc(lists, sum, [lists:duplicate(1000000, 0.1e-300)]). {163616,9.99999999972789e-296} 15> timer:tc(lists, sum, [lists:duplicate(1000000, 0.1e-310)]). {238753,1.0000000000158536e-305} 16> timer:tc(lists, sum, [lists:duplicate(1000000, 0.1e-320)]). {471354,9.98012605e-316} 17> timer:tc(lists, sum, [lists:duplicate(1000000, 0.1e-321)]). {471283,9.881313e-317} 18> timer:tc(lists, sum, [lists:duplicate(1000000, 0.1e-322)]). {471398,9.881313e-318} 19> timer:tc(lists, sum, [lists:duplicate(1000000, 0.1e-323)]). {164053,0.0} % on my machine (Athlon_. I tested on Intel Core2 in 32-bits, and % differences are much bigger, up to 20 times slower! Similar behaviour I found in erl_scan:string/1. This is also very different behaviour than erl_scan:string/1, used by compiler to parse shell input and source files. 20> erl_scan:string("1"++lists:duplicate(309, $0)++".0"). {error,{1,erl_scan,{illegal,float}},1} 21> erl_scan:string("1"++lists:duplicate(308, $0)++".0"). {ok,[{float,1,1.0e308}],1} Everything fine, infinities are trapped. Unfortunetly, for underflows compiler similary behaves wrong 22> erl_scan:string("0."++lists:duplicate(322, $0)++"1"). {ok,[{float,1,1.0e-323}],1} % should return error 23> erl_scan:string("0."++lists:duplicate(323, $0)++"1"). {ok,[{float,1,0.0}],1} % should return error Also string:to_float behaves in same way: 24> string:to_float("0."++lists:duplicate(322, $0)++"1"). {1.0e-323,[]} % should return error 25> string:to_float("0."++lists:duplicate(323, $0)++"1"). {0.0,[]} % should return error 26> string:to_float("1"++lists:duplicate(308, $0)++".0"). {1.0e308,[]} 27> string:to_float("1"++lists:duplicate(309, $0)++".0"). {error,no_float} I think it should be fixed, so more reliable software can be written, like statistics software (subnormals can for example easilly appear when summing and multipling small numbers, however it is normally rear, and should throw error, to not produce bad results, because even using smart summation algorithms, like Kahan scheme, will not fix this problem). For sure such floats should not be allowed in source code, or when parsing from string. And probably also not be allowed to appear using any builting arithmetic functions. Another example: 30> math:exp(100). 2.6881171418161356e43 31> math:exp(1000). ** exception error: bad argument in an arithmetic expression in function math:exp/1 called as math:exp(1000) infinity trapped, but subnormal not: 32> math:exp(-100). 3.720075976020836e-44 33> math:exp(-1000). 0.0 I also found that scientific notation behaves in same way: 34> list_to_float("1.123456789e-320"). 1.1235e-320 35> list_to_float("1.123456789e-330"). 0.0 My last argument will be about hardware support. For example many new ARM processors, supports hardware floating point computations, but often without support for subnormals! This makes them not fully IEEE-754 compilant, unless running in software floating point mode, which is slower, especially if it also need to handle subnormals! I'm using 32-bit cpu: model name : AMD Athlon(tm) stepping : 2 cpu MHz : 1154.450 cache size : 256 KB fdiv_bug : no hlt_bug : no f00f_bug : no coma_bug : no fpu : yes fpu_exception : yes cpuid level : 1 wp : yes flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 mmx fxsr sse syscall mp mmxext 3dnowext 3dnow up Erlang version 1:14.b.4-dfsg-1 installed from Debian/GNU Linux testing. Do not know exact complation flags, but here is small info 1> erlang:system_info(system_version). "Erlang R14B04 (erts-5.8.5) [source] [rq:1] [async-threads:0] [hipe] [kernel-poll:false]\n" 2> erlang:system_info(system_architecture). "i486-pc-linux-gnu" 3> erlang:system_info(build_type). opt 4> erlang:system_info(c_compiler_used). {gnuc,{4,6,1}} 5> erlang:system_info(debug_compiled). false 6> erlang:system_info(smp_support). false 7> erlang:system_info(threads). true speed differences of subnormals on Intel Core2 (32-bit mode), same compiler, same options. 1> timer:tc(lists, sum, [lists:duplicate(10000000, 0.1e-300)]). {278703,9.999999998591641e-295} 3> timer:tc(lists, sum, [lists:duplicate(10000000, 0.1e-310)]). {1049095,9.999999997470606e-305} 5> timer:tc(lists, sum, [lists:duplicate(10000000, 0.1e-320)]). {3501330,9.980126046e-315} % about 12 times slower, and obviously loss of precission. Beyond infinities, nan, and denormalized numbers, there also signed zero, but this is handled without problem: 10> list_to_float("0.0") =:= list_to_float("-0.0"). true 11> math:sqrt(list_to_float("-0.0")). 0.0 This is acceptable, because signed zero is mostly usefull with NaN and infinites support, and because we do not have them, it is good solution to ignore signed zero problem. I found no discussion on erlang-questions list in the past, so hope it is worth discussing. Also Erlang Reference Manual User's Guide, doesn't mention anything on the matter. Regards, Witek -- Witold Baryluk From lukas@REDACTED Tue Dec 27 23:48:25 2011 From: lukas@REDACTED (Lukas Larsson) Date: Tue, 27 Dec 2011 23:48:25 +0100 Subject: [erlang-questions] IEEE-754 subnormals parsing and handling problems and bugs In-Reply-To: <20111227223048.GE11045@smp.if.uj.edu.pl> References: <20111227223048.GE11045@smp.if.uj.edu.pl> Message-ID: Hello! Interesting stuff! Do you have any information about how other high level languages handle this? Maybe looking at how Ruby and Python behaves in these edge cases will help to create a good solution. Too bad that a change which would create exceptions when working with small floats breaks backwards computability quite severely. Any ideas on how to do this without breaking backwards compatibility? for list_to_float it would be easy, but float division and multiplication is harder. Lukas On Tue, Dec 27, 2011 at 11:30 PM, Witold Baryluk wrote: > Hello, > > I found problem when parsing small numbers > > 1> list_to_float("0."++lists:duplicate(322, $0)++"1"). > 1.0e-323 > 2> list_to_float("0."++lists:duplicate(323, $0)++"1"). > 0.0 > > This is contrasting difference to the handling of big numbers > > 3> list_to_float("1"++lists:duplicate(308, $0)++".0"). > 1.0e308 > 4> list_to_float("1"++lists:duplicate(309, $0)++".0"). > ** exception error: bad argument > ? ? in function ?list_to_float/1 > ? ? ? ?called as list_to_float("1000000...[lots of zeros removed]......000000000.0") > > Example 2, shourly should throw error. But actually example 1 also, > becaus it create so called subnormal numbers (aka denormal numbers, > underflow value). Take look at this two examples: > > 5> list_to_float("0."++lists:duplicate(322, $0)++"123456789"). > 1.0e-323 > 6> list_to_float("0."++lists:duplicate(300, $0)++"123456789"). > 1.23456789e-301 > > > One can check how arithmetic exception handling is working here: > > 7> 1.0e200 * 1.0e200. > ** exception error: bad argument in an arithmetic expression > ? ? in operator ?*/2 > ? ? ? ?called as 1.0e200 * 1.0e200 > > but this doesn't happen for small numbers > > 8> 0.123456789e-300. > 1.23456789e-301 > 9> 0.123456789e-400. > 0.0 > 10> 0.123456789e-320. > 1.235e-321 > > 11> 0.123456789e-100 * 0.123456789e-100. > 1.524157875019052e-202 > 12> 0.123456789e-200 * 0.123456789e-200. > 0.0 > > Why infinities are trapped, but subnormals not? Because there is no good > syntax for NaNs and Infinites, but there is for subnormals and zero? > As of speed in fact subnormal processing is much more slower, than infinities. > This means, that for example adding lots of numbers near 1.0e-320 > can be few times slower, than normal numbers. Other oprations, like > square root, trigonometry or multiplications can have even bigger > performance impact. > > 13> timer:tc(lists, sum, [lists:duplicate(1000000, 0.1e-200)]). > {164756,1.0000000000056682e-195} > 14> timer:tc(lists, sum, [lists:duplicate(1000000, 0.1e-300)]). > {163616,9.99999999972789e-296} > 15> timer:tc(lists, sum, [lists:duplicate(1000000, 0.1e-310)]). > {238753,1.0000000000158536e-305} > 16> timer:tc(lists, sum, [lists:duplicate(1000000, 0.1e-320)]). > {471354,9.98012605e-316} > 17> timer:tc(lists, sum, [lists:duplicate(1000000, 0.1e-321)]). > {471283,9.881313e-317} > 18> timer:tc(lists, sum, [lists:duplicate(1000000, 0.1e-322)]). > {471398,9.881313e-318} > 19> timer:tc(lists, sum, [lists:duplicate(1000000, 0.1e-323)]). > {164053,0.0} > > % on my machine (Athlon_. I tested on Intel Core2 in 32-bits, and > % differences are much bigger, up to 20 times slower! > > > Similar behaviour I found in erl_scan:string/1. > > This is also very different behaviour than erl_scan:string/1, used by compiler > to parse shell input and source files. > > 20> erl_scan:string("1"++lists:duplicate(309, $0)++".0"). > {error,{1,erl_scan,{illegal,float}},1} > 21> erl_scan:string("1"++lists:duplicate(308, $0)++".0"). > {ok,[{float,1,1.0e308}],1} > > Everything fine, infinities are trapped. > > Unfortunetly, for underflows compiler similary behaves wrong > > 22> erl_scan:string("0."++lists:duplicate(322, $0)++"1"). > {ok,[{float,1,1.0e-323}],1} % should return error > 23> erl_scan:string("0."++lists:duplicate(323, $0)++"1"). > {ok,[{float,1,0.0}],1} % should return error > > Also string:to_float behaves in same way: > > 24> string:to_float("0."++lists:duplicate(322, $0)++"1"). > {1.0e-323,[]} % should return error > 25> string:to_float("0."++lists:duplicate(323, $0)++"1"). > {0.0,[]} % should return error > > 26> string:to_float("1"++lists:duplicate(308, $0)++".0"). > {1.0e308,[]} > 27> string:to_float("1"++lists:duplicate(309, $0)++".0"). > {error,no_float} > > > > I think it should be fixed, so more reliable software can be written, > like statistics software (subnormals can for example easilly appear when > summing and multipling small numbers, however it is normally rear, and > should throw error, to not produce bad results, because even using smart > summation algorithms, like Kahan scheme, will not fix this problem). > > For sure such floats should not be allowed in source code, or when > parsing from string. And probably also not be allowed to appear using > any builting arithmetic functions. > > > Another example: > > 30> math:exp(100). > 2.6881171418161356e43 > 31> math:exp(1000). > ** exception error: bad argument in an arithmetic expression > ? ? in function ?math:exp/1 > ? ? ? ?called as math:exp(1000) > > infinity trapped, but subnormal not: > > 32> math:exp(-100). > 3.720075976020836e-44 > 33> math:exp(-1000). > 0.0 > > > I also found that scientific notation behaves in same way: > > 34> list_to_float("1.123456789e-320"). > 1.1235e-320 > 35> list_to_float("1.123456789e-330"). > 0.0 > > > My last argument will be about hardware support. For example many new > ARM processors, supports hardware floating point computations, but often > without support for subnormals! This makes them not fully IEEE-754 > compilant, unless running in software floating point mode, which is > slower, especially if it also need to handle subnormals! > > > I'm using 32-bit cpu: > > model name ? ? ?: AMD Athlon(tm) > stepping ? ? ? ?: 2 > cpu MHz ? ? ? ? : 1154.450 > cache size ? ? ?: 256 KB > fdiv_bug ? ? ? ?: no > hlt_bug ? ? ? ? : no > f00f_bug ? ? ? ?: no > coma_bug ? ? ? ?: no > fpu ? ? ? ? ? ? : yes > fpu_exception ? : yes > cpuid level ? ? : 1 > wp ? ? ? ? ? ? ?: yes > flags ? ? ? ? ? : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 mmx fxsr sse syscall mp mmxext 3dnowext 3dnow up > > > Erlang version 1:14.b.4-dfsg-1 installed from Debian/GNU Linux testing. > Do not know exact complation flags, but here is small info > > 1> erlang:system_info(system_version). > "Erlang R14B04 (erts-5.8.5) [source] [rq:1] [async-threads:0] [hipe] [kernel-poll:false]\n" > 2> erlang:system_info(system_architecture). > "i486-pc-linux-gnu" > 3> erlang:system_info(build_type). > opt > 4> erlang:system_info(c_compiler_used). > {gnuc,{4,6,1}} > 5> erlang:system_info(debug_compiled). > false > 6> erlang:system_info(smp_support). > false > 7> erlang:system_info(threads). > true > > > > > speed differences of subnormals on Intel Core2 (32-bit mode), same compiler, same options. > > 1> timer:tc(lists, sum, [lists:duplicate(10000000, 0.1e-300)]). > {278703,9.999999998591641e-295} > 3> timer:tc(lists, sum, [lists:duplicate(10000000, 0.1e-310)]). > {1049095,9.999999997470606e-305} > 5> timer:tc(lists, sum, [lists:duplicate(10000000, 0.1e-320)]). > {3501330,9.980126046e-315} > > % about 12 times slower, and obviously loss of precission. > > Beyond infinities, nan, and denormalized numbers, there also > signed zero, but this is handled without problem: > > 10> list_to_float("0.0") =:= list_to_float("-0.0"). > true > 11> math:sqrt(list_to_float("-0.0")). > 0.0 > > This is acceptable, because signed zero is mostly usefull with NaN and > infinites support, and because we do not have them, it is good solution > to ignore signed zero problem. > > > I found no discussion on erlang-questions list in the past, so hope it > is worth discussing. > > Also Erlang Reference Manual User's Guide, doesn't mention anything on the matter. > > Regards, > Witek > > > > > -- > Witold Baryluk > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions From max.lapshin@REDACTED Wed Dec 28 12:03:30 2011 From: max.lapshin@REDACTED (Max Lapshin) Date: Wed, 28 Dec 2011 14:03:30 +0300 Subject: [erlang-questions] Diagnosting problems with cowboy Message-ID: Erlyvideo is failing after 3 hours of working. It happens only on one client's machine. It is new version that uses cowboy. This is beginning of erl_crash.dump: =erl_crash_dump:0.1 Wed Dec 28 06:05:14 2011 Slogan: eheap_alloc: Cannot allocate 1824525600 bytes of memory (of type "heap"). System version: Erlang R15B (erts-5.9) [source] [64-bit] [smp:4:4] [async-threads:8] [hipe] [kernel-poll:true] Compiled: Wed Dec 14 16:00:22 2011 Taints: crypto,jiffy,mpeg2_crc32,mpegts_reader Atoms: 12502 =memory total: 4067805288 processes: 3758136452 processes_used: 3758105607 system: 309668836 atom: 347633 atom_used: 344446 binary: 86113112 code: 8335129 ets: 730624 I've found only two interesting processes (look at their Reductions, Stack and Message queue length): =proc:<0.244.0> State: Garbing Spawned as: cowboy_http_protocol:init/4 Spawned by: <0.133.0> Started: Wed Dec 28 02:15:21 2011 Message queue length: 6577001 Number of heap fragments: 0 Heap fragment data: 0 Link list: [#Port<0.2722>, <0.239.0>, <0.133.0>, {from,<0.132.0>,#Ref<0.0.0.322>}] Reductions: 25916636 Stack+heap: 24488375 OldHeap: 182452560 Heap unused: 22924313 OldHeap unused: 663469 Program counter: 0x00007f8e80a98998 (prim_inet:recv0/3 + 224) CP: 0x0000000000000000 (invalid) =proc:<0.250.0> State: Waiting Spawned as: cowboy_http_protocol:init/4 Spawned by: <0.133.0> Started: Wed Dec 28 02:15:21 2011 Message queue length: 6596904 Number of heap fragments: 0 Heap fragment data: 0 Link list: [#Port<0.2784>, <0.239.0>, <0.133.0>, {to,<0.239.0>,#Ref<0.0.4.18567>}, {from,<0.132.0>,#Ref<0.0.0.355>}] Reductions: 25538292 Stack+heap: 24488375 OldHeap: 182452560 Heap unused: 22856852 OldHeap unused: 110812 Program counter: 0x00007f8e80abd950 (gen:do_call/4 + 576) CP: 0x0000000000000000 (invalid) arity = 0 Looks like these processes were receiving about 500 messages per second during 4 hours. Either they were subscribing on the same stream several times, either there was some other problem. How can I inspect this? Currently I think about adding process, that once in 5 seconds check all processes and kill everyone with message queue len > 10 000 messages. From iostres@REDACTED Wed Dec 28 14:24:56 2011 From: iostres@REDACTED (Ivan Ostres) Date: Wed, 28 Dec 2011 14:24:56 +0100 Subject: [erlang-questions] SASL event handler problem Message-ID: Hi all, I am trying to make a custom SASL handler (gen_event) as follows: -module(logger_event). -behaviour(gen_event). %% API -export([start_link/0, register_with_logger/0, unregister_with_logger/0]). %% gen_event callbacks -export([init/1, handle_event/2, handle_call/2, handle_info/2, terminate/2, code_change/3]). -define(SERVER, ?MODULE). -record(state, {}). start_link() -> gen_event:start_link({local, ?SERVER}). register_with_logger() -> error_logger:add_report_handler(?MODULE). init([]) -> {ok, #state{}}. handle_event({info_report,_Gleader, {Pid, Type, Report}}, State) -> io:fwrite("INFO <~p> ~p ~p~n",[Pid, Type, Report]), {ok, State}; handle_event(_Event, State) -> io:fwrite("ERR unknown event ~p~n",[_Event]), {ok, State}. handle_call(_Request, State) -> Reply = ok, {ok, Reply, State}. handle_info(_Info, State) -> {ok, State}. terminate(_Reason, _State) -> ok. code_change(_OldVsn, State, _Extra) -> {ok, State}. The problem is that I get different results for following cases: Eshell V5.8.5 (abort with ^G) (emacs@REDACTED)1> logger_event:start_link(). {ok,<0.39.0>} (emacs@REDACTED)2> logger_event:register_with_logger(). ok (emacs@REDACTED)3> error_logger:info_report("test1"). INFO <<0.37.0>> std_info "test1" =INFO REPORT==== 28-Dec-2011::14:23:07 === test1 ok (emacs@REDACTED)4> error_logger:info_report("test~p",2). INFO <<0.37.0>> "test~p" 2 ok (emacs@REDACTED)5> The problem is that for std_info (error_logger:info_report/1) I get both "my" version of log and standard log, while for (error_logger:info_report/2) I get just my version of log. Please help, Ivan From iostres@REDACTED Wed Dec 28 15:25:40 2011 From: iostres@REDACTED (Ivan Ostres) Date: Wed, 28 Dec 2011 15:25:40 +0100 Subject: [erlang-questions] SASL event handler problem In-Reply-To: References: Message-ID: Hi Siri, thanks for the answer - I definitely mixed info_report with info_msg :-(. BR, Ivan On 12/28/11 3:10 PM, Siri Hansen wrote: > Hi Ivan! > > The arguments for error_logger:info_report/2 shall be Type and Report, > not a format string and data. The documentation says: > > "info_report(Type, Report) -> ok > > Types: > > Type = any() > Report = report() > > Sends a user defined information report event to the error logger. An > event handler to handle the event is supposed to have been added. *The > event is ignored by the standard event handler*. > > It is recommended that Report follows the same structure as for > info_report/1." > > In fact, if you give 'std_info' as Type to the call, then the standard > event handler will handle the report (equivalent to > error_logger:info_report/1), else it will be ignored. > > What you might be looking for is actually error_logger:info_msg/2 - > which takes a format string and data. > > Regards > /siri > > > 2011/12/28 Ivan Ostres > > > Hi all, > > I am trying to make a custom SASL handler (gen_event) as follows: > > -module(logger_event). > -behaviour(gen_event). > %% API > -export([start_link/0, register_with_logger/0, > unregister_with_logger/0]). > %% gen_event callbacks > -export([init/1, handle_event/2, handle_call/2, > handle_info/2, terminate/2, code_change/3]). > -define(SERVER, ?MODULE). > -record(state, {}). > > start_link() -> > gen_event:start_link({local, ?SERVER}). > register_with_logger() -> > error_logger:add_report_handler(?MODULE). > init([]) -> > {ok, #state{}}. > > handle_event({info_report,_Gleader, {Pid, Type, Report}}, State) -> > io:fwrite("INFO <~p> ~p ~p~n",[Pid, Type, Report]), > {ok, State}; > handle_event(_Event, State) -> > io:fwrite("ERR unknown event ~p~n",[_Event]), > {ok, State}. > > handle_call(_Request, State) -> > Reply = ok, > {ok, Reply, State}. > handle_info(_Info, State) -> > {ok, State}. > terminate(_Reason, _State) -> > ok. > code_change(_OldVsn, State, _Extra) -> > {ok, State}. > > The problem is that I get different results for following cases: > > Eshell V5.8.5 (abort with ^G) > (emacs@REDACTED)1> logger_event:start_link(). > {ok,<0.39.0>} > (emacs@REDACTED)2> logger_event:register_with_logger(). > ok > (emacs@REDACTED)3> error_logger:info_report("test1"). > INFO <<0.37.0>> std_info "test1" > > =INFO REPORT==== 28-Dec-2011::14:23:07 === > test1 > ok > (emacs@REDACTED)4> error_logger:info_report("test~p",2). > INFO <<0.37.0>> "test~p" 2 > ok > (emacs@REDACTED)5> > > > The problem is that for std_info (error_logger:info_report/1) I > get both "my" version of log and standard log, while for > (error_logger:info_report/2) I get just my version of log. > > Please help, > Ivan > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > > From klacke@REDACTED Wed Dec 28 18:05:01 2011 From: klacke@REDACTED (Claes Wikstrom) Date: Wed, 28 Dec 2011 18:05:01 +0100 Subject: [erlang-questions] Yaws 1.92 Message-ID: <4EFB4C3D.1050305@hyber.org> New release of Yaws, called 1.92 Code, relnotes, win32 build etc as usual at http://yaws.hyber.org Enjoy, /klacke From ari.brandeis.king@REDACTED Thu Dec 29 04:15:19 2011 From: ari.brandeis.king@REDACTED (Ari King) Date: Wed, 28 Dec 2011 22:15:19 -0500 Subject: [erlang-questions] Kerl + Erlang Installation Management Message-ID: Hi, Does anyone know if it's possible to use kerl (https://github.com/spawngrid/kerl) to manage Erlang installation requirements for products like RabbitMQ, CouchDB, etc.? I've been able to use kerl to build and install various Erlang version, and I've been able to compile code against these versions. However, when I tried to install the aforementioned products, they were not able to find any of the Erlang installations. Thanks. -Ari From bourinov@REDACTED Thu Dec 29 05:30:09 2011 From: bourinov@REDACTED (Max Bourinov) Date: Thu, 29 Dec 2011 08:30:09 +0400 Subject: [erlang-questions] base64:decode fails on facebook base64 encoded strings In-Reply-To: <2158D152-D690-4DC1-9E40-7C9D79A24D56@licenser.net> References: <2158D152-D690-4DC1-9E40-7C9D79A24D56@licenser.net> Message-ID: So Erlangers, I wrote about this little bug in Facebook and I got an answer! >>I believe the trailing = is an optional padding in base64 your code needs to accept base64 with and without trailing '=' characters. See last part of http://email.about.com/cs/standards/a/base64_encoding.htm This is what they said. That is very interesting, I personally would not omit data from protocol specification, but it appears that if it possible. Anyway I didn't see anything about omitting here http://tools.ietf.org/html/rfc1421 or http://tools.ietf.org/html/rfc2045 So, if you ever face such a loose implementation of base64 here is a snippet that might help you to deal with it: -spec fb_decode_base64(Base64 :: list()) -> binary() | error. fb_decode_base64(Base64) when is_list(Base64) -> try base64:decode(Base64) catch error:_ -> % could be missing = try base64:decode(Base64 ++ "=") catch error:_ -> % could be missing == try base64:decode(Base64 ++ "==") catch error:_ -> % base64 is really wrong. we cannot fix it error end end end. On Wed, Dec 21, 2011 at 7:54 PM, Heinz N. Gies wrote: > As an addition look closely at the decoding on the webside, it also fails > the last two characters are missing unless you add the missing '=' to the > base64 encoded data. > > Regards, > Heinz > > -- > Heinz N. Gies > heinz@REDACTED > http://licenser.net > > On Dec 21, 2011, at 16:44, Max Bourinov wrote: > > Hi guys, > > Does anybody knows why base64:decode fails on strings like this: > > > eyJhbGdvcml0aG0iOiJITUFDLVNIQTI1NiIsImNyZWRpdHMiOnsib3JkZXJfZGV0YWlscyI6IntcIm9yZGVyX2lkXCI6Mjg1NTAwMDgxNTAxMTU4LFwiYnV5ZXJcIjoxMDI3NDE5NzkzLFwiYXBwXCI6MTY4MzExOTc2NTgwNDUwLFwicmVjZWl2ZXJcIjoxMDI3NDE5NzkzLFwiYW1vdW50XCI6MSxcInVwZGF0ZV90aW1lXCI6MTMyNDQ3OTA3NixcInRpbWVfcGxhY2VkXCI6MTMyNDQ3OTA3NCxcImRhdGFcIjpcIlwiLFwiaXRlbXNcIjpbe1wiaXRlbV9pZFwiOlwiMFwiLFwidGl0bGVcIjpcIkEgRmFjZWJvb2sgSGF0XCIsXCJkZXNjcmlwdGlvblwiOlwiVGhlIGNvb2xlc3QgaGF0IHlvdSd2ZSBldmVyIHNlZW4uXCIsXCJpbWFnZV91cmxcIjpcImh0dHA6XFxcL1xcXC93d3cuZmFjZWJvb2suY29tXFxcL2ltYWdlc1xcXC9naWZ0c1xcXC83NDAucG5nXCIsXCJwcm9kdWN0X3VybFwiOlwiaHR0cDpcXFwvXFxcL3d3dy5mYWNlYm9vay5jb21cXFwvaW1hZ2VzXFxcL2dpZnRzXFxcLzc0MC5wbmdcIixcInByaWNlXCI6MSxcImRhdGFcIjpcIlwifV0sXCJzdGF0dXNcIjpcInBsYWNlZFwifSIsInN0YXR1cyI6InBsYWNlZCIsIm9yZGVyX2lkIjoyODU1MDAwODE1MDExNTgsInRlc3RfbW9kZSI6MX0sImV4cGlyZXMiOjEzMjQ0ODMyMDAsImlzc3VlZF9hdCI6MTMyNDQ3OTA3Niwib2F1dGhfdG9rZW4iOiJBQUFDWkFGQ1pCVFZXSUJBQzBhYkhWb3dLRWdTVHVOQ3ZDYjRTR21hWkE4STdYc3Z0bXBZZU1hTWx3clNia0U5dkxKTHRldUdraWpNakh4aVpBVWY5am9RcG9aQ3ZWYW9YVUN6N21zU3Bjb0FuWGhKRDVRU0lRIiwidXNlciI6eyJjb3VudHJ5IjoicnUiLCJsb2NhbGUiOiJlbl9VUyIsImFnZSI6eyJtaW4iOjIxfX0sInVzZXJfaWQiOiIxMDI3NDE5NzkzIn0 > > You can easily decode it with online tool like this: > http://www.motobit.com/util/base64-decoder-encoder.asp > > But lovely Erlang says: > > ** exception error: no function clause matching base64:decode("Jye", > > [133,177,157,189,201,165,209,161,180,136,232,137,33,53,5,12, > > 181,77,33,4,200,212,216,136,176,137,141|...]) > in function base64:decode/1 > > Seems something wrong with pattern matching or what could it be? And most > interesting question - how to find a proper work around? > > > Best regards, > Max > > > _______________________________________________ > 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 steven.charles.davis@REDACTED Thu Dec 29 06:29:06 2011 From: steven.charles.davis@REDACTED (Steve Davis) Date: Wed, 28 Dec 2011 21:29:06 -0800 (PST) Subject: [erlang-questions] base64:decode fails on facebook base64 encoded strings In-Reply-To: References: <2158D152-D690-4DC1-9E40-7C9D79A24D56@licenser.net> Message-ID: <167198e3-f1ec-4d1e-8d57-8d46f8f64817@k10g2000yqk.googlegroups.com> These two refs are interesting in this context: http://en.wikipedia.org/wiki/Base64#Variants_summary_table http://tools.ietf.org/html/rfc4648#section-5 /s On Dec 28, 10:30?pm, Max Bourinov wrote: > So Erlangers, > > I wrote about this little bug in Facebook and I got an answer! > > >>I believe the trailing = is an optional padding in base64 your code needs > > to accept base64 with and without trailing '=' characters. See last part ofhttp://email.about.com/cs/standards/a/base64_encoding.htm > > This is what they said. That is very interesting, I personally would not > omit data from protocol specification, but it appears that if it possible. > Anyway I didn't see anything about omitting herehttp://tools.ietf.org/html/rfc1421orhttp://tools.ietf.org/html/rfc2045 > > So, if you ever face such a loose implementation of base64 here is a > snippet that might help you to deal with it: > > -spec fb_decode_base64(Base64 :: list()) -> binary() | error. > fb_decode_base64(Base64) when is_list(Base64) -> > ? ? try base64:decode(Base64) > ? ? catch > ? ? ? ? error:_ -> % could be missing = > ? ? ? ? ? ? ? ? try base64:decode(Base64 ++ "=") > ? ? ? ? ? ? ? ? catch > ? ? ? ? ? ? ? ? ? ? ? ? error:_ -> % could be missing == > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? try base64:decode(Base64 ++ "==") > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? catch > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? error:_ -> % base64 is really wrong. we cannot fix it > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? error > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? end > ? ? ? ? ? ? ? ? end > > ? ? end. > > On Wed, Dec 21, 2011 at 7:54 PM, Heinz N. Gies wrote: > > > > > > > > > As an addition look closely at the decoding on the webside, it also fails > > the last two characters are missing unless you add the missing '=' to the > > base64 encoded data. > > > Regards, > > Heinz > > > -- > > Heinz N. Gies > > he...@REDACTED > >http://licenser.net > > > On Dec 21, 2011, at 16:44, Max Bourinov wrote: > > > Hi guys, > > > Does anybody knows why base64:decode fails on strings like this: > > > eyJhbGdvcml0aG0iOiJITUFDLVNIQTI1NiIsImNyZWRpdHMiOnsib3JkZXJfZGV0YWlscyI6Int cIm9yZGVyX2lkXCI6Mjg1NTAwMDgxNTAxMTU4LFwiYnV5ZXJcIjoxMDI3NDE5NzkzLFwiYXBwXC I6MTY4MzExOTc2NTgwNDUwLFwicmVjZWl2ZXJcIjoxMDI3NDE5NzkzLFwiYW1vdW50XCI6MSxcI nVwZGF0ZV90aW1lXCI6MTMyNDQ3OTA3NixcInRpbWVfcGxhY2VkXCI6MTMyNDQ3OTA3NCxcImRh dGFcIjpcIlwiLFwiaXRlbXNcIjpbe1wiaXRlbV9pZFwiOlwiMFwiLFwidGl0bGVcIjpcIkEgRmF jZWJvb2sgSGF0XCIsXCJkZXNjcmlwdGlvblwiOlwiVGhlIGNvb2xlc3QgaGF0IHlvdSd2ZSBldm VyIHNlZW4uXCIsXCJpbWFnZV91cmxcIjpcImh0dHA6XFxcL1xcXC93d3cuZmFjZWJvb2suY29tX FxcL2ltYWdlc1xcXC9naWZ0c1xcXC83NDAucG5nXCIsXCJwcm9kdWN0X3VybFwiOlwiaHR0cDpc XFwvXFxcL3d3dy5mYWNlYm9vay5jb21cXFwvaW1hZ2VzXFxcL2dpZnRzXFxcLzc0MC5wbmdcIix cInByaWNlXCI6MSxcImRhdGFcIjpcIlwifV0sXCJzdGF0dXNcIjpcInBsYWNlZFwifSIsInN0YX R1cyI6InBsYWNlZCIsIm9yZGVyX2lkIjoyODU1MDAwODE1MDExNTgsInRlc3RfbW9kZSI6MX0sI mV4cGlyZXMiOjEzMjQ0ODMyMDAsImlzc3VlZF9hdCI6MTMyNDQ3OTA3Niwib2F1dGhfdG9rZW4i OiJBQUFDWkFGQ1pCVFZXSUJBQzBhYkhWb3dLRWdTVHVOQ3ZDYjRTR21hWkE4STdYc3Z0bXBZZU1 hTWx3clNia0U5dkxKTHRldUdraWpNakh4aVpBVWY5am9RcG9aQ3ZWYW9YVUN6N21zU3Bjb0FuWG hKRDVRU0lRIiwidXNlciI6eyJjb3VudHJ5IjoicnUiLCJsb2NhbGUiOiJlbl9VUyIsImFnZSI6e yJtaW4iOjIxfX0sInVzZXJfaWQiOiIxMDI3NDE5NzkzIn0 > > > You can easily decode it with online tool like this: > >http://www.motobit.com/util/base64-decoder-encoder.asp > > > But lovely Erlang says: > > > ** exception error: no function clause matching base64:decode("Jye", > > > [133,177,157,189,201,165,209,161,180,136,232,137,33,53,5,12, > > > ?181,77,33,4,200,212,216,136,176,137,141|...]) > > ? ? ?in function ?base64:decode/1 > > > Seems something wrong with pattern matching or what could it be? And most > > interesting question - how to find a proper work around? > > > Best regards, > > Max > > > ?_______________________________________________ > > erlang-questions mailing list > > erlang-questi...@REDACTED > >http://erlang.org/mailman/listinfo/erlang-questions > > > _______________________________________________ > > erlang-questions mailing list > > erlang-questi...@REDACTED > >http://erlang.org/mailman/listinfo/erlang-questions > > _______________________________________________ > erlang-questions mailing list > erlang-questi...@REDACTED://erlang.org/mailman/listinfo/erlang-questions From cjsvance@REDACTED Thu Dec 29 06:37:23 2011 From: cjsvance@REDACTED (Christopher Vance) Date: Thu, 29 Dec 2011 16:37:23 +1100 Subject: [erlang-questions] base64:decode fails on facebook base64 encoded strings In-Reply-To: <167198e3-f1ec-4d1e-8d57-8d46f8f64817@k10g2000yqk.googlegroups.com> References: <2158D152-D690-4DC1-9E40-7C9D79A24D56@licenser.net> <167198e3-f1ec-4d1e-8d57-8d46f8f64817@k10g2000yqk.googlegroups.com> Message-ID: Trailing '=' if needed to bring the payload to a multiple of 4 characters are not optional. You could probably add extra '=' after that if you like. On 29 December 2011 16:29, Steve Davis wrote: > These two refs are interesting in this context: > > http://en.wikipedia.org/wiki/Base64#Variants_summary_table > http://tools.ietf.org/html/rfc4648#section-5 > > /s > > On Dec 28, 10:30?pm, Max Bourinov wrote: >> So Erlangers, >> >> I wrote about this little bug in Facebook and I got an answer! >> >> >>I believe the trailing = is an optional padding in base64 your code needs >> >> to accept base64 with and without trailing '=' characters. See last part ofhttp://email.about.com/cs/standards/a/base64_encoding.htm >> >> This is what they said. That is very interesting, I personally would not >> omit data from protocol specification, but it appears that if it possible. >> Anyway I didn't see anything about omitting herehttp://tools.ietf.org/html/rfc1421orhttp://tools.ietf.org/html/rfc2045 >> >> So, if you ever face such a loose implementation of base64 here is a >> snippet that might help you to deal with it: >> >> -spec fb_decode_base64(Base64 :: list()) -> binary() | error. >> fb_decode_base64(Base64) when is_list(Base64) -> >> ? ? try base64:decode(Base64) >> ? ? catch >> ? ? ? ? error:_ -> % could be missing = >> ? ? ? ? ? ? ? ? try base64:decode(Base64 ++ "=") >> ? ? ? ? ? ? ? ? catch >> ? ? ? ? ? ? ? ? ? ? ? ? error:_ -> % could be missing == >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? try base64:decode(Base64 ++ "==") >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? catch >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? error:_ -> % base64 is really wrong. we cannot fix it >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? error >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? end >> ? ? ? ? ? ? ? ? end >> >> ? ? end. >> >> On Wed, Dec 21, 2011 at 7:54 PM, Heinz N. Gies wrote: >> >> >> >> >> >> >> >> > As an addition look closely at the decoding on the webside, it also fails >> > the last two characters are missing unless you add the missing '=' to the >> > base64 encoded data. >> >> > Regards, >> > Heinz >> >> > -- >> > Heinz N. Gies >> > he...@REDACTED >> >http://licenser.net >> >> > On Dec 21, 2011, at 16:44, Max Bourinov wrote: >> >> > Hi guys, >> >> > Does anybody knows why base64:decode fails on strings like this: >> >> > eyJhbGdvcml0aG0iOiJITUFDLVNIQTI1NiIsImNyZWRpdHMiOnsib3JkZXJfZGV0YWlscyI6Int cIm9yZGVyX2lkXCI6Mjg1NTAwMDgxNTAxMTU4LFwiYnV5ZXJcIjoxMDI3NDE5NzkzLFwiYXBwXC I6MTY4MzExOTc2NTgwNDUwLFwicmVjZWl2ZXJcIjoxMDI3NDE5NzkzLFwiYW1vdW50XCI6MSxcI nVwZGF0ZV90aW1lXCI6MTMyNDQ3OTA3NixcInRpbWVfcGxhY2VkXCI6MTMyNDQ3OTA3NCxcImRh dGFcIjpcIlwiLFwiaXRlbXNcIjpbe1wiaXRlbV9pZFwiOlwiMFwiLFwidGl0bGVcIjpcIkEgRmF jZWJvb2sgSGF0XCIsXCJkZXNjcmlwdGlvblwiOlwiVGhlIGNvb2xlc3QgaGF0IHlvdSd2ZSBldm VyIHNlZW4uXCIsXCJpbWFnZV91cmxcIjpcImh0dHA6XFxcL1xcXC93d3cuZmFjZWJvb2suY29tX FxcL2ltYWdlc1xcXC9naWZ0c1xcXC83NDAucG5nXCIsXCJwcm9kdWN0X3VybFwiOlwiaHR0cDpc XFwvXFxcL3d3dy5mYWNlYm9vay5jb21cXFwvaW1hZ2VzXFxcL2dpZnRzXFxcLzc0MC5wbmdcIix cInByaWNlXCI6MSxcImRhdGFcIjpcIlwifV0sXCJzdGF0dXNcIjpcInBsYWNlZFwifSIsInN0YX R1cyI6InBsYWNlZCIsIm9yZGVyX2lkIjoyODU1MDAwODE1MDExNTgsInRlc3RfbW9kZSI6MX0sI mV4cGlyZXMiOjEzMjQ0ODMyMDAsImlzc3VlZF9hdCI6MTMyNDQ3OTA3Niwib2F1dGhfdG9rZW4i OiJBQUFDWkFGQ1pCVFZXSUJBQzBhYkhWb3dLRWdTVHVOQ3ZDYjRTR21hWkE4STdYc3Z0bXBZZU1 hTWx3clNia0U5dkxKTHRldUdraWpNakh4aVpBVWY5am9RcG9aQ3ZWYW9YVUN6N21zU3Bjb0FuWG hKRDVRU0lRIiwidXNlciI6eyJjb3VudHJ5IjoicnUiLCJsb2NhbGUiOiJlbl9VUyIsImFnZSI6e yJtaW4iOjIxfX0sInVzZXJfaWQiOiIxMDI3NDE5NzkzIn0 >> >> > You can easily decode it with online tool like this: >> >http://www.motobit.com/util/base64-decoder-encoder.asp >> >> > But lovely Erlang says: >> >> > ** exception error: no function clause matching base64:decode("Jye", >> >> > [133,177,157,189,201,165,209,161,180,136,232,137,33,53,5,12, >> >> > ?181,77,33,4,200,212,216,136,176,137,141|...]) >> > ? ? ?in function ?base64:decode/1 >> >> > Seems something wrong with pattern matching or what could it be? And most >> > interesting question - how to find a proper work around? >> >> > Best regards, >> > Max >> >> > ?_______________________________________________ >> > erlang-questions mailing list >> > erlang-questi...@REDACTED >> >http://erlang.org/mailman/listinfo/erlang-questions >> >> > _______________________________________________ >> > erlang-questions mailing list >> > erlang-questi...@REDACTED >> >http://erlang.org/mailman/listinfo/erlang-questions >> >> _______________________________________________ >> erlang-questions mailing list >> erlang-questi...@REDACTED://erlang.org/mailman/listinfo/erlang-questions > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions -- Christopher Vance From baryluk@REDACTED Thu Dec 29 09:08:19 2011 From: baryluk@REDACTED (Witold Baryluk) Date: Thu, 29 Dec 2011 09:08:19 +0100 Subject: [erlang-questions] source file encoding In-Reply-To: <4EF078C1.9090105@gmail.com> References: <4EF078C1.9090105@gmail.com> Message-ID: <20111229080818.GA15295@smp.if.uj.edu.pl> On 12-20 13:00, Richard Carlsson wrote: > On 12/19/2011 11:18 AM, Justus wrote: > >Hi all, > > > >Strings must be in the ISO-latin-1 character set. I remember that > >errors will be reported if other characters occurring in a .erl file > >when compiling. > > > >But when trying R15B, it looks that values beyond ISO-latin-1 are also > >accepted. So now, we can use UTF8 without BOM encoding, and with the > >help of ct_expand, I managed to say "hello world" in Chinese > >literally. > > > >I wonder is there any plan add Unicode support in string- and > >character-literals? > > > >-compile({parse_transform, ct_expand}). > > > >-define(STR(S), ct_expand:term(unicode:characters_to_list(list_to_binary(S)))). > > > >hello_world() -> > > S = ?STR("??, ??"), > > io:format("~ts~n", [S]). > > > > The code that you wrote is actually the following: > > S = ?STR("?? ???, ??????"), > > Even if your editor shows you chinese characters and saves the file > as utf-8, Erlang still treats the input as Latin-1. (All byte > sequences are valid latin-1, so there is no foolproof way of > separating utf-8 files from latin-1 files automatically). > > To understand where things go can wrong if you start saving source > files as utf-8, consider the following two modules: > > module(m1). > ... > Pid ! "Micka?l", > ... > > module(m2). > ... > receive > "Micka?l" -> ok > end > ... > > Assume that the first is saved with Latin-1 and the second with > UTF-8. Even though they may look the same to your eyes (because your > editor hides the difference) the code in the second file is really > waiting for the following string, and the program will not work: > > receive > "Micka\303\253l" -> ok > end > This is how erl_scan works, when it finds starting " of string, then it doesn't analize what is next, just searches for next closing ", (modulo skiping over escaped \", so beetween " and ", can be anything at all (but not new lines). Then it is parsed as is. Kind a bug actually. Check this https://github.com/baryluk/otp/tree/source_code_encoding_in_compiler_and_epp I have WIP branch which enables you choising file encoding for sources files, it is actually single small change in erl_scan.erl module, but patch is slightly larger, to make it fully configurable, to have documentation and tests. So is still not complete. Basically I use it for UTF-8 files (it is most safe, also when reading ASCII encoded files). Here is a diff https://github.com/baryluk/otp/compare/master...source_code_encoding_in_compiler_and_epp Regards, Witek -- Witold Baryluk From baryluk@REDACTED Thu Dec 29 10:39:00 2011 From: baryluk@REDACTED (Witold Baryluk) Date: Thu, 29 Dec 2011 10:39:00 +0100 Subject: [erlang-questions] towards a unified dict api In-Reply-To: <4EF4FBFC.5060307@gmail.com> References: <4EF4FBFC.5060307@gmail.com> Message-ID: <20111229093859.GB15295@smp.if.uj.edu.pl> On 12-23 23:09, Richard Carlsson wrote: > A thing I've been tinkering with on and off for years is making a > unified API for dictionaries in Erlang (dict, orddict, gb_trees, > ets, dets). This requires figuring out a set of function names and > calling conventions that are mostly familiar but which don't already > have a conflicting definition in one or more of the modules > involved. > > In the end I went for using most of the dict module API unchanged, > with some new synonyms, and a number of additional useful functions. > I also made the dict module define a new 'dict' behaviour (even > though it's just an interface rather than a complete behaviour). > > One particular detail is that gb_trees (with its user-unfriendly > name and rather different calling conventions) can now quite simply > be used through the dict module as an ordered variant of dict, and > you can pretend you never heard of the gb_trees module unless you > want to use one of its specially implementation-dependent functions. > An ordered dict can be created through dict:new([ordered_set]). This > also resolved some major problems with clashing function > definitions. > > The code (based on the OTP maint branch) can be found here: > > https://github.com/richcarl/otp/tree/dict-api > I agree dict API is way to go, because it is so used. However I would be against introdusing any synonymous, it may start confusing. What I do not link in dict API is how update/4 function behaves. It is called like update(Key, Fun, Initial, Dict) -> Dict. Problem is that if Initial is some sort of complex and costly to compute initial value, then it will be most of the time wasted, because it will be not needed. THis is why I often use function like this: update_full(Key, Fun, FunInit, Dict) when is_function(Fun, 1), is_function(FunInit, 0) -> case dict:is_key(Key, Dict) of true -> dict:update(Key, Fun, Dict); false -> Val = FunInit(), dict:store(Key, Val, Dict) end; Of course integrating it directly into dict will make it even faster, by not needing to traverse datastructure twice. I'm not really sure if integrating abstract collections into existing dict module is good idea. It should not break compatibility, but it will for sure bring some performance hit (due pattern matching in the dict module and delegation to other modules). I think dict module should be leaves as is, and new module should be introduced, like gen_dict. Sure in some sense, it is easier to just find all dict:new() using simple grep, and change it to dict:new([...]), where appropriate without worring about other call sites, but if for some reasons one changes dict:new([dict]), to something else, some functions may subtelly change how they work, so I think it should not messed too much. And running sed s/\bdict:\b/gen_dict:/ or similar things, shouldn't be hard, but will make sure developer understand it can be: 1) slightly slower, due additional level of indirection 2) have slightly different API In fact I prepared much simpler (but ugly) wrapper years ago, and often I use it when I know I needs to store and access randomly potentially lots of elements, but want to test if it is actually faster than using simple orddict, or proplist or gb_trees or own datastructures: https://github.com/baryluk/common_collection % I have somewhere on disk even newer version, will need to search No tests, no real documentation, no nothing, no simple way of adding collections without editing file (howver it should be simple to fix). I will for sure write it now in different way (I was using for some time a parametrized modules as wrappers to dict and proplists also, but because of unknown future of them Erlang - I personally like them very much! - i stoped using them, despite being even simpler to use). But it works. It looks that https://github.com/erlware/erlware_commons/tree/master/src is more modular and easier to extend by other persons without changing source code. It probably is faster. But it lacks many very useful functions, as well is not separate project on its own (as it should be). -- Witold Baryluk JID: witold.baryluk // jabster.pl From baryluk@REDACTED Thu Dec 29 11:15:17 2011 From: baryluk@REDACTED (Witold Baryluk) Date: Thu, 29 Dec 2011 11:15:17 +0100 Subject: [erlang-questions] source file encoding In-Reply-To: References: <4EF078C1.9090105@gmail.com> <20111229080818.GA15295@smp.if.uj.edu.pl> Message-ID: <20111229101517.GC15295@smp.if.uj.edu.pl> On 12-29 16:17, Justus wrote: > Great. > > But have you ever considered the Python way? > > http://docs.python.org/tutorial/interpreter.html#source-code-encoding I belive this is bad solution. ENcoding should be defined OUTSIDE of the file itself, because if not it creates chicken-egg proble, how to open and read file if it is not yet know its encoding? Same problem is is HTML, when charset can be defined in head section. It is much better to just define it in HTTP header using charset= property of Content-Type. It is also much faster (doesn't need any buffering, and other tricks). It may work in case of UTF-8, because it should be relativly safe to work on ASCII files as UTF-8 files, and then switch to UTF-8 after such declaration. A charset should be defined outside, manually, or using some form of file-system metadata (extended atributes), or using BOM marker. http://en.wikipedia.org/wiki/Byte_order_mark My solution is just SINGLE line of change in epp.erl: around line 252 server(Pid, Name, Path, Pdm, Encoding0) -> process_flag(trap_exit, true), - case file:open(Name, [read]) of + case file:open(Name, [read, {encoding, utf8}]) of Rest of patch is actually configurability noise. It is pretty safe to do this change, because most of existing erlang files are written using ASCII subset of latin1 encoding, so are safe to read also as UTF-8. Regards, Witek -- Witold Baryluk JID: witold.baryluk // jabster.pl From desired.mta@REDACTED Thu Dec 29 11:19:26 2011 From: desired.mta@REDACTED (Motiejus =?utf-8?Q?Jak=C5=A1tys?=) Date: Thu, 29 Dec 2011 12:19:26 +0200 Subject: [erlang-questions] Kerl + Erlang Installation Management In-Reply-To: References: Message-ID: <20111229101926.GA4300@jakstys.lt> On Wed, Dec 28, 2011 at 10:15:19PM -0500, Ari King wrote: > Hi, > > Does anyone know if it's possible to use kerl > (https://github.com/spawngrid/kerl) to manage Erlang installation > requirements for products like RabbitMQ, CouchDB, etc.? I've been able > to use kerl to build and install various Erlang version, and I've been > able to compile code against these versions. However, when I tried to > install the aforementioned products, they were not able to find any of > the Erlang installations. Thanks. Have you tried activating your shell first? couchdb/ $ . /usr/local/erlangs/R14B4/activate couchdb/ $ ./configure Untested Motiejus From michael.santos@REDACTED Thu Dec 29 14:58:35 2011 From: michael.santos@REDACTED (Michael Santos) Date: Thu, 29 Dec 2011 08:58:35 -0500 Subject: [erlang-questions] base64:decode fails on facebook base64 encoded strings In-Reply-To: References: <2158D152-D690-4DC1-9E40-7C9D79A24D56@licenser.net> Message-ID: <20111229135835.GA26146@ecn.lan> On Thu, Dec 29, 2011 at 08:30:09AM +0400, Max Bourinov wrote: > So Erlangers, > > I wrote about this little bug in Facebook and I got an answer! > > >>I believe the trailing = is an optional padding in base64 your code needs > to accept base64 with and without trailing '=' characters. See last part of > http://email.about.com/cs/standards/a/base64_encoding.htm > > This is what they said. That is very interesting, I personally would not > omit data from protocol specification, but it appears that if it possible. > Anyway I didn't see anything about omitting here > http://tools.ietf.org/html/rfc1421 or http://tools.ietf.org/html/rfc2045 There is something about dropping the padding in RFC 4648: 5. Base 64 Encoding with URL and Filename Safe Alphabet The pad character "=" is typically percent-encoded when used in an URI [9], but if the data length is known implicitly, this can be avoided by skipping the padding; see section 3.2. > So, if you ever face such a loose implementation of base64 here is a > snippet that might help you to deal with it: > > -spec fb_decode_base64(Base64 :: list()) -> binary() | error. > fb_decode_base64(Base64) when is_list(Base64) -> > try base64:decode(Base64) > catch > error:_ -> % could be missing = > try base64:decode(Base64 ++ "=") > catch > error:_ -> % could be missing == > try base64:decode(Base64 ++ "==") > catch > error:_ -> % base64 is really wrong. we cannot fix it > error > end > end > > end. The length can be used to figure out the padding (not exactly the same as your code, throws an exception on bad data rather than returning an error): -module(tt). -export([fb_decode_base64/1]). fb_decode_base64(Base64) when is_list(Base64) -> decode(list_to_binary(Base64)). decode(Base64) when byte_size(Base64) rem 4 == 3 -> base64:decode(< > Hi, Garret. > > Thanks, didn't think about the problem this way. This is much easier > than making a rebar plugin :) > > Still, it clearly seems like a workaround too. > Generally, you have one core application and multiple dependencies in > a project, or at least so tells me my experience. These dependencies > may be either independent applications (gproc, gen_bunny or whatever) > or module libraries. (Of course, there are some exceptions of such a > scheme, modern Riak for example, but there aren't many of them) > And this is exactly why most of the open-source projects have the same > directory structure as I described in my first email. Putting source > code into another directory is not a big deal, of course, but it's > slightly less convenient and more confusing. > > We can force these projects to do "git mkdir && git mv && git commit" > (not a big deal, would take less than a minute), or even to do nothing > (how many people like and use OTP upgrades?). Or we can add to reltool > an ability to understand their projects structure, and structure of > future 1000 projects. > > On Tue, Dec 20, 2011 at 11:25 PM, Garret Smith > wrote: > > My rebar/reltool setup is doing close to what you describe as the "ideal" > > way. > > > > Relevant project structure is: > > > > apps/ > > app1 > > app2 > > > > deps/ > > > > > > rel/ > > reltool.config > > > > My rebar.config looks like: > > {lib_dirs, ["apps"]}. > > > > {sub_dirs, [ > > "apps/app1", > > "apps/app2", > > "rel"]}. > > > > {deps, [...]}. > > > > My reltool.config looks like (cut-n-pasted pieces here): > > > > {sys, [ > > {lib_dirs, ["../apps", "../deps"]}, > > {rel, "start", "1", > > [ > > app1, > > app2, > > dependent_app1, > > dependent_app1 > > ]}, > > {rel, "start_clean", "", > > [ > > kernel, > > stdlib > > ]}, > > {app, app1, [{incl_cond, include}]}, > > {app, app1, [{incl_cond, include}]}, > > {app, dependent_app1, [{incl_cond, include}]}, > > {app, dependent_app2, [{incl_cond, include}]} > > }. > > > > > > With this setup, rebar & reltool take the apps under apps/ and deps/ and > > creates a target release for me. > > > > Is this what you are looking for? > > > > -Garret > > > > On Tue, Dec 20, 2011 at 11:12 AM, Dmitry Demeshchuk < > demeshchuk@REDACTED> > > wrote: > >> > >> Hello, Siri and everyone. > >> > >> Recently I've been trying to start using OTP releases in our projects > >> with help of rebar. However, I faced the following problem. > >> > >> Rebar expects that *all* Erlang code resides in some directory > >> (generally, "deps" folder) or several directories. This is a reltool > >> strict requirement, as far as I understand. Unlike, Riak, all our > >> applications have the following directory structure: > >> > >> . > >> .. > >> deps/ > >> ebin/ > >> include/ > >> priv/ > >> src/ > >> > >> So, we pull some libraries (and sometimes smaller applications) as > >> deps, but the main application's code resides in the root application > >> folder. And there's no way to make reltool include this code into the > >> generated release, or at least I don't see it. > >> > >> For now, there are 2 ways for me to solve this without affecting reltool > >> itself: > >> > >> 1. For all apps, make another repository that just pulls our > >> application and all its deps, so the actual application code resides > >> in the deps/ dir as well, and generate the release package from it. > >> However, this seems like an overhead to me. Moreover, this isn't > >> convenient for development. > >> > >> 2. I made a hack that creates symlinks in the deps/ dir, so that it > >> seems to reltool that the core application actually resides in the > >> deps/ folder, so it's included into the release. Obviously, this is > >> kinda ugly and potentially buggy, forget total Windows > >> incompatibility. Initially, this was a pull request to rebar but after > >> some thinking me and one of rebar's maintainers agreed that it's > >> better to make this code a rebar plugin. > >> > >> So, as you can see, both of the solutions aren't perfect. The ideal > >> way I can see is an ability to set explicit app directories in > >> reltool.config, like: > >> > >> {explicit_app_dirs, ["/apps/myapp1"]}. > >> > >> Probably, it won't make any other use besides the problem I'm > >> describing here, but at least it's quite general and doesn't seem like > >> a hack. Maybe there's a better way that I didn't come up with. Or > >> maybe reltool can do what I want, and I just don't know about such an > >> ability. > >> > >> This seems like a very useful feature. I know that many people use > >> just the same directory structure in their projects. Also, rebar > >> maintainers already gave me their +1 to this. I'll be glad to work on > >> the patch if we come up with a good solution. > >> > >> Thank you. > >> > >> > >> -- > >> Best regards, > >> Dmitry Demeshchuk > >> _______________________________________________ > >> erlang-questions mailing list > >> erlang-questions@REDACTED > >> http://erlang.org/mailman/listinfo/erlang-questions > > > > > > > > -- > Best regards, > Dmitry Demeshchuk > -------------- next part -------------- An HTML attachment was scrubbed... URL: From bourinov@REDACTED Thu Dec 29 16:37:10 2011 From: bourinov@REDACTED (Max Bourinov) Date: Thu, 29 Dec 2011 19:37:10 +0400 Subject: [erlang-questions] base64:decode fails on facebook base64 encoded strings In-Reply-To: <20111229135835.GA26146@ecn.lan> References: <2158D152-D690-4DC1-9E40-7C9D79A24D56@licenser.net> <20111229135835.GA26146@ecn.lan> Message-ID: <-6391761140670093321@unknownmsgid> That is great! Thank you! Sent from my iPhone On 29.12.2011, at 17:55, Michael Santos wrote: > On Thu, Dec 29, 2011 at 08:30:09AM +0400, Max Bourinov wrote: >> So Erlangers, >> >> I wrote about this little bug in Facebook and I got an answer! >> >>>> I believe the trailing = is an optional padding in base64 your code needs >> to accept base64 with and without trailing '=' characters. See last part of >> http://email.about.com/cs/standards/a/base64_encoding.htm >> >> This is what they said. That is very interesting, I personally would not >> omit data from protocol specification, but it appears that if it possible. >> Anyway I didn't see anything about omitting here >> http://tools.ietf.org/html/rfc1421 or http://tools.ietf.org/html/rfc2045 > > There is something about dropping the padding in RFC 4648: > > 5. Base 64 Encoding with URL and Filename Safe Alphabet > > The pad character "=" is typically percent-encoded when used in an URI > [9], but if the data length is known implicitly, this can be avoided by > skipping the padding; see section 3.2. > >> So, if you ever face such a loose implementation of base64 here is a >> snippet that might help you to deal with it: >> >> -spec fb_decode_base64(Base64 :: list()) -> binary() | error. >> fb_decode_base64(Base64) when is_list(Base64) -> >> try base64:decode(Base64) >> catch >> error:_ -> % could be missing = >> try base64:decode(Base64 ++ "=") >> catch >> error:_ -> % could be missing == >> try base64:decode(Base64 ++ "==") >> catch >> error:_ -> % base64 is really wrong. we cannot fix it >> error >> end >> end >> >> end. > > The length can be used to figure out the padding (not exactly the same > as your code, throws an exception on bad data rather than returning > an error): > > -module(tt). > -export([fb_decode_base64/1]). > > fb_decode_base64(Base64) when is_list(Base64) -> > decode(list_to_binary(Base64)). > > decode(Base64) when byte_size(Base64) rem 4 == 3 -> > base64:decode(<: > Hi all! > > I am trying to implement FSM of a protocol inside gen_fsm behavior. For > a keepalive purpose I need a timer that would produce event when timer > is expired so I could know when to send a keepalive packet and to know > when holdtime is gone (I didn;t receive keepalive packet from other > side). I was trying to get more info on gen_fsm:start_timer but > documentation is a bit sparse - it's clear how to create timer but not > how to catch it's event (well, at least to me since this is first time I > am using gen_fsm). > > If someone could explain this in few sentences I would be very grateful. > Also if there is a better way for keepalive mechanism inside gen_fsm, I > would like to know it. > > Thanks and regards, > Ivan Ostres > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions From michael.santos@REDACTED Thu Dec 29 19:35:25 2011 From: michael.santos@REDACTED (Michael Santos) Date: Thu, 29 Dec 2011 13:35:25 -0500 Subject: [erlang-questions] gen_fsm and keepalive timer In-Reply-To: References: Message-ID: <20111229183525.GA27078@ecn.lan> On Thu, Dec 29, 2011 at 06:51:44PM +0100, Ivan Ostres wrote: > Hi all! > > I am trying to implement FSM of a protocol inside gen_fsm behavior. > For a keepalive purpose I need a timer that would produce event when > timer is expired so I could know when to send a keepalive packet and > to know when holdtime is gone (I didn;t receive keepalive packet > from other side). I was trying to get more info on > gen_fsm:start_timer but documentation is a bit sparse - it's clear > how to create timer but not how to catch it's event (well, at least > to me since this is first time I am using gen_fsm). > > If someone could explain this in few sentences I would be very > grateful. Also if there is a better way for keepalive mechanism > inside gen_fsm, I would like to know it. > > Thanks and regards, > Ivan Ostres Using the optional timeout in gen_fsm states might be simpler to use: -record(state, { timeout = 1000 }). my_state(Data, #state{timeout = Timeout} = State) -> handle_protocol(Data), {next_state, my_state, State, Timeout}; my_state(timeout, #state{timeout = Timeout} = State) -> keepalive(), {next_state, my_state, State, Timeout}. From steven.charles.davis@REDACTED Fri Dec 30 01:25:14 2011 From: steven.charles.davis@REDACTED (Steve Davis) Date: Thu, 29 Dec 2011 16:25:14 -0800 (PST) Subject: [erlang-questions] towards a unified dict api In-Reply-To: <4EFCA4F2.9070809@gmail.com> References: <4EF4FBFC.5060307@gmail.com> <20111229093859.GB15295@smp.if.uj.edu.pl> <4EFCA4F2.9070809@gmail.com> Message-ID: <648319a9-1515-4500-ad6d-09d71415453c@l19g2000yqc.googlegroups.com> Once, I would have strongly agreed with you. Now, I am not so sure that this tenet is true for many cases. Specifically what guides this change of heart for me is the painful progress in RPC/CORBA/JRMI abstractions over the years. I suspect that it also applies to data/ state sources. My 2c. /s On Dec 29, 11:35?am, Richard Carlsson wrote: > ...but you shouldn't have to know anything about the implementation. From mapandfold@REDACTED Fri Dec 30 03:47:42 2011 From: mapandfold@REDACTED (Justus) Date: Fri, 30 Dec 2011 10:47:42 +0800 Subject: [erlang-questions] source file encoding In-Reply-To: <20111229101517.GC15295@smp.if.uj.edu.pl> References: <4EF078C1.9090105@gmail.com> <20111229080818.GA15295@smp.if.uj.edu.pl> <20111229101517.GC15295@smp.if.uj.edu.pl> Message-ID: IMHO, encoding is an inner property of a file. Ideally, a reader detects the encoding properly. But in practice, it's better to give the reader some hints, either inside or outside of the file. I prefer the inside one, because the source file is then perfectly self-described. The OUTSIDE way also has the following problem that you already know: "All included files will be read and parsed using same encoding Encoding, which may produce unexpected results, if they are in fact encoded using different encodings." On Thu, Dec 29, 2011 at 6:15 PM, Witold Baryluk wrote: > > I belive this is bad solution. ENcoding should be defined OUTSIDE of the > file itself, because if not it creates chicken-egg proble, how to open > and read file if it is not yet know its encoding? Same problem is is HTML, > when charset can be defined in head section. It is much better to just > define it in HTTP header using charset= property of Content-Type. > It is also much faster (doesn't need any buffering, and other tricks). > > It may work in case of UTF-8, because it should be relativly safe > to work on ASCII files as UTF-8 files, and then switch to UTF-8 > after such declaration. > > A charset should be defined outside, manually, or using some form of > file-system metadata (extended atributes), or using BOM marker. > > http://en.wikipedia.org/wiki/Byte_order_mark > > My solution is just SINGLE line of change in epp.erl: around line 252 > > server(Pid, Name, Path, Pdm, Encoding0) -> > ? ? process_flag(trap_exit, true), > - ? ?case file:open(Name, [read]) of > + ? ?case file:open(Name, [read, {encoding, utf8}]) of > > > Rest of patch is actually configurability noise. It is pretty safe > to do this change, because most of existing erlang files are written using > ASCII subset of latin1 encoding, so are safe to read also as UTF-8. > > > Regards, > Witek > > -- > Witold Baryluk > JID: witold.baryluk // jabster.pl -- Best Regards, Justus From kenji.rikitake@REDACTED Fri Dec 30 07:10:55 2011 From: kenji.rikitake@REDACTED (Kenji Rikitake) Date: Fri, 30 Dec 2011 15:10:55 +0900 Subject: [erlang-questions] FreeBSD port for Erlang R15B Message-ID: <20111230061055.GA27099@k2r.org> My unofficial port of R15B for FreeBSD is available: As a patch: http://www.freebsd.org/cgi/query-pr.cgi?pr=163711 As an Evernote article with tar.gz file: https://evernote.com/pub/jj1bdx/erlang-shared#b=b10325fc-cb12-4532-bc13-c9f383f4ed49&n=22a7c8f0-420e-4102-a136-c2093296ea78 I'm sure Jimmy Olgeni (the port maintainer) will take a look at this soon. Briefly tested on 9.0-PRERELEASE amd64 and 8.2-RELEASE on i386. Kenji Rikitake From dmitriid@REDACTED Fri Dec 30 10:47:10 2011 From: dmitriid@REDACTED (Dmitrii Dimandt) Date: Fri, 30 Dec 2011 10:47:10 +0100 Subject: [erlang-questions] Efficient Denial of Service Attacks on Web Application Platforms and it's effects in Erlang? Message-ID: Hi all. Efficient Denial of Service Attacks on Web Application Platforms: http://events.ccc.de/congress/2011/Fahrplan/attachments/2007_28C3_Effective_DoS_on_web_application_platforms.pdf Tl;dr: It's not strictly platforms that are targeted, it's languages (!) Most of the time web forms are processed and stored in hash tables. It is quite easy to craft a request with hash table collisions. PHP, Java, C# (ASP.NET), Python, Ruby ? all are vulnerable. PHP: 1 Gbit/s attack will keep ~10.000 i7 cores busy Python: 1 Gbit/s attack will keep ~5?104 Core Duo cores busy etc. The link above contains technical details I wonder if Erlang-based web platforms/servers etc. are affected and if they are affected? Specifically, I'm worried about - Yaws - Mochiweb - Webmachine - Misultin - Cowboy :) -------------- next part -------------- An HTML attachment was scrubbed... URL: From mapandfold@REDACTED Fri Dec 30 11:10:28 2011 From: mapandfold@REDACTED (Justus) Date: Fri, 30 Dec 2011 18:10:28 +0800 Subject: [erlang-questions] Efficient Denial of Service Attacks on Web Application Platforms and it's effects in Erlang? In-Reply-To: References: Message-ID: I did a quick check on Yaws and Mochiweb, they both use list but not dict to store form values, so such attack won't work here. On Fri, Dec 30, 2011 at 5:47 PM, Dmitrii Dimandt wrote: > Hi all. > > Efficient Denial of Service Attacks on Web Application Platforms: > http://events.ccc.de/congress/2011/Fahrplan/attachments/2007_28C3_Effective_DoS_on_web_application_platforms.pdf > > Tl;dr: > > It's not strictly platforms that are targeted, it's languages (!) > Most of the time web forms are processed and stored in hash tables. > It is quite easy to craft a request with hash table collisions. > > PHP, Java, C# (ASP.NET), Python, Ruby ? all are vulnerable. > > PHP: 1 Gbit/s attack will keep ~10.000 i7 cores busy > Python: 1 Gbit/s attack will keep ~5?104 Core Duo cores busy > > etc. > > The link above contains technical details > > > I wonder if Erlang-based web platforms/servers etc. are affected and if they > are affected? > > Specifically, I'm worried about > > - Yaws > - Mochiweb > - Webmachine > - Misultin > - Cowboy > > :) > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > -- Best Regards, Justus From carlsson.richard@REDACTED Fri Dec 30 11:26:45 2011 From: carlsson.richard@REDACTED (Richard Carlsson) Date: Fri, 30 Dec 2011 11:26:45 +0100 Subject: [erlang-questions] towards a unified dict api In-Reply-To: <648319a9-1515-4500-ad6d-09d71415453c@l19g2000yqc.googlegroups.com> References: <4EF4FBFC.5060307@gmail.com> <20111229093859.GB15295@smp.if.uj.edu.pl> <4EFCA4F2.9070809@gmail.com> <648319a9-1515-4500-ad6d-09d71415453c@l19g2000yqc.googlegroups.com> Message-ID: <4EFD91E5.3010203@gmail.com> On 2011-12-30 01:25, Steve Davis wrote: > On Dec 29, 11:35 am, Richard Carlsson > wrote: >> ...but you shouldn't have to know anything about the implementation. > > Once, I would have strongly agreed with you. Now, I am not so sure > that this tenet is true for many cases. Specifically what guides this > change of heart for me is the painful progress in RPC/CORBA/JRMI > abstractions over the years. I suspect that it also applies to data/ > state sources. > > My 2c. > /s And I basically agree, which is why I'm not aiming for an object oriented approach. But I think that letting the dict module have an ordered version, just like ets tables, is a good idea. You still get to choose between O(n) time for an unordered table and O(log n) time for an ordered table when you initialize the dict, and from a usability perspective it means that for most cases where you want a functional dictionary data type, the dict module is all you need to know. I couldn't get a good unified dict API until I decided to remove the gb_trees module from the equation by making it accessible via dict instead, because its current API is too different from the existing dict/orddict API and the name clashes got too difficult to resolve. I could of course also invent a new name for gb_trees, but that seems unnecessary. /Richard From essen@REDACTED Fri Dec 30 11:49:47 2011 From: essen@REDACTED (=?windows-1252?Q?Lo=EFc_Hoguin?=) Date: Fri, 30 Dec 2011 11:49:47 +0100 Subject: [erlang-questions] Efficient Denial of Service Attacks on Web Application Platforms and it's effects in Erlang? In-Reply-To: References: Message-ID: <4EFD974B.3010701@dev-extend.eu> Cowboy uses proplists for this. On 12/30/2011 10:47 AM, Dmitrii Dimandt wrote: > Hi all. > > Efficient Denial of Service Attacks on Web Application Platforms: > http://events.ccc.de/congress/2011/Fahrplan/attachments/2007_28C3_Effective_DoS_on_web_application_platforms.pdf > > Tl;dr: > > It's not strictly platforms that are targeted, it's languages (!) > Most of the time web forms are processed and stored in hash tables. > It is quite easy to craft a request with hash table collisions. > > PHP, Java, C# (ASP.NET ), Python, Ruby ? all are vulnerable. > > PHP: 1 Gbit/s attack will keep ~10.000 i7 cores busy > Python: 1 Gbit/s attack will keep ~5?104 Core Duo cores busy > > etc. > > The link above contains technical details > > > I wonder if Erlang-based web platforms/servers etc. are affected and if > they are affected? > > Specifically, I'm worried about > > - Yaws > - Mochiweb > - Webmachine > - Misultin > - Cowboy -- Lo?c Hoguin Dev:Extend From marc@REDACTED Fri Dec 30 12:25:38 2011 From: marc@REDACTED (Marc Worrell) Date: Fri, 30 Dec 2011 12:25:38 +0100 Subject: [erlang-questions] Efficient Denial of Service Attacks on Web Application Platforms and it's effects in Erlang? In-Reply-To: <4EFD974B.3010701@dev-extend.eu> References: <4EFD974B.3010701@dev-extend.eu> Message-ID: <1579818C-6EC7-4C07-8951-A74B6F488A20@worrell.nl> Zotonic uses lists as well. -Marc Sent from my iPhone On 30 dec. 2011, at 11:49, Lo?c Hoguin wrote: > Cowboy uses proplists for this. > > On 12/30/2011 10:47 AM, Dmitrii Dimandt wrote: >> Hi all. >> >> Efficient Denial of Service Attacks on Web Application Platforms: >> http://events.ccc.de/congress/2011/Fahrplan/attachments/2007_28C3_Effective_DoS_on_web_application_platforms.pdf >> >> Tl;dr: >> >> It's not strictly platforms that are targeted, it's languages (!) >> Most of the time web forms are processed and stored in hash tables. >> It is quite easy to craft a request with hash table collisions. >> >> PHP, Java, C# (ASP.NET ), Python, Ruby ? all are vulnerable. >> >> PHP: 1 Gbit/s attack will keep ~10.000 i7 cores busy >> Python: 1 Gbit/s attack will keep ~5?104 Core Duo cores busy >> >> etc. >> >> The link above contains technical details >> >> >> I wonder if Erlang-based web platforms/servers etc. are affected and if >> they are affected? >> >> Specifically, I'm worried about >> >> - Yaws >> - Mochiweb >> - Webmachine >> - Misultin >> - Cowboy > > > -- > Lo?c Hoguin > Dev:Extend > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions From gleber.p@REDACTED Fri Dec 30 13:45:03 2011 From: gleber.p@REDACTED (Gleb Peregud) Date: Fri, 30 Dec 2011 13:45:03 +0100 Subject: [erlang-questions] Is on_load official? Message-ID: Hello OTP team Is on_load official and can be considered stable? In "Compilation and Code loading"[1] it is said (last sentence is the most interesting part): ======================================================= Warning This section describes an experimental feature that was introduced in R13B03, and changed in a backwards-incompatible way in R13B04. *There may be more backward-incompatible changes in future releases*. ======================================================= but in "man erl_nif" it is said that "The NIF concept is officially supported from R14B"[2] I think those two statements are a bit conflicting, since on_load is a standard method of loading NIF implementation libraries. Comments? Thanks! Gleb Peregud 1: http://www.erlang.org/doc/reference_manual/code_loading.html 2: http://www.erlang.org/doc/man/erl_nif.html From jesper.louis.andersen@REDACTED Fri Dec 30 14:04:13 2011 From: jesper.louis.andersen@REDACTED (Jesper Louis Andersen) Date: Fri, 30 Dec 2011 14:04:13 +0100 Subject: [erlang-questions] Efficient Denial of Service Attacks on Web Application Platforms and it's effects in Erlang? In-Reply-To: References: Message-ID: <4EFDB6CD.7000302@erlang-solutions.com> On 12/30/11 10:47 AM, Dmitrii Dimandt wrote: > > Specifically, I'm worried about > > - Yaws > - Mochiweb > - Webmachine > - Misultin > - Cowboy > The most worrisome place in Erlang is if you are using ETS in a mode where the underlying runtime uses a Hash, i.e, set or bag semantics. The ordered semantics use a tree and are thus not vulnerable - and the hash may not be either, but I don't know the details of that. There is a reason Dan J. Bernstein went for using critbit/radix/patricia trees in most of his software due to this. It is kind of a timing attack in a similar form. What you should be worried about is this: A user can control an input which ends up being a key in a hash table. If this is true, then the table may be a problem if the user can craft collisions. The simplest solution is probably to lace the key with some "salt" or build up the hash so it is a family and change it such that an enemy attacker doesn't know what values to use in order to create collisions. Or you can chose a hash table structure without the problem in the first place. But the quick Erlang fix is to use an ordered ETS table where applicable. Problem solved. -- Jesper Louis Andersen Erlang Solutions Ltd., Copenhagen, DK From ulf@REDACTED Fri Dec 30 15:02:48 2011 From: ulf@REDACTED (Ulf Wiger) Date: Fri, 30 Dec 2011 15:02:48 +0100 Subject: [erlang-questions] Efficient Denial of Service Attacks on Web Application Platforms and it's effects in Erlang? In-Reply-To: <4EFDB6CD.7000302@erlang-solutions.com> References: <4EFDB6CD.7000302@erlang-solutions.com> Message-ID: On 30 Dec 2011, at 14:04, Jesper Louis Andersen wrote: > The most worrisome place in Erlang is if you are using ETS in a mode where the underlying runtime uses a Hash, i.e, set or bag semantics. The ordered semantics use a tree and are thus not vulnerable - and the hash may not be either, but I don't know the details of that. There is a reason Dan J. Bernstein went for using critbit/radix/patricia trees in most of his software due to this. It is kind of a timing attack in a similar form. Yes, ordered_set tables are nice, but as far as I can tell, the erlang:phash2/2 function gives a very even spread for strings. I did run some experiments, generating all possible strings of length 3, 4, 5, and counting the hash collisions for a given hash range, and the spread was very even. With a limited alphabet, I generated strings up to length 9, with similar results. Of course, trying a large number of lengths and hash ranges takes more time than I am willing to spend on this. Also, ets tables use linear hashing. If the hash function doesn't manage to redistribute values after a resize, it would be problematic, but the hash function was redesigned exactly for this purpose, after Mats Cronquist had encountered a situation, many years ago, where tens of thousand keys ended up in the same bucket. Here is the program I used: -module(hsh). -export([run/2]). run(L, R) -> lists:sort(dict:to_list(run_(L, [], dict:new(), R))). cs() -> "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ". run_(1, S, D0, R) -> lists:foldl(fun(C, D) -> log(S ++ [C], D, R) end, D0, cs()); run_(L, S, D0, R) when L > 1 -> lists:foldl(fun(C, D) -> run_(L-1, S++[C], D, R) end, D0, cs()). log(S, D, R) -> dict:update_counter(erlang:phash2(S, R), 1, D). BR, Ulf W From ericbmerritt@REDACTED Fri Dec 30 16:56:05 2011 From: ericbmerritt@REDACTED (Eric B Merritt) Date: Fri, 30 Dec 2011 10:56:05 -0500 Subject: [erlang-questions] Is on_load official? In-Reply-To: References: Message-ID: <1325260565.1969.23.camel@localhost.localdomain> On Fri, 2011-12-30 at 13:45 +0100, Gleb Peregud wrote: > Hello OTP team > > Is on_load official and can be considered stable? In "Compilation and > Code loading"[1] it is said (last sentence is the most interesting > part): > > ======================================================= > Warning > > This section describes an experimental feature that > was introduced in R13B03, and changed in a > backwards-incompatible way in R13B04. *There may be more > backward-incompatible changes in future releases*. > ======================================================= > > but in "man erl_nif" it is said that "The NIF concept is officially > supported from R14B"[2] > > I think those two statements are a bit conflicting, since on_load is a > standard method of loading NIF implementation libraries. Not really. They where unstable in the R13 series but where considered stable in the R14 series. That seems pretty strait forward. > > Comments? > > Thanks! > Gleb Peregud > > 1: http://www.erlang.org/doc/reference_manual/code_loading.html > 2: http://www.erlang.org/doc/man/erl_nif.html > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions From gleber.p@REDACTED Fri Dec 30 16:58:50 2011 From: gleber.p@REDACTED (Gleb Peregud) Date: Fri, 30 Dec 2011 16:58:50 +0100 Subject: [erlang-questions] Is on_load official? In-Reply-To: <1325260565.1969.23.camel@localhost.localdomain> References: <1325260565.1969.23.camel@localhost.localdomain> Message-ID: On Fri, Dec 30, 2011 at 16:56, Eric B Merritt wrote: >> *There may be more backward-incompatible changes in future releases*. I think you missed the last sentence of the warning :) It seems like this sentence was not removed when R14B has been released, although it should have been removed. From roberto@REDACTED Fri Dec 30 18:25:53 2011 From: roberto@REDACTED (Roberto Ostinelli) Date: Fri, 30 Dec 2011 09:25:53 -0800 Subject: [erlang-questions] Efficient Denial of Service Attacks on Web Application Platforms and it's effects in Erlang? In-Reply-To: References: Message-ID: proplists on misultin too. Specifically, I'm worried about > > - Yaws > - Mochiweb > - Webmachine > - Misultin > - Cowboy > > :) > -------------- next part -------------- An HTML attachment was scrubbed... URL: From roberto@REDACTED Fri Dec 30 18:32:43 2011 From: roberto@REDACTED (Roberto Ostinelli) Date: Fri, 30 Dec 2011 09:32:43 -0800 Subject: [erlang-questions] gen_tcp:recv/3 timeout In-Reply-To: References: Message-ID: thank you klaar, though there's something I don't like in the proposed solution: what if you receive more than the intended original N bytes? there's the (un)famous undocumented option gen_tcp:unrecv but i'd rather not use it, plus there isn't an SSL equivalent for it. storing the additional received bytes for later usage seems cumbersome, and sometimes even unfeasible when considering that I'm often switching the packet type and the active options of inet. i was thinking to wrap the gen_tcp:recv/3 function around something that re-calls it if it timeouts, but unfortunately when it does the returned error {error, timeout} does *not* contain the bytes received up to that point, which then get lost. ..anyone? On Tue, Dec 27, 2011 at 7:52 AM, Magnus Klaar wrote: > Hi! > > gen_tcp:recv(..., N, M) returns {error, timeout} if N bytes has not been > received after M milliseconds. If less bytes are available the call will > _not_ succeed. If you are receiving data at a slow rate specifying 0 as the > length is preferrable because the call will return whatever data is > available at the time. If there is no data available it will wait and > timeout if no data has been received after M milliseconds. If you don't > want to timeout at all when doing this, specify infinity as the timout > value. > > MVH Magnus > > On Tue, Dec 27, 2011 at 2:10 AM, Roberto Ostinelli wrote: > >> dear list, >> >> when calling gen_tcp:recv/3 by specifying a length and a timeout, when >> will {error, timeout} be a response? Is it: >> >> 1. when no bytes are received for a period longer than the specified >> Timeout >> 2. when the number of bytes specified in Length is not received within >> Timeout >> >> if 2, what is the best solution to actually *not* have a recv/3 timeout >> while receiving bytes at a very low pace (for instance on very slow >> connections)? >> >> thank you, >> >> r. >> > -------------- next part -------------- An HTML attachment was scrubbed... URL: From ericbmerritt@REDACTED Fri Dec 30 18:33:02 2011 From: ericbmerritt@REDACTED (Eric B Merritt) Date: Fri, 30 Dec 2011 12:33:02 -0500 Subject: [erlang-questions] Line Numbers in annotations in core erlang as they relate to stack traces Message-ID: <1325266382.1969.35.camel@localhost.localdomain> Guys, There seems to be a bug in R15B core erlang where line numbers specified in annotations are not available in stack traces. As always this could be a misunderstanding on my part. However, given a core erlang form of cerl:ann_c_apply([10], ...) and an exception occurs at that location the line numbers seem not to be available to what ever creates the stack trace. I have to assume that I am missing something here. If erlang is actually transformed to core erlang before being compiled to beam it doesn't make sense that this would be over looked. As always any insight is welcome. Thanks, Eric From bourinov@REDACTED Fri Dec 30 19:29:14 2011 From: bourinov@REDACTED (Max Bourinov) Date: Fri, 30 Dec 2011 22:29:14 +0400 Subject: [erlang-questions] Erlang program and bash/Munin communication Message-ID: Hi Dear Erlangers! I want to plot some stats from my Erlang program in munin ( http://munin-monitoring.org/). For that I have to call it somehow from bash/sh script. Standart munin setup calls the script every 5 minutes. So, I want to know, what is a best way to establish one way (Erlang -> Bash) communication? One of approaches could be when Erlang program writes file to somewhere like /var/run/erl-prog and bash script reads it. Is there are any other simpler options available? p.s. I know that ejabberd has some interface to bash, but its code too complex to my task. Best regards, Max -------------- next part -------------- An HTML attachment was scrubbed... URL: From mattevans123@REDACTED Fri Dec 30 20:00:47 2011 From: mattevans123@REDACTED (Matthew Evans) Date: Fri, 30 Dec 2011 14:00:47 -0500 Subject: [erlang-questions] Erlang program and bash/Munin communication In-Reply-To: References: Message-ID: You could try erl_call http://www.erlang.org/doc/man/erl_call.html Or escript called from bash. http://www.erlang.org/doc/man/escript.html erl_call is normally hidden in the Erlang release somewhere, not in the default path. From: bourinov@REDACTED Date: Fri, 30 Dec 2011 22:29:14 +0400 To: erlang-questions@REDACTED Subject: [erlang-questions] Erlang program and bash/Munin communication Hi Dear Erlangers! I want to plot some stats from my Erlang program in munin (http://munin-monitoring.org/). For that I have to call it somehow from bash/sh script. Standart munin setup calls the script every 5 minutes. So, I want to know, what is a best way to establish one way (Erlang -> Bash) communication? One of approaches could be when Erlang program writes file to somewhere like /var/run/erl-prog and bash script reads it. Is there are any other simpler options available? p.s. I know that ejabberd has some interface to bash, but its code too complex to my task.Best regards, Max _______________________________________________ erlang-questions mailing list erlang-questions@REDACTED http://erlang.org/mailman/listinfo/erlang-questions -------------- next part -------------- An HTML attachment was scrubbed... URL: From bourinov@REDACTED Fri Dec 30 20:17:38 2011 From: bourinov@REDACTED (Max Bourinov) Date: Fri, 30 Dec 2011 23:17:38 +0400 Subject: [erlang-questions] Erlang program and bash/Munin communication In-Reply-To: References: Message-ID: Hi Matthew, erl_call seems more convenient to me. Thank you! Will give it a try. Best regards, Max On Fri, Dec 30, 2011 at 11:00 PM, Matthew Evans wrote: > You could try erl_call > > http://www.erlang.org/doc/man/erl_call.html > > Or escript called from bash. > > http://www.erlang.org/doc/man/escript.html > > erl_call is normally hidden in the Erlang release somewhere, not in the > default path. > > ------------------------------ > From: bourinov@REDACTED > Date: Fri, 30 Dec 2011 22:29:14 +0400 > To: erlang-questions@REDACTED > Subject: [erlang-questions] Erlang program and bash/Munin communication > > > Hi Dear Erlangers! > > I want to plot some stats from my Erlang program in munin ( > http://munin-monitoring.org/). For that I have to call it somehow from > bash/sh script. Standart munin setup calls the script every 5 minutes. > > So, I want to know, what is a best way to establish one way (Erlang -> > Bash) communication? > > One of approaches could be when Erlang program writes file to somewhere > like /var/run/erl-prog and bash script reads it. > > Is there are any other simpler options available? > > p.s. I know that ejabberd has some interface to bash, but its code too > complex to my task. > > Best regards, > Max > > > > _______________________________________________ erlang-questions mailing > list erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From spawn.think@REDACTED Fri Dec 30 20:45:16 2011 From: spawn.think@REDACTED (Ahmed Omar) Date: Fri, 30 Dec 2011 20:45:16 +0100 Subject: [erlang-questions] gen_tcp:recv/3 timeout In-Reply-To: References: Message-ID: AFAIK, data doesn't get lost except if the socket is closed from the other side. On Fri, Dec 30, 2011 at 6:32 PM, Roberto Ostinelli wrote: > thank you klaar, > > though there's something I don't like in the proposed solution: what if > you receive more than the intended original N bytes? there's the (un)famous > undocumented option gen_tcp:unrecv but i'd rather not use it, plus there > isn't an SSL equivalent for it. > > storing the additional received bytes for later usage seems cumbersome, > and sometimes even unfeasible when considering that I'm often switching the > packet type and the active options of inet. > > i was thinking to wrap the gen_tcp:recv/3 function around something that > re-calls it if it timeouts, but unfortunately when it does the returned > error {error, timeout} does *not* contain the bytes received up to that > point, which then get lost. > > ..anyone? > > > On Tue, Dec 27, 2011 at 7:52 AM, Magnus Klaar wrote: > >> Hi! >> >> gen_tcp:recv(..., N, M) returns {error, timeout} if N bytes has not been >> received after M milliseconds. If less bytes are available the call will >> _not_ succeed. If you are receiving data at a slow rate specifying 0 as the >> length is preferrable because the call will return whatever data is >> available at the time. If there is no data available it will wait and >> timeout if no data has been received after M milliseconds. If you don't >> want to timeout at all when doing this, specify infinity as the timout >> value. >> >> MVH Magnus >> >> On Tue, Dec 27, 2011 at 2:10 AM, Roberto Ostinelli wrote: >> >>> dear list, >>> >>> when calling gen_tcp:recv/3 by specifying a length and a timeout, when >>> will {error, timeout} be a response? Is it: >>> >>> 1. when no bytes are received for a period longer than the specified >>> Timeout >>> 2. when the number of bytes specified in Length is not received within >>> Timeout >>> >>> if 2, what is the best solution to actually *not* have a recv/3 timeout >>> while receiving bytes at a very low pace (for instance on very slow >>> connections)? >>> >>> thank you, >>> >>> r. >>> >> > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > > -- Best Regards, - Ahmed Omar http://nl.linkedin.com/in/adiaa Follow me on twitter @spawn_think -------------- next part -------------- An HTML attachment was scrubbed... URL: From roberto.ostinelli@REDACTED Fri Dec 30 21:39:00 2011 From: roberto.ostinelli@REDACTED (Roberto Ostinelli) Date: Fri, 30 Dec 2011 12:39:00 -0800 Subject: [erlang-questions] gen_tcp:recv/3 timeout In-Reply-To: References: Message-ID: <89D398DE-8E0A-4DD7-B2F3-BBEDEAE9F0B6@widetag.com> ok, but how do you retrieve it? does it get stashed back again on the tcp stack? On 30/dic/2011, at 11:45, Ahmed Omar wrote: > AFAIK, data doesn't get lost except if the socket is closed from the other side. From max.lapshin@REDACTED Fri Dec 30 22:41:39 2011 From: max.lapshin@REDACTED (Max Lapshin) Date: Sat, 31 Dec 2011 00:41:39 +0300 Subject: [erlang-questions] Erlang on Freescale i.MX53 (Cortex A8, ARM): works excelently Message-ID: $ erl Erlang R15B (erts-5.9) [source] [async-threads:0] [kernel-poll:false] Eshell V5.9 (abort with ^G) 1> os:cmd("uname -a"). "Linux lucid-desktop 2.6.35.3-744-g27fdf7b #1 PREEMPT Thu Jan 27 15:10:16 CST 2011 armv7l GNU/Linux\n" Erlyvideo is compiled with all NIFs and launched on small CPU: http://www.freescale.com/webapp/sps/site/prod_summary.jsp?code=IMX53QSB Can serve about 80 Mbit/s from such "computer". I wanted to use it as a hardware capture+encoder to make video camera with H.264 output, but was very, very disappointed by quality of produced video. But it is not about erlang =) But erlang works there excelently. Thanks! From spawn.think@REDACTED Sat Dec 31 00:32:54 2011 From: spawn.think@REDACTED (Ahmed Omar) Date: Sat, 31 Dec 2011 00:32:54 +0100 Subject: [erlang-questions] gen_tcp:recv/3 timeout In-Reply-To: <89D398DE-8E0A-4DD7-B2F3-BBEDEAE9F0B6@widetag.com> References: <89D398DE-8E0A-4DD7-B2F3-BBEDEAE9F0B6@widetag.com> Message-ID: after u got {error, timeout}, if you do gen_tcp:recv(Sock, 0, T), u will get the data, as the data was not consumed/sent from the port driver yet. (as long as socket was not closed) On Fri, Dec 30, 2011 at 9:39 PM, Roberto Ostinelli < roberto.ostinelli@REDACTED> wrote: > ok, but how do you retrieve it? does it get stashed back again on the tcp > stack? > > > > On 30/dic/2011, at 11:45, Ahmed Omar wrote: > > > AFAIK, data doesn't get lost except if the socket is closed from the > other side. > -- Best Regards, - Ahmed Omar http://nl.linkedin.com/in/adiaa Follow me on twitter @spawn_think -------------- next part -------------- An HTML attachment was scrubbed... URL: From g@REDACTED Sat Dec 31 00:40:59 2011 From: g@REDACTED (Garrett Smith) Date: Fri, 30 Dec 2011 17:40:59 -0600 Subject: [erlang-questions] Erlang on Freescale i.MX53 (Cortex A8, ARM): works excelently In-Reply-To: References: Message-ID: On Fri, Dec 30, 2011 at 3:41 PM, Max Lapshin wrote: > $ erl > Erlang R15B (erts-5.9) [source] [async-threads:0] [kernel-poll:false] > > Eshell V5.9 ?(abort with ^G) > 1> os:cmd("uname -a"). > "Linux lucid-desktop 2.6.35.3-744-g27fdf7b #1 PREEMPT Thu Jan 27 > 15:10:16 CST 2011 armv7l GNU/Linux\n" > > > > Erlyvideo is compiled with all NIFs and launched on small CPU: > http://www.freescale.com/webapp/sps/site/prod_summary.jsp?code=IMX53QSB Wow - $150 board with Erlang! I'm tempted to pick one up to play around. Very cool Max! From zabrane3@REDACTED Sat Dec 31 08:48:08 2011 From: zabrane3@REDACTED (Zabrane Mickael) Date: Sat, 31 Dec 2011 08:48:08 +0100 Subject: [erlang-questions] Release handling + Heart = headache Message-ID: <9A9E762A-0448-4657-A084-D1332BA21ED8@gmail.com> Hi guys, I've successfully generated a release for a simple project and now, I'm interested to use "-heart" option for monitoring. When running the project in dev mode with heart, the HEART_COMMAND is taken into account and my program restart as expected (in case of crash, unresponsive VM ...). But the same program is never restarted under release mode. The doc say the HEART_COMMAND is ignored under release mode, and advices to set the start_prg envirnoment variable for SASL. I tried this somewhere in my code without success: application:set_env(sasl, start_prg, HEART_COMMAND), I'm feeling a bit lost? Advices/Hints please? Regards, Zabrane -------------- next part -------------- An HTML attachment was scrubbed... URL: From bourinov@REDACTED Sat Dec 31 10:57:33 2011 From: bourinov@REDACTED (Max Bourinov) Date: Sat, 31 Dec 2011 13:57:33 +0400 Subject: [erlang-questions] Erlang program and bash/Munin communication In-Reply-To: References: Message-ID: If somebody is interested where is erl_call from R15B on OSX, check out this path: /usr/local/lib/erlang/lib/erl_interface-3.7.6/bin/erl_call Best regards, Max On Fri, Dec 30, 2011 at 11:17 PM, Max Bourinov wrote: > Hi Matthew, > > erl_call seems more convenient to me. > > Thank you! Will give it a try. > > Best regards, > Max > > > > > On Fri, Dec 30, 2011 at 11:00 PM, Matthew Evans wrote: > >> You could try erl_call >> >> http://www.erlang.org/doc/man/erl_call.html >> >> Or escript called from bash. >> >> http://www.erlang.org/doc/man/escript.html >> >> erl_call is normally hidden in the Erlang release somewhere, not in the >> default path. >> >> ------------------------------ >> From: bourinov@REDACTED >> Date: Fri, 30 Dec 2011 22:29:14 +0400 >> To: erlang-questions@REDACTED >> Subject: [erlang-questions] Erlang program and bash/Munin communication >> >> >> Hi Dear Erlangers! >> >> I want to plot some stats from my Erlang program in munin ( >> http://munin-monitoring.org/). For that I have to call it somehow from >> bash/sh script. Standart munin setup calls the script every 5 minutes. >> >> So, I want to know, what is a best way to establish one way (Erlang -> >> Bash) communication? >> >> One of approaches could be when Erlang program writes file to somewhere >> like /var/run/erl-prog and bash script reads it. >> >> Is there are any other simpler options available? >> >> p.s. I know that ejabberd has some interface to bash, but its code too >> complex to my task. >> >> Best regards, >> Max >> >> >> >> _______________________________________________ erlang-questions mailing >> list erlang-questions@REDACTED >> http://erlang.org/mailman/listinfo/erlang-questions >> > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From greim@REDACTED Sat Dec 31 12:18:32 2011 From: greim@REDACTED (greim) Date: Sat, 31 Dec 2011 12:18:32 +0100 Subject: [erlang-questions] Erlang program and bash/Munin communication In-Reply-To: References: Message-ID: <4EFEEF88.90108@schleibinger.com> Am 30.12.2011 19:29, schrieb Max Bourinov: > Hi Dear Erlangers! > > I want to plot some stats from my Erlang program in munin > (http://munin-monitoring.org/). For that I have to call it somehow from > bash/sh script. Standart munin setup calls the script every 5 minutes. > i think a named pipe (mkfifo) is better Markus > So, I want to know, what is a best way to establish one way (Erlang -> > Bash) communication? > > One of approaches could be when Erlang program writes file to somewhere > like /var/run/erl-prog and bash script reads it. > > Is there are any other simpler options available? > > p.s. I know that ejabberd has some interface to bash, but its code too > complex to my task. > > Best regards, > Max > > > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions From max.lapshin@REDACTED Sat Dec 31 12:22:19 2011 From: max.lapshin@REDACTED (Max Lapshin) Date: Sat, 31 Dec 2011 14:22:19 +0300 Subject: [erlang-questions] Erlang on Freescale i.MX53 (Cortex A8, ARM): works excelently In-Reply-To: References: Message-ID: On Sat, Dec 31, 2011 at 2:40 AM, Garrett Smith wrote: > > Wow - $150 board with Erlang! I'm tempted to pick one up to play around. > > Very cool Max! Yes, dreams come true and you can launch distributed coffee machine: http://www.freescale.com/webapp/sps/site/application.jsp?code=APLCKGPROD I don't know exactly what can it do, perhaps some failure tolerance: dishwasher will help to finish cappucino. This board is shipped with plain Ubuntu (ancient, but working). 150$ is a big price, but it is for a big development board with many peripheral hardware and 1 GB of RAM (!). If you know where to go to make hardware, it is possible to buy small chip for 20$: http://www.iwavesystems.com/i.MX53.htm and use its pinout to connect to peripheral. This box with other ARM cpu: http://www.raspberrypi.org/ is almost the same, but less powerfull and without some features like hardware H.264 encoding. And it is much, much cheaper. From max.lapshin@REDACTED Sat Dec 31 12:23:06 2011 From: max.lapshin@REDACTED (Max Lapshin) Date: Sat, 31 Dec 2011 14:23:06 +0300 Subject: [erlang-questions] Erlang on Freescale i.MX53 (Cortex A8, ARM): works excelently In-Reply-To: References: Message-ID: This one is even better: http://www.digi.com/products/wireless-wired-embedded-solutions/solutions-on-module/connectcore/connectcore-wi-mx53#overview replace dump software in your BMW with erlang =) From bourinov@REDACTED Sat Dec 31 14:23:32 2011 From: bourinov@REDACTED (Max Bourinov) Date: Sat, 31 Dec 2011 17:23:32 +0400 Subject: [erlang-questions] Erlang program and bash/Munin communication In-Reply-To: <4EFEEF88.90108@schleibinger.com> References: <4EFEEF88.90108@schleibinger.com> Message-ID: <-9131750455992961685@unknownmsgid> Sent from my iPhone On 31.12.2011, at 15:18, greim wrote: > Am 30.12.2011 19:29, schrieb Max Bourinov: >> Hi Dear Erlangers! >> >> I want to plot some stats from my Erlang program in munin >> (http://munin-monitoring.org/). For that I have to call it somehow from >> bash/sh script. Standart munin setup calls the script every 5 minutes. >> > > > i think a named pipe (mkfifo) is better > > Markus > Hi Markus, can you provide more detail or introduction link? Best regards, Max > > >> So, I want to know, what is a best way to establish one way (Erlang -> >> Bash) communication? >> >> One of approaches could be when Erlang program writes file to somewhere >> like /var/run/erl-prog and bash script reads it. >> >> Is there are any other simpler options available? >> >> p.s. I know that ejabberd has some interface to bash, but its code too >> complex to my task. >> >> Best regards, >> Max >> >> >> >> >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://erlang.org/mailman/listinfo/erlang-questions > From meetprashant007@REDACTED Sat Dec 31 15:16:19 2011 From: meetprashant007@REDACTED (Prashant Sharma) Date: Sat, 31 Dec 2011 19:46:19 +0530 Subject: [erlang-questions] Erlang program and bash/Munin communication In-Reply-To: <-9131750455992961685@unknownmsgid> References: <4EFEEF88.90108@schleibinger.com> <-9131750455992961685@unknownmsgid> Message-ID: Hi Max, Ejabberd uses erlang port for running the script. In which external script reads from stdin and writes to stdout. http://www.erlang.org/doc/tutorial/users_guide.html -P On Sat, Dec 31, 2011 at 6:53 PM, Max Bourinov wrote: > Sent from my iPhone > > On 31.12.2011, at 15:18, greim wrote: > >> Am 30.12.2011 19:29, schrieb Max Bourinov: >>> Hi Dear Erlangers! >>> >>> I want to plot some stats from my Erlang program in munin >>> (http://munin-monitoring.org/). For that I have to call it somehow from >>> bash/sh script. Standart munin setup calls the script every 5 minutes. >>> >> >> >> i think a named pipe (mkfifo) is better >> >> Markus >> > > Hi Markus, can you provide more detail or introduction link? > > Best regards, > Max > >> >> >>> So, I want to know, what is a best way to establish one way (Erlang -> >>> Bash) communication? >>> >>> One of approaches could be when Erlang program writes file to somewhere >>> like /var/run/erl-prog and bash script reads it. >>> >>> Is there are any other simpler options available? >>> >>> p.s. I know that ejabberd has some interface to bash, but its code too >>> complex to my task. >>> >>> Best regards, >>> Max >>> >>> >>> >>> >>> _______________________________________________ >>> 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 -- Prashant Sharma Development Engineer Pramati Technologies Begumpet "Hare Krishna" From muharem@REDACTED Sat Dec 31 15:38:23 2011 From: muharem@REDACTED (Muharem Hrnjadovic) Date: Sat, 31 Dec 2011 15:38:23 +0100 Subject: [erlang-questions] direct binary to integer conversion In-Reply-To: <4EFE1793.1010602@foldr3.com> References: <4EFE1793.1010602@foldr3.com> Message-ID: <4EFF1E5F.30605@lbox.cc> Hello there! Is there a way to convert a binary to an integer *directly*? Right now I am using the following construct: string:to_integer(binary_to_list(B)) where B is a binary. Best regards/Mit freundlichen Gr??en -- Muharem Hrnjadovic Public key id : B2BBFCFC Key fingerprint : A5A3 CC67 2B87 D641 103F 5602 219F 6B60 B2BB FCFC -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 900 bytes Desc: OpenPGP digital signature URL: From zabrane3@REDACTED Sat Dec 31 16:30:20 2011 From: zabrane3@REDACTED (Zabrane Mickael) Date: Sat, 31 Dec 2011 16:30:20 +0100 Subject: [erlang-questions] direct binary to integer conversion In-Reply-To: <4EFF1E5F.30605@lbox.cc> References: <4EFE1793.1010602@foldr3.com> <4EFF1E5F.30605@lbox.cc> Message-ID: <7770B3F6-87E1-4104-8CDD-FFCB61C0F956@gmail.com> This may be could help (for non negative integers): https://github.com/extend/cowboy/blob/master/src/cowboy_http.erl#L534 Regards, Zabrane On Dec 31, 2011, at 3:38 PM, Muharem Hrnjadovic wrote: > Hello there! > > Is there a way to convert a binary to an integer *directly*? Right now I > am using the following construct: > > string:to_integer(binary_to_list(B)) > > where B is a binary. > > Best regards/Mit freundlichen Gr??en > > -- > Muharem Hrnjadovic > Public key id : B2BBFCFC > Key fingerprint : A5A3 CC67 2B87 D641 103F 5602 219F 6B60 B2BB FCFC > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions -------------- next part -------------- An HTML attachment was scrubbed... URL: From dmkolesnikov@REDACTED Sat Dec 31 17:14:19 2011 From: dmkolesnikov@REDACTED (Dmitry Kolesnikov) Date: Sat, 31 Dec 2011 18:14:19 +0200 Subject: [erlang-questions] gen_fsm and keepalive timer In-Reply-To: <20111229183525.GA27078@ecn.lan> References: <20111229183525.GA27078@ecn.lan> Message-ID: <6766729C-5246-49D1-8CD8-0AE83A0B680E@gmail.com> Hello, I would recommend to use gen_fsm:send_event_after(...) see http://www.erlang.org/doc/man/gen_fsm.html It makes your code is more readable and allow to handle multiple timeouts/timers within state. Dmitry On 29.12.2011, at 20.35, Michael Santos wrote: > On Thu, Dec 29, 2011 at 06:51:44PM +0100, Ivan Ostres wrote: >> Hi all! >> >> I am trying to implement FSM of a protocol inside gen_fsm behavior. >> For a keepalive purpose I need a timer that would produce event when >> timer is expired so I could know when to send a keepalive packet and >> to know when holdtime is gone (I didn;t receive keepalive packet >> from other side). I was trying to get more info on >> gen_fsm:start_timer but documentation is a bit sparse - it's clear >> how to create timer but not how to catch it's event (well, at least >> to me since this is first time I am using gen_fsm). >> >> If someone could explain this in few sentences I would be very >> grateful. Also if there is a better way for keepalive mechanism >> inside gen_fsm, I would like to know it. >> >> Thanks and regards, >> Ivan Ostres > > Using the optional timeout in gen_fsm states might be simpler to use: > > -record(state, { timeout = 1000 }). > > my_state(Data, #state{timeout = Timeout} = State) -> > handle_protocol(Data), > {next_state, my_state, State, Timeout}; > my_state(timeout, #state{timeout = Timeout} = State) -> > keepalive(), > {next_state, my_state, State, Timeout}. > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions From muharem@REDACTED Sat Dec 31 18:22:44 2011 From: muharem@REDACTED (Muharem Hrnjadovic) Date: Sat, 31 Dec 2011 18:22:44 +0100 Subject: [erlang-questions] direct binary to integer conversion In-Reply-To: <7770B3F6-87E1-4104-8CDD-FFCB61C0F956@gmail.com> References: <4EFE1793.1010602@foldr3.com> <4EFF1E5F.30605@lbox.cc> <7770B3F6-87E1-4104-8CDD-FFCB61C0F956@gmail.com> Message-ID: <4EFF44E4.9000800@lbox.cc> On 12/31/2011 04:30 PM, Zabrane Mickael wrote: > This may be could help (for non negative integers): > https://github.com/extend/cowboy/blob/master/src/cowboy_http.erl#L534 Thanks for the pointer! Will take a look. > On Dec 31, 2011, at 3:38 PM, Muharem Hrnjadovic wrote: > >> Hello there! >> >> Is there a way to convert a binary to an integer *directly*? Right now I >> am using the following construct: >> >> string:to_integer(binary_to_list(B)) >> >> where B is a binary. Best regards/Mit freundlichen Gr??en -- Muharem Hrnjadovic Public key id : B2BBFCFC Key fingerprint : A5A3 CC67 2B87 D641 103F 5602 219F 6B60 B2BB FCFC -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 900 bytes Desc: OpenPGP digital signature URL: