text:
.. :changelog:

Changelog
---------

unreleased
^^^^^^^^^^

v2.3.2 (2022-01-25)
^^^^^^^^^^^^^^^^^^^

- Add compatibility with Django 4.0
- Fix regression where settings receiving a default were ignored. #323 #327

v2.3.1 (2021-11-08)
^^^^^^^^^^^^^^^^^^^

- Test Django 3.2 on Python 3.10 as well.

- Test on PyPy 3.6, 3.7 and 3.8.

- Enforce Python version requirement during installation (>=3.6).

- Fix and refactor the documentation build process.

v2.3 (2021-10-27)
^^^^^^^^^^^^^^^^^

- **BACKWARD INCOMPATIBLE** Drop support for Python 2.7 and 3.5.

- **BACKWARD INCOMPATIBLE** Drop support for Django < 2.2.

- Add support for Django 3.1 and 3.2.

- Add suppport for Python 3.9 and 3.10.

- Deprecate ``utils.import_by_path`` in favor of
  ``django.utils.module_loading.import_string``.

- Add ASGI support.

- Added "python -m configurations" entry point.

- Make package ``install_requires`` include ``django>=2.2``.

- Prevent an ImproperlyConfigured warning from ``DEFAULT_HASHING_ALGORITHM``.

- Prevent warnings for settings deprecated in Django 2.2
  (``DEFAULT_CONTENT_TYPE`` and ``FILE_CHARSET``).

- Preserve Django warnings when ``DEFAULT_AUTO_FIELD`` is not set.

- Miscellaneous documentation fixes.

- Miscellaneous internal improvements.

v2.2 (2019-12-03)
^^^^^^^^^^^^^^^^^

- **BACKWARD INCOMPATIBLE** Drop support for Python 3.4.

- **BACKWARD INCOMPATIBLE** Drop support for Django < 1.11.

- Add support for Django 3.0.

- Add support for Python 3.8.

- Add support for PyPy 3.

- Replace ``django.utils.six`` with ``six`` to support Django >= 3.

- Start using tox-travis and setuptools-scm for simplified test harness
  and release management.

v2.1 (2018-08-16)
^^^^^^^^^^^^^^^^^

- **BACKWARD INCOMPATIBLE** Drop support of Python 3.3.

- **BACKWARD INCOMPATIBLE** Drop support of Django 1.9.

- Add support for Django 2.1.

- Add ``PositiveIntegerValue`` configuration value.

- Fix ``bool(BooleanValue)`` to behave as one would expect (e.g.
  ``bool(BooleanValue(False))`` returns ``False``).

- Miscellaneous documentation improvements and bug fixes.

v2.0 (2016-07-29)
^^^^^^^^^^^^^^^^^

- **BACKWARD INCOMPATIBLE** Drop support of Python 2.6 and 3.2

- **BACKWARD INCOMPATIBLE** Drop support of Django < 1.8

- **BACKWARD INCOMPATIBLE** Moved sphinx callable has been moved from
  ``configurations`` to ``configurations.sphinx``.

- **BACKWARD INCOMPATIBLE** Removed the previously deprecated
  ``configurations.Settings`` class in favor of the
  ``configurations.Configuration`` added in 0.4. This removal was planned for
  the 1.0 release and is now finally enacted.

- Add multiprocessing support for sphinx integration

- Fix a RemovedInDjango19Warning warning

v1.0 (2016-01-04)
^^^^^^^^^^^^^^^^^

- Project has moved to `Jazzband <https://jazzband.co/>`_. See guidelines for
  contributing.

- Support for Django 1.8 and above.

- Allow ``Value`` classes to be used outside of ``Configuration`` classes. (#62)

- Fixed "Value with ValidationMixin will raise ValueError if no default assigned". (#69)

- Fixed wrong behaviour when assigning BooleanValue. (#83)

- Add ability to programmatically call Django commands from configurations using
  ``call_command``.

- Added SingleNestedTupleValue and SingleNestedListValue classes. (#85)

- Several other miscellaneous bugfixes.

v0.8 (2014-01-16)
^^^^^^^^^^^^^^^^^

- Added ``SearchURLValue`` to configure Haystack ``HAYSTACK_CONNECTIONS``
  settings.

v0.7 (2013-11-26)
^^^^^^^^^^^^^^^^^

- Removed the broken stdout wrapper that displayed the currently enabled
  configuration when using the runserver management command. Added a logging
  based solution instead.

- Fixed default value of ``CacheURLValue`` class that was shadowed by an
  unneeded name parameter. Thanks to Stefan Wehrmeyer.

- Fixed command line options checking in the importer to happen before the
  validation. Thanks to Stefan Wehrmeyer.

- Added Tox test configuration.

- Fixed an erroneous use of ``PathValue`` in the 1.6.x project template.

v0.6 (2013-09-19)
^^^^^^^^^^^^^^^^^

- Added a IPython extension to support IPython notebooks correctly. See
  the :doc:`cookbook` for more information.

v0.5.1 (2013-09-12)
^^^^^^^^^^^^^^^^^^^

- Prevented accidentally parsing the command line options to look for the
  ``--configuration`` option outside of Django's management commands.
  This should fix a problem with gunicorn's own ``--config`` option.
  Thanks to Brian Rosner for the report.

v0.5 (2013-09-09)
^^^^^^^^^^^^^^^^^

- Switched from raising Django's ``ImproperlyConfigured`` exception on errors
  to standard ``ValueError`` to prevent hiding those errors when Django
  specially handles the first.

- Switched away from d2to1 as a way to define package metadata since distutils2
  is dead.

- Extended ``Value`` class documentation and fixed other issues.

- Moved tests out of the ``configurations`` package for easier maintenance.

v0.4 (2013-09-03)
^^^^^^^^^^^^^^^^^

- Added ``Value`` classes and subclasses for easier handling of settings values,
  including populating them from environment variables.

- Renamed ``configurations.Settings`` class to ``configurations.Configuration``
  to better describe what the class is all about. The old class still exists
  and is marked as pending deprecation. It'll be removed in version 1.0.

- Added a ``setup`` method to handle the new ``Value`` classes and allow an
  in-between modification of the configuration values.

- Added Django project templates for 1.5.x and 1.6.x.

- Reorganized and extended documentation.

v0.3.2 (2014-01-16)
^^^^^^^^^^^^^^^^^^^

- Fixed an installation issue.

v0.3.1 (2013-09-20)
^^^^^^^^^^^^^^^^^^^

- Backported a fix from master that makes 0.3.x compatible with newer
  versions of six.

v0.3 (2013-05-15)
^^^^^^^^^^^^^^^^^

- Added ``pristinemethod`` decorator to be able to have callables as settings.

- Added ``pre_setup`` and ``post_setup`` method hooks to be able to run code
  before or after the settings loading is finished.

- Minor docs and tests cleanup.

v0.2.1 (2013-04-11)
^^^^^^^^^^^^^^^^^^^

- Fixed a regression in parsing the new ``-C``/``--configuration`` management
  command option.

- Minor fix in showing the configuration in the ``runserver`` management
  command output.

v0.2 (2013-03-27)
^^^^^^^^^^^^^^^^^

- **backward incompatible change** Dropped support for Python 2.5! Please use
  the 0.1 version if you really want.

- Added Python>3.2 and Django 1.5 support!

- Catch error when getting or evaluating callable setting class attributes.

- Simplified and extended tests.

- Added optional ``-C``/``--configuration`` management command option similar
  to Django's ``--settings`` option

- Fixed the runserver message about which setting is used to
  show the correct class.

- Stopped hiding AttributeErrors happening during initialization
  of settings classes.

- Added FastCGI helper.

- Minor documentation fixes

v0.1 (2012-07-21)
^^^^^^^^^^^^^^^^^

- Initial public release


text:
BooksSearch
===========

This is small MVC based application to get Details about books

Prerequisites
-------------------------------------
java 1.5 or later
Tomcat 5.5 or later
oracle Database or Mysql database
-------------------------------------
create DSN called 'contact'

Control Panel --> Administrative Tools -- > click ODBC Datasources
         --> Sytem DSN/User DSN -> Add -> Select Microsoft odbc for Oracle -> Finish
         Enter Datasource name as : contact, username and password according to ur schema (in application scott/tiger)
-----------------------------------------------------------------------------------------
Create table in Oracle db software

create table select_books
(bookid varchar2(20),
bookname varchar2(20),
authorname varchar2(20),
status varchar2(20),category varchar2(20));

// insert some rows
-------------------------------------------------------------
Compile java classes
In our application both BookBean.java and DbConnector.java kept in package called 'beans'

Order of compilation
Navigate to classes folder of application, ex
d:\>ProjectApp\ProjectApp\WEB-INF\classes>javac -d . BookBean.java
d:\>ProjectApp\ProjectApp\WEB-INF\classes>javac -d . DbConnector.java
d:\>ProjectApp\ProjectApp\WEB-INF\classes>javac SelectedBooks.java

Deploy it and run

redpajama_set_name: RedPajamaGithub


text:
namespace google {
namespace cloud {
namespace edgecontainer_internal {
GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN

EdgeContainerLogging::EdgeContainerLogging(
    std::shared_ptr<EdgeContainerStub> child, TracingOptions tracing_options,
    std::set<std::string> components)
    : child_(std::move(child)),
      tracing_options_(std::move(tracing_options)),
      components_(std::move(components)) {}

StatusOr<google::cloud::edgecontainer::v1::ListClustersResponse>
EdgeContainerLogging::ListClusters(
    grpc::ClientContext& context,
    google::cloud::edgecontainer::v1::ListClustersRequest const& request) {
  return google::cloud::internal::LogWrapper(
      [this](grpc::ClientContext& context,
             google::cloud::edgecontainer::v1::ListClustersRequest const&
                 request) { return child_->ListClusters(context, request); },
      context, request, __func__, tracing_options_);
}

StatusOr<google::cloud::edgecontainer::v1::Cluster>
EdgeContainerLogging::GetCluster(
    grpc::ClientContext& context,
    google::cloud::edgecontainer::v1::GetClusterRequest const& request) {
  return google::cloud::internal::LogWrapper(
      [this](
          grpc::ClientContext& context,
          google::cloud::edgecontainer::v1::GetClusterRequest const& request) {
        return child_->GetCluster(context, request);
      },
      context, request, __func__, tracing_options_);
}

future<StatusOr<google::longrunning::Operation>>
EdgeContainerLogging::AsyncCreateCluster(
    google::cloud::CompletionQueue& cq,
    std::unique_ptr<grpc::ClientContext> context,
    google::cloud::edgecontainer::v1::CreateClusterRequest const& request) {
  return google::cloud::internal::LogWrapper(
      [this](google::cloud::CompletionQueue& cq,
             std::unique_ptr<grpc::ClientContext> context,
             google::cloud::edgecontainer::v1::CreateClusterRequest const&
                 request) {
        return child_->AsyncCreateCluster(cq, std::move(context), request);
      },
      cq, std::move(context), request, __func__, tracing_options_);
}

future<StatusOr<google::longrunning::Operation>>
EdgeContainerLogging::AsyncUpdateCluster(
    google::cloud::CompletionQueue& cq,
    std::unique_ptr<grpc::ClientContext> context,
    google::cloud::edgecontainer::v1::UpdateClusterRequest const& request) {
  return google::cloud::internal::LogWrapper(
      [this](google::cloud::CompletionQueue& cq,
             std::unique_ptr<grpc::ClientContext> context,
             google::cloud::edgecontainer::v1::UpdateClusterRequest const&
                 request) {
        return child_->AsyncUpdateCluster(cq, std::move(context), request);
      },
      cq, std::move(context), request, __func__, tracing_options_);
}

future<StatusOr<google::longrunning::Operation>>
EdgeContainerLogging::AsyncDeleteCluster(
    google::cloud::CompletionQueue& cq,
    std::unique_ptr<grpc::ClientContext> context,
    google::cloud::edgecontainer::v1::DeleteClusterRequest const& request) {
  return google::cloud::internal::LogWrapper(
      [this](google::cloud::CompletionQueue& cq,
             std::unique_ptr<grpc::ClientContext> context,
             google::cloud::edgecontainer::v1::DeleteClusterRequest const&
                 request) {
        return child_->AsyncDeleteCluster(cq, std::move(context), request);
      },
      cq, std::move(context), request, __func__, tracing_options_);
}

StatusOr<google::cloud::edgecontainer::v1::GenerateAccessTokenResponse>
EdgeContainerLogging::GenerateAccessToken(
    grpc::ClientContext& context,
    google::cloud::edgecontainer::v1::GenerateAccessTokenRequest const&
        request) {
  return google::cloud::internal::LogWrapper(
      [this](grpc::ClientContext& context,
             google::cloud::edgecontainer::v1::GenerateAccessTokenRequest const&
                 request) {
        return child_->GenerateAccessToken(context, request);
      },
      context, request, __func__, tracing_options_);
}

StatusOr<google::cloud::edgecontainer::v1::ListNodePoolsResponse>
EdgeContainerLogging::ListNodePools(
    grpc::ClientContext& context,
    google::cloud::edgecontainer::v1::ListNodePoolsRequest const& request) {
  return google::cloud::internal::LogWrapper(
      [this](grpc::ClientContext& context,
             google::cloud::edgecontainer::v1::ListNodePoolsRequest const&
                 request) { return child_->ListNodePools(context, request); },
      context, request, __func__, tracing_options_);
}

StatusOr<google::cloud::edgecontainer::v1::NodePool>
EdgeContainerLogging::GetNodePool(
    grpc::ClientContext& context,
    google::cloud::edgecontainer::v1::GetNodePoolRequest const& request) {
  return google::cloud::internal::LogWrapper(
      [this](
          grpc::ClientContext& context,
          google::cloud::edgecontainer::v1::GetNodePoolRequest const& request) {
        return child_->GetNodePool(context, request);
      },
      context, request, __func__, tracing_options_);
}

future<StatusOr<google::longrunning::Operation>>
EdgeContainerLogging::AsyncCreateNodePool(
    google::cloud::CompletionQueue& cq,
    std::unique_ptr<grpc::ClientContext> context,
    google::cloud::edgecontainer::v1::CreateNodePoolRequest const& request) {
  return google::cloud::internal::LogWrapper(
      [this](google::cloud::CompletionQueue& cq,
             std::unique_ptr<grpc::ClientContext> context,
             google::cloud::edgecontainer::v1::CreateNodePoolRequest const&
                 request) {
        return child_->AsyncCreateNodePool(cq, std::move(context), request);
      },
      cq, std::move(context), request, __func__, tracing_options_);
}

future<StatusOr<google::longrunning::Operation>>
EdgeContainerLogging::AsyncUpdateNodePool(
    google::cloud::CompletionQueue& cq,
    std::unique_ptr<grpc::ClientContext> context,
    google::cloud::edgecontainer::v1::UpdateNodePoolRequest const& request) {
  return google::cloud::internal::LogWrapper(
      [this](google::cloud::CompletionQueue& cq,
             std::unique_ptr<grpc::ClientContext> context,
             google::cloud::edgecontainer::v1::UpdateNodePoolRequest const&
                 request) {
        return child_->AsyncUpdateNodePool(cq, std::move(context), request);
      },
      cq, std::move(context), request, __func__, tracing_options_);
}

future<StatusOr<google::longrunning::Operation>>
EdgeContainerLogging::AsyncDeleteNodePool(
    google::cloud::CompletionQueue& cq,
    std::unique_ptr<grpc::ClientContext> context,
    google::cloud::edgecontainer::v1::DeleteNodePoolRequest const& request) {
  return google::cloud::internal::LogWrapper(
      [this](google::cloud::CompletionQueue& cq,
             std::unique_ptr<grpc::ClientContext> context,
             google::cloud::edgecontainer::v1::DeleteNodePoolRequest const&
                 request) {
        return child_->AsyncDeleteNodePool(cq, std::move(context), request);
      },
      cq, std::move(context), request, __func__, tracing_options_);
}

StatusOr<google::cloud::edgecontainer::v1::ListMachinesResponse>
EdgeContainerLogging::ListMachines(
    grpc::ClientContext& context,
    google::cloud::edgecontainer::v1::ListMachinesRequest const& request) {
  return google::cloud::internal::LogWrapper(
      [this](grpc::ClientContext& context,
             google::cloud::edgecontainer::v1::ListMachinesRequest const&
                 request) { return child_->ListMachines(context, request); },
      context, request, __func__, tracing_options_);
}

StatusOr<google::cloud::edgecontainer::v1::Machine>
EdgeContainerLogging::GetMachine(
    grpc::ClientContext& context,
    google::cloud::edgecontainer::v1::GetMachineRequest const& request) {
  return google::cloud::internal::LogWrapper(
      [this](
          grpc::ClientContext& context,
          google::cloud::edgecontainer::v1::GetMachineRequest const& request) {
        return child_->GetMachine(context, request);
      },
      context, request, __func__, tracing_options_);
}

StatusOr<google::cloud::edgecontainer::v1::ListVpnConnectionsResponse>
EdgeContainerLogging::ListVpnConnections(
    grpc::ClientContext& context,
    google::cloud::edgecontainer::v1::ListVpnConnectionsRequest const&
        request) {
  return google::cloud::internal::LogWrapper(
      [this](grpc::ClientContext& context,
             google::cloud::edgecontainer::v1::ListVpnConnectionsRequest const&
                 request) {
        return child_->ListVpnConnections(context, request);
      },
      context, request, __func__, tracing_options_);
}

StatusOr<google::cloud::edgecontainer::v1::VpnConnection>
EdgeContainerLogging::GetVpnConnection(
    grpc::ClientContext& context,
    google::cloud::edgecontainer::v1::GetVpnConnectionRequest const& request) {
  return google::cloud::internal::LogWrapper(
      [this](grpc::ClientContext& context,
             google::cloud::edgecontainer::v1::GetVpnConnectionRequest const&
                 request) {
        return child_->GetVpnConnection(context, request);
      },
      context, request, __func__, tracing_options_);
}

future<StatusOr<google::longrunning::Operation>>
EdgeContainerLogging::AsyncCreateVpnConnection(
    google::cloud::CompletionQueue& cq,
    std::unique_ptr<grpc::ClientContext> context,
    google::cloud::edgecontainer::v1::CreateVpnConnectionRequest const&
        request) {
  return google::cloud::internal::LogWrapper(
      [this](google::cloud::CompletionQueue& cq,
             std::unique_ptr<grpc::ClientContext> context,
             google::cloud::edgecontainer::v1::CreateVpnConnectionRequest const&
                 request) {
        return child_->AsyncCreateVpnConnection(cq, std::move(context),
                                                request);
      },
      cq, std::move(context), request, __func__, tracing_options_);
}

future<StatusOr<google::longrunning::Operation>>
EdgeContainerLogging::AsyncDeleteVpnConnection(
    google::cloud::CompletionQueue& cq,
    std::unique_ptr<grpc::ClientContext> context,
    google::cloud::edgecontainer::v1::DeleteVpnConnectionRequest const&
        request) {
  return google::cloud::internal::LogWrapper(
      [this](google::cloud::CompletionQueue& cq,
             std::unique_ptr<grpc::ClientContext> context,
             google::cloud::edgecontainer::v1::DeleteVpnConnectionRequest const&
                 request) {
        return child_->AsyncDeleteVpnConnection(cq, std::move(context),
                                                request);
      },
      cq, std::move(context), request, __func__, tracing_options_);
}

future<StatusOr<google::longrunning::Operation>>
EdgeContainerLogging::AsyncGetOperation(
    google::cloud::CompletionQueue& cq,
    std::unique_ptr<grpc::ClientContext> context,
    google::longrunning::GetOperationRequest const& request) {
  return google::cloud::internal::LogWrapper(
      [this](google::cloud::CompletionQueue& cq,
             std::unique_ptr<grpc::ClientContext> context,
             google::longrunning::GetOperationRequest const& request) {
        return child_->AsyncGetOperation(cq, std::move(context), request);
      },
      cq, std::move(context), request, __func__, tracing_options_);
}

future<Status> EdgeContainerLogging::AsyncCancelOperation(
    google::cloud::CompletionQueue& cq,
    std::unique_ptr<grpc::ClientContext> context,
    google::longrunning::CancelOperationRequest const& request) {
  return google::cloud::internal::LogWrapper(
      [this](google::cloud::CompletionQueue& cq,
             std::unique_ptr<grpc::ClientContext> context,
             google::longrunning::CancelOperationRequest const& request) {
        return child_->AsyncCancelOperation(cq, std::move(context), request);
      },
      cq, std::move(context), request, __func__, tracing_options_);
}

GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END
}  // namespace edgecontainer_internal
}  // namespace cloud
}  // namespace google


text:
import tweepy
import json
import csv
from datetime import datetime, date
import time
from bson import json_util
from tweepy.streaming import StreamListener
from tweepy import OAuthHandler
from tweepy import Stream
from textblob import TextBlob
from pymongo import MongoClient

# import twitter keys and tokens
from config import *

#Authenticate via Twitter
auth = OAuthHandler(consumer_key, consumer_secret)
auth.set_access_token(access_token, access_token_secret)
api = tweepy.API(auth)

#Pass MongoDB variables
MONGODB_HOST = 'localhost'
MONGODB_PORT = 27017
DB_NAME = 'twittersentiment'
COLLECTION_NAME = 'betterment'
FIELDS = {
    "author": True,
    "message": True,
    "date" : True,
    "polarity": True,
    "subjectivity": True,
    "sentiment": True,
    "_id" : False
}

tweets = []

def test():
    connection = MongoClient(MONGODB_HOST, MONGODB_PORT)
    collection = connection[DB_NAME][COLLECTION_NAME]
    tweet = collection.find_one(projection=FIELDS)
    #json_tweets = [json.dumps(tweet, default=json_util.default) for tweet in tweets]
    #json_tweets = [json.loads(json_tweet, object_hook=json_util.object_hook) for json_tweet in json_tweets]
    return tweet["date"]

def scrape(query):
    print "Searching for matching tweets and analyzing sentiment..."
    for data in tweepy.Cursor(api.search, q=query).items():

        date = data.created_at.strftime("%Y-%m-%d")
        text = TextBlob(data.text)
        polarity = text.sentiment.polarity

        # determine if sentiment is positive, negative, or neutral
        if polarity < 0:
            sentiment = "negative"
        else:
            sentiment = "positive"

        tweets.append({
            "author": data.user.screen_name,
            "date": date,
            "message": data.text,
            "polarity": polarity,
            "subjectivity": text.sentiment.subjectivity,
            "sentiment": sentiment
            })
    print "...done."
    return tweets

def add(data):
    print "Inserting into MongoDB..."
    connection = MongoClient(MONGODB_HOST, MONGODB_PORT)
    collection = connection[DB_NAME][COLLECTION_NAME]
    collection.insert(data)
    print "...done."
    connection.close()

def clear():
    connection = MongoClient(MONGODB_HOST, MONGODB_PORT)
    collection = connection[DB_NAME][COLLECTION_NAME]
    collection.drop()
'''def export_csv():
    print "Exporting to csv..."
    f = open('tweets.csv', 'w', newline = '')
    for tweet in tweets:
        tweet.date = tweet.date.date()
'''

if __name__ == "__main__":
    clear()
    add(scrape("@Betterment"))
#    query = "@Betterment"
#    scrape(query)


text:
ACCEPTED

#### According to
Index Fungorum

#### Published in
in Sun, Lu & Bai, Acta Mycol. Sin. 14(2): 109 (1995)

#### Original name
Ascochyta maackiae J.D. Sun & J.K. Bai

### Remarks
null


text:
//
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.0-b52-fcs
// See http://java.sun.com/xml/jaxb
// Any modifications to this file will be lost upon recompilation of the source schema.
// Generated on: 2012.09.17 at 02:39:44 오후 KST
//

package com.athena.chameleon.engine.entity.xml.application.jeus.v5_0;

import java.util.ArrayList;
import java.util.List;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;

/**
 *
Java class for snmp-adaptorType complex type.
 *
 *
The following schema fragment specifies the expected content contained within this class.
 *
 *

 * <complexType name="snmp-adaptorType">
 *   <complexContent>
 *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
 *       <sequence>
 *         <element name="snmp-adaptor-port" type="{http://www.tmaxsoft.com/xml/ns/jeus}snmp-adaptor-portType"/>
 *         <element name="snmp-version" type="{http://www.tmaxsoft.com/xml/ns/jeus}snmp-versionType" minOccurs="0"/>
 *         <element name="snmp-max-packet-size" type="{http://www.tmaxsoft.com/xml/ns/jeus}snmp-max-packet-sizeType" minOccurs="0"/>
 *         <element name="snmp-security" type="{http://www.w3.org/2001/XMLSchema}boolean" minOccurs="0"/>
 *         <element name="trap-demon" type="{http://www.tmaxsoft.com/xml/ns/jeus}trap-demonType" maxOccurs="unbounded" minOccurs="0"/>
 *         <element name="pooling" type="{http://www.tmaxsoft.com/xml/ns/jeus}poolingType" minOccurs="0"/>
 *       </sequence>
 *     </restriction>
 *   </complexContent>
 * </complexType>
 *

 *
 *
 */
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "snmp-adaptorType", propOrder = {
    "snmpAdaptorPort",
    "snmpVersion",
    "snmpMaxPacketSize",
    "snmpSecurity",
    "trapDemon",
    "pooling"
})
public class SnmpAdaptorType {

    @XmlElement(name = "snmp-adaptor-port", namespace = "http://www.tmaxsoft.com/xml/ns/jeus")
    protected int snmpAdaptorPort;
    @XmlElement(name = "snmp-version", namespace = "http://www.tmaxsoft.com/xml/ns/jeus", defaultValue = "3")
    protected Integer snmpVersion;
    @XmlElement(name = "snmp-max-packet-size", namespace = "http://www.tmaxsoft.com/xml/ns/jeus", defaultValue = "4096")
    protected Integer snmpMaxPacketSize;
    @XmlElement(name = "snmp-security", namespace = "http://www.tmaxsoft.com/xml/ns/jeus", defaultValue = "false")
    protected Boolean snmpSecurity;
    @XmlElement(name = "trap-demon", namespace = "http://www.tmaxsoft.com/xml/ns/jeus", required = true)
    protected List<TrapDemonType> trapDemon;
    @XmlElement(namespace = "http://www.tmaxsoft.com/xml/ns/jeus")
    protected PoolingType pooling;

    /**
     * Gets the value of the snmpAdaptorPort property.
     *
     */
    public int getSnmpAdaptorPort() {
        return snmpAdaptorPort;
    }

    /**
     * Sets the value of the snmpAdaptorPort property.
     *
     */
    public void setSnmpAdaptorPort(int value) {
        this.snmpAdaptorPort = value;
    }

    /**
     * Gets the value of the snmpVersion property.
     *
     * @return
     *     possible object is
     *     {@link Integer }
     *
     */
    public Integer getSnmpVersion() {
        return snmpVersion;
    }

    /**
     * Sets the value of the snmpVersion property.
     *
     * @param value
     *     allowed object is
     *     {@link Integer }
     *
     */
    public void setSnmpVersion(Integer value) {
        this.snmpVersion = value;
    }

    /**
     * Gets the value of the snmpMaxPacketSize property.
     *
     * @return
     *     possible object is
     *     {@link Integer }
     *
     */
    public Integer getSnmpMaxPacketSize() {
        return snmpMaxPacketSize;
    }

    /**
     * Sets the value of the snmpMaxPacketSize property.
     *
     * @param value
     *     allowed object is
     *     {@link Integer }
     *
     */
    public void setSnmpMaxPacketSize(Integer value) {
        this.snmpMaxPacketSize = value;
    }

    /**
     * Gets the value of the snmpSecurity property.
     *
     * @return
     *     possible object is
     *     {@link Boolean }
     *
     */
    public Boolean isSnmpSecurity() {
        return snmpSecurity;
    }

    /**
     * Sets the value of the snmpSecurity property.
     *
     * @param value
     *     allowed object is
     *     {@link Boolean }
     *
     */
    public void setSnmpSecurity(Boolean value) {
        this.snmpSecurity = value;
    }

    /**
     * Gets the value of the trapDemon property.
     *
     *

     * This accessor method returns a reference to the live list,
     * not a snapshot. Therefore any modification you make to the
     * returned list will be present inside the JAXB object.
     * This is why there is not a set method for the trapDemon property.
     *
     *

     * For example, to add a new item, do as follows:
     *

     *    getTrapDemon().add(newItem);
     *

     *
     *
     *

     * Objects of the following type(s) are allowed in the list
     * {@link TrapDemonType }
     *
     *
     */
    public List<TrapDemonType> getTrapDemon() {
        if (trapDemon == null) {
            trapDemon = new ArrayList<TrapDemonType>();
        }
        return this.trapDemon;
    }

    /**
     * Gets the value of the pooling property.
     *
     * @return
     *     possible object is
     *     {@link PoolingType }
     *
     */
    public PoolingType getPooling() {
        return pooling;
    }

    /**
     * Sets the value of the pooling property.
     *
     * @param value
     *     allowed object is
     *     {@link PoolingType }
     *
     */
    public void setPooling(PoolingType value) {
        this.pooling = value;
    }

}


text:
// Copyright 2011-2016 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package com.google.security.zynamics.binnavi.API.disassembly;

import java.util.List;

import com.google.security.zynamics.binnavi.Gui.GraphWindows.CommentDialogs.Interfaces.IComment;

// / Used to listen on instructions.
/**
 * Interface that can be implemented by objects that want to be notified about changes in
 * Instruction objects.
 */
public interface IInstructionListener {
  // ! Signals an appended instruction comment.
  /**
   * Invoked after a comment has been added to the list of instruction comments.
   *
   * @param instruction The instruction where the comment was added.
   * @param comment The comment which was added.
   */
  void appendedComment(Instruction instruction, IComment comment);

  // ! Signals the deletion of a comment in the list of instruction comments.
  /**
   * Invoked after a comment has been deleted from the list of instruction comments.
   *
   * @param instruction The instruction where the comment was deleted.
   * @param comment The comment which was deleted.
   */
  void deletedComment(Instruction instruction, IComment comment);

  // ! Signals an edited instruction comment.
  /**
   * Invoked after the comment of the instruction was edited.
   *
   * @param instruction The instruction whose comment changed.
   * @param comment The new comment of the instruction.
   */
  void editedComment(Instruction instruction, IComment comment);

  // ! Signals the initialization of the instruction comments.
  /**
   * Invoked after the comments of an instruction have been initialized.
   *
   * @param instruction The instructions whose comments are initialized.
   * @param comments The comments with which the instruction is initialized.
   */
  void initializedComment(Instruction instruction, List<IComment> comments);
}


text:
package com.netuitive.io.dropwizard;

import com.codahale.metrics.MetricRegistry;
import com.codahale.metrics.ScheduledReporter;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonTypeName;
import com.readytalk.metrics.StatsDReporter;
import io.dropwizard.metrics.BaseReporterFactory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import javax.validation.constraints.NotNull;

/**
 *
 * Created by bspindler on 6/10/16.
 */
@JsonTypeName("statsd-reporter-example")
public class StatsDReporterFactory extends BaseReporterFactory {

    private static final Logger LOG = LoggerFactory.getLogger(StatsDReporterFactory.class);

    @NotNull
    private String host;

    @JsonProperty
    public String getHost() {
        return host;
    }

    @JsonProperty
    public void setHost(String host) {
        this.host = host;
    }

    @NotNull
    private int port;

    @JsonProperty
    public int getPort() { return port; }

    @JsonProperty
    public void setPort(int port) { this.port = port; }

    /**
     * Configures and builds a {@link ScheduledReporter} instance for the given registry.
     *
     * @param registry the metrics registry to report metrics from.
     * @return a reporter configured for the given metrics registry.
     */
    @Override
    public ScheduledReporter build(MetricRegistry registry) {

        StatsDReporter.Builder builder
                = StatsDReporter.forRegistry(registry)
                                .convertDurationsTo(getDurationUnit())
                                .convertRatesTo(getRateUnit())
                                .filter(getFilter());

        LOG.info("StatsDReporterFactory built with host: {}, port: {}", getHost(), getPort());

        return builder.build(getHost(), getPort());
    }
}


text:
/*jshint globalstrict:false, strict:false, maxlen: 500 */
/*global fail, assertEqual, assertNotEqual, AQL_EXPLAIN */

////////////////////////////////////////////////////////////////////////////////
/// @brief tests for Ahuacatl, skiplist index queries
///
/// @file
///
/// DISCLAIMER
///
/// Copyright 2010-2016 ArangoDB GmbH, Cologne, Germany
///
/// Licensed under the Apache License, Version 2.0 (the "License");
/// you may not use this file except in compliance with the License.
/// You may obtain a copy of the License at
///
///     http://www.apache.org/licenses/LICENSE-2.0
///
/// Unless required by applicable law or agreed to in writing, software
/// distributed under the License is distributed on an "AS IS" BASIS,
/// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
/// See the License for the specific language governing permissions and
/// limitations under the License.
///
/// Copyright holder is ArangoDB GmbH, Cologne, Germany
///
/// @author Michael Hackstein
/// @author Copyright 2016, ArangoDB GmbH, Cologne, Germany
////////////////////////////////////////////////////////////////////////////////

const internal = require("internal");
const db = internal.db;
const jsunity = require("jsunity");
const errors = internal.errors;

function indexHintSuite() {
  const getIndexNames = function (query) {
    return AQL_EXPLAIN(query, {}, {optimizer: {rules: ["-all", "+use-indexes"]}})
      .plan.nodes.filter(node => (node.type === 'IndexNode'))
      .map(node => node.indexes.map(index => index.name));
  };

  const cn = 'UnitTestsIndexHints';
  let collection;
  let defaultEqualityIndex;
  let alternateEqualityIndex;
  let defaultSortingIndex;
  let alternateSortingIndex;

  return {

////////////////////////////////////////////////////////////////////////////////
/// @brief set up
////////////////////////////////////////////////////////////////////////////////

    setUpAll: function () {
      internal.db._drop(cn);
      collection = internal.db._create(cn);

      collection.ensureIndex({type: 'hash', name: 'hash_a', fields: ['a']});
      collection.ensureIndex({type: 'hash', name: 'hash_a_b', fields: ['a', 'b']});
      collection.ensureIndex({type: 'hash', name: 'hash_b_a', fields: ['b', 'a']});
      collection.ensureIndex({type: 'skiplist', name: 'skip_a', fields: ['a']});
      collection.ensureIndex({type: 'skiplist', name: 'skip_a_b', fields: ['a', 'b']});
      collection.ensureIndex({type: 'skiplist', name: 'skip_b_a', fields: ['b', 'a']});

      defaultEqualityIndex = 'hash_a';
      alternateEqualityIndex = 'skip_a';
      defaultSortingIndex = 'hash_a';
      alternateSortingIndex = 'skip_a_b';
    },

    tearDownAll: function () {
      internal.db._drop(cn);
    },

    testFilterNoHint: function () {
      const query = `
        FOR doc IN ${cn} OPTIONS {}
          FILTER doc.a == 1
          RETURN doc
      `;
      const usedIndexes = getIndexNames(query);
      assertEqual(usedIndexes.length, 1);
      assertEqual(usedIndexes[0].length, 1);
      assertEqual(usedIndexes[0][0], defaultEqualityIndex);
    },

    testPrimary: function () {
      [
        `FOR doc IN ${cn} OPTIONS {indexHint: 'primary', forceIndexHint: false} FILTER doc._key == 'test' RETURN doc`,
        `FOR doc IN ${cn} OPTIONS {indexHint: 'primary', forceIndexHint: true} FILTER doc._key == 'test' RETURN doc`,
        `FOR doc IN ${cn} OPTIONS {indexHint: 'primary', forceIndexHint: false} FILTER doc._key == 'test' && doc.testi == 99 RETURN doc`,
        `FOR doc IN ${cn} OPTIONS {indexHint: 'primary', forceIndexHint: true} FILTER doc._key == 'test' && doc.testi == 99 RETURN doc`,
        `FOR doc IN ${cn} OPTIONS {indexHint: 'primary', forceIndexHint: false} FILTER doc.testi == 99 && doc._key == 'test' RETURN doc`,
        `FOR doc IN ${cn} OPTIONS {indexHint: 'primary', forceIndexHint: true} FILTER doc.testi == 99 && doc._key == 'test' RETURN doc`,
      ].forEach((query) => {
        const usedIndexes = getIndexNames(query);
        assertEqual(usedIndexes.length, 1, query);
        assertEqual(usedIndexes[0].length, 1, query);
        assertEqual(usedIndexes[0][0], 'primary', query);
      });
    },

    testMultipleOrConditionsPrimary: function () {
      [
        `FOR doc IN ${cn} OPTIONS {indexHint: 'primary', forceIndexHint: false} FILTER doc._key == 'test' || doc.a == 'testi' RETURN doc`,
        `FOR doc IN ${cn} OPTIONS {indexHint: 'primary', forceIndexHint: true} FILTER doc._key == 'test' || doc.a == 'testi' RETURN doc`,
        `FOR doc IN ${cn} OPTIONS {indexHint: 'primary', forceIndexHint: false} FILTER doc.a == 'testi' || doc._key == 'test' RETURN doc`,
        `FOR doc IN ${cn} OPTIONS {indexHint: 'primary', forceIndexHint: true} FILTER doc.a == 'testi' || doc._key == 'test' RETURN doc`,
      ].forEach((query) => {
        const usedIndexes = getIndexNames(query);
        assertEqual(usedIndexes.length, 1, query);
        assertEqual(usedIndexes[0].length, 2, query);
        assertEqual(["hash_a", "primary"], usedIndexes[0].sort(), query);
      });
    },

    testMultipleOrConditionsOther: function () {
      [
        `FOR doc IN ${cn} OPTIONS {indexHint: 'primary', forceIndexHint: false} FILTER doc.a == 'test' || doc.b == 'testi' RETURN doc`,
        `FOR doc IN ${cn} OPTIONS {indexHint: 'primary', forceIndexHint: true} FILTER doc.a == 'test' || doc.b == 'testi' RETURN doc`,
        `FOR doc IN ${cn} OPTIONS {indexHint: 'primary', forceIndexHint: false} FILTER doc.b == 'testi' || doc.a == 'test' RETURN doc`,
        `FOR doc IN ${cn} OPTIONS {indexHint: 'primary', forceIndexHint: true} FILTER doc.b == 'testi' || doc.a == 'test' RETURN doc`,
      ].forEach((query) => {
        const usedIndexes = getIndexNames(query);
        assertEqual(usedIndexes.length, 1, query);
        assertEqual(usedIndexes[0].length, 2, query);
        assertEqual(["hash_a", "hash_b_a"], usedIndexes[0].sort(), query);
      });
    },

    testMultipleOrConditionsSomeOfThemOnNonIndexedAttributes: function () {
      [
        `FOR doc IN ${cn} OPTIONS {indexHint: 'primary', forceIndexHint: true} FILTER doc._key == 'test' || doc.testi == 99 RETURN doc`,
        `FOR doc IN ${cn} OPTIONS {indexHint: 'primary', forceIndexHint: true} FILTER doc.testi == 99 || doc._key == 'test' RETURN doc`,
      ].forEach((query) => {
        // no indexes used here
        const usedIndexes = getIndexNames(query);
        assertEqual(usedIndexes.length, 0, query);
      });
    },

    testFilterDefaultHint: function () {
      const query = `
        FOR doc IN ${cn} OPTIONS {indexHint: '${defaultEqualityIndex}'}
          FILTER doc.a == 1
          RETURN doc
      `;
      const usedIndexes = getIndexNames(query);
      assertEqual(usedIndexes.length, 1);
      assertEqual(usedIndexes[0].length, 1);
      assertEqual(usedIndexes[0][0], defaultEqualityIndex);
    },

    testFilterDefaultHintForced: function () {
      const query = `
        FOR doc IN ${cn} OPTIONS {indexHint: '${defaultEqualityIndex}', forceIndexHint: true}
          FILTER doc.a == 1
          RETURN doc
      `;
      const usedIndexes = getIndexNames(query);
      assertEqual(usedIndexes.length, 1);
      assertEqual(usedIndexes[0].length, 1);
      assertEqual(usedIndexes[0][0], defaultEqualityIndex);
    },

    testFilterNonexistentIndexHint: function () {
      const query = `
        FOR doc IN ${cn} OPTIONS {indexHint: 'foo'}
          FILTER doc.a == 1
          RETURN doc
      `;
      const usedIndexes = getIndexNames(query);
      assertEqual(usedIndexes.length, 1);
      assertEqual(usedIndexes[0].length, 1);
      assertEqual(usedIndexes[0][0], defaultEqualityIndex);
    },

    testFilterNonexistentIndexHintForced: function () {
      const query = `
        FOR doc IN ${cn} OPTIONS {indexHint: 'foo', forceIndexHint: true}
          FILTER doc.a == 1
          RETURN doc
      `;
      try {
        const usedIndexes = getIndexNames(query);
        fail();
      } catch (err) {
        assertEqual(errors.ERROR_QUERY_FORCED_INDEX_HINT_UNUSABLE.code, err.errorNum);
      }
    },

    testFilterUnusableHint: function () {
      const query = `
        FOR doc IN ${cn} OPTIONS {indexHint: 'hash_b_a'}
          FILTER doc.a == 1
          RETURN doc
      `;
      const usedIndexes = getIndexNames(query);
      assertEqual(usedIndexes.length, 1);
      assertEqual(usedIndexes[0].length, 1);
      assertEqual(usedIndexes[0][0], defaultEqualityIndex);
    },

    testFilterUnusableHintForced: function () {
      const query = `
        FOR doc IN ${cn} OPTIONS {indexHint: 'hash_b_a', forceIndexHint: true}
          FILTER doc.a == 1
          RETURN doc
      `;
      try {
        const usedIndexes = getIndexNames(query);
        fail();
      } catch (err) {
        assertEqual(errors.ERROR_QUERY_FORCED_INDEX_HINT_UNUSABLE.code, err.errorNum);
      }
    },

    testFilterTypeHint: function () {
      const query = `
        FOR doc IN ${cn} OPTIONS {indexHint: '${alternateEqualityIndex}'}
          FILTER doc.a == 1
          RETURN doc
      `;
      const usedIndexes = getIndexNames(query);
      assertEqual(usedIndexes.length, 1);
      assertEqual(usedIndexes[0].length, 1);
      assertEqual(usedIndexes[0][0], alternateEqualityIndex);
    },

    testFilterPartialCoverageHint: function () {
      const query = `
        FOR doc IN ${cn} OPTIONS {indexHint: 'skip_a_b'}
          FILTER doc.a == 1
          RETURN doc
      `;
      const usedIndexes = getIndexNames(query);
      assertEqual(usedIndexes.length, 1);
      assertEqual(usedIndexes[0].length, 1);
      assertEqual(usedIndexes[0][0], 'skip_a_b');
    },

    testFilterListFirstHint: function () {
      const query = `
        FOR doc IN ${cn} OPTIONS {indexHint: ['skip_a_b', '${alternateEqualityIndex}']}
          FILTER doc.a == 1
          RETURN doc
      `;
      const usedIndexes = getIndexNames(query);
      assertEqual(usedIndexes.length, 1);
      assertEqual(usedIndexes[0].length, 1);
      assertEqual(usedIndexes[0][0], `skip_a_b`);
    },

    testFilterListLastHint: function () {
      const query = `
        FOR doc IN ${cn} OPTIONS {indexHint: ['skip_b_a', '${alternateEqualityIndex}']}
          FILTER doc.a == 1
          RETURN doc
      `;
      const usedIndexes = getIndexNames(query);
      assertEqual(usedIndexes.length, 1);
      assertEqual(usedIndexes[0].length, 1);
      assertEqual(usedIndexes[0][0], alternateEqualityIndex);
    },

    testFilterNestedMatchedHint: function () {
      const query = `
        FOR doc IN ${cn} OPTIONS {indexHint: '${alternateEqualityIndex}'}
          FILTER doc.a == 1
          FOR sub IN ${cn} OPTIONS {indexHint: '${alternateEqualityIndex}'}
            FILTER sub.a == 2
            RETURN [doc, sub]
      `;
      const usedIndexes = getIndexNames(query);
      assertEqual(usedIndexes.length, 2);
      assertEqual(usedIndexes[0].length, 1);
      assertEqual(usedIndexes[0][0], alternateEqualityIndex);
      assertEqual(usedIndexes[1].length, 1);
      assertEqual(usedIndexes[1][0], alternateEqualityIndex);
    },

    testFilterNestedUnmatchedHint: function () {
      const query = `
        FOR doc IN ${cn} OPTIONS {indexHint: '${alternateEqualityIndex}'}
          FILTER doc.a == 1
          FOR sub IN ${cn} OPTIONS {indexHint: 'skip_a_b'}
            FILTER sub.a == 2
            RETURN [doc, sub]
      `;
      const usedIndexes = getIndexNames(query);
      assertEqual(usedIndexes.length, 2);
      assertEqual(usedIndexes[0].length, 1);
      assertEqual(usedIndexes[0][0], alternateEqualityIndex);
      assertEqual(usedIndexes[1].length, 1);
      assertEqual(usedIndexes[1][0], 'skip_a_b');
    },

    testSortNoHint: function () {
      const query = `
        FOR doc IN ${cn} OPTIONS {}
          SORT doc.a
          RETURN doc
      `;
      const usedIndexes = getIndexNames(query);
      assertEqual(usedIndexes.length, 1);
      assertEqual(usedIndexes[0].length, 1);
      assertEqual(usedIndexes[0][0], defaultSortingIndex);
    },

    testSortDefaultHint: function () {
      const query = `
        FOR doc IN ${cn} OPTIONS {indexHint: '${defaultSortingIndex}'}
          SORT doc.a
          RETURN doc
      `;
      const usedIndexes = getIndexNames(query);
      assertEqual(usedIndexes.length, 1);
      assertEqual(usedIndexes[0].length, 1);
      assertEqual(usedIndexes[0][0], defaultSortingIndex);
    },

    testSortDefaultHintForced: function () {
      const query = `
        FOR doc IN ${cn} OPTIONS {indexHint: '${defaultSortingIndex}', forceIndexHint: true}
          SORT doc.a
          RETURN doc
      `;
      const usedIndexes = getIndexNames(query);
      assertEqual(usedIndexes.length, 1);
      assertEqual(usedIndexes[0].length, 1);
      assertEqual(usedIndexes[0][0], defaultSortingIndex);
    },

    testSortNonexistentIndexHint: function () {
      const query = `
        FOR doc IN ${cn} OPTIONS {indexHint: 'foo'}
          SORT doc.a
          RETURN doc
      `;
      const usedIndexes = getIndexNames(query);
      assertEqual(usedIndexes.length, 1);
      assertEqual(usedIndexes[0].length, 1);
      assertEqual(usedIndexes[0][0], defaultSortingIndex);
    },

    testSortNonexistentIndexHintForced: function () {
      const query = `
        FOR doc IN ${cn} OPTIONS {indexHint: 'foo', forceIndexHint: true}
          SORT doc.a
          RETURN doc
      `;
      try {
        const usedIndexes = getIndexNames(query);
        fail();
      } catch (err) {
        assertEqual(errors.ERROR_QUERY_FORCED_INDEX_HINT_UNUSABLE.code, err.errorNum);
      }
    },

    testSortUnusableHint: function () {
      const query = `
        FOR doc IN ${cn} OPTIONS {indexHint: 'skip_b_a'}
          SORT doc.a
          RETURN doc
      `;
      const usedIndexes = getIndexNames(query);
      assertEqual(usedIndexes.length, 1);
      assertEqual(usedIndexes[0].length, 1);
      assertEqual(usedIndexes[0][0], defaultSortingIndex);
    },

    testSortUnusableHintForced: function () {
      const query = `
        FOR doc IN ${cn} OPTIONS {indexHint: 'skip_b_a', forceIndexHint: true}
          SORT doc.a
          RETURN doc
      `;
      try {
        const usedIndexes = getIndexNames(query);
        fail();
      } catch (err) {
        assertEqual(errors.ERROR_QUERY_FORCED_INDEX_HINT_UNUSABLE.code, err.errorNum);
      }
    },

    testSortPartialCoverageHint: function () {
      const query = `
        FOR doc IN ${cn} OPTIONS {indexHint: '${alternateSortingIndex}'}
          SORT doc.a
          RETURN doc
      `;
      const usedIndexes = getIndexNames(query);
      assertEqual(usedIndexes.length, 1);
      assertEqual(usedIndexes[0].length, 1);
      assertEqual(usedIndexes[0][0], alternateSortingIndex);
    },

    testSortListFirstHint: function () {
      const query = `
        FOR doc IN ${cn} OPTIONS {indexHint: ['${alternateSortingIndex}', '${defaultSortingIndex}']}
          SORT doc.a
          RETURN doc
      `;
      const usedIndexes = getIndexNames(query);
      assertEqual(usedIndexes.length, 1);
      assertEqual(usedIndexes[0].length, 1);
      assertEqual(usedIndexes[0][0], alternateSortingIndex);
    },

    testSortListLastHint: function () {
      const query = `
        FOR doc IN ${cn} OPTIONS {indexHint: ['skip_b_a', '${alternateSortingIndex}']}
          SORT doc.a
          RETURN doc
      `;
      const usedIndexes = getIndexNames(query);
      assertEqual(usedIndexes.length, 1);
      assertEqual(usedIndexes[0].length, 1);
      assertEqual(usedIndexes[0][0], alternateSortingIndex);
    },

    testUpsertWithIndexHint: function () {
      const prefix = " UPSERT { a: 1234 } INSERT { a: 1234 } UPDATE {} IN " + cn + " OPTIONS ";
      const indexHints = [
        [{}, ["hash_a", "hash_a_b", "skip_a", "skip_a_b"]],
        [{indexHint: 'foo'}, ["hash_a", "hash_a_b", "skip_a", "skip_a_b"]],
        [{indexHint: ['hash_a'], forceIndexHint: true}, ['hash_a']],
        [{indexHint: ['hash_a']}, ['hash_a']],
        [{indexHint: ['hash_a_b'], forceIndexHint: true}, ['hash_a_b']],
        [{indexHint: ['hash_a_b']}, ['hash_a_b']],
        [{indexHint: ['skip_a'], forceIndexHint: true}, ['skip_a']],
        [{indexHint: ['skip_a']}, ['skip_a']],
        [{indexHint: ['skip_a_b'], forceIndexHint: true}, ['skip_a_b']],
        [{indexHint: ['skip_a_b']}, ['skip_a_b']],
        [{indexHint: ['foo', 'bar', 'hash_a'], forceIndexHint: true}, ['hash_a']],
        [{indexHint: 'hash_a', forceIndexHint: true}, ['hash_a']],
        [{indexHint: 'hash_a'}, ['hash_a']],
        [{indexHint: 'hash_a_b', forceIndexHint: true}, ['hash_a_b']],
        [{indexHint: 'hash_a_b'}, ['hash_a_b']],
        [{indexHint: 'skip_a', forceIndexHint: true}, ['skip_a']],
        [{indexHint: 'skip_a'}, ['skip_a']],
        [{indexHint: 'skip_a_b', forceIndexHint: true}, ['skip_a_b']],
        [{indexHint: 'skip_a_b'}, ['skip_a_b']],
      ];
      indexHints.forEach((indexHint, index) => {
        let queryExplain = AQL_EXPLAIN(prefix + JSON.stringify(indexHint[0])).plan.nodes;
        queryExplain.filter((node) => node.type === "IndexNode").forEach((node) => {
            assertNotEqual(indexHint[1].indexOf(node.indexes[0].name), -1);
        });
      });
    }
  };
}

function indexHintDisableIndexSuite() {
  const cn = 'UnitTestsIndexHints';

  return {

    setUpAll: function () {
      internal.db._drop(cn);
      let c = internal.db._create(cn);
      c.ensureIndex({type: 'persistent', name: 'value1', fields: ['value1']});
    },

    tearDownAll: function () {
      internal.db._drop(cn);
    },

    testDisableIndexOff : function () {
      [ "", "OPTIONS { disableIndex: false }"].forEach((option) => {
        const queries = [
          [ `FOR doc IN ${cn} ${option} RETURN doc`, null, [] ],
          [ `FOR doc IN ${cn} ${option} RETURN doc._key`, 'primary', ['_key'], true ],
          [ `FOR doc IN ${cn} ${option} FILTER doc._key == '123' RETURN doc`, 'primary', [], false ],
          [ `FOR doc IN ${cn} ${option} FILTER doc._key == '123' RETURN doc._key`, 'primary', ['_key'], true ],
          [ `FOR doc IN ${cn} ${option} FILTER doc.value1 == 123 RETURN doc`, 'value1', [], false ],
          [ `FOR doc IN ${cn} ${option} FILTER doc.value1 == 123 RETURN doc.value1`, 'value1', ['value1'], true ],
          [ `FOR doc IN ${cn} ${option} FILTER doc.value1 == 123 RETURN doc.value2`, 'value1', ['value2'], false ],
          [ `FOR doc IN ${cn} ${option} SORT doc._key RETURN doc._key`, 'primary', ['_key'], true ],
          [ `FOR doc IN ${cn} ${option} SORT doc._key RETURN 1`, 'primary', [], false ],
          [ `FOR doc IN ${cn} ${option} SORT doc._key DESC RETURN doc._key`, 'primary', ['_key'], true ],
          [ `FOR doc IN ${cn} ${option} SORT doc._key DESC RETURN 1`, 'primary', [], false ],
          [ `FOR doc IN ${cn} ${option} SORT doc.value1 RETURN doc.value1`, 'value1', ['value1'], true ],
          [ `FOR doc IN ${cn} ${option} SORT doc.value1 RETURN doc.value2`, 'value1', ['value2'], false ],
        ];

        queries.forEach((query) => {
          let plan = AQL_EXPLAIN(query[0], null, { optimizer: { rules: ["-optimize-cluster-single-document-operations"] } }).plan;
          let nodes = plan.nodes;

          let node;

          if (query[1] === null) {
            // expect EnumerateCollectionNode
            assertEqual(0, nodes.filter((node) => node.type === 'IndexNode').length);
            let ns = nodes.filter((node) => node.type === 'EnumerateCollectionNode');
            assertEqual(1, ns.length, query);
            node = ns[0];
          } else {
            // expect IndexNode
            assertEqual(0, nodes.filter((node) => node.type === 'EnumerateCollectionNode').length);
            let ns = nodes.filter((node) => node.type === 'IndexNode');
            assertEqual(1, ns.length, query);
            node = ns[0];
            assertEqual(1, node.indexes.length, query);
            assertEqual(query[1], node.indexes[0].name, query);
            assertEqual(query[3], node.indexCoversProjections, query);
          }
          assertEqual(query[2], node.projections);
        });
      });
    },

    testDisableIndexOn : function () {
      const queries = [
        [ `FOR doc IN ${cn} OPTIONS { disableIndex: true } RETURN 1`, [] ],
        [ `FOR doc IN ${cn} OPTIONS { disableIndex: true } RETURN doc`, [] ],
        [ `FOR doc IN ${cn} OPTIONS { disableIndex: true } RETURN doc._key`, ['_key'] ],
        [ `FOR doc IN ${cn} OPTIONS { disableIndex: true } FILTER doc._key == '123' RETURN doc`, [] ],
        [ `FOR doc IN ${cn} OPTIONS { disableIndex: true } FILTER doc._key == '123' RETURN doc._key`, ['_key'] ],
        [ `FOR doc IN ${cn} OPTIONS { disableIndex: true } FILTER doc.value1 == 123 RETURN doc`, [] ],
        [ `FOR doc IN ${cn} OPTIONS { disableIndex: true } FILTER doc.value1 == 123 RETURN doc.value1`, ['value1'] ],
        [ `FOR doc IN ${cn} OPTIONS { disableIndex: true } FILTER doc.value1 == 123 RETURN doc.value2`, ['value1', 'value2'] ],
        [ `FOR doc IN ${cn} OPTIONS { disableIndex: true } SORT doc._key RETURN doc._key`, ['_key'] ],
        [ `FOR doc IN ${cn} OPTIONS { disableIndex: true } SORT doc._key RETURN 1`, ['_key'] ],
        [ `FOR doc IN ${cn} OPTIONS { disableIndex: true } SORT doc._key DESC RETURN doc._key`, ['_key'] ],
        [ `FOR doc IN ${cn} OPTIONS { disableIndex: true } SORT doc._key DESC RETURN 1`, ['_key'] ],
        [ `FOR doc IN ${cn} OPTIONS { disableIndex: true } SORT doc.value1 RETURN doc.value1`, ['value1'] ],
        [ `FOR doc IN ${cn} OPTIONS { disableIndex: true } SORT doc.value1 RETURN doc.value2`, ['value1', 'value2'] ],
      ];

      queries.forEach((query) => {
        let plan = AQL_EXPLAIN(query[0], null, { optimizer: { rules: ["-optimize-cluster-single-document-operations"] } }).plan;
        let nodes = plan.nodes;

        assertEqual(0, nodes.filter((node) => node.type === 'IndexNode').length);
        let ns = nodes.filter((node) => node.type === 'EnumerateCollectionNode');
        assertEqual(1, ns.length, query);
        let node = ns[0];
        assertEqual(query[1], node.projections.sort(), query);
      });
    },

  };
}

jsunity.run(indexHintSuite);
jsunity.run(indexHintDisableIndexSuite);

return jsunity.done();


text:
#pragma once

#include "FreeRTOS.h"
#include "semphr.h"

namespace PigweedLogger {

void init();
int putString(const char * buffer, size_t size);
SemaphoreHandle_t * getSemaphore();

} // namespace PigweedLogger


text:
package net.kuujo.copycat.raft;

import net.kuujo.copycat.raft.protocol.Operation;
import net.kuujo.copycat.util.concurrent.Context;

import java.util.function.Consumer;
import java.util.function.Function;

/**
 * State machine executor.
 *
 * @author Jordan Halterman
 */
public interface StateMachineExecutor extends Context {

  /**
   * Returns the state machine context.
   *
   * @return The state machine context.
   */
  StateMachineContext context();

  /**
   * Registers a global operation callback.
   *
   * @param callback The operation callback.
   * @return The state machine executor.
   * @throws NullPointerException if {@code callback} is null
   */
  StateMachineExecutor register(Function<Commit<? extends Operation<?>>, ?> callback);

  /**
   * Registers a void operation callback.
   *
   * @param type The operation type.
   * @param callback The operation callback.
   * @param <T> The operation type.
   * @return The state machine executor.
   * @throws NullPointerException if {@code type} or {@code callback} are null
   */
  <T extends Operation<Void>> StateMachineExecutor register(Class<T> type, Consumer<Commit<T>> callback);

  /**
   * Registers an operation callback.
   *
   * @param type The operation type.
   * @param callback The operation callback.
   * @param <T> The operation type.
   * @param  The operation output type.
   * @return The state machine executor.
   * @throws NullPointerException if {@code type} or {@code callback} are null
   */
  <T extends Operation, U> StateMachineExecutor register(Class<T> type, Function<Commit<T>, U> callback);

  @Override
  default void close() {

  }

}


text:
namespace cil {

enum LexemeType : int {
	LtUknown = 0,
	LtComment,
	LtBeginBlock,
	LtEndBlock,
	LtComma,
	LtBeginSquareBracket,
	LtEndSquareBracket
};

class MockLexeme {
	int m_begin;
	int m_end;

public:
	MockLexeme(int begin, int end)
		: m_begin(begin), m_end(end) {
	}

public:
	int Begin() const {
		return m_begin;
	}

	int End() const {
		return m_end;
	}

public:
	virtual std::wstring getValue(const std::wstring &content) {
		std::wstring retVal(content, Begin(), End() - Begin());

		return retVal;
	}

	virtual LexemeType getType() = 0;
};

class Uknown : public MockLexeme {
public:
	Uknown(int begin, int end)
		: MockLexeme(begin, end) {
	}

public:
	LexemeType getType() override {
		return LexemeType::LtUknown;
	}
};

class Comment : public MockLexeme {
public:
	Comment(int begin, int end)
		: MockLexeme(begin, end) {

	}

public:
	LexemeType getType() override {
		return LexemeType::LtComment;
	}
};

class BeginBlock : public MockLexeme {
public:
	BeginBlock(int begin, int end)
		: MockLexeme(begin, end) {
	}

public:
	LexemeType getType() override {
		return LexemeType::LtBeginBlock;
	}
};

class EndBlock : public MockLexeme {
public:
	EndBlock(int begin, int end)
		: MockLexeme(begin, end) {
	}

public:
	LexemeType getType() override {
		return LexemeType::LtEndBlock;
	}
};

class Comma : public MockLexeme {
public:
	Comma(int begin, int end)
		: MockLexeme(begin, end) {
	}

public:
	LexemeType getType() override {
		return LexemeType::LtComma;
	}
};

class BeginSquareBracket : public MockLexeme {
public:
	BeginSquareBracket(int begin, int end)
		: MockLexeme(begin, end) {
	}

public:
	LexemeType getType() override {
		return LexemeType::LtBeginSquareBracket;
	}
};

class EndSquareBracket : public MockLexeme {
public:
	EndSquareBracket(int begin, int end)
		: MockLexeme(begin, end) {
	}

public:
	LexemeType getType() override {
		return LexemeType::LtEndSquareBracket;
	}
};

} // namespace 'ilparser'


text:
import cStringIO
import json
import logging
import unittest

from telemetry.core import util
from telemetry.core.backends.chrome import tracing_backend
from telemetry.timeline import tracing_timeline_data
from telemetry.timeline.model import TimelineModel
from telemetry.unittest import tab_test_case

class CategoryFilterTest(unittest.TestCase):
  def testIsSubset(self):
    b = tracing_backend.CategoryFilter(None)
    a = tracing_backend.CategoryFilter(None)
    self.assertEquals(a.IsSubset(b), True)

    b = tracing_backend.CategoryFilter(None)
    a = tracing_backend.CategoryFilter("test1,test2")
    self.assertEquals(a.IsSubset(b), True)

    b = tracing_backend.CategoryFilter(None)
    a = tracing_backend.CategoryFilter("-test1,-test2")
    self.assertEquals(a.IsSubset(b), True)

    b = tracing_backend.CategoryFilter("test1,test2")
    a = tracing_backend.CategoryFilter(None)
    self.assertEquals(a.IsSubset(b), None)

    b = tracing_backend.CategoryFilter(None)
    a = tracing_backend.CategoryFilter("test*")
    self.assertEquals(a.IsSubset(b), None)

    b = tracing_backend.CategoryFilter("test?")
    a = tracing_backend.CategoryFilter(None)
    self.assertEquals(a.IsSubset(b), None)

    b = tracing_backend.CategoryFilter("test1")
    a = tracing_backend.CategoryFilter("test1,test2")
    self.assertEquals(a.IsSubset(b), False)

    b = tracing_backend.CategoryFilter("-test1")
    a = tracing_backend.CategoryFilter("test1")
    self.assertEquals(a.IsSubset(b), False)

    b = tracing_backend.CategoryFilter("test1,test2")
    a = tracing_backend.CategoryFilter("test2,test1")
    self.assertEquals(a.IsSubset(b), True)

    b = tracing_backend.CategoryFilter("-test1,-test2")
    a = tracing_backend.CategoryFilter("-test2")
    self.assertEquals(a.IsSubset(b), False)

    b = tracing_backend.CategoryFilter("disabled-by-default-test1")
    a = tracing_backend.CategoryFilter(
        "disabled-by-default-test1,disabled-by-default-test2")
    self.assertEquals(a.IsSubset(b), False)

    b = tracing_backend.CategoryFilter("disabled-by-default-test1")
    a = tracing_backend.CategoryFilter("disabled-by-default-test2")
    self.assertEquals(a.IsSubset(b), False)

  def testIsSubsetWithSyntheticDelays(self):
    b = tracing_backend.CategoryFilter("DELAY(foo;0.016)")
    a = tracing_backend.CategoryFilter("DELAY(foo;0.016)")
    self.assertEquals(a.IsSubset(b), True)

    b = tracing_backend.CategoryFilter("DELAY(foo;0.016)")
    a = tracing_backend.CategoryFilter(None)
    self.assertEquals(a.IsSubset(b), True)

    b = tracing_backend.CategoryFilter(None)
    a = tracing_backend.CategoryFilter("DELAY(foo;0.016)")
    self.assertEquals(a.IsSubset(b), False)

    b = tracing_backend.CategoryFilter("DELAY(foo;0.016)")
    a = tracing_backend.CategoryFilter("DELAY(foo;0.032)")
    self.assertEquals(a.IsSubset(b), False)

    b = tracing_backend.CategoryFilter("DELAY(foo;0.016;static)")
    a = tracing_backend.CategoryFilter("DELAY(foo;0.016;oneshot)")
    self.assertEquals(a.IsSubset(b), False)

    b = tracing_backend.CategoryFilter("DELAY(foo;0.016),DELAY(bar;0.1)")
    a = tracing_backend.CategoryFilter("DELAY(bar;0.1),DELAY(foo;0.016)")
    self.assertEquals(a.IsSubset(b), True)

    b = tracing_backend.CategoryFilter("DELAY(foo;0.016),DELAY(bar;0.1)")
    a = tracing_backend.CategoryFilter("DELAY(bar;0.1)")
    self.assertEquals(a.IsSubset(b), True)

    b = tracing_backend.CategoryFilter("DELAY(foo;0.016),DELAY(bar;0.1)")
    a = tracing_backend.CategoryFilter("DELAY(foo;0.032),DELAY(bar;0.1)")
    self.assertEquals(a.IsSubset(b), False)

class TracingBackendTest(tab_test_case.TabTestCase):
  def _StartServer(self):
    self._browser.SetHTTPServerDirectories(util.GetUnittestDataDir())

  def _WaitForAnimationFrame(self):
    def _IsDone():
      js_is_done = """done"""
      return bool(self._tab.EvaluateJavaScript(js_is_done))
    util.WaitFor(_IsDone, 5)

  def testGotTrace(self):
    if not self._browser.supports_tracing:
      logging.warning('Browser does not support tracing, skipping test.')
      return
    self._StartServer()
    self._browser.StartTracing()
    self._browser.StopTracing()

    # TODO(tengs): check model for correctness after trace_event_importer
    # is implemented (crbug.com/173327).

class ChromeTraceResultTest(unittest.TestCase):
  def __init__(self, method_name):
    super(ChromeTraceResultTest, self).__init__(method_name)

  def testWrite1(self):
    ri = tracing_timeline_data.TracingTimelineData(map(json.loads, []))
    f = cStringIO.StringIO()
    ri.Serialize(f)
    v = f.getvalue()

    j = json.loads(v)
    assert 'traceEvents' in j
    self.assertEquals(j['traceEvents'], [])

  def testWrite2(self):
    ri = tracing_timeline_data.TracingTimelineData(map(json.loads, [
        '"foo"',
        '"bar"']))
    f = cStringIO.StringIO()
    ri.Serialize(f)
    v = f.getvalue()

    j = json.loads(v)
    assert 'traceEvents' in j
    self.assertEquals(j['traceEvents'], ['foo', 'bar'])

  def testWrite3(self):
    ri = tracing_timeline_data.TracingTimelineData(map(json.loads, [
        '"foo"',
        '"bar"',
        '"baz"']))
    f = cStringIO.StringIO()
    ri.Serialize(f)
    v = f.getvalue()

    j = json.loads(v)
    assert 'traceEvents' in j
    self.assertEquals(j['traceEvents'],
                      ['foo', 'bar', 'baz'])

  def testBrowserProcess(self):
    ri = tracing_timeline_data.TracingTimelineData(map(json.loads, [
        '{"name": "process_name",'
        '"args": {"name": "Browser"},'
        '"pid": 5, "ph": "M"}',
        '{"name": "thread_name",'
        '"args": {"name": "CrBrowserMain"},'
        '"pid": 5, "tid": 32578, "ph": "M"}']))
    model = TimelineModel(ri)
    self.assertEquals(model.browser_process.pid, 5)


text:
var os = require("os");
var db = require('../../db/DB');

exports.onShutdown = false;
exports.gracefulShutdown = function(err) {
  if(err && err.stack) {
    console.error(err.stack);
  } else if(err) {
    console.error(err);
  }

  //ensure there is only one graceful shutdown running
  if(exports.onShutdown) return;
  exports.onShutdown = true;

  console.log("graceful shutdown...");

  //do the db shutdown
  db.db.doShutdown(function() {
    console.log("db sucessfully closed.");

    process.exit(0);
  });

  setTimeout(function(){
    process.exit(1);
  }, 3000);
}

exports.expressCreateServer = function (hook_name, args, cb) {
  exports.app = args.app;

  // Handle errors
  args.app.use(function(err, req, res, next){
    // if an error occurs Connect will pass it down
    // through these "error-handling" middleware
    // allowing you to respond however you like
    res.send(500, { error: 'Sorry, something bad happened!' });
    console.error(err.stack? err.stack : err.toString());
  })

  //connect graceful shutdown with sigint and uncaughtexception
  if(os.type().indexOf("Windows") == -1) {
    //sigint is so far not working on windows
    //https://github.com/joyent/node/issues/1553
    process.on('SIGINT', exports.gracefulShutdown);
  }

  process.on('uncaughtException', exports.gracefulShutdown);
}


text:
package app.next.udacity.com.nextthing.OkHttp;

/**
 * Created by Shaman on 12/31/14.
 */
public interface HttpCallBack {
    public void callBack();
}


text:
require 'shoulda/action_controller/matchers/assign_to_matcher'
require 'shoulda/action_controller/matchers/filter_param_matcher'
require 'shoulda/action_controller/matchers/set_the_flash_matcher'
require 'shoulda/action_controller/matchers/render_with_layout_matcher'
require 'shoulda/action_controller/matchers/respond_with_matcher'
require 'shoulda/action_controller/matchers/respond_with_content_type_matcher'
require 'shoulda/action_controller/matchers/set_session_matcher'
require 'shoulda/action_controller/matchers/route_matcher'

module Shoulda # :nodoc:
  module ActionController # :nodoc:

    # By using the macro helpers you can quickly and easily create concise and
    # easy to read test suites.
    #
    # This code segment:
    #
    #   describe UsersController, "on GET to show with a valid id" do
    #     before(:each) do
    #       get :show, :id => User.first.to_param
    #     end
    #
    #     it { should assign_to(:user) }
    #     it { should respond_with(:success) }
    #     it { should render_template(:show) }
    #     it { should not_set_the_flash) }
    #
    #     it "should do something else really cool" do
    #       assigns[:user].id.should == 1
    #     end
    #   end
    #
    # Would produce 5 tests for the show action
    module Matchers
    end
  end
end


text:
using Neutronium.Example.ViewModel.Infra;

namespace Neutronium.Example.ViewModel
{
    public class Local : ViewModelBase
    {
        private string _City;
        public string City
        {
            get { return _City; }
            set
            {
                Set(ref _City, value, "City");
            }
        }

        private string _Region;
        public string Region
        {
            get { return _Region; }
            set
            {
                Set(ref _Region, value, "Region");
            }
        }
    }
}


text:
namespace onnxruntime {

class RandomNormal final : public OpKernel {
 public:
  RandomNormal(const OpKernelInfo& info) : OpKernel(info) {
    ORT_ENFORCE(info.GetAttr<float>("mean", &mean_).IsOK());
    ORT_ENFORCE(info.GetAttr<float>("scale", &scale_).IsOK());

    // read optional seed attribute and generate if not provided
    float seed = 0.f;
    if (info.GetAttr<float>("seed", &seed).IsOK()) {
      generator_ = std::default_random_engine{gsl::narrow_cast<uint32_t>(seed)};
    } else {
      // node index is added to the global seed to avoid two nodes generating the same sequence of random data
      generator_ = std::default_random_engine{gsl::narrow_cast<uint32_t>(utils::GetRandomSeed() + info.node().Index())};
    }

    int64_t dtype;
    ORT_ENFORCE(info.GetAttr<int64_t>("dtype", &dtype).IsOK());
    dtype_ = static_cast<ONNX_NAMESPACE::TensorProto::DataType>(dtype);
    ORT_ENFORCE(ONNX_NAMESPACE::TensorProto::DataType_IsValid(dtype_) && dtype_ != ONNX_NAMESPACE::TensorProto::UNDEFINED,
                "Invalid dtype of ", dtype_);

    TensorShapeVector shape;
    ORT_ENFORCE(info.GetAttrs("shape", shape).IsOK());
    shape_ = TensorShape(shape);
  }

  Status Compute(OpKernelContext* ctx) const override;

 private:
  float mean_;
  float scale_;

  // generator_ is updated with every call to Compute().
  // use generator_mutex_ to ensure Compute() can be called concurrently.
  // this is to ensure that a model with random generators is deterministic and still can be executed in parallel.
  mutable std::default_random_engine generator_;
  mutable onnxruntime::OrtMutex generator_mutex_;
  ONNX_NAMESPACE::TensorProto::DataType dtype_;
  TensorShape shape_;
};

class RandomNormalLike final : public OpKernel {
 public:
  RandomNormalLike(const OpKernelInfo& info) : OpKernel(info) {
    ORT_ENFORCE(info.GetAttr<float>("mean", &mean_).IsOK());
    ORT_ENFORCE(info.GetAttr<float>("scale", &scale_).IsOK());

    // read optional seed attribute and generate if not provided
    float seed = 0.f;
    if (info.GetAttr<float>("seed", &seed).IsOK()) {
      generator_ = std::default_random_engine{gsl::narrow_cast<uint32_t>(seed)};
    } else {
      // node index is added to the global seed to avoid two nodes generating the same sequence of random data
      generator_ = std::default_random_engine{gsl::narrow_cast<uint32_t>(utils::GetRandomSeed() + info.node().Index())};
    }

    int64_t dtype;
    if (info.GetAttr<int64_t>("dtype", &dtype).IsOK()) {
      dtype_ = static_cast<ONNX_NAMESPACE::TensorProto::DataType>(dtype);
      ORT_ENFORCE(ONNX_NAMESPACE::TensorProto::DataType_IsValid(dtype_) && dtype_ != ONNX_NAMESPACE::TensorProto::UNDEFINED,
                  "Invalid dtype of ", dtype_);
    }
  }

  Status Compute(OpKernelContext* ctx) const override;

 private:
  float mean_;
  float scale_;

  // see comments for generator_ and generator_mutex_ in RandomNormal class.
  mutable std::default_random_engine generator_;
  mutable onnxruntime::OrtMutex generator_mutex_;
  ONNX_NAMESPACE::TensorProto::DataType dtype_ = ONNX_NAMESPACE::TensorProto::DataType::TensorProto_DataType_UNDEFINED;  //optional and may be inferred
};

class RandomUniform final : public OpKernel {
 public:
  RandomUniform(const OpKernelInfo& info) : OpKernel(info) {
    ORT_ENFORCE(info.GetAttr<float>("high", &high_).IsOK());
    ORT_ENFORCE(info.GetAttr<float>("low", &low_).IsOK());

    // read optional seed attribute and generate if not provided
    float seed = 0.f;
    if (info.GetAttr<float>("seed", &seed).IsOK()) {
      generator_ = std::default_random_engine{gsl::narrow_cast<uint32_t>(seed)};
    } else {
      // node index is added to the global seed to avoid two nodes generating the same sequence of random data
      generator_ = std::default_random_engine{gsl::narrow_cast<uint32_t>(utils::GetRandomSeed() + info.node().Index())};
    }

    int64_t dtype;
    ORT_ENFORCE(info.GetAttr<int64_t>("dtype", &dtype).IsOK());
    dtype_ = static_cast<ONNX_NAMESPACE::TensorProto::DataType>(dtype);
    ORT_ENFORCE(ONNX_NAMESPACE::TensorProto::DataType_IsValid(dtype_) && dtype_ != ONNX_NAMESPACE::TensorProto::UNDEFINED,
                "Invalid dtype of ", dtype_);

    TensorShapeVector shape;
    ORT_ENFORCE(info.GetAttrs("shape", shape).IsOK());
    shape_ = TensorShape(shape);
  }

  Status Compute(OpKernelContext* ctx) const override;

 private:
  float high_;
  float low_;

  // see comments for generator_ and generator_mutex_ in RandomNormal class.
  mutable std::default_random_engine generator_;
  mutable onnxruntime::OrtMutex generator_mutex_;
  ONNX_NAMESPACE::TensorProto::DataType dtype_;
  TensorShape shape_;
};

class RandomUniformLike final : public OpKernel {
 public:
  RandomUniformLike(const OpKernelInfo& info) : OpKernel(info) {
    ORT_ENFORCE(info.GetAttr<float>("high", &high_).IsOK());
    ORT_ENFORCE(info.GetAttr<float>("low", &low_).IsOK());
    // read optional seed attribute and generate if not provided
    float seed = 0.f;
    if (info.GetAttr<float>("seed", &seed).IsOK()) {
      generator_ = std::default_random_engine{gsl::narrow_cast<uint32_t>(seed)};
    } else {
      // node index is added to the global seed to avoid two nodes generating the same sequence of random data
      generator_ = std::default_random_engine{gsl::narrow_cast<uint32_t>(utils::GetRandomSeed() + info.node().Index())};
    }

    int64_t dtype;
    if (info.GetAttr<int64_t>("dtype", &dtype).IsOK()) {
      dtype_ = static_cast<ONNX_NAMESPACE::TensorProto::DataType>(dtype);
      ORT_ENFORCE(ONNX_NAMESPACE::TensorProto::DataType_IsValid(dtype_) && dtype_ != ONNX_NAMESPACE::TensorProto::UNDEFINED,
                  "Invalid dtype of ", dtype_);
    }
  }

  Status Compute(OpKernelContext* ctx) const override;

 private:
  float high_;
  float low_;

  // see comments for generator_ and generator_mutex_ in RandomNormal class.
  mutable std::default_random_engine generator_;
  mutable onnxruntime::OrtMutex generator_mutex_;
  ONNX_NAMESPACE::TensorProto::DataType dtype_ = ONNX_NAMESPACE::TensorProto::DataType::TensorProto_DataType_UNDEFINED;  //optional and may be inferred
};

class Multinomial final : public OpKernel {
 public:
  Multinomial(const OpKernelInfo& info) : OpKernel(info) {
    ORT_ENFORCE(info.GetAttr<int64_t>("sample_size", &num_samples_).IsOK());

    float seed = 0.f;
    if (info.GetAttr<float>("seed", &seed).IsOK()) {
      generator_ = std::default_random_engine{gsl::narrow_cast<uint32_t>(seed)};
    } else {
      // node index is added to the global seed to avoid two nodes generating the same sequence of random data
      generator_ = std::default_random_engine{gsl::narrow_cast<uint32_t>(utils::GetRandomSeed() + info.node().Index())};
    }

    int64_t output_dtype_tmp;
    if (!info.GetAttr<int64_t>("dtype", &output_dtype_tmp).IsOK()) {
      output_dtype_ = ONNX_NAMESPACE::TensorProto_DataType_INT32;  // default is INT32 as per spec
    } else {
      output_dtype_ = static_cast<ONNX_NAMESPACE::TensorProto::DataType>(output_dtype_tmp);
    }
    ORT_ENFORCE(ONNX_NAMESPACE::TensorProto::DataType_IsValid(output_dtype_) && output_dtype_ != ONNX_NAMESPACE::TensorProto::UNDEFINED,
                "Invalid dtype of ", output_dtype_);
  }

  Status Compute(OpKernelContext* ctx) const override;

 private:
  int64_t num_samples_;

  // see comments for generator_ and generator_mutex_ in RandomNormal class.
  mutable std::default_random_engine generator_;
  mutable onnxruntime::OrtMutex generator_mutex_;
  ONNX_NAMESPACE::TensorProto::DataType output_dtype_;
};
}  // namespace onnxruntime


text:
@interface GPPlayerController : UIViewController

@property (nonatomic,copy) NSString *urlString;

- (instancetype)initWithURLString:(NSString *)urlString;

@end


text:
A small time-killer app on node+express.
You get a random photo from Flickr and try to guess what country it was taken in.

App uses geonames.org api for reverse geocoding.

## vk.com
This app will be suited to work with vk.com,
so it will use api of vk.com for authentication and to store some information about user.

## Requirements
As a scaffold was used [Express Coffee Template](https://github.com/twilson63/express-coffee) so
requirements are practically the same:

* [NodeJs](http://nodejs.org)
* [Express](http://expressjs.com)
* [CoffeeScript](http://coffeescript.org)
* [Jade](http://jade-lang.com/)
* [Stylus](http://learnboost.github.io/stylus/)
* [bootstrap-stylus](https://github.com/Acquisio/bootstrap-stylus)
* [Nib](http://visionmedia.github.io/nib/)
* [connect-assets](http://github.com/TrevorBurnham/connect-assets)
* [Mocha](http://mochajs.org/)

## Licence
See LICENSE


text:
'use strict';

const modelFunction = require('../cprsMetaService');
const serviceTestUtils = require('../tests/serviceTestUtils');

describe('validateESignature asynchronous specs', () => {
    let context;
    beforeAll(() => {
        context = serviceTestUtils.beforeAllScript(modelFunction).context;
    });

    it('Valid param returns 1', (done) => {
        modelFunction.validateESignature('10vZr$}A/', context, (err, res) => {
            if (err) return serviceTestUtils.handleError(err, done);
            expect(res).toBeDefined();
            expect(res).toEqual(jasmine.any(Number));
            expect(res).toEqual(1);
            done();
        });
    });

    it('Invalid param returns 0', (done) => {
        modelFunction.validateESignature('blahblahblah1', context, (err, res) => {
            if (err) return serviceTestUtils.handleError(err, done);
            expect(res).toBeDefined();
            expect(res).toEqual(jasmine.any(Number));
            expect(res).toEqual(0);
            done();
        });
    });
});


text:
<?php

// This file is used only on first installation!

$options = array();
$options['ids'] = '';
$options['url'] = '';
$options['message'] = '
Subscribe to our newsletter and get access to the full article.
[subscription_form]';
$options['enabled'] = 0;


text:
classdef GeogridMap < mfs3.map.AbstractLandareasMap
%GEOGRIDMAP Coordinate grid & beam/gateway assignment map

    properties
        % beam grid parameters
        radius  % radius [km]
        tilt    % tilt [deg]
        % satellite beamwidth
        thetaB  % [deg]
        % uicontrol selections
        option = 'dist' % assignment
    end

    properties (SetAccess = protected)
        % link budget
        linkB
        % information tables
        tblGrid     % grid
        tblBeams    % user beams
    end

    properties (SetAccess = private)
        % uicontrol object handles
        panel   % uipanel
        popup   % popup for option
        button  % refresh button
        % graphical object handles
        hData   % surface
        hText   % labels
        hCell   % cells
    end

    methods
        function this = GeogridMap(...
                lonS,altS,radius,tilt,thetaB,tblGrid,tblBeams)
            % Initialize superclass
            this = this@mfs3.map.AbstractLandareasMap(...
                'mercator','europe');
            % Initialize figure and axes
            this.initUI('Association of Beams to Grid Points Map')

            % Initialize link budget
            this.linkB = mfs3.budget.LinkBudget(lonS,altS,0);
            % Beam radius on Earth's surface
            this.radius = radius;
            % Beam cell axial tilt
            this.tilt = tilt;
            % Satellite beamwidth
            this.thetaB = thetaB;

            % Coordinate grid table
            names = {'Lat','Lon','El','Range'};
            this.tblGrid = sortrows(tblGrid(:,names),{'Lon','Lat'});
            % User beam information table
            names = {'Number','Lat','Lon','Frequency'};
            this.tblBeams = sortrows(tblBeams(:,names),'Number');

            % Enable figure
            set(this.hF,'Visible','on')
        end
    end

    methods (Access = protected)
        % Protected method signatures
        initUI(this,name)
        resizeUI(this,source,eventData)
    end

    methods (Access = protected)
        % Private method signatures
        popupCallback(this,source,eventData)
        buttonCallback(this,source,eventData)
    end

end


text: export { ChartArea20 as default } from "../../";


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;

namespace TMDbLib.Utilities
{
    internal static class EnumMemberCache
    {
        private static readonly Dictionary<Type, Dictionary<object, string>> MemberCache;

        static EnumMemberCache()
        {
            MemberCache = new Dictionary<Type, Dictionary<object, string>>();
        }

        private static Dictionary<object, string> GetOrPrepareCache(Type type)
        {
            if (!type.GetTypeInfo().IsEnum)
                throw new ArgumentException();

            Dictionary<object, string> cache;
            lock (MemberCache)
            {
                if (MemberCache.TryGetValue(type, out cache))
                    return cache;
            }

            cache = new Dictionary<object, string>();

            foreach (FieldInfo fieldInfo in type.GetTypeInfo().DeclaredMembers.OfType<FieldInfo>().Where(s => s.IsStatic))
            {
                object value = fieldInfo.GetValue(null);
                CustomAttributeData attrib = fieldInfo.CustomAttributes.FirstOrDefault(s => s.AttributeType == typeof(EnumValueAttribute));

                if (attrib == null)
                {
                    cache[value] = value.ToString();
                }
                else
                {
                    CustomAttributeTypedArgument arg = attrib.ConstructorArguments.FirstOrDefault();
                    string enumValue = arg.Value as string;

                    cache[value] = enumValue;
                }
            }

            lock (MemberCache)
                MemberCache[type] = cache;

            return cache;
        }

        public static T GetValue<T>(string input)
        {
            Type valueType = typeof(T);
            Dictionary<object, string> cache = GetOrPrepareCache(valueType);

            foreach (KeyValuePair<object, string> pair in cache)
            {
                if (StringComparer.OrdinalIgnoreCase.Equals(pair.Value, input))
                {
                    return (T)pair.Key;
                }
            }

            return default;
        }

        public static object GetValue(string input, Type type)
        {
            Dictionary<object, string> cache = GetOrPrepareCache(type);

            foreach (KeyValuePair<object, string> pair in cache)
            {
                if (StringComparer.OrdinalIgnoreCase.Equals(pair.Value, input))
                {
                    return pair.Key;
                }
            }

            return null;
        }

        public static string GetString(object value)
        {
            Type valueType = value.GetType();
            Dictionary<object, string> cache = GetOrPrepareCache(valueType);

            string str;
            cache.TryGetValue(value, out str);

            return str;
        }
    }
}


text:
<!DOCTYPE html>

    <title>××××</title>
    <meta charset="UTF-8">
    <meta http-equiv="Content-Type" content="text/html, charset=UTF-8"/>
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0"/>
    <meta name="apple-mobile-web-app-capable" content="yes"/>
    <meta name="format-detection" content="telephone=no">
    <meta names="apple-mobile-web-app-status-bar-style" content="black-translucent"/>
    <meta name="keywords" content=""/>
    <meta name="description" content=""/>
    <link rel="stylesheet" href="" type="text/css">

    <canvas id="clock" width="200" height="200"></canvas>

        <canvas id="bezier" width="200" height="200"></canvas>
        <canvas id="yaxis" width="20" height="210"></canvas>
        <canvas id="xaxis" width="210" height="20"></canvas>

Usage

CSS

transition-timing-function: cubic-bezier();

JavaScript with KeySpline

var k = new KeySpline();  ...
                k.get(time);

        Read the
            article -
        Gist


text:
package org.bit.conn;

import java.sql.SQLException;
import java.util.HashMap;
import java.util.List;

/**
* CREATE TABLE Spam_Dictionary(
* 		Dict_word TEXT UNIQUE NOT NULL,
* 		Dict_frequency INTEGER UNSIGNED NOT NULL;
* );
*
* CREATE TABLE Normal_Dictionary(
* 		Dict_word TEXT UNIQUE NOT NULL,
* 		Dict_frequency INTEGER UNSIGNED NOT NULL;
* );
* */
public interface DictAccess extends DatabaseAccess{

	enum DictDataIndex{BLANK, INDEX_WORD, INDEX_FREQUENCY };

	public HashMap<String,Integer> query(boolean tag, boolean isInsert, List<String> wordlist) throws SQLException;
	public int delete(boolean tag,List<String> word) throws SQLException;//minus 1 of frequency
	public int insert(boolean tag,List<String> word) throws SQLException;
	public int createTableDict() throws SQLException;

}


text:
class Lilypad
  class Hoptoad
    class Notify

      include Log::Methods

      def initialize(env, exception)
        @exception = exception
        @env = env

        http_start do |http|
          begin
            xml = XML.build *parse
            http.post @uri.path, xml, headers
          rescue Exception => e
          end
        end

        if env && success?
          env['hoptoad.notified'] = true
        end

        Config::Request.reset!
        log :notify, @response
        success?
      end

      private

      class Backtrace < Struct.new(:file, :number, :method)
      end

      def backtrace
        regex = %r{^([^:]+):(\d+)(?::in `([^']+)')?$}
        @exception.backtrace.map do |line|
          _, file, number, method = line.match(regex).to_a
          Backtrace.new file, number, method
        end
      end

      def filter(hash)
        return hash if Config.filters.empty?
        hash.inject({}) do |acc, (key, val)|
          match = Config.filters.any? { |f| key.to_s =~ Regexp.new(f) }
          acc[key] = match ? "[FILTERED]" : val
          acc
        end
      end

      def headers
        {
          'Content-type' => 'text/xml',
          'Accept' => 'text/xml, application/xml'
        }
      end

      def http_start(&block)
        @uri = URI.parse Config.notify_url
        Net::HTTP.start @uri.host, @uri.port do |http|
          http.read_timeout = 5 # seconds
          http.open_timeout = 2 # seconds
          @response = yield http
        end
      end

      def parse
        env = filter ENV.to_hash.merge(@env || {})

        if @env
          request = Rack::Request.new @env
          params = request.params rescue Hash.new
          params = filter params
          request_path = request.script_name + request.path_info
        else
          params = {}
          request_path = 'Internal'
        end

        [ backtrace, env, @exception, params, request_path ]
      end

      def success?
        @response.class.superclass == Net::HTTPSuccess
      end
    end
  end
end


text:
require 'rails_helper'

describe Chief::CountryCode do
  describe '.to_taric' do
    let!(:country_code) { create :country_code}
    let(:example_code) { Forgery(:basic).text }

    it 'maps CHIEF code to Taric' do
      expect(Chief::CountryCode.to_taric(country_code.chief_country_cd)).to eq country_code.country_cd
    end

    it 'is blank if no mapping is found' do
      expect(Chief::CountryCode.to_taric(example_code)).to be_blank
    end
  end
end


text:
/**
 * Module requirements.
 */

var Transport = require('../transport')
  , parser = require('engine.io-parser')
  , debug = require('debug')('engine:polling');

/**
 * Exports the constructor.
 */

module.exports = Polling;

/**
 * HTTP polling constructor.
 *
 * @api public.
 */

function Polling (req) {
  Transport.call(this, req);
}

/**
 * Inherits from Transport.
 *
 * @api public.
 */

Polling.prototype.__proto__ = Transport.prototype;

/**
 * Transport name
 *
 * @api public
 */

Polling.prototype.name = 'polling';

/**
 * Overrides onRequest.
 *
 * @param {http.ServerRequest}
 * @api private
 */

Polling.prototype.onRequest = function (req) {
  var res = req.res;

  if ('GET' == req.method) {
    this.onPollRequest(req, res);
  } else if ('POST' == req.method) {
    this.onDataRequest(req, res);
  } else {
    res.writeHead(500);
    res.end();
  }
};

/**
 * The client sends a request awaiting for us to send data.
 *
 * @api private
 */

Polling.prototype.onPollRequest = function (req, res) {
  if (this.req) {
    debug('request overlap');
    // assert: this.res, '.req and .res should be (un)set together'
    this.onError('overlap from client');
    res.writeHead(500);
    return;
  }

  debug('setting request');

  this.req = req;
  this.res = res;

  var self = this;

  function onClose () {
    self.onError('poll connection closed prematurely');
  }

  function cleanup () {
    req.removeListener('close', onClose);
    self.req = self.res = null;
  }

  req.cleanup = cleanup;
  req.on('close', onClose);

  this.writable = true;
  this.emit('drain');

  // if we're still writable but had a pending close, trigger an empty send
  if (this.writable && this.shouldClose) {
    debug('triggering empty send to append close packet');
    this.send([{ type: 'noop' }]);
  }
};

/**
 * The client sends a request with data.
 *
 * @api private
 */

Polling.prototype.onDataRequest = function (req, res) {
  if (this.dataReq) {
    // assert: this.dataRes, '.dataReq and .dataRes should be (un)set together'
    this.onError('data request overlap from client');
    res.writeHead(500);
    return;
  }

  var isBinary = 'application/octet-stream' == req.headers['content-type'];

  this.dataReq = req;
  this.dataRes = res;

  var chunks = isBinary ? new Buffer(0) : '';
  var self = this;

  function cleanup () {
    chunks = isBinary ? new Buffer(0) : '';
    req.removeListener('data', onData);
    req.removeListener('end', onEnd);
    req.removeListener('close', onClose);
    self.dataReq = self.dataRes = null;
  }

  function onClose () {
    cleanup();
    self.onError('data request connection closed prematurely');
  }

  function onData (data) {
    var contentLength;
    if (typeof data == 'string') {
      chunks += data;
      contentLength = Buffer.byteLength(chunks);
    } else {
      chunks = Buffer.concat([chunks, data]);
      contentLength = chunks.length;
    }

    if (contentLength > self.maxHttpBufferSize) {
      chunks = '';
      req.connection.destroy();
    }
  }

  function onEnd () {
    self.onData(chunks);
    res.writeHead(200, self.headers(req, {
        'Content-Length': 2
        // text/html is required instead of text/plain to avoid an
        // unwanted download dialog on certain user-agents (GH-43)
      , 'Content-Type': 'text/html'
    }));
    res.end('ok');
    cleanup();
  }

  req.abort = cleanup;
  req.on('close', onClose);
  req.on('data', onData);
  req.on('end', onEnd);
  if (!isBinary) req.setEncoding('utf8');
};

/**
 * Processes the incoming data payload.
 *
 * @param {String} encoded payload
 * @api private
 */

Polling.prototype.onData = function (data) {
  debug('received "%s"', data);
  var self = this;
  var callback = function(packet) {
    if ('close' == packet.type) {
      debug('got xhr close packet');
      self.onClose();
      return false;
    }

    self.onPacket(packet);
  };

  parser.decodePayload(data, callback);
};

/**
 * Writes a packet payload.
 *
 * @param {Object} packet
 * @api private
 */

Polling.prototype.send = function (packets) {
  if (this.shouldClose) {
    debug('appending close packet to payload');
    packets.push({ type: 'close' });
    this.shouldClose();
    this.shouldClose = null;
  }

  var self = this;
  parser.encodePayload(packets, this.supportsBinary, function(data) {
    self.write(data);
  });
};

/**
 * Writes data as response to poll request.
 *
 * @param {String} data
 * @api private
 */

Polling.prototype.write = function (data) {
  debug('writing "%s"', data);
  this.doWrite(data);
  this.req.cleanup();
  this.writable = false;
};

/**
 * Closes the transport.
 *
 * @api private
 */

Polling.prototype.doClose = function (fn) {
  debug('closing');

  if (this.dataReq) {
    // FIXME: should we do this?
    debug('aborting ongoing data request');
    this.dataReq.abort();
  }

  if (this.writable) {
    debug('transport writable - closing right away');
    this.send([{ type: 'close' }]);
    fn();
  } else {
    debug('transport not writable - buffering orderly close');
    this.shouldClose = fn;
  }
};


text:
package com.opengamma.web.analytics;

import static org.testng.AssertJUnit.assertEquals;

import java.util.Collections;
import java.util.List;

import org.testng.annotations.Test;

import com.google.common.collect.ImmutableList;
import com.google.common.collect.Lists;
import com.opengamma.util.test.TestGroup;
import com.opengamma.web.analytics.formatting.TypeFormatter;

/**
 * Test.
 */
@Test(groups = TestGroup.UNIT)
public class GridCellTest {

  @Test
  public void testCompareTo() throws Exception {
    List<GridCell> cells = Lists.newArrayList(
        new GridCell(1, 0, TypeFormatter.Format.CELL),
        new GridCell(1, 1, TypeFormatter.Format.EXPANDED),
        new GridCell(2, 1, TypeFormatter.Format.CELL),
        new GridCell(0, 1, TypeFormatter.Format.CELL),
        new GridCell(1, 1, TypeFormatter.Format.CELL),
        new GridCell(0, 3, TypeFormatter.Format.CELL),
        new GridCell(2, 0, TypeFormatter.Format.CELL));
    Collections.sort(cells);
    ImmutableList<GridCell> expected = ImmutableList.of(
        new GridCell(0, 1, TypeFormatter.Format.CELL),
        new GridCell(0, 3, TypeFormatter.Format.CELL),
        new GridCell(1, 0, TypeFormatter.Format.CELL),
        new GridCell(1, 1, TypeFormatter.Format.CELL),
        new GridCell(1, 1, TypeFormatter.Format.EXPANDED),
        new GridCell(2, 0, TypeFormatter.Format.CELL),
        new GridCell(2, 1, TypeFormatter.Format.CELL));
    assertEquals(expected, cells);
  }

  @Test
  public void buildFromString() {
    GridCell fromString = new GridCell("1, 2, CELL");
    assertEquals(new GridCell(1, 2, TypeFormatter.Format.CELL), fromString);
  }
}