Skip to main content
Filter by
Sorted by
Tagged with
0 votes
3 answers
206 views

I am storing some settings for my application in a JSON file located alongside the application .exe. I want to load these settings only once, lazily, the first time one of them is needed. So for ...
Theodor Zoulias's user avatar
0 votes
2 answers
141 views

Situation: A method that validates its arguments and returns an iterator; public static IEnumerable<double> Range(double startingValue, double step, int count) { // I would really like this ...
Joachim J's user avatar
  • 204
1 vote
1 answer
137 views

I have the following entities: class A { @Id String aId; @OneToMany(fetch = FetchType.LAZY) List<B> bsOfA @OneToMany(fetch = FetchType.LAZY) List<C> csOfA public A(String ...
Guppy_00's user avatar
  • 317
1 vote
3 answers
297 views

I have a struct with a LazyLock and a constructor function that helps set it. struct X { x: LazyLock<ComplexType>, } impl X { pub fn new(x_factory: ComplexTypeFactory) -> Self { ...
Daniel A. White's user avatar
0 votes
0 answers
70 views

Project Name: Project-Manager I am trying to implement a service class which would fetch all the projects or single projects from the DB by id but in both the cases I am getting this lazy ...
Aditya Kumar's user avatar
2 votes
1 answer
529 views

Is there an official naming convention for private properties? I use them for lazy initialization of expensive fields: private string _veryExpensive; private string VeryExpensive => _veryExpensive ?...
5andr0's user avatar
  • 2,248
0 votes
1 answer
55 views

What is the purpose, respectively the aim, of a lazy property? Kotlin-language documentation: https://kotlinlang.org/docs/delegated-properties.html#lazy-properties Saving memory? Or is it something ...
cluster1's user avatar
  • 6,128
2 votes
1 answer
58 views

In the following program an object is reported as null, even though it is clearly initialized. class MyClass() class MyOtherClass(c: MyClass) object Foo { val myClass = new MyClass() object ...
bobismijnnaam's user avatar
0 votes
1 answer
71 views

I am working on creating an Airline website using Spring Boot. I have a Seat class and a Flight class which represent tables in the database. The idea is that whenever a flight is added, seats for the ...
SWE's user avatar
  • 19
0 votes
1 answer
45 views

Assume, we have two simple entities Parent and Child like the following: @Entity public class Parent extends BaseEntity { private String content; @OneToMany(mappedBy = "parent", ...
DommeL's user avatar
  • 31
0 votes
1 answer
49 views

I need to instantiate MyHttpClient as Singleton. MyHttpClient is used by multiple threads. Solution below works, but it's ugly and should have issue with endpoint, I just didn't hit it yet. endpoint ...
Capacytron's user avatar
  • 3,818
-2 votes
1 answer
392 views

I have more than 500 web-elements in a webpage. If I use Page Object Model with PageFactory.initElements() in selenium it will initialize all the elements once the object is created. Lets says I am ...
Sathya's user avatar
  • 1
1 vote
0 answers
143 views

I am encountering an issue with re-rendering of a horizontal ScrollView inside a vertical ScrollView in SwiftUI. The vertical ScrollView contains multiple horizontal ScrollViews, each displaying a ...
santhosh kumar's user avatar
1 vote
1 answer
259 views

can the lazy init be done safely this way? We had a dispute where a colleague was claming for some first threads it could fail and they would see the null value. public class TestAtomicReference { ...
PZ73's user avatar
  • 19
0 votes
1 answer
298 views

I have a Next.js Application and for State Management I am using Redux Toolkit. Now, to maintain authentication status in frontend side, I need to take the existing token and send it to backend for ...
D_Gamer's user avatar
  • 358
1 vote
1 answer
678 views

I have a view model with 2 collections, that takes the data from database. For example countries and type of VAT. I would like to defer the initialization of this collections until I will, becauase if ...
Álvaro García's user avatar
0 votes
0 answers
40 views

I read a Fortran code : program t real :: x(5) =[1.,-2.,3.,-4.,5.] real,allocatable :: y(:) y = x ... For me the normal way is allocate(y,source=x) I'm surprised that it works, both ...
Fabien's user avatar
  • 1
1 vote
2 answers
207 views

The racy single-check idiom is a technique for lazy initialization without synchronization or volatile. It can be used when initialization is allowed to be performed concurrently by multiple threads, ...
mperktold's user avatar
  • 500
2 votes
0 answers
146 views

Dear StackOverflow members, I am creating big html documents using R Markdown. These documents contain 200 till 300 charts generated using ggplotly. The creation/knitting of these files works well. ...
user3516915's user avatar
-2 votes
1 answer
120 views

I want to implement a lazy static reqwest::ClientBuilder. NB this is for a utilities module, so I have a feeling it'd be difficult to avoid using a static in this case. I want to construct it once, ...
mike rodent's user avatar
  • 16.1k
-1 votes
3 answers
294 views

I would like to have something like Android Compose's remember(key) { init } in plain JVM Kotlin. So some sort of Lazy delegate but on every access it calls a key function and if its return value ...
askSoap's user avatar
  • 187
2 votes
1 answer
6k views

In our case there are two entities User and UserRole and relationship between those two entity are one to many relationship. We perform some operation like we get the user data using Hibernate and ...
Akbarhussain Aghariya's user avatar
1 vote
0 answers
68 views

I'm trying to map Realm Persisted Objects to another Type for separation of concerns. I have something like a protocol repository retrieving an array of items: [Item] I've one implementation of this ...
Lory Huz's user avatar
  • 1,508
0 votes
1 answer
1k views

I've already had some success with lazy_static: static ref WORD_COUNT_REPORTING_STEP_MUTEX: Arc<Mutex<usize>> = Arc::new(Mutex::new(0)); static ref INDEX_NAME: RwLock<String> = ...
mike rodent's user avatar
  • 16.1k
0 votes
0 answers
451 views

I'm trying to mock a constructor of a class that is a lazy variable of the class I'm testing: private val manager by lazy { manager(Data(ID_ADMIN, MANAGER_CODE), context) } I have the mockk() ...
Dave_August's user avatar
0 votes
1 answer
297 views

Given an expensive to initialize object and 2 consumers: class A: def __init__(): time.sleep(42) self.foo = 1 def func1(obj: A): pass def func2(obj: A): print(A.foo) How to create a ...
y.selivonchyk's user avatar
2 votes
1 answer
1k views

I find two different ways to implement a singleton pattern, they are Lazy Initialization and Eager Initialization. and the code is: public class EagerSingleton { private static final ...
Yu Xing's user avatar
  • 89
1 vote
0 answers
74 views

I've been reading about the Singleton pattern in C# and how thread safety can be a concern, especially when it comes to lazy initialization. I'm aware of the Lazy<T> class which can be used to ...
Fatih Furkan Çambel's user avatar
0 votes
1 answer
959 views

When I enable spring.main.lazy-initialization=true then Spring does not instantiate configuration classes referenced by @Import. I have to explicitly @Autowire them into entrypoint to get them picked ...
Marcin Wisnicki's user avatar
1 vote
0 answers
299 views

I want to initialize a variable before getting to the GoRouter routes. This authenticated below is the variable I want to initialize: class AuthProvider with ChangeNotifier { late bool? ...
Brice's user avatar
  • 31
0 votes
2 answers
1k views

My code has several JPA repository method call. I fetch data and aggregate it. But I want to do that in an asynchronous way. So, I am trying to use CompletableFeature. But I am getting the below error:...
user404's user avatar
  • 2,046
0 votes
2 answers
696 views

Why do we need to add volatile to field to prevent invalid data retrieval? Can't we do the same thing by adding synchronized to method declaration instead of to a block of code? public class ...
kaka's user avatar
  • 845
2 votes
1 answer
3k views

I'm trying to get a mutable reference to the underlying data of OnceLock using get_mut() method, but getting error mod OL { use std::sync::OnceLock; static CELL: OnceLock<i32> = ...
Harry's user avatar
  • 4,198
1 vote
1 answer
443 views

Having a problem with upgrading hibernate to 5.3+ with the method calling getHibernateLazyInitializer().getIdentifier() on a HibernateProxy which is loaded with AuditedReader from hibernate envers. ...
Skyverian's user avatar
3 votes
0 answers
100 views

When making an app with a large number of plots, it takes quite a while to load them. The issue is that all the plots on a page start rendering at the same time, even though a good number of them are ...
mkranj's user avatar
  • 549
3 votes
2 answers
5k views

Dagger hilt 2.42 I am trying to provide this class using lazy dagger injection. class AlgoliaAnalyticsProvider @Inject constructor( private val clientInsights: Lazy<ClientInsights>, ...
ant2009's user avatar
  • 22.7k
0 votes
1 answer
175 views

Can we do get and didSet together with lazy keyword. I have an array it fetch data from database (get) and another thing when that array will modify i will call delegate to reload data in didSet. Its ...
Yogesh Patel's user avatar
  • 2,037
0 votes
1 answer
182 views

I tried two ways of initializing a lazy var, one works, the other gets a compiler error. OK: var maxDiscount = MaxDiscount(); maxDiscount.maxDiscountPercent ERROR: MaxDiscount().maxDiscountPercent If ...
sgrem's user avatar
  • 11
-3 votes
2 answers
2k views

in the class below variables with str type are used but without declaring value from abc import ABC class User(ABC): first_name: str last_name: str is this lazy instantiation?
Gustavo Felipe's user avatar
0 votes
0 answers
85 views

I have a TypeScript class that extends an abstract class called Lazy. The Lazy class uses a proxy object to get and set properties dynamically. Here is the code: abstract class Lazy<T> { ...
Arda's user avatar
  • 57
1 vote
2 answers
129 views

There are two different ways of using the lazy property syntax and I fail to see the difference between them: //1 lazy var a = { "hello" }() //2 lazy var b = "hello" In other ...
Joakim Sjöstedt's user avatar
4 votes
2 answers
2k views

... @RequiredArgsContructor(onConstructor_ = {@Lazy}) Class A{ private final B b; @Lazy private final C c; } Class A{ private final B b; private final C c; A(B b,@Lazy C c){ this.b = ...
Crazy Coke's user avatar
1 vote
1 answer
178 views

I'm not sure if anyone has experienced this particular twist of the LazyInitialization issue. I have a console Spring Boot application (so: no views - everything basically happens within a single ...
Alexander's user avatar
0 votes
0 answers
327 views

Can any one help me with correct approach to integrate Resteasy and Spring with AOP declartive configuration for JTA transaction. The configuration is as per below, Project structure: com.example.dao ...
Abhishek Kotalwar's user avatar
0 votes
0 answers
116 views

I have an error when selecting the children values of the installer entity which name it infoRges installer entity: @Entity @Table(name = "installer") public class Installer ...
Bader-Eddine Qodia's user avatar
1 vote
2 answers
1k views

I want to use a global variable. During first access to read it, I want to write to this variable using an API. For any subsequent access to read it, it should not require locks. This is the ...
subtleseeker's user avatar
  • 5,533
1 vote
0 answers
432 views

Briefly, I have a class that lazily initializes one of its data members and I'd like to figure out the best way to do this in a multithreaded environment. In more detail, my class currently looks ...
Dimitrije Kostic's user avatar
0 votes
2 answers
129 views

I'm looking for vocabulary or for a library that supports the following behaviour: Imagine a Javascript object like the following one: const foo = { id: 1, name: 'Some String value', supplier: ...
Hammerbot's user avatar
  • 16.5k
0 votes
1 answer
350 views

I am intending to use lazy initialization with a .NET core 6 WPF application with the following. public partial class MainWindow : Window { public MainWindow() { InitializeComponent(); ...
Furkan Gözükara's user avatar
0 votes
1 answer
524 views

I have something like this Entity1 @Id String id1; @OneToMany(Fetch = LAZY) List<Entity2> list1; ... Entity2 @Id String id2; @OneToMany(Fetch = LAZY) List<Entity3> list2; ... Entity3 @Id ...
Marco's user avatar
  • 382

1
2 3 4 5
15