text:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using WorkLibrary;

namespace WorkData
{
    public class TaskReport
    {
        public TaskReport()
        {
        }

        public TaskReport(List<Filter> yearList, List<Filter> monthList, List<Filter> activityList, List<Filter> projectList, byte groupByOption, bool? calculateTime)
        {
            CalendarYearList = ConvertHelper.FilterListToIntList(yearList);
            CalendarMonthList = ConvertHelper.FilterListToIntList(monthList);
            ActivityIdList = ConvertHelper.FilterListToIntList(activityList);
            ProjectIdList = ConvertHelper.FilterListToIntList(projectList);
            GroupByOption = groupByOption;
            CalculateTime = calculateTime;
        }

        #region PROCEDURE PARAMETERS

        [Description("@calendar_year_list")]
        public List<int> CalendarYearList { get; set; }

        [Description("@calendar_month_list")]
        public List<int> CalendarMonthList { get; set; }

        [Description("@activity_id_list")]
        public List<int> ActivityIdList { get; set; }

        [Description("@project_id_list")]
        public List<int> ProjectIdList { get; set; }

        [Description("@group_by_option")]
        public byte GroupByOption { get; set; }

        [Description("@calculate_time")]
        public bool? CalculateTime { get; set; }

        #endregion

        #region PROPERTIES

        [Description("@calendar_year")]
        public short? CalendarYear { get; set; }

        [Description("@calendar_month")]
        public byte? CalendarMonth { get; set; }

        [Description("@project_name")]
        public string ProjectName { get; set; }

        [Description("@activity_name")]
        public string ActivityName { get; set; }

        [Description("@diff_seconds")]
        public int DiffSeconds { get; set; }

        public bool IsTotal
        {
            get
            {
                bool isTotal;
                ReportGroupOption reportGroupOption = (ReportGroupOption) GroupByOption;

                switch (reportGroupOption)
                {
                    case ReportGroupOption.YearMonthProjectActivity:
                        isTotal = CalendarYear == null || CalendarMonth == null || string.IsNullOrWhiteSpace(ProjectName) || string.IsNullOrWhiteSpace(ActivityName);
                        break;
                    case ReportGroupOption.YearMonthProject:
                        isTotal = CalendarYear == null || CalendarMonth == null || string.IsNullOrWhiteSpace(ProjectName);
                        break;
                    case ReportGroupOption.YearMonthActivity:
                        isTotal = CalendarYear == null || CalendarMonth == null || string.IsNullOrWhiteSpace(ActivityName);
                        break;
                    case ReportGroupOption.YearMonth:
                        isTotal = CalendarYear == null || CalendarMonth == null;
                        break;
                    case ReportGroupOption.YearProjectActivity:
                        isTotal = CalendarYear == null || string.IsNullOrWhiteSpace(ProjectName) || string.IsNullOrWhiteSpace(ActivityName);
                        break;
                    case ReportGroupOption.YearProject:
                        isTotal = CalendarYear == null || string.IsNullOrWhiteSpace(ProjectName);
                        break;
                    case ReportGroupOption.YearActivity:
                        isTotal = CalendarYear == null || string.IsNullOrWhiteSpace(ActivityName);
                        break;
                    case ReportGroupOption.Year:
                        isTotal = CalendarYear == null;
                        break;
                    case ReportGroupOption.ProjectActivity:
                        isTotal = string.IsNullOrWhiteSpace(ProjectName) || string.IsNullOrWhiteSpace(ActivityName);
                        break;
                    case ReportGroupOption.Project:
                        isTotal = string.IsNullOrWhiteSpace(ProjectName);
                        break;
                    case ReportGroupOption.Activity:
                        isTotal = string.IsNullOrWhiteSpace(ActivityName);
                        break;
                    case ReportGroupOption.None:
                        isTotal = true;
                        break;
                    default:
                        throw new ArgumentOutOfRangeException();
                }

                return isTotal;
            }
        }

        #endregion
    }
}


text:
//Webix CDN files are available online for HTTP or HTTPS including their fonts
//Place the following lines in your HTML file

//    <link rel="stylesheet" href="https://cdn.webix.com/edge/webix.css" type="text/css">
//

// webix supports a simple require, but only relative to the 'codebase'
// folder, so we can't go there much...

//console.log ( 'codebase' , webix.codebase );
//console.log ( 'url' , window.location , location );

//Here for reference, not needed for this script
// webix has no concept of query string params or pathnames in any
// reasonable form, so we just use a home grown query string hack
/*
function GetQueryStringParams(sParam) {
    var sPageURL = window.location.search.substring(1);
    var sURLVariables = sPageURL.split('&');
    for (var i = 0; i < sURLVariables.length; i++) {
        var sParameterName = sURLVariables[i].split('=');
        if (sParameterName[0] == sParam)
        {
            return sParameterName[1];
        }
    }
    return null;
}
var proxy = GetQueryStringParams('p');
*/

//Variable for the initial number of columns before we add EAs, Options, etc.
var NUM_COLUMNS=8;

//---------------------------------
// set up the REST location
//var myServer = proxy ? location.host + '/proxy/' + proxy : location.host ;
var myServer = location.host ;
var base_url = "https://" + myServer + "/wapi/v1.4/";
//console.log ( 'rest server' , base_url );

//---------------------------------
//Initialize the Webix Ready and Helper functions

//---------------------------------
// MAIN ENTRY POINT

webix.ready(function(){
    renderMain();
});

//---------------------------------
// HELPER Functions
webix.error = function(myText) {
    webix.message({type:"error", text: myText});
};

//---------------------------------
// Data controls

//---------------------------------
// Define our UI

var gridPanel = {
    rows: [
//---------------------------------
//First row is our form
//---------------------------------
    {
        view:"toolbar",
        id:"myToolbar",
        cols:[
            { view:"text",
                id: 'query',
                //label:"Hostname|Prefix",
                placeholder: 'hostname/ip (regex)',
                width: 200,
                //value:'linux',
                name: 'query' },
			{ view:"select",
				id: 'querytype',
				name: 'querytype',
				options: ['Name','Alias','IPv4','IPv6','MAC','Comment'],
				width: 100
			},
            { view:"button", id:"gridDelBut", value:"Search",
//When this search button is clicked, we will do an onGridSearch()
                click: 'onGridSearch',
                width:100, align:"left" },
            { view:"text",
            	id: 'max_results',
                //label:"Hostname|Prefix",
                label: 'Max Results',
                labelWidth: 100,
                labelAlign: 'right',
                placeholder: 'Max Results',
                width: 200,
                value:'100',
                name: 'max_results' },
            { view:"text",
            	id: 'total_records',
                //label:"Hostname|Prefix",
                label: 'Returned Records:',
                labelWidth: 125,
                labelAlign: 'right',
                placeholder: '0',
                width: 200,
//                value:'0',
                name: 'total_records'},
        ]
    },
//---------------------------------
//Second row is our table
//---------------------------------
    {
        id: "gridPanelGrid",
//Helper functions
        on:{
          onBeforeLoad:function(){
            this.showOverlay("Loading...");
          },
          onAfterLoad:function(){
            if (!this.count()){this.showOverlay("Sorry, there is no data");}
            else{this.hideOverlay();}
          }
        },
        view:"datatable",

//Set all of the table attributes
        select:"cell",
        multiselect:true,
        clipboard:"selection",
        resizeColumn: true,
//Uncomment the following if you want pagination
/*
//Link Pager to "pager" div ID from main HTML file
        pager:{
          template:"{common.first()} {common.prev()} {common.pages()} {common.next()} {common.last()}",
          container:"pager",
          autosize:true,
          group:10
    	},
*/
        leftSplit:3,
        minColumnWidth:150,
		//autoheight:true,
		//autowidth:true,
        //footer:true,
        //autoConfig:true
        // we /could/ use autoConfig, but it sets default widths (50px)
        // and the effort to walk the dataaset and resize everything
        // calling datatable.adjustColumn("title", "header");
        // is ineffecient since we are calling things like 'parse' that
        // will have done it N times already
        //
        // So we manually define the base columns, then add additional
        // columns later
//---------------------------------
//Define our Columns in the table here
//---------------------------------

        columns:[
            //autowidth:true,
            // sort == int or string
            // adjust:"data" : set col width to widest item
            // adjust:"header" : set col width to header string
            // fillspace:true : column widens to all avallable space
//            {id:"_ref", hidden: true, header:"ref", adjust:"data" },
            {id:"view", header:["View",{content:"selectFilter"}], adjust:"data", sort:"string"},
            {id:"name", header:["Name",{content:"textFilter"}], adjust:"data", sort:"string"},
            {id:"aliases", header:["Aliases",{content:"textFilter"}], adjust:"data", sort:"string"},
            {id:"ipv4addrs", header:["IPv4 Address",{content:"textFilter"}], adjust:"data", sort:"string"},
            {id:"ipv6addrs", header:["IPv6 Address",{content:"textFilter"}], adjust:"data", sort:"string"},
            {id:"zone", header:["Zone",{content:"selectFilter"}], adjust:"data", sort:"string"},
            {id:"comment", header:["Comment",{content:"textFilter"}], sort:"string"},
//Have a hard time sorting and filtering on boolean values, even if I convert them .toString(), so just make it sortable
            {id:"disable", header:"Disabled", rowspan:2, adjust:"header", sort:"string"}
//Can't do this because the select box uses the original values
//            {id:"disable", header:["Disabled",{content:"selectFilter"}], adjust:"header", sort:"string", format:function(value){
//				value=='true' ? value="Yes" : value="No";
//				return(value);
//            	}
//            }
        ]
    },
//---------------------------------
//Third & Forth row is our table to bound the datatable
//---------------------------------
    {
    view:"resizer",
    },
    {
    view:"template",
    template:"Written by Brad Andersen (brad@bradandersen.com)",
    type:"clean",
    height:40
    }
    ]

};

//---------------------------------
// UI Controllers

//Run this when the search button is pressed
function onGridSearch() {
    var myGrid = $$("gridPanelGrid");

//Remove any rows from the table from a previous run
    myGrid.clearAll();
    myGrid.showOverlay("Loading...");

// Setup the AJAX query
    var params={
            '_max_results' : $$("myToolbar").getValues().max_results,
            '_return_fields%2B' : 'comment,disable,view,zone,extattrs,aliases'
    };
    var query=$$("myToolbar").getValues().query;
    var querytype=$$("myToolbar").getValues().querytype;
    var queryop="~:"; //Case-insensitive regular expression search
    var queryobj="name";
    if(querytype=="Alias"){var queryobj="alias";}
    if(querytype=="Comment"){var queryobj="comment";}
    if(querytype=="MAC"){var queryobj="mac";}
    if(querytype=="IPv6"){var queryobj="ipv6addr";}
//IPv4 search do not have letters, so case-sensitivity does not work in the Infoblox API
    if(querytype=="IPv4"){var queryop="~"; var queryobj="ipv4addr";}
//Set a query operation if the query field has data
    if(query){
      var toquery=queryobj+queryop;
      toquery=toquery.toString();
      params[toquery]=query;
//console.log(toquery);
    }

//console.log(params);
    webix.ajax().get( base_url + 'record:host', params,
        // handlers
        {
            error:function(text, data, request){
                webix.error(request.status+':'+text);
            },
//Take the data.json from Infoblox API and add it to the table
            success:function(text, data, request){
                //console.log ( 'hosts' , data.json() );
                var myGrid = $$("gridPanelGrid");
                myGrid.hideOverlay();
                myGrid.showOverlay("Processing...");
                addResultsToGrid( data.json() );
            }
        });

}

//---------------------------------
//Add results to Webix datatable
//---------------------------------

function addResultsToGrid( json ) {
    var myGrid = $$("gridPanelGrid");

    // if you add rows to the grid, they don't autosize or support
    // autoConfig, so you should parse the whole dataset at once, clean
    // it up, then punt it to the renderer

    // walk each element of the grid and clean it up
    // and track all unique EAs
    var eaValues = {};
    var jsonarray=webix.toArray( json );
    jsonarray.each( function(rec) {

// flatten addresses, aliases, macs, Extensible Attributes
        var ipv4addrs = [];
        var ipv6addrs = [];
        var aliases = [];
//Does not work trying to turn a boolean into a string, webix.datatable still can't sort/filter
//        if (rec.disable){
//           rec.disable=rec.disable.toString();
//        }
        if ( rec.ipv4addrs ) {
            // use the webix toArray() + each()
            webix.toArray( rec.ipv4addrs ).each( function(ip) {
                ipv4addrs.push( ip.ipv4addr );
            });
            if ( ipv4addrs.length > 0 ) {
              rec.ipv4addrs = ipv4addrs.join(", ");
       		}

        }
        if ( rec.ipv6addrs ) {
            webix.toArray( rec.ipv6addrs ).each( function(ip) {
                ipv6addrs.push( ip.ipv6addr );
            });
            if ( ipv6addrs.length > 0 ) {
              rec.ipv6addrs = ipv6addrs.join(", ");
            }
        }
        if ( rec.aliases ) {
            rec.aliases=rec.aliases.join(", ");
//			console.log(rec.aliases);
        }

        // flatten EAs and add them as unique fields
        if ( rec.extattrs ) {
            Object.keys(rec.extattrs).forEach(function(key,index) {
//console.log(key+'='+JSON.stringify(index));
                var eaname = 'EA_'+key;
				//Replace spaces and dashes with underscores or webix.datatable will wrap the headers
                eaname=eaname.replace(/[\s\-]/ig,"_");
                rec[eaname] = rec.extattrs[key].value;
//console.log(rec.extattrs[key].value," -",eaname," - ",rec[eaname]);
                // and track this new EA in a hash
                eaValues[eaname] = 1 ;
            });

        }
//console.log ( 'rec' , rec );

    });

    // now add unique EA values as extra columns to the config at the end
    var columns = webix.toArray(myGrid.config.columns);

//If we do multiple searches our columns keep getting appended, so we must remove what was added previously.
    for (i = columns.length; i >= NUM_COLUMNS; i--) {
      columns.removeAt(i);
//      console.log(columns.length,'- removing ', i);
    }

    Object.keys(eaValues).sort(function(s1, s2){var l=s1.toLowerCase(), m=s2.toLowerCase();return l===m?0:l>m?1:-1;}).forEach(function(key,index) {
//console.log(key+'='+index);
        columns.insertAt({
            id: key,
            header: [key,{content:"textFilter"}],
            adjust:"header",
            sort:"string"
        },columns.length);
    });

//Various methods for refreshing columns, header, etc.
//    myGrid.refreshHeaderContent();
    myGrid.refreshColumns();
//    myGrid.refresh();
    myGrid.parse( json );
//    datatable.adjustColumn("title", "data");

//    var numrows=webix.toArray(json).length;

//  if you run this as text/javascript you have to do it this way
//    var elem = document.getElementById("total_records");
//    elem.value = numrows;
//    console.log(elem);
//  however, if you run this as application/javascript, this works
//    document.getElementById("total_records").value = numrows;
    document.getElementById("total_records").value = jsonarray.length;
//    webix.alert("Rows Returned: "+numrows);

}

//---------------------------------
// on Ready :

function renderMain() {
//    console.log ( "page rendered : ok" );

    // define the UI,
    // this is all done with objects, so we can use vars

    webix.ui( gridPanel );

}

redpajama_set_name: RedPajamaGithub


text:
<?php

/* TwigBundle:Exception:error.rdf.twig */
class __TwigTemplate_ee9f4fbb8cff7265002fa7dcc6ec5b6d6e8c82f1f798fa8f62d06db1c69a4a33 extends Twig_Template
{
    public function __construct(Twig_Environment $env)
    {
        parent::__construct($env);

        $this->parent = false;

        $this->blocks = array(
        );
    }

    protected function doDisplay(array $context, array $blocks = array())
    {
        // line 1
        $this->loadTemplate("TwigBundle:Exception:error.xml.twig", "TwigBundle:Exception:error.rdf.twig", 1)->display($context);
    }

    public function getTemplateName()
    {
        return "TwigBundle:Exception:error.rdf.twig";
    }

    public function getDebugInfo()
    {
        return array (  19 => 1,);
    }
}


text:
#include "vhcl.h"
#if !defined(__FLASHPLAYER__) && !defined(__ANDROID__)
#include "external/glew/glew.h"
#endif
#include "SbmShader.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#ifdef WIN32
#include <direct.h>
#endif
#include <vhcl.h>

#if !defined(ANDROID_BUILD) && !defined(SB_IPHONE)
/************************************************************************/
/* Shader program class                                                 */
/************************************************************************/

SbmShaderManager& SbmShaderManager::singleton()
{
	if (!_singleton)
		_singleton = new SbmShaderManager();
	return *_singleton;
}

void SbmShaderManager::destroy_singleton() {
	if( _singleton )
		delete _singleton;
	_singleton = NULL;
}

int SbmShaderManager::getShaderSupport() { return shaderSupport; }

SbmShaderProgram::SbmShaderProgram()
{
	vsID = -1;
	fsID = -1;
	programID = -1;
	isBuilt = false;
}

SbmShaderProgram::~SbmShaderProgram()
{
#if !defined(__FLASHPLAYER__)
	if (programID > 0 )
		glDeleteProgram(programID);
	if (vsID > 0)
		glDeleteShader(vsID);
	if (fsID > 0)
		glDeleteShader(fsID);
#endif
	isBuilt = false;
}

void SbmShaderProgram::initShaderProgram( const char* vsName, const char* fsName )
{
	// we can initialize the shader name first, before there is a opengl context
	if (vsName)
	{
		vsFilename = vsName;
		char *vs = NULL;
		vs = textFileRead(vsName);
		if (vs)
			vsShaderStr = vs;
		free(vs);

	}
	if (fsName)
	{
		fsFilename = fsName;
		char *fs = NULL;
		fs = textFileRead(fsName);
		if (fs)
			fsShaderStr = fs;
		free(fs);
	}
}

void SbmShaderProgram::initShaderProgramStr( const char* shaderVS, const char* shaderFS )
{
	if (shaderVS)
		vsShaderStr = shaderVS;
	if (shaderFS)
		fsShaderStr = shaderFS;
}

void SbmShaderProgram::buildShader()
{
#if !defined(__FLASHPLAYER__)
	// build the shader after there is an opengl context
	vsID = -1;
	fsID = -1;
	if (vsShaderStr.size() > 0)
	{
		LOG("Create Vertex Shader");
		vsID = glCreateShader(GL_VERTEX_SHADER);
		loadShaderStr(vsID,vsShaderStr.c_str());
		LOG("After Build Vertex Shader");
	}

	if (fsShaderStr.size() > 0)
	{
		LOG("Create Fragment Shader");
		fsID = glCreateShader(GL_FRAGMENT_SHADER);
		loadShaderStr(fsID,fsShaderStr.c_str());
		LOG("After Build Fragment Shader");
	}

	printShaderInfoLog(vsID);
    printShaderInfoLog(fsID);

	programID = glCreateProgram();
	if (vsID != -1)
		glAttachShader(programID,vsID);
	if (fsID != -1)
		glAttachShader(programID,fsID);
	glLinkProgram(programID);
	printProgramInfoLog(programID);
	isBuilt = true;
	//printOglError("linkProgram");
#endif
}

void SbmShaderProgram::loadShader(GLuint sID,  const char* shaderFileName )
{
	char *vs = NULL;
	vs = textFileRead(shaderFileName);
	if (!vs) return;
	const char* vv = vs;
	loadShaderStr(sID,vv);
	free(vs);
}

void SbmShaderProgram::loadShaderStr( GLuint sID, const char* shaderStr )
{
	glShaderSource(sID, 1, &shaderStr,NULL);
	glCompileShader(sID);
}

char * SbmShaderProgram::textFileRead(const char *fn )
{
	FILE *fp;
	char *content = NULL;
	int count=0;
	if (fn != NULL) {
		fp = fopen(fn,"rt");
		if (fp != NULL) {
			fseek(fp, 0, SEEK_END);
			count = ftell(fp);
			rewind(fp);
			if (count > 0) {
				content = (char *)malloc(sizeof(char) * (count+1));
				count = fread(content,sizeof(char),count,fp);
				content[count] = '\0';
			}
			fclose(fp);
		}
		else
		{
			LOG("*** ERROR: Could not open file %s", fn);
		}
	}
	return content;
}

void SbmShaderProgram::printShaderInfoLog( GLuint obj )
{
	int infologLength = 0;
	int charsWritten  = 0;
	char *infoLog;

	glGetShaderiv(obj, GL_INFO_LOG_LENGTH,&infologLength);

	if (infologLength > 0)
	{
		infoLog = (char *)malloc(infologLength);
		glGetShaderInfoLog(obj, infologLength, &charsWritten, infoLog);
		LOG("%s\n",infoLog);
		free(infoLog);
	}
}

void SbmShaderProgram::printProgramInfoLog( GLuint obj )
{
	int infologLength = 0;
	int charsWritten  = 0;
	char *infoLog;

	glGetProgramiv(obj, GL_INFO_LOG_LENGTH,&infologLength);

	if (infologLength > 0)
	{
		infoLog = (char *)malloc(infologLength);
		glGetProgramInfoLog(obj, infologLength, &charsWritten, infoLog);
		LOG("%s\n",infoLog);
		free(infoLog);
	}
}

void SbmShaderProgram::printOglError(const char* tag)
{
	GLenum glErr;
	int    retCode = 0;

	glErr = glGetError();
#if 1
	while (glErr != GL_NO_ERROR)
	{
#if !defined(__FLASHPLAYER__)
		LOG("glError %s: %s\n", tag,gluErrorString(glErr));
#endif
		retCode = 1;
		glErr = glGetError();
	}
#endif
}
/************************************************************************/
/* Shader Manager                                                       */
/************************************************************************/
SbmShaderManager* SbmShaderManager::_singleton = NULL;
int SbmShaderManager::shaderSupport = NO_GPU_SUPPORT;

SbmShaderManager::SbmShaderManager(void)
{
	viewer = NULL;
	shaderInit = false;
#ifdef __ANDROID__
	shaderSupport = SUPPORT_OPENGL_2_0;
#else
	shaderSupport = NO_GPU_SUPPORT;
#endif
}

void SbmShaderManager::setViewer( SrViewer* vw )
{
	if (vw == NULL)
	{
		shaderInit = false;
	}
	viewer = vw;
}

SbmShaderManager::~SbmShaderManager(void)
{
	std::map<std::string,SbmShaderProgram*>::iterator vi;
	for ( vi  = shaderMap.begin();
		  vi != shaderMap.end();
		  vi++)
	{
		SbmShaderProgram* program = vi->second;
		delete program;
	}
}

bool SbmShaderManager::initOpenGL()
{
	if (!viewer)
		return false;
	viewer->makeGLContext();
	return true;
}

bool SbmShaderManager::initGLExtension()
{
	if (shaderInit && shaderSupport != NO_GPU_SUPPORT) // already initialize glew
		return true;

    if (shaderInit && shaderSupport == NO_GPU_SUPPORT)
        return false;

#if !defined(__FLASHPLAYER__) && !defined(__ANDROID__)
	if (!viewer)
		return false;
        static int counter = 0;

	//viewer->makeGLContext();

	glewInit();

/*
#if !defined(MAC_BUILD)
    if (glewIsSupported("GL_VERSION_3_0"))
	{
        LOG("Ready for OpenGL 3.0\n");
		shaderInit = true;
		shaderSupport = SUPPORT_OPENGL_3_0;
		return true;
	}
    else
#endif
	*/
	if (glewIsSupported("GL_VERSION_2_0") || glewIsSupported("GL_VERSION_3_0"))
	{
		LOG("Ready for OpenGL 2.0.\n");
		shaderInit = true;
		shaderSupport = SUPPORT_OPENGL_2_0;
		return true;
	}
	else {
		//if (counter == 3)
		LOG("OpenGL 2.0 not supported. GPU Shader will be disabled.\n");
		//exit(1);
        counter++;
        if (counter == 3)
            shaderInit = true;
		return false;
    }
    //return false;
#elif defined(__ANDROID__)
	shaderInit = true;
	return true;
	return false;
#endif
}

void SbmShaderManager::addShader(const char* entryName, const char* vsName, const char* fsName, bool shaderFile )
{
    if (shaderSupport == NO_GPU_SUPPORT)
        return;

	std::string keyName = entryName;
	if (shaderMap.find(keyName) != shaderMap.end())
	{
		SbmShaderProgram* tempS = shaderMap[keyName];
		delete tempS;
	}

    SbmShaderProgram* program = new SbmShaderProgram();
	if (shaderFile)
		program->initShaderProgram(vsName,fsName);
	else
	{
		program->initShaderProgramStr(vsName,fsName);
	}
	shaderMap[keyName] = program;
}

void SbmShaderManager::buildShaders()
{
	std::map<std::string,SbmShaderProgram*>::iterator vi;
	for ( vi  = shaderMap.begin();
		  vi != shaderMap.end();
		  vi++)
	{
		SbmShaderProgram* program = vi->second;
		if (!program->finishBuild())
			program->buildShader();
	}
}

SbmShaderProgram* SbmShaderManager::getShader( const std::string& entryName )
{
	SbmShaderProgram* program = NULL;
	if (shaderMap.find(entryName) != shaderMap.end())
	{
		program = shaderMap[entryName];
	}
	return program;
}
#endif


text:
package io.github.resilience4j.ratpack.recovery;

import io.github.resilience4j.core.lang.Nullable;

public class DefaultRecoveryFunction<O> implements RecoveryFunction<O> {

    @Override
    @Nullable
    public O apply(@Nullable Throwable t) throws Exception {
        Exception exception = (Exception) t;
        if (exception != null) {
            throw exception;
        } else {
            return null;
        }
    }
}


text:
package org.kvj.bravo7.widget;

import org.kvj.bravo7.ApplicationContext;

import android.appwidget.AppWidgetManager;
import android.appwidget.AppWidgetProvider;
import android.content.Context;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.util.Log;
import android.widget.RemoteViews;

public abstract class WidgetProvider extends AppWidgetProvider {

	private static final String TAG = "WidgetProvider";
	protected ApplicationContext app = null;

	public WidgetProvider(ApplicationContext context) {
		this.app = context;
	}

	protected String getString(SharedPreferences data, int name, int def) {
		return data.getString(app.getResources().getString(name), app
				.getResources().getString(def));
	}

	protected void setInt(SharedPreferences data, int name, int value) {
		data.edit()
				.putString(app.getResources().getString(name),
						Integer.toString(value)).commit();
	}

	protected int getInt(SharedPreferences data, int name, int def) {
		int defInt = -1;
		try {
			defInt = Integer
					.parseInt(data.getString(app.getResources().getString(def),
							"-1"), 10);
		} catch (Exception e) {
			e.printStackTrace();
		}
		try {
			return Integer.parseInt(getString(data, name, def), 10);
		} catch (Exception e) {
			e.printStackTrace();
		}
		return defInt;
	}

	@Override
	public void onUpdate(Context context, AppWidgetManager appWidgetManager,
			int[] appWidgetIds) {
		super.onUpdate(context, appWidgetManager, appWidgetIds);
		Log.i(TAG, "onUpdate: " + appWidgetIds.length);
		for (int i = 0; i < appWidgetIds.length; i++) {
			// Call update for every widget
			int id = appWidgetIds[i];
			update(id, appWidgetManager, new Bundle());
		}
	}

	private boolean update(int id, AppWidgetManager appWidgetManager,
			Bundle extras) {
		SharedPreferences prefs = app.getWidgetConfig(id);
		if (null == prefs) { // Skip
			Log.w(TAG, "onUpdate: no prefs " + id);
			return false;
		}
		RemoteViews views = update(prefs, id, extras);
		if (null != views) { // Have views - update
			appWidgetManager.updateAppWidget(id, views);
		} else {
			Log.w(TAG, "onUpdate: no views " + id);
			return false;
		}
		return true;
	}

	public void update(int id, Bundle extras) {
		AppWidgetManager appWidgetManager = AppWidgetManager.getInstance(app);
		update(id, appWidgetManager, extras);
	}

	abstract protected RemoteViews update(SharedPreferences preferences,
			int id, Bundle data);

}


text:
// The MIT License (MIT)
//
// Copyright (c) 2014 Jonas Finnemann Jensen
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.

var slugid = require('./slugid');
var uuidv4 = require('uuid/v4');

/**
 * Test that we can correctly encode a "non-nice" uuid (with first bit set) to
 * its known slug. The specific uuid was chosen since it has a slug which
 * contains both `-` and `_` characters.
 */
exports.encodeTest = function(test) {
  test.expect(1);

  // 10000000010011110011111111001000110111111100101101001011000001101000100111111011101011101111101011010101111000011000011101010100....
  // <8 ><0 ><4 ><f ><3 ><f ><c ><8 ><d ><f ><c ><4 ><0 ><6 ><8 ><9 ><f ><e ><f ><d ><5 ><e ><1 ><8 ><7 ><5 ><4 >
  // < g  >< E  >< 8  >< _  >< y  >< N  >< _  >< L  >< S  >< w  >< J  >< -  >< 6  >< 7  >< 6  >< 1  >< e  >< G  >< H  >< V  >
  var uuid_ = '804f3fc8-dfcb-4b06-89fb-aefad5e18754';
  var expectedSlug = "gE8_yN_LSwaJ-6761eGHVA";

  // Encode
  var actualSlug = slugid.encode(uuid_);

  // Test that it encoded correctly
  test.ok(expectedSlug == actualSlug, "UUID not correctly encoded into slug: '" + expectedSlug + "' != '" + actualSlug + "'");

  test.done();
};

/**
 * Test that we can decode a "non-nice" slug (first bit of uuid is set) that
 * begins with `-`
 */
exports.decodeTest = function(test) {
  test.expect(1);

  // 11111011111011111011111011111011111011111011111001000011111011111011111111111111111111111111111111111111111111111111111111111101....
  // <f ><e ><f ><e ><f ><e ><f ><e ><4 ><3 ><e ><f ><f ><f ><f ><f ><f ><f ><f ><f ><f ><f ><f ><f ><f ><f ><d >
  // < -  >< -  >< -  >< -  >< -  >< -  >< -  >< -  >< Q  >< -  >< -  >< -  >< _  >< _  >< _  >< _  >< _  >< _  >< _  >< _  >< _  >< Q  >
  var slug = '--------Q--__________Q';
  var expectedUuid = "fbefbefb-efbe-43ef-bfff-fffffffffffd";

  // Decode
  var actualUuid = slugid.decode(slug);

  // Test that it is decoded correctly
  test.ok(expectedUuid == actualUuid, "Slug not correctly decoded into uuid: '" + expectedUuid + "' != '" + actualUuid + "'");

  test.done();
}

/**
 * Test that 100 v4 uuids are unchanged after encoding and then decoding them
 */
exports.uuidEncodeDecodeTest = function(test) {
  test.expect(100);

  for (i = 0; i < 100; i++) {
    // Generate uuid
    var uuid_ = uuidv4();

    // Encode
    var slug = slugid.encode(uuid_);

    // Test that decode uuid matches original
    test.ok(slugid.decode(slug) == uuid_, "Encode and decode isn't identity");
  }

  test.done();
};

/**
 * Test that 100 v4 slugs are unchanged after decoding and then encoding them.
 */
exports.slugDecodeEncodeTest = function(test) {
  test.expect(100);

  for (i = 0; i < 100; i++) {
    // Generate slug
    var slug1 = slugid.v4();

    // Decode
    var uuid_ = slugid.decode(slug1);

    // Encode
    var slug2 = slugid.encode(uuid_);

    // Test that decode uuid matches original
    test.ok(slug1 == slug2, "Decode and encode isn't identity");
  }

  test.done();
};

/**
 * Test: Make sure that all allowed characters can appear in all allowed
 * positions within the "nice" slug. In this test we generate over a thousand
 * slugids, and make sure that every possible allowed character per position
 * appears at least once in the sample of all slugids generated. We also make
 * sure that no other characters appear in positions in which they are not
 * allowed.
 *
 * base 64 encoding char -> value:
 * ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_
 * 0         1         2         3         4         5          6
 * 0123456789012345678901234567890123456789012345678901234567890123
 *
 * e.g. from this we can see 'j' represents 35 in base64
 *
 * The following comments show the 128 bits of the v4 uuid in binary, hex and
 * base 64 encodings. The 6 fixed bits (`0`/`1`) according to RFC 4122, plus
 * the first (most significant) fixed bit (`0`) are shown among the 121
 * arbitrary value bits (`.`/`x`). The `x` means the same as `.` but just
 * highlights which bits are grouped together for the respective encoding.
 *
 * schema:
 *      <..........time_low............><...time_mid...><time_hi_+_vers><clk_hi><clk_lo><.....................node.....................>
 *
 * bin: 0xxx............................................0100............10xx............................................................
 * hex:  $A <01><02><03><04><05><06><07><08><09><10><11> 4  <13><14><15> $B <17><18><19><20><21><22><23><24><25><26><27><28><29><30><31>
 *
 * => $A in {0, 1, 2, 3, 4, 5, 6, 7} (0b0xxx)
 * => $B in {8, 9, A, B} (0b10xx)
 *
 * bin: 0xxxxx..........................................0100xx......xxxx10............................................................xx0000
 * b64:   $C  < 01 >< 02 >< 03 >< 04 >< 05 >< 06 >< 07 >  $D  < 09 >  $E  < 11 >< 12 >< 13 >< 14 >< 15 >< 16 >< 17 >< 18 >< 19 >< 20 >  $F
 *
 * => $C in {A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V, W, X, Y, Z, a, b, c, d, e, f} (0b0xxxxx)
 * => $D in {Q, R, S, T} (0b0100xx)
 * => $E in {C, G, K, O, S, W, a, e, i, m, q, u, y, 2, 6, -} (0bxxxx10)
 * => $F in {A, Q, g, w} (0bxx0000)
 */
exports.niceSpreadTest = function(test) {
  var charsAll = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_".split('').sort().join('');
  // 0 - 31: 0b0xxxxx
  var charsC = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdef".split('').sort().join('');
  // 16, 17, 18, 19: 0b0100xx
  var charsD = "QRST".split('').sort().join('');
  // 2, 6, 10, 14, 18, 22, 26, 30, 34, 38, 42, 46, 50, 54, 58, 62: 0bxxxx10
  var charsE = "CGKOSWaeimquy26-".split('').sort().join('');
  // 0, 16, 32, 48: 0bxx0000
  var charsF = "AQgw".split('').sort().join('');
  expected = [charsC, charsAll, charsAll, charsAll, charsAll, charsAll, charsAll, charsAll, charsD, charsAll, charsE, charsAll, charsAll, charsAll, charsAll, charsAll, charsAll, charsAll, charsAll, charsAll, charsAll, charsF];
  spreadTest(
    test,
    function() {
      return slugid.nice();
    },
    expected
  );
}

/**
 * This test is the same as niceSpreadTest but for slugid.v4() rather than
 * slugid.nice(). The only difference is that a v4() slug can start with any of
 * the base64 characters since the first six bits of the uuid are random.
 */
exports.v4SpreadTest = function(test) {
  var charsAll = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_".split('').sort().join('');
  // 16, 17, 18, 19: 0b0100xx
  var charsD = "QRST".split('').sort().join('');
  // 2, 6, 10, 14, 18, 22, 26, 30, 34, 38, 42, 46, 50, 54, 58, 62: 0bxxxx10
  var charsE = "CGKOSWaeimquy26-".split('').sort().join('');
  // 0, 16, 32, 48: 0bxx0000
  var charsF = "AQgw".split('').sort().join('');
  expected = [charsAll, charsAll, charsAll, charsAll, charsAll, charsAll, charsAll, charsAll, charsD, charsAll, charsE, charsAll, charsAll, charsAll, charsAll, charsAll, charsAll, charsAll, charsAll, charsAll, charsAll, charsF];
  spreadTest(
    test,
    function() {
      return slugid.v4();
    },
    expected
  );
}

/**
 * `spreadTest` runs a test against the `generator` function, to check that
 * when calling it 64*40 times, the range of characters per string position it
 * returns matches the array `expected`, where each entry in `expected` is a
 * string of all possible characters that should appear in that position in the
 * string, at least once in the sample of 64*40 responses from the `generator`
 * function */
function spreadTest(test, generator, expected) {
  // k records which characters were found at which positions. It has one entry
  // per slugid character, therefore 22 entries. Each entry is an object with
  // a property for each character found, where the value of that property is
  // the number of times that character appeared at that position in the slugid
  // in the large sample of slugids generated in this test.
  var k = [[], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], []];

  test.expect(1);

  // Generate a large sample of slugids, and record what characters appeared
  // where...  A monte-carlo test has demonstrated that with 64 * 20
  // iterations, no failure occurred in 1000 simulations, so 64 * 40 should be
  // suitably large to rule out false positives.
  for (i = 0; i < 64 * 40; i++) {
    var slug = generator();
    for (j = 0; j < slug.length; j++) {
      if (k[j][slug.charAt(j)] === undefined) {
        k[j][slug.charAt(j)] = 1
      } else {
        k[j][slug.charAt(j)]++;
      }
    }
  }

  // Compose results into an array `actual`, for comparison with `expected`
  var actual = [];
  for (j = 0; j < k.length; j++) {
    a = Object.keys(k[j])
    actual[j] = ""
    for (x = 0; x  0) {
        actual[j] += a[x]
      }
    }
    // sort for easy comparison
    actual[j] = actual[j].split('').sort().join('');
  }

  test.ok(arraysEqual(expected, actual), "In a large sample of generated slugids, the range of characters found per character position in the sample did not match expected results.\n\nExpected: " + expected + "\n\nActual: " + actual)
  test.done();
}

/**
 * `arraysEqual` checks arrays `a` and `b` for equality
 */
function arraysEqual(a, b) {
  if (a === b) return true;
  if (a == null || b == null) return false;
  if (a.length != b.length) return false;
  for (var i = 0; i < a.length; ++i) {
    if (a[i] !== b[i]) return false;
  }
  return true;
}


text:
# deep-views

Views controller, dom directives and dom-sheets for deepjs

For [jquery dom manipulator](./docs/jquery-dom.md), take a look there.

Simple View :
```javascript
var deep = require("deepjs");
require("deep-views/index");
require("deep-views/lib/jquery-dom")("dom");

var view = deep.View({
	how: "<b>Hello my friend</b>",
	where: "dom.htmlOf::#content"
});

view.refresh();
```

"What" is injected in "how".
```javascript
var view = deep.View({
	what: {
		fullName:"John Rambo"
	},
	how: function (what) {
		return "<b>Hello " + what.fullName + "</b>";
	},
	where: "dom.replace::#content"
});
```

"What" could be loadable.
```javascript
var deep = require("deepjs"); // core
require("deep-views/index"); // views
require("deep-views/lib/jquery-dom")("dom"); // dom protocol

// browser side template and json client protocol
require("deep-marked/lib/jq-ajax")("marked"); // server side use : deep-marked/lib/nodejs
require("deep-jquery/lib/ajax/json")("json"); // server side use : deep-node/lib/rest/file/json

var view = deep.View({
	what: "json::/json/profile.json",
	how: "marked::/templates/my-template.html",
	where: "dom.prependTo::#content"
});
```

"What" could be deeply structured. every loadable string (with a valid protocol in front) will be replaced by its result.
```javascript
var view = deep.View({
	what: {
		datas:"json::/json/profile.json",
		otherDatas:"json::/json/comments.json"
	},
	how: "swig::/templates/simple-template.html",
	where: "dom.appendTo::#content"
});
```

"done" is executed after "where". Use it to bind custom behaviour.
```javascript
var view = deep.View({
	what: "json::/json/profile.json",
	how: "swig::/templates/simple-template.html",
	where: "dom.appendTo::#content",
	done: function (renderObject) {
		$(renderObject.placed).find("#fullname-span").click(function () {
			window.alert("You clicked on a name");
		});
	}
});
```

Full description :
```javascript
var view = deep.View({
	init:function(){
		// init views (bind event listeners, ...);
		// fired each time that view will be placed in dom.
		// (if you refresh a view that is already in dom : it is not fired)
	},
	// what datas to render
	what:{ /*...*/ }
	// how to render datas
	how: function(what){
		return something;
	},
	// where to place rendered output (in dom)
	where: function( howOutput ){
		// do as you want.
		return placed_dom_element;
	},
	done: function ( renderedObject ) {
		// "done" handler of whole render sequence
		// do as you want.
	},
	fail: function ( renderedObject ) {
		// manage any error from load/render sequence.
	},
	clean: function(){
		// remove event listeners
		// fired when its removed from dom
	}
});
view.refresh();
```

A config entry could be added :
```javascript
var view = deep.View({
	config:{
		scope:"browser", // or "both" (default), or "server"
		relink:false	// relink any anchor tag resent in rendered output to deeplink engine
	},
	how: "swig::/templates/simple-template.html",
	where: "dom.appendTo::#content"
});
```

Directives could be used with views html output.
Docs on directives and dom-sheets coming soon.

## Licence

LGPL 3.0


text:
// Copyright 2015 PingCAP, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// See the License for the specific language governing permissions and
// limitations under the License.

package stringutil

import (
	"strings"
	"unicode/utf8"

	"github.com/juju/errors"
)

// ErrSyntax indicates that a value does not have the right syntax for the target type.
var ErrSyntax = errors.New("invalid syntax")

// UnquoteChar decodes the first character or byte in the escaped string
// or character literal represented by the string s.
// It returns four values:
//
//1) value, the decoded Unicode code point or byte value;
//2) multibyte, a boolean indicating whether the decoded character requires a multibyte UTF-8 representation;
//3) tail, the remainder of the string after the character; and
//4) an error that will be nil if the character is syntactically valid.
//
// The second argument, quote, specifies the type of literal being parsed
// and therefore which escaped quote character is permitted.
// If set to a single quote, it permits the sequence \' and disallows unescaped '.
// If set to a double quote, it permits \" and disallows unescaped ".
// If set to zero, it does not permit either escape and allows both quote characters to appear unescaped.
// Different with strconv.UnquoteChar, it permits unnecessary backslash.
func UnquoteChar(s string, quote byte) (value []byte, tail string, err error) {
	// easy cases
	switch c := s[0]; {
	case c == quote:
		err = errors.Trace(ErrSyntax)
		return
	case c >= utf8.RuneSelf:
		r, size := utf8.DecodeRuneInString(s)
		if r == utf8.RuneError {
			value = append(value, c)
			return value, s[1:], nil
		}
		value = append(value, string(r)...)
		return value, s[size:], nil
	case c != '\\':
		value = append(value, c)
		return value, s[1:], nil
	}
	// hard case: c is backslash
	if len(s) <= 1 {
		err = errors.Trace(ErrSyntax)
		return
	}
	c := s[1]
	s = s[2:]
	switch c {
	case 'b':
		value = append(value, '\b')
	case 'n':
		value = append(value, '\n')
	case 'r':
		value = append(value, '\r')
	case 't':
		value = append(value, '\t')
	case 'Z':
		value = append(value, '\032')
	case '0':
		value = append(value, '\000')
	case '_', '%':
		value = append(value, '\\')
		value = append(value, c)
	case '\\':
		value = append(value, '\\')
	case '\'', '"':
		value = append(value, c)
	default:
		value = append(value, c)
	}
	tail = s
	return
}

// Unquote interprets s as a single-quoted, double-quoted,
// or backquoted Go string literal, returning the string value
// that s quotes. For example: test=`"\"\n"` (hex: 22 5c 22 5c 6e 22)
// should be converted to `"\n` (hex: 22 0a).
func Unquote(s string) (t string, err error) {
	n := len(s)
	if n < 2 {
		return "", errors.Trace(ErrSyntax)
	}
	quote := s[0]
	if quote != s[n-1] {
		return "", errors.Trace(ErrSyntax)
	}
	s = s[1 : n-1]
	if quote != '"' && quote != '\'' {
		return "", errors.Trace(ErrSyntax)
	}
	// Avoid allocation. No need to convert if there is no '\'
	if strings.IndexByte(s, '\\') == -1 && strings.IndexByte(s, quote) == -1 {
		return s, nil
	}
	buf := make([]byte, 0, 3*len(s)/2) // Try to avoid more allocations.
	for len(s) > 0 {
		mb, ss, err := UnquoteChar(s, quote)
		if err != nil {
			return "", errors.Trace(err)
		}
		s = ss
		buf = append(buf, mb...)
	}
	return string(buf), nil
}

const (
	patMatch = iota + 1
	patOne
	patAny
)

// CompilePattern handles escapes and wild cards convert pattern characters and
// pattern types.
func CompilePattern(pattern string, escape byte) (patChars, patTypes []byte) {
	var lastAny bool
	patChars = make([]byte, len(pattern))
	patTypes = make([]byte, len(pattern))
	patLen := 0
	for i := 0; i < len(pattern); i++ {
		var tp byte
		var c = pattern[i]
		switch c {
		case escape:
			lastAny = false
			tp = patMatch
			if i < len(pattern)-1 {
				i++
				c = pattern[i]
				if c == escape || c == '_' || c == '%' {
					// Valid escape.
				} else {
					// Invalid escape, fall back to escape byte.
					// mysql will treat escape character as the origin value even
					// the escape sequence is invalid in Go or C.
					// e.g., \m is invalid in Go, but in MySQL we will get "m" for select '\m'.
					// Following case is correct just for escape \, not for others like +.
					// TODO: Add more checks for other escapes.
					i--
					c = escape
				}
			}
		case '_':
			if lastAny {
				patChars[patLen-1], patTypes[patLen-1] = c, patOne
				patChars[patLen], patTypes[patLen] = '%', patAny
				patLen++
				continue
			}
			tp = patOne
		case '%':
			if lastAny {
				continue
			}
			lastAny = true
			tp = patAny
		default:
			lastAny = false
			tp = patMatch
		}
		patChars[patLen] = c
		patTypes[patLen] = tp
		patLen++
	}
	patChars = patChars[:patLen]
	patTypes = patTypes[:patLen]
	return
}

const caseDiff = 'a' - 'A'

// NOTE: Currently tikv's like function is case sensitive, so we keep its behavior here.
func matchByteCI(a, b byte) bool {
	return a == b
	// We may reuse below code block when like function go back to case insensitive.
	/*
		if a == b {
			return true
		}
		if a >= 'a' && a <= 'z' && a-caseDiff == b {
			return true
		}
		return a >= 'A' && a <= 'Z' && a+caseDiff == b
	*/
}

// DoMatch matches the string with patChars and patTypes.
func DoMatch(str string, patChars, patTypes []byte) bool {
	var sIdx int
	for i := 0; i < len(patChars); i++ {
		switch patTypes[i] {
		case patMatch:
			if sIdx >= len(str) || !matchByteCI(str[sIdx], patChars[i]) {
				return false
			}
			sIdx++
		case patOne:
			sIdx++
			if sIdx > len(str) {
				return false
			}
		case patAny:
			i++
			if i == len(patChars) {
				return true
			}
			for sIdx < len(str) {
				if matchByteCI(patChars[i], str[sIdx]) && DoMatch(str[sIdx:], patChars[i:], patTypes[i:]) {
					return true
				}
				sIdx++
			}
			return false
		}
	}
	return sIdx == len(str)
}


text:
module NavLYNX
  mattr_accessor :selected_class
  mattr_accessor :wrapper
  mattr_accessor :wrapper_class
end

require "nav_lynx/engine"


text:
import _extends from "@babel/runtime/helpers/extends";
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/objectWithoutPropertiesLoose";
import React from 'react';
import PropTypes from 'prop-types';
import KeyboardArrowLeft from '../internal/svg-icons/KeyboardArrowLeft';
import KeyboardArrowRight from '../internal/svg-icons/KeyboardArrowRight';
import withTheme from '../styles/withTheme';
import IconButton from '../IconButton';
/**
 * @ignore - internal component.
 */

var _ref = React.createElement(KeyboardArrowRight, null);

var _ref2 = React.createElement(KeyboardArrowLeft, null);

var _ref3 = React.createElement(KeyboardArrowLeft, null);

var _ref4 = React.createElement(KeyboardArrowRight, null);

const TablePaginationActions = React.forwardRef(function TablePaginationActions(props, ref) {
  const {
    backIconButtonProps,
    count,
    nextIconButtonProps,
    onChangePage,
    page,
    rowsPerPage,
    theme
  } = props,
        other = _objectWithoutPropertiesLoose(props, ["backIconButtonProps", "count", "nextIconButtonProps", "onChangePage", "page", "rowsPerPage", "theme"]);

  const handleBackButtonClick = event => {
    onChangePage(event, page - 1);
  };

  const handleNextButtonClick = event => {
    onChangePage(event, page + 1);
  };

  return React.createElement("div", _extends({
    ref: ref
  }, other), React.createElement(IconButton, _extends({
    onClick: handleBackButtonClick,
    disabled: page === 0,
    color: "inherit"
  }, backIconButtonProps), theme.direction === 'rtl' ? _ref : _ref2), React.createElement(IconButton, _extends({
    onClick: handleNextButtonClick,
    disabled: page >= Math.ceil(count / rowsPerPage) - 1,
    color: "inherit"
  }, nextIconButtonProps), theme.direction === 'rtl' ? _ref3 : _ref4));
});
process.env.NODE_ENV !== "production" ? TablePaginationActions.propTypes = {
  /**
   * Properties applied to the back arrow [`IconButton`](/api/icon-button/) element.
   */
  backIconButtonProps: PropTypes.object,

  /**
   * The total number of rows.
   */
  count: PropTypes.number.isRequired,

  /**
   * Properties applied to the next arrow [`IconButton`](/api/icon-button/) element.
   */
  nextIconButtonProps: PropTypes.object,

  /**
   * Callback fired when the page is changed.
   *
   * @param {object} event The event source of the callback
   * @param {number} page The page selected
   */
  onChangePage: PropTypes.func.isRequired,

  /**
   * The zero-based index of the current page.
   */
  page: PropTypes.number.isRequired,

  /**
   * The number of rows per page.
   */
  rowsPerPage: PropTypes.number.isRequired,

  /**
   * @ignore
   */
  theme: PropTypes.object.isRequired
} : void 0;
export default withTheme(TablePaginationActions);


text:
class Finance::FeeCollectionDiscount < ApplicationRecord
end


text:
index_menu_privacy='
Privacy (German)
'

privacy='
[For all claims and information you are kindly requested to refer to the original German version.](/de/privacy)
'


text:
require_relative './ruby-client/features/step_definitions/step_helpers.rb'
CONSTANTS_FILE = File.dirname(__FILE__) + '/../constants.h'

code = get_claim_code_from_server

def read_file
  File.open(CONSTANTS_FILE, 'r') do |f|
    f.read
  end
end

def write_file(string)
  f = open(CONSTANTS_FILE, 'w')
  f.write(string)
  f.close
end

if code.length > 0
  constants = read_file
  write_file(constants.gsub(/@".*"/, "@\"#{code}\""))
else
  puts "there was an error getting the code"
  exit -1
end


text:
Recommended VSCode extensions:

- C# - 1.8.0 or greater
- Status Bar Tasks - you'll thank me.
- vscode-icons - make it pretty.


text:
dbm.registerClass("dbm.core.extendedevent.commands.htmldom.BaseElementCommand", "dbm.core.extendedevent.commands.CommandBaseObject", function(objectFunctions, staticFunctions, ClassReference) {
	//console.log("dbm.core.extendedevent.commands.htmldom.BaseElementCommand");

	//Self reference
	var BaseElementCommand = dbm.importClass("dbm.core.extendedevent.commands.htmldom.BaseElementCommand");

	//Error report
	var ErrorManager = dbm.importClass("dbm.core.globalobjects.errormanager.ErrorManager");
	var ReportTypes = dbm.importClass("dbm.constants.error.ReportTypes");
	var ReportLevelTypes = dbm.importClass("dbm.constants.error.ReportLevelTypes");

	//Dependencies

	//Utils
	var ReevaluationCreator = dbm.importClass("dbm.utils.reevaluation.ReevaluationCreator");

	//Constants
	var CommandStatusTypes = dbm.importClass("dbm.constants.status.CommandStatusTypes");

	/**
	 * Constructor
	 */
	objectFunctions._init = function() {
		//console.log("dbm.core.extendedevent.commands.htmldom.BaseElementCommand::_init");

		this.superCall();

		this.elementReevaluator = null;

		return this;
	};

	/**
	 * Gets the parameters for this class. Part of the toString function.
	 */
	objectFunctions._toString_getAttributes = function(aReturnArray) {
		this.superCall(aReturnArray);

		aReturnArray.push("element: " + this.elementReevaluator);
	};

	objectFunctions.performDestroy = function() {

		ClassReference.softDestroyIfExists(this.elementReevaluator);

		this.superCall();
	};

	objectFunctions.setAllReferencesToNull = function() {

		this.elementReevaluator = null;

		this.superCall();
	};
});


text:
import imp
import os
import numpy as np
import multi_tracker_analysis as mta

class Config(object):
    def __init__(self, path, identifiercode=''):
        if '.py' in path:
            self.path = os.path.dirname(path)
        else:
            self.path = path
        self.identifiercode = identifiercode

        # pre-processing data parameters
        self.preprocess_data_function = self.preprocess_data
        self.minlength = 5 # in frames
        self.maxspeed = 150 # pixels / frame
        self.minspeed = 0
        self.minimal_cumulative_distance_travelled = 4

        # other parameters
        self.sensory_stimulus_on = []

    def preprocess_data(self, pandas_dataframe):
        print 'Preprocessing data - see config file for details!'

        pandas_dataframe = mta.read_hdf5_file_to_pandas.cull_short_trajectories(pandas_dataframe, self.minlength)
        pandas_dataframe = mta.read_hdf5_file_to_pandas.remove_rows_above_speed_threshold(pandas_dataframe, speed_threshold=self.maxspeed)
        pandas_dataframe = mta.read_hdf5_file_to_pandas.remove_objects_that_never_exceed_minimum_speed(pandas_dataframe, speed_threshold=self.minspeed)
        pandas_dataframe = mta.read_hdf5_file_to_pandas.cull_trajectories_that_do_not_cover_much_x_or_y_distance(pandas_dataframe, min_distance_travelled=self.minimal_cumulative_distance_travelled)

        # Delete cut and join trajectories
        instructions_filename = mta.read_hdf5_file_to_pandas.get_filename(self.path, 'delete_cut_join_instructions.pickle')
        if instructions_filename is not None:
            pandas_dataframe = mta.read_hdf5_file_to_pandas.delete_cut_join_trajectories_according_to_instructions(pandas_dataframe, instructions_filename)
        else:
            print 'No delete cut join instructions found in path!'

        return pandas_dataframe


text:
package nl.nn.adapterframework.extensions.javascript;

import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;

import nl.nn.adapterframework.util.flow.ResultHandler;

public class NashornTest {
	private Nashorn engine;

	@Before
	public void setUp() throws JavascriptException {
		engine = new Nashorn();
		engine.startRuntime();
	}

	@Test
	public void testGetEngine() {
		Assert.assertNotNull(engine.getEngine());
	}

	@Test
	public void testResultHandler() throws Exception {
		ResultHandler resultHandler = new ResultHandler();
		engine.setResultHandler(resultHandler);

		engine.executeScript("result('somerandomtext');");
		Assert.assertEquals("somerandomtext", resultHandler.waitFor());

		engine.executeScript("error('somerandomtext22');");
		try {
			resultHandler.waitFor();
			Assert.fail();
		} catch (Exception e) {
			Assert.assertEquals("somerandomtext22", e.getMessage());
		}
	}

	@Test
	public void testPromise() throws Exception {
		String script =
				"var promise = new Promise(function(resolve, reject) { \n" +
						"    resolve('Success') \n" +
						"}) \n" +
						"  \n" +
						"promise \n" +
						"    .then(function(successMessage) { \n" +
						"        result(successMessage); \n" +
						"    }) \n" +
						"    .catch(function(errorMessage) { \n" +
						"        error(errorMessage); \n" +
						"    }); ";

		ResultHandler resultHandler = new ResultHandler();
		engine.setResultHandler(resultHandler);
		engine.executeScript(script);
		Assert.assertEquals("Success", resultHandler.waitFor());
	}

	@Test
	public void testExecuteFunction() throws JavascriptException {
		String script = "function plusTwo(x) { return x + 2;}";
		engine.executeScript(script);
		Double out = (Double) engine.executeFunction("plusTwo", 5);
		Assert.assertEquals(7.0, out, 0.0);
	}

	@Test
	public void testExecuteFunctionNoParam() throws JavascriptException {
		String script = "function plusTwo(x) { return x + 2;}";
		engine.executeScript(script);
		Double out = (Double) engine.executeFunction("plusTwo");
		Assert.assertTrue(out.isNaN());
	}

	@Test(expected = JavascriptException.class)
	public void testExecuteFunctionUnknownFunc() throws JavascriptException {
		engine.executeFunction("plusTwo");
	}
}


text:
<!DOCTYPE html>

  <link rel="shortcut icon" href="favicon.ico" />
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <link rel="stylesheet" href="reset.css" />
  <link rel="stylesheet" href="style.css" />

  <title>Percentify</title>

Percentify

      <input type="checkbox" id="rounded">Round to whole numbers
      <input type="checkbox" id="half">Include half-points

      Total number of exam questions:
      <input type="text" id="number-input" autofocus>

      Exam is worth
      <input type="text" id="worth-input" value="100" autofocus>
      % of final grade


text:
#include "uthash.h"
#include <stdlib.h>   /* malloc */
#include <errno.h>    /* perror */
#include <stdio.h>    /* printf */

#define BUFLEN 20

#if 0
/* Print a message if the hash's no-expand flag is set. */
#undef uthash_noexpand_fyi
#undef uthash_expand_fyi
#define uthash_noexpand_fyi(tbl) printf("noexpand set\n");
#define uthash_expand_fyi(tbl) printf("hash expanded\n");
#endif

typedef struct name_rec {
    char boy_name[BUFLEN];
    UT_hash_handle hh;
} name_rec;

int namecmp(void *_a, void *_b) {
    name_rec *a = (name_rec*)_a;
    name_rec *b = (name_rec*)_b;
    return strcmp(a->boy_name,b->boy_name);
}

int main(int argc,char *argv[]) {
    name_rec *name, *names=NULL;
    char linebuf[BUFLEN];
    FILE *file;

    if ( (file = fopen( "test11.dat", "r" )) == NULL ) {
        perror("can't open: ");
        exit(-1);
    }

    while (fgets(linebuf,BUFLEN,file) != NULL) {
        if ( (name = (name_rec*)malloc(sizeof(name_rec))) == NULL) exit(-1);
        strncpy(name->boy_name,linebuf,BUFLEN);
        HASH_ADD_STR(names,boy_name,name);
    }

    fclose(file);
    HASH_SORT(names,namecmp);
    for(name=names;name;name=(name_rec*)(name->hh.next))
      printf("%s",name->boy_name);

   return 0;
}


text:
'''
Created by auto_sdk on 2014-12-17 17:22:51
'''
from top.api.base import RestApi
class WlbItemUpdateRequest(RestApi):
	def __init__(self,domain='gw.api.taobao.com',port=80):
		RestApi.__init__(self,domain, port)
		self.color = None
		self.delete_property_key_list = None
		self.goods_cat = None
		self.height = None
		self.id = None
		self.is_dangerous = None
		self.is_friable = None
		self.length = None
		self.name = None
		self.package_material = None
		self.pricing_cat = None
		self.remark = None
		self.title = None
		self.update_property_key_list = None
		self.update_property_value_list = None
		self.volume = None
		self.weight = None
		self.width = None

	def getapiname(self):
		return 'taobao.wlb.item.update'


text:
(function() {
  $(function() {
    var HtmlMode, editor;
    HtmlMode = ace.require("ace/mode/html").Mode;
    editor = ace.edit("code-preview-list");
    editor.getSession().setMode(new HtmlMode());
    editor.setTheme("ace/theme/github");
  });

}).call(this);


text:
/* Simple example showing off SpriteList */

function PlayState() {
  this.setup = function() {
    this.balls = new Pentagine.SpriteList();

    for (var i = 0; i < 10; i++) {
      var newBall = new Pentagine.Sprite(penta, 'ball.png', 5, i * 40 + 100);
      newBall.speed = 5;
      this.balls.push(newBall);
    }
  };

  this.update = function() {
    if (penta.isDown('right')) {
      this.balls.sprites.forEach(function(ball, index) {
        ball.x += ball.speed;
      });
    }

    if (penta.isDown('left')) {
      this.balls.sprites.forEach(function(ball, index) {
        ball.x -= ball.speed;
      });
    }
  };

  this.draw = function() {
    penta.clearCanvas('#00F');

    penta.drawString('Use RIGHT and LEFT arrow keys.', 2, 10);

    this.balls.draw();
  };
}

var penta = new Pentagine.Game();

penta.setup({ desiredFPS: 60,
              preventedKeys: ['down', 'right', 'left', 'up', 'space'],
              firstState: new PlayState(),
              width: 800,
              height: 640 });


text:
 /*!
 * \file
 * \brief
 */ /*-------------------------------------------------------------------*/

#include "esextcTessellationShaderBarrier.hpp"
#include "gluContextInfo.hpp"
#include "gluDefs.hpp"
#include "glwEnums.hpp"
#include "glwFunctions.hpp"
#include "tcuTestLog.hpp"

namespace glcts
{

/** Constructor
 *
 * @param context       Test context
 * @param name          Test case's name
 * @param description   Test case's description
 **/
TessellationShaderBarrierTests::TessellationShaderBarrierTests(Context& context, const ExtParameters& extParams)
	: TestCaseGroupBase(context, extParams, "tessellation_shader_tc_barriers",
						"Verifies memory barrier work correctly when used in"
						"tessellation control shaders")
{
	/* Left blank on purpose */
}

/* Instantiates all tests and adds them as children to the node */
void TessellationShaderBarrierTests::init(void)
{
	addChild(new glcts::TessellationShaderBarrier1(m_context, m_extParams));
	addChild(new glcts::TessellationShaderBarrier2(m_context, m_extParams));
	addChild(new glcts::TessellationShaderBarrier3(m_context, m_extParams));
}

/** Constructor
 *
 * @param context       Test context
 * @param name          Test case's name
 * @param description   Test case's desricption
 **/
TessellationShaderBarrierTestCase::TessellationShaderBarrierTestCase(Context& context, const ExtParameters& extParams,
																	 const char* name, const char* description)
	: TestCaseBase(context, extParams, name, description)
	, m_bo_id(0)
	, m_fs_id(0)
	, m_po_id(0)
	, m_tcs_id(0)
	, m_tes_id(0)
	, m_vao_id(0)
	, m_vs_id(0)
{
	/* Left blank on purpose */
}

/** Deinitializes all ES objects created for the test. */
void TessellationShaderBarrierTestCase::deinit()
{
	/** Call base class' deinit() function */
	TestCaseBase::deinit();

	if (!m_is_tessellation_shader_supported)
	{
		return;
	}

	const glw::Functions& gl = m_context.getRenderContext().getFunctions();

	/* Disable GL_RASTERIZER_DISCARD mode the test has enabled */
	gl.disable(GL_RASTERIZER_DISCARD);

	/* Bring back the original GL_PATCH_VERTICES_EXT setting */
	gl.patchParameteri(m_glExtTokens.PATCH_VERTICES, 3);

	/* Revert buffer object bindings */
	gl.bindBuffer(GL_TRANSFORM_FEEDBACK_BUFFER, 0 /* buffer */);
	gl.bindBufferBase(GL_TRANSFORM_FEEDBACK_BUFFER, 0 /* index */, 0 /* buffer */);

	/* Unbind vertex array object */
	gl.bindVertexArray(0);

	/* Free all the objects that might have been initialized */
	if (m_bo_id != 0)
	{
		gl.deleteBuffers(1, &m_bo_id);

		m_bo_id = 0;
	}

	if (m_fs_id != 0)
	{
		gl.deleteShader(m_fs_id);

		m_fs_id = 0;
	}

	if (m_po_id != 0)
	{
		gl.deleteProgram(m_po_id);

		m_po_id = 0;
	}

	if (m_tcs_id != 0)
	{
		gl.deleteShader(m_tcs_id);

		m_tcs_id = 0;
	}

	if (m_tes_id != 0)
	{
		gl.deleteShader(m_tes_id);

		m_tes_id = 0;
	}

	if (m_vs_id != 0)
	{
		gl.deleteShader(m_vs_id);

		m_vs_id = 0;
	}

	if (m_vao_id != 0)
	{
		gl.deleteVertexArrays(1, &m_vao_id);

		m_vao_id = 0;
	}
}

/** Initializes all ES objects that will be used for the test. */
void TessellationShaderBarrierTestCase::initTest()
{
	/* The test requires EXT_tessellation_shader */
	const glw::Functions& gl = m_context.getRenderContext().getFunctions();

	if (!m_is_tessellation_shader_supported)
	{
		return;
	}

	gl.genVertexArrays(1, &m_vao_id);
	GLU_EXPECT_NO_ERROR(gl.getError(), "Could not generate vertex array object");

	gl.bindVertexArray(m_vao_id);
	GLU_EXPECT_NO_ERROR(gl.getError(), "Error binding vertex array object!");

	/* Set up storage for XFB data. Also configure the BO binding points */
	const unsigned int xfb_data_size = getXFBBufferSize();

	gl.genBuffers(1, &m_bo_id);
	gl.bindBuffer(GL_TRANSFORM_FEEDBACK_BUFFER, m_bo_id);
	gl.bindBufferBase(GL_TRANSFORM_FEEDBACK_BUFFER, 0 /* index */, m_bo_id);
	gl.bufferData(GL_TRANSFORM_FEEDBACK_BUFFER, xfb_data_size, NULL /* data */, GL_STATIC_DRAW);

	GLU_EXPECT_NO_ERROR(gl.getError(), "Could not set up storage for XFB data");

	/* Set up shader objects */
	m_fs_id  = gl.createShader(GL_FRAGMENT_SHADER);
	m_tcs_id = gl.createShader(m_glExtTokens.TESS_CONTROL_SHADER);
	m_tes_id = gl.createShader(m_glExtTokens.TESS_EVALUATION_SHADER);
	m_vs_id  = gl.createShader(GL_VERTEX_SHADER);

	GLU_EXPECT_NO_ERROR(gl.getError(), "Could not create shader objects");

	/* Set up fragment shader body */
	const char* fs_body = "${VERSION}\n"
						  "\n"
						  "void main()\n"
						  "{\n"
						  "}\n";

	/* Set up tessellation control shader body */
	const char* tcs_body = getTCSCode();

	/* Set up tessellation evaluation shader body */
	const char* tes_body = getTESCode();

	/* Set up vertex shader body */
	const char* vs_body = getVSCode();

	/* Set up a program object */
	m_po_id = gl.createProgram();

	GLU_EXPECT_NO_ERROR(gl.getError(), "glCreateProgram() failed");

	/* Set up XFB */
	const char** names   = NULL;
	int			 n_names = 0;

	getXFBProperties(&n_names, &names);

	gl.transformFeedbackVaryings(m_po_id, n_names, names, GL_INTERLEAVED_ATTRIBS);
	GLU_EXPECT_NO_ERROR(gl.getError(), "glTransformFeedbackVaryings() failed");

	/* Try to compile and link all the shader objects */
	if (!buildProgram(m_po_id, m_fs_id, 1, &fs_body, m_tcs_id, 1, &tcs_body, m_tes_id, 1, &tes_body, m_vs_id, 1,
					  &vs_body))
	{
		TCU_FAIL("Program linking failed");
	}

	/* All set! */
}

/** Executes the test.
 *
 *  Sets the test result to QP_TEST_RESULT_FAIL if the test failed, QP_TEST_RESULT_PASS otherwise.
 *
 *  Note the function throws exception should an error occur!
 *
 *  @return STOP if the test has finished, CONTINUE to indicate iterate() should be called once again.
 **/
tcu::TestNode::IterateResult TessellationShaderBarrierTestCase::iterate(void)
{
	initTest();

	/* Do not execute if required extensions are not supported. */
	if (!m_is_tessellation_shader_supported)
	{
		throw tcu::NotSupportedError(TESSELLATION_SHADER_EXTENSION_NOT_SUPPORTED);
	}

	/* Prepare for the draw call */
	const glw::Functions& gl = m_context.getRenderContext().getFunctions();

	glw::GLint  drawcall_count		 = 0;
	glw::GLenum drawcall_mode		 = GL_NONE;
	glw::GLint  drawcall_n_instances = 1;
	glw::GLint  n_patch_vertices	 = 0;
	glw::GLenum tf_mode				 = GL_NONE;

	getDrawCallArgs(&drawcall_mode, &drawcall_count, &tf_mode, &n_patch_vertices, &drawcall_n_instances);

	gl.enable(GL_RASTERIZER_DISCARD);
	GLU_EXPECT_NO_ERROR(gl.getError(), "glEnable(GL_RASTERIZER_DISCARD) failed");

	gl.patchParameteri(m_glExtTokens.PATCH_VERTICES, n_patch_vertices);
	GLU_EXPECT_NO_ERROR(gl.getError(), "glPatchParameteriEXT() failed");

	gl.useProgram(m_po_id);
	GLU_EXPECT_NO_ERROR(gl.getError(), "glUseProgram() failed");

	gl.beginTransformFeedback(tf_mode);
	GLU_EXPECT_NO_ERROR(gl.getError(), "glBeginTransformFeedback() failed");
	{
		if (drawcall_n_instances == 1)
		{
			gl.drawArrays(drawcall_mode, 0 /* first */, drawcall_count);
		}
		else
		{
			DE_ASSERT(drawcall_n_instances > 1);

			gl.drawArraysInstanced(drawcall_mode, 0 /* first */, drawcall_count, drawcall_n_instances);
		}
		GLU_EXPECT_NO_ERROR(gl.getError(), "glDrawArrays() or glDrawArraysInstanced() failed");
	}
	gl.endTransformFeedback();
	GLU_EXPECT_NO_ERROR(gl.getError(), "glEndTransformFeedback() failed");

	/* Retrieve the data generated by XFB */
	int			bo_size  = getXFBBufferSize();
	const void* xfb_data = NULL;

	xfb_data = gl.mapBufferRange(GL_TRANSFORM_FEEDBACK_BUFFER, 0 /* offset */, bo_size, GL_MAP_READ_BIT);

	GLU_EXPECT_NO_ERROR(gl.getError(), "glMapBufferRange() failed");

	/* Verify the data */
	bool is_xfb_data_valid = verifyXFBBuffer(xfb_data);

	/* Unmap the buffer object */
	gl.unmapBuffer(GL_TRANSFORM_FEEDBACK_BUFFER);

	GLU_EXPECT_NO_ERROR(gl.getError(), "glUnmapBuffer() failed");

	/* Set the test result, depending on the verification outcome */
	if (is_xfb_data_valid)
	{
		m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass");
	}
	else
	{
		m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Fail");
	}

	return STOP;
}

/** Constructor
 *
 * @param context Test context
 **/
TessellationShaderBarrier1::TessellationShaderBarrier1(Context& context, const ExtParameters& extParams)
	: TessellationShaderBarrierTestCase(context, extParams, "barrier_guarded_read_calls",
										"Verifies invocation A can correctly read a per-vertex and"
										" per-patch attribute modified by invocation B after a barrier() call")
	, m_n_result_vertices(2048)
{
	m_n_input_vertices = (m_n_result_vertices / 2 /* result points per isoline */) * 4 /* vertices per patch */;
}

/** Retrieves arguments to be used for the rendering process.
 *
 *  @param out_mode             Deref will be used to store draw call mode. Must not be NULL.
 *  @param out_count            Deref will be used to store count argument to be used for the draw call.
 *                              Must not be NULL.
 *  @param out_tf_mode          Deref will be used to store transform feed-back mode to be used for
 *                              glBeginTransformFeedback() call, prior to issuing the draw call. Must
 *                              not be NULL.
 *  @param out_n_patch_vertices Deref will be used to store GL_PATCH_VERTICES_EXT pname value, to be set with
 *                              glPatchParameteriEXT() call prior to issuing the draw call. Must not be NULL.
 *  @param out_n_instances      Deref will be used to store amount of instances to use for the draw call.
 *                              Using a value of 1 will result in a glDrawArrays() call. Using values larger
 *                              than 1 will trigger glDrawArraysInstanced() call. Values smaller than 1 are
 *                              forbidden.
 **/
void TessellationShaderBarrier1::getDrawCallArgs(glw::GLenum* out_mode, glw::GLint* out_count, glw::GLenum* out_tf_mode,
												 glw::GLint* out_n_patch_vertices, glw::GLint* out_n_instances)
{
	*out_count			  = m_n_input_vertices;
	*out_mode			  = GL_PATCHES_EXT;
	*out_n_instances	  = 1;
	*out_n_patch_vertices = 4;
	*out_tf_mode		  = GL_POINTS;
}

/** Retrieves tessellation control shader body.
 *
 *  @return TC stage shader body.
 **/
const char* TessellationShaderBarrier1::getTCSCode()
{
	static const char* tcs_code =
		"${VERSION}\n"
		"\n"
		"${TESSELLATION_SHADER_REQUIRE}\n"
		"\n"
		"layout (vertices = 4) out;\n"
		"\n"
		"flat  in  int   vertex_id[];\n"
		"\n"
		"patch out int   test_patch_value;\n"
		"      out ivec4 test_vector [];\n"
		"      out ivec4 test_vector2[];\n"
		"\n"
		"void main()\n"
		"{\n"
		"    if (gl_InvocationID == 0)\n"
		"    {\n"
		"        test_patch_value = vertex_id[0];\n"
		"    }\n"
		"\n"
		"    test_vector[gl_InvocationID] = ivec4(vertex_id[gl_InvocationID],\n"
		"                                         vertex_id[gl_InvocationID] + 1,\n"
		"                                         vertex_id[gl_InvocationID] + 2,\n"
		"                                         vertex_id[gl_InvocationID] + 3);\n"
		"\n"
		"    barrier();\n"
		"\n"
		"    int next_invocation = (gl_InvocationID + 1) % 4;\n"
		"\n"
		"    test_vector2[gl_InvocationID] = ivec4(test_vector[next_invocation].xyz, test_patch_value);\n"
		"\n"
		"    gl_TessLevelOuter[0] = 1.0;\n"
		"    gl_TessLevelOuter[1] = 1.0;\n"
		"}\n";

	return tcs_code;
}

/** Retrieves tessellation evaluation shader body.
 *
 *  @return TE stage shader body.
 **/
const char* TessellationShaderBarrier1::getTESCode()
{
	static const char* tes_code = "${VERSION}\n"
								  "\n"
								  "${TESSELLATION_SHADER_REQUIRE}\n"
								  "\n"
								  "layout(isolines, point_mode) in;\n"
								  "\n"
								  "in ivec4 test_vector2[];\n"
								  "\n"
								  "out ivec4 result_vector2;\n"
								  "\n"
								  "void main()\n"
								  "{\n"
								  "    int base = gl_PrimitiveID * 4;\n"
								  "\n"
								  "    if (test_vector2[0].x == (base + 1) && test_vector2[0].y == (base + 2) && "
								  "test_vector2[0].z == (base + 3) && test_vector2[0].w == (base + 0)  &&\n"
								  "        test_vector2[1].x == (base + 2) && test_vector2[1].y == (base + 3) && "
								  "test_vector2[1].z == (base + 4) && test_vector2[1].w == (base + 0)  &&\n"
								  "        test_vector2[2].x == (base + 3) && test_vector2[2].y == (base + 4) && "
								  "test_vector2[2].z == (base + 5) && test_vector2[2].w == (base + 0)  &&\n"
								  "        test_vector2[3].x == (base + 0) && test_vector2[3].y == (base + 1) && "
								  "test_vector2[3].z == (base + 2) && test_vector2[3].w == (base + 0) )\n"
								  "    {\n"
								  "        result_vector2 = ivec4(1);\n"
								  "    }\n"
								  "    else\n"
								  "    {\n"
								  "        result_vector2 = ivec4(0);\n"
								  "    }\n"
								  "}\n";

	return tes_code;
}

/** Retrieves vertex shader body.
 *
 *  @return Vertex shader body.
 **/
const char* TessellationShaderBarrier1::getVSCode()
{
	static const char* vs_code = "${VERSION}\n"
								 "\n"
								 "flat out int vertex_id;\n"
								 "\n"
								 "void main()\n"
								 "{\n"
								 "    vertex_id = gl_VertexID;\n"
								 "}\n";

	return vs_code;
}

/** Retrieves amount of bytes that should be used for allocating storage space for
 *  a buffer object that will later be used to hold XFB result data.
 *
 *  @return Amount of bytes required by the test.
 */
int TessellationShaderBarrier1::getXFBBufferSize()
{
	return static_cast<int>(m_n_result_vertices * sizeof(int) * 4 /* components */ * 2 /* points per isoline */);
}

/** Retrieves names of transform feedback varyings and amount of those. These should be used
 *  prior to link the test program object.
 *
 *  @param out_n_names Deref will be used to store the number of names that @param out_names array
 *                     holds. Must not be NULL.
 *  @param out_names   Deref will be used to store a pointer to an array holding TF varying names;
 *                     Must not be NULL.
 **/
void TessellationShaderBarrier1::getXFBProperties(int* out_n_names, const char*** out_names)
{
	static const char* names[1] = { "result_vector2" };

	*out_n_names = 1;
	*out_names   = names;
}

/** Verifies data captured by XFB is correct.
 *
 *  @param data Buffer holding the result XFB data. Must not be NULL.
 *
 *  @return true if the result data is confirmed to be valid, false otherwise.
 **/
bool TessellationShaderBarrier1::verifyXFBBuffer(const void* data)
{
	int* data_int = (int*)data;

	/* Run through all vertices */
	for (unsigned int n_vertex = 0; n_vertex < m_n_result_vertices; ++n_vertex)
	{
		int retrieved_x = data_int[n_vertex * 4];
		int retrieved_y = data_int[n_vertex * 4 + 1];
		int retrieved_z = data_int[n_vertex * 4 + 2];
		int retrieved_w = data_int[n_vertex * 4 + 3];

		if (retrieved_x != 1 || retrieved_y != 1 || retrieved_z != 1 || retrieved_w != 1)
		{
			m_testCtx.getLog() << tcu::TestLog::Message << "Invalid value returned: expected:[1, 1, 1, 1]"
							   << " retrieved: "
							   << "[" << retrieved_x << ", " << retrieved_y << ", " << retrieved_z << ", "
							   << retrieved_w << tcu::TestLog::EndMessage;

			TCU_FAIL("Invalid rendering result");
		}
	}

	return true;
}

/** Constructor
 *
 * @param context Test context
 **/
TessellationShaderBarrier2::TessellationShaderBarrier2(Context& context, const ExtParameters& extParams)
	: TessellationShaderBarrierTestCase(context, extParams, "barrier_guarded_write_calls",
										"Verifies it is safe to write to the same per-patch output "
										"from multiple TC invocations, as long as each write happens "
										"in a separate phase.")
	, m_n_result_vertices(2048)
{
	m_n_input_vertices = (m_n_result_vertices / 2 /* result points per isoline */) * 4 /* vertices per patch */;
}

/** Retrieves arguments to be used for the rendering process.
 *
 *  @param out_mode             Deref will be used to store draw call mode. Must not be NULL.
 *  @param out_count            Deref will be used to store count argument to be used for the draw call.
 *                              Must not be NULL.
 *  @param out_tf_mode          Deref will be used to store transform feed-back mode to be used for
 *                              glBeginTransformFeedback() call, prior to issuing the draw call. Must
 *                              not be NULL.
 *  @param out_n_patch_vertices Deref will be used to store GL_PATCH_VERTICES_EXT pname value, to be set with
 *                              glPatchParameteriEXT() call prior to issuing the draw call. Must not be NULL.
 *  @param out_n_instances      Deref will be used to store amount of instances to use for the draw call.
 *                              Using a value of 1 will result in a glDrawArrays() call. Using values larger
 *                              than 1 will trigger glDrawArraysInstanced() call. Values smaller than 1 are
 *                              forbidden.
 **/
void TessellationShaderBarrier2::getDrawCallArgs(glw::GLenum* out_mode, glw::GLint* out_count, glw::GLenum* out_tf_mode,
												 glw::GLint* out_n_patch_vertices, glw::GLint* out_n_instances)
{
	*out_count			  = m_n_input_vertices;
	*out_mode			  = GL_PATCHES_EXT;
	*out_n_instances	  = 1;
	*out_n_patch_vertices = 4;
	*out_tf_mode		  = GL_POINTS;
}

/** Retrieves tessellation control shader body.
 *
 *  @return TC stage shader body.
 **/
const char* TessellationShaderBarrier2::getTCSCode()
{
	static const char* tcs_code = "${VERSION}\n"
								  "\n"
								  "${TESSELLATION_SHADER_REQUIRE}\n"
								  "\n"
								  "layout (vertices = 4) out;\n"
								  "\n"
								  "      out float tcs_result[];\n"
								  "patch out int   test_patch_value;\n"
								  "\n"
								  "void main()\n"
								  "{\n"
								  /* Four invocations per input patch will be executed. Have the first one write its
		 * secret value to the output per-patch attribute.
		 */
								  "    if (gl_InvocationID == 0)\n"
								  "    {\n"
								  "        test_patch_value = 123;\n"
								  "    }\n"
								  "\n"
								  "    barrier();\n"
								  "\n"
								  /* Let's have the second invocation update the value at this point */
								  "    if (gl_InvocationID == 1)\n"
								  "    {\n"
								  "        test_patch_value = 234;\n"
								  "    }\n"
								  "\n"
								  "    barrier();\n"
								  "\n"
								  /* Finally, if this is invocation number one, check if test_patch_value
		 * stores a correct value.
		 */
								  "    tcs_result[gl_InvocationID] = 2.0;\n"
								  "\n"
								  "    if (gl_InvocationID == 0)\n"
								  "    {\n"
								  "        if (test_patch_value == 234)\n"
								  "        {\n"
								  "            tcs_result[gl_InvocationID] = 1.0;\n"
								  "        }\n"
								  "    }\n"
								  "\n"
								  "    gl_TessLevelOuter[0] = 1.0;\n"
								  "    gl_TessLevelOuter[1] = 1.0;\n"
								  "}\n";

	return tcs_code;
}

/** Retrieves tessellation evaluation shader body.
 *
 *  @return TE stage shader body.
 **/
const char* TessellationShaderBarrier2::getTESCode()
{
	static const char* tes_code = "${VERSION}\n"
								  "\n"
								  "${TESSELLATION_SHADER_REQUIRE}\n"
								  "\n"
								  "layout(isolines, point_mode) in;\n"
								  "\n"
								  "      in float tcs_result[];\n"
								  "\n"
								  "out float tes_result;\n"
								  "\n"
								  "void main()\n"
								  "{\n"
								  /* TCS invocation order is undefined so take a maximum of all values we received */
								  "    if (tcs_result[0] == 1.0 &&\n"
								  "        tcs_result[1] == 2.0 &&\n"
								  "        tcs_result[2] == 2.0 &&\n"
								  "        tcs_result[3] == 2.0)\n"
								  "    {\n"
								  "        tes_result = 1.0;\n"
								  "    }\n"
								  "    else\n"
								  "    {\n"
								  "        tes_result = 0.0;\n"
								  "    }\n"
								  "}\n";

	return tes_code;
}

/** Retrieves vertex shader body.
 *
 *  @return Vertex shader body.
 **/
const char* TessellationShaderBarrier2::getVSCode()
{
	static const char* vs_code = "${VERSION}\n"
								 "\n"
								 "void main()\n"
								 "{\n"
								 "}\n";

	return vs_code;
}

/** Retrieves amount of bytes that should be used for allocating storage space for
 *  a buffer object that will later be used to hold XFB result data.
 *
 *  @return Amount of bytes required by the test.
 */
int TessellationShaderBarrier2::getXFBBufferSize()
{
	return static_cast<int>(m_n_result_vertices * sizeof(float) * 2 /* points per isoline */);
}

/** Retrieves names of transform feedback varyings and amount of those. These should be used
 *  prior to link the test program object.
 *
 *  @param out_n_names Deref will be used to store the number of names that @param out_names array
 *                     holds. Must not be NULL.
 *  @param out_names   Deref will be used to store a pointer to an array holding TF varying names;
 *                     Must not be NULL.
 **/
void TessellationShaderBarrier2::getXFBProperties(int* out_n_names, const char*** out_names)
{
	static const char* names[1] = { "tes_result" };

	*out_n_names = 1;
	*out_names   = names;
}

/** Verifies data captured by XFB is correct.
 *
 *  @param data Buffer holding the result XFB data. Must not be NULL.
 *
 *  @return true if the result data is confirmed to be valid, false otherwise.
 **/
bool TessellationShaderBarrier2::verifyXFBBuffer(const void* data)
{
	float*		data_float = (float*)data;
	const float epsilon	= (float)1e-5;

	/* Run through all vertices */
	for (unsigned int n_vertex = 0; n_vertex < m_n_result_vertices; ++n_vertex)
	{
		if (de::abs(data_float[n_vertex] - 1.0f /* valid result value */) > epsilon)
		{
			TCU_FAIL("Invalid data retrieved");
		}
	}

	return true;
}

/** Constructor
 *
 * @param context Test context
 **/
TessellationShaderBarrier3::TessellationShaderBarrier3(Context& context, const ExtParameters& extParams)
	: TessellationShaderBarrierTestCase(context, extParams, "barrier_guarded_read_write_calls",
										"Verifies it is safe to write to the same per-patch output "
										"from multiple TC invocations, as long as each write happens "
										"in a separate phase.")
	, m_n_instances(10)				/* as per test spec */
	, m_n_invocations(16)			/* as per test spec */
	, m_n_patch_vertices(8)			/* as per test spec */
	, m_n_patches_per_invocation(2) /* as per test spec */
	, m_n_result_vertices(2 /* result points per isoline */ * m_n_patches_per_invocation * m_n_invocations *
						  m_n_instances)
{
	m_n_input_vertices = (m_n_result_vertices / 2 /* result points per isoline */) * 4 /* vertices per patch */;
}

/** Retrieves arguments to be used for the rendering process.
 *
 *  @param out_mode             Deref will be used to store draw call mode. Must not be NULL.
 *  @param out_count            Deref will be used to store count argument to be used for the draw call.
 *                              Must not be NULL.
 *  @param out_tf_mode          Deref will be used to store transform feed-back mode to be used for
 *                              glBeginTransformFeedback() call, prior to issuing the draw call. Must
 *                              not be NULL.
 *  @param out_n_patch_vertices Deref will be used to store GL_PATCH_VERTICES_EXT pname value, to be set with
 *                              glPatchParameteriEXT() call prior to issuing the draw call. Must not be NULL.
 *  @param out_n_instances      Deref will be used to store amount of instances to use for the draw call.
 *                              Using a value of 1 will result in a glDrawArrays() call. Using values larger
 *                              than 1 will trigger glDrawArraysInstanced() call. Values smaller than 1 are
 *                              forbidden.
 **/
void TessellationShaderBarrier3::getDrawCallArgs(glw::GLenum* out_mode, glw::GLint* out_count, glw::GLenum* out_tf_mode,
												 glw::GLint* out_n_patch_vertices, glw::GLint* out_n_instances)
{
	*out_count			  = m_n_patches_per_invocation * m_n_patch_vertices * m_n_instances;
	*out_mode			  = GL_PATCHES_EXT;
	*out_n_instances	  = m_n_instances;
	*out_n_patch_vertices = m_n_patch_vertices;
	*out_tf_mode		  = GL_POINTS;
}

/** Retrieves tessellation control shader body.
 *
 *  @return TC stage shader body.
 **/
const char* TessellationShaderBarrier3::getTCSCode()
{
	static const char* tcs_code =
		"${VERSION}\n"
		"\n"
		"${TESSELLATION_SHADER_REQUIRE}\n"
		"\n"
		"layout (vertices = 16) out;\n"
		"\n"
		"      out int tcs_data        [];\n"
		"patch out int tcs_patch_result[16];\n"
		"\n"
		"void main()\n"
		"{\n"
		/* Even invocations should write their gl_InvocationID value to their per-vertex output. */
		"    if ((gl_InvocationID % 2) == 0)\n"
		"    {\n"
		"        tcs_data[gl_InvocationID] = gl_InvocationID;\n"
		"    }\n"
		"\n"
		"    barrier();\n"
		"\n"
		/* Odd invocations should read values stored by preceding even invocation,
		 * add current invocation's ID to that value, and then write it to its per-vertex
		 * output.
		 */
		"    if ((gl_InvocationID % 2) == 1)\n"
		"    {\n"
		"        tcs_data[gl_InvocationID] = tcs_data[gl_InvocationID - 1] + gl_InvocationID;\n"
		"    }\n"
		"\n"
		"    barrier();\n"
		"\n"
		/* Every fourth invocation should now read & sum up per-vertex outputs for four invocations
		 * following it (including the one discussed), and store it in a per-patch variable */
		"    tcs_patch_result[gl_InvocationID] = 0;\n"
		"\n"
		"    if ((gl_InvocationID % 4) == 0)\n"
		"    {\n"
		"        tcs_patch_result[gl_InvocationID] += tcs_data[gl_InvocationID];\n"
		"        tcs_patch_result[gl_InvocationID] += tcs_data[gl_InvocationID+1];\n"
		"        tcs_patch_result[gl_InvocationID] += tcs_data[gl_InvocationID+2];\n"
		"        tcs_patch_result[gl_InvocationID] += tcs_data[gl_InvocationID+3];\n"
		"    }\n"
		"\n"
		"    gl_TessLevelOuter[0] = 1.0;\n"
		"    gl_TessLevelOuter[1] = 1.0;\n"
		"}\n";

	return tcs_code;
}

/** Retrieves tessellation evaluation shader body.
 *
 *  @return TC stage shader body.
 **/
const char* TessellationShaderBarrier3::getTESCode()
{
	static const char* tes_code = "${VERSION}\n"
								  "\n"
								  "${TESSELLATION_SHADER_REQUIRE}\n"
								  "\n"
								  "layout(isolines, point_mode) in;\n"
								  "\n"
								  "patch in int tcs_patch_result[16];\n"
								  "\n"
								  "flat out ivec4 tes_result1;\n"
								  "flat out ivec4 tes_result2;\n"
								  "flat out ivec4 tes_result3;\n"
								  "flat out ivec4 tes_result4;\n"
								  "\n"
								  "void main()\n"
								  "{\n"
								  "    tes_result1 = ivec4(tcs_patch_result[0],  tcs_patch_result[1],  "
								  "tcs_patch_result[2],  tcs_patch_result[3]);\n"
								  "    tes_result2 = ivec4(tcs_patch_result[4],  tcs_patch_result[5],  "
								  "tcs_patch_result[6],  tcs_patch_result[7]);\n"
								  "    tes_result3 = ivec4(tcs_patch_result[8],  tcs_patch_result[9],  "
								  "tcs_patch_result[10], tcs_patch_result[11]);\n"
								  "    tes_result4 = ivec4(tcs_patch_result[12], tcs_patch_result[13], "
								  "tcs_patch_result[14], tcs_patch_result[15]);\n"
								  "}\n";

	return tes_code;
}

/** Retrieves vertex shader body.
 *
 *  @return Vertex shader body.
 **/
const char* TessellationShaderBarrier3::getVSCode()
{
	static const char* vs_code = "${VERSION}\n"
								 "\n"
								 "void main()\n"
								 "{\n"
								 "}\n";

	return vs_code;
}

/** Retrieves amount of bytes that should be used for allocating storage space for
 *  a buffer object that will later be used to hold XFB result data.
 *
 *  @return Amount of bytes required by the test.
 */
int TessellationShaderBarrier3::getXFBBufferSize()
{
	return static_cast<int>(m_n_instances * m_n_result_vertices * sizeof(int) * 4 /* ivec4 */ *
							2 /* points per isoline */);
}

/** Retrieves names of transform feedback varyings and amount of those. These should be used
 *  prior to link the test program object.
 *
 *  @param out_n_names Deref will be used to store the number of names that @param out_names array
 *                     holds. Must not be NULL.
 *  @param out_names   Deref will be used to store a pointer to an array holding TF varying names;
 *                     Must not be NULL.
 **/
void TessellationShaderBarrier3::getXFBProperties(int* out_n_names, const char*** out_names)
{
	static const char* names[] = { "tes_result1", "tes_result2", "tes_result3", "tes_result4" };

	*out_n_names = 4;
	*out_names   = names;
}

/** Verifies data captured by XFB is correct.
 *
 *  @param data Buffer holding the result XFB data. Must not be NULL.
 *
 *  @return true if the result data is confirmed to be valid, false otherwise.
 **/
bool TessellationShaderBarrier3::verifyXFBBuffer(const void* data)
{
	const int*		 data_int = (const int*)data;
	std::vector<int> tcs_data(m_n_invocations, 0);
	std::vector<int> tcs_patch_result(m_n_invocations, 0);

	/* This is a simple C++ port of the TCS used for the test.
	 *
	 * Note: We only need to consider a single set of values stored by TES
	 *       for a single result point, as the same set of values will be
	 *       reported for the other point. Owing to the fact gl_InvocationID
	 *       in TCS will iterate from 0 to 15 for all input patches and instances,
	 *       we can re-use the data for all subsequent input patches. */
	/* Phase 1 */
	for (unsigned int n = 0; n < m_n_invocations; n += 2)
	{
		tcs_data[n] = n;
	}

	/* Phase 2 */
	for (unsigned int n = 1; n < m_n_invocations; n += 2)
	{
		tcs_data[n] = tcs_data[n - 1] + n;
	}

	/* Phase 3 */
	for (unsigned int n_patch_vertex = 0; n_patch_vertex < m_n_invocations; ++n_patch_vertex)
	{
		const unsigned int invocation_id = n_patch_vertex;

		tcs_patch_result[invocation_id] = 0;

		if ((invocation_id % 4) == 0)
		{
			tcs_patch_result[invocation_id] += tcs_data[invocation_id];
			tcs_patch_result[invocation_id] += tcs_data[invocation_id + 1];
			tcs_patch_result[invocation_id] += tcs_data[invocation_id + 2];
			tcs_patch_result[invocation_id] += tcs_data[invocation_id + 3];
		}
	} /* for (all patch vertices) */

	/* Time to do the actual comparison. */
	for (unsigned int n_patch = 0; n_patch < m_n_result_vertices / m_n_invocations; ++n_patch)
	{
		bool	   are_equal				 = true;
		const int  n_points_per_line_segment = 2;
		const int* patch_data_int			 = data_int + n_patch * m_n_invocations * n_points_per_line_segment;

		for (unsigned int n_invocation = 0; n_invocation < m_n_invocations; ++n_invocation)
		{
			if (patch_data_int[n_invocation] != tcs_patch_result[n_invocation])
			{
				are_equal = false;

				break;
			}
		} /* for (all patch vertices which have contributed for given input patch being considered) */

		if (!are_equal)
		{
			std::stringstream logMessage;

			logMessage << "Result data for patch [" << n_patch << "]: (";

			for (unsigned int n_patch_vertex = 0; n_patch_vertex < m_n_patch_vertices; ++n_patch_vertex)
			{
				logMessage << patch_data_int[n_patch_vertex];

				if (n_patch_vertex == (m_n_patch_vertices - 1))
				{
					logMessage << "), ";
				}
				else
				{
					logMessage << ", ";
				}
			} /* for (all patch vertices) */

			logMessage << "expected: ";

			for (unsigned int n_patch_vertex = 0; n_patch_vertex < m_n_patch_vertices; ++n_patch_vertex)
			{
				logMessage << tcs_patch_result[n_patch_vertex];

				if (n_patch_vertex == (m_n_patch_vertices - 1))
				{
					logMessage << "). ";
				}
				else
				{
					logMessage << ", ";
				}
			} /* for (all patch vertices) */

			/* Log the message */
			m_testCtx.getLog() << tcu::TestLog::Message << logMessage.str().c_str() << tcu::TestLog::EndMessage;

			/* Bail out */
			TCU_FAIL("Invalid data captured");
		} /* if (!are_equal) */
	}	 /* for (all patches) */

	return true;
}

} /* namespace glcts */


text:
<?xml version="1.0" encoding="utf-8"?>
<merge xmlns:android="http://schemas.android.com/apk/res/android" >

    <LinearLayout
        android:id="@+id/layout_listview_header_parent"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:gravity="bottom"
        android:orientation="vertical" >

        <RelativeLayout
            android:id="@+id/layout_listview_header_content"
            android:layout_width="match_parent"
            android:layout_height="60dp" >

            <TextView
                android:id="@+id/layout_listview_header_hint_textview"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_centerInParent="true"
                android:text="@string/pull_header_hint_normal" />

            <ImageView
                android:id="@+id/layout_listview_header_arrow"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_alignLeft="@id/layout_listview_header_hint_textview"
                android:layout_centerVertical="true"
                android:layout_marginLeft="-35dp"
                android:src="@drawable/xlistview_arrow" />

            <ProgressBar
                android:id="@+id/layout_listview_header_progressbar"
                android:layout_width="30dp"
                android:layout_height="30dp"
                android:layout_alignLeft="@id/layout_listview_header_hint_textview"
                android:layout_centerVertical="true"
                android:layout_marginLeft="-40dp"
                android:visibility="invisible" />
        </RelativeLayout>
    </LinearLayout>

</merge>


text:
function [bincenters,M,N,L]=amp_v_phase_save(nobins,A,P,outfilename,A_bands,P_bands,dirname)

% Finding amplitude vs. phase curves for each pair of modes. nobins is the
% number of bins, A is a matrix whose columns are the amplitudes of the modes,
% P is a matrix whose columns are the phases of the modes, figchoice is
% either 1 (to make a figure) or 0 (to omit the figure). A_bands is a matrix of
% mins, centers and maxes for the frequency bands of the amplitude-modulated
% components. P_bands gives the same for the phase-modulating components.

[nopoints,nomodes_hi]=size(A);
[nopoints,nomodes_lo]=size(P);

bincenters=1:nobins;
bincenters=(bincenters-1)*2*pi/nobins-pi*(nobins-1)/nobins;

Pmod=mod(P,2*pi)-pi;

for j=1:nomodes_lo     % Counter for modes providing phase.
    amp_index=0;    % Index for recording all amplitudes in each phase bin.
    for i=1:nobins  % Counter for phase bins.
        indices=[];
        indices=find(bincenters(i)-pi/nobins<=Pmod(:,j) & Pmod(:,j)<bincenters(i)+pi/nobins);   % Bin phases.
        L(amp_index+1:amp_index+length(indices),j)=bincenters(i)/pi; % Vector recording the number of time points falling around phase i of mode j.
        for k=1:nomodes_hi     % Counter for modes providing amplitude.
            if length(indices)~=0
                M(i,k,j)=sum(A(indices,k))/length(indices); % Average amplitude of mode k around phase i of mode j.
                N(amp_index+1:amp_index+length(indices),k,j)=A(indices,k);  % Amplitudes of mode k around phase i of mode j.
            else
                M(i,k,j)=0;
            end
        end
        amp_index=amp_index+length(indices);    % Index at which vector of amplitudes ends.
    end
end

% Saving amplitude vs. phase curves, binned data.

A_band_range_label=['a_',num2str(nomodes_hi),'_from_',num2str(min(A_bands(:,1))),'_to_',num2str(max(A_bands(:,3)))];
P_band_range_label=['p_',num2str(nomodes_lo),'_from_',num2str(min(P_bands(:,1))),'_to_',num2str(max(P_bands(:,3)))];
band_range_label=[A_band_range_label,'_',P_band_range_label];

if nargin>6 & ~isempty(dirname)
    dirname=[dirname,'\',outfilename,'_avp_data'];
else
    dirname=[outfilename,'_avp_data'];
end
% if nargin>6 & ~isempty(dirname)
%     dirname=[dirname,'\',outfilename,'_',band_range_label];
% else
%     dirname=[outfilename,'_',band_range_label];
% end
mkdir (dirname);

token=[];
for i=1:nomodes_hi
    token=[token,'%f\t'];
end
token=[token,'%f\n'];

fid=fopen([dirname,'\',outfilename,'_avp.list'],'w');
fid1=fopen([dirname,'\',outfilename,'_binned_data.list'],'w');
% fid=fopen([dirname,'\',outfilename,'_',band_range_label,'_avp.list'],'w');
% fid1=fopen([dirname,'\',outfilename,'_',band_range_label,'_binned_data.list'],'w');
fid2=fopen([dirname,'\',outfilename,'_P_bands.txt'],'w');
fid3=fopen([dirname,'\',outfilename,'_A_bands.txt'],'w');
% fid2=fopen([dirname,'\',outfilename,'_',P_band_range_label,'_bands.txt'],'w');
% fid3=fopen([dirname,'\',outfilename,'_',A_band_range_label,'_bands.txt'],'w');
fprintf(fid2,'%f\t%f\t%f\n',P_bands');
fprintf(fid3,'%f\t%f\t%f\n',A_bands');

for j=1:nomodes_lo
    phase_label=['p_',num2str(P_bands(j,1)),'_to_',num2str(P_bands(j,3))];
    avpphasefilename=[dirname,'\',outfilename,'_avp_',phase_label,'.txt'];
    binneddataphasefilename=[dirname,'\',outfilename,'_binned_',phase_label,'.txt'];
    fprintf(fid,'%s\n',avpphasefilename);
    fprintf(fid1,'%s\n',binneddataphasefilename);
    fid4=fopen(avpphasefilename,'w');
    fid5=fopen(binneddataphasefilename,'w');
    fprintf(fid4,token,[P_bands(j,2) bincenters; A_bands(:,2) M(:,:,j)']);
    fprintf(fid5,token,[L(:,j) N(:,:,j)]');
end

fclose('all')