Tutorial by Examples: ee

Remove all characters except letters, digits and !#$%&'*+-=?^_`{|}~@.[]. var_dump(filter_var('[email protected]', FILTER_SANITIZE_EMAIL)); var_dump(filter_var("!#$%&'*+-=?^_`{|}~.[]@example.com", FILTER_SANITIZE_EMAIL)); var_dump(filter_var('john/@example.com', FILTER_SANITIZE_EM...
As well as allowing module entities to have access control (being public or private) modules entities may also have the protect attribute. A public protected entity may be use associated, but the used entity is subject to restrictions on its use. module mod integer, public, protected :: i=1 en...
The minimum required to use Webpack is the following command: webpack ./src/index.js ./dist/bundle.js // this is equivalent to: webpack source-file destination-file Web pack will take the source file, compile to the output destination and resolve any dependencies in the source files.
Let's say we have model Travel with many related fields: class Travel(models.Model): tags = models.ManyToManyField( Tag, related_name='travels', ) route_places = models.ManyToManyField( RoutePlace, related_name='travels', ) coordinate = models.F...
There are a few ways to catch multiple exceptions. The first is by creating a tuple of the exception types you wish to catch and handle in the same manner. This example will cause the code to ignore KeyError and AttributeError exceptions. try: d = {} a = d[1] b = d.non_existing_fiel...
Angular supports three types of expressions in the ng-class directive. 1. String <span ng-class="MyClass">Sample Text</span> Specifying an expression that evaluates to a string tells Angular to treat it as a $scope variable. Angular will check the $scope and look for a va...
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"> <path d="M 10,10 V 200" stroke="green" stroke-width="5" /> </svg> Result:
A derived type is extensible if it has neither the bind attribute nor the sequence attribute. Such a type may be extended by another type. module mod type base_type integer i end type base_type type, extends(base_type) :: higher_type integer j end type higher_type end ...
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...
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 ...
create table empl ( name text primary key, boss text null references name on update cascade on delete cascade default null ); insert into empl values ('Paul',null); insert into empl values ('Luke','Paul'); insert into empl values ('Kate'...
SequenceEqual is used to compare two IEnumerable<T> sequences with each other. int[] a = new int[] {1, 2, 3}; int[] b = new int[] {1, 2, 3}; int[] c = new int[] {1, 3, 2}; bool returnsTrue = a.SequenceEqual(b); bool returnsFalse = a.SequenceEqual(c);
One of the uses of recursion is to navigate through a hierarchical data structure, like a file system directory tree, without knowing how many levels the tree has or the number of objects on each level. In this example, you will see how to use recursion on a directory tree to find all sub-directorie...
Sometimes you need to keep a linear (non-branching) history of your code commits. If you are working on a branch for a while, this can be tricky if you have to do a regular git pull since that will record a merge with upstream. [alias] up = pull --rebase This will update with your upstream so...
C++17 Normally, elision is an optimization. While virtually every compiler support copy elision in the simplest of cases, having elision still places a particular burden on users. Namely, the type who's copy/move is being elided must still have the copy/move operation that was elided. For example:...
If you return a prvalue expression from a function, and the prvalue expression has the same type as the function's return type, then the copy from the prvalue temporary can be elided: std::string func() { return std::string("foo"); } Pretty much all compilers will elide the tempor...
If you return an lvalue expression from a function, and this lvalue: represents an automatic variable local to that function, which will be destroyed after the return the automatic variable is not a function parameter and the type of the variable is the same type as the function's return type ...
public class Foo { private const int TASK_ITERATION_DELAY_MS = 1000; private CancellationTokenSource _cts; public Foo() { this._cts = new CancellationTokenSource(); } public void StartExecution() { Task.Factory.StartNew(this.OwnCodeCancelable...
Unlike durations, periods can be used to accurately model clock times without knowing when events such as leap seconds, leap days, and DST changes occur. start_2012 <- ymd_hms("2012-01-01 12:00:00") ## [1] "2012-01-01 12:00:00 UTC" # period() considers leap year calculati...
GROUP BY is used in combination with aggregation functions. Consider the following table: orderIduserIdstoreNameorderValueorderDate143Store A2520-03-2016257Store B5022-03-2016343Store A3025-03-2016482Store C1026-03-2016521Store A4529-03-2016 The query below uses GROUP BY to perform aggregated calc...

Page 11 of 54