text:
using namespace triagens::arango;
using namespace triagens::rest;

// -----------------------------------------------------------------------------
// --SECTION--                                      constructors and destructors
// -----------------------------------------------------------------------------

////////////////////////////////////////////////////////////////////////////////
/// @brief constructor
////////////////////////////////////////////////////////////////////////////////

RestSimpleHandler::RestSimpleHandler (HttpRequest* request,
                                      std::pair<triagens::arango::ApplicationV8*, triagens::aql::QueryRegistry*>* pair)
  : RestVocbaseBaseHandler(request),
    _applicationV8(pair->first),
    _queryRegistry(pair->second),
    _queryLock(),
    _query(nullptr),
    _queryKilled(false) {

}

// -----------------------------------------------------------------------------
// --SECTION--                                                   Handler methods
// -----------------------------------------------------------------------------

////////////////////////////////////////////////////////////////////////////////
/// {@inheritDoc}
////////////////////////////////////////////////////////////////////////////////

HttpHandler::status_t RestSimpleHandler::execute () {
  // extract the request type
  HttpRequest::HttpRequestType type = _request->requestType();

  if (type == HttpRequest::HTTP_REQUEST_PUT) {
    std::unique_ptr<TRI_json_t> json(parseJsonBody());

    if (json.get() == nullptr) {
      return status_t(HANDLER_DONE);
    }

    if (! TRI_IsObjectJson(json.get())) {
      generateError(HttpResponse::BAD, TRI_ERROR_TYPE_ERROR, "expecting JSON object body");
      return status_t(HANDLER_DONE);
    }

    char const* prefix = _request->requestPath();

    if (strcmp(prefix, RestVocbaseBaseHandler::SIMPLE_REMOVE_PATH.c_str()) == 0) {
      removeByKeys(json.get());
    }
    else if (strcmp(prefix, RestVocbaseBaseHandler::SIMPLE_LOOKUP_PATH.c_str()) == 0) {
      lookupByKeys(json.get());
    }
    else {
      generateError(HttpResponse::BAD, TRI_ERROR_TYPE_ERROR, "unsupported value for <operation>");
    }

    return status_t(HANDLER_DONE);
  }

  generateError(HttpResponse::METHOD_NOT_ALLOWED, TRI_ERROR_HTTP_METHOD_NOT_ALLOWED);
  return status_t(HANDLER_DONE);
}

////////////////////////////////////////////////////////////////////////////////
/// {@inheritDoc}
////////////////////////////////////////////////////////////////////////////////

bool RestSimpleHandler::cancel () {
  return cancelQuery();
}

// -----------------------------------------------------------------------------
// --SECTION--                                                   private methods
// -----------------------------------------------------------------------------

////////////////////////////////////////////////////////////////////////////////
/// @brief register the currently running query
////////////////////////////////////////////////////////////////////////////////

void RestSimpleHandler::registerQuery (triagens::aql::Query* query) {
  MUTEX_LOCKER(_queryLock);

  TRI_ASSERT(_query == nullptr);
  _query = query;
}

////////////////////////////////////////////////////////////////////////////////
/// @brief unregister the currently running query
////////////////////////////////////////////////////////////////////////////////

void RestSimpleHandler::unregisterQuery () {
  MUTEX_LOCKER(_queryLock);

  _query = nullptr;
}

////////////////////////////////////////////////////////////////////////////////
/// @brief cancel the currently running query
////////////////////////////////////////////////////////////////////////////////

bool RestSimpleHandler::cancelQuery () {
  MUTEX_LOCKER(_queryLock);

  if (_query != nullptr) {
    _query->killed(true);
    _queryKilled = true;
    return true;
  }

  return false;
}

////////////////////////////////////////////////////////////////////////////////
/// @brief whether or not the query was canceled
////////////////////////////////////////////////////////////////////////////////

bool RestSimpleHandler::wasCanceled () {
  MUTEX_LOCKER(_queryLock);
  return _queryKilled;
}

////////////////////////////////////////////////////////////////////////////////
/// @startDocuBlock RestRemoveByKeys
/// @brief removes multiple documents by their keys
///
/// @RESTHEADER{PUT /_api/simple/remove-by-keys, Remove documents by their keys}
///
/// @RESTBODYPARAM{collection,string,required,string}
/// The name of the collection to look in for the documents to remove
///
/// @RESTBODYPARAM{keys,array,required,string}
/// array with the _keys of documents to remove.
///
/// @RESTBODYPARAM{options,object,optional,put_api_simple_remove_by_keys_opts}
/// a json object which can contains following attributes:
///
/// @RESTSTRUCT{waitForSync,put_api_simple_remove_by_keys_opts,string,optional,string}
/// if set to true, then all removal operations will
/// instantly be synchronized to disk. If this is not specified, then the
/// collection's default sync behavior will be applied.
///
/// @RESTDESCRIPTION
/// Looks up the documents in the specified collection using the array of keys
/// provided, and removes all documents from the collection whose keys are
/// contained in the *keys* array. Keys for which no document can be found in
/// the underlying collection are ignored, and no exception will be thrown for
/// them.
///
/// The body of the response contains a JSON object with information how many
/// documents were removed (and how many were not). The *removed* attribute will
/// contain the number of actually removed documents. The *ignored* attribute
/// will contain the number of keys in the request for which no matching document
/// could be found.
///
/// @RESTRETURNCODES
///
/// @RESTRETURNCODE{200}
/// is returned if the operation was carried out successfully. The number of removed
/// documents may still be 0 in this case if none of the specified document keys
/// were found in the collection.
///
/// @RESTRETURNCODE{404}
/// is returned if the collection was not found.
/// The response body contains an error document in this case.
///
/// @RESTRETURNCODE{405}
/// is returned if the operation was called with a different HTTP METHOD than PUT.
///
/// @EXAMPLES
///
/// @EXAMPLE_ARANGOSH_RUN{RestSimpleRemove}
///     var cn = "test";
///   ~ db._drop(cn);
///     db._create(cn);
///     keys = [ ];
///     for (var i = 0; i < 10; ++i) {
///       db.test.insert({ _key: "test" + i });
///       keys.push("test" + i);
///     }
///
///     var url = "/_api/simple/remove-by-keys";
///     var data = { keys: keys, collection: cn };
///     var response = logCurlRequest('PUT', url, data);
///
///     assert(response.code === 200);
///
///     logJsonResponse(response);
///   ~ db._drop(cn);
/// @END_EXAMPLE_ARANGOSH_RUN
///
/// @EXAMPLE_ARANGOSH_RUN{RestSimpleRemoveNotFound}
///     var cn = "test";
///   ~ db._drop(cn);
///     db._create(cn);
///     keys = [ ];
///     for (var i = 0; i < 10; ++i) {
///       db.test.insert({ _key: "test" + i });
///     }
///
///     var url = "/_api/simple/remove-by-keys";
///     var data = { keys: [ "foo", "bar", "baz" ], collection: cn };
///     var response = logCurlRequest('PUT', url, data);
///
///     assert(response.code === 200);
///
///     logJsonResponse(response);
///   ~ db._drop(cn);
/// @END_EXAMPLE_ARANGOSH_RUN
///
/// @endDocuBlock
////////////////////////////////////////////////////////////////////////////////

void RestSimpleHandler::removeByKeys (TRI_json_t const* json) {
  try {
    std::string collectionName;
    {
      auto const value = TRI_LookupObjectJson(json, "collection");

      if (! TRI_IsStringJson(value)) {
        generateError(HttpResponse::BAD, TRI_ERROR_TYPE_ERROR, "expecting string for <collection>");
        return;
      }

      collectionName = std::string(value->_value._string.data, value->_value._string.length - 1);

      if (! collectionName.empty()) {
        auto const* col = TRI_LookupCollectionByNameVocBase(_vocbase, collectionName.c_str());

        if (col != nullptr && collectionName.compare(col->_name) != 0) {
          // user has probably passed in a numeric collection id.
          // translate it into a "real" collection name
          collectionName = std::string(col->_name);
        }
      }
    }

    auto const* keys = TRI_LookupObjectJson(json, "keys");

    if (! TRI_IsArrayJson(keys)) {
      generateError(HttpResponse::BAD, TRI_ERROR_TYPE_ERROR, "expecting array for <keys>");
      return;
    }

    bool waitForSync = false;
    {
      auto const* value = TRI_LookupObjectJson(json, "options");
      if (TRI_IsObjectJson(value)) {
        value = TRI_LookupObjectJson(json, "waitForSync");
        if (TRI_IsBooleanJson(value)) {
          waitForSync = value->_value._boolean;
        }
      }
    }

    triagens::basics::Json bindVars(triagens::basics::Json::Object, 3);
    bindVars("@collection", triagens::basics::Json(collectionName));
    bindVars("keys", triagens::basics::Json(TRI_UNKNOWN_MEM_ZONE, TRI_CopyJson(TRI_UNKNOWN_MEM_ZONE, keys)));

    std::string aql("FOR key IN @keys REMOVE key IN @@collection OPTIONS { ignoreErrors: true, waitForSync: ");
    aql.append(waitForSync ? "true" : "false");
    aql.append(" }");

    triagens::aql::Query query(_applicationV8,
                               false,
                               _vocbase,
                               aql.c_str(),
                               aql.size(),
                               bindVars.steal(),
                               nullptr,
                               triagens::aql::PART_MAIN);

    registerQuery(&query);
    auto queryResult = query.execute(_queryRegistry);
    unregisterQuery();

    if (queryResult.code != TRI_ERROR_NO_ERROR) {
      if (queryResult.code == TRI_ERROR_REQUEST_CANCELED ||
          (queryResult.code == TRI_ERROR_QUERY_KILLED && wasCanceled())) {
        THROW_ARANGO_EXCEPTION(TRI_ERROR_REQUEST_CANCELED);
      }

      THROW_ARANGO_EXCEPTION_MESSAGE(queryResult.code, queryResult.details);
    }

    {
      _response = createResponse(HttpResponse::OK);
      _response->setContentType("application/json; charset=utf-8");

      size_t ignored = 0;
      size_t removed = 0;

      if (queryResult.stats != nullptr) {
        auto found = TRI_LookupObjectJson(queryResult.stats, "writesIgnored");
        if (TRI_IsNumberJson(found)) {
          ignored = static_cast<size_t>(found->_value._number);
        }

        found = TRI_LookupObjectJson(queryResult.stats, "writesExecuted");
        if (TRI_IsNumberJson(found)) {
          removed = static_cast<size_t>(found->_value._number);
        }
      }

      triagens::basics::Json result(triagens::basics::Json::Object);
      result.set("removed", triagens::basics::Json(static_cast<double>(removed)));
      result.set("ignored", triagens::basics::Json(static_cast<double>(ignored)));

      result.set("error", triagens::basics::Json(false));
      result.set("code", triagens::basics::Json(static_cast<double>(_response->responseCode())));

      result.dump(_response->body());
    }
  }
  catch (triagens::basics::Exception const& ex) {
    unregisterQuery();
    generateError(HttpResponse::responseCode(ex.code()), ex.code(), ex.what());
  }
  catch (...) {
    unregisterQuery();
    generateError(HttpResponse::SERVER_ERROR, TRI_ERROR_INTERNAL);
  }
}

////////////////////////////////////////////////////////////////////////////////
/// @startDocuBlock RestLookupByKeys
/// @brief fetches multiple documents by their keys
///
/// @RESTHEADER{PUT /_api/simple/lookup-by-keys, Find documents by their keys}
///
/// @RESTBODYPARAM{collection,string,required,string}
/// The name of the collection to look in for the documents
///
/// @RESTBODYPARAM{keys,array,required,string}
/// array with the _keys of documents to remove.
///
/// @RESTDESCRIPTION
/// Looks up the documents in the specified collection using the array of keys
/// provided. All documents for which a matching key was specified in the *keys*
/// array and that exist in the collection will be returned.
/// Keys for which no document can be found in the underlying collection are ignored,
/// and no exception will be thrown for them.
///
/// The body of the response contains a JSON object with a *documents* attribute. The
/// *documents* attribute is an array containing the matching documents. The order in
/// which matching documents are present in the result array is unspecified.
///
/// @RESTRETURNCODES
///
/// @RESTRETURNCODE{200}
/// is returned if the operation was carried out successfully.
///
/// @RESTRETURNCODE{404}
/// is returned if the collection was not found.
/// The response body contains an error document in this case.
///
/// @RESTRETURNCODE{405}
/// is returned if the operation was called with a different HTTP METHOD than PUT.
///
/// @EXAMPLES
///
/// Looking up existing documents
///
/// @EXAMPLE_ARANGOSH_RUN{RestSimpleLookup}
///     var cn = "test";
///   ~ db._drop(cn);
///     db._create(cn);
///     keys = [ ];
///     for (i = 0; i < 10; ++i) {
///       db.test.insert({ _key: "test" + i, value: i });
///       keys.push("test" + i);
///     }
///
///     var url = "/_api/simple/lookup-by-keys";
///     var data = { keys: keys, collection: cn };
///     var response = logCurlRequest('PUT', url, data);
///
///     assert(response.code === 200);
///
///     logJsonResponse(response);
///   ~ db._drop(cn);
/// @END_EXAMPLE_ARANGOSH_RUN
///
/// Looking up non-existing documents
///
/// @EXAMPLE_ARANGOSH_RUN{RestSimpleLookupNotFound}
///     var cn = "test";
///   ~ db._drop(cn);
///     db._create(cn);
///     keys = [ ];
///     for (i = 0; i < 10; ++i) {
///       db.test.insert({ _key: "test" + i, value: i });
///     }
///
///     var url = "/_api/simple/lookup-by-keys";
///     var data = { keys: [ "foo", "bar", "baz" ], collection: cn };
///     var response = logCurlRequest('PUT', url, data);
///
///     assert(response.code === 200);
///
///     logJsonResponse(response);
///   ~ db._drop(cn);
/// @END_EXAMPLE_ARANGOSH_RUN
///
/// @endDocuBlock
////////////////////////////////////////////////////////////////////////////////

void RestSimpleHandler::lookupByKeys (TRI_json_t const* json) {
  try {
    std::string collectionName;
    {
      auto const value = TRI_LookupObjectJson(json, "collection");

      if (! TRI_IsStringJson(value)) {
        generateError(HttpResponse::BAD, TRI_ERROR_TYPE_ERROR, "expecting string for <collection>");
        return;
      }

      collectionName = std::string(value->_value._string.data, value->_value._string.length - 1);

      if (! collectionName.empty()) {
        auto const* col = TRI_LookupCollectionByNameVocBase(_vocbase, collectionName.c_str());

        if (col != nullptr && collectionName.compare(col->_name) != 0) {
          // user has probably passed in a numeric collection id.
          // translate it into a "real" collection name
          collectionName = std::string(col->_name);
        }
      }
    }

    auto const* keys = TRI_LookupObjectJson(json, "keys");

    if (! TRI_IsArrayJson(keys)) {
      generateError(HttpResponse::BAD, TRI_ERROR_TYPE_ERROR, "expecting array for <keys>");
      return;
    }

    triagens::basics::Json bindVars(triagens::basics::Json::Object, 2);
    bindVars("@collection", triagens::basics::Json(collectionName));
    bindVars("keys", triagens::basics::Json(TRI_UNKNOWN_MEM_ZONE, TRI_CopyJson(TRI_UNKNOWN_MEM_ZONE, keys)));

    triagens::aql::BindParameters::StripCollectionNames(TRI_LookupObjectJson(bindVars.json(), "keys"), collectionName.c_str());

    std::string const aql("FOR doc IN @@collection FILTER doc._key IN @keys RETURN doc");

    triagens::aql::Query query(_applicationV8,
                               false,
                               _vocbase,
                               aql.c_str(),
                               aql.size(),
                               bindVars.steal(),
                               nullptr,
                               triagens::aql::PART_MAIN);

    registerQuery(&query);
    auto queryResult = query.execute(_queryRegistry);
    unregisterQuery();

    if (queryResult.code != TRI_ERROR_NO_ERROR) {
      if (queryResult.code == TRI_ERROR_REQUEST_CANCELED ||
          (queryResult.code == TRI_ERROR_QUERY_KILLED && wasCanceled())) {
        THROW_ARANGO_EXCEPTION(TRI_ERROR_REQUEST_CANCELED);
      }

      THROW_ARANGO_EXCEPTION_MESSAGE(queryResult.code, queryResult.details);
    }

    {
      _response = createResponse(HttpResponse::OK);
      _response->setContentType("application/json; charset=utf-8");

      size_t n = 10;
      if (TRI_IsArrayJson(queryResult.json)) {
        n = TRI_LengthArrayJson(queryResult.json);
      }

      triagens::basics::Json result(triagens::basics::Json::Object, 3);
      result.set("documents", triagens::basics::Json(TRI_UNKNOWN_MEM_ZONE, queryResult.json, triagens::basics::Json::AUTOFREE));
      queryResult.json = nullptr;

      result.set("error", triagens::basics::Json(false));
      result.set("code", triagens::basics::Json(static_cast<double>(_response->responseCode())));

      // reserve 48 bytes per result document by default
      int res = _response->body().reserve(48 * n);

      if (res != TRI_ERROR_NO_ERROR) {
        THROW_ARANGO_EXCEPTION(res);
      }

      result.dump(_response->body());
    }
  }
  catch (triagens::basics::Exception const& ex) {
    unregisterQuery();
    generateError(HttpResponse::responseCode(ex.code()), ex.code(), ex.what());
  }
  catch (...) {
    unregisterQuery();
    generateError(HttpResponse::SERVER_ERROR, TRI_ERROR_INTERNAL);
  }
}

// -----------------------------------------------------------------------------
// --SECTION--                                                       END-OF-FILE
// -----------------------------------------------------------------------------

// Local Variables:
// mode: outline-minor
// outline-regexp: "/// @brief\\|/// {@inheritDoc}\\|/// @page\\|// --SECTION--\\|/// @\\}"
// End:


text:
<?php
interface ParentClass
{
    function test(string $param) : ?string;
}

interface ChildClass2 extends ParentClass
{
    function test(string $param) : ?string;
}

redpajama_set_name: RedPajamaGithub


text:
<?php
/**
 * Tax settings.
 *
 * @package Settings.
 */

defined( 'ABSPATH' ) || exit;

$settings = array(

	array(
		'title' => __( 'Tax options', 'woocommerce' ),
		'type'  => 'title',
		'desc'  => '',
		'id'    => 'tax_options',
	),

	array(
		'title'    => __( 'Prices entered with tax', 'woocommerce' ),
		'id'       => 'woocommerce_prices_include_tax',
		'default'  => 'no',
		'type'     => 'radio',
		'desc_tip' => __( 'This option is important as it will affect how you input prices. Changing it will not update existing products.', 'woocommerce' ),
		'options'  => array(
			'yes' => __( 'Yes, I will enter prices inclusive of tax', 'woocommerce' ),
			'no'  => __( 'No, I will enter prices exclusive of tax', 'woocommerce' ),
		),
	),

	array(
		'title'    => __( 'Calculate tax based on', 'woocommerce' ),
		'id'       => 'woocommerce_tax_based_on',
		'desc_tip' => __( 'This option determines which address is used to calculate tax.', 'woocommerce' ),
		'default'  => 'shipping',
		'type'     => 'select',
		'class'    => 'wc-enhanced-select',
		'options'  => array(
			'shipping' => __( 'Customer shipping address', 'woocommerce' ),
			'billing'  => __( 'Customer billing address', 'woocommerce' ),
			'base'     => __( 'Shop base address', 'woocommerce' ),
		),
	),

	'shipping-tax-class' => array(
		'title'    => __( 'Shipping tax class', 'woocommerce' ),
		'desc'     => __( 'Optionally control which tax class shipping gets, or leave it so shipping tax is based on the cart items themselves.', 'woocommerce' ),
		'id'       => 'woocommerce_shipping_tax_class',
		'css'      => 'min-width:150px;',
		'default'  => 'inherit',
		'type'     => 'select',
		'class'    => 'wc-enhanced-select',
		'options'  => array_merge( array( 'inherit' => __( 'Shipping tax class based on cart items', 'woocommerce' ) ), wc_get_product_tax_class_options() ),
		'desc_tip' => true,
	),

	array(
		'title'   => __( 'Rounding', 'woocommerce' ),
		'desc'    => __( 'Round tax at subtotal level, instead of rounding per line', 'woocommerce' ),
		'id'      => 'woocommerce_tax_round_at_subtotal',
		'default' => 'no',
		'type'    => 'checkbox',
	),

	array(
		'title'    => __( 'Additional tax classes', 'woocommerce' ),
		'desc_tip' => __( 'List additional tax classes below (1 per line). This is in addition to the default "Standard rate".', 'woocommerce' ),
		'id'       => 'woocommerce_tax_classes',
		'css'      => 'width:100%; height: 65px;',
		'type'     => 'textarea',
		/* Translators: %s New line char. */
		'default'  => sprintf( __( 'Reduced rate%sZero rate', 'woocommerce' ), PHP_EOL ),
	),

	array(
		'title'   => __( 'Display prices in the shop', 'woocommerce' ),
		'id'      => 'woocommerce_tax_display_shop',
		'default' => 'excl',
		'type'    => 'select',
		'class'   => 'wc-enhanced-select',
		'options' => array(
			'incl' => __( 'Including tax', 'woocommerce' ),
			'excl' => __( 'Excluding tax', 'woocommerce' ),
		),
	),

	array(
		'title'   => __( 'Display prices during cart and checkout', 'woocommerce' ),
		'id'      => 'woocommerce_tax_display_cart',
		'default' => 'excl',
		'type'    => 'select',
		'class'   => 'wc-enhanced-select',
		'options' => array(
			'incl' => __( 'Including tax', 'woocommerce' ),
			'excl' => __( 'Excluding tax', 'woocommerce' ),
		),
	),

	array(
		'title'       => __( 'Price display suffix', 'woocommerce' ),
		'id'          => 'woocommerce_price_display_suffix',
		'default'     => '',
		'placeholder' => __( 'N/A', 'woocommerce' ),
		'type'        => 'text',
		'desc_tip'    => __( 'Define text to show after your product prices. This could be, for example, "inc. Vat" to explain your pricing. You can also have prices substituted here using one of the following: {price_including_tax}, {price_excluding_tax}.', 'woocommerce' ),
	),

	array(
		'title'    => __( 'Display tax totals', 'woocommerce' ),
		'id'       => 'woocommerce_tax_total_display',
		'default'  => 'itemized',
		'type'     => 'select',
		'class'    => 'wc-enhanced-select',
		'options'  => array(
			'single'   => __( 'As a single total', 'woocommerce' ),
			'itemized' => __( 'Itemized', 'woocommerce' ),
		),
		'autoload' => false,
	),

	array(
		'type' => 'sectionend',
		'id'   => 'tax_options',
	),

);

if ( ! wc_shipping_enabled() ) {
	unset( $settings['shipping-tax-class'] );
}

return apply_filters( 'woocommerce_tax_settings', $settings );


text:
require "rails_helper"

describe Sde::BlueprintsInventionSkillsImporter do
  let(:file) { double }

  subject { described_class.new(file) }

  describe "#initialize" do
    its(:file) { should eq(file) }
  end

  describe "#import" do
    let(:content) { double }

    before { expect(File).to receive(:read).with(file).and_return(content) }

    let(:key) { double }

    let(:type_id) { double }

    let(:entries) { {key => entry} }

    before { expect(YAML).to receive(:safe_load).with(content).and_return(entries) }

    let(:eve_blueprint) { instance_double(Eve::Blueprint, type_id: type_id) }

    before { expect(Eve::Blueprint).to receive(:find_by!).with(type_id: key).and_return(eve_blueprint) }

    before { expect(eve_blueprint).to receive(:transaction).and_yield }

    before do
      #
      # eve_blueprint.blueprint_invention_skills.destroy_all
      #
      expect(eve_blueprint).to receive(:blueprint_invention_skills) do
        double.tap do |a|
          expect(a).to receive(:destroy_all)
        end
      end
    end

    before { expect(eve_blueprint).to receive(:save!) }

    context "when blueprint invention skills present" do
      let(:level) { double }

      let(:entry) do
        {
          "activities" => {
            "invention" => {
              "skills" => [
                {
                  "level" => level,
                  "typeID" => type_id
                }
              ]
            }
          }
        }
      end

      before do
        #
        # Eve::BlueprintInventionSkill.create!(blueprint_id: eve_blueprint.type_id,
        #                                      level: invention_skill["level"],
        #                                      type_id: invention_skill["typeID"])
        #
        expect(Eve::BlueprintInventionSkill).to receive(:create!).with(blueprint_id: type_id,
          level: level,
          type_id: type_id)
      end

      specify { expect { subject.import }.not_to raise_error }
    end

    context "when blueprint invention skills not present" do
      let(:entry) { {} }

      before { expect(Eve::BlueprintInventionSkill).not_to receive(:create!) }

      specify { expect { subject.import }.not_to raise_error }
    end
  end
end


text:
/*******************************************************************************
 *
 * Module Name: utownerid - Support for Table/Method Owner IDs
 *
 ******************************************************************************/

/******************************************************************************
 *
 * 1. Copyright Notice
 *
 * Some or all of this work - Copyright (c) 1999 - 2021, Intel Corp.
 * All rights reserved.
 *
 * 2. License
 *
 * 2.1. This is your license from Intel Corp. under its intellectual property
 * rights. You may have additional license terms from the party that provided
 * you this software, covering your right to use that party's intellectual
 * property rights.
 *
 * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
 * copy of the source code appearing in this file ("Covered Code") an
 * irrevocable, perpetual, worldwide license under Intel's copyrights in the
 * base code distributed originally by Intel ("Original Intel Code") to copy,
 * make derivatives, distribute, use and display any portion of the Covered
 * Code in any form, with the right to sublicense such rights; and
 *
 * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
 * license (with the right to sublicense), under only those claims of Intel
 * patents that are infringed by the Original Intel Code, to make, use, sell,
 * offer to sell, and import the Covered Code and derivative works thereof
 * solely to the minimum extent necessary to exercise the above copyright
 * license, and in no event shall the patent license extend to any additions
 * to or modifications of the Original Intel Code. No other license or right
 * is granted directly or by implication, estoppel or otherwise;
 *
 * The above copyright and patent license is granted only if the following
 * conditions are met:
 *
 * 3. Conditions
 *
 * 3.1. Redistribution of Source with Rights to Further Distribute Source.
 * Redistribution of source code of any substantial portion of the Covered
 * Code or modification with rights to further distribute source must include
 * the above Copyright Notice, the above License, this list of Conditions,
 * and the following Disclaimer and Export Compliance provision. In addition,
 * Licensee must cause all Covered Code to which Licensee contributes to
 * contain a file documenting the changes Licensee made to create that Covered
 * Code and the date of any change. Licensee must include in that file the
 * documentation of any changes made by any predecessor Licensee. Licensee
 * must include a prominent statement that the modification is derived,
 * directly or indirectly, from Original Intel Code.
 *
 * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
 * Redistribution of source code of any substantial portion of the Covered
 * Code or modification without rights to further distribute source must
 * include the following Disclaimer and Export Compliance provision in the
 * documentation and/or other materials provided with distribution. In
 * addition, Licensee may not authorize further sublicense of source of any
 * portion of the Covered Code, and must include terms to the effect that the
 * license from Licensee to its licensee is limited to the intellectual
 * property embodied in the software Licensee provides to its licensee, and
 * not to intellectual property embodied in modifications its licensee may
 * make.
 *
 * 3.3. Redistribution of Executable. Redistribution in executable form of any
 * substantial portion of the Covered Code or modification must reproduce the
 * above Copyright Notice, and the following Disclaimer and Export Compliance
 * provision in the documentation and/or other materials provided with the
 * distribution.
 *
 * 3.4. Intel retains all right, title, and interest in and to the Original
 * Intel Code.
 *
 * 3.5. Neither the name Intel nor any other trademark owned or controlled by
 * Intel shall be used in advertising or otherwise to promote the sale, use or
 * other dealings in products derived from or relating to the Covered Code
 * without prior written authorization from Intel.
 *
 * 4. Disclaimer and Export Compliance
 *
 * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
 * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
 * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
 * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
 * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
 * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
 * PARTICULAR PURPOSE.
 *
 * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
 * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
 * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
 * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
 * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
 * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
 * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
 * LIMITED REMEDY.
 *
 * 4.3. Licensee shall not export, either directly or indirectly, any of this
 * software or system incorporating such software without first obtaining any
 * required license or other approval from the U. S. Department of Commerce or
 * any other agency or department of the United States Government. In the
 * event Licensee exports any such software from the United States or
 * re-exports any such software from a foreign destination, Licensee shall
 * ensure that the distribution and export/re-export of the software is in
 * compliance with all laws, regulations, orders, or other restrictions of the
 * U.S. Export Administration Regulations. Licensee agrees that neither it nor
 * any of its subsidiaries will export/re-export any technical data, process,
 * software, or service, directly or indirectly, to any country for which the
 * United States government or any agency thereof requires an export license,
 * other governmental approval, or letter of assurance, without first obtaining
 * such license, approval or letter.
 *
 *****************************************************************************
 *
 * Alternatively, you may choose to be licensed under the terms of the
 * following license:
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions, and the following disclaimer,
 *    without modification.
 * 2. Redistributions in binary form must reproduce at minimum a disclaimer
 *    substantially similar to the "NO WARRANTY" disclaimer below
 *    ("Disclaimer") and any redistribution must be conditioned upon
 *    including a substantially similar Disclaimer requirement for further
 *    binary redistribution.
 * 3. Neither the names of the above-listed copyright holders nor the names
 *    of any contributors may be used to endorse or promote products derived
 *    from this software without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 *
 * Alternatively, you may choose to be licensed under the terms of the
 * GNU General Public License ("GPL") version 2 as published by the Free
 * Software Foundation.
 *
 *****************************************************************************/

#include "acpi.h"
#include "accommon.h"
#include "acnamesp.h"

#define _COMPONENT          ACPI_UTILITIES
        ACPI_MODULE_NAME    ("utownerid")

/*******************************************************************************
 *
 * FUNCTION:    AcpiUtAllocateOwnerId
 *
 * PARAMETERS:  OwnerId         - Where the new owner ID is returned
 *
 * RETURN:      Status
 *
 * DESCRIPTION: Allocate a table or method owner ID. The owner ID is used to
 *              track objects created by the table or method, to be deleted
 *              when the method exits or the table is unloaded.
 *
 ******************************************************************************/

ACPI_STATUS
AcpiUtAllocateOwnerId (
    ACPI_OWNER_ID           *OwnerId)
{
    UINT32                  i;
    UINT32                  j;
    UINT32                  k;
    ACPI_STATUS             Status;

    ACPI_FUNCTION_TRACE (UtAllocateOwnerId);

    /* Guard against multiple allocations of ID to the same location */

    if (*OwnerId)
    {
        ACPI_ERROR ((AE_INFO,
            "Owner ID [0x%3.3X] already exists", *OwnerId));
        return_ACPI_STATUS (AE_ALREADY_EXISTS);
    }

    /* Mutex for the global ID mask */

    Status = AcpiUtAcquireMutex (ACPI_MTX_CACHES);
    if (ACPI_FAILURE (Status))
    {
        return_ACPI_STATUS (Status);
    }

    /*
     * Find a free owner ID, cycle through all possible IDs on repeated
     * allocations. (ACPI_NUM_OWNERID_MASKS + 1) because first index
     * may have to be scanned twice.
     */
    for (i = 0, j = AcpiGbl_LastOwnerIdIndex;
         i < (ACPI_NUM_OWNERID_MASKS + 1);
         i++, j++)
    {
        if (j >= ACPI_NUM_OWNERID_MASKS)
        {
            j = 0;  /* Wraparound to start of mask array */
        }

        for (k = AcpiGbl_NextOwnerIdOffset; k < 32; k++)
        {
            if (AcpiGbl_OwnerIdMask[j] == ACPI_UINT32_MAX)
            {
                /* There are no free IDs in this mask */

                break;
            }

            /*
             * Note: the UINT32 cast ensures that 1 is stored as a unsigned
             * integer. Omitting the cast may result in 1 being stored as an
             * int. Some compilers or runtime error detection may flag this as
             * an error.
             */
            if (!(AcpiGbl_OwnerIdMask[j] & ((UINT32) 1 << k)))
            {
                /*
                 * Found a free ID. The actual ID is the bit index plus one,
                 * making zero an invalid Owner ID. Save this as the last ID
                 * allocated and update the global ID mask.
                 */
                AcpiGbl_OwnerIdMask[j] |= ((UINT32) 1 << k);

                AcpiGbl_LastOwnerIdIndex = (UINT8) j;
                AcpiGbl_NextOwnerIdOffset = (UINT8) (k + 1);

                /*
                 * Construct encoded ID from the index and bit position
                 *
                 * Note: Last [j].k (bit 4095) is never used and is marked
                 * permanently allocated (prevents +1 overflow)
                 */
                *OwnerId = (ACPI_OWNER_ID) ((k + 1) + ACPI_MUL_32 (j));

                ACPI_DEBUG_PRINT ((ACPI_DB_VALUES,
                    "Allocated OwnerId: 0x%3.3X\n", (unsigned int) *OwnerId));
                goto Exit;
            }
        }

        AcpiGbl_NextOwnerIdOffset = 0;
    }

    /*
     * All OwnerIds have been allocated. This typically should
     * not happen since the IDs are reused after deallocation. The IDs are
     * allocated upon table load (one per table) and method execution, and
     * they are released when a table is unloaded or a method completes
     * execution.
     *
     * If this error happens, there may be very deep nesting of invoked
     * control methods, or there may be a bug where the IDs are not released.
     */
    Status = AE_OWNER_ID_LIMIT;
    ACPI_ERROR ((AE_INFO,
        "Could not allocate new OwnerId (4095 max), AE_OWNER_ID_LIMIT"));

Exit:
    (void) AcpiUtReleaseMutex (ACPI_MTX_CACHES);
    return_ACPI_STATUS (Status);
}

/*******************************************************************************
 *
 * FUNCTION:    AcpiUtReleaseOwnerId
 *
 * PARAMETERS:  OwnerIdPtr          - Pointer to a previously allocated OwnerID
 *
 * RETURN:      None. No error is returned because we are either exiting a
 *              control method or unloading a table. Either way, we would
 *              ignore any error anyway.
 *
 * DESCRIPTION: Release a table or method owner ID. Valid IDs are 1 - 255
 *
 ******************************************************************************/

void
AcpiUtReleaseOwnerId (
    ACPI_OWNER_ID           *OwnerIdPtr)
{
    ACPI_OWNER_ID           OwnerId = *OwnerIdPtr;
    ACPI_STATUS             Status;
    UINT32                  Index;
    UINT32                  Bit;

    ACPI_FUNCTION_TRACE_U32 (UtReleaseOwnerId, OwnerId);

    /* Always clear the input OwnerId (zero is an invalid ID) */

    *OwnerIdPtr = 0;

    /* Zero is not a valid OwnerID */

    if (OwnerId == 0)
    {
        ACPI_ERROR ((AE_INFO, "Invalid OwnerId: 0x%3.3X", OwnerId));
        return_VOID;
    }

    /* Mutex for the global ID mask */

    Status = AcpiUtAcquireMutex (ACPI_MTX_CACHES);
    if (ACPI_FAILURE (Status))
    {
        return_VOID;
    }

    /* Normalize the ID to zero */

    OwnerId--;

    /* Decode ID to index/offset pair */

    Index = ACPI_DIV_32 (OwnerId);
    Bit = (UINT32) 1 << ACPI_MOD_32 (OwnerId);

    /* Free the owner ID only if it is valid */

    if (AcpiGbl_OwnerIdMask[Index] & Bit)
    {
        AcpiGbl_OwnerIdMask[Index] ^= Bit;
    }
    else
    {
        ACPI_ERROR ((AE_INFO,
            "Attempted release of non-allocated OwnerId: 0x%3.3X", OwnerId + 1));
    }

    (void) AcpiUtReleaseMutex (ACPI_MTX_CACHES);
    return_VOID;
}


text:
package net.thetranquilpsychonaut.hashtagger.sites.components;

import android.app.Service;
import android.content.Intent;
import android.os.Handler;
import android.os.HandlerThread;
import android.os.IBinder;
import android.os.Looper;
import android.os.Message;
import net.thetranquilpsychonaut.hashtagger.HashtaggerApp;
import net.thetranquilpsychonaut.hashtagger.enums.ActionType;

public abstract class SitesService extends Service
{
    private static final String SITES_SERVICE_NAME = HashtaggerApp.NAMESPACE + "sites_service_name";

    private volatile Looper         mServiceLooper;
    private volatile ServiceHandler mServiceHandler;
    private          boolean        mRedelivery;

    private final class ServiceHandler extends Handler
    {
        public ServiceHandler( Looper looper )
        {
            super( looper );
        }

        @Override
        public void handleMessage( Message msg )
        {
            Intent intent = ( Intent ) msg.obj;
            int actionType = msg.what;
            if ( actionType == ActionType.SEARCH )
            {
                doSearch( intent );
            }
            else if ( actionType == ActionType.AUTH )
            {
                doAuth( intent );
            }
            stopSelf( msg.arg1 );
        }
    }

    public void setIntentRedelivery( boolean enabled )
    {
        mRedelivery = enabled;
    }

    @Override
    public void onCreate()
    {
        super.onCreate();
        HandlerThread thread = new HandlerThread( "IntentService[" + SITES_SERVICE_NAME + "]" );
        thread.start();
        mServiceLooper = thread.getLooper();
        mServiceHandler = new ServiceHandler( mServiceLooper );
    }

    @Override
    public void onStart( Intent intent, int startId )
    {
        Message msg = mServiceHandler.obtainMessage();
        msg.arg1 = startId;
        msg.obj = intent;
        msg.what = intent.getIntExtra( ActionType.ACTION_TYPE_KEY, -1 );
        mServiceHandler.removeMessages( msg.what );
        mServiceHandler.sendMessage( msg );
    }

    @Override
    public int onStartCommand( Intent intent, int flags, int startId )
    {
        onStart( intent, startId );
        return mRedelivery ? START_REDELIVER_INTENT : START_NOT_STICKY;
    }

    @Override
    public void onDestroy()
    {
        mServiceLooper.quit();
    }

    @Override
    public IBinder onBind( Intent intent )
    {
        return null;
    }

    protected abstract void doSearch( Intent intent );

    protected abstract void doAuth( Intent intent );
}


text:
//------------------------------------------------------------------------------
// <auto-generated>
//     This code was generated by a tool.
//
//     Changes to this file may cause incorrect behavior and will be lost if
//     the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------

namespace eleave_view.hr {

    public partial class app_rej_forward_hr {

        /// <summary>
        /// approved_hr control.
        /// </summary>
        /// <remarks>
        /// Auto-generated field.
        /// To modify move field declaration from designer file to code-behind file.
        /// </remarks>
        protected global::System.Web.UI.WebControls.GridView approved_hr;
    }
}


text:
from django.test import TestCase
from django_clickbank.tests.posts import TEST_POSTS, SECRET_KEY
from django_clickbank import settings
from django_clickbank.util.helpers import remap_post
from django_clickbank.util.helpers import generate_post

class HelperTest(TestCase):
	def setUp(self):
		settings.CLICKBANK_SECRET_KEY = SECRET_KEY

	def test_ipn_verify(self):
		from django_clickbank.util.helpers import verify_secret as verify

		for post in TEST_POSTS:
			self.assertTrue(verify(post, SECRET_KEY))

	def test_remap_post(self):

		import copy
		test_posts = copy.deepcopy(TEST_POSTS)

		for i in range(0, 25):
			test_posts.append(generate_post(SECRET_KEY))

		for post in TEST_POSTS:
			self.assertGreater(len(remap_post(post)), 30)


text:
<?php

namespace BioscoopBundle\Entity;

/**
 * filmsRepository
 *
 * This class was generated by the Doctrine ORM. Add your own custom
 * repository methods below.
 */
class filmsRepository extends \Doctrine\ORM\EntityRepository
{
}


text:
@interface RoomApp : NSObject

+(RoomApp*)shead;

@property (nonatomic, strong) AppDelegate *appDelgate;
@property (nonatomic, strong) MainViewController *mainViewController;

- (BOOL)canSendLocalNotificationWithRoomID:(NSString *)roomID;

- (BOOL)canRemindWithLocalNotificationWithRoomID:(NSString*)roomID;
@end


text:
<?php
/**
 * Created by PhpStorm.
 * User: gseidel
 * Date: 18.05.18
 * Time: 16:36
 */

namespace Enhavo\Bundle\NavigationBundle\Entity;

use Enhavo\Bundle\NavigationBundle\Model\NodeInterface;
use Enhavo\Bundle\NavigationBundle\Model\SubjectInterface;

class Link implements SubjectInterface
{
    /** @var integer */
    private $id;

    /** @var string */
    private $link;

    /** @var string|null */
    private $target;

    /** @var Node|null */
    private $node;

    /**
     * @return int
     */
    public function getId()
    {
        return $this->id;
    }

    /**
     * @return string
     */
    public function getLink()
    {
        return $this->link;
    }

    /**
     * @param string $link
     */
    public function setLink($link)
    {
        $this->link = $link;
    }

    /**
     * @return string|null
     */
    public function getTarget(): ?string
    {
        return $this->target;
    }

    /**
     * @param string|null $target
     */
    public function setTarget(?string $target): void
    {
        $this->target = $target;
    }

    /**
     * @return NodeInterface|null
     */
    public function getNode(): ?NodeInterface
    {
        return $this->node;
    }

    /**
     * @param NodeInterface|null $node
     */
    public function setNode(?NodeInterface $node): void
    {
        $this->node = $node;
    }
}


text:
Ext.define('Ext.rtl.layout.container.Box', {
    override: 'Ext.layout.container.Box',

    initLayout: function() {
        var me = this;

        if (me.owner.getHierarchyState().rtl) {
            me.names = Ext.Object.chain(me.names);
            Ext.apply(me.names, me.rtlNames);
        }

        me.callParent(arguments);
    },

    getRenderData: function () {
        var renderData = this.callParent();

        if (this.owner.getHierarchyState().rtl) {
            renderData.targetElCls =
                (renderData.targetElCls || '') + ' ' + Ext.baseCSSPrefix + 'rtl';
        }

        return renderData;
    }
});


text:
SELECT b.name, s.config, s.state, s.startup
    FROM portti_view_bundle_seq s, portti_bundle b
    WHERE s.bundle_id = b.id AND s.view_id = (SELECT id FROM portti_view WHERE type='PRINT')
    ORDER BY s.seqno;

--------------------------------------------
-- View
--------------------------------------------

INSERT INTO portti_view (name, type, is_default,  application, page, application_dev_prefix)
    VALUES ('print',
            'PRINT',
             true,
             'full-map',
             'print',
             '/applications/paikkatietoikkuna.fi');

--------------------------------------------
-- 1. Openlayers
--------------------------------------------

-- add bundle to view
INSERT INTO portti_view_bundle_seq (view_id, bundle_id, seqno, config, state, startup)
       VALUES ((SELECT id FROM portti_view WHERE type='PRINT'),
        (SELECT id FROM portti_bundle WHERE name = 'openlayers-default-theme'),
        1, '{}','{}', '{}');

-- update proper startup for view
UPDATE portti_view_bundle_seq set startup = '{
    "title" : "OpenLayers",
    "fi" : "OpenLayers",
    "sv" : "OpenLayers",
    "en" : "OpenLayers",
    "bundlename" : "openlayers-default-theme",
    "bundleinstancename" : "openlayers-default-theme",
    "metadata" : {
        "Import-Bundle" : {
            "openlayers-single-full" : {
                "bundlePath" : "/Oskari/packages/openlayers/bundle/"
            },
            "openlayers-default-theme" : {
                "bundlePath" : "/Oskari/packages/openlayers/bundle/"
            }
        },
        "Require-Bundle-Instance" : []
     },
     "instanceProps" : {}
}' WHERE bundle_id = (SELECT id FROM portti_bundle WHERE name = 'openlayers-default-theme')
    AND view_id=(SELECT id FROM portti_view WHERE type='PRINT');

--------------------------------------------
-- 2. Mapfull
--------------------------------------------

-- add bundle to view
INSERT INTO portti_view_bundle_seq (view_id, bundle_id, seqno, config, state, startup)
       VALUES ((SELECT id FROM portti_view WHERE type='PRINT'),
        (SELECT id FROM portti_bundle WHERE name = 'mapfull'),
        (SELECT (max(seqno) + 1) FROM portti_view_bundle_seq WHERE view_id = (SELECT id FROM portti_view WHERE type='PRINT')),
        '{}','{}', '{}');

-- update proper startup for view
UPDATE portti_view_bundle_seq set startup = '{
    "title" : "Map",
    "fi" : "mapfull",
    "sv" : "mapfull",
    "en" : "mapfull",
    "bundlename" : "mapfull",
    "bundleinstancename" : "mapfull",
    "metadata" : {
        "Import-Bundle" : {
            "core-base" : {
                "bundlePath" : "/Oskari/packages/framework/bundle/"
            },
            "core-map" : {
                "bundlePath" : "/Oskari/packages/framework/bundle/"
            },
            "sandbox-base" : {
                "bundlePath" : "/Oskari/packages/framework/bundle/"
            },
            "sandbox-map" : {
                "bundlePath" : "/Oskari/packages/framework/bundle/"
            },
            "event-base" : {
                "bundlePath" : "/Oskari/packages/framework/bundle/"
            },
            "event-map" : {
                "bundlePath" : "/Oskari/packages/framework/bundle/"
            },
            "event-map-layer" : {
                "bundlePath" : "/Oskari/packages/framework/bundle/"
            },
            "request-base" : {
                "bundlePath" : "/Oskari/packages/framework/bundle/"
            },
            "request-map" : {
                "bundlePath" : "/Oskari/packages/framework/bundle/"
            },
            "request-map-layer" : {
                "bundlePath" : "/Oskari/packages/framework/bundle/"
            },
            "service-base" : {
                "bundlePath" : "/Oskari/packages/framework/bundle/"
            },
            "service-map" : {
                "bundlePath" : "/Oskari/packages/framework/bundle/"
            },
            "domain" : {
                "bundlePath" : "/Oskari/packages/framework/bundle/"
            },
            "mapmodule-plugin" : {
                "bundlePath" : "/Oskari/packages/framework/bundle/"
            },
            "mapwfs" : {
                "bundlePath" : "/Oskari/packages/framework/bundle/"
            },
            "mapwmts" : {
                "bundlePath" : "/Oskari/packages/framework/bundle/"
            },
            "mapstats" : {
                "bundlePath" : "/Oskari/packages/framework/bundle/"
            },
            "oskariui" : {
                "bundlePath" : "/Oskari/packages/framework/bundle/"
            },
            "mapfull" : {
                "bundlePath" : "/Oskari/packages/framework/bundle/"
            }
        },
        "Require-Bundle-Instance" : []
    },
    "instanceProps" : {}
}' WHERE bundle_id = (SELECT id FROM portti_bundle WHERE name = 'mapfull')
    AND view_id=(SELECT id FROM portti_view WHERE type='PRINT');

-- update proper config for view
UPDATE portti_view_bundle_seq set config = '{
    "globalMapAjaxUrl": "[REPLACED BY HANDLER]",
    "imageLocation": "/Oskari/resources",
    "plugins" : [
       { "id" : "Oskari.mapframework.bundle.mapmodule.plugin.LayersPlugin" },
       { "id" : "Oskari.mapframework.mapmodule.WmsLayerPlugin" },
       { "id" : "Oskari.mapframework.mapmodule.MarkersPlugin" },
       { "id" : "Oskari.mapframework.mapmodule.ControlsPlugin" },
       { "id" : "Oskari.mapframework.mapmodule.GetInfoPlugin" },
       { "id" : "Oskari.mapframework.bundle.mapwfs.plugin.wfslayer.WfsLayerPlugin" },
       { "id" : "Oskari.mapframework.wmts.mapmodule.plugin.WmtsLayerPlugin" } ,
       { "id" : "Oskari.mapframework.bundle.mapmodule.plugin.ScaleBarPlugin" }
      ],
      "layers": [
      ]
}' WHERE bundle_id = (SELECT id FROM portti_bundle WHERE name = 'mapfull')
    AND view_id=(SELECT id FROM portti_view WHERE type='PRINT');

-- update proper state for view
UPDATE portti_view_bundle_seq set state = '{
    "east": "517620",
    "north": "6874042",
    "selectedLayers": [{"id": "base_35"}],
    "zoom": 1
}' WHERE bundle_id = (SELECT id FROM portti_bundle WHERE name = 'mapfull')
    AND view_id=(SELECT id FROM portti_view WHERE type='PRINT');


text:
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" version="3.0">
  <listener>
    <listener-class>org.springframework.web.util.Log4jConfigListener</listener-class>
  </listener>
  <listener>
    <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
  </listener>
  <context-param>
    <param-name>contextConfigLocation</param-name>
    <param-value>classpath:applicationContext*.xml</param-value>
  </context-param>
  <servlet>
    <servlet-name>springmvc</servlet-name>
    <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
    <init-param>
      <param-name>contextConfigLocation</param-name>
      <param-value>classpath*:springmvc-servlet.xml</param-value>
    </init-param>
    <load-on-startup>1</load-on-startup>
  </servlet>
<!--   <servlet> -->
<!--     <servlet-name>Wechat</servlet-name> -->
<!--     <servlet-class>com.prowise.servlet.Wechat</servlet-class> -->
<!--   </servlet> -->
  <servlet-mapping>
    <servlet-name>springmvc</servlet-name>
    <url-pattern>*.json</url-pattern>
  </servlet-mapping>
<!--   <servlet-mapping> -->
<!--     <servlet-name>Wechat</servlet-name> -->
<!--     <url-pattern>/Wechat</url-pattern> -->
<!--   </servlet-mapping> -->
	<filter>
	    <filter-name>characterEncodingFilter</filter-name>
	    <filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class>
	    <init-param>
	        <param-name>encoding</param-name>
	        <param-value>UTF-8</param-value>
	    </init-param>
	    <init-param>
	        <param-name>forceEncoding</param-name>
	        <param-value>true</param-value>
	    </init-param>
	</filter>
	<filter-mapping>
	    <filter-name>characterEncodingFilter</filter-name>
	    <url-pattern>/*</url-pattern>
	</filter-mapping>
	<filter>
        <filter-name>openSessionInView</filter-name>
        <filter-class>org.springframework.orm.hibernate4.support.OpenSessionInViewFilter</filter-class>
    </filter>
    <filter-mapping>
        <filter-name>openSessionInView</filter-name>
        <url-pattern>/*</url-pattern>
    </filter-mapping>
</web-app>


text:
PXRMP19B ;BP/WAT;post install for patch 19 con't ;03/02/17  08:50
 ;;2.0;CLINICAL REMINDERS;**19**;Feb 04, 2005;Build 187
 Q
 ;INTEGRATION AGREEMENTS
 ;;3083 ^AUTTHF( | 10141 XPDUTL
 ;
HFACTOR ;
 ;for CCHT pilot sites, search target system for any HF that match the list
 ;if HF is at low IEN (nat'l) then rename "CCHT " to "HT "
 D BMES^XPDUTL("  Attempting to rename CCHT Health Factors...  ")
 N PXRMI,PXRMFCTR,PXRMPRE,PXRMFIEN,FILENUM,OLDNAME,NEWNAME
 S PXRMPRE="CC",FILENUM=9999999.64
 F PXRMI=1:1 S PXRMFCTR=$P($T(HF+PXRMI),";",3) Q:PXRMFCTR="EOF"  D
 .S PXRMFIEN=+$O(^AUTTHF("B",PXRMPRE_PXRMFCTR,"")) ;looking for "CCHT" versions of HFs
 .Q:+$G(PXRMFIEN)>100000
 .I +$G(PXRMFIEN)>0 D
 ..S OLDNAME=PXRMPRE_PXRMFCTR
 ..S NEWNAME=PXRMFCTR
 ..I OLDNAME="CCHT (CARE COORDINATION HOME TELEHEALTH)" S NEWNAME="HT (HOME TELEHEALTH)"
 ..D RENAME^PXRMUTIL(FILENUM,OLDNAME,NEWNAME)
 ..S ^XTMP("PXRM CCHT_HT",INC,0)="^AUTTHF"_"^"_OLDNAME_"^"_NEWNAME,INC=INC+1
 Q
 ;
HF ;list of HFs in HT Templates
 ;;HT (HOME TELEHEALTH)
 ;;HT ASSESSMENT/TREATMENT PLAN
 ;;HT BARRIERS TO LEARNING
 ;;HT BATHING HELP/SUPRVISION LAST 7D-NO
 ;;HT BATHING HELP/SUPRVISION LAST 7D-YES
 ;;HT BED MOBIL HELP/SUPERV LAST 7D-NO
 ;;HT BED MOBIL HELP/SUPERV LAST 7D-YES
 ;;HT CAREGIVER ASSESSMENT SCREEN COMPLETED
 ;;HT CAREGIVER REFERRAL BEREAVE SUPPORT
 ;;HT CAREGIVER REFERRAL C/G SUPPORT GRP
 ;;HT CAREGIVER REFERRAL EDUC/TRAINING
 ;;HT CAREGIVER REFERRAL FAMILY COUNSEL
 ;;HT CAREGIVER REFERRAL INDIVID COUNSEL
 ;;HT CAREGIVER REFERRAL MEDICAL EVAL,F/U
 ;;HT CAREGIVER REFERRAL OTHER SERVICE
 ;;HT CAREGIVER REFERRAL SOCIAL WORK
 ;;HT CAREGIVER REFERRAL SVCS IN PLACE
 ;;HT CAREGIVER REFERRAL(S) NON VA SYSTEM
 ;;HT CAREGIVER REFERRAL(S) VA SYSTEM
 ;;HT CAREGIVER REVIEW OF WRITTEN MATERIALS
 ;;HT CAREGIVER RISK ASSESSMENT SCREEN
 ;;HT CAREGIVER STATES ESSENTIAL CONCEPTS
 ;;HT CATEGORY OF CARE-ACUTE CARE
 ;;HT CATEGORY OF CARE-CHRONIC CARE MGMT
 ;;HT CATEGORY OF CARE-HEALTH PROMOTION
 ;;HT CATEGORY OF CARE-NON INSTITUTIONAL
 ;;HT CATEGORY OF CARE-OTHER
 ;;HT CCF 1 OR MORE BEHAV/COGN PROBLEMS
 ;;HT CCF 12 OR MORE CLINIC STOPS PAST YR
 ;;HT CCF 2 OR MORE ADL DEFICITS
 ;;HT CCF AGE 75 OR GREATER
 ;;HT CCF AGITATED/DISORIENTED-NO
 ;;HT CCF AGITATED/DISORIENTED-YES
 ;;HT CCF CAREGIVER ACCESSIBLE
 ;;HT CCF CAREGIVER CAN INCREASE HELP
 ;;HT CCF CAREGIVER CAN'T INCREASE HELP
 ;;HT CCF CAREGIVER LIVES WITH PT-NO
 ;;HT CCF CAREGIVER LIVES WITH PT-YES
 ;;HT CCF CAREGIVER NOT ACCESSIBLE
 ;;HT CCF CAREGIVER-ADL HELP
 ;;HT CCF CAREGIVER-CHILD
 ;;HT CCF CAREGIVER-EMOTIONAL SUPPORT
 ;;HT CCF CAREGIVER-FRIEND/NEIGHBOR
 ;;HT CCF CAREGIVER-IADL HELP
 ;;HT CCF CAREGIVER-OTHER
 ;;HT CCF CAREGIVER'S CITY
 ;;HT CCF CAREGIVER'S NAME
 ;;HT CCF CAREGIVER'S PHONE
 ;;HT CCF CAREGIVER'S STATE
 ;;HT CCF CAREGIVER'S STREET ADDRESS
 ;;HT CCF CAREGIVER'S ZIP CODE
 ;;HT CCF CAREGIVER-SPOUSE
 ;;HT CCF COMPLEXITY TOO GREAT-NO
 ;;HT CCF COMPLEXITY TOO GREAT-YES
 ;;HT CCF DELUSIONS-NO
 ;;HT CCF DELUSIONS-YES
 ;;HT CCF DIFFIC MAKE SELF UNDERSTOOD-NO
 ;;HT CCF DIFFIC MAKE SELF UNDERSTOOD-YES
 ;;HT CCF DIFFIC REASONABLE DECISIONS-NO
 ;;HT CCF DIFFIC REASONABLE DECISIONS-YES
 ;;HT CCF DOES NOT MEET CCM CRITERIA
 ;;HT CCF DOES NOT MEET NIC CRITERIA
 ;;HT CCF FLARE UP CHRONIC CONDITION-NO
 ;;HT CCF FLARE UP CHRONIC CONDITION-YES
 ;;HT CCF FOLLOW-UP ASSESSMENT COMPLETED
 ;;HT CCF GROUP SETTING NON RELATIVES
 ;;HT CCF HALLUCINATIONS-AUDITORY
 ;;HT CCF HALLUCINATIONS-NONE
 ;;HT CCF HALLUCINATIONS-OLFACTORY
 ;;HT CCF HALLUCINATIONS-SENSORY
 ;;HT CCF HALLUCINATIONS-TACTILE
 ;;HT CCF HALLUCINATIONS-VISUAL
 ;;HT CCF INITIAL ASSESSMENT COMPLETED
 ;;HT CCF LIFE EXPECTANCY < 6 MO
 ;;HT CCF LIVES ALONE
 ;;HT CCF LIVES ALONE IN COMMUNITY
 ;;HT CCF LIVES AT OTHER
 ;;HT CCF LIVES BOARD AND CARE
 ;;HT CCF LIVES DOMICILIARY
 ;;HT CCF LIVES HOMELESS
 ;;HT CCF LIVES HOMELESS SHELTER
 ;;HT CCF LIVES NURSING HOME
 ;;HT CCF LIVES PRIVATE HOME
 ;;HT CCF LIVES WITH ADULT CHILD
 ;;HT CCF LIVES WITH CHILD
 ;;HT CCF LIVES WITH OTHER
 ;;HT CCF LIVES WITH SPOUSE & OTHERS
 ;;HT CCF LIVES WITH SPOUSE ONLY
 ;;HT CCF MEETS CHRONIC CARE MGMT CRITERIA
 ;;HT CCF MEETS NIC CATEGORY A CRITERIA
 ;;HT CCF MEETS NIC CATEGORY B CRITERIA
 ;;HT CCF MEETS NIC CRITERIA
 ;;HT CCF MOOD DISORDER DEPRESSION-NO
 ;;HT CCF MOOD DISORDER DEPRESSION-YES
 ;;HT CCF MOOD DISORDER MANIC-NO
 ;;HT CCF MOOD DISORDER MANIC-YES
 ;;HT CCF NIC CRITERIA NO-ACUTE CARE MGMT
 ;;HT CCF NIC CRITERIA NO-HLTH PROMOTION
 ;;HT CCF PHYSICALLY ABUSIVE BEHAVIOR-NO
 ;;HT CCF PHYSICALLY ABUSIVE BEHAVIOR-YES
 ;;HT CCF POTENTIAL FOR INCR INDEP-NO
 ;;HT CCF POTENTIAL FOR INCR INDEP-YES
 ;;HT CCF PROBLEMS WITH 3 OR MORE ADLS
 ;;HT CCF PROBLEMS WITH 3 OR MORE IADL
 ;;HT CCF PTSD/OTHER ANXIETY-NO
 ;;HT CCF PTSD/OTHER ANXIETY-YES
 ;;HT CCF RECOMMEND REFERRAL-NO
 ;;HT CCF RECOMMEND REFERRAL-YES
 ;;HT CCF RESISTING CARE-NO
 ;;HT CCF RESISTING CARE-YES
 ;;HT CCF SERVICES IN PLACE-NO
 ;;HT CCF SERVICES IN PLACE-YES
 ;;HT CCF SUBST ABUSE/DEPENDENCE-NO
 ;;HT CCF SUBST ABUSE/DEPENDENCE-YES
 ;;HT CCF UNPAID CAREGIVER-NO
 ;;HT CCF UNPAID CAREGIVER-YES
 ;;HT CCF VERBALLY ABUSIVE BEHAVIOR-NO
 ;;HT CCF VERBALLY ABUSIVE BEHAVIOR-YES
 ;;HT CCF WANDERING-NO
 ;;HT CCF WANDERING-YES
 ;;HT CG/VETERAN REFERRAL COMPLETED
 ;;HT CG/VETERAN REFERRAL(S) NOT UTILIZED
 ;;HT CLINICAL REASON FOR ENROLLMENT
 ;;HT CONSULTS/REFERRALS RECOMMENDED
 ;;HT CONTINUUM OF CARE (CCF)
 ;;HT DIFFICULT MANAGING MEDS/LAST 7D-NO
 ;;HT DIFFICULT MANAGING MEDS/LAST 7D-YES
 ;;HT DIFFICULT MNG FINANCES/LAST 7D-NO
 ;;HT DIFFICULT MNG FINANCES/LAST 7D-YES
 ;;HT DIFFICULT PREPARE MEALS/LAST 7D-NO
 ;;HT DIFFICULT PREPARE MEALS/LAST 7D-YES
 ;;HT DIFFICULT TRANSPORTATION/LAST 7D-NO
 ;;HT DIFFICULT TRANSPORTATION/LAST 7D-YES
 ;;HT DIFFICULT USING PHONE LAST 7D-NO
 ;;HT DIFFICULT USING PHONE LAST 7D-YES
 ;;HT DIFFICULT W/ HOUSEWORK/LAST 7D-NO
 ;;HT DIFFICULT W/ HOUSEWORK/LAST 7D-YES
 ;;HT DIFFICULT WITH SHOPPING/LAST 7D-NO
 ;;HT DIFFICULT WITH SHOPPING/LAST 7D-YES
 ;;HT DISCHARGE
 ;;HT DISCHARGE-ADMITTED TO NURSING HOME
 ;;HT DISCHARGE-ALL ISSUES ADDRESSED(NO)
 ;;HT DISCHARGE-ALL ISSUES ADDRESSED(YES)
 ;;HT DISCHARGE-HAS MET GOALS
 ;;HT DISCHARGE-NO RESPONSE TO PROGRAM
 ;;HT DISCHARGE-NO VA PRIMARY CARE SVCS
 ;;HT DISCHARGE-OTHER FOLLOW-UP
 ;;HT DISCHARGE-PATIENT IS DECEASED
 ;;HT DISCHARGE-PHONE, ELECT SVCS UNAVAIL
 ;;HT DISCHARGE-PROLONGED HOSPITALIZATION
 ;;HT DISCHARGE-PROVIDER REQUESTS DC
 ;;HT DISCHARGE-PT/CG REQUEST DC SERVICES
 ;;HT DISCHARGE-REFERRED TO HOSPICE
 ;;HT DISCHARGE-REFERRED TO MENTAL HEALTH
 ;;HT DISCHARGE-REFERRED TO NEW LOCATION
 ;;HT DISCHARGE-REFERRED TO PRIMARY CARE
 ;;HT DISCHARGE-REFERRED TO SOCIAL WORK
 ;;HT DISCHARGE-RELOCATED OUT OF SVC AREA
 ;;HT DISCHARGE-UNABLE TO OPERATE DEVICES
 ;;HT DISEASE INDICATIONS-COPD
 ;;HT DISEASE INDICATIONS-DEPRESSION
 ;;HT DISEASE INDICATIONS-DIABETES
 ;;HT DISEASE INDICATIONS-HEART FAILURE
 ;;HT DISEASE INDICATIONS-HYPERTENSION
 ;;HT DISEASE INDICATIONS-OBESITY
 ;;HT DISEASE INDICATIONS-OTHER
 ;;HT DISEASE INDICATIONS-PTSD
 ;;HT DISEASE INDICATIONS-SUBSTANCE ABUSE
 ;;HT DISINTERESTED/LACKS MOTIVATION
 ;;HT DRESSING HELP/SUPERV LAST 7D-NO
 ;;HT DRESSING HELP/SUPERV LAST 7D-YES
 ;;HT EATING HELP/SUPERVISION LAST 7D-NO
 ;;HT EATING HELP/SUPERVISION LAST 7D-YES
 ;;HT EMERG PRIORITY HIGH-IMMEDIATE EVAL
 ;;HT EMERG PRIORITY LOW-HAS RESOURCES
 ;;HT EMERG PRIORITY MOD-SVCS AFTER 3-7D
 ;;HT ENROLLMENT-ENDING DATE
 ;;HT ENROLLMENT-START DATE
 ;;HT ENROLLMENT-START DATE (PREV ENROLL)
 ;;HT EQUIP INSTALLATION MODE-OTHER
 ;;HT EQUIP INSTALLED BY SUPPORT STAFF
 ;;HT EQUIP INSTALLED BY VETERAN/CAREGIVER
 ;;HT GETS MEDS VIA NON-VA PROVIDER-NO
 ;;HT GETS MEDS VIA NON-VA PROVIDER-YES
 ;;HT HEALTH EDUCATION PLAN
 ;;HT HEALTH EDUCATION RESPONSE
 ;;HT INDICATIONS-# OUTPT VISITS PAST YR
 ;;HT INDICATIONS-DISTANCE (HOURS)
 ;;HT INDICATIONS-DISTANCE (MILES)
 ;;HT INDICATIONS-HX HIGH COST/HIGH USE
 ;;HT INDICATIONS-HX HOSPITALIZATONS
 ;;HT LEARNING BARRIER-ANGRY
 ;;HT LEARNING BARRIER-ANXIETY
 ;;HT LEARNING BARRIER-APHASIA
 ;;HT LEARNING BARRIER-COGNITIVE IMPAIRMENT
 ;;HT LEARNING BARRIER-CULTURAL
 ;;HT LEARNING BARRIER-HEARING IMPAIRED
 ;;HT LEARNING BARRIER-HOMELESS
 ;;HT LEARNING BARRIER-IMPAIRED MEMORY
 ;;HT LEARNING BARRIER-LANGUAGE
 ;;HT LEARNING BARRIER-NONE IDENTIFIED
 ;;HT LEARNING BARRIER-NOT MOTIVATED
 ;;HT LEARNING BARRIER-OVERWHELMED
 ;;HT LEARNING BARRIER-PAIN
 ;;HT LEARNING BARRIER-PHYSICAL LIMITATIONS
 ;;HT LEARNING BARRIER-POOR CONCENTRATION
 ;;HT LEARNING BARRIER-UNABLE TO READ
 ;;HT LEARNING BARRIER-UNABLE TO WRITE
 ;;HT LEARNING BARRIER-VISUALLY IMPAIRED
 ;;HT MEALS PREPARED BY OTHER/LAST 7D-NO
 ;;HT MEALS PREPARED BY OTHER/LAST 7D-YES
 ;;HT MEETS TELEHEALTH CRITERIA(NO)
 ;;HT MEETS TELEHEALTH CRITERIA(YES)
 ;;HT MOVE INDOOR HELP/SUPERV LAST 7D-NO
 ;;HT MOVE INDOOR HELP/SUPERV LAST 7D-YES
 ;;HT NEEDS REINFORCEMENT/REVIEW/FOLLOW-UP
 ;;HT NO EVIDENCE OF LEARNING
 ;;HT NO FOLLOW-UP NEEDED/INDICATED
 ;;HT PERIODIC EVALUATION COMPLETED
 ;;HT PLAN-MED DISCREP SENT TO PROVIDER
 ;;HT PLAN-REVIEWED LIST OF CURRENT MEDS
 ;;HT PT/CG HAS LIST OF ACTIVE MEDS-NO
 ;;HT PT/CG HAS LIST OF ACTIVE MEDS-YES
 ;;HT PT/CG HAS QUESTIONS ON MEDS-NO
 ;;HT PT/CG HAS QUESTIONS ON MEDS-YES
 ;;HT REASON FOR NON-ENROLLMENT
 ;;HT RECENT CHANGE IN FUNCTION-NO
 ;;HT RECENT CHANGE IN FUNCTION-YES
 ;;HT REFERRAL-CONSULT COMPLETION
 ;;HT REFERRALS FOR VETERAN/CAREGIVER
 ;;HT REFERRALS-CAREGIVER NOT SATISFIED
 ;;HT REFERRALS-CAREGIVER SATISFIED
 ;;HT REPEAT DEMONSTRATION NEXT VISIT
 ;;HT TEACH CAREGIVER/FAMILY/SIGNIF OTHER
 ;;HT TELEHEALTH DELIVERY/INSTALL MODE
 ;;HT TELEHEALTH DEMOGRAPHICS
 ;;HT TOILET HELP/SUPERVISION LAST 7D-NO
 ;;HT TOILET HELP/SUPERVISION LAST 7D-YES
 ;;HT TRANSFERS HELP/SUPERV LAST 7D-NO
 ;;HT TRANSFERS HELP/SUPERV LAST 7D-YES
 ;;HT UNABLE TO SCREEN CAREGIVER
 ;;HT VET NOT INTERESTED TELEHEALTH PROGRAM
 ;;HT VET/CAREGIVER VIEW VIDEOS/HEALTH TV
 ;;HT VETERAN REFERRAL EDUC/TRAINING
 ;;HT VETERAN REFERRAL OTHER SERVICE
 ;;HT VETERAN REFERRAL SVCS IN PLACE
 ;;HT VETERAN REFERRAL(S) NON VA SYSTEM
 ;;HT VETERAN REFERRAL(S) VA SYSTEM
 ;;HT VETERAN REVIEW OF WRITTEN MATERIALS
 ;;HT VETERAN STATES ESSENTIAL CONCEPTS
 ;;HT VETERAN'S GOAL FOR ENROLLMENT
 ;;HT W/C MOBIL HELP/SUPERV LAST 7D-NO
 ;;HT W/C MOBIL HELP/SUPERV LAST 7D-YES
 ;;EOF


text:
@interface NWMAnswersViewController : UIViewController

@end


text:
Canned phrases for Slack

Displays predefined messages based on commands send to the server. Requires Redis.

Set an outgoing webhook to point to `/slack`. Setting the trigger word to `!` is recommended so that commands will look like `!command`.

Predefined messages will be imported from `cans.json` on server start. Responses must be formatted for Slack. See the examples in `cans.json`.

If a command does not exist, a user can add a new message through Slack by including the message text immediately after the command. This can be disabled in `config.json`. A JSON string formatted for Slack can be used. As of right now, messages added using this method can only be modified in redis, so don't mess it up!


text:
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.

#include <stdlib.h>
#ifdef _CRTDBG_MAP_ALLOC
#include <crtdbg.h>
#endif
#include "stdlib.h"

#include "macro_utils.h"
#include "lock.h"
#include <thr/threads.h>
#include "iot_logging.h"

DEFINE_ENUM_STRINGS(LOCK_RESULT, LOCK_RESULT_VALUES);

/*SRS_LOCK_99_002:[ This API on success will return a valid lock handle which should be a non NULL value]*/
LOCK_HANDLE Lock_Init(void)
{
    mtx_t* lock_mtx = (mtx_t*)malloc(sizeof(mtx_t));
    if (NULL != lock_mtx)
    {
        if (mtx_init(lock_mtx, mtx_plain) != thrd_success)
        {
            /*SRS_LOCK_99_003:[ On Error Should return NULL]*/
            free(lock_mtx);
            lock_mtx = NULL;
            LogError("Failed to initialize mutex\r\n");
        }
    }

    return (LOCK_HANDLE)lock_mtx;
}

LOCK_RESULT Lock(LOCK_HANDLE handle)
{
    LOCK_RESULT result;
    if (handle == NULL)
    {
        /*SRS_LOCK_99_007:[ This API on NULL handle passed returns LOCK_ERROR]*/
        result = LOCK_ERROR;
        LogError("(result = %s)\r\n", ENUM_TO_STRING(LOCK_RESULT, result));
    }
    else
    {
        if (mtx_lock((mtx_t*)handle) == thrd_success)
        {
            /*SRS_LOCK_99_005:[ This API on success should return LOCK_OK]*/
            result = LOCK_OK;
        }
        else
        {
            /*SRS_LOCK_99_006:[ This API on error should return LOCK_ERROR]*/
            result = LOCK_ERROR;
            LogError("(result = %s)\r\n", ENUM_TO_STRING(LOCK_RESULT, result));
        }
    }
    return result;
}
LOCK_RESULT Unlock(LOCK_HANDLE handle)
{
    LOCK_RESULT result;
    if (handle == NULL)
    {
        /*SRS_LOCK_99_011:[ This API on NULL handle passed returns LOCK_ERROR]*/
        result = LOCK_ERROR;
        LogError("(result = %s)\r\n", ENUM_TO_STRING(LOCK_RESULT, result));
    }
    else
    {
        if (mtx_unlock((mtx_t*)handle) == thrd_success)
        {
            /*SRS_LOCK_99_009:[ This API on success should return LOCK_OK]*/
            result = LOCK_OK;
        }
        else
        {
            /*SRS_LOCK_99_010:[ This API on error should return LOCK_ERROR]*/
            result = LOCK_ERROR;
            LogError("(result = %s)\r\n", ENUM_TO_STRING(LOCK_RESULT, result));
        }
    }
    return result;
}

LOCK_RESULT Lock_Deinit(LOCK_HANDLE handle)
{
    LOCK_RESULT result=LOCK_OK ;
    if (NULL == handle)
    {
        /*SRS_LOCK_99_013:[ This API on NULL handle passed returns LOCK_ERROR]*/
        result = LOCK_ERROR;
        LogError("(result = %s)\r\n", ENUM_TO_STRING(LOCK_RESULT, result));
    }
    else
    {
        /*SRS_LOCK_99_012:[ This API frees the memory pointed by handle]*/
        (void)mtx_destroy((mtx_t*)handle);
        free(handle);
        handle = NULL;
    }

    return result;
}


text:
package org.diirt.datasource.extra;

import java.awt.Color;
import java.time.Duration;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;

/**
 * Parameters for the waterfall plot
 *
 * @author carcassi
 */
public class WaterfallPlotParameters extends Parameters {

    static class InternalCopy {
        final Integer height;
        final ColorScheme colorScheme;
        final Boolean adaptiveRange;
        final Boolean scrollDown;
        final Duration pixelDuration;
        final Integer backgroundColor;

        private InternalCopy(Map<Object, Object> params) {
            height = (Integer) params.get("height");
            colorScheme = (ColorScheme) params.get("colorScheme");
            adaptiveRange = (Boolean) params.get("adaptiveRange");
            scrollDown = (Boolean) params.get("scrollDown");
            pixelDuration = (Duration) params.get("pixelDuration");
            backgroundColor = (Integer) params.get("backgroundColor");
        }

    }

    WaterfallPlotParameters(Object name, Object value) {
        super(Collections.singletonMap(name, value));
    }

    WaterfallPlotParameters(Map<Object, Object> map) {
        super(map);
    }

    WaterfallPlotParameters(WaterfallPlotParameters defaults, WaterfallPlotParameters... newValues) {
        super(defaults, newValues);
    }

    /**
     * Defaults parameters for the waterfall plot.
     *
     * @return set of default parameters
     */
    public static WaterfallPlotParameters defaults() {
        Map<Object, Object> defaults = new HashMap<Object, Object>();
        defaults.put("height", 50);
        defaults.put("colorScheme", ColorScheme.singleRangeGradient(Color.BLACK, Color.WHITE));
        defaults.put("adaptiveRange", false);
        defaults.put("scrollDown", false);
        defaults.put("pixelDuration", Duration.ofMillis(10));
        return new WaterfallPlotParameters(defaults);
    }

    InternalCopy internalCopy() {
        return new InternalCopy(getParameters());
    }

    /**
     * Height of the plot in pixels.
     *
     * @param height height of the plot in pixels
     * @return a new parameter
     */
    public static WaterfallPlotParameters height(int height) {
        return new WaterfallPlotParameters("height", height);
    }

    /**
     * The color scheme to convert a value to an rgb pixel in the plot.
     *
     * @param colorScheme color scheme
     * @return a new parameter
     */
    public static WaterfallPlotParameters colorScheme(ColorScheme colorScheme) {
        return new WaterfallPlotParameters("colorScheme", colorScheme);
    }

    /**
     * True if the range for the display should be the automatically
     * determined or should be desumed by the data.
     *
     * @param adaptiveRange true automatic range, false use the data form the channel
     * @return  a new parameter
     */
    public static WaterfallPlotParameters adaptiveRange(boolean adaptiveRange) {
        return new WaterfallPlotParameters("adaptiveRange", adaptiveRange);
    }

    /**
     * Whether the plot should scroll down or up.
     *
     * @param scrollDown true if scrolls down (current value at the top),
     * false if scrolls down (current value at the bottom)
     * @return a new parameter
     */
    public static WaterfallPlotParameters scrollDown(boolean scrollDown) {
        return new WaterfallPlotParameters("scrollDown", scrollDown);
    }

    /**
     * How much time should be allocated to each line of the plot.
     *
     * @param pixelDuration amount of time for each pixel
     * @return a new parameter
     */
    public static WaterfallPlotParameters pixelDuration(Duration pixelDuration) {
        return new WaterfallPlotParameters("pixelDuration", pixelDuration);
    }

    /**
     * The background color for the plot.
     *
     * @param rgb background color for the plot
     * @return a new parameter
     */
    public static WaterfallPlotParameters backgroundColor(int rgb) {
        return new WaterfallPlotParameters("backgroundColor", rgb);
    }

    /**
     * Returns a new set of parameters with the given changes;
     *
     * @param newParameters parameters to change
     * @return a new set of parameters
     */
    public WaterfallPlotParameters with(WaterfallPlotParameters... newParameters) {
        return new WaterfallPlotParameters(this, newParameters);
    }

    /**
     * The height of the plot in pixels.
     *
     * @return height of the plot
     */
    public int getHeight() {
        return internalCopy().height;
    }

    /**
     * True if range is automatic, false if taken from data.
     *
     * @return true if using automatic range
     */
    public boolean isAdaptiveRange() {
        return internalCopy().adaptiveRange;
    }

    /**
     * Whether the plot scrolls up or down.
     *
     * @return true if scrolls down
     */
    public boolean isScrollDown() {
        return internalCopy().scrollDown;
    }

    /**
     * Color scheme used for the plot.
     *
     * @return a color scheme
     */
    public ColorScheme getColorScheme() {
        return internalCopy().colorScheme;
    }

    /**
     * Time interval for each line.
     *
     * @return the duration for each line
     */
    public Duration getPixelDuration() {
        return internalCopy().pixelDuration;
    }

}


text:
#include "proctor/inverse_bag_proposer.h"

namespace pcl
{

  namespace proctor
  {
    double
    InverseBagProposer::getVotes(Entry &query, Entry &match)
    {
      int max_votes = 1;

      double votes = 0;

      for (unsigned int pi = 0; pi < query.features->size(); pi++) {
        vector<int> indices;
        vector<float> distances;

        int num_found = match.tree->nearestKSearch(*query.features, pi, max_votes, indices, distances);

        for (int ri = 0; ri < num_found; ri++) {
          /* Assuming that a distance of 0 is an error */
          if (distances[ri] != 0) {
            votes += 1.0 / (distances[ri]);
          }
        }
      }

      return votes;
    }

  }

}


text:
package net.gotev.sipservice;

import org.pjsip.pjsua2.CallInfo;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

/**
 * Obtains display name and remote uri from a CallInfo object.
 * @author gotev (Aleksandar Gotev)
 */
public class CallerInfo {

    private static final String UNKNOWN = "Unknown";

    private final String displayName;
    private final String remoteUri;

    public CallerInfo(final CallInfo callInfo) {
        String temp = callInfo.getRemoteUri();

        if (temp == null || temp.isEmpty()) {
            displayName = remoteUri = UNKNOWN;
            return;
        }

        Pattern displayNameAndRemoteUriPattern = Pattern.compile("^\"([^\"]+).*?sip:(.*?)>$");
        Matcher completeInfo = displayNameAndRemoteUriPattern.matcher(temp);
        if (completeInfo.matches()) {
            displayName = completeInfo.group(1);
            remoteUri = completeInfo.group(2);

        } else {
            Pattern remoteUriPattern = Pattern.compile("^.*?sip:(.*?)>$");
            Matcher remoteUriInfo = remoteUriPattern.matcher(temp);
            if (remoteUriInfo.matches()) {
                displayName = remoteUri = remoteUriInfo.group(1);
            } else {
                displayName = remoteUri = UNKNOWN;
            }
        }
    }

    public String getDisplayName() {
        return displayName;
    }

    public String getRemoteUri() {
        return remoteUri;
    }
}


text:
FOUNDATION_EXPORT double Pods_EasyTipView_TestsVersionNumber;
FOUNDATION_EXPORT const unsigned char Pods_EasyTipView_TestsVersionString[];


text:
import {Component, Input, ViewEncapsulation} from '@angular/core';
import {NgbNav} from './nav';

/**
 * The outlet where currently active nav content will be displayed.
 *
 * @since 5.2.0
 */
@Component({
  selector: '[ngbNavOutlet]',
  host: {'[class.tab-content]': 'true'},
  encapsulation: ViewEncapsulation.None,
  template: `
      <ng-template ngFor let-item [ngForOf]="nav.items">
          <div class="tab-pane"
               *ngIf="item.isPanelInDom()"
               [id]="item.panelDomId"
               [class.active]="item.active"
               [attr.role]="paneRole ? paneRole : nav.roles ? 'tabpanel' : undefined"
               [attr.aria-labelledby]="item.domId">
              <ng-template [ngTemplateOutlet]="item.contentTpl?.templateRef || null"
                           [ngTemplateOutletContext]="{$implicit: item.active}"></ng-template>
          </div>
      </ng-template>
  `
})
export class NgbNavOutlet {
  /**
   * A role to set on the nav pane
   */
  @Input() paneRole;

  /**
   * Reference to the `NgbNav`
   */
  @Input('ngbNavOutlet') nav: NgbNav;
}


text: minimal django project to make use of jsonresume schema


text:
namespace ISGPAI.Game.Collections
{
	public interface IAStarHeuristic
	{
		int Calculate(GraphNode node);
	}
}


text:
@interface NWHttpRequestSerializer : AFHTTPRequestSerializer

@property (nonatomic) NSURLRequestCachePolicy cachePolicy;

@end


text:
module Crisscross
  ##
  # provides methods to add and remove sub objects
  module Mapable
    def map(s)
      @s ||= []
      fail 'object is already mapped' if @s.include?(s)
      @s << s
    end

    def unmap(s)
      @s ||= []
      fail 'object is not mapped' unless @s.include?(s)
      @s.delete(s)
    end

    def sub
      @s
    end
  end
end


text:
<?php

namespace OpenConext\Value\Saml\Metadata\Organization;

use OpenConext\Value\Exception\InvalidArgumentException;
use PHPUnit_Framework_TestCase as UnitTest;
use stdClass;

class OrganizationDisplayNameListTest extends UnitTest
{
    /**
     * @test
     * @group metadata
     * @group organization
     *
     * @expectedException InvalidArgumentException
     */
    public function all_elements_must_be_an_organization_display_name()
    {
        $invalidElements = array(
            new OrganizationDisplayName('OpenConext', 'en'),
            new OrganizationDisplayName('Different', 'en'),
            new stdClass()
        );

        new OrganizationDisplayNameList($invalidElements);
    }

    /**
     * @test
     * @group metadata
     * @group organization
     */
    public function adding_an_organization_display_name_returns_a_new_list_with_that_name_appended()
    {
        $initialNameOne = new OrganizationDisplayName('OpenConext', 'en');
        $initialNameTwo = new OrganizationDisplayName('Different', 'en');
        $additionalName = new OrganizationDisplayName('Display_Name', 'en');

        $list = new OrganizationDisplayNameList(array($initialNameOne, $initialNameTwo));

        $newList = $list->add($additionalName);

        $this->assertNotSame($newList, $list, 'when adding an element to a list a new list must be returned');

        $this->assertTrue($list->contains($initialNameOne));
        $this->assertTrue($list->contains($initialNameTwo));
        $this->assertFalse($list->contains($additionalName));

        $this->assertTrue($newList->contains($initialNameOne));
        $this->assertTrue($newList->contains($initialNameTwo));
        $this->assertTrue($newList->contains($additionalName));
    }

    /**
     * @test
     * @group metadata
     * @group organization
     */
    public function presence_of_a_name_can_be_tested()
    {
        $displayNameOne   = new OrganizationDisplayName('OpenConext', 'en');
        $displayNameTwo   = new OrganizationDisplayName('Different', 'en');
        $notInList = new OrganizationDisplayName('Display_Name', 'en');

        $list = new OrganizationDisplayNameList(array($displayNameOne, $displayNameTwo));

        $this->assertTrue($list->contains($displayNameOne));
        $this->assertTrue($list->contains($displayNameTwo));
        $this->assertFalse($list->contains($notInList));
    }

    /**
     * @test
     * @group metadata
     * @group organization
     */
    public function the_index_of_an_organization_display_name_can_be_retrieved()
    {
        $displayNameOne   = new OrganizationDisplayName('OpenConext', 'en');
        $displayNameTwo   = new OrganizationDisplayName('Different', 'en');
        $notInList = new OrganizationDisplayName('Display_Name', 'en');

        $list = new OrganizationDisplayNameList(array($displayNameOne, $displayNameTwo));

        $this->assertEquals(0, $list->indexOf($displayNameOne));
        $this->assertEquals(1, $list->indexOf($displayNameTwo));
        $this->assertEquals(-1, $list->indexOf($notInList), 'An element not in the list must have an index of -1');
    }

    /**
     * @test
     * @group metadata
     * @group organization
     */
    public function an_organization_display_name_can_be_retrieved_by_index()
    {
        $displayNameOne = new OrganizationDisplayName('OpenConext', 'en');
        $displayNameTwo = new OrganizationDisplayName('Different', 'en');

        $list = new OrganizationDisplayNameList(array($displayNameOne, $displayNameTwo));

        $this->assertSame($displayNameOne, $list->get(0));
        $this->assertSame($displayNameTwo, $list->get(1));
    }

    /**
     * @test
     * @group metadata
     * @group organization
     *
     * @dataProvider \OpenConext\Value\TestDataProvider::notInteger
     * @expectedException InvalidArgumentException
     *
     * @param mixed $invalidArgument
     */
    public function index_to_retrieve_the_element_of_must_be_an_integer($invalidArgument)
    {
        $displayNameOne = new OrganizationDisplayName('OpenConext', 'en');
        $displayNameTwo = new OrganizationDisplayName('Different', 'en');

        $list = new OrganizationDisplayNameList(array($displayNameOne, $displayNameTwo));

        $list->get($invalidArgument);
    }

    /**
     * @test
     * @group metadata
     * @group organization
     *
     * @expectedException \OpenConext\Value\Exception\IndexOutOfBoundsException
     */
    public function an_exception_is_thrown_when_attempting_to_get_an_element_with_a_negative_index()
    {
        $displayNameOne = new OrganizationDisplayName('OpenConext', 'en');
        $displayNameTwo = new OrganizationDisplayName('Different', 'en');

        $list = new OrganizationDisplayNameList(array($displayNameOne, $displayNameTwo));

        $list->get(-1);
    }

    /**
     * @test
     * @group metadata
     * @group organization
     *
     * @expectedException \OpenConext\Value\Exception\IndexOutOfBoundsException
     */
    public function an_exception_is_thrown_when_attempting_to_get_an_element_with_an_index_larger_than_the_list_size()
    {
        $displayNameOne = new OrganizationDisplayName('OpenConext', 'en');
        $displayNameTwo = new OrganizationDisplayName('OpenConext', 'nl');

        $list = new OrganizationDisplayNameList(array($displayNameOne, $displayNameTwo));

        $list->get(4);
    }

    /**
     * @test
     * @group metadata
     * @group organization
     */
    public function an_organization_display_name_can_be_searched_for()
    {
        $predicate = function (OrganizationDisplayName $organizationDisplayName) {
            return $organizationDisplayName->getLanguage() === 'en_GB';
        };

        $displayNameOne = new OrganizationDisplayName('OpenConext', 'en_US');
        $displayNameTwo = new OrganizationDisplayName('OpenConext', 'en_GB');

        $list = new OrganizationDisplayNameList(array($displayNameOne, $displayNameTwo));

        $this->assertSame($displayNameTwo, $list->find($predicate));
    }

    /**
     * @test
     * @group metadata
     * @group contactperson
     */
    public function find_returns_the_first_matching_element()
    {
        $predicate = function (OrganizationDisplayName $organizationDisplayName) {
            return $organizationDisplayName->getLanguage() === 'en_GB';
        };

        $displayNameOne = new OrganizationDisplayName('OpenConext', 'en_US');
        $displayNameTwo = new OrganizationDisplayName('OpenConext', 'en_GB');
        $notReturned    = new OrganizationDisplayName('OpenConext', 'en_GB');

        $list = new OrganizationDisplayNameList(array($displayNameOne, $displayNameTwo, $notReturned));

        $this->assertSame($displayNameTwo, $list->find($predicate));
    }

    /**
     * @test
     * @group metadata
     * @group contactperson
     */
    public function null_is_returned_when_no_match_is_found()
    {
        $predicate = function () {
            return false;
        };

        $displayNameOne = new OrganizationDisplayName('OpenConext', 'en_US');
        $displayNameTwo = new OrganizationDisplayName('OpenConext', 'en_GB');

        $list = new OrganizationDisplayNameList(array($displayNameOne, $displayNameTwo));

        $this->assertNull($list->find($predicate));
    }

    /**
     * @test
     * @group        metadata
     * @group        contactperson
     *
     * @dataProvider \OpenConext\Value\TestDataProvider::notCallable
     * @expectedException InvalidArgumentException
     *
     * @param mixed $notCallable
     */
    public function find_predicate_must_be_a_callable($notCallable)
    {
        $displayNameOne = new OrganizationDisplayName('OpenConext', 'en_US');
        $displayNameTwo = new OrganizationDisplayName('OpenConext', 'en_GB');

        $list = new OrganizationDisplayNameList(array($displayNameOne, $displayNameTwo));

        $list->find($notCallable);
    }

    /**
     * @test
     * @group metadata
     * @group organization
     */
    public function lists_are_only_equal_when_containing_the_same_elements_in_the_same_order()
    {
        $displayNameOne   = new OrganizationDisplayName('OpenConext', 'en');
        $displayNameTwo   = new OrganizationDisplayName('Different', 'en');
        $displayNameThree = new OrganizationDisplayName('Display_Name', 'en');

        $base           = new OrganizationDisplayNameList(array($displayNameOne, $displayNameTwo));
        $theSame        = new OrganizationDisplayNameList(array($displayNameOne, $displayNameTwo));
        $differentOrder = new OrganizationDisplayNameList(array($displayNameTwo, $displayNameOne));
        $lessElements   = new OrganizationDisplayNameList(array($displayNameOne));
        $moreElements   = new OrganizationDisplayNameList(array($displayNameOne, $displayNameTwo, $displayNameThree));

        $this->assertTrue($base->equals($theSame));
        $this->assertFalse($base->equals($differentOrder));
        $this->assertFalse($base->equals($lessElements));
        $this->assertFalse($base->equals($moreElements));
    }

    /**
     * @test
     * @group metadata
     * @group organization
     */
    public function an_organization_display_name_list_can_be_iterated_over()
    {
        $displayNameOne = new OrganizationDisplayName('OpenConext', 'en');
        $displayNameTwo = new OrganizationDisplayName('Different', 'en');

        $list = new OrganizationDisplayNameList(array($displayNameOne, $displayNameTwo));

        $unknownElementSeen = false;
        $displayNameOneSeen = $displayNameTwoSeen = false;

        foreach ($list as $displayName) {
            if (!$displayNameOneSeen && $displayName === $displayNameOne) {
                $displayNameOneSeen = true;
            } elseif (!$displayNameTwoSeen && $displayName === $displayNameTwo) {
                $displayNameTwoSeen = true;
            } else {
                $unknownElementSeen = true;
            }
        }

        $this->assertFalse(
            $unknownElementSeen,
            'Found unknown element while iterating over OrganizationDisplayNameList'
        );
        $this->assertTrue(
            $displayNameOneSeen,
            'Missing expected element displayNameOne when iterating over OrganizationDisplayNameList'
        );
        $this->assertTrue(
            $displayNameTwoSeen,
            'Missing expected element displayNameTwo when iterating over OrganizationDisplayNameList'
        );
    }

    /**
     * @test
     * @group metadata
     * @group organization
     */
    public function the_elements_in_an_organization_display_name_list_can_be_counted()
    {
        $numberOne   = new OrganizationDisplayName('OpenConext', 'en');
        $numberTwo   = new OrganizationDisplayName('Different', 'en');
        $numberThree = new OrganizationDisplayName('Display_Name', 'en');

        $twoElements   = new OrganizationDisplayNameList(array($numberThree, $numberTwo));
        $threeElements = new OrganizationDisplayNameList(array($numberThree, $numberTwo, $numberOne));

        $this->assertCount(2, $twoElements);
        $this->assertCount(3, $threeElements);
    }

    /**
     * @test
     * @group metadata
     * @group organization
     */
    public function a_list_exposes_an_array_containing_its_elements()
    {
        $numberOne = new OrganizationDisplayName('OpenConext', 'en');
        $numberTwo = new OrganizationDisplayName('Different', 'en');

        $list = new OrganizationDisplayNameList(array($numberTwo, $numberOne, $numberTwo));

        $this->assertSame(
            array($numberTwo, $numberOne, $numberTwo),
            $list->toArray()
        );
    }

    /**
     * @test
     * @group metadata
     * @group organization
     */
    public function deserializing_a_serialized_organization_display_name_list_results_in_an_equal_value_object()
    {
        $displayNameOne = new OrganizationDisplayName('OpenConext', 'en');
        $displayNameTwo = new OrganizationDisplayName('Different', 'en');

        $original     = new OrganizationDisplayNameList(array($displayNameOne, $displayNameTwo));
        $deserialized = OrganizationDisplayNameList::deserialize($original->serialize());

        $this->assertTrue($original->equals($deserialized));
    }

    /**
     * @test
     * @group metadata
     * @group organization
     *
     * @dataProvider \OpenConext\Value\TestDataProvider::notArray
     * @expectedException InvalidArgumentException
     *
     * @param mixed $notArray
     */
    public function deserialization_requires_an_array($notArray)
    {
        OrganizationDisplayNameList::deserialize($notArray);
    }

    /**
     * @test
     * @group metadata
     * @group organization
     */
    public function an_organization_display_name_list_can_be_cast_to_string()
    {
        $displayNameOne = new OrganizationDisplayName('OpenConext', 'en');
        $displayNameTwo = new OrganizationDisplayName('Different', 'en');

        $list = new OrganizationDisplayNameList(array($displayNameOne, $displayNameTwo));

        $string = sprintf('OrganizationDisplayNameList[%s, %s]', (string) $displayNameOne, (string) $displayNameTwo);
        $this->assertSame($string, (string) $list);
    }
}


text:
require_relative "../../../../lib/query_string_search/abstract_comparison"

RSpec.describe QueryStringSearch::SetComparison do
  let(:value) { rand }
  let(:comparison) do
    c = QueryStringSearch::SetComparison.new
    c.subject = value
    c
  end

  describe "comparing for existence" do
    before do
      comparison.operator = "=".to_sym
    end

    describe "target has the data" do
      it "returns true" do
        expect(comparison.compare(value)).to be_truthy
      end
    end

    describe "target does not have the data" do
      it "returns true" do
        expect(comparison.compare(value + 1)).to be_falsey
      end
    end
  end

  describe "comparing for absence" do
    before do
      comparison.operator = :!=
    end

    describe "target has the data" do
      it "returns false" do
        expect(comparison.compare(value)).to be_falsey
      end
    end

    describe "target does not have the data" do
      it "returns true" do
        expect(comparison.compare(value + 1)).to be_truthy
      end
    end
  end
end


text:
REM Config
set NGINX_DIR=nginx
set THISDIR=%~dp0

REM Copy resources
rmdir /s /q .\res

mkdir .\res
mkdir .\res\A2BBIdSrv
mkdir .\res\A2BBAPI

xcopy /y /s ..\A2BBIdentityServer\bin\Debug\netcoreapp1.1 .\res\A2BBIdSrv
copy /y ..\A2BBIdentityServer\appsettings.json .\res\A2BBIdSrv\appsettings.json
xcopy /y /s ..\A2BBAPI\bin\Debug\netcoreapp1.1 .\res\A2BBAPI
copy /y ..\A2BBAPI\appsettings.json .\res\A2BBAPI\appsettings.json

REM Start DotNet
cd .\res\A2BBIdSrv
start dotnet .\A2BBIdentityServer.dll
cd ..\..\res\A2BBAPI
start dotnet .\A2BBAPI.dll
cd ..\..

REM Start nginx
copy /y .\nginx.conf %NGINX_DIR%\conf\nginx.conf
%NGINX_DIR%\nginx.exe -p %NGINX_DIR%


text:
module Metric::Aggregation
  class Common
    def self.supports?(meth)
      singleton_methods(false).include?(meth.to_sym)
    end

    def self.column(col, *args) # args => obj, result, counts, value, default_operation = nil
      default_operation = args[4]
      args = args[0..3]

      meth = col
      meth = col.to_s.split("_").last unless supports?(meth)
      meth = default_operation        unless supports?(meth) || default_operation.nil?
      send(meth, col, *args) if supports?(meth)
    end
  end

  class Aggregate < Common
    def self.summation(col, _obj, result, counts, value)
      return if value.nil?
      result[col] += value
      counts[col] += 1
    end

    class << self
      alias_method :derived_vm_numvcpus, :summation
      alias_method :average, :summation
    end

    def self.latest(col, _obj, result, _counts, value)
      return if value.nil?
      result[col] = value
    end

    def self.cpu_usage_rate_average(col, state, result, counts, value)
      return if value.nil?
      if state.try(:total_cpu).to_i > 0
        pct = value / 100
        total = state.total_cpu
        value = total * pct
        result[col] += value
      elsif state.try(:numvcpus).to_i > 0
        result[col] += value * state.numvcpus
        counts[col] += state.numvcpus
      else
        average(col, state, result, counts, value)
      end
    end

    def self.mem_usage_absolute_average(col, state, result, counts, value)
      return if value.nil?
      if state && state.total_mem
        pct = value / 100
        total = state.total_mem
        value = total * pct
        result[col] += value
      else
        average(col, state, result, counts, value)
      end
    end
  end

  class Process < Common
    def self.average(col, _dummy, result, counts, aggregate_only = false)
      return if aggregate_only || result[col].nil?
      result[col] = result[col] / counts[col] unless counts[col] == 0
    end

    def self.summation(*)
      # noop
    end

    class << self
      alias_method :latest, :summation
    end

    def self.cpu_usage_rate_average(col, state, result, counts, aggregate_only = false)
      return if result[col].nil?
      if state.try(:total_cpu).to_i > 0
        total = state.total_cpu
        result[col] = result[col] / total * 100 unless total == 0
      else
        average(col, state, result, counts) unless aggregate_only
      end
    end

    def self.mem_usage_absolute_average(col, state, result, counts, aggregate_only = false)
      return if result[col].nil?
      if state && state.total_mem
        total = state.total_mem
        result[col] = result[col] / total * 100 unless total == 0
      else
        average(col, state, result, counts) unless aggregate_only
      end
    end
  end
end