This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-10-13
Channels
- # announcements (1)
- # babashka (41)
- # beginners (194)
- # calva (14)
- # chlorine-clover (2)
- # cider (32)
- # circleci (9)
- # cljsrn (10)
- # clojure (110)
- # clojure-australia (1)
- # clojure-berlin (2)
- # clojure-dev (39)
- # clojure-europe (42)
- # clojure-france (3)
- # clojure-nl (19)
- # clojure-spec (22)
- # clojure-uk (23)
- # clojurescript (21)
- # conjure (41)
- # datomic (33)
- # depstar (16)
- # duct (46)
- # events (1)
- # fulcro (17)
- # graphql (14)
- # jobs (6)
- # jobs-discuss (9)
- # leiningen (6)
- # malli (29)
- # off-topic (21)
- # pathom (7)
- # portal (1)
- # rdf (81)
- # re-frame (3)
- # reagent (12)
- # reitit (2)
- # remote-jobs (1)
- # rum (1)
- # shadow-cljs (60)
- # specter (1)
- # sql (13)
- # tools-deps (23)
- # vrac (1)
- # yada (19)
Anyone remember where this is? I saw about a month ago a talk on clojure code management where the guy never put code into files, instead placing it in a database. I'm afraid I can't be more specific since it's been too long 😜
Datomic as source control?
More like unison: https://www.unisonweb.org
I am wondering on usage of memoization/ttl. My question regarding is: if the cache is invalidated and memoized function get called several times in mutlithreaded env how will it behave? Will there be one computation for the first cache miss and waiting on result from subsequent invocations or will all pending invocations go compute the value? I am thinking if background tasks that are basically "fetch data from other service and update value every X minutes" can be effectively replaced with memo/ttl.
Ok, so I did some practiacl testing and it seems data will not be computed several times when there is a computation pending.
Has anyone experienced segfaults with REBL / AdoptOpenJDK 11 on MacOS, and… have pointers on what to do to fix it
It works perfectly fine on 8, but as soon as I switch to 11, I get segfaults
Tried AdoptOpenJDK 15, also segfaults
… bit vague, I know, I was kinda hoping that it rings a bell with someone :)
It appears to segfault in libjfxwebkit?
Yeah looking at logs, it is trying to find libraries in the maven repository > WARNING: java.lang.UnsatisfiedLinkError: Can’t load library: ~/.m2/repository/org/openjfx/javafx-graphics/11.0.2/libjfxwebkit.dylib > > Loaded library /libjfxwebkit.dylib from resource
In Oracle Java 8, JavaFX is built in. In later Java’s, you need openjavafx as an additional set of libraries
You can see the set of required deps at https://docs.datomic.com/cloud/other-tools/REBL.html
Are you using those deps?
I’m using them in my lein profile:
{:tools {:plugins [[lein-ancient "0.6.15"]
[lein-localrepo "0.5.4"]]}
:rebl {:repl-options {:nrepl-middleware [nrebl.middleware/wrap-nrebl]}
:dependencies [[rickmoynihan/nrebl.middleware "0.2.0"]
[com.cognitect/rebl "0.9.242"]
[org.openjfx/javafx-fxml "11.0.2"]
[org.openjfx/javafx-controls "11.0.2"]
[org.openjfx/javafx-swing "11.0.2"]
[org.openjfx/javafx-base "11.0.2"]
[org.openjfx/javafx-web "11.0.2"]
[cljfmt "0.6.4"]]
:resource-paths ["*snip*/REBL-0.9.220/REBL-0.9.220.jar"]
:injections [(require 'nrebl.middleware) (require '[cognitect.rebl :as rebl])]
:jvm-opts ["-Djavafx.verbose=true"]}
:user [:tools :rebl]}
But those are different versions
Yeah, let me try with that 15 version, followed a bit of a mixed set of advice
Even if you are on Java 11, you should use the newer javafx libs
And you shouldn’t need the cljfmt dep
You also seem to have one version of rebl in the deps and another in the resources?
Yeah, I set it straight like this:
{:tools {:plugins [[lein-ancient "0.6.15"]
[lein-localrepo "0.5.4"]]}
:rebl {:repl-options {:nrepl-middleware [nrebl.middleware/wrap-nrebl]}
:dependencies [[rickmoynihan/nrebl.middleware "0.2.0"]
[com.cognitect/rebl "0.9.242"]
[org.openjfx/javafx-fxml "15-ea+6"]
[org.openjfx/javafx-controls "15-ea+6"]
[org.openjfx/javafx-swing "15-ea+6"]
[org.openjfx/javafx-base "15-ea+6"]
[org.openjfx/javafx-web "15-ea+6"]]
:injections [(require 'nrebl.middleware) (require '[cognitect.rebl :as rebl])]
:jvm-opts ["-Djavafx.verbose=true"]}
:user [:tools :rebl]}
Those are the versions I found here: https://docs.datomic.com/cloud/other-tools/REBL.html#installation but in leiningens format
I found some instructions by Sean, which was the mixed advice: https://github.com/RickMoynihan/nrebl.middleware/issues/23#issuecomment-533243271Same problem tho, still get a segfault.
# A fatal error has been detected by the Java Runtime Environment:
#
# SIGSEGV (0xb) at pc=0x00000001047de1a4, pid=11576, tid=121871
#
# JRE version: OpenJDK Runtime Environment AdoptOpenJDK (11.0.8+10) (build 11.0.8+10)
# Java VM: OpenJDK 64-Bit Server VM AdoptOpenJDK (11.0.8+10, mixed mode, tiered, compressed oops, g1 gc, bsd-amd64)
# Problematic frame:
# V [libjvm.dylib+0x3de1a4] jni_CallStaticBooleanMethodV+0xdf
(Thanks btw!)
Those set faults were fixed in the openjfx 15 early access versions
Or one set were, maybe this is something new
I haven’t seen that before
It’s also crashing with the released openjfx 15 versions. (e.g. ["org.openjfx/javafx-… "15"]
).
So that openjfx option I enabled, gives me this warning:
WARNING: java.lang.UnsatisfiedLinkError: Can't load library: *snip*/.m2/repository/org/openjfx/javafx-graphics/15/libprism_es2.dylib
Loaded library /libprism_es2.dylib from resource
(and of a bunch of other dylib’s)
Is that expected?@UDF11HLKC Which macOS are you on? Since I switched to the 15-ea+6 OpenJFX, I've had no problems on macOS 10.12, running AdoptOpenJDKs 11, 14, or 15.
I have seen that warning on Ubuntu (on WSL2 on Windows 10) but it still loads and runs just fine (via Xlaunch).
I’m on Mojave 10.14
Is there anything specific that you do that results in the segfault, or is it random?
Starting rebl, guaranteed segfault: (rebl/ui)
(I'll note that I don't use lein
or nREPL at all so that may be a factor in what you're seeing)
is there some reason you are using "15" and not "15-ea+6" as in the docs?
(I guess that was at Sean? I tried both with the same results)
I haven't actually tested rebl with the final 15 release
Oh, I interpreted “Those set faults were fixed in the openjfx 15 early access versions” as “try final” 🙂. My bad, but I’m still having the crashes with -ea+6
hey interesting, it works with a deps.edn
I've used a bunch of different java vendors, and jdk versions, and open javafx versions and have never seen the issue you're reporting
but I always use deps.edn, not lein so there may be some difference there, not sure what
Really appreciate all the help so far 🙂
I’m at least glad it works with a deps.edn, now its something lein related
At least easier finding ^^
For the internet travellers: For me, it doesn’t segfault when lein can find a project.clj
, in folders that are not lein projects it does still, tho.
Thats a situation that works for me, I think.
my two cents, it's mainly for places where you want to know if (count x)
is greater than some value y
With clj -X:deps mvn-pom
is there a way to specify what version should be put in the pom file?
not at the moment - you set it in the source pom
but you should really use clj -Spom
for now
Thank you for the quick response. Can I specify version on the command line with clj -Spom
?
no, no difference in that regard
the internals have been reworked to support that kind of configurability and that's coming but working on other things atm
Ok thanks a lot.
@soren.sjorup Since this question comes up a lot, I decided to write a script for it: https://github.com/borkdude/babashka/blob/master/examples/set_pom_version.clj
Thank you so much. Big babashka fan!
My tags are qualified so I needed to change the condition to (and (:tag elt) (= "version" (name (:tag elt))))
I have xmlns=“
in the project
tag.
Sure will do. Thanks a lot! Spent way to much time on this today.
(def xml (xml/parse-str (slurp pom-xml) :namespace-aware false))
also works.
instead of that construction with and
you could use the extra arg to the keyword
(= "version" (name (:tag elt "")))
I made it into:
(if-let [t (:tag elt)]
(if (= "version" (name t))
(assoc elt :content version)
elt)
elt)
with :namespace-aware false
we don’t need name
in there.
I leave the tweaking to the end user. However, I'm interested in a fix for getting the XML declaration and the first tag to be pretty printed better.
I'm actually getting:
<?xml version="1.0" encoding="UTF-8"?><project>
<version>1.0.2</version>
</project>
Yes I also get the <?xml
and <project
on the same line. But it’s not high prio for me.
On what sorry?
Yeah sure. But I’m not going to read it. 🙂
🙂 Again thank you so much for making babashka. I never got around to learning bash. But I love Clojure!
When running from CLI, is there anything to do to output the result? I have a very simple file and I can't get it to show anything.
(ns myns)
(defn -main
[& args]
(+ 1 2))
Running with clojure -m myns
.Oh derp, of course.
Thank you very much
I'm halfway surprised -main
doesn't return exit code 3
but only halfway :D
that would be deeply weird :)
clearly I've been doing too much low-level programming lately
yeah, but that's quite different from using the last expression in -main
as an OS level return value (and more useful of course)
Is babashka related to gravvl vm or something? How does that bb executable come from?
@UGC0NEP4Y It is related. Babashka is a tool that runs Clojure code through an interpreter that is compiled with GraalVM.
just tried. quite fast. the only thing annoying is, when downloading the binary from github, chrome prompts that this file is seldom downloaded and might not be safe. Also, when execute the binary for the first time, macos says its not signed might not be safe ….
I'm very curious about the humble preserving-reduced
function in the core library. Does anyone have any insight into this?
I see that it's used in cat
and if something is reduced
it wraps it with another reduced
... that seems very strange but I'm sure there's a very good reason for it
Also I understand that it's just an implementation detail of transducers but I can't for the life of me figure out what cases this covers.
if you have nested calls to reduce
, as in cat
, and the inner call to reduce
short circuits with reduced
, you don't want to resume reducing with the outer call to reduce
so you double wrap so that when the inner reduce short circuits, it unwraps one layer, then the outer reduce unwraps the other layer
anybody gotten an uberjar to run under procrun
on windows? keep getting an error saying it can’t find the class file. I’m able to call my gen-class
static method using a java program with the uberjar on the classpath.
the first thing I would test is java -jar the.jar
- you need more than just the class existing, you need to either ask for the right class or have the right default entrypoint
replaced my uberjar with a minimal one, which works. so now I just have to figure out whats different. thanks for the input!