This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2023-05-08
Channels
- # announcements (1)
- # babashka (28)
- # beginners (13)
- # calva (10)
- # clerk (18)
- # clj-on-windows (39)
- # clj-otel (1)
- # cljdoc (17)
- # clojars (12)
- # clojure (40)
- # clojure-austin (11)
- # clojure-brasil (1)
- # clojure-europe (23)
- # clojure-nl (3)
- # clojure-norway (16)
- # clojure-uk (2)
- # clojurescript (28)
- # clr (4)
- # conjure (1)
- # emacs (14)
- # hoplon (6)
- # hyperfiddle (59)
- # interop (2)
- # leiningen (1)
- # off-topic (37)
- # pathom (1)
- # polylith (5)
- # portal (7)
- # reagent (9)
- # releases (3)
- # shadow-cljs (22)
- # spacemacs (6)
- # tools-build (12)
- # tools-deps (51)
- # web-security (6)
- # xtdb (7)
Hello. I have a question. In fact, I have a very frustrating task at the company. I need to develop a script on Windows server 2012 in a closed network. The task to be developed is “create a csv file after extracting data from the mssql server with a select statement and simple data processing”. What makes me hard • windows server 2012, • It is a server in a closed network that is not connected to the Internet. Files necessary for development can be transferred to the server via USB. Can I use babashka to do what I want? Can you suggest a development setup suitable for this situation?
You can connect to mssql with a sql pod:
https://github.com/babashka/babashka-sql-pods#ms-sql-server-support
You can download the pod separately and load it with (babashka.pods/load-pod "<path-to-pod>")
and then execute the above code.
Another way involves maybe shelling out to https://learn.microsoft.com/en-us/sql/tools/mssql-cli?view=sql-server-ver16 or so.
For csv you can use clojure.data.csv
which is built into bb.
Your guidance is enough for me to do the task. Thank you so much for your kind guidance. 🙂
I have the following line in my ~/.config/clojure/deps.edn
to prevent jars from being installed in ~/.m2:
:mvn/local-repo "/home/ramblurr/.cache/maven/repository"
When I use clojure ....
this is respected, but when I call clojure
via bb
it isn't.. For example with repl-portal (shell "clojure -A:dev -M:inspect/portal-cli-cider")
as a task in a project's bb.edn
running bb repl-portal
will download lots of jars into ~/.m2
This should work the same way, you're just shelling out to clojure. But it could be that you're having some :deps
in bb.edn
itself which are downloaded?
the bb.edn file in question is here: https://github.com/Ramblurr/probematic/blob/main/bb.edn
Yes, this:
:deps {local/deps {:local/root "."}}
is causing the dependencies in your deps.edn
to be downloaded as wellBtw, don't use the name local/deps
: use a unique name there since if you use the name local/deps
in other places, you'll get caching problems
hmm ok don't remember how that ended up there in the first place, probably copied it from another project. removing it seems to solve the problem. thanks!
Ah, I didn't know about this either. The local/deps
solution was originally in the docs but it looks like this was changed a few months ago: https://github.com/babashka/book/commit/b88e3646bb726ed16f2799986f4603719784bee3
bbin
is actually generating scripts that use local/deps
at the moment so that sounds like a bug we'll want to fix
We (=Pitch) have taken over as maintainers of asdf-babashka, whose excellent author hasn't been responsive in 2yrs. Our fork (which fixes an important issue on Apple Silicon) is maintained here: https://github.com/pitch-io/asdf-babashka We're also taking steps to get this published as the official asdf babashka plugin
Feel free to ping us here if you have any questions (we love asdf!)
It's almost embarrassing how the "main" babashka-plugin has been broken since M1 came out, should have been replaced with your fork much sooner. FWIW, I highly recommend checking out https://github.com/jdxcode/rtx. Without evangelising too much, it's better in almost every regard, piggybacking on the asdf plugin repo, and respects .tool-version files for converts.
Right, we're also investigating rtx as an alternative. ASDF works very well, but it has one flaw – it adds up to 400ms to every invocation of java, clojure, bb etc. This can add up. A couple of possible fixes for this: • Switch to rtx • Build a PATH https://github.com/asdf-vm/asdf/issues/290 • Use https://github.com/asdf-community/asdf-direnv
I feel like betting on rtx is a little risky now (as asdf has a bigger community), but I agree that rtx has the better design
(Another problem with asdf's shims, other than performance, is that they are on the PATH even if you don't have a .tools-version
. It wants to own the world. AFAIK rtx with its PATH-modifying approach doesn't have that problem)
Speaking of things that are worse than Nix () I need to get around to opening a PR for my Nix derivation that pulls the pre-built binary version of Babashka, and then convince the powers that be at Pitch (whoever they might be) to maintain that. 😜
Does anyone know why my bb script in CIDER sometimes doesn't want to execute (cider-pprint-eval-last-sexp)
and would throw "java.lang.ClassCastException: clojure.lang.PersistentVector cannot be cast to java.lang.Number"?
Ah, maybe it's not a problem with bb. Something to do with cider-nrepl. My minimal setup with deps.edn project and I'm seeing the same thing:
Error printing return value (ClassCastException) at clojure.lang.Numbers/lt (Numbers.java:253).
class clojure.lang.PersistentVector cannot be cast to class java.lang.Number (clojure.lang.PersistentVector is in unnamed module of loader 'app'; java.lang.Number is in module java.base of loader 'bootstrap')
ERROR: Unhandled REPL handler exception processing message {:op analyze-last-stacktrace, :nrepl.middleware.print/stream? 1, :nrepl.middleware.print/print cider.nrepl.pprint/pprint, :nrepl.middleware.print/quota 1048576, :nrepl.middleware.print/buffer-size 4096, :nrepl.middleware.print/options {:right-margin 70, :length []}, :session f7cb9ce8-09b8-4c25-8d2f-b8fadd762169, :id 14}
java.lang.ClassCastException: class clojure.lang.PersistentVector cannot be cast to class java.lang.Number (clojure.lang.PersistentVector is in unnamed module of loader 'app'; java.lang.Number is in module java.base of loader 'bootstrap')