Fork me on GitHub
#off-topic
<
2022-01-12
>
orestis06:01:50

Postgres and jsonb is quite nice for this.

orestis07:01:01

You can even use those json fields (or any jsonpath expression) for queries, and I think even indexing. Though indexing assumes you know exactly the shape of your data so if so, why put it in json?

mauricio.szabo15:01:09

"Schemaless" indexing works with JSONB, but only for equality and inequality - you create a GIN index on the whole field

slipset14:01:11

We’re migrating from mongo to pg and jsonb plays a significant role in it. There are things that we don’t want to “model out” straight away, even though the data shape is known, so we just stick it in a jsonb blob for now.

👀 1
slipset14:01:54

We also have a concept of custom fields, and for now, they’ll be stored in a jsonb blob and their integrity will be handled by application code.

Stuart18:01:07

Does anyone know what this is? It's on the river by my flat.

Stuart18:01:30

Over a couple of weeks it's been moving up the river.

Martynas M18:01:30

But where are the workers...? I can't believe it does that on its own... Did you try to ask workers?

manutter5118:01:35

My guess would be something to take core samples of the river bottom. Alternate guess would be laying some kind of pipeline.

Stuart18:01:35

I've only ever seen a worker on it one day, and he was too far from the edge of the river to be able to speak to him

Stuart18:01:15

Everyday though I see it in a different location. COuld very well be laying pipes, and the time of day I pass it (evening), the workers have gone home

Martynas M18:01:49

There are so much stuff on that platform. They are definetly changing something at the bottom. Also if it would've been sample collection then they would need one diver guy on any boat.

Mno18:01:20

I wonder how it moves

mal18:01:25

that propeller probably flips down into the water and the legs go up

mario-star 1
manutter5118:01:28

What river is that @U013YN3T4DA?

Stuart18:01:47

The River Clyde in Glasgow, Scotland

manutter5119:01:40

I googled for lake and river "core" sampling barge and clicked on Images, got a lot of photos that kinda look like that.

👀 1
Martynas M03:01:35

Which means those are not pipes and instead those are what they drill into the ground. Nice.

sova-soars-the-sora04:01:08

Glasgow is a great place with great people

emilaasa09:01:49

Looks like a shallow water jack-up barge - pretty cool things! 🙂

Max22:01:49

I’ve been thinking about exception handling recently, here’s a little something I cooked up:

(defn main [a b]
  ;; If do-a throws an ExceptionInfo with {:type :some-ex}, returns :failure
  (trys'
   (let [x (try' (do-a a)
                 {:some-ex (constantly :failure)})
         y (do-b b)]
     :success)))
Writeup, justification, and code: https://gist.github.com/maxrothman/f91ffccd8f2ba22618b2c699c8a8fbb1 Thoughts?

Joshua Suskalo16:02:40

I saw you mention this in another thread, and I thought I'd throw my hat in the ring and show what the same control flow would look like in https://github.com/IGJoshua/farolero , which produces something slightly more verbose but which I think is a little more clear about the control flow.

Max23:02:50

My implementation was inspired by farolero’s! Credit where credit is due 🙂

Joshua Suskalo01:02:49

Oh that's really cool!

Joshua Suskalo02:02:30

Glad to hear my work can be an inspiration for people. :)

noisesmith22:01:07

for a project I'd work on, I would find the complexity of a conditional inside catch to be less cognitive overhead, compared to learning two new try macro variants

noisesmith22:01:25

also I've never had try/catch like that inside a handler, instead I have used a middleware that wraps the handlers and catches their exceptions

noisesmith22:01:03

the errors are rarely handler specific, and usually cross their concerns, instead being in categories like "auth missing" / "db connection failure" / "remote api failure"

Max22:01:04

If all of your errors fit in nice global categories, then this probably doesn’t solve a problem you have

Max22:01:30

In the projects I’m currently working on, most endpoints have domain-specific failure modes that, while you can force them into global categories, I find that doing so makes it hard to tell what failure modes can occur in each endpoint.

hiredman22:01:36

https://github.com/cognitect-labs/anomalies#the-categories might be something to look it, I like it because it fairly clearly communicates how to respond to a given error

noisesmith22:01:37

even with domain specific errors, I don't see why you couldn't put the exception catching in a middleware used with endpoints in that domain

noisesmith22:01:54

but of course you find this solution clearer, I'm simply answering the question posed, those were my thoughts

hiredman22:01:42

I know my handlers usually don't throw exceptions like that, so maybe more monadic in style, check some condition, return error response or continue on to do other stuff

hiredman22:01:17

usually wrapped in a general "just in case" exception catching