Fork me on GitHub
#beginners
<
2017-05-04
>
fingertoe00:05:40

I think I figured it out. (.addJobSelectionCriteria list JobList/SELECTION_PRIMARY_JOB_STATUS_ACTIVE, Boolean/TRUE)

donaldball00:05:33

(= true Boolean/TRUE) fwiw

fingertoe00:05:34

Ah, Okay. Something isn’t quite right, but I think I am getting closer!

seancorfield01:05:57

@fingertoe One thing to watch out for there is that .addJobSelectionCriteria has a void return type so it updates the list without returning it. You might find doto helpful here.

fingertoe02:05:35

It returns nil when I call it from clojure. It’s supposed to change the underlying java object so when I ask it to .getJobs it gives me a specified subset.. Not sure it’s working, but you guys got me moving in the right direction. doto does look handy..

chrjs15:05:48

Hey good folks. Relative noob doing a little performance profiling here. Could anyone confirm that if I’m spending a lot of time in clojure.lang.RT.ClassForName (as determined by jvisualvm profiling), I’m probably not being smart w.r.t. reflection somewhere?

tbaldridge15:05:40

@chrjs depends what's calling that function, I'd walk up the stack and see what the parents of that function call are

tbaldridge15:05:22

you can also see a lot of calls to that method if you're profiling the compiler (which you probably shouldn't)

chrjs15:05:17

Sagely advice, thanks @tbaldridge. I’m not profiling the compiler 😉

noisesmith17:05:03

yeah - the time out argument to start profiling is your friend there (I’ve been doing a lot of profiling lately…), because by waiting to start the profile you can skip all the clojure.core compiling your code stuff

noisesmith17:05:44

also, if you use leiningen, look at the output of lein check, and see if the code it points out as using reflection shows up as hot spots in profiling - if so it could benefit from type hinting

fingertoe20:05:30

I keep getting SQLException No suitable driver found for jdbc:mysql: when Attempting to connect to mysql.. I have a [mysql/mysql-connector-java “5.1.38”] in my project.clj I am pretty sure I am missing something obvious..

seancorfield21:05:39

fingertoe: What does your db-spec look like in the java.jdbc function call?

fingertoe00:05:15

(def mysql-db {:classname “com.mysql.jdbc.Driver” :subprotocol “mysql” :subname “http://sdb.cgibberihr.us-east-1.rds.amazonaws.com” :user “user” :password “passything”}))

seancorfield00:05:41

I think your :subname is the wrong format so the JDBC connection string is illegal when it is built.

seancorfield00:05:22

I strongly recommend using the simpler and more modern form of db-spec, with :dbtype and :dbname (and :host / :port if needed).

seancorfield00:05:50

Looking at your :subname I don’t see a database name (and it doesn’t start with // which it should).

seancorfield00:05:18

Try something like

(def mysql-db {:dbtype "mysql" :dbname "whatever"
               :user "user" :password "passything"
               :host ""})

seancorfield00:05:48

(with "whatever" replaced by your actual database name)

seancorfield00:05:53

I added this format because so many people get :subname wrong…

seancorfield00:05:21

This also takes care of the driver name since clojure.java.jdbc knows all the common ones anyway.

fingertoe00:05:54

Good improvement. I am not on to Invalid password. 😉

fingertoe00:05:16

I think I am victorious! Thanks for your help…