This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2019-05-20
Channels
- # announcements (27)
- # aws (1)
- # beginners (62)
- # boot (5)
- # calva (56)
- # clj-kondo (6)
- # cljdoc (3)
- # cljsrn (4)
- # clojure (65)
- # clojure-dev (17)
- # clojure-europe (2)
- # clojure-italy (17)
- # clojure-nl (24)
- # clojure-spec (30)
- # clojure-uk (14)
- # clojurescript (35)
- # clr (7)
- # crux (18)
- # cursive (8)
- # data-science (3)
- # datascript (38)
- # datomic (15)
- # emacs (16)
- # fulcro (34)
- # hyperfiddle (1)
- # immutant (1)
- # luminus (7)
- # nrepl (1)
- # off-topic (38)
- # pedestal (2)
- # planck (10)
- # re-frame (7)
- # reagent (7)
- # reitit (9)
- # shadow-cljs (36)
- # sql (19)
- # tools-deps (11)
- # vim (64)
Another awesomeness of clojure, the code is so condensed you dont have to use a code block thing in anki thats likely to break at some point.
Hi. First time importing a Java package into a Clojure project, and I can't import a 3rd party library installed with lein
.
I am using this package https://github.com/googleapis/google-auth-library-java/blob/6698b3f6b5ab6017e28f68971406ca765807e169/oauth2_http/java/com/google/auth/oauth2/ServiceAccountCredentials.java#L32 and this class https://github.com/googleapis/google-auth-library-java/blob/6698b3f6b5ab6017e28f68971406ca765807e169/oauth2_http/java/com/google/auth/oauth2/ServiceAccountCredentials.java#L87
My project.clj
(defproject warehouse "0.1.0-SNAPSHOT"
:description "FIXME: write description"
:url ""
:license {:name "EPL-2.0 OR GPL-2.0-or-later WITH Classpath-exception-2.0"
:url " "}
:dependencies [[org.clojure/clojure "1.10.0"]
[clj-http "3.10.0"]
[com.google.auth/google-auth-library-oauth2-http "0.15.0"]]
:main ^:skip-aot warehouse.core
:target-path "target/%s"
:profiles {:uberjar {:aot :all}})
My namespace in warehouse/core.clj
(ns warehouse.core
(:gen-class)
(:require [clj-http.client :as client])
(:import (com.google.auth.oauth2 ServiceAccountCredentials)))
Evaling the buffer with core.clj with Cider gives me
Execution error (ClassNotFoundException) at java.net.URLClassLoader/findClass (URLClassLoader.java:436).
com.google.auth.oauth2.ServiceAccountCredentials
I can import Java utils successfully, for example (:import java.util Date)
I have run lein install
to confirm that the auth library is installed.If I want to use aws beanstalk, would it be wisest to use http-kit? I am currently using immutant with sente for websockets, haven't deployed it yet though.
since beanstalk uses apache tomcat. (http-kit?)
My request looks like this:
(client/post ""
{:debug true}
{:basic-auth ["api" "key-432432432432"]}
{:form-params
{:from ""
:to ""
:subject "Test"
:text "..."}})
(client/post ""
{:debug true
:basic-auth ["api" "key-432432432432"]
:form-params {
:from ""
:to ""
:subject "Test"
:text "..."}})
I deleted message because it was related to mailgun not to clojure itself.
Hi all, I have a defrecord
statement in one namespace and I’m trying to extend-protocol
with that record type in another namespace. I keep getting a ClassNotFoundException
though. How am I supposed to import/require/reference the record type?
I’ve tried:
- (ns foo (:require [my-project.other :as other])) (extend-protocol MyProtocol other/MyRecord)
- (ns foo (:require [my-project.other :as other])) (extend-protocol MyProtocol other.MyRecord)
- (ns foo (:require [my-project.other])) (extend-protocol MyProtocol my-project.other/MyRecord)
- (ns foo (:require [my-project.other])) (extend-protocol MyProtocol my-project.other.MyRecord)
- (ns foo (:import my-project.other.MyRecord) (extend-protocol MyProtocol my-project.other.MyRecord)
- (ns foo (:require [my-project.other]) (:import (my-project.other MyRecord)) (extend-protocol MyProtocol my-project.other.MyRecord)
But none of those worked yet…
Hmm, I might have figured it out. I tried using underscores in the import
statement and in the references rather than hyphens (for the containing namespace)
Yep, that was it. Final answer for me was:
(ns my-project.something
(:require [my-project.other])
(:import my_project.other.MyRecord))
;...
(extend-protocol MyProtocol
my_project.other.MyRecord
;...
Hello! Is someone here experienced with Etaoin? I know most of it is actions but in its documentation it doesn't provide a way to handle drop downs (for example, mouse hovering to open one of the dropdowns menus and then click it), or actions that are outside the scope of the documentation, I am new to clojure btw
@fmaldonado yeah, I use etaoin. I’m not sure if I have used dropdowns.
hey @borkdude, thanks for answering, has there been a test case in which you had to use something out of the scope of etaoin? is for references and knowledge, mostly
the code of etaoin is in essence just firing HTTP requests at the webdriver REST API, so whenever there is a limitation, it’s not hard to figure out how to work around it
I guess the easiest is one click to open it and one to select it. Haven't used etaoin for this, but recently did with selenium which is about the same. If you can change the html it's often the easiest to set an id. You can also use the chrome deftools to get the query for an element right.
thank you both for your answers, my doubts are quite specific tbh because of the new enviroment i've been working on
Can you please explain to me why this code raises "can only recur from tail position" ?
typically when compiling a function call the computer has to keep track of a return address to return to after computing the function. at certain locations in a program when there is a function call it turns out yo don't need to track the return address, those locations are often referred to as a tail call
a tail call is useful in that context because it can avoid the bookkeeping in a normal function call which means you can use them for constant space recursion
it very obviously isn't a tail call because the "recur" call needs to return to the evaluation of (+ ... ...) to continue
it's not a tail call if there are any operations in its function that are left to be done after it returns
more formally the continuation of the recur expression is not the same as the continuation of the whole function
anyone familiar with core.logic.permuteo
? would love to get an intuition about what it does
oh nvm
i think i got it
hey guys, I have this line on Java:
private final LocalServiceTestHelper helper =
new LocalServiceTestHelper(new LocalMemcacheServiceTestConfig());
how I transpile this to clojure interop?
(let [helper (LocalServiceTestHelper. (LocalMemcacheServiceTestConfig.))] ...)
or a def, depending on how it's being used
most of the time "move every paren one word to the left" does most of the work
I wasn't using dot on
LocalMemcaceServiceTestConfig
callI've seen a statement along these lines and am wondering if there is any reason to use the assert
rather than just throw
ing an exception
(I have written code that uses asserts like that from time to time, but it is a lazy habit)
asserts in theory are checks that can be turned off, there is some var you can set to turn them off, in which case the above code will be incorrect
@mitchell_clojure another variation: (do (assert (not= u1 u2) "unsupported operation") q)