To make a custom pipe available application wide, During application bootstrap, extending PLATFORM_PIPES.
import { bootstrap } from '@angular/platform-browser-dynamic';
import { provide, PLATFORM_PIPES } from '@angular/core';
import { AppComponent } from './app.component';
import { MyPipe }...
Detailed instructions on getting WSO2 set up or installed.
Almost all the WSO2 Products can be started using the wso2server.sh/bat files that can be found in the <Product_Home>/bin folder of each product. When you run the sh/bat script it will star the particular WSO2 product with default set...
The case modifier causes the Scala compiler to automatically generate common boilerplate code for the class. Implementing this code manually is tedious and a source of errors. The following case class definition:
case class Person(name: String, age: Int)
... will have the following code automati...
There are several ways to format and get a string as a result.
The .NET way is by using String.Format or StringBuilder.AppendFormat:
open System
open System.Text
let hello = String.Format ("Hello {0}", "World")
// return a string with "Hello World"
let builder...
Sometimes when you make a game you need to create and destroy a lot of objects of the same type over and over again. You can simply do this by making a prefab and instantiate/destroy this whenever you need to, however, doing this is inefficient and can slow your game down.
One way to get around thi...
F|forbidden
Similar to Deny, this flag forces the server to immediately return a 403 Forbidden status code to the requesting browser or client for the request.
Example: Deny access to requests that end with exe:
RewriteRule .exe$ - [F]
G|gone
If a requested resource was available in the past,...
Unity works with hierarchies in order to keep your project organized. You can assign objects a place in the hierarchy using the editor but you can also do this through code.
Parenting
You can set an object's parent with the following methods
var other = GetOtherGameObject();
other.transform.Se...
append([], Bs, Bs).
append([A|As], Bs, [A|Cs]) :-
append(As, Bs, Cs).
append/3 is one of the most well-known Prolog relations. It defines a relation between three arguments and is true if the third argument is a list that denotes the concatenation of the lists that are specified in the firs...
Sometimes you want to destructure key under a map which might not be present in the map, but you want a default value for the destructured value. You can do that this way:
(def my-map {:a 3 :b 4})
(let [{a :a
b :b
:keys [c d]
:or {a 1
c 2}} my-map]
(println ...
Destructurling works in many places, as well as in the param list of an fn:
(defn my-func [[_ a b]]
(+ a b))
(my-func [1 2 3]) ;= 5
(my-func (range 5)) ;= 3
Destructuring also works for the & rest construct in the param list:
(defn my-func2 [& [_ a b]]
(+ a b))
(my-func2 1 ...
Destructuring also gives you the ability to interpret a sequence as a map:
(def my-vec [:a 1 :b 2])
(def my-lst '("smthg else" :c 3 :d 4))
(let [[& {:keys [a b]}] my-vec
[s & {:keys [c d]} my-lst]
(+ a b c d)) ;= 10
It is useful for defining functions with named p...
Predicates that produce side effects leave the realm of pure logic. These are for example:
writeq/1
read/1
format/2
Side effects are phenomena that cannot be reasoned about within the program. For example, deletion of a file or output on the system terminal.
Predicates that reason about instantiations are called meta-logical. Examples are:
var/1
ground/1
integer/1
These predicates are outside the realm of pure monotonic logic programs, because they break properties like commutativity of conjunction.
Other predicates that are meta-logical includ...
In oracle, the difference (in days and/or fractions thereof) between two DATEs can be found using subtraction:
SELECT DATE '2016-03-23' - DATE '2015-12-25' AS difference FROM DUAL;
Outputs the number of days between the two dates:
DIFFERENCE
----------
89
And:
SELECT TO_DATE( '201...
The MEDIAN function since Oracle 10g is an easy to use aggregation function:
SELECT MEDIAN(SAL)
FROM EMP
It returns the median of the values
Works on DATETIME values too.
The result of MEDIAN is computed by first ordering the rows. Using N as the number of rows in the group, Oracle calcula...