Search Results

Search found 9025 results on 361 pages for 'quad core'.

Page 59/361 | < Previous Page | 55 56 57 58 59 60 61 62 63 64 65 66  | Next Page >

  • Altering ManagedObjects In NSArray

    - by Garry
    I have an entity called 'Job' with two boolean attributes named 'completed' and 'logged'. I am trying to retrieve all completed jobs that have not been logged at app start-up and change them to logged. I'm able to get all the completed but unlogged jobs with this fetchRequest: NSPredicate *predicate = [NSPredicate predicateWithFormat:@"(completed == %@ && logged == %@)", [NSNumber numberWithBool:YES], [NSNumber numberWithBool:NO]]; I'm then assigning this predicate to a fetchRequest and calling the [managedObjectContext executeFetchRequest:fetchRequest] method to get an array of all Job entities that meet this criteria. This seems to work fine and is returning the correct number of jobs. What I've been trying to do is loop through the NSArray returned, set the logged attribute to YES and then save. This seems to complete and doesn't return any errors but the changes are not persisted when the application quits. Where am I going wrong? [fetchRequest setPredicate:predicate]; NSError error; NSArray jobsToLog = [managedObjectContext executeFetchRequest:fetchRequest error:&error]; if ([jobsToLog count] > 0) { for (int i = 0; i < [jobsToLog count] - 1; i++) { [[jobsToLog objectAtIndex:i] setLogged:[NSNumber numberWithBool:YES]]; // Commit the changes made to disk error = nil; if (![managedObjectContext save:&error]) { // An error occurred } } } Thanks in anticipation,

    Read the article

  • Tableview with sections managed by fetched results controller

    - by Matthes
    Hi, I'm quite new to CoreData and need help with one issue. I have tableview which simply lists cities stored in SQLite db. City is defined by "cityId" and "name" attributes. Data are fetched using NSFetchedResultsController and everything works fine except that I can't figure out how to make FetchedResultsController to group cities by first letter of city names. When I supply "name" for sectionNameKeyPath argument of initWithFetchRequest:managedObjectContext:sectionNameKeyPath:cacheName: method, it creates section for each city, which is obviously something I don't want. I can't figure out how to create an expression which would make it work in way I need. thanks for any tips and/or advices on this Matthes

    Read the article

  • Getting invalid context errors

    - by Andrew
    I don't have much code thus far, only this to start: UIGraphicsBeginImageContextWithOptions(bounds.size, NO, 0); CGContextRef context = UIGraphicsGetCurrentContext(); CGMutablePathRef outerPath; CGMutablePathRef highlightPath; CGRect outerRect = rectForRectWithInset(bounds, 1); CGRect highlightRect = CGRectMake(outerRect.origin.x, outerRect.origin.y + 1, outerRect.size.width, outerRect.size.height); And then the problematic bit, which when commented out, the error goes away: CGContextSaveGState(context); CGContextAddPath(context, highlightPath); CGContextSetFillColorWithColor(context, [[UIColor colorWithWhite:1.0 alpha:0.05]CGColor]); CGContextFillPath(context); CGContextRestoreGState(context); Below that is simply: UIImage *image = UIGraphicsGetImageFromCurrentImageContext(); UIGraphicsEndImageContext();

    Read the article

  • NSContextManagedObject - Problem Accessing it

    - by Jacob
    I have tab bar navigation application and The problem is that in my root controller I am able to set its NSContextManagedObject to the app delegates...However when I try to do the same on the other controller the application freezes... This only happens in the ViewDidLoad but thats where I need to set it so I can fetch the data

    Read the article

  • Building a NSPredicate for a filter

    - by John
    Hi, Just wondering what the best way to build a NSPredicate is if some filters are optional? This is basically for a filter, so if some options aren't selected I don't to filter by them eg. If I have option1 and option2 set for the filter. NSPredicate* predicate = [NSPredicate predicateWithFormat:@"option1 = %@ AND option2 = %@] .... otherwise if just option1 NSPredicate* predicate = [NSPredicate predicateWithFormat:@"option1 = %@] .... The key being there are 10 different options to filter, so I don't want to have to code for the 10x10 possible combinations. Thanks

    Read the article

  • How to use AFIncrementalStore to binding with a NSManagedObject

    - by Matrosov Alexander
    I am searching for more information on how to use AFIncrementalStore. I need to know how to implement it step by step. Please don't down vote it, because of many resources, I really need help with this. If I understood right AFIncrementalStore it is a layer for fetching data from the server and for the mapping data model. Am I right? So I have few URL that I need to mapping into my local model. All of them use GET requests. For example base_url/api/categories I get this string in response: [{"category":{"name":"3d max","id":"1111001","users":[]}}, {"category":{"name":"photoshop","id":"1111002","users":[]}}, {"category":{"name":"auto cad","id":"1111003","users":[]}}] So I have a question how I can binding my local db with this data using AFIncrementalStore. Also if you can see there are relationships in the response string that are connected to uses. The array for users will contain id that is correspond to concert users. So I think second question is how to point that model has to have relationship.

    Read the article

  • Securing Coredata objects

    - by Abraham Durairaj
    I am working on an application which has got some sensitive information. I am aware that it would be difficult for a layman to hack into iphone to get the information. If I use SQLite directly I have something called SQLite Cipher to encrypt / encode the database. Is there anyway where I can have the same way of encrypting the coredata so it makes it hard for hackers to get into the data. Can someone shed some light on this? Thanks in Advance

    Read the article

  • How to access the private variables of a class in its subclass?

    - by giri
    This is a question I was asked in an interview: I have class A with private members and Class B extends A. I know private members of a class cannot be accessed, but the question is: I need to access private members of class A from class B, rather than create variables with the same value in class B. I hope I am clear with this question. Thanks.

    Read the article

  • How to get address the object of an related entity with CoreData ?

    - by eemceebee
    Hi Ok, after I ran into a dead end modifieing an existing Apple example for CoreData, I started completely new creating my own project and that worked fine,..... until I tried to access a related entity. So here is what I did. I created 2 entities, where one is just the detail information of the other one, so there is a one-2-one relationship. Entity #1, Stocks: name value details -- relationship to Entity #2 Entity #2, StockDetails: bank published stock -- relationship to Entity #1 Now, I created the "Managed Object Class" for both of the Entities. Then I created a few lines to put some data into it NSManagedObjectContext *context = [self managedObjectContext]; Stocks *stockinfo= [NSEntityDescription insertNewObjectForEntityForName:@"Stocks" inManagedObjectContext:context]; stockinfo.name = @"Apple"; stockinfo.value = [NSNumber numberWithInt:200]; StockDetails *thestockdetails = [NSEntityDescription insertNewObjectForEntityForName:@"StockDetails" inManagedObjectContext:context]; thestockdetails.bank = @"Bank of America"; thestockdetails.published = [NSDate date]; thestockdetails.stock = stocks_; stockinfo.details = thestockdetails ; NSError *error; if (![context save:&error]) { NSLog(@"A Problem occured, couldn't save: %@", [error localizedDescription]); } Just want to mention here, that I do not get an error with this. Next I put everything into a UITableViewController for a preview and another for a detail view. The preview just shows infos form Entity #1 (Stocks) and when selected it shows the detail view. Now here I also display the infos form Entity #1 (Stocks) but I want to show the Entity #2 (StockDetails) aswell. This is how I try to access the data : StockDetails *details_ = [stockinfo details]; And this gives me a EXC_BAD_ACCESS. So any idea what I am doing wrong here ? Thanks

    Read the article

  • [CA_COLOR_OPAQUE] things that make a layer non-opaque. scaled CAGradientLayer?

    - by mahal tertin
    i spent some time with the environment variable CA_COLOR_OPAQUE = 1 and have my findings to share. things that make a CALayer non-opaque (slow, more memory, ...): * contents with alpha (like an NSImage with an icon) * NSImage/CGImage from a pdf as contents (even when the pdf does not contain any alpha and opaque=YES) * backgroundColor = nil * CATextLayer with text in a (because it is contents with alpha) * rounded corners? maybe/sometimes * masksToBounds? not necessarily as we scale most of tree with CATransform3DScale on sublayerTransform i found also these rather irritating non-opaque: * CAGradientLayer that is somewhere down in this scaled tree (even when set all the gradient colors without alpha) * edgeAntialiasingMask != 0 of a layer that is somewhere down in this scaled tree the last two do not make sense to me. why should it be non opaque? what do i see? if anyone has any thoughts on these findings, i'm happy to learn as i couldn't find such a list yet.

    Read the article

  • iPhone - Change entity class (NSManagedObject) to make them initializable

    - by ncohen
    Hi everyone, I would like to use my custom NSManagedObject like a normal object (as well as its regular functions). Is it possible to modify the class in order to be able to initialize it like a normal object? [[myManagedObject alloc] init]; Thanks edit: to clarify the question, will it screw everything up if I change the @dynamic with @synthesize in the implementation?

    Read the article

  • Is it good choice to move a Sublayer around a view using UIPanGestureRecognizer?

    - by Pranjal Bikash Das
    I have a CALayer and as sublayer to this CALayer i have added an imageLayer which contains an image of resolution 276x183. I added a UIPanGestureRecognizer to the main view and calculation the coordinates of the CALayer as follows: - (void)panned:(UIPanGestureRecognizer *)sender{ subLayer.frame=CGRectMake([sender locationInView:self.view].x-138, [sender locationInView:self.view].y-92, 276, 183); } in viedDidLoad i have: subLayer.backgroundColor=[UIColor whiteColor].CGColor; subLayer.frame=CGRectMake(22, 33, 276, 183); imageLayer.contents=(id)[UIImage imageNamed:@"A.jpg"].CGImage; imageLayer.frame=subLayer.bounds; imageLayer.masksToBounds=YES; imageLayer.cornerRadius=15.0; subLayer.shadowColor=[UIColor blackColor].CGColor; subLayer.cornerRadius=15.0; subLayer.shadowOpacity=0.8; subLayer.shadowOffset=CGSizeMake(0, 3); [subLayer addSublayer:imageLayer]; [self.view.layer addSublayer:subLayer]; It is giving desired output but a bit slow in the simulator. I have not yet tested it in Device. so my question is - Is it OK to move a CALayer containing an image??

    Read the article

  • NSFetchedResultsController didn't return data

    - by Dmitry Kochkin
    Hello! I get stuck in some problem and after 2 days of seeking I've found solution but didn't get idea why does it work. First, I'm initialized NSFetchedResultsController using following code (it look like a lot of automatically generated): - (NSFetchedResultsController *)fetchedResultsController { if (fetchedResultsController != nil) return fetchedResultsController; NSFetchRequest *fetchRequest = [[NSFetchRequest alloc] init]; NSEntityDescription *entity = [NSEntityDescription entityForName:@"Profile" inManagedObjectContext:self.managedObjectContext]; [fetchRequest setEntity:entity]; [fetchRequest setFetchBatchSize:20]; NSSortDescriptor *sortDescriptor = [[NSSortDescriptor alloc] initWithKey:@"lastName" ascending:YES]; NSArray *sortDescriptors = [[NSArray alloc] initWithObjects:sortDescriptor, nil]; [fetchRequest setSortDescriptors:sortDescriptors]; NSFetchedResultsController *aFetchedResultsController = [[NSFetchedResultsController alloc] initWithFetchRequest:fetchRequest managedObjectContext:self.managedObjectContext sectionNameKeyPath:nil cacheName:@"Root"]; aFetchedResultsController.delegate = self; self.fetchedResultsController = aFetchedResultsController; NSError *error = nil; //[aFetchedResultsController performFetch:&error]; [aFetchedResultsController release]; [fetchRequest release]; [sortDescriptor release]; [sortDescriptors release]; return fetchedResultsController; } Have a look at commented string - there wasn't any of these strings and when I asked for data - I didn't get any (and it was there!). When I've uncommented that line, it starts work. Seems evident, but all examples I saw before hadn't that line. And they work. How can it be? I just want to know what am I doing wrong.

    Read the article

  • Java java.util.ConcurrentModificationException error

    - by vijay
    Hi all, please can anybody help me solve this problem last so many days I could not able to solve this error. I tried using synchronized method and other ways but did not work so please help me Error java.util.ConcurrentModificationException at java.util.AbstractList$Itr.checkForComodification(Unknown Source) at java.util.AbstractList$Itr.remove(Unknown Source) at JCA.startAnalysis(JCA.java:103) at PrgMain2.doPost(PrgMain2.java:235) Code public synchronized void startAnalysis() { //set Starting centroid positions - Start of Step 1 setInitialCentroids(); Iterator<DataPoint> n = mDataPoints.iterator(); //assign DataPoint to clusters loop1: while (true) { for (Cluster c : clusters) { c.addDataPoint(n.next()); if (!n.hasNext()) break loop1; } } //calculate E for all the clusters calcSWCSS(); //recalculate Cluster centroids - Start of Step 2 for (Cluster c : clusters) { c.getCentroid().calcCentroid(); } //recalculate E for all the clusters calcSWCSS(); // List copy = new ArrayList(originalList); //synchronized (c) { for (int i = 0; i < miter; i++) { //enter the loop for cluster 1 for (Cluster c : clusters) { for (Iterator<DataPoint> k = c.getDataPoints().iterator(); k.hasNext(); ) { // synchronized (k) { DataPoint dp = k.next(); System.out.println("Value of DP" +dp); //pick the first element of the first cluster //get the current Euclidean distance double tempEuDt = dp.getCurrentEuDt(); Cluster tempCluster = null; boolean matchFoundFlag = false; //call testEuclidean distance for all clusters for (Cluster d : clusters) { //if testEuclidean < currentEuclidean then if (tempEuDt > dp.testEuclideanDistance(d.getCentroid())) { tempEuDt = dp.testEuclideanDistance(d.getCentroid()); tempCluster = d; matchFoundFlag = true; } //if statement - Check whether the Last EuDt is > Present EuDt } //for variable 'd' - Looping between different Clusters for matching a Data Point. //add DataPoint to the cluster and calcSWCSS if (matchFoundFlag) { tempCluster.addDataPoint(dp); //k.notify(); // if(k.hasNext()) k.remove(); for (Cluster d : clusters) { d.getCentroid().calcCentroid(); } //for variable 'd' - Recalculating centroids for all Clusters calcSWCSS(); } //if statement - A Data Point is eligible for transfer between Clusters. // }// syn } //for variable 'k' - Looping through all Data Points of the current Cluster. }//for variable 'c' - Looping through all the Clusters. }//for variable 'i' - Number of iterations. // syn }

    Read the article

  • CoreGraphics taking a while to show on a large view - can i get it to repeat pixels?

    - by Andrew
    This is my coregraphics code: void drawTopPaperBackground(CGContextRef context, CGRect rect) { CGRect paper3 = CGRectMake(10, 14, 300, rect.size.height - 14); CGRect paper2 = CGRectMake(13, 12, 294, rect.size.height - 12); CGRect paper1 = CGRectMake(16, 10, 288, rect.size.height - 10); //Shadow CGContextSetShadowWithColor(context, CGSizeMake(0,0), 10, [[UIColor colorWithWhite:0 alpha:0.5]CGColor]); CGPathRef path = createRoundedRectForRect(paper3, 0); CGContextSetFillColorWithColor(context, [[UIColor blackColor] CGColor]); CGContextAddPath(context, path); CGContextFillPath(context); //Layers of paper //CGContextSaveGState(context); drawPaper(context, paper3); drawPaper(context, paper2); drawPaper(context, paper1); //CGContextRestoreGState(context); } void drawPaper(CGContextRef context, CGRect rect) { //Shadow CGContextSaveGState(context); CGContextSetShadowWithColor(context, CGSizeMake(0,0), 1, [[UIColor colorWithWhite:0 alpha:0.5]CGColor]); CGPathRef path = createRoundedRectForRect(rect, 0); CGContextSetFillColorWithColor(context, [[UIColor blackColor] CGColor]); CGContextAddPath(context, path); CGContextFillPath(context); //CGContextRestoreGState(context); //Gradient //CGContextSaveGState(context); CGColorRef startColor = [UIColor colorWithWhite:0.92 alpha:1.0].CGColor; CGColorRef endColor = [UIColor colorWithWhite:0.94 alpha:1.0].CGColor; CGRect firstHalf = CGRectMake(rect.origin.x, rect.origin.y, rect.size.width / 2, rect.size.height); CGRect secondHalf = CGRectMake(rect.origin.x + (rect.size.width / 2), rect.origin.y, rect.size.width / 2, rect.size.height); drawVerticalGradient(context, firstHalf, startColor, endColor); drawVerticalGradient(context, secondHalf, endColor, startColor); //CGContextRestoreGState(context); //CGContextSaveGState(context); CGRect redRect = rectForRectWithInset(rect, -1); CGMutablePathRef redPath = createRoundedRectForRect(redRect, 0); //CGContextSaveGState(context); CGContextSetStrokeColorWithColor(context, [[UIColor blackColor] CGColor]); CGContextAddPath(context, path); CGContextClip(context); CGContextAddPath(context, redPath); CGContextSetShadowWithColor(context, CGSizeMake(0, 0), 15.0, [[UIColor colorWithWhite:0 alpha:0.1] CGColor]); CGContextStrokePath(context); CGContextRestoreGState(context); } The view is a UIScrollView, which contains a textview. Every time the user types something and goes onto a new line, I call [self setNeedsDisplay]; and it redraws the code. But when the view starts to get long - around 1000 height, it has very noticeable lag. How can i make this code more efficient? Can i take a line of pixels and make it just repeat that, or stretch it, all the way down?

    Read the article

  • Can I access views when drawn in the drawRect method?

    - by GianPac
    When creating the content view of a tableViewCell, I used the drawInRect:withFont, drawAtPoint... and others, inside drawRect: since all I needed was to lay some text. Turns out, part of the text drawn need to be clickable URLs. So I decided to create a UIWebView and insert it into my drawRect. Everything seems to be laid out fine, the problem is that interaction with the UIWebView is not happening. I tried enabling the interaction, did not work. I want to know, since with drawRect: I am drawing to the current graphics context, there is anything I can do to have my subviews interact with the user? here is some of my code I use inside the UITableViewCell class. -(void) drawRect:(CGRect)rect{ NSString *comment = @"something"; [comment drawAtPoint:point forWidth:195 withFont:someFont lineBreakMode:UILineBreakModeMiddleTruncation]; NSString *anotherCommentWithURL = @"this comment has a URL http://twtr.us"; UIWebView *webView = [[UIWebView alloc] initWithFrame:someFrame]; webView.delegate = self; webView.text = anotherCommentWithURL; [self addSubView:webView]; [webView release]; } As I said, the view draws fine, but there is no interaction with the webView from the outside. the URL gets embedded into HTML and should be clickable. It is not. I got it working on another view, but on that one I lay the views. Any ideas?

    Read the article

  • CoreData is saving model without the save: method being called

    - by chris
    I have a list of items with a plus button in the navigation bar that opens up a modal window containing a table of the models attributes, that displays a form when the table items are clicked (pretty standard form style). For some reason if I click the plus button to open the form to create a new model, then immediately click the done button, the person model is saved. The action linked to the done button does nothing but call on a delegate method notifying the personListViewController to close the window. The apple docs do state that the model is not saved after calling the insertNewObjectForEntityName: ... Simply creating a managed object does not cause it to be saved to a persistent store. The managed object context acts as a scratchpad. I am at a lost to why this is happening, but every time I click the done button I have a new blank item in the original tableView. I am using SDK v3.1.3 // PersonListViewController - open modal window - (void)addPerson { // Load the new form PersonNewViewController *newController = [[PersonNewViewController alloc] init]; newController.modalFormDelegate = self; [self presentModalViewController:newController animated:YES]; [newController release]; } // PersonFormViewController - (void)viewDidLoad { [super viewDidLoad]; if ( person == nil ) { MyAppDelegate *appDelegate = [[UIApplication sharedApplication] delegate]; self.person = [NSEntityDescription insertNewObjectForEntityForName:@"Person" inManagedObjectContext:appDelegate.managedObjectContext]; } ... UIBarButtonItem *doneButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemDone target:self action:@selector(done)]; self.navigationItem.rightBarButtonItem = doneButton; [doneButton release]; } - (IBAction) done { [self.modalFormDelegate didCancel]; } // delegate method in the original listViewController - (void) didCancel { [self dismissModalViewControllerAnimated:YES]; }

    Read the article

  • NSManagedObjectContext returns YES for hasChanges when there are none

    - by JK
    I created a separate NSManagedObjectContext on a separate thread to perform some store maintenance. However, I have noticed that the context returns YES for hasChanges as soon as a managed object in it is even referenced e.g. NSString *name = managedObject.name; This context is created and used exclusively in 1 method. Why is it returning has changes, when there there are none?

    Read the article

< Previous Page | 55 56 57 58 59 60 61 62 63 64 65 66  | Next Page >