class

getter and setter for class in class c#

Hello. I a little problem. Assuming we have a class InnerClass with attributes and getter/setter. We also have a class OuterClass containing the InnerClass. e.g. class InnerClass { private int m_a; private int m_b; public int M_A { get { return m_a; } set { ...

In C# how many lines before a class should be consider to be refactored?

A good rule of thumb by is that I intelligently refactor any method over 50 lines. The count does not include comments and white space but actual code. The reason I also say intelligently is there are plenty of times where a class over 50 lines is acceptable and cannot or should not be changed. I do not have a rule of thumb for classe...

C++ RTTI Inheritance causes class size to increase

In C++ the problem is simple. I have 2 classes one contains the other as part of its implementation. struct A { void do_something() { }; }; struct B { A obj_A; void hello_world() { }; }; Now the problem is that structure B is one byte larger if A is part of B when I do a sizeof(B) and object of type B. A ...

Can we use more than one mock object in a unit test?

hello, i have read many articles about unit testing.. Most of the articles said that we should not use more than one mock object in a test..but i can't understand why :s sometimes we really need more than one mock object in a test.. ...

Where can I find the facebook php class reference?

For an example, there is a set_user function $facebook->set_user but I typed in set_user at the facebook developer wiki search box, it returns 'There is no page titled "set_user"' http://wiki.developers.facebook.com/index.php/Special:Search?search=set_user&go=Go Where can I find the list of the functions and properties for the f...

dynamic class property $$value in php

How can i reference a class property knowing only a string? class Foo { public $bar; public function TestFoobar() { $this->foobar('bar'); } public function foobar($string) { echo $this->$$string; //doesn't work } } what is the correct way to eval the string? ...

is there a good web crawler library available for PHP or Ruby?

is there a good web crawler library available for PHP or Ruby? a library that can do it depth first or breadth first... and handle the links even when href="../relative_path.html" and base url is used. ...

javascript open.window returns null in called function

Hi there can anyone help, i have a developed a function that when called should open a window but it returns NULL. If i do the opening window in the original javascript function it works. I suppose its the original function passes control to the other function but for some reason this doesn't work.. Here is my original function, this b...

Please critique my class

Hi all I've taken a few school classes along time ago on and to be honest i never really understood the concept of classes. I recently "got back on the horse" and have been trying to find some real world application for creating a class. you may have seen that I'm trying to parse a lot of family tree data that is in an very old and ant...

Problem including a file in php gives an error whether I include the file or not.

With include('basemodel.php'); I get Fatal error: Class 'BaseModel' not found in C:\xampp\htdocs\allsides\account\model.php on line 2 Without include('basemodel.php'); I get Fatal error: Cannot redeclare class BaseModel in C:\xampp\htdocs\allsides\others\basemodel.php on line 2 ...

A class method which behaves differently when called as an instance method?

I'm wondering if it's possible to make a method which behaves differently when called as a class method than when called as an instance method. For example, as a skills-improvement project, I'm writing a Matrix class (yes, I know there are perfectly good matrix classes already out there). I've created a class method for it called identi...

How to change class variable in Javascript?

PROBLEM SOLVED. Special thanks to Andrew Noyes for explaining its not a class but a Object Literal Notation. What a noob am I.. EDIT: SORRY, i made a mistake in my js file, the structure of my js is like this: (I am totally new to javascript, i need your guys help here...) var className = { settings : { setA : true, setB: ...

subsonic Substage how can i override a class name

Is there anyway to override the class name generated as its causing me problems when generating tables. Im getting clashes as i have property names the same names as some of my tables. This causes duplicate name compile time errors on my classes. ...

Registering Windows Classes Win32

Hi, what's the best practise for registering window classes for a win32 program? Do you register every class in the WinMain function or as they're required? ...

xml output from class

Hello I'm trying to generate xml output (based on a class) that looks like this: <cdsXMLEnvelope> <TestValue1>x1</TestValue1> <inner> <eTestValue1>e1</eTestValue1> </inner> <inner> <eTestValue1>e1</eTestValue1> </inner> <inner> <eTestValue1>e1</eTestValue1> </inner> </cdsXMLEnvelope> [System.Xml.Serialization.X...

python instance variables as optional arguments

In python, is there a way I can use instance variables as optional arguments in a class method? ie: def function(self, arg1=val1, arg2=val2, arg3=self.instance_var): # do stuff.... Any help would be appreciated. ...

Python Class Members Initialization

Hello, I have just recently battled a bug in Python. It was one of those silly newbie bugs, but it got me thinking about the mechanisms of Python (I'm a long time C++ programmer, new to Python). I will lay out the buggy code and explain what I did to fix it, and then I have a couple of questions... The scenario: I have a class called A...

Passing a **Class as an argument

Hi, I'm trying to declare a method in main.h like this: void buildGraph(int gNum, Graph** gArray); Where Graph is a class and I'm trying to pass a pointer to an array of pointers to Graph objects. I get the error message: "Graph has not been declared". Even though I have #include "graph.h" at the top of the page and I've been using ...

PHP Microsoft Excel file generation / export class

I've been looking for a good Excel file generation class and have yet to find one - my number one issue is that I although I can get the exported file to open in Excel (running 2007), I always get a warning saying "the file is in a different format to the file extension". I noticed that the Excel export in phpMyAdmin even generates the ...

What to define Predefined Constants as.

I have a database class that automatically sets up a connection to the database and does some basic input filtering and whatnot. I am looking at setting some predefined constants to adjust the behavior of the class methods. What should I set the values of the constants as? Since the values will never be referred to, or compared, direc...