instance

Do static local variables in a class persist between objects?

class MyClass { static int staticInt; void instanceMethod( int param ) { static int parameter = param; } } Clearly staticInt is shared between all instance of MyClass. But can different instances of MyClass have different values of parameter the static local variable within instaceMethod? Update What about between progr...

Help: Instance Variables & Properties [iPhone]

In something like this: @interface Control_FunViewController : UIViewController { UITextField *nameField; UITextField *numberField; } @property (nonatomic, retain) IBOutlet UITextField *nameField; @property (nonatomic, retain) IBOutlet UITextField *numberField; I understand that "UITextField *nameField;" is an instance variabl...

php Set a anonymous function in an instance

I am just starting out with PHP, and I am wondering if there is a way to add an anonymous function to a class instance. For instance, lets say... class A{ public B; } $c = new A(); //This is where I am getting a little confused... //The following wont work $c->B = function(){echo('HelloWorld');}; $c->B(); What I am hoping to d...

setting value to the instance of primitive types

I have a function which performs some operation i.e. fetches some data from database. The generic it takes is primitive type always i.e. int, char, bool, string etc. I can easily create its instance. But I can't set the value that I have fetched from database to this instance. public T PerformOperation<T>() { object instance = (...

In SQL Server, how can I test the instance I'm currently connecting is default or not?

Hi guys, In SQL Server, how can I test the instance I'm currently connecting is default or not? I mean how can I using TSQL to get this information? Thanks. ...

Accessing typedef from the instance

As in stl containers, why can't we access a typedef inside the class from the class instance? Is there a particular insight into this? When value_type was a template parameter it could help making more general code if there wasn't the need to specify the template parameters as in vector::value_type Example: class T { public: typ...

Using haskell read and typeclasses - ambiguous type variable error

Hi all, I have an ambiguous type variable error on the definition of "trial" below, I am wondering if there is anything that can be done to make this situation work? I want to really just deal with instances and not explicit data types (such as the MO1, MO2 included below). module Tc102 where class (Show a, Read a) => MyObj a where ...

Django prepopulate form with the fields from the database

i have a privacy form, in wich i am selecting what application should be hidden when one accesses a user's profile. The form contains several checkboxes,and the user checks what he wants to be hidden. What i want is, when a user accesses this form, the form to be an instance of the privacy form already saved, if it exists one. I mean, if...

Puzzling behaviour (Java instances, arrays & GWT)

I am not sure if this is Java behaviour or rogue GWT behaviour. But here goes. I have a class for 2D vectors, called Vector2. In my program I do some simulation of 2D particles represented by instances of this class. I have two arrays of Vector2, m_x and m_oldx that are members of another class, with a function that does some processing...

Why type(classInstance) is returning 'instance'?

Hi! I have a method that accepts a parameter that can be of several types, and has to do one thing or other depending on the type, but if I check the type of said parameter, I don't get the 'real' type, I always get <type 'instance'>, and that is messing up with my comparisons. I have something like: from classes import Class1 from c...

Prevent new activity instance after clicking on notification

Hello, application (non-wanted) behavior - application is started, some text is put into text-box and notification is created through button action. user "clicks" the home button, application is "minimized", notification is available in bar user selects the notification and the application is "maximized" BUT - instead of the origi...

C# Get the name of a non-static property of a class.

I have a question very similiar to another question: http://stackoverflow.com/questions/2820660/get-name-of-property-as-a-string. His solution ended up with // Static Property string name = GetPropertyName(() => SomeClass.SomeProperty); // Instance Property string name = GetPropertyName(() => someObject.SomeProperty); What I'd ...

Alias for instance variables?

Is there a way to create aliases for instance variables (not talking about db alias attributes) other than assigning it to another instance var? For ex: @imavar alias_attribute(@hesavar, @imavar) ...

How to create instance in SQL Server 2008

I have SQL Server 2005 Express installed. Later I upgraded to SQL Server 2008. I don't know much about instances, but when I log into SQL Server 2005 and I log into SQL Server 2008 it is showing the same number of databases. Also, when I create a database in SQL Server 2008 it is showing it in SQL Server 2005. Any Idea how can I create ...

In C++ how can you create class instance w call to either a struct or nothing?

I'm creating a Class. This class stores user preferences in a Struct. When creating an instance of the class, I want the client to have the option of creating an instance with no preferences passed in or with a preferences struct passed in. I can do this with pointers, but I wanted to know how I could do it by passing the preferences...

Django create object only once by a user id

hello, I'm making a little vote system, in wich one can vote an answer, but only once. I have not created a form for the vote, i am creating the vote when someone submits it (accesses a link) How can i make, in my situation, for a person to be able to vote only once? It would be better if i would make a form instead? my code: def voteup...

V8 FunctionTemplate Class Instance

I have the following class: class PluginManager { public: Handle<Value> Register(const Arguments& args); Handle<ObjectTemplate> GetObjectTemplate(); }; I want the Register method to be accessible from JavaScript. I add it to the global object like this: PluginManager pluginManagerInstance; global->Set(String::New("register...

Installing New Instances in SQL Server 2008

I want to Install New SQL Server 2008 Instance. I want to know whether Installing New Instance would create any problem to already installed instances. I have SQL Server 2005 Instances transformed to SQL Server 2008 and It has many databases, so If i installed SQL Server 2008 New Instance will i be able to see all my previously install...

iphone declare property correctly

Hi all, I have this problem: I have my code into my view that connect to internet to retrieve some info and populate a uitableview, and works fine.. To make order to my code I created my class derived to nsobject and I added all my code inside it... the table is populated, but the app retrieve bad_access... I think that the problem is th...

How to pass message to instance from a different class in objective c?

Stuck on what I figure is simple thing here. Basically I need to pass a pointer to an object as an argument into an instance method of another class. Said differently: I have a class that creates "Things" and I have an instance of another class that I want to receive the "Things." Working with Cocos2D frameworks. The Things are a custo...