Search found 64 matches
- Thu Jan 31, 2013 3:09 am
- Forum: newLISP in the real world
- Topic: external filter
- Replies: 2
- Views: 1675
Re: external filter
Thanks, Lutz. I'll play with those variations.
- Wed Jan 30, 2013 4:19 am
- Forum: newLISP in the real world
- Topic: external filter
- Replies: 2
- Views: 1675
external filter
What is a more idiomatic way to do this? : (set 'tmp-file (open "/tmp/file" "write")) (write tmp-file (join (map markup (parse pretext "\n" 0)) "\n")) (close tmp-file) (setf posttext (join (exec "fmt -68 /tmp/file") "\n")) It feels dirty to use a /tmp/file like that. Ideally I'd like to pipe a strin...
- Sat Jan 26, 2013 3:54 am
- Forum: newLISP in the real world
- Topic: When command-line arguments contain "http://" something ....
- Replies: 3
- Views: 2272
Re: When command-line arguments contain "http://" something
An only slightly more harmonious solution might be to go the other way and expect URL literal command-line arguments to be marked up so as to prevent them being remotely executed by newLISP. Prepending a + is one simple way: newlisp +http://www.google.com/bank.html getting the url then as: (setf url...
- Thu Jan 24, 2013 2:38 pm
- Forum: newLISP in the real world
- Topic: crypto module on ubuntu
- Replies: 3
- Views: 1925
- Thu Jan 24, 2013 9:18 am
- Forum: newLISP in the real world
- Topic: crypto module on ubuntu
- Replies: 3
- Views: 1925
Re: crypto module on ubuntu
just a stab in the dark here, csfreebird, but you said you were on amd64 but then went and installed:
?
I am assuming the error message:
is saying that it expected a 64-bit ELF class...
Code: Select all
apt-get install libssl0.9.8:i386
I am assuming the error message:
Code: Select all
wrong ELF class: ELFCLASS32
- Wed Jan 23, 2013 12:32 am
- Forum: Whither newLISP?
- Topic: magic numbers
- Replies: 10
- Views: 11674
Re: magic numbers
Thanks for the list of places to cover, Lutz. Adding adhoc constants to individual scripts will lead to an inevitable mess of misspellings. The idea of a company-wide constants module is good -- and such a project would be the beginnings of a globally used Constants.lsp or English.lsp or SomeSuch.ls...
- Tue Jan 22, 2013 3:10 am
- Forum: Whither newLISP?
- Topic: magic numbers
- Replies: 10
- Views: 11674
Re: magic numbers
Good to know, Lutz, thanks. So... care to weigh in on the magic-number side? This phenomenon exists in several places throughout the newLISP API. Many functions take an optional integer parameter that is an OR compositie of individual option values. As bare numbers, this makes reading code quite dif...
- Mon Jan 21, 2013 9:55 pm
- Forum: Whither newLISP?
- Topic: magic numbers
- Replies: 10
- Views: 11674
Re: magic numbers
Thanks for playing along, Cormulion. Your solution is certainly the easiest of the named-symbols implementations. On the down side, it produces fairly verbose symbols. Another question I had about the code: two fours? Is it possible for the state of (last-error) to change between testing for Error:p...
- Sun Jan 20, 2013 11:18 pm
- Forum: Whither newLISP?
- Topic: magic numbers
- Replies: 10
- Views: 11674
magic numbers
o_O Some magic Lutz code: (error-event (fn () (if (= 4 ((last-error) 0)) (println "ERR:" (last (last-error 4))) (println ((last-error) 1))))) For a while now I have been unconsciously squirming in my seat when reading over code like this. This morning I became aware of that discomfort and cried in ...
- Sat Jan 19, 2013 1:28 pm
- Forum: newLISP in the real world
- Topic: Send byte array via TCP
- Replies: 8
- Views: 3424
Re: Send byte array via TCP
I have never done net coding, but I thought that was exactly what the (pack ...), (unpack ...) pair were for - to be able to send binary values encoded as strings to be decoded back into their proper forms at the other end. No?
- Sat Jan 19, 2013 12:10 pm
- Forum: newLISP in the real world
- Topic: Send byte array via TCP
- Replies: 8
- Views: 3424
Re: Send byte array via TCP
I'm going to guess here, csfreebird, that you can use the (pack ...) and (unpack ...) functions for this. See the newLISP User Manual for these functions. From a quick look, it would seem you'd use: (pack ">d" your_short) For a signed big-endian short. Heh... and on clicking Submit, it seems that Co...
- Thu Jan 17, 2013 9:30 pm
- Forum: newLISP newS
- Topic: sqlite3 module: how to maintain lib paths
- Replies: 10
- Views: 18460
Re: sqlite3 module: how to maintain lib paths
There is the
analogue too... :-/
This bit me yesterday when I was testing jazper's sqlite3 stuff. I whimped out and created a symlink from /usr/local/lib/libsqlite3.so, but that really was just a kludge.
Code: Select all
/usr/lib/i386-linux-gnu/libsqlite3.so.0
This bit me yesterday when I was testing jazper's sqlite3 stuff. I whimped out and created a symlink from /usr/local/lib/libsqlite3.so, but that really was just a kludge.
- Thu Jan 17, 2013 4:58 am
- Forum: newLISP in the real world
- Topic: cgi again
- Replies: 12
- Views: 4718
Re: cgi again
o_O what am I gonna do with all this popcorn?! Thanks, RickyBoy & Cormullion - it was the case sensitivity issues I was unsure about. I was fairly sure that the NULL was necessary - it seemed so in standalone tests of sqlite3.lsp. I don't think I made any other changes, jazper, apart from the aesthe...
- Wed Jan 16, 2013 1:34 pm
- Forum: newLISP in the real world
- Topic: cgi again
- Replies: 12
- Views: 4718
Re: cgi again
Try: #!/usr/bin/newlisp ;;; to create table, used this -- CREATE TABLE UsrTbl(Id INTEGER PRIMARY KEY, UserName TEXT, UserEmail TEXT) (print "Content-type: text/html\n") (module "cgi.lsp") (module "sqlite3.lsp") (println [text] <br> <form action="UPDTDB2.cgi" method="POST"> <pre> User name:<input typ...
- Mon Jan 14, 2013 8:13 am
- Forum: newLISP in the real world
- Topic: list all in directory
- Replies: 8
- Views: 3408
Re: list all in directory
Use the (copy ) function on the string.
Code: Select all
(replace "hello" (copy x) "goodbye")
- Mon Jan 14, 2013 7:48 am
- Forum: newLISP in the real world
- Topic: list all in directory
- Replies: 8
- Views: 3408
Re: list all in directory
This is shown in CodePatterns under Walking A Directory Tree in section 5.
- Wed Jan 09, 2013 7:45 am
- Forum: newLISP in the real world
- Topic: Searching in lists
- Replies: 19
- Views: 7053
Re: Searching in lists
Without seeing your data, I can only guess at the structure. As such, this code will almost certainly fail: (map rest (ref-all '("title" *) x match true)) Hopefully the intent survives though and you're able to find a built-in search function to suit your needs. There are about three hundred of them...
- Sat Jan 05, 2013 10:23 pm
- Forum: newLISP in the real world
- Topic: accessing deeply nested lists (XPath?)
- Replies: 12
- Views: 4522
Re: accessing deeply nested lists (XPath?)
It is the wise man who chooses another direction when he sees he's on the wrong path. Well played, rickyboy. Intellectually, I get why the macro form is not playing nice for us, but I lack the necessary coalface time at the keyboard to properly internalise that lesson. This is an area of my lisp tha...
- Sat Jan 05, 2013 10:23 am
- Forum: newLISP in the real world
- Topic: accessing deeply nested lists (XPath?)
- Replies: 12
- Views: 4522
Re: accessing deeply nested lists (XPath?)
Ah... a snag I hit in the macro forms, rickyboy, is the resulting order of execution when called on a nested call of itself: (define (get_workspace_trees , x) (let (x '()) (dolist (output (get_active_output_names)) (push (list output (nodes "content" (nodes output (get_tree)))) x)) x)) The code for ...
- Fri Jan 04, 2013 9:29 pm
- Forum: newLISP in the real world
- Topic: accessing deeply nested lists (XPath?)
- Replies: 12
- Views: 4522
Re: accessing deeply nested lists (XPath?)
Wow. That's brilliant, rickyboy! Thanks for taking the time to show and explain those ideas to me. That is exactly what I was looking for (but didn't know what it would look like) when I asked for places to improve my code. I am new to lisp, so knowing when to reach for a macro is still beyond my re...
- Fri Jan 04, 2013 1:06 pm
- Forum: newLISP in the real world
- Topic: accessing deeply nested lists (XPath?)
- Replies: 12
- Views: 4522
Re: accessing deeply nested lists (XPath?)
...does that come with a cape and hat? 'cos if there's a cape and hat, i'm in! ...ok, i'd settle for just the hat...
- Fri Jan 04, 2013 11:46 am
- Forum: newLISP in the real world
- Topic: accessing deeply nested lists (XPath?)
- Replies: 12
- Views: 4522
Re: accessing deeply nested lists (XPath?)
Thanks, Cormullion. I must have tried a hundred different ways to call (ref...) today with maddening ocassional successes and frustratingly more failures so coyly announced by newLISP simply as: nil I used your code to have another go, and it worked. Here is my new (nodes...) function: (define (node...
- Fri Jan 04, 2013 7:22 am
- Forum: newLISP in the real world
- Topic: accessing deeply nested lists (XPath?)
- Replies: 12
- Views: 4522
accessing deeply nested lists (XPath?)
I have a deeply nested tree of lists (which came from json (the i3-tag -t get_tree command from the i3 window manager, specifically)). What is the best way in newLISP to drill down into various parts of this structure? I have so far been using code like: ((assoc "nodes" (((assoc "nodes" ((get_tree) ...
- Tue Dec 04, 2012 12:41 pm
- Forum: newLISP in the real world
- Topic: formatting 'nil'
- Replies: 9
- Views: 4015
Re: formatting 'nil'
I should have thought about copy(). I have to do that all the time in Vim because its map() function is destructive. :-/
Thanks for the reminder, and speed test, Cormullion. Completed this thread nicely, I'd say. :-)
Thanks for the reminder, and speed test, Cormullion. Completed this thread nicely, I'd say. :-)
- Mon Dec 03, 2012 9:27 pm
- Forum: newLISP in the real world
- Topic: formatting 'nil'
- Replies: 9
- Views: 4015
Re: formatting 'nil'
W00t! Learned about replace() today. Yay. :-) Thanks, cormullion. It was interesting to see Michael's speed test. I hadn't thought about how slow map() might be. And what a speed difference! Another thing to note about the two different solutions, though, is that the map() is non-destructive, wherea...