Fork me on GitHub
#babashka
<
2023-11-28
>
mmer15:11:16

Hi how can I do a call to an insecure https endpoint using bb curl?

borkdude15:11:08

I recommend using babashka.http-client in most cases though, it's also possible with that one

mmer15:11:13

I am trying to debug something so using curl as opposed to http-kit.

mmer16:11:06

When using insecure endpoint and wanting to post multipart forms, what library would you suggest using?

borkdude16:11:39

babashka.http-client ;)

mmer17:11:09

I have had something strange happen - I was using http-kit to do a multipart form post - It was all working fine and had been for sometime. A couple of days ago I started getting stray 503 errors, but when I changed the code to use the client you suggested the issue went away.

DeepReef1116:11:45

How to rename a symbol in emacs (cider)? I get the following message when starting cider: The refactor-nrepl middleware requires clojure 1.8.0 (or newer)WARNING: No Clojure project was detected. The clj-rename doesn't work.

borkdude16:11:36

I do that via clojure-lsp (#lsp )

1
borkdude16:11:43

I'm not sure if renaming works in babashka nrepl but you could also try to load your project in a normal clojure REPL. bb print-deps prints a deps.edn

vemv16:11:49

Yeah refactor-nrepl most likely doesn't work with bb. Use a vanilla repl connection, or clojure-lsp

borkdude16:11:31

What is a vanilla repl connection @U45T93RA6?

vemv16:11:43

vanilla jvm

DeepReef1116:11:46

clojure-lsp did work. Are there potential advantages to using the repl instead?

borkdude16:11:59

clojure-lsp can be used for refactorings such as renaming, a REPL can be used for evaluating code, they can co-exist and sometimes overlap in features

vemv16:11:36

in this context we probably mean the repl as a means of code intelligence, e.g. cider-nrepl+refactor-nrepl vs clojure-lsp renaming works reasonably well with refactor-nrepl, but clojure-lsp does it just as well, and mostly better there are things that objetively are better done with "repl" tech - it can be faster and more accurate. But the opposite can also be true, lsp can be faster and more accurate for other features

vemv16:11:01

Ideally we'd mix and match gracefully, but there hasn't been such coordination effort

danm16:11:46

Is there a way, when using babashka.cli and the :spec keyword to be able to generate a nice help output, to get it to handle positional args? In a non-spec definition I do it with :args->opts, but I can't see anything in the docs about how to do the equivalent of that with :spec, and using :args->opts in the same options map works for the actual functioning of the cli parser, but not for the help output

borkdude16:11:55

I don't think the help output with format-opts supports any positional arguments at the moment

danm16:11:23

Fair enough, no worries 🙂

j4m3s22:11:48

Hey! Would it make sense to add java.util.Stack to the list of available classes ?

borkdude22:11:10

if you can give a compelling reason / example for it, maybe?

j4m3s22:11:06

My use case is a script that adds some value to a stack. It's big enough that using list if not an option (and apparently transient are not seq-able so I can't iterate on them either so that's a no go). Does that make sense ? 😅 I'm maybe missing a better clojure-based solution I need a mutable data-structure that can be used as a stack (push/pop) and that I can iterate on ~

borkdude22:11:07

Why is a list not a good option compared to Stack?

j4m3s22:11:56

If my understanding is correct, clojure list use a value, than pointer to the next value. Which means I would use an extra 8 bytes per item in my list so, not great overhead-wise 😕 (the more I read myself the more I feel like maybe using clojure/babashka here is not the right tool ...)

borkdude22:11:33

Are you able to build babashka locally? You can add the class to babashka.impl.classes and see if that works for you. I'd have to check if it adds much binary size to bb and then consider if it's worth doing

j4m3s22:11:18

I've never done it but I'll try! At least that way I can test changes if I ever need to do any ~

borkdude22:11:48

it's a matter of downloading Oracle GraalVM 21, setting GRAALVM_HOME to it, then run script/uberjar && script/compile You also need to clone babashka with the recursive option (for submodules)

borkdude22:11:56

I'll check back here in the morning

j4m3s22:11:39

No worries, it's not urgent!

jackrusher08:11:32

how many items are going to be in this stack?

j4m3s09:11:28

I don't numbers to give you (I'll try later today) but probably one to several gigabytes

borkdude09:11:25

Maybe a ByteBuffer would be a better data structure to work with such a giant heap of data?

j4m3s09:11:59

Never heard of that, what's that ? 🙂

borkdude09:11:02

not sure if it's suited for your problem, it seems you're looking for a linked list

j4m3s09:11:40

I probably could use it by using special characters as "stops" between items inside it but it seems very overkill. Nice to know about it though! Yeah I need something that can be used as a stack but preferably doesn't allocate a pointer for each item since memory is already a bit of a stretch ~.