Fork me on GitHub
#beginners
<
2021-02-27
>
John Doneth01:02:17

If someone could help me make heads or tails of this error, that would be amazing. For some reason I can't invoke the constructor of this Java class without an exception being raised.

project.main=> (new com.sun.jna.NativeString "")
Execution error (IllegalAccessError) at project.main/eval2183 (form-init10170902368369356528.clj:1).
failed to access class com.sun.jna.NativeString from class project.main$eval2183 (com.sun.jna.NativeString is in unnamed module of loader 'app'; project.main$eval2183 is in unnamed module of loader clojure.lang.DynamicClassLoader @576d3dca)

hiredman01:02:52

It looks like it is a package private class

John Doneth01:02:36

How can you tell it's only private to the package? I see the public attribute on the constructor

John Doneth01:02:28

Oh does the class declaration itself needs the public modifier? It's been a while since I used Java itself

hiredman01:02:00

Me too, but yes I believe the class needs the modifier as well

phronmophobic02:02:02

specifically for jna, you typically don't use NativeString, you typically either: • pass a java.lang.String (which gets converted to a c string) • pass a https://java-native-access.github.io/jna/4.2.1/com/sun/jna/WString.html (which gets converted to a wide string) • or pass a https://java-native-access.github.io/jna/4.2.0/com/sun/jna/Memory.html whose bytes you fill yourself (which gets passed a pointer)

popeye07:02:01

I have an application that, my test cases depends on the docker container up, Before running clojure testc ases I need to start docker so that container is available, Is there any good doc of integration of test cases docker for clojure

javahippie08:02:34

@popeyepwr A little self promotion, I maintain a Clojure wrapper for Testcontainers a Java library orchestrating Docker containers for test cases.: https://github.com/javahippie/clj-test-containers This could maybe help you

javahippie08:02:08

You can create and start a container prior to your testrun. It will shutdown automatically when the JVM exits

Hagenek09:02:27

Hi, everyone. Hope you are having a nice Saturday. I have given myself a small project today, create a clojure program that reads and writes to a PostgreSQL databse (without ORM). Anyone know of a good place to start? 😃

myguidingstar03:03:25

ORM hater here. Try this sql library http://walkable.gitlab.io :))

borkdude10:02:08

@georghagen If you want to use the regular Clojure on the JVM, I recommend the honeysql library, next.jdbc + the postgresql JDBC driver. You can also use babashka and the postgresql pod for instant startup. https://github.com/babashka/babashka-sql-pods/#run You can also use the honeysql library with this (see further along in the README).

clojure-spin 3
Hagenek10:02:43

Great! Thanks, thats enough to get me started 😃

naxels11:02:10

Good day everyone

naxels11:02:22

In VSCode while using Calva / lsp / clj-kondo under the hood

naxels11:02:41

when I tried to parse XML using the clojure.data.xml library

naxels11:02:48

and do as the github page suggests for namespacing:

naxels11:02:57

;; 
;; Emitting namespaced XML is usually done by using alias-uri 
;; in combination with clojure's built-in ::kw-ns/shorthands:

naxels11:02:11

I receive a message from clj-kondo when actually applying this:

naxels11:02:28

(alias-uri 'xh "")

naxels11:02:35

:when (= ::xh/location (:tag x))]

naxels11:02:47

the message: Unresolved namespace xh. Are you missing a require?

naxels11:02:14

How can I resolve this?

borkdude11:02:57

@patrick.glind I think you can fix this using a clj-kondo config. Please provide a full minimal standalone repro of your code which I can execute with clj-kondo --lint example.clj

naxels11:02:37

Hi Michiel, sure

naxels11:02:12

how do you want the file?

naxels11:02:46

it’s 1 resource file and 1 clj file, deps.edn is just clojure & clojure.data.xml

naxels11:02:28

although for clj-kondo you likely won’t need the .xml file in resources

borkdude11:02:58

just the .clj file would be fine, clj-kondo doesn't care about your deps, you can just throw some code at it

naxels11:02:27

@borkdude, if it’s easier, I also have a github link to the file

borkdude12:02:08

@patrick.glind I think it's best to post an issue about this at the clj-kondo repo. I'll fix it in the next release of clj-kondo. For now you can write:

:when #_:clj-kondo/ignore
        (= ::xh/location (:tag x))
to ignore this warning. Clj-kondo just doesn't understand the alias-uri macro.

naxels12:02:56

understood, thanks

naxels12:02:03

i was hoping it was my inexperience that was the problem haha

borkdude12:02:50

it's clj-kondo's inexperience :)

naxels12:02:48

you want an Issue or Feature request?

borkdude12:02:02

either way is fine

naxels12:02:57

Thanks! it’s posted

naxels12:02:14

Keep up the good work on the tool, really like having it watching over my shoulder

naxels12:02:19

Enjoy your weekend

🎉 3
pez15:02:00

Hello, I’d love myself some beginners and experts to try out an interactive beginners guide to Clojure that I am developing. Thanks in advance! ❤️ https://clojureverse.org/t/dram-is-an-interactive-beginners-clojure-guide-in-the-making/7268

❤️ 9
👍 3
borkdude15:02:13

Why is it called Dram? This means "whine" in Dutch ;)

pez15:02:12

The repo lists this definition: > dram > noun • mainly Scottish a small drink of whisky or other spirits: a wee dram to ward off the winter chill.

pez16:02:20

It’s a reference to Calva, I guess.

borkdude16:02:48

So you are creating a community of alcohol lovers. Nice direction ;)

pez16:02:08

@U051BLM8F started it!

calva 6
pez16:02:46

And there’s rum , which needs citrus and more of these. I know @U5GP9FMC0 dislikes this a bit. Haha.

Stuart16:02:58

Need more clojure named after Scottish alcoholic beverages!

calva 3
pez16:02:03

Yeah, where’s Lagavulin, the smoke testing library?

bozhidar16:02:52

I've been wondering about this myself! 😄

pez16:02:50

Many years ago me and my wife visited Scotland. We rented a car and drove (well she was the driver ) from distillery to distillery, learnt about whiskey making, and had drams (I had drams). I guess that’s why dram was close at hand for me in naming this project.