reactive-programming

R Shiny Tabsets simultaneous processing

瘦欲@ 提交于 2019-12-07 14:22:56
问题 I have a R Shiny app, which calculates several statistics in different tabsets. As the calculations are quite computation intensive, I use submitButton to prevent reactivity. My problem is now that each calculation (all in different tabsets) are writing outputs to a folder and I want Shiny to write an output for all tabsets when initializing. Unfortunately, Shiny only creates an output for the tabset, that is active when initializing. Is there a way to tell Shiny , that it should calculate

Exception handling in rxjava

こ雲淡風輕ζ 提交于 2019-12-07 13:08:50
问题 I am trying to get accustomed to rxjava and I am trying to call the below QuoteReader in an Observable. I am not sure how to handle the exception thrown, public class QuoteReader { public Map<String, Object> getQuote() throws IOException{ OkHttpClient okHttpClient = new OkHttpClient(); Request request = new Request.Builder().url("http://quotes.rest/qod.json").build(); Gson gson = new Gson(); Map<String, Object> responseMap = null; try(Response response = okHttpClient.newCall(request).execute(

ggvis plots rendered using bind_shiny() aren't reactive

荒凉一梦 提交于 2019-12-07 12:59:45
问题 I think I'm missing some basic aspect of ggvis + shiny. Following the tutorials, plots are constructed in server.R using a series of %>% pipes, ending with bind_shiny, which associates the plot with an identifier that can be referred to in ui.R What I don't get though is that the plot itself is not reactive in the way that code within renderTable(), renderText() or reactive() will be. So if I want to refer to an input parameter like input$x in defining the plot, it won't work, I'll get an

RxJs avoid external state but still access previous values

妖精的绣舞 提交于 2019-12-07 08:59:46
问题 I'm using RxJs to listen to a amqp queu (not really relevant). I have a function createConnection that returns an Observable that emits the new connection object. Once I have a connection, I want to send messages through it every 1000ms and after 10 messages I want to close the connection. I'm trying to avoid external state, but if I don't store the connection in an external variable, how can I close it? See I begin with the connection, then flatMap and push messages, so after a few chains I

Reactive Extensions swallows exceptions from OnNext() called on a thread pool thread?

纵饮孤独 提交于 2019-12-07 08:52:40
问题 I use Rx 2 in .Net 4.5. When the following code runs, it just exits silently without executing the OnCompleted delegate or showing any errors. If I use Scheduler.CurrentThread in ToObservable , it will at least throw the error and terminate the program, at which point not executing OnCompleted makes sense. But when this is executed in a thread other than the main one, this behavior seems unreasonable and unacceptable. Do I miss anything? static void Main() { Enumerable.Range(0, 1)

RxJava performing operation on a list and returning an observable

痴心易碎 提交于 2019-12-07 08:29:06
问题 I'm new to RxJava (specifically, RxJava2) and I'm having some trouble with what seems to be a relatively easy operation. I need to get some data from a db, iterate through the data (it is represented as a list), perform an operation on each item, wrap the data in another object and return. This is what I have so far: mDataManager .getStuffList(id) .flatMapIterable(listOfStuff -> listOfStuff) .flatMap(item -> mDataManager .performCount(id, item.getTitle()) .doOnNext(item::setCounter) .takeLast

subscribe_on with from_iterable/range in RxPY

让人想犯罪 __ 提交于 2019-12-07 07:56:57
问题 I'm trying to get my head around scheduling in reactive extensions for python. I would like to use subscribe_on to process multiple observables in parallel. This works fine if the observable is created with just , but not if for example range or from_ are used. just defaults to Scheduler.immediate , while other generators default to Scheduler.current_thread . Which causes the difference, but feels inconsistent to me. Probably because I don't grasp the full problem. Consider the following

Synchronous stream of responses from a stream of requests with RxJS

时间秒杀一切 提交于 2019-12-07 05:23:18
问题 I'm new to RxJS and was wondering if anyone could help me. I want to create a synchronous stream of responses (preferably with the corresponding requests) from a stream of requests(payload data). I basically want the requests to be sent one by one, each waiting for the response from the last one. I tried this, but it sends everything at once ( jsbin ): var requestStream, responseStream; requestStream = Rx.Observable.from(['a','b','c','d','e']); responseStream = requestStream.flatMap(

What is the MutableLiveData equivalent in RxJava?

别来无恙 提交于 2019-12-07 05:09:31
问题 Per the example below from the LiveData Android documentation, what would be the RxJava 2 equivalent? We certainly can use a combination of publish() , refcount() and replay() to achieve the core of the MutableLiveData observable behavior. That said, what would be the analogous counterpart of mCurrentName.setValue() as it pertains to detecting a change and emitting the corresponding event? public class NameViewModel extends ViewModel { // Create a LiveData with a String private

Meteor - How can I pass data between helpers and events for a template?

℡╲_俬逩灬. 提交于 2019-12-07 05:04:22
问题 I'm a bit new to Meteor and something I'm having trouble with is reactive data -- particularly in instances where I need to change the data shown based on a mouse or keyboard event. Doing this kind of stuff the normal js way seems to give me trouble in meteor since everything I change gets re-rendered and reset constantly. So, I thought I'd see if this would be a case in which I could use Meteor's Deps object, however I can't quite grasp it. Here's the code I'm using: (function(){ var tenants