Fork me on GitHub

oke am i doing something wrong?


ajax.cljs post to server and when i use :body it's #object[ 0x5aec0e6e [email protected]] is that normal ? what do i do now?


do i need to parse that with transit.clj


or error is else where?


Yeah, you can reasonably expect the body to be an InputStream. The easiest way to get the data out is to just use slurp.


(let [body (slurp (:body req))] …)


so this is normal when using ajax.cljs ?


Is there a way to use an editor to unpack a the s-expressions back one level? Example: Say i have.. (def foo [x] (+ x 1) and.. (def bar [x] (foo 1)) so if i have my mouse at the * it would unpack the next expression, like so: (def bar [x] *(foo 1)) -> (def bar [x] (+ x 1)) I know there is a “eval and replace” in Cider , i would want a just a “replace”.


Hey all, just wanted to confirm what is expected in this scenario. You are using boot-reload or figwheel. You load up a simple app where one file as a ns of app.core. You require app.core into another ns. You launch you app and everything works. Now, you want to change your ns from app.core to app-awesome.core. Would this require a full restart of boot-reload or fighweel? Through my experimentation, I found that this is the case. However, I . just want to confirm that this is actually expected and its not my configs.


@drewverlee I think you want cljr-inline-symbol (for me, , r i s). It's been unreliable for me, though, sometimes throws errors in a way I've never tracked down (or really tried TBH).


Thanks. I’ll take i’ll try that out.


There’s also cider-eval-last-sexp-and-replace, but that does something a bit different — instead of changing (foo 1) to (+ x 1), in your case it would just change it to 2. Not what you wanted, but also sometimes useful 🙂


@tkjone figwheel's reloading doesn't handle new files, deleted files, or renamed files.


(where effectively, a renamed file is both - you would need to eliminate things defined under the old ns etc.)


@noisesmith I was initially thinking that too, but then I wasn’t confident of it — it seems like a) you wouldn’t usually care if there were things loaded under the old ns, you would just ignore them (in many cases, anyway), and b) it seems like the new ns, assuming cljs, would get built along with everything else in that dir, and then you could just require it as usual. Am I wrong on that? My confidence in the above is extremely low, which is why I didn’t answer.


yes you are wrong


Cool, thanks.


it's pretty easy to test bymaking a new file


Yeah, I was too lazy to go test it 😉


you can even mess it up by deleting the file and recreating it (it's watching file handles, or so it seemed)


Cool, good to know.


Hi, I need a help with using javafx with Clojure. I don't know how to get data from a form to a caller. Can somebody point me in the right direction or maybe knows some resource where I could dig in.Thanks


Newbie: Just learning how to connect to a postgresql database using older examples in tutorials. It appears that jdbc has changed quite a bit since 0.3.0 (now 0.7.0). I am quite confused now with a full day of alternate tutorials, searches, different errors, and reading across both postgres documentation and clojure libraries - jdbc especially. Need expert to verify if I am setting up my dependencies and jdbc correctly. Are these correct? from project.clj: :dependencies [[org.clojure/clojure "1.8.0"] [ring "1.6.2"] [compojure "1.6.0"] [org.clojure/java.jdbc "0.7.0"] [org.postgresql/postgresql "42.1.4"]] from core.clj: ;;; database connection (def db "jdbc:<postgresql://localhost/webdev?user=postgres&password=mypassword%22|postgresql://localhost/webdev?user=postgres&password=mypassword">) When I invoke the webapp I get the following error: ERROR: relation "items" does not exist Position: 63 Which on research appears to mean the table which I am creating in the following code does not exist: (ns webdev.item.model (:require [ :as db])) (defn create-table [db] (db/execute! db ["CREATE EXTENSION IF NOT EXISTS \"uuid-ossp\""]) (db/execute! db ["CREATE TABLE IF NOT EXISTS items (id UUID PRIMARY KEY DEFAULT uuid_generate_v4(), name TEXT NOT NULL, description NOT NULL, checked BOOLEAN NOT NULL DEFAULT FALSE, date_created TIMESTAMPTZ NOT NULL DEFAULT now())"])) which I confirm to be "not created" when looking at pgAdmin. But I think it is getting to the database and looking for the table. But not certain. Can you first verify the items above. I will provide more of the logic later if I need to. Any hints or more current resources I should master here? Thanks


I think your db declaration should be a connection spec, not a string


e.g. (def db {:connection-uri ""})


I've generally used the following before:

(defonce db-spec {:subprotocol "postgresql"
                  :subname (str "//" (:database-name env))
                  :classname "org.postgresql.Driver"
                  :user (:database-user env)
                  :password (:database-password env) })


Thanks to you both. I will try both methods and come back here with success status or more questions.