text:
package de.isnow.sqlws.resources;

import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import de.isnow.sqlws.model.WsColumn;
import de.isnow.sqlws.model.WsSchema;
import de.isnow.sqlws.model.WsColumn;
import de.isnow.sqlws.model.WsTable;

import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
import java.util.Collection;

@Path("/column")
public class ColumnService {

	@GET
	@Path("/{id}")
	@Produces(MediaType.APPLICATION_JSON)
	public WsColumn getColumn(
			@PathParam("id") String columnid
	) throws JsonProcessingException {
		WsColumn wsc = WsColumn.get(columnid);

		return wsc;
	}

	@GET
	@Path("/table/{tableid}")
    @Produces(MediaType.APPLICATION_JSON)
    public Collection<WsColumn> getColumns(
    		@PathParam("tableid") String schemaId
    		) throws JsonProcessingException {
		WsTable table = WsTable.get(schemaId);
		if (null == table) {
			return null;
		}
		Collection<WsColumn> columns = table.getColumns();
		return columns;
    }

}

redpajama_set_name: RedPajamaGithub


text:
<!DOCTYPE html>

    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0, target-densitydpi=medium-dpi" />
    <title> @@DocumentName@@ </title>
    <link rel="stylesheet" type="text/css" href="/@@URLRootDirectoryName@@/CSS/DefaultStyle.css" />

@@DocumentName@@

                <form id="passwordcheckform" method="get" action="/@@URLRootDirectoryName@@/LoginOK" onsubmit="return PasswordCheckFormValueCheck();">

비밀번호를 다시 확인 해주세요.

                    <input type="password" name="authpassword" placeholder="비밀번호를 입력하세요." />

                    <input type="submit" value="로그인" />
                </form>

            @@AssemblyName@@

            @@AssemblyVersion@@


text:
**A Python Library for creating and Editing Ableton Live instrument patches**

** Analog **

It's as easy as this:

	from pyableton.presets import AnalogPreset
	instrument = AnalogPreset()

	instrument.osc[1].waveshape = 'SINE'
	instrument.filter[0].type = 'LP24'
	instrument.filter[1].envelope.attacktime = 0.0687
	instrument.polyphony = 'MONO'

	instrument.save_preset('gnarly_wobble.adv')


text:
import hashlib
import sys
import os
import traceback
import pdb

from logzero import logger

from neo.VM.RandomAccessStack import RandomAccessStack
from neo.VM.ExecutionContext import ExecutionContext
from neo.VM import VMState
from neo.VM.OpCode import *
from neo.SmartContract.ContractParameterType import ContractParameterType
from neocore.BigInteger import BigInteger
from neo.VM.InteropService import Array, Struct, StackItem
from neocore.UInt160 import UInt160

class ExecutionEngine():

    _Table = None
    _Service = None

    _ScriptContainer = None
    _Crypto = None

    _VMState = VMState.BREAK

    _InvocationStack = None
    _EvaluationStack = None
    _AltStack = None

    _ExecutedScriptHashes = None

    ops_processed = 0

    @property
    def ScriptContainer(self):
        return self._ScriptContainer

    @property
    def Crypto(self):
        return self._Crypto

    @property
    def State(self):
        return self._VMState

    @property
    def InvocationStack(self):
        return self._InvocationStack

    @property
    def EvaluationStack(self):
        return self._EvaluationStack

    @property
    def AltStack(self):
        return self._AltStack

    @property
    def CurrentContext(self):
        return self._InvocationStack.Peek()

    @property
    def CallingContext(self):
        if self._InvocationStack.Count > 1:
            return self.InvocationStack.Peek(1)
        return None

    @property
    def EntryContext(self):
        return self.InvocationStack.Peek(self.InvocationStack.Count - 1)

    @property
    def ExecutedScriptHashes(self):
        return self._ExecutedScriptHashes

    def __init__(self, container=None, crypto=None, table=None, service=None):
        self._ScriptContainer = container
        self._Crypto = crypto
        self._Table = table
        self._Service = service

        self._InvocationStack = RandomAccessStack(name='Invocation')
        self._EvaluationStack = RandomAccessStack(name='Evaluation')
        self._AltStack = RandomAccessStack(name='Alt')
        self._ExecutedScriptHashes = []
        self.ops_processed = 0

    def AddBreakPoint(self, position):
        self.CurrentContext.Breakpoints.add(position)

    def ResultsForCode(self, contract):
        try:
            return_type = contract.ReturnType

            item = self.EvaluationStack.Items[0]
            if return_type == ContractParameterType.Integer:
                return item.GetBigInteger()
            elif return_type == ContractParameterType.Boolean:
                return item.GetBoolean()
            elif return_type == ContractParameterType.ByteArray:
                return item.GetByteArray()
            elif return_type == ContractParameterType.String:
                return item.GetString()
            elif return_type == ContractParameterType.Array:
                return item.GetArray()
            else:
                logger.error("Could not format results for return type %s " % return_type)
            return item
        except Exception as e:
            pass

        return self.EvaluationStack.Items

    def Dispose(self):
        while self._InvocationStack.Count > 0:
            self._InvocationStack.Pop().Dispose()

    def Execute(self):
        self._VMState &= ~VMState.BREAK

        while self._VMState & VMState.HALT == 0 and self._VMState & VMState.FAULT == 0 and self._VMState & VMState.BREAK == 0:
            self.StepInto()

    def ExecuteOp(self, opcode, context):
        estack = self._EvaluationStack
        istack = self._InvocationStack
        astack = self._AltStack

        if opcode > PUSH16 and opcode != RET and context.PushOnly:
            self._VMState |= VMState.FAULT

        if opcode >= PUSHBYTES1 and opcode <= PUSHBYTES75:
            bytestoread = context.OpReader.ReadBytes(int.from_bytes(opcode, 'little'))
            estack.PushT(bytestoread)
        else:

            # push values
            pushops = [PUSHM1, PUSH1, PUSH2, PUSH3, PUSH4, PUSH5, PUSH6, PUSH7, PUSH8,
                       PUSH9, PUSH10, PUSH11, PUSH12, PUSH13, PUSH14, PUSH15, PUSH16]

            if opcode == PUSH0:
                estack.PushT(bytearray([0]))

            elif opcode == PUSHDATA1:
                lenngth = context.OpReader.ReadByte()
                estack.PushT(bytearray(context.OpReader.ReadBytes(lenngth)))
            elif opcode == PUSHDATA2:
                estack.PushT(context.OpReader.ReadBytes(context.OpReader.ReadUInt16()))
            elif opcode == PUSHDATA4:
                estack.PushT(context.OpReader.ReadBytes(context.OpReader.ReadUInt32()))
            elif opcode in pushops:
                # EvaluationStack.Push((int)opcode - (int)OpCode.PUSH1 + 1);
                topush = int.from_bytes(opcode, 'little') - int.from_bytes(PUSH1, 'little') + 1
                estack.PushT(topush)

            # control
            elif opcode == NOP:
                pass
            elif opcode in [JMP, JMPIF, JMPIFNOT]:
                offset_b = context.OpReader.ReadInt16()
                offset = context.InstructionPointer + offset_b - 3

                if offset < 0 or offset > len(context.Script):
                    self._VMState |= VMState.FAULT
                    return

                fValue = True
                if opcode > JMP:
                    fValue = estack.Pop().GetBoolean()
                    if opcode == JMPIFNOT:
                        fValue = not fValue
                if fValue:
                    context.SetInstructionPointer(offset)

            elif opcode == CALL:
                istack.PushT(context.Clone())
                context.SetInstructionPointer(context.InstructionPointer + 2)

                self.ExecuteOp(JMP, self.CurrentContext)

            elif opcode == RET:
                istack.Pop().Dispose()
                if istack.Count == 0:
                    self._VMState |= VMState.HALT

            elif opcode == APPCALL or opcode == TAILCALL:
                if self._Table is None:
                    self._VMState |= VMState.FAULT
                    return

                script_hash = context.OpReader.ReadBytes(20)

                is_normal_call = False
                for b in script_hash:
                    if b > 0:
                        is_normal_call = True

                if not is_normal_call:
                    script_hash = self.EvaluationStack.Pop().GetByteArray()

                script = self._Table.GetScript(UInt160(data=script_hash).ToBytes())

                if script is None:
                    logger.error("Could not find script from script table: %s " % script_hash)
                    self._VMState |= VMState.FAULT
                    return

                if opcode == TAILCALL:
                    istack.Pop().Dispose()

                self.LoadScript(script)

            elif opcode == SYSCALL:
                call = context.OpReader.ReadVarBytes(252).decode('ascii')
                if not self._Service.Invoke(call, self):
                    self._VMState |= VMState.FAULT

            # stack operations
            elif opcode == DUPFROMALTSTACK:
                estack.PushT(astack.Peek())

            elif opcode == TOALTSTACK:
                astack.PushT(estack.Pop())

            elif opcode == FROMALTSTACK:
                estack.PushT(astack.Pop())

            elif opcode == XDROP:
                n = estack.Pop().GetBigInteger()
                if n < 0:
                    self._VMState |= VMState.FAULT
                    return
                estack.Remove(n)

            elif opcode == XSWAP:
                n = estack.Pop().GetBigInteger()

                if n < 0:
                    self._VMState |= VMState.FAULT
                    return

                # if n == 0 break, same as do x if n > 0
                if n > 0:

                    item = estack.Peek(n)
                    estack.Set(n, estack.Peek())
                    estack.Set(0, item)

            elif opcode == XTUCK:
                n = estack.Pop().GetBigInteger()

                if n <= 0:
                    self._VMState |= VMState.FAULT
                    return

                estack.Insert(n, estack.Peek())

            elif opcode == DEPTH:
                estack.PushT(estack.Count)

            elif opcode == DROP:
                estack.Pop()

            elif opcode == DUP:
                estack.PushT(estack.Peek())

            elif opcode == NIP:
                x2 = estack.Pop()
                estack.Pop()
                estack.PushT(x2)

            elif opcode == OVER:

                x2 = estack.Pop()
                x1 = estack.Peek()
                estack.PushT(x2)
                estack.PushT(x1)

            elif opcode == PICK:

                n = estack.Pop().GetBigInteger()
                if n < 0:
                    self._VMState |= VMState.FAULT
                    return

                estack.PushT(estack.Peek(n))

            elif opcode == ROLL:

                n = estack.Pop().GetBigInteger()
                if n < 0:
                    self._VMState |= VMState.FAULT
                    return

                if n > 0:
                    estack.PushT(estack.Remove(n))

            elif opcode == ROT:
                x3 = estack.Pop()
                x2 = estack.Pop()
                x1 = estack.Pop()

                estack.PushT(x2)
                estack.PushT(x3)
                estack.PushT(x1)

            elif opcode == SWAP:

                x2 = estack.Pop()
                x1 = estack.Pop()
                estack.PushT(x2)
                estack.PushT(x1)

            elif opcode == TUCK:

                x2 = estack.Pop()
                x1 = estack.Pop()
                estack.PushT(x2)
                estack.PushT(x1)
                estack.PushT(x2)

            elif opcode == CAT:

                x2 = estack.Pop().GetByteArray()
                x1 = estack.Pop().GetByteArray()
                estack.PushT(x1 + x2)

            elif opcode == SUBSTR:

                count = estack.Pop().GetBigInteger()
                if count < 0:
                    self._VMState |= VMState.FAULT
                    return

                index = estack.Pop().GetBigInteger()
                if index < 0:
                    self._VMState |= VMState.FAULT
                    return

                x = estack.Pop().GetByteArray()

                estack.PushT(x[index:count + index])

            elif opcode == LEFT:

                count = estack.Pop().GetBigInteger()
                if count < 0:
                    self._VMState |= VMState.FAULT
                    return

                x = estack.Pop().GetByteArray()
                estack.PushT(x[:count])

            elif opcode == RIGHT:

                count = estack.Pop().GetBigInteger()
                if count < 0:
                    self._VMState |= VMState.FAULT
                    return

                x = estack.Pop().GetByteArray()
                if len(x) < count:
                    self._VMState |= VMState.FAULT
                    return

                estack.PushT(x[-count:])

            elif opcode == SIZE:

                x = estack.Pop().GetByteArray()
                estack.PushT(len(x))

            elif opcode == INVERT:

                x = estack.Pop().GetBigInteger()
                estack.PushT(~x)

            elif opcode == AND:

                x2 = estack.Pop().GetBigInteger()
                x1 = estack.Pop().GetBigInteger()

                estack.PushT(x1 & x2)

            elif opcode == OR:

                x2 = estack.Pop().GetBigInteger()
                x1 = estack.Pop().GetBigInteger()

                estack.PushT(x1 | x2)

            elif opcode == XOR:

                x2 = estack.Pop().GetBigInteger()
                x1 = estack.Pop().GetBigInteger()

                estack.PushT(x1 ^ x2)

            elif opcode == EQUAL:
                x2 = estack.Pop()
                x1 = estack.Pop()
                estack.PushT(x1.Equals(x2))

            # numeric

            elif opcode == INC:

                x = estack.Pop().GetBigInteger()
                estack.PushT(x + 1)

            elif opcode == DEC:

                x = estack.Pop().GetBigInteger()
                estack.PushT(x - 1)

            elif opcode == SIGN:

                # Make sure to implement sign for big integer
                x = estack.Pop().GetBigInteger()
                estack.PushT(x.Sign)

            elif opcode == NEGATE:

                x = estack.Pop().GetBigInteger()
                estack.PushT(-x)

            elif opcode == ABS:

                x = estack.Pop().GetBigInteger()
                estack.PushT(abs(x))

            elif opcode == NOT:

                x = estack.Pop().GetBigInteger()
                estack.PushT(not x)

            elif opcode == NZ:

                x = estack.Pop().GetBigInteger()
                estack.PushT(x is not 0)

            elif opcode == ADD:

                x2 = estack.Pop().GetBigInteger()
                x1 = estack.Pop().GetBigInteger()

                estack.PushT(x1 + x2)

            elif opcode == SUB:

                x2 = estack.Pop().GetBigInteger()
                x1 = estack.Pop().GetBigInteger()

                estack.PushT(x1 - x2)

            elif opcode == MUL:

                x2 = estack.Pop().GetBigInteger()
                x1 = estack.Pop().GetBigInteger()

                estack.PushT(x1 * x2)

            elif opcode == DIV:

                x2 = estack.Pop().GetBigInteger()
                x1 = estack.Pop().GetBigInteger()

                estack.PushT(x1 / x2)

            elif opcode == MOD:

                x2 = estack.Pop().GetBigInteger()
                x1 = estack.Pop().GetBigInteger()

                estack.PushT(x1 % x2)

            elif opcode == SHL:

                n = estack.Pop().GetBigInteger()
                x = estack.Pop().GetBigInteger()

                estack.PushT(x << n)

            elif opcode == SHR:

                n = estack.Pop().GetBigInteger()
                x = estack.Pop().GetBigInteger()

                estack.PushT(x >> n)

            elif opcode == BOOLAND:

                x2 = estack.Pop().GetBoolean()
                x1 = estack.Pop().GetBoolean()

                estack.PushT(x1 and x2)

            elif opcode == BOOLOR:

                x2 = estack.Pop().GetBoolean()
                x1 = estack.Pop().GetBoolean()

                estack.PushT(x1 or x2)

            elif opcode == NUMEQUAL:

                x2 = estack.Pop().GetBigInteger()
                x1 = estack.Pop().GetBigInteger()

                estack.PushT(x2 == x1)

            elif opcode == NUMNOTEQUAL:

                x2 = estack.Pop().GetBigInteger()
                x1 = estack.Pop().GetBigInteger()

                estack.PushT(x1 != x2)

            elif opcode == LT:

                x2 = estack.Pop().GetBigInteger()
                x1 = estack.Pop().GetBigInteger()

                estack.PushT(x1 < x2)

            elif opcode == GT:

                x2 = estack.Pop().GetBigInteger()
                x1 = estack.Pop().GetBigInteger()

                estack.PushT(x1 > x2)

            elif opcode == LTE:

                x2 = estack.Pop().GetBigInteger()
                x1 = estack.Pop().GetBigInteger()

                estack.PushT(x1 <= x2)

            elif opcode == GTE:

                x2 = estack.Pop().GetBigInteger()
                x1 = estack.Pop().GetBigInteger()

                estack.PushT(x1 >= x2)

            elif opcode == MIN:

                x2 = estack.Pop().GetBigInteger()
                x1 = estack.Pop().GetBigInteger()

                estack.PushT(min(x1, x2))

            elif opcode == MAX:

                x2 = estack.Pop().GetBigInteger()
                x1 = estack.Pop().GetBigInteger()

                estack.PushT(max(x1, x2))

            elif opcode == WITHIN:

                b = estack.Pop().GetBigInteger()
                a = estack.Pop().GetBigInteger()
                x = estack.Pop().GetBigInteger()

                estack.PushT(a <= x and x < b)

            # CRyPTO
            elif opcode == SHA1:
                h = hashlib.sha1(estack.Pop().GetByteArray())
                estack.PushT(h.digest())

            elif opcode == SHA256:
                h = hashlib.sha256(estack.Pop().GetByteArray())
                estack.PushT(h.digest())

            elif opcode == HASH160:

                estack.PushT(self.Crypto.Hash160(estack.Pop().GetByteArray()))

            elif opcode == HASH256:

                estack.PushT(self.Crypto.Hash256(estack.Pop().GetByteArray()))

            elif opcode == CHECKSIG:

                pubkey = estack.Pop().GetByteArray()
                sig = estack.Pop().GetByteArray()

                try:

                    res = self.Crypto.VerifySignature(self.ScriptContainer.GetMessage(), sig, pubkey)
                    estack.PushT(res)

                except Exception as e:
                    estack.PushT(False)
                    traceback.print_stack()
                    traceback.print_exc()

            elif opcode == CHECKMULTISIG:

                n = estack.Pop().GetBigInteger()

                if n < 1:
                    self._VMState |= VMState.FAULT
                    return

                pubkeys = []
                for i in range(0, n):
                    pubkeys.append(estack.Pop().GetByteArray())

                m = estack.Pop().GetBigInteger()

                if m < 1 or m > n:
                    self._VMState |= VMState.FAULT
                    return

                sigs = []

                for i in range(0, m):
                    sigs.append(estack.Pop().GetByteArray())

                message = self.ScriptContainer.GetMessage() if self.ScriptContainer else ''

                fSuccess = True

                try:

                    i = 0
                    j = 0

                    while fSuccess and i < m and j < n:

                        if self.Crypto.VerifySignature(message, sigs[i], pubkeys[j]):
                            i += 1
                        j += 1

                        if m - i > n - j:
                            fSuccess = False

                except Exception as e:
                    fSuccess = False

                estack.PushT(fSuccess)

            # lists
            elif opcode == ARRAYSIZE:

                item = estack.Pop()

                if not item:
                    self._VMState |= VMState.FAULT
                    return

                if not item.IsArray:
                    estack.PushT(len(item.GetByteArray()))

                else:
                    estack.PushT(len(item.GetArray()))

            elif opcode == PACK:

                size = estack.Pop().GetBigInteger()

                if size < 0 or size > estack.Count:
                    self._VMState |= VMState.FAULT
                    return

                items = []

                for i in range(0, size):
                    topack = estack.Pop()
                    items.append(topack)

                estack.PushT(items)

            elif opcode == UNPACK:
                item = estack.Pop()

                if not item.IsArray:
                    self._VMState |= VMState.FAULT
                    return

                items = item.GetArray()
                items.reverse()

                [estack.PushT(i) for i in items]

                estack.PushT(len(items))

            elif opcode == PICKITEM:

                index = estack.Pop().GetBigInteger()

                if index < 0:
                    self._VMState |= VMState.FAULT
                    return

                item = estack.Pop()

                if not item.IsArray:
                    self._VMState |= VMState.FAULT
                    return

                items = item.GetArray()

                if index >= len(items):
                    self._VMState |= VMState.FAULT
                    return

                to_pick = items[index]
                estack.PushT(to_pick)

            elif opcode == SETITEM:
                newItem = estack.Pop()

                if issubclass(type(newItem), StackItem) and newItem.IsStruct:
                    newItem = newItem.Clone()

                index = estack.Pop().GetBigInteger()

                arrItem = estack.Pop()

                if not issubclass(type(arrItem), StackItem) or not arrItem.IsArray:
                    self._VMState |= VMState.FAULT
                    return

                items = arrItem.GetArray()

                if index < 0 or index >= len(items):
                    self._VMState |= VMState.FAULT
                    return

                items[index] = newItem

            elif opcode == NEWARRAY:

                count = estack.Pop().GetBigInteger()
                items = [None for i in range(0, count)]
                estack.PushT(Array(items))

            elif opcode == NEWSTRUCT:

                count = estack.Pop().GetBigInteger()

                items = [None for i in range(0, count)]

                estack.PushT(Struct(items))

            elif opcode == APPEND:
                newItem = estack.Pop()

                if type(newItem) is Struct:
                    newItem = newItem.Clone()

                arrItem = estack.Pop()

                if not arrItem.IsArray:
                    self._VMState |= VMState.FAULT
                    return

                arr = arrItem.GetArray()
                arr.append(newItem)

            elif opcode == REVERSE:

                arrItem = estack.Pop()
                if not arrItem.IsArray:
                    self._VMState |= VMState.FAULT
                    return
                arrItem.GetArray().reverse()

            elif opcode == REMOVE:
                index = estack.Pop().GetBigInteger()
                arrItem = estack.Pop()
                if not arrItem.IsArray:
                    self._VMState |= VMState.FAULT
                    return
                items = arrItem.GetArray()

                if index < 0 or index >= len(items):
                    self._VMState |= VMState.FAULT
                    return
                del items[index]

            elif opcode == THROW:
                self._VMState |= VMState.FAULT
                return

            elif opcode == THROWIFNOT:
                if not estack.Pop().GetBoolean():
                    self._VMState |= VMState.FAULT
                    return

            elif opcode == DEBUG:
                pdb.set_trace()
                return

            else:

                self._VMState |= VMState.FAULT
                return

        if self._VMState & VMState.FAULT == 0 and self.InvocationStack.Count > 0:

            if self.CurrentContext.InstructionPointer in self.CurrentContext.Breakpoints:
                self._VMState |= VMState.BREAK

    def LoadScript(self, script, push_only=False):

        context = ExecutionContext(self, script, push_only)
        self._InvocationStack.PushT(context)

        self._ExecutedScriptHashes.append(context.ScriptHash())

    def RemoveBreakPoint(self, position):

        if self._InvocationStack.Count == 0:
            return False
        return self.CurrentContext.Breakpoints.remove(position)

    def StepInto(self):
        if self._InvocationStack.Count == 0:
            logger.info("INVOCATION COUNT IS 0, HALT")
            self._VMState |= VMState.HALT

        if self._VMState & VMState.HALT > 0 or self._VMState & VMState.FAULT > 0:
            logger.info("stopping because vm state is %s " % self._VMState)
            return

        op = None

        if self.CurrentContext.InstructionPointer >= len(self.CurrentContext.Script):
            op = RET
        else:
            op = self.CurrentContext.OpReader.ReadByte(do_ord=False)

#        opname = ToName(op)
#        logger.info("____________________________________________________")
#        logger.info("[%s] %02x -> %s" % (self.ops_processed,int.from_bytes(op,byteorder='little'), opname))
#        logger.info("-----------------------------------")

        self.ops_processed += 1

        try:
            self.ExecuteOp(op, self.CurrentContext)
        except Exception as e:
            logger.error("COULD NOT EXECUTE OP: %s %s %s" % (e, op, ToName(op)))
            logger.exception(e)

    def StepOut(self):
        self._VMState &= ~VMState.BREAK
        count = self._InvocationStack.Count

        while self._VMState & VMState.HALT == 0 and \
                self._VMState & VMState.FAULT == 0 and \
                self._VMState & VMState.BREAK == 0 and \
                self._InvocationStack.Count > count:

            self.StepInto()

    def StepOver(self):
        if self._VMState & VMState.HALT > 0 or self._VMState & VMState.FAULT > 0:
            return

        self._VMState &= ~VMState.BREAK
        count = self._InvocationStack.Count

        while self._VMState & VMState.HALT == 0 and \
                self._VMState & VMState.FAULT == 0 and \
                self._VMState & VMState.BREAK == 0 and \
                self._InvocationStack.Count > count:

            self.StepInto()


text:
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')

describe "Checkpoint::Sessions" do
  include Rack::Test::Methods

  def app
    Checkpoint::Sessions::App
  end

  it "should display login form to unauthenticated user" do
    get '/sso/login'
    last_response.status.should == 401
    last_response.body.should include("log in")
  end

  it "should not log in unconfirmed user" do
    user = Factory(:unconfirmed_user, :password => "sesh_path", :password_confirmation => "sesh_path")
    post '/sso/login', :email => user.email, :password => "sesh_path"
    last_response.status.should == 401
  end

  it "should login user with valid credentials" do
    user = Factory(:user, :password => "sesh_path", :password_confirmation => "sesh_path")
    post '/sso/login', :email => user.email, :password => "sesh_path"
    last_response.status.should == 302
  end

  it "should not login user without valid credentials" do
    user = Factory.attributes_for(:user)
    post '/sso/login', :email => user[:email], :password => user[:password]
    last_response.status.should == 401
  end

  it "should log out user" do
    user = Factory(:user, :password => "sesh_path", :password_confirmation => "sesh_path")
    post '/sso/login', :email => user.email, :password => "sesh_path"

    get '/sso/login'
    last_response.status.should == 302

    get '/sso/logout'
    get '/sso/login'
    last_response.status.should == 401
  end

end


text:
title: Doc Issues
description: Explains the process involved in accepting documentation updates.
weight: 60
aliases:
    - /docs/welcome/contribute/reviewing-doc-issues.html
---

This page explains how documentation issues are reviewed and prioritized for the
[istio/istio.github.io](https://github.com/istio/istio.github.io) repository.
The purpose is to provide a way to organize issues and make it easier to contribute to
Istio documentation. The following should be used as the standard way of prioritizing,
labeling, and interacting with issues.

## Prioritizing Issues

The following labels and definitions should be used to prioritize issues. If you change the priority of an issue, please comment on
the issue with your reasoning for the change.

    P1

Major content errors affecting more than 1 page

Broken code sample on a heavily trafficked page

Errors on a "getting started" page

Well known or highly publicized customer pain points

Automation issues

    P2

Default for all new issues

Broken code for sample that is not heavily used

Minor content issues in a heavily trafficked page

Major content issues on a lower-trafficked page

    P3

Typos and broken anchor links

## Handling special issue types

If a single problem has one or more issues open for it, the problem should be consolidated into a single issue. You should decide which issue to keep open
(or open a new issue), port over all relevant information, link related issues, and close all the other issues that describe the same problem. Only having
a single issue to work on will help reduce confusion and avoid duplicating work on the same problem.

Depending on where a dead link is reported, different actions are required to resolve the issue. Dead links in the reference
docs are automation issues and should be assigned a P1 until the problem can be fully understood. All other dead links are issues
that need to be manually fixed and can be assigned a P3.


text:
#include "stdafx.h"

Ragdoll::Ragdoll(int id) : PhysicsObject(id),
frozen(false),drawDebugLines(false),particle(0),link(0),numParticles(0),numLinks(0),
damping(0),particleInvMass(1.0f)
{
	useExternalMatrix(true);
}

Ragdoll::~Ragdoll()
{
}

ePhysError Ragdoll::setRagdollMass(float mass)
{
	if(mass<=0.0f) return PERR_BAD_PARAMETER;

	return PERR_AOK;
}

ePhysError Ragdoll::fixPoint(int pntNo, bool fixed)
{
	if(pntNo<0 || pntNo>=numParticles) return PERR_BAD_PARAMETER;
	particle[pntNo].fixed = fixed;
	particle[pntNo].lastPos=particle[pntNo].pos; //Need this to remove apparent velocity from particle
	return PERR_AOK;
}

ePhysError Ragdoll::fixPoints(float px, float py, float pz, float radius, bool fixed)
{
	if(radius<0) return PERR_BAD_PARAMETER;

	float radSq=radius*radius;
	Vector3 stickyPos(px,py,pz);

	RagdollParticle * curParticle = &particle[0];

	for(int i=0;i<numParticles;i++,curParticle++)
	{
		if((curParticle->pos-stickyPos).MagSqr()<=radSq)
		{
			curParticle->fixed=fixed;
			curParticle->lastPos=curParticle->pos; //Need this to remove apparent velocity from particle
		}
	}
	return PERR_AOK;
}

ePhysError Ragdoll::fixPoints(float px, float py, float pz, float sx, float sy, float sz, bool fixed)
{
	if(sx<=0.0f || sy<=0.0f || sz<=0.0f) return PERR_BAD_PARAMETER;

	Vector3 minp(px-0.5f*sx,py-0.5f*sy,pz-0.5f*sz);
	Vector3 maxp(px+0.5f*sx,py+0.5f*sy,pz+0.5f*sz);

	RagdollParticle * curParticle = &particle[0];

	for(int i=0;i<numParticles;i++,curParticle++)
	{
		if(curParticle->pos.x<maxp.x && curParticle->pos.y<maxp.y && curParticle->pos.z<maxp.z)
		{
			if(curParticle->pos.x>minp.x && curParticle->pos.y>minp.y && curParticle->pos.z>minp.z)
			{
				curParticle->fixed=fixed;
				curParticle->lastPos=curParticle->pos; //Need this to remove apparent velocity from particle
			}
		}
	}
	return PERR_AOK;
}

ePhysError Ragdoll::fixNearestPoint(float px, float py, float pz, bool fixed)
{
	float minRadSq=1e38f;
	Vector3 stickyPos(px,py,pz);

	RagdollParticle * curParticle = &particle[0];
	RagdollParticle * minParticle = 0;

	for(int i=0;i<numParticles;i++,curParticle++)
	{
		float curRadSq = (curParticle->pos-stickyPos).MagSqr();
		if(curRadSq<minRadSq)
		{
			minParticle=curParticle;
			minRadSq=curRadSq;
		}
	}
	if(minParticle)
	{
		minParticle->fixed=fixed;
		minParticle->lastPos=minParticle->pos; //Need this to remove apparent velocity from particle
	}
	return PERR_AOK;
}

ePhysError Ragdoll::fixPointToObject(int pntNo, int objectID, Vector3 * pos)
{
	if(pntNo<0 || pntNo>=numParticles) return PERR_BAD_PARAMETER;
	if(!PhysicsManager::DLL_GetExists(objectID)) return PERR_ITEM_DOESNT_EXIST;

	particle[pntNo].fixed = true;
	particle[pntNo].objectID=objectID;

	//Check to see if we're already referring to the object
	if(refObjectID.Find(objectID)==-1)
	{
		//Make sure the object notifies us if it gets deleted
		refObjectID.Push(objectID);
		PhysicsManager::DLL_SetDeleteCallback(objectID,onAttachedObjectDeletedRagdollCallback,objId);
	}

	//Give particle the pointer	to the object's position information
	PhysicsManager::DLL_GetPositionData(objectID,&(particle[pntNo].DBProPosition));

	if(!pos)
	{
		//Calculate the local position on the target object
		Matrix mat,invMat;
		mat.convertD3DMatrix(&(particle[pntNo].DBProPosition->matWorld));
		invMat.getInverse3x3Of(mat);
		particle[pntNo].fixedPos=particle[pntNo].pos;
		particle[pntNo].fixedPos-=mat.pos();
		invMat.rotateV3(&particle[pntNo].fixedPos);
	}
	else
	{
		particle[pntNo].fixedPos=*pos;
	}
	particle[pntNo].lastPos=particle[pntNo].pos; //Need this to remove apparent velocity from particle
	return PERR_AOK;
}

ePhysError Ragdoll::freeAllPoints()
{
	for(int i=0;i<numParticles;i++)
	{
		if(particle[i].fixed)
		{
			particle[i].fixed=false;
			particle[i].objectID=-1;
			particle[i].DBProPosition=0;
		}
	}
	refObjectID.Clear();
	return PERR_AOK;
}

ePhysError Ragdoll::freePointsOnObject(int objectID)
{
	int objIndex = refObjectID.Find(objectID);
	if(objIndex==-1) return PERR_ITEM_DOESNT_EXIST;

	for(int i=0;i<numParticles;i++)
	{
		if(particle[i].fixed && particle[i].objectID==objectID)
		{
			particle[i].fixed=false;
			particle[i].objectID=-1;
			particle[i].DBProPosition=0;
		}
	}
	refObjectID.Remove(objIndex);
	return PERR_AOK;
}

ePhysError Ragdoll::freePointsOnAllObjects()
{
	if(refObjectID.Count()==0) return PERR_AOK;
	for(int i=0;i<numParticles;i++)
	{
		if(particle[i].fixed && particle[i].objectID!=-1)
		{
			particle[i].fixed=false;
			particle[i].objectID=-1;
			particle[i].DBProPosition=0;
		}
	}
	refObjectID.Clear();
	return PERR_AOK;
}

ePhysError Ragdoll::applyForce(int pointId, float fx, float fy, float fz)
{
	if(pointId<0 || pointId>=numParticles) return PERR_BAD_PARAMETER;
	particle[pointId].force.x+=fx;
	particle[pointId].force.y+=fy;
	particle[pointId].force.z+=fz;
	return PERR_AOK;
}

ePhysError Ragdoll::applyImpulse(int pointId, float ix, float iy, float iz)
{
	if(pointId<0 || pointId>=numParticles) return PERR_BAD_PARAMETER;
	particle[pointId].pos.x+=ix*PhysicsManager::iterationInterval;
	particle[pointId].pos.y+=iy*PhysicsManager::iterationInterval;
	particle[pointId].pos.z+=iz*PhysicsManager::iterationInterval;
	return PERR_AOK;
}

/*
ePhysError Cloth::saveClothState(const char * filename)
{
	if(!hasMesh) return PERR_CLOTH_NOT_GENERATED;

	//Append .clt to the end if it's not already there
	int len = (int)strlen(filename);
	char fname[512];
	if(strcmpi(&filename[len-4],".clt")!=0)
	{
		sprintf(fname,"%s.clt",filename);
	}
	else strcpy(fname,filename);

	FILE * file;
	file = fopen(fname,"wb");

	if(!file) return PERR_CANT_CREATE_SAVE_FILE;

	//Write out a header
	char fileID[19] = "PHYSICS:CLOTH001.0";
	if(!fwrite(fileID,19,1,file)) {fclose(file);return PERR_IO_FILE_ERROR;}

	if(!saveParams(file)) {fclose(file);return PERR_IO_FILE_ERROR;}
	for(int i=0;i<numParticles;i++)
	{
		if(!particle[i].saveParams(file)) {fclose(file);return PERR_IO_FILE_ERROR;}
	}
	for(int i=0;i<numSegs;i++)
	{
		if(!segment[i].saveParams(file,&particle[0])) {fclose(file);return PERR_IO_FILE_ERROR;}
	}
	fclose(file);
	return PERR_AOK;
}

ePhysError Cloth::loadClothState(const char * filename, bool useVelocities)
{
	if(hasMesh) return PERR_CLOTH_ALREADY_GENERATED;

	//Append .clt to the end if it's not already there
	int len = (int)strlen(filename);
	char fname[512];
	if(strcmpi(&filename[len-4],".clt")!=0)
	{
		sprintf(fname,"%s.clt",filename);
	}
	else strcpy(fname,filename);

	FILE * file;
	file = fopen(fname,"rb");
	if(!file) return PERR_CANT_LOAD_FILE;

	//Read and check the header
	char fileID[19];
	fread(fileID,19,1,file);
	if(strcmp("PHYSICS:CLOTH001.0",fileID)!=0) {fclose(file);return PERR_INCORRECT_FILE_FORMAT;}

	if(!loadParams(file)) {fclose(file);return PERR_IO_FILE_ERROR;}
	particle = new ClothParticle[numParticles];
	segment = new ClothSegment[numSegs];

	for(int i=0;i<numParticles;i++)
	{
		if(!particle[i].loadParams(file)) {fclose(file);return PERR_IO_FILE_ERROR;}
		if(particle[i].fixed && particle[i].objectID!=-1)
		{
			//Check to see if we're already referring to the object
			if(refObjectID.Find(particle[i].objectID)==-1)
			{
				//Make sure the object notifies us if it gets deleted
				refObjectID.Push(particle[i].objectID);
				PhysicsManager::DLL_SetDeleteCallback(particle[i].objectID,onAttachedObjectDeletedCallback,0);
			}
		}
	}
	for(int i=0;i<numSegs;i++)
	{
		if(!segment[i].loadParams(file,&particle[0])) {fclose(file);return PERR_IO_FILE_ERROR;}
	}
	fclose(file);

	if(!useVelocities)
	{
		for(int i=0;i<numParticles;i++)
		{
			particle[i].lastPos=particle[i].pos;
		}
	}

	allocateGraphicsAndInit(false);
	hasMesh=true;
	return PERR_AOK;
}

bool Cloth::saveParams(FILE * file)
{
	if(!fwrite(&numParticles,sizeof(int),1,file)) return false;
	if(!fwrite(&numTriangles,sizeof(int),1,file)) return false;
	if(!fwrite(&numSegs,sizeof(int),1,file)) return false;
	if(!fwrite(&elastic_USER,sizeof(float),1,file)) return false;
	if(!fwrite(&mass_USER,sizeof(float),1,file)) return false;
	if(!fwrite(&particleInvMass,sizeof(float),1,file)) return false;
	if(!fwrite(&clothStiffness,sizeof(float),1,file)) return false;
	return true;
}

bool Cloth::loadParams(FILE * file)
{
	if(!fread(&numParticles,sizeof(int),1,file)) return false;
	if(!fread(&numTriangles,sizeof(int),1,file)) return false;
	if(!fread(&numSegs,sizeof(int),1,file)) return false;
	if(!fread(&elastic_USER,sizeof(float),1,file)) return false;
	if(!fread(&mass_USER,sizeof(float),1,file)) return false;
	if(!fread(&particleInvMass,sizeof(float),1,file)) return false;
	if(!fread(&clothStiffness,sizeof(float),1,file)) return false;
	return true;
}

bool ClothParticle::saveParams(FILE * file)
{
	if(!fwrite(&pos,sizeof(Vector3),1,file)) return false;
	if(!fwrite(&lastPos,sizeof(Vector3),1,file)) return false;
	if(!fwrite(&segmentWeighting,sizeof(float),1,file)) return false;
	if(!fwrite(&triWeighting,sizeof(float),1,file)) return false;
	if(!fwrite(&fixed,sizeof(bool),1,file)) return false;
	if(!fwrite(&objectID,sizeof(int),1,file)) return false;
	if(!fwrite(&fixedPos,sizeof(Vector3),1,file)) return false;
	if(!fwrite(&u,sizeof(float),1,file)) return false;
	if(!fwrite(&v,sizeof(float),1,file)) return false;
	return true;
}

bool ClothParticle::loadParams(FILE * file)
{
	if(!fread(&pos,sizeof(Vector3),1,file)) return false;
	if(!fread(&lastPos,sizeof(Vector3),1,file)) return false;
	if(!fread(&segmentWeighting,sizeof(float),1,file)) return false;
	if(!fread(&triWeighting,sizeof(float),1,file)) return false;
	if(!fread(&fixed,sizeof(bool),1,file)) return false;
	if(!fread(&objectID,sizeof(int),1,file)) return false;
	if(!fread(&fixedPos,sizeof(Vector3),1,file)) return false;
	if(!fread(&u,sizeof(float),1,file)) return false;
	if(!fread(&v,sizeof(float),1,file)) return false;

	if(fixed && objectID!=-1)
	{
		//Reassign cloth to object
		if(PhysicsManager::DLL_GetExists(objectID))
		{
			PhysicsManager::DLL_GetPositionData(objectID,&DBProPosition);
		}
		else
		{
			objectID=-1;
			DBProPosition=0;
		}
	}

	return true;
}

bool ClothSegment::saveParams(FILE * file, ClothParticle * base)
{
	int p[4];
	p[0]=(int)(particle[0]-base);
	p[1]=(int)(particle[1]-base);
	p[2]=(int)(particle[2]-base);
	if(particle[3]) p[3]=(int)(particle[3]-base);
	else p[3]=-1;

	if(!fwrite(p,sizeof(int)*4,1,file)) return false;
	if(!fwrite(distSq,sizeof(float)*6,1,file)) return false;
	if(!fwrite(&numParticles,sizeof(int),1,file)) return false;

	return true;
}

bool ClothSegment::loadParams(FILE * file, ClothParticle * base)
{
	int p[4];
	if(!fread(p,sizeof(int)*4,1,file)) return false;
	if(!fread(distSq,sizeof(float)*6,1,file)) return false;
	if(!fread(&numParticles,sizeof(int),1,file)) return false;

	particle[0] = base+p[0];
	particle[1] = base+p[1];
	particle[2] = base+p[2];
	if(p[3]!=-1) particle[3] = base+p[3];
	else particle[3]=0;

	return true;
}
*/

/*
void removeClothObjectReferences(ClothPtr& cloth, void * userData)
{
	//Gets called for each cloth
	int id = *((int*)userData);
	cloth->freePointsOnObject(id);
}

void onAttachedObjectDeletedCallback(int id, int userData)
{
	physics->callForEachCloth(removeClothObjectReferences,&id);
}
*/

void onAttachedObjectDeletedRagdollCallback(int id, int userData)
{
	RagdollPtr ragdoll;
	if(physics->getRagdoll(userData,ragdoll)!=PERR_AOK) return;
	if(!ragdoll->isValid()) return;
	ragdoll->freePointsOnObject(id);
}


text:
const { rdfType, owlFunctionalProperty } = require('../constants');
const memorize = require('../graph/memorize');

function isGraphqlList(g, iri) {
  return g[iri].isRelayConnection || !(g[iri][rdfType] && g[iri][rdfType].includes(owlFunctionalProperty));
}

module.exports = memorize(isGraphqlList, 'isGraphqlList');


text:
/* $Id: iptcrdr.h,v 1.21 2014/03/28 12:03:37 nanard Exp $ */
/* MiniUPnP project
 * http://miniupnp.free.fr/ or http://miniupnp.tuxfamily.org/
 * (c) 2006-2011 Thomas Bernard
 * This software is subject to the conditions detailed
 * in the LICENCE file provided within the distribution */

#ifndef IPTCRDR_H_INCLUDED
#define IPTCRDR_H_INCLUDED

#include "../commonrdr.h"

int
add_redirect_rule2(const char * ifname,
                   const char * rhost, unsigned short eport,
                   const char * iaddr, unsigned short iport, int proto,
                   const char * desc, unsigned int timestamp);

int
add_peer_redirect_rule2(const char * ifname,
                   const char * rhost, unsigned short rport,
                   const char * eaddr, unsigned short eport,
                   const char * iaddr, unsigned short iport, int proto,
                   const char * desc, unsigned int timestamp);

int
add_filter_rule2(const char * ifname,
                 const char * rhost, const char * iaddr,
                 unsigned short eport, unsigned short iport,
                 int proto, const char * desc);

int
delete_redirect_and_filter_rules(unsigned short eport, int proto);

int
add_peer_dscp_rule2(const char * ifname,
                   const char * rhost, unsigned short rport,
                   unsigned char dscp,
                   const char * iaddr, unsigned short iport, int proto,
                   const char * desc, unsigned int timestamp);

int get_nat_ext_addr(struct sockaddr* src, struct sockaddr *dst, uint8_t proto,
                     struct sockaddr* ret_ext);
int
get_peer_rule_by_index(int index,
                           char * ifname, unsigned short * eport,
                           char * iaddr, int iaddrlen, unsigned short * iport,
                           int * proto, char * desc, int desclen,
                           char * rhost, int rhostlen, unsigned short * rport,
                           unsigned int * timestamp,
                           u_int64_t * packets, u_int64_t * bytes);
int
get_nat_redirect_rule(const char * nat_chain_name, const char * ifname, unsigned short eport, int proto,
                  char * iaddr, int iaddrlen, unsigned short * iport,
                  char * desc, int desclen,
                  char * rhost, int rhostlen,
                  unsigned int * timestamp,
                  u_int64_t * packets, u_int64_t * bytes);

/* for debug */
int
list_redirect_rule(const char * ifname);

#endif


text:
.. _limited-http-methods:

===================================
Example with limited HTTP Methods
===================================

.. literalinclude:: limited-http-methods.py


text:
Game = {};

// var w = 450;
// var h = 600;
var w = 320; // window.innerWidth;
var h = 530; // window.innerHeight;
var score = 0;
var score_level_start = 0;
var best_score = 0;
var sound = false;
var playerSelected = 1;
var playID = 0;
var realm = 1;
var realms = [

    { // CLOUDS
        threshold: 3000,
        assets: {
            background: 'bg_clouds',
            platform: 'platform',
            cloud: 'cloud',
            spikes: 'spikes',
            win_message: 'Try our new \nSalami \nSnacks',
            win_icon: 'clouds_win_circle',
        }
    },

    { // ICE
        threshold: 4000,
        assets: {
            background: 'bg_ice',
            platform: 'platform_ice',
            cloud: 'snowflake',
            spikes: 'spikes_ice',
            win_message: 'Try our Italian \nTurkey Burgers',
            win_icon: 'ice_win_circle',
        }
    },

    { // BBQ
        threshold: 5000,
        assets: {
            background: 'bg_bbq',
            platform: 'platform_bbq',
            cloud: 'float_bbq',
            spikes: 'spikes_bbq',
            win_message: 'Try our \nMild Italian \nPure Pork \nSausage',
            win_icon: 'bbq_win_circle',
        }
    },

    { // KITCHEN
        threshold: 6000,
        assets: {
            background: 'bg_kitchen',
            platform: 'platform_kitchen',
            cloud: 'float_kitchen',
            spikes: 'spikes_kitchen',
            win_message: 'Try our \nMild Italian \nPure Pork \nSausage',
            win_icon: 'bbq_win_circle',
        }
    },

    { // TABLE
        threshold: 7000,
        assets: {
            background: 'bg_table',
            platform: 'platform_table',
            cloud: 'float_table',
            spikes: 'spikes_table',
            win_message: 'Try our \nMild Italian \nPure Pork \nSausage',
            win_icon: 'bbq_win_circle',
        }
    }

];

var filter;

var coupon = {
  available: false,
  displayed: false,
  captured: false,
  claimed: false,
  ignored: false
};

function rand(num){ return Math.floor(Math.random() * num) };

function createTitle(txt, icon) {
  var bar = game.add.graphics(0, 0);
  bar.beginFill(0x59afd7);
  bar.drawRect(0, 0, w, 42);
  var xPos = (this.game.device.desktop) ? 30 : 60;
  var title = game.add.text(xPos, 8, txt, { font: '18px Oswald', fill: '#fff' });
  title.setShadow(1, 1, 'rgba(0, 0, 0, 0.2)', 5);

  if (icon) {
    // bar.add
  }
}

function createGround(){
  var ground = game.add.sprite(0, 360, 'ground');
  // ground.scale.setTo(0.85, 0.85);
}

/*
var pause_ctrl = document.getElementById('control-pause');
pause_ctrl.onclick = function(){
  console.log('clicked pause');
  Phaser.GAMES[0].paused = true;
}
*/

function request(type, url, data, callback){
  var req = new XMLHttpRequest();
  req.onload = callback;
  req.open(type, url, true);
  req.setRequestHeader("Content-Type", "application/json");
  req.send(JSON.stringify(data));
}

Game.Boot = function (game) { };

Game.Boot.prototype = {
	preload: function () {
    game.stage.backgroundColor = '#87d1f2';
		game.load.image('loading', 'game/images/loading.png');
		game.load.image('loading2', 'game/images/loading2.png');
		game.load.image('orientation', 'game/images/orientation.png');
    // game.load.bitmapFont('kemco', 'fonts/kemco.png', 'fonts/kemco.xml');
	},
	create: function() {

    // game.scale.minWidth = w;
    // game.scale.minHeight = h;
    game.scale.width = w;
    game.scale.height = h;
    // game.scale.pageAlignHorizontally = true;
    // game.scale.pageAlignVertically = false;

    // game.scale.scaleMode = Phaser.ScaleManager.SHOW_ALL;
    game.scale.scaleMode = Phaser.ScaleManager.NO_SCALE;

    game.scale.setScreenSize();

    game.scale.forcePortrait = true;

		if (!this.game.device.desktop) {
			// document.body.style.backgroundColor="#87d1f2";
			// game.stage.scale.forceOrientation(false, true, 'orientation');
            // game.stage.scaleMode = Phaser.StageScaleMode.SHOW_ALL;
            // this.game.stage.scale.pageAlignHorizontally = true;
            // this.game.stage.scale.pageAlignVeritcally = true;
            // game.stage.scale.setShowAll();
            // game.stage.scale.refresh();

            // this.game.antialias = false;
            // game.smoothed = false;

        }

    // this.game.stage.scale.setScreenSize(true);

		this.game.state.start('Load');
    this.game.physics.startSystem(Phaser.Physics.ARCADE);
	}
};

Game.Load = function (game) { };

Game.Load.prototype = {
	preload: function () {

    preload_label = game.add.text(0, (h * 0.5) - 40, 'Loading...', { font: '32px kemco', fill: '#fff', stroke: '#000', strokeThickness: 5 });
    preload_label.x = (w - preload_label.width) * 0.5;

		preloading2 = game.add.sprite(w/2, h/2+15, 'loading2');
		preloading2.x -= preloading2.width/2;
		preloading = game.add.sprite(w/2, h/2+19, 'loading');
		preloading.x -= preloading.width/2;
		game.load.setPreloadSprite(preloading);

    game.load.image('logo', 'game/images/1-preplayscreen-Logo_agents.png');

		game.load.image('heart', 'game/images/heart.png');
    game.load.image('burger', 'game/images/food/burger.png');
    game.load.image('hotdog', 'game/images/food/hotdog.png');
    game.load.image('kebab', 'game/images/food/kebab.png');

		game.load.image('player_zoom', 'game/images/player_zoom.png');
	  // game.load.spritesheet('player', 'images/character/marc.png', 60, 77);

    game.load.spritesheet('p1', 'game/images/character/marc.png', 60, 77);
    game.load.spritesheet('p2', 'game/images/character/angelo.png', 60, 77);

    game.load.spritesheet('button_start', 'game/images/buttons/button_sprite_sheet.png', 193, 71);

		game.load.image('line', 'game/images/line.png');
    game.load.image('snow', 'game/images/snow.jpg');

		game.load.spritesheet('mute', 'game/images/mute.png', 28, 18);

    game.load.image('pausepic', 'game/images/pausepic.jpg');

    game.load.image('clouds_intro', 'game/images/1-preplayscreen-Clouds.png');
    game.load.image('character_intro', 'game/images/1-preplayscreen-Character.png');

    game.load.image('p1static', 'game/images/Marc-static.png');
    game.load.image('p2static', 'game/images/Angelo-static.png');

    game.load.image('facebook', 'game/images/4-GameShare-Facebook.png');
    game.load.image('instagram', 'game/images/4-GameShare-Instagram.png');
    game.load.image('twitter', 'game/images/4-GameShare-Twitter.png');
    game.load.image('email', 'game/images/4-GameShare-Email.png');

    game.load.image('btn_mainmenu', 'game/images/button-mainmenu.png');
    game.load.image('btn_playagain', 'game/images/button-playagain.png');
    game.load.image('btn_nextlevel', 'game/images/button-nextlevel.png');
    game.load.image('btn_resume', 'game/images/2-ingamePause-Resume.png');
    game.load.image('btn_coupon_yes', 'game/images/6-CouponWin-MailCoupon.png');
    game.load.image('btn_coupon_no', 'game/images/6-CouponWin-NoThanks.png');

    game.load.image('circleimage', 'game/images/circleimage.png');

    game.load.image('ground', 'game/images/3-leaderboard-Grass.png');

    // LEVEL CLOUDS
    game.load.image('bg_clouds', 'game/images/Background-game2.jpg');
    game.load.image('cloud', 'game/images/cloud1.png');
    game.load.image('platform', 'game/images/platform.png');
    game.load.image('spikes', 'game/images/spikes.png');
    game.load.image('clouds_win_circle', 'game/images/circleimage.png')

    // LEVEL ICE
    game.load.image('bg_ice', 'game/images/bg_ice.png');
    game.load.image('snowflake', 'game/images/snowflake.png');
    game.load.image('platform_ice', 'game/images/platform_ice.png');
    game.load.image('spikes_ice', 'game/images/spikes_ice.png');
    game.load.image('ice_win_circle', 'game/images/salami.png');

    // LEVEL BBQ
    game.load.image('bg_bbq', 'game/images/levels/bbq/bg_bbq.png');
    game.load.image('float_bbq', 'game/images/levels/bbq/smoke.png');
    game.load.image('platform_bbq', 'game/images/levels/bbq/platform_bbq.png');
    game.load.image('spikes_bbq', 'game/images/levels/bbq/spikes_bbq.png');
    game.load.image('bbq_win_circle', 'game/images/sausage.png');

    // LEVEL PICNIC
    game.load.image('bg_picnic', 'game/images/levels/picnic/bg_picnic.png');
    game.load.image('float_picnic', 'game/images/levels/picnic/plate.png');
    game.load.image('platform_picnic', 'game/images/levels/picnic/platform_picnic.png');
    game.load.image('spikes_picnic', 'game/images/levels/picnic/spikes_picnic.png');

    // LEVEL KITCHEN
    game.load.image('bg_kitchen', 'game/images/levels/kitchen/bg_kitchen.png');
    game.load.image('float_kitchen', 'game/images/levels/kitchen/steam.png');
    game.load.image('platform_kitchen', 'game/images/levels/kitchen/platform_kitchen.png');
    game.load.image('spikes_kitchen', 'game/images/levels/kitchen/spikes_kitchen.png');

    // LEVEL TABLE
    game.load.image('bg_table', 'game/images/levels/table/bg_wood.png');
    game.load.image('float_table', 'game/images/levels/table/napkin.png');
    game.load.image('platform_table', 'game/images/levels/table/platform_wood.png');
    game.load.image('spikes_table', 'game/images/levels/table/spikes_wood.png');

    // WIN
    game.load.image('bg_win', 'game/images/bg_win.png');
    game.load.image('btn_main_menu', 'game/images/btn_main_menu.png');

    // PRIZE
    game.load.image('prize', 'game/images/6-CouponWin-Coin1.png');
    game.load.image('prize_zoom', 'game/images/6-CouponWin-Coin3.png');

    /*
		game.load.audio('dead', 'sounds/dead.wav');
		game.load.audio('jump', 'sounds/jump.wav');
		game.load.audio('heart', 'sounds/heart.wav');
		game.load.audio('music', 'sounds/music.wav');
		game.load.audio('hit', 'sounds/hit.wav');
    */

    // game.load.script('filter', 'js/filters/Gray.js');

    // this.load.bitmapFont('minecraftia', 'fonts/minecraftia.png', 'fonts/minecraftia.xml');

	},
	create: function () {
		game.state.start('Menu');
	}
};


text:
import subprocess

import mock

from tempest.common import commands
from tempest.tests import base

class TestCommands(base.TestCase):

    def setUp(self):
        super(TestCommands, self).setUp()
        self.subprocess_args = {'stdout': subprocess.PIPE,
                                'stderr': subprocess.STDOUT}

    @mock.patch('subprocess.Popen')
    def test_ip_addr_raw(self, mock):
        expected = ['/usr/bin/sudo', '-n', 'ip', 'a']
        commands.ip_addr_raw()
        mock.assert_called_once_with(expected, **self.subprocess_args)

    @mock.patch('subprocess.Popen')
    def test_ip_route_raw(self, mock):
        expected = ['/usr/bin/sudo', '-n', 'ip', 'r']
        commands.ip_route_raw()
        mock.assert_called_once_with(expected, **self.subprocess_args)

    @mock.patch('subprocess.Popen')
    def test_ip_ns_raw(self, mock):
        expected = ['/usr/bin/sudo', '-n', 'ip', 'netns', 'list']
        commands.ip_ns_raw()
        mock.assert_called_once_with(expected, **self.subprocess_args)

    @mock.patch('subprocess.Popen')
    def test_iptables_raw(self, mock):
        table = 'filter'
        expected = ['/usr/bin/sudo', '-n', 'iptables', '--line-numbers',
                    '-L', '-nv', '-t',
                    '%s' % table]
        commands.iptables_raw(table)
        mock.assert_called_once_with(expected, **self.subprocess_args)

    @mock.patch('subprocess.Popen')
    def test_ip_ns_list(self, mock):
        expected = ['/usr/bin/sudo', '-n', 'ip', 'netns', 'list']
        commands.ip_ns_list()
        mock.assert_called_once_with(expected, **self.subprocess_args)

    @mock.patch('subprocess.Popen')
    def test_ip_ns_addr(self, mock):
        ns_list = commands.ip_ns_list()
        for ns in ns_list:
            expected = ['/usr/bin/sudo', '-n', 'ip', 'netns', 'exec', ns,
                        'ip', 'a']
            commands.ip_ns_addr(ns)
            mock.assert_called_once_with(expected, **self.subprocess_args)

    @mock.patch('subprocess.Popen')
    def test_ip_ns_route(self, mock):
        ns_list = commands.ip_ns_list()
        for ns in ns_list:
            expected = ['/usr/bin/sudo', '-n', 'ip', 'netns', 'exec', ns,
                        'ip', 'r']
            commands.ip_ns_route(ns)
            mock.assert_called_once_with(expected, **self.subprocess_args)

    @mock.patch('subprocess.Popen')
    def test_iptables_ns(self, mock):
        table = 'filter'
        ns_list = commands.ip_ns_list()
        for ns in ns_list:
            expected = ['/usr/bin/sudo', '-n', 'ip', 'netns', 'exec', ns,
                        'iptables', '-v', '-S', '-t', table]
            commands.iptables_ns(ns, table)
            mock.assert_called_once_with(expected, **self.subprocess_args)


text:
"use strict";

importScripts("/resources/testharness.js");
importScripts("/resources/WebIDLParser.js", "/resources/idlharness.js");

async_test(function(t) {
  var request = new XMLHttpRequest();
  request.open("GET", "domstringlist.idl");
  request.send();
  request.onload = t.step_func(function() {
    var idlArray = new IdlArray();
    var idls = request.responseText;

    idlArray.add_idls(idls);

    idlArray.add_objects({
      DOMStringList: [],
    });
    idlArray.test();
    t.done();
  });
});

done();


text: (window.webpackJsonp=window.webpackJsonp||[]).push([[3],{149:function(n,w,o){}}]);


text:
/* ==========================================================================
   $BASE-PICKER
   ========================================================================== */
/**
 * Note: the root picker element should *NOT* be styled more than what's here.
 */
.picker {
    font-size: 16px;
    text-align: left;
    line-height: 1.2;
    color: #000000;
    position: absolute;
    z-index: 10000;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    display: none;
}
/**
 * The picker input element.
 */
.picker__input {
    cursor: default;
}
/**
 * When the picker is opened, the input element is "activated".
 */
.picker__input.picker__input--active {
    border-color: #0089ec;
}
/**
 * The holder is the only "scrollable" top-level container element.
 */
.picker__holder {
    width: 100%;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

/*!
 * Classic picker styling for pickadate.js
 * Demo: http://amsul.github.io/pickadate.js
 */
/**
 * Note: the root picker element should *NOT* be styled more than what's here.
 */
.picker {
    width: 100%;
}
/**
 * The holder is the base of the picker.
 */
.picker__holder {
    position: absolute;
    background: #ffffff;
    border: 1px solid #aaaaaa;
    border-top-width: 0;
    border-bottom-width: 0;
    border-radius: 0 0 5px 5px;
    box-sizing: border-box;
    min-width: 176px;
    max-width: 466px;
    max-height: 0;
    -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=0)";
    filter: alpha(opacity=0);
    -moz-opacity: 0;
    opacity: 0;
    -webkit-transform: translateY(-1em) perspective(600px) rotateX(10deg);
    transform: translateY(-1em) perspective(600px) rotateX(10deg);
    transition: -webkit-transform 0.15s ease-out, opacity 0.15s ease-out, max-height 0s 0.15s, border-width 0s 0.15s;
    transition: transform 0.15s ease-out, opacity 0.15s ease-out, max-height 0s 0.15s, border-width 0s 0.15s;
}
/**
 * The frame and wrap work together to ensure that
 * clicks within the picker don't reach the holder.
 */
.picker__frame {
    padding: 1px;
}
.picker__wrap {
    margin: -1px;
}

.picker--opened{
    display: block;
}
/**
 * When the picker opens...
 */
.picker--opened .picker__holder {
    max-height: 25em;
    -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=100)";
    filter: alpha(opacity=100);
    -moz-opacity: 1;
    opacity: 1;
    border-top-width: 1px;
    border-bottom-width: 1px;
    -webkit-transform: translateY(0) perspective(600px) rotateX(0);
    transform: translateY(0) perspective(600px) rotateX(0);
    transition: -webkit-transform 0.15s ease-out, opacity 0.15s ease-out, max-height 0s, border-width 0s;
    transition: transform 0.15s ease-out, opacity 0.15s ease-out, max-height 0s, border-width 0s;
    box-shadow: 0 6px 18px 1px rgba(0, 0, 0, 0.12);
}

/* ==========================================================================
   $BASE-DATE-PICKER
   ========================================================================== */
/**
 * The picker box.
 */
.picker__box {
    padding: 0 1em;
}
/**
 * The header containing the month and year stuff.
 */
.picker__header {
    text-align: center;
    position: relative;
    margin-top: .75em;
}
/**
 * The month and year labels.
 */
.picker__month,
.picker__year {
    font-weight: 500;
    display: inline-block;
    margin-left: .25em;
    margin-right: .25em;
}
.picker__year {
    color: #999999;
    font-size: .8em;
    font-style: italic;
}
/**
 * The month and year selectors.
 */
.picker__select--month,
.picker__select--year {
    border: 1px solid #b7b7b7;
    height: 2em;
    padding: .5em;
    margin-left: .25em;
    margin-right: .25em;
}
@media (min-width: 24.5em) {
    .picker__select--month,
    .picker__select--year {
        margin-top: -0.5em;
    }
}
.picker__select--month {
    width: 35%;
}
.picker__select--year {
    width: 22.5%;
}
.picker__select--month:focus,
.picker__select--year:focus {
    border-color: #0089ec;
}
/**
 * The month navigation buttons.
 */
.picker__nav--prev,
.picker__nav--next {
    position: absolute;
    padding: .5em 1.25em;
    width: 1em;
    height: 1em;
    box-sizing: content-box;
    top: -0.25em;
}
@media (min-width: 24.5em) {
    .picker__nav--prev,
    .picker__nav--next {
        top: -0.33em;
    }
}
.picker__nav--prev {
    left: -1em;
    padding-right: 1.25em;
}
@media (min-width: 24.5em) {
    .picker__nav--prev {
        padding-right: 1.5em;
    }
}
.picker__nav--next {
    right: -1em;
    padding-left: 1.25em;
}
@media (min-width: 24.5em) {
    .picker__nav--next {
        padding-left: 1.5em;
    }
}
.picker__nav--prev:before,
.picker__nav--next:before {
    content: " ";
    border-top: .5em solid transparent;
    border-bottom: .5em solid transparent;
    border-right: 0.75em solid #000000;
    width: 0;
    height: 0;
    display: block;
    margin: 0 auto;
}
.picker__nav--next:before {
    border-right: 0;
    border-left: 0.75em solid #000000;
}
.picker__nav--prev:hover,
.picker__nav--next:hover {
    cursor: pointer;
    color: #000000;
    background: #b1dcfb;
}
.picker__nav--disabled,
.picker__nav--disabled:hover,
.picker__nav--disabled:before,
.picker__nav--disabled:before:hover {
    cursor: default;
    background: none;
    border-right-color: #f5f5f5;
    border-left-color: #f5f5f5;
}
/**
 * The calendar table of dates
 */
.picker__table {
    text-align: center;
    border-collapse: collapse;
    border-spacing: 0;
    table-layout: fixed;
    font-size: inherit;
    width: 100%;
    margin-top: .75em;
    margin-bottom: .5em;
}
@media (min-height: 33.875em) {
    .picker__table {
        margin-bottom: .75em;
    }
}
.picker__table td {
    margin: 0;
    padding: 0;
}
/**
 * The weekday labels
 */
.picker__weekday {
    width: 14.285714286%;
    font-size: .75em;
    padding-bottom: .25em;
    color: #999999;
    font-weight: 500;
    /* Increase the spacing a tad */
}
@media (min-height: 33.875em) {
    .picker__weekday {
        padding-bottom: .5em;
    }
}
/**
 * The days on the calendar
 */
.picker__day {
    padding: .3125em 0;
    font-weight: 200;
    border: 1px solid transparent;
}
.picker__day--today {
    position: relative;
}
.picker__day--today:before {
    content: " ";
    position: absolute;
    top: 2px;
    right: 2px;
    width: 0;
    height: 0;
    border-top: 0.5em solid #0059bc;
    border-left: .5em solid transparent;
}
.picker__day--disabled:before {
    border-top-color: #aaaaaa;
}
.picker__day--outfocus {
    color: #dddddd;
}
.picker__day--infocus:hover,
.picker__day--outfocus:hover {
    cursor: pointer;
    color: #000000;
    background: #b1dcfb;
}
.picker__day--highlighted {
    border-color: #0089ec;
}
.picker__day--highlighted:hover,
.picker--focused .picker__day--highlighted {
    cursor: pointer;
    color: #000000;
    background: #b1dcfb;
}
.picker__day--selected,
.picker__day--selected:hover,
.picker--focused .picker__day--selected {
    background: #0089ec;
    color: #ffffff;
}
.picker__day--disabled,
.picker__day--disabled:hover,
.picker--focused .picker__day--disabled {
    background: #f5f5f5;
    border-color: #f5f5f5;
    color: #dddddd;
    cursor: default;
}
.picker__day--highlighted.picker__day--disabled,
.picker__day--highlighted.picker__day--disabled:hover {
    background: #bbbbbb;
}
/**
 * The footer containing the "today", "clear", and "close" buttons.
 */
.picker__footer {
    text-align: center;
}
.picker__button--today,
.picker__button--clear,
.picker__button--close {
    border: 1px solid #ffffff;
    background: #ffffff;
    font-size: .8em;
    padding: .66em 0;
    font-weight: bold;
    width: 33%;
    display: inline-block;
    vertical-align: bottom;
}
.picker__button--today:hover,
.picker__button--clear:hover,
.picker__button--close:hover {
    cursor: pointer;
    color: #000000;
    background: #b1dcfb;
    border-bottom-color: #b1dcfb;
}
.picker__button--today:focus,
.picker__button--clear:focus,
.picker__button--close:focus {
    background: #b1dcfb;
    border-color: #0089ec;
    outline: none;
}
.picker__button--today:before,
.picker__button--clear:before,
.picker__button--close:before {
    position: relative;
    display: inline-block;
    height: 0;
}
.picker__button--today:before,
.picker__button--clear:before {
    content: " ";
    margin-right: .45em;
}
.picker__button--today:before {
    top: -0.05em;
    width: 0;
    border-top: 0.66em solid #0059bc;
    border-left: .66em solid transparent;
}
.picker__button--clear:before {
    top: -0.25em;
    width: .66em;
    border-top: 3px solid #ee2200;
}
.picker__button--close:before {
    content: "\D7";
    top: -0.1em;
    vertical-align: top;
    font-size: 1.1em;
    margin-right: .35em;
    color: #777777;
}
.picker__button--today[disabled],
.picker__button--today[disabled]:hover {
    background: #f5f5f5;
    border-color: #f5f5f5;
    color: #dddddd;
    cursor: default;
}
.picker__button--today[disabled]:before {
    border-top-color: #aaaaaa;
}

/* ==========================================================================
   $CLASSIC-DATE-PICKER
   ========================================================================== */


text:
  Definition ¶

Documentation

Backend

Classes

Definition

{% highlight javascript %}
// This example file exports a function that will have "Class" injected into it via the clever-injector
module.exports = function( Class ) {
  return Class.extend(
  /* @Class */
  {
    // Static attributes or methods
  },
  /* @Prototype */
  {
    // Instance attributes or methods
  });
};
{% endhighlight %}

Extend's arguments

You can call .extend() with only the Static/Class object instead of defining both


text:
package io.unravelling.ferguson.configuration;

import io.unravelling.ferguson.model.ServerType;

import java.util.Properties;

import org.apache.commons.lang3.EnumUtils;

/**
 * author Tiago Veiga Lazaro
 * version 1.0.0
 * since 1.0.0
 */
public final class FergusonConfiguration {

  /**
   * Type of the server (currently supported: EMS). See enum ServerType for more information.
   */
  public static final String SERVER_TYPE = "type";

  /**
   * Url to the server to be managed.
   */
  public static final String SERVER_URL = "url";

  /**
   * Username with administrative rights.
   */
  public static final String SERVER_USERNAME = "username";

  /**
   * Password for the supplied user. Ignores the warning of hardcoding password, as this is
   * the name of the property holding the password, rather than the password itself.
   */
  @SuppressWarnings({"squid:S2068"})
  public static final String SERVER_PASSWORD = "password";

  /**
   * Private constructor for the class to disable instantiation.
   */
  private FergusonConfiguration() {}

  /**
   * Validates the received configuration for the Ferguson library.
   * @param configuration Configuration on the form of properties.
   * @return True if configuration is valid.
   */
  public static boolean validateConfiguration(final Properties configuration) {

    return configuration != null
        && configuration.size() > 0
        && validateServerType(configuration)
        && validateServerUrl(configuration)
        && validateServerUsername(configuration)
        && validateServerPassword(configuration);
  }

  /**
   * Validates the server type that was supplied.
   * @param configuration Configuration of the server.
   * @return Boolean indicating if the server configuration is correct or not.
   */
  static boolean validateServerType(final Properties configuration) {

    return (configuration.containsKey(FergusonConfiguration.SERVER_TYPE)
        && EnumUtils.isValidEnum(ServerType.class,
        configuration.getProperty(FergusonConfiguration.SERVER_TYPE)));
  }

  /**
   * Validates the server URL that was supplied.
   * @param configuration Configuration of the server.
   * @return Boolean indicating if the server configuration is correct or not.
   */
  static boolean validateServerUrl(final Properties configuration) {

    return (configuration.containsKey(FergusonConfiguration.SERVER_URL)
        && !configuration.getProperty(FergusonConfiguration.SERVER_URL).isEmpty());
  }

  /**
   * Validates the server username that was supplied.
   * @param configuration Configuration of the server.
   * @return Boolean indicating if the server configuration is correct or not.
   */
  static boolean validateServerUsername(final Properties configuration) {

    return (configuration.containsKey(FergusonConfiguration.SERVER_USERNAME)
        && !configuration.getProperty(FergusonConfiguration.SERVER_USERNAME).isEmpty());
  }

  /**
   * Validates the server password that was supplied.
   * @param configuration Configuration of the server.
   * @return Boolean indicating if the server configuration is correct or not.
   */
  static boolean validateServerPassword(final Properties configuration) {

    return configuration.containsKey(FergusonConfiguration.SERVER_PASSWORD);
  }
}


text:
RSpec::Matchers.define :have_a_spec do

  description do
    'has a spec file'
  end

  match do |path|
    File.exist?( spec_file_for( path ) )
  end

  failure_message do |path|
    "expected #{path} to have spec at #{spec_file_for( path )}"
  end

  failure_message_when_negated do |path|
    "expected #{path} to not have spec at #{spec_file_for( path )}"
  end

  def spec_file_for( path )
    basename = File.basename( path, '.rb' ) + '_spec.rb'

    dirname = File.dirname( path )
    dirname.gsub!( /^app/, 'spec' )
    dirname.gsub!( /^lib/, 'spec/lib' )

    return File.join( dirname, basename )
  end
end


text:
using System;
using System.Data;
using System.Data.Common;

namespace Data.Net
{
    internal sealed class CommandBuilderAsync : IDisposable
    {
        private readonly DataParameters _parameters;

        private bool _outPutParam;

        internal readonly DbCommand Command;

        internal CommandBuilderAsync(string sql, IDbConnection connection, bool oracleProvider,
            DataParameters parameters = null, CommandType commandType = CommandType.Text)
        {
            Command = connection.CreateCommand() as DbCommand;
            Command.CommandText = sql ?? throw new ArgumentNullException(nameof(sql));
            Command.CommandType = commandType;
            Command.Connection = connection as DbConnection;

            if (oracleProvider)
            {
                var bindByName = Command.GetType().GetProperty("BindByName");
                bindByName?.SetValue(Command, true, null);
            }

            if (parameters == null) return;

            _parameters = parameters;

            AddParam();
        }

        private void AddParam()
        {
            foreach (var item in _parameters)
            {
                switch (item)
                {
                    case Parameter param:
                        Command.Parameters.Add(BuildParameter(param));
                        break;
                    case IDbDataParameter dataParameter:
                        Command.Parameters.Add(dataParameter);

                        if (!_outPutParam && dataParameter.Direction != 0 && dataParameter.Direction != ParameterDirection.Input) _outPutParam = true;

                        break;
                }
            }
        }

        private IDbDataParameter BuildParameter(Parameter parameter)
        {
            var p = Command.CreateParameter();
            p.ParameterName = parameter.Name;
            p.Value = parameter.Value ?? DBNull.Value;

            if (parameter.Direction == 0 || parameter.Direction == ParameterDirection.Input) return p;

            if (!_outPutParam) _outPutParam = true;

            p.DbType = parameter.DbType;
            p.Direction = parameter.Direction;
            p.Size = parameter.Size;
            return p;
        }

        internal void UpdateDataParameter()
        {
            if (!_outPutParam) return;

            foreach (var item in _parameters)
            {
                switch (item)
                {
                    case Parameter p when p.Direction != 0 && p.Direction != ParameterDirection.Input:
                        p.SetValue((Command.Parameters[p.Name] as IDbDataParameter)?.Value);
                        break;
                    case IDbDataParameter dp when dp.Direction != 0 && dp.Direction != ParameterDirection.Input:
                        dp.Value = (Command.Parameters[dp.ParameterName] as IDbDataParameter)?.Value;
                        break;
                }
            }
        }

        public void Dispose() => Command?.Dispose();
    }
}


text:
using System.Web.Http;

namespace CustomReceiver
{
    public static class WebApiConfig
    {
        public static void Register(HttpConfiguration config)
        {
            // Web API configuration and services

            // Web API routes
            config.MapHttpAttributeRoutes();

            config.Routes.MapHttpRoute(
                name: "DefaultApi",
                routeTemplate: "api/{controller}/{id}",
                defaults: new { id = RouteParameter.Optional }
            );

            // Initialize Custom WebHook receiver
            config.InitializeReceiveCustomWebHooks();
        }
    }
}


text:
import flipsta
from flipsta import Zero, One
from cost import Cost

class State:
    '''
    State whose identity depends on it being the same object.
    (Even though it's got a name.)
    '''
    def __init__ (self, name):
        self.name = name

    def __str__ (self):
        return str (self.name)

state2 = State ('two')

def make_automaton():

    automaton = flipsta.Automaton()

    assert (not automaton.has_state ("start"))
    assert (not automaton.has_state (3))

    automaton.add_state ("start")
    assert (automaton.has_state ("start"))
    assert (not automaton.has_state (3))

    assert (list (automaton.states()) == ["start"])

    automaton.add_state (1)
    automaton.add_state (state2)
    automaton.add_state (3)

    assert (list (automaton.states()) == ["start", 1, state2, 3])

    try:
        automaton.add_state (3)
        assert (False)
    except ValueError:
        pass

    automaton.add_arc ("start", 3, Cost (1.5))
    # Quick test that is used in the documentation.
    (arc,) = automaton.arcs_on (True, "start")
    assert (arc.state (False) == "start")
    assert (arc.state (True) == 3)
    assert (arc.label() == Cost (1.5))

    (arc,) = automaton.arcs_on (False, 3)
    assert (arc.state (False) == "start")
    assert (arc.state (True) == 3)
    assert (arc.label() == Cost (1.5))

    automaton.add_arc ("start", 1, Cost (2.))
    automaton.add_arc (1, state2, Cost (0.))
    automaton.add_arc (state2, 3, Cost (.5))

    # def printArc (arc):
    #     print arc.state (False), arc.state (True), arc.label().value

    # for state in automaton.states():
    #     print '***', state
    #     print '  in:'
    #     for arc in automaton.arcs_on (False, state):
    #         print '    ',
    #         printArc (arc)
    #     print '  out:'
    #     for arc in automaton.arcs_on (True, state):
    #         print '    ',
    #         printArc (arc)

    arcs = list (automaton.arcs_on (False, 3))
    assert (len (arcs) == 2)
    assert (arcs [0].state (False) == state2)
    assert (arcs [0].state (True) == 3)
    assert (arcs [0].label() == Cost (0.5))
    assert (arcs [1].state (False) == "start")
    assert (arcs [1].state (True) == 3)
    assert (arcs [1].label() == Cost (1.5))

    arcs = list (automaton.arcs_on (True, "start"))
    assert (len (arcs) == 2)
    assert (arcs[0].state (False) == "start")
    assert (arcs[0].state (True) == 1)
    assert (arcs[0].label() == Cost (2.))
    assert (arcs[1].state (False) == "start")
    assert (arcs[1].state (True) == 3)
    assert (arcs[1].label() == Cost (1.5))

    try:
        automaton.set_terminal_label (True, 5, Cost (1.))
        assert (False);
    except KeyError:
        pass

    automaton.set_terminal_label (True, "start", Cost (1.))
    automaton.set_terminal_label (False, 3, Cost (2.))
    automaton.set_terminal_label (True, 1, Zero)

    assert (list (automaton.terminal_states (True)) == [("start", Cost (1.))])
    assert (list (automaton.terminal_states (False)) == [(3, Cost (2.))])

    assert (automaton.terminal_label (True, "start") == Cost (1.))
    assert (automaton.terminal_label (True, 1) == Zero)

    assert (automaton.terminal_label (False, "start") == Zero)
    assert (automaton.terminal_label (False, 3) != Zero)
    assert (automaton.terminal_label (False, 3) == Cost (2.))

    return automaton

def make_acyclic_automaton():

    automaton = make_automaton()

    automaton.add_arc (state2, 1, Cost (1.))
    return automaton

make_automaton()

# Test topological order.

topologically_ordered = make_automaton().topological_order()
assert (list (topologically_ordered) == ["start", 1, state2, 3])

topologically_ordered = make_automaton().topological_order (True)
assert (list (topologically_ordered) == ["start", 1, state2, 3])

topologically_ordered = make_automaton().topological_order (False)
assert (list (topologically_ordered) == [3, state2, 1, "start"])

# We don't actually want to call this every time.
# make_automaton().draw ("./temporary_automaton.dot", True)

try:
    topologically_ordered = make_acyclic_automaton().topological_order()
    # Exception should have been thrown.
    assert (False)
except RuntimeError:
    pass

# Test acyclic shortest distance.
distances = list (make_automaton().shortest_distance_acyclic_from ("start"))
assert (len (distances) == 4)
assert (distances [0] == ("start", Cost (0)))
assert (distances [1] == (1, Cost (2.)))
assert (distances [2] == (state2, Cost (2.)))
assert (distances [3] == (3, Cost (1.5)))

# The same, but with the initial states as an iterable.
distances = list (
    make_automaton().shortest_distance_acyclic ([("start", Cost (1))]))
assert (len (distances) == 4)
assert (distances [0] == ("start", Cost (1)))
assert (distances [1] == (1, Cost (3.)))
assert (distances [2] == (state2, Cost (3.)))
assert (distances [3] == (3, Cost (2.5)))

distances = list (make_automaton().shortest_distance_acyclic (
    [("start", Cost (.5)), (state2, Cost (1.))]))

assert (distances == [("start", Cost (.5)), (1, Cost (2.5)),
    (state2, Cost (1.)), (3, Cost (1.5))])

# Give initial_states as a (lazy) iterable instead of a list.
distances = list (make_automaton().shortest_distance_acyclic (
    ((state, Cost (value)) for state, value in [("start", .5), (state2, 1.)])))

assert (distances == [("start", Cost (.5)), (1, Cost (2.5)),
    (state2, Cost (1.)), (3, Cost (1.5))])


text:
package at.ac.tuwien.big.xmlintelledit.xmltext.ecoretransform.impl;

import org.eclipse.emf.ecore.EClass;

public class EClassStats {
	private EClass c;

	private long instanceCount;

	public EClassStats(EClass c) {
		this.instanceCount = 0;
		this.c = c;
	}

	public void increment () {
		++ instanceCount;
	}

	public void increment (long count) {
		instanceCount += count;
	}

	public long getInstanceCount (){
		return instanceCount;
	}

	public long getFeatureCount (){
		return c.getFeatureCount();
	}

	public long getFeatureLoad (){
		return getFeatureCount() * getInstanceCount();
	}

	@Override
	public String toString() {
		return Long.toString(instanceCount) + " " + Long.toString (getFeatureCount());
	}

	public String getName() {
		return c.getName();
	}
}


text:
package com.benbarkay.fxi18n;

import com.benbarkay.fxi18n.util.Stub;
import javafx.beans.property.Property;
import javafx.beans.property.SimpleObjectProperty;
import javafx.beans.value.ObservableValue;
import org.junit.Before;
import org.junit.Test;

import java.lang.ref.WeakReference;
import java.util.concurrent.atomic.AtomicReference;

import static org.junit.Assert.assertEquals;

public class RepositoryUpdaterTest {
    private Property<StringRepository> repositoryProperty;

    @Before
    public void setUp() {
        repositoryProperty = new SimpleObjectProperty<>();
    }

    @Test
    public void itRemovesItselfWhenTargetPropertyIsGarbageCollected() {
        RepositoryUpdater updater = new RepositoryUpdater(
                null,
                new WeakReference<>(repositoryProperty),
                null
        );
        final AtomicReference<Object> removedListener = new AtomicReference<>();
        repositoryProperty = null;
        System.gc();
        // noinspection unchecked
        updater.changed(Stub.of(ObservableValue.class)
            .withOverride("removeListener", new Stub.MethodImplementation() {
                @Override
                public Object methodCalled(Object[] args) {
                    removedListener.set(args[0]);
                    return null;
                }
            }), null, null);
        assertEquals(updater, removedListener.get());
    }

    @Test
    public void itUpdatesRepositoryWhenLocaleChanges() {
        StringRepository expected = Stub.of(StringRepository.class)
                .thatReturns(null);
        RepositoryUpdater updater = new RepositoryUpdater(
                null,
                new WeakReference<>(repositoryProperty),
                Stub.of(StringRepositoryFactory.class).thatReturns(expected)
        );
        updater.changed(null, null, null);
        assertEquals(expected, repositoryProperty.getValue());
    }
}


text:
SYNONYM

#### According to
The Catalogue of Life, 3rd January 2011

#### Published in
Rhodora 42:455, t. 635, fig. 1-2. 1940

#### Original name
null

### Remarks
null


text:
#
#
# ifndef CHAOS_PREPROCESSOR_ARBITRARY_GREATER_H
# define CHAOS_PREPROCESSOR_ARBITRARY_GREATER_H
#
# include <chaos/preprocessor/arbitrary/less_equal.h>
# include <chaos/preprocessor/config.h>
# include <chaos/preprocessor/lambda/ops.h>
# include <chaos/preprocessor/logical/compl.h>
#
# /* CHAOS_PP_ARBITRARY_GREATER */
#
# define CHAOS_PP_ARBITRARY_GREATER(x, y) CHAOS_PP_COMPL(CHAOS_PP_ARBITRARY_LESS_EQUAL(x, y))
# define CHAOS_PP_ARBITRARY_GREATER_ID() CHAOS_PP_ARBITRARY_GREATER
#
# if CHAOS_PP_VARIADICS
#    define CHAOS_PP_ARBITRARY_GREATER_ CHAOS_PP_LAMBDA(CHAOS_PP_ARBITRARY_GREATER)
# endif
#
# /* CHAOS_PP_ARBITRARY_GREATER_INTERNAL */
#
# define CHAOS_PP_ARBITRARY_GREATER_INTERNAL(x, y) CHAOS_PP_COMPL(CHAOS_PP_ARBITRARY_LESS_EQUAL_INTERNAL(x, y))
#
# endif


text:
import { NgModule, NO_ERRORS_SCHEMA } from "@angular/core";
import { NativeScriptFormsModule } from "nativescript-angular/forms";
import { NativeScriptModule } from "nativescript-angular/nativescript.module";
import { HomeComponent } from './home.component';
import { HomeRouteModule } from './home-route.module';
import { NSGradientDirectiveModule } from "nativescript-ng-gradient";

@NgModule({
    declarations: [HomeComponent],
    imports: [
      NativeScriptModule,
      NativeScriptFormsModule,
      HomeRouteModule,
      NSGradientDirectiveModule
    ],
    exports: [HomeComponent],
    schemas: [NO_ERRORS_SCHEMA],
    providers: []
})
export class HomeModule {

}


text:
order: 27
title:
  en-US: Dynamic Settings
  zh-CN: 动态控制表格属性
---

## zh-CN

选择不同配置组合查看效果。

## en-US

Select different settings to see the result.

````jsx
import { Table, Icon, Switch, Radio, Form, Divider } from 'igroot';

const FormItem = Form.Item;

const columns = [{
  title: 'Name',
  dataIndex: 'name',
  key: 'name',
  width: 150,
  render: text => <a href="javascript:;">{text}</a>,
}, {
  title: 'Age',
  dataIndex: 'age',
  key: 'age',
  width: 70,
}, {
  title: 'Address',
  dataIndex: 'address',
  key: 'address',
}, {
  title: 'Action',
  key: 'action',
  width: 360,
  render: (text, record) => (
    <span>
      <a href="javascript:;">Action 一 {record.name}</a>
      <Divider type="vertical" />
      <a href="javascript:;">Delete</a>
      <Divider type="vertical" />
      <a href="javascript:;" className="ant-dropdown-link">
        More actions <Icon type="down" />
      </a>
    </span>
  ),
}];

const data = [];
for (let i = 1; i <= 10; i++) {
  data.push({
    key: i,
    name: 'John Brown',
    age: `${i}2`,
    address: `New York No. ${i} Lake Park`,
    description: `My name is John Brown, I am ${i}2 years old, living in New York No. ${i} Lake Park.`,
  });
}

const expandedRowRender = record => <p>{record.description}</p>;
const title = () => 'Here is title';
const showHeader = true;
const footer = () => 'Here is footer';
const scroll = { y: 240 };
const pagination = { position: 'bottom' };

class Demo extends React.Component {
  state = {
    bordered: false,
    loading: false,
    pagination,
    size: 'default',
    expandedRowRender,
    title: undefined,
    showHeader,
    footer,
    rowSelection: {},
    scroll: undefined,
    hasData: true,
  }

  handleToggle = (prop) => {
    return (enable) => {
      this.setState({ [prop]: enable });
    };
  }

  handleSizeChange = (e) => {
    this.setState({ size: e.target.value });
  }

  handleExpandChange = (enable) => {
    this.setState({ expandedRowRender: enable ? expandedRowRender : undefined });
  }

  handleTitleChange = (enable) => {
    this.setState({ title: enable ? title : undefined });
  }

  handleHeaderChange = (enable) => {
    this.setState({ showHeader: enable ? showHeader : false });
  }

  handleFooterChange = (enable) => {
    this.setState({ footer: enable ? footer : undefined });
  }

  handleRowSelectionChange = (enable) => {
    this.setState({ rowSelection: enable ? {} : undefined });
  }

  handleScollChange = (enable) => {
    this.setState({ scroll: enable ? scroll : undefined });
  }

  handleDataChange = (hasData) => {
    this.setState({ hasData });
  }

  handlePaginationChange = (e) => {
    const { value } = e.target;
    this.setState({
      pagination: value === 'none' ? false : { position: value },
    });
  }

  render() {
    const state = this.state;
    return (
      <div>
        <div className="components-table-demo-control-bar">
          <Form layout="inline">
            <FormItem label="Bordered">
              <Switch checked={state.bordered} onChange={this.handleToggle('bordered')} />
            </FormItem>
            <FormItem label="loading">
              <Switch checked={state.loading} onChange={this.handleToggle('loading')} />
            </FormItem>
            <FormItem label="Title">
              <Switch checked={!!state.title} onChange={this.handleTitleChange} />
            </FormItem>
            <FormItem label="Column Header">
              <Switch checked={!!state.showHeader} onChange={this.handleHeaderChange} />
            </FormItem>
            <FormItem label="Footer">
              <Switch checked={!!state.footer} onChange={this.handleFooterChange} />
            </FormItem>
            <FormItem label="Expandable">
              <Switch checked={!!state.expandedRowRender} onChange={this.handleExpandChange} />
            </FormItem>
            <FormItem label="Checkbox">
              <Switch checked={!!state.rowSelection} onChange={this.handleRowSelectionChange} />
            </FormItem>
            <FormItem label="Fixed Header">
              <Switch checked={!!state.scroll} onChange={this.handleScollChange} />
            </FormItem>
            <FormItem label="Has Data">
              <Switch checked={!!state.hasData} onChange={this.handleDataChange} />
            </FormItem>
            <FormItem label="Size">
              <Radio.Group size="default" value={state.size} onChange={this.handleSizeChange}>
                <Radio.Button value="default">Default</Radio.Button>
                <Radio.Button value="middle">Middle</Radio.Button>
                <Radio.Button value="small">Small</Radio.Button>
              </Radio.Group>
            </FormItem>
            <FormItem label="Pagination">
              <Radio.Group
                value={state.pagination ? state.pagination.position : 'none'}
                onChange={this.handlePaginationChange}
              >
                <Radio.Button value="top">Top</Radio.Button>
                <Radio.Button value="bottom">Bottom</Radio.Button>
                <Radio.Button value="both">Both</Radio.Button>
                <Radio.Button value="none">None</Radio.Button>
              </Radio.Group>
            </FormItem>
          </Form>
        </div>
        <Table {...this.state} columns={columns} dataSource={state.hasData ? data : null} />
      </div>
    );
  }
}

ReactDOM.render(<Demo />, mountNode);
````

<style>
.components-table-demo-control-bar {
  margin-bottom: 10px;
}
.components-table-demo-control-bar .ant-form-item {
  margin-right: 16px;
  margin-bottom: 8px;
}
</style>


text:
import doctest
import pytest
from insights.parsers import bdi_read_ahead_kb, ParseException
from insights.tests import context_wrap

BDI_READ_AHEAD_KB = """
128
""".strip()

BDI_READ_AHEAD_KB_INVALID = """
invalid
""".strip()

def test_bdi_read_ahead_kb():
    read_ahead_kb = bdi_read_ahead_kb.BDIReadAheadKB(context_wrap(BDI_READ_AHEAD_KB))
    assert read_ahead_kb.read_ahead_kb == 128

def test_invalid_bdi_read_ahead_kb():
    with pytest.raises(ParseException) as e:
        bdi_read_ahead_kb.BDIReadAheadKB(context_wrap(BDI_READ_AHEAD_KB_INVALID))
    assert "Error: " in str(e)

def test_bdi_read_ahead_kb_doc_examples():
    env = {
        'bdi_read_ahead_kb': bdi_read_ahead_kb.BDIReadAheadKB(context_wrap(BDI_READ_AHEAD_KB)),
    }
    failed, total = doctest.testmod(bdi_read_ahead_kb, globs=env)
    assert failed == 0


text:
@interface CCFeedback : NSObject

@property NSString *app;

@property NSString *label;
@property NSString *content;
@property NSDictionary *userInfo;

- (NSDictionary *)toDictionary;

- (instancetype)initWithApp:(NSString *)app label:(NSString *)label content:(NSString *)content;

@end


text:
.class Landroid/support/v7/widget/ScrollingTabContainerView$1;
.super Ljava/lang/Object;
.source "ScrollingTabContainerView.java"

# interfaces
.implements Ljava/lang/Runnable;

# annotations
.annotation system Ldalvik/annotation/EnclosingMethod;
    value = Landroid/support/v7/widget/ScrollingTabContainerView;->animateToTab(I)V
.end annotation

.annotation system Ldalvik/annotation/InnerClass;
    accessFlags = 0x0
    name = null
.end annotation

# instance fields
.field final synthetic this$0:Landroid/support/v7/widget/ScrollingTabContainerView;

.field final synthetic val$tabView:Landroid/view/View;

# direct methods
.method constructor <init>(Landroid/support/v7/widget/ScrollingTabContainerView;Landroid/view/View;)V
    .locals 0
    .param p1, "this$0"    # Landroid/support/v7/widget/ScrollingTabContainerView;

    .prologue
    .line 264
    iput-object p1, p0, Landroid/support/v7/widget/ScrollingTabContainerView$1;->this$0:Landroid/support/v7/widget/ScrollingTabContainerView;

    iput-object p2, p0, Landroid/support/v7/widget/ScrollingTabContainerView$1;->val$tabView:Landroid/view/View;

    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    return-void
.end method

# virtual methods
.method public run()V
    .locals 4

    .prologue
    .line 267
    iget-object v1, p0, Landroid/support/v7/widget/ScrollingTabContainerView$1;->val$tabView:Landroid/view/View;

    invoke-virtual {v1}, Landroid/view/View;->getLeft()I

    move-result v1

    iget-object v2, p0, Landroid/support/v7/widget/ScrollingTabContainerView$1;->this$0:Landroid/support/v7/widget/ScrollingTabContainerView;

    invoke-virtual {v2}, Landroid/support/v7/widget/ScrollingTabContainerView;->getWidth()I

    move-result v2

    iget-object v3, p0, Landroid/support/v7/widget/ScrollingTabContainerView$1;->val$tabView:Landroid/view/View;

    invoke-virtual {v3}, Landroid/view/View;->getWidth()I

    move-result v3

    sub-int/2addr v2, v3

    div-int/lit8 v2, v2, 0x2

    sub-int v0, v1, v2

    .line 268
    .local v0, "scrollPos":I
    iget-object v1, p0, Landroid/support/v7/widget/ScrollingTabContainerView$1;->this$0:Landroid/support/v7/widget/ScrollingTabContainerView;

    const/4 v2, 0x0

    invoke-virtual {v1, v0, v2}, Landroid/support/v7/widget/ScrollingTabContainerView;->smoothScrollTo(II)V

    .line 269
    iget-object v1, p0, Landroid/support/v7/widget/ScrollingTabContainerView$1;->this$0:Landroid/support/v7/widget/ScrollingTabContainerView;

    const/4 v2, 0x0

    iput-object v2, v1, Landroid/support/v7/widget/ScrollingTabContainerView;->mTabSelector:Ljava/lang/Runnable;

    .line 270
    return-void
.end method


text:
package com.github.aha.poc.junit5.advanced;

import static com.github.aha.poc.junit5.advanced.SpyingTests.Greeting.GreetingService.WELCOME;
import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.ArgumentMatchers.anyInt;
import static org.mockito.BDDMockito.given;
import static org.mockito.Mockito.reset;

import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Nested;
import org.junit.jupiter.api.Test;
import org.mockito.Mockito;

import lombok.Getter;

// based on https://blog.jdriven.com/2013/05/mock-superclass-method-with-mockito/
@DisplayName("Examples of spying tests")
public class SpyingTests {

	@Nested
	@DisplayName("simple inheritance")
	class Greeting {

		@Test
		@DisplayName("should use service in standard way")
		void regularUsage() {
			HelloService service = new HelloService();

			assertThat(service.sayGreeting()).isEqualTo("Welcome and Hello");
			assertThat(service.generalGreeting).isEqualTo(WELCOME);
		}

		@Test
		@DisplayName("should mock inherited method in spied class")
		void mockInheritedMethod() {
			HelloService spiedService = Mockito.spy(new HelloService());
			Mockito.doNothing().when((HelloService) spiedService).initGreeting();

			assertThat(spiedService.sayGreeting()).isEqualTo("Hello");
			assertThat(spiedService.generalGreeting).isEmpty();
		}

		abstract class GreetingService {

			static final String WELCOME = "Welcome and ";

			String generalGreeting = "";

			public String sayGreeting() {
				initGreeting();
				return getGreeting();
			}

			protected abstract String getGreeting();

			void initGreeting() {
				generalGreeting = WELCOME;
			}
		}

		class HelloService extends GreetingService {

			@Override
			protected String getGreeting() {
				return generalGreeting + "Hello";
			}

		}

	}

	@Nested
	@DisplayName("inheritance with generics")
	class Calculator {

		@Test
		@DisplayName("should use service in standard way")
		void regularUsage() {
			assertThat(new IntCalc().add(3)).isEqualTo(8);
		}

		@Test
		@DisplayName("should mock inherited method in spied class")
		void mockInheritedMethod() {
			IntCalc spiedService = Mockito.spy(new IntCalc());
			given(spiedService.add(anyInt())).willReturn(0);

			assertThat(spiedService.add(3)).isEqualTo(0);
			reset(spiedService);
			assertThat(spiedService.add(5)).isEqualTo(10);
		}

		abstract class AbstractCalc<V extends Number> {

			@Getter
			V value = getInitValue();

			public V add(V valueToBeAdded) {
				return addValue(value, valueToBeAdded);
			}

			abstract V getInitValue();

			abstract V addValue(V currentValue, V valueToBeAdded);

		}

		class IntCalc extends AbstractCalc<Integer> {

			@Override
			protected Integer addValue(Integer currentValue, Integer addition) {
				return currentValue + addition;
			}

			@Override
			Integer getInitValue() {
				return 5;
			}

		}

	}

}