Tutorial by Examples: dc

Unlike a named class or struct, unnamed classes and structs must be instantiated where they are defined, and cannot have constructors or destructors. struct { int foo; double bar; } foobar; foobar.foo = 5; foobar.bar = 4.0; class { int baz; public: int buzz; ...
Break and continue keywords work like they do in other languages. while(true) { if(condition1) { continue // Will immediately start the next iteration, without executing the rest of the loop body } if(condition2) { break // Will exit the loop completely } } ...
Observables are broadly categorised as Hot or Cold, depending on their emission behaviour. A Cold Observable is one which starts emitting upon request(subscription), whereas a Hot Observable is one that emits regardless of subscriptions. Cold Observable /* Demonstration of a Cold Observable */ Ob...
A cell in a grid or treegrid. <table role="grid"> <thead> <!-- etc --> </thead> <tbody> <tr> <td role="gridcell">17</td> <td role="gridcell">64</td> <td role="gr...
The DATEDIF function returns the difference between two date values, based on the interval specified. It is provided for compatibility with Lotus 1-2-3. The DATEDIF function cannot be found on the function list and autocomplete and screen tips are unavailable. Note: It is pronounced "date diff&...
Large fluent assertions do become harder to read, but when combined with classes that have good implementations of ToString(), they can generate very useful error messages. [Test] public void AdvancedContraintsGiveUsefulErrorMessages() { Assert.That(actualCollection, Has .Count.Equa...
The apply and call methods in every function allow it to provide a custom value for this. function print() { console.log(this.toPrint); } print.apply({ toPrint: "Foo" }); // >> "Foo" print.call({ toPrint: "Foo" }); // >> "Foo" You mig...
If you need to search an ActiveRecord model for similar values, you might be tempted to use LIKE or ILIKE but this isn't portable between database engines. Similarly, resorting to always downcasing or upcasing can create performance issues. You can use ActiveRecord's underlying Arel matches method...
GCD will guarantee that your singleton only gets instantiated once, even if called from multiple threads. Insert this into any class for a singleton instance called shared. + (instancetype)shared { // Variable that will point to the singleton instance. The `static` // modifier makes it ...
Arithmetic operations are performed elementwise on Numpy arrays. For arrays of identical shape, this means that the operation is executed between elements at corresponding indices. # Create two arrays of the same size a = np.arange(6).reshape(2, 3) b = np.ones(6).reshape(2, 3) a # array([0, 1...
Controlled form components are defined with a value property. The value of controlled inputs is managed by React, user inputs will not have any direct influence on the rendered input. Instead, a change to the value property needs to reflect this change. class Form extends React.Component { con...
Uncontrolled components are inputs that do not have a value property. In opposite to controlled components, it is the application's responsibility to keep the component state and the input value in sync. class Form extends React.Component { constructor(props) { super(props); th...
The pattern matching library trivia provides a system trivia.ppcre that allows captured groups to be bound through pattern matching (trivia:match "John Doe" ((trivia.ppcre:ppcre "(.*)\\W+(.*)" first-name last-name) (list :first-name first-name :last-name last-name))) ;...
On CLiki, a Wiki for Common Lisp and free Common Lisp software, a list of Proposed ANSI Revisions and Clarifications is being maintained. Since the Common Lisp standard has not changed since 1994, users have found several problems with the specification document. These are documented on the CLiki p...
To store and retrieve encrypted credentials easily, use PowerShell's built-in XML serialization (Clixml): $credential = Get-Credential $credential | Export-CliXml -Path 'C:\My\Path\cred.xml' To re-import: $credential = Import-CliXml -Path 'C:\My\Path\cred.xml' The important thing to remem...
1. Character Class Character class is denoted by []. Content inside a character class is treated as single character separately. e.g. suppose we use [12345] In the example above, it means match 1 or 2 or 3 or 4 or 5 . In simple words, it can be understood as or condition for single characters (...
Stackage is a repository for Haskell packages. We can add these packages to a stack project. Adding lens to a project. In a stack project, there is a file called stack.yaml. In stack.yaml there is a segment that looks like: resolver: lts-6.8 Stackage keeps a list of packages for every revision...
The width and height attributes designate the dimensions of the rectangle. These values are in pixels by default The fill value sets the color for the rectangle. If no value for fill is specified, black is used by default <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="h...
In XAML: <RadioButton IsChecked="{Binding EntityValue, Mode=TwoWay, Converter={StaticResource StringToIsCheckedConverter}, ConverterParameter=Male}" Content="Male"/> <RadioButton IsChecked="{Bindi...
Create SharedPreferences BuyyaPref SharedPreferences pref = getApplicationContext().getSharedPreferences("BuyyaPref", MODE_PRIVATE); Editor editor = pref.edit(); Storing data as KEY/VALUE pair editor.putBoolean("key_name1", true); // Saving boolean - true/false ...

Page 8 of 28