Top "Initializer" questions

Initializers are called to create a new instance of a particular type.

Initializing shared_ptr member variable, new vs make_shared?

When initializing a shared_ptr member variable: // .h class Customer { public: Customer(); private: std::shared_ptr<OtherClass> something_; } // .…

c++ c++11 shared-ptr initializer make-shared
Why doesn't initializer work with properties returning list<t>?

Couldn't find an answer to this question. It must be obvious, but still. I try to use initializer in this …

c# .net initializer
Class methods which create new instances

Apart from the standard [[MyClass alloc] init] pattern, some objects are built from static methods like MyClass *obj = [MyClass classWithString:@"…

objective-c memory-management class-method initializer
Rails - How to set global instance variables in initializers?

I was using the predictor gem. I initialized the recommender in initializers/predictor.rb: require 'course_recommender' recommender = CourseRecommender.new # …

ruby-on-rails controller initializer
How to default-initialize a struct containing an array in Rust?

What is the recommended way to declare a struct that contains an array, and then create a zero-initialized instance? Here …

arrays struct rust initializer
JSF2 preRenderComponent is called always when f:ajax is executed

I have an JSF page backed by NewsBean.java which has <f:event type="preRenderComponent" listener="#{newsBean.init}" /> …

ajax jsf jsf-2 initializer postconstruct
Calling a Java method with no name

I'm looking at the code below and found something a bit strange: public class Sequence { Sequence() { System.out.print("c "); } { …

java initializer
How can I access the Rails logger from an initializer?

Following the advice from my previous question, I placed my background process in an initializer named scheduler.rb. However, I'm …

ruby-on-rails logging initializer
Rails 3.1 Deployment to Heroku Error

I'm trying to deploy my app to Heroku, I've done this before on my Windows machine, and now I am …

ruby-on-rails deployment heroku initializer ruby-on-rails-3.1
Rails initializer for development and production

I have the following code in /config/initializers/chargify.rb Chargify.configure do |c| c.subdomain = 'example' c.api_key = …

ruby-on-rails environment initializer