Fork me on GitHub
#clojure
<
2015-10-19
>
escherize00:10:08

I just realized keywords can have spaces in them. Would I ever use this for anything but ahem job security?

jtackett01:10:29

Hey can someone help me create and add a jar file to my lein local repo for use in another project?

fitzoh02:10:48

@jtackett: my first thought was to use maven to install it locally. Googling leads me to believe that’s probably the right way to go

fitzoh02:10:13

@jtackett: What issues are you having?

jtackett02:10:38

looks like it can’t find the jar files in the maven repo after installing them using that library

fitzoh02:10:27

do they show up when you use lein localrepo list , or not at all?

jtackett02:10:17

they show up with this command:

jtackett02:10:21

lein localrepo coords SSAM-1.0.jar SSAM-1.0.jar SSAM/SSAM 1.0

jtackett02:10:43

don’t show up on the list though

fitzoh02:10:07

Yeah, that command just looks at the jar and guess what the coords should be

jtackett02:10:17

how do I add them to the list?

fitzoh02:10:27

lein localrepo install [-r repo-path] [-p pom-file] <filename> <[groupId/]artifactId> <version>

fitzoh02:10:30

so probably

fitzoh02:10:48

lein localrepo install SSAM-1.0.jar SSAM/SSAM 1.0

fitzoh02:10:30

the examples are

$ lein localrepo install foo-1.0.6.jar com.example/foo 1.0.6
$ lein localrepo install foomatic-1.3.9.jar foomatic 1.3.9
$ lein localrepo coords /tmp/foobar-1.0.0-SNAPSHOT.jar | xargs lein localrepo install

jtackett02:10:48

and once they are on the list, they should work in the project?

fitzoh02:10:48

Assuming the plugin works like it says it does (never used it before)

Shantanu Kumar05:10:20

@jtackett: Hi, author of lein-localrepo here. Did it work for you?

Pablo Fernandez09:10:12

Does anybody know how you are supposed to set the delivery-settings for clojurewerkz mailer?

martinklepsch15:10:56

What’s the jvm option I need to set again when (pst *e) just returns a single line?

martinklepsch15:10:14

-XX:-OmitStackTraceInFastThrow simple_smile

gtrak16:10:51

that's something that's been bugging me for years that I always took for granted... thx for that one

gtrak16:10:24

I thought that would fix this for me, but it doesn't (+ nil nil), what's going on?

gtrak16:10:34

ah, nevermind, it's right simple_smile, thanks

Pablo Fernandez16:10:30

Is there something like delayed_job for clojure that can store the queue of tasks in PostgreSQL?

donaldball16:10:35

onyx may suit your needs, though it’s far more ambitious in scope than delayed_job and friends

Pablo Fernandez16:10:57

It might work, but it seems a bit overkill for sending emails in background.

abhayarawal18:10:27

hey guys. I’ve got a performance question. It’s on stackoverflow. Read the section after UPDATE in the question. http://stackoverflow.com/questions/33218783/clojure-reducer-map-not-working

gtrak18:10:32

my guess is the work of max is trivial compared to fork/join overhead

gtrak18:10:03

try tesser, which removes that overhead: https://github.com/aphyr/tesser

gtrak18:10:57

or don't do it in parallel, or try experimenting with the 'n' parameter in '(r/fold n combinef reducef coll)'

gtrak18:10:36

also I find this really suspect: ([t1 t2] (map max t1 t2)))

gtrak18:10:59

the work is being done in the call to into, that's why it makes such a big difference

gtrak18:10:11

try mapv to keep it eager

gtrak18:10:43

you shouldn't mix laziness and reducers

jfntn19:10:25

Is there a way to spit clojure code to a file that will write multiline strings literally, i.e. without the \n’s over multiple lines?

jaen19:10:52

If there's a multimethod that dispatches on class and I want to add Clojure maps to that what should I dispatch on? Wouldn't PersistentArrayMap be to specific?

thheller19:10:16

@jaen I'd recommend to stick to interfaces

thheller19:10:27

you might get PersistentArrayMap or PersistentHashMap

thheller19:10:40

java.util.Map would work

thheller19:10:11

or clojure.lang.IPersistentMap

jaen19:10:24

But class will return concrete class, not the interface right, so I won't be able to dispatch or that.

jaen19:10:37

I guess I'll just change the map to a record then

thheller19:10:23

@jaen: just verified. it works with clojure.lang.IPersistentMap

jaen19:10:31

@theller: thanks, though I think I'll just go with creating a record, since class for map returns the concrete class, not the interface/protocol and I won't have to change the multimethod definition if I do that.

thheller19:10:21

@jaen can also use clojure.lang.ILookup

thheller19:10:24

records implement that

jaen19:10:06

Right, but what I mean is the fact that the multimethod I have to work with dispatches on class, so I can't use interface as a dispatch value

thheller19:10:21

yes you can?

jaen19:10:43

Huh, then maybe I'm misunderstanding something

jaen19:10:31

I guess then equals of classes takes interfaces into account?

thheller19:10:43

it doesn't dispatch in equals

jaen19:10:15

So I'm a bit confused how it works then

jaen19:10:26

If the dispatch value is different from the value returned by class

jaen19:10:28

And yet it works

bensu19:10:18

@jaen @thheller if you are dispatching on class, isn't there a way to get that working with a protocol?

thheller19:10:45

@bensu not sure? can a protocol dispatch on an interface? never tried that

jaen19:10:47

@thheller: right; I've just checked out clojure.lang.MultiFn and it walks the parents of the value and for classes that happens to be superclasses and interfaces.

jaen19:10:56

So I understand what's going on now

thheller19:10:03

@bensu seems to work too 😉

bensu19:10:30

@thheller: great! then I would recommend using a protocol since it's faster

swizzard22:10:56

hey so i’m currently checking (if (= :running @(:state component) in 3 separate places in one looping function, which seems crazy?

cfleming22:10:52

Does anyone know of a ClassLoader that I could use to load classes from a jar, which is not a URLClassLoader?

doug kirk23:10:24

@cfleming URLClassLoader is still the best CL to use; it's the default loader for the JRE

cfleming23:10:50

@kirked: I know, but I have a kind of specialised use case.

cfleming23:10:02

I’m isolating leiningen using shimdandy.

cfleming23:10:24

Leiningen uses dynapath which allows modifying the classpath of URLClassLoaders

cfleming23:10:46

I need to stop it doing that, and the only way I can see of doing that is to use a different type of CL.

cfleming23:10:24

Perhaps I’ll just copy the URLCL code to my project and use that.

doug kirk23:10:10

Subclass URLClassLoader and override addURL to silently ignore additions (?)

cfleming23:10:36

Then lein won’t work, since it will try to load plugins etc and they won’t be there.

doug kirk23:10:24

Ideally, lein would use a CL for its work and plugins, and another for repl and compilation

doug kirk23:10:41

Cause then you can dump the CL and everything it has can be GC'd

doug kirk23:10:52

But I admit I don't know what it's doing

cfleming23:10:56

That’s basically what ShimDandy gives me.

cfleming23:10:09

I create an isolated CL tree, which I ditch after calling lein.

cfleming23:10:42

The problem is that the root of that tree is modifiable, and lein (via dynapath) adds things as high up the hierarchy as it can.

doug kirk23:10:46

Also note that they form trees; you can only pass a parent in the constructor, but if a child can't resolve a class it'll ask the parent if there is one.

doug kirk23:10:47

seems like the opportunity is in "as high up the hierarchy as it can"

cfleming23:10:12

Unless I hook dynapath, I can’t fix that.

doug kirk23:10:37

So you need a CL that disallows what, exactly? I musn't have understood

cfleming23:10:24

dynapath allows jars to be added to the classpath of classloaders that it recognises. Lein uses that to load plugins, middleware etc while it’s running.

doug kirk23:10:51

So you want one that dynapath doesn't recognize

cfleming23:10:18

The problem is that dynapath adds them as high up the hierarchy as possible, and it knows how to modify URLClassLoaders

doug kirk23:10:48

Go grab the source for URLClassLoader and give it your own name and package.

cfleming23:10:10

Thinking about it, I think I can subclass URLCL and then extend the dynapath protocol to say that my subclass is not extendable.

cfleming23:10:31

I’ll try that, and if not I’ll cut and paste the source.

doug kirk23:10:00

Yeah, as long as you can do that. instanceof checks of course will still give truth.

cfleming23:10:25

dynapath uses a protocol, so that should be ok

doug kirk23:10:13

There's also the close() method on URLCL. Dunno if that would help.

cfleming23:10:25

Ugly, but it should work.