Fork me on GitHub

bah, I need to process some html (specifically to pull data out of a table.) I know there is a jsoup pod... but is there anything lighter weight?


Regex for the win... (def rows (drop 1 (clojure.string/split table-contents #"<tr class=\"\w+\">")))



#!/usr/bin/env bb

(require '[babashka.pods :as pods])

(pods/load-pod 'retrogradeorbit/bootleg "0.1.9")

(require '[pod.retrogradeorbit.bootleg.utils :as utils])

(-> "<html><p>Hello</p></html>"
    (utils/convert-to :hiccup))
;; => [:html [:p "Hello"]]

👏 2

This pod will self-install itself


Thanks, I now realize I need to do even more parsing... I have to pull data out of a simple form. Life is too short to parse HTML with regex and indexOf and subs() - I will try the pod.


I am going to include test.check as a preparation for including clojure.spec in babashka. clojure.spec will be included when it's clear what happens to alpha and version 2, but I've already made a start with this as a feature flag, which is disabled by default.

nice 1

Released babashka 0.2.8 with additional built-in libraries: - core.match (much requested) - clojure.test.check (prep for including spec once it comes out of alpha) - hiccup (who doesn't use it?)

👍 4
🔥 1


Eccentric J21:01:49

What’s the recommended way to connect to a postgres db via babashka?


Welcome btw!

Eccentric J22:01:54

Thanks on both accounts 😄

Eccentric J22:01:26

/home1/[redacted]/.babashka/pods/repository/org.babashka/postgresql/0.0.1/pod-babashka-postgresql: /lib64/ version `GLIBC_2.14' not found (required by /home1/[redacted]/.babashka/pods/repository/org.babashka/postgresql/0.0.1/pod-babashka-postgresql)
Is there a way to get a static binary for this or should I try a different route?


@jayzawrotny Are you running this in an alpine docker container?

Eccentric J22:01:28

It’s a shared hosting environment as a cgi-script for learning\experimenting.


currently we don't have a static version of this pod. theoretically it's possible


you can compile it yourself locally, it's not hard


the other way of connecting to postgres would be to shell out to psql


There is even a library around shelling out to psql for bb:


But this was before there were pods.

Eccentric J22:01:59

Great! I did see that library mentioned in the docs but was curious about alternatives. The psql bin does exist on this server so shelling out should be doable, but local compile then uploading might be more performant I’m guessing? Any docs on compiling it locally? Should I setup a docker container to match the host environment?


And there is another way: there is a feature flag in babashka itself which includes the postgres driver. So you could have a static babashka with postgres support and you could then upload this to your shared env.

Eccentric J22:01:29

I did upload the static babashka already


@jayzawrotny yeah, so you could compile the pod statically, or you could compile babashka statically with pg support enabled


then you would have it built into bb, you can require next.jdbc directly without the pod

Eccentric J22:01:51

That could work too for sure. This is quite exciting!

Eccentric J22:01:51

Thanks very much!


Be sure to use GraalVM java11-20.3.0.

👍 1
Eccentric J23:01:31

After a bit of research I’m going to start with compiling the pods. As it stands, I’m unable to use any pods at runtime so tackling this is a must for any definitive guide. Fortunately those links gave me enough info to get that going.