Initializers are called to create a new instance of a particular type. In its simplest form, an initializer is like an instance method with no parameters
Questions tagged [initializer]
684 questions
0
votes
2 answers
Spring DataSourceInitializer splits trigger ins sql by ; delimiter
We use org.springframework.batch.test.DataSourceInitializer class in order to init DB on basis of .sql scripts.
Init was failed,after trigger had been added to .sql.
After debugging,the cause of error while was found here:
try {
scripts =…

sergionni
- 13,290
- 42
- 132
- 189
0
votes
1 answer
How do you handle errors when calling another class initializer?
I am trying to do some error handling while also initializing new classes. I'm surprised at the way it is set up and am hoping that I'm just missing something very simple. Here's a simple version of what I'm trying to accomplish:
Public Class…

Apachi
- 32
- 5
0
votes
1 answer
reactivemongo play 2.3 0.11.7 to 0.11.11 upgrade raises ExceptionInInitializerError
[I am re-editing this question to reflect on my last tests]
I am trying to upgrade my akka / play 2.3 application from
"org.reactivemongo" %% "play2-reactivemongo" % "0.11.7.play23"
to
"org.reactivemongo" %% "play2-reactivemongo" %…

david
- 309
- 1
- 4
- 15
0
votes
2 answers
Creating a Scantron to grade a test in Python
I'm tasked with creating a program that simulates a scantron being turned on from an off state, once turned on it compares two arrays and displays a student's grade based on the comparison of the two arrays. I'm also tasked with creating classes.
I…

Rozay
- 13
- 7
0
votes
0 answers
What happens if an initialiser returns an object of the wrong class?
Let's say I have an Objective-C class that's intended to be a singleton — its init method checks if there's already an instance of that class and returns it.
Now suppose you have two subclasses of this class, A and B, and that you do:
[[A alloc]…

Kartick Vaddadi
- 4,818
- 6
- 39
- 55
0
votes
1 answer
Can't invoke generic initializer from protocol extension in Swift
I'm trying to call a struct I made from a protocol extension method I also made:
public struct AdjacentDifferenceArrayGenerator: GeneratorType {
private var array: [T]
public init

CTMacUser
- 1,996
- 1
- 16
- 27
0
votes
2 answers
uninitialized constant Request (NameError)
I get this error: /LiveToChallenge/config/initializers/gibbon.rb:1:in '': uninitialized constant Gibbon::Request (NameError) when I try to start the server rails server.
app/config/initializers/gibbon.rb
require…

AnthonyGalli.com
- 2,796
- 5
- 31
- 80
0
votes
3 answers
Uninitialized variable - passing it to a function
http://en.cppreference.com/w/cpp/language/storage_duration
Static local variables
Static variables declared at block scope are initialized the first
time control passes through their declaration (unless their
initialization is zero- or…

user5539357
- 1,024
- 1
- 9
- 19
0
votes
1 answer
When you declare a pointer, is it NULL?
When you declare a pointer like int* p;. Is p initially NULL?

odin19
- 147
- 1
- 8
0
votes
1 answer
Proper way to include modules on gem classes to add methods to gem classes
I am trying to load modules into some of the Mailboxer gem classes to add extra methods to those classes. Sometimes my attempts work however, I will usually get "Undefined method" error.
I have tried adding the modules to the lib directory and then…

earth2jason
- 715
- 1
- 9
- 20
0
votes
2 answers
Swift String init ambiguous(which String.init method does this code call?)
It's a leetcode problem: 168. Excel Sheet Column Title @
https://leetcode.com/problems/excel-sheet-column-title/
The code works fine at my mac,
but got compile error at leetcode:
Line 5: ambiguous use of 'init'
So, please tell me which String.init…

user2710368
- 11
- 3
0
votes
2 answers
When are initializer blocks used in java?
I read that an initializer block is "an unnamed code block that contains th code that initializes the class?
For example :
class A {
final int x;
final int y;
final String n;
{
x = 10;
y = 20;
}
public A(String name ) {
/* etc...…

Caffeinated
- 11,982
- 40
- 122
- 216
0
votes
1 answer
What is going wrong with my variadic initializer in Swift?
I created a class with an initializer which takes a variadic parameter but it doesn't do what it is supposed to do. I created a variable called start which is a reference to the storted property unteresElement. But somehow it stays "nil" even though…

IneedHelpFromYou
- 21
- 2
0
votes
1 answer
Must call a designated initializer of the superclass 'UIViewController'
I have a class A defined in ObjC and Class B - subclass of A defined in Swift.
The implementation is as follows:
Class A
- (id)init {
return [super init];
}
Class B
init(url: NSURL) {
super.init()
let request =…

Siddharthan Asokan
- 4,321
- 11
- 44
- 80
0
votes
1 answer
Unable to use I18n.t call in an initializer file
I would like to use I18n.t call in an initializer file.
Unfortunately, it doesn't work. Rails returns the usual "translation missing:" message.
It seems that the I18n files haven't been loaded yet when the call is made.
Are there any workarounds…

jlfenaux
- 3,263
- 1
- 26
- 33