Search Results

Search found 13788 results on 552 pages for 'instance'.

Page 2/552 | < Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >

  • Access to an "upper" instance of a class from another instance of a different class

    - by BorrajaX
    Hello everyone! I have a tricky question and probably what I want to do is not even possible but... who knows... Python seems very flexible and powerful... I'd like to know if there's a way to access to the class (or its fields) where an object is instanciated. Let's say I have: def Class1: def __init__(self): self.title = "randomTitle" self.anotherField = float() self.class2Field = Class2() and the class whose type will be the class2Field: def Class2: def __init__(self): self.field1 = "" self.field2 = "" # . . . # I'd like to know if there's a way to access the instance of Class1 from the instance of Class2 that is declared in Class1 (meaning, accessing the fields of Class1 from the variable self.class2Field in that Class1 instance) I know I can always change the init in Class2 to accept a Class1 parameter, but I'd like to know if there's another way of "climbing" through the class hierachy... Thank you very much!

    Read the article

  • Objective-C: Cannot Change Value of Instance Variable Inside a Function

    - by user262325
    Hello everyone, I cannot change the value of an instance variable inside a function. I have defined a class: // info.h #import <Foundation/Foundation.h> @interface NSMyObject : NSObject { NSInteger i; } -(void) setI:(NSInteger)v; @end #import "info.h" @implementation NSMyObject -(void) setI:(NSInteger)v ; { i=v; } - (void)dealloc { [super dealloc]; } @end I call a function 'myFunction' with parameter temObj which is a NSMyObject instance. myFunction(temObj);//temObj is NSMyObject In the function, I can change the value of the instance variable of parameter obj. -(void)myFunction:(NSMyObject*) obj; { [obj setI:0]; } ... expecting this to change the content of temObj. But when I check the results of operation on obj in function myFunction the value of temObj.i has not changed. Welcome any comment Thanks

    Read the article

  • Getting instance of a class in ArrayList

    - by user1499974
    I have a small problem with ArrayList. You see, I wish to get an instance of RenderNewHUD in my renderer class, which has a list of registered renderers. I did not want to create a variable for this due to limitations and awkwardness. Here is my code. RenderNewHUD hud = renderer.renderList.get(RenderNewHUD()); How exactly can I go along getting the instance of RenderNewHUD without creating a new instance? If you need any more of my code, just ask. Sorry if this is a very dumb question - I have looked EVERYWHERE for an answer.

    Read the article

  • reporting services 2005 instance

    - by niao
    Greetings, I have Reporting Services Installed on my computer. It was installed previously by other developer. However I cannot access reporting services instance on my localhost. When I open Reporting Services Configuration the error returned is: no report servers were found on the specified machine How can I add/restore this instance?

    Read the article

  • Rails: i have a class method and i want to modify something of the instance

    - by Totty
    Rails: i have a class method and i want to modify something of the instance something like this: class Test < Main template :box def test # here I want to access the template name, that is box end end class Main def initialize end def self.template(name) # here I have to save somehow the template name # remember is not an instance. end end that is similar to the model classes: # in the model has_many :projects How do I do it?

    Read the article

  • Get Instance ID of an Object in PHP

    - by Alix Axel
    I've learn a while ago on StackOverflow that we can get the "instance ID" of any resource, for instance: var_dump(intval(curl_init())); // int(2) var_dump(intval(finfo_open())); // int(3) var_dump(intval(curl_init())); // int(4) var_dump(intval(finfo_open())); // int(5) var_dump(intval(curl_init())); // int(6) I need something similar but applied to classes: var_dump(intval(new stdClass())); // int(1) var_dump(intval(new stdClass())); // int(1) var_dump(intval(new stdClass())); // int(1) var_dump(intval(new stdClass())); // int(1) var_dump(intval(new stdClass())); // int(1) I'm using stdClass just has an example here, but as you can see, it's not the output I was hoping for. I just did some more testing and I found that var_dump() can see the instance ID of an object: var_dump($a = new stdClass()); // object(stdClass)#1 (0) { } var_dump($b = new stdClass()); // object(stdClass)#2 (0) { } var_dump($c = new stdClass()); // object(stdClass)#3 (0) { } The same happens with resources of course: var_dump(curl_init()); // resource(2) of type (curl) var_dump(curl_init()); // resource(3) of type (curl) var_dump(curl_init()); // resource(4) of type (curl) Is there any way to achieve the same effect in PHP?

    Read the article

  • Deployment of SQL Server: installing a second instance?

    - by Workshop Alex
    Simple problem. I'm working on a Delphi 2007/WIN32 application which now uses MS Access as simple data store. I have to modify it to support SQL Server Express, which is easy. These modifications are working so the application can be deployed using either SQL Server or MS Access. (Whatever the user prefers.) I did consider deploying the whole application together with the SQL Compact but this is not practicak. Using SQL Server Express 2008 instead of 2005 is an option, but also has a few nasty side-effects which we don't want to resolve for now. The problem is deploying the whole project. The installation with SQL Server would need a quiet installation so the user won't notice it. SQL Server is mentioned in the documentation so they know it's there. We just don't want to bother them with technical issues. In most cases, such an installation will go just fine. But what if the user already has an SQL Server (2005) installation which is used for something else? Personally, I would prefer to just install a second instance of SQL Server on their system so it won't conflict with the other installation. (Thus, if they uninstall the other app, the SQL instance will just stay installed.) While SQL Server 2005 and 2008 can be installed on the same system simply by using two different names for the instance, I wonder if it's also possible to install SQL Server 2005 twice on a single system to get two instances. And if possible, how?

    Read the article

  • kQuery : Trying to find a specific instance of a class by number

    - by mattelliottIT
    I guess I have just hit a mental block with this one; maybe some fresh eyes will help. Basically I have a few instance of the class "menu-item" which when clicked call the click function via jQuery and bring up a video. Instead of giving each on an id as well as a class I am trying to find which instance of the class was clicked (1, 2, 3, etc). Just can't seem to get it though. //click listener for menu-items $('.menu-item').click(function(event) { var o = $('.menu-item'); var count = o.length(); // switch(count) { case 0 : filename == 'letters'; break; case 1 : filename == 'the-gift'; break; } var videoPlayer = '<video controls width="618px">'; videoPlayer += '<source src="_video/' + filename + '.mp4" />'; videoPlayer += '</video>'; //place video $('#videoCont').html(videoPlayer); }); I'm trying to create an array there where each instance of the 'menu-item' is one array item. (btw, for now I am just proofing this with an mp4 filetype before I add in the ogv and webm formats). Thanks for any and all help!

    Read the article

  • BizTalk: Instance Subscription: Details

    - by Leonid Ganeline
    It has interesting behavior and it is not always what we are waiting for. An orchestration can be enlisted with many subscriptions. In other word it can have several Receive shapes. Usually the first Receive uses the Activation subscription but other Receives create the Instance subscriptions. [See “Publish and Subscribe Architecture” in MSDN] Here is a sample process. This orchestration has two receives. It is a typical Sequential Convoy. [See "BizTalk Server 2004 Convoy Deep Dive" in MSDN by Stephen W. Thomas]. Let's experiment started.   There are three typical scenarios. First scenario: everything is OK Activation subscription for the Sample message is created when the orchestration the SampleProcess is enlisted. The Instance subscription is created only when the SampleProcess orchestration instance is started and it is removed when the orchestration instance is ended. So far so good, the Message_2 was delivered exactly in this time interval and was consumed. Second scenario: no consumers Three Sample_2 messages were delivered. One was delivered before the SampleProcess was started and before the instance subscription was created. Second message was delivered in the correct time interval. The third one was delivered after the SampleProcess orchestration was ended and the instance subscription was removed. Note: ·         It was not the first Sample_2 was consumed. It was first in the queue but in was not waiting, it was suspended when it was delivered to the Message Box and didn’t have any subscribers at this moment. The first and the last Sample_2 messages were Suspended (Nonresumable) in the Message Box. For each of this message we have got two (!) service instances associated with this suspended message. One service instance has the ServiceClass of Messaging, and we can see its Error Description:   The second service instance has the ServiceClass of RoutingFailureReport, and we can see its Error Description:   Third scenario: something goes wrong Two Sample_2 messages were delivered. Both were delivered in the same interval when the SampleProcess orchestration was working and the instance subscription was created and was working too. First Sample_2 was consumed. The second Sample_2 has the subscription but the subscriber, the SampleProcess orchestration, will not consume it. After the SampleProcess orchestration is ended (And only after! I will discuss this in the next article.), it is suspended (Nonresumable). In this time only one service instance associated with this kind of scenario is suspended. This service instance has the ServiceClass of Orchestration, and we can see its Error Description: In the Message tab we will see the Sample_2 message in the Suspended (Resumable) status. Note: ·         This behavior looks ambiguous. We see here the orchestration consumes the extra message(s) and gets suspended together with those extra messages. These messages are not consumed in term of “processed by orchestration”. But they are consumed in term of the “delivered to the subscriber”. The receive shape in the orchestration is not received these extra messages. But these messages are routed to the orchestration.     Unified Sequential convoy  Now one more scenario. It is the unified sequential convoy. That means the activation subscription is for the same message type as it for the instance subscription. The Sample_2 message is now the Sample message. For simplicity the SampleProcess orchestration consumes only two Sample messages. Usually the orchestration consumes a lot of messages inside loop, but now it is only two of them. First message starts the orchestration, the second message goes inside this orchestration. Then the next pair of messages follows, and so on. But if the input messages follow in shorter intervals we have got the problem. We lost messages in unpredictable manner. Note: ·         Maybe the better behavior would be if the orchestration removes the instance subscription after the message is consumed, not in the end on the orchestration. Right now it is a “feature” of the BizTalk subscription mechanism.

    Read the article

  • AWS EC2 - How to specify an IAM role for an instance being launched via awscli

    - by Skaperen
    I am using the "aws ec2 run-instances" command (from the awscli package) to launch an instance in AWS EC2. I want to set an IAM role on the instance I am launching. The IAM role is configured and I can use it successfully when launching an instance from the AWS web UI. But when I try to do this using that command, and the "--iam-instance-profile" option, it failed. Doing "aws ec2 run-instances help" shows Arn= and Name= subfields for the value. When I try to look up the Arn using "aws iam list-instance-profiles" it gives this error message: A client error (AccessDenied) occurred: User: arn:aws:sts::xxxxxxxxxxxx:assumed-role/shell/i-15c2766d is not authorized to perform: iam:ListInstanceProfiles on resource: arn:aws:iam::xxxxxxxxxxxx:instance-profile/ (where xxxxxxxxxxxx is my AWS 12-digit account number) I looked up the Arn string via the web UI and used that via "--iam-instance-profile Arn=arn:aws:iam::xxxxxxxxxxxx:instance-profile/shell" on the run-instances command, and that failed with: A client error (UnauthorizedOperation) occurred: You are not authorized to perform this operation. If I leave off the "--iam-instance-profile" option entirely, the instance will launch but it will not have the IAM role setting I need. So the permission seems to have something to do with using "--iam-instance-profile" or accessing IAM data. I repeated several times in case of AWS glitches (they happen sometimes) and no success. I suspected that perhaps there is a restriction that an instance with an IAM role is not allowed to launch an instance with a more powerful IAM role. But in this case, the instance I am doing the command in has the same IAM role that I am trying to use. named "shell" (though I also tried using another one, no luck). Is setting an IAM role not even permitted from an instance (via its IAM role credentials)? Is there some higher IAM role permission needed to use IAM roles, than is needed for just launching a plain instance? Is "--iam-instance-profile" the appropriate way to specify an IAM role? Do I need to use a subset of the Arn string, or format it in some other way? Is it possible to set up an IAM role that can do any IAM role accesses (maybe a "Super Root IAM" ... making up this name)? FYI, everything involves Linux running on the instances. Also, I am running all this from an instance because I could not get these tools installed on my desktop. That and I do not want to put my IAM user credentials on any AWS storage as advised by AWS here. after answered: I did not mention the launching instance permission of "PowerUserAccess" (vs. "AdministratorAccess") because I did not realize additional access was needed at the time the question was asked. I assumed that the IAM role was "information" attached to the launch. But it really is more than that. It is a granting of permission.

    Read the article

  • Refering to javascript instance methods with a pound/hash sign

    - by Josh
    This question is similar to http://stackoverflow.com/questions/736120/why-are-methods-in-ruby-documentation-preceded-by-a-pound-sign I understand why in Ruby instance methods are proceeded with a pound sign, helping to differentiate talking about SomeClass#someMethod from SomeObject.someMethod and allowing rdoc to work. And I understand that the authors of PrototypeJS admire Ruby (with good reason) and so they use the hash mark convention in their documentation. My question is: is this a standard practice amongst JavaScript developers or is it just Prototype developers who do this? Asked another way, is it proepr for me to refer to instance methods in comments/documentation as SomeClass#someMethod? Or should my documentation refer to `SomeClass.someMethod?

    Read the article

  • php Set a anonymous function in an instance

    - by geekay
    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 do is reuse the same spit of code in a great number of different applications, and make it so that I can just 'swap-out' and replace functions in specific instances. I am using php5.3 (so anonymous functions should work, just not in the way that I am using them). Thanks so very much for your time!! -GK

    Read the article

  • Why are my ActiveRecord class instance variables disappearing after the first request in development

    - by Paul C
    I have a class instance variable on one of my AR classes. I set its value at boot with an initializer and, after that, never touch it again except to read from it. In development mode, this value disappears after the first request to the web server. However, when running tests, using the console or running the production server this does not happen. # The AR class class Group < ActiveRecord::Base class << self attr_accessor :path end end # The initializer Group.path = File.join(RAILS_ROOT, "public", "etc") # First request in a view %p= Group.path #=> "/home/rails/app/public/etc" # Second request in a view %p= Group.path #=> nil Is there something about development mode that nukes instance variables from classes with each request? If so, is there a way to disable this for specific variables or classes?

    Read the article

  • Business entity: private instance VS single instance

    - by taoufik
    Suppose my WinForms application has a business entity Order, the entity is used in multiple views, each view handles a different domain or use-case in the application. As an example, one managing orders, the other one digging into one order and displaying additional data. If I'd use nHibernate (or any other ORM) and use one session/dataContext per view (or per db action), I'd end up getting two different instances for the same Order (let's say orderId = 1). Although functionally the same entity, they are technically two different instances. Yes, I could implement Equals/GetHashcode to make them "seem" the same. Why would you go for a single instance per entity vs private instances per view or per use-case? Having single instances has the advantage of sharing INotifyPropertyChanged events, and sharing additional (non-persistent) data. Having a private instance in each view would give you the flexibility of the undo functionality on a view level. In the example above, I'd allow the user to change order details, and give them the flexibility to not save the change. Here, synchronisation between the view/use-case happens on a data persistence level. What would your argument be?

    Read the article

  • Add a child inside a newly created instance, inside of a loop in AS3

    - by HeroicNate
    I am trying to create a gallery where each thumb is housed inside of it's own movie clip that will have more data, but it keeps failing because it won't let me refer to the newly created instance of the movie clip. Below is what I am trying to do. var xml:XML; var xmlReq:URLRequest = new URLRequest("xml.xml"); var xmlLoader:URLLoader = new URLLoader(); var imageLoader:Loader; var vidThumbn:ThumbNail; var next_y:Number = 0; for(var i:int = 0; i < xml.downloads.videos.video.length(); i++) { vidThumbn = new ThumbNail(); imageLoader = new Loader(); imageLoader.load(new URLRequest(xml.downloads.videos.video[i].ThumbnailImage)); vidThumbn.y = next_y; vidThumbn.x = 0; next_y += 117; imageLoader.name = xml.downloads.videos.video[i].Files[0].File.URL; videoBox.thumbList.thumbListHolder.addChild(vidThumbn); videoBox.thumbList.thumbListHolder.vidThumbn.addChild(imageLoader); } It dies every time on that last line. How do I refer to that vidThumbn instance so I can add the imageLoader? I don't know what I'm missing. It feels like it should work.

    Read the article

  • MEF instance management

    - by Lawrence A. Contreras
    I am working on application that has multiple modules and sub modules. Here's what I need to do: ModuleA has a sub module SubModuleA, SubModuleB, SubModuleC. I want to export ModuleA, SubModuleA, SubModuleB, SubModuleC. ModuleA can have multiple instances. Whenever I import ModuleA inside the sub modules, I want to get the correct instance and also when I import SubModuleA,SubModuleB and SubModuleC inside other classes. How can I manage that scenario using MEF? Do I really need to use MEF. Updated: Here's a quick example: public class School { List<Classroom> classRooms { get; set; } } [Export] public class Classroom { List<Teacher> teachers { get; set; } } public class Teacher { List<Student> students { get; set; } } public class Student { [Import] Classroom classroom { get; set; } } As you can see, I want to export the classroom class because I need to import it in the Student class, let's just say that I really need the classroom class inside the student class. I want to skip the part where we pass the classroom to the teacher and from the teacher we'll pass it to the student. But when I import classroom, I want to have the correct instance where that class room contains the teacher of the student.

    Read the article

  • Single Instance Storage layers

    - by Moo
    Hi, I have a data storage requirement which is an excellent candidate for single instance storage and deduplication. Can anyone suggest any .Net compatible libraries or systems which handles SIS and deduplication, either with SQL Server as an actual back end or its own high performance storage engine? What have peoples experiences been with such engines, and are there any pit falls to watch out for? Regards Moo

    Read the article

  • Help: Instance Variables & Properties [iPhone]

    - by Devoted
    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 variable and "@property ..." is a property. But what do these individual things do? I guess what I'm really asking is how the property is used for example in the implementation file (.m)

    Read the article

  • Changing Graphic Instance using ActionScript

    - by Luke Duddridge
    Hi, I was wondering if it is at all possible to change the "Graphic" used in a frame dynamically using actionscript. I was hoping to either change the image the Graphic is an instance of or change the Graphic I am using in the current frame. Cheers Addition: Could I have a layer for each Graphic and then using action script choose which layer shows?

    Read the article

  • Python - Get Instance Variables

    - by Chris Bunch
    Is there a built-in method in Python to get an array of all a class' instance variables? For example, if I have this code: class hi: def __init__(self): self.ii = "foo" self.kk = "bar" Is there a way for me to do this: >>> mystery_method(hi) ["ii", "kk"] Thanks guys! Edit: I originally had asked for class variables erroneously. Thanks to all who brought this to my attention!

    Read the article

  • C# Copying instance variable to local variable in functions of same class

    - by NickLarsen
    I have been looking through some code on an open source project recently and found many occurrences of this kind of code: class SomeClass { private int SomeNumber = 42; public ReturnValue UseSomeNumber(...) { int someNumberCopy = this.SomeNumber; if (someNumberCopy > ...) { // ... do some work with someNumberCopy } else { // ... do something else with someNumberCopy } } } Is there any real benefit to making a copy of the instance variable?

    Read the article

  • how can I get instance from the property.

    - by viky
    In my application I have a class which has properties of user-defined types like this: class MyType { public A MyProperty { get; set; } } class A { .....some methods and proeprties } for some operations that I need to perform from my main program, I create a List of MyProperty whenever creating object of MyType and pass it to my main program and there I perform different operation on these properties which reflects in there instances also. Is there any way by which I could get the object instance for any particular MyProperty from that property in the list.

    Read the article

  • Easiest way to find previous instance of an application

    - by Yogi Yang 007
    I have rewritten a VB6 based application developed in Delphi, which should have only one instance running. How can I do this with minimum of code? In VB6 we just have to use one single line of code If App.PrevInstance Then 'Take some action End If On goggling I did find a solution but it is very length and we have to mess with .drp file. I do not want to do that. I want something simpler.

    Read the article

< Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >