This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-09-07
Channels
- # 100-days-of-code (1)
- # announcements (10)
- # aws (2)
- # beginners (134)
- # calva (25)
- # cider (29)
- # cljs-dev (43)
- # clojure (130)
- # clojure-dusseldorf (3)
- # clojure-italy (27)
- # clojure-nl (48)
- # clojure-spec (32)
- # clojure-uk (63)
- # clojurescript (75)
- # core-logic (5)
- # cursive (18)
- # datascript (2)
- # datomic (37)
- # emacs (5)
- # figwheel (13)
- # figwheel-main (55)
- # graphql (1)
- # java (7)
- # jobs (11)
- # jobs-discuss (19)
- # juxt (1)
- # leiningen (16)
- # luminus (10)
- # mount (3)
- # off-topic (40)
- # om (1)
- # onyx (1)
- # pedestal (7)
- # re-frame (40)
- # reagent (81)
- # ring (2)
- # shadow-cljs (32)
- # spacemacs (5)
- # testing (1)
- # tools-deps (48)
i wrote a commad line tool and compiled it with graal, it works fine when run with java -jar
, but the compiled file throw a ClassNotFoundException: java.lang.ProcessBuilder
error.
I had the same issue, I believe it's a problem with reflection. Did you try this with the release candidate 6 of GraalVM?
also, if you are moderately skilled with interop, it's easier to use ProcessBuilder / Process directly rather than conch; this would also be easier than fixing conch so it works with graalvm
well, maybe I should say "if you are trying to do anything interesting with process IO and moderately skilled with interop"
conch does make some people's tasks simpler, just not the ones I've needed
I'm trying to draw time series data onto a static image file, is there an aesthetically pleasing graphing lib out there by any chance?
https://github.com/thi-ng/geom https://github.com/metasoarous/oz incanter also there was a d3 wrapper called c2
is there a way to pretty print Json while writing it to a file?
the only way I found is
(spit output-file
(with-out-str (json/pprint new-json-obj)))
which actually works but seems a bit of a weird way
I wonder why there is no format
in the json API
Where can I report bugs in clojure core?
I mean this is a bug right? (proxy [URLClassLoader] [(make-array URL 0) ^ClassLoader (.getContextClassLoader (Thread/currentThread))])
emits reflection warning
there's no reason why there is a reflection warning there
@just_crashed I'm using clojure.data.json
not chesire
@andrea.crotti so you're looking for a way to customize the pretty printer? data.json uses clojure.pprint under the hood, see http://clojuredocs.org/clojure.pprint if you want to dig inside. If you just want to print it to a file directly (without the intermediate string), see http://clojure.java.io/writer + (binding [*out* (writer ...)] pprint here)
no I was jus tasking if there was a better way to do what I did with
(spit output-file
(with-out-str (json/pprint new-json-obj)))
if it just uses the core pprint maybe I can simply use the pprint/format instead
As I've said, (binding [*out* (writer output-file)] (json/pprint new-json-obj))
would be a better way of doing it (no intermediate string)
well it .just seems silly to go through out entirely
since there should be a format function that returns another string surely
so ideally something like (spit output-file (json/format new-json-obj))
would be what I would have liked more
but not a big deal
if you need to return a string, with-out-str is totally fine (but if all you do with that string is to spit it in a file, you don't need that string at all)
cheshire has a specific function that writes an object to a string, but data.json takes a more minimalistic approach to the api; can't blame them for that! :)
@roklenarcic maybe it's because of some proxy
magic? I have no idea to be honest.
@just_crashed I tried signing up for that clojure dev confluence, but it doesn't recognize my password and I just signed up prior, no confirmation email either... oh well... app still works despite the warning
what is the easiest way to replace all "-" with "_" in a complex nested json structure?
with Specter I think it would be something like (transform (walker string?) #(str/replace % #"-" "_") your-json)
is the thing about camels 😄 🐫
(json/read-str "{\"firstName\":\"John\",\"lastName\":\"Smith\"}" :key-fn ->kebab-case-keyword)
Hello. Playing with Datomic. I have a query using pull that does what I want, but the results use the #: namespace map syntax. Is there a way to get the results with fully expanded attribute names? So, {:equipmentType/typeName "Crane"} instead of #:equipmentType{:typeName "Crane"} Edit: hey, I found it! It was just REPL formatting. I did (set! print-namespace-maps false) in my REPL.
Can anyone explain to me why the first version of the code, while handling files sequentially works while the second versions hangs because after the report channel is filled (I set it with a buffer size of 10), all my threads are parked and nothing happens anymore in process-object? I am missing something
@joelmarty2 are there any processes taking something from reports channel?
@joelmarty2 i tried your code with just processing integer and it works fine
the process-object function is blocking and may take a while to execute (something like 10s)
@joelmarty2 i put (Thread/sleep 10000) inside the process-object and still works
one difference I see is that you buffered the s3objects channel, which is not my case but it doesn't make any difference
if the process-object does blocking IO, then it's better to use pipeline-blocking instead of go-block.
i've looked into that but I am not sure my process-object function could be seen as a transducer, I don't know enough about transducers. the process function reads the s3 object line by line, parses it and makes some transforms and then writes the structures to a redis instance
so let's play around with it, you can create a transducer from your process-object function by simply (map process-object)
@joelmarty2 no problem, i'm sorry I can't help you find the problem with using go-block for your process. I still don't fully understand the go block
don't sweat it @mavbozo,I won't look further into it, I inherited this overly-complicated app and I don't plan to spend much more time on it, your solution works and using a library function is much more reliable that what I could have done
that's out of scope, clj is not a build tool
you can write some other code that compiles your java and uses clj; maybe someone has implemented that already
if you really want to, you could write a clojure program that used the JavaCompiler api to compile java :)
that is, clj is a program runner. the java compiler is a program.
what’s the clojure mechanism for something like:
(attempt (a) (b) (c))
which throws if a, b and c throw, but not if one passes?I'd probably try (assert (some #(try (%) true (Catch Exception _)) [a b c]))
or something vaguely like it
@lwhorton you could look at the source of as->
, and replace the let
machinery it uses with and
/`try/catch`
(if you prefer a form based rather than fn based solution)
actually, I just checked the source of some->
and that is very similar, and probably an even better starting example
of course your difference from both is you don't need the let bindings, as you aren't propagating data from one step to the next
its neat that this can be done without introducing a large dependency (was about to go looking for error monad libs)
not only that, but the hand rolled macro will be relatively small and you can be reasonably confident there aren't huge gotchas - clojure is kind of special that way
i love it. i work in elixir probably 40% of my time now and i miss clojure 100% of that time.
is there a way to make an interface that "extends" another interface without gen-class?
More or less on-topic: I always thought it was common sense to use OracleJDK in prod, does anyone know why Heroku nudges users (Clojure and JVM generally) to OpenJDK?
no, they just changed their support model (which when was the last time you used jvm support?), and oracle has a bad image, so when they change things it is attributed to them wanting to do something shady (which I entirely believe), which begets any even worse image, which causes people to want to get away from them
doesn’t “jvm support” include releasing bug fixes and security patches, not just customer support?
Another twist (something I didn't know until recently) is that it's Oracle that maintains OpenJDK too
@rplevy It looks like maybe Red Hat will step up to become the primary avenue of support for OpenJDK...
(and this discussion probably belongs in #java since it isn't really about Clojure -- which is not affected by Oracle's decisions 🙂 )
I just learned that Oracle is going to charge for support and updates for JDK 1.8 (minimum for Clojure 1.10) starting in January (I think that's what @hiredman was referring to actually)
does anyone have a good strategy to squash database migrations together?
I'm using migratus
now so I just write the migrations as SQL, I guess I could
- migrate everything
- get the actual SQL schema from the database
- create a new squashed migration with that schema, just a bit sad to lose all the comments and things like that though
does anyone have a working example of server-sent events with ring 1.16? I’m hitting a brick wall
What’s the best way to check that a map only has certain specified keys in clojure.spec.alpha
? I tried following https://groups.google.com/forum/#!topic/clojure/fti0eJdPQJ8
So for example I have
(s/def ::message (s/merge (s/keys :req-un [::value])
(s/map-of #{:value} any?)))
If I comment out the s/map-of
call, stest/check
works fine. If I uncomment it,
I get ExceptionInfo Couldn't satisfy such-that predicate after 100 tries. clojure.core/ex-info (core.clj:4739)
Regardless of map-of
being commented out or not, (gen/generate (s/gen ::message))
works every time.
Does anyone have any insight?@jon324 What are you calling stest/check
on? What does that function look like?
(does s/merge
actually allow a spec that isn't just s/keys
?)
I’m confused why it was recommended here https://groups.google.com/forum/#!topic/clojure/fti0eJdPQJ8
First off, that's two years old so it may well be out of date by now.
Second, Alistair doesn't explain why he changed it to s/merge
, nor did anyone follow-up to ask about the difference... which also makes me think no one tested the two versions fully.
s/merge
's docs just say "map-validating specs" and gives s/keys
as an example, but I don't think I've ever seen s/merge
used with anything other than s/keys
specs...
So, yeah, s/and
makes more sense to me here.
(btw, there's a #clojure-spec channel, in case you need to deep dive on it)
There's a #juxt channel in case you don't get any answers here (smaller channel might be more likely to see/help sometimes).
Do library owners normally sign their release artifacts with gpg when deploying to clojars? I recently released my first library, but it look me several hours to figure out how to sign the release artifacts with gpg. I develop on windows, but eventually used linux just to get gpg to work, and even still it took me a while. Now I'm trying to release another version, and I'm having issues with gpg again. gpg: signing failed: Permission denied
I know I can skip the signing, but is this a bad idea? I don't want to go that route, but these issues are driving me crazy
@brandon.ringe Do you use Leiningen for deploying to Clojars, or some other method? I've followed the Leiningen instructions for deploying, and while they were not a quick 5-minute read, they have worked.
From a Mac OS system, so Unix-like, not from Windows.
These are the instructions I am referring to: https://github.com/technomancy/leiningen/blob/master/doc/GPG.md
I am no gpg expert, so a cookbook approach is what I was looking for.
@andy.fingerhut Yes, I have read through them several times looking for something I may have missed. But I haven't tried storing my credentials yet, so maybe I need to do that.
I'm guessing it might be trying to use my key, seeing no credentials file, and just denying me, instead of prompting for credentials.
i've run into issues with gpg v1 vs v2. For some reason v1 keeps getting reinstalled from my package manager but v2 is the one that brings up a system wide prompt. Check gpg --version
. I symlink gpg2 to gpg and mv gpg version 1 to gpg_old
I am trying out tools.trace on a project where there are Clojure protocols, and there are deftype types that implement those protocols, and also extend-type forms that cause those protocols to be implemented for built-in JDK classes. When I try tools.trace's trace-ns on the namespace, or trace-var on the name of one of the protocol methods, I see traces of calls to the methods defined with extend-type on the built-in JDK class, but I do not see any messages about the calls to that protocol method on the Clojure deftype. Does this sound like a limitation of tools.trace's capabilities that would be difficult to change?
A related question would be - if you wanted to trace such calls, is there a method other than using tools.trace, and inserting debug println calls, that you use?