Fork me on GitHub

quick question when I connect to an aws db do I need access keys? or can I just connect with user and pass?


You just need the username and password. You can build a JDBC URL based off of that and create a connection just like connecting to any other DB


@admay It's better to use :dbtype and :dbname with :user and :password rather than trying to build the JDBC URL yourself.

seancorfield01:12:14 tries to make connecting easier by figuring out the URL for you.


@josh_tackett Which AWS DB are you using? I haven't tried it myself but should have no problem connecting to their MySQL-variant and at least one person has used it with RedShift (it's given as one of the examples in the README for If you have problems, head over to #sql and ask as I'm more likely to see it there.


@seancorfield No worries it was just an inbound configuration issue. FYI Amazon sets the default inbound rule for mysql to your IP address used when setting up the RDS instance

New To Clojure11:12:12

Is there a way to dump all data of JVM to start new JVM instances with the same initial data (state)?


I don’t think so


maybe you can run the JVM in a container/VM and save and reload the container


yeah I dont think it can be done, but it looks interesting. What are some use cases where this might be needed/useful?

New To Clojure13:12:20

@pcbalodi First use case is troubleshooting of a rare bug.


ah nice, that will be good


Depending on the type of the bug, you can take a heap dump and try analysing it

New To Clojure16:12:53

@vijaykiran In gdb? It's C, not Java.


hmm - I thought you were talking about JVM


that would be super complicated given all the file descriptors and other OS resources the JVM would have

Alex Miller (Clojure team)17:12:38

People have actually been working on this for years - they used to be called Isolates but I think they have a new name now


I tried seesaw with a hello world app, and though it is simple to use I didn’t like the start-up time of the app. Is there some library which can create a GUI that starts up instantly, like say electron apps do?


How are you starting your app?


While clojure startup time isn’t anything to brag about generally, tools like lein add meaningfully to the startup time. You probably want to build an uberjar and run it via java directly, as well as choose your jvm-opts judiciously.


@donaldball yes I did lein run. I’ll try the uberjar method and see. I also couldn’t figure out why a java app called ‘main’ starts up before my app. Actually I am a C/C++ person, and am not aware of Java’s quirks


the “java app” is your process - clojure is a java library that generates and runs byte code in the jvm. “main” is a default name because neither you nor seesaw changed the default.


leiningen is a shell script which in your case runs java in order to calculate a classpath, then runs a second java process with that classpath in order to run your clojure program


@noisesmith thanks a lot. Your explanations are very helpful.

Oleh K.18:12:25

I've got an error compiling cljs with node dependencies: node_modules/firebaseui/dist/firebaseui.css: Unexpected token, expected ( (1:8) Anybody knows what to do with this?


How much loc your productivity daily avg? and avg. how much loc one project in Clojure? (eg. with/out macros)

Alex Miller (Clojure team)19:12:50

git deltas on last 3 days:

3 files changed, 105 insertions(+), 41 deletions(-)
9 files changed, 63 insertions(+), 60 deletions(-)
2 files changed, 33 insertions(+), 36

Alex Miller (Clojure team)19:12:14

some of those lines required multiple hrs of research and/or testing :)


on a good day I can add 5 new features while reducing line count by about 300 lines


but “line” and “feature” are both kind of fuzzy metrics


Yeah, I generally consider it a very productive day if I've added functionality and reduced the overall number of lines!


@sb I'm always happy to share our code base stats:

Clojure build/config 43 files 2150 total loc
Clojure source 243 files 56183 total loc,
    3099 fns, 710 of which are private,
    372 vars, 41 macros, 47 atoms,
    440 specs, 11 function specs.
Clojure tests 145 files 19484 total loc,
    23 specs, 1 function specs.


daily what is the optimal at different levels? eg. beginner, senior? (eg. reagent/re-frame/sente application)


I don't think the LOC metric is at all useful (other than a vague measure of overall code base size). A daily metric is just nonsense.


"daily productivity" is a terrible concept in general, to be honest.


Ok, in this case, how can I compare with myself?


Because I see.. one project size (at my case 3-5k loc)


I don’t know, what is really the normal metric. I totally understand what you wrote now.


In some ways, with Clojure, I might expect a senior developer to produce more functionality with fewer lines of code than a beginner -- because a senior dev will often write more concise, more idiomatic code.


Also, Clojure emphasizes "hammock time" -- thinking carefully about a problem, exploring code via the REPL, and only then writing the actual production code.


True. I do it in similar way.


Ok, that was a bad question 😄 .. just I want to check myself.


If your team is Agile and doing some sort of story point estimation -- and is good at estimation (which most teams aren't!) -- then you could compare productivity in terms of story points completed. But even then I'd consider it a suspect metric.


Thanks, that is great idea! I’m still alone (learn Clojure).


You'll probably find, at first, that you're very slow to write Clojure code -- unless you have an FP background it is very alien.


Over time, you'll find yourself solving problems faster -- but probably with less code 🙂


Yes, I feel that. 🙂


Thanks 👍


We actually track those stats I posted, updating a file in git every Monday. A quick scan of diffs suggests that two senior Clojure devs are usually producing about 300 lines of Clojure source a week and about 100 lines of Clojure tests.


That said, there are weeks where our source lines went up by 1,000 and other weeks where it went down by 300!


Thank you very much this information, very useful for me!!




I feel myself a little bit better. 😉


The build/config stuff is our build.boot file and all our EDN config files (which control a lot of app behavior, as well as specifying each subproject's dependencies).


so i've got this list of objects, that I want to map to a hash of {:(.getKeyword object) (.getText object)}, should I be looking at juxt or is there an easier / more idiomatic way of doing this


🎶 ...and a macro in a sexp… 🎶


.getKeyword and .getText will return strings


I assume the : in your example is illustrative - does that mean you need the string to be converted to a keyword?


the simplest thing is going to be (fn [o] {(keyword (.getKeyword o)) (.getText o)})


juxt would still require fn wrappers around the methods and then into to create a hash-map

Alex Miller (Clojure team)20:12:41

you could do something like (apply keyword ((juxt :keyword :text) (bean o)))

Alex Miller (Clojure team)20:12:03

if you’re looking to impress your friends rather than make it readable :)


aieeee, I always struggle with java interop. Dear clojurist friends, I have a really stupid question: I'm trying to import this java class. i have no problem importing and using the normal Jsoup class, but I can't seem to figure out the right ns form to import the examples.HtmlToPlainText class. I've tried (:import [org.jsoup Jsoup HtmlToPlainText]) and I've tried

(:import [org.jsoup Jsoup]
           [org.jsoup.examples HtmlToPlainText])
but in both cases the compiler throws ClassNotFoundException. Does anyone feel like cluing me in?


@gowder how are you pulling in the jsoup dep for your project?


also - is that :import inside your ns form or stand alone?


because I would expect that error if using the keyword outside the ns


@noisesmith off maven, via lein [org.jsoup/jsoup "1.11.2"] --- and yes, in my ns form.


then you are doing something else wrong - those are the two likely issues


I'm wondering now if the examples stuff just isn't in what's on maven


are you sure you restarted since editing your deps?


because I tried to pull in another subpackage and it didn't throw

(ns cleanup-case.core
  (:import [org.jsoup Jsoup]
           [org.jsoup.helper StringUtil]
           [org.jsoup.examples HtmlToPlainText])
the helper one didn't blow up...


you could look inside the jar - the classpath will show where the jar is on your file system


Hmm, I am having trouble filtering/mapping with a static method. (ChunkHelper/isText (first chunks)) works fine, but (filter ChunkHelper/isText chunks) errors with CompilerException java.lang.RuntimeException: Unable to find static field: isText in class,


@slack1478 static methods are not first class, you can’t put them on the stack so you can’t pass them as an argument to filter


you need to create a function that calls the static method


(filter #(ChunkHelper/isText %) chunks) seems to work


oooh. that is indeed the problem (and now I just learned how to look in a jar file... cool)


@gowder yeah they are zip files, even emacs and vim can open and peek inside 😄


hmm. I wonder what will happen if I just compile jsoup myself and then stick that example class on the classpath. terrible things, probably...


@gowder you can build and install to your local cache using maven, right? but if you are collaborating with others you probably want a private repo you can deploy to


or just use an artifact that exists


Thanks for all your help @noisesmith @alexmiller and @tsulej - i made this little module for reading and writing png metadata


its really messy, and i think i can remove some of the deps, but it works


from the perspective of someone new to clojure, its looks nice and clear to me! that’s a fun project


@slack1478 a couple of small things - line 22/23 you can replace (map …) (flatten) with (mapcat …)


mapcat is like map but concatenates all the results into a sequence - it’s less aggressive than flatten and preferable when it works


or, instead of mapcat or flatten, you can use (into {}) instead of (apply hash-map)


its kinda crazy I had to use pngj for reading metadata supposedly because I didn't understand how IIOImage works... and honestly I'm not sure if I should be using javax/iioimage, pngj, or apache commons imaging


they all kinda are broken in different ways


as a very minor detail, on line 52 you don’t need to call vec on the metadata - reduce can use any collection directly that vec works on


or I had trouble understanding them / trawling through javadocs


@slack1478 two points from my side: 1) you read file twice, for image and for metadata - can be optimized to read once; 2) metadata is hash-map, you don't need to convert it to vec and operate on pairs (I think)


however reading once can be impossible here...


you would need to do that if you want keywords though


(regarding point 2)


@tsulej for 1) its a bit tricky since i am using two different libraries for reading and writing


best thing to do would be consolidate, then I can have it only read once


like, I can reduce the (File.) redundancy now