Tutorial by Examples: c

AngularJS code for rendering plain text: <p>{{ ScopePropertyX }} and {{ ScopePropertyY }}</p> KnockoutJS equivalent: <p> <!-- ko text: ScopeObservableX --><!-- /ko --> and <!-- ko text: ScopeObservableY --><!-- /ko --> </p> or: ...
A good example of a feature that request platform specific code is when you want to implement text-to-speech (tts). This example assumes that you are working with shared code in a PCL library. A schematic overview of our solution would look like the image underneath. In our shared code we define...
[\+\-]?\d+(\.\d*)? This will match any signed float, if you don't want signs or are parsing an equation remove [\+\-]? so you have \d+(\.\d+)? Explanation: \d+ matches any integer ()? means the contents of the parentheses are optional but always have to appear together '\.' matches '.', we ...
Starting from a fresh installation of Codeigniter 3, here is a simple way to start with an Hello World application, to break the ice with this solid PHP framework. To do this you can start creating the view that we want to be shown for our Hello World app. We are going to put it in your applicatio...
Now we'll try going for a little more complex example, using the capabilities of the controller to fill in the view. Here is our view: /application/views/hello_world.php <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <titl...
Let's say that we want to have an alternative greeting that is accessible through a different URL. We might create a new function or even a new controller for that, but a best practice is to optimize what we already have, to make it work at it's best! To do this, we'll keep the same view as in the ...
public class Tag { public IList<string> Synonyms { get; set; } } Synonyms is a collection-type property. When the Tag object is created using object initializer syntax, Synonyms can also be initialized with collection initializer syntax: Tag t = new Tag { Synonyms = new List&...
Recursion is when a method calls itself. Preferably it will do so until a specific condition is met and then it will exit the method normally, returning to the point from which the method was called. If not, a stack overflow exception might occur due to too many recursive calls. /// <summary>...
To read the contents to a file into a string variable: Dim fileContents As String = System.IO.File.ReadAllText("filename.txt") ReadAllText will open the specified file, read data to the end, then close the file. To read a file, separating it into an array element for each line: Dim f...
;; package.el is available since emacs 24 (require 'package) ;; Add melpa package source when using package list (add-to-list 'package-archives '("melpa" . "http://melpa.org/packages/") t) ;; Load emacs packages and activate them ;; This must come before configurations o...
Routes in Flask can be defined using the route decorator of the Flask application instance: app = Flask(__name__) @app.route('/') def index(): return 'Hello Flask' The route decorator takes a string which is the URL to match. When a request for a URL that matches this string is receive...
UIGraphicsBeginPDFContextToFile(fileName, CGRectZero, nil); UIGraphicsBeginPDFPageWithInfo(CGRectMake(0, 0, 612, 792), nil); [self drawText]; UIGraphicsEndPDFContext(); fileName is the document file where You are going to append or attach NSString* temporaryFile = @"firstI...
Minimal requirements for WCF service is one ServiceContract with one OperationContract. Service contract: [ServiceContract] public interface IDemoService { [OperationContract] CompositeType SampleMethod(); } Service contract implementation: public class DemoService : IDemoService...
In all serious Prolog systems, association lists are available to allow faster than linear access to a collection of elements. These association lists are typically based on balanced trees like AVL trees. There is a public domain library called library(assoc) that ships with many Prolog systems and ...
Consider the following block of code. try { using (var disposable = new MyDisposable()) { throw new Exception("Couldn't perform operation."); } } catch (Exception ex) { Console.WriteLine(ex.Message); } class MyDisposable : IDisposable { public vo...
6.0 Introduced in C# 6.0, the Null Conditional Operator ?. will immediately return null if the expression on its left-hand side evaluates to null, instead of throwing a NullReferenceException. If its left-hand side evaluates to a non-null value, it is treated just like a normal . operator. Note tha...
To connect to a local Wildfly server via the command line, the tool bin/jboss-cli.sh can be used: $ ./bin/jboss-cli.sh --connect [standalone@localhost:9990 /] To connect to a remote Wildfly server, use the --controller option: $ ./bin/jboss-cli.sh --connect --controller=localhost:9990 [stan...
int a; std::cout << a; // Undefined behavior! This results in undefined behavior, because a is uninitialised. It is often, incorrectly, claimed that this is because the value is "indeterminate", or "whatever value was in that memory location before". However, it is th...
The call/N family of predicates can call arbitrary Prolog goals at run time: ?- G=true, call(G). true. ?- G=(true,false), call(G). false.
In Prolog, the so-called meta-call is a built-in language feature. All Prolog code is represented by Prolog terms, allowing goals to be constructed dynamically and be used like other goals without additional predicates: ?- Goal = dif(X, Y), Goal. dif(X, Y). Using this mechanism, other higher-or...

Page 186 of 826