Skip to main content
Filter by
Sorted by
Tagged with
0 votes
1 answer
45 views

Wrong observer list used when implementing Subject twice with Observer pattern

I have implemented a simple Observer pattern in c++ like this: template<typename T> class Observer { private: virtual void notify(const T& data) = 0; public: virtual ~Observer() = ...
Placeblock's user avatar
0 votes
1 answer
36 views

How to check if the object leads to memory leak with autotests?

I have an object, that have internal logic related to events subscription. I want to write an autotest, that checks if the object can be collected by GC after certain steps. For example: public ...
Nikolai's user avatar
  • 1,090
0 votes
2 answers
71 views

How can I invoke StateHasChanged() or update my UI from an implemented interface within a .net Blazor .RAZOR page?

I have a Blazor Server application. With this application, I am "talking" with MistralAI. This REST API endpoint has a streaming token you can set that will allow it to "stream" ...
Brian's user avatar
  • 1,931
-1 votes
1 answer
56 views

stateFlow value changes, but subscribers are not notified

I use koin and jetpack compose. and when I update the stateFlow value, subscribers are not informed and there is no recomposition in the composable functions. part of code in view model: private val ...
nezzuko's user avatar
0 votes
1 answer
29 views

Is there a way to "expand" an enum in C++ for "type-switching"?

For a project I need an observer class (owned by a Subject that then notifies all of its observers) that handles other behaviours. These observers work by calling their onNotify( Event* ) method that ...
thegrult's user avatar
0 votes
0 answers
21 views

How to save CoAP server observable state in central memory for multiple server instances

I have an infrastructure where CoAP server (CoAP.NET library) receives message from client 1 and publish this message to subscribers of this topic (let suppose subscriber 1). When client 2 sends ...
Umar Abbas's user avatar
  • 4,529
1 vote
1 answer
35 views

Observer pattern: hide update method from classes which are not the Publisher

Context I am writing a simple simulation library which includes Entity and Event classes. I decided to implement the Observer pattern so that as soon as an Event is simulated (Publisher), it can ...
Afelium's user avatar
  • 65
0 votes
0 answers
9 views

Understanding meaning of arrows in Observer pattern

Question Why is the association arrow from Subject to Observer in case of the interfaces? Why is the association arrow from ConcreteObserver to ConcreteSubject in case of the implementations? What is ...
james gem's user avatar
  • 141
0 votes
0 answers
24 views

Fragments with Mvvm and observer pattern are not working

I am new to android studio and I am dealing with this problem for few hours and I cannot figure it out. Hear me out. I am making and android application and inside of a main activity I have multiple ...
Marian Radu's user avatar
0 votes
1 answer
65 views

Question about observer pattern. How about there is an observer need information from two or more sources

I just carefully studied the observer pattern. And I wrote a demo snippet to better undertand it. But after I just finished the demo, a question arose, the observer pattern is between one obserable ...
John's user avatar
  • 3,402
1 vote
1 answer
41 views

.NET Rx C# Observable.FromEventPattern does not run OnCompleted

I could not figure it out why the following code could not run the OnCompleted, can anyone please help me thanks. Basically what I'm doing is everytime I press a key, I'll fire an event and convert ...
Thanh Pham's user avatar
0 votes
0 answers
30 views

How to trigger a event to refresh Configuration of multiple .net apis

We have over 100+ .net API whose configuration are fetched from gitlab configuration. Whenever someone updates the configuration, we do sync mirror and restart the service. We have a requirement where ...
Nikhil Srivastava's user avatar
3 votes
0 answers
91 views

How would the Broker pattern look like in Rust?

This great answer on how to implement the traditional observer pattern in Rust concludes with an interesting alternative idea, namely using a broker pattern instead: There are other solutions, such ...
bluenote10's user avatar
  • 25.8k
0 votes
0 answers
35 views

Dynamically updating Subscribers in Python based on changes in nested dataclasses

I am currently developing scientific modeling software in Python based on PyQt and VTK libraries. The software comprises both 3D and 2D views with various control elements. I have dynamically added 3D ...
KestMa's user avatar
  • 1
0 votes
0 answers
12 views

Selective Context Dispatches and Listeners

I've been working on an approach to selective context listening/dispatching, without using any 3rd party libraries. I think solution is working now but I wondered if any more experienced React ...
WillBuchanan's user avatar
0 votes
1 answer
94 views

Observable from Func delegate

Is there a method or library function that would accept Func<T> and return IObservable<T> by invoking it? The functionality should be probably equal to public IObservable<T> Create&...
Luboš Hemala's user avatar
0 votes
0 answers
35 views

Does the Observable.take(1) function dispose itself after taking 1?

Does an Observable.take(1) function dispose itself after taking 1?
Ralf Wickum's user avatar
  • 3,150
0 votes
0 answers
48 views

How to change mechanism of listener like launchedeffect with compose function within?

I need to change swipeStates when list param is changed, but rememberSwipeableCardState is composable function so I cannot do it I receive an error: @Composable invocations can only happen from the ...
Takeshi567's user avatar
2 votes
1 answer
84 views

How can I create a Weak<dyn T> via Weak::new()?

I am working on a pub/sub model that looks like this: trait EventObserver { ... } struct Publisher { observer: Mutex<Weak<dyn EventObserver + Send + Sync>>, } How do I initialize the ...
OLNG's user avatar
  • 185
0 votes
1 answer
167 views

Instrumentation of React's onClick events to integrate analytics

We want to track user navigation in a React app - clicks on buttons, form filling, page navigation. What we don't want - to pollute every onClick etc handlers with custom analytics code. Does react ...
gavenkoa's user avatar
  • 48k
0 votes
1 answer
60 views

Why can not load new list after delete or change item status?

I use paging3 libary to get data from api with pagination. I get it and load succesfully in onViewCreated. But when use delete api item from list. It can not load new list to adapter. When I recrated ...
Ahmet Yılmaz's user avatar
0 votes
1 answer
55 views

Who should be in charge of adding the observers to an event

I need to link three classes, Portal, WaveManager and TimeManager, so that when a condition is satisfied in Portal, TimeManager.SlowTime() and WaveManager.SpeedUpSpawn() are executed. Events seem to ...
vandermies's user avatar
1 vote
1 answer
126 views

With Node EventEmitter, how would one remove an object from a service's list while also un-subscribing from the service's event-dispatching?

I'm studying about the EventEmitter of Node.js. I'm trying to create a Bakery where customers automatically buy bread if they have money when it bakes bread. Still, I also want to create a list of ...
dvgga's user avatar
  • 13
0 votes
0 answers
29 views

MutableLiveData with ArrayList and ArrayAdapter

i am trying change my: ArrayList<Worker> Workers = new ArrayList<Worker>(); to: private MutableLiveData<ArrayList<Worker>> Workers = new MutableLiveData<>(); i built ...
עמית ישי's user avatar
0 votes
1 answer
99 views

How to notify parent component using observable in child component Angular?

There is this father component 'SalesListComponent' <div class="container"> <div> <h3>Total Venda: R${{totalCashierDay}}</h3> <div *ngFor=&...
Rodrigo Cezar's user avatar
0 votes
0 answers
44 views

Does using Observer pattern mean using simple state management?

From here: https://medium.com/@ChanakaDev/reactive-state-management-with-getx-39f73527ce84#:~:text=Note%3A,the%20help%20of%20a%20method. Note: It seems like using the reactive way for the state ...
Aquarius_Girl's user avatar
0 votes
1 answer
74 views

Push and Pull Communication Styles in oop: why Push style is not flexible?

I'm trying to learn Observer Design Pattern and I started to watch the series which belongs to codewithmosh called "The Ultimate Design Pattern Series". in the lesson which was about ...
Mehdi's user avatar
  • 153
2 votes
1 answer
136 views

Modelling Gof Observer patterns in UML

I am in the process of modeling my project, which I will subsequently implement in Java, utilizing UML. The focus of my project is the management of a gym. Currently, I am working on modeling my GoF ...
LuX's user avatar
  • 65
0 votes
0 answers
48 views

How to remove redundant elements from the beginning of an array when implementing infinite scroll in react?

There is a page that receives a data stream of a YouTube video. I output this data to the page and implement infinite scrolling with observer. Visualization: enter image description here Problem. When ...
Денис Ястребов's user avatar
0 votes
1 answer
61 views

Create and integrate custom events in a Java Swing App

I've been creating a Java Swing app which tracks the position of dummy cars and plots them on a map. I'm afraid that the app is getting bigger and I need a sort of split between UI and app logic. Is ...
Cesar's user avatar
  • 3
3 votes
0 answers
43 views

Why do Observable Objects notify observers before the change occurs rather than after in Swift? [duplicate]

The new Observation features come with a withObservationTracking(_ apply:onChange:) that executes the onChange closure when any property accessed in the apply closure is modified. However, the ...
rayaantaneja's user avatar
  • 1,716
-1 votes
1 answer
69 views

Observe property change in Spring tests

Consider a Service-Bean, that sets a property on some schedule: @Service class UserService { var userInfo: Map<String, UserInfo>? = null @Scheduled(...) private fun fetchUserInfo()...
DFPy's user avatar
  • 1
1 vote
1 answer
509 views

In Godot 4.1.1, signal from Area2d that detects if a RigidBody2D, that is inside that Area2d, is leaving, but not completely left yet

In a scene that has a RigidBody2D inside an Area2D, I want to detect the moment that the RigidBody2D have some portion out of the said Area2D. I now that the Area2D has two signals with a body as a ...
vinicius de novaes's user avatar
0 votes
1 answer
2k views

Exception: Error happened when building Observer, but it was captured since disableErrorBoundaries==true

I am returning below widget in my build method of StatefulWidget class in flutter app: return Stack( children: [ Observer( builder: (context) { return SingleChildScrollView( ...
Jaimin Modi's user avatar
  • 1,651
2 votes
1 answer
49 views

Conceptual 'Class Model' mapping an 'Observer Pattern' in UML

I am drawing a conceptual UML Class Diagram based on an Observer Pattern between a UI layer and a mapped domain, where the publisher pushes notifications in the form of SQL queries to the different ...
Aleksandar's user avatar
0 votes
0 answers
98 views

Can a delegate in C# contain a collection of objects?

Assume the following Observer Pattern as described in the UML diagram below: Previously, the subscribers to the publisher were updated by the Notify() method in Academy through a collection List<...
Aleksandar's user avatar
0 votes
0 answers
60 views

NullPointerException in getViewBinding

I have a fragment that uses viewbinding through eventhandlers. The eventhandlers are setup and taken down in onResume() and onPause(). In rare cases accessing the view through events results in a ...
mrbang's user avatar
  • 366
1 vote
0 answers
141 views

How to find objects which are accessing a map

Context I am writing a dashboard builder application. Users create visualizations in the dashboard which access variables defined in the dashboard to generate queries. Here is an example. Dashboard: ...
Madhusoodan P's user avatar
-1 votes
1 answer
2k views

Java - Custom Thread Pool vs Spring Event with Async Handlers

I am working on intercepting service layer methods and capture runtime business data and write it to some sort of persistence. After intercepting the methods, I am planning to do the persistence part ...
user762421's user avatar
0 votes
0 answers
34 views

How can I improve my solution for implementing the Observer Pattern using Java Generics?

Unsatisfying Solution for Implementing Observer Pattern Using Java Generics For educational reasons I wanted to implement the Observer Pattern using Java Generics. I came up with the following ...
bhansen's user avatar
0 votes
0 answers
136 views

Unity FSM which is controlled by Enums, Not Transitioning with Delay

I'm using a Finite State Machine (FSM) in Unity3d to control my character's behavior. I have two states for this case: Wait and Idle. The FSM should transition from Wait to Idle after a set amount of ...
New One's user avatar
  • 11
1 vote
0 answers
83 views

Crash occurs with observer pattern using smart_ptrs [duplicate]

I am trying to implement observer design pattern using C++ 11 smart pointers. Below is my code. The below program crashes if we try to remove the observer from the subject. //observer class ...
Meraj Hussain's user avatar
0 votes
0 answers
30 views

Is there a smart way to send a String between two classes that are not supposed to interract with eachother?

I should begin to say that I am quite new to Java. I am trying to write a simple chat program and thought it would be nice to have "popup" messages, for example if the intended message did ...
flurp.potatis's user avatar
2 votes
0 answers
195 views

Implementing the observer pattern with nested elements

Update: So I'm still struggling to create a hierarchy where the parent is responsible for rendering its nested children, and keeping track of children that need to be registered/unregistered. ...
NickW's user avatar
  • 1,304
3 votes
1 answer
373 views

HRV background observer for HealthKit never triggers (react native)

I'm working on a React-Native app that on the iOS side collects HRV readings from HealthKit, I need to mount an observer that triggers when new HRV readings are added to HealthKit. I also need it to ...
Alex Skotner's user avatar
0 votes
1 answer
197 views

Why Observer Pattern Doesn't Work Properly In a Unity3d Project?

In my game I have a script attached to a child object(muzzle) of a game object (Pistol -parent object-) that becames SetActive(false) and SetActive(true) frequently. public class Pistol : ...
New One's user avatar
  • 11
1 vote
1 answer
30 views

update() method gets called/notified in ScoreView class, but does not update the Label

public class ScoreView extends Container implements Observer { private Label livesLabel; private Label foodLevelLabel; public ScoreView() { // Create and add labels to the container ...
H.Aslan's user avatar
  • 11
0 votes
0 answers
180 views

Combining the state and observable patterns in Rust

I've been interested in working with Rust for a while and wanted to recreate one of my school projects in it. This project involves creating an Order which goes through multiple stages much like this ...
TheCodingDragon's user avatar
0 votes
1 answer
199 views

Mirroring C++ model class hierarchy in Model-View-Controller

I have a system which describes lots of devices with complex data and behavior represented by a sophisticated class hierarchy in C++. This part of the system knows nothing about the onscreen ...
Damir Tenishev's user avatar
0 votes
1 answer
57 views

Observer Pattern Closing Observable While Notifying

I have a observable object that creates a UDP socket. This object has methods to send packets from that UDP socket and a thread to listen for received packets and invoke the PacketReceived event when ...
M.Toy's user avatar
  • 103

1
2 3 4 5
37