This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2015-11-12
Channels
- # admin-announcements (3)
- # beginners (13)
- # boot (52)
- # cbus (1)
- # cider (13)
- # cljs-dev (70)
- # cljsjs (16)
- # cljsrn (124)
- # clojure (129)
- # clojure-austin (3)
- # clojure-boston (2)
- # clojure-russia (238)
- # clojure-sg (3)
- # clojurescript (119)
- # cursive (18)
- # datomic (22)
- # editors-rus (2)
- # events (1)
- # hoplon (160)
- # jobs (1)
- # jobs-rus (8)
- # ldnclj (31)
- # ldnproclodo (1)
- # lein-figwheel (4)
- # leiningen (8)
- # off-topic (3)
- # om (335)
- # onyx (29)
- # re-frame (15)
- # reagent (12)
- # robots (1)
- # yada (19)
(I have a function that only makes sense to be called with a byte, and I wanted to slap a {:pre [(byte? b)]}
assertion on it, but discovered that byte?
does not exist.)
@johanatan: thanks, that could work too, although would have to be (<= Byte/MIN_VALUE b Byte/MAX_VALUE)
I think...
Is there any way to copy all project dependencies to some folder with lein? I want to package project but I don’t want to produce uberjar. So I’m thinking of moving all deps jars to some folder and package it.
@kharus, you could use my script http://www.nowprovision.com/easy-access-to-dependency-source-code--2 this will put them in a depref directory then just rsync -av depref/ src/
@kharus: You can use the lein-libdir plugin or just use the :local-repo
function, which is probably better if you want to run your lein project using those deps.
@kharus actually thinking about my script won't work for this as its only first level dependencies that are pulled out, follow @cfleming suggestions
I would like to create a solution, where I connect a frontend app, using javascript to a clojure app over websockets. I need a way of authorization and think pubsub fullfills my needs. Which solution would you prefer? - clj-wamp, which is currently only supporting wamp v1 - rabbitmq but the websockets support isn’t available for the langohr package - redis, where I don’t know much about
I have to check the client against an database, to prove its legibility. after that, the connection should be shown in the backend application. Only when the connection is choosen within the backend app, the real communication should start. I have multiple backend clients which has to get only shown frontend clients who called the frontend app over that specific account.
Maybe there are other ways, which I doesn’t had considered yet. But the Wamp approach suites my needs at most.
So I've been reading Clojure Applied and there's this section on maps vs records right at the start. We talked about this with a colleague who has been writing Clojure professionally for longer than I have (only ~6 months in my case) and his position seems to be 'use maps everywhere, don't bother with records unless you have protocols you want to extend them with'. I'm not so sure on this. I kind of like having an entry point into a 'component' - be it a namespace, web service or whatever - which accepts a map, then turns it into a record and passes that around. Related to that is the matter of type hinting - when I do have a record does it make any sense to provide type hints in function signatures that accept a record as their argument? Or is there no net benefit to doing that/it's not idiomatic?
there is no benefit to doing so, so I don't usually do that
Thanks @alexmiller - do you also prefer to pass maps instead of records to represent program data, even if it's internal stuff?
well I'm the author of Clojure Applied, so those are my opinions :)
it really depends on what I'm doing
for domain data that is used internally, I think there are many benefits to using records over maps
What I like most about records is that they are self-documenting. I find trying to glean the structure of a map from the function call chain (as different functions in the chain may access different parts of it) unnecessarily difficult.
for the case of using a data container (not information entities) then maps are probably better
and if I'm interacting with external stuff, I prefer to commit only to maps
This is an internal domain data container I'm talking about, but it's also mostly being used in just one namespace. Thanks!
What’s the best way to call a function with signature (fn [& {:as opts}])
when you have the opts as a map?
Best I found is (apply x (apply concat opts))
which is nasty
@ordnungswidrig: (apply x (mapcat identity opts))
is probably just as nasty? Maybe there’s a mapply
in a utility library you’re using
@martinklepsch: any apply->
which be a good thing: (apply->> {:a 1 :b 2} concat x)
@martinklepsch: replacing (->> {:a 1 :b 2} (apply concat) (apply x))
Hi! Weird question, after firing up a project after a week (without changes!) lein deps
suddenly wants to retrieve [joda-time 2.9.1]
which as far as I can tell, doesn't exist, and it predictably fails to find it
does anybody know how to do something similar to lein deps :tree
without lein trying to retrieve the deps first?
Has anybody seen an error like this before? I get it after bringing in cheshire:
(require '[cheshire.core :as ches])
CompilerException java.lang.IllegalAccessError: tag does not exist, compiling:(cheshire/generate_seq.clj:1:1)
@jr Hah, got it. I had updated leiningen, just not in project.clj. That seems to have done the trick
I am writing a leiningen plugin for managing “aspects” of a project (note: terminology might be really bad - this is why I’m posting here). An “aspect” is a collection of dependencies, file templates, and perhaps some migration code.
I wish there was something like clj-http that's async AND supports proxies. Such an animal doesn't exist, so I'm stuck with sync 😕
I think this is a good idea, but I’m having trouble coming up with a good name, or the one-line description.
@jstew Hrmm… to me, that implies that it can be compiled or run separately. Example “aspects” I have so far are “midje”, “logging”, “config-management”, and one for our internal documentation requirements.
should be super easy to add: http://download.eclipse.org/jetty/9.3.5.v20151012/apidocs/org/eclipse/jetty/client/HttpClient.html#getProxyConfiguration-- https://github.com/mpenet/jet/blob/master/src/clj/qbits/jet/client/http.clj#L174
Hi! Does anyone uses internalization in clojurescript, any experience with "com.taoensso/tower" or any other library. Thanks.
@jstew: this is what we use: https://github.com/cch1/http.async.client -- a coworker and I recently took over maintaining it
for example: connect from a non-Clojure technology and send expressions, receive results, deserialize to whatever you're programming in (Ruby, etc)?
i think it’s just a socket server, on top of which a nrepl handler has been provided. but it’s still just a socket, with which you can do anything you please
what do you get back from the socket, when you eval "(+ 1 2 3)", only "6" or more information? sorry, didn't try it yet
Someone asked how to embed Clojure in a Ruby application. I thought this could work.
The socket-repl is lower-level than something like nREPL. You specify the function that evaluates things, so you can control what it does and how it returns things.
The provided socket repl works on text streams
But the socket server is separate from the repl - you can make your own repl that communicates with any protocol you want
I've got a really simple think I thought would be doing logging like this:
(go-loop []
(println (<! ch-recv))
(recur))
I've had a problem before when things were logged three times... turned out to be nrepl + timbre problem.
@jstew: Have you considered Aleph?
@mitchelkuijpers: Yes, and it appears as there are no docs pertaining to being able to configure a proxy during runtime, but according to a github issue it may be possible.
I may end up having to submit patches somewhere. Not a big deal, just a little extra work
Yeah the docs are a bit lacking unfortunately, haven’t tried configuring a proxy to be honest. But you get basically the same api als clj-http
weavejester: would you accept a patch for https://github.com/weavejester/hiccup/issues/108 ?
sablono (hiccup for CLJS) already supports it, and I’d like to unify some .clj & .cljs code
I'm slightly puzzled by something, I have something in the repl that's adding meta data to things (maps, vectors, etc) that's causing problems in another part of my app that has to deal with these objects. The metadata is basic file things, like the following for one of the maps:
{:file file:/Users/dan/repos/projects/company/mvp/src/clj/company/api/post.clj, :line 182, :column 20, :end-line 186, :end-column 36}
Does anyone recognise this? Or already know where it might be coming from?
No, it's just normal namespaces in a file
I don't see it when I run the app outside of the repl though, only when I open the repl port and connect to the running app
No, the problem that I'm having is that the objects (maps, vectors, etc) are being sent to redis through Carmine, which encodes the data including meta data
Which then leads to a point where the objects can be identical, but the encoding in redis is not
It's only in development that I see this, I'm running the app through "lein repl" with a :repl-options {:init ...}
in the project file that starts the app running. At this point everything seems ok. Then I connect emacs/cider to the repl port and it starts adding the meta data
I want to use prismatic/schema for data coercion but it throws disallowed-key
errors for the keys that are not described in a coercer schema. I want it just to ignore them. Has somebody faced the same issue? What is the reason for such a behavior? I can't really understand why it's so strict about this.
@pshk4r: been there https://groups.google.com/forum/#!topic/prismatic-plumbing/lLCEcSh4cpw
@val_waeselynck: thanks. the thing is: I don't want to drop undescribed keys, I want it to not to coerce them. See, I receive a lot of fields, like 20 for example, all of them in string format obviously. And only 3 of them should not be strings but numbers or whatever. So instead of describing all 20, I would like to just ask coerce fields :money, :year, :age
and leave everything else as it is. At the moment, schema expects me to describe all the 20 fields and I see no logic here.
@pshk4r: something like {:money Int, :year Int, :age Int, Keyword Any}
maybe ?
or {:money Int, :year Int, :age Int, Keyword Str}
@pshk4r: you're welcome
@danmidwood Weird. I don’t know what the problem is, but I have ideas on how to isolate it - binary chop on nrepl middleware after trying a different nrepl client to ensure that it isn’t CIDER’s doing.