calva

Wednesdays you might find @U0ETXRFEW in the Gather Calva space. Invite is https://gather.town/invite?token=GZqrm7CR and the password is `Be kind`.
Faris 2021-01-01T06:03:53.028900Z

Thank you for all your work @pez and the rest of the Calva team!

1
❤️ 2
practicalli-john 2021-01-01T11:11:47.038300Z

Happy new year. Is there a list of Calva function names or some API docs? I'd like to add key bindings to VSpaceCode that call Calva functions. For example, defining , e f to evaluate a top level form by calling a function such as calva.evalCurrentTopLevelForm Alternative, I guess I could clone the Calva project and poke around and hopefully use auto-complere to discover function names. Thanks.

pez 2021-01-01T11:16:43.040200Z

If you open the Calva extension in the Extensions pane, there is a tab there Feature Contributions and in there you find a section for Commands. Most commands take no arguments.

👍 1
pez 2021-01-02T10:42:19.084400Z

Awesome! Let’s see when you come to paredit. Haha.

practicalli-john 2021-01-02T17:49:03.088700Z

paredit seems just as straight forward. There seem to be more paredit commands than I am familiar with, so will require a bit of though about the keys to use The rewrap function is part of refactor in Spacemacs, but it makes sense to add it in structured editing using the same key binding as Calva - i.e. using the ({[" pscq keys I believe I can skip the selecting s-expressions of paredit, as VSpaceCode already has the same selection tools that seem to work.

pez 2021-01-01T11:17:29.040800Z

I’d be very interested in publishing any bindings you produce that way on http://calva.io somewhere.

pez 2021-01-01T11:20:33.042700Z

Some (I guess most) shortcuts are contextual, using the when clause. I don’t know what VSpaceCode allows, but anyway, to find the when clauses, open the Keyboard Shortcuts pane and look for the commands.

👍 1
Eugen 2021-01-01T11:21:08.042900Z

happy new year !

Eugen 2021-01-01T11:22:28.044400Z

is there a way to reload compiled classes in Calva? Right now I just close vscode, open and re-jack-in . I compile java classes with gen-class that I need to reload

Eugen 2021-01-01T11:22:52.044900Z

or at least a command to restart and re-jack in without closing vscode ?

roelof 2021-01-01T11:23:57.045400Z

@eugen.stan happy new year from the Netherlands

🎆 1
🦜 2
pez 2021-01-01T12:47:30.049900Z

Happy New Year, @eugen.stan! I’m not sure what it takes to reload compiled classes. But StackOverflow suggests to leave a (comment (compile '<http://name.space|name.space>)) in the file. Where the comment hides the compile command from itself. Then you should be able to use Calva’s Evaluate Top Level Form on that.

👍 1
pez 2021-01-01T12:49:57.052400Z

To restart the REPL, if it is started with Jack-in, you can use the Disconnect REPL command. I’m not sure that is going to stay like that, because it is a bit weird that disconnect also jacks out, I think. But what you can rely on to remain is that if you jack-in again, the process will start with jacking out. So I change my suggestion to “Just jack in again” 😃 .

👍 1
pez 2021-01-01T14:31:02.059100Z

New Year’s release of Calva, v2.0.144, with these changes: • https://github.com/BetterThanTomorrow/calva/issues/915https://github.com/BetterThanTomorrow/calva/issues/910https://github.com/BetterThanTomorrow/calva/issues/904 See these docs for info about loading current namespace in the repl window https://calva.io/output/#load-current-namespace

👍 1
🎆 2
roelof 2021-01-01T14:31:53.059500Z

installling right now

2
roelof 2021-01-01T15:36:16.060600Z

are there here some people who work in linux ?

roelof 2021-01-01T15:36:24.060800Z

or wsl2

Eugen 2021-01-01T17:35:28.061Z

I work on linux

roelof 2021-01-01T17:36:11.061800Z

oke, I try to find out if there is a problem wth my setip or a problem in a crux tutorial

roelof 2021-01-01T17:36:24.062100Z

are you willing to try some code ?

roelof 2021-01-02T10:19:20.083500Z

yep, and very very difficult to find out what causes the issue

roelof 2021-01-01T17:36:26.062300Z

@eugen.stan

Eugen 2021-01-01T17:36:28.062500Z

sure

Eugen 2021-01-01T17:36:47.062600Z

let's write here

roelof 2021-01-01T17:37:28.063400Z

expeciallty the entity-history part

roelof 2021-01-01T17:37:49.064Z

with my it hangs and with the tutorial maker it works

roelof 2021-01-01T17:38:38.064200Z

oke

roelof 2021-01-01T17:39:04.064400Z

this works not on my computer and works on the computer of the maker of this tutorial

roelof 2021-01-01T17:39:28.064600Z

;; tag::require[]
(ns tutorials.crux.earth
  (:require [crux.api :as crux]))
;; end::require[]
;; tag::node[]
(def node (crux/start-node {}))
;; end::node[]
;; tag::manifest[]
(def manifest
  {:crux.db/id :manifest
   :pilot-name "Johanna"
   :id/rocket "SB002-sol"
   :id/employee "22910x2"
   :badges ["SETUP"]
   :cargo ["stereo" "gold fish" "slippers" "secret note"]})
;; end::manifest[]
;; tag::submit[]
(crux/submit-tx node [[:crux.tx/put manifest]])
;;=&gt;#:crux.tx{:tx-id 0, :tx-time #inst "2020-06-18T13:54:08.375-00:00"}
;; end::submit[]
;; tag::check[]
(crux/entity-history (crux/db node) :manifest :asc)
;;=&gt; {:crux.tx/tx-time #inst "2020-06-18T13:54:08.375-00:00",
;;    :crux.tx/tx-id 0,
;;    :crux.db/valid-time #inst "2020-06-18T13:54:08.375-00:00",
;;    :crux.db/content-hash #crux/id "0ab888b62775eea2eb2fffe10c9f6bfbf661a792"}
;; end::check[]

Eugen 2021-01-01T17:39:39.064800Z

are you sure? code samples do not always work

roelof 2021-01-01T17:39:59.065Z

yep, I talked with her the whole afternoon and we cannot solve it

Eugen 2021-01-01T17:40:41.065200Z

ok, so i need the dependency and also the runing db?

Eugen 2021-01-01T17:41:09.065400Z

please share the crux dependency line

roelof 2021-01-01T17:41:55.065700Z

oke

roelof 2021-01-01T17:42:17.065900Z

I have this on my project.clj file

:dependencies [[org.clojure/clojure "1.10.0"]
                 [juxt/crux-core "RELEASE"]]

Eugen 2021-01-01T17:45:07.066300Z

does this help ?

practicalli-john 2021-01-01T17:45:53.066700Z

Initially starting with just languageId, adding any when clauses if required

roelof 2021-01-01T17:48:04.066900Z

yep., it also seems to work on your computer

Eugen 2021-01-01T17:48:18.067100Z

have you restarted you repl?

roelof 2021-01-01T17:48:37.067300Z

several times

Eugen 2021-01-01T17:48:40.067500Z

you are using def and from what I kno that is not the best way to handle it

Eugen 2021-01-01T17:48:42.067700Z

hmm

Eugen 2021-01-01T17:48:46.067900Z

I'm using clojure 1.10.1

Eugen 2021-01-01T17:49:10.068100Z

have you restarted your computer ? 🙂

roelof 2021-01-01T17:49:52.068400Z

nope

Eugen 2021-01-01T17:49:52.068600Z

java -version
openjdk version "1.8.0_275"
OpenJDK Runtime Environment (AdoptOpenJDK)(build 1.8.0_275-b01)
OpenJDK 64-Bit Server VM (AdoptOpenJDK)(build 25.275-b01, mixed mode)

Eugen 2021-01-01T17:50:10.068800Z

uname -a
Linux daos-495 5.9.0-5-amd64 #1 SMP Debian 5.9.15-1 (2020-12-17) x86_64 GNU/Linux

roelof 2021-01-01T17:50:30.069Z

`

java -version
openjdk version "11.0.9.1" 2020-11-04
OpenJDK Runtime Environment (build 11.0.9.1+1-Ubuntu-0ubuntu1.20.04)
OpenJDK 64-Bit Server VM (build 11.0.9.1+1-Ubuntu-0ubuntu1.20.04, mixed mode, sharing)

Eugen 2021-01-01T17:50:36.069200Z

well, good luck, I hope it helps

roelof 2021-01-01T17:51:05.069400Z

roelof@DESKTOP-GKSR5BK:~/banking$ uname -a
Linux DESKTOP-GKSR5BK 4.19.128-microsoft-standard #1 SMP Tue Jun 23 12:58:10 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux

Eugen 2021-01-01T17:55:07.069600Z

Eugen 2021-01-01T17:55:14.070Z

tried with java 11 also

roelof 2021-01-01T17:56:43.070200Z

thanks, im out of ideas

Eugen 2021-01-01T17:57:17.070400Z

have you tried to run it from a main (outside of REPL)?

Eugen 2021-01-01T17:57:41.070600Z

it does seem to be a setup issue

roelof 2021-01-01T18:00:10.070800Z

no, I do not know how I then can run it

Eugen 2021-01-01T18:02:38.071Z

give me a few minutes

roelof 2021-01-01T18:02:51.071200Z

take your time

Eugen 2021-01-01T18:03:01.071400Z

do you have clojure / clj tools installed?

roelof 2021-01-01T18:04:21.071600Z

yep

roelof 2021-01-01T18:04:41.071800Z

when I try this :

(defn -main[](
            (crux/entity-history
 (crux/db node #inst "2116-01-01T09")
 :kaarlang/clients
 :desc
 {:with-docs? true})
            ))

(-main)

roelof 2021-01-01T18:04:52.072Z

it stil seems to hang

Eugen 2021-01-01T18:05:37.072200Z

you should not call (-main)

roelof 2021-01-01T18:06:52.072400Z

oke

roelof 2021-01-01T18:07:10.072600Z

I wil not doing anything till you say so

Eugen 2021-01-01T18:10:07.072800Z

you could add an alias to run the main function https://stackoverflow.com/questions/11023762/leiningen-with-multiple-main-classes

roelof 2021-01-01T18:11:18.073100Z

?? I do not have any or only 1 main in this project

Eugen 2021-01-01T18:12:57.073300Z

ok, then make leiningen run this main

Eugen 2021-01-01T18:13:01.073500Z

(defn -main []
  (let [node (crux/start-node {})
        manifest {:crux.db/id :manifest
                  :pilot-name "Johanna"
                  :id/rocket "SB002-sol"
                  :id/employee "22910x2"
                  :badges ["SETUP"]
                  :cargo ["stereo" "gold fish" "slippers" "secret note"]}]
    (crux/submit-tx node [[:crux.tx/put manifest]])
    (crux/entity-history (crux/db node) :manifest :asc)
    ))

roelof 2021-01-01T18:15:24.073700Z

oke, how do I do that

roelof 2021-01-01T18:15:49.073900Z

in repl I see this output : #'tutorials.crux.jupiter/-main

Eugen 2021-01-01T18:16:57.074100Z

you shuould define a :main https://leiningen.org/

Eugen 2021-01-01T18:17:07.074400Z

(defproject <http://leiningen.org|leiningen.org> "1.0.0"
  :description "Generate static HTML for <https://leiningen.org>"
  :dependencies [[enlive "1.0.1"]
                 [cheshire "4.0.0"]
                 [org.markdownj/markdownj "0.3.0-1.0.2b4"]]
  :main leiningen.web)

Eugen 2021-01-01T18:17:23.074600Z

define the ns that contains the -main function

roelof 2021-01-01T18:19:39.075400Z

did :

(defproject practicalli/crux-demo "0.1.0-SNAPSHOT"
  :description "FIXME: write description"
  :url "<http://example.com/FIXME>"
  :license {:name "EPL-2.0 OR GPL-2.0-or-later WITH Classpath-exception-2.0"
            :url "<https://www.eclipse.org/legal/epl-2.0/>"}
  :dependencies [[org.clojure/clojure "1.10.0"]
                 [juxt/crux-core "RELEASE"]]
  :main tutorials.crux.jupiter
  :target-path "target/%s"
  :profiles {:uberjar {:aot :all}})

roelof 2021-01-01T18:24:47.075600Z

hmm, does not work

roelof 2021-01-01T18:25:24.075800Z

I have this in my file

(defn -main []
  (let [node (crux/start-node {})
        manifest {:crux.db/id :manifest
                  :pilot-name "Johanna"
                  :id/rocket "SB002-sol"
                  :id/employee "22910x2"
                  :badges ["SETUP"]
                  :cargo ["stereo" "gold fish" "slippers" "secret note"]}]
    (crux/submit-tx node [[:crux.tx/put manifest]])
    (crux/entity-history (crux/db node) :manifest :asc)
    ))
do this in the repl
tutorials.crux.jupiter=&gt; (require 'tutorials.crux.jupiter)
nil
tutorials.crux.jupiter=&gt; (tutorials.crux.jupiter/-main)
Syntax error compiling at (form-init6925765827011711183.clj:1:1).
No such var: tutorials.crux.jupiter/-main

Eugen 2021-01-01T18:25:25.076Z

what does lein run give ? (put a println inside main fn

Eugen 2021-01-01T18:25:47.076200Z

defn -main

Eugen 2021-01-01T18:25:57.076400Z

I gave you the code above

roelof 2021-01-01T18:26:36.076600Z

lein repl

Eugen 2021-01-01T18:26:43.076800Z

lein run

roelof 2021-01-01T18:26:44.077Z

Gives

Can't find 'tutorials.crux.jupiter' as .class or .clj for lein run: please check the spelling.
Exception in thread "main" Syntax error compiling at (/tmp/form-init17099874963866708404.clj:1:74).

roelof 2021-01-01T18:27:09.077200Z

yep, and that one I use. the one you gave me

Eugen 2021-01-01T18:27:49.077400Z

follow this guide in a new file https://github.com/technomancy/leiningen/blob/stable/doc/TUTORIAL.md#running-code

Eugen 2021-01-01T18:28:05.077600Z

once you have that working, you can switch to your crux sample

roelof 2021-01-01T18:35:23.077800Z

chips, wrong file

roelof 2021-01-01T18:35:27.078Z

this one works fine

roelof 2021-01-01T18:36:50.078200Z

can you try this one

roelof 2021-01-01T18:37:30.078800Z

(ns practicalli.earth
  (:require [crux.api :as crux]))
(def node (crux/start-node {}))
(defn easy-ingest
  "Uses Crux put transaction to add a vector of documents to a specified
  node"
  [node docs]
  (crux/submit-tx node (mapv (fn [doc] [:crux.tx/put doc]) docs)))
(crux/submit-tx
 node [[:crux.tx/put {:crux.db/id :kaarlang/clients
                      :clients [:encompass-trade]}
        #inst "2110-01-01T09"
        #inst "2111-01-01T09"]
       [:crux.tx/put {:crux.db/id :kaarlang/clients
                      :clients [:encompass-trade :blue-energy]}
        #inst "2111-01-01T09"
        #inst "2113-01-01T09"]
       [:crux.tx/put {:crux.db/id :kaarlang/clients
                      :clients [:blue-energy]}
        #inst "2113-01-01T09"
        #inst "2114-01-01T09"]
       [:crux.tx/put {:crux.db/id :kaarlang/clients
                      :clients [:blue-energy :gold-harmony :tombaugh-resources]}
        #inst "2114-01-01T09"
        #inst "2115-01-01T09"]])
(crux/entity-history
 (crux/db node #inst "2116-01-01T09")
 :kaarlang/clients
 :desc
 {:with-docs? true})

roelof 2021-01-01T18:39:51.079Z

with me it hangs on the entity-history ?

roelof 2021-01-01T18:41:44.079200Z

See you did

roelof 2021-01-01T18:41:52.079400Z

sorry I lost it

roelof 2021-01-01T18:42:00.079600Z

but when I do you main now

roelof 2021-01-01T18:42:05.079800Z

I see this :

Caused by: java.lang.Exception: Cannot find anything to run for: practicalli.jupiter

Eugen 2021-01-01T18:42:40.080Z

sorry I don't have time to try out things

Eugen 2021-01-01T18:43:15.080200Z

I think the last error is because you don't have a -main fn

roelof 2021-01-01T18:44:08.080400Z

oke, it worked now

roelof 2021-01-01T18:44:11.080600Z

I see hello

roelof 2021-01-01T18:44:37.080800Z

because I added a (print "hello) to the main

roelof 2021-01-01T18:44:53.081Z

bu that on is not the code that fails on my computer

Eugen 2021-01-01T18:45:09.081200Z

yeah, sorry I can't help you there

roelof 2021-01-01T18:45:19.081400Z

that is this code :

(crux/entity-history 
  (crux/db node #inst "2116-01-01T09")
 :kaarlang/clients
 :desc
 {:with-docs? true})

roelof 2021-01-01T18:47:48.081600Z

and with this code ;

(defn -main []
  (print "Hello")
  (crux/db node #inst "2116-01-01T09")
 :kaarlang/clients
 :desc
 {:with-docs? true}) 

roelof 2021-01-01T18:48:09.081800Z

I see hello and then a waiting cursor for a vey long time

bringe 2021-01-01T20:38:35.082200Z

If you can provide a complete project in a github repo that can be pulled down and the steps you take up until you have an issue, it may be easier for someone to help, so that you can be sure things are the same at least code-wise, and be able to know if it's some external setup issue.

roelof 2021-01-01T21:57:05.082400Z

There is a complete github repo and I already noticed that on 2 persons it worked and on my the same code does not work