This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
- # aws (1)
- # beginners (65)
- # boot (400)
- # cider (19)
- # clara (2)
- # cljs-dev (29)
- # clojure (127)
- # clojure-chicago (2)
- # clojure-conj (1)
- # clojure-dev (12)
- # clojure-russia (156)
- # clojure-sg (6)
- # clojure-za (1)
- # clojurescript (193)
- # core-async (23)
- # datomic (91)
- # editors (4)
- # editors-rus (1)
- # events (1)
- # hoplon (3)
- # jobs (1)
- # ldnclj (6)
- # leiningen (3)
- # nginx (3)
- # off-topic (5)
- # om (93)
- # onyx (10)
- # re-frame (11)
- # spacemacs (1)
- # testing (2)
- # yada (5)
@martinklepsch: agreed. I don't remember it being something asked for by in the tooling circles I frequent. I will be interested to see how long it takes and how things migrate
I am trying to start a http-kit server with reload and cors but for some reason I am unable to get it to work, I still get CORS failures from my browser. My server is a component component, here’s here I am trying to wrap the handller: https://gist.github.com/verma/a581e6425ad0b26d0b7e#file-server-clj-L51-L53
verma: are you using https://github.com/r0man/ring-cors for wrap-cors?
What's clojure equivalent of ruby's
caller method? http://ruby-doc.org/core-2.2.3/Kernel.html#method-i-caller
To put it another way, if a function is call from multiple places, at runtime, is there a way to print out caller for debugging purpose?
the Thread class has methods to inspect the stack
(Thread/dumpStack) will just dump that thread's stack to stderr
or (Thread/getStackTrace) gives you an array of StackTraceElement's that you can traverse and do whatever
Ahh, right. Thanks @alexmiller
@verma, i had similar issue with r0man/ring-cors - it just raised null-pointer exception or empty request, i switched to ring.middleware.cors ( https://github.com/jumblerg/ring.middleware.cors )
and i saw that someone was complaining about yesql pollutes namespace, there’s
require-sql macro, i’m using it to prevent confusion between models function and yesql query - https://github.com/krisajenkins/yesql/blob/master/src/yesql/core.clj#L40
Is there a
let-cond? I.e. where I have the cond test expression available in the body?
has anyone considered writing an acme client in clojure/java? https://github.com/letsencrypt/acme-spec
@alexmiller: It's really encouraging to see core.async come out with those new features. Thanks for moving that along.
happy to get it released finally!
I know there are a pile of tickets there too and I would like to start whittling those down too
Already using both
offer! in Onyx, yielding a real perf improvement since we're not doing blocking operations anymore.
you're not actually polling are you? :)
@alexmiller: In some cases we're planning to, yeah. It's helpful for cases where you want to read as much data from an input source as possible and immediately process it without waiting - which is good when the time needed to process the payload is low.
Weird trick from the Mechanical Sympathy guy (Martin Thompson).
@michaeldrogalis: there any write up on creating onyx plugins?
Does anybody have experience with rewrite-clj? i feel myself stupid. how to replace smth like
[:div.row ...] with
(row ...) in tree after i found it with zip/find-value? i've tried
(z/edit (z/up (z/find-value x z/next :div.row)) (fn [x] (n/list-node (cons 'row (rest (n/children x)))))), but i get
java.lang.UnsupportedOperationException: rewrite-clj.node.protocols/eval1689/fn protocols.clj: 60 rewrite-clj.node.protocols/eval1644/fn/G protocols.clj: 51 boot.user/eval4246/fn boot.user7362033130061499799.clj: 1 ... clojure.core/apply core.clj: 626 rewrite-clj.zip.edit/edit/fn edit.clj: 34 rewrite-clj.zip.edit/edit-node edit.clj: 25 ... clojure.core/apply core.clj: 626 clojure.zip/edit zip.clj: 214 ... rewrite-clj.zip.edit/edit edit.clj: 34 ... boot.user/eval4246 boot.user7362033130061499799.clj: 1 ... clojure.core/eval core.clj: 2927
@albaker: Over to #C051WKSP3
@michaeldrogalis: ah, didn't know there was one - thanks
@mbertheau: I created a cond-let macro as part of https://github.com/AvisoNovate/toolchest
When multiple developers work on a clojure project and build uberjars of the same project as it iteratively evolves, there is a risk that the version numbers in the project aren't updated. It would be great to hear other's experience with this and how this is dealt with. For example, should an autoincrement be added to the version? or should the initials of the last developer be added? e.g.
? if so, how best to make this automatic, slurp the project.clj file to make the changes and put it back? eager to hear thoughts on pros and cons...
(defproject myproj "0.0.1-SNAPSHOT-AA-01"
I'm used to working on projects alone, but now have two others joining it. Want to craft a solid process.
I don’t see how this would be an issue, unless each developer is deploying their own working branch.
we extensively use git. the issue is that we prefer end-to-end tests from different uberjar builds and want to make sure they have unique (informative) names
once the end-to-end tests are valid for an uberjar, then it is eligible for production (if desired)
end to end tests take long, so might as well have the CI do it, and you only worry about it when it fails.
cons: it might take a while before you get any feedback, not sure if that is a cons anyway because e-to-e tests are by their own nature very slow to run.
another cons might be that you need some jenkins expertise, if you are using jenkins, and you don’t have anyone inhouse with experience. But it is worth learning anyway.
yeah, using the git SHA is a good idea. This is handy when you are building libraries that you use inhouse
using the commit as the project version would be cool. I wonder how that would work...
assuming you're on unixy systems - execute a shell and get the variable inside
aaelony: you could make use of a git hook to change the version to reflect the commit hash
Doing some work for a 30 y/o travel company in the UK. Replaced 1,000 lines of SQL with about… 15 lines of Clojure? Drinking cask beer to celebrate.
I don’t even want to think about how one would reliably analyze the effects of 1000 lines of sql
now that's a table
The story is (gather round 🔥) they have a homebuilt web analytics thing. It lets you define any field/collection in JS, and it’s written to the backend. As a column. In the db. This company has 1500+ web properties and 900 employees.
Some time ago when they just started creating this thing someone probably has thought that it was a clever and elegant solution
yep, whenever I think "oh what a clever solution" my next thought is "let's not go there, 'tis a silly place"
— how do I compare two byte arrays?
user> (= (byte-array 0) (byte-array 0)) ;; => false
Turn ‘em into seqs?
I suppose, but it’s not ideal. Obviously, the above was a simplified example to illustrate my confusion. I suppose I need two checks now; one that I’ve got a byte array back, and another that munges the array into a vec/sec and checks that it has the correct values.
(the unexpected behavior is because you’re getting reference equals semantics, aka
identical? in clojure)
it’s ok to call
seq on other seqable things, not just byte arrays — so, it may be safe to do w/o a special case check
yep, I definitely just spent 5 minutes figuring out why (byte-array 0) is not equal to (byte-array 1)
@dot_treo: Thanks, that looks like what I’m after!
user> (java.util.Arrays/equals (byte-array 0) (byte-array 0)) ;; => true user> (java.util.Arrays/equals (byte-array 10) (byte-array 10)) ;; => true user> (java.util.Arrays/equals (byte-array [1, 2,30]) (byte-array [1, 2, 30])) ;; => true user> (java.util.Arrays/equals (byte-array [1, 2,30]) (byte-array '(1, 2, 30))) ;; => true
Cool. That might come in handy, but equals is enough for the simple problems I’m currently having
(If anyone wonders: yes, I was stuck on the very first exercise in the Matasano crypto challenges: http://cryptopals.com/sets/1/challenges/1/ )
My brain’s fried and I could use a hand. I’m trying to return a map filtered by a coll of nested keys. https://gist.github.com/LusciousPear/24a65467091c3caf3368 — In other words, return only the key/values in
(decode test-2) that are in
fields. I’m puzzled trying to find an elegant way to do it.
@aaelony: We're in a similar boat to you, regarding CI and leiningen - and I've yet to find a good solution...
The problem I have with things like
lein-sha-version is that yes it gives you repeatable builds -- but it then means that your CI effectively stops doing integration - because all of your versions are locked... SNAPSHOTs give you this, but at the expense of not knowing auditably which SNAPSHOT ended up in an artifact.
e.g. we have a clojure project
B that depends on a project
A... When I push a commit to
A I want jenkins to first build
A and run its tests, then trigger
B to be built and tested and with the new
A dependency. If and only if the downstream builds all pass do I want
B to be deployed to my jars repository with the updated dependency on
I haven't figured out all the moving parts yet - but my feeling is that you could build this out of a middleware like this one:
https://github.com/RickMoynihan/lein-build-env that only swaps out
-SNAPSHOT versions - with an incrementing build ID then you can use something like
lein ancient to update to the latest...
Some other problems are that for the downstream builds to see the upstream deps you need to
lein install them before you know if they're good... Because
.m2 is global if the candidate is bad you've installed a broken jar which can contaminate other builds - so I suspect you might also want to set
:local-repo and clean up if it fails
Basically I think there are lots of moving parts required to do it properly
@rickmoynihan: agree. I my case though, I think
lein-sha-version is sufficient. It will enable uberjars to be built and tested, and then another process can decide whether or not to make it production.
@aaelony: that works if you don't have lots of downstream project dependencies -- but we have about a dozen (and its growing weekly) -- and updating version numbers feels like a job the CI should be doing
that is true. we're at the end 😉 ... but if you can include the downstream project deps in your assessment of the builds... (??)
Sorry - not sure what you mean...
maybe I misunderstood.. you said "downstream project dependencies -- but we have about a dozen", can you name that dozen as one thing and test it as one thing?
they're a dozen different projects
I would hope however, that someone on this list has probably seen an effective solution for this though 😉
I've been hoping that too!
@aaelony: Another problem is that you effectively have to duplicate parts of the project.clj's as jenkins build triggers to get jenkins to automatically trigger downstream builds... maintaining this is a pain
if you forget to keep it in sync, jenkins can end up triggering more builds than it needs to... and likewise if you forget to add a link then projects you were hoping would be built aren't... it doesn't happen often -- but when it does its a small but annoying inconvenience
its not so much jenkins -- just that it doesn't have knowledge of how to trigger downstream builds based on information in the project.clj files
I suspect any CI would have the same issue -- personally it feels more like leiningen/maven is the problem here
not really - they're different projects for different clients / audiences