File level metadata applies to all the code within the file and should be placed at the top of the file:
<?php
/**
* @author John Doe ([email protected])
* @copyright MIT
*/
If a class extends another class and would use the same metadata, providing it @inheritDoc is a simple way for use the same documentation. If multiple classes inherit from a base, only the base would need to be changed for the children to be affected.
abstract class FooBase
{
/**
* @par...
Select Now();
Shows the current server date and time.
Update `footable` set mydatefield = Now();
This will update the field mydatefield with current server date and time in server's configured timezone, e.g.
'2016-07-21 12:00:00'
Maybe is used to represent possibly empty values - similar to null in other languages. Usually it is used as the output type of functions that can fail in some way.
Consider the following function:
halve :: Int -> Maybe Int
halve x
| even x = Just (x `div` 2)
| odd x = Nothing
Think ...
Let's say you need to implement an automatic search box, but the search operation is somewhat costly, like sending a web request or hitting up a database. You may want to limit the amount of search being done.
For example, the user is typing "C# Reactive Extensions" in the search box :
I...
There are two operators for filtering duplicates:
emails.Distinct(); // Never see the same value twice
emails.DistinctUntilChanged(); // Never see the same value twice in a row
You can also pass in a predicate:
emails.DistinctUntilChanged(x => x.Length); // Never see the same length email t...
Let's use *norm as an example. From the documentation:
dnorm(x, mean = 0, sd = 1, log = FALSE)
pnorm(q, mean = 0, sd = 1, lower.tail = TRUE, log.p = FALSE)
qnorm(p, mean = 0, sd = 1, lower.tail = TRUE, log.p = FALSE)
rnorm(n, mean = 0, sd = 1)
So if I wanted to know the value of a standard no...
In order to define a variable inside a linq expression, you can use the let keyword. This is usually done in order to store the results of intermediate sub-queries, for example:
int[] numbers = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 };
var aboveAverages = from number in numbers
l...
The \b metacharacter
To make it easier to find whole words, we can use the metacharacter \b. It marks the beginning and the end of an alphanumeric sequence*. Also, since it only serves to mark this locations, it actually matches no character on its own.
*: It is common to call an alphanumeric sequ...
In order to enable a multidex configuration you need:
to change your Gradle build configuration
to use a MultiDexApplication or enable the MultiDex in your Application class
Gradle configuration
In app/build.gradle add these parts:
android {
compileSdkVersion 24
buildToolsVersion ...
The dexcount plugin counts methods and class resource count after a successful build.
Add the plugin in the app/build.gradle:
apply plugin: 'com.android.application'
buildscript {
repositories {
mavenCentral() // or jcenter()
}
dependencies {
classpath 'com.ge...
While in insert mode, press <C-o> to temporarily leave insert mode and execute a one-off normal command.
Example
<C-o>2w jumps to the second word to the left and returns to insert mode.
Note: Repeating with . will only repeat the actions from returning to insert mode
This allows for ...
C++11 introduced final specifier which forbids method overriding if appeared in method signature:
class Base {
public:
virtual void foo() {
std::cout << "Base::Foo\n";
}
};
class Derived1 : public Base {
public:
// Overriding Base::foo
void foo() f...
A reference is a scalar variable (one prefixed by $ ) which “refers to” some other data.
my $value = "Hello";
my $reference = \$value;
print $value; # => Hello
print $reference; # => SCALAR(0x2683310)
To get the referred-to data, you de-reference it.
say ${$reference}...
Array References are scalars ($) which refer to Arrays.
my @array = ("Hello"); # Creating array, assigning value from a list
my $array_reference = \@array;
These can be created more short-hand as follows:
my $other_array_reference = ["Hello"];
Modifying / Using array ref...
Html5-Canvas ...
Is an Html5 element.
Is supported in most modern browsers (Internet Explorer 9+).
Is a visible element that is transparent by default
Has a default width of 300px and a default height of 150px.
Requires JavaScript because all content must be programmatically added to the Canv...
The URLRequest and URLLoader classes work together to make requests from Flash to external resources. The URLRequest defines information about the request e.g. the request body and the request method type, and the URLLoader references this to perform the actual request and provide a means of being n...
The URLVariables class allows you to define data to be sent along with a URLRequest.
Example:
var variables:URLVariables = new URLVariables();
variables.prop = "hello";
variables.anotherProp = 10;
var request:URLRequest = new URLRequest('http://someservice.com');
request.data = v...