Menu

Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Show posts Menu

Topics - Jeremy Reimer

#1
Hi again,



I'm building a simple web application in newlisp using the Dragonfly framework, which I really like using.  However I can't seem to delete cookies using the (Response:cookie) command.



I can set the cookie easily using this code:



(Response:cookie "monarch" username (date-value 2011 12 12) "/") ; open a cookie to say we are signed in


That makes a cookie and I can check for the presence of the cookie by searching for it in ($COOKIES), and even by searching cookies in my web browser.  It's definitely there.  The problem is that I can never get rid of it!



According to the Dragonfly reference manual, the way to get rid of the cookie is to reference it and assign it a value of "nil":



(Response:cookie "monarch" nil) ; delete cookie


But this doesn't work!  The cookie is there forever (well, until it expires in 2011).  How can I get rid of it?



I'm using newLISP 10.2.8 and Dragonfly 0.70 on Apache on Linux.
#2
Hi folks,



I'm trying to get the upload.cgi script to work from this thread:



http://newlispfanclub.alh.net/forum/viewtopic.php?f=2&t=2585">http://newlispfanclub.alh.net/forum/vie ... f=2&t=2585">http://newlispfanclub.alh.net/forum/viewtopic.php?f=2&t=2585



I'm running Apache 2 on Ubuntu Linux.  I've used the version of the script for newLISP 10 but no matter what I do I get the error "wrong upload format" when the code reaches this point:



(if (not (find ".*filename="(.*)".*" disposition 1))
(throw-error "Error: wrong upload format"))


I've set permissions for the upload directory to 755 and upload.cgi to 777.  When I check my server, it seems like the script is creating the temporary file "upload-file", but never populating it with anything, as it always ends up as 0 bytes.  Since there is never anything in the temporary file, the symbol "disposition" which is set as (read-line "upload-file"), ends up being nil, and thus the script throws the error at the above point.



Is there something wrong with the script?  Does it have to be updated for newlisp 10.2.8?  It seems to me that it is never executing this while loop:



(while (read-buffer (device) buffer 1024)
   (write-buffer infile buffer))


And thus the file "upload-file" never gets written with anything.  



Thanks for your help!
#3
Hi folks,



Say I have a large list (say, 40,000 records) that takes about five seconds to load with the load("40klist.lsp") command.  I'd like to keep this list in memory when the user navigates to another web page on the same site, so that each page that needs to reference the list won't have the same five second delay.  Is this at all possible?  



Thanks!
#4
Hi all! Thanks for your incredible help so far.



I've come across a puzzler: I am using xml-parse to extract data from an XML feed and into a newLISP list.  This is the function I'm using:



(define (parse-xml-data str)
   (xml-type-tags nil nil nil nil)
      (let ((xml (xml-parse str 15 'Yamato)))
        (or xml (throw-error (xml-error)))))


I'm using "'Yamato" to try and save the resulting list in a different context, so that any symbols that are created don't conflict with existing symbols in newLISP's MAIN context, or in the Dragonfly context.  However, this doesn't seem to work, as I get the resulting SXML list back:



((Yamato:document (Yamato:element ((Yamato:name "First") (date "4/23/2010")) (Yamato:data "This is the first element")) (Yamato:element ((Yamato:name "Second") (date "4/23/2010")) (Yamato:data "This is the second element"))))


Every symbol is now in the "Yamato" context, except for "date".  "date" is a symbol in the Dragonfly context.  I want it also to be in the Yamato context, but it seems like the Dragonfly context is overriding this when xml-parse converts the XML element names into symbols.  How can I stop this and force every element into the Yamato context?  



Thanks for your help!
#5
Hi folks,



I'm trying to build a field selector in newLISP.  Right now I have the code:



(define (multi-select-box inputlist)
(let (a "")
(extend a "<form action='multi-select-submit.cgi'")
(dolist (x inputlist)
(extend a "<input type='checkbox' name='input' value='" (string x) "'>" (string x) "<br>"))
(extend a "<input type='submit' value='Submit'>")
(extend a "</form>")
a))


What this function does is return a string that creates a multi-select HTML form (with checkboxes) based on a list.  This string can then be printed to the web page.  When the user clicks "Submit", it redirects to a URL like this one:



http://localhost:8080/multi-select-submit.cgi?input=document&input=element">http://localhost:8080/multi-select-subm ... ut=element">http://localhost:8080/multi-select-submit.cgi?input=document&input=element



Now, from that URL I can probably extract the form values input=document and input=element.  But I'm not sure how to get the current URL in the first place.  



I am using newLISP and Dragonfly to serve the web pages.



Thanks for any help you can provide!
#6
Hello!  I'm just getting started with newLISP, and I really like it a lot.  Forgive the newbie questions.



I have a test XML file called dingy.xml that looks like this:



<document>
<element name="First" date="4/23/2010">
  <data>This is the first element</data>
</element>
<element name="Second" date="4/23/2010">
  <data>This is the second element</data>
</element>
</document>


I am parsing with xml-parse using this code:



(define (parse-xml-data str)
  (xml-type-tags nil nil nil nil)
  (let ((xml (xml-parse str 15)))
       (or xml (throw-error (xml-error)))))

  (setq parsedlist (parse-xml-data (read-file "./dingy.xml")))


This returns an s-xml list as follows:



((document (element ((name "First") (date "4/23/2010")) (data "This is the first element")) (element ((name "Second") (date "4/23/2010")) (data "This is the second element"))))



Now, I am able to search and retrieve, say, all items with the type "data" using this code:



(dolist (el (ref-all 'data parsedlist))
         (println (rest (parsedlist (chop el)))))


This gives me back the following result:



("This is the first element")



("This is the second element")



This is great!  But now my question is this:  how could I find all the "field names" (I don't know how better to describe it) without knowing them beforehand?  In this XML example, I have a type called "data", which I pass into ref-all by quoting it; 'data.  But what if I just want to get a list of all possible elements I could search for?  In other words, how could I get a list back that looks like this:



((document) (name) (date) (element) (data))



which is all the different types of element names (field names?) in my XML?  My goal for this is to be able to input in any kind of XML file and return back a list of searchable "field names".



In the newLISP introductory guide, it says (pg 156):


Quote
You add them up to get the options code number – so 15 (+ 1 2 4 8) uses the first four of these options: suppress unwanted stuff, and translate strings tags to symbols.  As a result of this, new symbols have been added to newLISP's symbol table:



(channel description docs item lastBuildDate link managingEditor rss sxml title version webMaster xml)



These correspond to the string tags in the XML file, and they'll be useful almost immediately.


I guess what I'm looking for is some way to bring back a list of all the symbols that have been added to the symbol table when I use xml-parse.  I wish I could have explained it better.  :)



Thanks so much for any help you can provide!