This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-12-27
Channels
- # aleph (8)
- # announcements (14)
- # beginners (25)
- # cider (20)
- # cljdoc (5)
- # clojure (70)
- # clojure-europe (2)
- # clojure-germany (6)
- # clojure-italy (8)
- # clojure-nl (3)
- # clojure-russia (107)
- # clojure-spec (22)
- # clojure-uk (40)
- # clojurescript (18)
- # core-async (3)
- # cursive (8)
- # data-science (11)
- # datomic (20)
- # editors (1)
- # emacs (5)
- # figwheel-main (19)
- # fulcro (25)
- # graphql (1)
- # hoplon (2)
- # hyperfiddle (2)
- # jobs (1)
- # leiningen (3)
- # lumo (4)
- # off-topic (40)
- # pedestal (1)
- # quil (4)
- # re-frame (5)
- # shadow-cljs (105)
- # sql (4)
- # uncomplicate (1)
Anyone else running into this issue on 1.10? No matching field found: exists for class java.io.File
(defn- load-properties [file]
(when (.exists file)
(with-open [r (io/reader file)]
(doto (Properties.)
(.load r)))))
@flyboarder What version of Java are you running on? That sounds more like a Java reflection/lookup issue to me.
im using graalvm compiles to native image fine but getting this at runtime
We use .exists
on java.io.File
objects all over the place on OpenJDK 8 / Clojure 1.10 with no problem -- so that suggests a GraalVM issue perhaps?
I wonder if adding a type hint on file
would solve that? (defn- load-properties [^java.io.File file] …
@flyboarder Graal can’t find things by reflection unless you configure it to do so with a separate JSON file. This is how Clojure calls Java interop methods when it doesn’t know the type.
The type hint will fix it. But you should turn on reflection warnings in your project.clj to avoid further surprises.
@seancorfield @eraserhd the type hint didn’t work - i’ll try with (set! *warn-on-reflection* true)
and see what happens
@flyboarder with-open is challenging, also. I had to do this: https://github.com/eraserhd/rep/blob/develop/src/rep/core.clj#L125
@seancorfield @eraserhd thanks everyone! The reflection warnings allowed me to add all the required type-hints
native image is crazy fast!
startup is crazy fast. Seems to be some worries about overall performance being slightly slower as of now, but if you only need better startup, it is indeed crazy fast!
performance being slower only seems to be a thing when running the SubstrateVM, JVM performance is normal
hi guys
why i couldnt use ~x# in this macro ?
i would like to eval what x# has as local variable
what i try to do is: i want to iterate over expressions, and the values with X type will do some process with it else skip
You don’t need the ~
there, because it’s a symbol generated by the macro itself. The ~
is just for “unwrapping” symbols you pass into the macro when you call the macro.
So you need it for s
but not for x#
but i want to process the value of the var not the var itself
Yeah, that’s the tricky part of macros, they execute before vars have values.
But maybe you mean something different than what I think you mean?
i want to get the actual class of the variable r1 and r2 for example
(def r1 1), (def r2 2)
so i should get [jclojure.lang.Symbol ava.lang.Long java.lang.Long]
Try (macroexpand-1 (iter-exp 1))
and see what the result looks like.
Ok, I think I’m starting to follow a little better what you’re trying to do here (still sipping my morning coffee, trying to get the brain cells working)
Ok, so what you’re seeing is the classic “macro-compile-time” versus “evaluation-time” problem.
Oh wait, I missed something
Left off the quote
Try this: (macroexpand-1 '(iter-exp '(+ r1 r2)))
That should give you the intermediate step of what your macro actually “compiles” to at “macro-compile-time”.
Also, maybe you don’t even want a macro here?
(def r1 1)
=> #'user/r1
(def r2 2)
=> #'user/r2
(mapv #(class (eval %)) '(+ r1 r2))
=> [clojure.core$_PLUS_ java.lang.Long java.lang.Long]
The second law of macros is that an object with constant velocity will maintain that velocity unless acted upon by a net unbalanced force
The third law of macros is No Smoking https://www.youtube.com/watch?v=0ZnrZZTPJP8
No, unbalanced is important. The phrase people usually use for the law "acted upon by an outside force" is wrong because it leaves that out
hm not sure if this is the right place to ask, but can I get buddy's token auth backend to recognise that my token is in a cookie (rather than header)?
@pasi it looks like you'll want to implement a custom backend, extending the buddy.auth.protocols/IAuthentication
protocol's parse
method with your own cookie parsing code. Your implementation could very well defer to an existing backend for the rest of the protocol's methods too, so you wouldn't have to implement the entire protocol.
https://github.com/funcool/buddy-auth/blob/master/src/buddy/auth/backends/token.clj#L85-L87
hm yeah; I guess that looks simple enough. I might just go with an auth header initially to keep things simple tho
I am batching data, in real time using core-async, a game queue (with different predicates like, maps, server-country). I've solved it by creating 1 core async channel per combination and attaching a go-loop with some functions that takes care of Cancel, New Player etc... Anyone with a tip on how I can do this in a better way? I currently have 300 core-async channels because I have quite a few possible combinations. I was thinking of using Kafka and something like Onyx to do "batching by predicates", this has to be quick (in real time since its a game queue).
Would also appreciate some links to where I can find more useful information how to build stuff like this.
I have a pre-defined lookup, so If a player queues up I will find the correct channels to put them on. The channels and the processors (go-loops for each channel) is defined on startup.
Also when a go-loop ("processor") have batched enough players, it will send a "remove me" message to all the other channels a player is on.
What problems do you have with your current approach? channels are pretty cheap afaik
Well, alternately you can define it in Java, in case that helps you more easily tweak any/all Java class-creation knobs that exist.
I am unsure why I am getting this message after running lein uberjar
in my project
Release versions may not depend upon snapshots.
Freeze snapshots to dated versions or set the LEIN_SNAPSHOTS_IN_RELEASE environment variable to override.
I changed the version in my project.clj to not include -SNAPSHOT
and I get this message. Would anybody be able to provide me with context to this message and maybe how to resolve it? (besides slapping -SNAPSHOT
back onto the end of the version)I think it's complaining about one of the dependencies in your project.clj
having a -SNAPSHOT
version.
@manutter51 there are no dependencies with the extension -SNAPSHOT
. I created a project with bare bone project with lein new __
and removed snapshot and ran lein uberjar
and got the same message.
Figured it out, for some reason lein uberjar
is trying to include dependencies defined in my profiles.clj and inject them into the uberjar.
Aha, that was going to be one of my next suggestions. Seems like profiles.clj
has been cropping up a lot recently.
That makes sense, does that include all the profiles in your profiles.clj? (ex. :user
and :repl
)