Fork me on GitHub
#clojure
<
2016-02-17
>
hlship04:02:30

In reference to this potential bug: https://github.com/weavejester/medley/issues/13#issuecomment-184967348 ... what operations on a collection are supposed to maintain the metadata, and which are not?

jimmy10:02:22

hi guys how do I get the value from a key with namespace attached to it. For example :interior.category/floorings I want to get floorings

jimmy10:02:26

thanks @robert-stuttaford , didn't know that name would strip out the ns part in keyword too.

slotkenov13:02:14

I can’t get compojure-api to read the request body. The body remains nil. I have `(POST "/" [] :return SignUp :body [data (describe SignUp "The sign up data")] :summary "Saves sign up data" (ok data))`

slotkenov13:02:11

data remains nil

juhoteperi13:02:34

@slotkenov: How are you sending the request? What type is your request body?

slotkenov13:02:01

It’s a POST request with JSON data

joost-diepenmaat13:02:31

what’s the content type of the request?

slotkenov13:02:13

application/json

joost-diepenmaat13:02:19

yeah that should work...

juhoteperi13:02:55

@slotkenov: Are you using 1.0.0-RC? Have you checked the route is working correctly (println or something)?

slotkenov13:02:09

RC2 I believe yeah

slotkenov13:02:53

I’m using schema and the response I get is:

slotkenov13:02:57

{ "errors": "(not (map? nil))" }

slotkenov13:02:03

So I know it’s getting there

hjrnunes13:02:54

what about the request? Is it as it should be?

hjrnunes13:02:25

do you actually have anything in the body? 😛

hjrnunes13:02:22

Schema seems to think you don’t, assuming you get a 400 back

slotkenov13:02:31

I get a 400 back indeed. Chrome dev tools, however, tells me I’m sending a nice JSON body

ikitommi13:02:06

@slotkenov: tested with the sample app lein new compojure-api signup, updated to 1.0.0-RC2 & changed the line 33 to :body [pizza (describe Pizza "pizza”)]. Seems to be the same case and works as expected when tested from the swagger-ui.

slotkenov13:02:09

Yeah, just cloned the compojure-api repo and ran the examples; works fine

slotkenov13:02:23

Now I have to figure out what the difference is with my project

ikitommi13:02:35

could there be multiple json-middlewares mounted? the api function wraps ring-middleware-format already.

slotkenov13:02:05

uh oh, might be...

minimal13:02:30

I had the same problem when I tried to bolt on compojure-api onto and app with already defined middleware

slotkenov13:02:09

I have this atm:

slotkenov13:02:10

(defn wrap-middleware [handler] (-> handler (wrap-defaults (assoc-in site-defaults [:security :anti-forgery] false)) wrap-json-response wrap-json-params wrap-exceptions wrap-reload))

slotkenov13:02:54

Yes that was it simple_smile

slotkenov13:02:13

removed the wrap-json-response and -params

ikitommi13:02:45

great. I would be nice if we could figure out the double-wrapping somehow in ring-middleware-format.

pesterhazy15:02:15

People, we need a prisamtic schema cheat sheet!

edlich17:02:43

edlich from :clojureD says hi! (4 the first time here)

mikeholmesuk17:02:40

@edlich: the clarango guy? 👋

edlich17:02:56

yes but I gave the driver away 😞 no time)

mikeholmesuk17:02:56

(sorry, one of them)

edlich17:02:34

great that you you this DB

mikeholmesuk17:02:54

Indeed. I’m a contributor to Clarango as well.

edlich17:02:12

Now I see! Great to meet u here!

roberto18:02:07

has anyone run lein with xvfb?

roberto18:02:31

I want to start a lein repl that will use selenium to do some tests, but need to use xvfb in the server.

roberto18:02:46

but unfortunately, xvfb fails to run lein

roberto18:02:05

xvfb is working btw, I can launch the x11-apps with it

echristopherson18:02:29

huh? xvfb has very little to do with lein

echristopherson18:02:50

I assume you have an xterm or something running in xvfb, and that has lein running in it

echristopherson18:02:28

what does the terminal say in that case?

roberto18:02:32

the only difference b/w xvfb-run xclock and xvfb lein test is lein

roberto18:02:39

that is why I assumed the issue was lein

echristopherson18:02:52

you're missing a -run

roberto18:02:58

yeah, sorry

roberto18:02:09

I have the -run plus some other arguments

roberto18:02:13

too lazy to type it all out

echristopherson18:02:11

it would help to see the output

roberto18:02:28

xvfb-run: error: Xvfb failed to start

roberto18:02:38

not that helpful

echristopherson18:02:08

that's all? but xclock works?

roberto18:02:14

yeah, that is all.

roberto18:02:17

but xclock works

roberto18:02:24

any x11-app works

echristopherson18:02:38

try it with -e /path/to/errorlog

echristopherson18:02:14

I wonder if it's because lein is a script

echristopherson18:02:17

or not in the path

roberto18:02:20

hehehe, can’t print out the entire output

roberto18:02:34

but complains about Unrecognized option: 0

roberto18:02:49

xvfb-run --server-args="$DISPLAY $GEOMETRY" -e xvfb.err lein repl

roberto18:02:08

used the same command that runs in our docker container

roberto18:02:21

thanks for the tip on logging to a file

jonahbenton18:02:08

@roberto: try -a to xvfb-run to have it pick the X display automaticaly

echristopherson18:02:09

what is the value of $GEOMETRY?

roberto18:02:34

800x600x600

flyboarder19:02:06

Any idea why my ring app will not serve png’s? getting 404??

dottedmag19:02:36

@echristopherson: X11 has finally got the support for 3D-displays, apparently.

jakehow20:02:30

Hey all, can anyone point me in the right direction of how to attach a custom ring handler to my figwheel setup for a re-frame app? Details here-> https://github.com/bhauman/lein-figwheel/issues/344

shaun-mahood22:02:57

Not sure if I'm doing this the best way or not, but I'm pulling in data from SQL using clojure.java.jdbc, and when I try to divide the numbers from the SQL data pull I get the error message

CompilerException java.lang.ArithmeticException: Non-terminating decimal expansion; no exact representable decimal result.
I'm just converting the values to double before dividing them now, is that the best way of dealing with this or am I missing something?

shaun-mahood22:02:47

@val_waeselynck: Putting in the values, it ends up being essentially (/ 1234M 12345678M), which gives me the error, and (/ (double 1234M) (double 12345678M)) to get it to give me back the decimal I'm looking for

jonahbenton23:02:13

hey @shaun-mahood : use with-precision, e.g. (with-precision 10 (/ 1234M 123456789M))

george.w.singer23:02:11

What is meant by the "signature" of a clojure function? I've seen this term thrown around some, and it seems to be used to reference the structure/type of the input arguments of a function (excluding the functions return value). Is this correct?