This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-11-22
Channels
- # 100-days-of-code (1)
- # adventofcode (21)
- # announcements (2)
- # beginners (44)
- # calva (1)
- # cider (2)
- # cljdoc (16)
- # cljs-dev (70)
- # cljsrn (29)
- # clojure (66)
- # clojure-austria (1)
- # clojure-europe (4)
- # clojure-finland (1)
- # clojure-hamburg (1)
- # clojure-italy (24)
- # clojure-nl (3)
- # clojure-uk (127)
- # clojurescript (30)
- # core-typed (3)
- # cursive (34)
- # data-science (2)
- # datomic (16)
- # duct (17)
- # editors (1)
- # emacs (4)
- # figwheel-main (4)
- # fulcro (40)
- # hoplon (2)
- # instaparse (5)
- # kaocha (4)
- # leiningen (1)
- # luminus (4)
- # nrepl (46)
- # off-topic (5)
- # onyx (2)
- # other-languages (55)
- # parinfer (3)
- # protorepl (4)
- # re-frame (33)
- # reagent (6)
- # reitit (13)
- # ring-swagger (5)
- # shadow-cljs (26)
- # spacemacs (4)
- # sql (8)
- # testing (27)
- # tools-deps (21)
- # yada (1)
So I just put my open dispatch stuff up in a lib here https://github.com/johnmn3/dispacio, mostly to piss off @hiredman š But if it raises anyone else's ire, I'd be happy to hear your critical feedback (or collaboration!)
If no baby seals are harmed over the next few days by the lib, I'll probably drop it in the #ann channel
Here's a puzzle for someone: I have an input-stream. I want to print each line immediately as data is available. I also want that content to go to a corresponding function that will consume it at its own pace. Is there a simple way to "tap" and print an input-stream like this?
@bmaddy Here's another one:
((fn [in f]
(with-open [r (io/reader in)]
(run! #(doto % prn f)
(line-seq r))))
(java.io.ByteArrayInputStream. (.getBytes "foo\nbar\n"))
prn)
is there a best practice for syntax quoting without fully qualified namespaces? (similar to this: https://stackoverflow.com/questions/13758555/why-is-clojure-adding-namespace-qualifiers-to-names-inside-a-backquote)
The options that I see are ~'
(unquote/quote) every symbol or use a library that provides such a macro but isn't maintained (https://github.com/brandonbloom/backtick). Am I missing anything? (aside from writing my own macro)
did you try the backtick library and it didnāt work, or are you concerned that it doesnāt work cause there is no activity on the repo?
@schmee I'm about to give that a go. usually not keen on using 3rd party libraries that don't seem maintained. wondering if it's not maintained because there's a more idiomatic way that I'm missing here
I think itās not unmaintained, itās just ādoneā. some clojure libs are like that
activity on the repo usually signals new features (not the case here cause itās a one-feature lib), adapting to other peoples breaking changes (this lib has no deps so not relevant), or fixing bugs (this is <100 LOC so most bugs have probably been ironed out by now)
Hi. I'm delivering micro service as jar file which is run on the client's sever. How can I add some license solution which can limit time of usage (e.g. 12 months) and number of API requests (e.g. 10k)? There are situations when my app doesn't have access to the Internet. I know that it is very general question and maybe more Java related, but I need at least some tips or ideas or links. Thanks in advance for help
@U0ARSC79A you basically need some kind of license key which will encode the license validity. In your app, you can then decode that license key and check if current time is still less than the end time encoded in the license key. Otherwise, you show an error to the user. Of course, you rely on system clock setting but you could add some more checks if that's an issue. As regards to the license key format it should be encrypted somehow - symmetric encryption isn't ideal since you'd have to hardcode encryption key somewhere in your app. An alternative would be license key signed with your private key and decoded (in the app) with the corresponding public key.
I used buddy's compact message signing for a similar purpose in the past: https://funcool.github.io/buddy-sign/latest/#compact
Note that anybody can see the content of license key but that shouldn't be an issue - you just want to make sure that user cannot generate a fake license key.
hi, does anyone know a way to include maven :classifier
artifacts in a deps.edn
given that they have the same mvn
coordinates & :deps
is a map ?
Does anyone know if it's possible to specify a different dependency file than deps.edn
in the clojure
script?
@weavejester donāt know, but this workaround may work for you: clj -Sdeps "$(cat deps2.edn)"
I figured I might need to do something like that š
you can point to a folder where a deps.edn lives though: CLJ_CONFIG=foo clojure -A:my-alias
any deps.edn in $PWD overrides values from foo/deps.edn, but it also works when $PWD/deps.edn does not exist.
Soo I am working on a project where we have to run Clojure in OSGI. And it works pretty flawlessly actually, apart from one thing. For some reason if a ns requires clojure.tools.logging
it fails to load the OSGI bundle with the following error:
Caused by: java.lang.RuntimeException: Can't embed object in code, maybe print-dup not defined: nrepl.misc, compiling:(nrepl/misc.clj:7:1) [INFO] [talledLocalContainer] at clojure.lang.Compiler.analyzeSeq(Compiler.java:7010)
[INFO] [talledLocalContainer] at clojure.lang.Compiler.analyze(Compiler.java:6773) [INFO] [talledLocalContainer] at clojure.lang.Compiler.analyzeSeq(Compiler.java:6991)
[INFO] [talledLocalContainer] at clojure.lang.Compiler.analyze(Compiler.java:6773)
[INFO] [talledLocalContainer] at clojure.lang.Compiler.access$300(Compiler.java:38) [INFO] [talledLocalContainer] at clojure.lang.Compiler$DefExpr$Parser.parse(Compiler.java:595)
[INFO] [talledLocalContainer] at clojure.lang.Compiler.analyzeSeq(Compiler.java:7003) [INFO] [talledLocalContainer] at clojure.lang.Compiler.analyze(Compiler.java:6773)
[INFO] [talledLocalContainer] at clojure.lang.Compiler.analyze(Compiler.java:6729) [INFO] .......
We are using com.theoryinpractise/clojure.osgi
is there anyone who has any knowledge about this?Bump. Is there anyone with knowledge about clojure+osgi?
I want to make a command line tools in clojure, but the startup time makes it a bad experience. Is there anything I can do to improve the startup time. I'm talking about tools to add stuff to my bind configuration (dns), managing some vhosts,...
I am a Clojure newbee. Have read about GraalVm for speeding up command line apps. https://clojureverse.org/t/why-is-graalvm-so-fast/2079/4 No personal experience though.
If the JVM isn't a requirement, you might get better startup time with ClojureScript/Node.js
@robin.broeck Planck and Lumo are suited for this if you want to run scripts on the fly.
Happy Thanksgiving to all of you who are US based! For what it's worth, I am incredibly, unironically grateful for the support and expertise that live in the clojure community. You've made my life so much better.
@robin.broeck I made some tools to help with GraalVM native-image building and CLI apps: https://github.com/taylorwood/lein-native-image (contains a few examples) https://github.com/taylorwood/clj.native-image (same as above but for deps.edn projects) https://github.com/taylorwood/clj.native-cli is a project template of sorts, with example Clojure->native-image app https://github.com/taylorwood/clojurl
using tagged-literal
as shown here http://insideclojure.org/2018/06/21/tagged-literal/, what is the best way to further process a data structure containing these? I want to process them down stream further by providing reader functions. the only way I found was to pr-str
and then clojure.edn/read
them providing the reader functions. but the round trip to a string feels unnecessary
can you give an example what you want to do? you can pass a :readers
argument to the read
function that is a map of data readers for whatever tags you want
I want to read
forms from a network socket, but at the time of reading I donāt yet know all values which the tagged literals need to be replaced with later, thus providing :readers
at that time is of no use to me, I think. the forms are more like templates I want to store for later use, and only then I know all the things which can go into :readers
.
Thanks @pradyumna and @petterik; those are both tons better than the route I was heading down!
Hi, do you agree that It would be nice if the following comparison returned true?
(= #"\d" #"\d")
=> false
Would be hard to implement equality for two regex patterns because two patterns that match the same things could look very different
@christian.gonzalez nice point
Is anyone familiar with this error: java.lang.Exception: Unable to find data source: $__in__2 in: ($ $__in__2)
?
@yogidevbear it's a #datomic query?
Yup - should I take the question to #datomic instead?
not really.
this error probably due missing db
argument.
can you share the :in
part of the query?
Funny thing is it's inconsistent - the code seems to be working as results are being updated, but this error is happening too
The :in
is :in $ [?e ...]
The query looks roughly like:
(d/q '[:find ?eid ?foobar
:in $ [?e ...]
:where
[?eid :some/id]
[?eid :foo ?foo]
[?eid :bar ?bar]
[(str ?foo "_" ?bar) ?foo-bar]]
db
batch)
where batch
is from a previous query using sample
to limit the qty of rows being dealt with to do some retrospective updatinghttps://clojurians.slack.com/archives/C03S1KBA2/p1542917552908600?thread_ts=1542917075.906800&cid=C03S1KBA2 no I don't believe so
@souenzzo Thanks for that comment re nil
db. I found a missing when
check in my calling function to check the batch before passing it in. batch
was the 2nd argument which I think is the issue here re $__in__2
how can I pass a edn reader for #'
? Trying to make this work (edn/read-string {:default (fn [t v] v)} "#'user/hello")
but I get No dispatch macro for: '
@mkvlr
#'
is a clojure special-form. It's not edn
. You can use clojure.core/read-string
. But it is "not safe"
@souenzzo so there's no way to read that string with edn? I want this for a prepl. Does it mean I have to change it on the side where it's printed?
There is a issue on jira about use #var
or something like.
you can do
(edn/read-string {:readers {'var resolve}} "#var clojure.core/get")
=> #'clojure.core/get
(binding [*print-dup* true]
(pr-str #'clojure.core/get))
=> "#=(var clojure.core/get)"
But i think that once it's a prepl
, maybe you can use read-string
. Once "all data" is trusted.I see https://dev.clojure.org/jira/browse/CLJ-2165 is the jira, thanks!
(defmethod print-method clojure.lang.Var
[x ^Writer writer]
(.write writer (format "#my/var[%s]" (str (symbol x)))))
=> #object[clojure.lang.MultiFn 0x5bdbb90e "clojure.lang.MultiFn@5bdbb90e"]
#'get
=> #my/var[clojure.core/get]
(edn/read-string {:readers {'my/var (comp resolve first)}}
"#my/var[clojure.core/get]")
=> #my/var[clojure.core/get]
Not sure if it is a good solution. But kind of work.Is there a way to ensure / specify the order of some dependencies in a classpath (context class path)?
I've come to the conclusion this is the wrong approach and that it is much better (sensible, extensible) to ensure unique paths for 'duplicate' resources...
I've come to the conclusion this is the wrong approach and that it is much better (sensible, extensible) to ensure unique paths for 'duplicate' resources...
Bump. Is there anyone with knowledge about clojure+osgi?