Fork me on GitHub
#clojure
<
2019-05-02
>
seancorfield00:05:07

@lilactown do you mean clojure.java.jdbc?

lilactown00:05:02

well, I actually mean your next.jdbc lib 🙂

Ivan Koz00:05:15

@noisesmith can you explain semantics of ::keyword

noisesmith00:05:49

it expands to a namespaced keyword in the current namespace

lilactown00:05:46

here's what I'm trying to do:

$ clojure -A:rebl:rebel -Sdeps '{mysql/mysql-connector-java {:mvn/version "5.1.6"}}'
[Rebel readline] Type :repl/help for online help info
user=> (require '[next.jdbc :as jdbc])
nil
user=> (def db {:dbtype "mysql" :dbname "content_service"})
#'user/db
user=> (def ds (jdbc/get-datasource db))
#'user/ds
user=> (jdbc/execute! ds "show tables")
Execution error (SQLException) at java.sql.DriverManager/getConnection (DriverManager.java:702).
No suitable driver found for jdbc:

seancorfield00:05:23

Hmm, I would have expected that to work, but that's a pretty old MySQL driver.

seancorfield00:05:31

It's been tested against mysql/mysql-connector-java {:mvn/version "5.1.41"}

lilactown00:05:09

oh, my -Sdeps isn't right

seancorfield00:05:33

Yeah, just noticed

lilactown00:05:37

works great 🙂 thanks!

seancorfield00:05:22

Best place to ask questions about next.jdbc -- or clojure.java.jdbc or databases in general -- is #sql

Alex Miller (Clojure team)00:05:46

:: means "keyword, autoresolved in the current namespace context"

deva04:05:42

How to include a git repo in deps.edn which have java source. I am trying like this

{:deps
 {org.clojure/data.csv {:git/url ""
                        :sha "e5beccad0bafdb8e78f19cba481d4ecef5fabf36"}}}
but I am getting ClassNotFoundException for Java files. Any pointers or help is appreciated.

seancorfield04:05:17

@gdrte Java has to be compiled first. You can't just pull in source files, unlike Clojure.

deva04:05:03

So it means I can't include Java in the same package/repo?

seancorfield04:05:22

@gdrte That repo does not have Java code in it so I'm not sure what you're asking/trying to do here.

deva04:05:00

Nvm, the above is just an example. Here is the repo https://github.com/gdrte/suricatta

deva04:05:33

the error is Syntax error (ClassNotFoundException) compiling reify* at (impl.clj:106:3). suricatta.impl.IParam

deva04:05:35

gdrte/suricatta {:git/url ""
     :sha "9cc71345e79b72e3504c1c94a9ba76c2925be74f"}

seancorfield04:05:47

Right, you can't use Java source files with clj/`deps.edn`. They need to be compiled (via javac) first.

deva04:05:08

So, I can't do it one go, hmmmm.

seancorfield04:05:35

You would need to compile, build, and publish your Java code as a JAR somewhere, and depend on that.

deva05:05:29

Thanks for the reply Sir.

deva05:05:05

aah... actually I forked that project, and upgraded clojure and some other libs. I didn't tried to send a PR to original author. I thought clojure git deps will work for me without messing the artifactory id.

seancorfield05:05:12

For some situations, you can actually hack around this by shelling out and running a javac ... command line.

deva05:05:48

yeah, I will build it locally and include the jar

seancorfield05:05:22

You can add a JAR to the classpath as a :local/root dep.

deva05:05:10

I just did that. It worked. Thanks again.

4
seancorfield05:05:17

It's really a good incentive to try to do everything in Clojure 🙂

👍 8
mloughlin09:05:34

every week I get an email from the Rust team called "This Week in Rust", it's an update on news, jobs, calls for participation in open source projects, events and so on is there an equivalent for Clojure?

lread09:05:35

Cherished Clojure weeklies are: Daniel Compton’s The REPL newsletter https://www.therepl.net/Newsletters/ and Eric Normand’s http://PurelyFunctional.tv Newsletter https://purelyfunctional.tv/newsletter/

👍 4
😘 4
lread09:05:22

I also really like Alex Miller’s weekly update blog: http://insideclojure.org/

👍 8
erwinrooijakkers11:05:36

What’s up with this?

(= 40.4 (float 40.4)) ;; => false
  (= 47.5 (float 47.5)) ;; => true

dharrigan11:05:16

For me, it's the otherway round. Comparing precision on floats on the JVM, using the equals method, I suspect is the same issue when comparing floats on Java on the JVM. You're not sure on the precision that the JVM uses per call.

dharrigan11:05:45

There's lots of results on google on comparing floats (on Java, but equality valid to Clojure)

dharrigan11:05:57

Rich Hickey added a comment - 05/Sep/13 8:27 AM

It is out of scope for Clojure to fix this for Java types Float/Double/BigInteger

Ben Hammond15:05:09

I have a com.cognitect.aws/glacier question; I want to run list-vaults but when I run

(aws/invoke dev/gl {:op :ListVaults
                    :request {:accountId "099465141348"
                              :apiVersion "2012-06-01"
                              }})
I get
=>
{:code "MissingParameterValueException",
 :message "Required parameter missing: API version",
 :type "Client",
 :cognitect.anomalies/category :cognitect.anomalies/incorrect}

Ben Hammond15:05:35

what is the secret sauce for getting the apiVersion accepted?

Ben Hammond15:05:19

(I tried putting into

(aws/client {:api :com.cognitect.aws/glacier
                     :version "2012-06-01"
                     :region :eu-west-1
...)
but that didn't help either

ghadi15:05:11

@ben.hammond turn on request validation

Ben Hammond15:05:49

just with (aws/validate-requests gl true) you mean?

4
Ben Hammond15:05:31

same error message ..?

ghadi15:05:48

Also, (aws/doc client :ListVaults)

ghadi15:05:13

Make sure the keywords you're providing are correct

ghadi15:05:30

Usually they are capitalized

Ben Hammond15:05:07

yeah that doc does not talk about API versions at all

ghadi15:05:53

Have you tried omitting the arguments

ghadi15:05:07

Just empty map

Ben Hammond15:05:23

yes so I get a helpful error message if I leave out the required :accountId

ghadi15:05:27

I've never seen an API that makes you send in the version

Ben Hammond15:05:07

I think there might be a regression for the AWS glacier API floating around; but I'm not quite sure

Ben Hammond15:05:26

these are all JSON apis at the AWS end of things aren't they

Ben Hammond15:05:17

there's a

x-amz-glacier-version: 2012-06-01
header in some of the docs

quadron15:05:39

does turning tuples into a map destroy information about order?

danielglauser15:05:51

@veix.q5 Yes, maps do not guarantee order. If you need a sorted map I suggest looking at: http://clojuredocs.org/clojure.core/sorted-map

djtango16:05:02

Is this a bug?

user=> :0
:0
user=> ::0
:user/0
user=> (ns foo)
nil
foo=> (ns user)
nil
user=> (require '[foo])
nil
user=> ::foo/0
Syntax error reading source at (REPL:2:0).
Invalid token: ::foo/0

noisesmith16:05:10

:0 isn't meant to work, but happens to

hiredman16:05:17

that is actually a very complicated question connected to many mailing list posts, irc and slack discussions

tristefigure16:05:26

:foo/0 instead of ::foo/0 ? (already namespaced)

hiredman16:05:51

at one point :0 was made not to work, and then that change was reverted

djtango16:05:03

because leading numbers are invalid identifiers?

hiredman16:05:14

which you might interpret as positive intent that :0 is intended to work

djtango16:05:32

it's more that the autoresolving is the only one that doesn't work

hiredman16:05:34

but my advice would be to behave as if :0 doesn't work

noisesmith16:05:31

@djtango :0 was never designed to work, a version of clojure existed where it worked anyway, it was kept that way. ::foo/0 never worked because the issue was understood before ::foo/bar existed

djtango16:05:39

ok cool thanks

cjsauer21:05:06

Could someone remind me, I think I remember seeing a fn named something like requiring-resolve. Where would I find this :thinking_face:

noisesmith22:05:53

clojure versions 1.10+

cjsauer22:05:00

Okay, I’m on 1.10.0-alpha7. Is it in a specific ns? Intellisense is failing me…

noisesmith22:05:12

why use a 1.10 alpha?

noisesmith22:05:43

it's in clojure.core, I'm not sure if it was present in the 1.10 alphas or not, but it is present in the 1.10 release

cjsauer22:05:04

I see. Just haven’t gotten around to changing that version string quite yet. Thank you!

noisesmith22:05:35

oh, I might be wrong, it might be a 1.11 thing... - nope, definitely here in 1.10

$ clj
Clojure 1.10.0
(ins)user=> (requiring-resolve 'clojure.set/union)
#'clojure.set/union

👍 4
cjsauer22:05:17

Ah okay, that would at least explain why I can’t find it any of the usual channels

cjsauer22:05:10

Yep, there it is. Thank you.

Alex Miller (Clojure team)22:05:36

It was added till very late in the release cycle

seancorfield23:05:42

I think it was in one of the final Beta versions?