Tutorial by Examples: f

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.
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...
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...
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="...
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...
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
Date FormatSQL StatementSample OutputYY-MM-DDSELECT RIGHT(CONVERT(VARCHAR(10), SYSDATETIME(), 20), 8) AS [YY-MM-DD]SELECT REPLACE(CONVERT(VARCHAR(8), SYSDATETIME(), 11), '/', '-') AS [YY-MM-DD]11-06-08YYYY-MM-DDSELECT CONVERT(VARCHAR(10), SYSDATETIME(), 120) AS [YYYY-MM-DD]SELECT REPLACE(CONVERT(VAR...
In Julia, you can have an Array that holds other Array type objects. Consider the following examples of initializing various types of Arrays: A = Array{Float64}(10,10) # A single Array, dimensions 10 by 10, of Float64 type objects B = Array{Array}(10,10,10) # A 10 by 10 by 10 Array. Each ele...
In Julia, as in many other languages, it is possible to interpolate by inserting values defined by variables into strings. For a simple example: n = 2 julia> MyString = "there are $n ducks" "there are 2 ducks" We can use other types than numeric, e.g. Result = false j...
If you have void F1(MyType1 x) { // do something } void F1(MyType2 x) { // do something else } and for some reason you need to call the first overload of F1 but with x = null, then doing simply F1(null); will not compile as the call is ambiguous. To counter this you can do F1...
As mentioned in the Intro to Expressions expressions are a specific type of object in Julia. As such, they have fields. The two most used fields of an expression are its head and its args. For instance, consider the expression MyExpr3 = Expr(:(=), :x, 2) discussed in Creating Expressions. We...
There are a number of useful web resources that can help further your knowledge of expressions in Julia. These include: Julia Docs - Metaprogramming Wikibooks - Julia Metaprogramming Julia’s macros, expressions, etc. for and by the confused, by Gray Calhoun Month of Julia - Metaprogramming, b...
Setting up deep-linking for your app is easy.You just need a small url using which you want to open your app. Follow the steps to set up deep-linking for your app. Lets create a project and name it DeepLinkPOC. Now select your project target. After selecting target,select the 'info' ...
Send a message using GCM HTTP connection server protocol: https://gcm-http.googleapis.com/gcm/send Content-Type:application/json Authorization:key=AIzaSyZ-1u...0GBYzPu7Udno5aA { "to": "/topics/foo-bar", "data": { "message": "T...
SELECT DISTINCT o.name AS Object_Name,o.type_desc FROM sys.sql_modules m INNER JOIN sys.objects o ON m.object_id=o.object_id WHERE m.definition Like '%myField%' ORDER BY 2,1 Will find mentions of myField in SProcs, Views, etc.
The Deque is the only Python data structure with fast Queue operations. (Note queue.Queue isn't normally suitable, since it's meant for communication between threads.) A basic use case of a Queue is the breadth first search. from collections import deque def bfs(graph, root): distances = {}...
Postscript is a dynamic-namespacing or LISP 1 language. But it provides the tools to implement local variables in procedures and other effects needed to implement algorithms. For local names in a procedure, make a new dictionary at the start and pop it at the end. /myproc { 10 dict begin ...
Sometimes, the latest tagged version of a package is buggy or is missing some required features. Advanced users may wish to update to the latest development version of a package (sometimes referred to as the "master", named after the usual name for a development branch in Git). The benefit...

Page 271 of 457