Tutorial by Examples: c

The default namespace is the namespace corresponding to the absence of any prefix. It can be declared with the special xmlns attribute. <?xml version="1.0"?> <foo xmlns="http://www.example.com/my-namespace"> <!-- the element foo is in the namespace htt...
A namespace binding (special xmlns or xmlns:... attribute) is in scope for all the descendants of the enclosing element, including this element. <?xml version="1.0"?> <root> <my:element xmlns:my="http://www.example.com/ns1"> <!-- here, the prefix my...
To cancel a call to requestAnimationFrame, you need the id it returned from when it was last called. This is the parameter you use for cancelAnimationFrame. The following example starts some hypothetical animation then pauses it after one second. // stores the id returned from each call to reques...
Dim inputCode As Integer = Console.Read() Console.Read() awaits input from the user and, upon receipt, returns an integer value corresponding with the character code of the entered character. If the input stream is ended in some way before input can be obtained, -1 is returned instead.
Dim inputChar As ConsoleKeyInfo = Console.ReadKey() Console.ReadKey() awaits input from the user and, upon receipt, returns an object of class ConsoleKeyInfo, which holds information relevant to the character which the user provided as input. For detail regarding the information provided, visit t...
C++11 Deriving a class may be forbidden with final specifier. Let's declare a final class: class A final { }; Now any attempt to subclass it will cause a compilation error: // Compilation error: cannot derive from final class: class B : public A { }; Final class may appear anywhere in cl...
Addition + and subtraction - operations can be used to combine delegate instances. The delegate contains a list of the assigned delegates. using System; using System.Reflection; using System.Reflection.Emit; namespace DelegatesExample { class MainClass { private delegate void MyD...
You can easily add a breakpoint to your code by clicking on the grey column to the left of the line of your VBA code where you want execution to stop. A red dot appears in the column and the breakpoint code is also highlighted in red. You can add multiple breakpoints throughout your code and resumi...
In contrast of a full template specialization partial template specialization allows to introduce template with some of the arguments of existing template fixed. Partial template specialization is only available for template class/structs: // Common case: template<typename T, typename U> st...
Once a model object has been fetched, it becomes a fully realized instance of the class. As such, any additional methods can be accessed in forms and serializers (like Django Rest Framework). Using python properties is an elegant way to represent additional values that are not stored in the databa...
This example will show you how to quickly get a hello world Aurelia application up and running using the Aurelia CLI. Prerequisites The Aurelia CLI is a Node.js based application, so make sure you install it first before proceeding. You will need Node.js 4.4.7 or later. You will also need a Git c...
A commonly used CSS/Javascript library is Bootstrap. To install it into your Aurelia CLI driven application first you need to install it using Npm. npm install bootstrap --save Because Bootstrap has a hard dependency on jQuery, we need to make sure we also have jQuery installed: npm install jqu...
While Value Converters can be comprised of either a toView or fromView method, in the below example we will be creating a basic Value Converter which just uses the toView method which accepts the value being sent to the view as the first argument. to-uppercase.js export class ToUppercaseValueConve...
A bi-directional value converter utilizes two methods in your Value Converter class: toView and fromView these methods are aptly named to signify which direction the data is flowing. In our example we will be creating a prepend Value Converter which will make sure that an amount entered in our app ...
A Value Converter can be used alongside other value converters and you can infinitely chain them using the | pipe separator. ${myString | toUppercase | removeCharacters:'&,%,-,+' | limitTo:25} The above theoretical example firstly applies toUppercase which capitalizes our string. Then it app...
Stateless components are getting their philosophy from functional programming. Which implies that: A function returns all time the same thing exactly on what is given to it. For example: const statelessSum = (a, b) => a + b; let a = 0; const statefulSum = () => a++; As you can see fro...
Create project using STS (Spring Starter Project) or Spring Initializr (at https://start.spring.io ). Add a Web Dependency in your pom.xml: <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId&...
Recursion occurs when a function call causes that same function to be called again before the original function call terminates. For example, consider the well-known mathematical expression x! (i.e. the factorial operation). The factorial operation is defined for all nonnegative integers as follows:...
1) Use ng-repeat sparingly Using ng-repeat in views generally results in poor performance, particularly when there are nested ng-repeat's. This is super slow! <div ng-repeat="user in userCollection"> <div ng-repeat="details in user"> {{details}} </div...
use lib 'includes'; use MySuperCoolModule; use lib 'includes'; adds the relative directory includes/ as another module search path in @INC. So assume that you have a module file MySyperCoolModule.pm inside includes/, which contains: package MySuperCoolModule; If you want, you can group as ma...

Page 145 of 826