text:
///////////////////////////////////////////////////////////////////////////////
// Includes
///////////////////////////////////////////////////////////////////////////////
// Standard C Included Files
#include <stdio.h>
#include <string.h>
// Standard C Included Files
#include "fsl_sai_driver.h"
#include "board.h"
#include "fsl_os_abstraction.h"

///////////////////////////////////////////////////////////////////////////////
// Definitions
///////////////////////////////////////////////////////////////////////////////
#define BUFFER_SIZE                 (64U)
#define SAI_INSTANCE                (0U)

///////////////////////////////////////////////////////////////////////////////
// Variables
///////////////////////////////////////////////////////////////////////////////
uint32_t rxFinish       = 0;
I2S_Type * saiBaseAddr    = (I2S_Type*)I2S0_BASE;

///////////////////////////////////////////////////////////////////////////////
// Code
///////////////////////////////////////////////////////////////////////////////

/*!
* @brief Rx callback function
*/
void rx_callback(uint32_t *callParam)
{
    *callParam = 1;
    SAI_HAL_RxSetIntCmd(saiBaseAddr, kSaiIntrequestFIFORequest, false);
}

/*!
* @brief SAI in loopback mode.
*
* This function demostrates how to use SAI to transfer a buffer
* in loopback mode.
*/
int32_t main()
{
    uint32_t i = 0;
    uint8_t txBuffer[BUFFER_SIZE];
    uint8_t rxBuffer[BUFFER_SIZE];
    static sai_user_config_t txConfig;
    static sai_user_config_t rxConfig;
    static sai_state_t txState;
    static sai_state_t rxState;
    static sai_data_format_t format;
#if (FSL_FEATURE_SAI_FIFO_COUNT == 1)
    uint32_t data = (txBuffer[0] | (txBuffer[1] << 8));
#endif

    // Init hardware
    hardware_init();
    // Init pins for SAI module.
    configure_i2s_pins(SAI_INSTANCE);
    // Call this function to initialize the console UART.  This function
    // enables the use of STDIO functions (printf, scanf, etc.)
    dbg_uart_init();

    printf("SAI loopback example\n\r");
    // Initalize the buffer value.
    for (i = 0; i < BUFFER_SIZE; i++)
    {
        txBuffer[i] = i;
    }
    // Get default setting of SAI.
    SAI_DRV_TxGetDefaultSetting(&txConfig);
    SAI_DRV_RxGetDefaultSetting(&rxConfig);

    while(1)
    {
        // Init SAI
        SAI_DRV_TxInit(SAI_INSTANCE,&txConfig, &txState);
        SAI_DRV_RxInit(SAI_INSTANCE,&rxConfig, &rxState);

        // Config the format, tx and rx use the same format.
        format.bits        = 16;
        format.mono_streo  = kSaiStreo;
        format.sample_rate = 44100;
        format.mclk        = format.sample_rate * 384;

        SAI_DRV_TxConfigDataFormat(SAI_INSTANCE, &format);
        SAI_DRV_RxConfigDataFormat(SAI_INSTANCE, &format);

        // Register callback function for rx
        SAI_DRV_RxRegisterCallback(SAI_INSTANCE, (sai_callback_t)rx_callback, (void*)&rxFinish);

    #if (FSL_FEATURE_SAI_FIFO_COUNT > 1)
        // Test interrupt way
        SAI_DRV_SendData(SAI_INSTANCE, txBuffer,BUFFER_SIZE);
        SAI_DRV_ReceiveData(SAI_INSTANCE, rxBuffer,BUFFER_SIZE);
        SAI_DRV_TxSetIntCmd(SAI_INSTANCE, true);
        SAI_DRV_RxSetIntCmd(SAI_INSTANCE, true);

        // Wait rx finished
        while(!rxFinish);
        rxFinish = 0;
    #else
        // Start tx and rx
        SAI_DRV_TxStartModule(SAI_INSTANCE);
        SAI_DRV_RxStartModule(SAI_INSTANCE);
        // First fill the TX FIFO, as FIFO length only 1.
        SAI_HAL_SendData(saiBaseAddr, txConfig.channel , data);
        for (i = 0; i < BUFFER_SIZE/2; i++)
        {
            SAI_DRV_SendDataBlocking(SAI_INSTANCE, &txBuffer[(i + 1) * 2], 2);
            SAI_DRV_ReceiveDataBlocking(SAI_INSTANCE, &rxBuffer[i * 2], 2);
        }
    #endif
        // Check if the data is transferred successfully.
        for ( i = 0; i < BUFFER_SIZE; i++)
        {
            if (txBuffer[i]  != rxBuffer[i])
            {
                printf("SAI loopback failed!\n\r");
                return -1;
            }
        }

        memset(rxBuffer, 0, sizeof(rxBuffer));

        // Print the successful message.
        printf("SAI loopback Succeed!\n\n\r");

        // Deinit module
        SAI_DRV_TxDeinit(SAI_INSTANCE);
        SAI_DRV_RxDeinit(SAI_INSTANCE);

        printf("Press any key to run again.\n\r");
        getchar();
    }
}


text:
var util = require("util");
var choreography = require("temboo/core/choreography");

/*
    InsertActivity
    Posts a bulletin for a specific channel.
*/

var InsertActivity = function(session) {
    /*
        Create a new instance of the InsertActivity Choreo. A TembooSession object, containing a valid
        set of Temboo credentials, must be supplied.
	*/
    var location = "/Library/YouTube/Activities/InsertActivity"
    InsertActivity.super_.call(this, session, location);

    /*
    Define a callback that will be used to appropriately format the results of this Choreo.
    */
    var newResultSet = function(resultStream) {
        return new InsertActivityResultSet(resultStream);
    }

	/*
	Obtain a new InputSet object, used to specify the input values for an execution of this Choreo.
	*/
    this.newInputSet = function() {
        return new InsertActivityInputSet();
    }

	/*
	Execute this Choreo with the specified inputs, calling the specified callback upon success,
	and the specified errorCallback upon error.
	*/
    this.execute = function(inputs, callback, errorCallback) {
        this._execute(inputs, newResultSet, callback, errorCallback);
    }
}

/*
An InputSet with methods appropriate for specifying the inputs to the InsertActivity
Choreo. The InputSet object is used to specify input parameters when executing this Choreo.
*/

var InsertActivityInputSet = function() {
    InsertActivityInputSet.super_.call(this);
        /*
        Set the value of the ActivityMetadata input for this Choreo. ((required, json) A JSON representation of the activity resource to create. See documentation for examples.)
        */
        this.set_ActivityMetadata = function(value) {
            this.setInput("ActivityMetadata", value);
        }

        /*
        Set the value of the AccessToken input for this Choreo. ((optional, string) A valid access token retrieved during the OAuth process. This is required for OAuth authentication unless you provide the ClientID, ClientSecret, and RefreshToken to generate a new access token.)
        */
        this.set_AccessToken = function(value) {
            this.setInput("AccessToken", value);
        }

        /*
        Set the value of the ClientID input for this Choreo. ((conditional, string) The Client ID provided by Google. Required for OAuth authentication unless providing a valid AccessToken.)
        */
        this.set_ClientID = function(value) {
            this.setInput("ClientID", value);
        }

        /*
        Set the value of the ClientSecret input for this Choreo. ((conditional, string) The Client Secret provided by Google. Required for OAuth authentication unless providing a valid AccessToken.)
        */
        this.set_ClientSecret = function(value) {
            this.setInput("ClientSecret", value);
        }

        /*
        Set the value of the Fields input for this Choreo. ((optional, string) Allows you to specify a subset of fields to include in the response using an xpath-like syntax (i.e. items/snippet/title).)
        */
        this.set_Fields = function(value) {
            this.setInput("Fields", value);
        }

        /*
        Set the value of the Part input for this Choreo. ((optional, string) A comma-separated list of fields that are being set and that will be returned in the response. Part names that can be passed are: snippet and contentDetails.)
        */
        this.set_Part = function(value) {
            this.setInput("Part", value);
        }

        /*
        Set the value of the RefreshToken input for this Choreo. ((conditional, string) An OAuth refresh token used to generate a new access token when the original token is expired. Required for OAuth authentication unless providing a valid AccessToken.)
        */
        this.set_RefreshToken = function(value) {
            this.setInput("RefreshToken", value);
        }

}

/*
A ResultSet with methods tailored to the values returned by the InsertActivity Choreo.
The ResultSet object is used to retrieve the results of a Choreo execution.
*/

var InsertActivityResultSet = function(resultStream) {
    InsertActivityResultSet.super_.call(this, resultStream);
        /*
        Retrieve the value for the "Response" output from this Choreo execution. ((json) The response from Google.)
        */
        this.get_Response = function() {
            return this.getResult("Response");
        }
        /*
        Retrieve the value for the "NewAccessToken" output from this Choreo execution. ((string) Contains a new AccessToken when the RefreshToken is provided.)
        */
        this.get_NewAccessToken = function() {
            return this.getResult("NewAccessToken");
        }
}

util.inherits(InsertActivity, choreography.Choreography);
util.inherits(InsertActivityInputSet, choreography.InputSet);
util.inherits(InsertActivityResultSet, choreography.ResultSet);
exports.InsertActivity = InsertActivity;

/*
    ListActivitiesByChannel
    Returns a list of activities for a specified channel.
*/

var ListActivitiesByChannel = function(session) {
    /*
        Create a new instance of the ListActivitiesByChannel Choreo. A TembooSession object, containing a valid
        set of Temboo credentials, must be supplied.
	*/
    var location = "/Library/YouTube/Activities/ListActivitiesByChannel"
    ListActivitiesByChannel.super_.call(this, session, location);

    /*
    Define a callback that will be used to appropriately format the results of this Choreo.
    */
    var newResultSet = function(resultStream) {
        return new ListActivitiesByChannelResultSet(resultStream);
    }

	/*
	Obtain a new InputSet object, used to specify the input values for an execution of this Choreo.
	*/
    this.newInputSet = function() {
        return new ListActivitiesByChannelInputSet();
    }

	/*
	Execute this Choreo with the specified inputs, calling the specified callback upon success,
	and the specified errorCallback upon error.
	*/
    this.execute = function(inputs, callback, errorCallback) {
        this._execute(inputs, newResultSet, callback, errorCallback);
    }
}

/*
An InputSet with methods appropriate for specifying the inputs to the ListActivitiesByChannel
Choreo. The InputSet object is used to specify input parameters when executing this Choreo.
*/

var ListActivitiesByChannelInputSet = function() {
    ListActivitiesByChannelInputSet.super_.call(this);
        /*
        Set the value of the APIKey input for this Choreo. ((optional, string) The API Key provided by Google for simple API access when you do not need to access user data.)
        */
        this.set_APIKey = function(value) {
            this.setInput("APIKey", value);
        }

        /*
        Set the value of the AccessToken input for this Choreo. ((optional, string) A valid access token retrieved during the OAuth process. This is required for OAuth authentication unless you provide the ClientID, ClientSecret, and RefreshToken to generate a new access token.)
        */
        this.set_AccessToken = function(value) {
            this.setInput("AccessToken", value);
        }

        /*
        Set the value of the ChannelID input for this Choreo. ((required, string) The id of the channel to list activities for.)
        */
        this.set_ChannelID = function(value) {
            this.setInput("ChannelID", value);
        }

        /*
        Set the value of the ClientID input for this Choreo. ((conditional, string) The Client ID provided by Google. Required for OAuth authentication unless providing a valid AccessToken.)
        */
        this.set_ClientID = function(value) {
            this.setInput("ClientID", value);
        }

        /*
        Set the value of the ClientSecret input for this Choreo. ((conditional, string) The Client Secret provided by Google. Required for OAuth authentication unless providing a valid AccessToken.)
        */
        this.set_ClientSecret = function(value) {
            this.setInput("ClientSecret", value);
        }

        /*
        Set the value of the Fields input for this Choreo. ((optional, string) Allows you to specify a subset of fields to include in the response using an xpath-like syntax (i.e. items/snippet/title).)
        */
        this.set_Fields = function(value) {
            this.setInput("Fields", value);
        }

        /*
        Set the value of the MaxResults input for this Choreo. ((optional, integer) The maximum number of results to return.)
        */
        this.set_MaxResults = function(value) {
            this.setInput("MaxResults", value);
        }

        /*
        Set the value of the PageToken input for this Choreo. ((optional, string) The "nextPageToken" found in the response which is used to page through results.)
        */
        this.set_PageToken = function(value) {
            this.setInput("PageToken", value);
        }

        /*
        Set the value of the Part input for this Choreo. ((optional, string) Specifies a comma-separated list of one or more activity resource properties that the API response will include. Part names that you can pass are id, snippet, and contentDetails.)
        */
        this.set_Part = function(value) {
            this.setInput("Part", value);
        }

        /*
        Set the value of the PublishedAfter input for this Choreo. ((optional, date) Returns only results created after the specified time (formatted as a RFC 3339 date-time i.e. 1970-01-01T00:00:00Z).)
        */
        this.set_PublishedAfter = function(value) {
            this.setInput("PublishedAfter", value);
        }

        /*
        Set the value of the PublishedBefore input for this Choreo. ((optional, date) Returns only results created before the specified time (formatted as a RFC 3339 date-time i.e. 1970-01-01T00:00:00Z).)
        */
        this.set_PublishedBefore = function(value) {
            this.setInput("PublishedBefore", value);
        }

        /*
        Set the value of the RefreshToken input for this Choreo. ((conditional, string) An OAuth refresh token used to generate a new access token when the original token is expired. Required for OAuth authentication unless providing a valid AccessToken.)
        */
        this.set_RefreshToken = function(value) {
            this.setInput("RefreshToken", value);
        }

}

/*
A ResultSet with methods tailored to the values returned by the ListActivitiesByChannel Choreo.
The ResultSet object is used to retrieve the results of a Choreo execution.
*/

var ListActivitiesByChannelResultSet = function(resultStream) {
    ListActivitiesByChannelResultSet.super_.call(this, resultStream);
        /*
        Retrieve the value for the "Response" output from this Choreo execution. ((json) The response from YouTube.)
        */
        this.get_Response = function() {
            return this.getResult("Response");
        }
        /*
        Retrieve the value for the "NewAccessToken" output from this Choreo execution. ((string) Contains a new AccessToken when the RefreshToken is provided.)
        */
        this.get_NewAccessToken = function() {
            return this.getResult("NewAccessToken");
        }
}

util.inherits(ListActivitiesByChannel, choreography.Choreography);
util.inherits(ListActivitiesByChannelInputSet, choreography.InputSet);
util.inherits(ListActivitiesByChannelResultSet, choreography.ResultSet);
exports.ListActivitiesByChannel = ListActivitiesByChannel;

/*
    ListHomePageActivities
    Returns an activity feed that displays on the YouTube home page for the currently authenticated user.
*/

var ListHomePageActivities = function(session) {
    /*
        Create a new instance of the ListHomePageActivities Choreo. A TembooSession object, containing a valid
        set of Temboo credentials, must be supplied.
	*/
    var location = "/Library/YouTube/Activities/ListHomePageActivities"
    ListHomePageActivities.super_.call(this, session, location);

    /*
    Define a callback that will be used to appropriately format the results of this Choreo.
    */
    var newResultSet = function(resultStream) {
        return new ListHomePageActivitiesResultSet(resultStream);
    }

	/*
	Obtain a new InputSet object, used to specify the input values for an execution of this Choreo.
	*/
    this.newInputSet = function() {
        return new ListHomePageActivitiesInputSet();
    }

	/*
	Execute this Choreo with the specified inputs, calling the specified callback upon success,
	and the specified errorCallback upon error.
	*/
    this.execute = function(inputs, callback, errorCallback) {
        this._execute(inputs, newResultSet, callback, errorCallback);
    }
}

/*
An InputSet with methods appropriate for specifying the inputs to the ListHomePageActivities
Choreo. The InputSet object is used to specify input parameters when executing this Choreo.
*/

var ListHomePageActivitiesInputSet = function() {
    ListHomePageActivitiesInputSet.super_.call(this);
        /*
        Set the value of the AccessToken input for this Choreo. ((optional, string) A valid access token retrieved during the OAuth process. This is required for OAuth authentication unless you provide the ClientID, ClientSecret, and RefreshToken to generate a new access token.)
        */
        this.set_AccessToken = function(value) {
            this.setInput("AccessToken", value);
        }

        /*
        Set the value of the ClientID input for this Choreo. ((conditional, string) The Client ID provided by Google. Required for OAuth authentication unless providing a valid AccessToken.)
        */
        this.set_ClientID = function(value) {
            this.setInput("ClientID", value);
        }

        /*
        Set the value of the ClientSecret input for this Choreo. ((conditional, string) The Client Secret provided by Google. Required for OAuth authentication unless providing a valid AccessToken.)
        */
        this.set_ClientSecret = function(value) {
            this.setInput("ClientSecret", value);
        }

        /*
        Set the value of the Fields input for this Choreo. ((optional, string) Allows you to specify a subset of fields to include in the response using an xpath-like syntax (i.e. items/snippet/title).)
        */
        this.set_Fields = function(value) {
            this.setInput("Fields", value);
        }

        /*
        Set the value of the MaxResults input for this Choreo. ((optional, integer) The maximum number of results to return.)
        */
        this.set_MaxResults = function(value) {
            this.setInput("MaxResults", value);
        }

        /*
        Set the value of the PageToken input for this Choreo. ((optional, string) The "nextPageToken" found in the response which is used to page through results.)
        */
        this.set_PageToken = function(value) {
            this.setInput("PageToken", value);
        }

        /*
        Set the value of the Part input for this Choreo. ((optional, string) Specifies a comma-separated list of one or more activity resource properties that the API response will include. Part names that you can pass are id, snippet, and contentDetails.)
        */
        this.set_Part = function(value) {
            this.setInput("Part", value);
        }

        /*
        Set the value of the PublishedAfter input for this Choreo. ((optional, date) Returns only results created after the specified time (formatted as a RFC 3339 date-time i.e. 1970-01-01T00:00:00Z).)
        */
        this.set_PublishedAfter = function(value) {
            this.setInput("PublishedAfter", value);
        }

        /*
        Set the value of the PublishedBefore input for this Choreo. ((optional, date) Returns only results created before the specified time (formatted as a RFC 3339 date-time i.e. 1970-01-01T00:00:00Z).)
        */
        this.set_PublishedBefore = function(value) {
            this.setInput("PublishedBefore", value);
        }

        /*
        Set the value of the RefreshToken input for this Choreo. ((conditional, string) An OAuth refresh token used to generate a new access token when the original token is expired. Required for OAuth authentication unless providing a valid AccessToken.)
        */
        this.set_RefreshToken = function(value) {
            this.setInput("RefreshToken", value);
        }

}

/*
A ResultSet with methods tailored to the values returned by the ListHomePageActivities Choreo.
The ResultSet object is used to retrieve the results of a Choreo execution.
*/

var ListHomePageActivitiesResultSet = function(resultStream) {
    ListHomePageActivitiesResultSet.super_.call(this, resultStream);
        /*
        Retrieve the value for the "Response" output from this Choreo execution. ((json) The response from YouTube.)
        */
        this.get_Response = function() {
            return this.getResult("Response");
        }
        /*
        Retrieve the value for the "NewAccessToken" output from this Choreo execution. ((string) Contains a new AccessToken when the RefreshToken is provided.)
        */
        this.get_NewAccessToken = function() {
            return this.getResult("NewAccessToken");
        }
}

util.inherits(ListHomePageActivities, choreography.Choreography);
util.inherits(ListHomePageActivitiesInputSet, choreography.InputSet);
util.inherits(ListHomePageActivitiesResultSet, choreography.ResultSet);
exports.ListHomePageActivities = ListHomePageActivities;

/*
    ListMyActivities
    Returns a list of activity events for the authenticated user.
*/

var ListMyActivities = function(session) {
    /*
        Create a new instance of the ListMyActivities Choreo. A TembooSession object, containing a valid
        set of Temboo credentials, must be supplied.
	*/
    var location = "/Library/YouTube/Activities/ListMyActivities"
    ListMyActivities.super_.call(this, session, location);

    /*
    Define a callback that will be used to appropriately format the results of this Choreo.
    */
    var newResultSet = function(resultStream) {
        return new ListMyActivitiesResultSet(resultStream);
    }

	/*
	Obtain a new InputSet object, used to specify the input values for an execution of this Choreo.
	*/
    this.newInputSet = function() {
        return new ListMyActivitiesInputSet();
    }

	/*
	Execute this Choreo with the specified inputs, calling the specified callback upon success,
	and the specified errorCallback upon error.
	*/
    this.execute = function(inputs, callback, errorCallback) {
        this._execute(inputs, newResultSet, callback, errorCallback);
    }
}

/*
An InputSet with methods appropriate for specifying the inputs to the ListMyActivities
Choreo. The InputSet object is used to specify input parameters when executing this Choreo.
*/

var ListMyActivitiesInputSet = function() {
    ListMyActivitiesInputSet.super_.call(this);
        /*
        Set the value of the AccessToken input for this Choreo. ((optional, string) A valid access token retrieved during the OAuth process. This is required for OAuth authentication unless you provide the ClientID, ClientSecret, and RefreshToken to generate a new access token.)
        */
        this.set_AccessToken = function(value) {
            this.setInput("AccessToken", value);
        }

        /*
        Set the value of the ClientID input for this Choreo. ((conditional, string) The Client ID provided by Google. Required for OAuth authentication unless providing a valid AccessToken.)
        */
        this.set_ClientID = function(value) {
            this.setInput("ClientID", value);
        }

        /*
        Set the value of the ClientSecret input for this Choreo. ((conditional, string) The Client Secret provided by Google. Required for OAuth authentication unless providing a valid AccessToken.)
        */
        this.set_ClientSecret = function(value) {
            this.setInput("ClientSecret", value);
        }

        /*
        Set the value of the Fields input for this Choreo. ((optional, string) Allows you to specify a subset of fields to include in the response using an xpath-like syntax (i.e. items/snippet/title).)
        */
        this.set_Fields = function(value) {
            this.setInput("Fields", value);
        }

        /*
        Set the value of the MaxResults input for this Choreo. ((optional, integer) The maximum number of results to return.)
        */
        this.set_MaxResults = function(value) {
            this.setInput("MaxResults", value);
        }

        /*
        Set the value of the PageToken input for this Choreo. ((optional, string) The "nextPageToken" found in the response which is used to page through results.)
        */
        this.set_PageToken = function(value) {
            this.setInput("PageToken", value);
        }

        /*
        Set the value of the Part input for this Choreo. ((optional, string) Specifies a comma-separated list of one or more activity resource properties that the API response will include. Part names that you can pass are id, snippet, and contentDetails.)
        */
        this.set_Part = function(value) {
            this.setInput("Part", value);
        }

        /*
        Set the value of the PublishedAfter input for this Choreo. ((optional, date) Returns only results created after the specified time (formatted as a RFC 3339 date-time i.e. 1970-01-01T00:00:00Z).)
        */
        this.set_PublishedAfter = function(value) {
            this.setInput("PublishedAfter", value);
        }

        /*
        Set the value of the PublishedBefore input for this Choreo. ((optional, date) Returns only results created before the specified time (formatted as a RFC 3339 date-time i.e. 1970-01-01T00:00:00Z).)
        */
        this.set_PublishedBefore = function(value) {
            this.setInput("PublishedBefore", value);
        }

        /*
        Set the value of the RefreshToken input for this Choreo. ((conditional, string) An OAuth refresh token used to generate a new access token when the original token is expired. Required for OAuth authentication unless providing a valid AccessToken.)
        */
        this.set_RefreshToken = function(value) {
            this.setInput("RefreshToken", value);
        }

}

/*
A ResultSet with methods tailored to the values returned by the ListMyActivities Choreo.
The ResultSet object is used to retrieve the results of a Choreo execution.
*/

var ListMyActivitiesResultSet = function(resultStream) {
    ListMyActivitiesResultSet.super_.call(this, resultStream);
        /*
        Retrieve the value for the "Response" output from this Choreo execution. ((json) The response from YouTube.)
        */
        this.get_Response = function() {
            return this.getResult("Response");
        }
        /*
        Retrieve the value for the "NewAccessToken" output from this Choreo execution. ((string) Contains a new AccessToken when the RefreshToken is provided.)
        */
        this.get_NewAccessToken = function() {
            return this.getResult("NewAccessToken");
        }
}

util.inherits(ListMyActivities, choreography.Choreography);
util.inherits(ListMyActivitiesInputSet, choreography.InputSet);
util.inherits(ListMyActivitiesResultSet, choreography.ResultSet);
exports.ListMyActivities = ListMyActivities;

redpajama_set_name: RedPajamaGithub


text:
using System;
using System.Collections.Specialized;
using System.Net;
using System.Text;

namespace HttpMockPlayer.Tests
{
    public class Client
    {
        private readonly Uri baseAddress;

        public Client(Uri baseAddress)
        {
            this.baseAddress = baseAddress;
        }

        public WebResponse Send(string path, string method, NameValueCollection headers = null, CookieCollection cookies = null)
        {
            return CreateRequest(path, method, headers, cookies).GetResponse();
        }

        public WebResponse Send(string path, string method, string content, NameValueCollection headers = null, CookieCollection cookies = null)
        {
            var request = CreateRequest(path, method, headers, cookies);

            return Send(path, method, Encoding.UTF8.GetBytes(content), headers, cookies);
        }

        public WebResponse Send(string path, string method, byte[] content, NameValueCollection headers = null, CookieCollection cookies = null)
        {
            var request = CreateRequest(path, method, headers, cookies);

            request.ContentLength = content.Length;

            using (var stream = request.GetRequestStream())
            {
                stream.Write(content, 0, content.Length);
            }

            return request.GetResponse();
        }

        private HttpWebRequest CreateRequest(string path, string method, NameValueCollection headers = null, CookieCollection cookies = null)
        {
            var request = WebRequest.CreateHttp(new Uri(baseAddress, path));
            request.Method = method;

            if (headers != null)
            {
                foreach (string header in headers)
                {
                    var value = headers[header];

                    switch (header)
                    {
                        case "Accept":
                            request.Accept = value;
                            break;
                        case "Connection":
                            if (value.ToLower() == "keep-alive")
                            {
                                request.KeepAlive = true;
                            }
                            else if (value.ToLower() == "close")
                            {
                                request.KeepAlive = false;
                            }
                            else
                            {
                                request.Connection = value;
                            }
                            break;
                        case "Content-Length":
                            request.ContentLength = long.Parse(value);
                            break;
                        case "Content-Type":
                            request.ContentType = value;
                            break;
                        case "Date":
                            request.Date = DateTime.Parse(value);
                            break;
                        case "Expect":
                            if (value.ToLower() != "100-continue")
                            {
                                request.Expect = value;
                            }
                            break;
                        case "Host":
                            request.Host = value;
                            break;
                        case "If-Modified-Since":
                            request.IfModifiedSince = DateTime.Parse(value);
                            break;
                        case "Referer":
                            request.Referer = value;
                            break;
                        case "Transfer-Encoding":
                            if (value.ToLower() == "chunked")
                            {
                                request.SendChunked = true;
                            }
                            else
                            {
                                request.TransferEncoding = value;
                            }
                            break;
                        case "User-Agent":
                            request.UserAgent = value;
                            break;
                        default:
                            request.Headers[header] = value;
                            break;
                    }
                }
            }

            if (cookies != null)
            {
                request.CookieContainer = new CookieContainer();
                request.CookieContainer.Add(cookies);
            }

            return request;
        }
    }
}


text:
Unofficial API Wrapper for adf.ly

[![Build Status](https://travis-ci.org/pacop/adfly.svg?branch=master)](https://travis-ci.org/pacop/adfly)

## Installation

To use this rubygem:

```
$ sudo gem install adfly
```

With bundler:

```
gem "adfly", "~> 0.0.1"
```

## Some examples

```
adfly = Adfly::API.new UID, KEY
adfly.create_link url: 'http://www.google.es'
=> "http://adf.ly/eY6Th"
```

You can specify adver_type(:int or :banner) or domain

```
adfly.create_link url: 'http://www.google.es', advert_type: :int, domain: 'q.gs'
=> "http://q.gs/eY6Th"
```

Maybe you want to read https://adf.ly/publisher/tools#tools-api

## Contributing to adfly

* Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet.
* Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it.
* Fork the project.
* Start a feature/bugfix branch.
* Commit and push until you are happy with your contribution.
* Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
* Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.

## Copyright

Copyright (c) 2014 pacop. See LICENSE.txt for
further details.


text:
package com.facebook.buck.junit;

import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.containsString;

import com.facebook.buck.testutil.integration.DebuggableTemporaryFolder;
import com.facebook.buck.testutil.integration.ProjectWorkspace;
import com.facebook.buck.testutil.integration.ProjectWorkspace.ProcessResult;
import com.facebook.buck.testutil.integration.TestDataHelper;

import org.junit.Rule;
import org.junit.Test;

import java.io.IOException;

public class CallFlowIntegrationTest {

  @Rule
  public DebuggableTemporaryFolder temporaryFolder = new DebuggableTemporaryFolder();

  @Test
  public void testCallFlow() throws IOException {
    ProjectWorkspace workspace = TestDataHelper.createProjectWorkspaceForScenario(
        this, "test_call_flow", temporaryFolder);
    workspace.setUp();

    // ExceedsAnnotationTimeoutTest should fail.
    ProcessResult suiteTestResult = workspace.runBuckCommand("test", "//:example");
    suiteTestResult.assertTestFailure(
        "Test should fail because @AfterClass method is supposed to call exit(42)");
    assertThat(suiteTestResult.getStderr(), containsString("exit code 42"));
  }

}


text:
using System.Threading.Tasks;

namespace EasyRpc.AspNetCore.Authorization
{
    /// <summary>
    /// Interface representing an end point authorization
    /// </summary>
    public interface IEndPointMethodAuthorization
    {
        /// <summary>
        /// authorize request async
        /// </summary>
        /// <param name="context">request</param>
        /// <returns>true is authorized</returns>
        Task<bool> AsyncAuthorize(RequestExecutionContext context);
    }
}


text:
<?php
namespace App\Api;
use Hyperspan;

class Template extends \Bullet\View\Template
{
    public $callbacks = array();

    protected $_data = array();
    protected $_links = array();
    protected $_fields = array();
    protected $_titleField;
    protected $_showPrimaryAction = true;

    // Single item view?
    protected $_itemView = false;

    public function __construct($data = array())
    {
        if($data instanceof Hyperspan\Response) {
            $format = new Hyperspan\Formatter\Siren($data);
            $data = $format->toArray();
        }

        if(!is_array($data)) {
            throw new \InvalidArgumentException("Argument 1 passed to " . __METHOD__ . " must be of the type array or Hyperspan\Response. " . gettype($data) . " given");
        }

        if(!isset($data['title'])) {
            throw new \InvalidArgumentException("Title not set. Please add a 'title' key to the \$data array.");
        }

        parent::__construct('/templates/api', array('title' => $data['title'], 'data' => $data));

        // Set path to current directory
        $this->path(__DIR__);

        // Store data
        $this->_data = $data;
    }

    /**
     * Load and return new view for partial
     *
     * @param string $template Template file to use
     * @param array $vars Variables to pass to partial
     * @return Bullet\View\Template
     */
    public function partial($template, array $vars = array())
    {
        $tpl = new parent($template, $vars);
        $tpl->layout(false);
        return $tpl->path(__DIR__ . '/templates/');
    }

    /**
     * Is view single-item view?
     *
     * @return boolean
     */
    public function itemView($res = null)
    {
        if($res !== null) {
            $this->_itemView = $res;
            return $this;
        }
        return $this->_itemView;
    }

    /**
     * Set field name to the primary title field
     */
    public function titleField($field = null)
    {
        if($field !== null) {
            $this->_titleField = $field;
            return $this;
        }
        return $this->_titleField;
    }

    /**
     * Array of $properties from Siren JSON
     *
     * @return array
     */
    public function properties()
    {
        $properties = array();
        if(isset($this->_data['properties'])) {
            $properties = $this->_data['properties'];
        }
        return $properties;
    }

    /**
     * Array of $entities from Siren JSON
     *
     * @return array
     */
    public function entities()
    {
        $entities = array();
        if(isset($this->_data['entities'])) {
            $entities = $this->_data['entities'];
        }
        return $entities;
    }

    /**
     * Array of error messages
     *
     * @return array
     */
    public function errors()
    {
        $errors = array();
        if(isset($this->_data['errors'])) {
            $errors = $this->_data['errors'];
        }
        return $errors;
    }

    /**
     * Set particular fields to display on the form
     */
    public function fields(array $fields = null)
    {
        if($fields !== null) {
            $this->_fields = $fields;
            return $this;
        }

        // Determine fields to be displayed if none are explicitly set
        if(!$this->_fields) {
            if(isset($this->_data['entities'][0]['properties']['@display'])) {
                $this->_fields = $this->_data['entities'][0]['properties']['@display'];
            } elseif(isset($this->_data['entities'][0]['properties'])) {
                $this->_fields = array_keys($this->_data['entities'][0]['properties']);
            }
        }
        return $this->_fields;
    }

    /**
     * Define callback to display content for field
     *
     * @return string
     */
    public function field($field, $callback)
    {
        if(!is_callable($callback)) {
            throw new \InvalidArgumentException("Second parameter must be valid callback or closure (got " . gettype($callback) . ")");
        }

        $this->callbacks['field'][$field] = $callback;
        return $this;
    }

    /**
     * Get links array and format them
     */
    public function links(array $links = null)
    {
        if($links !== null) {
            $this->_links = $links;
            return $this;
        }

        // Parse links and normalize data
        if(!$this->_links) {
            $links = array();

            if(isset($this->_data['links'])) {
                $links = $this->formatLinks($this->_data['links']);
            }

            $this->_links = $links;
        }
        return $this->_links;
    }

    /**
     * Get primary action described in actions to display them on page
     */
    public function primaryAction()
    {
        $primaryLink = false;
        $links = $this->actions();
        foreach($links as $linkRel => $link) {
            if($linkRel == 'self') { continue; }
            if($linkRel == 'add') { $primaryLink = $linkRel; }
            if($primaryLink !== null) { break; }
        }
        return $primaryLink;
    }

    /**
     * Get actions/forms described in 'actions' to display them on page
     */
    public function actions()
    {
        $actions = array();
        if(isset($this->_data['actions'])) {
            $actions = $this->formatLinks($this->_data['actions'], 'name');
        }
        return $actions;
    }

    /**
     * Ensure 'title' key is present and make 'rel' the array key
     */
    public function formatLinks(array $data, $field = 'rel')
    {
        $links = array();
        foreach($data as $link) {
            if(!isset($link[$field])) {
                throw new \InvalidArgumentException("Link rel must be set. Looking at link: " . var_export($link, true));
            }
            // Use first rel listed if array
            $linkRel = is_array($link[$field]) ? $link[$field][0] : $link[$field];

            // Ensure title is set
            if(!isset($link['title'])) {
                $link['title'] = ucwords(str_replace('_', ' ', $linkRel));
            }
            $links[$linkRel] = $link;
        }
        return $links;
    }

    /**
     * Is this response ONLY actions?
     *
     * @return boolean
     */
    public function isOnlyActions()
    {
        return (count($this->actions()) >= 1 && count($this->entities()) === 0 && count($this->properties()) === 0);
    }
}


text:
package nl.basjes.pig.input.apachehttpdlog;

import org.apache.pig.ExecType;
import org.apache.pig.PigServer;
import org.apache.pig.builtin.mock.Storage;
import org.apache.pig.data.Tuple;
import org.junit.jupiter.api.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.util.List;

import static org.apache.pig.builtin.mock.Storage.resetData;
import static org.apache.pig.builtin.mock.Storage.tuple;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertTrue;

class TestFields {
    private static final Logger LOG = LoggerFactory.getLogger(TestFields.class);

    private static final String LOGFORMAT = "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"";

    @Test
    void fieldsTest() throws Exception {
        PigServer pigServer = new PigServer(ExecType.LOCAL);
        Storage.Data data = resetData(pigServer);

        pigServer.registerQuery(
                "Fields = " +
                        "    LOAD '" + getClass().getResource("/access.log") + "' " +
                        "    USING nl.basjes.pig.input.apachehttpdlog.Loader(" +
                        "          '" + LOGFORMAT + "', " +
                        "          'Fields'," +
                        "          '-map:request.firstline.uri.query.g:HTTP.URI'," +
                        "          '-map:request.firstline.uri.query.r:HTTP.URI'," +
                        "          '-map:request.firstline.uri.query.s:SCREENRESOLUTION'," +
                        "          '-load:nl.basjes.parse.httpdlog.dissectors.ScreenResolutionDissector:x'" +
                        "           ) AS ( " +
                        "          Fields );"
        );

        pigServer.registerQuery("STORE Fields INTO 'Fields' USING mock.Storage();");

        List<Tuple> out = data.get("Fields");

        // Check the basics
        assertTrue(out.contains(tuple("HTTP.URI:request.firstline.uri")), "Missing Base URI");
        assertTrue(out.contains(tuple("HTTP.QUERYSTRING:request.firstline.uri.query")), "Missing Base QueryString");
        assertTrue(out.contains(tuple("STRING:request.firstline.uri.query.*")), "Missing Base Query Parameters");

        // Check the the remapped possibilities
        assertTrue(out.contains(tuple("HTTP.URI:request.firstline.uri.query.g")), "Missing Remapped URI G");
        assertTrue(out.contains(tuple("HTTP.QUERYSTRING:request.firstline.uri.query.g.query")), "Missing Remapped URI G QueryString");
        assertTrue(out.contains(tuple("STRING:request.firstline.uri.query.g.query.*")), "Missing Remapped URI G Query Parameters");
        assertTrue(out.contains(tuple("HTTP.URI:request.firstline.uri.query.r")), "Missing Remapped URI R");
        assertTrue(out.contains(tuple("HTTP.QUERYSTRING:request.firstline.uri.query.r.query")), "Missing Remapped URI R QueryString");
        assertTrue(out.contains(tuple("STRING:request.firstline.uri.query.r.query.*")), "Missing Remapped URI R Query Parameters");

        // Check the the remapped possibilities from the additional dissector
        assertTrue(out.contains(tuple("SCREENRESOLUTION:request.firstline.uri.query.s")), "Missing Remapped Extraloaded SCREENRESOLUTION");
        assertTrue(out.contains(tuple("SCREENWIDTH:request.firstline.uri.query.s.width")), "Missing Remapped Extraloaded Width");
        assertTrue(out.contains(tuple("SCREENHEIGHT:request.firstline.uri.query.s.height")), "Missing Remapped Extraloaded Height");
    }

    @Test
    void fieldsExampleTest() throws Exception {
        PigServer pigServer = new PigServer(ExecType.LOCAL);
        Storage.Data data = resetData(pigServer);

        pigServer.registerQuery(
            "Example = " +
            "    LOAD '" + getClass().getResource("/access.log") + "' " +
            "    USING nl.basjes.pig.input.apachehttpdlog.Loader(" +
            "          '" + LOGFORMAT + "', " +
            "          'Example'," +
            "          '-map:request.firstline.uri.query.g:HTTP.URI'," +
            "          '-map:request.firstline.uri.query.r:HTTP.URI'," +
            "          '-map:request.firstline.uri.query.s:SCREENRESOLUTION'," +
            "          '-load:nl.basjes.parse.httpdlog.dissectors.ScreenResolutionDissector:x'" +
            "           ) AS ( " +
            "          Example );"
        );

        pigServer.registerQuery("STORE Example INTO 'Example' USING mock.Storage();");

        validateExampleResult(data.get("Example"));
    }

    @Test
    void fieldsFullBareExampleTest() throws Exception {
        PigServer pigServer = new PigServer(ExecType.LOCAL);
        Storage.Data data = resetData(pigServer);

        pigServer.registerQuery(
            "Example = " +
            "    LOAD '" + getClass().getResource("/access.log") + "' " +
            "    USING nl.basjes.pig.input.apachehttpdlog.Loader(" +
            "          '" + LOGFORMAT + "', " +
            "          '-map:request.firstline.uri.query.g:HTTP.URI'," +
            "          '-map:request.firstline.uri.query.r:HTTP.URI'," +
            "          '-map:request.firstline.uri.query.s:SCREENRESOLUTION'," +
            "          '-load:nl.basjes.parse.httpdlog.dissectors.ScreenResolutionDissector:x'" +
            "           );"
        );

        pigServer.registerQuery("STORE Example INTO 'Example' USING mock.Storage();");

        validateExampleResult(data.get("Example"));
    }

    private void validateExampleResult(List<Tuple> out) throws Exception {
        assertEquals(1, out.size());
        assertEquals(1, out.get(0).size());

        String theValue = out.get(0).get(0).toString();

        LOG.info("Result is {}", theValue);
        assertTrue(theValue.contains("nl.basjes.pig.input.apachehttpdlog.Loader"));

        assertTrue(!theValue.contains("''"), "Empty field");
        assertTrue(theValue.contains("HTTP.URI:request.firstline.uri"), "Missing Base URI");
        assertTrue(theValue.contains("HTTP.QUERYSTRING:request.firstline.uri.query"), "Missing Base QueryString");
        assertTrue(theValue.contains("STRING:request.firstline.uri.query.*"), "Missing Base Query Parameters");

        // Check the special parameters
        assertTrue(theValue.contains("'-map:request.firstline.uri.query.s:SCREENRESOLUTION'"), "Missing MAP parameter");
        assertTrue(theValue.contains("'-load:nl.basjes.parse.httpdlog.dissectors.ScreenResolutionDissector:x'"), "Missing LOAD parameter");

        // Check the remapped possibilities
        assertTrue(theValue.contains("HTTP.URI:request.firstline.uri.query.g"), "Missing Remapped URI G");
        assertTrue(theValue.contains("HTTP.QUERYSTRING:request.firstline.uri.query.g.query"), "Missing Remapped URI G QueryString");
        assertTrue(theValue.contains("STRING:request.firstline.uri.query.g.query.*"), "Missing Remapped URI G Query Parameters");
        assertTrue(theValue.contains("HTTP.URI:request.firstline.uri.query.r"), "Missing Remapped URI R");
        assertTrue(theValue.contains("HTTP.QUERYSTRING:request.firstline.uri.query.r.query"), "Missing Remapped URI R QueryString");
        assertTrue(theValue.contains("STRING:request.firstline.uri.query.r.query.*"), "Missing Remapped URI R Query Parameters");

        // Casts of values
        assertTrue(theValue.contains("request_firstline_uri:chararray"), "Missing Casts Base URI");
        assertTrue(theValue.contains("request_firstline_uri_query:chararray"), "Missing Casts Base QueryString");
        assertTrue(theValue.contains("request_firstline_uri_query__:map[]"), "Missing Casts Base Query Parameters");

        // Check the Casts of remapped possibilities
        assertTrue(theValue.contains("request_firstline_uri_query_g:chararray"), "Missing Casts Remapped URI G");
        assertTrue(theValue.contains("request_firstline_uri_query_g_query:chararray"), "Missing Casts Remapped URI G QueryString");
        assertTrue(theValue.contains("request_firstline_uri_query_g_query__:map[]"), "Missing Casts Remapped URI G Query Parameters");
        assertTrue(theValue.contains("request_firstline_uri_query_r:chararray"), "Missing Casts Remapped URI R");
        assertTrue(theValue.contains("request_firstline_uri_query_r_query:chararray"), "Missing Casts Remapped URI R QueryString");
        assertTrue(theValue.contains("request_firstline_uri_query_r_query__:map[]"), "Missing Casts Remapped URI R Query Parameters");
    }

    @Test
    void fieldsBareExampleTest() throws Exception {
        PigServer pigServer = new PigServer(ExecType.LOCAL);
        Storage.Data data = resetData(pigServer);

        pigServer.registerQuery(
            "Example = " +
                "    LOAD '" + getClass().getResource("/access.log") + "' " +
                "    USING nl.basjes.pig.input.apachehttpdlog.Loader(" +
                "          '" + LOGFORMAT + "'" +
                "    );"
        );

        pigServer.registerQuery("STORE Example INTO 'Example' USING mock.Storage();");

        List<Tuple> out = data.get("Example");

        // Check the basics
        assertEquals(1, out.size());
        assertEquals(1, out.get(0).size());

        String theValue = out.get(0).get(0).toString();

        LOG.info("Result is {}", theValue);
        assertTrue(theValue.contains("nl.basjes.pig.input.apachehttpdlog.Loader"));

        assertTrue(!theValue.contains("''"), "Empty field");

        assertTrue(theValue.contains("HTTP.URI:request.firstline.uri"), "Missing Base URI");
        assertTrue(theValue.contains("HTTP.QUERYSTRING:request.firstline.uri.query"), "Missing Base QueryString");
        assertTrue(theValue.contains("STRING:request.firstline.uri.query.*"), "Missing Base Query Parameters");

        // Casts of values
        assertTrue(theValue.contains("request_firstline_uri:chararray"), "Missing Casts Base URI");
        assertTrue(theValue.contains("request_firstline_uri_query:chararray"), "Missing Casts Base QueryString");
        assertTrue(theValue.contains("request_firstline_uri_query__:map[]"), "Missing Casts Base Query Parameters");
    }

}


text:
namespace app {
namespace Uno {
namespace Collections {

::uInterfaceType* IList__Uno_Graphics_PolygonFace__typeof();

struct IList__Uno_Graphics_PolygonFace
{
    int(*__fp_get_Item)(void*, int);
    void(*__fp_RemoveAt)(void*, int);

    static int Item(::uObject* __this, int index) { return ((IList__Uno_Graphics_PolygonFace*)uGetInterfacePtr(__this, IList__Uno_Graphics_PolygonFace__typeof()))->__fp_get_Item((::uByte*)__this + (__this->__obj_type->TypeType == uTypeTypeStruct ? sizeof(::uObject) : 0), index); }
    static void RemoveAt(::uObject* __this, int index) { ((IList__Uno_Graphics_PolygonFace*)uGetInterfacePtr(__this, IList__Uno_Graphics_PolygonFace__typeof()))->__fp_RemoveAt((::uByte*)__this + (__this->__obj_type->TypeType == uTypeTypeStruct ? sizeof(::uObject) : 0), index); }
};

}}}

#endif


text:
'use strict';

var $ = require('cheerio');

var MetadataParser = function(){};

MetadataParser.prototype.getCommentTags = function(){
	var tag = 'gconfig';
    var end = '@gconfig';
    var matcher = new RegExp('<!--\\s*'+tag+'\\s*-->([\\s\\S]*?)<!--\\s*'+end+'\\s*-->', 'igm');
};

MetadataParser.prototype.extractMetadata = function(metadata){
    var output = {}, name, content, namespace, key;
    metadata.map(function(i, meta){
        meta = $(meta);
        if(meta.attr('name') && meta.attr('name').indexOf(':')){
            name = meta.attr('name').split(':');
            content = meta.attr('content');
            namespace = name[0];
            key = name[1];
            if(! (namespace in output)) output[namespace] = {};
            output[namespace][key] = content;
        }
    });
    return output;
};

MetadataParser.prototype.buildMetadata = function(data){
    var metadata = {}, tags=[], name, content, html;
    Object.keys(data).forEach(function(namespace){
        Object.keys(data[namespace]).forEach(function(item){
            name = namespace+':'+item;
            content = data[namespace][item];
            html = '<meta name="'+name+'" content="'+content+'">';
            tags.push(html);
            metadata[name] = {name:name, content:content, html:html};
            // metadata.push({name:name, content:content, html:html});
        });
    });
    metadata.html = tags;
    return metadata;
};

module.exports = MetadataParser;


text:
create class test_class
  class attribute (create_date date, author varchar(10))
  (col1 set varchar(10));

insert into test_class values({'Jerry', 'Tom', 'Disney'});
update class test_class set (create_date, author) = (to_date('20080405','yyyymmdd'), 'NHN');

select attr_name, attr_type, data_type, domain_class_name
from   db_attr_setdomain_elm
where  class_name = 'test_class';

drop class test_class;


text:
package main

import (
  "net/http"

  "github.com/gorilla/context"
  "github.com/julienschmidt/httprouter"
)

type router struct {
  *httprouter.Router
}

func (r *router) Get(path string, handler http.Handler) {
  r.GET(path, wrapHandler(handler))
}

func (r *router) Post(path string, handler http.Handler) {
  r.POST(path, wrapHandler(handler))
}

func (r *router) Put(path string, handler http.Handler) {
  r.PUT(path, wrapHandler(handler))
}

func (r *router) Delete(path string, handler http.Handler) {
  r.DELETE(path, wrapHandler(handler))
}

func NewRouter() *router {
  return &router{httprouter.New()}
}

func wrapHandler(h http.Handler) httprouter.Handle {
  return func(w http.ResponseWriter, r *http.Request, ps httprouter.Params) {
    context.Set(r, "params", ps)
    h.ServeHTTP(w, r)
  }
}


text:
<?php

include __DIR__ . '/../bootstrap.php';

class CrossbarTest extends PHPUnit_Framework_TestCase
{

    /**
     * @var \Thruway\Connection
     */
    protected $_conn;
    protected $_error;
    protected $_testArgs;
    protected $_testKWArgs;
    protected $_publicationId;
    protected $_details;
    protected $_testResult;
    protected $_echoResult;

    public function setUp()
    {
        $this->_testArgs   = null;
        $this->_testResult = null;
        $this->_error      = null;

        $this->_conn = new \Thruway\Connection(
            [
                "realm"       => 'realm1',
                "url"         => 'ws://127.0.0.1:8080/ws',
                "max_retries" => 0,
            ]
        );
    }

    public function testCall()
    {

        $this->_conn->on(
            'open',
            function (\Thruway\ClientSession $session) {

                for ($x = 0; $x <= 10; $x++) {
                    $session->call('com.example.add2', [$x, 18])->then(
                        function ($res) use ($x) {

                            $this->_testResult = $res;

                            if ($res[0] >= 28 || $x >= 10) {
                                $this->_conn->close();
                            }

                        },
                        function ($error) {
                            $this->_conn->close();
                            $this->_error = $error;
                        }
                    );

                }
            }
        );

        $this->_conn->open();

        $this->assertNull($this->_error, "Got this error when making an RPC call: {$this->_error}");
        $this->assertTrue(is_numeric($this->_testResult[0]));
        $this->assertEquals(28, $this->_testResult[0]);
    }

    public function testSubscribe()
    {
        $this->_conn->on('open', function (\Thruway\ClientSession $session) {

            $session->subscribe('com.example.oncounter', function ($args) {
                $this->_conn->close();
                $this->_testArgs = $args;
            });
        });

        $this->_conn->open();

        $this->assertGreaterThan(0, $this->_testArgs[0]);
    }

    public function testRegister()
    {
        $this->_conn->on('open', function (\Thruway\ClientSession $session) {

            $session->register('com.example.mul2', function ($args) {
                $this->_conn->close();
                $this->_testArgs = $args;

            });
        });

        $this->_conn->open();

        $this->assertGreaterThan(0, $this->_testArgs[0]);
    }

}


text:
package org.aml.core.mappings;

public @interface create {

	String value();
}


text:
package org.earthtime.UPb_Redux.dateInterpretation.vermeeschKDE;

import java.io.*;
import java.util.*;

/**
 *
 * @author James F. Bowring
 */
public abstract class Data implements Iterator, Iterable {

    /**
     *
     * @param fn
     * @param preferences
     */
    public Data(String fn, Preferences preferences) {
        X = new ArrayList<Double>();
        Y = new ArrayList<Double>();
        Z = new ArrayList<Double>();
        z = new ArrayList<Double>();
        sigma = new ArrayList<Double>();
        C = new ArrayList<Double>();
        radialX = new ArrayList<Double>();
        radialY = new ArrayList<Double>();
        setFileName(fn);
        this.preferences = preferences;
    }

    /**
     *
     * @param X
     * @param Y
     * @param Z
     * @param preferences
     */
    public Data(ArrayList<Double> X, ArrayList<Double> Y, ArrayList<Double> Z, Preferences preferences){
        this("reduxData", preferences);
        this.X = X;
        this.Y = Y;
        this.Z = Z;
    }

    /**
     *
     * @return
     */
    public Preferences preferences(){
        return preferences;
    }

    /* check to see if the input file contains -as its second entry-
     * "F" (Fission tracks = 0), "L" (Luminescence = 1) or "O" (Other = 2).
     * If not, return -1
     */

    /**
     *
     * @param fn
     * @return
     * @throws Exception
     */

    static public boolean isFissionTrackFile(String fn) throws Exception {
        String aLine;
        char datatype = 'F';
        try {
            //System.out.println("Loading: " + fn);
            FileInputStream fin = new FileInputStream(fn);
            BufferedReader br = new BufferedReader(new InputStreamReader(fin));
            // extract sample name
            aLine = br.readLine();
            StringTokenizer stokenizer = new StringTokenizer(aLine, ",");
            int numtokens = stokenizer.countTokens();
            stokenizer.nextToken();
            if (numtokens == 1) {
                return false;
            } else if (numtokens == 2){
                datatype = stokenizer.nextToken().charAt(0);
            }
            if (datatype=='F'){
                return true;
            } else {
                return false;
            }
        } catch (Exception e){
            System.err.println("Problem with Data.getDataType()");
            return false;
        }
    }

    /**
     *
     * @throws Exception
     */
    public void readData() throws Exception {
        String aLine;
        if (filename.equals("")){return;}
        try {
            //System.out.println("Loading: " + filename);
            FileInputStream fin = new FileInputStream(getFileName());
            BufferedReader br = new BufferedReader(new InputStreamReader(fin));
            // extract sample name
            aLine = br.readLine();
            StringTokenizer stokenizer = new StringTokenizer(aLine, ",");
            int numtokens = stokenizer.countTokens();
            samplename = stokenizer.nextToken();
            if (numtokens == 2){
                stokenizer.nextToken();
            }
            readHeaderAndBody(br);
            br.close();
        } catch (FileNotFoundException e){
            System.err.println("Couldn't find file: " + filename);
            this.setFileName("");
        } catch (Exception e) {
            System.err.println("Problem in Data:readData()");
        }
    }

    int getRowNumber(int samplenumber) throws Exception {
        int sn = 0;
        for (Iterator i = iterator(); i.hasNext(); i.next()) {
            if (sn >= samplenumber){
                break;
            } else {
                sn++;
            }
        }
        return ii;
    }

    abstract void readHeaderAndBody(BufferedReader br) throws Exception;

    /**
     *
     * @param br
     * @throws Exception
     */
    public void readBody(BufferedReader br) throws Exception {
        String aLine;
        int numtokens = 1;
        try {
            // extract the X, (optional) Y and (optional) Z data
            for (int i=0; (aLine = br.readLine()) != null ; i++) {
                StringTokenizer st = new StringTokenizer(aLine, ",");
                numtokens = st.countTokens();
                this.setX(Double.parseDouble(st.nextToken()),i);
                if (numtokens > 1) {
                    this.setY(Double.parseDouble(st.nextToken()),i);
                } else {
                    this.setY(NAN, i);
                }
                if (numtokens == 3) {
                    this.setZ(Double.parseDouble(st.nextToken()),i);
                } else {
                    this.setZ(NAN, i);
                }
            }
        } catch (Exception e){
            System.err.println("Error in Data.readBody(), error reading: " + filename);
        }
    }

    abstract void data2rxry(boolean fixedAxes) throws Exception ;

    abstract void writeOutput(String filepath) throws Exception ;

    /**
     *
     * @param out
     * @throws Exception
     */
    protected void writeBody(BufferedWriter out) throws Exception {
        String nl = System.getProperties().getProperty("line.separator");
        try {
            double[] XYZ;
            double c;
            for (Iterator i= this.iterator(); i.hasNext(); ) {
                XYZ = (double[]) i.next();
                c = XYZ[2];
                this.writeXY(out, XYZ[0], XYZ[1]);
                if (c >=0) {
                    out.write("," + c);
                }
                out.write(nl);
            }
            out.close();
        } catch (IOException e) {
            System.err.println("Problem in Data.writeBody()");
        }
    }

    /**
     *
     * @param out
     * @param X
     * @param Y
     * @throws Exception
     */
    protected void writeXY(BufferedWriter out, double X, double Y) throws Exception{
        out.write(X + "," + Y);
    }

    abstract double z02t(double z0) throws Exception ;

    /* returns 3-element array of central age, its standard error and age dispersion*/
    abstract double[] getCentralAge() throws Exception ;

    abstract double getPooledAge() throws Exception;

    abstract double[] getArithmeticMean() throws Exception;

    /* convert an age t (in years) to the corresponding radial plot parameter z
     * you should run data2rxry(plotoption,fixedaxes) before this function
     */
    abstract double t2z(double t) throws Exception ;

    /**
     *
     * @param doLog
     * @return
     * @throws Exception
     */
    public double[] getMinMaxAgeErr(boolean doLog) throws Exception {
        double[][] dea = this.getDataErrArray(doLog);
        double[] minmaxterr = {MINT,MAXT, 0, 0}; // initialise to some ridiculous values
        for (int i=0; i<dea[0].length; i++){
            if (dea[0][i]<minmaxterr[0]){
                minmaxterr[0] = dea[0][i];
                minmaxterr[2] = dea[1][i];
            }
            if (dea[0][i]>minmaxterr[1]){
                minmaxterr[1] = dea[0][i];
                minmaxterr[3] = dea[1][i];
            }
        }
        return minmaxterr;
    };

    double[] getMinMaxAge() throws Exception{
        double[] minmaxterr = getMinMaxAgeErr(false),
                 out = {minmaxterr[0],minmaxterr[1]};
        return out;
    }

    double getMinAge() throws Exception {
        double[] mM = getMinMaxAge();
        return mM[0];
    }

    double getMaxAge() throws Exception {
        double[] mM = getMinMaxAge();
        return mM[1];
    }

    double[] getMinMaxC() throws Exception {
        double c;
        double[] minmaxc = {1e10,1e-10};// initialize to some ridiculous values
        double[] XYZ;
        for (Iterator i= iterator(); i.hasNext(); ) {
            XYZ = (double[]) i.next();
            c = XYZ[2];
            if (c<minmaxc[0] && c!= Data.NAN){
                minmaxc[0] = c;
            }
            if (c>minmaxc[1] && c!= Data.NAN){
                minmaxc[1] = c;
            }
        }
        return minmaxc;
    };

    /**
     *
     * @param index
     * @return
     * @throws Exception
     */
    public double getC(int index) throws Exception {
        return C.get(index);
    }

//    Reloads the data from filename if you have changed it

    /**
     *
     * @throws Exception
     */
        public void reload() throws Exception {
        this.clear();
        readData();
    }

    /**
     *
     * @throws Exception
     */
    public void clear() throws Exception {
        X.clear();
        Y.clear();
        Z.clear();
        z.clear();
        sigma.clear();
        C.clear();
        radialX.clear();
        radialY.clear();
    }

    /**
     *
     * @return
     */
    public int getSize(){
        return X.size();
    }

    /**
     *
     * @param index
     * @return
     */
    public double getY(int index) {
        return Y.get(index);
    }

    /**
     *
     * @param value
     * @param index
     */
    public void setY(double value, int index) {
        // recursively extend the ArrayList if necessary
        if (index<Y.size()){
            Y.set(index, value);
        } else {
            X.add(NAN);
            Y.add(NAN);
            Z.add(NAN);
            setY(value,index);
        }
    }

    /**
     *
     * @param index
     * @return
     */
    public double getX(int index) {
        return X.get(index);
    }

    /**
     *
     * @param value
     * @param index
     */
    public void setX(double value, int index) {
        // recursively extend the ArrayList if necessary
        if (index<X.size()){
            X.set(index, value);
        } else {
            X.add(NAN);
            Y.add(NAN);
            Z.add(NAN);
            setX(value,index);
        }
    }

    /**
     *
     * @param index
     * @return
     */
    public double getZ(int index) {
        return Z.get(index);
    }

    /**
     *
     * @param value
     * @param index
     */
    public void setZ(double value, int index) {
        // recursively extend the ArrayList if necessary
        if (index<Z.size()){
            Z.set(index, value);
        } else {
            X.add(NAN);
            Y.add(NAN);
            Z.add(NAN);
            setZ(value,index);
        }
    }

    /**
     *
     * @return
     */
    public String getSampleName(){
        return samplename;
    }

    /**
     *
     * @param samplename
     */
    public void setSampleName(String samplename){
        this.samplename = samplename;
    }

    /**
     *
     * @param x
     * @param y
     * @param index
     * @throws Exception
     */
    public void insertEntry(double x, double y, int index) throws Exception {
        this.insertEntry(x, y, NAN, index);
    }

    /**
     *
     * @param x
     * @param y
     * @param c
     * @param index
     * @throws Exception
     */
    public void insertEntry(double x, double y, double c, int index) throws Exception {
        X.add(index, x);
        Y.add(index, y);
        Z.add(index, c);
    }

    /**
     *
     * @param index
     * @throws Exception
     */
    public void removeEntry(int index) throws Exception {
        Y.remove(index);
        X.remove(index);
        Z.remove(index);
    }

    /**
     *
     * @param fn
     */
    public void setFileName(String fn){
        filename = fn;
    }

    /**
     *
     * @return
     */
    public String getFileName(){
        return filename;
    }

    /* checks to see if there are any instances where X = 0
     * (to be used to automatically assign arcsin transformation)
     */

    /**
     *
     * @return
     * @throws Exception
     */

    public boolean hasZeros() throws Exception {
        double xyj;
        double[] XY;
        for (Iterator i= this.iterator(); i.hasNext(); ){
            XY = (double[]) i.next();
            xyj = XY[0];
            if (xyj == 0){
                return true;
            }
        }
        return false;
    }

    abstract double[][] getDataErrArray(boolean doLog) throws Exception;

    abstract double[] zs2ts(double z, double s) throws Exception ;

    /**
     *
     * @param z
     * @param sigma
     * @return
     * @throws Exception
     */
    public double[] zs2rxry(double z, double sigma) throws Exception {
        double[] xy = new double[2];
        xy[0] = 1/sigma;
        xy[1] = (z-z0)/sigma;
        return xy;
    }

    /**
     *
     * @param rx
     * @param ry
     * @return
     * @throws Exception
     */
    public double[] rxry2zs(double rx, double ry) throws Exception {
        double[] zs = new double[2];
        zs[1] = 1/rx;
        zs[0] = z0 + zs[1]*ry;
        return zs;
    }

    /**
     *
     * @return
     */
    public ArrayList<Double> getRadialX(){
        return this.radialX;
    }

    /**
     *
     * @return
     */
    public ArrayList<Double> getRadialY(){
        return this.radialY;
    }

    /* get the radial parameter z (not to be confused with the colour parameter Z!)*/

    /**
     *
     * @return
     */

    public ArrayList<Double> get_z(){
        return this.z;
    }

    /**
     *
     * @return
     */
    public ArrayList<Double> get_sigma(){
        return this.sigma;
    }

    /**
     *
     * @return
     */
    public double get_z0(){
        return this.z0;
    }

    /**
     *
     * @param z0
     */
    public void set_z0(double z0){
        this.z0 = z0;
    }

    /* checks to see if there are at least 2 instances where the third
     * data column !=0, in order to see if a colour scale should be plotted
     */

    /**
     *
     * @return
     * @throws Exception
     */

    public boolean hasColour() throws Exception {
        double zj;
        int numGTzero = 0; // number of instances where z>=0
        double[] XYZ;
        for (Iterator i= this.iterator(); i.hasNext(); ){
            XYZ = (double[]) i.next();
            zj = XYZ[2];
            if (zj >= 0){
                numGTzero++;
            }
            if (numGTzero>=2){return true;}
        }
        return false;
    }

    /**
     *
     * @return
     */
    public int length(){
       int j = 0;
       for (Iterator i = this.iterator(); i.hasNext(); j++){ i.next(); }
       return j;
    }

    /**
     *
     * @return
     * @throws Exception
     */
    public int getNumPeaks() throws Exception {
        return numpeaks;
    }

    /**
     *
     * @param numpeaks
     * @throws Exception
     */
    public void setNumPeaks(int numpeaks) throws Exception {
        this.numpeaks = numpeaks;
    }

    /**
     *
     * @return
     * @throws Exception
     */
    public double getUnit() throws Exception {
        return this.unit;
    }

    /**
     *
     * @param unit
     * @throws Exception
     */
    public void setUnit(double unit) throws Exception {
        this.unit = unit;
    }

    /**
     *
     * @param data
     */
    public void copy(Data data){
        this.samplename = data.samplename;
        double[] XYZ;
        int j = 0;
        for (Iterator i= data.iterator(); i.hasNext(); ) {
            XYZ = (double[]) i.next();
            this.setX(XYZ[0], j);
            this.setY(XYZ[1], j);
            this.setZ(XYZ[2], j);
            j++;
        }
    }

    @Override
    public Iterator iterator() {
        ii = 0;
        // if the X, Y arrays are empty, return immediately
        if (this.X.size()==0){return this;}
        // if the first row is empty, find the first non-empty row
        if (this.getX(ii)==NAN){
            do {
            ii++;
            } while (hasNext() && (this.getX(ii)==NAN));
            return this;
        } else {
            return this;
        }
    }

    @Override
    public boolean hasNext() { return ii < this.getSize(); }

    @Override
    public double[] next() {
        double xx = (double) this.getX(ii);
        double yy = (double) this.getY(ii);
        double zz = this.getZ(ii);
        double[] XYZ = {xx,yy,zz};
        // put iterator in right position for next request
        do {
            ii++;
        } while (hasNext() && (this.getX(ii)==NAN));
        return XYZ;
    }

    @Override
    public void remove() {
        throw new UnsupportedOperationException("remove() in Data.java not implemented");
    }

   protected String filename,

    /**
     *
     */
    samplename = "";
   protected ArrayList<Double> Y,

    /**
     *
     */
    X,

    /**
     *
     */
    Z,

    /**
     *
     */
    C,

    /**
     *
     */
    z,

    /**
     *
     */
    sigma,

    /**
     *
     */
    radialX,

    /**
     *
     */
    radialY;

    /**
     *
     */
    protected int ii; // iterator index

    /**
     *
     */
    protected double z0 = 0.0;
   static final double NAN = -999.9, MINT = Double.MAX_VALUE, MAXT = 0d;
   static final boolean debugmode = true;

    /**
     *
     */
    public Preferences preferences;

    /**
     *
     */
    protected int numpeaks = 0;
   final static double GA = 1e9, MA = 1e6, KA = 1e3, A = 1;

    /**
     *
     */
    protected double unit = A;

    /**
     * @param Y the Y to set
     */
    public void setY ( ArrayList<Double> Y ) {
        this.Y = Y;
    }

    /**
     * @param X the X to set
     */
    public void setX ( ArrayList<Double> X ) {
        this.X = X;
    }

    /**
     * @param Z the Z to set
     */
    public void setZ ( ArrayList<Double> Z ) {
        this.Z = Z;
    }

}