clojure-uk

A place for people in the UK, near the UK, visiting the UK, planning to visit the UK or just vaguely interested to randomly chat about things (often vi and emacs, occasionally clojure). More general the #ldnclj
dharrigan 2020-10-14T05:32:03.150Z

Good Morning!

2
mccraigmccraig 2020-10-14T06:05:34.150600Z

mรฅnยก

alexlynham 2020-10-14T07:20:11.150700Z

morning

djm 2020-10-14T07:20:35.151Z

๐Ÿ‘‹

dharrigan 2020-10-14T08:39:35.151700Z

I do like developing at the repl - I can try out things so quickly, code it up as a test, then try it out and bingo - just works ๐Ÿ™‚

alexlynham 2020-10-14T08:50:13.151800Z

it's the thing i miss most about clj tbh

2020-10-14T09:58:51.152200Z

Morn'

mccraigmccraig 2020-10-14T10:14:28.152600Z

there's no reason you can't repl in js-land is there @alex.lynham?

alexlynham 2020-10-14T10:30:25.152700Z

you can rig up a typescript repl in emacs tbf, but it's just naff

alexlynham 2020-10-14T10:31:03.152800Z

i mean, i already find the cljs repl less useful than the clj one, but everything is async and you can't await stuff easily, so it's just more hassle than writing a unit test tbh

mccraigmccraig 2020-10-14T10:43:39.155100Z

i've used something like this in cljs repl: (defn wait-print [p] (.handle p (fn [success error] (if error (print error) (print success))))) ... and something similar to collect the value/error in an atom - that should work in js repl too ?

alexlynham 2020-10-14T10:46:27.156100Z

yeah i used a similar hack when i was doing cljs/sls stuff

mccraigmccraig 2020-10-14T10:46:49.156500Z

i found it transformational for cljs dev once i got a node-repl going, and could use it pretty much like a clj repl - although CIDER test runner doesn't work, which was sad

alexlynham 2020-10-14T10:47:03.156600Z

idk, it's about going with the grain - it's a pain in TS so i don't do it

alexlynham 2020-10-14T10:47:09.156700Z

it doesn't really add value

alexlynham 2020-10-14T10:47:52.156800Z

and the test watcher for our 400+ tests (db, unit, integration, handler) run in sub 35s, and only run the related changed ones, so that's a better feedback mechanism

thomas 2020-10-14T10:50:30.157Z

morning

2020-10-14T10:51:30.157500Z

anyone here used MongoDb? I've got a n00b question...

alexlynham 2020-10-14T10:51:54.157600Z

not for a while

alexlynham 2020-10-14T10:52:06.157700Z

@rickmoynihan are you folks still using it for bits and pieces?

2020-10-14T10:53:45.159100Z

I'm trying to spin up a trivial replicaset for an integration test; everything running locally; every time I try to make a change I get a 'Command failed with error 10107 (NotMaster)'

2020-10-14T10:54:05.159600Z

its never worked as a replicaset, so I'm sure I've just misconfigured something

2020-10-14T10:54:23.159900Z

over my dead body ๐Ÿ˜†

2020-10-14T10:54:28.160200Z

somehow the initial Master election never happens, maybe?

2020-10-14T10:55:13.160300Z

its only on some legacy stuff providing a small database of users

2020-10-14T10:58:33.162Z

rs.status()
{
"errmsg" : "no replset config has been received",
"code" : 94,
"codeName" : "NotYetInitialized"
...
}
I guess that's my problem

alexlynham 2020-10-14T11:00:04.162200Z

ah i did wonder if zib (memory, is that right?) had meant it went bye bye

dharrigan 2020-10-14T11:00:05.162400Z

I detest Mongo

dharrigan 2020-10-14T11:00:22.162800Z

We are in the process of slowly moving away from Mongo to Postgresql

dharrigan 2020-10-14T11:00:41.163100Z

such a mistake for us to even introduce Mongo into our architecture

alexlynham 2020-10-14T11:00:46.163300Z

on current project we're using postgres as a nosql store

2020-10-14T11:01:05.164Z

rs.initiate() run from mongo console seems to help

1
dharrigan 2020-10-14T11:01:05.164100Z

yeah, I use pg to store json too, and key/value pairs (hstore). works great

alexlynham 2020-10-14T11:01:13.164200Z

it's so stable and AWS aurora supports the PG API so

2020-10-14T11:01:26.164500Z

I managed to avoid Mongo until 2020

alexlynham 2020-10-14T11:01:40.164600Z

we've got aws aurora in prod and treat that like a no maintenance nosql store without the faff of dynamo

Conor 2020-10-14T11:01:44.164700Z

https://imgflip.com/i/4igdfe

๐Ÿ˜‚ 3
๐Ÿ˜ˆ 1
1
dharrigan 2020-10-14T11:01:54.165Z

lolz

Conor 2020-10-14T11:01:57.165100Z

Hats off to their marketing department though, they're playing a blinder

alexlynham 2020-10-14T11:02:00.165200Z

so if we do need to do complex admin tasks for some reason we can run ad hoc queries which is nice

2020-10-14T11:02:05.165400Z

WebScale innit

2020-10-14T11:02:26.165900Z

it does make me appreciate the thing that datomic has got right

dharrigan 2020-10-14T11:08:30.167Z

Does anyone have recommends for a templating library, i.e., a template + vars == rendered content. This is not for webpages. I'm thinking of using Thymeleaf (which I've used before)

dharrigan 2020-10-14T11:08:39.167200Z

(it's for email templates)

dharrigan 2020-10-14T11:08:59.167500Z

I would have to do thymeleaft interop, which is no biggie...

mccraigmccraig 2020-10-14T11:33:02.168900Z

in recent memory i've used StringTemplate... which was meh... and multiple mustache variants, both home-rolled and imported - i'd probably look at https://github.com/fotoetienne/cljstache , although i haven't used it myself

dharrigan 2020-10-14T11:35:39.169300Z

interesting

dharrigan 2020-10-14T11:35:41.169500Z

will review

dharrigan 2020-10-14T11:35:42.169700Z

ta

dharrigan 2020-10-14T11:38:55.170Z

looks very good. simple, no other dependencies.

dharrigan 2020-10-14T11:39:24.170600Z

have a ๐Ÿบ or ๐Ÿต on me!

โ˜• 2
dharrigan 2020-10-14T13:07:44.171500Z

works great btw, very easy to integrate. w00t!

alexlynham 2020-10-14T13:50:02.171700Z

even in typescript vs js

alexlynham 2020-10-14T13:50:30.171800Z

i reckon conservatively 10% of our code base is in some way basically just dealing with JS being shite at handling null/undefined

thomas 2020-10-14T14:01:51.172200Z

most of the JS bugs I had to deal with were related to that

alexlynham 2020-10-14T14:03:04.172300Z

infuriatingly typescript helps to a point but tends to kick you when you're down

alexlynham 2020-10-14T14:03:16.172400Z

wasn't really an issue i've ever had in cljs

alexlynham 2020-10-14T14:03:45.172500Z

think the compilation story x lisp parens makes it easier to catch errors at dev time even tho it's dynamic not static

2020-10-14T14:38:48.176300Z

nil is certainly still a problem in clojure/script but it canโ€™t really have a bullet proof design for it, given it works on platforms where the billion dollar mistake (now surely many, many times that) already exists. It does however manage to insulate you from many problems handling it, by appropriately nil punning in the seq/core apiโ€™s etc. I canโ€™t really speak for whether typescript does it more or less than clojure, Iโ€™m sure it helps a fair bit though.

alexlynham 2020-10-14T14:39:36.176400Z

i think the design of the core api is the key really

alexlynham 2020-10-14T14:39:43.176500Z

because at dev time TS helps a lot

alexlynham 2020-10-14T14:40:13.176600Z

but at runtime you get some DEVASTATING (and i use all caps here because i think they are justified) edge case bugs

alexlynham 2020-10-14T14:40:16.176700Z

gosh darn

alexlynham 2020-10-14T14:40:38.176800Z

just stuff you take for granted in clj(s) too like what happens when you destructure something nested and a key isn't there

alexlynham 2020-10-14T14:41:05.176900Z

in some cases JS will throw, in some cases it's undefined, it's still a wild west even with the TS layer sometimes