Tutorial by Examples: e

UserType belongs to many Users <-> Users have one UserType One way navigation property with required public class UserType { public int UserTypeId {get; set;} } public class User { public int UserId {get; set;} public int UserTypeId {get; set;} public virtual UserType...
EntityFramewok Fluent API is a powerful and elegant way of mapping your code-first domain models to underlying database. This also can be used with code-first with existing database. You have two options when using Fluent API: you can directly map your models on OnModelCreating method or you can cre...
By using the .HasKey() method, a property can be explicitly configured as primary key of the entity. using System.Data.Entity; // .. public class PersonContext : DbContext { // .. protected override void OnModelCreating(DbModelBuilder modelBuilder) { // .. ...
By using the .HasKey() method, a set of properties can be explicitly configured as the composite primary key of the entity. using System.Data.Entity; // .. public class PersonContext : DbContext { // .. protected override void OnModelCreating(DbModelBuilder modelBuilder) {...
By using the .HasMaxLength() method, the maximum character count can be configured for a property. using System.Data.Entity; // .. public class PersonContext : DbContext { // .. protected override void OnModelCreating(DbModelBuilder modelBuilder) { // .. ...
By using the .IsRequired() method, properties can be specified as mandatory, which means that the column will have a NOT NULL constraint. using System.Data.Entity; // .. public class PersonContext : DbContext { // .. protected override void OnModelCreating(DbModelBuilder modelB...
There are two common ways to encode a POST request body: URL encoding (application/x-www-form-urlencoded) and form data (multipart/form-data). Much of the code is similar, but the way you construct the body data is different. Sending a request using URL encoding Be it you have a server for your s...
In GSP the <%= %> syntax is rarely used due to the support for GSP expressions. A GSP expression is similar to a JSP EL expression or a Groovy GString and takes the form ${expr}: <html> <body> Hello ${params.name} </body> </html> However, unlike JSP EL ...
Media queries are not supported at all in IE8 and below. A Javascript based workaround To add support for IE8, you could use one of several JS solutions. For example, Respond can be added to add media query support for IE8 only with the following code : <!--[if lt IE 9]> <script ...
The POSIX and C standards explicitly state that using fflush on an input stream is undefined behavior. The fflush is defined only for output streams. #include <stdio.h> int main() { int i; char input[4096]; scanf("%i", &i); fflush(stdin); // <-- unde...
"The :nth-child(an+b) CSS pseudo-class matches an element that has an+b-1 siblings before it in the document tree, for a given positive or zero value for n" - MDN :nth-child pseudo-selector12345678910:first-child✔:nth-child(3)✔:nth-child(n+3)✔✔✔✔✔✔✔✔:nth-child(3n)✔✔✔:nth-child(3n+1)...
Using alarm, user can schedule SIGALARM signal to be raised after specified interval. In case user did not blocked, ignored or specified explicit signal handler for this signal, the default action for this signal will be performed on arrival. Per specification default action for SIGALARM is to termi...
This program demonstrates how to run another process using fork() and wait its termination using waitpid(): fork() creates an identical copy of the current process. The original process is the parent process, while the newly created one is the child process. Both processes continue exactly afte...
To view all the implicits in-scope during a REPL session: scala> :implicits To also include implicit conversions defined in Predef.scala: scala> :implicits -v If one has an expression and wishes to view the effect of all rewrite rules that apply to it (including implicits): scala> ...
Given a noisy signal: import numpy as np import matplotlib.pyplot as plt np.random.seed(1) x = np.linspace(0,2*np.pi,100) y = np.sin(x) + np.random.random(100) * 0.2 plt.plot(x,y) plt.show() one can smooth it using a Savitzky–Golay filter using the scipy.signal.savgol_filter() method...
The ranges of the integer types are implementation-defined. The header <limits> provides the std::numeric_limits<T> template which provides the minimum and maximum values of all fundamental types. The values satisfy guarantees provided by the C standard through the <climits> and (&...
Since workers run in a separate thread from the one that created them, communication needs to happen via postMessage. Note: Because of the different export prefixes, some browsers have webkitPostMessage instead of postMessage. You should override postMessage to make sure workers "work" (n...
If a class, enum, inline function, template, or member of a template has external linkage and is defined in multiple translation units, all definitions must be identical or the behavior is undefined according to the One Definition Rule (ODR). foo.h: class Foo { public: double x; private...
Use the link attribute in the document's head: <head> <link rel="stylesheet" type="text/css" href="stylesheet.css"> </head> You can also use stylesheets provided from websites via a content delivery network, or CDN for short. (for example, Bo...
You can also include CSS elements internally by using the <style> tag: <head> <style type="text/css"> body { background-color: gray; } </style> </head> Multiple internal stylesheets can be included in a program as...

Page 543 of 1191