Friday, November 18, 2016

SQL Tutorial

Please read from below link.


  1. Tutorial : Click Here
  2. Complex Queries in SQL
    1. Link 1
    2. Link 2

Objective C

Swift Tutorial

Please read from below link.

Click here

C Language Tutorial

Please read from below link

Click Here

C++

What Is Core Data?

Core Data is a framework that you use to manage the model layer objects in your application. It provides generalized and automated solutions to common tasks associated with object life cycle and object graph management, including persistence.

Core Data typically decreases by 50 to 70 percent the amount of code you write to support the model layer. This is primarily due to the following built-in features that you do not have to implement, test, or optimize:

  1. Change tracking and built-in management of undo and redo beyond basic text editing.
  2. Maintenance of change propagation, including maintaining the consistency of relationships among objects.
  3. Lazy loading of objects, partially materialized futures (faulting), and copy-on-write data sharing to reduce overhead.
  4. Automatic validation of property values. Managed objects extend the standard key-value coding validation methods to ensure that individual values lie within acceptable ranges, so that combinations of values make sense.
  5. Schema migration tools that simplify schema changes and allow you to perform efficient in-place schema migration.
  6. Optional integration with the application’s controller layer to support user interface synchronization.
  7. Grouping, filtering, and organizing data in memory and in the user interface.
  8. Automatic support for storing objects in external data repositories.
  9. Sophisticated query compilation. Instead of writing SQL, you can create complex queries by associating an NSPredicate object with a fetch request.
  10. Version tracking and optimistic locking to support automatic multiwriter conflict resolution.
  11. Effective integration with the macOS and iOS tool chains.



Grand Central Dispatch


Please Read from below Link.

Click Here

NSURLSession Advantage

NSURLConnection is deprecated in OS X 10.11 and iOS 9.0




Advantage:

  • NSURLSession also provides support for background downloads, which make it possible to continue downloading resources while your app isn’t running (or when it is in the background on iOS).
  • NSURLSession also provides grouping of related requests, making it easy to cancel all of the requests associated with a particular work unit, such as canceling all loads associated with loading a web page when the user closes the window or tab.

Main difference between NSURLSession and NSURLConnection

  • NSURLConnection: if we have an open connection with NSURLConnection and the system interrupt our App, when our App goes to background mode, everything we have received or sent were lost.
  • NSURLSession: solve this problem and also give us out of process downloads. It manage the connection process even when we don’t have access. You will need to use application:handleEventsForBackgroundURLSession:completionHandler in your AppDelegate


Example of :

NSURL *URL = [NSURL URLWithString:@"http://example.com&"];    NSURLRequest *request = [NSURLRequest requestWithURL:URL];    [NSURLConnection sendAsynchronousRequest:request queue:[NSOperationQueue mainQueue] completionHandler:^(NSURLResponse *response, NSData *data, NSError *error) { // …      
    }];
                
                
    NSURL *URL = [NSURL URLWithString:@"http://example.com"];
    NSURLRequest *request = [NSURLRequest requestWithURL:URL];
    NSURLSession *session = [NSURLSession sharedSession];    NSURLSessionDataTask *task = [session dataTaskWithRequest:request completionHandler: ^(NSData *data, NSURLResponse *response, NSError *error) { // …      
    }];
    [task resume];
                              
                              
    NSURL *URL = [NSURL URLWithString:@"http://example.com/file.zip"];
    NSURLRequest *request = [NSURLRequest requestWithURL:URL];
    NSURLSession *session = [NSURLSession sharedSession];
    NSURLSessionDownloadTask *downloadTask = [session downloadTaskWithRequest:request completionHandler: ^(NSURL *location, NSURLResponse *response, NSError *error) {
        NSString *documentsPath = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) firstObject];        NSURL *documentsDirectoryURL = [NSURL fileURLWithPath:documentsPath];
        NSURL *documentURL = [documentsDirectoryURL URLByAppendingPathComponent:[response suggestedFilename]];
        [[NSFileManager defaultManager] moveItemAtURL:location toURL:documentURL error:nil];
    }];
    [downloadTask resume];
  
                                            
    NSURL *URL = [NSURL URLWithString:@"http://example.com/upload"];
    NSURLRequest *request = [NSURLRequest requestWithURL:URL];
    NSData *data = …; NSURLSession *session = [NSURLSession sharedSession];
    NSURLSessionUploadTask *uploadTask = [session uploadTaskWithRequest:request fromData:data completionHandler: ^(NSData *data, NSURLResponse *response, NSError *error) {
        // …      
    }];
    [uploadTask resume];
                                              
    //Init the NSURLSession with a configuration
    NSURLSessionConfiguration *defaultConfigObject = [NSURLSessionConfiguration defaultSessionConfiguration];    NSURLSession *defaultSession = [NSURLSession sessionWithConfiguration: defaultConfigObject delegate: nil delegateQueue: [NSOperationQueue mainQueue]];
    //Create an URLRequest
    NSURL *url = [NSURL URLWithString:@"yourURL"];
    NSMutableURLRequest *urlRequest = [NSMutableURLRequest requestWithURL:url];
    //Create POST Params and add it to HTTPBody
    NSString *params = @"api_key=APIKEY&email=example@example.com&password=password";    [urlRequest setHTTPMethod:@"POST"];
    [urlRequest setHTTPBody:[params dataUsingEncoding:NSUTF8StringEncoding]];
    //Create task
    NSURLSessionDataTask * dataTask =[defaultSession dataTaskWithRequest urlRequest completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
    //Handle your response here
    }];
    [dataTask resume];