This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-05-25
Channels
- # aws (2)
- # beginners (57)
- # boot (31)
- # carry (15)
- # cider (9)
- # cljs-dev (9)
- # cljs-experience (32)
- # cljsrn (94)
- # clojure (129)
- # clojure-dusseldorf (3)
- # clojure-greece (4)
- # clojure-italy (8)
- # clojure-norway (3)
- # clojure-russia (344)
- # clojure-sg (39)
- # clojure-spec (2)
- # clojure-uk (39)
- # clojurescript (84)
- # core-async (99)
- # cursive (10)
- # data-science (1)
- # datascript (4)
- # datomic (66)
- # emacs (10)
- # graphql (4)
- # hoplon (28)
- # jobs (15)
- # luminus (3)
- # lumo (5)
- # off-topic (23)
- # om (4)
- # onyx (32)
- # pedestal (24)
- # re-frame (2)
- # reagent (7)
- # ring-swagger (32)
- # spacemacs (4)
- # untangled (57)
- # utah-clojurians (1)
What's the preferred way to create a sandboxed environment that extends dev, that will be ignored when the dev profile builds — is it :profiles?
with leiningen you can give the profile any name you like, and then merge it with dev
:provided is for dependencies that are used during development and production, but will be supplied externally in the production environment (so shouldn't be included in the production jar)
@noisesmith I'm looking at some examples of that right now, is the idea basically to assoc the required dependencies, etc. with the desired profile name and also alias that name to "lein with-profiles the-name"?
kzeidler: the "alias" is automatic, with-profile
is how you tell lein to use a custom profile for a task. lein with-profile +foo repl
- but you can also define an alias that combines a specific alias and task.
(apply = (map first colls))
is to (apply = (map first) colls)
as (into [] (map first colls))
is to (into [] (map first) colls)
@tclamb not that I know of, what would be the benefit over composing apply
with sequence
/ into
?
why is ring/compojure route like (PUT “/test” [filter]) resulting in a scalar string “aha” when called with a single item array [“aha”]. ??? Callling it with [“asdf” “asdff”] results in proper binding of a 2 element array. For some reason compojure/ring is unwrapping single element arrays…. ?
Any tips on why I might be getting thousands of these? The server eventually dies from OOM.
"clojure-agent-send-off-pool-1003" - Thread t@24578
java.lang.Thread.State: TIMED_WAITING
at sun.misc.Unsafe.park(Native Method)
- parking to wait for <65be8b86> (a java.util.concurrent.SynchronousQueue$TransferStack)
at java.util.concurrent.locks.LockSupport.parkNanos(LockSupport.java:226)
at java.util.concurrent.SynchronousQueue$TransferStack.awaitFulfill(SynchronousQueue.java:460)
at java.util.concurrent.SynchronousQueue$TransferStack.transfer(SynchronousQueue.java:359)
at java.util.concurrent.SynchronousQueue.poll(SynchronousQueue.java:942)
at java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1068)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1130)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:745)
Locked ownable synchronizers:
- None
@curlyfry I used the Http interface directly with http-kit, which made it nicely data-driven, and enabled me to do AWS request signing which was necessary in my case.
Fork in the road. For someone most comfortable with static, no-frills Apache servers, but interested in deploying a socket-based app, would Immutant or Http-kit be the friendlier choice?
does anyone know something similar to this for Clojure / JVM? https://github.com/kalafut/imohash
luxbock: No, but IIRC clojure uses murmur3 hashing, so it looks like it’d be a fairly easy fn to write
are there clojure bindings for https://github.com/amzn/amazon-pay-sdk-java anywhere ?
@adamfrey - I’ve always used getx
and getx-in
from simulant, when I wanted this functionality. https://github.com/Datomic/simulant/blob/master/src/simulant/util.clj#L24-L37
@pithyless Thanks for that, I hadn't seen it before. I'm interested in getting it to work for the more idiomatic (:key {:key 1})
, in development at least. Maybe I'll experiment with building clojure myself to try it out
There are just too many cases, where the key may in fact not be there by design. So I like the explicit nature of getx
and getx-in
.
@bpiel Were you using agents for something specifically? If not, wild guess: some logging framework is crapping out.
@john Thanks. I think we figured it out. We were just spinning up a lot of threads in a place we didn't expect. Nothing interesting.
My big lesson here was that visualvm is awesome and that I should've reached for it sooner
@joshjones rgr. thanks
@ghadi what's the status of squee? I'll need a jdbc lib soon and I really like some of the ideas/impl (stole a few things for mpenet/alia)
Anybody going to the triclojure meet up in Durham tonight?
@mpenet I still like it more than clojure.java.jdbc, but obviously I haven't maintained it. maybe I should file a few issues to it and accept pull requests
the few changes I wanted to explore:
- make query
return a reducible directly, rather than realizing and internal one. (this means it would delay sending a statement until it was reduced over)
- allow a "edn-reader" like construct to get out different value types directly, like java.time.Instants
- perhaps registering queries globally a la spec
another option is just assume people will use c.j.jdbc and provide the reducible result set from squee alone as a library
I am mostly interested in the reducible parts yes, also rowgenerator. But the code is generally cleaner in squee too imho
yeah the transaction and connection handling is solid -- rowgenerator might just end up being a multi arity function
btw the reducible parts have been extracted into these two functions: https://gist.github.com/ghadishayban/902373e247e920855139902912d237f0
On my phone right now, but I am saving this for later, I had seen earlier versions of it I think. Cool stuff
the function passed in would check the ResultSet's .next
and extract a row, or return ::eof
I think these two functions cover 90% of the usecases for either implementing your own IReduceInit, or having generators/`yield`
Say, using clojure.test
fixtures, is there a way to specify that I want a certain fixture only to apply to an individual test, instead of to all tests in the namespace?
@timgilbert I think could just call it directly (your-fixture (fn [] your-test-code))
the fixture stuff is for executing setup and tear down code around multiple tests so you don't have to repeat that setup code
if you are doing setup and tear down for a single test, there is no benefit over doing it directly in the test
@hiredman he could have common setup and teardown between individual tests in different test files
you can also use it as organization guide, tests that rely on the same setup and tear down in the same files, tests that rely on different setup and tear down in different files
that would seem to be a poor organisation guide. I want to disable logging for some tests and capture it for others. which tests that applies to is very orthogonal to how I'd like to organise my test suite. yes @joshjones fixtures are nothing special, just functions that you can call
@bfabry if you want to separate the tests themselves from the list of special cases, wild idea: create a custom macro (e.g. deftest-potentially-logged
or something more general like deftest+
) and make it check with the global variable which holds the names of tests which must capture the logs.
ah, guess I a bit misinterpreted what you said. Yes, I agree. I would also wrap every test case with a needed function instead of keeping a separate list of tests to modify 🙂
But if the separate list is really needed than creating a custom macro is one of the solutions as it's not possible with clojure.test
out of the box.
hi everyone, while using clojure.jdbc
is there an easy way of changing the name conventions of the returned fields? In SQL seems like i cant select myName as my-name
and id like to stick to clojure conventions without a :row-fn
combined with rename-keys
`
plins: There is a #sql room but have you tried
select myName as `my-name
`One could also supply an :identifiers
option to jdbc/query
So @ericnormand posted http://www.lispcast.com/cognitect-clojure, which is well worth a read.
which is a summary of some sorts of what happened on the Clojure Jira the last seven days.
Being a Jira Jockey by trade, this is something I could continue writing if people find it interesting.
Thumbs up to that, @slipset - I don’t have the time nor the inclination to follow the developments on the Clojure JIRA but if this were turned into a newsletter I would definitely subscribe to it.
@slipset key point from the article: RH is a feature. i would say RH is Clojure's killer app.
look at the milestones: clojure, clojurescript, core.async, spec, just to name a few. what other language ecosystem even comes close?
all of those things(lisps, compiling to js, csp, contracts/generative testing) are great, and are great together, but also have a long history
my thesis: clojure can do this kind of stuff. of course any language can. but in clojure you can do it without breaking the language.
racket, haskell, c#: clojure added core.async, which, while not part of the language kernel, effectively extended the language. have the other languages mentioned done similar? can they? i honestly do not know
c# has been a steady release of really nice language features, haskell allows for any random (phD) person to make their own compiler extensions, any lisp obviously allows for extensions, java has java 8 and soon java 9,
afaik, cobol has steadily added features. yes, you can write oo-cobol. that does not make it good.
(IMHO) it doesn't matter whether it needed compiler work or not. In core.async's case it's cool that it didn't, but that's it
Just like it doesn't matter right now if clojure is self-hosted or not. It's great and it works
this may sound trivial, but I think Clojure's ubiquitous use of data literal forms []
and {}
everywhere made lisp just more approachable for newbies. And being on the JVM was the perfect storm.
is there a way to detect termination of a standalone clojure application to perform some graceful shutdown procedures?
@raywillig if you're in java land, you can add a hook to the JVM shutdown
so i'm on hotel wifi and this is causing leiningen to throw a bunch of certificate errors when it tries to fetch deps
lol... can you get a vpn out through the hotel wifi? that'd solve the problem and mean your safety and privacy stay a bit intact
@adamvh once I tried to use leiningen from a “free wifi” and I ended up downloading a bunch of “jar files” that actually contained the html markup for a “click here to use intarwebs” page
because I forgot to access the wifi from a browser first
With transit-clj
I can write multiple objects to the same outputstream, and read them back one by one by calling the reader multiple times with the same inputstream. Is that an artifact of the implementation on the JVM or is it a supported use-case?
@jfntn it’s something demonstrated in the readme https://github.com/cognitect/transit-clj#usage
I doubt it would be in the readme if not supported
@noisesmith indeed, thanks for pointing that out. My problem is I need to replicate that reader example in ClojureScript and it doesn’t seem supported there
@slipset I have done some stuff like this in the past - both in a weekly form and in a longer form at http://insideclojure.org but I think it's hard to get some of the context. Like I would not completely agree with some of the things in your writeup. It also puts all tickets on an equal footing when some tickets are big and important and some are not. It's hard for me to tell where the balance is between doing the work and talking about the work (to the detriment of doing the work)
Which is not to say that I'm really for or against you doing it, just some of the things I experienced
hey is there a way to run tests under specific directory, or using wildcard in namespace in clojure.test? only option i have found so far, is to use test-selector
but I try to avoid annotating all the tests I need to group together
you can use clojure.test/test-ns to run tests on a particular ns in the repl
or clojure.test/run-tests which takes a varargs of namespaces