Tutorial by Examples: c

// 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...
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...
Base plot install.packages('survminer') source("https://bioconductor.org/biocLite.R") biocLite("RTCGA.clinical") # data for examples library(RTCGA.clinical) survivalTCGA(BRCA.clinical, OV.clinical, extract.cols = "admin.disease_code") -> BRCAOV.sur...
Just run: svn delete https://svn.example.com/svn/MyRepo/MyProject/branches/MyNewBranch -m "Deleting no longer needed MyNewBranch" Or, using the short URL: svn delete ^/branches/MyNewBranch -m "Deleting no longer needed MyNewBranch" In Windows, you need to use ^^ You ...
Using unserialize function to unserialize data from user input can be dangerous. A Warning from php.net Warning Do not pass untrusted user input to unserialize(). Unserialization can result in code being loaded and executed due to object instantiation and autoloading, and a malicious user may ...
A CROSS JOIN performs a join between two tables that does not use an explicit join clause and results in the Cartesian product of two tables. A Cartesian product means each row of one table is combined with each row of the second table in the join. For example, if TABLEA has 20 rows and TABLEB has 2...
reduce(_:combine:) can be used in order to combine the elements of a sequence into a single value. It takes an initial value for the result, as well as a closure to apply to each element – which will return the new accumulated value. For example, we can use it to sum an array of numbers: let numbe...
Sometimes the default Scrapy user agent ("Scrapy/VERSION (+http://scrapy.org)") is blocked by the host. To change the default user agent open settings.py, uncomment and edit the following line to what ever you want. #USER_AGENT = 'projectName (+http://www.yourdomain.com)' For example ...
This example shows how to create a table, insert data, and select from the database using SQLAlchemy Core. For information re: the SQLAlchemy ORM, see here. First, we'll need to connect to our database. from sqlalchemy import create_engine engine = create_engine('sqlite://') The engine is ...
Reading line by line awk '/^>/ {printf("%s%s\t",(N>0?"\n":""),$0);N++;next;} {printf("%s",$0);} END {printf("\n");}' < input.fa one can read this awk script as: if the current line ($0) starts like a fasta header (^>). Then we prin...
download and linearize the 10 first FASTA sequences from UniProt: $ curl -s "ftp://ftp.uniprot.org/pub/databases/uniprot/current_release/knowledgebase/complete/uniprot_sprot.fasta.gz" |\ gunzip -c |\ awk '/^>/ {printf("%s%s\t",(N>0?"\n":""),$0);N...
In order to create a hotkey or hotstring that only triggers when certain windows are active or exist, you can put one or several of the following directives before the hotkey definition: #IfWinActive [, WinTitle, WinText] #IfWinExist [, WinTitle, WinText] #IfWinNotActive [, WinTitle, WinText] #I...
Default config is configured in import org.fusesource.restygwt.client.Defaults; Service root. By default, RestyGWT will use module name to get rest service root, to change it, call on module load: Defaults.setServiceRoot("/rest/"); Date format. By default, RestyGWT will send u...
# the usual boilerplate setup cmake_minimum_required(2.8) project(my_test_project LANGUAGES CXX) # tell CMake to use CTest extension enable_testing() # create an executable, which instantiates a runner from # GoogleTest, Boost.Test, QtTest or whatever framework you use add_execut...

Page 352 of 826