Fork me on GitHub
#clojure
<
2016-06-06
>
jimmy03:06:50

hi guys, is there any good lib to generate elasticsearch mappings from datomic schema ? thanks

hiredman04:06:44

you can avoid docker redoing stuff from scratch by not doing stuff from scratch, create an image or whatever it is called from the current state of your project and use that instead of whatever base you are currently using

danielstockton13:06:36

does anyone have an opinion on when to instrument a function with clojure.spec and when to add :pre assertions?

danielstockton13:06:19

im having trouble deciding which to use

anmonteiro13:06:20

if I’m dispatching a multimethod on a vector, e.g. (defmulti foo (fn [a b] [a b])) , can I specify a default value for one of the elements in defmethod ?

anmonteiro13:06:10

say I wanted to write a (defmethod foo [:a :default] [a b]) that would dispatch on all invocations for which the first argument is :a

emil0r13:06:34

Is there anyone who would like to help a poor soul wrestling with SOAP?

dpsutton13:06:15

@anmonteiro i can't check it but can you write a signature like (defmethod foo [:a _ ] (blah blah ...))

anmonteiro13:06:14

I’ll declare my dispatch vectors with [:foo :default] and in the default implementation, I’ll get-method for [a :default]

bhauman15:06:09

Would it be obnoxious to have lein figwheel clean the :target-path after someone changes the :dependencies in their project.clj?

fabrao18:06:19

Hello all, there is a library to work with OpenNMS, for monitoring platforms. So to use the instance of it in java we have to :

WSManEndpoint endpoint = new WSManEndpoint.Builder("")
                .withServerVersion(WSManVersion.WSMAN_1_0)
                .withStrictSSL(false)
                .build();
I saw the source code that is like :
... public class WSManEndpoint
{
  private final URL url;
  private final String username;
  private final String password;
  private final boolean gssAuth;
  private final boolean strictSSL;
  private final WSManVersion serverVersion;
  private final Integer maxElements;
  private final Integer maxEnvelopeSize;
  private final Integer connectionTimeout;
  private final Integer receiveTimeout;
  
  private WSManEndpoint(Builder builder)
  {
    this.url = builder.url;
    this.username = builder.username;
    this.password = builder.password;
    this.gssAuth = builder.gssAuth;
    this.strictSSL = builder.strictSSL;
    this.serverVersion = builder.serverVersion;
    this.maxElements = builder.maxElements;
    this.maxEnvelopeSize = builder.maxEnvelopeSize;
    this.connectionTimeout = builder.connectionTimeout;
    this.receiveTimeout = builder.receiveTimeout;
  }
  
  public static class Builder
  {
    private final URL url;
    private boolean strictSSL = true;
    private String username;
    private String password;
    private boolean gssAuth = false;
    private WSManVersion serverVersion = WSManVersion.WSMAN_1_2;
    private Integer maxElements;
    private Integer maxEnvelopeSize;
    private Integer connectionTimeout;
    private Integer receiveTimeout;
    
    public Builder(String url)
      throws MalformedURLException
    { ...
So, I trying to use it with:
(ns delldrac.core
  (:import (org.opennms.core.wsman WSManClient WSManConstants WSManEndpoint WSManVersion))
  (:gen-class))

  (.. (WSManEndpoint.Builder. "")
    (withServerVersion WSManVersion/WSMAN_1_0)
    (withStrictSSL false)
    (build))

clojure.lang.Compiler$CompilerException: java.lang.ClassNotFoundException: WSManEndpoint.Builder, compiling:(C:\Trabalho\delldrac\src\clj\delldrac\core.clj:21:7)
What I´m doing wrong?

d-side18:06:50

It's WSManEndpoint$Builder, I guess.

d-side18:06:32

It has to be imported explicitly though, it doesn't just get imported because it's nested in the already imported one. /cc @fabrao

fabrao18:06:40

humm, using like this

(:import (org.opennms.core.wsman WSManClient WSManConstants WSManEndpoint WSManEndpoint$Builder WSManVersion))
works. Sorry about my newbe question 😞

hiredman18:06:38

clojure has a number of features that generally get referred to as "java interop"

hiredman18:06:55

the problem is, the interop stuff with clojure is really for interop with the jvm, not with java the language

hiredman18:06:07

and it is not always obvious to people that there is a difference between what happens on the jvm, and features in the java language, and who knows what and where those differences are

hiredman18:06:13

java the langauge varargs, inner classes, generics, and I am sure others I am forgetting, are all places where the jvm differs from java the lanaguage

hiredman18:06:04

and in those places, clojure "java interop" exposes what the jvm does, not what java the language does

ghadi18:06:32

so for each one of those: varargs get handled as a trailing array param, inner classes become Foo$InnerBar, generic params become Object...

hiredman18:06:41

since java the language is an existence proof that java's interpretation can exist on the jvm, all we need is someone to write some crazy macros that implement java the language's view on top of clojure's built in jvm view

gfredericks18:06:11

(defmacro as-if-java [& body] ...)

dpsutton19:06:35

(defmacro as-if-scala [& body] ...)