text:
package org.scalatest.matchers

import org.scalatest._
import org.scalatest.prop.Checkers
import org.scalacheck._
import Arbitrary._
import Prop._

class ShouldFullyMatchSpec extends Spec with ShouldMatchers with Checkers with ReturnsNormallyThrowsAssertion {

/*
s should include substring t
s should include regex t
s should startWith substring t
s should startWith regex t
s should endWith substring t
s should endWith regex t
s should fullyMatch regex t
*/

  describe("The fullyMatch regex syntax") {

    val decimal = """(-)?(\d+)(\.\d*)?"""
    val decimalRegex = """(-)?(\d+)(\.\d*)?""".r

    describe("(when the regex is specified by a string)") {

      it("should do nothing if the string fully matches the regular expression specified as a string") {
        "1.7" should fullyMatch regex ("1.7")
        "1.7" should fullyMatch regex (decimal)
        "-1.8" should fullyMatch regex (decimal)
        "8" should fullyMatch regex (decimal)
        "1." should fullyMatch regex (decimal)
      }

      it("should do nothing if the string does not fully match the regular expression specified as a string when used with not") {

        "eight" should not { fullyMatch regex (decimal) }
        "1.eight" should not { fullyMatch regex (decimal) }
        "one.8" should not { fullyMatch regex (decimal) }

        "eight" should not fullyMatch regex (decimal)
        "1.eight" should not fullyMatch regex (decimal)
        "one.8" should not fullyMatch regex (decimal)
        "1.8-" should not fullyMatch regex (decimal)
      }

      it("should do nothing if the string does not fully match the regular expression specified as a string when used in a logical-and expression") {
        "1.7" should (fullyMatch regex (decimal) and (fullyMatch regex (decimal)))
        "1.7" should ((fullyMatch regex (decimal)) and (fullyMatch regex (decimal)))
        "1.7" should (fullyMatch regex (decimal) and fullyMatch regex (decimal))
      }

      it("should do nothing if the string does not fully match the regular expression specified as a string when used in a logical-or expression") {
        "1.7" should (fullyMatch regex ("hello") or (fullyMatch regex (decimal)))
        "1.7" should ((fullyMatch regex ("hello")) or (fullyMatch regex (decimal)))
        "1.7" should (fullyMatch regex ("hello") or fullyMatch regex (decimal))
      }

      it("should do nothing if the string does not fully match the regular expression specified as a string when used in a logical-and expression with not") {
        "fred" should (not (fullyMatch regex ("bob")) and not (fullyMatch regex (decimal)))
        "fred" should ((not fullyMatch regex ("bob")) and (not fullyMatch regex (decimal)))
        "fred" should (not fullyMatch regex ("bob") and not fullyMatch regex (decimal))
      }

      it("should do nothing if the string does not fully match the regular expression specified as a string when used in a logical-or expression with not") {
        "fred" should (not (fullyMatch regex ("fred")) or not (fullyMatch regex (decimal)))
        "fred" should ((not fullyMatch regex ("fred")) or (not fullyMatch regex (decimal)))
        "fred" should (not fullyMatch regex ("fred") or not fullyMatch regex (decimal))
      }

      it("should throw TestFailedException if the string does not match the regular expression specified as a string") {

        val caught1 = intercept[TestFailedException] {
          "1.7" should fullyMatch regex ("1.78")
        }
        assert(caught1.getMessage === "\"1.7\" did not fully match the regular expression 1.78")

        val caught2 = intercept[TestFailedException] {
          "1.7" should fullyMatch regex ("21.7")
        }
        assert(caught2.getMessage === "\"1.7\" did not fully match the regular expression 21.7")

        val caught3 = intercept[TestFailedException] {
          "-1.eight" should fullyMatch regex (decimal)
        }
        assert(caught3.getMessage === "\"-1.eight\" did not fully match the regular expression (-)?(\\d+)(\\.\\d*)?")

        val caught6 = intercept[TestFailedException] {
          "eight" should fullyMatch regex (decimal)
        }
        assert(caught6.getMessage === "\"eight\" did not fully match the regular expression (-)?(\\d+)(\\.\\d*)?")

        val caught7 = intercept[TestFailedException] {
          "1.eight" should fullyMatch regex (decimal)
        }
        assert(caught7.getMessage === "\"1.eight\" did not fully match the regular expression (-)?(\\d+)(\\.\\d*)?")

        val caught8 = intercept[TestFailedException] {
          "one.8" should fullyMatch regex (decimal)
        }
        assert(caught8.getMessage === "\"one.8\" did not fully match the regular expression (-)?(\\d+)(\\.\\d*)?")

        val caught9 = intercept[TestFailedException] {
          "1.8-" should fullyMatch regex (decimal)
        }
        assert(caught9.getMessage === "\"1.8-\" did not fully match the regular expression (-)?(\\d+)(\\.\\d*)?")
      }

      it("should throw TestFailedException if the string does matches the regular expression specified as a string when used with not") {

        val caught1 = intercept[TestFailedException] {
          "1.7" should not { fullyMatch regex ("1.7") }
        }
        assert(caught1.getMessage === "\"1.7\" fully matched the regular expression 1.7")

        val caught2 = intercept[TestFailedException] {
          "1.7" should not { fullyMatch regex (decimal) }
        }
        assert(caught2.getMessage === "\"1.7\" fully matched the regular expression (-)?(\\d+)(\\.\\d*)?")

        val caught3 = intercept[TestFailedException] {
          "-1.8" should not { fullyMatch regex (decimal) }
        }
        assert(caught3.getMessage === "\"-1.8\" fully matched the regular expression (-)?(\\d+)(\\.\\d*)?")

        val caught4 = intercept[TestFailedException] {
          "8" should not { fullyMatch regex (decimal) }
        }
        assert(caught4.getMessage === "\"8\" fully matched the regular expression (-)?(\\d+)(\\.\\d*)?")

        val caught5 = intercept[TestFailedException] {
          "1." should not { fullyMatch regex (decimal) }
        }
        assert(caught5.getMessage === "\"1.\" fully matched the regular expression (-)?(\\d+)(\\.\\d*)?")

        val caught11 = intercept[TestFailedException] {
          "1.7" should not fullyMatch regex ("1.7")
        }
        assert(caught11.getMessage === "\"1.7\" fully matched the regular expression 1.7")

        val caught12 = intercept[TestFailedException] {
          "1.7" should not fullyMatch regex (decimal)
        }
        assert(caught12.getMessage === "\"1.7\" fully matched the regular expression (-)?(\\d+)(\\.\\d*)?")

        val caught13 = intercept[TestFailedException] {
          "-1.8" should not fullyMatch regex (decimal)
        }
        assert(caught13.getMessage === "\"-1.8\" fully matched the regular expression (-)?(\\d+)(\\.\\d*)?")

        val caught14 = intercept[TestFailedException] {
          "8" should not fullyMatch regex (decimal)
        }
        assert(caught14.getMessage === "\"8\" fully matched the regular expression (-)?(\\d+)(\\.\\d*)?")

        val caught15 = intercept[TestFailedException] {
          "1." should not fullyMatch regex (decimal)
        }
        assert(caught15.getMessage === "\"1.\" fully matched the regular expression (-)?(\\d+)(\\.\\d*)?")
      }

      it("should throw TestFailedException if the string fully matches the regular expression specified as a string when used in a logical-and expression") {

        val caught1 = intercept[TestFailedException] {
          "1.7" should (fullyMatch regex (decimal) and (fullyMatch regex ("1.8")))
        }
        assert(caught1.getMessage === "\"1.7\" fully matched the regular expression (-)?(\\d+)(\\.\\d*)?, but \"1.7\" did not fully match the regular expression 1.8")

        val caught2 = intercept[TestFailedException] {
          "1.7" should ((fullyMatch regex (decimal)) and (fullyMatch regex ("1.8")))
        }
        assert(caught2.getMessage === "\"1.7\" fully matched the regular expression (-)?(\\d+)(\\.\\d*)?, but \"1.7\" did not fully match the regular expression 1.8")

        val caught3 = intercept[TestFailedException] {
          "1.7" should (fullyMatch regex (decimal) and fullyMatch regex ("1.8"))
        }
        assert(caught3.getMessage === "\"1.7\" fully matched the regular expression (-)?(\\d+)(\\.\\d*)?, but \"1.7\" did not fully match the regular expression 1.8")

        // Check to make sure the error message "short circuits" (i.e., just reports the left side's failure)
        val caught4 = intercept[TestFailedException] {
          "1.eight" should (fullyMatch regex (decimal) and (fullyMatch regex ("1.8")))
        }
        assert(caught4.getMessage === "\"1.eight\" did not fully match the regular expression (-)?(\\d+)(\\.\\d*)?")

        val caught5 = intercept[TestFailedException] {
          "1.eight" should ((fullyMatch regex (decimal)) and (fullyMatch regex ("1.8")))
        }
        assert(caught5.getMessage === "\"1.eight\" did not fully match the regular expression (-)?(\\d+)(\\.\\d*)?")

        val caught6 = intercept[TestFailedException] {
          "1.eight" should (fullyMatch regex (decimal) and fullyMatch regex ("1.8"))
        }
        assert(caught6.getMessage === "\"1.eight\" did not fully match the regular expression (-)?(\\d+)(\\.\\d*)?")
      }

      it("should throw TestFailedException if the string fully matches the regular expression specified as a string when used in a logical-or expression") {

        val caught1 = intercept[TestFailedException] {
          "1.seven" should (fullyMatch regex (decimal) or (fullyMatch regex ("1.8")))
        }
        assert(caught1.getMessage === "\"1.seven\" did not fully match the regular expression (-)?(\\d+)(\\.\\d*)?, and \"1.seven\" did not fully match the regular expression 1.8")

        val caught2 = intercept[TestFailedException] {
          "1.seven" should ((fullyMatch regex (decimal)) or (fullyMatch regex ("1.8")))
        }
        assert(caught2.getMessage === "\"1.seven\" did not fully match the regular expression (-)?(\\d+)(\\.\\d*)?, and \"1.seven\" did not fully match the regular expression 1.8")

        val caught3 = intercept[TestFailedException] {
          "1.seven" should (fullyMatch regex (decimal) or fullyMatch regex ("1.8"))
        }
        assert(caught3.getMessage === "\"1.seven\" did not fully match the regular expression (-)?(\\d+)(\\.\\d*)?, and \"1.seven\" did not fully match the regular expression 1.8")
      }

      it("should throw TestFailedException if the string fully matches the regular expression specified as a string when used in a logical-and expression used with not") {

        val caught1 = intercept[TestFailedException] {
          "1.7" should (not fullyMatch regex ("1.8") and (not fullyMatch regex (decimal)))
        }
        assert(caught1.getMessage === "\"1.7\" did not fully match the regular expression 1.8, but \"1.7\" fully matched the regular expression (-)?(\\d+)(\\.\\d*)?")

        val caught2 = intercept[TestFailedException] {
          "1.7" should ((not fullyMatch regex ("1.8")) and (not fullyMatch regex (decimal)))
        }
        assert(caught2.getMessage === "\"1.7\" did not fully match the regular expression 1.8, but \"1.7\" fully matched the regular expression (-)?(\\d+)(\\.\\d*)?")

        val caught3 = intercept[TestFailedException] {
          "1.7" should (not fullyMatch regex ("1.8") and not fullyMatch regex (decimal))
        }
        assert(caught3.getMessage === "\"1.7\" did not fully match the regular expression 1.8, but \"1.7\" fully matched the regular expression (-)?(\\d+)(\\.\\d*)?")
      }

      it("should throw TestFailedException if the string fully matches the regular expression specified as a string when used in a logical-or expression used with not") {

        val caught1 = intercept[TestFailedException] {
          "1.7" should (not fullyMatch regex (decimal) or (not fullyMatch regex ("1.7")))
        }
        assert(caught1.getMessage === "\"1.7\" fully matched the regular expression (-)?(\\d+)(\\.\\d*)?, and \"1.7\" fully matched the regular expression 1.7")

        val caught2 = intercept[TestFailedException] {
          "1.7" should ((not fullyMatch regex (decimal)) or (not fullyMatch regex ("1.7")))
        }
        assert(caught2.getMessage === "\"1.7\" fully matched the regular expression (-)?(\\d+)(\\.\\d*)?, and \"1.7\" fully matched the regular expression 1.7")

        val caught3 = intercept[TestFailedException] {
          "1.7" should (not fullyMatch regex (decimal) or not fullyMatch regex ("1.7"))
        }
        assert(caught3.getMessage === "\"1.7\" fully matched the regular expression (-)?(\\d+)(\\.\\d*)?, and \"1.7\" fully matched the regular expression 1.7")

        val caught4 = intercept[TestFailedException] {
          "1.7" should (not (fullyMatch regex (decimal)) or not (fullyMatch regex ("1.7")))
        }
        assert(caught4.getMessage === "\"1.7\" fully matched the regular expression (-)?(\\d+)(\\.\\d*)?, and \"1.7\" fully matched the regular expression 1.7")
      }
    }

    describe("(when the regex is specified by an actual Regex)") {

      it("should do nothing if the string fully matches the regular expression specified as a string") {
        "1.7" should fullyMatch regex ("1.7")
        "1.7" should fullyMatch regex (decimalRegex)
        "-1.8" should fullyMatch regex (decimalRegex)
        "8" should fullyMatch regex (decimalRegex)
        "1." should fullyMatch regex (decimalRegex)
      }

      it("should do nothing if the string does not fully match the regular expression specified as a string when used with not") {

        "eight" should not { fullyMatch regex (decimalRegex) }
        "1.eight" should not { fullyMatch regex (decimalRegex) }
        "one.8" should not { fullyMatch regex (decimalRegex) }

        "eight" should not fullyMatch regex (decimalRegex)
        "1.eight" should not fullyMatch regex (decimalRegex)
        "one.8" should not fullyMatch regex (decimalRegex)
        "1.8-" should not fullyMatch regex (decimalRegex)
      }

      it("should do nothing if the string does not fully match the regular expression specified as a string when used in a logical-and expression") {
        "1.7" should (fullyMatch regex (decimalRegex) and (fullyMatch regex (decimalRegex)))
        "1.7" should ((fullyMatch regex (decimalRegex)) and (fullyMatch regex (decimalRegex)))
        "1.7" should (fullyMatch regex (decimalRegex) and fullyMatch regex (decimalRegex))
      }

      it("should do nothing if the string does not fully match the regular expression specified as a string when used in a logical-or expression") {
        "1.7" should (fullyMatch regex ("hello") or (fullyMatch regex (decimalRegex)))
        "1.7" should ((fullyMatch regex ("hello")) or (fullyMatch regex (decimalRegex)))
        "1.7" should (fullyMatch regex ("hello") or fullyMatch regex (decimalRegex))
      }

      it("should do nothing if the string does not fully match the regular expression specified as a string when used in a logical-and expression with not") {
        "fred" should (not (fullyMatch regex ("bob")) and not (fullyMatch regex (decimalRegex)))
        "fred" should ((not fullyMatch regex ("bob")) and (not fullyMatch regex (decimalRegex)))
        "fred" should (not fullyMatch regex ("bob") and not fullyMatch regex (decimalRegex))
      }

      it("should do nothing if the string does not fully match the regular expression specified as a string when used in a logical-or expression with not") {
        "fred" should (not (fullyMatch regex ("fred")) or not (fullyMatch regex (decimalRegex)))
        "fred" should ((not fullyMatch regex ("fred")) or (not fullyMatch regex (decimalRegex)))
        "fred" should (not fullyMatch regex ("fred") or not fullyMatch regex (decimalRegex))
      }

      it("should throw TestFailedException if the string does not match the regular expression specified as a string") {

        val caught1 = intercept[TestFailedException] {
          "1.7" should fullyMatch regex ("1.78")
        }
        assert(caught1.getMessage === "\"1.7\" did not fully match the regular expression 1.78")

        val caught2 = intercept[TestFailedException] {
          "1.7" should fullyMatch regex ("21.7")
        }
        assert(caught2.getMessage === "\"1.7\" did not fully match the regular expression 21.7")

        val caught3 = intercept[TestFailedException] {
          "-1.eight" should fullyMatch regex (decimalRegex)
        }
        assert(caught3.getMessage === "\"-1.eight\" did not fully match the regular expression (-)?(\\d+)(\\.\\d*)?")

        val caught6 = intercept[TestFailedException] {
          "eight" should fullyMatch regex (decimalRegex)
        }
        assert(caught6.getMessage === "\"eight\" did not fully match the regular expression (-)?(\\d+)(\\.\\d*)?")

        val caught7 = intercept[TestFailedException] {
          "1.eight" should fullyMatch regex (decimalRegex)
        }
        assert(caught7.getMessage === "\"1.eight\" did not fully match the regular expression (-)?(\\d+)(\\.\\d*)?")

        val caught8 = intercept[TestFailedException] {
          "one.8" should fullyMatch regex (decimalRegex)
        }
        assert(caught8.getMessage === "\"one.8\" did not fully match the regular expression (-)?(\\d+)(\\.\\d*)?")

        val caught9 = intercept[TestFailedException] {
          "1.8-" should fullyMatch regex (decimalRegex)
        }
        assert(caught9.getMessage === "\"1.8-\" did not fully match the regular expression (-)?(\\d+)(\\.\\d*)?")
      }

      it("should throw TestFailedException if the string does matches the regular expression specified as a string when used with not") {

        val caught1 = intercept[TestFailedException] {
          "1.7" should not { fullyMatch regex ("1.7") }
        }
        assert(caught1.getMessage === "\"1.7\" fully matched the regular expression 1.7")

        val caught2 = intercept[TestFailedException] {
          "1.7" should not { fullyMatch regex (decimalRegex) }
        }
        assert(caught2.getMessage === "\"1.7\" fully matched the regular expression (-)?(\\d+)(\\.\\d*)?")

        val caught3 = intercept[TestFailedException] {
          "-1.8" should not { fullyMatch regex (decimalRegex) }
        }
        assert(caught3.getMessage === "\"-1.8\" fully matched the regular expression (-)?(\\d+)(\\.\\d*)?")

        val caught4 = intercept[TestFailedException] {
          "8" should not { fullyMatch regex (decimalRegex) }
        }
        assert(caught4.getMessage === "\"8\" fully matched the regular expression (-)?(\\d+)(\\.\\d*)?")

        val caught5 = intercept[TestFailedException] {
          "1." should not { fullyMatch regex (decimalRegex) }
        }
        assert(caught5.getMessage === "\"1.\" fully matched the regular expression (-)?(\\d+)(\\.\\d*)?")

        val caught11 = intercept[TestFailedException] {
          "1.7" should not fullyMatch regex ("1.7")
        }
        assert(caught11.getMessage === "\"1.7\" fully matched the regular expression 1.7")

        val caught12 = intercept[TestFailedException] {
          "1.7" should not fullyMatch regex (decimalRegex)
        }
        assert(caught12.getMessage === "\"1.7\" fully matched the regular expression (-)?(\\d+)(\\.\\d*)?")

        val caught13 = intercept[TestFailedException] {
          "-1.8" should not fullyMatch regex (decimalRegex)
        }
        assert(caught13.getMessage === "\"-1.8\" fully matched the regular expression (-)?(\\d+)(\\.\\d*)?")

        val caught14 = intercept[TestFailedException] {
          "8" should not fullyMatch regex (decimalRegex)
        }
        assert(caught14.getMessage === "\"8\" fully matched the regular expression (-)?(\\d+)(\\.\\d*)?")

        val caught15 = intercept[TestFailedException] {
          "1." should not fullyMatch regex (decimalRegex)
        }
        assert(caught15.getMessage === "\"1.\" fully matched the regular expression (-)?(\\d+)(\\.\\d*)?")
      }

      it("should throw TestFailedException if the string fully matches the regular expression specified as a string when used in a logical-and expression") {

        val caught1 = intercept[TestFailedException] {
          "1.7" should (fullyMatch regex (decimalRegex) and (fullyMatch regex ("1.8")))
        }
        assert(caught1.getMessage === "\"1.7\" fully matched the regular expression (-)?(\\d+)(\\.\\d*)?, but \"1.7\" did not fully match the regular expression 1.8")

        val caught2 = intercept[TestFailedException] {
          "1.7" should ((fullyMatch regex (decimalRegex)) and (fullyMatch regex ("1.8")))
        }
        assert(caught2.getMessage === "\"1.7\" fully matched the regular expression (-)?(\\d+)(\\.\\d*)?, but \"1.7\" did not fully match the regular expression 1.8")

        val caught3 = intercept[TestFailedException] {
          "1.7" should (fullyMatch regex (decimalRegex) and fullyMatch regex ("1.8"))
        }
        assert(caught3.getMessage === "\"1.7\" fully matched the regular expression (-)?(\\d+)(\\.\\d*)?, but \"1.7\" did not fully match the regular expression 1.8")

        // Check to make sure the error message "short circuits" (i.e., just reports the left side's failure)
        val caught4 = intercept[TestFailedException] {
          "1.eight" should (fullyMatch regex (decimalRegex) and (fullyMatch regex ("1.8")))
        }
        assert(caught4.getMessage === "\"1.eight\" did not fully match the regular expression (-)?(\\d+)(\\.\\d*)?")

        val caught5 = intercept[TestFailedException] {
          "1.eight" should ((fullyMatch regex (decimalRegex)) and (fullyMatch regex ("1.8")))
        }
        assert(caught5.getMessage === "\"1.eight\" did not fully match the regular expression (-)?(\\d+)(\\.\\d*)?")

        val caught6 = intercept[TestFailedException] {
          "1.eight" should (fullyMatch regex (decimalRegex) and fullyMatch regex ("1.8"))
        }
        assert(caught6.getMessage === "\"1.eight\" did not fully match the regular expression (-)?(\\d+)(\\.\\d*)?")
      }

      it("should throw TestFailedException if the string fully matches the regular expression specified as a string when used in a logical-or expression") {

        val caught1 = intercept[TestFailedException] {
          "1.seven" should (fullyMatch regex (decimalRegex) or (fullyMatch regex ("1.8")))
        }
        assert(caught1.getMessage === "\"1.seven\" did not fully match the regular expression (-)?(\\d+)(\\.\\d*)?, and \"1.seven\" did not fully match the regular expression 1.8")

        val caught2 = intercept[TestFailedException] {
          "1.seven" should ((fullyMatch regex (decimalRegex)) or (fullyMatch regex ("1.8")))
        }
        assert(caught2.getMessage === "\"1.seven\" did not fully match the regular expression (-)?(\\d+)(\\.\\d*)?, and \"1.seven\" did not fully match the regular expression 1.8")

        val caught3 = intercept[TestFailedException] {
          "1.seven" should (fullyMatch regex (decimalRegex) or fullyMatch regex ("1.8"))
        }
        assert(caught3.getMessage === "\"1.seven\" did not fully match the regular expression (-)?(\\d+)(\\.\\d*)?, and \"1.seven\" did not fully match the regular expression 1.8")
      }

      it("should throw TestFailedException if the string fully matches the regular expression specified as a string when used in a logical-and expression used with not") {

        val caught1 = intercept[TestFailedException] {
          "1.7" should (not fullyMatch regex ("1.8") and (not fullyMatch regex (decimalRegex)))
        }
        assert(caught1.getMessage === "\"1.7\" did not fully match the regular expression 1.8, but \"1.7\" fully matched the regular expression (-)?(\\d+)(\\.\\d*)?")

        val caught2 = intercept[TestFailedException] {
          "1.7" should ((not fullyMatch regex ("1.8")) and (not fullyMatch regex (decimalRegex)))
        }
        assert(caught2.getMessage === "\"1.7\" did not fully match the regular expression 1.8, but \"1.7\" fully matched the regular expression (-)?(\\d+)(\\.\\d*)?")

        val caught3 = intercept[TestFailedException] {
          "1.7" should (not fullyMatch regex ("1.8") and not fullyMatch regex (decimalRegex))
        }
        assert(caught3.getMessage === "\"1.7\" did not fully match the regular expression 1.8, but \"1.7\" fully matched the regular expression (-)?(\\d+)(\\.\\d*)?")
      }

      it("should throw TestFailedException if the string fully matches the regular expression specified as a string when used in a logical-or expression used with not") {

        val caught1 = intercept[TestFailedException] {
          "1.7" should (not fullyMatch regex (decimalRegex) or (not fullyMatch regex ("1.7")))
        }
        assert(caught1.getMessage === "\"1.7\" fully matched the regular expression (-)?(\\d+)(\\.\\d*)?, and \"1.7\" fully matched the regular expression 1.7")

        val caught2 = intercept[TestFailedException] {
          "1.7" should ((not fullyMatch regex (decimalRegex)) or (not fullyMatch regex ("1.7")))
        }
        assert(caught2.getMessage === "\"1.7\" fully matched the regular expression (-)?(\\d+)(\\.\\d*)?, and \"1.7\" fully matched the regular expression 1.7")

        val caught3 = intercept[TestFailedException] {
          "1.7" should (not fullyMatch regex (decimalRegex) or not fullyMatch regex ("1.7"))
        }
        assert(caught3.getMessage === "\"1.7\" fully matched the regular expression (-)?(\\d+)(\\.\\d*)?, and \"1.7\" fully matched the regular expression 1.7")

        val caught4 = intercept[TestFailedException] {
          "1.7" should (not (fullyMatch regex (decimalRegex)) or not (fullyMatch regex ("1.7")))
        }
        assert(caught4.getMessage === "\"1.7\" fully matched the regular expression (-)?(\\d+)(\\.\\d*)?, and \"1.7\" fully matched the regular expression 1.7")
      }
    }
  }
}


text:
// +build !experimental

package shim

import (
	"github.com/golang/protobuf/ptypes/timestamp"

	"github.com/hyperledger/fabric/protos/ledger/queryresult"
	pb "github.com/hyperledger/fabric/protos/peer"
)

// Chaincode interface must be implemented by all chaincodes. The fabric runs
// the transactions by calling these functions as specified.
type Chaincode interface {
	// Init is called during Instantiate transaction after the chaincode container
	// has been established for the first time, allowing the chaincode to
	// initialize its internal data
	Init(stub ChaincodeStubInterface) pb.Response

	// Invoke is called to update or query the ledger in a proposal transaction.
	// Updated state variables are not committed to the ledger until the
	// transaction is committed.
	Invoke(stub ChaincodeStubInterface) pb.Response
}

// ChaincodeStubInterface is used by deployable chaincode apps to access and
// modify their ledgers
type ChaincodeStubInterface interface {
	// GetArgs returns the arguments intended for the chaincode Init and Invoke
	// as an array of byte arrays.
	GetArgs() [][]byte

	// GetStringArgs returns the arguments intended for the chaincode Init and
	// Invoke as a string array. Only use GetStringArgs if the client passes
	// arguments intended to be used as strings.
	GetStringArgs() []string

	// GetFunctionAndParameters returns the first argument as the function
	// name and the rest of the arguments as parameters in a string array.
	// Only use GetFunctionAndParameters if the client passes arguments intended
	// to be used as strings.
	GetFunctionAndParameters() (string, []string)

	// GetArgsSlice returns the arguments intended for the chaincode Init and
	// Invoke as a byte array
	GetArgsSlice() ([]byte, error)

	// GetTxID returns the tx_id of the transaction proposal (see ChannelHeader
	// in protos/common/common.proto)
	GetTxID() string

	// InvokeChaincode locally calls the specified chaincode `Invoke` using the
	// same transaction context; that is, chaincode calling chaincode doesn't
	// create a new transaction message.
	// If the called chaincode is on the same channel, it simply adds the called
	// chaincode read set and write set to the calling transaction.
	// If the called chaincode is on a different channel,
	// only the Response is returned to the calling chaincode; any PutState calls
	// from the called chaincode will not have any effect on the ledger; that is,
	// the called chaincode on a different channel will not have its read set
	// and write set applied to the transaction. Only the calling chaincode's
	// read set and write set will be applied to the transaction. Effectively
	// the called chaincode on a different channel is a `Query`, which does not
	// participate in state validation checks in subsequent commit phase.
	// If `channel` is empty, the caller's channel is assumed.
	InvokeChaincode(chaincodeName string, args [][]byte, channel string) pb.Response

	// GetState returns the value of the specified `key` from the
	// ledger. Note that GetState doesn't read data from the writeset, which
	// has not been committed to the ledger. In other words, GetState doesn't
	// consider data modified by PutState that has not been committed.
	// If the key does not exist in the state database, (nil, nil) is returned.
	GetState(key string) ([]byte, error)

	// PutState puts the specified `key` and `value` into the transaction's
	// writeset as a data-write proposal. PutState doesn't effect the ledger
	// until the transaction is validated and successfully committed.
	// Simple keys must not be an empty string and must not start with null
	// character (0x00), in order to avoid range query collisions with
	// composite keys, which internally get prefixed with 0x00 as composite
	// key namespace.
	PutState(key string, value []byte) error

	// DelState records the specified `key` to be deleted in the writeset of
	// the transaction proposal. The `key` and its value will be deleted from
	// the ledger when the transaction is validated and successfully committed.
	DelState(key string) error

	// GetStateByRange returns a range iterator over a set of keys in the
	// ledger. The iterator can be used to iterate over all keys
	// between the startKey (inclusive) and endKey (exclusive).
	// The keys are returned by the iterator in lexical order. Note
	// that startKey and endKey can be empty string, which implies unbounded range
	// query on start or end.
	// Call Close() on the returned StateQueryIteratorInterface object when done.
	// The query is re-executed during validation phase to ensure result set
	// has not changed since transaction endorsement (phantom reads detected).
	GetStateByRange(startKey, endKey string) (StateQueryIteratorInterface, error)

	// GetStateByPartialCompositeKey queries the state in the ledger based on
	// a given partial composite key. This function returns an iterator
	// which can be used to iterate over all composite keys whose prefix matches
	// the given partial composite key. The `objectType` and attributes are
	// expected to have only valid utf8 strings and should not contain
	// U+0000 (nil byte) and U+10FFFF (biggest and unallocated code point).
	// See related functions SplitCompositeKey and CreateCompositeKey.
	// Call Close() on the returned StateQueryIteratorInterface object when done.
	// The query is re-executed during validation phase to ensure result set
	// has not changed since transaction endorsement (phantom reads detected).
	GetStateByPartialCompositeKey(objectType string, keys []string) (StateQueryIteratorInterface, error)

	// CreateCompositeKey combines the given `attributes` to form a composite
	// key. The objectType and attributes are expected to have only valid utf8
	// strings and should not contain U+0000 (nil byte) and U+10FFFF
	// (biggest and unallocated code point).
	// The resulting composite key can be used as the key in PutState().
	CreateCompositeKey(objectType string, attributes []string) (string, error)

	// SplitCompositeKey splits the specified key into attributes on which the
	// composite key was formed. Composite keys found during range queries
	// or partial composite key queries can therefore be split into their
	// composite parts.
	SplitCompositeKey(compositeKey string) (string, []string, error)

	// GetQueryResult performs a "rich" query against a state database. It is
	// only supported for state databases that support rich query,
	// e.g.CouchDB. The query string is in the native syntax
	// of the underlying state database. An iterator is returned
	// which can be used to iterate (next) over the query result set.
	// The query is NOT re-executed during validation phase, phantom reads are
	// not detected. That is, other committed transactions may have added,
	// updated, or removed keys that impact the result set, and this would not
	// be detected at validation/commit time.  Applications susceptible to this
	// should therefore not use GetQueryResult as part of transactions that update
	// ledger, and should limit use to read-only chaincode operations.
	GetQueryResult(query string) (StateQueryIteratorInterface, error)

	// GetHistoryForKey returns a history of key values across time.
	// For each historic key update, the historic value and associated
	// transaction id and timestamp are returned. The timestamp is the
	// timestamp provided by the client in the proposal header.
	// GetHistoryForKey requires peer configuration
	// core.ledger.history.enableHistoryDatabase to be true.
	// The query is NOT re-executed during validation phase, phantom reads are
	// not detected. That is, other committed transactions may have updated
	// the key concurrently, impacting the result set, and this would not be
	// detected at validation/commit time. Applications susceptible to this
	// should therefore not use GetHistoryForKey as part of transactions that
	// update ledger, and should limit use to read-only chaincode operations.
	GetHistoryForKey(key string) (HistoryQueryIteratorInterface, error)

	// GetCreator returns `SignatureHeader.Creator` (e.g. an identity)
	// of the `SignedProposal`. This is the identity of the agent (or user)
	// submitting the transaction.
	GetCreator() ([]byte, error)

	// GetTransient returns the `ChaincodeProposalPayload.Transient` field.
	// It is a map that contains data (e.g. cryptographic material)
	// that might be used to implement some form of application-level
	// confidentiality. The contents of this field, as prescribed by
	// `ChaincodeProposalPayload`, are supposed to always
	// be omitted from the transaction and excluded from the ledger.
	GetTransient() (map[string][]byte, error)

	// GetBinding returns the transaction binding
	GetBinding() ([]byte, error)

	// GetDecorations returns additional data (if applicable)
	// about the proposal that originated from the peer
	GetDecorations() map[string][]byte

	// GetSignedProposal returns the SignedProposal object, which contains all
	// data elements part of a transaction proposal.
	GetSignedProposal() (*pb.SignedProposal, error)

	// GetTxTimestamp returns the timestamp when the transaction was created. This
	// is taken from the transaction ChannelHeader, therefore it will indicate the
	// client's timestamp, and will have the same value across all endorsers.
	GetTxTimestamp() (*timestamp.Timestamp, error)

	// SetEvent allows the chaincode to propose an event on the transaction
	// proposal. If the transaction is validated and successfully committed,
	// the event will be delivered to the current event listeners.
	SetEvent(name string, payload []byte) error
}

// CommonIteratorInterface allows a chaincode to check whether any more result
// to be fetched from an iterator and close it when done.
type CommonIteratorInterface interface {
	// HasNext returns true if the range query iterator contains additional keys
	// and values.
	HasNext() bool

	// Close closes the iterator. This should be called when done
	// reading from the iterator to free up resources.
	Close() error
}

// StateQueryIteratorInterface allows a chaincode to iterate over a set of
// key/value pairs returned by range and execute query.
type StateQueryIteratorInterface interface {
	// Inherit HasNext() and Close()
	CommonIteratorInterface

	// Next returns the next key and value in the range and execute query iterator.
	Next() (*queryresult.KV, error)
}

// HistoryQueryIteratorInterface allows a chaincode to iterate over a set of
// key/value pairs returned by a history query.
type HistoryQueryIteratorInterface interface {
	// Inherit HasNext() and Close()
	CommonIteratorInterface

	// Next returns the next key and value in the history query iterator.
	Next() (*queryresult.KeyModification, error)
}

// MockQueryIteratorInterface allows a chaincode to iterate over a set of
// key/value pairs returned by range query.
// TODO: Once the execute query and history query are implemented in MockStub,
// we need to update this interface
type MockQueryIteratorInterface interface {
	StateQueryIteratorInterface
}

redpajama_set_name: RedPajamaGithub


text: Delete this file dump all your GPX files in this folder.


text:
#ifndef BT_MULTIBODY_LINK_H
#define BT_MULTIBODY_LINK_H

#include "LinearMath/btQuaternion.h"
#include "LinearMath/btVector3.h"
#include "BulletCollision/CollisionDispatch/btCollisionObject.h"

enum	btMultiBodyLinkFlags
{
	BT_MULTIBODYLINKFLAGS_DISABLE_PARENT_COLLISION = 1
};

//both defines are now permanently enabled
#define BT_MULTIBODYLINK_INCLUDE_PLANAR_JOINTS
#define TEST_SPATIAL_ALGEBRA_LAYER

//
// Various spatial helper functions
//

//namespace {

#include "LinearMath/btSpatialAlgebra.h"

//}

//
// Link struct
//

struct btMultibodyLink
{

	BT_DECLARE_ALIGNED_ALLOCATOR();

    btScalar m_mass;         // mass of link
    btVector3 m_inertiaLocal;   // inertia of link (local frame; diagonal)

    int m_parent;         // index of the parent link (assumed to be < index of this link), or -1 if parent is the base link.

    btQuaternion m_zeroRotParentToThis;    // rotates vectors in parent-frame to vectors in local-frame (when q=0). constant.

    btVector3 m_dVector;   // vector from the inboard joint pos to this link's COM. (local frame.) constant.
	//this is set to zero for planar joint (see also m_eVector comment)

    // m_eVector is constant, but depends on the joint type:
    // revolute, fixed, prismatic, spherical: vector from parent's COM to the pivot point, in PARENT's frame.
	// planar: vector from COM of parent to COM of this link, WHEN Q = 0. (local frame.)
	// todo: fix the planar so it is consistent with the other joints

    btVector3 m_eVector;

	btSpatialMotionVector m_absFrameTotVelocity, m_absFrameLocVelocity;

	enum eFeatherstoneJointType
	{
		eRevolute = 0,
		ePrismatic = 1,
		eSpherical = 2,
		ePlanar = 3,
		eFixed = 4,
		eInvalid
	};

	// "axis" = spatial joint axis (Mirtich Defn 9 p104). (expressed in local frame.) constant.
    // for prismatic: m_axesTop[0] = zero;
    //                m_axesBottom[0] = unit vector along the joint axis.
    // for revolute: m_axesTop[0] = unit vector along the rotation axis (u);
    //               m_axesBottom[0] = u cross m_dVector (i.e. COM linear motion due to the rotation at the joint)
	//
	// for spherical: m_axesTop[0][1][2] (u1,u2,u3) form a 3x3 identity matrix (3 rotation axes)
	//				  m_axesBottom[0][1][2] cross u1,u2,u3 (i.e. COM linear motion due to the rotation at the joint)
	//
	// for planar: m_axesTop[0] = unit vector along the rotation axis (u); defines the plane of motion
	//			   m_axesTop[1][2] = zero
	//			   m_axesBottom[0] = zero
	//			   m_axesBottom[1][2] = unit vectors along the translational axes on that plane
	btSpatialMotionVector m_axes[6];
	void setAxisTop(int dof, const btVector3 &axis) { m_axes[dof].m_topVec = axis; }
	void setAxisBottom(int dof, const btVector3 &axis) { m_axes[dof].m_bottomVec = axis; }
	void setAxisTop(int dof, const btScalar &x, const btScalar &y, const btScalar &z) { m_axes[dof].m_topVec.setValue(x, y, z); }
	void setAxisBottom(int dof, const btScalar &x, const btScalar &y, const btScalar &z) { m_axes[dof].m_bottomVec.setValue(x, y, z); }
	const btVector3 & getAxisTop(int dof) const { return m_axes[dof].m_topVec; }
	const btVector3 & getAxisBottom(int dof) const { return m_axes[dof].m_bottomVec; }

	int m_dofOffset, m_cfgOffset;

    btQuaternion m_cachedRotParentToThis;   // rotates vectors in parent frame to vectors in local frame
    btVector3 m_cachedRVector;                // vector from COM of parent to COM of this link, in local frame.

    btVector3 m_appliedForce;    // In WORLD frame
    btVector3 m_appliedTorque;   // In WORLD frame

btVector3 m_appliedConstraintForce;    // In WORLD frame
    btVector3 m_appliedConstraintTorque;   // In WORLD frame

	btScalar m_jointPos[7];

    //m_jointTorque is the joint torque applied by the user using 'addJointTorque'.
    //It gets set to zero after each internal stepSimulation call
	btScalar m_jointTorque[6];

	class btMultiBodyLinkCollider* m_collider;
	int m_flags;

	int m_dofCount, m_posVarCount;				//redundant but handy

	eFeatherstoneJointType m_jointType;

	struct btMultiBodyJointFeedback*	m_jointFeedback;

	btTransform	m_cachedWorldTransform;//this cache is updated when calling btMultiBody::forwardKinematics

	const char* m_linkName;//m_linkName memory needs to be managed by the developer/user!
	const char* m_jointName;//m_jointName memory needs to be managed by the developer/user!

    // ctor: set some sensible defaults
	btMultibodyLink()
		: 	m_mass(1),
			m_parent(-1),
			m_zeroRotParentToThis(0, 0, 0, 1),
			m_cachedRotParentToThis(0, 0, 0, 1),
			m_collider(0),
			m_flags(0),
			m_dofCount(0),
			m_posVarCount(0),
			m_jointType(btMultibodyLink::eInvalid),
			m_jointFeedback(0),
			m_linkName(0),
			m_jointName(0)
	{

		m_inertiaLocal.setValue(1, 1, 1);
		setAxisTop(0, 0., 0., 0.);
		setAxisBottom(0, 1., 0., 0.);
		m_dVector.setValue(0, 0, 0);
		m_eVector.setValue(0, 0, 0);
		m_cachedRVector.setValue(0, 0, 0);
		m_appliedForce.setValue( 0, 0, 0);
		m_appliedTorque.setValue(0, 0, 0);
		//
		m_jointPos[0] = m_jointPos[1] = m_jointPos[2] = m_jointPos[4] = m_jointPos[5] = m_jointPos[6] = 0.f;
		m_jointPos[3] = 1.f;			//"quat.w"
		m_jointTorque[0] = m_jointTorque[1] = m_jointTorque[2] = m_jointTorque[3] = m_jointTorque[4] = m_jointTorque[5] = 0.f;
		m_cachedWorldTransform.setIdentity();
	}

    // routine to update m_cachedRotParentToThis and m_cachedRVector
	void updateCacheMultiDof(btScalar *pq = 0)
	{
		btScalar *pJointPos = (pq ? pq : &m_jointPos[0]);

		switch(m_jointType)
		{
			case eRevolute:
			{
				m_cachedRotParentToThis = btQuaternion(getAxisTop(0),-pJointPos[0]) * m_zeroRotParentToThis;
				m_cachedRVector = m_dVector + quatRotate(m_cachedRotParentToThis,m_eVector);

				break;
			}
			case ePrismatic:
			{
				// m_cachedRotParentToThis never changes, so no need to update
				m_cachedRVector = m_dVector + quatRotate(m_cachedRotParentToThis,m_eVector) + pJointPos[0] * getAxisBottom(0);

				break;
			}
			case eSpherical:
			{
				m_cachedRotParentToThis = btQuaternion(pJointPos[0], pJointPos[1], pJointPos[2], -pJointPos[3]) * m_zeroRotParentToThis;
				m_cachedRVector = m_dVector + quatRotate(m_cachedRotParentToThis,m_eVector);

				break;
			}
			case ePlanar:
			{
				m_cachedRotParentToThis = btQuaternion(getAxisTop(0),-pJointPos[0]) * m_zeroRotParentToThis;
				m_cachedRVector = quatRotate(btQuaternion(getAxisTop(0),-pJointPos[0]), pJointPos[1] * getAxisBottom(1) + pJointPos[2] * getAxisBottom(2)) + quatRotate(m_cachedRotParentToThis,m_eVector);

				break;
			}
			case eFixed:
			{
				m_cachedRotParentToThis = m_zeroRotParentToThis;
				m_cachedRVector = m_dVector + quatRotate(m_cachedRotParentToThis,m_eVector);

				break;
			}
			default:
			{
				//invalid type
				btAssert(0);
			}
		}
	}
};

#endif //BT_MULTIBODY_LINK_H


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Application.Services.Dtos;
using Application.Services.Validation.Dtos;
using Application.Services.Validation.Interfaces;
using Infrastructure.Data.Interfaces;

namespace Application.Services.Validation
{
    public class MovementValidationSvc: BaseValidationSvc, IMovementValidationSvc
    {
        public ValidationResult ValidateForCreating(CreateMovementDto createMovementDto)
        {
            var result = new ValidationResult();
            if (!createMovementDto.TagNames.Any())
            {
                result.Errors.Add("TagNames", "Cannot be empty");
            }

            return result;
        }
    }
}


text:
define(['lodash', 'log'], function (_, log) {

    var CommonUtils = function () {
    };

    /**
     * Generates a unique id for an attribute by checking against a list of parents.
     *
     * @param {Object} genArgs - Arguments for creating an object.
     * @param {ASTNode} genArgs.node - The AST node of which the attribute belongs to.
     * @param {Object[]} genArgs.attributes[] - The list of attributes to which the unique ID to be generated.
     * @param {string} genArgs.attributes[].defaultValue - The default value for the attribute.
     * @param {function} genArgs.attributes[].setter - The setter function of the attribute.
     * @param {function} genArgs.attributes[].getter - The getter function of the attribute.
     * @param {Object[]} genArgs.attributes[].parents[] - The list of parents to traverse through to generate a unique
     * ID.
     * @param {ASTNode} genArgs.attributes[].parents[].node - The AST node of the parent.
     * @param {function} genArgs.attributes[].parents[].getChildrenFunc - The getter function to get the children of a
     * parent node.
     * @param {function} genArgs.attributes[].parents[].getter - The getter function which returns the identifier of the
     * children returned from getChildrenFunc.
     */
    CommonUtils.generateUniqueIdentifier = function (genArgs) {
        _.forEach(genArgs.attributes, function (attribute) {
            if (_.isNil(attribute.getter.call(genArgs.node)) || attribute.checkEvenIfDefined) {
                // To store all the identifiers of the parents.
                var existingIdentifiers = [];

                _.forEach(attribute.parents, function (parent) {
                    log.debug("Children: " + parent.getChildrenFunc.call(parent.node));
                    // Get the children of the parent.
                    _.forEach(parent.getChildrenFunc.call(parent.node), function (child) {
                        // Skipping the current node.
                        if (!_.isEqual(genArgs.node.getID(), child.getID())) {
                            var childVal = parent.getter.call(child);
                            existingIdentifiers.push(childVal);
                        }
                    });
                });

                log.debug("Existing identifiers: " + existingIdentifiers);

                // Generating the ID.
                var counter = 0;
                var currentAttributeValue = attribute.defaultValue;
                while (true) {
                    var tempNewValue = counter > 0 ? currentAttributeValue + counter : currentAttributeValue;
                    if (!_.includes(existingIdentifiers, tempNewValue)) {
                        break;
                    }
                    counter++
                }

                if (_.isEqual(counter, 0)) {
                    attribute.setter.call(genArgs.node, currentAttributeValue);
                } else {
                    attribute.setter.call(genArgs.node, currentAttributeValue + counter);
                }
            }
        })
    };

    return CommonUtils;
});


text:
var assert = require('chai').assert;
var expect = require('chai').expect;

var Node = require('../lib/node');
var SinglyLinkedList = require('../lib/singly-linked-list');

var list = new SinglyLinkedList();

//TODO: Add more test for edge cases i.e empty list

describe('SinglyLinkedList', function(){

	describe('#isEmpty()', function(){
		it('should tell whether the list is empty', function(){
			assert.strictEqual(true, list.isEmpty(), 'Current list is empty');
		});
	});

	describe('#addFirst()', function(){
		it('should add the item to list', function(){
			list.addFirst(5);
			assert.strictEqual(5, list.getFirst().getValue(), 'Value of first item is 5');
			assert.strictEqual(5, list.getLast().getValue(), 'Value of last item is 5');
			assert.strictEqual(1, list.getSize(), 'List has size 1');
		});
	});

	describe('#getFirst()', function(){
		it('should get the first item of the list', function(){
			list.addFirst(6);
			assert.strictEqual(6, list.getFirst().getValue(), 'Value of first item is 6');
		});
	});

	describe('#getLast()', function(){
		it('should get the last item of the list', function(){
			assert.strictEqual(5, list.getLast().getValue(), 'Value of last item is 5');
		});
	});

	describe('#getSize()', function(){
		it('should return the size of the list', function(){
			list.addFirst(7);
			assert.strictEqual(3, list.getSize(), 'List has size 3');
			list.addFirst(8);
			assert.strictEqual(4, list.getSize(), 'List has size 4');
		});
	});

	describe('#removeFirst()', function(){
		it('should remove first element of the list', function(){
			assert.deepEqual([8,7,6,5], list.toArray(), 'List equals to [8,7,6,5]');
			list.removeFirst();
			assert.deepEqual([7,6,5], list.toArray(), 'List equals to [7,6,5]');
		});
	});

	describe('#addLast()', function(){

		it('should successfully add item to an empty list', function(){
			var emptyList = new SinglyLinkedList();
			emptyList.addLast(1);
			assert.deepEqual([1], emptyList.toArray(), 'List equals to [1]');
			emptyList.addLast(2);
			assert.deepEqual([1,2], emptyList.toArray(), 'List equals to [1,2]');
		});

		it('should add the item to the end of the list', function(){
			assert.deepEqual([7,6,5], list.toArray(), 'List equals to [7,6,5]');
			list.addLast(4);
			assert.deepEqual([7,6,5,4], list.toArray(), 'List equals to [7,6,5,4]');
			assert.strictEqual(4, list.getLast().getValue(), 'Value of last item is 4');
		});
	});

	describe('#removeLast()', function(){
		it('should remove last element of the list', function(){
			list.removeLast();
			assert.deepEqual([7,6,5], list.toArray(), 'List equals to [7,6,5]');
			assert.strictEqual(5, list.getLast().getValue(), 'Value of last item is 5');
			list.removeLast();
			assert.deepEqual([7,6], list.toArray(), 'List equals to [7,6]');
			list.removeLast();
			assert.deepEqual([7], list.toArray(), 'List equals to [7]');
			list.removeLast();
			assert.deepEqual([], list.toArray(), 'List is empty');
			expect(function(){
				list.removeLast();
			}).to.throw(Error,/Can not remove from empty list/);
		});
	});

});


text:
Question Types

How to answer the different types of questions you might see on an exam.

There are five main types of questions you may be asked on the algebra EOC exam:

-Multiple choice questions provide a number of possible answers, and you must select the correct one.

-Fill in the blank questions require you to solve a problem on your own, and put the correct answer(s) in the text box(es).

-Multiple select questions provide a number of possibles answers, and you must select which ones are correct.


text:
<?php

class AddressController extends AddressControllerCore
{

}


text:
package ru.job4j.settask.simarrset;

/*
 * Class SimArrSet realize Set with array.
 * @author Nikolai Matveev
 * @since 13.02.2018
 * @version 0.1
 */

import net.jcip.annotations.GuardedBy;
import net.jcip.annotations.ThreadSafe;
import ru.job4j.listtask.simarr.SimArr;

import java.util.Iterator;
@ThreadSafe
public class SimArrSet<T> implements Iterable<T> {
    @GuardedBy("array")
    private SimArr<T> array = new SimArr<>();

    public SimArrSet() {
    }

    public synchronized void add(T ob) {
        if(!array.contains(ob)) {
            array.add(ob);
        }
    }

    @Override
    public Iterator<T> iterator() {
        return array.iterator();
    }
}


text:
TwitchEmote4Facebook
====================

adds the Twitch emotes to the facebook chat

## TODO

Pretty much everything, but if you want Kappa in Facebook, well you got it!


text:
using ProtoBuf;

namespace Model
{
    [ProtoContract]
    public class UserMission
    {
        [ProtoMember(1)] public int State { get; internal set; }
        [ProtoMember(2)] public int Progress { get; internal set; }
    }
}


text:
using System;

namespace Azure.Communication.Administration.Models
{
    /// <summary> Definition for number configuration. </summary>
    public partial class NumberConfigurationResponse
    {
        /// <summary> Initializes a new instance of NumberConfigurationResponse. </summary>
        /// <param name="pstnConfiguration"> Definition for pstn number configuration. </param>
        /// <exception cref="ArgumentNullException"> <paramref name="pstnConfiguration"/> is null. </exception>
        internal NumberConfigurationResponse(PstnConfiguration pstnConfiguration)
        {
            if (pstnConfiguration == null)
            {
                throw new ArgumentNullException(nameof(pstnConfiguration));
            }

            PstnConfiguration = pstnConfiguration;
        }

        /// <summary> Definition for pstn number configuration. </summary>
        public PstnConfiguration PstnConfiguration { get; }
    }
}


text:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<title>DefaultChannelImplManager</title>
<meta name="date" content="2014-02-14">
<link rel="stylesheet" type="text/css" href="../../../stylesheet.css" title="Style">

JavaScript is disabled on your browser.

Overview

Package

Class

Use

Tree

Deprecated

Index

Help

Prev Class

Next Class

Frames

No Frames

All Classes

Summary:

Nested |

Field |

Constr |

Method

Detail:

Field |

Constr |

Method

linkjvm.low.vision

Class DefaultChannelImplManager

java.lang.Object

linkjvm.low.vision.ChannelImplManager

linkjvm.low.vision.DefaultChannelImplManager

public class DefaultChannelImplManager
extends ChannelImplManager

Constructor Summary

Constructors

Constructor and Description

DefaultChannelImplManager()

Method Summary

Methods

Modifier and Type
Method and Description

ChannelImpl
channelImpl(java.lang.String name)

void
delete()

void
setImage(SWIGTYPE_p_cv__Mat image)

Methods inherited from class java.lang.Object

equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Constructor Detail

DefaultChannelImplManager

public DefaultChannelImplManager()

Method Detail

delete

public void delete()

Overrides:

delete in class ChannelImplManager

setImage

public void setImage(SWIGTYPE_p_cv__Mat image)

Overrides:

setImage in class ChannelImplManager

channelImpl

public ChannelImpl channelImpl(java.lang.String name)

Overrides:

channelImpl in class ChannelImplManager

Overview

Package

Class

Use

Tree

Deprecated

Index

Help

Prev Class

Next Class

Frames

No Frames

All Classes

Summary:

Nested |

Field |

Constr |

Method

Detail:

Field |

Constr |

Method


text:
/* TypoPRO Fira Sans Condensed ExtraLight Italic */
@font-face {
    font-family:  'TypoPRO Fira Sans Condensed 250';
    src:          url('TypoPRO-FiraSansCondensed-ExtraLightItalic.eot');
    src:          local('*'),
                  url('TypoPRO-FiraSansCondensed-ExtraLightItalic.eot?#iefix') format('embedded-opentype'),
                  url('TypoPRO-FiraSansCondensed-ExtraLightItalic.woff') format('woff'),
                  url('TypoPRO-FiraSansCondensed-ExtraLightItalic.ttf') format('truetype');
    font-style:   italic;
    font-weight:  normal;
    font-stretch: condensed;
    font-variant: normal;
}


text:
CONDA_PACKAGES = openocd dfu-util
PYTHON_PACKAGES = pyusb pycodestyle autopep8 setuptools-pep8
include conda.mk

# pypi upload
test-upload:
	python3 setup.py register -r pypitest
	python3 setup.py sdist upload -r pypitest

upload:
	python3 setup.py register -r pypi
	python3 setup.py sdist upload -r pypi

.PHONY: test-upload upload

# Unbind helper - needs to be setuid
bin/unbind-helper:
	@echo "Making setuid unbind helper program."
	gcc -Wall -std=c99 unbind-helper.c -o $@
	sudo chmod 755 $@
	sudo chown root:root $@
	sudo chmod u+s $@
	ls -l $@

unbind-helper:
	@make check-unbind-helper || make bin/unbind-helper

check-unbind-helper:
	@[ -e bin/unbind-helper ]
	@[ "$$(stat -c "%a %U" bin/unbind-helper)" = "4755 root" ]

clean-unbind-helper:
	if [ -e bin/unbind-helper ]; then sudo rm bin/unbind-helper; fi

.PHONY: unbind-helper check-unbind-helper clean-unbind-helper

# Useful python targets
version:
	python3 setup.py version

check:
	pycodestyle hdmi2usb --ignore=E402 --ignore=W503
	pycodestyle *.py

fix:
	autopep8 -v -r -i -a -a hdmi2usb

test:
	python3 -m "hdmi2usb.modeswitch.tests"
	python3 hdmi2usb/modeswitch/files.py hdmi2usb/firmware/spartan6/atlys/bscan_spi_xc6slx45.bit
	python3 setup.py test

root-test:
	sudo make test

# ???
read-dna:
	./hdmi2usb-mode-switch.py --verbose --mode=jtag
	which openocd
	openocd --file board/numato_opsis.cfg -c "init; xc6s_print_dna xc6s.tap; exit"

update-usb-ids:
	rm USB-IDs.md
	wget https://raw.githubusercontent.com/wiki/timvideos/HDMI2USB/USB-IDs.md -O USB-IDs.md
	git add USB-IDs.md
	git commit -m "Updating the USB-IDs.md file"

# Global rules
clean:
	make clean-conda
	make clean-unbind-helper
	git clean -d -x -f

install-deps:
	apt-get install posh

setup:
	if ! make check-conda; then \
		make -s conda; \
	fi
	if ! make check-unbind-helper; then \
		make -s unbind-helper; \
	fi
	@make --quiet config

config:
	@echo ""
	@echo "Set your path with;"
	@echo " export PATH=$(PWD)/bin:$(PWD)/conda/bin:\$$PATH"
	@echo ""

all:
	@echo "Checking setup...."
	@make --quiet setup
	@echo
	@echo "Running code checks...."
	@make --quiet check
	@echo
	@echo "Running tests...."
	@make --quiet test
	@echo
	@echo "Printing version info...."
	@make --quiet version
	@echo
	@make --quiet config

.PHONY: bin/unbind-helper
.DEFAULT_GOAL := all


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

import static com.amazonaws.util.StringUtils.UTF8;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.OutputStreamWriter;
import java.io.StringWriter;
import java.io.Writer;
import java.util.Map;
import java.util.List;

import com.amazonaws.AmazonClientException;
import com.amazonaws.services.devicefarm.model.*;
import com.amazonaws.transform.Marshaller;
import com.amazonaws.util.BinaryUtils;
import com.amazonaws.util.StringUtils;
import com.amazonaws.util.StringInputStream;
import com.amazonaws.util.json.*;

/**
 * ResolutionMarshaller
 */
public class ResolutionJsonMarshaller {

    /**
     * Marshall the given parameter object, and output to a JSONWriter
     */
    public void marshall(Resolution resolution, JSONWriter jsonWriter) {
        if (resolution == null) {
            throw new AmazonClientException(
                    "Invalid argument passed to marshall(...)");
        }

        try {
            jsonWriter.object();

            if (resolution.getWidth() != null) {
                jsonWriter.key("width").value(resolution.getWidth());
            }

            if (resolution.getHeight() != null) {
                jsonWriter.key("height").value(resolution.getHeight());
            }

            jsonWriter.endObject();
        } catch (Throwable t) {
            throw new AmazonClientException(
                    "Unable to marshall request to JSON: " + t.getMessage(), t);
        }
    }

    private static ResolutionJsonMarshaller instance;

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

}


text:
<?php
/**
 * Customize the output of menus for Foundation top bar
 *
 * @package TacticalWP
 * @since 1.0.0
 */

/**
 * Big thanks to Brett Mason (https://github.com/brettsmason) for the awesome walker
 */

if ( ! class_exists( 'TWP_Top_Bar_Walker' ) ) :
	class TWP_Top_Bar_Walker extends Walker_Nav_Menu {
		function start_lvl( &$output, $depth = 0, $args = array() ) {
			$indent = str_repeat("\t", $depth);
			$output .= "\n$indent<ul class=\"dropdown menu vertical\" data-toggle>\n";
		}
	}
endif;


text:
package org.springside.examples.showcase.cache;

import static org.junit.Assert.*;

import java.util.Map;

import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springside.modules.memcached.SpyMemcachedClient;
import org.springside.modules.test.spring.SpringContextTestCase;

@ContextConfiguration(locations = { "/cache/applicationContext-memcached.xml" })
public class MemcachedDemo extends SpringContextTestCase {

	@Autowired
	private SpyMemcachedClient spyMemcachedClient;

	@Test
	public void normal() {

		String key = "consumer:1";
		String value = "admin";

		spyMemcachedClient.set(key, 60 * 60 * 1, value);
		String result = spyMemcachedClient.get(key);
		assertEquals(value, result);

		spyMemcachedClient.delete(key);
		result = spyMemcachedClient.get(key);
		assertNull(result);
	}

	@Test
	public void getBulk() {

		String key1 = "consumer:1";
		String value1 = "admin";

		String key2 = "consumer:2";
		String value2 = "calvin";

		String key3 = "invalidKey";

		spyMemcachedClient.set(key1, 60 * 60 * 1, value1);
		spyMemcachedClient.set(key2, 60 * 60 * 1, value2);

		Map<String, String> result = spyMemcachedClient.getBulk(key1, key2);
		assertEquals(value1, result.get(key1));
		assertEquals(value2, result.get(key2));
		assertNull(result.get(key3));
	}

	@Test
	public void incr() {
		String key = "incr_key";

		//注意,incr返回的数值使用long表达
		long result = spyMemcachedClient.incr(key, 2, 1);
		assertEquals(1, result);
		//注意,get返回的数值使用字符串表达
		assertEquals("1", spyMemcachedClient.get(key));

		result = spyMemcachedClient.incr(key, 2, 1);
		assertEquals(3, result);
		assertEquals("3", spyMemcachedClient.get(key));

		key = "set_and_incr_key";
		//注意,set中的数值必须使用字符串,后面的incr操作结果才会正确.
		spyMemcachedClient.set(key, 60 * 60 * 1, "1");
		result = spyMemcachedClient.incr(key, 2, 1);
		assertEquals(3, result);
	}
}


text:
Triangle = Thing.clone().newSlots({
	protoType: "Triangle"
}).setSlots({
	init: function()
	{
		Thing.init.apply(this)
		this.setup()
	},

	setup: function()
	{
		var geometry = new THREE.CircleGeometry(.6, 3);

		var material = new THREE.MeshLambertMaterial(
			{
				//color: new THREE.Color().setRGB(0,0,0),
				color: Palettes.current().foreground(),
				wireframe: false,
				wireframeLinewidth: 36,
				opacity: 1,
				transparent: true
			} );

	    this._object = new THREE.Mesh(geometry, material);
	},

/*
	update: function()
	{
		Thing.update.apply(this)
	}
	*/
})


text:
package org.openengsb.core.services.internal.security.ldap;

import java.util.Collections;
import java.util.Comparator;
import java.util.List;
import java.util.UUID;

import org.apache.directory.shared.ldap.model.entry.Entry;
import org.apache.directory.shared.ldap.model.exception.LdapException;
import org.apache.directory.shared.ldap.model.name.Dn;
import org.openengsb.infrastructure.ldap.model.Node;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.fasterxml.uuid.EthernetAddress;
import com.fasterxml.uuid.Generators;
import com.fasterxml.uuid.UUIDComparator;
import com.fasterxml.uuid.impl.TimeBasedGenerator;

/**
 * Assists in maintaining order between entries. Many Java collections allow duplicates or return their elements in a
 * predefined order. Ldap supports no duplicates and does not specify how implementations return their entries. This
 * class provides the following:

 * 1) Make non-distinct objects distinct.

 * 2) Order objects.

 * Order can only be achieved among distinct objects, so 2) implies 1).
 * */
public final class TimebasedOrderFilter {

    private static final Logger LOGGER = LoggerFactory.getLogger(TimebasedOrderFilter.class);
    public static final String ID_ATTRIBUTE = "org-openengsb-uuid";
    public static final String UNIQUE_OBJECT_OC = "org-openengsb-uniqueObject";

    private TimebasedOrderFilter() {
    }

    /**
     * Adds a timebased uuid to entry. If updateRdn is true, the uuid becomes the rdn. Use this to handle duplicates.
     */
    public static void addId(Entry entry, boolean updateRdn) {
        String uuid = newUUID().toString();
        try {
            entry.add(SchemaConstants.OBJECT_CLASS_ATTRIBUTE, UNIQUE_OBJECT_OC);
            entry.add(ID_ATTRIBUTE, uuid);
        } catch (LdapException e) {
            throw new LdapRuntimeException(e);
        }
        if (updateRdn) {
            Dn newDn = LdapUtils.concatDn(ID_ATTRIBUTE, uuid, entry.getDn().getParent());
            entry.setDn(newDn);
        }
    }

    /**
     * Iterates over entries and adds a timebased uuid to each entry. If updateRdn is true, the uuid becomes the rdn.
     * Use this to handle duplicates.
     */
    public static void addIds(List<Entry> entries, boolean updateRdn) {
        for (Entry entry : entries) {
            addId(entry, updateRdn);
        }
    }

    /**
     * Sorts the list of entries according to their id. This method does not check whether an entry actually has an id
     * attribute. Non existing attributes are represented as null. The underlying comparator compares null to null as
     * equal and null to non-null as smaller.
     * */
    public static void sortById(List<Entry> entries) {
        Collections.sort(entries, new IdComparator());
    }

    /**
     * Sorts the list of nodes according to the ids of their underlying entries. This method does not check whether an
     * entry actually has an id attribute. Non existing attributes are represented as null. The underlying comparator
     * compares null to null as equal and null to non-null as smaller.
     * */
    public static void sortByIdNode(List<Node> nodes) {
        Collections.sort(nodes, new IdComparatorNode());
    }

    /**
     * Returns the String value of the id attribute.
     * */
    public static String extractId(Entry entry) {
        return LdapUtils.extractAttributeNoEmptyCheck(entry, TimebasedOrderFilter.ID_ATTRIBUTE);
    }

    private static UUID newUUID() {
        TimeBasedGenerator uuidGenerator = Generators.timeBasedGenerator(EthernetAddress.fromInterface());
        return uuidGenerator.generate();
    }

    private static class IdComparator implements Comparator<Entry> {
        @Override
        public int compare(Entry e1, Entry e2) {
            String id1 = extractId(e1);
            String id2 = extractId(e2);
            if (id1 == null && id2 == null) {
                return 0;
            } else if (id1 == null && id2 != null) {
                LOGGER.warn("id2 = emptyString? {}", id2.isEmpty());
                return -1;
            } else if (id1 != null && id2 == null) {
                LOGGER.warn("id1 = emptyString? {}", id1.isEmpty());
                return 1;
            } else {
                return UUIDComparator.staticCompare(UUID.fromString(id1), UUID.fromString(id2));
            }

        }
    }

    private static class IdComparatorNode implements Comparator<Node> {
        @Override
        public int compare(Node n1, Node n2) {
            Entry e1 = n1.getEntry();
            Entry e2 = n2.getEntry();
            if (e1 == null && e2 == null) {
                return 0;
            } else if (e1 == null && e2 != null) {
                return -1;
            } else if (e1 != null && e2 == null) {
                return 1;
            } else {
                return new IdComparator().compare(e1, e2);
            }

        }
    }

}


text:
package org.web3j.utils;

import java.math.BigDecimal;

import org.junit.Test;

import org.web3j.utils.Convert;

import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.MatcherAssert.assertThat;

public class ConvertTest {

    @Test
    public void testFromWei() {
        assertThat(Convert.fromWei("21000000000000", Convert.Unit.WEI),
                is(new BigDecimal("21000000000000")));
        assertThat(Convert.fromWei("21000000000000", Convert.Unit.KWEI),
                is(new BigDecimal("21000000000")));
        assertThat(Convert.fromWei("21000000000000", Convert.Unit.MWEI),
                is(new BigDecimal("21000000")));
        assertThat(Convert.fromWei("21000000000000", Convert.Unit.GWEI),
                is(new BigDecimal("21000")));
        assertThat(Convert.fromWei("21000000000000", Convert.Unit.SZABO),
                is(new BigDecimal("21")));
        assertThat(Convert.fromWei("21000000000000", Convert.Unit.FINNEY),
                is(new BigDecimal("0.021")));
        assertThat(Convert.fromWei("21000000000000", Convert.Unit.ETHER),
                is(new BigDecimal("0.000021")));
        assertThat(Convert.fromWei("21000000000000", Convert.Unit.KETHER),
                is(new BigDecimal("0.000000021")));
        assertThat(Convert.fromWei("21000000000000", Convert.Unit.METHER),
                is(new BigDecimal("0.000000000021")));
        assertThat(Convert.fromWei("21000000000000", Convert.Unit.GETHER),
                is(new BigDecimal("0.000000000000021")));
    }

    @Test
    public void testToWei() {
        assertThat(Convert.toWei("21", Convert.Unit.WEI), is(new BigDecimal("21")));
        assertThat(Convert.toWei("21", Convert.Unit.KWEI), is(new BigDecimal("21000")));
        assertThat(Convert.toWei("21", Convert.Unit.MWEI), is(new BigDecimal("21000000")));
        assertThat(Convert.toWei("21", Convert.Unit.GWEI), is(new BigDecimal("21000000000")));
        assertThat(Convert.toWei("21", Convert.Unit.SZABO), is(new BigDecimal("21000000000000")));
        assertThat(Convert.toWei("21", Convert.Unit.FINNEY),
                is(new BigDecimal("21000000000000000")));
        assertThat(Convert.toWei("21", Convert.Unit.ETHER),
                is(new BigDecimal("21000000000000000000")));
        assertThat(Convert.toWei("21", Convert.Unit.KETHER),
                is(new BigDecimal("21000000000000000000000")));
        assertThat(Convert.toWei("21", Convert.Unit.METHER),
                is(new BigDecimal("21000000000000000000000000")));
        assertThat(Convert.toWei("21", Convert.Unit.GETHER),
                is(new BigDecimal("21000000000000000000000000000")));
    }

    @Test
    public void testUnit() {
        assertThat(Convert.Unit.fromString("ether"), is(Convert.Unit.ETHER));
        assertThat(Convert.Unit.fromString("ETHER"), is(Convert.Unit.ETHER));
        assertThat(Convert.Unit.fromString("wei"), is(Convert.Unit.WEI));
    }
}


text:
title: 'Project of the Week: Jasper'
author: zeke
date: '2017-03-21'
---

This week we interviewed the creator of [Jasper], an Electron-based tool for
managing GitHub notifications.

---

## Hello! Who are you?

I'm [Ryo Maruyama](https://github.com/h13i32maru), a software developer in Japan. I am developing [Jasper](https://jasperapp.io) and [ESDoc](https://esdoc.org).

## What is Jasper?

[Jasper] is a flexible and powerful issue reader for GitHub. It supports issues and pull requests on github.com and GitHub Enterprise.

[![Jasper App Screenshot](https://cloud.githubusercontent.com/assets/2289/24108647/75ef131e-0d4b-11e7-945b-27dd50cb03ab.png)](https://jasperapp.io/)

## Why did you make it?

When people use GitHub in their job or OSS activities, they tend to receive many notifications on a daily basis. As a way to subscribe to the notifications, GitHub provides email and [web notifications](https://github.com/notifications). I used these for a couple of years, but I faced the following problems:

- It's easy to overlook issues where I was mentioned, I commented, or I am watching.
- I put some issues in a corner of my head to check later, but I sometimes forget about them.
- To not forget issues, I keep many tabs open in my browser.
- It's hard to check all issues that are related to me.
- It's hard to grasp all of my team's activity.

I was spending a lot of time and energy trying to prevent those problems, so I decided to make an issue reader for GitHub to solve these problems efficiently, and started developing Jasper.

## Who's using Jasper?

Jasper is used by developers, designers, and managers in several companies that are using GitHub.
Of course, some OSS developers also are using it.
And it is also used by some people at GitHub!

## How does Jasper work?

Once Jasper is configured, the following screen appears. From left to right, you can see "streams list", "issues list" and "issue body".

[![Jasper Start Screen](https://cloud.githubusercontent.com/assets/2289/24108645/75ae3786-0d4b-11e7-9a1a-3c270ae33cba.png)](https://jasperapp.io/)

This "stream" is the core feature of Jasper. For example, if you want to see "issues that are assigned to @zeke in the electron/electron repository", you create the following stream:

```
repo:electron/electron assignee:zeke is:issue
```

[![Jasper Start Screen 2](https://cloud.githubusercontent.com/assets/2289/24108648/75f403ec-0d4b-11e7-9ed4-4599ecd26b78.png)](https://jasperapp.io/)

After creating the stream and waiting for a few seconds, you can see the issues that meet the conditions.

[![Jasper Start Screen 3](https://cloud.githubusercontent.com/assets/2289/24108646/75b7fea6-0d4b-11e7-9d05-7dd4e595403c.png)](https://jasperapp.io/)

## What can we do with streams?

I will introduce what kind of conditions can be used for stream.

### Users and Teams

| Stream | Issues |
| ---- | --- |
| `mentions:cat mentions:dog` | Issues that mention user `cat` or `dog`|
| `author:cat author:dog` | Issues created by user `cat` or `dog` |
| `assignee:cat assignee:dog` | Issues assigned to `cat` or `dog` |
| `commenter:cat commenter:dog` | Issues that `cat` or `dog` commented on |
| `involves:cat involves:dog` | Issues that "involve" `cat` or `bob` |
| `team:animal/white-cat team:animal/black-dog` | Issues that `animal/white-cat` or `animal/black-dog` are mentioned in |

`involves` means `mention`, `author`, `assignee` or `commenter`

### Repositories and Organizations

| Stream | Issues |
| --- | --- |
| `repo:cat/jump repo:dog/run` | Issues in `cat/jump` or `dog/run` |
| `org:electron user:cat user:dog` | Issues in `electron`, `cat` or `dog` |

`org` is same as `user`

### Attributes

| Stream | Issues |
| --- | --- |
| `repo:cat/jump milestone:v1.0.0 milestone:v1.0.1` | Issues that are attached to `v1.0.0` or `v1.0.1` in `cat/jump` |
| `repo:cat/jump label:bug label:blocker` | Issues that are attached `bug` **and** `blocker` in `cat/jump` |
| `electron OR atomshell` | Issues that include `electron` or `atomshell` |

### Review Status

| Stream | Issues |
| --- | --- |
| `is:pr review:required` | Issues that are required review in `cat/jump` |
| `is:pr review-requested:cat` | Issues that are requested review by `cat`.
 But these are not reviewed yet. |
| `is:pr reviewed-by:cat` | Issues that are reviewed by `cat` |

As you may have noticed by looking at these, streams can use GitHub's search queries.
For details on how to use streams and search queries, see the following URLs.

- [jasperapp.io/doc.html#stream](https://jasperapp.io/doc.html#stream)
- [help.github.com/articles/searching-issues](https://help.github.com/articles/searching-issues/)
- [help.github.com/articles/search-syntax](https://help.github.com/articles/search-syntax/)

Jasper also has features for unread issue management, unread comment management, marking stars, notification updating, filtering issues, keyboard shortcuts, etc.

## Is Jasper a paid product? How much does it cost?

Jasper is $12. However you can use the [free trial edition](https://jasperapp.io/) for 30 days.

## Why did you choose to build Jasper on Electron?

I like the following aspects of Electron:

- Apps can be developed with JavaScript/CSS/HTML.
- Apps can be built for Windows, Mac, and Linux platforms.
- Electron is actively developed and has a large community.

These features enable rapid and simple desktop application development. It is awesome! If you have any product idea, you should consider using Electron by all means.

## What are some challenges you've faced while developing Jasper?

I had a hard time figuring out the "stream" concept. At first I considered using GitHub's [Notifications API]. However I noticed that it does not support certain use cases. After that I considered using the [Issues API] and [Pull Requests API], in addition to the Notification API. But it never became what I wanted. Then while thinking about various methods, I realized that polling GitHub's [Search API] would offer the most flexibility. It took about a month of experimentation to get to this point, then I implemented a prototype of Jasper with the stream concept in two days.

Note: The polling is limited to once every 10 seconds at most. This is acceptable enough for the restriction of GitHub API.

## What's coming next?

I have a plan to develop the following features:

- **A filtered stream**: A stream has some filtered stream that filter issues in the stream. It is like as view of SQL.
- **Multiple accounts**: you will be able to use both github.com and GHE
- **Improve performance**: For now the loading a issue in WebView is low speed than normal browser.

Follow [@jasperappio](https://twitter.com/jasperappio) on Twitter for updates.

[Jasper]: https://jasperapp.io
[Notifications API]: https://developer.github.com/v3/activity/notifications/
[Pull Requests API]: https://developer.github.com/v3/pulls/
[Issues API]: https://developer.github.com/v3/issues/
[Search API]: https://developer.github.com/v3/search/


text:
package org.wte4j.examples.showcase.client.management;

import java.util.List;

import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.user.client.ui.IsWidget;

public interface NewTemplateDisplay extends IsWidget {

	String getTemplateName();

	void setTemplateName(String string);

	void setDataModelListItems(List<DataModelItem> dataModelItems);

	String getSelectedDataModel();

	void setSelectedDataModel(String dataModel);

	boolean validateAddTemplateForm();

	void addCloseDialogClickHandler(ClickHandler clickHandler);

	void addCreateTemplateClickHandler(ClickHandler clickHandler);

	void showSpinner();

	void hideSpinner();

	void setFocusOnTemplateName();

}


text:
"""
13C (Methyl) H-to-C CPMG
========================

Measures methyl carbon chemical exchange recorded on site-specifically
13CH3-labeled proteins in a highly deuterated background. Magnetization is
initially anti-phase and is read out as in-phase. Because of the P-element
only even ncyc should be recorded. Resulting magnetization intensity after
the CPMG block is calculated using the (6n)×(6n), two-spin matrix, where n
is the number of states::

    { Ix(a), Iy(a), Iz(a), IxSz(a), IySz(a), IzSz(a),
      Ix(b), Iy(b), Iz(b), IxSz(b), IySz(b), IzSz(b), ... }

References
----------

Lundström, Vallurupalli, Religa, Dahlquist and Kay. J Biomol NMR (2007) 38, 79-88

Note
----

A sample configuration file for this module is available using the command::

    $ chemex config cpmg_ch3_13c_h2c

"""
import functools as ft

import numpy as np
import numpy.linalg as nl

import chemex.experiments.helper as ceh
import chemex.helper as ch
import chemex.nmr.liouvillian as cnl

_SCHEMA = {
    "type": "object",
    "properties": {
        "experiment": {
            "type": "object",
            "properties": {
                "time_t2": {"type": "number"},
                "carrier": {"type": "number"},
                "pw90": {"type": "number"},
                "time_equil": {"type": "number", "default": 0.0},
                "taub": {"type": "number", "default": 2.0e-3},
                "observed_state": {
                    "type": "string",
                    "pattern": "[a-z]",
                    "default": "a",
                },
            },
            "required": ["time_t2", "carrier", "pw90"],
        }
    },
}

def read(config):
    ch.validate(config, _SCHEMA)
    config["basis"] = cnl.Basis(type="ixyzsz", spin_system="ch")
    config["fit"] = _fit_this()
    config["even_ncycs"] = True
    return ceh.load_experiment(config=config, pulse_seq_cls=PulseSeq)

def _fit_this():
    return {
        "rates": ["r2_i_{observed_state}"],
        "model_free": ["tauc_{observed_state}"],
    }

class PulseSeq:
    def __init__(self, config, propagator):
        self.prop = propagator
        settings = config["experiment"]
        self.time_t2 = settings["time_t2"]
        self.time_eq = settings["time_equil"]
        self.prop.carrier_i = settings["carrier"]
        self.pw90 = settings["pw90"]
        self.taub = settings["taub"]
        self.t_neg = -2.0 * self.pw90 / np.pi
        self.prop.b1_i = 1 / (4.0 * self.pw90)
        self.prop.detection = f"[iz_{settings['observed_state']}]"

    @ft.lru_cache(maxsize=10000)
    def calculate(self, ncycs, params_local):
        self.prop.update(params_local)

        # Calculation of the propagators corresponding to all the delays
        tau_cps, all_delays = self._get_delays(ncycs)
        delays = dict(zip(all_delays, self.prop.delays(all_delays)))
        d_neg = delays[self.t_neg]
        d_eq = delays[self.time_eq]
        d_taub = delays[self.taub]
        d_cp = {ncyc: delays[delay] for ncyc, delay in tau_cps.items()}

        # Calculation of the propagators corresponding to all the pulses
        p90 = self.prop.p90_i
        p180 = self.prop.p180_i
        p180_sx = self.prop.perfect180_s[0]

        # Getting the starting magnetization
        start = self.prop.get_start_magnetization("2izsz")

        # Calculating the p-element
        palmer = d_taub @ p90[0] @ p180_sx @ p90[0] @ d_taub

        # Calculating the inensities as a function of ncyc
        intst = {0: self.prop.detect(d_eq @ p90[1] @ palmer @ p90[0] @ start)}
        part1 = d_neg @ p90[0] @ start
        part2 = d_eq @ p90[1] @ d_neg
        for ncyc in set(ncycs) - {0}:
            echo = d_cp[ncyc] @ p180[[1, 0]] @ d_cp[ncyc]
            cpmg1, cpmg2 = nl.matrix_power(echo, ncyc)
            end = part2 @ cpmg2 @ palmer @ cpmg1 @ part1
            intst[ncyc] = self.prop.detect(end)

        # Return profile
        return np.array([intst[ncyc] for ncyc in ncycs])

    @ft.lru_cache()
    def _get_delays(self, ncycs):
        ncycs_ = np.asarray(ncycs)
        ncycs_ = ncycs_[ncycs_ > 0]
        tau_cps = dict(zip(ncycs_, self.time_t2 / (4.0 * ncycs_) - self.pw90))
        delays = [self.t_neg, self.taub, self.time_eq, *tau_cps.values()]
        return tau_cps, delays

    def ncycs_to_nu_cpmgs(self, ncycs):
        ncycs_ = np.asarray(ncycs)
        ncycs_ = ncycs_[ncycs_ > 0]
        return ncycs_ / self.time_t2


text:
#ifndef Operations_h
#define Operations_h

#include "Interpreter.h"
#include "JSImmediate.h"
#include "JSNumberCell.h"
#include "JSString.h"

namespace JSC {

    NEVER_INLINE JSValue throwOutOfMemoryError(ExecState*);
    NEVER_INLINE JSValue jsAddSlowCase(CallFrame*, JSValue, JSValue);
    JSValue jsTypeStringForValue(CallFrame*, JSValue);
    bool jsIsObjectType(JSValue);
    bool jsIsFunctionType(JSValue);

    ALWAYS_INLINE JSValue jsString(ExecState* exec, JSString* s1, JSString* s2)
    {
        if (!s1->length())
            return s2;
        if (!s2->length())
            return s1;

        unsigned ropeLength = s1->ropeLength() + s2->ropeLength();
        JSGlobalData* globalData = &exec->globalData();

        if (ropeLength <= JSString::s_maxInternalRopeLength)
            return new (globalData) JSString(globalData, ropeLength, s1, s2);

        unsigned index = 0;
        RefPtr<JSString::Rope> rope = JSString::Rope::createOrNull(ropeLength);
        if (UNLIKELY(!rope))
            return throwOutOfMemoryError(exec);
        rope->append(index, s1);
        rope->append(index, s2);
        ASSERT(index == ropeLength);
        return new (globalData) JSString(globalData, rope.release());
    }

    ALWAYS_INLINE JSValue jsString(ExecState* exec, const UString& u1, JSString* s2)
    {
        unsigned ropeLength = 1 + s2->ropeLength();
        JSGlobalData* globalData = &exec->globalData();

        if (ropeLength <= JSString::s_maxInternalRopeLength)
            return new (globalData) JSString(globalData, ropeLength, u1, s2);

        unsigned index = 0;
        RefPtr<JSString::Rope> rope = JSString::Rope::createOrNull(ropeLength);
        if (UNLIKELY(!rope))
            return throwOutOfMemoryError(exec);
        rope->append(index, u1);
        rope->append(index, s2);
        ASSERT(index == ropeLength);
        return new (globalData) JSString(globalData, rope.release());
    }

    ALWAYS_INLINE JSValue jsString(ExecState* exec, JSString* s1, const UString& u2)
    {
        unsigned ropeLength = s1->ropeLength() + 1;
        JSGlobalData* globalData = &exec->globalData();

        if (ropeLength <= JSString::s_maxInternalRopeLength)
            return new (globalData) JSString(globalData, ropeLength, s1, u2);

        unsigned index = 0;
        RefPtr<JSString::Rope> rope = JSString::Rope::createOrNull(ropeLength);
        if (UNLIKELY(!rope))
            return throwOutOfMemoryError(exec);
        rope->append(index, s1);
        rope->append(index, u2);
        ASSERT(index == ropeLength);
        return new (globalData) JSString(globalData, rope.release());
    }

    ALWAYS_INLINE JSValue jsString(ExecState* exec, Register* strings, unsigned count)
    {
        ASSERT(count >= 3);

        unsigned ropeLength = 0;
        for (unsigned i = 0; i < count; ++i) {
            JSValue v = strings[i].jsValue();
            if (LIKELY(v.isString()))
                ropeLength += asString(v)->ropeLength();
            else
                ++ropeLength;
        }

        JSGlobalData* globalData = &exec->globalData();
        if (ropeLength == 3)
            return new (globalData) JSString(exec, strings[0].jsValue(), strings[1].jsValue(), strings[2].jsValue());

        RefPtr<JSString::Rope> rope = JSString::Rope::createOrNull(ropeLength);
        if (UNLIKELY(!rope))
            return throwOutOfMemoryError(exec);

        unsigned index = 0;
        for (unsigned i = 0; i < count; ++i) {
            JSValue v = strings[i].jsValue();
            if (LIKELY(v.isString()))
                rope->append(index, asString(v));
            else
                rope->append(index, v.toString(exec));
        }

        ASSERT(index == ropeLength);
        return new (globalData) JSString(globalData, rope.release());
    }

    ALWAYS_INLINE JSValue jsString(ExecState* exec, JSValue thisValue, const ArgList& args)
    {
        unsigned ropeLength = 0;
        if (LIKELY(thisValue.isString()))
            ropeLength += asString(thisValue)->ropeLength();
        else
            ++ropeLength;
        for (unsigned i = 0; i < args.size(); ++i) {
            JSValue v = args.at(i);
            if (LIKELY(v.isString()))
                ropeLength += asString(v)->ropeLength();
            else
                ++ropeLength;
        }

        RefPtr<JSString::Rope> rope = JSString::Rope::createOrNull(ropeLength);
        if (UNLIKELY(!rope))
            return throwOutOfMemoryError(exec);

        unsigned index = 0;
        if (LIKELY(thisValue.isString()))
            rope->append(index, asString(thisValue));
        else
            rope->append(index, thisValue.toString(exec));
        for (unsigned i = 0; i < args.size(); ++i) {
            JSValue v = args.at(i);
            if (LIKELY(v.isString()))
                rope->append(index, asString(v));
            else
                rope->append(index, v.toString(exec));
        }
        ASSERT(index == ropeLength);

        JSGlobalData* globalData = &exec->globalData();
        return new (globalData) JSString(globalData, rope.release());
    }

    // ECMA 11.9.3
    inline bool JSValue::equal(ExecState* exec, JSValue v1, JSValue v2)
    {
        if (v1.isInt32() && v2.isInt32())
            return v1 == v2;

        return equalSlowCase(exec, v1, v2);
    }

    ALWAYS_INLINE bool JSValue::equalSlowCaseInline(ExecState* exec, JSValue v1, JSValue v2)
    {
        do {
            if (v1.isNumber() && v2.isNumber())
                return v1.uncheckedGetNumber() == v2.uncheckedGetNumber();

            bool s1 = v1.isString();
            bool s2 = v2.isString();
            if (s1 && s2)
                return asString(v1)->value(exec) == asString(v2)->value(exec);

            if (v1.isUndefinedOrNull()) {
                if (v2.isUndefinedOrNull())
                    return true;
                if (!v2.isCell())
                    return false;
                return v2.asCell()->structure()->typeInfo().masqueradesAsUndefined();
            }

            if (v2.isUndefinedOrNull()) {
                if (!v1.isCell())
                    return false;
                return v1.asCell()->structure()->typeInfo().masqueradesAsUndefined();
            }

            if (v1.isObject()) {
                if (v2.isObject())
                    return v1 == v2
#ifdef QT_BUILD_SCRIPT_LIB
                        || asObject(v1)->compareToObject(exec, asObject(v2))
#endif
                        ;
                JSValue p1 = v1.toPrimitive(exec);
                if (exec->hadException())
                    return false;
                v1 = p1;
                if (v1.isInt32() && v2.isInt32())
                    return v1 == v2;
                continue;
            }

            if (v2.isObject()) {
                JSValue p2 = v2.toPrimitive(exec);
                if (exec->hadException())
                    return false;
                v2 = p2;
                if (v1.isInt32() && v2.isInt32())
                    return v1 == v2;
                continue;
            }

            if (s1 || s2) {
                double d1 = v1.toNumber(exec);
                double d2 = v2.toNumber(exec);
                return d1 == d2;
            }

            if (v1.isBoolean()) {
                if (v2.isNumber())
                    return static_cast<double>(v1.getBoolean()) == v2.uncheckedGetNumber();
            } else if (v2.isBoolean()) {
                if (v1.isNumber())
                    return v1.uncheckedGetNumber() == static_cast<double>(v2.getBoolean());
            }

            return v1 == v2;
        } while (true);
    }

    // ECMA 11.9.3
    ALWAYS_INLINE bool JSValue::strictEqualSlowCaseInline(ExecState* exec, JSValue v1, JSValue v2)
    {
        ASSERT(v1.isCell() && v2.isCell());

        if (v1.asCell()->isString() && v2.asCell()->isString())
            return asString(v1)->value(exec) == asString(v2)->value(exec);

        return v1 == v2;
    }

    inline bool JSValue::strictEqual(ExecState* exec, JSValue v1, JSValue v2)
    {
        if (v1.isInt32() && v2.isInt32())
            return v1 == v2;

        if (v1.isNumber() && v2.isNumber())
            return v1.uncheckedGetNumber() == v2.uncheckedGetNumber();

        if (!v1.isCell() || !v2.isCell())
            return v1 == v2;

        return strictEqualSlowCaseInline(exec, v1, v2);
    }

    ALWAYS_INLINE bool jsLess(CallFrame* callFrame, JSValue v1, JSValue v2)
    {
        if (v1.isInt32() && v2.isInt32())
            return v1.asInt32() < v2.asInt32();

        double n1;
        double n2;
        if (v1.getNumber(n1) && v2.getNumber(n2))
            return n1 < n2;

        JSGlobalData* globalData = &callFrame->globalData();
        if (isJSString(globalData, v1) && isJSString(globalData, v2))
            return asString(v1)->value(callFrame) < asString(v2)->value(callFrame);

        JSValue p1;
        JSValue p2;
        bool wasNotString1 = v1.getPrimitiveNumber(callFrame, n1, p1);
        bool wasNotString2 = v2.getPrimitiveNumber(callFrame, n2, p2);

        if (wasNotString1 | wasNotString2)
            return n1 < n2;

        return asString(p1)->value(callFrame) < asString(p2)->value(callFrame);
    }

    inline bool jsLessEq(CallFrame* callFrame, JSValue v1, JSValue v2)
    {
        if (v1.isInt32() && v2.isInt32())
            return v1.asInt32() <= v2.asInt32();

        double n1;
        double n2;
        if (v1.getNumber(n1) && v2.getNumber(n2))
            return n1 <= n2;

        JSGlobalData* globalData = &callFrame->globalData();
        if (isJSString(globalData, v1) && isJSString(globalData, v2))
            return !(asString(v2)->value(callFrame) < asString(v1)->value(callFrame));

        JSValue p1;
        JSValue p2;
        bool wasNotString1 = v1.getPrimitiveNumber(callFrame, n1, p1);
        bool wasNotString2 = v2.getPrimitiveNumber(callFrame, n2, p2);

        if (wasNotString1 | wasNotString2)
            return n1 <= n2;

        return !(asString(p2)->value(callFrame) < asString(p1)->value(callFrame));
    }

    // Fast-path choices here are based on frequency data from SunSpider:
    //    <times> Add case: <t1> <t2>
    //    ---------------------------
    //    5626160 Add case: 3 3 (of these, 3637690 are for immediate values)
    //    247412  Add case: 5 5
    //    20900   Add case: 5 6
    //    13962   Add case: 5 3
    //    4000    Add case: 3 5

    ALWAYS_INLINE JSValue jsAdd(CallFrame* callFrame, JSValue v1, JSValue v2)
    {
        double left = 0.0, right;
        if (v1.getNumber(left) && v2.getNumber(right))
            return jsNumber(callFrame, left + right);

        if (v1.isString()) {
            return v2.isString()
                ? jsString(callFrame, asString(v1), asString(v2))
                : jsString(callFrame, asString(v1), v2.toPrimitiveString(callFrame));
        }

        // All other cases are pretty uncommon
        return jsAddSlowCase(callFrame, v1, v2);
    }

    inline size_t normalizePrototypeChain(CallFrame* callFrame, JSValue base, JSValue slotBase, const Identifier& propertyName, size_t& slotOffset)
    {
        JSCell* cell = asCell(base);
        size_t count = 0;

        while (slotBase != cell) {
            JSValue v = cell->structure()->prototypeForLookup(callFrame);

            // If we didn't find slotBase in base's prototype chain, then base
            // must be a proxy for another object.

            if (v.isNull())
                return 0;

            cell = asCell(v);

            // Since we're accessing a prototype in a loop, it's a good bet that it
            // should not be treated as a dictionary.
            if (cell->structure()->isDictionary()) {
                asObject(cell)->flattenDictionaryObject();
                if (slotBase == cell)
                    slotOffset = cell->structure()->get(propertyName);
            }

            ++count;
        }

        ASSERT(count);
        return count;
    }

    inline size_t normalizePrototypeChain(CallFrame* callFrame, JSCell* base)
    {
        size_t count = 0;
        while (1) {
            JSValue v = base->structure()->prototypeForLookup(callFrame);
            if (v.isNull())
                return count;

            base = asCell(v);

            // Since we're accessing a prototype in a loop, it's a good bet that it
            // should not be treated as a dictionary.
            if (base->structure()->isDictionary())
                asObject(base)->flattenDictionaryObject();

            ++count;
        }
    }

    ALWAYS_INLINE JSValue resolveBase(CallFrame* callFrame, Identifier& property, ScopeChainNode* scopeChain)
    {
        ScopeChainIterator iter = scopeChain->begin();
        ScopeChainIterator next = iter;
        ++next;
        ScopeChainIterator end = scopeChain->end();
        ASSERT(iter != end);

        PropertySlot slot;
        JSObject* base;
        while (true) {
            base = *iter;
            if (next == end || base->getPropertySlot(callFrame, property, slot))
                return base;

            iter = next;
            ++next;
        }

        ASSERT_NOT_REACHED();
        return JSValue();
    }
} // namespace JSC

#endif // Operations_h


text:
bash "Install PGP key and add HTTPS support for APT" do
  code <<-EOF
    sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 561F9B9CAC40B2F7
    sudo apt-get install -y apt-transport-https ca-certificates
  EOF
end

bash "add APT repo" do
  code <<-EOF
    sudo sh -c 'echo deb https://oss-binaries.phusionpassenger.com/apt/passenger trusty main > /etc/apt/sources.list.d/passenger.list'
    sudo apt-get update
  EOF
end

bash "Install passenger+nginx" do
  code <<-EOF
    sudo apt-get install -y --force-yes nginx-extras passenger
  EOF
end

nginx_conf_path = "/etc/nginx/nginx.conf"
execute "rm -f #{nginx_conf_path}" do
  only_if { File.exists?(nginx_conf_path) }
end

template "/etc/nginx/nginx.conf" do
  source "nginx.conf.erb"
  variables({
                passenger_ruby: "/home/#{node['user']['name']}/.rbenv/shims/ruby",
                rails_env:      node['env'],
                app_root:       "/var/www/#{node['app']}/current/public"
            })
end

['enabled', 'available'].each do |type_of_action|
  default_path = "/etc/nginx/sites-#{type_of_action}/default"
  execute "rm -f #{default_path}" do
    only_if { File.exists?(default_path) }
  end
end

template "/etc/nginx/sites-available/#{node['app']}" do
  source "#{node['app']}.erb"
  variables({
                rails_env:   node['env'],
                server_name: node['app'],
                app_root:    "/var/www/#{node['app']}/current/public"

            })
end

available_path = "/etc/nginx/sites-available/#{node['app']}"
execute "sudo ln -fs #{available_path} /etc/nginx/sites-enabled/#{node['app']}" do
  only_if { File.exists?(available_path) }
end


text:
import { createSelector, Store } from '@ngrx/store';
import { PerWindowState } from 'altair-graphql-core/build/types/state/per-window.interfaces';
import { getInitialHeadersState } from './headers.reducer';

export const getHeaders = (state: PerWindowState) => state ? state.headers : { ...getInitialHeadersState() };