The Book, lib_chan and IRC Lite

View: New views
6 Messages — Rating Filter:   Alert me  

The Book, lib_chan and IRC Lite

by Dmitrii Dimandt :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I'm stupid and I am not afraid to admit it :)

I'm currently battling the IRC Lite from chapter 11 of "Programming Erlang". Whatever I do (copy paste, run make in the code directory obtained from the biik's site etc.) I get the following error when I run the example:
lib_chan_mm: protocol error:{login,"general","joe"}
Does anyone else run into the same problem? Of course, I am going to dig deeper into the code and try and locate the error myself. But I was surprised to be bitten by this :(

_______________________________________________
erlang-questions mailing list
erlang-questions@...
http://www.erlang.org/mailman/listinfo/erlang-questions

Re: The Book, lib_chan and IRC Lite

by Joe Armstrong-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

This is very strange - Possible some software rot has set it, or the
distributed code
is corrupt - we'll have to try and get to the bottom of this.

Just to test, I downloaded *everything* from the prag site and tested
things. here's
what I did.

Download the code from the link on
http://www.pragmaticprogrammer.com/titles/jaerlang/code.html

unpacked the archive.

Then:

cd code
> make
... lots of output
$ cd socket_dist
$ make

mkdir -p /home/ejoearm/.erlang_config/
cp conf /home/ejoearm/.erlang_config/lib_chan.conf
make clean - clean up
To run the chat test program
  1) start two xterms
  2) in xterm one type -- make chat_server
  3) in xterm two type -- make chat_client
  Note: remember to type make in the directory above this
        before running make in this directory
To run the lib_chan test program
  1) start two xterms
  2) in xterm one type -- make server
  3) in xterm two type -- make client

You should get something like this - "ejoarm" is the value of my $HOME
environment
variable.

Then I just obey the instructions. start two xterms and do make
chat_server in one
and make chat_client in the other.

This worked for me just as in the book.

>From your mail I cannot see what you did.

Can you repeat what I've just done starting with a clean copy of the code,
and see if it works.

If it does not work I'll need to see *all* the output to figure out
what is going wrong.

With a little poking around we should be able to find out what's going wrong.

Cheers

/Joe Armstrong




On 8/4/07, Dmitrii 'Mamut' Dimandt <dmitriid@...> wrote:

>
>  I'm stupid and I am not afraid to admit it :)
>
>  I'm currently battling the IRC Lite from chapter 11 of "Programming
> Erlang". Whatever I do (copy paste, run make in the code directory obtained
> from the biik's site etc.) I get the following error when I run the example:
>
> lib_chan_mm: protocol error:{login,"general","joe"}
>  Does anyone else run into the same problem? Of course, I am going to dig
> deeper into the code and try and locate the error myself. But I was
> surprised to be bitten by this :(
>
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@...
> http://www.erlang.org/mailman/listinfo/erlang-questions
>
_______________________________________________
erlang-questions mailing list
erlang-questions@...
http://www.erlang.org/mailman/listinfo/erlang-questions

Re: The Book, lib_chan and IRC Lite

by Dmitrii Dimandt :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Joe Armstrong wrote:
> >From your mail I cannot see what you did.
>
> Can you repeat what I've just done starting with a clean copy of the code,
> and see if it works.
>
>  
This is *really* odd :)
I downloaded the code and went through all the steps again and it worked :)
I guess I might have downloaded some intermediate code from the site or
something went wrong with my code, but now it works :) Even though it
didn't work before.

Actually the same problem bit at least one other person on the list,
avindev at gmail dot com, he sent me a patch for my code. I guess he
must've downloaded the same version of the code as I did.

However, everything works ok now, so I guess i learned my lesson:
download the latest code before trying anything out :)


_______________________________________________
erlang-questions mailing list
erlang-questions@...
http://www.erlang.org/mailman/listinfo/erlang-questions

Re: The Book, lib_chan and IRC Lite

by Joe Armstrong-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Strange, there is a report of an error (and a patch) on the book's errata page
but I have not been able to reproduce the error.

I don't think there ever was a broken version on the prag site - you
might having forgotten
to do a make or have some weird paths setup. The command
"code:clash()" will report
any irregularities in your code loading paths.

Otherwise I have no idea what went wrong. It's possible there is some
weird error
but in that case I don't know how to reproduce it - I think the
program is correct.

Cheers

/Joe


On 8/7/07, Dmitrii 'Mamut' Dimandt <dmitriid@...> wrote:

> Joe Armstrong wrote:
> > >From your mail I cannot see what you did.
> >
> > Can you repeat what I've just done starting with a clean copy of the code,
> > and see if it works.
> >
> >
> This is *really* odd :)
> I downloaded the code and went through all the steps again and it worked :)
> I guess I might have downloaded some intermediate code from the site or
> something went wrong with my code, but now it works :) Even though it
> didn't work before.
>
> Actually the same problem bit at least one other person on the list,
> avindev at gmail dot com, he sent me a patch for my code. I guess he
> must've downloaded the same version of the code as I did.
>
> However, everything works ok now, so I guess i learned my lesson:
> download the latest code before trying anything out :)
>
>
>
_______________________________________________
erlang-questions mailing list
erlang-questions@...
http://www.erlang.org/mailman/listinfo/erlang-questions

Re: The Book, lib_chan and IRC Lite

by Dmitrii Dimandt :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Joe Armstrong wrote:

> Strange, there is a report of an error (and a patch) on the book's errata page
> but I have not been able to reproduce the error.
>
> I don't think there ever was a broken version on the prag site - you
> might having forgotten
> to do a make or have some weird paths setup. The command
> "code:clash()" will report
> any irregularities in your code loading paths.
>
>  
funny thing is that I've started getting the same "protocol error" from
lib_chan_mm right after I wrote that everything worked ok :) I haven't
had time to investigate the problem, though... I'll write as son as I
can lay my habds on the code...
_______________________________________________
erlang-questions mailing list
erlang-questions@...
http://www.erlang.org/mailman/listinfo/erlang-questions

Re: The Book, lib_chan and IRC Lite

by Joe Armstrong-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

There *was* a bug after all - there was a patch by Kazuya Sakakihara
on the errata list for the book.

I missed this since I when I retested the version I distributed it
seemed to work
(very strange). I've now fixed the code and the changes should make it
into the next
printing of the book.

The corrected versions of code/socket_dist/chat_client.erl and
code/socket_dist/chat_group.erl are attached to this mail.

I hope they are correct now.

Sorry for all the confusion.

/Joe





On 8/7/07, Dmitrii 'Mamut' Dimandt <dmitriid@...> wrote:

> Joe Armstrong wrote:
> > Strange, there is a report of an error (and a patch) on the book's errata page
> > but I have not been able to reproduce the error.
> >
> > I don't think there ever was a broken version on the prag site - you
> > might having forgotten
> > to do a make or have some weird paths setup. The command
> > "code:clash()" will report
> > any irregularities in your code loading paths.
> >
> >
> funny thing is that I've started getting the same "protocol error" from
> lib_chan_mm right after I wrote that everything worked ok :) I haven't
> had time to investigate the problem, though... I'll write as son as I
> can lay my habds on the code...
>



_______________________________________________
erlang-questions mailing list
erlang-questions@...
http://www.erlang.org/mailman/listinfo/erlang-questions

chat_group.erl (1K) Download Attachment
chat_client.erl (4K) Download Attachment