This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-02-17
Channels
- # beginners (52)
- # boot (116)
- # cider (21)
- # cljs-dev (44)
- # clojure (104)
- # clojure-dev (82)
- # clojure-greece (5)
- # clojure-japan (4)
- # clojure-nl (14)
- # clojure-russia (65)
- # clojure-serbia (3)
- # clojure-spec (38)
- # clojure-uk (9)
- # clojure-ukraine (1)
- # clojurescript (65)
- # clojurewest (1)
- # community-development (1)
- # core-logic (3)
- # cursive (5)
- # data-science (9)
- # datomic (13)
- # emacs (45)
- # euroclojure (1)
- # hoplon (2)
- # instaparse (23)
- # javascript (1)
- # jobs (2)
- # klipse (43)
- # leiningen (8)
- # lumo (25)
- # off-topic (7)
- # om (13)
- # om-next (3)
- # onyx (11)
- # pedestal (12)
- # planck (19)
- # proton (1)
- # re-frame (26)
- # reagent (26)
- # remote-jobs (13)
- # ring-swagger (23)
- # spacemacs (1)
- # untangled (3)
I just heard an interview where Bob Martin said: > Object Oriented languages are a discipline around not having pointers to functions. I know this isnโt the perfect channel for this question, but can anyone explain what he means? I have a guess, but i might be wrong.
I am reading Web Dev with Clj (book) and after second chapter i got but which i cant seem to fix alone.
(defroutes auth-routes (GET "/register" [] (registration-page)) (POST "/register" [id pass pass1] (handle-registration)) (GET "/login" [] (login-page)) (POST "/login" [id pass] (handle-login id pass)) (GET "/logout" [] (layout/common (form-to [:post "/layout"] (submit-button "Logout")))) (POST "/logout" [] (session/clear!) (redirect "/")))
(defn handle-registration [id pass pass1] (rule (= pass pass1) [:pass "password was not retyped correctly"]) (if (errors? :pass) (registration-page) (do (db/add-user-record {:id id :pass (crypt/encrypt pass)}) (redirect "/login"))))
i get arrity exception and i saw request in browser it does send id, pass and pass1
what book is this from exactly? This one: https://pragprog.com/book/dswdcloj2/web-development-with-clojure-second-edition ?
it seems like they don't get into auth until chapter 8 during the picture gallery app
well, not necessarily, as long as you're using the correct versions of the libraries the code examples should still work.
@lepistane ArityException means that you are calling a function with the wrong number of arguments. Look here:
(POST "/register" [id pass pass1]
(handle-registration))
...
(defn handle-registration [id pass pass1]
You have a function handle-registration that takes 3 arguments, but when calling the function you call it with 0 arguments.@lepistane np just keep on bothering, this is what the beginners channel is there for ๐
I can't find the link -- anyone recall a github project that was a TDD ClojureScript tutorial for a simple web app?
I saw it recently and it looked cool and of course I didn't star/bookmark/readlater/fave/like/etc it
@sveri i fixed it but it still breaks Wrong number of args (0) passed to: auth/handle-registration
(defroutes auth-routes (GET "/register" [] (registration-page)) (POST "/register" [id pass pass1] (handle-registration id pass pass1)) (GET "/login" [] (login-page)) (POST "/login" [id pass] (handle-login id pass)) (GET "/logout" [] (layout/common (form-to [:post "/layout"] (submit-button "Logout")))) (POST "/logout" [] (session/clear!) (redirect "/")))
if you post larger code snippets could you click the plus button to the left side of the input box please and then "code or text snippet". Also it seems like some code is missing.
i understand sorry. i am new to slack. '''(defroutes auth-routes (GET "/register" [] (registration-page)) (POST "/register" [id pass pass1] (handle-registration id pass pass1)) (GET "/login" [] (login-page)) (POST "/login" [id pass] (handle-login id pass)) (GET "/logout" [] (layout/common (form-to [:post "/layout"] (submit-button "Logout")))) (POST "/logout" [] (session/clear!) (redirect "/"))) ''' is this better
Also please post the functions that are being called, now I can only see the routes, but not the function definitions
This is a common occurring even with years of experience. That weird thing that is happening is just something you dont understand. In former times they called that weird thing god. Today people try to figure out what exactly went wrong or what changed ๐
i am using emacs setup from Brave and True i run cider-jack-in (that starts nrepl) and i start server from there
It depends on how your ring server is set up, but a lot of exmple code uses the ring-devel
middleware, which will check to see if your code has changed and reload some namespaces if it has
From personal experience I've found compojure defroutes stuff to be a little squirrelly with reloading though
If you want to be certain, stopping and restarting your server if the best way to go
Exactly. I had to use components and its restart functions to notify my repl of changed routes.