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...
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...
When Flash makes a request for data from an external source, that operation is asynchronous. The most basic explanation of what this means is that the data loads "in the background" and triggers the event handler you allocate to Event.COMPLETE when it is received. This can happen at any po...
If you need to roll for a true or false in an "x% chance" situation, use:
function roll(chance:Number):Boolean {
return Math.random() >= chance;
}
Used like:
var success:Boolean = roll(0.5); // True 50% of the time.
var again:Boolean = roll(0.25); // True 25% of the time.
...
To get any random color:
function randomColor():uint
{
return Math.random() * 0xFFFFFF;
}
If you need more control over the red, green and blue channels:
var r:uint = Math.random() * 0xFF;
var g:uint = Math.random() * 0xFF;
var b:uint = Math.random() * 0xFF;
var color:uint = r <&...
Value Type (where T : struct)
The built-in primitive data types, such as char, int, and float, as well as user-defined types declared with struct, or enum. Their default value is new T() :
default(int) // 0
default(DateTime) // 0001-01-01 12:00:00 AM
default(char) // '...
To get started with Thymeleaf visit official download page.
Maven dependency
<dependency>
<groupId>org.thymeleaf</groupId>
<artifactId>thymeleaf</artifactId>
<version>3.0.1.RELEASE</version>
</dependency>
Gradle dependency
compile gr...
A series is a one-dimension data structure. It's a bit like a supercharged array, or a dictionary.
import pandas as pd
s = pd.Series([10, 20, 30])
>>> s
0 10
1 20
2 30
dtype: int64
Every value in a series has an index. By default, the indices are integers, running fro...
Detailed instructions on getting openerp set up or installed in Debian/Ubuntu.
To install from source code, we need Python 2.7, Git and a PostgreSQL database:
$ sudo apt-get install git python-pip python2.7-dev -y
$ sudo apt-get install postgresql -y
$ sudo su -c "createuser -s $(whoami)&qu...
The Flex compiler (mxmlc) is one of the most important parts of the Flex SDK. You can edit AS3 code in any text editor you like. Create a main class file that extends from DisplayObject.
You can trigger builds at the command line as follows:
mxmlc -source-path="." -default-size [width in...
Output some information about a known remote: origin
git remote show origin
Print just the remote's URL:
git config --get remote.origin.url
With 2.7+, it is also possible to do, which is arguably better than the above one that uses the config command.
git remote get-url origin
In a Service Provider register method we can bind an interface to an implementation:
public function register()
{
App::bind( UserRepositoryInterface::class, EloquentUserRepository::class );
}
From now on, everytime the app will need an instance of UserRepositoryInterface, Larave...
Equality
For basic equality testing, the equal operator == is used. For more comprehensive checks, use the identical operator ===.
The identical operator works the same as the equal operator, requiring its operands have the same value, but also requires them to have the same data type.
For exampl...
from pandas_datareader import data
# Only get the adjusted close.
aapl = data.DataReader("AAPL",
start='2015-1-1',
end='2015-12-31',
data_source='yahoo')['Adj Close']
>>> aapl.plot(title='AAPL Adj. C...
This method will work on modern versions of Arch, CentOS, CoreOS, Debian, Fedora, Mageia, openSUSE, Red Hat Enterprise Linux, SUSE Linux Enterprise Server, Ubuntu, and others. This wide applicability makes it an ideal as a first approach, with fallback to other methods if you need to also identify o...
Elements and attributes behave differently with respect to default namespaces. This is often the source of confusion.
An attribute whose name has no prefix lives in no namespace, also when a default namespace is in scope.
<?xml version="1.0"?>
<foo attr="value" xmlns=...
To cancel a call to requestAnimationFrame, you need the id it returned from when it was last called. This is the parameter you use for cancelAnimationFrame. The following example starts some hypothetical animation then pauses it after one second.
// stores the id returned from each call to reques...
Addition + and subtraction - operations can be used to combine delegate instances. The delegate contains a list of the assigned delegates.
using System;
using System.Reflection;
using System.Reflection.Emit;
namespace DelegatesExample {
class MainClass {
private delegate void MyD...