Fork me on GitHub
#beginners
<
2016-05-18
>
bwstearns00:05:26

@jeff.engebretsen: thanks for the recommendation. I will definitely pass that on.

mpuppe10:05:41

Are nested refs a terrible idea? I’m trying to build some kind of todo list GUI with Swing and I’m trying to code a „view-model“ and that kind of leads me straight down that road. Because I need to watch the whole list and I need to watch each individual item of the list.

mpuppe10:05:49

(I wish there was something like React for Swing)

agi_underground15:05:58

maybe someone know what i`m doing wrong: when i do "lain uberjar" for my project , i reseive these error: java.lang.ClassNotFoundException: org.eclipse.jetty.server.nio.SelectChannelConnector, compiling:(jetty.clj:1:1) [6:16] i`m use [info.sunng/ring-jetty9-adapter "0.9.3"] for ability use latest 9.3.8 jetty server

plexus15:05:19

that's strange... maybe first try lein clean and then again lein uberjar. If you still have the same error please post the output of lein deps :tree

plexus15:05:36

as suggested in #C03S1KBA2 you can try adding [org.eclipse.jetty/jetty-server "9.3.8.v20160314"] to your :dependencies in project.clj. That's the version that ring-jetty9-adapter 9.3.8 expects to find

agi_underground17:05:34

i try exclude ring-jetty-adapter from ring(have deps conflict with "[info.sunng/ring-jetty9-adapter "0.9.3"]"), and program run well, but when i try to compile this with "lein uberjar" i have some strange errors. In this case, when i need jetty 9.3.8 and ring in one project, i need to clone ring git-repository, compile it with my custom deps in ring-jetty-adapter(set "org.eclipse.jetty/jetty-server "9.8.3""), push it to clojars and just now i can add new jetty in my project, right?

seancorfield19:05:08

@agi_underground: You should not need to create a custom version of Ring to achieve this! You just need to get the dependencies and exclusions right in your project.

agi_underground19:05:03

@seancorfield: yes, thank you, that's exactly what I did. But now, when i try to start my project with http2 : java -jar target/project-0.1.0-SNAPSHOT-standalone.jar --add-to-startd=http2 i have this error: "Exception in thread "main" java.lang.NumberFormatException: For input string: "--add-to-startd=http2"" my versions of java etc.: java version "1.8.0_91" Java(TM) SE Runtime Environment (build 1.8.0_91-b14) Java HotSpot(TM) 64-Bit Server VM (build 25.91-b14, mixed mode)

seancorfield19:05:39

The stack trace will show you which line is causing that. Your -main program is trying to process the command line arguments and expects a number where you’re passing a string.

agi_underground19:05:40

all works perfect! thanks for all!

miguelb20:05:00

is it not possible to define a protocol in a cljs repl?

agi_underground20:05:18

one more question: when i need provide port to my app and in the same time param like http2, how to do this? with: java -jar target/app-0.1.0-SNAPSHOT-standalone.jar 4334 --add-to-startd=http2 it dont work

roberto21:05:53

something is probably wrong with your code. It is possible to pass in cli args

roberto21:05:36

port is a vector

roberto21:05:44

oh, sorry, you are trying to destructure

roberto21:05:01

hmmm, I’ve never tried to do that

roberto21:05:11

normally I just read the args as a vector

roberto21:05:37

if you want something more fancy checkout https://github.com/clojure/tools.cli

agi_underground21:05:21

but, i think --add-to-startd is option for java, isn`t it?

roberto21:05:03

yeah, normally you would use -Dadd-to-start= in java land

hoopes21:05:10

user=> (require '[org.httpkit.client :as c])
user=> (defn callback [{:keys [status headers body error]}] (println status))
user=> (c/get "" { :query-params { :access_token "mytok" }} callback)
401
user=> (c/get "" {} callback)
200
...am I missing something glaringly obvious here?

roberto21:05:57

hard to tell, I’m not familiar with pinterest’s api

hoopes21:05:45

well...i'm more talking about the :query-params bit - the second one is just a string with the token in the url, which is what i thought the first should wind up as when the request is made

hoopes21:05:20

they look like they should make exactly the same request, accd to http://www.http-kit.org/client.html#async

hoopes21:05:29

the second one

roberto21:05:51

it works if you call it like that, right?

roberto21:05:05

with curl or wget

hoopes21:05:24

yeah, the second call in the example up there returns a 200, so it's definitely working when the url is a string (and from curl as well)

hoopes21:05:39

i'm just wondering what beginner-level dumb mistake i'm making for the request with the param map to not work

roberto21:05:57

hmm, yeah looks weird. My guess is that query-params in that context doesn’t mean what we think it means

hoopes21:05:58

user=> (c/get "" {:query-params { :access_token "mytok"}} callback)

(in another terminal...)
$ python -m SimpleHTTPServer 8000
127.0.0.1 - - [18/May/2016 17:32:19] "GET /?access_token=mytok HTTP/1.1" 200 -

hoopes21:05:46

welp - i must be doing something dumb...i'll keep digging. thanks for the help, roberto!

roberto21:05:51

ah, maybe that space in your map in front of :query-params is hurting you?

roberto21:05:37

normally they don’t have a space {:query-params {:access-token “mytok”}} better than { :query-params { :access-token “mytok” } }