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...
chrome.runtime.getManifest() returns the extension's manifest in a form of a parsed object.
This method works both on content scripts and all extension pages, it requires no permissions,
Example, obtaining the extension's version string:
var version = chrome.runtime.getManifest().version;
Using the Control.Invoke() method you may move the execution of a method or function from a background thread to the thread that the control was created on, which is usually the UI (User Interface) thread. By doing so your code will be queued to run on the control's thread instead, which removes the...
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=...
A namespace binding (special xmlns or xmlns:... attribute) is in scope for all the descendants of the enclosing element, including this element.
<?xml version="1.0"?>
<root>
<my:element xmlns:my="http://www.example.com/ns1">
<!-- here, the prefix my...
<?xml version="1.0"?>
<?speech-generator voice="Siri"?>
<root xmlns:vocabulary="http://www.example.com/vocabulary">
<!-- These are the standard greetings -->
<vocabulary:greetings>
<vocabulary:greeting xml:lang="en-US&q...
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...
Dim inputCode As Integer = Console.Read()
Console.Read() awaits input from the user and, upon receipt, returns an integer value corresponding with the character code of the entered character. If the input stream is ended in some way before input can be obtained, -1 is returned instead.
Dim inputChar As ConsoleKeyInfo = Console.ReadKey()
Console.ReadKey() awaits input from the user and, upon receipt, returns an object of class ConsoleKeyInfo, which holds information relevant to the character which the user provided as input. For detail regarding the information provided, visit t...
itertools.takewhile enables you to take items from a sequence until a condition first becomes False.
def is_even(x):
return x % 2 == 0
lst = [0, 2, 4, 12, 18, 13, 14, 22, 23, 44]
result = list(itertools.takewhile(is_even, lst))
print(result)
This outputs [0, 2, 4, 12, 18].
Not...
itertools.dropwhile enables you to take items from a sequence after a condition first becomes False.
def is_even(x):
return x % 2 == 0
lst = [0, 2, 4, 12, 18, 13, 14, 22, 23, 44]
result = list(itertools.dropwhile(is_even, lst))
print(result)
This outputs [13, 14, 22, 23, 44].
...
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...
You can easily add a breakpoint to your code by clicking on the grey column to the left of the line of your VBA code where you want execution to stop. A red dot appears in the column and the breakpoint code is also highlighted in red.
You can add multiple breakpoints throughout your code and resumi...
In contrast of a full template specialization partial template specialization allows to introduce template with some of the arguments of existing template fixed. Partial template specialization is only available for template class/structs:
// Common case:
template<typename T, typename U>
st...
Once a model object has been fetched, it becomes a fully realized instance of the class. As such, any additional methods can be accessed in forms and serializers (like Django Rest Framework).
Using python properties is an elegant way to represent additional values that are not stored in the databa...
This example will show you how to quickly get a hello world Aurelia application up and running using the Aurelia CLI.
Prerequisites
The Aurelia CLI is a Node.js based application, so make sure you install it first before proceeding. You will need Node.js 4.4.7 or later.
You will also need a Git c...
A commonly used CSS/Javascript library is Bootstrap. To install it into your Aurelia CLI driven application first you need to install it using Npm.
npm install bootstrap --save
Because Bootstrap has a hard dependency on jQuery, we need to make sure we also have jQuery installed:
npm install jqu...