instances

When chaining .NET delegates, how are the original instances (re)used?

Say I have the following C# code: Action a = TestMethod; Action b = TestMethod; Action c = b; b += a; Tests indicates that b is not the same instance as c, so clearly the + operator seems to create a new instance of the delegate. Is this a correct assumption? Does it reuse the b-instance internally, or does it just copy the method/tar...

Problem opening excel 2007 in new instance using VBA (using OLE and bound object frame)

Hi Guys, I have problem creating new instance of excel 2007 using VBA (from Access 2002). At first I misunderstood the problem and it is more complicated than I thought. Set myXL = CreateObject("Excel.Application") Creates new processes (I thought it didn't), but still strange thing is happening. I use OLE to store Excel files in SQ...

I need a Python class that keep tracks of how many times it is instantiated

I need a class that works like this: >>> a=Foo() >>> b=Foo() >>> c=Foo() >>> c.i 3 Here is my try: class Foo(object): i = 0 def __init__(self): Foo.i += 1 It works as required, but I wonder if there is a more pythonic way to do it. ...

Why can't you add attributes to object in python?

(Written in Python shell) >>> o = object() >>> o.test = 1 Traceback (most recent call last): File "<pyshell#45>", line 1, in <module> o.test = 1 AttributeError: 'object' object has no attribute 'test' >>> class test1: pass >>> t = test1() >>> t.test Traceback (most recent call last): File "<pyshell#50>", line 1, in <modul...

Multiple webRole instances at Azure and session state

I have webRole with some data stored in Session. The data is some tens of small variables (strings), and one-two big objects (some megabytes). I need to run this webRole in multiple instances. Since two requests from the single user can go to different instances, Session became useless. So, i am looking for most efficient and simplest me...

"Global variable" in Visual C#

I have made the Graph class, and i want to simulate a distribution network. The Graph works 100%. But, i want to use that same struct/class in all my application! For example: I have Form1 that shows the simulation, but i want to insert Nodes (for example) but i want to do it in Form2! Since the data is always in the same class, i could...

List SQL Express 2005 instances using VB6 code

How to list all the instances of SQL Server 2005 Express Edition using vb6 application? ...

Dynamically add Multiple Instances of a Form Based on User Input - Flex

I'm trying to create a form that based on the users input would determine how many forms to generate dynamically. I have a base state with a combo box that contains 1-4. Bases on the users selection I would like to have the next state generate the number of forms. So if you user selects 2 and click next - 2 copies of the form would be ...

It is related to core java enums.

what is singleton instances of the enumeration class in java? ...

Cocoa:Testing for the same object with ifs/switches

Ok so here's my code, it works great: - (void)textViewDidChange:(UITextView *)textView{ if (textView==someObject) { [detailItem setValue:textView.text forKey:@"someObjectAttribute"]; } The problem is that I have lots of textviews instances to test for and I would prefer to find some other way to consolidate the code. I was thinkin...

Delphi Unit local variables - how to make each instance unique?

Ok, this, I'm sure is something simple that is easy to do. The problem : I've inherited scary spaghetti code and am slowly trying to better it when new features need adding - generally when a refactor makes adding the new feature neater. I've got a bunch of code I'm packing into a single unit which, in different places in the appli...

Java ServerSocket Multiple Listen Instances

i have a java game app that uses sockets to communicate with each other. the issue is when i do a socket listen (server), i can run another instance of the game on the same machine using the same port as before to listen, and it results in listening again. now i have two instances of the application both listening on the same port. you ...

Use of Java constructors in persistent entities

Hello I'm new to JPA and using persistence in Java anyway and I have two questions I can't quite work out: I have generated tags as: @JoinColumn(name = "UserName", referencedColumnName = "UserName") @ManyToOne(optional = false) private User userName; @JoinColumn(name = "DatasetNo", referencedColumnName = "DatasetNo") @ManyToOne(optiona...

Managing Instances in Python

Hello, I am new to Python and this is my first time asking a stackOverflow question, but a long time reader. I am working on a simple card based game but am having trouble managing instances of my Hand class. If you look below you can see that the hand class is a simple container for cards(which are just int values) and each Player c...

How do you distinguish your EC2 instances?

The ec2-describe-instances command is not very helpful in distinguishing the instances. Are there command line tools that give a better overview? Perhaps somewhat like http://github.com/newbamboo/manec2 but with support for different regions etc. ...

license key for our WAMP server

Hi, We have a WAMP server. We have to deliver it to the client and ensure that only one instance of the server can be used. We are looking for a simple protection(since any scheme can be broken). Basically, we want to limit the number of server installs to 1. Please let me know a solution that can be implemented in a short time. Thanks...

Data.Vector.Binary overlaps Binary [a] instance

In my application I need to serialize a vector containing an arbitrary datatype, in this case is a list of Doubles. For serializing the vector I'm importing Data.Vector.Binary. When loading the module in GHCi the following error arises: Overlapping instances for Binary [Double] arising from a use of `decode' at Statistics.hs:57:33-42...

[Haskell] Error: "No instances for (x)..."

Exercise 14.16-17 in Thompson asks me to add the operations of multiplication and (integer) division to the type Expr, which represents a simple language for arithmetic, then define the functions show and eval (evaluates an expression of type Expr) for Expr. My solution works for each arithmetic operation except division: data Expr = L...

JavaScript: get object instances to contain extended variables

So, say I had the following script: var hey = { foo: 1, bar: 2, baz: 3, init: function(newFoo){ this.foo = newFoo; return this; } } hey.check = function(){ alert('yeah, new function'); } Basically, I can call new hey.init(999) and get a new hey variable with hey.foo set to 999. But when I do tha...

Nservicebus configuration in WPF

Using the pub/sub sample i managed to get multiple instances of the same console app to read all messages sent from the publisher. What I did whas this: namespace Subscriber1 { public class EndpointConfig : IConfigureThisEndpoint, AsA_Server { } public class OverrideInputQueue : IWantCustomInitialization { public void...