reactive-programming

ReactiveCommand CanExecute reacting to changes in a collection

本小妞迷上赌 提交于 2019-12-25 04:45:23
问题 I have a ReactiveCollection filled with Items (that are ReactiveObjects as well). I want to create a ReactiveCommand that should be enabled only when any of the items in the collection has some property set to true, something like: MyCommand = ReactiveCommand.Create( watch items in collection to see if item.MyProp == true ) So anytime there is one of the items with the property set to true, the command should be enabled. EDIT: Thanks, Paul. The resulting code is this: public MainViewModel() {

Merging multiple custom observables in RX

女生的网名这么多〃 提交于 2019-12-25 04:32:11
问题 Trying to model a system sending out notifications from a number of publishers using RX. I have two custom interfaces ITopicObservable and ITopicObserver to model the fact that the implementing classes will have other properties and methods apart from the IObservable and IObserver interfaces. The problem I have is that my thinking is I should be able to add a number of observables together, merge them together and subscribe to an observer to provide updates from all merged observables.

Sort collection of objects with Reactive Extensions in Java?

断了今生、忘了曾经 提交于 2019-12-25 02:06:34
问题 How can I can sort a collection of objects using rxjava based on one or more fields of the objects? public class Car { public String model; public int numberOfWheels; public String color; public int yearOfProduction; } List<Car> cars = new ArrayList<>(); cars.add(...); cars.add(...); Observable<List<Car>> getCars() { Observable.just(cars) }; Observable<List<Car>> getCarsSortedByModel() { ??? }; Observable<List<Car>> getCarsSortedByColor() { ??? }; Observable<List<Car>>

Spring Boot + Webflux + Reactive MongoDB - get document by property Id

怎甘沉沦 提交于 2019-12-25 01:08:41
问题 I'd like to find all Offer documents by Offer.ProductProperties.brand: @Document(collection = "offers") public class Offer { @Id private String id; @NotNull @DBRef private ProductProperties properties; ProductProperties: @Document(collection = "product_properties") public class ProductProperties { @Id private String id; @NotNull @NotEmpty private String brand; Service: Flux<ProductProperties> all = productPropertiesRepository.findAllByBrand(brand); List<String> productPropIds = all.toStream()

Monitoring queue of ExecutionContextExecutor “scala.concurrent.ExecutionContext.Implicits.global”

无人久伴 提交于 2019-12-25 00:47:08
问题 Is there any way to monitor the task queue of scala.concurrent.ExecutionContext.Implicits.global ? ie., see the number of tasks waiting for a thread to be released? 回答1: JDK comes along with jconsole and jmc . You can use them to see thread usage. You can see, Thread state, blocked count thread allocated bytes etc scala implicit threads name start with scala-execution-context-global-n . jmc screenshot: Related: what is the best way to get the number of futures running in background in an

How to call shiny module based on reactive input?

若如初见. 提交于 2019-12-24 22:17:12
问题 I would like to call a nested module server based on a reactive input and display the return output on the main panel. The function callModule doesn't seem to work here when it is depending on a reactive input. I assume this to be a common scenario when you’re building a complex app but I’ve been struggling to find a solution. Below is my code or you can run the app by entering the following command in R: shiny::runGist("23abbb50a1df6a91af990a7401919044") Thank you in advance. library(shiny)

Why is the handler for a REST endpoint being accessed twice, when accessed from a WebClient?

人走茶凉 提交于 2019-12-24 20:22:40
问题 This is a second attempt, with revised demo code that, hopefully, better illustrates the issue. The code has been stripped down to remove all elements except those demonstrating the issue being encountered. Add Note: Some additional testing was done, and the results posted as an answer (vice extending this post). It may be that this is "expected behavior", but I'm still trying to understand "the why". The code "works", in that it returns the expected information (either a String, or a list of

rxjs zip is not lazy?

旧时模样 提交于 2019-12-24 12:22:26
问题 I 've removed the boilerplate to get to the point // a.js // My observables from stream and event this.a = Rx.Node.fromStream(this.aStream()); this.itemSource = Rx.Observable.fromEvent(ee, 'addItem'); // Zip 'em this.itemcombo = Rx.Observable.zip(this.a, this.itemSource, function (s1, s2) { return {item: s2, a: s1.toString()}; }); // Streams the lowercase alphabet rb.prototype.aStream = function aStream() { var rs = Readable(); var c = 97; rs._read = function () { rs.push(String.fromCharCode

RxSwift : manage object updates in the app

筅森魡賤 提交于 2019-12-24 10:59:36
问题 I have a big concern about how to manage object properties changes. Imagine I have a "car" class, with some properties like "name", "date", "price" etc. In my view "A", I'm displaying all cars I retrieve from a API. In a view B & C, I can display and edit specific information about the car selected in the view A (let's say it's "car AAA"). it's possible too, to refresh the car object with a API call to retrieve the last information about the car. I want to be able to update the view A, if the

Applying leaflet map bounds to filter data, within Shiny

无人久伴 提交于 2019-12-24 08:58:39
问题 The code below is meant to reproduce that which is found in this example with the exception of adding an additional parameter for "speed". However, my map-datatable link has broken - Can anyone help me spot the bug ? The original code updates the table based on the bounds of the map, while in my code changing the map zoom has no effect on my table. I'm also not able to get the "speed" filter to work on the table and map, which is a functionality I am looking for. Any pointers would be