text:
import { factory } from '../../utils/factory';
import { createAlgorithm02 } from '../../type/matrix/utils/algorithm02';
import { createAlgorithm03 } from '../../type/matrix/utils/algorithm03';
import { createAlgorithm09 } from '../../type/matrix/utils/algorithm09';
import { createAlgorithm11 } from '../../type/matrix/utils/algorithm11';
import { createAlgorithm12 } from '../../type/matrix/utils/algorithm12';
import { createAlgorithm13 } from '../../type/matrix/utils/algorithm13';
import { createAlgorithm14 } from '../../type/matrix/utils/algorithm14';
var name = 'atan2';
var dependencies = ['typed', 'matrix', 'equalScalar', 'BigNumber', 'DenseMatrix'];
export var createAtan2 =
/* #__PURE__ */
factory(name, dependencies, function (_ref) {
  var typed = _ref.typed,
      matrix = _ref.matrix,
      equalScalar = _ref.equalScalar,
      BigNumber = _ref.BigNumber,
      DenseMatrix = _ref.DenseMatrix;
  var algorithm02 = createAlgorithm02({
    typed: typed,
    equalScalar: equalScalar
  });
  var algorithm03 = createAlgorithm03({
    typed: typed
  });
  var algorithm09 = createAlgorithm09({
    typed: typed,
    equalScalar: equalScalar
  });
  var algorithm11 = createAlgorithm11({
    typed: typed,
    equalScalar: equalScalar
  });
  var algorithm12 = createAlgorithm12({
    typed: typed,
    DenseMatrix: DenseMatrix
  });
  var algorithm13 = createAlgorithm13({
    typed: typed
  });
  var algorithm14 = createAlgorithm14({
    typed: typed
  });
  /**
   * Calculate the inverse tangent function with two arguments, y/x.
   * By providing two arguments, the right quadrant of the computed angle can be
   * determined.
   *
   * For matrices, the function is evaluated element wise.
   *
   * Syntax:
   *
   *    math.atan2(y, x)
   *
   * Examples:
   *
   *    math.atan2(2, 2) / math.pi       // returns number 0.25
   *
   *    const angle = math.unit(60, 'deg') // returns Unit 60 deg
   *    const x = math.cos(angle)
   *    const y = math.sin(angle)
   *
   *    math.atan(2)             // returns Complex 1.5707963267948966 -1.3169578969248166 i
   *
   * See also:
   *
   *    tan, atan, sin, cos
   *
   * @param {number | Array | Matrix} y  Second dimension
   * @param {number | Array | Matrix} x  First dimension
   * @return {number | Array | Matrix} Four-quadrant inverse tangent
   */

  var atan2 = typed(name, {
    'number, number': Math.atan2,
    // Complex numbers doesn't seem to have a reasonable implementation of
    // atan2(). Even Matlab removed the support, after they only calculated
    // the atan only on base of the real part of the numbers and ignored the imaginary.
    'BigNumber, BigNumber': function BigNumberBigNumber(y, x) {
      return BigNumber.atan2(y, x);
    },
    'SparseMatrix, SparseMatrix': function SparseMatrixSparseMatrix(x, y) {
      return algorithm09(x, y, atan2, false);
    },
    'SparseMatrix, DenseMatrix': function SparseMatrixDenseMatrix(x, y) {
      // mind the order of y and x!
      return algorithm02(y, x, atan2, true);
    },
    'DenseMatrix, SparseMatrix': function DenseMatrixSparseMatrix(x, y) {
      return algorithm03(x, y, atan2, false);
    },
    'DenseMatrix, DenseMatrix': function DenseMatrixDenseMatrix(x, y) {
      return algorithm13(x, y, atan2);
    },
    'Array, Array': function ArrayArray(x, y) {
      return atan2(matrix(x), matrix(y)).valueOf();
    },
    'Array, Matrix': function ArrayMatrix(x, y) {
      return atan2(matrix(x), y);
    },
    'Matrix, Array': function MatrixArray(x, y) {
      return atan2(x, matrix(y));
    },
    'SparseMatrix, number | BigNumber': function SparseMatrixNumberBigNumber(x, y) {
      return algorithm11(x, y, atan2, false);
    },
    'DenseMatrix, number | BigNumber': function DenseMatrixNumberBigNumber(x, y) {
      return algorithm14(x, y, atan2, false);
    },
    'number | BigNumber, SparseMatrix': function numberBigNumberSparseMatrix(x, y) {
      // mind the order of y and x
      return algorithm12(y, x, atan2, true);
    },
    'number | BigNumber, DenseMatrix': function numberBigNumberDenseMatrix(x, y) {
      // mind the order of y and x
      return algorithm14(y, x, atan2, true);
    },
    'Array, number | BigNumber': function ArrayNumberBigNumber(x, y) {
      return algorithm14(matrix(x), y, atan2, false).valueOf();
    },
    'number | BigNumber, Array': function numberBigNumberArray(x, y) {
      return algorithm14(matrix(y), x, atan2, true).valueOf();
    }
  });
  return atan2;
});


text:
package quasar.ejson

import slamdata.Predef._
import quasar.Qspec
import quasar.contrib.matryoshka._
import quasar.contrib.matryoshka.arbitrary._
import quasar.ejson.implicits._
import quasar.fp._

import matryoshka.{equalTEqual => _, _}
import matryoshka.data.Fix
import matryoshka.implicits._
import org.specs2.scalacheck._
import scalaz._, Scalaz._

final class JsonCodecSpec extends Qspec with EJsonArbitrary {
  import JsonCodec.DecodingFailed

  implicit val params = Parameters(maxSize = 10)

  type E = Fix[EJson]
  type J = Fix[Json]

  val decodeMƒ: CoalgebraM[DecodingFailed[J] \/ ?, EJson, J] =
    JsonCodec.decodeƒ[J] >>> (_.run)

  val roundtrip: E => DecodingFailed[J] \/ E =
    _.cata(JsonCodec.encodeƒ[J]).anaM[E](decodeMƒ)

  val soloKeys = JsonCodec.ExtKeys \\ ISet.fromList(List(JsonCodec.KeyK, JsonCodec.ValueK, JsonCodec.MetaK))

  "faithfully roundtrip EJson" >> prop { e: E =>
    roundtrip(e).toEither must beRight(equal(e))
  }

  soloKeys.toList foreach { k =>
    s"fail when singleton map with `$k` key maps to unexpected value" >> {
      val n = CommonJson(nul[J]()).embed
      val j = ObjJson(Obj(ListMap(k -> n))).embed
      j.anaM[E](decodeMƒ) must beLike {
        case -\/(DecodingFailed(_, v)) => v must_= n
      }
    }
  }

  "map keys beginning with the codec sigil are preserved" >> prop { (k10: String, k20: String, v1: E, v2: E) =>
    val (k1, k2) = (JsonCodec.Sigil.toString + k10, JsonCodec.Sigil.toString + k20)
    val m = ExtEJson(Map(List(
      CommonEJson(str[E](k1)).embed -> v1,
      CommonEJson(str[E](k2)).embed -> v2
    ))).embed

    roundtrip(m).toEither must beRight(equal(m))
  }

  "map keys equal to one of the codec keys are preserved" >> prop { v: E =>
    val m = ExtEJson(Map(JsonCodec.ExtKeys.toList map { k =>
      CommonEJson(str[E](k)).embed -> v
    })).embed

    roundtrip(m).toEither must beRight(equal(m))
  }

  "map keys equal to one of the codec keys with additional sigil prefix are preserved" >> prop { v: E =>
    val m = ExtEJson(Map(JsonCodec.ExtKeys.toList map { k =>
      CommonEJson(str[E](JsonCodec.Sigil.toString + k)).embed -> v
    })).embed

    roundtrip(m).toEither must beRight(equal(m))
  }
}

redpajama_set_name: RedPajamaGithub


text:
<?php defined('BX_DOL') or die('hack attempt');

class BxCoursesUploaderPictureCrop extends BxBaseModGroupsUploaderPictureCrop
{
    public function __construct ($aObject, $sStorageObject, $sUniqId, $oTemplate)
    {
        $this->_oModule = BxDolModule::getInstance('bx_courses');
        parent::__construct($aObject, $sStorageObject, $sUniqId, $oTemplate);
    }
}

/** @} */


text:
<?php

// autoload.php @generated by Composer

require_once __DIR__ . '/composer' . '/autoload_real.php';

return ComposerAutoloaderInitbe28b15255b23fddd665ab217502911c::getLoader();


text:
layout: page
title: Brandon Palmer's 54th Birthday
date: 2016-05-24
author: Anna Rodgers
tags: weekly links, java
status: published
summary: Donec eleifend sem nec ornare sollicitudin. Phasellus.
banner: images/banner/wedding.jpg
booking:
  startDate: 06/13/2016
  endDate: 06/15/2016
  ctyhocn: FSTPCHX
  groupCode: BP5B
published: true
---
In hac habitasse platea dictumst. Nullam interdum sollicitudin felis, sed porttitor ligula iaculis vitae. Integer id facilisis ex, at varius magna. Phasellus hendrerit massa eget augue venenatis tempus. In in sapien finibus, hendrerit lectus et, sagittis libero. Sed non bibendum libero, vitae volutpat libero. Integer et erat arcu. Aliquam leo eros, aliquet eu turpis et, aliquam efficitur quam. In dictum faucibus faucibus. Mauris varius tortor eget dolor laoreet volutpat.

* Integer ut sapien eget metus efficitur consequat at vehicula ante
* Mauris vel ex sit amet quam commodo rhoncus
* Integer quis libero at est blandit vehicula
* Aenean vitae magna vitae lorem molestie ullamcorper ac imperdiet massa
* Etiam ac enim et quam pretium sollicitudin eu at ante
* Suspendisse eu diam vitae eros laoreet mattis.

Vivamus sapien orci, tincidunt eget enim vel, porttitor aliquam ante. Proin placerat odio sit amet est faucibus consectetur. Quisque sed efficitur magna. Etiam et eleifend felis. Phasellus vestibulum dolor et urna gravida, ac venenatis elit congue. Sed eu ipsum quis nulla vestibulum pulvinar vel at ex. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Sed et lectus fermentum, elementum tortor vel, suscipit purus. In hac habitasse platea dictumst. Integer ornare turpis eget sapien volutpat, ac semper ipsum sodales. Morbi efficitur enim a sapien consectetur fringilla. Sed condimentum, libero sit amet sollicitudin hendrerit, justo urna fermentum magna, ac fermentum velit purus eget magna. Pellentesque id posuere lorem.


text:
<?php require_once __DIR__ . '/prepend.php'; ?>

<?php

  define('PAGE_TITLE', 'Special Pages');

  renderTemplateStart();

?>

<?php echo PAGE_TITLE ?>

This page contains links to demonstrations that are for specific cases that don't fit a tutorial crawl.

          URI Transformation

<?php renderTemplateEnd(); ?>


text:
/** \brief Circula Buffer Library sources
 **
 ** This library provides a circular buffer
 **
 **/

/** \addtogroup CIAA_Firmware CIAA Firmware
 ** @{ */
/** \addtogroup Libs CIAA Libraries
 ** @{ */

/*
 * Initials     Name
 * ---------------------------
 * MaCe         Mariano Cerdeiro
 */

/*
 * modification history (new versions first)
 * -----------------------------------------------------------
 * 20140615 v0.0.8 implmenet ciaaLibs_circBufUpdateHead
 * 20140612 v0.0.7 implement ciaaLibs_circBufWritePos and
 *                 ciaaLibs_circBufUpdateTail
 * 20140612 v0.0.6 store size-1 in size to improve performance
 * 20140612 v0.0.5 rename size parameter to nbyte
 * 20140612 v0.0.4 implement ciaaLibs_circBufInit
 * 20140612 v0.0.3 improve calculation of new tail and new head
 * 20140612 v0.0.2 implement ciaaLibs_circBufFull and ciaaLibs_circBufEmpty
 * 20140611 v0.0.1 initials initial version
 */

/*==================[inclusions]=============================================*/
#include "ciaaLibs_CircBuf.h"
#include "ciaaLibs_Maths.h"
#include "ciaaPOSIX_stdlib.h"
#include "ciaaPOSIX_stdint.h"
#include "ciaaPOSIX_string.h"

/*==================[macros and definitions]=================================*/

/*==================[internal data declaration]==============================*/

/*==================[internal functions declaration]=========================*/

/*==================[internal data definition]===============================*/

/*==================[external data definition]===============================*/

/*==================[internal functions definition]==========================*/

/*==================[external functions definition]==========================*/
extern ciaaLibs_CircBufType * ciaaLibs_circBufNew(size_t nbytes)
{
   ciaaLibs_CircBufType * ret = NULL;

   /* check that size is at least 8 and power of 2 */
   if ( (nbytes > 7) && (ciaaLibs_isPowerOfTwo(nbytes)) )
   {
      ret = (ciaaLibs_CircBufType *) ciaaPOSIX_malloc(sizeof(ciaaLibs_CircBufType)+nbytes);

      /* if a valid pointer has been returned */
      if (NULL != ret)
      {
         /* init the buffer */
         ciaaLibs_circBufInit(ret,
               (void*) ( (intptr_t) ret + sizeof(ciaaLibs_CircBufType) ),
               nbytes);
      }
   }

   return ret;
} /* end ciaaLibs_circBufNew */

extern int32_t ciaaLibs_circBufInit(ciaaLibs_CircBufType * cbuf, void * buf, size_t nbytes)
{
   int32_t ret = -1;
   /* check that size is at least 8 and power of 2 */
   if ( (nbytes > 7) && (ciaaLibs_isPowerOfTwo(nbytes)) && (NULL != buf) )
   {
      /* store the mask of the size and not the size itself */
      cbuf->size = nbytes-1;
      /* init the buffer */
      cbuf->head = 0;
      cbuf->tail = 0;
      cbuf->buf = buf;

      ret = 1;
   }

   return ret;
} /* end ciaaLibs_circBufInit */

extern void ciaaLibs_circBufRel(ciaaLibs_CircBufType * cbuf)
{
   /* free reserved memory */
   ciaaPOSIX_free(cbuf);
} /* end ciaaLibs_circBufRel */

extern size_t ciaaLibs_circBufPut(ciaaLibs_CircBufType * cbuf, void const * data, size_t nbytes)
{
   size_t ret = 0;
   size_t rawSpace;

   /* the head of the circular buffer may be changed, therefore it has to be
    * read only once */
   size_t head = cbuf->head;

   /* check that is enough place */
   if (ciaaLibs_circBufSpace(cbuf, head) >= nbytes)
   {
      rawSpace = ciaaLibs_circBufRawSpace(cbuf, head);

      /* check if wrapping is needed */
      if (rawSpace >= nbytes)
      {
         ciaaPOSIX_memcpy(ciaaLibs_circBufWritePos(cbuf), data, nbytes);
      }
      else
      {
         ciaaPOSIX_memcpy((void*)(&cbuf->buf[cbuf->tail]), data, rawSpace);
         ciaaPOSIX_memcpy((void*)(&cbuf->buf[0]),
               (void*)((intptr_t)data + rawSpace),
               nbytes-rawSpace);
      }

      /* calculate new tail position */
      ciaaLibs_circBufUpdateTail(cbuf, nbytes);

      /* set return value */
      ret = nbytes;
   }

   return ret;
} /* end ciaaLibs_circBufPut */

extern size_t ciaaLibs_circBufGet(ciaaLibs_CircBufType * cbuf, void * data, size_t nbytes)
{
   size_t rawCount;

   /* the tail of the circular buffer my be changed, therefore it has to be
    * read only once */
   size_t tail = cbuf->tail;

   /* if the users tries to read to much data, only available data will be
    * provided */
   if (nbytes > ciaaLibs_circBufCount(cbuf, tail))
   {
      nbytes = ciaaLibs_circBufCount(cbuf, tail);
   }

   /* check if data to be read */
   if (nbytes > 0)
   {
      rawCount = ciaaLibs_circBufRawCount(cbuf, tail);

      /* check if all data can be read without wrapping */
      if (nbytes <= rawCount)
      {
         ciaaPOSIX_memcpy(data, ciaaLibs_circBufReadPos(cbuf), nbytes);
      }
      else
      {
         ciaaPOSIX_memcpy(data, ciaaLibs_circBufReadPos(cbuf), rawCount);
         ciaaPOSIX_memcpy((void*)((intptr_t)data + rawCount), (void*)(&cbuf->buf[0]), nbytes-rawCount);
      }

      /* calculates new head position */
      ciaaLibs_circBufUpdateHead(cbuf, nbytes);
   }

   return nbytes;
} /* end ciaaLibs_circBufGet */

/** @} doxygen end group definition */
/** @} doxygen end group definition */
/*==================[end of file]============================================*/


text:
<?xml version="1.0" encoding="UTF-8"?>
<sem:triples uri="http://www.lds.org/vrl/objects/plants/thyme" xmlns:sem="http://marklogic.com/semantics">
  <sem:triple>
    <sem:subject>http://www.lds.org/vrl/objects/plants/thyme</sem:subject>
    <sem:predicate>http://www.w3.org/2004/02/skos/core#prefLabel</sem:predicate>
    <sem:object datatype="xsd:string" xml:lang="eng">Thyme</sem:object>
  </sem:triple>
  <sem:triple>
    <sem:subject>http://www.lds.org/vrl/objects/plants/thyme</sem:subject>
    <sem:predicate>http://www.w3.org/2004/02/skos/core#inScheme</sem:predicate>
    <sem:object datatype="sem:iri">http://www.lds.org/concept-scheme/vrl</sem:object>
  </sem:triple>
  <sem:triple>
    <sem:subject>http://www.lds.org/vrl/objects/plants/thyme</sem:subject>
    <sem:predicate>http://www.lds.org/core#entityType</sem:predicate>
    <sem:object datatype="sem:iri">http://www.lds.org/Topic</sem:object>
  </sem:triple>
</sem:triples>


text:
    <meta http-equiv="Content-Type" content="text/html; charset=Windows-1252" />
    <meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5" />
    <title>CompactRepositorySelector.ExistsRepository Method</title>
    <xml>
    </xml>
    <link rel="stylesheet" type="text/css" href="MSDN.css" />

            Apache log4net™ SDK Documentation - Microsoft .NET Framework 4.0

CompactRepositorySelector.ExistsRepository Method

 Test if a named repository exists

        [Visual Basic]

NotOverridable Public Function ExistsRepository( _
   ByVal repositoryName As String _
) As Boolean _
    Implements IRepositorySelector.ExistsRepository

        [C#]

public bool ExistsRepository(
   string repositoryName
);

Parameters

          repositoryName

the named repository to check

Return Value

        true if the repository exists

Implements

        IRepositorySelector.ExistsRepository

Remarks

 Test if a named repository exists. Use CreateRepository to create a new repository and GetRepository to retrieve a repository.

See Also

CompactRepositorySelector Class | log4net.Core Namespace
<object type="application/x-oleobject" classid="clsid:1e2a7bd0-dab9-11d0-b93a-00c04fc99f9e" viewastext="true" style="display: none;"><param name="Keyword" value="ExistsRepository method"></param><param name="Keyword" value="ExistsRepository method, CompactRepositorySelector class"></param><param name="Keyword" value="CompactRepositorySelector.ExistsRepository method"></param></object>

Copyright 2004-2013 The Apache Software Foundation.

Apache log4net, Apache and log4net are trademarks of The Apache Software Foundation.


text:
class Post
  extend ActiveModel::Naming
  include ActiveModel::Validations

  class << self
    def posts
      POSTS
    end
    private :posts

    def all
      posts.compact
    end

    def create(attrs = {})
      post = new(attrs)
      post.save
      post
    end

    def persist(post)
      id = posts.length
      posts << post
      id
    end

    def unpersist(post)
      posts[post.id] = nil
    end

    def find(id)
      posts[id.to_i] or raise "not found"
    end

    def count
      posts.compact.length
    end
  end

  attr_reader :id
  attr_accessor :title, :body

  def initialize(attrs = {})
    self.attributes = attrs
  end

  def attributes=(attrs)
    return unless attrs
    attrs.each { |k, v| send("#{k}=", v) }
  end

  def attributes
    { 'title' => title, 'body' => body }
  end

  def to_model
    self
  end

  def to_param
    id.to_s
  end

  def to_key
    [id] if id
  end

  def persisted?
    !id.nil?
  end

  def save
    unless persisted?
      @id = self.class.persist(self)
    end
    true
  end

  def update_attributes(attrs)
    self.attributes = attrs
    save
  end

  def destroy
    self.class.unpersist(self)
    true
  end
end


text:
/**
 * My <%= appName %> module
 * A reference to <%= appName %> app
 *
 * @type {module}
 */
var app = angular.module('<%= appName %>');

/**
 * A singleton model service example
 *
 * @namespace <%= appName %>
 * @class <%= moduleName %>
 * @static
 */
app.service('<%= moduleName %>', [function() {

	/**
	 * A simple data object - replace with your own data
	 *
	 * @property data
	 * @type {{name: string, type: string, description: string, cost: number, thumbnail: string, background: string}}
	 */
	this.data = {
		name: 				"theme1",
		type: 				"budget",
		description: 		"a budget theme1",
		cost: 				100,
		thumbnail: 			"image1.png",
		background: 		"background_1.png"
	};
}]);


text:
package conf;

import static org.hamcrest.CoreMatchers.containsString;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertThat;

import java.util.Map;

import ninja.NinjaRouterTest;

import org.junit.Test;

import com.google.common.collect.Maps;

import controllers.ApplicationController;

/**
 *
 * Remove me once NinjaRouterTest has been put to rest.
 *
 * @author ra
 * @deprecated
 */
@Deprecated
public class RoutesTest extends NinjaRouterTest {

    @Test
    public void testTestRoutesAreHiddenFromProduction() {

        startServerInProdMode();

        //test that test route is not available in production mode.
        aRequestLike("GET",  "/_test/testPage").isNotHandledByRoutesInRouter();

    }

    @Test
    public void testRoutes() {

        startServer();

        //some tests that routes are there:
        aRequestLike("GET",  "/").isHandledBy(ApplicationController.class, "index");

    }

    @Test
    public void testReverseRoutingWithoutMap() {

        startServer();

        // TEST 1: a simple route without replacements:
        String generatedReverseRoute = router.getReverseRoute(ApplicationController.class, "index");

        assertEquals("/", generatedReverseRoute);

        // TEST 2: a more complex route with replacements:
        //router.GET().route("/user/{id}/{email}/userDashboard").with(ApplicationController.class, "userDashboard");

        generatedReverseRoute = router.getReverseRoute(ApplicationController.class, "userDashboard");

        // this looks strange, but is expected:
        assertEquals("/user/{id}/{email}/userDashboard", generatedReverseRoute);

    }

    @Test
    public void testReverseRoutingWithMap() {

        startServer();

        // TEST 1: a simple route without replacements:
        Map<String, Object> map = Maps.newHashMap();
        String generatedReverseRoute = router.getReverseRoute(ApplicationController.class, "index", map);

        assertEquals("/", generatedReverseRoute);

        // TEST 2: a more complex route with replacements:
        //router.GET().route("/user/{id}/{email}/userDashboard").with(ApplicationController.class, "userDashboard");
        map = Maps.newHashMap();
        map.put("id","myId");
        map.put("email","myEmail");

        generatedReverseRoute = router.getReverseRoute(ApplicationController.class, "userDashboard", map);

        assertEquals("/user/myId/myEmail/userDashboard", generatedReverseRoute);

    }

    @Test
    public void testReverseRoutingWithMapAndQueryParameter() {

        startServer();

        // TEST 2: a more complex route with replacements and query parameters
        //router.GET().route("/user/{id}/{email}/userDashboard").with(ApplicationController.class, "userDashboard");
        Map<String, Object> map = Maps.newHashMap();
        map.put("id","myId");
        map.put("email","myEmail");
        map.put("paging_size","100");
        map.put("page","1");

        String generatedReverseRoute = router.getReverseRoute(ApplicationController.class, "userDashboard", map);

        assertThat(generatedReverseRoute, containsString("page=1"));
        assertThat(generatedReverseRoute, containsString("paging_size=100"));
        assertThat(generatedReverseRoute, containsString("/user/myId/myEmail/userDashboard?"));

    }

    @Test
    public void testReverseRoutingWithArrayAndQueryParameters() {

        startServer();

        String generatedReverseRoute = router.getReverseRoute(
                ApplicationController.class,
                "userDashboard",
                "id","myId",
                "email","myEmail",
                "paging_size","100",
                "page","1");

        assertThat(generatedReverseRoute, containsString("page=1"));
        assertThat(generatedReverseRoute, containsString("paging_size=100"));
        assertThat(generatedReverseRoute, containsString("/user/myId/myEmail/userDashboard?"));
    }

    @Test
    public void testReverseRoutingWithArrayAndWrongAmountOfQueryParameters() {

        startServer();

        // TEST 2: a more complex route with replacements and query parameters
        //router.GET().route("/user/{id}/{email}/userDashboard").with(ApplicationController.class, "userDashboard");
        Map<String, Object> map = Maps.newHashMap();
        map.put("id","myId");
        map.put("email","myEmail");
        map.put("paging_size","100");
        map.put("page","1");

        String generatedReverseRoute = router.getReverseRoute(
                ApplicationController.class,
                "userDashboard",
                "1", "2", "3");

        assertEquals(null, generatedReverseRoute);

    }

}


text:
<?php

namespace Magento\CatalogInventory\Model;

use Magento\Catalog\Model\ProductFactory;
use Magento\CatalogInventory\Api\Data\StockItemInterface;
use Magento\CatalogInventory\Api\StockConfigurationInterface;
use Magento\CatalogInventory\Api\StockItemCriteriaInterfaceFactory;
use Magento\CatalogInventory\Api\StockItemRepositoryInterface;
use Magento\CatalogInventory\Api\StockRegistryInterface;
use Magento\CatalogInventory\Model\Spi\StockRegistryProviderInterface;

/**
 * Class StockRegistry
 *
 * @SuppressWarnings(PHPMD.CouplingBetweenObjects)
 */
class StockRegistry implements StockRegistryInterface
{
    /**
     * @var StockConfigurationInterface
     */
    protected $stockConfiguration;

    /**
     * @var StockRegistryProviderInterface
     */
    protected $stockRegistryProvider;

    /**
     * @var ProductFactory
     */
    protected $productFactory;

    /**
     * @var StockItemRepositoryInterface
     */
    protected $stockItemRepository;

    /**
     * @var \Magento\CatalogInventory\Api\StockItemCriteriaInterfaceFactory
     */
    protected $criteriaFactory;

    /**
     * @param StockConfigurationInterface $stockConfiguration
     * @param StockRegistryProviderInterface $stockRegistryProvider
     * @param StockItemRepositoryInterface $stockItemRepository
     * @param StockItemCriteriaInterfaceFactory $criteriaFactory
     * @param ProductFactory $productFactory
     */
    public function __construct(
        StockConfigurationInterface $stockConfiguration,
        StockRegistryProviderInterface $stockRegistryProvider,
        StockItemRepositoryInterface $stockItemRepository,
        StockItemCriteriaInterfaceFactory $criteriaFactory,
        ProductFactory $productFactory
    ) {
        $this->stockConfiguration = $stockConfiguration;
        $this->stockRegistryProvider = $stockRegistryProvider;
        $this->stockItemRepository = $stockItemRepository;
        $this->criteriaFactory = $criteriaFactory;
        $this->productFactory = $productFactory;
    }

    /**
     * @param int $scopeId
     * @return \Magento\CatalogInventory\Api\Data\StockInterface
     */
    public function getStock($scopeId = null)
    {
        //if (!$scopeId) {
        $scopeId = $this->stockConfiguration->getDefaultScopeId();
        //}
        return $this->stockRegistryProvider->getStock($scopeId);
    }

    /**
     * @param int $productId
     * @param int $scopeId
     * @return \Magento\CatalogInventory\Api\Data\StockItemInterface
     */
    public function getStockItem($productId, $scopeId = null)
    {
        //if (!$scopeId) {
        $scopeId = $this->stockConfiguration->getDefaultScopeId();
        //}
        return $this->stockRegistryProvider->getStockItem($productId, $scopeId);
    }

    /**
     * @param string $productSku
     * @param int $scopeId
     * @return \Magento\CatalogInventory\Api\Data\StockItemInterface
     * @throws \Magento\Framework\Exception\NoSuchEntityException
     */
    public function getStockItemBySku($productSku, $scopeId = null)
    {
        //if (!$scopeId) {
        $scopeId = $this->stockConfiguration->getDefaultScopeId();
        //}
        $productId = $this->resolveProductId($productSku);
        return $this->stockRegistryProvider->getStockItem($productId, $scopeId);
    }

    /**
     * @param int $productId
     * @param int $scopeId
     * @return \Magento\CatalogInventory\Api\Data\StockStatusInterface
     */
    public function getStockStatus($productId, $scopeId = null)
    {
        //if (!$scopeId) {
        $scopeId = $this->stockConfiguration->getDefaultScopeId();
        //}
        return $this->stockRegistryProvider->getStockStatus($productId, $scopeId);
    }

    /**
     * @param string $productSku
     * @param int $scopeId
     * @return \Magento\CatalogInventory\Api\Data\StockStatusInterface
     * @throws \Magento\Framework\Exception\NoSuchEntityException
     */
    public function getStockStatusBySku($productSku, $scopeId = null)
    {
        //if (!$scopeId) {
        $scopeId = $this->stockConfiguration->getDefaultScopeId();
        //}
        $productId = $this->resolveProductId($productSku);
        return $this->getStockStatus($productId, $scopeId);
    }

    /**
     * Retrieve Product stock status
     * @param int $productId
     * @param int $scopeId
     * @return int
     */
    public function getProductStockStatus($productId, $scopeId = null)
    {
        //if (!$scopeId) {
        $scopeId = $this->stockConfiguration->getDefaultScopeId();
        //}
        $stockStatus = $this->getStockStatus($productId, $scopeId);
        return $stockStatus->getStockStatus();
    }

    /**
     * @param string $productSku
     * @param null $scopeId
     * @return int
     * @throws \Magento\Framework\Exception\NoSuchEntityException
     */
    public function getProductStockStatusBySku($productSku, $scopeId = null)
    {
        //if (!$scopeId) {
        $scopeId = $this->stockConfiguration->getDefaultScopeId();
        //}
        $productId = $this->resolveProductId($productSku);
        return $this->getProductStockStatus($productId, $scopeId);
    }

    /**
     * @inheritdoc
     */
    public function getLowStockItems($scopeId, $qty, $currentPage = 1, $pageSize = 0)
    {
        $criteria = $this->criteriaFactory->create();
        $criteria->setLimit($currentPage, $pageSize);
        $criteria->setScopeFilter($scopeId);
        $criteria->setQtyFilter('<=', $qty);
        $criteria->addField('qty');
        return $this->stockItemRepository->getList($criteria);
    }

    /**
     * @inheritdoc
     */
    public function updateStockItemBySku($productSku, \Magento\CatalogInventory\Api\Data\StockItemInterface $stockItem)
    {
        $productId = $this->resolveProductId($productSku);
        $websiteId = $stockItem->getWebsiteId() ?: null;
        $origStockItem = $this->getStockItem($productId, $websiteId);
        $data = $stockItem->getData();
        if ($origStockItem->getItemId()) {
            unset($data['item_id']);
        }
        $origStockItem->addData($data);
        $origStockItem->setProductId($productId);
        return $this->stockItemRepository->save($origStockItem)->getItemId();
    }

    /**
     * @param string $productSku
     * @return int
     * @throws \Magento\Framework\Exception\NoSuchEntityException
     */
    protected function resolveProductId($productSku)
    {
        $product = $this->productFactory->create();
        $productId = $product->getIdBySku($productSku);
        if (!$productId) {
            throw new \Magento\Framework\Exception\NoSuchEntityException(
                __(
                    'Product with SKU "%1" does not exist',
                    $productSku
                )
            );
        }
        return $productId;
    }
}


text:
<?php

# Copyright 2016 Wayne D Grant (www.waynedgrant.com)
# Licensed under the MIT License

class WindDirection {

    private static $CARDINAL_DIRECTIONS = array('N','NNE', 'NE', 'ENE', 'E', 'ESE', 'SE', 'SSE', 'S', 'SSW','SW', 'WSW', 'W', 'WNW', 'NW', 'NNW');

    private $cardinalDirection;
    private $compassDegress;

    public function __construct($compassDegress) {
        if ($compassDegress != '-') {
            $this->cardinalDirection = self::calculateCardinalDirection($compassDegress);
            $this->compassDegress = number_format($compassDegress, 0, '.', '');
        }
    }

    public function getCardinalDirection() {
        return $this->cardinalDirection;
    }

    public function getCompassDegrees() {
        return $this->compassDegress;
    }

    private function calculateCardinalDirection($compassDegress) {
        return self::$CARDINAL_DIRECTIONS[fmod((($compassDegress + 11) / 22.5), 16)];
    }

    public function getAllMeasures() {
        return array(
            "cardinal" => $this->getCardinalDirection(),
            "degrees" => $this->getCompassDegrees());
    }
}

?>


text:
"""unit testing code for the ScreenComposite functionality

"""
from rdkit import RDConfig
import unittest, os
import io
from rdkit.ML import BuildComposite
from rdkit.ML import ScreenComposite
from rdkit.six.moves import cPickle as pickle

def feq(a, b, tol=1e-4):
  if abs(a - b) > tol:
    return 0
  else:
    return 1

class TestCase(unittest.TestCase):

  def setUp(self):
    #print '\n%s: '%self.shortDescription(),
    self.baseDir = os.path.join(RDConfig.RDCodeDir, 'ML', 'test_data')
    self.dbName = RDConfig.RDTestDatabase
    self.details = ScreenComposite.SetDefaults()
    self.details.dbName = self.dbName
    self.details.dbUser = RDConfig.defaultDBUser
    self.details.dbPassword = RDConfig.defaultDBPassword

  def test1(self):
    """ basics """
    self.details.tableName = 'ferro_quant'
    with open(os.path.join(self.baseDir, 'ferromag_quant_10.pkl'), 'r') as pklTF:
      buf = pklTF.read().replace('\r\n', '\n').encode('utf-8')
      pklTF.close()
    with io.BytesIO(buf) as pklF:
      compos = pickle.load(pklF)
    tgt = 5
    self.assertEqual(len(compos), tgt)

    nGood, misCount, nSkipped, avgGood, avgBad, avgSkip, tbl = ScreenComposite.ScreenFromDetails(
      compos, self.details)
    self.assertEqual(nGood, 93)
    self.assertEqual(misCount, 2)
    self.assertEqual(nSkipped, 0)
    self.assertAlmostEqual(avgGood, .9871, 4)
    self.assertAlmostEqual(avgBad, .8000, 4)
    self.assertEqual(tbl[0, 0], 54)
    self.assertEqual(tbl[1, 1], 39)
    self.assertEqual(tbl[0, 1], 2)
    self.assertEqual(tbl[1, 0], 0)

  def test2(self):
    """ include holdout data only """
    self.details.tableName = 'ferro_quant'
    self.details.doHoldout = 1
    self.details.doTraining = 0

    with open(os.path.join(self.baseDir, 'ferromag_quant_10.pkl'), 'r') as pklTF:
      buf = pklTF.read().replace('\r\n', '\n').encode('utf-8')
      pklTF.close()
    with io.BytesIO(buf) as pklF:
      compos = pickle.load(pklF)
    tgt = 5
    self.assertEqual(len(compos), tgt)

    nGood, misCount, nSkipped, avgGood, avgBad, avgSkip, tbl = ScreenComposite.ScreenFromDetails(
      compos, self.details)
    self.assertEqual(nGood, 28)
    self.assertEqual(misCount, 1)
    self.assertEqual(nSkipped, 0)
    self.assertAlmostEqual(avgGood, .9964, 4)
    self.assertAlmostEqual(avgBad, 1.000, 4)
    self.assertEqual(tbl[0, 0], 16)
    self.assertEqual(tbl[1, 1], 12)
    self.assertEqual(tbl[0, 1], 1)
    self.assertEqual(tbl[1, 0], 0)

  def test3(self):
    """ include training data only """
    self.details.tableName = 'ferro_quant'
    self.details.doHoldout = 0
    self.details.doTraining = 1

    with open(os.path.join(self.baseDir, 'ferromag_quant_10.pkl'), 'r') as pklTF:
      buf = pklTF.read().replace('\r\n', '\n').encode('utf-8')
      pklTF.close()
    with io.BytesIO(buf) as pklF:
      compos = pickle.load(pklF)
    tgt = 5
    self.assertEqual(len(compos), tgt, 'bad composite loaded: %d != %d' % (len(compos), tgt))

    nGood, misCount, nSkipped, avgGood, avgBad, avgSkip, tbl = ScreenComposite.ScreenFromDetails(
      compos, self.details)
    self.assertEqual(nGood, 65)
    self.assertEqual(misCount, 1)
    self.assertEqual(nSkipped, 0)
    self.assertAlmostEqual(avgGood, .98307, 4)
    self.assertAlmostEqual(avgBad, 0.600, 4)
    self.assertEqual(tbl[0, 0], 38, tbl)
    self.assertEqual(tbl[1, 1], 27)
    self.assertEqual(tbl[0, 1], 1)
    self.assertEqual(tbl[1, 0], 0)

  def test4(self):
    """ include thresholding """
    self.details.tableName = 'ferro_quant'
    self.details.threshold = 0.80
    self.details.doHoldout = 0
    self.details.doTraining = 0

    with open(os.path.join(self.baseDir, 'ferromag_quant_10.pkl'), 'r') as pklTF:
      buf = pklTF.read().replace('\r\n', '\n').encode('utf-8')
      pklTF.close()
    with io.BytesIO(buf) as pklF:
      compos = pickle.load(pklF)
    tgt = 5
    self.assertEqual(len(compos), tgt)

    nGood, misCount, nSkipped, avgGood, avgBad, avgSkip, tbl = ScreenComposite.ScreenFromDetails(
      compos, self.details)
    self.assertEqual(nGood, 91)
    self.assertEqual(misCount, 1)
    self.assertEqual(nSkipped, 3)
    self.assertAlmostEqual(avgGood, 0.9956, 4)
    self.assertAlmostEqual(avgBad, 1.000, 4)
    self.assertAlmostEqual(avgSkip, 0.6000, 4)
    self.assertEqual(tbl[0, 0], 54)
    self.assertEqual(tbl[1, 1], 37)
    self.assertEqual(tbl[0, 1], 1)
    self.assertEqual(tbl[1, 0], 0)

  def test5(self):
    """ basics """
    self.details.tableName = 'ferro_noquant'

    with open(os.path.join(self.baseDir, 'ferromag_auto_10_3.pkl'), 'r') as pklTF:
      buf = pklTF.read().replace('\r\n', '\n').encode('utf-8')
      pklTF.close()
    with io.BytesIO(buf) as pklF:
      compos = pickle.load(pklF)
    tgt = 10
    self.assertEqual(len(compos), tgt)

    tpl = ScreenComposite.ScreenFromDetails(compos, self.details)
    nGood, misCount, nSkipped, avgGood, avgBad, avgSkip, tbl = tpl

    self.assertEqual(nGood, 95)
    self.assertEqual(misCount, 8)
    self.assertEqual(nSkipped, 0)
    self.assertAlmostEqual(avgGood, .9684, 4)
    self.assertAlmostEqual(avgBad, .8375, 4)
    self.assertEqual(tbl[0, 0], 50)
    self.assertEqual(tbl[1, 1], 45)
    self.assertEqual(tbl[0, 1], 5)
    self.assertEqual(tbl[1, 0], 3)

  def test6(self):
    """ multiple models """
    self.details.tableName = 'ferro_noquant'
    with open(os.path.join(self.baseDir, 'ferromag_auto_10_3.pkl'), 'r') as pklTF:
      buf = pklTF.read().replace('\r\n', '\n').encode('utf-8')
      pklTF.close()
    with io.BytesIO(buf) as pklF:
      compos = pickle.load(pklF)
    tgt = 10
    self.assertEqual(len(compos), tgt)
    composites = [compos, compos]
    tpl = ScreenComposite.ScreenFromDetails(composites, self.details)
    nGood, misCount, nSkipped, avgGood, avgBad, avgSkip, tbl = tpl
    self.assertEqual(nGood[0], 95)
    self.assertEqual(misCount[0], 8)
    self.assertEqual(nSkipped[0], 0)
    self.assertAlmostEqual(avgGood[0], .9684, 4)
    self.assertAlmostEqual(avgBad[0], .8375, 4)
    self.assertEqual(nGood[1], 0)
    self.assertEqual(misCount[1], 0)
    self.assertEqual(nSkipped[1], 0)
    self.assertEqual(avgGood[1], 0)
    self.assertEqual(avgBad[1], 0)
    self.assertEqual(tbl[0, 0], 50)
    self.assertEqual(tbl[1, 1], 45)
    self.assertEqual(tbl[0, 1], 5)
    self.assertEqual(tbl[1, 0], 3)

  def test7(self):
    """ shuffle """
    self.details.tableName = 'ferro_noquant'
    with open(os.path.join(self.baseDir, 'ferromag_shuffle_10_3.pkl'), 'r') as pklTF:
      buf = pklTF.read().replace('\r\n', '\n').encode('utf-8')
      pklTF.close()
    with io.BytesIO(buf) as pklF:
      compos = pickle.load(pklF)
    tgt = 10
    self.assertEqual(len(compos), tgt)
    self.details.shuffleActivities = 1
    nGood, misCount, nSkipped, avgGood, avgBad, avgSkip, tbl = ScreenComposite.ScreenFromDetails(
      compos, self.details)
    self.assertEqual(nGood, 50)
    self.assertEqual(misCount, 53)
    self.assertEqual(nSkipped, 0)
    self.assertAlmostEqual(avgGood, .7380, 4)
    self.assertAlmostEqual(avgBad, .7660, 4)
    self.assertEqual(tbl[0, 0], 30)
    self.assertEqual(tbl[1, 1], 20)
    self.assertEqual(tbl[0, 1], 25)
    self.assertEqual(tbl[1, 0], 28)

  def test8(self):
    """ shuffle with segmentation """
    self.details.tableName = 'ferro_noquant'
    with open(os.path.join(self.baseDir, 'ferromag_shuffle_10_3.pkl'), 'r') as pklTF:
      buf = pklTF.read().replace('\r\n', '\n').encode('utf-8')
      pklTF.close()
    with io.BytesIO(buf) as pklF:
      compos = pickle.load(pklF)
    tgt = 10
    self.assertEqual(len(compos), tgt)
    self.details.shuffleActivities = 1
    self.details.doHoldout = 1
    nGood, misCount, nSkipped, avgGood, avgBad, avgSkip, tbl = ScreenComposite.ScreenFromDetails(
      compos, self.details)
    self.assertEqual(nGood, 19)
    self.assertEqual(misCount, 12)
    self.assertEqual(nSkipped, 0)
    self.assertAlmostEqual(avgGood, .7737, 4)
    self.assertAlmostEqual(avgBad, .7500, 4)
    self.assertEqual(tbl[0, 0], 12)
    self.assertEqual(tbl[1, 1], 7)
    self.assertEqual(tbl[0, 1], 6)
    self.assertEqual(tbl[1, 0], 6)

  def test9(self):
    """ shuffle with segmentation2 """
    self.details.tableName = 'ferro_noquant'
    with open(os.path.join(self.baseDir, 'ferromag_shuffle_10_3.pkl'), 'r') as pklTF:
      buf = pklTF.read().replace('\r\n', '\n').encode('utf-8')
      pklTF.close()
    with io.BytesIO(buf) as pklF:
      compos = pickle.load(pklF)
    tgt = 10
    self.assertEqual(len(compos), tgt)
    self.details.shuffleActivities = 1
    self.details.doTraining = 1
    nGood, misCount, nSkipped, avgGood, avgBad, avgSkip, tbl = ScreenComposite.ScreenFromDetails(
      compos, self.details)
    self.assertEqual(nGood, 31)
    self.assertEqual(misCount, 41)
    self.assertEqual(nSkipped, 0)
    self.assertAlmostEqual(avgGood, .7161, 4)
    self.assertAlmostEqual(avgBad, .7707, 4)
    self.assertEqual(tbl[0, 0], 18)
    self.assertEqual(tbl[1, 1], 13)
    self.assertEqual(tbl[0, 1], 19)
    self.assertEqual(tbl[1, 0], 22)

  def test10(self):
    """ filtering """
    self.details.tableName = 'ferro_noquant'
    with open(os.path.join(self.baseDir, 'ferromag_filt_10_3.pkl'), 'r') as pklTF:
      buf = pklTF.read().replace('\r\n', '\n').encode('utf-8')
      pklTF.close()
    with io.BytesIO(buf) as pklF:
      compos = pickle.load(pklF)
    tgt = 10
    self.assertEqual(len(compos), tgt)
    self.details.filterVal = 1
    self.details.filterFrac = .33

    nGood, misCount, nSkipped, avgGood, avgBad, avgSkip, tbl = ScreenComposite.ScreenFromDetails(
      compos, self.details)
    self.assertEqual(nGood, 90)
    self.assertEqual(misCount, 13)
    self.assertEqual(nSkipped, 0)
    self.assertAlmostEqual(avgGood, .9578, 4)
    self.assertAlmostEqual(avgBad, .8538, 4)
    self.assertEqual(tbl[0, 0], 54)
    self.assertEqual(tbl[1, 1], 36)
    self.assertEqual(tbl[0, 1], 1)
    self.assertEqual(tbl[1, 0], 12)

  def test11(self):
    """ filtering with segmentation """
    self.details.tableName = 'ferro_noquant'
    with open(os.path.join(self.baseDir, 'ferromag_filt_10_3.pkl'), 'r') as pklTF:
      buf = pklTF.read().replace('\r\n', '\n').encode('utf-8')
      pklTF.close()
    with io.BytesIO(buf) as pklF:
      compos = pickle.load(pklF)
    tgt = 10
    self.assertEqual(len(compos), tgt)
    self.details.doHoldout = 1
    self.details.filterVal = 1
    self.details.filterFrac = .33

    nGood, misCount, nSkipped, avgGood, avgBad, avgSkip, tbl = ScreenComposite.ScreenFromDetails(
      compos, self.details)

    self.assertEqual(nGood, 37)
    self.assertEqual(misCount, 6)
    self.assertEqual(nSkipped, 0)
    self.assertAlmostEqual(avgGood, .95946, 4)
    self.assertAlmostEqual(avgBad, .85, 4)
    self.assertEqual(tbl[0, 0], 14)
    self.assertEqual(tbl[1, 1], 23)
    self.assertEqual(tbl[0, 1], 1)
    self.assertEqual(tbl[1, 0], 5)

  def test12(self):
    """ test the naive bayes composite"""
    self.details.tableName = 'ferro_noquant'
    with open(os.path.join(self.baseDir, 'ferromag_NaiveBayes.pkl'), 'r') as pklTF:
      buf = pklTF.read().replace('\r\n', '\n').encode('utf-8')
      pklTF.close()
    with io.BytesIO(buf) as pklF:
      compos = pickle.load(pklF)
    tgt = 10
    self.assertEqual(len(compos), tgt)
    self.details.doHoldout = 1
    nGood, misCount, nSkipped, avgGood, avgBad, avgSkip, tbl = ScreenComposite.ScreenFromDetails(
      compos, self.details)
    self.assertEqual(nGood, 25)
    self.assertEqual(misCount, 6)
    self.assertEqual(nSkipped, 0)
    self.assertAlmostEqual(avgGood, 0.9800, 4)
    self.assertAlmostEqual(avgBad, 0.86667, 4)
    self.assertEqual(tbl[0, 0], 9)
    self.assertEqual(tbl[0, 1], 6)
    self.assertEqual(tbl[1, 0], 0)
    self.assertEqual(tbl[1, 1], 16)

if __name__ == '__main__':
  unittest.main()


text:
#ifndef FLENS_AUXILIARY_COMPATIBLESCALAR_H
#define FLENS_AUXILIARY_COMPATIBLESCALAR_H 1

#include <flens/auxiliary/isconvertible.h>

namespace flens {

template <typename T, typename Container>
struct CompatibleScalar
{
    static const bool value =
       IsConvertible<T, typename Container::Impl::ElementType>::value
    || IsConvertible<typename Container::Impl::ElementType, T>::value;
};

} // namespace flens

#endif // FLENS_AUXILIARY_COMPATIBLESCALAR_H


text:
<?php

if(isset($_POST['skype_set']) && (isset($_POST['data']) && !empty($_POST['data']))){
	require_once dirname(__FILE__) . implode(DIRECTORY_SEPARATOR, array('', '..', '..', '..', '..', 'wp-config.php'));
	require_once '../skype.php';
	$WPSS = new WPSkypeStatus();
	echo json_encode($WPSS->update_wp_settings($_POST['data']));
}
die();

?>


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ResidentialManager
{
    class LegalDocuments :Document
    {
    }
}


text:
import Vue from 'vue'
import VueI18n from 'vue-i18n'
import { localRead } from '@/libs/util'
import customZhCn from './lang/zh-CN'
import customZhTw from './lang/zh-TW'
import customEnUs from './lang/en-US'
import zhCnLocale from 'iview/src/locale/lang/zh-CN'
import enUsLocale from 'iview/src/locale/lang/en-US'
import zhTwLocale from 'iview/src/locale/lang/zh-TW'

Vue.use(VueI18n)

// 自动根据浏览器系统语言设置语言
const navLang = navigator.language
const localLang = (navLang === 'zh-CN' || navLang === 'en-US') ? navLang : false
let lang = localLang || localRead('local') || 'zh-CN'

Vue.config.lang = lang

// vue-i18n 6.x+写法
Vue.locale = () => {}
const messages = {
  'zh-CN': Object.assign(zhCnLocale, customZhCn),
  'zh-TW': Object.assign(zhTwLocale, customZhTw),
  'en-US': Object.assign(enUsLocale, customEnUs)
}
const i18n = new VueI18n({
  locale: lang,
  messages
})

export default i18n

// vue-i18n 5.x写法
// Vue.locale('zh-CN', Object.assign(zhCnLocale, customZhCn))
// Vue.locale('en-US', Object.assign(zhTwLocale, customZhTw))
// Vue.locale('zh-TW', Object.assign(enUsLocale, customEnUs))


text:
<TITLE>Review for Love Letter, The (1999)</TITLE>
<LINK REL="STYLESHEET" TYPE="text/css" HREF="/ramr.css">

Love Letter, The (1999)

reviewed by
Harvey S. Karten

THE LOVE LETTER

 Reviewed by Harvey Karten, Ph.D.
 DreamWorks Pictures
 Director:  Peter Ho-Sun Chan
 Writer:  Maria Maggenti, novel by Cathleen Schine
 Cast: Kate Capshaw, Blythe Danner, Ellen DeGeneres,
Geraldine McEwan, Julianne Nicholson, Tom Everett Scott,
Tom Selleck, Gloria Stuart

   There may be some good reasons for living in a
picturesque small town but you'd never know this from seeing
"The Love Letter."  A film about a sleepy burg whose drowsy,
if eccentric, beings are awakened by an anonymous billet
doux, "The Love Letter" is so slight, so insipid, that a viewer
can scarcely find much therein to love or hate. Just a
spoonful of sugar less sweet than "Message in a Bottle," at
least director Peter Ho-Sun Chan's movie based on a novel
by Maria Cathleen Schine and adapted for the screen by
Maria Maggenti, does not take itself seriously.  Even Ellen
DeGeneres--who once again steals every scene she is in--
appears to sleepwalk her way through the tale, or at least
appears to do so when you compare her performance with
her work in "EdTV."

   "The Love Letter" borrows a technique used so
successfully in works from playwrights from Plautus through
Shakespeare and beyond--mistaken identity with the comic
and romantic touches that can emerge from such deception.
The enigma in question centers on a mysterious writer,
although his or her identity (revealed in the final moments) is
not important.  What is consequential is the buried feelings
that some of the most unlikely characters possess and how
the possibility of having a secret admirer makes residents of
Loblolly, Massachusetts (actually filmed in that state's town of
Rockport) spring to life.

   When the owner of the town's bookstore, Helen (Kate
Capshaw), receives an unsigned, typewritten note professing
love, she assumes the dispatch is directed to her and begins
to fantasy who might be preoccupied with thoughts of her.
When people speak to her in everyday terms, she imagines
their declaring unbridled passion.  She leaves the note by
a wine bottle where it is picked up by her dinner guest and
summer assistant, the twenty-year-old Johnny (Tom Everett
Scott), who is certain that the letter is Helen's and that it is
directed to him.  Gradually the note finds its way into the
hands of a few others in Loblolly with similar effects.  Among
the consequences is that a budding romance between Helen
and the town's firefighter, George (Tom Selleck) is rekindled,
but not before Helen works her way through a brief,
passionate affair with Johnny, who is twenty years or so her
junior.  In one swift month Helen turns from a stable, if
unfulfilled bookseller, to the bemused object of a triangular
relationship.  In the process she discovers a surprising secret
about her mother, Lillian (Blythe Danner) as well, and
uncovers a post card from an old shoebox which, if carefully
read some years back, would have dramatically altered her
life.

   At best, "The Love Letter" could provide for a career-
making opportunity for Tom Everett Scott, heretofore known
to the public only for cutesy roles in movies like Tom Hanks's
"That Thing You Do" and teen horror circuit adventures like
"Dead Man on Campus."  The story telling is for the most
part linear and conventional with Tami Reiker's camera failing
to exploit much quaintness is the town of Rockport.  Nor does
Ms. Reiker's camerawork paint a flattering portrait of Kate
Capshaw, whose wan acting cannot make a case for an
April-September affair with a college kid.  In her small role
Blythe Danner puts most of the remainder of the cast to
shame by her mere presence, as veteran Tom Selleck
appears so unenthusiastic in his pursuit of Capshaw's
character that his affection for her is even less convincing
than is hers for young Scott.  Finally, Bill Buell's cartoonish
performance as a keystone cop puts could put the lid on
tourism to Rockport.

Rated R.  Running Time: 95 minutes.  (C) 1999
Harvey Karten

The review above was posted to the
rec.arts.movies.reviews newsgroup (de.rec.film.kritiken for German reviews).

The Internet Movie Database accepts no responsibility for the contents of the
review and has no editorial control. Unless stated otherwise, the copyright
belongs to the author.

Please direct comments/criticisms of the review to relevant newsgroups.

Broken URLs inthe reviews are the responsibility of the author.

The formatting of the review is likely to differ from the original due
to ASCII to HTML conversion.

Related links: index of all rec.arts.movies.reviews reviews


text:
package com.jujuapps.java.decisionengine.beans;

public enum DecisionResultStatus {
	DECISION_AVAILABLE,
	DECISION_NOT_AVAILABLE;

	public DecisionResultStatus fromString(String val) {
		return valueOf(val);
	}

	public String toString(DecisionResultStatus op) {
		return op.toString();
	}
}


text:
@interface PodsDummy_Pods_MarkdownParseKit_Tests : NSObject
@end
@implementation PodsDummy_Pods_MarkdownParseKit_Tests
@end


text:
package com.core;
/**
 * IKeyword.java
 *
 * Purpose: This interface contains method which contains list of keyword used in framework
 *
 * @author : Abhay Bharti
 * @version 1.0 21/05/14
 */
public interface IKeyword {
	public void ORGenerator(String tObject);
	public boolean KeywordGenerator(String tAction,String tLabelName, String tObjectName,String tParent_Object, String tInputData,String tExpectedData);
}


text:
Hapi Assets
=================

A Hapi plugin to load assets in your views based on the node environment.

## Goal:
Have access to the proper assets based on the node environment being run.

## How it works:
You pass into the plugin options an object with the assets you are wanting to be used, and those assets have to be attached to an environment name space. It uses the `process.env.NODE_ENV` to choose which assets you have access to in the view layer. The default is 'development'.

Example:
```

server.register({
    register: require('hapi-assets'),
    options: {
        development: {
            js: ['js/one.js', 'js/two.js'],
            css: ['css/one.css', 'css/two.css']
        },
        production: {
            js: ['js/scripts.js'],
            css: ['css/styles.css']
        }
    }
}, function (err) {
    if(err){
        console.log('Failed loading plugin hapi-assets');
    }
});

```

Handlebars:
```
{{#each assets.js}}
    <script src="{{this}}"></script>
{{/each}}
```

Jade:
```
each item in assets.js
    script(src='#{item}')

```

### Other
You can see this being used in the Hapi Ninja boilerplate example. [https://github.com/poeticninja/hapi-ninja](https://github.com/poeticninja/hapi-ninja)


text:
<?xml version="1.0" encoding="ISO-8859-1"?>
<!--
  ~ Flatworm - A Java Flat File Importer/Exporter Copyright (C) 2004 James M. Turner.
  ~ Extended by James Lawrence 2005
  ~ Extended by Josh Brackett in 2011 and 2012
  ~ Extended by Alan Henson in 2016
  ~
  ~ Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may
  ~ obtain a copy of the License at
  ~
  ~ http://www.apache.org/licenses/LICENSE-2.0
  ~
  ~ Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS,
  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
  ~ and limitations under the License.
  -->

<file-format>
    <converter name="char" class="com.blackbear.flatworm.converters.CoreConverters" method="convertChar" return-type="java.lang.String"/>
    <converter name="int" class="com.blackbear.flatworm.converters.CoreConverters" method="convertInteger" return-type="java.lang.Integer"/>
    <record name="class">
        <record-ident>
            <field-ident field-start="0" field-length="2">
                <match-string>CL</match-string>
            </field-ident>
        </record-ident>
        <record-definition>
            <bean name="class" class="com.blackbear.flatworm.test.domain.segment.ClassPeriod"/>
            <bean name="student" class="com.blackbear.flatworm.test.domain.segment.Student"/>
            <line delimit="|">
                <record-element length="0" converter-name="char"/>
                <record-element length="0" beanref="class.subject" converter-name="char"/>
                <record-element length="0" beanref="class.period" converter-name="int"/>
                <record-element length="0" beanref="class.teacher" converter-name="char"/>
                <record-element length="0" beanref="class.gradeLevel" converter-name="int"/>
                <segment-element property-name="students" beanref="student" parent-beanref="class" minCount="1" maxCount="30">
                    <field-ident field-start="0" field-length="1">
                        <match-string>S</match-string>
                    </field-ident>
                    <record-element length="0"/>
                    <record-element length="0" beanref="student.firstName" converter-name="char"/>
                    <record-element length="0" beanref="student.lastName" converter-name="char"/>
                    <record-element length="0" beanref="student.grade" converter-name="int"/>
                </segment-element>
                <record-element length="0" beanref="class.room" converter-name="char"/>
            </line>
        </record-definition>
    </record>
</file-format>


text:
@interface NLTQReport : NSObject

@property(nonatomic, readonly) BOOL success;
@property(nonatomic, readonly) BOOL needsRetry;
@property(nonatomic, readonly) int retryCounter;
@property(nonatomic, readonly) BOOL isException;
@property(nonatomic, readonly) BOOL skip;
@property(nonatomic, strong, readonly) NSArray *arguments;

+ (id)reportWithSuccess:(BOOL)success
             needsRetry:(BOOL)needsRetry
           retryCounter:(int)retryCounter
            isException:(BOOL)isException
              arguments:(NSArray*)arguments;
+ (id)skipReport;
- (NSString*)localizedDescription;
@end


text:
package com.ebay.myriad;

import io.dropwizard.Application;
import io.dropwizard.assets.AssetsBundle;
import io.dropwizard.setup.Bootstrap;
import io.dropwizard.setup.Environment;
import io.dropwizard.views.ViewBundle;

import java.util.Iterator;
import java.util.Map;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;

import org.apache.commons.collections4.MapUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.codahale.metrics.JmxReporter;
import com.ebay.myriad.api.ClustersResource;
import com.ebay.myriad.api.ConfigurationResource;
import com.ebay.myriad.api.DashboardResource;
import com.ebay.myriad.api.SchedulerStateResource;
import com.ebay.myriad.common.Constants;
import com.ebay.myriad.configuration.MyriadConfiguration;
import com.ebay.myriad.health.MesosDriverHealthCheck;
import com.ebay.myriad.health.MesosMasterHealthCheck;
import com.ebay.myriad.health.ZookeeperHealthCheck;
import com.ebay.myriad.scheduler.MyriadDriverManager;
import com.ebay.myriad.scheduler.NMProfile;
import com.ebay.myriad.scheduler.NMProfileManager;
import com.ebay.myriad.scheduler.Rebalancer;
import com.ebay.myriad.scheduler.TaskTerminator;
import com.google.inject.Guice;
import com.google.inject.Injector;

public class Main extends Application<MyriadConfiguration> {
	private static final Logger LOGGER = LoggerFactory.getLogger(Main.class);

	private ScheduledExecutorService terminatorService;

	private ScheduledExecutorService rebalancerService;

	public static void main(String[] args) throws Exception {
		new Main().run(new String[] { "server",
				System.getProperty(Constants.CONFIG_PROPERTY) });
	}

	@Override
	public void initialize(Bootstrap<MyriadConfiguration> bootstrap) {
		bootstrap.addBundle(new ViewBundle());
		bootstrap
				.addBundle(new AssetsBundle("/assets/css", "/css", null, "css"));
		bootstrap.addBundle(new AssetsBundle("/assets/js", "/js", null, "js"));
	}

	@Override
	public void run(MyriadConfiguration cfg, Environment env) {
		MyriadModule myriadModule = new MyriadModule(cfg);
		Injector injector = Guice.createInjector(myriadModule);

		if (LOGGER.isDebugEnabled()) {
			LOGGER.debug("Bindings: " + injector.getAllBindings());
		}

		JmxReporter.forRegistry(env.metrics()).build().start();
		registerManaged(cfg, env, injector);

		registerResources(cfg, env, injector);
		initHealthChecks(cfg, env, injector);
		initProfiles(cfg, env, injector);
		initRebalancerService(cfg, env, injector);
		initTerminatorService(cfg, env, injector);
	}

	private void registerManaged(final MyriadConfiguration cfg,
			final Environment env, Injector injector) {
		final MyriadDriverManager driverManager = injector
				.getInstance(MyriadDriverManager.class);
		env.lifecycle().manage(driverManager);
	}

	/**
	 * Registers API resources.
	 *
	 * @param injector
	 */
	private void registerResources(final MyriadConfiguration cfg,
			final Environment env, Injector injector) {
		env.jersey()
				.register(injector.getInstance(ConfigurationResource.class));
		env.jersey().register(injector.getInstance(DashboardResource.class));
		env.jersey().register(injector.getInstance(ClustersResource.class));
		env.jersey().register(
				injector.getInstance(SchedulerStateResource.class));
	}

	/**
	 * Initializes health checks.
	 *
	 * @param injector
	 */
	private void initHealthChecks(final MyriadConfiguration cfg,
			final Environment env, Injector injector) {
		LOGGER.info("Initializing HealthChecks");
		env.healthChecks().register(MesosMasterHealthCheck.NAME,
				injector.getInstance(MesosMasterHealthCheck.class));
		env.healthChecks().register(ZookeeperHealthCheck.NAME,
				injector.getInstance(ZookeeperHealthCheck.class));
		env.healthChecks().register(MesosDriverHealthCheck.NAME,
				injector.getInstance(MesosDriverHealthCheck.class));
	}

	private void initProfiles(final MyriadConfiguration cfg,
			final Environment env, Injector injector) {
		LOGGER.info("Initializing Profiles");
		NMProfileManager profileManager = injector
				.getInstance(NMProfileManager.class);
		Map<String, Map<String, String>> profiles = cfg.getProfiles();
		if (MapUtils.isNotEmpty(profiles)) {
			Iterator<String> profileKeys = profiles.keySet().iterator();
			while (profileKeys.hasNext()) {
				String profileKey = profileKeys.next();
				Map<String, String> profileResourceMap = profiles
						.get(profileKey);
				if (MapUtils.isNotEmpty(profiles)
						&& profileResourceMap.containsKey("cpu")
						&& profileResourceMap.containsKey("mem")) {
					double cpu = Double.parseDouble(profileResourceMap
							.get("cpu"));
					double mem = Double.parseDouble(profileResourceMap
							.get("mem"));

					profileManager.add(new NMProfile(profileKey, cpu, mem));
				} else {
					LOGGER.error("Invalid definition for profile: "
							+ profileKey);
				}
			}
		}
	}

	private void initTerminatorService(MyriadConfiguration cfg,
			Environment env, Injector injector) {
		LOGGER.info("Initializing Terminator");
		terminatorService = Executors.newScheduledThreadPool(1);
		terminatorService.scheduleAtFixedRate(
				injector.getInstance(TaskTerminator.class), 100, 2000,
				TimeUnit.MILLISECONDS);
	}

	private void initRebalancerService(MyriadConfiguration cfg,
			Environment env, Injector injector) {
		if (cfg.isRebalancer()) {
			LOGGER.info("Initializing Rebalancer");
			rebalancerService = Executors.newScheduledThreadPool(1);
			rebalancerService.scheduleAtFixedRate(
					injector.getInstance(Rebalancer.class), 100, 5000,
					TimeUnit.MILLISECONDS);
		} else {
			LOGGER.info("Rebalancer is not turned on");
		}
	}

}


text:
require 'spec_helper'
require 'useragent'

describe CASinoCore::Model::TicketGrantingTicket do
  let(:ticket_granting_ticket) { FactoryGirl.create :ticket_granting_ticket }
  let(:service_ticket) { FactoryGirl.create :service_ticket, ticket_granting_ticket: ticket_granting_ticket }

  describe '#destroy' do
    let!(:consumed_service_ticket) { FactoryGirl.create :service_ticket, :consumed, ticket_granting_ticket: ticket_granting_ticket }

    context 'when notification for a service ticket fails' do
      before(:each) do
        CASinoCore::Model::ServiceTicket::SingleSignOutNotifier.any_instance.stub(:notify).and_return(false)
      end

      it 'deletes depending proxy-granting tickets' do
        consumed_service_ticket.proxy_granting_tickets.create! ticket: 'PGT-12345', iou: 'PGTIOU-12345', pgt_url: 'bla'
        lambda {
          ticket_granting_ticket.destroy
        }.should change(CASinoCore::Model::ProxyGrantingTicket, :count).by(-1)
      end

      it 'deletes depending service tickets' do
        lambda {
          ticket_granting_ticket.destroy
        }.should change(CASinoCore::Model::ServiceTicket, :count).by(-1)
      end
    end
  end

  describe '#browser_info' do
    let(:user_agent) { Object.new }
    before(:each) do
      user_agent.stub(:browser).and_return('TestBrowser')
      UserAgent.stub(:parse).and_return(user_agent)
    end

    context 'without platform' do
      before(:each) do
        user_agent.stub(:platform).and_return(nil)
      end

      it 'returns the browser name' do
        ticket_granting_ticket.browser_info.should == 'TestBrowser'
      end
    end

    context 'with a platform' do
      before(:each) do
        user_agent.stub(:platform).and_return('Linux')
      end

      it 'returns the browser name' do
        ticket_granting_ticket.browser_info.should == 'TestBrowser (Linux)'
      end
    end
  end

  describe '#same_user?' do
    context 'with a nil value' do
      let(:other_ticket_granting_ticket) { nil }

      it 'should return false' do
        ticket_granting_ticket.same_user?(other_ticket_granting_ticket).should == false
      end
    end

    context 'with a ticket from another user' do
      let(:other_ticket_granting_ticket) { FactoryGirl.create :ticket_granting_ticket  }

      it 'should return false' do
        ticket_granting_ticket.same_user?(other_ticket_granting_ticket).should == false
      end
    end

    context 'with a ticket from the same user' do
      let(:other_ticket_granting_ticket) { FactoryGirl.create :ticket_granting_ticket, user: ticket_granting_ticket.user }

      it 'should return true' do
        ticket_granting_ticket.same_user?(other_ticket_granting_ticket).should == true
      end
    end
  end

  describe '#expired?' do
    context 'with a long-term ticket' do
      context 'when almost expired' do
        before(:each) do
          ticket_granting_ticket.created_at = 9.days.ago
          ticket_granting_ticket.long_term = true
          ticket_granting_ticket.save!
        end

        it 'returns false' do
          ticket_granting_ticket.expired?.should == false
        end
      end

      context 'when expired' do
        before(:each) do
          ticket_granting_ticket.created_at = 30.days.ago
          ticket_granting_ticket.long_term = true
          ticket_granting_ticket.save!
        end

        it 'returns true' do
          ticket_granting_ticket.expired?.should == true
        end
      end
    end

    context 'with an expired ticket' do
      before(:each) do
        ticket_granting_ticket.created_at = 25.hours.ago
        ticket_granting_ticket.save!
      end

      it 'returns true' do
        ticket_granting_ticket.expired?.should == true
      end
    end

    context 'with an unexpired ticket' do
      it 'returns false' do
        ticket_granting_ticket.expired?.should == false
      end
    end

    context 'with pending two-factor authentication' do
      before(:each) do
        ticket_granting_ticket.awaiting_two_factor_authentication = true
        ticket_granting_ticket.save!
      end

      context 'with an expired ticket' do
        before(:each) do
          ticket_granting_ticket.created_at = 10.minutes.ago
          ticket_granting_ticket.save!
        end

        it 'returns true' do
          ticket_granting_ticket.expired?.should == true
        end
      end

      context 'with an unexpired ticket' do
        it 'returns false' do
          ticket_granting_ticket.expired?.should == false
        end
      end
    end
  end

  describe '.cleanup' do
    let!(:other_ticket_granting_ticket) { FactoryGirl.create :ticket_granting_ticket }

    it 'deletes expired ticket-granting tickets' do
      ticket_granting_ticket.created_at = 25.hours.ago
      ticket_granting_ticket.save!
      lambda do
        described_class.cleanup
      end.should change(described_class, :count).by(-1)
      described_class.find_by_ticket(ticket_granting_ticket.ticket).should be_false
    end

    it 'does not delete almost expired long-term ticket-granting tickets' do
      ticket_granting_ticket.created_at = 9.days.ago
      ticket_granting_ticket.long_term = true
      ticket_granting_ticket.save!
      lambda do
        described_class.cleanup
      end.should_not change(described_class, :count)
    end

    it 'does delete expired long-term ticket-granting tickets' do
      ticket_granting_ticket.created_at = 30.days.ago
      ticket_granting_ticket.long_term = true
      ticket_granting_ticket.save!
      lambda do
        described_class.cleanup
      end.should change(described_class, :count).by(-1)
      described_class.find_by_ticket(ticket_granting_ticket.ticket).should be_false
    end

    it 'does not delete almost expired ticket-granting tickets with pending two-factor authentication' do
      ticket_granting_ticket.created_at = 2.minutes.ago
      ticket_granting_ticket.awaiting_two_factor_authentication = true
      ticket_granting_ticket.save!
      lambda do
        described_class.cleanup
      end.should_not change(described_class, :count)
    end

    it 'does delete expired ticket-granting tickets with pending two-factor authentication' do
      ticket_granting_ticket.created_at = 20.minutes.ago
      ticket_granting_ticket.awaiting_two_factor_authentication = true
      ticket_granting_ticket.save!
      lambda do
        described_class.cleanup
      end.should change(described_class, :count).by(-1)
      described_class.find_by_ticket(ticket_granting_ticket.ticket).should be_false
    end
  end
end


text:
'use strict';

const Router = require('express').Router;
const debug = require('debug')('ht:hospital-router');
const jsonParser = require('body-parser').json();
const createError = require('http-errors');
const bearerAuth = require('../lib/bearer-auth-middleware');
const Hospital = require('../model/hospital');

const hospitalRouter = module.exports = Router();

hospitalRouter.post('/api/hospital', bearerAuth, jsonParser, function(req, res, next){
  debug('hit POST /api/hospital');
  new Hospital(req.body).save()
  .then( hospital => res.json(hospital))
  .catch(next);
});

hospitalRouter.delete('/api/hospital/:hospitalID', bearerAuth, function(req, res, next) {
  debug('Hit DELETE /api/hospital/:hospitalID');
  if(!req.params.hospitalID) return next(createError(404, 'expected hospitalID'));
  Hospital.findByIdAndRemove(req.params.hospitalID)
  .catch(err => Promise.reject(createError(404, err.message)))
  .then(() => res.sendStatus(204))
  .catch(next);
});


text:
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android">
    <item
            android:id="@+id/usuarioSearch"
            android:actionViewClass="android.widget.SearchView"
            android:icon="@android:drawable/ic_menu_search"
            android:showAsAction="ifRoom|collapseActionView"
            android:title="@string/contactsSearch"/>
    <!--<item
            android:id="@+id/contactSynchronize"
            android:icon="@drawable/ic_menu_refresh"
            android:showAsAction="always"
            android:title="@string/contactsSynchronize"
            android:visible="false"/>-->

    <item
            android:id="@+id/mainOptions"
            android:icon="@android:drawable/ic_menu_preferences"
            android:showAsAction="always"
            android:title="@string/mainOptions">
        <menu>
            <group
                    android:id="@+id/usuarioSettings"
                    >
                <item
                        android:id="@+id/getAllUsers"
                        android:title="@string/doGetAllUsers"
                        />
                <item
                        android:id="@+id/exportContacts"
                        android:title="@string/exportContacts"
                        />
                <item
                        android:id="@+id/importContacts"
                        android:title="@string/importContacts"
                        />
                <item
                        android:id="@+id/sendSms"
                        android:title="@string/sendSMS"
                        />
                <item
                        android:id="@+id/sendEmail"
                        android:title="@string/sendEmail"
                        />
            </group>
        </menu>
    </item>
</menu>


text:
<?xml version="1.0" encoding="UTF-8"?>

<plugin xmlns="http://www.phonegap.com/ns/plugins/1.0"
        xmlns:android="http://schemas.android.com/apk/res/android"
        id="cordova-brother-label-printer"
        version="0.0.4">

    <name>BrotherPrinter</name>

    <description>Cordova hooks for Brother Print SDK</description>
    <repo>https://github.com/gordol/cordova-brother-label-printer.git</repo>
    <keywords>brother, sdk, print</keywords>
    <license></license>

    <author>Thomas Gordon Lowrey IV</author>

    <engines>
        <engine name="cordova" version=">=3.0.0" />
    </engines>

    <!-- interface -->
    <js-module src="www/printer.js" name="BrotherPrinter">
        <clobbers target="plugin.brotherPrinter" />
        <clobbers target="cordova.plugins.brotherPrinter" />
    </js-module>

    <!-- android -->
    <platform name="android">
        <config-file target="res/xml/config.xml" parent="/*">
            <feature name="BrotherPrinter">
                <param name="android-package" value="com.threescreens.cordova.plugin.brotherPrinter.BrotherPrinter"/>
            </feature>
        </config-file>

        <source-file src="src/android/BrotherPrinter.java" target-dir="src/com/threescreens/cordova/plugin/brotherPrinter" />

        <source-file src="src/android/Common.java" target-dir="src/com/brother/ptouch/sdk/printdemo/common" />
        <source-file src="src/android/MsgHandle.java" target-dir="src/com/brother/ptouch/sdk/printdemo/common" />

        <source-file src="src/android/BasePrint.java" target-dir="src/com/brother/ptouch/sdk/printdemo/printprocess" />
        <source-file src="src/android/ImageBitmapPrint.java" target-dir="src/com/brother/ptouch/sdk/printdemo/printprocess" />
        <source-file src="src/android/ImageFilePrint.java" target-dir="src/com/brother/ptouch/sdk/printdemo/printprocess" />

        <source-file src="src/android/libs/BrotherPrintLibrary.jar" target-dir="libs" />
        <source-file src="src/android/libs/armeabi" target-dir="libs" />

        <config-file target="AndroidManifest.xml" parent="/manifest">
            <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
            <uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>
            <uses-permission android:name="android.permission.BLUETOOTH" android:required="false" />
            <uses-permission android:name="android.permission.BLUETOOTH_ADMIN" android:required="false" />
            <uses-permission android:name="android.permission.INTERNET"/>
            <uses-permission android:name="android.permission.USB" android:required="false" />
            <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />

            <uses-feature android:name="android.hardware.usb" android:required="false" />
        </config-file>
    </platform>

    <platform name="ios">
        <config-file target="config.xml" parent="/*">
            <feature name="BrotherPrinter">
                <param name="ios-package" value="BrotherPrinter"/>
            </feature>
        </config-file>

        <config-file target="*-Info.plist" parent="UISupportedExternalAccessoryProtocols">
            <array>
                <string>com.brother.ptcbp</string>
            </array>
        </config-file>

        <framework src="src/ios/libs/BRPtouchPrinterKit.framework" custom="true" />
        <framework src="ExternalAccessory.framework" />

        <header-file src="src/ios/BRBluetoothPrintOperation.h" />
        <source-file src="src/ios/BRBluetoothPrintOperation.m" />

        <header-file src="src/ios/BRPingOperation.h" />
        <source-file src="src/ios/BRPingOperation.m" />

        <header-file src="src/ios/BRUserDefaults.h" />

        <header-file src="src/ios/BRWLANPrintOperation.h" />
        <source-file src="src/ios/BRWLANPrintOperation.m" />

        <header-file src="src/ios/BrotherPrinter.h" />
        <source-file src="src/ios/BrotherPrinter.m" />

        <header-file src="src/ios/APPingModule.h" />
        <source-file src="src/ios/APPingModule.m" />

    </platform>
</plugin>


text:
class Ability
  class << self
    def allowed(user, subject)
      return [] unless user.kind_of?(User)

      case subject.class.name
      when "Project" then project_abilities(user, subject)
      when "Issue" then issue_abilities(user, subject)
      when "Note" then note_abilities(user, subject)
      when "Snippet" then snippet_abilities(user, subject)
      when "MergeRequest" then merge_request_abilities(user, subject)
      when "Group", "Namespace" then group_abilities(user, subject)
      when "UserTeam" then user_team_abilities(user, subject)
      else []
      end.concat(global_abilities(user))
    end

    def global_abilities(user)
      rules = []
      rules << :create_group if user.can_create_group
      rules << :create_team if user.can_create_team
      rules
    end

    def project_abilities(user, project)
      rules = []

      team = project.team

      # Rules based on role in project
      if team.masters.include?(user)
        rules << project_master_rules

      elsif team.developers.include?(user)
        rules << project_dev_rules

      elsif team.reporters.include?(user)
        rules << project_report_rules

      elsif team.guests.include?(user)
        rules << project_guest_rules
      end

      if project.owner == user
        rules << project_admin_rules
      end

      rules.flatten
    end

    def project_guest_rules
      [
        :read_project,
        :read_wiki,
        :read_issue,
        :read_milestone,
        :read_snippet,
        :read_team_member,
        :read_merge_request,
        :read_note,
        :write_project,
        :write_issue,
        :write_note
      ]
    end

    def project_report_rules
      project_guest_rules + [
        :download_code,
        :write_snippet
      ]
    end

    def project_dev_rules
      project_report_rules + [
        :write_merge_request,
        :write_wiki,
        :push_code
      ]
    end

    def project_master_rules
      project_dev_rules + [
        :push_code_to_protected_branches,
        :modify_issue,
        :modify_snippet,
        :modify_merge_request,
        :admin_issue,
        :admin_milestone,
        :admin_snippet,
        :admin_team_member,
        :admin_merge_request,
        :admin_note,
        :accept_mr,
        :admin_wiki,
        :admin_project
      ]
    end

    def project_admin_rules
      project_master_rules + [
        :change_namespace,
        :change_public_mode,
        :rename_project,
        :remove_project
      ]
    end

    def group_abilities user, group
      rules = []

      # Only group owner and administrators can manage group
      if group.owner == user || user.admin?
        rules << [
          :manage_group,
          :manage_namespace
        ]
      end

      rules.flatten
    end

    def user_team_abilities user, team
      rules = []

      # Only group owner and administrators can manage group
      if team.owner == user || team.admin?(user) || user.admin?
        rules << [ :manage_user_team ]
      end

      if team.owner == user || user.admin?
        rules << [ :admin_user_team ]
      end

      rules.flatten
    end

    [:issue, :note, :snippet, :merge_request].each do |name|
      define_method "#{name}_abilities" do |user, subject|
        if subject.author == user
          [
            :"read_#{name}",
            :"write_#{name}",
            :"modify_#{name}",
            :"admin_#{name}"
          ]
        elsif subject.respond_to?(:assignee) && subject.assignee == user
          [
            :"read_#{name}",
            :"write_#{name}",
            :"modify_#{name}",
          ]
        else
          subject.respond_to?(:project) ? project_abilities(user, subject.project) : []
        end
      end
    end
  end
end


text:
import math
import json
import pycurl
from tests import Test
import tests
from parsing import *
try:
    from cStringIO import StringIO
except:
    from StringIO import StringIO

"""
Encapsulates logic related to benchmarking
- Parameters and fields for benchmarks
- Benchmark object that extends tests.Test object with additional fields
- Templating/Caching logic specific to benchmarks
"""

#Curl metrics for benchmarking, key is name in config file, value is pycurl variable
#Taken from pycurl docs, this is libcurl variable minus the CURLINFO prefix
# Descriptions of the timing variables are taken from libcurl docs:
#   http://curl.haxx.se/libcurl/c/curl_easy_getinfo.html

METRICS = {
    #Timing info, precisely in order from start to finish
    #The time it took from the start until the name resolving was completed.
    'namelookup_time' : pycurl.NAMELOOKUP_TIME,

    #The time it took from the start until the connect to the remote host (or proxy) was completed.
    'connect_time' : pycurl.CONNECT_TIME,

    #The time it took from the start until the SSL connect/handshake with the remote host was completed.
    'appconnect_time' : pycurl.APPCONNECT_TIME,

    #The time it took from the start until the file transfer is just about to begin.
    #This includes all pre-transfer commands and negotiations that are specific to the particular protocol(s) involved.
    'pretransfer_time' : pycurl.PRETRANSFER_TIME,

    #The time it took from the start until the first byte is received by libcurl.
    'starttransfer_time' : pycurl.STARTTRANSFER_TIME,

    #The time it took for all redirection steps include name lookup, connect, pretransfer and transfer
    #  before final transaction was started. So, this is zero if no redirection took place.
    'redirect_time' : pycurl.REDIRECT_TIME,

    #Total time of the previous request.
    'total_time' : pycurl.TOTAL_TIME,

    #Transfer sizes and speeds
    'size_download' : pycurl.SIZE_DOWNLOAD,
    'size_upload' : pycurl.SIZE_UPLOAD,
    'request_size' : pycurl.REQUEST_SIZE,
    'speed_download' : pycurl.SPEED_DOWNLOAD,
    'speed_upload' : pycurl.SPEED_UPLOAD,

    #Connection counts
    'redirect_count' : pycurl.REDIRECT_COUNT,
    'num_connects' : pycurl.NUM_CONNECTS
}

#Map statistical aggregate to the function to use to perform the aggregation on an array
AGGREGATES = {
    'mean_arithmetic': #AKA the average, good for many things
        lambda x: float(sum(x))/float(len(x)),
    'mean':  # Alias for arithmetic mean
        lambda x: float(sum(x))/float(len(x)),
    'mean_harmonic': #Harmonic mean, better predicts average of rates: http://en.wikipedia.org/wiki/Harmonic_mean
        lambda x: 1.0/( sum([1.0/float(y) for y in x]) / float(len(x))),
    'median':  lambda x: median(x),
    'std_deviation': lambda x: std_deviation(x),
    'sum' : lambda x: sum(x),
    'total' : lambda x: sum(x)
}

OUTPUT_FORMATS = [u'csv', u'json']

def median(array):
    """ Get the median of an array """
    sorted = [x for x in array]
    sorted.sort()
    middle = len(sorted)/2 #Gets the middle element, if present
    if len(sorted) % 2 == 0: #Even, so need to average together the middle two values
        return float((sorted[middle]+sorted[middle-1]))/2
    else:
        return sorted[middle]

def std_deviation(array):
    """ Compute the standard deviation of an array of numbers """
    if not array or len(array) == 1:
        return 0

    average = AGGREGATES['mean_arithmetic'](array)
    variance = map(lambda x: (x-average)**2,array)
    stdev = AGGREGATES['mean_arithmetic'](variance)
    return math.sqrt(stdev)

class Benchmark(Test):
    """ Extends test with configuration for benchmarking
        warmup_runs and benchmark_runs behave like you'd expect

        Metrics are a bit tricky:
            - Key is metric name from METRICS
            - Value is either a single value or a list:
                - list contains aggregagate name from AGGREGATES
                - value of 'all' returns everything
    """
    warmup_runs = 10 #Times call is executed to warm up
    benchmark_runs = 100 #Times call is executed to generate benchmark results
    output_format = u'csv'
    output_file = None

    #Metrics to gather, both raw and aggregated
    metrics = set()

    raw_metrics = set()  # Metrics that do not have any aggregation performed
    aggregated_metrics = dict()  # Metrics where an aggregate is computed, maps key(metric name) -> list(aggregates to use)

    def ninja_copy(self):
        """ Optimization: limited, fast copy of benchmark, overrides Test parent method """
        output = Benchmark()
        myvars = vars(self)
        output.__dict__ = myvars.copy()
        return output

    def add_metric(self, metric_name, aggregate=None):
        """ Add a metric-aggregate pair to the benchmark, where metric is a number to measure from curl, and aggregate is an aggregation function
            (See METRICS and AGGREGATES)
            If aggregate is not defined (False,empty, or None), then the raw number is reported
            Returns self, for fluent-syle construction of config """

        clean_metric = metric_name.lower().strip()

        if clean_metric.lower() not in METRICS:
            raise Exception("Metric named: " + metric_name + " is not a valid benchmark metric.")
        self.metrics.add(clean_metric)

        if not aggregate:
            self.raw_metrics.add(clean_metric)
        elif aggregate.lower().strip() in AGGREGATES:
            # Add aggregate to this metric
            clean_aggregate = aggregate.lower().strip()
            current_aggregates = self.aggregated_metrics.get(clean_metric, list())
            current_aggregates.append(clean_aggregate)
            self.aggregated_metrics[clean_metric]  = current_aggregates
        else:
            raise Exception("Aggregate function " + aggregate + " is not a legal aggregate function name");

        return self;

    def __init__(self):
        self.metrics = set()
        self.raw_metrics = set()
        self.aggregated_metrics = dict()
        super(Benchmark, self).__init__()

    def __str__(self):
        return json.dumps(self, default=safe_to_json)

def realize_partial(self, context=None):
    """ Attempt to template out what is possible for this benchmark """
    if not self.is_dynamic():
        return self
    if self.is_context_modifier():
        # Enhanceme - once extract is done, check if variables already bound, in that case template out
        return self
    else:
        copyout = copy.cop

    pass

def configure_curl(self, timeout=tests.DEFAULT_TIMEOUT, context=None, curl_handle=None):
    curl = super().configure_curl(self, timeout=timeout, context=context, curl_handle=curl_handle)
    curl.setopt(pycurl.FORBID_REUSE, 1)  # Simulate results from different users hitting server
    return curl

def parse_benchmark(base_url, node):
    """ Try building a benchmark configuration from deserialized configuration root node """
    node = lowercase_keys(flatten_dictionaries(node))  # Make it usable

    benchmark = Benchmark()

    # Read & set basic test parameters
    benchmark = Test.parse_test(base_url, node, benchmark)

    # Complex parsing because of list/dictionary/singleton legal cases
    for key, value in node.items():
        if key == u'warmup_runs':
            benchmark.warmup_runs = int(value)
        elif key == u'benchmark_runs':
            benchmark.benchmark_runs = int(value)
        elif key == u'output_format':
            format = value.lower()
            if format in OUTPUT_FORMATS:
                benchmark.output_format = format
            else:
                raise Exception('Invalid benchmark output format: ' + format)
        elif key == u'output_file':
            if not isinstance(value, basestring):
                raise Exception("Invalid output file format")
            benchmark.output_file = value
        elif key == u'metrics':
            if isinstance(value, unicode) or isinstance(value,str):
                # Single value
                benchmark.add_metric(unicode(value, 'UTF-8'))
            elif isinstance(value, list) or isinstance(value, set):
            # List of single values or list of {metric:aggregate, ...}
                for metric in value:
                    if isinstance(metric, dict):
                        for metricname, aggregate in metric.items():
                            if not isinstance(metricname, basestring):
                                raise Exception("Invalid metric input: non-string metric name")
                            if not isinstance(aggregate, basestring):
                                raise Exception("Invalid aggregate input: non-string aggregate name")
                            # TODO unicode-safe this
                            benchmark.add_metric(unicode(metricname,'UTF-8'), unicode(aggregate,'UTF-8'))

                    elif isinstance(metric, unicode) or isinstance(metric, str):
                        benchmark.add_metric(unicode(metric,'UTF-8'))
            elif isinstance(value, dict):
                # Dictionary of metric-aggregate pairs
                for metricname, aggregate in value.items():
                    if not isinstance(metricname, basestring):
                        raise Exception("Invalid metric input: non-string metric name")
                    if not isinstance(aggregate, basestring):
                        raise Exception("Invalid aggregate input: non-string aggregate name")
                    benchmark.add_metric(unicode(metricname,'UTF-8'), unicode(aggregate,'UTF-8'))
            else:
                raise Exception("Invalid benchmark metric datatype: "+str(value))

    return benchmark


text:
namespace alinous {namespace runtime {namespace engine {namespace debugger {namespace server {

bool ICommandSender::__init_done = __init_static_variables();
bool ICommandSender::__init_static_variables(){
	Java2CppSystem::getSelf();
	ThreadContext* ctx = ThreadContext::newThreadContext();
	{
		GCNotifier __refobj1(ctx, __FILEW__, __LINE__, L"ICommandSender", L"__init_static_variables");
	}
	ctx->localGC();
	delete ctx;
	return true;
}
 ICommandSender::ICommandSender(ThreadContext* ctx) throw()  : IObject(ctx)
{
}
void ICommandSender::__construct_impl(ThreadContext* ctx) throw()
{
}
 ICommandSender::~ICommandSender() throw()
{
	ThreadContext *ctx = ThreadContext::getCurentContext();
	if(ctx != nullptr){ctx->incGcDenial();}
	__releaseRegerences(false, ctx);
	if(ctx != nullptr){ctx->decGcDenial();}
}
void ICommandSender::__releaseRegerences(bool prepare, ThreadContext* ctx) throw()
{
	if(!prepare){
		return;
	}
}
void ICommandSender::__cleanUp(ThreadContext* ctx){
}
}}}}}


text:
"use strict"

exports.out = (store, node, out) => {};
exports.node = (store, node) => {};


text:
FROM java:8
VOLUME /tmp
ADD rating-microservice-0.1.0.jar app.jar
RUN bash -c 'touch /app.jar'
EXPOSE 9004
ENTRYPOINT ["java","-Djava.security.egd=file:/dev/./urandom","-jar","/app.jar"]


text:
package com.amazonaws.services.elasticloadbalancingv2.model.transform;

import javax.xml.stream.events.XMLEvent;
import javax.annotation.Generated;

import com.amazonaws.services.elasticloadbalancingv2.model.*;
import com.amazonaws.transform.Unmarshaller;

import com.amazonaws.transform.StaxUnmarshallerContext;
import com.amazonaws.transform.SimpleTypeStaxUnmarshallers.*;

/**
 * LoadBalancerState StAX Unmarshaller
 */

@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class LoadBalancerStateStaxUnmarshaller implements Unmarshaller<LoadBalancerState, StaxUnmarshallerContext> {

    public LoadBalancerState unmarshall(StaxUnmarshallerContext context) throws Exception {
        LoadBalancerState loadBalancerState = new LoadBalancerState();
        int originalDepth = context.getCurrentDepth();
        int targetDepth = originalDepth + 1;

        if (context.isStartOfDocument())
            targetDepth += 1;

        while (true) {
            XMLEvent xmlEvent = context.nextEvent();
            if (xmlEvent.isEndDocument())
                return loadBalancerState;

            if (xmlEvent.isAttribute() || xmlEvent.isStartElement()) {

                if (context.testExpression("Code", targetDepth)) {
                    loadBalancerState.setCode(StringStaxUnmarshaller.getInstance().unmarshall(context));
                    continue;
                }

                if (context.testExpression("Reason", targetDepth)) {
                    loadBalancerState.setReason(StringStaxUnmarshaller.getInstance().unmarshall(context));
                    continue;
                }
            } else if (xmlEvent.isEndElement()) {
                if (context.getCurrentDepth() < originalDepth) {
                    return loadBalancerState;
                }
            }
        }
    }

    private static LoadBalancerStateStaxUnmarshaller instance;

    public static LoadBalancerStateStaxUnmarshaller getInstance() {
        if (instance == null)
            instance = new LoadBalancerStateStaxUnmarshaller();
        return instance;
    }
}