From: Emre Sevinc
Subject: Shoutcast using PCL: How to handle sockets and locking w/o Allegro?
Date: 
Message-ID: <87oe8zwrtp.fsf@ileriseviye.org>
I came to the last part of studying the Shoutcast server
and the MP3 web based browser developed by Peter Seibel
and described in his book Practical Common Lisp:

http://www.gigamonkeys.com/book/practical-an-mp3-browser.html

At the beginning of chapter he mentions some packages
and I have a couple of questions:

  "Finally, the lock slot holds a process lock created 
   with the function make-process-lock, which is part of 
   Allegro's MULTIPROCESSING package."

and for sockets:

  "The function request-socket is part of AllegroServe, 
   while remote-host and ipaddr-to-dotted are part of 
   Allegro's socket library."

Well, the only thing I have on my Debian box is AllegroServe
portable Lisp web server which is running fine on SBCL. I was
able to feel and experiment what it is like to publish a
file using AllegroServe. 

But now I wonder what I can do about that "MULTIPROCESSING"
and "Allegro's socket library". If possible I would like
to continue using SBCL. What are the corresponding packages
that I can use with SBCL on my Debian GNU/Linux? 

I'd be very happy if I can handle this final part without
switching to another Lisp implementation :)

If that is possible then what kind of modifications should
be applied to that process locking and socket code? Same
macros? Or different names? 

Happy hacking,

-- 
Emre Sevinc

eMBA Software Developer         Actively engaged in:
http:www.bilgi.edu.tr           http://ileriseviye.org
http://www.bilgi.edu.tr         http://fazlamesai.net
Cognitive Science Student       http://cazci.com
http://www.cogsci.boun.edu.tr

From: Peter Seibel
Subject: Re: Shoutcast using PCL: How to handle sockets and locking w/o Allegro?
Date: 
Message-ID: <m2ek9vd38o.fsf@gigamonkeys.com>
Emre Sevinc <·····@bilgi.edu.tr> writes:

> I came to the last part of studying the Shoutcast server
> and the MP3 web based browser developed by Peter Seibel
> and described in his book Practical Common Lisp:
>
> http://www.gigamonkeys.com/book/practical-an-mp3-browser.html
>
> At the beginning of chapter he mentions some packages
> and I have a couple of questions:
>
>   "Finally, the lock slot holds a process lock created 
>    with the function make-process-lock, which is part of 
>    Allegro's MULTIPROCESSING package."
>
> and for sockets:
>
>   "The function request-socket is part of AllegroServe, 
>    while remote-host and ipaddr-to-dotted are part of 
>    Allegro's socket library."
>
> Well, the only thing I have on my Debian box is AllegroServe
> portable Lisp web server which is running fine on SBCL. I was
> able to feel and experiment what it is like to publish a
> file using AllegroServe. 
>
> But now I wonder what I can do about that "MULTIPROCESSING"
> and "Allegro's socket library". If possible I would like
> to continue using SBCL. What are the corresponding packages
> that I can use with SBCL on my Debian GNU/Linux? 

The main thing in Portable AllegroServe other than a somewhat hacked
copy of AllegroServe is a compatibility library that provides packages
that mirror the Allegro packages for things like threads and
sockets. So you ought to be able to use those. Look in the acl-compat
directory of the Portable AllegroServe distribution.

You will, probably need to either change the DEFPACKAGE forms in the
book's code to use the slightly different package names
(:acl-compat-mp instead of :multiprocessing) or you could play around
with using RENAME-PACKAGE to give the acl-compat packages nicknames
that correspond to the names used in the book's code. The only trick
there is that your implementation may already have packages with those
names (or nicknames) which you would then need to rename out of the
way first.

-Peter

-- 
Peter Seibel           * ·····@gigamonkeys.com
Gigamonkeys Consulting * http://www.gigamonkeys.com/
Practical Common Lisp  * http://www.gigamonkeys.com/book/
From: Emre Sevinc
Subject: Re: Shoutcast using PCL: How to handle sockets and locking w/o Allegro?
Date: 
Message-ID: <87mzojxjy2.fsf@ileriseviye.org>
Peter Seibel <·····@gigamonkeys.com> writes:

> Emre Sevinc <·····@bilgi.edu.tr> writes:
>
>> I came to the last part of studying the Shoutcast server
>> and the MP3 web based browser developed by Peter Seibel
>> and described in his book Practical Common Lisp:
>>
>> http://www.gigamonkeys.com/book/practical-an-mp3-browser.html
>>
>> At the beginning of chapter he mentions some packages
>> and I have a couple of questions:
>>
>>   "Finally, the lock slot holds a process lock created 
>>    with the function make-process-lock, which is part of 
>>    Allegro's MULTIPROCESSING package."
>>
>> and for sockets:
>>
>>   "The function request-socket is part of AllegroServe, 
>>    while remote-host and ipaddr-to-dotted are part of 
>>    Allegro's socket library."
>>
>> Well, the only thing I have on my Debian box is AllegroServe
>> portable Lisp web server which is running fine on SBCL. I was
>> able to feel and experiment what it is like to publish a
>> file using AllegroServe. 
>>
>> But now I wonder what I can do about that "MULTIPROCESSING"
>> and "Allegro's socket library". If possible I would like
>> to continue using SBCL. What are the corresponding packages
>> that I can use with SBCL on my Debian GNU/Linux? 
>
> The main thing in Portable AllegroServe other than a somewhat hacked
> copy of AllegroServe is a compatibility library that provides packages
> that mirror the Allegro packages for things like threads and
> sockets. So you ought to be able to use those. Look in the acl-compat
> directory of the Portable AllegroServe distribution.

Hmm, I guess that means I need:

   cl-acl-compat - Compatibility layer for Allegro Common Lisp

and it seems it is already installed on my Debian GNU/Linux
(when I installed cl-aserve).


> You will, probably need to either change the DEFPACKAGE forms in the
> book's code to use the slightly different package names
> (:acl-compat-mp instead of :multiprocessing) or you could play around
> with using RENAME-PACKAGE to give the acl-compat packages nicknames
> that correspond to the names used in the book's code. The only trick
> there is that your implementation may already have packages with those
> names (or nicknames) which you would then need to rename out of the
> way first.

Thanks for the suggestions. I'm going to check if my cl-acl-compat
and SBCL helps and see whether I have those package names in my
system. I'll give feedback on that. Stay tuned ;-)

By the way, implementing the core SQL-like database operations
for mp3 database (tables, rows, schema, inserting, selecting, order by,
distinct, etc.) was very cool but that also made me think, if it 
would be fine (for the book) to give some examples about connecting 
to a real RDBMS (and making the book 5-10 pages thicker). I know
that would be trivial stuff but since your Internet programming examples
are very practical and to the point, talking about connecting to
external database systems would enhance the effect of "practicality"
of the book, I guess, without making it much longer.


Happy hacking,

-- 
Emre Sevinc

eMBA Software Developer         Actively engaged in:
http:www.bilgi.edu.tr           http://ileriseviye.org
http://www.bilgi.edu.tr         http://fazlamesai.net
Cognitive Science Student       http://cazci.com
http://www.cogsci.boun.edu.tr
From: Peter Seibel
Subject: Re: Shoutcast using PCL: How to handle sockets and locking w/o Allegro?
Date: 
Message-ID: <m2ackidbup.fsf@gigamonkeys.com>
Emre Sevinc <·····@bilgi.edu.tr> writes:

> By the way, implementing the core SQL-like database operations for
> mp3 database (tables, rows, schema, inserting, selecting, order by,
> distinct, etc.) was very cool but that also made me think, if it
> would be fine (for the book) to give some examples about connecting
> to a real RDBMS (and making the book 5-10 pages thicker). I know
> that would be trivial stuff but since your Internet programming
> examples are very practical and to the point, talking about
> connecting to external database systems would enhance the effect of
> "practicality" of the book, I guess, without making it much longer.

Yeah. I'd have liked to have done that but I simply ran out of time,
energy, and space. The main problem was to make it practical I'd have
to explain how to install and set up a database which would probably
take more space to explain than any other part of it. I just couldn't
face that at the time. The actual Lisp part would probably be quite
trivial. Maybe in the 2nd edition.

-Peter

-- 
Peter Seibel           * ·····@gigamonkeys.com
Gigamonkeys Consulting * http://www.gigamonkeys.com/
Practical Common Lisp  * http://www.gigamonkeys.com/book/
From: Emre Sevinc
Subject: Re: Shoutcast using PCL: How to handle sockets and locking w/o Allegro?
Date: 
Message-ID: <87k6jlwp7c.fsf@ileriseviye.org>
Peter Seibel <·····@gigamonkeys.com> writes:

> Emre Sevinc <·····@bilgi.edu.tr> writes:
>
>> By the way, implementing the core SQL-like database operations for
>> mp3 database (tables, rows, schema, inserting, selecting, order by,
>> distinct, etc.) was very cool but that also made me think, if it
>> would be fine (for the book) to give some examples about connecting
>> to a real RDBMS (and making the book 5-10 pages thicker). I know
>> that would be trivial stuff but since your Internet programming
>> examples are very practical and to the point, talking about
>> connecting to external database systems would enhance the effect of
>> "practicality" of the book, I guess, without making it much longer.
>
> Yeah. I'd have liked to have done that but I simply ran out of time,
> energy, and space. The main problem was to make it practical I'd have
> to explain how to install and set up a database which would probably
> take more space to explain than any other part of it. I just couldn't
> face that at the time. The actual Lisp part would probably be quite
> trivial. Maybe in the 2nd edition.

I can't prove that right now but I believe more than %90 of your
potential readers will have touched some RDBMS (MySQL, PostgreSQL,
MS SQL Server, Oracle, etc.) and played with SQL and stored
procedures in some way.

So, assuming a hypothetical database (one of the most popular
ones mentioned above) and a couple of tables created and not 
explaining how to install and create a database from scratch 
wouldn't hurt too much.

I'm sure if you add that to the 2nd Edition and on the backcover
tell people that you are showing them how to connect to RDBMS, pull any kind 
of data and publish them, this would increase book's popularity.
Just like the familiar terms like MP3, streaming, Shoutcast server,
HTML, Internet programming, etc. do (ok, I accept that connecting
to RDBMS stuff is trivial, not half interesting as MP3 stuff but
it gives you more and more chance for "yes, Common Lisp for real world
problems, what else did you think?" :)


Happy hacking,

-- 
Emre Sevinc

eMBA Software Developer         Actively engaged in:
http:www.bilgi.edu.tr           http://ileriseviye.org
http://www.bilgi.edu.tr         http://fazlamesai.net
Cognitive Science Student       http://cazci.com
http://www.cogsci.boun.edu.tr