object

Creating a list of objects in Python

Hi, I'm trying to create a Python script that opens several databases and compares their contents. In the process of creating that script, I've run into a problem in creating a list whose contents are objects that I've created. I've simplified the program to its bare bones for this posting. First I create a new class, create a new ins...

How to Create a Managed Path through SharePoint Object Model

This is a question for a WSS/SharePoint guru. Consider this scenario: I have an ASP.Net web service which links our corporate CRM system and WSS-based intranet together. What I am trying to do is provision a new WSS site collection whenever a new client is added to the CRM system. In order to make this work, I need to programmatically ...

Alternative to DLL's as objects (dynamically replaceable objects)

I have an application that uses many different .NET managed DLL's as objects (each DLL implements a common interface). Each DLL also has a version number in the file name. Suppose I create the object "Shape~01.dll." The application will use that DLL but it can't be replaced while the application is running. So, if I want to "upgrade"...

How do you change a connection string dynamically in an object datasource in asp.net?

how to change connection string dynamically in object datasource in asp.net ? ...

javascript - associative array without toString, etc...

I want to create an associative array: var aa = {} //equivalent to Object(), new Object(), etc... and I want to be sure that any key I access is going to be a number: aa['hey'] = 4.3; aa['btar'] = 43.1; I know JS doesn't have typing, so I can't automatically check this, but I can ensure in my own code that I only assign strings to ...

Delphi(2006) Loop Help

So What I'm essentially trying to do is have something happen 70% of the time, another few things happen 10% of the time each if that makes sense but my app doesn't seem to do any of the actions I'm guessing I'm misunderstanding the loop syntax or something, anyway if anyone could take a look and maybe give me some advice per1 := 70; pe...

Why in JavaScript is a function considered both a constructor and an object?

I have been doing a lot of research on this lately, but have yet to get a really good solid answer. I read somewhere that a new Function() object is created when the JavaScript engine comes across a function statement, which would lead me to believe it could be a child of an object (thus becoming one). So I emailed Douglas Crockford, and...

JavaScript - check if in global context

When a function is attached to an object and called: function f() { return this.x; } var o = {x: 20}; o.func = f; o.func(); //evaluates to 20 this refers to the object that the function was called as a method of. It's equivalent to doing f.call(o). When the function is called not as part of an object, this refers to the global object...

Can't assign a member which is a pointer to a templatized class

My problem is that in my "Widget" class i've the following declaration: MouseEvent* X; In a member function I initialize the pointer with an address the normal way: X = new MouseEvent; Ok, this last line makes the compiler stop at: error C2166: l-value specifies const object All right, a MouseEvent is declared as a typedef t...

Javascript isDOM -- How do you check if a Javascript Object is a DOM Object?

I'm trying to get: document.createElement('div') //=> true {tagName: 'foobar something'} //=> false In my own scripts, I used to just use this since I never needed tagName as a property: if (!object.tagName) throw ...; So for the 2nd object, I came up with the following as a quick solution -- which mostly works. ;) Problem is, i...

JavaScript - Identify whether a property is defined and set to 'undefined', or undefined

Say I have the following code: function One() {} One.prototype.x = undefined; function Two() {} var o = new One(); var t = new Two(); o.x and t.x will both evaluate to undefined. o.hasOwnProperty('x') and t.hasOwnProperty('x') will both return false; the same goes for propertyIsEnumerable. Two questions: Is there any way to tell t...

C++ 2D Arrays of an Object Constructor

In my Dev C++, I am trying to create a 2D Array class that acts like a Grid. But one of the problem is I am unsure what do for the constructor. When I try to compile, I get the following errors: In constructor 'Grid::Grid(int,int)': 'sqaures' is not a type 'yPos' cannot appear in a constant-expression [Build Error] [grid.o] Error 1 Her...

Using parent variables in a extended class in PHP

I have 2 classes, main and extended. I need to use main vars in extended class. <?php class Main { public $vars = array(); } $main = new Main; $main->vars['key'] = 'value'; class Extended extends Main { } $other = new Extended; var_dump($other->vars); ?> Who I can do it? No valid for example: <?php class Extended extends Mai...

C++ 2DArray Objects; Pointers and Array Problems

This problem is from a solved problem in my old question, which is from: http://stackoverflow.com/questions/394763/c-inserting-2d-array-object-into-another-2d-array-object But also created a new problem for me. Please read the question and the solution in the link to understand my problem. The solution in the previous question was to ma...

Delphi object persistence, what is the best way

I have developed application for drawing some shapes (lines mostly) , now i need to be able to store sketch to a file, i know that delphi has build in routines for object persistance, but i have never used it. Can someone tell me can object persistence be used if i have to persist object that have also references to other objects (th...

What is the simplest way to create and call dynamically a class method in C++?

I want to fill a map with class name and method, a unique identifier and a pointer to the method. typedef std::map<std::string, std::string, std::string, int> actions_type; typedef actions_type::iterator actions_iterator; actions_type actions; actions.insert(make_pair(class_name, attribute_name, identifier, method_pointer)); //after w...

How to ensure hashCode() is consistent with equals()?

When overriding the equals() function of java.lang.Object, the javadocs suggest that, "it is generally necessary to override the hashCode method whenever this method is overridden, so as to maintain the general contract for the hashCode method, which states that equal objects must have equal hash codes." The hascode method must retur...

Sorting an array of an array of objects in PHP by key value

Basically I have a setup like the following: Array ( [0] => Array ( [0] => stdClass Object ( [nid] => 1 [title] => title1 [uid] => 1 [parent] => 0 [weight] => -15 [name] => name1 [value] => 0 ) [1] => stdClass Object ( [nid] => 2 [title] => title2 [uid] => 1 [parent] => 0 [weight] => -7 [name] => name2 [value] => 100 ) ...

Object-Orientation in C

Can someone please share a set of nifty preprocessor hacks (ANSI C89/ISO C90 compatible please) which enable some kind of ugly (but usable) object-orientation in C? I am familiar with a few different object-oriented languages, so please don't respond with answers like "Learn C++!". I have read "Object-Oriented Programming With ANSI C" (b...

Need to 'wrap up' a C++ dll/h/lib/xml/exe based SDK into a COM to use in a C# 2.0 project

I just got handed an SDK made of C++ dll, lib, exe, and various .h files. I presume it is meant for C++ developers. The sample projects they provide with their documentation are all written in C++. I am able to spin them up with Visual Studio 8 (2005) and run them. They do control the device as advertised. However the project this nee...