Tutorial by Examples: f

<form asp-action="create" asp-controller="Home"> <!--Your form elements goes here--> </form>
<form asp-action="create" asp-controller="Home" asp-route-returnurl="dashboard" asp-route-from="google"> <!--Your form elements goes here--> </form> This will generate the below markup <form action=&qu...
Extension methods enable you to simplify your interface definitions by only including core required functionality in the interface itself and allowing you to define convenience methods and overloads as extension methods. Interfaces with fewer methods are easier to implement in new classes. Keeping o...
An interface is a definition of a contract between the user of the interface and the class that implement it. One way to think of an interface is as a declaration that an object can perform certain functions. Let's say that we define an interface IShape to represent different type of shapes, we exp...
First, we'll need to do some setup to get HStoreField working. make sure django.contrib.postgres is in your `INSTALLED_APPS Add HStoreExtension to your migrations. Remember to put HStoreExtension before any CreateModel or AddField migrations. from django.contrib.postgres.operations import HSt...
-> Note: make sure you set up HStoreField first before going on with this example. (above) No parameters are required for initializing a HStoreField. from django.contrib.postgres.fields import HStoreField from django.db import models class Catalog(models.model): name = models.C...
Catalog.objects.filter(titles__Pro_Git='Scott Chacon and Ben Straub')
The @for directive allows you to loop through some code for a set amount of iterations and has two forms: @for <var> from <start> through <end> {} @for <var> from <start> to <end> {} The difference in the two forms is the through and the to; the through key...
You often find yourself in a situation where you need to find a variables corresponding value, and collections got you covered. In the example below we got three different locales in an array with a corresponding calling code assigned. We want to be able to provide a locale and in return get the as...
Imagine that a system want to detect apples and oranges in a basket of fruits. System can pick a fruit, extract some property of it (e.g weight of that fruit). Suppose System has a Teacher! that teaches the system which objects are apples and which are oranges. This is an example of a supervised cl...
You can also turn on more tests, such as: valgrind -q --tool=memcheck --leak-check=yes ./my-program arg1 arg2 < test-input See valgrind --help for more information about the (many) options, or look at the documentation at http://valgrind.org/ for detailed information about what the output mea...
Here is a program that calls malloc but not free: #include <stdio.h> #include <stdlib.h> int main(int argc, char **argv) { char *s; s = malloc(26); // the culprint return 0; } With no extra arguments, valgrind will not look for this error. But if we turn on...
Unary folds are used to fold parameter packs over a specific operator. There are 2 kinds of unary folds: Unary Left Fold (... op pack) which expands as follows: ((Pack1 op Pack2) op ...) op PackN Unary Right Fold (pack op ...) which expands as follows: Pack1 op (... (Pack(N-1) op Pac...
Binary folds are basically unary folds, with an extra argument. There are 2 kinds of binary folds: Binary Left Fold - (value op ... op pack) - Expands as follows: (((Value op Pack1) op Pack2) op ...) op PackN Binary Right Fold (pack op ... op value) - Expands as follows: Pack1 op (......
Quantifiers allows to specify count of repeated strings. Zero or one: /a?/ Zero or many: /a*/ One or many: /a+/ Exact number: /a{2,4}/ # Two, three or four /a{2,}/ # Two or more /a{,4}/ # Less than four (including zero) By default, quantifiers are greedy, whi...
Unions are a specialized struct within which all members occupy overlapping memory. union U { int a; short b; float c; }; U u; //Address of a and b will be equal (void*)&u.a == (void*)&u.b; (void*)&u.a == (void*)&u.c; //Assigning to any union member changes ...
ClientContext clientContext = new ClientContext(siteUrl); Web oWebsite = clientContext.Web; clientContext.Load(oWebsite); clientContext.ExecuteQuery(); Console.WriteLine("Title: {0} Description: {1}", oWebsite.Title, oWebsite.Description);
ClientContext clientContext = new ClientContext(siteUrl); Web oWebsite = clientContext.Web; clientContext.Load( oWebsite, website => website.Title, website => website.Created); clientContext.ExecuteQuery(); Console.WriteLine("Title: {...
ClientContext clientContext = new ClientContext(siteUrl); Web oWebsite = context.Web; oWebsite.Title = "Updated Web Site"; oWebsite.Description = "This is an updated Web site."; oWebsite.Update(); clientContext.ExecuteQuery();
ClientContext clientContext = new ClientContext(siteUrl); Web oWebsite = clientContext.Web; ListCollection collList = oWebsite.Lists; clientContext.Load(collList); clientContext.ExecuteQuery(); foreach (List oList in collList) { Console.WriteLine("Title: {0} Created: {1}",...

Page 109 of 457