/*
    This file is part of the WebKit open source project.
    This file has been generated by generate-bindings.pl. DO NOT MODIFY!

    This library is free software; you can redistribute it and/or
    modify it under the terms of the GNU Library General Public
    License as published by the Free Software Foundation; either
    version 2 of the License, or (at your option) any later version.

    This library is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    Library General Public License for more details.

    You should have received a copy of the GNU Library General Public License
    along with this library; see the file COPYING.LIB.  If not, write to
    the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.
*/

#include "config.h"
#include "V8SVGFETurbulenceElement.h"

#if ENABLE(SVG) && ENABLE(FILTERS)

#include "CSSMutableStyleDeclaration.h"
#include "ExceptionCode.h"
#include "RuntimeEnabledFeatures.h"
#include "V8Binding.h"
#include "V8BindingMacros.h"
#include "V8BindingState.h"
#include "V8CSSStyleDeclaration.h"
#include "V8CSSValue.h"
#include "V8DOMWrapper.h"
#include "V8IsolatedContext.h"
#include "V8Proxy.h"
#include "V8SVGAnimatedEnumeration.h"
#include "V8SVGAnimatedInteger.h"
#include "V8SVGAnimatedLength.h"
#include "V8SVGAnimatedNumber.h"
#include "V8SVGAnimatedString.h"
#include "V8SVGElement.h"
#include <wtf/GetPtr.h>
#include <wtf/RefCounted.h>
#include <wtf/RefPtr.h>

namespace WebCore {

WrapperTypeInfo V8SVGFETurbulenceElement::info = { V8SVGFETurbulenceElement::GetTemplate, V8SVGFETurbulenceElement::derefObject, 0, &V8SVGElement::info };

namespace SVGFETurbulenceElementInternal {

template <typename T> void V8_USE(T) { }

static v8::Handle<v8::Value> baseFrequencyXAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
{
    INC_STATS("DOM.SVGFETurbulenceElement.baseFrequencyX._get");
    SVGFETurbulenceElement* imp = V8SVGFETurbulenceElement::toNative(info.Holder());
    return toV8(imp->baseFrequencyXAnimated());
}

static v8::Handle<v8::Value> baseFrequencyYAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
{
    INC_STATS("DOM.SVGFETurbulenceElement.baseFrequencyY._get");
    SVGFETurbulenceElement* imp = V8SVGFETurbulenceElement::toNative(info.Holder());
    return toV8(imp->baseFrequencyYAnimated());
}

static v8::Handle<v8::Value> numOctavesAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
{
    INC_STATS("DOM.SVGFETurbulenceElement.numOctaves._get");
    SVGFETurbulenceElement* imp = V8SVGFETurbulenceElement::toNative(info.Holder());
    return toV8(imp->numOctavesAnimated());
}

static v8::Handle<v8::Value> seedAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
{
    INC_STATS("DOM.SVGFETurbulenceElement.seed._get");
    SVGFETurbulenceElement* imp = V8SVGFETurbulenceElement::toNative(info.Holder());
    return toV8(imp->seedAnimated());
}

static v8::Handle<v8::Value> stitchTilesAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
{
    INC_STATS("DOM.SVGFETurbulenceElement.stitchTiles._get");
    SVGFETurbulenceElement* imp = V8SVGFETurbulenceElement::toNative(info.Holder());
    return toV8(static_pointer_cast<SVGAnimatedEnumeration>(imp->stitchTilesAnimated()));
}

static v8::Handle<v8::Value> typeAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
{
    INC_STATS("DOM.SVGFETurbulenceElement.type._get");
    SVGFETurbulenceElement* imp = V8SVGFETurbulenceElement::toNative(info.Holder());
    return toV8(static_pointer_cast<SVGAnimatedEnumeration>(imp->typeAnimated()));
}

static v8::Handle<v8::Value> xAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
{
    INC_STATS("DOM.SVGFETurbulenceElement.x._get");
    SVGFETurbulenceElement* imp = V8SVGFETurbulenceElement::toNative(info.Holder());
    return toV8(imp->xAnimated());
}

static v8::Handle<v8::Value> yAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
{
    INC_STATS("DOM.SVGFETurbulenceElement.y._get");
    SVGFETurbulenceElement* imp = V8SVGFETurbulenceElement::toNative(info.Holder());
    return toV8(imp->yAnimated());
}

static v8::Handle<v8::Value> widthAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
{
    INC_STATS("DOM.SVGFETurbulenceElement.width._get");
    SVGFETurbulenceElement* imp = V8SVGFETurbulenceElement::toNative(info.Holder());
    return toV8(imp->widthAnimated());
}

static v8::Handle<v8::Value> heightAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
{
    INC_STATS("DOM.SVGFETurbulenceElement.height._get");
    SVGFETurbulenceElement* imp = V8SVGFETurbulenceElement::toNative(info.Holder());
    return toV8(imp->heightAnimated());
}

static v8::Handle<v8::Value> resultAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
{
    INC_STATS("DOM.SVGFETurbulenceElement.result._get");
    SVGFETurbulenceElement* imp = V8SVGFETurbulenceElement::toNative(info.Holder());
    return toV8(imp->resultAnimated());
}

static v8::Handle<v8::Value> classNameAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
{
    INC_STATS("DOM.SVGFETurbulenceElement.className._get");
    SVGFETurbulenceElement* imp = V8SVGFETurbulenceElement::toNative(info.Holder());
    return toV8(imp->classNameAnimated());
}

static v8::Handle<v8::Value> styleAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
{
    INC_STATS("DOM.SVGFETurbulenceElement.style._get");
    SVGFETurbulenceElement* imp = V8SVGFETurbulenceElement::toNative(info.Holder());
    return toV8(imp->style());
}

static v8::Handle<v8::Value> getPresentationAttributeCallback(const v8::Arguments& args)
{
    INC_STATS("DOM.SVGFETurbulenceElement.getPresentationAttribute");
    SVGFETurbulenceElement* imp = V8SVGFETurbulenceElement::toNative(args.Holder());
    STRING_TO_V8PARAMETER_EXCEPTION_BLOCK(V8Parameter<>, name, MAYBE_MISSING_PARAMETER(args, 0, MissingIsUndefined));
    return toV8(imp->getPresentationAttribute(name));
}

} // namespace SVGFETurbulenceElementInternal

static const BatchedAttribute SVGFETurbulenceElementAttrs[] = {
    // Attribute 'baseFrequencyX' (Type: 'readonly attribute' ExtAttr: '')
    {"baseFrequencyX", SVGFETurbulenceElementInternal::baseFrequencyXAttrGetter, 0, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
    // Attribute 'baseFrequencyY' (Type: 'readonly attribute' ExtAttr: '')
    {"baseFrequencyY", SVGFETurbulenceElementInternal::baseFrequencyYAttrGetter, 0, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
    // Attribute 'numOctaves' (Type: 'readonly attribute' ExtAttr: '')
    {"numOctaves", SVGFETurbulenceElementInternal::numOctavesAttrGetter, 0, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
    // Attribute 'seed' (Type: 'readonly attribute' ExtAttr: '')
    {"seed", SVGFETurbulenceElementInternal::seedAttrGetter, 0, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
    // Attribute 'stitchTiles' (Type: 'readonly attribute' ExtAttr: '')
    {"stitchTiles", SVGFETurbulenceElementInternal::stitchTilesAttrGetter, 0, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
    // Attribute 'type' (Type: 'readonly attribute' ExtAttr: '')
    {"type", SVGFETurbulenceElementInternal::typeAttrGetter, 0, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
    // Attribute 'x' (Type: 'readonly attribute' ExtAttr: '')
    {"x", SVGFETurbulenceElementInternal::xAttrGetter, 0, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
    // Attribute 'y' (Type: 'readonly attribute' ExtAttr: '')
    {"y", SVGFETurbulenceElementInternal::yAttrGetter, 0, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
    // Attribute 'width' (Type: 'readonly attribute' ExtAttr: '')
    {"width", SVGFETurbulenceElementInternal::widthAttrGetter, 0, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
    // Attribute 'height' (Type: 'readonly attribute' ExtAttr: '')
    {"height", SVGFETurbulenceElementInternal::heightAttrGetter, 0, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
    // Attribute 'result' (Type: 'readonly attribute' ExtAttr: '')
    {"result", SVGFETurbulenceElementInternal::resultAttrGetter, 0, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
    // Attribute 'className' (Type: 'readonly attribute' ExtAttr: '')
    {"className", SVGFETurbulenceElementInternal::classNameAttrGetter, 0, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
    // Attribute 'style' (Type: 'readonly attribute' ExtAttr: '')
    {"style", SVGFETurbulenceElementInternal::styleAttrGetter, 0, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
};

static const BatchedCallback SVGFETurbulenceElementCallbacks[] = {
    {"getPresentationAttribute", SVGFETurbulenceElementInternal::getPresentationAttributeCallback},
};

static const BatchedConstant SVGFETurbulenceElementConsts[] = {
    {"SVG_TURBULENCE_TYPE_UNKNOWN", static_cast<signed int>(0)},
    {"SVG_TURBULENCE_TYPE_FRACTALNOISE", static_cast<signed int>(1)},
    {"SVG_TURBULENCE_TYPE_TURBULENCE", static_cast<signed int>(2)},
    {"SVG_STITCHTYPE_UNKNOWN", static_cast<signed int>(0)},
    {"SVG_STITCHTYPE_STITCH", static_cast<signed int>(1)},
    {"SVG_STITCHTYPE_NOSTITCH", static_cast<signed int>(2)},
};

static v8::Persistent<v8::FunctionTemplate> ConfigureV8SVGFETurbulenceElementTemplate(v8::Persistent<v8::FunctionTemplate> desc)
{
    desc->ReadOnlyPrototype();

    v8::Local<v8::Signature> defaultSignature = configureTemplate(desc, "SVGFETurbulenceElement", V8SVGElement::GetTemplate(), V8SVGFETurbulenceElement::internalFieldCount,
        SVGFETurbulenceElementAttrs, WTF_ARRAY_LENGTH(SVGFETurbulenceElementAttrs),
        SVGFETurbulenceElementCallbacks, WTF_ARRAY_LENGTH(SVGFETurbulenceElementCallbacks));
    v8::Local<v8::ObjectTemplate> instance = desc->InstanceTemplate();
    v8::Local<v8::ObjectTemplate> proto = desc->PrototypeTemplate();

    batchConfigureConstants(desc, proto, SVGFETurbulenceElementConsts, WTF_ARRAY_LENGTH(SVGFETurbulenceElementConsts));

    // Custom toString template
    desc->Set(getToStringName(), getToStringTemplate());
    return desc;
}

v8::Persistent<v8::FunctionTemplate> V8SVGFETurbulenceElement::GetRawTemplate()
{
    V8BindingPerIsolateData* data = V8BindingPerIsolateData::current();
    V8BindingPerIsolateData::TemplateMap::iterator result = data->rawTemplateMap().find(&info);
    if (result != data->rawTemplateMap().end())
        return result->second;

    v8::HandleScope handleScope;
    v8::Persistent<v8::FunctionTemplate> templ = createRawTemplate();
    data->rawTemplateMap().add(&info, templ);
    return templ;
}

v8::Persistent<v8::FunctionTemplate> V8SVGFETurbulenceElement::GetTemplate()
{
    V8BindingPerIsolateData* data = V8BindingPerIsolateData::current();
    V8BindingPerIsolateData::TemplateMap::iterator result = data->templateMap().find(&info);
    if (result != data->templateMap().end())
        return result->second;

    v8::HandleScope handleScope;
    v8::Persistent<v8::FunctionTemplate> templ =
        ConfigureV8SVGFETurbulenceElementTemplate(GetRawTemplate());
    data->templateMap().add(&info, templ);
    return templ;
}

bool V8SVGFETurbulenceElement::HasInstance(v8::Handle<v8::Value> value)
{
    return GetRawTemplate()->HasInstance(value);
}

v8::Handle<v8::Object> V8SVGFETurbulenceElement::wrapSlow(SVGFETurbulenceElement* impl)
{
    v8::Handle<v8::Object> wrapper;
    V8Proxy* proxy = 0;
    if (impl->document()) {
        proxy = V8Proxy::retrieve(impl->document()->frame());
        if (proxy && static_cast<Node*>(impl->document()) == static_cast<Node*>(impl)) {
            if (proxy->windowShell()->initContextIfNeeded()) {
                // initContextIfNeeded may have created a wrapper for the object, retry from the start.
                return V8SVGFETurbulenceElement::wrap(impl);
            }
        }
    }

    v8::Handle<v8::Context> context;
    if (proxy)
        context = proxy->context();

    // Enter the node's context and create the wrapper in that context.
    if (!context.IsEmpty())
        context->Enter();
    wrapper = V8DOMWrapper::instantiateV8Object(proxy, &info, impl);
    // Exit the node's context if it was entered.
    if (!context.IsEmpty())
        context->Exit();
    if (wrapper.IsEmpty())
        return wrapper;

    impl->ref();
    v8::Persistent<v8::Object> wrapperHandle = v8::Persistent<v8::Object>::New(wrapper);

    if (!hasDependentLifetime)
        wrapperHandle.MarkIndependent();
    wrapperHandle.SetWrapperClassId(v8DOMSubtreeClassId);
    getDOMNodeMap().set(impl, wrapperHandle);
    return wrapper;
}

void V8SVGFETurbulenceElement::derefObject(void* object)
{
    static_cast<SVGFETurbulenceElement*>(object)->deref();
}

} // namespace WebCore

#endif // ENABLE(SVG) && ENABLE(FILTERS)


"""
The `compat` module provides support for backwards compatibility with older
versions of Django/Python, and compatibility wrappers around optional packages.
"""

# flake8: noqa
from __future__ import unicode_literals

import inspect

import django
from django.apps import apps
from django.conf import settings
from django.core.exceptions import ImproperlyConfigured
from django.db import connection, models, transaction
from django.template import Context, RequestContext, Template
from django.utils import six
from django.views.generic import View

try:
    from django.urls import (
        NoReverseMatch, RegexURLPattern, RegexURLResolver, ResolverMatch, Resolver404, get_script_prefix, reverse, reverse_lazy, resolve
    )
except ImportError:
    from django.core.urlresolvers import (  # Will be removed in Django 2.0
        NoReverseMatch, RegexURLPattern, RegexURLResolver, ResolverMatch, Resolver404, get_script_prefix, reverse, reverse_lazy, resolve
    )

try:
    import urlparse  # Python 2.x
except ImportError:
    import urllib.parse as urlparse

def unicode_repr(instance):
    # Get the repr of an instance, but ensure it is a unicode string
    # on both python 3 (already the case) and 2 (not the case).
    if six.PY2:
        return repr(instance).decode('utf-8')
    return repr(instance)

def unicode_to_repr(value):
    # Coerce a unicode string to the correct repr return type, depending on
    # the Python version. We wrap all our `__repr__` implementations with
    # this and then use unicode throughout internally.
    if six.PY2:
        return value.encode('utf-8')
    return value

def unicode_http_header(value):
    # Coerce HTTP header value to unicode.
    if isinstance(value, six.binary_type):
        return value.decode('iso-8859-1')
    return value

def total_seconds(timedelta):
    # TimeDelta.total_seconds() is only available in Python 2.7
    if hasattr(timedelta, 'total_seconds'):
        return timedelta.total_seconds()
    else:
        return (timedelta.days * 86400.0) + float(timedelta.seconds) + (timedelta.microseconds / 1000000.0)

def distinct(queryset, base):
    if settings.DATABASES[queryset.db]["ENGINE"] == "django.db.backends.oracle":
        # distinct analogue for Oracle users
        return base.filter(pk__in=set(queryset.values_list('pk', flat=True)))
    return queryset.distinct()

# Obtaining manager instances and names from model options differs after 1.10.
def get_names_and_managers(options):
    if django.VERSION >= (1, 10):
        # Django 1.10 onwards provides a `.managers` property on the Options.
        return [
            (manager.name, manager)
            for manager
            in options.managers
        ]
    # For Django 1.8 and 1.9, use the three-tuple information provided
    # by .concrete_managers and .abstract_managers
    return [
        (manager_info[1], manager_info[2])
        for manager_info
        in (options.concrete_managers + options.abstract_managers)
    ]

# field.rel is deprecated from 1.9 onwards
def get_remote_field(field, **kwargs):
    if 'default' in kwargs:
        if django.VERSION < (1, 9):
            return getattr(field, 'rel', kwargs['default'])
        return getattr(field, 'remote_field', kwargs['default'])

    if django.VERSION < (1, 9):
        return field.rel
    return field.remote_field

def _resolve_model(obj):
    """
    Resolve supplied `obj` to a Django model class.

    `obj` must be a Django model class itself, or a string
    representation of one.  Useful in situations like GH #1225 where
    Django may not have resolved a string-based reference to a model in
    another model's foreign key definition.

    String representations should have the format:
        'appname.ModelName'
    """
    if isinstance(obj, six.string_types) and len(obj.split('.')) == 2:
        app_name, model_name = obj.split('.')
        resolved_model = apps.get_model(app_name, model_name)
        if resolved_model is None:
            msg = "Django did not return a model for {0}.{1}"
            raise ImproperlyConfigured(msg.format(app_name, model_name))
        return resolved_model
    elif inspect.isclass(obj) and issubclass(obj, models.Model):
        return obj
    raise ValueError("{0} is not a Django model".format(obj))

def is_authenticated(user):
    if django.VERSION < (1, 10):
        return user.is_authenticated()
    return user.is_authenticated

def is_anonymous(user):
    if django.VERSION < (1, 10):
        return user.is_anonymous()
    return user.is_anonymous

def get_related_model(field):
    if django.VERSION < (1, 9):
        return _resolve_model(field.rel.to)
    return field.remote_field.model

def value_from_object(field, obj):
    if django.VERSION < (1, 9):
        return field._get_val_from_obj(obj)
    return field.value_from_object(obj)

# contrib.postgres only supported from 1.8 onwards.
try:
    from django.contrib.postgres import fields as postgres_fields
except ImportError:
    postgres_fields = None

# JSONField is only supported from 1.9 onwards
try:
    from django.contrib.postgres.fields import JSONField
except ImportError:
    JSONField = None

# coreapi is optional (Note that uritemplate is a dependency of coreapi)
try:
    import coreapi
    import uritemplate
except (ImportError, SyntaxError):
    # SyntaxError is possible under python 3.2
    coreapi = None
    uritemplate = None

# coreschema is optional
try:
    import coreschema
except ImportError:
    coreschema = None

# django-filter is optional
try:
    import django_filters
except ImportError:
    django_filters = None

# django-crispy-forms is optional
try:
    import crispy_forms
except ImportError:
    crispy_forms = None

# requests is optional
try:
    import requests
except ImportError:
    requests = None

# Django-guardian is optional. Import only if guardian is in INSTALLED_APPS
# Fixes (#1712). We keep the try/except for the test suite.
guardian = None
try:
    if 'guardian' in settings.INSTALLED_APPS:
        import guardian
except ImportError:
    pass

# PATCH method is not implemented by Django
if 'patch' not in View.http_method_names:
    View.http_method_names = View.http_method_names + ['patch']

# Markdown is optional
try:
    import markdown

    if markdown.version <= '2.2':
        HEADERID_EXT_PATH = 'headerid'
        LEVEL_PARAM = 'level'
    elif markdown.version < '2.6':
        HEADERID_EXT_PATH = 'markdown.extensions.headerid'
        LEVEL_PARAM = 'level'
    else:
        HEADERID_EXT_PATH = 'markdown.extensions.toc'
        LEVEL_PARAM = 'baselevel'

    def apply_markdown(text):
        """
        Simple wrapper around :func:`markdown.markdown` to set the base level
        of '#' style headers to <h2>.
        """
        extensions = [HEADERID_EXT_PATH]
        extension_configs = {
            HEADERID_EXT_PATH: {
                LEVEL_PARAM: '2'
            }
        }
        md = markdown.Markdown(
            extensions=extensions, extension_configs=extension_configs
        )
        return md.convert(text)
except ImportError:
    apply_markdown = None
    markdown = None

try:
    import pygments
    from pygments.lexers import get_lexer_by_name
    from pygments.formatters import HtmlFormatter

    def pygments_highlight(text, lang, style):
        lexer = get_lexer_by_name(lang, stripall=False)
        formatter = HtmlFormatter(nowrap=True, style=style)
        return pygments.highlight(text, lexer, formatter)

    def pygments_css(style):
        formatter = HtmlFormatter(style=style)
        return formatter.get_style_defs('.highlight')

except ImportError:
    pygments = None

    def pygments_highlight(text, lang, style):
        return text

    def pygments_css(style):
        return None

# `separators` argument to `json.dumps()` differs between 2.x and 3.x
# See: http://bugs.python.org/issue22767
if six.PY3:
    SHORT_SEPARATORS = (',', ':')
    LONG_SEPARATORS = (', ', ': ')
    INDENT_SEPARATORS = (',', ': ')
else:
    SHORT_SEPARATORS = (b',', b':')
    LONG_SEPARATORS = (b', ', b': ')
    INDENT_SEPARATORS = (b',', b': ')

try:
    # DecimalValidator is unavailable in Django < 1.9
    from django.core.validators import DecimalValidator
except ImportError:
    DecimalValidator = None

def set_rollback():
    if hasattr(transaction, 'set_rollback'):
        if connection.settings_dict.get('ATOMIC_REQUESTS', False):
            # If running in >=1.6 then mark a rollback as required,
            # and allow it to be handled by Django.
            if connection.in_atomic_block:
                transaction.set_rollback(True)
    elif transaction.is_managed():
        # Otherwise handle it explicitly if in managed mode.
        if transaction.is_dirty():
            transaction.rollback()
        transaction.leave_transaction_management()
    else:
        # transaction not managed
        pass

def template_render(template, context=None, request=None):
    """
    Passing Context or RequestContext to Template.render is deprecated in 1.9+,
    see https://github.com/django/django/pull/3883 and
    https://github.com/django/django/blob/1.9/django/template/backends/django.py#L82-L84

    :param template: Template instance
    :param context: dict
    :param request: Request instance
    :return: rendered template as SafeText instance
    """
    if isinstance(template, Template):
        if request:
            context = RequestContext(request, context)
        else:
            context = Context(context)
        return template.render(context)
    # backends template, e.g. django.template.backends.django.Template
    else:
        return template.render(context, request=request)

def set_many(instance, field, value):
    if django.VERSION < (1, 10):
        setattr(instance, field, value)
    else:
        field = getattr(instance, field)
        field.set(value)

def include(module, namespace=None, app_name=None):
    from django.conf.urls import include
    if django.VERSION < (1,9):
        return include(module, namespace, app_name)
    else:
        return include((module, app_name), namespace)


package org.drools.core.base.accumulators;

import java.io.Externalizable;
import java.io.IOException;
import java.io.ObjectInput;
import java.io.ObjectOutput;

/**
 * An implementation of an accumulator capable of calculating maximum values
 */
public class MaxAccumulateFunction extends AbstractAccumulateFunction<MaxAccumulateFunction.MaxData> {

    public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {

    }

    public void writeExternal(ObjectOutput out) throws IOException {

    }

    protected static class MaxData implements Externalizable {
        public Comparable max = null;

        public MaxData() {}

        public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
            max = (Comparable) in.readObject();
        }

        public void writeExternal(ObjectOutput out) throws IOException {
            out.writeObject(max);
        }

        @Override
        public String toString() {
            return "max";
        }
    }

    public MaxData createContext() {
        return new MaxData();
    }

    public void init(MaxData data) {
        data.max = null;
    }

    public void accumulate(MaxData data,
                           Object value) {
        if (value != null) {
            data.max = data.max == null || data.max.compareTo( value ) < 0 ?
                       (Comparable) value :
                       data.max;
        }
    }

    public void reverse(MaxData data,
                        Object value) {
    }

    public Object getResult(MaxData data) {
        return data.max;
    }

    public boolean supportsReverse() {
        return false;
    }

    public Class<?> getResultType() {
        return Comparable.class;
    }
}


/**
 * @file safety.c
 * Safety button logic.
 */

#include <px4_config.h>

#include <stdbool.h>

#include <drivers/drv_hrt.h>

#include "px4io.h"

static struct hrt_call arming_call;
static struct hrt_call failsafe_call;

/*
 * Count the number of times in a row that we see the arming button
 * held down.
 */
static unsigned counter = 0;

/*
 * Define the various LED flash sequences for each system state.
 */
#define LED_PATTERN_FMU_OK_TO_ARM 		0x0003		/**< slow blinking			*/
#define LED_PATTERN_FMU_REFUSE_TO_ARM 		0x5555		/**< fast blinking			*/
#define LED_PATTERN_IO_ARMED 			0x5050		/**< long off, then double blink 	*/
#define LED_PATTERN_FMU_ARMED 			0x5500		/**< long off, then quad blink 		*/
#define LED_PATTERN_IO_FMU_ARMED 		0xffff		/**< constantly on			*/

static unsigned blink_counter = 0;

/*
 * IMPORTANT: The arming state machine critically
 * 	      depends on using the same threshold
 *            for arming and disarming. Since disarming
 *            is quite deadly for the system, a similar
 *            length can be justified.
 */
#define ARM_COUNTER_THRESHOLD	10

static bool safety_button_pressed;

static void safety_check_button(void *arg);
static void failsafe_blink(void *arg);

void
safety_init(void)
{
	/* arrange for the button handler to be called at 10Hz */
	hrt_call_every(&arming_call, 1000, 100000, safety_check_button, NULL);
}

void
failsafe_led_init(void)
{
	/* arrange for the failsafe blinker to be called at 8Hz */
	hrt_call_every(&failsafe_call, 1000, 125000, failsafe_blink, NULL);
}

static void
safety_check_button(void *arg)
{
	/*
	 * Debounce the safety button, change state if it has been held for long enough.
	 *
	 */
	safety_button_pressed = BUTTON_SAFETY;

	/*
	 * Keep pressed for a while to arm.
	 *
	 * Note that the counting sequence has to be same length
	 * for arming / disarming in order to end up as proper
	 * state machine, keep ARM_COUNTER_THRESHOLD the same
	 * length in all cases of the if/else struct below.
	 */
	if (safety_button_pressed && !(r_status_flags & PX4IO_P_STATUS_FLAGS_SAFETY_OFF) &&
	    (r_setup_arming & PX4IO_P_SETUP_ARMING_IO_ARM_OK)) {

		if (counter < ARM_COUNTER_THRESHOLD) {
			counter++;

		} else if (counter == ARM_COUNTER_THRESHOLD) {
			/* switch to armed state */
			r_status_flags |= PX4IO_P_STATUS_FLAGS_SAFETY_OFF;
			counter++;
		}

	} else if (safety_button_pressed && (r_status_flags & PX4IO_P_STATUS_FLAGS_SAFETY_OFF)) {

		if (counter < ARM_COUNTER_THRESHOLD) {
			counter++;

		} else if (counter == ARM_COUNTER_THRESHOLD) {
			/* change to disarmed state and notify the FMU */
			r_status_flags &= ~PX4IO_P_STATUS_FLAGS_SAFETY_OFF;
			counter++;
		}

	} else {
		counter = 0;
	}

	/* Select the appropriate LED flash pattern depending on the current IO/FMU arm state */
	uint16_t pattern = LED_PATTERN_FMU_REFUSE_TO_ARM;

	if (r_status_flags & PX4IO_P_STATUS_FLAGS_SAFETY_OFF) {
		if (r_setup_arming & PX4IO_P_SETUP_ARMING_FMU_ARMED) {
			pattern = LED_PATTERN_IO_FMU_ARMED;

		} else {
			pattern = LED_PATTERN_IO_ARMED;
		}

	} else if (r_setup_arming & PX4IO_P_SETUP_ARMING_FMU_ARMED) {
		pattern = LED_PATTERN_FMU_ARMED;

	} else if (r_setup_arming & PX4IO_P_SETUP_ARMING_IO_ARM_OK) {
		pattern = LED_PATTERN_FMU_OK_TO_ARM;

	}

	/* Turn the LED on if we have a 1 at the current bit position */
	LED_SAFETY(pattern & (1 << blink_counter++));

	if (blink_counter > 15) {
		blink_counter = 0;
	}
}

static void
failsafe_blink(void *arg)
{
	/* indicate that a serious initialisation error occured */
	if (!(r_status_flags & PX4IO_P_STATUS_FLAGS_INIT_OK)) {
		LED_AMBER(true);
		return;
	}

	static bool failsafe = false;

	/* blink the failsafe LED if we don't have FMU input */
	if (!(r_status_flags & PX4IO_P_STATUS_FLAGS_FMU_OK)) {
		failsafe = !failsafe;

	} else {
		failsafe = false;
	}

	LED_AMBER(failsafe);
}


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
<TITLE>
Uses of Class org.apache.wicket.util.tester.DummyPanelPage (Wicket Parent 1.5.7 API)
</TITLE>

<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../../../../stylesheet.css" TITLE="Style">

      Overview
      Package
      Class
    Use
      Tree
      Deprecated
      Index
      Help

 PREV
 NEXT

  FRAMES
 NO FRAMES

  All Classes

Uses of Class
org.apache.wicket.util.tester.DummyPanelPage

No usage of org.apache.wicket.util.tester.DummyPanelPage

      Overview
      Package
      Class
    Use
      Tree
      Deprecated
      Index
      Help

 PREV
 NEXT

  FRAMES
 NO FRAMES

  All Classes

Copyright © 2006-2012 Apache Software Foundation. All Rights Reserved.


layout: post
date: 2015-11-27
title: "Camille La Vie Beaded Mesh Two-Tone Dress Sleeveless Floor-Length Mermaid/Trumpet"
category: Camille La Vie
tags: [Camille La Vie,Mermaid/Trumpet,Spaghetti Straps,Floor-Length,Sleeveless]
---
### Camille La Vie Beaded Mesh Two-Tone Dress
Just **$279.99**
###   Sleeveless Floor-Length Mermaid/Trumpet

BRANDS	Camille La Vie

Silhouette	Mermaid/Trumpet

Neckline	Spaghetti Straps

Hemline/Train	Floor-Length

Sleeve	Sleeveless

Buy it: [https://www.readybrides.com/en/camille-la-vie/10191-camille-la-vie-beaded-mesh-two-tone-dress.html](https://www.readybrides.com/en/camille-la-vie/10191-camille-la-vie-beaded-mesh-two-tone-dress.html)


import React from 'react'
import { useLocation } from 'react-router'

import Modal from 'v2/components/UI/Modal/Portal'
import ModalFullscreenDialog from 'v2/components/UI/ModalFullscreenDialog'
import { ModalFullBlock } from 'v2/components/ModalFullBlock'
import { useParams } from 'react-router'

export const ModalBlockWrapper: React.FC = () => {
  const location = useLocation()
  const params = useParams()

  const state = location.state as any
  const context = state.context

  const set = new Set<string>(
    context
      ?.filter(
        k =>
          k?.__typename !== 'Channel' &&
          k?.__typename !== 'Group' &&
          k?.__typename !== 'User' &&
          !!k?.id
      )
      .map(k => k.id.toString())
  )

  const ids = Array.from(set)

  return (
    <Modal Dialog={ModalFullscreenDialog} bg="utility.opaque">
      <ModalFullBlock id={parseInt(params.id)} ids={ids} />
    </Modal>
  )
}


from led import LED, MAX_BRIGHTNESS

def set_all(num, red, green, blue, brightness=MAX_BRIGHTNESS):
    states = []
    for i in range(num):
        states.append(LED(red, green, blue, brightness))
    return states

def all_off(num):
    return set_all(num, 0, 0, 0, 0)


================================
For this assignment, write an http server that will act as a simple data store. It should respond to GET/POST/PUT/PATCH/DELETE requests for a single resource of your choosing. The data coming in from a post request should be saved to a json file in a data folder in your repository, do not commit your data folder to git. For example if a request is sent to /notes with a body of {noteBody: 'hello world'} the json data in the body should be stored in it's own json file. You can pick a naming scheme for the file but I would recommend using the number of files that you have received so far. Submit as a pull request to your own repository.

Rubric:

Handles REST requests: 3pts

JSON storage: 3pts

Tests: 2pts

Project Organization and Development Files: 2pts


' Licensed to the .NET Foundation under one or more agreements.
' The .NET Foundation licenses this file to you under the MIT license.
' See the LICENSE file in the project root for more information.

Imports System.Composition
Imports System.Threading
Imports Microsoft.CodeAnalysis.SignatureHelp
Imports Microsoft.CodeAnalysis.VisualBasic.Syntax
Imports Microsoft.CodeAnalysis.VisualBasic.Utilities.IntrinsicOperators

Namespace Microsoft.CodeAnalysis.VisualBasic.SignatureHelp
    <ExportSignatureHelpProvider("PredefinedCastExpressionSignatureHelpProvider", LanguageNames.VisualBasic), [Shared]>
    Partial Friend Class PredefinedCastExpressionSignatureHelpProvider
        Inherits AbstractIntrinsicOperatorSignatureHelpProvider(Of PredefinedCastExpressionSyntax)

        <ImportingConstructor>
        Public Sub New()
        End Sub

        Protected Overrides Function GetIntrinsicOperatorDocumentationAsync(node As PredefinedCastExpressionSyntax, document As Document, cancellationToken As CancellationToken) As ValueTask(Of IEnumerable(Of AbstractIntrinsicOperatorDocumentation))
            Return New ValueTask(Of IEnumerable(Of AbstractIntrinsicOperatorDocumentation))(GetIntrinsicOperatorDocumentationImplAsync(node, document, cancellationToken))
        End Function

        Private Async Function GetIntrinsicOperatorDocumentationImplAsync(node As PredefinedCastExpressionSyntax, document As Document, cancellationToken As CancellationToken) As Task(Of IEnumerable(Of AbstractIntrinsicOperatorDocumentation))
            Return SpecializedCollections.SingletonEnumerable(New PredefinedCastExpressionDocumentation(node.Keyword.Kind, Await document.Project.GetCompilationAsync(cancellationToken).ConfigureAwait(False)))
        End Function

        Protected Overrides Function IsTriggerToken(token As SyntaxToken) As Boolean
            Return token.IsChildToken(Of PredefinedCastExpressionSyntax)(Function(ce) ce.OpenParenToken)
        End Function

        Public Overrides Function IsTriggerCharacter(ch As Char) As Boolean
            Return ch = "("c
        End Function

        Public Overrides Function IsRetriggerCharacter(ch As Char) As Boolean
            Return ch = ")"c
        End Function

        Protected Overrides Function IsArgumentListToken(node As PredefinedCastExpressionSyntax, token As SyntaxToken) As Boolean
            Return node.Keyword <> token AndAlso
                node.CloseParenToken <> token
        End Function
    End Class
End Namespace


<?php
$test = isset( $_GET['variant-test'] ) ? $_GET['variant-test'] : 'main';
switch($test){
	case 'new':
		require_once('variant/new.php');
		break;
	case 'edit':
		require_once('variant/edit.php');
		break;
	case 'main':
	default:
		require_once('variant/variant.php');
		break;
}


clones all public repositories of a github profile to local fs


package end2end

import pb "github.com/poy/talaria/api/v1"

//go:generate hel

type NodeServer interface {
	pb.NodeServer
}


package com.github.st1hy.countthemcalories.core.meals;

import com.github.st1hy.countthemcalories.R;

import org.joda.time.DateTime;
import org.joda.time.DateTimeZone;
import org.junit.Before;
import org.junit.Test;

import static org.hamcrest.Matchers.equalTo;
import static org.junit.Assert.assertThat;

public class DefaultNamePlTest {

    DefaultNamePl defaultNameEn;

    @Before
    public void setUp() {
        DateTimeZone.setDefault(DateTimeZone.UTC);
        defaultNameEn = new DefaultNamePl();
    }

    @Test
    public void matchDate() throws Exception {
        assertThat(defaultNameEn.matchDate(new DateTime().withTime(8,0,0,0)),
                equalTo(R.string.add_meal_name_breakfast));
        assertThat(defaultNameEn.matchDate(new DateTime().withTime(12,0,0,0)),
                equalTo(R.string.add_meal_name_dinner));
        assertThat(defaultNameEn.matchDate(new DateTime().withTime(16,0,0,0)),
                equalTo(R.string.add_meal_name_dinner));
        assertThat(defaultNameEn.matchDate(new DateTime().withTime(17,0,0,0)),
                equalTo(R.string.add_meal_name_supper));
        assertThat(defaultNameEn.matchDate(new DateTime().withTime(0,0,0,0)),
                equalTo(R.string.add_meal_name_supper));
    }

}


ACCEPTED

#### According to
NUB Generator [autonym]

#### Published in
null

#### Original name
null

### Remarks
null


<?xml version="1.0" encoding="UTF-8"?>
<ivy-module version="2.0" xmlns:e="http://ant.apache.org/ivy/extra">
	<info organisation="org.scala-sbt.temp"
		module="temp-module-98ec89c315ed408f615fff2c4774286d17323b01"
		revision="1.1.7"
		status="integration"
		publication="20180731110715"
	/>
	<configurations>
		<conf name="compile" visibility="public" description=""/>
		<conf name="runtime" visibility="public" description="" extends="compile"/>
		<conf name="test" visibility="public" description="" extends="runtime"/>
		<conf name="provided" visibility="public" description=""/>
		<conf name="optional" visibility="public" description=""/>
	</configurations>
	<publications>
	</publications>
	<dependencies>
		<dependency org="org.scala-sbt" name="compiler-bridge_2.12" rev="1.1.7" conf="compile->default(compile)">
			<artifact name="compiler-bridge_2.12" type="src" ext="jar" conf="*" e:classifier="sources"/>
		</dependency>
	</dependencies>
</ivy-module>


http_path = "/"
css_dir = "css"
sass_dir = "scss"
images_dir = "images"
javascripts_dir = "js"

# You can select your preferred output style here (can be overridden via the command line):
output_style = :expanded
			   #:compressed
			   #:compact

# To enable relative paths to assets via compass helper functions. Uncomment:
relative_assets = true

# To disable debugging comments that display the original location of your selectors. Uncomment:
 line_comments = false

# If you prefer the indented syntax, you might want to regenerate this
# project again passing --syntax sass, or you can uncomment this:
# preferred_syntax = :sass
# and then run:
# sass-convert -R --from scss --to sass sass scss && rm -rf sass && mv scss sass


using System.Collections.Generic;
using System.Text;
using SchoolSystemLogic.Core;

namespace SchoolSystemLogic.Commands
{
    public class StudentListMarksCommand : ICommand
    {
        public string Execute(IList<string> parameters)
        {
            var indexOfTheStudent = int.Parse(parameters[0]);
            var marks = Engine.Students[indexOfTheStudent].ListMarks();

            var result = new StringBuilder();

            if (marks.Length == 0)
            {
                result.Append("This student has no marks.");
            }
            else
            {
                result.AppendLine("The student has these marks:");
                result.AppendLine(marks);
            }

            return result.ToString();
        }
    }
}


<?php

namespace SilverStripe\Security;

use Controller;
use Form;
use Member;
use Object;

/**
 * Abstract base class for an authentication method
 *
 * This class is used as a base class for the different authentication
 * methods like {@link MemberAuthenticator} or {@link OpenIDAuthenticator}.
 *
 * @author Markus Lanthaler <markus@silverstripe.com>
 * @package framework
 * @subpackage security
 */
abstract class Authenticator extends Object
{

	/**
	 * This variable holds all full namespaced authenticators that should be used
	 *
	 * @var array
	 */
	private static $authenticators = array('SilverStripe\Security\MemberAuthenticator');

	/**
	 * Used to influence the order of authenticators on the login-screen
	 * (default shows first).
	 *
	 * @var string
	 */
	private static $default_authenticator = 'SilverStripe\Security\MemberAuthenticator';

	/**
	 * Method to authenticate an user
	 *
	 * @param array $RAW_data Raw data to authenticate the user
	 * @param Form $form Optional: If passed, better error messages can be
	 *                             produced by using
	 *                             {@link Form::sessionMessage()}
	 *
	 * @return bool|Member Returns FALSE if authentication fails, otherwise
	 *                     the member object
	 */
	public static function authenticate($RAW_data, Form $form = null)
	{
	}

	/**
	 * Method that creates the login form for this authentication method
	 *
	 * @param Controller $controller The parent controller, necessary to create the
	 *                   appropriate form action tag
	 *
	 * @return Form Returns the login form to use with this authentication
	 *              method
	 */
	public static function get_login_form(Controller $controller)
	{
	}

	/**
	 * Method that creates the re-authentication form for the in-CMS view
	 *
	 * @param Controller $controller
	 */
	public static function get_cms_login_form(Controller $controller)
	{
	}

	/**
	 * Determine if this authenticator supports in-cms reauthentication
	 *
	 * @return bool
	 */
	public static function supports_cms()
	{
		return false;
	}

	/**
	 * Get the name of the authentication method
	 *
	 * @return string Returns the name of the authentication method.
	 */
	public static function get_name()
	{
	}

	public static function register($authenticator)
	{
		self::register_authenticator($authenticator);
	}

	/**
	 * Register a new authenticator
	 *
	 * The new authenticator has to exist and to be derived from the
	 * {@link Authenticator}.
	 * Every authenticator can be registered only once.
	 *
	 * @param string $authenticator Name of the authenticator class to
	 *                              register
	 *
	 * @return bool Returns TRUE on success, FALSE otherwise.
	 */
	public static function register_authenticator($authenticator)
	{
		$authenticator = trim($authenticator);

		if (class_exists($authenticator) === false) {
			return false;
		}

		if (is_subclass_of($authenticator, 'Authenticator') === false) {
			return false;
		}

		if (in_array($authenticator, self::$authenticators, null) === false) {
			if (call_user_func(array($authenticator, 'on_register')) === true) {
				self::$authenticators[] = $authenticator;
			} else {
				return false;
			}
		}

		return true;
	}

	public static function unregister($authenticator)
	{
		self::unregister_authenticator($authenticator);
	}

	/**
	 * Remove a previously registered authenticator
	 *
	 * @param string $authenticator Name of the authenticator class to register
	 *
	 * @return bool Returns TRUE on success, FALSE otherwise.
	 */
	public static function unregister_authenticator($authenticator)
	{
		if (call_user_func(array($authenticator, 'on_unregister')) === true
			&& in_array($authenticator, self::$authenticators, null)
		) {
			unset(self::$authenticators[array_search($authenticator, self::$authenticators, null)]);
		}

	}

	/**
	 * Check if a given authenticator is registered
	 *
	 * @param string $authenticator Name of the authenticator class to check
	 *
	 * @return bool Returns TRUE if the authenticator is registered, FALSE
	 *              otherwise.
	 */
	public static function is_registered($authenticator)
	{
		return in_array($authenticator, self::$authenticators, null);
	}

	/**
	 * Get all registered authenticators
	 *
	 * @return array Returns an array with the class names of all registered
	 *               authenticators.
	 */
	public static function get_authenticators()
	{
		// put default authenticator first (mainly for tab-order on loginform)
		if ($key = array_search(self::$default_authenticator, self::$authenticators, null)) {
			unset(self::$authenticators[$key]);
			array_unshift(self::$authenticators, self::$default_authenticator);
		}

		return self::$authenticators;
	}

	/**
	 * Set a default authenticator (shows first in tabs)
	 *
	 * @param string
	 */
	public static function set_default_authenticator($authenticator)
	{
		self::$default_authenticator = $authenticator;

	}

	/**
	 * @return string
	 */
	public static function get_default_authenticator()
	{
		return self::$default_authenticator;
	}

	/**
	 * Callback function that is called when the authenticator is registered
	 *
	 * Use this method for initialization of a newly registered authenticator.
	 * Just overload this method and it will be called when the authenticator
	 * is registered.
	 * <b>If the method returns FALSE, the authenticator won't be
	 * registered!</b>
	 *
	 * @return bool Returns TRUE on success, FALSE otherwise.
	 */
	protected static function on_register()
	{
		return true;
	}

	/**
	 * Callback function that is called when an authenticator is removed.
	 *
	 * @return bool
	 */
	protected static function on_unregister()
	{
		return true;
	}
}


package php.runtime;

import org.junit.Assert;
import org.junit.FixMethodOrder;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;
import org.junit.runners.MethodSorters;
import php.runtime.memory.*;

@RunWith(JUnit4.class)
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class MemoryTest {

    @Test
    public void testNull(){
        Memory memory = Memory.NULL;

        Assert.assertEquals(Memory.Type.NULL, memory.type);
        Assert.assertFalse(memory.toBoolean());
        Assert.assertEquals("", memory.toString());
        Assert.assertEquals(0.0, memory.toDouble(), 0.000001);
        Assert.assertEquals(0, memory.toLong());

        Assert.assertNotNull(memory.toNumeric());
        Assert.assertEquals(Memory.Type.INT, memory.toNumeric().type);
        Assert.assertEquals(0, memory.toNumeric().toLong());

        Assert.assertEquals(memory, memory.toImmutable());
        Assert.assertTrue(memory.isImmutable());
    }

    @Test
    public void testFalse(){
        Memory memory = Memory.FALSE;

        Assert.assertEquals(Memory.Type.BOOL, memory.type);
        Assert.assertFalse(memory.toBoolean());
        Assert.assertEquals("", memory.toString());
        Assert.assertEquals(0.0, memory.toDouble(), 0.000001);
        Assert.assertEquals(0, memory.toLong());

        Assert.assertNotNull(memory.toNumeric());
        Assert.assertEquals(Memory.Type.INT, memory.toNumeric().type);
        Assert.assertEquals(0, memory.toNumeric().toLong());

        Assert.assertEquals(memory, memory.toImmutable());
        Assert.assertTrue(memory.isImmutable());
    }

    @Test
    public void testTrue(){
        Memory memory = Memory.TRUE;

        Assert.assertEquals(Memory.Type.BOOL, memory.type);
        Assert.assertTrue(memory.toBoolean());
        Assert.assertEquals("1", memory.toString());
        Assert.assertEquals(1.0, memory.toDouble(), 0.000001);
        Assert.assertEquals(1, memory.toLong());

        Assert.assertNotNull(memory.toNumeric());
        Assert.assertEquals(Memory.Type.INT, memory.toNumeric().type);
        Assert.assertEquals(1, memory.toNumeric().toLong());

        Assert.assertEquals(memory, memory.toImmutable());
        Assert.assertTrue(memory.isImmutable());
    }

    @Test
    public void testLong(){
        LongMemory memory = new LongMemory(100);

        Assert.assertEquals(Memory.Type.INT, memory.type);
        Assert.assertTrue(memory.toBoolean());
        Assert.assertEquals("100", memory.toString());
        Assert.assertEquals(100, memory.toDouble(), 0.000001);
        Assert.assertEquals(100, memory.toLong());

        Assert.assertNotNull(memory.toNumeric());
        Assert.assertEquals(Memory.Type.INT, memory.toNumeric().type);
        Assert.assertEquals(100, memory.toNumeric().toLong());

        Assert.assertEquals(memory, memory.toImmutable());
        Assert.assertTrue(memory.isImmutable());
    }

    @Test
    public void testDouble(){
        DoubleMemory memory = new DoubleMemory(50);

        Assert.assertEquals(Memory.Type.DOUBLE, memory.type);
        Assert.assertTrue(memory.toBoolean());
        Assert.assertEquals("50", memory.toString());
        Assert.assertEquals(50, memory.toDouble(), 0.000001);
        Assert.assertEquals(50, memory.toLong());

        Assert.assertNotNull(memory.toNumeric());
        Assert.assertEquals(Memory.Type.DOUBLE, memory.toNumeric().type);
        Assert.assertEquals(50, memory.toNumeric().toLong());

        Assert.assertEquals(memory, memory.toImmutable());
        Assert.assertTrue(memory.isImmutable());
    }

    @Test
    public void testString(){
        StringMemory memory = new StringMemory("foobar");

        Assert.assertEquals(Memory.Type.STRING, memory.type);
        Assert.assertTrue(memory.toBoolean());
        Assert.assertEquals("foobar", memory.toString());
        Assert.assertEquals(0.0, memory.toDouble(), 0.000001);
        Assert.assertEquals(0, memory.toLong());

        Assert.assertNotNull(memory.toNumeric());
        Assert.assertEquals(Memory.Type.INT, memory.toNumeric().type);
        Assert.assertEquals(0, memory.toNumeric().toLong());

        Assert.assertEquals(memory, memory.toImmutable());
        Assert.assertTrue(memory.isImmutable());

        Assert.assertNull(StringMemory.toLong("-"));
        Assert.assertEquals(-1, StringMemory.toLong("-1").toLong());
        Assert.assertEquals(32, StringMemory.toLong("32").toLong());

        Assert.assertTrue(new BinaryMemory(new byte[]{1,2}).toBoolean());
        Assert.assertFalse(new BinaryMemory(new byte[]{}).toBoolean());
        Assert.assertFalse(new BinaryMemory().toBoolean());
        Assert.assertFalse(new BinaryMemory(new byte[]{'0'}).toBoolean());

        Assert.assertEquals(StringMemory.valueOf("-").toNumeric().toLong(), 0);
        Assert.assertEquals(StringMemory.valueOf("-").toLong(), 0);
    }

    @Test
    public void testReference(){
        ReferenceMemory memory = new ReferenceMemory(Memory.TRUE);

        Assert.assertEquals(Memory.Type.REFERENCE, memory.type);
        Assert.assertTrue(memory.toBoolean());
        Assert.assertEquals("1", memory.toString());
        Assert.assertEquals(1, memory.toDouble(), 0.000001);
        Assert.assertEquals(1, memory.toLong());

        Assert.assertNotNull(memory.toNumeric());
        Assert.assertEquals(Memory.Type.INT, memory.toNumeric().type);
        Assert.assertEquals(1, memory.toNumeric().toLong());

        Assert.assertNotEquals(memory, memory.toImmutable());
        Assert.assertEquals(Memory.TRUE, memory.toImmutable());
        Assert.assertFalse(memory.isImmutable());
    }
}


package controllers

import (
	"github.com/revel/examples/chat/app/chatroom"
	"github.com/revel/revel"
)

type LongPolling struct {
	*revel.Controller
}

func (c LongPolling) Room(user string) revel.Result {
	chatroom.Join(user)
	return c.Render(user)
}

func (c LongPolling) Say(user, message string) revel.Result {
	chatroom.Say(user, message)
	return nil
}

func (c LongPolling) WaitMessages(lastReceived int) revel.Result {
	subscription := chatroom.Subscribe()
	defer subscription.Cancel()

	// See if anything is new in the archive.
	var events []chatroom.Event
	for _, event := range subscription.Archive {
		if event.Timestamp > lastReceived {
			events = append(events, event)
		}
	}

	// If we found one, grand.
	if len(events) > 0 {
		return c.RenderJSON(events)
	}

	// Else, wait for something new.
	event := <-subscription.New
	return c.RenderJSON([]chatroom.Event{event})
}

func (c LongPolling) Leave(user string) revel.Result {
	chatroom.Leave(user)
	return c.Redirect(Application.Index)
}


ACCEPTED

#### According to
Index Fungorum

#### Published in
Nuovo Giorn. Bot. Ital. 8: 161 (1892)

#### Original name
Cytospora oleina Berl.

### Remarks
null


CREATE TABLE `users` (
	`id` int unsigned NOT NULL AUTO_INCREMENT PRIMARY KEY,
	`access` int NOT NULL DEFAULT 1,
	`created` int(10) unsigned NOT NULL,
	`last_seen` int(10) unsigned NOT NULL
) ENGINE='InnoDB';


#ifndef _flint_h_
#define _flint_h_

#include <math.h>

/*
	For real-time applications you need big integers: the number
	of recorded samples will exceed the maximum 32-bit signed integer
	after only 13.5 hours. So having int64_t would be best,
	and that is indeed what Praat uses for these same purposes,
	but the Vokaturi library has to be able to run with old compilers and linkers.
	Not all old compilers support int64_t, and not all old linkers
	support 64-bit division without calling external functions.
	So we simply employ the type "double", which can contain signed integers
	up to 54 bits.
*/
typedef double flint;
/*
	On these high-precision "integers",
	the integer division (with its rounding down) and the modulo function
	cannot be performed with the usual operator symbols for integer types
	(which are "/" and "%", respectively),
	so for those operations we use inline functions instead.
*/
inline static flint flint_div (flint a, flint b) { return floor (a / b); }
inline static flint flint_mod (flint a, flint b) { return a - floor (a / b) * b; }

/* End of file flint.h */
#endif


namespace PetFinder.Data.Migrations
{
    using System.Data.Entity.Migrations;
    using System.Linq;

    public sealed class Configuration : DbMigrationsConfiguration<AppDbContext>
    {
        public Configuration()
        {
            this.AutomaticMigrationsEnabled = true;
            this.AutomaticMigrationDataLossAllowed = false;
        }

        protected override void Seed(AppDbContext context)
        {
            if (context.Users.Any())
            {
                return;
            }

            var dataSeed = new DataSeed(context);
            dataSeed.SeedRoles();
            dataSeed.SeedAdmin();
            dataSeed.SeedUsers();
            dataSeed.SeedRegions();
            dataSeed.SeedPostCategories();
            dataSeed.SeedPets();
            dataSeed.SeedPostsWithComments(
                context.Users.ToList(),
                context.PostCategories.ToList(),
                context.Pets.ToList(),
                context.Regions.ToList());
            dataSeed.SeedImages(context.Posts.ToList());
        }
    }
}


using SurgSim::Graphics::OsgTexture1d;

OsgTexture1d::OsgTexture1d() : OsgTexture(new osg::Texture1D())
{
}

void OsgTexture1d::setSize(int width)
{
	getOsgTexture1d()->setTextureWidth(width);
}

void OsgTexture1d::getSize(int* width) const
{
	*width = getOsgTexture1d()->getTextureWidth();
	if (*width == 0 && getOsgTexture()->getNumImages() > 0)
	{
		*width = getOsgTexture()->getImage(0)->s();
	}
}


package com.asakusafw.testdriver.html;

import static org.hamcrest.Matchers.*;
import static org.junit.Assert.*;

import java.io.File;
import java.io.IOException;

import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.TemporaryFolder;

import com.asakusafw.testdriver.core.DataModelDefinition;
import com.asakusafw.testdriver.core.Difference;
import com.asakusafw.testdriver.core.DifferenceSink;
import com.asakusafw.testdriver.core.DifferenceSinkFactory;
import com.asakusafw.testdriver.core.TestContext;
import com.asakusafw.testdriver.core.TestToolRepository;
import com.asakusafw.testdriver.excel.Simple;
import com.asakusafw.testdriver.model.SimpleDataModelDefinition;

/**
 * Test for {@link HtmlDifferenceSinkProvider}.
 */
public class HtmlDifferenceSinkProviderTest {

    static final DataModelDefinition<Simple> SIMPLE = new SimpleDataModelDefinition<>(Simple.class);

    /**
     * temporary folder.
     */
    @Rule
    public final TemporaryFolder temp = new TemporaryFolder();

    /**
     * Load the provider via SPI.
     * @throws Exception if failed
     */
    @Test
    public void spi() throws Exception {
        TestToolRepository repo = new TestToolRepository(getClass().getClassLoader());

        File file = temp.newFile("example.html");
        file.delete();

        DifferenceSinkFactory factory = repo.getDifferenceSinkFactory(file.toURI());
        try (DifferenceSink sink = factory.createSink(SIMPLE, new TestContext.Empty())) {
            Simple expected = new Simple();
            expected.text = "expected";
            Simple actual = new Simple();
            actual.text = "actual";
            sink.put(new Difference(
                    SIMPLE.toReflection(expected),
                    SIMPLE.toReflection(actual),
                    "testing"));
        }

        assertThat(file.exists(), is(true));
    }

    /**
     * Attempt to load the provider via SPI, but its extension is wrong.
     * @throws Exception if failed
     */
    @Test
    public void spi_wrong_extension() throws Exception {
        TestToolRepository repo = new TestToolRepository(getClass().getClassLoader());

        File file = temp.newFile("example.invalid");
        file.delete();

        DifferenceSinkFactory factory = repo.getDifferenceSinkFactory(file.toURI());
        try (DifferenceSink sink = factory.createSink(SIMPLE, new TestContext.Empty())) {
            sink.close();
            fail();
        } catch (IOException e) {
            // ok.
        }
    }
}