I load a user control in a web page which throws an exception:
this.LoadControl(someusercontrol); // throws TypeLoadException
The details :
System.Reflection.ReflectionTypeLoadException: The classes in the module cannot be loaded.
at (wrapper managed-to-native) System.Reflection.Assembly:GetTypes (bool)
at System.Reflection.Assem...
What is the difference between pointer to a reference, reference to a pointer and pointer to a pointer in C++?
Where should one be preferred over the other?
...
I thought I'm pretty experienced in java, but it seems that's not really the case, I just noticed something yesterday, something I used before but never really realised what it did. I googled but didn't find the answer to my question.
If I declare an int array, and use Array's static sort function to sort my array, I just need to type
...
Hello,
I have a solution with multiple projects - executable, library, and others(unimportant right now). Library contains EF entity classes and executable uses them. When I'm working on some code from the executable then every entity that I use is marked as an error and compiler says that I should check usings and references. Reference...
Hi,
I have encountered a working (with XLC8 and MSFT9 compilers) piece of code, containing a c++ file with a function defined with c linkage and a reference argument. This bugs me, as references are c++ only. The function in question is called from c code, where it is declared as taking a pointer argument to the same type in place of th...
Amongst the programming languages I know and those I've been exposed to, C++ looks like the only one to have both pointers and references. Is it true?
...
I am writing a lib in C++/CLI, and one of the functions is returning a System::Drawing::Color object. I added System.Drawing as a project reference. It works.
I then created a test application to link to this lib and added my created lib as a reference. Everything linked fine, but then I tried to the run the application and I had the...
I currently have a function template, taking a reference, that does something in essence equivalent to:
template <typename T>
void f(T& t)
{
t = T();
}
Now, I can call:
int a;
f(a);
To initialize my variable a.
I can even do:
std::vector<int> a(10);
f(a[5]);
However, this will fail:
std::vector<bool> a(10);
f(a[5]);
The re...
Short Version
For those who don't have the time to read my reasoning for this question below:
Is there any way to enforce a policy of "new objects only" or "existing objects only" for a method's parameters?
Long Version
There are plenty of methods which take objects as parameters, and it doesn't matter whether the method has the obje...
It's considered a bad idea/bad design, have a class with a constructor accepting a reference, like the following?
class Compiler
{
public:
Compiler( const std::string& fileName );
~Compiler();
//etc
private:
const std::string& m_CurrentFileName;
};
or should I use values?
I actually do care about performance.
Thank you in adva...
I want to write a small installer app that installs a web site and creates IIS virtual directories. The app should run on Windows XP/Server 2003 (IIS 6) as well as on Vista/2008 (IIS 7).
The problem is: for IIS 6 we create virt dirs by calling WMI/Metabase API, for IIS 7 there is a much better API: Microsoft.Web.Administration, but its ...
In msvc i can write
#pragma comment(lib, "my.lib");
which includes my.lib in the linking stage. In my solution i have 2 projects. One is a class project the other is my main. How do i include the reference dll in code instead of adding the reference in the project?
...
I have the following contrived example (coming from real code):
template <class T>
class Base {
public:
Base(int a):x(a) {}
Base(Base<T> * &other) { }
virtual ~Base() {}
private:
int x;
};
template <class T>
class Derived:public Base<T>{
public:
Derived(int x):Base<T>(x) {}
Derived(Derived<T>* &other): Base<T>(other) {}
...
void outputString(const string &ss) {
cout << "outputString(const string& ) " + ss << endl;
}
void outputString(const string ss) {
cout << "outputString(const string ) " + ss << endl;
}
int main(void) {
//! outputString("ambigiousmethod");
const string constStr = "ambigiousmethod2";
//! outputString(constStr);
} //...
I want to include all the assemblies in the GtkSharp package. Right now, I have to find every assembly and include it individually. Is there any way to simple include all assemblies in the GtkSharp package?
...
First of all, let me say that I am not a C++ developer. However, I am working on a neural network project that requires me to work with C++. I am working with the Flood Neural Network library. I am trying to use a neural network library in an unmanaged C++ project that I am developing. My goal is to create an instance of a class object w...
I have this example:
my $numbers = [ 1, 2, 3, 4, 5, 6 ];
my $newarray = [ reverse @$numbers ];
This example contains some synthetic code to make the $numbers arrayref appropriate for the reverse function. I would like to remove that code and do something more like this:
my $newarray = reverse $numbers;
I know this doesn't work, it ...
I have been trying to understand the difference between different references but the theory does not provoke any ideas for me to visualize the same.
Could anyone please explain in brief the different references?
An example for each would do better.
...
We've created a caching layer to our J2EE-application. In this instance we use Ehcache. This has created a few challenges.
Let's take this example.
OrderItem orderitem = cache.getOrderItemByID("id");
OrderItem old_orderitem = cache.getOrderItemID("id");
orderitem.setStatus(1);
old_orderitem.setStatus(2);
If we're not carefull, any ...
There's some debate here over which is better for referencing our common code base from other projects: by project or by assembly. I'm in favor of referencing the project, especially since we have automated unit tests that prove that the common code does what it needs to.
The thought from the other camp is to lock down those projects...