Fork me on GitHub
#beginners
<
2021-10-12
>
Alex Miller (Clojure team)00:10:40

You might also want to look at java.util.Scanner

Michael Stokley02:10:33

i'm running into an error trying to start a repl for a project via the clj command line tool

Error building classpath. Could not acquire write lock for 'artifact:tractsoft:beekeeper:0.1.1'
java.lang.IllegalStateException: Could not acquire write lock for 'artifact:tractsoft:beekeeper:0.1.1'
i'm not seeing much discussion of this on forums. has anyone run into this?

Michael Stokley02:10:16

here's the full trace

Error building classpath. Could not acquire write lock for 'artifact:tractsoft:beekeeper:0.1.1'
java.lang.IllegalStateException: Could not acquire write lock for 'artifact:tractsoft:beekeeper:0.1.1'
	at org.eclipse.aether.internal.impl.synccontext.named.NamedLockFactoryAdapter$AdaptedLockSyncContext.acquire(NamedLockFactoryAdapter.java:146)
	at org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolveArtifacts(DefaultArtifactResolver.java:229)
	at org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolveArtifact(DefaultArtifactResolver.java:209)
	at org.apache.maven.repository.internal.DefaultArtifactDescriptorReader.loadPom(DefaultArtifactDescriptorReader.java:240)
	at org.apache.maven.repository.internal.DefaultArtifactDescriptorReader.readArtifactDescriptor(DefaultArtifactDescriptorReader.java:171)
	at org.eclipse.aether.internal.impl.DefaultRepositorySystem.readArtifactDescriptor(DefaultRepositorySystem.java:257)
	at clojure.tools.deps.alpha.extensions.maven$fn__1053.invokeStatic(maven.clj:132)
	at clojure.tools.deps.alpha.extensions.maven$fn__1053.invoke(maven.clj:122)
	at clojure.lang.MultiFn.invoke(MultiFn.java:244)
	at clojure.tools.deps.alpha$expand_deps$children_task__746$fn__748$fn__749.invoke(alpha.clj:406)
	at clojure.tools.deps.alpha.util.concurrent$submit_task$task__479.invoke(concurrent.clj:34)
	at clojure.lang.AFn.call(AFn.java:18)
	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
	at java.base/java.lang.Thread.run(Thread.java:829)

Alex Miller (Clojure team)02:10:05

what version of the CLI are you on?

Alex Miller (Clojure team)02:10:18

and can you share your deps.edn with me?

Michael Stokley02:10:34

~/projects/one-deps-repl(main *%) $ clj -version
Clojure CLI version 1.10.3.967

Alex Miller (Clojure team)02:10:22

latest is 1.10.3.986 and you might want to try updating to that, but in the case it's still happening, you can add -Sthreads 1 and that may also help

šŸ‘€ 1
Alex Miller (Clojure team)02:10:47

I have an open issue for this, would appreciate any repro info before you update if you are able to share deps.edn

Michael Stokley02:10:04

ok, i updated the CLI

Michael Stokley02:10:08

got a whole new error

Michael Stokley02:10:37

i will now try -Sthreads 1

Alex Miller (Clojure team)02:10:14

well that's not going to help you with that error - it's just not finding the artifact in the s3 bucket, which could be permissions or something else

Michael Stokley02:10:56

ah, ok. that gives me a direction to go in. thank you!

Alex Miller (Clojure team)02:10:59

:bucket "mt2-maven", :path "tractsoft/beekeeper/0.1.1/beekeeper-0.1.1.pom"

Alex Miller (Clojure team)02:10:42

I would hold off on the threads thing until you see something that looks like a concurrency error

šŸ‘ 1
Alex Miller (Clojure team)02:10:10

this is probably well beyond "beginners", feel free to follow up in #tools-deps

Michael Stokley02:10:42

i've graduated out of the beginners channel :star-struck:

šŸŽ“ 5
clojure-spin 1
Frederico Benevides08:10:25

Hi. I'm getting this error No value supplied for key: true while using :require to load two namespaces. If I require just one, the code works. My code:

(ns manjaro.main                                                                                                      
  (:require [manjaro.pacman :as pacman                                                                                
             manjaro.yay :as yay]))
Does anyone have some idea?

lispyclouds08:10:35

it needs to be two vectors like this:

(ns manjaro.main                                                                                                      
  (:require [manjaro.pacman :as pacman]                                                                                
             [manjaro.yay :as yay]))

šŸ™Œ 1
Lycheese10:10:48

Hi, I have the following function where I have to iterate over a map inside an and :

(let [attrs {:type "synonym"}
      entry {:tag :name :attrs {:type "primary"}}]
  (when (and true (for [attr-key (keys attrs)]
                    (= (attr-key attrs) (attr-key (:attrs entry)))))
    (prn "test")))
I think it essentially boils down to (when (and '(false)) (prn "test)) , but I'm not sure how to get the values out of the list.

Fredrik10:10:41

Instead of looping over each attribute, you can pull out all attributes and compare them to the desired ones

Fredrik10:10:57

(let [attrs {:type "synonym"}
      entry {:tag :name :attrs {:type "synonym"}}
      entry-attrs (:attrs entry)]
  (= attrs (select-keys entry-attrs (keys attrs))))

Lycheese10:10:15

That makes so much more sense than what I was doing. Thank you very much.

Fredrik10:10:33

A direct answer to your original question is to use (every? true? ...) , but for this particular problem I'd do it this way instead šŸ™‚

GVF13:10:37

Hi! Newbie here running into issues when trying to run migrations from this project https://github.com/dking1286/joyful_clojure/tree/master/03_clojure_application_development in lein. this works:

(load "db/migration")
(in-ns 'db.migration)
(migrate-up!)
but this doesn't:
(in-ns 'db.migration)
#object[clojure.lang.Namespace 0x298f9e91 "db.migration"]
db.migration=> (migrate-up!)
CompilerException java.lang.RuntimeException: Unable to resolve symbol: migrate-up! in this context, compiling:(/private/var/folders/qx/b7z7n0r10612_85l9btz2x5w0000gn/T/form-init7653181204673703865.clj:1:1) 
is this expected? do I need to load every file in order to be able to run it?

Alex Miller (Clojure team)13:10:36

yes, without some kind of load or require, the vars are not available in the Clojure runtime

šŸ‘ 1
David Pham15:10:41

Anyone would know how to make an http request with Kerberos authentication?

David Pham15:10:05

I think I could find a way to wrap Java code to make it work, but I wondered if there was any solution that was compatible with the main http client like in clj-http or org.httpkit.client?

noisesmith16:10:07

I think a good example to copy would be the aws-api lib from cognitect https://github.com/cognitect-labs/aws-api - they use their own http client which oddly I can't find the repo for, but the general idea should translate regardless of the client lib.

David Pham16:10:19

Maybe could you je more precise? I have absolutely zero knowledge in authentication

noisesmith16:10:06

"authentication" is a very broad concept. I don't think you can really generalize it. Usually the way I break this down for a specific API is to figure out the API calls I need (usually a series of http calls that create a context with the server then acquire a token), then how to use the result (eg. attaching the the token I acquired as a payload to another http request).

noisesmith16:10:32

oh! I think I misunderstood your question - if what you want to know is specifically about how to interact with kerberos I didn't offer anything useful

noisesmith16:10:19

you mention wrapping the java code - that's what I'd do actually, just use a java lib for kerberos auth via interop

šŸ‘ 1
popeye16:10:56

(def a [{:a "a", :price 200} {:b "b", :price 200}]) I have a vector above and I wanted to sum up the price and output is 400 Initially I thought (apply + (:price a)) should work, what am I doing wrong ?

Fredrik16:10:15

Let's break it down into two steps. First we want to extract all the prices, then sum them together. First step: How do you go from [{:a "a", :price 200} {:b "b", :price 200}] to a list of prices?

popeye16:10:24

price should sum up

Apple16:10:05

(apply + (map :price a))

šŸ™Œ 1
roelof18:10:08

I think I ask earlier but I cannot find the answer back. are there any good free tutorials to learn how to make a website

bhenry19:10:59

iā€™m long out of the game, but i remember https://figwheel.org/tutorial getting me going easily.