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

#1
I installed newlisp 10.7.1 using apt-get install on on a raspberry pi 3.



(module "unix.lsp") failed looking for "/usr/local/share/newlisp/modules/unix.lsp"



I located it incorrectly installed at "/usr/share/newlisp/modules/unix.lsp"



Not sure who is responsible for the repository or if it's location is defined somewhere in the make process.



PS:  any clue if / when 10.7.3 will be promoted to the release version ?



I am hoping to see (read-key true) on the other platforms ASAP. The only was to see it widely propagated is for the repositories to upgrade. That will not happen until there is a formal release.
#2
WANTED: The able to test for a key-pressed or be able to time out from a (read- like function.



The object is to be able to interrupt a loop with a key stroke. currently all input functions are blocking and wait forever for input. Sometimes when no input is forth coming we need to be able to move on.  



(net-peek and (net-connect with it's timeout are good examples of non-blocking input.



In windows we have the following workaround but nothing I can figure out for the other os's



(if (not _kbhit) (import "msvcrt.DLL" "_kbhit" ))
(if (not _getch) (import "msvcrt.DLL" "_getch" ))

(define (key-pressed)
  (if (= 0 (_kbhit)) nil
      (begin
         (setq keyval (_getch))
         (if (or (= keyval 0)(= keyval 224)) (CONSOLE:_getch))
         (setq keypress (char keyval)))))
#3
linux, freebsd and win 2012r2 are all running  as virtual machines on the same box, each running on one dedicated xeon 3.0g core.



The win 10 box is also on the same network connection, it is a new 7th generation I7 3.4g cpu with 8 cores proving the system speed has little to do with the net-connect timing.



While this is a useful example,

What I am fishing for is suggested additions to the ports scan list.

 

#
# myhost is a FQDN or IP address
# ie. (myscan "test.example.com")
#     (myscan "192.168.1.1")
#
(define (myscan myhost)
   (setq timeout 500)
   (println "Scanning: " myhost)
   (dolist (plist myscan-list)
        (setq myport (plist 0))
(if (set 'socket (net-connect myhost myport timeout))
(begin
       (setq rtt (time (set 'socket2 (net-connect myhost myport (+ timeout 25))))
             timeout (/ (+ rtt timeout 50) 2))
       (println "open port: " myport " : " rtt "ms " (plist 1) )
(net-close socket2)
(net-close socket))
(print myport "  r")))
   (println "       ") )
#

(setq myscan-list '(
    (7 "echo")
    (9 "discard")
    (11 "systat")
    (13 "daytime")
    (17 "qotd")
    (18 "msp")
    (19 "chargen")
    (20 "ftp-data")
    (21 "ftp")
    (22 "ssh")
    (23 "telnet")
    (25 "smtp")
    (37 "time")
    (38 "rap")
    (39 "rlp")
    (42 "nameserver")
    (43 "whois")
    (49 "tacas")
    (53 "domain")
    (63 "whoispp")
    (66 "sqlnet")
    (67 "bootps")
    (68 "bootpc")
    (69 "tftp")
    (70 "gopher")
    (79 "finger")
    (80 "http")
    (81 "hosts2-ns")
    (88 "kerberos")
    (101 "hostname")
    (102 "iso-tsap")
    (107 "rtelnet")
    (109 "pop2")
    (110 "pop3")
    (111 "sunrpc")
    (113 "auth")
    (115 "sftp")
    (117 "uucp-path")
    (118 "sqlserv")
    (119 "nntp")
    (123 "ntp")
    (135 "epmap")
    (137 "netbios-ns")
    (138 "netbios-ds")
    (139 "netbios-ssn")
    (143 "imap")
    (150 "sql-net")
    (156 "sqlsrv")
    (158 "pcmail-srv")
    (161 "snmp")
    (162 "snmptrap")
    (170 "print-srv")
    (179 "bgp")
    (194 "irc")
    (204 "isc")
    (220 "imap3")
    (322 "rtsps")
    (349 "mftp")
    (366 "alt-smtp")
    (389 "ldap")
    (443 "https")
    (445 "microsoft-ds")
    (464 "kpasswd")
    (465 "smtps")
    (507 "crs")
    (512 "exec")
    (513 "login")
    (514 "cmd")
    (515 "printer")
    (519 "unix=time")
    (520 "efs")
    (522 "ulp")
    (526 "tempo")
    (529 "irc-serv")
    (530 "courier")
    (531 "conference")
    (532 "netnews")
    (540 "uucp")
    (543 "klogin")
    (544 "kshell")
    (546 "dhcpv6-client")
    (547 "dhcpv6-server")
    (548 "afpovertcp")
    (554 "rtsp")
    (556 "remotefs")
    (563 "nntps")
    (565 "whoami")
    (568 "ms-shuttle")
    (569 "ms-rome")
    (580 "sntp-heartbeat")
    (587 "submission")
    (593 "http-rpc-epmap")
    (612 "hmmp-ind")
    (613 "hmmp-op")
    (636 "ldaps")
    (666 "doom")
    (691 "msexch-routing")
    (749 "kerberos-adm")
    (800 "mdbs_daemon")
    (989 "ftps-data")
    (990 "ftps")
    (992 "telnets")
    (993 "imaps")
    (994 "ircs")
    (995 "pop3s")
    (1034 "activesync")
    (1025 "trojan")
    (1080 "socks")
    (1109 "kpop")
    (1110 "nfsd-status")
    (1155 "nfa")
    (1270 "opsmgr")
    (1433 "ms-sql-m")
    (1434 "ms-sql-s")
    (1477 "ms-sna-server")
    (1478 "ms-sna-base")
    (1512 "wins")
    (1524 "ingreslock")
    (1607 "stt")
    (1711 "pptconference")
    (1723 "pptp")
    (1731 "msiccp")
    (1745 "remote-winsock")
    (1755 "ms-streaming")
    (1801 "msmq")
    (1863 "msnp")
    (1900 "ssdp")
    (1944 "close-combat")
    (2053 "knetd")
    (2106 "mzap")
    (2177 "qwave")
    (2234 "directplay")
    (2382 "ms-olap3")
    (2383 "ms-olap4")
    (2393 "ms-olap1")
    (2394 "ms-olap2")
    (2460 "ms-theater")
    (2504 "wlbs")
    (2525 "ms-v-worlds")
    (2701 "sms-rcinfo")
    (2702 "sms-xfer")
    (2703 "sms-chat")
    (2704 "sms-remctrl")
    (2725 "msolap-ptp2")
    (2869 "icslap")
    (3020 "cifs")
    (3074 "xbox")
    (3126 "ms-dotnetster")
    (3128 "trojan")
    (3132 "ms-rule-engine")
    (3268 "msft-gc")
    (3269 "msft-gc-ssl")
    (3343 "ms-cluster-net")
    (3389 "ms-wbt-server")
    (3535 "ms-la")
    (3540 "pnrp-port")
    (3544 "teredo")
    (3587 "p2pgroup")
    (3702 "ws-discovery")
    (3776 "dvcprov-port")
    (3847 "msfw-control")
    (3882 "msdts1")
    (3935 "sdp-portmapper")
    (4350 "net-device")
    (4400 "trojan")
    (4500 "ipsec-msft")
    (4899 "radmin")
    (5000 "upnp")
    (5191 "aol")
    (5228 "google")
    (5355 "llmnr")
    (5357 "wsd")
    (5358 "wsd")
    (5678 "rrac")
    (5679 "dccm")
    (5720 "ms-licensing")
    (6000 "trojan")
    (5900 "vnc")
    (6073 "directplay8")
    (6112 "battlenet")
    (8080 "http-alt")
    (8222 "vmware")
    (8333 "vmware")
    (9535 "man")
    (9753 "rasadv")
    (10000 "webmin")
    (11320 "imip-channels")
    (12345 "trojan")
    (15000 "kaspersky")
    (16384 "cisco-rtp")
    (20000 "usermin")))




myscan Linux 64bit vers 16.4.3

newLISP v.10.7.1 64-bit on Linux IPv4/6 UTF-8 libffi, options: newlisp -h

scanning:

open port: 21 : 46.731ms. ftp

open port: 22 : 46.259ms. ssh

open port: 80 : 46.281ms. http

open port: 443 : 46.771ms. https





myscan FreeBSD 64bit vers 11.1

newLISP v.10.6.2 64-bit on BSD IPv4/6 UTF-8 libffi, options: newlisp -h

scanning:

open port: 21 : 129.836ms. ftp

open port: 22 : 228.404ms. ssh

open port: 80 : 123.528ms. http

open port: 443 : 116.864ms. https





myscan Win10 64bit

newLISP v.10.7.1 64-bit on Windows IPv4/6 UTF-8 libffi, options: newlisp -h

scanning:

open port: 21 : 46.882ms. ftp

open port: 22 : 46.876ms. ssh

open port: 80 : 46.879ms. http

open port: 443 : 46.882ms. https





myscan Win 2012r2

newLISP v.10.6.2 32-bit on Win32 IPv4/6 libffi, options: newlisp -h

Scanning:

open port: 21 : 46.874ms ftp

open port: 22 : 46.875ms ssh

open port: 80 : 46.874ms http

open port: 443 : 46.875ms https
#4
The following test program runs just fine on both windows and ubuntu Linux but has print buffering problems and fails on FreeBSD 11.1.


;; (load "test.lsp")
#
; pressing key1 returns true, key2 returns nil, all other keys ignored
(define (torf key1 key2)
   (setq keypress2 "")
   (while (and (!= keypress2 key1) (!= keypress2 key2))
          (setq keypress2 (upper-case (char (read-key)))))
   (= keypress2 key1) )
#
; dummy compile/link code for testing
(define (linkme)
    (setq compile true
          exename "test")
    (println "ncompile/link code runs here")
    nil) ; return no errors
#
; mainline program edited for testing
(define (doit)
     (println "do main program here")
     (sleep 5000) ; pause for effect
     (println "then exit")
     (fake-exit) )
#
; entry point for this test
(define (run)
   (if (not compiled)
      (begin
         (print "n "C"ompile or "R"un ? " )
         (if (torf "C" "R")
              (begin
                   (if (not (linkme))
                         (println (string "n Compile of " exename " was successful. "))
                         (println (string "n Compile of " exename " failed! ")))
                   (print " "E"xit or "T"est ? ")
                   (if (torf "T" "E")
                       (doit)
                       (print "nfinished")))
             (doit)))
      (doit))
  true
  )
  true
  ;eof


here is a sample good run on ubuntu.


newLISP v.10.7.1 64-bit on Linux IPv4/6 UTF-8 libffi, options: newlisp -h

> (load "test.lsp")
true
> (run)

 "C"ompile or "R"un ?  [i]; entered "c" for compile[/i]
compile/link code runs here

 Compile of test was successful.
 "E"xit or "T"est ?
finished


and failing example on BSD


root@bsd1:/home/bob # newlisp
newLISP v.10.6.2 64-bit on BSD IPv4/6 UTF-8 libffi, options: newlisp -h

> (load "test.lsp")
true
> (run)
;[i] the program stops at this point waiting on input with no prompt.
; enter an "c" to exit as if the prompt was there and it
; flushes the print buffer and continues.[/i]
 "C"ompile or "R"un ?
compile/link code runs here
[i]; and stops again waiting on input with no prompt.
; enter an "e" to exit as if the prompt was there again
; flushes the print buffer and we continue to the exit.[/i]
Compile of test was successful.
"E"xit or "T"est ?
finished
>


This leaves me clueless, I will test later on cent-os as soon as I can get another VM running.
#5
Quote
;;

;; (pause msg delay) is a debuging tool that lets me

;; pause in a loop and look at things and in some

;; cases (setq  things before continuing.

;;

;; msg is evaled and printed as a string for

;; delay in seconds, if not specified default is 10

;; return key enters and exits eval print loop

;; any other key to bypass delay and continue.

;;

;; this requires windows, I need an ubuntu equivalent

;;

(if (not _kbhit) (import "msvcrt.DLL" "_kbhit" ))

(if (not _getch) (import "msvcrt.DLL" "_getch" ))



(define (key-pressed)      ; this is what is needed !

  (if (= 0 (_kbhit)) nil

      (begin

         (setq keyval (_getch))

         (if (or (= keyval 0)(= keyval 224)) (_getch))

         (setq keypress (char keyval)))))

#

(define (pause msg delay )

    (setq delay (if delay delay 10))

    (print (string "n=>: " msg " "))

    (if (!= "r" (dotimes ( x delay (key-pressed)) (sleep 1000))) nil

         (while (!= (setq tmp (print "n=>? ") estring (read-line)) "")

                (print (string "=>: " (eval-string estring) ))true)nil))

#

# example

#

(pause "Doing it" 5)

;

;eof


#6
Given the reverse dns generated by (setq rdns (net-lookup ip-add))

This example appends the expanded name if there is a 2 char code..

The value/time saver here, is the assoc list of countries.  



;;;
;;; Expand 2 char country codes
;;; by caveguy
;;;
(define (expand-cc rdns , tmp)
   (if (and (= "." (first (slice rdns -3)))
            (setq tmp (upper-case (slice rdns -2)))
            (setq tmp (assoc tmp cntrylst))
            (setq tmp (last tmp)))
       (string rdns " ""  tmp """)
       (string rdns "")))
#
(set 'cntrylst '(
  ("AF" "Afghanistan")
  ("AX" "Åland Isl.")
  ("AL" "Albania")
  ("DZ" "Algeria")
  ("AS" "American Samoa")
  ("AD" "Andorra")
  ("AO" "Angola")
  ("AI" "Anguilla")
  ("AQ" "Antarctica")
  ("AG" "Antigua & Barbuda")
  ("AR" "Argentina")
  ("AM" "Armenia")
  ("AW" "Aruba")
  ("AU" "Australia")
  ("AT" "Austria")
  ("AZ" "Azerbaijan")
  ("BS" "Bahamas")
  ("BH" "Bahrain")
  ("BD" "Bangladesh")
  ("BB" "Barbados")
  ("BY" "Belarus")
  ("BE" "Belgium")
  ("BZ" "Belize")
  ("BJ" "Benin")
  ("BM" "Bermuda")
  ("BT" "Bhutan")
  ("BO" "Bolivia")
  ("BQ" "Bonaire")
  ("BA" "Bosnia & Herzegovina")
  ("BW" "Botswana")
  ("BV" "Bouvet Isl.")
  ("BR" "Brazil")
  ("IO" "British Indian Ocean Terr.")
  ("BN" "Brunei Darussalam")
  ("BG" "Bulgaria")
  ("BF" "Burkina Faso")
  ("BI" "Burundi")
  ("KH" "Cambodia")
  ("CM" "Cameroon")
  ("CA" "Canada")
  ("CV" "Cape Verde")
  ("KY" "Cayman Isl.")
  ("CF" "Central African Rep.")
  ("TD" "Chad")
  ("CL" "Chile")
  ("CN" "China")
  ("CX" "Christmas Isl.")
  ("CC" "Cocos Isl.")
  ("CO" "Colombia")
  ("KM" "Comoros")
  ("CG" "Congo")
  ("CD" "Congo")
  ("CK" "Cook Isl.")
  ("CR" "Costa Rica")
  ("CI" "Côte d'Ivoire")
  ("HR" "Croatia")
  ("CU" "Cuba")
  ("CW" "Curaçao")
  ("CY" "Cyprus")
  ("CZ" "Czech Rep.")
  ("DK" "Denmark")
  ("DJ" "Djibouti")
  ("DM" "Dominica")
  ("DO" "Dominican Rep.")
  ("EC" "Ecuador")
  ("EG" "Egypt")
  ("SV" "El Salvador")
  ("GQ" "Equatorial Guinea")
  ("ER" "Eritrea")
  ("EE" "Estonia")
  ("ET" "Ethiopia")
  ("EU" "European Union")
  ("FK" "Falkland Isl.")
  ("FO" "Faroe Isl.")
  ("FJ" "Fiji")
  ("FI" "Finland")
  ("FR" "France")
  ("GF" "French Guiana")
  ("PF" "French Polynesia")
  ("TF" "French Southern Terr.")
  ("GA" "Gabon")
  ("GM" "Gambia")
  ("GE" "Georgia")
  ("DE" "Germany")
  ("GH" "Ghana")
  ("GI" "Gibraltar")
  ("GR" "Greece")
  ("GL" "Greenland")
  ("GD" "Grenada")
  ("GP" "Guadeloupe")
  ("GU" "Guam")
  ("GT" "Guatemala")
  ("GG" "Guernsey")
  ("GN" "Guinea")
  ("GW" "Guinea-Bissau")
  ("GY" "Guyana")
  ("HT" "Haiti")
  ("HM" "Heard & McDonald Isl.")
  ("VA" "Vatican)")
  ("HN" "Honduras")
  ("HK" "Hong Kong")
  ("HU" "Hungary")
  ("IS" "Iceland")
  ("IN" "India")
  ("ID" "Indonesia")
  ("IR" "Iran")
  ("IQ" "Iraq")
  ("IE" "Ireland")
  ("IM" "Isle of Man")
  ("IL" "Israel")
  ("IT" "Italy")
  ("JM" "Jamaica")
  ("JP" "Japan")
  ("JE" "Jersey")
  ("JO" "Jordan")
  ("KZ" "Kazakhstan")
  ("KE" "Kenya")
  ("KI" "Kiribati")
  ("KP" "Korea, North")
  ("KR" "Korea, South")
  ("KW" "Kuwait")
  ("KG" "Kyrgyzstan")
  ("LA" "Lao")
  ("LV" "Latvia")
  ("LB" "Lebanon")
  ("LS" "Lesotho")
  ("LR" "Liberia")
  ("LY" "Libya")
  ("LI" "Liechtenstein")
  ("LT" "Lithuania")
  ("LU" "Luxembourg")
  ("MO" "Macao")
  ("MK" "Macedonia")
  ("MG" "Madagascar")
  ("MW" "Malawi")
  ("MY" "Malaysia")
  ("MV" "Maldives")
  ("ML" "Mali")
  ("MT" "Malta")
  ("MH" "Marshall Isl.")
  ("MQ" "Martinique")
  ("MR" "Mauritania")
  ("MU" "Mauritius")
  ("YT" "Mayotte")
  ("MX" "Mexico")
  ("FM" "Micronesia")
  ("MD" "Moldova")
  ("MC" "Monaco")
  ("MN" "Mongolia")
  ("ME" "Montenegro")
  ("MS" "Montserrat")
  ("MA" "Morocco")
  ("MZ" "Mozambique")
  ("MM" "Myanmar")
  ("NA" "Namibia")
  ("NR" "Nauru")
  ("NP" "Nepal")
  ("NL" "Netherlands")
  ("NC" "New Caledonia")
  ("NZ" "New Zealand")
  ("NI" "Nicaragua")
  ("NE" "Niger")
  ("NG" "Nigeria")
  ("NU" "Niue")
  ("NF" "Norfolk Isl.")
  ("MP" "Mariana Isl.")
  ("NO" "Norway")
  ("OM" "Oman")
  ("PK" "Pakistan")
  ("PW" "Palau")
  ("PS" "Palestine")
  ("PA" "Panama")
  ("PG" "Papua New Guinea")
  ("PY" "Paraguay")
  ("PE" "Peru")
  ("PH" "Philippines")
  ("PN" "Pitcairn")
  ("PL" "Poland")
  ("PT" "Portugal")
  ("PR" "Puerto Rico")
  ("QA" "Qatar")
  ("RE" "Réunion")
  ("RO" "Romania")
  ("RU" "Russian Federation")
  ("RW" "Rwanda")
  ("BL" "Saint Barthélemy")
  ("SH" "Saint Helena, Ascension")
  ("KN" "Saint Kitts & Nevis")
  ("LC" "Saint Lucia")
  ("MF" "French Saint Martin")
  ("PM" "Saint Pierre & Miquelon")
  ("VC" "Saint Vincent & Grenadines")
  ("WS" "Samoa")
  ("SM" "San Marino")
  ("ST" "Sao Tome & Principe")
  ("SA" "Saudi Arabia")
  ("SN" "Senegal")
  ("RS" "Serbia")
  ("SC" "Seychelles")
  ("SL" "Sierra Leone")
  ("SG" "Singapore")
  ("SX" "Dutch Saint Martin")
  ("SK" "Slovakia")
  ("SI" "Slovenia")
  ("SB" "Solomon Isl.")
  ("SO" "Somalia")
  ("ZA" "South Africa")
  ("GS" "Georgia & Sandwich Isl.")
  ("SS" "South Sudan")
  ("ES" "Spain")
  ("LK" "Sri Lanka")
  ("SD" "Sudan")
  ("SR" "Suriname")
  ("SJ" "Svalbard & Jan Mayen")
  ("SZ" "Swaziland")
  ("SE" "Sweden")
  ("CH" "Switzerland")
  ("SY" "Syrian Arab Rep.")
  ("TW" "Taiwan")
  ("TJ" "Tajikistan")
  ("TZ" "Tanzania")
  ("TH" "Thailand")
  ("TL" "Timor-Leste")
  ("TG" "Togo")
  ("TK" "Tokelau")
  ("TO" "Tonga")
  ("TT" "Trinidad & Tobago")
  ("TN" "Tunisia")
  ("TR" "Turkey")
  ("TM" "Turkmenistan")
  ("TC" "Turks & Caicos Isl.")
  ("TV" "Tuvalu")
  ("UG" "Uganda")
  ("UA" "Ukraine")
  ("AE" "United Arab Emirates")
  ("GB" "United Kingdom")
  ("UK" "United Kingdom")
  ("US" "United States")
  ("UM" "US Outlying Isl.")
  ("UY" "Uruguay")
  ("UZ" "Uzbekistan")
  ("VU" "Vanuatu")
  ("VE" "Venezuela")
  ("VN" "Viet Nam")
  ("VG" "Brit. Virgin Isl.")
  ("VI" "US Virgin Isl.")
  ("WF" "Wallis & Futuna")
  ("EH" "Western Sahara")
  ("YE" "Yemen")
  ("ZM" "Zambia")
  ("ZW" "Zimbabwe")))
#7
Whither newLISP? / (directory) nonsence
June 13, 2017, 10:49:56 PM
first problem I put (directory) in the search box an it tells me it is too common ?



I change-dir to the directory with my log files and do a (directory) and get back a list of everything.

In this case I only want the dovecot logs so why does (directory "dovecot*") return nil ?



obviously too common a problem for search to be bothered responding with a hint.  



Its late, I'm tired, what am I overlooking ?
#8
Updated my newlisp.syn file for the textpad editor. Hope this saves someone some work  someday :)


;newlisp/sym
; Caveguys newlisp keyword syntax file for textpad editor.
; last edit 2017/06/01

C=1

[Syntax]
Namespace1 = 6
IgnoreCase = Yes
InitKeyWordChars = A-Za-z*$'
KeyWordChars = -A-Za-z0-9*:_
BracketChars = ()
OperatorChars = -+*/^=<>
PreprocStart =
SyntaxStart =
SyntaxEnd =
CommentStart = ;|
CommentEnd = |;
CommentStartAlt =
CommentEndAlt =
SingleComment = ;
SingleCommentCol =
SingleCommentAlt =
SingleCommentColAlt =
StringStart = "
StringEnd = "
StringAlt =
StringEsc =
CharStart =
CharEnd =
CharEsc =

; ///////////////////////////
; standard newlisp functions
; ///////////////////////////
[Keywords 1]
NaNp
abort
abs
acos
acosh
add
address
amb
and
append
append-file
apply
args
array
array-list
arrayp
asin
asinh
assoc
atan
atan2
atanh
atomp
base64-dec
base64-enc
bayes-query
bayes-train
begin
beta
betai
bigint
bigintp
bind
binomial
bit_and
bit_exclusive
bit_inclusive
bit_not
bit_shift
bits
callback
case
catch
ceil
change-dir
char
chop
clean
close
collect
colon
command-event
cond
cons
constant
context
contextp
copy
copy-file
corr
cos
cosh
count
cpymem
crc32
crit-chi2
crit-f
crit-t
crit-z
current-line
curry
date
date-list
date-parse
date-value
debug
dec
deci
def-new
default
define
define-macro
delete
delete-file
delete-url
destroy
det
device
difference
directory
directoryp
display-html
div
do-until
do-while
doargs
dolist
dostring
dotimes
dotree
dump
dup
emptyp
encrypt
ends-with
env
erf
error-event
eval
eval-string
eval-string-js
evenp
exec
exec
exists
exit
exp
expand
explode
extend
factor
fft
file-info
filep
filter
find
find-all
first
flat
float
floatp
floor
flt
fn
for
for-all
fork
format
fv
gammai
gammaln
gcd
get-char
get-float
get-int
get-long
get-string
get-url
global
globalp
history
if
if-not
ifft
import
inc
inci
index
infp
int
integerp
intersect
invert
irr
join
json-error
json-parse
kmeans-query
kmeans-train
lambda
lambda-macro
lambdap
last
last-error
legalp
length
let
letex
letn
list
listp
load
local
log
lookup
lower-case
macro
macrop
main-args
make-dir
map
mat
match
max
member
min
mod
mul
multiply
name
net-accept
net-close
net-connect
net-error
net-eval
net-interface
net-ipv
net-listen
net-local
net-lookup
net-packet
net-peek
net-ping
net-receive
net-receive-from
net-receive-udp
net-select
net-send
net-send-to
net-send-udp
net-service
net-sessions
new
nilp
normal
not
now
nper
npv
nth
nullp
numberp
oddp
open
or
ostype
pack
parse
peek
pipe
pmt
pop
pop-assoc
post-url
pow
prefix
pretty-print
primitivep
print
println
prob-chi2
prob-f
prob-t
prob-z
process
prompt-event
protectedp
push
put-url
pv
quote
quotep
rand
random
randomize
read
read-buffer
read-char
read-expr
read-file
read-key
read-line
read-utf8
reader-event
real-path
receive
ref
ref-all
regex
regex-comp
remove-dir
rename-file
replace
reset
rest
reverse
rotate
round
save
search
seed
seek
select
self
semaphore
send
sequence
series
set
set-locale
set-ref
set-ref-all
setf
sgn
share
shell
signal
silent
sin
sinh
sleep
slice
sort
source
spawn
sqrt
ssq
starts-with
stats
string
stringp
struct
sub
swap
sym
symbolp
symbols
sync
sys-error
sys-info
systemsymbol
t-test
tan
tanh
term
throw
throw-error
time
time-of-day
timer
title-case
trace
trace-highlight
transpose
trim
truep
unicode
unify
union
unique
unless
unpack
until
upper-case
utf8
utf8len
wait-pid
when
while
write
write-char
write-file
write-line
xfer-event
xml-error
xml-parse
xml-type-tags
zerop
#9
In the following example (fix-args) fixes the main-arg offset problem with using input args with -x linked programs.



Using the offset of 2 from the original example:
;; uppercase.lsp - Link example
  (println (upper-case ((main-args) 2)))
  (println "main-args " (main-args))
  (exit)


~# newlisp uppercase.lsp uppercase-command

UPPERCASE-COMMAND

main-args ("newlisp" "uppercase.lsp" "uppercase-command")



works as expected but errors out when linked.



~# ./uppercase uppercase-linked

ERR: invalid list index



changing the offset to 1 unsurprisingly converts the wrong string when not linked.


;; uppercase.lsp - Link example
  (println (upper-case ((main-args) 1)))
  (println "main-args " (main-args))
  (exit)



~# newlisp -x uppercase.lsp uppercase


root@ubuntu1:~# newlisp uppercase.lsp uppercase-command

UPPERCASE.LSP

main-args ("newlisp" "uppercase.lsp" "uppercase-command")



The addition and use of (fix-args) solves the problem in all cases.


#!/usr/bin/env /usr/bin/newlisp
;; uppercase.lsp - Link example
(define (fix-args) (if (find "newlisp" (lower-case (main-args 0))) (rest (main-args)) (main-args)))
(define (run)
   (println (upper-case ((fix-args) 1)))
   (println "main-args " (main-args))
   (println "fix-args " (fix-args)"n"))
(run)
(exit)


~# newlisp -x uppercase.lsp uppercase

~# ./uppercase uppercase-linked


UPPERCASE-LINKED

main-args ("./uppercase" "uppercase-linked")

fix-args ("./uppercase" "uppercase-linked")



~# ./uppercase.lsp uppercase.shell

UPPERCASE.SHELL

main-args ("/usr/bin/newlisp" "./uppercase.lsp" "uppercase.xxx")

fix-args ("./uppercase.lsp" "uppercase.xxx")



~# newlisp uppercase.lsp uppercase-command

UPPERCASE-COMMAND

main-args ("newlisp" "uppercase.lsp" "uppercase-command")

fix-args ("uppercase.lsp" "uppercase-command")
#10
problem: newlisp -x linked programs can eat all available memory, blow their stack and DOS a system unless they are constrained. With -m and -s not playing nice with -x, constraint is hard to achieve.



test.lsp
(println "maxheap " (sys-info 1) " maxstack " (sys-info 5))
(exit)


newlisp -x test.lsp test

chmod 755 ... and run ./test

maxheap 576460752303423488 maxstack 2048

max heap is huge and stack is assumed small for this example.



newlisp -m256 -s4096 test.lsp

maxheap 8388608 maxstack 4096


maxheap is more reasonable and maxstack is larger



newlisp -m256 -s4096 -x test.lsp test2

returns with no error and never makes test2



newlisp -x test.lsp test2 -m 256 -s 4096

also returns without an error yet never makes test2



This problem became apparent to me when one of my linked programs went into an endless loop.

It ate a lot of memory, DOSing the server before it was discovered and killed off.

It was during the migration from: newLISP v.10.1.0 on Win32 IPv4 using link.lsp to: newLISP v.10.6.2 64-bit on Linux IPv4/6 UTF-8 libffi [Linux 3.13.0-43-generic on x86_64] using -x that got me started.



I also tested  newLISP v.10.6.0 32-bit on Linux IPv4/6 libffi, options: newlisp -h on [Linux 3.13.0-39-generic on i686] -x worked the same [no surprise].
#11
upon discovering the 10.6.0 32 bit newlisp is not happy on a 64 bit system.

I set about googling errors until the following cookbook Install of newLISP 10.6.2 worked clean on several 64bit Ubuntu 64bit 14.04.01 systems.



# Install newLISP 10.6.2 on amd64 ubuntu 14.04.01


sudo su
cd ~
apt-get install libreadline6 libreadline6-dev libffi-dev  
wget http://www.newlisp.org/downloads/development/inprogress/newlisp-10.6.2.tgz
tar -xvf newlisp-10.6.2.tgz
cd newlisp-10.6.2/
./configure
make
make install

# done now Test in teminal:
cd ~
newlisp

# returns

newLISP v.10.6.2 64-bit on Linux IPv4/6 UTF-8 libffi, options: newlisp -h

>

>(exit)



Good luck ...
#12
I need help accessing a password protected samba share from windows.



If I log in to the share with my username/password from explorer before starting newlisp



(directory "//server/share") works just fine

as does (open "//server/share/file ....



but when windows decides to reboot, I loose the share and things go south....



I have tried "username:password@//server/share..."

along with a bunch of other wild guesses, none have worked :(



Please any help will be appreciated, getting paged at night is getting old.
#13
I am running Win7 V6.1. 64 bit version on an intel quadcore,



I have newlisp 10.1.10 installed in the C:Program Files (x86) directory and newlisp.exe runs fine if I click on a .lsp file on the desktop.



I have installed both 32 & 64 bit java  (Version 6 Update 18) and all the Java tests pass on both 32 and 64 bit IE. I have also tested and found java to be working working with Foxfire 3.6, Chrome 4.0.249.89, Safari 4.0.4. Open Office is also running fine on this system.



Attemps to run newLISP-GS or newlisp-edit.lsp return the following error"



Exception in thread "main" java.lang.NoClassDefFoundError: C:Program Files (x86)newlispguiserver/jar

Caused by: java.lang.ClassNotFoundException: C:Program Files (x86)newlispguiserver.jar

        at java.net.URLClassLoader$1.run(Unknown Source)

        at java.security.AccessController.doPrivileged(Native Method)

        at java.net.URLClassLoader.findClass(Unknown Source)

        at java.lang.ClassLoader.loadClass(Unknown Source)

        at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)

        at java.lang.ClassLoader.loadClass(Unknown Source)

Could not find the main class: C:Program Files (x86)newlispguiserver.jar.

Program will exit.



Any help or suggestions would be helpfull.

PS: I Newlisp 10.1.7 on my old winXP laptop and it is working just fine other than having to fix all my old pre V10 (inc's and (dec's to make them work as expected again. But that is a different problem. :(
#14
In debugging a backup utility, I have come across a small number of of files on my system that cause (copy-file to "fail" with an error code of 63.



My 2 platforms are windows server 2003 and XP pro, it happens with 10.x



Here is what I know so far:

On the XP system all the files that errored were either .iso or .img disk images of IBM diagnostics disks. On the server, I got the same error which turned out to be an access problem, once given the proper access rights the error went away and the files copied. On the XP system I switched to using "kernel32.DLL" "CopyFileA" and the problem went also went away.



As closer look I found that the files in question had unexplainable file attributes set.



(file-info filename)  returns:

(1474560 33206 2 0 0 1246818382 1188159663 1188159637)

 on the file in question.



33206 = 1000 0001 1011 0110 = 0x81B6



What is a 0x8000 attribute flag bit ?

It seems to translate to a "GoAway" your not welcome :( ?



(file-info name) works as expected on the other 3k+ files in the backup tree on both systems who do not have the 0x8000 bit of death set.



My guess at this point is that the Attribute (long) got crossed with a pointer, but why only when the 16'th bit of death is set ? I would expect an -1 on error if this was a negative error number it would be -439 an equally confusing attribute.



Any thoughts ?
#15
I am using (copy-file to make a backup file and it is putting the current date- time in the (file-info of the new copy. I need to be able to preserve the FileTime info on the copy or find a way to put it back to what it was.

.......
#16
I want to add and/or change the icon for newlisp.exe, well more importantly a myhack.exe produced using the (link) function.



My first thought was to use Icon Changer, but it reports there is no icon to change :(



Can anyone give me a clue how to add an icon, or provide me with a newlisp.exe that has an Icon attached that I can change and then link to it ?



If the distribution newlisp.exe had newlisp.ico attached, I think the change icon utility would work.



I prefer NOT to purchase a full password encrypted Exe Wrapper just to add a  recognizable icon for Brain Dead Users who mostly think the text is too small to easily read, that's why real programs all have icons :)



Any thoughts ?
#17
The "get cookies" code that builds CGI:cookies from "HTTP_COOKIE" in cgi.lsp tears up cookies with embeded or tailing "=".



The following, fixed the problem, nicely for me.



(if (env "HTTP_COOKIE")

    (dolist (elmnt (parse (env "HTTP_COOKIE") ";"))

         (set 'var (trim (first (parse elmnt "="))))

 ### (set 'value (trim (last (parse elmnt "="))))

         (set 'value (slice elmnt (+ 1 (find "=" elmnt))))

         (push (list var value) cookies))

    (set 'cookies '()))



This feature plays hell with (base64-*) and (encrypt) of cookies !



I had been chaseing a random problem for weeks before I figured out how to reporduce it. In my case a (base64 string with a trailing "=" came back "" which trigered a differant, repeatable, error, that lead to this fix.

Well back to my rat killen, Just thought someone else might have a random cookie related problem that this might fix.
#18
I am at the limits of my understanding of math here, and am looking for an example or lib function, that can preform a Standard Deviation on a list of values and give me back the magic number, so I can move on with my life :)



Lutz: I do like how the language has evolved, Its been a few years, but I have begun a new project, I hope to abuse NewLisp's IP capibilities, this time around.



Later

Bob
#19
Anything else we might add? / File upload from browser
September 13, 2004, 06:08:53 PM
I have a function that I need in newlisp. And I am at a loss :(



given the following form action:



<form action="/upload.cgi" enctype="multipart/form-data" method=post>

<input type=file name=stonehenge>

<input type=submit value=Upload>

</form>



Using upload.exe (dos-cgi) or upload.php see below

the specified file is uploaded and put into an upload directory on the server.

I looked at (put-url) but I dont see a connection :(

I need to do this with a method=post  using the method=put from the put-url example always returns REQUEST_METHOD=GET never PUT ?





FYI: The PHP function that provided the function I am looking for  is:

move_uploaded_file ( string filename, string destination)



Push the "(" back to the front where it belongs and get rid of the stupid useless coma and it would be perferct :)



I keep hopeing that I have overlooked somthing symple here ....
#20
It has been a while since I have worked with newlisp, and posted here, so let me say hi to all.



I took som time  to download the lates greatest and play with it. I was pleased to see the evelotion of blog and wiki, keep up the good work!  



Then, came monday morning and I got the first phone call, many of the exsisting exsisting cgi's on my server were blowing up. The reason was simple, I hace not kept up with the depreciated subbers, and had jumped many versions of newlisp in one leap :(



First (substring) had to be replaced with (chop), ok (substring got chopped I can deal with that in thais age of cut backs and downsizeing.

Then (concat) had to be replaced with (append with a -1 appended in select places. Appending to (append to fix a distinct lacking of (conact was indead ironic to say the least. When  I found myseld replacing (remove with (replace using a replace all, because (remove had been removed, I knew I had fallen into carefull crafted Syntactical trap.  There were dark forces lurking here :) As it turned out that was all that was needed in a bunch of files.



Now that that problem is solved, and things are back running, I am back to playing in blog and wiki land.



My short term goal is to create a blog, where each new topic is centered around an image. I envision uploading a  jpg or png using http put and placed as the focal point of the page.  I do believe that everyone is using a modern browser these days that supports http upload.



As a Collectors, hobbyists, photographers, artists, ...  we want to be able to upload a jpg or png of our latest great creation or find into a Blog. Be it fishing for approval or seeking answers, it is the feedback from the other in the Blog that inspires the posting.



I do plan on looking at wiki much closer, at first glance it looks like it would work well for maintaining a galery of a collection.



A bit off subject, the "gallery" project written in PHP is heading off in that direction but does not have the level of interaction, you have with wiki.



One final question:

Are there any example of http-upload that I may have missed ?



Now .. Back to the grind stone :)