I am working with someone else's code. The code was originally designed so that data would dynamically create controls (and sub-controls of those controls...) on the OnInit event on numerous web control panels. And then later validation methods would check those dynamically created controls for valid data. This continues to work just fin...
Hi, I mentioned in one of my earlier questions that I'm reading book "C++ Coding Standards" By Herb Sutter and Andrei Alexandrescu. In one of the chapters they are saying something like this:
Always perform unmanaged resource acquisition, such as a new expression whose result is not immediately passed to a smart pointer constructor, ...
Hi
I was told there are multiple situations in which initialization list must be used to for initialization.
There are three cases
1) const member
2) reference
3) members without default constructors
Is that right? Anyone would like elaborate this? Is there any other case I missed?
Thanks!
...
class Interface {
public:
static const int i = 1;
static const double d = 1.0;
//! static const string *name = new string("Interface name");
virtual string getName() = 0;
}
Since C++ is a traditional truely compiled programming language,it could be easily convinced that it does allow object initialization(?).But why do C++...
What is Double Brace initialization syntax in Java?
...
Hello,
I have a question in regard to PHP arrays.
If I create an array
$ids = array();
then put something in position 1000 of it:
$ids[1000] = 5;
How would the interpreter do this internally? Are arrays contiguous lumps of memory like Java? Would it be like int[1000] where 1000 ints are initlialized?
Or is it more of a map wher...
Hi,
i defined boost::multi_array with
typedef boost::multi_array<unsigned int, 1> uint_1d_vec_t;
typedef boost::multi_array<unsigned int, 2> uint_2d_vec_t;
uint_1d_vec_t foo( boost::extents[ num_elements ] );
uint_2d_vec_t boo( boost::extents[ num_elements/2 ][ kappa ] );
were num_elements/2 ist an integer number...
What's this easiest / most efficient way to initialize these blocks of doubles, preferably at compile time:
#define N 1000
double mul1[N][N] __attribute__ ((aligned (64)));
double mul2[N][N] __attribute__ ((aligned (64)));
They're used for "const" read only test data.
...
I heard a saying that c++ programmers should avoid memset,
class ArrInit {
//! int a[1024] = { 0 };
int a[1024];
public:
ArrInit() { memset(a, 0, 1024 * sizeof(int)); }
};
so considering the code above,if you do not use memset,how could you make a[1..1024] filled with zero?Whats wrong with memset in C++?
thanks.
...
How do I check whether a DropDownList is initialized in ASP.NET? I'm not talking about checking for empty strings. The dropdownlist is usually unintialized if there the datasource was not bound to it. So when I try to check the contents with something like this
x = DropDownList.SelectedItem.ToString()
it simply bombs...any suggestions...
Using this code, many keys are output, but I expected no output:
import os
for i in os.environ:
print i
This is the code from os.py:
try:
environ
except NameError:
environ = {}
Where does os.environ get its values from? Where is it initialized?
...
Is there a better way to initialise C structures?
I can use initialiser lists at the variable declaration point; however this isn't that useful if all arguments are not known at compile time, or if I'm not declaring a local/global instance, eg:
Legacy C Code which declares the struct, and also has API's using it
typedef struct
{
i...
In Win32 API programming it's typical to use C structs with multiple fields. Usually only a couple of them have meaningful values and all others have to be zeroed out. This can be achieved in either of the two ways:
STRUCT theStruct;
memset( &theStruct, 0, sizeof( STRUCT ) );
or
STRUCT theStruct = {};
The second variant looks clean...
If I have a
class A
{
private:
Widget* widgets[5];
};
Is it guaranteed that all pointers are NULL, or do I need to initialize them in the constructor? Is it true for all compilers?
Thanks.
...
Hi,
I am new to spring MVC. I am looking for a place in my spring mvc applicationwhere I can initialize all sorts of things in the application.
usually I did that in the init() method of the my main servlet but now the dispatcher servlet is of spring and I cannot overide the init function.
what is the best practice?
Thanks.
...
Many Win32 API functions have parameters specified to be "out". For example, GetIconInfo() description says about the second parameter that The function fills in the structure's members.
This implies that the function doesn't ever read the original values stored in the "out" parameter - only changes them - and therefore the caller is fr...
Let's say I have this:
public class Whatever {
private ArrayList<String> myList = new ArrayList<String>();
// more code goes here
}
or let's say I have this:
public class Whatever {
private ArrayList<String> myList = null;
public Whatever() {
myList = new ArrayList<String>();
}
}
What's the difference between t...
This MSND article says SecureZeroMemory() is good for cases when sensitive data stored in memory for a while should be for sure overwritten as soon as possible when no longer needed. Answers to this SO question explain why this can make a difference.
Now is there any sence in using SecureZeroMemory() for initializing just every memory b...
Check this code..
string str;
if (str.Contains("something.."))
{
}
Compiler throws this error for this code
Use of unassigned local variable 'str'
Why does a reference type is not initialized to null ?
Just want to know out of curiosity.
I'd also want to know what happens for code below. how does this assignme...
I have an array of integers in Java that is initialized as follows:
public int MyNumbers[] = {0,0,0,0};
I would like to, however, initialize the array to a variable-length number of zeroes.
private int number_of_elements = 4;
public int MyNumbers[] = {0} * number_of_elements; // ????
I am clueless how to do this being new to Java ...