Questions tagged as 'singleton'

1
answer

What is a singleton variable in prolog?

I'm doing a job in Prolog and when trying to make a query it says there are "Singleton variables". For example, a part of the code: s([Policia_X, Policia_Y, Ladrao_X, Ladrao_Y]) :- pode_andar_horizontal([Policia_X, Policia_Y]). Returns the...
asked by 25.10.2018 / 03:00
1
answer

Returning error in insert function

Good morning. My function is returning an error, but I do not know what you mean, I used the Singleton pattern to do so I will post 2 codes: <?php class IndicadoDAO{ private $idIndicado; private $nome; private $e...
asked by 04.12.2018 / 14:18
1
answer

Project Standards: Singleton

I know that Singleton guarantees me a single instance of a given object. I got this. What creates me doubt would be its use in practice like that. Let's assume the code below, using Singleton with Generics (code taken from t...
asked by 08.12.2017 / 10:23
1
answer

Singleton Pattern

I'm creating a project in C # and WPF, and I need to control instances of WPF windows, that is, if I want to open a window in a part of code with wndJanela.Show() , I want it when I call the Show () method again. another part of the code,...
asked by 10.06.2016 / 05:36
1
answer

Static member error in Singleton implementation

When implementing the Singleton pattern the compiler gives the following error:    include \ graphdata.h | 21 | error: 'constexpr' needed for in-class initialization of static data member 'graphdata * graphdata :: instance' of non-integral ty...
asked by 05.10.2018 / 16:20
1
answer

What is the advantage of having a single instance when using the singleton pattern in web development?

Searching a little more about singleton I found some comments for and against using this approach. I still doubt the utility of instantiating a single instance of a class (and making it global) in a web development scenario, where we should l...
asked by 07.09.2017 / 18:28
0
answers

Return a variable (Singleton) using Node that depends on Promise

Good afternoon guys, How can I create a variable in NodeJS / JS where I would return a value only to be used multiple times throughout the program? Exemplifying my problem: I have to log in to a platform and then send data to it. When I l...
asked by 12.07.2017 / 21:05
2
answers

Singleton Pattern in Python

I was seeing this article on how to create singleton classes in Python (among many others), I found it unnecessary for so much programming technique for a really simple thing. Of course I may be wrong. But if I do this, for example class Tes...
asked by 23.05.2018 / 19:22
1
answer

Singleton pattern for communication with database

In PHP when I do a Singleton, an instance is created for every request that tries to open a connection to the database, or instantiating once it "always" will stay in memory for all requests ? example: class Connect{ private static $...
asked by 17.03.2016 / 12:26
1
answer

Global variable data missing Android

Hello everyone, I'm creating an application that when I log in, the application brings the data Nome , Login , Senha and Foto(a url) of the server database, and save those data in a Singleton so that they are use...
asked by 13.04.2016 / 22:56