Tutorial by Examples

Creating a new array is slightly confusing, as there is no real identifier for an array in awk. So, an array cannot really be initialised with our AWK code. An array in awk is associative, meaning that any string or number can be a key. This means that the array is more like a key-value pair dictio...
The following example will contain a block of code that is meant to be split into several source files, as denoted by // filename comments. Source Files // my_function.h /* Note how this header contains only a declaration of a function. * Header functions usually do not define implementations...
Templates require compile-time generation of code: a templated function, for example, will be effectively turned into multiple distinct functions once a templated function is parameterized by use in source code. This means that template function, member function, and class definitions cannot be del...
Query: query:/sitecore/content/home/foo/bar Result bar
Current Item: bar (path: /sitecore/content/home/foo/bar) Query: query:./child/grandchild Result: grandchild (path: /sitecore/content/home/foo/bar/child/grandchild)
Query: query:/sitecore/content/[@@templatename='Homepage'] Result: home (name: home, path: /sitecore/content/home, template name: Homepage)
Tree structure: /sitecore /content /foo-site /home /my-account /bar-site /home /my-account /baz-site /home /my-account The template of each site item (foo-site, bar-site, b...
Overview The transpose function is one of Bosun's more powerful functions, but it also takes effort to understand. It is powerful because it lets us alert at different levels than the tag structure of the underlying data. Transpose changes the scope of your alert. This lets you scope things into l...
using System; [assembly:CLSCompliant(true)] namespace CLSDoc { public class Cat { internal UInt16 _age = 0; private UInt16 _daysTillVacination = 0; //Warning CS3003 Type of 'Cat.DaysTillVacination' is not CLS-compliant protected UInt16 DaysT...
using System; [assembly:CLSCompliant(true)] namespace CLSDoc { public class Car { internal UInt16 _yearOfCreation = 0; //Warning CS3008 Identifier '_numberOfDoors' is not CLS-compliant //Warning CS3003 Type of 'Car._numberOfDoors' is not CLS-compli...
using System; [assembly:CLSCompliant(true)] namespace CLSDoc { public class Car { //Warning CS3005 Identifier 'Car.CALCULATEAge()' differing only in case is not CLS-compliant public int CalculateAge() { return 0; } ...
using System; [assembly:CLSCompliant(true)] namespace CLSDoc { public class Car { //Warning CS3008 Identifier '_age' is not CLS-complian public int _age = 0; } } You can not start variable with _
using System; [assembly:CLSCompliant(true)] namespace CLSDoc { [CLSCompliant(false)] public class Animal { public int age = 0; } //Warning CS3009 'Dog': base type 'Animal' is not CLS-compliant public class Dog : Animal { } }
Breadth-first-search (BFS) is an algorithm for traversing or searching tree or graph data structures. It starts at the tree root (or some arbitrary node of a graph, sometimes referred to as a 'search key') and explores the neighbor nodes first, before moving to the next level neighbors. BFS was inve...
Most of the time, we'll need to find out the shortest path from single source to all other nodes or a specific node in a 2D graph. Say for example: we want to find out how many moves are required for a knight to reach a certain square in a chessboard, or we have an array where some cells are blocked...
Detailed instructions on getting actionscript set up or installed.
const correctness is the practice of designing code so that only code that needs to modify an instance is able to modify an instance (i.e. has write access), and conversely, that any code that doesn't need to modify an instance is unable to do so (i.e. only has read access). This prevents the insta...
In a const-correct class, all member functions which don't change logical state have this cv-qualified as const, indicating that they don't modify the object (apart from any mutable fields, which can freely be modified even in const instances); if a const cv-qualified function returns a reference, t...
In a const-correct function, all passed-by-reference parameters are marked as const unless the function directly or indirectly modifies them, preventing the programmer from inadvertently changing something they didn't mean to change. This allows the function to take both const and non-cv-qualified ...
;;Find the nth Fibonacci number for any n > 0. ;; Precondition: n > 0, n is an integer. Behavior undefined otherwise. (defun fibonacci (n) (cond ( ;; Base case. ;; The first two Fibonacci numbers (indices 1 and 2) are 1 by defin...

Page 965 of 1336