This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2015-12-14
Channels
- # admin-announcements (283)
- # announcements (1)
- # aws (3)
- # beginners (24)
- # cider (32)
- # clara (13)
- # cljs-dev (1)
- # cljsjs (10)
- # cljsrn (24)
- # clojure (179)
- # clojure-dev (6)
- # clojure-russia (149)
- # clojurecup (5)
- # clojurescript (33)
- # cursive (23)
- # datomic (35)
- # devops (6)
- # emacs (1)
- # jobs-rus (11)
- # ldnclj (77)
- # lein-figwheel (1)
- # luminus (3)
- # off-topic (3)
- # om (179)
- # onyx (13)
- # proton (6)
- # reagent (60)
- # testing (1)
hey all—can anyone tell me how I can (temporarily) edit the source of a lein dependency in my project? I basically want to throw a quick (prn) around a dynamic var that gets called in there
ok, looks like in ~/.m2
but I didn’t realize these are all jars ls -al ~/.m2/repository/eftest/eftest/0.1.0/
. Is there even a way to edit source of something that was pulled in from maven?
hi, has anyone here used a fast disk backed queue? I don’t mind it if I need to use Java but I preferred something that works well with the clojure set data structure.
@davebryand: If you want to run a modified version of a library on which you depend, the normal approach would be to clone the repo, modify it, lein install
it locally, and depend upon that modified version (often libraries have a "SNAPSHOT" version on master).
ah, very good—thanks @seancorfield
I’m working on a library and I need to test it on Heroku. Is there a way to do it without releasing an unfinished version to clojars?
http://clojars.org seems to be down right now?
Seems like the folks at Advent of Code reddit liked this snippet I made with loom: https://www.reddit.com/r/adventofcode/comments/3wj34t/graph_visualization_of_day_7s_wires/ Don't know if the author of the lib is here, but thanks for writing it
anyone encountered this issue? Caused by: java.lang.NoClassDefFoundError: Could not initialize class clojure.tools.reader.reader_types__init
i’m sure i have the latest jar in my lein deps - 1.0.0-alpha2, and the latest tools.analyzer.jvm - 0.6.9
no clashes on either of them in lein deps :tree
driving me slightly mad 😐
only happens on our linux build box, fine on my mac
How do I generate the pom and other files for release with lein?
@robert-stuttaford: have you tried lein clean?
@robert-stuttaford: and if that doesn't work, (re)move your .m2 dir and try again: lein clean + lein deps
i have a vector of vectors, is there a shorthand to map over the inner vectors like (map (fn [col] (map my-func col)) cols) ?
flatten the vector and then map over it?
i don't want it flattened in the end, i guess i'll just define a helper called map-inner or something
thought it might already exist
what do you mean by flatten in the end?
nothing sorry, was wrong thinking
(map func (flatten your-vec))
that is a bit clearer, thanks
Not sure if that works or whether it’s what you want. Does Clojure have flatten or was that Common Lisp?
works marvelously, thanks
Now, I think flatten is recursive, so if you have three levels of vectors, it’ll flatten them all.
yep, it will, that isn't a problem
hmm actually, it isnt quite the same as before
i didnt check it properly
do need it to only flatten one level
Then you need to concatenate vectors.
Try concat
(map func (apply concat your-vector-of-vectors))
@pupeno you can use lein-heroku plugin to test your clojar withou releasing
@codefinger: cool! I’ll keep that in mind.
@pupeno (inner-map inc [[1 2] [3 4]]) should return [[2 3] [4 5]]
Oh… you want to preserve the structure of the vector. Sorry, I missed that.
I’d just write a map call inside another.
Not sure if there’s a better way.
@danielstockton: it's probably an overkill for this use case, but you might want to know about - https://github.com/nathanmarz/specter
thanks, looks interesting
@codefinger: do you use it? uploading the build is taking forever.
@pupeno: no i made it :) it does have to upload your binaries, which can take a while depending on connection speed
is anyone here using docker? is there a clear way to cache lein deps in a container?
@eyelidlessness: i tend to do the build separately from running the Dockerfile and just include the uberjar in the Dockerfile, but you could run lein deps
as a step in your Dockerfile. the downside would be that when your deps actually change then you would have to throw your docker cache for the image away... which would perhaps mean having to run apt-get update
etc again - not sure if or how you can remove just some steps from the docker cache
interesting. i'll take a look at that. thanks!
pulling deps on each build is such a long wait, that i'd prefer to avoid it in prod (heck, i'd prefer to avoid it in dev)
hmm - lein has it's own mechanism for deciding when it's going to pull deps... can you tell lein not to check ?
as far as i can tell it's using that mechanism, but from a fresh local repository every time
i am trying out RUN lein deps
right now, i expect it'll cache as expected
@borkdude: i would be willing to bet there are a number of chrome extensions for that. but i couldn't guess how they handle scenarios where servers are not configured with the correct mime-type
couldn't you just mount the location that lein deps are stored as a data volume or something?
that's interesting.
Haven't tried it, but it might work
i'm new to docker. i'm getting the impression that volumes are the key to everything
yea they're pretty useful
I spent a few hours last week figuring them out. Turns out that selinux doesn't play very nicely with them
one would hope that wouldn't be the case 😕
you get them to work together, but its a bit complicated
http://www.projectatomic.io/blog/2015/06/using-volumes-with-docker-can-cause-problems-with-selinux/
mostly the issue is that I wasn't getting any sort of notification from selinux that it was blocking docker
Everyone loves docker but me, it seems. For smaller deployments it's more trouble than it's worth to me. I can see where larger deployments would benefit but I don't deploy anything that big yet.
i'm not 100% sold on docker yet, but i'm evaluating it
or use a server side switch, we have something like that where you can pass format=... to the request params (or via headers) and have it returned as json/edn/yaml etc
@jstew docker definitely has an upfront cost that is mitigated over time. If its a small deployment that's going to be in an environment, or even several environments, that you know everything about, it's probably not actually worth the upfront cost just as a deployment tool
I use it at work though, and it's definitely very useful when working on several projects at once with different requirements on the environment
@eyelidlessness: volumes are certainly useful - for my app containers i use them to mount the host syslog device /dev/log
into the docker container so that i can use the host syslog to collect all container logging, and if you are using a container for a service with persistent storage then they are essential
I haven't seen that up front cost mitigated over time though... The issue is doing things the "docker way". You can't just get a shell on your remote server to get a database dump, for example. You have to figure out how to do that through docker, then you end up either having to remember how to do that or write additional tooling to solve already solved problems.
@eyelidlessness: why not build outside docker and then just put the resulting uberjar/war inside?
@jaen: +1 to that
@jaen: i'm, perhaps wrongheadedly, trying to ensure the entire build process has a predictable environment
I have a couple of ruby apps deployed with docker. Nothing with the JVM though. It's been nice to have parity between local envs and staging/production but the JVM almost makes that a moot point.
@eyelidlessness: this is not a bad idea, I suppose, but then I would suggest having a separate devlopment container (where you build the jar/war) and deployment container.
that is what i have. you pretty much have to
the only difference is i'm just taking the static build and deploying with nginx
(in that files will be created as root or given gid, and you can't easily map between users inside and outside of the container)
@eyelidlessness: you can take a look at this if you want - https://gitlab.com/jaen/panda5
My use case was "let Windows people run that without any hassle" which it unfortunately failed at (couldn't get docker running on Windows for some reason).
@codefinger: oh! Thank you for making it then
@jaen: thanks i'll take a look
re: windows, i can't say directly, but i do know that my OS X experience with docker has been world's better this time around than a year ago
Well, it should be comparable, since both run VM, but somehow on Windows it was problematic to get it working; first docker couldn't see VT-x extensions (it seems you have to run it as an admin) and then something else.
of course
thanks @borkdude. i took another path: backing away from updating the deps in an old project
@robert-stuttaford: saw a talk about this on Clojure eXchange: 'Are you afraid of dependencies' (or similar title)
project has both server and cljs codebase. couldn’t get them to agree on a tools.reader.
lein release changed the tag scheme
In my GC logs I see [Full GC (Allocation Failure) 2783M->1890M(2784M), 17.0343879 secs]
every few minutes or so. Am I right in assuming this means that the JVM stops the world for 15 seconds on each of those occasions?
My JVM settings include (in addition to -Xmx
): -XX:+UseG1GC -XX:SurvivorRatio=1 -XX:NewRatio=2 -XX:MaxTenuringThreshold=15 -XX:-UseAdaptiveSizePolicy -XX:G1HeapRegionSize=32m -XX:+UseStringDeduplication
I would like a clojure code search engine. E.g. I want to search for “(take (iterate & ))” and see how frequently it occurs. Has this been done?
hey pesterhazy: it looks like you are using many jvm options, but you are not aware that that JVM can stop the world for 15 seconds. I recommend removing AdaptiveSzie and StringDedup
Go through this to tune the rest according to your particular usage http://www.oracle.com/technetwork/articles/java/g1gc-1984535.html
I wonder what would happen if one attempted to algorithmically optimize clojure.core’s API based on usage patterns. E.g. Inline fns and arities which are infrequently used and introduce fns and arities for common usage patterns.
@eraserhd: Funny, I just read this: http://www.lispcast.com/100-most-used-clojure-expressions which is not exactly what you want but maybe the approach can be adapted.
@sveri: Not a coincidence, I just read that, too, which is why I was thinking of it 😄
@ghadi: point taken
@ghadi: you correctly pointed out some cognitive dissonance
in my defense, I did not add these options originally but was asked to review them
yeah a lot of places I've worked have just had magic JVM_OPTS that have been passed down as tribal magic but no one ever understands
before I read your comment I did the obvious and removed all the options except for -Xmx
it's a bit better but I'm still seeing 8s+ pauses, obviously totally unacceptable
there must be something in our code that generates tons and tons of garbage
@ghadi: I'll at least do my homeword and read Oracle's documentation on GCs next time
NOT the most fun part of working in the jvm however
Hm, I am looking for memoization for an atom that accepts a TTL. I could do it manually like "delete after x ms", check on every deref it a value exists, if not, insert value, but that seems like a library could handle that better
pesterhazy: yeah. better tho than devops team just saying, "Hey I spent 10 minutes and found these magic opts online, can we try them?" Redhat+Oracle working on a new collector for giant heaps
What’s the easiest way to listen for keyboard events in Clojure?
@alex.hall: Thanks, that works
it might not
it tracks files on disk, and might not yet have been updated to deal with .cljc
easy to find out on github
yeah, reloaded workflow (which uses tools.ns) is definitely better, overall
(have used both, definitely prefer reloaded )
Pardon my dumb, but what is the reloaded workflow?
a way to draw boxes around your app global state in such a way that you can easily tear everything down, reload all your code, restart all your stateful services, without restarting your jvm
i have an emacs function that invokes it, so: make some changes, hit C-c r, and i know everything’s properly recompiled (including dependent code) and cleanly restarted
takes a little upfront effort, but it’s so worth it
Hi, I am trying to understand how can I control the http response (status & body) from a compojure-api API. My endpoint has a login function which can return a JWT in the form of a map {:token “…my token … “} and otherwise, I would like to respond with a 401 http code and some string message.
However, I cannot completely understand how it works. Here is a link to the docs: https://github.com/metosin/compojure-api#response-models
I can’t understand where the Total var comes from and most important, if this is the correct way of doing what I want.
@rcanepa: ok
, forbidden
and not-found
are just functions from ring-http-response to create Ring response maps, case
is just example implementation to return different responses
@rcanepa: Total var is a schema
@rcanepa: Yes. Also, if you only want to set schema for 200 response, you can use :return
metadata handler
@juhoteperi: Awesome… it worked perfectly! Thank you!!
@robert-stuttaford: well, I have a pretty similar setup, just with this - https://github.com/danielsz/system/blob/master/src/system/boot.clj - and for some reason it can't recognize cljcs ; /
Is this one : http://rundis.github.io/blog/2015/buddy_auth_part2.html a good example how to make autherisation work