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

#16
newLISP in the real world / Re: nL cron script
October 28, 2019, 04:33:37 AM
Working!



Moving the txt file and script to the home directory made cron all go!



You always share the best secrets ralph, thanks very much again for this!
#17
newLISP in the real world / Re: nL cron script
October 27, 2019, 08:06:33 PM
ralph,



thanks for the help!



my nL script file has this already at top:


#!/usr/bin/env newlisp

I can run it from the command line fine and it does it all.



I am almost ready to leave a nL process hanging just to make it done.?
#18
newLISP in the real world / Re: nL cron script
October 27, 2019, 04:38:07 PM
Hi and thanks ralph,



I had tried that as well but it still doesn't append the file.



Any way to check for why it might not be working? Thanks!
#19
Thanks for link!
#20
newLISP in the real world / nL cron script
October 26, 2019, 12:56:33 AM
Hi,



I have a script I am trying to run from cron on Debian/Ubuntu.


* * * * * joe /home/joe/winny/winny.lsp

The permissions of winny.lsp are 755.



Syslog looks like it is executing:


Oct 26 01:49:01 jsfccfow CRON[6574]: (joe) CMD (joe /home/joe/winny/winny.lsp)

The winny.lsp script contains:


(append-file "ltcbtc.txt" (println pairs (date (date-value) 0 "%y%m%d%H%M%S")))

The ltcbtc.txt file is already created and chmoded to 755.



I am not getting anything added to ltcbtc.txt file.



Anything I might be missing to get the nL script to run w cron?



Thank you! :-)
#21
newLISP in the real world / Re: translating big numbers
October 12, 2019, 10:35:44 PM
Ok super, thanks Ralph!



format always seals the deal. I see it now.



Out of curiousity, where are all the numbers coming from after the 0's in the following?


> (format "%0.100f" -2.000000000000049e-07)
"-0.0000002000000000000048878588486791010869758622447989182546734809875488281250000000000000000000000000"


I would think it would be '"-0.00000020000000000000490000...'?
#22
newLISP in the real world / translating big numbers
October 12, 2019, 06:22:58 PM
Hi,



I often get this sort of number:



-2.000000000000049e-07



I would like number to just display itself, without the "e-" exponent thing.



I don't mind zeros and I have a big screen and it would love to see the real number.



Would there be an easy way to convert the e number back into normal digits?



Thanks much! :-)
#23
newLISP in the real world / Re: values into mul
October 11, 2019, 04:46:06 PM
rickyboy,



You're the man, thanks big!



I hadn't gotten so far as the read-expr, much appreciated! =)
#24
newLISP in the real world / values into mul
October 11, 2019, 04:08:36 PM
Hi,



I am trying this:


(set 'abc "8888")
(println abc)
(println (mul 2 abc))


and getting this:


8888

ERR: value expected in function mul : abc


What would be the way to get values into the mul function?



Thanks!
#25
Anything else we might add? / dragonfly artwork
October 10, 2019, 05:46:35 PM
Cool dragonfly art.



Came from the back cover of a magazine Birdy.
#26
newLISP in the real world / ccxt with nL
July 31, 2019, 03:33:14 AM
Hi,



ccxt has 'support' for php, python and js.



https://github.com/ccxt/ccxt">https://github.com/ccxt/ccxt

https://github.com/ccxt/ccxt/wiki/Manual#api-methods--endpoints">https://github.com/ccxt/ccxt/wiki/Manua ... -endpoints">https://github.com/ccxt/ccxt/wiki/Manual#api-methods--endpoints



I would like to skip those languages and simply access its api endpoints from nL.



Would anyone have a thought on how this might be done?



Thank you for any tip or suggestion on this! :-)
#27
Wow, that did the trick!



Thank you for the insight Ralph! :9)
#28
newLISP in the real world / loading html templates
June 17, 2019, 08:10:09 AM
Hi,



I think I should load html templates with set command, however when I surround the html with the [text][/text] tags and use println to display the html, it omits the header.



For example, this code:


(set 'template [text]<!DOCTYPE html>
<html lang="en">
<title>W3.CSS Template</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://www.w3schools.com/w3css/4/w3.css">
<link rel="stylesheet" href="https://www.w3schools.com/lib/w3-theme-black.css">
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<style>
html,body,h1,h2,h3,h4,h5,h6 {font-family: "Roboto", sans-serif;}
.w3-sidebar {
  z-index: 3;
  width: 250px;
  top: 43px;
  bottom: 0;
  height: inherit;
}
</style>
<body>

<!-- Navbar -->
<div class="w3-top">
  <div class="w3-bar w3-theme w3-top w3-left-align w3-large">
    <a class="w3-bar-item w3-button w3-right w3-hide-large w3-hover-white w3-large w3-theme-l1" href="javascript:void(0)" onclick="w3_open()"><i class="fa fa-bars"></i></a>
    <a href="#" class="w3-bar-item w3-button w3-theme-l1">Logo</a>
    <a href="#" class="w3-bar-item w3-button w3-hide-small w3-hover-white">About</a>
    <a href="#" class="w3-bar-item w3-button w3-hide-small w3-hover-white">Values</a>
    <a href="#" class="w3-bar-item w3-button w3-hide-small w3-hover-white">News</a>
    <a href="#" class="w3-bar-item w3-button w3-hide-small w3-hover-white">Contact</a>
    <a href="#" class="w3-bar-item w3-button w3-hide-small w3-hide-medium w3-hover-white">Clients</a>
    <a href="#" class="w3-bar-item w3-button w3-hide-small w3-hide-medium w3-hover-white">Partners</a>
  </div>
</div>

<!-- Sidebar -->
<nav class="w3-sidebar w3-bar-block w3-collapse w3-large w3-theme-l5 w3-animate-left" id="mySidebar">
  <a href="javascript:void(0)" onclick="w3_close()" class="w3-right w3-xlarge w3-padding-large w3-hover-black w3-hide-large" title="Close Menu">
    <i class="fa fa-remove"></i>
  </a>
  <h4 class="w3-bar-item"><b>Menu</b></h4>
  <a class="w3-bar-item w3-button w3-hover-black" href="#">Link</a>
  <a class="w3-bar-item w3-button w3-hover-black" href="#">Link</a>
  <a class="w3-bar-item w3-button w3-hover-black" href="#">Link</a>
  <a class="w3-bar-item w3-button w3-hover-black" href="#">Link</a>
</nav>

<!-- Overlay effect when opening sidebar on small screens -->
<div class="w3-overlay w3-hide-large" onclick="w3_close()" style="cursor:pointer" title="close side menu" id="myOverlay"></div>

<!-- Main content: shift it to the right by 250 pixels when the sidebar is visible -->
<div class="w3-main" style="margin-left:250px">

  <div class="w3-row w3-padding-64">
    <div class="w3-twothird w3-container">
      <h1 class="w3-text-teal">Heading</h1>
      <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Lorem ipsum
        dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.</p>
    </div>
    <div class="w3-third w3-container">
      <p class="w3-border w3-padding-large w3-padding-32 w3-center">AD</p>
      <p class="w3-border w3-padding-large w3-padding-64 w3-center">AD</p>
    </div>
  </div>

  <div class="w3-row">
    <div class="w3-twothird w3-container">
      <h1 class="w3-text-teal">Heading</h1>
      <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Lorem ipsum
        dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.</p>
    </div>
    <div class="w3-third w3-container">
      <p class="w3-border w3-padding-large w3-padding-32 w3-center">AD</p>
      <p class="w3-border w3-padding-large w3-padding-64 w3-center">AD</p>
    </div>
  </div>

  <div class="w3-row w3-padding-64">
    <div class="w3-twothird w3-container">
      <h1 class="w3-text-teal">Heading</h1>
      <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Lorem ipsum
        dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.</p>
    </div>
    <div class="w3-third w3-container">
      <p class="w3-border w3-padding-large w3-padding-32 w3-center">AD</p>
      <p class="w3-border w3-padding-large w3-padding-64 w3-center">AD</p>
    </div>
  </div>

  <!-- Pagination -->
  <div class="w3-center w3-padding-32">
    <div class="w3-bar">
      <a class="w3-button w3-black" href="#">1</a>
      <a class="w3-button w3-hover-black" href="#">2</a>
      <a class="w3-button w3-hover-black" href="#">3</a>
      <a class="w3-button w3-hover-black" href="#">4</a>
      <a class="w3-button w3-hover-black" href="#">5</a>
      <a class="w3-button w3-hover-black" href="#">ยป</a>
    </div>
  </div>

  <footer id="myFooter">
    <div class="w3-container w3-theme-l2 w3-padding-32">
      <h4>Footer</h4>
    </div>

    <div class="w3-container w3-theme-l1">
      <p>Powered by <a href="https://www.w3schools.com/w3css/default.asp" target="_blank">w3.css</a></p>
    </div>
  </footer>

<!-- END MAIN -->
</div>

<script>
// Get the Sidebar
var mySidebar = document.getElementById("mySidebar");

// Get the DIV with overlay effect
var overlayBg = document.getElementById("myOverlay");

// Toggle between showing and hiding the sidebar, and add overlay effect
function w3_open() {
  if (mySidebar.style.display === 'block') {
    mySidebar.style.display = 'none';
    overlayBg.style.display = "none";
  } else {
    mySidebar.style.display = 'block';
    overlayBg.style.display = "block";
  }
}

// Close the sidebar with the close button
function w3_close() {
  mySidebar.style.display = "none";
  overlayBg.style.display = "none";
}
</script>

</body>
</html>
[/text])


when called with (println template), the browser yields a page that is missing the html header info and begins the source html with this:


<!-- Navbar -->
<div class="w3-top">
  <div class="w3-bar w3-theme w3-top w3-left-align w3-large">
    <a class="w3-bar-item w3-button w3-right w3-hide-large w3-hover-white w3-large w3-theme-l1" href="javascript:void(0)" onclick="w3_open()"><i class="fa fa-bars"></i></a>
    <a href="#" class="w3-bar-item w3-button w3-theme-l1">Logo</a>
    <a href="#" class="w3-bar-item w3-button w3-hide-small w3-hover-white">About</a>
    <a href="#" class="w3-bar-item w3-button w3-hide-small w3-hover-white">Values</a>
    <a href="#" class="w3-bar-item w3-button w3-hide-small w3-hover-white">News</a>
    <a href="#" class="w3-bar-item w3-button w3-hide-small w3-hover-white">Contact</a>
    <a href="#" class="w3-bar-item w3-button w3-hide-small w3-hide-medium w3-hover-white">Clients</a>
    <a href="#" class="w3-bar-item w3-button w3-hide-small w3-hide-medium w3-hover-white">Partners</a>
  </div>
</div>

<!-- Sidebar --> ...


Is there something in the html header that is causing it not to display? I thought the [text][/text] formatters allowed anything to go inside of them?



Thanks very much!
#29
Blingo!



Raisins have been picked Ralph! Woo hoo! :D



What a treasure it is to have such support!



I learned more than I was looking for and am such happier!



Kind thanks for your suggestion and guidance, again.



It's a happy json raisin pickin from the cake kinda day today! :P
#30
Ralph



Gotcha on the x y term form finding they y data if it is there. Also on the error prevention by returning an empty value instead of getting a nil value from the ref statement. It's brilliant and certainly makes using json data more friendly.



I am getting the


ERR: data type and format don't match in function format :

error after integrating your simpler map suggestion.


(set 'ali (get-url ali-link))
(set 'alie (json-parse ali))
(set 'jsondata (lookup "products" (lookup "result" alie)))
 
(define (raisins jsonitem)
    (format "<a href="%s">%s</a>n"<img src="%s">nn"
          (string (if (ref '("productUrl" ?) jsonitem match true) ($it 1) '()))
          (string (if (ref '("productTitle" ?) jsonitem match true) ($it 1) '()))
          (string (if (ref '("imageUrl" ?) jsonitem match true) ($it 1) '())) ))
 
(println (join (map raisins jsondata) "n"))


(println jsondata) gives this:


((("productTitle" "GILDAN EMACS GNU XEMACS LISP programmers wildebeest short-sleeved T-shirt") ("imageUrl" "https://ae01.alicdn.com/kf/HTB1HMtjKuuSBuNjSsziq6zq8pXaz/GILDAN-EMACS-GNU-XEMACS-font-b-LISP-b-font-programmers-wildebeest-short-sleeved-T-shirt.jpg") ("productUrl" "https://www.aliexpress.com/item/GILDAN-EMACS-GNU-XEMACS-LISP-programmers-wildebeest-short-sleeved-T-shirt/32919995838.html")) (("productTitle" ...

What I do notice looking at the JSON result in Firefox, is that there are <font>LISP</font> in the productTitle, which may be confusing the syntax for format?



In the JSON Firefox display, it shows


productTitle:     "EMACS GNU XEMACS <font><b>LISP</b></font> programmers wildebeest men Sweatshirts Thick Combed Cotton"

It seems these raisins are quite close to being picked. Thank you again for your guidance, Ralph.