Fork me on GitHub
#clojure
<
2022-06-29
>
joss03:06:28

which libraries for SSH client?

dpsutton04:06:23

We use Apache sshd core

👍 1
dpsutton04:06:28

It's Java interop

jjttjj04:06:09

I like https://github.com/hierynomus/sshj (also via interop)

👀 1
👍 1
pinkfrog05:06:06

Hi. What’s the difference between these two lines. Seems they are merely altering the place.

hiredman05:06:37

On exception the first leaves the entry in the queue

pinkfrog05:06:10

That’s interesting.

hiredman05:06:15

That is what retrying does, if there is an error loading a given namespace, that namespace is left in the queue so it is reloaded again the next time a reload is triggered

Geekingfrog10:06:51

I'm looking at the code for timbre (specifically, [this line](https://github.com/ptaoussanis/timbre/blob/master/src/taoensso/timbre.cljc#L778) ) and I'm very confused by the &form, where does this thing come from? What is it?

rolt10:06:21

&form (and &env) are available in defmacro,. &form is the actual form

jpmonettas10:06:28

FlowStorm debugger 2.2.99 is out with new features FlowStorm is a Clojure and ClojureScript debugger. Last release (2.2.99) includes a bunch of new features, and fixes : • Browser now support instrumentation/uninstrumentation of vars and namespaces (single and multiple) • Instrumenting from the repl synchronize with the browser (for everything but #trace) • Added a context menu on locals to define vars from values • Added jump to first and last traces on thread controls (useful for exceptions debugging) • Added print-level and print-meta controls on pprint value panels • Improve re-run flow UX • Namespace instrumentation now accepts :verbose? to log known and unknown instrumentation errors details • Added flow-storm.api/uninstrument-forms-for-namespaces to undo instrument-form-for-namespaces instrumentation • Added #rtrace0 ... #rtrace5, like #rtrace but with different flow-ids • Added double clicking on flows functions window to execute show-function-calls If you have any questions or ideas, there is the #flow-storm slack channel now! Github repo : https://github.com/jpmonettas/flow-storm-debugger/ Cheers!

vlaaad10:06:08

You can also post that in #announcements?

jpmonettas13:06:04

oh yeah, will do it! thanks @U47G49KHQ

seancorfield16:06:15

Deleted from #clojure since announcement don't belong here. There's also #releases for small/repeated updates to libraries. #announcements is intended for major releases and we encourage folks to only post there once a month at most.

jpmonettas16:06:27

np, sure, didn't knew about that @U04V70XH6

runjorel13:06:21

Hi all, does anyone have any experience with a project that is primarily clojure but has some kotlin code mixed in? Think I just don’t understand how to compile kotlin source so that my clojure code can pick it up. This may be a bad idea. Just have a PoC that I am working on and while I could write some Java interop, I’d rather use Kotlin.

runjorel13:06:36

This good. I think what I need to figure out is how to use clj build tools to compile kotlin in my local source folder so that I can import it in my clojure code.

delaguardo14:06:12

One option would be to compile kotlin sources into a jar and include this jar into deps.edn as a local dependency using :local/root

runjorel14:06:01

that makes sense. I will check that out. thanks

jpmonettas14:06:04

@U9EAK7JJG or you can add maybe on your deps.edn :paths ["src" "kotlin-classes-folder"] , that should bring all compiled classes into your classpath. I guess that depends on how frequently you are recompiling the kotlin sources

runjorel14:06:06

Oh really! Ok that is more of what I was looking for. I'll give that a shot. I didn't think it could be that simple

jpmonettas14:06:10

I know everything you put there will end up in your classpath, but haven't tried it myself

runjorel14:06:43

im just getting through some meetings and then ill post back to confirm

delaguardo15:06:00

There is one problem with both solutions - after recompiling you have to restart your repl to ensure classes are not cached. I don't think there is an easy way to have hot reloading

runjorel14:07:07

well just to circle back, I never did find a way to make this completely “just work”. I added the src directory, I manually compiled kotlin files, etc. Cursive even had autocompletion for my kotlin classes. However, I had issues: • I couldn’t access Kotlin files in the repl (even after I compiled them and sent them to target). The URLClassLoader couldn’t find them. • I had some classpath issues getting the Kotlin compiler to see libraries I pulled from deps.edn. I think once I figure out the claspath this can be resolved. Perhaps if I took some time to investigate how Corfield built his java build functionality I can do the same for kotlin.

jpmonettas16:07:55

damn, maybe the easiest then is just pack kotlin classes into a jar and then just reference it with :local/root in deps.edn then. You can create a script to do all that, and will have to restart the repl after changing kotlin files but that should work

jpmonettas16:07:24

or you can go all in and try to figure out the classloaders issues, which sounds like a nightmare

dpsutton15:06:56

I’m working with c3p0 connection pooling. I want to add a ConnectionCustomizer to monitor the lifecycle of connections. The library wants that to be passed by class name as a property and then it instantiates it. So I’m registering it as "connectionCustomizerClassName" (.getName ConnectionCustomizer) where ConnectionCustomizer is a defrecord implementing the interface. Yet when c3p0 is calling Class.forName( className ).newInstance(); it is throwing a java.lang.ClassNotFoundException: metabase.driver.sql_jdbc.connection.ConnectionCustomizer. I am able to construct a class in this manner: (.newInstance (Class/forName (.getName ConnectionCustomizer))) so I suspect I have a classLoader issue. But I’m not sure how to resolve that issue. Does anyone have any pointers?

hiredman16:06:32

you can try setting the context classloader to whatever (clojure.lang,RT/baseLoader) returns

dpsutton16:06:44

I’m not sure how to do that i guess. Their docs state: > To install a ConnectionCustomizer just implement the interface, make your class accessible to c3p0's ClassLoader, and set the configuration parameter below:

dpsutton16:06:47

You can set a property contextClassLoaderSource > Must be one of caller, library, or none. Determines how the contextClassLoader (see java.lang.Thread) of c3p0-spawned Threads is determined. If caller, c3p0-spawned Threads (helper threads, java.util.Timer threads) inherit their contextClassLoader from the client Thread that provokes initialization of the pool. I’ve set this to caller explicitly and it still doesn’t seem to work

hiredman16:06:06

you then need to use https://docs.oracle.com/javase/7/docs/api/java/lang/Thread.html#setContextClassLoader(java.lang.ClassLoader) to set the context classloader on thread where c3p0 is called to a classloader where clojure stuff defined dynamically is visible, like the one returned by RT/baseLoader

👀 1
zimablue16:06:22

what is the best practise for modelling hierearchical one-parent<->many-children relationships in datomic-likes? we could put the attribute on either side, I see that the guidance is to only put it on one side which makes sense, the few examples I can find seem to always have it on the child. References to good material also appreciated

rolt17:06:52

it's been a while, but if i remember correctly it's easier to put a relation of cardinality one on the children to the parent, than a many from the parent to the children, for the simple reason that in the second case you'd be modelling a many-to-many

zimablue17:06:50

Thanks that's a clever answer, a one to many contains l constraint can only be expressed on one side I didn't think of that