text:
#pragma once

// includes
// std
#include <cassert>

// Eigen
#include <Eigen/Core>

// eigen-qld
#include "eigen_qld_api.h"

namespace Eigen
{
extern "C" int ql_(const int * m,
                   const int * me,
                   const int * mmax,
                   const int * n,
                   const int * nmax,
                   const int * mnn,
                   const double * c,
                   const double * d,
                   const double * a,
                   const double * b,
                   const double * xl,
                   const double * xu,
                   double * x,
                   double * u,
                   const double * eps,
                   const int * mode,
                   const int * iout,
                   int * ifail,
                   const int * iprint,
                   double * war,
                   int * lwar,
                   int * iwar,
                   int * liwar);

/** \brief A lightweight wrapper of the ql algorithm by Professor Schittkowski.
 * It handles the workspace memory to be passed to the solver along with the problem.
 */
class QLDDirect
{
public:
  /** Create a solver without allocating memory.
   * A call to QLDDirect::problem will be necessary before calling QLDDirect::solve
   */
  EIGEN_QLD_API QLDDirect();

  /** Create a solver and allocate the memory necessary to solve a problem with the given dimensions.
   * See also QLDDirect::problem
   */
  EIGEN_QLD_API QLDDirect(int nrvar, int nreq, int nrineq, int ldq = -1, int lda = -1, bool verbose = false);

  /** Specify a file number for output (Fortran unit specification).*/
  EIGEN_QLD_API void fdOut(int fd);
  /** Get the file number used for output*/
  EIGEN_QLD_API int fdOut() const;

  /** Specify if QLD must generate outputs or not.*/
  EIGEN_QLD_API void verbose(bool v);
  /** Check if QLD must generate outputs or not.*/
  EIGEN_QLD_API bool verbose() const;

  /** Return the fail code of the last call to QLDDirect::solve. 0 means succes.*/
  EIGEN_QLD_API int fail() const;

  /** Allocate the memory necessary to solve a problem with the given dimensions.
   * \param nrvar Size of the variable vector \f$x\f$.
   * \param nreq Number of equality constraints, i.e. the row size of \f$A_{eq}\f$.
   * \param nrineq Number of inequality constraints, i.e. the row size of \f$A_{ineq}\f$.
   * \param ldq Leading dimension of the matrix \f$Q\f$ (see below). If smaller than
   * \p nrvar, \p nrvar will be used instead (which is the default case).
   * \param lda Leading dimension of the matrix
   * \f$A = \begin{bmatrix} A_{eq} \\ A_{ineq} \end{bmatrix} \f$. If smaller
   * than \p nreq + \p nrineq, it will be set to this value (which is the default case).
   *
   * \note For a column-major matrix (which is the default case in Eigen and what QLD
   * is expecting), the matrix values are stored in a simple, 1-d array, one column
   * after the other. Often the column are place in this arry one right after the other
   * but this needs not be the case: there can be unused values in the array between
   * the values of two columns. The offset between the start of two consecutive columns
   * in the array is called the leading dimension. For a matrix \a M with leading dimension
   * \a ld, and data ordered in an array \a data, element M(i,j) is found at data[i+ld*j]. \n
   * As an example, consider the matrix
   * \f{align}{ \begin{bmatrix} 4 & 3 & 7 & 2 \\ 2 & 8 & 1 & 5 \\ 6 & 5 & 1 & 2 \end{bmatrix}
   * \f}
   * It can be stored with a leading dimension of 5 as \n
   * [4, 2, 6, x, x, 3, 8, 5, x, x, 7, 1, 1, x, x, 2, 5, 2] \n
   * where the x are unimportant value with respect to this matrix.\n
   * For classical Eigen matrices like \a MatrixXd, ld is equal to the row size, but if for
   * example we consider a matrix \a B that is the block of another one \a M, the
   * leading dimension of \a B will be the row dimension of \a M.
   */
  EIGEN_QLD_API void problem(int nrvar, int nreq, int nrineq, int ldq = -1, int lda = -1);

  /** Return the result from the latest call to QLDDirect::solve. */
  EIGEN_QLD_API const VectorXd & result() const;

  /** Return the lagrange multipliers associated with results, with the multipliers
   * corresponding to equality constraints first, then to inequality constraints, then
   * lower bounds, then upper bounds.
   */
  EIGEN_QLD_API const VectorXd & multipliers() const;

  /** Solve the problem
   * \f{align}{
   *   \underset{{x} \in \mathbb{R}^n}{\text{minimize}} & \ \frac{1}{2}{x^TQx} + {c^Tx} \nonumber \\
   *   \text{subject to} & \ A_{1:m_e} x + b_{1:m_e} = 0 \\
   *   & \ A_{m_e+1:\mbox{end}} x + b_{m_e+1:\mbox{end}} \geq 0 \\
   *   & \ x_l \leq x \leq x_u
   * \f}
   *
   * For a positive definite matrix \f$Q\f$, we have the Cholesky decomposition \f$Q = R^T R\f$
   * with \f$R\f$ upper triangular. If \p isDecomp is \a true, \f$R\f$ should be given instead of \f$Q\f$.
   * Only the upper triangular part of \f$R\f$ will be used.
   *
   * \param Q The matrix \f$Q\f$, or its Cholesky factor \f$R\f$ if \p isDecomp is \a true.
   * \f$Q\f$ should be symmetric and positive definite, \f$R\f$ should be upper triangular.
   * \param c The vector \f$c\f$.
   * \param A The matrix \f$A = \begin{bmatrix} A_{eq} \\ A_{ineq} \end{bmatrix} \f$.
   * \param b The vector \f$b = \begin{bmatrix} b_{eq} \\ b_{ineq} \end{bmatrix} \f$.
   * \param xl The vector \f$x_{l}\f$.
   * \param xu The vector \f$x_{u}\f$.
   * \param nreq The number \f$m_e\f$ of equality constraints (i.e. the row size of \f$A_{eq}\f$).
   * \param isDecomp specify if the Cholesky decomposition of \f$Q\f$ is used or not.
   * \param eps Desired final accuracy.
   */
  template<typename MatObj, typename VecObj, typename MatConstr, typename VecConstr, typename VecVar>
  bool solve(const MatrixBase<MatObj> & Q,
             const MatrixBase<VecObj> & c,
             const MatrixBase<MatConstr> & A,
             const MatrixBase<VecConstr> & b,
             const MatrixBase<VecVar> & xl,
             const MatrixBase<VecVar> & xu,
             int nreq,
             bool isDecomp = false,
             double eps = 1e-12);

private:
  EIGEN_QLD_API inline int fortran_ql(const int * m,
                                      const int * me,
                                      const int * mmax,
                                      const int * n,
                                      const int * nmax,
                                      const int * mnn,
                                      const double * c,
                                      const double * d,
                                      const double * a,
                                      const double * b,
                                      const double * xl,
                                      const double * xu,
                                      double * x,
                                      double * u,
                                      const double * eps,
                                      const int * mode,
                                      const int * iout,
                                      int * ifail,
                                      const int * iprint,
                                      double * war,
                                      int * lwar,
                                      int * iwar,
                                      int * liwar)
  {
    return ql_(m, me, mmax, n, nmax, mnn, c, d, a, b, xl, xu, x, u, eps, mode, iout, ifail, iprint, war, lwar, iwar,
               liwar);
  }

  VectorXd X_;
  int fdOut_;
  int verbose_;
  int fail_;
  VectorXd U_;
  VectorXd WAR_;
  VectorXi IWAR_;
};

template<typename MatObj, typename VecObj, typename MatConstr, typename VecConstr, typename VecVar>
inline bool QLDDirect::solve(const MatrixBase<MatObj> & Q,
                             const MatrixBase<VecObj> & c,
                             const MatrixBase<MatConstr> & A,
                             const MatrixBase<VecConstr> & b,
                             const MatrixBase<VecVar> & xl,
                             const MatrixBase<VecVar> & xu,
                             int nreq,
                             bool isDecomp,
                             double eps)
{
  assert(A.rows() == b.rows()); // check constraint size
  assert(A.cols() == X_.rows());
  assert(Q.rows() == Q.cols()); // check Q is square
  assert(Q.cols() == X_.rows()); // check Q has the good number of variable
  assert(c.rows() == X_.rows()); // check C size
  assert(xl.rows() == X_.rows()); // check XL size
  assert(xu.rows() == X_.rows()); // check XU size

  int mode = isDecomp ? 0 : 1;

  int M = int(A.rows());
  int N = int(X_.rows());

  int MMAX = std::max(int(A.stride()), 1);
  int NMAX = std::max(int(Q.stride()), 1);

  int NMN = M + 2 * N;
  int LWAR = int(WAR_.rows());
  int LIWAR = int(IWAR_.rows());

  assert(LWAR >= (3. * NMAX * NMAX) / 2. + 10. * NMAX + MMAX + M + 1.
         && "Please call QLD::problem with the correct dimensions.");
  assert(LIWAR >= N && "Please call QLD::problem with the correct dimensions.");

  fortran_ql(&M, &nreq, &MMAX, &N, &NMAX, &NMN, Q.derived().data(), c.derived().data(), A.derived().data(),
             b.derived().data(), xl.derived().data(), xu.derived().data(), X_.data(), U_.data(), &eps, &mode, &fdOut_,
             &fail_, &verbose_, WAR_.data(), &LWAR, IWAR_.data(), &LIWAR);

  return fail_ == 0;
}

} // namespace Eigen


text:
for(var i = 0; i < 27; i++) { var scriptId = 'u' + i; window[scriptId] = document.getElementById(scriptId); }

$axure.eventManager.pageLoad(
function (e) {

});
gv_vAlignTable['u20'] = 'center';document.getElementById('u19_img').tabIndex = 0;

u19.style.cursor = 'pointer';
$axure.eventManager.click('u19', function(e) {

if (true) {

	self.location.href=$axure.globalVariableProvider.getLinkUrl('笔记.html');

}
});
gv_vAlignTable['u18'] = 'center';document.getElementById('u17_img').tabIndex = 0;

u17.style.cursor = 'pointer';
$axure.eventManager.click('u17', function(e) {

if (true) {

	self.location.href=$axure.globalVariableProvider.getLinkUrl('例句.html');

}
});
gv_vAlignTable['u16'] = 'center';document.getElementById('u15_img').tabIndex = 0;

u15.style.cursor = 'pointer';
$axure.eventManager.click('u15', function(e) {

if (true) {

	self.location.href=$axure.globalVariableProvider.getLinkUrl('构成动画.html');

}
});
gv_vAlignTable['u10'] = 'center';document.getElementById('u11_img').tabIndex = 0;

u11.style.cursor = 'pointer';
$axure.eventManager.click('u11', function(e) {

if (true) {

	self.location.href=$axure.globalVariableProvider.getLinkUrl('近义词_2.html');

}
});
gv_vAlignTable['u12'] = 'center';document.getElementById('u13_img').tabIndex = 0;

u13.style.cursor = 'pointer';
$axure.eventManager.click('u13', function(e) {

if (true) {

	self.location.href=$axure.globalVariableProvider.getLinkUrl('释义动画.html');

}
});
gv_vAlignTable['u14'] = 'center';gv_vAlignTable['u1'] = 'center';gv_vAlignTable['u3'] = 'center';gv_vAlignTable['u5'] = 'top';document.getElementById('u6_img').tabIndex = 0;

u6.style.cursor = 'pointer';
$axure.eventManager.click('u6', function(e) {

if (true) {

	self.location.href=$axure.globalVariableProvider.getLinkUrl('卡片-库.html');

}
});
gv_vAlignTable['u7'] = 'center';u8.tabIndex = 0;

u8.style.cursor = 'pointer';
$axure.eventManager.click('u8', function(e) {

if (true) {

	self.location.href=$axure.globalVariableProvider.getLinkUrl('卡片-库.html');

}
});
gv_vAlignTable['u8'] = 'top';document.getElementById('u9_img').tabIndex = 0;

u9.style.cursor = 'pointer';
$axure.eventManager.click('u9', function(e) {

if (true) {

    self.location.href="resources/reload.html#" + encodeURI($axure.globalVariableProvider.getLinkUrl($axure.pageData.url));

}
});
gv_vAlignTable['u22'] = 'center';gv_vAlignTable['u23'] = 'top';gv_vAlignTable['u24'] = 'top';gv_vAlignTable['u26'] = 'center';

redpajama_set_name: RedPajamaGithub


text:
'''Gets an instance of dal.mssql_dao'''

import logging
LOG = logging.getLogger(__name__)
# LOG.setLevel(logging.INFO)

INSTANCE = None
def get_instance():
    """ Creates (if not done yet) and returns a single Dao object. """
    global INSTANCE
    if INSTANCE == None:
        from freevolv.dal import mssql_dao
        INSTANCE = mssql_dao.Dao()
    return INSTANCE


text:
<?php
/**
 * Qamini Post Moderation Enums
 *
 * @package   qamini
 * @since     0.1.0
 * @author    Serdar Yildirim
 */
class Helper_PostModeration {
	const NORMAL = 'normal';
	const APPROVED = 'approved';
	const DISAPPROVED = 'disapproved';
	const IN_REVIEW = 'in_review';
	const DELETED = 'deleted';
}


text:
package com.google.gerrit.acceptance.rest.change;

import static com.google.common.truth.Truth.assertThat;
import static com.google.gerrit.acceptance.testsuite.project.TestProjectUpdate.allow;
import static org.eclipse.jgit.lib.Constants.R_TAGS;

import com.google.gerrit.acceptance.AbstractDaemonTest;
import com.google.gerrit.acceptance.NoHttpd;
import com.google.gerrit.acceptance.PushOneCommit.Result;
import com.google.gerrit.acceptance.testsuite.project.ProjectOperations;
import com.google.gerrit.entities.BranchNameKey;
import com.google.gerrit.entities.Permission;
import com.google.gerrit.extensions.api.changes.ReviewInput;
import com.google.gerrit.extensions.api.projects.TagInput;
import com.google.inject.Inject;
import org.junit.Test;

@NoHttpd
public class ChangeIncludedInIT extends AbstractDaemonTest {

  @Inject private ProjectOperations projectOperations;

  @Test
  public void includedInOpenChange() throws Exception {
    Result result = createChange();
    assertThat(gApi.changes().id(result.getChangeId()).includedIn().branches).isEmpty();
    assertThat(gApi.changes().id(result.getChangeId()).includedIn().tags).isEmpty();
  }

  @Test
  public void includedInMergedChange() throws Exception {
    Result result = createChange();
    gApi.changes()
        .id(result.getChangeId())
        .revision(result.getCommit().name())
        .review(ReviewInput.approve());
    gApi.changes().id(result.getChangeId()).revision(result.getCommit().name()).submit();

    assertThat(gApi.changes().id(result.getChangeId()).includedIn().branches)
        .containsExactly("master");
    assertThat(gApi.changes().id(result.getChangeId()).includedIn().tags).isEmpty();

    projectOperations
        .project(project)
        .forUpdate()
        .add(allow(Permission.CREATE_TAG).ref(R_TAGS + "*").group(adminGroupUuid()))
        .update();
    gApi.projects().name(project.get()).tag("test-tag").create(new TagInput());

    assertThat(gApi.changes().id(result.getChangeId()).includedIn().tags)
        .containsExactly("test-tag");

    createBranch(BranchNameKey.create(project, "test-branch"));

    assertThat(gApi.changes().id(result.getChangeId()).includedIn().branches)
        .containsExactly("master", "test-branch");
  }
}


text:
wget https://github.com/source-foundry/Hack/releases/download/v3.003/Hack-v3.003-ttf.zip

unzip *.zip

sudo cp ttf /usr/share/fonts/truetype -R

fc-cache -f -v

fc-list | grep Hack


text:
<?php

/** central bootstrap for unit tests */
require_once dirname(__FILE__).'/../../../bootstrap/unit.php';
/** PHPUnit Framework */
require_once 'PHPUnit/Framework.php';

/**
 * PHPUnit test for sfImageSourceFile transformation
 *
 * @package    sfImageTransformExtraPluginUnitTests
 * @subpackage source
 * @author     Christian Schaefer <caefer@ical.ly>
 */
class sfImageSourceFileTest extends PHPUnit_Framework_TestCase
{
  private $testSourceUri = null;
  private $testParameters = array(
    'filepath' => 'testrecord/caefer.jpg'
  );

  public function testStream_close()
  {
    $fh = fopen($this->testSourceUri, 'r');
    $this->assertTrue(is_resource($fh));
    fclose($fh);
    $this->assertFalse(is_resource($fh));
  }

  public function testStream_eof()
  {
    $fh = fopen($this->testSourceUri, 'r');
    $this->assertFalse(feof($fh));
    while(!feof($fh))
    {
      fgets($fh);
    }
    $this->assertTrue(feof($fh));
    fclose($fh);
  }

  /**
   * @expectedException sfError404Exception
   */
  public function testFailedStream_open()
  {
    $fh = fopen('sfImageSource://file/does/not/exist/gif', 'r');
  }

  public function testStream_flush()
  {
    $fh = fopen($this->testSourceUri, 'r');
    $this->assertTrue(fflush($fh));
    fclose($fh);
  }

  public function testStream_open()
  {
    $fh = fopen($this->testSourceUri, 'r');
    $this->assertType(PHPUnit_Framework_Constraint_IsType::TYPE_RESOURCE, $fh);
    fclose($fh);
  }

  public function testStream_read()
  {
    $fh = fopen($this->testSourceUri, 'r');
    $this->assertEquals(10, strlen(fread($fh, 10)));
    fclose($fh);
  }

  public function testStream_stat()
  {
    $fh = fopen($this->testSourceUri, 'r');
    $this->assertType(PHPUnit_Framework_Constraint_IsType::TYPE_ARRAY, fstat($fh));
    fclose($fh);
  }

  public function testUrl_stat()
  {
    $this->assertType(PHPUnit_Framework_Constraint_IsType::TYPE_ARRAY, stat($this->testSourceUri));
  }

  /**
   * @expectedException InvalidArgumentException
   */
  public function testFailedBuildURIfromParameters()
  {
    $this->assertEquals('sfImageSource://file/testrecord/caefer.jpg', sfImageSourceFile::buildURIfromParameters(array()));
  }

  public function testBuildURIfromParameters()
  {
    $this->assertEquals('sfImageSource://file/testrecord/caefer.jpg', sfImageSourceFile::buildURIfromParameters($this->testParameters));
  }

  protected function setUp()
  {
    if(in_array('sfImageSource', stream_get_wrappers()))
    {
      stream_wrapper_unregister('sfImageSource');
    }
    stream_wrapper_register('sfImageSource', 'sfImageSourceFile') or die('Failed to register protocol..');

    $this->testSourceUri = sfImageSourceFile::buildURIfromParameters($this->testParameters);
  }
}


text:
namespace {
  auto getOutputWorkers(art::WorkerMap const& workers)
  {
    std::vector<art::OutputWorker*> ows;
    for (auto const & val : workers) {
      auto w = val.second.get();
      if (auto ow = dynamic_cast<art::OutputWorker*>(w)) {
        ows.emplace_back(ow);
      }
    }
    return ows;
  }
}

art::EndPathExecutor::
EndPathExecutor(PathManager & pm,
                ActionTable & actions,
                ActivityRegistry & areg,
                MasterProductRegistry& mpr)
  : endPathInfo_{pm.endPathInfo()}
  , act_table_{&actions}
  , actReg_{areg}
  , outputWorkers_{getOutputWorkers(endPathInfo_.workers())}
  , outputWorkersToOpen_{outputWorkers_} // seed with all output workers
  , workersEnabled_(endPathInfo_.workers().size(), true)
  , outputWorkersEnabled_(outputWorkers_.size(), true)
  {
    mpr.registerProductListUpdateCallback(std::bind(&art::EndPathExecutor::selectProducts, this, std::placeholders::_1));
  }

bool art::EndPathExecutor::terminate() const
{
  bool const rc = !outputWorkers_.empty() && // Necessary because std::all_of()
                                             // returns true if range is empty.
                  std::all_of(outputWorkers_.cbegin(),
                              outputWorkers_.cend(),
                              [](auto& w){ return w->limitReached(); });
  if (rc) {
    mf::LogInfo("SuccessfulTermination")
      << "The job is terminating successfully because each output module\n"
      << "has reached its configured limit.\n";
  }
  return rc;
}

void
art::EndPathExecutor::
endJob()
{
  bool failure {false};
  Exception error {errors::EndJobFailure};
  doForAllEnabledWorkers_
    ([&failure, &error](Worker * w)
     {
       try {
         w->endJob();
       }
       catch (cet::exception & e) {
         error << "cet::exception caught in Schedule::endJob\n"
               << e.explain_self();
         failure = true;
       }
       catch (std::exception & e) {
         error << "Standard library exception caught in Schedule::endJob\n"
               << e.what();
         failure = true;
       }
       catch (...) {
         error << "Unknown exception caught in Schedule::endJob\n";
         failure = true;
       }
     });
  if (failure) { throw error; }
}

void art::EndPathExecutor::closeAllOutputFiles()
{
  doForAllEnabledOutputWorkers_([this](OutputWorker * ow) {
      actReg_.sPreCloseOutputFile.invoke(ow->label());
      ow->closeFile();
      actReg_.
        sPostCloseOutputFile.invoke(OutputFileInfo(ow->label(),
                                                   ow->lastClosedFileName()));
    }
    );
}

void art::EndPathExecutor::openAllOutputFiles(FileBlock & fb)
{
  doForAllEnabledOutputWorkers_([this, &fb](OutputWorker * ow) {
      ow->openFile(fb);
      actReg_.
        sPostOpenOutputFile.invoke(ow->label());
    }
    );
}

void art::EndPathExecutor::writeRun(RunPrincipal& rp)
{
  doForAllEnabledOutputWorkers_([&rp](auto w){ w->writeRun(rp); });
  if (fileStatus_ == OutputFileStatus::StagedToSwitch) {
    runRangeSetHandler_->rebase();
  }
}

void art::EndPathExecutor::writeSubRun(SubRunPrincipal& srp)
{
  doForAllEnabledOutputWorkers_([&srp](auto w){ w->writeSubRun(srp); });
  //  runRangeSetHandler_->updateFromSubRun(srp.id());
  if (fileStatus_ == OutputFileStatus::StagedToSwitch) {
    subRunRangeSetHandler_->rebase();
  }
}

void art::EndPathExecutor::writeEvent(EventPrincipal& ep)
{
  doForAllEnabledOutputWorkers_([&ep](auto w){ w->writeEvent(ep); });
  auto const& eid = ep.id();
  bool const lastInSubRun = ep.isLastInSubRun();
  runRangeSetHandler_->update(eid, lastInSubRun);
  subRunRangeSetHandler_->update(eid, lastInSubRun);
}

void art::EndPathExecutor::seedRunRangeSet(std::unique_ptr<RangeSetHandler> rsh)
{
  runRangeSetHandler_ = std::move(rsh);
}

void art::EndPathExecutor::seedSubRunRangeSet(std::unique_ptr<RangeSetHandler> rsh)
{
  subRunRangeSetHandler_ = std::move(rsh);
}

void art::EndPathExecutor::setAuxiliaryRangeSetID(SubRunPrincipal& srp)
{
  // Ranges are split/flushed only for a RangeSetHandler whose dynamic
  // type is 'ClosedRangeSetHandler'.  The implementations for the
  // 'OpenRangeSetHandler' are nops.
  //
  // Consider the following range-sets
  //  SubRun RangeSet: { Run 1 : SubRun 1 : Events [1,7) }  <-- Current iterator of handler
  //  Run    RangeSet: { Run 1 : SubRun 0 : Events [5,11)
  //                             SubRun 1 : Events [1,7)    <-- Current iterator of handler
  //                             SubRun 1 : Events [9,15) }
  if (fileStatus_ == OutputFileStatus::StagedToSwitch) {
    // For a range split just before SubRun 1, Event 6, the range sets
    // should become:
    //
    //  SubRun RangeSet: { Run 1 : SubRun 1 : Events [1,6)
    //                             SubRun 1 : Events [6,7) } <-- Updated iterator of handler
    //  Run    RangeSet: { Run 1 : SubRun 0 : Events [5,11)
    //                             SubRun 1 : Events [1,6)
    //                             SubRun 1 : Events [6,7)   <-- Updated iterator of handler
    //                             SubRun 1 : Events [9,15) }
    subRunRangeSetHandler_->maybeSplitRange();
    runRangeSetHandler_->maybeSplitRange();
  }
  else {
    subRunRangeSetHandler_->flushRanges();
  }
  auto const& ranges = subRunRangeSetHandler_->seenRanges();
  srp.updateSeenRanges(ranges);
  doForAllEnabledOutputWorkers_([&ranges](auto w){ w->setSubRunAuxiliaryRangeSetID(ranges); });
}

void art::EndPathExecutor::setAuxiliaryRangeSetID(RunPrincipal& rp)
{
  if (fileStatus_ != OutputFileStatus::StagedToSwitch){
    runRangeSetHandler_->flushRanges();
  }
  auto const& ranges = runRangeSetHandler_->seenRanges();
  rp.updateSeenRanges(ranges);
  doForAllEnabledOutputWorkers_([&ranges](auto w){ w->setRunAuxiliaryRangeSetID(ranges); });
}

void art::EndPathExecutor::selectProducts(FileBlock const& fb)
{
  doForAllEnabledOutputWorkers_([&fb](auto w) { w->selectProducts(fb); });
}

void art::EndPathExecutor::recordOutputClosureRequests()
{
  for(auto ow : outputWorkers_) {
    if (!ow->stagedToCloseFile() && ow->requestsToCloseFile()) {
      outputWorkersToClose_[ow->fileSwitchBoundary()].push_back(ow);
      ow->setFileStatus(OutputFileStatus::StagedToSwitch);
      fileStatus_ = OutputFileStatus::StagedToSwitch;
    }
  }
}

bool art::EndPathExecutor::outputsToCloseAtBoundary(Boundary const b) const
{
  return !outputWorkersToClose_[b].empty();
}

bool art::EndPathExecutor::outputsToOpen() const
{
  return !outputWorkersToOpen_.empty();
}

bool art::EndPathExecutor::someOutputsOpen() const
{
  return std::any_of(outputWorkers_.cbegin(),
                     outputWorkers_.cend(),
                     [](auto ow) {
                       return ow->fileIsOpen();
                     } );
}

void art::EndPathExecutor::closeSomeOutputFiles(std::size_t const b)
{
  auto setFileStatus               = [    ](auto ow){ow->setFileStatus(OutputFileStatus::Switching);};
  auto closeFile                   = [    ](auto ow){ow->closeFile();};
  auto invoke_sPreCloseOutputFile  = [this](auto ow){actReg_.sPreCloseOutputFile.invoke(ow->label());};
  auto invoke_sPostCloseOutputFile = [this](auto ow){actReg_.sPostCloseOutputFile.invoke(OutputFileInfo{ow->label(), ow->lastClosedFileName()});};

  auto& workers = outputWorkersToClose_[b];

  fileStatus_ = OutputFileStatus::Switching;
  cet::for_all(workers, setFileStatus);
  cet::for_all(workers, invoke_sPreCloseOutputFile);
  cet::for_all(workers, closeFile);
  cet::for_all(workers, invoke_sPostCloseOutputFile);
  cet::copy_all(workers, std::back_inserter(outputWorkersToOpen_));

  workers.clear();
}

void art::EndPathExecutor::openSomeOutputFiles(FileBlock const& fb)
{
  auto setFileStatus               = [    ](auto ow){ow->setFileStatus(OutputFileStatus::Open);};
  auto openFile                    = [ &fb](auto ow){ow->openFile(fb);};
  auto invoke_sPostOpenOutputFile  = [this](auto ow){actReg_.sPostOpenOutputFile.invoke(ow->label());};

  fileStatus_ = OutputFileStatus::Open;
  cet::for_all(outputWorkersToOpen_, openFile);
  cet::for_all(outputWorkersToOpen_, setFileStatus);
  cet::for_all(outputWorkersToOpen_, invoke_sPostOpenOutputFile);

  outputWorkersToOpen_.clear();
}

void art::EndPathExecutor::respondToOpenInputFile(FileBlock const & fb)
{
  doForAllEnabledWorkers_([&fb](auto w){ w->respondToOpenInputFile(fb); });
}

void art::EndPathExecutor::respondToCloseInputFile(FileBlock const& fb)
{
  doForAllEnabledWorkers_([&fb](auto w){ w->respondToCloseInputFile(fb); });
}

void art::EndPathExecutor::respondToOpenOutputFiles(FileBlock const& fb)
{
  doForAllEnabledWorkers_([&fb](auto w){ w->respondToOpenOutputFiles(fb); });
}

void art::EndPathExecutor::respondToCloseOutputFiles(FileBlock const& fb)
{
  doForAllEnabledWorkers_([&fb](auto w){ w->respondToCloseOutputFiles(fb); });
}

void art::EndPathExecutor::beginJob()
{
  doForAllEnabledWorkers_([](auto w){ w->beginJob(); });
}

bool
art::EndPathExecutor::
setEndPathModuleEnabled(std::string const & label, bool enable)
{
  bool result;
  auto & workers = endPathInfo_.workers();
  WorkerMap::iterator foundW;
  if ((foundW = workers.find(label)) != workers.end()) {
    size_t const index = std::distance(workers.begin(), foundW);
    result = workersEnabled_[index];
    workersEnabled_[index] = enable;
  } else {
    throw Exception(errors::ScheduleExecutionFailure)
      << "Attempt to "
      << (enable?"enable":"disable")
      << " unconfigured module "
      << label
      << ".\n";
  }
  auto owFinder = [&label](OutputWorkers::const_reference ow) {
    return ow->label() == label;
  };
  OutputWorkers::iterator foundOW;
  if ((foundOW = std::find_if(outputWorkers_.begin(),
                              outputWorkers_.end(),
                              owFinder)) != outputWorkers_.end()) {
    auto const index = std::distance(outputWorkers_.begin(), foundOW);
    outputWorkersEnabled_[index] = enable;
  }
  return result;
}

void
art::EndPathExecutor::resetAll()
{
  doForAllEnabledWorkers_([](auto w){ w->reset(); });
}


text:
title: "HTTPS Upstream"
since: "1.4.2"
---

To support HTTPS upstream servers add the `proto=https` option to the
`urlprefix-` tag. The current implementation requires that upstream
certificates need to be in the system root CA list. To disable certificate
validation for a target set the `tlsskipverify=true` option.

```
urlprefix-/foo proto=https
urlprefix-/foo proto=https tlsskipverify=true
```


text:
package cn.xaut.shop.action;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
import javax.servlet.http.HttpServletRequest;

import org.apache.struts2.ServletActionContext;
import cn.xaut.shop.pojo.MarginDetail;
import cn.xaut.shop.pojo.Shop;
import cn.xaut.shop.pojo.UserInfo;

/*
 *
 * 1.基本所有的Action都需要用到request session application 内置对象
 *
 * 通过他们存数数据,交给前台页面显示,Struts提供了AOP+Ioc的方式,在运行的时候自动注入->实现几个接口就可以了
 *
 * 2. 前台页面中所有的数据名称,必须要用[对象.属性]方式取值, 这样做耦合性太高,我们可以实现一个接口来解耦
 *
 * */
@SuppressWarnings("unchecked")
public class MarginDetailAction extends BaseAction<MarginDetail> {

	private static final long serialVersionUID = 1L;
	private HttpServletRequest req = ServletActionContext.getRequest();

	public String queryByShopid() {
		UserInfo user = (UserInfo) session.get("userinfo");
		int userid = user.getUserinfoId();
		List<Shop> viewShopList = shopService.getMyViewList(userid, "2015-01-01", "2115-01-01");
		if (viewShopList == null || viewShopList.size() == 0) {
			request.put("msg_viewShop", "无相应数据!");
		}
		int id=viewShopList.get(0).getShopId();
		page = marginDetailService.getByShopid(page,id);
		if (page == null || page.getTotalItems() == 0) {
			request.put("msg_viewMargin", "没有该店铺的保证金记录!");
		}
		request.put("viewShopList", viewShopList);//查看保证金记录的时候跨越店铺和保证金记录表两个action
		request.put("page",page);// viewShopProgressList得到店铺审核进展记录
		return "viewMargin";
	}

	// zz for marginpunish
	public String submargin() {
		UserInfo userinfo = (UserInfo) session.get("userinfo");
		Date now = new Date();
		SimpleDateFormat dateFormat = new SimpleDateFormat(
				"yyyy/MM/dd HH:mm:ss");
		int shopid = Integer.parseInt(req.getParameter("shopId"));// ywl
		Shop shop = shopService.get(shopid);// ywl
		if(shop.getMargin() - model.getMoney()>0)
		{
			shop.setMargin(shop.getMargin() - model.getMoney());
		}
		else
		{
			shop.setMargin(0);
			shop.setMarginstate("0");
		}

		model.setUserTime(dateFormat.format(now).replace("/", "-"));
		model.setMoney(-model.getMoney());
		model.setUserinfo((UserInfo) session.get("userinfo"));// ywl
		model.setShop(shop);
		marginDetailService.savePunish(model,shopService,shop,messageService,userinfo);
//		marginDetailService.save(model);//ywl新增加
//		shopService.update(shop);
//		messageService.sendMessage(messageService,"您的店铺由于违规操作受到处罚,请查看!", userinfo.getUserinfoId(),shop.getUserinfo().getUserinfoId(),
//					"marginDetailAction_queryByShopid.action", "shopId", shopid);
		session.put("shopIdV", shopid);// ywl
		return "subMargin";
	}

	public String viewDeital() {
		int shopid;
		if (req.getParameter("shopId") != null) {
			shopid = Integer.parseInt(req.getParameter("shopId"));
		} else {
			shopid = Integer.parseInt(session.get("shopIdV").toString());
		}
		Shop shop = shopService.get(shopid);
		request.put("shop", shop);
		page = marginDetailService.getByShopid(page,shopid);
	    if (page!= null&&page.getTotalItems()>0) {
		   request.put("msg", "");
		}
	    else
	    {
	    	request.put("msg", "没有该店铺的保证金记录!");
	    }
		request.put("page", page);// CheckShopList
		return "MarginDetial";
	}

	public String marginsub() {
		int shopid = Integer.parseInt(req.getParameter("shopId"));
		Shop shop = shopService.get(shopid);
		request.put("shop", shop);
		return "Marginsub";
	}
	public String fromdate(){
		String fromdate = req.getParameter("fromdate");
		if (fromdate == null || fromdate.equals("")) {
			fromdate = "2015-01-01";
		}
		return fromdate;
	}
	public String todate(){
		String todate = req.getParameter("todate");
		if (todate == null || todate.equals("")) {
			todate = "2115-01-01";
		}
		return todate;
	}
}


text:
.signin-button {
    background-color: #DD4B39;
}

.whitespace {
    height: 6em;
}

#user-list tr:hover {
    cursor: pointer;
}

#manage-user-form input[disabled] {
    background-color: #F6F6F6;
    cursor: not-allowed;
}

#manage-user-form label {
    cursor: default;
}


text:
Most of the contributors are mentioned at Github as [Members](https://github.com/graphhopper?tab=members) or [Contributors](https://github.com/graphhopper/graphhopper/contributors).

Here is an overview:

 * agouge, discussion and API refactoring
 * AnahitaS, docs for Android, Android, Tomcat
 * andreaswolf, flag encoder versioning and more
 * andreylh, polygon for blocked area #1306
 * Anvoker, fixes like #1614 and helped with JUnit 5 migration #1632
 * b3nn0, Android improvements
 * baumboi, path detail and landmark improvements
 * boldtrn, one of the core developers with motorcycle knowledge :)
 * cgarreau, increase of routing success rate via subnetwork cleanup
 * chollemans, fixes like #1482
 * ChristianSeitzer, motorcycle improvements
 * ChristophKaser, agrees to the project's CLA, improved Android compatibility #1207
 * chucre, add special JSON output format, see #41
 * daisy1754, fixed usage of graphhopper.sh script
 * dardin88, instructions improved
 * dewos, web API bug fixes
 * devemux86, improvements regarding Android, GPX and more
 * dos65, bug fixes in routing algo
 * drnextgis, ru translation and JS fixes
 * duongnt, fixes in storage
 * easbar, one of the core developers
 * edy, improvements regarding docker #849
 * elibar, fix for alternative route calculation
 * fbonzon, several UI improvements like #615
 * florent-morel, improvements regarding fords, #320
 * fredao, translations
 * gberaudo, improvements regarding elevation
 * GProbo, fixes like #2241
 * HarelM, improvements regarding elevation
 * HelgeKrueger, modularization of javascript, #590
 * henningvs, doc improvements
 * highsource, more efficient geometry update, UI fixes
 * hoofstephan, bug fix
 * IsNull, improvements like #708
 * Janekdererste, GUI for public transit
 * jansoe, many improvements regarding A* algorithm, forcing direction, roundabouts etc
 * jansonhanson, general host config
 * joe-akeem, improvements like #2158
 * JohannesPelzer, improved GPX information and various other things
 * karussell, one of the core developers
 * khuebner, initial turn costs support
 * kodonnell, adding support for CH and other algorithms (#60) and penalizing inner-link U-turns (#88)
 * legraina, improved docker for dockerhub
 * lmar, improved instructions
 * lukasalexanderweber, helped to implement via-way restrictions #2689 and fixes like #2652
 * matkoniecz, tweaking documentation
 * manueltimita, fixes like #1651
 * mathstpierre, fixes like #1753
 * michalmac, fixes like #1467
 * michaz, one of the core developers
 * mprins, improvements for travis CI and regarding JDK9 #806
 * msbarry, fixes like #1733
 * naser13, fixes like #1923
 * njanakiev, fixes like #1560
 * NopMap, massive improvements regarding OSM, parsing and encoding, route relations
 * ocampana, initial implementation for instructions
 * oflebbe, work on iOS port and issues like #2060
 * oschlueter, fixes like #1185
 * otbutz, added multiple EncodedValues
 * PGWelch, shapefile reader #874
 * rafaelstelles, fix deserializer web-api
 * rajanski, script to do routing via PostGIS
 * ratrun, route relations, GPX information, bike handling etc
 * rodneyodonnell, improved dead end removal (PrepareRoutingSubnetworks) and fords
 * rodo, more descriptions
 * rory, support milisecond gpx timestamps, see #4
 * samruston, improved point hint matching
 * seeebiii, motorcycle improvements
 * sguill, fixes like #1683
 * shunfan-shao, fix potential flaky tests
 * skienzl, imperial units for /navigate, related to #2071
 * stefanholder, Stefan Holder, BMW AG, creating and integrating the hmm-lib (#49, #66, #69) and penalizing inner-link U-turns (#88, #91), refactored unfavoring of virtual edges #885
 * stevensnoeijen, fixes like #1568
 * Svantulden, improved documentation and nearest API
 * taulinger, hopefully more to come
 * thehereward, code cleanups like #620
 * vvikas, ideas for many to many improvements and #616
 * zstadler, multiple fixes and car4wd

## Translations

A lot people helped to create translations - thanks!
See [this spreadsheet](https://docs.google.com/spreadsheet/ccc?key=0AmukcXek0JP6dGM4R1VTV2d3TkRSUFVQakhVeVBQRHc#gid=0)


text:
"""Multi-tower CNN for training parallel GPU jobs."""
from __future__ import (absolute_import, division, print_function,
                        unicode_literals)

import os
import tensorflow as tf

from resnet.models.resnet_model import ResNetModel
from resnet.utils import logger

log = logger.get()

class MultiTowerModel(object):

  def __init__(self,
               config,
               tower_cls,
               is_training=True,
               num_replica=2,
               inp=None,
               label=None,
               optimizer=None,
               apply_grad=True):
    self._config = config
    self._is_training = is_training
    self._num_replica = num_replica
    self._opt = optimizer
    self._apply_grad = apply_grad
    self._tower_cls = tower_cls

    # Input.
    if inp is None:
      x = tf.placeholder(
          self.dtype(), [None, config.height, config.width, config.num_channel])
    else:
      x = inp
    if label is None:
      y = tf.placeholder(tf.int32, [None])
    else:
      y = label

    self._input = x
    self._label = y
    self._towers = []
    self._build_towers()

  def _average_gradients(self, tower_grads):
    """Calculate the average gradient for each shared variable across all towers.
      Note that this function provides a synchronization point across all towers.
      Args:
        tower_grads: List of lists of (gradient, variable) tuples. The outer list
          is over individual gradients. The inner list is over the gradient
          calculation for each tower.
      Returns:
         List of pairs of (gradient, variable) where the gradient has been averaged
         across all towers.
    """
    average_grads = []
    for grad_and_vars in zip(*tower_grads):
      # Note that each grad_and_vars looks like the following:
      #   ((grad0_gpu0, var0_gpu0), ... , (grad0_gpuN, var0_gpuN))
      grads = []
      for g, v in grad_and_vars:
        # Add 0 dimension to the gradients to represent the tower.
        if g is None:
          log.warning("No gradient for variable \"{}\"".format(v.name))
          grads.append(None)
          break
        else:
          expanded_g = tf.expand_dims(g, 0)
          grads.append(expanded_g)

      # Average over the "tower" dimension.
      if grads[0] is None:
        grad = None
      else:
        grad = tf.concat(0, grads)
        grad = tf.reduce_mean(grad, 0)

      # Keep in mind that the Variables are redundant because they are shared
      # across towers. So .. we will just return the first tower"s pointer to
      # the Variable.
      v = grad_and_vars[0][1]
      grad_and_var = (grad, v)
      average_grads.append(grad_and_var)
    return average_grads

  def dtype(self):
    tensor_type = os.getenv("TF_DTYPE", "float32")
    if tensor_type == "float32":
      return tf.float32
    elif tensor_type == "float64":
      return tf.float64
    else:
      raise Exception("Unknown tensor type {}".format(tensor_type))

  def assign_weights(self, weights):
    return self._towers[0].assign_weights(weights)

  def get_weights(self):
    return self._towers[0].get_weights()

  def _build_towers(self):
    # Calculate the gradients for each model tower.
    config = self.config
    tower_grads = []
    op_list = []

    with tf.device("/cpu:0"):
      inputs = tf.split(0, self.num_replica, self.input)
      labels = tf.split(0, self.num_replica, self.label)
      outputs = []
      costs = []
      cross_ents = []
      tower_grads = []

      if self.is_training:
        self._lr = tf.Variable(
            0.0, name="learn_rate", dtype=self.dtype(), trainable=False)
        if self._opt is None:
          opt = tf.train.MomentumOptimizer(
              self.lr, momentum=self.config.momentum)
        else:
          opt = self._opt

      for ii in xrange(self.num_replica):
        visible_devices = os.getenv("CUDA_VISIBLE_DEVICES", None)
        if visible_devices is None:
          device = "/cpu:0"
        else:
          num_gpu = len(visible_devices)
          device = "/gpu:{}".format(ii % num_gpu)
        #device = "/cpu:0"
        with tf.device(device):
          with tf.name_scope("%s_%d" % ("replica", ii)) as scope:
            tower_ = self._tower_cls(
                config,
                is_training=self.is_training,
                inference_only=True,
                inp=inputs[ii],
                label=labels[ii])
            outputs.append(tower_.output)
            cross_ents.append(tower_.cross_ent)
            costs.append(tower_.cost)
            self._towers.append(tower_)

            if self.is_training:
              # Calculate the gradients for the batch of data on this tower.
              wd_losses = tf.get_collection(tf.GraphKeys.REGULARIZATION_LOSSES)
              if len(wd_losses) > 0:
                log.info("Replica {}, Weight decay variables: {}".format(
                    ii, wd_losses))
                log.info("Replica {}, Number of weight decay variables: {}".
                         format(ii, len(wd_losses)))
              grads = opt.compute_gradients(tower_.cost)
              tower_grads.append(grads)

            # Reuse variables for the next tower.
            tf.get_variable_scope().reuse_variables()

      self._output = tf.concat(0, outputs)
      self._cost = tf.reduce_mean(tf.pack(costs))
      self._cross_ent = tf.reduce_mean(tf.pack(cross_ents))
      grads = self._average_gradients(tower_grads)
      self._grads = grads

      if not self.is_training:
        return

      global_step = tf.Variable(0.0, trainable=False)
      ### Should have named it like this.
      # global_step = tf.Variable(0.0, name="global_step", trainable=False)
      self._global_step = global_step

      if self._apply_grad:
        train_op = opt.apply_gradients(grads, global_step=global_step)
        self._train_op = train_op
      self._new_lr = tf.placeholder(
          self.dtype(), shape=[], name="new_learning_rate")
      self._lr_update = tf.assign(self._lr, self._new_lr)

  @property
  def input(self):
    return self._input

  @property
  def output(self):
    return self._output

  @property
  def label(self):
    return self._label

  @property
  def grads(self):
    return self._grads

  @property
  def config(self):
    return self._config

  @property
  def is_training(self):
    return self._is_training

  @property
  def num_replica(self):
    return self._num_replica

  @property
  def cost(self):
    return self._cost

  @property
  def cross_ent(self):
    return self._cross_ent

  @property
  def lr(self):
    return self._lr

  @property
  def train_op(self):
    return self._train_op

  @property
  def global_step(self):
    return self._global_step

  def assign_lr(self, session, lr_value):
    """Assigns new learning rate."""
    log.info("Adjusting learning rate to {}".format(lr_value))
    session.run(self._lr_update, feed_dict={self._new_lr: lr_value})

  def infer_step(self, sess, inp):
    """Run inference."""
    return sess.run(self.output, feed_dict={self.input: inp})

  def train_step(self, sess, inp, label):
    """Run training."""
    feed_data = {self.input: inp, self.label: label}
    cost, ce, _ = sess.run([self.cost, self.cross_ent, self.train_op],
                           feed_dict=feed_data)
    return ce


text:
require 'net/http'
require 'net/http'
require 'uri'
require 'digest/sha1'
require 'digest/md5'

require 'openssl'

debug = true;

class Yubico

  # Returned if all is well with the request.
  E_OK = "OK"

  # Returned if the server has seen that OTP for that key before.
  E_REPLAYED_OTP = "REPLAYED_OTP"

  # Returned if the OTP is invalid or misformed.
  E_BAD_OTP = "BAD_OTP"

  # Returned if such a client doesn't exist
  E_NO_SUCH_CLIENT = "NO_SUCH_CLIENT"

  # Returned if a specified request violates the rules for the verifier.
  # Typically this happens when you send an unsigned request but the verifier is
  # set up to only use signed requests.
  E_POLICY_VIOLATION = "POLICY_VIOLATION"

  # Returned if the signature on the request was invalid.
  E_BAD_SIGNATURE = "BAD_SIGNATURE"

  # Returned if the operation is not allowed, or otherwise denied.
  E_OPERATION_NOT_ALLOWED = "OPERATION_NOT_ALLOWED"

  # Returned if a parameter is bad or missing, respectively. (Also returns an "info" field -- needs to be parsed (1) )
  E_INCORRECT_PARAMETER = "INCORRECT_PARAMETER"
  E_MISSING_PARAMETER = "MISSING_PARAMETER"

  # Returned on a Backend Error
  E_BACKEND_ERROR = "BACKEND_ERROR"

  # Returned when the object is constructed without a shared key, on requests that require
  # the shared key.
  E_MISSING_SECRET = "MISSING_SECRET"

  # Returned on an unknown error server side.
  E_UNKNOWN_ERROR = "UNKNOWN_ERROR"

  # The requested client or verifier ID for the instance of the object.
  attr_accessor :_id

  # The shared key, if required, for the client or verifier.
  attr_accessor :_key

  # The response from the server.
  attr_accessor :_res

  # Initialization is used to create the instance variables at creation.
  # Yubikey.new requires in the least an ID, and also takes a shared key.
  def initialize(id, key='')
    @_id = id
    @_key = key
  end

	public

	  # Verify an Yubikey OTP Token. Returns the value of the response variable "status"
	  #   req = yk.verify( @token, @id )
	  #     # => STATUS_VARIABLE
	  # Upon an error, you should use the Yubikey.last_response method for a more detailed collection of
	  # variables, including the request hash, info and further.
		def verify( otp, id = @_id )
		  @_id = id if @_id.nil?
			# Set up the full URL for the request, then pass it through the +URI+ gauntlet.
			fullurl = "https://api.yubico.com/wsapi/verify?id="+ (@_id.to_s) +"&otp="+ otp
			url = URI.parse(fullurl)
			http = Net::HTTP.new(url.host, 443)
      http.use_ssl = true
      # Make the call to the server and return the full response, not just the body (to be used later)
      res = http.get(url.path + "?" + url.query)
		  # Parse and find the status within the response's body, to verify this is, in fact, what we're looking for.
		  if ( !(/status=([a-zA-Z0-9_]+)/.match(res.body)) )
		    # If it's not, let's raise an error.
		    raise "Response Error: "+ res.body
	      else
	        @_res = res.body
	      end
		  # Finally, return the response value.
		  @_res.scan(/status=([a-zA-Z0-9_]+)[\s]/).first.to_s
		end

    # Return the last available Yubikey response body, in full, for parsing.
    #   req = yk.verify( @token, @_id )
    #   res = req.last_response
    #     # => "h=...\nstatus=OK"
	  #
	  # On an error, there will be many fields returned by this function you can sift out manually
	  # using regular expressions (to be implemented: last_response returns an associative array of the
	  # response.) for various variables.
	  #   req = yk.verify( @token, @_id )
	  #     # => "h=Z/D42NucC1nSlIVZqFPR3RO5dG4=\r\nt=2007-10-23T14:26:48Z\r\nstatus=REPLAYED_OTP\r\n\r\n"
	  #   res = yk.last_response
	  #   res["h"]
	  #     # => "h=Z/D42NucC1nSlIVZqFPR3RO5dG4="
	  #   res["t"]
	  #     # => "2007-10-23T14:26:48Z"
	  #   res["status"]
	  #     # => "REPLAYED_OTP"
	  #   res["info"]
	  #     # => nil
	  #
    def last_response
      hash = @_res.scan(/h=([\w_\=\/]+)[\s]/).first
	    timestamp = @_res.scan(/t=([\w\-:]+)[\s]/).first
	    status = @_res.scan(/status=([a-zA-Z0-9_]+)[\s]/).first
	    info = @_res.scan(/info=([\w\t\S\W]+)/).first

	    return { "h" => hash, "t" => timestamp, "status" => status, "info" => info }
    end

    # Requests add_key information from the server and returns all the information
    # required to encode a Yubikey. This command will create a new key on request,
    # so standard practice should be very secure and sure before this is called.
    #
    #   if( user.created? )
    #     user.keyflag = yk.add_key( @_id, timestamp )
    #     user.keydata = yk.last_response
    #   end
    #     # =>
		def add_key( id, nonce )
		  if not @_key
		    return E_MISSING_SECRET
		  end

			operation = "add_key"
			mesg = "id=#{id}&nonce=#{nonce}&operation=#{operation}"
			key = self.hmac( @_id, mesg, 'sha1' )
			url = URI.parse("http://api.yubico.com/wsapi/add_key?operation=#{operation}&id=#{id}&nonce=#{nonce}&h=#{key}")
      http = Net::HTTP.new(url.host, 443)
      http.use_ssl = true
      res = http.get(url.path + "?" + url.query)
			if( ( res.body ) && ( /status=([\w_]+)[\s]/.match(res.body) ) )
				@_res = res.body
				return res.body.scan(/status=([\w_]+)[\s]/).first
			else
				return E_UNKNOWN_ERROR
			end
		end

    # Signed request that deletes key +key_id+ from the server, with the client ID +id+
    # and passes +nonce+ as the request nonce.
		def delete_key( id, key_id, nonce )
		  if not @_key
		    return E_MISSING_SECRET
		  end
		  operation = "delete_key"
		  mesg = "key_id=#{key_id}&id=#{id}&nonce=#{nonce}&operation=#{operation}"
		  key = self.hmac( @_id, mesg, 'sha1' )
		  url = URI.parse("http://api.yubico.com/wsapi/delete_key?#{mesg}&h=#{key}")
		  http = Net::HTTP.new(url.host, 443)
      http.use_ssl = true
      res = http.get(url.path + "?" + url.query)
		  if( (res.body) && ( /status=([\w_]+)[\s]/.match(res.body) ) )
		    @_res = res.body
		    return res.body.scan(/status=([\w_]+)[\s]/).first
		  else
		    return E_UNKNOWN_ERROR
		  end
		end

    # Unimplemented
		def addClient
		end

    # Unimplemented
		def deleteClient
		end

		# Define the headers for our signed requests.
		headers = {
			"user-agent" => "Yubico::Auth Ruby 1.0",
			"x-hopbyhop" => "Magic happens here."
		}

	# Takes the OTP, shared key, and ID, creates the RFC3339 timestamp, and returns the hash.
	#   hash = yubikey_object.signKey( @otp, @shared, @id )
	#     # => "39ccb32d95edfdbcd882f2b01809724ec640ea16"
 		def hmac( key, msg, algorithm )
			OpenSSL::HMAC.hexdigest(OpenSSL::Digest::Digest.new(algorithm), key, msg)
		end

end


text:
package org.commonjava.maven.ext.core.impl;

import org.commonjava.maven.ext.common.model.Project;
import org.commonjava.maven.ext.core.ManipulationSession;
import org.commonjava.maven.ext.core.state.NexusStagingMavenPluginRemovalState;
import org.commonjava.maven.ext.core.state.PluginState;

import javax.inject.Named;
import javax.inject.Singleton;

import java.util.List;
import java.util.Set;

/**
 * {@link Manipulator} implementation that can remove nexus-staging-maven-plugin from a project's pom file.
 * Configuration is stored in a {@link PluginState} instance, which is in turn stored in the
 * {@link ManipulationSession}.
 */
@Named("nexus-staging-maven-plugin-removal-manipulator")
@Singleton
public class NexusStagingMavenPluginRemovalManipulator extends BasePluginRemovalManipulator
        implements Manipulator
{
    /**
     * Initialize the {@link PluginState} state holder in the {@link ManipulationSession}. This state holder detects
     * version-change configuration from the Maven user properties (-D properties from the CLI) and makes it available
     * for later.
     *
     * @param session the session
     */
    @Override
    public void init( ManipulationSession session )
    {
        this.session = session;
        session.setState( new NexusStagingMavenPluginRemovalState( session.getUserProperties() ) );
    }

    /**
     * Apply the alignment changes to the list of {@link Project}s given.
     *
     * @param projects the projects to apply changes to
     */
    @Override
    public Set<Project> applyChanges( final List<Project> projects )
    {
        return applyChanges( projects, session.getState( NexusStagingMavenPluginRemovalState.class ) );
    }

    /**
     * Determines the order in which manipulators are run, with the lowest number running first.
     * Uses a 100-point scale.
     *
     * @return one greater than current index for {@code PluginRemovalManipulator}
     */
    @Override
    public int getExecutionIndex()
    {
        return 53;
    }
}


text:
import React, { Component } from 'react';
import classNames from 'classnames';
import PropTypes from 'prop-types';

import './task-item-row.css';
import Img from 'react-image';
import ReactTooltip from 'react-tooltip';
import Icon from '../../atoms/icon';
import { connect } from 'react-redux';
import { I18n } from 'react-i18next';

export class TaskItemRow extends Component {
  constructor() {
    super(...arguments);

    this.state = {};

    this.renderLabel = this.renderLabel.bind(this);
  }

  render() {
    const { task } = this.props;

    let containerClasses = classNames(
      'task-item-row',
      {
        'task-item--completed': task.completed,
      },
      { 'is-active': this.props.isActive },
    );

    return (
      <I18n ns="translations">
        {(t, { i18n }) => (
          // Removed tab index as it causes error in the active task when switching between fields

            {task && task.isCritical && (

                <Icon name="warning" className="warning grow" />

            )}

{this.renderTitle(task, t)}

{this.renderAssignee(task)}

{this.renderLabel(task)}

        )}
      </I18n>
    );
  }

  renderTitle(task, translate) {
    let classNames = 'task-item-title';
    if (task.isDone) {
      classNames += ' is-done';
    }

    return (

        {task.title && task.title !== '' ? (
          task.title
        ) : (
          {translate('task.unnamed-task')}
        )}

    );
  }

  renderAssignee(task) {
    if (!task.assignee) return;
    const avatar = task.assignee.photoURL ? (

    ) : (
      ''
    );
    return (

        <ReactTooltip id="task-assignee-tooltip" type="light" effect="solid" />
        {avatar}

    );
  }

  renderLabel(task) {
    if (
      !task.label ||
      (Object.keys(task.label).length === 0 &&
        task.label.constructor === Object)
    ) {
      return null;
    }
    const labels =
      this.props.selectedProject && this.props.selectedProject.popularTags
        ? this.props.selectedProject.popularTags
        : [];
    return (

        {Object.keys(task.label).map(label => {
          const bg = labels[label] ? labels[label] : '999';
          return (
            <span
              key={label}
              style={{ backgroundColor: `#${bg}` }}
              className="label-default"
            >
              {label}

          );
        })}

    );
  }
}

TaskItemRow.propTypes = {
  task: PropTypes.object.isRequired,
  isActive: PropTypes.bool.isRequired,
  selectedProject: PropTypes.object,
};

const mapStateToProps = state => {
  return {};
};

export default connect(mapStateToProps, {})(TaskItemRow);


text:
/* eslint-disable no-console */
/* istanbul ignore file */

import { register } from 'register-service-worker'

const notifyUserAboutUpdate = worker => {
  confirm('New Content!', () => {
    worker.postMessage({ action: 'skipWaiting' })
  })
}

if (process.env.NODE_ENV === 'production') {
  register(`${process.env.BASE_URL}service-worker.js`, {
    ready () {
      console.log(
        'App is being served from cache by a service worker.\n' +
        'For more details, visit https://goo.gl/AFskqB'
      )
    },
    registered () {
      console.log('Service worker has been registered.')
    },
    cached () {
      console.log('Content has been cached for offline use.')
    },
    updatefound () {
      console.log('New content is downloading.')
    },
    updated (registration) {
      console.log('New content is available; please refresh.')
      notifyUserAboutUpdate(registration.waiting)
    },
    offline () {
      console.log('No internet connection found. App is running in offline mode.')
    },
    error (error) {
      console.error('Error during service worker registration:', error)
    }
  })

  let refreshing
  navigator.serviceWorker.addEventListener('controllerchange', () => {
    if (refreshing) return
    window.location.reload()
    refreshing = true
  })
}


text:
egame.define("ArcadeBody", ["Arcade"], function(Arcade) {
    /**
     * The Physics Body is linked to a single Sprite. All physics operations should be performed against the body rather than
     * the Sprite itself. For example you can set the velocity, acceleration, bounce values etc all on the Body.
     *
     * @class egame.Physics.Arcade.Body
     * @constructor
     * @param {egame.Sprite} sprite - The Sprite object this physics body belongs to.
     */
    egame.Physics.Arcade.Body = function(sprite) {
        /**
         * @property {egame.Sprite} sprite - Reference to the parent Sprite.
         */
        this.sprite = sprite;

        /*
         * @property {egame.Game} game - Local reference to game.
         */
        this.game = sprite.game;

        /**
         * @property {number} type - The type of physics system this body belongs to.
         */
        this.type = egame.Physics.ARCADE;

        /**
         * @property {boolean} enable - A disabled body won't be checked for any form of collision or overlap or have its pre/post updates run.
         * @default
         */
        this.enable = true;

        /**
         * @property {egame.Point} offset - The offset of the Physics Body from the Sprite x/y position.
         */
        this.offset = new egame.Point();

        /**
         * @property {egame.Point} position - The position of the physics body.
         * @readonly
         */
        this.position = new egame.Point(sprite.x, sprite.y);

        /**
         * @property {egame.Point} prev - The previous position of the physics body.
         * @readonly
         */
        this.prev = new egame.Point(this.position.x, this.position.y);

        /**
         * @property {boolean} allowRotation - Allow this Body to be rotated? (via angularVelocity, etc)
         * @default
         */
        this.allowRotation = true;

        /**
         * An Arcade Physics Body can have angularVelocity and angularAcceleration. Please understand that the collision Body
         * itself never rotates, it is always axis-aligned. However these values are passed up to the parent Sprite and updates its rotation.
         * @property {number} rotation
         */
        this.rotation = sprite.rotation;

        /**
         * @property {number} preRotation - The previous rotation of the physics body.
         * @readonly
         */
        this.preRotation = sprite.rotation;

        /**
         * @property {number} width - The calculated width of the physics body.
         * @readonly
         */
        this.width = sprite.width;

        /**
         * @property {number} height - The calculated height of the physics body.
         * @readonly
         */
        this.height = sprite.height;

        /**
         * @property {number} sourceWidth - The un-scaled original size.
         * @readonly
         */
        this.sourceWidth = sprite.width;

        /**
         * @property {number} sourceHeight - The un-scaled original size.
         * @readonly
         */
        this.sourceHeight = sprite.height;

        if (sprite.texture) {
            this.sourceWidth = sprite.texture.frame.width;
            this.sourceHeight = sprite.texture.frame.height;
        }

        /**
         * @property {number} halfWidth - The calculated width / 2 of the physics body.
         * @readonly
         */
        this.halfWidth = Math.abs(sprite.width / 2);

        /**
         * @property {number} halfHeight - The calculated height / 2 of the physics body.
         * @readonly
         */
        this.halfHeight = Math.abs(sprite.height / 2);

        /**
         * @property {egame.Point} center - The center coordinate of the Physics Body.
         * @readonly
         */
        this.center = new egame.Point(sprite.x + this.halfWidth, sprite.y + this.halfHeight);

        /**
         * @property {egame.Point} velocity - The velocity, or rate of change in speed of the Body. Measured in pixels per second.
         */
        this.velocity = new egame.Point();

        /**
         * @property {egame.Point} newVelocity - The new velocity. Calculated during the Body.preUpdate and applied to its position.
         * @readonly
         */
        this.newVelocity = new egame.Point(0, 0);

        /**
         * @property {egame.Point} deltaMax - The Sprite position is updated based on the delta x/y values. You can set a cap on those (both +-) using deltaMax.
         */
        this.deltaMax = new egame.Point(0, 0);

        /**
         * @property {egame.Point} acceleration - The acceleration is the rate of change of the velocity. Measured in pixels per second squared.
         */
        this.acceleration = new egame.Point();

        /**
         * @property {egame.Point} drag - The drag applied to the motion of the Body.
         */
        this.drag = new egame.Point();

        /**
         * @property {boolean} allowGravity - Allow this Body to be influenced by gravity? Either world or local.
         * @default
         */
        this.allowGravity = true;

        /**
         * @property {egame.Point} gravity - A local gravity applied to this Body. If non-zero this over rides any world gravity, unless Body.allowGravity is set to false.
         */
        this.gravity = new egame.Point(0, 0);

        /**
         * @property {egame.Point} bounce - The elasticity of the Body when colliding. bounce.x/y = 1 means full rebound, bounce.x/y = 0.5 means 50% rebound velocity.
         */
        this.bounce = new egame.Point();

        /**
         * @property {egame.Point} maxVelocity - The maximum velocity in pixels per second sq. that the Body can reach.
         * @default
         */
        this.maxVelocity = new egame.Point(10000, 10000);

        /**
         * @property {egame.Point} friction - The amount of movement that will occur if another object 'rides' this one.
         */
        this.friction = new egame.Point(1, 0);

        /**
         * @property {number} angularVelocity - The angular velocity controls the rotation speed of the Body. It is measured in radians per second.
         * @default
         */
        this.angularVelocity = 0;

        /**
         * @property {number} angularAcceleration - The angular acceleration is the rate of change of the angular velocity. Measured in radians per second squared.
         * @default
         */
        this.angularAcceleration = 0;

        /**
         * @property {number} angularDrag - The drag applied during the rotation of the Body.
         * @default
         */
        this.angularDrag = 0;

        /**
         * @property {number} maxAngular - The maximum angular velocity in radians per second that the Body can reach.
         * @default
         */
        this.maxAngular = 1000;

        /**
         * @property {number} mass - The mass of the Body. When two bodies collide their mass is used in the calculation to determine the exchange of velocity.
         * @default
         */
        this.mass = 1;

        /**
         * @property {number} angle - The angle of the Body in radians, as calculated by its angularVelocity.
         * @readonly
         */
        this.angle = 0;

        /**
         * @property {number} speed - The speed of the Body as calculated by its velocity.
         * @readonly
         */
        this.speed = 0;

        /**
         * @property {number} facing - A const reference to the direction the Body is traveling or facing.
         * @default
         */
        this.facing = egame.NONE;

        /**
         * @property {boolean} immovable - An immovable Body will not receive any impacts from other bodies.
         * @default
         */
        this.immovable = false;

        /**
         * If you have a Body that is being moved around the world via a tween or a Group motion, but its local x/y position never
         * actually changes, then you should set Body.moves = false. Otherwise it will most likely fly off the screen.
         * If you want the physics system to move the body around, then set moves to true.
         * @property {boolean} moves - Set to true to allow the Physics system to move this Body, otherwise false to move it manually.
         * @default
         */
        this.moves = true;

        /**
         * This flag allows you to disable the custom x separation that takes place by Physics.Arcade.separate.
         * Used in combination with your own collision processHandler you can create whatever type of collision response you need.
         * @property {boolean} customSeparateX - Use a custom separation system or the built-in one?
         * @default
         */
        this.customSeparateX = false;

        /**
         * This flag allows you to disable the custom y separation that takes place by Physics.Arcade.separate.
         * Used in combination with your own collision processHandler you can create whatever type of collision response you need.
         * @property {boolean} customSeparateY - Use a custom separation system or the built-in one?
         * @default
         */
        this.customSeparateY = false;

        /**
         * When this body collides with another, the amount of overlap is stored here.
         * @property {number} overlapX - The amount of horizontal overlap during the collision.
         */
        this.overlapX = 0;

        /**
         * When this body collides with another, the amount of overlap is stored here.
         * @property {number} overlapY - The amount of vertical overlap during the collision.
         */
        this.overlapY = 0;

        /**
         * If a body is overlapping with another body, but neither of them are moving (maybe they spawned on-top of each other?) this is set to true.
         * @property {boolean} embedded - Body embed value.
         */
        this.embedded = false;

        /**
         * A Body can be set to collide against the World bounds automatically and rebound back into the World if this is set to true. Otherwise it will leave the World.
         * @property {boolean} collideWorldBounds - Should the Body collide with the World bounds?
         */
        this.collideWorldBounds = false;

        /**
         * Set the checkCollision properties to control which directions collision is processed for this Body.
         * For example checkCollision.up = false means it won't collide when the collision happened while moving up.
         * @property {object} checkCollision - An object containing allowed collision.
         */
        this.checkCollision = {
            none: false,
            any: true,
            up: true,
            down: true,
            left: true,
            right: true
        };

        /**
         * This object is populated with boolean values when the Body collides with another.
         * touching.up = true means the collision happened to the top of this Body for example.
         * @property {object} touching - An object containing touching results.
         */
        this.touching = {
            none: true,
            up: false,
            down: false,
            left: false,
            right: false
        };

        /**
         * This object is populated with previous touching values from the bodies previous collision.
         * @property {object} wasTouching - An object containing previous touching results.
         */
        this.wasTouching = {
            none: true,
            up: false,
            down: false,
            left: false,
            right: false
        };

        /**
         * This object is populated with boolean values when the Body collides with the World bounds or a Tile.
         * For example if blocked.up is true then the Body cannot move up.
         * @property {object} blocked - An object containing on which faces this Body is blocked from moving, if any.
         */
        this.blocked = {
            up: false,
            down: false,
            left: false,
            right: false
        };

        /**
         * If this is an especially small or fast moving object then it can sometimes skip over tilemap collisions if it moves through a tile in a step.
         * Set this padding value to add extra padding to its bounds. tilePadding.x applied to its width, y to its height.
         * @property {egame.Point} tilePadding - Extra padding to be added to this sprite's dimensions when checking for tile collision.
         */
        this.tilePadding = new egame.Point();

        /**
         * @property {boolean} dirty - If this Body in a preUpdate (true) or postUpdate (false) state?
         */
        this.dirty = false;

        /**
         * @property {boolean} skipQuadTree - If true and you collide this Sprite against a Group, it will disable the collision check from using a QuadTree.
         */
        this.skipQuadTree = false;

        /**
         * If true the Body will check itself against the Sprite.getBounds() dimensions and adjust its width and height accordingly.
         * If false it will compare its dimensions against the Sprite scale instead, and adjust its width height if the scale has changed.
         * Typically you would need to enable syncBounds if your sprite is the child of a responsive display object such as a FlexLayer,
         * or in any situation where the Sprite scale doesn't change, but its parents scale is effecting the dimensions regardless.
         * @property {boolean} syncBounds
         * @default
         */
        this.syncBounds = false;

        /**
         * @property {boolean} _reset - Internal cache var.
         * @private
         */
        this._reset = true;

        /**
         * @property {number} _sx - Internal cache var.
         * @private
         */
        this._sx = sprite.scale.x;

        /**
         * @property {number} _sy - Internal cache var.
         * @private
         */
        this._sy = sprite.scale.y;

        /**
         * @property {number} _dx - Internal cache var.
         * @private
         */
        this._dx = 0;

        /**
         * @property {number} _dy - Internal cache var.
         * @private
         */
        this._dy = 0;

    };

    egame.Physics.Arcade.Body.prototype = {
        /**
        * Internal method.
        *
        * @method Phaser.Physics.Arcade.Body#updateBounds
        * @protected
        */
        updateBounds: function () {

            if (this.syncBounds)
            {
                var b = this.sprite.getBounds();
                b.ceilAll();

                if (b.width !== this.width || b.height !== this.height)
                {
                    this.width = b.width;
                    this.height = b.height;
                    this._reset = true;
                }
            }
            else
            {
                var asx = Math.abs(this.sprite.scale.x);
                var asy = Math.abs(this.sprite.scale.y);

                if (asx !== this._sx || asy !== this._sy)
                {
                    this.width = this.sourceWidth * asx;
                    this.height = this.sourceHeight * asy;
                    this._sx = asx;
                    this._sy = asy;
                    this._reset = true;
                }
            }

            if (this._reset)
            {
                this.halfWidth = Math.floor(this.width / 2);
                this.halfHeight = Math.floor(this.height / 2);
                this.center.setTo(this.position.x + this.halfWidth, this.position.y + this.halfHeight);
            }

        },

        /**
        * Internal method.
        *
        * @method Phaser.Physics.Arcade.Body#preUpdate
        * @protected
        */
        preUpdate: function () {
            if (!this.enable || this.game.physics.arcade.isPaused)
            {
                return;
            }

            this.dirty = true;

            //  Store and reset collision flags
            this.wasTouching.none = this.touching.none;
            this.wasTouching.up = this.touching.up;
            this.wasTouching.down = this.touching.down;
            this.wasTouching.left = this.touching.left;
            this.wasTouching.right = this.touching.right;

            this.touching.none = true;
            this.touching.up = false;
            this.touching.down = false;
            this.touching.left = false;
            this.touching.right = false;

            this.blocked.up = false;
            this.blocked.down = false;
            this.blocked.left = false;
            this.blocked.right = false;

            this.embedded = false;

            this.updateBounds();
            this.position.x = (this.sprite.world.x - (this.sprite.anchor.x * this.width)) + this.offset.x;
            this.position.y = (this.sprite.world.y - (this.sprite.anchor.y * this.height)) + this.offset.y;
            this.rotation = this.sprite.angle;

            this.preRotation = this.rotation;

            if (this._reset || this.sprite.fresh)
            {
                this.prev.x = this.position.x;
                this.prev.y = this.position.y;
            }

            if (this.moves)
            {
                this.game.physics.arcade.updateMotion(this);

                this.newVelocity.set(this.velocity.x * this.game.time.physicsElapsed, this.velocity.y * this.game.time.physicsElapsed);
                this.position.x += this.newVelocity.x;
                this.position.y += this.newVelocity.y;

                if (this.position.x !== this.prev.x || this.position.y !== this.prev.y)
                {
                    this.speed = Math.sqrt(this.velocity.x * this.velocity.x + this.velocity.y * this.velocity.y);
                    this.angle = Math.atan2(this.velocity.y, this.velocity.x);
                }

                //  Now the State update will throw collision checks at the Body
                //  And finally we'll integrate the new position back to the Sprite in postUpdate

                if (this.collideWorldBounds)
                {
                    this.checkWorldBounds();
                }
            }

            this._dx = this.deltaX();
            this._dy = this.deltaY();

            this._reset = false;

        },

        /**
         * Internal method.
         *
         * @method egame.Physics.Arcade.Body#postUpdate
         * @protected
         */
        postUpdate: function() {

            //  Only allow postUpdate to be called once per frame
            if (!this.enable || !this.dirty) {
                return;
            }

            this.dirty = false;

            if (this.deltaX() < 0) {
                this.facing = egame.LEFT;
            } else if (this.deltaX() > 0) {
                this.facing = egame.RIGHT;
            }

            if (this.deltaY() < 0) {
                this.facing = egame.UP;
            } else if (this.deltaY() > 0) {
                this.facing = egame.DOWN;
            }

            if (this.moves) {
                this._dx = this.deltaX();
                this._dy = this.deltaY();

                if (this.deltaMax.x !== 0 && this._dx !== 0) {
                    if (this._dx < 0 && this._dx < -this.deltaMax.x) {
                        this._dx = -this.deltaMax.x;
                    } else if (this._dx > 0 && this._dx > this.deltaMax.x) {
                        this._dx = this.deltaMax.x;
                    }
                }

                if (this.deltaMax.y !== 0 && this._dy !== 0) {
                    if (this._dy < 0 && this._dy < -this.deltaMax.y) {
                        this._dy = -this.deltaMax.y;
                    } else if (this._dy > 0 && this._dy > this.deltaMax.y) {
                        this._dy = this.deltaMax.y;
                    }
                }

                this.sprite.position.x += this._dx;
                this.sprite.position.y += this._dy;
                this._reset = true;
            }
            //TODO NIU
            this.center.set(this.position.x + this.halfWidth, this.position.y + this.halfHeight);

            if (this.allowRotation) {
                this.sprite.angle += this.deltaZ();
            }

            this.prev.x = this.position.x;
            this.prev.y = this.position.y;

        },

        /**
         * Removes this bodys reference to its parent sprite, freeing it up for gc.
         *
         * @method egame.Physics.Arcade.Body#destroy
         */
        destroy: function() {

            if (this.sprite.parent && this.sprite.parent instanceof egame.Group) {
                this.sprite.parent.removeFromHash(this.sprite);
            }

            this.sprite.body = null;
            this.sprite = null;

        },

        /**
         * Internal method.
         *
         * @method egame.Physics.Arcade.Body#checkWorldBounds
         * @protected
         */
        checkWorldBounds: function() {

            var pos = this.position;
            var bounds = this.game.physics.arcade.bounds;
            var check = this.game.physics.arcade.checkCollision;
            // console.log(bounds)
            // console.log(pos)
            if (pos.x < bounds.x && check.left) {
                // console.log(check)
                pos.x = bounds.x;
                this.velocity.x *= -this.bounce.x;
                // console.log("v:"+this.velocity.x)
                this.blocked.left = true;
            } else if (this.right > bounds.right && check.right) {
                pos.x = bounds.right - this.width;
                this.velocity.x *= -this.bounce.x;
                this.blocked.right = true;
            }

            if (pos.y < bounds.y && check.up) {
                pos.y = bounds.y;
                this.velocity.y *= -this.bounce.y;
                this.blocked.up = true;
            } else if (this.bottom > bounds.bottom && check.down) {
                pos.y = bounds.bottom - this.height;
                this.velocity.y *= -this.bounce.y;
                this.blocked.down = true;
            }

        },

        /**
         * You can modify the size of the physics Body to be any dimension you need.
         * So it could be smaller or larger than the parent Sprite. You can also control the x and y offset, which
         * is the position of the Body relative to the top-left of the Sprite.
         *
         * @method egame.Physics.Arcade.Body#setSize
         * @param {number} width - The width of the Body.
         * @param {number} height - The height of the Body.
         * @param {number} [offsetX] - The X offset of the Body from the Sprite position.
         * @param {number} [offsetY] - The Y offset of the Body from the Sprite position.
         */
        setSize: function(width, height, offsetX, offsetY) {

            if (offsetX === undefined) {
                offsetX = this.offset.x;
            }
            if (offsetY === undefined) {
                offsetY = this.offset.y;
            }

            this.sourceWidth = width;
            this.sourceHeight = height;
            this.width = this.sourceWidth * this._sx;
            this.height = this.sourceHeight * this._sy;
            this.halfWidth = Math.floor(this.width / 2);
            this.halfHeight = Math.floor(this.height / 2);
            this.offset.setTo(offsetX, offsetY);

            this.center.setTo(this.position.x + this.halfWidth, this.position.y + this.halfHeight);

        },

        /**
         * Resets all Body values (velocity, acceleration, rotation, etc)
         *
         * @method egame.Physics.Arcade.Body#reset
         * @param {number} x - The new x position of the Body.
         * @param {number} y - The new y position of the Body.
         */
        reset: function(x, y) {

            this.velocity.set(0);
            this.acceleration.set(0);

            this.speed = 0;
            this.angularVelocity = 0;
            this.angularAcceleration = 0;

            this.position.x = (x - (this.sprite.anchor.x * this.width)) + this.offset.x;
            this.position.y = (y - (this.sprite.anchor.y * this.height)) + this.offset.y;

            this.prev.x = this.position.x;
            this.prev.y = this.position.y;

            this.rotation = this.sprite.angle;
            this.preRotation = this.rotation;

            this._sx = this.sprite.scale.x;
            this._sy = this.sprite.scale.y;

            this.center.setTo(this.position.x + this.halfWidth, this.position.y + this.halfHeight);

        },

        /**
         * Tests if a world point lies within this Body.
         *
         * @method egame.Physics.Arcade.Body#hitTest
         * @param {number} x - The world x coordinate to test.
         * @param {number} y - The world y coordinate to test.
         * @return {boolean} True if the given coordinates are inside this Body, otherwise false.
         */
        hitTest: function(x, y) {
            return egame.Rectangle.contains(this, x, y);
        },

        /**
         * Returns true if the bottom of this Body is in contact with either the world bounds or a tile.
         *
         * @method egame.Physics.Arcade.Body#onFloor
         * @return {boolean} True if in contact with either the world bounds or a tile.
         */
        onFloor: function() {
            return this.blocked.down;
        },

        /**
         * Returns true if either side of this Body is in contact with either the world bounds or a tile.
         *
         * @method egame.Physics.Arcade.Body#onWall
         * @return {boolean} True if in contact with either the world bounds or a tile.
         */
        onWall: function() {
            return (this.blocked.left || this.blocked.right);
        },

        /**
         * Returns the absolute delta x value.
         *
         * @method egame.Physics.Arcade.Body#deltaAbsX
         * @return {number} The absolute delta value.
         */
        deltaAbsX: function() {
            return (this.deltaX() > 0 ? this.deltaX() : -this.deltaX());
        },

        /**
         * Returns the absolute delta y value.
         *
         * @method egame.Physics.Arcade.Body#deltaAbsY
         * @return {number} The absolute delta value.
         */
        deltaAbsY: function() {
            return (this.deltaY() > 0 ? this.deltaY() : -this.deltaY());
        },

        /**
         * Returns the delta x value. The difference between Body.x now and in the previous step.
         *
         * @method egame.Physics.Arcade.Body#deltaX
         * @return {number} The delta value. Positive if the motion was to the right, negative if to the left.
         */
        deltaX: function() {
            return this.position.x - this.prev.x;
        },

        /**
         * Returns the delta y value. The difference between Body.y now and in the previous step.
         *
         * @method egame.Physics.Arcade.Body#deltaY
         * @return {number} The delta value. Positive if the motion was downwards, negative if upwards.
         */
        deltaY: function() {
            return this.position.y - this.prev.y;
        },

        /**
         * Returns the delta z value. The difference between Body.rotation now and in the previous step.
         *
         * @method egame.Physics.Arcade.Body#deltaZ
         * @return {number} The delta value. Positive if the motion was clockwise, negative if anti-clockwise.
         */
        deltaZ: function() {
            return this.rotation - this.preRotation;
        }

    };

    /**
     * @name egame.Physics.Arcade.Body#bottom
     * @property {number} bottom - The bottom value of this Body (same as Body.y + Body.height)
     * @readonly
     */
    Object.defineProperty(egame.Physics.Arcade.Body.prototype, "bottom", {

        get: function() {
            return this.position.y + this.height;
        }

    });

    /**
     * @name egame.Physics.Arcade.Body#right
     * @property {number} right - The right value of this Body (same as Body.x + Body.width)
     * @readonly
     */
    Object.defineProperty(egame.Physics.Arcade.Body.prototype, "right", {

        get: function() {
            return this.position.x + this.width;

        }

    });

    /**
     * @name egame.Physics.Arcade.Body#x
     * @property {number} x - The x position.
     */
    Object.defineProperty(egame.Physics.Arcade.Body.prototype, "x", {

        get: function() {
            return this.position.x;
        },

        set: function(value) {

            this.position.x = value;
        }

    });

    /**
     * @name egame.Physics.Arcade.Body#y
     * @property {number} y - The y position.
     */
    Object.defineProperty(egame.Physics.Arcade.Body.prototype, "y", {

        get: function() {
            return this.position.y;
        },

        set: function(value) {

            this.position.y = value;

        }

    });

    /**
     * Render Sprite Body.
     *
     * @method egame.Physics.Arcade.Body#render
     * @param {object} context - The context to render to.
     * @param {egame.Physics.Arcade.Body} body - The Body to render the info of.
     * @param {string} [color='rgba(0,255,0,0.4)'] - color of the debug info to be rendered. (format is css color string).
     * @param {boolean} [filled=true] - Render the objected as a filled (default, true) or a stroked (false)
     */
    egame.Physics.Arcade.Body.render = function(context, body, color, filled) {
        if (filled === undefined) {
            filled = true;
        }

        color = color || 'rgba(0,255,0,0.4)';

        if (filled) {
            context.fillStyle = color;
            context.fillRect(body.position.x - body.game.camera.x, body.position.y - body.game.camera.y, body.width, body.height);
        } else {
            context.strokeStyle = color;
            context.strokeRect(body.position.x - body.game.camera.x, body.position.y - body.game.camera.y, body.width, body.height);
        }

    };

    /**
     * Render Sprite Body Physics Data as text.
     *
     * @method egame.Physics.Arcade.Body#renderBodyInfo
     * @param {egame.Physics.Arcade.Body} body - The Body to render the info of.
     * @param {number} x - X position of the debug info to be rendered.
     * @param {number} y - Y position of the debug info to be rendered.
     * @param {string} [color='rgb(255,255,255)'] - color of the debug info to be rendered. (format is css color string).
     */
    egame.Physics.Arcade.Body.renderBodyInfo = function(debug, body) {

        debug.line('x: ' + body.x.toFixed(2), 'y: ' + body.y.toFixed(2), 'width: ' + body.width, 'height: ' + body.height);
        debug.line('velocity x: ' + body.velocity.x.toFixed(2), 'y: ' + body.velocity.y.toFixed(2), 'deltaX: ' + body._dx.toFixed(2), 'deltaY: ' + body._dy.toFixed(2));
        debug.line('acceleration x: ' + body.acceleration.x.toFixed(2), 'y: ' + body.acceleration.y.toFixed(2), 'speed: ' + body.speed.toFixed(2), 'angle: ' + body.angle.toFixed(2));
        debug.line('gravity x: ' + body.gravity.x, 'y: ' + body.gravity.y, 'bounce x: ' + body.bounce.x.toFixed(2), 'y: ' + body.bounce.y.toFixed(2));
        debug.line('touching left: ' + body.touching.left, 'right: ' + body.touching.right, 'up: ' + body.touching.up, 'down: ' + body.touching.down);
        debug.line('blocked left: ' + body.blocked.left, 'right: ' + body.blocked.right, 'up: ' + body.blocked.up, 'down: ' + body.blocked.down);

    };

    egame.Physics.Arcade.Body.prototype.constructor = egame.Physics.Arcade.Body;

    return egame.Physics.Arcade.Body;
});


text:
require "helper"

describe Google::Cloud::Speech::Project, :recognize, :mock_speech do
  let(:results_json) { "{\"results\":[{\"alternatives\":[{\"transcript\":\"how old is the Brooklyn Bridge\",\"confidence\":0.98267895}]}]}" }
  let(:results_grpc) { Google::Cloud::Speech::V1::RecognizeResponse.decode_json results_json }
  let(:results) { results_grpc.results.map { |result_grpc| Google::Cloud::Speech::Result.from_grpc result_grpc } }
  let(:filepath) { "acceptance/data/audio.raw" }

  it "recognizes audio from local file path" do
    config_grpc = Google::Cloud::Speech::V1::RecognitionConfig.new(encoding: :LINEAR16, language_code: "en-US", sample_rate_hertz: 16000)
    audio_grpc = Google::Cloud::Speech::V1::RecognitionAudio.new(content: File.read(filepath, mode: "rb"))

    mock = Minitest::Mock.new
    mock.expect :recognize, results_grpc, [config_grpc, audio_grpc, options: default_options]

    speech.service.mocked_service = mock
    results = speech.recognize filepath, encoding: :linear16, language: "en-US", sample_rate: 16000
    mock.verify

    results.count.must_equal 1
    results.first.transcript.must_equal "how old is the Brooklyn Bridge"
    results.first.confidence.must_be_close_to 0.98267895
    results.first.alternatives.must_be :empty?
  end

  it "recognizes audio from local file object" do
    config_grpc = Google::Cloud::Speech::V1::RecognitionConfig.new(encoding: :LINEAR16, language_code: "en-US", sample_rate_hertz: 16000)
    audio_grpc = Google::Cloud::Speech::V1::RecognitionAudio.new(content: File.read(filepath, mode: "rb"))

    mock = Minitest::Mock.new
    mock.expect :recognize, results_grpc, [config_grpc, audio_grpc, options: default_options]

    speech.service.mocked_service = mock
    results = speech.recognize File.open(filepath, "rb"), encoding: :linear16, language: "en-US", sample_rate: 16000
    mock.verify

    results.count.must_equal 1
    results.first.transcript.must_equal "how old is the Brooklyn Bridge"
    results.first.confidence.must_be_close_to 0.98267895
    results.first.alternatives.must_be :empty?
  end

  it "recognizes audio from GCS URL" do
    config_grpc = Google::Cloud::Speech::V1::RecognitionConfig.new(encoding: :LINEAR16, language_code: "en-US", sample_rate_hertz: 16000)
    audio_grpc = Google::Cloud::Speech::V1::RecognitionAudio.new(uri: "gs://some_bucket/audio.raw")

    mock = Minitest::Mock.new
    mock.expect :recognize, results_grpc, [config_grpc, audio_grpc, options: default_options]

    speech.service.mocked_service = mock
    results = speech.recognize "gs://some_bucket/audio.raw", encoding: :linear16, language: "en-US", sample_rate: 16000
    mock.verify

    results.count.must_equal 1
    results.first.transcript.must_equal "how old is the Brooklyn Bridge"
    results.first.confidence.must_be_close_to 0.98267895
    results.first.alternatives.must_be :empty?
  end

  it "recognizes audio from Storage File URL" do
    config_grpc = Google::Cloud::Speech::V1::RecognitionConfig.new(encoding: :LINEAR16, language_code: "en-US", sample_rate_hertz: 16000)
    audio_grpc = Google::Cloud::Speech::V1::RecognitionAudio.new(uri: "gs://some_bucket/audio.raw")

    mock = Minitest::Mock.new
    mock.expect :recognize, results_grpc, [config_grpc, audio_grpc, options: default_options]

    speech.service.mocked_service = mock
    gcs_fake = OpenStruct.new to_gs_url: "gs://some_bucket/audio.raw"
    results = speech.recognize gcs_fake, encoding: :linear16, language: "en-US", sample_rate: 16000
    mock.verify

    results.count.must_equal 1
    results.first.transcript.must_equal "how old is the Brooklyn Bridge"
    results.first.confidence.must_be_close_to 0.98267895
    results.first.alternatives.must_be :empty?
  end

  it "recognizes audio from Audio object" do
    config_grpc = Google::Cloud::Speech::V1::RecognitionConfig.new(encoding: :LINEAR16, language_code: "en-US", sample_rate_hertz: 16000)
    audio_grpc = Google::Cloud::Speech::V1::RecognitionAudio.new(content: File.read(filepath, mode: "rb"))

    mock = Minitest::Mock.new
    mock.expect :recognize, results_grpc, [config_grpc, audio_grpc, options: default_options]

    speech.service.mocked_service = mock
    audio = speech.audio filepath, encoding: :linear16, language: "en-US", sample_rate: 16000
    results = speech.recognize audio
    mock.verify

    results.count.must_equal 1
    results.first.transcript.must_equal "how old is the Brooklyn Bridge"
    results.first.confidence.must_be_close_to 0.98267895
    results.first.alternatives.must_be :empty?
  end

  it "recognizes audio from Audio object, preserving attributes" do
    config_grpc = Google::Cloud::Speech::V1::RecognitionConfig.new(encoding: :LINEAR16, language_code: "en-US", sample_rate_hertz: 16000)
    audio_grpc = Google::Cloud::Speech::V1::RecognitionAudio.new(content: File.read(filepath, mode: "rb"))

    mock = Minitest::Mock.new
    mock.expect :recognize, results_grpc, [config_grpc, audio_grpc, options: default_options]

    speech.service.mocked_service = mock
    audio = speech.audio filepath
    results = speech.recognize audio, encoding: :linear16, language: "en-US", sample_rate: 16000
    mock.verify

    results.count.must_equal 1
    results.first.transcript.must_equal "how old is the Brooklyn Bridge"
    results.first.confidence.must_be_close_to 0.98267895
    results.first.alternatives.must_be :empty?
  end

  it "recognizes audio from Audio object, overriding attributes" do
    config_grpc = Google::Cloud::Speech::V1::RecognitionConfig.new(encoding: :LINEAR16, language_code: "en-US", sample_rate_hertz: 16000)
    audio_grpc = Google::Cloud::Speech::V1::RecognitionAudio.new(content: File.read(filepath, mode: "rb"))

    mock = Minitest::Mock.new
    mock.expect :recognize, results_grpc, [config_grpc, audio_grpc, options: default_options]

    speech.service.mocked_service = mock
    audio = speech.audio filepath, encoding: :flac, sample_rate: 48000, language: "en-US"
    results = speech.recognize audio, encoding: :linear16, language: "en-US", sample_rate: 16000
    mock.verify

    results.count.must_equal 1
    results.first.transcript.must_equal "how old is the Brooklyn Bridge"
    results.first.confidence.must_be_close_to 0.98267895
    results.first.alternatives.must_be :empty?
  end
end


text:
package jp.ac.nii.prl.mape.autoscaling.analysis.repository;

import java.util.Optional;

import org.springframework.data.jpa.repository.JpaRepository;

import jp.ac.nii.prl.mape.autoscaling.analysis.model.Adaptation;

public interface AdaptationRepository extends JpaRepository<Adaptation, Integer> {

	Optional<Adaptation> findById(Integer adaptationId);

	Optional<Adaptation> findByDeploymentId(Integer deploymentId);

}