This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-01-26
Channels
- # announcements (1)
- # asami (7)
- # aws (3)
- # babashka (30)
- # beginners (21)
- # calva (48)
- # cider (11)
- # clj-commons (5)
- # clj-kondo (12)
- # cljdoc (5)
- # cljfx (1)
- # cljs-dev (32)
- # cljsrn (4)
- # clojure (218)
- # clojure-europe (88)
- # clojure-nl (11)
- # clojure-uk (31)
- # clojurescript (8)
- # cursive (98)
- # data-science (6)
- # datomic (49)
- # emacs (12)
- # events (4)
- # fulcro (47)
- # graalvm (3)
- # graphql (4)
- # introduce-yourself (5)
- # java (13)
- # juxt (9)
- # lsp (74)
- # meander (3)
- # membrane (4)
- # missionary (31)
- # off-topic (24)
- # pathom (41)
- # portal (4)
- # reagent (3)
- # releases (1)
- # remote-jobs (3)
- # rewrite-clj (4)
- # shadow-cljs (10)
- # slack-help (2)
- # testing (20)
- # tools-deps (43)
Can somebody offer some suggestions for how to easily host a babashka/scittle server?
Good question. I guess you could always use a VPS on DigitalOcean and what not. Alternatively you could use Amazon or Google and make a lambda. Another alternative: shared hosting on Bluehost or similar, but then I think you'd have to set up your site with CGI. You can read about bb + CGI here: • https://eccentric-j.com/blog/clojure-like-its-php.html • https://blog.michielborkent.nl/using-babashka-with-php.html
I thought bb supported clojure.tools but getting an error
(require '[clojure.tools.namespace.repl :refer [refresh]]) ; java.lang.Exception: Could not find namespace: clojure.tools.namespace.repl.
It's not a built-in dep but there is a fork which works well with babashka. https://github.com/babashka/tools.namespace You probably need to upgrade babashka for it to work, not sure.
Is it expected that one cannot import java.text.SimpleDateFormat
? If yes, why is that? I'm on babashka 0.7.3
@arne-clojurians in babashka we include only java.time
No, with a script I'm writing myself. I'm trying to parse a german date ("22.12.2022") into an Instant so I can exchange it via EDN
$ bb -e '(java.time.LocalDate/parse "2022.01.26", (java.time.format.DateTimeFormatter/ofPattern "yyyy.MM.dd"))'
#object[java.time.LocalDate 0x187bb91e "2022-01-26"]
Ok, what I tried to do didn't quite work. I tried to pass output between two babashka scripts, with the first one using bb -O
. Some of the values I'm trying to pass are dates, so I thought I could leverage the #inst
tag for that. However, when parsing the dates as Instants, they get serialized like this: #object[java.time.Instant 0x782f8391 "2022-01-02T23:00:00Z"]
Is there any way to make it use the #inst
tag?
There are several options. Serialize using a different tag and then use that tag when reading EDN.
Or convert the date into java.util.Date
or so
I found some information on this here: https://nextjournal.com/schmudde/java-time
This seems to work:
$ bb -e '(-> (java.time.LocalDate/parse "2022-01-26", java.time.format.DateTimeFormatter/ISO_LOCAL_DATE) (.atStartOfDay (java.time.ZoneId/of "EST5EDT")) (.toInstant) (java.util.Date/from) )' | bb -e '*input*'
#inst "2022-01-26T05:00:00.000-00:00"
I'm thinking of making a CLI tool. I could build it in clojure and compile it using graalvm. another thought I had was writing it in babashka. the end goal is to have a tool that someone can do brew install lilactown/brew/thing
. is that something that babashka supports?
@lilactown Absolutely! Take a look at https://github.com/babashka/neil - it's a babashka script that can be installed using brew and scoop (Windows) and even nix
the tool itself is simple: read in some JSON/EDN from stdin, do some operations, print it
The brew formula itself is hosted here: https://github.com/babashka/homebrew-brew