Tutorial by Examples: c

NSLog(@"%s %@",__FUNCTION__, @"etc etc"); Inserts the class and method name into the output: 2016-07-22 12:51:30.099 loggingExample[18132:2971471] -[ViewController viewDidLoad] etc etc
Postfix increment X++ will add 1 to x var x = 42; x++; Console.WriteLine(x); // 43 Postfix decrement X-- will subtract one var x = 42 x--; Console.WriteLine(x); // 41 ++x is called prefix increment it increments the value of x and then returns x while x++ returns the value of x and the...
In Prolog, custom operators can be defined using op/3: op(+Precedence, +Type, :Operator) Declares Operator to be an operator of a Type with a Precedence. Operator can also be a list of names in which case all elements of the list are declared to be identical operators. Precedence is an in...
This example uses four different files: The User model The User mailer The html template for the email The plain-text template for the email In this case, the user model calls the approved method in the mailer and passes the post that has been approved (the approved method in the model may ...
vagrant up --provider hyperv
vagrant up --provider docker
vagrant up --provider vmware_fusion
vagrant up --provider vmware_workstation
vagrant up --provider virtualbox VirtualBox is the default provider for a vanilla Vagrant setup.
Instead of the usual loosely typed: @Html.ActionLink("Log in", "UserController", "LogIn") You can now make action links strongly typed: @Html.ActionLink("Log in", @typeof(UserController), @nameof(UserController.LogIn)) Now if you want to refactor your ...
#!/bin/bash NO_SNAPSHOTS="No snapshots have been taken yet" SNAPSHOT_OUTPUT=$(vagrant snapshot list | grep "${NO_SNAPSHOTS}") if [ -z "${SNAPSHOT_OUTPUT}" ]; then echo "Found some snapshots, going to remove them" for SNAPSHOT in $(vagrant snap...
NSString *testString1 = @"(555) 123-5678"; NSString *testString2 = @"not a phone number"; NSError *error = nil; NSRegularExpression *regex = [NSRegularExpression regularExpressionWithPattern:@"^\\(\\d{3}\\) \\d{3}\\-\\d{4}$" ...
Versions Release Date VersionRelease Date8.2.4December 07, 20167.53December 07, 20166.38 (unsupported)February 24, 20165.23 (unsupported)August 11, 2010 Entity types In earlier versions of Drupal, the field system was only used on content types. Now, thanks to the Entity API, we can add fields...
Add the following line to ViewDidLoad method: print(Realm.Configuration.defaultConfiguration.fileURL!) The line above will print the location to Xcode's console. Copy the file path, go to Finder → Go → Go to Folder... (or ⌘+⇧+G)→ paste the path and hit Go.
Log the realm file location using: NSLog(@"%@",[RLMRealmConfiguration defaultConfiguration].fileURL); The line above will print the location to Xcode's console. Copy the file path, go to Finder → Go → Go to Folder... (or ⌘+⇧+G)→ paste the path and hit Go.
Problem # models.py: class Library(models.Model): name = models.CharField(max_length=100) books = models.ManyToManyField(Book) class Book(models.Model): title = models.CharField(max_length=100) # views.py def myview(request): # Query the database. libraries = Librar...
Problem Django querysets are evaluated in a lazy fashion. For example: # models.py: class Author(models.Model): name = models.CharField(max_length=100) class Book(models.Model): author = models.ForeignKey(Author, related_name='books') title = models.CharField(max_length=100) ...
There are places in the standard where an object is copied or moved in order to initialize an object. Copy elision (sometimes called return value optimization) is an optimization whereby, under certain specific circumstances, a compiler is permitted to avoid the copy or move even though the standard...
C++17 Normally, elision is an optimization. While virtually every compiler support copy elision in the simplest of cases, having elision still places a particular burden on users. Namely, the type who's copy/move is being elided must still have the copy/move operation that was elided. For example:...
If you use a prvalue expression to copy initialize a variable, and that variable has the same type as the prvalue expression, then the copying can be elided. std::string str = std::string("foo"); Copy initialization effectively transforms this into std::string str("foo"); (th...

Page 192 of 826