[erlang-questions] Beginner questions

OJ Reeves <>
Mon Dec 24 10:35:36 CET 2012


All,

The first issue is that the init() function isn't correct for this
gen_server.

On line 83, the init function starts like this:
init(S) ->
When it should (apparently) be like this:
init([S]) ->

This doesn't make the server run though. The next error states:

6> population_monitor:start().
******** Population monitor started with parameters:{state,
                                                     [gt],
                                                     test,[],[],undefined,

 undefined,undefined,[],0,
                                                     0,0,0,0,undefined,
                                                     undefined,undefined,
                                                     undefined,undefined,
                                                     undefined,0.5,10,10,
                                                     mathema,100,100000,inf,
                                                     undefined,false}
{error,{{badrecord,population},
        [{population_monitor,extract_AgentIds,2,
                             [{file,"population_monitor.erl"},{line,372}]},
         {population_monitor,init,1,
                             [{file,"population_monitor.erl"},{line,89}]},
         {gen_server,init_it,6,[{file,"gen_server.erl"},{line,304}]},
         {proc_lib,init_p_do_apply,3,
                   [{file,"proc_lib.erl"},{line,227}]}]}}

I get the feeling that there's going to be more stuff requiring fixes as
you go. Perhaps the best thing its to get in touch with the author directly
and find out about the state of the source base before continuing.

Cheers
OJ


On Mon, Dec 24, 2012 at 5:49 PM, Ivan Uemlianin <> wrote:

> Dear Bob
>
> This line should be part of the function population_monitor:init/1 (that's
> file population_monitor, function init, which takes one argument).
>
> The error it complains of is {badrecord,state}, so perhaps the record S
> has been badly set up.
>
> Are you learning erlang through neuroevolution :) ?  Do you have other
> reference resources?
>
> Nadolig Llawen
>
> Ivan
>
>
> --
> festina lente
>
>
> On 24 Dec 2012, at 07:24, Bob Matthews <> wrote:
>
> Thank you Ivan
>
> line 82: Population_Id = S#state.population_id,
>
> Merry Xmas to you too :)
>
> Bob
> Dunedin
> New Zealand
>
> On 24/12/2012 8:14 p.m., Ivan Uemlianin wrote:
>
> I dont have my computer with me but the error is at line 82 of the file
> population_monitor.erl.
>
>  Best wishes
>
>  Ivan
>
> --
> festina lente
>
>
> On 24 Dec 2012, at 01:32, Bob Matthews <> wrote:
>
>   The code that I am looking at is DXNN2 copyrighted to Gene Sher.
>
> The error message I got which I am having difficulty interpreting is as
> follows....................
>
> 4> population_monitor:start().
> {error,{{badrecord,state},
>         [{population_monitor,init,1,
>                              [{file,"population_monitor.erl"},{line,82}]},
>          {gen_server,init_it,6,[{file,"gen_server.erl"},{line,304}]},
>          {proc_lib,init_p_do_apply,3,
>                    [{file,"proc_lib.erl"},{line,227}]}]}}
>
> I am using the latest versionR15B03
>
> Thank you for you help
>
> Bob
> Dunedin New Zealand
>
> On 24/12/2012 11:58 a.m., Matti Oinas wrote:
>
> Hi,
>
> My first proposal is to change the editor to something more usable like
> emacs or if you prefer something different then notepad++, sublime text or
> eclipse + erlIDE. Everyone of these are able to show you the line numbers
> and offer syntax highlight features.
>
> It would help a lot if you tell us which code you are looking at. Server
> callbacks probably mean gen_server callbacks so it doesn't matter if you
> are using windows or linux.
>
> Matti
>
> On 12/24/2012 12:08 AM, Bob Matthews wrote:
>
> Hi
>
> I have just started to learn Erlang............
> I am using Windows 7 on a PC
>
> *Question 1*)  when I get an error message, what is the easiest way for
> me to find the exact line number?
> I use ms Word as an editor.
>
> *Question 2*) the code I am looking at was run on Unix, on a server.
> Part of the code talks about server call-backs etc.
> It is unclear how I translate that to a windows PC
>
> Many thanks
>
> Bob
>
>
> _______________________________________________
> erlang-questions mailing ://erlang.org/mailman/listinfo/erlang-questions
>
>
> No virus found in this message.
> Checked by AVG - www.avg.com
> Version: 2013.0.2805 / Virus Database: 2634/5951 - Release Date: 12/11/12
> Internal Virus Database is out of date.
>
>
>   _______________________________________________
> erlang-questions mailing list
> 
> http://erlang.org/mailman/listinfo/erlang-questions
>
> No virus found in this message.
> Checked by AVG - www.avg.com
> Version: 2013.0.2805 / Virus Database: 2634/5951 - Release Date: 12/11/12
> Internal Virus Database is out of date.
>
>
>
> _______________________________________________
> erlang-questions mailing list
> 
> http://erlang.org/mailman/listinfo/erlang-questions
>
>


-- 

OJ Reeves
+61 431 952 586
http://buffered.io/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20121224/1c719e77/attachment.html>


More information about the erlang-questions mailing list