Tutorial by Examples: and

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...
DBContract.java //Define the tables and columns of your local database public final class DBContract { /*Content Authority its a name for the content provider, is convenient to use the package app name to be unique on the device */ public static final String CONTENT_AUTHORITY =...
Modern A weak reference looks like one of these: @property (weak) NSString *property; NSString *__weak variable; If you have a weak reference to an object, then under the hood: You're not retaining it. When it gets deallocated, every reference to it will automatically be set to nil Obje...
Using the Story Board: Select the tab bar item from the corresponding view controller and go to the attributes inspector If you want a built-in icon and title, set the 'System Item' to the corresponding value. For a custom icon, add the required images to the assets folder and set the 'System It...
git does not recognice the concept of folders, it just works with files and their filepaths. This means git does not track empty folders. SVN, however, does. Using git-svn means that, by default, any change you do involving empty folders with git will not be propagated to SVN. Using the --rmdir fl...
Date time formatting, according to the localization. const usDateTimeFormatting = new Intl.DateTimeFormat('en-US'); const esDateTimeFormatting = new Intl.DateTimeFormat('es-ES'); const usDate = usDateTimeFormatting.format(new Date('2016-07-21')); // "7/21/2016" const esDate = esDateT...
Add one common horizontal line for all categorical variables # sample data df <- data.frame(x=('A', 'B'), y = c(3, 4)) p1 <- ggplot(df, aes(x=x, y=y)) + geom_bar(position = "dodge", stat = 'identity') + theme_bw() p1 + geom_hline(aes(yintercept=5), colour=...
import 'dart:async'; Future main() async { var value = await _waitForValue(); print("Here is the value: $value"); //since _waitForValue() returns immediately if you un it without await you won't get the result var errorValue = "not finished yet"; _waitForValue()...
To convert decimal number to binary format use base 2 Int32 Number = 15; Console.WriteLine(Convert.ToString(Number, 2)); //OUTPUT : 1111 To convert decimal number to octal format use base 8 int Number = 15; Console.WriteLine(Convert.ToString(Number, 8)); //OUTPUT : 17 To conv...
The URL for the credits label. Defaults to: http://www.highcharts.com. credits: { text: 'StackOverflow.com', href: 'http://stackoverflow.com' },
In sequence workflows, yield adds a single item into the sequence being built. (In monadic terminology, it is return.) > seq { yield 1; yield 2; yield 3 } val it: seq<int> = seq [1; 2; 3] > let homogenousTup2ToSeq (a, b) = seq { yield a; yield b } > tup2Seq ("foo", &qu...
Some example cases when the result is an optional. var result: AnyObject? = someMethod() switch result { case nil: print("result is nothing") case is String: print("result is a String") case _ as Double: print("result is not nil, any value that is a Dou...
This illustrates that union members shares memory and that struct members does not share memory. #include <stdio.h> #include <string.h> union My_Union { int variable_1; int variable_2; }; struct My_Struct { int variable_1; int variable_2; }; int main (void) { ...
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...
Let's extend our template from above and include content from header.php and footer.php Including header: We will include header right after Template name comment There are two common ways to do this. Both are right and work same, it's just about your style and how code looks First way: <?ph...
Enums in Swift are much more powerful than some of their counterparts in other languages, such as C. They share many features with classes and structs, such as defining initialisers, computed properties, instance methods, protocol conformances and extensions. protocol ChangesDirection { mutati...
We prepare a file called reverser.ml with the following contents: let acc = ref [] in try while true do acc := read_line () :: !acc; done with End_of_file -> print_string (String.concat "\n" !acc) We then compile our program using ...
localStorage, sessionStorage are JavaScript Objects and you can treat them as such. Instead of using Storage Methods like .getItem(), .setItem(), etc… here's a simpler alternative: // Set localStorage.greet = "Hi!"; // Same as: window.localStorage.setItem("greet", "Hi!&qu...
Sometimes we need to change type from Collection<T?> to Collections<T>. In that case, filterNotNull is our solution. val a: List<Int?> = listOf(1, 2, 3, null) val b: List<Int> = a.filterNotNull()

Page 39 of 153