Fork me on GitHub

Hello,I want to know is there any useful libs for clojure operating file of binary and text??


@steiner3044 The idiomatic approach would be to use interop and rely on the Java I/O libraries.


I knew why, but I don’t remember. Why spec/assert doesn’t throw exception by default and this is solved by

(s/check-asserts true)
? I am thinking if I am going to use assert in correct way

Alex Miller (Clojure team)13:03:08

Assertions are a dev time feature, off by default


But at the same time, the regular assert is turned on by default, isn't it?


also I found different data from assert and explain-data


#:clojure.spec.alpha{:problems ({:path [:shop/uuid],
                                 :pred clojure.core/uuid?,
                                 :val "999",
                                 :via [:shop/uuid],
                                 :in [:shop/uuid]}),
                     :spec :api.shops.spec/shop,
                     :value #:shop{:uuid "999"},
                     :failure :assertion-failed}
#:clojure.spec.alpha{:problems ({:path [:shop/uuid],
                                 :pred clojure.core/uuid?,
                                 :val "999",
                                 :via [:api.shops.spec/shop :shop/uuid],
                                 :in [:shop/uuid]}),
                     :spec :api.shops.spec/shop,
                     :value #:shop{:uuid "999"}}


    (s/explain-data ::s-shop/shop {:shop/uuid "999"})
    (s/assert ::s-shop/shop {:shop/uuid "999"})
    (catch Exception e
      (ex-data e))))


it always has 1 :via less


so for direct check it has [] instead of [:shop/uuid]


very not consistent

Nikolas Pafitis16:03:07

Hey guys, can i use datomic-free as a persistent database( Preferably over mysql) or is it available only as an in-memory database and i have to get the Starter edition in order to use persistent db?


You may want to try #datomic


hello everybody!


i'm developing an http proxy (between two services). which library/libraries would you recommend for evented io? i searched around and it looks like aleph is almost the only way to go..

Renzo Tomlinson22:03:33

anyone run into trouble when trying to post to an Incoming Slackhook? I can curl successfully with the code snippet they provide but I'm unable to make the same request using the clj-http library. I keep getting a 400 Bad Request. Double and triple-checked my url and that the headers and the json body are correct. I have no idea at this point but I'm probably missing something obvious. Will post some code

Renzo Tomlinson22:03:29

curl -X POST -v --http1.1 -H 'Content-type: application/json' --data '{"text":"Hello, World!"}' works fine

Renzo Tomlinson22:03:53

(defn alert
  (client/post slackhook
                :accept "*/*"
                :content-type :json
                :body "{\"json\": \"input\"}" ;(ch/generate-string {:hello "world"})
                :debug true
i've tried setting the headers explicitly. the body is hardcoded right now because i just want to make sure its working. no dice

Renzo Tomlinson22:03:51

400 Bad Request error is the response I keep getting

Renzo Tomlinson22:03:20

ah, i'm oblivious. there needs to be a "text" key in the body

dpsutton22:03:24 shows a different way to set the content type header

Renzo Tomlinson22:03:35

thanks, @U11BV7MTK . i tried both ways of setting the header and just confirmed that the way I was setting still works. My mistake was that my payload wasn't following the correct pattern. Something I overlooked but also probably could have been a little more explicit in the documentation


how to "reify" abstract classes?


You use proxy to instantiate abstract classes.


It's pretty similar.


But it can instantiate non-interfaces (such as abstract classes).


one thing to be careful of is proxy-super is the only way to invoke superclass methods, and it is not thread safe


if two threads call proxy-super on the same proxy concurrently, the proxy itself can be replaced by an auto-generated instance of the superclass, which as you might expect, breaks everything