This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2015-08-28
Channels
- # admin-announcements (59)
- # aws (27)
- # beginners (42)
- # boot (22)
- # cider (5)
- # clojure (97)
- # clojure-australia (3)
- # clojure-italy (2)
- # clojure-japan (9)
- # clojure-russia (81)
- # clojure-sg (2)
- # clojurescript (86)
- # clojutre (1)
- # cloxp (2)
- # cursive (60)
- # datomic (24)
- # docs (1)
- # editors (1)
- # emacs (17)
- # hoplon (57)
- # instaparse (1)
- # jobs (11)
- # ldnclj (19)
- # re-frame (1)
- # reagent (3)
- # spacemacs (7)
- # testing (8)
- # yada (127)
i got it working in other projects but am getting it again in this one and can't figure what I'm missing this time
Was just going for low-hanging fruit. Your component dep in the :dev profile rather than up top, etc, etc.
i have another 1.7 project which is built mostly the same and I don't get this error there
You could also try lein with-profile production deps :tree
to see if that changes anything. (I think uberjar uses the production profile.)
Yes, but merges that into the production profile. In other words, the :dev profile is omitted.
Does anybody have a recommendation on libraries to make a pool of resources in Clojure? My goal is to have some objects that are slow to create, so I want to re-use them over time, but they are not thread safe, so no two threads should be using one at the same time.
@pupeno: check aleph
's aleph.flow
namespace: https://github.com/ztellman/aleph/blob/master/src/aleph/flow.clj (it's a wrapper around the https://github.com/ztellman/dirigiste)
gsnewmark: do you know what’s the semantic of the key when acquiring and releasing objects?
as far as I understand it's just an id for the particular resource (type). For example, in aleph
's HTTP client key is a hostname, and all connections to this host are stored under it
Wouldn’t different resource types be different pools anyway?
aleph
has one pool for all client connections, but each group of connections for particular host are stored under the different key. I suspect it's easier to specify maximum global number of connections this way, but it's definitely possible to simply create a separate pool for each resource type (and store all objects/resources under the same key).
@ztellman can probably explain reasoning behind the key better than I
I just want a single pool, it seems like I would just use one constant key.
Understood. Thanks.
What I’m doing is creating ScriptEngines on a web app to run JavaScript on the server side. They are expensive to create and non-thread-safe. This is why I’m using a pool. But I feel the pool controller is very dependant on the implementation of the web server (whether it’s multithreaded, multi-process, event driven). I went for a fixed controller with a very high maximum, is this the right approach?
Here’s the code: https://github.com/ldnclj/proclodo-spa-server-rendering/blob/master/src/clj/proclodo_spa_server_rendering/handler.clj#L24-L41
@ztellman: I’m trying to understand the stats from the pool. Is the number of workers the number of objects in the pool?
Is there a version of comp
that behaves like some->
? (I.e., short-circuits and returns any falsey values.)
Right now I’ve got
#(some-> %
zip/node
:content
first
productpage-body?)
and it just looks nicer in my particular case as a comp
. (In fact, it was a comp
until I realized I was NPE’ing.)@erik_price: What's wrong with that approach ?
Well, it’s not the end of the world; it works. But I’ve got a series of predicates that look like this, as arguments to a call to every-pred
, and since I’m not closing over any local environment, the anonymous function syntax is a tad misleading. I could just write a function that does something like some-comp
but was curious if I was missing anything built-in.
@michaelr: That looks like a problem with AOT-compilation and the way the Uberjar is assembled; possibly related to https://github.com/stuartsierra/component/issues/32
@stuartsierra: heh, this one tricked me https://clojars.org/datomic-free . Thanks
hi all, anyone know of a lein plugin that will process doc/*.md files and create nice html documentation. I’m looking at codox and that looks nice for generating api docs from source code, but I’d also like to include my doc/intro.md in the generated html output as well.
My clojure app running in heroku is throwing out-of-memory errors. Am I correct in assuming that I'm processing more requests than I can simultaneously with the amout of ram that I have?
What would be the Clojure idiom to add key/value pairs to a hashmap only when the value is not nil? I’m constructing a hashmap of configuration and when the environment doesn’t specify a vaule, then it’s nil, but I don’t want an explicit nil, I want no key in the hashmap.
@pupeno: I've done this on occasion (defn assoc-some [m k v] (if (some? v) (assoc m k v) m))
mpenet: in clojure you can use anything as keys, even emojis.
you can also use into
with a transducer: (into {} (filter (fn [[k v]] (some? v))) {:k1 nil :k2 1})
@stuartsierra: that wouldn’t remove the taste of imperative this code has: https://gist.github.com/pupeno/23318a05d4920dcafc51
it looks like a useful function though
or merge and (partial remove (comp nil? val)), but the reduce-kv thing reads better imo
I believe that in Clojure, backslashes in regexp literals are not escaped like normal strings are - is that correct?
However I assume that they are when using re-pattern, since that accepts a normal string?
@cfleming: that is correct, reader docs mention exactly this: "Regex strings do not follow the same escape character rules as strings. Specifically, backslashes in the pattern are treated as themselves (and do not need to be escaped with an additional backslash). For example, (re-pattern "\\s*\\d+") can be written more concisely as #"\s*\d+"."
@cfleming: didn't mean that as a rtfm, http://clojure.org docs can be hard to navigate ime
@ragge: No problem, I’m quite happy with an RTFM, but yeah - I’d searched for it but hadn’t found it.
@pupeno: I'm late to the thread, but I use merge with when.
(merge {} (when foo {:foo foo}) (when bar {:bar bar}))
although I'm not sure if it's the most performant way@whacked: @luxbock Not sure if you all are still interested in L-Systems stuff but I think I've figured out a good way to handle parametric and context-sensitive systems. I've got an example where I keep track of the age of items as they go through each iteration of the system. https://github.com/decomplect/ion/blob/master/src/ion/ergo/l_system.cljc
I made it very open-ended so pretty much anything can be added as a parameter and so lots of interesting things should be able to be done with these functions.
But I have this nagging feeling that I'm not leveraging transducers the way I should be...
http://jarkeeper.com/carouselapps/to-jdbc-uri is claiming my library is depending on the outdated Clojure 1.6.0. Should I depend on 1.7.0 or 1.6.0? the library works with either.
@pupeno I tend not to depend on any clojure version, but add a clojure dependency to lein's :dev profile so I can boot a repl
that way your users get to decide
Weird that system
isn't in scope. I use it in the project.clj file in the context of returning database info (e.g. ~(str "jdbc:postgresql:" (System/getenv "DATABASE_URL") ...
perhaps it's in the difference between #=
and ~
when it comes to evaluating in project.clj, but I don't fully know
@troydm: https://libraries.io/clojars has some stats. But they're not great yet(tm)
anyone know why I might be running into SQLException Too many update results were returned
on a one statement migratus migration?
@tel: Check HikariCP
It has a Clojure wrapper also