Search Results

Search found 1263 results on 51 pages for 'retain'.

Page 43/51 | < Previous Page | 39 40 41 42 43 44 45 46 47 48 49 50  | Next Page >

  • Defined outlets, connected them, they all returns (null)

    - by Tom
    Hi! I'm trying to play with a WebView. I made an outlet: IBOutlet UIWebView *browser; Defined it as a property: @property (nonatomic, retain) IBOutlet UIWebView *browser; Synthethized it: @synthesize browser; Finally, I connected it in Interface Builder, really it is. Then I try to do something with it i.e.: [browser loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:@"http://apple.com"]]]; Or also: Etape *etape = [[Etape alloc] init]; NSString *html = [etape generateHTMLforEtape:[current_etape objectAtIndex:0]]; [browser loadHTMLString:html baseURL:nil]; [etape release]; I get no errors, I tried to Build & Analyse, no notices or warnings or errors.. I've been searching for one whole day, please help me :/ Thanks a lot! EDIT: Here's screenshots of my connections for my WebView: EDIT: That is how I call the view: DetailViewController *dvController = [[DetailViewController alloc] initWithNibName:@"DetailViewController" bundle:[NSBundle mainBundle]]; dvController.workflow_id = parent_id; Etape *etape = [[Etape alloc] init]; dvController.etapes = [etape getEtapes:parent_id]; [etape release]; [self.navigationController pushViewController:dvController animated:YES]; [dvController release];

    Read the article

  • Symfony 1.4 - Don't save a blank password on a executeUpdate action.

    - by Twelve47
    I have a form to edit a UserProfile which is stored in mysql db. Which includes the following custom configuration: public function configure() { $this->widgetSchema['password']=new sfWidgetFormInputPassword(); $this->validatorSchema['password']->setOption('required', false); // you don't need to specify a new password if you are editing a user. } When the user tries to save the executeUpdate method is called to commit the changes. If the password is left blank, the password field is set to '', but I want it to retain the old password instead of overwriting it. What is the best (/most in the symfony ethos) way of doing this? My solution was to override the setter method on the model (which i had done anyway for password encryption), and ignore blank values. public function setPassword( $password ) { if ($password=='') return false; // if password is blank don't save it. return $this->_set('password', UserProfile ::encryptPassword( $password )); } It seems to work fine like this, but is there a better way? If you're wondering I cannot use sfDoctrineGuard for this project as I am dealing with a legacy database, and cannot change the schema.

    Read the article

  • Setting synthesized arrays causing memory leaks using nested arrays

    - by webtoad
    Hello: Why is the following code causing a memory leak in an iPhone App? All of the initted objects below leak, including the arrays, the strings and the numbers. So, I'm thinking it has something to do with the the synthesized array property not releasing the object when I set the property again on the second and subsequent time this piece of code is called. Here is the code: "controller" (below) is my custom view controller class, which I have a reference to, and I am setting with this code snippet: sqlite3_stmt *statement; NSMutableArray *foo_IDs = [[NSMutableArray alloc] init]; NSMutableArray *foo_Names = [[NSMutableArray alloc] init]; NSMutableArray *foo_IDsBySection = [[NSMutableArray alloc] init]; NSMutableArray *foo_NamesBySection = [[NSMutableArray alloc] init]; // Get data: NSString *sql = @"select distinct p.foo_ID, p.foo_Name from foo as p "; if (sqlite3_prepare_v2(...) == SQLITE_OK) { while (sqlite3_step(statement) == SQLITE_ROW) { int p_id; NSString *foo_Name; p_id = sqlite3_column_int(statement, 0); char *str2 = (char *)sqlite3_column_text(statement, 1); foo_Name = [NSString stringWithCString:str2]; [foo_IDs addObject:[NSNumber numberWithInt:p_id]]; [foo_Names addObject:foo_Name]; } sqlite3_finalize(statement); } // Pass the array itself into another array: // (normally there is more than one array in each array) [foo_IDsBySection addObject: foo_IDs]; [foo_NamesBySection addObject: foo_Names]; [foo_IDs release]; [foo_Names release]; // Set some synthesized properties (of type NSArray, nonatomic, // retain) in controller: controller.foo_IDsBySection = foo_IDsBySection; controller.foo_NamesBySection = foo_NamesBySection; [foo_IDsBySection release]; [foo_NamesBySection release]; Thanks for any help!

    Read the article

  • Cocos2d and MPMoviePlayerViewController - NSNotificationCenter not working

    - by digi_0315
    I'm using cocos2d with MPMoviePlayerViewController class, but when I tryed to catch notification status when the movie is finished I got this error: Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[NSCFString movieFinishedCallback]: unrecognized selector sent to instance 0x5d23730' my playVideoController.m are: @implementation PlayVideoViewController +(id) scene{ CCScene *scene = [CCScene node]; CCLayer *layer = [credits node]; [scene addChild: layer]; return scene; } -(id)initWithPath:(NSString *)moviePath{ if ((self = [super init])){ movieURL = [NSURL fileURLWithPath:moviePath]; [movieURL retain]; playerViewController = [[MPMoviePlayerViewController alloc] initWithContentURL:movieURL]; player = [playerViewController moviePlayer]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(movieFinishedCallback) name:MPMoviePlayerPlaybackDidFinishNotification object:player]; [[[CCDirector sharedDirector] openGLView] addSubview:playerViewController.view]; [player play]; } return self; } -(void)movieFinishedCallback{ CCLOG(@"video finished!!"); } in .h: #import <UIKit/UIKit.h> #import "cocos2d.h" #import <MediaPlayer/MediaPlayer.h> @interface PlayVideoViewController : CCLayer { NSURL *movieURL; MPMoviePlayerViewController *playerViewController; MPMoviePlayerController *player; } +(id) scene; @end and I call it in appDelegate.m: - (void) applicationDidFinishLaunching:(UIApplication*)application { CC_DIRECTOR_INIT(); CCDirector *director = [CCDirector sharedDirector]; [director setDeviceOrientation:kCCDeviceOrientationLandscapeLeft]; EAGLView *glView = [director openGLView]; [glView setMultipleTouchEnabled:YES]; [CCTexture2D setDefaultAlphaPixelFormat:kTexture2DPixelFormat_RGBA8888];//kEAGLColorFormatRGBA8 NSString *path = [[NSBundle mainBundle] pathForResource:@"intro" ofType:@"mov" inDirectory:nil]; vi ewController = [[[PlayVideoViewController alloc] initWithPath:path] autorelease]; } what i'm doing wrong? anyone can help me please?? I'm try to solve it since a lot of hours ago but I can't!

    Read the article

  • Does it exist: smart pointer, owned by one object allowing access.

    - by Noah Roberts
    I'm wondering if anyone's run across anything that exists which would fill this need. Object A contains an object B. It wants to provide access to that B to clients through a pointer (maybe there's the option it could be 0, or maybe the clients need to be copiable and yet hold references...whatever). Clients, lets call them object C, would normally, if we're perfect developers, be written carefully so as to not violate the lifetime semantics of any pointer to B they might have...but we're not perfect, in fact we're pretty dumb half the time. So what we want is for object C to have a pointer to object B that is not "shared" ownership but that is smart enough to recognize a situation in which the pointer is no longer valid, such as when object A is destroyed or it destroys object B. Accessing this pointer when it's no longer valid would cause an assertion/exception/whatever. In other words, I wish to share access to data in a safe, clear way but retain the original ownership semantics. Currently, because I've not been able to find any shared pointer in which one of the objects owns it, I've been using shared_ptr in place of having such a thing. But I want clear owneship and shared/weak pointer doesn't really provide that. Would be nice further if this smart pointer could be attached to member variables and not just hold pointers to dynamically allocated memory regions. If it doesn't exist I'm going to make it, so I first want to know if someone's already released something out there that does it. And, BTW, I do realize that things like references and pointers do provide this sort of thing...I'm looking for something smarter.

    Read the article

  • Array passing between classes, gone?

    - by Kenneth
    Hey guys . i have two classes, SelectionScreenTable & GraphView. In the SelectionScreenTable class .h, i declared a NSMutableArray called usagedatas NSMutableArray *usagedatas; } @property (nonatomic, retain) NSMutableArray *usagedatas; In the SelectionScreenTable class.m i remembered to @synthesize. Later on, while processing my methods, i did a NSLog(@"usagedatas count:%i",usagedatas.count); to check whether it has value and it returned 1. so yeah its good up to this point. And in the -(void) dealloc , i remembered to released it . [usagedatas release]; So now comes ME trying to use it in another class. In GraphView.m i imported the "SelectionScreenTable.h". in the -(void)viewDidLoad i did SelectionScreenTable *UD = [SelectionScreenTable alloc]; NSLog(@"GraphView UD.usagedataas.count = :%i",UD.usagedatas.count); it returned 0. Any idea guys?

    Read the article

  • iPhone: Low memory crash...

    - by MacTouch
    Once again I'm hunting memory leaks and other crazy mistakes in my code. :) I have a cache with frequently used files (images, data records etc. with a TTL of about one week and a size limited cache (100MB)). There are sometimes more then 15000 files in a directory. On application exit the cache writes an control file with the current cache size along with other useful information. If the applications crashes for some reason (sh.. happens sometimes) I have in such case to calculate the size of all files on application start to make sure I know the cache size. My app crashes at this point because of low memory and I have no clue why. Memory leak detector does not show any leaks at all. I do not see any too. What's wrong with the code below? Is there any other fast way to calculate the total size of all files within a directory on iPhone? Maybe without to enumerate the whole contents of the directory? The code is executed on the main thread. NSUInteger result = 0; NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; NSDirectoryEnumerator *dirEnum = [[[NSFileManager defaultManager] enumeratorAtPath:path] retain]; int i = 0; while ([dirEnum nextObject]) { NSDictionary *attributes = [dirEnum fileAttributes]; NSNumber* fileSize = [attributes objectForKey:NSFileSize]; result += [fileSize unsignedIntValue]; if (++i % 500 == 0) { // I tried lower values too [pool drain]; } } [dirEnum release]; dirEnum = nil; [pool release]; pool = nil; Thanks, MacTouch

    Read the article

  • objective-c having issues with an NSDictioary object

    - by Mark
    I have a simple iPhone app that Im learning and I want to have an instance variable called urlLists which is an NSDictionary I have declared it like so: @interface MyViewController : UIViewController <UIPickerViewDataSource, UIPickerViewDelegate>{ IBOutlet UIPickerView *pickerView; NSMutableArray *categories; NSDictionary *urlLists; } @property(retain) NSDictionary *urlLists; @end and in the implementation: @implementation MyViewController @synthesize urlLists; ... - (void)viewDidLoad { [super viewDidLoad]; categories = [[NSMutableArray alloc] init]; [categories addObject:@"Sport"]; [categories addObject:@"Entertainment"]; [categories addObject:@"Technology"]; [categories addObject:@"Political"]; NSArray *objects = [NSArray arrayWithObjects:@"value1", @"value2", @"value3", @"value4", nil]; urlLists = [NSDictionary dictionaryWithObjects:objects forKeys:categories]; for (id key in urlLists) { NSLog(@"key: %@, value: %@", key, [urlLists objectForKey:key]); } } ... @end And, this all works up to here. I have added a UIPicker to my app, and when I select one of the items, I want to Log the one picked and its related entry in my dictionary. -(void) pickerView:(UIPickerView *)thePickerView didSelectRow:(NSInteger)row inComponent:(NSInteger) component { for (id key in self.urlLists) { NSLog(@"key: %@, value: %@", key, [urlLists objectForKey:key]); } } but I get the old EXC_BAD_ACCESS error... I know Im missing something small, but what? Thanks

    Read the article

  • Mutually beneficial IP/copyright clauses for contract-based freelance work

    - by Nathan de Vries
    I have a copyright section in the contract I give to my clients stating that I retain copyright on any works produced during my work for them as an independent contractor. This is most definitely not intended to place arbitrary restrictions on my clients, but rather to maintain my ability to decide on how the software I create is licensed and distributed. Almost every project I work on results in at least one part of it being released as open source. Every project I work on makes use of third-party software released in the same fashion, so returning the favour is something I would like to continue doing. Unfortunately, the contract is not so clear when it comes to defining the rights of the client in the use of said software. I mention that the code will be licensed to them, but do not mention specifics about exclusivity, ability to produce derivatives etc. As such, a client has raised concerns about the copyright section of my contract, and has suggested that I reword it such that all copyrights are transferred entirely to the client on final payment for the project. This will almost certainly reduce my ability to distribute the software I have created; I would much prefer to find a more mutually beneficial agreement where both our concerns are appeased. Are there any tried and true approaches to licensing software in this kind of situation? To summarise: I want to maintain the ability to license (parts of) the software under my own terms, independently of my relationship with the client; with some guarantee to the client that no trade-secrets or critical business logic will be shared; giving them the ability to re-use my code in their future projects; but not necessarily letting them sell it (I'm not sure about this, though...what happens if they sell their business and the software along with it?) I realise that everyone's feedback is going to be prefixed with "IANAL", however I appreciate any thoughts you might have on the matter.

    Read the article

  • Detecting when a cell's detail-disclosure button has been clicked (when using a custom cell XIB)

    - by Gloria
    1 if (cell == nil) 2 { 3 [[NSBundle mainBundle] loadNibNamed:@"TVCell" owner:self options:nil]; 4 cell = tvCell; 5 self.tvCell = nil; 6 } There's some code from an Apple example of using your own "custom cell XIB" to create cells in a UITableView. It appears to work... but I think I would do better to actually UNDERSTAND what is being done there. Why isn't line #3 assigning the value TO something? cell = [[NSBundle mainBundle] loadNibNamed:@"TVCell" owner:self options:nil]; (In fact, cell and tvCell aren't being used at all.) Why is line #4 assigning using tvCell when nothing has been put it in at all, yet? Why is line #5 nulling out the tvCell that I need? Why is "@property (nonatomic, assign) IBOutlet UITableViewCell *tvCell;" using assign, not retain? About the only thing I can't get working correctly is when I put a disclosure-button on my custom cell XIB. Is there a way for me to detect when the user has clicked on it? (Hopefully, without using 100s of TAGs.)

    Read the article

  • java web templates across multiple WAR files

    - by Casey
    I have a multi WAR web application that was designed badly. There is a single WAR that is responsible for handling some authorization against a database and defines a standard web page using a jsp taglib. The main WAR basically checks the privileges of the user and than based on that, displays links to the context path of the other deployed WARS. Each of the other deployed WARs includes this custom tag lib. I am working on redesigning this application, and one of the nice things that I want to retain is that we have other project teams that have developed these WAR modules that "plug into" our current system to take advantage of other things we have to offer. I am not entirely sure how to handle the page templates though. I need a templating system that would be easy enough to use across multiple wars (I was thinking of jsp fragments??). I really only need to define a consistent header and main navigation section. Whatever else is displayed on the page is up to the individual web project. Any suggestions? I hope that this is clear, if not I can elaborate more.

    Read the article

  • Elegant and 'correct' multiton implementation in Objective C?

    - by submachine
    Would you call this implementation of a multiton in objective-c 'elegant'? I have programmatically 'disallowed' use of alloc and allocWithZone: because the decision to allocate or not allocate memory needs to be done based on a key. I know for sure that I need to work with only two instances, so I'm using 'switch-case' instead of a map. #import "Multiton.h" static Multiton *firstInstance = nil; static Multiton *secondInstance = nil; @implementation Multiton + (Multiton *) sharedInstanceForDirection:(char)direction { return [[self allocWithKey:direction] init]; } + (id) allocWithKey:(char)key { return [self allocWithZone:nil andKey:key]; } + (id)allocWithZone:(NSZone *)zone andKey:(char)key { Multiton **sharedInstance; @synchronized(self) { switch (key) { case KEY_1: sharedInstance = &firstInstance; break; case KEY_2: sharedInstance = &secondInstance; break; default: [NSException raise:NSInvalidArgumentException format:@"Invalid key"]; break; } if (*sharedInstance == nil) *sharedInstance = [super allocWithZone:zone]; } return *sharedInstance; } + (id) allocWithZone:(NSZone *)zone { //Do not allow use of alloc and allocWithZone [NSException raise:NSObjectInaccessibleException format:@"Use allocWithZone:andKey: or allocWithKey:"]; return nil; } - (id) copyWithZone:(NSZone *)zone { return self; } - (id) retain { return self; } - (unsigned) retainCount { return NSUIntegerMax; } - (void) release { return; } - (id) autorelease { return self; } - (id) init { [super init]; return self; } PS: I've not tried out if this works as yet, but its compiling cleanly :)

    Read the article

  • perl regular expressions substitution/replacement using variables with special characters

    - by user961627
    Okay I've checked previous similar questions and I've been juggling with different variations of quotemeta but something's still not right. I have a line with a word ID and two words - the first is the wrong word, the second is right. And I'm using a regex to replace the wrong word with the right one. $line = "ANN20021015_0104_XML_16_21 A$xAS A$xASA"; @splits = split("\t",$line); $wrong_word = quotemeta $splits[1]; $right_word = quotemeta $splits[2]; print $right_word."\n"; print $wrong_word."\n"; $line =~ s/$wrong_word\t/$right_word\t/g; print $line; What's wrong with what I'm doing? Edit The problem is that I'm unable to retain the complete words - they get chopped off at the special characters. This code works perfectly fine for words without special characters. The output I need for the above example is: ANN20021015_0104_XML_16_21 A$xASA A$xASA But what I get is ANN20021015_0104_XML_16_21 A A Because of the $ character.

    Read the article

  • Entity Framework Validation & usage

    - by kmsellers
    I'm aware there is an AssociationChanged event, however, this event fires after the association is made. There is no AssociationChanging event. So, if I want to throw an exception for some validation reason, how do I do this and get back to my original value? Also, I would like to default values for my entity based on information from other entities but do this only when I know the entitiy is instanced for insertion into the database. How do I tell the difference between that and the object getting instanced because it is about to be populated based on existing data? Am I supposed to know? Is that considiered business logic that should be outside of my entity business logic? If that's the case, then should I be designing controller classes to wrap all these entities? My concern is that if I deliver back an entity, I want the client to get access to the properties, but I want to retain tight control over validations on how they are set, defaulted, etc. Every example I've seen references context, which is outside of my enity partial class validation, right? BTW, I looked at the EFPocoAdapter and for the life of me cannot determine how to populate lists of from within my POCO class... anyone know how I get to the context from a EFPoco Class?

    Read the article

  • Stil facing the problem in Orientation in iphone

    - by aman-gupta
    Hi, In my application I have 15 screens in that i m using UIViewController for all screens and in all screens i m using the below way to call other screen :- AppDelegate *appRefre = (AppDelegate *)[[UIApplication sharedApplication]delegate]; [self.navigationController pushViewController:appRefre.frmReferencesLink animated:YES]; And the below code is activated in all screen for orientation to control the user to switch from one orientation to other mode (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { if (interfaceOrientation == UIInterfaceOrientationPortrait) { return YES; } else { return NO; } } But when i run my application in iPhone device my application gets terminated when i physically rotate my iphone device from UIInterfaceOrientationPortrait to UIInterfaceOrientationPortraitUpsideDown or UIInterfaceOrientationLandscapeLeft,UIInterfaceOrientationLandscapeRight. And One more things is that when my application lauch i used following code for launching my appliaction :- 1) I made a pointer in mydelegate.h file: UINavigationController *navigationController; Then synthesize its property @property(nonatomic,retain)UINavigationController *navigationController 2) In mydelegat.m I Wrote @synthesize navigationController; (void)applicationDidFinishLaunching:(UIApplication *)application { navigationController = [[UINavigationController alloc] initWithRootViewController:DefaultViewLink]; [window addSubview:navigationController.view]; [window makeKeyAndVisible]; } 3) In above point DefaultView is launch first and gets remove from view and then actual my appliaction come into picture. So exactly what i want i want my appliaction to be in portrait mode for all screens i dont want my appliaction will switch to other mode.It remains the same as in portrait mode after rotation to any other mode. Please help me out its very urgent. Thanks in Advance and humble request to help me out

    Read the article

  • UITableViewRowAnimationBottom doesn't work for last row

    - by GendoIkari
    I've come across a very similar question here: Inserting row to end of table with UITableViewRowAnimationBottom doesn't animate., though no answers have been given. His code was also a little different than mine. I have an extremely simple example, built from the Navigation application template. NSMutableArray *items; - (void)viewDidLoad { [super viewDidLoad]; items = [[NSMutableArray array] retain]; self.navigationItem.rightBarButtonItem = [[[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemAdd target:self action:@selector(addItem)] autorelease]; } - (void)addItem{ [items insertObject:@"new" atIndex:0]; [self.tableView insertRowsAtIndexPaths:[NSArray arrayWithObject:[NSIndexPath indexPathForRow:0 inSection:0]] withRowAnimation:UITableViewRowAnimationBottom]; } - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { return items.count; } - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *CellIdentifier = @"Cell"; UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; if (cell == nil) { cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease]; } cell.textLabel.text = [items objectAtIndex:indexPath.row]; return cell; } - (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath { if (editingStyle == UITableViewCellEditingStyleDelete) { [items removeObjectAtIndex:indexPath.row]; [tableView deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:UITableViewRowAnimationBottom]; } } The problem is, when I either insert or delete the very last row in the table, the animation doesn't work at all; the row just appears or disappears instantly. This only happens with UITableViewRowAnimationBottom, but that's the animation that makes the most sense for creating or deleting table cells in this way. Is this a bug in Apple's framework? Or does it do this on purpose? Would it make sense to add an extra cell to the count, and then setup this cell so that it looks like it's not there at all, just to get around this behavior?

    Read the article

  • Added CAGradientLayer, getting this in my UIView dealloc: [CALayer release]: message sent to deallocated instance

    - by developerdoug
    Here there, I have a custom UIView. This view acts as a activity indicator but as label above the UIActivityIndicatorView. In the init, I add a CAGradientLayer. I allocate and initialize it and insert it at index 0 as a sublayer of the UIView layer property. In my dealloc method was called, I received a message in the console: - [CALayer release]: message sent to deallocated instance. My code: @interface LabelActivityIndicatorView () { UILabel *_label; UIActivityIndicatorView *_activityIndicatorView; CAGradientLayer *_gradientLayer; } @end @implementation LabelActivityIndicatorView //dealloc - (void) dealloc { [_label release]; [_activityIndicatorView release]; //even tried to remove the layer [_gradientLayer removeFromSuperLayer]; [_gradientLayer release]; [super dealloc]; } // init - (id) initWithFrame:(CGRect)frame { if ( (self = [super initWithFrame:frame]) ) { // init the label // init the gradient layer _gradientLayer = [[CAGradientLayer alloc] init]; [_gradientLayer setBounds:[self bounds]]; [_gradientLayer setPosition:CGPointMake(frame.size.width/2, frame.size.height/2)]; [[self layer] insertSublayer:_gradientLayer atIndex:0]; [[self layer] setNeedsDisplay]; } return self; } @end Anyone have any ideas. Since I'm allocating and initializing the gradient layer I'm responsible for releasing it. I should be able to alloc and init and assign to some ivar. Perhaps I should create a property with retain on it. Thanks,

    Read the article

  • ccfollow actions in cocos2d

    - by Srinivas
    ccfollow actions is following my projectile correctly. when, double tap recognised. see the below code. were am mistaken. here is my code:- - (void)update:(ccTime)dt { if (numTaps==1 ) { [self runAction:[CCFollow actionWithTarget:nextProjectile worldBoundary:CGRectMake(0,0,1050,350)]]; } } - (void)ccTouchesEnded:(NSSet *)touches withEvent:(UIEvent *)event { numTaps = [[touches anyObject] tapCount]; printf("Tapcount : %d",numTaps); if (numTaps ==1) { nextProjectile = [[CCSprite spriteWithFile:@"Weapon.png"] retain]; nextProjectile.position = ccp(nextprojectile .contentSize.width/2+65, nextprojectile.contentSize.height/2+70); [nextProjectile runAction:[CCSequence actions: [here's my nextprojectile actions],nil]]; } } after seen the above code. a question raised by you. why am mentioning the ccfollow action in if condition. answer is here, ordinarily, am mention in update function it will not works, when i set this if condition it works after double tap recognised. how to rectify this issue? any help would be highly appreciated.

    Read the article

  • Passing bundle to activity set as singletask

    - by Falmarri
    So I have a MapActivity that runs an asynchtask that occasionally updates what exactly it's displaying on the map (via a string). I originally pass this string in from the intent when the activity is first created. And then if you click on one of the drawables on the map, it opens a new activity, which can then create a new mapview (same class) with a different string setting. The problem I have is that I only want one instance of the mapview to be running at once. Thus I set android:launchmode="singletask" in the manifest. This works in that it brings the mapactivity to the front, but is there any way to send it a new intent bundle to get a new setting for the string it needs? I tried regetting the extras from the bundle, but it seems to retain the old bundle, not the new intent that was passed to it. I'm not sure I want to do startActivityForResult because the 2nd activity may or may not want to update the original activity. I hope that made sense. I can post code if necessary, but I think that should explain my situation.

    Read the article

  • ViewController doesn't get released

    - by ObjectiveFlash
    Every time I turn the page in my app, I am removing and releasing the previous viewController - but for some reason it is still in memory. I know this, because after using the app for a while, I get 47 memory warnings - one from each view controller - if I had opened 47 pages before the memory warning occurred. I get 60 memory warnings if I had opened 60 pages before the memory warning occurred. And so on... This is the code that runs from page to page: UIViewController *nextController; Class nextClass = [pageClasses objectAtIndex:(currentPageIndex - 1)]; nextController = [[nextClass alloc] initWithNibName:[pageNibs objectAtIndex:(currentPageIndex - 1)] bundle:nil]; [nextController performSelector:@selector(setDelegate:) withObject:self]; [currentPageController.view removeFromSuperview]; [self.view addSubview:nextController.view]; [currentPageController release]; currentPageController = nextController; [currentPageController retain]; [nextController release]; Can anybody point to any issues they see? Thanks so much!

    Read the article

  • Editable, growable DataGrid that retains values on postback and updates underlying DataTable

    - by jlstrecker
    I'm trying to create an ASP.NET/C# page that allows the user to edit a table of data, add rows to it, and save the data back to the database. For the table of data, I'm using a DataGrid whose cells contain TextBoxes or CheckBoxes. I have a button for adding rows (which works) and a button for saving the data. However, I'm quite stuck on two things: The TextBoxes and CheckBoxes should retain their values on postback. So if the user edits a TextBox and clicks the button to add more rows, the edits should be retained when the page reloads. However, the edits should not be saved to the database at this point. When the user clicks the save button, or anytime before, the DataTable underlying the DataGrid needs to be updated with the values of the TextBoxes and CheckBoxes so that the DataTable can be sent to the database. I have a method that does this, but I can't figure out when to call it. Any help getting this to work, or suggestions of alternative user interfaces that would behave similarly, would be appreciated.

    Read the article

  • EXC_BAD_ACCESS in NSURLConnection: how to debug?

    - by baswell
    I have an iPhone app that downloads URLs. (PDFs to display) Easy: self.conn = [NSURLConnection connectionWithRequest:self.request delegate:self]; where self.conn is a retained property. For specific URLs, this throws EXC_BAD_ACCESS. The URL is valid and is constructed in the same way as URLs that do work. (90% of URLs are fine) These ones work: http://www.airservicesaustralia.com/publications/current/ersa/FAC_YARG_11-Mar-2010.pdf http://www.airservicesaustralia.com/publications/current/ersa/FAC_YARK_11-Mar-2010.pdf These don't: http://www.airservicesaustralia.com/publications/current/ersa/FAC_YAMK_11-Mar-2010.pdf http://www.airservicesaustralia.com/publications/current/ersa/FAC_YATN_11-Mar-2010.pdf Spot the difference? Yeah, me neither. Also no difference in response headers from the server for them. To clarify, the ones that work ALWAYS work, the ones that don't NEVER work. So not some random release/retain issue it seems. For the ones that don't work, none of the methods in my delegate are ever called, it fails hard before that. And with no error message, just EXC_BAD_ACCESS. Sooo.... Any way to debug what is going on inside NSURLConnection?

    Read the article

  • Process a set of files from a source directory to a destination directory in Python

    - by Spoike
    Being completely new in python I'm trying to run a command over a set of files in python. The command requires both source and destination file (I'm actually using imagemagick convert as in the example below). I can supply both source and destination directories, however I can't figure out how to easily retain the directory structure from the source to the destination directory. E.g. say the srcdir contains the following: srcdir/ file1 file3 dir1/ file1 file2 Then I want the program to create the following destination files on destdir: destdir/file1, destdir/file3, destdir/dir1/file1 and destdir/dir1/file2 So far this is what I came up with: import os from subprocess import call srcdir = os.curdir # just use the current directory destdir = 'path/to/destination' for root, dirs, files in os.walk(srcdir): for filename in files: sourceFile = os.path.join(root, filename) destFile = '???' cmd = "convert %s -resize 50%% %s" % (sourceFile, destFile) call(cmd, shell=True) The walk method doesn't directly provide what directory the file is under srcdir other than concatenating the root directory string with the file name. Is there some easy way to get the destination file, or do I have to do some string manipulation in order to do this?

    Read the article

  • Keeping Linq to SQL alive when using ViewModels (ASP.NET MVC)

    - by Kohan
    I have recently started using custom ViewModels (For example, CustomerViewModel) public class CustomerViewModel { public IList<Customer> Customers{ get; set; } public int ProductId{ get; set; } public CustomerViewModel(IList<Customer> customers, int productId) { this.Customers= customers; this.ProductId= productId; } public CustomerViewModel() { } } ... and am now passing them to my view instead of the Entities themselves (for example, var Custs = repository.getAllCusts(id) ) as it seems good practice to do so. The problem i have encountered is that when using ViewModels; by the time it has got to the the view i have lost the ability to lazy load on customers. I do not believe this was the case before using them. Is it possible to retain the ability of Lazy Loading while still using ViewModels? Or do i have to eager load using this method? Thanks, Kohan.

    Read the article

  • How can I get the Twitter following and follower Email id and MobileNo in the iPhone sdk Using MGTwitterEngine?

    - by user1808090
    I'm unable to get the Twitter following and Followers Email id and MobileNo i am using below code for that using below code i am able to get only Twitter following name and Id Please help? if([[NSUserDefaults standardUserDefaults] valueForKey:@"UseridLoop"]==nil) { urlString = [NSString stringWithFormat:@"https://api.twitter.com/1/friends/ids.json?cursor=-1&user_id=%@",[[NSUserDefaults standardUserDefaults] valueForKey:@"Userid"]]; } else { urlString = [NSString stringWithFormat:@"https://api.twitter.com/1/followers/ids.json?cursor=-1&user_id=%@",[[NSUserDefaults standardUserDefaults] valueForKey:@"UseridLoop"]]; } NSURLRequest *notificationRequest = [NSURLRequest requestWithURL:[NSURL URLWithString:urlString]]; NSHTTPURLResponse *response; NSError *error; NSData *responData; responData = [NSURLConnection sendSynchronousRequest:notificationRequest returningResponse:&response error:&error]; NSLog(@"%@",responData); NSString *dataString = [[NSString alloc] initWithData:responData encoding:NSUTF8StringEncoding]; // NSDictionary *dict = [[NSDictionary alloc] initWithDictionary:(NSDictionary *)[dataString JSONValue]]; // // NSMutableDictionary *globalCelebDict=[[NSMutableDictionary alloc]initWithDictionary:(NSMutableDictionary *)[dataString JSONValue ] ]; // //NSMutableDictionary *globalCelebDictNext=[[NSMutableDictionary alloc]initWithDictionary:(NSMutableDictionary *)[[ globalCelebDict objectForKey:@"GetGroupDetailsResult"] JSONValue]]; // NSLog(@"dict %@",dict); SBJSON *json = [[SBJSON alloc] init]; NSMutableDictionary *customDetailDict=[[NSMutableDictionary alloc]init]; customDetailDict=[json objectWithString:dataString error:&error]; // NSDictionary *customDetailDict = [json objectWithString:dataString error:&error]; NSLog(@"%@",customDetailDict); if (customDetailDict!=nil) { array=[[customDetailDict objectForKey:@"ids"]retain]; NSLog(@"%@",array); NSLog(@"%d",[array count]); [[NSUserDefaults standardUserDefaults]removeObjectForKey:@"UseridLoop"]; NSLog(@"%@",[[NSUserDefaults standardUserDefaults]valueForKey:@"UseridLoop"]); } }

    Read the article

< Previous Page | 39 40 41 42 43 44 45 46 47 48 49 50  | Next Page >