This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
what is the correct way to access data that is stored in a path specified in deps.edn
? E.g. I'm trying to put some data used during testing in the resources
folder. E.g. my deps.edn looks like:
{...
:test :extra-paths ["test" "resources"],
...}
but I don't know what the path should be when writing test code to use data in resources
those paths get added to your classpath, so you can use
(for example) to access those files as relative to the classpath
ah okay thanks! I'll try that. figured it was something simple
Maybe more of a java question - but if I have a byte array - how can I turn this into a long/hex so I can do bitwise operations on it
There's more than one way to do it with different tradeoffs. One reasonable way is to use BigInteger, https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/math/BigInteger.html#%3Cinit%3E(byte%5B%5D)
if you have a byte array of size <= 8 (so it fits into a long) you can do like this also :
(let [arr (byte-array [1 0 0 0 0 0 0 0])
l (bit-or
(bit-shift-left (aget arr 7) 0)
(bit-shift-left (aget arr 6) 8)
(bit-shift-left (aget arr 5) 16)
(bit-shift-left (aget arr 4) 24)
(bit-shift-left (aget arr 3) 32)
(bit-shift-left (aget arr 2) 40)
(bit-shift-left (aget arr 1) 48)
(bit-shift-left (aget arr 0) 56))]
(format "%x" l))
depending on the endiannes you want to change the numbering on the first row