Tutorial by Examples: ed

The main difference is that double-quoted String literals support string interpolations and the full set of escape sequences. For instance, they can include arbitrary Ruby expressions via interpolation: # Single-quoted strings don't support interpolation puts 'Now is #{Time.now}' # Now is #{Time...
The static (compile-time) type is used rather than the dynamic (run-time type) to match parameters. public class Base { public virtual string GetName() { return "Base"; } } public class Derived : Base { public override string GetName() { ...
It is possible to treat a GoogleMap as an Android view if we make use of the provided MapView class. Its usage is very similar to MapFragment. In your layout use MapView as follows: <com.google.android.gms.maps.MapView xmlns:android="http://schemas.android.com/apk/res/android" ...
The % wildcard appended to the beginning or end (or both) of a string will allow 0 or more of any character before the beginning or after the end of the pattern to match. Using '%' in the middle will allow 0 or more characters between the two parts of the pattern to match. We are going to use this...
Just execute lsb_release -a. On Debian: $ lsb_release -a No LSB modules are available. Distributor ID: Debian Description: Debian GNU/Linux testing (stretch) Release: testing Codename: stretch On Ubuntu: $ lsb_release -a No LSB modules are available. Distributor ID: Ubun...
You can open the VB editor in any of the Microsoft Office applications by pressing Alt+F11 or going to the Developer tab and clicking on the "Visual Basic" button. If you don't see the Developer tab in the Ribbon, check if this is enabled. By default the Developer tab is disabled. To enab...
NSArray *array = [NSArray arrayWithObjects:@"Nick", @"Ben", @"Adam", @"Melissa", nil]; NSPredicate *aPredicate = [NSPredicate predicateWithFormat:@"SELF beginswith[c] 'a'"]; NSArray *beginWithA = [array filteredArrayUsingPredicate:bPredicate]; ...
Properties are members of an object. Each named property is a pair of (name, descriptor). The name is a string that allows access (using the dot notation object.propertyName or the square brackets notation object['propertyName']). The descriptor is a record of fields defining the bevahiour of the pr...
To make a rounded UIView, specify a cornerRadius for the view's layer. This also applies any class which inherits from UIView, such as UIImageView. Programmatically Swift Code someImageView.layoutIfNeeded() someImageView.clipsToBounds = true someImageView.layer.cornerRadius = 10 Objective-C...
All Java exceptions are instances of classes in the Exception class hierarchy. This can be represented as follows: java.lang.Throwable - This is the base class for all exception classes. Its methods and constructors implement a range of functionality common to all exceptions. java.lang.Excep...
In Python 2, an iterator can be traversed by using a method called next on the iterator itself: Python 2.x2.3 g = (i for i in range(0, 3)) g.next() # Yields 0 g.next() # Yields 1 g.next() # Yields 2 In Python 3 the .next method has been renamed to .__next__, acknowledging its “magic” ro...
SELECT * FROM Employees ORDER BY LName This statement will return all the columns from the table Employees. IdFNameLNamePhoneNumber2JohnJohnson24681012141JamesSmith12345678903MichaelWilliams1357911131 SELECT * FROM Employees ORDER BY LName DESC Or SELECT * FROM Employees ORDER BY LName ASC...
Defining position as fixed we can remove an element from the document flow and set its position relatively to the browser window. One obvious use is when we want something to be visible when we scroll to the bottom of a long page. #stickyDiv { position:fixed; top:10px; left:10px; } ...
Define a new type, mytype: type :: mytype integer :: int real :: float end type mytype Declare a variable of type mytype: type(mytype) :: foo The components of a derived type can be accessed with the % operator1: foo%int = 4 foo%float = 3.142 A Fortran 2003 feature (not yet ...
Deploying an advanced project template to shared hosting is a bit trickier than a basic one because it has two webroots, which shared hosting webservers don't support. We will need to adjust the directory structure so frontend URL will be http://site.local and backend URL will be http://site.local/a...
SharedPreferences sharedPreferences = ...; sharedPreferences.registerOnSharedPreferenceChangeListener(mOnSharedPreferenceChangeListener); private final SharedPreferences.OnSharedPreferenceChangeListener mOnSharedPreferenceChangeListener = new SharedPreferences.OnSharedPreferenceChangeListener(...
An XML document is a text file that conforms to the XML specification's well-formedness rules. Such a conforming document is said to be well-formed (not to be confused with valid). XML is very strict with well-formedness in comparison to other languages such as HTML. A text file that is not well-for...
def say_hello_to(name) puts "Hello #{name}" end say_hello_to('Charles') # Hello Charles
def greet(greeting, name) puts "#{greeting} #{name}" end greet('Hi', 'Sophie') # Hi Sophie
While static constructors are always called before the first usage of a type it's sometimes useful to be able to force them to be called and the RuntimeHelpers class provide an helper for it: using System.Runtime.CompilerServices; // ... RuntimeHelpers.RunClassConstructor(typeof(Foo).TypeHand...

Page 12 of 145