Fork me on GitHub
#off-topic
<
2022-07-06
>
souenzzo16:07:09

Any reference repository of "testing java code with clojure"? I don't wanna use clj or lein, I'm trying to keep at mvn/pom

delaguardo16:07:34

There is a maven plugin offering integration - https://github.com/vivid-inc/clojure-maven-plugin but I’m not sure if it does what you asked though

dpsutton16:07:55

zach tellman made some functional data structures in java and uses clojure to test. I’m trying to find them

souenzzo16:07:16

He uses lein, that I already know I'm more interested on learning maven

dpsutton16:07:10

ah, but he uses a very traditional clojure project structure to test: https://github.com/lacuna/bifurcan

Lennart Buit19:07:30

Bit of a basic-CS question: I’m looking for a function that I give a variable length string, and produces a consistent-but-arbitrary value in a small range. A bit like Java’s hashCode, but limited in range, and less serial.

hiredman19:07:02

that is basically the definition of a hash function

Lennart Buit19:07:21

Yeah I know, but … I cant find an easy one with a diffusion property like I want

hiredman19:07:49

diffusion property?

Lennart Buit20:07:01

This is what I meant, found it while looking around FNV1: https://en.wikipedia.org/wiki/Avalanche_effect

hiredman19:07:31

you may want a perfect hash function

Lennart Buit19:07:37

I mean, Java’s hashcode gives serial values for “a”, “b”, “c”, … I dont want that.

Martynas Maciulevičius19:07:58

No, he meant the other hash function, not the one that Java uses for Objects. For instance SHA256.

hiredman19:07:03

user=> (hash "a")
1455541201
user=> (hash "b")
516420758
user=> (hash "c")
1219591486
user=>

hiredman19:07:57

hash is clojure's hash function, which is uh, murmur3 or murmur3ish

hiredman20:07:54

if I need to write hash function the fnv family is simple to implement, but not great

Lennart Buit20:07:15

It doesn’t need to be great, it just needs to produce convincible “unpredictable” values for alphabetical data

Lennart Buit20:07:04

Yeah fnv looks exactly like what I want, thanks!

Martynas Maciulevičius20:07:25

Is it me or the developer that wrote this into code was... let's say... paranoid? They have three references to shadowRoot (Thanks, now I learned what it is). But well... they really didn't want you to find the elements that are inside that tree. And they also had one shadowRoot subtree just to confuse the searcher. I'm shocked. Also why does shadowRoot even exist...

Lennart Buit20:07:00

The idea of shadow roots is to be able to encapsulate components in much the same way native html elements do (like input, text area, …)

Lennart Buit20:07:42

So you shouldn’t care about their internals

Martynas Maciulevičius20:07:56

I know. But there is some kind of a dread when I try to find elements using document.querySelectorAll and... there is nothing. And then you look for iframes and there are none.

Lennart Buit20:07:05

(You are lucky btw, that the shadow roots are “open”, if someone really wants you to stop looking inside, thats also an option to close them that you are discouraged to use)

Martynas Maciulevičius20:07:17

Doesn't that mean that a closed shadow DOM becomes a closed iframe?

Lennart Buit20:07:30

.shadowRoot returns null if closed

Lennart Buit20:07:26

Not so sure about the intricacies of iframes tho

Martynas Maciulevičius20:07:11

Yes but if it's closed it still spins under the hood. And then it's as you said -- you can't get in to inspect it. And you can have some malware but DOM wouldn't even show that anything is there. 😕

Lennart Buit20:07:21

well behaving webcomponents allow you to compose them using slots, so in the ideal world you shouldn’t have to query inside their shadow root. From the outside you manage the host (say ‘theme-builder’) and its children (‘custom-base’ or whatever), and the webcomponent projects those children inside its shadow root via slots.

Lennart Buit20:07:15

(this example, clearly, is not implemented that way, they probably put too much in the shadow root of theme-builder , that you wanted to get out again :p)

Martynas Maciulevičius21:07:15

They've put everything into the shadow root. In the top-level of the document they had a shadow-root and two empty divs 😄

Lennart Buit21:07:09

Yeah, thats not how thats supposed to work lol :’)

Martynas Maciulevičius05:07:13

Anyway. It's an alternative to obfuscation... but why then they didn't do code obfuscation :thinking_face: Probably then that's some kind of component-based framework... Maybe we're missing out here...

seancorfield23:07:49

How dare people talk about Clojure in #off-topic 😆

😄 3
Hamid Sadeghian16:07:29

or better yet, start a "clojure-memes" channel?