workspace
stringclasses
4 values
channel
stringclasses
4 values
text
stringlengths
1
3.93k
ts
stringlengths
26
26
user
stringlengths
2
11
clojurians
clojure
your code seems fine to me
2017-12-01T10:40:25.000305
Guillermo
clojurians
clojure
Not good for readily understandable code. :slightly_smiling_face:
2017-12-01T10:40:43.000170
Dirk
clojurians
clojure
Seems fine to me too with update.
2017-12-01T10:42:24.000560
Johana
clojurians
clojure
Maybe that’s the problem with Specter too.
2017-12-01T10:42:44.000521
Johana
clojurians
clojure
Or Clojure. :stuck_out_tongue:
2017-12-01T10:43:14.000349
Johana
clojurians
clojure
<@Altagracia> with specter: `(setval [:a ALL :deleteme] NONE data)`
2017-12-01T10:50:59.000426
Owen
clojurians
clojure
Ah, <@Sonny> replied: it’s probably about holding the head
2017-12-01T10:52:16.000475
Johana
clojurians
clojure
Anyone here familiar with a javalib which compresses animated gifs, similiar to what Guetzli does to jpgs?
2017-12-01T11:10:46.000560
Sherrie
clojurians
clojure
(clojure libs are valid too, but we're more of a wrapping kinda people)
2017-12-01T11:38:39.000329
Sherrie
clojurians
clojure
probably anything you find would be a wrapper.
2017-12-01T11:40:20.000526
Guillermo
clojurians
clojure
I don't know of anything, but if there is a C library that does what you need, it's straightforward to wrap C, and pretty pleasant using JNR-FFI
2017-12-01T11:40:55.000004
Guillermo
clojurians
clojure
you don't have to write any C glue manually
2017-12-01T11:41:07.000553
Guillermo
clojurians
clojure
Name it
2017-12-01T11:43:16.000851
Sherrie
clojurians
clojure
or simply avoiding calling first on anything for cases where that realizes things
2017-12-01T11:53:33.000529
Sonny
clojurians
clojure
What do you do in clojure spec to generate sample `(gen/sample (s/gen ::foo))` with unique value like `code`. Do you make own function for code generation or is some simpler way?
2017-12-01T12:15:30.000711
Gladys
clojurians
clojure
you can use `s/with-gen` to supply a custom generator when you define a spec
2017-12-01T12:28:47.000764
Sonny
clojurians
clojure
or supply an override generator function when a spec is used in places like s/exercise, stest/instrument, etc
2017-12-01T12:29:10.000257
Sonny
clojurians
clojure
yes, i was thinking about `s/with-gen`. Not sure what you mean by override generator. Probably i don’t know about something :slightly_smiling_face:
2017-12-01T12:31:51.000273
Gladys
clojurians
clojure
functions like s/exercise take a map of spec name to generator functions that can be used to override the generator for a spec just in the context of that call
2017-12-01T12:36:57.000234
Sonny
clojurians
clojure
oh i see some things changed in the doc from last time when i saw it, thx
2017-12-01T12:38:47.000035
Gladys
clojurians
clojure
```clojure user=&gt; (s/def ::i int?) :user/i user=&gt; (s/exercise ::i) ([0 0] [-1 -1] [1 1] [-1 -1] [-6 -6] [-6 -6] [-4 -4] [2 2] [-2 -2] [-56 -56]) user=&gt; (s/exercise ::i 10 {::i (fn [] (s/gen #{5 10}))}) ([5 5] [5 5] [10 10] [5 5] [5 5] [10 10] [10 10] [5 5] [5 5] [5 5])```
2017-12-01T12:39:59.000433
Sonny
clojurians
clojure
the docs have been out of date for a very long time but I refreshed them last week
2017-12-01T12:40:16.000427
Sonny
clojurians
clojure
In Stuart Halloway's talk Simplicity Ain't easy, at the end he mentioned that there is some interesting discussion about design foundations other than simplicity. I can't seem to find any more information on it. Does anybody know of any discussion on that?
2017-12-01T15:15:38.000100
Giovanni
clojurians
clojure
<@Giovanni> the three ones from Rich and Stu are power, focus, and simplicity
2017-12-01T16:04:44.000315
Sonny
clojurians
clojure
I think Stu has done talks on two of those (see also <https://www.youtube.com/watch?v=KZ8u_sWT9Ls> )
2017-12-01T16:05:39.000264
Sonny
clojurians
clojure
<@Sonny> Thanks much!
2017-12-01T16:11:48.000226
Giovanni
clojurians
clojure
Maybe some day he will complete the trilogy and then we can get into the prequels
2017-12-01T16:16:38.000164
Sonny
clojurians
clojure
just wait, he’ll use CGI to add realistic concrete inheritence when he re-releases the original
2017-12-01T16:17:22.000217
Margaret
clojurians
clojure
#rich_shot_first
2017-12-01T16:20:34.000468
Sonny
clojurians
clojure
If you are directly indexing `:a` you might not mind numerically indexing its array using medley's `dissoc-in`:
2017-12-01T17:20:06.000234
Branda
clojurians
clojure
```(let [d {:a [{:b 1 :deleteme "foo"}]}] (dissoc-in d [:a 0 :deleteme]))```
2017-12-01T17:20:11.000250
Branda
clojurians
clojure
But if you have more than one element in `:a` I would just inline the lambda instead and use update as bork suggests: ```(let [d {:a [{:b 1 :deleteme "foo"}]}] (update d :a (fn [m] (mapv #(dissoc % :deleteme) m))))```
2017-12-01T17:30:51.000022
Branda
clojurians
clojure
I'm getting an error when using clj with a deps.edn including a :local/root. ```{:deps {org.clojure/java.jdbc {:mvn/version "0.6.2-alpha2"} oracle/driver {:local/root "./ojdbc7.jar"}}} ``` It says ```Error building classpath. Wrong number of args (4) passed to: local/eval398/fn--400```
2017-12-01T23:54:21.000016
Wendi
clojurians
clojure
Based on "Refer to a specific jar on disk" in <https://clojure.org/guides/deps_and_cli>
2017-12-01T23:54:47.000029
Wendi
clojurians
clojure
I also tried full path etc.
2017-12-01T23:55:04.000044
Wendi
clojurians
clojure
(Also interested in how to debug stuff like this.)
2017-12-01T23:55:53.000047
Wendi
clojurians
clojure
is there a simple way to do a https supporting web server in java? it feels silly that my clojure code is all doing http/ws, then I am running some node.js wrapper to tunnel https -&gt; http, wss -&gt; ws
2017-12-02T03:18:05.000040
Berry
clojurians
clojure
Answering my own question in part. `clj -Sverbose` will show details. In my case confirming my brew install wasn't the latest. (not a fix but still useful).
2017-12-02T03:28:33.000060
Wendi
clojurians
clojure
<@Berry> have you seen this? <http://www.luminusweb.net/docs/deployment.md#setting_up_ssl>
2017-12-02T04:28:13.000029
Danyel
clojurians
clojure
I personally just deploy to Elastic Beanstalk, which takes care of SSL and Nginx for me
2017-12-02T04:29:24.000002
Danyel
clojurians
clojure
yeah, AWS makes SSL trivial
2017-12-02T04:48:52.000041
Berry
clojurians
clojure
my situation is: I need this for local, with a self signed cert
2017-12-02T04:49:03.000068
Berry
clojurians
clojure
some auth libs I'm talking to are unhappy unless the host url is ssl, thus, I need ssl even in my dev setup
2017-12-02T04:49:23.000054
Berry
clojurians
clojure
I see, then yes I think Immutant is the way to go: <http://immutant.org/documentation/current/apidoc/guide-web.html#h3374>
2017-12-02T05:17:12.000011
Danyel
clojurians
clojure
i'm a clojure newbie and am trying to learn channels and agents. Did a small tutorial about them here: <https://joaoptrindade.com/tutorial-clojure-agents-and-channels> anyone interested in giving some feedback? see if i understood the concept correctly
2017-12-02T05:22:10.000032
Tisha
clojurians
clojure
Hi. what’s the equivalent in clojure for ```hash_hmac('sha512')```
2017-12-02T05:36:12.000090
Tameka
clojurians
clojure
what is the equivalent in java ? :stuck_out_tongue:
2017-12-02T05:46:49.000068
Marty
clojurians
clojure
Based on that error, it’s probably a bug based on one of the recent refactors. I will take a look. Also btw, this stuff is good for <#C6QH853H8|tools-deps>
2017-12-02T08:50:47.000115
Sonny
clojurians
clojure
yep, had some signature drift. will be fixed in next release.
2017-12-02T09:01:38.000058
Sonny
clojurians
clojure
as a temp workaround, you can probably declare it in paths instead - `:paths ["src" "ojdbc7.jar"]`
2017-12-02T09:02:53.000007
Sonny
clojurians
clojure
that’s not what paths is for, but it should work
2017-12-02T09:03:22.000039
Sonny
clojurians
clojure
buddy includes that sort of thing <https://funcool.github.io/buddy-core/latest/#hmac>
2017-12-02T10:02:21.000107
Leann
clojurians
clojure
there are more reasons to use nginx as a reverse proxy - it has better security and more reliable security updates than most alternatives, and if set up properly can improve performance and balance your load for you
2017-12-02T10:45:11.000039
Margaret
clojurians
clojure
as stupid as it sounds, neither performance nor load balancing matters for production, I'm using AWS for SSL this is literally for local, where there is just one user (me), and I need SSL because some auth libraries I'm playing with barf if my webpage isn't hosted in SSL
2017-12-02T13:03:08.000057
Berry
clojurians
clojure
oh - aws might be using nginx for your ssl for all I know (I know that is how it works for our app at least)
2017-12-02T13:06:20.000014
Margaret
clojurians
clojure
when creating a restful api using ring + compojure, do I have to specify `{:body ..}` for every single handler? Is it not possible to make this automatic
2017-12-02T15:24:51.000031
Tameka
clojurians
clojure
?
2017-12-02T15:24:51.000124
Tameka
clojurians
clojure
this is what I mean: ``` (defn index-page [req] {:body {:data [{:id 1 :name "Some name"}]}}) (defroutes app-routes (GET "/" _ index-page)) ```
2017-12-02T15:26:11.000100
Tameka
clojurians
clojure
Thanks.
2017-12-02T17:23:22.000031
Wendi
clojurians
clojure
how can I make an http call in ring and return the result to the client? when I do this ``` (defn get-orders [req] (let [{:keys [sig uri]} (api-signature :get-orders)] (client/get uri {:async? true} (fn [response] {:body "something"}) (fn [exception] {:body "error"})))) ```
2017-12-02T17:49:22.000086
Tameka
clojurians
clojure
it gives me this error ``` No implementation of method: :render of protocol: #'compojure.response/Renderable found for class: org.apache.http.impl.nio.client.FutureWrapper ```
2017-12-02T17:49:46.000072
Tameka
clojurians
clojure
<@Tameka> you're making an async `get` call inside a _synchronous_ handler.
2017-12-02T18:20:19.000061
Daniell
clojurians
clojure
You could use Ring's async handler machinery -- or force a dereference on the `get` call -- or just do a synchronous `get` instead.
2017-12-02T18:21:15.000068
Daniell
clojurians
clojure
thanks <@Daniell>. Actually I removed `:async? true` along with callbacks and it works fine now
2017-12-02T18:27:08.000023
Tameka
clojurians
clojure
I just don’t get what’s the point of async in here :smile:
2017-12-02T18:28:12.000094
Tameka
clojurians
clojure
is it there just so it doesn’t block IO?
2017-12-02T18:28:40.000054
Tameka
clojurians
clojure
If you were using Ring's async handlers, it would make sense to use the async version of `get` -- and, yes, async would not block while the HTTP call is processed.
2017-12-02T18:31:50.000063
Daniell
clojurians
clojure
I’ve created a new project using `chestnut` template and when I do `lein install`, it throws this error: ```Cannot run program "sassc": error=2, No such file or directory``` once I remove this bit from my project.clj it works: ``` :sassc [{:src "src/scss/style.scss" :output-to "resources/public/css/style.css"}] :auto {"sassc" {:file-pattern #"\.(scss)$" :paths ["src/scss"]}} ```
2017-12-03T04:43:34.000063
Tameka
clojurians
clojure
is there something wrong with `sassc`?
2017-12-03T04:43:55.000052
Tameka
clojurians
clojure
`(reduce * (int-array [1 2 3 4]))` &lt;-- why does this code work? what is causing the reduce to be able to handle what I believe to be a JVM object
2017-12-03T05:44:36.000037
Berry
clojurians
clojure
<@Berry> It goes like this: reduce -&gt; coll-reduce -&gt; protocol on type "Object" -&gt; seq the given array -&gt; `ArraySeq_int` -&gt; Faster internal reduce on it.
2017-12-03T06:02:02.000058
Randee
clojurians
clojure
<@Berry> Actually, this is wrong: Check out: ``` (reduce (fn [_ _] (try (throw (Exception.)) (catch Exception ex ex))) 0 (int-array [0 1])) ```
2017-12-03T06:09:24.000025
Randee
clojurians
clojure
It'd would use a faster internal reduce if you seq your array beforehand, it's more than 2x faster with `(reduce ... (seq (int-array ...))`
2017-12-03T06:09:52.000016
Randee
clojurians
clojure
<@Randee> I don't understand what that snippet is supposed to show
2017-12-03T06:26:49.000029
Kareen
clojurians
clojure
<@Kareen> It's just a little hack to see get the stacktrace so I could see how the reduce function is called. With `(seq (int-array ...)` it shows nicely it's called from `ArraySeq_int.reduce`
2017-12-03T06:27:52.000008
Randee
clojurians
clojure
ah ok
2017-12-03T06:28:09.000014
Kareen
clojurians
clojure
nice hack :)
2017-12-03T06:28:27.000093
Kareen
clojurians
clojure
<@Kareen> Do you think `(reduce ... ... some-array)` should also end up in `ArraySeq_int.reduce`? I could create a ticket for it..
2017-12-03T06:29:59.000080
Randee
clojurians
clojure
sure
2017-12-03T06:44:47.000059
Kareen
clojurians
clojure
has anyone ever had a problem with `clj-http` when using `:as :clojure`? i.e. ```(client/get "<http://example.com/foo.clj>" {:as :clojure})``` I’m getting the following in my browser ``` Invalid keyword: .```
2017-12-03T07:13:03.000074
Tameka
clojurians
clojure
and when adding ```[org.clojure/tools.reader "1.1.1"]``` to my deps, CIDER dumps the following ``` WARN: org.clojure/clojure version 1.5.1 requested, but 1.8.0 already on classpath. WARN: org.clojure/tools.reader version 1.1.1 requested, but 1.0.0 already on classpath. Dependencies not loaded due to conflict with previous jars : [[org.clojure/clojure "1.5.1"] [org.clojure/tools.reader "1.1.1"]] ```
2017-12-03T07:13:50.000051
Tameka
clojurians
clojure
<@Tameka> The contents of foo.clj might be up for question
2017-12-03T07:16:22.000050
Jodie
clojurians
clojure
if I do `:as :json` then it works fine
2017-12-03T07:16:50.000050
Tameka
clojurians
clojure
could it be that clojure map just doesn’t like something in there?
2017-12-03T07:17:12.000099
Tameka
clojurians
clojure
<@Tameka> but, valid clojure is not the same as valid json
2017-12-03T07:17:28.000030
Jodie
clojurians
clojure
Are you requesting a clj file, or a json file?
2017-12-03T07:17:41.000061
Jodie
clojurians
clojure
it’s a json response from a server
2017-12-03T07:17:57.000033
Tameka
clojurians
clojure
I thought it would convert automatically, but I guess that’s the issue yes :slightly_smiling_face:
2017-12-03T07:18:15.000057
Tameka
clojurians
clojure
`:as :clojure` is for taking a _clojure string_ and turning it into a data structure.
2017-12-03T07:18:47.000008
Jodie
clojurians
clojure
`:as :json` takes a json string, and turns it into a data structure.
2017-12-03T07:18:59.000011
Jodie
clojurians
clojure
ah gotcha. thanks!
2017-12-03T07:19:11.000020
Tameka
clojurians
clojure
and I’m guessing there’s no way to convert json to clj map, right?
2017-12-03T07:26:03.000073
Tameka
clojurians
clojure
Actually, there is… <https://github.com/clojure/data.json>
2017-12-03T07:27:32.000008
Olen
clojurians
clojure
<@Tameka> can you take a look at this.
2017-12-03T07:27:52.000025
Olen
clojurians
clojure
<@Tameka> Does `:as :json` not do that for you already?
2017-12-03T07:29:04.000059
Jodie
clojurians
clojure
doesn’t seem to be doing so. it returns json string when I do `(:body response)`
2017-12-03T07:29:52.000090
Tameka
clojurians
clojure
<@Tameka> do you have a dependency on cheshire?
2017-12-03T07:32:10.000070
Jodie
clojurians
clojure
as I read in `clj-http` docs, `:as :json` requires `cheshire` lib. and when I add that to my deps, I get ``` [[cheshire "5.8.0"] [tigris "0.1.1"] [com.fasterxml.jackson.core/jackson-core "2.9.0"] [com.fasterxml.jackson.dataformat/jackson-dataformat-cbor "2.9.0"] [com.fasterxml.jackson.dataformat/jackson-dataformat-smile "2.9.0"]] Dependencies not loaded due to conflict with previous jars : [[org.clojure/clojure "1.5.1"]] ```
2017-12-03T07:32:14.000080
Tameka
clojurians
clojure
See <https://github.com/dakrone/clj-http#optional-dependencies>
2017-12-03T07:32:17.000006
Jodie
clojurians
clojure
and then the `clj-http` has that section for `jackson` thingy
2017-12-03T07:32:39.000054
Tameka