An instance is a specific realization of any object.
Questions tagged [instances]
516 questions
                    
                    69
                    
            votes
                
                2 answers
            
        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 "", line 1, in 
    o.test = 1
AttributeError: 'object' object has no attribute 'test'
>>> class test1:
    pass
>>> t =…  
         
    
    
        quano
        
- 18,812
- 25
- 97
- 108
                    34
                    
            votes
                
                7 answers
            
        Django model instances primary keys do not reset to 1 after all instances are deleted
I have been working on an offline version of my Django web app and have frequently deleted model instances for a certain ModelX.
I have done this from the admin page and have experienced no issues. The model only has two fields: name and order and…
         
    
    
        pj2452
        
- 905
- 3
- 10
- 22
                    26
                    
            votes
                
                6 answers
            
        On Amazon EC2, will the Spot Instance price ever be higher than the On-Demand Price?
The spot prices are generally much less than the normal on-demand prices for EC2 servers but the prices also vary widely. Does it ever happen that the spot price is higher than an on-demand price?
If not, doesn't it make sense to always use spot…
         
    
    
        eric
        
- 1,453
- 2
- 20
- 32
                    24
                    
            votes
                
                4 answers
            
        JavaScript creating new instance of objects
So I am designing a grade book interface and I have a course defined as:
then later I want to create a new instance:
 var gradingareas = new Array("Homework",…
         
    
    
        user1991562
        
- 285
- 1
- 2
- 5
                    21
                    
            votes
                
                4 answers
            
        Obtaining tags from AWS instances with boto
I'm trying to obtain tags from instances in my AWS account using Python's boto library.
While this snippet works correctly bringing all tags:
    tags = e.get_all_tags()
    for tag in tags:
        print tag.name, tag.value
(e is an EC2…
         
    
    
        rodolk
        
- 5,606
- 3
- 28
- 34
                    18
                    
            votes
                
                6 answers
            
        Java - How Can I Check If A Class Is Inheriting From Some Class Or Interface?
I need to check:
public static boolean check(Class> c, Class> d)
{
    if (/* c inherits from d */)
        return true;
    else
        return false;
}
How can I do that ?
And is that possible without c.newInstance() ?
The title was wrong at…
         
    
    
        Bitterblue
        
- 13,162
- 17
- 86
- 124
                    15
                    
            votes
                
                3 answers
            
        SSM send command to EC2 instance Failed
I'm trying to use boto3 to run ssh commands on EC2 instances.
I read this guide:
http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/troubleshooting-remote-commands.html
and I did everything of what they wrote there but I keep get error…
         
    
    
        Udi Goldberg
        
- 175
- 1
- 1
- 5
                    14
                    
            votes
                
                3 answers
            
        Microservices: database and microservice instances
Lets say we have a microservice A and a B. B has its own database. However B has to be horizontally scaled, thus we end up having 3 instances of B. What happens to the database? Does it scale accordingly, does it stays the same (centralized)…
         
    
    
        nobitta
        
- 195
- 1
- 11
                    14
                    
            votes
                
                1 answer
            
        Object-oriented languages without class concept
I am reading introduction to Scala paper and found following statement:
It should be noted that some object-oriented languages do not have the
  concept of class.
Question: Which object-oriented languages do not have class concept and how do they…
         
    
    
        tommyk
        
- 3,187
- 7
- 39
- 61
                    14
                    
            votes
                
                3 answers
            
        Why doesn't Python call instance method __init__() on instance creation but calls class-provided __init__() instead?
I'm overring the __new__() method of a class to return a class instance which has a specific __init__() set. Python seems to call the class-provided __init__() method instead of the instance-specific method, although the Python documentation…
         
    
    
        vkoukis
        
- 143
- 5
                    13
                    
            votes
                
                1 answer
            
        Objective-C: Creating Instance from Class Reference
You can create a class reference with the following code:
Class M = [NSMutableString class]; // NSMutableString (for example).
You can then call methods on that saved class with code like this:
[M string];
But can you create instances, from that…
         
    
    
        Alex Coplan
        
- 13,211
- 19
- 77
- 138
                    13
                    
            votes
                
                5 answers
            
        Detect number of processes running with the same name
Any ideas of how to write a function that returns the number of instances of a process is running?
Perhaps something like this?
function numInstances([string]$process)
{
    $i = 0
    while()
    {
     … 
         
    
    
        Jack
        
- 2,153
- 5
- 28
- 43
                    13
                    
            votes
                
                9 answers
            
        How to Count Number of Instances of a Class
Can anyone tell me how to count the number of instances of a class?
Here's my code 
public class Bicycle {
    //instance variables
    public int gear, speed, seatHeight;
    public String color;
    //constructor
    public Bicycle(int gear, int…
         
    
    
        RifferRaffers
        
- 213
- 2
- 5
- 11
                    11
                    
            votes
                
                2 answers
            
        Python: Create a duplicate of an instance of a class
I have an instance 'graph_main' of a class BipartiteGraph which I've defined. All I need now is to keep this instance untouched but create another instance 'graph1' of this class that is identical to 'graph_main'. But for some reason the graph_main…
         
    
    
        mathamateur
        
- 368
- 1
- 3
- 10
                    10
                    
            votes
                
                2 answers
            
        TypeScript class decorator that modifies object instance
I'm making a plugin for Aurelia and need a class decorator that 
adds attributes to the new object instance, and
calls an external function with the new object as an argument.
I've looked through examples, and so far I've put together…
         
    
    
        jwx
        
- 101
- 1
- 4