[Chicken-users] what would you recommend for this ?

2011-06-21 Thread HP wei
I am seeking some ideas about the following project.

Suppose there are about 20 machines A1, A2, ... A20.
Each Ai does the following
   (1) at some specified time,  it checks the status of some databases
and the status of the disks 
If certain condition is met, either an email is sent to someone
or a message is sent to the master machine (see below).
   (2) At the request of the master machine,
it carries out the requested task and sends back result.

Let there be one master machine M.
I am thinking that this should run a spiffy web server.
It needs to maintain many states and communicate with
Ai.

Let there be un-specified number of Clients (C1, C2, ...)
connecting to M at un-specified times.
Let's suppose I am C1.
I would like to see the status of those databases and disks.
And if needed, I would like to issue a command to resolve problems.
e.g.
(a) sync from M3:database_x  to M10:database_x
(b) ask all machines to gather all status now.

Of course, the requests (issued commands) from different Ci
need to be consistent and may need to be queued.

--

How to proceed ?
For Ci, it can just use the available web browser.

For M, maybe a spiffy web server.
Is it possible to issue a command to many Ci's  asynchronously and
gather results from each Ci ?  (sort of like MapReduce)

What about Ai ?  A rpc-server ?

THanks
HP
___
Chicken-users mailing list
Chicken-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/chicken-users


[Chicken-users] ssax examples could not run

2011-06-21 Thread HP wei
I installed chicken.4.7.0
and ssax, sxpath

Then I tried to follow the examples pointed to in the ssax homepage
in
http://modis.ispras.ru/Lizorkin/sxml-tutorial.html

Specifically,
When I run this in csi,
(use ssax)
(use sxpath)

(sxml:document http://...html;)

I got
Error: unbound variable: sxml:document

Another example, after installing htmlprag

(*html-sxml* http://modis.ispras.ru/Lizorkin/Apidoc/htmlprag.html

 (open-input-resource http://html
http://modis.ispras.ru/Lizorkin/XML/amorphis.html))

-- gives
Error: unbound variable: open-input-resource



Do I need to use wget in the shell to download the html page
and then come back to csi to parse it ??

thanks
HP
___
Chicken-users mailing list
Chicken-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] ssax examples could not run

2011-06-21 Thread Peter Bex
On Tue, Jun 21, 2011 at 01:58:08PM -0400, HP wei wrote:
 I installed chicken.4.7.0
 and ssax, sxpath
 
 Then I tried to follow the examples pointed to in the ssax homepage
 in
 http://modis.ispras.ru/Lizorkin/sxml-tutorial.html

Generally, the Chicken documentation takes precedence over the
documentation of the upstream project (this goes for all eggs).
In this case, http://wiki.call-cc.org/egg/ssax

 Specifically,
 When I run this in csi,
 (use ssax)
 (use sxpath)
 
 (sxml:document http://...html;)
 
 I got
 Error: unbound variable: sxml:document

Yes, sxml:document isn't part of the SSAX parser itself, but of
the xlink sublibrary of sxml-tools.  Chicken's ssax egg packages
up purely the SSAX parser.

Sorry about the confusion, the upstream SSAX project is just a holy mess
of stuff which is split up in a way that's not very orthogonal.

We did our best to try to split it up into chunks that make sense for a
user so you don't have to make a choice to include everything and the
kitchen sink whenever you need *some* subfunctionality provided by the
SSAX project.

 Another example, after installing htmlprag
 
 (*html-sxml* http://modis.ispras.ru/Lizorkin/Apidoc/htmlprag.html
 
  (open-input-resource http://html
 http://modis.ispras.ru/Lizorkin/XML/amorphis.html))
 
 -- gives
 Error: unbound variable: open-input-resource

This is a very weird one; it doesn't exist _anywhere_ in the SSAX
project:

$ cvs -z3 -d:pserver:anonym...@ssax.cvs.sourceforge.net:/cvsroot/ssax co -P 
sxml-tools
...
$ cvs -z3 -d:pserver:anonym...@ssax.cvs.sourceforge.net:/cvsroot/ssax co -P SSAX
...
$ grep -r open-input-resource SSAX sxml-tools
sxml-tools/xlink.scm: (let* ((port (open-input-resource req-uri))
sxml-tools/xlink.scm: (let* ((port (open-input-resource req-uri))
sxml-tools/xlink.scm: (let* ((port (open-input-resource req-uri))
sxml-tools/xlink.scm: (let* ((port (open-input-resource req-uri))

Only usage points, no definition at all!

On Dmitry Lizorkin's website there's this definition:
http://modis.ispras.ru/Lizorkin/Apidoc/access-remote.html#codefunc60351
which links to a http-transaction procedure here:
http://modis.ispras.ru/Lizorkin/Apidoc/http.html#codefunc26928

but neither of these exist in the SSAX source tree itself.
It can't really, since SSAX is (mostly) portable Scheme code,
but you can't portably open a network connection (scroll down
on that page to see cond-expand code that makes this available
in a sort-of portable way).

You could copy/paste this code, and it should probably work
unmodified, but read on for a better solution.

 Do I need to use wget in the shell to download the html page
 and then come back to csi to parse it ??

No, you can also use http-client, which provides a procedure which is
similarly high-level as open-input-resource:

(pp (call-with-input-request
 http://modis.ispras.ru/Lizorkin/XML/poem.xml;
 #f (lambda (p)
  (let ((sxml (ssax:xml-sxml p '(
;; Consume the rest of the stream, ssax does not
;; fully read until the end.
(read-string #f p)
sxml
=
(*TOP* (*PI* xml version='1.0')
   (poem (@ (title The Lovesong of J. Alfred Prufrock)
(poet T. S. Eliot))
 (stanza
   (line Let us go then, you and I,)
   (line When the evening is spread out against the sky)
   (line Like a patient etherized upon a table:))
 (stanza
   (line In the room the women come and go)
   (line Talking of Michaelangelo.

For more information, see http://wiki.call-cc.org/egg/http-client

I hope this helps!

Cheers,
Peter
-- 
http://sjamaan.ath.cx
--
The process of preparing programs for a digital computer
 is especially attractive, not only because it can be economically
 and scientifically rewarding, but also because it can be an aesthetic
 experience much like composing poetry or music.
-- Donald Knuth

___
Chicken-users mailing list
Chicken-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/chicken-users


[Chicken-users] Should http-client automatically consume unconsumed input? [Was: Re: ssax examples could not run]

2011-06-21 Thread Peter Bex
Hi again,

Also, about this piece of code:

 (pp (call-with-input-request
  http://modis.ispras.ru/Lizorkin/XML/poem.xml;
  #f (lambda (p)
   (let ((sxml (ssax:xml-sxml p '(
 ;; Consume the rest of the stream, ssax does not
 ;; fully read until the end.
 (read-string #f p)
 sxml

Does it make sense to have http-client automatically consume any
remaining data after the user-supplied reader returns?
What about continuations?  Or perhaps it should be read when the
*next* request is done?

Thoughts? Opinions?

Cheers,
Peter
-- 
http://sjamaan.ath.cx
--
The process of preparing programs for a digital computer
 is especially attractive, not only because it can be economically
 and scientifically rewarding, but also because it can be an aesthetic
 experience much like composing poetry or music.
-- Donald Knuth

___
Chicken-users mailing list
Chicken-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/chicken-users