Fork me on GitHub

@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 could see it being quite useful for runtime tools though


I thought we were over the whole global DB madness 😞


Do libs still do that?


yesql lets you set one if you want to, but I always just pass the db-spec


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:


is there anything obvious I am missing here?


verma: are you using for wrap-cors?


xeqi: yes


xeqi: my bad, I was unknowingly requesting data from a non-existant service 😕


What's clojure equivalent of ruby's caller method?


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?

Alex Miller (Clojure team)04:10:40

the Thread class has methods to inspect the stack

Alex Miller (Clojure team)04:10:00

(Thread/dumpStack) will just dump that thread's stack to stderr

Alex Miller (Clojure team)04:10:29

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 ( )


@rbxbx: i’m using yesql with hikari-cp and yesql - works very well


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 -


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?


thanks @timgluz I’ll take a look at it.


Whoa. enlive is awesome. Seems to be less popular than I would’ve thought, though.


@alexmiller: It's really encouraging to see core.async come out with those new features. Thanks for moving that along. simple_smile

Alex Miller (Clojure team)14:10:44

happy to get it released finally!

Alex Miller (Clojure team)14:10:10

I know there are a pile of tickets there too and I would like to start whittling those down too


Already using both poll! and offer! in Onyx, yielding a real perf improvement since we're not doing blocking operations anymore.

Alex Miller (Clojure team)14:10:13

you're not actually polling are you? :)


It makes manifold less necessary I guess


let-flow is still the best though


@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).

Al Baker16:10:49

@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

  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
                            edit.clj:   34
                          edit.clj:   25
                      clojure.core/apply                          core.clj:  626
                                         zip.clj:  214
                               edit.clj:   34
                      boot.user/eval4246  boot.user7362033130061499799.clj:    1
                       clojure.core/eval                          core.clj: 2927

Al Baker17:10:24

@michaeldrogalis: ah, didn't know there was one - thanks


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.

(defproject myproj "0.0.1-SNAPSHOT-AA-01" 
? 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...


something seems wrong with the way you develop/release if this is happening


could you elaborate on your development process a bit more?


the question actually is what should the development process be


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.


I might be missing something


working on maven based projects is similar.


aaelony: just use git or any scms and don't add any .jar to it, only code files


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


run the tests on the branches


have the ci build each branch when it is pushed


once the end-to-end tests are valid for an uberjar, then it is eligible for production (if desired)


we run it on each PR instead of branch


so, you create a PR, the CI runs the tests on that branch


this is exactly what I want to hear pros/cons on simple_smile


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: if you have lots of PRs, your server can become slow and overwhelmed


with jenkins you can limit the amount of builds it can do simultaneously.


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.


for unique project versions you can take the git SHA


this is very true, some of the end to end tests do in fact take a long time.


yeah, using the git SHA is a good idea. This is handy when you are building libraries that you use inhouse


and you want to test a library currently under development


and make sure it works with your own code.


using the commit as the project version would be cool. I wonder how that would work...


a library approach would indeed be cleaner


assuming you're on unixy systems - execute a shell and get the variable inside project.clj


aaelony: you could make use of a git hook to change the version to reflect the commit hash


centos, so no problem


mmm... dm3 solutions is better


thanks. this is quite good.


lein-sha-version looks awesome!


thanks for all the comments. perfect.


bonus - uses jgit, so portable


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


Let’s put it this way … to start, there’s 17,291 columns in one table.


The effects? I’m drinking. That’s an effect.


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.


normalize all the things


Some time ago when they just started creating this thing someone probably has thought that it was a clever and elegant solution


I fear clever.


yep, whenever I think "oh what a clever solution" my next thought is "let's not go there, 'tis a silly place"



user> (=  (byte-array 0) (byte-array 0))
;; => false
— how do I compare two byte arrays?


(Sorry if that is a very noob question.)


Turn ‘em into seqs?


(apply = (map seq [(byte-array 0) (byte-array 0) ...]))


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


You could drop down into Java …. (Arrays/equals


or.. it does, maybe I misspelled something in my previous test


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


there is also a deepEquals for two dimensional arrays


Cool. That might come in handy, but equals is enough for the simple problems I’m currently having simple_smile


(If anyone wonders: yes, I was stuck on the very first exercise in the Matasano crypto challenges: )


My brain’s fried and I could use a hand. I’m trying to return a map filtered by a coll of nested keys. — 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 A 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: 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.


Oh boy, criterium doesn’t half eat battery simple_smile


We could even make a database table about the characteristics of each build 😉


@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 😉


perhaps they can weigh in


I've been hoping that too! simple_smile


@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


well if jenkins is part of the problem...


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


and it can't all be one build...


not really - they're different projects for different clients / audiences