11,817 questions
0
votes
0
answers
20
views
Kotlin variable vs field initialization semantics [duplicate]
Let's consider the following Koltin code:
val a: Int = 1
class A {
val a: Int = a // error here: a is not initialized
fun f() {
val a = a // this is fine, a on the right-hand side ...
0
votes
0
answers
24
views
How to initialise one part of a list in the front end before the second part is loaded? (Blazor Server)
Im a beginner in Blazor and im experimenting with the ChatGPT API. I want the user prompt to be shown in a message before the GPT answer is loaded, but its refusing to do anything until both are ...
-1
votes
0
answers
18
views
How to add additional databases after mysql initialization in docker container?
We are using docker and have a mysql container. We use docker-entrypoint-initdb.d to initialize our mysql container with multiple databases and associated schema. This has been working great for a ...
-2
votes
0
answers
77
views
Modern C++: Brace initialization not working when inside body of a class constructor? [duplicate]
So I know about uniform initialization in C++, which can be achieved by giving consistent preference to braced initialization over the (many) legacy alternatives available in the language.
Yet, I have ...
0
votes
0
answers
16
views
Algorithm to find the set of K solutions candidates based on two criteria
The context is the initialization of optimization algorithms (for example, differential evolution), where we generate a random population of vectors that represent the solution's parameters.
We are ...
3
votes
1
answer
28
views
Calling C function from the .init3 section of a AVR-GCC compiled program
I am working on a project that contains a firmware update failure feature that :
notifies user/host that firmware update failed whenever the device gets unplugged in the middle of a firmware update ...
1
vote
1
answer
85
views
Is there a way to create an immutable record type that supports @{} object initialization? [closed]
The following code creates a C# record type, instantiates it using the hashtable object initialization idiom, then modifies the record's field:
Add-Type -TypeDefinition @'
namespace n {
public ...
3
votes
1
answer
101
views
what are "const-correctness" rules for initializing/binding pointers and references to pointers?
Given that there are 4 "constness" flavors of pointers:
B * = non-const pointer to non-const B
const B * = non-const pointer to const B aka
B ...
2
votes
0
answers
34
views
Python Singleton Class with inherited __init__ not working
I am currently trying to learn a new method of programming. I am creating a Singleton class to help manage my config file, which is used across multiple areas of my code. The code that I'm using is ...
2
votes
1
answer
106
views
Efficient method to initialize a really large C++ vector with the same values
I was doing this leetcode problem and I had to initialize a very large 2D DP array of size 2^14 x 14 with all entries set to -1 to solve the problem. However I noticed a big performance difference ...
1
vote
1
answer
133
views
initialization inside of an shared library (.so)
I'm porting a bigger project to Linux (originally Windows) and I'm painfully missing a counterpart of Windows DllMain().
DllMain(DLL_PROCESS_ATTACH) is called after C runtime (CRT) init is done, so ...
0
votes
1
answer
67
views
How do I initialize a derived-type variable?
How do I initialize a derived-type variable?
PS. I'm an old F77 programmer, with decent knowledge of OOP using C#, but new to "derived-types" in Fortran. A MS student wrote a large code and ...
6
votes
3
answers
205
views
Parameter pack to initialize member std::array
I have a class Color which is a thin wrapper around std::array. I would like to be able to use it in 2 ways:
Color<5> color{1,2,3,4,5} should produce color.values = [1,2,3,4,5]
Color<5> ...
0
votes
1
answer
58
views
How often (and when) is main.dart called in Flutter when an app is running?
A simple question related to app initialisation in main.dart.
I am calling a .setData() method to load a UserModel in main before the App is returned. This UserModel then persists as a static class ...
1
vote
1
answer
80
views
How to initialize an array of structs containing union in C++?
I have been struggling with initialization of an array containing struct members with union.
Let's say I have following declarations in C++
enum class FilterType { kLowPass, kAverage };
enum ...