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 - joejoe

#41
i am trying to take a list of words and transform it into an html list.



the list:


one
two
three


what I am trying to construct is this:


<li><a href="/one">one</a></li>
<li><a href="/two">two</a></li>
<li><a href="/three">three</a></li>


what i am trying is this:


(set 'l (read-file "./list"))
(parse l)
(replace $it l "<li><a href="http://xyz.com/$it">$it</a></li>")
(println l)


however, i am getting the error:


ERR: string expected in function replace

the manual entry for the replace function says:



syntax: (replace exp-key list exp-replacement [func-compare])



i thought $it is the exp-key, l is the list, and the exp-replacement to be:


"<li><a href="http://xyz.com/$it">$it</a></li>"

am i correct to guess that replace is the correct function to do this?



thanks very much!
#42
Hi -



When I run my go.lsp file repeatedly from the command line, I am getting the same output every time. Here is the go.lsp:


#/usr/bin/newlisp

; read the input file

(set 'l (read-file "./list"))

; parse and print the inputed, randomized file

(set 'r (randomize (parse l)))
(println r)

(exit)


$ newlisp go.lsp

("nine" "five" "one" "three" "ten" "six" "eight" "two" "four" "seven")

$ newlisp go.lsp

("nine" "five" "one" "three" "ten" "six" "eight" "two" "four" "seven")



The file list looks like this:


one
two
three
four
five
six
seven
eight
nine
ten


I am trying to get it to display a different, randomized output every time.



Thanks for any hint. :0)   --
#43
Hi - At the bottom of the Advanced Features Help page for the nL wiki



http://newlisp.nfshost.com/wiki/index.cgi?page=How_To_Use_Advanced_Features">http://newlisp.nfshost.com/wiki/index.c ... d_Features">http://newlisp.nfshost.com/wiki/index.cgi?page=How_To_Use_Advanced_Features



it says:


QuoteHTML tags

The following HTML tags can be used, but without any attributes or options. To change the appearance of how these tags work, use the style sheet in Default Style. Care must be taken to close tags if required. Unclosed tags can change the appearance of all the remaining page with unexpected results.


Is there any way to allow full html code to be displayed through the wiki?

Some sort of total escaping or something? Or is this not a good thing to do w/ the wiki?



I was about to begin to strip out and replace all the html w/ nL code, but I thought first to ask to see if something easier is allowed.



Thanks!
#44
Hi - I am trying to put together a few bits of code from cormullion's superb introduction here:



http://www.newlisp.org/dokuwiki/doku.php?id=introduction:introduction_part_2#working_with_xml">http://www.newlisp.org/dokuwiki/doku.ph ... g_with_xml">http://www.newlisp.org/dokuwiki/doku.php?id=introduction:introduction_part_2#working_with_xml



but am ending up with:



ERR: value expected : (0 2 9 0)



The two bits Im trying to merge are commented in the code below, along with my attempt to take the titles from the xml file and make them into local file names. From there I want to put the links and description into each respective file.



Would anyone be able to say which part of the manual I need to go back and study? I cant seem to get inside of the dolist to insert a save command for each title as it is recursed through. Thanks for any sort of tip.


#!/usr/bin/newlisp

(set 'xml (get-url "http://shop.ebay.com/i.html?_nkw=lisp&_rss=1"))
(xml-type-tags nil nil nil nil)
(set 'sxml (xml-parse xml 15))

;(println (lookup 'title (sxml (chop (ref 'item sxml)))))
;(save (lookup 'title (sxml (chop (ref 'item sxml)))))

;(dolist (el (ref-all 'title sxml))
; (println (rest (sxml (chop el)))))

(dolist (el (println (lookup 'title (sxml (chop (ref-all 'item sxml))))))
(save (lookup 'title (sxml (chop (ref-all 'item sxml))))))

(exit)
#45
newLISP in the real world / using external modules
September 08, 2009, 11:40:58 AM
hi -



im trying to use the web.lsp module:



http://static.artfulcode.net/newlisp/web.lsp.html">http://static.artfulcode.net/newlisp/web.lsp.html



i added the file



http://static.artfulcode.net/newlisp/web.lsp.src.html">http://static.artfulcode.net/newlisp/web.lsp.src.html



as web.lsp to the



/usr/share/newlisp/modules



directory on my debian squeeze i386 machine and went through the ./configure, make and make install again and tried to do a basic function call like this:


> (Web:parse-url http://www.newlisp.org)

ERR: invalid function : (Web:parse-url http://www.newlisp.org)
> (parse-url http://www.newlisp.org)

ERR: invalid function : (parse-url http://www.newlisp.org)
>


i know i am making a most basic error in trying this.



can anyone say what i am doing incorrectly? thanks very much!
#46
Hi -



I chmodded 777 the pages and backup folders in the newlisp wiki software but any changes I make with the Edit button at page bottom are not having effect. If I manually edit the pages from the command line, the page shows the changes.



I havent changed anything other than chmodding these folders and making the software find newlisp in colors.cgi, index.cgi and rss.cgi.



Also, when I go to edit the setup.lsp via web browser, it gives this error when I try to save:



ERR: problem saving file in function save : "pages/setup.lsp"



Anyone else have this same experience or know why page changes and setup utility are not completing? Thanks very much!



One last strange thing: when I tar zxvf the newlisp wiki folder, all the files in the pages folder have the wierd ^M at the end of every line. I typically have only seen this when using unzip withouth the -e flag. thanks again! :0)