text:
package com.canoo.dp.impl.remoting.server.spring;

import com.canoo.dp.impl.remoting.BeanManagerImpl;
import com.canoo.platform.remoting.BeanManager;
import com.canoo.dp.impl.platform.core.Assert;
import com.canoo.dp.impl.server.bootstrap.PlatformBootstrap;
import com.canoo.dp.impl.server.context.DolphinContext;
import com.canoo.dp.impl.server.context.DolphinContextProvider;
import com.canoo.dp.impl.server.context.RemotingContextImpl;
import com.canoo.dp.impl.server.event.LazyEventBusInvocationHandler;
import com.canoo.platform.remoting.server.RemotingContext;
import com.canoo.platform.remoting.server.binding.PropertyBinder;
import com.canoo.platform.remoting.server.event.RemotingEventBus;
import com.canoo.platform.server.spring.ClientScope;
import com.canoo.platform.server.spring.SingletonScope;
import org.apiguardian.api.API;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import java.lang.reflect.Proxy;

import static org.apiguardian.api.API.Status.INTERNAL;

/**
 * Provides all Dolphin Platform Beans and Scopes for CDI
 */
@Configuration
@API(since = "0.x", status = INTERNAL)
public class RemotingSpringBeanFactory {

    @Bean(name = "remotingContext")
    @ClientScope
    protected RemotingContext createRemotingContext(RemotingEventBus eventBus) {
        Assert.requireNonNull(eventBus, "eventBus");

        final DolphinContextProvider contextProvider = PlatformBootstrap.getServerCoreComponents().getInstance(DolphinContextProvider.class);
        Assert.requireNonNull(contextProvider, "contextProvider");

        final DolphinContext context = contextProvider.getCurrentDolphinContext();
        Assert.requireNonNull(context, "context");

        return new RemotingContextImpl(context, eventBus);
    }

    /**
     * Method to create a spring managed {@link BeanManagerImpl} instance in client scope.
     *
     * @return the instance
     */
    @Bean(name = "beanManager")
    @ClientScope
    protected BeanManager createManager(RemotingContext remotingContext) {
        Assert.requireNonNull(remotingContext, "remotingContext");
        return remotingContext.getBeanManager();
    }

    /**
     * Method to create a spring managed {@link RemotingEventBus} instance in singleton scope.
     *
     * @return the instance
     */
    @Bean(name = "dolphinEventBus")
    @SingletonScope
    protected RemotingEventBus createEventBus() {
        return (RemotingEventBus) Proxy.newProxyInstance(getClass().getClassLoader(), new Class[]{RemotingEventBus.class}, new LazyEventBusInvocationHandler());
    }

    @Bean(name = "propertyBinder")
    @ClientScope
    protected PropertyBinder createPropertyBinder(RemotingContext remotingContext) {
        Assert.requireNonNull(remotingContext, "remotingContext");
        return remotingContext.getBinder();
    }
}


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Cosmos.Build.Installer {
  public class Log {
    public void WriteLine(string aText) {
      if (LogLine != null) {
        LogLine(aText);
      }
    }

    public void NewSection(string aText) {
      if (LogSection != null) {
        LogSection(aText);
      }
    }

    public void SetError() {
      if (LogError != null) {
        LogError();
      }
    }

    public delegate void LogErrorHandler();
    public event LogErrorHandler LogError;

    public delegate void LogLineHandler(string aLine);
    public event LogLineHandler LogLine;

    public delegate void LogSectionHandler(string aLine);
    public event LogSectionHandler LogSection;
  }
}

redpajama_set_name: RedPajamaGithub


text:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xmlns:context="http://www.springframework.org/schema/context"
       xmlns:mvc="http://www.springframework.org/schema/mvc" xmlns:aop="http://www.springframework.org/schema/aop"
       xmlns:cache="http://www.springframework.org/schema/cache"
       xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc.xsd http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop.xsd http://www.springframework.org/schema/cache http://www.springframework.org/schema/cache/spring-cache.xsd">

    <!--<bean id="curatorFramework" class="org.apache.curator.framework.CuratorFrameworkFactory" destroy-method="destroy">-->
    <!--<property name="connectString" value="${zkAddress:zk01.yohoops.org:2181,zk02.yohoops.org:2181,zk03.yohoops.org:2181,zk04.yohoops.org:2181,zk05.yohoops.org:2181}"/>-->
    <!--</bean>-->

    <bean id="restTemplate" class="org.springframework.web.client.RestTemplate">
        <constructor-arg ref="clientHttpRequestFactory"/>
        <property name="messageConverters">
            <list>
                <bean class="org.springframework.http.converter.ByteArrayHttpMessageConverter"/>
                <bean class="org.springframework.http.converter.StringHttpMessageConverter">
                    <property name="supportedMediaTypes">
                        <list>
                            <value>text/plain;charset=UTF-8</value>
                            <value>text/html;charset=UTF-8</value>
                            <value>text/xml;charset=GBK</value>
                        </list>
                    </property>
                </bean>
                <bean class="org.springframework.http.converter.ResourceHttpMessageConverter"/>
                <bean class="org.springframework.http.converter.FormHttpMessageConverter"/>
                <bean class="com.alibaba.fastjson.support.spring.FastJsonHttpMessageConverter">
                    <property name="supportedMediaTypes" value="application/json;charset=UTF-8"/>
                </bean>
            </list>
        </property>
        <!--<property name="errorHandler" ref="errorHandler"/>-->
    </bean>

    <bean id="clientHttpRequestFactory"
          class="org.springframework.http.client.SimpleClientHttpRequestFactory">
        <property name="readTimeout" value="${http.call.readTimeOut:1000}"/>
        <property name="connectTimeout" value="${http.call.connectTimeout:5000}"/>
    </bean>

    <bean id="curatorFramework" class="com.tts.component.webservice.initial.CuratorFrameworkFactoryBean" destroy-method="destroy">
        <property name="connectString" value="${zkServer:instance:port}"/>
    </bean>

    <bean id="serviceRegister" class="com.tts.component.webservice.register.ZeusRegister">
        <constructor-arg name="basePath" value="/tts/services"/>
        <constructor-arg name="client" ref="curatorFramework"/>
    </bean>

    <bean id="serviceInitial" class="com.tts.component.webservice.initial.ZeusInitial">
        <property name="port" value="${service.port}"/>
        <property name="group" value="${service.name}"/>
        <property name="register" ref="serviceRegister"/>
    </bean>

    <bean id="serviceClient" class="com.tts.component.webservice.register.ZkCuratorServiceClient">
        <constructor-arg name="basePath" value="/tts/services"/>
        <constructor-arg name="client" ref="curatorFramework"/>
    </bean>

    <bean id="serviceFinder" class="com.tts.component.webservice.finder.ZkServiceFinder">
        <property name="client" ref="serviceClient"/>
        <property name="strategy" ref="roundRobinStrategy"/>
    </bean>

    <bean id="serviceCaller" class="com.tts.component.webservice.finder.Invoker">
        <property name="serviceFinder" ref="serviceFinder"/>
        <property name="defaultTimeOut" value="${defaultTimeOut}"/>
        <property name="waitingTimeOut" value="${waitingTimeOut}"/>
        <property name="restTemplate" ref="restTemplate"/>
    </bean>

    <bean id="randomStrategy" class="com.tts.component.webservice.finder.strategy.RandomStrategy"/>
    <bean id="roundRobinStrategy" class="com.tts.component.webservice.finder.strategy.RoundRobinStrategy"/>

</beans>


text:
var precond = require('../lib/checks');

exports["Precond"] = {
    "checkState": function(test) {
        test.throws(function() {
            precond.checkState(false, 'abc %s def %s', 1, 3);
        }, /abc 1 def 3/);
        test.done();
    },

    "checkArgument": function(test) {
        test.throws(function() {
            precond.checkArgument(false, 'abc %s def %s', 1, 3);
        }, /abc 1 def 3/);
        test.done();
    },

    "checkIsDef": function(test) {
        test.doesNotThrow(function() { precond.checkIsDef(null); });
        test.doesNotThrow(function() { precond.checkIsDef(0); });
        test.doesNotThrow(function() { precond.checkIsDef([]); });
        test.doesNotThrow(function() { precond.checkIsDef({}); });
        test.throws(function() {
            precond.checkIsDef(undefined, 'abc %s def %s', 1, 3);
        }, /abc 1 def 3/);
        test.throws(function() {
            precond.checkIsDef(undefined);
        }, /Expected value to be defined but was undefined./);
        test.equals(0, precond.checkIsDef(0));
        test.done();
    },

    "checkIsDefAndNotNull": function(test) {
        test.doesNotThrow(function() { precond.checkIsDef(0); });
        test.doesNotThrow(function() { precond.checkIsDef([]); });
        test.doesNotThrow(function() { precond.checkIsDef({}); });
        test.throws(function() {
            precond.checkIsDefAndNotNull(undefined, 'abc %s def %s', 1, 3);
        }, /abc 1 def 3/);
        test.throws(function() {
            precond.checkIsDefAndNotNull(null, 'abc %s def %s', 1, 3);
        }, /abc 1 def 3/);
        test.throws(function() {
            precond.checkIsDefAndNotNull(null);
        }, /Expected value to be defined and not null but got "null"./);
        test.equals(0, precond.checkIsDefAndNotNull(0));
        test.done();
    },

    "checkIsString": function(test) {
        test.doesNotThrow(function() { precond.checkIsString(''); });
        test.throws(function() { precond.checkIsString(new String('')); });
        test.throws(function() {
            precond.checkIsString({}, 'abc %s def %s', 1, 3);
        }, /abc 1 def 3/);
        test.throws(function() {
            precond.checkIsString({});
        }, /Expected "string" but got "object"./);
        test.equals('foo', precond.checkIsString('foo'));
        test.done();
    },

    "checkIsArray": function(test) {
        test.doesNotThrow(function() { precond.checkIsArray([]); });
        test.throws(function() {
            precond.checkIsArray({}, 'abc %s def %s', 1, 3);
        }, /abc 1 def 3/);
        test.throws(function() {
            precond.checkIsArray({});
        }, /Expected "array" but got "object"./);
        var arr = [1, 2];
        test.equals(arr, precond.checkIsArray(arr));
        test.done();
    },

    "checkIsNumber": function(test) {
        test.doesNotThrow(function() { precond.checkIsNumber(0); });
        test.throws(function() {
            precond.checkIsNumber({}, 'abc %s def %s', 1, 3);
        }, /abc 1 def 3/);
        test.throws(function() {
            precond.checkIsNumber({});
        }, /Expected "number" but got "object"./);
        test.equals(0, precond.checkIsNumber(0));
        test.done();
    },

    "checkIsBoolean": function(test) {
        test.doesNotThrow(function() { precond.checkIsBoolean(true); });
        test.doesNotThrow(function() { precond.checkIsBoolean(false); });
        test.throws(function() {
            precond.checkIsBoolean({}, 'abc %s def %s', 1, 3);
        }, /abc 1 def 3/);
        test.throws(function() {
            precond.checkIsBoolean({});
        }, /Expected "boolean" but got "object"./);
        test.equals(true, precond.checkIsBoolean(true));
        test.done();
    },

    "checkIsFunction": function(test) {
        test.doesNotThrow(function() { precond.checkIsFunction(function() {}); });
        test.throws(function() {
            precond.checkIsFunction({}, 'abc %s def %s', 1, 3);
        }, /abc 1 def 3/);
        test.throws(function() {
            precond.checkIsFunction({});
        }, /Expected "function" but got "object"./);
        var fn = function() {};
        test.equals(fn, precond.checkIsFunction(fn));
        test.done();
    },

    "checkIsObject": function(test) {
        test.doesNotThrow(function() { precond.checkIsObject({}); });
        test.throws(function() {
            precond.checkIsObject([], 'abc %s def %s', 1, 3);
        }, /abc 1 def 3/);
        test.throws(function() {
            precond.checkIsObject(null, 'abc %s def %s', 1, 3);
        }, /abc 1 def 3/);
        test.throws(function() {
            precond.checkIsObject(null);
        }, /Expected "object" but got "null"./);
        var obj = {};
        test.equals(obj, precond.checkIsObject(obj));
        test.done();
    }
};


text:
#include <cusp/graph/detail/host/maximum_flow.h>
#include <cusp/graph/detail/device/maximum_flow.h>

namespace cusp
{
namespace graph
{
namespace detail
{
namespace dispatch
{

////////////////
// Host Paths //
////////////////
template<typename MatrixType, typename ArrayType, typename IndexType>
typename MatrixType::value_type
maximum_flow(const MatrixType& G, ArrayType& flow, const IndexType src, const IndexType sink, cusp::host_memory)
{
    return cusp::graph::detail::host::maximum_flow(G, flow, src, sink);
}

//////////////////
// Device Paths //
//////////////////
template<typename MatrixType, typename ArrayType, typename IndexType>
typename MatrixType::value_type
maximum_flow(const MatrixType& G, ArrayType& flow, const IndexType src, const IndexType sink, cusp::device_memory)
{
    return cusp::graph::detail::device::maximum_flow(G, flow, src, sink);
}

} // end namespace dispatch
} // end namespace detail
} // end namespace graph
} // end namespace cusp


text:
package com.marktreble.f3ftimer.resultsmanager;

import java.util.ArrayList;

import android.os.Bundle;
import android.app.ListActivity;
import android.content.Intent;
import android.content.res.Resources;
import android.util.TypedValue;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.ArrayAdapter;
import android.widget.ImageView;
import android.widget.ListView;
import android.widget.TextView;

import com.marktreble.f3ftimer.data.race.*;
import com.marktreble.f3ftimer.R;

public class ResultsCompletedRoundsActivity extends ListActivity {

	private ArrayAdapter<String> mArrAdapter;

	private Integer mRid;

	static final boolean DEBUG = true;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);

		ImageView view = (ImageView)findViewById(android.R.id.home);
		Resources r = getResources();
		int px = (int)TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 16, r.getDisplayMetrics());
		view.setPadding(0, 0, px, 0);

		setContentView(R.layout.race);

		Intent intent = getIntent();
		if (intent.hasExtra("race_id")){
			Bundle extras = intent.getExtras();
			mRid = extras.getInt("race_id");
		}

		RaceData datasource = new RaceData(this);
  		datasource.open();
  		Race race = datasource.getRace(mRid);
  		datasource.close();

 		TextView tt = (TextView) findViewById(R.id.race_title);
  		tt.setText(race.name);

		ArrayList<String> arrOptions = new ArrayList<String>();
		for (int i=1; i<race.round; i++){
			arrOptions.add(String.format("Round %d", i));
		}

		mArrAdapter = new ArrayAdapter<String>(this, R.layout.listrow , arrOptions);
		if (race.round<=1){
			TextView noneView = new TextView(this);
	   	   	noneView.setText("No rounds completed yet");
	   	   	noneView.setTextColor(r.getColor(R.color.text2));
			int px1 = (int)TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 16, r.getDisplayMetrics());
	   	   	noneView.setTextSize(px1);
	   	   	noneView.setPadding(px1, px1, px1, px1);

	   	   	getListView().addFooterView(noneView);
		}

		setListAdapter(mArrAdapter);

	}

	@Override
	public void onListItemClick(ListView l, View v, int position, long id) {
		Intent intent =  new Intent(this, ResultsCompletedRoundActivity.class);
        intent.putExtra("race_id", mRid);
        intent.putExtra("round_id", position+1);
    	startActivityForResult(intent, mRid);
	}

	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		// Inflate the menu; this adds items to the action bar if it is present.
		getMenuInflater().inflate(R.menu.results, menu);
		return true;
	}

	@Override
	public boolean onOptionsItemSelected(MenuItem item) {
	    // Handle presses on the action bar items
	    switch (item.getItemId()) {
	    	case R.id.menu_share:
	    		share();
	    		return true;
	        default:
	            return super.onOptionsItemSelected(item);
	    }
	}

	public void share(){
		/*Intent intent = new Intent(mContext, SettingsActivity.class);
    	startActivityForResult(intent, 1);
    	*/
	}
}


text:
function createMasker_offline()

%Create Masker Straight matrices offline:

if is_test_machine() %If it's computer in Tinnitus Room
    disp('-------------------------');
    disp('--- In Tinnitus Room ---');
    disp('-------------------------');
    options.sound_path = '/Users/dbaskent/Sounds/VU_zinnen/Vrouw/equalized';
    options.tmp_path   = '/Users/dbaskent/Sounds/VU_zinnen/Vrouw/processed';

else %If it's experimenter's OWN computer:
    disp('-------------------------');
    disp('--- On coding machine ---');
    disp('-------------------------');
    options.sound_path = '~/Library/Matlab/Sounds/VU_zinnen/Vrouw/equalized';
    options.tmp_path   = '~/Library/Matlab/Sounds/VU_zinnen/Vrouw/processed';
end

    filename = fullfile(options.tmp_path, sprintf('options.mat'));
    options.filename = filename;

%-------------------------------------------------
%% Set appropriate path

current_dir = fileparts(mfilename('fullpath'));
added_path  = {};

added_path{end+1} = '~/Library/Matlab/auditory-research-tools/vocoder_2015';
addpath(added_path{end});

added_path{end+1} = '~/Library/Matlab/auditory-research-tools/STRAIGHTV40_006b';
addpath(added_path{end});

added_path{end+1} = '~/Library/Matlab/auditory-research-tools/common_tools';
addpath(added_path{end});

[expe, options] = expe_build_conditions(options);

tic()

phase = {'training', 'test'};

for j = 1:length(phase);
    nconditions = length(options.(phase{j}).voices) ;

    maskerList = [];
    for i_masker_list = 1:length(options.masker)

        masker_list = options.masker(i_masker_list);
        masker_sentences = options.list{masker_list}(1):options.list{masker_list}(2);
        maskerList = [maskerList masker_sentences];

    end

    %maskerList = options.masker(1):options.masker(2);

    for i = 1:nconditions

        for file = 1:length(maskerList)
            disp('-----------')
            disp(['File ' num2str(maskerList(file))])
            disp('-----------')
            disp([num2str(i) '/' num2str(nconditions)])
            disp('-----------')

            f0 = options.(phase{j}).voices(i).f0
            ser = options.(phase{j}).voices(i).ser

            [masker,fs] = straight_process(maskerList(file), f0, ser, options);

        end

    end
end

toc()

end

function [y, fs] = straight_process(sentence, t_f0, ser, options)

    wavIn = fullfile(options.sound_path, [num2str(sentence), '.wav']);
    wavOut = make_fname(wavIn, t_f0, ser, options.tmp_path);

    if ~exist(wavOut, 'file')

        mat = strrep(wavIn, '.wav','.straight.mat');

        if exist(mat, 'file')
            load(mat);
        else
            [x, fs] = audioread(wavIn);
            [f0, ap] = exstraightsource(x, fs);

            sp = exstraightspec(x, f0, fs);
            x_rms = rms(x);

            save(mat, 'fs', 'f0', 'sp', 'ap', 'x_rms');
        end

        %mf0 = exp(mean(log(f0(f0~=0))));

        %f0(f0~=0) = f0(f0~=0) / mf0 * t_f0;
        f0(f0~=0) = f0(f0~=0) .* t_f0;

        p.frequencyAxisMappingTable = ser;
        y = exstraightsynth(f0, sp, ap, fs, p);

        y = y/rms(y)*x_rms;
        if max(abs(y))>1
            warning('Output was renormalized for "%s".', wavOut);
            y = 0.98*y/max(abs(y));
        end

        audiowrite(wavOut, y, fs);

    else

        [y, fs] = audioread(wavOut);
    end
end

function fname = make_fname(wav, f0, ser, destPath)

    [~, name, ext] = fileparts(wav);

    fname = sprintf('M_%s_GPR%.2f_SER%.2f', name, f0, ser);

    fname = fullfile(destPath, [fname, ext]);
end


text:
title: "Main Content Ordered Lists"
type: typography
scss: src/assets/stylesheets/_page.scss
usage: "Ordered lists found in post content"
---

List item one

Sub list item one

Sub list item two

Sub list item three

List item two


text:
import { ok } from 'assert';
import { equals } from './equals';
import { pow } from './pow';
import { map } from './map';
import { random } from './random';

describe('(v) pow', () => {
  it('should work as expected', () => {
    const x = random(3);

    ok(equals(map(x, (value: number) => Math.pow(value, 2)), x.pow(2)));
  });

  it('should work as the static equivalent', () => {
    const x = random(3);

    ok(equals(map(x, (value: number) => Math.pow(value, 2)), pow(x, 2)));
  });
});


text:
import fs from 'fs';
import test from 'tape';
import path from 'path';
import load from 'load-json-file';
import write from 'write-json-file';
import envelope from '@turf/envelope';
import pointGrid from '@turf/point-grid';
import truncate from '@turf/truncate';
import { getCoords } from '@turf/invariant';
import { lineString } from '@turf/helpers';
import { featureEach } from '@turf/meta';
import { randomPolygon }  from '@turf/random';
import isobands from './index';
import matrixToGrid from './matrix-to-grid';

const directories = {
    in: path.join(__dirname, 'test', 'in') + path.sep,
    out: path.join(__dirname, 'test', 'out') + path.sep
};

const fixtures = fs.readdirSync(directories.in).map(filename => {
    return {
        filename,
        name: path.parse(filename).name,
        json: load.sync(directories.in + filename)
    };
});

test('isobands', t => {
    fixtures.forEach(({name, json, filename}) => {
        const options = json.properties || json
        const { breaks, matrix, origin, cellSize } = options;

        // allow GeoJSON featureCollection or matrix
        let points = json.properties ? json : matrixToGrid(matrix, origin, cellSize, options);

        // Results
        const results = truncate(isobands(points, breaks, options));

        // Add red line around point data
        results.features.push(lineString(getCoords(envelope(points))[0], {
            stroke: '#F00',
            'stroke-width': 1
        }));

        if (process.env.REGEN) write.sync(directories.out + name + '.geojson', results);
        t.deepEqual(results, load.sync(directories.out + name + '.geojson'), name);
    });

    t.end();
});

test('isobands -- throws', t => {
    const points = pointGrid([-70.823364, -33.553984, -70.473175, -33.302986], 5);

    t.throws(() => isobands(randomPolygon(), [1, 2, 3]), 'invalid points');
    t.throws(() => isobands(points, ''), 'invalid breaks');
    t.throws(() => isobands(points, [1, 2, 3], {zProperty: 'temp', breaksProperties: 'hello' }), 'invalid options');

    t.end();
});


text:
package org.jabref.model.entry.field;

import java.util.Arrays;
import java.util.Collections;
import java.util.EnumSet;
import java.util.Optional;
import java.util.Set;

public enum AMSField implements Field {

    FJOURNAL("fjournal");

    private final String name;
    private final String displayName;
    private final Set<FieldProperty> properties;

    AMSField(String name) {
        this.name = name;
        this.displayName = null;
        this.properties = EnumSet.noneOf(FieldProperty.class);
    }

    AMSField(String name, String displayName) {
        this.name = name;
        this.displayName = displayName;
        this.properties = EnumSet.noneOf(FieldProperty.class);
    }

    AMSField(String name, String displayName, FieldProperty first, FieldProperty... rest) {
        this.name = name;
        this.displayName = displayName;
        this.properties = EnumSet.of(first, rest);
    }

    AMSField(String name, FieldProperty first, FieldProperty... rest) {
        this.name = name;
        this.displayName = null;
        this.properties = EnumSet.of(first, rest);
    }

    public static <T> Optional<AMSField> fromName(T type, String name) {
        return Arrays.stream(AMSField.values())
                     .filter(field -> field.getName().equalsIgnoreCase(name))
                     .findAny();
    }

    @Override
    public Set<FieldProperty> getProperties() {
        return Collections.unmodifiableSet(properties);
    }

    @Override
    public String getName() {
        return name;
    }

    @Override
    public boolean isStandardField() {
        return false;
    }

    @Override
    public String getDisplayName() {
        if (displayName == null) {
            return Field.super.getDisplayName();
        } else {
            return displayName;
        }
    }
}


text:
package eu.hurion.vaadin.heroku;

import com.vaadin.server.VaadinRequest;
import com.vaadin.ui.ComponentContainer;
import com.vaadin.ui.Label;
import com.vaadin.ui.UI;
import com.vaadin.ui.VerticalLayout;

public class TestApplication extends UI {

    public static final String TEST_LABEL = "test";
    public static final String TEST_LABEL_ID = "test-label";

    @Override
    protected void init(final VaadinRequest vaadinRequest) {
        setContent(buildContent());
    }

    private ComponentContainer buildContent() {
        final VerticalLayout layout = new VerticalLayout();
        final Label testLabel = new Label(TEST_LABEL);
        testLabel.setId(TEST_LABEL_ID);
        layout.addComponent(testLabel);
        return layout;
    }
}


text:
<!DOCTYPE html>

    <Title>Human Resources System</Title>
    <meta name="author" content="Michael Allender Gardner" />
    <meta name="owner" content="Michael Allender Gardner" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0">

    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">

Are you sure you want to delete

{{request('name')}}

                <form class="text-center" method="post">
                    {{ csrf_field() }}
                    <button type="submit" name="id" value="{{request('id')}}" formaction="deleteUser" class="btn btn-danger">Yes</button>
                    <button type="submit" formaction="cancel" class="btn btn-info">No</button>
                </form>


text:
<?php
namespace Main\StockManagerBundle\StockManagerDTO;

use Symfony\Component\Validator\Constraints as Assert;
use Main\StockManagerBundle\Validator\Constraints as FormAssert;
use Symfony\Component\Validator\Constraints\Date;
use Main\StockManagerBundle\Entity\Product;
use Main\StockManagerBundle\Entity\Ingredient;

class ProductIngredientDTO{
	/**
	 *
	 * @Assert\NotNull
	 */
	private $product;

	/**
	 * @Assert\NotNull
	 */
	private $ingredient;

	public function convertToIngredient($ingredientService){
		$ingredient = $ingredientService->getingredientById($this->ingredient);

		return $ingredient;
	}

	public function __get($name){
		return $this->$name;
	}

	public function __set($name, $value){
		$this->$name = $value;
	}
}

?>


text:
package io.awacs.component.org.jetbrains.java.decompiler.util;

import java.util.Collection;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Set;

public class FastSparseSetFactory<E> {

  private final VBStyleCollection<int[], E> colValuesInternal = new VBStyleCollection<>();

  private int lastBlock;

  private int lastMask;

  public FastSparseSetFactory(Collection<E> set) {

    int block = -1;
    int mask = -1;
    int index = 0;

    for (E element : set) {

      block = index / 32;

      if (index % 32 == 0) {
        mask = 1;
      }
      else {
        mask <<= 1;
      }

      colValuesInternal.putWithKey(new int[]{block, mask}, element);

      index++;
    }

    lastBlock = block;
    lastMask = mask;
  }

  private int[] addElement(E element) {

    if (lastMask == -1 || lastMask == 0x80000000) {
      lastMask = 1;
      lastBlock++;
    }
    else {
      lastMask <<= 1;
    }

    int[] pointer = new int[]{lastBlock, lastMask};
    colValuesInternal.putWithKey(pointer, element);

    return pointer;
  }

  public FastSparseSet<E> spawnEmptySet() {
    return new FastSparseSet<>(this);
  }

  public int getLastBlock() {
    return lastBlock;
  }

  public int getLastMask() {
    return lastMask;
  }

  private VBStyleCollection<int[], E> getInternalValuesCollection() {
    return colValuesInternal;
  }

  public static class FastSparseSet<E> implements Iterable<E> {
    public static final FastSparseSet[] EMPTY_ARRAY = new FastSparseSet[0];

    private final FastSparseSetFactory<E> factory;

    private final VBStyleCollection<int[], E> colValuesInternal;

    private int[] data;
    private int[] next;

    private FastSparseSet(FastSparseSetFactory<E> factory) {
      this.factory = factory;
      this.colValuesInternal = factory.getInternalValuesCollection();

      int length = factory.getLastBlock() + 1;
      this.data = new int[length];
      this.next = new int[length];
    }

    private FastSparseSet(FastSparseSetFactory<E> factory, int[] data, int[] next) {
      this.factory = factory;
      this.colValuesInternal = factory.getInternalValuesCollection();

      this.data = data;
      this.next = next;
    }

    public FastSparseSet<E> getCopy() {

      int arrlength = data.length;
      int[] cpdata = new int[arrlength];
      int[] cpnext = new int[arrlength];

      System.arraycopy(data, 0, cpdata, 0, arrlength);
      System.arraycopy(next, 0, cpnext, 0, arrlength);

      return new FastSparseSet<>(factory, cpdata, cpnext);
    }

    private int[] ensureCapacity(int index) {

      int newlength = data.length;
      if (newlength == 0) {
        newlength = 1;
      }

      while (newlength <= index) {
        newlength *= 2;
      }

      int[] newdata = new int[newlength];
      System.arraycopy(data, 0, newdata, 0, data.length);
      data = newdata;

      int[] newnext = new int[newlength];
      System.arraycopy(next, 0, newnext, 0, next.length);
      next = newnext;

      return newdata;
    }

    public void add(E element) {
      int[] index = colValuesInternal.getWithKey(element);

      if (index == null) {
        index = factory.addElement(element);
      }

      int block = index[0];
      if (block >= data.length) {
        ensureCapacity(block);
      }

      data[block] |= index[1];

      changeNext(next, block, next[block], block);
    }

    public void setAllElements() {

      int lastblock = factory.getLastBlock();
      int lastmask = factory.getLastMask();

      if (lastblock >= data.length) {
        ensureCapacity(lastblock);
      }

      for (int i = lastblock - 1; i >= 0; i--) {
        data[i] = 0xFFFFFFFF;
        next[i] = i + 1;
      }

      data[lastblock] = lastmask | (lastmask - 1);
      next[lastblock] = 0;
    }

    public void addAll(Set<E> set) {
      for (E element : set) {
        add(element);
      }
    }

    public void remove(E element) {
      int[] index = colValuesInternal.getWithKey(element);

      if (index == null) {
        index = factory.addElement(element);
      }

      int block = index[0];
      if (block < data.length) {
        data[block] &= ~index[1];

        if (data[block] == 0) {
          changeNext(next, block, block, next[block]);
        }
      }
    }

    public void removeAll(Set<E> set) {
      for (E element : set) {
        remove(element);
      }
    }

    public boolean contains(E element) {
      int[] index = colValuesInternal.getWithKey(element);

      if (index == null) {
        index = factory.addElement(element);
      }

      return index[0] < data.length && ((data[index[0]] & index[1]) != 0);
    }

    public boolean contains(FastSparseSet<E> set) {
      int[] extdata = set.getData();
      int[] intdata = data;

      int minlength = Math.min(extdata.length, intdata.length);

      for (int i = minlength - 1; i >= 0; i--) {
        if ((extdata[i] & ~intdata[i]) != 0) {
          return false;
        }
      }

      for (int i = extdata.length - 1; i >= minlength; i--) {
        if (extdata[i] != 0) {
          return false;
        }
      }

      return true;
    }

    private void setNext() {

      int link = 0;
      for (int i = data.length - 1; i >= 0; i--) {
        next[i] = link;
        if (data[i] != 0) {
          link = i;
        }
      }
    }

    private static void changeNext(int[] arrnext, int key, int oldnext, int newnext) {
      for (int i = key - 1; i >= 0; i--) {
        if (arrnext[i] == oldnext) {
          arrnext[i] = newnext;
        }
        else {
          break;
        }
      }
    }

    public void union(FastSparseSet<E> set) {

      int[] extdata = set.getData();
      int[] extnext = set.getNext();
      int[] intdata = data;
      int intlength = intdata.length;

      int pointer = 0;
      do {
        if (pointer >= intlength) {
          intdata = ensureCapacity(extdata.length - 1);
        }

        boolean nextrec = (intdata[pointer] == 0);
        intdata[pointer] |= extdata[pointer];

        if (nextrec) {
          changeNext(next, pointer, next[pointer], pointer);
        }

        pointer = extnext[pointer];
      }
      while (pointer != 0);
    }

    public void intersection(FastSparseSet<E> set) {
      int[] extdata = set.getData();
      int[] intdata = data;

      int minlength = Math.min(extdata.length, intdata.length);

      for (int i = minlength - 1; i >= 0; i--) {
        intdata[i] &= extdata[i];
      }

      for (int i = intdata.length - 1; i >= minlength; i--) {
        intdata[i] = 0;
      }

      setNext();
    }

    public void symdiff(FastSparseSet<E> set) {
      int[] extdata = set.getData();
      int[] intdata = data;

      int minlength = Math.min(extdata.length, intdata.length);

      for (int i = minlength - 1; i >= 0; i--) {
        intdata[i] ^= extdata[i];
      }

      boolean expanded = false;
      for (int i = extdata.length - 1; i >= minlength; i--) {
        if (extdata[i] != 0) {
          if (!expanded) {
            intdata = ensureCapacity(extdata.length - 1);
          }
          intdata[i] = extdata[i];
        }
      }

      setNext();
    }

    public void complement(FastSparseSet<E> set) {

      int[] extdata = set.getData();
      int[] intdata = data;
      int extlength = extdata.length;

      int pointer = 0;
      do {
        if (pointer >= extlength) {
          break;
        }

        intdata[pointer] &= ~extdata[pointer];
        if (intdata[pointer] == 0) {
          changeNext(next, pointer, pointer, next[pointer]);
        }

        pointer = next[pointer];
      }
      while (pointer != 0);
    }

    public boolean equals(Object o) {
      if (o == this) return true;
      if (o == null || !(o instanceof FastSparseSet)) return false;

      int[] longdata = ((FastSparseSet)o).getData();
      int[] shortdata = data;

      if (data.length > longdata.length) {
        shortdata = longdata;
        longdata = data;
      }

      for (int i = shortdata.length - 1; i >= 0; i--) {
        if (shortdata[i] != longdata[i]) {
          return false;
        }
      }

      for (int i = longdata.length - 1; i >= shortdata.length; i--) {
        if (longdata[i] != 0) {
          return false;
        }
      }

      return true;
    }

    public int getCardinality() {

      boolean found = false;
      int[] intdata = data;

      for (int i = intdata.length - 1; i >= 0; i--) {
        int block = intdata[i];
        if (block != 0) {
          if (found) {
            return 2;
          }
          else {
            if ((block & (block - 1)) == 0) {
              found = true;
            }
            else {
              return 2;
            }
          }
        }
      }

      return found ? 1 : 0;
    }

    public boolean isEmpty() {
      return data.length == 0 || (next[0] == 0 && data[0] == 0);
    }

    public Iterator<E> iterator() {
      return new FastSparseSetIterator<>(this);
    }

    public Set<E> toPlainSet() {
      HashSet<E> set = new HashSet<>();

      int[] intdata = data;

      int size = data.length * 32;
      if (size > colValuesInternal.size()) {
        size = colValuesInternal.size();
      }

      for (int i = size - 1; i >= 0; i--) {
        int[] index = colValuesInternal.get(i);

        if ((intdata[index[0]] & index[1]) != 0) {
          set.add(colValuesInternal.getKey(i));
        }
      }

      return set;
    }

    public String toString() {
      return toPlainSet().toString();
    }

    public String toBinary() {

      StringBuilder buffer = new StringBuilder();
      int[] intdata = data;

      for (int i = 0; i < intdata.length; i++) {
        buffer.append(" ").append(Integer.toBinaryString(intdata[i]));
      }

      return buffer.toString();
    }

    private int[] getData() {
      return data;
    }

    private int[] getNext() {
      return next;
    }

    public int[] getLoad() {
      int[] intdata = data;
      int notempty = 0;

      for (int i = 0; i < intdata.length; i++) {
        if (intdata[i] != 0) {
          notempty++;
        }
      }

      return new int[]{intdata.length, notempty};
    }

    public FastSparseSetFactory<E> getFactory() {
      return factory;
    }
  }

  public static class FastSparseSetIterator<E> implements Iterator<E> {

    private final VBStyleCollection<int[], E> colValuesInternal;
    private final int[] data;
    private final int[] next;
    private final int size;

    private int pointer = -1;
    private int next_pointer = -1;

    private FastSparseSetIterator(FastSparseSet<E> set) {
      colValuesInternal = set.getFactory().getInternalValuesCollection();
      data = set.getData();
      next = set.getNext();
      size = colValuesInternal.size();
    }

    private int getNextIndex(int index) {

      index++;
      int bindex = index >>> 5;
      int dindex = index & 0x1F;

      while (bindex < data.length) {
        int block = data[bindex];

        if (block != 0) {
          block >>>= dindex;
          while (dindex < 32) {
            if ((block & 1) != 0) {
              return (bindex << 5) + dindex;
            }
            block >>>= 1;
            dindex++;
          }
        }

        dindex = 0;
        bindex = next[bindex];

        if (bindex == 0) {
          break;
        }
      }

      return -1;
    }

    public boolean hasNext() {
      next_pointer = getNextIndex(pointer);
      return (next_pointer >= 0);
    }

    public E next() {
      if (next_pointer >= 0) {
        pointer = next_pointer;
      }
      else {
        pointer = getNextIndex(pointer);
        if (pointer == -1) {
          pointer = size;
        }
      }

      next_pointer = -1;
      return pointer < size ? colValuesInternal.getKey(pointer) : null;
    }

    public void remove() {
      int[] index = colValuesInternal.get(pointer);
      data[index[0]] &= ~index[1];
    }
  }
}


text:
package org.apache.sqoop.submission;

import org.apache.sqoop.classification.InterfaceAudience;
import org.apache.sqoop.classification.InterfaceStability;

/**
 * List of states where the submission might be.
 */
@InterfaceAudience.Private
@InterfaceStability.Unstable
public enum SubmissionStatus {

  /**
   * In the middle of creating new submission. This might be creation step
   * on our side on remote cluster side.
   */
  BOOTING,

  /**
   * We weren't able to submit this submission to remote cluster
   */
  FAILURE_ON_SUBMIT,

  /**
   * Submission is running.
   */
  RUNNING,

  /**
   * Submission has finished gracefully
   */
  SUCCEEDED,

  /**
   * Submission has not finished gracefully, there were issues.
   */
  FAILED,

  /**
   * We have no idea in what state the submission actually is.
   */
  UNKNOWN,

  /**
   * Special submission type for job that was never executed.
   */
  NEVER_EXECUTED,

  ;

  /**
   * Return array of submission status that are considered as unfinished.
   *
   * @return Array of unfinished submission statuses
   */
  public static SubmissionStatus[] unfinished() {
    return new SubmissionStatus[] { RUNNING, BOOTING };
  }

  public boolean isRunning() {
    return this == RUNNING || this == BOOTING;
  }

  public boolean isFailure() {
    return this == FAILED || this == UNKNOWN || this == FAILURE_ON_SUBMIT;
  }
}


text:
package com.dremio.telemetry.api.metrics;

/**
 * Tool for monitoring count of something
 */
public interface Counter {
  default void increment(String... tags) {
    increment(1);
  }
  default void decrement(String... tags) {
    decrement(1);
  }

  void increment(long value, String... tags);
  void decrement(long value, String... tags);
}


text:
package org.michaelevans.uber.entities;

import java.util.List;

public class UberTimes {
    private List<Time> times;

    public List<Time> getTimes() {
        return times;
    }
}


text:
package usst.socialshare.core.activity;

import android.app.Activity;
import android.content.Intent;
import android.content.res.AssetManager;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.drawable.BitmapDrawable;
import android.os.Bundle;
import android.os.Handler;
import android.view.Gravity;
import android.view.View;
import android.view.ViewGroup.LayoutParams;
import android.view.Window;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;
import android.widget.Toast;

import com.sina.weibo.sdk.api.share.BaseResponse;
import com.sina.weibo.sdk.api.share.IWeiboHandler;
import com.sina.weibo.sdk.api.share.IWeiboShareAPI;
import com.sina.weibo.sdk.api.share.WeiboShareSDK;
import com.sina.weibo.sdk.constant.WBConstants;

import java.io.IOException;

import usst.socialshare.core.BMShareListener;
import usst.socialshare.core.ErrorInfo;
import usst.socialshare.core.data.BMPlatform;
import usst.socialshare.core.data.PlatformKeyInfo;
import usst.socialshare.core.data.ShareData;
import usst.socialshare.core.social.QQOpenShare;
import usst.socialshare.core.social.RennShare;
import usst.socialshare.core.social.SinaShare;
import usst.socialshare.core.social.TencentWbShare;
import usst.socialshare.core.util.Util;

/**
 * 分享界面
 *
 * @author youtui
<<<<<<< HEAD
=======
 * @revised by cunbao  解决了部分BUG
>>>>>>> latest version
 * @since 14/6/11
 */
public class ShareActivity extends Activity implements IWeiboHandler.Response {
	/** 分享的平台 */
	private BMPlatform platform;
	/** 新浪微博分享操作类 */
	private SinaShare sinaShare;
	/** 新浪微博分享接口 */
	private IWeiboShareAPI iWeiboShareAPI;
	/** 返回按钮id */
	private final int BACK_ID = 140901;
	/** 分享按钮id */
	private final int SHAREBT_ID = 140902;
	/** 人人分享成功 */
	public static final int RENN_SHARE_SUCCESS = 0;
	/** 人人分享错误 */
	public static final int RENN_SHARE_ERROR = 1;
	/** 人人分享网络错误 */
	public static final int RENN_HTTP_ERROR = 2;
	/** 人人分享图片未找到 */
	public static final int RENN_PIC_NOTFOUND = 3;
	/** 待分享数据 */
	public static ShareData shareData;
	/** 分享监听 */
	public static BMShareListener listener;
	/** 短链接 */
	private String shortUrl;
	/** 长连接 */
	private String realUrl;
	/** 处理人人分享回调 */
	private Handler mHandler = new Handler() {
		public void handleMessage(android.os.Message msg) {
			switch (msg.what) {
			// 人人分享成功
			case RENN_SHARE_SUCCESS:
//				if (shareData != null) {
//					BMShareListener.sharePoint(ShareActivity.this, PlatformKeyInfo.youTui_AppKey, ChannelId.RENN, realUrl, !shareData.isAppShare, shortUrl);
//				}
				if (listener != null) {
					ErrorInfo error = new ErrorInfo();
					String errorMessage = (String) msg.obj;
					error.setErrorMessage(errorMessage);
					listener.onSuccess();
				}
				ShareActivity.this.finish();
				break;
			/** 处理人人分享错误 */
			case RENN_SHARE_ERROR:
				if (listener != null) {
					ErrorInfo error = new ErrorInfo();
					String errorMessage = (String) msg.obj;
					error.setErrorMessage(errorMessage);
					listener.onError(error);
				}
				ShareActivity.this.finish();
				break;
			/** 处理人人分享网络错误 */
			case RENN_HTTP_ERROR:
				Toast.makeText(ShareActivity.this, "连接到服务器错误...", Toast.LENGTH_SHORT).show();
				ShareActivity.this.finish();
				break;
			/** 处理人人分享图片未找到 */
			case RENN_PIC_NOTFOUND:
				Toast.makeText(ShareActivity.this, "未找到分享图片,请重新设置分享图片路径...", Toast.LENGTH_SHORT).show();
				break;
			default:
				break;
			}
		};
	};

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		requestWindowFeature(Window.FEATURE_NO_TITLE);
		super.onCreate(savedInstanceState);
		doShare();
<<<<<<< HEAD
=======
		if (savedInstanceState != null) {
			iWeiboShareAPI.handleWeiboResponse(getIntent(), this);
		}
>>>>>>> latest version
	}

	/**
	 * 分享操作
	 */
	private void doShare() {
		platform = (BMPlatform) getIntent().getExtras().get("platform");
		shortUrl = getIntent().getExtras().getString("shortUrl");
		realUrl = getIntent().getExtras().getString("realUrl");
		boolean sinaWeiboIsNoKeyShare = getIntent().getExtras().getBoolean("sinaWeiboIsNoKeyShare");

		switch (platform) {
		// 分享到新浪微博
		case PLATFORM_SINAWEIBO:
			if (sinaWeiboIsNoKeyShare) {
				initView("新浪微博", platform);
			} else {
				iWeiboShareAPI = WeiboShareSDK.createWeiboAPI(this, PlatformKeyInfo.sinaWeibo_AppKey);
<<<<<<< HEAD
=======
				iWeiboShareAPI.registerApp();  // 将应用注册到微博客户端
>>>>>>> latest version
				sinaShare = new SinaShare(ShareActivity.this, shareData);
				sinaShare.shareToSina();
			}
			break;
		// 分享到qq
		case PLATFORM_QQ:
			new QQOpenShare(this, "QQ", listener, shareData).shareToQQ();
			break;
		// 分享到qq空间
		case PLATFORM_QZONE:
			new QQOpenShare(this, "Qzone", listener, shareData).shareToQzone();
			break;
		// 分享到腾讯微博
		case PLATFORM_TENCENTWEIBO:
			initView("腾讯微博", platform);
			break;
		// 分享到人人网
		case PLATFORM_RENN:
			initView("人人网", platform);
			break;
		default:
			break;
		}

	}

	/**
	 * 新浪微博分享完会调用该方法
	 */
	@Override
	protected void onNewIntent(Intent intent) {
<<<<<<< HEAD
		setIntent(intent);
		if (platform == BMPlatform.PLATFORM_SINAWEIBO) {
			iWeiboShareAPI.handleWeiboResponse(intent, this);
		}
		super.onNewIntent(intent);
=======
		//setIntent(intent);
		super.onNewIntent(intent);
		if (platform == BMPlatform.PLATFORM_SINAWEIBO) {
			iWeiboShareAPI.handleWeiboResponse(intent, this);
		}

>>>>>>> latest version
	}

	/**
	 * 新浪分享回调
	 */
	@Override
	public void onResponse(BaseResponse baseResp) {
		switch (baseResp.errCode) {
		// 分享成功
		case WBConstants.ErrorCode.ERR_OK:
//			if (shareData != null) {
//				BMShareListener.sharePoint(this, PlatformKeyInfo.youTui_AppKey, ChannelId.SINAWEIBO, realUrl, !shareData.isAppShare, shortUrl);
//			}
			if (listener != null) {
				ErrorInfo error = new ErrorInfo();
				error.setErrorMessage(baseResp.errMsg);
				listener.onSuccess();
			}
			break;
		// 分享取消
		case WBConstants.ErrorCode.ERR_CANCEL:
			if (listener != null) {
				listener.onCancel();
			}
<<<<<<< HEAD

=======
>>>>>>> latest version
			break;
		// 分享错误
		case WBConstants.ErrorCode.ERR_FAIL:
			// 新浪微博分享在这里有bug
			if ("auth faild!!!!".equals(baseResp.errMsg)) {
				Toast.makeText(this, "授权失败,请重新获取授权...", Toast.LENGTH_SHORT).show();
				iWeiboShareAPI.registerApp();
			} else {
				if (listener != null) {
					ErrorInfo error = new ErrorInfo();
					error.setErrorMessage(baseResp.errMsg);
					listener.onError(error);
				}
			}
			break;
<<<<<<< HEAD

		default:
			break;
		}

		finish();

=======
		}
		//finish();
		ShareActivity.this.finish();
>>>>>>> latest version
	}

	@Override
	protected void onDestroy() {
		// activity摧毁时释放listener
		Util.dismissDialog();
		shareData = null;
		listener = null;
		super.onDestroy();
	}

	/** 腾讯微博和人人以及新浪的无key分享需要自己写分享编辑界面 */
	private void initView(String platformName, final BMPlatform platform) {
		LinearLayout mainLinear = new LinearLayout(this);
		mainLinear.setOrientation(LinearLayout.VERTICAL);
		mainLinear.setBackgroundColor(0xffe9ecff);
		//
		RelativeLayout headerLayout = new RelativeLayout(this);
		RelativeLayout.LayoutParams headerLinearParams = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.FILL_PARENT, Util.dip2px(this, 50));
		headerLayout.setLayoutParams(headerLinearParams);
		headerLayout.setBackgroundColor(0xff66c0ff);

		// 返回键
		LinearLayout back = new LinearLayout(this);
		RelativeLayout.LayoutParams backParams = new RelativeLayout.LayoutParams(Util.dip2px(this, 50), RelativeLayout.LayoutParams.FILL_PARENT);
		backParams.addRule(RelativeLayout.ALIGN_PARENT_LEFT);
		back.setHorizontalGravity(Gravity.CENTER);
		back.setVerticalGravity(Gravity.CENTER);
		back.setId(BACK_ID);
		back.setOnClickListener(new View.OnClickListener() {

			@Override
			public void onClick(View v) {
				ShareActivity.this.finish();

			}

		});
		// 返回键图片
		ImageView backImage = new ImageView(this);
		LayoutParams backImageParams = new LayoutParams(Util.dip2px(this, 20), Util.dip2px(this, 20));
		backImage.setLayoutParams(backImageParams);
		AssetManager asset = getAssets();
		Bitmap backBitmap = null;
		try {
			backBitmap = BitmapFactory.decodeStream(asset.open("yt_left_arrow.png"));
		} catch (IOException e) {
			e.printStackTrace();
		}
		backImage.setImageBitmap(backBitmap);
		back.addView(backImage);
		// 标题栏
		TextView title = new TextView(this);
		RelativeLayout.LayoutParams titleParams = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.FILL_PARENT, RelativeLayout.LayoutParams.FILL_PARENT);
		titleParams.addRule(RelativeLayout.RIGHT_OF, BACK_ID);
		titleParams.addRule(RelativeLayout.LEFT_OF, SHAREBT_ID);
		title.setGravity(Gravity.CENTER_VERTICAL);
		title.setText(platformName);
		title.setTextSize(16);
		title.setTextColor(0xffffffff);

		// 分享按钮
		TextView shareBt = new TextView(this);
		shareBt.setId(SHAREBT_ID);
		RelativeLayout.LayoutParams shareBtParams = new RelativeLayout.LayoutParams(Util.dip2px(this, 50), RelativeLayout.LayoutParams.FILL_PARENT);
		shareBtParams.addRule(RelativeLayout.ALIGN_PARENT_RIGHT);
		shareBt.setText("分享");
		shareBt.setGravity(Gravity.CENTER_VERTICAL);
		shareBt.setTextColor(0xffffffff);

		shareBt.setOnClickListener(new View.OnClickListener() {

			@Override
			public void onClick(View v) {
				if (platform == BMPlatform.PLATFORM_RENN) {
					Util.showProgressDialog(ShareActivity.this, "分享中...", true);
					new RennShare(ShareActivity.this, mHandler, listener, shareData).shareToRenn();
				} else if (platform == BMPlatform.PLATFORM_TENCENTWEIBO) {
					Util.showProgressDialog(ShareActivity.this, "分享中...", true);
					new TencentWbShare(ShareActivity.this, listener, shareData).shareToTencentWb();
				} else if (platform == BMPlatform.PLATFORM_SINAWEIBO) {
					// 没有key的情况下进行新浪微博分享
					Util.showProgressDialog(ShareActivity.this, "分享中...", true);
//					SinaNoKeyShare.shareToSina(ShareActivity.this, shareData, listener, realUrl, shortUrl);
				}
			}
		});

		headerLayout.addView(back, backParams);
		headerLayout.addView(title, titleParams);
		headerLayout.addView(shareBt, shareBtParams);
		// 分享内容框
		LinearLayout bodyLayout = new LinearLayout(this);
		bodyLayout.setOrientation(LinearLayout.VERTICAL);
		LinearLayout.LayoutParams bodyParams = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.FILL_PARENT, Util.dip2px(this, 270));
		bodyLayout.setLayoutParams(bodyParams);
		bodyLayout.setBackgroundColor(0xfff4f4f4);
		// 分享的文字
		EditText editText = new EditText(this);
		LinearLayout.LayoutParams editParams = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.FILL_PARENT, Util.dip2px(this, 160));
		editParams.setMargins(8, 8, 8, 8);
		editText.setLayoutParams(editParams);
		if (shareData != null && shareData.getText() != null) {
			editText.setText(shareData.getText());
		}
		editText.setGravity(Gravity.TOP);
		editText.setTextColor(0xffa1a1a1);
		editText.setTextSize(13);
		editText.setBackgroundDrawable(null);
		// 分享的图片
		ImageView shareImage = new ImageView(this);
		LinearLayout.LayoutParams shareImageParams = new LinearLayout.LayoutParams(Util.dip2px(this, 100), Util.dip2px(this, 100));
		shareImageParams.setMargins(8, 0, 8, 8);
		shareImage.setLayoutParams(shareImageParams);
		if (shareData != null && shareData.getImagePath() != null) {
			Bitmap imageBit = BitmapFactory.decodeFile(shareData.getImagePath());
			BitmapDrawable bitDraw = new BitmapDrawable(imageBit);
			shareImage.setBackgroundDrawable(bitDraw);
		}

		bodyLayout.addView(editText);
		bodyLayout.addView(shareImage);

		mainLinear.addView(headerLayout, headerLinearParams);
		mainLinear.addView(bodyLayout, bodyParams);

		setContentView(mainLinear);
	}

	@Override
	protected void onRestart() {
		Util.dismissDialog();
		finish();
		super.onRestart();
	}

}


text:
ACCEPTED

#### According to
Index Fungorum

#### Published in
null

#### Original name
Depazea vagans var. brassicae J.J. Kickx

### Remarks
null


text:
// Copyright (C) 2004, 2006 International Business Machines and others.
// All Rights Reserved.
// This code is published under the Common Public License.
//
// $Id: IpTripletHelper.hpp 759 2006-07-07 03:07:08Z andreasw $
//
// Authors:  Carl Laird, Andreas Waechter     IBM    2004-08-13

#ifndef __IPTRIPLETHELPER_HPP__
#define __IPTRIPLETHELPER_HPP__

#include "IpTypes.hpp"
#include "IpException.hpp"

namespace Ipopt
{

  /** forward declarations */
  class Matrix;
  class GenTMatrix;
  class SymTMatrix;
  class DiagMatrix;
  class IdentityMatrix;
  class ExpansionMatrix;
  class ScaledMatrix;
  class SymScaledMatrix;
  class SumMatrix;
  class SumSymMatrix;
  class ZeroMatrix;
  class CompoundMatrix;
  class CompoundSymMatrix;
  class Vector;

  class TripletHelper
  {
  public:
    /**@name A set of recursive routines that help with the Triplet format. */
    //@{
    /** find the total number of triplet entries of a Matrix */
    static Index GetNumberEntries(const Matrix& matrix);

    /** fill the irows, jcols structure for the triplet format from the matrix */
    static void FillRowCol(Index n_entries, const Matrix& matrix, Index* iRow, Index* jCol, Index row_offset=0, Index col_offset=0);

    /** fill the values for the triplet format from the matrix */
    static void FillValues(Index n_entries, const Matrix& matrix, Number* values);

    /** fill the values from the vector into a dense double* structure */
    static void FillValuesFromVector(Index dim, const Vector& vector, Number* values);

    /** put the values from the double* back into the vector */
    static void PutValuesInVector(Index dim, const Number* values, Vector& vector);
    //@}

    DECLARE_STD_EXCEPTION(UNKNOWN_MATRIX_TYPE);
    DECLARE_STD_EXCEPTION(UNKNOWN_VECTOR_TYPE);

  private:
    /** find the total number of triplet entries for the SumMatrix */
    static Index GetNumberEntries_(const SumMatrix& matrix);

    /** find the total number of triplet entries for the SumSymMatrix */
    static Index GetNumberEntries_(const SumSymMatrix& matrix);

    /** find the total number of triplet entries for the CompoundMatrix */
    static Index GetNumberEntries_(const CompoundMatrix& matrix);

    /** find the total number of triplet entries for the CompoundSymMatrix */
    static Index GetNumberEntries_(const CompoundSymMatrix& matrix);

    static void FillRowCol_(Index n_entries, const GenTMatrix& matrix, Index row_offset, Index col_offset, Index* iRow, Index* jCol);

    static void FillValues_(Index n_entries, const GenTMatrix& matrix, Number* values);

    static void FillRowCol_(Index n_entries, const SymTMatrix& matrix, Index row_offset, Index col_offset, Index* iRow, Index* jCol);

    static void FillValues_(Index n_entries, const SymTMatrix& matrix, Number* values);

    static void FillRowCol_(Index n_entries, const DiagMatrix& matrix, Index row_offset, Index col_offset, Index* iRow, Index* jCol);

    static void FillValues_(Index n_entries, const DiagMatrix& matrix, Number* values);

    static void FillRowCol_(Index n_entries, const IdentityMatrix& matrix, Index row_offset, Index col_offset, Index* iRow, Index* jCol);

    static void FillValues_(Index n_entries, const IdentityMatrix& matrix, Number* values);

    static void FillRowCol_(Index n_entries, const ExpansionMatrix& matrix, Index row_offset, Index col_offset, Index* iRow, Index* jCol);

    static void FillValues_(Index n_entries, const ExpansionMatrix& matrix, Number* values);

    static void FillRowCol_(Index n_entries, const SumMatrix& matrix, Index row_offset, Index col_offset, Index* iRow, Index* jCol);

    static void FillValues_(Index n_entries, const SumMatrix& matrix, Number* values);

    static void FillRowCol_(Index n_entries, const SumSymMatrix& matrix, Index row_offset, Index col_offset, Index* iRow, Index* jCol);

    static void FillValues_(Index n_entries, const SumSymMatrix& matrix, Number* values);

    static void FillRowCol_(Index n_entries, const CompoundMatrix& matrix, Index row_offset, Index col_offset, Index* iRow, Index* jCol);

    static void FillValues_(Index n_entries, const CompoundMatrix& matrix, Number* values);

    static void FillRowCol_(Index n_entries, const CompoundSymMatrix& matrix, Index row_offset, Index col_offset, Index* iRow, Index* jCol);

    static void FillValues_(Index n_entries, const CompoundSymMatrix& matrix, Number* values);

    static void FillRowCol_(Index n_entries, const ScaledMatrix& matrix, Index row_offset, Index col_offset, Index* iRow, Index* jCol);

    static void FillValues_(Index n_entries, const ScaledMatrix& matrix, Number* values);

    static void FillRowCol_(Index n_entries, const SymScaledMatrix& matrix, Index row_offset, Index col_offset, Index* iRow, Index* jCol);

    static void FillValues_(Index n_entries, const SymScaledMatrix& matrix, Number* values);

  };
} // namespace Ipopt

#endif


text:
({
	AUD_displayName:"Ausztrál dollár",
	AUD_symbol:"$A",
	CAD_displayName:"Kanadai dollár",
	CAD_symbol:"Can$",
	CHF_displayName:"Svájci frank",
	CHF_symbol:"SwF",
	CNY_displayName:"Kínai jüan renminbi",
	CNY_symbol:"Y",
	EUR_displayName:"Euro",
	GBP_displayName:"Brit font sterling",
	HKD_displayName:"Hongkongi dollár",
	HKD_symbol:"HK$",
	JPY_displayName:"Japán jen",
	USD_displayName:"USA dollár",
	USD_symbol:"USD"
})


text:
<!DOCTYPE html>

      <meta charset="UTF-8"/>
      <meta name="viewport" content="width=device-width, initial-scale=1">
      <title>Welcome to relembra</title>

Welcome to relembra

If you're seeing this message, that means you haven't yet compiled your ClojureScript!

Please run lein shadow watch app to start the ClojureScript compiler and reload the page.

For better ClojureScript development experience in Chrome follow these steps:

Open DevTools

Go to Settings ("three dots" icon in the upper right corner of DevTools > Menu > Settings F1 > General > Console)

Check-in "Enable custom formatters"

Close DevTools

Open DevTools

See ClojureScript documentation for further details.

    {% style "/assets/bulma/css/bulma.min.css" %}
    {% style "/assets/material-icons/css/material-icons.min.css" %}
    {% style "/css/screen.css" %}

    {% script "/js/app.js" %}


text:
{{
  properties: {
    category: "core api"
  }
}}

This base class is incredibly useful if you're looking to extend the functionality of DOM elements. This comes
handy especially when creating pollyfills for browsers that don't support certain DOM features, such as `placeholder`.

#### paperclip.nodeBinding(name, nodeBindingClass)

Registers a node name or attribute binding class

#### BaseAttrBinding(options)

{{#example}}
{{#block:"index-pc"}}

{{/}}
{{#block:"textAttrBinding-js"}}

{{/}}
{{#block:"index-js"}}

{{/}}
{{/}}

#### override _onChange(text)

called whenever the attribute changes

#### node

the DOM node being bound to


text:
package kafka.coordinator

import kafka.server.KafkaConfig
import kafka.utils.TestUtils

import org.junit.Assert._
import org.junit.{Before, Test}
import org.scalatest.junit.JUnitSuite

/**
 * Test coordinator group and topic metadata management
 */
class CoordinatorMetadataTest extends JUnitSuite {
  val DefaultNumPartitions = 8
  val DefaultNumReplicas = 2
  var coordinatorMetadata: CoordinatorMetadata = null

  @Before
  def setUp() {
    val props = TestUtils.createBrokerConfig(nodeId = 0, zkConnect = "")
    coordinatorMetadata = new CoordinatorMetadata(KafkaConfig.fromProps(props).brokerId)
  }

  @Test
  def testGetNonexistentGroup() {
    assertNull(coordinatorMetadata.getGroup("group"))
  }

  @Test
  def testGetGroup() {
    val groupId = "group"
    val protocolType = "consumer"
    val expected = coordinatorMetadata.addGroup(groupId, protocolType)
    val actual = coordinatorMetadata.getGroup(groupId)
    assertEquals(expected, actual)
  }

  @Test
  def testAddGroupReturnsPreexistingGroupIfItAlreadyExists() {
    val groupId = "group"
    val protocolType = "consumer"
    val group1 = coordinatorMetadata.addGroup(groupId, protocolType)
    val group2 = coordinatorMetadata.addGroup(groupId, protocolType)
    assertEquals(group1, group2)
  }

  @Test(expected = classOf[IllegalArgumentException])
  def testRemoveNonexistentGroup() {
    val groupId = "group"
    val topics = Set("a")
    coordinatorMetadata.removeGroup(groupId)
  }

}


text:
module ReadabilityImporter
  VERSION = "0.1.3"
end


text:
echo "WRITING KUBE FILES , will overwrite the jsons, then testing pods. is kube clean ready to go?"

#Args below can be overriden when calling from cmd line.
#Just send all the args in order.
#for dev/test you can use:
#kubectl="$GOPATH/src/k8s.io/kubernetes/cluster/kubectl.sh"

kubectl="kubectl"
VERSION="r.2.8.19"
_SECONDS=1000          # number of seconds to measure throughput.
FE="1"                # amount of Web server
LG="1"                # amount of load generators
SLAVE="1"             # amount of redis slaves
TEST="1"              # 0 = Don't run tests, 1 = Do run tests.
NS="default"          # namespace
NODE_PORT=30291     #nodePort, see fe-s.json

kubectl="${1:-$kubectl}"
VERSION="${2:-$VERSION}"
_SECONDS="${3:-$_SECONDS}"   # number of seconds to measure throughput.
FE="${4:-$FE}"       # amount of Web server
LG="${5:-$LG}"        # amount of load generators
SLAVE="${6:-$SLAVE}"     # amount of redis slaves
TEST="${7:-$TEST}"      # 0 = Don't run tests, 1 = Do run tests.
NS="${8:-$NS}"          # namespace
NODE_PORT="${9:-$NODE_PORT}" #nodePort, see fe-s.json
echo "Running w/ args: kubectl $kubectl version $VERSION sec $_SECONDS fe $FE lg $LG slave $SLAVE test = $TEST, NAMESPACE = $NS, NODE_PORT = $NODE_PORT"
function create {

cat << EOF > fe-rc.json
{
  "kind": "ReplicationController",
  "apiVersion": "v1",
  "metadata": {
    "name": "fectrl",
    "labels": {"name": "frontend"}
  },
  "spec": {
    "replicas": $FE,
    "selector": {"name": "frontend"},
    "template": {
      "metadata": {
        "labels": {
          "name": "frontend",
          "uses": "redis-master"
        }
      },
      "spec": {
         "containers": [{
           "name": "frontend-go-restapi",
           "image": "jayunit100/k8-petstore-web-server:$VERSION"
         }]
      }
    }
  }
}
EOF

cat << EOF > bps-load-gen-rc.json
{
  "kind": "ReplicationController",
  "apiVersion": "v1",
  "metadata": {
    "name": "bpsloadgenrc",
    "labels": {"name": "bpsLoadGenController"}
  },
  "spec": {
    "replicas": $LG,
    "selector": {"name": "bps"},
    "template": {
      "metadata": {
        "labels": {
          "name": "bps",
          "uses": "frontend"
        }
      },
      "spec": {
        "containers": [{
           "name": "bps",
           "image": "jayunit100/bigpetstore-load-generator",
           "command": ["sh","-c","/opt/PetStoreLoadGenerator-1.0/bin/PetStoreLoadGenerator http://\$FRONTEND_SERVICE_HOST:3000/rpush/k8petstore/ 4 4 1000 123"]
        }]
      }
    }
  }
}
EOF

cat << EOF > fe-s.json
{
  "kind": "Service",
  "apiVersion": "v1",
  "metadata": {
    "name": "frontend",
    "labels": {
      "name": "frontend"
    }
  },
  "spec": {
    "ports": [{
      "port": 3000,
      "nodePort": $NODE_PORT
    }],
    "selector": {
      "name": "frontend"
    },
    "type": "NodePort"
  }
}
EOF

cat << EOF > rm.json
{
  "kind": "Pod",
  "apiVersion": "v1",
  "metadata": {
    "name": "redismaster",
    "labels": {
      "name": "redis-master"
    }
  },
  "spec": {
    "containers": [{
      "name": "master",
      "image": "jayunit100/k8-petstore-redis-master:$VERSION",
      "ports": [{
        "containerPort": 6379
      }]
    }]
  }
}
EOF

cat << EOF > rm-s.json
{
  "kind": "Service",
  "apiVersion": "v1",
  "metadata": {
    "name": "redismaster",
    "labels": {
      "name": "redis-master"
    }
  },
  "spec": {
    "ports": [{
      "port": 6379
    }],
    "selector": {
      "name": "redis-master"
    }
  }
}
EOF

cat << EOF > rs-s.json
{
  "kind": "Service",
  "apiVersion": "v1",
  "metadata": {
    "name": "redisslave",
    "labels": {
      "name": "redisslave"
    }
  },
  "spec": {
    "ports": [{
      "port": 6379
    }],
    "selector": {
      "name": "redisslave"
    }
  }
}
EOF

cat << EOF > slave-rc.json
{
  "kind": "ReplicationController",
  "apiVersion": "v1",
  "metadata": {
    "name": "redissc",
    "labels": {"name": "redisslave"}
  },
  "spec": {
    "replicas": $SLAVE,
    "selector": {"name": "redisslave"},
    "template": {
      "metadata": {
        "labels": {
          "name": "redisslave",
          "uses": "redis-master"
        }
      },
      "spec": {
         "containers": [{
           "name": "slave",
           "image": "jayunit100/k8-petstore-redis-slave:$VERSION",
           "ports": [{"containerPort": 6379}]
         }]
      }
    }
  }
}
EOF
$kubectl create -f rm.json --namespace=$NS
$kubectl create -f rm-s.json --namespace=$NS
sleep 3 # precaution to prevent fe from spinning up too soon.
$kubectl create -f slave-rc.json --namespace=$NS
$kubectl create -f rs-s.json --namespace=$NS
sleep 3 # see above comment.
$kubectl create -f fe-rc.json --namespace=$NS
$kubectl create -f fe-s.json --namespace=$NS
$kubectl create -f bps-load-gen-rc.json --namespace=$NS
}

#Get the IP addresses of all Kubernetes nodes.
function getIP {
  #currently this script is only tested on GCE. The following line may need to be updated if k8s is not running on a cloud platform
  NODES_IP=$($kubectl get nodes -o go-template='{{range .items}}{{range .status.addresses}}{{if or (eq .type "ExternalIP") (eq .type "LegacyHostIP")}}{{.address}}{{print "\n"}}{{end}}{{end}}{{end}}')
  TEST_IP=$($kubectl get nodes -o go-template='{{range (index .items 0).status.addresses}}{{if eq .type "ExternalIP"}}{{.address}}{{end}}{{end}}')
  if [ -z "$TEST_IP" ]; then
    TEST_IP=$($kubectl get nodes -o go-template='{{range (index .items 0).status.addresses}}{{if eq .type "LegacyHostIP"}}{{.address}}{{end}}{{end}}')
  fi
  if [ -z "$NODES_IP" ]; then
    echo "Error: Can't get node's IP!!!"
    exit 1
  else
    printf '\n\n\n%*s\n' "${COLUMNS:-$(tput cols)}" '' | tr ' ' =
    echo -e "List of nodes' IP addresses:\n$NODES_IP"
    echo -e "Node IP $TEST_IP will be used in the tests in this script"
    printf '%*s\n\n\n\n' "${COLUMNS:-$(tput cols)}" '' | tr ' ' =
  fi
}

function getNodePort {
NODE_PORT=$($kubectl get services/frontend --namespace=$NS -o go-template='{{(index .spec.ports 0).nodePort}}')

if [ -z "$NODE_PORT" ]; then
        echo "Error: Can't get NodePort of services/frontend!!!"
        exit 1
else
        printf '\n\n\n%*s\n' "${COLUMNS:-$(tput cols)}" '' | tr ' ' =
        echo -e "NodePort of services/frontend:\n$NODE_PORT"
        echo -e "WARNING: On cloud platforms like GCE, you may need to add a firewall rule to allow TCP traffic on port $NODE_PORT"
        printf '%*s\n\n\n\n' "${COLUMNS:-$(tput cols)}" '' | tr ' ' =
fi
}

function pollfor {
  pass_http=0

  ### Test HTTP Server comes up.
  for i in `seq 1 150`;
  do
      ### Just testing that the front end comes up.  Not sure how to test total entries etc... (yet)
      echo "Trying curl frontend:3000 via $TEST_IP:$NODE_PORT, attempt ${i}. Expect a few failures while pulling images... "
      curl --max-time 1 --connect-timeout 3 "$TEST_IP:$NODE_PORT" > result
      cat result
      cat result | grep -q "k8-bps"
      if [ $? -eq 0 ]; then
          echo "TEST PASSED after $i tries !"
          i=1000
          break
        else
            echo "the above RESULT didn't contain target string for trial $i"
        fi
        sleep 3
    done

    if [ $i -eq 1000 ]; then
       pass_http=1
    fi
}

function tests {
    pass_load=0

    ### Print statistics of db size, every second, until $SECONDS are up.
    for i in `seq 1 $_SECONDS`;
     do
        echo "curl : $TEST_IP:$NODE_PORT , $i of $_SECONDS"
        curr_cnt="`curl --max-time 1  --connect-timeout 3 "$TEST_IP:$NODE_PORT/llen"`"
        ### Write CSV File of # of trials / total transcations.
        echo "$i $curr_cnt" >> result
        echo "total transactions so far : $curr_cnt"
        sleep 1
  done
}

create

getIP

getNodePort

pollfor

if [[ $pass_http -eq 1 ]]; then
    echo "Passed..."
else
    exit 1
fi

if [[ $TEST -eq 1 ]]; then
    echo "running polling tests now"
    tests
fi


text:
<!-- Start coffee/commands/jqueryClick.coffee -->

Clicks an element using jquery selectors.
### Examples:

    browser.jqueryClick(".classname:first > input:checked")
    browser.jqueryClick("div:has(.classname):contains('something'):last")

Author: maxgalbu

### Params:

* **String** *selector* - jQuery selector for the element
* **Function** *[callback]* - function that will be called after the element is clicked

<!-- End coffee/commands/jqueryClick.coffee -->


text:
package org.scalatest

import org.scalatest.prop.Tables
import org.scalatest.events.Event

trait OrderExpectedResults extends EventHelpers {
  def assertOrderTest(events: List[Event])
}

object ParallelTestExecutionOrderExamples extends Tables {

  def orderSuite = new ExampleParallelTestExecutionOrderSuite
  def orderFixtureSuite = new ExampleParallelTestExecutionOrderFixtureSuite
  def orderSpec = new ExampleParallelTestExecutionOrderSpec
  def orderFixtureSpec = new ExampleParallelTestExecutionOrderFixtureSpec
  def orderFunSuite = new ExampleParallelTestExecutionOrderFunSuite
  def orderFixtureFunSuite = new ExampleParallelTestExecutionOrderFixtureFunSuite
  def orderFunSpec = new ExampleParallelTestExecutionOrderFunSpec
  def orderFixtureFunSpec = new ExampleParallelTestExecutionOrderFixtureFunSpec
  def orderFeatureSpec = new ExampleParallelTestExecutionOrderFeatureSpec
  def orderFixtureFeatureSpec = new ExampleParallelTestExecutionOrderFixtureFeatureSpec
  def orderFlatSpec = new ExampleParallelTestExecutionOrderFlatSpec
  def orderFixtureFlatSpec = new ExampleParallelTestExecutionOrderFixtureFlatSpec
  def orderFreeSpec = new ExampleParallelTestExecutionOrderFreeSpec
  def orderFixtureFreeSpec = new ExampleParallelTestExecutionOrderFixtureFreeSpec
  def orderPropSpec = new ExampleParallelTestExecutionOrderPropSpec
  def orderFixturePropSpec = new ExampleParallelTestExecutionOrderFixturePropSpec
  def orderWordSpec = new ExampleParallelTestExecutionOrderWordSpec
  def orderFixtureWordSpec = new ExampleParallelTestExecutionOrderFixtureWordSpec

  def orderExamples =
    Table(
      "suite1",
      orderSuite,
      orderFixtureSuite,
      orderSpec,
      orderFixtureSpec,
      orderFunSuite,
      orderFixtureFunSuite,
      orderFunSpec,
      orderFixtureFunSpec,
      orderFeatureSpec,
      orderFixtureFeatureSpec,
      orderFlatSpec,
      orderFixtureFlatSpec,
      orderFreeSpec,
      orderFixtureFreeSpec,
      orderPropSpec,
      orderFixturePropSpec,
      orderWordSpec,
      orderFixtureWordSpec
    )
}

@DoNotDiscover
class ExampleParallelTestExecutionOrderSuite extends Suite with OrderExpectedResults with ParallelTestExecution {
  def testMethod1() {}
  def testMethod2() {}
  def testMethod3() {}

  def assertOrderTest(events: List[Event]) {
    assert(events.size === 6)
    checkTestStarting(events(0), "testMethod1")
    checkTestSucceeded(events(1), "testMethod1")
    checkTestStarting(events(2), "testMethod2")
    checkTestSucceeded(events(3), "testMethod2")
    checkTestStarting(events(4), "testMethod3")
    checkTestSucceeded(events(5), "testMethod3")
  }
}

@DoNotDiscover
class ExampleParallelTestExecutionOrderFixtureSuite extends fixture.Suite with OrderExpectedResults with ParallelTestExecution with StringFixture {
  def testFixtureMethod1() {}
  def testFixtureMethod2() {}
  def testFixtureMethod3() {}

  def assertOrderTest(events: List[Event]) {
    assert(events.size === 6)
    checkTestStarting(events(0), "testFixtureMethod1")
    checkTestSucceeded(events(1), "testFixtureMethod1")
    checkTestStarting(events(2), "testFixtureMethod2")
    checkTestSucceeded(events(3), "testFixtureMethod2")
    checkTestStarting(events(4), "testFixtureMethod3")
    checkTestSucceeded(events(5), "testFixtureMethod3")
  }
}

@DoNotDiscover
class ExampleParallelTestExecutionOrderSpec extends Spec with OrderExpectedResults with ParallelTestExecution {
  def `test 1` {}
  def `test 2` {}
  def `test 3` {}

  def assertOrderTest(events: List[Event]) {
    assert(events.size === 6)
    checkTestStarting(events(0), "test 1")
    checkTestSucceeded(events(1), "test 1")
    checkTestStarting(events(2), "test 2")
    checkTestSucceeded(events(3), "test 2")
    checkTestStarting(events(4), "test 3")
    checkTestSucceeded(events(5), "test 3")
  }
}

@DoNotDiscover
class ExampleParallelTestExecutionOrderFixtureSpec extends fixture.Spec with OrderExpectedResults with ParallelTestExecution with StringFixture {
  def `test 1`(fixture: String) {}
  def `test 2`(fixture: String) {}
  def `test 3`(fixture: String) {}

  def assertOrderTest(events: List[Event]) {
    assert(events.size === 6)
    checkTestStarting(events(0), "test 1")
    checkTestSucceeded(events(1), "test 1")
    checkTestStarting(events(2), "test 2")
    checkTestSucceeded(events(3), "test 2")
    checkTestStarting(events(4), "test 3")
    checkTestSucceeded(events(5), "test 3")
  }
}

@DoNotDiscover
class ExampleParallelTestExecutionOrderFunSuite extends FunSuite with OrderExpectedResults with ParallelTestExecution {
  test("Test 1") {}
  test("Test 2") {}
  test("Test 3") {}
  def assertOrderTest(events: List[Event]) {
    assert(events.size === 6)
    checkTestStarting(events(0), "Test 1")
    checkTestSucceeded(events(1), "Test 1")
    checkTestStarting(events(2), "Test 2")
    checkTestSucceeded(events(3), "Test 2")
    checkTestStarting(events(4), "Test 3")
    checkTestSucceeded(events(5), "Test 3")
  }
}

@DoNotDiscover
class ExampleParallelTestExecutionOrderFixtureFunSuite extends fixture.FunSuite with OrderExpectedResults with ParallelTestExecution with StringFixture {
  test("Fixture Test 1") { fixture => }
  test("Fixture Test 2") { fixture => }
  test("Fixture Test 3") { fixture => }
  def assertOrderTest(events: List[Event]) {
    assert(events.size === 6)
    checkTestStarting(events(0), "Fixture Test 1")
    checkTestSucceeded(events(1), "Fixture Test 1")
    checkTestStarting(events(2), "Fixture Test 2")
    checkTestSucceeded(events(3), "Fixture Test 2")
    checkTestStarting(events(4), "Fixture Test 3")
    checkTestSucceeded(events(5), "Fixture Test 3")
  }
}

@DoNotDiscover
class ExampleParallelTestExecutionOrderFunSpec extends FunSpec with OrderExpectedResults with ParallelTestExecution {
  describe("Scope 1") {
    it("Test 1") {}
    it("Test 2") {}
  }
  describe("Scope 2") {
    it("Test 3") {}
    it("Test 4") {}
  }
  def assertOrderTest(events: List[Event]) {
    assert(events.size === 12)
    checkScopeOpened(events(0), "Scope 1")
    checkTestStarting(events(1), "Scope 1 Test 1")
    checkTestSucceeded(events(2), "Scope 1 Test 1")
    checkTestStarting(events(3), "Scope 1 Test 2")
    checkTestSucceeded(events(4), "Scope 1 Test 2")
    checkScopeClosed(events(5), "Scope 1")
    checkScopeOpened(events(6), "Scope 2")
    checkTestStarting(events(7), "Scope 2 Test 3")
    checkTestSucceeded(events(8), "Scope 2 Test 3")
    checkTestStarting(events(9), "Scope 2 Test 4")
    checkTestSucceeded(events(10), "Scope 2 Test 4")
    checkScopeClosed(events(11), "Scope 2")
  }
}

@DoNotDiscover
class ExampleParallelTestExecutionOrderFixtureFunSpec extends fixture.FunSpec with OrderExpectedResults with ParallelTestExecution with StringFixture {
  describe("Fixture Scope 1") {
    it("Fixture Test 1") { fixture => }
    it("Fixture Test 2") { fixture =>}
  }
  describe("Fixture Scope 2") {
    it("Fixture Test 3") { fixture => }
    it("Fixture Test 4") { fixture =>}
  }
  def assertOrderTest(events: List[Event]) {
    assert(events.size === 12)
    checkScopeOpened(events(0), "Fixture Scope 1")
    checkTestStarting(events(1), "Fixture Scope 1 Fixture Test 1")
    checkTestSucceeded(events(2), "Fixture Scope 1 Fixture Test 1")
    checkTestStarting(events(3), "Fixture Scope 1 Fixture Test 2")
    checkTestSucceeded(events(4), "Fixture Scope 1 Fixture Test 2")
    checkScopeClosed(events(5), "Fixture Scope 1")
    checkScopeOpened(events(6), "Fixture Scope 2")
    checkTestStarting(events(7), "Fixture Scope 2 Fixture Test 3")
    checkTestSucceeded(events(8), "Fixture Scope 2 Fixture Test 3")
    checkTestStarting(events(9), "Fixture Scope 2 Fixture Test 4")
    checkTestSucceeded(events(10), "Fixture Scope 2 Fixture Test 4")
    checkScopeClosed(events(11), "Fixture Scope 2")
  }
}

@DoNotDiscover
class ExampleParallelTestExecutionOrderFeatureSpec extends FeatureSpec with OrderExpectedResults with ParallelTestExecution {
  feature("Scope 1") {
    scenario("Test 1") {}
    scenario("Test 2") {}
  }
  feature("Scope 2") {
    scenario("Test 3") {}
    scenario("Test 4") {}
  }
  def assertOrderTest(events: List[Event]) {
    assert(events.size === 12)
    checkScopeOpened(events(0), "Feature: Scope 1")
    checkTestStarting(events(1), "Feature: Scope 1 Scenario: Test 1")
    checkTestSucceeded(events(2), "Feature: Scope 1 Scenario: Test 1")
    checkTestStarting(events(3), "Feature: Scope 1 Scenario: Test 2")
    checkTestSucceeded(events(4), "Feature: Scope 1 Scenario: Test 2")
    checkScopeClosed(events(5), "Feature: Scope 1")
    checkScopeOpened(events(6), "Feature: Scope 2")
    checkTestStarting(events(7), "Feature: Scope 2 Scenario: Test 3")
    checkTestSucceeded(events(8), "Feature: Scope 2 Scenario: Test 3")
    checkTestStarting(events(9), "Feature: Scope 2 Scenario: Test 4")
    checkTestSucceeded(events(10), "Feature: Scope 2 Scenario: Test 4")
    checkScopeClosed(events(11), "Feature: Scope 2")
  }
}

@DoNotDiscover
class ExampleParallelTestExecutionOrderFixtureFeatureSpec extends fixture.FeatureSpec with OrderExpectedResults with ParallelTestExecution with StringFixture {
  feature("Fixture Scope 1") {
    scenario("Fixture Test 1") { fixture => }
    scenario("Fixture Test 2") { fixture =>}
  }
  feature("Fixture Scope 2") {
    scenario("Fixture Test 3") { fixture => }
    scenario("Fixture Test 4") { fixture =>}
  }
  def assertOrderTest(events: List[Event]) {
    assert(events.size === 12)
    checkScopeOpened(events(0), "Feature: Fixture Scope 1")
    checkTestStarting(events(1), "Feature: Fixture Scope 1 Scenario: Fixture Test 1")
    checkTestSucceeded(events(2), "Feature: Fixture Scope 1 Scenario: Fixture Test 1")
    checkTestStarting(events(3), "Feature: Fixture Scope 1 Scenario: Fixture Test 2")
    checkTestSucceeded(events(4), "Feature: Fixture Scope 1 Scenario: Fixture Test 2")
    checkScopeClosed(events(5), "Feature: Fixture Scope 1")
    checkScopeOpened(events(6), "Feature: Fixture Scope 2")
    checkTestStarting(events(7), "Feature: Fixture Scope 2 Scenario: Fixture Test 3")
    checkTestSucceeded(events(8), "Feature: Fixture Scope 2 Scenario: Fixture Test 3")
    checkTestStarting(events(9), "Feature: Fixture Scope 2 Scenario: Fixture Test 4")
    checkTestSucceeded(events(10), "Feature: Fixture Scope 2 Scenario: Fixture Test 4")
    checkScopeClosed(events(11), "Feature: Fixture Scope 2")
  }
}

@DoNotDiscover
class ExampleParallelTestExecutionOrderFlatSpec extends FlatSpec with OrderExpectedResults with ParallelTestExecution {
  behavior of "Scope 1"
  it should "Test 1" in {}
  it should "Test 2" in {}

  behavior of "Scope 2"
  it should "Test 3" in {}
  it should "Test 4" in {}

  def assertOrderTest(events: List[Event]) {
    assert(events.size === 12)
    checkScopeOpened(events(0), "Scope 1")
    checkTestStarting(events(1), "Scope 1 should Test 1")
    checkTestSucceeded(events(2), "Scope 1 should Test 1")
    checkTestStarting(events(3), "Scope 1 should Test 2")
    checkTestSucceeded(events(4), "Scope 1 should Test 2")
    checkScopeClosed(events(5), "Scope 1")
    checkScopeOpened(events(6), "Scope 2")
    checkTestStarting(events(7), "Scope 2 should Test 3")
    checkTestSucceeded(events(8), "Scope 2 should Test 3")
    checkTestStarting(events(9), "Scope 2 should Test 4")
    checkTestSucceeded(events(10), "Scope 2 should Test 4")
    checkScopeClosed(events(11), "Scope 2")
  }
}

@DoNotDiscover
class ExampleParallelTestExecutionOrderFixtureFlatSpec extends fixture.FlatSpec with OrderExpectedResults with ParallelTestExecution with StringFixture {
  behavior of "Fixture Scope 1"
  it should "Fixture Test 1" in { fixture => }
  it should "Fixture Test 2" in { fixture => }

  behavior of "Fixture Scope 2"
  it should "Fixture Test 3" in { fixture => }
  it should "Fixture Test 4" in { fixture => }

  def assertOrderTest(events: List[Event]) {
    assert(events.size === 12)
    checkScopeOpened(events(0), "Fixture Scope 1")
    checkTestStarting(events(1), "Fixture Scope 1 should Fixture Test 1")
    checkTestSucceeded(events(2), "Fixture Scope 1 should Fixture Test 1")
    checkTestStarting(events(3), "Fixture Scope 1 should Fixture Test 2")
    checkTestSucceeded(events(4), "Fixture Scope 1 should Fixture Test 2")
    checkScopeClosed(events(5), "Fixture Scope 1")
    checkScopeOpened(events(6), "Fixture Scope 2")
    checkTestStarting(events(7), "Fixture Scope 2 should Fixture Test 3")
    checkTestSucceeded(events(8), "Fixture Scope 2 should Fixture Test 3")
    checkTestStarting(events(9), "Fixture Scope 2 should Fixture Test 4")
    checkTestSucceeded(events(10), "Fixture Scope 2 should Fixture Test 4")
    checkScopeClosed(events(11), "Fixture Scope 2")
  }
}

@DoNotDiscover
class ExampleParallelTestExecutionOrderFreeSpec extends FreeSpec with OrderExpectedResults with ParallelTestExecution {
  "Scope 1" - {
    "Test 1" in {}
    "Test 2" in {}
  }

  "Scope 2" - {
    "Test 3" in {}
    "Test 4" in {}
  }

  def assertOrderTest(events: List[Event]) {
    assert(events.size === 12)
    checkScopeOpened(events(0), "Scope 1")
    checkTestStarting(events(1), "Scope 1 Test 1")
    checkTestSucceeded(events(2), "Scope 1 Test 1")
    checkTestStarting(events(3), "Scope 1 Test 2")
    checkTestSucceeded(events(4), "Scope 1 Test 2")
    checkScopeClosed(events(5), "Scope 1")
    checkScopeOpened(events(6), "Scope 2")
    checkTestStarting(events(7), "Scope 2 Test 3")
    checkTestSucceeded(events(8), "Scope 2 Test 3")
    checkTestStarting(events(9), "Scope 2 Test 4")
    checkTestSucceeded(events(10), "Scope 2 Test 4")
    checkScopeClosed(events(11), "Scope 2")
  }
}

@DoNotDiscover
class ExampleParallelTestExecutionOrderFixtureFreeSpec extends fixture.FreeSpec with OrderExpectedResults with ParallelTestExecution with StringFixture {
  "Fixture Scope 1" - {
    "Fixture Test 1" in { fixture => }
    "Fixture Test 2" in { fixture => }
  }

  "Fixture Scope 2" - {
    "Fixture Test 3" in { fixture => }
    "Fixture Test 4" in { fixture => }
  }

  def assertOrderTest(events: List[Event]) {
    assert(events.size === 12)
    checkScopeOpened(events(0), "Fixture Scope 1")
    checkTestStarting(events(1), "Fixture Scope 1 Fixture Test 1")
    checkTestSucceeded(events(2), "Fixture Scope 1 Fixture Test 1")
    checkTestStarting(events(3), "Fixture Scope 1 Fixture Test 2")
    checkTestSucceeded(events(4), "Fixture Scope 1 Fixture Test 2")
    checkScopeClosed(events(5), "Fixture Scope 1")
    checkScopeOpened(events(6), "Fixture Scope 2")
    checkTestStarting(events(7), "Fixture Scope 2 Fixture Test 3")
    checkTestSucceeded(events(8), "Fixture Scope 2 Fixture Test 3")
    checkTestStarting(events(9), "Fixture Scope 2 Fixture Test 4")
    checkTestSucceeded(events(10), "Fixture Scope 2 Fixture Test 4")
    checkScopeClosed(events(11), "Fixture Scope 2")
  }
}

@DoNotDiscover
class ExampleParallelTestExecutionOrderPropSpec extends PropSpec with OrderExpectedResults with ParallelTestExecution {
  property("Test 1") {}
  property("Test 2") {}
  property("Test 3") {}

  def assertOrderTest(events: List[Event]) {
    assert(events.size === 6)
    checkTestStarting(events(0), "Test 1")
    checkTestSucceeded(events(1), "Test 1")
    checkTestStarting(events(2), "Test 2")
    checkTestSucceeded(events(3), "Test 2")
    checkTestStarting(events(4), "Test 3")
    checkTestSucceeded(events(5), "Test 3")
  }
}

@DoNotDiscover
class ExampleParallelTestExecutionOrderFixturePropSpec extends fixture.PropSpec with OrderExpectedResults with ParallelTestExecution with StringFixture {
  property("Fixture Test 1") { fixture => }
  property("Fixture Test 2") { fixture => }
  property("Fixture Test 3") { fixture => }

  def assertOrderTest(events: List[Event]) {
    assert(events.size === 6)
    checkTestStarting(events(0), "Fixture Test 1")
    checkTestSucceeded(events(1), "Fixture Test 1")
    checkTestStarting(events(2), "Fixture Test 2")
    checkTestSucceeded(events(3), "Fixture Test 2")
    checkTestStarting(events(4), "Fixture Test 3")
    checkTestSucceeded(events(5), "Fixture Test 3")
  }
}

@DoNotDiscover
class ExampleParallelTestExecutionOrderWordSpec extends WordSpec with OrderExpectedResults with ParallelTestExecution {
  "Scope 1" should {
    "Test 1" in {}
    "Test 2" in {}
  }

  "Scope 2" should {
    "Test 3" in {}
    "Test 4" in {}
  }

  def assertOrderTest(events: List[Event]) {
    assert(events.size === 12)
    checkScopeOpened(events(0), "Scope 1")
    checkTestStarting(events(1), "Scope 1 should Test 1")
    checkTestSucceeded(events(2), "Scope 1 should Test 1")
    checkTestStarting(events(3), "Scope 1 should Test 2")
    checkTestSucceeded(events(4), "Scope 1 should Test 2")
    checkScopeClosed(events(5), "Scope 1")
    checkScopeOpened(events(6), "Scope 2")
    checkTestStarting(events(7), "Scope 2 should Test 3")
    checkTestSucceeded(events(8), "Scope 2 should Test 3")
    checkTestStarting(events(9), "Scope 2 should Test 4")
    checkTestSucceeded(events(10), "Scope 2 should Test 4")
    checkScopeClosed(events(11), "Scope 2")
  }
}

@DoNotDiscover
class ExampleParallelTestExecutionOrderFixtureWordSpec extends fixture.WordSpec with OrderExpectedResults with ParallelTestExecution with StringFixture {
  "Fixture Scope 1" should {
    "Fixture Test 1" in { fixture => }
    "Fixture Test 2" in { fixture => }
  }

  "Fixture Scope 2" should {
    "Fixture Test 3" in { fixture => }
    "Fixture Test 4" in { fixture => }
  }

  def assertOrderTest(events: List[Event]) {
    assert(events.size === 12)
    checkScopeOpened(events(0), "Fixture Scope 1")
    checkTestStarting(events(1), "Fixture Scope 1 should Fixture Test 1")
    checkTestSucceeded(events(2), "Fixture Scope 1 should Fixture Test 1")
    checkTestStarting(events(3), "Fixture Scope 1 should Fixture Test 2")
    checkTestSucceeded(events(4), "Fixture Scope 1 should Fixture Test 2")
    checkScopeClosed(events(5), "Fixture Scope 1")
    checkScopeOpened(events(6), "Fixture Scope 2")
    checkTestStarting(events(7), "Fixture Scope 2 should Fixture Test 3")
    checkTestSucceeded(events(8), "Fixture Scope 2 should Fixture Test 3")
    checkTestStarting(events(9), "Fixture Scope 2 should Fixture Test 4")
    checkTestSucceeded(events(10), "Fixture Scope 2 should Fixture Test 4")
    checkScopeClosed(events(11), "Fixture Scope 2")
  }
}


text:
package com.cloudera.flume.handlers.debug;

import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.cloudera.flume.conf.Context;
import com.cloudera.flume.conf.FlumeConfiguration;
import com.cloudera.flume.conf.SinkFactory.SinkDecoBuilder;
import com.cloudera.flume.core.Event;
import com.cloudera.flume.core.EventSink;
import com.cloudera.flume.core.EventSinkDecorator;
import com.cloudera.flume.reporter.ReportEvent;
import com.cloudera.flume.reporter.Reportable;
import com.cloudera.util.BackoffPolicy;
import com.cloudera.util.CappedExponentialBackoff;
import com.cloudera.util.CumulativeCappedExponentialBackoff;
import com.cloudera.util.MultipleIOException;
import com.google.common.base.Preconditions;

/**
 * This sink decorator attempts to retry appending for up to max millis. This in
 * conjunction with other decorators can make a sink never thrown an exception.
 * This is desired behavior on the retry side of a disk failover log.
 */
public class InsistentAppendDecorator<S extends EventSink> extends
    EventSinkDecorator<S> implements Reportable {
  static final Logger LOG = LoggerFactory
      .getLogger(InsistentAppendDecorator.class);
  final BackoffPolicy backoff;

  // attribute names
  final public static String A_INITIALSLEEP = "intialSleep";
  final public static String A_MAXSLEEP = "maxSleep";
  final public static String A_ATTEMPTS = "appendAttempts";
  final public static String A_REQUESTS = "appendRequests";
  final public static String A_SUCCESSES = "appendSuccessses";
  final public static String A_RETRIES = "appendRetries";
  final public static String A_GIVEUPS = "appendGiveups";

  long appendRequests = 0; // # of times append was called
  long appendAttempts = 0; // # of of times
  long appendSuccesses = 0; // # of times we successfully appended
  long appendRetries = 0; // # of times we tried to reappend
  long appendGiveups = 0; // # of times we gave up on waitingf

  public InsistentAppendDecorator(S s, BackoffPolicy bop) {
    super(s);
    this.backoff = bop;
  }

  /**
   * Creates a deco that has subsink s, and after failure initially waits for
   * 'initial' ms, exponentially backs off an individual sleep upto 'sleepCap'
   * ms, and fails after total backoff time has reached 'cumulativeCap' ms.
   */
  public InsistentAppendDecorator(S s, long initial, long sleepCap,
      long cumulativeCap) {
    super(s);
    this.backoff = new CumulativeCappedExponentialBackoff(initial, sleepCap,
        cumulativeCap);
  }

  /**
   * Creates a deco that has subsink s, and after failure initially waits for
   * 'initial' ms, exponentially backs off an individual sleep upto 'sleepCap'
   * ms. This has no cumulative cap and will never give up.
   */
  public InsistentAppendDecorator(S s, long initial, long sleepCap) {
    super(s);
    this.backoff = new CappedExponentialBackoff(initial, sleepCap);
  }

  /**
   * We have to be careful with this append method -- it has the potential to
   * block forever!
   *
   * @throws InterruptedException
   */
  @Override
  public void append(Event evt) throws IOException, InterruptedException {
    List<IOException> exns = new ArrayList<IOException>();
    int attemptRetries = 0;
    appendRequests++;
    while (!backoff.isFailed() && isOpen.get()
        && !Thread.currentThread().isInterrupted()) {
      try {
        appendAttempts++;
        super.append(evt);
        appendSuccesses++;
        backoff.reset(); // reset backoff counter;
        return;
      } catch (InterruptedException ie) {
        throw ie;
      } catch (IOException e) {
        // this is an unexpected exception
        long waitTime = backoff.sleepIncrement();
        LOG.info("append attempt " + attemptRetries + " failed, backoff ("
            + waitTime + "ms): " + e.getMessage());
        LOG.debug(e.getMessage(), e);
        exns.add((e instanceof IOException) ? (IOException) e
            : new IOException(e));
        backoff.backoff();
        try {
          backoff.waitUntilRetryOk();
        } catch (InterruptedException e1) {
          // got an interrupted signal, bail out!
          throw e1;
        } finally {
          attemptRetries++;
          appendRetries++;
        }
      } catch (RuntimeException e) {
        // this is an unexpected exception
        LOG.info("Failed due to unexpected runtime exception "
            + "during append attempt", e);
        appendGiveups++;
        throw e;
      }
    }
    appendGiveups++;
    // failed to start
    IOException ioe = MultipleIOException.createIOException(exns);
    if (ioe == null) {
      return;
    }
    throw ioe;
  }

  public static SinkDecoBuilder builder() {
    return new SinkDecoBuilder() {
      @Override
      public EventSinkDecorator<EventSink> build(Context context,
          String... argv) {
        long initMs = FlumeConfiguration.get().getInsistentOpenInitBackoff();
        long cumulativeMaxMs = FlumeConfiguration.get()
            .getFailoverMaxCumulativeBackoff();
        long maxSingleMs = FlumeConfiguration.get()
            .getFailoverMaxSingleBackoff();

        Preconditions.checkArgument(argv.length <= 3,
            "usage: insistentAppend([maxSingle=" + maxSingleMs + "[,init="
                + initMs + "[,cumulativeMax=maxint]]])");

        if (argv.length >= 1) {
          maxSingleMs = Long.parseLong(argv[0]);
        }
        if (argv.length >= 2) {
          initMs = Long.parseLong(argv[1]);
        }
        if (argv.length == 3) {
          cumulativeMaxMs = Long.parseLong(argv[2]);
          // This one can give up
          return new InsistentAppendDecorator<EventSink>(null, initMs,
              maxSingleMs, cumulativeMaxMs);
        }

        // This one never gives up
        return new InsistentAppendDecorator<EventSink>(null, initMs,
            maxSingleMs);

      }

    };
  }

  @Override
  public String getName() {
    return "InsistentAppend";
  }

  @Override
  public ReportEvent getMetrics() {
    ReportEvent rpt = super.getMetrics();

    // counters
    rpt.setLongMetric(A_REQUESTS, appendRequests);
    rpt.setLongMetric(A_ATTEMPTS, appendAttempts);
    rpt.setLongMetric(A_SUCCESSES, appendSuccesses);
    rpt.setLongMetric(A_RETRIES, appendRetries);
    rpt.setLongMetric(A_GIVEUPS, appendGiveups);

    return rpt;
  }

  @Override
  public Map<String, Reportable> getSubMetrics() {
    Map<String, Reportable> map = super.getSubMetrics();
    map.put("backoffPolicy." + backoff.getName(), backoff);
    return map;
  }

}


text:
<?php

namespace Oro\Bundle\EmailBundle\Validator;

use Symfony\Component\Validator\Constraint;
use Symfony\Component\Validator\ConstraintValidator;

use Oro\Bundle\FilterBundle\Filter\FilterUtility;
use Oro\Bundle\EmailBundle\Entity\AutoResponseRuleCondition;

class AutoResponseRuleConditionValidator extends ConstraintValidator
{
    /**
     * @param AutoResponseRuleCondition|null $value
     * @param Constraint $constraint
     */
    public function validate($value, Constraint $constraint)
    {
        if (!$value) {
            return;
        }

        if ($this->filterValueShouldBeEmpty($value->getFilterType())) {
            if ($value->getFilterValue()) {
                $this->context->addViolation($constraint->nonEmptyInputMessage);
            }
        } elseif (!$value->getFilterValue()) {
            $this->context->addViolation($constraint->emptyInputMessage);
        }
    }

    /**
     * @param bool $filterType
     */
    protected function filterValueShouldBeEmpty($filterType)
    {
        return in_array($filterType, [FilterUtility::TYPE_EMPTY, FilterUtility::TYPE_NOT_EMPTY]);
    }
}


text:
using System;
using System.Collections.Generic;
using System.Text;
using System.Xml;
using System.Xml.Serialization;
using KMLib.Abstract;

namespace KMLib
{
    public class Polygon : AGeometry
    {
        private BoundaryIs m_OuterBoundaryIs = new BoundaryIs();//--required for all polygons
        private BoundaryIs m_InnerBoundaryIs;//--optional

        [XmlElement("outerBoundaryIs")]
        public BoundaryIs OuterBoundaryIs
        {
            get
            {
                return m_OuterBoundaryIs;
            }
            set
            {
                m_OuterBoundaryIs = value;
            }
        }

        [XmlElement("innerBoundaryIs")]
        public BoundaryIs InnerBoundaryIs
        {
            get
            {
                return m_InnerBoundaryIs;
            }
            set
            {
                m_InnerBoundaryIs = value;
            }
        }
    }
}


text:
-- phpMyAdmin SQL Dump
-- version 4.7.3
-- https://www.phpmyadmin.net/
--
-- Host: localhost
-- Generation Time: Oct 16, 2017 at 12:20 AM
-- Server version: 5.7.19
-- PHP Version: 7.1.8

SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET AUTOCOMMIT = 0;
START TRANSACTION;
SET time_zone = "+00:00";

/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;

--
-- Database: `url_shortener`
--

-- --------------------------------------------------------

--
-- Table structure for table `urls`
--

CREATE TABLE `urls` (
  `id` int(11) NOT NULL,
  `short_url` text NOT NULL,
  `long_url` text NOT NULL,
  `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='saving urls';

--
-- Indexes for dumped tables
--

--
-- Indexes for table `urls`
--
ALTER TABLE `urls`
  ADD PRIMARY KEY (`id`);

--
-- AUTO_INCREMENT for dumped tables
--

--
-- AUTO_INCREMENT for table `urls`
--
ALTER TABLE `urls`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;COMMIT;

/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;


text:
module CanTango
  module Api
    module Attributes
      [:read, :edit].each do |action|
        define_method :"#{action}_attribute" do |name|
          :"#{action}_attr_\#{name}"
        end

        define_method :"#{action}_attributes" do |*names|
          names.select_symbols.map { |name| send("#{action}_attribute", name) }
        end
      end
    end
  end
end