From stesch at no-spoon.de Thu Feb 2 14:10:00 2006 From: stesch at no-spoon.de (Stefan Scholl) Date: Thu, 2 Feb 2006 15:10:00 +0100 Subject: [tbnl-devel] Re: TBNL file descriptor leak In-Reply-To: References: <20060114184332.GB29042@oja.no> <20060122034111.GA23565@oja.no> <20060122172004.GA29409@oja.no> Message-ID: <20060202141000.GE5598@parsec.no-spoon.de> On 2006-01-23 11:11:25, Edi Weitz wrote: > OK, thanks for the info. I've been thinking about extracting the > relevant bits from KMRCL and integrating them into TBNL directly > anyway. We only use a small fraction of what's in there and it might > make sense to make some of this user-configurable, not only because of > the external format but also because of the interface(s) TBNL will > listen on, for example. I'll do that one day... :) Last time I checked only the following symbols are used: kmrcl:listener kmrcl::with-lock-held kmrcl:close-active-socket kmrcl:init/listener kmrcl::make-lock The locking stuff is easy. But for the sockets I'd try some other, specialized library. Less to maintain for TBNL. Are there any portable libraries for the multiprocesing/threading stuff (Listener)? From edi at agharta.de Wed Feb 8 00:15:51 2006 From: edi at agharta.de (Edi Weitz) Date: Wed, 08 Feb 2006 01:15:51 +0100 Subject: [tbnl-devel] New version 0.9.7 Message-ID: ChangeLog: Version 0.9.7 2006-02-06 More robust computation of content length Download: Cheers, Edi. From edi at agharta.de Wed Feb 8 15:17:15 2006 From: edi at agharta.de (Edi Weitz) Date: Wed, 08 Feb 2006 16:17:15 +0100 Subject: [tbnl-devel] Hunchentoot 0.1.3 released Message-ID: ChangeLog: Version 0.1.3 2006-02-08 Removed KMRCL workaround Download: From emailmac at gmail.com Thu Feb 9 09:38:13 2006 From: emailmac at gmail.com (Mac Chan) Date: Thu, 9 Feb 2006 01:38:13 -0800 Subject: [tbnl-devel] uploading a huge file / ajax progress bar Message-ID: <4877ae640602090138v625c042fodaddaa2c9eef38bc@mail.gmail.com> Hi, I'm trying to see if it's feasible to use lisp + tbnl to build an internal documentation system that allows user to upload huge files. Typically users might upload files with size ranges from 20mb to 600mb. I'm using lispworks as the development platform, but intend to deploy the site in freebsd/linux + sbcl/cmucl. I notice that by uploading a 600mb file on win32 + lispworks + tbnl mod-lisp, the memory usage remains constant (ie. Lispworks is streaming the content directly to disk). However, with either freebsd/cmucl or linux/sbcl, top shows that all of the uploaded contents are first stored in memory and then get written to disk. This is a major scalability problem, I'm not sure if this is a design issue that can be fixed. Since uploading huge files take a bit of time, displaying a progress is a must; otherwise user might think that the browser hangs. It is also good to let them know how long will it take to upload the file so they can check back in couple minutes instead of staring at a stalled screen. There exist some open source implementations for php and ruby. http://www.raditha.com/php/progress.php http://sean.treadway.info/demo/upload/ I quickly went through the tbnl request post initialization routine and the rfc2388 module. It looks like what we need to do is to change rfc2388 to continuously write a report of the current upload progress to a file, and then add an entry point in tbnl to return a html page showing the current progress. This page can be launched by javascript when the upload form is submitted. Am I missing any important piece of information in this picture? If anyone can give me more pointers I would try my hands on this as an exercise. I'm not sure if anyone would find this useful though. Thanks in advance. -- Mac From cyberhigh at gurusnetwork.org Fri Feb 10 05:15:58 2006 From: cyberhigh at gurusnetwork.org (CyBerHigh) Date: Thu, 09 Feb 2006 21:15:58 -0800 Subject: [tbnl-devel] tbnl configuration Message-ID: <43EC218E.4000309@gurusnetwork.org> Hello I am trying to set up my first running of tbnl. Well, I got everything working to a point. I am using apache 12 and SBCL as my lisp. TBNL works, I can go to the test page and everything works on it. The problem with my set up is that it doesn't seem to be able to do anything else besides the default pages. Like, I tried to make it so that everything inside of /asp would be ran with TBNL server, however it just gives me a page saying that TBNL isn't proberly configured yet. Any idea as to how I can set it so this will work? Also is is possible for me to be able to set up apache to handle any file with the .lisp extention as a lisp file and send it to TBNL server? As I was playing with the test page I noticed that the server didn't seem very responsive. Well, it was on the first load but as soon as I would click on a link the page would like hang. Infact it never would load the page, I am not sure if this is because I havn't configured something right. If it is always like this could you let me know, because it wouldn't be very suited for production use if I can't get past the first page easyly. I am not saying that I couldn't ever, I had to click on the link a bunch and finally it would switch. Or I would have to wait like 5 mins then I could change the page. That IMO isn't very usfull for production. Is there a fix to this slow responsivness? Thank you From edi at agharta.de Fri Feb 10 07:37:42 2006 From: edi at agharta.de (Edi Weitz) Date: Fri, 10 Feb 2006 08:37:42 +0100 Subject: [tbnl-devel] uploading a huge file / ajax progress bar In-Reply-To: <4877ae640602090138v625c042fodaddaa2c9eef38bc@mail.gmail.com> (Mac Chan's message of "Thu, 9 Feb 2006 01:38:13 -0800") References: <4877ae640602090138v625c042fodaddaa2c9eef38bc@mail.gmail.com> Message-ID: Hi! On Thu, 9 Feb 2006 01:38:13 -0800, Mac Chan wrote: > I notice that by uploading a 600mb file on win32 + lispworks + tbnl > mod-lisp, the memory usage remains constant (ie. Lispworks is > streaming the content directly to disk). > > However, with either freebsd/cmucl or linux/sbcl, top shows that all > of the uploaded contents are first stored in memory and then get > written to disk. This is a major scalability problem, I'm not sure > if this is a design issue that can be fixed. This should not happen. Maybe you're using older versions of TBNL here? The code which is responsible for the streaming was inadvertently left out from some released versions. > I quickly went through the tbnl request post initialization routine > and the rfc2388 module. It looks like what we need to do is to > change rfc2388 to continuously write a report of the current upload > progress to a file, and then add an entry point in tbnl to return a > html page showing the current progress. This page can be launched by > javascript when the upload form is submitted. > > Am I missing any important piece of information in this picture? If > anyone can give me more pointers I would try my hands on this as an > exercise. I'm not sure if anyone would find this useful though. What you describe seems to be the usual way to do it. I also did something similar once for a mod_perl application. As far as changing RFC2388 is concerned, it would be nice if we could convince Janis to add the changes to his distributions (and therefore make them unobtrusive so they won't bother non-TBNL users). Thanks, Edi. From edi at agharta.de Fri Feb 10 07:46:29 2006 From: edi at agharta.de (Edi Weitz) Date: Fri, 10 Feb 2006 08:46:29 +0100 Subject: [tbnl-devel] tbnl configuration In-Reply-To: <43EC218E.4000309@gurusnetwork.org> (cyberhigh@gurusnetwork.org's message of "Thu, 09 Feb 2006 21:15:58 -0800") References: <43EC218E.4000309@gurusnetwork.org> Message-ID: Hi! On Thu, 09 Feb 2006 21:15:58 -0800, CyBerHigh wrote: > I am using apache 12 Er, Apache 12? > Like, I tried to make it so that everything inside of /asp would be > ran with TBNL server, however it just gives me a page saying that > TBNL isn't proberly configured yet. Any idea as to how I can set it > so this will work? Yes, sure. Why don't you tell us how your handlers and dispatchers look like? If you've just changed the Apache location from /tbnl to /asp, you won't see anything but the default page with the test code because the test code checks for URLs starting with /tbnl/test. My guess is that this might be your problem. > Also is is possible for me to be able to set up apache to handle any > file with the .lisp extention as a lisp file and send it to TBNL > server? This should do it: AddHandler lisp-handler .lisp > As I was playing with the test page I noticed that the server didn't > seem very responsive. I haven't seen that here. This is SBCL on which OS? If it isn't a recent version with native threads on Linux/x86 with a 2.6.x kernel, then you must switch to another Lisp like CMUCL[1], LispWorks, or AllegroCL. TBNL needs a Lisp with MP capabilities - see documentation. HTH, Edi. [1] For CMUCL don't forget the usual (mp::startup-idle-and-top-level-loops) From travis at crosswirecorp.com Fri Feb 10 05:48:27 2006 From: travis at crosswirecorp.com (Travis Cross) Date: Fri, 10 Feb 2006 00:48:27 -0500 Subject: [tbnl-devel] uploading a huge file / ajax progress bar In-Reply-To: <4877ae640602090138v625c042fodaddaa2c9eef38bc@mail.gmail.com> References: <4877ae640602090138v625c042fodaddaa2c9eef38bc@mail.gmail.com> Message-ID: <43EC292B.2050302@crosswirecorp.com> > I'm not sure if anyone would find this useful though. I for one would find this useful. It would also serve to make TBNL a more compelling system, as this is a hard problem to solve at the application level in many frameworks. > If anyone can give me more pointers I would try my hands on this You seem to have identified the key points. I will take a look through the code and see if I can add anything that might be useful to you. Cheers, -- Travis Mac Chan wrote: > Hi, > > I'm trying to see if it's feasible to use lisp + tbnl to build an > internal documentation system that allows user to upload huge files. > > Typically users might upload files with size ranges from 20mb to 600mb. > > I'm using lispworks as the development platform, but intend to deploy > the site in freebsd/linux + sbcl/cmucl. > > I notice that by uploading a 600mb file on win32 + lispworks + tbnl > mod-lisp, the memory usage remains constant (ie. Lispworks is > streaming the content directly to disk). > > However, with either freebsd/cmucl or linux/sbcl, top shows that all > of the uploaded contents are first stored in memory and then get > written to disk. This is a major scalability problem, I'm not sure if > this is a design issue that can be fixed. > > Since uploading huge files take a bit of time, displaying a progress > is a must; otherwise user might think that the browser hangs. It is > also good to let them know how long will it take to upload the file so > they can check back in couple minutes instead of staring at a stalled > screen. > > There exist some open source implementations for php and ruby. > http://www.raditha.com/php/progress.php > http://sean.treadway.info/demo/upload/ > > I quickly went through the tbnl request post initialization routine > and the rfc2388 module. It looks like what we need to do is to change > rfc2388 to continuously write a report of the current upload progress > to a file, and then add an entry point in tbnl to return a html page > showing the current progress. This page can be launched by javascript > when the upload form is submitted. > > Am I missing any important piece of information in this picture? > If anyone can give me more pointers I would try my hands on this as an > exercise. I'm not sure if anyone would find this useful though. > > Thanks in advance. > -- Mac > _______________________________________________ > tbnl-devel site list > tbnl-devel at common-lisp.net > http://common-lisp.net/mailman/listinfo/tbnl-devel From edi at agharta.de Fri Feb 10 12:03:18 2006 From: edi at agharta.de (Edi Weitz) Date: Fri, 10 Feb 2006 13:03:18 +0100 Subject: [tbnl-devel] Re: [Lispweb] tbnl: what package? In-Reply-To: <20060210111519.GS9719@ocean.vvo.ru> (Igor Plekhov's message of "Fri, 10 Feb 2006 21:15:19 +1000") References: <20060210111519.GS9719@ocean.vvo.ru> Message-ID: [This is probably better asked on the TBNL mailing list.] On Fri, 10 Feb 2006 21:15:19 +1000, Igor Plekhov wrote: > In TBNL some functions are created to handle incoming requests. Functions are created? You're talking about your own handlers or something else? > What package are they executed in? I.e. what package *PACKAGE* is > bound to? How can I control it? In your own functions you can rebind *PACKAGE* to your liking. (let ((*package* (my-function))) ;; do something ) For existing TBNL functions the package shouldn't matter with the exception of READ-FROM-STRING* the behaviour of which is documented: Does that answer your question or am I misunderstanding? From edi at agharta.de Fri Feb 10 13:02:13 2006 From: edi at agharta.de (Edi Weitz) Date: Fri, 10 Feb 2006 14:02:13 +0100 Subject: [tbnl-devel] tbnl configuration In-Reply-To: <43EC879F.8020304@gurusnetwork.org> (cyberhigh@gurusnetwork.org's message of "Fri, 10 Feb 2006 04:31:27 -0800") References: <43EC218E.4000309@gurusnetwork.org> <43EC879F.8020304@gurusnetwork.org> Message-ID: [Please use the mailing list.] On Fri, 10 Feb 2006 04:31:27 -0800, CyBerHigh wrote: > Sorry I ment Apache 13 with mod_lisp. There is no Apache 13. You probably mean 1.3. > I am on Freebsd 5.4 with SBCL .0.9.9 OK, then you don't have threads. That explains your problems. > My handler looks like this > LispServer 127.0.0.1 3000 "tbnl" > AddHandler lisp-handler .lisp > > SetHandler lisp-handler > That's not the kind of handler I was talking about. I meant your Lisp handlers. > Now, adding the .lisp part helped out, I can now get it to error out > saying something isn't configured write, when I try to go to a .lisp > file. I tryed to put a simple (format t "hello, world") into the > file but it gave me the same thing. Where do you expect the output of FORMAT to go? > I can't tell where it is erroring out at, because it doesn't put it > into the error log nor does it print it to the screen. What do you see in Apache's access log? > Any idea as to how I can get it printed out? Get what printed out? You can use LOG-MESSAGE to write to the error log. > It is possible that the slowness I was experincing could have been > from it being misconfigured. I think it's because you don't have threads. On FreeBSD use CMUCL. Cheers, Edi. From download at hpc.unm.edu Fri Feb 10 13:25:45 2006 From: download at hpc.unm.edu (Jim Prewett) Date: Fri, 10 Feb 2006 06:25:45 -0700 (MST) Subject: [tbnl-devel] Re: [Lispweb] tbnl: what package? In-Reply-To: References: <20060210111519.GS9719@ocean.vvo.ru> Message-ID: -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 I'm guessing this is what I just ran into and the answer is your new function names and symbols will be interned in :CL-USER :) I'd love to know how to change that, but haven't bothered to dig yet. (in my case, :CL-USER would be my second choice after one of my own packages) In my case, I had code that uses the multi-method dispatch mechanism to display the right page (I'm not yet sure if thats a good idea :) something like this: (defmethod display-page (page-name (eql 'login-page)) ... ) To convert the text strings given by the user into the right symbol (so this dispatch mecnhanism can work), I must intern them in the :CL-USER package. This did take me a while to figure out and *I* couldn't find it in the documentation anywhere. (I guess, maybe, it should have been obvious, but I still consider myself mostly a Lisp newbie). I believe my CMUCL Lisp starts with a core file causing it to start in :Jims-PackageA, then I've been loading a file (that causes TBNL and all that good stuff to be loaded) and immediately switching to :Jims-PackageB, so it was really confusing to be using the :CL-USER package at all. :) I hope this helps, Jim James E. Prewett Jim at Prewett.org download at hpc.unm.edu Systems Team Leader LoGS: http://www.hpc.unm.edu/~download/LoGS/ Designated Security Officer OpenPGP key: pub 1024D/31816D93 HPC Systems Engineer III UNM HPC 505.277.8210 On Fri, 10 Feb 2006, Edi Weitz wrote: > [This is probably better asked on the TBNL mailing list.] > > On Fri, 10 Feb 2006 21:15:19 +1000, Igor Plekhov wrote: > > > In TBNL some functions are created to handle incoming requests. > > Functions are created? You're talking about your own handlers or > something else? > > > What package are they executed in? I.e. what package *PACKAGE* is > > bound to? How can I control it? > > In your own functions you can rebind *PACKAGE* to your liking. > > (let ((*package* (my-function))) > ;; do something > ) > > For existing TBNL functions the package shouldn't matter with the > exception of READ-FROM-STRING* the behaviour of which is documented: > > > > Does that answer your question or am I misunderstanding? > _______________________________________________ > tbnl-devel site list > tbnl-devel at common-lisp.net > http://common-lisp.net/mailman/listinfo/tbnl-devel > -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.1 (GNU/Linux) Comment: Made with pgp4pine 1.76 iD8DBQFD7JRhv/zdxjGBbZMRAiLAAKCOXmJCkb90Iggd3184shHqXFTRwACfRTsS EHOz1zmgJHMTN9rD0QToHDk= =qR6P -----END PGP SIGNATURE----- From edi at agharta.de Fri Feb 10 15:09:00 2006 From: edi at agharta.de (Edi Weitz) Date: Fri, 10 Feb 2006 16:09:00 +0100 Subject: [tbnl-devel] Re: [Lispweb] tbnl: what package? In-Reply-To: (Jim Prewett's message of "Fri, 10 Feb 2006 06:25:45 -0700 (MST)") References: <20060210111519.GS9719@ocean.vvo.ru> Message-ID: On Fri, 10 Feb 2006 06:25:45 -0700 (MST), Jim Prewett wrote: > I'm guessing this is what I just ran into and the answer is your new > function names and symbols will be interned in :CL-USER :) I'd love > to know how to change that, but haven't bothered to dig yet. (in my > case, :CL-USER would be my second choice after one of my own > packages) > > In my case, I had code that uses the multi-method dispatch mechanism > to display the right page (I'm not yet sure if thats a good idea :) > something like this: > > (defmethod display-page (page-name (eql 'login-page)) > ... ) > > To convert the text strings given by the user into the right symbol > (so this dispatch mecnhanism can work), I must intern them in the > :CL-USER package. > > This did take me a while to figure out and *I* couldn't find it in > the documentation anywhere. (I guess, maybe, it should have been > obvious, but I still consider myself mostly a Lisp newbie). I > believe my CMUCL Lisp starts with a core file causing it to start in > :Jims-PackageA, then I've been loading a file (that causes TBNL and > all that good stuff to be loaded) and immediately switching to > :Jims-PackageB, so it was really confusing to be using the :CL-USER > package at all. :) Hmm. It /seems/ to me that both of you are rather talking about general problems with packages and not about TBNL in particular. TBNL itself never interns symbols except when it creates keywords, and in this case the package is clearly defined. You should always create your own package to work in if you write code, don't use CL-USER. See test.lisp in TBNL for an example. If your code looks like this (defmethod display-page (page-name (eql 'login-page)) ... ) then LOGIN-PAGE will be a symbol accessible in the package you're in, i.e. the package of the file the method is defined in (assuming you used LOAD to load the file). In 99.9% of all cases this should be the package you find in the very first line starting with IN-PACKAGE. If you don't have such a line there - see above... :) Sorry if that sounds patronizing, maybe I'm again missing the point. Cheers, Edi. From download at hpc.unm.edu Fri Feb 10 15:52:20 2006 From: download at hpc.unm.edu (Jim Prewett) Date: Fri, 10 Feb 2006 08:52:20 -0700 (MST) Subject: [tbnl-devel] Re: [Lispweb] tbnl: what package? In-Reply-To: References: <20060210111519.GS9719@ocean.vvo.ru> Message-ID: I think you're missing the point Edi :) Here is a simple example that I think gets to the heart of the problem: I'm certainly not claiming that this isn't a problem with my understanding, however :) When you visit /foo, the webpage returned displays this text: "package: #" What I'm not understanding is *why* that is what is displayed. I would have hoped for "package: #". (defpackage :mypackage) (in-package :mypackage) (defun some-func () (cl-who:with-html-output-to-string (*standard-output* nil :prologue nil :indent nil) (:HTML (:HEAD (:TITLE "foo")) (:BODY (cl-who:str (CL-WHO:ESCAPE-STRING (format () "package: ~A" *package*))))))) (setq tbnl:*dispatch-table* (list (tbnl:create-prefix-dispatcher "/foo" #'some-func))) Jim James E. Prewett Jim at Prewett.org download at hpc.unm.edu Systems Team Leader LoGS: http://www.hpc.unm.edu/~download/LoGS/ Designated Security Officer OpenPGP key: pub 1024D/31816D93 HPC Systems Engineer III UNM HPC 505.277.8210 On Fri, 10 Feb 2006, Edi Weitz wrote: > On Fri, 10 Feb 2006 06:25:45 -0700 (MST), Jim Prewett wrote: > > > I'm guessing this is what I just ran into and the answer is your new > > function names and symbols will be interned in :CL-USER :) I'd love > > to know how to change that, but haven't bothered to dig yet. (in my > > case, :CL-USER would be my second choice after one of my own > > packages) > > > > In my case, I had code that uses the multi-method dispatch mechanism > > to display the right page (I'm not yet sure if thats a good idea :) > > something like this: > > > > (defmethod display-page (page-name (eql 'login-page)) > > ... ) > > > > To convert the text strings given by the user into the right symbol > > (so this dispatch mecnhanism can work), I must intern them in the > > :CL-USER package. > > > > This did take me a while to figure out and *I* couldn't find it in > > the documentation anywhere. (I guess, maybe, it should have been > > obvious, but I still consider myself mostly a Lisp newbie). I > > believe my CMUCL Lisp starts with a core file causing it to start in > > :Jims-PackageA, then I've been loading a file (that causes TBNL and > > all that good stuff to be loaded) and immediately switching to > > :Jims-PackageB, so it was really confusing to be using the :CL-USER > > package at all. :) > > Hmm. It /seems/ to me that both of you are rather talking about > general problems with packages and not about TBNL in particular. TBNL > itself never interns symbols except when it creates keywords, and in > this case the package is clearly defined. > > You should always create your own package to work in if you write > code, don't use CL-USER. See test.lisp in TBNL for an example. > > If your code looks like this > > (defmethod display-page (page-name (eql 'login-page)) > ... ) > > then LOGIN-PAGE will be a symbol accessible in the package you're in, > i.e. the package of the file the method is defined in (assuming you > used LOAD to load the file). In 99.9% of all cases this should be the > package you find in the very first line starting with IN-PACKAGE. If > you don't have such a line there - see above... :) > > Sorry if that sounds patronizing, maybe I'm again missing the point. > > Cheers, > Edi. > From edi at agharta.de Fri Feb 10 17:12:35 2006 From: edi at agharta.de (Edi Weitz) Date: Fri, 10 Feb 2006 18:12:35 +0100 Subject: [tbnl-devel] Re: [Lispweb] tbnl: what package? In-Reply-To: (Jim Prewett's message of "Fri, 10 Feb 2006 08:52:20 -0700 (MST)") References: <20060210111519.GS9719@ocean.vvo.ru> Message-ID: On Fri, 10 Feb 2006 08:52:20 -0700 (MST), Jim Prewett wrote: > I think you're missing the point Edi :) I don't... :) > Here is a simple example that I think gets to the heart of the > problem: I'm certainly not claiming that this isn't a problem with > my understanding, however :) > > When you visit /foo, the webpage returned displays this text: > "package: #" > > What I'm not understanding is *why* that is what is displayed. I > would have hoped for "package: #". > > (defpackage :mypackage) > (in-package :mypackage) > > (defun some-func () > (cl-who:with-html-output-to-string (*standard-output* nil :prologue nil > :indent nil) > (:HTML > (:HEAD > (:TITLE "foo")) > (:BODY > (cl-who:str > (CL-WHO:ESCAPE-STRING > (format () "package: ~A" *package*))))))) > > (setq tbnl:*dispatch-table* > (list (tbnl:create-prefix-dispatcher > "/foo" > #'some-func))) Why should it display #? *PACKAGE* is a runtime concept, it's not a literal constant that's hard-coded into the function when you compile it: CL-USER 1 > (defpackage :foo (:use :cl)) # CL-USER 2 > (in-package :foo) # FOO 3 > (defun foo () *package*) FOO FOO 4 > (foo) # FOO 5 > (in-package :cl-user) # CL-USER 6 > (foo::foo) # The package you see in your example depends on how (from where) you started TBNL and how (from where) the thread that handles the request is invoked. The ANSI standard doesn't specify the package newly created threads start in (because it doesn't mention MP) but your Lisp's documentation will probably tell you. I think it's not unusual (and makes sense) to just re-bind *PACKAGE* to *PACKAGE*. So, the important part is missing in your example above: When and how did you invoke TBNL:START-TBNL? I bet you did that from CL-USER and you will see a different result if you start it from MYPACKAGE. If you're doing something with packages at runtime you should always re-bind *PACKAGE* - or in the case of INTERN you should use its second argument. Cheers, Edi. From edi at agharta.de Fri Feb 10 17:26:52 2006 From: edi at agharta.de (Edi Weitz) Date: Fri, 10 Feb 2006 18:26:52 +0100 Subject: [tbnl-devel] Re: [Lispweb] tbnl: what package? In-Reply-To: <43ECCC17.5080801@crosswirecorp.com> (Travis Cross's message of "Fri, 10 Feb 2006 12:23:35 -0500") References: <20060210111519.GS9719@ocean.vvo.ru> <43ECCC17.5080801@crosswirecorp.com> Message-ID: On Fri, 10 Feb 2006 12:23:35 -0500, Travis Cross wrote: > (let ((*package* (find-package :keyword))) > (format nil "package: ~a~%query=BAR?: ~a~%" *package* > (eq :bar (intern (or (tbnl:parameter "query") > "BAR"))))) Or simply (intern (or (tbnl:parameter "query") "BAR") :keyword) From travis at crosswirecorp.com Fri Feb 10 17:23:35 2006 From: travis at crosswirecorp.com (Travis Cross) Date: Fri, 10 Feb 2006 12:23:35 -0500 Subject: [tbnl-devel] Re: [Lispweb] tbnl: what package? In-Reply-To: References: <20060210111519.GS9719@ocean.vvo.ru> Message-ID: <43ECCC17.5080801@crosswirecorp.com> (we are now well outside of TBNL land...) Jim Prewett wrote: > When you visit /foo, the webpage returned displays this text: > "package: #" I experienced a nasty bug awhile back caused by similar confusion. I was reading from a stream at runtime and expecting the package to be bound to the package in effect in the source code. Wrong. Or at least, wrong some of the time, which caused a debugging nightmare: the code worked correctly when started from SLIME, but failed when SBCL was started by my init scripts. It took me some time to understand what was going on. > What I'm not understanding is *why* that is what is displayed. The explanation is this: IN-PACKAGE only binds *package* at compile-time. At runtime, it is your responsibility to ensure the correct package is dynamically bound. The hyperspec does not make this point very clearly at all. If you are reading symbols at runtime for the purpose of comparison, I recommend using the keyword package. The example then becomes something more akin to: (defpackage :mypackage (:use :cl)) (in-package :mypackage) (defun some-func () (cl-who:with-html-output-to-string (*standard-output* nil :prologue nil :indent nil) (:html (:head (:title "foo")) (:body (cl-who:str (cl-who:escape-string (let ((*package* (find-package :keyword))) (format nil "package: ~a~%query=BAR?: ~a~%" *package* (eq :bar (intern (or (tbnl:parameter "query") "BAR"))))))))))) (setq tbnl:*dispatch-table* (list (tbnl:create-prefix-dispatcher "/tbnl/foo" #'some-func))) Cheers, -- Travis From download at hpc.unm.edu Fri Feb 10 17:52:20 2006 From: download at hpc.unm.edu (Jim Prewett) Date: Fri, 10 Feb 2006 10:52:20 -0700 (MST) Subject: [tbnl-devel] Re: [Lispweb] tbnl: what package? In-Reply-To: References: <20060210111519.GS9719@ocean.vvo.ru> Message-ID: Ah-Ha! It must be something to do with the threads as you say. I seem to get the same result reguardless of which package I start TBNL from. FWIW, I'm using CMU Common Lisp 19b (19B) on FreeBSD 4.11-STABLE. I still get the same result reguardless of which package I start TBNL from. My file now looks like this: (defpackage :mypackage) (in-package :mypackage) (tbnl:start-tbnl) (defun some-func () (cl-who:with-html-output-to-string (*standard-output* nil :prologue nil :indent nil) (:HTML (:HEAD (:TITLE "foo")) (:BODY (cl-who:str (CL-WHO:ESCAPE-STRING (format () "package: ~A" *package*))))))) (setq tbnl:*dispatch-table* (list (tbnl:create-prefix-dispatcher "/foo" #'some-func))) > Why should it display #? *PACKAGE* is a runtime > concept, it's not a literal constant that's hard-coded into the > function when you compile it: Right. The point of my example was to show that, at runtime, *PACKAGE* seems to always be bound to :COMMON-LISP-USER for any function I run inside of TBNL. My cureosity is why does that happen; while I haven't yet looked at the CMUCL thread documentation, my guess is that it is related to threads. > The package you see in your example depends on how (from where) you > started TBNL and how (from where) the thread that handles the request > is invoked. Under CMUCL, I see that the former (where TBNL is started) has no effect. My guess is that, for whatever reason, the thread is launched in the :COMMON-LISP-USER package. > So, the important part is missing in your example above: When and how > did you invoke TBNL:START-TBNL? I bet you did that from CL-USER and > you will see a different result if you start it from MYPACKAGE. It doesn't seem to matter. :) In my original email, I stated that my Lisp environment is set up such that I *NEVER* see the CL-USER package which is why I found it so strange that *PACKAGE* would ever be set to :COMMON-LISP-USER! > If you're doing something with packages at runtime you should always > re-bind *PACKAGE* - or in the case of INTERN you should use its second > argument. Thats probably the advice I was looking for :) Sorry for being so dense :) Jim From edi at agharta.de Fri Feb 10 17:57:51 2006 From: edi at agharta.de (Edi Weitz) Date: Fri, 10 Feb 2006 18:57:51 +0100 Subject: [tbnl-devel] Re: [Lispweb] tbnl: what package? In-Reply-To: (Jim Prewett's message of "Fri, 10 Feb 2006 10:52:20 -0700 (MST)") References: <20060210111519.GS9719@ocean.vvo.ru> Message-ID: On Fri, 10 Feb 2006 10:52:20 -0700 (MST), Jim Prewett wrote: > Ah-Ha! It must be something to do with the threads as you say. FWIW, it might also be related to how KMRCL invokes the threads. I saw different packages when I tried your example with LispWorks. From edi at agharta.de Sun Feb 12 21:23:15 2006 From: edi at agharta.de (Edi Weitz) Date: Sun, 12 Feb 2006 22:23:15 +0100 Subject: [tbnl-devel] tbnl configuration In-Reply-To: <43EFC127.6030708@gurusnetwork.org> (cyberhigh@gurusnetwork.org's message of "Sun, 12 Feb 2006 15:13:43 -0800") References: <43EC218E.4000309@gurusnetwork.org> <43EFC127.6030708@gurusnetwork.org> Message-ID: Please use the mailing list. On Sun, 12 Feb 2006 15:13:43 -0800, CyBerHigh wrote: > Does CLISP offer threads on Freebsd and on linux? No, CLISP doesn't have threads on any platform. From emailmac at gmail.com Tue Feb 14 00:15:33 2006 From: emailmac at gmail.com (Mac Chan) Date: Mon, 13 Feb 2006 16:15:33 -0800 Subject: [tbnl-devel] uploading a huge file / ajax progress bar In-Reply-To: References: <4877ae640602090138v625c042fodaddaa2c9eef38bc@mail.gmail.com> Message-ID: <4877ae640602131615u5b0d2048gc382e456223c0d2@mail.gmail.com> On 2/9/06, Edi Weitz wrote: > This should not happen. Maybe you're using older versions of TBNL > here? The code which is responsible for the streaming was > inadvertently left out from some released versions. I forget what version of tbnl I was testing with, but it was the latest one when I tried it. I'll report back when I have time to do this test again. > What you describe seems to be the usual way to do it. I also did > something similar once for a mod_perl application. > > As far as changing RFC2388 is concerned, it would be nice if we could > convince Janis to add the changes to his distributions (and therefore > make them unobtrusive so they won't bother non-TBNL users). I spent sometime reading the perl code by Raditha Dissanayake (http://www.raditha.com/php/progress.php) and implementede the same idea in tbnl. Basically, before the user submits a file, we need to create a unique identifier (at least unique for each user) and associate this id with the form post request. We then pass this id to a popup page so it can poll the uploading progress. Since the file upload will be part of a multipart/form-data stream, it's easier to pass the id in the query string and rearrange the initialization order of the get-parameters and post-parameters. This way by the time we are saving the file (post-parameters) we'll have the id ready (get-parameters). There might be a cleaner way to do this but I don't know better. Please take a look and feel free to change it or make it sucks less (I'm not trying to create more work for Edi or anyone though). TBNL is really a lot more fun than other web frameworks I've used. Cheers, -- Mac -------------- next part -------------- A non-text attachment was scrubbed... Name: rfc2388.patch Type: application/octet-stream Size: 9423 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: file_upload.patch Type: application/octet-stream Size: 16453 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: packages.lisp Type: application/octet-stream Size: 6819 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: specials.lisp Type: application/octet-stream Size: 13242 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: request.lisp Type: application/octet-stream Size: 21701 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: test.lisp Type: application/octet-stream Size: 26958 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: rfc2388.lisp Type: application/octet-stream Size: 20051 bytes Desc: not available URL: From edi at agharta.de Tue Feb 14 09:38:26 2006 From: edi at agharta.de (Edi Weitz) Date: Tue, 14 Feb 2006 10:38:26 +0100 Subject: [tbnl-devel] uploading a huge file / ajax progress bar In-Reply-To: <4877ae640602131615u5b0d2048gc382e456223c0d2@mail.gmail.com> (Mac Chan's message of "Mon, 13 Feb 2006 16:15:33 -0800") References: <4877ae640602090138v625c042fodaddaa2c9eef38bc@mail.gmail.com> <4877ae640602131615u5b0d2048gc382e456223c0d2@mail.gmail.com> Message-ID: On Mon, 13 Feb 2006 16:15:33 -0800, Mac Chan wrote: > Please take a look and feel free to change it or make it sucks less > (I'm not trying to create more work for Edi or anyone though). Thanks for the patch. We're in the process of moving to a new flat, so I probably won't have much time to review this in the next days. Maybe at the end of the month. > TBNL is really a lot more fun than other web frameworks I've used. Thanks... :) Cheers, Edi.