Tutorial by Examples

Objective-C NSPredicate *predicate = [NSPredicate predicateWithFormat: @"self[SIZE] = %d", 5)]; Swift let predicate = NSPredicate(format: "self[SIZE] >= %d", 5) In this example, the predicate will match items that are arrays with length of at least 5.
An NSPredicate can use substitution variables to allow values to be bound on the fly. Objective-C NSPredicate *template = [NSPredicate predicateWithFormat: @"self BEGINSWITH $letter"]; NSDictionary *variables = @{ @"letter": @"r" }; NSPredicate *beginsWithR = [templ...
Objective-C NSArray *heroes = @[@"tracer", @"bastion", @"reaper", @"junkrat", @"roadhog"]; NSPredicate *template = [NSPredicate predicateWithFormat:@"self BEGINSWITH $letter"]; NSDictionary *beginsWithRVariables = @{ @"letter&qu...
To prevent memory leaks, one should not forget to close an input stream or an output stream whose job is done. This is usually done with a try-catch-finally statement without the catch part: void writeNullBytesToAFile(int count, String filename) throws IOException { FileOutputStream out = null...
You can bind event listeners to the EventSource object to listen to different events channels using the .addEventListener method. EventSource.addEventListener(name: String, callback: Function, [options]) name: The name related to the name of the channel the server is emitting events to. callb...
make a publisher account add an asset in the publisher account download the asset store tools (from the asset store) go to "Asset Store Tools" > "Package Upload" select the correct package and project folder in the asset store tools window click upload submit your asse...
It is always a good practice to test how push notifications work even before you have your server side ready for them, just to make sure that everything is set up correctly on your side. It is quite easy to send yourself a push notification using a following PHP script. Save the script as a file ...
Save aps.cer to a folder Open "Keychain access" and export the key that is under that certificate to a .p12 file (call it key.p12). To do that right click on it and choose Export. Save it to the same folder as step 1. On export you will be prompted for a password. Make something u...
Major mode Emacs can adapt its behaviour to the specific type of text edited in a buffer. The set of specific Emacs customizations for a particular type of text is called a "major mode". Each buffer has exactly one major mode depending on its content type. Major modes can change the mean...
Using redux directly with react might seem little difficult, As for every component you want to update when store changes, you have to subscribe that component to the redux store React Redux takes care of all these and makes it really easy to write components that can request the data it needs from...
As seen in previous examples, basic use of this script is: python setup.py install But there is even more options, like installing the package and have the possibility to change the code and test it without having to re-install it. This is done using: python setup.py develop If you want to p...
What is Flink Like Apache Hadoop and Apache Spark, Apache Flink is a community-driven open source framework for distributed Big Data Analytics. Written in Java, Flink has APIs for Scala, Java and Python, allowing for Batch and Real-Time streaming analytics. Requirements a UNIX-like environment,...
JAXB can be used to generate classes from an model defined in XSD. It will then be possible to read XML document made against this XSD directly as java instances and inversly save these instances as XML document. Take the following XSD saved in a file named SimpleModel.xsd <?xml version="...
When an application has not been packaged as an executable JAR, you need to provide the name of an entry-point class on the java command line. Running the HelloWorld class The "HelloWorld" example is described in Creating a new Java program . It consists of a single class called HelloWo...
A Java entry-point class has a main method with the following signature and modifiers: public static void main(String[] args) Sidenote: because of how arrays work, it can also be (String args[]) When the java command starts the virtual machine, it loads the specified entry-point classes and...
The Factory method pattern is a creational pattern that abstracts away the instantiation logic of an object in order to decouple the client code from it. When a factory method belongs to a class that is an implementation of another factory pattern such as Abstract factory then it is usually more ap...
Detailed instructions on getting promise set up or installed.
Swift 2.3 let url = NSURL(string: "http://google.com/lastPath") let lastPath = url?.lastPathComponent Swift 3.0 let url = URL(string: "http://google.com/lastPath") let lastPath = url?.lastPathComponent
GET your REST data and store in a PowerShell object: $Post = Invoke-RestMethod -Uri "http://jsonplaceholder.typicode.com/posts/1" Modify your data: $Post.title = "New Title" PUT the REST data back $Json = $Post | ConvertTo-Json Invoke-RestMethod -Method Put -Uri "h...
GET your REST data and store in a PowerShell object: $Users = Invoke-RestMethod -Uri "http://jsonplaceholder.typicode.com/users" Modify many items in your data: $Users[0].name = "John Smith" $Users[0].email = "[email protected]" $Users[1].name = "Jane S...

Page 805 of 1336