Tutorial by Examples: er

public class Foo { private IBar _iBar; public IBar iBar { set { _iBar = value; } } public void DoStuff() { _iBar.DoSomething(); } } public interface IBar { void DoSomething(); }
Variables of character type or of a derived type with length parameter may have the length parameter either assumed or deferred. The character variable name character(len=len) name is of length len throughout execution. Conversely the length specifier may be either character(len=*) ... ! Ass...
val num = 42d Print two decimal places for num using f println(f"$num%2.2f") 42.00 Print num using scientific notation using e println(f"$num%e") 4.200000e+01 Print num in hexadecimal with a println(f"$num%a") 0x1.5p5 Other format strings can be found ...
Move Blue to the beginning of the array: NSMutableArray *myColors = [NSMutableArray arrayWithObjects: @"Red", @"Green", @"Blue", @"Yellow", nil]; NSUInteger fromIndex = 2; NSUInteger toIndex = 0; id blue = [[[self.array objectAtIndex:fromIndex] retain]...
Every authenticated user has a Firebase uid that's unique across all providers and is returned in the result of every authentication method. A good way to store your user's data is to create a node to keep all the users's data and to protect it using your security rules - Database { "use...
An implicit conversion allows the compiler to automatically convert an object of one type to another type. This allows the code to treat an object as an object of another type. case class Foo(i: Int) // without the implicit Foo(40) + 2 // compilation-error (type mismatch) // defines how t...
You can use the filter(_:) method on SequenceType in order to create a new array containing the elements of the sequence that satisfy a given predicate, which can be provided as a closure. For example, filtering even numbers from an [Int]: let numbers = [22, 41, 23, 30] let evenNumbers = number...
This function lets you iterate over the Cartesian product of a list of iterables. For example, for x, y in itertools.product(xrange(10), xrange(10)): print x, y is equivalent to for x in xrange(10): for y in xrange(10): print x, y Like all python functions that accept a v...
Introduction: This simple function generates infinite series of numbers. For example... for number in itertools.count(): if number > 20: break print(number) Note that we must break or it prints forever! Output: 0 1 2 3 4 5 6 7 8 9 10 Arguments: count() ta...
Generics are placeholders for types, allowing you to write flexible code that can be applied across multiple types. The advantage of using generics over Any is that they still allow the compiler to enforce strong type-safety. A generic placeholder is defined within angle brackets <>. Generic...
fs.access() determines whether a path exists and what permissions a user has to the file or directory at that path. fs.access doesn't return a result rather, if it doesn't return an error, the path exists and the user has the desired permissions. The permission modes are available as a property on ...
A macro can produce different outputs against different input patterns: /// The `sum` macro may be invoked in two ways: /// /// sum!(iterator) /// sum!(1234, iterator) /// macro_rules! sum { ($iter:expr) => { // This branch handles the `sum!(iterator)` case $iter.f...
In $e:expr, the expr is called the fragment specifier. It tells the parser what kind of tokens the parameter $e is expecting. Rust provides a variety of fragment specifiers to, allowing the input to be very flexible. SpecifierDescriptionExamplesidentIdentifierx, foopathQualified namestd::collection...
extern crate serde; extern crate serde_json; macro_rules! enum_str { ($name:ident { $($variant:ident($str:expr), )* }) => { #[derive(Clone, Copy, Debug, Eq, PartialEq)] pub enum $name { $($variant,)* } impl ::serde::Serialize for $name {...
insert overwrite table yourTargetTable select * from yourSourceTable;
INSERT INTO will append to the table or partition, keeping the existing data intact. INSERT INTO table yourTargetTable SELECT * FROM yourSourceTable; If a table is partitioned then we can insert into that particular partition in static fashion as shown below. INSERT INTO TABLE yourTarge...
HTML <div class="box_shadow"></div> CSS .box_shadow { background-color: #1C90F3; width: 200px; height: 100px; margin: 50px; -webkit-box-shadow: inset 0px 0px 10px 0px #444444; -moz-box-shadow: inset 0px 0px 10px 0px #444444; box-shadow: inse...
If you need to match characters that are a part of the regular expression syntax you can mark all or part of the pattern as a regex literal. \Q marks the beginning of the regex literal. \E marks the end of the regex literal. // the following throws a PatternSyntaxException because of the un-close...
The following code will print the arguments to the program, and the code will attempt to convert each argument into a number (to a long): #include <stdlib.h> #include <stdio.h> #include <errno.h> #include <limits.h> int main(int argc, char* argv[]) { for (int ...
To share files or to host simple websites(http and javascript) in your local network, you can use Python's builtin SimpleHTTPServer module. Python should be in your Path variable. Go to the folder where your files are and type: For python 2: $ python -m SimpleHTTPServer <portnumber> For p...

Page 67 of 417