From john.thingstad at chello.no Fri Aug 3 20:11:33 2007 From: john.thingstad at chello.no (John Thingstad) Date: Fri, 03 Aug 2007 22:11:33 +0200 Subject: [cl-who-devel] Heap corruption? Message-ID: Below is a selection of code I have written and the output it generates. The part that function generates a nested list of lists for a tree control. My system runs under Huchentoot. I use Lispworks under Windows. The output looks good. I can run it approx 10 times in a row. Then something fails. Among the errors are: 1. MySQL: 2006 - connection lost 2. MySQL: "select * from blog-header where (id = 199)" selector just be one row 3. The browser dons't update at all. When I go back other pages show incorrect data. I have isolated it to navigate-blog, navigate-year and navigate-month functions. I tried completly rewiting it (this is the second version), but get the same problem. Any idea what is happening here? (defun remove-prefix (uri prefix) "Returns the prefix from an uri in search of a blog name. Big assumtion: Blog names consists only of latin characters." (let ((scanstring (concatenate 'string prefix "([A-Za-z]+)"))) (multiple-value-bind (dummy matchvector) (scan-to-strings scanstring uri) (declare (ignore dummy)) (if matchvector (svref matchvector 0) "")))) (defconstant *month-abbrev* (list "jan" "feb" "mar" "apr" "may" "jun" "jul" "aug" "sep" "oct" "nov" "dec")) (defun get-month-string (month) (nth (decf month) *month-abbrev*)) (defun extract-year (date-string) (parse-integer (subseq date-string 0 4))) (defun extract-month (date-string) (parse-integer (subseq date-string 5 7))) ;; Result format: ((year (month (date title url) ...) ...) ...) (defun make-navigate-list (item-list name) (let (last-year last-month year-list month-list result-list) (iter (for item in (reverse item-list)) (let* ((date-string (getf item :pub_time)) (year (extract-year date-string)) (month (extract-month date-string))) (when (or (not last-year) (< year last-year)) (setf last-year year) (setf last-month nil) (when month-list (push (reverse month-list) year-list)) (setf month-list nil) (when year-list (push (reverse year-list) result-list)) (setf year-list (list (format nil "~D" year)))) (when (or (not last-month) (< month last-month)) (setf last-month month) (when month-list (push (reverse month-list) year-list)) (setf month-list (list (get-month-string month)))) (push (list (subseq (getf item :pub_time) 0 10) (or (getf item :title) "") (format nil "~A?id=~D" name (getf item :id))) month-list))) (when month-list (push (reverse month-list) year-list)) (when year-list (push (reverse year-list) result-list)) (reverse result-list))) (defun navigate-month (month-list) (with-html-output-to-string (*standard-output* nil :prologue nil :indent t) (:li (:a :href (format nil "/~A/" (first month-list)) (fmt "~A" (first month-list))) (:ul (iter (for item in (rest month-list)) (htm (:li (:a :href (third item) (fmt "~A ~A" (first item) (second item)))))))))) (defun navigate-year (year-list) (with-html-output-to-string (*standard-output* nil :prologue nil :indent t) (:li (:a :href (format nil "/~A/" (first year-list)) (fmt "~A" (first year-list))) (iter (for month-list in (rest year-list)) (htm (:ul (fmt "~A" (navigate-month month-list)))))))) (defun navigate-blog (items name) (let ((navigate-list (make-navigate-list items name))) (with-html-output-to-string (*standard-output* nil :prologue nil :indent t) (:div :id "bloglist" (:ul :id "navigation" :class "foldertree" (iter (for year-list in navigate-list) (fmt "~A" (navigate-year year-list)))))))) (defun present-blog (blog) (let* ((item-id (or (and (get-parameter "id") (parse-integer (get-parameter "id"))) (latest-blog-item-id (getf blog :name)))) (item (get-blog-item item-id))) (with-html-output-to-string (*standard-output* nil :prologue t :indent t) (:html :xmlns "http://www.w3.org/1999/xhtml" (:head (:title (fmt "~A - ~A" (escape-string (getf blog :title)) (escape-string (getf item :title)))) (:link :href *blog-css-file* :rel "stylesheet" :type "text/css") (:link :href *tree-css-file* :rel "stylesheet" :type "text/css" :media "screen, projection") (:script :type "text/javascript" :src *tree-js-file* "")) (:body (:div :id "left-column" (:a :href *blog-homepage* "Blog home") (fmt "~A" (navigate-blog (get-items (getf blog :id)) (script-name)))) (:div :id "wrapper" (:div :id "header" (:h1 (escape-string (fmt "~A" (escape-string (getf blog :title)))))) (:div :id "main" (if item (htm (:h3 (fmt "~A" (escape-string (getf item :title)))) (:h4 (fmt "~A" (escape-string (getf item :pub_time)))) (:p (fmt "~A" (or (getf item :contents) "")))) (htm (:p (:em "This blog is empty!"))))))))))) (defun no-blog () (with-html-output-to-string (*standard-output* nil :prologue t :indent t) (:html :xmlns "http://www.w3.org/1999/xhtml" (:head (:title "Error") (:link :href *blog-css-file* :rel "stylesheet" :type "text/css")) (:body (:div :id "left-column" (:a :href *blog-homepage* "Blog home")) (:div :id "wrapper" (:div :id "header" (:h1 :class "middle" "Error!")) (:div :id "main" (:h2 :class "middle" "No such page") (:p :class "middle" "The blog that you requested does not exist!"))))))) (defun blog-page () (no-cache) (let ((blog (get-blog (remove-prefix (script-name) *blog-prefix*)))) (if blog (present-blog blog) (no-blog)))) ;;----------------------------------------------------------------------------------------------------------- Which generatates something like the following Many Items blog - Tomorrow
Blog home

Tomorrow

2007-07-18 00:00:00

From john.thingstad at chello.no Fri Aug 3 23:51:12 2007 From: john.thingstad at chello.no (John Thingstad) Date: Sat, 04 Aug 2007 01:51:12 +0200 Subject: [cl-who-devel] Heap corruption? In-Reply-To: References: Message-ID: P? Fri, 03 Aug 2007 22:11:33 +0200, skrev John Thingstad : > Below is a selection of code I have written and the output it generates. > The part that function generates a nested list of lists for a tree > control. > My system runs under Huchentoot. I use Lispworks under Windows. > > The output looks good. > I can run it approx 10 times in a row. > Then something fails. > Among the errors are: > > 1. MySQL: 2006 - connection lost > > 2. MySQL: "select * from blog-header where (id = 199)" > selector just be one row > > 3. The browser dons't update at all. When I go back other pages show > incorrect data. > > I have isolated it to navigate-blog, navigate-year and navigate-month > functions. > I tried completly rewiting it (this is the second version), but get the > same problem. > > Any idea what is happening here? > Arg! The problem is actually in present-blog. It comes from loading the css and script file for the tree control here. That is two more file requests per page. This must cause a race condition. Simply removing (no-cashe) from blog-page makes sure these are loaded only once and the problem goes away. From osei.poku at gmail.com Fri Aug 10 17:40:18 2007 From: osei.poku at gmail.com (Osei Poku) Date: Fri, 10 Aug 2007 13:40:18 -0400 Subject: [cl-who-devel] case sensitivity Message-ID: <20070810174018.GD27601@pokut60> I am evaluating cl-who for the capability of generating svg documents. One issue I have encountered is the viewBox attribute of a top-level svg tag which appears to be case sensitive. so for example: (with-html-output (*standard-output* nil :indent t) (:svg :width "500" :height "400" :viewBox "0 0 1000 800" (:rect :x "1" :y "1" :width "600" :height "500" :fill "none" :stroke-width "4" :stroke "red")) nil) gives: which outputs a rectangle with some of the edges outside the viewable area instead of inside the viewable area. Ideally the point of viewbox is to scale all the coordinates used within the svg tag such that they fit in the specified width and height of the svg tag. Is there a clean way (other than special casing that tag) to create the case sensitive attribute? I am not sure why it is case-sensitive but the following viewers seem to recognize the camelCase version and not the all lowercase version. opera inkscape sketsa SVG graphics editor xara xtreme Thanks, -- Osei Poku From edi at agharta.de Fri Aug 10 21:29:57 2007 From: edi at agharta.de (Edi Weitz) Date: Fri, 10 Aug 2007 23:29:57 +0200 Subject: [cl-who-devel] case sensitivity In-Reply-To: <20070810174018.GD27601@pokut60> (Osei Poku's message of "Fri, 10 Aug 2007 13:40:18 -0400") References: <20070810174018.GD27601@pokut60> Message-ID: On Fri, 10 Aug 2007 13:40:18 -0400, Osei Poku wrote: > Is there a clean way (other than special casing that tag) to create > the case sensitive attribute? No, currently not. We'd need a patch similar to the one for *DOWNCASE-TAGS-P* for that one (or maybe one should subsume downcasing of tags and attributes into one special variable). Cheers, Edi. From opoku at ece.cmu.edu Sat Aug 11 00:21:07 2007 From: opoku at ece.cmu.edu (Osei Poku) Date: Fri, 10 Aug 2007 20:21:07 -0400 Subject: [cl-who-devel] case sensitivity In-Reply-To: References: <20070810174018.GD27601@pokut60> Message-ID: <20070811002107.GH27601@pokut60> On Fri, Aug 10, 2007 at 11:29:57PM +0200, Edi Weitz wrote: > On Fri, 10 Aug 2007 13:40:18 -0400, Osei Poku wrote: > > > Is there a clean way (other than special casing that tag) to create > > the case sensitive attribute? > > No, currently not. We'd need a patch similar to the one for > *DOWNCASE-TAGS-P* for that one (or maybe one should subsume downcasing > of tags and attributes into one special variable). Patch attached. Naturally comments welcome. I did the latter and replaced *DOWNCASE-TAGS-P* with *DOWNCASE-TOKENS-P*. This make both element names and attributes case sensitive when set to nil. > > Cheers, > Edi. > _______________________________________________ > cl-who-devel site list > cl-who-devel at common-lisp.net > http://common-lisp.net/mailman/listinfo/cl-who-devel -- Osei Poku PhD Student, ECE Carnegie Mellon University 412.268.2687 (work) -------------- next part -------------- A non-text attachment was scrubbed... Name: cl-who-case-sensitive.patch Type: text/x-diff Size: 5004 bytes Desc: not available URL: From clnet at genworks.com Tue Aug 14 05:08:03 2007 From: clnet at genworks.com (Dave Cooper) Date: Tue, 14 Aug 2007 01:08:03 -0400 Subject: [cl-who-devel] Fwd: *downcase-tags-p* for attributes, setting *downcase-tags-p* for compile-time In-Reply-To: References: Message-ID: <30eff3110708132208g12a14660g65c8da2c0492ca67@mail.gmail.com> Hi, Has anyone else found it necessary to conditionalize the downcasing of attribute names, like what is currently done with regular tags? For example in the following bit of X3D: (with-html-output (*stream* nil :indent t) (:Shape (:Appearance (:Material :diffuseColor "0 1 0") ... ))) the diffuseColor attribute name needs to have its case preserved. Second question: the *downcase-tags-p* has to be set to nil at compile time. This is probably more of a general Lisp question and not so specific to cl-who, but what is the preferred way of setting a variable like this to a non-default value for the duration of compiling a file, similar to what one would do with a special variable at runtime with (let ((*downcase-tags-p* nil)) ...) or (let (*downcase-tags-p*) ...) ? I am hoping to find something less error-prone (and thread-unsafe) than this: ;; beginning of the file (eval-when (compile load eval) (setq *downcase-tags-p* nil)) ;; ... ;; end of the file (eval-when (compile load eval) (setq *downcase-tags-p* t)) ;; Thanks, -dave -- Dave Cooper, Head of Product Development, Genworks International dave at genworks.com, dave.genworks.com(skype) USA: 248-327-3253(o), 1-800-731-9220(toll-free) UK: +44 (0) 191 645 1699 From edi at agharta.de Fri Aug 24 08:06:00 2007 From: edi at agharta.de (Edi Weitz) Date: Fri, 24 Aug 2007 10:06:00 +0200 Subject: [cl-who-devel] New release 0.11.0 (Was: case sensitivity) In-Reply-To: <20070811002107.GH27601@pokut60> (Osei Poku's message of "Fri, 10 Aug 2007 20:21:07 -0400") References: <20070810174018.GD27601@pokut60> <20070811002107.GH27601@pokut60> Message-ID: On Fri, 10 Aug 2007 20:21:07 -0400, Osei Poku wrote: > Patch attached. Naturally comments welcome. Thanks for the patch which is in the new release. It took me a bit longer to apply it as it wasn't complete - the HTML docs were missing. http://weitz.de/patches.html Cheers, Edi. From edi at agharta.de Fri Aug 24 08:10:25 2007 From: edi at agharta.de (Edi Weitz) Date: Fri, 24 Aug 2007 10:10:25 +0200 Subject: [cl-who-devel] Fwd: *downcase-tags-p* for attributes, setting *downcase-tags-p* for compile-time In-Reply-To: <30eff3110708132208g12a14660g65c8da2c0492ca67@mail.gmail.com> (Dave Cooper's message of "Tue, 14 Aug 2007 01:08:03 -0400") References: <30eff3110708132208g12a14660g65c8da2c0492ca67@mail.gmail.com> Message-ID: On Tue, 14 Aug 2007 01:08:03 -0400, "Dave Cooper" wrote: > Has anyone else found it necessary to conditionalize the downcasing > of attribute names, like what is currently done with regular tags? Yes, you're not the only one - see the new 0.11.0 release. > Second question: the *downcase-tags-p* has to be set to nil at > compile time. Yep, this is by design. You can call it a feature in the sense of optimization, but you can also call it a design flaw as CL-WHO currently doesn't export functionality to compose output at runtime. This would require a major overhaul for which I don't have enough time at the moment. > I am hoping to find something less error-prone (and thread-unsafe) than this: > > ;; beginning of the file > (eval-when (compile load eval) (setq *downcase-tags-p* nil)) > ;; > > ... > > ;; end of the file > (eval-when (compile load eval) (setq *downcase-tags-p* t)) > ;; I'm not aware of a better solution. Maybe the ASDF experts have an idea how this could be done in a more elegant way, but that would be outside the ANSI standard. Cheers, Edi. From osei.poku at gmail.com Fri Aug 24 14:26:23 2007 From: osei.poku at gmail.com (Osei Poku) Date: Fri, 24 Aug 2007 10:26:23 -0400 Subject: [cl-who-devel] New release 0.11.0 (Was: case sensitivity) In-Reply-To: References: <20070810174018.GD27601@pokut60> <20070811002107.GH27601@pokut60> Message-ID: <20070824142623.GC10521@pokut60> On Fri, Aug 24, 2007 at 10:06:00AM +0200, Edi Weitz wrote: > On Fri, 10 Aug 2007 20:21:07 -0400, Osei Poku wrote: > > > Patch attached. Naturally comments welcome. > > Thanks for the patch which is in the new release. It took me a bit > longer to apply it as it wasn't complete - the HTML docs were missing. > > http://weitz.de/patches.html Sorry. I should not have assumed that they were automatically generated. > > Cheers, > Edi. > _______________________________________________ > cl-who-devel site list > cl-who-devel at common-lisp.net > http://common-lisp.net/mailman/listinfo/cl-who-devel -- Osei Poku From helmut at cybernetic-systems.de Sun Aug 26 15:25:50 2007 From: helmut at cybernetic-systems.de (helmut at cybernetic-systems.de) Date: Sun, 26 Aug 2007 17:25:50 +0200 (CEST) Subject: [cl-who-devel] (Str ... in attributes Message-ID: <40165.192.168.168.8.1188141950.squirrel@mail.cyystems.com> Some problems with (str ... Version: $Header: /usr/local/cvsrep/cl-who/cl-who.asd,v 1.16 2007/05/28 18:31:31 edi Exp $ I have an incorrect output when using (str.... as the value of an attribute. (Or is that not allowed?) Helmut Example: CL-USER> (cl-who:with-html-output (*standard-output*) (:input :onmouseover (cl-who:str "style.border=\"thin solid black\";"))) Result NotSoOK:> CL-USER> (cl-who:with-html-output (*standard-output*) (:input :onmouseover "style.border=\"thin solid black\";")) Result OK:> Same with a variable: CL-USER> (let ((ot "style.border=\"thin solid black\";")) (cl-who:with-html-output (*standard-output*) (:input :onmouseover (cl-who:str ot)))) Result NotOK:> CL-USER> (let ((ot "style.border=\"thin solid black\";")) (cl-who:with-html-output (*standard-output*) (:input :onmouseover ot))) Result OK:> From yazicivo at ttnet.net.tr Mon Aug 27 13:34:13 2007 From: yazicivo at ttnet.net.tr (yazicivo at ttnet.net.tr) Date: Mon, 27 Aug 2007 16:34:13 +0300 Subject: [cl-who-devel] Re: (Str ... in attributes Message-ID: <948456.1188221653125.JavaMail.root@fep01.ttnet.net.tr> > I have an incorrect output when using (str.... as the value of an attribute. > (Or is that not allowed?) You shouldn't be using STR/FMT/ESC for attribute values. See CL-WHO documentation related with the syntax. Regards. From helmut at cybernetic-systems.de Tue Aug 28 15:14:43 2007 From: helmut at cybernetic-systems.de (Dr. Helmut G. Enders) Date: Tue, 28 Aug 2007 17:14:43 +0200 Subject: [cl-who-devel] Re: (Str ... in attributes In-Reply-To: <948456.1188221653125.JavaMail.root@fep01.ttnet.net.tr> References: <948456.1188221653125.JavaMail.root@fep01.ttnet.net.tr> Message-ID: <46D43BE3.5070109@cybernetic-systems.de> Honorable yazicivo at ttnet.net.tr writes on 27.08.2007 15:34: > > I have an incorrect output when using (str.... as the value of an attribute. > > (Or is that not allowed?) > > You shouldn't be using STR/FMT/ESC for attribute values. See CL-WHO documentation related with the syntax. > > Thanks, you are right .... As always, RTFM thoroughly isn't a bad idea! Helmut -- CS Cybernetic Systems GmbH Markgrafenstr. 19 D-95100 Selb Germany -- Dr. Helmut G. Enders Phone: +49 9287 9929 11 Fax: +49 9287 9929 32 Email: helmut at cybernetic-systems.de -- COO: Dipl.-Kfm.Univ. Hiltrud Enders County Court: Hof HRB 1968 VAT ID: DE 154589625 --