Fork me on GitHub
#datascript
<
2020-09-04
>
stathissideris20:09:27

hello, does datascript somehow allow you to “subscribe” to queries? or somehow get notified to changes of part of the db?

metasoarous22:09:06

@stathissideris Right now, the best solution to this is still https://github.com/mpdairy/posh, though I'll warn you that it is not perfect about guessing when it needs to update query results, in particular if you have things like recursive queries.

metasoarous22:09:42

That's assuming you're looking for client side support. There's also a re-posh plugin somewhere if you're using re-frame.

metasoarous22:09:13

If you're looking for server side support for this kind of thing, you might want to take a look at https://github.com/sixthnormal/clj-3df.

stathissideris22:09:17

Thanks! I was actually planning to use it with Java Swing

metasoarous22:09:30

Cool! There was an effort some while back getting things to work clojure side, which is a little tricky cause there's no reagent. I don't remember/know what came of that, but maybe someone else can chime in.

metasoarous22:09:54

Either way, may be worth checking out 3df as well, though I'll caution you that it doesn't cover all of datomic/datascript either. The underpinnings are in Rust, so naturally you can't use clj(s) functions for queries. Also, I think there are some kinds of queries it can't do perfectly (yet).

stathissideris22:09:14

Ok thanks, I’ll give it a go

metasoarous22:09:53

Cool! Excited to hear how that works for you.

stathissideris22:09:17

I think if I can get the changes fro the transaction I might be fine with writing code that explicitly updates my swing gui

stathissideris22:09:32

I really don’t want to invent react on swing

stathissideris22:09:45

It’s too big a yak to shave 😄

metasoarous22:09:33

Yeah, kind of depends on your update model, right? Like, if this is just a desktop app, probably fine just to recompute all queries on every tx. But if it's got multiple users or lots of changes, something like posh or 3df may help.

metasoarous22:09:42

I did a thing with datomic and cljfx once upon a time, but I don't remember how I managed the update logic. Can potentially find some time next week to look back at that if you're interested.

stathissideris22:09:57

It’s desktop, I’m writing a Clojure-based spreadsheet

😎 3
stathissideris22:09:45

Thanks, but cljfx is already react-like so I’m not sure how applicable it would be in my case

metasoarous23:09:06

Any reason you're bound to swing over javafx? 🙂

metasoarous23:09:37

Clojure based spreadsheet, huh? Sounds cool 🙂

metasoarous23:09:03

Interested in hearing what you're vision is there if you're able to share at this point.

metasoarous23:09:49

FWIW, I recently started using a super simple spreadsheet app called tad (https://www.tadviewer.com/). It's much lighter weight than excel or libreoffice calc, and I've found it pretty helpful for quick skimming csv files and such. It's not a full spreadsheet app though (though has some interesting tricks up its sleave, like sorting and pivots). Curious to hear where on the spectrum you're aiming for. I'd love to have a full spreadsheet model, where clojure-based cell formulas 🙂

stathissideris23:09:15

I think I may have seen tad before, it’s mainly for pivots, right?

stathissideris23:09:05

I tried javafx and it was too buggy and heavy for my tastes, and also i like the fact that swing you have no extra deps

👍 3
metasoarous23:09:07

Yeah, it (tad) doesn't have a lot of bells and whistles; Focus is on simplicity. But it's "tight" package and great for quickly scanning through files.

stathissideris23:09:58

In terms of vision: it’s going to have Clojure as its primary scripting language, I’ll also try to make it as keyboard driven as possible. Will allow you to load deps and use them in the cells, so it should work with existing code relatively easily. Not sure about that yet, but I think it’s going to be a commercial app

stathissideris23:09:10

Not sure if there is a market

stathissideris23:09:45

Here’s an early demo from a while ago https://youtu.be/dd0yBua-o18

metasoarous23:09:03

Very cool 🙂

metasoarous23:09:12

Do you have a target price point yet?

stathissideris23:09:38

No idea, I’ve never sold software as a product before

stathissideris23:09:14

I’ve mainly released open source and that’s easy to “sell” 😊

stathissideris23:09:09

Is the video meant to be joke? :thinking_face:

metasoarous23:09:25

Like: "Look at us, selling software."

stathissideris23:09:06

Oh! 😀 Have you ever sold any software you made?

metasoarous23:09:26

As a service, yes; Never a desktop app.

stathissideris23:09:51

Desktop is weird these days

✔️ 3
stathissideris23:09:11

I think there may be a market in finance for what I’m building

metasoarous23:09:52

I'd consider it

stathissideris23:09:05

Great to hear, now all that remains is to build it 😀

metal 3
metasoarous23:09:26

FWIW, I'll be probably 2x more likely to buy it if I can use Oz/Vega for vizs 🙂

stathissideris23:09:35

Vega is definitely going to be part of this

phronmophobic23:09:07

@stathissideris, not sure if you would consider something a little experimental, but if you're trying to build for desktop with something that's not swing and is not javafx, you can try https://github.com/phronmophobic/membrane. the graphics and event model is pure clojure

stathissideris23:09:16

@smith.adriane oh I think I’ve seen this before and I do like the idea of skipping all the legacy that sits awkwardly in the middle of my app, but it looks like it would slow me down at this stage because I’d have to reimplement tables in membrane which is a large undertaking

👍 3
phronmophobic23:09:24

it would definitely slow you down in the short term. it depends on how much flexibility you would like to have with your UI in the long run. my experience is that once you start trying to do things that aren't built in with swing/cljfx, then it gets really hair really quickly.

stathissideris23:09:11

Yes, you’re right and I’ve ran into this sort of thing in the past

stathissideris23:09:30

I tried implementing a Clojure data structure inspector by drawing directly onto a canvas and it was way more effort than I had imagined

stathissideris23:09:31

What’s your motivation for this?

phronmophobic23:09:58

the short story is that I wanted all the cool react/re-frame/etc stuff available in the browser/cljs world, but I wanted to build a desktop app.

stathissideris23:09:32

And did you? (Build the app)

stathissideris23:09:03

I’m only asking because yak shaving sometimes depletes my energy to the point of not wanting to do the original thing anymore

phronmophobic23:09:44

I've been having a lot of fun improving the membrane

stathissideris23:09:58

Some would say that you’re stuck in the membrane :rolling_on_the_floor_laughing:

😁 3
phronmophobic23:09:26

I've been building lots of one-off apps

stathissideris11:09:53

Like what? I’m curious

phronmophobic19:09:36

here's some examples of one-off apps I built: • internal tool for transferring client's data • tool to quickly crop photos • ui for searching an old mbox file of customer support emails • I built a hobby project that could take a recording of someone playing every note on an instrument and then clip the notes to play any midi file using those clips. I made a simple ui to help detect the pitch of each note as well as automatically clip it • ui for keeping track of stuff for a board game I used to play with friends before the pandemic (gloomhaven) • https://github.com/phronmophobic/treemap-clj and the corresponding https://blog.phronemophobic.com/treemap/treemaps-are-awesome.html • some one-off charts

phronmophobic19:09:47

very cool project

stathissideris21:09:36

Thanks for the list, it sounds like you’ve done quite a few things with it!

stathissideris21:09:50

Glad you like spec-provider 😊

phronmophobic23:09:16

I was actually wanting to build a spreadsheet-like app, but wanted access to the file system, better networking options, multi-processing, etc. which is nicer on the jvm compared to browser/node environments

👍 3
stathissideris23:09:58

Have you implemented scrolling in membrane yet?

stathissideris23:09:50

Oh yeah it’s in the demo

phronmophobic23:09:15

although, I have an irrational disdain for scrollviews, so I don't use them very often and support could probably be improved

stathissideris23:09:23

That’s where I gave up

stathissideris23:09:38

Text boxes couldn’t have been easy

phronmophobic23:09:24

it's not too bad. I recently found https://github.com/mogenslund/liquid, which I'm trying to make better use of

phronmophobic23:09:06

liquid has its own renderer(s), but the model is very flexible and you can easily integrate it with your own graphics model

stathissideris23:09:37

membrane looks very interesting, I think I’ll devote some time to study your code

phronmophobic23:09:32

I've been using it for my own projects, but there are still some rough bits. don't hesitate to ping me or ask questions in #membrane