Tutorial by Examples

Given the following file: hello how are you i am fine let's go, you! let's go, baby! grep with look-behind allows to print only some parts: $ grep -Po "(?<=let's go, ).*" file you! baby! In this case, it matches what occurs after "let's go, ".
To make a new directory from a File instance you would need to use one of two methods: mkdirs() or mkdir(). mkdir() - Creates the directory named by this abstract pathname. (source) mkdirs() - Creates the directory named by this abstract pathname, including any necessary but nonexistent parent d...
Returns a string value in reversed order. Parameters: string expression. Any string or binary data that can be implicitly converted to varchar. Select REVERSE('Sql Server') -- Returns 'revreS lqS'
Returns the starting position of the first occurrence of a the specified pattern in the specified expression. Parameters: pattern. A character expression the contains the sequence to be found. Limited to A maximum length of 8000 chars. Wildcards (%, _) can be used in the pattern. If the patter...
NgZone reference can be injected via the Dependency Injection (DI). my.component.ts import { Component, NgOnInit, NgZone } from '@angular/core'; @Component({...}) export class Mycomponent implements NgOnInit { constructor(private _ngZone: NgZone) { } ngOnInit() { this._ngZone.runO...
runOutsideAngular can be used to run code outside Angular 2 so that it does not trigger change detection unnecessarily. This can be used to for example run multiple HTTP request to get all the data before rendering it. To execute code again inside Angular 2, run method of NgZone can be used. my.com...
Returns a string (varchar) of repeated spaces. Parameters: integer expression. Any integer expression, up to 8000. If negative, null is returned. if 0, an empty string is returned. (To return a string longer then 8000 spaces, use Replicate. SELECT SPACE(-1) -- Returns NULL SELECT SPACE(0) -...
Repeats a string value a specified number of times. Parameters: string expression. String expression can be a character string or binary data. integer expression. Any integer type, including bigint. If negative, null is returned. If 0, an empty string is returned. SELECT REPLICATE('a', -1) ...
// Global.asax.cs calls this method at application start public static void Register(HttpConfiguration config) { // New code config.EnableCors(); } //Enabling CORS for controller after the above registration [EnableCors(origins: "http://example.com", headers: "*"...
public static void Register(HttpConfiguration config) { var corsAttr = new EnableCorsAttribute("http://example.com", "*", "*"); config.EnableCors(corsAttr); }
public void ConfigureServices(IServiceCollection services) { services.AddCors(o => o.AddPolicy("MyPolicy", builder => { builder.AllowAnyOrigin() .AllowAnyMethod() .AllowAnyHeader(); })); // ... } public void Configur...
public void ConfigureServices(IServiceCollection services) { services.AddMvc(); services.AddCors(); services.ConfigureCors(options => options.AddPolicy("AllowSpecific", p => p.WithOrigins("http://localhost:1233") ...
Definition of the category The Haskell types along with functions between types form (almost†) a category. We have an identity morphism (function) (id :: a -> a) for every object (type) a; and composition of morphisms ((.) :: (b -> c) -> (a -> b) -> a -> c), which obey category la...
Categorical products In category theory, the product of two objects X, Y is another object Z with two projections: π₁ : Z → X and π₂ : Z → Y; such that any other two morphisms from another object decompose uniquely through those projections. In other words, if there exist f₁ : W → X and f₂ : W →...
This example is not tied to any concrete GUI toolkit, like reactive-banana-wx does, for instance. Instead it shows how to inject arbitary IO actions into FRP machinery. The Control.Event.Handler module provides an addHandler function which creates a pair of AddHandler a and a -> IO () values. Th...
In reactive-banana the Event type represents a stream of some events in time. An Event is similar to an analog impulse signal in the sense that it is not continuous in time. As a result, Event is an instance of the Functor typeclass only. You can't combine two Events together because they may fire a...
To represent continious signals, reactive-banana features Behavior a type. Unlike Event, a Behavior is an Applicative, which lets you combine n Behaviors using an n-ary pure function (using <$> and <*>). To obtain a Behavior a from the Event a there is accumE function: main = do (...
When applied to a property of a domain class, the database will create a NOT NULL column. using System.ComponentModel.DataAnnotations; public class Person { public int PersonID { get; set; } [Required] public string PersonName { get; set; } } The resulting column wi...
[MaxLength(int)] attribute can be applied to a string or array type property of a domain class. Entity Framework will set the size of a column to the specified value. using System.ComponentModel.DataAnnotations; public class Person { public int PersonID { get; set; } [MinLength(...
services/my.service.ts import { Injectable } from '@angular/core'; @Injectable() export class MyService { data: any = [1, 2, 3]; getData() { return this.data; } } The service provider registration in the bootstrap method will make the service available globally. main.ts im...

Page 565 of 1336