text:
<?php
/**
 * Declares the StorageStrategyException class.
 *
 * @author     Mike Lohmann <mike.lohmann@phplabs.de>
 */

namespace Phm\Component\Storage\Exceptions;

class StorageStrategyException extends \Exception {}


text:
package co.gongzh.servicekit;

import org.jetbrains.annotations.NotNull;

import java.io.File;
import java.time.ZoneId;
import java.util.Collections;
import java.util.List;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

/**
 * @author Gong Zhang
 */
public interface AppDelegate {

    /**
     * @return status code. (0 means the app is successfully started, while other
     *         values are error code that will be returned to system.)
     */
    int onStart();
    void onStop();
    void onCommand(@NotNull String line);

    default void onStdinClose() {}

    @NotNull
    default LogFileResolver getLogFileResolver() {
        return () -> new File(".log");
    }

    default ExecutorService createGlobalThreadPool() {
        return Executors.newCachedThreadPool();
    }

    default void purgeGlobalThreadPool(@NotNull ExecutorService pool) {
        pool.shutdownNow();
    }

}

redpajama_set_name: RedPajamaGithub


text:
#include "d3d8Wrapper.h"

extern "C"
{
	namespace D3D8Wrapper
	{
		ThreadSafePointerSet IDirect3D8::m_List;

		D3D8Wrapper::IDirect3D8::IDirect3D8(D3D8Base::IDirect3D8* real) : D3D8Wrapper::IDirect3DUnknown((IUnknown*) real)
		{
			LOG("IDirect3D8::IDirect3D8( " << real << " )\n");
			m_pD3D = real;
		}

		// Tries to find the real object in the pointer set, or creates a new wrapped object
		D3D8Wrapper::IDirect3D8* D3D8Wrapper::IDirect3D8::GetDirect3D(D3D8Base::IDirect3D8* pD3D)
		{
			LOG("IDirect3D8::GetDirect3D( " << pD3D << " )\n");
			D3D8Wrapper::IDirect3D8* p = (D3D8Wrapper::IDirect3D8*) m_List.GetDataPtr(pD3D);
			if( p == NULL )
			{
				p = new D3D8Wrapper::IDirect3D8(pD3D);
				m_List.AddMember(pD3D,p);
				return p;
			}

			p->m_ulRef++;
			return p;
		}

		STDMETHODIMP_(ULONG) D3D8Wrapper::IDirect3D8::Release(THIS)
		{
			LOG("IDirect3D8::Release() [ " << this << " ]\n");
			m_pUnk->Release();

			ULONG ulRef = --m_ulRef;

			if(ulRef == 0)
			{
				m_List.DeleteMember(GetDirect3D8());
				delete this;
				return 0L;
			}
			return ulRef;
		}

		/*** IDirect3D8 methods ***/

		STDMETHODIMP D3D8Wrapper::IDirect3D8::GetAdapterDisplayMode(THIS_ UINT Adapter,D3D8Base::D3DDISPLAYMODE* pMode)
		{
			LOG("IDirect3D8::GetAdapterDisplayMode( " << Adapter << " , " << pMode << " ) [ " << this << " ]\n");
			return m_pD3D->GetAdapterDisplayMode(Adapter, pMode);
		}

		STDMETHODIMP D3D8Wrapper::IDirect3D8::RegisterSoftwareDevice(void* pInitializeFunction)
		{
			LOG("IDirect3D8::RegisterSoftwareDevice( " << pInitializeFunction << " ) [ " << this << " ]\n");
			return m_pD3D->RegisterSoftwareDevice(pInitializeFunction);
		}

		STDMETHODIMP_(UINT) D3D8Wrapper::IDirect3D8::GetAdapterCount(THIS)
		{
			LOG("IDirect3D8::GetAdapterCount() [ " << this << " ]\n");
			return m_pD3D->GetAdapterCount();
		}

		STDMETHODIMP D3D8Wrapper::IDirect3D8::GetAdapterIdentifier(UINT Adapter,DWORD Flags,D3D8Base::D3DADAPTER_IDENTIFIER8* pIdentifier)
		{
			LOG("IDirect3D8::GetAdapterIdentifier( " << Adapter << " , " << Flags << " , " << pIdentifier << " ) [ " << this << " ]\n");
			return m_pD3D->GetAdapterIdentifier(Adapter,Flags,pIdentifier);
		}

		STDMETHODIMP_(UINT) D3D8Wrapper::IDirect3D8::GetAdapterModeCount(UINT Adapter)
		{
			LOG("IDirect3D8::GetAdapterModeCount( " << Adapter << " ) [ " << this << " ]\n");
			return m_pD3D->GetAdapterModeCount(Adapter);
		}

		STDMETHODIMP D3D8Wrapper::IDirect3D8::EnumAdapterModes(UINT Adapter,UINT Mode,D3D8Base::D3DDISPLAYMODE* pMode)
		{
			LOG("IDirect3D8::EnumAdapterModes( " << Adapter << " , " << Mode << " , " << pMode << " ) [ " << this << " ]\n");
			return m_pD3D->EnumAdapterModes(Adapter,Mode,pMode);
		}

		STDMETHODIMP D3D8Wrapper::IDirect3D8::CheckDeviceType(UINT Adapter,D3D8Base::D3DDEVTYPE CheckType,D3D8Base::D3DFORMAT DisplayFormat,D3D8Base::D3DFORMAT BackBufferFormat,BOOL Windowed)
		{
			LOG("IDirect3D8::CheckDeviceType( " << Adapter << " , " << CheckType << " , " << DisplayFormat << " , " << BackBufferFormat << " , " << Windowed << " ) [ " << this << " ]\n");
			return m_pD3D->CheckDeviceType(Adapter,CheckType,DisplayFormat,BackBufferFormat,Windowed);
		}

		STDMETHODIMP D3D8Wrapper::IDirect3D8::CheckDeviceFormat(UINT Adapter,D3D8Base::D3DDEVTYPE DeviceType,D3D8Base::D3DFORMAT AdapterFormat,DWORD Usage,D3D8Base::D3DRESOURCETYPE RType,D3D8Base::D3DFORMAT CheckFormat)
		{
			LOG("IDirect3D8::CheckDeviceFormat( " << Adapter << " , " << DeviceType << " , " << AdapterFormat << " , " << Usage << " , " << RType << " , " << CheckFormat << " ) [ " << this << " ]\n");
			return m_pD3D->CheckDeviceFormat(Adapter,DeviceType,AdapterFormat,Usage,RType,CheckFormat);
		}

		STDMETHODIMP D3D8Wrapper::IDirect3D8::CheckDeviceMultiSampleType(UINT Adapter,D3D8Base::D3DDEVTYPE DeviceType,D3D8Base::D3DFORMAT SurfaceFormat,BOOL Windowed,D3D8Base::D3DMULTISAMPLE_TYPE MultiSampleType)
		{
			LOG("IDirect3D8::CheckDeviceMultiSampleType( " << Adapter << " , " << DeviceType << " , " << SurfaceFormat << " , " << Windowed << " , " << MultiSampleType << " ) [ " << this << " ]\n");
			return m_pD3D->CheckDeviceMultiSampleType(Adapter,DeviceType,SurfaceFormat,Windowed,MultiSampleType);
		}

		STDMETHODIMP D3D8Wrapper::IDirect3D8::CheckDepthStencilMatch(UINT Adapter,D3D8Base::D3DDEVTYPE DeviceType,D3D8Base::D3DFORMAT AdapterFormat,D3D8Base::D3DFORMAT RenderTargetFormat,D3D8Base::D3DFORMAT DepthStencilFormat)
		{
			LOG("IDirect3D8::CheckDepthStencilMatch( " << Adapter << " , " << DeviceType << " , " << AdapterFormat << " , " << RenderTargetFormat << " , " << DepthStencilFormat << " ) [ " << this << " ]\n");
			return m_pD3D->CheckDepthStencilMatch(Adapter,DeviceType,AdapterFormat,RenderTargetFormat,DepthStencilFormat);
		}

		STDMETHODIMP D3D8Wrapper::IDirect3D8::GetDeviceCaps(UINT Adapter,D3D8Base::D3DDEVTYPE DeviceType,D3D8Base::D3DCAPS8* pCaps)
		{
			LOG("IDirect3D8::GetDeviceCaps( " << Adapter << " , " << DeviceType << " , " << pCaps << " ) [ " << this << " ]\n");
			return m_pD3D->GetDeviceCaps(Adapter,DeviceType,pCaps);
		}

		STDMETHODIMP_(HMONITOR) D3D8Wrapper::IDirect3D8::GetAdapterMonitor(UINT Adapter)
		{
			LOG("IDirect3D8::GetAdapterMonitor( " << Adapter << " ) [ " << this << " ]\n");
			return m_pD3D->GetAdapterMonitor(Adapter);
		}

		STDMETHODIMP D3D8Wrapper::IDirect3D8::CreateDevice(UINT Adapter,D3D8Base::D3DDEVTYPE DeviceType,HWND hFocusWindow,DWORD BehaviorFlags,D3D8Base::D3DPRESENT_PARAMETERS* pPresentationParameters,D3D8Wrapper::IDirect3DDevice8** ppReturnedDeviceInterface)
		{
			//sometimes, Intel drivers will clear the dll path. So let's save and restore it (do their job for them)
			//it doesn't seem like this happens any time besides creating the D3D8 object and a device.
			//If it does, then this solution isn't scalable at all.
			//This is a good place to note that it appears possible that on the affected drivers, the D3D9 interface will only SetDllDirectory the first time a D3D9 object is created
			char oldDllDirectory[MAX_PATH];
			GetDllDirectory(MAX_PATH, oldDllDirectory);

			LOG("IDirect3D8::CreateDevice( " << Adapter << " , " << DeviceType << " , " << hFocusWindow << " , " << BehaviorFlags << " , " << pPresentationParameters << " , " << ppReturnedDeviceInterface << " ) [ " << this << " ]\n");
			D3D8Base::IDirect3DDevice8* realDevice = NULL;

			HRESULT hr = m_pD3D->CreateDevice(Adapter,DeviceType,hFocusWindow,BehaviorFlags,pPresentationParameters,&realDevice);

			//restore old DLL directory
			SetDllDirectory(oldDllDirectory);

			if(FAILED(hr))
			{
				return hr;
			}

			// Wrap the real object
			D3D8Wrapper::IDirect3DDevice8* wrappedDevice = D3D8Wrapper::IDirect3DDevice8::GetDirect3DDevice(realDevice);

			// Store this wrapped pointer for grabbing the screen later
			last_device = wrappedDevice;

			// Create a new render target
			D3D8Base::IDirect3DSurface8 *realSurface = NULL;
			HRESULT hr2 = realDevice->CreateRenderTarget(pPresentationParameters->BackBufferWidth,pPresentationParameters->BackBufferHeight,D3D8Base::D3DFMT_X8R8G8B8,pPresentationParameters->MultiSampleType,FALSE,&realSurface);

			// Store a wrapped pointer to it for grabbing the screen
			render_surface = D3D8Wrapper::IDirect3DSurface8::GetSurface(realSurface);

			// Return our wrapped object
			*ppReturnedDeviceInterface = wrappedDevice;

			return hr;
		}

	}
}


text:
<?php

namespace App\Http\Controllers\Api\V1\Management;

use Illuminate\Http\Request;
use App\Http\Controllers\Controller;
use JWTAuth, JWTException;
use App\Models\Management\Advisory;
use Validator;
use Dingo\Api\Routing\Helpers;

class AdvisoryController extends Controller
{
    use Helpers;

    /**
     * Display a listing of the resource.
     *
     * @return \Illuminate\Http\Response
     */
    public function index()
    {
        return Advisory::all();
    }

    /**
     * Show the form for creating a new resource.
     *
     * @param $name
     * @return \Illuminate\Http\Response
     */
    public function create($name)
    {
        if (!JWTAuth::parseToken()->authenticate()->roles[0]->hasPermission('info/advisory/add')) $this->response->errorForbidden(403022);

        if (Validator::make(['name' => $name], ['name' => 'string'])->fails()) $this->response->errorBadRequest(400032);
        if (Validator::make(['name' => $name], ['name' => 'unique:advisories'])->fails()) $this->response->errorBadRequest(400033);
        $advisory = new Advisory();
        $advisory->name = $name;
        if (!$advisory->save()) $this->response->errorInternal(500001);
        return $advisory;
    }

    /**
     * Update the specified resource in storage.
     *
     * @param  \Illuminate\Http\Request $request
     * @param  int $id
     * @return \Illuminate\Http\Response
     */
    public function update(Request $request, $id)
    {
        if (!JWTAuth::parseToken()->authenticate()->roles[0]->hasPermission('info/advisory/edit')) $this->response->errorForbidden(403024);

        $parameters = $request->all();
        $parameters['id'] = $id;
        if (Validator::make($parameters, ['id' => 'exists:advisories'])->fails()) $this->response->errorBadRequest(400034);
        if (Validator::make($parameters, ['name' => 'string'])->fails()) $this->response->errorBadRequest(400032);
        if (Validator::make($parameters, ['name' => 'unique:advisories'])->fails()) $this->response->errorBadRequest(400033);

        $advisory = Advisory::find($id);
        if (key_exists('name', $parameters)) $advisory->name = $parameters['name'];
        if (!$advisory->save()) $this->response->errorInternal(500001);
        return $advisory;
    }

    /**
     * Remove the specified resource from storage.
     *
     * @param  int $id
     * @return \Illuminate\Http\Response
     */
    public function destroy($id)
    {
        if (!JWTAuth::parseToken()->authenticate()->roles[0]->hasPermission('info/advisory/remove')) $this->response->errorForbidden(403023);

        if (Validator::make(['id' => $id], ['id' => 'exists:advisories'])->fails()) $this->response->errorBadRequest(400034);
        $advisory = Advisory::find($id);
        $advisory->delete();
    }
}


text:
/*
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package io.prestosql.sql.query;

import org.testng.annotations.AfterClass;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;

import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatThrownBy;

public class TestUnnest
{
    private QueryAssertions assertions;

    @BeforeClass
    public void init()
    {
        assertions = new QueryAssertions();
    }

    @AfterClass(alwaysRun = true)
    public void teardown()
    {
        assertions.close();
        assertions = null;
    }

    @Test
    public void testUnnestArrayRows()
    {
        assertThat(assertions.query(
                "SELECT * FROM UNNEST(ARRAY[ROW(1, 1.1), ROW(3, 3.3)], ARRAY[ROW('a', true), ROW('b', false)])"))
                .matches("VALUES (1, 1.1, 'a', true), (3, 3.3, 'b', false)");
        assertThat(assertions.query(
                "SELECT x, y FROM (VALUES (ARRAY[ROW(1.0, 2), ROW(3, 4.123)])) AS t(a) CROSS JOIN UNNEST(a) t(x, y)"))
                .matches("VALUES (1.0, 2), (3, 4.123)");
        assertThat(assertions.query(
                "SELECT x, y, z FROM (VALUES (ARRAY[ROW(1, 2), ROW(3, 4)])) t(a) CROSS JOIN (VALUES (1), (2)) s(z) CROSS JOIN UNNEST(a) t(x, y)"))
                .matches("VALUES (1, 2, 1), (1, 2, 2), (3, 4, 1), (3, 4, 2)");
    }

    @Test
    public void testUnnestPreserveColumnName()
    {
        assertThat(assertions.query(
                "SELECT x FROM UNNEST(CAST(ARRAY[ROW(1, 'a'), ROW(2, 'b')] as ARRAY(ROW(x int, y varchar))))"))
                .matches("VALUES (1), (2)");

        assertThatThrownBy(() -> assertions.query(
                "SELECT x FROM" +
                        "(VALUES (3)) AS t(x)" +
                        "CROSS JOIN UNNEST(CAST(ARRAY[ROW(1, 'a'), ROW(2, 'b')] as ARRAY(ROW(x int, y varchar))))"))
                .hasMessageMatching(".*Column 'x' is ambiguous.*");

        assertThat(assertions.query(
                "SELECT t.x FROM" +
                        "(VALUES (3)) AS t(x)" +
                        "CROSS JOIN UNNEST(CAST(ARRAY[ROW(1, 'a'), ROW(2, 'b')] as ARRAY(ROW(x int, y varchar))))"))
                .matches("VALUES (3), (3)");

        assertThat(assertions.query(
                "SELECT u.x FROM" +
                        "(VALUES (3)) AS t(x)" +
                        "CROSS JOIN UNNEST(CAST(ARRAY[ROW(1, 'a'), ROW(2, 'b')] as ARRAY(ROW(x int, y varchar)))) u"))
                .matches("VALUES (1), (2)");
    }

    @Test
    public void testUnnestMultiExpr()
    {
        assertThatThrownBy(() -> assertions.query(
                "SELECT x " +
                        "FROM UNNEST(" +
                        "   CAST(ARRAY[ROW(1, 'a'), ROW(2, 'b')] as ARRAY(ROW(x int, y varchar)))," +
                        "   CAST(ARRAY[ROW(1, 'a'), ROW(2, 'b')] as ARRAY(ROW(x int, y varchar))))"))
                .hasMessageMatching(".*Column 'x' is ambiguous.*");

        assertThat(assertions.query(
                "SELECT t3 " +
                        "FROM UNNEST(" +
                        "   CAST(ARRAY[ROW(1, 'a'), ROW(2, 'b')] as ARRAY(ROW(x int, y varchar)))," +
                        "   CAST(ARRAY[ROW(3, 'c'), ROW(4, 'd')] as ARRAY(ROW(x int, y varchar)))) t(t1,t2,t3,t4)"))
                .matches("VALUES (3), (4)");

        assertThat(assertions.query(
                "SELECT x " +
                        "FROM UNNEST(" +
                        "   CAST(ARRAY[ROW(1, 'a'), ROW(2, 'b')] as ARRAY(ROW(a int, b varchar)))," +
                        "   CAST(ARRAY[ROW(3, 'c'), ROW(4, 'd')] as ARRAY(ROW(x int, y varchar))))"))
                .matches("VALUES (3), (4)");
    }

    @Test
    public void testLeftJoinUnnest()
    {
        assertThat(assertions.query(
                "SELECT * FROM (VALUES ARRAY[1, null]) a(x) LEFT OUTER JOIN UNNEST(x) ON true"))
                .matches("VALUES (ARRAY[1, null], 1), (ARRAY[1, null], null)");
        assertThat(assertions.query(
                "SELECT * FROM (VALUES ARRAY[1, null]) a(x) LEFT OUTER JOIN UNNEST(x) WITH ORDINALITY ON true"))
                .matches("VALUES (ARRAY[1, null], 1, BIGINT '1'), (ARRAY[1, null], null, BIGINT '2')");
        assertThat(assertions.query(
                "SELECT * FROM (VALUES ARRAY[]) a(x) LEFT OUTER JOIN UNNEST(x) ON true"))
                .matches("VALUES (ARRAY[], null)");
        assertThat(assertions.query(
                "SELECT * FROM (VALUES ARRAY[]) a(x) LEFT OUTER JOIN UNNEST(x) WITH ORDINALITY ON true"))
                .matches("VALUES (ARRAY[], null, CAST(NULL AS bigint))");
        assertThatThrownBy(() -> assertions.query(
                "SELECT * FROM (VALUES ARRAY[1, null]) a(x) LEFT OUTER JOIN UNNEST(x) b(y) ON b.y = 1"))
                .hasMessageMatching("line .*: LEFT JOIN involving UNNEST is only supported with condition ON TRUE");
        assertThat(assertions.query(
                "SELECT * FROM (VALUES 'a', 'b') LEFT JOIN UNNEST(ARRAY[]) ON TRUE"))
                .matches("VALUES ('a', null), ('b', null)");
        assertThat(assertions.query(
                "SELECT id, e FROM (VALUES (1, ARRAY[3,4]), (2, NULL), (3, ARRAY[4]), (4, NULL), (5, ARRAY[]), (6, ARRAY[7,8])) x(id, a) LEFT JOIN UNNEST(a) AS y(e) ON true"))
                .matches("VALUES (1,3), (1,4), (2,NULL), (3,4), (4,NULL), (5,NULL), (6,7), (6,8)");
        // misalignment
        assertThat(assertions.query(
                "SELECT * FROM (VALUES 1) LEFT OUTER JOIN UNNEST (MAP(ARRAY[1, 2], ARRAY['a', 'b']), ARRAY[ROW(3, 'c', true)]) WITH ORDINALITY ON TRUE"))
                .matches("VALUES (1, 1, 'a', 3, 'c', true, BIGINT '1'), (1, 2, 'b', null, null, null, BIGINT '2')");
        assertThat(assertions.query(
                "SELECT * FROM (VALUES 1) LEFT OUTER JOIN UNNEST (MAP(ARRAY[1], ARRAY['a']), ARRAY[true, false], ARRAY[]) WITH ORDINALITY ON TRUE"))
                .matches("VALUES (1, 1, 'a', true, null, BIGINT '1'), (1, null, null, false, null, BIGINT '2')");
    }

    @Test
    public void testRightJoinUnnest()
    {
        // The SQL standard doesn't allow lateral references in UNNEST subquery of RIGHT join.
        assertThat(assertions.query(
                "SELECT * FROM (VALUES ARRAY[1, null]) a(x) RIGHT OUTER JOIN UNNEST(ARRAY[2, null]) ON true"))
                .matches("VALUES (ARRAY[1, null], 2), (ARRAY[1, null], null)");
        assertThat(assertions.query(
                "SELECT * FROM (VALUES ARRAY[]) a(x) RIGHT OUTER JOIN UNNEST(ARRAY[2, null]) ON true"))
                .matches("VALUES (ARRAY[], 2), (ARRAY[], null)");
        assertThat(assertions.query(
                "SELECT * FROM (VALUES ARRAY[1, null]) a(x) RIGHT OUTER JOIN UNNEST(ARRAY[2, null]) WITH ORDINALITY ON true"))
                .matches("VALUES (ARRAY[1, null], 2, BIGINT '1'), (ARRAY[1, null], null, BIGINT '2')");
        assertThatThrownBy(() -> assertions.query(
                "SELECT * FROM (VALUES ARRAY[1, null]) a(x) RIGHT OUTER JOIN UNNEST(ARRAY[2, null]) b(y) ON b.y = 1"))
                .hasMessageMatching("line .*: RIGHT JOIN involving UNNEST is only supported with condition ON TRUE");
    }

    @Test
    public void testFullJoinUnnest()
    {
        // The SQL standard doesn't allow lateral references in UNNEST subquery of FULL join.
        assertThat(assertions.query(
                "SELECT * FROM (VALUES ARRAY[1, null]) a(x) FULL OUTER JOIN UNNEST(ARRAY[2, null]) ON true"))
                .matches("VALUES (ARRAY[1, null], 2), (ARRAY[1, null], null)");
        assertThat(assertions.query(
                "SELECT * FROM (VALUES ARRAY[1, null]) a(x) FULL OUTER JOIN UNNEST(ARRAY[2, null]) WITH ORDINALITY ON true"))
                .matches("VALUES (ARRAY[1, null], 2, BIGINT '1'), (ARRAY[1, null], null, BIGINT '2')");
        assertThat(assertions.query(
                "SELECT * FROM (VALUES ARRAY[]) a(x) FULL OUTER JOIN UNNEST(ARRAY[2, null]) ON true"))
                .matches("VALUES (ARRAY[], 2), (ARRAY[], null)");
        assertThat(assertions.query(
                "SELECT * FROM (VALUES ARRAY[]) a(x) FULL OUTER JOIN UNNEST(ARRAY[2, null]) WITH ORDINALITY ON true"))
                .matches("VALUES (ARRAY[], 2, BIGINT '1'), (ARRAY[], null, BIGINT '2')");
        assertThatThrownBy(() -> assertions.query(
                "SELECT * FROM (VALUES ARRAY[1, null]) a(x) FULL OUTER JOIN UNNEST(ARRAY[2, null]) b(y) ON b.y = 1"))
                .hasMessageMatching("line .*: FULL JOIN involving UNNEST is only supported with condition ON TRUE");
    }

    @Test
    public void testInnerJoinUnnest()
    {
        assertThat(assertions.query(
                "SELECT * FROM (VALUES ARRAY[1, null]) a(x) INNER JOIN UNNEST(x) ON true"))
                .matches("VALUES (ARRAY[1, null], 1), (ARRAY[1, null], null)");
        assertThat(assertions.query(
                "SELECT * FROM (VALUES ARRAY[1, null]) a(x) INNER JOIN UNNEST(x) WITH ORDINALITY ON true"))
                .matches("VALUES (ARRAY[1, null], 1, BIGINT '1'), (ARRAY[1, null], null, BIGINT '2')");
        assertions.assertQueryReturnsEmptyResult(
                "SELECT * FROM (VALUES ARRAY[]) a(x) INNER JOIN UNNEST(x) ON true");
        assertions.assertQueryReturnsEmptyResult(
                "SELECT * FROM (VALUES ARRAY[]) a(x) INNER JOIN UNNEST(x) WITH ORDINALITY ON true");
        assertThatThrownBy(() -> assertions.query(
                "SELECT * FROM (VALUES ARRAY[1, null]) a(x) INNER JOIN UNNEST(x) b(y) ON b.y = 1"))
                .hasMessageMatching("line .*: INNER JOIN involving UNNEST is only supported with condition ON TRUE");
    }

    @Test
    public void testRepeatedExpressions()
    {
        assertThat(assertions.query(
                "SELECT * FROM (VALUES 1) t, UNNEST(ARRAY['a', 'b'], ARRAY['a', 'b']) u (x, y)"))
                .matches("VALUES (1, 'a', 'a'), (1, 'b', 'b')");
    }
}


text:
class UtilsLXDAuth {
    public:
        static bool check_trust_certs(std::string &sError);
        static bool connect_with_lxd(const std::string &sPass, std::string &sError);
        static bool set_trusted(const std::string &sPass, std::string &sError);
};

#endif


text:
package FindingPathInMaze;

/**
 * Created by buamod on 2017-05-07.
 *
 * Examples of paths for testing
 *
 * @author Raquel M. Crespo-Garcia <rcrespo@it.uc3m.es>
 */
public final class PathSamples {

    // Use with MazeSample 1
    public static final Movement[] movsPath1a = {
            Movement.DOWN,
            Movement.RIGHT,
            Movement.DOWN, Movement.DOWN, Movement.DOWN, Movement.DOWN, Movement.DOWN, Movement.DOWN, Movement.DOWN,
            Movement.RIGHT,Movement.RIGHT,Movement.RIGHT,Movement.RIGHT,Movement.RIGHT,Movement.RIGHT,Movement.RIGHT
    };

    // Use with MazeSample 1
    public static final Movement[] movsPath1b = {
            Movement.DOWN, Movement.RIGHT,
            Movement.DOWN, Movement.RIGHT,
            Movement.DOWN, Movement.RIGHT,
            Movement.DOWN, Movement.RIGHT,
            Movement.DOWN, Movement.RIGHT,
            Movement.DOWN, Movement.RIGHT,
            Movement.DOWN, Movement.RIGHT,
            Movement.DOWN, Movement.RIGHT
    };

}


text:
module RSpec
  module Matchers
    module BuiltIn
      # @api private
      # Provides the implementation for `change`.
      # Not intended to be instantiated directly.
      class Change < BaseMatcher
        # @api public
        # Specifies the delta of the expected change.
        def by(expected_delta)
          ChangeRelatively.new(change_details, expected_delta, :by) do |actual_delta|
            values_match?(expected_delta, actual_delta)
          end
        end

        # @api public
        # Specifies a minimum delta of the expected change.
        def by_at_least(minimum)
          ChangeRelatively.new(change_details, minimum, :by_at_least) do |actual_delta|
            actual_delta >= minimum
          end
        end

        # @api public
        # Specifies a maximum delta of the expected change.
        def by_at_most(maximum)
          ChangeRelatively.new(change_details, maximum, :by_at_most) do |actual_delta|
            actual_delta <= maximum
          end
        end

        # @api public
        # Specifies the new value you expect.
        def to(value)
          ChangeToValue.new(change_details, value)
        end

        # @api public
        # Specifies the original value.
        def from(value)
          ChangeFromValue.new(change_details, value)
        end

        # @private
        def matches?(event_proc)
          raise_block_syntax_error if block_given?
          perform_change(event_proc) && change_details.changed?
        end

        def does_not_match?(event_proc)
          raise_block_syntax_error if block_given?
          perform_change(event_proc) && !change_details.changed?
        end

        # @api private
        # @return [String]
        def failure_message
          "expected #{change_details.value_representation} to have changed, " \
          "but #{positive_failure_reason}"
        end

        # @api private
        # @return [String]
        def failure_message_when_negated
          "expected #{change_details.value_representation} not to have changed, " \
          "but #{negative_failure_reason}"
        end

        # @api private
        # @return [String]
        def description
          "change #{change_details.value_representation}"
        end

        # @private
        def supports_block_expectations?
          true
        end

      private

        def initialize(receiver=nil, message=nil, &block)
          @receiver = receiver
          @message = message
          @block = block
        end

        def change_details
          @change_details ||= ChangeDetails.new(matcher_name, @receiver, @message, &@block)
        end

        def perform_change(event_proc)
          @event_proc = event_proc
          change_details.perform_change(event_proc) do |actual_before|
            # pre-compute values derived from the `before` value before the
            # mutation is applied, in case the specified mutation is mutation
            # of a single object (rather than a changing what object a method
            # returns). We need to cache these values before the `before` value
            # they are based on potentially gets mutated.
            @actual_before_description = description_of(actual_before)
          end
        end

        def raise_block_syntax_error
          raise SyntaxError, "Block not received by the `change` matcher. " \
          "Perhaps you want to use `{ ... }` instead of do/end?"
        end

        def positive_failure_reason
          return "was not given a block" unless Proc === @event_proc
          "is still #{@actual_before_description}"
        end

        def negative_failure_reason
          return "was not given a block" unless Proc === @event_proc
          "did change from #{@actual_before_description} " \
          "to #{description_of change_details.actual_after}"
        end
      end

      # Used to specify a relative change.
      # @api private
      class ChangeRelatively < BaseMatcher
        def initialize(change_details, expected_delta, relativity, &comparer)
          @change_details = change_details
          @expected_delta = expected_delta
          @relativity     = relativity
          @comparer       = comparer
        end

        # @private
        def failure_message
          "expected #{@change_details.value_representation} to have changed " \
          "#{@relativity.to_s.tr('_', ' ')} " \
          "#{description_of @expected_delta}, but #{failure_reason}"
        end

        # @private
        def matches?(event_proc)
          @event_proc = event_proc
          @change_details.perform_change(event_proc) && @comparer.call(@change_details.actual_delta)
        end

        # @private
        def does_not_match?(_event_proc)
          raise NotImplementedError, "`expect { }.not_to change " \
            "{ }.#{@relativity}()` is not supported"
        end

        # @private
        def description
          "change #{@change_details.value_representation} " \
          "#{@relativity.to_s.tr('_', ' ')} #{description_of @expected_delta}"
        end

        # @private
        def supports_block_expectations?
          true
        end

      private

        def failure_reason
          return "was not given a block" unless Proc === @event_proc
          "was changed by #{description_of @change_details.actual_delta}"
        end
      end

      # @api private
      # Base class for specifying a change from and/or to specific values.
      class SpecificValuesChange < BaseMatcher
        # @private
        MATCH_ANYTHING = ::Object.ancestors.last

        def initialize(change_details, from, to)
          @change_details  = change_details
          @expected_before = from
          @expected_after  = to
        end

        # @private
        def matches?(event_proc)
          perform_change(event_proc) && @change_details.changed? && @matches_before && matches_after?
        end

        # @private
        def description
          "change #{@change_details.value_representation} #{change_description}"
        end

        # @private
        def failure_message
          return not_given_a_block_failure unless Proc === @event_proc
          return before_value_failure      unless @matches_before
          return did_not_change_failure    unless @change_details.changed?
          after_value_failure
        end

        # @private
        def supports_block_expectations?
          true
        end

      private

        def perform_change(event_proc)
          @event_proc = event_proc
          @change_details.perform_change(event_proc) do |actual_before|
            # pre-compute values derived from the `before` value before the
            # mutation is applied, in case the specified mutation is mutation
            # of a single object (rather than a changing what object a method
            # returns). We need to cache these values before the `before` value
            # they are based on potentially gets mutated.
            @matches_before = values_match?(@expected_before, actual_before)
            @actual_before_description = description_of(actual_before)
          end
        end

        def matches_after?
          values_match?(@expected_after, @change_details.actual_after)
        end

        def before_value_failure
          "expected #{@change_details.value_representation} " \
          "to have initially been #{description_of @expected_before}, " \
          "but was #{@actual_before_description}"
        end

        def after_value_failure
          "expected #{@change_details.value_representation} " \
          "to have changed to #{description_of @expected_after}, " \
          "but is now #{description_of @change_details.actual_after}"
        end

        def did_not_change_failure
          "expected #{@change_details.value_representation} " \
          "to have changed #{change_description}, but did not change"
        end

        def did_change_failure
          "expected #{@change_details.value_representation} not to have changed, but " \
          "did change from #{@actual_before_description} " \
          "to #{description_of @change_details.actual_after}"
        end

        def not_given_a_block_failure
          "expected #{@change_details.value_representation} to have changed " \
          "#{change_description}, but was not given a block"
        end
      end

      # @api private
      # Used to specify a change from a specific value
      # (and, optionally, to a specific value).
      class ChangeFromValue < SpecificValuesChange
        def initialize(change_details, expected_before)
          @description_suffix = nil
          super(change_details, expected_before, MATCH_ANYTHING)
        end

        # @api public
        # Specifies the new value you expect.
        def to(value)
          @expected_after     = value
          @description_suffix = " to #{description_of value}"
          self
        end

        # @private
        def does_not_match?(event_proc)
          if @description_suffix
            raise NotImplementedError, "`expect { }.not_to change { }.to()` " \
              "is not supported"
          end

          perform_change(event_proc) && !@change_details.changed? && @matches_before
        end

        # @private
        def failure_message_when_negated
          return not_given_a_block_failure unless Proc === @event_proc
          return before_value_failure unless @matches_before
          did_change_failure
        end

      private

        def change_description
          "from #{description_of @expected_before}#{@description_suffix}"
        end
      end

      # @api private
      # Used to specify a change to a specific value
      # (and, optionally, from a specific value).
      class ChangeToValue < SpecificValuesChange
        def initialize(change_details, expected_after)
          @description_suffix = nil
          super(change_details, MATCH_ANYTHING, expected_after)
        end

        # @api public
        # Specifies the original value.
        def from(value)
          @expected_before    = value
          @description_suffix = " from #{description_of value}"
          self
        end

        # @private
        def does_not_match?(_event_proc)
          raise NotImplementedError, "`expect { }.not_to change { }.to()` " \
            "is not supported"
        end

      private

        def change_description
          "to #{description_of @expected_after}#{@description_suffix}"
        end
      end

      # @private
      # Encapsulates the details of the before/after values.
      #
      # Note that this class exposes the `actual_after` value, to allow the
      # matchers above to derive failure messages, etc from the value on demand
      # as needed, but it intentionally does _not_ expose the `actual_before`
      # value. Some usages of the `change` matcher mutate a specific object
      # returned by the value proc, which means that failure message snippets,
      # etc, which are derived from the `before` value may not be accurate if
      # they are lazily computed as needed. We must pre-compute them before
      # applying the change in the `expect` block. To ensure that all `change`
      # matchers do that properly, we do not expose the `actual_before` value.
      # Instead, matchers must pass a block to `perform_change`, which yields
      # the `actual_before` value before applying the change.
      class ChangeDetails
        attr_reader :actual_after

        def initialize(matcher_name, receiver=nil, message=nil, &block)
          if receiver && !message
            raise(
              ArgumentError,
              "`change` requires either an object and message " \
              "(`change(obj, :msg)`) or a block (`change { }`). " \
              "You passed an object but no message."
            )
          end

          @matcher_name = matcher_name
          @receiver = receiver
          @message = message
          @value_proc = block
        end

        def value_representation
          @value_representation ||=
            if @message
              "`#{message_notation(@receiver, @message)}`"
            elsif (value_block_snippet = extract_value_block_snippet)
              "`#{value_block_snippet}`"
            else
              'result'
            end
        end

        def perform_change(event_proc)
          @actual_before = evaluate_value_proc
          @before_hash = @actual_before.hash
          yield @actual_before if block_given?

          return false unless Proc === event_proc
          event_proc.call

          @actual_after = evaluate_value_proc
          @actual_hash = @actual_after.hash
          true
        end

        def changed?
          # Consider it changed if either:
          #
          # - The before/after values are unequal
          # - The before/after values have different hash values
          #
          # The latter case specifically handles the case when the value proc
          # returns the exact same object, but it has been mutated.
          #
          # Note that it is not sufficient to only check the hashes; it is
          # possible for two values to be unequal (and of different classes)
          # but to return the same hash value. Also, some objects may change
          # their hash after being compared with `==`/`!=`.
          @actual_before != @actual_after || @before_hash != @actual_hash
        end

        def actual_delta
          @actual_after - @actual_before
        end

      private

        def evaluate_value_proc
          @value_proc ? @value_proc.call : @receiver.__send__(@message)
        end

        def message_notation(receiver, message)
          case receiver
          when Module
            "#{receiver}.#{message}"
          else
            "#{Support.class_of(receiver)}##{message}"
          end
        end

        if RSpec::Support::RubyFeatures.ripper_supported?
          def extract_value_block_snippet
            return nil unless @value_proc
            Expectations::BlockSnippetExtractor.try_extracting_single_line_body_of(@value_proc, @matcher_name)
          end
        else
          def extract_value_block_snippet
            nil
          end
        end
      end
    end
  end
end


text:
.tree{
	font-size:12px;
	margin:0;
	padding:0;
	list-style-type:none;
}
.tree li{
	white-space:nowrap;
}
.tree li ul{
	list-style-type:none;
	margin:0;
	padding:0;
}
.tree-node{
	height:18px;
	white-space:nowrap;
	cursor:pointer;
}
.tree-indent{
	display:inline-block;
	width:16px;
	height:18px;
	vertical-align:middle;
}
.tree-hit{
	cursor:pointer;
}
.tree-expanded{
	display:inline-block;
	width:16px;
	height:18px;
	vertical-align:middle;
	background:url('images/tree_arrows.gif') no-repeat -18px 0px;
}
.tree-expanded-hover{
	background:url('images/tree_arrows.gif') no-repeat -50px 0px;
}
.tree-collapsed{
	display:inline-block;
	width:16px;
	height:18px;
	vertical-align:middle;
	background:url('images/tree_arrows.gif') no-repeat 0px 0px;
}
.tree-collapsed-hover{
	background:url('images/tree_arrows.gif') no-repeat -32px 0px;
}
.tree-lines .tree-expanded{
	background:url('images/tree_elbow.png') no-repeat -36px -54px;
}
.tree-lines .tree-collapsed{
	background:url('images/tree_elbow.png') no-repeat 0px -36px;
}
.tree-lines .tree-node-last .tree-expanded{
	background:url('images/tree_elbow.png') no-repeat -18px 0px;
}
.tree-lines .tree-node-last .tree-collapsed{
	background:url('images/tree_elbow.png') no-repeat -36px -36px;
}
.tree-lines .tree-root-first .tree-expanded{
	background:url('images/tree_elbow.png') no-repeat -18px -54px;
}
.tree-lines .tree-root-first .tree-collapsed{
	background:url('images/tree_elbow.png') no-repeat -18px -36px;
}
.tree-lines .tree-root-one .tree-expanded{
	background:url('images/tree_elbow.png') no-repeat 0px -18px;
}
.tree-lines .tree-root-one .tree-collapsed{
	background:url('images/tree_elbow.png') no-repeat 0px -72px;
}
.tree-line{
	background:url('images/tree_elbow.png') no-repeat 0px -54px;
}
.tree-join{
	background:url('images/tree_elbow.png') no-repeat -18px -18px;
}
.tree-joinbottom{
	background:url('images/tree_elbow.png') no-repeat 0px 0px;
}
.tree-folder{
	display:inline-block;
	background:url('images/tree_folder.gif') no-repeat;
	width:16px;
	height:18px;
	vertical-align:middle;
}
.tree-folder-open{
	background:url('images/tree_folder_open.gif') no-repeat;
}
.tree-file{
	display:inline-block;
	background:url('images/tree_file.gif') no-repeat;
	width:16px;
	height:18px;
	vertical-align:middle;
}
.tree-loading{
	background:url('images/tree_loading.gif') no-repeat;
}
.tree-title{
	display:inline-block;
	text-decoration:none;
	vertical-align:middle;
	padding:1px 2px 1px 2px;
	white-space:nowrap;
}

.tree-node-hover{
	background:#fafafa;
}
.tree-node-selected{
	background:#FBEC88;
}
.tree-checkbox{
	display:inline-block;
	width:16px;
	height:18px;
	vertical-align:middle;
}
.tree-checkbox0{
	background:url('images/tree_checkbox_0.gif') no-repeat;
}
.tree-checkbox1{
	background:url('images/tree_checkbox_1.gif') no-repeat;
}
.tree-checkbox2{
	background:url('images/tree_checkbox_2.gif') no-repeat;
}
.tree-node-proxy{
	font-size:12px;
	padding:1px 2px 1px 18px;
	background:#fafafa;
	border:1px solid #ccc;
	z-index:9900000;
}
.tree-dnd-yes{
	background:url('images/tree_dnd_yes.png') no-repeat 0 center;
}
.tree-dnd-no{
	background:url('images/tree_dnd_no.png') no-repeat 0 center;
}
.tree-node-top{
	border-top:1px dotted red;
}
.tree-node-bottom{
	border-bottom:1px dotted red;
}
.tree-node-append .tree-title{
	border:1px dotted red;
}
.tree-editor{
	border:1px solid #ccc;
	font-size:12px;
	line-height:16px;
	width:80px;
	position:absolute;
	top:0;
}


text:
package com.alibaba.json.test.benchmark;

import java.lang.management.ManagementFactory;
import java.util.List;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.serializer.SerializeConfig;
import com.alibaba.json.test.TestUtils;
import com.alibaba.json.test.benchmark.decode.EishayDecodeBytes;

import data.media.Image;
import data.media.Media;
import data.media.MediaContent;
import data.media.writeAsArray.ImageSerializer;
import data.media.writeAsArray.MediaContentSerializer;
import data.media.writeAsArray.MediaSerializer;

public class BenchmarkMain_EishayEncode_WriteAsArray {

    public static void main(String[] args) throws Exception {
        SerializeConfig config = SerializeConfig.getGlobalInstance();
        config.put(MediaContent.class, new MediaContentSerializer());
        config.put(Media.class, new MediaSerializer());
        config.put(Image.class, new ImageSerializer());

        System.out.println(System.getProperty("java.vm.name") + " " + System.getProperty("java.runtime.version"));
        List<String> arguments = ManagementFactory.getRuntimeMXBean().getInputArguments();
        System.out.println(arguments);

        MediaContent content = EishayDecodeBytes.instance.getContent();
        String text = encode(content);
        System.out.println(text);

        for (int i = 0; i < 10; ++i) {
            perf(text);
        }
    }

    static long perf(Object obj) {
        long startYGC = TestUtils.getYoungGC();
        long startYGCTime = TestUtils.getYoungGCTime();
        long startFGC = TestUtils.getFullGC();

        long startMillis = System.currentTimeMillis();
        for (int i = 0; i < 1000 * 1000; ++i) {
            encode(obj);
        }
        long millis = System.currentTimeMillis() - startMillis;

        long ygc = TestUtils.getYoungGC() - startYGC;
        long ygct = TestUtils.getYoungGCTime() - startYGCTime;
        long fgc = TestUtils.getFullGC() - startFGC;

        System.out.println("encode\t" + millis + ", ygc " + ygc + ", ygct " + ygct + ", fgc " + fgc);
        return millis;
    }

    static String encode(Object text) {
        return JSON.toJSONString(text);
    }
}


text:
import Immutable from 'immutable';
import {packValue, unpackValue, badFunction} from './value';
import {TextDecoder} from 'text-encoding-utf-8';

const littleEndian = false;

export const allocate = function (size) {
  return Immutable.List(Array(size).fill(0));
};

export const writeValue = function (memory, ref, value) {
  if (value === undefined)
    return memory;  // XXX
  // XXX assert(ref instanceof PointerValue)
  // XXX assert(typeEquals(ref.type.pointee, value.type))
  const address = ref.address;
  const nbytes = value.type.size;
  const view = new DataView(new ArrayBuffer(nbytes));
  packValue(view, 0, value, littleEndian);
  for (let offset = 0; offset < nbytes; offset += 1) {
    memory = memory.set(address + offset, view.getUint8(offset));
  }
  return memory;
};

export const readValue = function (core, ref) {
  // XXX assert(ref instanceof PointerValue)
  const {memory} = core;
  const {type, address} = ref;
  const nbytes = type.pointee.size;
  const view = new DataView(new ArrayBuffer(nbytes));
  for (let offset = 0; offset < nbytes; offset += 1) {
    view.setUint8(offset, memory.get(address + offset));
  }
  return unpackValue(view, 0, type.pointee, littleEndian, core);
};

export const strlen = function (memory, ref, maxBytes) {
  const {address} = ref;
  const limit = (maxBytes === undefined ? memory.size : Math.min(memory.size, address + maxBytes)) - 1;
  let endAddress = address;
  while (endAddress < limit && memory.get(endAddress) !== 0) {
    endAddress += 1;
  }
  return endAddress - address;
};

const readBytes = function (view, byteCount, memory, ref) {
  for (let offset = 0; offset < byteCount; offset += 1) {
    view.setInt8(offset, memory.get(ref.address + offset));
  }
};

export const readString = function (memory, ref, maxBytes) {
  const byteCount = strlen(memory, ref, maxBytes);
  const view = new DataView(new ArrayBuffer(byteCount));
  readBytes(view, byteCount, memory, ref);
  const decoder = new TextDecoder("utf-8");
  return decoder.decode(view);
};


text:
package com.example.yang.test.util;

import android.content.Context;
import android.os.Bundle;
import android.util.Log;
import android.widget.Toast;

import com.iflytek.cloud.SpeechConstant;
import com.iflytek.cloud.SpeechError;
import com.iflytek.cloud.SpeechUtility;
import com.iflytek.cloud.VoiceWakeuper;
import com.iflytek.cloud.WakeuperListener;
import com.iflytek.cloud.WakeuperResult;
import com.iflytek.cloud.util.ResourceUtil;
import com.iflytek.cloud.util.ResourceUtil.RESOURCE_TYPE;

import org.json.JSONException;
import org.json.JSONObject;

/**
 * Created by Administrator on 2017/2/10.
 */

public abstract class WakeupUtil {
    /**
     * 唤醒的回调
     */
    public abstract void kqwWake();

    // 上下文
    private Context mContext;
    // 语音唤醒对象
    private VoiceWakeuper mIvw;
    private String resultString = "";

    /*
     * TODO 设置门限值 : 门限值越低越容易被唤醒,需要自己反复测试,根据不同的使用场景,设置一个比较合适的唤醒门限
     */
    // private final static int MAX = 60;
    // private final static int MIN = -20;
    private int curThresh = 40;

    public WakeupUtil(Context context) {
        mContext = context;

        // 加载识唤醒地资源,resPath为本地识别资源路径
        StringBuffer param = new StringBuffer();
        String resPath = ResourceUtil.generateResourcePath(context, RESOURCE_TYPE.assets, "ivw/586db7d6.jet");
        param.append(ResourceUtil.IVW_RES_PATH + "=" + resPath);
        param.append("," + ResourceUtil.ENGINE_START + "=" + SpeechConstant.ENG_IVW);
        boolean ret = SpeechUtility.getUtility().setParameter(ResourceUtil.ENGINE_START, param.toString());
        if (!ret) {
            LogUtils.d("启动本地引擎失败!");
        }
        // 初始化唤醒对象
        mIvw = VoiceWakeuper.createWakeuper(context, null);

    }

    ;

    /**
     * 唤醒
     */
    public void wake() {
        // 非空判断,防止因空指针使程序崩溃
        mIvw = VoiceWakeuper.getWakeuper();
        if (mIvw != null) {
            // 清空参数
            mIvw.setParameter(SpeechConstant.PARAMS, null);
            // 唤醒门限值,根据资源携带的唤醒词个数按照"id:门限;id:门限"的格式传入
            mIvw.setParameter(SpeechConstant.IVW_THRESHOLD, "0:" + curThresh);
            // 设置唤醒模式
            mIvw.setParameter(SpeechConstant.IVW_SST, "wakeup");
            // 设置持续进行唤醒
            mIvw.setParameter(SpeechConstant.KEEP_ALIVE, "1");
            mIvw.startListening(mWakeuperListener);
        } else {
            ToastUtil.showToast(mContext,"唤醒未初始化");
        }
    }

    public void stopWake() {
        mIvw = VoiceWakeuper.getWakeuper();
        if (mIvw != null) {
            mIvw.stopListening();
        } else {
            ToastUtil.showToast(mContext,"唤醒未初始化");
        }
    }

    private WakeuperListener mWakeuperListener = new WakeuperListener() {

        @Override
        public void onResult(WakeuperResult result) {
            LogUtils.d("onResult");
            try {
                String text = result.getResultString();
                JSONObject object;
                object = new JSONObject(text);
                StringBuffer buffer = new StringBuffer();
                buffer.append("【RAW】 " + text);
                buffer.append("\n");
                buffer.append("【操作类型】" + object.optString("sst"));
                buffer.append("\n");
                buffer.append("【唤醒词id】" + object.optString("id"));
                buffer.append("\n");
                buffer.append("【得分】" + object.optString("score"));
                buffer.append("\n");
                buffer.append("【前端点】" + object.optString("bos"));
                buffer.append("\n");
                buffer.append("【尾端点】" + object.optString("eos"));
                resultString = buffer.toString();
                stopWake();
                kqwWake();
            } catch (JSONException e) {
                resultString = "结果解析出错";
                e.printStackTrace();
            }
        }

        @Override
        public void onError(SpeechError error) {
            LogUtils.d("onError--"+error.getPlainDescription(true));
        }

        @Override
        public void onBeginOfSpeech() {
            LogUtils.d("onBeginOfSpeech");
        }

        @Override
        public void onEvent(int eventType, int isLast, int arg2, Bundle obj) {
            LogUtils.d("onEvent");
        }

        @Override
        public void onVolumeChanged(int i) {
            LogUtils.d("onVolumeChanged");
        }
    };
}


text:
typedef NS_ENUM(NSUInteger, MLActivationFunctionType) {
	MLActivationFunctionTypeLinear= 0,
    MLActivationFunctionTypeRectifiedLinear,
	MLActivationFunctionTypeStep,
	MLActivationFunctionTypeSigmoid,
	MLActivationFunctionTypeTanH
};

#endif


text:
import httplib2
import mock
import unittest
import ee

class DataTest(unittest.TestCase):

  def testSuccess(self):
    with DoStubHttp(200, 'application/json', '{"data": "bar"}'):
      self.assertEqual('bar', ee.data.send_('/foo', {}))

  def testNon200Success(self):
    with DoStubHttp(202, 'application/json', '{"data": "bar"}'):
      self.assertEqual('bar', ee.data.send_('/foo', {}))

  def testJsonSyntaxError(self):
    with DoStubHttp(200, 'application/json', '{"data"}'):
      with self.assertRaises(ee.ee_exception.EEException) as cm:
        ee.data.send_('/foo', {})
      self.assertEqual('Invalid JSON: {"data"}', str(cm.exception))

  def testJsonStructureError(self):
    with DoStubHttp(200, 'application/json', '{}'):
      with self.assertRaises(ee.ee_exception.EEException) as cm:
        ee.data.send_('/foo', {})
      self.assertEqual('Malformed response: {}', str(cm.exception))

  def testUnexpectedStatus(self):
    with DoStubHttp(418, 'text/html', '<html>'):
      with self.assertRaises(ee.ee_exception.EEException) as cm:
        ee.data.send_('/foo', {})
      self.assertEqual('Server returned HTTP code: 418', str(cm.exception))

  def testJson200Error(self):
    with DoStubHttp(200, 'application/json',
                    '{"error": {"code": 500, "message": "bar"}}'):
      with self.assertRaises(ee.ee_exception.EEException) as cm:
        ee.data.send_('/foo', {})
      self.assertEqual(u'bar', str(cm.exception))

  def testJsonNon2xxError(self):
    with DoStubHttp(400, 'application/json',
                    '{"error": {"code": 400, "message": "bar"}}'):
      with self.assertRaises(ee.ee_exception.EEException) as cm:
        ee.data.send_('/foo', {})
      self.assertEqual(u'bar', str(cm.exception))

  def testWrongContentType(self):
    with DoStubHttp(200, 'text/html', '{"data": "bar"}'):
      with self.assertRaises(ee.ee_exception.EEException) as cm:
        ee.data.send_('/foo', {})
      self.assertEqual(u'Response was unexpectedly not JSON, but text/html',
                       str(cm.exception))

  def testNoContentType(self):
    with DoStubHttp(200, None, '{"data": "bar"}'):
      self.assertEqual('bar', ee.data.send_('/foo', {}))

  def testContentTypeParameterAllowed(self):
    with DoStubHttp(200, 'application/json; charset=utf-8', '{"data": ""}'):
      self.assertEqual('', ee.data.send_('/foo', {}))

  def testRawSuccess(self):
    with DoStubHttp(200, 'image/png', 'FAKEDATA'):
      self.assertEqual('FAKEDATA', ee.data.send_('/foo', {}, opt_raw=True))

  def testRawError(self):
    with DoStubHttp(400, 'application/json',
                    '{"error": {"code": 400, "message": "bar"}}'):
      with self.assertRaises(ee.ee_exception.EEException) as cm:
        ee.data.send_('/foo', {}, opt_raw=True)
      self.assertEqual(u'Server returned HTTP code: 400', str(cm.exception))

  def testRaw200Error(self):
    """Raw shouldn't be parsed, so the error-in-200 shouldn't be noticed.

    (This is an edge case we do not expect to see.)
    """
    with DoStubHttp(200, 'application/json',
                    '{"error": {"code": 400, "message": "bar"}}'):
      self.assertEqual('{"error": {"code": 400, "message": "bar"}}',
                       ee.data.send_('/foo', {}, opt_raw=True))

  def testNotProfiling(self):
    # Test that we do not request profiling.
    with DoProfileStubHttp(self, False):
      ee.data.send_('/foo', {})

  def testProfiling(self):
    with DoProfileStubHttp(self, True):
      seen = []
      def ProfileHook(profile_id):
        seen.append(profile_id)

      with ee.data.profiling(ProfileHook):
        ee.data.send_('/foo', {})
      self.assertEqual(['someProfileId'], seen)

  def testProfilingCleanup(self):
    with DoProfileStubHttp(self, True):
      try:
        with ee.data.profiling(lambda _: None):
          raise ExceptionForTest()
      except ExceptionForTest:
        pass

    # Should not have profiling enabled after exiting the context by raising.
    with DoProfileStubHttp(self, False):
      ee.data.send_('/foo', {})

def DoStubHttp(status, mime, resp_body):
  """Context manager for temporarily overriding Http."""
  def Request(unused_self, unused_url, method, body, headers):
    _ = method, body, headers  # Unused kwargs.
    response = httplib2.Response({
        'status': status,
        'content-type': mime,
    })
    return response, resp_body
  return mock.patch('httplib2.Http.request', new=Request)

def DoProfileStubHttp(test, expect_profiling):
  def Request(unused_self, unused_url, method, body, headers):
    _ = method, headers  # Unused kwargs.
    test.assertEqual(expect_profiling, 'profiling=1' in body, msg=body)
    response_dict = {
        'status': 200,
        'content-type': 'application/json'
    }
    if expect_profiling:
      response_dict['x-earth-engine-computation-profile'] = 'someProfileId'
    response = httplib2.Response(response_dict)
    return response, '{"data": "dummy_data"}'
  return mock.patch('httplib2.Http.request', new=Request)

class ExceptionForTest(Exception):
  pass

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


text:
package eureka

const (
	softlayerInstanceID = "getId"
)

// SoftLayer datacenter information
type softlayerInfo struct{}

// Returns the unique identifier of this datacenter info
func (softlayer *softlayerInfo) GetID(dcinfo *DatacenterInfo) string {
	if dcinfo == nil || dcinfo.Metadata == nil {
		return ""
	}

	uid := dcinfo.Metadata[softlayerInstanceID]
	return uid
}


text:
package io.wenhao.mapper;

import io.wenhao.model.User;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Component;

@Component
public interface UserMapper {

    public User getUser(@Param("id") Integer id);

    public User getUserByName(@Param("userName") String userName);

    public Integer addUserBasic(User user);

    public Integer addUserInfo(@Param("user") User user);

    public User updateUser(@Param("user") User user);

    public Integer deleteUserBasic(@Param("id") String id);

    public Integer deleteUserInfo(@Param("id") String id);
}


text:
module Main where

import Test.Ribot.Tokenizer

import Test.Framework (Test, defaultMain, testGroup)

main :: IO ()
main = defaultMain tests

tests :: [Test]
tests =
    [ testGroup "tokenizer" tokenizerTests
    ]


text:
package info.breezes.orm;

import android.database.sqlite.SQLiteOpenHelper;
import info.breezes.orm.utils.TableUtils;

/**
 * Created by jianxingqiao on 5/4/2014.
 */

public abstract class OrmSQLiteHelper extends SQLiteOpenHelper {

    public OrmSQLiteHelper(android.content.Context context, String name, android.database.sqlite.SQLiteDatabase.CursorFactory factory, int version) {
        this(context, name, factory, version, null);
    }

    public OrmSQLiteHelper(android.content.Context context, String name, android.database.sqlite.SQLiteDatabase.CursorFactory factory, int version, android.database.DatabaseErrorHandler errorHandler) {
        super(context, name, factory, version, errorHandler);
    }

    public synchronized void close(){
        super.close();
    }

    public <T> QueryAble<T> query(Class<T> tableClass) {
        return new QueryAble<T>(tableClass, getReadableDatabase());
    }

    public long insert(Object object) {
        return TableUtils.insert(getWritableDatabase(), object);
    }

    public int update(Object object) {
        return TableUtils.update(getWritableDatabase(), object);
    }

    public int insertOrUpdate(Object object){
        return -1;
    }

    public <T> int updateBy(Object object,String column){
        return -1;
    }

    public int delete(Object object){
        return -1;
    }

    public <T> int deleteBy(Object object,String column){
        return -1;
    }

}


text:
<?php

namespace App\Form\Processor;

use App\Entity\Manager\UserManager;
use App\Form\UserForm;
use Symfony\Component\Form\FormFactoryInterface;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;

class UserFormProcessor extends AbstractFormProcessor
{
    /**
     * @var UserManager
     */
    private $userManager;

    private $user;

    public function __construct(
        UserManager $userManager,
        FormFactoryInterface $formFactory,
        TokenStorageInterface $tokenStorage
    ) {
        parent::__construct($formFactory, $tokenStorage);

        $this->userManager = $userManager;
    }

    protected function handleRequest(Request $request)
    {
        if ($request->isMethod('POST')) {
            $form = $this->getForm();

            $form->handleRequest($request);

            if ($form->isValid()) {
                $this->user = $form->getData();

                $this->userManager->updateUser($this->user);

                $this->evaluateRedirect();
            }
        }
    }

    protected function getFormClass()
    {
        return UserForm::class;
    }

    protected function getFormOptions()
    {
        return [
            'user' => $this->getAuthenticatedUser(),
        ];
    }

    public function getUser()
    {
        return $this->user;
    }

    protected function evaluateRedirect()
    {
        $this->setRedirectTo(
            $this->isButtonClicked(
                'saveAndClose'
            ) ? self::REDIRECT_TO_LIST : null
        );
    }
}


text:
layout: post
date: 2010-06-08
time: "09:00:00"
authors: ["Greg Wilson"]
title: "Episode 11: Making It Fast"
category: ["Content"]
---

Today's episode is the last in the series on program design using invasion percolation as an example.  In it, we look at how to make the program we've developed so far run zillions of times faster. It's the longest episode so far, and probably the most difficult, but it makes two very important points:

The biggest performance gains come from improvements to algorithms and data structures, not from tweaking loops and rearranging conditionals.

If you want to write a fast program, you should start by writing a simple one, test it, and then rewrite it piece by piece, re-testing as you go along.

Here's the complete list of episodes:

Introduction

The Grid

Aliasing

Randomness

Finding Neighbors

Resolving Ties

Assembling the Program

Bugs

Refactoring

Testing

Tuning


text:
package org.jboss.as.quickstart.xml;

import java.net.URL;

public class Resources {

   public static URL getResource(String path) {
      return Resources.class.getResource(path);
   }

}


text:
package org.tinywind.codility.lesson2;

import java.util.Arrays;
import java.util.TreeSet;

/**
 * https://codility.com/programmers/task/odd_occurrences_in_array/
 * Find value that occurs in odd number of elements.
 *
 * @author http://tinywind.blog.me/220752072231
 * score: 100
 */
public class OddOccurrencesInArray {
    public static void main(String[] args) {
        p(2, 1, 2, 3, 3);
        p(10, 10, 1);
        p(10);
    }

    private static void p(int... A) {
        System.out.println("A(" + Arrays.toString(A) + ") : " + solution(A));
    }

    private static int solution(int[] A) {
        TreeSet<Integer> unpaired = new TreeSet<>();
        for (int i : A) {
            if (unpaired.remove(i)) {
                continue;
            }
            unpaired.add(i);
        }
        return unpaired.first();
    }
}


text:
<template name="categories_menu">
  <div class="categories-menu-wrapper {{moduleClass}}">
    {{#if hasCategories}}
      {{> menuComponent menuName="categories" menuLabel=menuLabel itemTemplate="categories_menu_item" menuItems=menuItems menuClass=menuClass startPosition=startPosition}}
    {{/if}}
  </div>
</template>


text:
<?php

namespace App\Http\Controllers\Auth;

use App\Http\Controllers\Controller;
use App\Providers\RouteServiceProvider;
use Illuminate\Http\Request;
use Inertia\Inertia;

class EmailVerificationPromptController extends Controller
{
    /**
     * Display the email verification prompt.
     *
     * @param  \Illuminate\Http\Request  $request
     * @return mixed
     */
    public function __invoke(Request $request)
    {
        return $request->user()->hasVerifiedEmail()
                    ? redirect()->intended(RouteServiceProvider::HOME)
                    : Inertia::render('Auth/VerifyEmail', ['status' => session('status')]);
    }
}


text:
/**
 * Created by pratik on 18/12/17.
 */
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { FormsModule } from '@angular/forms';
import { IconLoaderService } from '../../../index';
import { AmexioVideoPlayerComponent } from './video.player.component';

describe('amexio-video-player', () => {
    let comp: AmexioVideoPlayerComponent;
    let fixture: ComponentFixture<AmexioVideoPlayerComponent>;

    beforeEach(() => {
        TestBed.configureTestingModule({
            imports: [FormsModule],
            declarations: [AmexioVideoPlayerComponent],
            providers: [IconLoaderService],
        });
        fixture = TestBed.createComponent(AmexioVideoPlayerComponent);
        comp = fixture.componentInstance;
    });

    // it('check routeBackToApp method',() => {
    //     comp.currentVolume = 1;
    //         expect(comp.currentVolume).toEqual(1);
    // });

});


text:
package command.control;

import java.util.List;
import model.TreeInterpreter;
import model.Turtle;
import parser.CommandTreeNode;
import command.Command;

public class AskWithCommand extends Command{
    private TreeInterpreter tree;
    private CommandTreeNode condition;
    private List<CommandTreeNode> subCommands;

    public AskWithCommand (CommandTreeNode node1, CommandTreeNode node2, TreeInterpreter t) {
        tree = t;
        condition = node1.getChildren().get(0);
        subCommands = node2.getChildren();
    }

    public double calculateValue () {
        List<Turtle> turtles = tree.getTurtleList();
        tree.interpretTree(condition);
        for (int i = 0; i < turtles.size(); i++) {
            if((i+1) == (int) condition.getValue()){
                tree.setActiveTurtleIndex(i+1);
                for (int j = 0; j < subCommands.size(); j++) {
                    tree.interpretTree(subCommands.get(j));
                    if ((i == turtles.size() - 1) && (j == (subCommands.size() - 1))) { // return the last command run
                        tree.setActiveTurtleIndex(1); // set the activeTurtleIndex back to 1;
                        return subCommands.get(j).getValue();
                    }
                }
            }
        }
        return 0;
    }
}


text:
FactoryGirl.define do
  factory :category do
    name "Name"
  end

  factory :menu_item do
    label "Some menu item name"
    url "http://somedomain.com"
    site_id 1
  end

  factory :page do
    name "Some page name"
  end
end


text:
![Logo](docs/logo-30.png) i3: A tiling window manager
=====================================================

[![Build Status](https://github.com/i3/i3/actions/workflows/main.yml/badge.svg)](https://github.com/i3/i3/actions/workflows/main.yml)
[![Issue Stats](https://img.shields.io/github/issues/i3/i3.svg)](https://github.com/i3/i3/issues)
[![Pull Request Stats](https://img.shields.io/github/issues-pr/i3/i3.svg)](https://github.com/i3/i3/pulls)

[![Packages](https://repology.org/badge/latest-versions/i3.svg)](https://repology.org/metapackage/i3/versions)
[![Packages](https://repology.org/badge/tiny-repos/i3.svg)](https://repology.org/metapackage/i3/versions)

i3 is a tiling window manager for X11.

For more information about i3, please see [the project's website](https://i3wm.org/) and [online documentation](https://i3wm.org/docs/).

For information about contributing to i3, please see [CONTRIBUTING.md](.github/CONTRIBUTING.md).


text:
#include <find.hpp>

#include <iostream>
#include <regex>

#include <cmdline.hpp>
#include <kdb.hpp>
#include <keysetio.hpp>

using namespace kdb;
using namespace std;

FindCommand::FindCommand ()
{
}

int FindCommand::execute (Cmdline const & cl)
{
	Key root ("/", KEY_END);
	KDB kdb (root);
	KeySet ks;

	printWarnings (cerr, root);

	kdb.get (ks, root);

	if (cl.verbose) cout << "size of all keys: " << ks.size () << endl;

	KeySet part;
	std::smatch match;

	try
	{
		std::regex reg (cl.arguments[0]);

		for (const auto & it : ks)
		{
			std::string name = it.getName ();
			if (std::regex_search (name, match, reg))
			{
				part.append (it);
			}
		}
	}
	catch (const regex_error & error)
	{
		cerr << "Regex error in "" << cl.arguments[0] << "": " << error.what () << endl;
	}

	if (cl.verbose) cout << "size of found keys: " << part.size () << endl;
	cout.setf (std::ios_base::unitbuf);
	if (cl.null)
	{
		cout.unsetf (std::ios_base::skipws);
	}

	std::cout << part;

	printWarnings (cerr, root);

	return 0;
}

FindCommand::~FindCommand ()
{
}


text:
package org.apache.geode.internal.jndi;

import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.catchThrowable;
import static org.mockito.Mockito.any;
import static org.mockito.Mockito.doThrow;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.never;
import static org.mockito.Mockito.same;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;

import java.sql.Connection;
import java.sql.SQLException;
import java.util.HashMap;
import java.util.Map;

import javax.naming.Context;
import javax.sql.DataSource;

import org.junit.Test;

import org.apache.geode.internal.datasource.DataSourceCreateException;
import org.apache.geode.internal.datasource.DataSourceFactory;

public class JNDIInvokerTest {

  @Test
  public void verifyThatMapDataSourceWithGetSimpleDataSourceThrowingWillThrowThatException()
      throws Exception {
    Map<String, String> inputs = new HashMap<>();
    Context context = mock(Context.class);
    DataSourceFactory dataSourceFactory = mock(DataSourceFactory.class);
    DataSourceCreateException exception = mock(DataSourceCreateException.class);
    doThrow(exception).when(dataSourceFactory).getSimpleDataSource(any());
    inputs.put("type", "SimpleDataSource");

    Throwable thrown =
        catchThrowable(() -> JNDIInvoker.mapDatasource(inputs, null, dataSourceFactory, context));

    assertThat(thrown).isSameAs(exception);
  }

  @Test
  public void mapDataSourceWithGetConnectionExceptionThrowsDataSourceCreateException()
      throws Exception {
    Map<String, String> inputs = new HashMap<>();
    Context context = mock(Context.class);
    DataSource dataSource = mock(DataSource.class);
    SQLException exception = mock(SQLException.class);
    doThrow(exception).when(dataSource).getConnection();
    DataSourceFactory dataSourceFactory = mock(DataSourceFactory.class);
    when(dataSourceFactory.getSimpleDataSource(any())).thenReturn(dataSource);
    inputs.put("type", "SimpleDataSource");
    String jndiName = "myJndiBinding";
    inputs.put("jndi-name", jndiName);

    Throwable thrown =
        catchThrowable(() -> JNDIInvoker.mapDatasource(inputs, null, dataSourceFactory, context));

    assertThat(thrown).isInstanceOf(DataSourceCreateException.class)
        .hasMessage("Failed to connect to \"" + jndiName + "\". See log for details");
    verify(context, never()).rebind((String) any(), any());
  }

  @Test
  public void mapDataSourceWithGetConnectionSuccessClosesConnectionAndRebinds() throws Exception {
    Map<String, String> inputs = new HashMap<>();
    Context context = mock(Context.class);
    DataSource dataSource = mock(DataSource.class);
    Connection connection = mock(Connection.class);
    when(dataSource.getConnection()).thenReturn(connection);
    DataSourceFactory dataSourceFactory = mock(DataSourceFactory.class);
    when(dataSourceFactory.getSimpleDataSource(any())).thenReturn(dataSource);
    inputs.put("type", "SimpleDataSource");
    String jndiName = "myJndiBinding";
    inputs.put("jndi-name", jndiName);

    JNDIInvoker.mapDatasource(inputs, null, dataSourceFactory, context);

    verify(connection).close();
    verify(context).rebind((String) any(), same(dataSource));
  }
}


text:
@implementation DRSession

@synthesize delegate = _delegate;

#pragma mark -
#pragma mark init & dealloc methods

- (id) initWithHostName:(NSString *)host {
    // default to telnet port 23
    return [self initWithHostName:host port:23];
}

- (id) initWithHostName:(NSString *)host port:(NSInteger)port {
    if ( (self = [super init]) ) {
        socket = [[AsyncSocket alloc] initWithDelegate:self];

        // continue to send commands during mouse drags
        [socket setRunLoopModes:[NSArray arrayWithObject:NSRunLoopCommonModes]];

        // TODO: implement connect method to handle error
        [socket connectToHost:host onPort:port error:NULL];

        // -onSocket:didWriteDataWithTag: will queue first read after first write
        // on new socket, subsequent reads are called during -onSocket:didReadData:withTag:
        _firstWrite = YES;
    }
    return self;
}

#pragma mark -
#pragma mark DRSession methods

- (void) sendCommand:(NSString *)commandString {
    NSData * command = [commandString dataUsingEncoding:NSASCIIStringEncoding];
    DLog(@"%@", commandString);
    [socket writeData:command withTimeout:1.0 tag:0L];
}

- (void) close {
    [socket disconnect];
}

#pragma mark -
#pragma mark AsyncSocket delegate call-backs

-(void)onSocketDidDisconnect:(AsyncSocket *)sock {
    DLog(@"socket did disconnect");
}

-(void)onSocket:(AsyncSocket *)sock willDisconnectWithError:(NSError *)err {
    DLog(@"socket will disconnect with error: %@", err);
}

-(void)onSocket:(AsyncSocket *)sock didConnectToHost:(NSString *)host port:(UInt16)port {
    DLog(@"%@", socket);
}

-(void)onSocket:(AsyncSocket *)sock didReadData:(NSData*)data withTag:(long)tag {
    NSString * reply = [[NSString alloc] initWithData:data encoding:NSASCIIStringEncoding];
    NSString * trimmedReply = [reply stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]];
    DLog(@"socket received data: %@", reply);
    DREvent *event = [[DREvent alloc] initWithRawEvent:trimmedReply];
    [self.delegate session:self didReceiveEvent:event];
    [socket readDataToData:[AsyncSocket CRData] withTimeout:-1.0 tag:0];
}

-(void)onSocket:(AsyncSocket *)sock didWriteDataWithTag:(long)tag {
    if (_firstWrite) {
        DLog(@"socket did write data, reading data first time");
        [socket readDataToData:[AsyncSocket CRData] withTimeout:-1.0 tag:0];
        _firstWrite = NO;
    }
}

@end


text:
    ⚠

      ✘
      ✔

        Incorrect

        Correct

    <span class="oppia-response-summary" ng-attr-title="<[$ctrl.getSummary()]>">
      <[$ctrl.getShortSummary()]>
       1" class="badge badge-primary position-relative oppia-num-rules">
        +<[$ctrl.getNumRules() - 1]>

   →

    Correct

    <[$ctrl.getOutcome().dest]>

    (<[$ctrl.getOutcome().newStateName]>)
    Nowhere yet...

    (try again)

    Wrong
 (try again)

  


text:
package com.amazonaws.services.simpleworkflow.flow.spring;

import java.lang.Thread.UncaughtExceptionHandler;
import java.util.concurrent.TimeUnit;

import org.springframework.context.SmartLifecycle;

import com.amazonaws.services.simpleworkflow.AmazonSimpleWorkflow;
import com.amazonaws.services.simpleworkflow.flow.DataConverter;
import com.amazonaws.services.simpleworkflow.flow.WorkerBase;
import com.amazonaws.services.simpleworkflow.flow.worker.GenericWorkflowWorker;
import com.amazonaws.services.simpleworkflow.model.WorkflowType;

/**
 * To be used with Spring. Assumes that injected implementation bean has
 * "workflow" scope. Otherwise the same object instance will be reused for
 * multiple decisions which is guaranteed to break replay if any instance fields
 * are used.
 */
public class SpringWorkflowWorker implements WorkerBase, SmartLifecycle {

    private final GenericWorkflowWorker genericWorker;

    private final SpringWorkflowDefinitionFactoryFactory factoryFactory = new SpringWorkflowDefinitionFactoryFactory();

    private int startPhase;

    private long terminationTimeoutSeconds = 60;

    private boolean disableAutoStartup;

    public SpringWorkflowWorker() {
        genericWorker = new GenericWorkflowWorker();
        genericWorker.setWorkflowDefinitionFactoryFactory(factoryFactory);
    }

    public SpringWorkflowWorker(AmazonSimpleWorkflow service, String domain, String taskListToPoll) {
        genericWorker = new GenericWorkflowWorker(service, domain, taskListToPoll);
        genericWorker.setWorkflowDefinitionFactoryFactory(factoryFactory);
    }

    public AmazonSimpleWorkflow getService() {
        return genericWorker.getService();
    }

    public void setService(AmazonSimpleWorkflow service) {
        genericWorker.setService(service);
    }

    @Override
    public String getDomain() {
        return genericWorker.getDomain();
    }

    public void setDomain(String domain) {
        genericWorker.setDomain(domain);
    }

    @Override
    public boolean isRegisterDomain() {
        return genericWorker.isRegisterDomain();
    }

    public void setRegisterDomain(boolean registerDomain) {
        genericWorker.setRegisterDomain(registerDomain);
    }

    @Override
    public long getDomainRetentionPeriodInDays() {
        return genericWorker.getDomainRetentionPeriodInDays();
    }

    public void setDomainRetentionPeriodInDays(long domainRetentionPeriodInDays) {
        genericWorker.setDomainRetentionPeriodInDays(domainRetentionPeriodInDays);
    }

    @Override
    public String getTaskListToPoll() {
        return genericWorker.getTaskListToPoll();
    }

    public void setTaskListToPoll(String taskListToPoll) {
        genericWorker.setTaskListToPoll(taskListToPoll);
    }

    public DataConverter getDataConverter() {
        return factoryFactory.getDataConverter();
    }

    public void setDataConverter(DataConverter converter) {
        factoryFactory.setDataConverter(converter);
    }

    @Override
    public double getMaximumPollRatePerSecond() {
        return genericWorker.getMaximumPollRatePerSecond();
    }

    @Override
    public void setMaximumPollRatePerSecond(double maximumPollRatePerSecond) {
        genericWorker.setMaximumPollRatePerSecond(maximumPollRatePerSecond);
    }

    @Override
    public int getMaximumPollRateIntervalMilliseconds() {
        return genericWorker.getMaximumPollRateIntervalMilliseconds();
    }

    @Override
    public void setMaximumPollRateIntervalMilliseconds(int maximumPollRateIntervalMilliseconds) {
        genericWorker.setMaximumPollRateIntervalMilliseconds(maximumPollRateIntervalMilliseconds);
    }

    @Override
    public UncaughtExceptionHandler getUncaughtExceptionHandler() {
        return genericWorker.getUncaughtExceptionHandler();
    }

    @Override
    public void setUncaughtExceptionHandler(UncaughtExceptionHandler uncaughtExceptionHandler) {
        genericWorker.setUncaughtExceptionHandler(uncaughtExceptionHandler);
    }

    @Override
    public String getIdentity() {
        return genericWorker.getIdentity();
    }

    @Override
   public void setIdentity(String identity) {
        genericWorker.setIdentity(identity);
    }

    @Override
    public long getPollBackoffInitialInterval() {
        return genericWorker.getPollBackoffInitialInterval();
    }

    @Override
    public void setPollBackoffInitialInterval(long backoffInitialInterval) {
        genericWorker.setPollBackoffInitialInterval(backoffInitialInterval);
    }

    @Override
    public long getPollBackoffMaximumInterval() {
        return genericWorker.getPollBackoffMaximumInterval();
    }

    @Override
    public void setPollBackoffMaximumInterval(long backoffMaximumInterval) {
        genericWorker.setPollBackoffMaximumInterval(backoffMaximumInterval);
    }

    @Override
    public boolean isDisableServiceShutdownOnStop() {
        return genericWorker.isDisableServiceShutdownOnStop();
    }

    @Override
    public void setDisableServiceShutdownOnStop(boolean disableServiceShutdownOnStop) {
        genericWorker.setDisableServiceShutdownOnStop(disableServiceShutdownOnStop);
    }

    @Override
    public void setDisableTypeRegistrationOnStart(boolean disableTypeRegistrationOnStart) {
        genericWorker.setDisableTypeRegistrationOnStart(disableTypeRegistrationOnStart);
    }

    @Override
    public boolean isDisableTypeRegistrationOnStart() {
        return genericWorker.isDisableTypeRegistrationOnStart();
    }

    @Override
    public double getPollBackoffCoefficient() {
        return genericWorker.getPollBackoffCoefficient();
    }

    @Override
    public void setPollBackoffCoefficient(double backoffCoefficient) {
        genericWorker.setPollBackoffCoefficient(backoffCoefficient);
    }

    @Override
    public int getPollThreadCount() {
        return genericWorker.getPollThreadCount();
    }

    @Override
    public void setPollThreadCount(int threadCount) {
        genericWorker.setPollThreadCount(threadCount);
    }

    @Override
    public void suspendPolling() {
        genericWorker.suspendPolling();
    }

    @Override
    public void resumePolling() {
        genericWorker.resumePolling();
    }

    public Iterable<WorkflowType> getWorkflowTypesToRegister() {
        return factoryFactory.getWorkflowTypesToRegister();
    }

    @Override
    public void start() {
        genericWorker.start();
    }

    @Override
    public void shutdown() {
        genericWorker.shutdown();
    }

    @Override
    public void shutdownNow() {
        genericWorker.shutdownNow();
    }

    @Override
    public boolean shutdownAndAwaitTermination(long timeout, TimeUnit unit) throws InterruptedException {
        return genericWorker.shutdownAndAwaitTermination(timeout, unit);
    }

    public void stopNow() {
        genericWorker.shutdownNow();
    }

    @Override
    public boolean awaitTermination(long timeout, TimeUnit unit) throws InterruptedException {
        return genericWorker.awaitTermination(timeout, unit);
    }

    public void setWorkflowImplementations(Iterable<Object> workflowImplementations)
            throws InstantiationException, IllegalAccessException {
        for (Object workflowImplementation : workflowImplementations) {
            addWorkflowImplementation(workflowImplementation);
        }
    }

    public Iterable<Object> getWorkflowImplementations() {
        return factoryFactory.getWorkflowImplementations();
    }

    public void addWorkflowImplementation(Object workflowImplementation) throws InstantiationException, IllegalAccessException {
        factoryFactory.addWorkflowImplementation(workflowImplementation);
    }

    @Override
    public String toString() {
        return this.getClass().getSimpleName() + "[genericWorker=" + genericWorker + ", factoryFactory=" + factoryFactory + "]";
    }

    @Override
    public void stop() {
        shutdown();
        try {
            awaitTermination(terminationTimeoutSeconds, TimeUnit.SECONDS);
        }
        catch (InterruptedException e) {
        }
    }

    @Override
    public boolean isRunning() {
        return genericWorker.isRunning();
    }

    /**
     * @return default is 0
     */
    @Override
    public int getPhase() {
        return startPhase;
    }

    public void setPhase(int startPhase) {
        this.startPhase = startPhase;
    }

    @Override
    public boolean isAutoStartup() {
        return !disableAutoStartup;
    }

    public long getTerminationTimeoutSeconds() {
        return terminationTimeoutSeconds;
    }

    public void setTerminationTimeoutSeconds(long terminationTimeoutSeconds) {
        this.terminationTimeoutSeconds = terminationTimeoutSeconds;
    }

    public boolean isDisableAutoStartup() {
        return disableAutoStartup;
    }

    public void setDisableAutoStartup(boolean disableAutoStartup) {
        this.disableAutoStartup = disableAutoStartup;
    }

    @Override
    public void stop(Runnable callback) {
        stop();
        callback.run();
    }

    @Override
    public void registerTypesToPoll() {
        genericWorker.registerTypesToPoll();
    }

}


text:
bool conditionaldistributionParse(CMT::ConditionalDistribution* obj, std::string cmd, const MEX::Output& output, const MEX::Input& input);

#endif


text:
/* jshint node: true */
'use strict';

/**
  # rtcio-demo-quickconnect

  This is a starter project for working with [WebRTC](http://webrtc.org).

  ## Getting Started

  First, clone this repository:

  ```
  git clone https://github.com/rtc-io/rtcio-demo-quickconnect.git
  ```

  Next, install node dependencies:

  ```
  cd rtcio-demo-quickconnect
  npm install
  ```

  Once the dependencies have been installed, you should then be able to run
  the demonstration server:

  ```
  npm start
  ```

  If everything has worked correctly, you should now be able to open your
  browser to the following url:

  <http://localhost:3000/>

  You can test that you have WebRTC peer connections operating correctly by
  opening two browser windows to the same url; or, you can find someone else
  that has access to your machine and point them to: <http://your.ip:3000/>.
  All being well you should be able to communicate with that person using
  WebRTC!

**/

var express = require('express');
var stylus = require('stylus');
var nib = require('nib');
var app = express();
var server = require('http').Server(app);
var browserify = require('browserify-middleware');

// create the switchboard
var switchboard = require('rtc-switchboard')(server);

// convert stylus stylesheets
app.use(stylus.middleware({
  src: __dirname + '/site',
  compile: function(str, sourcePath) {
    return stylus(str)
      .set('filename', sourcePath)
      .set('compress', false)
      .use(nib());
  }
}));

// serve the rest statically
app.use(browserify('./site'));
app.use(express.static(__dirname + '/site'));

// we need to expose the primus library
app.get('/rtc.io/primus.js', switchboard.library());

// start the server
server.listen(Number(process.env.PORT || 3000), function(err) {
  if (err) {
    return console.log('Encountered error starting server: ', err);
  }

  console.log('server running on port 3000');
});


text:
//
//  UnityInterstitialAd.hpp
//  ee_x
//
//  Created by Zinge on 10/10/17.
//
//

#ifndef EE_X_UNITY_INTERSTITIAL_AD_HPP
#define EE_X_UNITY_INTERSTITIAL_AD_HPP

#include <string>

#include <ee/ads/IFullScreenAd.hpp>
#include <ee/core/ObserverManager.hpp>

#include "ee/unity_ads/UnityAdsFwd.hpp"

namespace ee {
namespace unity_ads {
class InterstitialAd : public IFullScreenAd,
                       public ObserverManager<AdObserver> {
public:
    explicit InterstitialAd(
        ILogger& logger,
        const std::shared_ptr<ads::IAsyncHelper<AdResult>>& displayer,
        Bridge* plugin, const std::string& adId);

    virtual ~InterstitialAd() override;

    virtual void destroy() override;

    virtual bool isLoaded() const override;
    virtual Task<bool> load() override;
    virtual Task<AdResult> show() override;

private:
    friend Bridge;

    void onLoaded();
    void onFailedToShow(const std::string& message);
    void onClosed();

    ILogger& logger_;
    std::shared_ptr<ads::IAsyncHelper<AdResult>> displayer_;
    Bridge* plugin_;
    std::string adId_;
};
} // namespace unity_ads
} // namespace ee

#endif /* EE_X_UNITY_INTERSTITIAL_AD_HPP */


text:
<?xml version="1.0" encoding="utf-8"?>
<set
  xmlns:android="http://schemas.android.com/apk/res/android">
    <set android:ordering="sequentially">
        <objectAnimator android:interpolator="@android:interpolator/linear" android:duration="183" android:valueFrom="1.0" android:valueTo="1.0" android:valueType="floatType" android:propertyName="trimPathStart" />
        <objectAnimator android:interpolator="@android:interpolator/fast_out_slow_in" android:duration="400" android:valueFrom="1.0" android:valueTo="0.0" android:valueType="floatType" android:propertyName="trimPathStart" />
    </set>
</set>


text:
RSpec.describe Coined::Purse do
  describe '#initialize' do
    subject { described_class.new(copper, silver, gold, platinum) }

    context 'without zero coins' do
      let(:copper) { 0 }
      let(:silver) { 0 }
      let(:gold) { 0 }
      let(:platinum) { 0 }

      it { expect(subject.coins).to be_empty }
    end

    context 'with coin amounts' do
      let(:copper) { 10 }
      let(:silver) { 23 }
      let(:gold) { 3 }
      let(:platinum) { 1 }

      it { expect(subject.coins.size).to eql 37 }
      it { expect(subject.amount(Coined::Coin::Copper)).to eql 10 }
      it { expect(subject.amount(Coined::Coin::Silver)).to eql 23 }
      it { expect(subject.amount(Coined::Coin::Gold)).to eql 3 }
      it { expect(subject.amount(Coined::Coin::Platinum)).to eql 1 }
    end
  end

  describe '#add_coins' do
    subject { purse.add_coins(coin_type, amount) }

    let(:purse) { described_class.new(11, 5, 14, 20) }

    context 'adding copper' do
      let(:coin_type) { Coined::Coin::Copper }
      let(:amount) { 27 }

      it { expect { subject }.to change { purse.coins.size }.by(27) }

      it { expect { subject }.to change { purse.amount(Coined::Coin::Copper) }.from(11).to(38) }
      it { expect { subject }.not_to change { purse.amount(Coined::Coin::Silver) } }
      it { expect { subject }.not_to change { purse.amount(Coined::Coin::Gold) } }
      it { expect { subject }.not_to change { purse.amount(Coined::Coin::Platinum) } }
    end

    context 'adding silver' do
      let(:coin_type) { Coined::Coin::Silver }
      let(:amount) { 9 }

      it { expect { subject }.to change { purse.coins.size }.by(9) }

      it { expect { subject }.not_to change { purse.amount(Coined::Coin::Copper) } }
      it { expect { subject }.to change { purse.amount(Coined::Coin::Silver) }.from(5).to(14) }
      it { expect { subject }.not_to change { purse.amount(Coined::Coin::Gold) } }
      it { expect { subject }.not_to change { purse.amount(Coined::Coin::Platinum) } }
    end

    context 'adding gold' do
      let(:coin_type) { Coined::Coin::Gold }
      let(:amount) { 36 }

      it { expect { subject }.to change { purse.coins.size }.by(36) }

      it { expect { subject }.not_to change { purse.amount(Coined::Coin::Copper) } }
      it { expect { subject }.not_to change { purse.amount(Coined::Coin::Silver) } }
      it { expect { subject }.to change { purse.amount(Coined::Coin::Gold) }.from(14).to(50) }
      it { expect { subject }.not_to change { purse.amount(Coined::Coin::Platinum) } }
    end

    context 'adding platinum' do
      let(:coin_type) { Coined::Coin::Platinum }
      let(:amount) { 15 }

      it { expect { subject }.to change { purse.coins.size }.by(15) }

      it { expect { subject }.not_to change { purse.amount(Coined::Coin::Copper) } }
      it { expect { subject }.not_to change { purse.amount(Coined::Coin::Silver) } }
      it { expect { subject }.not_to change { purse.amount(Coined::Coin::Gold) } }
      it { expect { subject }.to change { purse.amount(Coined::Coin::Platinum) }.from(20).to(35) }
    end
  end

  describe '#remove_coins' do
    subject { purse.remove_coins(coin_type, amount) }

    let(:purse) { described_class.new(11, 5, 14, 20) }

    context 'removing copper' do
      let(:coin_type) { Coined::Coin::Copper }
      let(:amount) { 4 }

      it { expect { subject }.to change { purse.coins.size }.by(-4) }

      it { expect { subject }.to change { purse.amount(Coined::Coin::Copper) }.from(11).to(7) }
      it { expect { subject }.not_to change { purse.amount(Coined::Coin::Silver) } }
      it { expect { subject }.not_to change { purse.amount(Coined::Coin::Gold) } }
      it { expect { subject }.not_to change { purse.amount(Coined::Coin::Platinum) } }
    end

    context 'removing silver' do
      let(:coin_type) { Coined::Coin::Silver }
      let(:amount) { 5 }

      it { expect { subject }.to change { purse.coins.size }.by(-5) }

      it { expect { subject }.not_to change { purse.amount(Coined::Coin::Copper) } }
      it { expect { subject }.to change { purse.amount(Coined::Coin::Silver) }.from(5).to(0) }
      it { expect { subject }.not_to change { purse.amount(Coined::Coin::Gold) } }
      it { expect { subject }.not_to change { purse.amount(Coined::Coin::Platinum) } }
    end

    context 'removing gold' do
      let(:coin_type) { Coined::Coin::Gold }
      let(:amount) { 20 }

      it { expect { subject }.to change { purse.coins.size }.by(-14) }

      it { expect { subject }.not_to change { purse.amount(Coined::Coin::Copper) } }
      it { expect { subject }.not_to change { purse.amount(Coined::Coin::Silver) } }
      it { expect { subject }.to change { purse.amount(Coined::Coin::Gold) }.from(14).to(0) }
      it { expect { subject }.not_to change { purse.amount(Coined::Coin::Platinum) } }
    end

    context 'removing platinum' do
      let(:coin_type) { Coined::Coin::Platinum }
      let(:amount) { 14 }

      it { expect { subject }.to change { purse.coins.size }.by(-14) }

      it { expect { subject }.not_to change { purse.amount(Coined::Coin::Copper) } }
      it { expect { subject }.not_to change { purse.amount(Coined::Coin::Silver) } }
      it { expect { subject }.not_to change { purse.amount(Coined::Coin::Gold) } }
      it { expect { subject }.to change { purse.amount(Coined::Coin::Platinum) }.from(20).to(6) }
    end
  end

  describe '#amount' do
    subject { purse.amount(coin_type) }

    let(:purse) { described_class.new(20, 12, 6, 2) }

    context 'of copper' do
      let(:coin_type) { Coined::Coin::Copper }

      it { is_expected.to eql 20 }
    end

    context 'of silver' do
      let(:coin_type) { Coined::Coin::Silver }

      it { is_expected.to eql 12 }
    end

    context 'of gold' do
      let(:coin_type) { Coined::Coin::Gold }

      it { is_expected.to eql 6 }
    end

    context 'of platinum' do
      let(:coin_type) { Coined::Coin::Platinum }

      it { is_expected.to eql 2 }
    end
  end

  describe '#value' do
    subject { purse.value(coin_type) }

    let(:purse) { described_class.new(copper, silver, gold, platinum) }

    let(:copper) { 153 }
    let(:silver) { 62 }
    let(:gold) { 21 }
    let(:platinum) { 7 }

    context 'with Coin::Copper' do
      let(:coin_type) { Coined::Coin::Copper }

      it { is_expected.to eql 9873.0 }
    end

    context 'with Coin::Silver' do
      let(:coin_type) { Coined::Coin::Silver }

      it { is_expected.to eql 987.3 }
    end

    context 'with Coin::Gold' do
      let(:coin_type) { Coined::Coin::Gold }

      it { is_expected.to eql 98.73 }
    end

    context 'with Coin::Platinum' do
      let(:coin_type) { Coined::Coin::Platinum }

      it { is_expected.to eql 9.873 }
    end
  end
end


text:
namespace net {

class IOBuffer;

// Class with a push-based interface for uploading data. Buffers all data until
// the request is completed. Not recommended for uploading large amounts of
// seekable data, due to this buffering behavior.
class NET_EXPORT ChunkedUploadDataStream : public UploadDataStream {
 public:
  // Utility class that allows writing data to a particular
  // ChunkedUploadDataStream. It can outlive the associated
  // ChunkedUploadDataStream, and the URLRequest it is associated with, and
  // still be safely used. This allows the consumer to not have to worry about
  // the lifetime of the ChunkedUploadDataStream, which the owning URLRequest
  // may delete without warning.
  //
  // The writer may only be used on the ChunkedUploadDataStream's thread.
  class NET_EXPORT Writer {
   public:
    Writer(const Writer&) = delete;
    Writer& operator=(const Writer&) = delete;
    ~Writer();

    // Adds data to the stream. |is_done| should be true if this is the last
    // data to be appended. |data_len| must not be 0 unless |is_done| is true.
    // Once called with |is_done| being true, must never be called again.
    // Returns true if write was passed successfully on to the next layer,
    // though the data may not actually have been written to the underlying
    // URLRequest.  Returns false if unable to write the data failed because the
    // underlying ChunkedUploadDataStream was destroyed.
    bool AppendData(const char* data, int data_len, bool is_done);

   private:
    friend class ChunkedUploadDataStream;

    explicit Writer(base::WeakPtr<ChunkedUploadDataStream> upload_data_stream);

    const base::WeakPtr<ChunkedUploadDataStream> upload_data_stream_;
  };

  explicit ChunkedUploadDataStream(int64_t identifier,
                                   bool has_null_source = false);

  ChunkedUploadDataStream(const ChunkedUploadDataStream&) = delete;
  ChunkedUploadDataStream& operator=(const ChunkedUploadDataStream&) = delete;
  ~ChunkedUploadDataStream() override;

  // Creates a Writer for appending data to |this|.  It's generally expected
  // that only one writer is created per stream, though multiple writers are
  // allowed.  All writers write to the same stream, and once one of them
  // appends data with |is_done| being true, no other writers may be used to
  // append data.
  std::unique_ptr<Writer> CreateWriter();

  // Adds data to the stream. |is_done| should be true if this is the last
  // data to be appended. |data_len| must not be 0 unless |is_done| is true.
  // Once called with |is_done| being true, must never be called again.
  // TODO(mmenke):  Consider using IOBuffers instead, to reduce data copies.
  // TODO(mmenke):  Consider making private, and having all consumers use
  //     Writers.
  void AppendData(const char* data, int data_len, bool is_done);

 private:
  // UploadDataStream implementation.
  int InitInternal(const NetLogWithSource& net_log) override;
  int ReadInternal(IOBuffer* buf, int buf_len) override;
  void ResetInternal() override;

  int ReadChunk(IOBuffer* buf, int buf_len);

  // Index and offset of next element of |upload_data_| to be read.
  size_t read_index_ = 0;
  size_t read_offset_ = 0;

  // True once all data has been appended to the stream.
  bool all_data_appended_ = false;

  std::vector<std::unique_ptr<std::vector<char>>> upload_data_;

  // Buffer to write the next read's data to. Only set when a call to
  // ReadInternal reads no data.
  scoped_refptr<IOBuffer> read_buffer_;
  int read_buffer_len_ = 0;

  base::WeakPtrFactory<ChunkedUploadDataStream> weak_factory_{this};
};

}  // namespace net

#endif  // NET_BASE_CHUNKED_UPLOAD_DATA_STREAM_H_


text:
Data Reduction Proxy Status

Status:

Primary proxy:

Secondary proxy:

Probe status:

Bypass details:
      Unknown

Origin URL:

Duration (seconds):

Bypass reason:

  View current proxy configuration

Recent events

          Time
          Action

          Details

Bandwidth Savings

        Session
        Total


text:
using System.Reflection;
using Abp.Dependency;
using Abp.Modules;
using Abp.Startup;

namespace AbpWebSite
{
    public class AbpWebSiteCoreModule : AbpModule
    {
        public override void Initialize(IAbpInitializationContext initializationContext)
        {
            base.Initialize(initializationContext);
            IocManager.Instance.RegisterAssemblyByConvention(Assembly.GetExecutingAssembly());
        }
    }
}


text:
{% extends "layout.html" %}

{% block content %}

Admin: Teams list

  {% if flash %}

      {{ flash }}

  {% endif %}

        #
        name
        members
        # bots
        wins
        losses
        elo
        modify
        delete

      {% for team in teams %}

          {{ team.id }}
          {{ team.name }}

            {% for member in team.members %}
              {{ member.kerberos }}
              {{ ',' if not loop.last }}
            {% else %}
              No members.
            {% endfor %}

                {{ team.bots|length }}

                {{ team.wins }}

                {{ team.losses }}

                {{ team.elo | int }}

            <form class="ui inline form" action="{{ url_for('admin_team_modify', team_id=team.id) }}" method="POST">

                  Enabled?
                  <select name="is_disabled" class="ui fluid dropdown">
                    <option value="no" {% if not team.is_disabled %} selected {% endif %}>Enabled</option>
                    <option value="yes" {% if team.is_disabled %} selected {% endif %}>Disabled</option>
                  </select>

                  Auto-accepts?
                  <select name="must_autoaccept" class="ui fluid dropdown">
                    <option value="no" {% if not team.must_autoaccept %} selected {% endif %}>Doesn't auto-accept</option>
                    <option value="yes" {% if team.must_autoaccept %} selected {% endif %}>Auto-accept</option>
                  </select>

                  <button class="ui positive basic button">Modify</button>

            </form>

            {% if team.can_be_deleted() %}
              <form class="ui form" action="{{ url_for('admin_team_delete', team_id=team.id) }}" method="POST">
                <button type="submit" class="ui basic negative icon button"></button>
              </form>
            {% endif %}

      {% else %}

No teams yet, create one below

      {% endfor %}

Create a team

    <form class="ui form inline" action="{{ url_for('admin_teams_create') }}" method="POST">

        <input type="text" placeholder="Team name" name="team_name">
        <button class="ui positive button">Create</button>

    </form>

{% endblock %}

{% block scripts %}

{% endblock %}