Tutorial by Examples: c

A static member function is just like an ordinary C/C++ function, except with scope: It is inside a class, so it needs its name decorated with the class name; It has accessibility, with public, protected or private. So, if you have access to the static member function and decorate it correctl...
To access a member function of a class, you need to have a "handle" to the particular instance, as either the instance itself, or a pointer or reference to it. Given a class instance, you can point to various of its members with a pointer-to-member, IF you get the syntax correct! Of course...
A static member variable is just like an ordinary C/C++ variable, except with scope: It is inside a class, so it needs its name decorated with the class name; It has accessibility, with public, protected or private. So, if you have access to the static member variable and decorate it correctl...
sp_who2 This procedure can be used to find information on current SQL server sessions. Since it is a procedure, it's often helpful to store the results into a temporary table or table variable so one can order, filter, and transform the results as needed. The below can be used for a queryable v...
To create a mixin use the @mixin directive. @mixin default-box ($color, $borderColor) { color: $color; border: 1px solid $borderColor; clear: both; display: block; margin: 5px 0; padding: 5px 10px; } You can specify a list of arguments inside a parenthesis followin...
string nullString = null; string emptyString = ""; string whitespaceString = " "; string tabString = "\t"; string newlineString = "\n"; string nonEmptyString = "abc123"; bool result; result = String.IsNullOrEmpty(nullString); ...
Declaring a generic interface interface IResult<T> { wasSuccessfull: boolean; error: T; } var result: IResult<string> = .... var error: string = result.error; Generic interface with multiple type parameters interface IRunnable<T, U> { run(input: T): U; } ...
class Result<T> { constructor(public wasSuccessful: boolean, public error: T) { } public clone(): Result<T> { ... } } let r1 = new Result(false, 'error: 42'); // Compiler infers T to string let r2 = new Result(false, 42); // Compiler infers T...
Simple constraint: interface IRunnable { run(): void; } interface IRunner<T extends IRunnable> { runSafe(runnable: T): void; } More complex constraint: interface IRunnble<U> { run(): U; } interface IRunner<T extends IRunnable<U>, U> { runSafe...
In interfaces: interface IRunner { runSafe<T extends IRunnable>(runnable: T): void; } In classes: class Runner implements IRunner { public runSafe<T extends IRunnable>(runnable: T): void { try { runnable.run(); } catch(e) { } ...
Create generic class instance: var stringRunnable = new Runnable<string>(); Run generic function: function runSafe<T extends Runnable<U>, U>(runnable: T); // Specify the generic types: runSafe<Runnable<string>, string>(stringRunnable); // Let typescript figu...
Using the mmap module allows the user to randomly access locations in a file by mapping the file into memory. This is an alternative to using normal file operations. import mmap with open('filename.ext', 'r') as fd: # 0: map the whole file mm = mmap.mmap(fd.fileno(), 0) # print ...
Prefabs are an asset type that allows the storage of a complete GameObject with its components, properties, attached components and serialized property values. There are many scenarios where this is useful, including: Duplicating objects in a scene Sharing a common object across multiple scenes ...
If you are familiar with jQuery and Sizzle syntax, d3 selections should not be much different. d3 mimics the W3C Selectors API to make interacting with elements easier. For a basic example, to select all <p> and add a change to each of them: d3.selectAll('p') .attr('class','textClass') ...
You can alternatively use an Object Declaration that contains the main function for a Kotlin program. package my.program object App { @JvmStatic fun main(args: Array<String>) { println("Hello World") } } The class name that you will run is the name of you...
Similar to using an Object Declaration, you can define the main function of a Kotlin program using a Companion Object of a class. package my.program class App { companion object { @JvmStatic fun main(args: Array<String>) { println("Hello World") ...
TYPO3 Extbase extension development method came along with the release of TYPO3 4.3.0 in November 2009. Extbase is a PHP-based framework which supports developers in creating clean and easily maintainable TYPO3 extensions.The first real presentation of Extbase happened in April 2009 on the american ...
Haskell supports a notion of class extension. For example, the class Ord inherits all of the operations in Eq, but in addition has a compare function that returns an Ordering between values. Ord may also contain the common order comparison operators, as well as a min method and a max method. The =&...
From ES5.1 onwards, you can use the native method Array.prototype.filter to loop through an array and leave only entries that pass a given callback function. In the following example, our callback checks if the given value occurs in the array. If it does, it is a duplicate and will not be copied to...
The <div> element usually has no specific semantic meaning by itself, simply representing a division, and is typically used for grouping and encapsulating other elements within an HTML document and separating those from other groups of content. As such, each <div> is best described by it...

Page 163 of 826