This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
- # beginners (49)
- # boot (139)
- # cider (10)
- # clojure (82)
- # clojure-belgium (59)
- # clojure-dusseldorf (5)
- # clojure-russia (11)
- # clojure-sanfrancisco (2)
- # clojure-uk (56)
- # clojurebridge (4)
- # clojurescript (138)
- # cursive (19)
- # datomic (8)
- # dirac (1)
- # editors (11)
- # emacs (18)
- # flambo (21)
- # hoplon (45)
- # jobs (1)
- # juxt (3)
- # keechma (1)
- # mount (43)
- # off-topic (2)
- # om (64)
- # om-next (1)
- # onyx (2)
- # other-languages (8)
- # re-frame (72)
- # reagent (99)
- # ring-swagger (7)
- # rum (3)
- # spacemacs (21)
- # specter (5)
- # untangled (42)
- # vim (4)
- # yada (7)
I'm still just getting started, experimenting with tweaks to the Get Started project (https://github.com/hoplon/hoplon/wiki/Get-Started). I want to add a text area to the web page, into which the user can type, and then grab that text in the function called when a button is pressed. I had thought from the name that an input cell would do that... but not the one used in the example... Is there a simple example of this in one of the demos, or can someone give me code or a pointer to help me do this?
hm, with a textarea it's a little tricker, since textareas don't have a
value attribute. their value is stored as a child text node
@alandipert: For even more generality/utility, it'd be great if the output area could be written to incrementally, in case the "process" function takes a long time to run and you want to provide status messages along the way.
but if process takes a long time, you might want to use a watch instead... and leave cell world
the idea with javelin is that most UI updates are not cpu-heavy, just hard to orchestrate and do consistently
instead using them to build interfaces in front of other (potentially cpu/io heavy) processing
@alandipert: Woo hoo! And the separate status cell sounds right too. I can't try this right now (in a workshop...) but will as soon as I get a chance.
@alandipert: I'm not sure that I do fully understand your comment about the concepts behind javelin and UI updates, but my "process" function will indeed almost always be CPU heavy (in a big way, sometimes).
if you try to use just 1 thread, the UI thread can block processing and vice versa, which is not what anyone usually wants
the browser environment is single-threaded, so to do work without blocking one needs to program with callbacks, which get queued kind of the way threads get scheduled
tl;dr it's not good to put functions that could block for a long time in formula cells, since that will block updates for any dependent UI bits
But in that one thread, could I occasionally spit out some status to the status cell and have it actually appear in the browser while I keep computing?
there is something call a webworker, which is a limited form of thread and kind of weird to work with
Hmm. What I want to do is conceptually like a single threaded program running in a terminal, which prints stuff out along the way while it does a long computation
for something compute-heavy that looks like Javelin you can look at http://docs.paralleluniverse.co/pulsar/ - the Dataflow part
Hmmm... from a quick look at pulsar I don't see how to get started with what I know, without learning a lot more. The lovely thing that attracted me to holon is the Get Started page that showed how to get a complete web page app up knowing only pure Clojure.
I think I'm going to try to stick with hoplon, ignore the issue about blocking, etc., and see how far I get
Mainly just because it seems to me like it will be the easiest way, by far, to get something running in the users' browsers
@alandipert: re: "and this computation is happening in the browser, not in the server?" Yeah, that's the idea. But again, just because I'm not a web programmer and don't know what I'm doing 🙂. The particular program I want to do this with is something that people could run in their terminals... except that my audience is mathematicians, many who won't know how to install anything on their computers... so since it's in Clojure, and since Clojurescript exists, I thought it'd be easiest to put something up that lets them run it in their browsers... and hoplon looks like it will let me do this without learning much of anything about web programming, assuming that I can handle the issues raised here (maybe I already can -- I have to study and try the code you posted :-).