Fork me on GitHub
#clojure-europe
<
2022-03-09
>
pez07:03:22

Morning! Calva is suffering a period of degraded quality. It really is a big monster I am trying to control...

gratitude 4
calva 1
pez07:03:12

(And it is also a bit fun, because the test safety net grows as I am chasing the bug down using tests.)

pez08:03:41

Fixed it now. Will probably release in a moment. Rest of this Calva day will be spent on quality in this area of Calva.

slipset08:03:07

Oh yeah, morning!

dharrigan08:03:00

Good Morning!

slipset09:03:40

Like, who would’a thunk?

borkdude09:03:43

Congrats! This means you will have more budget to spend on Clojure OSS as well ;) ;)

simongray10:03:54

that’s a lotta dinero

borkdude10:03:16

My 2015 Macbook Air is deteriorating and I kind of hoped for an update yesterday so I would have a good excuse to buy a replacement. But buying a 2 year old M1 model now ... dunno. I use it for travels and watching TV mostly. My main MBP isn't due for a replacement yet. (I have considered switching from Mac but at the end of the day, for me it's the system with the least amount of friction).

pez10:03:52

My wife has one of them M1 Air and it sure is a great computer. Maybe you can buy a used one?

borkdude10:03:18

I guess I could

borkdude10:03:23

But I also want to have 16GB of memory :)

borkdude10:03:46

Maybe I could just buy one and spend 1600 euros ...

borkdude10:03:06

Compared to a Pro machine it's still quite cheap ;P

simongray10:03:55

The m1 macbook does have 16GB. I guess it’s harder to find a used one with 16GB, though.

simongray10:03:10

I still find it incredible that my personal M1 macbook air performs better than the top of the line 16" intel macbook pro I’m working on now 😛

borkdude10:03:16

I guess I could shift the older M1 model to my wife once her Macbook Pro 2015 wears out, she usually only uses it at her desk ...

pez10:03:25

Sounds like you have a plan! 😃

mpenet12:03:20

a new air will come out this year likely

mpenet12:03:09

I am trying to convince myself it's a good buy, but I have a hard time justifying the move for my use

orestis13:03:44

The 16GB Macbook Air is a joy. Unconditional yes for me, the value is the same and the prices will probably go higher with, ahem, the situation (the war in Ukraine).

simongray13:03:20

war??? I think you mean “special military operation” 🤡

borkdude19:03:06

placed the order ... do you think compiling binaries for M1 are compatible with newer processors for mac, m2, whatever? or does every processor need its own toolchain/CI? that would be quite the struggle

orestis03:03:49

Pretty sure there's only one arch- I haven't seen anything like this (multiple toolchain needs ) previously.

borkdude10:03:11

I wondered if I should get the 1TB drive and pay 200 euro more compared to the 512GB one... but for a secondary laptop this is already a pretty luxurious purchase. So I dug down with ncduon my old Macbook Air and discovered a lot of junk and now have 200GB free of 512GB, so I guess I'm good with 512GB

borkdude17:03:49

I'm loving the cute small charger!

borkdude17:03:57

Also, less weight to carry on a trip!

orestis18:03:45

It's really nice! Tomorrow daycare is closed so I'm taking the little one to the grandparents for the day. I can put in a day's full coding + meetings without even having the charger with me.

simongray19:03:25

@U04V15CAJ You got it already? Congrats.

borkdude19:03:00

Yeah, got it in the mail today

🎉 1
thomas10:03:16

the new desktop looks very yummie, I have to say.

simongray10:03:32

Pricy, but very yummy indeed.

thomas13:03:16

oooh yes... I wouldn't want to pay for it myself of course

simongray10:03:32

Pricy, but very yummy indeed.

pez10:03:20

I just ordered a pair of headsets with bom microphone at https://www.thomann.de/. Gotta say it was a delightful experience. They answered on the phone immediately and could help me avoid the ones that I were considering and guided me to what I needed. Don't know how it is out there, but in Sweden most e-shopping is horrible. Everything seems broken. Here it was so easy! An extra nice feature was that when the site recognized my e-mail address they offered to send me a login code. Which I then could fill in during checkout without leaving the process.

javahippie10:03:02

Thomann is the MVP in germany for all things music & audio. Their physical store is also very nice, almost campus-like

pez11:03:38

Is it located in Berlin?

javahippie11:03:18

No, more like northern Bavaria

simongray10:03:15

That’s nice.

genRaiy10:03:31

Does anyone here have experience of using the fluid builders in Java from Clojure ... seems like quite the 🤯

genRaiy10:03:57

MailerBuilder
  .withSMTPServer("server", 25, "username", "password")
  .buildMailer()
  .sendMail(email);

javahippie10:03:27

Should work well with thread-first, shouldn’t it? That’s what we did in beginning with testcontainers, before we had a wrapper:

(-> (org.testcontainers.containers.GenericContainer. "postgres:12.2")
                       (.withExposedPorts (into-array Integer [(int 5432)]))
                       (.withEnv "POSTGRES_PASSSWORD" pw))

genRaiy10:03:24

I'm trying but it doesn't quite work like that 😞

javahippie11:03:22

(import [org.simplejavamail MailerBuilder])


  (-> (MailerBuilder/withSMTPServer "server" (int 25))
      (.buildMailer)
      (.sendEmail my-mail))
works on my REPL

😍 1
genRaiy11:03:31

I'm a 🤡

otfrom11:03:45

@javahippie I presume that will work with doto as well as each of those methods just returns the mutated object?

otfrom11:03:30

though I suppose only trusting the whatever is returned from the method is a safer bet than expecting the original object in the fluid builder to be mutated

javahippie11:03:31

The withSMTPServer returns a stateful builder which would also work with doto, but the “buildMailer” method has a different type as a response.

👍 1
otfrom11:03:36

so -> is probably "safer"

javahippie11:03:02

Let’s just say in that builder there are some interesting design choices 😉

👍 1
😬 1
otfrom11:03:27

caveat developer

Ben Sless17:03:15

I have a function lying around that takes class and uses reflection to generate a function taking a map of options in kebab case and builds with it

genRaiy19:03:28

I'm trying to avoid reflection if possible but still … post the gist :)

Ben Sless19:03:13

I couldn't find it, but this is the gist of it, example for Ben Mane's Caffeine

(let [opts (gensym "opts__")
      builder (gensym "builder__")
      builder-opts (keep
                    (fn [{:keys [return-type flags name parameter-types]}]
                      (when (and
                             (not (:static flags))
                             (:public flags)
                             (<= 1 (count parameter-types))
                             (= 'com.github.benmanes.caffeine.cache.Caffeine return-type))
                        [name parameter-types]))
                    (:members (clojure.reflect/reflect (Caffeine/newBuilder))))
      chain
      (mapcat (fn [[m [arg]]]
                (let [k (csk/->kebab-case-keyword m)
                      met (symbol (str "." m))]
                  (if arg
                    `[(contains? ~opts ~k) (~met (~k ~opts))]
                    `[(contains? ~opts ~k) ~met])))
              builder-opts)]
  `(cond-> ~builder
     ~@chain))

1
otfrom11:03:06

I would guess that doto would work as well https://clojuredocs.org/clojure.core/doto

javahippie11:03:40

The builders return an instance of the builder itself with the new values attached, then it depends if the original object is stateful, or built “on the fly”

borkdude11:03:47

doto doesn't work I think since it returns original object argument

borkdude11:03:59

I think -> should work

otfrom11:03:32

yeah, I suppose it all depends on whether or not the thing is stateful. I have a feeling your first object is returned after MailerBuilder.withSMTPServer(...?

genRaiy11:03:47

thanks @javahippie hero of the hour

genRaiy11:03:22

Also good morning

👌 1
lread12:03:31

Good morning

otfrom13:03:46

well, thanks for expanding that photo slack

😂 1
otfrom13:03:03

If I'm hitting a RESTish API, what is the preferred library nowadays? I think I need to talk to sharepoint

javahippie14:03:02

clj or cljs?

javahippie18:03:21

I use clj-http for everything and it fulfills all my JSON and Transit needs. But I wonder if there is a CLJ client which makes use of Javas native HTTP client

👍 1
simongray13:03:34

it’s so sunny outside, think I’m gonna head out for a short walk

👍 4
🚶 1
mccraigmccraig15:03:50

anyone else seen an issue with records instantiated by a tag-reader in a top-level def form having a stale class (and so not working with protocols) ?

pithyless17:03:36

I came across a really weird error today; no idea if it's related, but it was also a weird behavior with the def form. https://clojurians.slack.com/archives/C87NB2CFN/p1646846870791379

mccraigmccraig17:03:32

hmm - perhaps related - in both cases it seems some compilation has happened in between the evaluation of the body of the def form version and the call of the 0-args fn version which changes the environment unexpectedly

mccraigmccraig17:03:04

in your case a concrete method is defined and in my case it looks like a record class is recompiled

mccraigmccraig16:03:17

that will let us get rid of some nasty js code in our gulpfiles which serialises js datastructures as EDN (to send to shadow as config)

borkdude16:03:42

awesome. let me know if you have any questions. there is also an #nbb channel