initialization

nhibernate configure and buildsessionfactory time

I'm using Nhibernate as the OR/M tool for an asp.net application and the startup performance is really frustrating. Part of the problem is definitely me in my lack of understanding but I've tried a fair bit (understanding is definitely improving) and am still getting nowhere. Currently ANTS profiler has that the Configure() takes 13-18 ...

Is it true that the assigned final object field may still be null inside a constructor?

Is it true that the assigned final object field may still be null inside a constructor? class MyClass { private final Object obj = new Object(); public MyClass() { System.out.println(obj); // may print null? } } if yes, isn't this a bug? ...

Document Based Application, preinitialize window (enter serial, buy, trial)

I need to create several windows before NSDocument is loaded, or create a window that blocks NSDocument window and top menu. I tried several solutions - but they didn't work right. modal window, one after another. there were some problems with Async URLConnection, and some other problems with my NSDocument content. I created custom M...

Please explain this python behavior

class SomeClass(object): def __init__(self, key_text_pairs = None): ..... for key, text in key_text_pairs: ...... ...... x = SomeClass([(1, "abc",), (2, "fff",)]) The value of key_text_pairs inside the init is None even if I pass a list as in the above statement. Why is it so?? I want to w...

Java: how to initialize String[]?

Error % javac StringTest.java StringTest.java:4: variable errorSoon might not have been initialized errorSoon[0] = "Error, why?"; Code public class StringTest { public static void main(String[] args) { String[] errorSoon; errorSoon[0] = "Error, why?"; } } ...

How do I declare a C# Web User Control but stop it from initializing?

I have a C#/ASP.NET .aspx page that declares two controls that each represents the content of one tab. I want a query string argument (e.g., ?tab=1) to determine which of the two controls is activated. My problem is, they both go through the initialization events and populate their child controls, wasting CPU resources and slowing the ...

is it bad to use initializer block

Hi I use initializer block in C# new Something { foo = 1, bar = 2 }; but people say this is bad practice. I don't think it is wrong, is it? ...

How to default-initialize local variables of built-in types in C++?

How do I default-initialize a local variable of primitive type in C++? For example if a have a typedef: typedef unsigned char boolean;//that's Microsoft RPC runtime typedef I'd like to change the following line: boolean variable = 0; //initialize to some value to ensure reproduceable behavior retrieveValue( &variable ); // do actual ...

initialize array to 0 in C

I need a big null array in C as a global. Is there any way to do this besides typing out char ZEROARRAY[1024] = {0, 0, 0, /* ... 1021 more times... */ }; ? ...

Initialization of objects in the background

I need to initialize few objects, it can take a while so I want to do it in some background thread. I also want to display progressBar showing what is the progress of initialization. What is the most elegant way to do it? I was thinking about an interface: interface ILoadable { int Progress { get; } event EventHandler Loaded;...

an emacs command to open a new instance of emacs

How can I make a cross-platform emacs command that opens another instance of emacs with -q option? The reason why I need such a command is that it would be easy to modify the command to make it open another instance of emacs with -q and -l option so that the new instance loads an el file that I am editing with the old instance. ...

C++ where to initialize static const

Hi, I have a class class foo { public: foo(); foo( int ); private: static const string s; }; Where is the best place to initialize the string s in the source file? ...

Declaration and initialization of local variables - what is most C++ like?

Hi, I did not find any suitable questions answered yet, so I'd like to know what is "better" C++ style in the mean of performance and/or memory. Both codes are inside a method. The question is: When to declare long prio? And what are the implications? Code 1 while (!myfile.eof()) { getline(myfile, line); long prio = strtol(line...

Is this list-initialization of an array of unknown size valid in C++0x?

Is this list-initialization of an array of unknown size valid in C++0x? int main() { int x[]{0, 1,2,3,4}; return x[0]; } I believe it is valid, but would appreciate some confirmation. If anyone could quote from the C++0x-FCD to support their case, it would be greatly appreciated. Thanks! ...

Java: define terms initialization, declaration and assignment

I find the defs circular, the subjects are defined by their verbs but the verbs are undefined! So how do you define them? The Circular Definitions itialization: to initilise a variable. It can be done at the time of declaration. assignment: to assign value to a variable. It can be done anywhere, only once with the final-identifier. ...

Scala array initialization

You have: val array = new Array[Array[Cell]](height, width) How do you initialize all elements to new Cell("something")? Thanks, Etam (new to Scala). ...

Java: initialization problem, cannot print "assigned" values from arrayList

$ javac ArrayListTest.java $ java ArrayListTest $ cat ArrayListTest.java import java.io.*; import java.util.*; public class ArrayListTest{ public static void main(String[] args) { try { String hello ="oeoaseu oeu hsoae sthoaust hoaeut hoasntu"; ArrayList<String> appendMe = null; for(S...

Java: 2-assignments-2-initializations inside for-loop not allowed?

Related question, about assignment-initialization-declaration. $ javac MatchTest.java MatchTest.java:7: ')' expected for((int i=-1 && String match="hello"); (i=text.indexOf(match)+1);) ^ MatchTest.java:7: ';' expected for((int i=-1 && String match="hello"); (i=text.indexOf(match)+1);) ^ MatchTest....

C static variables and intialization

Hi, If I have a global static variable x like in this code #include <stdio.h> #include <stdio.h> static int x; int main(void) { DO SOMETHING WITH x HERE x++; } What will be difference if I opted to initialize x to a value first say as in static int x = 0; before entering "main"? In my first case where I didn't ass...

Java: design problem with final-value and empty constructor

$ javac InitInt.java InitInt.java:7: variable right might not have been initialized InitInt(){} ^ 1 error $ cat InitInt.java import java.util.*; import java.io.*; public class InitInt { private final int right; // Design Problem? // I feel the initialization problem is just due to bad style. InitInt(){} Ini...