text:
#include <cstddef>
#include <string>
#include <iostream>
#include <tchar.h>
#include <windows.h>

// FDO Headers File
#include <FdoStd.h>
#include <FDO.h>
#include <FdoCommon.h>
#include <FdoGeometry.h>
#include <FdoMessage.h>
#include <SuperMapIniFile.h>

#include "fdoutility.h"
using namespace fdoutility;

/********************************************************************
	ת»»×Ö·û´®
********************************************************************/
std::string WcharToString(const wchar_t* wstr)
{
	size_t		nSize;
	char	*ASCIITemp;

	nSize = _tcslen(wstr) * 2;

	ASCIITemp = (char*) malloc (nSize + 1);

	WideCharToMultiByte(
		CP_ACP, /* ANSI code page */
		0, /* no flags */
		wstr, /* wchar_t */
		(int)nSize,
		ASCIITemp,
		(int)nSize,
		NULL, /* Don't worry about other characters */
		NULL  /* Don't worry about other characters */
		);

	ASCIITemp[nSize] = '\0';

	std::string StringTemp(ASCIITemp);

	free(ASCIITemp);

	return StringTemp;
}

/*
#define RETURN_CHECK(x, msg) 	if(NULL == x){ std::cout << msg; return 0;}

#define CONFIG_SECTION	"ProviderConfig"

int _tmain()
{
	SuperMapIniFile inifile;
	inifile.Load("c:\\test.ini");
	inifile.AddSection(CONFIG_SECTION);

	FdoPtr<FdoProviderRegistry> registry = (FdoProviderRegistry *)FdoFeatureAccessManager::GetProviderRegistry();

	FdoStringP displayName;
	FdoStringP internalName;
	FdoStringP libraryPath;
	FdoPtr<FdoProvider> provider;
	int count = registry->GetProviders()->GetCount();
	for(int i = 0; i < count; i++)
	{
		provider = registry->GetProviders()->GetItem(i);
		internalName = provider->GetName();
		displayName = provider->GetDisplayName();
		libraryPath = provider->GetLibraryPath();

		std::cout << "ÌṩÕßÃû³Æ£º" << WcharToString(internalName)
				<< "\nÏÔʾµÄÃû³Æ£º" <<  WcharToString(displayName)
				<< "\nÌṩÕߵĿ⣺" <<  WcharToString(libraryPath)
				<< std::endl;
	}

	inifile.SetValue(CONFIG_SECTION, "ProviderName", WcharToString(internalName).c_str());
	inifile.SetValue(CONFIG_SECTION, "ProviderDisplayName", WcharToString(displayName).c_str());
	inifile.SetValue(CONFIG_SECTION, "ProviderLibraryPath", WcharToString(libraryPath).c_str());

	inifile.Save();
	inifile.ClearAll();

	inifile.Load("c:\\test.ini");

	std::cout << "---------------------------------------------" << std::endl;
	std::string strTemp1, strTemp2, strTemp3;
	inifile.GetValue(CONFIG_SECTION, "ProviderName", strTemp1,"");
	inifile.GetValue(CONFIG_SECTION, "ProviderDisplayName", strTemp2, "");
	inifile.GetValue(CONFIG_SECTION, "ProviderLibraryPath", strTemp3, "");

	std::cout << "ÌṩÕßÃû³Æ£º" << strTemp1
		<< "\nÏÔʾµÄÃû³Æ£º" <<  strTemp2
		<< "\nÌṩÕߵĿ⣺" <<  strTemp3
		<< std::endl;

	inifile.ClearAll();

	std::cout << "½¨Á¢ OSGeo.SuperMap.1.0 ÌṩÕß ..." << std::endl;
	FdoPtr<FdoConnectionManager> connectMgr = (FdoConnectionManager *)FdoFeatureAccessManager::GetConnectionManager();
	FdoPtr<FdoIConnection> fdoConnection = connectMgr->CreateConnection(_T("OSGeo.SuperMap.1.0"));
	RETURN_CHECK(fdoConnection, "½¨Á¢Á¬½Óʧ°Ü... \n");

	FdoPtr<FdoIConnectionInfo> info = fdoConnection->GetConnectionInfo();
	RETURN_CHECK(info, "»ñÈ¡Á¬½ÓÐÅϢʧ°Ü... \n");

	FdoPtr<FdoIConnectionPropertyDictionary> ConnDict = info->GetConnectionProperties();
	RETURN_CHECK(ConnDict, "»ñÈ¡Á¬½ÓÊôÐÔÐÅϢʧ°Ü... \n");

	FdoInt32 nPropertyCount = 0;
	FdoString ** names = NULL;
	FdoStringP name;
	FdoStringP localname;
	FdoStringP val;
	FdoStringP defaultVal;
	bool isRequired = false;
	bool isProtected = false;
	bool isFilename = false;
	bool isFilepath = false;
	bool isDatastorename = false;
	bool isEnumerable = false;
	FdoInt32 enumCount = 0;
	FdoString ** enumNames = NULL;
	FdoStringP enumName;

	names = ConnDict->GetPropertyNames(nPropertyCount);
	for(int i = 0; i < nPropertyCount; i++)
	{
		name = names[i];
		val = ConnDict->GetProperty(name);
		defaultVal = ConnDict->GetPropertyDefault(name);
		localname = ConnDict->GetLocalizedName(name);
		isRequired = ConnDict->IsPropertyRequired(name);
		isProtected = ConnDict->IsPropertyProtected(name);
		isFilename = ConnDict->IsPropertyFileName(name);
		isFilepath = ConnDict->IsPropertyFilePath(name);
		isDatastorename = ConnDict->IsPropertyDatastoreName(name);
		isEnumerable = ConnDict->IsPropertyEnumerable(name);

		std::cout << "Ãû³Æ£º\t\t" << name
				<< "\nĬÈÏÖµ£º\t" <<  defaultVal
				<< "\n±¾µØÃû³Æ£º\t" <<  WcharToString(localname)
				<< "\n±ØÐ裺\t\t" <<  (isRequired?"ÊÇ":"·ñ")
				<< "\n±£»¤£º\t\t" <<  (isProtected?"ÊÇ":"·ñ")
				<< "\nÎļþ£º\t\t" <<  (isFilename?"ÊÇ":"·ñ")
				<< "\n·¾¶£º\t\t" <<  (isFilepath?"ÊÇ":"·ñ")
				<< "\nÊý¾Ý¿âÃû£º\t" <<  (isDatastorename?"ÊÇ":"·ñ")
				<< "\nÁо٣º\t\t" <<  (isEnumerable?"ÊÇ":"·ñ")

				<< std::endl;

		if (isEnumerable)
		{
			if (isRequired)
			{
				enumNames = ConnDict->EnumeratePropertyValues(name, enumCount);
				for(int j = 0; j < enumCount; j++)
				{
					enumName = enumNames[j];
					std::cout << "ÁоÙÃû³Æ£º" << enumName;
				}
				std::cout << std::endl;
			}
		}

	}

	ConnDict->SetProperty(_T("DataSource"), _T("c:\\world.sdb"));

	FdoConnectionState state = fdoConnection->Open();

	std::cout << "\n>>>>>>>>>>>>>>>>>>>>>>>>>>¿ªÊ¼Ö´ÐÐSelectÃüÁî\n";

	FdoPtr<FdoISelect> sampleSelect;
	sampleSelect = (FdoISelect *)fdoConnection->CreateCommand(FdoCommandType_Select);

	sampleSelect->SetFeatureClassName(L"SampleFeatureClass");

	// ½¨Á¢Ò»¸ö¹ýÂËÆ÷
	FdoPtr<FdoIdentifier> queryPropertyName;
	queryPropertyName = FdoIdentifier::Create(L"SampleIdentityDataProperty");

	// 2. ½¨Á¢FdoDataValue
	FdoPtr<FdoDataValue> queryPropertyValue;
	queryPropertyValue = FdoDataValue::Create(101);
	// 3. µ÷Óà FdoComparisonCondition::Create() ½¨Á¢±È½Ï¹ýÂËÌõ¼þ

	FdoPtr<FdoFilter> filter;
	filter = FdoComparisonCondition::Create(queryPropertyName, FdoComparisonOperations_EqualTo, queryPropertyValue);
	sampleSelect->SetFilter(filter);
	// Ö´ÐвéѯÃüÁî
	FdoPtr<FdoIFeatureReader> queryResults;
	queryResults = sampleSelect->Execute();

	FdoPtr<FdoClassDefinition> classDef;
	FdoPtr<FdoPropertyDefinitionCollection> properties;
	FdoInt32 numProperties = 0;
	FdoPropertyDefinition * propertyDef;
	FdoPropertyType propertyType;
	FdoDataType dataType;
	FdoDataPropertyDefinition * dataPropertyDef;
	FdoString * propertyName = NULL;
	FdoPtr<FdoByteArray> byteArray;
	FdoIGeometry * geometry = NULL;
	FdoGeometryType geometryType = FdoGeometryType_None;
	FdoILineString * linestring = NULL;
	FdoIDirectPosition * position = NULL;
	FdoInt32 dimensionality = FdoDimensionality_XY;
	FdoInt32 numPositions = 0;
	FdoInt32 numInteriorRings = 0;

	// Ñ»·¶Á³ö¼¸ºÎºÍÊý¾ÝÊôÐÔÐÅÏ¢
	while (queryResults->ReadNext())
	{
		classDef = queryResults->GetClassDefinition();
		properties = classDef->GetProperties();

		numProperties = properties->GetCount();
		for(int i = 0; i < numProperties; i++)
		{
			propertyDef = properties->GetItem(i);
			propertyName = propertyDef->GetName();
			propertyType = propertyDef->GetPropertyType();
			std::cout << "Êý¾ÝÊôÐÔÃû³Æ£º" <<  WcharToString(propertyName);
			switch (propertyType)
			{
			case FdoPropertyType_DataProperty:
				dataPropertyDef = dynamic_cast<FdoDataPropertyDefinition *> (propertyDef);
				dataType = dataPropertyDef->GetDataType();
				switch (dataType)
				{
				case FdoDataType_Boolean:
					break;
				case FdoDataType_Int32:
					std::cout << "\tÊý¾ÝÀàÐÍ£ºInt32" << "\t\tÖµ£º" << queryResults->GetInt32(propertyName) << std::endl;
					break;
				case FdoDataType_String:
					std::cout << "\tÊý¾ÝÀàÐÍ£º×Ö·û´®" << "\tÖµ£º" << WcharToString(queryResults->GetString(propertyName)) << std::endl;
					break;
				default:
					break;
				}
				break;
			case FdoPropertyType_GeometricProperty:
				{
					FdoFgfGeometryFactory * geometryFactory = FdoFgfGeometryFactory::GetInstance();
					byteArray = queryResults->GetGeometry(propertyName);
					geometry = geometryFactory->CreateGeometryFromFgf (byteArray);
					geometryType = geometry->GetDerivedType();

					switch (geometryType)
					{
						case FdoGeometryType_None:
							break;
						case FdoGeometryType_Point:
							std::cout << "\t¼¸ºÎÊôÐÔÀàÐÍ£ºµã\n" ;
							break;
						case FdoGeometryType_LineString:
							std::cout << "\t¼¸ºÎÊôÐÔÀàÐÍ£ºÏß" ;

							linestring = dynamic_cast<FdoILineString *>(geometry);
							numPositions = linestring->GetCount();

							std::cout << "\t¹²ÓÐ" <<  numPositions << "µã\n";
							double X, Y, Z, M;
							Z = M = 0;

							for(int i = 0; i < numPositions; i++)
							{
								position = linestring->GetItem(i);
								if (dimensionality & FdoDimensionality_Z && dimensionality & FdoDimensionality_M)
								{
									X = position->GetX();
									Y = position->GetY();
									Z = position->GetZ();
									M = position->GetM();

								}
								else if (dimensionality & FdoDimensionality_Z && !(dimensionality & FdoDimensionality_M))
								{
									X = position->GetX();
									Y = position->GetY();
									Z = position->GetZ();
								}
								else
								{
									X = position->GetX();
									Y = position->GetY();
								}

								std::cout << "X=" << X << "\tY=" << Y << "\tZ=" << Z << "\n";
							}
							break;
						case FdoGeometryType_Polygon:
							std::cout << "\t¼¸ºÎÊôÐÔÀàÐÍ£ºÃæ\n" ;
							break;
						case FdoGeometryType_MultiPoint:
							break;
						case FdoGeometryType_MultiLineString:
							break;
						case FdoGeometryType_MultiPolygon:
							break;
						case FdoGeometryType_MultiGeometry:
							break;
						case FdoGeometryType_CurveString:
							break;
						case FdoGeometryType_CurvePolygon:
							break;
						case FdoGeometryType_MultiCurveString:
							break;
						case FdoGeometryType_MultiCurvePolygon:
							break;
						default:
							break;
					}
				}

			}
		}
	}
	std::cout << "<<<<<<<<<<<<<<<<<<<<<<<<<<½áÊøÖ´ÐÐSelectÃüÁî\n";

	return 0;
}

*/

int _tmain()
{
	try
	{
		std::wstring provider(L"SuperMap.SuperMap SDX.1.0");

		// Create connection
		FdoPtr<FdoIConnection> conn = fdoutility::create_connection(provider);

		// Connection string with datastore specified
		FdoPtr<FdoIConnectionInfo> info = conn->GetConnectionInfo();

		FdoPtr<FdoIConnectionPropertyDictionary> ConnDict = info->GetConnectionProperties();

		//ConnDict->SetProperty(_T("DataSource"), _T("type=sql;server=192.168.1.76;database=test1;user=fdo;password=fdo;IsImage=false"));
		ConnDict->SetProperty(_T("DataSource"), _T("type=sdb;database=C:\\sdbguass.sdb;IsImage=false"));

		// Open connection
		FdoConnectionState state = conn->Open();

		std::wcout <<  "FdoIConnection::Open()\n";
		std::wcout <<  " State: " << conn->GetConnectionState() << std::endl;

		// Close connection (usually optional)
		conn->Close();

		std::wcout <<  "FdoIConnection::Close()\n";
		std::wcout <<  " State: " << conn->GetConnectionState() << std::endl;
	}
	catch (FdoException* ex)
	{
		std::wcout << L"*** FDO Error:\n";
		int i = 5;
		FdoException* nex = ex;
		while (nex)
		{
			const wchar_t* msg = nex->GetExceptionMessage();
			if (NULL == msg)
			{
				msg = L"NO MESSAGE";
			}
			std::wcout << std::setw(++i) << L"*** " << msg << std::endl;
			nex = nex->GetCause();
		}
		ex->Release();
	}
	catch(std::exception& ex)
	{
		std::cout << "*** Std Error: " << ex.what() << std::endl;
	}
	catch(...)
	{
		std::cout << "*** Undefined error!\n" << std::endl;
	}
	return 0;
}


text:
class GFontManagerImplementLinux : public GFontManager
{
public:
    GFontManagerImplementLinux(unsigned w, unsigned h);

    virtual ~GFontManagerImplementLinux()
    {
        delete mFontCache;
    };

    void DrawText(const unsigned short *text, unsigned int text_length, float x, float y,
                  bool isStroke, GCanvasContext *context, float scaleX = 1, float scaleY = 1) override;

    float MeasureText(const char *text, unsigned int text_length, gcanvas::GFontStyle *fontStyle) override;

    //空实现
    float *MeasureTextExt(const char *text, unsigned int text_length, gcanvas::GFontStyle *fontStyle) override
    {
        return nullptr;
    }

    //空实现
    float *PreMeasureTextHeight(const char *text, unsigned int text_length, GCanvasContext *context) override
    {
        return nullptr;
    }

    GTexture *GetOrCreateFontTexture() override;

private:
    void AdjustTextPenPoint(GCanvasContext *context, const std::vector<GFont *> &font,
                            const unsigned short *text,
                            unsigned int textLength,
                            bool isStroke,
                            float &x, float &y, float sx, float sy);

    GFont *GetFontByCharCode(wchar_t charCode, gcanvas::GFontStyle *fontStyle);

    void DrawTextInternal(GCanvasContext *context, GFont *font, bool isStroke, wchar_t text,
                          float &x, float y, float sx, float sy);
    GFontCache *mFontCache = nullptr;
};

redpajama_set_name: RedPajamaGithub


text:
<!doctype html>

  <meta charset="utf-8">
  <title>Basic Carousel</title>
  <link rel="canonical" href="amps.html" >
  <meta name="viewport" content="width=device-width,minimum-scale=1,initial-scale=1">

Grouping 3 items at a time, with looping

  <amp-base-carousel id="carousel-1" width="9" height="2" layout="responsive" loop="true" visible-count="3" snap-align="center">
    <amp-img class="slide" src="./img/redgradient.png" layout="flex-item"></amp-img>
    <amp-img class="slide" src="./img/greengradient.png" layout="flex-item"></amp-img>
    <amp-img class="slide" src="./img/bluegradient.png" layout="flex-item"></amp-img>
    <amp-img class="slide" src="./img/orangegradient.png" layout="flex-item"></amp-img>
    <amp-img class="slide" src="./img/tealgradient.png" layout="flex-item"></amp-img>
    <amp-img class="slide" src="./img/lemonyellowgradient.png" layout="flex-item"></amp-img>
    <amp-img class="slide" src="./img/lilacgradient.png" layout="flex-item"></amp-img>
  </amp-base-carousel>


text:
from django.conf.urls import patterns, url
from django.contrib.auth.decorators import login_required
from . import views

urlpatterns = patterns(
    '',
    url(r'^$', login_required(views.{{ cookiecutter.model_name }}List.as_view()), name='{{ cookiecutter.model_name|lower }}_list'),
    url(r'^add/$', login_required(views.{{ cookiecutter.model_name }}Create.as_view()), name='{{ cookiecutter.model_name|lower }}_create'),
    url(r'^(?P<pk>[\d]+)/$', login_required(views.{{ cookiecutter.model_name }}Detail.as_view()), name='{{ cookiecutter.model_name|lower }}_detail'),
    url(r'^(?P<pk>[\d]+)/edit/$', login_required(views.{{ cookiecutter.model_name }}Update.as_view()), name='{{ cookiecutter.model_name|lower }}_update'),
    url(r'^(?P<pk>[\d]+)/delete/$', login_required(views.{{ cookiecutter.model_name }}Delete.as_view()), name='{{ cookiecutter.model_name|lower }}_delete'),
)


text:
using Playblack.Sequencer;
using PlayBlack.Editor.Windows;
using UnityEditor;
using UnityEngine;

namespace PlayBlack.Editor.Sequencer {

    [CustomEditor(typeof(SequenceExecutor))]
    public class SequencerInspector : UnityEditor.Editor {

        public override void OnInspectorGUI() {
            if (target == null) {
                return;
            }
            base.OnInspectorGUI();
            SequenceExecutor sequencer = target as SequenceExecutor;

            if (GUILayout.Button("Open Sequencer Settings")) {
                var window = GenericPopupWindow.Popup<SequencerEditorWindow>();
                window.SetData(sequencer, this.serializedObject);
            }
        }
    }
}


text:
.boxel-validation-state-input-group {
  --input-height: 2.5rem;
  --input-icon-size: var(--boxel-icon-sm);
  --input-icon-space: var(--boxel-sp-xs);

  position: relative;
  width: 100%;
  font-family: var(--boxel-font-family);
  line-height: calc(27 / 20);
  letter-spacing: var(--boxel-lsp-xs);
}

.boxel-validation-state-input-group__input {
  height: var(--input-height);
  padding-right: calc(var(--input-icon-size) + var(--input-icon-space) * 2);
  font: inherit;
  letter-spacing: inherit;
}

.boxel-validation-state-input-group__icon {
  position: absolute;
  width: var(--input-icon-size);
  height: var(--input-height);
  right: var(--input-icon-space);
  top: 0;
  user-select: none;
}


text:
/* Copyright  (c) 2002 Graz University of Technology. All rights reserved.
 *
 * Redistribution and use in  source and binary forms, with or without
 * modification, are permitted  provided that the following conditions are met:
 *
 * 1. Redistributions of  source code must retain the above copyright notice,
 *    this list of conditions and the following disclaimer.
 *
 * 2. Redistributions in  binary form must reproduce the above copyright notice,
 *    this list of conditions and the following disclaimer in the documentation
 *    and/or other materials provided with the distribution.
 *
 * 3. The end-user documentation included with the redistribution, if any, must
 *    include the following acknowledgment:
 *
 *    "This product includes software developed by IAIK of Graz University of
 *     Technology."
 *
 *    Alternately, this acknowledgment may appear in the software itself, if
 *    and wherever such third-party acknowledgments normally appear.
 *
 * 4. The names "Graz University of Technology" and "IAIK of Graz University of
 *    Technology" must not be used to endorse or promote products derived from
 *    this software without prior written permission.
 *
 * 5. Products derived from this software may not be called
 *    "IAIK PKCS Wrapper", nor may "IAIK" appear in their name, without prior
 *    written permission of Graz University of Technology.
 *
 *  THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED
 *  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
 *  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
 *  PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE LICENSOR BE
 *  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
 *  OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
 *  PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
 *  OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
 *  ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
 *  OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
 *  OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 *  POSSIBILITY  OF SUCH DAMAGE.
 */

package sun.security.pkcs11.wrapper;

/**
 * class CK_VERSION describes the version of a Cryptoki interface, a Cryptoki
 * library, or an SSL implementation, or the hardware or firmware version of a
 * slot or token.

 * PKCS#11 structure:
 *

 * typedef struct CK_VERSION {
 *   CK_BYTE major;
 *   CK_BYTE minor;
 * } CK_VERSION;
 *

 *
 * @author Karl Scheibelhofer <Karl.Scheibelhofer@iaik.at>
 * @author Martin Schlaeffer <schlaeff@sbox.tugraz.at>
 */
public class CK_VERSION {

    /**
     * PKCS#11:
     *

     *   CK_BYTE major;
     *

     */
    public byte major;  /* integer portion of version number */

    /**
     * PKCS#11:
     *

     *   CK_BYTE minor;
     *

     */
    public byte minor;  /* 1/100ths portion of version number */

    public CK_VERSION(int major, int minor) {
        this.major = (byte)major;
        this.minor = (byte)minor;
    }

    /**
     * Returns the string representation of CK_VERSION.
     *
     * @return the string representation of CK_VERSION
     */
    public String toString() {
        StringBuilder buffer = new StringBuilder();

        buffer.append(major & 0xff);
        buffer.append('.');
        int m = minor & 0xff;
        if (m < 10) {
            buffer.append('0');
        }
        buffer.append(m);

        return buffer.toString();
    }

}


text:
/**
 * This code is for dealing with adding and removing collections
 * in the workspace.
 */
YAHOO.namespace("ur.public.home");

YAHOO.ur.public.home =
{
    /*
     * Get the picture
     *
     * currentLocation = location of the current picture
     * type = INIT for initial load
     *         NEXT for next picture
     *         PREV for previous picture
     */
    getRepositoryPicture : function(currentLocation, type)
    {

        // action for getting the picture
        var getRepositoryPictureAction =  basePath + 'nextRepositoryPicture.action';

        // Success action on getting the picture
        var handleSuccess = function(o)
        {
			// check for the timeout - forward user to login page if timout
	        // occured
	        if( !urUtil.checkTimeOut(o.responseText) )
	        {
                var divToUpdate = document.getElementById('repository_picture');
                divToUpdate.innerHTML = o.responseText;
            }
        };

        //Faiure action on getting a picture
        var handleFailure = function(o)
	    {
        	// supress if user tries to move away from the picture before loading
	        if( o.status != 0 )
	        {
	            alert('Could not get picture '
	                + o.status + ' status text ' + o.statusText );
	        }
	    };

	    // Get the next picture
        var transaction = YAHOO.util.Connect.asyncRequest('GET',
            getRepositoryPictureAction +"?currentRepositoryPictureLocation="+
            currentLocation +'&type='+ type +'&bustcache='+new Date().getTime(),
            {success: handleSuccess, failure: handleFailure}, null);
    },

    /*
     * Get the news information
     *
     * currentLocation = location of the current picture
     * type = INIT for initial load
     *         NEXT for next news item
     *         PREV for previous news item
     * numNewsItemsToGet = number of news item to retrieve at once
     */
    getNewsItems : function(currentLocation, type)
    {
       // action for getting the picture
       var getNewsAction =  basePath + 'getNewsItems.action';

       //Success action on getting the news item
       var handleSuccess = function(o)
       {
			// check for the timeout - forward user to login page if timout
	        // occured
	        if( !urUtil.checkTimeOut(o.responseText) )
	        {
                var divToUpdate = document.getElementById('news_items');
                divToUpdate.innerHTML = o.responseText;
            }
       };

       //Faiure action on getting the news item
       var handleFailure = function(o)
	   {
	       if( o.status != 0 )
	       {
	            alert('Could not get news '
	            + o.status + ' status text ' + o.statusText );
	       }
	   };

	   // get the next news item
       var transaction = YAHOO.util.Connect.asyncRequest('GET',
            getNewsAction +"?currentNewsItemLocation="+
            currentLocation +'&type='+ type +
            '&bustcache='+new Date().getTime(),
            {success: handleSuccess, failure: handleFailure}, null);
    },

    /**
     * Get the next set of researcher pages
     */
    getResearcherPicture : function(currentLocation, type)
    {
        // action for getting the researcher information
        var getResearcherPictureAction =  basePath + 'nextResearcherPicture.action';

        // Success action on getting the researcher information
        var handleSuccess = function(o)
        {
			// check for the timeout - forward user to login page if timout
	        // occured
	        if( !urUtil.checkTimeOut(o.responseText) )
	        {
                var divToUpdate = document.getElementById('researcher_picture');
                divToUpdate.innerHTML = o.responseText;
            }
        };

        //Failure action on getting a picture
        var handleFailure = function(o)
	    {
	        // prevents failure on page refresh
	    	if( o.status != 0 )
	        {
	            alert('Could not get researcher picture '
	                + o.status + ' status text ' + o.statusText );
	        }
	    };

	    //  Get the next picture
        var transaction = YAHOO.util.Connect.asyncRequest('GET',
            getResearcherPictureAction +"?currentResearcherLocation="+
            currentLocation +'&type='+ type +'&bustcache='+new Date().getTime(),
        {success: handleSuccess, failure: handleFailure}, null);
    }

};


text:
import app from '@wq/app';
import material from '@wq/material';
import mapgl from '@wq/map-gl';
import modules from './modules';
import version from './version';

app.use([material, mapgl]);

export default app;

export { modules, version };


text:
package com.adaptris.core;

import java.util.UUID;

import javax.jms.ConnectionFactory;
import javax.jms.JMSException;

import com.adaptris.core.jms.MockJmsConnection;
import com.adaptris.core.jms.MockNoOpConnectionErrorHandler;
import com.adaptris.core.jms.UrlVendorImplementation;

public class ChannelTest extends ExampleChannelCase {

  private static final String DUP_CEH_MESSAGE =
      "This channel has been configured with 2 ErrorHandlers that are incompatible with each other";
  private StandardWorkflow workflow;
  private AdaptrisMessageConsumer consumer;
  private AdaptrisMessageProducer producer;

  public ChannelTest(java.lang.String testName) {
    super(testName);
  }

  @Override
  protected Object retrieveObjectForSampleConfig() {
    ChannelList cl = new ChannelList();
    Channel c = new Channel();
    try {
      c.setUniqueId(UUID.randomUUID().toString());
      c.getWorkflowList().add(createDefaultWorkflow());
      c.getWorkflowList().add(configureWorkflow(new PoolingWorkflow()));
      cl.addChannel(c);
    } catch (CoreException e) {
      throw new RuntimeException(e);
    }
    return cl;
  }

  @Override
  protected String createBaseFileName(Object object) {
    return Channel.class.getName();
  }

  public void testLifecycle_Init() throws Exception {
    Channel c = new Channel();
    c.getWorkflowList().add(createDefaultWorkflow());
    c.requestInit();
    assertEquals(InitialisedState.getInstance(), c.retrieveComponentState());
  }

  public void testLifecycle_Start() throws Exception {
    Channel c = new Channel();
    c.getWorkflowList().add(createDefaultWorkflow());
    c.requestStart();
    assertEquals(StartedState.getInstance(), c.retrieveComponentState());

  }

  public void testLifecycle_Stop() throws Exception {
    Channel c = new Channel();
    c.getWorkflowList().add(createDefaultWorkflow());
    c.requestStart();
    c.requestStop();
    assertEquals(StoppedState.getInstance(), c.retrieveComponentState());

  }

  public void testLifecycle_Close() throws Exception {
    Channel c = new Channel();
    c.getWorkflowList().add(createDefaultWorkflow());
    c.requestStart();
    c.requestClose();
    assertEquals(ClosedState.getInstance(), c.retrieveComponentState());
  }

  public void testChannel_StateManagedComponentContainerInit() throws Exception {
    Channel channel = new Channel();
    Workflow workflow = createDefaultWorkflow();
    channel.getWorkflowList().add(workflow);
    channel.requestInit();
    workflow.requestClose();
    assertEquals(ClosedState.getInstance(), workflow.retrieveComponentState());
    assertEquals(InitialisedState.getInstance(), channel.retrieveComponentState());
    // This should reinitialise the workflow.
    channel.requestInit();
    assertEquals(InitialisedState.getInstance(), workflow.retrieveComponentState());
  }

  public void testChannel_StateManagedComponentContainerStart() throws Exception {
    Channel channel = new Channel();
    Workflow workflow = createDefaultWorkflow();
    channel.getWorkflowList().add(workflow);
    channel.requestStart();
    workflow.requestClose();
    assertEquals(ClosedState.getInstance(), workflow.retrieveComponentState());
    assertEquals(StartedState.getInstance(), channel.retrieveComponentState());
    // This should restart the workflow.
    channel.requestStart();
    assertEquals(StartedState.getInstance(), workflow.retrieveComponentState());
  }

  public void testChannel_StateManagedComponentContainerStop() throws Exception {
    Channel channel = new Channel();
    Workflow workflow = createDefaultWorkflow();
    channel.getWorkflowList().add(workflow);
    channel.requestStart();
    channel.requestStop();
    workflow.requestStart();
    assertEquals(StartedState.getInstance(), workflow.retrieveComponentState());
    assertEquals(StoppedState.getInstance(), channel.retrieveComponentState());
    // This should stop the workflow.
    channel.requestStop();
    assertEquals(StoppedState.getInstance(), workflow.retrieveComponentState());
  }

  public void testChannel_StateManagedComponentContainerClose() throws Exception {
    Channel channel = new Channel();
    Workflow workflow = createDefaultWorkflow();
    channel.getWorkflowList().add(workflow);
    channel.requestStart();
    workflow.requestClose();
    assertEquals(ClosedState.getInstance(), workflow.retrieveComponentState());
    assertEquals(StartedState.getInstance(), channel.retrieveComponentState());
    // This should stop the workflow.
    channel.requestStart();
    assertEquals(StartedState.getInstance(), workflow.retrieveComponentState());
  }

  public void testSetConsumeConnection() {
    Channel c = new Channel();
    NullConnection conn = new NullConnection();
    c.setConsumeConnection(conn);
    assertEquals(conn, c.getConsumeConnection());
    try {
      c.setConsumeConnection(null);
      fail();
    } catch (IllegalArgumentException expected) {

    }
    assertEquals(conn, c.getConsumeConnection());
  }

  public void testSetProduceConnection() {
    Channel c = new Channel();
    NullConnection conn = new NullConnection();
    c.setProduceConnection(conn);
    assertEquals(conn, c.getProduceConnection());
    try {
      c.setProduceConnection(null);
      fail();
    } catch (IllegalArgumentException expected) {

    }
    assertEquals(conn, c.getProduceConnection());
  }

  public void testSetMessageErrorHandler() {
    Channel c = new Channel();
    ProcessingExceptionHandler obj = new StandardProcessingExceptionHandler();
    c.setMessageErrorHandler(obj);
    assertEquals(obj, c.getMessageErrorHandler());
    try {
      c.setMessageErrorHandler(null);
      fail();
    } catch (IllegalArgumentException expected) {

    }
    assertEquals(obj, c.getMessageErrorHandler());
  }

  public void testRegisterMessageErrorHandler() {
    Channel c = new Channel();
    ProcessingExceptionHandler obj = new StandardProcessingExceptionHandler();
    c.registerActiveMsgErrorHandler(obj);
    assertNotSame(obj, c.getMessageErrorHandler());
    assertEquals(obj, c.retrieveActiveMsgErrorHandler());
    try {
      c.registerActiveMsgErrorHandler(null);
      fail();
    } catch (IllegalArgumentException expected) {

    }
    assertNotSame(obj, c.getMessageErrorHandler());
    assertEquals(obj, c.retrieveActiveMsgErrorHandler());
  }

  public void testSetWorkflowList() {
    Channel c = new Channel();
    WorkflowList wl = new WorkflowList();
    c.setWorkflowList(wl);
    assertEquals(wl, c.getWorkflowList());
    try {
      c.setWorkflowList(null);
      fail();
    } catch (IllegalArgumentException expected) {

    }
    assertEquals(wl, c.getWorkflowList());
  }

  public void testBackReferences() throws Exception {
    Channel channel = new Channel();
    NullConnection consConn = new NullConnection();
    channel.setConsumeConnection(consConn);
    assertEquals(consConn, channel.getConsumeConnection());
    assertEquals(0, consConn.retrieveExceptionListeners().size());

    NullConnection prodConn = new NullConnection();
    channel.setProduceConnection(prodConn);
    assertEquals(prodConn, channel.getProduceConnection());
    assertEquals(0, prodConn.retrieveExceptionListeners().size());

    // Now marshall and see if it's the same.
    XStreamMarshaller m = new XStreamMarshaller();
    String xml = m.marshal(channel);
    Channel channel2 = (Channel) m.unmarshal(xml);
    // If the setter has been used, then these two will be "true"
    // The above line is now not true! We have removed behaviour from the setters and is now done in
    // the prepare.
    // So the back refs are no longer created in the setConsumeConnection/setProduceConnection.
    // assertEquals(1, channel2.getConsumeConnection().retrieveExceptionListeners().size());
    // assertTrue(channel2 ==
    // channel2.getConsumeConnection().retrieveExceptionListeners().toArray()[0]);
    //
    // assertEquals(1, channel2.getProduceConnection().retrieveExceptionListeners().size());
    // assertTrue(channel2 ==
    // channel2.getProduceConnection().retrieveExceptionListeners().toArray()[0]);

    // So let's make sure that there is no behaviour in the setters!
    assertEquals(0, channel2.getConsumeConnection().retrieveExceptionListeners().size());
    assertEquals(0, channel2.getProduceConnection().retrieveExceptionListeners().size());

    // Now if we call the prepare method, let's see if our back refs have been set correctly;
    channel2.prepare();

    assertEquals(1, channel2.getConsumeConnection().retrieveExceptionListeners().size());
    assertEquals(1, channel2.getProduceConnection().retrieveExceptionListeners().size());
  }

  public void testConnectionEqualityCheck2DifferentConnections() throws Exception {
    Channel channel = new Channel();

    MockJmsConnection produceConnection = createMockJmsConnection(null, "broker1");
    MockJmsConnection consumeConnection = createMockJmsConnection(null, "broker2");

    channel.setConsumeConnection(consumeConnection);
    channel.setProduceConnection(produceConnection);

    consumeConnection.init();
    produceConnection.init();

    channel.init();
  }

  public void testConnectionEqualityCheck2ConnectionsToSameBroker() throws Exception {
    Channel channel = new Channel();

    MockJmsConnection produceConnection = createMockJmsConnection(null, "broker1");
    MockJmsConnection consumeConnection = createMockJmsConnection(null, "broker1");

    channel.setConsumeConnection(consumeConnection);
    channel.setProduceConnection(produceConnection);

    try {
      channel.init();
      fail("Should fail, 2 identical connections with error handlers");
    } catch (CoreException ex) {
      assertEquals(DUP_CEH_MESSAGE, ex.getMessage());
    }
  }

  public void testConnectionEqualityCheck_SharedConnectionSameBroker() throws Exception {
    Adapter adapter = new Adapter();
    adapter.setUniqueId(getName());
    Channel channel = new Channel();

    adapter.getSharedComponents().addConnection(createMockJmsConnection(getName(), "b1"));
    SharedConnection consumeConnection = new SharedConnection(getName());
    SharedConnection produceConnection = new SharedConnection(getName());

    channel.setConsumeConnection(consumeConnection);
    channel.setProduceConnection(produceConnection);
    adapter.getChannelList().add(channel);
    try {
      adapter.requestInit();
    } finally {
      adapter.requestClose();
    }
  }

  public void testConnectionEqualityCheck_MultipleSharedConnections() throws Exception {

    Adapter adapter = new Adapter();
    adapter.setUniqueId(getName());
    Channel channel = new Channel();

    adapter.getSharedComponents().addConnection(createMockJmsConnection(getName(), "b1"));
    adapter.getSharedComponents().addConnection(createMockJmsConnection(getName() + "2", "b2"));

    SharedConnection consumeConnection = new SharedConnection(getName());
    SharedConnection produceConnection = new SharedConnection(getName() + "2");

    channel.setConsumeConnection(consumeConnection);
    channel.setProduceConnection(produceConnection);
    adapter.getChannelList().add(channel);
    try {
      adapter.requestInit();
    } finally {
      adapter.requestClose();
    }
  }

  public void testConnectionEqualityCheck_MultipleSharedConnections_SameBroker() throws Exception {
    Adapter adapter = new Adapter();
    adapter.setUniqueId(getName());
    Channel channel = new Channel();

    adapter.getSharedComponents().addConnection(createMockJmsConnection(getName(), "b1"));
    adapter.getSharedComponents().addConnection(createMockJmsConnection(getName() + "2", "b1"));

    SharedConnection consumeConnection = new SharedConnection(getName());
    SharedConnection produceConnection = new SharedConnection(getName() + "2");

    channel.setConsumeConnection(consumeConnection);
    channel.setProduceConnection(produceConnection);
    adapter.getChannelList().add(channel);
    try {
      adapter.requestInit();
      fail("Should fail, 2 identical connections with error handlers");
    } catch (CoreException expected) {
      assertEquals(DUP_CEH_MESSAGE, expected.getMessage());
    } finally {
      adapter.requestClose();
    }
  }

  public void testConnectionEqualityCheckSameConnectionInstances() throws Exception {
    Channel channel = new Channel();

    MockJmsConnection connection = createMockJmsConnection(null, "broker1");

    channel.setConsumeConnection(connection);
    channel.setProduceConnection(connection);

    channel.init();
  }

  public void testHasUniqueId() {
    Channel c = new Channel();
    assertEquals(false, c.hasUniqueId());
    c.setUniqueId("");
    assertEquals(false, c.hasUniqueId());
    c.setUniqueId("unique-id");
    assertEquals(true, c.hasUniqueId());
  }

  private MockJmsConnection createMockJmsConnection(String uid, String brokerUrl) {
    MockJmsConnection connection = new MockJmsConnection();
    if (uid != null)
      connection.setUniqueId(uid);
    UrlVendorImplementation vendorImp = new UrlVendorImplementation() {
      public ConnectionFactory createConnectionFactory() throws JMSException {
        return null;
      }
    };
    vendorImp.setBrokerUrl(brokerUrl);
    connection.setVendorImplementation(vendorImp);
    connection.setConnectionErrorHandler(new MockNoOpConnectionErrorHandler());
    return connection;
  }
}


text:
package graphql.sql.web;

import java.util.Collections;
import java.util.Map;

public class RelayRequest {
    private String query;

    private String operationName;

    private Map<String, Object> variables = Collections.emptyMap();

    public String getQuery() {
        return query;
    }

    public void setQuery(String query) {
        this.query = query;
    }

    public String getOperationName() {
        return operationName;
    }

    public void setOperationName(String operationName) {
        this.operationName = operationName;
    }

    public Map<String, Object> getVariables() {
        return variables;
    }

    public void setVariables(Map<String, Object> variables) {
        this.variables = variables;
    }
}


text:
#include "talk/base/fakesslidentity.h"
#include "talk/base/gunit.h"
#include "talk/base/thread.h"
#include "talk/p2p/base/constants.h"
#include "talk/p2p/base/fakesession.h"
#include "talk/p2p/base/parsing.h"
#include "talk/p2p/base/p2ptransport.h"
#include "talk/p2p/base/rawtransport.h"
#include "talk/p2p/base/sessionmessages.h"
#include "talk/xmllite/xmlelement.h"
#include "talk/xmpp/constants.h"

using cricket::Candidate;
using cricket::Candidates;
using cricket::Transport;
using cricket::FakeTransport;
using cricket::TransportChannel;
using cricket::FakeTransportChannel;
using cricket::IceRole;
using cricket::TransportDescription;
using cricket::WriteError;
using cricket::ParseError;
using talk_base::SocketAddress;

static const char kIceUfrag1[] = "TESTICEUFRAG0001";
static const char kIcePwd1[] = "TESTICEPWD00000000000001";

class TransportTest : public testing::Test,
                      public sigslot::has_slots<> {
 public:
  TransportTest()
      : thread_(talk_base::Thread::Current()),
        transport_(new FakeTransport(
            thread_, thread_, "test content name", NULL)),
        channel_(NULL),
        connecting_signalled_(false) {
    transport_->SignalConnecting.connect(this, &TransportTest::OnConnecting);
  }
  ~TransportTest() {
    transport_->DestroyAllChannels();
  }
  bool SetupChannel() {
    channel_ = CreateChannel(1);
    return (channel_ != NULL);
  }
  FakeTransportChannel* CreateChannel(int component) {
    return static_cast<FakeTransportChannel*>(
        transport_->CreateChannel(component));
  }
  void DestroyChannel() {
    transport_->DestroyChannel(1);
    channel_ = NULL;
  }

 protected:
  void OnConnecting(Transport* transport) {
    connecting_signalled_ = true;
  }

  talk_base::Thread* thread_;
  talk_base::scoped_ptr<FakeTransport> transport_;
  FakeTransportChannel* channel_;
  bool connecting_signalled_;
};

class FakeCandidateTranslator : public cricket::CandidateTranslator {
 public:
  void AddMapping(int component, const std::string& channel_name) {
    name_to_component[channel_name] = component;
    component_to_name[component] = channel_name;
  }

  bool GetChannelNameFromComponent(
      int component, std::string* channel_name) const {
    if (component_to_name.find(component) == component_to_name.end()) {
      return false;
    }
    *channel_name = component_to_name.find(component)->second;
    return true;
  }
  bool GetComponentFromChannelName(
      const std::string& channel_name, int* component) const {
    if (name_to_component.find(channel_name) == name_to_component.end()) {
      return false;
    }
    *component = name_to_component.find(channel_name)->second;
    return true;
  }

  std::map<std::string, int> name_to_component;
  std::map<int, std::string> component_to_name;
};

// Test that calling ConnectChannels triggers an OnConnecting signal.
TEST_F(TransportTest, TestConnectChannelsDoesSignal) {
  EXPECT_TRUE(SetupChannel());
  transport_->ConnectChannels();
  EXPECT_FALSE(connecting_signalled_);

  EXPECT_TRUE_WAIT(connecting_signalled_, 100);
}

// Test that DestroyAllChannels kills any pending OnConnecting signals.
TEST_F(TransportTest, TestDestroyAllClearsPosts) {
  EXPECT_TRUE(transport_->CreateChannel(1) != NULL);

  transport_->ConnectChannels();
  transport_->DestroyAllChannels();

  thread_->ProcessMessages(0);
  EXPECT_FALSE(connecting_signalled_);
}

// This test verifies channels are created with proper ICE
// role, tiebreaker and remote ice mode and credentials after offer and
// answer negotiations.
TEST_F(TransportTest, TestChannelIceParameters) {
  transport_->SetIceRole(cricket::ICEROLE_CONTROLLING);
  transport_->SetIceTiebreaker(99U);
  cricket::TransportDescription local_desc(
      cricket::NS_JINGLE_ICE_UDP, std::vector<std::string>(),
      kIceUfrag1, kIcePwd1, cricket::ICEMODE_FULL, NULL, cricket::Candidates());
  ASSERT_TRUE(transport_->SetLocalTransportDescription(local_desc,
                                                       cricket::CA_OFFER));
  EXPECT_EQ(cricket::ICEROLE_CONTROLLING, transport_->ice_role());
  EXPECT_TRUE(SetupChannel());
  EXPECT_EQ(cricket::ICEROLE_CONTROLLING, channel_->GetIceRole());
  EXPECT_EQ(cricket::ICEMODE_FULL, channel_->remote_ice_mode());
  EXPECT_EQ(kIceUfrag1, channel_->ice_ufrag());
  EXPECT_EQ(kIcePwd1, channel_->ice_pwd());

  cricket::TransportDescription remote_desc(
      cricket::NS_JINGLE_ICE_UDP, std::vector<std::string>(),
      kIceUfrag1, kIcePwd1, cricket::ICEMODE_FULL, NULL, cricket::Candidates());
  ASSERT_TRUE(transport_->SetRemoteTransportDescription(remote_desc,
                                                        cricket::CA_ANSWER));
  EXPECT_EQ(cricket::ICEROLE_CONTROLLING, channel_->GetIceRole());
  EXPECT_EQ(99U, channel_->IceTiebreaker());
  EXPECT_EQ(cricket::ICEMODE_FULL, channel_->remote_ice_mode());
  // Changing the transport role from CONTROLLING to CONTROLLED.
  transport_->SetIceRole(cricket::ICEROLE_CONTROLLED);
  EXPECT_EQ(cricket::ICEROLE_CONTROLLED, channel_->GetIceRole());
  EXPECT_EQ(cricket::ICEMODE_FULL, channel_->remote_ice_mode());
  EXPECT_EQ(kIceUfrag1, channel_->remote_ice_ufrag());
  EXPECT_EQ(kIcePwd1, channel_->remote_ice_pwd());
}

// Tests channel role is reversed after receiving ice-lite from remote.
TEST_F(TransportTest, TestSetRemoteIceLiteInOffer) {
  transport_->SetIceRole(cricket::ICEROLE_CONTROLLED);
  cricket::TransportDescription remote_desc(
      cricket::NS_JINGLE_ICE_UDP, std::vector<std::string>(),
      kIceUfrag1, kIcePwd1, cricket::ICEMODE_LITE, NULL, cricket::Candidates());
  ASSERT_TRUE(transport_->SetRemoteTransportDescription(remote_desc,
                                                        cricket::CA_OFFER));
  cricket::TransportDescription local_desc(
      cricket::NS_JINGLE_ICE_UDP, std::vector<std::string>(),
      kIceUfrag1, kIcePwd1, cricket::ICEMODE_FULL, NULL, cricket::Candidates());
  ASSERT_TRUE(transport_->SetLocalTransportDescription(local_desc,
                                                       cricket::CA_ANSWER));
  EXPECT_EQ(cricket::ICEROLE_CONTROLLING, transport_->ice_role());
  EXPECT_TRUE(SetupChannel());
  EXPECT_EQ(cricket::ICEROLE_CONTROLLING, channel_->GetIceRole());
  EXPECT_EQ(cricket::ICEMODE_LITE, channel_->remote_ice_mode());
}

// Tests ice-lite in remote answer.
TEST_F(TransportTest, TestSetRemoteIceLiteInAnswer) {
  transport_->SetIceRole(cricket::ICEROLE_CONTROLLING);
  cricket::TransportDescription local_desc(
      cricket::NS_JINGLE_ICE_UDP, std::vector<std::string>(),
      kIceUfrag1, kIcePwd1, cricket::ICEMODE_FULL, NULL, cricket::Candidates());
  ASSERT_TRUE(transport_->SetLocalTransportDescription(local_desc,
                                                       cricket::CA_OFFER));
  EXPECT_EQ(cricket::ICEROLE_CONTROLLING, transport_->ice_role());
  EXPECT_TRUE(SetupChannel());
  EXPECT_EQ(cricket::ICEROLE_CONTROLLING, channel_->GetIceRole());
  // Channels will be created in ICEFULL_MODE.
  EXPECT_EQ(cricket::ICEMODE_FULL, channel_->remote_ice_mode());
  cricket::TransportDescription remote_desc(
      cricket::NS_JINGLE_ICE_UDP, std::vector<std::string>(),
      kIceUfrag1, kIcePwd1, cricket::ICEMODE_LITE, NULL, cricket::Candidates());
  ASSERT_TRUE(transport_->SetRemoteTransportDescription(remote_desc,
                                                        cricket::CA_ANSWER));
  EXPECT_EQ(cricket::ICEROLE_CONTROLLING, channel_->GetIceRole());
  // After receiving remote description with ICEMODE_LITE, channel should
  // have mode set to ICEMODE_LITE.
  EXPECT_EQ(cricket::ICEMODE_LITE, channel_->remote_ice_mode());
}

// Tests that we can properly serialize/deserialize candidates.
TEST_F(TransportTest, TestP2PTransportWriteAndParseCandidate) {
  Candidate test_candidate(
      "", 1, "udp",
      talk_base::SocketAddress("2001:db8:fefe::1", 9999),
      738197504, "abcdef", "ghijkl", "foo", "testnet", 50, "");
  Candidate test_candidate2(
      "", 2, "tcp",
      talk_base::SocketAddress("192.168.7.1", 9999),
      1107296256, "mnopqr", "stuvwx", "bar", "testnet2", 100, "");
  talk_base::SocketAddress host_address("www.google.com", 24601);
  host_address.SetResolvedIP(talk_base::IPAddress(0x0A000001));
  Candidate test_candidate3(
      "", 3, "spdy", host_address, 1476395008, "yzabcd",
      "efghij", "baz", "testnet3", 150, "");
  WriteError write_error;
  ParseError parse_error;
  talk_base::scoped_ptr<buzz::XmlElement> elem;
  cricket::Candidate parsed_candidate;
  cricket::P2PTransportParser parser;

  FakeCandidateTranslator translator;
  translator.AddMapping(1, "test");
  translator.AddMapping(2, "test2");
  translator.AddMapping(3, "test3");

  EXPECT_TRUE(parser.WriteGingleCandidate(test_candidate, &translator,
                                          elem.accept(), &write_error));
  EXPECT_EQ("", write_error.text);
  EXPECT_EQ("test", elem->Attr(buzz::QN_NAME));
  EXPECT_EQ("udp", elem->Attr(cricket::QN_PROTOCOL));
  EXPECT_EQ("2001:db8:fefe::1", elem->Attr(cricket::QN_ADDRESS));
  EXPECT_EQ("9999", elem->Attr(cricket::QN_PORT));
  EXPECT_EQ("0.34", elem->Attr(cricket::QN_PREFERENCE));
  EXPECT_EQ("abcdef", elem->Attr(cricket::QN_USERNAME));
  EXPECT_EQ("ghijkl", elem->Attr(cricket::QN_PASSWORD));
  EXPECT_EQ("foo", elem->Attr(cricket::QN_TYPE));
  EXPECT_EQ("testnet", elem->Attr(cricket::QN_NETWORK));
  EXPECT_EQ("50", elem->Attr(cricket::QN_GENERATION));

  EXPECT_TRUE(parser.ParseGingleCandidate(elem.get(), &translator,
                                          &parsed_candidate, &parse_error));
  EXPECT_TRUE(test_candidate.IsEquivalent(parsed_candidate));

  EXPECT_TRUE(parser.WriteGingleCandidate(test_candidate2, &translator,
                                          elem.accept(), &write_error));
  EXPECT_EQ("test2", elem->Attr(buzz::QN_NAME));
  EXPECT_EQ("tcp", elem->Attr(cricket::QN_PROTOCOL));
  EXPECT_EQ("192.168.7.1", elem->Attr(cricket::QN_ADDRESS));
  EXPECT_EQ("9999", elem->Attr(cricket::QN_PORT));
  EXPECT_EQ("0.51", elem->Attr(cricket::QN_PREFERENCE));
  EXPECT_EQ("mnopqr", elem->Attr(cricket::QN_USERNAME));
  EXPECT_EQ("stuvwx", elem->Attr(cricket::QN_PASSWORD));
  EXPECT_EQ("bar", elem->Attr(cricket::QN_TYPE));
  EXPECT_EQ("testnet2", elem->Attr(cricket::QN_NETWORK));
  EXPECT_EQ("100", elem->Attr(cricket::QN_GENERATION));

  EXPECT_TRUE(parser.ParseGingleCandidate(elem.get(), &translator,
                                          &parsed_candidate, &parse_error));
  EXPECT_TRUE(test_candidate2.IsEquivalent(parsed_candidate));

  // Check that an ip is preferred over hostname.
  EXPECT_TRUE(parser.WriteGingleCandidate(test_candidate3, &translator,
                                          elem.accept(), &write_error));
  EXPECT_EQ("test3", elem->Attr(cricket::QN_NAME));
  EXPECT_EQ("spdy", elem->Attr(cricket::QN_PROTOCOL));
  EXPECT_EQ("10.0.0.1", elem->Attr(cricket::QN_ADDRESS));
  EXPECT_EQ("24601", elem->Attr(cricket::QN_PORT));
  EXPECT_EQ("0.69", elem->Attr(cricket::QN_PREFERENCE));
  EXPECT_EQ("yzabcd", elem->Attr(cricket::QN_USERNAME));
  EXPECT_EQ("efghij", elem->Attr(cricket::QN_PASSWORD));
  EXPECT_EQ("baz", elem->Attr(cricket::QN_TYPE));
  EXPECT_EQ("testnet3", elem->Attr(cricket::QN_NETWORK));
  EXPECT_EQ("150", elem->Attr(cricket::QN_GENERATION));

  EXPECT_TRUE(parser.ParseGingleCandidate(elem.get(), &translator,
                                          &parsed_candidate, &parse_error));
  EXPECT_TRUE(test_candidate3.IsEquivalent(parsed_candidate));
}

TEST_F(TransportTest, TestGetStats) {
  EXPECT_TRUE(SetupChannel());
  cricket::TransportStats stats;
  EXPECT_TRUE(transport_->GetStats(&stats));
  // Note that this tests the behavior of a FakeTransportChannel.
  ASSERT_EQ(1U, stats.channel_stats.size());
  EXPECT_EQ(1, stats.channel_stats[0].component);
  transport_->ConnectChannels();
  EXPECT_TRUE(transport_->GetStats(&stats));
  ASSERT_EQ(1U, stats.channel_stats.size());
  EXPECT_EQ(1, stats.channel_stats[0].component);
}


text:
<?php

namespace Matthias\SymfonyConsoleForm\Tests\Form\Data;

class Address
{
    public $street;

    /**
     * @param $street
     */
    public function __construct($street)
    {
        $this->street = $street;
    }
}


text:
import useMatch from './useMatch';

export default function useLocation() {
  return useMatch().location;
}


text:
//=======================================================================
// Copyright (c) 2014-2020 Baptiste Wicht
// Distributed under the terms of the MIT License.
// (See accompanying file LICENSE or copy at
//  http://opensource.org/licenses/MIT)
//=======================================================================

#pragma once

#include "dll/base_traits.hpp"
#include "dll/base_rnn_layer.hpp"

#include "dll/util/timers.hpp" // for auto_timer

namespace dll {

/*!
 * \brief Standard dense layer of neural network.
 */
template <typename Desc>
struct dyn_rnn_layer_impl final : base_rnn_layer<dyn_rnn_layer_impl<Desc>, Desc> {
    using desc        = Desc;                            ///< The descriptor of the layer
    using weight      = typename desc::weight;           ///< The data type for this layer
    using this_type   = dyn_rnn_layer_impl<desc>;  ///< The type of this layer
    using base_type   = base_rnn_layer<this_type, desc>; ///< The base type
    using layer_t     = this_type;                       ///< This layer's type
    using dyn_layer_t = typename desc::dyn_layer_t;      ///< The dynamic version of this layer

    static constexpr auto activation_function = desc::activation_function; ///< The layer's activation function

    using w_initializer = typename desc::w_initializer; ///< The initializer for the W weights
    using u_initializer = typename desc::u_initializer; ///< The initializer for the U weights
    using b_initializer = typename desc::b_initializer; ///< The initializer for the biases

    using input_one_t  = etl::dyn_matrix<weight, 2>; ///< The type of one input
    using output_one_t = etl::dyn_matrix<weight, 2>; ///< The type of one output
    using input_t      = std::vector<input_one_t>;   ///< The type of the input
    using output_t     = std::vector<output_one_t>;  ///< The type of the output

    using w_type = etl::dyn_matrix<weight, 2>; ///< The type of the W weights
    using u_type = etl::dyn_matrix<weight, 2>; ///< The type of the U weights
    using b_type = etl::dyn_matrix<weight, 1>; ///< The type of the b biases

    //Weights and biases
    w_type w; ///< Weights W
    u_type u; ///< Weights U
    b_type b; ///< Biases b

    //Backup Weights and biases
    std::unique_ptr<w_type> bak_w; ///< Backup Weights W
    std::unique_ptr<u_type> bak_u; ///< Backup Weights U
    std::unique_ptr<b_type> bak_b; ///< Backup biases b

    size_t time_steps;      ///< The number of time steps
    size_t sequence_length; ///< The length of the sequences
    size_t hidden_units;    ///< The number of hidden units
    size_t bptt_steps;      ///< The number of BPTT steps

    /*!
     * \brief Initialize a recurrent layer with basic weights.
     *
     * The weights are initialized from a normal distribution of
     * zero-mean and unit variance.
     */
    dyn_rnn_layer_impl()
            : base_type() {}

    /*!
     * \brief Initialize the dynamic layer
     */
    void init_layer(size_t time_steps, size_t sequence_length, size_t hidden_units) {
        this->time_steps      = time_steps;
        this->sequence_length = sequence_length;
        this->hidden_units    = hidden_units;

        this->bptt_steps = desc::Truncate == 0 ? time_steps : desc::Truncate;

        w = etl::dyn_matrix<weight, 2>(hidden_units, hidden_units);
        u = etl::dyn_matrix<weight, 2>(sequence_length, hidden_units);
        b = etl::dyn_matrix<weight, 1>(hidden_units);

        w_initializer::initialize(w, hidden_units, hidden_units);
        u_initializer::initialize(u, hidden_units, hidden_units);

        b_initializer::initialize(b, sequence_length, hidden_units);
    }

    /*!
     * \brief Returns the input size of this layer
     */
    size_t input_size() const noexcept {
        return time_steps * sequence_length;
    }

    /*!
     * \brief Returns the output size of this layer
     */
    size_t output_size() const noexcept {
        return time_steps * hidden_units;
    }

    /*!
     * \brief Returns the number of parameters of this layer
     */
    size_t parameters() const noexcept {
        return hidden_units * hidden_units + hidden_units * sequence_length + hidden_units;
    }

    /*!
     * \brief Returns a short description of the layer
     * \return an std::string containing a short description of the layer
     */
    std::string to_short_string([[maybe_unused]] std::string pre = "") const {
        if constexpr (activation_function == function::IDENTITY) {
            return "RNN (dyn)";
        } else {
            char buffer[512];
            snprintf(buffer, 512, "RNN (%s) (dyn)", to_string(activation_function).c_str());
            return {buffer};
        }
    }

    /*!
     * \brief Returns a short description of the layer
     * \return an std::string containing a short description of the layer
     */
    std::string to_full_string([[maybe_unused]] std::string pre = "") const {
        char buffer[512];

        if constexpr (activation_function == function::IDENTITY) {
            snprintf(buffer, 512, "RNN(dyn): %lux%lu -> %lux%lu", time_steps, sequence_length, time_steps, hidden_units);
        } else {
            snprintf(buffer, 512, "RNN(dyn): %lux%lu -> %s -> %lux%lu", time_steps, sequence_length, to_string(activation_function).c_str(), time_steps, hidden_units);
        }

        return {buffer};
    }

    /*!
     * \brief Returns the output shape
     * \return an std::string containing the description of the output shape
     */
    std::vector<size_t> output_shape([[maybe_unused]] const std::vector<size_t>& input_shape) const {
        return {time_steps, hidden_units};
    }

    /*!
     * \brief Apply the layer to the given batch of input.
     *
     * \param x A batch of input
     * \param output A batch of output that will be filled
     */
    template <typename H, typename V>
    void forward_batch(H&& output, const V& x) const {
        dll::auto_timer timer("dyn_rnn:forward_batch");

        cpp_assert(etl::dim<0>(output) == etl::dim<0>(x), "The number of samples must be consistent");

        base_type::forward_batch_impl(output, x, w, u, b, time_steps, sequence_length, hidden_units);
    }

    /*!
     * \brief Prepare one empty output for this layer
     * \return an empty ETL matrix suitable to store one output of this layer
     *
     * \tparam Input The type of one Input
     */
    template <typename Input>
    output_one_t prepare_one_output() const {
        return output_one_t(time_steps, hidden_units);
    }

    /*!
     * \brief Prepare a set of empty outputs for this layer
     * \param samples The number of samples to prepare the output for
     * \return a container containing empty ETL matrices suitable to store samples output of this layer
     * \tparam Input The type of one input
     */
    template <typename Input>
    output_t prepare_output(size_t samples) const {
        output_t output;
        output.reserve(samples);
        for (size_t i = 0; i < samples; ++i) {
            output.emplace_back(time_steps, hidden_units);
        }
        return output;
    }

    /*!
     * \brief Initialize the dynamic version of the layer from the
     * fast version of the layer
     * \param dyn Reference to the dynamic version of the layer that
     * needs to be initialized
     */
    template <typename DLayer>
    static void dyn_init([[maybe_unused]] DLayer& dyn) {}

    /*!
     * \brief Adapt the errors, called before backpropagation of the errors.
     *
     * This must be used by layers that have both an activation fnction and a non-linearity.
     *
     * \param context the training context
     */
    template <typename C>
    void adapt_errors([[maybe_unused]] C& context) const {
        // Nothing to do here (done in BPTT)
    }

    /*!
     * \brief Backpropagate the errors to the previous layers
     * \param output The ETL expression into which write the output
     * \param context The training context
     */
    template <typename H, typename C>
    void backward_batch(H&& output, C& context) const {
        dll::auto_timer timer("dyn_rnn:backward_batch");

        base_type::backward_batch_impl(output, context, w, u, time_steps, sequence_length, hidden_units, bptt_steps);
    }

    /*!
     * \brief Compute the gradients for this layer, if any
     * \param context The trainng context
     */
    template <typename C>
    void compute_gradients(C& context) const {
        dll::auto_timer timer("dyn_rnn:compute_gradients");

        base_type::compute_gradients_impl(context, w, u, time_steps, sequence_length, hidden_units, bptt_steps);
    }
};

// Declare the traits for the Layer

template <typename Desc>
struct layer_base_traits<dyn_rnn_layer_impl<Desc>> {
    static constexpr bool is_neural     = true;  ///< Indicates if the layer is a neural layer
    static constexpr bool is_dense      = false; ///< Indicates if the layer is dense
    static constexpr bool is_conv       = false; ///< Indicates if the layer is convolutional
    static constexpr bool is_deconv     = false; ///< Indicates if the layer is deconvolutional
    static constexpr bool is_standard   = true;  ///< Indicates if the layer is standard
    static constexpr bool is_rbm        = false; ///< Indicates if the layer is RBM
    static constexpr bool is_pooling    = false; ///< Indicates if the layer is a pooling layer
    static constexpr bool is_unpooling  = false; ///< Indicates if the layer is an unpooling laye
    static constexpr bool is_transform  = false; ///< Indicates if the layer is a transform layer
    static constexpr bool is_recurrent  = true; ///< Indicates if the layer is a recurrent layer
    static constexpr bool is_multi      = false; ///< Indicates if the layer is a multi-layer layer
    static constexpr bool is_dynamic    = true;  ///< Indicates if the layer is dynamic
    static constexpr bool pretrain_last = false; ///< Indicates if the layer is dynamic
    static constexpr bool sgd_supported = true;  ///< Indicates if the layer is supported by SGD
};

/*!
 * \brief specialization of sgd_context for dyn_rnn_layer_impl
 */
template <typename DBN, typename Desc, size_t L>
struct sgd_context<DBN, dyn_rnn_layer_impl<Desc>, L> {
    using layer_t = dyn_rnn_layer_impl<Desc>; ///< The layer
    using weight  = typename layer_t::weight;       ///< The data type for this layer

    static constexpr size_t layer    = L;               ///< The index of the layer
    static constexpr auto batch_size = DBN::batch_size; ///< The batch size of the network

    etl::dyn_matrix<weight, 3> input;
    etl::dyn_matrix<weight, 3> output;
    etl::dyn_matrix<weight, 3> errors;

    sgd_context(const dyn_rnn_layer_impl<Desc>& layer)
            : input(batch_size, layer.time_steps, layer.sequence_length), output(batch_size, layer.time_steps, layer.hidden_units, 0.0), errors(batch_size, layer.time_steps, layer.hidden_units, 0.0) {}
};

} //end of dll namespace


text:
package rx.internal.schedulers;

import java.util.concurrent.PriorityBlockingQueue;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicInteger;

import rx.Scheduler;
import rx.Subscription;
import rx.functions.Action0;
import rx.subscriptions.BooleanSubscription;
import rx.subscriptions.Subscriptions;

/**
 * Schedules work on the current thread but does not execute immediately. Work is put in a queue and executed
 * after the current unit of work is completed.
 */
public final class TrampolineScheduler extends Scheduler {
    public static final TrampolineScheduler INSTANCE = new TrampolineScheduler();

    @Override
    public Worker createWorker() {
        return new InnerCurrentThreadScheduler();
    }

    private TrampolineScheduler() {
    }

    static final class InnerCurrentThreadScheduler extends Scheduler.Worker implements Subscription {

        final AtomicInteger counter = new AtomicInteger();
        final PriorityBlockingQueue<TimedAction> queue = new PriorityBlockingQueue<TimedAction>();
        private final BooleanSubscription innerSubscription = new BooleanSubscription();
        private final AtomicInteger wip = new AtomicInteger();

        @Override
        public Subscription schedule(Action0 action) {
            return enqueue(action, now());
        }

        @Override
        public Subscription schedule(Action0 action, long delayTime, TimeUnit unit) {
            long execTime = now() + unit.toMillis(delayTime);

            return enqueue(new SleepingAction(action, this, execTime), execTime);
        }

        private Subscription enqueue(Action0 action, long execTime) {
            if (innerSubscription.isUnsubscribed()) {
                return Subscriptions.unsubscribed();
            }
            final TimedAction timedAction = new TimedAction(action, execTime, counter.incrementAndGet());
            queue.add(timedAction);

            if (wip.getAndIncrement() == 0) {
                do {
                    final TimedAction polled = queue.poll();
                    if (polled != null) {
                        polled.action.call();
                    }
                } while (wip.decrementAndGet() > 0);
                return Subscriptions.unsubscribed();
            } else {
                // queue wasn't empty, a parent is already processing so we just add to the end of the queue
                return Subscriptions.create(new Action0() {

                    @Override
                    public void call() {
                        queue.remove(timedAction);
                    }

                });
            }
        }

        @Override
        public void unsubscribe() {
            innerSubscription.unsubscribe();
        }

        @Override
        public boolean isUnsubscribed() {
            return innerSubscription.isUnsubscribed();
        }

    }

    static final class TimedAction implements Comparable<TimedAction> {
        final Action0 action;
        final Long execTime;
        final int count; // In case if time between enqueueing took less than 1ms

        TimedAction(Action0 action, Long execTime, int count) {
            this.action = action;
            this.execTime = execTime;
            this.count = count;
        }

        @Override
        public int compareTo(TimedAction that) {
            int result = execTime.compareTo(that.execTime);
            if (result == 0) {
                return compare(count, that.count);
            }
            return result;
        }
    }

    // because I can't use Integer.compare from Java 7
    static int compare(int x, int y) {
        return (x < y) ? -1 : ((x == y) ? 0 : 1);
    }

}


text:
'use strict';

/**
 * Inserts static segments into all components.
 * @param {object} components - The components to process.
 * @param {SegmentDrawer} segments - The segment storage.
 * @param {Array.<string>} languages - The list of languages.
 */
function insertStaticSegments( components, segments, languages ) {

  for (var componentName in components) {
    if (components.hasOwnProperty( componentName )) {
      var language;
      var appliedTokens = [ ];
      var component = components[ componentName ];

      // Determine the language of the component.
      if (typeof languages === 'string')
        language = languages;
      else {
        var parts = componentName.split( '/', 2 );
        language = languages.indexOf( parts[ 0 ] ) >= 0 ? parts[ 0 ] : '';
      }

      // Insert static segments into a language specific component only.
      if (language) {
        // Get static segment tokens of the component.
        component.tokens.filter( function ( token ) {
          return token.isStatic;
        } )
          .forEach( function ( token ) {

            // Get segment.
            var segment = segments.get( language, token.name );

            // Insert the static segment into the component.
            var re = new RegExp( token.expression, 'g' );
            component.html = component.html.replace( re, segment.html );
            appliedTokens.push( token.name );
          } );

        // Remove applied segment tokens.
        component.tokens = component.tokens.filter( function ( token ) {
          return appliedTokens.indexOf( token.name ) < 0;
        } );
      }
    }
  }
}

module.exports = insertStaticSegments;