This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2016-09-20
Channels
- # bangalore-clj (3)
- # beginners (30)
- # boot (117)
- # braid-chat (6)
- # carry (9)
- # cider (6)
- # clara (11)
- # cljs-dev (28)
- # cljsrn (12)
- # clojars (2)
- # clojure (114)
- # clojure-austin (2)
- # clojure-dev (1)
- # clojure-dusseldorf (1)
- # clojure-greece (47)
- # clojure-italy (5)
- # clojure-russia (79)
- # clojure-spec (121)
- # clojure-uk (133)
- # clojurescript (92)
- # community-development (67)
- # copenhagen-clojurians (1)
- # core-async (25)
- # cursive (67)
- # datascript (1)
- # datomic (34)
- # devcards (24)
- # emacs (8)
- # funcool (71)
- # juxt (1)
- # keechma (2)
- # lein-figwheel (6)
- # luminus (8)
- # mount (17)
- # om (135)
- # om-next (13)
- # onyx (147)
- # pedestal (11)
- # planck (7)
- # re-frame (42)
- # reagent (86)
- # rum (11)
- # specter (6)
- # testing (6)
- # untangled (1)
- # vim (6)
- # yada (24)
Has anybody's used https://github.com/kumarshantanu/espejito for latency timing? is there any other lib out there?
oh thanks!
looks like I need to pay Peter a lot of drinks š» š
richiardiandrea: https://www.taoensso.com/clojure/backers
@richiardiandrea We are using Espejito at Concur in several web services in production ā we log the metrics report when the total latency crosses a threshold. We also trigger it on-demand when perf tuning.
Good to know, I will need to explore more in depth both libs and then decide which one to use, thanks for pitching in!
I'm looking for a small, easy to use, and relatively fast server application, which one is better http-kit, Immutant v2+, nginx-clojure, Aleph?
If not, I've used ring-jetty-adapter and it is simple and fast. If so, ring-jetty9-adapter adds it in there, and is what I'm using now.
@lxsameer Try Pedestal 0.5. Lots of optimization work has gone in recently. New docs site: http://pedestal.io/
when did that doc-site go up, @stuartsierra ?
within the last 3ā4 weeks
very nice. not having this was quite a drawback for pedestal. stoked it's up!
I can take no credit for it š
@tomjkidd @stuartsierra I want to use sente , so I need a server app which sente supports
Michael Nygard did the bulk of the work on the new Pedestal site
@lxsameer hmm, http-kit is the only other one I've used. It is simple enough. http://www.parens-of-the-dead.com/ uses it in their podcast too, so you could get a feeling for how its used (and even learn some other cool tricks...)
hey guys I am running into an interesting problem. I have a microservice written in clojure. When I deploy my service and run it as a jar I am getting intermittent stackoverflow errors coming from the flatland/useful/experimental/delegate.clj. When I run the code locally on my machine it seems to work alright. When I get to the bottom of the stack trace I see references to my endpoints.clj file (line 1), but there is nothing here to tell me what is setting off the stackoverflow. Here is the start of the trace. Anyone have any ideas where to start debugging this: xception in thread "main" java.lang.StackOverflowError, compiling:(flatland/useful/experimental/delegate.clj:54:27) at clojure.lang.Compiler.analyzeSeq(Compiler.java:6875) at clojure.lang.Compiler.analyze(Compiler.java:6669) at clojure.lang.Compiler.analyzeSeq(Compiler.java:6856) at clojure.lang.Compiler.analyze(Compiler.java:6669) at clojure.lang.Compiler.access$300(Compiler.java:38) at clojure.lang.Compiler$LetExpr$Parser.parse(Compiler.java:6269) at clojure.lang.Compiler.analyzeSeq(Compiler.java:6868) at clojure.lang.Compiler.analyze(Compiler.java:6669) at clojure.lang.Compiler.analyzeSeq(Compiler.java:6856) at clojure.lang.Compiler.analyze(Compiler.java:6669) at clojure.lang.Compiler.analyze(Compiler.java:6625) at clojure.lang.Compiler$IfExpr$Parser.parse(Compiler.java:2797) at clojure.lang.Compiler.analyzeSeq(Compiler.java:6868) at clojure.lang.Compiler.analyze(Compiler.java:6669) at clojure.lang.Compiler.analyze(Compiler.java:6625) at clojure.lang.Compiler$BodyExpr$Parser.parse(Compiler.java:6001) at clojure.lang.Compiler$LetExpr$Parser.parse(Compiler.java:6319) at clojure.lang.Compiler.analyzeSeq(Compiler.java:6868) at clojure.lang.Compiler.analyze(Compiler.java:6669) at clojure.lang.Compiler.analyze(Compiler.java:6625) at clojure.lang.Compiler$BodyExpr$Parser.parse(Compiler.java:6001) at clojure.lang.Compiler$FnMethod.parse(Compiler.java:5380) at clojure.lang.Compiler$FnExpr.parse(Compiler.java:3972) at clojure.lang.Compiler.analyzeSeq(Compiler.java:6866) at clojure.lang.Compiler.analyze(Compiler.java:6669) at clojure.lang.Compiler.analyze(Compiler.java:6625) at clojure.lang.Compiler$InvokeExpr.parse(Compiler.java:3766) at clojure.lang.Compiler.analyzeSeq(Compiler.java:6870) at clojure.lang.Compiler.analyze(Compiler.java:6669) at clojure.lang.Compiler.analyze(Compiler.java:6625) at clojure.lang.Compiler$LetExpr$Parser.parse(Compiler.java:6231) at clojure.lang.Compiler.analyzeSeq(Compiler.java:6868) at clojure.lang.Compiler.analyze(Compiler.java:6669) at clojure.lang.Compiler.analyzeSeq(Compiler.java:6856) at clojure.lang.Compiler.analyze(Compiler.java:6669) at clojure.lang.Compiler.analyze(Compiler.java:6625) at clojure.lang.Compiler$IfExpr$Parser.parse(Compiler.java:2792) at clojure.lang.Compiler.analyzeSeq(Compiler.java:6868) at clojure.lang.Compiler.a
I'm trying to use http://github.com/profesorfalken/jProcesses. I tried (import org.jprocesses.JProcesses) and many variations and none worked. I always get classNotFoundException.
What's the correct way?
@pupeno https://github.com/profesorfalken/jProcesses/blob/master/src/main/java/org/jutils/jprocesses/JProcesses.java#L16
So: (import 'org.jutils.jprocesses.JProcesses)
I think?
Thanks.
Howdy y'all. The basic Buddy auth example for JWE tokens doesn't seem to be working for me. I'm using Boot and System with Sente to send the POST request to login, and it returns success. But I always get unauthorized
when I check with buddy/authenticated?
I'm guessing the problem is that Buddy only checks the :identity
key in the Ring map, but the example puts the token elsewhere? Ahdunno, tried this for a few hours yesterday.
It's possible to check for the existence of the token wherever it's puts, but I kind of want to use the Buddy middleware because I figure it will easily tell if the token has expired.
Does anyone know of an example of rigging your own timeout check for the token, as a possible solution?
Is there a way to use the java xor operator, since clojure doesnāt have a non-bitwise one?
@uwo Don't know if you've seen these (I haven't really evaluated them): https://clojurefun.wordpress.com/2012/08/04/macro-magic-the-xor-macro-38-2/ https://gist.github.com/edbond/665401
@coyotespike gotcha. so youād recommend implementing our own (with the help of examples)?
Also here, mikera appears to be using Java Booleans: https://github.com/mikera/clojure-utils/blob/1453c16940db0650a3cb080168c01ad7f5507300/src/main/clojure/mikera/cljutils/logic.clj
I'm not experienced at Java interop, sadly
I would be rather surprised if it wasn't possible though. Are you thinking it might be more direct?
Just more at hand, I suppose. Thereās no issue with grabbing any of those implementations, surely.
@coyotespike thanks!
Hi everyone, I'm looking at ways to take a vector and remove items based on another vector, the only caveat is that the first vector may contain duplicates and I only want to remove one instance of the items with duplicates. The second vector will contain only distinct items. I've come up with this wacky idea https://gist.github.com/markwoodhall/7b76adc715ac3f21e9bfe747678aee58 but I'm interested in other examples, not necessarily the most readable, just interesting!
@markwoodhall Are the duplicates in contents
guaranteed to be contiguous? i.e. do we never see [123 123 456 123]
@dfan for this example we will only ever see continuous duplicates.
@markwoodhall nice example ! I have this solution. Loop based & straightforwardā¦ā¦ but working and in O(n)+n*O(logāām) (+ 2n ?), maybe interesting ā¦
(defn mask-remove-one
[from to]
(persistent!
(loop [bads (set from)
accu (transient [])
goods to]
(if (nil? goods)
accu
(let [val (first goods)]
(cond
(contains? bads val) (recur (disj bads val)
accu
(next goods))
:else (recur bads (conj! accu val) (next goods))))))))
@ggaillard Nice example, thanks.
speaking of whichā¦ I need to push the boss on the 1.9 alpha, so we can start on Spec. Iām sure 1.9.0 will be stable by the time we try to put anything out
Okay, so I have this project, right? Its got two primary public functions, one of them is defined in foo.bar namespace, the other is defined in foo.baz namespace, but I want users of this library to only need to require them from foo.core what do i do?
the following does not seem to work:
(ns foo.core (:require [foo.bar :refer [func1]][foo.baz :refer [func2]]))
yeah, that doesnāt do what youāre trying to do - it just func1 and func2 to be understood when in the namespace foo.core
some people use potemkin to import vars for things like this
I personally donāt like that - I would define them in the namespace you want
but itās a matter of taste I suppose
Yeah. I'm from python, where you build logical units of functionality in separate modules, then you forward the api to the parent package
Clojure doesnāt really favor encapsulation anywhere :)
haha, yeah seems that way! I guess I'll just redef them. Not a huge deal either way. Thanks for the input, Alex. You are, as always, the man.
āencapsulation of information is follyā - http://clojure.org/reference/datatypes - thatās a little different context but gives an idea
Thats a departure from my ingrained beliefs, I had no idea it was a contested concept. I'm super excited to learn more
I guess it makes sense in the context of Rich's big effort (which you are a big part of, I hear @alexmiller) to reduce code's focus on aggregate data
wow, man, I cant even... like, clojure core uses defn- and private methods. What is the difference between private methods and encapsulating data? What are the criteria for putting any information anywhere if not by logical separation?
even private functions can be found and invoked
I treat them as more like guides to use
they can be, but they are still /marked/ as private. whats the difference between using defn- as a guide and using namespaces as a guide?
they are both tools to convey intent
the idea (with data at least) is that data is just data. when itās immutable, there is no ādangerā about letting a consumer see that data and even manipulate it (because you donāt affect the original)
instead of wrapping things, just make them as directly observable and manipulable as possible
I think the always-read capability of stateful constructs like atoms, vars, agents, refs in similar way
I see, I think the confusion is that perhaps you thought I wanted things forwarded into core in order to obfuscate the dependent libraries, and only expose the things I wanted people to play with
and to some degree vars in a ns as well - if they are different, Iād say thatās not because they are functions, but because vars are stateful
thatās how I read it, yes
yeah, I think thatās a non-goal personally
requiring stuff is fine and tells users where to find the things they use
the problem with these forwarding kinds of vars is they foil helpers like doc
and source
and confuse IDE tooling
well, thatās my opinion, but opinions differ among people I respect :)
I mean, I'm pretty well on board. Organization is good, but encapsulation (data hiding) is bad.
I think I wrote a post about levels of hiding somewhere
the corollary to the above might be "and dont build in shortcuts to circumvent your organization, it breaks things and gains nothing"
I love this, man. David Hume would be so pumped about the direction programming is taking.
canāt find the blog post, maybe itās in Clojure Applied
@idiomancy When I got started with Clojure (back in 2010), I carried over a very OOP mindset so I not only used defn-
"religiously" but I also tended to have a namespace mything.foo
for the "API" and mything.foo.core
for the "implementation" (the latter had to have public functions so the API ns could require them). Iāve pretty much moved away from private functions completely now and I no longer try to second guess users of my namespaces by trying "hide" the implementation in another namespace.
Now I try hard to have namespaces that all actually mean something and could all be reasonably used by client code, and I try to make everything public (unless there really is a good reason not to).
I do still tend to make data private and expose it via a public function but thatās mostly for consistency of the API ("everything is a function").
(although thereās an argument that data that is a hash map could be directly exposed "as if" it were a function)
I think old beliefs of mine die at a rate of multiple per week since I started doing clojure professionally instead of just as a hobby
It can be very hard to let go of OOP thinking. For most devs thatās what theyāre taught out of the gate and itās how nearly all mainstream languages work. Plus itās been the mainstream way of thinking for about three decades now.
I really like clojure's brand of opinonation. After some thought, I end up agreeing with pretty much all of it, with varying speeds of adoption. The only problem is that sometimes the reasoning is only kind of alluded to until you find The Blog Post, or The Podcast that discusses it
(I was lucky, I did some FP way, way back before I even learned OOPā¦ but Iāve been doing OOP professionally now since ā92 so Iām still unlearning some deeply ingrained bad habits!)
and pretty much the only one who knows where they are is alexmiller, and so he gets stuck directing people to them!
itās like, literally, my job :)
Well I co-wrote a book
And I'm doing a new edit of Programming Clojure, Stu's book