Fork me on GitHub
#beginners
<
2017-07-17
>
cjhowe00:07:39

oh dang, doto is amazing!

lepistane18:07:44

could pdf be opened as xml ? with tags and all?

noisesmith18:07:11

probably, but we also have libraries that operate directly on pdf

lepistane18:07:03

i need to extract some text from pdf so i wanna see how xml looks maybe it could be easier with xpath/xquery than to parse text

lepistane18:07:15

how would one go about it ? pdf to xml?

noisesmith18:07:39

right - you could also use that jar from clojure if the command line app is not flexible enough for what you need

ghadi18:07:29

@lepistane https://www.pdfdata.io/ this is a clojure service from @cemerick

derwolfe21:07:37

Is there an OSS clojure project that is generally held out as a good project for beginners with the language to look at for idioms, etc?

alice21:07:29

Can anyone help me understand how to split the middleware for my site and api up in Compojure

alice21:07:32

I'm totally lost

alice21:07:45

but I need to split the middleware before I can go anywhere

alice21:07:11

wrap-routes is definitely involved but I don't think I've used it correctly

mobileink22:07:26

@alice: got an example?

alice22:07:51

Well ATM the issue has changed just a tad

alice22:07:01

I'm sure it's sttill more or less tthe same domain, but now I'm wrestling CORS

alice22:07:19

I've just been throwing things into, and taking things out of both randomly praying something will change

alice22:07:44

@mobileink

mobileink22:07:45

sorry, i can't read that on my screen, but i see lots of wrap-routes, i believe you can put then all together and use just one, but i'm going from memory. (fyi can use 3 backticks to format code)

mobileink22:07:24

what problem symptoms are you seeing?

alice22:07:41

2:6001/front-page:1 POST  500 (Server Error)
(index):1 XMLHttpRequest cannot load . No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin '' is therefore not allowed access. The response had HTTP status code 500.

alice22:07:59

Basically, chrome keeps yelling at me in the console

alice22:07:02

and my API is unusable

dees22:07:54

500 means the server app crashed in some form or another, so you should check the server logs to find out what went wrong there, and troubleshoot from there

dees22:07:42

i'm still just 'hello, world' level with clojure so might not be much help with the syntax particulars but can maybe help narrow things down

mobileink22:07:58

afraid i can't help much with CORS other than to observe you've got different ports.

alice22:07:34

Different ports is happening right now, yeah

alice22:07:56

My workflow has CLJS and CLJ separate until the production build

alice22:07:01

Should probably fix that

mobileink22:07:05

google "cors ports". evidently the port matters, but i don't know the details.

mobileink22:07:46

what's your dev setup? are you running separate clj and cljs repls?

dees22:07:49

yeah port is part of the host, as far as browser is considered

dees22:07:56

that doesn't explain the 500 error though

mobileink22:07:06

why not? cors violation = 500? (i.e. sorry cannot serve that sucker)

dees22:07:27

500 response from the server means "internal server error" meaning the server itself crashed, nothing browser-facing

dees22:07:43

cors violation is a browser-side thing

dees22:07:17

the browser's saying "hey you can't have this because the server didn't say you can, because you're crossing origin boundaries and we only do that if the server says it's ok"

dees22:07:31

"by the way, what the server said was 500"

dees22:07:54

the cors thing may still need to be addressed but the server code is still broken

dees22:07:20

4xx errors are "something wrong with your request"

dees22:07:25

5xx errors are "something wrong on our end" (the server side)

mobileink23:07:15

hmm, ok but then why: " No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:3449' is therefore not allowed access. The response had HTTP status code 500."

mobileink23:07:24

if the url violates cors, and that's a browser thing, why is it sent to the server?

mobileink23:07:27

put differently: if server says 500, how does the browser know it's a cors problem?

dees23:07:48

the browser checks the response for the header

dees23:07:58

the header is set by the server (or not) and the browser will respect it if it's set

dees23:07:24

recently browsers began enforcing that policy more strictly, and if the header is totally un-set they will block the response