Fork me on GitHub
#clojure-europe
<
2021-03-16
>
dharrigan06:03:41

Good Morning!

RAMart06:03:42

:spock-hand:

raymcdermott08:03:32

Morning has broken

mpenet08:03:44

god morgon

borkdude08:03:31

Instead of storing EDN files as a "db" I would probably go for datalevin now if I would have that case use again: https://twitter.com/huahaiy/status/1371689142585753604

👍 6
mpenet08:03:16

asami is a good choice too now (storage is in alpha), you get as-of too

👍 3
pez08:03:06

Good morning! I just found out that GitPod is switching to using VS Code instead of Theia. It’s already an experimental feature and when I try it, I can install and run Calva in there. Quite amazing. The first run is slow, but from then it is quite like running it on my computer.

joelkuiper09:03:03

morning 🙂

reefersleep09:03:11

Good morning!

orestis10:03:41

Good morning! I reconnected with my Iyengar Yoga teacher via Zoom, and I'm so happy. I haven't done any yoga or exercise since more than a year now.

👍 18
borkdude10:03:29

My wife is also doing yoga (but via Youtube, her teacher is sometimes live and posts videos), has been doing it throughout the pandemic. Only in the summer there were some lessons she could attend, but then the lockdown came again.

simongray11:03:09

I used to do yoga on the regular with a friend of mine, but at one point (a year or two before the pandemic even started) he stopped wanting to go preferring to do it online instead… and then my attendance also dropped to zero soon after.

reefersleep12:03:26

late morning for you today? 🙂

reefersleep12:03:51

(I wanted to change into proper pants hours ago, but our son has been impossible all day)

otfrom13:03:40

I'm so tired I had double morning

ordnungswidrig12:03:49

I redescovered DDR yesterday, a dance game with a sensor mat on the wii. I was more fun than I remembered and more exhausting on top. Unfortunately that mat is not recognized as a usb gamepad like a similar mat I have. Otherwise I would totally create some clojurescript game with it otherwise.

ordnungswidrig12:03:28

The game controller support in browsers is an awesome thing. Using the other controller mat, I created a “jump height measuring app” (based on the time of flight) with reagent and it was very fun.

🙌 6
🎮 3
reefersleep12:03:43

I read the title in both ways at once! Odd.

reefersleep12:03:45

Btw, I saw metal mentioned in your tweet profile. This is my latest discovery, maybe you’ll like it: https://www.youtube.com/watch?v=SSEtBgQDExE

borkdude13:03:47

sounds pretty good \,,/

metal 3
ordnungswidrig13:03:20

OMG I need some post moder jukebox after this :-p

reefersleep15:03:18

@borkdude what’s your recent metal discovery/ies? 🙂

borkdude15:03:29

My latest favorite album isn't really metal, more progrock

borkdude15:03:39

Transatlantic, The Absolute Universe

borkdude15:03:05

Looking forward to the new Liquid Tension Experiment 3 (instrumental progressive rock/metal)

reefersleep12:03:30

I’m not that much of a prog rock fan. I enjoy Roundabout by Yes, but that’s about it, so far. I’ll pass this recommendation on to my prog rock loving colleague, though!

reefersleep12:03:05

(Transatlantic, I mean 🙂 )

borkdude12:03:46

I love a wide range of rock/metal related bands, but progressive tickles my musical brain the most.

reefersleep13:03:06

I totally get that, brain tickling is lovely in general 🙂 For me, stuff like Tool does that, but also some complex electronic music.

jkxyz12:03:44

Is it a sign of tunnel vision that I don’t have a problem with Clojure’s error messages, which everyone seems to complain about so much?

reefersleep12:03:30

I’ve learned to read them, but they were hard in the beginning, and I even had experience from Java. If you come from a different language (or from scratch), it might be tough.

reefersleep12:03:30

We’re probably the same by now, you and me. There’s way too much information for the REPL to decode the errors. We’ve gotten used to it, though. Our brains do the translating. We don’t even see the code. All we see is blonde, brunette, redhead.

🕶️ 3
ordnungswidrig13:03:11

I remember as a beginner is was a little lost even though I have a strong background in java.

ordnungswidrig13:03:00

On the other hand when I do some haskell, I’m even more lost, even though the errors might be technicall more precise and even more concise.

ordnungswidrig13:03:23

I think it’s the S T A C K T R A C E S which are hard to read for many developers.

slipset14:03:33

I did some work (somewhat recently) in Python. I think the problem is familiarity rather than anything else, as in, the error messages from Python were quite cryptic even though I believe they were in colours.

jkxyz14:03:06

Yeah I think you have to develop some mental heuristics for skipping the unimportant parts in the stacktrace (clojure.lang.RT etc) and parsing the generated class names to get to the function that caused the error. But I don’t think it’s worse than a lot of languages. I actually think that JVM Clojure is good at pointing you to where to look

borkdude12:03:20

I don't have a problem with it either, it's just a joke

jkxyz12:03:20

Took me a second to parse the pun 🙂

raymcdermott14:03:08

some Stockholm activities occurring here 🙂 take a look at ELM and Rust even and you see what things might be like

borkdude15:03:39

"you should use spec to get better error message", yeah, but instrumenting core specs will make my Advent of Clojure solution run in 15 minutes insteaf of 300ms :P

raymcdermott15:03:27

it's an indication that you should rewrite your answer 😝

raymcdermott15:03:35

spec would be nice but annotated exceptions would already be better - they recently changed exceptions to be data so that's something that could be used to help users (new and old)

borkdude15:03:21

I think it's a chicken and egg situation: the experts don't care and the beginners don't have the experience to fix it

raymcdermott15:03:39

who's the chicken in that scenario?

borkdude15:03:59

that is your koan

raymcdermott15:03:02

btw the egg definitely came first 🙂

raymcdermott15:03:57

I think there are enough experts that care

borkdude15:03:14

Where is the evidence?

raymcdermott15:03:24

your work, expound, etc

borkdude15:03:09

I thought we were discussing Compiler exceptions

raymcdermott15:03:21

the problem isn't a lack of care in the world it's just that changes outside of the centre have lower impact

slipset15:03:23

I ordered a chicken and an egg from amazon to see which came first.

😂 15
😆 9
raymcdermott15:03:15

are the annual clojure survey results out btw?

slipset15:03:53

I’m most likely hit by the Stockholm syndrom, but I don’t spend much time agonizing over error messages these days.

raymcdermott15:03:34

isn't that your home location?

slipset15:03:06

There are a couple that are annoying, like this one:

user> (foo 'bar 'baz 'qix)
Execution error (ArityException) at user/eval204152 (form-init9860581626012504089.clj:4103).
Wrong number of args (3) passed to: user/foo
user> 
I believe the compiler/runtime has enough information to tell me that foo expects two params

slipset15:03:07

But notice, no stack traces or anything here. Also, thanks to @borkdude and @ericdallo I’m catching a lot of stupid (compiler) errors before they become exceptions.

dharrigan15:03:25

That one is one of my most confusing ones...why couldn't it have said "Wrong number of args passed to: user/foo, got 3 expecting 2" or something like that.

slipset15:03:10

I looked into this at some point, and it’s rather involved in how AFn (or whatever is implemented)

slipset15:03:06

Basically AFn (or whatever) is an abstract class containing 21 methods which all throw exceptions like Wrong number of args (3) passed to (.name)

borkdude15:03:20

I once brought up the arity information problem in #clojure-dev since the CLJS compiler warns you about this. But it wasn't deemed interesting enough

slipset15:03:30

and then the concrete implementation for say foo overrides invoke for the correct arities.

borkdude15:03:44

so I'll just continue in my own little clj-kondo corner :p

borkdude15:03:41

The compiler can keep around enough information to be able to warn you about this, but this comes at slightly more compile time cost (which may be worth it) and the trade-off that vars can be redefined at runtime, so the information might go out of date (but I think even that can be accounted for since the Compiler sees everything). But you cannot get the arity from an opaque function object, which may be the most fundamental problem (I do think you can fix this on the compiler or even macro level). But even then, it wasn't deemed that interesting.

dharrigan15:03:18

Can I quote The Big Lebowski here?

😎 3
dharrigan15:03:51

The Dude: Yeah,well, that's just, like, your opinion, man.

😆 6
dharrigan15:03:11

not directed at anyone here 🙂

slipset15:03:13

And, if I were to choose, there are other things I would want Rich to spend his time on 🙂

joelkuiper15:03:19

anyone here ever used http://keycloak.org/ in production?

joelkuiper15:03:11

it seems like it would save quite a few headaches without being tied to AWS/Cloud for IAM, but not sure if there are some "gotchas" I should be aware of 😛

javahippie15:03:18

The gotcha is that you run the database with all the credentials yourself, and are responsible for it - and that it’s kind of chunky in both runtime and configuration

javahippie15:03:01

I’d assume it’s battle tested, and it’s heavily used and tested by RedHat. We have it running to secure our OpenShift Dev Environment, but gladly I am not the one managing it

djm15:03:07

We use it. I think it depends on what you want to do - we ended up with some complex integration code (using their SPI thing), as we were trying to fit it into our existing ecosystem. Doing something sensibly from scratch would be much less painful

joelkuiper15:03:18

Hmm that's good to know, I got it running in Clojure with reitit/re-frame/buddy-auth (front + back) by adapting https://github.com/jgrodziski/keycloak-clojure ever so slightly and just running the docker containers in a day or so, but it does seem rather brittle

joelkuiper15:03:11

I'm anticipating some SAML/LDAP auth stuff, and I really didn't want to do that from scratch, so it seemed a pragmatic choice but not sure if it ends up being worth the trouble (even getting the theming right is a pain)

javahippie15:03:18

I had it up and running with ring-oauth2 via standard OIDC, what does this library do?

joelkuiper15:03:58

it's pretty much a wrapper around the java lib , primarily focused around the admin tasks rather than the auth flow itself, but it had a sample for integrating it with re-frame so I just rolled with it 😛

javahippie15:03:08

If you stick with OIDC default flows, you could always interchange the provider and not be coupled to Keycloak. But that lib does seem convenient. I guess if you want to have one component bundling LDAP, OIDC, platform auth etc. etc., and be the one controlling that component, there is not much way around keycloak

javahippie15:03:24

I’m currently considering throwing money at the issue and buying into Auth0, but they have been acquired, and I don’t like that. @U7PBP4UVA half-jokingly suggested building our own auth library with adapters, so I half-jokingly bring it up again here

joelkuiper15:03:14

I was looking at keycloak and that lib and half jokingly thought "welp I guess I can build my own Auth0 and get acquired for an obscene amount of money" 😆

joelkuiper15:03:42

so I guess there was some alignment there 😛

javahippie15:03:47

It might even be possible to integrate keycloak into the application itself (at least in a java context): https://www.baeldung.com/keycloak-embedded-in-spring-boot-app

joelkuiper15:03:34

hmm, I kinda like that it isn't integrated at the moment though, but good to have the option at least 🙂

orestis16:03:58

Pac4j is on my list. I have almost already dismissed keycloak as we are multitenant and it seems like it wasn’t designed for our use case.

orestis16:03:26

Funnily enough we might need to use keycloak as an identity provider as google SSO is a joke

djm16:03:27

We are multitenant too

djm16:03:36

One realm per tenant

orestis16:03:00

Do you have to create the realms with xml and such then? I like just creating an entry in a central database and then things work automatically since we control the SSO code.

djm16:03:33

We have some scripts to set the realms up, using some json templates

orestis16:03:34

We also have to deal with social signups and other concerns, plus we want to control the UI 100%

djm16:03:26

We're very antisocial, so I can't comment on that part

djm16:03:17

All of our user admin is done is a separate application (and we have KC connected to that database), so mostly no one has to use the KC UI

javahippie16:03:30

> Funnily enough we might need to use keycloak as an identity provider as google SSO is a joke Try Apple

orestis17:03:40

Apple doesn’t control our emails and Calendar and files though! Google provides saml SSO but then provisioning only works for a built in list of apps...

👍 3
thomas08:03:58

At finalist we used it quite often. Does the job really well.

thomas08:03:19

if you have questions let me know @U0508P8EK

👍 3
borkdude15:03:17

To give an argument in favor of not doing this in the compiler: a linter can catch most of these issues and you don't get any compilation delay. In sci I'm also not checking for certain things which I just leave to the linter

slipset15:03:23

I think Fogus is working on some cool stuff related to speeding up destructuring.

borkdude15:03:53

Was it speeding up or extending it with "passing named arguments and get a map"

slipset15:03:54

I saw the issue flying past at some point, but not able to find it now.

slipset15:03:05

The latter.

borkdude15:03:28

I was hoping the first, but the second is cool too, if it's not making it any slower :)

slipset15:03:47

So I have a published interface which accepts kw-args, and I needed to make them into a map (and merge with defaults). And that is slow.

slipset15:03:10

(especially since merge uses reduce1 in lieu of reduce)

slipset15:03:57

(I seem to remember an issue about that, but I’m unable to find it)

borkdude16:03:44

I needed a kind of str/split for collections. It's neat that you can do this without traversing the collection twice or writing a lower level loop/reduce:

(into [] (comp (partition-by #(= % 1)) (take-nth 2)) [2 2 3 1 2 3])
[[2 2 3] [2 3]]

ordnungswidrig17:03:46

I wonder if there is a stream/query interface to json or even clojure lazy data structures. For those cases where you only need a small subset of a potential json document and you want to avoid reading it all or realizing all.

ordnungswidrig17:03:55

Something like a grep for :orders :* :client :person :name #(.starts with % "Dude") but lazy.

slipset18:03:57

@ordnungswidrig cheshire seem to have some lazy stuff in it, but it uses jackson underneath, so I’m not sure where the lazyness kicks in, if it’s in lazy also in parsing, or only in creating the objects.

slipset18:03:12

jsoniter (a java and a go lib) also has some lazy stuff in it.

borkdude18:03:11

@slipset The laziness in cheshire is only for top-level arrays. @ordnungswidrig I proposed this to @ikitommi once for jsonista, but afaik it's not possibly out of the box currently.

borkdude18:03:34

Languages like Haskell or Scala support this better when you build custom types to deserialize to.

slipset18:03:53

From what I’ve read of the jackson source I don’t think you coul do:

(take 10 (json/parse-stream (json/write-stream (range)))

slipset18:03:19

but it would’ve been cool

slipset18:03:49

Allthough somewhat useless

borkdude18:03:15

$ bb -O -e '(range)' | bb -I -e '(take 10 *input*)'
(0 1 2 3 4 5 6 7 8 9)

slipset18:03:04

That’s cool 🙂

borkdude18:03:39

only works on macOS/linux, not on Windows due to some missing signal there

slipset19:03:02

Reminds me of a blog/article about running some stuff in parallel in bash, but my google-fu is failing me.

ordnungswidrig19:03:20

I was thinking about an event based interface like SAX for XML parsing. The interesting part would be the stream matching. Basicall you’ll get a pre-walk over all JSON values and I’d love to be able to match on it. For the above examples the “matcher” would need to keep the current “path” in memory to know when a match occurs. I think work on regex applied to streams could be resued.

ordnungswidrig19:03:19

There we go: a streaming jsonpath library https://github.com/jsurfer/JsonSurfer

simongray21:03:50

I think you could accomplish it using a zipper.