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

// otherwise define conflict between 3rdParty\date\include\date\date.h and
// 3rdParty\iresearch\core\shared.hpp
#if defined(_MSC_VER)
#include "date/date.h"
#endif

#include "IResearchAqlAnalyzer.h"

#include "utils/hash_utils.hpp"
#include "utils/object_pool.hpp"

#include "Aql/AqlCallList.h"
#include "Aql/AqlCallStack.h"
#include "Aql/AqlFunctionFeature.h"
#include "Aql/Expression.h"
#include "Aql/FixedVarExpressionContext.h"
#include "Aql/Optimizer.h"
#include "Aql/OptimizerRule.h"
#include "Aql/Parser.h"
#include "Aql/QueryString.h"
#include "Aql/StandaloneCalculation.h"
#include "Basics/ResourceUsage.h"
#include "Basics/StaticStrings.h"
#include "Basics/StringUtils.h"
#include "Basics/VelocyPackHelper.h"
#include "Basics/FunctionUtils.h"
#include "IResearch/IResearchCommon.h"
#include "IResearch/VelocyPackHelper.h"
#include "Logger/LogMacros.h"
#include "RestServer/DatabaseFeature.h"
#include "Transaction/SmartContext.h"
#include "Utils/CollectionNameResolver.h"
#include "VocBase/Identifiers/DataSourceId.h"
#include "VocBase/vocbase.h"

#include <Containers/HashSet.h>
#include "VPackDeserializer/deserializer.h"

namespace {
using namespace arangodb::velocypack::deserializer;
using namespace arangodb::aql;

constexpr const char QUERY_STRING_PARAM_NAME[] = "queryString";
constexpr const char COLLAPSE_ARRAY_POSITIONS_PARAM_NAME[] =
    "collapsePositions";
constexpr const char KEEP_NULL_PARAM_NAME[] = "keepNull";
constexpr const char BATCH_SIZE_PARAM_NAME[] = "batchSize";
constexpr const char MEMORY_LIMIT_PARAM_NAME[] = "memoryLimit";
constexpr const char CALCULATION_PARAMETER_NAME[] = "param";
constexpr const char RETURN_TYPE_PARAM_NAME[] = "returnType";

constexpr const uint32_t MAX_BATCH_SIZE{1000};
constexpr const uint32_t MAX_MEMORY_LIMIT{33554432U};  // 32Mb

using Options = arangodb::iresearch::AqlAnalyzer::Options;

struct OptionsValidator {
  std::optional<deserialize_error> operator()(Options const& opts) const {
    if (opts.queryString.empty()) {
      return deserialize_error{std::string("Value of '")
                                   .append(QUERY_STRING_PARAM_NAME)
                                   .append("' should be non empty string")};
    }
    if (opts.batchSize == 0) {
      return deserialize_error{std::string("Value of '")
                                   .append(BATCH_SIZE_PARAM_NAME)
                                   .append("' should be greater than 0")};
    }
    if (opts.batchSize > MAX_BATCH_SIZE) {
      return deserialize_error{std::string("Value of '")
                                   .append(BATCH_SIZE_PARAM_NAME)
                                   .append("' should be less or equal to ")
                                   .append(std::to_string(MAX_BATCH_SIZE))};
    }
    if (opts.memoryLimit == 0) {
      return deserialize_error{std::string("Value of '")
                                   .append(MEMORY_LIMIT_PARAM_NAME)
                                   .append("' should be greater than 0")};
    }
    if (opts.memoryLimit > MAX_MEMORY_LIMIT) {
      return deserialize_error{std::string("Value of '")
                                   .append(MEMORY_LIMIT_PARAM_NAME)
                                   .append("' should be less or equal to ")
                                   .append(std::to_string(MAX_MEMORY_LIMIT))};
    }
    if (opts.returnType != arangodb::iresearch::AnalyzerValueType::String &&
        opts.returnType != arangodb::iresearch::AnalyzerValueType::Number &&
        opts.returnType != arangodb::iresearch::AnalyzerValueType::Bool) {
      return deserialize_error{
          std::string("Value of '")
              .append(RETURN_TYPE_PARAM_NAME)
              .append("' should be ")
              .append(arangodb::iresearch::ANALYZER_VALUE_TYPE_STRING)
              .append(" or ")
              .append(arangodb::iresearch::ANALYZER_VALUE_TYPE_NUMBER)
              .append(" or ")
              .append(arangodb::iresearch::ANALYZER_VALUE_TYPE_BOOL)};
    }
    return {};
  }
};

using OptionsDeserializer = utilities::constructing_deserializer<
    Options,
    parameter_list<
        factory_deserialized_parameter<QUERY_STRING_PARAM_NAME,
                                       values::value_deserializer<std::string>,
                                       true>,
        factory_simple_parameter<COLLAPSE_ARRAY_POSITIONS_PARAM_NAME, bool,
                                 false, values::numeric_value<bool, false>>,
        factory_simple_parameter<KEEP_NULL_PARAM_NAME, bool, false,
                                 values::numeric_value<bool, true>>,
        factory_simple_parameter<BATCH_SIZE_PARAM_NAME, uint32_t, false,
                                 values::numeric_value<uint32_t, 10>>,
        factory_simple_parameter<MEMORY_LIMIT_PARAM_NAME, uint32_t, false,
                                 values::numeric_value<uint32_t, 1048576U>>,
        factory_deserialized_default<
            RETURN_TYPE_PARAM_NAME,
            arangodb::iresearch::AnalyzerValueTypeEnumDeserializer,
            values::numeric_value<
                arangodb::iresearch::AnalyzerValueType,
                static_cast<std::underlying_type_t<
                    arangodb::iresearch::AnalyzerValueType>>(
                    arangodb::iresearch::AnalyzerValueType::String)>>>>;

using ValidatingOptionsDeserializer =
    validate<OptionsDeserializer, OptionsValidator>;

bool parse_options_slice(VPackSlice const& slice,
                         arangodb::iresearch::AqlAnalyzer::Options& options) {
  auto const res = deserialize<ValidatingOptionsDeserializer,
                               hints::hint_list<hints::ignore_unknown>>(slice);
  if (!res.ok()) {
    LOG_TOPIC("d88b8", WARN, arangodb::iresearch::TOPIC)
        << "Failed to deserialize options from JSON while constructing '"
        << arangodb::iresearch::AqlAnalyzer::type_name()
        << "' analyzer, error: '" << res.error().message << "'";
    return false;
  }
  options = res.get();
  return true;
}

bool normalize_slice(VPackSlice const& slice, VPackBuilder& builder) {
  arangodb::iresearch::AqlAnalyzer::Options options;
  if (parse_options_slice(slice, options)) {
    VPackObjectBuilder root(&builder);
    builder.add(QUERY_STRING_PARAM_NAME, VPackValue(options.queryString));
    builder.add(COLLAPSE_ARRAY_POSITIONS_PARAM_NAME,
                VPackValue(options.collapsePositions));
    builder.add(KEEP_NULL_PARAM_NAME, VPackValue(options.keepNull));
    builder.add(BATCH_SIZE_PARAM_NAME, VPackValue(options.batchSize));
    builder.add(MEMORY_LIMIT_PARAM_NAME, VPackValue(options.memoryLimit));
    switch (options.returnType) {
      case arangodb::iresearch::AnalyzerValueType::String:
        builder.add(
            RETURN_TYPE_PARAM_NAME,
            VPackValue(arangodb::iresearch::ANALYZER_VALUE_TYPE_STRING));
        break;
      case arangodb::iresearch::AnalyzerValueType::Number:
        builder.add(
            RETURN_TYPE_PARAM_NAME,
            VPackValue(arangodb::iresearch::ANALYZER_VALUE_TYPE_NUMBER));
        break;
      case arangodb::iresearch::AnalyzerValueType::Bool:
        builder.add(RETURN_TYPE_PARAM_NAME,
                    VPackValue(arangodb::iresearch::ANALYZER_VALUE_TYPE_BOOL));
        break;
      default:
        TRI_ASSERT(false);
    }
    return true;
  }
  return false;
}

irs::analysis::analyzer::ptr make_slice(VPackSlice const& slice) {
  arangodb::iresearch::AqlAnalyzer::Options options;
  if (parse_options_slice(slice, options)) {
    auto validationRes = arangodb::aql::StandaloneCalculation::validateQuery(
        arangodb::DatabaseFeature::getCalculationVocbase(), options.queryString,
        CALCULATION_PARAMETER_NAME, " in aql analyzer",
        /*isComputedValue*/ false);
    if (validationRes.ok()) {
      return std::make_unique<arangodb::iresearch::AqlAnalyzer>(options);
    } else {
      LOG_TOPIC("f775e", WARN, arangodb::iresearch::TOPIC)
          << "error validating calculation query: "
          << validationRes.errorMessage();
    }
  }
  return nullptr;
}

ExecutionNode* getCalcNode(ExecutionNode* node) {
  // get calculation node which satisfy the requirements
  if (node == nullptr || node->getType() != ExecutionNode::RETURN) {
    return nullptr;
  }

  auto& deps = node->getDependencies();
  if (deps.size() == 1 &&
      deps[0]->getType() == ExecutionNode::NodeType::CALCULATION) {
    auto calcNode = deps[0];

    auto& deps2 = calcNode->getDependencies();
    if (deps2.size() == 1 &&
        deps2[0]->getType() == ExecutionNode::NodeType::SINGLETON) {
      return calcNode;
    }
  }

  return nullptr;
}
}  // namespace

namespace arangodb {
namespace iresearch {

/*static*/ bool AqlAnalyzer::normalize_vpack(std::string_view args,
                                             std::string& out) {
  auto const slice = arangodb::iresearch::slice(args);
  VPackBuilder builder;
  if (normalize_slice(slice, builder)) {
    out.resize(builder.slice().byteSize());
    std::memcpy(&out[0], builder.slice().begin(), out.size());
    return true;
  }
  return false;
}

/*static*/ bool AqlAnalyzer::normalize_json(std::string_view args,
                                            std::string& out) {
  auto src = VPackParser::fromJson(args.data(), args.size());
  VPackBuilder builder;
  if (normalize_slice(src->slice(), builder)) {
    out = builder.toString();
    return true;
  }
  return false;
}

/*static*/ irs::analysis::analyzer::ptr AqlAnalyzer::make_vpack(
    std::string_view args) {
  auto const slice = arangodb::iresearch::slice(args);
  return make_slice(slice);
}

/*static*/ irs::analysis::analyzer::ptr AqlAnalyzer::make_json(
    std::string_view args) {
  auto builder = VPackParser::fromJson(args.data(), args.size());
  return make_slice(builder->slice());
}

bool tryOptimize(AqlAnalyzer* analyzer) {
  ExecutionNode* execNode = getCalcNode(analyzer->_plan->root());
  if (execNode != nullptr) {
    TRI_ASSERT(execNode->getType() == ExecutionNode::NodeType::CALCULATION);
    analyzer->_nodeToOptimize = static_cast<CalculationNode*>(execNode);
    // allocate memory for result
    analyzer->_queryResults = analyzer->_itemBlockManager.requestBlock(1, 1);
    return true;
  }

  return false;
}

void resetFromExpression(AqlAnalyzer* analyzer) {
  auto e = analyzer->_nodeToOptimize->expression();

  auto& trx = analyzer->_query->trxForOptimization();

  auto& query = analyzer->_query->ast()->query();

  // create context
  // value is not needed since getting it from _bindedNodes
  NoVarExpressionContext ctx(trx, query, analyzer->_aqlFunctionsInternalCache);

  analyzer->_executionState = ExecutionState::DONE;  // already calculated

  // put calculated value in _queryResults
  analyzer->_queryResults->destroyValue(0, 0);
  bool mustDestroy = true;

  analyzer->_queryResults->setValue(0, 0, e->execute(&ctx, mustDestroy));

  analyzer->_engineResultRegister = 0;
}

void resetFromQuery(AqlAnalyzer* analyzer) {
  analyzer->_queryResults = nullptr;
  analyzer->_plan->clearVarUsageComputed();
  analyzer->_aqlFunctionsInternalCache.clear();
  analyzer->_engine.initFromPlanForCalculation(*analyzer->_plan);
  analyzer->_executionState = ExecutionState::HASMORE;
  analyzer->_engineResultRegister = analyzer->_engine.resultRegister();
}

#ifdef ARANGODB_USE_GOOGLE_TESTS
bool AqlAnalyzer::isOptimized() const {
  return _resetImpl == &resetFromExpression;
}
#endif

AqlAnalyzer::AqlAnalyzer(Options const& options)
    : irs::analysis::analyzer(irs::type<AqlAnalyzer>::get()),
      _options(options),
      _query(arangodb::aql::StandaloneCalculation::buildQueryContext(
          arangodb::DatabaseFeature::getCalculationVocbase())),
      _itemBlockManager(_query->resourceMonitor(),
                        SerializationFormat::SHADOWROWS),
      _engine(0, *_query, _itemBlockManager, SerializationFormat::SHADOWROWS,
              nullptr),
      _resetImpl(&resetFromQuery) {
  _query->resourceMonitor().memoryLimit(_options.memoryLimit);
  std::get<AnalyzerValueTypeAttribute>(_attrs).value = _options.returnType;
  TRI_ASSERT(arangodb::aql::StandaloneCalculation::validateQuery(
                 arangodb::DatabaseFeature::getCalculationVocbase(),
                 _options.queryString, CALCULATION_PARAMETER_NAME,
                 " in aql analyzer", /*isComputedValue*/ false)
                 .ok());
}

bool AqlAnalyzer::next() {
  do {
    if (_queryResults != nullptr) {
      while (_queryResults->numRows() > _resultRowIdx) {
        AqlValue const& value = _queryResults->getValueReference(
            _resultRowIdx++, _engineResultRegister);
        if (_options.keepNull || !value.isNull(true)) {
          switch (_options.returnType) {
            case AnalyzerValueType::String:
              if (value.isString()) {
                std::get<2>(_attrs).value =
                    arangodb::iresearch::getBytesRef(value.slice());
              } else {
                VPackFunctionParameters params;
                params.push_back(value);
                aql::NoVarExpressionContext ctx(_query->trxForOptimization(),
                                                *_query,
                                                _aqlFunctionsInternalCache);
                _valueBuffer = aql::functions::ToString(
                    &ctx, *_query->ast()->root(), params);
                TRI_ASSERT(_valueBuffer.isString());
                std::get<2>(_attrs).value = irs::ViewCast<irs::byte_type>(
                    _valueBuffer.slice().stringView());
              }
              break;
            case AnalyzerValueType::Number:
              if (value.isNumber()) {
                std::get<3>(_attrs).value = value.slice();
              } else {
                VPackFunctionParameters params;
                params.push_back(value);
                aql::NoVarExpressionContext ctx(_query->trxForOptimization(),
                                                *_query,
                                                _aqlFunctionsInternalCache);
                _valueBuffer = aql::functions::ToNumber(
                    &ctx, *_query->ast()->root(), params);
                TRI_ASSERT(_valueBuffer.isNumber());
                std::get<3>(_attrs).value = _valueBuffer.slice();
              }
              break;
            case AnalyzerValueType::Bool:
              if (value.isBoolean()) {
                std::get<3>(_attrs).value = value.slice();
              } else {
                VPackFunctionParameters params;
                params.push_back(value);
                aql::NoVarExpressionContext ctx(_query->trxForOptimization(),
                                                *_query,
                                                _aqlFunctionsInternalCache);
                _valueBuffer = aql::functions::ToBool(
                    &ctx, *_query->ast()->root(), params);
                TRI_ASSERT(_valueBuffer.isBoolean());
                std::get<3>(_attrs).value = _valueBuffer.slice();
              }
              break;
            default:
              // new return type added?
              TRI_ASSERT(false);
              LOG_TOPIC("a9ba5", WARN, iresearch::TOPIC)
                  << "Unexpected AqlAnalyzer return type "
                  << static_cast<std::underlying_type_t<AnalyzerValueType>>(
                         _options.returnType);
              std::get<2>(_attrs).value = irs::kEmptyStringView<irs::byte_type>;
              _valueBuffer = AqlValue();
              std::get<3>(_attrs).value = _valueBuffer.slice();
          }
          std::get<0>(_attrs).value = _nextIncVal;
          _nextIncVal = !_options.collapsePositions;
          return true;
        }
      }
    }
    if (_executionState == ExecutionState::HASMORE) {
      _executionState = ExecutionState::DONE;  // set to done to terminate in
                                               // case of exception
      _resultRowIdx = 0;
      _queryResults = nullptr;
      try {
        AqlCallStack aqlStack{
            AqlCallList{AqlCall::SimulateGetSome(_options.batchSize)}};
        SkipResult skip;
        std::tie(_executionState, skip, _queryResults) =
            _engine.execute(aqlStack);
        TRI_ASSERT(skip.nothingSkipped());
        TRI_ASSERT(_executionState != ExecutionState::WAITING);
      } catch (std::exception const& e) {
        LOG_TOPIC("c92eb", WARN, iresearch::TOPIC)
            << "error executing calculation query: " << e.what()
            << " AQL query: " << _options.queryString;
      } catch (...) {
        LOG_TOPIC("bf89b", WARN, iresearch::TOPIC)
            << "error executing calculation query"
            << " AQL query: " << _options.queryString;
      }
    }
  } while (
      _executionState != ExecutionState::DONE ||
      (_queryResults != nullptr && _queryResults->numRows() > _resultRowIdx));
  return false;
}

bool AqlAnalyzer::reset(std::string_view field) noexcept {
  try {
    if (!_plan) {  // lazy initialization
      // important to hold a copy here as parser accepts reference!
      auto queryString = arangodb::aql::QueryString(_options.queryString);
      auto ast = _query->ast();
      TRI_ASSERT(ast);
      Parser parser(*_query, *ast, queryString);
      parser.parse();
      AstNode* astRoot = const_cast<AstNode*>(ast->root());
      TRI_ASSERT(astRoot);
      Ast::traverseAndModify(
          astRoot, [this, field, ast](AstNode* node) -> AstNode* {
            if (node->type == NODE_TYPE_PARAMETER) {
              // should be only our parameter name. see validation method!
              TRI_ASSERT(node->getStringView() == CALCULATION_PARAMETER_NAME);
              // FIXME: move to computed value once here could be not only
              // strings
              auto newNode =
                  ast->createNodeValueMutableString(field.data(), field.size());
              // finally note that the node was created from a bind parameter
              newNode->setFlag(FLAG_BIND_PARAMETER);
              newNode->setFlag(
                  DETERMINED_CONSTANT);  // keep value as non-constant to
                                         // prevent optimizations
              newNode->setFlag(DETERMINED_NONDETERMINISTIC,
                               VALUE_NONDETERMINISTIC);
              _bindedNodes.push_back(newNode);
              return newNode;
            } else {
              return node;
            }
          });
      // we have to set "optimizeNonCacheable" to false here, so that the
      // queryString expression gets re-evaluated every time, and does not
      // store the computed results once (e.g. when using a queryString such
      // as "RETURN DATE_NOW()" you always want the current date to be
      // returned, and not a date once stored)
      ast->validateAndOptimize(_query->trxForOptimization(),
                               {.optimizeNonCacheable = false});

      std::unique_ptr<ExecutionPlan> plan =
          ExecutionPlan::instantiateFromAst(ast, true);

      // run the plan through the optimizer, executing only the absolutely
      // necessary optimizer rules (we skip all other rules to save time). we
      // have to execute the "splice-subqueries" rule here so we replace all
      // SubqueryNodes with SubqueryStartNodes and SubqueryEndNodes.
      Optimizer optimizer(1);
      // disable all rules which are not necessary
      optimizer.disableRules(plan.get(), [](OptimizerRule const& rule) -> bool {
        return rule.canBeDisabled() || rule.isClusterOnly();
      });
      optimizer.createPlans(std::move(plan), _query->queryOptions(), false);

      _plan = optimizer.stealBest();

      // try to optimize
      if (tryOptimize(this)) {
        _resetImpl = &resetFromExpression;
      }
    }

    for (auto node : _bindedNodes) {
      node->setStringValue(field.data(), field.size());
    }

    _resultRowIdx = 0;
    _nextIncVal = 1;  // first increment always 1 to move from -1 to 0
    _engine.reset();

    _resetImpl(this);
    return true;

  } catch (std::exception const& e) {
    LOG_TOPIC("d2223", WARN, iresearch::TOPIC)
        << "error creating calculation query: " << e.what()
        << " AQL query: " << _options.queryString;
  } catch (...) {
    LOG_TOPIC("5ad87", WARN, iresearch::TOPIC)
        << "error creating calculation query"
        << " AQL query: " << _options.queryString;
  }
  return false;
}
}  // namespace iresearch
}  // namespace arangodb


text:
<?xml version="1.0" encoding="utf-8"?>
<resources xmlns:ns1="urn:oasis:names:tc:xliff:document:1.2">
    <!-- From: file:/Users/wdullaer/Documents/Programming%20Projects/MaterialDateTimePicker/library/src/main/res/values-nl/strings.xml -->
    <eat-comment/>
    <string name="mdtp_date_v1_monthyear">MMMM yyyy</string>
    <string msgid="3968620852217927702" name="mdtp_day_picker_description">"Maandraster van dagen"</string>
    <string msgid="6908431551612331381" name="mdtp_deleted_key">"<ns1:g id="KEY">%1$s</ns1:g> verwijderd"</string>
    <string msgid="7007948707597430919" name="mdtp_done_label">"Gereed"</string>
    <string msgid="7586639618712934060" name="mdtp_hour_picker_description">"Ronde schuifregelaar voor uren"</string>
    <string msgid="2674929164900463786" name="mdtp_item_is_selected">"<ns1:g id="ITEM">%1$s</ns1:g> geselecteerd"</string>
    <string msgid="6024811202872705251" name="mdtp_minute_picker_description">"Ronde schuifregelaar voor minuten"</string>
    <string msgid="3973338219107019769" name="mdtp_select_day">"Maand en dag selecteren"</string>
    <string msgid="7651068754188418859" name="mdtp_select_hours">"Uren selecteren"</string>
    <string msgid="8327182090226828481" name="mdtp_select_minutes">"Minuten selecteren"</string>
    <string msgid="2603330600102539372" name="mdtp_select_year">"Jaar selecteren"</string>
    <string msgid="6963340404644587098" name="mdtp_year_picker_description">"Jaarlijst"</string>
</resources>

redpajama_set_name: RedPajamaGithub


text:
<resources>
    <string name="app_name">Complex</string>
    <string name="real">real</string>
    <string name="imag">imag</string>
    <string name="abs">abs</string>
    <string name="deg">deg</string>
    <string name="rad">rad</string>
    <string name="rad_div_pi">rad/π</string>

    <string name="real_imag">real/imag</string>
    <string name="abs_deg">abs/deg</string>
    <string name="abs_rad">abs/rad</string>
    <string name="abs_rad_pi">abs/(rad/π)π</string>

    <string name="angle_char" translatable="false">∠</string>
    <string name="plus_i" translatable="false">+ i</string>
    <string name="pi_char" translatable="false">π</string>
    <string name="calculate">Calculate</string>

    <string name="real_part">REAL PART</string>
    <string name="imag_part">IMAGINARY PART</string>
    <string name="abs_value">ABSOLUTE</string>
    <string name="angle_in_deg">ANGLE IN DEGREES</string>
    <string name="angle_in_rad">ANGLE IN RADIANS</string>
    <string name="angle_in_rad_div_pi">ANGLE IN RADIANS DIVIDED BY PI</string>

    <string name="error">ERROR</string>
    <string name="menu_look_code">Look at source code</string>
</resources>


text:
<!doctype html>

    <meta charset="utf-8">
    <title>Bootstrap Admin</title>
    <meta content="IE=edge,chrome=1" http-equiv="X-UA-Compatible">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="description" content="">
    <meta name="author" content="">

    <link href='http://fonts.useso.com/css?family=Open+Sans:400,700' rel='stylesheet' type='text/css'>
    <link rel="stylesheet" type="text/css" href="lib/bootstrap/css/bootstrap.css">
    <link rel="stylesheet" href="lib/font-awesome/css/font-awesome.css">

    <link rel="stylesheet" type="text/css" href="stylesheets/theme.css">
    <link rel="stylesheet" type="text/css" href="stylesheets/premium.css">

    <link rel="shortcut icon" href="../assets/ico/favicon.ico">
    <link rel="apple-touch-icon-precomposed" sizes="144x144" href="../assets/ico/apple-touch-icon-144-precomposed.png">
    <link rel="apple-touch-icon-precomposed" sizes="114x114" href="../assets/ico/apple-touch-icon-114-precomposed.png">
    <link rel="apple-touch-icon-precomposed" sizes="72x72" href="../assets/ico/apple-touch-icon-72-precomposed.png">
    <link rel="apple-touch-icon-precomposed" href="../assets/ico/apple-touch-icon-57-precomposed.png">

          <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target=".navbar-collapse">
            Toggle navigation

          </button>
           Aircraft

                     Jack Smith

My Account

Admin Panel

Users

Security

Payments

Logout

 Dashboard

 Main

 User List

 User Profile

 Media

 Calendar

    <li data-popover="true" data-content="Items in this group require a premium license." rel="popover" data-placement="right"> Premium Features

- Premium features require a license -

 Enhanced Profile

 Blog

 Blog Page

 Pricing Tables

 Upgrade Account

 Widgets

 Activity Timeline

 Enhanced Users List

 Enhanced Media

 Invoice

 Advanced Tools

 Additional Color Themes

 Account +3

 Sign In

 Sign Up

 Reset Password

 Legal

 Privacy Policy

 Terms and Conditions

 Help

 Faq

 Get Premium

Edit User

Home

Users

jsmith

Profile

Password

      <form id="tab">

        Username
        <input type="text" value="jsmith" class="form-control">

        First Name
        <input type="text" value="John" class="form-control">

        Last Name
        <input type="text" value="Smith" class="form-control">

        Email
        <input type="text" value="jsmith@yourcompany.com" class="form-control">

          Address
          <textarea value="Smith" rows="3" class="form-control">2817 S 49th
Apt 314
San Jose, CA 95101</textarea>

            Time Zone
            <select name="DropDownTimezone" id="DropDownTimezone" class="form-control">
              <option value="-12.0">(GMT -12:00) Eniwetok, Kwajalein</option>
              <option value="-11.0">(GMT -11:00) Midway Island, Samoa</option>
              <option value="-10.0">(GMT -10:00) Hawaii</option>
              <option value="-9.0">(GMT -9:00) Alaska</option>
              <option selected="selected" value="-8.0">(GMT -8:00) Pacific Time (US & Canada)</option>
              <option value="-7.0">(GMT -7:00) Mountain Time (US & Canada)</option>
              <option value="-6.0">(GMT -6:00) Central Time (US & Canada), Mexico City</option>
              <option value="-5.0">(GMT -5:00) Eastern Time (US & Canada), Bogota, Lima</option>
              <option value="-4.0">(GMT -4:00) Atlantic Time (Canada), Caracas, La Paz</option>
              <option value="-3.5">(GMT -3:30) Newfoundland</option>
              <option value="-3.0">(GMT -3:00) Brazil, Buenos Aires, Georgetown</option>
              <option value="-2.0">(GMT -2:00) Mid-Atlantic</option>
              <option value="-1.0">(GMT -1:00 hour) Azores, Cape Verde Islands</option>
              <option value="0.0">(GMT) Western Europe Time, London, Lisbon, Casablanca</option>
              <option value="1.0">(GMT +1:00 hour) Brussels, Copenhagen, Madrid, Paris</option>
              <option value="2.0">(GMT +2:00) Kaliningrad, South Africa</option>
              <option value="3.0">(GMT +3:00) Baghdad, Riyadh, Moscow, St. Petersburg</option>
              <option value="3.5">(GMT +3:30) Tehran</option>
              <option value="4.0">(GMT +4:00) Abu Dhabi, Muscat, Baku, Tbilisi</option>
              <option value="4.5">(GMT +4:30) Kabul</option>
              <option value="5.0">(GMT +5:00) Ekaterinburg, Islamabad, Karachi, Tashkent</option>
              <option value="5.5">(GMT +5:30) Bombay, Calcutta, Madras, New Delhi</option>
              <option value="5.75">(GMT +5:45) Kathmandu</option>
              <option value="6.0">(GMT +6:00) Almaty, Dhaka, Colombo</option>
              <option value="7.0">(GMT +7:00) Bangkok, Hanoi, Jakarta</option>
              <option value="8.0">(GMT +8:00) Beijing, Perth, Singapore, Hong Kong</option>
              <option value="9.0">(GMT +9:00) Tokyo, Seoul, Osaka, Sapporo, Yakutsk</option>
              <option value="9.5">(GMT +9:30) Adelaide, Darwin</option>
              <option value="10.0">(GMT +10:00) Eastern Australia, Guam, Vladivostok</option>
              <option value="11.0">(GMT +11:00) Magadan, Solomon Islands, New Caledonia</option>
              <option value="12.0">(GMT +12:00) Auckland, Wellington, Fiji, Kamchatka</option>
            </select>

        </form>

        <form id="tab2">

            New Password
            <input type="password" class="form-control">

              <button class="btn btn-primary">Update</button>

        </form>

      <button class="btn btn-primary"> Save</button>
      Delete

        <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>

Delete Confirmation

Are you sure you want to delete the user?

        <button class="btn btn-default" data-dismiss="modal" aria-hidden="true">Cancel</button>
        <button class="btn btn-danger" data-dismiss="modal">Delete</button>

Collect from 网页模板

© 2014 Portnine


text:
Core* Core::_instance = nullptr;
Core* Core::getInstance()
{
    if (_instance == nullptr) {
        _instance = new Core();
    }
    return _instance;
}

Core::Core()
{

}

QQmlApplicationEngine* Core::getEngine()
{
    if (mEngine == nullptr) {
        mEngine = new QQmlApplicationEngine;
    }
    return mEngine;
}

void Core::hello()
{
    qDebug() << "hello world!";
}


text:
<?xml version="1.0" encoding="utf-8"?>
<resources>
    <color name="ns_accent">#3d5afe</color>
</resources>


text:
public class Part
{
    public string Name { get; set; }

    public int Hours { get; set; }

    public Part(string name, int hours)
    {
        this.Name = name;
        this.Hours = hours;
    }

    public override string ToString()
    {
        return $"  Part Name: {this.Name} Hours Worked: {this.Hours}";
    }
}


text:
using System.Collections.Generic;
using System.Linq;
using NSpec.Domain;
using NUnit.Framework;

namespace NSpec.Tests.WhenRunningSpecs
{
    [TestFixture]
    [Category("RunningSpecs")]
    public class describe_implicit_befores : when_running_specs
    {
        class SpecClass : nspec
        {
            void method_level_context()
            {
                List<int> ints = new List<int>();
                ints.Add(5);

                it["should have two entries"] = () =>
                {
                    ints.Add(16);
                    Assert.That(ints.Count, Is.EqualTo(1));
                };

                specify = () => Assert.That(ints.Count, Is.EqualTo(1));
            }
        }

        [Test, Ignore("It cannot be tested")]
        public void should_give_each_specify_a_new_instance_of_spec()
        {
            Run(typeof(SpecClass));
            Assert.Inconclusive("I dont think this is possible....");
            TheMethodContextExamples().First().ShouldHavePassed();
            TheMethodContextExamples().Last().ShouldHavePassed();
        }

        private IEnumerable<ExampleBase> TheMethodContextExamples()
        {
            return classContext.Contexts.First().AllExamples();
        }
    }
}


text:
[![Go Reference][goref-image]][goref-url]
[![Apache License][license-image]][license-url]

This module provides instrumentation for [`AWS Lambda`](https://docs.aws.amazon.com/lambda/latest/dg/golang-handler.html).

## Installation

```bash
go get -u go.opentelemetry.io/contrib/instrumentation/github.com/aws/aws-lambda-go/otellambda
```

## example
See [./example](https://github.com/open-telemetry/opentelemetry-go-contrib/tree/main/instrumentation/github.com/aws/aws-lambda-go/otellambda/example)

## Usage

Create a sample Lambda Go application such as below.

```go
package main

import (
	"context"
	"fmt"
	"github.com/aws/aws-lambda-go/lambda"
)

type MyEvent struct {
	Name string `json:"name"`
}

func HandleRequest(ctx context.Context, name MyEvent) (string, error) {
	return fmt.Sprintf("Hello %s!", name.Name ), nil
}

func main() {
	lambda.Start(HandleRequest)
}
```

Now use the provided wrapper to instrument your basic Lambda function:
```go
// Add import
import "go.opentelemetry.io/contrib/instrumentation/github.com/aws/aws-lambda-go/otellambda"

// wrap lambda handler function
func main() {
	lambda.Start(otellambda.InstrumentHandler(HandleRequest))
}
```

## AWS Lambda Instrumentation Options

| Options | Input Type  | Description | Default |
| --- | --- | --- | --- |
| `WithTracerProvider` | `trace.TracerProvider` | Provide a custom `TracerProvider` for creating spans. Consider using the [AWS Lambda Resource Detector][lambda-detector-url] with your tracer provider to improve tracing information. | `otel.GetTracerProvider()`
| `WithFlusher` | `otellambda.Flusher`  | This instrumentation will call the `ForceFlush` method of its `Flusher` at the end of each invocation. Should you be using asynchronous logic (such as `sddktrace's BatchSpanProcessor`) it is very import for spans to be `ForceFlush`'ed before [Lambda freezes](https://docs.aws.amazon.com/lambda/latest/dg/runtimes-context.html) to avoid data delays. | `Flusher` with noop `ForceFlush`
| `WithEventToCarrier` | `func(eventJSON []byte) propagation.TextMapCarrier{}` | Function for providing custom logic to support retrieving trace header from different event types that are handled by AWS Lambda (e.g., SQS, CloudWatch, Kinesis, API Gateway) and returning them in a `propagation.TextMapCarrier` which a Propagator can use to extract the trace header into the context. | Function which returns an empty `TextMapCarrier` - new spans will be part of a new Trace and have no parent past Lambda instrumentation span
| `WithPropagator` | `propagation.Propagator` | The `Propagator` the instrumentation will use to extract trace information into the context. | `otel.GetTextMapPropagator()` |

### Usage With Options Example

```go
var someHeaderKey = "Key" // used by propagator and EventToCarrier function to identify trace header

type mockHTTPRequest struct {
	Headers map[string][]string
	Body string
}

func mockEventToCarrier(eventJSON []byte) propagation.TextMapCarrier{
	var request mockHTTPRequest
	_ = json.unmarshal(eventJSON, &request)
	return propogation.HeaderCarrier{someHeaderKey: []string{request.Headers[someHeaderKey]}}
}

type mockPropagator struct{}
// Extract - read from `someHeaderKey`
// Inject
// Fields

func HandleRequest(ctx context.Context, request mockHTTPRequest) error {
	return fmt.Sprintf("Hello %s!", request.Body ), nil
}

func main() {
	exp, _ := stdouttrace.New()

	tp := sdktrace.NewTracerProvider(
		    sdktrace.WithBatcher(exp))

	lambda.Start(otellambda.InstrumentHandler(HandleRequest,
		                                    otellambda.WithTracerProvider(tp),
		                                    otellambda.WithFlusher(tp),
		                                    otellambda.WithEventToCarrier(mockEventToCarrier),
		                                    otellambda.WithPropagator(mockPropagator{})))
}
```

## Useful links

- For more information on OpenTelemetry, visit: <https://opentelemetry.io/>
- For more about OpenTelemetry Go: <https://github.com/open-telemetry/opentelemetry-go>
- For help or feedback on this project, join us in [GitHub Discussions][discussions-url]

## License

Apache 2.0 - See [LICENSE][license-url] for more information.

[license-url]: https://github.com/open-telemetry/opentelemetry-go-contrib/blob/main/LICENSE
[license-image]: https://img.shields.io/badge/license-Apache_2.0-green.svg?style=flat
[goref-image]: https://pkg.go.dev/badge/go.opentelemetry.io/contrib/instrumentation/github.com/aws/aws-lambda-go/otellambda.svg
[goref-url]: https://pkg.go.dev/go.opentelemetry.io/contrib/instrumentation/github.com/aws/aws-lambda-go/otellambda
[discussions-url]: https://github.com/open-telemetry/opentelemetry-go/discussions
[lambda-detector-url]: https://github.com/open-telemetry/opentelemetry-go-contrib/blob/main/detectors/aws/lambda


text:
package com.angkorteam.pluggable.framework.validation.controller;

import java.io.Serializable;

public class LinkController implements Comparable<LinkController>, Serializable {

    /**
     *
     */
    private static final long serialVersionUID = 6813010136998034798L;

    private String method;

    private String label;

    private double order;

    public String getMethod() {
        return method;
    }

    public void setMethod(String method) {
        this.method = method;
    }

    public String getLabel() {
        return label;
    }

    public void setLabel(String label) {
        this.label = label;
    }

    public double getOrder() {
        return order;
    }

    public void setOrder(double order) {
        this.order = order;
    }

    @Override
    public int compareTo(LinkController o) {
        return Double.valueOf(this.order).compareTo(o.order);
    }

}


text:
[![Build Status](https://travis-ci.org/pwm/deepend.svg?branch=master)](https://travis-ci.org/pwm/deepend)
[![codecov](https://codecov.io/gh/pwm/deepend/branch/master/graph/badge.svg)](https://codecov.io/gh/pwm/deepend)
[![Maintainability](https://api.codeclimate.com/v1/badges/5f290f7ca04ac4f032e1/maintainability)](https://codeclimate.com/github/pwm/deepend/maintainability)
[![Test Coverage](https://api.codeclimate.com/v1/badges/5f290f7ca04ac4f032e1/test_coverage)](https://codeclimate.com/github/pwm/deepend/test_coverage)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)

A library for scheduling dependent task execution.

The goal is to be able to build a network of dependent entities, eg. task ids, which can then be sorted into a correct execution order. This means that if task B depends on task A then task A comes before task B in the sorted order.

## Table of Contents

* [Requirements](#requirements)
* [Installation](#installation)
* [Usage](#usage)
* [How it works](#how-it-works)
* [Tests](#tests)
* [Changelog](#changelog)
* [Licence](#licence)

## Requirements

PHP 7.1+

## Installation

    $ composer require pwm/deepend

## Usage

Below is a simple example of creating dependencies between 4 tasks:

```php
// Create an empty store
$deepEnd = new DeepEnd();

// Add some entries, in our example they are the task ids
$deepEnd->add('t1');
$deepEnd->add('t2');
$deepEnd->add('t3');
$deepEnd->add('t4');

// Specify dependencies between them. A pointing to B, ie. an arrow from A to B,
// means that B depends on A therefore A has to happen before B can happen.
$deepEnd->draw((new Arrow)->from('t1')->to('t2'));
$deepEnd->draw((new Arrow)->from('t1')->to('t3'));
$deepEnd->draw((new Arrow)->from('t2')->to('t4'));

// Get a valid execution order
$order = $deepEnd->sort(); // $order = ['t1', 't3', 't2', 't4']
```

You can also add data (including functions and objects) to your tasks for later use. For this case use the `sortToMap()` method, which returns a map with ids as keys and the added data as values. Using the above example of 4 tasks we could do the following:

```php
function taskRunner(string $taskId, string $taskData): void
{
    echo sprintf('Running task %s with data %s ... done.', $taskId, $taskData) . PHP_EOL;
}

$deepEnd = new DeepEnd();

$deepEnd->add('t1', 't1-data');
$deepEnd->add('t2', 't2-data');
$deepEnd->add('t3', 't3-data');
$deepEnd->add('t4', 't4-data');

$deepEnd->draw((new Arrow)->from('t1')->to('t2'));
$deepEnd->draw((new Arrow)->from('t1')->to('t3'));
$deepEnd->draw((new Arrow)->from('t2')->to('t4'));

$orderedTasks = $deepEnd->sortToMap();
foreach ($orderedTasks as $taskId => $taskData) {
    taskRunner($taskId, $taskData);
}

// Running task t1 with data t1-data ... done.
// Running task t3 with data t3-data ... done.
// Running task t2 with data t2-data ... done.
// Running task t4 with data t4-data ... done.
```

## How it works

When adding entries via the `add()` method and arrows via the `draw()` method you are actually building a graph, more specifically a directed acyclic graph (DAG), where nodes are added via `add()` and edges/arrows via `draw()`.

Every time you want to draw a new arrow from node A to node B DeepEnd checks whether it would create a cycle and if the answer is yes then it will tell you in the form of an exception. The way this is done is that, before drawing the arrow, DeepEnd checks whether A is already reachable from B, ie. whether there's a path from B to A. If there is, then an arrow from A to B would lead to a cycle as you can already get from B to A and then, via the new arrow, back to B.

Once you have your graph built the `sort()` method can be used to do what is called a topological sort on your DAG. This is done using depth first search where DeepEnd incrementally indexes nodes as it leaves them after visiting. This is known as postordering. Once finished it will sort the nodes in reverse order, starting with nodes with the highest post order index. This results in an order where nodes that depend on other nodes come after their dependencies, which is the order we are after.

## Tests

	$ vendor/bin/phpunit
	$ composer phpcs
	$ composer phpstan

## Changelog

[Click here](changelog.md)

## Licence

[MIT](LICENSE)


text:
namespace extensions {

namespace keys = declarative_webrequest_constants;
namespace keys2 = url_matcher_constants;

TEST(WebRequestConditionTest, CreateCondition) {
  // Necessary for TestURLRequest.
  MessageLoop message_loop(MessageLoop::TYPE_IO);
  URLMatcher matcher;

  std::string error;
  scoped_ptr<WebRequestCondition> result;

  // Test wrong condition name passed.
  error.clear();
  result = WebRequestCondition::Create(
      matcher.condition_factory(),
      *base::test::ParseJson(
          "{ \"invalid\": \"foobar\", \n"
          "  \"instanceType\": \"declarativeWebRequest.RequestMatcher\", \n"
          "}"),
      &error);
  EXPECT_FALSE(error.empty());
  EXPECT_FALSE(result.get());

  // Test wrong datatype in host_suffix.
  error.clear();
  result = WebRequestCondition::Create(
      matcher.condition_factory(),
      *base::test::ParseJson(
          "{ \n"
          "  \"url\": [], \n"
          "  \"instanceType\": \"declarativeWebRequest.RequestMatcher\", \n"
          "}"),
      &error);
  EXPECT_FALSE(error.empty());
  EXPECT_FALSE(result.get());

  // Test success (can we support multiple criteria?)
  error.clear();
  result = WebRequestCondition::Create(
      matcher.condition_factory(),
      *base::test::ParseJson(
          "{ \n"
          "  \"resourceType\": [\"main_frame\"], \n"
          "  \"url\": { \"hostSuffix\": \"example.com\" }, \n"
          "  \"instanceType\": \"declarativeWebRequest.RequestMatcher\", \n"
          "}"),
      &error);
  EXPECT_EQ("", error);
  ASSERT_TRUE(result.get());

  URLMatcherConditionSet::Vector url_matcher_condition_set;
  result->GetURLMatcherConditionSets(&url_matcher_condition_set);
  matcher.AddConditionSets(url_matcher_condition_set);

  net::TestURLRequestContext context;
  const GURL http_url("http://www.example.com");
  net::TestURLRequest match_request(http_url, NULL, &context);
  WebRequestData data(&match_request, ON_BEFORE_REQUEST);
  WebRequestDataWithMatchIds request_data(&data);
  request_data.url_match_ids = matcher.MatchURL(http_url);
  EXPECT_EQ(1u, request_data.url_match_ids.size());
  content::ResourceRequestInfo::AllocateForTesting(
      &match_request, ResourceType::MAIN_FRAME, NULL, -1, -1);
  EXPECT_TRUE(result->IsFulfilled(request_data));

  const GURL https_url("https://www.example.com");
  net::TestURLRequest wrong_resource_type(https_url, NULL, &context);
  data.request = &wrong_resource_type;
  request_data.url_match_ids = matcher.MatchURL(http_url);
  // Make sure IsFulfilled does not fail because of URL matching.
  EXPECT_EQ(1u, request_data.url_match_ids.size());
  content::ResourceRequestInfo::AllocateForTesting(&wrong_resource_type,
      ResourceType::SUB_FRAME, NULL, -1, -1);
  EXPECT_FALSE(result->IsFulfilled(request_data));
}

TEST(WebRequestConditionTest, CreateConditionFirstPartyForCookies) {
  // Necessary for TestURLRequest.
  MessageLoop message_loop(MessageLoop::TYPE_IO);
  URLMatcher matcher;

  std::string error;
  scoped_ptr<WebRequestCondition> result;

  result = WebRequestCondition::Create(
      matcher.condition_factory(),
      *base::test::ParseJson(
          "{ \n"
          "  \"firstPartyForCookiesUrl\": { \"hostPrefix\": \"fpfc\"}, \n"
          "  \"instanceType\": \"declarativeWebRequest.RequestMatcher\", \n"
          "}"),
      &error);
  EXPECT_EQ("", error);
  ASSERT_TRUE(result.get());

  URLMatcherConditionSet::Vector url_matcher_condition_set;
  result->GetURLMatcherConditionSets(&url_matcher_condition_set);
  matcher.AddConditionSets(url_matcher_condition_set);

  net::TestURLRequestContext context;
  const GURL http_url("http://www.example.com");
  const GURL first_party_url("http://fpfc.example.com");
  net::TestURLRequest match_request(http_url, NULL, &context);
  WebRequestData data(&match_request, ON_BEFORE_REQUEST);
  WebRequestDataWithMatchIds request_data(&data);
  request_data.url_match_ids = matcher.MatchURL(http_url);
  EXPECT_EQ(0u, request_data.url_match_ids.size());
  request_data.first_party_url_match_ids = matcher.MatchURL(first_party_url);
  EXPECT_EQ(1u, request_data.first_party_url_match_ids.size());
  content::ResourceRequestInfo::AllocateForTesting(
      &match_request, ResourceType::MAIN_FRAME, NULL, -1, -1);
  EXPECT_TRUE(result->IsFulfilled(request_data));
}

// Conditions without UrlFilter attributes need to be independent of URL
// matching results. We test here that:
//   1. A non-empty condition without UrlFilter attributes is fulfilled iff its
//      attributes are fulfilled.
//   2. An empty condition (in particular, without UrlFilter attributes) is
//      always fulfilled.
TEST(WebRequestConditionTest, NoUrlAttributes) {
  // Necessary for TestURLRequest.
  MessageLoop message_loop(MessageLoop::TYPE_IO);
  URLMatcher matcher;
  std::string error;

  // The empty condition.
  error.clear();
  scoped_ptr<WebRequestCondition> condition_empty = WebRequestCondition::Create(
      matcher.condition_factory(),
      *base::test::ParseJson(
          "{ \n"
          "  \"instanceType\": \"declarativeWebRequest.RequestMatcher\", \n"
          "}"),
      &error);
  EXPECT_EQ("", error);
  ASSERT_TRUE(condition_empty.get());

  // A condition without a UrlFilter attribute, which is always true.
  error.clear();
  scoped_ptr<WebRequestCondition> condition_no_url_true =
      WebRequestCondition::Create(
          matcher.condition_factory(),
          *base::test::ParseJson(
              "{ \n"
              "  \"instanceType\": \"declarativeWebRequest.RequestMatcher\", \n"
              // There is no "1st party for cookies" URL in the requests below,
              // therefore all requests are considered first party for cookies.
              "  \"thirdPartyForCookies\": false, \n"
              "}"),
          &error);
  EXPECT_EQ("", error);
  ASSERT_TRUE(condition_no_url_true.get());

  // A condition without a UrlFilter attribute, which is always false.
  error.clear();
  scoped_ptr<WebRequestCondition> condition_no_url_false =
      WebRequestCondition::Create(
          matcher.condition_factory(),
          *base::test::ParseJson(
              "{ \n"
              "  \"instanceType\": \"declarativeWebRequest.RequestMatcher\", \n"
              "  \"thirdPartyForCookies\": true, \n"
              "}"),
          &error);
  EXPECT_EQ("", error);
  ASSERT_TRUE(condition_no_url_false.get());

  net::TestURLRequestContext context;
  net::TestURLRequest https_request(
      GURL("https://www.example.com"), NULL, &context);

  // 1. A non-empty condition without UrlFilter attributes is fulfilled iff its
  //    attributes are fulfilled.
  WebRequestData data(&https_request, ON_BEFORE_REQUEST);
  EXPECT_FALSE(
      condition_no_url_false->IsFulfilled(WebRequestDataWithMatchIds(&data)));

  data = WebRequestData(&https_request, ON_BEFORE_REQUEST);
  EXPECT_TRUE(
      condition_no_url_true->IsFulfilled(WebRequestDataWithMatchIds(&data)));

  // 2. An empty condition (in particular, without UrlFilter attributes) is
  //    always fulfilled.
  data = WebRequestData(&https_request, ON_BEFORE_REQUEST);
  EXPECT_TRUE(condition_empty->IsFulfilled(WebRequestDataWithMatchIds(&data)));
}

TEST(WebRequestConditionTest, CreateConditionSet) {
  // Necessary for TestURLRequest.
  MessageLoop message_loop(MessageLoop::TYPE_IO);
  URLMatcher matcher;

  WebRequestConditionSet::AnyVector conditions;
  conditions.push_back(linked_ptr<base::Value>(base::test::ParseJson(
      "{ \n"
      "  \"instanceType\": \"declarativeWebRequest.RequestMatcher\", \n"
      "  \"url\": { \n"
      "    \"hostSuffix\": \"example.com\", \n"
      "    \"schemes\": [\"http\"], \n"
      "  }, \n"
      "}").release()));
  conditions.push_back(linked_ptr<base::Value>(base::test::ParseJson(
      "{ \n"
      "  \"instanceType\": \"declarativeWebRequest.RequestMatcher\", \n"
      "  \"url\": { \n"
      "    \"hostSuffix\": \"example.com\", \n"
      "    \"hostPrefix\": \"www\", \n"
      "    \"schemes\": [\"https\"], \n"
      "  }, \n"
      "}").release()));

  // Test insertion
  std::string error;
  scoped_ptr<WebRequestConditionSet> result =
      WebRequestConditionSet::Create(matcher.condition_factory(),
                                     conditions, &error);
  EXPECT_EQ("", error);
  ASSERT_TRUE(result.get());
  EXPECT_EQ(2u, result->conditions().size());

  // Tell the URLMatcher about our shiny new patterns.
  URLMatcherConditionSet::Vector url_matcher_condition_set;
  result->GetURLMatcherConditionSets(&url_matcher_condition_set);
  matcher.AddConditionSets(url_matcher_condition_set);

  // Test that the result is correct and matches http://www.example.com and
  // https://www.example.com
  GURL http_url("http://www.example.com");
  net::TestURLRequestContext context;
  net::TestURLRequest http_request(http_url, NULL, &context);
  WebRequestData data(&http_request, ON_BEFORE_REQUEST);
  WebRequestDataWithMatchIds request_data(&data);
  request_data.url_match_ids = matcher.MatchURL(http_url);
  EXPECT_EQ(1u, request_data.url_match_ids.size());
  EXPECT_TRUE(result->IsFulfilled(*(request_data.url_match_ids.begin()),
                                  request_data));

  GURL https_url("https://www.example.com");
  request_data.url_match_ids = matcher.MatchURL(https_url);
  EXPECT_EQ(1u, request_data.url_match_ids.size());
  net::TestURLRequest https_request(https_url, NULL, &context);
  data.request = &https_request;
  EXPECT_TRUE(result->IsFulfilled(*(request_data.url_match_ids.begin()),
                                  request_data));

  // Check that both, hostPrefix and hostSuffix are evaluated.
  GURL https_foo_url("https://foo.example.com");
  request_data.url_match_ids = matcher.MatchURL(https_foo_url);
  EXPECT_EQ(0u, request_data.url_match_ids.size());
  net::TestURLRequest https_foo_request(https_foo_url, NULL, &context);
  data.request = &https_foo_request;
  EXPECT_FALSE(result->IsFulfilled(-1, request_data));
}

TEST(WebRequestConditionTest, TestPortFilter) {
  // Necessary for TestURLRequest.
  MessageLoop message_loop(MessageLoop::TYPE_IO);
  URLMatcher matcher;

  WebRequestConditionSet::AnyVector conditions;
  conditions.push_back(linked_ptr<base::Value>(base::test::ParseJson(
      "{ \n"
      "  \"instanceType\": \"declarativeWebRequest.RequestMatcher\", \n"
      "  \"url\": { \n"
      "    \"ports\": [80, [1000, 1010]], \n"  // Allow 80;1000-1010.
      "    \"hostSuffix\": \"example.com\", \n"
      "  }, \n"
      "}").release()));

  // Test insertion
  std::string error;
  scoped_ptr<WebRequestConditionSet> result =
      WebRequestConditionSet::Create(matcher.condition_factory(),
                                     conditions, &error);
  EXPECT_EQ("", error);
  ASSERT_TRUE(result.get());
  EXPECT_EQ(1u, result->conditions().size());

  // Tell the URLMatcher about our shiny new patterns.
  URLMatcherConditionSet::Vector url_matcher_condition_set;
  result->GetURLMatcherConditionSets(&url_matcher_condition_set);
  matcher.AddConditionSets(url_matcher_condition_set);

  std::set<URLMatcherConditionSet::ID> url_match_ids;

  // Test various URLs.
  GURL http_url("http://www.example.com");
  net::TestURLRequestContext context;
  net::TestURLRequest http_request(http_url, NULL, &context);
  url_match_ids = matcher.MatchURL(http_url);
  ASSERT_EQ(1u, url_match_ids.size());

  GURL http_url_80("http://www.example.com:80");
  net::TestURLRequest http_request_80(http_url_80, NULL, &context);
  url_match_ids = matcher.MatchURL(http_url_80);
  ASSERT_EQ(1u, url_match_ids.size());

  GURL http_url_1000("http://www.example.com:1000");
  net::TestURLRequest http_request_1000(http_url_1000, NULL, &context);
  url_match_ids = matcher.MatchURL(http_url_1000);
  ASSERT_EQ(1u, url_match_ids.size());

  GURL http_url_2000("http://www.example.com:2000");
  net::TestURLRequest http_request_2000(http_url_2000, NULL, &context);
  url_match_ids = matcher.MatchURL(http_url_2000);
  ASSERT_EQ(0u, url_match_ids.size());
}

// Create a condition with two attributes: one on the request header and one on
// the response header. The Create() method should fail and complain that it is
// impossible that both conditions are fulfilled at the same time.
TEST(WebRequestConditionTest, ConditionsWithConflictingStages) {
  // Necessary for TestURLRequest.
  MessageLoop message_loop(MessageLoop::TYPE_IO);
  URLMatcher matcher;

  std::string error;
  scoped_ptr<WebRequestCondition> result;

  // Test error on incompatible application stages for involved attributes.
  error.clear();
  result = WebRequestCondition::Create(
      matcher.condition_factory(),
      *base::test::ParseJson(
          "{ \n"
          "  \"instanceType\": \"declarativeWebRequest.RequestMatcher\", \n"
          // Pass a JS array with one empty object to each of the header
          // filters.
          "  \"requestHeaders\": [{}], \n"
          "  \"responseHeaders\": [{}], \n"
          "}"),
      &error);
  EXPECT_FALSE(error.empty());
  EXPECT_FALSE(result.get());
}

}  // namespace extensions


text:
package slogo.nodes;

import slogo.interpreter.EngineController;

public class ConstantNode extends NodeObject {
	private double myValue;

	public ConstantNode(String value, String rawString, NodeObject parent) {
		super(value, rawString, parent);
		myValue = Double.parseDouble(value);
	}

	@Override
	public boolean hasCompleteChildren() {
		return true;
	}

	@Override
	public void addChild(NodeObject node) {
		// TODO Auto-generated method stub

	}

	@Override
	public boolean canAdd() {
		return false;
	}

	@Override
	public double traverseAndExecute(EngineController controller) {
		return myValue;
	}

}


text:
using System;
using SharpChannels.Core.Channels;
using SharpChannels.Core.Messages;

namespace SharpChannels.Core.Communication
{
    public interface IBusServer<TMessage> where TMessage : IMessage
    {
        int SubscriprionNumber { get; }
        event EventHandler<ExceptionEventArgs> CommunicationFailed;
        event EventHandler<ClientAcceptedEventArgs> ClientConnected;
    }
}


text:
package org.aikodi.rejuse.data.tree.walker;

import org.aikodi.rejuse.data.tree.TreeStructure;

/**
 * A walker that applies the given walker to the children of a tree node.
 *
 * @author Marko van Dooren
 *
 * @param <T> The type of the elements in the trees.
 * @param <E> The type of exceptions that can be thrown by this walker.
 */
public class ChildWalker<T, E extends Exception> implements TreeWalker<T, E> {

  /**
   * The walker that will process the children of the top
   * of the traversed trees.
   * The walker is not null.
   */
  private TreeWalker<T, ? extends E> _walker;

	/**
	 * Create a new recurse walker that applies the given walker
	 * to the children of the top of the traversed tree.
	 *
	 * @param walker The walker that will process the children of the top
   *               of the traversed trees.
   *               The walker cannot be null.
	 */
  public ChildWalker(TreeWalker<T, ? extends E> walker) {
  	if (walker == null) {
  		throw new IllegalArgumentException("The walker cannot be null.");
  	}
    _walker = walker;
  }

  /**
   * Return the walker that will process the children of the top
   * of the traversed trees.
   *
   * @return The walker that will process the children of the top
   *         of the traversed trees.
   *         The result is not null.
   */
  public TreeWalker<T, ? extends E> walker() {
    return _walker;
  }

  /**
   * Let the walker of this child walker traverse the children of
   * the top of the given tree.
   */
  @Override
  public <X extends T, N extends Exception> void traverse(TreeStructure<X, N> tree) throws E, N {
  	if (tree == null) {
  		throw new IllegalArgumentException("The tree cannot be null.");
  	}
    for (TreeStructure<? extends X, N> child : tree.branches()) {
      walker().enter(child);
      walker().traverse(child);
      walker().exit(child);
    }
  }

}


text:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="60dp"
    android:layout_gravity="center_vertical"
    android:background="@drawable/bar_white"
    android:gravity="center_vertical"
    android:orientation="horizontal"
    android:paddingEnd="20dp"
    android:paddingLeft="20dp"
    android:paddingRight="20dp"
    android:paddingStart="20dp">

    <ImageView
        android:id="@+id/title_icon"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:contentDescription="@string/hello_world" />

    <TextView
        android:id="@+id/title"
        style="@style/TextGrisLarge"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_marginLeft="20dp"
        android:layout_marginStart="20dp"
        android:layout_weight="1" />

</LinearLayout>


text:
import re

from google.appengine.api import users
from google.appengine.ext import webapp
from google.appengine.api.urlfetch import DownloadError

from library import logins3

class BucketErzeugen(webapp.RequestHandler):
    def post(self):
        mobile = self.request.get('mobile')
        if mobile != "true":
            mobile = "false"
        # self.response.out.write('posted!')
        # Die Eingabe aus dem Formular holen
        neuerbucketname = self.request.get('bucketname')

        # Den Usernamen erfahren
        username = users.get_current_user()

        if neuerbucketname == "":
          # Testen ob ein Name für den neuen key angegeben wurde
          # Wenn kein Name angegeben wurde, kann kein Key angelegt werden
          #fehlermeldung = "Sie haben keine Namen angegeben"
          fehlermeldung = "92"
          self.redirect('/s3?mobile='+str(mobile)+'&message='+fehlermeldung)
        elif re.search(r'[^\-.a-zA-Z0-9]', neuerbucketname) != None:
          # Testen ob der Name für den neuen key nicht erlaubte Zeichen enthält
          fehlermeldung = "106"
          self.redirect('/s3?mobile='+str(mobile)+'&message='+fehlermeldung)
        else:
          # Mit S3 verbinden
          conn_s3 = logins3(username)
          try:
            # Liste der Buckets
            liste_buckets = conn_s3.get_all_buckets()
          except:
            # Wenn es nicht klappt...
            fehlermeldung = "107"
            self.redirect('/s3?mobile='+str(mobile)+'&message='+fehlermeldung)
          else:
            # Wenn es geklappt hat...
            # Variable erzeugen zum Erfassen, ob der neue Bucket schon existiert
            laenge_liste_buckets = len(liste_buckets)

            # Variable erzeugen zum Erfassen, ob der neue Bucket schon existiert
            schon_vorhanden = 0
            for i in range(laenge_liste_buckets):
              # Bucket-Namen in einen String umwandeln
              vergleich = str(liste_buckets[i].name)
              # Vergleichen
              if vergleich == neuerbucketname:
                # Bucket-Name existiert schon!
                schon_vorhanden = 1

            if schon_vorhanden == 0:
              # Wenn man noch keinen Bucket mit dem eingegebenen Namen besitzt...
              try:
                # Versuch den Bucket anzulegen
                conn_s3.create_bucket(neuerbucketname)
              except:
                fehlermeldung = "107"
                # Wenn es nicht klappt...
                self.redirect('/s3?mobile='+str(mobile)+'&message='+fehlermeldung)
              else:
                fehlermeldung = "105"
                # Wenn es geklappt hat...
                self.redirect('/s3?mobile='+str(mobile)+'&message='+fehlermeldung)
            else:
              # Wenn man schon einen Bucket mit dem eingegeben Namen hat...
              fehlermeldung = "108"
              self.redirect('/s3?mobile='+str(mobile)+'&message='+fehlermeldung)


text:
/*
This simple analog for an audio decoder just adds 1 to the numbers
received. This way, we can consider odd numbers to be encoded audio,
and even numbers to be decoded audio samples
*/

import { addGetters } from 'properties-and-events'
import { TransformStream } from './streams'
import StreamWrapper from './StreamWrapper'

export default class Decoder extends StreamWrapper {
  constructor () {
    super()
    addGetters(this, 'stream')
    this._stream = new TransformStream({
      transform (chunk, controller) {
        return controller.enqueue(chunk + 1)
      }
    })
  }
}


text:
package org.grassroot.android.activities;

import android.support.v4.app.Fragment;

/**
 * Created by paballo on 2016/05/16.
 */
public class WelcomeFragment extends Fragment {
}


text:
/*************************************************************************/
/*  audio_stream.h                                                       */
/*************************************************************************/
/*                       This file is part of:                           */
/*                           GODOT ENGINE                                */
/*                      https://godotengine.org                          */
/*************************************************************************/
/* Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur.                 */
/* Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md)    */
/*                                                                       */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the       */
/* "Software"), to deal in the Software without restriction, including   */
/* without limitation the rights to use, copy, modify, merge, publish,   */
/* distribute, sublicense, and/or sell copies of the Software, and to    */
/* permit persons to whom the Software is furnished to do so, subject to */
/* the following conditions:                                             */
/*                                                                       */
/* The above copyright notice and this permission notice shall be        */
/* included in all copies or substantial portions of the Software.       */
/*                                                                       */
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,       */
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF    */
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY  */
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,  */
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE     */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.                */
/*************************************************************************/

#ifndef AUDIO_STREAM_H
#define AUDIO_STREAM_H

#include "image.h"
#include "resource.h"
#include "servers/audio/audio_filter_sw.h"
#include "servers/audio_server.h"

class AudioStreamPlayback : public Reference {

	GDCLASS(AudioStreamPlayback, Reference)

public:
	virtual void start(float p_from_pos = 0.0) = 0;
	virtual void stop() = 0;
	virtual bool is_playing() const = 0;

	virtual int get_loop_count() const = 0; //times it looped

	virtual float get_playback_position() const = 0;
	virtual void seek(float p_time) = 0;

	virtual void mix(AudioFrame *p_buffer, float p_rate_scale, int p_frames) = 0;
};

class AudioStreamPlaybackResampled : public AudioStreamPlayback {

	GDCLASS(AudioStreamPlaybackResampled, AudioStreamPlayback)

	enum {
		FP_BITS = 16, //fixed point used for resampling
		FP_LEN = (1 << FP_BITS),
		FP_MASK = FP_LEN - 1,
		INTERNAL_BUFFER_LEN = 256,
		CUBIC_INTERP_HISTORY = 4
	};

	AudioFrame internal_buffer[INTERNAL_BUFFER_LEN + CUBIC_INTERP_HISTORY];
	uint64_t mix_offset;

protected:
	void _begin_resample();
	virtual void _mix_internal(AudioFrame *p_buffer, int p_frames) = 0;
	virtual float get_stream_sampling_rate() = 0;

public:
	virtual void mix(AudioFrame *p_buffer, float p_rate_scale, int p_frames);

	AudioStreamPlaybackResampled() { mix_offset = 0; }
};

class AudioStream : public Resource {

	GDCLASS(AudioStream, Resource)
	OBJ_SAVE_TYPE(AudioStream) //children are all saved as AudioStream, so they can be exchanged

protected:
	static void _bind_methods();

public:
	virtual Ref<AudioStreamPlayback> instance_playback() = 0;
	virtual String get_stream_name() const = 0;

	virtual float get_length() const = 0; //if supported, otherwise return 0
};

class AudioStreamPlaybackRandomPitch;

class AudioStreamRandomPitch : public AudioStream {

	GDCLASS(AudioStreamRandomPitch, AudioStream)
	friend class AudioStreamPlaybackRandomPitch;

	Set<AudioStreamPlaybackRandomPitch *> playbacks;
	Ref<AudioStream> audio_stream;
	float random_pitch;

protected:
	static void _bind_methods();

public:
	void set_audio_stream(const Ref<AudioStream> &p_audio_stream);
	Ref<AudioStream> get_audio_stream() const;

	void set_random_pitch(float p_pitch);
	float get_random_pitch() const;

	virtual Ref<AudioStreamPlayback> instance_playback();
	virtual String get_stream_name() const;

	virtual float get_length() const; //if supported, otherwise return 0

	AudioStreamRandomPitch();
};

class AudioStreamPlaybackRandomPitch : public AudioStreamPlayback {

	GDCLASS(AudioStreamPlaybackRandomPitch, AudioStreamPlayback)
	friend class AudioStreamRandomPitch;

	Ref<AudioStreamRandomPitch> random_pitch;
	Ref<AudioStreamPlayback> playback;
	Ref<AudioStreamPlayback> playing;
	float pitch_scale;

public:
	virtual void start(float p_from_pos = 0.0);
	virtual void stop();
	virtual bool is_playing() const;

	virtual int get_loop_count() const; //times it looped

	virtual float get_playback_position() const;
	virtual void seek(float p_time);

	virtual void mix(AudioFrame *p_buffer, float p_rate_scale, int p_frames);

	~AudioStreamPlaybackRandomPitch();
};

#endif // AUDIO_STREAM_H


text:
import React from 'react';
import { createRoot } from 'react-dom';
import { createStore, applyMiddleware, combineReducers } from 'redux';
import { Provider } from 'react-redux';
import thunk from 'redux-thunk';
import Translator from '@u-wave/translate';
import webApiRequest from '../redux/request';
import readApplicationConfig from '../utils/readApplicationConfig';
import * as reducers from './reducers';
import { setResetKey } from './actions';
import PasswordResetApp from './containers/PasswordResetApp';
import english from '../../locale/en.yaml';
import './app.css';

const config = readApplicationConfig();
const key = document.querySelector('#reset-data').textContent;

const store = createStore(
  combineReducers(reducers),
  { config },
  applyMiddleware(
    thunk,
    webApiRequest(),
  ),
);

const qs = new URL(window.location.href).searchParams;
store.dispatch(setResetKey(key || qs.get('key')));

const translator = new Translator(english.uwave);

const root = createRoot(document.querySelector('#app'));
root.render((
  <Provider store={store}>
    <PasswordResetApp translator={translator} />
  </Provider>
));


text:
using System.Collections.Immutable;
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.Diagnostics;
using Analyzer.Utilities;

namespace System.Runtime.Analyzers
{
    /// <summary>
    /// CA2216: Disposable types should declare finalizer
    /// </summary>
    public abstract class DisposableTypesShouldDeclareFinalizerAnalyzer : DiagnosticAnalyzer
    {
        internal const string RuleId = "CA2216";

        private static readonly LocalizableString s_localizableTitle = new LocalizableResourceString(nameof(SystemRuntimeAnalyzersResources.DisposableTypesShouldDeclareFinalizerTitle), SystemRuntimeAnalyzersResources.ResourceManager, typeof(SystemRuntimeAnalyzersResources));

        private static readonly LocalizableString s_localizableMessage = new LocalizableResourceString(nameof(SystemRuntimeAnalyzersResources.DisposableTypesShouldDeclareFinalizerMessage), SystemRuntimeAnalyzersResources.ResourceManager, typeof(SystemRuntimeAnalyzersResources));
        private static readonly LocalizableString s_localizableDescription = new LocalizableResourceString(nameof(SystemRuntimeAnalyzersResources.DisposableTypesShouldDeclareFinalizerDescription), SystemRuntimeAnalyzersResources.ResourceManager, typeof(SystemRuntimeAnalyzersResources));

        internal static DiagnosticDescriptor Rule = new DiagnosticDescriptor(RuleId,
                                                                             s_localizableTitle,
                                                                             s_localizableMessage,
                                                                             DiagnosticCategory.Usage,
                                                                             DiagnosticSeverity.Warning,
                                                                             isEnabledByDefault: false,
                                                                             description: s_localizableDescription,
                                                                             helpLinkUri: null,     // TODO: add MSDN url
                                                                             customTags: WellKnownDiagnosticTags.Telemetry);

        public override ImmutableArray<DiagnosticDescriptor> SupportedDiagnostics => ImmutableArray.Create(Rule);

        public override void Initialize(AnalysisContext analysisContext)
        {

        }
    }
}


text:
from django import forms

from ..nospam import utils
from .fields import HoneypotField

class BaseForm(forms.Form):

    def __init__(self, request, *args, **kwargs):
        self._request = request
        super(BaseForm, self).__init__(*args, **kwargs)

class AkismetForm(BaseForm):

    akismet_fields = {
            'comment_author': 'name',
            'comment_author_email': 'email',
            'comment_author_url': 'url',
            'comment_content': 'comment',
            }
    akismet_api_key = None

    def akismet_check(self):
        fields = {}
        for key, value in self.akismet_fields.items():
            fields[key] = self.cleaned_data[value]
        return utils.akismet_check(self._request, akismet_api_key=self.akismet_api_key, **fields)

class RecaptchaForm(BaseForm):
    pass

class HoneyPotForm(BaseForm):
    accept_terms = HoneypotField()

class SuperSpamKillerForm(RecaptchaForm, HoneyPotForm, AkismetForm):
    pass


text:
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Cognito.StripeClient.Arguments
{
	public class AuthenticationArguments : BaseArguments
	{
		[JsonProperty("client_secret")]
		public string ClientSecret { get; set; }
		public string Code { get; set; }
		[JsonProperty("grant_type")]
		public string GrantType { get; set; }
		[JsonProperty("refresh_token")]
		public string RefreshToken { get; set; }
	}

	public class DeauthorizeArguments : BaseArguments
	{
		[JsonProperty("client_id")]
		public string ClientId { get; set; }
		[JsonProperty("_user_id")]
		public string AccountId { get; set; }
	}
}


text:
const dgram = require('dgram');

class UDPClient {
	constructor(host,port) {
		this.client = dgram.createSocket("udp4");
		this.host = host;
		this.port = port;
	}

	connect(callback) {
		callback();
	}

	close(callback) {
		callback();
	}

	send(msg, callback) {
		this.client.send(msg, 0, msg.length, this.port, this.host, callback);
	}
}

module.exports = UDPClient;


text:
    <button type="button" class="close" data-dismiss="modal" aria-hidden="true" ng-click="cancel()"></button>

Delete Matrix

 Are you sure you want to delete this matrix?

    <button class="btn btn-primary" type="button" ng-click="create()"> Yes</button>
    <button class="btn btn-warning" type="button" ng-click="cancel()"> No</button>


text:
import React, { Component } from 'react';
import { Chart, Axis, Tooltip, Geom } from 'bizcharts';
import styles from './style.css';

class Bar extends Component {
    state = {
        autoHideXLabels: false
    };

    componentDidMount() {
        window.addEventListener('resize', this.resize);
    }

    componentWillUnmount() {
        window.removeEventListener('resize', this.resize);
    }

    resize() {
        if (!this.node) {
            return;
        }
        const canvasWidth = this.node.parentNode.clientWidth;
        const { data = [], autoLabel = true } = this.props;
        if (!autoLabel) {
            return;
        }
        const minWidth = data.length * 30;
        const { autoHideXLabels } = this.state;

        if (canvasWidth <= minWidth) {
            if (!autoHideXLabels) {
                this.setState({
                    autoHideXLabels: true
                });
            }
        } else if (autoHideXLabels) {
            this.setState({
                autoHideXLabels: false
            });
        }
    }

    handleRoot = n => {
        this.root = n;
    };

    handleRef = n => {
        this.node = n;
    };

    render() {
        const {
            height,
            title,
            forceFit = true,
            data,
            color = 'rgba(24, 144, 255, 0.85)',
            padding
            } = this.props;

        const { autoHideXLabels } = this.state;

        const scale = {
            x: {
                type: 'cat',
                alias: 'time',
                tickCount: 10
            },
            y: {
                min: 0,
                alias: 'count'
            }
        };

        const tooltip = [
            'x*y',
            (x, y) => ({
                name: x,
                value: y
            })
        ];

        return (

                    {title &&
{title}
}
                    <Chart
                        scale={scale}
                        height={title ? height - 41 : height}
                        forceFit={forceFit}
                        data={data}
                        padding={padding || 'auto'}
                        >
                        <Axis
                            name="x"
                            title={false}
                            label={autoHideXLabels ? false : {}}
                            tickLine={autoHideXLabels ? false : {}}
                            />
                        <Axis name="y" min={0}/>
                        <Tooltip showTitle={false} crosshairs={false}/>
                        <Geom type="line" position="x*y" color={color} tooltip={tooltip}/>
                    </Chart>

        );
    }
}

export default Bar;


text:
class Tee < ActiveRecord::Base
  belongs_to :colour

  ThinkingSphinx::Callbacks.append(self, :behaviours => [:sql])
  ThinkingSphinx::Callbacks.append(
    self, behaviours: [:sql, :deltas], :path => [:colour]
  )
end


text:
package org.apache.sshd.util.test;

import java.io.IOException;

import org.apache.sshd.client.future.DefaultOpenFuture;
import org.apache.sshd.client.future.OpenFuture;
import org.apache.sshd.common.channel.AbstractChannel;
import org.apache.sshd.common.channel.Channel;
import org.apache.sshd.common.channel.throttle.ChannelStreamWriter;
import org.apache.sshd.common.channel.throttle.ChannelStreamWriterResolver;
import org.apache.sshd.common.channel.throttle.DefaultChannelStreamWriter;
import org.apache.sshd.common.util.buffer.Buffer;

public class BogusChannel extends AbstractChannel {
    public BogusChannel() {
        super(false);
    }

    @Override
    protected void doWriteData(byte[] data, int off, long len) throws IOException {
        // ignored
    }

    @Override
    protected void doWriteExtendedData(byte[] data, int off, long len) throws IOException {
        // ignored
    }

    @Override
    protected void sendWindowAdjust(long len) throws IOException {
        // ignored
    }

    @Override
    public OpenFuture open(long recipient, long rwsize, long rmpsize, Buffer buffer) {
        return new DefaultOpenFuture(this, this.futureLock);
    }

    @Override
    public void handleOpenSuccess(long recipient, long rwsize, long rmpsize, Buffer buffer) throws IOException {
        // ignored
    }

    @Override
    public void handleOpenFailure(Buffer buffer) throws IOException {
        // ignored
    }

    @Override
    public ChannelStreamWriterResolver getChannelStreamWriterResolver() {
        return ChannelStreamWriterResolver.NONE;
    }

    @Override
    public ChannelStreamWriter resolveChannelStreamWriter(Channel channel, byte cmd) {
        return new DefaultChannelStreamWriter(channel);
    }

}


text:
         {{ 'rrOverride_request' | translate }}

{{ 'httpRun_httpMethod' | translate }}

            <select *ngIf="model" [(ngModel)]="model.method" (ngModelChange)="changeValue()">
                <option value="no">{{ 'apiProxy_noOverride' | translate }}</option>
                <option *ngFor="let method of availableMethods" [value]="method">{{method.toUpperCase()}}</option>
            </select>

            <pair-list *ngIf="paramsOptions"
                        [options]="paramsOptions"
                        addButtonLabel="{{ 'httpRun_addParameter' | translate}}"
                        emptyLabel="{{ 'httpRun_noQuery' | translate }}"
                        title="{{ 'httpRun_query' | translate }}"
                        (valueChanges)="paramsValueChanges($event)">

            </pair-list>

            <pair-list *ngIf="headerOptions"
                        [options]="headerOptions"
                        addButtonLabel="{{ 'httpRun_addHeader' | translate}}"
                        emptyLabel="{{ 'httpRun_noHeaders' | translate }}"
                        title="{{ 'httpRun_headers' | translate }}"
                        (valueChanges)="headerValueChanges($event)">

            </pair-list>

         {{ 'rrOverride_response' | translate }}

                    {{ 'rrOverride_code' | translate }}

                <input type="text" [(ngModel)]="model.statusCode" (ngModelChange)="changeValue()">

                    {{ 'rrOverride_message' | translate }}

                <input type="text" [(ngModel)]="model.statusReason" (ngModelChange)="changeValue()">

            <pair-list *ngIf="responseHeaderOptions"
                        [options]="responseHeaderOptions"
                        addButtonLabel="{{ 'httpRun_addHeader' | translate}}"
                        emptyLabel="{{ 'httpRun_noHeaders' | translate }}"
                        title="{{ 'httpRun_headers' | translate }}"
                        (valueChanges)="responseHeaderValueChanges($event)">

            </pair-list>

            {{ 'rrOverride_boby' | translate }}


text:
package com.strato.hidrive.api.oauth;

public final class OAuthConst {
	public static final String OAUTH_CALLBACK_HOST = "localhost";
	public static final String GRAND_TYPE = "refresh_token";
	public static final String AUTH_CODE_QUERY_KEY = "code";
	public static final String AUTH_SCOPE_QUERY_KEY = "scope";
	public static final String LOGIN_URL = "https://www.hidrive.strato.com/oauth2/authorize?response_type=code&client_id=%s&lang=%s&scope=%s";
	public static final String OAUTH_TOKEN_URL = "https://www.hidrive.strato.com";
	public static final String MINIMAL_SCOPE = "rw";
	public static final String[] LOGIN_PAGE_SUPPORTED_LANGUAGES = new String[] {"de", "en", "es", "fr", "it", "nl", "pt"};
	public static final String LOGIN_PAGE_DEFAULT_LANGUAGE = "en";
}


text:
package edu.sdsmt.csc476.example;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;

import edu.sdsmt.csc476.example.service.simple.R;

public class MainActivity extends Activity
{

	private Intent _intentService;
	private Button _buttonStartService;
	private Button _buttonStopService;

	@Override
	protected void onCreate(Bundle savedInstanceState)
	{
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_main);

		_intentService = new Intent(this, SimpleService.class);

		_buttonStartService = (Button) findViewById(R.id.buttonStartService);
		_buttonStartService.setOnClickListener(new OnClickListener()
		{
			@Override
			public void onClick(View view)
			{
				startService(_intentService);
			}
		});

		_buttonStopService = (Button) findViewById(R.id.buttonStopService);
		_buttonStopService.setOnClickListener(new OnClickListener()
		{
			@Override
			public void onClick(View view)
			{
				stopService(_intentService);
			}
		});

	}
}


text:
package com.luiges90.sq.behaviour;

import com.luiges90.sq.GameField;
import com.luiges90.sq.MovingEntity;
import com.luiges90.sq.R;
import com.luiges90.sq.enemy.BaseEnemy;

public class TeleportOnHit implements OnDestroyBehaviour {

    /**
     *
     */
    private static final long serialVersionUID = 1443782866814193676L;

    @Override
    public boolean isDestroyed(MovingEntity owner, GameField field) {
        return true;
    }

    @Override
    public void onHit(MovingEntity owner, GameField field) {
        owner.setPosition(BaseEnemy.initPosition(field.getPlayerPosition()));
        field.getSoundPlayer().playSound(R.raw.teleport);
    }

    @Override
    public void onDestroy(MovingEntity owner, GameField field) {
        // no-op

    }

}