This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2016-12-20
Channels
- # admin-announcements (1)
- # bangalore-clj (4)
- # beginners (176)
- # boot (38)
- # cider (9)
- # clara (1)
- # clojars (9)
- # clojure (290)
- # clojure-belgium (25)
- # clojure-berlin (2)
- # clojure-dusseldorf (10)
- # clojure-italy (1)
- # clojure-russia (141)
- # clojure-sg (1)
- # clojure-spec (40)
- # clojure-uk (38)
- # clojurebridge (19)
- # clojurescript (148)
- # code-reviews (37)
- # community-development (7)
- # cursive (27)
- # datomic (71)
- # editors-rus (3)
- # events (1)
- # heroku (1)
- # hoplon (16)
- # jobs (5)
- # lambdaisland (3)
- # lein-figwheel (211)
- # luminus (3)
- # off-topic (52)
- # om (18)
- # onyx (49)
- # overtone (3)
- # pedestal (48)
- # protorepl (7)
- # rdf (2)
- # re-frame (61)
- # reagent (3)
- # timbre (2)
- # untangled (69)
How to I add a newline to a println?
@grounded_sage add the newline character (println "foo\n" "bar\n" "baz")
Cool. I thought it was that. I just used it in the passed and it didnt work. But appears to work now..
super n00b compojure question. I'm getting <h1>Invalid anti-forgery token</h1>
as a response when I try to test an endpoint with Postman. here's my whole app:
(ns demo-clj.core
(:require [compojure.core :refer :all]
[compojure.route :as route])
(:gen-class))
(defroutes app
(GET "/" [] "<h1>Hello World</h1>")
(route/not-found "<h1>Page not found</h1>")
(POST "/intPlus2" [n]
{:n (+ 2 n)}))
I'm hoping to get back something along the lines of {"n": 4}
@goomba What middlewares are you using? In particular, are you using the CSRF prevention middleware? If so, then your POST requests, by default, need a CSRF token or they'll be rejected.
no middleware (I think)
that's the whole project you're looking at. Dependencies:
:dependencies [[org.clojure/clojure "1.8.0"]
[org.clojure/tools.cli "0.3.5"]
[compojure "1.5.1"]
]
ran with lein ring server-headless
What confuses me is that the error message you're getting sounds like typical anti-CSRF middleware (I think there's a few available for Ring based apps) but I don't see it being applied anywhere.
confuses me too š
Here https://github.com/ring-clojure/ring-anti-forgery/blob/master/src/ring/middleware/anti_forgery.clj#L54 is where your error appears to be coming from.
It's more or less as I would expect, except I can't see where it's being added to your Ring app.
do you think it might have something to do with lein
...?
oh god I'm an idiot
completely disregard
was running the wrong project entirely
was running a similarly named project
clearly on the other side of balmer's peak
Not so much, I found http://shop.oreilly.com/product/0636920034292.do to be pretty good having come from LPTHW
ah i think this one's more newbie friendly https://github.com/ClojureBridge/curriculum
@nur Have you gotten this tip yet? http://www.braveclojure.com/introduction/
On a similar vein to the question above, I bought myself Living Clojure for a Christmas present (5 more sleeps to go!). Can anyone recommend a good "beginners" intro course to spec (as this isn't included in the book)?
Can someone help me to find orphan tags here :
{% extends "base.html" %}
{% block content %}
<section class="body-content ">
<div class="page-content">
<div class="container">
<div class="row">
<div class="col-md-8">
<!--classic image post-->
<div class="blog-classic">
<div class="blog-post">
<div class="full-width">
{{ paintings.tiles )}
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</section>
{% endblock %}
@curlyfry yup i borrow the book from the library... install brew leiningen and `| .gitignore | doc | | intro.md ā | project.clj | README.md ā | resources | src | | clojure_noob ā | | | core.clj ā | test | | clojure_noob | | | core_test.clj` lost lol
@poooogles thanks, the ) must be a }
trying http://quil.info/ with clojurebridge
i just feel like my setup is not there yet... last time it was codeblock C++ many years ago
Nurs-MacBook:clojure-noob nurazhar$ lein repl
nREPL server started on port 51966 on host 127.0.0.1 -
REPL-y 0.3.7, nREPL 0.2.12
Clojure 1.8.0
Java HotSpot(TM) 64-Bit Server VM 1.8.0_112-b16
Docs: (doc function-name-here)
(find-doc "part-of-name-here")
Source: (source function-name-here)
Javadoc: (javadoc java-object-or-class-here)
Exit: Control+D or (exit) or (quit)
Results: Stored in vars *1, *2, *3, an exception in *e
clojure-noob.core=>
ok i think i get it
terminal = IDE@nur there are plugins for editors which send code from current buffer to the REPL for you
@nur if you really want a full blown IDE there is the Cursive plugin for IntelliJ (there's a license fee for Cursive) or Counterclockwise for Eclipse (although I'm not sure how well that's supported atm). Based on recent survey's the most popular editors in use are Emacs (with CIDER) and IntelliJ (with Cursive) followed by Vim (with Fireplace) and Atom (with proto-repl)
I am using NightCode now https://github.com/ClojureBridge/curriculum/blob/gh-pages/outline/setup_osx.md will look into those thanks
hi guys
(distinct (take 100 (repeatedly #(.getMillis (DateTime. ))))) (1482246807033)
is there a way to get precision better than milli seconds ?
seems last expression is executed in time less than milli second
rand is amazing
(count (distinct (take 1000000 (repeatedly #(rand 1000000))))) 1000000
i'm not sure it's there
maybe getPicos
any idea why lein doo
is saying there's only one 1 test with 1 assertion?
(deftest class-root
(testing "Should be able to parse a root path"
(async done
(go
(let [model (<! (fetch/model flymine-beta))]
(is (= :Gene (path/class model "Gene")))
(done)))))
(testing "Should be able to parse a normal path"
(async done
(go
(let [model (<! (fetch/model flymine-beta))]
(is (= :Organism (path/class model "Gene.organism.name")))
(done))))))
nesting testing
seems to work for others: https://github.com/r0man/cljs-http/blob/master/test/cljs_http/client_test.cljs#L114
@abdullahibra you can use (System/nanoTime) for nano-level precision (but not necessarily nano-level resolution) in Java.
ah great
there are a lot of caveats wrt the os that youāre on and what that actually does
http://stackoverflow.com/questions/351565/system-currenttimemillis-vs-system-nanotime seems to have a good overview
What I try to do is to make a url where the part after the /detail/ is the id which is found by the data.id
?
Use <a href=ā/detail/{{data.id}}ā>
@seancorfield thanks, that worked
@seancorfield how can I debug a css problem. When I open the site in FF with F12 I see a message that the stylesheet cannot be found.
This sounds like the same problem you had before with JS not being loaded. So the solution is going to be to debug it and fix it same way you did with the JS file.
(at this point, I think you should be making more effort to debug problems directly yourself, before folks just give you the answer)
@seancorfield I try but I hope when I do not find it, someone can give me a hint where to look
but you are right. at some way the css did not get found where I read the readme , it schould be find the css there
@roelofw so you have an href to css. you expected the css to be found but it is not finding the css
also adding /resources/public/ before the css did not take care that the css is found
okay, so your hypothesis is that the resource string might be wrong. so to test your hypothesis you change the string
how many experiments have you run, what were the inputs, outputs, and what were your observations?
I also tried this : (render "{% style \"/css/screen.css\" %}" {:servlet-context "/"})
hello everyone, got a problem with namespaces and :require
š
I have a cljc ns in which i require clojure.core and some other clojure libraries, other than some cljs namespace in my own project.
I wrapped the cljs required ns in #?(:cljs ā¦)
but it keeps complaining about a single namespace that cannot be found, showing this error in the repl
java.lang.RuntimeException: No such namespace: schemas, compiling:(.../graph-editor/src_front/graph_editor_front/api.cljc:14:30)
not sure about the other cljs ns, because it complains about this one, which is the first used in my code. can anyone help me to understand what i am doing wrong?
@roelofw I've pulled down the project and ran it and I'm not getting any errors, so commit and push any changes you have locally so I can see what you've done
when you click on a painting like this url : http://localhost:3000/detail/SK-C-1368
but first you need to debug the current one. Why does the data class only work on screens with a max width of 479px?
I ran the project and went to a detail page, I inspected the page and expected there to be a .data style on the elements with class="data", there actually wasn't. So I asked where is the bug? is it the app, the wrappers, the language, the library, the jvm, the operating system, the hardware, or physics itself? the css file is there and the app found it so it isn't OS, the css is working for every other element so it isn't the language or libraries, the wrappers are turning the resource statements into proper hrefs, so it must be in our css
@roelofw btw. "borrowed" can mean you are actually breaking they copyright. So you should make sure that "borrowing" somebody else css is allowed š
not to mention using a $59 css file for an open source toy web app is a bit of overkill
In the end its up to you. Its just that people can get pretty * when they see their layouts used somewhere else.
I think I will destroy this project. I cannot make it work that the first page schows multiple images with masonary and a beutifull detail page where I can show one image and some more info about the image
take some hammock time or work on other projects, but as you practice and learn you can always revisit it with new eyes
I don't see why not, rip out all the custom styling and start with something basic and build up
frontend work is not my cup of tea either so I totally feel your pain, but having a simple grid layout with a nice details page for each item is a nice concrete achievable goal for the project.
then when you want to explore using Om, Reagent, or Re-frame you can make a branch off master and refactor it to be a SPA
that always depends on the purpose of the details page. for ecommerce you want price, description, specs, swatches, and "buy now" button to be prominent, but for a gallery app you might just want artist details and description to be prominent
@roelofw At a first glance I like it, maybe a padding would be nice. But really, its a nice and clean page with the picture in the middle taking the focus where it should be.
Yeah the picture location is good, you can fill up the white space around it with details about the painting in a larger point font
What do you think about this : https://lit-lowlands-46138.herokuapp.com/detail/SK-A-2963
@roelofw I am not sure if the border around the text is needed at all, or maybe make it more transparent. That said, this discussion belongs to #off-topic I guess.
2) maybe a idea to make it work that the text will be in Englisch or Dutch and the user can choose
and will then continue with these projects : https://purelyfunctional.tv/functional-programming-career-guide/10-side-projects-resume/
@gdeer81 , the repository for my Luminus guestbook Reagent app in progress is at https://github.com/levinem/guestbook