Fork me on GitHub
#clojure-uk
<
2017-11-02
>
thomas08:11:44

moin moin morning

otfrom08:11:06

I'm heading down to London for the next 7 days

jasonbell08:11:40

I’m never going to complain about Clojure or Java ever again. After working with Swift it’s ready to go out of the window, every release had breaking changes.

otfrom08:11:03

and now, I apparently understand monoids

chrjs11:11:35

ba dm tsh

thomas08:11:05

Added it to my list of video's to watch, thank you @otfrom

mccraigmccraig09:11:46

now you only need a vid on the category of endofunctors and you'll achieve monad nirvana @otfrom

guy10:11:09

Morning!

maleghast11:11:59

Morning All 🙂

maleghast11:11:51

Have any of you people had good results with OpenStreetMap and ClojureScript, and if so which libraries have you gone for..? I am using React through Reagent at the moment, so react-leaflet seems like a good idea, but I would be interested in alternatives if y’all have any recommendations..?

mccraigmccraig11:11:26

i've done lots with cljs and leaflet @maleghast - and leaflet works fine with OSM i believe

mccraigmccraig11:11:06

at the time i used om-old, and our own leaflet component... react-leaflet looks like a good idea

mccraigmccraig11:11:35

although it wasn't hard to use with plain om, so it shouldn't be hard with plain reagent

maleghast11:11:43

Splendid! Thanks @mccraigmccraig 🙂 I am a bit new to all this front end stuff - will Leaflet “play nicely” with GoogleMaps if we get a paid subscription “down the line”

mccraigmccraig11:11:10

i did an experiment with using google-maps tiles with leaflet - that worked fine - not sure about licensing though. we ended up using mapbox for our tiles - leaflet is their default UI and it was easily customisable for themes etc

mccraigmccraig11:11:40

we also did another experiment with ordnance survey for tiles - that was fine too

mccraigmccraig11:11:36

if you end up having to do lost of geospatial transformation @maleghast i recommend PostGIS, and if you end up with a lot of queries which need to do full-table scans every time the UI updates a control then elasticsearch is blindingly fast for such spatial queries

maleghast11:11:48

Oooh, this is all very good to know - thanks… I am putting together a PostGIS database at the moment, not that I have the slightest idea how to use it, but I have been asked to build one…

maleghast11:11:22

ES is a great technology for so many things - I had a sense that it was good at GeoSpatial, good to have that confirmed “from the sharp end” so to speak.

maleghast11:11:01

Were you putting GIS data into ES from PostGIS - using ES like a big Geospatial Cache - or did you just use ES on its own?

mccraigmccraig11:11:03

no, i did exactly that - do all the geospatial munging in PostGIS then upload to ES to serve

mccraigmccraig11:11:09

it imports ordnance survey shapefiles into PostGIS and does the co-ordinate system mapping from OS national grid (EPSG:27700) to WGS.84 (EPSG:4326) which is the system all the web maps use

mccraigmccraig11:11:33

and make sure you are using a recent postgresql @maleghast

maleghast11:11:36

Thanks very much 🙂 We’re running on 9.6.x I think…

maleghast11:11:45

(AWS RDS current PostgreSQL version)

mccraigmccraig11:11:37

that will be fine... there was an earlier version 9.0 or 9.1 or something which had some errors in the parameters in the PostGIS coordinate-system database, which messed your life up good

maleghast11:11:31

Ah ok then - dodged that bullet phew

maleghast11:11:38

I have a creeping sense that I am going to have to learn a LOT MORE about geospatial stuff before I am done…

maleghast11:11:55

All feels very new and intimidating at the moment.

mccraigmccraig11:11:12

you will have to learn a bunch of new terminology... but most of the painful stuff is nicely packaged by PostGIS and ES

maleghast11:11:27

That’s good to know 🙂

maleghast11:11:35

I need to import the GADM data into PostGIS in the next couple of days - I am still not clear on how to use__ it once it’s in there however… I mean once it’s imported how does one write a query to get the boundary for say Lancashire? More to the point how does that data come out, i.e. what format is it in etc.? I am asking rhetorically - I am not looking for you to answer the questions at all, I promise. I am just trying to illustrate my level of ignorance 🙂 If you have any good recommendations for learning resources, however, that would be greatly appreciated.

mccraigmccraig11:11:39

import the data first - find out the EPSG # for it's coordinate system and plug it in to a script like the one i gave you above. each shapefile will import to a single postgresql table

mccraigmccraig11:11:44

once you have the data in postgis then you can just select from tables... the geospatial data is in custom formats, but there are sql fns to work with them and indexes which support them, so it's sql all the way down

mccraigmccraig11:11:51

generally there will be a bunch of metadata columns and a geospatial column in a geospatial table... it's been an age though and i don't even have postgresql installed on my current machine, so my knowledge is kinda hazy

thomas12:11:40

@maleghast this is a project that uses openlayers, haven't tried leaflet .

maleghast12:11:56

@mccraigmccraig - Thanks for the overview; it’s encouraging me to hold the view that it’s not so scary as I’ve persuaded myself that it might be.

maleghast12:11:09

@thomas - Thanks I will take a look at that 🙂

mccraigmccraig12:11:26

it's actually great fun @maleghast

otfrom17:11:22

@mccraigmccraig pushed at your or thought of by you as reasonable things?

danm17:11:36

@otfrom Does your wording imply your thoughts on the matter? 😉

otfrom17:11:11

@carr0t I like streams of events. I'm a fan

danm17:11:34

Heh, fair enough. I thought from your phrasing you were suggesting otherwise

danm17:11:44

We use Kafka for our event streams

danm17:11:50

Connecting many Clojure microservices

jasonbell17:11:48

An interesting thread by Jay Krepps on Twitter last night on why Kafka was on 0.x for so long.

danm17:11:47

Heh. The excuse I was given was "We hadn't done anything important enough to go to 1.x". Now they've done exactly-once delivery (apparently)

danm17:11:52

What was the thread consensus?

jasonbell17:11:50

And the tooling on streams, KSQL that kinda thing. Made sense.

jasonbell17:11:17

The 0.x was immaterial to me, it was solid enough to use.

danm17:11:31

Likewise

danm17:11:51

We're still on 0.10.2 at the moment. Do need to go to 1.0 at some point but no rush

mccraigmccraig17:11:19

@otfrom thought of by me as reasonable things... not kafka/onyx style streams though - that would be all heavyweight - manifold style streams

mccraigmccraig17:11:45

turns out that with a few stream primitives, sort-merge, outer-join, inner-join, cross-streams, you can do all sorts of fun stuff very fast with sorted streams of records from cassandra

otfrom19:11:02

Ooh. That sounds awesome

mccraigmccraig20:11:22

it's great when you need to do small-to-moderate-sized joins in cassandra - think 10ks of records, maybe 100ks - for large joins use spark already - but a lot of my current problems seem to fit into that category, e.g. expand a list of all the subscribers to a timeline or match import records against existing db records

yogidevbear20:11:49

The stuff you work on sounds like a lot of fun @mccraigmccraig

yogidevbear20:11:05

I might just be weird though

yogidevbear20:11:23

Not that those two are necessarily mutually exclusive 🙃

mccraigmccraig20:11:45

ha, well i mostly find it fun too, although the last release was a bit brutal

otfrom21:11:59

Are you able to join streams without using c* for the lookups?

mccraigmccraig21:11:17

@otfrom if you get a stream of records from c* from a partition sorted by the join-key then you can efficiently get a lot of records with very few queries - joining is then just doing the merge part of a sort-merge join

otfrom21:11:38

Sounds like I have some reading to do

mccraigmccraig21:11:30

example - i get 3 streams from cassandra, all sorted by participant-id, conversation-participants, conversation-participant-reaction-counts and conversation-participant-notification-counts ... joining these 3 streams is just a matter of repeatedly considering the records at the head of the 3 streams, and selecting those (1 or more) with the least participant-id to merge and put on to the output stream

mccraigmccraig21:11:46

as long as your c* client supports streams (alia does) then there are very few queries (you can adjust it, but iirc the default page-size is 5000 in alia), the joins happen purely in memory and it's all non-blocking

mccraigmccraig21:11:31

you can probably do something very similar with the core.async interface in alia too