Tutorial by Examples

demoApp.directive('demoDirective', function () { var directiveDefinitionObject = { multiElement: priority: terminal: scope: {}, bindToController: {}, controller: controllerAs: require: restrict: templateNamespace: template: templateU...
.SD .SD refers to the subset of the data.table for each group, excluding all columns used in by. .SD along with lapply can be used to apply any function to multiple columns by group in a data.table We will continue using the same built-in dataset, mtcars: mtcars = data.table(mtcars) # Let's not ...
SyncAdapter /** * Define a sync adapter for the app. * <p/> * <p>This class is instantiated in {@link SyncService}, which also binds SyncAdapter to the system. * SyncAdapter should only be initialized in SyncService, never anywhere else. * <p/> * <p>The system ca...
Validating array form input fields is very simple. Suppose you have to validate each name, email and father name in a given array. You could do the following: $validator = \Validator::make($request->all(), [ 'name.*' => 'required', 'email.*' => 'email|unique:users'...
Sometimes it is appropriate to use an immutable empty collection. The Collections class provides methods to get such collections in an efficient way: List<String> anEmptyList = Collections.emptyList(); Map<Integer, Date> anEmptyMap = Collections.emptyMap(); Set<Number> anEmptySe...
In Julia, the @show macro is often useful for debugging purposes. It displays both the expression to be evaluated and its result, finally returning the value of the result: julia> @show 1 + 1 1 + 1 = 2 2 It is straightforward to create our own version of @show: julia> macro myshow(exp...
A pure function is a function that, given the same input, will always return the same output and are side-effect free. // This is a pure function function add($a, $b) { return $a + $b; } Some side-effects are changing the filesystem, interacting with databases, printing to the screen. //...
Partial credit to this SO answer. List Concatenation aggregates a column or expression by combining the values into a single string for each group. A string to delimit each value (either blank or a comma when omitted) and the order of the values in the result can be specified. While it is not part ...
Sometimes you want to add an element to the beginning of an array without modifying any of the current elements (order) within the array. Whenever this is the case, you can use array_unshift(). array_unshift() prepends passed elements to the front of the array. Note that the list of elements is ...
When running from the CLI, PHP exhibits some different behaviours than when run from a web server. These differences should be kept in mind, especially in the case where the same script might be run from both environments. No directory change When running a script from a web server, the current w...
The INITCAP function converts the case of a string so that each word starts with a capital letter and all subsequent letters are in lowercase. SELECT INITCAP('HELLO mr macdonald!') AS NEW FROM dual; Output NEW ------------------- Hello Mr Macdonald!
Dynamic binding, also referred as method overriding is an example of run time polymorphism that occurs when multiple classes contain different implementations of the same method, but the object that the method will be called on is unknown until run time. This is useful if a certain condition dicta...
LOWER converts all uppercase letters in a string to lowercase. SELECT LOWER('HELLO World123!') text FROM dual; Outputs: texthello world123!
we can use filters to sanitize our variable according to our need. Example $string = "<p>Example</p>"; $newstring = filter_var($string, FILTER_SANITIZE_STRING); var_dump($newstring); // string(7) "Example" above will remove the html tags from $string variable. ...
The @var keyword can be used to describe the type and usage of: a class property a local or global variable a class or global constant class Example { /** @var string This is something that stays the same */ const UNCHANGING = "Untouchable"; /** @var string $some_s...
NLog.Extensions.Logging is the official NLog provider for Microsoft's in .NET Core and ASP.NET Core. Here and here are instruction and example respectively.
There are a number of different ways to install the AWS CLI on your machine, depending on what operating system and environment you are using: On Microsoft Windows – use the MSI installer. On Linux, OS X, or Unix – use pip (a package manager for Python software) or install manually with the bundle...
void doSomething(String... strings) { for (String s : strings) { System.out.println(s); } } The three periods after the final parameter's type indicate that the final argument may be passed as an array or as a sequence of arguments. Varargs can be used only in the final argume...
The preferred way of describing dependencies is by using constructor injection which follows Explicit Dependencies Principle: ITestService.cs public interface ITestService { int GenerateRandom(); } TestService.cs public class TestService : ITestService { public int GenerateRando...
Builtin container comes with a set of builtin features : Lifetime control public void ConfigureServices(IServiceCollection services) { // ... services.AddTransient<ITestService, TestService>(); // or services.AddScoped<ITestService, TestSer...

Page 239 of 1336