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 😜
More like unison: https://www.unisonweb.org
Datomic as source control? :thinking-face:
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.
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?
You may want to examine the error file and loook for s corresponding jdk bug
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
Ok, so I did some practiacl testing and it seems data will not be computed several times when there is a computation pending.
In Oracle Java 8, JavaFX is built in. In later Java’s, you need openjavafx as an additional set of libraries
any niche application of (bounded-count) ?
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
my two cents, it's mainly for places where you want to know if (count x)
is greater than some value y
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?... and on something not ICounted 🙂
oh, it actually does that check
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))))
ah I see, where is that difference coming from?
I have xmlns=“<http://maven.apache.org/POM/4.0.0>”
in the project
tag.
Ah, that makes sense. Feel free to PR the update if you so wish
Sure will do. Thanks a lot! Spent way to much time on this today.
@lennart.buit 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.
Updated it already
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
(def xml (xml/parse-str (slurp pom-xml) :namespace-aware false))
also works.
Is there anything specific that you do that results in the segfault, or is it random?
ah good one
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)
instead of that construction with and
you could use the extra arg to the keyword
(= "version" (name (:tag elt "")))
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
I made it into:
(if-let [t (:tag elt)]
(if (= "version" (name t))
(assoc elt :content version)
elt)
elt)
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
with :namespace-aware false
we don’t need name
in there.
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
.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>
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
Yes I also get the <?xml
and <project
on the same line. But it’s not high prio for me.
if you want to print to stdout you can use println
.
Oh derp, of course.
Thank you very much
:thumbsup:
you can also do a str/replace on that
I'm halfway surprised -main
doesn't return exit code 3
but only halfway :D
that would be deeply weird :)
Is babashka related to gravvl vm or something? How does that bb executable come from?
On what sorry?
clearly I've been doing too much low-level programming lately
@i It is related. Babashka is a tool that runs Clojure code through an interpreter that is compiled with GraalVM.
fast for interactive use?
Really appreciate all the help so far 🙂
It has worse performance than JVM Clojure, but better startup (few milliseconds).
To get the XML declaration straightened
I’m at least glad it works with a deps.edn, now its something lein related
At least easier finding ^^
Yeah sure. But I’m not going to read it. 🙂
That's the spirit :)
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 ….
You can also install it through brew
🙂 Again thank you so much for making babashka. I never got around to learning bash. But I love Clojure!
Same here!
🙂
actually clj-kondo does return exit code 0, 2 or 3 with meaning attached to it
1 is reserved for unexpected errors
yeah, but that's quite different from using the last expression in -main
as an OS level return value (and more useful of course)
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
cat
is a transducer that is used in some reducing context which is the outer layer
the inner layer is the call to reduce that is on the last line of cat
ohhhhhhhhhhkay that makes perfect sense
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.
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.
Have you checked the uberjar to see if the class is in there?
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!