I am creating a "department picker" form that is going to serve as a modal popup form with many of my "primary" forms of a Winforms application. Ideally the user is going to click on an icon next to a text box that will pop up the form, they will select the department they need, and when they click OK, the dialog will close and I will ha...
Hi,
Why is the following code "crashing" in PHP?:
$normal_array = array();
$array_of_arrayrefs = array( &$normal_array );
end( $array_of_arrayrefs )["one"] = 1; // choking on this one
The expected result is that the final code line appends $normal_array with key "one" having value 1. In the real context of this scenario I use ...
I want to be able to do the following:
$normal_array = array();
$array_of_arrayrefs = array( &$normal_array );
// Here I want to access the $normal_array reference **as a reference**,
// but that doesn't work obviously. How to do it?
end( $array_of_arrayrefs )["one"] = 1; // choking on this one
print $normal_array["one"]; // sho...
Let's say we have a method signature like
public static function explodeDn($dn, array &$keys = null, array &$vals = null,
$caseFold = self::ATTR_CASEFOLD_NONE)
we can easily call the method by omitting all parameters after $dn:
$dn=Zend_Ldap_Dn::explodeDn('CN=Alice Baker,CN=Users,DC=example,DC=com');
We can also call the metho...
In an attempt to wrap some unmanaged code in a managed .dll I'm trying to convert a Generic::List of data points into a std::vector. Here's a snippet of what I'm trying to do:
namespace ManagedDLL
{
public ref class CppClass
{
void ListToStdVec( const List<double>& input_list, std::vector<double>& output_vector )
...
This is a question based on C code for Win32.
In one of my functions I have the following code:
void SeparateStuff()
{
HGLOBAL hMem;
IStream* pStream;
Status result;
unsigned char* pBytes;
DWORD size;
FILE* fp;
if (hMem = GlobalAlloc(GMEM_MOVEABLE, 0))
{
if (CreateStreamOnHGlobal(hMem, FALSE, &pStr...
Hi all,
I'd like to be able to declare an array as a function argument in C++, as shown in the example code below (which doesn't compile). Is there any way to do this (other than declaring the array separately beforehand)?
#include <stdio.h>
static void PrintArray(int arrayLen, const int * array)
{
for (int i=0; i<arrayLen; i++) p...
I need to call a static function from an object using the Singleton design, but using a variable as the class name.
The best way, $class::getInstance();, is only available in PHP 5.3, and the other way I found, call_user_func(array($class, 'getInstance'));, results in the maximum execution time being breached. Does anyone know why this ...
Consider this:
List<MyClass> obj_list = get_the_list();
foreach( MyClass obj in obj_list )
{
obj.property = 42;
}
Is 'obj' a reference to the corresponding object within the list so that when I change the property the change will persist in the object instance once constructed somewhere?
...
I have an interesting problem. The basis of the problem is that my last iteration of an array reference doesn't
seem to "stick," if you will. A little context: I've devised a very simple data structure for page heirarchy that
looks like this:
,1,2,3>,4>,5,6,7<<,8
Translation: forget about the annoying leading commas. Pages 1, 2, 3, & 8...
Sorry guys! i am so into the code! that i forgot to put the compiler errors.
Here is a new version of the code simplified!
And this are the errors:
Error 1 The best overloaded method match for 'IWeird.DataBase.ModifyData(ref IWeird.IDataTable)' has some invalid arguments
Error 2 Argument '1': cannot convert from 'ref IWeird.Period...
I usually save serialized structs to my database, so
I pass them by reference a lot!
Is that a bad practice?
...
Right now my implementation returns the thing by value. The member m_MyObj itself is not const - it's value changes depending on what the user selects with a Combo Box. I am no C++ guru, but I want to do this right. If I simply stick a & in front of GetChosenSourceSystem in both decl. and impl., I get one sort of compiler error. If I do ...