initialization

The initialization part is not called

≡放荡痞女 提交于 2020-02-23 10:29:32
问题 I'm maintaining the VirtualTreeView component for Delphi and C++Builder. With Delphi everything is okay but when I compile the packages with the C++Builder the code in the initialization part in the Delphi units is not called. Any ideas? 回答1: When a Delphi unit's initialization / finalization sections are not being called in a C++Builder project, it usually means the Delphi unit is not being linked into the final executable, typically because the C++ code is not directly referencing any code

Initializing multidimensional arrays in c# (with other arrays)

非 Y 不嫁゛ 提交于 2020-02-23 08:51:30
问题 In C#, it's possible to initialize a multidimensional array using constants like so: Object[,] twodArray = new Object[,] { {"00", "01", "02"}, {"10", "11", "12"}, {"20", "21", "22"} }; I personally think initializing an array with hard coded constants is kind of useless for anything other than test exercises. Anyways, what I desperately need to do is initialize a new multidimensional array as above using existing arrays. (Which have the same item count, but contents are of course only defined

How to handle/inform users about unrecoverable exceptions in an APP_INITIALIZER?

浪子不回头ぞ 提交于 2020-02-18 05:49:06
问题 My Angular5 app loads a config file from the backend during application initialization (APP_INITIALIZER). Since the app cannot be run without it, my goal is to show a message to the user that the config couldn't be loaded. providers: [ AppConfig, { provide: APP_INITIALIZER, useFactory: (config: AppConfig) => () => config.load(), deps: [AppConfig], multi: true }, { provide: LocationStrategy, useClass: HashLocationStrategy}, { provide: ErrorHandler, useClass: GlobalErrorHandler }] The AppConfig

How can I generate an init call from strings in swift

折月煮酒 提交于 2020-02-06 08:04:12
问题 class A { let val : Int init(val: Int) { self.val = val } } I have these 3 strings: let className = "A" let argName = "val" let argValue = "4" How can I call A(val:4) from using these 3 strings? 回答1: Since you've noted in the comments that the types will all be subclasses of some supertype, then that supertype can handle all the dispatching. In Cocoa, this is a pretty common pattern known as a class cluster. class SuperA { enum SuperAError: Error { case cannotConstruct } static func create

How can I generate an init call from strings in swift

好久不见. 提交于 2020-02-06 08:03:44
问题 class A { let val : Int init(val: Int) { self.val = val } } I have these 3 strings: let className = "A" let argName = "val" let argValue = "4" How can I call A(val:4) from using these 3 strings? 回答1: Since you've noted in the comments that the types will all be subclasses of some supertype, then that supertype can handle all the dispatching. In Cocoa, this is a pretty common pattern known as a class cluster. class SuperA { enum SuperAError: Error { case cannotConstruct } static func create

Initialisation of Spring ConfigurationProperties

ぐ巨炮叔叔 提交于 2020-02-06 07:30:07
问题 I have the following class mapping parts of the properties from the application.properties: @Component @ConfigurationProperties(prefix = "city") @Getter @Setter public class CityProperties { private int populationAmountWorkshop; private double productionInefficientFactor; private Loaner loaner = new Loaner(); private Tax tax = new Tax(); private Guard pikeman = new Guard(); private Guard bowman = new Guard(); private Guard crossbowman = new Guard(); private Guard musketeer = new Guard();

Why is constant initialization need for static char* but not static char**

情到浓时终转凉″ 提交于 2020-02-06 03:39:16
问题 Can someone please explain why this code... // main.c #include <stddef.h> static const int g_a = 1; static const char* g_b = "hello"; static const char* g_c[] = { "a", "b", NULL }; typedef struct Foo { int a; const char* b; const char** c; } Foo; static Foo f[] = { { g_a, g_b, g_c } }; int main( int argc, char* argv[] ) { return 0; } ...produces this error: > gcc --version && gcc -g main.c gcc (GCC) 8.2.1 20181215 (Red Hat 8.2.1-6) Copyright (C) 2018 Free Software Foundation, Inc. This is

Forms of list initialization

只愿长相守 提交于 2020-02-04 03:22:22
问题 See the following code: std::vector<int> v1{1, 2, 3}; std::vector<int> v2 = {1, 2, 3}; My questions are: Is there a difference between the two? I know the first one must be list initialization, but how about the second? Because there is a assign sign for the second, it makes me think that the compiler will use the std::initializer_list to create a temporary vector first, then it use copy constructor to copy the temp vector to v2 . Is this the fact? 回答1: The two (direct-list-initialization vs

Initialization section of the package

橙三吉。 提交于 2020-02-02 12:08:38
问题 This is the package specification: CREATE OR REPLACE PACKAGE employee_info IS PROCEDURE p; FUNCTION f RETURN BOOLEAN; END employee_info; This is the package body: CREATE OR REPLACE PACKAGE body employee_info IS PROCEDURE p IS BEGIN dbms_output.put_line('This is procedure'); dbms_output.put_line(chr(10)); END; FUNCTION f RETURN BOOLEAN IS BEGIN dbms_output.put_line('This is function '); dbms_output.put_line(chr(10)); RETURN true; END; BEGIN dbms_output.put_line('This is the initialization

Initialization section of the package

∥☆過路亽.° 提交于 2020-02-02 12:06:19
问题 This is the package specification: CREATE OR REPLACE PACKAGE employee_info IS PROCEDURE p; FUNCTION f RETURN BOOLEAN; END employee_info; This is the package body: CREATE OR REPLACE PACKAGE body employee_info IS PROCEDURE p IS BEGIN dbms_output.put_line('This is procedure'); dbms_output.put_line(chr(10)); END; FUNCTION f RETURN BOOLEAN IS BEGIN dbms_output.put_line('This is function '); dbms_output.put_line(chr(10)); RETURN true; END; BEGIN dbms_output.put_line('This is the initialization