Tutorial by Examples

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...
Similar to hsl() notation, but with an added alpha (opacity) value. hsla(240, 100%, 50%, 0) /* transparent */ hsla(240, 100%, 50%, 0.5) /* half-translucent blue */ hsla(240, 100%, 50%, 1) /* fully opaque blue */ Syntax hsla(<hue>, <saturation>%, <lightness>%, <a...
The Groovy version of Hello World. println 'Hello World!'
When you use or, it will either return the first value in the expression if it's true, else it will blindly return the second value. I.e. or is equivalent to: def or_(a, b): if a: return a else: return b For and, it will return its first value if it's false, else it r...
You should use caution when using setState in an asynchronous context. For example, you might try to call setState in the callback of a get request: class MyClass extends React.Component { constructor() { super(); this.state = { user: {} }; } ...
Props are a way to pass information into a React component, they can have any type including functions - sometimes referred to as callbacks. In JSX props are passed with the attribute syntax <MyComponent userID={123} /> Inside the definition for MyComponent userID will now be accessible f...
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...
ng-repeat is a built in directive in Angular which lets you iterate an array or an object and gives you the ability to repeat an element once for each item in the collection. ng-repeat an array <ul> <li ng-repeat="item in itemCollection"> {{item.Name}} </...
$scope.$emit Using $scope.$emit will fire an event name upwards through the scope hierarchy and notify to the $scope.The event life cycle starts at the scope on which $emit was called. Working wireframe : $scope.$broadcast Using $scope.$broadcast will fire an event down the $scope. We can list...
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...
First define the service (in this case it uses the factory pattern): .factory('dataService', function() { var dataObject = {}; var service = { // define the getter method get data() { return dataObject; }, // define the setter method ...

Page 235 of 1336