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

#1
newLISP newS / newLISP Github?
May 25, 2023, 06:27:23 PM
I noticed that there's an empty newlisp organization on Github: https://github.com/newlisp

Anyone know whose this is?

It seems like a good idea to get the source up and running on Github, and maybe now is a good time for someone in the community to step up as a maintainer and do that.
#2
newLISP newS / Navigating the new forums
May 20, 2023, 11:01:57 AM
Hi guys!

As most of you are aware, no one has heard from Lutz in a while, and the old forums were in a state of disarray (outdated software, no HTTPS, spam, etc.). So I offered to help, and Ryon graciously agreed to help with the transfer.

Welcome to the new forums! :D

No one knows what the future holds for Lutz' amazing programming language, but it's becoming clear that its future is in the hands of the community now. So if you'd like to step up and help improve newLISP, here you'll find a welcoming community to help.

Regarding the forum migration - the importer was good but not perfect. Some links are kinda broken. Your profile info might need updating. If there's anything you'd like to make sure got imported, please check the old forums and repost your work here if necessary.

Notes on how to convert links you come across:

Converting links

Let's say you're browsing and see a link that looks like this:

http://newlispfanclub.alh.net/forum/viewtopic.php?t=2488

Take the value after `t` and convert it like so:

=> https://newlispfanclub.com/index.php?topic=2488.0

Same here, just ignore the `f` parameter:

http://www.newlispfanclub.alh.net/forum/viewtopic.php?f=15&t=3961

=> https://newlispfanclub.com/index.php?topic=3961.0

Post links

Links to individual posts within a thread are a bit harder because phpBB excludes the topic ID from the URL:

http://www.newlispfanclub.alh.net/forum/viewtopic.php?p=25186#p25186

But if you happen to know it, this is how they're mapped:

=> https://newlispfanclub.com/index.php?topic=5229.msg25186#msg25186

Need anything?

Any questions/comments/concerns? Let us know!
#3
Dragonfly / Where to find Dragonfly Framework
May 20, 2023, 08:49:34 AM
#4
I tried to get in contact with Lutz, here, by email, by Facebook, and haven't heard back from him.



I don't know who hosts these forums, but they are clearly in a sorry shape.



I'd like to offer to help migrate these forums to better software, with better spam protection, and HTTPS.



Qualifications:



I have experience hosting forums: https://www.taoeffect.com/forum/">https://www.taoeffect.com/forum/



I have a long history of being a newLISP fan:



- https://www.taoeffect.com/blog/2010/01/how-newlisp-took-my-breath-and-syntax-away/">https://www.taoeffect.com/blog/2010/01/ ... ntax-away/">https://www.taoeffect.com/blog/2010/01/how-newlisp-took-my-breath-and-syntax-away/

- Co-created the Dragonfly newLISP Web Framework, which has a dedicated forum here: http://www.newlispfanclub.alh.net/forum/viewforum.php?f=17">http://www.newlispfanclub.alh.net/forum/viewforum.php?f=17



If whoever runs these forums could please reach out to me both here and via email, I'd appreciate it.
#5
Hi folks, I've released a new module for the Dragonfly framework to handle sending email using the wonderful `msmtp` command, allowing Dragonfly to send SMTPS emails, and it uses the exact same API as the existing smtpx.lsp API:



https://github.com/taoeffect/dragonfly-newlisp/blob/master/example-site/dragonfly-framework/plugins-inactive/msmtp.lsp">https://github.com/taoeffect/dragonfly- ... /msmtp.lsp">https://github.com/taoeffect/dragonfly-newlisp/blob/master/example-site/dragonfly-framework/plugins-inactive/msmtp.lsp



It also has improved logging for the `./newlispServer` command, which now `tail -F`'s the dragonfly.log file so you can see log output just from running that one command.



Note, these changes are in the `master` branch, not in a tagged version.



Enjoy!
#6
Hi folks, I've released a new module for the Dragonfly framework to handle sending email using the wonderful `msmtp` command, allowing Dragonfly to send SMTPS emails, and it uses the exact same API as the existing smtpx.lsp API:



https://github.com/taoeffect/dragonfly-newlisp/blob/master/example-site/dragonfly-framework/plugins-inactive/msmtp.lsp">https://github.com/taoeffect/dragonfly- ... /msmtp.lsp">https://github.com/taoeffect/dragonfly-newlisp/blob/master/example-site/dragonfly-framework/plugins-inactive/msmtp.lsp



Enjoy!



Also - I'm offering to host newlisp forums if you guys (and Lutz) would like me to. Here's an example of the forums I already host: https://www.taoeffect.com/forum/">https://www.taoeffect.com/forum/



Advantages: no spam (*cross-fingers*) and HTTPS!

Disadvantages: might not contain the history of these forums, as it doesn't make sense to import a polluted forum.
#7
Dragonfly / Dragonfly 0.73
August 05, 2015, 09:52:41 PM
0.73 - fixed a cookie parsing bug



https://github.com/taoeffect/dragonfly-newlisp">https://github.com/taoeffect/dragonfly-newlisp
#8
newLISP in the real world / SSL + SMTP
May 26, 2014, 11:25:21 AM
So... does the smtpx.lsp module work over SSL? I'm guessing that it doesn't... is that right?
#9
Original: https://www.taoeffect.com/blog/2010/01/how-newlisp-took-my-breath-and-syntax-away/">https://www.taoeffect.com/blog/2010/01/ ... ntax-away/">https://www.taoeffect.com/blog/2010/01/how-newlisp-took-my-breath-and-syntax-away/



Translation: http://translate.google.com/translate?sl=auto&tl=en&js=n&prev=_t&hl=en&ie=UTF-8&u=http%3A%2F%2Fblog.skydark.info%2Fprogramming%2F2012%2F06%2F28%2Fnewlisp%2F">http://translate.google.com/translate?s ... newlisp%2F">http://translate.google.com/translate?sl=auto&tl=en&js=n&prev=_t&hl=en&ie=UTF-8&u=http%3A%2F%2Fblog.skydark.info%2Fprogramming%2F2012%2F06%2F28%2Fnewlisp%2F



Funny: "newLISP is a true diamond in the rough" -> Chinese -> English -> "newLISP is a genuine natural diamonds" ^_^
#10
Dragonfly / Dragonfly 0.71
June 22, 2013, 12:39:43 PM
made utf8-urlencode behave more like php. no longer escaping dashes

https://github.com/taoeffect/dragonfly-newlisp/commit/2891dfd7843237feeb775f512d0e68baebb2f2d2">https://github.com/taoeffect/dragonfly- ... baebb2f2d2">https://github.com/taoeffect/dragonfly-newlisp/commit/2891dfd7843237feeb775f512d0e68baebb2f2d2
#11
newLISP newS / TextMate bundle for newLISP
July 08, 2010, 01:53:10 PM
I've added my TextMate bundle for newLISP to github:



http://github.com/taoeffect/newLISP.tmbundle">http://github.com/taoeffect/newLISP.tmbundle
#12
I've created a little project that adds Java-like namespaces to newLISP!



You can now do stuff like:


(ns-import 'com.example.*)
(ns-import 'com.example2.Test)

(Test:foo "bar")


In a nutshell, this solves the name clashing issues in newLISP and means newLISP is now much easier to use for large projects.



It's on GitHub and Bitbucket!



http://github.com/taoeffect/namespace-newlisp">http://github.com/taoeffect/namespace-newlisp

http://bitbucket.org/taoeffect/namespace-newlisp">http://bitbucket.org/taoeffect/namespace-newlisp
#13
newLISP newS / Bug in 'process'?
June 30, 2010, 03:50:31 PM
v.10.2.9


> (begin (process "ls") (sleep 2000) (println "hi"))
hi
"hi"


Or another version:


> ((fn () (sleep 2000) (println "foo")) (process "ls"))
foo
"foo"


That happens instantly. There's no delay despite the (sleep 2000) call. Shouldn't there be a delay?
#14
Dragonfly / Dragonfly 0.70 Released!
March 22, 2010, 07:06:09 PM
Finally! Here are the changes:


 * all code uses new ++,--,extend,write,read functions (still compatible with older newlisps)
  * added 'extract' and '<-' functions to core utils
  * Route.Resource has been updated with a 'catch-all' function.
  * added documentation for MAX_POST_LENGTH in request.lsp
  * $BINARY can now handle large data (compensated for a newLISP bug in 'read-buffer').
  * DF:activate-plugin can now be used to load all lisp files in a directory
  * db/database_utils includes for-query-with-db, assoc-row-with-db, query-cell-with-db and others
  * db/database_orm - DB.OBJ - a very simple ORM for DF.DB
  * db/database_sqlite3 updated to version 1.2 (see its docs for what's new)
  * fixed Jeff's JSON.lsp plugin (switched to " instead of ' for strings)
  * fixed bug in definition of define-smacro
  * Response:cookie now returns correct value (full cookie as list) when given only key


http://github.com/taoeffect/dragonfly-newlisp/downloads">Download 0.70 from here.



This version should be safe to use with the latest version of newLISP.



Also, Dragonfly has moved off Google Code, its official repository is now located on GitHub:



http://github.com/taoeffect/dragonfly-newlisp">http://github.com/taoeffect/dragonfly-newlisp



If you prefer using Mercurial (like I do), you can http://hg-git.github.com/">use this.
#15
Nice one cormullion! Top of HN too. :-)



http://unbalanced-parentheses.nfshost.com/newlisptacklesglobalwarming">//http://unbalanced-parentheses.nfshost.com/newlisptacklesglobalwarming



Very well written actually. Are you going to eventually post what the intentional mistakes were?
#16
This would be a lifesaver, I've found myself needing this so many times: a function to give me the context of a symbol.



I.e. check out this awesome function:


(define-smacro (for-query-with-db db query ctx)
(letn (db (eval db) sql (db:prepare-sql query) keys '())
(dotimes (i (sql:col-count))
(push (sym (upper-case (sql:col-name i)) ctx) keys -1)
)
(push-autorelease-pool) ; in case we have blobs
(while (list? (setf values (sql:next-row)))
(eval (expand (cons 'begin $args) (unify keys values)))
)
(pop-autorelease-pool)
(deallocate sql)
)
)


It can't live because the body ($args) uses symbols in a different context. I have to manually *tell* 'sym' what context the symbols in the body are coming from.



This function is going to be in Dragonfly 0.61, it will let you do stuff like this:


<table>
<tr><td>ID</td><td>Name</td><td>Age</td></tr>
<% (for-query-with-db db "SELECT rowid,name,age FROM people" %>
<tr><td><%=ROWID%></td><td><%=NAME%></td><td><%=AGE%></td></tr>
<% ) %>
</table>


That's pretty great, but currently this will just show a bunch of nil's. To get it to show the right values I have to hack it up and make it ugly:


<table>
<tr><td>ID</td><td>Name</td><td>Age</td></tr>
<% (for-query-with-db db "SELECT rowid,name,age FROM people" DF %>
<tr><td><%=ROWID%></td><td><%=NAME%></td><td><%=AGE%></td></tr>
<% ) %>
</table>


I could get rid of that 'DF' on the end if there was a (sym->ctx) function available. There are so many other cool things you could do if such a function existed. Can such a function be brought into newLISP?



Edit: updated function definition to use 'expand' and 'unify'
#17
newLISP newS / Fix for strings in Jeff's JSON module
January 23, 2010, 04:17:58 PM
Just noticed that Jeff's JSON module (which is included as part of Dragonfly) encodes strings using the apostrophe (') instead of the double-quote ("). This is actually invalid JSON and will cause problems with frameworks that require valid JSON (like the latest version of jQuery, 1.4).



I've added this fix to the mercurial repo for Dragonfly, but just thought it was worth mentioning here just in case this trips anyone else up.
#18
newLISP newS / Buggy read-buffer!
January 12, 2010, 04:05:22 PM
EDIT: this file has been updated after the discovery of a new bug in 'read-buffer'.



Bug #1 - Bad usage of <int-size>



While troubleshooting a problem I took a look at source for the read-buffer function and found something that I wasn't expecting, namely that when you pass it the <int-size> parameter to specify the maximum number of bytes to read, it will actually allocate a temporary buffer of that size.



From the documentation this is not evident. I assumed that 'read-buffer' would read from <int-file> in smaller chunks, copying what it read into a smaller temporary byte array and then copying that, chunk-by-chunk, into <sym-buffer>. In my opinion this is what the function *should* do because it handles efficiently all scenarios. I.e. what if you're expecting to get data anywhere from 1KB to 100MB? I don't think it makes sense in that situation to always allocate 100MB of memory, but it would be nice to be able to tell 'read-buffer' that such an amount of data is possible.



Bug #2 (severe) - function 'read' used incorrectly



Related to Bug #1, the C read function is used incorrectly, and actually this turned out to be the cause of the problem I was having (referenced in passing above), which is that read-buffer cannot currently be used to read large amounts of data (over ~64KB, this value is system dependent). From the man page on read:


RETURN VALUES
     If successful, the number of bytes actually read is returned.  Upon read-
     ing end-of-file, zero is returned.  Otherwise, a -1 is returned and the
     global variable errno is set to indicate the error.


So the bug is that 'read-buffer' doesn't use chunked reads and perhaps consequently also does not keep reading until 0 is returned. Proper use of read is something along these lines:


int read-buffer(int fd, unsigned char *buff, int possibleSize) {
int chunk_size = possibleSize > 8192 ? 8192 : possibleSize;
unsigned char *p = buff;
int amnt;

while ( (amnt = read(fd, p, chunk_size)) != 0 && possibleSize > 0 ) {
if ( amnt == -1 ) return -1; // error!
p += amnt;
possibleSize -= amnt;
if ( possibleSize < chunk_size )
chunk_size = possibleSize;
}

return (int)(p - buff);
}
#19
newLISP newS / SMTP module improved
January 06, 2010, 09:56:06 AM
As part of my work on Dragonfly, I've updated newLISP's SMTP module.



It has the following advantages over the two SMTP modules included with newLISP:



[*] Full support for proper encoding of UTF-8 strings
  • [*] Improved interface and implementation for handling attachments and foreign characters

  • [*] Allows specifying of custom SMTP port
  • [/list]


    It's available as part of http://code.google.com/p/dragonfly-newlisp/downloads/list">Dragonfly 0.60 in the example-site/dragonfly-framework/plugins-inactive folder, and its API is http://www.rundragonfly.com/dragonfly_smtp_api">available online.



    I would like to propose including this version with newLISP. It's fully backwards compatible with the previous smtp.lsp module.



    Here's the source:


    ;; @module smtp.lsp
    ;; @description Send mail using SMTP protocol
    ;; @version 3.0 - Partial rewrite for Dragonfly. Addition attachments, custom port and proper utf8 encoding for subject/message/attachments
    ;; @version 2.3 - fix in mail-send-body, thanks to Alessandro
    ;; @version 2.2 - doc changes
    ;; @version 2.1 - changes for 10.0
    ;; @version 2.0 - March 2008, Cormullion added AUTH PLAIN authentication
    ;; @author Lutz Mueller 2001-2009, Cormullion 2008, Greg Slepak 2009-2010

    (context 'SMTP)

    ;; @syntax (SMTP:send-mail <str-from> <str-to> <str-subject> <str-message> [<str-server> [<str-usr> <str-pass> [<int-port>]]])
    ;; @param <str-from> The email address of the sender.
    ;; @param <str-to> The email address of the recipient.
    ;; @param <str-subject> The subject line of the email.
    ;; @param <str-message> The message part of the email.
    ;; @param <str-server> The address of the SMTP server (default: "localhost")
    ;; @param <str-user> Optional user name for authentication.
    ;; @param <str-pass> Optional password for authentication.
    ;; @param <int-port> Optional port to communicate on (default: 25)
    ;; @return On success 'true', on failure 'nil'.
    ;; In case the function fails returning 'nil', the function
    ;; 'SMTP:get-error-text' can be used to receive the error text.
    ;;
    ;; @example
    ;; (SMTP:send-mail "jdoe@asite.com" "somebody@isp.com" "Greetings"
    ;;   "How are you today? - john doe -" "smtp.asite.com" "jdoe" "secret")
    ;;
    ;; This logs in to the server, tries to authenticate using the username 'jdoe' and password 'secret' (if supplied),
    ;; and sends an email with the format:
    ;;
    ;;  From:    jdoe@asite.com
    ;;  To:      somebody@isp.com
    ;;  Subject: Greetings
    ;;  Message: How are you today? - John Doe -
    (define (send-mail mail-from mail-to mail-subject mail-body (SMTP-server "localhost") user-name password (port 25))
        (and
            (set 'from-hostname (nth 1 (parse mail-from "@")))
            (set 'socket (net-connect SMTP-server port))
            (confirm-request "2")
            (net-send-get-result (string "HELO " from-hostname) "2")
            (if (or (null? user-name) (null? password))  ; NOTE: changed unless -> if-not
               true (mail-authorize user-name password))
            (net-send-get-result (string "MAIL FROM: <" mail-from ">") "2")
            (net-send-get-result (string "RCPT TO: <" mail-to ">") "2")
            (net-send-get-result "DATA" "3")
            (mail-send-header)
            (mail-send-body)
            (confirm-request "2")
            (net-send-get-result "QUIT" "2")
            (or (net-close socket) true)))

    (define (confirm-request conf)
        (net-receive socket recvbuff 256 "rn")
        ; Empty out pipe. According to SMTP spec, last line has valid code.
        ; added for 1.8 for newLISP 9.2.0
        (while (< 0 (net-peek socket))
            (net-receive socket recvbuff 256 "rn")
        )
        (starts-with recvbuff conf))


    (define (net-send-get-result str conf)
       (set 'send-str (string str "rn"))
       (net-send socket send-str)
       (if conf (confirm-request conf) true))

    ; DANGER! We *must* use 'append' here instead of 'string' as the two treat "00" differently!
    (define (mail-authorize user-name password)
       (net-send-get-result
           (string "AUTH PLAIN "
                   (base64-enc (append "00" user-name "00" password))) "235"))

    ; ;old functions, we have our own.
    ; (define (mail-send-header)
    ;     (net-send-get-result (string "TO: " mail-to))
    ;     (net-send-get-result (string "FROM: " mail-from))
    ;     (net-send-get-result (string "SUBJECT: " mail-subject))
    ; ;(net-send-get-result headers)
    ;     (net-send-get-result (string "X-Mailer: newLISP v." (nth -2 (sys-info)))))
    ;
    ; (define (mail-send-body )
    ;     (net-send-get-result "")
    ;     (dolist (lne (parse mail-body "rn"))
    ;         (if (starts-with lne ".")
    ;             (net-sent-get-result (string "." lne))
    ;             (net-send-get-result lne)))
    ;     (net-send-get-result "."))

    ;; @syntax (SMTP:get-error-text)
    ;; <p>Call this to get the reason 'send-mail' returned 'nil'.</p>
    (define (get-error-text)
        recvbuff)

    ; ---------------------------------------------------------------
    ; !Attachments - Public API
    ; ---------------------------------------------------------------

    ;; @syntax (SMTP:clear-attachments)
    (define (clear-attachments)
    (setf attachments '())
    )

    ;; @syntax (SMTP:attach-document <str-content> <str-filename> [<str-disposition> [<str-mime-type> [<str-encoding>]]])
    ;; @param <str-content> The attachment data.
    ;; @param <str-filename> How you'd like your attachment to appear named in the email.
    ;; @param <str-disposition> "attachment" or "inline". default is "attachment".
    ;; @param <str-mime-type> default is "application/octet-stream".
    ;; @param <str-encoding> default is "base64". If 'encoding' is "base64" it will be automatically transformed using 'encode64-widthsafe'
    (define (attach-document content filename (disposition "attachment") (mime-type "application/octet-stream") (encoding "base64"))
    (push (list content filename disposition mime-type encoding) attachments -1)
    )

    ; ---------------------------------------------------------------
    ; !UTF-8 encoding support for non-ASCII characters
    ; ---------------------------------------------------------------

    ;; @syntax (SMTP:encode64-widthsafe <buff-data>)
    ;; <p>Useful for attaching binary data such as images. Converts the data into base64
    ;; and chops it up so that the lines are not longer than 76 characters long, making
    ;; it safe to include in the body of emails.</p>
    ;; <p>If the attachment's encoding to "base64" (which it is by default), this function
    ;; will automatically applied to the <str-content> of the email.</p>
    (define (encode64-widthsafe data)
    (join (explode (base64-enc data) 76) "n")
    )

    ;; @syntax (SMTP:encode64-line <str-line>)
    ;; <p>Creates a base64 UTF-8 compatible string, suitable for including foreign characters
    ;; in the subjects of emails. This is used by 'send-mail' automatically on the filename
    ;; of any attachments, as well as the subject of the email.</p>
    (define (encode64-line str)
    (string "=?UTF-8?B?" (base64-enc str) "?=")
    )

    ; ---------------------------------------------------------------
    ; !Attachments - Private API
    ; ---------------------------------------------------------------

    (setf boundary (string "newLISP-" (nth -2 (sys-info)) "--65z64F4n654"))
    (setf headers (string "MIME-Version: 1.0rnContent-Type: multipart/mixed; boundary=" boundary))

    (setf mail-body-wrapper (string
    {--} boundary {
    Content-Type: text/plain; charset=utf-8
    Content-Transfer-Encoding: base64

    %s

    --} boundary {%s}))

    ; filename madness. We actually do not need the *=utf-8 weirdness
    ; if we're using the encode64-line func instead of utf8-urlencode

    (setf attachment-wrapper (string
    ;{Content-Disposition: %s; filename*=utf-8''%s
    {Content-Disposition: %s; filename="%s"
    Content-Type: %s; name="%s"
    Content-Transfer-Encoding: %s

    %s

    --} boundary {%s}))

    (setf attachments '()) ; the list of attachments is placed here

    (define (prepared-body)
    (format mail-body-wrapper (encode64-widthsafe mail-body)
    ; indicate this is the last boundary if no attachments
    (if (zero? (length attachments)) "--" "")
    )
    )

    (define (mail-send-header)
        (net-send-get-result (string "TO: " mail-to))
        (net-send-get-result (string "FROM: " mail-from))
        (net-send-get-result (string "SUBJECT: " (encode64-line mail-subject)))
    (net-send-get-result headers)
        (net-send-get-result (string "X-Mailer: newLISP v." (nth -2 (sys-info)) "rn")))

    (define (mail-send-body)
    (net-send-get-result "")
    (net-send-get-result (prepared-body))
    (send-attachments)
    (net-send-get-result ".")
    )

    (define (send-attachments , encoding filename)
    (dolist (attachment attachments)
    (set 'encoding (attachment 4) 'filename (attachment 1))
    (net-send-get-result (format attachment-wrapper
    (attachment 2)
    (encode64-line filename)
    (attachment 3)
    (encode64-line filename)
    encoding
    (if (= encoding "base64")
    (encode64-widthsafe (attachment 0))
    (attachment 0)
    )
    ; indicate this is the last boundary if no more
    (if (= (+ 1 $idx) (length attachments)) "--" "")
    ))
    )
    )

    (context MAIN)
    #20
    Dragonfly / Dragonfly 0.60 Released!
    January 06, 2010, 08:37:55 AM
    Hey Dragonfly Fans - A New Year's present for you!



    http://code.google.com/p/dragonfly-newlisp/downloads/list">Dragonfly 0.60 Is Now Available For Download!



    Check out the http://www.rundragonfly.com/changes">complete list of changes, highlights include:



    [*] Dragonfly DB Interface included as a plugin
  • [*] Objective newLISP included as part of the core

  • [*] New handy DF_SELF, DF_PAGE and DF_SELF_DIR global variables

  • [*] New route Route.CGI! (inactive by default)

  • [*] New file path manipulation functions: file-ext del-ext basename dirname

  • [*] DF:viewname removed, use DF_SELF or DF_PAGE + new path functions as replacements

  • [*] Request:urlencode/decode functions now properly handle UTF8 characters (renamed to utf8-urlencode/utf8-urldecode)
  • [/list]


    If you've written your own routes, be sure to update them to use the new SET_DF_SELF function as http://www.rundragonfly.com/dragonfly_create_routes">described in the updated guide.



    Enjoy, and check out the http://www.rundragonfly.com/dragonfly_welcome">updated user guide, which now contains several new sections and now comes with syntax highlighting*! :-)



    * If you don't see it, refresh the site to clear your cache.