This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
- # beginners (145)
- # boot (19)
- # calva (61)
- # cider (33)
- # cljs-dev (15)
- # cljsrn (16)
- # clojure (35)
- # clojure-dev (39)
- # clojure-russia (2)
- # clojure-spec (10)
- # clojure-uk (7)
- # clojurescript (5)
- # cursive (14)
- # data-science (1)
- # datomic (3)
- # figwheel-main (9)
- # fulcro (46)
- # jobs (4)
- # off-topic (8)
- # quil (6)
- # re-frame (5)
- # shadow-cljs (70)
- # spacemacs (3)
- # speculative (2)
- # tools-deps (2)
I'm building a Clojure wrapper for a Java library and I'm wondering how I should add a dependency on that library from my wrapper. The thing is the Java library depends on a Java Agent JAR of the same version to provide the implementation through instrumentation. The library's public api is likely to stay the same, so my wrapper should work with any version of the library, but a specific library version can work with only specific version of the java agent. What are the possible approaches here? Adding direct dependency to the Java library from my wrapper would work as long as the user goes with the same Java Agent version, but would likely break in the future when new agent versions are released. Of course, then users could exclude the library dependency and provide their own. Or I could release a new version of the wrapper for every library/agent version, but this might prove to be too much maintenance work. Currently I'm thinking of going with adding the library dependency as 'provided', i.e. when including a dependency to my wrapper, users would also need to download the Java Agent (anyway required) and then add another dependency to the library. Any other ideas - preferably ones that don't require a ton of maintenance?
We have a wrapper for that internally, and we assume the caller provides both the library and the agent and keeps them in sync. I think that's really the only sane approach here.
It's actually Elastic APM. Yeah, I guess it's the sanest approach to have the user provide both.
Btw, have you noticed this New Relic Clojure wrapper: https://github.com/Yleisradio/new-reliquary
I had not. Thank you. It doesn't look as sophisticated as to what we're already doing (we have tracing via annotations, a bunch of metrics stuff, support for the New Relic Agent and periodic probe/reporting, middleware, and transactions).
Can someone help me find the docs for sorted maps please? The docs at https://clojure.org/reference/data_structures mention them, and say that they “are, well, sorted”. I want to know how they are sorted - by key, value, insertion order, etc.
Afaik you can supply your own comparator. See https://clojure.github.io/clojure/clojure.core-api.html#clojure.core/sorted-map and https://clojure.github.io/clojure/clojure.core-api.html#clojure.core/sorted-map-by
I think the flatland ordered meal does what I need (I want to maintain insertion order). But my question is about the docs - I don’t see any mention of how a map is sorted if no comparator is supplied.
Nor mention of what the comparator should return. Or what args are passed to the comparator.
I think it's ascending order by key by default. The args are
b - i.e. the objects to compare.
@marc-omorain comparator is a java concept. It returns -1, 0 or 1. To keep insertion order, you should use a specific lib called "orders"
Thanks for the help. To be clear though, I’m wondering if there are docs on this.
Clojure's default comparator, if you do not supply one explicitly, is
I haven't yet found any explicit lines in doc strings saying that, but in brief checking of source code it appears to be true.
I have written something a few years back, but not published in a well-known place, necessarily: https://github.com/jafingerhut/thalia/blob/master/doc/project-docs/en_US/clojure.core/1.6.0/clojure.core/compare.md
I am considering copying that to http://ClojureDocs.org page on the behavior of clojure.core/compare
I should have pointed you here first -- it does explicitly document that
compare is the default comparator, and has some notes on its behavior: https://clojure.org/guides/comparators
Continuing with my hopefully brief obsession, I have just updated the sorted-map entry on http://ClojureDocs.org to make the answers to some of your questions hopefully quick to answer: http://clojuredocs.org/clojure.core/sorted-map
I can't find anything comprehensive. 😞 There's this: https://clojure.org/guides/learn/hashed_colls#_sorted_maps which gives tiny bit insight on the default comparator at least.
Can anyone suggest a way to take screenshots of a webpage in clojure/java? I'm looking for the simplest solution possible, preferably with no extra dependencies.
not exactly what you're asking for, but is clojurescript a possibility? https://github.com/niklasvh/html2canvas
I've tried that with poor results (compared to how things actually look in a real browser).
If you're open to using an external service http://urlbox.io is quite good. We've snapshoted pages with some crazy js/svg and all sorts of constraints (timers etc) with it
@danielstockton I think the JavaFX WebView has a
snapshot function you can use
@danielstockton If you're open to using external paid service, I would recommend url2png. It works pretty well and has some nice features, such as it allowing you to include custom css file just for screenshotting purposes. For a DIY solution, I'd probably go with something like headless chrome to get as close to desktop/mobile rendering as possible.