Tutorial by Examples: er

Download Heroku Toolbelt. Navigate to the root of the sources of your Django app. You'll need tk Type heroku create [app_name]. If you don't give an app name, Heroku will randomly generate one for you. Your app URL will be http://[app name].herokuapp.com Make a text file with the ...
3.0 let string = "My fantastic string" var index = string.startIndex while index != string.endIndex { print(string[index]) index = index.successor() } Note: endIndex is after the end of the string (i.e. string[string.endIndex] is an error, but string[string.startIndex] i...
A defer statement in Go is simply a function call marked to be executed at a later time. Defer statement is an ordinary function call prefixed by the keyword defer. defer someFunction() A deferred function is executed once the function that contains the defer statement returns. Actual call to th...
Standard enumerations allow users to declare a useful name for a set of integers. The names are collectively referred to as enumerators. An enumeration and its associated enumerators are defined as follows: enum myEnum { enumName1, enumName2, }; An enumeration is a type, one which is...
A common use for enumerators is for switch statements and so they commonly appear in state machines. In fact a useful feature of switch statements with enumerations is that if no default statement is included for the switch, and not all values of the enum have been utilized, the compiler will issue ...
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...
package { import flash.events.TimerEvent; import flash.utils.Timer; public class CountdownTimer extends Timer { public var time:Number = 0; public function CountdownTimer(time:Number = Number.NEGATIVE_INFINITY, delay:Number = 1000) { super(delay, repeatCount); ...
// RawRepresentable has an associatedType RawValue. // For this struct, we will make the compiler infer the type // by implementing the rawValue variable with a type of String // // Compiler infers RawValue = String without needing typealias // struct NotificationName: RawRepresentable { ...
Pattern matching allows to deconstruct complex values and it is by no way limited to the “outer most” level of the representation of a value. To illustrate this, we implement the function transforming a boolean expression into a boolean expression where all negations are only on atoms, the so calle...
A reference to an option &Option<T> cannot be unwrapped if the type T is not copyable. The solution is to change the option to &Option<&T> using as_ref(). Rust forbids transferring of ownership of objects while the objects are borrowed. When the Option itself is borrowed (&a...
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...
ga('create', 'UA-XXXX-Y', {'sampleRate': 5}); Optional. This may only be set in the create method. Specifies what percentage of users should be tracked. This defaults to 100 (no users are sampled out) but large sites may need to use a lower sample rate to stay within Google Analytics processing ...
Before ECMAScript 2015 (ES6), a parameter's default value could be assigned in the following way: function printMsg(msg) { msg = typeof msg !== 'undefined' ? // if a value was provided msg : // then, use that value in the reassignemnt 'Default value for ...
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()
The most important AppWidgetProvider callback is onUpdate(). It is called everytime an appwidget is added. public class ExampleAppWidgetProvider extends AppWidgetProvider { public void onUpdate(Context context, AppWidgetManager appWidgetManager, int[] appWidgetIds) { final int N = a...
This example uses a search controller to filter the cells in a table view controller. The search bar is placed inside the header view of the table view. The table view content is offset with the same height as the search bar so that the search bar is hidden at first. Upon scrolling up past the top e...
Early bound (requires a reference to Microsoft Scripting Runtime): Public Sub EnumerateDirectory() Dim fso As Scripting.FileSystemObject Set fso = New Scripting.FileSystemObject Dim targetFolder As Folder Set targetFolder = fso.GetFolder("C:\") Dim foundFi...
It's a regular pattern in design these days to vertically align call to actions inside its containing cards like this: This can be achieved using a special trick with flexbox HTML <div class="cards"> <div class="card"> <p>Lorem ipsum Magna proident ...
It is often useful for debugging purposes to find the root cause of an error. In order to examine an error value that implements std::error::Error: use std::error::Error; let orig_error = call_returning_error(); // Use an Option<&Error>. This is the return type of Error.cause(). le...
The reason you do not have to override Awake, Start, Update and other method is because they are not virtual methods defined in a base class. The first time your script gets accessed, the scripting runtime looks through the script to see if some methods are defined. If they are, that information is...

Page 115 of 417