text:
package com.sequenceiq.cloudbreak.core.flow2.cluster.repair;

import com.sequenceiq.cloudbreak.core.flow2.FlowState;
import com.sequenceiq.cloudbreak.core.flow2.RestartAction;
import com.sequenceiq.cloudbreak.core.flow2.restart.FillInMemoryStateStoreRestartAction;

enum ChangePrimaryGatewayState implements FlowState {
    INIT_STATE,
    CHANGE_PRIMARY_GATEWAY_STATE,
    WAITING_FOR_AMBARI_SERVER_STATE,
    UPDATE_PROXY_STATE,
    CHANGE_PRIMARY_GATEWAY_FINISHED_STATE,
    CHANGE_PRIMARY_GATEWAY_FAILED_STATE,
    FINAL_STATE;

    private Class<? extends RestartAction> restartAction = FillInMemoryStateStoreRestartAction.class;

    @Override
    public Class<? extends RestartAction> restartAction() {
        return restartAction;
    }
}

redpajama_set_name: RedPajamaGithub


text:
import ApplicationSerializer from 'ember-fhir-adapter/serializers/application';

var CommunicationRequest = ApplicationSerializer.extend({
    attrs: {
        identifier : {embedded: 'always'},
				category : {embedded: 'always'},
				sender : {embedded: 'always'},
				recipient : {embedded: 'always'},
				payload:  {embedded: 'always'},
				medium : {embedded: 'always'},
				requester : {embedded: 'always'},
				encounter : {embedded: 'always'},
				scheduledPeriod : {embedded: 'always'},
				reason : {embedded: 'always'},
				subject : {embedded: 'always'},
				priority : {embedded: 'always'}
    }
});
export default CommunicationRequest;


text:
class StubStack < OpenStruct; end

Fabricator(:stack, from: :stub_stack) do
  name 'foo'
  version 'v2'

  apps { [] }
  databases { [] }
end


text:
package legends.model.events.basic;

import java.util.ArrayList;
import java.util.EnumSet;
import java.util.List;
import java.util.Set;
import java.util.function.BiConsumer;
import java.util.function.BinaryOperator;
import java.util.function.Function;
import java.util.function.Predicate;
import java.util.function.Supplier;
import java.util.stream.Collector;
import java.util.stream.Stream;

import legends.model.collections.basic.EventCollection;

public class EventCollectionFilter<T extends EventCollection>
		implements Collector<EventCollection, List<T>, Stream<T>> {

	Class<T> eventClass;
	Predicate<T> filter;

	public EventCollectionFilter(Class<T> eventClass, Predicate<T> filter) {
		this.eventClass = eventClass;
		this.filter = filter;
	}

	@Override
	public Supplier<List<T>> supplier() {
		return () -> new ArrayList<>();
	}

	@SuppressWarnings("unchecked")
	@Override
	public BiConsumer<List<T>, EventCollection> accumulator() {
		return (l, e) -> {
			if (e.getClass().equals(eventClass) && filter.test((T) e))
				l.add((T) e);
		};
	}

	@Override
	public BinaryOperator<List<T>> combiner() {
		return (l1, l2) -> {
			l1.addAll(l2);
			return l1;
		};
	}

	@Override
	public Function<List<T>, Stream<T>> finisher() {
		return e -> e.stream();
	}

	@Override
	public Set<java.util.stream.Collector.Characteristics> characteristics() {
		return EnumSet.of(Characteristics.UNORDERED);
	}

}


text:
package ru.job4j.list;

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

/**
 * Created by Ivan Sliusar on 22.09.2017.
 * Red Line Soft corp.
 */
public class CycleDetection {
    /**
     * Test linked list fore looping.
     *
     * @param first Node.
     * @return boolean
     */
    public boolean hasCycle(Node first) {

        List<Node> uniqueValue = new ArrayList<>();

        while (first.getNext() != null) {
            if (uniqueValue.contains(first.getNext())) {
                return true;
            } else {
                uniqueValue.add(first.getNext());
            }
            first = first.getNext();
        }
        return false;
    }
}


text:
namespace Norm
{
    /// <summary>
    /// The i mongo grouping.
    /// </summary>
    /// <typeparam retval="K">Key</typeparam>
    /// <typeparam retval="V">Value</typeparam>
    public interface IMongoGrouping<K, V>
    {
        /// <summary>
        /// Gets or sets the ey.
        /// </summary>
        K Key { get; set; }

        /// <summary>
        /// Gets or sets the value.
        /// </summary>
        V Value { get; set; }
    }
}


text:
//-----------------------------------NOTICE----------------------------------//
// Some of this file is automatically filled in by a Python script.  Only    //
// add custom code in the designated areas or it will be overwritten during  //
// the next update.                                                          //
//-----------------------------------NOTICE----------------------------------//

//--BEGIN FILE HEAD CUSTOM CODE--//

//--END CUSTOM CODE--//

#include "../../include/FixLink.h"
#include "../../include/ObjectRegistry.h"
#include "../../include/NIF_IO.h"
#include "../../include/obj/BSDismemberSkinInstance.h"
#include "../../include/gen/BodyPartList.h"
using namespace Niflib;

//Definition of TYPE constant
const Type BSDismemberSkinInstance::TYPE("BSDismemberSkinInstance", &NiSkinInstance::TYPE );

BSDismemberSkinInstance::BSDismemberSkinInstance() : numPartitions((int)0) {
	//--BEGIN CONSTRUCTOR CUSTOM CODE--//

	//--END CUSTOM CODE--//
}

BSDismemberSkinInstance::~BSDismemberSkinInstance() {
	//--BEGIN DESTRUCTOR CUSTOM CODE--//

	//--END CUSTOM CODE--//
}

const Type & BSDismemberSkinInstance::GetType() const {
	return TYPE;
}

NiObject * BSDismemberSkinInstance::Create() {
	return new BSDismemberSkinInstance;
}

void BSDismemberSkinInstance::Read( istream& in, list<unsigned int> & link_stack, const NifInfo & info ) {
	//--BEGIN PRE-READ CUSTOM CODE--//

	//--END CUSTOM CODE--//

	NiSkinInstance::Read( in, link_stack, info );
	NifStream( numPartitions, in, info );
	partitions.resize(numPartitions);
	for (unsigned int i1 = 0; i1 < partitions.size(); i1++) {
		NifStream( partitions[i1].partFlag, in, info );
		NifStream( partitions[i1].bodyPart, in, info );
	};

	//--BEGIN POST-READ CUSTOM CODE--//
	//--END CUSTOM CODE--//
}

void BSDismemberSkinInstance::Write( ostream& out, const map<NiObjectRef,unsigned int> & link_map, list<NiObject *> & missing_link_stack, const NifInfo & info ) const {
	//--BEGIN PRE-WRITE CUSTOM CODE--//
	//--END CUSTOM CODE--//

	NiSkinInstance::Write( out, link_map, missing_link_stack, info );
	numPartitions = (int)(partitions.size());
	NifStream( numPartitions, out, info );
	for (unsigned int i1 = 0; i1 < partitions.size(); i1++) {
		NifStream( partitions[i1].partFlag, out, info );
		NifStream( partitions[i1].bodyPart, out, info );
	};

	//--BEGIN POST-WRITE CUSTOM CODE--//
	//--END CUSTOM CODE--//
}

std::string BSDismemberSkinInstance::asString( bool verbose ) const {
	//--BEGIN PRE-STRING CUSTOM CODE--//
	//--END CUSTOM CODE--//

	stringstream out;
	unsigned int array_output_count = 0;
	out << NiSkinInstance::asString();
	numPartitions = (int)(partitions.size());
	out << "  Num Partitions:  " << numPartitions << endl;
	array_output_count = 0;
	for (unsigned int i1 = 0; i1 < partitions.size(); i1++) {
		if ( !verbose && ( array_output_count > MAXARRAYDUMP ) ) {
			out << "<Data Truncated. Use verbose mode to see complete listing.>" << endl;
			break;
		};
		out << "    Part Flag:  " << partitions[i1].partFlag << endl;
		out << "    Body Part:  " << partitions[i1].bodyPart << endl;
	};
	return out.str();

	//--BEGIN POST-STRING CUSTOM CODE--//
	//--END CUSTOM CODE--//
}

void BSDismemberSkinInstance::FixLinks( const map<unsigned int,NiObjectRef> & objects, list<unsigned int> & link_stack, list<NiObjectRef> & missing_link_stack, const NifInfo & info ) {
	//--BEGIN PRE-FIXLINKS CUSTOM CODE--//
	//--END CUSTOM CODE--//

	NiSkinInstance::FixLinks( objects, link_stack, missing_link_stack, info );

	//--BEGIN POST-FIXLINKS CUSTOM CODE--//
	//--END CUSTOM CODE--//
}

std::list<NiObjectRef> BSDismemberSkinInstance::GetRefs() const {
	list<Ref<NiObject> > refs;
	refs = NiSkinInstance::GetRefs();
	return refs;
}

std::list<NiObject *> BSDismemberSkinInstance::GetPtrs() const {
	list<NiObject *> ptrs;
	ptrs = NiSkinInstance::GetPtrs();
	return ptrs;
}

//--BEGIN MISC CUSTOM CODE--//

vector<BodyPartList > BSDismemberSkinInstance::GetPartitions() const {
   return partitions;
}

void BSDismemberSkinInstance::SetPartitions( const vector<BodyPartList >& value ) {
   partitions.clear();
   for(unsigned int i = 0; i < value.size(); i++) {
	   partitions.push_back(value[i]);
   }
}

//--END CUSTOM CODE--//


text:
import numpy as np
import os
import argparse

from tensorpack import *
from tensorpack.tfutils import optimizer, summary, gradproc
from tensorpack.utils import logger
from tensorpack.utils.fs import download, get_dataset_path
from tensorpack.utils.argtools import memoized_ignoreargs

import reader as tfreader
from reader import ptb_producer

import tensorflow as tf
rnn = tf.contrib.rnn

SEQ_LEN = 35
HIDDEN_SIZE = 650
NUM_LAYER = 2
BATCH = 20
DROPOUT = 0.5
VOCAB_SIZE = None
TRAIN_URL = 'https://raw.githubusercontent.com/tomsercu/lstm/master/data/ptb.train.txt'
VALID_URL = 'https://raw.githubusercontent.com/tomsercu/lstm/master/data/ptb.valid.txt'
TEST_URL = 'https://raw.githubusercontent.com/tomsercu/lstm/master/data/ptb.test.txt'

@memoized_ignoreargs
def get_PennTreeBank(data_dir=None):
    if data_dir is None:
        data_dir = get_dataset_path('ptb_data')
    if not os.path.isfile(os.path.join(data_dir, 'ptb.train.txt')):
        download(TRAIN_URL, data_dir)
        download(VALID_URL, data_dir)
        download(TEST_URL, data_dir)
    word_to_id = tfreader._build_vocab(os.path.join(data_dir, 'ptb.train.txt'))
    data3 = [np.asarray(tfreader._file_to_word_ids(os.path.join(data_dir, fname), word_to_id))
             for fname in ['ptb.train.txt', 'ptb.valid.txt', 'ptb.test.txt']]
    return data3, word_to_id

class Model(ModelDesc):
    def inputs(self):
        return [tf.placeholder(tf.int32, (None, SEQ_LEN), 'input'),
                tf.placeholder(tf.int32, (None, SEQ_LEN), 'nextinput')]

    def build_graph(self, input, nextinput):
        is_training = get_current_tower_context().is_training
        initializer = tf.random_uniform_initializer(-0.05, 0.05)

        def get_basic_cell():
            cell = rnn.BasicLSTMCell(num_units=HIDDEN_SIZE, forget_bias=0.0, reuse=tf.get_variable_scope().reuse)
            if is_training:
                cell = rnn.DropoutWrapper(cell, output_keep_prob=1 - DROPOUT)
            return cell

        cell = rnn.MultiRNNCell([get_basic_cell() for _ in range(NUM_LAYER)])

        def get_v(n):
            return tf.get_variable(n, [BATCH, HIDDEN_SIZE],
                                   trainable=False,
                                   initializer=tf.constant_initializer())

        state_var = [rnn.LSTMStateTuple(
            get_v('c{}'.format(k)), get_v('h{}'.format(k))) for k in range(NUM_LAYER)]
        self.state = state_var = tuple(state_var)

        embeddingW = tf.get_variable('embedding', [VOCAB_SIZE, HIDDEN_SIZE], initializer=initializer)
        input_feature = tf.nn.embedding_lookup(embeddingW, input)  # B x seqlen x hiddensize
        input_feature = Dropout(input_feature, keep_prob=1 - DROPOUT)

        with tf.variable_scope('LSTM', initializer=initializer):
            input_list = tf.unstack(input_feature, num=SEQ_LEN, axis=1)  # seqlen x (Bxhidden)
            outputs, last_state = rnn.static_rnn(cell, input_list, state_var, scope='rnn')

        # update the hidden state after a rnn loop completes
        update_state_ops = []
        for k in range(NUM_LAYER):
            update_state_ops.extend([
                tf.assign(state_var[k].c, last_state[k].c),
                tf.assign(state_var[k].h, last_state[k].h)])

        # seqlen x (Bxrnnsize)
        output = tf.reshape(tf.concat(outputs, 1), [-1, HIDDEN_SIZE])  # (Bxseqlen) x hidden
        logits = FullyConnected('fc', output, VOCAB_SIZE,
                                activation=tf.identity, kernel_initializer=initializer,
                                bias_initializer=initializer)
        xent_loss = tf.nn.sparse_softmax_cross_entropy_with_logits(
            logits=logits, labels=tf.reshape(nextinput, [-1]))

        with tf.control_dependencies(update_state_ops):
            cost = tf.truediv(tf.reduce_sum(xent_loss),
                              tf.cast(BATCH, tf.float32), name='cost')  # log-perplexity

        perpl = tf.exp(cost / SEQ_LEN, name='perplexity')
        summary.add_moving_summary(perpl, cost)
        return cost

    def reset_lstm_state(self):
        s = self.state
        z = tf.zeros_like(s[0].c)
        ops = []
        for k in range(NUM_LAYER):
            ops.append(s[k].c.assign(z))
            ops.append(s[k].h.assign(z))
        return tf.group(*ops, name='reset_lstm_state')

    def optimizer(self):
        lr = tf.get_variable('learning_rate', initializer=1.0, trainable=False)
        opt = tf.train.GradientDescentOptimizer(lr)
        return optimizer.apply_grad_processors(
            opt, [gradproc.GlobalNormClip(5)])

def get_config():
    logger.auto_set_dir()

    data3, wd2id = get_PennTreeBank()
    global VOCAB_SIZE
    VOCAB_SIZE = len(wd2id)
    steps_per_epoch = (data3[0].shape[0] // BATCH - 1) // SEQ_LEN

    train_data = TensorInput(
        lambda: ptb_producer(data3[0], BATCH, SEQ_LEN),
        steps_per_epoch)
    val_data = TensorInput(
        lambda: ptb_producer(data3[1], BATCH, SEQ_LEN),
        (data3[1].shape[0] // BATCH - 1) // SEQ_LEN)

    test_data = TensorInput(
        lambda: ptb_producer(data3[2], BATCH, SEQ_LEN),
        (data3[2].shape[0] // BATCH - 1) // SEQ_LEN)

    M = Model()
    return TrainConfig(
        data=train_data,
        model=M,
        callbacks=[
            ModelSaver(),
            HyperParamSetterWithFunc(
                'learning_rate',
                lambda e, x: x * 0.80 if e > 6 else x),
            RunOp(lambda: M.reset_lstm_state()),
            InferenceRunner(val_data, [ScalarStats(['cost'])]),
            RunOp(lambda: M.reset_lstm_state()),
            InferenceRunner(
                test_data,
                [ScalarStats(['cost'], prefix='test')], tower_name='InferenceTowerTest'),
            RunOp(lambda: M.reset_lstm_state()),
            CallbackFactory(
                trigger=lambda self:
                [self.trainer.monitors.put_scalar(
                    'validation_perplexity',
                    np.exp(self.trainer.monitors.get_latest('validation_cost') / SEQ_LEN)),
                 self.trainer.monitors.put_scalar(
                     'test_perplexity',
                     np.exp(self.trainer.monitors.get_latest('test_cost') / SEQ_LEN))]
            ),
        ],
        max_epoch=70,
    )

if __name__ == '__main__':
    parser = argparse.ArgumentParser()
    parser.add_argument('--gpu', type=int, help='the GPU to use')
    parser.add_argument('--load', help='load model')
    args = parser.parse_args()
    if args.gpu:
        os.environ['CUDA_VISIBLE_DEVICES'] = str(args.gpu)

    config = get_config()
    if args.load:
        config.session_init = SaverRestore(args.load)
    launch_train_with_config(config, SimpleTrainer())


text:
using System.Collections.Generic;
using System.ComponentModel.Composition;
using System.Linq;
using AgentMulder.ReSharper.Domain.Patterns;
using AgentMulder.ReSharper.Domain.Registrations;
using AgentMulder.ReSharper.Domain.Utils;
using JetBrains.ReSharper.Feature.Services.CSharp.StructuralSearch;
using JetBrains.ReSharper.Feature.Services.CSharp.StructuralSearch.Placeholders;
using JetBrains.ReSharper.Feature.Services.StructuralSearch;
using JetBrains.ReSharper.Psi;
using JetBrains.ReSharper.Psi.CSharp.Tree;

namespace AgentMulder.Containers.SimpleInjector.Patterns
{
    [Export("ComponentRegistration", typeof(IRegistrationPattern))]
    public class RegisterAll : RegisterWithService
    {
        private static readonly IStructuralSearchPattern pattern =
            new CSharpStructuralSearchPattern("$container$.RegisterAll($arguments$)",
                new ExpressionPlaceholder("container", "global::SimpleInjector.Container", true),
                new ArgumentPlaceholder("arguments", -1, -1));

        public RegisterAll()
            : base(pattern)
        {
        }

        protected override IEnumerable<IComponentRegistration> FromGenericArguments(IInvocationExpression invocationExpression)
        {
            var serviceType = invocationExpression.TypeArguments.First() as IDeclaredType;
            if (serviceType == null)
            {
                yield break;
            }

            var typeElement = serviceType.GetTypeElement();
            if (typeElement == null)
            {
                yield break;
            }

            IEnumerable<ITypeElement> concreteTypes = invocationExpression.Arguments.SelectMany(argument => argument.Value.GetRegisteredTypes());

            yield return CreateRegistrations(invocationExpression, typeElement, concreteTypes);
        }

        protected override IEnumerable<IComponentRegistration> FromArguments(IInvocationExpression invocationExpression)
        {
            if (invocationExpression.Arguments.Count != 2)
            {
                yield break;
            }

            ICSharpArgument arg1 = invocationExpression.Arguments.First();

            ITypeElement typeElement = arg1.With(f => f.Value as ITypeofExpression)
                                           .With(f => f.ArgumentType as IDeclaredType)
                                           .With(f => f.GetTypeElement());
            if (typeElement == null)
            {
                yield break;
            }

            ICSharpArgument arg2 = invocationExpression.Arguments.Last();
            IEnumerable<ITypeElement> concreteTypes = arg2.With(f => f.Value)
                                                          .With(f => f.GetRegisteredTypes()).ToList();

            if (concreteTypes.Any())
            {
                yield return CreateRegistrations(invocationExpression, typeElement, concreteTypes);
            }
        }

        private static IComponentRegistration CreateRegistrations(IInvocationExpression invocationExpression, ITypeElement serviceType, IEnumerable<ITypeElement> concreteTypes)
        {
            return new TypesBasedOnRegistration(concreteTypes, new ServiceRegistration(invocationExpression, serviceType));
        }
    }
}


text:
//
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//

#if 0
/**** Generated Based on d:\ProjectK\src\InternalApis\Version\buildnumber.settings.targets
Bizarely enough, you can't put comments in this file (without the #if) -
because ndp\clr\src\Tools\applaunch preprocesses it into a perl script *****/
#endif
#define ProjectNMajorVersion   1
#define ProjectNMinorVersion   0
#define ProjectNMajorVersion_A "1"
#define ProjectNMinorVersion_A "0"
#define BuildNumberMajor       22220
#define BuildNumberMinor       0
#define BuildNumberMajor_A     "22220"
#define BuildNumberMinor_A     "00"
#define BuildNumbers_A         "22220.00"
#define BuildNumbers_T         TEXT("22220.00")

#define NDPBuildNumberMajor   22220
#define NDPBuildNumberMinor   0
#define NDPBuildNumbers_A     "22220.00"
#define NDPBuildNumbers_T     TEXT("22220.00")

#define NDPFileVersionMinor   5
#define NDPFileVersionBuild   22220
#define NDPFileVersionRevision   0

#define NDPFileVersionMinor_A     "5"
#define NDPFileVersionBuild_A     "22220"
#define NDPFileVersionRevision_A     "00"
#define PROJECTN_VER_FILEVERSION_STR   ProjectNMajorVersion_A "." NDPFileVersionMinor_A "." NDPFileVersionBuild_A "." NDPFileVersionRevision_A
#define PROJECTN_VER_LEGALCOPYRIGHT_LOGO_STR "Copyright (c) Microsoft Corporation.  All rights reserved."


text:
package org.apache.nifi.processor.annotation;

import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
import java.lang.annotation.Inherited;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

/**
 * Marker annotation a processor implementation can use to indicate that the
 * processor is not thread safe for concurrent execution of its onTrigger()
 * method. By default processors are assumed to be thread safe for concurrent
 * execution.
 *
 * @author none
 */
@Documented
@Target({ElementType.TYPE})
@Retention(RetentionPolicy.RUNTIME)
@Inherited
public @interface TriggerSerially {
}


text:
#ifndef _LOGLOSS_H__
#define _LOGLOSS_H__

#include <shogun/lib/config.h>

#include <shogun/loss/LossFunction.h>

namespace shogun
{
/**@brief CLogLoss implements the logarithmic loss
 * function.
 */
class CLogLoss: public CLossFunction
{
public:
	/**
	 * Constructor
	 */
	CLogLoss(): CLossFunction() {};

	/**
	 * Destructor
	 */
	~CLogLoss() {};

	/**
	 * Get loss for an example
	 *
	 * @param z where to evaluate the loss
	 *
	 * @return loss
	 */
	float64_t loss(float64_t z);

	/**
	 * Get first derivative of the loss function
	 *
	 * @param z where to evaluate the derivative of the loss
	 *
	 * @return first derivative
	 */
	virtual float64_t first_derivative(float64_t z);

	/**
	 * Get second derivative of the loss function
	 *
	 * @param z where to evaluate the second derivative of the loss
	 *
	 * @return second derivative
	 */
	virtual float64_t second_derivative(float64_t z);

	/**
	 * Get importance aware weight update for this loss function
	 *
	 * @param prediction prediction
	 * @param label label
	 * @param eta_t learning rate at update number t
	 * @param norm scale value
	 *
	 * @return update
	 */
	virtual float64_t get_update(float64_t prediction, float64_t label, float64_t eta_t, float64_t norm);

	/**
	 * Get square of gradient, used for adaptive learning
	 *
	 * @param prediction prediction
	 * @param label label
	 *
	 * @return square of gradient
	 */
	virtual float64_t get_square_grad(float64_t prediction, float64_t label);

	/**
	 * Return loss type
	 *
	 * @return L_LOGLOSS
	 */
	virtual ELossType get_loss_type() { return L_LOGLOSS; }

	virtual const char* get_name() const { return "LogLoss"; }
};

}

#endif


text:
using namespace gpos;
using namespace gpdxl;

//---------------------------------------------------------------------------
//	@function:
//		CDXLPhysicalWindow::CDXLPhysicalWindow
//
//	@doc:
//		Ctor
//
//---------------------------------------------------------------------------
CDXLPhysicalWindow::CDXLPhysicalWindow(CMemoryPool *mp,
									   ULongPtrArray *part_by_colid_array,
									   CDXLWindowKeyArray *window_key_array)
	: CDXLPhysical(mp),
	  m_part_by_colid_array(part_by_colid_array),
	  m_dxl_window_key_array(window_key_array)
{
	GPOS_ASSERT(nullptr != m_part_by_colid_array);
	GPOS_ASSERT(nullptr != m_dxl_window_key_array);
}

//---------------------------------------------------------------------------
//	@function:
//		CDXLPhysicalWindow::~CDXLPhysicalWindow
//
//	@doc:
//		Dtor
//
//---------------------------------------------------------------------------
CDXLPhysicalWindow::~CDXLPhysicalWindow()
{
	m_part_by_colid_array->Release();
	m_dxl_window_key_array->Release();
}

//---------------------------------------------------------------------------
//	@function:
//		CDXLPhysicalWindow::GetDXLOperator
//
//	@doc:
//		Operator type
//
//---------------------------------------------------------------------------
Edxlopid
CDXLPhysicalWindow::GetDXLOperator() const
{
	return EdxlopPhysicalWindow;
}

//---------------------------------------------------------------------------
//	@function:
//		CDXLPhysicalWindow::GetOpNameStr
//
//	@doc:
//		Operator name
//
//---------------------------------------------------------------------------
const CWStringConst *
CDXLPhysicalWindow::GetOpNameStr() const
{
	return CDXLTokens::GetDXLTokenStr(EdxltokenPhysicalWindow);
}

//---------------------------------------------------------------------------
//	@function:
//		CDXLPhysicalWindow::UlPartCols
//
//	@doc:
//		Returns the number of partition columns
//
//---------------------------------------------------------------------------
ULONG
CDXLPhysicalWindow::PartByColsCount() const
{
	return m_part_by_colid_array->Size();
}

//---------------------------------------------------------------------------
//	@function:
//		CDXLPhysicalWindow::UlWindowKeys
//
//	@doc:
//		Returns the number of window keys
//
//---------------------------------------------------------------------------
ULONG
CDXLPhysicalWindow::WindowKeysCount() const
{
	return m_dxl_window_key_array->Size();
}

//---------------------------------------------------------------------------
//	@function:
//		CDXLPhysicalWindow::PdxlWindowKey
//
//	@doc:
//		Return the window key at a given position
//
//---------------------------------------------------------------------------
CDXLWindowKey *
CDXLPhysicalWindow::GetDXLWindowKeyAt(ULONG position) const
{
	GPOS_ASSERT(position <= m_dxl_window_key_array->Size());
	return (*m_dxl_window_key_array)[position];
}

//---------------------------------------------------------------------------
//	@function:
//		CDXLPhysicalWindow::SerializeToDXL
//
//	@doc:
//		Serialize operator in DXL format
//
//---------------------------------------------------------------------------
void
CDXLPhysicalWindow::SerializeToDXL(CXMLSerializer *xml_serializer,
								   const CDXLNode *dxlnode) const
{
	const CWStringConst *element_name = GetOpNameStr();

	xml_serializer->OpenElement(
		CDXLTokens::GetDXLTokenStr(EdxltokenNamespacePrefix), element_name);

	// serialize partition keys
	CWStringDynamic *part_by_cols_str =
		CDXLUtils::Serialize(m_mp, m_part_by_colid_array);
	xml_serializer->AddAttribute(CDXLTokens::GetDXLTokenStr(EdxltokenPartKeys),
								 part_by_cols_str);
	GPOS_DELETE(part_by_cols_str);

	// serialize properties
	dxlnode->SerializePropertiesToDXL(xml_serializer);

	// serialize children
	dxlnode->SerializeChildrenToDXL(xml_serializer);

	// serialize the list of window keys
	const CWStringConst *window_keys_list_str =
		CDXLTokens::GetDXLTokenStr(EdxltokenWindowKeyList);
	xml_serializer->OpenElement(
		CDXLTokens::GetDXLTokenStr(EdxltokenNamespacePrefix),
		window_keys_list_str);
	const ULONG size = m_dxl_window_key_array->Size();
	for (ULONG ul = 0; ul < size; ul++)
	{
		CDXLWindowKey *window_key_dxlnode = (*m_dxl_window_key_array)[ul];
		window_key_dxlnode->SerializeToDXL(xml_serializer);
	}
	xml_serializer->CloseElement(
		CDXLTokens::GetDXLTokenStr(EdxltokenNamespacePrefix),
		window_keys_list_str);

	xml_serializer->CloseElement(
		CDXLTokens::GetDXLTokenStr(EdxltokenNamespacePrefix), element_name);
}

#ifdef GPOS_DEBUG
//---------------------------------------------------------------------------
//	@function:
//		CDXLPhysicalWindow::AssertValid
//
//	@doc:
//		Checks whether operator node is well-structured
//
//---------------------------------------------------------------------------
void
CDXLPhysicalWindow::AssertValid(const CDXLNode *dxlnode,
								BOOL validate_children) const
{
	// assert proj list and filter are valid
	CDXLPhysical::AssertValid(dxlnode, validate_children);
	GPOS_ASSERT(nullptr != m_part_by_colid_array);
	GPOS_ASSERT(nullptr != m_dxl_window_key_array);
	GPOS_ASSERT(EdxlwindowIndexSentinel == dxlnode->Arity());
	CDXLNode *child_dxlnode = (*dxlnode)[EdxlwindowIndexChild];
	if (validate_children)
	{
		child_dxlnode->GetOperator()->AssertValid(child_dxlnode,
												  validate_children);
	}
}
#endif	// GPOS_DEBUG

// EOF


text:
package cf_mysql_broker
/*
* File Generated by enaml generator
* !!! Please do not edit this file !!!
*/
type CfMysql struct {

	/*Mysql - Descr: Size of the ib_log_file used by innodb, in MB Default: 1024
*/
	Mysql *Mysql `yaml:"mysql,omitempty"`

	/*Broker - Descr: Optional, The ip to be registered with the cf router for the broker. Defaults to the ip of the vm Default: <nil>
*/
	Broker *Broker `yaml:"broker,omitempty"`

	/*ExternalHost - Descr: Host used to register a route for the broker with the router in cf-release via NATS. By registering the broker with Cloud Foundry using this route, and using the router for load balancing, the broker can be horizontally scaled. Domain is typically the same as system domain in cf-release. Default: <nil>
*/
	ExternalHost interface{} `yaml:"external_host,omitempty"`

	/*Host - Descr: Host (DNS) or IP address used by the broker and bound applications to reach the service Default: <nil>
*/
	Host interface{} `yaml:"host,omitempty"`

}


text:
'use strict';

Object.defineProperty(exports, "__esModule", {
  value: true
});
var isFunction = function isFunction(value) {
  return typeof value === 'function';
};

exports.default = function (state) {
  return {
    intent: function intent(script, actions) {
      if (isFunction(actions)) actions = [actions];

      if (isFunction(script) && Array.isArray(actions)) {
        state.intents.push({ script: script, actions: actions });
      }

      return this;
    }
  };
};


text:
	var express = require("express"),
		path = require("path");

// Load config

	global.config = require(path.join(__dirname, "package.json")).config;

// Instantiate Express

	var app = express();

// Configure Express

	// app
  	app.use("/js", express.static(__dirname + "/app/js"));
  	app.use("/partials", express.static(__dirname + "/app/partials"));

	// static resources that don't need compiling
	app.use("/libs", express.static(__dirname + "/assets/libs"));
	app.use("/img", express.static(__dirname + "/assets/img"));
	app.use("/styles", express.static(__dirname + "/assets/styles"));
	app.use("/sounds", express.static(__dirname + "/assets/sounds"));
	app.use("/fonts", express.static(__dirname + "/assets/fonts"));

// Create the http server

	var http = require("http").createServer(app).listen(8080);

// Removing www from URL routes

	app.get("/*", function(req, res, next) {
		if (req.headers.host.match(/^www\./) != null) res.redirect("http://" + req.headers.host.slice(4) + req.url, 301);
		else next();
	});

	app.get('/', function(req,res) { res.sendFile(path.join(__dirname, "/views/index.html")); });


text:
L.S.Slideshow = L.Class.extend({

    statics: {
        CLASSNAME: 'storage-slideshow-active'
    },

    options: {
        delay: 5000,
        autoplay: false
    },

    initialize: function (map, options) {
        this.setOptions(options);
        this.map = map;
        this._id = null;
        var current = null,  // current feature
            self = this;
        try {
            Object.defineProperty(this, 'current', {
                get: function () {
                    if (!current) {
                        var datalayer = this.defaultDatalayer();
                        if (datalayer) {
                            current = datalayer.getFeatureByIndex(0);
                        }
                    }
                    return current;
                },
                set: function (feature) {
                    current = feature;
                }
            });
        }
        catch (e) {
            // Certainly IE8, which has a limited version of defineProperty
        }
        try {
            Object.defineProperty(this, 'next', {
                get: function () {
                    if (!current) {
                        return self.current;
                    }
                    return current.getNext();
                }
            });
        }
        catch (e) {
            // Certainly IE8, which has a limited version of defineProperty
        }
        if  (this.options.autoplay) {
            this.map.onceDatalayersLoaded(function () {
                this.play();
            }, this);
        }
        this.map.on('edit:enabled', function () {
            this.stop();
        }, this);
    },

    setOptions: function (options) {
        L.setOptions(this, options);
        this.timeSpinner();
    },

    defaultDatalayer: function () {
        var datalayer;
        for (var i in this.map.datalayers) {
            if (this.map.datalayers.hasOwnProperty(i)) {
                datalayer = this.map.datalayers[i];
                if (datalayer.isVisible() && datalayer.isBrowsable()) {
                    return datalayer;
                }
            }
        }
    },

    timeSpinner: function () {
        var time = parseInt(this.options.delay, 10);
        if (!time) return;
        var css = 'rotation ' + time / 1000 + 's infinite linear',
            spinners = document.querySelectorAll('.storage-slideshow-toolbox .play .spinner');
        for (var i = 0; i < spinners.length; i++) {
            spinners[i].style.animation = css;
            spinners[i].style['-webkit-animation'] = css;
            spinners[i].style['-moz-animation'] = css;
            spinners[i].style['-o-animation'] = css;
        }
    },

    resetSpinners: function () {
        // Make that animnation is coordinated with user actions
        var spinners = document.querySelectorAll('.storage-slideshow-toolbox .play .spinner'),
            el, newOne;
        for (var i = 0; i < spinners.length; i++) {
            el = spinners[i];
            newOne = el.cloneNode(true);
            el.parentNode.replaceChild(newOne, el);
        }
    },

    play: function () {
        if (this._id) return;
        if (this.map.editEnabled) return;
        L.DomUtil.addClass(document.body, L.S.Slideshow.CLASSNAME);
        this._id = window.setInterval(L.bind(this.loop, this), this.options.delay);
        this.resetSpinners();
        this.loop();
    },

    loop: function () {
        this.current = this.next;
        this.step();
    },

    pause: function () {
        if (this._id) {
            L.DomUtil.removeClass(document.body, L.S.Slideshow.CLASSNAME);
            window.clearInterval(this._id);
            this._id = null;
        }
    },

    stop: function () {
        this.pause();
        this.current = null;
    },

    forward: function () {
        this.pause();
        this.current = this.next;
        this.step();
    },

    backward: function () {
        this.pause();
        if (this.current) {
            this.current = this.current.getPrevious();
        }
        this.step();
    },

    step: function () {
        if(!this.current) {
            this.stop();
            return;
        }
        this.current.zoomTo();
        this.current.view();
    },

    renderToolbox: function (container) {
        var box = L.DomUtil.create('ul', 'storage-slideshow-toolbox'),
            play = L.DomUtil.create('li', 'play', box),
            stop = L.DomUtil.create('li', 'stop', box),
            prev = L.DomUtil.create('li', 'prev', box),
            next = L.DomUtil.create('li', 'next', box);
        L.DomUtil.create('div', 'spinner', play);
        play.title = L._('Start slideshow');
        stop.title = L._('Stop slideshow');
        next.title = L._('Zoom to the next');
        prev.title = L._('Zoom to the previous');
        var toggle = function () {
            if (this._id) this.pause();
            else this.play();
        };
        L.DomEvent.on(play, 'click', L.DomEvent.stop)
                  .on(play, 'click', toggle, this);
        L.DomEvent.on(stop, 'click', L.DomEvent.stop)
                  .on(stop, 'click', this.stop, this);
        L.DomEvent.on(prev, 'click', L.DomEvent.stop)
                  .on(prev, 'click', this.backward, this);
        L.DomEvent.on(next, 'click', L.DomEvent.stop)
                  .on(next, 'click', this.forward, this);
        container.appendChild(box);
        this.timeSpinner();
        return box;
    }

});


text:
<?php
//initialize the session
if (!isset($_SESSION)) {
  session_start();
}
// verify that the user is admin
if ($_SESSION['MM_UserGroup'] != 'Admin') {
    die("No cuenta con permisos suficientes");
}
// ** Logout the current user. **
$logoutAction = $_SERVER['PHP_SELF']."?doLogout=true";
if ((isset($_SERVER['QUERY_STRING'])) && ($_SERVER['QUERY_STRING'] != "")){
  $logoutAction .="&". htmlentities($_SERVER['QUERY_STRING']);
}

AgregarAlumno($_POST['Materia'], $_POST['DNI'], $_POST['Apellido'], $_POST['Nombre'] );

function Modificarlista($IdMateria, $dni, $apellido, $nombre)

$setencia = "update";
?>


text:
//
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.5-b10
// See http://java.sun.com/xml/jaxb
// Any modifications to this file will be lost upon recompilation of the source schema.
// Generated on: 2015.06.13 at 03:17:43 PM CST
//

package org.ovirt.engine.api.model;

import java.util.ArrayList;
import java.util.List;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlType;

/**
 *
Java class for BlockStatistic complex type.
 *
 *
The following schema fragment specifies the expected content contained within this class.
 *
 *

 * <complexType name="BlockStatistic">
 *   <complexContent>
 *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
 *       <sequence>
 *         <element ref="{}statistic" maxOccurs="unbounded" minOccurs="0"/>
 *       </sequence>
 *     </restriction>
 *   </complexContent>
 * </complexType>
 *

 *
 *
 */
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "BlockStatistic", propOrder = {
    "statistic"
})
public class BlockStatistic {

    protected List<Statistic> statistic;

    /**
     * Gets the value of the statistic property.
     *
     *

     * This accessor method returns a reference to the live list,
     * not a snapshot. Therefore any modification you make to the
     * returned list will be present inside the JAXB object.
     * This is why there is not a set method for the statistic property.
     *
     *

     * For example, to add a new item, do as follows:
     *

     *    getStatistic().add(newItem);
     *

     *
     *
     *

     * Objects of the following type(s) are allowed in the list
     * {@link Statistic }
     *
     *
     */
    public List<Statistic> getStatistic() {
        if (statistic == null) {
            statistic = new ArrayList<Statistic>();
        }
        return this.statistic;
    }

    public boolean isSetStatistic() {
        return ((this.statistic!= null)&&(!this.statistic.isEmpty()));
    }

    public void unsetStatistic() {
        this.statistic = null;
    }

}


text:
package systemcharts

import (
	"context"

	catalog "github.com/rancher/rancher/pkg/apis/catalog.cattle.io/v1"
	"github.com/rancher/rancher/pkg/controllers/dashboard/chart"
	"github.com/rancher/rancher/pkg/features"
	namespace "github.com/rancher/rancher/pkg/namespace"
	"github.com/rancher/rancher/pkg/settings"
	"github.com/rancher/rancher/pkg/wrangler"
	corecontrollers "github.com/rancher/wrangler/pkg/generated/controllers/core/v1"
	"github.com/rancher/wrangler/pkg/relatedresource"
	"github.com/sirupsen/logrus"
	"k8s.io/apimachinery/pkg/api/errors"
	apierror "k8s.io/apimachinery/pkg/api/errors"
	"k8s.io/apimachinery/pkg/runtime"
)

const (
	repoName = "rancher-charts"
)

func Register(ctx context.Context, wContext *wrangler.Context) error {
	h := &handler{
		manager:      wContext.SystemChartsManager,
		namespaces:   wContext.Core.Namespace(),
		chartsConfig: chart.RancherConfigGetter{ConfigCache: wContext.Core.ConfigMap().Cache()},
	}

	wContext.Catalog.ClusterRepo().OnChange(ctx, "bootstrap-charts", h.onRepo)
	relatedresource.WatchClusterScoped(ctx, "bootstrap-charts", func(namespace, name string, obj runtime.Object) ([]relatedresource.Key, error) {
		return []relatedresource.Key{{
			Name: repoName,
		}}, nil
	}, wContext.Catalog.ClusterRepo(), wContext.Mgmt.Feature())
	return nil
}

type handler struct {
	manager      chart.Manager
	namespaces   corecontrollers.NamespaceController
	chartsConfig chart.RancherConfigGetter
}

func (h *handler) onRepo(key string, repo *catalog.ClusterRepo) (*catalog.ClusterRepo, error) {
	if repo == nil || repo.Name != repoName {
		return repo, nil
	}

	systemGlobalRegistry := map[string]interface{}{
		"cattle": map[string]interface{}{
			"systemDefaultRegistry": settings.SystemDefaultRegistry.Get(),
		},
	}
	for _, chartDef := range h.getChartsToInstall() {
		if chartDef.Enabled != nil && !chartDef.Enabled() {
			continue
		}

		if chartDef.Uninstall {
			if err := h.manager.Uninstall(chartDef.ReleaseNamespace, chartDef.ChartName); err != nil {
				return repo, err
			}
			if chartDef.RemoveNamespace {
				if err := h.namespaces.Delete(chartDef.ReleaseNamespace, nil); err != nil && !errors.IsNotFound(err) {
					return repo, err
				}
			}
			continue
		}

		values := map[string]interface{}{
			"global": systemGlobalRegistry,
		}
		if chartDef.Values != nil {
			for k, v := range chartDef.Values() {
				values[k] = v
			}
		}
		if err := h.manager.Ensure(chartDef.ReleaseNamespace, chartDef.ChartName, chartDef.MinVersionSetting.Get(), values, false); err != nil {
			return repo, err
		}
	}

	return repo, nil
}

func (h *handler) getChartsToInstall() []*chart.Definition {
	return []*chart.Definition{
		{
			ReleaseNamespace:  namespace.System,
			ChartName:         "rancher-webhook",
			MinVersionSetting: settings.RancherWebhookMinVersion,
			Values: func() map[string]interface{} {
				values := map[string]interface{}{
					"capi": map[string]interface{}{
						"enabled": features.EmbeddedClusterAPI.Enabled(),
					},
					"mcm": map[string]interface{}{
						"enabled": features.MCM.Enabled(),
					},
				}
				// add priority class value.
				if priorityClassName, err := h.chartsConfig.GetPriorityClassName(); err != nil {
					if !apierror.IsNotFound(err) {
						logrus.Warnf("Failed to get rancher priorityClassName for 'rancher-webhook': %v", err)
					}
				} else {
					values[chart.PriorityClassKey] = priorityClassName
				}
				return values
			},
			Enabled: func() bool {
				return features.MCM.Enabled() || features.EmbeddedClusterAPI.Enabled()
			},
		},
		{
			ReleaseNamespace: "rancher-operator-system",
			ChartName:        "rancher-operator",
			Uninstall:        true,
			RemoveNamespace:  true,
		},
	}
}


text:
${ _('Background Layer') }

${ _('WMS Layer') }

${ _('Vector Layer') }


text:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

    <meta content="text/html; charset=utf-8" http-equiv="Content-type">
    <title>Firediff Test</title>
    <link href="external.css" rel="stylesheet" type="text/css">

        Text Value

Test InnerHTML

Test


text:
module CleanBsmartCatalog
  VERSION = "0.0.1"
end


text:
<!DOCTYPE html>

    <meta charset="UTF-8">
    <title>Tryit Editor</title>

                    <button title="Vertically" onclick="restack(false)" id="stackV">Vertical</button>
                    <button title="Horizontally"  onclick="restack(true)" id="stackH">Horizontal</button>
                    <button class="run" type="button" onclick="submitTryit()">Run »</button>

  						<input type="checkbox" id="myswitch" checked>

                    <textarea autocomplete="off" class="code_input" id="textareaCode" wrap="logical" spellcheck="false"><!DOCTYPE html>

  <meta charset="UTF-8">

我设置了 float: left; width: 200px;

正正正正正正正正正正正正正正正正正正正正正正正正正正正正正正正正正正正正正正正正正正正正正正正正正
    正正正正正正正正正正正正正正正正正正正正正正正正

<button onclick="cf()">点击触发BFC</button>

</textarea>
                    <form autocomplete="off" style="margin:0px;display:none;">
                        <input type="hidden" name="code" id="code" />
                        <input type="hidden" id="bt" name="bt" />
                    </form>

Result:


text:
int mainloop( Map &world, SDL_Surface **screen );

int main(int argc, char **argw){
  string mapfolder, mapfile;
  SDL_Surface *screen = NULL;

  settings.load_settings("./gobblashx.conf");

  Map world;

  SDL_Init( SDL_INIT_VIDEO );
  prepare_graphics( &screen );

  cliprectworld.w = settings.screen_w;
  cliprectmenu.x = cliprectworld.x + cliprectworld.w;
  cliprectmenu.w = settings.screen_w - cliprectmenu.x;
  cliprectmenu.y = cliprectworld.y;
  cliprectmenu.h = cliprectworld.h;

  if (argc == 1){
    mapfolder = "maps/";
    mapfile = "first.map";
  }
  else if (argc == 2){
    int ls = -1; //lastslash
    int ts = 0; //testslash
    string arg = argw[1];
    while( arg[ts] != '\0'){
      ts ++;
      if (arg[ts] == '/')
        ls = ts;
    }
    if (ls == -1){
      mapfolder = "./";
      mapfile = arg;
    }
    else{
      mapfolder = arg.substr(0, ls + 1);
      mapfile = arg.substr(ls +1, arg.size() - ls);
    }

    printf("mapfolder:%s\n", mapfolder.c_str());
    printf("mapfile:%s\n", mapfile.c_str());
  }
  else {
    printf("Wrong number of arguments!\n");
    exit(1);
  }
  editor = new Editor(&screen, world, mapfolder, mapfile);
  game = new Game;
  game->set_aitools(&world);
  if (world.load_mapfile((mapfolder + mapfile).c_str(), &screen,
                         game->aitools)){
    printf("Failed to load map!\n");
    exit(1);
  }

  game->set_world(&world);

  settings.follow_hero = false;
  mainloop( world, &screen );

  end_graphics( &screen );
  world.free_map();
  SDL_Quit();

  return 0;
}

int mainloop( Map &world, SDL_Surface **screen )
{
  int i;

  while(not editor->quit)
    {
      game->wait_until_next_frame();
      if (editor->gamecontrollers == true){
        game->get_input();
      }
      else{
        editor->get_input();
      }
      if (not game->paused){
        for(i = 0; i <= world.get_fxfield_max(); i++){
          if (world.fxfield[i] != NULL){
            world.unregister_fxfield( world.fxfield[i] );
            world.fxfield[i]->lifetime --;
            if (world.fxfield[i]->lifetime < 0){
              delete world.fxfield[i];
              world.fxfield[i] = NULL;
            }
            else{
              world.register_fxfield( world.fxfield[i] );
            }
          }
        }
        if (editor->creatures_think){
          for(i = 0; i <= world.get_creature_max(); i++){
            if (not world.creature[i]->dead){
              if (world.creature[i]->safe > 0)
                world.creature[i]->safe --;
              world.creature[i]->think();
            }
          }
        }
        if (editor->gravity){
          gravity(world);
          physics(world);
        }
        checkfxfields(world);
      } // fi not game->paused

      SDL_SetClipRect(*screen, &cliprectmenu);

      editor->paint_menu( screen );
      paint_world( world, screen );
      editor->paint_message( screen );
      SDL_Flip( *screen );

      game->next_frame();
    }

  printf("fps:%f\n", game->get_fps());
  return 0;
}


text:
using System.Collections.Generic;
using System.Globalization;
using BEPUutilities;

namespace BEPUphysics.DataStructures
{
    ///<summary>
    /// Acceleration structure of triangles surrounded by axis aligned bounding boxes, supporting various speedy queries.
    ///</summary>
    public class MeshBoundingBoxTree
    {
        MeshBoundingBoxTreeData data;

        /// <summary>
        /// Gets the bounding box surrounding the tree.
        /// </summary>
        public BoundingBox BoundingBox
        {
            get
            {
                if (root != null)
                    return root.BoundingBox;
                else
                    return new BoundingBox();
            }
        }

        Node root;

        /// <summary>
        /// Gets or sets the data used to construct the tree.
        /// When set, the tree will be reconstructed.
        /// </summary>
        public MeshBoundingBoxTreeData Data
        {
            get
            {
                return data;
            }
            set
            {
                this.data = value;
                Reconstruct();
            }
        }

        /// <summary>
        /// Constructs a new tree.
        /// </summary>
        /// <param name="data">Data to use to construct the tree.</param>
        public MeshBoundingBoxTree(MeshBoundingBoxTreeData data)
        {
            Data = data;
        }

        /// <summary>
        /// Reconstructs the tree based on the current data.
        /// </summary>
        public void Reconstruct()
        {
            root = null;
            for (int i = 0; i < data.indices.Length; i += 3)
            {
                //Use a permuted version of the triangles instead of the actual triangle list.
                //Permuting makes the input basically random, improving the quality of the tree.
                Insert((int)(((982451653L * (i / 3)) % (data.indices.Length / 3)) * 3));
            }
        }

        /// <summary>
        /// Refits the tree based on the current data.
        /// This process is cheaper to perform than a reconstruction when the topology of the mesh
        /// does not change.
        /// </summary>
        public void Refit()
        {
            if (root != null)
                root.Refit(data);
        }

        void Analyze(out List<int> depths, out int minDepth, out int maxDepth, out int nodeCount)
        {
            depths = new List<int>();
            nodeCount = 0;
            root.Analyze(depths, 0, ref nodeCount);

            maxDepth = 0;
            minDepth = int.MaxValue;
            for (int i = 0; i < depths.Count; i++)
            {
                if (depths[i] > maxDepth)
                    maxDepth = depths[i];
                if (depths[i] < minDepth)
                    minDepth = depths[i];
            }
        }

        void Insert(int triangleIndex)
        {
            //Insertions can easily be performed stacklessly.
            //Only one path is chosen at each step and nothing is returned, so the history of the 'recursion' is completely forgotten.

            var node = new LeafNode(triangleIndex, data);
            if (root == null)
            {
                //Empty tree.  This is the first and only node.
                root = node;
            }
            else
            {
                if (root.IsLeaf) //Root is alone.
                    root.TryToInsert(node, out root);
                else
                {
                    //The caller is responsible for the merge.
                    BoundingBox.CreateMerged(ref node.BoundingBox, ref root.BoundingBox, out root.BoundingBox);
                    Node treeNode = root;
                    while (!treeNode.TryToInsert(node, out treeNode)) ;//TryToInsert returns the next node, if any, and updates node bounding box.
                }
            }
        }

        /// <summary>
        /// Gets the triangles whose bounding boxes are overlapped by the query.
        /// </summary>
        /// <param name="boundingBox">Shape to query against the tree.</param>
        /// <param name="outputOverlappedElements">Indices of triangles in the index buffer with bounding boxes which are overlapped by the query.</param>
        /// <returns>Whether or not any elements were overlapped.</returns>
        public bool GetOverlaps(BoundingBox boundingBox, IList<int> outputOverlappedElements)
        {
            if (root != null)
            {
                bool intersects;
                root.BoundingBox.Intersects(ref boundingBox, out intersects);
                if (intersects)
                    root.GetOverlaps(ref boundingBox, outputOverlappedElements);
            }
            return outputOverlappedElements.Count > 0;
        }

        /// <summary>
        /// Gets the triangles whose bounding boxes are overlapped by the query.
        /// </summary>
        /// <param name="boundingSphere">Shape to query against the tree.</param>
        /// <param name="outputOverlappedElements">Indices of triangles in the index buffer with bounding boxes which are overlapped by the query.</param>
        /// <returns>Whether or not any elements were overlapped.</returns>
        public bool GetOverlaps(BoundingSphere boundingSphere, IList<int> outputOverlappedElements)
        {
            if (root != null)
            {
                bool intersects;
                root.BoundingBox.Intersects(ref boundingSphere, out intersects);
                if (intersects)
                    root.GetOverlaps(ref boundingSphere, outputOverlappedElements);
            }
            return outputOverlappedElements.Count > 0;
        }
        ///// <summary>
        ///// Gets the triangles whose bounding boxes are overlapped by the query.
        ///// </summary>
        ///// <param name="boundingFrustum">Shape to query against the tree.</param>
        ///// <param name="outputOverlappedElements">Indices of triangles in the index buffer with bounding boxes which are overlapped by the query.</param>
        ///// <returns>Whether or not any elements were overlapped.</returns>
        //public bool GetOverlaps(BoundingFrustum boundingFrustum, IList<int> outputOverlappedElements)
        //{
        //    if (root != null)
        //    {
        //        bool intersects;
        //        boundingFrustum.Intersects(ref root.BoundingBox, out intersects);
        //        if (intersects)
        //            root.GetOverlaps(ref boundingFrustum, outputOverlappedElements);
        //    }
        //    return outputOverlappedElements.Count > 0;
        //}
        /// <summary>
        /// Gets the triangles whose bounding boxes are overlapped by the query.
        /// </summary>
        /// <param name="ray">Shape to query against the tree.</param>
        /// <param name="outputOverlappedElements">Indices of triangles in the index buffer with bounding boxes which are overlapped by the query.</param>
        /// <returns>Whether or not any elements were overlapped.</returns>
        public bool GetOverlaps(Ray ray, IList<int> outputOverlappedElements)
        {
            if (root != null)
            {
                float result;
                if (ray.Intersects(ref root.BoundingBox, out result))
                    root.GetOverlaps(ref ray, float.MaxValue, outputOverlappedElements);
            }
            return outputOverlappedElements.Count > 0;
        }
        /// <summary>
        /// Gets the triangles whose bounding boxes are overlapped by the query.
        /// </summary>
        /// <param name="ray">Shape to query against the tree.</param>
        /// <param name="maximumLength">Maximum length of the ray in units of the ray's length.</param>
        /// <param name="outputOverlappedElements">Indices of triangles in the index buffer with bounding boxes which are overlapped by the query.</param>
        /// <returns>Whether or not any elements were overlapped.</returns>
        public bool GetOverlaps(Ray ray, float maximumLength, IList<int> outputOverlappedElements)
        {
            if (root != null)
            {
                float result;
                if (ray.Intersects(ref root.BoundingBox, out result))
                    root.GetOverlaps(ref ray, maximumLength, outputOverlappedElements);
            }
            return outputOverlappedElements.Count > 0;
        }

        abstract class Node
        {
            internal BoundingBox BoundingBox;
            internal abstract void GetOverlaps(ref BoundingBox boundingBox, IList<int> outputOverlappedElements);
            internal abstract void GetOverlaps(ref BoundingSphere boundingSphere, IList<int> outputOverlappedElements);
            //internal abstract void GetOverlaps(ref BoundingFrustum boundingFrustum, IList<int> outputOverlappedElements);
            internal abstract void GetOverlaps(ref Ray ray, float maximumLength, IList<int> outputOverlappedElements);

            internal abstract bool IsLeaf { get; }

            internal abstract bool TryToInsert(LeafNode node, out Node treeNode);

            internal abstract void Analyze(List<int> depths, int depth, ref int nodeCount);

            internal abstract void Refit(MeshBoundingBoxTreeData data);
        }

        sealed class InternalNode : Node
        {
            internal Node ChildA;
            internal Node ChildB;

            internal override bool IsLeaf
            {
                get { return false; }
            }

            internal override void GetOverlaps(ref BoundingBox boundingBox, IList<int> outputOverlappedElements)
            {
                //Users of the GetOverlaps method will have to check the bounding box before calling
                //root.getoverlaps.  This is actually desired in some cases, since the outer bounding box is used
                //to determine a pair, and further overlap tests shouldn't bother retesting the root.
                bool intersects;
                ChildA.BoundingBox.Intersects(ref boundingBox, out intersects);
                if (intersects)
                    ChildA.GetOverlaps(ref boundingBox, outputOverlappedElements);
                ChildB.BoundingBox.Intersects(ref boundingBox, out intersects);
                if (intersects)
                    ChildB.GetOverlaps(ref boundingBox, outputOverlappedElements);
            }

            internal override void GetOverlaps(ref BoundingSphere boundingSphere, IList<int> outputOverlappedElements)
            {
                bool intersects;
                ChildA.BoundingBox.Intersects(ref boundingSphere, out intersects);
                if (intersects)
                    ChildA.GetOverlaps(ref boundingSphere, outputOverlappedElements);
                ChildB.BoundingBox.Intersects(ref boundingSphere, out intersects);
                if (intersects)
                    ChildB.GetOverlaps(ref boundingSphere, outputOverlappedElements);
            }

            //internal override void GetOverlaps(ref BoundingFrustum boundingFrustum, IList<int> outputOverlappedElements)
            //{
            //    bool intersects;
            //    boundingFrustum.Intersects(ref ChildA.BoundingBox, out intersects);
            //    if (intersects)
            //        ChildA.GetOverlaps(ref boundingFrustum, outputOverlappedElements);
            //    boundingFrustum.Intersects(ref ChildB.BoundingBox, out intersects);
            //    if (intersects)
            //        ChildB.GetOverlaps(ref boundingFrustum, outputOverlappedElements);
            //}

            internal override void GetOverlaps(ref Ray ray, float maximumLength, IList<int> outputOverlappedElements)
            {
                float result;
                if (ray.Intersects(ref ChildA.BoundingBox, out result) && result < maximumLength)
                    ChildA.GetOverlaps(ref ray, maximumLength, outputOverlappedElements);
                if (ray.Intersects(ref ChildB.BoundingBox, out result) && result < maximumLength)
                    ChildB.GetOverlaps(ref ray, maximumLength, outputOverlappedElements);
            }

            internal override bool TryToInsert(LeafNode node, out Node treeNode)
            {
                ////The following can make the tree shorter, but it actually hurt query times in testing.
                //bool aIsLeaf = childA.IsLeaf;
                //bool bIsLeaf = childB.IsLeaf;
                //if (aIsLeaf && !bIsLeaf)
                //{
                //    //Just put us with the leaf.  Keeps the tree shallower.
                //    BoundingBox merged;
                //    BoundingBox.CreateMerged(ref childA.BoundingBox, ref node.BoundingBox, out merged);
                //    childA = new InternalNode() { BoundingBox = merged, childA = this.childA, childB = node };
                //    treeNode = null;
                //    return true;
                //}
                //else if (!aIsLeaf && bIsLeaf)
                //{
                //    //Just put us with the leaf.  Keeps the tree shallower.
                //    BoundingBox merged;
                //    BoundingBox.CreateMerged(ref childB.BoundingBox, ref node.BoundingBox, out merged);
                //    childB = new InternalNode() { BoundingBox = merged, childA = node, childB = this.childB };
                //    treeNode = null;
                //    return true;
                //}

                //Since we are an internal node, we know we have two children.
                //Regardless of what kind of nodes they are, figure out which would be a better choice to merge the new node with.

                //Use the path which produces the smallest 'volume.'
                BoundingBox mergedA, mergedB;
                BoundingBox.CreateMerged(ref ChildA.BoundingBox, ref node.BoundingBox, out mergedA);
                BoundingBox.CreateMerged(ref ChildB.BoundingBox, ref node.BoundingBox, out mergedB);

                Vector3 offset;
                float originalAVolume, originalBVolume;
                Vector3.Subtract(ref ChildA.BoundingBox.Max, ref ChildA.BoundingBox.Min, out offset);
                originalAVolume = offset.X * offset.Y * offset.Z;
                Vector3.Subtract(ref ChildB.BoundingBox.Max, ref ChildB.BoundingBox.Min, out offset);
                originalBVolume = offset.X * offset.Y * offset.Z;

                float mergedAVolume, mergedBVolume;
                Vector3.Subtract(ref mergedA.Max, ref mergedA.Min, out offset);
                mergedAVolume = offset.X * offset.Y * offset.Z;
                Vector3.Subtract(ref mergedB.Max, ref mergedB.Min, out offset);
                mergedBVolume = offset.X * offset.Y * offset.Z;

                //Could use factor increase or absolute difference
                if (mergedAVolume - originalAVolume < mergedBVolume - originalBVolume)
                {
                    //merging A produces a better result.
                    if (ChildA.IsLeaf)
                    {
                        ChildA = new InternalNode() { BoundingBox = mergedA, ChildA = this.ChildA, ChildB = node };
                        treeNode = null;
                        return true;
                    }
                    else
                    {
                        ChildA.BoundingBox = mergedA;
                        treeNode = ChildA;
                        return false;
                    }
                }
                else
                {
                    //merging B produces a better result.
                    if (ChildB.IsLeaf)
                    {
                        //Target is a leaf! Return.
                        ChildB = new InternalNode() { BoundingBox = mergedB, ChildA = node, ChildB = this.ChildB };
                        treeNode = null;
                        return true;
                    }
                    else
                    {
                        ChildB.BoundingBox = mergedB;
                        treeNode = ChildB;
                        return false;
                    }
                }

            }

            public override string ToString()
            {
                return "{" + ChildA.ToString() + ", " + ChildB.ToString() + "}";

            }

            internal override void Analyze(List<int> depths, int depth, ref int nodeCount)
            {
                nodeCount++;
                ChildA.Analyze(depths, depth + 1, ref nodeCount);
                ChildB.Analyze(depths, depth + 1, ref nodeCount);
            }

            internal override void Refit(MeshBoundingBoxTreeData data)
            {
                ChildA.Refit(data);
                ChildB.Refit(data);
                BoundingBox.CreateMerged(ref ChildA.BoundingBox, ref ChildB.BoundingBox, out BoundingBox);
            }
        }

        /// <summary>
        /// The tiny extra margin added to leaf bounding boxes that allow the volume cost metric to function properly even in degenerate cases.
        /// </summary>
        public static float LeafMargin = .001f;
        sealed class LeafNode : Node
        {
            int LeafIndex;

            internal override bool IsLeaf
            {
                get { return true; }
            }

            internal LeafNode(int leafIndex, MeshBoundingBoxTreeData data)
            {
                LeafIndex = leafIndex;
                data.GetBoundingBox(leafIndex, out BoundingBox);
                //Having an ever-so-slight margin allows the hierarchy use a volume metric even for degenerate shapes (consider a flat tessellated plane).
                BoundingBox.Max.X += LeafMargin;
                BoundingBox.Max.Y += LeafMargin;
                BoundingBox.Max.Z += LeafMargin;
                BoundingBox.Min.X -= LeafMargin;
                BoundingBox.Min.Y -= LeafMargin;
                BoundingBox.Min.Z -= LeafMargin;
            }

            internal override void GetOverlaps(ref BoundingBox boundingBox, IList<int> outputOverlappedElements)
            {
                //Our parent already tested the bounding box.  All that's left is to add myself to the list.
                outputOverlappedElements.Add(LeafIndex);
            }

            internal override void GetOverlaps(ref BoundingSphere boundingSphere, IList<int> outputOverlappedElements)
            {
                outputOverlappedElements.Add(LeafIndex);
            }

            //internal override void GetOverlaps(ref BoundingFrustum boundingFrustum, IList<int> outputOverlappedElements)
            //{
            //    outputOverlappedElements.Add(LeafIndex);
            //}

            internal override void GetOverlaps(ref Ray ray, float maximumLength, IList<int> outputOverlappedElements)
            {
                outputOverlappedElements.Add(LeafIndex);
            }

            internal override bool TryToInsert(LeafNode node, out Node treeNode)
            {
                var newTreeNode = new InternalNode();
                BoundingBox.CreateMerged(ref BoundingBox, ref node.BoundingBox, out newTreeNode.BoundingBox);
                newTreeNode.ChildA = this;
                newTreeNode.ChildB = node;
                treeNode = newTreeNode;
                return true;
            }

            public override string ToString()
            {
                return LeafIndex.ToString(CultureInfo.InvariantCulture);
            }

            internal override void Analyze(List<int> depths, int depth, ref int nodeCount)
            {
                nodeCount++;
                depths.Add(depth);
            }

            internal override void Refit(MeshBoundingBoxTreeData data)
            {
                data.GetBoundingBox(LeafIndex, out BoundingBox);
                //Having an ever-so-slight margin allows the hierarchy use a volume metric even for degenerate shapes (consider a flat tessellated plane).
                BoundingBox.Max.X += LeafMargin;
                BoundingBox.Max.Y += LeafMargin;
                BoundingBox.Max.Z += LeafMargin;
                BoundingBox.Min.X -= LeafMargin;
                BoundingBox.Min.Y -= LeafMargin;
                BoundingBox.Min.Z -= LeafMargin;
            }
        }

    }

}


text:
<?php

namespace Index\Mailserver;

use Kotchasan\Html;
use Kotchasan\Language;

/**
 * ตั้งค่าระบบอีเมล
 *
 * @author Goragod Wiriya <admin@goragod.com>
 *
 * @since 1.0
 */
class View extends \Gcms\Adminview
{
    /**
     * module=mailserver
     *
     * @param object $config
     *
     * @return string
     */
    public function render($config)
    {
        $form = Html::create('form', array(
            'id' => 'setup_frm',
            'class' => 'setup_frm',
            'autocomplete' => 'off',
            'action' => 'index.php/index/model/mailserver/submit',
            'onsubmit' => 'doFormSubmit',
            'ajax' => true,
            'token' => true,
        ));
        $fieldset = $form->add('fieldset', array(
            'title' => '{LNG_General}',
        ));
        // noreply_email
        $fieldset->add('text', array(
            'id' => 'noreply_email',
            'labelClass' => 'g-input icon-email',
            'itemClass' => 'item',
            'label' => '{LNG_noreply email}',
            'comment' => '{LNG_Email addresses for sender and do not reply such as no-reply@domain.tld}',
            'placeholder' => 'no-reply@domain.tld',
            'maxlength' => 255,
            'value' => isset($config->noreply_email) ? $config->noreply_email : self::$cfg->noreply_email,
        ));
        // email_charset
        $fieldset->add('text', array(
            'id' => 'email_charset',
            'labelClass' => 'g-input icon-language',
            'itemClass' => 'item',
            'label' => '{LNG_Email encoding}',
            'comment' => '{LNG_Specify the language code of the email, as utf-8}',
            'value' => isset($config->email_charset) ? $config->email_charset : self::$cfg->email_charset,
        ));
        // email_use_phpMailer
        $fieldset->add('select', array(
            'id' => 'email_use_phpMailer',
            'labelClass' => 'g-input icon-host',
            'itemClass' => 'item',
            'label' => '{LNG_Mail program}',
            'comment' => '{LNG_Set the application for send an email}',
            'options' => Language::get('MAIL_PROGRAMS'),
            'value' => isset($config->email_use_phpMailer) ? $config->email_use_phpMailer : self::$cfg->email_use_phpMailer,
        ));
        // ตั้งค่า mail server
        $fieldset = $form->add('fieldset', array(
            'title' => '{LNG_Mail server settings}',
        ));
        // email_Host
        $fieldset->add('text', array(
            'id' => 'email_Host',
            'labelClass' => 'g-input icon-world',
            'itemClass' => 'item',
            'label' => '{LNG_Mail server}',
            'placeholder' => 'localhost',
            'comment' => '{LNG_The name of the mail server as localhost or smtp.gmail.com (To change the settings of your email is the default. To remove this box entirely.)}',
            'value' => isset($config->email_Host) ? $config->email_Host : self::$cfg->email_Host,
        ));
        // email_Port
        $fieldset->add('number', array(
            'id' => 'email_Port',
            'labelClass' => 'g-input icon-config',
            'itemClass' => 'item',
            'label' => '{LNG_Port}',
            'comment' => '{LNG_Mail server port number (default is 25, for GMail used 465, 587 for DirectAdmin).}',
            'value' => isset($config->email_Port) ? $config->email_Port : self::$cfg->email_Port,
        ));
        // email_SMTPAuth
        $fieldset->add('select', array(
            'id' => 'email_SMTPAuth',
            'labelClass' => 'g-input icon-verfied',
            'itemClass' => 'item',
            'label' => '{LNG_Authentication require}',
            'comment' => '{LNG_How to define user authentication for mail servers. If you enable it, you must configure below correctly.}',
            'options' => Language::get('BOOLEANS'),
            'value' => isset($config->email_SMTPAuth) ? $config->email_SMTPAuth : self::$cfg->email_SMTPAuth,
        ));
        // email_SMTPSecure
        $fieldset->add('select', array(
            'id' => 'email_SMTPSecure',
            'labelClass' => 'g-input icon-config',
            'itemClass' => 'item',
            'label' => '{LNG_SSL support}',
            'comment' => '{LNG_Enable SSL encryption for sending email}',
            'options' => Language::get('SMTPSECURIES'),
            'value' => isset($config->email_SMTPSecure) ? $config->email_SMTPSecure : self::$cfg->email_SMTPSecure,
        ));
        // email_Username
        $fieldset->add('text', array(
            'id' => 'email_Username',
            'labelClass' => 'g-input icon-user',
            'itemClass' => 'item',
            'label' => '{LNG_Username}',
            'comment' => '{LNG_Username of the mail server} ({LNG_To change it, enter a new value})',
            'value' => isset($config->email_Username) ? $config->email_Username : self::$cfg->email_Username,
        ));
        // email_Password
        $fieldset->add('text', array(
            'id' => 'email_Password',
            'labelClass' => 'g-input icon-password',
            'itemClass' => 'item',
            'label' => '{LNG_Password}',
            'comment' => '{LNG_Password of the mail server} ({LNG_To change it, enter a new value})',
        ));
        $fieldset = $form->add('fieldset', array(
            'class' => 'submit',
        ));
        // submit
        $fieldset->add('submit', array(
            'class' => 'button save large icon-save',
            'value' => '{LNG_Save}',
        ));
        $form->script('initMailserver();');
        return $form->render();
    }
}


text:
    <!-- Bootstrap core CSS -->
    <link href="../../lib/bootstrap/css/bootstrap.min.css" rel="stylesheet">
    <!-- font awesome CSS -->
    <link rel="stylesheet" href="../../lib/font-awesome-4.3.0/css/font-awesome.min.css">

    <!-- Custom styles for this template -->
    <link href="../../blocks/dist/css/bootCommerce.min.css" rel="stylesheet">

    <!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
    <!--[if lt IE 9]>
      <script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
      <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
    <![endif]-->


text:
"""
    fabcloudkit

    :copyright: (c) 2013 by Rick Bohrer.
    :license: BSD, see LICENSE for more details.
"""
from __future__ import absolute_import

# pypi
from fabric.operations import sudo

# package
from fabcloudkit import ctx
from .internal import *
from .toolbase import *

class Provisioner(object):
    def __init__(self, role):
        self._role = role

    def execute(self):
        start_msg('Provisioning instance in role "{0}":'.format(self._role.name))
        spec = self._role.get('provision', None)
        if not spec:
            succeed_msg('Nothing to provision.')
            return

        self._create_dirs()
        for tool_def in spec:
            Tool.execute(tool_def.keys()[0], tool_def.values()[0])
        succeed_msg('Provisioning completed successfully for role "{0}".'.format(self._role.name))

    def _create_dirs(self):
        # repos directory.
        result = sudo('mkdir -p -m 0777 {0}'.format(ctx().repos_root()))
        if result.failed:
            HaltError('Unable to create root directory for repo storage.')

        # builds directory.
        result = sudo('mkdir -p -m 0777 {0}'.format(ctx().builds_root()))
        if result.failed:
            HaltError('Unable to create root directory for builds.')


text:
"""Exceptions raised by the emrcontainers service."""
from moto.core.exceptions import JsonRESTError

class ResourceNotFoundException(JsonRESTError):
    code = 400

    def __init__(self, resource):
        super().__init__("ResourceNotFoundException", resource)


text:
<?xml version="1.0" encoding="UTF-8"?>
<content>
    <component name="subscriptions" class="Energine\mail\components\MailSubscriptionList">
        <params>
            <param name="rights">2</param>
			<param name="active">1</param>
        </params>
    </component>
</content>


text:
function configure_module_lists {
    cd ${git_bp}/src

    feature_file_list=$(find . -name "feature.xml")

    feature_modules=$(find . -name "feature.xml" | sed 's|/feature.xml||' | sed 's|./||')

    for feature in ${feature_file_list}; do
        plugins=$(sed -n '/<plugin/{:start /\/>/!{N;b start};/plugin\s*id=/p}' ${feature} | awk -F"id=" '{printf("%s\n", $2)}' | sed '/^\s*$/d' | sed s/\"// | sed s/\"//)
        plugins="$(echo $plugins | tr -d '\r')"
        plugin_modules="${plugins} ${plugin_modules} "
    done
}

# The jar_distribution function creates a jar file for every package that
# will be delivered
function jar_distribution {
	echo -e "Entering create_bp_release.sh::jar_distribution"

    cd ${git_bp}/src

    echo -e "Creating a jar of each project"

    for module in ${plugin_modules}; do
        if [ -d "${module}/src" ]; then
            echo -e "  Creating jar for ${module}"
            cd ${module}/src
            # First copy all files other than .java from the src to the bin
            echo -e "    Ready to loop to find files to package."
            file_list=$(find . -path "*.java"  -prune -o -print | sed s/.*gitignore// | sed '/^\s*$/d')
            echo -e "    The files are: ${file_list}"
            for file in ${file_list}; do
                echo -e "    Found file ${file}"
                if [ ! -d ${file} ]; then
                    mod_dir=`dirname ${file}`
                    echo -e "      mod_dir=${mod_dir}"
                    echo -e "      Copying $file to ${git_bp}/src/${module}/bin/${mod_dir}"
                    cp $file ${git_bp}/src/${module}/bin/${mod_dir}
                fi
                echo -e "      ready to look for next file"
            done
            echo -e "    Finished looping."

            cd ${git_bp}/src/${module}/bin

            jar_name=`grep -e "^source.*jar =" ../build.properties | awk '/^source/,/ =/ { sub("source.", ""); print $1;}' -`
            echo -e "    jar file name is ${jar_name}"
            jar -cvf ${jar_name} . > ${pkg_log_dir}/${jar_name}.log 2>&1
            echo -e "    Finished creating jar file."
        else
            echo -e "  Skipping jar creation for ${module}"
        fi

        cd ${git_bp}/src
    done
	echo -e "Exiting create_bp_release.sh::jar_distribution"
}

# The zip_distribution function creates a zip file that can later be
# unzipped into the plugin directory of an eclipse installation
function zip_distribution {
	echo -e "Entering create_bp_release.sh::zip_distribution"
    jar_distribution

    cd ${git_bp}/src

    echo -e "Zipping the distribution"

    for module in ${plugin_modules}; do
        module_release_version="${release_version}"

        # If MANIFEST.MF or plugin.xml file exists, get plugin version from there
        if [ -e ${module}/META-INF/MANIFEST.MF ]; then
            module_release_version=$(awk -F": " '{if (/[0-9]\.[0-9]\.[0-9]/) {print $2; exit;}}' ${module}/META-INF/MANIFEST.MF)
            module_release_version="$(echo ${module_release_version} | tr -d '\r')"
            echo -e "Extracted version ${module_release_version} from MANIFEST.MF"
        elif [ -e ${module}/plugin.xml ]; then
            module_release_version=$(awk -F"\"" '{if (/ersion.*\=.*[0-9]\.[0-9]\.[0-9]/) {print $2; exit;}}' ${module}/plugin.xml | sed '/^\s*$/d')
            echo -e "Extracted version ${module_release_version} from plugin.xml"
        fi

        echo -e "  Zipping ${module} (${module_release_version})"

        # Update the timestamp in the build ID
        if [ -e ${module}/about.mappings ]; then
            internal_version=""
            if [ "${branch}" != "master" ]; then
                internal_version="${branch}"
            fi
            echo -e "0=${module_release_version} ${internal_version}\n1=${timestamp}\n" > ${module}/about.mappings
        fi

        mkdir -p ${build_dir}/plugins/${module}_${module_release_version}

        copy_included_files ${module} plugins ${module}_${module_release_version}
        cd ${git_bp}/src

         cp -f $module/bin/*.jar ${build_dir}/plugins/${module}_${module_release_version} > /dev/null 2>&1
    done

    create_all_features

    cd ${build_dir}
    mkdir -p ${site_result_dir}/eclipse
    cp -Rd features ${site_result_dir}/eclipse
    cp -Rd plugins ${site_result_dir}/eclipse

    jar_specific_plugins

    # Copy the MASL jars to the plugins dir.
    cd ${git_bp}/src/org.xtuml.bp.xtext.masl.parent/org.xtuml.bp.xtext.masl.updatesite/target/repository/features
    cp -f *.jar ${site_result_dir}/eclipse/features
    cd ${git_bp}/src/org.xtuml.bp.xtext.masl.parent/org.xtuml.bp.xtext.masl.updatesite/target/repository/plugins
    cp -f *.jar ${site_result_dir}/eclipse/plugins

    cd ${site_result_dir}/..
    zip -r BridgePoint_extension_${branch}.zip BridgePoint_${branch} > ${pkg_log_dir}/BridgePoint_extension_${branch}_zip.log 2>&1
	rm -rf BridgePoint_${branch}
	echo -e "Exiting create_bp_release.sh::zip_distribution"
}

function jar_specific_plugins {
    echo -e "Entering create_bp_release.sh::jar_specific_plugins"
    cd ${site_result_dir}/eclipse/plugins
    for jarplugin in ${plugins_to_jar}; do
      jar_plugin_fullname="${jarplugin}_${release_version}"
      echo -e "Converting ${jar_plugin_fullname} to a jar file."
      cd ${jar_plugin_fullname}
      # Use the Manifest file declared in our plugin.  Don't let jar create one.
      jar cMf "${jar_plugin_fullname}.jar" *
      mv  "${jar_plugin_fullname}.jar" ../
      cd ../
      rm -rf "${jar_plugin_fullname}"
    done
    cd ${build_dir}
    echo -e "Exiting create_bp_release.sh::jar_specific_plugins"
}

function copy_included_files {
    echo -e "Entering create_bp_release.sh::copy_included_files"

    # This function copies all files listed in a plugin's
    # bin.includes variable from its build.properties file
    #
    # args: 1 = module 2 = parent folder (features or plugins) 3 = destination folder
    echo -e "  copying files: ${1} to ${2}/${3}"
    if [ ! -d ${build_dir}/${2}/${3} ]; then
      mkdir -p ${build_dir}/${2}/${3}
    fi
    if [ -e ${1}/build.properties ]; then
	  include_files=$(echo -e "\n" | cat ${1}/build.properties - | awk '{if (/bin.includes = /) {print $3; getline; while (! /=/) {print $1; if (getline != 1) break;}}}' - | tr -d '\\\\' | tr -d ',' | tr -d '\r')

      cd ${1}
      for file in ${include_files}; do
        if [ "${file}" = "." ]; then
          # Special handling for plugins that will be packaged as jars
          file="bin/org/"
          cp -Rd ${file} ${build_dir}/${2}/${3}/
          plugins_to_jar="${plugins_to_jar} ${1}"
        else
          if [ -d ${file} ]; then
            cp --parents -Rd ${file} ${build_dir}/${2}/${3}/
          else
            cp --parents ${file} ${build_dir}/${2}/${3}/ > /dev/null 2>&1
          fi
        fi
      done
      cd ..

	  exclude_files=$(echo -e "\n" | cat ${1}/build.properties - | awk '{if (/bin.excludes = /) {print $3; getline; while (! /=/) {print $1; if (getline != 1) break;}}}' - | tr -d '\\\\' | tr -d ',' | tr -d '\r')

      for file in ${exclude_files}; do
        rm -rf ${build_dir}/${2}/${3}/${file}
      done

    fi
	echo -e "Exiting create_bp_release.sh::copy_included_files"
}

function create_all_features {
	echo -e "Entering create_bp_release.sh::create_all_features"

    cd ${git_bp}/src

    echo -e "Processing features: ${feature_modules}"
    for feature in $feature_modules; do
      echo "  Processing ${feature}"
      feature_version=$(awk -F"\"" '{if (/[0-9]\.[0-9]\.[0-9]/) {print $2; exit;}}' ${feature}/feature.xml | sed '/^\s*$/d')
      feature_less=$(echo $feature | sed s/"-feature"//)

      copy_included_files $feature features ${feature_less}_${feature_version}
      cd ${git_bp}/src
    done
	echo -e "Exiting create_bp_release.sh::create_all_features"
}

#-------------------------------------------------------------------------------
# Main
#-------------------------------------------------------------------------------

echo -e "Entering create_bp_release.sh"

date

if [ "$#" -lt 6 ]; then
  echo "This script has required parameters.  See below for usage."
  echo
  echo "create_bp_release.sh Build_dir Branch_name Git_BP Log_dir Timestamp Site_result_dir"
  echo ""
  echo "  Build_dir - path to the folder where the build is happening"
  echo "  Branch_name - product version, any branch/tag found in git"
  echo "  Git_BP - path to BridgePoint git repository"
  echo "  Log_dir - path to the folder where logs are stored"
  echo "  Timestamp - the timestamp to apply to the build IDs"
  echo "  Site_result_dir - path to folder where the update site data is packaged"
  echo ""
  exit 1
fi

build_dir="$1"
branch="$2"
git_bp="$3"
log_dir="$4"
timestamp="$5"
site_result_dir="$6"

echo "Create BP Release invocation: ./create_bp_release.sh ${build_dir} ${branch} ${git_bp} ${log_dir} ${timestamp} ${site_result_dir}"

pkg_log_dir="${log_dir}/pkg_logs"

feature_modules=""
plugin_modules=""
plugins_to_jar=""

if [ ! -x $pkg_log_dir ]; then
  echo -e "Creating package log directory: $pkg_log_dir"
  mkdir -p ${pkg_log_dir}
fi

if [ ! -x ${build_dir}/plugins ]; then
  echo -e "Creating plugin directory: ${build_dir}/plugins"
  mkdir -p ${build_dir}/plugins
fi

if [ ! -x ${build_dir}/features ]; then
  echo -e "Creating feature directory: ${build_dir}/features"
  mkdir -p ${build_dir}/features
fi

release_version=$(awk -F": " '{if (/[0-9]\.[0-9]\.[0-9]/) {print $2; exit;}}' ${git_bp}/src/org.xtuml.bp.pkg/META-INF/MANIFEST.MF)
release_version="$(echo ${release_version} | tr -d '\r')"

# Set up the lists of features and plug-ins
configure_module_lists

zip_distribution

echo -e "Exiting create_bp_release.sh"

exit 0


text:
/** @file
    udp builtin server
*/

#include <vnet/udp/udp.h>
#include <vnet/session/session.h>
#include <vnet/session/application_interface.h>

/** per-worker built-in server copy buffers */
u8 **copy_buffers;

static int
builtin_session_create_callback (stream_session_t * s)
{
  /* Simple version: declare session ready-to-go... */
  s->session_state = SESSION_STATE_READY;
  return 0;
}

static void
builtin_session_disconnect_callback (stream_session_t * s)
{
  stream_session_disconnect (s);
}

static int
builtin_server_rx_callback (stream_session_t * s)
{
  svm_fifo_t *rx_fifo, *tx_fifo;
  u32 this_transfer, max_deq, max_enq;
  int actual_transfer;
  u8 *my_copy_buffer;
  session_fifo_event_t evt;
  unix_shared_memory_queue_t *q;

  my_copy_buffer = copy_buffers[s->thread_index];
  rx_fifo = s->server_rx_fifo;
  tx_fifo = s->server_tx_fifo;

  max_deq = svm_fifo_max_dequeue (rx_fifo);
  max_enq = svm_fifo_max_enqueue (tx_fifo);
  this_transfer = max_enq < max_deq ? max_enq : max_deq;

  vec_validate (my_copy_buffer, this_transfer - 1);
  _vec_len (my_copy_buffer) = this_transfer;

  actual_transfer = svm_fifo_dequeue_nowait (rx_fifo, this_transfer,
					     my_copy_buffer);
  ASSERT (actual_transfer == this_transfer);
  actual_transfer = svm_fifo_enqueue_nowait (tx_fifo, this_transfer,
					     my_copy_buffer);
  ASSERT (actual_transfer == this_transfer);

  copy_buffers[s->thread_index] = my_copy_buffer;

  if (svm_fifo_set_event (tx_fifo))
    {
      /* Fabricate TX event, send to ourselves */
      evt.fifo = tx_fifo;
      evt.event_type = FIFO_EVENT_APP_TX;
      evt.event_id = 0;
      q = session_manager_get_vpp_event_queue (s->thread_index);
      unix_shared_memory_queue_add (q, (u8 *) & evt,
				    0 /* do wait for mutex */ );
    }

  return 0;
}

/* *INDENT-OFF* */
static session_cb_vft_t builtin_server = {
    .session_accept_callback = builtin_session_create_callback,
    .session_disconnect_callback = builtin_session_disconnect_callback,
    .builtin_server_rx_callback = builtin_server_rx_callback
};
/* *INDENT-ON* */

static int
attach_builtin_uri_server ()
{
  vnet_app_attach_args_t _a, *a = &_a;
  u8 segment_name[128];
  u32 segment_name_length;
  u64 options[16];

  segment_name_length = ARRAY_LEN (segment_name);

  memset (a, 0, sizeof (*a));
  memset (options, 0, sizeof (options));

  a->api_client_index = ~0;
  a->segment_name = segment_name;
  a->segment_name_length = segment_name_length;
  a->session_cb_vft = &builtin_server;

  options[SESSION_OPTIONS_ACCEPT_COOKIE] = 0x12345678;
  options[SESSION_OPTIONS_SEGMENT_SIZE] = (2 << 30);	/*$$$$ config / arg */
  options[APP_OPTIONS_FLAGS] = APP_OPTIONS_FLAGS_BUILTIN_APP;
  options[APP_OPTIONS_PREALLOC_FIFO_PAIRS] = 1024;

  a->options = options;

  return vnet_application_attach (a);
}

static int
bind_builtin_uri_server (u8 * uri)
{
  vnet_bind_args_t _a, *a = &_a;
  int rv;

  rv = attach_builtin_uri_server ();
  if (rv)
    return rv;

  memset (a, 0, sizeof (*a));
  a->uri = (char *) uri;
  a->app_index = ~0;		/* built-in server */

  rv = vnet_bind_uri (a);

  return rv;
}

static int
unbind_builtin_uri_server (u8 * uri)
{
  vnet_unbind_args_t _a, *a = &_a;

  a->app_index = ~0;
  a->uri = (char *) uri;

  return vnet_unbind_uri (a);
}

static clib_error_t *
builtin_server_init (vlib_main_t * vm)
{
  vlib_thread_main_t *vtm = vlib_get_thread_main ();
  u32 num_threads;

  num_threads = 1 /* main thread */  + vtm->n_threads;

  vec_validate (copy_buffers, num_threads - 1);
  return 0;
}

VLIB_INIT_FUNCTION (builtin_server_init);

static clib_error_t *
builtin_uri_bind_command_fn (vlib_main_t * vm,
			     unformat_input_t * input,
			     vlib_cli_command_t * cmd)
{
  u8 *uri = 0;
  int rv;

  while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT)
    {
      if (unformat (input, "uri %s", &uri))
	;
      else
	break;
    }

  if (uri == 0)
    return clib_error_return (0, "uri to bind not specified...");

  rv = bind_builtin_uri_server (uri);

  vec_free (uri);

  switch (rv)
    {
    case 0:
      break;

    default:
      return clib_error_return (0, "bind_uri_server returned %d", rv);
      break;
    }

  return 0;
}

/* *INDENT-OFF* */
VLIB_CLI_COMMAND (builtin_uri_bind_command, static) =
{
  .path = "builtin uri bind",
  .short_help = "builtin uri bind",
  .function = builtin_uri_bind_command_fn,
};
/* *INDENT-ON* */

static clib_error_t *
builtin_uri_unbind_command_fn (vlib_main_t * vm,
			       unformat_input_t * input,
			       vlib_cli_command_t * cmd)
{
  u8 *uri = 0;
  int rv;

  while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT)
    {
      if (unformat (input, "uri %s", &uri))
	;
      else
	break;
    }

  if (uri == 0)
    return clib_error_return (0, "uri to unbind not specified...");

  rv = unbind_builtin_uri_server (uri);

  vec_free (uri);

  switch (rv)
    {
    case 0:
      break;

    default:
      return clib_error_return (0, "unbind_uri_server returned %d", rv);
      break;
    }

  return 0;
}

/* *INDENT-OFF* */
VLIB_CLI_COMMAND (builtin_uri_unbind_command, static) =
{
  .path = "builtin uri unbind",
  .short_help = "builtin uri unbind",
  .function = builtin_uri_unbind_command_fn,
};
/* *INDENT-ON* */

/*
 * fd.io coding-style-patch-verification: ON
 *
 * Local Variables:
 * eval: (c-set-style "gnu")
 * End:
 */