text:
#include "GfxPch.h"

#include "AttachSet.h"
#include "Skeleton.h"

namespace Demi
{
    DiAttachSet::DiAttachSet()
    {
    }

    DiAttachSet::~DiAttachSet()
    {
        AttachNodeMap::iterator itAttach;
        DiAttachNode * pkAttachNode = NULL;
        for (itAttach = mMapAttachNodes.begin(); itAttach != mMapAttachNodes.end(); ++ itAttach)
        {
            pkAttachNode = itAttach->second;

            if(pkAttachNode)
            {
                DI_DELETE pkAttachNode;
            }
        }
        mMapAttachNodes.clear();
        mVecRootAttaches.clear();
    }

    void DiAttachSet::Reset()
    {
        AttachNodeMap::iterator itAttach;
        for (itAttach = mMapAttachNodes.begin(); itAttach != mMapAttachNodes.end(); ++ itAttach)
        {
            (*itAttach).second->Reset();
        }
    }

    DiAttachNode* DiAttachSet::CreateAttachNode(const DiString& strAttach)
    {
        if(HasAttachNode(strAttach))
        {
            DI_WARNING("Cannot locate the attach node: %s", strAttach.c_str());
            return nullptr;
        }

        DiAttachNode * newnode = new DiAttachNode(strAttach);
        DI_ASSERT(newnode);

        mMapAttachNodes[strAttach] = newnode;

        return newnode;
    }

    DiAttachNode* DiAttachSet::GetAttachNode(const DiString& strAttach)
    {
        auto itAttach = mMapAttachNodes.find(strAttach);
        if(itAttach == mMapAttachNodes.end())
        {
            DI_WARNING("Cannot locate the attach node: %s",strAttach.c_str());
            return nullptr;
        }

        return itAttach->second;
    }

    const DiAttachNode* DiAttachSet::GetAttachNode(const DiString& strAttach) const
    {
        auto itAttach = mMapAttachNodes.find(strAttach);
        if(itAttach == mMapAttachNodes.end())
        {
            DI_WARNING("Cannot locate the attach node: %s",strAttach.c_str());
            return nullptr;
        }

        return itAttach->second;
    }

    DiAttachSet::RootAttachListIterator DiAttachSet::GetRootAttechesIterator(void)
    {
        if (mVecRootAttaches.empty())
        {
            DeriveRootAttaches();
        }

        return RootAttachListIterator(mVecRootAttaches.begin(),mVecRootAttaches.end());
    }

    void DiAttachSet::UpdateTransforms(void)
    {
        RootAttachList::iterator itAttach, itEnd;
        itEnd = mVecRootAttaches.end();

        for (itAttach = mVecRootAttaches.begin(); itAttach != itEnd; ++ itAttach)
        {
            (*itAttach)->_Update(true, false);
        }
    }

    void DiAttachSet::SetBindingPose(void)
    {
        UpdateTransforms();

        AttachNodeMap::iterator itAttach;
        for (itAttach = mMapAttachNodes.begin(); itAttach != mMapAttachNodes.end(); ++ itAttach )
        {
            itAttach->second->SetBindingPose();
        }
    }

    void DiAttachSet::GetAttachMatrices(Demi::DiMat4 * pMatrices,size_t unArrayLen)
    {
        UpdateTransforms();

        size_t unCount = 0;
        for (auto itAttach = mMapAttachNodes.begin(); itAttach != mMapAttachNodes.end()
             && unCount < unArrayLen; ++ itAttach)
        {
            DiAttachNode * pkAttach = itAttach->second;
            pkAttach->GetOffsetTransform(* pMatrices);
            ++pMatrices;
            ++unCount;
        }
    }

    bool DiAttachSet::HasAttachNode(const DiString& strAttach)
    {
        return mMapAttachNodes.find(strAttach) != mMapAttachNodes.end();
    }

    void DiAttachSet::DeriveRootAttaches() const
    {
        mVecRootAttaches.clear();
        for (auto itAttach = mMapAttachNodes.begin(); itAttach != mMapAttachNodes.end(); ++ itAttach)
        {
            DiAttachNode * nd = itAttach->second;
            if (nd && (!nd->GetParent() ||
                       (nd->GetParent() && DiNode::NT_ATTACHNODE != nd->GetParent()->GetNodeType())))
            {
                mVecRootAttaches.push_back(nd);
            }
        }
    }

    DiAttachSetInstance::DiAttachSetInstance(DiAttachSet* pkTemplet,DiSkeletonInstance * pSkeleton)
        : mTemplet(pkTemplet),
        mSkeleton(pSkeleton)
    {
        Init();
    }

    DiAttachSetInstance::~DiAttachSetInstance()
    {

    }

    void DiAttachSetInstance::Init()
    {
        if(!mTemplet)
        {
            return;
        }

        RootAttachListIterator itRootAttach = mTemplet->GetRootAttechesIterator();
        while (itRootAttach.HasMoreElements())
        {
            DiAttachNode * nd = itRootAttach.GetNext();
            if(mSkeleton)
            {
                DiString strParent;
                DiNode * parent = nullptr;
                if(nd->GetParent())
                {
                    strParent = nd->GetParent()->GetName();
                    parent = mSkeleton->GetBone(strParent);
                }
                CloneAttachNodes( nd , parent);
            }
            else
            {
                CloneAttachNodes(nd , nullptr);
            }
            nd->_Update(true,false);
        }

        SetBindingPose();
    }

    void DiAttachSetInstance::CloneAttachNodes(DiAttachNode * pkSource, DiNode * pkParentNode)
    {
        DiAttachNode* newAttach = nullptr;

        newAttach = CreateAttachNode(pkSource->GetName());

        if(!pkParentNode)
        {
            mVecRootAttaches.push_back(newAttach);
        }
        else if(DiNode::NT_ATTACHNODE != pkParentNode->GetNodeType())
        {
            pkParentNode->AddChild(newAttach);
            mVecRootAttaches.push_back(newAttach);
        }
        else
        {
            pkParentNode->AddChild(newAttach);
        }

        newAttach->SetOrientation(pkSource->GetOrientation());
        newAttach->SetPosition(pkSource->GetPosition());
        newAttach->SetScale(pkSource->GetScale());

        size_t childrenSize = pkSource->GetChildrenNum();
        for (size_t i = 0; i < childrenSize; ++i)
        {
            CloneAttachNodes(static_cast<DiAttachNode*>(pkSource->GetChild(i)), newAttach);
        }
    }
}


text:
package org.dasein.cloud.test.compute;

import org.dasein.cloud.CloudException;
import org.dasein.cloud.InternalException;
import org.dasein.cloud.compute.AffinityGroup;
import org.dasein.cloud.compute.AffinityGroupFilterOptions;
import org.dasein.cloud.compute.AffinityGroupSupport;
import org.dasein.cloud.compute.ComputeServices;
import org.dasein.cloud.dc.DataCenter;
import org.dasein.cloud.dc.DataCenterServices;
import org.dasein.cloud.test.DaseinTestManager;
import org.junit.*;
import org.junit.rules.TestName;

import java.util.Map;
import java.util.UUID;

import static org.junit.Assert.*;
import static org.junit.Assert.assertTrue;
import static org.junit.Assume.assumeTrue;

/**
 * Test cases to validate an implementation of Affinty Group support
 * User: daniellemayne
 * Date: 23/07/2014
 * Time: 09:23
 */
public class StatelessAffinityGroupTests {
    static private DaseinTestManager tm;

    @BeforeClass
    static public void configure() {
        tm = new DaseinTestManager(StatelessAffinityGroupTests.class);
    }

    @AfterClass
    static public void cleanUp() {
        if (tm != null) {
            tm.close();
        }
    }

    @Rule
    public final TestName name = new TestName();

    private String testAffinityGroupId;
    private String testDataCenterId;

    public StatelessAffinityGroupTests() {
    }

    @Before
    public void before() {
        tm.begin(name.getMethodName());
        assumeTrue(!tm.isTestSkipped());
        try {
            testDataCenterId = DaseinTestManager.getDefaultDataCenterId(true);

            if (testDataCenterId != null) {
                ComputeServices computeServices = tm.getProvider().getComputeServices();
                if (computeServices.hasAffinityGroupSupport()) {
                    AffinityGroupSupport support = computeServices.getAffinityGroupSupport();
                    AffinityGroupFilterOptions options = AffinityGroupFilterOptions.getInstance().withDataCenterId(testDataCenterId);

                    for (AffinityGroup ag : support.list(options)) {
                        if (testAffinityGroupId == null) {
                            testAffinityGroupId = ag.getAffinityGroupId();
                        }
                    }
                }
            }
        } catch (Throwable ignore) {
            // ignore
        }
    }

    @After
    public void after() {
        tm.end();
    }

    @Test
    public void getBogusAffinityGroup() throws CloudException, InternalException {
        assumeTrue(!tm.isTestSkipped());
        ComputeServices computeServices = tm.getProvider().getComputeServices();
        if (computeServices.hasAffinityGroupSupport()) {
            AffinityGroupSupport services = computeServices.getAffinityGroupSupport();
            AffinityGroup ag = services.get(UUID.randomUUID().toString());

            tm.out("Bogus Affinity Group", ag);
            assertNull("Dummy affinity group must be null, but one was found", ag);

        } else {
            tm.ok("Affinity groups not supported in " + tm.getProvider().getCloudName());
        }
    }

    @Test
    public void getAffinityGroup() throws CloudException, InternalException {
        assumeTrue(!tm.isTestSkipped());

        ComputeServices computeServices = tm.getProvider().getComputeServices();
        if (computeServices.hasAffinityGroupSupport()) {
            if (testAffinityGroupId != null) {
                AffinityGroupSupport services = computeServices.getAffinityGroupSupport();
                AffinityGroup ag = services.get(testAffinityGroupId);

                tm.out("Affinity Group", ag);
                assertNotNull("Failed to find the test affinity group", ag);
            } else {
                fail("No testAffinityGroup found for getAffinityGroup test");
            }
        } else {
            tm.ok("Affinity groups not supported in " + tm.getProvider().getCloudName());
        }
    }

    @Test
    public void affinityGroupContent() throws CloudException, InternalException {
        assumeTrue(!tm.isTestSkipped());

        ComputeServices computeServices = tm.getProvider().getComputeServices();
        if (computeServices.hasAffinityGroupSupport()) {
            if (testAffinityGroupId != null) {
                AffinityGroupSupport services = computeServices.getAffinityGroupSupport();
                AffinityGroup ag = services.get(testAffinityGroupId);

                assertNotNull("Failed to find the test affinity group", ag);
                tm.out("Affinity Group ID", ag.getAffinityGroupId());
                tm.out("Name", ag.getAffinityGroupName());
                tm.out("Description", ag.getDescription());
                tm.out("Datacenter ID", ag.getDataCenterId());
                tm.out("Created", ag.getCreationTimestamp());

                Map<String, String> tags = ag.getTags();
                assertNotNull("Tags may not be null", ag.getTags());

                for (Map.Entry<String, String> entry : tags.entrySet()) {
                    tm.out("Tag " + entry.getKey(), entry.getValue());
                }
                assertNotNull("Affinity Group ID must not be null", ag.getAffinityGroupId());
                assertNotNull("Affinity group name must not be null", ag.getAffinityGroupName());
                assertNotNull("Datacenter id must not be null", ag.getDataCenterId());
            } else {
                fail("No testAffinityGroup found for affinityGroupContent test");
            }
        } else {
            tm.ok("Affinity groups not supported in " + tm.getProvider().getCloudName());
        }
    }

    @Test
    public void listAffinityGroups() throws CloudException, InternalException {
        assumeTrue(!tm.isTestSkipped());

        ComputeServices computeServices = tm.getProvider().getComputeServices();
        if (computeServices.hasAffinityGroupSupport()) {
            if (testDataCenterId != null) {
                if (testAffinityGroupId != null) {
                    AffinityGroupSupport services = computeServices.getAffinityGroupSupport();
                    AffinityGroupFilterOptions options = AffinityGroupFilterOptions.getInstance().withDataCenterId(testDataCenterId);
                    Iterable<AffinityGroup> affinityGroups = services.list(options);
                    boolean found = false;
                    int count = 0;

                    assertNotNull("Null set of affinity groups returned from listAffinityGroups()", affinityGroups);
                    for (AffinityGroup affinityGroup : affinityGroups) {
                        count++;
                        tm.out("Affinity group", affinityGroup);
                        if (affinityGroup.getAffinityGroupId().equals(testAffinityGroupId)) {
                            found = true;
                        }
                    }
                    tm.out("Total Affinity Group Count", count);
                    assertTrue("Did not find the test affinity group ID among returned affinity groups", found);
                } else {
                    fail("No testAffinityGroup found for affinityGroupContent test");
                }
            } else {
                fail("Unable to find datacenter id for listAffinityGroups test");
            }
        } else {
            tm.ok("Affinity groups not supported in " + tm.getProvider().getCloudName());
        }
    }
}

redpajama_set_name: RedPajamaGithub


text:
<?php

/**
 * Class manages promotion groups
 */
class actions_groups_ajax extends ajaxListComponent
{

    /**
     * Columns array
     *
     * @var array
     */
    protected $_aColumns = array('container1' => array( // field , table,  visible, multilanguage, ident
        array('oxtitle', 'oxgroups', 1, 0, 0),
        array('oxid', 'oxgroups', 0, 0, 0),
        array('oxid', 'oxgroups', 0, 0, 1),
    ),
                                 'container2' => array(
                                     array('oxtitle', 'oxgroups', 1, 0, 0),
                                     array('oxid', 'oxgroups', 0, 0, 0),
                                     array('oxid', 'oxobject2action', 0, 0, 1),
                                 )
    );

    /**
     * Returns SQL query for data to fetc
     *
     * @return string
     */
    protected function _getQuery()
    {
        // active AJAX component
        $sGroupTable = $this->_getViewName('oxgroups');
        $oDb = oxDb::getDb();

        $sId = oxRegistry::getConfig()->getRequestParameter('oxid');
        $sSynchId = oxRegistry::getConfig()->getRequestParameter('synchoxid');

        // category selected or not ?
        if (!$sId) {
            $sQAdd = " from {$sGroupTable} where 1 ";
        } else {
            $sQAdd .= " from oxobject2action, {$sGroupTable} where {$sGroupTable}.oxid=oxobject2action.oxobjectid " .
                      " and oxobject2action.oxactionid = " . $oDb->quote($sId) .
                      " and oxobject2action.oxclass = 'oxgroups' ";
        }

        if ($sSynchId && $sSynchId != $sId) {
            $sQAdd .= " and {$sGroupTable}.oxid not in ( select {$sGroupTable}.oxid " .
                      "from oxobject2action, {$sGroupTable} where $sGroupTable.oxid=oxobject2action.oxobjectid " .
                      " and oxobject2action.oxactionid = " . $oDb->quote($sSynchId) .
                      " and oxobject2action.oxclass = 'oxgroups' ) ";
        }

        return $sQAdd;
    }

    /**
     * Removes user group from promotion
     */
    public function removePromotionGroup()
    {
        $aRemoveGroups = $this->_getActionIds('oxobject2action.oxid');
        if (oxRegistry::getConfig()->getRequestParameter('all')) {
            $sQ = $this->_addFilter("delete oxobject2action.* " . $this->_getQuery());
            oxDb::getDb()->Execute($sQ);
        } elseif ($aRemoveGroups && is_array($aRemoveGroups)) {
            $sRemoveGroups = implode(", ", oxDb::getInstance()->quoteArray($aRemoveGroups));
            $sQ = "delete from oxobject2action where oxobject2action.oxid in (" . $sRemoveGroups . ") ";
            oxDb::getDb()->Execute($sQ);
        }
    }

    /**
     * Adds user group to promotion
     */
    public function addPromotionGroup()
    {
        $aChosenGroup = $this->_getActionIds('oxgroups.oxid');
        $soxId = oxRegistry::getConfig()->getRequestParameter('synchoxid');

        if (oxRegistry::getConfig()->getRequestParameter('all')) {
            $sGroupTable = $this->_getViewName('oxgroups');
            $aChosenGroup = $this->_getAll($this->_addFilter("select $sGroupTable.oxid " . $this->_getQuery()));
        }
        if ($soxId && $soxId != "-1" && is_array($aChosenGroup)) {
            foreach ($aChosenGroup as $sChosenGroup) {
                $oObject2Promotion = oxNew("oxbase");
                $oObject2Promotion->init('oxobject2action');
                $oObject2Promotion->oxobject2action__oxactionid = new oxField($soxId);
                $oObject2Promotion->oxobject2action__oxobjectid = new oxField($sChosenGroup);
                $oObject2Promotion->oxobject2action__oxclass = new oxField("oxgroups");
                $oObject2Promotion->save();
            }
        }
    }
}


text:
package de.hs8.ditop.datastructures;

import com.fasterxml.jackson.annotation.JsonIgnore;
import de.hs8.graphics.FPoint;

import java.awt.Shape;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * Created by hen on 10/27/14.
 */
public class Topic {

    public String topicName;
    // @JsonIgnore

    public FPoint centerPos = new FPoint();
    public double recommendedRadius = 1;

    public Map<String, Double> characteristicness = new HashMap<String, Double>();
    //	public Map<String, SubCollectionDescription> containedIn = new HashMap<String, SubCollectionDescription>();

    @JsonIgnore
    public Shape unionShape;

    public int inSetBitvector;
    public float disValue;
    public float characteristicValue = -1;
    public boolean isShared = false;

    // @JsonIgnore
    public List<Term> terms = new ArrayList<Term>();

    public Topic(final String groupName) {
        super();
        this.topicName = groupName;
    }

    @Override
    public String toString() {
        return "Topic [groupName=" + topicName + ", characteristicness="
                + characteristicness + ", inSetBitvector=" + inSetBitvector
                + ", disValue=" + disValue + ", characteristicValue="
                + characteristicValue + ", terms=" + terms + "]";
    }

    public FPoint getCenterPos() {
        return centerPos;
    }

    public void setCenterPos(final FPoint centerPos) {
        this.centerPos = centerPos;
    }

    public Shape getUnionShape() {
        return unionShape;
    }

    public void setUnionShape(final Shape unionShape) {
        this.unionShape = unionShape;
    }

    public int getInSetBitvector() {
        return inSetBitvector;
    }

    public void setInSetBitvector(final int inSetBitvector) {
        this.inSetBitvector = inSetBitvector;
    }

    public void cleanup() {
        characteristicness.clear();
        inSetBitvector = 0;
        disValue = 0;
        characteristicValue = -1;
        isShared = false;

    }

}


text:
#include <string.h>
#include <stdlib.h>

#include "dfrph.h"
#include "upm_fti.h"
#include "fti/upm_sensor.h"

/**
 * This file implements the Function Table Interface (FTI) for this sensor
 */

const char upm_dfrph_name[] = "DFRPH";
const char upm_dfrph_description[] = "Analog pH Meter Pro";
const upm_protocol_t upm_dfrph_protocol[] = {UPM_ANALOG};
const upm_sensor_t upm_dfrph_category[] = {UPM_PH};

// forward declarations
const void* upm_dfrph_get_ft(upm_sensor_t sensor_type);
void* upm_dfrph_init_str(const char* protocol, const char* params);
void upm_dfrph_close(void* dev);
const upm_sensor_descriptor_t upm_dfrph_get_descriptor();
upm_result_t upm_dfrph_set_offset(const void* dev, float offset);
upm_result_t upm_dfrph_set_scale(const void* dev, float scale);
upm_result_t upm_dfrph_get_value(const void* dev, float *value);

/* This sensor implementes 2 function tables */
/* 1. Generic base function table */
static const upm_sensor_ft ft_gen =
{
    .upm_sensor_init_name = &upm_dfrph_init_str,
    .upm_sensor_close = &upm_dfrph_close,
    .upm_sensor_get_descriptor = &upm_dfrph_get_descriptor
};

/* 2. PH function table */
static const upm_ph_ft ft_ph =
{
    .upm_ph_set_offset = &upm_dfrph_set_offset,
    .upm_ph_set_scale = &upm_dfrph_set_scale,
    .upm_ph_get_value = &upm_dfrph_get_value
};

const void* upm_dfrph_get_ft(upm_sensor_t sensor_type)
{
    switch(sensor_type)
    {
        case UPM_SENSOR:
            return &ft_gen;
        case UPM_PH:
            return &ft_ph;
        default:
            return NULL;
    }
}

void* upm_dfrph_init_str(const char* protocol, const char* params)
{
    fprintf(stderr, "String initialization - not implemented, using ain0: %s\n", __FILENAME__);
    return dfrph_init(0);
}

void upm_dfrph_close(void* dev)
{
    dfrph_close(dev);
}

const upm_sensor_descriptor_t upm_dfrph_get_descriptor()
{
    /* Fill in the descriptor */
    upm_sensor_descriptor_t usd;
    usd.name = upm_dfrph_name;
    usd.description = upm_dfrph_description;
    usd.protocol_size = 1;
    usd.protocol = upm_dfrph_protocol;
    usd.category_size = 1;
    usd.category = upm_dfrph_category;

    return usd;
}

upm_result_t upm_dfrph_set_offset(const void* dev, float offset)
{
    return dfrph_set_offset((dfrph_context)dev, offset);
}

upm_result_t upm_dfrph_set_scale(const void* dev, float scale)
{
    return dfrph_set_scale((dfrph_context)dev, scale);
}

upm_result_t upm_dfrph_get_value(const void* dev, float *value)
{
    return dfrph_get_ph((dfrph_context)dev, value);
}


text:
/** Use the Tab key to skip any character. */
define(function (require, exports, module) {
  'use strict';

  var EXTENSION_NAME = 'dag0310.tab-out';
  var TAB_OUT_COMMAND = EXTENSION_NAME + '.tab-out';
  var TOGGLE_COMMAND = EXTENSION_NAME + '.toggle';
  var DEFAULT_KEY_BINDING = 'Tab';
  var ALT_KEY_BINDING = 'Alt-Tab';
  var ALT_KEY_BINDING_ENABLED_PREFERENCE = 'altKeyEnabled';

  var CommandManager = brackets.getModule('command/CommandManager');
  var KeyBindingManager = brackets.getModule('command/KeyBindingManager');
  var EditorManager = brackets.getModule('editor/EditorManager');
  var Menus = brackets.getModule('command/Menus');
  var PreferencesManager = brackets.getModule('preferences/PreferencesManager');

  var _prefs = PreferencesManager.getExtensionPrefs(EXTENSION_NAME);
  _prefs.definePreference(ALT_KEY_BINDING_ENABLED_PREFERENCE, 'boolean', false);

  function tabOutIfPossible() {
    var editor = EditorManager.getFocusedEditor();
    if (! editor) {
      return true;
    }

    var currentCursorPosition = editor.getCursorPos();
    var nextCursorPosition = {line: currentCursorPosition.line, ch: currentCursorPosition.ch + 1};

    if (editor.getSelectedText() !== '') {
      return true;
    }

    var beginningOfLinePosition = {line: currentCursorPosition.line, ch: 0};
    var textInLineBeforeCursor = editor.document.getRange(beginningOfLinePosition, currentCursorPosition);
    var hasOnlyWhitespaceToTheLeft = textInLineBeforeCursor.trim() === '';
    if (hasOnlyWhitespaceToTheLeft) {
      return true;
    }

    editor.setCursorPos(nextCursorPosition);

    return false;
  }

  function setKeyBinding(isAlternative) {
    if (isAlternative && brackets.platform === 'mac') {
      KeyBindingManager.removeBinding(DEFAULT_KEY_BINDING);
      KeyBindingManager.addBinding(TAB_OUT_COMMAND, ALT_KEY_BINDING, 'mac');
    } else {
      KeyBindingManager.removeBinding(ALT_KEY_BINDING);
      KeyBindingManager.addBinding(TAB_OUT_COMMAND, DEFAULT_KEY_BINDING);
    }
  }

  function toggleKeyBinding() {
    _prefs.set(ALT_KEY_BINDING_ENABLED_PREFERENCE, ! _prefs.get(ALT_KEY_BINDING_ENABLED_PREFERENCE));
    _prefs.save();

    CommandManager.get(TOGGLE_COMMAND).setChecked(_prefs.get(ALT_KEY_BINDING_ENABLED_PREFERENCE));

    setKeyBinding(_prefs.get(ALT_KEY_BINDING_ENABLED_PREFERENCE));

    brackets.getModule('widgets/Dialogs').showModalDialog('', 'Please restart Brackets', "Tab Out's and other plugins' affected keyboard shortcuts fully functional after restart of Brackets!");
  }

  CommandManager.registerInternal(TAB_OUT_COMMAND, tabOutIfPossible);
  setKeyBinding(_prefs.get(ALT_KEY_BINDING_ENABLED_PREFERENCE));

  if (brackets.platform === 'mac') {
    CommandManager.register('Tab Out: Use ' + ALT_KEY_BINDING.replace('-', '+') + ' instead of ' + DEFAULT_KEY_BINDING + ' (Mac only)', TOGGLE_COMMAND, toggleKeyBinding);
    var menu = Menus.getMenu(Menus.AppMenuBar.NAVIGATE_MENU);
    menu.addMenuItem(TOGGLE_COMMAND);
    CommandManager.get(TOGGLE_COMMAND).setChecked(_prefs.get(ALT_KEY_BINDING_ENABLED_PREFERENCE));
  }
});


text:
<?php

namespace ZendTest\Validator;

use stdClass;
use Zend\Validator\NotEmpty;

/**
 * @group      Zend_Validator
 */
class NotEmptyTest extends \PHPUnit_Framework_TestCase
{
    /**
     * @var NotEmpty
     */
    protected $validator;

    public function setUp()
    {
        $this->validator = new NotEmpty();
    }

    /**
     * Ensures that the validator follows expected behavior
     *
     * ZF-6708 introduces a change for validating integer 0; it is a valid
     * integer value. '0' is also valid.
     *
     * @param mixed $value Value to test
     * @param boolean $valid Expected validity of value
     *
     * @group ZF-6708
     * @return void
     * @dataProvider basicProvider
     */
    public function testBasic($value, $valid)
    {
        $this->checkValidationValue($value, $valid);
    }

    /**
     * Provides values and expected validity for the basic test
     *
     * @return array
     */
    public function basicProvider()
    {
        return array(
            array('word', true),
            array('', false),
            array('    ', false),
            array('  word  ', true),
            array('0', true),
            array(1, true),
            array(0, true),
            array(true, true),
            array(false, false),
            array(null, false),
            array(array(), false),
            array(array(5), true),
            array(0.0, false),
            array(1.0, true),
            array(new stdClass(), true),
        );
    }

    /**
     * Ensures that the validator follows expected behavior
     *
     * @param mixed $value Value to test
     * @param boolean $valid Expected validity of value
     *
     * @return void
     *
     * @dataProvider booleanProvider
     */
    public function testOnlyBoolean($value, $valid)
    {
        $this->validator->setType(NotEmpty::BOOLEAN);
        $this->checkValidationValue($value, $valid);
    }

    /**
     * Provides values and their expected validity for boolean empty
     *
     * @return array
     */
    public function booleanProvider()
    {
        return array(
            array(false, false),
            array(true, true),
            array(0, true),
            array(1, true),
            array(0.0, true),
            array(1.0, true),
            array('', true),
            array('abc', true),
            array('0', true),
            array('1', true),
            array(array(), true),
            array(array('xxx'), true),
            array(null, true),
        );
    }

    /**
     * Ensures that the validator follows expected behavior
     *
     * @param mixed $value Value to test
     * @param boolean $valid Expected validity of value
     *
     * @return void
     *
     * @dataProvider integerOnlyProvider
     */
    public function testOnlyInteger($value, $valid)
    {
        $this->validator->setType(NotEmpty::INTEGER);
        $this->checkValidationValue($value, $valid);
    }

    /**
     * Provides values and their expected validity for when the validator is testing empty integer values
     *
     * @return array
     */
    public function integerOnlyProvider()
    {
        return array(
            array(false, true),
            array(true, true),
            array(0, false),
            array(1, true),
            array(0.0, true),
            array(1.0, true),
            array('', true),
            array('abc', true),
            array('0', true),
            array('1', true),
            array(array(), true),
            array(array('xxx'), true),
            array(null, true),
        );
    }

    /**
     * Ensures that the validator follows expected behavior
     *
     * @param mixed $value Value to test
     * @param boolean $valid Expected validity of value
     *
     * @return void
     *
     * @dataProvider floatOnlyProvider
     */
    public function testOnlyFloat($value, $valid)
    {
        $this->validator->setType(NotEmpty::FLOAT);
        $this->checkValidationValue($value, $valid);
    }

    /**
     * Provides values and their expected validity for boolean empty
     *
     * @return array
     */
    public function floatOnlyProvider()
    {
        return array(
            array(false, true),
            array(true, true),
            array(0, true),
            array(1, true),
            array(0.0, false),
            array(1.0, true),
            array('', true),
            array('abc', true),
            array('0', true),
            array('1', true),
            array(array(), true),
            array(array('xxx'), true),
            array(null, true),
        );
    }

    /**
     * Ensures that the validator follows expected behavior
     *
     * @param mixed $value Value to test
     * @param boolean $valid Expected validity of value
     *
     * @return void
     *
     * @dataProvider stringOnlyProvider
     */
    public function testOnlyString($value, $valid)
    {
        $this->validator->setType(NotEmpty::STRING);
        $this->checkValidationValue($value, $valid);
    }

    /**
     * Provides values and their expected validity for boolean empty
     *
     * @return array
     */
    public function stringOnlyProvider()
    {
        return array(
            array(false, true),
            array(true, true),
            array(0, true),
            array(1, true),
            array(0.0, true),
            array(1.0, true),
            array('', false),
            array('abc', true),
            array('0', true),
            array('1', true),
            array(array(), true),
            array(array('xxx'), true),
            array(null, true),
        );
    }
    /**
     * Ensures that the validator follows expected behavior
     *
     * @param mixed $value Value to test
     * @param boolean $valid Expected validity of value
     *
     * @return void
     *
     * @dataProvider zeroOnlyProvider
     */
    public function testOnlyZero($value, $valid)
    {
        $this->validator->setType(NotEmpty::ZERO);
        $this->checkValidationValue($value, $valid);
    }

    /**
     * Provides values and their expected validity for boolean empty
     *
     * @return array
     */
    public function zeroOnlyProvider()
    {
        return array(
            array(false, true),
            array(true, true),
            array(0, true),
            array(1, true),
            array(0.0, true),
            array(1.0, true),
            array('', true),
            array('abc', true),
            array('0', false),
            array('1', true),
            array(array(), true),
            array(array('xxx'), true),
            array(null, true),
        );
    }

    /**
     * Ensures that the validator follows expected behavior
     *
     * @param mixed $value Value to test
     * @param boolean $valid Expected validity of value
     *
     * @return void
     *
     * @dataProvider arrayOnlyProvider
     */
    public function testOnlyArray($value, $valid)
    {
        $this->validator->setType(NotEmpty::EMPTY_ARRAY);
        $this->checkValidationValue($value, $valid);
    }

    /**
     * Provides values and their expected validity for boolean empty
     *
     * @return array
     */
    public function arrayOnlyProvider()
    {
        return array(
            array(false, true),
            array(true, true),
            array(0, true),
            array(1, true),
            array(0.0, true),
            array(1.0, true),
            array('', true),
            array('abc', true),
            array('0', true),
            array('1', true),
            array(array(), false),
            array(array('xxx'), true),
            array(null, true),
        );
    }

    /**
     * Ensures that the validator follows expected behavior
     *
     * @param mixed $value Value to test
     * @param boolean $valid Expected validity of value
     *
     * @return void
     *
     * @dataProvider nullOnlyProvider
     */
    public function testOnlyNull($value, $valid)
    {
        $this->validator->setType(NotEmpty::NULL);
        $this->checkValidationValue($value, $valid);
    }

    /**
     * Provides values and their expected validity for boolean empty
     *
     * @return array
     */
    public function nullOnlyProvider()
    {
        return array(
            array(false, true),
            array(true, true),
            array(0, true),
            array(1, true),
            array(0.0, true),
            array(1.0, true),
            array('', true),
            array('abc', true),
            array('0', true),
            array('1', true),
            array(array(), true),
            array(array('xxx'), true),
            array(null, false),
        );
    }

    /**
     * Ensures that the validator follows expected behavior
     *
     * @param mixed $value Value to test
     * @param boolean $valid Expected validity of value
     *
     * @return void
     *
     * @dataProvider phpOnlyProvider
     */
    public function testOnlyPHP($value, $valid)
    {
        $this->validator->setType(NotEmpty::PHP);
        $this->checkValidationValue($value, $valid);
    }

    /**
     * Provides values and their expected validity for boolean empty
     *
     * @return array
     */
    public function phpOnlyProvider()
    {
        return array(
            array(false, false),
            array(true, true),
            array(0, false),
            array(1, true),
            array(0.0, false),
            array(1.0, true),
            array('', false),
            array('abc', true),
            array('0', false),
            array('1', true),
            array(array(), false),
            array(array('xxx'), true),
            array(null, false),
        );
    }

    /**
     * Ensures that the validator follows expected behavior
     *
     * @param mixed $value Value to test
     * @param boolean $valid Expected validity of value
     *
     * @return void
     *
     * @dataProvider spaceOnlyProvider
     */
    public function testOnlySpace($value, $valid)
    {
        $this->validator->setType(NotEmpty::SPACE);
        $this->checkValidationValue($value, $valid);
    }

    /**
     * Provides values and their expected validity for boolean empty
     *
     * @return array
     */
    public function spaceOnlyProvider()
    {
        return array(
            array(false, true),
            array(true, true),
            array(0, true),
            array(1, true),
            array(0.0, true),
            array(1.0, true),
            array('', true),
            array('abc', true),
            array('0', true),
            array('1', true),
            array(array(), true),
            array(array('xxx'), true),
            array(null, true),
        );
    }

    /**
     * Ensures that the validator follows expected behavior
     *
     * @param mixed $value Value to test
     * @param boolean $valid Expected validity of value
     *
     * @return void
     *
     * @dataProvider onlyAllProvider
     */
    public function testOnlyAll($value, $valid)
    {
        $this->validator->setType(NotEmpty::ALL);
        $this->checkValidationValue($value, $valid);
    }

    /**
     * Provides values and their expected validity for boolean empty
     *
     * @return array
     */
    public function onlyAllProvider()
    {
        return array(
            array(false, false),
            array(true, true),
            array(0, false),
            array(1, true),
            array(0.0, false),
            array(1.0, true),
            array('', false),
            array('abc', true),
            array('0', false),
            array('1', true),
            array(array(), false),
            array(array('xxx'), true),
            array(null, false),
        );
    }

    /**
     * Ensures that the validator follows expected behavior
     *
     * @param mixed $value Value to test
     * @param boolean $valid Expected validity of value
     *
     * @return void
     *
     * @dataProvider arrayConstantNotationProvider
     */
    public function testArrayConstantNotation($value, $valid)
    {
        $this->validator = new NotEmpty(
            array(
                'type' => array(
                    NotEmpty::ZERO,
                    NotEmpty::STRING,
                    NotEmpty::BOOLEAN
                )
            )
        );

        $this->checkValidationValue($value, $valid);
    }

    /**
     * Provides values and their expected validity for boolean empty
     *
     * @return array
     */
    public function arrayConstantNotationProvider()
    {
        return array(
            array(false, false),
            array(true, true),
            array(0, true),
            array(1, true),
            array(0.0, true),
            array(1.0, true),
            array('', false),
            array('abc', true),
            array('0', false),
            array('1', true),
            array(array(), true),
            array(array('xxx'), true),
            array(null, true),
        );
    }

    /**
     * Ensures that the validator follows expected behavior
     *
     * @param mixed $value Value to test
     * @param boolean $valid Expected validity of value
     *
     * @return void
     *
     * @dataProvider arrayConfigNotationProvider
     */
    public function testArrayConfigNotation($value, $valid)
    {
        $this->validator = new NotEmpty(
            array(
                'type' => array(
                    NotEmpty::ZERO,
                    NotEmpty::STRING,
                    NotEmpty::BOOLEAN),
                'test' => false
            )
        );

        $this->checkValidationValue($value, $valid);
    }

    /**
     * Provides values and their expected validity for boolean empty
     *
     * @return array
     */
    public function arrayConfigNotationProvider()
    {
        return array(
            array(false, false),
            array(true, true),
            array(0, true),
            array(1, true),
            array(0.0, true),
            array(1.0, true),
            array('', false),
            array('abc', true),
            array('0', false),
            array('1', true),
            array(array(), true),
            array(array('xxx'), true),
            array(null, true),
        );
    }

    /**
     * Ensures that the validator follows expected behavior
     *
     * @param mixed $value Value to test
     * @param boolean $valid Expected validity of value
     *
     * @return void
     *
     * @dataProvider multiConstantNotationProvider
     */
    public function testMultiConstantNotation($value, $valid)
    {
        $this->validator = new NotEmpty(
            NotEmpty::ZERO + NotEmpty::STRING + NotEmpty::BOOLEAN
        );

        $this->checkValidationValue($value, $valid);
    }

    /**
     * Ensures that the validator follows expected behavior
     *
     * @param mixed $value Value to test
     * @param boolean $valid Expected validity of value
     *
     * @return void
     *
     * @dataProvider multiConstantNotationProvider
     */
    public function testMultiConstantBooleanOrNotation($value, $valid)
    {
        $this->validator = new NotEmpty(
            NotEmpty::ZERO | NotEmpty::STRING | NotEmpty::BOOLEAN
        );

        $this->checkValidationValue($value, $valid);
    }

    /**
     * Provides values and their expected validity for boolean empty
     *
     * @return array
     */
    public function multiConstantNotationProvider()
    {
        return array(
            array(false, false),
            array(true, true),
            array(0, true),
            array(1, true),
            array(0.0, true),
            array(1.0, true),
            array('', false),
            array('abc', true),
            array('0', false),
            array('1', true),
            array(array(), true),
            array(array('xxx'), true),
            array(null, true),
        );
    }
    /**
     * Ensures that the validator follows expected behavior
     *
     * @param mixed $value Value to test
     * @param boolean $valid Expected validity of value
     *
     * @return void
     *
     * @dataProvider stringNotationProvider
     */
    public function testStringNotation($value, $valid)
    {
        $this->validator = new NotEmpty(
            array(
                'type' => array('zero', 'string', 'boolean')
            )
        );

        $this->checkValidationValue($value, $valid);
    }

    /**
     * Provides values and their expected validity for boolean empty
     *
     * @return array
     */
    public function stringNotationProvider()
    {
        return array(
            array(false, false),
            array(true, true),
            array(0, true),
            array(1, true),
            array(0.0, true),
            array(1.0, true),
            array('', false),
            array('abc', true),
            array('0', false),
            array('1', true),
            array(array(), true),
            array(array('xxx'), true),
            array(null, true),
        );
    }

    /**
     * Ensures that the validator follows expected behavior so if a string is specified more than once, it doesn't
     * cause different validations to run
     *
     * @param string  $string   Array of string type values
     * @param integer $expected Expected type setting value
     *
     * @return void
     *
     * @dataProvider duplicateStringSettingProvider
     */
    public function testStringNotationWithDuplicate($string, $expected)
    {
        $type = array($string, $string);
        $this->validator->setType($type);

        $this->assertEquals($expected, $this->validator->getType());
    }

    /**
     * Data provider for testStringNotationWithDuplicate method. Provides a string which will be duplicated. The test
     * ensures that setting a string value more than once only turns on the appropriate bit once
     *
     * @return array
     */
    public function duplicateStringSettingProvider()
    {
        return array(
            array('boolean',      NotEmpty::BOOLEAN),
            array('integer',      NotEmpty::INTEGER),
            array('float',        NotEmpty::FLOAT),
            array('string',       NotEmpty::STRING),
            array('zero',         NotEmpty::ZERO),
            array('array',        NotEmpty::EMPTY_ARRAY),
            array('null',         NotEmpty::NULL),
            array('php',          NotEmpty::PHP),
            array('space',        NotEmpty::SPACE),
            array('object',       NotEmpty::OBJECT),
            array('objectstring', NotEmpty::OBJECT_STRING),
            array('objectcount',  NotEmpty::OBJECT_COUNT),
            array('all',          NotEmpty::ALL),
        );
    }

    /**
     * Ensures that the validator follows expected behavior
     *
     * @param mixed $value Value to test
     * @param boolean $valid Expected validity of value
     *
     * @return void
     *
     * @dataProvider singleStringNotationProvider
     */
    public function testSingleStringNotation($value, $valid)
    {
        $this->validator = new NotEmpty(
            'boolean'
        );
        $this->checkValidationValue($value, $valid);
    }

    /**
     * Provides values and their expected validity for boolean empty
     *
     * @return array
     */
    public function singleStringNotationProvider()
    {
        return array(
            array(false, false),
            array(true, true),
            array(0, true),
            array(1, true),
            array(0.0, true),
            array(1.0, true),
            array('', true),
            array('abc', true),
            array('0', true),
            array('1', true),
            array(array(), true),
            array(array('xxx'), true),
            array(null, true),
        );
    }

    /**
     * Ensures that the validator follows expected behavior
     *
     * @param mixed $value Value to test
     * @param boolean $valid Expected validity of value
     *
     * @return void
     *
     * @dataProvider configObjectProvider
     */
    public function testConfigObject($value, $valid)
    {
        $options = array('type' => 'all');
        $config  = new \Zend\Config\Config($options);

        $this->validator = new NotEmpty(
            $config
        );

        $this->checkValidationValue($value, $valid);
    }

    /**
     * Provides values and their expected validity for boolean empty
     *
     * @return array
     */
    public function configObjectProvider()
    {
        return array(
            array(false, false),
            array(true, true),
            array(0, false),
            array(1, true),
            array(0.0, false),
            array(1.0, true),
            array('', false),
            array('abc', true),
            array('0', false),
            array('1', true),
            array(array(), false),
            array(array('xxx'), true),
            array(null, false),
        );
    }

    /**
     * Ensures that the validator follows expected behavior
     *
     * @return void
     */
    public function testSettingFalseType()
    {
        $this->setExpectedException('Zend\Validator\Exception\InvalidArgumentException', 'Unknown');
        $this->validator->setType(true);
    }

    /**
     * Ensures that the validator follows expected behavior
     *
     * @return void
     */
    public function testGetType()
    {
        $this->assertEquals($this->validator->getDefaultType(), $this->validator->getType());
    }

    /**
     * @group ZF-3236
     */
    public function testStringWithZeroShouldNotBeTreatedAsEmpty()
    {
        $this->assertTrue($this->validator->isValid('0'));
    }

    /**
     * Ensures that getMessages() returns expected default value
     *
     * @return void
     */
    public function testGetMessages()
    {
        $this->assertEquals(array(), $this->validator->getMessages());
    }

    /**
     * @ZF-4352
     */
    public function testNonStringValidation()
    {
        $v2 = new NotEmpty();
        $this->assertTrue($this->validator->isValid($v2));
    }

    /**
     * @ZF-8767
     *
     * @return void
     */
    public function testZF8767()
    {
        $valid = new NotEmpty(NotEmpty::STRING);

        $this->assertFalse($valid->isValid(''));
        $messages = $valid->getMessages();
        $this->assertArrayHasKey('isEmpty', $messages);
        $this->assertContains("can't be empty", $messages['isEmpty']);
    }

    /**
     * @return void
     */
    public function testObjects()
    {
        $valid = new NotEmpty(NotEmpty::STRING);
        $object = new stdClass();

        $this->assertFalse($valid->isValid($object));

        $valid = new NotEmpty(NotEmpty::OBJECT);
        $this->assertTrue($valid->isValid($object));
    }

    /**
     * @return void
     */
    public function testStringObjects()
    {
        $valid = new NotEmpty(NotEmpty::STRING);

        $object = $this->getMockBuilder('\stdClass')
            ->setMethods(array('__toString'))
            ->getMock();

        $object->expects($this->atLeastOnce())
            ->method('__toString')
            ->will($this->returnValue('Test'));

        $this->assertFalse($valid->isValid($object));

        $valid = new NotEmpty(NotEmpty::OBJECT_STRING);
        $this->assertTrue($valid->isValid($object));

        $object = $this->getMockBuilder('\stdClass')
            ->setMethods(array('__toString'))
            ->getMock();
        $object->expects($this->atLeastOnce())
            ->method('__toString')
            ->will($this->returnValue(''));

        $this->assertFalse($valid->isValid($object));
    }

    /**
     * @group ZF-11566
     *
     * @param mixed $value Value to test
     * @param boolean $valid Expected validity of value
     *
     * @dataProvider arrayConfigNotationWithoutKeyProvider
     */
    public function testArrayConfigNotationWithoutKey($value, $valid)
    {
        $this->validator = new NotEmpty(
            array('zero', 'string', 'boolean')
        );

        $this->checkValidationValue($value, $valid);
    }

    /**
     * Provides values and their expected validity for boolean empty
     *
     * @return array
     */
    public function arrayConfigNotationWithoutKeyProvider()
    {
        return array(
            array(false, false),
            array(true, true),
            array(0, true),
            array(1, true),
            array(0.0, true),
            array(1.0, true),
            array('', false),
            array('abc', true),
            array('0', false),
            array('1', true),
            array(array(), true),
            array(array('xxx'), true),
            array(null, true),
        );
    }

    public function testEqualsMessageTemplates()
    {
        $validator = $this->validator;
        $this->assertAttributeEquals(
            $validator->getOption('messageTemplates'),
            'messageTemplates',
            $validator
        );
    }

    public function testTypeAutoDetectionHasNoSideEffect()
    {
        $validator = new NotEmpty(array('translatorEnabled' => true));
        $this->assertEquals($validator->getDefaultType(), $validator->getType());
    }

    public function testDefaultType()
    {
        $this->assertSame(
            NotEmpty::BOOLEAN
                | NotEmpty::FLOAT
                | NotEmpty::STRING
                | NotEmpty::EMPTY_ARRAY
                | NotEmpty::NULL
                | NotEmpty::SPACE
                | NotEmpty::OBJECT,
            $this->validator->getDefaultType()
        );
    }

    /**
     * Checks that the validation value matches the expected validity
     *
     * @param mixed $value Value to validate
     * @param bool  $valid Expected validity
     *
     * @return void
     */
    protected function checkValidationValue($value, $valid)
    {
        $isValid = $this->validator->isValid($value);

        if ($valid) {
            $this->assertTrue($isValid);
        } else {
            $this->assertFalse($isValid);
        }
    }
}


text:
{% extends "base.html" %}
{% load url from future %}

{% block content %}
Google OAuth2

Google OAuth

Google OpenId

Twitter OAuth

Yahoo OpenId

Yahoo OAuth

Stripe OAuth2

Strava OAuth2

Facebook OAuth2

Facebook App

Angel OAuth2

Behance OAuth2

Bitbucket OAuth

Box.net OAuth2

LinkedIn OAuth

Github OAuth2

Foursquare OAuth2

Instagram OAuth2

Live OAuth2

VK.com OAuth2

Dailymotion OAuth2

Disqus OAuth2

Dropbox OAuth

Evernote OAuth (sandbox mode)

Fitbit OAuth

Flickr OAuth

Soundcloud OAuth2

ThisIsMyJam OAuth1

Stocktwits OAuth2

Tripit OAuth

Clef OAuth

Twilio

Xing OAuth

Yandex OAuth2

Douban OAuth2

Mixcloud OAuth2

Rdio OAuth2

Rdio OAuth1

Yammer OAuth2

Stackoverflow OAuth2

Readability OAuth1

Skyrock OAuth1

Tumblr OAuth1

Reddit OAuth2

Podio OAuth2

Amazon OAuth2

Steam OpenId

Email Auth

Username Auth

<form action="{% url 'social:begin' "openid" %}" method="post">{% csrf_token %}

    OpenId provider
    <input id="openid_identifier" type="text" value="" name="openid_identifier" />
    <input type="submit" value="Login" />

</form>

<form action="{% url 'social:begin' "livejournal" %}" method="post">{% csrf_token %}

    LiveJournal ID
    <input id="openid_lj_identifier" type="text" value="" name="openid_lj_user" />
    <input type="submit" value="Login" />

</form>

<form method="post" action="{% url 'social:complete' "persona" %}">
  <input type="hidden" name="assertion" value="" />
  Persona
</form>
{% endblock %}

{% block scripts %}

{% endblock %}


text:
<mvc:View controllerName="sap.ui.webc.main.sample.CardHeader.C" xmlns="sap.ui.webc.main" xmlns:fiori="sap.ui.webc.fiori" xmlns:mvc="sap.ui.core.mvc" height="100%">
    <Toast id="demoToast" duration="1000"></Toast>

    <fiori:Page>
        <fiori:header>
            <fiori:Bar>
                <fiori:middleContent>
                    <Title text="CardHeader"></Title>
                </fiori:middleContent>
            </fiori:Bar>
        </fiori:header>

        <fiori:content>
            <CardHeader subtitleText="Some text..." titleText="Some text..." click="handleClick">
                <action>
                    <Button icon="employee" text="Some text..."></Button>
                    <Button icon="employee" text="Some text..."></Button>
                    <Button icon="employee" text="Some text..."></Button>
                </action>
                <avatar>
                    <Button icon="employee" text="Some text..."></Button>
                    <Button icon="employee" text="Some text..."></Button>
                    <Button icon="employee" text="Some text..."></Button>
                </avatar>
            </CardHeader>
        </fiori:content>
    </fiori:Page>
</mvc:View>


text:
package com.sportmonks.endpoints;

import org.apache.commons.lang3.StringUtils;

import java.util.HashSet;
import java.util.Set;

/**
 * Created by kevin on 28/05/2016.
 */
public class VenuesEndPointParams extends AbstractEndPointParams {
    private Integer venueId;
    private Set<String> relations = new HashSet<>();

    public void addRelation(final VenuesEndPoint.Relation relation) {
        relations.add(relation.toString());
    }

    public String getRelations() {
        return StringUtils.join(relations, ",");
    }

    public boolean isValidId() {
        return venueId != null && venueId > 0;
    }

    public Integer getVenueId() {
        return venueId;
    }

    public void setVenueId(Integer venueId) {
        this.venueId = venueId;
    }

}


text:
using Newtonsoft.Json;
using System;
using System.Collections.Generic;

namespace Chutzpah.Models
{
    public enum BatchCompileMode
    {
        External,
        Executable
    }

    public enum CompilePathType
    {
        File,
        Folder
    }

    public class CompilePathMap
    {
        /// <summary>
        /// The source file/directory
        /// </summary>
        public string SourcePath { get; set; }

        [JsonIgnore]
        public bool SourcePathIsFile { get; set; }

        /// <summary>
        /// The file/directory that source file/directory is mapped to
        /// Specifying a file OutputPath and a directory for SourcePath
        /// indicated the files are being concatentated into one large file
        /// </summary>
        public string OutputPath { get; set; }

        [JsonIgnore]
        public bool OutputPathIsFile { get; set; }

        /// <summary>
        /// The type (file or folder) that the output path refers to. If not specified
        /// Chutzpah will try to take a best guess by assuming it is a file if it has a .js extension
        /// </summary>
        public CompilePathType? OutputPathType { get; set; }
    }

    public class BatchCompileConfiguration
    {
        public BatchCompileConfiguration()
        {
            Extensions = new List<string>();
            ExtensionsWithNoOutput = new List<string>();
            SkipIfUnchanged = true;
            Paths = new List<CompilePathMap>();
        }

        /// <summary>
        /// Determines the mode of the compile setting. By default it is to run the executable but if you set it to External
        /// then Chutzpah assumes some external force will compile and Chutzpah will just look for generated JS files
        /// </summary>
        public BatchCompileMode? Mode { get; set; }

        /// <summary>
        /// The extension of the files which are getting compiled
        /// </summary>
        public ICollection<string> Extensions { get; set; }

        /// <summary>
        /// The extensions of files which take part in compile but have no build output. This is used for cases like TypeScript declaration files.
        /// They have .d.ts extension and are part of compilation but have no output. You must tell Chutzpah about these if you want the SkipIfUnchanged setting to work.
        /// Otherwise Chutzpah will things these are missing output. If not using that setting then you don't need to specify this
        /// </summary>
        public ICollection<string> ExtensionsWithNoOutput { get; set; }

        /// <summary>
        /// This is the working directory of the process which executes the commad. This will default to the
        /// directory of the settings file
        /// </summary>
        public string WorkingDirectory { get; set; }

        /// <summary>
        /// Deprecated in favor of Paths element
        /// The root directory where all the sources the command compiles are below.
        /// This lets Chutzpah know where in the out dir it should find each reference file
        /// </summary>
        public string SourceDirectory { get; set; }

        /// <summary>
        /// Deprecated in favor of Paths element
        /// The directory where the compiled files are output to
        /// </summary>
        public string OutDirectory { get; set; }

        /// <summary>
        /// The collection of path mapping from source directory/file to output directory/file
        /// </summary>
        public ICollection<CompilePathMap> Paths { get; set; }

        /// <summary>
        /// The full path to an executable which Chutzpah executes to perform the batch compilation
        /// </summary>
        public string Executable { get; set; }

        /// <summary>
        /// The arguments to pass to the command
        /// </summary>
        public string Arguments { get; set; }

        /// <summary>
        /// How long to wait for compile to finish in milliseconds. Defaults to 5 minutes
        /// </summary>
        public int? Timeout { get; set; }

        /// <summary>
        /// Skips the execution if all files Chutzpah knows about are older than all of the output files
        /// This is defaulted to true but if you hit issues since it is possible chutzpah might not know about all the files your compilation
        /// code is using then you can turn this off. Ideally you can tell Chutzpah about these and then set this to be more performant
        /// </summary>
        public bool? SkipIfUnchanged { get; set; }

        /// <summary>
        /// Configures whether .map files should be loaded (if available) to convert under-test JS
        /// line numbers to those of their original source files.
        /// </summary>
        public bool? UseSourceMaps { get; set; }

        /// <summary>
        /// Should Chutzpah ignore files it expects to find compiled. If set
        /// to true Chutzpah will log an error otherwise it will throw
        /// </summary>
        public bool? IgnoreMissingFiles{ get; set; }

        /// <summary>
        /// The settings file directory that this batch compile configuration came from
        /// </summary>
        [JsonIgnore]
        public string SettingsFileDirectory { get; set; }
    }
}


text:
import * as React from 'react';
import { ConstraintItem } from '../../common-elements/fields';

export interface ConstraintsViewProps {
  constraints: string[];
}

export class ConstraintsView extends React.PureComponent<ConstraintsViewProps> {
  render() {
    if (this.props.constraints.length === 0) {
      return null;
    }
    return (
      <span>
        {' '}
        {this.props.constraints.map(constraint => (
          <ConstraintItem key={constraint}> {constraint} </ConstraintItem>
        ))}
      </span>
    );
  }
}


text:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
              xmlns:hudson="http://schemas.android.com/apk/res-auto"
              android:layout_width="match_parent"
              android:layout_height="match_parent"
              android:orientation="vertical">
    <TextView
        style="@style/setting_item_title_style"
        android:text="@string/visible_circle_column_count"/>

    <com.hudson.donglingmusic.ui.view.SelectProgressBar
        android:id="@+id/spb_circle_column_count"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        hudson:line_color="@color/gray"
        hudson:max_value="200"
        hudson:min_value="50"/>

    <TextView
        style="@style/setting_item_title_style"
        android:text="@string/visible_circle_column_stroke_width"/>

    <com.hudson.donglingmusic.ui.view.SelectProgressBar
        android:id="@+id/spb_circle_column_stroke_width"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        hudson:line_color="@color/gray"
        hudson:max_value="10"
        hudson:min_value="1"/>

    <TextView
        android:id="@+id/textView"
        style="@style/setting_item_title_style" android:text="@string/visible_music_circle_color"/>

    <LinearLayout
        android:id="@+id/ll_colors_container"
        android:layout_width="match_parent"
        android:layout_height="60dp"
        android:orientation="horizontal">

    </LinearLayout>

    <LinearLayout
        android:orientation="horizontal"
        android:layout_marginTop="10dp"
        android:layout_width="match_parent"
        android:layout_height="wrap_content">

        <ImageView
            android:id="@+id/iv_color_add"
            android:background="@drawable/selector_btn_blue_bg"
            android:src="@drawable/visible_color_add"
            android:layout_weight="1"
            android:layout_width="0dp"
            android:layout_height="wrap_content"/>

        <ImageView
            android:id="@+id/iv_color_modify"
            android:background="@drawable/selector_btn_blue_bg"
            android:src="@drawable/visible_color_modify"
            android:layout_weight="1"
            android:layout_width="0dp"
            android:layout_height="wrap_content"/>
        <ImageView
            android:id="@+id/iv_color_delete"
            android:background="@drawable/selector_btn_blue_bg"
            android:src="@drawable/visible_color_delete"
            android:layout_weight="1"
            android:layout_width="0dp"
            android:layout_height="wrap_content"/>

    </LinearLayout>

    <View android:layout_height="1dp"
          android:layout_marginTop="10dp"
          android:background="@color/appThemeColor"
          android:layout_width="match_parent"/>
    <CheckedTextView
        android:id="@+id/ctv_rotate_color"
        style="@style/CheckedTextViewTheme"
        android:text="@string/visible_music_circle_rotate_color" />
    <View android:layout_height="1dp"
          android:background="@color/appThemeColor"
          android:layout_width="match_parent"/>

    <com.hudson.donglingmusic.ui.view.CircleVisualizerFFTView
        android:id="@+id/cvf_preview"
        android:layout_gravity="center_horizontal"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"/>

</LinearLayout>


text:
import * as Sentry from "@sentry/node";
import {
  ApolloServerPluginLandingPageDisabled,
  ApolloServerPluginLandingPageGraphQLPlayground,
} from "apollo-server-core";
import { ApolloServer } from "apollo-server-express";
import { getContext } from "./context.js";

import { schema } from "./schema.js";

export const apolloServer = new ApolloServer({
  plugins: [
    process.env["NODE_ENV"] === "production"
      ? ApolloServerPluginLandingPageDisabled()
      : ApolloServerPluginLandingPageGraphQLPlayground(),
  ],
  schema,
  context: ({ req }) => getContext({ req }),
  formatError: (error) => {
    // We do want to report errors that are intentionally inside the resolvers.
    if (!error.originalError || error.originalError.name !== "APIError") {
      if (error.path || error.name !== "GraphQLError") {
        Sentry.withScope((scope) => {
          scope.setTag("graphql", "exec_error");
          scope.setExtras({
            source: error.source && error.source.body,
            positions: error.positions,
            path: error.path,
          });
          Sentry.captureException(error);
        });
      } else {
        Sentry.withScope((scope) => {
          scope.setTag("graphql", "wrong_query");
          scope.setExtras({
            source: error.source && error.source.body,
            positions: error.positions,
          });
          Sentry.captureMessage(`GraphQLWrongQuery: ${error.message}`);
        });
      }
    }

    return { message: error.message };
  },
});


text:
IOS原生库扫描二维码,速度比第三方库好很多。

##Overview

此代码用的是IOS原生库实现,没有加任何第三方类库。(支持扫描和生成二维码,以下格式均可)
ios支持以下格式码的扫描:

*  AVMetadataObjectTypeQRCode
*  AVMetadataObjectTypeCode128Code
*  AVMetadataObjectTypeEAN8Code
*  AVMetadataObjectTypeUPCECode
*  AVMetadataObjectTypeCode39Code
*  AVMetadataObjectTypePDF417Code
*  AVMetadataObjectTypeAztecCode
*  AVMetadataObjectTypeCode93Code
*  AVMetadataObjectTypeEAN13Code
*  AVMetadataObjectTypeCode39Mod43Code

此代码最新版本事例只能扫描QRCdoe、PDF417码(即AVMetadataObjectTypePDF417Code)、AVMetadataObjectTypeEAN13Code。

### 关于PDF417码
PDF417码:PDF417 is a stacked linear barcode symbol format used in a variety of applications, primarily transport, identification cards, and inventory management.

#### 联系方式
我是一个单细胞单线程妞。

<zltqzj@163.com>


text:
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Runtime.Serialization.Formatters.Binary;
using System.Text;
using UnityEngine;

class ValueList {

	/* A list of strings and other values, for localization */

	/*
	{
		"id1" : "value1",
		"group" : {
			"id2" : "value2"
		}
	}

	Use:
	getString("id1"); // "value1"
	getString("group.id2"); // "value2"

	TODO:
	 * Proper processed string
	 * Insert from JSON
	 * Other native types: bool, number, etc
	 * Other Unity types: prefab, texture, audio clip
	 * Actual language filtering

	* For proper language later:
	Values.json
	{
		id: "en",
		name: "English",
		values: {
			name: "App name"
		}
	}

	*/

	// Constants
	private static string ID_HYERARCHY_SEPARATOR = ".";

	// Default values
	//private static string VALUE_STRING_DEFAULT = "[null]";

	// Static properties
	private static Dictionary<string, ValueList> instances;

	// Properties
	private string _key;									// Instance name
	private ValueGroup root;

	// ================================================================================================================
	// STATIC ---------------------------------------------------------------------------------------------------------

	static ValueList() {
		instances = new Dictionary<string, ValueList>();
	}

	// ================================================================================================================
	// CONSTRUCTOR ----------------------------------------------------------------------------------------------------

	public ValueList(string key = "") {
		_key = key;

		ValueList.addInstance(this);
		root = new ValueGroup();
	}

	// ================================================================================================================
	// STATIC INTERFACE -----------------------------------------------------------------------------------------------

	private static void addInstance(ValueList instance) {
		if (instances.ContainsKey(instance.key)) instances.Remove(instance.key);
		instances.Add(instance.key, instance);
	}

	public static ValueList getInstance(string key = "") {
		if (instances.ContainsKey(key)) return instances[key];

		// Doesn't exist, create a new one and return it
		return new ValueList(key);
	}

	// ================================================================================================================
	// PUBLIC INTERFACE -----------------------------------------------------------------------------------------------

	/*
	public function setValues(__object:Object):void {
		// Set the values; __object must be a JSON-like object
		values = __object;
		// TODO: read string data replacing unix/windows line feed?
	}
	 * */

	public string GetString(string keyPath) {
		return getValueInternal<string>(keyPath);
	}

	public T GetValue<T>(string keyPath) {
		return getValueInternal<T>(keyPath);
	}

	public void SetString(string keyPath, string value) {
		setValueInternal(keyPath, new ValueItemString(value));
	}

	public bool HasKey(string keyPath) {
		return getValueInternal<object>(keyPath) != null;
	}

	public void SetFromJSON(string jsonSource) {
		// Parses a JSON file and sets the value data
		// { "key" : "value", "group" : { "key": "value" }}
		SetFromDictionary(JSON.parseAsDictionary(jsonSource, JSON.FLAG_REMOVE_COMMENTS));
	}

	public void SetFromDictionary(IDictionary dictionary, string parentRoot = "") {
		// Set values from a dictionary, using a parent root if any
		string thisPath;
		foreach (DictionaryEntry entry in dictionary) {
			thisPath = (parentRoot.Length > 0 ? parentRoot + ID_HYERARCHY_SEPARATOR : "") + entry.Key;
			if (entry.Value is string) {
				// Normal string
				SetString(thisPath, entry.Value as string);
			} else if (entry.Value is IDictionary) {
				// Group
				SetFromDictionary(entry.Value as Dictionary<string, object>, thisPath);
			} else {
				Debug.LogError("Error! Cannot add from dictionary with object [" + entry.Value + "]");
			}
		}
	}

	/*
	public string getProcessedString(string text) {
		return getProcessedStringInternal(text);
	}
	*/

	// ================================================================================================================
	// ACCESSOR INTERFACE ---------------------------------------------------------------------------------------------

	public string key {
		get { return _key; }
	}

	// ================================================================================================================
	// INTERNAL INTERFACE ---------------------------------------------------------------------------------------------

	/*
	private string getProcessedStringInternal(string text) {
		// Returns a string with processed codes
		// For example "this is an ${examples/example}!" returns "this is an EXAMPLE!" (where the value of examples.example in strings.json is "EXAMPLE")

		var newString = "";

		var codes:RegExp = /\$\{(.+?)\}/ig;
		var result:Object = codes.exec(__string);

		var lastIndex:Number = 0;
		var newIndex:Number;

		while (Boolean(result)) {
			newIndex = result["index"];

			// What came before the tag
			newString += __string.substring(lastIndex, newIndex);

			// The tag tex
			newString += getString(result[1]);

			lastIndex = codes.lastIndex;

			result = codes.exec(__string);
		}

		// End text after last tag
		newString += __string.substring(lastIndex, __string.length);

		return newString;
	}
	 * */

	private T getValueInternal<T>(string keyPath) {
		// Get the full path to the value name
		var ids = new List<string>(keyPath.Split(ID_HYERARCHY_SEPARATOR.ToCharArray()));
		ValueGroup group;
		string itemKey;
		if (ids.Count > 0) {
			// Remove last (because it's the item)
			itemKey = ids[ids.Count - 1];
			ids.RemoveAt(ids.Count - 1);
			group = getGroupInternal(ids);
		} else {
			Debug.LogWarning("ValueList :: Value path [" + keyPath + "] is empty!");
			return default(T);
		}

		if (group == null) {
			return default(T);
		} else if (group.hasItem(itemKey)) {
			return (T)(group.getItem(itemKey).getValue());
		} else {
			Debug.LogWarning("ValueList :: Value path key [" + keyPath + "] doesn't exist!");
			return default(T);
		}
	}

	private void setValueInternal(string keyPath, ValueItem valueItem) {
		var ids = new List<string>(keyPath.Split(ID_HYERARCHY_SEPARATOR.ToCharArray()));
		ValueGroup group;
		string itemKey;
		if (ids.Count > 0) {
			// Remove last (because it's the item)
			itemKey = ids[ids.Count - 1];
			ids.RemoveAt(ids.Count - 1);
			group = getGroupInternal(ids, true);
			group.addItem(itemKey, valueItem);
		} else {
			Debug.LogWarning("ValueList :: Value path [" + keyPath + "] is empty!");
		}
	}

	private ValueGroup getGroupInternal(List<String> keyPath, bool canCreate = false) {
		var currentGroup = root;

		for (var i = 0; i < keyPath.Count; i++) {
			if (currentGroup.hasGroup(keyPath[i])) {
				// Found
				currentGroup = currentGroup.getGroup(keyPath[i]);
			} else if (canCreate) {
				// Doesn't exist, but can create
				currentGroup.addGroup(keyPath[i], new ValueGroup());
				currentGroup = currentGroup.getGroup(keyPath[i]);
			} else {
				// Doesn't exist, fail
				Debug.LogWarning("ValueList :: Value path [" + string.Join(ID_HYERARCHY_SEPARATOR, keyPath.ToArray()) + "] doesn't exist!");
				return null;
			}
		}

		return currentGroup;
	}

	// ================================================================================================================
	// AUXILIARY CLASSES ----------------------------------------------------------------------------------------------

	class ValueGroup {
		private Dictionary<string, ValueGroup> groups;
		private Dictionary<string, ValueItem> items;

		public ValueGroup() {
			groups = new Dictionary<string, ValueGroup>();
			items = new Dictionary<string, ValueItem>();
		}

		public bool hasItem(string key) {
			return items.ContainsKey(key);
		}

		public void addItem(string key, ValueItem item) {
			items[key] = item;
		}

		public ValueItem getItem(string key) {
			return items[key];
		}

		public bool hasGroup(string key) {
			return groups.ContainsKey(key);
		}

		public void addGroup(string key, ValueGroup group) {
			groups[key] = group;
		}

		public ValueGroup getGroup(string key) {
			return groups[key];
		}
	}

	abstract class ValueItem {
		private object value;

		public ValueItem(object value) {
			this.value = value;
		}

		public object getValue() {
			return value;
		}
	}

	class ValueItemString:ValueItem {
		public ValueItemString(string value):base(value) {
		}

		public string getValue() {
			return (string)getValue();
		}
	}

}


text:
package com.alwaysallthetime.adnlib.data;

import java.util.ArrayList;

public class MessageList extends ArrayList<Message> implements IPageableAppDotNetObjectList<Message> {}


text:
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
Partial Class NewGameWindow
    Inherits System.Windows.Forms.Form

    'Form overrides dispose to clean up the component list.
    <System.Diagnostics.DebuggerNonUserCode()> _
    Protected Overrides Sub Dispose(ByVal disposing As Boolean)
        Try
            If disposing AndAlso components IsNot Nothing Then
                components.Dispose()
            End If
        Finally
            MyBase.Dispose(disposing)
        End Try
    End Sub

    'Required by the Windows Form Designer
    Private components As System.ComponentModel.IContainer

    'NOTE: The following procedure is required by the Windows Form Designer
    'It can be modified using the Windows Form Designer.
    'Do not modify it using the code editor.
    <System.Diagnostics.DebuggerStepThrough()> _
    Private Sub InitializeComponent()
        Dim resources As System.ComponentModel.ComponentResourceManager = New System.ComponentModel.ComponentResourceManager(GetType(NewGameWindow))
        Me.Label1 = New System.Windows.Forms.Label()
        Me.lstTemplate = New System.Windows.Forms.ComboBox()
        Me.Label2 = New System.Windows.Forms.Label()
        Me.txtGameName = New System.Windows.Forms.TextBox()
        Me.Label3 = New System.Windows.Forms.Label()
        Me.txtFilename = New System.Windows.Forms.TextBox()
        Me.cmdOK = New System.Windows.Forms.Button()
        Me.cmdCancel = New System.Windows.Forms.Button()
        Me.cmdBrowse = New System.Windows.Forms.Button()
        Me.ctlSaveDialog = New System.Windows.Forms.SaveFileDialog()
        Me.Label4 = New System.Windows.Forms.Label()
        Me.optTextAdventure = New System.Windows.Forms.RadioButton()
        Me.optGamebook = New System.Windows.Forms.RadioButton()
        Me.picTextAdventureBorder = New System.Windows.Forms.PictureBox()
        Me.picGamebookBorder = New System.Windows.Forms.PictureBox()
        Me.picTextAdventure = New System.Windows.Forms.PictureBox()
        Me.picGamebook = New System.Windows.Forms.PictureBox()
        CType(Me.picTextAdventureBorder, System.ComponentModel.ISupportInitialize).BeginInit()
        CType(Me.picGamebookBorder, System.ComponentModel.ISupportInitialize).BeginInit()
        CType(Me.picTextAdventure, System.ComponentModel.ISupportInitialize).BeginInit()
        CType(Me.picGamebook, System.ComponentModel.ISupportInitialize).BeginInit()
        Me.SuspendLayout()
        '
        'Label1
        '
        Me.Label1.AutoSize = True
        Me.Label1.Location = New System.Drawing.Point(104, 136)
        Me.Label1.Name = "Label1"
        Me.Label1.Size = New System.Drawing.Size(58, 13)
        Me.Label1.TabIndex = 4
        Me.Label1.Text = "&Language:"
        '
        'lstTemplate
        '
        Me.lstTemplate.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList
        Me.lstTemplate.FormattingEnabled = True
        Me.lstTemplate.Location = New System.Drawing.Point(107, 152)
        Me.lstTemplate.Name = "lstTemplate"
        Me.lstTemplate.Size = New System.Drawing.Size(182, 21)
        Me.lstTemplate.TabIndex = 5
        '
        'Label2
        '
        Me.Label2.AutoSize = True
        Me.Label2.Location = New System.Drawing.Point(16, 209)
        Me.Label2.Name = "Label2"
        Me.Label2.Size = New System.Drawing.Size(38, 13)
        Me.Label2.TabIndex = 6
        Me.Label2.Text = "&Name:"
        '
        'txtGameName
        '
        Me.txtGameName.Anchor = CType(((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Left) _
            Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
        Me.txtGameName.Location = New System.Drawing.Point(77, 206)
        Me.txtGameName.Name = "txtGameName"
        Me.txtGameName.Size = New System.Drawing.Size(484, 20)
        Me.txtGameName.TabIndex = 7
        '
        'Label3
        '
        Me.Label3.AutoSize = True
        Me.Label3.Location = New System.Drawing.Point(16, 240)
        Me.Label3.Name = "Label3"
        Me.Label3.Size = New System.Drawing.Size(55, 13)
        Me.Label3.TabIndex = 8
        Me.Label3.Text = "File name:"
        '
        'txtFilename
        '
        Me.txtFilename.Anchor = CType(((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Left) _
            Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
        Me.txtFilename.Location = New System.Drawing.Point(77, 237)
        Me.txtFilename.Name = "txtFilename"
        Me.txtFilename.ReadOnly = True
        Me.txtFilename.Size = New System.Drawing.Size(403, 20)
        Me.txtFilename.TabIndex = 9
        '
        'cmdOK
        '
        Me.cmdOK.Anchor = CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
        Me.cmdOK.Enabled = False
        Me.cmdOK.Location = New System.Drawing.Point(405, 273)
        Me.cmdOK.Name = "cmdOK"
        Me.cmdOK.Size = New System.Drawing.Size(75, 23)
        Me.cmdOK.TabIndex = 11
        Me.cmdOK.Text = "OK"
        Me.cmdOK.UseVisualStyleBackColor = True
        '
        'cmdCancel
        '
        Me.cmdCancel.Anchor = CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
        Me.cmdCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel
        Me.cmdCancel.Location = New System.Drawing.Point(486, 273)
        Me.cmdCancel.Name = "cmdCancel"
        Me.cmdCancel.Size = New System.Drawing.Size(75, 23)
        Me.cmdCancel.TabIndex = 12
        Me.cmdCancel.Text = "Cancel"
        Me.cmdCancel.UseVisualStyleBackColor = True
        '
        'cmdBrowse
        '
        Me.cmdBrowse.Anchor = CType((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
        Me.cmdBrowse.Location = New System.Drawing.Point(486, 235)
        Me.cmdBrowse.Name = "cmdBrowse"
        Me.cmdBrowse.Size = New System.Drawing.Size(75, 23)
        Me.cmdBrowse.TabIndex = 10
        Me.cmdBrowse.Text = "&Browse..."
        Me.cmdBrowse.UseVisualStyleBackColor = True
        '
        'ctlSaveDialog
        '
        Me.ctlSaveDialog.DefaultExt = "aslx"
        Me.ctlSaveDialog.Filter = "Quest Games|*.aslx"
        '
        'Label4
        '
        Me.Label4.AutoSize = True
        Me.Label4.Location = New System.Drawing.Point(15, 13)
        Me.Label4.Name = "Label4"
        Me.Label4.Size = New System.Drawing.Size(61, 13)
        Me.Label4.TabIndex = 1
        Me.Label4.Text = "Game type:"
        '
        'optTextAdventure
        '
        Me.optTextAdventure.AutoSize = True
        Me.optTextAdventure.Checked = True
        Me.optTextAdventure.Location = New System.Drawing.Point(82, 11)
        Me.optTextAdventure.Name = "optTextAdventure"
        Me.optTextAdventure.Size = New System.Drawing.Size(97, 17)
        Me.optTextAdventure.TabIndex = 2
        Me.optTextAdventure.TabStop = True
        Me.optTextAdventure.Text = "&Text adventure"
        Me.optTextAdventure.UseVisualStyleBackColor = True
        '
        'optGamebook
        '
        Me.optGamebook.AutoSize = True
        Me.optGamebook.Location = New System.Drawing.Point(324, 11)
        Me.optGamebook.Name = "optGamebook"
        Me.optGamebook.Size = New System.Drawing.Size(77, 17)
        Me.optGamebook.TabIndex = 3
        Me.optGamebook.Text = "&Gamebook"
        Me.optGamebook.UseVisualStyleBackColor = True
        '
        'picTextAdventureBorder
        '
        Me.picTextAdventureBorder.BackColor = System.Drawing.Color.White
        Me.picTextAdventureBorder.Location = New System.Drawing.Point(107, 34)
        Me.picTextAdventureBorder.Name = "picTextAdventureBorder"
        Me.picTextAdventureBorder.Size = New System.Drawing.Size(182, 89)
        Me.picTextAdventureBorder.TabIndex = 11
        Me.picTextAdventureBorder.TabStop = False
        '
        'picGamebookBorder
        '
        Me.picGamebookBorder.BackColor = System.Drawing.Color.White
        Me.picGamebookBorder.Location = New System.Drawing.Point(346, 34)
        Me.picGamebookBorder.Name = "picGamebookBorder"
        Me.picGamebookBorder.Size = New System.Drawing.Size(182, 89)
        Me.picGamebookBorder.TabIndex = 12
        Me.picGamebookBorder.TabStop = False
        '
        'picTextAdventure
        '
        Me.picTextAdventure.BackColor = System.Drawing.Color.White
        Me.picTextAdventure.Image = CType(resources.GetObject("picTextAdventure.Image"), System.Drawing.Image)
        Me.picTextAdventure.Location = New System.Drawing.Point(117, 44)
        Me.picTextAdventure.Name = "picTextAdventure"
        Me.picTextAdventure.Size = New System.Drawing.Size(122, 50)
        Me.picTextAdventure.TabIndex = 13
        Me.picTextAdventure.TabStop = False
        '
        'picGamebook
        '
        Me.picGamebook.BackColor = System.Drawing.Color.White
        Me.picGamebook.Image = CType(resources.GetObject("picGamebook.Image"), System.Drawing.Image)
        Me.picGamebook.Location = New System.Drawing.Point(360, 44)
        Me.picGamebook.Name = "picGamebook"
        Me.picGamebook.Size = New System.Drawing.Size(142, 74)
        Me.picGamebook.TabIndex = 14
        Me.picGamebook.TabStop = False
        '
        'NewGameWindow
        '
        Me.AcceptButton = Me.cmdOK
        Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
        Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
        Me.CancelButton = Me.cmdCancel
        Me.ClientSize = New System.Drawing.Size(573, 308)
        Me.Controls.Add(Me.picGamebook)
        Me.Controls.Add(Me.picTextAdventure)
        Me.Controls.Add(Me.picGamebookBorder)
        Me.Controls.Add(Me.picTextAdventureBorder)
        Me.Controls.Add(Me.optGamebook)
        Me.Controls.Add(Me.optTextAdventure)
        Me.Controls.Add(Me.Label4)
        Me.Controls.Add(Me.cmdBrowse)
        Me.Controls.Add(Me.cmdCancel)
        Me.Controls.Add(Me.cmdOK)
        Me.Controls.Add(Me.txtFilename)
        Me.Controls.Add(Me.Label3)
        Me.Controls.Add(Me.txtGameName)
        Me.Controls.Add(Me.Label2)
        Me.Controls.Add(Me.lstTemplate)
        Me.Controls.Add(Me.Label1)
        Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog
        Me.MaximizeBox = False
        Me.MaximumSize = New System.Drawing.Size(1200, 400)
        Me.MinimizeBox = False
        Me.MinimumSize = New System.Drawing.Size(400, 190)
        Me.Name = "NewGameWindow"
        Me.ShowIcon = False
        Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent
        Me.Text = "Create New Game"
        CType(Me.picTextAdventureBorder, System.ComponentModel.ISupportInitialize).EndInit()
        CType(Me.picGamebookBorder, System.ComponentModel.ISupportInitialize).EndInit()
        CType(Me.picTextAdventure, System.ComponentModel.ISupportInitialize).EndInit()
        CType(Me.picGamebook, System.ComponentModel.ISupportInitialize).EndInit()
        Me.ResumeLayout(False)
        Me.PerformLayout()

    End Sub
    Friend WithEvents Label1 As System.Windows.Forms.Label
    Friend WithEvents lstTemplate As System.Windows.Forms.ComboBox
    Friend WithEvents Label2 As System.Windows.Forms.Label
    Friend WithEvents txtGameName As System.Windows.Forms.TextBox
    Friend WithEvents Label3 As System.Windows.Forms.Label
    Friend WithEvents txtFilename As System.Windows.Forms.TextBox
    Friend WithEvents cmdOK As System.Windows.Forms.Button
    Friend WithEvents cmdCancel As System.Windows.Forms.Button
    Friend WithEvents cmdBrowse As System.Windows.Forms.Button
    Friend WithEvents ctlSaveDialog As System.Windows.Forms.SaveFileDialog
    Friend WithEvents Label4 As System.Windows.Forms.Label
    Friend WithEvents optTextAdventure As System.Windows.Forms.RadioButton
    Friend WithEvents optGamebook As System.Windows.Forms.RadioButton
    Friend WithEvents picTextAdventureBorder As System.Windows.Forms.PictureBox
    Friend WithEvents picGamebookBorder As System.Windows.Forms.PictureBox
    Friend WithEvents picTextAdventure As System.Windows.Forms.PictureBox
    Friend WithEvents picGamebook As System.Windows.Forms.PictureBox
End Class


text:
/*!
 * Created with JetBrains WebStorm.
 * User: mschwartz
 * Date: 9/11/13
 * Time: 9:13 AM
 * To change this template use File | Settings | File Templates.
 */

/**
 * Return the extension of the path, from the last '.' to end of string in the last portion of the path. If there is no '.' in the last portion of the path or the first character of it is '.', then it returns an empty string.
 * @method extname
 * @member path
 * @param {String} p - path
 * @returns {String} extension - extension or empty string
 */
module.exports = function(p) {
    if (!p || p[0] === '.') {
        return '';
    }
    var dotIndex = p.lastIndexOf('.');
    if (dotIndex === -1) {
        return '';
    }
    return p.substr(dotIndex);
};


text:
<!doctype html>

        <title>{{ username }}</title>
        <link rel="shortcut icon" href={{ url_for('static',filename='favicon.ico')}}>
        <link rel="stylesheet" type="text/css" href={{ url_for('static', filename='user.css')}}>

{{aggregators}}


text:
namespace v8 {
namespace internal {
namespace interpreter {

MaybeHandle<Object> CallInterpreter(Isolate* isolate,
                                    Handle<JSFunction> function) {
  return Execution::Call(isolate, function,
                         isolate->factory()->undefined_value(), 0, nullptr);
}

InterpreterTester::InterpreterTester(
    Isolate* isolate, const char* source, MaybeHandle<BytecodeArray> bytecode,
    MaybeHandle<TypeFeedbackVector> feedback_vector, const char* filter)
    : isolate_(isolate),
      source_(source),
      bytecode_(bytecode),
      feedback_vector_(feedback_vector) {
  i::FLAG_ignition = true;
  i::FLAG_always_opt = false;
}

InterpreterTester::InterpreterTester(
    Isolate* isolate, Handle<BytecodeArray> bytecode,
    MaybeHandle<TypeFeedbackVector> feedback_vector, const char* filter)
    : InterpreterTester(isolate, nullptr, bytecode, feedback_vector, filter) {}

InterpreterTester::InterpreterTester(Isolate* isolate, const char* source,
                                     const char* filter)
    : InterpreterTester(isolate, source, MaybeHandle<BytecodeArray>(),
                        MaybeHandle<TypeFeedbackVector>(), filter) {}

InterpreterTester::~InterpreterTester() {}

Local<Message> InterpreterTester::CheckThrowsReturnMessage() {
  TryCatch try_catch(reinterpret_cast<v8::Isolate*>(isolate_));
  auto callable = GetCallable<>();
  MaybeHandle<Object> no_result = callable();
  CHECK(isolate_->has_pending_exception());
  CHECK(try_catch.HasCaught());
  CHECK(no_result.is_null());
  isolate_->OptionalRescheduleException(true);
  CHECK(!try_catch.Message().IsEmpty());
  return try_catch.Message();
}

Handle<Object> InterpreterTester::NewObject(const char* script) {
  return v8::Utils::OpenHandle(*CompileRun(script));
}

Handle<String> InterpreterTester::GetName(Isolate* isolate, const char* name) {
  Handle<String> result = isolate->factory()->NewStringFromAsciiChecked(name);
  return isolate->factory()->string_table()->LookupString(isolate, result);
}

std::string InterpreterTester::SourceForBody(const char* body) {
  return "function " + function_name() + "() {\n" + std::string(body) + "\n}";
}

std::string InterpreterTester::function_name() {
  return std::string(kFunctionName);
}

}  // namespace interpreter
}  // namespace internal
}  // namespace v8


text:
package com.squareup.okhttp.internal.allocations;

import com.squareup.okhttp.ConnectionPool;
import org.junit.Test;

import static junit.framework.TestCase.assertEquals;
import static org.junit.Assert.assertNotEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.fail;

public final class ConnectionTest {
  ConnectionPool connectionPool = new ConnectionPool(1, 1000L);

  @Test public void reserveCreateCompleteRelease() throws Exception {
    Connection connection = new Connection(connectionPool);
    connection.setAllocationLimit(1);

    Connection.StreamAllocation a = connection.reserve("a");
    Connection.Stream a1 = a.newStream("a1");
    assertNotNull(a1);
    a.streamComplete(a1);
    assertEquals(1, connection.size()); // Still allocated.

    connection.release(a);
    assertEquals(0, connection.size());
  }

  @Test public void reserveCreateReleaseComplete() throws Exception {
    Connection connection = new Connection(connectionPool);
    connection.setAllocationLimit(1);

    Connection.StreamAllocation a = connection.reserve("a");
    Connection.Stream a1 = a.newStream("a1");
    assertNotNull(a1);
    connection.release(a);
    assertEquals(1, connection.size()); // Still allocated.

    a.streamComplete(a1);
    assertEquals(0, connection.size());
  }

  @Test public void reuseAllocation() throws Exception {
    Connection connection = new Connection(connectionPool);
    connection.setAllocationLimit(1);

    Connection.StreamAllocation a = connection.reserve("a");
    Connection.Stream a1 = a.newStream("a1");
    assertNotNull(a1);
    a.streamComplete(a1);
    assertEquals(1, connection.size());

    Connection.Stream a2 = a.newStream("a2");
    assertNotNull(a2);
    a.streamComplete(a2);
    assertEquals(1, connection.size());

    connection.release(a);
    assertEquals(0, connection.size());
  }

  @Test public void cannotReuseAllocationAfterRelease() throws Exception {
    Connection connection = new Connection(connectionPool);
    connection.setAllocationLimit(1);

    Connection.StreamAllocation a = connection.reserve("a");
    Connection.Stream a1 = a.newStream("a1");
    a.streamComplete(a1);
    connection.release(a);

    try {
      a.newStream("a2");
      fail();
    } catch (IllegalStateException expected) {
    }
  }

  @Test public void createReturnsNullAfterNoNewStreams() throws Exception {
    Connection connection = new Connection(connectionPool);
    connection.setAllocationLimit(1);

    Connection.StreamAllocation a = connection.reserve("a");
    Connection.Stream a1 = a.newStream("a1");
    assertNotNull(a1);
    a.streamComplete(a1);
    assertEquals(1, connection.size());

    connection.noNewStreams();
    assertNull(a.newStream("a2"));
    assertEquals(1, connection.size());

    connection.release(a);
    assertEquals(0, connection.size());
  }

  @Test public void reserveReturnsNullAfterNoNewStreams() throws Exception {
    Connection connection = new Connection(connectionPool);
    connection.setAllocationLimit(1);

    Connection.StreamAllocation a = connection.reserve("a");
    Connection.Stream a1 = a.newStream("a1");

    connection.noNewStreams();
    assertNull(connection.reserve("b"));

    // Even after streams are released, the limit still holds.
    a.streamComplete(a1);
    assertNull(connection.reserve("c"));
  }

  @Test public void closeScheduledAfterNoNewStreams() throws Exception {
    Connection connection = new Connection(connectionPool);
    connection.setAllocationLimit(1);

    Connection.StreamAllocation a = connection.reserve("c");
    Connection.Stream a1 = a.newStream("a1");
    connection.noNewStreams();
    assertEquals(Long.MAX_VALUE, connection.idleAt);

    a.streamComplete(a1);
    assertEquals(Long.MAX_VALUE, connection.idleAt);

    connection.release(a);
    assertNotEquals(Long.MAX_VALUE, connection.idleAt);
  }

  @Test public void multipleAllocations() throws Exception {
    Connection connection = new Connection(connectionPool);
    connection.setAllocationLimit(2);

    Connection.StreamAllocation a = connection.reserve("a");
    Connection.StreamAllocation b = connection.reserve("b");
    Connection.Stream a1 = a.newStream("a1");
    Connection.Stream b1 = b.newStream("b1");
    assertEquals(2, connection.size());

    connection.release(a);
    assertEquals(2, connection.size());
    a.streamComplete(a1);
    assertEquals(1, connection.size());

    b.streamComplete(b1);
    assertEquals(1, connection.size());
    connection.release(b);
    assertEquals(0, connection.size());
  }

  @Test public void lowerAndRaiseAllocationLimit() throws Exception {
    Connection connection = new Connection(connectionPool);
    connection.setAllocationLimit(2);

    assertNotNull(connection.reserve("a"));
    assertNotNull(connection.reserve("a"));
    assertNull(connection.reserve("c"));

    connection.setAllocationLimit(0);
    assertEquals(2, connection.size());
    assertNull(connection.reserve("d"));

    connection.setAllocationLimit(3);
    assertNotNull(connection.reserve("e"));
  }

  @Test public void leakedAllocation() throws Exception {
    Connection connection = new Connection(connectionPool);
    connection.setAllocationLimit(1);

    reserveAndLeakAllocation(connection);
    awaitGarbageCollection();
    connection.pruneLeakedAllocations();
    assertEquals(0, connection.size());

    assertNull(connection.reserve("b")); // Can't allocate once a leak has been detected.
  }

  /** Use a helper method so there's no hidden reference remaining on the stack. */
  private void reserveAndLeakAllocation(Connection connection) {
    connection.reserve("a");
  }

  /**
   * See FinalizationTester for discussion on how to best trigger GC in tests.
   * https://android.googlesource.com/platform/libcore/+/master/support/src/test/java/libcore/
   * java/lang/ref/FinalizationTester.java
   */
  private void awaitGarbageCollection() throws InterruptedException {
    Runtime.getRuntime().gc();
    Thread.sleep(100);
    System.runFinalization();
  }
}