class

MooTools Classes and JsDoc

I have the following Moo class: Nem.Ui.Window = new Class({ Implements: [Options, Events], options: { caption: "Ventana", icon: $empty, centered: true, id: $empty, width: $empty, height: $empty, modal: false, desktop: $empty, ...

Perl - Calling subclass constructor from superclass (OO)

This may turn out to be an embarrassingly stupid question, but better than potentially creating embarrassingly stupid code. :-) This is an OO design question, really. Let's say I have an object class 'Foos' that represents a set of dynamic configuration elements, which are obtained by querying a command on disk, 'mycrazyfoos -getconf...

Call to a member function query() on a non-object

Ok, this is so weird!!! I am running PHP Version 5.1.6 when I try and run the code below it gives a fatal error of an object that has not been instantiated. As soon as I un-comment this line of code //$cb_db = new cb_db(USER, PASSWORD, NAME, HOST); everything works. Even though I have declared the $cb_db object as global within in the me...

C++ increment operator

How to differentiate between overloading the 2 versions of operator ++ ? const T& operator ++(const T& rhs) which one? i++; ++i; ...

Is there a Pattern in Scala that add a method to an Array object?

Is there a Pattern in Scala that can add a method to an Array object? I am thinking of the implicit conversion of Int to RichInt. But that can't be done as Array is a final class. ...

User Control Tells Project What To Do...

Hi All This might be abit "out there", but here goes: I have a User Control. And I have a project. How can I have my user control pass a particular "event" to my project, and then have my project run that event? ...

jQuery Validation using the class instead of the name value

Hi, I'd like to validate a form using the jquery validate plugin, but I'm unable to use the 'name' value within the html - as this is a field also used by the server app. Specifically, I need to limit the number of checkboxes checked from a group. (Maximum of 3.) All of the examples I have seen, use the name attribute of each element. W...

Global qualification in a class declarations class-head

We found something similar to the following (don't ask ...): namespace N { struct A { struct B; }; } struct A { struct B; }; using namespace N; struct ::A::B {}; // <- point of interest Interestingly, this compiles fine with VS2005, icc 11.1 and Comeau (online), but fails with GCC: global qualification of class name is inva...

Django: way to test what class a generic relation content_object is?

In my project I have a class, NewsItem. Instances of NewsItem act like a wrapper. They can be associated with either an ArtWork instance, or an Announcement instance. Here's how the NewsItem model looks: class NewsItem(models.Model): content_type = models.ForeignKey(ContentType) object_id = models.PositiveIntegerField() content_o...

Python: Hack to call a method on an object that isn't of its class

Assume you define a class, which has a method which does some complicated processing: class A(object): def my_method(self): # Some complicated processing is done here return self And now you want to use that method on some object from another class entirely. Like, you want to do A.my_method(7). This is what you'd ...

How can I create a list of classes in C# to iterate over in a loop

Suppose I have class animal and classes cat and dog extending it. I want to do something along the lines of: foreach (class a in {cat, dog}) if (a.isValid(parameters)) doStuff(); isValid is a static method from animal that just checks if the given parameters define an object of the given type doStuff means I'm doing stuf...

transmit a java.lang.reflect.Proxy over a network

Is there a convenient way to transmit an object including its code (the class) over a network (not just the instance data)? Don't ask me why I want to do this. It's in an assignment. I asked several times if that is really what they meant and the didn't rephrase their answer so I guess they really want us to transmit code (not just the ...

Can I use vector as index in map structure in c++?

I attempted to do something like this but it does not compile: class point { public: int x; int y; }; int main() { vector<point> vp1; vector<point> vp2; vector<point> vp3; map < vector<point>, int > m; m[vp1] = 1; m[vp2] = 2; m[vp3] = 3; map < vector<point>, int >::iterator it; ...

Can I use string concatenation to define a class CONST in PHP?

I know that you can create global constants in terms of each other using string concatenation: define('FOO', 'foo'); define('BAR', FOO.'bar'); echo BAR; will print 'foobar'. However, I'm getting an error trying to do the same using class constants. class foobar { const foo = 'foo'; const foo2 = self::foo; const bar = self::f...

How to access java classes in a subfolder.

Hi all. I'm trying to make a program that can load an unknown set of plugins from a sub-folder, "Plugins". All of these plugins implement the same interface. What I need to know is how do I find all of the classes in this folder so that I can instantiate and use them? ...

migrating C++ code from structures to classes

I am migrating some C++ code from structures to classes. I was using structures mainly for bit-field optimizations which I do not need any more (I am more worried about speed than saving space now). What are the general guidelines for doing this migration? I am still in the planning stage as this is a very big move affecting a major p...

how to call another classes method from within a class?

here is my setup. class testA { function doSomething() { return something; } } $classA = new testA(); class testB { $classA->doSomething(); } this wont work inside that class.: $classA->doSomething(); how else would i do it? ...

What's an elegant solution to get the property values from two classes (that have the same property names) that do not use inheritance?

Essentially I have to use a poorly implemented web service maintained by other programmers. They have two classes that don't derive from a parent class, but have the same properties (Ughh...). So it looks like this in my web service proxy class file: public partial class Product1 { public int Quantity; public int Price; } publi...

How do I get the value of a class variable in squeak?

Hi, I have a string that contains the name of a class variable that I know exists for class A. I need to get the value of this variable (i.e. dereferencing), how do I do it? ...

c# Does sealing a class seal all overriden members?

If I seal a class are all overriden members implicitly sealed or do I have to seal each overriden member explicitly? public sealed ClassA : ClassB { // Is this implicitly sealed or do I have to explicitly seal public override void Method1() {} } TIA. Klaus ...