Tutorial by Examples: o

In slices the zero value is an empty slice. var myIntSlice []int // [] - an empty slice Use make to create a slice populated with values, any values created in the slice are set to the zero value of the type of the slice. For instance: myIntSlice := make([]int, 5) // [0, 0, 0, 0, 0] - a s...
When creating a struct without initializing it, each field of the struct is initialized to its respective zero value. type ZeroStruct struct { myString string myInt int64 myBool bool } func main() { var myZero = ZeroStruct{} fmt.Printf("Zero values are: %q, %d...
A layout is a view file, which is extended by other views which inject blocks of code into their parent. For example: parent.blade.php: <html> <head> <style type='text/css'> @yield('styling') </style> </head> <body> ...
Shortcodes are useful when you want to be able add more complex elements inline into the normal content editor. A shortcode in it's simplest for would look like this: function my_shortcode( ){ return "This is a shortcode"; } add_shortcode( 'my_shortcode', 'my_shortcode' ); It w...
Here is an example of a simple button short code: <?php function my_button_shortcode( $atts ) { // Parse the input attributes and assgn default values for the // attributes that are not specified on the shortcode $a = shortcode_atts( array( 'id' => '', 'ur...
Orphan nodes/vertices are those lacking all relationships/edges. MATCH (n) WHERE NOT (n)--() DELETE n
btn class of Twitter-bootstrap can be used with any of the following html elements. anchor button input with both type="button" and type="submit" Below are examples of all possible use cases of btn class <a class="btn" href="#" role="button&qu...
twitter-bootstrap-3 has provided four different sizes of buttons Large button btn-lg Default button does not require any btn size Small button btn-sm Extra small button btn-xs <button type="button" class="btn btn-lg">Large button</button> <button type=...
Overriding properties (both read-only and mutable): abstract class Car { abstract val name: String; open var speed: Int = 0; } class BrokenCar(override val name: String) : Car() { override var speed: Int get() = 0 set(value) { throw UnsupportedOpera...
A tsconfig.json file can contain both line and block comments, using the same rules as ECMAScript. //Leading comment { "compilerOptions": { //this is a line comment "module": "commonjs", //eol line comment "target" /*inline bl...
When automating the provisioning of new nodes to a swarm, you need to know what the right join token is for the swarm as well as the advertised address of the manager. You can find this out by running the following commands on any of the existing manager nodes: # grab the ipaddress:port of the mana...
A boolean array can be created manually by using dtype=bool when creating the array. Values other than 0, None, False or empty strings are considered True. import numpy as np bool_arr = np.array([1, 0.5, 0, None, 'a', '', True, False], dtype=bool) print(bool_arr) # output: [ True True False ...
Function pointers are the most basic way of passing functions around, which can also be used in C. (See the C documentation for more details). For the purpose of callable objects, a function pointer can be defined as: typedef returnType(*name)(arguments); // All using name =...
Every class which overloads the operator() can be used as a function object. These classes can be written by hand (often referred to as functors) or automatically generated by the compiler by writing Lambdas from C++11 on. struct Person { std::string name; unsigned int age; }; // Func...
Checkbox is a control that allow user to get boolean values from user for a spesific question like "Are you ok?". Has a event called CheckedChanged, which occurs whenever the check property is changed. Here is a CheckBox that has a question "Is Checked?". We got this Message...
When Vim opens a file with <CR><NL> line endings (common on MSDOS based operating systems, also called CRLF) it will set fileformat to dos, you can check what with: :set fileformat? fileformat=dos Or just :set ff? fileformat=dos To convert it to <NL> line endings (com...
HelloWorld.proj <Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003" DefaultTargets="SayHello"> <!-- Properties can be passed as command line parameters. i.e. /p:Name=MyName or /p:Name="My Name" (Use quotes if the value includes ...
The sample content used here is Tears of Steel, by Blender Foundation. Specifically, we will use the download titled "HD 720p (~365MB, mov, 2.0)". This is a single file that ends with the extension "mov" and will play in just about any modern media player. Note that the download...
The importance of good naming, can be best illustrated by some bad examples: [Test] Test1() {...} //Cryptic name - absolutely no information [Test] TestFoo() {...} //Name of the function - and where can I find the expected behaviour? [Test] TestTFSid567843() {...} //Huh? You want me to lo...
Same as, with writing classes - start with the simple cases, then add requirement (aka tests) and implementation (aka production code) case by case: [Test] public void EnsureThat_IsLeapYearIfDecimalMultipleOf4() {...} [Test] public void EnsureThat_IsNOTLeapYearIfDecimalMultipleOf100 {...} [Tes...

Page 643 of 1038