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

#16
Quote from: "Fanda"Just in case you want to play with fuzzy logic, take a peek:

http://www.intricatevisions.com/index.cgi?page=nlfuzzy">http://www.intricatevisions.com/index.cgi?page=nlfuzzy



You will find a fuzzy logic library and an example of water temperature regulation.



Fanda


Hi!



Does anyone have a copy of this library? The website seems to be down and I'm interested in some fuzzy logic examples in newLISP.



Thanks in advance.

Marc
#17
Welcome to the powerful world of newLISP :-)
#18
Hi Ricky!



Dragonfly is rock-solid for my needs. By using the internal Resources API it's very flexible when talking to or receiving web services. So I'm not working on Dragonfly II. ;)



Here's a sample CRUD skeleton for a model "coaching":



(DF:activate-plugin "official/sqlite3")

(new Resource 'Resource.Coaching)
(context 'Resource.Coaching)

(define (Resource.Coaching:Resource.Coaching action id response-format)
(catch-all action id response-format)
)

(define (catch-all action id response-format)

(case action
("create"

)

("read"

)

("update"

)

("delete"

)

(true
(Response:content-type Response:text)
(println "This is API Version 1.0rn")
(println "Can't find called Action: " action "rn")
(println "Can't find called ID: " id "rn")
(println "Response format: " response-format "rn")
) ; END default

) ; END CASE


) ; END catch-all

(context MAIN)


Just put in Your newLISP scripts into the actions and You get an API which responds to calls like
http://localhost/coaching/create/1
http://localhost/coaching/read/1
http://localhost/coaching/delete/1
http://localhost/coaching/update/1


If You need help on scrapers, SQLite or something else in newLISP just ping me. I've got a lot of libraries.



Cheers

Marc
#19
My current project is a dashboard analytics for a field sales force. Sales people can track in real-time their leads, offers and sales. The CEO Board have a nice visualization with many charts and graphics.



It's powered by a custom tuned Dragonfly Framework with Twitter Bootstrap and lot's of JQuery. In the back their is a REST API.



The best: newLISP is so blazing fast, that their IT Department always wondered.



Cheers

Marc
#20
Thanks for this useful and small scraper.



Best wishes

Marc
#21
QuoteMarc,



Officially, newLISP is undeniably a lisp and can be used in Lisp in Summer Projects.



Personally, I'd love to see some newLISP projects!    Anything in particular you have in mind?



 Heow Goodman

 Lisp In Summer Projects


Good to hear, isn't it? :-)



Let's rock and roll
#22
Hi!



Does anyone have experience in parsing large OSM (Openstreetmap) files? I'm trying to parse them with (xml-parse) but I get an error from newLISP telling me that there's not enough memory for (read-file)



The file is 32GB (gigabytes!).



Here's the error message:



newlisp -m 4096 -s 10000 parse.lsp
newlisp(18433) malloc: *** mmap(size=4258476032) failed (error code=12)
*** error: can't allocate region
*** set a breakpoint in malloc_error_break to debug

ERR: not enough memory in function read-file


Thanks for any suggestion.

Marc
#23
newLISP in the real world / newLISP and big data?
May 08, 2013, 04:49:15 AM
Hi!



I've just come across this blog post and wondered if the Gist shown there is newLISP? Because the use of (nth) looks pretty familiar to me.



http://blog.bugsense.com/post/49924755479/bigdata-in-motion-building-a-real-time-android">//http://blog.bugsense.com/post/49924755479/bigdata-in-motion-building-a-real-time-android



What Do You think?



(load "stdlib.lql")
(load "dblib.lql")
 
(timespace "day")
 
(define string-row *stream*)
 
(let ((row (reverse
            (string-split (str string-row) ":"))))
  (if (= (length row) 4)
    (begin
      (let ((os-ver (nth row 0))
            (phone-model (nth row 1))
            (error-class (nth row 2)))
      (incdb "sessions" 1)
      (incdb (session-by "osver" os-ver) 1)
      (incdb (session-by "device" phone-model) 1)
      (incdb (session-by "error" error-class) 1)
      (incdb (session-by-crash "os_ver_class" os-ver error-class) 1)
      (incdb (session-by-crash "device_class" phone-model error-class) 1)
 
      (push! (unique "os_ver") os-ver)
      (push! (unique "device") phone-model)
      (push! (unique "error_class") error-class)))
      #f))




Update:
QuoteA full blown custom LISP language written in C to implement queries, which is many times faster that having a VM (with a garbage collector) online all the time

http://highscalability.com/blog/2012/11/26/bigdata-using-erlang-c-and-lisp-to-fight-the-tsunami-of-mobi.html">//http://highscalability.com/blog/2012/11/26/bigdata-using-erlang-c-and-lisp-to-fight-the-tsunami-of-mobi.html
#24
Hi newLISPers



here comes a quick hack for the weekend. I needed a way to authenticate against the Dropbox API for one of my projects. Unfortunately the API uses oAuth and needs "https" so I have to use the CURL library instead of newLISP build-in (get-url).



At first You need to create Your own Dropbox API keys. That's very easy.



  • Login to Dropbox

    Open this URL https://www.dropbox.com/developers/apps">//https://www.dropbox.com/developers/apps

    Click "Create an app" and follow the guide

  • [/list]

    Now You need this little script to get the authentication tokens.



    #!/usr/bin/env newlisp

    ;; BEGIN SETTINGS

    ;; Set Your own Dropbox API keys
    ;; You can create these keys here: https://www.dropbox.com/developers/apps
    (set 'oauth-consumer-key "this-is-your-app-key") ;; this is the App key
    (set 'oauth-signature "this-is-so-secret") ;; this is the App secret
    (set 'curl "curl") ;; set path to curl executable

    ;; END SETTINGS


    (set 'post-request (append {'Authorization: OAuth oauth_version="1.0", oauth_signature_method="PLAINTEXT", oauth_consumer_key="} oauth-consumer-key {", oauth_signature="} oauth-signature {&"'}))
    (set 'post-target "https://api.dropbox.com/1/oauth/request_token")

    ;; GET TOKEN SECRET
    (set 'curlpost (append curl " --silent --header " post-request " " post-target))
    (set 'response (first (exec curlpost)))
    (set 'oauth_token_secret  (first (parse response "&")))
    (set 'the-secret (last (parse oauth_token_secret "=")))
    (set 'oauth_token (last (parse response "&")))

    ;; AUTH BY USER
    (set 'authurl "https://www.dropbox.com/1/oauth/authorize?")
    (set 'callbackurl "&oauth_callback=http://localhost/auth_complete")
    (set 'curlauth (append curl " --silent " authurl oauth_token callbackurl))
    (exec curlauth)
    (println "Opening browser for authorization ... please follow further steps in Your browser.")
    (set 'launchcmd (append "open " authurl oauth_token callbackurl))
    (exec launchcmd)

    (println "When authorization on Dropbox.com was successful press the 'a' key: ")
    (while (!= (set 'key (read-key)) 97)
    (println "When authorization on Dropbox.com was successful press the 'a' key: ")
    )

    ;; GET ACCESS TOKEN
    (set 'access-request (append {'Authorization: OAuth oauth_version="1.0", oauth_signature_method="PLAINTEXT", oauth_consumer_key="4n1wccbr1cyx3la", } oauth_token {", oauth_signature="xppxoa9rpqoviwc&} the-secret {"'}))

    (set 'access-target "https://api.dropbox.com/1/oauth/access_token")
    (set 'curlaccess (append curl " --silent --header " access-request " " access-target))
    (set 'access_response (first (exec curlaccess)))
    (println "Access response (JSON): " access_response)

    (set 'access_token (parse access_response "&"))
    (println "Access token: " access_token)
    (set 'oauth_token (last (parse (nth 1 access_token) "=")))
    (println "OAuth token: " oauth_token)
    (write-file "oauth-token.txt" (string oauth_token))

    (set 'access_token_secret (last (parse (first (parse access_response "&")) "=")))
    (println "Access token secret: " access_token_secret)
    (write-file "token.txt" (string access_token_secret))
    (exit)


    ---- LAUNCH the script ---- :-)



    Beware: I've just tested it on OSX.



    When You run this script in OSX terminal it'll automatically open Your default browser and asks if newLISP get's access to Your Dropbox. Grant access now.



    Now go back to terminal and press the "a" key to go on with the script. We need to pause, because we've to wait for user interaction (grant access) in the browser.



    Finally You should see the Dropbox API response with OAuth Token and Access Token Secret.



    ----- Use the Dropbox API ----- :-) :-)



    With these tokens/keys we can use the Dropbox API. Here's a little snippet to get the account information.



    #!/usr/bin/env newlisp

    ;; BEGIN SETTINGS

    ;; Set Your own Dropbox API keys
    ;; You can create these keys here: https://www.dropbox.com/developers/apps
    (set 'oauth-consumer-key "this-is-your-app-key") ;; this is the App key
    (set 'oauth-signature "this-is-so-secret") ;; this is the App secret
    (set 'curl "curl") ;; set path to curl executable

    ;; END SETTINGS

    (set 'access_token_secret (read-file "token.txt"))
    (set 'oauth_token (read-file "oauth-token.txt"))
    (set 'header (append {'Authorization: OAuth oauth_version="1.0", oauth_signature_method="PLAINTEXT", oauth_consumer_key="} oauth-consumer-key {", oauth_token="} oauth_token {", oauth_signature="} oauth-signature {&} access_token_secret {"'}))

    (define (json2list response)
    (json-parse (first response))
    )

    (define (accountinfo)
    (set 'endpoint "https://api.dropbox.com/1/account/info")
    (set 'url (append curl " --silent --header " header " " endpoint))
    (set 'response (exec url))
    (json2list response)
    )

    (println (accountinfo))
    (exit)


    Hopefully everything works and You have some fun with the Dropbox API. When I find some time, maybe I'll write a complete Dropbox module.



    Cheers

    Marc
#25
newLISP in the real world / Re: Using MaxMind's GeoIP.js
February 12, 2013, 09:42:21 PM
Thanks so much Lutz! Especially for this explanation:


QuoteTransform data types using float on the sub-expression, the second $1 is the return value for the float function when conversion fails:


I didn't notice that find-all is so powerful.
#26
newLISP in the real world / Using MaxMind's GeoIP.js
February 12, 2013, 06:51:59 AM
This one might become useful in your web projects. It calls an external javascript file on MaxMinds geolocation servers and returns your browsers location.



I'm using it in a Dragonfly project to detect the users location and serving current weather condition.



(set 'jsdata (get-url "http://j.maxmind.com/app/geoip.js"))
(set 'location (find-all [text]'(.*)'[/text] jsdata))
(print location)


And something cool - it's free if you put a link on your website :-)



http://dev.maxmind.com/geoip/javascript">http://dev.maxmind.com/geoip/javascript

Free use of the service is allowed with attribution in the following form:



This website uses <a href="http://www.maxmind.com/en/javascript%22%3EGeoIP">http://www.maxmind.com/en/javascript">GeoIP Javascript from MaxMind</a>
#27
newLISP newS / Re: newLISP Development release 10.4.6
February 09, 2013, 05:12:09 AM
Thanks so much Lutz for Your great work!
#28
newLISP in the real world / Re: Newbie question
January 27, 2013, 12:50:56 AM
Welcome Peter!



Would You please post an example of Your XML. It's easier to help then.



Thanks

- Marc
#29
Great and clean script. I just need to determine my home server's SLA ;-)
#30
Whither newLISP? / Re: How to get newLISP popular?
January 09, 2013, 07:01:22 AM
Here are some good links about the iOS Guidelines



In short:


Quote
iOS does not allow shared libraries!



Why?



They are afraid your app will download a new version of the shared library at runtime and change the behavior and thus circumvent the whole Apple App Store Review process.


http://blog.burhum.com/post/38236943467/your-lgpl-license-is-completely-destroying-ios-adoption">//http://blog.burhum.com/post/38236943467/your-lgpl-license-is-completely-destroying-ios-adoption

http://stackoverflow.com/questions/4733847/can-you-build-dynamic-libraries-for-ios-and-load-them-at-runtime">//http://stackoverflow.com/questions/4733847/can-you-build-dynamic-libraries-for-ios-and-load-them-at-runtime