class

Should I create new objects every page load or pass them page to page in PHP?

With PHP and MySQL I am working on a user login type site. Here is my plan so far. User logs in with email/password I then set a few things into session (UserID, photoURL, userName, latitude, longitude, gender) These are the basic items that will be saved into session and possibly APC/Memcache when a user is "logged in". I have my...

C++ empty class or typedef

Hi, I'm currently using something like that in my code: class B : public A<C> { }; Wouldn't it be better to use a typedef? typedef A<C> B; ...

How to structure a very large Objective-C class?

Hi, I've a fairly complex window that is backed by a controller class that is obviously growing to meet the needs of my view window. While I believe I am sticking to proper MVC I'm still having problems managing a fairly largish controller class. How do you breakdown your objects? Maybe use Categories? For example, one category to hand...

Implement/instantiate abstract class via reflection in Scala

I'm working on a framework for a EA (evolutionary alg) project in Scala. In this i have a trait that implements common EA-code and leaves problem spesific code like genotype convertion and fitness testing to classes that implement this trait. However, I don't want to fully implement the trait before it is actually run because of testing ...

C# Property for a list of classes

I'm trying to use the property grid in the designer for Visual Studio. I have a list of classes that I want the developer to be able to add to at design time so that the user can have access to extra features. Here is some example code of what I have in the code already. The problem is when the developer goes to the design mode he c...

Getting data from classes outside it's construction.

Maby the title is confusing , but i try to explain here what i'm trying to do. I'm working on the oscommerce 3 project inside another cms. Above my expectations i succeed verry well. But there's one problem left for me , i cant get the generated dynamic titles from oscommerce into the cms. Oscommerce uses a template class and combine ...

C# and Variable Scope in Winforms

Within a Winform app, I would like data in an instantiated class to be accessible by multiple form controls. For example, if I create Class Foo, which has a string property of name, I'd like to instantiate Foo a = new a() by clicking Button1, and when I click Button2, I'd like to be able to MessageBox.Show(a.name). There may be multipl...

Deleting attributes when deleting instance

Hello, class A: def __get(self): return self._x def __set(self, y): self._x = y def __delete_x(self): print('DELETING') del self._x x = property(__get,__set,__delete_x) b = A() # Here, when b is deleted, i'd like b.x to be deleted, i.e __delete_x() # called (and for immediate consequence, "DELETING" printed) del b Tha...

Linux org.GNOME.Accessibility.JavaBridge$AccessQueue throws java.lang.ClassNotFoundException after the class has been previously loaded

I am running java with an agent. When my application does not use GUI (swing) it runs fine under both JREs mentioned below. When it does use GUI (swing), when using JRE: HotSpot (TM) 64 Bits Server VM (build 1.6.0-b105, mixed mode) it runs fine. But with JRE: /usr/lib/jvm/java-6-openjdk, it produces exception java.lang.NoClassDefFoun...

A little problem in handling 2-D arrays with class

class linklist4x4 { private: struct node4x4 { double data[4][4]; node4x4 *link; }*p; public: linklist4x4(); void append( double* num ); void add_as_first( double* num ); void addafter( int c, double* num ); //void del( double* num ); void display(); int count(); double*...

Get value from constructor to a function in php class.

Hello, i have a class like: class List_PendingVerify extends Rs_List { public function __construct( $id ) { } protected function loadData( ) { } } Now i how could i get value of $id in loadData function ? so that i can be able to echo $id. Thanks. ...

Could anyone please explain this Java syntax?

I have encountered the following Java syntax that I don't recognize. This part is fine: public abstract class Stream<T> implements Iterator<T> { public boolean hasNext() { return true; } public void remove() { throw new RuntimeException("Unsupported Operation"); } } But this I don't get: Stream<Integer>...

How to pass data to another function from a class (in HTMLParser)?

I'm beginning to learn python. My python version is 3.1 I've never learnt OOP before, so I'm confused by the HTMLParser. from html.parser import HTMLParser class parser(HTMLParser): def handle_data(self, data): print(data) p = parser() page = """<html><h1>title</h1><p>I'm a paragraph!</p></html>""" p.feed(page) I'll get this: ...

PHP how to assign class property variables conditionally

Hi, I'm new to php classes, arrays, etc, so pls excuse me if I don't use the correct terminology. What I'm looking for is how to assign easily values to properties from a class without having to depend on "if" statements. For example: Suppose I have an instance of a class test, and "test" has a property "employee" (hope this is the co...

Can I ReDim a module level array using a property?

I think I have a pretty good handle on how to handle module level arrays in VBA though Property Get and Let. Is there a way to ReDim a module level array through a property? The following code errors out at the ReDim statement in the last procedure (DoTest). Private mstrTestArray() As String Private Sub Class_Initialize() ReDim ms...

incompatible types in assignment of char?

Hi, I am getting an error with this code. 'Incompatible types in assignment of char to char[13]' I can't figure out how to initialize these arrays and make this work. Basically, the program takes ISBN codes (4 groups of integers and makes one string with '-' in them between each group of numbers) and verifies that they are correct. The p...

How to get a reference to the current class from class body?

I want to keep a dictionary of (all, non-immediate included) subclasses in a base class, so that I can instantiate them from a string. I'm doing this because the CLSID is sent through a web form, so I want to restrict the choices to the ones set from the subclasses. (I don't want to eval()/globals() the classname). class BaseClass(obje...

Differences between structs and classes?

Do structures support inheritance? I think it's stupid question, but I have not much idea about it. What is the meaning of writing code like this: struct A { void f() { cout << "Class A" << endl; } }; struct B: A { void f() { cout << "Class B" << endl; } }; In structures also private section will come, don't they give encapsul...

How do I document a c# dll

How do I write a class so that property and method descriptions are visible to people referencing the dll in other projects? [Description("My age in years attribute")] public int Age { get { return 0; } set { } } doesn't work, neither does /// <summary> /// My age in years attribute /// </s...

jQuery setting class to a variable

Hi, I am trying to set class to a variable. My code is: var vtxt = $(this).attr("id"); $("('" + vtxt + "')").addClass("on"); It does not work this way. I've tried several things with no luck. What is the right format for adding a setting class to a variable? Thank you ...