Tutorial by Examples: c

public class Person { public int PersonID { get; set; } [Column("NameOfPerson")] public string PersonName { get; set; } } Tells Entity Framework to use a specific column name instead using the name of the property. You can also specify the database data type a...
To find active ScriptableObjects during runtime, you can use Resources.FindObjectsOfTypeAll(). T[] instances = Resources.FindObjectsOfTypeAll<T>(); Where T is the type of the ScriptableObject instance you're searching. Active means it has been loaded in memory in some form before. This me...
A shallow copy is a copy of a collection without performing a copy of its elements. >>> import copy >>> c = [[1,2]] >>> d = copy.copy(c) >>> c is d False >>> c[0] is d[0] True
If you have nested lists, it is desireable to clone the nested lists as well. This action is called deep copy. >>> import copy >>> c = [[1,2]] >>> d = copy.deepcopy(c) >>> c is d False >>> c[0] is d[0] False
You can create shallow copies of lists using slices. >>> l1 = [1,2,3] >>> l2 = l1[:] # Perform the shallow copy. >>> l2 [1,2,3] >>> l1 is l2 False
A dictionary object has the method copy. It performs a shallow copy of the dictionary. >>> d1 = {1:[]} >>> d2 = d1.copy() >>> d1 is d2 False >>> d1[1] is d2[1] True
Sets also have a copymethod. You can use this method to perform a shallow copy. >>> s1 = {()} >>> s2 = s1.copy() >>> s1 is s2 False >>> s2.add(3) >>> s1 {[]} >>> s2 {3,[]}
Box Collider A primitive Collider shaped like a cuboid. Properties Is Trigger - If ticked, the Box Collider will ignore physics and become a Trigger Collider Material - A reference, if specified, to the physics material of the Box Collider Center - The Box Collider's central posit...
I create a file called database-servlet.xml somewhere on the classpath. Initially your config file will look like this: <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/...
Active Patterns can be used to make calling some .NET API's feel more natural, particularly those that use an output parameter to return more than just the function return value. For example, you'd normally call the System.Int32.TryParse method as follows: let couldParse, parsedInt = System.Int32....
The @each directive allows you to iterate through any list or map. It takes the form of @each $var or <list or map> {} where $var can be any variable name and <list or map> can be anything that returns a list or map. In the following example, the loop will iterate through the $authors l...
UITextView has extra paddings by default. Sometimes it's annoying especially if you want to measure some text without view instance and place them at some area precisely. Do this to remove such paddings. messageTextView.textContainerInset = UIEdgeInsetsZero messageTextView.textContainer.lineFragm...
The flow or execution of a loop can be controlled by use of break and continue expressions. Break break exits the current loop. In case the loop is nested inside another loop, the parent loop is unaffected. for (i in 0...10) { for (j in 0...10) { if (j == 5) break; trace(i,...
Before starting you must have: Anaconda installed on your system Account on Binstar If you are not using Anaconda 1.6+ install the binstar command line client: $ conda install binstar $ conda update binstar If you are not using Anaconda the Binstar is also available on pypi: $ pip install bin...
Pre -Requsite: Download Visual Studio IDE Create a new project Install specflow visual studio integration, Nunit Adapter & Nunit framework Download specflow for visual studio as shown below
<html> <head> <script src="https://code.jquery.com/jquery-3.1.0.min.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/underscore.js/1.8.3/underscore-min.js"></script> <script src="https:...
The attribute status_code contains the status code of the response good_req = requests.get('https://api.github.com/events') code_200 = good_req.status_code notfound_req = requests.get('https://api.github.com/not_found') code_404 = notfound_req.status_code requests.codes.__dict__ will provid...
<style> input:in-range { border: 1px solid blue; } </style> <input type="number" min="10" max="20" value="15"> <p>The border for this value will be blue</p> The :in-range CSS pseudo-class matches when an element...
Let's say we want to change main loop, only for specific taxonomy, or post type. Targeting only main loop on book post type archive page. add_action( 'pre_get_posts', 'my_callback_function' ); function my_callback_function( $query ) { if( !$query->is_main_query() || is_admin() ) return;...
add_action( 'pre_get_posts', 'single_category' ); function single_category( $query ) { if( !$query->is_main_query() || is_admin() ) return; $query->set( 'cat', '1' ); return; }

Page 369 of 826