class

UML - class model question

Hello, I have started to study UML standard and would need little help with two things I cannot find. I understand that in the class model I should design classes and their relations like: Customer<>--->(*1)Items ordered 1)Is it correct that we design only "our" custom classes and do not care about classes used inside like Dictionary,L...

Get ProjectItems for Partial Class through CodeModel

I have seen looking for a way to get the list of ProjectItems (files) for a known class, which generated from several partial classes. I use CodeModel to search for a class and accessing the ProjectItem to do stuff, which works fine for normal classes. But when it comes to partial classes, the ProjectItem property give one file but dont ...

In what language is there a "guard" keyword or concept?

I recently tried to understand a C++ program that was written by somebody who I assume had a background in functional programming: For example, he had declared a closure class which he extensively used and which does somewhat resemble what is known as a closure in functional programming. Another class was called a guard, but I haven't qu...

What are classes and modules for in C#

Can someone explain the difference between a class and a module. When do you use one versus the other? I am using C#. Update: I do mean the C# equivalent of the VB Module. ...

Python: creating class instance without calling initializer

Is there any way to avoid calling __init__ on a class while initializing it, such as from a class method? I am trying to create a case and punctuation insensitive string class in Python used for efficient comparison purposes but am having trouble creating a new instance without calling __init__. >>> class String: def __init__(self...

PHP class variable set/get problem

I've attempted to write a PHP class that gets the uptime of my Linux machine. It will get the uptime correctly, but I have an if statement that determines whether or not the load average is "high" or not and set a warning code, and it doesn't seem to be working (it stays at 0). I've included all of the code here from the class (50 or so...

Dynamically picking variable from a class

I'm trying to get data from a class in php5, where the data in the class is private and the calling function is requesting a piece of data from the class. I want to be able to gain that specific piece of data from the private variables without using a case statement. I want to do something to the effect of: public function get_data($f...

Python __init__ argument problem

I have some trouble understanding what happens with class init arguments that are lists like: class A(object): def __init__(self, argument=[]): self.argument = argument[:] or: def __init__(self,argument=None): self.arguments = arguments or [] or: def __init__(self, argument=[]): self.argument = argume...

Creating Controls in a Class File

Hi All I selected Class Library option in C# Vis Studio Express to create a DLL which holds heaps of my commonly-used methods etc... I'm trying to create a textbox in the class file, so that when I add the dll to another project all i have to type is: MyControls.Create(TextBox); ...And it will create a text box and return it to me an...

Declaring a variable as a "Class" datatype, without calling the "Class" constructor?

Forgive me if I'm just blatantly missing something, but I'm trying to make the transition from structs and c to classes and c++. Heres what I'm trying to do: A have a "Checkers" class and a "Board" class. Now with structs, I could just create an array of Checkers in my "board.cpp" file by doing: Checker checkers[2][12] (0 and 1 for ...

read web.config from another assembly using t4

Does anyone have a good example or helper class that would allow me to read the connection string in a web application from a T4 template residing in ANOTHER assembly referenced by the web application. I am generating some code from the database that it references and i would appresiate some help on how to get the connection string for t...

Getting Unresolved External error

I have made a class and it compiles with no syntax errors, but I get 6 unresolved external symbols? THE CLASS: struct CELL { private: static bool haslife; static int x; static int y; public: static bool has_life() { return haslife; } static void set_coords(int xcoord, int ycoord) { x = xcoord; ...

in C++, how to use a singleton to ensure that each class has a unique integral ID?

I have a bunch of C++ classes. I want each class to have something like: static int unique_id; All instances of a same class should have the same unique_id; different classes should have different unique_id's. The simplest way to do this appears to be threading a singleton through the classes. However, I don't know what's called w...

How to Use External Class Files in an Eclipse Project

Hi all, My lecturer didn't provide us with the .java files for a tutorial. My question is, how would i use his class files in my eclipse project, and defeat the following error? Error: Exception in thread "main" java.lang.NoClassDefFoundError: lec/utils/InputReader at randomIt.main(randomIt.java:17) Caused by: java.lang.ClassNot...

Is there any way to create a class property in Python?

The following doesn't work for some reason: >>> class foo(object): ... @property ... @classmethod ... def bar(cls): ... return "asdf" ... >>> foo.bar <property object at 0x1da8d0> >>> foo.bar + '\n' Traceback (most recent call last): File "<stdin>", line 1, in <module> TypeError: unsupported operand type(s) fo...

OpenMP questions

Hi, I want to parallelize a loop in a class member function. However there are two errors in the code: class myclass { public: int _k; void f(int nb_examples, int nb_try) { int i; int ks[nb_try]; // assignment to elements in ks omp_set_num_threads(_nb_threads); #pragma omp parallel shar...

How Can I Add a "Selected" Class Based on URL with jQuery?

I have a sidebar list of links, code shown below... <div class="WikiCustomNav WikiElement wiki"><a href="/" class="wiki_link">Home</a> <a href="/Calendar" class="wiki_link">Calendar</a> <a href="/Science" class="wiki_link">Science</a> <a href="/Language+Arts" class="wiki_link">Language Arts</a> <a href="/Video+Page" class="wiki_link">Vi...

Unique Numerical ID for a Templated Class using Function Address

So, this question has been asked before, but I wanted a question with some of those key words in the title. The issue is simple: How can I have a templated class, such that for each instance of the template - but not each instance of the class - there is a unique, numerical identifier? That is, a way to differentiate: foo<int> f1; foo...

objective c dynamic object creation

Hey Guys Quick question for you. I want to be able to create an instance of an object. The object type is based of a string. In php you can just replace the class name with a string, but I doubt it is that easy in Objective c. NSString * className; id theObject; className = @"TestObject"; theObject = [[className alloc] init]; here...

PHP: run class method when another class method is run?

PHP: run function when a specific class method is run what I want is to run some additional functions when a class method is run without altering the already existing class. how? ...