Tutorial by Examples: c

Query: query:/sitecore/content/home/foo/bar Result bar
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...
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...
In most text editors, the standard shortcut for saving the current document is Ctrl+S (or Cmd+S on macOS). Vim doesn't have this feature by default but this can be mapped to make things easier. Adding the following lines in .vimrc file will do the job. nnoremap <c-s> :w<CR> inoremap &...
Consider 2 MySQL Servers for replication setup, one is a Master and the other is a Slave. We are going to configure the Master that it should keep a log of every action performed on it. We are going to configure the Slave server that it should look at the log on the Master and whenever changes happ...
Whenever there is an error while running a query on the slave, MySQL stop replication automatically to identify the problem and fix it. This mainly because an event caused a duplicate key or a row was not found and it cannot be updated or deleted. You can skip such errors, even if this is not recomm...
UILabel *label=[[UILabel alloc]initWithFrame:CGRectMake(0, 0, 320, 480)]; label.backgroundColor=[UIColor lightGrayColor]; NSMutableAttributedString *attributedString; attributedString = [[NSMutableAttributedString alloc] initWithString:@"Apply Underlining"]; [attributedString addAttrib...
import #include <math.h> The code in the viewDidLoad or loadView should look something look something like this - (void)loadView { [super loadView]; UIImageView *imageView=[[UIImageView alloc]initWithFrame:CGRectMake(0, 50, 320, 320)]; [self.view addSubview:imageView]; UIImage *image=[U...
The basic usage is: mysql> CREATE USER 'my_new_user'@'localhost' IDENTIFIED BY 'test_password'; However for situations where is not advisable to hard-code the password in cleartext it is also possible to specify directly, using the directive PASSWORD, the hashed value as returned by the PASS...

Page 601 of 826