Fork me on GitHub
#beginners
<
2022-06-18
>
xbrln06:06:29

Hello All, I need a small help with date time in Java Interop 🙂 I wanted to get the current date time in the format "yyyy-MM-dd HH:mm:ss" for timezone "Europe/Berlin" I was using https://github.com/clj-time/clj-time library to achieve it like this,

(require '[clj-time.core :as t]
	     '[clj-time.format :as f])

(f/unparse
  (f/formatter "yyyy-MM-dd HH:mm:ss")
  (t/from-time-zone (t/now) (t/time-zone-for-offset -2)))
I would like to know how to do the same with Java Interop ?

Martin Půda07:06:06

(.format (DateTimeFormatter/ofPattern "yyyy-MM-dd HH:mm:ss")
         (ZonedDateTime/now (ZoneId/of "Europe/Berlin")))

=> "2022-06-18 09:40:31"

xbrln08:06:45

Thank you 👍:skin-tone-3:

Lukas11:06:36

My cider-jack-in command has a 'duplicate key error' I can resolve this error with C-u M-x cider-jack-in and changing the command. But how can I make this change permanently?

practicalli-johnny12:06:59

A .dir-locals.el file in the root of the project can be used to affect the cider-jack-in command by setting variables https://practical.li/spacemacs/clojure-projects/project-configuration.html

❤️ 1
dpsutton14:06:23

What's the error? Is it in the deps map? And if so what is the duplicated key?

Lukas14:06:53

Yes it is

dpsutton14:06:13

Which key is in there twice?

Lukas14:06:42

nrepl-refactor (if i recall correctly)

practicalli-johnny15:06:32

A duplicate key error shouldnt occur unless one of the aliases being added to the default clojure command has a duplicate error itself. Without details this doesnt seem to be a cider issue, but a deps.edn configuration issue.

Lukas15:06:31

Ah goid to know I will later take a look

Lukas15:06:38

Thanks a lot

Lukas21:06:17

[nREPL] Starting server via /usr/bin/clojure -Sdeps '{:deps {refactor-nrepl/refactor-nrepl {:mvn/version "3.5.2"} nrepl/nrepl {:mvn/version "0.9.0"} refactor-nrepl/refactor-nrepl {:mvn/version "3.5.2"} cider/cider-nrepl {:mvn/version "0.27.4"}} :aliases {:cider/nrepl {:main-opts ["-m" "nrepl.cmdline" "--middleware" "[refactor-nrepl.middleware/wrap-refactor,cider.nrepl/cider-middleware]"]}}}' -M:cider/nrepl
error in process sentinel: nrepl-server-sentinel: Could not start nREPL server: Error while parsing option "--config-data {:deps {refactor-nrepl/refactor-nrepl {:mvn/version \"3.5.2\"} nrepl/nrepl {:mvn/version \"0.9.0\"} refactor-nrepl/refactor-nrepl {:mvn/version \"3.5.2\"} cider/cider-nrepl {:mvn/version \"0.27.4\"}} :aliases {:cider/nrepl {:main-opts [\"-m\" \"nrepl.cmdline\" \"--middleware\" \"[refactor-nrepl.middleware/wrap-refactor,cider.nrepl/cider-middleware]\"]}}}": java.lang.IllegalArgumentException: Duplicate key: refactor-nrepl/refactor-nrepl
how do I figure out, who is injecting these dependencies?

Lukas21:06:09

my project deps.edn

{:paths ["src" "resources"]
 :deps {org.clojure/clojure {:mvn/version "1.11.1"}
        instaparse/instaparse {:mvn/version "1.4.12"}
        org.clojure/data.csv {:mvn/version "1.0.1"}}
 :aliases
 {:test
  {:extra-paths ["test"]
   :extra-deps {org.clojure/test.check {:mvn/version "1.1.1"}
                io.github.cognitect-labs/test-runner
                {:git/tag "v0.5.1" :git/sha "dfb30dd"}}}
  :build {:deps {io.github.seancorfield/build-clj
                 {:git/tag "v0.8.2" :git/sha "0ffdb4c"}}
          :ns-default build}}}
and my ~/.clojure/deps.edn file is the standard template

Mc Arcady20:06:19

Hello Clojurians. I'm following the https://figwheel.org/tutorial tutorial on a Debian machine, but cannot find how the install the clj CLI tool (the tutorial uses homebrew). Installing 'clojure' worked fine, but the arguments are not the same. Many thanks

dpsutton20:06:16

Uninstall that clojure executable and then follow the instructions here: https://clojure.org/guides/install_clojure

Mc Arcady20:06:01

Thanks a lot! Will try that 🙂