Fork me on GitHub
#beginners
<
2017-01-01
>
notanon04:01:45

@roelof why don't you post the data you're working with

pwalsh06:01:55

@sveri clojure.spec yep! Thanks for the heads up, I would never have found it so early, and it is extremely useful for what I want to do. Still a bit dense for me to see immediately how to implement all of Table Schema’s type, format, and constraints options, but likely that is a matter of time. From my first reading though I think I'll be able to implementation most of https://github.com/frictionlessdata/jsontableschema-py/tree/master/jsontableschema/types and https://github.com/frictionlessdata/jsontableschema-py/tree/master/jsontableschema/constraints using clojure.spec

pwalsh06:01:48

Does anyone here have experience with JSON Schema ( http://json-schema.org/ )? I use it extensively, including in the lib I’m currently porting to Clojure. I can find several Clojure libs for it ( https://github.com/bigmlcom/closchema https://github.com/metosin/scjsv https://github.com/tatut/json-schema ), but from a quick glance I’m not sure they are mature (some disclaimers, don’t seem actively maintained, etc.). I need a quite mature library as I use JSON Schema to its fullest (`$ref`, oneOf, JSON Pointers, etc.). There is a very mature Java lib for JSON Schema at https://github.com/daveclayton/json-schema-validator but as I’m quite new to Clojure I was hoping to find a Clojure implementation. Can anyone recommend one of the Clojure implementations, or, recommend to wrap the Java implementation?

roelof09:01:53

@notanon : here you have the respons from the external api : https://www.refheap.com/

roelof09:01:34

I think I will have some copies of the specs I have because the specs that I have are from another call to the api and the checks are different. There I only check for the objectNumber where I now have to check the name of the painter , the title and the description of the painting

roelof09:01:15

Another question : Can I "convert" this ::response to artObjects-id:response in specs. or will I break (s/conform .... ) with this change

roelof11:01:12

No, I cannot , when I do this : (s/def artObjects-id:artObject (s/keys :req-un [::objectNumber]))

roelof11:01:39

artObjects-id:artObject cannot be resolved

roelof11:01:57

or I must make for every spec a seperate namespace

sb13:01:13

Hello I created a simple auth with friend but not works..

sb13:01:30

based on tutorial..

sb13:01:53

I got this back. Any idea what is wrong with that?

henriklundahl15:01:24

@sb, on line 70 you have @users, but users is a map. Change to just users.

sb16:01:23

@henriklundahl: thanks, I check it!

neurogoo16:01:39

For some reason I can't connect to localhost addresses on my dev computer anymore so I am using another computer in the same network to view website I am generating. But now I have problem that I can't seem to make figwheel recognize when I have connected to the website. I have tired all sorts of things but nothing has been working

neurogoo16:01:04

It is build on reagent template

roelof16:01:45

@seancorfield with your solution. Do I understand it right that the specs are all in seperate files which haves seperate namespaces ?

sveri16:01:05

@neurogoo I would try to fix that localhost problem first before I make a workaround that introduces new problems that might even have to do with your localhost problem 😉

mingp16:01:01

@neurogoo What happens when you try to access localhost in a web browser?

mingp16:01:12

Do you get the same behavior from 127.0.0.1?

neurogoo17:01:00

I can't believe this....now it does work on localhost....

neurogoo17:01:38

I still would like to get the remote access working for for example when I try to debug with phone, but for some reason now localhost works after I set the websocket url

mingp17:01:11

@neurogoo Looking at your project.clj, looks like you're referencing 192.168.*.*. FYI, that is a local network only IP address assigned by your router, and isn't accessible from outside your local network. That may be part of your issue with your phone. Also, in general, those addresses are pretty unreliable.

neurogoo17:01:59

Ah, yes I am aware of that, but my phone and other computer as using the same wifi so that should not be problem

mingp17:01:40

Also, make sure you're not being blocked by a firewall somewhere.

neurogoo17:01:55

And I can access the website from other computers. Problem is that figwheel tries to use localhost address for some reason to connect back and so it fails

mingp17:01:57

For example, a default Mac OS X install's default firewall config will block almost all incoming traffic.

mingp17:01:12

Oh, hm... That changes things, then.

neurogoo17:01:13

hmmm I should check firewalls

mingp17:01:48

Have you considered https://localtunnel.github.io/www/ just as a sanity check to rule out routing issues?

mingp17:01:13

That's what I usually use when I don't want to deal with the madness that is NAT, firewalls, routing, etc.

neurogoo17:01:24

never heard about this project. Will give it a try 🙂

mingp17:01:53

To be clear, I don't expect it to fix your situation, but I do expect it will let you confirm/refute whether it's a routing related issue.

neurogoo17:01:09

Well with localtunnel there is still the problem with it trying to connect <ws://localhost:3449/figwheel-ws> and failing in that.

mingp17:01:51

Where is it getting that from?

mingp17:01:01

Could you potentially switch to domain-relative URLs everywhere?

mingp17:01:20

And where that's not possible, could you potentially have a configurable URL interpolated in?

neurogoo17:01:11

I don't know, I thought that webaddress would be something that figwheel sets up and what would be dependent on webhost-url I set, but it does not seem to be

mingp17:01:51

That may be a matter of digging into docs/source. Sorry that I am not familiar with this stack specifically.

neurogoo17:01:56

Well thanks anyway for your help @mingp 🙂 I have been pretty frustrated with all the problems I have had with this project, but at least now I have at least some connection working

sb17:01:36

@henriklundahl: Thanks works! I mixed two type of tutorials.. that was the problem. I didn’t see.. 👍

sb17:01:36

How can I define two resource path at hiccup? (resources “/”) jump to “public/”, but if I would like to use very different admin template how to possible, just drop under public/ folder with “/admin” path or possible to use similar level dir?

sb17:01:00

Eg. /public and /admin and /user ?

sb17:01:04

templating

notanon18:01:59

i know i've done this before, let me see if i can find it

notanon18:01:09

hiccup is for generating html strings though, did you mean compojure?

notanon18:01:34

you have a (defroutes ...) call already?

sb18:01:02

Means I would add an admin route

notanon18:01:17

after your GET "/"

notanon18:01:20

you can do something like

notanon18:01:48

(compojure.route/resources "/") (compojure.route/resources "/admin")

notanon18:01:09

remember routes are evaluated top to bottom, so /admin will be searched after /

notanon18:01:16

ordering is important

sb18:01:20

Ok, in this case I need to add to public/admin the files.

notanon18:01:42

in that example your folder structure on the filesystem would be like this

notanon18:01:49

project-folder/resources/public

notanon18:01:57

project-folder/resources/admin

notanon18:01:22

if you wanted ../public/admin change (compojure.route/resources "/admin") to (compojure.route/resources "/public/admin")

sb18:01:54

really? hmm.. interesting. thanks the info!! 👍👍

sb18:01:05

Ok, I try it now! 👍

notanon18:01:33

actually, i may be wrong, it assumes a root of /public

notanon18:01:44

see the options param on the resources function

notanon18:01:59

takes a :root option to change it from /public to something else

notanon18:01:01

my mistake

sb18:01:21

Ok, that is very helpful! Thanks again!!

notanon18:01:28

np. good luck