Search Results

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

Page 23/552 | < Previous Page | 19 20 21 22 23 24 25 26 27 28 29 30  | Next Page >

  • iOS5: Confusion with loadview and init and instance variables

    - by user743550
    I'm new to iOS5 and storyboarding. I noticed that if I declare an instance variables inside my viewcontroller .h file and set the values inside my init of .m file of my viewcontroller, whe the view of the viewcontroller is displayed, my instance variables show null inside viewDidLoad. In order for me to get myvariables, I'd need to do [self init] inside viewDidLoad. My questions are: @interface tableViewController : UITableViewController { NSMutableArray *myvariable; } @end @implementation tableViewController -(id)init { myvariable = [[NSMutableArray alloc]initWithObjects:@"Hi2",@"Yo2",@"whatsup2", nil]; } - (void)viewDidLoad { NSLog(@"%@",myvariable); // DISPLAYS NULL [super viewDidLoad]; } Why isn't my variables available in viewdidLoad when I declared and implemented in my .h and .m files? If that's the case, is viewDidLoad or viewWillAppear the common places to load the data for the viewcontroller? It looks like even if you instantiate a viewcontroller, the init function gets called but the viewDidLoad doesn't necessarily have the variables to be displayed. Where's the right place/methods to load the model(data) for my viewcontroller? Thanks in advance

    Read the article

  • ABMultiValueCopyValueAtIndex gives message sent to deallocated instance.

    - by Mohammed Sadiq
    HI , I am getting a issue when trying to access the kABPersonInstantMessageProperty. The code is as follows : ABMultiValueRef IMS = ABRecordCopyValue(record, kABPersonInstantMessageProperty); CFRetain(IMS); if(IMS) { int IMSCount = ABMultiValueGetCount(IMS); MWLOG(5, @"**** IMS COunt **** : %d", IMSCount); for(int iIM =0; iIM < IMSCount; ++iIM) { MWLOG(5, @"index *** : %d", iIM); CFDictionaryRef dict = ABMultiValueCopyValueAtIndex(IMS, iIM); NSString* label = (NSString*)ABMultiValueCopyLabelAtIndex(IMS, iIM); NSString* service= (NSString*)CFDictionaryGetValue(dict, kABPersonInstantMessageServiceKey); NSString* username= (NSString*)CFDictionaryGetValue(dict, kABPersonInstantMessageUsernameKey); if(label) CFRelease(label); if(service) CFRelease(service); if(username) CFRelease(username); if(dict) CFRelease(dict); } CFRelease(IMS); } But I am getting the following error in console : 2010-03-13 12:39:16.731 mwp[1464:4f0b] * -[CFString retain]: message sent to deallocated instance 0x1582820 2010-03-13 12:49:12.219 mwp[1464:4f0b] * -[CFString _cfTypeID]: message sent to deallocated instance 0x15f0bf0 The stacktrace in the debugger is as follows : **#0 0x3026e017 in forwarding #1 0x3024a0a2 in __forwarding_prep_0___ *#2 0x30201368 in CFRetain * #3 0x325bdb6d in ABCCopyDictionaryWithTypes #4 0x325bdbe3 in ABCMultiDictionaryCreateCopy Is that the issue is with the api. I searched in the net but could nt find any solutions. I am getting this issue only in reading the InstantMessageProperty. Any help would be greatly appreciated .... Best Regards, Mohammed Sadiq.

    Read the article

  • New To StructureMap - Getting No Default Instance Error 202

    - by Code Sherpa
    Hi. I am very new to StructureMap and am getting the following error: StructureMap Exception Code: 202 No Default Instance defined for PluginFamily Company.ProjectCore.Core.IUserSession, Company.ProjectCore, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null It seems to be hitting the first interface instance on compile and then throws the above error: private readonly IUserSession _userSession; public SiteMaster() { _userSession = ObjectFactory.GetInstance<IUserSession>(); // ERROR THROWN HERE ... } For what it is worth, I have the PluginFamily reference above all of interfaces: [PluginFamily("Default")] public interface IUserSession Below is my entire StructureMap.config <StructureMap> <Assembly Name="Company.ProjectWeb" /> <Assembly Name="Company.ProjectCore" /> <!-- Use DefaultKey="Default" for standard cache or DefaultKey="MemCached" for memcached cache. --> <PluginFamily Assembly="Company.ProjectCore" Type="Company.ProjectCore.Core.ICache" DefaultKey="MemCached" /> <!-- Use DefaultKey="Default" for sending the email in real time through the configured mail server or use DefaultKey="MailQueue" to send the mail in batches through another process --> <PluginFamily Assembly="Company.ProjectCore" Type="Company.ProjectCore.Core.IEmailService" DefaultKey="MailQueue" /> <!-- Use DefaultKey="Default" for standard cache or DefaultKey="UserSession" for memcached cache. --> <PluginFamily Assembly="Company.ProjectCore" Type="Company.ProjectCore.Core.IUserSession" DefaultKey="UserSession" /> <!-- Use DefaultKey="Default" for standard cache or DefaultKey="Redirector" for memcached cache. --> <PluginFamily Assembly="Company.ProjectCore" Type="Company.ProjectCore.Core.IRedirector" DefaultKey="Redirector" /> <!-- Use DefaultKey="Default" for standard cache or DefaultKey="Navigation" for memcached cache. --> <PluginFamily Assembly="Company.ProjectCore" Type="Company.ProjectCore.Core.INavigation" DefaultKey="Navigation" /> Any suggestions? Thanks.

    Read the article

  • Unable to access a primitive array inside a custom class from a UIViewController instance

    - by Daniel
    Hello! I have made a subclass of NSObject that is meant to be the model of my application. The class has a few methods and on instance primitive array as such: @interface Cube : NSObject { int cubeState[5][2][2]; } - (id)printContent; @end @implementation Cube - (void)init { if (self = [super init]) { for (int i=0; i<=5; i++) { for (int j=0; j<=2; j++) { for (int k=0; k<=2; k++) { cubeState[i][j][k] = i; } } } } return self; } - (void)printContent { for (int i=0; i<=5; i++) { for (int j=0; j<=2; j++) { for (int k=0; k<=2; k++) { NSLog(@"[%d] [%d] [%d] = %d", i, j, k, cubeState[i][j][k]); } } } } @end This works fine if instanciated from the delegate as such: #include "Cube.h" @implementation CubeAppDelegate @synthesize window; - (void)applicationDidFinishLaunching:(UIApplication *)application { Cube *cube = [[Cube alloc] init]; [cube printContent]; [cube release]; [window makeKeyAndVisible]; } However, the application crashes if I try to create a subclass of UIViewController with a Cube *cube property and later try to access the Cube instance object through the view controller's property as such: @interface CustomController : UIViewController { Cube *cube; } @property (nonatomic, retain) Cube *cube; @end @implementation CustomController @synthesize cube; - (void)dealloc { [cube release]; [super dealloc]; } @end and in the delegate: - (void)applicationDidFinishLaunching:(UIApplication *)application { viewController = [[CustomController alloc] initWithNibName:@"MainView" bundle:nil]; viewController.cube = [[[Cube alloc] init] autorelease]; [viewController.cube printContent]; // Application crashes here } Any ideas?

    Read the article

  • Direct3D11 and SharpDX - How to pass a model instance's world matrix as an input to a vertex shader

    - by Nathan Ridley
    Using Direct3D11, I'm trying to pass a matrix into my vertex shader from the instance buffer that is associated with a given model's vertices and I can't seem to construct my InputLayout without throwing an exception. The shader looks like this: cbuffer ConstantBuffer : register(b0) { matrix World; matrix View; matrix Projection; } struct VIn { float4 position: POSITION; matrix instance: INSTANCE; float4 color: COLOR; }; struct VOut { float4 position : SV_POSITION; float4 color : COLOR; }; VOut VShader(VIn input) { VOut output; output.position = mul(input.position, input.instance); output.position = mul(output.position, View); output.position = mul(output.position, Projection); output.color = input.color; return output; } The input layout looks like this: var elements = new[] { new InputElement("POSITION", 0, Format.R32G32B32_Float, 0, 0, InputClassification.PerVertexData, 0), new InputElement("INSTANCE", 0, Format.R32G32B32A32_Float, 0, 0, InputClassification.PerInstanceData, 1), new InputElement("COLOR", 0, Format.R32G32B32A32_Float, 12, 0) }; InputLayout = new InputLayout(device, signature, elements); The buffer initialization looks like this: public ModelDeviceData(Model model, Device device) { Model = model; var vertices = Helpers.CreateBuffer(device, BindFlags.VertexBuffer, model.Vertices); var instances = Helpers.CreateBuffer(device, BindFlags.VertexBuffer, Model.Instances.Select(m => m.WorldMatrix).ToArray()); VerticesBufferBinding = new VertexBufferBinding(vertices, Utilities.SizeOf<ColoredVertex>(), 0); InstancesBufferBinding = new VertexBufferBinding(instances, Utilities.SizeOf<Matrix>(), 0); IndicesBuffer = Helpers.CreateBuffer(device, BindFlags.IndexBuffer, model.Triangles); } The buffer creation helper method looks like this: public static Buffer CreateBuffer<T>(Device device, BindFlags bindFlags, params T[] items) where T : struct { var len = Utilities.SizeOf(items); var stream = new DataStream(len, true, true); foreach (var item in items) stream.Write(item); stream.Position = 0; var buffer = new Buffer(device, stream, len, ResourceUsage.Default, bindFlags, CpuAccessFlags.None, ResourceOptionFlags.None, 0); return buffer; } The line that instantiates the InputLayout object throws this exception: *HRESULT: [0x80070057], Module: [General], ApiCode: [E_INVALIDARG/Invalid Arguments], Message: The parameter is incorrect.* Note that the data for each model instance is simply an instance of SharpDX.Matrix. EDIT Based on Tordin's answer, it sems like I have to modify my code like so: var elements = new[] { new InputElement("POSITION", 0, Format.R32G32B32_Float, 0, 0, InputClassification.PerVertexData, 0), new InputElement("INSTANCE0", 0, Format.R32G32B32A32_Float, 0, 0, InputClassification.PerInstanceData, 1), new InputElement("INSTANCE1", 1, Format.R32G32B32A32_Float, 0, 0, InputClassification.PerInstanceData, 1), new InputElement("INSTANCE2", 2, Format.R32G32B32A32_Float, 0, 0, InputClassification.PerInstanceData, 1), new InputElement("INSTANCE3", 3, Format.R32G32B32A32_Float, 0, 0, InputClassification.PerInstanceData, 1), new InputElement("COLOR", 0, Format.R32G32B32A32_Float, 12, 0) }; and in the shader: struct VIn { float4 position: POSITION; float4 instance0: INSTANCE0; float4 instance1: INSTANCE1; float4 instance2: INSTANCE2; float4 instance3: INSTANCE3; float4 color: COLOR; }; VOut VShader(VIn input) { VOut output; matrix world = { input.instance0, input.instance1, input.instance2, input.instance3 }; output.position = mul(input.position, world); output.position = mul(output.position, View); output.position = mul(output.position, Projection); output.color = input.color; return output; } However I still get an exception.

    Read the article

  • Django Querying Relation of Relation

    - by Brent
    I'm stuck on a Django ORM issue that is bugging me. I have a set of models linked by a foreign key but the requirements are a bit odd. I need to list items by their relation's relation. This is hard to explain so I've tried to depict this below, given: Work ManyToMany(Award) Award ForeignKey(AwardCategory) AwardCategory I need to list work items so they are listed by the award category. Desired output would be: Work Instance A Award Instance A that belongs to Award Category Instance A Award Instance C that belongs to Award Category Instance A Award Instance G that belongs to Award Category Instance A Work Instance A (same instance as above, but listed by different award__category) Award Instance F that belongs to Award Category Instance B Award Instance R that belongs to Award Category Instance B Award Instance Z that belongs to Award Category Instance B Work Instance B Award Instance B that belongs to Award Category Instance A Award Instance A that belongs to Award Category Instance A Essentially I want to list all work by the award category. I can get this to work in part but my solution is filthy and gross. I'm wondering if there is a better way. I considered using a ManyToMany and a through attribute but I'm not certain if I'm utilizing it correctly.

    Read the article

  • Rails, if instance is in a scope?

    - by Joseph Silvashy
    I using rails 3 and I can't seem to check if a given instance is in a scope, see here: p = Post.find 6 +----+----------+-------------------------+-------------------------+-------------------------+-----------+ | id | title | publish_date | created_at | updated_at | published | +----+----------+-------------------------+-------------------------+-------------------------+-----------+ | 6 | asfdfdsa | 2010-03-28 22:33:00 UTC | 2010-03-28 22:33:46 UTC | 2010-03-28 22:33:46 UTC | true | +----+----------+-------------------------+-------------------------+-------------------------+-----------+ I have a menu scope which looks like: scope :menu, where("published != ?", false).limit(4) When I run it I get: Post.menu.all +----+------------------+------------------+------------------+-------------------+-----------+ | id | title | publish_date | created_at | updated_at | published | +----+------------------+------------------+------------------+-------------------+-----------+ | 1 | Lorem ipsum | 2010-03-23 07... | 2010-03-23 07... | 2010-03-28 21:... | true | | 2 | fdasf | 2010-03-28 21... | 2010-03-28 21... | 2010-03-28 21:... | true | | 3 | Ruby’s Imple... | 2010-03-28 21... | 2010-03-28 21... | 2010-03-28 21:... | true | | 4 | dsaD | 2010-03-28 22... | 2010-03-28 22... | 2010-03-28 22:... | true | +----+------------------+------------------+------------------+-------------------+-----------+ Which is correct, but if I try to check if p is in the the menu scope using: Post.menu.exists?(p) I get true when it should be false What is the proper way to find out if a given instance of something is in a scope?

    Read the article

  • Passing an instance variable through RJS?

    - by Elliot
    Hey guys here is my code (roughly): books.html.erb <% @books.each do |book| %> <% @bookid = book.id %> <div id="enter_stuff"> <%= render "input", :bookid => @bookid %> </div> <%end%> _input.html.erb <% @book = Book.find_by_id(@bookid) %> <strong>your book is: <%=h @book.name %></strong> create.rjs page.replace_html :enter_stuff, :partial => 'input', :object => @bookid The problem here is that only create.js doesn't seem to work (though, if instead of passing the partial I passed "..." it does work, so I know its that there are instance variables in the partial that aren't being reset. Any ideas?) So the final question, is how do I pass an instance variable to a partial through the create.rjs file? p.s. I know I will have duplicate div IDs, I'm not worrying about that for now though. Best, Elliot

    Read the article

  • BackgroundWorker and instance variables

    - by Alastair Pitts
    One thing that's always confused me is how a BackgroundWorker seems to have thread-safe access to the instance variables of the surrounding class. Given a basic class: public class BackgroundProcessor { public List<int> Items { get; private set; } public BackgroundProcessor(IEnumerable<int> items) { Items = new List<int>(items); } public void DoWork() { BackgroundWorker worker = new BackgroundWorker(); worker.RunWorkerCompleted += new RunWorkerCompletedEventHandler(worker_RunWorkerCompleted); worker.DoWork += new DoWorkEventHandler(worker_DoWork); worker.RunWorkerAsync(); } void worker_DoWork(object sender, DoWorkEventArgs e) { var processor = new ProcessingClass(); processor.Process(this.Points); //Accessing the instance variable } void worker_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e) { //Stuff goes here } } Am I erroneous in my assumption the the call to processor.Process(this.Points); is a thread-safe call? How don't I get a cross-thread access violation? I'm sure it's obvious, but it always has confused me.

    Read the article

  • ASP.NET application - Error when trying to connect to a SQL Server 2008 instance

    - by Pablo Dami
    Hi everyone! Despite that I’m a regular reader of this great forum, this is my first post on it. I believe that this community can help me with the following problem that I have. I’m trying to publish an ASP.NET website over an IIS 6.0 (Windows 2003 Server), and I have some troubles trying to connect to the database. Curiously, I have installed another ASP.NET website into the same IIS 6.0 with the same properties and security parameters and can connect without problems with the same database. The application that works fine is almost the same that the one that can’t connect with SQL Server (actually is the same but with several modifications). I’ll enumarate some information related to the problem: S.O: Windows 2003 Server SQL Server Engine: SQL Server 2008 SQL Server accept remote connections? Yes. ASP.NET version: 2.0.50727 The connections via TCP/IP are enabled to the SQL Server instance? Yes. The corresponding user that I have in the connection string, actually exists into the database with the “owner” role? Yes. ORM Tool used: nHibernate I get the following error when I try to run the aplication into the browser: Error while establishing a connection to the server. When connecting to SQL Server 2005, this failure may occur because the default settings SQL Server does not allow remote connections. (provider: Shared Memory Provider, error: 40 - Could not open a connection to SQL Server) In order to isolate the problem, I made some test. For example, using the web app that works fine I can connect without any problema with the database that uses the web app that can’t. With this evidence I concluded that the problem is within the web app and not into the SQL Server instance. I also google it my problem but sadly I can't find nothing usefull to solve it. If someone can help me I’ll appreciate that. Thank you so much for your time!

    Read the article

  • Access class instance "name" dynamically in Python

    - by user328317
    In plain english: I am creating class instances dynamically in a for loop, the class then defines a few attributes for the instance. I need to later be able to look up those values in another for loop. Sample code: class A: def init(self, name, attr): self.name=name self.attr=attr names=("a1", "a2", "a3") x=10 for name in names: name=A(name, x) x += 1 ... ... ... for name in names: print name.attr How can I create an identifier for these instances so they can be accessed later on by "name"? I've figured a way to get this by associating "name" with the memory location: class A: instances=[] names=[] def init(self, name, attr): self.name=name self.attr=attr A.instances.append(self) A.names.append(name) names=("a1", "a2", "a3") x=10 for name in names: name=A(name, x) x += 1 ... ... ... for name in names: index=A.names.index(name) print "name: " + name print "att: " + str(A.instances[index].att) This has had me scouring the web for 2 days now, and I have not been able to find an answer. Maybe I don't know how to ask the question properly, or maybe it can't be done (as many other posts seemed to be suggesting). Now this 2nd example works, and for now I will use it. I'm just thinking there has to be an easier way than creating your own makeshift dictionary of index numbers and I'm hoping I didn't waste 2 days looking for an answer that doesn't exist. Anyone have anything? Thanks in advance, Andy Update: A coworker just showed me what he thinks is the simplest way and that is to make an actual dictionary of class instances using the instance "name" as the key.

    Read the article

  • Message sent to deallocated instance which has never been released

    - by Jakub
    Hello, I started dealing with NSOperations and (as usual with concurrency) I'm observing strange behaviour. In my class I've got an instance variable: NSMutableArray *postResultsArray; when one button in the UI is pressed I initialize the array: postResultsArray = [NSMutableArray array]; and setup the operations (together with dependencies). In the operations I create a custom object and try to add to the array: PostResult *result = [[PostResult alloc] initWithServiceName:@"Sth" andResult:someResult]; [self.postResultsArray addObject:result]; and while adding I get: -[CFArray retain]: message sent to deallocated instance 0x3b40c30 which is strange as I don't release the array anywhere in my code (I did, but when the problem started to appear I commented all the release operations to be sure that they are not the case). I also used to have @synchronized section like below: PostResult *result = [[PostResult alloc] initWithServiceName:@"Sth" andResult:someResult]; @synchronized (self.postResultsArray) { [self.postResultsArray addObject:result]; } but the problem was the same (however, the error was for the synchronized operation). Any ideas what I may be doing wrong?

    Read the article

  • "Finding" an object instance of a known class?

    - by Sean C
    My first post here (anywhere for that matter!), re. Cocoa/Obj-C (I'm NOT up to speed on either, please be patient!). I hope I haven't missed the answer already, I did try to find it. I'm an old-school procedural dog (haven't done any programming since the mid 80's, so I probably just can't even learn new tricks), but OOP has my head spinning! My question is: is there any means at all to "discover/find/identify" an instance of an object of a known class, given that some OTHER unknown process instantiated it? eg. somthing that would accomplish this scenario: (id) anObj = [someTarget getMostRecentInstanceOf:[aKnownClass class]]; for that matter, "getAnyInstance" or "getAllInstances" might do the trick too. Background: I'm trying to write a plugin for a commercial application, so much of the heavy lifting is being done by the app, behind the scenes. I have the SDK & header files, I know what class the object is, and what method I need to call (it has only instance methods), I just can't identify the object for targetting. I've spent untold hours and days going over Apples documentation, tutorials and lots of example/sample code on the web (including here at Stack Overflow), and come up empty. Seems that everything requires a known target object to work, and I just don't have one. Since I may not be expressing my problem as clearly as needed, I've put up a web page, with diagram & working sample pages to illustrate: http://www.nulltime.com/svtest/index.html Any help or guidance will be appreciated! Thanks.

    Read the article

  • Javascript Instance Variable Syntax (AJAX page refresh)

    - by Rosarch
    I'm having difficulty with Javascript instance variables. I'm trying to make an easy way to refresh the chat page, looking for new messages. The AJAX call supplies a mid, or the lowest message id to be returned. This allows the call to only ask for the most recent messages, instead of all of them. MessageRefresher.prototype._latest_mid; function MessageRefresher(latest_mid) { this._latest_mid = latest_mid; // it thinks `this` refers to the MessageRefresher object } MessageRefresher.prototype.refresh = function () { refreshMessages(this._latest_mid); // it thinks `this` refers to the window this._latest_mid++; } function refreshMessages(latest_mid) { $.getJSON('API/read_messages', { room_id: $.getUrlVar('key'), mid: latest_mid }, function (messages) { for (var i = 0; i < messages[0].length; i++) { var newChild = sprintf("<li>%s: %s</li>", messages[1][i], messages[0][i]); $("#messages").append(newChild); } }); var messageRefresher = new MessageRefresher(0); setInterval(messageRefresher.refresh, 1000); This results in all the messages being printed out, over and over again. I know it has other bugs, but the main issue I'm trying to work out right now is the use of the instance variable. Or is there another way I should be going about doing this?

    Read the article

  • MemoryStream instance timing help

    - by rod
    Hi All, Is it ok to instance a MemoryStream at the top of my method, do a bunch of stuff to it, and then use it? For instance: public static byte[] TestCode() { MemoryStream m = new MemoryStream(); ... ... whole bunch of stuff in between ... ... //finally using(m) { return m.ToArray(); } } Updated code public static byte[] GetSamplePDF() { using (MemoryStream m = new MemoryStream()) { Document document = new Document(); PdfWriter.GetInstance(document, m); document.Open(); PopulateTheDocument(document); document.Close(); return m.ToArray(); } } private static void PopulateTheDocument(Document document) { Table aTable = new Table(2, 2); aTable.AddCell("0.0"); aTable.AddCell("0.1"); aTable.AddCell("1.0"); aTable.AddCell("1.1"); document.Add(aTable); for (int i = 0; i < 20; i++) { document.Add(new Phrase("Hello World, Hello Sun, Hello Moon, Hello Stars, Hello Sea, Hello Land, Hello People. ")); } } My point was to try to reuse building the byte code. In other words, build up any kind of document and then send it to TestCode() method.

    Read the article

  • nhibernate sessionfactory instance more than once on web service

    - by Manuel
    Hello, i have a web service that use nhibernate. I have a singleton pattern on the repositorry library but on each call the service, it creates a new instance of the session factory wich is very expensive. What can i do? region Atributos /// <summary> /// Session /// </summary> private ISession miSession; /// <summary> /// Session Factory /// </summary> private ISessionFactory miSessionFactory; private Configuration miConfiguration = new Configuration(); private static readonly ILog log = LogManager.GetLogger(typeof(NHibernatePersistencia).Name); private static IRepositorio Repositorio; #endregion #region Constructor private NHibernatePersistencia() { //miConfiguration.Configure("hibernate.cfg.xml"); try { miConfiguration.Configure(); this.miSessionFactory = miConfiguration.BuildSessionFactory(); this.miSession = this.SessionFactory.OpenSession(); log.Debug("Se carga NHibernate"); } catch (Exception ex) { log.Error("No se pudo cargar Nhibernate " + ex.Message); throw ex; } } public static IRepositorio Instancia { get { if (Repositorio == null) { Repositorio = new NHibernatePersistencia(); } return Repositorio; } } #endregion #region Propiedades /// <summary> /// Sesion de NHibernate /// </summary> public ISession Session { get { return miSession.SessionFactory.GetCurrentSession(); } } /// <summary> /// Sesion de NHibernate /// </summary> public ISessionFactory SessionFactory { get { return this.miSessionFactory; } } #endregion In wich way can i create a single instance for all services?

    Read the article

  • Instance of method leaking, iPhone

    - by Wolfert
    The following method shows up as leaking while performing a memory-leaks test with Instruments: - (NSDictionary*) initSigTrkLstWithNiv:(int)pm_SigTrkNiv SigTrkSig:(int)pm_SigTrkSig SigResIdt:(int)pm_SigResIdt SigResVal:(int)pm_SigResVal { NSArray *objectArray; NSArray *keyArray; if (self = [super init]) { self.SigTrkNiv = [NSNumber numberWithInt:pm_SigTrkNiv]; self.SigTrkSig = [NSNumber numberWithInt:pm_SigTrkSig]; self.SigResIdt = [NSNumber numberWithInt:pm_SigResIdt]; self.SigResVal = [NSNumber numberWithInt:pm_SigResVal]; objectArray = [NSArray arrayWithObjects:SigTrkNiv,SigTrkSig,SigResIdt,SigResVal, nil]; keyArray = [NSArray arrayWithObjects:@"SigTrkNiv", @"SigTrkSig", @"SigResIdt", @"SigResVal", nil]; self = [NSDictionary dictionaryWithObjects:objectArray forKeys:keyArray]; } return self; } code that invokes the instance: NSDictionary *lv_SigTrkLst = [[SigTrkLst alloc]initSigTrkLstWithNiv:[[tempDict objectForKey:@"SigTrkNiv"] intValue] SigTrkSig:[[tempDict objectForKey:@"SigTrkSig"] intValue] SigResIdt:[[tempDict objectForKey:@"SigResIdt"] intValue] SigResVal:[[tempDict objectForKey:@"SigResVal"] intValue]]; [[QBDataContainer sharedDataContainer].SigTrkLstArray addObject:lv_SigTrkLst]; [lv_SigTrkLst release]; Instruments informs that 'SigTrkLst' is leaking. Even though I have released the instance? (I know that adding it to the array increments the retainCount by 1 but releasing it twice removes it from the array?)

    Read the article

  • How to proxy calls to the instance of an object

    - by mr.b
    Edit: Changed question title from "Does C# allow method overloading, PHP style (__call)?" - figured out it doesn't have much to do with actual question. Also edited question text. What I want to accomplish is to proxy calls to a an instance of an object methods, so I could log calls to any of its methods. Right now, I have code similar to this: class ProxyClass { static logger; public AnotherClass inner { get; private set; } public ProxyClass() { inner = new AnotherClass(); } } class AnotherClass { public void A() {} public void B() {} public void C() {} // ... } // meanwhile, in happyCodeLandia... ProxyClass pc = new ProxyClass(); pc.inner.A(); // need to write log message like "method A called" pc.inner.B(); // need to write log message like "method B called" // ... So, how can I proxy calls to an object instance in extensible way? Method overloading would be most obvious solution (if it was supported in PHP way). By extensible, meaning that I don't have to modify ProxyClass whenever AnotherClass changes. In my case, AnotherClass can have any number of methods, so it wouldn't be appropriate to overload or wrap all methods to add logging. I am aware that this might not be the best approach for this kind of problem, so if anyone has idea what approach to use, shoot. Thanks!

    Read the article

  • Error 1009 after gotoAndStop - stage instance never gets added

    - by ELambda
    I've been through the forums for hours (days?) searching on 1009 errors, but I remain stumped on this. It seems very mysterious and I would LOVE some help if you have any ideas. I have a single .swf that is 7 frames long - each frame represents a different "page" and you can switch pages through a menu widget in the top right corner. The menu widget calls gotoAndPlay( "frame" ). Everything works fine except when I switch from one particular frame to another. Then, during initialization of the new frame (setting some visible properties on various items, in actionscript), I get the dreaded 1009 error on a specific stage instance, a dynamic text instance i_word. Here's what I've tried so far: made sure the actionscript for the new frame starts with a stop() statement before starting initialization - no dice tried changing i_word into a movie_clip instead of dynamic text, made sure it was exported for actionscript - no difference. (I also have 2 other dynamic text instances on the same page that don't seem to cause a problem) added an ENTER_FRAME listener when the new frame is loaded, in case the problem was a timing issue. Put in a big if statement checking if i_word and other instances are not null before proceeding to initialization. It never enters the if, because i_word NEVER gets added. I added trace statements for all instances that are null, and it is the only one. If I remove all references to i_word in my actionscript, everything else is not null, and things go forward. The text for i_word even shows up on the screen in that case. tried renaming i_word - no dice tried deleting the layer i_word was on and adding a new layer - no dice It feels like there is a serious Gremlin in my flash file somewhere. Or maybe I'm missing something obvious. Let me know if you have any ideas...I'd be so grateful. Thank you! Elambda

    Read the article

  • object references an unsaved transient instance

    - by developer
    Hi, I have 2 tables, user and userprofile, both with almost identical fields. user table references userprofile table by primary key ID. My requirement is that on click of a button I need to dump user table record to userprofile table. Now for a particular user table, if there is a corresponding userprofile entry, I am successfully able to dump the data, but if there is no record in userprofile table then I need to create a new record by dumping all the data. My problem is that I am able to update the data when the record is present in userprofile table, but in the case wherein I have to create a new record I get the below error "object references an unsaved transient instance - save the transient instance before flushing". `<class name="User"> <id name="ID" type="Int32"> <generator class="native" /> </id> <many-to-one name="Pid" class="UserProfile" /> </class>` UserProfile is another table and Pid above references the Primary key ID of UserProfile table.

    Read the article

  • Translate an IQueryable instance to LINQ syntax in a string

    - by James Dunne
    I would like to find out if anyone has existing work surrounding formatting an IQueryable instance back into a LINQ C# syntax inside a string. It'd be a nice-to-have feature for an internal LINQ-to-SQL auditing framework I'm building. Once my framework gets the IQueryable instance from a data repository method, I'd like to output something like: This LINQ query: from ce in db.EiClassEnrollment join c in db.EiCourse on ce.CourseID equals c.CourseID join cl in db.EiClass on ce.ClassID equals cl.ClassID join t in db.EiTerm on ce.TermID equals t.TermID join st in db.EiStaff on cl.Instructor equals st.StaffID where (ce.StudentID == studentID) && (ce.TermID == termID) && (cl.Campus == campusID) select new { ce, cl, t, c, st }; Generates the following LINQ-to-SQL query: DECLARE @p0 int; DECLARE @p1 int; DECLARE @p2 int; SET @p0 = 777; SET @p1 = 778; SET @p2 = 779; SELECT [t0].[ClassEnrollmentID], ..., [t4].[Name] FROM [dbo].[ei_ClassEnrollment] AS [t0] INNER JOIN [dbo].[ei_Course] AS [t1] ON [t0].[CourseID] = [t1].[CourseID] INNER JOIN [dbo].[ei_Class] AS [t2] ON [t0].[ClassID] = [t2].[ClassID] INNER JOIN [dbo].[ei_Term] AS [t3] ON [t0].[TermID] = [t3].[TermID] INNER JOIN [dbo].[ei_Staff] AS [t4] ON [t2].[Instructor] = [t4].[StaffID] WHERE ([t0].[StudentID] = @p0) AND ([t0].[TermID] = @p1) AND ([t2].[Campus] = @p2) I already have the SQL output working as you can see. I just need to find a way to get the IQueryable to translate into a string representing its original LINQ syntax (with an acceptable translation loss). I'm not afraid of writing it myself, but I'd like to see if anyone else has done this first.

    Read the article

  • Flash automatically names objects on stage "instance#"

    - by meowMIX3R
    Hi, I have 2 TLF text boxes already placed on my main stage. In the property inspector window I give these the instance names: "txt1" and "txt2". I am trying to have a single mouseup event, and figure out which text box it occurred on. My document class has the following code: package { import flash.display.Sprite; import flash.events.KeyboardEvent; public class SingleEvent extends Sprite{ public function SingleEvent() { // constructor code root.addEventListener(KeyboardEvent.KEY_UP, textChanged,false,0,true); } private function textChanged(e:KeyboardEvent){ trace(e.target.name); trace(" " + e.target); switch(e.target){ case txt1: trace("txt1 is active"); break; case txt2: trace("txt2 is active"); break; default: break; } } } } Example output is: instance15 [object Sprite] instance21 [object Sprite] Since the objects are already on the stage, I am not sure how to get flash to recognize them as "txt1" and "txt2" instead of "instance#". I tried setting the .name property, but it had no effect. In the publish settings, I have "Automatically declare stage instances" checked. Also, is it possible to have a single change event for multiple slider components? The following never fires: root.addEventListener(SliderEvent.CHANGE, sliderChanged,false,0,true); Thanks for any tips

    Read the article

  • UISplitView: how to access instance?

    - by chpwn
    I have a navigation controller in my left portion of my split view, and in the right portion. But sometimes, for example when an item is tapped, my left side must manually set the view controller on the right side. Where is the best place to store the split view controller instance? Pass it around to each view controller on the left side, like I do with the navigation controller? Store it in my App Delegate and then access it via a property with [[UIApplication sharedApplication] delegate].splitView?

    Read the article

  • iPhone static libraries: How to hide instance variable

    - by Frenzy
    I'm creating a static library to share using the following guide: http://www.amateurinmotion.com/articles/2009/02/08/creating-a-static-library-for-iphone.html In one of the functions, I return a "SomeUIView" which is a subclass of UIView and is defined in the public header, however I don't want to expose the internal instance variable of SomeUIView in the public header. I've tried using categories for a private internal header file for SomeUIView, but I keep running into "Duplicate interface declaration for class 'SomeUIView'". Does anyone know how to do this? Thanks!

    Read the article

< Previous Page | 19 20 21 22 23 24 25 26 27 28 29 30  | Next Page >