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

Messages - Darth.Severus

#1
First, many thanks for your work an sharing your code.



I changed the code of your module to be more flexible. It finds the right name of the installed version of libnewt.so and uses this one. I think, this is somehow like the use of libraries should be implemented in such modules.


(context 'Newt)

(define (find-libnewt)
(if (!= (setq result-of-find (exec "find /usr/lib -name *libnewt*")) '())
((exec (string "basename " (last result-of-find)))0)
(throw-error "libnewt not found in /usr/lib! You might need to install libnewt.")))

    (constant 'Prefix "newt")

    (constant 'Library (find-libnewt))


However I got this error message trying your example:
QuoteERR: import function not found in function import : "/usr/lib/i386-linux-gnu/libnewt.so.0.52.14: undefined symbol: newtComponentGetPosition"

called from user function module
My guess is, I'm using another libnewt library.
#2
In a script I run: (read-file <path>) and (parse str "/n") to get a list with the content of a file parsed in lines into the symbol input-list. Then I run following code:


(dolist (temp input-list)
(when (not (or
(starts-with temp "#")
(starts-with temp "t")))
(setq temp (replace " " temp "&nbsp;"))
(push (string temp "<br>") result-list -1))
(when (starts-with temp "#")
(push (heading temp) result-list -1)))


It does what it should do, but not with the first line. It has no (exit) function at the end, so I can look what is in input-list. The first line is "### whatever" and e.g. the fifth is "### whatever-again". But it applies the first (when) to the first line and the second (when) function to all the others starting with "#". This is completely crazy.



Linux my-notebook 3.14-0.bpo.2-686-pae #1 SMP Debian 3.14.15-2~bpo70+1 (2014-08-21) i686 GNU/Linux

newLISP v.10.6.2 32-bit on Linux IPv4/6 UTF-8 libffi
#3
Thanks for all these infos, but here is one more thing:

I took the keywords from (symbols), but the ^ sign should not be in the keyword list, or everything will be highlighted.



Other thing: I have run_cmd=newlisp "%f" in my file, but when I click to execute a window appears only for a moment. Removing "%f" causes nothing.
#4
newLISP in the real world / man pages for newLisp
April 10, 2013, 07:29:48 AM
I while ago I wondered, why there are no manpages for newLisp functions like for programms in Linux. Cause I thought this would really be helpful, I created them on my own. Ripped the descriptions from the manual and created a context with the name 'man'. I added a line to newlisp console, so that it is always loaded.

So (man "append") prints the description of append into the console.



I think it would be helpful, especially for beginners if something like that would become part of newlisp as standard or at least of nls.lsp.

Put the line (load "/home/yourpath/man.lsp") into nls.lsp to load it automatically, and put man.lsp also into "/usr/share/newlisp/modules" or the correct path in your OS, then (module man.lsp)



"man.lsp" is the context with a definition, if loaded (man "something") works. The function replace is missing in man.lsp, cause I couldn't load it with that entry inside. "manGen.lsp" is the ripping programm.



The files are here, only man.lsp is needed, manGen.lsp is for making a new version.

https://github.com/DarthSeverus/newLisp">https://github.com/DarthSeverus/newLisp
#5
Ahhh, my usual error, thinking complex instead of doing the nearest thing. I always tried it with the same website... -> facepalm.



However, it works now.  I'm using the dump option of w3m browser to save the sites to my disc before I process them.
(eval-string (string {(exec "w3m } url { -dump_source -T text/html > temppage.html")}))

I think the problem was a security measure of the website, maybe it blocks non-browsers when they try to get more than two sites.



Thanks, anyway.
#6
I'm using some code in a program, to get the links of a website incl. subpages. But it's not working, I often get "ERR: HTTP document empty". I puted a until loop into the code, so that it tries it several times, always after some minutes. My fist thougth was, I'm blocked by the server, but this seems not to be the case. If I open a newlist shell and write (get-url url) I get the site, while I still have the same IP.



(define (pick-links url)
(setq page (get-url url))
(println (1 20 page)) ; testing
(write-file "page" page); also testing
(until (not (starts-with page "ERR: HTTP document empty"))
(and (sleep 600000) (setq page (get-url url))))
(setq linklist (join (find-all "<a href=([^>]+)>([^>]*)</a>" page) "<br>n"))
        (setq linklist
(replace {"} linklist "`")) ;"
(setq parsedlist
(parse linklist "n"))  
(setq page nil) )
#7
newLISP in the real world / Re: newLISP on Rockets
October 30, 2012, 02:29:57 AM
Quote from: "hilti" Isn't http://www.rundragonfly.com">//http://www.rundragonfly.com a good starting point to learn Dragonfly? Greg and I wrote a lot documentation to get used to the simple development cycle when using Dragonfly.

What's missing?
Sorry for my late answer, I was distracted by other problems.

I'm realy happy and thankfull that rundragonfly.com exists, but when I was reading there I thought it was written by someone who has to much experience in doing webdesign und programming, and is blind for beginner problems. I even had no clue how to start creating something, I was just overwhelmed by all that stuff I should know or understand without explanation, and didn't know what I had to learn first, and so on. I even thought I could do everything in nL without knowing something about HTML and JS. Newlisp is also my first programming language I'm realy learning (ignoring some C64-Basic). I'm a bit experienced in it, but I also was not doing much web stuff with it before I tried to understand Dragonfly. This is why I started this wiki @//dragonfly-newlisp.wikidot.com/, my writings there are the best explanation.

I've read the introducion in HTML5 on w3schools.com since then, a bit about CSS and JS, and will go on with that. Right now I'm writing nL-scripts which are creating several HTML sites using content from other sources. Go on learning dragonfly or/and Newlisp on Rockets will be the next step then.
#8
newLISP in the real world / Re: newLISP on Rockets
October 26, 2012, 06:55:58 PM
Oh, I just started to learn how dragonfly works, as a complete beginner in webdesign. I started this wiki //dragonfly-newlisp.wikidot.com, and planned to announce it soon. This newLisp on Rockets project seems to be interesting to me, cause there may be more interessting discussions about how all that stuff works.
#9
I tried something with eval-string cause:
Quote;; cause (append-file aktuell content) isn't working.


It was ment this way:
Quote(eval-string (string {(append-file aktuell content)} ))


aktuell is the path and content is the symbol with the content from (setq content (read-file contentname))



I thought append-file isn't accepting (append-file aktuell content), and tried it by using eval-string.



But now it is really working without eval-string.

There was another error, and because I was using the same symbol name several times I was seeking the error at the wrong place and messed up my code there. This was a reminder why not using symbol names again.


Quotethe best would be to decompose the expression and try the parts individually.

You're right, from now on I'm gonna check parts of the code in newLisp-edit (GUI). I tried to write that little script by using an editor without syntax highlighting, cause I was switching from WinXP to Linux and had not found a good editor with highlighting so far. I also didn't test parts of the code on their own, just run the full script again and again. Now I've got it, I think. I'm nearly a complete beginner in programming and also in Linux.



Thanks, so far.
#10
I'm writing a script which takes additional code for the content container from txt files and creates html sites with different content. Now I have a problem.



Stuff like this works:
Quote
(append-file aktuell {<div id="center" style="background-color:#EEEEEE;height:800px;width:420px;font-size:0.875em;float:left;">})

(append-file aktuell "n")


aktuell is a symbol with e.g. index.html ... other.html from a dolist function



But, here is a problem.
Quote
(trace true)

(define contentname (chop aktuell 5))

(define contentname (push ".txt" contentname -1))

(change-dir "/home/myUsername/Folder/Content/")

(setq content (read-file contentname))

(change-dir "/home/myUsername/Folder/HTML/")

(append-file aktuell (eval-string (string {(append-file aktuell content)} )))

;; cause (append-file aktuell content) isn't working.


If I use (trace true) like above I get:
Quote
ERR: string expected in function append-file : aktuell}

ERR: string expected : (eval-string (string "(append-file aktuell content)"))

ERR: missing argument


Strange to me is also, that it works through the whole list of html file names, but if I don't use (trace true) it crashes and doesn't create more than a uncomplete index.html. So far it was no problem, cause it created the html files correctly if I had "trace true" into the code, but now a have one more error and it may be related to that.
#11
Sorry, I was just confused cause I thought the line
QuotenewLISP v.10.3.4 on Linux IPv4/6 UTF-8, execute 'newlisp -h' for more info.

has to appear first, cause a was working with the shell the last days, but this line appears at the end of the program. It works fine, let's forget this fast :D ...
#12
It opens and closes it right away.
#13
Hi,

I want to have .lsp files to be executable by click, like in windows. Without making a real executable out of it by using link.lsp.

I'm using roxterm and Antix-Linux (Debian/Mepis) and I am realativly new to linux. I'm using roxterm -e newlisp "$@ as "set run action". My problem now is that it prints


Quoteit works!newLISP v.10.3.4 on Linux IPv4/6 UTF-8, execute 'newlisp -h' for more info.


#!/usr/bin/newlisp
(print "it works!")


Regards,

DS
#14
newLISP newS / Re: Forums registration not working?
September 27, 2012, 09:00:17 PM
I got my mail now. Thanks.