Fork me on GitHub
#beginners
<
2017-06-14
>
eslachance07:06:21

@seancorfield trying to follow some examples from https://en.wikibooks.org/wiki/Clojure_Programming/Examples/JDBC_Examples#Creating_a_Table (not sure how up to date they are) and it's kind of failing.

(def db
  {:connection-uri (str "jdbc:h2:./evimg.db")})
(j/with-db-connection db
                      (j/create-table :images [:code "varchar(8)"] [:path "varchar(256)"]))
IllegalArgumentException Don't know how to create ISeq from: clojure.lang.Symbol  clojure.lang.RT.seqFrom (RT.java:542)
I'm a little lost without good, functional examples 😞

eslachance07:06:21

all the examples seem to be the same.

jumar08:06:23

@eslachance not sure which version of clojure.java.jdbc you're using, but I'd say it's because of the fact that create-table doesn't exist anymore Try create-table-ddl, e.g.

(j/execute! {:connection-uri "jdbc:h2:/Users/jumar/.h2.db"} (j/create-table-ddl :images [[:code "varchar(8)"] [:path "varchar(256)"]]))

eslachance08:06:03

Ah I see an extra [] around there

eslachance08:06:40

I guess some examples do need to be updated.... because here too: http://clojure-doc.org/articles/tutorials/basic_web_development.html

seancorfield16:06:17

eslachance: Ah, good to know that java.jdbc is mentioned on other parts of clojure-doc itself and is outdated there as well! Although, to be fair, that example uses the 0.2.3 version and the code is correct for that very old version. Not helpful, perhaps, but at least it should work (with that version).

eslachance16:06:29

I know it's hard to maintain examples and docs, I mean, I created and maintain https://anidiotsguide.gitbooks.io/discord-js-bot-guide/getting-started/your_basic_bot.html for the discord.js library and there's some iffy code in there, too. I know the pain.

seancorfield16:06:36

I added an issue on GH for the web dev page, so at least there’s a reminder now. Once the main java.jdbc section gets updated, I will try to carve out time to go through the web dev section and get it all updated to the latest versions of the libraries it mentions.

eslachance09:06:04

Welp. thank you @jumar I appreciate it ^_^

sb13:06:27

Is there any kind of Office 365 Clojure repository? I didn’t find with google.

dominicm14:06:09

sb: What do you mean?

sb14:06:35

I would like to access to Office 365 via Rest API (cloud products)

dominicm14:06:39

Clojure doesn't have a strong culture of wrapping rest apis with libraries ime.

dominicm14:06:44

it very probably doesn't exist.

sb14:06:04

Yes, I see.

sb14:06:13

Thanks!

seancorfield16:06:58

@eslachance Unfortunately, I can’t single-handedly update every website article about java.jdbc 😞 I control the GitHub repo (as primary maintainer), https://github.com/clojure/java.jdbc/ — That has some very basic docs and it steers people toward http://clojure-doc.org and the dedicated mailing list: “Additional documentation can be found in the java.jdbc section of http://clojure-doc.org and there is a dedicated java.jdbc mailing list” — http://clojure-doc.org/articles/ecosystem/java_jdbc/home.html (which I try to keep up to date but that’s open to everyone to contribute to without a CA or any other restrictions).

seancorfield16:06:08

That said, clojure-doc was last updated for the 0.5.6 release and 0.6.0 included breaking changes and 0.7.0 is currently in alpha. I was holding off an overhaul until 0.7.0 went gold because it really needs a ground-up rewrite.

eslachance16:06:24

Obviously I didn't mean to imply that you were responsible for out of date websites, just that it was the origin of my confusion ^_^

seancorfield16:06:37

Someone from the community has stepped up to help with that rewrite — which pleases me greatly!

eslachance16:06:39

I'm just the type of person that goes by examples, not docs, so it's hard for me.

seancorfield16:06:35

@eslachance Oh, don’t worry, I didn’t take it as criticism! It frustrates me too that there’s a lot of old material out there about java.jdbc that confuses people (especially when it’s the ancient contrib.sql stuff!).

shaun-mahood16:06:54

@seancorfield: When you get to the rewrite I'm up for helping out as well

seancorfield16:06:46

I think the examples on clojure-doc are all still functional, but I’d have to do a double-check.

alexmiller18:06:42

Would be happy to have lib guides on http://clojure.org too btw

seancorfield18:06:55

I’ve added a cautionary note to the top of the WikiBooks page that the examples are all outdated and providing a link to the clojure-doc Using java.jdbc page.

seancorfield18:06:17

(still pending review — but hopefully it’ll get approved)

seancorfield18:06:51

That WikiBooks Clojure site is pretty useless for a lot of stuff since so many pages are outdated 😞

jlmr20:06:30

I have a macro defenition like this: (defmacro macroname [{:keys [a b]} [f & r]] <macrobody>) When I call the macro with two arguments (the first one a map with keys :a and :b, the second one a list) f and r behave like I expect them to, but a and b are always nil. What am I doing wrong?

noisesmith20:06:12

I would expect the key destructuring to only work if the first arg is a map literal

noisesmith20:06:38

macros are functions from an input form to an output form, they know nothing about the real data in your app at runtime