Fork me on GitHub
#clojure
<
2017-07-08
>
spieden00:07:02

@bbktsk if you end up having to get lots of data in and out of java beans you might try this: https://github.com/uwcpdx/bean-dip/

mrchance09:07:08

Hi! Can someone give me a hint on how to add error handling to my logic programs? I already asked in #core-logic, but it's all tumbleweeds and cricket noises there... I'd like to receive a little more information than () when my program fails to produce a result 🙂 I was thinking about a fall through case that unifies an error parameter to something meaningful, but I am not sure if that is a good idea or even how to do it well

spaszek15:07:19

is anyone eager to help me? pretty new to clojure so the question is pretty basic 🙂

hmaurer15:07:06

@spaszek I am new to clojure too but that might be even better as I am familiar with some of the beginner’s struggles. Shoot 🙂

kurt-o-sys16:07:10

Transit seems to be the way to go for transmitting clj datastructures. ... but it seems to be work in progress: > NOTE: Transit is a work in progress and may evolve based on feedback. As a result, while Transit is a great option for transferring data between applications, it should not yet be used for storing data durably over time. This recommendation will change when the specification is complete. ... and it's been over a year since there was a commit

kurt-o-sys16:07:58

So I wonder: is it stable? Is it still maintained? Is it still wip? ...?

madstap17:07:18

What I understand from that warning is that the details of how it encodes edn as json or messagepack is subject to change, so if you save something to disk today, there's no guarantee that you can read it back with a future version of transit. If you want to transmit data, you're good.

madstap17:07:18

I wouldn't worry about a lack of commits, that probably just means it's stabilized.

kurt-o-sys17:07:31

allright, thx.

kurt-o-sys18:07:43

another transit question: in order to be able to read json data, it seems one has to stringify it first. Here's a function receiving a POST request and handling the request (using express/node.js)

(->> req
                                          .-body
                                          (.stringify js/JSON)
                                          (t/read (t/reader :json))
                                          str)
It feels a bit weird to have to stringify first, but that's how it's supposed to work? (Or am I missing something?)

bfabry18:07:31

that seems wrong

bfabry18:07:58

you're going json->data->json->data there

kurt-o-sys19:07:33

right... my feeling as well, but how to make it work properly?

(->> req
                                          .-body
                                          (t/read (t/reader :json)))
doesn't work - oh, that last str can be omitted, that's just to print it in a readable way.

kurt-o-sys19:07:37

transit does seem to take a json-string, not a json-object, if I'm right.

ajmagnifico20:07:50

So, here’s a question I had over in #beginners about namespace-qualified keywords, if anyone has any thoughts. Thanks. https://clojurians.slack.com/archives/C053AK3F9/p1499543674615216

ajmagnifico20:07:06

Just wondering where they are “tragically underused” and where/why I should be using them.

kurt-o-sys21:07:14

@bfabry found it: express parses json if you add (.use app (.json body-parser)). I changed that line to: (.use app (.text body-parser #js {:type "*/*"})). (I'll have to refine it a little... having type */* doesn't seem a good idea, but at least, it works now.)

joshkh21:07:58

has anyone had success serving '206 partial content' responses with their favourite clojure http server? i'm trying to serve streamable videos (where 206 responses are required), however https://github.com/remvee/ring-partial-content/blob/master/src/ring/middleware/partial_content.clj doesn't seem to respond with an 'Accept-Ranges: bytes' header.

lvh23:07:47

Is there a decent Clojure HTTP client that mimics browser cookie behavior? Aleph doesn’t support cookie stores, it does… something with cookies but there’s no docs so it’s not clear what — clj-http cookie handling is totally broken if the cookies get set on a redirect request

lvh23:07:14

I would like to not have to have a headless browser and instrument it with selenium, but that’s lookling like an increasingly viable option