# sql/operators.py
# Copyright (C) 2005-2021 the SQLAlchemy authors and contributors
# <see AUTHORS file>
#
# This module is part of SQLAlchemy and is released under
# the MIT License: http://www.opensource.org/licenses/mit-license.php
# This module is part of SQLAlchemy and is released under
# the MIT License: http://www.opensource.org/licenses/mit-license.php
"""Defines operators used in SQL expressions."""
from operator import add
from operator import and_
from operator import contains
from operator import eq
from operator import ge
from operator import getitem
from operator import gt
from operator import inv
from operator import le
from operator import lshift
from operator import lt
from operator import mod
from operator import mul
from operator import ne
from operator import neg
from operator import or_
from operator import rshift
from operator import sub
from operator import truediv
from .. import util
if util.py2k:
from operator import div
else:
div = truediv
class Operators(object):
"""Base of comparison and logical operators.
Implements base methods
:meth:`~sqlalchemy.sql.operators.Operators.operate` and
:meth:`~sqlalchemy.sql.operators.Operators.reverse_operate`, as well as
:meth:`~sqlalchemy.sql.operators.Operators.__and__`,
:meth:`~sqlalchemy.sql.operators.Operators.__or__`,
:meth:`~sqlalchemy.sql.operators.Operators.__invert__`.
Usually is used via its most common subclass
:class:`.ColumnOperators`.
"""
__slots__ = ()
def __and__(self, other):
"""Implement the ``&`` operator.
When used with SQL expressions, results in an
AND operation, equivalent to
:func:`_expression.and_`, that is::
a & b
is equivalent to::
from sqlalchemy import and_
and_(a, b)
Care should be taken when using ``&`` regarding
operator precedence; the ``&`` operator has the highest precedence.
The operands should be enclosed in parenthesis if they contain
further sub expressions::
(a == 2) & (b == 4)
"""
return self.operate(and_, other)
def __or__(self, other):
"""Implement the ``|`` operator.
When used with SQL expressions, results in an
OR operation, equivalent to
:func:`_expression.or_`, that is::
a | b
is equivalent to::
from sqlalchemy import or_
or_(a, b)
Care should be taken when using ``|`` regarding
operator precedence; the ``|`` operator has the highest precedence.
The operands should be enclosed in parenthesis if they contain
further sub expressions::
(a == 2) | (b == 4)
"""
return self.operate(or_, other)
def __invert__(self):
"""Implement the ``~`` operator.
When used with SQL expressions, results in a
NOT operation, equivalent to
:func:`_expression.not_`, that is::
~a
is equivalent to::
from sqlalchemy import not_
not_(a)
"""
return self.operate(inv)
def op(
self, opstring, precedence=0, is_comparison=False, return_type=None
):
"""Produce a generic operator function.
e.g.::
somecolumn.op("*")(5)
produces::
somecolumn * 5
This function can also be used to make bitwise operators explicit. For
example::
somecolumn.op('&')(0xff)
is a bitwise AND of the value in ``somecolumn``.
:param operator: a string which will be output as the infix operator
between this element and the expression passed to the
generated function.
:param precedence: precedence to apply to the operator, when
parenthesizing expressions. A lower number will cause the expression
to be parenthesized when applied against another operator with
higher precedence. The default value of ``0`` is lower than all
operators except for the comma (``,``) and ``AS`` operators.
A value of 100 will be higher or equal to all operators, and -100
will be lower than or equal to all operators.
:param is_comparison: if True, the operator will be considered as a
"comparison" operator, that is which evaluates to a boolean
true/false value, like ``==``, ``>``, etc. This flag should be set
so that ORM relationships can establish that the operator is a
comparison operator when used in a custom join condition.
.. versionadded:: 0.9.2 - added the
:paramref:`.Operators.op.is_comparison` flag.
:param return_type: a :class:`.TypeEngine` class or object that will
force the return type of an expression produced by this operator
to be of that type. By default, operators that specify
:paramref:`.Operators.op.is_comparison` will resolve to
:class:`.Boolean`, and those that do not will be of the same
type as the left-hand operand.
.. versionadded:: 1.2.0b3 - added the
:paramref:`.Operators.op.return_type` argument.
.. seealso::
:ref:`types_operators`
:ref:`relationship_custom_operator`
"""
operator = custom_op(opstring, precedence, is_comparison, return_type)
def against(other):
return operator(self, other)
return against
def bool_op(self, opstring, precedence=0):
"""Return a custom boolean operator.
This method is shorthand for calling
:meth:`.Operators.op` and passing the
:paramref:`.Operators.op.is_comparison`
flag with True.
.. versionadded:: 1.2.0b3
.. seealso::
:meth:`.Operators.op`
"""
return self.op(opstring, precedence=precedence, is_comparison=True)
def operate(self, op, *other, **kwargs):
r"""Operate on an argument.
This is the lowest level of operation, raises
:class:`NotImplementedError` by default.
Overriding this on a subclass can allow common
behavior to be applied to all operations.
For example, overriding :class:`.ColumnOperators`
to apply ``func.lower()`` to the left and right
side::
class MyComparator(ColumnOperators):
def operate(self, op, other):
return op(func.lower(self), func.lower(other))
:param op: Operator callable.
:param \*other: the 'other' side of the operation. Will
be a single scalar for most operations.
:param \**kwargs: modifiers. These may be passed by special
operators such as :meth:`ColumnOperators.contains`.
"""
raise NotImplementedError(str(op))
def reverse_operate(self, op, other, **kwargs):
"""Reverse operate on an argument.
Usage is the same as :meth:`operate`.
"""
raise NotImplementedError(str(op))
class custom_op(object):
"""Represent a 'custom' operator.
:class:`.custom_op` is normally instantiated when the
:meth:`.Operators.op` or :meth:`.Operators.bool_op` methods
are used to create a custom operator callable. The class can also be
used directly when programmatically constructing expressions. E.g.
to represent the "factorial" operation::
from sqlalchemy.sql import UnaryExpression
from sqlalchemy.sql import operators
from sqlalchemy import Numeric
unary = UnaryExpression(table.c.somecolumn,
modifier=operators.custom_op("!"),
type_=Numeric)
.. seealso::
:meth:`.Operators.op`
:meth:`.Operators.bool_op`
"""
__name__ = "custom_op"
def __init__(
self,
opstring,
precedence=0,
is_comparison=False,
return_type=None,
natural_self_precedent=False,
eager_grouping=False,
):
self.opstring = opstring
self.precedence = precedence
self.is_comparison = is_comparison
self.natural_self_precedent = natural_self_precedent
self.eager_grouping = eager_grouping
self.return_type = (
return_type._to_instance(return_type) if return_type else None
)
def __eq__(self, other):
return isinstance(other, custom_op) and other.opstring == self.opstring
def __hash__(self):
return id(self)
def __call__(self, left, right, **kw):
return left.operate(self, right, **kw)
class ColumnOperators(Operators):
"""Defines boolean, comparison, and other operators for
:class:`_expression.ColumnElement` expressions.
By default, all methods call down to
:meth:`.operate` or :meth:`.reverse_operate`,
passing in the appropriate operator function from the
Python builtin ``operator`` module or
a SQLAlchemy-specific operator function from
:mod:`sqlalchemy.expression.operators`. For example
the ``__eq__`` function::
def __eq__(self, other):
return self.operate(operators.eq, other)
Where ``operators.eq`` is essentially::
def eq(a, b):
return a == b
The core column expression unit :class:`_expression.ColumnElement`
overrides :meth:`.Operators.operate` and others
to return further :class:`_expression.ColumnElement` constructs,
so that the ``==`` operation above is replaced by a clause
construct.
.. seealso::
:ref:`types_operators`
:attr:`.TypeEngine.comparator_factory`
:class:`.ColumnOperators`
:class:`.PropComparator`
"""
__slots__ = ()
timetuple = None
"""Hack, allows datetime objects to be compared on the LHS."""
def __lt__(self, other):
"""Implement the ``<`` operator.
In a column context, produces the clause ``a < b``.
"""
return self.operate(lt, other)
def __le__(self, other):
"""Implement the ``<=`` operator.
In a column context, produces the clause ``a <= b``.
"""
return self.operate(le, other)
__hash__ = Operators.__hash__
def __eq__(self, other):
"""Implement the ``==`` operator.
In a column context, produces the clause ``a = b``.
If the target is ``None``, produces ``a IS NULL``.
"""
return self.operate(eq, other)
def __ne__(self, other):
"""Implement the ``!=`` operator.
In a column context, produces the clause ``a != b``.
If the target is ``None``, produces ``a IS NOT NULL``.
"""
return self.operate(ne, other)
def is_distinct_from(self, other):
"""Implement the ``IS DISTINCT FROM`` operator.
Renders "a IS DISTINCT FROM b" on most platforms;
on some such as SQLite may render "a IS NOT b".
.. versionadded:: 1.1
"""
return self.operate(is_distinct_from, other)
def isnot_distinct_from(self, other):
"""Implement the ``IS NOT DISTINCT FROM`` operator.
Renders "a IS NOT DISTINCT FROM b" on most platforms;
on some such as SQLite may render "a IS b".
.. versionadded:: 1.1
"""
return self.operate(isnot_distinct_from, other)
def __gt__(self, other):
"""Implement the ``>`` operator.
In a column context, produces the clause ``a > b``.
"""
return self.operate(gt, other)
def __ge__(self, other):
"""Implement the ``>=`` operator.
In a column context, produces the clause ``a >= b``.
"""
return self.operate(ge, other)
def __neg__(self):
"""Implement the ``-`` operator.
In a column context, produces the clause ``-a``.
"""
return self.operate(neg)
def __contains__(self, other):
return self.operate(contains, other)
def __getitem__(self, index):
"""Implement the [] operator.
This can be used by some database-specific types
such as PostgreSQL ARRAY and HSTORE.
"""
return self.operate(getitem, index)
def __lshift__(self, other):
"""implement the << operator.
Not used by SQLAlchemy core, this is provided
for custom operator systems which want to use
<< as an extension point.
"""
return self.operate(lshift, other)
def __rshift__(self, other):
"""implement the >> operator.
Not used by SQLAlchemy core, this is provided
for custom operator systems which want to use
>> as an extension point.
"""
return self.operate(rshift, other)
def concat(self, other):
"""Implement the 'concat' operator.
In a column context, produces the clause ``a || b``,
or uses the ``concat()`` operator on MySQL.
"""
return self.operate(concat_op, other)
def like(self, other, escape=None):
r"""Implement the ``like`` operator.
In a column context, produces the expression::
a LIKE other
E.g.::
stmt = select([sometable]).\
where(sometable.c.column.like("%foobar%"))
:param other: expression to be compared
:param escape: optional escape character, renders the ``ESCAPE``
keyword, e.g.::
somecolumn.like("foo/%bar", escape="/")
.. seealso::
:meth:`.ColumnOperators.ilike`
"""
return self.operate(like_op, other, escape=escape)
def ilike(self, other, escape=None):
r"""Implement the ``ilike`` operator, e.g. case insensitive LIKE.
In a column context, produces an expression either of the form::
lower(a) LIKE lower(other)
Or on backends that support the ILIKE operator::
a ILIKE other
E.g.::
stmt = select([sometable]).\
where(sometable.c.column.ilike("%foobar%"))
:param other: expression to be compared
:param escape: optional escape character, renders the ``ESCAPE``
keyword, e.g.::
somecolumn.ilike("foo/%bar", escape="/")
.. seealso::
:meth:`.ColumnOperators.like`
"""
return self.operate(ilike_op, other, escape=escape)
def in_(self, other):
"""Implement the ``in`` operator.
In a column context, produces the clause ``column IN <other>``.
The given parameter ``other`` may be:
* A list of literal values, e.g.::
stmt.where(column.in_([1, 2, 3]))
In this calling form, the list of items is converted to a set of
bound parameters the same length as the list given::
WHERE COL IN (?, ?, ?)
* A list of tuples may be provided if the comparison is against a
:func:`.tuple_` containing multiple expressions::
from sqlalchemy import tuple_
stmt.where(tuple_(col1, col2).in_([(1, 10), (2, 20), (3, 30)]))
* An empty list, e.g.::
stmt.where(column.in_([]))
In this calling form, the expression renders a "false" expression,
e.g.::
WHERE 1 != 1
This "false" expression has historically had different behaviors
in older SQLAlchemy versions, see
:paramref:`_sa.create_engine.empty_in_strategy`
for behavioral options.
.. versionchanged:: 1.2 simplified the behavior of "empty in"
expressions
* A bound parameter, e.g. :func:`.bindparam`, may be used if it
includes the :paramref:`.bindparam.expanding` flag::
stmt.where(column.in_(bindparam('value', expanding=True)))
In this calling form, the expression renders a special non-SQL
placeholder expression that looks like::
WHERE COL IN ([EXPANDING_value])
This placeholder expression is intercepted at statement execution
time to be converted into the variable number of bound parameter
form illustrated earlier. If the statement were executed as::
connection.execute(stmt, {"value": [1, 2, 3]})
The database would be passed a bound parameter for each value::
WHERE COL IN (?, ?, ?)
.. versionadded:: 1.2 added "expanding" bound parameters
If an empty list is passed, a special "empty list" expression,
which is specific to the database in use, is rendered. On
SQLite this would be::
WHERE COL IN (SELECT 1 FROM (SELECT 1) WHERE 1!=1)
.. versionadded:: 1.3 "expanding" bound parameters now support
empty lists
* a :func:`_expression.select` construct,
which is usually a correlated
scalar select::
stmt.where(
column.in_(
select([othertable.c.y]).
where(table.c.x == othertable.c.x)
)
)
In this calling form, :meth:`.ColumnOperators.in_` renders as given::
WHERE COL IN (SELECT othertable.y
FROM othertable WHERE othertable.x = table.x)
:param other: a list of literals, a :func:`_expression.select`
construct,
or a :func:`.bindparam` construct that includes the
:paramref:`.bindparam.expanding` flag set to True.
"""
return self.operate(in_op, other)
def notin_(self, other):
"""implement the ``NOT IN`` operator.
This is equivalent to using negation with
:meth:`.ColumnOperators.in_`, i.e. ``~x.in_(y)``.
In the case that ``other`` is an empty sequence, the compiler
produces an "empty not in" expression. This defaults to the
expression "1 = 1" to produce true in all cases. The
:paramref:`_sa.create_engine.empty_in_strategy` may be used to
alter this behavior.
.. versionchanged:: 1.2 The :meth:`.ColumnOperators.in_` and
:meth:`.ColumnOperators.notin_` operators
now produce a "static" expression for an empty IN sequence
by default.
.. seealso::
:meth:`.ColumnOperators.in_`
"""
return self.operate(notin_op, other)
def notlike(self, other, escape=None):
"""implement the ``NOT LIKE`` operator.
This is equivalent to using negation with
:meth:`.ColumnOperators.like`, i.e. ``~x.like(y)``.
.. seealso::
:meth:`.ColumnOperators.like`
"""
return self.operate(notlike_op, other, escape=escape)
def notilike(self, other, escape=None):
"""implement the ``NOT ILIKE`` operator.
This is equivalent to using negation with
:meth:`.ColumnOperators.ilike`, i.e. ``~x.ilike(y)``.
.. seealso::
:meth:`.ColumnOperators.ilike`
"""
return self.operate(notilike_op, other, escape=escape)
def is_(self, other):
"""Implement the ``IS`` operator.
Normally, ``IS`` is generated automatically when comparing to a
value of ``None``, which resolves to ``NULL``. However, explicit
usage of ``IS`` may be desirable if comparing to boolean values
on certain platforms.
.. seealso:: :meth:`.ColumnOperators.isnot`
"""
return self.operate(is_, other)
def isnot(self, other):
"""Implement the ``IS NOT`` operator.
Normally, ``IS NOT`` is generated automatically when comparing to a
value of ``None``, which resolves to ``NULL``. However, explicit
usage of ``IS NOT`` may be desirable if comparing to boolean values
on certain platforms.
.. seealso:: :meth:`.ColumnOperators.is_`
"""
return self.operate(isnot, other)
def startswith(self, other, **kwargs):
r"""Implement the ``startswith`` operator.
Produces a LIKE expression that tests against a match for the start
of a string value::
column LIKE <other> || '%'
E.g.::
stmt = select([sometable]).\
where(sometable.c.column.startswith("foobar"))
Since the operator uses ``LIKE``, wildcard characters
``"%"`` and ``"_"`` that are present inside the <other> expression
will behave like wildcards as well. For literal string
values, the :paramref:`.ColumnOperators.startswith.autoescape` flag
may be set to ``True`` to apply escaping to occurrences of these
characters within the string value so that they match as themselves
and not as wildcard characters. Alternatively, the
:paramref:`.ColumnOperators.startswith.escape` parameter will establish
a given character as an escape character which can be of use when
the target expression is not a literal string.
:param other: expression to be compared. This is usually a plain
string value, but can also be an arbitrary SQL expression. LIKE
wildcard characters ``%`` and ``_`` are not escaped by default unless
the :paramref:`.ColumnOperators.startswith.autoescape` flag is
set to True.
:param autoescape: boolean; when True, establishes an escape character
within the LIKE expression, then applies it to all occurrences of
``"%"``, ``"_"`` and the escape character itself within the
comparison value, which is assumed to be a literal string and not a
SQL expression.
An expression such as::
somecolumn.startswith("foo%bar", autoescape=True)
Will render as::
somecolumn LIKE :param || '%' ESCAPE '/'
With the value of ``:param`` as ``"foo/%bar"``.
.. versionadded:: 1.2
.. versionchanged:: 1.2.0 The
:paramref:`.ColumnOperators.startswith.autoescape` parameter is
now a simple boolean rather than a character; the escape
character itself is also escaped, and defaults to a forwards
slash, which itself can be customized using the
:paramref:`.ColumnOperators.startswith.escape` parameter.
:param escape: a character which when given will render with the
``ESCAPE`` keyword to establish that character as the escape
character. This character can then be placed preceding occurrences
of ``%`` and ``_`` to allow them to act as themselves and not
wildcard characters.
An expression such as::
somecolumn.startswith("foo/%bar", escape="^")
Will render as::
somecolumn LIKE :param || '%' ESCAPE '^'
The parameter may also be combined with
:paramref:`.ColumnOperators.startswith.autoescape`::
somecolumn.startswith("foo%bar^bat", escape="^", autoescape=True)
Where above, the given literal parameter will be converted to
``"foo^%bar^^bat"`` before being passed to the database.
.. seealso::
:meth:`.ColumnOperators.endswith`
:meth:`.ColumnOperators.contains`
:meth:`.ColumnOperators.like`
"""
return self.operate(startswith_op, other, **kwargs)
def endswith(self, other, **kwargs):
r"""Implement the 'endswith' operator.
Produces a LIKE expression that tests against a match for the end
of a string value::
column LIKE '%' || <other>
E.g.::
stmt = select([sometable]).\
where(sometable.c.column.endswith("foobar"))
Since the operator uses ``LIKE``, wildcard characters
``"%"`` and ``"_"`` that are present inside the <other> expression
will behave like wildcards as well. For literal string
values, the :paramref:`.ColumnOperators.endswith.autoescape` flag
may be set to ``True`` to apply escaping to occurrences of these
characters within the string value so that they match as themselves
and not as wildcard characters. Alternatively, the
:paramref:`.ColumnOperators.endswith.escape` parameter will establish
a given character as an escape character which can be of use when
the target expression is not a literal string.
:param other: expression to be compared. This is usually a plain
string value, but can also be an arbitrary SQL expression. LIKE
wildcard characters ``%`` and ``_`` are not escaped by default unless
the :paramref:`.ColumnOperators.endswith.autoescape` flag is
set to True.
:param autoescape: boolean; when True, establishes an escape character
within the LIKE expression, then applies it to all occurrences of
``"%"``, ``"_"`` and the escape character itself within the
comparison value, which is assumed to be a literal string and not a
SQL expression.
An expression such as::
somecolumn.endswith("foo%bar", autoescape=True)
Will render as::
somecolumn LIKE '%' || :param ESCAPE '/'
With the value of ``:param`` as ``"foo/%bar"``.
.. versionadded:: 1.2
.. versionchanged:: 1.2.0 The
:paramref:`.ColumnOperators.endswith.autoescape` parameter is
now a simple boolean rather than a character; the escape
character itself is also escaped, and defaults to a forwards
slash, which itself can be customized using the
:paramref:`.ColumnOperators.endswith.escape` parameter.
:param escape: a character which when given will render with the
``ESCAPE`` keyword to establish that character as the escape
character. This character can then be placed preceding occurrences
of ``%`` and ``_`` to allow them to act as themselves and not
wildcard characters.
An expression such as::
somecolumn.endswith("foo/%bar", escape="^")
Will render as::
somecolumn LIKE '%' || :param ESCAPE '^'
The parameter may also be combined with
:paramref:`.ColumnOperators.endswith.autoescape`::
somecolumn.endswith("foo%bar^bat", escape="^", autoescape=True)
Where above, the given literal parameter will be converted to
``"foo^%bar^^bat"`` before being passed to the database.
.. seealso::
:meth:`.ColumnOperators.startswith`
:meth:`.ColumnOperators.contains`
:meth:`.ColumnOperators.like`
"""
return self.operate(endswith_op, other, **kwargs)
def contains(self, other, **kwargs):
r"""Implement the 'contains' operator.
Produces a LIKE expression that tests against a match for the middle
of a string value::
column LIKE '%' || <other> || '%'
E.g.::
stmt = select([sometable]).\
where(sometable.c.column.contains("foobar"))
Since the operator uses ``LIKE``, wildcard characters
``"%"`` and ``"_"`` that are present inside the <other> expression
will behave like wildcards as well. For literal string
values, the :paramref:`.ColumnOperators.contains.autoescape` flag
may be set to ``True`` to apply escaping to occurrences of these
characters within the string value so that they match as themselves
and not as wildcard characters. Alternatively, the
:paramref:`.ColumnOperators.contains.escape` parameter will establish
a given character as an escape character which can be of use when
the target expression is not a literal string.
:param other: expression to be compared. This is usually a plain
string value, but can also be an arbitrary SQL expression. LIKE
wildcard characters ``%`` and ``_`` are not escaped by default unless
the :paramref:`.ColumnOperators.contains.autoescape` flag is
set to True.
:param autoescape: boolean; when True, establishes an escape character
within the LIKE expression, then applies it to all occurrences of
``"%"``, ``"_"`` and the escape character itself within the
comparison value, which is assumed to be a literal string and not a
SQL expression.
An expression such as::
somecolumn.contains("foo%bar", autoescape=True)
Will render as::
somecolumn LIKE '%' || :param || '%' ESCAPE '/'
With the value of ``:param`` as ``"foo/%bar"``.
.. versionadded:: 1.2
.. versionchanged:: 1.2.0 The
:paramref:`.ColumnOperators.contains.autoescape` parameter is
now a simple boolean rather than a character; the escape
character itself is also escaped, and defaults to a forwards
slash, which itself can be customized using the
:paramref:`.ColumnOperators.contains.escape` parameter.
:param escape: a character which when given will render with the
``ESCAPE`` keyword to establish that character as the escape
character. This character can then be placed preceding occurrences
of ``%`` and ``_`` to allow them to act as themselves and not
wildcard characters.
An expression such as::
somecolumn.contains("foo/%bar", escape="^")
Will render as::
somecolumn LIKE '%' || :param || '%' ESCAPE '^'
The parameter may also be combined with
:paramref:`.ColumnOperators.contains.autoescape`::
somecolumn.contains("foo%bar^bat", escape="^", autoescape=True)
Where above, the given literal parameter will be converted to
``"foo^%bar^^bat"`` before being passed to the database.
.. seealso::
:meth:`.ColumnOperators.startswith`
:meth:`.ColumnOperators.endswith`
:meth:`.ColumnOperators.like`
"""
return self.operate(contains_op, other, **kwargs)
def match(self, other, **kwargs):
"""Implements a database-specific 'match' operator.
:meth:`~.ColumnOperators.match` attempts to resolve to
a MATCH-like function or operator provided by the backend.
Examples include:
* PostgreSQL - renders ``x @@ to_tsquery(y)``
* MySQL - renders ``MATCH (x) AGAINST (y IN BOOLEAN MODE)``
* Oracle - renders ``CONTAINS(x, y)``
* other backends may provide special implementations.
* Backends without any special implementation will emit
the operator as "MATCH". This is compatible with SQLite, for
example.
"""
return self.operate(match_op, other, **kwargs)
def desc(self):
"""Produce a :func:`_expression.desc` clause against the
parent object."""
return self.operate(desc_op)
def asc(self):
"""Produce a :func:`_expression.asc` clause against the
parent object."""
return self.operate(asc_op)
def nullsfirst(self):
"""Produce a :func:`_expression.nullsfirst` clause against the
parent object."""
return self.operate(nullsfirst_op)
def nullslast(self):
"""Produce a :func:`_expression.nullslast` clause against the
parent object."""
return self.operate(nullslast_op)
def collate(self, collation):
"""Produce a :func:`_expression.collate` clause against
the parent object, given the collation string.
.. seealso::
:func:`_expression.collate`
"""
return self.operate(collate, collation)
def __radd__(self, other):
"""Implement the ``+`` operator in reverse.
See :meth:`.ColumnOperators.__add__`.
"""
return self.reverse_operate(add, other)
def __rsub__(self, other):
"""Implement the ``-`` operator in reverse.
See :meth:`.ColumnOperators.__sub__`.
"""
return self.reverse_operate(sub, other)
def __rmul__(self, other):
"""Implement the ``*`` operator in reverse.
See :meth:`.ColumnOperators.__mul__`.
"""
return self.reverse_operate(mul, other)
def __rdiv__(self, other):
"""Implement the ``/`` operator in reverse.
See :meth:`.ColumnOperators.__div__`.
"""
return self.reverse_operate(div, other)
def __rmod__(self, other):
"""Implement the ``%`` operator in reverse.
See :meth:`.ColumnOperators.__mod__`.
"""
return self.reverse_operate(mod, other)
def between(self, cleft, cright, symmetric=False):
"""Produce a :func:`_expression.between` clause against
the parent object, given the lower and upper range.
"""
return self.operate(between_op, cleft, cright, symmetric=symmetric)
def distinct(self):
"""Produce a :func:`_expression.distinct` clause against the
parent object.
"""
return self.operate(distinct_op)
def any_(self):
"""Produce a :func:`_expression.any_` clause against the
parent object.
This operator is only appropriate against a scalar subquery
object, or for some backends an column expression that is
against the ARRAY type, e.g.::
# postgresql '5 = ANY (somearray)'
expr = 5 == mytable.c.somearray.any_()
# mysql '5 = ANY (SELECT value FROM table)'
expr = 5 == select([table.c.value]).as_scalar().any_()
.. seealso::
:func:`_expression.any_` - standalone version
:func:`_expression.all_` - ALL operator
.. versionadded:: 1.1
"""
return self.operate(any_op)
def all_(self):
"""Produce a :func:`_expression.all_` clause against the
parent object.
This operator is only appropriate against a scalar subquery
object, or for some backends an column expression that is
against the ARRAY type, e.g.::
# postgresql '5 = ALL (somearray)'
expr = 5 == mytable.c.somearray.all_()
# mysql '5 = ALL (SELECT value FROM table)'
expr = 5 == select([table.c.value]).as_scalar().all_()
.. seealso::
:func:`_expression.all_` - standalone version
:func:`_expression.any_` - ANY operator
.. versionadded:: 1.1
"""
return self.operate(all_op)
def __add__(self, other):
"""Implement the ``+`` operator.
In a column context, produces the clause ``a + b``
if the parent object has non-string affinity.
If the parent object has a string affinity,
produces the concatenation operator, ``a || b`` -
see :meth:`.ColumnOperators.concat`.
"""
return self.operate(add, other)
def __sub__(self, other):
"""Implement the ``-`` operator.
In a column context, produces the clause ``a - b``.
"""
return self.operate(sub, other)
def __mul__(self, other):
"""Implement the ``*`` operator.
In a column context, produces the clause ``a * b``.
"""
return self.operate(mul, other)
def __div__(self, other):
"""Implement the ``/`` operator.
In a column context, produces the clause ``a / b``.
"""
return self.operate(div, other)
def __mod__(self, other):
"""Implement the ``%`` operator.
In a column context, produces the clause ``a % b``.
"""
return self.operate(mod, other)
def __truediv__(self, other):
"""Implement the ``//`` operator.
In a column context, produces the clause ``a / b``.
"""
return self.operate(truediv, other)
def __rtruediv__(self, other):
"""Implement the ``//`` operator in reverse.
See :meth:`.ColumnOperators.__truediv__`.
"""
return self.reverse_operate(truediv, other)
_commutative = {eq, ne, add, mul}
_comparison = {eq, ne, lt, gt, ge, le}
def commutative_op(fn):
_commutative.add(fn)
return fn
def comparison_op(fn):
_comparison.add(fn)
return fn
def from_():
raise NotImplementedError()
@comparison_op
def function_as_comparison_op():
raise NotImplementedError()
def as_():
raise NotImplementedError()
def exists():
raise NotImplementedError()
def istrue(a):
raise NotImplementedError()
def isfalse(a):
raise NotImplementedError()
@comparison_op
def is_distinct_from(a, b):
return a.is_distinct_from(b)
@comparison_op
def isnot_distinct_from(a, b):
return a.isnot_distinct_from(b)
@comparison_op
def is_(a, b):
return a.is_(b)
@comparison_op
def isnot(a, b):
return a.isnot(b)
def collate(a, b):
return a.collate(b)
def op(a, opstring, b):
return a.op(opstring)(b)
@comparison_op
def like_op(a, b, escape=None):
return a.like(b, escape=escape)
@comparison_op
def notlike_op(a, b, escape=None):
return a.notlike(b, escape=escape)
@comparison_op
def ilike_op(a, b, escape=None):
return a.ilike(b, escape=escape)
@comparison_op
def notilike_op(a, b, escape=None):
return a.notilike(b, escape=escape)
@comparison_op
def between_op(a, b, c, symmetric=False):
return a.between(b, c, symmetric=symmetric)
@comparison_op
def notbetween_op(a, b, c, symmetric=False):
return a.notbetween(b, c, symmetric=symmetric)
@comparison_op
def in_op(a, b):
return a.in_(b)
@comparison_op
def notin_op(a, b):
return a.notin_(b)
def distinct_op(a):
return a.distinct()
def any_op(a):
return a.any_()
def all_op(a):
return a.all_()
def _escaped_like_impl(fn, other, escape, autoescape):
if autoescape:
if autoescape is not True:
util.warn(
"The autoescape parameter is now a simple boolean True/False"
)
if escape is None:
escape = "/"
if not isinstance(other, util.compat.string_types):
raise TypeError("String value expected when autoescape=True")
if escape not in ("%", "_"):
other = other.replace(escape, escape + escape)
other = other.replace("%", escape + "%").replace("_", escape + "_")
return fn(other, escape=escape)
@comparison_op
def startswith_op(a, b, escape=None, autoescape=False):
return _escaped_like_impl(a.startswith, b, escape, autoescape)
@comparison_op
def notstartswith_op(a, b, escape=None, autoescape=False):
return ~_escaped_like_impl(a.startswith, b, escape, autoescape)
@comparison_op
def endswith_op(a, b, escape=None, autoescape=False):
return _escaped_like_impl(a.endswith, b, escape, autoescape)
@comparison_op
def notendswith_op(a, b, escape=None, autoescape=False):
return ~_escaped_like_impl(a.endswith, b, escape, autoescape)
@comparison_op
def contains_op(a, b, escape=None, autoescape=False):
return _escaped_like_impl(a.contains, b, escape, autoescape)
@comparison_op
def notcontains_op(a, b, escape=None, autoescape=False):
return ~_escaped_like_impl(a.contains, b, escape, autoescape)
@comparison_op
def match_op(a, b, **kw):
return a.match(b, **kw)
@comparison_op
def notmatch_op(a, b, **kw):
return a.notmatch(b, **kw)
def comma_op(a, b):
raise NotImplementedError()
@comparison_op
def empty_in_op(a, b):
raise NotImplementedError()
@comparison_op
def empty_notin_op(a, b):
raise NotImplementedError()
def filter_op(a, b):
raise NotImplementedError()
def concat_op(a, b):
return a.concat(b)
def desc_op(a):
return a.desc()
def asc_op(a):
return a.asc()
def nullsfirst_op(a):
return a.nullsfirst()
def nullslast_op(a):
return a.nullslast()
def json_getitem_op(a, b):
raise NotImplementedError()
def json_path_getitem_op(a, b):
raise NotImplementedError()
def is_comparison(op):
return op in _comparison or isinstance(op, custom_op) and op.is_comparison
def is_commutative(op):
return op in _commutative
def is_ordering_modifier(op):
return op in (asc_op, desc_op, nullsfirst_op, nullslast_op)
def is_natural_self_precedent(op):
return (
op in _natural_self_precedent
or isinstance(op, custom_op)
and op.natural_self_precedent
)
_booleans = (inv, istrue, isfalse, and_, or_)
def is_boolean(op):
return is_comparison(op) or op in _booleans
_mirror = {gt: lt, ge: le, lt: gt, le: ge}
def mirror(op):
"""rotate a comparison operator 180 degrees.
Note this is not the same as negation.
"""
return _mirror.get(op, op)
_associative = _commutative.union([concat_op, and_, or_]).difference([eq, ne])
_natural_self_precedent = _associative.union(
[getitem, json_getitem_op, json_path_getitem_op]
)
"""Operators where if we have (a op b) op c, we don't want to
parenthesize (a op b).
"""
_asbool = util.symbol("_asbool", canonical=-10)
_smallest = util.symbol("_smallest", canonical=-100)
_largest = util.symbol("_largest", canonical=100)
_PRECEDENCE = {
from_: 15,
function_as_comparison_op: 15,
any_op: 15,
all_op: 15,
getitem: 15,
json_getitem_op: 15,
json_path_getitem_op: 15,
mul: 8,
truediv: 8,
div: 8,
mod: 8,
neg: 8,
add: 7,
sub: 7,
concat_op: 6,
filter_op: 6,
match_op: 5,
notmatch_op: 5,
ilike_op: 5,
notilike_op: 5,
like_op: 5,
notlike_op: 5,
in_op: 5,
notin_op: 5,
is_: 5,
isnot: 5,
eq: 5,
ne: 5,
is_distinct_from: 5,
isnot_distinct_from: 5,
empty_in_op: 5,
empty_notin_op: 5,
gt: 5,
lt: 5,
ge: 5,
le: 5,
between_op: 5,
notbetween_op: 5,
distinct_op: 5,
inv: 5,
istrue: 5,
isfalse: 5,
and_: 3,
or_: 2,
comma_op: -1,
desc_op: 3,
asc_op: 3,
collate: 4,
as_: -1,
exists: 0,
_asbool: -10,
_smallest: _smallest,
_largest: _largest,
}
def is_precedent(operator, against):
if operator is against and is_natural_self_precedent(operator):
return False
else:
return _PRECEDENCE.get(
operator, getattr(operator, "precedence", _smallest)
) <= _PRECEDENCE.get(against, getattr(against, "precedence", _largest))


Lithromantic and Akoiromantic are two terms that mean the same thing. However, lithromantic is older and was the original term. The prefix lith- means stone, and the term was coined by the tumblr blog lithromantic. An anonymous user asked why they chose the prefix stone for their romantic orientation, which is a fair question. The following is an excerpt from lithromantic’s reply: “We looked at other terms for romantic and sexual orientations, and we noticed that most of them relied of latin or greek roots. So we went looking for a root which meant something at all like “experiences without desire to reciprocate”. We didn’t find anything. I mean, anything close, not anything we could figure out how to twist around and make it mean what we wanted. But, we’re both AFAB queers, one of us Stone, so we were familiar with Stone Butch sexuality. For those of you who don’t know, Butch/Femme is sort of the Old Guard of lesbian sexuality (not to say butch/femme isn’t still a thing, but a particular type of butche/femme was historically the norm for lesbians), and Stone is a particular type of sexual expression.  This was the closest allegory that we could find, and we chose to call this in our naming of this romantic orientation.”
However, controversy soon arose about the term. Some people were concerned that the term was appropriation, and decided to make an alternative. The most commonly used alternatives were akoiromantic and akoineromantic (not in common use anymore). An anonymous user asked pride-flags-for-us, “Do you happen to know an alternative to lith or am I fine to use it (i'm a transboy with demiboy leanings)? It's really the only sexuality that described my sexuality the best. But I've heard asexual is similar..” and they replied, "The prefix lith- is appropriative of lesbian culture which is why the lith- communities are working towards creating a different prefix. So far akoine- is the most accepted one. Anyone can use the akoine- label as long as it fits your sexuality/romantic”. Another post about it commented on it as neutrally as possible: “Some people take problem with lithromantic as it comes from stone butch terminology, which is appropriated from the lesbian community. I’m not making any definitive statements about the issue currently as I haven’t seen any actual lesbian-identified people speaking out about this, and most commentary I have seen comes from people outside the lesbian community saying it’s appropriation. However, that doesn’t mean it’s not appropriation. I’m not making any definitive statements about it either way at the moment, but since it’s still a debatable issue, it might be best to avoid the term and use akoiromantic instead.” Akoiromantic emerged from this discussion as an alternative to lithromantic.
Many lesbians argued against this being appropriation, however, and some spoke out against using akoiromantic. The following are excerpts from tumblr user ladyxaxa’s argument: “Hey!  I’ve been tracing this issue for a while, and I agree that most of the people saying it’s appropriation aren’t actually lesbian or stone identified. Meanwhile, the creator of the term (who does identify as stone/lithsexual) has explicitly said that it’s not appropriation, and I and my homoromantic asexual QPP agree. In fact, I would argue that not calling it lithromantic is erasure. . . . Basically, what I’m trying to say that by not calling it lith, it erases the history that the explanation of this experience comes from lesbian/stone activism. Ironically, by calling something appropriation that really, really isn’t because queer woman and stone people specifically intended it for sharing, the history of that sharing is erased. There are ‘actual lesbians’ (as many posts put it) who use this term and think it’s okay for you to use this term if you identify with it (and I’m obviously not saying you can’t use akoiromantic or another proposed term, although personally I think etymologically lith makes so much more sense specifically because it retains the link with stoneness). In other words, the concept that lith/akoiromantic indicates would not have been articulated when it was if not for lesbians and stone people and them relating their experiences to aromanticism, and I think it’s important to recognize that by retaining the words that we gave it.” So really, the only difference between akoiromantic and lithromantic is their roots, not the meaning. Currently, both are recognized in the aromantic community. (Note: the author is neither lith/akoiromantic nor lesbian. This is not meant to be an influential piece, but informative.)
Quoiromanticism (pronounced kwa-romantic and kwa-romanticism) comes from the French word "quoi" meaning "what". It was originally WTFromantic, but tumblr user epochryphal decided to coin an alternative for people who have trouble with pronounciation/spelling and/or a problem with swearing.
The original defintion was “applying romantic orientation doesn’t make sense here”. Over time, many people expanded the definition to also mean “can’t tell the difference between two attractions”.
In your aro activism using just the latter definition (can't tell the difference between two attractions) can be harmful. It makes a presumption that everyone who isn't simply aromantic or somewhere on the aromantic spectrum experiences the attraction in question, and just can't tell, which enforces amatonormativity and the "alloromantic as default" idea.
In conclusion, quoiromanticism is unique to everyone, and when telling people about quoiromanticism, make sure to use the full definition!
For further reading on quoiromanticism, you can browse through epochrypal's blog or this post about quoiromanticism!


DistributionUtils: Distribution Utilities
Utilities are provided which are of use in the
packages I have developed for dealing with
distributions. Currently these packages are GeneralizedHyperbolic,
VarianceGamma, and SkewHyperbolic and NormalLaplace. Each of these
packages requires DistributionUtils. Functionality includes sample
skewness and kurtosis, log-histogram, tail plots, moments by
integration, changing the point about which a moment is
calculated, functions for testing distributions using inversion
tests and the Massart inequality. Also includes an implementation
of the incomplete Bessel K function.
Downloads:
Reverse dependencies:
Linking:
Please use the canonical form
https://CRAN.R-project.org/package=DistributionUtils
to link to this page.


JJ Churchill wins UK industry award 22 Nov 2019, 11:36 by Michael Tyrrell Share This Article Tweet ShareShareShare Subscribe to our FREE Newsletter Author


| getSymbols.oanda {quantmod} | R Documentation |
Access to 191 currency and metal prices, downloadable as more that 36000 currency pairs from Oanda.com.
Downloads Symbols
to specified env
from
https://www.oanda.com historical currency database.
This method is not meant to be called directly, instead
a call to getSymbols("x",src="oanda")
will
in turn call this method. It is documented for the
sole purpose of highlighting the arguments accepted,
and to serve as a guide to creating additional
getSymbols 'methods'.
getSymbols.oanda(Symbols, env, return.class = "xts", from = Sys.Date() - 179, to = Sys.Date(), ...)
Symbols |
a character vector specifying the names
of each symbol to be loaded - expressed as a currency pair.
(e.g. U.S. Dollar to Euro rate would be expressed as
a string “USD/EUR”. The naming convention follows from
Oanda.com, and a table of possible values is
available by calling |
env |
where to create objects. |
return.class |
class of returned object |
from |
Start of series expressed as "CCYY-MM-DD" |
to |
Start of series expressed as "CCYY-MM-DD" |
... |
additional parameters |
Meant to be called internally by getSymbols only.
Oanda data is 7 day daily average price data, that is Monday through Sunday.
Oanda only provides historical data for the past 180 days. getSymbols will
return as much data as possible, and warn when the from
date is more
than 180 days ago.
A call to getSymbols(Symbols,src="oanda") will load into the specified environment one object for each 'Symbol' specified, with class defined by 'return.class'. Presently this may be 'ts', 'zoo', 'xts', or 'timeSeries'.
Oanda rates are quoted as one unit of base currency to the equivelant amount of foreign currency.
Jeffrey A. Ryan
Oanda.com https://www.oanda.com
Currencies: getSymbols.FRED
,
getSymbols
## Not run: getSymbols("USD/EUR",src="oanda") getSymbols("USD/EUR",src="oanda",from="2005-01-01") ## End(Not run)


Disable path restrictions, allowing scripts to access any path in the file system.
Display stack traces when an error occurs.
A comma-separated `list` of libraries to include or exclude. A name prefixed with "+" or nothing is included, and a name prefixed with "-" is excluded. If the name is "*", then the state is applied to all libraries. States are applied in order.
Mark a `path` as an accessible root directory. May be specified any number of times.


|
JavaTM 2 Platform Standard Ed. 5.0 |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object javax.management.modelmbean.DescriptorSupport
public class DescriptorSupport
This class represents the metadata set for a ModelMBean element. A descriptor is part of the ModelMBeanInfo, ModelMBeanNotificationInfo, ModelMBeanAttributeInfo, ModelMBeanConstructorInfo, and ModelMBeanParameterInfo.
A descriptor consists of a collection of fields. Each field is in fieldname=fieldvalue format. Field names are not case sensitive, case will be preserved on field values.
All field names and values are not predefined. New fields can be defined and added by any program. Some fields have been predefined for consistency of implementation and support by the ModelMBeanInfo, ModelMBeanAttributeInfo, ModelMBeanConstructorInfo, ModelMBeanNotificationInfo, ModelMBeanOperationInfo and ModelMBean classes.
| Constructor Summary | |
|---|---|
DescriptorSupport()
Descriptor default constructor. |
|
DescriptorSupport(DescriptorSupport inDescr)
Descriptor constructor taking a Descriptor as parameter. |
|
DescriptorSupport(int initNumFields)
Descriptor constructor. |
|
DescriptorSupport(String inStr)
Descriptor constructor taking an XML String. |
|
DescriptorSupport(String[] fields)
Constructor taking fields in the fieldName=fieldValue format. |
|
DescriptorSupport(String[] fieldNames,
Object[] fieldValues)
Constructor taking field names and field values. |
| Method Summary | |
|---|---|
Object |
clone()
Returns a new Descriptor which is a duplicate of the Descriptor. |
String[] |
getFieldNames()
Returns all the fields names in the descriptor. |
String[] |
getFields()
Returns all the fields in the descriptor. |
Object |
getFieldValue(String inFieldName)
Returns the value for a specific fieldname. |
Object[] |
getFieldValues(String[] fieldNames)
Returns all the field values in the descriptor as an array of Objects. |
boolean |
isValid()
Returns true if all of the fields have legal values given their names. |
void |
removeField(String fieldName)
Removes a field from the descriptor. |
void |
setField(String inFieldName,
Object fieldValue)
Sets the string value for a specific fieldname. |
void |
setFields(String[] fieldNames,
Object[] fieldValues)
Sets all Fields in the list to the new value with the same index in the fieldValue array. |
String |
toString()
Returns |
String |
toXMLString()
Returns an XML String representing the descriptor. |
| Methods inherited from class java.lang.Object |
|---|
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public DescriptorSupport()
isValid
returns false
)
public DescriptorSupport(int initNumFields) throws MBeanException, RuntimeOperationsException
isValid
returns false
).
initNumFields
- The initial capacity of the Map that
stores the descriptor fields.
RuntimeOperationsException
- for illegal value for
initNumFields (<= 0)
MBeanException
- Wraps a distributed communication Exception.public DescriptorSupport(DescriptorSupport inDescr)
inDescr
- the descriptor to be used to initialize the
constructed descriptor. If it is null or contains no descriptor
fields, an empty Descriptor will be created.public DescriptorSupport(String inStr) throws MBeanException, RuntimeOperationsException, XMLParseException
Descriptor constructor taking an XML String.
The format of the XML string is not defined, but an
implementation must ensure that the string returned by
toXMLString()
on an existing
descriptor can be used to instantiate an equivalent
descriptor using this constructor.
In this implementation, all field values will be created as Strings. If the field values are not Strings, the programmer will have to reset or convert these fields correctly.
inStr
- An XML-formatted string used to populate this
Descriptor. The format is not defined, but any
implementation must ensure that the string returned by
method toXMLString
on an existing
descriptor can be used to instantiate an equivalent
descriptor when instantiated using this constructor.
RuntimeOperationsException
- If the String inStr
passed in parameter is null
XMLParseException
- XML parsing problem while parsing
the input String
MBeanException
- Wraps a distributed communication Exception.public DescriptorSupport(String[] fieldNames, Object[] fieldValues) throws RuntimeOperationsException
fieldNames
- String array of field names. No elements of
this array can be null.fieldValues
- Object array of the corresponding field
values. Elements of the array can be null. The
fieldValue
must be valid for the
fieldName
(as defined in method isValid
)
Note: array sizes of parameters should match. If both arrays are null or empty, then an empty descriptor is created.
RuntimeOperationsException
- for illegal value for
field Names or field Values. The array lengths must be equal.
If the descriptor construction fails for any reason, this
exception will be thrown.public DescriptorSupport(String[] fields)
fields
- String array with each element containing a
field name and value. If this array is null or empty, then the
default constructor will be executed. Null strings or empty
strings will be ignored.
All field values should be Strings. If the field values are not Strings, the programmer will have to reset or convert these fields correctly.
Note: Each string should be of the form fieldName=fieldValue.
RuntimeOperationsException
- for illegal value for
field Names or field Values. The field must contain an
"=". "=fieldValue", "fieldName", and "fieldValue" are illegal.
FieldName cannot be null. "fieldName=" will cause the value to
be null. If the descriptor construction fails for any reason,
this exception will be thrown.| Method Detail |
|---|
public Object getFieldValue(String inFieldName) throws RuntimeOperationsException
getFieldValue
in interface Descriptor
inFieldName
- The field name in question; if not found,
null is returned.
RuntimeOperationsException
- for illegal value (null
or empty string) for field Names.public void setField(String inFieldName, Object fieldValue) throws RuntimeOperationsException
isValid
). If the field does not exist, it is
added at the end of the Descriptor. If it does exist, the
value is replaced.
setField
in interface Descriptor
inFieldName
- The field name to be set. Must
not be null or empty string.fieldValue
- The field value to be set for the field
name. Can be null or empty string.
RuntimeOperationsException
- for illegal value for
field Names.public String[] getFields()
getFields
in interface Descriptor
setFields(java.lang.String[], java.lang.Object[])
public String[] getFieldNames()
getFieldNames
in interface Descriptor
public Object[] getFieldValues(String[] fieldNames)
getFieldValues
in interface Descriptor
fieldNames
- String array of the names of the fields that
the values should be returned for.public void setFields(String[] fieldNames, Object[] fieldValues) throws RuntimeOperationsException
isValid
). If it is not valid, then an
exception will be thrown. If the arrays are empty, then no
change will take effect.
setFields
in interface Descriptor
fieldNames
- String array of field names. The array and
array elements cannot be null.fieldValues
- Object array of the corresponding field
values. The array cannot be null. Elements of the array can
be null.
RuntimeOperationsException
- for illegal value for
field Names or field Values. Neither can be null. The array
lengths must be equal.getFields()
public Object clone() throws RuntimeOperationsException
clone
in interface Descriptor
clone
in class Object
RuntimeOperationsException
- for illegal value for
field Names or field Values. If the descriptor construction
fails for any reason, this exception will be thrown.Cloneable
public void removeField(String fieldName)
removeField
in interface Descriptor
fieldName
- String name of the field to be removed.
If the field is not found no exception is thrown.public boolean isValid() throws RuntimeOperationsException
This implementation does not support interoperating with a directory or lookup service. Thus, conforming to the specification, no checking is done on the "export" field.
Otherwise this implementation returns false if:
isValid
in interface Descriptor
RuntimeOperationsException
- If the validity checking
fails for any reason, this exception will be thrown.public String toXMLString()
Returns an XML String representing the descriptor.
The format is not defined, but an implementation must
ensure that the string returned by this method can be
used to build an equivalent descriptor when instantiated
using the constructor DescriptorSupport(String inStr)
.
Fields which are not String objects will have toString() called on them to create the value. The value will be enclosed in parentheses. It is not guaranteed that you can reconstruct these objects unless they have been specifically set up to support toString() in a meaningful format and have a matching constructor that accepts a String in the same format.
If the descriptor is empty the following String is returned: <Descriptor></Descriptor>
RuntimeOperationsException
- for illegal value for
field Names or field Values. If the XML formated string
construction fails for any reason, this exception will be
thrown.public String toString()
toString
in class Object
RuntimeOperationsException
- for illegal value for
field Names or field Values. If the descriptor string fails
for any reason, this exception will be thrown.
|
JavaTM 2 Platform Standard Ed. 5.0 |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Copyright © 2004, 2010 Oracle and/or its affiliates. All rights reserved. Use is subject to license terms. Also see the documentation redistribution policy.


How the Internet Works
Home
Virtualization
Containerization
Virtualization vs Containerization
Docker Webserver Tutorial
Linux Commands & Docker Container
Docker & Pycharm
Team
Hi There!
This site is on Docker, Linux, and Containerization!


Huggins parameters and interaction parameters for PVA:CAR blends *.
Blend Composition
(η)
(dL/g)
Κ
H
b
(dL
2/g
2)
μ
R
2
w
PVA
w
CAR
1
0
0.793
0.427
0.268
–
0.998
0.990
0.010
1.107
0.214
0.263
−0.02
0.989
0.978
0.021
1.311
1.081
1.860
4.06
0.998
0.953
0.047
1.552
1.090
2.627
2.81
0.999
0.883
0.117
1.846
0.965
3.290
1.44
0.996
0.860
0.140
2.026
0.869
3.574
1.31
0.995
0.834
0.166
2.583
0.444
2.968
0.85
0.981
0.767
0.233
3.032
0.437
4.017
0.63
0.986
0
1
3.816
1.346
19.618
–
0.978
* The composition values presented in boldface correspond to the starting solutions from which PVA, PC5, PC12, and CAR gels were prepared through five successive freeze–thaw cycles.


This section describes the format of simple breakpoint conditions. We first list the tests that can be used to enquire the state of execution. We then proceed to describe the conditions usable in the action part and the options for focusing on past execution states. Finally, we describe condition macros and the format of the values of the debugger action variables.
We distinguish between two kinds of tests, based on whether they refer
to information stored in the backtrace or not. The latter
category, the non-backtraced tests, contains the conditions
related to the current port (port
, bid
, mode
,
show
, command
, get
) and the breakpoint type
selection conditions (advice
and debug
). All remaining
tests refer to information stored in the backtrace.
Non-backtraced tests will raise an exception, if they appear in
calls to execution_state/1
from outside the debugger, or in
queries about past execution state, in execution_state/2
.
Backtraced tests are allowed both inside and outside the
debugger. However such tests can fail if the given query is not
meaningful in the given context, e.g. if
execution_state(goal(G))
is queried before any breakpoints
were encountered.
Note that if a test is used in the second argument of
execution_state/2
, the term current, in the
following descriptions, should be interpreted as referring to the
execution state focused on (described by the first argument of
execution_state/2
).


Just want to open a topic where we all can list things that do not work as expected.
This thread should just list things that are buggy and this thread should no be used to discuss problems. Only a list of facts. Simple and handy. The battlelog forums is full of flamers that doesn't really help.
I begin
* Tower Collapse - All is stuck in the air when the tower collapse
* Random Frame Drops, doesn't matter which hardware on PC
* Delayed Stats in Battlelog
* Settings sometimes not loaded/saved properly
* Report Screen Ingame - Overlay of some elements
* Report Screen - Weird glitches on summarize points for ribbons, medals, etc...
* Flares of Heli sometimes doesn't help
* Support Ammo - Unexpected behaviour, doesn't reload ammo for me most of the time - Maybe i use the wrong ammo pack
* Support Ammo - Sometimes on drop ammo it fly miles away
* Glitches when heli explode in air - Elements stuck in air
* Interface looks "muddy", no clear edges, looks like upscaling
* Hit detection of explosives sometimes does not work properly - Rocket on a tank, no explosion is visible, for example
* Battlelog doesn't work when you have the language in url, exampl /de/ or /fr/ or something like that
* Deploy window stuck sometimes - Nothing clickable - Goto Menu and Back solve it
juress
Theme Developer
Support ammo - are you using the big pack? The small one only replenishes the ammo of the person that walks over it.
Topicstarter
BrainFooLong
Administrator
juress wrote:
Support ammo - are you using the big pack? The small one only replenishes the ammo of the person that walks over it.
Ok, that could be my fail. Will take a closer look into the specs.
Post edited 7 x times, last by
dapil
Plugin Developer
dapil
Plugin Developer
When I start the game, first time I visit the deploy screen, I can not click on any deploy point, and in the background, I can see the flag labels moving, like from the first person view from some other already deployed player. Escaping into menu and back fixes it.
Solved in an update
The console is flashing.
Solved by Brain
Battlelog: Unlocks page is not working (things not showing in the right window, dogtags not even showing), Awards page is not working (things not showing in the right window), Stats page is not working (things not showing in the right window).
Post edited 2 x times, last by
Meaurk
Global Moderator
Meaurk
Global Moderator
dapil wrote:
Battlelog: Unlocks page is not working (things not showing in the right window, dogtags not even showing), Awards page is not working (things not showing in the right window), Stats page is not working (things not showing in the right window).
No problems here with latest Chrome version.
And who was expecting the Beta would be perfect? I mean, it's not just called a Beta for some extra marketing. :-)
dapil
Plugin Developer
Meaurk wrote:
And who was expecting the Beta would be perfect? I mean, it's not just called a Beta for some extra marketing. :-)
I am absolutely aware of this.
Topicstarter
BrainFooLong
Administrator
dapil wrote:
Battlelog: Unlocks page is not working (things not showing in the right window, dogtags not even showing), Awards page is not working (things not showing in the right window), Stats page is not working (things not showing in the right window).
See
* Battlelog doesn't work when you have the language in url, exampl /de/ or /fr/ or something like that


Entrepreneurship. Empowerment. Excellence.
Put your skills to test with The E3 Challenge! Every summer, energetic and committed youth between the ages of 16-20 are divided into teams to compete with one another in three distinct business challenges - each with its own unique characteristics. The challenges range from direct sales to new product development proposals. Working in real-life situations not only helps our participants broaden their technical skills, it also gives them an opportunity to build new friendships and develop important "soft" skills that are often overlooked.
In addition to the challenge, a support system of mentors, workshops and seminars makes this competition a valuable learning experience. Judged on leadership, adaptability and teamwork, a winning team is selected at the end of three rounds of competition.
The E3 Challenge is a leadership development project under Power Unit Youth Organization. It was created to support Power Unit Youth Organization's mission by promoting entrepreneurship, empowerment and excellence in youth.
As a mentor, you are given the chance to have an impact on the growth of your mentees. You are able to share your experience and knowledge with them.  Not only is it a development opportunity for your mentees, it is also one for yourself. You look back at how you communicate with them; discovering what is the most effective way to get your message across and get your team to see you point. It is also a chance for you to develop your EQ, as sympathy and understanding play an important role when trying to push them forward. Finally, you have a chance to take part in the amazing challenges that your team is on. Frankly, I wish that I had the opportunities presented to them when I was their age!
As an E3 Mentor, I was pleasantly reminded of the creativity and resourcefulness of which young individuals are capable. Some of my participants impressed me with their ambition and leadership potential. Others impressed me with their efficiency and project management skills. All of them impressed me with their courage to overcome their weaknesses and fears as they became more confident in themselves.
My team won the 2013 E3 Challenge, but win or lose, I could not be more proud of their development as individuals and as a team. Three of my participants have immediately moved on to take important leadership roles in the E3 Challenge organizing team or other areas of PUYO.
The experience was equally rewarding for me, as I had the opportunity to work with other strong mentors and a pair of very dedicated peer advisors who care greatly about youth development.
The challenges definitely contributed to my team’s development in ways that the normal school curriculum would never have. I think some of the most important skills in today’s society are adaptation and teamwork. Although it may not have been a highlighted development skill in E3, it is vital to the younger generation. Businesses are starting to use social media, working with people across the globe, and assigning tasks that an employee may not have been normally responsible for. I feel that in order to succeed in today’s market, a candidate’s soft skills are just as, if not more important than their technical skills. The E3 was able to challenge my team by having them work with different personalities, adapt to the quickly changing environment of “Night It Up” on a daily basis, and most importantly, work in a team to accomplish the challenge. As many members of my team quickly learned, these challenges are not able to be completed by themselves (like some high school projects) and must utilize their team members. The teams that were able to identify a team leader and work effectively together typically came out stronger in presenting their challenges.
Interested in being a Mentor? Please contact Jenny Cui at<EMAIL_ADDRESS>for more information about this year's opportunities!
“On behalf of the TELUS team, I had a great time working with the E3 organizing primes and student teams. We were very impressed by the detailed marketing strategies that the teams developed under tight timelines and the level of professionalism showcased during the challenge presentations. Not only did the students highlight new marketing insights that we will incorporate into future campaigns, but it was also very rewarding to see the students develop their marketing skills during the challenge. Congrats and a job well done to all the 2013 E3 teams!”
- Ashley Cameron, Multicultural Marketing, TELUS
Hands-On Projects - Assist E3 participants in obtaining practical experience through working with your company’s established product lines and services. Allow the youths to implement their ideas and observe the results of their efforts first hand.
Professional Feedback - Take part in evaluating E3 participants’ performance. Provide professional feedback to E3 participants and help them further their development.
Invest in Our Community’s Youths - Your participation in The E3 Challenge provides a valuable learning experience to many ambitious youths. Cookie-cutter type textbook education no longer suffices in equipping youths with the necessary tools to succeed. Help us make learning fun and project your company as the driving force behind youth-empowering initiatives.
Reach Out to the Youth Market - Through the projects, allow the youths to familiarize with your products and services first hand. Get them involved, engaged, and leave a lasting impression!
Maybe you've missed the deadline for the E3 challenge this year, but no worries! Live through the E3 challenge experience with the current participants via our post challenge updates!
Our awesome E3 team definitely tested themselves during Night It Up! these past three days from July 11th-13th. Given only a tent, table, and lightbulb, each team had to come up with their own unique game for NIU! Standing guard at game booths three days in a row is a tough job, not to mention promoting under the hot and blazing sun, straining voices to get advertisements out, and working strenuous hours both pre and post the actual event. Despite innumerable rocky bumps along the way, all of our participants, mentors, and peer advisers endured their path along this demanding, vigorous, but most importantly, absolutely rewarding first E3 Challenge!
All of the E3 participants have indubitably gained important skills throughout the making of this first challenge, such as communicative skills, teamwork, perseverance, responsibility, and entrepreneurship. Personal development is a major value of PUYO and our E3 team has demonstrated great growth throughout this first E3 challenge. Best of all, everyone exhibited great philanthropic intentions as each team worked as hard as they could to bring in the most profit as possible for UNITY charity.


vHow to
accomplish these things:
Stick to a few
important points
Keep your
questions tightly worded and leading
Dont make big
jumps in questions
Order questions
carefully to make an argument implicit
DONT ASK ONE
QUESTION TOO MANY!!!
vDifferences between Mock Trial and real
trial
Emphasis on
showmanship
Witness is trying
to fight you
Judged more on presentation then
on content
v
vWhat the above
means:
Looking
confide*ant is more important than eliciting vital information
Witness control is
essential
v


Badges can be applied to a Segmented Control when the mode is 'default'. A badge can be added to any SegmentItem, using the badge property.
The badge can contain either a plain text string through 'content', or an icon provided as either the name of any default icon, or customName of any registered icon, in its 'icon' property. The description of the badge is used as aria-label.
Note on size: For all modes, the touch area will always be a minimum of 44px by 44px. If chip/segment is smaller than this, the surrounding area will still be clickable, to preserve accessibility.


{% extends "templates/layouts/container.html" %} {% block extra_style %} {% endblock %} {% block content %}
is a tool that we designed to make it easier for developers (especially Front-end Developers) to create and create user interfaces as outlined in the visual web form of the design that has been determined.


This software package implements functions to simulate spherical, ellipsoid and cubic polyatomic nanoparticles with arbitrary crystal structures and to calculate the associated pair-distribution function and X-ray/neutron total-scattering signals. It also provides a target function that can be used for simultaneous fitting of small- and wide-angle total scattering data in real and reciprocal spaces. The target function can be generated either as a sum of weighted residuals for individual datasets or as a vector of residuals suitable for optimization using multi-criteria algorithms (e.g. Pareto methods).
| Version: | 2.0-6 |
| Imports: | distrEx, rgl |
| Suggests: | DEoptim, mco |
| Published: | 2015-09-25 |
| Author: | Anton Gagin, Katharine Mullen, Igor Levin |
| Maintainer: | Anton Gagin <av.gagin at gmail.com> |
| License: | GPL-2 | GPL-3 [expanded from: GPL (≥ 2)] |
| URL: | http://scripts.iucr.org/cgi-bin/paper?S1600576714001046 |
| NeedsCompilation: | yes |
| Citation: | nanop citation info |
| Materials: | NEWS |
| CRAN checks: | nanop results |
| Reference manual: | nanop.pdf |
| Package source: | nanop_2.0-6.tar.gz |
| Windows binaries: | r-devel: nanop_2.0-6.zip, r-release: nanop_2.0-6.zip, r-oldrel: nanop_2.0-6.zip |
| OS X binaries: | r-release: nanop_2.0-6.tgz, r-oldrel: nanop_2.0-6.tgz |
| Old sources: | nanop archive |
Please use the canonical form https://CRAN.R-project.org/package=nanop to link to this page.


London tenant unable to heat his house after landlord cages thermostat
A London tenant was left unable to warm his house up after his landlord put the thermostat in a cage.
Alex Milsom shared a picture of the thermostat on Twitter, where it quickly went viral.
He told the PA news agency: “Hilariously/alarmingly this is a common experience as other people who have replied to my tweet have told me.
Sometime between Friday night and Saturday afternoon, we found our Nest adopted the motto of MC Hammer - namely 'can’t touch this' - and lo-and-behold we had no ability to control the thermostat
“We had the Nest installed earlier this month, and then sometime between Friday night and Saturday afternoon we found our Nest adopted the motto of MC Hammer – namely ‘can’t touch this’ – and lo-and-behold we had no ability to control the thermostat.
“This also affected our ability to control the hot water – and today and yesterday we found our hot water availability in short-supply.”
With the temperature getting increasingly frosty, Mr Milsom said he is unable to heat up extra water in the house, and ended up having to shower at work when the hot water ran out.
He added: “People across London, the UK, and indeed across the world have replied to my tweet to say about their experiences. From landlords who have taken away heating to landlords who have been even worse, it’s a really important discussion that I’m glad we had.
“It was also super endearing how everyone has been willing to support me as well – from free legal advice to everything else under the sun!”
Polly Neate, chief executive of Shelter, said: “This is yet another example of the raw deal private renters get in England.
“If your home is excessively cold or hot, it can be classed as a hazard under the health and safety rating system for rented homes. It is not acceptable for a landlord to provide an inadequate level of heating.
“And if your landlord is coming into your home without notice, then it could be harassment.
READ MORE
Former chancellor Philip Hammond quits Britain's Parliament
“Shelter’s trained advisers are on hand seven days a week to support anyone facing housing problems like this, from poor quality housing to eviction notices. To get advice and support, visit www.shelter.org.uk/gethelp.”


- A
- C
- D
- L
- N
- P
- T
Returns a link to the commit author. If the author has a matching user and is a member of the current @project it will link to the team member page. Otherwise it will link to the author email as specified in the commit.
options:
avatar: true will prepend the avatar image size: size of the avatar image in px
Source: show
Just like author_link but for the committer.
Source: show
# File app/decorators/commit_decorator.rb, line 57 def committer_link(options = {}) person_link(options.merge source: :committer) end
Returns the commits description
cut off, ellipses (`&hellp;`) are prepended to the commit message.
Source: show
# File app/decorators/commit_decorator.rb, line 34 def description description = safe_message title_end = description.index(%r\n/) if (!title_end && description.length > 80) || (title_end && title_end > 80) "…".html_safe << description[70..-1] else description.split(%r\n/, 2)[1].try(:chomp) end end
Returns a string describing the commit for use in a link title
Example
"Commit: Alex Denisov - Project git clone panel"
Source: show
# File app/decorators/commit_decorator.rb, line 9 def link_title "Commit: #{author_name} - #{title}" end
Returns the commits title.
Usually, the commit title is the first line of the commit message. In case this first line is longer than 80 characters, it is cut off after 70 characters and ellipses (`&hellp;`) are appended.
Source: show
# File app/decorators/commit_decorator.rb, line 18 def title title = safe_message return no_commit_message if title.blank? title_end = title.index(%r\n/) if (!title_end && title.length > 80) || (title_end && title_end > 80) title[0..69] << "…".html_safe else title.split(%r\n/, 2).first end end
Source: show
# File app/decorators/commit_decorator.rb, line 63 def no_commit_message "--no commit message" end
Private: Returns a link to a person. If the person has a matching user and is a member of the current @project it will link to the team member page. Otherwise it will link to the person email as specified in the commit.
options:
source: one of :author or :committer avatar: true will prepend the avatar image size: size of the avatar image in px
Source: show
# File app/decorators/commit_decorator.rb, line 75 def person_link(options = {}) source_name = send "#{options[:source]}_name".to_sym source_email = send "#{options[:source]}_email".to_sym text = if options[:avatar] avatar = h.image_tag h.gravatar_icon(source_email, options[:size]), class: "avatar #{"s#{options[:size]}" if options[:size]}", width: options[:size], alt: "" %Q{#{avatar} #{source_name}} else source_name end team_member = @project.try(:team_member_by_name_or_email, source_name, source_email) if team_member.nil? h.mail_to source_email, text.html_safe, class: "commit-#{options[:source]}-link" else h.link_to text, h.project_team_member_path(@project, team_member), class: "commit-#{options[:source]}-link" end end


|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface BeanPostInstantiationSupportInterface
The Interface BeanPostInstantiationSupportInterface.
| Method Summary | |
|---|---|
boolean |
addBeanPostInstantiation(java.util.Collection<java.lang.Object> collection)
Appends all of the BeanPostInstantiation s in the specified
collection to the end of this processor's managed list. |
boolean |
addBeanPostInstantiation(int index,
java.util.Collection<java.lang.Object> collection)
Inserts all of the BeanPostInstantiation s in the specified
collection into this processor's managed list at the specified position. |
void |
addBeanPostInstantiation(int index,
java.lang.Object instance)
Inserts the specified element at the specified position in this processor's managed list. |
boolean |
addBeanPostInstantiation(java.lang.Object instance)
Appends the specified BeanPostInstantiation to the end of this
processor's managed list. |
java.lang.Object |
removeBeanPostInstantiation(int index)
Removes the specified BeanPostInstantiation at the specified
position. |
boolean |
removeBeanPostInstantiation(java.lang.Object obj)
Removes the specified BeanPostInstantiation . |
| Method Detail |
|---|
boolean addBeanPostInstantiation(java.lang.Object instance)
BeanPostInstantiation
to the end of this
processor's managed list.
instance
- BeanPostInstantiation
to be appended to this list
void addBeanPostInstantiation(int index, java.lang.Object instance)
index
- index at which the specified BeanPostInstantiation
is
to be insertedinstance
- BeanPostInstantiation
instance to be insertedboolean addBeanPostInstantiation(java.util.Collection<java.lang.Object> collection)
BeanPostInstantiation
s in the specified
collection to the end of this processor's managed list.
collection
- collection containing BeanPostInstantiation
s to be
added
boolean addBeanPostInstantiation(int index, java.util.Collection<java.lang.Object> collection)
BeanPostInstantiation
s in the specified
collection into this processor's managed list at the specified position.
index
- index at which to insert the first element from the specified
collectioncollection
- collection containing BeanPostInstantiation
s to be
added to list
java.lang.Object removeBeanPostInstantiation(int index)
BeanPostInstantiation
at the specified
position.
index
- the index of the BeanPostInstantiation
to be removed
BeanPostInstantiation
was removed.boolean removeBeanPostInstantiation(java.lang.Object obj)
BeanPostInstantiation
.
obj
- the instance of BeanPostInstantiation
to be removed,
if present.
BeanPostInstantiation
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |


Run For A Cause: 10km finish line photos
Thousands of runners hit the road around Ballarat for the 2019 Run for a Cause on Sunday.
Our photographers were out and about trying to take as many photos as possible as the people of Ballarat being put through their paces.
Flick through the gallery above to see who you can spot and find links to all the other galleries below.
All photos are available to purchase from The Courier. Simply call 5320 1200 or pop by our office at 2 Webster Street to get your copy.
OTHER GALLERIES
Run for a Cause 2019 | kids' dash photos


{{>gramble-item title="The Robots Are Coming" excerpt="John Lanchester on what automation means for economies (and people)" img="/images/metropolis.jpg"}}
{{>gramble-item title="Minimum Viable Audience" excerpt="Build an audience before you build a business"}}
{{>gramble-item title="Seneca" excerpt="Micro-services toolkit for Node.js" img="/images/seneca.jpg"}}
{{>gramble-item title="Writing code for humans" excerpt="Writing JavaScript like poetry"}}
{{>gramble-item title="Schumpeter: Author-preneurship" excerpt="How to game best seller lists! Cites Eric Ries' Lean Startup" img="/images/books.jpg"}}
{{>gramble-item title="Prose.io" excerpt="A content editor for GitHub"}}


Product details
Product Name
SKU
Price
This field must be a number
Cost
This field must be a number
Minimum Stock
This field must be a number
Current Stock
This field must be a number
Custom Product
Description
Add materials by:
Item
Set
Add
Add
{{pm.material.name}} x {{pm.quantity}} (@{{pm.material.unit_cost}} each = ${{pm.material.unit_cost * pm.quantity }} )
Submit
Delete
Cancel


MapReduce Views Using the PHP SDK with Couchbase Server
You can use MapReduce views to create queryable secondary indexes in Couchbase Server.
The normal CRUD methods allow you to look up a document by its ID. A MapReduce (view query) allows you to look up one or more documents based on various criteria. MapReduce views are comprised of a map function that is executed once per document (this is done incrementally, so this is not run each time you query the view) and an optional reduce function that performs aggregation on the results of the map function. The map and reduce functions are stored on the server and written in JavaScript.
MapReduce queries can be further customized during query time to allow only a subset (or range) of the data to be returned.
| See the 6.0@server:learn:views/views-writing.adoc and 6.0@server:learn:views/views-querying.adoc sections of the general documentation to learn more about views and their architecture. |
The following example is the definition of a by_name
view in a "landmarks" design document in the "travel-sample" sample dataset.
This view checks whether a document is a landmark and has a name.
If it does, it emits the landmark’s name into the index.
This view allows landmarks to be queried for by it’s "name" field.
function (doc, meta) {
if (doc.type && doc.type == "landmark" && doc.name) {
emit(doc.name, null);
}
}
A Spatial View can instead be queried with a range
or bounding box.
For example, let’s imagine we have stored landmarks with coordinates for their home city (eg.
Paris, Vienna, Berlin and New York) under geo
, and each city’s coordinates is represented as two attributes, lon
and lat
.
The following spatial view map function could be used to find landmarks within Europe, as a "by_location" view in a "spatial" design document:
function (doc, meta) {
if (doc.type && doc.type == "landmark" && doc.geo) {
emit([doc.geo.lon, doc.geo.lat], null);
}
}
Querying Views from the PHP SDK
Once you have a view defined, it can be queried from the PHP SDK by using the query(CouchbaseViewQuery $query)
method on the CouchbaseBucket class.
Here is an example:
$query = CouchbaseViewQuery::from("landmarks", "by_name")->limit(10);
$landmarks = $bucket->query($query);
foreach ($landmarks->rows as $landmark)
{
printf("%s\n", $landmark->key);
}
The CouchbaseBucket.query
method takes an instance of CouchbaseViewQuery, executes it and returns back the result of query as either stdClass
instance (which is default) or nested array depending on third argument $json_asarray
.
Some useful methods and properties of the CouchbaseViewQuery
class include (others can be seen in the reference documentation):
-
order
: set order of documents in result, acceptsCouchbaseViewQuery::ORDER_ASCENDING
orCouchbaseViewQuery::ORDER_DESCENDING
-
skip
: skip this number of records before starting to return the results -
limit
: limit the number of the returned documents to the specified number -
key
: return only documents that match the specified key. -
keys
: return only documents that match one of keys specified within the given array
The value returned by query
implementation that contains the results of the query and number of rows.
Depending on $json_asarray
they should be accessed with property (default) or array syntax.
-
rows
: the results of the query. -
total_rows
: the total count of all rows.
The entry of rows
collection represents each row returned by the view request and contains properties for the document id
, the key
and the value
if it was emitted.
Here is another example of a more advanced query:
$query = CouchbaseViewQuery::from("landmarks", "by_name")
->limit(10)->range("A", "\u0fff");
$landmarks = $bucket->query($query);
foreach ($landmarks->rows as $landmark)
{
printf("%s\n", $landmark->key);
}
Here’s some sample output for the previous query:
A R M Chicken A. Cavalli & A16 Abacus Books Abbey and Palace of Holyroodhouse Abbey Grounds Abbot Kinney Abbots Tandoori ABC Bakery Cafe Aberconwy House
Querying Geospatial Views
To query a geospatial view, you will need to construct a CouchbaseViewQuery
object using fromSpatial
factory method.
Spatial queries accept additional builder method bbox
which allow you to limit the enclosing bounding boxes of the result.
The argument to this method is and array of four double
's with each element corresponding to a component emitted by the key (longitude and latitude).
On output, spatial queries yield objects similar to how regular view query does, with an added Geometry
property.
$query = CouchbaseViewQuery::fromSpatial("spatial", "routes")
->limit(10)->bbox(array(0, -90, 180, 90));
$routes = $bucket->query($query);
foreach ($routes->rows as $route)
{
var_dump($route->value);
}
The output:
array(3) { [0]=> string(5) "US964" [1]=> string(3) "DCA" [2]=> string(3) "CRW" } array(3) { [0]=> string(5) "DL790" [1]=> string(3) "MSP" [2]=> string(3) "CLE" } ...
In the example above, we construct a CouchbaseViewQuery
that will target the "routes" view on the "spatial" design document.
/*
Emit all the flights. You can filter them by day and time.
*/
function(doc, meta) {
if (doc.type === 'route') {
for (var i = 0; i < doc.schedule.length; i++) {
var schedule = doc.schedule[i];
var time = parseInt(schedule.utc.replace(/:/g, ''));
var key = [schedule.day, time];
var value = [
schedule.flight,
doc.sourceairport,
doc.destinationairport
];
emit(key, value);
}
}
}
We then pass the start and end coordinates in via the bbox
method and finally we limit are results to 10 items with the limit
method.


The GRIFFIN Collaboration consists of a consortium of institutional members and a team of physicists and engineers from across Canada and abroad. GRIFFIN is administered by its Steering Committee, and codified by its Collaboration Bylaws. The individual experiments performed with GRIFFIN are selected by the TRIUMF Experimental Evaluation Committee (EEC) which reviews all proposals for experiments at ISAC and awards beamtime based on the scientific merit and technical feasibility of the competing proposals.
A memorandum of understanding has been agreed between the initial instiutional member institutions.
| Name | Institution | Responsibility |
| Adam Garnsworthy | TRIUMF | Co-Principal Investigator Director of GRIFFIN Activities, Infrastructure, DAQ Steering Committee, LV Power, Cables |
| Carl Svensson | University of Guelph | Co-Principal Investigator Financial Management, Reporting, Detectors, HPGe Procurement, Simulations |
| Chris Pearson | TRIUMF | Data Acquisition, DAQ Steering Committee, DAQ Implementation, Computing |
| Paul Garrett | University of Guelph | Instrumentation, DAQ Steering Committee, Auxiliary Detector Integration, Electronics Shack |
| Kris Starosta | Simon Fraser University | HPGe Testing/MRO, DAQ Steering Committee, Online Analysis |
| Daryl Bishop | TRIUMF | DAQ Steering Committee |
| Jean-Pierre Martin | Univerite de Montreal | DAQ Development |
| Greg Hackman | TRIUMF | Mechanical Structure, LN2 System |
| Barry Davids | TRIUMF | Electrical Services |
| Gordon Ball | TRIUMF | Experimental Hall and Beamline Integration |
| Corina Andreoiu | Simon Fraser University | HPGe HV Power |
| Name | Institution | Responsibility |
| Corina Andreoiu | Simon Fraser University | Co-Principal Investigator Financial Management, Reporting, BGO Testing/MRO, preamplifiers |
| Carl Svensson | University of Guelph | Co-Principal Investigator Financial Management, Reporting, Detectors, BGO Procurement |
| Adam Garnsworthy | TRIUMF | Director of GRIFFIN Activities, Infrastructure, Digitizers, VME64x crates, Cables |
| Chris Pearson | TRIUMF | Data Acquisition, DAQ Implementation, Computing |
| Paul Garrett | University of Guelph | High-Voltage supply procurement |
| Greg Hackman | TRIUMF | Low-Voltage power supply procurement |


public class CvGBTrees extends CvStatModel
The class implements the Gradient boosted tree model as described in the beginning of this section.
| Modifier and Type | Field and Description |
|---|---|
static int |
ABSOLUTE_LOSS |
static int |
DEVIANCE_LOSS |
static int |
HUBER_LOSS |
static int |
SQUARED_LOSS |
| Constructor and Description |
|---|
CvGBTrees()
Default and training constructors.
|
CvGBTrees(Mat trainData,
int tflag,
Mat responses)
Default and training constructors.
|
CvGBTrees(Mat trainData,
int tflag,
Mat responses,
Mat varIdx,
Mat sampleIdx,
Mat varType,
Mat missingDataMask,
CvGBTreesParams params)
Default and training constructors.
|
| Modifier and Type | Method and Description |
|---|---|
void |
clear()
Clears the model.
|
float |
predict(Mat sample)
Predicts a response for an input sample.
|
float |
predict(Mat sample,
Mat missing,
Range slice,
int k)
Predicts a response for an input sample.
|
boolean |
train(Mat trainData,
int tflag,
Mat responses)
Trains a Gradient boosted tree model.
|
boolean |
train(Mat trainData,
int tflag,
Mat responses,
Mat varIdx,
Mat sampleIdx,
Mat varType,
Mat missingDataMask,
CvGBTreesParams params,
boolean update)
Trains a Gradient boosted tree model.
|
load, load, save, save
public static final int ABSOLUTE_LOSS
public static final int DEVIANCE_LOSS
public static final int HUBER_LOSS
public static final int SQUARED_LOSS
public CvGBTrees()
Default and training constructors.
The constructors follow conventions of "CvStatModel.CvStatModel". See "CvStatModel.train" for parameters descriptions.
public CvGBTrees(Mat trainData, int tflag, Mat responses)
Default and training constructors.
The constructors follow conventions of "CvStatModel.CvStatModel". See "CvStatModel.train" for parameters descriptions.
trainData
- a trainDatatflag
- a tflagresponses
- a responsespublic CvGBTrees(Mat trainData, int tflag, Mat responses, Mat varIdx, Mat sampleIdx, Mat varType, Mat missingDataMask, CvGBTreesParams params)
Default and training constructors.
The constructors follow conventions of "CvStatModel.CvStatModel". See "CvStatModel.train" for parameters descriptions.
trainData
- a trainDatatflag
- a tflagresponses
- a responsesvarIdx
- a varIdxsampleIdx
- a sampleIdxvarType
- a varTypemissingDataMask
- a missingDataMaskparams
- a paramspublic void clear()
Clears the model.
The function deletes the data set information and all the weak models and sets all internal variables to the initial state. The function is called in "CvGBTrees.train" and in the destructor.
public float predict(Mat sample)
Predicts a response for an input sample.
The method predicts the response corresponding to the given sample (see "Predicting with GBT"). The result is either the class label or the estimated function value. The "CvGBTrees.predict" method enables using the parallel version of the GBT model prediction if the OpenCV is built with the TBB library. In this case, predictions of single trees are computed in a parallel fashion.
sample
- Input feature vector that has the same format as every training
set element. If not all the variables were actually used during training,
sample
contains forged values at the appropriate places.public float predict(Mat sample, Mat missing, Range slice, int k)
Predicts a response for an input sample.
The method predicts the response corresponding to the given sample (see "Predicting with GBT"). The result is either the class label or the estimated function value. The "CvGBTrees.predict" method enables using the parallel version of the GBT model prediction if the OpenCV is built with the TBB library. In this case, predictions of single trees are computed in a parallel fashion.
sample
- Input feature vector that has the same format as every training
set element. If not all the variables were actually used during training,
sample
contains forged values at the appropriate places.missing
- Missing values mask, which is a dimensional matrix of the same
size as sample
having the CV_8U
type.
1
corresponds to the missing value in the same position in the
sample
vector. If there are no missing values in the feature
vector, an empty matrix can be passed instead of the missing mask.slice
- Parameter defining the part of the ensemble used for prediction.
If slice = Range.all()
, all trees are used. Use this parameter
to get predictions of the GBT models with different ensemble sizes learning
only one model.
k
- Number of tree ensembles built in case of the classification problem
(see "Training GBT"). Use this parameter to change the output to sum of the
trees' predictions in the k
-th ensemble only. To get the total
GBT model prediction, k
value must be -1. For regression
problems, k
is also equal to -1.public boolean train(Mat trainData, int tflag, Mat responses)
Trains a Gradient boosted tree model.
The first train method follows the common template (see "CvStatModel.train").
Both tflag
values (CV_ROW_SAMPLE
, CV_COL_SAMPLE
)
are supported.
trainData
must be of the CV_32F
type.
responses
must be a matrix of type CV_32S
or
CV_32F
. In both cases it is converted into the CV_32F
matrix inside the training procedure. varIdx
and
sampleIdx
must be a list of indices (CV_32S
) or a
mask (CV_8U
or CV_8S
). update
is a
dummy parameter.
The second form of "CvGBTrees.train" function uses "CvMLData" as a data set
container. update
is still a dummy parameter.
All parameters specific to the GBT model are passed into the training function as a "CvGBTreesParams" structure.
trainData
- a trainDatatflag
- a tflagresponses
- a responsespublic boolean train(Mat trainData, int tflag, Mat responses, Mat varIdx, Mat sampleIdx, Mat varType, Mat missingDataMask, CvGBTreesParams params, boolean update)
Trains a Gradient boosted tree model.
The first train method follows the common template (see "CvStatModel.train").
Both tflag
values (CV_ROW_SAMPLE
, CV_COL_SAMPLE
)
are supported.
trainData
must be of the CV_32F
type.
responses
must be a matrix of type CV_32S
or
CV_32F
. In both cases it is converted into the CV_32F
matrix inside the training procedure. varIdx
and
sampleIdx
must be a list of indices (CV_32S
) or a
mask (CV_8U
or CV_8S
). update
is a
dummy parameter.
The second form of "CvGBTrees.train" function uses "CvMLData" as a data set
container. update
is still a dummy parameter.
All parameters specific to the GBT model are passed into the training function as a "CvGBTreesParams" structure.
trainData
- a trainDatatflag
- a tflagresponses
- a responsesvarIdx
- a varIdxsampleIdx
- a sampleIdxvarType
- a varTypemissingDataMask
- a missingDataMaskparams
- a paramsupdate
- a update


BATTERIE"Mizmar" at Le Baiser Salé, Paris, France, "Convergences" by Agata Husser (drum solo excerpt), October 2015 |
PERCUSSION"My One and only love", solo on a vibraphone, Zürich 2016
|
|
MIZMAR in Paris, February 2014
|
"Polka" on xylophone with Harmony Orchester of Senlis Senlis, France, February 2016
|
|
V International Percussion Festival "Sources and Inspirations", Cracow, may 2007 |
"Lady Bird" by John Lawless, snare drum solo, Cracow 2010
|
|
"New Ground" by Darmon Meader in a practice room, Cracow 2010 |
"Concerto for Timpani and Percussion Ensemble" by John Beck, Cracow 2010
|


dml: Distance Metric Learning in R
2018
- Yuan Tang,
- Tao Gao,
- Nan Xiao
Journal of Open Source Software, 3(30), 1036. https://doi.org/10.21105/joss.01036
autoplotly: An R Package for Automatic Generation of Interactive Visualizations for Statistical Results
2018
Journal of Open Source Software, 3(24), 657. https://doi.org/10.21105/joss.00657
TensorFlow Estimators: Managing Simplicity vs. Flexibility in High-Level Machine Learning Frameworks
2017
- Heng-Tze Cheng,
- Lichan Hong,
- Mustafa Ispir,
- Clemens Mewald,
- Zakaria Haque,
- Illia Polosukhin,
- Georgios Roumpos,
- D Sculley,
- Jamie Smith,
- David Soergel,
- Yuan Tang,
- Philipp Tucker,
- Martin Wicke,
- Cassandra Xia,
- Jianwei Xie
Proceedings of the 23rd ACM SIGKDD International Conference on Knowledge Discovery and Data Mining, Halifax, NS, Canada, August 13 - August 17, 2017
TensorFlow实战 (TensorFlow in Practice)
2017
Beijing Publishing House of Electronics Industry
ggfortify: Unified Interface to Visualize Statistical Result of Popular R Packages
2016
- Yuan Tang,
- Masaaki Horikoshi,
- Wenxuan Li
The R Journal 8.2 (2016): 478-489
TF.Learn: TensorFlow's High-level Module for Distributed Machine Learning
2016
arXiv preprint arXiv:1612.04251
lfda: An R Package for Local Fisher Discriminant Analysis and Visualization
2016
arXiv preprint arXiv:1612.09219
Incorporating Hierarchical Structure Into Dynamic Systems: An Application Of Estimating HIV Epidemics At Sub-National And Sub-Population Level
2016
- Le Bao,
- Ben Sheng,
- Xiaoyue Niu,
- Yuan Tang,
- Tim Brown,
- Peter D. Ghys,
- Jeff W. Eaton
arXiv preprint arXiv:1602.05665


ShEx Schema IDE
Source Schema*
File
Query
URL
Source Sample Data*
File
Query
URL
ShEx Schema Map File
File
URL
>