Ok I see. It has a different terminal. Seems the best option for installing it is the Postgres app.
@grounded_sage: are you sure postgres is installed correctly on your system? what is the output of which postgres ?
@shanekilkelly: It's giving me nothing now. The previous installs gave me something but weren't working so I thought I would try it this way... still confused.
How is it installed now? Are you using postgres.app on a mac?
Yep that's how I have installed it now
Which is now giving me nothing when I ask which postgres
The Brew installed ones and enterprise ones both gave me something back. I think the enterprise one kept setting up a new user on the computer... which I didn't like.
Ok, when you use brew it installs the postgres binaries to /usr/local, which is visible on your shell path. Postgres.app keeps everything inside the app package, so those programs are not visible on the shell path.
I haven't installed the command line tools... I don't know where ~/.bash_profiles is http://postgresapp.com/documentation/cli-tools.html
If you just want to creat a database, then I suggest launching postgres.app and then using a graphical tool like pgadmin to connect and create your database
.bash_profile should be in your home directory
In the Clojure Web Development course. He just types in..... createdb app-name
Ok, let's back up, do you have much experience using the terminal? :)
Yes I have forced myself to use it a lot
I actually prefer it over GUI apps for doing stuff like this
I tried doing a search earlier for .bash_profile and nothing came up so I created my own... didn't do anything lol
Ok, then you know that '~/.bash_profile' is a file in your home directory? If you can edit that then the instructions in the linked article should allow you to get this working
Ah, it's also possible you may need to creat it
find: .bash_profile : No such file or directory Wades-Air:home wade$
Umm... I don't know what happened but it's finding it now...
which psql that is
Cool, createdb should now also work
Wades-Air:webdev wade$ lein run 8000 2016-01-17 22:37:51.076:INFO:main Logging initialized @3705ms Exception in thread "main" org.postgresql.util.PSQLException: ERROR: syntax error at or near "NOT" Position: 133, compiling:(/private/var/folders/m9/rcs8n7hd74q_qw084n6bc93c0000gn/T/form-init6970411645438536527.clj:1:124) at clojure.lang.Compiler.load(Compiler.java:7142) at clojure.lang.Compiler.loadFile(Compiler.java:7086) at clojure.main$load_script.invoke(main.clj:274) at clojure.main$init_opt.invoke(main.clj:279) at clojure.main$initialize.invoke(main.clj:307) at clojure.main$null_opt.invoke(main.clj:342) at clojure.main$main.doInvoke(main.clj:420) at clojure.lang.RestFn.invoke(RestFn.java:421) at clojure.lang.Var.invoke(Var.java:383) at clojure.lang.AFn.applyToHelper(AFn.java:156) at clojure.lang.Var.applyTo(Var.java:700) at clojure.main.main(main.java:37) Caused by: org.postgresql.util.PSQLException: ERROR: syntax error at or near "NOT" Position: 133 at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2103) at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1836) at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:257) at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:512) at org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:388) at org.postgresql.jdbc2.AbstractJdbc2Statement.executeUpdate(AbstractJdbc2Statement.java:334) at clojure.java.jdbc$db_do_execute_prepared_statement$fn__371.invoke(jdbc.clj:753) at clojure.java.jdbc$db_transaction_STAR_.doInvoke(jdbc.clj:595) at clojure.lang.RestFn.invoke(RestFn.java:425) at clojure.java.jdbc$db_do_execute_prepared_statement.invoke(jdbc.clj:752) at clojure.java.jdbc$db_do_prepared.doInvoke(jdbc.clj:786) at clojure.lang.RestFn.invoke(RestFn.java:442) at clojure.java.jdbc$execute_BANG_$execute_helper__404.invoke(jdbc.clj:892) at clojure.java.jdbc$execute_BANG_.doInvoke(jdbc.clj:896) at clojure.lang.RestFn.invoke(RestFn.java:425) at webdev.item.model$create_table.invoke(model.clj:8) at webdev.core$devmain.invoke(core.clj:69) at clojure.lang.Var.invoke(Var.java:379) at user$eval5.invoke(form-init6970411645438536527.clj:1) at clojure.lang.Compiler.eval(Compiler.java:6703) at clojure.lang.Compiler.eval(Compiler.java:6693) at clojure.lang.Compiler.load(Compiler.java:7130) ... 11 more
I have no idea what the error message is saying at all lol
Got it working. There was an error in the video training. On that note I am off to bed. Thanks @shanekilkelly for helping out simple_smile
Hi, does a series of progressive exercises to obtain basic fluency in Clojure exist anywhere that you know of?
perhaps the clojure katanas
someone should compile a list somewhere
@t0by: ^
many are listed at http://clojure.org/community/resources - issue with additions https://github.com/clojure/clojure-site/issues or PR welcome (PRs require signed Clojure CA - http://clojure.org/community/contributing_site)
"At this time, http://4clojure.com does not provide information regarding the sale of foreclosed homes, and has no plans of doing so in the future." I actually laughed out loud.
Is there a better way to write this:
clojure
(zipmap (keys (stasis/slurp-directory "resources/articles/" #"\.md$")) (map #(md/md-to-html-string %) (vals (stasis/slurp-directory "resources/articles/" #"\.md$"))))
Essentially I would like to keep the keys of a persistent array map and just operate on their values
returning a new map representing the change
so that sounds like a data transformation problem
step 1 for me is to always look at into
it isn't always the right solution, but quite often it is
into an empty map {} and then destructure the data structure that I am trying to work with? In this case
(stasis/slurp-directory "resources/articles/" #"\.md$")(defn zipmapf [f coll]
(zipmap coll (map f coll)))similar to what you need, perhaps
I feel like I always struggle with this type of manipulation in clojure, as if the elegant approach isn't there to be found in core.
and I'm not sold on my own attempts
Yes, this has been the biggest hurdle for me - manipulating data structures.
I like your into approach though! That's exactly what I need
manipulating vectors using into with optional transducers is a joy
versus the lack of ability to do something like this using a core function:
(defn hashmap-set
[keyvals]
(persistent!
(reduce
(fn [ret [k v]]
(assoc! ret k (conj (get ret k #{}) v)))
(transient {}) keyvals)))my favorite exploitation of clojure data transforms:
(defn produce
"Returns a lazy sequence of colls from a recursive, axiomatic,
transformative process."
[seed prep-f get-xf]
(letfn [(process
[coll]
(lazy-seq
(when (seq coll)
(let [new-coll (into (empty coll) (get-xf coll) (prep-f coll))]
(cons new-coll (process new-coll))))))]
(process seed)))from my generative function library: https://github.com/decomplect/ion/blob/master/src/ion/ergo/core.cljc
hello! My web form send form params to server that connect to google spreadsheet api, writes new line, and return response up to client
locally this works fine.
when I run the app in my hosting provider, I see that a new line is created in my spreadsheet but the server doesn't return anyresponse to client
(code 0)
anyone would have a clue?
I am using cljs-ajax for posting to server
in chrome the console indicates Chrome net::ERR_INCOMPLETE_CHUNKED_ENCODING error
in safari : kCFErrorDomainCFNetwork Code=303
Just to create the schedule based on n, this is what I was trying...
@kopasetik: the recur passes 2 arguments. You could fix the loop binding to be
(loop [n n
vctr vctr]
or just eliminate loop and let it recur to createSchedule.I don't like loop very often
maybe the feeling is mutual
@kopasetik: That just fixes the shape of the code. I haven’t looked into what it is really doing.
avoid loop like the complement of recur
OK, i’m not sure how to make an arithmetic series using iterate. Is that possible?
range
You can use iterate, as in (take 5 (iterate inc 5))
(iterate inc 5)
But, range is indeed geared to work with numbers
Speaking of that, the ClojureScript docstring for range indicates it returns a lazy seq. Wonder if that is strictly speaking, true.
partition is a fun function
ignoring chunking I'd be surprised if rangewasn't lazy in cljs
Well, range in ClojureScript has an interesting implementation.
oh?
Try (nth (range) 5e8) in Clojure and in ClojureScript. simple_smile
Hmm… Clojure doesn’t have indexed?
I'm on a borrowed laptop and don't have clojure installed yet. 😞
Well, suffice it to say, in ClojureScript, it returns a deftype that conspires to implement things like IIndexed in O (1) as opposed to O (n).
Same for ICounted, it is a nice trick that makes (count (range 1 1e8)) instant by doing something we all learned how to do before computers existed. simple_smile
its turtles and magiks all the way down
I am following Eric Normand's Web with Clojure tutorial and I am completely stuck with Postgres. I can't seem to get it to work with 'creatdb'