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

#1
newLISP Graphics & Sound / Scite editor
April 17, 2016, 12:09:43 PM
I also installed Scite, replacing lisp.properties with Kazmir's file. Running a one line "Hello World" file named "hello.lsp" returns bash exit code 127
Quotecmd /K "newlisp -c /home/myname/Desktop/hello.lsp"

is what is being sent to bash.



Can anyone throw any light on why this is happening and newlisp is not being called, please?
#2
newLISP Graphics & Sound / Guiserver again
April 17, 2016, 11:54:09 AM
Hi all.  With a new installation of Ubuntu 15.04, I installed java (not the jre that comes with ubuntu) from Oracle, as shown in the downloads page.  The result is that the java executable is found at
Quote/usr/bin/java/jre1.8.0_77/bin/java


I then created a link, with
Quotesudo ln -s /usr/bin/java/jre1.8.0_77/bin/java /usr/bin/java


This however does not find guiserver.jar when
Quotenewlisp-edit
is typed.  Am I linking incorrectly?  The newlisp executable is in /usr/local/bin
#3
newLISP Graphics & Sound / HTML Tag functions?
December 13, 2013, 09:14:01 AM
Some time ago, one of the frequent contributors posted some code showing how to do HTML tags.  I think it was in a context for each tag.  Since bookmarking that, my hard disk died, and some bookmarks with it, though I had copies of all the main stuff.



Please can someone point me to this post, or the code in it?  For example, a function called as (h1 string) would produce<h1>string</h1>.  



It was better than this, though, because it included args, allowing for classes etc.
#4
While trying to use sqlite3 in an app that needs the crypto library, I get a warning "can't find crypto library".  On Crunchbang linux, there are a few "crypt" files in /usr/lib/x86_64-linux-gnu directory:

libcrypt.so,

libcrypt.so.1.0.0,

libcrypt.a

the first is a symlink, as follows:lrwxrwxrwx   1 root root       35 Aug 18 14:19 libcrypt.so -> /lib/x86_64-linux-gnu/libcrypt.so.1

The problem is, I can't find the file the symlink points to (libcrypt.so.1), certainly not on that folder.  Should I edit the link to point to libcrypt.so.1.0.0?
#5
newLISP and the O.S. / Windows install
May 06, 2013, 01:39:07 AM
Hello all

Have just re-installed newLISP (Win 7 pro 64 bit).  When I try running programs from the IDE, I get:
Quoterun-shell

Could not start C:Program Files (x86)newlisp/newlisp.exe -C -w "C:UsersMyUserName"


I have java installed, and the IDE loads ok and loads files ok.  It just won't run them.  Will be grateful for any help.
#6
newLISP in the real world / "secret" save of game scores
February 13, 2013, 02:31:31 PM
I can't work out how to update and retrieve scores stored in a sqlite database on my web site.   A game on an Android phone needs to do this.  Is there some kind of "secret" way of doing this that bypasses the business of visibly logging on and clicking submit buttons?  My site has a database on it, and is written in newLISP.



People do this all the time, so I expect it must be doable with cgi and newLISP.  Any tips or pointers toward the approach will be much appreciated.
#7
I have never been able to get this to work.  After tweaking the elements string to ensure there are 11 items in each line (I take out the ellipsis in the example, and shorten the list to 5 lines just for testing), it never has yet inserted the elements into sqlite3, yet it also does not report an error.



Today I removed the (and after (if not (find "t1" (sql3:tables))) to arrive at this:(if (not (find "t1" (sql3:tables)))
   (create-table)
   (init-table))
.

Now, for the first time ever after tens of attempts, it inserts the elements to sqlite3 just fine, but I get a repl error message:
inserted element 1 1.0079 Hydrogen H -259 -253 0.09 0.14 1776 1 13.5984
inserted element 2 4.0026 Helium He -272 -269 0 0 1895 18 24.5874
inserted element 3 6.941 Lithium Li 180 1347 0.53 0 1817 1 5.3917
inserted element 4 277 Hassium Hs 0 0 0 0 1984 8 0
inserted element 5 268 Meitnerium Mt 0 0 0 0 1982 9 0

ERR: list index out of bounds in function int
called from user defined function sql3:sql
called from user defined function init-table
even though the insert went fine.



Testing the indices in the repl, they look fine to me.  Can anyone spot why I get this error message?  Here follows the entire program:(set 'elements [text]1 1.0079 Hydrogen H -259 -253 0.09 0.14 1776 1 13.5984
2 4.0026 Helium He -272 -269 0 0 1895 18 24.5874
3 6.941 Lithium Li 180 1347 0.53 0 1817 1 5.3917
4 277 Hassium Hs 0 0 0 0 1984 8 0
5 268 Meitnerium Mt 0 0 0 0 1982 9 0
[/text])

(module "sqlite3.lsp")

(if (sql3:open "periodic_table")
   (println "database opened/created")
   (println "problem: " (sql3:error)))

(set 'column-def "number INTEGER, atomic_weight FLOAT, element TEXT, symbol TEXT, mp FLOAT, bp FLOAT, density FLOAT, earth_crust FLOAT, discovered INTEGER, egroup INTEGER, ionization FLOAT")

(define (create-table)
 (if (sql3:sql (string "create table t1 (" column-def ")"))
    (println "created table ... OK")
    (println "problem " (sql3:error))))

(define (init-table)
 (dolist (e (parse elements "n" 0))
 (set 'line (parse e))
 (if (sql3:sql
  (format "insert into t1 values(%d, %f, '%s', '%s', %f, %f, %f, %f, %d, %d, %f);"
    (int (line 0))
    (float (line 1))
    (line 2)
    (line 3)
    (float (line 4))
    (float (line 5))
    (float (line 6))
    (float (line 7))
    (int (line 8))
    (int (line 9))
    (float (line 10))))
  ; success
  (println "inserted element " e)
  ; failure
  (println (sql3:error) ":" "problem inserting " e))))

(if (not (find "t1" (sql3:tables)))
   (create-table)
   (init-table))

(define (query sql-text)
 (set 'sqlarray (sql3:sql sql-text))    ; results of query
 (if sqlarray
   (map println sqlarray)
   (println (sql3:error) " query problem ")))

#8
newLISP in the real world / cgi again
January 16, 2013, 02:52:39 AM
I have never got the example in the User Guide to work.  I can get it to list a result set if I manually insert rows into the Elements Sqlite3 database, but nothing gets written via code.  Lately, I have been basing an attempt to write to a simple user, email database, from a webform.  This is what I wrote: it's an adaptation of a "quick and dirty" script that someone posted to talk to a sqlite3 database.
#!/usr/bin/newlisp
;;; to create table, used this -- CREATE TABLE UsrTbl(Id INTEGER PRIMARY KEY, UserName TEXT, UserEmail TEXT)

(print "Content-type: text/htmln")
(load (append (env "NEWLISPDIR") "\modules\cgi.lsp"))
(load (append (env "NEWLISPDIR") "\modules\sqlite3.lsp"))

(println
[text]
<br>
<form action="UPDTDB2.cgi" method="POST">
<pre>
User name:<input type="text" name="username"><br>
Email    :<input type="text" name="useremail"><br>
<input type="submit" value="Go">
</pre>
</form>
<br>
[/text])

(define (rslt 'sql-text)
(set 'sqlarray (sql3:sql sql-text))    ; results of query
(if sqlarray
(map println sqlarray)
(println (sql3:error) " query problem ")))

(define (insrt 'sql-text)
(set 'qry (sql3:sql sql-text))
(if qry
(println "ok")
(println (sql3:error))))

(set 'database "JCDB.db")
(sql3:open database)

(println {<br>})
(set 'name (CGI:get "UserName"))
(set 'email (CGI:get "UserEmail"))
(set 'sqlstr (string "INSERT INTO usrtbl VALUES('','" name "','" email "');" ))
(insrt sqlstr)

(println {<br>Hit the [back] button on your browser to got back<br>})

(exit)

;;; eof ;;


Once again, it list things that I put in manually, but will not insert values.  Can anyone spot what I am doing wrong?  No error message is posted.
#9
I use GoalSeek a fair amount in spreadsheets.  It's fast enough, but I confess I don't understand how it works.  Googling produced discussions about Newton Rhapson, something that Computer Science and Math students seem to know about.  Having last looked at math a half century ago on finishing my schooling, I can't pick up what it's about.  



Recently some other clever mathematical stuff was added to newLISP.  Has anybody ever tried something like GoalSeek in newLISP?  If so, I'd appreciate an explanation of the algorithm.  



As an example, I use it in spreadsheets to arrive at what a payment instalment will be over [n] months, at a certain rate of interest.  It isn't simply a matter of dividing sum of principle + interest by number of months, because interest is compounded monthly.  It looks to me like GoalSeek is able to cope with this, as though it calculates the a root of compound interest.  Microsoft gives an simple explanation of the algorithm which didn't help me at all.  Perhaps it just iterates, adding a cent at a time, until its guess subtracted from target is close enough to zero.  I'd imagine it would be easier to bisect, as in a binary search, but I can't get my head around the code even in pseudocode.  Any ideas?
#10
newLISP and the O.S. / Ubuntu 12.04 64 bit
May 09, 2012, 11:23:17 AM
I couldn't get a good install of newLISP on Precise Pangolin 64 bit.  I can see newlisp and its files on /usr/bin/newlisp, but when trying newlisp-editI get  /usr/bin/newlisp - bad interpreter: No such file or directoryI assume one uses the 32 bit installer under Ubuntu 64 bit, right?
#11
newLISP Graphics & Sound / wiki
April 24, 2012, 11:51:12 AM
ERR: list or string expected in function replace : nil called from user defined function search-content-table called from user defined function display-page

Looking at the source, I can't make out why clicking on "How To Use Advanced Features" returns this error.  It is called in exactly the same way as the two options above, namely:


  • How To Edit Text

    How To Customize

yet they work fine.



Can anyone help me understand?
#12
Good day everyone.



Clicking
Quotenewlisp-ide-4.6.tgz (updated 2010-04-21)
on the apps link in newlisp.org results in s a 404 error.  Is this a temporary problem, or is this browser based IDE no longer available?
#13
newLISP Graphics & Sound / java message on GS load
April 11, 2012, 08:44:53 AM
Greetings.



I get a strange message on loading the ide (after typing "newlisp-edit") on terminal command line:


(java:3058): Gtk-WARNING **: Unable to locate theme engine in module_path: "pixmap",


It doesn't seem to harm anything.  I am merely curious, and don't know the first thing about java.  Distro is Ubuntu 11.10.
#14
Hello:

I'm trying to figure out how to write to couchdb using REST:  command line syntax for creating a database is:


curl -X PUT http://127.0.0.1:5984/mydatabase

With newLISP, will post-url achieve the same thing?  I have tried, but there's no response, and the database does not show up in Futon.  Can someone help, please?



regards
#15
Hi

I am learning NewLisp:  having imported data (csv) into Sqlite3, I can work fine within the Firefox and Sqlite3Explorer tools.  However from within Newlisp IDE, the error reported is "no such table: MonFriDown".  As I say, the table is there, and usable:  in NewLisp, database opens ok. Code follows:

(load (append (env "NEWLISPDIR") "\modules\sqlite3.lsp"))
(if (sql3:open "SimonsTownLine.sqlite3")
(println "database opened/created")
(println "problem:  " (sql3:error)))

(define (query sql-text)
(set 'sqlarray (sql3:sql sql-text)) ; results of query
(if sqlarray
(map println sqlarray)
(println (sql3:error) " query problem ")))

(query "select * from MonFriDown")

 (sql3:error)            
 (sql3:close)  


Does anyone have similar problems with SQLite3, or is there something wrong with my code?

regards