<davexunit>hmm, web browsers choke on my guile web server... <davexunit>I have 2 script tags on the page. the browser fetches the source for the first one, but never evaluates it. the second script is not fetched and the html on the page is not rendered. <davexunit>no errors from guile, no errors in firefox, and firefox says that the request to fetch the first js file has completed. <davexunit>ah, found the problem. sxml is doing the wrong thing with a <script> tag <davexunit>even when there's no content in a <script> tag, it still needs </script>, it can't be <script /> <ijp>there is an option for that, I think <davexunit>as a workaround, I add the empty string as the contents. <ijp>I misremembered, it is wishlist, not closed <mark_weaver>davexunit: also, you should be able to put the doctype header in the sxml itself. <mark_weaver>davexunit: use xml->sxml to see what it should look like. <davexunit>mark_weaver: I'll try it. I noticed some documentation in the manual doing it this way. <davexunit>Throw to key `parser-error' with args `(#<input: string 4e701a0> "XML [22], unexpected EOF")'. <ijp>I do my own sxml -> xml with pre-post-order + SRV:send-reply to handle doctypes and raw strings <davexunit>mark_weaver: no. I'll try it and see what happens. <davexunit>it worked, but the doctype isn't in the output <davexunit>(xml->sxml "<!DOCTYPE html><foo></foo>") returns (*TOP* (foo)) <mark_weaver>however, instead of using 'string-append' to put it in front, you could use 'display' inside the 'with-output-to-string'. <davexunit>yeah, that's a good point. I should do that for other things, too. <davexunit>I'm needlessly reading static files in as strings and then writing them to the port <ijp>the pre-post-order is actually really nice to use, just most people don't <davexunit>despite being a professional web developer, this is my first foray into guile's web offerings. <ijp>davexunit: basically, you give it an alist of functions, and it rewrites your sxml accordingly <ijp>with an option specifying whether or not to rewrite the node's children <mark_weaver>ah, this is what I was thinking of: (sxml->xml '(*TOP* (*PI* xml "version=\\"1.0\\" encoding=\\"UTF-8\\"") (html ""))) => <?xml version="1.0" encoding="UTF-8"?><html></html> *mark_weaver goes afk again <hellekin>davexunit: nice to see you here. Are you willing to generate the GNU website from Guile? That would be awesome :) <davexunit>a task that no one would really want to help with, probably. ;) <hellekin>well actually I've been postponing learning Guille for at least 2 years, that's really a pity. But with such a community and gorgeous achievements such as Guix, and the numerous libraries that have been raining down on us in the past few months, I think there could be some interest in pushing for that project among the webmasters. <davexunit>I wonder how guile would fit in with the gnu.org structure. <davexunit>there are existing static site generators that could be used <ijp>a really simple interpreter as a pre-post-order :) <ijp>Exercise: do the lambda calculus <hellekin>Please Guilers, get a hold on the GNUnet guys and suck in their Social API. Tg will be there, and Mami is a sponge who loves Emacs and LISP, so you can easily convince him to get into Guile ,o) <cky>hellekin: ..."libraries that have been raining down on us"? Wow. Maybe I should get to porting Rackona to Guile after all. ;-) <hellekin>cky: what do you need, FFI? Guile has it :) <hellekin>srsly there were a good number of releases in the last three or four months no? ***siel_ is now known as siel
***endou___ is now known as endou__
***vicenteH` is now known as vicenteH
<davexunit>I am trying to write a function that can serve a static file via guile's web server. <davexunit>my first implementation read the file as a string, and then wrote that string to the http client port. <davexunit>is there a way that I can instead read from the input file port and write to the http client port directly? <janneke>davexunit: i was wondering about that last week <janneke>i was quite surprised that i could not find a generic function for that <janneke> (with-input-from-string (with-output-to-string producer) consumer)) <davexunit>I can just read it all in as a string for now. <janneke>i'm afraid that's what my 'pipe' does <janneke>please let me know/post it to guile-user if you find the real way to do my `pipe' <janneke>davexunit: are you the david that's on guile-gtk-general? *janneke is waiting for a reply on set of patches to guile-gtk-general, from about one month ago *janneke 's internet connection resembles early 90's modem times <davexunit>hmm, how do I write the contents of a bytevector to a port? <janneke>davexunit: what i truly wonder about with guile as opposed to python <janneke>is that i figure we all have our own separate libraries to do simple stuff <janneke> (call-with-input-file file-name get-bytevector-all)) <janneke> (let* ((file (open-output-file name))) <janneke>it just so happens that i didn't need to *write* binary files, only read <janneke>am i doing things wrong, or how can we somehow avoid re-inventing those basics all ourselves <davexunit>for gulp-text-file, you can do (with-input-from-string filename read-string) <janneke>it's sometimes a real put-down that simple things don't seem to be available <janneke>davexunit: huh? file-name as input-string? *janneke looks up read-string and is amazed he didn't find that earlier <janneke>now wonder about my dump-file, is there also a write-string and with output to file? <janneke>probably something like (define (dump-file file-name string) (with-output-to-file file-name (lambda () (sisplay string)))) <mark_weaver>davexunit: there's 'sendfile', which uses the underlying system call when available. <davexunit>I changed to reading static files in as bytevectors. reading in as a string caused an encoding phase to be run that corrupted binary files like images. <mark_weaver>just keep in mind that 'sendfile' does a binary copy, so not appropriate if you're working with text and the encodings might be different on the two ports. <mark_weaver>but if the file is UTF-8 and you can assume you're writing to the socket in UTF-8, then it's fine. <mark_weaver>right, in this case you probably want binary mode anyway :) <janneke>guile-gnome used to be many different git archives but have been merged <mario-goulart>Where can I find the source repository for guile gstreamer bindings, BTW? <janneke>mario-goulart: have you tried adding gstreamer to guile-gnome-platform in PACKAGES and run configure? <mark_weaver>but I think our gstreamer bindings are far out of date, and not currently usable. <mark_weaver>the last version I see announced is 0.9.91 from 2007 <paroneayea>maybe helpful if you want to look for inspiration from people doing similar stuff <ArneBab>wingo: ^ this could be interesting for your work on native compilation. <ArneBab>it’s just something small - actually stuff I had done weeks ago, but which I had not released. <davexunit>hmm, can't get guile's web server to accept connections from other computers. <davexunit>I see that the default #:addr is INADDR_LOOPBACK, so I tried changing it to INADDR_BROADCAST but had no luck.