Tuples can be compared based on their elements.
As an example, an enumerable whose elements are of type Tuple can be sorted based on comparisons operators defined on a specified element:
List<Tuple<int, string>> list = new List<Tuple<int, string>>();
list.Add(new Tuple<...
References behaves similarly, but not entirely like const pointers. A reference is defined by suffixing an ampersand & to a type name.
int i = 10;
int &refi = i;
Here, refi is a reference bound to i.
References abstracts the semantics of pointers, acting like an alias to the underlying...
Any quality Android application will keep track of what it's doing through application logs.
These logs allow easy debugging help for the developer to diagnose what's going on with the application.
Full Android Documentation can be found here, but a summary follows:
Basic Logging
The Log class...
The strchr and strrchr functions find a character in a string, that is in a NUL-terminated character array. strchr return a pointer to the first occurrence and strrchr to the last one.
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main(void)
{
char toSe...
To use the IronPython command line, open ipy.exe or ipy64.exe. Both files are located in the path that was selected during installation. By default they will be located at C:\Program Files\IronPython 2.7\.
Then start writing your statements directly in the IronPython command line.
For example:
pr...
In its most basic form, an object that implements IEnumerable represents a series of objects. The objects in question can be iterated using the c# foreach keyword.
In the example below, the object sequenceOfNumbers implements IEnumerable. It represents a series of integers. The foreach loop iterate...
The default position of an element is static. To quote MDN:
This keyword lets the element use the normal behavior, that is it is laid out in its current position in the flow. The top, right, bottom, left and z-index properties do not apply.
.element{
position:static;
}
This example limits SELECT result to 100 rows.
SELECT TOP 100 *
FROM table_name;
It is also possible to use a variable to specify the number of rows:
DECLARE @CountDesiredRows int = 100;
SELECT TOP (@CountDesiredRows) *
FROM table_name;
$incrementid = 100000000;
$order = Mage::getModel('sales/order')->loadByIncrementId($incrementid);
The above code is roughly analogous to the following SQL query.
select * from sales_flat_order where increment_id=100000000;
The increment_id is the customer facing order identifier, whereas...
Sort an enumeration in either ascending or descending order
Synonyms:
Sort-Object
sort
Assuming:
$names = @( "Aaron", "Aaron", "Bernie", "Charlie", "Danny" )
Ascending sort is the default:
$names | Sort-Object
$names | sort
Aaron
Aa...
You can group an enumeration based on an expression.
Synonyms:
Group-Object
group
Examples:
$names = @( "Aaron", "Albert", "Alphonse","Bernie", "Charlie", "Danny", "Ernie", "Frank")
$names | Group-Object -Prope...
Projecting an enumeration allows you to extract specific members of each object, to extract all the details, or to compute values for each object
Synonyms:
Select-Object
select
Selecting a subset of the properties:
$dir = dir "C:\MyFolder"
$dir | Select-Object Name, FullName, Att...
Class methods present alternate ways to build instances of classes. To illustrate, let's look at an example.
Let's suppose we have a relatively simple Person class:
class Person(object):
def __init__(self, first_name, last_name, age):
self.first_name = first_name
self.last...
There are two types of using keyword usage, using statement and using directive:
using statement:
The using keyword ensures that objects that implement the IDisposable interface are properly disposed after usage. There is a separate topic for the using statement
using directive
The using...
class Car {
public position: number = 0;
protected speed: number = 42;
move() {
this.position += this.speed;
}
}
class SelfDrivingCar extends Car {
move() {
// start moving around :-)
super.move();
super.move();
}
}
...
public class Singleton {
private static final Singleton INSTANCE = new Singleton();
private Singleton() {}
public static Singleton getInstance() {
return INSTANCE;
}
}
It can be argued that this example is effectively lazy initialization. Section 12.4.1 of ...
To increment date objects in Javascript, we can usually do this:
var checkoutDate = new Date(); // Thu Jul 21 2016 10:05:13 GMT-0400 (EDT)
checkoutDate.setDate( checkoutDate.getDate() + 1 );
console.log(checkoutDate); // Fri Jul 22 2016 10:05:13 GMT-0400 (EDT)
It is possible to use setD...