text:
package org.apache.flink.runtime.resourcemanager.slotmanager;

import org.apache.flink.api.common.JobID;
import org.apache.flink.runtime.clusterframework.types.AllocationID;
import org.apache.flink.runtime.clusterframework.types.ResourceProfile;
import org.apache.flink.runtime.instance.InstanceID;
import org.apache.flink.runtime.util.ResourceCounter;

import java.util.Collection;
import java.util.Map;
import java.util.Optional;

/** Provide the information of TaskManager's resource and slot status. */
interface TaskManagerResourceInfoProvider {
    /**
     * Get the pending allocations of the given pending task manager.
     *
     * @param pendingTaskManagerId of the pending task manager
     * @return pending allocations, mapped by jobId
     */
    Map<JobID, ResourceCounter> getPendingAllocationsOfPendingTaskManager(
            PendingTaskManagerId pendingTaskManagerId);

    /**
     * Get the {@link TaskManagerInfo}s of all registered task managers.
     *
     * @return a collection of {@link TaskManagerInfo}s of all registered task managers.
     */
    Collection<? extends TaskManagerInfo> getRegisteredTaskManagers();

    /**
     * Get the {@link TaskManagerInfo} of a registered task manager with the given instanceId
     *
     * @param instanceId of the task manager
     * @return An Optional of {@link TaskManagerInfo}, if find, of the task manager
     */
    Optional<TaskManagerInfo> getRegisteredTaskManager(InstanceID instanceId);

    /**
     * Get all pending task managers.
     *
     * @return a collection of {@link PendingTaskManager}s.
     */
    Collection<PendingTaskManager> getPendingTaskManagers();

    /**
     * Get the {@link TaskManagerSlotInformation} of the allocated slot with the given allocationId.
     *
     * @param allocationId of the slot
     * @return An Optional of {@link TaskManagerSlotInformation}, if find, of the slot
     */
    Optional<TaskManagerSlotInformation> getAllocatedOrPendingSlot(AllocationID allocationId);

    /**
     * Get all pending task managers with given total and default slot profile.
     *
     * @param totalResourceProfile of the pending task manager
     * @param defaultSlotResourceProfile of the pending task manager
     * @return Collection of all matching pending task managers
     */
    Collection<PendingTaskManager> getPendingTaskManagersByTotalAndDefaultSlotResourceProfile(
            ResourceProfile totalResourceProfile, ResourceProfile defaultSlotResourceProfile);
}


text:
package org.jitsi.videobridge.rest.root;

import org.glassfish.jersey.server.*;
import org.jetbrains.annotations.*;
import org.jitsi.utils.version.*;
import org.jitsi.videobridge.*;
import org.jitsi.videobridge.health.*;
import org.jitsi.videobridge.rest.*;
import org.jitsi.videobridge.rest.binders.*;
import org.jitsi.videobridge.rest.filters.*;
import org.jitsi.videobridge.stats.*;
import org.jitsi.videobridge.xmpp.*;

import static org.jitsi.videobridge.rest.RestConfig.config;

public class Application extends ResourceConfig
{
    public Application(
            Videobridge videobridge,
            XmppConnection xmppConnection,
            StatsCollector statsCollector,
            @NotNull Version version,
            @NotNull JvbHealthChecker healthChecker)

    {
        register(
            new ServiceBinder(
                videobridge,
                xmppConnection,
                statsCollector,
                healthChecker
            )
        );
        // Filters
        register(ConfigFilter.class);
        // Register all resources in the package
        packages("org.jitsi.videobridge.rest.root");

        if (config.isEnabled(RestApis.HEALTH))
        {
            register(new org.jitsi.rest.Health(healthChecker));
        }
        if (config.isEnabled(RestApis.VERSION))
        {
            register(new org.jitsi.rest.Version(version));
        }
    }
}

redpajama_set_name: RedPajamaGithub


text:
import 'promise/polyfill';

import * as hapi from 'hapi';
import * as boom from 'boom';
import Resource from '../resource';
import * as Plugin from '../index';

import {GetResponse} from './GetResponse';
import {GetListRequestValidator} from './validators/validators';

export class GetListResponse extends GetResponse {
  protected _paginationQuery: {};

  constructor(request: hapi.Request, resource: Resource, query: {}, plugin: Plugin.HapiPlugin) {
    super(request, resource, resource.model.find(query, resource.options.fieldProjection), plugin);
    this._paginationQuery = query;
    this._validator = new GetListRequestValidator(this._request);

    this.__applySorting();
    this.__applyPagination();
  }

  private __applySorting: any = () => {
    if (this._request.query.sort) {
      if (this._resource.canSortBy(this._request.query.sort)) {
        let field = this._resource.unaliasKey(this._request.query.sort);
        this._query.sort(field);
      } else {
        this._lastError = boom.badRequest('bad sort field');
      }
    }
  };

  private __applyPagination(): void {
    let pageMeta: HashMapNumber = {
      offset: 0,
      limit: this._resource.options.pagination.limit,
      total: 0
    };

    if (this._request.query.page) {
      if (typeof this._request.query.page !== 'object') {
        this._lastError = boom.badRequest('invalid page');
        return;
      }
      if (this._request.query.page.offset) {
        pageMeta['offset'] = parseInt(this._request.query.page.offset, 10);
      }
      if (this._request.query.page.limit) {
        pageMeta['limit'] = parseInt(this._request.query.page.limit, 10);
      }
    }

    this._query.skip(pageMeta['offset']);
    this._query.limit(pageMeta['limit']);

    this._syncQuery((callback: Function) => {
      this._resource.model.count(this._paginationQuery, (err: any, count: number) => {
        pageMeta['total'] = count;
        this._jsonRecords.addMeta('page', pageMeta);
        callback(err);
      });
    });
  }
}


text:
// clfft.generator.Transpose.cpp : Dynamic run-time generator of openCL transpose kernels
//

// TODO: generalize the kernel to work with any size

#include "stdafx.h"

#include <math.h>
#include <iomanip>

#include "generator.transpose.gcn.h"
#include "generator.stockham.h"

#include "action.h"

FFTGeneratedTransposeGCNAction::FFTGeneratedTransposeGCNAction(clfftPlanHandle plHandle, FFTPlan * plan, cl_command_queue queue, clfftStatus & err)
    : FFTTransposeGCNAction(plHandle, plan, queue, err)
{
    if (err != CLFFT_SUCCESS)
    {
        // FFTTransposeGCNAction() failed, exit
        fprintf(stderr, "FFTTransposeGCNAction() failed!\n");
        return;
    }

    // Initialize the FFTAction::FFTKernelGenKeyParams member
    err = this->initParams();

    if (err != CLFFT_SUCCESS)
    {
        fprintf(stderr, "FFTGeneratedTransposeGCNAction::initParams() failed!\n");
        return;
    }

    FFTRepo &fftRepo = FFTRepo::getInstance();

    err = this->generateKernel(fftRepo, queue);

    if (err != CLFFT_SUCCESS)
    {
        fprintf(stderr, "FFTGeneratedTransposeGCNAction::generateKernel failed\n");
        return;
    }

    err = compileKernels( queue, plHandle, plan);

    if (err != CLFFT_SUCCESS)
    {
        fprintf(stderr, "FFTGeneratedTransposeGCNAction::compileKernels failed\n");
        return;
    }

    err = CLFFT_SUCCESS;
}

bool FFTGeneratedTransposeGCNAction::buildForwardKernel()
{
    clfftLayout inputLayout = this->getSignatureData()->fft_inputLayout;
    clfftLayout outputLayout = this->getSignatureData()->fft_outputLayout;

    bool r2c_transform = (inputLayout == CLFFT_REAL);
    bool c2r_transform = (outputLayout == CLFFT_REAL);
    bool real_transform = (r2c_transform || c2r_transform);

    return (!real_transform) || r2c_transform;
}

bool FFTGeneratedTransposeGCNAction::buildBackwardKernel()
{
    clfftLayout inputLayout = this->getSignatureData()->fft_inputLayout;
    clfftLayout outputLayout = this->getSignatureData()->fft_outputLayout;

    bool r2c_transform = (inputLayout == CLFFT_REAL);
    bool c2r_transform = (outputLayout == CLFFT_REAL);
    bool real_transform = (r2c_transform || c2r_transform);

    return (!real_transform) || c2r_transform;
}

// A structure that represents a bounding box or tile, with convenient names for the row and column addresses
// local work sizes
struct tile
{
    union
    {
        size_t x;
        size_t col;
    };

    union
    {
        size_t y;
        size_t row;
    };
};

inline std::stringstream& clKernWrite( std::stringstream& rhs, const size_t tabIndex )
{
    rhs << std::setw( tabIndex ) << "";
    return rhs;
}

static void OffsetCalc(std::stringstream& transKernel, const FFTKernelGenKeyParams& params, bool input )
{
	const size_t *stride = input ? params.fft_inStride : params.fft_outStride;
	std::string offset = input ? "iOffset" : "oOffset";

	clKernWrite( transKernel, 3 ) << "size_t " << offset << " = 0;" << std::endl;
	clKernWrite( transKernel, 3 ) << "currDimIndex = groupIndex.y;" << std::endl;

	for(size_t i = params.fft_DataDim - 2; i > 0 ; i--)
	{
		clKernWrite( transKernel, 3 ) << offset << " += (currDimIndex/numGroupsY_" << i << ")*" << stride[i+1] << ";" << std::endl;
		clKernWrite( transKernel, 3 ) << "currDimIndex = currDimIndex % numGroupsY_" << i << ";" << std::endl;
	}

	clKernWrite( transKernel, 3 ) << "rowSizeinUnits = " << stride[1] << ";" << std::endl;

	if(params.transOutHorizontal)
	{
		if(input)
		{
			clKernWrite( transKernel, 3 ) << offset << " += rowSizeinUnits * wgTileExtent.y * wgUnroll * groupIndex.x;" << std::endl;
			clKernWrite( transKernel, 3 ) << offset << " += currDimIndex * wgTileExtent.x;" << std::endl;
		}
		else
		{
			clKernWrite( transKernel, 3 ) << offset << " += rowSizeinUnits * wgTileExtent.x * currDimIndex;" << std::endl;
			clKernWrite( transKernel, 3 ) << offset << " += groupIndex.x * wgTileExtent.y * wgUnroll;" << std::endl;
		}
	}
	else
	{
		if(input)
		{
			clKernWrite( transKernel, 3 ) << offset << " += rowSizeinUnits * wgTileExtent.y * wgUnroll * currDimIndex;" << std::endl;
			clKernWrite( transKernel, 3 ) << offset << " += groupIndex.x * wgTileExtent.x;" << std::endl;
		}
		else
		{
			clKernWrite( transKernel, 3 ) << offset << " += rowSizeinUnits * wgTileExtent.x * groupIndex.x;" << std::endl;
			clKernWrite( transKernel, 3 ) << offset << " += currDimIndex * wgTileExtent.y * wgUnroll;" << std::endl;
		}
	}

	clKernWrite( transKernel, 3 ) << std::endl;
}

// Small snippet of code that multiplies the twiddle factors into the butterfiles.  It is only emitted if the plan tells
// the generator that it wants the twiddle factors generated inside of the transpose
static clfftStatus genTwiddleMath( const FFTKernelGenKeyParams& params, std::stringstream& transKernel, const std::string& dtComplex, bool fwd )
{
    clKernWrite( transKernel, 9 ) << dtComplex << " W = TW3step( (groupIndex.x * wgTileExtent.x + xInd) * (currDimIndex * wgTileExtent.y * wgUnroll + yInd) );" << std::endl;
    clKernWrite( transKernel, 9 ) << dtComplex << " T;" << std::endl;

	if(fwd)
	{
		clKernWrite( transKernel, 9 ) << "T.x = ( W.x * tmp.x ) - ( W.y * tmp.y );" << std::endl;
		clKernWrite( transKernel, 9 ) << "T.y = ( W.y * tmp.x ) + ( W.x * tmp.y );" << std::endl;
	}
	else
	{
		clKernWrite( transKernel, 9 ) << "T.x =  ( W.x * tmp.x ) + ( W.y * tmp.y );" << std::endl;
		clKernWrite( transKernel, 9 ) << "T.y = -( W.y * tmp.x ) + ( W.x * tmp.y );" << std::endl;
	}

    clKernWrite( transKernel, 9 ) << "tmp.x = T.x;" << std::endl;
    clKernWrite( transKernel, 9 ) << "tmp.y = T.y;" << std::endl;

    return CLFFT_SUCCESS;
}

// These strings represent the names that are used as strKernel parameters
const std::string pmRealIn( "pmRealIn" );
const std::string pmImagIn( "pmImagIn" );
const std::string pmRealOut( "pmRealOut" );
const std::string pmImagOut( "pmImagOut" );
const std::string pmComplexIn( "pmComplexIn" );
const std::string pmComplexOut( "pmComplexOut" );

static clfftStatus genTransposePrototype( const FFTGeneratedTransposeGCNAction::Signature & params, const tile& lwSize, const std::string& dtPlanar, const std::string& dtComplex,
                                         const std::string &funcName, std::stringstream& transKernel, std::string& dtInput, std::string& dtOutput )
{

    // Declare and define the function
    clKernWrite( transKernel, 0 ) << "__attribute__(( reqd_work_group_size( " << lwSize.x << ", " << lwSize.y << ", 1 ) ))" << std::endl;
    clKernWrite( transKernel, 0 ) << "kernel void" << std::endl;

    clKernWrite( transKernel, 0 ) << funcName << "( ";

    switch( params.fft_inputLayout )
    {
    case CLFFT_COMPLEX_INTERLEAVED:
        dtInput = dtComplex;
        clKernWrite( transKernel, 0 ) << "global " << dtInput << "* restrict " << pmComplexIn;

        switch( params.fft_placeness )
        {
        case CLFFT_INPLACE:
            dtOutput = dtComplex;
            break;
        case CLFFT_OUTOFPLACE:
            switch( params.fft_outputLayout )
            {
            case CLFFT_COMPLEX_INTERLEAVED:
                dtOutput = dtComplex;
                clKernWrite( transKernel, 0 ) << ", global " << dtOutput << "* restrict " << pmComplexOut;
                break;
            case CLFFT_COMPLEX_PLANAR:
                dtOutput = dtPlanar;
                clKernWrite( transKernel, 0 ) << ", global " << dtOutput << "* restrict " << pmRealOut
                    << ", global " << dtOutput << "* restrict " << pmImagOut;
                break;
            case CLFFT_HERMITIAN_INTERLEAVED:
            case CLFFT_HERMITIAN_PLANAR:
            case CLFFT_REAL:
            default:
                return CLFFT_TRANSPOSED_NOTIMPLEMENTED;
            }
            break;
        default:
            return CLFFT_TRANSPOSED_NOTIMPLEMENTED;
        }
        break;
    case CLFFT_COMPLEX_PLANAR:
        dtInput = dtPlanar;
        clKernWrite( transKernel, 0 ) << "global " << dtInput << "* restrict " << pmRealIn << ", global " << dtInput << "* restrict " << pmImagIn;

        switch( params.fft_placeness )
        {
        case CLFFT_INPLACE:
            dtOutput = dtPlanar;
            break;
        case CLFFT_OUTOFPLACE:
            switch( params.fft_outputLayout )
            {
            case CLFFT_COMPLEX_INTERLEAVED:
                dtOutput = dtComplex;
                clKernWrite( transKernel, 0 ) << ", global " << dtOutput << "* restrict " << pmComplexOut;
                break;
            case CLFFT_COMPLEX_PLANAR:
                dtOutput = dtPlanar;
                clKernWrite( transKernel, 0 ) << ", global " << dtOutput << "* restrict " << pmRealOut
                    << ", global " << dtOutput << "* restrict " << pmImagOut;
                break;
            case CLFFT_HERMITIAN_INTERLEAVED:
            case CLFFT_HERMITIAN_PLANAR:
            case CLFFT_REAL:
            default:
                return CLFFT_TRANSPOSED_NOTIMPLEMENTED;
            }
            break;
        default:
            return CLFFT_TRANSPOSED_NOTIMPLEMENTED;
        }
        break;
    case CLFFT_HERMITIAN_INTERLEAVED:
    case CLFFT_HERMITIAN_PLANAR:
		return CLFFT_TRANSPOSED_NOTIMPLEMENTED;
    case CLFFT_REAL:
		dtInput = dtPlanar;
		clKernWrite( transKernel, 0 ) << "global " << dtInput << "* restrict " << pmRealIn;

		switch( params.fft_placeness )
        {
        case CLFFT_INPLACE:
            dtOutput = dtPlanar;
            break;
        case CLFFT_OUTOFPLACE:
            switch( params.fft_outputLayout )
            {
            case CLFFT_COMPLEX_INTERLEAVED:
            case CLFFT_COMPLEX_PLANAR:
            case CLFFT_HERMITIAN_INTERLEAVED:
            case CLFFT_HERMITIAN_PLANAR:
				return CLFFT_TRANSPOSED_NOTIMPLEMENTED;
            case CLFFT_REAL:
                dtOutput = dtPlanar;
                clKernWrite( transKernel, 0 ) << ", global " << dtOutput << "* restrict " << pmRealOut;
				break;
            default:
                return CLFFT_TRANSPOSED_NOTIMPLEMENTED;
            }
            break;
        default:
            return CLFFT_TRANSPOSED_NOTIMPLEMENTED;
        }
		break;
    default:
        return CLFFT_TRANSPOSED_NOTIMPLEMENTED;
    }

	if (params.fft_hasPreCallback)
	{
		assert(!params.fft_hasPostCallback);

		if (params.fft_preCallback.localMemSize > 0)
		{
			clKernWrite( transKernel, 0 ) << ", __global void* pre_userdata, __local void* localmem";
		}
		else
		{
			clKernWrite( transKernel, 0 ) << ", __global void* pre_userdata";
		}
	}

	if (params.fft_hasPostCallback)
	{
		assert(!params.fft_hasPreCallback);

		if (params.fft_postCallback.localMemSize > 0)
		{
			clKernWrite( transKernel, 0 ) << ", __global void* post_userdata, __local void* localmem";
		}
		else
		{
			clKernWrite( transKernel, 0 ) << ", __global void* post_userdata";
		}
	}

    // Close the method signature
    clKernWrite( transKernel, 0 ) << " )\n{" << std::endl;

    return CLFFT_SUCCESS;
}

static clfftStatus genTransposeKernel( const FFTGeneratedTransposeGCNAction::Signature & params, std::string& strKernel, const tile& lwSize, const size_t reShapeFactor,
                                            const size_t loopCount, const tile& blockSize )
{
    strKernel.reserve( 4096 );
    std::stringstream transKernel( std::stringstream::out );

    // These strings represent the various data types we read or write in the kernel, depending on how the plan
    // is configured
    std::string dtInput;        // The type read as input into kernel
    std::string dtOutput;       // The type written as output from kernel
    std::string dtPlanar;       // Fundamental type for planar arrays
    std::string dtComplex;      // Fundamental type for complex arrays

    // NOTE:  Enable only for debug
    // clKernWrite( transKernel, 0 ) << "#pragma OPENCL EXTENSION cl_amd_printf : enable\n" << std::endl;

    switch( params.fft_precision )
    {
    case CLFFT_SINGLE:
    case CLFFT_SINGLE_FAST:
        dtPlanar = "float";
        dtComplex = "float2";
        break;
    case CLFFT_DOUBLE:
    case CLFFT_DOUBLE_FAST:
        dtPlanar = "double";
        dtComplex = "double2";

        // Emit code that enables double precision in the kernel
        clKernWrite( transKernel, 0 ) << "#ifdef cl_khr_fp64" << std::endl;
        clKernWrite( transKernel, 3 ) << "#pragma OPENCL EXTENSION cl_khr_fp64 : enable" << std::endl;
        clKernWrite( transKernel, 0 ) << "#else" << std::endl;
        clKernWrite( transKernel, 3 ) <<  "#pragma OPENCL EXTENSION cl_amd_fp64 : enable" << std::endl;
        clKernWrite( transKernel, 0 ) << "#endif\n" << std::endl;
        break;
    default:
        return CLFFT_TRANSPOSED_NOTIMPLEMENTED;
        break;
    }

	//	If twiddle computation has been requested, generate the lookup function
	if(params.fft_3StepTwiddle)
	{
		std::string str;
		StockhamGenerator::TwiddleTableLarge twLarge(params.fft_N[0] * params.fft_N[1]);
		if( (params.fft_precision == CLFFT_SINGLE) || (params.fft_precision == CLFFT_SINGLE_FAST) )
			twLarge.GenerateTwiddleTable<StockhamGenerator::P_SINGLE>(str);
		else
			twLarge.GenerateTwiddleTable<StockhamGenerator::P_DOUBLE>(str);
		clKernWrite( transKernel, 0 ) << str << std::endl;
		clKernWrite( transKernel, 0 ) << std::endl;
	}

    clKernWrite( transKernel, 0 ) << "// Local structure to embody/capture tile dimensions" << std::endl;
    clKernWrite( transKernel, 0 ) << "typedef struct tag_Tile" << std::endl;
    clKernWrite( transKernel, 0 ) << "{" << std::endl;
    clKernWrite( transKernel, 3 ) << "size_t x;" << std::endl;
    clKernWrite( transKernel, 3 ) << "size_t y;" << std::endl;
    clKernWrite( transKernel, 0 ) << "} Tile;" << std::endl << std::endl;

    if( params.fft_placeness == CLFFT_INPLACE )
		return CLFFT_TRANSPOSED_NOTIMPLEMENTED;

	//If pre-callback is set for the plan
	if (params.fft_hasPreCallback)
	{
		//Insert callback function code at the beginning
		clKernWrite( transKernel, 0 ) << params.fft_preCallback.funcstring << std::endl;
		clKernWrite( transKernel, 0 ) << std::endl;
	}

	//If post-callback is set for the plan
	if (params.fft_hasPostCallback)
	{
		//Insert callback function code at the beginning
		clKernWrite( transKernel, 0 ) << params.fft_postCallback.funcstring << std::endl;
		clKernWrite( transKernel, 0 ) << std::endl;
	}

	for(size_t bothDir=0; bothDir<2; bothDir++)
	{
		//	Generate the kernel entry point and parameter list
		//
		bool fwd = bothDir ? false : true;

		std::string funcName;
		if(params.fft_3StepTwiddle)
			funcName = fwd ? "transpose_gcn_tw_fwd" : "transpose_gcn_tw_back";
		else
			funcName = "transpose_gcn";

		genTransposePrototype( params, lwSize, dtPlanar, dtComplex, funcName, transKernel, dtInput, dtOutput );

		clKernWrite( transKernel, 3 ) << "const Tile localIndex = { get_local_id( 0 ), get_local_id( 1 ) }; " << std::endl;
		clKernWrite( transKernel, 3 ) << "const Tile localExtent = { get_local_size( 0 ), get_local_size( 1 ) }; " << std::endl;
		clKernWrite( transKernel, 3 ) << "const Tile groupIndex = { get_group_id( 0 ), get_group_id( 1 ) };" << std::endl;
		clKernWrite( transKernel, 3 ) << std::endl;

		clKernWrite( transKernel, 3 ) << "// Calculate the unit address (in terms of datatype) of the beginning of the Tile for the WG block" << std::endl;
		clKernWrite( transKernel, 3 ) << "// Transpose of input & output blocks happens with the Offset calculation" << std::endl;
		clKernWrite( transKernel, 3 ) << "const size_t reShapeFactor = " << reShapeFactor << ";" << std::endl;
		clKernWrite( transKernel, 3 ) << "const size_t wgUnroll = " << loopCount << ";" << std::endl;
		clKernWrite( transKernel, 3 ) << "const Tile wgTileExtent = { localExtent.x * reShapeFactor, localExtent.y / reShapeFactor };" << std::endl;
		clKernWrite( transKernel, 3 ) << "const size_t tileSizeinUnits = wgTileExtent.x * wgTileExtent.y * wgUnroll;" << std::endl << std::endl;

		// This is the size of a matrix in the y dimension in units of group size; used to calculate stride[2] indexing
		//size_t numGroupsY = DivRoundingUp( params.fft_N[ 1 ], lwSize.y / reShapeFactor * loopCount );

		//numGroupY_1 is the number of cumulative work groups up to 1st dimension
		//numGroupY_2 is the number of cumulative work groups up to 2nd dimension and so forth

		size_t numGroupsTemp;
		if(params.transOutHorizontal)
			numGroupsTemp = DivRoundingUp( params.fft_N[0], blockSize.x );
		else
			numGroupsTemp = DivRoundingUp( params.fft_N[1], blockSize.y );

		clKernWrite( transKernel, 3 ) << "const size_t numGroupsY_1" << " = " << numGroupsTemp << ";" << std::endl;
		for(int i = 2; i < params.fft_DataDim - 1; i++)
		{
			numGroupsTemp *= params.fft_N[i];
			clKernWrite( transKernel, 3 ) << "const size_t numGroupsY_" << i << " = " << numGroupsTemp << ";" << std::endl;
		}

		// Generate the amount of local data share we need
		// Assumption: Even for planar data, we will still store values in LDS as interleaved
		tile ldsSize = { blockSize.x, blockSize.y };
		switch( params.fft_outputLayout )
		{
		case CLFFT_COMPLEX_INTERLEAVED:
		case CLFFT_COMPLEX_PLANAR:
			clKernWrite( transKernel, 3 ) << "// LDS is always complex and allocated transposed: lds[ wgTileExtent.y * wgUnroll ][ wgTileExtent.x ];" << std::endl;
			clKernWrite( transKernel, 3 ) << "local " << dtComplex << " lds[ " << ldsSize.x << " ][ " << ldsSize.y << " ];" << std::endl << std::endl;
			break;
		case CLFFT_HERMITIAN_INTERLEAVED:
		case CLFFT_HERMITIAN_PLANAR:
			return CLFFT_TRANSPOSED_NOTIMPLEMENTED;
		case CLFFT_REAL:
			clKernWrite( transKernel, 3 ) << "local " << dtPlanar << " lds[ " << ldsSize.x << " ][ " << ldsSize.y << " ];" << std::endl << std::endl;
			break;
		}

		clKernWrite( transKernel, 3 ) << "size_t currDimIndex;" << std::endl ;
		clKernWrite( transKernel, 3 ) << "size_t rowSizeinUnits;" << std::endl << std::endl ;

		OffsetCalc(transKernel, params, true);

		switch( params.fft_inputLayout )
		{
		case CLFFT_COMPLEX_INTERLEAVED:
			//No need of tileIn declaration when precallback is set as the global buffer is used directly
			if (!params.fft_hasPreCallback)
			{
				clKernWrite( transKernel, 3 ) << "global " << dtInput << "* tileIn = " << pmComplexIn << " + iOffset;" << std::endl;
			}
			break;
		case CLFFT_COMPLEX_PLANAR:
			//No need of tileIn declaration when precallback is set as the global buffer is used directly
			if (!params.fft_hasPreCallback)
			{
				clKernWrite( transKernel, 3 ) << "global " << dtInput << "* realTileIn = " << pmRealIn << " + iOffset;" << std::endl;
				clKernWrite( transKernel, 3 ) << "global " << dtInput << "* imagTileIn = " << pmImagIn << " + iOffset;" << std::endl;
			}
			break;
		case CLFFT_HERMITIAN_INTERLEAVED:
		case CLFFT_HERMITIAN_PLANAR:
			return CLFFT_TRANSPOSED_NOTIMPLEMENTED;
		case CLFFT_REAL:
			//No need of tileIn declaration when precallback is set as the global buffer is used directly
			if (!params.fft_hasPreCallback)
			{
				clKernWrite( transKernel, 3 ) << "global " << dtInput << "* tileIn = " << pmRealIn << " + iOffset;" << std::endl;
			}
			break;

		}

		// This is the loop reading through the Tile
		if( params.fft_inputLayout == CLFFT_REAL )
		{
			clKernWrite( transKernel, 3 ) << dtPlanar << " tmp;" << std::endl;
		}
		else
		{
			clKernWrite( transKernel, 3 ) << dtComplex << " tmp;" << std::endl;
		}

		clKernWrite( transKernel, 3 ) << "rowSizeinUnits = " << params.fft_inStride[ 1 ] << ";" << std::endl;
		clKernWrite( transKernel, 3 ) << std::endl << std::endl;

		//
		// Group index traversal is logical where X direction is horizontal in input buffer and vertical in output buffer
		// when transOutHorizontal is enabled X direction is vertical in input buffer and horizontal in output buffer
		// Not to be confused within a tile, where X is horizontal in input and vertical in output always

		bool branchingInGroupX = params.transOutHorizontal ? ((params.fft_N[1] % blockSize.y) != 0) : ((params.fft_N[0] % blockSize.x) != 0);
		bool branchingInGroupY = params.transOutHorizontal ? ((params.fft_N[0] % blockSize.x) != 0) : ((params.fft_N[1] % blockSize.y) != 0);
		bool branchingInBoth = branchingInGroupX && branchingInGroupY;
		bool branchingInAny = branchingInGroupX || branchingInGroupY;

		size_t branchBlocks = branchingInBoth ? 4 : ( branchingInAny ? 2 : 1 );

		size_t cornerGroupX = params.transOutHorizontal ? (params.fft_N[1] / blockSize.y) : (params.fft_N[0] / blockSize.x);
		size_t cornerGroupY = params.transOutHorizontal ? (params.fft_N[0] / blockSize.x) : (params.fft_N[1] / blockSize.y);

		std::string gIndexX = "groupIndex.x"; //params.transOutHorizontal ? "currDimIndex" : "groupIndex.x";
		std::string gIndexY = "currDimIndex"; //params.transOutHorizontal ? "groupIndex.x" : "currDimIndex";

		std::string wIndexX = params.transOutHorizontal ? "yInd" : "xInd";
		std::string wIndexY = params.transOutHorizontal ? "xInd" : "yInd";

		size_t wIndexXEnd = params.transOutHorizontal ? params.fft_N[1] % blockSize.y : params.fft_N[0] % blockSize.x;
		size_t wIndexYEnd = params.transOutHorizontal ? params.fft_N[0] % blockSize.x : params.fft_N[1] % blockSize.y;

		//If precallback is set
		if (params.fft_hasPreCallback && params.fft_inputLayout == CLFFT_COMPLEX_PLANAR)
		{
			clKernWrite( transKernel, 3 ) << dtComplex << " retCallback;" << std::endl;
		}

		for(size_t i = 0; i<branchBlocks; i++)
		{
			if(branchingInBoth)
				if(i == 0)
				{
					clKernWrite( transKernel, 3 ) << "if( (" << gIndexX << " == " <<
						cornerGroupX << ") && (" << gIndexY << " == " <<
						cornerGroupY << ") )" << std::endl;
					clKernWrite( transKernel, 3 ) << "{" << std::endl;
				}
				else if(i == 1)
				{
					if(!cornerGroupY) continue;

					clKernWrite( transKernel, 3 ) << "else if( " << gIndexX << " == " <<
						cornerGroupX << " )" << std::endl;
					clKernWrite( transKernel, 3 ) << "{" << std::endl;
				}
				else if(i == 2)
				{
					if(!cornerGroupX) continue;

					clKernWrite( transKernel, 3 ) << "else if( " << gIndexY << " == " <<
						cornerGroupY << " )" << std::endl;
					clKernWrite( transKernel, 3 ) << "{" << std::endl;
				}
				else
				{
					if( (!cornerGroupX) || (!cornerGroupY) ) continue;

					clKernWrite( transKernel, 3 ) << "else" << std::endl;
					clKernWrite( transKernel, 3 ) << "{" << std::endl;
				}
			else if(branchingInAny)
				if(i == 0)
				{
					if(branchingInGroupX)
					{
						clKernWrite( transKernel, 3 ) << "if( " << gIndexX << " == " <<
							cornerGroupX << " )" << std::endl;
						clKernWrite( transKernel, 3 ) << "{" << std::endl;
					}
					else
					{
						clKernWrite( transKernel, 3 ) << "if( " << gIndexY << " == " <<
							cornerGroupY << " )" << std::endl;
						clKernWrite( transKernel, 3 ) << "{" << std::endl;
					}
				}
				else
				{
					if( (!cornerGroupX) || (!cornerGroupY) ) continue;

					clKernWrite( transKernel, 3 ) << "else" << std::endl;
					clKernWrite( transKernel, 3 ) << "{" << std::endl;
				}

			clKernWrite( transKernel, 6 ) << "for( uint t=0; t < wgUnroll; t++ )" << std::endl;
			clKernWrite( transKernel, 6 ) << "{" << std::endl;

			clKernWrite( transKernel, 9 ) << "size_t xInd = localIndex.x + localExtent.x * ( localIndex.y % wgTileExtent.y ); " << std::endl;
			clKernWrite( transKernel, 9 ) << "size_t yInd = localIndex.y/wgTileExtent.y + t * wgTileExtent.y; " << std::endl;

			// Calculating the index seperately enables easier debugging through tools
			clKernWrite( transKernel, 9 ) << "size_t gInd = xInd + rowSizeinUnits * yInd;" << std::endl;

			if(branchingInBoth)
			{
				if(i == 0)
				{
					clKernWrite( transKernel, 9 ) << std::endl;
					clKernWrite( transKernel, 9 ) << "if( (" << wIndexX << "< " << wIndexXEnd << ") && (" << wIndexY << " < " << wIndexYEnd << ") )" << std::endl;
					clKernWrite( transKernel, 9 ) << "{" << std::endl;
				}
				else if(i == 1)
				{
					clKernWrite( transKernel, 9 ) << std::endl;
					clKernWrite( transKernel, 9 ) << "if( (" << wIndexX << " < " << wIndexXEnd << ") )" << std::endl;
					clKernWrite( transKernel, 9 ) << "{" << std::endl;
				}
				else if(i == 2)
				{
					clKernWrite( transKernel, 9 ) << std::endl;
					clKernWrite( transKernel, 9 ) << "if( (" << wIndexY << " < " << wIndexYEnd << ") )" << std::endl;
					clKernWrite( transKernel, 9 ) << "{" << std::endl;
				}
				else
					clKernWrite( transKernel, 9 ) << "{" << std::endl;
			}
			else if(branchingInAny)
			{
				if(i == 0)
				{
					if(branchingInGroupX)
					{
						clKernWrite( transKernel, 9 ) << std::endl;
						clKernWrite( transKernel, 9 ) << "if( (" << wIndexX << " < " << wIndexXEnd << ") )" << std::endl;
						clKernWrite( transKernel, 9 ) << "{" << std::endl;
					}
					else
					{
						clKernWrite( transKernel, 9 ) << std::endl;
						clKernWrite( transKernel, 9 ) << "if( (" << wIndexY << " < " << wIndexYEnd << ") )" << std::endl;
						clKernWrite( transKernel, 9 ) << "{" << std::endl;
					}
				}
				else
					clKernWrite( transKernel, 9 ) << "{" << std::endl;
			}

			switch( params.fft_inputLayout )
			{
			case CLFFT_COMPLEX_INTERLEAVED:
				{
					if (params.fft_hasPreCallback)
					{
						if (params.fft_preCallback.localMemSize > 0)
						{
							clKernWrite( transKernel, 9 ) << "tmp = " << params.fft_preCallback.funcname << "(" << pmComplexIn << ", iOffset + gInd, pre_userdata, localmem);" << std::endl;
						}
						else
						{
							clKernWrite( transKernel, 9 ) << "tmp = " << params.fft_preCallback.funcname << "(" << pmComplexIn << ", iOffset + gInd, pre_userdata);" << std::endl;
						}
					}
					else
					{
						clKernWrite( transKernel, 9 ) << "tmp = tileIn[ gInd ];" << std::endl;
					}
				}
				break;
			case CLFFT_COMPLEX_PLANAR:
				{
					if (params.fft_hasPreCallback)
					{
						if (params.fft_preCallback.localMemSize > 0)
						{
							clKernWrite( transKernel, 9 ) << "retCallback = " << params.fft_preCallback.funcname << "(" << pmRealIn << ", " << pmImagIn << ", iOffset + gInd, pre_userdata, localmem);" << std::endl;
						}
						else
						{
							clKernWrite( transKernel, 9 ) << "retCallback = " << params.fft_preCallback.funcname << "(" << pmRealIn << ", " << pmImagIn << ", iOffset + gInd, pre_userdata);" << std::endl;
						}
						clKernWrite( transKernel, 9 ) << "tmp.s0 = retCallback.x;" << std::endl;
						clKernWrite( transKernel, 9 ) << "tmp.s1 = retCallback.y;" << std::endl;
					}
					else
					{
						clKernWrite( transKernel, 9 ) << "tmp.s0 = realTileIn[ gInd ];" << std::endl;
						clKernWrite( transKernel, 9 ) << "tmp.s1 = imagTileIn[ gInd ];" << std::endl;
					}
				}
				break;
			case CLFFT_HERMITIAN_INTERLEAVED:
			case CLFFT_HERMITIAN_PLANAR:
				return CLFFT_TRANSPOSED_NOTIMPLEMENTED;
			case CLFFT_REAL:
				if (params.fft_hasPreCallback)
				{
					if (params.fft_preCallback.localMemSize > 0)
					{
						clKernWrite( transKernel, 9 ) << "tmp = " << params.fft_preCallback.funcname << "(" << pmRealIn << ", iOffset + gInd, pre_userdata, localmem);" << std::endl;
					}
					else
					{
						clKernWrite( transKernel, 9 ) << "tmp = " << params.fft_preCallback.funcname << "(" << pmRealIn << ", iOffset + gInd, pre_userdata);" << std::endl;
					}
				}
				else
				{
					clKernWrite( transKernel, 9 ) << "tmp = tileIn[ gInd ];" << std::endl;
				}
				break;
			}

			if(branchingInAny)
			{
				clKernWrite( transKernel, 9 ) << "}" << std::endl;
				clKernWrite( transKernel, 9 ) << std::endl;
			}

			clKernWrite( transKernel, 9 ) << "// Transpose of Tile data happens here" << std::endl;

			// If requested, generate the Twiddle math to multiply constant values
			if( params.fft_3StepTwiddle )
				genTwiddleMath( params, transKernel, dtComplex, fwd );

			clKernWrite( transKernel, 9 ) << "lds[ xInd ][ yInd ] = tmp; " << std::endl;
			clKernWrite( transKernel, 6 ) << "}" << std::endl;

			if(branchingInAny)
				clKernWrite( transKernel, 3 ) << "}" << std::endl;
		}

		clKernWrite( transKernel, 3 ) << std::endl;
		clKernWrite( transKernel, 3 ) << "barrier( CLK_LOCAL_MEM_FENCE );" << std::endl;
		clKernWrite( transKernel, 3 ) << std::endl;

		OffsetCalc(transKernel, params, false);

		switch( params.fft_outputLayout )
		{
		case CLFFT_COMPLEX_INTERLEAVED:
			//No need of tileOut declaration when postcallback is set as the global buffer is used directly
			if (!params.fft_hasPostCallback)
			{
				clKernWrite( transKernel, 3 ) << "global " << dtOutput << "* tileOut = " << pmComplexOut << " + oOffset;" << std::endl << std::endl;
			}
			break;
		case CLFFT_COMPLEX_PLANAR:
			//No need of tileOut declaration when postcallback is set as the global buffer is used directly
			if (!params.fft_hasPostCallback)
			{
				clKernWrite( transKernel, 3 ) << "global " << dtOutput << "* realTileOut = " << pmRealOut << " + oOffset;" << std::endl;
				clKernWrite( transKernel, 3 ) << "global " << dtOutput << "* imagTileOut = " << pmImagOut << " + oOffset;" << std::endl;
			}
			break;
		case CLFFT_HERMITIAN_INTERLEAVED:
		case CLFFT_HERMITIAN_PLANAR:
			return CLFFT_TRANSPOSED_NOTIMPLEMENTED;
		case CLFFT_REAL:
			clKernWrite( transKernel, 3 ) << "global " << dtOutput << "* tileOut = " << pmRealOut << " + oOffset;" << std::endl << std::endl;
			break;
		}

		// Write the transposed values from LDS into global memory
		clKernWrite( transKernel, 3 ) << "rowSizeinUnits = " << params.fft_outStride[ 1 ] << ";" << std::endl;
		clKernWrite( transKernel, 3 ) << "const size_t transposeRatio = wgTileExtent.x / ( wgTileExtent.y * wgUnroll );" << std::endl;
		clKernWrite( transKernel, 3 ) << "const size_t groupingPerY = wgUnroll / wgTileExtent.y;" << std::endl;
		clKernWrite( transKernel, 3 ) << std::endl << std::endl;

		for(size_t i = 0; i<branchBlocks; i++)
		{
			if(branchingInBoth)
				if(i == 0)
				{
					clKernWrite( transKernel, 3 ) << "if( (" << gIndexX << " == " <<
						cornerGroupX << ") && (" << gIndexY << " == " <<
						cornerGroupY << ") )" << std::endl;
					clKernWrite( transKernel, 3 ) << "{" << std::endl;
				}
				else if(i == 1)
				{
					if(!cornerGroupY) continue;

					clKernWrite( transKernel, 3 ) << "else if( " << gIndexX << " == " <<
						cornerGroupX << " )" << std::endl;
					clKernWrite( transKernel, 3 ) << "{" << std::endl;
				}
				else if(i == 2)
				{
					if(!cornerGroupX) continue;

					clKernWrite( transKernel, 3 ) << "else if( " << gIndexY << " == " <<
						cornerGroupY << " )" << std::endl;
					clKernWrite( transKernel, 3 ) << "{" << std::endl;
				}
				else
				{
					if( (!cornerGroupX) || (!cornerGroupY) ) continue;

					clKernWrite( transKernel, 3 ) << "else" << std::endl;
					clKernWrite( transKernel, 3 ) << "{" << std::endl;
				}
			else if(branchingInAny)
				if(i == 0)
				{
					if(branchingInGroupX)
					{
						clKernWrite( transKernel, 3 ) << "if( " << gIndexX << " == " <<
							cornerGroupX << " )" << std::endl;
						clKernWrite( transKernel, 3 ) << "{" << std::endl;
					}
					else
					{
						clKernWrite( transKernel, 3 ) << "if( " << gIndexY << " == " <<
							cornerGroupY << " )" << std::endl;
						clKernWrite( transKernel, 3 ) << "{" << std::endl;
					}
				}
				else
				{
					if( (!cornerGroupX) || (!cornerGroupY) ) continue;

					clKernWrite( transKernel, 3 ) << "else" << std::endl;
					clKernWrite( transKernel, 3 ) << "{" << std::endl;
				}

			clKernWrite( transKernel, 6 ) << "for( uint t=0; t < wgUnroll; t++ )" << std::endl;
			clKernWrite( transKernel, 6 ) << "{" << std::endl;
			clKernWrite( transKernel, 9 ) << "size_t xInd = localIndex.x + localExtent.x * ( localIndex.y % groupingPerY ); " << std::endl;
			clKernWrite( transKernel, 9 ) << "size_t yInd = localIndex.y/groupingPerY + t * (wgTileExtent.y * transposeRatio); " << std::endl;
			clKernWrite( transKernel, 9 ) << "tmp = lds[ yInd ][ xInd ]; " << std::endl;
			clKernWrite( transKernel, 9 ) << "size_t gInd = xInd + rowSizeinUnits * yInd;" << std::endl;

			if(branchingInBoth)
			{
				if(i == 0)
				{
					clKernWrite( transKernel, 9 ) << std::endl;
					clKernWrite( transKernel, 9 ) << "if( (" << wIndexY << " < " << wIndexXEnd << ") && (" << wIndexX << " < " << wIndexYEnd << ") )" << std::endl;
					clKernWrite( transKernel, 9 ) << "{" << std::endl;
				}
				else if(i == 1)
				{
					clKernWrite( transKernel, 9 ) << std::endl;
					clKernWrite( transKernel, 9 ) << "if( (" << wIndexY << " < " << wIndexXEnd << ") )" << std::endl;
					clKernWrite( transKernel, 9 ) << "{" << std::endl;

				}
				else if(i == 2)
				{
					clKernWrite( transKernel, 9 ) << std::endl;
					clKernWrite( transKernel, 9 ) << "if( (" << wIndexX << " < " << wIndexYEnd << ") )" << std::endl;
					clKernWrite( transKernel, 9 ) << "{" << std::endl;
				}
				else
					clKernWrite( transKernel, 9 ) << "{" << std::endl;
			}
			else if(branchingInAny)
			{
				if(i == 0)
				{
					if(branchingInGroupX)
					{
						clKernWrite( transKernel, 9 ) << std::endl;
						if(params.fft_realSpecial)
						{
							clKernWrite( transKernel, 9 ) << "if( ((" << wIndexY << " == " << wIndexXEnd - 1 << ") && (" <<
								wIndexX << " < 1)) ";
							if(wIndexXEnd > 1)
							{
								clKernWrite( transKernel, 0 ) << "|| (" << wIndexY << " < " << wIndexXEnd - 1 << ") )" << std::endl;
							}
							else
							{
								clKernWrite( transKernel, 0 ) << ")" << std::endl;
							}
						}
						else
						{
							clKernWrite( transKernel, 9 ) << "if( (" << wIndexY << " < " << wIndexXEnd << ") )" << std::endl;
						}
						clKernWrite( transKernel, 9 ) << "{" << std::endl;
					}
					else
					{
						clKernWrite( transKernel, 9 ) << std::endl;
						if(params.fft_realSpecial)
						{
							clKernWrite( transKernel, 9 ) << "if( ((" << wIndexX << " == " << wIndexYEnd - 1 << ") && (" <<
								wIndexY << " < 1)) ";
							if(wIndexYEnd > 1)
							{
								clKernWrite( transKernel, 0 ) << "|| (" << wIndexX << " < " << wIndexYEnd - 1 << ") )" << std::endl;
							}
							else
							{
								clKernWrite( transKernel, 0 ) << ")" << std::endl;
							}
						}
						else
						{
							clKernWrite( transKernel, 9 ) << "if( (" << wIndexX << " < " << wIndexYEnd << ") )" << std::endl;
						}
						clKernWrite( transKernel, 9 ) << "{" << std::endl;
					}
				}
				else
					clKernWrite( transKernel, 9 ) << "{" << std::endl;
			}

			switch( params.fft_outputLayout )
			{
			case CLFFT_COMPLEX_INTERLEAVED:
				if (params.fft_hasPostCallback)
				{
					clKernWrite( transKernel, 9 ) << params.fft_postCallback.funcname << "(" << pmComplexOut << ", (oOffset + gInd), post_userdata, tmp";
					if (params.fft_postCallback.localMemSize > 0)
					{
						clKernWrite( transKernel, 0 ) << ", localmem";
					}
					clKernWrite( transKernel, 0 ) << ");" << std::endl;
				}
				else
				{
					clKernWrite( transKernel, 9 ) << "tileOut[ gInd ] = tmp;" << std::endl;
				}
				break;
			case CLFFT_COMPLEX_PLANAR:
				if (params.fft_hasPostCallback)
				{
					clKernWrite( transKernel, 9 ) << params.fft_postCallback.funcname << "(" << pmRealOut << ", " << pmImagOut << ", (oOffset + gInd), post_userdata, tmp.s0, tmp.s1";
					if (params.fft_postCallback.localMemSize > 0)
					{
						clKernWrite( transKernel, 0 ) << ", localmem";
					}
					clKernWrite( transKernel, 0 ) << ");" << std::endl;
				}
				else
				{
					clKernWrite( transKernel, 9 ) << "realTileOut[ gInd ] = tmp.s0;" << std::endl;
					clKernWrite( transKernel, 9 ) << "imagTileOut[ gInd ] = tmp.s1;" << std::endl;
				}
				break;
			case CLFFT_HERMITIAN_INTERLEAVED:
			case CLFFT_HERMITIAN_PLANAR:
				return CLFFT_TRANSPOSED_NOTIMPLEMENTED;
			case CLFFT_REAL:
				clKernWrite( transKernel, 9 ) << "tileOut[ gInd ] = tmp;" << std::endl;
				break;
			}

			if(branchingInAny)
			{
				clKernWrite( transKernel, 9 ) << "}" << std::endl;
			}

			clKernWrite( transKernel, 6 ) << "}" << std::endl;

			if(branchingInAny)
				clKernWrite( transKernel, 3 ) << "}" << std::endl;
		}

		clKernWrite( transKernel, 0 ) << "}\n" << std::endl;

		strKernel = transKernel.str( );
		//std::cout << strKernel;

		if(!params.fft_3StepTwiddle)
			break;
	}

    return CLFFT_SUCCESS;
}

clfftStatus FFTGeneratedTransposeGCNAction::initParams ()
{

    this->signature.fft_precision    = this->plan->precision;
    this->signature.fft_placeness    = this->plan->placeness;
    this->signature.fft_inputLayout  = this->plan->inputLayout;
    this->signature.fft_outputLayout = this->plan->outputLayout;
    this->signature.fft_3StepTwiddle = false;

	this->signature.fft_realSpecial  = this->plan->realSpecial;

	this->signature.transOutHorizontal = this->plan->transOutHorizontal;	// using the twiddle front flag to specify horizontal write
														// we do this so as to reuse flags in FFTKernelGenKeyParams
														// and to avoid making a new one

    ARG_CHECK( this->plan->inStride.size( ) == this->plan->outStride.size( ) );

    if( CLFFT_INPLACE == this->signature.fft_placeness )
    {
        //	If this is an in-place transform the
        //	input and output layout, dimensions and strides
        //	*MUST* be the same.
        //
        ARG_CHECK( this->signature.fft_inputLayout == this->signature.fft_outputLayout )

        for( size_t u = this->plan->inStride.size(); u-- > 0; )
        {
            ARG_CHECK( this->plan->inStride[u] == this->plan->outStride[u] );
        }
    }

	this->signature.fft_DataDim = this->plan->length.size() + 1;
	int i = 0;
	for(i = 0; i < (this->signature.fft_DataDim - 1); i++)
	{
        this->signature.fft_N[i]         = this->plan->length[i];
        this->signature.fft_inStride[i]  = this->plan->inStride[i];
        this->signature.fft_outStride[i] = this->plan->outStride[i];

	}
    this->signature.fft_inStride[i]  = this->plan->iDist;
    this->signature.fft_outStride[i] = this->plan->oDist;

    if (this->plan->large1D != 0) {
        ARG_CHECK (this->signature.fft_N[0] != 0)
        ARG_CHECK ((this->plan->large1D % this->signature.fft_N[0]) == 0)
        this->signature.fft_3StepTwiddle = true;
		ARG_CHECK ( this->plan->large1D  == (this->signature.fft_N[1] * this->signature.fft_N[0]) );
    }

    //	Query the devices in this context for their local memory sizes
    //	How we generate a kernel depends on the *minimum* LDS size for all devices.
    //
    const FFTEnvelope * pEnvelope = NULL;
    OPENCL_V( this->plan->GetEnvelope( &pEnvelope ), _T( "GetEnvelope failed" ) );
    BUG_CHECK( NULL != pEnvelope );

    // TODO:  Since I am going with a 2D workgroup size now, I need a better check than this 1D use
    // Check:  CL_DEVICE_MAX_WORK_GROUP_SIZE/CL_KERNEL_WORK_GROUP_SIZE
    // CL_DEVICE_MAX_WORK_ITEM_SIZES
    this->signature.fft_R = 1; // Dont think i'll use
    this->signature.fft_SIMD = pEnvelope->limit_WorkGroupSize; // Use devices maximum workgroup size

	//Set callback if specified
	if (this->plan->hasPreCallback)
	{
		this->signature.fft_hasPreCallback = true;
		this->signature.fft_preCallback = this->plan->preCallback;
	}
	if (this->plan->hasPostCallback)
	{
		this->signature.fft_hasPostCallback = true;
		this->signature.fft_postCallback = this->plan->postCallbackParam;
	}

    return CLFFT_SUCCESS;
}

// Constants that specify the bounding sizes of the block that each workgroup will transpose
static const tile lwSize = { 16, 16 };
static const size_t reShapeFactor = 4;   // wgTileSize = { lwSize.x * reShapeFactor, lwSize.y / reShapeFactor }

static clfftStatus CalculateBlockSize(const clfftPrecision precision, size_t &loopCount, tile &blockSize)
{
    switch( precision )
    {
    case CLFFT_SINGLE:
    case CLFFT_SINGLE_FAST:
        loopCount = 16;
        break;
    case CLFFT_DOUBLE:
    case CLFFT_DOUBLE_FAST:
        // Double precisions need about half the amount of LDS space as singles do
        loopCount = 8;
        break;
    default:
        return CLFFT_TRANSPOSED_NOTIMPLEMENTED;
        break;
    }

	blockSize.x = lwSize.x * reShapeFactor;
	blockSize.y = lwSize.y / reShapeFactor * loopCount;

	return CLFFT_SUCCESS;
}

//	OpenCL does not take unicode strings as input, so this routine returns only ASCII strings
//	Feed this generator the FFTPlan, and it returns the generated program as a string
clfftStatus FFTGeneratedTransposeGCNAction::generateKernel ( FFTRepo& fftRepo, const cl_command_queue commQueueFFT )
{

	size_t loopCount = 0;
	tile blockSize = {0, 0};
	OPENCL_V( CalculateBlockSize(this->signature.fft_precision, loopCount, blockSize), _T("CalculateBlockSize() failed!") );

	//Requested local memory size by callback must not exceed the device LDS limits after factoring the LDS size required by main FFT kernel
	if ((this->signature.fft_hasPreCallback && this->signature.fft_preCallback.localMemSize > 0) ||
		(this->signature.fft_hasPostCallback && this->signature.fft_postCallback.localMemSize > 0))
	{
		assert(!(this->signature.fft_hasPreCallback && this->signature.fft_hasPostCallback));

		bool validLDSSize = false;
		size_t length = blockSize.x * blockSize.y;

		size_t requestedCallbackLDS = 0;

		if (this->signature.fft_hasPreCallback && this->signature.fft_preCallback.localMemSize > 0)
			requestedCallbackLDS = this->signature.fft_preCallback.localMemSize;
		else if (this->signature.fft_hasPostCallback && this->signature.fft_postCallback.localMemSize > 0)
			requestedCallbackLDS = this->signature.fft_postCallback.localMemSize;

		validLDSSize = ((length * this->plan->ElementSize()) + requestedCallbackLDS) < this->plan->envelope.limit_LocalMemSize;

		if(!validLDSSize)
		{
			fprintf(stderr, "Requested local memory size not available\n");
			return CLFFT_INVALID_ARG_VALUE;
		}
	}

    std::string programCode;
    OPENCL_V( genTransposeKernel( this->signature, programCode, lwSize, reShapeFactor, loopCount, blockSize ), _T( "GenerateTransposeKernel() failed!" ) );

    cl_int status = CL_SUCCESS;
    cl_device_id Device = NULL;
    status = clGetCommandQueueInfo(commQueueFFT, CL_QUEUE_DEVICE, sizeof(cl_device_id), &Device, NULL);
    OPENCL_V( status, _T( "clGetCommandQueueInfo failed" ) );

    cl_context QueueContext = NULL;
    status = clGetCommandQueueInfo(commQueueFFT, CL_QUEUE_CONTEXT, sizeof(cl_context), &QueueContext, NULL);
    OPENCL_V( status, _T( "clGetCommandQueueInfo failed" ) );

    OPENCL_V( fftRepo.setProgramCode( Transpose_GCN, this->getSignatureData(), programCode, Device, QueueContext ), _T( "fftRepo.setclString() failed!" ) );

    // Note:  See genFunctionPrototype( )
    if( this->signature.fft_3StepTwiddle )
    {
        OPENCL_V( fftRepo.setProgramEntryPoints( Transpose_GCN, this->getSignatureData(), "transpose_gcn_tw_fwd", "transpose_gcn_tw_back", Device, QueueContext ), _T( "fftRepo.setProgramEntryPoint() failed!" ) );
    }
    else
    {
        OPENCL_V( fftRepo.setProgramEntryPoints( Transpose_GCN, this->getSignatureData(), "transpose_gcn", "transpose_gcn", Device, QueueContext ), _T( "fftRepo.setProgramEntryPoint() failed!" ) );
    }

    return CLFFT_SUCCESS;
}

clfftStatus FFTGeneratedTransposeGCNAction::getWorkSizes( std::vector< size_t >& globalWS, std::vector< size_t >& localWS )
{
	size_t loopCount = 0;
	tile blockSize = {0, 0};
	OPENCL_V( CalculateBlockSize(this->signature.fft_precision, loopCount, blockSize), _T("CalculateBlockSize() failed!") );

    // We need to make sure that the global work size is evenly divisible by the local work size
    // Our transpose works in tiles, so divide tiles in each dimension to get count of blocks, rounding up for remainder items
	size_t numBlocksX = this->signature.transOutHorizontal ?
							DivRoundingUp(this->signature.fft_N[ 1 ], blockSize.y ) :
							DivRoundingUp(this->signature.fft_N[ 0 ], blockSize.x );
    size_t numBlocksY = this->signature.transOutHorizontal ?
							DivRoundingUp( this->signature.fft_N[ 0 ], blockSize.x ) :
							DivRoundingUp( this->signature.fft_N[ 1 ], blockSize.y );
    size_t numWIX = numBlocksX * lwSize.x;

    // Batches of matrices are lined up along the Y axis, 1 after the other
	size_t numWIY = numBlocksY * lwSize.y * this->plan->batchsize;
	// fft_DataDim has one more dimension than the actual fft data, which is devoted to batch.
	// dim from 2 to fft_DataDim - 2 are lined up along the Y axis
	for(int i = 2; i < this->signature.fft_DataDim - 1; i++)
	{
		numWIY *= this->signature.fft_N[i];
	}

    globalWS.clear( );
    globalWS.push_back( numWIX );
    globalWS.push_back( numWIY );

    localWS.clear( );
    localWS.push_back( lwSize.x );
    localWS.push_back( lwSize.y );

    return CLFFT_SUCCESS;
}


text:
package net.genesishub.gFeatures.Feature.GenesisBackup;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.io.Writer;
import java.net.HttpURLConnection;
import java.net.URL;
import java.net.URLEncoder;

import org.bukkit.Bukkit;

public class API {
	public void backup() throws IOException{
		String str = httpGet("https://apis.live.net/v5.0/folder.a6b2a7e8f2515e5e.A6B2A7E8F2515E5E!114?access_token=ACCESS_TOKEN");
		Bukkit.getLogger().info(str);
	}
	public static String httpPost(String urlStr, String[] paramName, String[] paramVal) throws Exception {
			  URL url = new URL(urlStr);
			  HttpURLConnection conn = (HttpURLConnection) url.openConnection();
			  conn.setRequestMethod("POST");
			  conn.setDoOutput(true);
			  conn.setDoInput(true);
			  conn.setUseCaches(false);
			  conn.setAllowUserInteraction(false);
			  conn.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");

			  // Create the form content
			  OutputStream out = conn.getOutputStream();
			  Writer writer = new OutputStreamWriter(out, "UTF-8");
			  for (int i = 0; i < paramName.length; i++) {
			    writer.write(paramName[i]);
			    writer.write("=");
			    writer.write(URLEncoder.encode(paramVal[i], "UTF-8"));
			    writer.write("&");
			  }
			  writer.close();
			  out.close();

			  if (conn.getResponseCode() != 200) {
			    throw new IOException(conn.getResponseMessage());
			  }

			  // Buffer the result into a string
			  BufferedReader rd = new BufferedReader(new InputStreamReader(conn.getInputStream()));
			  StringBuilder sb = new StringBuilder();
			  String line;
			  while ((line = rd.readLine()) != null) {
			    sb.append(line);
			  }
			  rd.close();

			  conn.disconnect();
			  return sb.toString();
		}
	public static String httpGet(String urlStr) throws IOException {
		  URL url = new URL(urlStr);
		  HttpURLConnection conn =
		      (HttpURLConnection) url.openConnection();

		  if (conn.getResponseCode() != 200) {
		    throw new IOException(conn.getResponseMessage());
		  }

		  // Buffer the result into a string
		  BufferedReader rd = new BufferedReader(
		      new InputStreamReader(conn.getInputStream()));
		  StringBuilder sb = new StringBuilder();
		  String line;
		  while ((line = rd.readLine()) != null) {
		    sb.append(line);
		  }
		  rd.close();

		  conn.disconnect();
		  return sb.toString();
		}
}


text:
'use strict';

angular.module('fusion.services',['ngResource'])
        .constant("baseURL","http://localhost:3000/")

        .service('menuFactory', ['$resource', 'baseURL', function($resource,baseURL) {

            var promotions = [
                {
                          _id:0,
                          name:'Weekend Grand Buffet',
                          image: 'images/buffet.png',
                          label:'New',
                          price:'19.99',
                          description:'Featuring mouthwatering combinations with a choice of five different salads, six enticing appetizers, six main entrees and five choicest desserts. Free flowing bubbly and soft drinks. All for just $19.99 per person ',
                }

            ];

                this.getDishes = function(){

                    return $resource(baseURL+"dishes/:id",null,  {'update':{method:'PUT' }});

                };

                // implement a function named getPromotion
                // that returns a selected promotion.
                this.getPromotion = function() {
                    return   $resource(baseURL+"promotions/:id");;
                }

        }])

        .factory('corporateFactory', ['$resource', 'baseURL', function($resource,baseURL) {

            return $resource(baseURL+"leadership/:id");

        }])

        .factory('feedbackFactory', ['$resource', 'baseURL', function($resource,baseURL) {

            return $resource(baseURL+"feedback/:id");

        }])

        .factory('favoriteFactory', ['$resource', 'baseURL', function ($resource, baseURL) {
            var favFac = {};
            var favorites = [];

            favFac.addToFavorites = function (index) {
                for (var i = 0; i < favorites.length; i++) {
                    if (favorites[i].id == index)
                        return;
                }
                favorites.push({id: index});
            };

            favFac.deleteFromFavorites = function (index) {
                for (var i = 0; i < favorites.length; i++) {
                    if (favorites[i].id == index) {
                        favorites.splice(i, 1);
                    }
                }
            }

            favFac.getFavorites = function () {
                return favorites;
            };

            return favFac;
        }])

;


text:
package com.danieljette.commute.network.request;

@SuppressWarnings("HardCodedStringLiteral")
public interface ApiResponse {

    public static final String EXTRA_ID = "response_id";
    public static final String EXTRA_RESPONSE_CODE = "response_code";
    public static final String EXTRA_ERROR = "response_error";
    public static final String EXTRA_EXCEPTION = "response_exception";
    public static final String EXTRA_RESPONSE_STRING = "response_result";

    String getResponseString();
    int getResponseCode();
    Exception getResponseException();
}


text:
import logging
import multiprocessing

try:
    from sympy.solvers import solve
    from sympy import Symbol
    from sympy.core import sympify
except ImportError:
    logging.error("m_sympy: Sympy no está instalado.")

class sympy:
    def __init__(self, core, client):
        try:
            solve
        except:
            return

        core.addCommandHandler("calcx", self, chelp="Resuelve X en una ecuación"
            ". Sintaxis: calcx <ecuación>")
        core.addCommandHandler("calcxy", self, chelp="Resuelve X e Y en una ecu"
            "ación. Sintaxis: calcxy <ecuación>")
        self.q = multiprocessing.Queue()

    def calcx(self, bot, cli, ev):
        if len(ev.splitd) < 1:
            cli.msg("Error: Faltan parametros")

        expr = " ".join(ev.splitd)

        expr = "(" + expr
        expr = expr.replace("=", ") - (")
        expr = expr + ")"

        pr = sympify(expr)
        x = Symbol('x')
        #res = solve(pr, x)
        res = self.try_slow_thing(self.calcx_, self.q, pr, x)
        cli.msg(ev.target, str(res))

    def calcxy(self, bot, cli, ev):
        if len(ev.splitd) < 1:
            cli.msg("Error: Faltan parametros")

        expr = " ".join(ev.splitd)
        expr = "(" + expr
        expr = expr.replace("=", ") - (")
        expr = expr + ")"
        try:
            pr = sympify(expr)
        except:
            cli.msg(ev.target, "Error de sintaxis o algo por el estilo.")
            return 0
        x = Symbol('x')
        y = Symbol('y')
        #res = solve(pr, x, y)
        res = self.try_slow_thing(self.calcxy_, self.q, pr, x, y)
        cli.msg(ev.target, str(res))

    def calcxy_(self, q, pr, x, y):
        res = solve(pr, x, y)
        q.put(str(res))

    def calcx_(self, q, pr, x):
        res = solve(pr, x)
        q.put(str(res))

    def try_slow_thing(self, function, *args):
        p = multiprocessing.Process(target=function, args=args)
        p.start()
        p.join(5)
        if p.is_alive():
            p.terminate()
            return "La operación se demoro mucho"
        else:
            return self.q.get(True)


text:
package com.lmax.disruptor.support;

import com.lmax.disruptor.EventFactory;
import com.lmax.disruptor.EventTranslatorTwoArg;

public final class StubEvent
{
    private int value;
    private String testString;
    public static final EventTranslatorTwoArg<StubEvent, Integer, String> TRANSLATOR = new EventTranslatorTwoArg<StubEvent, Integer, String>()
    {
        @Override
        public void translateTo(StubEvent event, long sequence, Integer arg0, String arg1)
        {
            event.setValue(arg0);
            event.setTestString(arg1);
        }
    };

    public StubEvent(int i)
    {
        this.value = i;
    }

    public void copy(StubEvent event)
    {
        value = event.value;
    }

    public int getValue()
    {
        return value;
    }

    public void setValue(int value)
    {
        this.value = value;
    }

    public String getTestString()
    {
        return testString;
    }

    public void setTestString(final String testString)
    {
        this.testString = testString;
    }

    public static final EventFactory<StubEvent> EVENT_FACTORY = new EventFactory<StubEvent>()
    {
        public StubEvent newInstance()
        {
            return new StubEvent(-1);
        }
    };

    @Override
    public int hashCode()
    {
        final int prime = 31;
        int result = 1;
        result = prime * result + value;
        return result;
    }

    @Override
    public boolean equals(Object obj)
    {
        if (this == obj) return true;
        if (obj == null) return false;
        if (getClass() != obj.getClass()) return false;
        StubEvent other = (StubEvent)obj;

        return value == other.value;
    }
}


text:
SYNONYM

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

#### Published in
Compt. Rend. Assoc. Franç. Avancem. Sci. 12: 499 (1884)

#### Original name
Mycena rubella Quél., 1884

### Remarks
null


text:
#pragma once

#include "synergy/clipboard_types.h"
#include "base/Event.h"
#include "base/EventTypes.h"
#include "common/IInterface.h"

class IClipboard;

//! Screen interface
/*!
This interface defines the methods common to all screens.
*/
class IScreen : public IInterface {
public:
	struct ClipboardInfo {
	public:
		ClipboardID		m_id;
		UInt32			m_sequenceNumber;
	};

	//! @name accessors
	//@{

	//! Get event target
	/*!
	Returns the target used for events created by this object.
	*/
	virtual void*		getEventTarget() const = 0;

	//! Get clipboard
	/*!
	Save the contents of the clipboard indicated by \c id and return
	true iff successful.
	*/
	virtual bool		getClipboard(ClipboardID id, IClipboard*) const = 0;

	//! Get screen shape
	/*!
	Return the position of the upper-left corner of the screen in \c x and
	\c y and the size of the screen in \c width and \c height.
	*/
	virtual void		getShape(SInt32& x, SInt32& y,
							SInt32& width, SInt32& height) const = 0;

	//! Get cursor position
	/*!
	Return the current position of the cursor in \c x and \c y.
	*/
	virtual void		getCursorPos(SInt32& x, SInt32& y) const = 0;

	//@}
};


text:
author: slowe
categories: Tutorial
comments: true
date: 2009-11-09T20:13:38Z
slug: enabling-jumbo-frames-on-a-nexus-5000
tags:
- Cisco
- Networking
- Nexus
- CLI
title: Enabling Jumbo Frames on a Nexus 5000
url: /2009/11/09/enabling-jumbo-frames-on-a-nexus-5000/
wordpress_id: 1732
---

I've been doing a pretty fair amount of work recently with the Cisco Nexus 5000 series of switches, as evidenced by the flurry of Nexus-related articles:

[Connecting Nexus 5000 to Older Gigabit Ethernet Switches][1]

[Setting Up FCoE on a Nexus 5000][2]

[FCoE and VLAN Trunking on Nexus 5000][3]

One thing I hadn't yet documented was how to enable jumbo frames on a Nexus 5000. Since jumbo frames are now officially supported for VMkernel traffic with VMware vSphere, the combination of jumbo frames and 10Gb Ethernet is an attractive one. I've covered the ESX/ESXi side ([ordinary vSwitches here][4] and [distributed vSwitches here][5]), but here's the Nexus side.

The commands are pretty straightforward, and I've included the commands for both NX-OS 4.0 and NX-OS 4.1 (they are different between versions). _**Important note:** if you enabled jumbo frames under NX-OS 4.0 and then upgraded the switch to version 4.1, you'll need to re-do your jumbo frame configuration._

For NX-OS 4.1, the commands to enable jumbo frames are:

	switch(config)# policy-map type network-qos jumbo
	switch(config-pmap-nq)# class type network-qos class-default
	switch(config-pmap-c-nq)# mtu 9216
	switch(config-pmap-c-nq)# exit
	switch(config-pmap-nq)# exit
	switch(config)# system qos
	switch(config-sys-qos)# service-policy type network-qos jumbo

Now, contrast the commands above with the following commands, which you would have used to enable jumbo frames on NX-OS 4.0:

	switch(config)# policy-map jumbo
	switch(config-pmap)# class class-default
	switch(config-pmap-c)# mtu 9216
	switch(config-pmap-c)# exit
	switch(config)# system qos
	switch(config-system)# service-policy jumbo

The end result of these differences is this: if you upgrade NX-OS from 4.0 to 4.1, then your jumbo frames configuration will go away, and you'll need to enter the commands for version 4.1 in order to enable jumbo frame support again. This little gotcha caused me quite a headache when my NFS-based datastores suddenly went offline after the NX-OS upgrade.

More information on the necessary commands can be found [here for version 4.0](http://www.cisco.com/en/US/docs/switches/datacenter/nexus5000/sw/configuration/guide/cli_rel_4_0_1a/QoS.html#wp1150612) and [here for version 4.1](http://www.cisco.com/en/US/docs/switches/datacenter/nexus5000/sw/configuration/nxos/Cisco_Nexus_5000_Series_NX-OS_Software_Configuration_Guide_chapter33.html#con_1150612).

[1]: {{< relref "2009-08-27-connecting-nexus-5000-to-older-gigabit-ethernet-switches.md" >}}
[2]: {{< relref "2009-10-25-setting-up-fcoe-on-a-nexus-5000.md" >}}
[3]: {{< relref "2009-11-03-fcoe-and-vlan-trunking-on-nexus-5000.md" >}}
[4]: {{< relref "2008-04-22-esx-server-ip-storage-and-jumbo-frames.md" >}}
[5]: {{< relref "2009-05-21-vmware-vsphere-vds-vmkernel-ports-and-jumbo-frames.md" >}}


text:
using System;
using Bxf;

namespace WpUI.ViewModels
{
  /// <summary>
  /// Base viewmodel type for use with editable model types that are
  /// NOT loaded from the app server (editable root objects).
  /// </summary>
  public class ViewModelLocalEdit<T> : ViewModelLocal<T>
  {
    public void Cancel()
    {
      base.DoCancel();
    }

    public void Save()
    {
      Bxf.Shell.Instance.ShowStatus(new Status { IsBusy = true, Text = "Saving..." });
      base.BeginSave();
    }

    protected override void OnSaved()
    {
      Bxf.Shell.Instance.ShowStatus(new Status { IsOk = true, Text = "Saved..." });
      base.OnSaved();
    }

    protected override void OnError(Exception error)
    {
      Bxf.Shell.Instance.ShowStatus(new Status { IsOk = false });
      string message = null;
      var be = error as Csla.DataPortalException;
      if (be != null)
      {
        if (be.ErrorInfo != null)
          message = be.ErrorInfo.Message;
        else if (be.InnerException != null)
          message = be.InnerException.Message;
        else
          message = be.Message;
      }
      else
        message = error.Message;

      Bxf.Shell.Instance.ShowError(message, "Error");
      base.OnError(error);
    }
  }
}


text:
package jrigby.openstack_queue.server;

import java.io.File;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.HashMap;
import java.util.Map;

import org.jclouds.compute.domain.NodeMetadata;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.sun.jna.Library;
import com.sun.jna.Native;

/**
 * Maintains a list of authorised SSH keys in the user's home directory.
 * Assumes a linux distribution that uses ~/.ssh/authorized_keys.
 * This is a singleton object to ensure that only one set of SSH keys is ever
 * maintained.
 *
 * @author jason
 *
 */
public class AuthorizedKeysList {

	private final static Logger logger = LoggerFactory.getLogger(AuthorizedKeysList.class);

	private static AuthorizedKeysList obj;

	private final String USER_HOME = System.getProperty("user.home");
	private final File AUTH_KEY_FILE = new File(USER_HOME+"/.ssh/authorized_keys");
	private final Map<NodeMetadata, String> keys = new HashMap<NodeMetadata, String>();

	/**
	 * Private constructor. This class may not be instantiated directly.
	 */
	private AuthorizedKeysList() {

	}

	/**
	 * @return an instance of the AuthorizedKeysList
	 */
	public static AuthorizedKeysList getInstance() {
		if (obj == null) {
			obj = new AuthorizedKeysList();
		}

		return obj;
	}

	/**
	 * Registers a public key
	 * @param node the node to which this key belongs
	 * @param publicKey the public key to register
	 */
	public synchronized void registerPublicKey(NodeMetadata node, String publicKey) {
		keys.put(node, publicKey);
		regenerateAuthorizedKeysFile();
		logger.debug("Registered public key for "+node.getHostname());
	}

	/**
	 * Deregisters a public key
	 * @param node the node to deregister
	 */
	public synchronized void deregisterPublicKey(NodeMetadata node) {
		keys.remove(node);
		regenerateAuthorizedKeysFile();
		logger.debug("Deregistered public key for "+node.getHostname());
	}

	/**
	 * Generates the public key file list
	 */
	private synchronized void regenerateAuthorizedKeysFile() {
		if (AUTH_KEY_FILE.exists()) {
			AUTH_KEY_FILE.delete();
		}

		try {
			PrintWriter out = new PrintWriter(AUTH_KEY_FILE);
			for (NodeMetadata node : keys.keySet()) {
				String publicKeys = keys.get(node);
				out.println(publicKeys);
			}
			out.close();

			// Change the permissions -- assumes Linux OS
			CLibrary libc = (CLibrary) Native.loadLibrary("c", CLibrary.class);
			libc.chmod(AUTH_KEY_FILE.getAbsolutePath(), 0600);
		} catch (IOException e) {
			e.printStackTrace();
			logger.warn("Could not write to "+AUTH_KEY_FILE.getAbsolutePath());
		}
	}

	private interface CLibrary extends Library {
	    public int chmod(String path, int mode);
	}
}


text:
/* */
"format cjs";
if (typeof global !== 'undefined') {
    global['javascript'] = {};
    global['javascript']['util'] = {};
    global['javascript']['util']['ArrayList'] = javascript.util.ArrayList;
    global['javascript']['util']['Arrays'] = javascript.util.Arrays;
    global['javascript']['util']['Collection'] = javascript.util.Collection;
    global['javascript']['util']['EmptyStackException'] = javascript.util.EmptyStackException;
    global['javascript']['util']['HashMap'] = javascript.util.HashMap;
    global['javascript']['util']['HashSet'] = javascript.util.HashSet;
    global['javascript']['util']['IndexOutOfBoundsException'] = javascript.util.IndexOutOfBoundsException;
    global['javascript']['util']['Iterator'] = javascript.util.Iterator;
    global['javascript']['util']['List'] = javascript.util.List;
    global['javascript']['util']['Map'] = javascript.util.Map;
    global['javascript']['util']['NoSuchElementException'] = javascript.util.NoSuchElementException;
    global['javascript']['util']['OperationNotSupported'] = javascript.util.OperationNotSupported;
    global['javascript']['util']['Set'] = javascript.util.Set;
    global['javascript']['util']['SortedMap'] = javascript.util.SortedMap;
    global['javascript']['util']['SortedSet'] = javascript.util.SortedSet;
    global['javascript']['util']['Stack'] = javascript.util.Stack;
    global['javascript']['util']['TreeMap'] = javascript.util.TreeMap;
    global['javascript']['util']['TreeSet'] = javascript.util.TreeSet;
}


text:
@implementation CLAppDelegate

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
    self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
    // Override point for customization after application launch.
    self.window.backgroundColor = [UIColor whiteColor];
    self.window.rootViewController = [[PermissionsTestViewController alloc] initWithNibName:nil bundle:nil];
    [self.window makeKeyAndVisible];

    return YES;

}

-(void)application:(UIApplication*) application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken
{
    BOOL didRegisterPushNotification = [ClusterPrePermissions didRegisterPushNotification];
    if(!didRegisterPushNotification) {
        [ClusterPrePermissions setResultForRigisterPushNotification:YES];
    }
    //Register device token stuff with whatever push notification system you're using
}

-(void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo
{
    //Handle information from remote notification here
    NSLog(@"%s, userinfo:%@", __func__, userInfo);
}

-(void)application:(UIApplication *)application didFailToRegisterForRemoteNotificationsWithError:(NSError *)error
{
    NSLog(@"%s, %@", __func__, error);
}

- (void)applicationWillResignActive:(UIApplication *)application
{
    // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
    // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game.
}

- (void)applicationDidEnterBackground:(UIApplication *)application
{
    // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
    // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
}

- (void)applicationWillEnterForeground:(UIApplication *)application
{
    // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background.
}

- (void)applicationDidBecomeActive:(UIApplication *)application
{
    // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
}

- (void)applicationWillTerminate:(UIApplication *)application
{
    // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
}

@end


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

describe Gene::Lang::ArgumentsScope do
  before  do
    @application = Gene::Lang::Application.new
    @matcher = Gene::Lang::Matcher.new
    @matcher.from_array [
      Gene::Types::Symbol.new('arg1'),
      Gene::Types::Symbol.new('arg2...'),
      Gene::Types::Symbol.new('^^attr1'),
    ]
  end

  it "should work" do
    arguments = Gene::Lang::Object.new
    arguments.data = [1, 2, 3]
    scope = Gene::Lang::ArgumentsScope.new arguments, @matcher
    scope.get_member('arg1').should == 1
    scope.get_member('arg2').should == [2, 3]
  end

  it "prop matcher should work" do
    arguments = Gene::Lang::Object.new
    arguments.set 'attr1', 'a'
    scope = Gene::Lang::ArgumentsScope.new arguments, @matcher
    scope.get_member('attr1').should == 'a'
  end

  it "`set_member` should work" do
    arguments = Gene::Lang::Object.new
    arguments.data = [1, 2]
    scope = Gene::Lang::ArgumentsScope.new arguments, @matcher
    scope.set_member('arg1', 3)
    arguments.data.should == [3, 2]
  end

  it "`set_member` should work for expandable data matcher" do
    arguments = Gene::Lang::Object.new
    arguments.data = [1, 2, 3]
    scope = Gene::Lang::ArgumentsScope.new arguments, @matcher
    scope.set_member('arg2', [3, 4])
    arguments.data.should == [1, 3, 4]
  end

  it "`set_member` should work for prop_matcher" do
    arguments = Gene::Lang::Object.new
    arguments.set 'attr1', 'a'
    scope = Gene::Lang::ArgumentsScope.new arguments, @matcher
    scope.set_member('attr1', 'b')
    arguments.get('attr1').should == 'b'
  end
end


text:
#include "mrcp_session_descriptor.h"

MRCP_DECLARE(mrcp_session_descriptor_t*) mrcp_session_descriptor_create(apr_pool_t *pool)
{
	mrcp_session_descriptor_t *descriptor = apr_palloc(pool,sizeof(mrcp_session_descriptor_t));
	apt_string_reset(&descriptor->origin);
	apt_string_reset(&descriptor->ip);
	apt_string_reset(&descriptor->ext_ip);
	apt_string_reset(&descriptor->resource_name);
	descriptor->resource_state = FALSE;
	descriptor->status = MRCP_SESSION_STATUS_OK;
	descriptor->response_code = 0;
	descriptor->control_media_arr = apr_array_make(pool,1,sizeof(void*));
	descriptor->audio_media_arr = apr_array_make(pool,1,sizeof(mpf_rtp_media_descriptor_t*));
	descriptor->video_media_arr = apr_array_make(pool,0,sizeof(mpf_rtp_media_descriptor_t*));
	return descriptor;
}

MRCP_DECLARE(mrcp_session_descriptor_t*) mrcp_session_answer_create(const mrcp_session_descriptor_t *offer, apr_pool_t *pool)
{
	int i;
	mrcp_session_descriptor_t *answer = apr_palloc(pool,sizeof(mrcp_session_descriptor_t));
	apt_string_reset(&answer->origin);
	apt_string_reset(&answer->ip);
	apt_string_reset(&answer->ext_ip);
	answer->resource_name = offer->resource_name;
	answer->resource_state = offer->resource_state;
	answer->status = offer->status;
	answer->control_media_arr = apr_array_make(pool,offer->control_media_arr->nelts,sizeof(void*));
	for(i=0; i<offer->control_media_arr->nelts; i++) {
		APR_ARRAY_PUSH(answer->control_media_arr,void*) = NULL;
	}
	answer->audio_media_arr = apr_array_make(pool,offer->audio_media_arr->nelts,sizeof(mpf_rtp_media_descriptor_t*));
	for(i=0; i<offer->audio_media_arr->nelts; i++) {
		APR_ARRAY_PUSH(answer->audio_media_arr,mpf_rtp_media_descriptor_t*) = NULL;
	}
	answer->video_media_arr = apr_array_make(pool,offer->video_media_arr->nelts,sizeof(mpf_rtp_media_descriptor_t*));
	for(i=0; i<offer->video_media_arr->nelts; i++) {
		APR_ARRAY_PUSH(answer->video_media_arr,mpf_rtp_media_descriptor_t*) = NULL;
	}
	return answer;
}

MRCP_DECLARE(const char*) mrcp_session_status_phrase_get(mrcp_session_status_e status)
{
	switch(status) {
		case MRCP_SESSION_STATUS_OK:
			return "OK";
		case MRCP_SESSION_STATUS_NO_SUCH_RESOURCE:
			return "Not Found";
		case MRCP_SESSION_STATUS_UNACCEPTABLE_RESOURCE:
			return "Not Acceptable";
		case MRCP_SESSION_STATUS_UNAVAILABLE_RESOURCE:
			return "Unavailable";
		case MRCP_SESSION_STATUS_ERROR:
			return "Error";
	}
	return "Unknown";
}


text:
package com.example.mateus.wristplayer.tiltMonitor;

/**
 * Created by mateus on 12/28/16.
 */

public interface TiltMonitorListener {

    void onTiltDetected();

}


text:
//------------------------------------------------------------------------------
// <auto-generated>
//     This code was generated by a tool
//     Changes to this file will be lost if the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace EventManager.Server.Data.Model
{
	using System;
	using System.Collections.Generic;
	using System.Linq;
	using System.Text;

	public class TouristAttraction : Entity
	{
		public string Name
		{
			get;
			set;
		}

		public string Description
		{
			get;
			set;
		}

		public double Longitude
		{
			get;
			set;
		}

		public double Latitude
		{
			get;
			set;
		}

		public string Address
		{
			get;
			set;
		}

		public virtual PhotoAlbum Photos
		{
			get;
			set;
		}

	}
}


text:
.PHONY: unpack-deps deps dep-KrisLibrary dep-ode dep-glui dep-tinyxml

ODECONFIG = --with-trimesh=none --disable-demos
#Uncomment this if you want to build ODE as a shared library
#ODECONFIG += --enable-shared
#Comment this out if you want to build ODE in single precision
#(not recommended on Linux, may give reasonable performance on Windows)
ODECONFIG += --enable-double-precision

UNAME = $(shell uname)

unpack-deps:
	git clone https://github.com/krishauser/KrisLibrary
	tar xvzf ode-0.14.tar.gz
	tar xvzf glui-2.36.tgz
	tar xvzf glew-2.0.0.tgz

deps: dep-tinyxml dep-glew dep-glui dep-ode dep-KrisLibrary

dep-KrisLibrary:
	cd KrisLibrary; cmake .
	cd KrisLibrary; make KrisLibrary

dep-tinyxml:
	cd tinyxml; make lib

dep-glew:
	cd glew-2.0.0; make
	cd glew-2.0.0; sudo make install
	echo "/usr/lib64" | sudo tee /etc/ld.so.conf.d/GLEW.conf
	sudo ldconfig

ifeq ($(UNAME), Darwin)
dep-glui:
	patch -N glui-2.36/src/makefile < glui-mac-osx.patch || true
	cd glui-2.36/src; make
else
dep-glui:
	cd glui-2.36/src; make
endif

dep-ode:
	cd ode-0.14; X_EXTRA_LIBS=-lX11 CFLAGS=-fPIC CXXFLAGS=-fPIC ./configure $(ODECONFIG)
	cd ode-0.14; make

#NOTE: call "sudo make ldconfig-ode" if you have set --enable-shared in ODECONFIG
ldconfig-ode:
	echo "$(CURDIR)/ode-0.14/ode/src/.libs" > /etc/ld.so.conf.d/ode.conf
	ldconfig


text:
import sys
import logging

from framework.transactions.context import TokuTransaction
from website.app import init_app
from website.models import NodeLog, Node
from scripts import utils as script_utils
from modularodm import Q

logger = logging.getLogger(__name__)

# Use a system to mark migrated nodes
SYSTEM_TAG = 'migrated_logs'

def get_all_parents(node):
    # return a list contains all possible forked_from and registered_from of the node to the very origin
    parent_list = []
    while True:
        parent = get_parent(node)
        if parent is None:
            break
        parent_list.append(parent)
        node = parent
    return parent_list

def get_parent(node):
    # detemine the latest action of the node that generate this node and return its parent
    if node.forked_from and node.registered_from:
        if node.forked_date > node.registered_date:
            return node.forked_from
        else:
            return node.registered_from
    elif node.forked_from and not node.registered_from:
        return node.forked_from
    elif node.registered_from and not node.forked_from:
        return node.registered_from
    else:
        return None

def do_migration(records, dry=False):
    for node in records:
        logs = list(NodeLog.find(Q('was_connected_to', 'eq', node)))
        existing_logs = node.logs
        for log in logs:
            if not log.node__logged:
                continue
            log_node = log.node__logged[0]
            # if the log_node is not contained in the node parent list then it doesn't belong to this node
            if log_node not in get_all_parents(node):
                logger.info('Excluding log {} from list because it is not associated with node {}'.format(log, node))
                logs.remove(log)

        with TokuTransaction():
            node.logs = logs + existing_logs
            node.system_tags.append(SYSTEM_TAG)
            node_type = 'registration' if node.is_registration else 'fork'
            logger.info('Adding {} logs to {} {}'.format(len(logs), node_type, node))
            if not dry:
                try:
                    node.save()
                except Exception as err:
                    logger.error('Could not update logs for node {} due to error'.format(node._id))
                    logger.exception(err)
                    logger.error('Skipping...')

def get_targets():
    return Node.find(
        (
            (Q('registered_from', 'ne', None) & Q('logs', 'eq', []))
            | Q('forked_from', 'ne', None)
        )
        & Q('is_deleted', 'ne', True)
        & Q('system_tags', 'ne', SYSTEM_TAG)
    )

def main():
    init_app(routes=False)  # Sets the storage backends on all models
    dry = 'dry' in sys.argv
    if not dry:
        script_utils.add_file_logger(logger, __file__)
    do_migration(get_targets(), dry)

if __name__ == '__main__':
    main()


text:
using System;
using System.ComponentModel;

namespace Azure.ResourceManager.KeyVault.Models
{
    /// <summary> The KeyPermissions. </summary>
    public readonly partial struct KeyPermissions : IEquatable<KeyPermissions>
    {
        private readonly string _value;

        /// <summary> Determines if two <see cref="KeyPermissions"/> values are the same. </summary>
        /// <exception cref="ArgumentNullException"> <paramref name="value"/> is null. </exception>
        public KeyPermissions(string value)
        {
            _value = value ?? throw new ArgumentNullException(nameof(value));
        }

        private const string EncryptValue = "encrypt";
        private const string DecryptValue = "decrypt";
        private const string WrapKeyValue = "wrapKey";
        private const string UnwrapKeyValue = "unwrapKey";
        private const string SignValue = "sign";
        private const string VerifyValue = "verify";
        private const string GetValue = "get";
        private const string ListValue = "list";
        private const string CreateValue = "create";
        private const string UpdateValue = "update";
        private const string ImportValue = "import";
        private const string DeleteValue = "delete";
        private const string BackupValue = "backup";
        private const string RestoreValue = "restore";
        private const string RecoverValue = "recover";
        private const string PurgeValue = "purge";

        /// <summary> encrypt. </summary>
        public static KeyPermissions Encrypt { get; } = new KeyPermissions(EncryptValue);
        /// <summary> decrypt. </summary>
        public static KeyPermissions Decrypt { get; } = new KeyPermissions(DecryptValue);
        /// <summary> wrapKey. </summary>
        public static KeyPermissions WrapKey { get; } = new KeyPermissions(WrapKeyValue);
        /// <summary> unwrapKey. </summary>
        public static KeyPermissions UnwrapKey { get; } = new KeyPermissions(UnwrapKeyValue);
        /// <summary> sign. </summary>
        public static KeyPermissions Sign { get; } = new KeyPermissions(SignValue);
        /// <summary> verify. </summary>
        public static KeyPermissions Verify { get; } = new KeyPermissions(VerifyValue);
        /// <summary> get. </summary>
        public static KeyPermissions Get { get; } = new KeyPermissions(GetValue);
        /// <summary> list. </summary>
        public static KeyPermissions List { get; } = new KeyPermissions(ListValue);
        /// <summary> create. </summary>
        public static KeyPermissions Create { get; } = new KeyPermissions(CreateValue);
        /// <summary> update. </summary>
        public static KeyPermissions Update { get; } = new KeyPermissions(UpdateValue);
        /// <summary> import. </summary>
        public static KeyPermissions Import { get; } = new KeyPermissions(ImportValue);
        /// <summary> delete. </summary>
        public static KeyPermissions Delete { get; } = new KeyPermissions(DeleteValue);
        /// <summary> backup. </summary>
        public static KeyPermissions Backup { get; } = new KeyPermissions(BackupValue);
        /// <summary> restore. </summary>
        public static KeyPermissions Restore { get; } = new KeyPermissions(RestoreValue);
        /// <summary> recover. </summary>
        public static KeyPermissions Recover { get; } = new KeyPermissions(RecoverValue);
        /// <summary> purge. </summary>
        public static KeyPermissions Purge { get; } = new KeyPermissions(PurgeValue);
        /// <summary> Determines if two <see cref="KeyPermissions"/> values are the same. </summary>
        public static bool operator ==(KeyPermissions left, KeyPermissions right) => left.Equals(right);
        /// <summary> Determines if two <see cref="KeyPermissions"/> values are not the same. </summary>
        public static bool operator !=(KeyPermissions left, KeyPermissions right) => !left.Equals(right);
        /// <summary> Converts a string to a <see cref="KeyPermissions"/>. </summary>
        public static implicit operator KeyPermissions(string value) => new KeyPermissions(value);

        /// <inheritdoc />
        [EditorBrowsable(EditorBrowsableState.Never)]
        public override bool Equals(object obj) => obj is KeyPermissions other && Equals(other);
        /// <inheritdoc />
        public bool Equals(KeyPermissions other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase);

        /// <inheritdoc />
        [EditorBrowsable(EditorBrowsableState.Never)]
        public override int GetHashCode() => _value?.GetHashCode() ?? 0;
        /// <inheritdoc />
        public override string ToString() => _value;
    }
}


text:
#ifndef PROBE_RENDER_TASK_H_INCLUDED
#define PROBE_RENDER_TASK_H_INCLUDED

#include "mesh_gl/AbstractGPURenderTaskDataSource.h"

namespace megamol {
namespace probe_gl {

class ProbeRenderTasks : public mesh_gl::AbstractGPURenderTaskDataSource {
public:
    /**
     * Answer the name of this module.
     *
     * @return The name of this module.
     */
    static const char* ClassName(void) {
        return "ProbeRenderTasks";
    }

    /**
     * Answer a human readable description of this module.
     *
     * @return A human readable description of this module.
     */
    static const char* Description(void) {
        return "...";
    }

    /**
     * Answers whether this module is available on the current system.
     *
     * @return 'true' if the module is available, 'false' otherwise.
     */
    static bool IsAvailable(void) {
        return true;
    }

    ProbeRenderTasks();
    ~ProbeRenderTasks();

protected:
    /**
     * Implementation of 'Create'.
     *
     * @return 'true' on success, 'false' otherwise.
     */
    virtual bool create();

    virtual bool getDataCallback(core::Call& caller);

    virtual bool getMetaDataCallback(core::Call& caller);

private:
    struct PerProbeDrawData {
        glm::mat4x4 object_transform;
        int highlighted;
        float pad0;
        float pad1;
        float pad2;
    };

    uint32_t m_version;

    /** In-place material collection (initialized with probe btf) */
    std::shared_ptr<mesh_gl::GPUMaterialCollection> m_material_collection;

    std::vector<std::string> m_identifiers;

    std::vector<glowl::DrawElementsCommand> m_draw_commands;

    std::vector<PerProbeDrawData> m_probe_draw_data;

    bool m_show_probes;

    core::CallerSlot m_probes_slot;

    core::CallerSlot m_event_slot;
};

} // namespace probe_gl
} // namespace megamol

#endif // !PROBE_RENDER_TASK_H_INCLUDED


text:
using Newtonsoft.Json;

namespace CompayaSmsGateway.Models.Sms
{
    internal class DeleteRequestModel
    {
        [JsonProperty(PropertyName = "reference")]
        public string Reference { get; set; }
    }
}


text:
{% extends 'projadmin/base.html' %}

{% block sidebar %}
  {% with current_sidebar="images" %}
    {{block.super}}
  {% endwith %}
{% endblock %}

{% block page_header %}
  {% url projadmin/images as refresh_link %}
  {# to make searchable false, just remove it from the include statement #}
  {% include '_page_header.html' with title="Images" refresh_link=refresh_link searchable="true" %}
{% endblock page_header %}

{% block _main %}
  {% include 'projadmin/image_table.html' %}
  {% if 'fileupload' in request.features %}
    <a href={% url projadmin/fileupload %}> Add Image </a>
  {% endif %}
{% endblock %}


text:
/*	$NetBSD: makecontext.c,v 1.4 2012/03/21 14:03:06 christos Exp $	*/

/*-
 * Copyright (c) 2001 The NetBSD Foundation, Inc.
 * All rights reserved.
 *
 * This code is derived from software contributed to The NetBSD Foundation
 * by Klaus Klein.
 *
 * 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.
 *
 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
 * ``AS IS'' AND ANY EXPRESS 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 FOUNDATION OR CONTRIBUTORS
 * 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.
 */

#include <sys/cdefs.h>
#if defined(LIBC_SCCS) && !defined(lint)
__RCSID("$NetBSD: makecontext.c,v 1.4 2012/03/21 14:03:06 christos Exp $");
#endif

#include <stddef.h>
#include <inttypes.h>
#include <ucontext.h>
#include "extern.h"

#include <stdarg.h>

void
makecontext(ucontext_t *ucp, void (*func)(void), int argc, ...)
{
	__greg_t *gr = ucp->uc_mcontext.__gregs;
	int i;
	unsigned int *sp;
	va_list ap;

	/* Compute and align stack pointer. */
	sp = (unsigned int *)
	    (((uintptr_t)ucp->uc_stack.ss_sp + ucp->uc_stack.ss_size) & ~7);
	/* Allocate necessary stack space for arguments exceeding r0-3. */
	if (argc > 4)
		sp -= argc - 4;
	gr[_REG_SP] = (__greg_t)(uintptr_t)sp;
	/* Wipe out frame pointer. */
	gr[_REG_FP] = 0;
	/* Arrange for return via the trampoline code. */
	gr[_REG_LR] = (__greg_t)(uintptr_t)_resumecontext;
	gr[_REG_PC] = (__greg_t)(uintptr_t)func;

	va_start(ap, argc);
	/* Pass up to four arguments in r0-3. */
	for (i = 0; i < argc && i < 4; i++)
		gr[_REG_R0 + i] = va_arg(ap, int);
	/* Pass any additional arguments on the stack. */
	for (argc -= i; argc > 0; argc--)
		*sp++ = va_arg(ap, int);
	va_end(ap);
}


text:
<selector xmlns:android="http://schemas.android.com/apk/res/android">
    <item android:drawable="@drawable/duyurular"
        android:state_focused="true"
        android:state_pressed="true" />
    <item android:drawable="@drawable/duyurular"
        android:state_focused="false"
        android:state_pressed="true" />
    <item android:drawable="@drawable/duyurular" android:state_focused="true" />
    <item android:drawable="@drawable/duyurular"
        android:state_focused="false"
        android:state_pressed="false" />
</selector>


text:
This plugin provides information about X509 certificate accessible via local
file or network connection.

### Configuration

```toml
# Reads metrics from a SSL certificate
[[inputs.x509_cert]]
  ## List certificate sources
  sources = ["/etc/ssl/certs/ssl-cert-snakeoil.pem", "https://example.org:443"]

  ## Timeout for SSL connection
  # timeout = "5s"

  ## Optional TLS Config
  # tls_ca = "/etc/telegraf/ca.pem"
  # tls_cert = "/etc/telegraf/cert.pem"
  # tls_key = "/etc/telegraf/key.pem"

  ## Use TLS but skip chain & host verification
  # insecure_skip_verify = false
```

### Metrics

- x509_cert
  - tags:
    - source - source of the certificate
    - organization
    - organizational_unit
    - country
    - province
    - locality
  - fields:
    - expiry (int, seconds)
    - age (int, seconds)
    - startdate (int, seconds)
    - enddate (int, seconds)

### Example output

```
x509_cert,host=myhost,source=https://example.org age=1753627i,expiry=5503972i,startdate=1516092060i,enddate=1523349660i 1517845687000000000
x509_cert,host=myhost,source=/etc/ssl/certs/ssl-cert-snakeoil.pem age=7522207i,expiry=308002732i,startdate=1510323480i,enddate=1825848420i 1517845687000000000
```


text:
/*
|--------------------------------------------------------------------------
|   Put here handlebars helpers
*/

require([
  "handlebars"  //require handlebars
],

function(Handlebars) {

    Handlebars.registerHelper('ifCond', function (v1, operator, v2, options) {
        //console.log(v1, operator,v2,options);
        switch (operator) {
            case '==':
                return (v1 == v2) ? options.fn(this) : options.inverse(this);
                break;
            case '===':
                return (v1 === v2) ? options.fn(this) : options.inverse(this);
                break;
            case '<':
                return (v1 < v2) ? options.fn(this) : options.inverse(this);
                break;
            case '<=':
                return (v1 <= v2) ? options.fn(this) : options.inverse(this);
                break;
            case '>':
                return (v1 > v2) ? options.fn(this) : options.inverse(this);
                break;
            case '>=':
                return (v1 >= v2) ? options.fn(this) : options.inverse(this);
                break;
            default:
                return options.inverse(this);
                break;
        }
    })

});


text:
package opt

import (
	"github.com/algolia/algoliasearch-client-go/v3/algolia/opt"
)

// ExtractLimit returns the first found LimitOption from the
// given variadic arguments or nil otherwise.
func ExtractLimit(opts ...interface{}) *opt.LimitOption {
	for _, o := range opts {
		if v, ok := o.(*opt.LimitOption); ok {
			return v
		}
	}
	return nil
}


text:
<?php

/**
* Required for class.media-extractor.php to match expected function naming convention.
*
* @param $url Can be just the $url or the whole $atts array
* @return bool|mixed The Youtube video ID via jetpack_get_youtube_id
*/

function jetpack_shortcode_get_youtube_id( $url ) {
    return jetpack_get_youtube_id( $url );
}

/**
* @param $url Can be just the $url or the whole $atts array
* @return bool|mixed The Youtube video ID
*/
function jetpack_get_youtube_id( $url ) {
	// Do we have an $atts array?  Get first att
	if ( is_array( $url ) )
		$url = $url[0];

	$url = youtube_sanitize_url( $url );
	$url = parse_url( $url );
	$id  = false;

	if ( ! isset( $url['query'] ) )
		return false;

	parse_str( $url['query'], $qargs );

	if ( ! isset( $qargs['v'] ) && ! isset( $qargs['list'] ) )
		return false;

	if ( isset( $qargs['list'] ) )
		$id = preg_replace( '|[^_a-z0-9-]|i', '', $qargs['list'] );

	if ( empty( $id ) )
		$id = preg_replace( '|[^_a-z0-9-]|i', '', $qargs['v'] );

	return $id;
}

if ( !function_exists( 'youtube_sanitize_url' ) ) :
/**
* Normalizes a YouTube URL to include a v= parameter and a query string free of encoded ampersands.
*
* @param string $url
* @return string The normalized URL
*/
function youtube_sanitize_url( $url ) {
	$url = trim( $url, ' "' );
	$url = trim( $url );
	$url = str_replace( array( 'youtu.be/', '/v/', '#!v=', '&', '&', 'playlist' ), array( 'youtu.be/?v=', '/?v=', '?v=', '&', '&', 'videoseries' ), $url );

	// Replace any extra question marks with ampersands - the result of a URL like "http://www.youtube.com/v/9FhMMmqzbD8?fs=1&hl=en_US" being passed in.
	$query_string_start = strpos( $url, "?" );

	if ( false !== $query_string_start ) {
		$url = substr( $url, 0, $query_string_start + 1 ) . str_replace( "?", "&", substr( $url, $query_string_start + 1 ) );
	}

	return $url;
}
endif;


text:
	$r.translate("step2.content")
#else
	$r.translate("step2.novalidChanges")
#end


text:
package top.limitart.net;

import top.limitart.net.flashssl.FlashSSLEndPoint;

/**
 * @author hank
 * @version 2018/10/15 0015 21:23
 */
public class FlashSSLServerDemo {
    public static void main(String[] args) throws Exception {
        FlashSSLEndPoint.builder().build().start(AddressPair.withPort(843));
    }
}