text:
"""Module which contains CumulatedCallsStage"""
from grortir.main.model.stages.calls_stage import CallsStage

class CumulatedCallsStage(CallsStage):
    """In this class last coordinate of input vector is value which will
    be added  to quality. Other mechanism is the same as in parent class.
    Simply in process we will put as last coordinate in output current quality
    and add this value to quality in children steps."""

    def __init__(self, name, max_calls, input_vector=(),
                 maximum_acceptable_quality=0.01):
        super().__init__(name, max_calls, input_vector,
                         maximum_acceptable_quality)
        self.control_params = [0] * (len(self.input_vector) - 1)
        dimensions = len(self.control_params)
        self.lower_bounds = [-1] * dimensions
        self.upper_bounds = [1] * dimensions

    @staticmethod
    def calculate_quality(input_vector, control_params):
        """Override Calls Stage method - here last coordinate of input is
        simply added to value calculated by remaining coordinates."""
        assert len(input_vector) - 1 == len(control_params)
        return CallsStage.calculate_quality(input_vector[: -1], control_params)

    def get_output_of_stage(self, input_vector, control_params):
        """We return here control params (as in CallsStage) and additionally
        in the last coordinate we put current quality."""
        current_quality = self.calculate_quality(input_vector, control_params)
        function_output = CallsStage.get_output_of_stage(self,
                                                         input_vector[:-1],
                                                         control_params)
        return function_output + [current_quality]


text:
function process_character_data(data, table) {
    var processed_data = [];

    if(data.length != null) {
        var data_length = data.length;

        if(data_length > 0) {
            var character_name = table.getCharacterFieldValue();

            for(var index = 0; index < data_length; index++) {
                var row_data = data[index];

                var character_rankings = row_data[character_name];

                var rank_row = [
                    null,
                    character_rankings.rank,
                    Formatting.getSocialMedia(row_data.player.steamid, row_data.player.linked),
                    Formatting.getNecrolabUserLink(row_data.player.steamid, row_data.player.personaname),
                    'Ranks',
                    character_rankings.score.rank,
                    character_rankings.speed.rank,
                ];

                var points_row = [
                    ' ',
                    null,
                    null,
                    null,
                    'Points',
                    Formatting.roundNumber(character_rankings.score.rank_points),
                    Formatting.roundNumber(character_rankings.speed.rank_points)
                ];

                var score_row = [
                    ' ',
                    null,
                    null,
                    null,
                    'Score/Time/Wins',
                    character_rankings.score.score,
                    Formatting.convertSecondsToTime(character_rankings.speed.time)
                ];

                switch(character_name) {
                    case 'story':
                    case 'all':
                    case 'all_dlc':
                        rank_row.push(null);
                        points_row.push(null);
                        score_row.push(null);
                        break;
                    default:
                        rank_row.push(character_rankings.deathless.rank);
                        points_row.push(Formatting.roundNumber(character_rankings.deathless.rank_points));
                        score_row.push(character_rankings.deathless.win_count);
                        break;
                }

                processed_data.push(rank_row);
                processed_data.push(points_row);
                processed_data.push(score_row);
            }
        }
    }

    return processed_data;
};

$(document).ready(function() {
    var table = new NecroTable($('#entries_table'));

    table.enableFixedHeader();
    table.enableButtons();
    table.enablePaging();
    table.enableHistory();
    table.enableSearchField();
    table.enableCharacterField();
    table.enableReleaseField();
    table.enableModeField();
    table.enableDateField();
    table.enableSeededField();
    table.enableSiteField();
    table.enableCollapsibleRows(2);

    table.setAjaxUrl(Formatting.getNecrolabApiUrl('/rankings/power/character/entries'));

    table.addColumns([
        {
            name: 'rank',
            title: 'Rank',
            type: 'num-fmt'
        },
        {
            name: 'social_media',
            title: ' ',
            type: 'string',
            orderable: false
        },
        {
            name: 'personaname',
            title: 'Player',
            type: 'string'
        },
        {
            name: 'type',
            title: ' ',
            type: 'string',
            orderable: false
        },
        {
            name: 'score_rank',
            title: 'Score',
            type: 'num-fmt'
        },
        {
            name: 'speed_rank',
            title: 'Speed',
            type: 'num-fmt'
        },
        {
            name: 'deathless_rank',
            title: 'Deathless',
            type: 'num-fmt'
        }
    ]);

    table.setDataProcessCallback(window, 'process_character_data');

    table.render();
});

redpajama_set_name: RedPajamaGithub


text:
import { Component, OnInit } from '@angular/core';

@Component({
    selector: 'pouchdb-demo',
    templateUrl: 'pouchdb-demo.component.html',
    styleUrls: ['pouchdb-demo.component.scss']
})

export class PouchDbDemoComponent implements OnInit {
    constructor() {
    }

    ngOnInit() {
    }
}


text:
import webapp2

class MainPage(webapp2.RequestHandler):
	def get(self):
		self.response.headers['Content-Type'] = 'text/plain'
		self.response.write('This is my main page.')

application = webapp2.WSGIApplication([
	('/', MainPage),
], debug=True)


text:
/* */
"use strict";
var Observable_1 = require('../../Observable');
var distinctUntilKeyChanged_1 = require('../../operator/distinctUntilKeyChanged');
Observable_1.Observable.prototype.distinctUntilKeyChanged = distinctUntilKeyChanged_1.distinctUntilKeyChanged;


text:
from Models.FeatureProcessing import *
from keras.models import Sequential
from keras.layers import Activation, Dense, LSTM
from keras.optimizers import Adam, SGD
import numpy as np
import abc
from ClassificationModule import ClassificationModule

class descriptionfoldersreponamelstm(ClassificationModule):
    """A basic lstm neural network"""

    def __init__(self, num_hidden_layers=3):
        ClassificationModule.__init__(self, "Description, foldernames and reponame LSTM", "A LSTM reading the description, foldernames and reponame character by character")

        hidden_size = 300
        self.maxlen = 300

        # Set output_size
        self.output_size = 7 # Hardcoded for 7 classes

        model = Sequential()

        # Maximum of self.maxlen charcters allowed, each in one-hot-encoded array
        model.add(LSTM(hidden_size, input_shape=(self.maxlen, getLstmCharLength())))

        for _ in range(num_hidden_layers):
            model.add(Dense(hidden_size))

        model.add(Dense(self.output_size))
        model.add(Activation('softmax'))

        model.compile(loss='categorical_crossentropy',
                    optimizer=SGD(),
                    metrics=['accuracy'])

        self.model = model
        print "\t-", self.name

    def resetAllTraining(self):
        """Reset classification module to status before training"""
        resetWeights(self.model)

    def trainOnSample(self, sample, nb_epoch=1, shuffle=True, verbose=True):
        """Trainiere (inkrementell) mit Sample. Evtl zusätzlich mit best. Menge alter Daten, damit overfitten auf neue Daten verhindert wird."""
        readme_vec = self.formatInputData(sample)
        label_index = getLabelIndex(sample)
        label_one_hot = np.expand_dims(oneHot(label_index), axis=0) # [1, 0, 0, ..] -> [[1, 0, 0, ..]] Necessary for keras
        self.model.fit(readme_vec, label_one_hot, nb_epoch=nb_epoch, shuffle=shuffle, verbose=verbose)

    def train(self, samples, nb_epoch=200, shuffle=True, verbose=True):
        """Trainiere mit Liste von Daten. Evtl weitere Paramter nötig (nb_epoch, learning_rate, ...)"""
        train_samples = []
        train_lables = []
        for sample in samples:
            formatted_sample = self.formatInputData(sample)[0].tolist()
            train_samples.append(formatted_sample)
            train_lables.append(oneHot(getLabelIndex(sample)))
        train_lables = np.asarray(train_lables)
        train_result = self.model.fit(train_samples, train_lables, nb_epoch=nb_epoch, shuffle=shuffle, verbose=verbose, class_weight=getClassWeights())
        self.isTrained = True
        return train_result

    def predictLabel(self, sample):
        """Gibt zurück, wie der Klassifikator ein gegebenes Sample klassifizieren würde"""
        if not self.isTrained:
            return 0
        sample = self.formatInputData(sample)
        return np.argmax(self.model.predict(sample))

    def predictLabelAndProbability(self, sample):
        """Return the probability the module assignes each label"""
        if not self.isTrained:
            return [0, 0, 0, 0, 0, 0, 0, 0]
        sample = self.formatInputData(sample)
        prediction = self.model.predict(sample)[0]
        return [np.argmax(prediction)] + list(prediction) # [0] So 1-D array is returned

    def formatInputData(self, sample):
        """Extract description and transform to vector"""
        sd = getDescription(sample)
        sd += getFoldernames(sample)
        sd += getName(sample)
        # Returns numpy array which contains 1 array with features
        return np.expand_dims(lstmEncode(sd, maxlen=self.maxlen), axis=0)


text:
package com.amazonaws.services.cloudsearch.model;

import java.io.Serializable;

/**
 *

 * A response message that contains the index fields for a search domain.
 *

 * @deprecated Use {@link com.amazonaws.services.cloudsearchv2.model.DescribeIndexFieldsResult} instead.
 */
@Deprecated
public class DescribeIndexFieldsResult implements Serializable {

    /**
     * The index fields configured for the domain.
     */
    private com.amazonaws.internal.ListWithAutoConstructFlag<IndexFieldStatus> indexFields;

    /**
     * The index fields configured for the domain.
     *
     * @return The index fields configured for the domain.
     */
    public java.util.List<IndexFieldStatus> getIndexFields() {
        if (indexFields == null) {
              indexFields = new com.amazonaws.internal.ListWithAutoConstructFlag<IndexFieldStatus>();
              indexFields.setAutoConstruct(true);
        }
        return indexFields;
    }

    /**
     * The index fields configured for the domain.
     *
     * @param indexFields The index fields configured for the domain.
     */
    public void setIndexFields(java.util.Collection<IndexFieldStatus> indexFields) {
        if (indexFields == null) {
            this.indexFields = null;
            return;
        }
        com.amazonaws.internal.ListWithAutoConstructFlag<IndexFieldStatus> indexFieldsCopy = new com.amazonaws.internal.ListWithAutoConstructFlag<IndexFieldStatus>(indexFields.size());
        indexFieldsCopy.addAll(indexFields);
        this.indexFields = indexFieldsCopy;
    }

    /**
     * The index fields configured for the domain.
     *

     * Returns a reference to this object so that method calls can be chained together.
     *
     * @param indexFields The index fields configured for the domain.
     *
     * @return A reference to this updated object so that method calls can be chained
     *         together.
     */
    public DescribeIndexFieldsResult withIndexFields(IndexFieldStatus... indexFields) {
        if (getIndexFields() == null) setIndexFields(new java.util.ArrayList<IndexFieldStatus>(indexFields.length));
        for (IndexFieldStatus value : indexFields) {
            getIndexFields().add(value);
        }
        return this;
    }

    /**
     * The index fields configured for the domain.
     *

     * Returns a reference to this object so that method calls can be chained together.
     *
     * @param indexFields The index fields configured for the domain.
     *
     * @return A reference to this updated object so that method calls can be chained
     *         together.
     */
    public DescribeIndexFieldsResult withIndexFields(java.util.Collection<IndexFieldStatus> indexFields) {
        if (indexFields == null) {
            this.indexFields = null;
        } else {
            com.amazonaws.internal.ListWithAutoConstructFlag<IndexFieldStatus> indexFieldsCopy = new com.amazonaws.internal.ListWithAutoConstructFlag<IndexFieldStatus>(indexFields.size());
            indexFieldsCopy.addAll(indexFields);
            this.indexFields = indexFieldsCopy;
        }

        return this;
    }

    /**
     * Returns a string representation of this object; useful for testing and
     * debugging.
     *
     * @return A string representation of this object.
     *
     * @see java.lang.Object#toString()
     */
    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append("{");
        if (getIndexFields() != null) sb.append("IndexFields: " + getIndexFields() );
        sb.append("}");
        return sb.toString();
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int hashCode = 1;

        hashCode = prime * hashCode + ((getIndexFields() == null) ? 0 : getIndexFields().hashCode());
        return hashCode;
    }

    @Override
    public boolean equals(Object obj) {
        if (this == obj) return true;
        if (obj == null) return false;

        if (obj instanceof DescribeIndexFieldsResult == false) return false;
        DescribeIndexFieldsResult other = (DescribeIndexFieldsResult)obj;

        if (other.getIndexFields() == null ^ this.getIndexFields() == null) return false;
        if (other.getIndexFields() != null && other.getIndexFields().equals(this.getIndexFields()) == false) return false;
        return true;
    }

}


text:
class Solution:
    # @param s, a string
    # @return a string
    def reverseWords(self, s):
        return ' '.join(map(lambda w: w[::-1], filter(lambda w: w != '', s[::-1].split(' '))))


text:
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/**
 *	Contains source code from the article "Radix Sort Revisited".
 *	\file		IceRevisitedRadix.cpp
 *	\author		Pierre Terdiman
 *	\date		April, 4, 2000
 */
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/**
 *	Revisited Radix Sort.
 *	This is my new radix routine:
 *  - it uses indices and doesn't recopy the values anymore, hence wasting less ram
 *  - it creates all the histograms in one run instead of four
 *  - it sorts words faster than dwords and bytes faster than words
 *  - it correctly sorts negative floating-point values by patching the offsets
 *  - it automatically takes advantage of temporal coherence
 *  - multiple keys support is a side effect of temporal coherence
 *  - it may be worth recoding in asm... (mainly to use FCOMI, FCMOV, etc) [it's probably memory-bound anyway]
 *
 *	History:
 *	- 08.15.98: very first version
 *	- 04.04.00: recoded for the radix article
 *	- 12.xx.00: code lifting
 *	- 09.18.01: faster CHECK_PASS_VALIDITY thanks to Mark D. Shattuck (who provided other tips, not included here)
 *	- 10.11.01: added local ram support
 *	- 01.20.02: bugfix! In very particular cases the last pass was skipped in the float code-path, leading to incorrect sorting......
 *	- 01.02.02:	- "mIndices" renamed => "mRanks". That's a rank sorter after all.
 *				- ranks are not "reset" anymore, but implicit on first calls
 *	- 07.05.02:	- offsets rewritten with one less indirection.
 *	- 11.03.02:	- "bool" replaced with RadixHint enum
 *
 *	\class		RadixSort
 *	\author		Pierre Terdiman
 *	\version	1.4
 *	\date		August, 15, 1998
 */
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

/*
To do:
	- add an offset parameter between two input values (avoid some data recopy sometimes)
	- unroll ? asm ?
	- 11 bits trick & 3 passes as Michael did
	- prefetch stuff the day I have a P3
	- make a version with 16-bits indices ?
*/

///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Precompiled Header
#include "Stdafx.h"

using namespace IceCore;

#define INVALIDATE_RANKS	mCurrentSize|=0x80000000
#define VALIDATE_RANKS		mCurrentSize&=0x7fffffff
#define CURRENT_SIZE		(mCurrentSize&0x7fffffff)
#define INVALID_RANKS		(mCurrentSize&0x80000000)

#define CHECK_RESIZE(n)																		\
	if(n!=mPreviousSize)																	\
	{																						\
				if(n>mCurrentSize)	Resize(n);												\
		else						ResetRanks();											\
		mPreviousSize = n;																	\
	}

#define CREATE_HISTOGRAMS(type, buffer)														\
	/* Clear counters/histograms */															\
	ZeroMemory(mHistogram, 256*4*sizeof(udword));											\
																							\
	/* Prepare to count */																	\
	ubyte* p = (ubyte*)input;																\
	ubyte* pe = &p[nb*4];																	\
	udword* h0= &mHistogram[0];		/* Histogram for first pass (LSB)	*/					\
	udword* h1= &mHistogram[256];	/* Histogram for second pass		*/					\
	udword* h2= &mHistogram[512];	/* Histogram for third pass			*/					\
	udword* h3= &mHistogram[768];	/* Histogram for last pass (MSB)	*/					\
																							\
	bool AlreadySorted = true;	/* Optimism... */											\
																							\
	if(INVALID_RANKS)																		\
	{																						\
		/* Prepare for temporal coherence */												\
		type* Running = (type*)buffer;														\
		type PrevVal = *Running;															\
																							\
		while(p!=pe)																		\
		{																					\
			/* Read input buffer in previous sorted order */								\
			type Val = *Running++;															\
			/* Check whether already sorted or not */										\
			if(Val<PrevVal)	{ AlreadySorted = false; break; } /* Early out */				\
			/* Update for next iteration */													\
			PrevVal = Val;																	\
																							\
			/* Create histograms */															\
			h0[*p++]++;	h1[*p++]++;	h2[*p++]++;	h3[*p++]++;									\
		}																					\
																							\
		/* If all input values are already sorted, we just have to return and leave the */	\
		/* previous list unchanged. That way the routine may take advantage of temporal */	\
		/* coherence, for example when used to sort transparent faces.					*/	\
		if(AlreadySorted)																	\
		{																					\
			mNbHits++;																		\
			for(udword i=0;i<nb;i++)	mRanks[i] = i;										\
			return *this;																	\
		}																					\
	}																						\
	else																					\
	{																						\
		/* Prepare for temporal coherence */												\
		udword* Indices = mRanks;															\
		type PrevVal = (type)buffer[*Indices];												\
																							\
		while(p!=pe)																		\
		{																					\
			/* Read input buffer in previous sorted order */								\
			type Val = (type)buffer[*Indices++];											\
			/* Check whether already sorted or not */										\
			if(Val<PrevVal)	{ AlreadySorted = false; break; } /* Early out */				\
			/* Update for next iteration */													\
			PrevVal = Val;																	\
																							\
			/* Create histograms */															\
			h0[*p++]++;	h1[*p++]++;	h2[*p++]++;	h3[*p++]++;									\
		}																					\
																							\
		/* If all input values are already sorted, we just have to return and leave the */	\
		/* previous list unchanged. That way the routine may take advantage of temporal */	\
		/* coherence, for example when used to sort transparent faces.					*/	\
		if(AlreadySorted)	{ mNbHits++; return *this;	}									\
	}																						\
																							\
	/* Else there has been an early out and we must finish computing the histograms */		\
	while(p!=pe)																			\
	{																						\
		/* Create histograms without the previous overhead */								\
		h0[*p++]++;	h1[*p++]++;	h2[*p++]++;	h3[*p++]++;										\
	}

#define CHECK_PASS_VALIDITY(pass)															\
	/* Shortcut to current counters */														\
	udword* CurCount = &mHistogram[pass<<8];												\
																							\
	/* Reset flag. The sorting pass is supposed to be performed. (default) */				\
	bool PerformPass = true;																\
																							\
	/* Check pass validity */																\
																							\
	/* If all values have the same byte, sorting is useless. */								\
	/* It may happen when sorting bytes or words instead of dwords. */						\
	/* This routine actually sorts words faster than dwords, and bytes */					\
	/* faster than words. Standard running time (O(4*n))is reduced to O(2*n) */				\
	/* for words and O(n) for bytes. Running time for floats depends on actual values... */	\
																							\
	/* Get first byte */																	\
	ubyte UniqueVal = *(((ubyte*)input)+pass);												\
																							\
	/* Check that byte's counter */															\
	if(CurCount[UniqueVal]==nb)	PerformPass=false;

///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/**
 *	Constructor.
 */
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
RadixSort::RadixSort() : mCurrentSize(0), mRanks(null), mRanks2(null), mTotalCalls(0), mNbHits(0)
{
#ifndef RADIX_LOCAL_RAM
	// Allocate input-independent ram
	mHistogram	= new udword[256*4];
	mOffset		= new udword[256];
#endif
	// Initialize indices
	INVALIDATE_RANKS;
}

///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/**
 *	Destructor.
 */
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
RadixSort::~RadixSort()
{
	// Release everything
#ifndef RADIX_LOCAL_RAM
	DELETEARRAY(mOffset);
	DELETEARRAY(mHistogram);
#endif
	DELETEARRAY(mRanks2);
	DELETEARRAY(mRanks);
}

///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/**
 *	Resizes the inner lists.
 *	\param		nb	[in] new size (number of dwords)
 *	\return		true if success
 */
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
bool RadixSort::Resize(udword nb)
{
	// Free previously used ram
	DELETEARRAY(mRanks2);
	DELETEARRAY(mRanks);

	// Get some fresh one
	mRanks	= new udword[nb];	CHECKALLOC(mRanks);
	mRanks2	= new udword[nb];	CHECKALLOC(mRanks2);

	return true;
}

inline_ void RadixSort::CheckResize(udword nb)
{
	udword CurSize = CURRENT_SIZE;
	if(nb!=CurSize)
	{
		if(nb>CurSize)	Resize(nb);
		mCurrentSize = nb;
		INVALIDATE_RANKS;
	}
}

///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/**
 *	Main sort routine.
 *	This one is for integer values. After the call, mRanks contains a list of indices in sorted order, i.e. in the order you may process your data.
 *	\param		input	[in] a list of integer values to sort
 *	\param		nb		[in] number of values to sort, must be < 2^31
 *	\param		hint	[in] RADIX_SIGNED to handle negative values, RADIX_UNSIGNED if you know your input buffer only contains positive values
 *	\return		Self-Reference
 */
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
RadixSort& RadixSort::Sort(const udword* input, udword nb, RadixHint hint)
{
	// Checkings
	if(!input || !nb || nb&0x80000000)	return *this;

	// Stats
	mTotalCalls++;

	// Resize lists if needed
	CheckResize(nb);

#ifdef RADIX_LOCAL_RAM
	// Allocate histograms & offsets on the stack
	udword mHistogram[256*4];
//	udword mOffset[256];
	udword* mLink[256];
#endif

	// Create histograms (counters). Counters for all passes are created in one run.
	// Pros:	read input buffer once instead of four times
	// Cons:	mHistogram is 4Kb instead of 1Kb
	// We must take care of signed/unsigned values for temporal coherence.... I just
	// have 2 code paths even if just a single opcode changes. Self-modifying code, someone?
	if(hint==RADIX_UNSIGNED)	{ CREATE_HISTOGRAMS(udword, input);	}
	else						{ CREATE_HISTOGRAMS(sdword, input);	}

	// Compute #negative values involved if needed
	udword NbNegativeValues = 0;
	if(hint==RADIX_SIGNED)
	{
		// An efficient way to compute the number of negatives values we'll have to deal with is simply to sum the 128
		// last values of the last histogram. Last histogram because that's the one for the Most Significant Byte,
		// responsible for the sign. 128 last values because the 128 first ones are related to positive numbers.
		udword* h3= &mHistogram[768];
		for(udword i=128;i<256;i++)	NbNegativeValues += h3[i];	// 768 for last histogram, 128 for negative part
	}

	// Radix sort, j is the pass number (0=LSB, 3=MSB)
	for(udword j=0;j<4;j++)
	{
		CHECK_PASS_VALIDITY(j);

		// Sometimes the fourth (negative) pass is skipped because all numbers are negative and the MSB is 0xFF (for example). This is
		// not a problem, numbers are correctly sorted anyway.
		if(PerformPass)
		{
			// Should we care about negative values?
			if(j!=3 || hint==RADIX_UNSIGNED)
			{
				// Here we deal with positive values only

				// Create offsets
//				mOffset[0] = 0;
//				for(udword i=1;i<256;i++)		mOffset[i] = mOffset[i-1] + CurCount[i-1];
				mLink[0] = mRanks2;
				for(udword i=1;i<256;i++)		mLink[i] = mLink[i-1] + CurCount[i-1];
			}
			else
			{
				// This is a special case to correctly handle negative integers. They're sorted in the right order but at the wrong place.

				// Create biased offsets, in order for negative numbers to be sorted as well
//				mOffset[0] = NbNegativeValues;												// First positive number takes place after the negative ones
				mLink[0] = &mRanks2[NbNegativeValues];										// First positive number takes place after the negative ones
//				for(udword i=1;i<128;i++)		mOffset[i] = mOffset[i-1] + CurCount[i-1];	// 1 to 128 for positive numbers
				for(udword i=1;i<128;i++)		mLink[i] = mLink[i-1] + CurCount[i-1];		// 1 to 128 for positive numbers

				// Fixing the wrong place for negative values
//				mOffset[128] = 0;
				mLink[128] = mRanks2;
//				for(i=129;i<256;i++)			mOffset[i] = mOffset[i-1] + CurCount[i-1];
				for(udword i=129;i<256;i++)		mLink[i] = mLink[i-1] + CurCount[i-1];
			}

			// Perform Radix Sort
			ubyte* InputBytes	= (ubyte*)input;
			InputBytes += j;
			if(INVALID_RANKS)
			{
//				for(udword i=0;i<nb;i++)	mRanks2[mOffset[InputBytes[i<<2]]++] = i;
				for(udword i=0;i<nb;i++)	*mLink[InputBytes[i<<2]]++ = i;
				VALIDATE_RANKS;
			}
			else
			{
				udword* Indices		= mRanks;
				udword* IndicesEnd	= &mRanks[nb];
				while(Indices!=IndicesEnd)
				{
					udword id = *Indices++;
//					mRanks2[mOffset[InputBytes[id<<2]]++] = id;
					*mLink[InputBytes[id<<2]]++ = id;
				}
			}

			// Swap pointers for next pass. Valid indices - the most recent ones - are in mRanks after the swap.
			udword* Tmp	= mRanks;	mRanks = mRanks2; mRanks2 = Tmp;
		}
	}
	return *this;
}

///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/**
 *	Main sort routine.
 *	This one is for floating-point values. After the call, mRanks contains a list of indices in sorted order, i.e. in the order you may process your data.
 *	\param		input			[in] a list of floating-point values to sort
 *	\param		nb				[in] number of values to sort, must be < 2^31
 *	\return		Self-Reference
 *	\warning	only sorts IEEE floating-point values
 */
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
RadixSort& RadixSort::Sort(const float* input2, udword nb)
{
	// Checkings
	if(!input2 || !nb || nb&0x80000000)	return *this;

	// Stats
	mTotalCalls++;

	udword* input = (udword*)input2;

	// Resize lists if needed
	CheckResize(nb);

#ifdef RADIX_LOCAL_RAM
	// Allocate histograms & offsets on the stack
	udword mHistogram[256*4];
//	udword mOffset[256];
	udword* mLink[256];
#endif

	// Create histograms (counters). Counters for all passes are created in one run.
	// Pros:	read input buffer once instead of four times
	// Cons:	mHistogram is 4Kb instead of 1Kb
	// Floating-point values are always supposed to be signed values, so there's only one code path there.
	// Please note the floating point comparison needed for temporal coherence! Although the resulting asm code
	// is dreadful, this is surprisingly not such a performance hit - well, I suppose that's a big one on first
	// generation Pentiums....We can't make comparison on integer representations because, as Chris said, it just
	// wouldn't work with mixed positive/negative values....
	{ CREATE_HISTOGRAMS(float, input2); }

	// Compute #negative values involved if needed
	udword NbNegativeValues = 0;
	// An efficient way to compute the number of negatives values we'll have to deal with is simply to sum the 128
	// last values of the last histogram. Last histogram because that's the one for the Most Significant Byte,
	// responsible for the sign. 128 last values because the 128 first ones are related to positive numbers.
	udword* h3= &mHistogram[768];
	for(udword i=128;i<256;i++)	NbNegativeValues += h3[i];	// 768 for last histogram, 128 for negative part

	// Radix sort, j is the pass number (0=LSB, 3=MSB)
	for(udword j=0;j<4;j++)
	{
		// Should we care about negative values?
		if(j!=3)
		{
			// Here we deal with positive values only
			CHECK_PASS_VALIDITY(j);

			if(PerformPass)
			{
				// Create offsets
//				mOffset[0] = 0;
				mLink[0] = mRanks2;
//				for(udword i=1;i<256;i++)		mOffset[i] = mOffset[i-1] + CurCount[i-1];
				for(udword i=1;i<256;i++)		mLink[i] = mLink[i-1] + CurCount[i-1];

				// Perform Radix Sort
				ubyte* InputBytes = (ubyte*)input;
				InputBytes += j;
				if(INVALID_RANKS)
				{
//					for(i=0;i<nb;i++)	mRanks2[mOffset[InputBytes[i<<2]]++] = i;
					for(udword i=0;i<nb;i++)	*mLink[InputBytes[i<<2]]++ = i;
					VALIDATE_RANKS;
				}
				else
				{
					udword* Indices		= mRanks;
					udword* IndicesEnd	= &mRanks[nb];
					while(Indices!=IndicesEnd)
					{
						udword id = *Indices++;
//						mRanks2[mOffset[InputBytes[id<<2]]++] = id;
						*mLink[InputBytes[id<<2]]++ = id;
					}
				}

				// Swap pointers for next pass. Valid indices - the most recent ones - are in mRanks after the swap.
				udword* Tmp	= mRanks;	mRanks = mRanks2; mRanks2 = Tmp;
			}
		}
		else
		{
			// This is a special case to correctly handle negative values
			CHECK_PASS_VALIDITY(j);

			if(PerformPass)
			{
				// Create biased offsets, in order for negative numbers to be sorted as well
//				mOffset[0] = NbNegativeValues;												// First positive number takes place after the negative ones
				mLink[0] = &mRanks2[NbNegativeValues];										// First positive number takes place after the negative ones
//				for(udword i=1;i<128;i++)		mOffset[i] = mOffset[i-1] + CurCount[i-1];	// 1 to 128 for positive numbers
				for(udword i=1;i<128;i++)		mLink[i] = mLink[i-1] + CurCount[i-1];		// 1 to 128 for positive numbers

				// We must reverse the sorting order for negative numbers!
//				mOffset[255] = 0;
				mLink[255] = mRanks2;
//				for(i=0;i<127;i++)		mOffset[254-i] = mOffset[255-i] + CurCount[255-i];	// Fixing the wrong order for negative values
				for(udword i=0;i<127;i++)	mLink[254-i] = mLink[255-i] + CurCount[255-i];		// Fixing the wrong order for negative values
//				for(i=128;i<256;i++)	mOffset[i] += CurCount[i];							// Fixing the wrong place for negative values
				for(udword i=128;i<256;i++)	mLink[i] += CurCount[i];							// Fixing the wrong place for negative values

				// Perform Radix Sort
				if(INVALID_RANKS)
				{
					for(udword i=0;i<nb;i++)
					{
						udword Radix = input[i]>>24;							// Radix byte, same as above. AND is useless here (udword).
						// ### cmp to be killed. Not good. Later.
//						if(Radix<128)		mRanks2[mOffset[Radix]++] = i;		// Number is positive, same as above
//						else				mRanks2[--mOffset[Radix]] = i;		// Number is negative, flip the sorting order
						if(Radix<128)		*mLink[Radix]++ = i;		// Number is positive, same as above
						else				*(--mLink[Radix]) = i;		// Number is negative, flip the sorting order
					}
					VALIDATE_RANKS;
				}
				else
				{
					for(udword i=0;i<nb;i++)
					{
						udword Radix = input[mRanks[i]]>>24;							// Radix byte, same as above. AND is useless here (udword).
						// ### cmp to be killed. Not good. Later.
//						if(Radix<128)		mRanks2[mOffset[Radix]++] = mRanks[i];		// Number is positive, same as above
//						else				mRanks2[--mOffset[Radix]] = mRanks[i];		// Number is negative, flip the sorting order
						if(Radix<128)		*mLink[Radix]++ = mRanks[i];		// Number is positive, same as above
						else				*(--mLink[Radix]) = mRanks[i];		// Number is negative, flip the sorting order
					}
				}
				// Swap pointers for next pass. Valid indices - the most recent ones - are in mRanks after the swap.
				udword* Tmp	= mRanks;	mRanks = mRanks2; mRanks2 = Tmp;
			}
			else
			{
				// The pass is useless, yet we still have to reverse the order of current list if all values are negative.
				if(UniqueVal>=128)
				{
					if(INVALID_RANKS)
					{
						// ###Possible?
						for(udword i=0;i<nb;i++)	mRanks2[i] = nb-i-1;
						VALIDATE_RANKS;
					}
					else
					{
						for(udword i=0;i<nb;i++)	mRanks2[i] = mRanks[nb-i-1];
					}

					// Swap pointers for next pass. Valid indices - the most recent ones - are in mRanks after the swap.
					udword* Tmp	= mRanks;	mRanks = mRanks2; mRanks2 = Tmp;
				}
			}
		}
	}
	return *this;
}

///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/**
 *	Gets the ram used.
 *	\return		memory used in bytes
 */
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
udword RadixSort::GetUsedRam() const
{
	udword UsedRam = sizeof(RadixSort);
#ifndef RADIX_LOCAL_RAM
	UsedRam += 256*4*sizeof(udword);			// Histograms
	UsedRam += 256*sizeof(udword);				// Offsets
#endif
	UsedRam += 2*CURRENT_SIZE*sizeof(udword);	// 2 lists of indices
	return UsedRam;
}


text:
require "stringio"
require "clamp/messages"

module Clamp

  # Command help generation.
  #
  module Help

    def usage(usage)
      @declared_usage_descriptions ||= []
      @declared_usage_descriptions << usage
    end

    attr_reader :declared_usage_descriptions, :description

    def description=(description)
      @description = description.dup
      if @description =~ /^\A\n*( +)/
        indent = Regexp.last_match(1)
        @description.gsub!(/^#{indent}/, "")
      end
      @description.strip!
    end

    def banner(description)
      self.description = description
    end

    def derived_usage_description
      parts = ["[OPTIONS]"]
      parts += parameters.map(&:name)
      parts.join(" ")
    end

    def usage_descriptions
      declared_usage_descriptions || [derived_usage_description]
    end

    def help(invocation_path, builder = Builder.new)
      help = builder
      help.add_usage(invocation_path, usage_descriptions)
      help.add_description(description)
      help.add_list(Clamp.message(:parameters_heading), parameters) if has_parameters?
      help.add_list(Clamp.message(:subcommands_heading), recognised_subcommands) if has_subcommands?
      help.add_list(Clamp.message(:options_heading), recognised_options)
      help.string
    end

    # A builder for auto-generated help.
    #
    class Builder

      def initialize
        @lines = []
      end

      def string
        left_column_width = lines.grep(Array).map(&:first).map(&:size).max
        StringIO.new.tap do |out|
          lines.each do |line|
            case line
            when Array
              line[0] = line[0].ljust(left_column_width)
              line.unshift("")
              out.puts(line.join("    "))
            else
              out.puts(line)
            end
          end
        end.string
      end

      def line(text = "")
        @lines << text
      end

      def row(lhs, rhs)
        @lines << [lhs, rhs]
      end

      def add_usage(invocation_path, usage_descriptions)
        line "#{Clamp.message(:usage_heading)}:"
        usage_descriptions.each do |usage|
          line "    #{invocation_path} #{usage}".rstrip
        end
      end

      def add_description(description)
        return unless description

        line
        line description.gsub(/^/, "  ")
      end

      DETAIL_FORMAT = "    %-29s %s"

      def add_list(heading, items)
        line
        line "#{heading}:"
        items.reject { |i| i.respond_to?(:hidden?) && i.hidden? }.each do |item|
          label, description = item.help
          description.each_line do |line|
            row(label, line)
            label = ""
          end
        end
      end

      private

      attr_accessor :lines

    end

  end

end


text:
interface I {
    [s: symbol]: string;
}

//// [parserES5SymbolIndexer1.js]


text:
module QueueingRabbit

  module JobExtensions

    module NewRelic

      def self.included(klass)
        if klass.respond_to?(:perform)
          add_for_class_method(klass)
        else
          add_for_instance_method(klass)
        end
      end

      def self.add_for_class_method(klass)
        klass.class_eval do |k|
          class << k
            include ::NewRelic::Agent::Instrumentation::ControllerInstrumentation
            add_transaction_tracer :perform, :category => :task
          end
        end
      end

      def self.add_for_instance_method(klass)
        klass.class_eval do |k|
          include ::NewRelic::Agent::Instrumentation::ControllerInstrumentation
          add_transaction_tracer :perform, :category => :task
        end
      end

    end

  end

end


text:
<?php

namespace Application\Db;

use Cache\Db\CacheService;

class IndexService {

    private $serviceLocator;

    public function __construct($serviceLocator) {
        $this->serviceLocator = $serviceLocator;
    }

    public function read() {
        ob_start();
        require __DIR__ . '/../../../view/application/index/index_template.phtml';
        $string = ob_get_contents();
        ob_end_clean();
        return array('result' => true, 'content' => $string);
    }

}


text:
/*
 * AnyOption 1.3
 *
 * kishan at hackorama dot com  www.hackorama.com JULY 2001
 *
 * + Acts as a common facade class for reading
 *   commandline options as well as options from
 *   an optionfile with delimited type value pairs
 *
 * + Handles the POSIX style single character options ( -w )
 *   as well as the newer GNU long options ( --width )
 *
 * + The option file assumes the traditional format of
 *   first character based comment lines and type value
 *   pairs with a delimiter , and flags which are not pairs
 *
 *  	# this is a coment
 *  	# next line is an option value pair
 *  	width : 100
 *     	# next line is a flag
 *      noimages
 *
 * + Supports printing out Help and Usage
 *
 * + Why not just use getopt() ?
 *
 *   getopt() Its a POSIX standard not part of ANSI-C.
 *   So it may not be available on platforms like Windows.
 *
 * + Why it is so long ?
 *
 *   The actual code which does command line parsing
 *   and option file parsing are done in  few methods.
 *   Most of the extra code are for providing a flexible
 *   common public interface to both a resourcefile and
 *   and command line supporting POSIX style and
 *   GNU long option as well as mixing of both.
 *
 * + Please see "anyoption.h" for public method descriptions
 *
 */

/* Updated Auguest 2004
 * Fix from  Michael D Peters (mpeters at sandia.gov)
 * to remove static local variables, allowing multiple instantiations
 * of the reader (for using multiple configuration files).  There is
 * an error in the destructor when using multiple instances, so you
 * cannot delete your objects (it will crash), but not calling the
 * destructor only introduces a small memory leak, so I
 * have not bothered tracking it down.
 *
 * Also updated to use modern C++ style headers, rather than
 * depricated iostream.h (it was causing my compiler problems)
*/

/*
 * Updated September 2006
 * Fix from Boyan Asenov for a bug in mixing up option indexes
 * leading to exception when mixing different options types
 */

#include "anyoption.h"

AnyOption::AnyOption()
{
	init();
}

AnyOption::AnyOption(int maxopt)
{
	init( maxopt , maxopt );
}

AnyOption::AnyOption(int maxopt, int maxcharopt)
{
	init( maxopt , maxcharopt );
}

AnyOption::~AnyOption()
{
	if( mem_allocated )
		cleanup();
}

void
AnyOption::init()
{
	init( DEFAULT_MAXOPTS , DEFAULT_MAXOPTS );
}

void
AnyOption::init(int maxopt, int maxcharopt )
{

	max_options 	= maxopt;
	max_char_options = maxcharopt;
	max_usage_lines	= DEFAULT_MAXUSAGE;
	usage_lines	= 0 ;
	argc 		= 0;
	argv 		= NULL;
	posix_style	= true;
	verbose 	= false;
	filename 	= NULL;
	appname 	= NULL;
	option_counter 	= 0;
	optchar_counter	= 0;
	new_argv 	= NULL;
	new_argc 	= 0 ;
	max_legal_args 	= 0 ;
	command_set 	= false;
	file_set 	= false;
	values 		= NULL;
	g_value_counter = 0;
	mem_allocated 	= false;
	command_set 	= false;
	file_set	= false;
	opt_prefix_char     = '-';
	file_delimiter_char = ':';
	file_comment_char   = '#';
	equalsign 	= '=';
	comment       = '#' ;
	delimiter     = ':' ;
	endofline     = '\n';
	whitespace    = ' ' ;
	nullterminate = '\0';
	set = false;
	once = true;
	hasoptions = false;
	autousage = false;

  strcpy( long_opt_prefix , "--" );

	if( alloc() == false ){
		cout << endl << "OPTIONS ERROR : Failed allocating memory" ;
		cout << endl ;
		cout << "Exiting." << endl ;
		exit (0);
	}
}

bool
AnyOption::alloc()
{
	int i = 0 ;
	int size = 0 ;

	if( mem_allocated )
		return true;

	size = (max_options+1) * sizeof(const char*);
	options = (const char**)malloc( size );
	optiontype = (int*) malloc( (max_options+1)*sizeof(int) );
	optionindex = (int*) malloc( (max_options+1)*sizeof(int) );
	if( options == NULL || optiontype == NULL || optionindex == NULL )
		return false;
	else
		mem_allocated  = true;
	for( i = 0 ; i < max_options ; i++ ){
		options[i] = NULL;
		optiontype[i] = 0 ;
		optionindex[i] = -1 ;
	}
	optionchars = (char*) malloc( (max_char_options+1)*sizeof(char) );
	optchartype = (int*) malloc( (max_char_options+1)*sizeof(int) );
	optcharindex = (int*) malloc( (max_char_options+1)*sizeof(int) );
	if( optionchars == NULL ||
            optchartype == NULL ||
            optcharindex == NULL )
        {
		mem_allocated = false;
		return false;
	}
	for( i = 0 ; i < max_char_options ; i++ ){
		optionchars[i] = '0';
		optchartype[i] = 0 ;
		optcharindex[i] = -1 ;
	}

	size = (max_usage_lines+1) * sizeof(const char*) ;
	usage = (const char**) malloc( size );

	if( usage == NULL  ){
		mem_allocated = false;
		return false;
	}
	for( i = 0 ; i < max_usage_lines ; i++ )
		usage[i] = NULL;

	return true;
}

bool
AnyOption::doubleOptStorage()
{
	options = (const char**)realloc( options,
			((2*max_options)+1) * sizeof( const char*) );
	optiontype = (int*) realloc(  optiontype ,
			((2 * max_options)+1)* sizeof(int) );
	optionindex = (int*) realloc(  optionindex,
			((2 * max_options)+1) * sizeof(int) );
	if( options == NULL || optiontype == NULL || optionindex == NULL )
		return false;
	/* init new storage */
	for( int i = max_options ; i < 2*max_options ; i++ ){
		options[i] = NULL;
		optiontype[i] = 0 ;
		optionindex[i] = -1 ;
	}
	max_options = 2 * max_options ;
	return true;
}

bool
AnyOption::doubleCharStorage()
{
	optionchars = (char*) realloc( optionchars,
			((2*max_char_options)+1)*sizeof(char) );
	optchartype = (int*) realloc( optchartype,
			((2*max_char_options)+1)*sizeof(int) );
	optcharindex = (int*) realloc( optcharindex,
			((2*max_char_options)+1)*sizeof(int) );
	if( optionchars == NULL ||
	    optchartype == NULL ||
	    optcharindex == NULL )
		return false;
	/* init new storage */
	for( int i = max_char_options ; i < 2*max_char_options ; i++ ){
		optionchars[i] = '0';
		optchartype[i] = 0 ;
		optcharindex[i] = -1 ;
	}
	max_char_options = 2 * max_char_options;
	return true;
}

bool
AnyOption::doubleUsageStorage()
{
	usage = (const char**)realloc( usage,
			((2*max_usage_lines)+1) * sizeof( const char*) );
	if ( usage == NULL )
		return false;
	for( int i = max_usage_lines ; i < 2*max_usage_lines ; i++ )
		usage[i] = NULL;
	max_usage_lines = 2 * max_usage_lines ;
	return true;

}

void
AnyOption::cleanup()
{
	free (options);
	free (optiontype);
	free (optionindex);
	free (optionchars);
	free (optchartype);
	free (optcharindex);
	free (usage);
	if( values != NULL )
		free (values);
	if( new_argv != NULL )
		free (new_argv);
}

void
AnyOption::setCommandPrefixChar( char _prefix )
{
	opt_prefix_char = _prefix;
}

void
AnyOption::setCommandLongPrefix( char *_prefix )
{
	if( strlen( _prefix ) > MAX_LONG_PREFIX_LENGTH ){
		*( _prefix + MAX_LONG_PREFIX_LENGTH ) = '\0';
	}

  strcpy (long_opt_prefix,  _prefix);
}

void
AnyOption::setFileCommentChar( char _comment )
{
	file_delimiter_char = _comment;
}

void
AnyOption::setFileDelimiterChar( char _delimiter )
{
	file_comment_char = _delimiter ;
}

bool
AnyOption::CommandSet()
{
	return( command_set );
}

bool
AnyOption::FileSet()
{
	return( file_set );
}

void
AnyOption::noPOSIX()
{
	posix_style = false;
}

bool
AnyOption::POSIX()
{
	return posix_style;
}

void
AnyOption::setVerbose()
{
	verbose = true ;
}

void
AnyOption::printVerbose()
{
	if( verbose )
		cout << endl  ;
}
void
AnyOption::printVerbose( const char *msg )
{
	if( verbose )
		cout << msg  ;
}

void
AnyOption::printVerbose( char *msg )
{
	if( verbose )
		cout << msg  ;
}

void
AnyOption::printVerbose( char ch )
{
	if( verbose )
		cout << ch ;
}

bool
AnyOption::hasOptions()
{
	return hasoptions;
}

void
AnyOption::autoUsagePrint(bool _autousage)
{
	autousage = _autousage;
}

void
AnyOption::useCommandArgs( int _argc, char **_argv )
{
	argc = _argc;
	argv = _argv;
	command_set = true;
	appname = argv[0];
	if(argc > 1) hasoptions = true;
}

void
AnyOption::useFiileName( const char *_filename )
{
	filename = _filename;
	file_set = true;
}

/*
 * set methods for options
 */

void
AnyOption::setCommandOption( const char *opt )
{
	addOption( opt , COMMAND_OPT );
	g_value_counter++;
}

void
AnyOption::setCommandOption( char opt )
{
	addOption( opt , COMMAND_OPT );
	g_value_counter++;
}

void
AnyOption::setCommandOption( const char *opt , char optchar )
{
	addOption( opt , COMMAND_OPT );
	addOption( optchar , COMMAND_OPT );
	g_value_counter++;
}

void
AnyOption::setCommandFlag( const char *opt )
{
	addOption( opt , COMMAND_FLAG );
	g_value_counter++;
}

void
AnyOption::setCommandFlag( char opt )
{
	addOption( opt , COMMAND_FLAG );
	g_value_counter++;
}

void
AnyOption::setCommandFlag( const char *opt , char optchar )
{
	addOption( opt , COMMAND_FLAG );
	addOption( optchar , COMMAND_FLAG );
	g_value_counter++;
}

void
AnyOption::setFileOption( const char *opt )
{
	addOption( opt , FILE_OPT );
	g_value_counter++;
}

void
AnyOption::setFileOption( char opt )
{
	addOption( opt , FILE_OPT );
	g_value_counter++;
}

void
AnyOption::setFileOption( const char *opt , char optchar )
{
	addOption( opt , FILE_OPT );
	addOption( optchar, FILE_OPT  );
	g_value_counter++;
}

void
AnyOption::setFileFlag( const char *opt )
{
	addOption( opt , FILE_FLAG );
	g_value_counter++;
}

void
AnyOption::setFileFlag( char opt )
{
	addOption( opt , FILE_FLAG );
	g_value_counter++;
}

void
AnyOption::setFileFlag( const char *opt , char optchar )
{
	addOption( opt , FILE_FLAG );
	addOption( optchar , FILE_FLAG );
	g_value_counter++;
}

void
AnyOption::setOption( const char *opt )
{
	addOption( opt , COMMON_OPT );
	g_value_counter++;
}

void
AnyOption::setOption( char opt )
{
	addOption( opt , COMMON_OPT );
	g_value_counter++;
}

void
AnyOption::setOption( const char *opt , char optchar )
{
	addOption( opt , COMMON_OPT );
	addOption( optchar , COMMON_OPT );
	g_value_counter++;
}

void
AnyOption::setFlag( const char *opt )
{
	addOption( opt , COMMON_FLAG );
	g_value_counter++;
}

void
AnyOption::setFlag( const char opt )
{
	addOption( opt , COMMON_FLAG );
	g_value_counter++;
}

void
AnyOption::setFlag( const char *opt , char optchar )
{
	addOption( opt , COMMON_FLAG );
	addOption( optchar , COMMON_FLAG );
	g_value_counter++;
}

void
AnyOption::addOption( const char *opt, int type )
{
	if( option_counter >= max_options ){
		if( doubleOptStorage() == false ){
			addOptionError( opt );
			return;
		}
	}
	options[ option_counter ] = opt ;
	optiontype[ option_counter ] =  type ;
	optionindex[ option_counter ] = g_value_counter;
	option_counter++;
}

void
AnyOption::addOption( char opt, int type )
{
	if( !POSIX() ){
		printVerbose("Ignoring the option character \"");
		printVerbose(  opt );
		printVerbose( "\" ( POSIX options are turned off )" );
		printVerbose();
		return;
	}

	if( optchar_counter >= max_char_options ){
		if( doubleCharStorage() == false ){
			addOptionError( opt );
			return;
		}
	}
	optionchars[ optchar_counter ] =  opt ;
	optchartype[ optchar_counter ] =  type ;
	optcharindex[ optchar_counter ] = g_value_counter;
	optchar_counter++;
}

void
AnyOption::addOptionError( const char *opt )
{
	cout << endl ;
	cout << "OPTIONS ERROR : Failed allocating extra memory " << endl ;
	cout << "While adding the option : \""<< opt << "\"" << endl;
	cout << "Exiting." << endl ;
	cout << endl ;
	exit(0);
}

void
AnyOption::addOptionError( char opt )
{
	cout << endl ;
	cout << "OPTIONS ERROR : Failed allocating extra memory " << endl ;
	cout << "While adding the option: \""<< opt << "\"" << endl;
	cout << "Exiting." << endl ;
	cout << endl ;
	exit(0);
}

void
AnyOption::processOptions()
{
	if( ! valueStoreOK() )
		return;
}

void
AnyOption::processCommandArgs(int max_args)
{
	max_legal_args = max_args;
	processCommandArgs();
}

void
AnyOption::processCommandArgs( int _argc, char **_argv, int max_args )
{
	max_legal_args = max_args;
	processCommandArgs(  _argc, _argv );
}

void
AnyOption::processCommandArgs( int _argc, char **_argv )
{
	useCommandArgs( _argc, _argv );
	processCommandArgs();
}

void
AnyOption::processCommandArgs()
{
   	if( ! ( valueStoreOK() && CommandSet() )  )
	   return;

	if( max_legal_args == 0 )
		max_legal_args = argc;
	new_argv = (int*) malloc( (max_legal_args+1) * sizeof(int) );
	for( int i = 1 ; i < argc ; i++ ){/* ignore first argv */
		if(  argv[i][0] == long_opt_prefix[0] &&
                     argv[i][1] == long_opt_prefix[1] ) { /* long GNU option */
			int match_at = parseGNU( argv[i]+2 ); /* skip -- */
			if( match_at >= 0 && i < argc-1 ) /* found match */
				setValue( options[match_at] , argv[++i] );
		}else if(  argv[i][0] ==  opt_prefix_char ) { /* POSIX char */
			if( POSIX() ){
				char ch =  parsePOSIX( argv[i]+1 );/* skip - */
				if( ch != '0' && i < argc-1 ) /* matching char */
					setValue( ch ,  argv[++i] );
			} else { /* treat it as GNU option with a - */
				int match_at = parseGNU( argv[i]+1 ); /* skip - */
				if( match_at >= 0 && i < argc-1 ) /* found match */
					setValue( options[match_at] , argv[++i] );
			}
		}else { /* not option but an argument keep index */
			if( new_argc < max_legal_args ){
                                new_argv[ new_argc ] = i ;
                                new_argc++;
                        }else{ /* ignore extra arguments */
                                printVerbose( "Ignoring extra argument: " );
				printVerbose( argv[i] );
				printVerbose( );
				printAutoUsage();
                        }
			printVerbose( "Unknown command argument option : " );
			printVerbose( argv[i] );
			printVerbose( );
			printAutoUsage();
		}
	}
}

char
AnyOption::parsePOSIX( char* arg )
{

	for( unsigned int i = 0 ; i < strlen(arg) ; i++ ){
		char ch = arg[i] ;
		if( matchChar(ch) ) { /* keep matching flags till an option */
			/*if last char argv[++i] is the value */
			if( i == strlen(arg)-1 ){
				return ch;
			}else{/* else the rest of arg is the value */
				i++; /* skip any '=' and ' ' */
				while( arg[i] == whitespace
			    		|| arg[i] == equalsign )
					i++;
				setValue( ch , arg+i );
				return '0';
			}
		}
	}
	printVerbose( "Unknown command argument option : " );
	printVerbose( arg );
	printVerbose( );
	printAutoUsage();
	return '0';
}

int
AnyOption::parseGNU( char *arg )
{
	size_t split_at = 0;
	/* if has a '=' sign get value */
	for( size_t i = 0 ; i < strlen(arg) ; i++ ){
		if(arg[i] ==  equalsign ){
			split_at = i ; /* store index */
			i = strlen(arg); /* get out of loop */
		}
	}
	if( split_at > 0 ){ /* it is an option value pair */
		char* tmp = (char*) malloc(  (split_at+1)*sizeof(char) );
		for( size_t i = 0 ; i < split_at ; i++ )
			tmp[i] = arg[i];
		tmp[split_at] = '\0';

		if ( matchOpt( tmp ) >= 0 ){
			setValue( options[matchOpt(tmp)] , arg+split_at+1 );
			free (tmp);
		}else{
			printVerbose( "Unknown command argument option : " );
			printVerbose( arg );
			printVerbose( );
			printAutoUsage();
			free (tmp);
			return -1;
		}
	}else{ /* regular options with no '=' sign  */
		return  matchOpt(arg);
	}
	return -1;
}

int
AnyOption::matchOpt( char *opt )
{
	for( int i = 0 ; i < option_counter ; i++ ){
		if( strcmp( options[i], opt ) == 0 ){
			if( optiontype[i] ==  COMMON_OPT ||
			    optiontype[i] ==  COMMAND_OPT )
			{ /* found option return index */
				return i;
			}else if( optiontype[i] == COMMON_FLAG ||
			       optiontype[i] == COMMAND_FLAG )
			{ /* found flag, set it */
				setFlagOn( opt );
				return -1;
			}
		}
	}
	printVerbose( "Unknown command argument option : " );
	printVerbose( opt  ) ;
	printVerbose( );
	printAutoUsage();
	return  -1;
}
bool
AnyOption::matchChar( char c )
{
	for( int i = 0 ; i < optchar_counter ; i++ ){
		if( optionchars[i] == c ) { /* found match */
			if(optchartype[i] == COMMON_OPT ||
			     optchartype[i] == COMMAND_OPT )
			{ /* an option store and stop scanning */
				return true;
			}else if( optchartype[i] == COMMON_FLAG ||
				  optchartype[i] == COMMAND_FLAG ) { /* a flag store and keep scanning */
				setFlagOn( c );
				return false;
			}
		}
	}
	printVerbose( "Unknown command argument option : " );
	printVerbose( c ) ;
	printVerbose( );
	printAutoUsage();
	return false;
}

bool
AnyOption::valueStoreOK( )
{
	int size= 0;
	if( !set ){
		if( g_value_counter > 0 ){
			size = g_value_counter * sizeof(char*);
			values = (char**)malloc( size );
			for( int i = 0 ; i < g_value_counter ; i++)
				values[i] = NULL;
			set = true;
		}
	}
	return  set;
}

/*
 * public get methods
 */
char*
AnyOption::getValue( const char *option )
{
	if( !valueStoreOK() )
		return NULL;

	for( int i = 0 ; i < option_counter ; i++ ){
		if( strcmp( options[i], option ) == 0 )
			return values[ optionindex[i] ];
	}
	return NULL;
}

bool
AnyOption::getFlag( const char *option )
{
	if( !valueStoreOK() )
		return false;
	for( int i = 0 ; i < option_counter ; i++ ){
		if( strcmp( options[i], option ) == 0 )
			return findFlag( values[ optionindex[i] ] );
	}
	return false;
}

char*
AnyOption::getValue( char option )
{
	if( !valueStoreOK() )
		return NULL;
	for( int i = 0 ; i < optchar_counter ; i++ ){
		if( optionchars[i] == option )
			return values[ optcharindex[i] ];
	}
	return NULL;
}

bool
AnyOption::getFlag( char option )
{
	if( !valueStoreOK() )
		return false;
	for( int i = 0 ; i < optchar_counter ; i++ ){
		if( optionchars[i] == option )
			return findFlag( values[ optcharindex[i] ] ) ;
	}
	return false;
}

bool
AnyOption::findFlag( char* val )
{
	if( val == NULL )
		return false;

	if( strcmp( TRUE_FLAG , val ) == 0 )
		return true;

	return false;
}

/*
 * private set methods
 */
bool
AnyOption::setValue( const char *option , char *value )
{
  if( !valueStoreOK() )
    return false;
        for( int i = 0 ; i < option_counter ; i++ ){
                if( strcmp( options[i], option ) == 0 ){
                        values[ optionindex[i] ] = (char*) malloc((strlen(value)+1)*sizeof(char));
                        strcpy( values[ optionindex[i] ], value );
      return true;
    }
        }
        return false;
}

bool
AnyOption::setFlagOn( const char *option )
{
  if( !valueStoreOK() )
    return false;

  for( int i = 0 ; i < option_counter ; i++ )
  {
    if( strcmp( options[i], option ) == 0 )
    {
      values[ optionindex[i] ] =
        (char*) malloc((strlen(TRUE_FLAG)+1)*sizeof(char));
      strcpy( values[ optionindex[i] ],  TRUE_FLAG );
      return true;
    }
        }
        return false;
}

bool
AnyOption::setValue( char option , char *value )
{
  if( !valueStoreOK() )
    return false;
        for( int i = 0 ; i < optchar_counter ; i++ ){
                if( optionchars[i] == option ){
                        values[ optcharindex[i] ] = (char*) malloc((strlen(value)+1)*sizeof(char));
                        strcpy( values[ optcharindex[i] ],  value );
      return true;
    }
        }
        return false;
}

bool
AnyOption::setFlagOn( char option )
{
  if( !valueStoreOK() )
    return false;
        for( int i = 0 ; i < optchar_counter ; i++ ){
                if( optionchars[i] == option ){
                        values[ optcharindex[i] ] = (char*) malloc((strlen(TRUE_FLAG)+1)*sizeof(char));
      strcpy( values[ optcharindex[i] ] , TRUE_FLAG );
      return true;
    }
        }
        return false;
}

int
AnyOption::getArgc( )
{
	return new_argc;
}

char*
AnyOption::getArgv( int index )
{
	if( index < new_argc ){
		return ( argv[ new_argv[ index ] ] );
	}
	return NULL;
}

/* dotfile sub routines */

bool
AnyOption::processFile()
{
	if( ! (valueStoreOK() && FileSet())  )
		return false;
	return  ( consumeFile(readFile()) );
}

bool
AnyOption::processFile( const char *filename )
{
	useFiileName(filename );
	return ( processFile() );
}

char*
AnyOption::readFile()
{
	return ( readFile(filename) );
}

/*
 * read the file contents to a character buffer
 */

char*
AnyOption::readFile( const char* fname )
{
        char *buffer;
        ifstream is;
        is.open ( fname , ifstream::in );
        if( ! is.good() ){
                is.close();
                return NULL;
        }
        is.seekg (0, ios::end);
        size_t length = (size_t)is.tellg();
        is.seekg (0, ios::beg);
        buffer = (char*) malloc(length*sizeof(char));
        is.read (buffer,length);
        is.close();
        return buffer;
}

/*
 * scans a char* buffer for lines that does not
 * start with the specified comment character.
 */
bool
AnyOption::consumeFile( char *buffer )
{

        if( buffer == NULL )
		return false;

       	char *cursor = buffer;/* preserve the ptr */
       	char *pline = NULL ;
       	int linelength = 0;
       	bool newline = true;
       	for( unsigned int i = 0 ; i < strlen( buffer ) ; i++ ){
       	if( *cursor == endofline ) { /* end of line */
          	if( pline != NULL ) /* valid line */
               		processLine( pline, linelength );
                 	pline = NULL;
                 	newline = true;
           	}else if( newline ){ /* start of line */
                 	newline = false;
              		if( (*cursor != comment ) ){ /* not a comment */
		    		pline = cursor ;
                    		linelength = 0 ;
                	}
             	}
            	cursor++; /* keep moving */
            	linelength++;
       	}
     	free (buffer);
	return true;
}

/*
 *  find a valid type value pair separated by a delimiter
 *  character and pass it to valuePairs()
 *  any line which is not valid will be considered a value
 *  and will get passed on to justValue()
 *
 *  assuming delimiter is ':' the behaviour will be,
 *
 *  width:10    - valid pair valuePairs( width, 10 );
 *  width : 10  - valid pair valuepairs( width, 10 );
 *
 *  ::::        - not valid
 *  width       - not valid
 *  :10         - not valid
 *  width:      - not valid
 *  ::          - not valid
 *  :           - not valid
 *
 */

void
AnyOption::processLine( char *theline, int length  )
{
        bool found = false;
        char *pline = (char*) malloc( (length+1)*sizeof(char) );
        for( int i = 0 ; i < length ; i ++ )
                pline[i]= *(theline++);
        pline[length] = nullterminate;
        char *cursor = pline ; /* preserve the ptr */
        if( *cursor == delimiter || *(cursor+length-1) == delimiter ){
                justValue( pline );/* line with start/end delimiter */
        }else{
                for( int i = 1 ; i < length-1 && !found ; i++){/* delimiter */
                        if( *cursor == delimiter ){
                                *(cursor-1) = nullterminate; /* two strings */
                                found = true;
                                valuePairs( pline , cursor+1 );
                        }
                        cursor++;
                }
                cursor++;
                if( !found ) /* not a pair */
                        justValue( pline );
        }
        free (pline);
}

/*
 * removes trailing and preceeding whitespaces from a string
 */
char*
AnyOption::chomp( char *str )
{
        while( *str == whitespace )
                str++;
        char *end = str+strlen(str)-1;
        while( *end == whitespace )
                end--;
        *(end+1) = nullterminate;
        return str;
}

void
AnyOption::valuePairs( char *type, char *value )
{
	if ( strlen(chomp(type)) == 1  ){ /* this is a char option */
		for( int i = 0 ; i < optchar_counter ; i++ ){
			if(  optionchars[i] == type[0]  ){ /* match */
				if( optchartype[i] == COMMON_OPT ||
				    optchartype[i] == FILE_OPT )
				{
			 		setValue( type[0] , chomp(value) );
			 		return;
				}
			}
		}
	}
	/* if no char options matched */
	for( int i = 0 ; i < option_counter ; i++ ){
		if( strcmp( options[i], type ) == 0 ){ /* match */
			if( optiontype[i] == COMMON_OPT ||
			    optiontype[i] == FILE_OPT )
			{
		 		setValue( type , chomp(value) );
		 		return;
			}
		}
	}
        printVerbose( "Unknown option in resourcefile : " );
	printVerbose( type );
	printVerbose( );
}

void
AnyOption::justValue( char *type )
{

	if ( strlen(chomp(type)) == 1  ){ /* this is a char option */
		for( int i = 0 ; i < optchar_counter ; i++ ){
			if(  optionchars[i] == type[0]  ){ /* match */
				if( optchartype[i] == COMMON_FLAG ||
				    optchartype[i] == FILE_FLAG )
				{
			 		setFlagOn( type[0] );
			 		return;
				}
			}
		}
	}
	/* if no char options matched */
	for( int i = 0 ; i < option_counter ; i++ ){
		if( strcmp( options[i], type ) == 0 ){ /* match */
			if( optiontype[i] == COMMON_FLAG ||
			    optiontype[i] == FILE_FLAG )
			{
		 		setFlagOn( type );
		 		return;
			}
		}
	}
        printVerbose( "Unknown option in resourcefile : " );
	printVerbose( type  );
	printVerbose( );
}

/*
 * usage and help
 */

void
AnyOption::printAutoUsage()
{
	if( autousage ) printUsage();
}

void
AnyOption::printUsage()
{

	if( once ) {
		once = false ;
		cout << endl ;
		for( int i = 0 ; i < usage_lines ; i++ )
			cout << usage[i] << endl ;
		cout << endl ;
	}
}

void
AnyOption::addUsage( const char *line )
{
	if( usage_lines >= max_usage_lines ){
		if( doubleUsageStorage() == false ){
			addUsageError( line );
			exit(1);
		}
	}
	usage[ usage_lines ] = line ;
	usage_lines++;
}

void
AnyOption::addUsageError( const char *line )
{
	cout << endl ;
	cout << "OPTIONS ERROR : Failed allocating extra memory " << endl ;
	cout << "While adding the usage/help  : \""<< line << "\"" << endl;
	cout << "Exiting." << endl ;
	cout << endl ;
	exit(0);

}


text:
package com.tectonica.jonix.onix3;

import com.tectonica.jonix.common.JPU;
import com.tectonica.jonix.common.OnixElement;
import com.tectonica.jonix.common.codelist.NameIdentifierTypes;
import com.tectonica.jonix.common.codelist.RecordSourceTypes;

import java.io.Serializable;

/*
 * NOTE: THIS IS AN AUTO-GENERATED FILE, DO NOT EDIT MANUALLY
 */

/**
 *
Publisher identifier type

 *

 * An ONIX code which identifies the scheme from which the value in the <IDValue> element is taken. Mandatory in
 * each occurrence of the <PublisherIdentifier> composite.
 *

 *

 *

 * Format
 * Fixed length, two digits
 *

 *

 * Codelist
 * List 44
 *

 *

 * Reference name
 * <tt><PublisherIDType></tt>
 *

 *

 * Short tag
 * <tt><x447></tt>
 *

 *

 * Cardinality
 * 1
 *

 *

 * Example
 * <tt><x447>03</x447></tt> (Deutsche Bibliothek publisher identifier)
 *

 *

 *

 * This tag may be included in the following composites:
 *

 *
<{@link PublisherIdentifier}>

 *

 *

 * Possible placements within ONIX message:
 *

 *
{@link ONIXMessage} ⯈ {@link Product} ⯈ {@link PublishingDetail} ⯈ {@link Publisher} ⯈
 * {@link PublisherIdentifier} ⯈ {@link PublisherIDType}

 *

 */
public class PublisherIDType implements OnixElement<NameIdentifierTypes>, Serializable {
    private static final long serialVersionUID = 1L;

    public static final String refname = "PublisherIDType";
    public static final String shortname = "x447";

    /////////////////////////////////////////////////////////////////////////////////
    // ATTRIBUTES
    /////////////////////////////////////////////////////////////////////////////////

    /**
     * (type: dt.DateOrDateTime)
     */
    public String datestamp;

    /**
     * (type: dt.NonEmptyString)
     */
    public String sourcename;

    public RecordSourceTypes sourcetype;

    /////////////////////////////////////////////////////////////////////////////////
    // VALUE MEMBER
    /////////////////////////////////////////////////////////////////////////////////

    public NameIdentifierTypes value;

    /**
     * Internal API, use the {@link #value()} method or the {@link #value} field instead
     */
    @Override
    public NameIdentifierTypes _value() {
        return value;
    }

    /////////////////////////////////////////////////////////////////////////////////
    // SERVICES
    /////////////////////////////////////////////////////////////////////////////////

    private final boolean exists;
    public static final PublisherIDType EMPTY = new PublisherIDType();

    public PublisherIDType() {
        exists = false;
    }

    public PublisherIDType(org.w3c.dom.Element element) {
        exists = true;
        datestamp = JPU.getAttribute(element, "datestamp");
        sourcename = JPU.getAttribute(element, "sourcename");
        sourcetype = RecordSourceTypes.byCode(JPU.getAttribute(element, "sourcetype"));

        value = NameIdentifierTypes.byCode(JPU.getContentAsString(element));
    }

    /**
     * @return whether this tag (<PublisherIDType> or <x447>) is explicitly provided in the ONIX XML
     */
    @Override
    public boolean exists() {
        return exists;
    }
}


text:
An Instagram like share sheet for anything you copy

![alt tag](https://raw.githubusercontent.com/mikemilla/copyshare/master/screen_shot_1.png)
![alt tag](https://raw.githubusercontent.com/mikemilla/copyshare/master/screen_shot_2.png)
![alt tag](https://raw.githubusercontent.com/mikemilla/copyshare/master/screen_shot_3.png)

## Download

https://play.google.com/store/apps/details?id=com.mikemilla.copyshare

## Contact

Michael Miller

- mail@mikemilla.com
- http://mikemilla.com
- https://dribbble.com/mikemilla

## License

Code released under [the MIT license](http://choosealicense.com/licenses/mit/)


text:
namespace qflex {

void QflexOrdering::clear() { this->instructions.clear(); }

void QflexOrdering::load(std::istream& istream) {
  this->load(std::move(istream));
}
void QflexOrdering::load(std::istream&& istream) {
  // Strip everthing from a line that doesn't follow the right format
  auto strip_line = [](std::string line) {
    // Remove everything after '#'
    line = std::regex_replace(line, std::regex("#.*"), "");

    // Remove any special character
    line = std::regex_replace(line, std::regex("[^)(\\s\\ta-zA-Z0-9_.,-]"), "");

    // Convert tabs to spaces
    line = std::regex_replace(line, std::regex("[\\t]"), " ");

    // Remove multiple spaces
    line = std::regex_replace(line, std::regex("[\\s]{2,}"), " ");

    // Remove last space
    line = std::regex_replace(line, std::regex("\\s+$"), "");

    // Remove spaces between parentheses
    line = std::regex_replace(line, std::regex("\\s+(?=[^()]*\\))"), "");

    // After stripping, line should follow the format
    // cut (1,0) 39 45
    // expand A 10
    // ...

    return line;
  };

  // Clear this ordering
  this->clear();

  std::string line;
  while (std::getline(istream, line))
    if (std::size(line = strip_line(line))) this->instructions.push_back(line);
}
void QflexOrdering::load(const std::string& filename) {
  if (auto in = std::ifstream(filename); in.good())
    this->load(in);
  else
    throw std::string("Cannot open ordering file: ") + filename;
}

}  // namespace qflex


text:
if [[ -z "$RS_KEY" ]]; then
  echo "Please set RS_KEY to your API key"
  exit 1
fi

rm -f recording_new.json
ARGS=(--host us-3.rightscale.com --key $RS_KEY)

set -v

cl=`./recorder ${ARGS[@]} cm15 index clouds`
cl=`./recorder ${ARGS[@]} cm15 index /api/clouds`
cl=`./recorder ${ARGS[@]} cm15 show /api/clouds/6`

./recorder ${ARGS[@]} --x1 ".cloud_type" cm15 show /api/clouds/6
./recorder ${ARGS[@]} --xm ".cloud_type" cm15 index clouds
./recorder ${ARGS[@]} --xj ".cloud_type" cm15 index clouds

./recorder ${ARGS[@]} --x1 '*:has(.name:val("EC2 us-east-1")) .name' cm15 index clouds
./recorder ${ARGS[@]} --xm '*:has(.name:val("EC2 us-east-1")) .name' cm15 index clouds
./recorder ${ARGS[@]} --xj '*:has(.name:val("EC2 us-east-1")) .name' cm15 index clouds

./recorder ${ARGS[@]} --xm .local_disks cm15 index /api/clouds/1/instance_types

./recorder ${ARGS[@]} --x1 :root cm15 index /api/clouds/3/volume_snapshots \
	'filter[]=resource_uid==snap-00828462'
./recorder ${ARGS[@]} --xm :root cm15 index /api/clouds/3/volume_snapshots \
	'filter[]=resource_uid==snap-00828462'
./recorder ${ARGS[@]} --xj :root cm15 index /api/clouds/3/volume_snapshots \
	'filter[]=resource_uid==snap-00828462'
echo -e "\nTesting some error cases..."

found=`./recorder ${ARGS[@]} cm15 show /api/clouds/0`
[[ "$?" == 2 ]] || exit 1
[[ -z "$found" ]] || exit 1
found=`./recorder ${ARGS[@]} --x1 ".name" cm15 show /api/clouds/0`
[[ "$?" != 0 ]] || exit 1
[[ -z "$found" ]] || exit 1
found=`./recorder ${ARGS[@]} --xm ".name" cm15 show /api/clouds/0`
[[ "$?" != 0 ]] || exit 1
[[ -z "$found" ]] || exit 1
found=`./recorder ${ARGS[@]} --xj ".name" cm15 show /api/clouds/0`
[[ "$?" != 0 ]] || exit 1
[[ -z "$found" ]] || exit 1

found=`./recorder ${ARGS[@]} cm15 index clouds 'filter[]=name==does not exist'`
[[ "$?" == 0 ]] || exit 1
[[ -z "$found" ]] || exit 1
found=`./recorder ${ARGS[@]} --x1 ".name" cm15 index clouds 'filter[]=name==does not exist'`
[[ "$?" != 0 ]] || exit 1
[[ -z "$found" ]] || exit 1
found=`./recorder ${ARGS[@]} --xm ".name" cm15 index clouds 'filter[]=name==does not exist'`
[[ "$?" == 0 ]] || exit 1
[[ -z "$found" ]] || exit 1
found=`./recorder ${ARGS[@]} --xj ".name" cm15 index clouds 'filter[]=name==does not exist'`
[[ "$?" == 0 ]] || exit 1
[[ "$found" == "[]" ]] || exit 1

found=`./recorder ${ARGS[@]} --x1 '*:has(.name:val("not_exist")) .name' cm15 index clouds`
[[ "$?" == 6 ]] || exit 1
[[ -z "$found" ]] || exit 1

found=`./recorder ${ARGS[@]} --xm '*:has(.name:val("not_exist")) .name' cm15 index clouds`
[[ "$?" == 0 ]] || exit 1
[[ -z "$found" ]] || exit 1

found=`./recorder ${ARGS[@]} --xj '*:has(.name:val("not_exist")) .name' cm15 index clouds`
[[ "$?" == 0 ]] || exit 1
[[ "$found" == "[]" ]] || exit 1

echo -e "\nTesting some random calls\n"

names=`./recorder ${ARGS[@]} --xm '*:has(.cloud_type:val("amazon")) .name' cm15 index clouds`
declare -a "names=($names)" # magic
set | egrep '^names'
[[ ${#names[@]} = 9 ]] || exit 1
./recorder ${ARGS[@]} --xj '*:has(.cloud_type:val("amazon")) .name' cm15 index clouds

./recorder ${ARGS[@]} --x1 'object:has(.name:val("rsc-test"))' cm15 index deployments
href=`./recorder ${ARGS[@]} --xh location cm15 create deployments \
	'deployment[name]=rsc-test' \
	'deployment[description]=expendable deployment used to test rsc'`
declare -a "href=($href)"
echo "href=$href"
if [[ -n "$href" ]]; then
  ./recorder ${ARGS[@]} cm15 destroy $href
fi

# find existing deployment and delete it
deployment=`./recorder ${ARGS[@]} \
	--x1 ':has(.rel:val("self")).href' \
	cm15 index deployments \
	'filter[]=name==rsc-test'`
echo "deployment: $deployment"
if [[ -n "$deployment" ]]; then
	./recorder ${ARGS[@]} cm15 destroy $deployment
fi

# create a deployment with too few params -> error
./recorder ${ARGS[@]} --xh location cm15 create deployments

echo -e "\nTesting enable.sh-like calls\n"

# create a deployment to launch an instance in
deployment_href=`./recorder ${ARGS[@]} --xh location cm15 create deployments 'deployment[name]=rsc-test'`
echo "deployment_href: $deployment_href"

# get the href of the EC2 us-east-1 cloud
cloud_href=`./recorder ${ARGS[@]} \
	--x1 '*:has(.name:val("EC2 us-east-1")) :has(.rel:val("self")).href' \
	cm15 index clouds`
echo "cloud_href: $cloud_href"

# locate the image to launch
image_href=`./recorder ${ARGS[@]} \
	--x1 ':has(.rel:val("self")).href' \
	cm15 index $cloud_href/images \
	'filter[]=resource_uid==ami-6089d208'`
echo "image_href: $image_href"

# locate an instance type
inst_type_href=`./recorder ${ARGS[@]} \
	--x1 ':has(.rel:val("self")).href' \
	cm15 index $cloud_href/instance_types \
	'filter[]=name==m3.medium'`
echo "inst_type_href: $inst_type_href"

# launch the instance
instance_href=`./recorder ${ARGS[@]} \
	--xh location\
	cm15 create $cloud_href/instances \
	"instance[image_href]=$image_href" \
	"instance[instance_type_href]=$inst_type_href" \
	"instance[name]=recorde.-test"`
echo "instance_href: $instance_href"

# wait for it to be running
while true; do
	state=`./recorder ${ARGS[@]} \
		--x1 '.state' \
		cm15 show $instance_href`
	echo state: $state
	if [[ "$state" != pending ]]; then break; fi
	sleep 60
done

./recorder ${ARGS[@]} cm15 show $instance_href
./recorder ${ARGS[@]} --x1 .locked cm15 show $instance_href
./recorder ${ARGS[@]} --xm .locked cm15 show $instance_href
./recorder ${ARGS[@]} --xj .locked cm15 show $instance_href

# find server template
st_href=`./recorder ${ARGS[@]} \
	--x1 ':has(.rel:val("self")).href' \
	cm15 index server_templates \
	'filter[]=name==Rightlink 10.0.rc4 Linux Base' \
	'filter[]=revision==0'`
echo st_href: $st_href

# terminating instance
./recorder ${ARGS[@]} cm15 terminate $instance_href
./recorder ${ARGS[@]} cm15 destroy $deployment_href


text:
using Microsoft.MixedReality.Toolkit.Editor;
using Microsoft.MixedReality.Toolkit.Input;
using Microsoft.MixedReality.Toolkit.Utilities;
using NUnit.Framework;
using System.Collections;
using System.Linq;
using UnityEngine;
using UnityEngine.TestTools;

namespace Microsoft.MixedReality.Toolkit.Tests
{
    public class RiggedHandVisualizerTests : BasePlayModeTests
    {
        private const string RiggedHandProfileName = "TestRiggedHandVisualizationConfigurationProfile";

        public override IEnumerator Setup()
        {
            var riggedHandProfile = ScriptableObjectExtensions.GetAllInstances<MixedRealityToolkitConfigurationProfile>()
                           .FirstOrDefault(x => x.name.Equals(RiggedHandProfileName));
            PlayModeTestUtilities.Setup(riggedHandProfile);

            yield return null;
        }

#if UNITY_2019_3_OR_NEWER
        /// <summary>
        /// Run a basic pinch test on the rigged hand to make sure nothing crashes and that the mesh updates appropriately
        /// </summary>
        [UnityTest]
        public IEnumerator TestRiggedHand()
        {
            // Initialize hand
            var rightHand = new TestHand(Handedness.Right);
            yield return rightHand.Show(Vector3.zero);

            RiggedHandVisualizer handVisualizer = GameObject.FindObjectOfType<RiggedHandVisualizer>().GetComponent<RiggedHandVisualizer>();

            yield return rightHand.SetGesture(ArticulatedHandPose.GestureId.Open);
            Assert.IsTrue(handVisualizer.HandRenderer.sharedMaterial.GetFloat(handVisualizer.PinchStrengthMaterialProperty) < 0.5f);

            yield return rightHand.SetGesture(ArticulatedHandPose.GestureId.Grab);
            Assert.IsTrue(handVisualizer.HandRenderer.sharedMaterial.GetFloat(handVisualizer.PinchStrengthMaterialProperty) > 0.5f);

            yield return rightHand.SetGesture(ArticulatedHandPose.GestureId.OpenSteadyGrabPoint);
            Assert.IsTrue(handVisualizer.HandRenderer.sharedMaterial.GetFloat(handVisualizer.PinchStrengthMaterialProperty) < 0.5f);
        }
#endif
    }
}

#endif


text:
Microservice session store for Express and Connect

[![Dependency Status](https://david-dm.org/rpcjs/connect-uva/status.svg?style=flat)](https://david-dm.org/rpcjs/connect-uva)
[![Build Status](http://img.shields.io/travis/rpcjs/connect-uva.svg?style=flat)](https://travis-ci.org/rpcjs/connect-uva)
[![npm version](https://badge.fury.io/js/connect-uva.svg)](http://badge.fury.io/js/connect-uva)

## Installation

```
npm install --save connect-uva
```

## License

The MIT License (MIT)


text:
module ODBCExt

  # ------------------------------------------------------------------------
  # Mandatory methods
  #

  # #last_insert_id must be implemented for any database which returns
  # false from #prefetch_primary_key?
  def last_insert_id(table, sequence_name, stmt = nil)
    @logger.unknown("ODBCAdapter#last_insert_id>") if @trace
    select_value("select @@IDENTITY", 'last_insert_id')
  end

  # ------------------------------------------------------------------------
  # Optional methods
  #
  # These are supplied for a DBMS only if necessary.
  # ODBCAdapter tests for optional methods using Object#respond_to?

  # Pre action for ODBCAdapter#insert
  def pre_insert(sql, name, pk, id_value, sequence_name)
    @iiTable = get_table_name(sql)
    @iiCol = get_autounique_column(@iiTable)
    @iiEnabled = false

    if @iiCol != nil
      if query_contains_autounique_col(sql, @iiCol)
        begin
          @connection.do(enable_identity_insert(@iiTable, true))
          @iiEnabled = true
        rescue Exception => e
          raise ActiveRecordError, "IDENTITY_INSERT could not be turned on"
        end
      end
    end
  end

  # Post action for ODBCAdapter#insert
  def post_insert(sql, name, pk, id_value, sequence_name)
    if @iiEnabled
      begin
        @connection.do(enable_identity_insert(@iiTable, false))
      rescue Exception => e
        raise ActiveRecordError, "IDENTITY_INSERT could not be turned off"
      end
    end
  end

  # ------------------------------------------------------------------------
  # Method redefinitions
  #
  # DBMS specific methods which override the default implementation
  # provided by the ODBCAdapter core.
  #
  def create_database(name)
    @logger.unknown("ODBCAdapter#create_database>") if @trace
    @logger.unknown("args=[#{name}]") if @trace
    execute "CREATE DATABASE #{name}"
  rescue Exception => e
    @logger.unknown("exception=#{e}") if @trace
    raise
  end

  def drop_database(name)
    @logger.unknown("ODBCAdapter#drop_database>") if @trace
    @logger.unknown("args=[#{name}]") if @trace
    execute "DROP DATABASE #{name}"
  rescue Exception => e
    @logger.unknown("exception=#{e}") if @trace
    raise
  end

  def rename_table(name, new_name)
    @logger.unknown("ODBCAdapter#rename_table>") if @trace
    execute "EXEC sp_rename '#{name}', '#{new_name}'"
  rescue Exception => e
    @logger.unknown("exception=#{e}") if @trace
    raise
  end

  def remove_column(table_name, column_name)
    @logger.unknown("ODBCAdapter#remove_column>") if @trace
    # Remove default constraints first
    defaults = select_all "select def.name from sysobjects def, syscolumns col, sysobjects tab where col.cdefault = def.id and col.name = '#{column_name}' and tab.name = '#{table_name}' and col.id = tab.id"
    defaults.each {|constraint|
      execute "ALTER TABLE #{quote_table_name(table_name)} DROP CONSTRAINT #{constraint["name"]}"
    }
    execute "ALTER TABLE #{quote_table_name(table_name)} DROP COLUMN #{quote_column_name(column_name)}"
  rescue Exception => e
    @logger.unknown("exception=#{e}") if @trace
    raise
  end

  def change_column(table_name, column_name, type, options = {})
    @logger.unknown("ODBCAdapter#change_column>") if @trace
    sql_commands = ["ALTER TABLE #{table_name} ALTER COLUMN #{column_name} #{type_to_sql(type, options[:limit], options[:precision], options[:scale])}"]
    if options_include_default?(options)
      # Remove default constraints first
      defaults = select_all "select def.name from sysobjects def, syscolumns col, sysobjects tab where col.cdefault = def.id and col.name = '#{column_name}' and tab.name = '#{table_name}' and col.id = tab.id"
      defaults.each {|constraint|
        execute "ALTER TABLE #{table_name} DROP CONSTRAINT #{constraint["name"]}"
      }
      sql_commands << "ALTER TABLE #{table_name} ADD CONSTRAINT DF_#{table_name}_#{column_name} DEFAULT #{quote(options[:default])} FOR #{column_name}"
    end
    sql_commands.each {|c|
      execute(c)
    }
  rescue Exception => e
    @logger.unknown("exception=#{e}") if @trace
    raise
  end

  def change_column_default(table_name, column_name, default)
    @logger.unknown("ODBCAdapter#change_column_default>") if @trace
    # Remove default constraints first
    defaults = select_all "select def.name from sysobjects def, syscolumns col, sysobjects tab where col.cdefault = def.id and col.name = '#{column_name}' and tab.name = '#{table_name}' and col.id = tab.id"
    defaults.each {|constraint|
      execute "ALTER TABLE #{table_name} DROP CONSTRAINT #{constraint["name"]}"
    }
    execute "ALTER TABLE #{table_name} ADD CONSTRAINT DF_#{table_name}_#{column_name} DEFAULT #{quote(default)} FOR #{column_name}"
  rescue Exception => e
    @logger.unknown("exception=#{e}") if @trace
    raise
  end

  def rename_column(table_name, column_name, new_column_name)
    @logger.unknown("ODBCAdapter#rename_column>") if @trace
    execute "EXEC sp_rename '#{table_name}.#{column_name}', '#{new_column_name}'"
  rescue Exception => e
    @logger.unknown("exception=#{e}") if @trace
    raise
  end

  def remove_index(table_name, options = {})
    @logger.unknown("ODBCAdapter#remove_index>") if @trace
    execute "DROP INDEX #{table_name}.#{quote_column_name(index_name(table_name, options))}"
  rescue Exception => e
    @logger.unknown("exception=#{e}") if @trace
    raise
  end

  def tables(name = nil)
    # Hide system tables.
    super(name).delete_if {|t| t =~ /^sys/ }
  end

  def indexes(table_name, name = nil)
    # Hide primary key indexes.
    super(table_name, name).delete_if { |i| i.name =~ /^PK_/ }
  end

  # ------------------------------------------------------------------------
  # Private methods to support methods above
  #
  private

  def get_table_name(sql)
    if sql =~ /^\s*insert\s+into\s+([^\(\s]+)\s*|^\s*update\s+([^\(\s]+)\s*/i
      $1
    elsif sql =~ /from\s+([^\(\s]+)\s*/i
      $1
    else
      nil
    end	end

  def get_autounique_column(table_name)
    @table_columns = {} unless @table_columns
    @table_columns[table_name] = columns(table_name) if @table_columns[table_name] == nil
    @table_columns[table_name].each do |col|
      return col.name if col.auto_unique?
    end

    return nil
  end

  def query_contains_autounique_col(sql, col)
    sql =~ /(\[#{col}\])|("#{col}")/
  end

  def enable_identity_insert(table_name, enable = true)
    if has_autounique_column(table_name)
    	"SET IDENTITY_INSERT #{table_name} #{enable ? 'ON' : 'OFF'}"
    end
  end

  def has_autounique_column(table_name)
    !get_autounique_column(table_name).nil?
  end

end # module


text:
=======
Symfony2-blog
=============

Symfony2 blog tutorial


text:
package edu.toronto.cs.xcurator.common;

import java.util.Map;
import javax.xml.XMLConstants;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
import org.w3c.dom.Document;
import org.w3c.dom.Element;

/**
 *
 * @author zhuerkan
 */
public class XmlDocumentBuilder {

    public Document createDocument() throws ParserConfigurationException {
        DocumentBuilder builder = createNsAwareDocumentBuilder();
        return builder.newDocument();
    }

    public Element addRootElement(Document doc, String rootNamespaceUri,
            String rootName) {
        Element root = doc.createElementNS(rootNamespaceUri, rootName);
        doc.appendChild(root);
        return root;
    }

    public DocumentBuilder createNsAwareDocumentBuilder() throws ParserConfigurationException {
        DocumentBuilderFactory builderFactory = DocumentBuilderFactory.newInstance();
        builderFactory.setNamespaceAware(true);
        return builderFactory.newDocumentBuilder();
    }

    public void addNsContextToEntityElement(Element entity, NsContext nsCtx) {
        for (Map.Entry<String, String> ns : nsCtx.getNamespaces().entrySet()) {
            String attributeName = XMLConstants.XMLNS_ATTRIBUTE;
            if (!ns.getKey().equals("")) {
                attributeName += ":" + ns.getKey();
            }
            entity.setAttributeNS(XMLConstants.XMLNS_ATTRIBUTE_NS_URI,
                    attributeName, ns.getValue());
        }
    }

    public void addUriBasedAttrToElement(String attrName, String typeUri,
            NsContext nsContext, Element element) {
        if (typeUri.startsWith("http://")) {
            String typeName = typeUri.substring(typeUri.lastIndexOf("/") + 1);
            String baseUri = typeUri.substring(0, typeUri.lastIndexOf("/"));
            String prefix = nsContext.getPrefix(baseUri);
            element.setAttribute(attrName, prefix == null ? typeUri : prefix + ":" + typeName);
        } else {
            element.setAttribute(attrName, typeUri);
        }
    }

}


text:
var React = require('react');
var Guide = require('./guide');

React.render(
    <Guide badgeUrl="./src/data/badges.json" />,
    document.getElementById('content')
);


text:
package io.github.eternalbits.linux.disk.lvm;

import java.nio.ByteBuffer;
import java.nio.charset.StandardCharsets;

import io.github.eternalbits.compactvd.Static;
import io.github.eternalbits.disk.WrongHeaderException;

class LvmPhysicalVolumeLabel {
	static final int LABEL_SIZE = 512;

	private static long LABELONE = 0x454E4F4C4542414CL;

	final LvmSimpleDiskLayout layout;

//	Label header
	long 	id;								// LABELONE
	long 	sector;							// Sector number of this label
	int		crc;							// From next field to end of sector [non-standard, not checked]
	int		offset;							// Offset from start of labelHeader to pvHeader
	long	type;							// LVM2 001

//	Physical volume header
	String	uuid;							// Physical volume UUID, 32 alphanumeric (ASCII) bytes
	long	deviceSize;						// This size can be overridden if PV belongs to a VG

//	Locations and sizes
	long	dataOffset;						// Data area location in bytes; data area size is usually zero
	long	metaStart;						// Metadata area header location in bytes
	long	metaSize;						// Metadata area header size in bytes

	LvmPhysicalVolumeLabel(LvmSimpleDiskLayout lvm, ByteBuffer in) throws WrongHeaderException {
		this.layout		= lvm;

		in.order(LvmSimpleDiskLayout.BYTE_ORDER);
		for (int i = 0; i+8 < in.remaining(); i += LABEL_SIZE) {
			if (in.getLong(i) == LABELONE) {
				in.position(i);
				if (in.remaining() >= LABEL_SIZE) {

					id		= in.getLong();
					sector	= in.getLong();
					crc		= in.getInt();
					offset	= in.getInt();
					type	= in.getLong();

					if (sector == i/LABEL_SIZE && offset >= 32 && offset < 408) {
						in.position(i + offset);

						uuid			= formatedUuid(in);
						deviceSize		= in.getLong();

						dataOffset		= in.getLong(); // "Must be exactly one data area"
						in.getLong();
						// Save only first data area and first metadata area header location.
						// No metadata is a valid configuration but is not supported here.
						while (in.getLong() != 0) in.getLong(); in.getLong();
						metaStart	= in.getLong();
						metaSize	= in.getLong();

						if (dataOffset > 0 && metaStart > 0 && metaSize > 0) {
							return;
						}
					}
				}
				break;
			}
		}

		throw new WrongHeaderException(getClass(), layout.toString());
	}

	private static String formatedUuid(ByteBuffer in) {
		StringBuilder sb = new StringBuilder(Static.getString(in, 6, StandardCharsets.US_ASCII));
		for (int i = 0; i < 6; i++) sb.append("-").append(Static.getString(in, 4, StandardCharsets.US_ASCII));
		return sb.append(Static.getString(in, 2, StandardCharsets.US_ASCII)).toString();
	}

}


text:
<?php namespace Anomaly\WysiwygFieldType\Table;

use Anomaly\FilesModule\File\Contract\FileInterface;
use Anomaly\Streams\Platform\Application\Application;

/**
 * Class FileTableButtons
 *
 * @link          http://pyrocms.com/
 * @author        PyroCMS, Inc. <support@pyrocms.com>
 * @author        Ryan Thompson <ryan@pyrocms.com>
 */
class FileTableButtons
{

    /**
     * Handle the table buttons.
     *
     * @param FileTableBuilder $builder
     * @param Application $application
     */
    public function handle(FileTableBuilder $builder, Application $application)
    {
        $segment = "app/{$application->getReference()}/files-module";

        $builder->setButtons(
            [
                'select' => [
                    'data-select' => $builder->getMode(),
                    'data-entry'  => function (FileInterface $entry) {
                        return $entry->path();
                    },
                ],
            ]
        );
    }
}


text:
<?php

namespace getjump\Vk\Wrapper;

use getjump\Vk\Core;

/**
 * Class BaseWrapper
 * Your Wrappers should extends this class as part of architecture.
 * @package getjump\Vk\Wrapper
 */
class BaseWrapper
{
    /**
     * @var \GuzzleHttp\Client
     */
    public $guzzle = false;

    /**
     * @var Core;
     */
    protected $vk;

    /**
     * @param Core $vk
     */
    public function __construct(Core $vk)
    {
        if ($vk instanceof Core) {
            $this->vk = $vk;
        }

        if (!$this->guzzle) {
            $this->guzzle = new \GuzzleHttp\Client();
        }
    }
}


text:
This is a minor fork of Dave Cheney's [excellent mdns library](https://github.com/davecheney/mdns)

It removes the gmx stuff and doesn't log on publish unless there are NO interfaces available,
instead of if either ipv4 or ipv6 is unavailable.

Introduction
============

This package allows Go processes to publish multicast DNS style records onto their local network segment. For more information about mDNS, and it's closely related cousin, Zeroconf, please visit http://www.multicastdns.org/.

Acknowledgements
================

Thanks to Brian Ketelsen and Miek Gieben for their feedback and suggestions. This package builds on Miek's fantastic godns library and would not have been possible without it.

Installation
============

This package can be installed using:

    go get github.com/davecheney/mdns

For development, this package is developed with John Asmuths excellent gb utility.

Usage
=====

Publishing mDNS records is simple

    import "github.com/davecheney/mdns"

    mdns.Publish("yourhost.local 60 IN A 192.168.1.100")

This places an A record into the internal zone file. Broadcast mDNS queries that match records in the internal zone file are responded to automatically. Other records types are supported, check the godoc for more information.

    go doc github.com/davecheney/mdns

Tested Platforms
================

This package has been tested on the following platforms

* linux/arm
* linux/386
* linux/amd64
* darwin/386
* darwin/amd64

gmx Instruments
===============

Counters for zone queries and entries, as well as connector questions and responses are instrumented via gmx.

	gmxc -p $(pgrep mdns-publisher) mdns | sort
	mdns.connector.questions: 3
	mdns.connector.responses: 3
	mdns.zone.local.entries: 5
	mdns.zone.local.queries: 12

Changelog
=========

12/02/2012

* Simplified mdns.Publish method, thanks to Miek Gieben for his quick work adding parsing support for SRV and PTR records.

07/02/2012

* Updated LICENCE to a proper BSD 2 clause
* Added gmx instrumentation
* Updated to the Go 1 multicast API

14/10/2011 Initial Release


text:
#ifndef B2_BLOCK_ALLOCATOR_H
#define B2_BLOCK_ALLOCATOR_H

#include "b2Settings.h"

const juce::int32 b2_chunkSize = 16 * 1024;
const juce::int32 b2_maxBlockSize = 640;
const juce::int32 b2_blockSizes = 14;
const juce::int32 b2_chunkArrayIncrement = 128;

struct b2Block;
struct b2Chunk;

/// This is a small object allocator used for allocating small
/// objects that persist for more than one time step.
/// See: http://www.codeproject.com/useritems/Small_Block_Allocator.asp
class b2BlockAllocator
{
public:
	b2BlockAllocator();
	~b2BlockAllocator();

	/// Allocate memory. This will use b2Alloc if the size is larger than b2_maxBlockSize.
	void* Allocate(juce::int32 size);

	/// Free memory. This will use b2Free if the size is larger than b2_maxBlockSize.
	void Free(void* p, juce::int32 size);

	void Clear();

private:

	b2Chunk* m_chunks;
	juce::int32 m_chunkCount;
	juce::int32 m_chunkSpace;

	b2Block* m_freeLists[b2_blockSizes];

	static juce::int32 s_blockSizes[b2_blockSizes];
	static juce::uint8 s_blockSizeLookup[b2_maxBlockSize + 1];
	static bool s_blockSizeLookupInitialized;
};

#endif


text:
package org.codehaus.groovy.ast.decompiled;

import org.codehaus.groovy.ast.ClassHelper;
import org.codehaus.groovy.ast.ClassNode;
import org.codehaus.groovy.ast.GenericsType;
import org.codehaus.groovy.vmplugin.v5.Java5;
import org.objectweb.asm.Opcodes;
import org.objectweb.asm.Type;
import org.objectweb.asm.signature.SignatureVisitor;

import java.util.ArrayList;
import java.util.List;

/**
* @author Peter Gromov
*/
abstract class TypeSignatureParser extends SignatureVisitor {
    private final AsmReferenceResolver resolver;

    public TypeSignatureParser(AsmReferenceResolver resolver) {
        super(Opcodes.ASM5);
        this.resolver = resolver;
    }

    abstract void finished(ClassNode result);

    private String baseName;
    private final List<GenericsType> arguments = new ArrayList<GenericsType>();

    @Override
    public void visitTypeVariable(String name) {
        finished(Java5.configureTypeVariableReference(name));
    }

    @Override
    public void visitBaseType(char descriptor) {
        finished(resolver.resolveType(Type.getType(String.valueOf(descriptor))));
    }

    @Override
    public SignatureVisitor visitArrayType() {
        final TypeSignatureParser outer = this;
        return new TypeSignatureParser(resolver) {
            @Override
            void finished(ClassNode result) {
                outer.finished(result.makeArray());
            }
        };
    }

    @Override
    public void visitClassType(String name) {
        baseName = AsmDecompiler.fromInternalName(name);
    }

    @Override
    public void visitTypeArgument() {
        arguments.add(createWildcard(new ClassNode[]{ClassHelper.OBJECT_TYPE}, null));
    }

    @Override
    public SignatureVisitor visitTypeArgument(final char wildcard) {
        return new TypeSignatureParser(resolver) {
            @Override
            void finished(ClassNode result) {
                if (wildcard == INSTANCEOF) {
                    arguments.add(new GenericsType(result));
                    return;
                }

                ClassNode[] upper = wildcard == EXTENDS ? new ClassNode[]{result} : null;
                ClassNode lower = wildcard == SUPER ? result : null;
                arguments.add(createWildcard(upper, lower));
            }
        };
    }

    private static GenericsType createWildcard(ClassNode[] upper, ClassNode lower) {
        ClassNode base = ClassHelper.makeWithoutCaching("?");
        base.setRedirect(ClassHelper.OBJECT_TYPE);
        GenericsType t = new GenericsType(base, upper, lower);
        t.setWildcard(true);
        return t;
    }

    @Override
    public void visitInnerClassType(String name) {
        baseName += "$" + name;
        arguments.clear();
    }

    @Override
    public void visitEnd() {
        ClassNode base = resolver.resolveClass(baseName);
        if (arguments.isEmpty()) {
            finished(base);
            return;
        }

        ClassNode bound = base.getPlainNodeReference();
        bound.setGenericsTypes(arguments.toArray(new GenericsType[arguments.size()]));
        finished(bound);
    }

}