text:
package generator.misc;

import generator.Schema.SchemaObjectInterface;

import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Random;

import org.hsqldb.Server;

/**
 * @author joaoesteves
 * 	The EntityEventNode holds all of the information relating
 *         to a single stage in the generation. This implementation is based on
 *         OrientDB and intents to minimise the memory consumption by storing
 *         the node instances on the disk.
 */
public class EntityEventNodeHSQLDB extends AbstractEntityEventNode  {
	private static final int COMMIT_THRESHOLD = 200000;
	private static final String NODE = "NODE";
	private static final String RELATIONSHIP = "RELATIONSHIP";
	private static final String NODE_PROPERTIES = "NODE_PROPERTIES";
	private static final String _ID_PROPERTY = "id";
	private static final String EMPTY_STRING = "";
	private static String dbURL;
	private static Server hsqlServer = null;
	private static Connection connection;

	/**
	 * holds the number of vertexes created so far
	 */
	private static long numVertexesCreated = 0;
	private static boolean nodesCreatedSinceLastCommit = false;

	/*
	 * Statements
	 *
	 */
	private static PreparedStatement saveNodeStatement;
	private static PreparedStatement createRelStatement;
	private static PreparedStatement createNodePropsStatement;
	private static PreparedStatement updateNodePropsStatement;
	private PreparedStatement countNodesStatement;

	static {
		// TODO: transfer the url into properties
		EntityEventNodeHSQLDB.dbURL = "jdbc:hsqldb:hsql://localhost/dgMaster";
	}

	/**
	 * Entity representation
	 * @author joaoesteves
	 *
	 */
	public static class Node{
		private long id;

		public Node(long id) {
			super();
			this.id = id;
		}

		public boolean createRelationshipTo(Node createdVertex, RelTypes isParent) {
			return createRelationship(id, createdVertex.getId());
		}

		public static boolean createRelationship(long parentId, long childId) {
			try {
				createRelStatement.setLong(1, parentId);
				createRelStatement.setLong(2, childId);
				createRelStatement.addBatch();
			} catch (SQLException e) {
				e.printStackTrace();
				return false;
			}
			return true;
		}

		public boolean setProperty(String name, String value) {
			try {
				PreparedStatement s = updateNodePropsStatement;
				s.setString(1, value);
				s.setLong(2, id);
				s.setString(3, name);
				s.addBatch();
			} catch (SQLException e) {
				e.printStackTrace();
				return false;
			}
			return true;
		}

		public boolean setProperties(Map<String, String> properties, boolean updateOnly) throws SQLException {

			PreparedStatement preparedStatement;
			if(updateOnly){
				preparedStatement = updateNodePropsStatement;
			}else{
				preparedStatement = createNodePropsStatement;
			}
			for(String propName: properties.keySet()){
				if(updateOnly){
				    preparedStatement.setString(1, properties.get(propName));
				    preparedStatement.setLong(2, id);
				    preparedStatement.setString(3, propName);
				}else{
				    preparedStatement.setLong(1, id);
				    preparedStatement.setString(2, propName);
				    preparedStatement.setString(3, properties.get(propName));
				}
			    preparedStatement.addBatch();
			}

			return true;
		}

		public boolean save(String nodeName){
			try {
				saveNodeStatement.setLong(1, id);
				saveNodeStatement.setString(2, nodeName);
				saveNodeStatement.addBatch();
			} catch (SQLException e) {
				e.printStackTrace();
				return false;
			}
			return true;
		}

		public long getId() {
			return id;
		}

		public void setId(long id) {
			this.id = id;
		}

	}

	public EntityEventNodeHSQLDB(SchemaObjectInterface s) throws FileNotFoundException, IOException, SQLException {
		schemaObject = s;
		type = s.getType();
		name = s.getName();
		initDb();
		saveNodeStatement = connection.prepareStatement("insert into "+NODE+" values (?,?)");
		createRelStatement = connection.prepareStatement("insert into "+RELATIONSHIP+" values (?,?)");
		createNodePropsStatement = connection.prepareStatement("insert into "+NODE_PROPERTIES+" values( ?, ?, ?)");
		updateNodePropsStatement = connection.prepareStatement("update "+NODE_PROPERTIES+" set property_value = ? where node_id = ? and property_name = ?");
		countNodesStatement = connection.prepareStatement("select count(*) from node where name = '"+this.name+"'");
	}

	// trees are structured in relation to their parent, so customers parent is
	// branch and its build ratio is 1000, then for every one f th parent make
	// 1000 of child top node only
	public EntityEventNodeHSQLDB(SchemaObjectInterface s, List<SchemaObjectInterface> list) throws FileNotFoundException, IOException, SQLException {
		this(s);
		buildRatioQty = 1;
		children = new ArrayList<EntityEventNodeInterface>();

		buildChildEntityEventNodes(s, list);
	}

	public EntityEventNodeHSQLDB(SchemaObjectInterface s, double b, EntityEventNodeHSQLDB parent, List<SchemaObjectInterface> list) throws FileNotFoundException, IOException, SQLException {
		this(s);
		buildRatioQty = b;
		children = new ArrayList<EntityEventNodeInterface>();
		this.parent = parent;

		buildChildEntityEventNodes(s, list);
	}

	/**
	 * builds the stages according do the total number of instances to be
	 * present in the keyValue Stage.
	 */
	public void keyStageValue(double totalNum) {
		if (this.parent != null) { // then this is not the top
			this.getParent().keyStageValue(totalNum / this.buildRatioQty);
		} else { // at the top
			numVertexesCreated = 0;

			System.out.println("\nBuilding the top node...");
			try {
				doBulkInsertOperation(BulkOperationMoment.START);
				connection.setAutoCommit(false);
				for (double i = 0; i < totalNum; i++) {
					try {
						Node vertex = createVertex(incNumVertexesCreated(), this.name, columns, null);
						for (EntityEventNodeInterface child : this.children) {
							((EntityEventNodeHSQLDB) child).build(vertex.getId());
						}
					} catch (SQLException e) {
						e.printStackTrace();
					}

				}
				commitBatches();
				doBulkInsertOperation(BulkOperationMoment.END);
				connection.setAutoCommit(true);
			} catch (SQLException e) {
				e.printStackTrace();
			}
		}
	}

	private static synchronized long getNumVertexesCreated() {
		synchronized (EntityEventNodeHSQLDB.class) {
			return numVertexesCreated;
		}
	}

	private static synchronized long incNumVertexesCreated() {
		synchronized (EntityEventNodeHSQLDB.class) {
			nodesCreatedSinceLastCommit = true;
			return numVertexesCreated++;
		}
	}

	/**
	 * builds the stage under the parentVertex
	 *
	 * @param createdVertex2
	 */
	public void build(Long parentVertexId) {
		// total amount of values we need to create.
		double total = this.buildRatioQty + leftOver;
		leftOver = total % 1;
		for (double i = 1; i <= total; i++) {
			try {
				Long thisVertexId = (long) incNumVertexesCreated();
				/*Node createdVertex = */createVertex(thisVertexId, this.name, columns, null);

				// build the vertex children
				for (EntityEventNodeInterface child : this.children) {
					((EntityEventNodeHSQLDB) child).build(parentVertexId);
				}

				// create and edge from this vertex to its parent
				createEdgeToParent(thisVertexId, parentVertexId);

				if (nodesCreatedSinceLastCommit && getNumVertexesCreated() % COMMIT_THRESHOLD == 0) {
					try {
						commitBatches();
					} catch (Exception e) {
						e.printStackTrace();
					}
				}
			} catch (SQLException e) {
				e.printStackTrace();
			}
		}
	}

	public String getColumnValue(int id, String columnName, String targetName) {
		if (this.name.equalsIgnoreCase(targetName)) {
			if (columns.indexOf(columnName) != -1) {
				String val = getEntityPropertyValue(id, columnName);
				if (val.contains(SEPARATOR_MULTIFIELD)) { // multiple options
					String[] val2 = val.split(SEPARATOR_MULTIFIELD_REGEX);
					Random rand = new Random();
					if (!isRandomReturnOnMultiFieldColumns()) {
						return val2[rand.nextInt(val2.length)]; // now it should
																// return a
																// random value
																// from the
																// array
					}

					// takes the first one and puts it on the end of the string,
					// and returns it, natural distribution in ordering
					// this approach also allows for control of percentages, if
					// you want 50 , 25, 25 enter the first value twice,
					// followed by the other two individuals.
					String replacement = EMPTY_STRING;
					boolean first = true;
					String returnValue = EMPTY_STRING;

					for (String s : val2) {
						if (first) {
							returnValue = s;
							first = false;
						} else {
							replacement += s + SEPARATOR_MULTIFIELD;
						}
					}
					replacement += returnValue; // now the first value is at the
												// end of the list
					updatePropertyValue(id, columnName, replacement); // update
																		// the
																		// stage
																		// instance
																		// with
																		// the
																		// new
																		// column
																		// value
					return returnValue; // now pass back what was the first
										// entry
				} else
					return val; // just a standard column, return the value
			} else {
				System.out.println("Error: cannot find the Column " + name + " , pls note names must match exactly");
				return EMPTY_STRING;// could not find the column specified
			}
		} else {
			return this.parent.getColumnValue(id, columnName, targetName);
		}
	}

	public static synchronized void initDb() throws FileNotFoundException, IOException, SQLException {
		// 'Server' is a class of HSQLDB representing
        // the database server
        if(hsqlServer != null) return;
        numVertexesCreated = 0;
//        try {
            hsqlServer = new Server();

            // HSQLDB prints out a lot of informations when
            // starting and closing, which we don't need now.
            // Normally you should point the setLogWriter
            // to some Writer object that could store the logs.
            hsqlServer.setLogWriter(null);
            hsqlServer.setSilent(true);

            // The actual database will be named 'xdb' and its
            // settings and data will be stored in files
            // testdb.properties and testdb.script
            hsqlServer.setDatabaseName(0, "dgMaster");
            hsqlServer.setDatabasePath(0, "file:dist/Databuild/db/testdb");

            File folder = new File(ApplicationContext.getDataBuildBaseFolder() + "/db/");
        	folder.delete();

            // Start the database!
            hsqlServer.start();

            connection = null;
            try {
                // Getting a connection to the newly started database
                Class.forName("org.hsqldb.jdbcDriver");
                // Default user of the HSQLDB is 'sa'
                // with an empty password
                connection = DriverManager.getConnection(
                    dbURL, "sa", "");

                try {
					connection.prepareStatement("drop table "+NODE+";").execute();
					connection.prepareStatement("drop table "+RELATIONSHIP+";").execute();
					connection.prepareStatement("drop table "+NODE_PROPERTIES+";").execute();
				} catch (Exception e) {
					//do nothing, tables dont exist
				}
                connection.prepareStatement(
                    "create table node ( id INTEGER, name VARCHAR(16) );").execute();
                connection.prepareStatement(
                    "create table relationship ( node_in_id INTEGER, node_in_out INTEGER);").execute();
                connection.prepareStatement(
                    "create table node_properties ( node_id INTEGER, property_name VARCHAR(32), property_value VARCHAR(128));").execute();

            } catch (ClassNotFoundException e) {
				e.printStackTrace();
			}

	}

	public static void shutdownConnection(){
        // Closing the connection
        if (connection != null) {
            try {
				connection.close();
			} catch (SQLException e) {
				e.printStackTrace();
			}
        }
        // Closing the server
        if (hsqlServer != null) {
            hsqlServer.stop();
            hsqlServer = null;
        }
	}

	/**
	 * Creates an Edge to the parent vertex
	 *
	 * @param createdVertex
	 * @param parentVertex
	 * @return
	 */
	private boolean createEdgeToParent(Long createdVertex, Long parentVertex) {
		return Node.createRelationship(parentVertex, createdVertex);
	}

	/**
	 * Creates a Vertex base on the stage instance object.
	 *
	 * @param schemaObject
	 * @param nodeInstance
	 * @param columnNames
	 * @return
	 * @throws SQLException
	 */
	private Node createVertex(double id, String name, List<String> columnNames, List<String> values) throws SQLException {
		Node newVertex = new Node((long) id);

		Map<String, String> properties = new HashMap<String, String>();
		properties.put(_ID_PROPERTY, ""+id);

		// fill out the properties in the columns
		for (int i = 0; i < columnNames.size(); i++) {
			String value = EMPTY_STRING;
			if (values != null && values.size() > i) {
				value = values.get(i);
			}
			properties.put(columnNames.get(i), value);
		}

		newVertex.setProperties(properties, false);

		newVertex.save(name);
		return newVertex;
	}

	public Long getStageInstancesCount() {
		try {
			ResultSet rs = countNodesStatement.executeQuery();

			// get the number of rows from the result set
			rs.next();
			return rs.getLong(1);
		} catch (SQLException e) {
			e.printStackTrace();
		}
		return 0L;
	}

	private void commitBatches(){
		try {
			System.out.println("\n[COMMIT]  Built " + getNumVertexesCreated() + " vertexes");

			EntityEventNodeHSQLDB.saveNodeStatement.executeBatch();
			EntityEventNodeHSQLDB.createNodePropsStatement.executeBatch();
			EntityEventNodeHSQLDB.createRelStatement.executeBatch();

			//EntityEventNodeHSQLDB.updateNodePropsStatement.executeBatch();
			nodesCreatedSinceLastCommit = false;
			connection.commit();
		} catch (SQLException e) {
			e.printStackTrace();
		}
	}

	private void doBulkInsertOperation(BulkOperationMoment moment) throws SQLException{
		if(moment.equals(BulkOperationMoment.START)){
			connection.prepareStatement("SET FILES LOG FALSE").execute();
			connection.prepareStatement("CHECKPOINT").execute();
		}
		if(moment.equals(BulkOperationMoment.END)){
			connection.prepareStatement("SET FILES LOG TRUE").execute();
			connection.prepareStatement("CHECKPOINT").execute();
		}
	}

	public StageInstanceInterface getStageInstance(int rowRefId) {

		StageInstance nodeInstance = new StageInstance(name, -1);
		for (String propertyKey : columns) {
			// ordering is maintained by the columns array
			// nodeInstance.addValue((String)v.getProperty(propertyKey));
		}

		// TODO: set the parentRefId

		return nodeInstance;

	}

	public void updatePropertyValue(int id, String columnName, String replacement) {
		putValueToStageInstance(id, columnName, replacement);
	}

	public String getEntityPropertyValue(int id, String columnName) {
		// TODO:
		return null;
	}

	public int putValueToStageInstance(int id, String columnName, String value) {
		// TODO:
		return 1;
	}

	public int cleanValuesOfInstance(int id) {
		StringBuilder sb = new StringBuilder();
		sb.append("update ");
		sb.append(name);
		sb.append(" set ");
		for (String fieldName : columns) {
			sb.append(fieldName);
			sb.append(" = '");
			sb.append("null");
			sb.append("'");
		}
		sb.append("where _id = ");
		sb.append(id);
		return -1;
		// TODO:
		// return graph.command(new OCommandSQL(sb.toString())).execute();
	}

	@Override
	protected EntityEventNodeInterface getNewInstanceOfNodeClass(SchemaObjectInterface childFromList, double value, AbstractEntityEventNode abstractEntityEventNode, List<SchemaObjectInterface> list)
			throws FileNotFoundException, IOException, SQLException {
		return new EntityEventNodeHSQLDB(childFromList, value, this, list);
	}

	public static synchronized Server getHsqlServer() {
		return hsqlServer;
	}

	public static synchronized void setHsqlServer(Server hsqlServer) {
		EntityEventNodeHSQLDB.hsqlServer = hsqlServer;
	}

}


text:
namespace PersonGenerator
{
    public enum Gender
    {
        Female,
        Male
    }
}

redpajama_set_name: RedPajamaGithub


text:
<?php
namespace TYPO3\CMS\Extensionmanager\Tests\Unit\Domain\Repository;

/**
 * Test case
 *
 */
class RepositoryRepositoryTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
{
    /**
     * @var \TYPO3\CMS\Extbase\Object\ObjectManagerInterface
     */
    protected $mockObjectManager;

    /**
     * @var \TYPO3\CMS\Extensionmanager\Domain\Repository\RepositoryRepository
     */
    protected $subject;

    protected function setUp()
    {
        $this->mockObjectManager = $this->getMock(\TYPO3\CMS\Extbase\Object\ObjectManagerInterface::class);
        /** @var $subject \TYPO3\CMS\Extensionmanager\Domain\Repository\RepositoryRepository|\PHPUnit_Framework_MockObject_MockObject */
        $this->subject = $this->getMock(\TYPO3\CMS\Extensionmanager\Domain\Repository\RepositoryRepository::class, ['findAll'], [$this->mockObjectManager]);
    }

    /**
     * @test
     */
    public function findOneTypo3OrgRepositoryReturnsNullIfNoRepositoryWithThisTitleExists()
    {
        $this->subject
            ->expects($this->once())
            ->method('findAll')
            ->will($this->returnValue([]));

        $this->assertNull($this->subject->findOneTypo3OrgRepository());
    }

    /**
     * @test
     */
    public function findOneTypo3OrgRepositoryReturnsRepositoryWithCorrectTitle()
    {
        $mockModelOne = $this->getMock(\TYPO3\CMS\Extensionmanager\Domain\Model\Repository::class);
        $mockModelOne
            ->expects(($this->once()))
            ->method('getTitle')
            ->will($this->returnValue('foo'));
        $mockModelTwo = $this->getMock(\TYPO3\CMS\Extensionmanager\Domain\Model\Repository::class);
        $mockModelTwo
            ->expects(($this->once()))
            ->method('getTitle')
            ->will($this->returnValue('TYPO3.org Main Repository'));

        $this->subject
            ->expects($this->once())
            ->method('findAll')
            ->will($this->returnValue([$mockModelOne, $mockModelTwo]));

        $this->assertSame($mockModelTwo, $this->subject->findOneTypo3OrgRepository());
    }
}


text:
package org.mamute.controllers;

import java.util.List;

import org.mamute.model.Vote;
import org.mamute.reputation.rules.KarmaCalculator;

public class RetrieveKarmaDownvote {
	public void retrieveKarma (List<Vote> votes) {
		for (Vote vote : votes) {
			if (vote.isDown()) {
				vote.getAuthor().descreaseKarma(KarmaCalculator.DOWNVOTED_QUESTION_OR_ANSWER);
			}
		}
	}
}


text:
/*
 * TODO: overflow: scroll or dragging implementation for inbox container,
 * TODO: dostrings.
 */

var EVENT_ONLINE = 0,
    EVENT_OFFLINE = 1;

$(document).ready(function() {
    $("#messageform").live("submit", function() {
        im.sendMessage($(this));
        return false;
    }).live("keypress", function(event) {
        if (event.keyCode === 13) {
            im.sendMessage($(this));
            return false;
        };
    });

    $(window).unload(function() { im.sendEvent(EVENT_OFFLINE); });
    $("#message").focus();
    $.ajaxSetup({dataType: "json",
                 error: im.error});

    im.sendEvent(EVENT_ONLINE);
    im.sync();
});

var im = {
    timer: null,
    errorDelay: null,

    sync: function() {
        window.clearTimeout(im.timer);

        $.get(IM_SYNC_URL,
              function(messages) {
                  im.errorDelay = null;
                  $.map(messages.payload, im.showMessage);
              });
        im.timer = window.setTimeout(im.sync, IM_SYNC_DELAY);
    },
    error: function() {
        im.errorDelay = (im.errorDelay)
            ? im.errorDelay * 2
            : IM_SYNC_DELAY;

        $("#messageform :submit").removeAttr("disabled");
        im.timer = window.setTimeout(im.sync, im.errorDelay);
    },
    sendEvent: function(event) {
        $.post(IM_SEND_URL, {"event": event});
    },
    sendMessage: function(form) {
        form.find(":submit").attr("disabled", "disabled");

        $.post(IM_SEND_URL, form.serialize(),
               function(message) {
                   im.showMessage(message.payload);
                   form.find(":submit").removeAttr("disabled");
                   form.find(":text").val("").focus();
               });

    },
    showMessage: function(message) { $("#inbox").append(message); }
};


text:
var view = require('view')

var View = view(require('./template.html'))

module.exports = function (ctx, next) {
  ctx.view = new View()
  next()
}


text:
fhc-create(1)
=============
## SYNOPSIS

 fhc admin environments alias create --environment=<environment> --environmentAlias=<environmentAlias> --environmentLabelAlias=<environmentLabelAlias>

## EXAMPLES

  fhc admin-environment-aliases create --environment=<environment id> --environmentAlias=<environment id alias> --environmentLabelAlias=<environment label alias>    Creates an environment alias

## OPTIONS

  --environment            The name for your environment this alias is targeting  [required]
  --environmentAlias       An aliased name for your environment                   [required]
  --environmentLabelAlias  Description of your environment alias                  [required]

## DESCRIPTION

Creates an environments.


text:
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2018 The Android Open Source Project

     Licensed under the Apache License, Version 2.0 (the "License");
     you may not use this file except in compliance with the License.
     You may obtain a copy of the License at

          http://www.apache.org/licenses/LICENSE-2.0

     Unless required by applicable law or agreed to in writing, software
     distributed under the License is distributed on an "AS IS" BASIS,
     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     See the License for the specific language governing permissions and
     limitations under the License.
-->
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
          package="android.support.customtabs">
    <uses-sdk android:minSdkVersion="16"/>
    <application>
        <activity android:name="android.support.customtabs.TestActivity"
                android:enabled="false">
            <!-- A browsable intent filter is required for the TrustedWebActivityService. -->
            <intent-filter>
                <action android:name="android.intent.action.VIEW"/>
                <category android:name="android.intent.category.DEFAULT" />
                <category android:name="android.intent.category.BROWSABLE"/>
                <data android:scheme="https"
                      android:host="www.example.com"
                      android:pathPrefix="/notifications"/>
            </intent-filter>
            <intent-filter>
                <action android:name="android.intent.action.MAIN"/>
                <category android:name="android.intent.category.DEFAULT" />
            </intent-filter>
        </activity>

        <service android:name="android.support.customtabs.PostMessageService"
                 android:enabled="false"/>

        <service android:name="android.support.customtabs.TestCustomTabsService"
                 android:enabled="false">
            <intent-filter>
                <category android:name="androidx.browser.trusted.category.TrustedWebActivities" />
            </intent-filter>
        </service>

        <service android:name="android.support.customtabs.TestCustomTabsServiceSupportsTwas"
                 android:enabled="false">
            <intent-filter>
                <action android:name="android.support.customtabs.action.CustomTabsService" />
                <category android:name="androidx.browser.trusted.category.TrustedWebActivities" />
                <category android:name="androidx.browser.trusted.category.TrustedWebActivitySplashScreensV1" />
            </intent-filter>
        </service>

        <service android:name="android.support.customtabs.TestCustomTabsServiceNoSplashScreens"
                 android:enabled="false">
            <intent-filter>
                <action android:name="android.support.customtabs.action.CustomTabsService" />
                <category android:name="androidx.browser.trusted.category.TrustedWebActivities" />
            </intent-filter>
        </service>

        <activity android:name=".trusted.TestBrowser"
                  android:theme="@style/Theme.AppCompat.Light"
                  android:exported="true"
                  android:enabled="false">
            <intent-filter>
                <action android:name="android.intent.action.VIEW" />
                <category android:name="android.intent.category.DEFAULT" />
                <category android:name="android.intent.category.BROWSABLE" />

                <data android:scheme="http" />
                <data android:scheme="https" />
            </intent-filter>
        </activity>

        <service android:name="android.support.customtabs.trusted.TestTrustedWebActivityService"
                 android:enabled="false">
            <intent-filter>
                <action android:name="android.support.customtabs.trusted.TRUSTED_WEB_ACTIVITY_SERVICE"/>
                <category android:name="android.intent.category.DEFAULT"/>
            </intent-filter>
        </service>

        <activity android:name="android.support.customtabs.trusted.LauncherActivity"
                  android:label="Test Launcher Activity"
                  android:theme="@style/Theme.AppCompat.Light"
                  android:enabled="false">

            <meta-data android:name="android.support.customtabs.trusted.DEFAULT_URL"
                       android:value="https://www.test.com/default_url/" />

            <meta-data
                android:name="android.support.customtabs.trusted.STATUS_BAR_COLOR"
                android:resource="@color/status_bar_color" />
        </activity>

        <!-- For TWA splash screens -->
        <provider
            android:name="android.support.v4.content.FileProvider"
            android:authorities="android.support.customtabs.trusted.test_fileprovider"
            android:grantUriPermissions="true"
            android:exported="false">
            <meta-data
                android:name="android.support.FILE_PROVIDER_PATHS"
                android:resource="@xml/filepaths" />
        </provider>
    </application>
</manifest>


text:
using UnityEngine;
using System.Collections;

public class MenuText : MonoBehaviour
{
	public int selectedToolbar;
	public TextAsset infoHelp;
	public GUISkin HSL_skin;
	public Rect windowRect = new Rect (80, 80, 120, 80);

//	static int h =Screen.height/10;
//	static int w =Screen.width/10;
	public Rect HelpArea = new Rect (20, 150 ,420,300);

	// Use this for initialization
	void OnGUI ()
	{
		//GUI.color = Color.yellow;
		GUI.skin.button.wordWrap = true;

		GUI.skin = HSL_skin;

		//GUI.Label (new Rect ( 80, 40, 350, 20), "BUSSELTON HOSPITAL COMPLEX");

//		GUI.Label (new Rect (100, 240, 240, 20), "INSTRUCTIONS");
//		GUI.Label (new Rect (100, 270, 240, 20), "Use A. W, D, S keys or the arrow keys");
//		GUI.Label (new Rect (100, 290, 240, 20), "to move through the building");
//		GUI.Label (new Rect (100, 310, 240, 20), "Use the right mouse button to");
//		GUI.Label (new Rect (100, 330, 240, 20), "drive the camera");
//		GUI.Label (new Rect (100, 350, 240, 20), "Turn the Plan Camera on or off");
//		GUI.Label (new Rect (100, 370, 240, 20), "with button in the bottom RH corner");
//		GUI.Label (new Rect (100, 390, 240, 20), "Select Building Area from the tabs at the top of the page");
//		GUI.Label (new Rect (100, 410, 240, 20), "Select Items with Middle Button or the I key");
//		GUI.Label (new Rect (100, 430, 240, 20), "Clear Label with the L key");
//		GUI.Label (new Rect (100, 450, 240, 20), "Rotate and object with the R key");
//		GUI.Label (new Rect (100, 470, 240, 20), "Reverse the rotation with the T key");
		GUI.TextArea(HelpArea,infoHelp.text);

	}

}


text:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

  <meta content="text/html; charset=UTF-8" http-equiv="content-type" />
  <title>Test Suite</title>

Test Suite

MenuTest

GenerateDiffURLValid

GenerateDiffURLInvalidBeforeNB

GenerateDiffURLInvalidAfterNB

GenerateDiffURLInvalidBothNB

GenerateMergeURLValid

GenerateMergeURLInvalidLocalNB

GenerateMergeURLInvalidRemoteNB

GenerateMergeURLInvalidBaseNB

GenerateMergeURLInvalidAllNB

GenerateMergeInvalidNoNB

GenerateDiffInvalidNoNB

GetComparisonValid

GetComparisonInvalid

MergeCellControls


text:
package kkok

import (
	"time"

	"github.com/cybozu-go/well"
)

const (
	defaultInitialInterval = 30
	defaultMaxInterval     = 30
	defaultAddr            = ":19898"
)

// Config is a struct to load TOML configuration file for kkok.
type Config struct {
	// InitialInterval specifies the initial interval seconds
	// to pool posted alerts before procession.
	// Default is 30 (seconds).
	InitialInterval int `toml:"initial_interval"`

	// MaxInterval specifies the maximum interval seconds to
	// pool posted alerts.  The interval begins with InitialInterval
	// then doubles if one or more alerts are posted during the
	// interval until it reaches MaxInterval.
	//
	// The interval will return to InitialInterval if no alerts are
	// posted during the current interval.
	//
	// Default is 30 (seconds).
	MaxInterval int `toml:"max_interval"`

	// Addr is the listen address for HTTP API.
	//
	// Default is ":19898"
	Addr string `toml:"listen"`

	// APIToken is used for API authentication if not empty.
	//
	// Default is empty.
	APIToken string `toml:"api_token"`

	// Log from cybozu-go/well.
	Log well.LogConfig `toml:"log"`

	// Sources is a list of parameters to construct alert generators.
	Sources []PluginParams `toml:"source"`

	// Routes is a map between route ID and a list of transports.
	Routes map[string][]PluginParams `toml:"route"`

	// Filters is a list of parameters to construct filters.
	Filters []PluginParams `toml:"filter"`
}

// InitialDuration returns the initial dispatch interval.
func (c *Config) InitialDuration() time.Duration {
	return time.Second * time.Duration(c.InitialInterval)
}

// MaxDuration returns the maximum dispatch interval.
func (c *Config) MaxDuration() time.Duration {
	return time.Second * time.Duration(c.MaxInterval)
}

// NewConfig returns *Config with default settings.
func NewConfig() *Config {
	return &Config{
		InitialInterval: defaultInitialInterval,
		MaxInterval:     defaultMaxInterval,
		Addr:            defaultAddr,
	}
}


text:
package org.apache.river.test.impl.outrigger.matching;

import java.util.logging.Level;

// Test harness specific classes
import org.apache.river.qa.harness.TestException;
import org.apache.river.qa.harness.QAConfig;

// All other imports
import org.apache.river.qa.harness.Test;
import java.rmi.*;
import java.util.List;
import java.util.Iterator;
import net.jini.core.entry.Entry;
import net.jini.space.JavaSpace;

/**
 * JavaSpaces test that registers with a space for write events using
 * all wildcard templates from each class in the UniqueEntry hierarchy
 * and then writes a number of entry and makes sure all the appropriate
 * matches come back
 */
public class SupertypeNotifyTest extends MatchTestBase {
    private NotifyTestUtil testUtil;

    /**
     * Sets up the testing environment.
     *
     * @param config Arguments from the runner for construct.
     */
    public Test construct(QAConfig config) throws Exception {
        super.construct(config);
        this.parse();
        return this;
    }

    protected void parse() throws Exception {
        super.parse();
        testUtil = new NotifyTestUtil(getConfig(), this);
    }

    public void run() throws Exception {
        testUtil.init((JavaSpaceAuditor) space);

        // Register for events
        int count = 0;

        for (Iterator i = writeList.iterator(); i.hasNext();) {
            final Entry toRegister = (Entry) i.next();
            final TemplateGenerator gen = new SuperclassTmplGen(toRegister);

            if (gen != null) {
                Entry tmpl;

                while ((tmpl = gen.next()) != null) {
                    testUtil.registerForNotify(tmpl);
                    logger.log(Level.INFO, "Notify Registration " + ++count);
                }
            }
        }
        spaceSet();
        writeBunch();
        final String rslt = testUtil.waitAndCheck();

        if (rslt != null) {
            throw new TestException(rslt);
        }
    }
}


text:
<!DOCTYPE html>

		<meta charset="utf-8">
		<meta http-equiv="X-UA-Compatible" content="IE=edge">
		<meta name="viewport" content="width=device-width, initial-scale=1">

		<title>CSR - Geo Test - draft</title>

		<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">

			Draft system for UI only, not fully integrated into CMS

{{gc.appName}}, {{gc.version}}

Welcome {{gc.cmsUsername}}

Click Start to begin...

{{gc.confirmationMessage}}

			Get Fake Loc
			{{gc.buttonText}}
			Save

				Location Name

				<input type="text" id="locationName" ng-model="gc.newLocation_newTitle" placeholder="Enter a name" class="form-control">

				Address
				<input type="text" id="locationAddress" placeholder="Enter an address" class="form-control">

				Block code
				<input type="text" id="locationBlockCode" placeholder="Enter a block code" class="form-control">

				Date of Construction
				<input type="text" id="locationYear" placeholder="Enter the year" class="form-control">

				Architect / Designer
				<input type="text" id="locationDesigner" placeholder="Enter architect / designer" class="form-control">

				Style
				<input type="text" id="locationStyle" placeholder="Enter style" class="form-control">

				Location Type
				<input type="text" id="locationTypeText" placeholder="Enter a type" class="form-control">

				Condition
				<select id="locationCondition" class="form-control" ng-model="gc.newLocation_locationType">
  					<option>Good</option>
  					<option>Bad</option>
  					<option>Ruined</option>
				</select>

				Target Group
				<input type="text" id="locationTargetGroup" placeholder="Enter target group" class="form-control">

				Notes
				<textarea id="privateNotes" class="form-control" rows="6"
				  ng-model="gc.newLocation_privateNote"
				  placeholder="Enter your notes here"
				  >
				</textarea>

				Type (choose one)
				<select id="locationType" class="form-control" ng-model="gc.newLocation_locationType">
  					<option>Tangible Heritage</option>
  					<option>Intangible Heritage</option>
				</select>

				Tangible Heritage subcategories

				 <input type="checkbox" name="animal" value="urban_staircase" /> Urban Staircase

				 <input type="checkbox" name="animal" value="urban_staircase" /> Informal/ Publicly Used Space

				 <input type="checkbox" name="animal" value="urban_staircase" /> Heritage Buildings

				 <input type="checkbox" name="animal" value="urban_staircase" /> Vintage Hotels

				 <input type="checkbox" name="animal" value="urban_staircase" /> Vintage Restaurants and cafes

				 <input type="checkbox" name="animal" value="urban_staircase" /> Cinemas/theaters

				 <input type="checkbox" name="animal" value="urban_staircase" /> Art and Culture

				 <input type="checkbox" name="animal" value="urban_staircase" /> Institutions/associations

				 <input type="checkbox" name="animal" value="urban_staircase" /> Vacant structures/plots

				 <input type="checkbox" name="animal" value="urban_staircase" /> Public/open spaces

				 <input type="checkbox" name="animal" value="urban_staircase" /> Transportations Hubs

				 <input type="checkbox" name="animal" value="urban_staircase" /> Market Places/Specialized Markets

				 <input type="checkbox" name="animal" value="urban_staircase" /> Street Names/vintage signs

				Save Changes
				Close this form

					lat
					lng

Loading page...


text:
package com.limemobile.app.plugin;

import android.content.ContentProvider;
import android.content.Context;
import android.content.pm.ProviderInfo;
import android.content.res.Configuration;

import com.limemobile.app.plugin.internal.PluginClientInfo;

public abstract class PluginHostContentProvider extends ContentProvider
		implements IPluginContentProvider {
	protected PluginClientInfo mPluginPackage;

	protected ContentProvider mProxyContentProvider;

	@Override
	public void setDelegate(ContentProvider pluginHostContentProvider,
			PluginClientInfo pluginPackage) {
		this.mProxyContentProvider = pluginHostContentProvider;
		this.mPluginPackage = pluginPackage;
	}

	@Override
	public void onConfigurationChanged(Configuration newConfig) {
		if (mProxyContentProvider == null) {
			super.onConfigurationChanged(newConfig);
		}
	}

	@Override
	public void onLowMemory() {
		if (mProxyContentProvider == null) {
			super.onLowMemory();
		}
	}

	@Override
	public void attachInfo(Context context, ProviderInfo info) {
		if (mProxyContentProvider == null) {
			super.attachInfo(context, info);
		}
	}

	@Override
	public void shutdown() {
		if (mProxyContentProvider == null) {
			super.shutdown();
		}
	}

}


text: {{data.name}}


text:
<?php

use Symfony\Component\Config\Loader\LoaderInterface;
use Symfony\Component\HttpKernel\Kernel;

class AppKernel extends Kernel
{
    public function registerBundles()
    {
        $bundles = array(
            new Symfony\Bundle\FrameworkBundle\FrameworkBundle(),
            new Symfony\Bundle\SecurityBundle\SecurityBundle(),
            new Symfony\Bundle\TwigBundle\TwigBundle(),
            new Symfony\Bundle\MonologBundle\MonologBundle(),
            new Symfony\Bundle\SwiftmailerBundle\SwiftmailerBundle(),
            new Symfony\Bundle\AsseticBundle\AsseticBundle(),
            new Doctrine\Bundle\DoctrineBundle\DoctrineBundle(),
            new Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle(),
            new Core\CoreBundle\CoreCoreBundle(),
            new Core\SearchengineBundle\CoreSearchengineBundle(),
            new Core\LayoutBundle\CoreLayoutBundle(),
            new Core\AdminBundle\CoreAdminBundle(),
            new Core\ProjectBundle\CoreProjectBundle(),
            new Core\SearchBundle\CoreSearchBundle(),
            new Core\DashboardBundle\CoreDashboardBundle(),
            new LogAnalyserBundle\LogAnalyserBundle(),
            new ViewerBundle\ViewerBundle(),
            new eZPublishBundle\eZPublishBundle(),
            new LogTrackerBundle\LogTrackerBundle(),
        );

        if (in_array($this->getEnvironment(), array('dev', 'test'))) {
            $bundles[] = new Symfony\Bundle\DebugBundle\DebugBundle();
            $bundles[] = new Symfony\Bundle\WebProfilerBundle\WebProfilerBundle();
            $bundles[] = new Sensio\Bundle\DistributionBundle\SensioDistributionBundle();
            $bundles[] = new Sensio\Bundle\GeneratorBundle\SensioGeneratorBundle();
            $bundles[] = new TestBundle\TestBundle();
        }

        return $bundles;
    }

    public function registerContainerConfiguration(LoaderInterface $loader)
    {
        $loader->load(__DIR__ . '/config/config_' . $this->getEnvironment() . '.yml');
    }
}


text:
package org.redisson.reactive;

import java.io.IOException;
import java.util.Collection;
import java.util.concurrent.TimeUnit;

import org.reactivestreams.Publisher;
import org.redisson.RedissonReference;
import org.redisson.api.RFuture;
import org.redisson.api.RObjectAsync;
import org.redisson.api.RObjectReactive;
import org.redisson.client.codec.Codec;
import org.redisson.command.CommandReactiveExecutor;
import org.redisson.misc.RedissonObjectFactory;

import io.netty.buffer.ByteBuf;
import reactor.fn.Supplier;
import reactor.rx.Stream;
import reactor.rx.Streams;

/**
 * Base Redisson object
 *
 * @author Nikita Koksharov
 *
 */
abstract class RedissonObjectReactive implements RObjectReactive {

    final CommandReactiveExecutor commandExecutor;
    private final String name;
    final Codec codec;
    protected RObjectAsync instance;

    public RedissonObjectReactive(Codec codec, CommandReactiveExecutor commandExecutor, String name, RObjectAsync instance) {
        this.codec = codec;
        this.name = name;
        this.commandExecutor = commandExecutor;
        this.instance = instance;
    }

    public <R> Publisher<R> reactive(Supplier<RFuture<R>> supplier) {
        return commandExecutor.reactive(supplier);
    }

    public RedissonObjectReactive(CommandReactiveExecutor commandExecutor, String name, RObjectAsync instance) {
        this(commandExecutor.getConnectionManager().getCodec(), commandExecutor, name, instance);
    }

    protected <V> Stream<V> newSucceeded(V result) {
        return Streams.just(result);
    }

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

    @Override
    public Codec getCodec() {
        return codec;
    }

    protected void encode(Collection<Object> params, Collection<?> values) {
        for (Object object : values) {
            params.add(encode(object));
        }
    }

    protected ByteBuf encode(Object value) {
        if (commandExecutor.isRedissonReferenceSupportEnabled()) {
            RedissonReference reference = RedissonObjectFactory.toReference(commandExecutor.getConnectionManager().getCfg(), value);
            if (reference != null) {
                value = reference;
            }
        }

        try {
            return codec.getValueEncoder().encode(value);
        } catch (IOException e) {
            throw new IllegalArgumentException(e);
        }
    }

    protected ByteBuf encodeMapKey(Object value) {
        if (commandExecutor.isRedissonReferenceSupportEnabled()) {
            RedissonReference reference = RedissonObjectFactory.toReference(commandExecutor.getConnectionManager().getCfg(), value);
            if (reference != null) {
                value = reference;
            }
        }

        try {
            return codec.getMapKeyEncoder().encode(value);
        } catch (IOException e) {
            throw new IllegalArgumentException(e);
        }
    }

    protected ByteBuf encodeMapValue(Object value) {
        if (commandExecutor.isRedissonReferenceSupportEnabled()) {
            RedissonReference reference = RedissonObjectFactory.toReference(commandExecutor.getConnectionManager().getCfg(), value);
            if (reference != null) {
                value = reference;
            }
        }

        try {
            return codec.getMapValueEncoder().encode(value);
        } catch (IOException e) {
            throw new IllegalArgumentException(e);
        }
    }

    @Override
    public Publisher<Void> restore(final byte[] state) {
        return reactive(new Supplier<RFuture<Void>>() {
            @Override
            public RFuture<Void> get() {
                return instance.restoreAsync(state);
            }
        });
    }

    @Override
    public Publisher<Void> restore(final byte[] state, final long timeToLive, final TimeUnit timeUnit) {
        return reactive(new Supplier<RFuture<Void>>() {
            @Override
            public RFuture<Void> get() {
                return instance.restoreAsync(state, timeToLive, timeUnit);
            }
        });
    }

    @Override
    public Publisher<Void> restoreAndReplace(final byte[] state) {
        return reactive(new Supplier<RFuture<Void>>() {
            @Override
            public RFuture<Void> get() {
                return instance.restoreAndReplaceAsync(state);
            }
        });
    }

    @Override
    public Publisher<Void> restoreAndReplace(final byte[] state, final long timeToLive, final TimeUnit timeUnit) {
        return reactive(new Supplier<RFuture<Void>>() {
            @Override
            public RFuture<Void> get() {
                return instance.restoreAndReplaceAsync(state, timeToLive, timeUnit);
            }
        });
    }

    @Override
    public Publisher<byte[]> dump() {
        return reactive(new Supplier<RFuture<byte[]>>() {
            @Override
            public RFuture<byte[]> get() {
                return instance.dumpAsync();
            }
        });
    }

    @Override
    public Publisher<Boolean> touch() {
        return reactive(new Supplier<RFuture<Boolean>>() {
            @Override
            public RFuture<Boolean> get() {
                return instance.touchAsync();
            }
        });
    }

    @Override
    public Publisher<Boolean> unlink() {
        return reactive(new Supplier<RFuture<Boolean>>() {
            @Override
            public RFuture<Boolean> get() {
                return instance.unlinkAsync();
            }
        });
    }

    @Override
    public Publisher<Void> copy(final String host, final int port, final int database, final long timeout) {
        return reactive(new Supplier<RFuture<Void>>() {
            @Override
            public RFuture<Void> get() {
                return instance.copyAsync(host, port, database, timeout);
            }
        });
    }

    @Override
    public Publisher<Void> rename(final String newName) {
        return reactive(new Supplier<RFuture<Void>>() {
            @Override
            public RFuture<Void> get() {
                return instance.renameAsync(newName);
            }
        });
    }

    @Override
    public Publisher<Void> migrate(final String host, final int port, final int database, final long timeout) {
        return reactive(new Supplier<RFuture<Void>>() {
            @Override
            public RFuture<Void> get() {
                return instance.migrateAsync(host, port, database, timeout);
            }
        });
    }

    @Override
    public Publisher<Boolean> move(final int database) {
        return reactive(new Supplier<RFuture<Boolean>>() {
            @Override
            public RFuture<Boolean> get() {
                return instance.moveAsync(database);
            }
        });
    }

    @Override
    public Publisher<Boolean> renamenx(final String newName) {
        return reactive(new Supplier<RFuture<Boolean>>() {
            @Override
            public RFuture<Boolean> get() {
                return instance.renamenxAsync(newName);
            }
        });
    }

    @Override
    public Publisher<Boolean> delete() {
        return reactive(new Supplier<RFuture<Boolean>>() {
            @Override
            public RFuture<Boolean> get() {
                return instance.deleteAsync();
            }
        });
    }

    @Override
    public Publisher<Boolean> isExists() {
        return reactive(new Supplier<RFuture<Boolean>>() {
            @Override
            public RFuture<Boolean> get() {
                return instance.isExistsAsync();
            }
        });
    }

}


text:
        <svg class="checkmark" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 52 52"><circle class="checkmark__circle" cx="26" cy="26" r="25" fill="none"/><path class="checkmark__check" fill="none" d="M14.1 27.2l7.1 7.2 16.7-16.8"/></svg>

          Your transaction has completed successfully!

Type

Sent

Amount

-{{ transaction.amount | number:'1.8-8' }} {{ coinUnit }}

Fee

-{{ transactionFee }} {{ coinUnit }}

Destination

{{ transaction.destinationAddress }}

        <button type="button" class="btn btn-lg btn-primary" data-dismiss="modal" aria-label="Close" (click)="activeModal.close('Close click')">OK</button>


text:
<?php declare(strict_types=1);

namespace PHPUnit\Framework\TestStatus;

/**
 * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit
 *
 * @psalm-immutable
 */
final class Deprecation extends Known
{
    /**
     * @psalm-assert-if-true Deprecation $this
     */
    public function isDeprecation(): bool
    {
        return true;
    }

    public function asInt(): int
    {
        return 4;
    }

    public function asString(): string
    {
        return 'deprecation';
    }
}


text:
<?php

namespace Aosmak\Laravel\Layer\Sdk\Services\Subservices\Interfaces;

use Aosmak\Laravel\Layer\Sdk\Models\ResponseInterface;

/**
 * Interface NotificationServiceInterface
 * @package namespace Aosmak\Laravel\Layer\Sdk\Services\Subservices\Interfaces
 */
interface NotificationServiceInterface extends BaseServiceInterface
{
    /**
     * Create a notification
     *
     * @param array $data notification data
     *
     * @return \Aosmak\Laravel\Layer\Sdk\Models\ResponseInterface
     */
    public function create(array $data): ResponseInterface;
}


text:
@if (comments_open())
    <h2>Comment Form </h2>

    <?php comments_template(); ?>
    <?php comment_form(); ?>
@endif


text:
test:
	python -m pytest --cov=bread/ test.py


text:
This library provides a set of modules:

 * [`test-utils-common`](test-utils-common) - set of test utilities aimed to deal with common testing routines
 * [`test-utils-akka`](test-utils-akka) - akka test configuration builder
 * [`test-utils-junit`](test-utils-junit) - collection of junit-specific test runners
 * [`test-utils-glassfish`](test-utils-glassfish) - set of utilities on top of embedded glassfish approach
 * [`test-utils-stress`](test-utils-stress) - simple performance measurement tool for multi-threaded environments
 which is useful for performing stress testing
 * [`serialization`](serialization) - set of stream serializers

## Utilities

### test-utils-akka

 * `AkkaUtils` - uri/system configuration builders for [Akka project](http://akka.io/)

### test-utils-common

 * `TRandom` - a wrapper over standard set of random generators with extended features
 * `SocketUtils` - set of utilities for determinig local/remote address availability
 * `SerializationUtils` - assertions for java/jackson (de)serialization cycles
 * `ContractUtils` - set of utilities for perform strong assertion

## Stress-tests framework (test-utils-stress)

### Example

Consider we need to measure performance of code below:

```java
    public class Example {
        public int sleep1 = 10;
        public int sleep2 = 20;

        public long doSomething() throws InterruptedException {
            Thread.sleep(sleep1);
            return sleep2;
        }

        public void doSomethingElse(long sleepTime) throws InterruptedException {
            Thread.sleep(sleepTime);
        }
    }
```

For example we can measure parallel execution of both methods is 10 threads, where each thread (roughly) repeats
execution of following code 400 times on single `Example` instance:

```java
long value = example.doSomething();
example.doSomethingElse(value);
```

This can be done by following code:

```java
    final Example example = new Example();
    StressScenario scenario = StressScenario.of(TimerResolution.NANOSECONDS);
    StressResult result = scenario.measure(10, 400, new Action() {
        @Override
        public void doAction(MeasureProvider p) throws Exception {
            final Long value = p.invoke("code-block1", new Get<Long>() {
                @Override
                public Long get() throws Exception {
                    return example.doSomething();
                }
            });
            p.invoke("code-block2", new Invoke() {
                @Override
                public void invoke() throws Exception {
                    example.doSomethingElse(value);
                }
            });
        }
    });
```

After stress scenario execution `StressResult` report will looks like following example:

    ====== Stress test result ========================
    Threads: .....................10
    Cycles: ......................400
    ==================================================
    ----- Stats for (name: code-block1) -----
    Operations:.............................4000
    Min operation time:.....................10.011 ms
    Max operation time:.....................14.950 ms
    Avg operation time:.....................10.089 ms
    Objective avg runtime:..................4.036 sec
    Total running time (10 workers):........40.357 sec
    Total time per thread:..................12.095 sec
    Running time per thread:................4.036 sec
    Avg wasted time per thread:.............8.059e+03 ms
    Avg thread throughput:..................9.911e+01 op/sec
    Avg throughput:.........................9.911e+02 op/sec
    Errors count:...........................0
    ----- Stats for (name: code-block2) -----
    Operations:.............................4000
    Min operation time:.....................20.014 ms
    Max operation time:.....................21.754 ms
    Avg operation time:.....................20.091 ms
    Objective avg runtime:..................8.036 sec
    Total running time (10 workers):........80.363 sec
    Total time per thread:..................12.100 sec
    Running time per thread:................8.036 sec
    Avg wasted time per thread:.............4.063e+03 ms
    Avg thread throughput:..................4.977e+01 op/sec
    Avg throughput:.........................4.977e+02 op/sec
    Errors count:...........................0
    ==================================================
    Total error count:............0
    Total running time:...........12.137 sec
    Approximate throughput:.......3.296e+02 op/sec


text:
require 'rails_helper'
require 'mno_enterprise/testing_support/shared_contexts/rake_task'

describe 'mnoe:locales:generate' do
  include_context 'rake_task'

  let(:generator)  { instance_double("MnoEnterprise::Frontend::LocalesGenerator", generate_json: true)}

  before do
    allow(MnoEnterprise::Frontend::LocalesGenerator).to receive(:new) { generator }
    allow(generator).to receive(:generate_json)
    allow_any_instance_of(Rake::FileUtilsExt).to receive(:cp_r)
  end

  it { expect(subject.prerequisites).to include('environment') }

  it 'creates a generator with the correct folder' do
    subject.invoke
    expect(MnoEnterprise::Frontend::LocalesGenerator).to have_received(:new).with('tmp/build/frontend/src/locales')
  end

  it 'generates the locales' do
    subject.invoke
    expect(generator).to have_received(:generate_json)
  end

  it 'copies the locales to the public folder' do
    expect_any_instance_of(Rake::FileUtilsExt).to receive(:cp_r).with('tmp/build/frontend/src/locales/.', 'public/dashboard/locales/')
    subject.invoke
  end
end


text:
/*
 * SlidingLayerFragment.java
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package ugia.io.androidbeautytreatment.viewcontroller.fragment;

import android.app.Fragment;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.wunderlist.slidinglayer.SlidingLayer;
import com.wunderlist.slidinglayer.transformer.RotationTransformer;
import com.wunderlist.slidinglayer.transformer.SlideJoyTransformer;
import ugia.io.androidbeautytreatment.R;

/**
 * Created by joseluisugia on 18/09/15.
 */
public class SlidingLayerFragment extends Fragment implements ClickableViewController {

    private SlidingLayer slidingLayerLeft;
    private SlidingLayer slidingLayerTop;
    private SlidingLayer slidingLayerRight;
    private SlidingLayer slidingLayerBottom;

    public static SlidingLayerFragment newInstance() {
        return new SlidingLayerFragment();
    }

    @Nullable
    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {

        View view = inflater.inflate(R.layout.fragment_slidinglayer, container, false);

        slidingLayerLeft = (SlidingLayer) view.findViewById(R.id.fs_slidinglayer_left);
        slidingLayerTop = (SlidingLayer) view.findViewById(R.id.fs_slidinglayer_top);
        slidingLayerRight = (SlidingLayer) view.findViewById(R.id.fs_slidinglayer_right);
        slidingLayerBottom = (SlidingLayer) view.findViewById(R.id.fs_slidinglayer_bottom);

        slidingLayerLeft.setLayerTransformer(new RotationTransformer());
        slidingLayerRight.setLayerTransformer(new RotationTransformer());
        slidingLayerTop.setLayerTransformer(new SlideJoyTransformer());
        slidingLayerBottom.setLayerTransformer(new SlideJoyTransformer());

        view.post(new Runnable() {
            @Override
            public void run() {
                slidingLayerLeft.closeLayer(false);
                slidingLayerRight.closeLayer(false);
            }
        });

        return view;
    }

    @Override
    public void buttonClicked(View view) {
        openLayers();
    }

    private void openLayers() {
        slidingLayerLeft.openLayer(true);
        slidingLayerTop.openLayer(true);
        slidingLayerRight.openLayer(true);
        slidingLayerBottom.openLayer(true);
    }
}


text:
html, body {
    margin: 0;
    padding: 0;
}

.mdl-layout__header .mdl-navigation__link {
    line-height: 60px;
    position: relative;
}

.mdl-layout__header .mdl-navigation__link.active {
    border-bottom: 4px solid #ec1460;
}

header.mdl-layout__header {
    padding-top: 30%;
    padding-left: 0;
    background: url('images/top.jpg') center center;
    background-size: cover;
    position: relative;
}

header.mdl-layout__header #logo {
    width: 70px;
    position: absolute;
    left: 50%;
    top: 50%;
    margin-top: -40px;
    margin-left: -35px;
    fill: #fff;
}

header.mdl-layout__header #logo img {
    width: 100%;
}

header.mdl-layout__header .menu {
    width: 100%;
    background: rgba(0,0,0,0.2);
}

header.mdl-layout__header #title {
    position: absolute;
    left: 20px;
    top: 20px;
    text-decoration: none;
    text-transform: uppercase;
    width: 50px;
    line-height: 20px;
    font-size: 13px;
}

.extra-spacing {
    padding: 7% 0;
    text-align: center;
}

.mdl-mega-footer {
    text-align: center;
    padding: 0 0 32px;
}

.mdl-mega-footer a {
    text-decoration: none;
}

.mdl-mega-footer div {
    padding: 0 16px;
}

.mdl-mega-footer--top-section button {
    margin: 0 10px;
}

.mdl-mega-footer--top-section:after, .mdl-mega-footer--middle-section:after {
    border: none;
    margin: 0;
}

.mdl-mega-footer .mdl-mega-footer--top-section {
    padding: 16px 0;
}

.mdl-mega-footer .mdl-mega-footer--middle-section {
    padding: 32px 0 16px;
    text-transform: uppercase;
    font-size: 12px;
}

.mdl-mega-footer .mdl-mega-footer--middle-section a {
    display: inline-block;
    padding: 0 10px;
}

.mdl-mega-footer .mdl-mega-footer--bottom-section {
    padding: 0 0 16px;
    font-size: 14px;
}

.mdl-mega-footer .mdl-mega-footer--bottom-section a {
    display: inline-block;
    padding: 0 5px;
    font-size: 12px;
}

.heading {
    padding: 5% 0;
    text-align: center;
    text-transform: uppercase;
    font-size: 12px;
}

.heading .icon {
    margin-bottom: 10%;
    width: 200px;
}

.heading.products {
    background: url('images/products.jpg') center center no-repeat;
    background-size: cover;
}

.heading.feature-one {
    padding-top: 40%;
    background: url('images/feature_one.jpg') center center no-repeat;
    background-size: cover;
}

.heading.feature-two {
    padding-top: 40%;
    background: url('images/feature_two.jpg') center center no-repeat;
    background-size: cover;
}

#view-source {
    position: fixed;
    display: block;
    right: 0;
    top: 0;
    z-index: 900;
    margin: 40px;
}

#about {
    text-align: left;
}

#about .title {
    text-align: right;
}

@media (max-width: 850px) {
    header.mdl-layout__header {
        padding-top: 10%;
    }
    header.mdl-layout__header #logo {
        width: 40px;
        margin-left: -20px;
    }
    header.mdl-layout__header #title {
        font-size: 12px;
        line-height: 16px;
    }
    .mdl-layout__header .mdl-navigation__link {
        line-height: 52px;
    }
    #view-source {
        margin: 10px;
    }
}

@media (max-width: 600px) {
    #about .title {
        text-align: center;
    }
    header.mdl-layout__header {
        padding-top: 20%;
    }
}


text:
package edu.pitt.dbmi.deepphe.summarization.jess;

import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.Insets;

import javax.swing.BorderFactory;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTextField;
import javax.swing.border.Border;

public class DeepPheSummaryPanel {

	private JPanel panel;
	private JTextField annotatorNameTextField = new JTextField();
	private JTextField annotatorDateTimeField = new JTextField();
	private JTextField leftResultTextField = new JTextField();
	private JTextField rightResultTextField = new JTextField();
	private JTextField foundRightTextField = new JTextField();
	private JTextField foundLeftTextField = new JTextField();
	private JTextField foundBilateralTextField = new JTextField();
	private JTextField foundNonSpecificTextField = new JTextField();
	private JTextField lateralityTextField = new JTextField();

	public DeepPheSummaryPanel() {
	}

	public void inititialize() {
		panel = new JPanel();
		GridBagLayout gridBagLayout = new GridBagLayout();
		panel.setLayout(gridBagLayout);
		Border border = BorderFactory.createTitledBorder("DeepPhe Machine Summary");
		panel.setBorder(border);

		// Annotator
		GridBagConstraints labelGbcs = templateGbcForLabels();
		panel.add(new JLabel("Annotator:"), labelGbcs);
		GridBagConstraints textFieldGbcs = templateGbcForTextFields();
		textFieldGbcs.gridwidth = 3;
		panel.add(annotatorNameTextField, textFieldGbcs);

		// AnnotationDate
		labelGbcs.gridy++;
		panel.add(new JLabel("Annotation Date:"), labelGbcs);
		textFieldGbcs.gridy++;
		panel.add(annotatorDateTimeField, textFieldGbcs);

		// left result
		labelGbcs.gridy++;
		panel.add(new JLabel("Left Result:"), labelGbcs);
		textFieldGbcs.gridwidth = 1;
		textFieldGbcs.gridy++;
		panel.add(leftResultTextField, textFieldGbcs);

		// right result
		labelGbcs.gridx += 2;
		panel.add(new JLabel("Right Result:"), labelGbcs);
		textFieldGbcs.gridx += 2;
		panel.add(rightResultTextField, textFieldGbcs);

		// foundLeft
		labelGbcs.gridx = 0;
		labelGbcs.gridy++;
		panel.add(new JLabel("Found Left:"), labelGbcs);
		textFieldGbcs.gridx = 1;
		textFieldGbcs.gridy++;
		panel.add(foundLeftTextField, textFieldGbcs);

		// foundRight
		labelGbcs.gridx += 2;
		panel.add(new JLabel("Found Right:"), labelGbcs);
		textFieldGbcs.gridx += 2;
		panel.add(foundRightTextField, textFieldGbcs);

		// foundBilateral
		labelGbcs.gridx = 0;
		labelGbcs.gridy++;
		panel.add(new JLabel("Found Bilateral"), labelGbcs);

		textFieldGbcs.gridx = 1;
		textFieldGbcs.gridy++;
		panel.add(foundBilateralTextField, textFieldGbcs);

		// foundNonSpecific
		labelGbcs.gridx += 2;
		panel.add(new JLabel("Found NonSpecific:"), labelGbcs);
		textFieldGbcs.gridx += 2;
		panel.add(foundNonSpecificTextField, textFieldGbcs);

		labelGbcs.gridx = 0;
		labelGbcs.gridy++;
		panel.add(new JLabel("Laterality"), labelGbcs);
		textFieldGbcs.gridx = 1;
		textFieldGbcs.gridy++;
		panel.add(lateralityTextField, textFieldGbcs);
	}

	private GridBagConstraints templateGbcForLabels() {
		GridBagConstraints gbc = new GridBagConstraints();
		gbc.gridx = 0;
		gbc.gridy = 0;
		gbc.gridheight = 1;
		gbc.gridwidth = 1;
		gbc.weightx = 0.0;
		gbc.weighty = 0.0;
		gbc.anchor = GridBagConstraints.NORTHEAST;
		gbc.fill = GridBagConstraints.NONE;
		gbc.insets = new Insets(5, 5, 5, 5);
		gbc.ipadx = 5;
		gbc.ipady = 5;
		return gbc;
	}

	private GridBagConstraints templateGbcForTextFields() {
		GridBagConstraints gbc = new GridBagConstraints();
		gbc.gridx = 1;
		gbc.gridy = 0;
		gbc.gridheight = 1;
		gbc.gridwidth = 1;
		gbc.weightx = 1.0;
		gbc.weighty = 0.0;
		gbc.anchor = GridBagConstraints.NORTHWEST;
		gbc.fill = GridBagConstraints.HORIZONTAL;
		gbc.insets = new Insets(5, 5, 5, 5);
		gbc.ipadx = 5;
		gbc.ipady = 5;
		return gbc;
	}

	public JPanel getPanel() {
		return panel;
	}

	public void setPanel(JPanel panel) {
		this.panel = panel;
	}
}


text:
package com.qiuqp.mybill.bean;

import android.util.Xml;

import com.qiuqp.mybill.AppException;
import com.qiuqp.mybill.common.StringUtils;
import org.xmlpull.v1.XmlPullParser;
import org.xmlpull.v1.XmlPullParserException;

import java.io.IOException;
import java.io.InputStream;
import java.io.Serializable;

/**
 * 通知信息实体类
 * @author liux (http://my.oschina.net/liux)
 * @version 1.0
 * @created 2012-3-21
 */
public class Notice implements Serializable {

	public final static String UTF8 = "UTF-8";
	public final static String NODE_ROOT = "oschina";

	public final static int	TYPE_ATME = 1;
	public final static int	TYPE_MESSAGE = 2;
	public final static int	TYPE_COMMENT = 3;
	public final static int	TYPE_NEWFAN = 4;

	private int atmeCount;
	private int msgCount;
	private int reviewCount;
	private int newFansCount;

	public int getAtmeCount() {
		return atmeCount;
	}
	public void setAtmeCount(int atmeCount) {
		this.atmeCount = atmeCount;
	}
	public int getMsgCount() {
		return msgCount;
	}
	public void setMsgCount(int msgCount) {
		this.msgCount = msgCount;
	}
	public int getReviewCount() {
		return reviewCount;
	}
	public void setReviewCount(int reviewCount) {
		this.reviewCount = reviewCount;
	}
	public int getNewFansCount() {
		return newFansCount;
	}
	public void setNewFansCount(int newFansCount) {
		this.newFansCount = newFansCount;
	}

	public static Notice parse(InputStream inputStream) throws IOException, AppException {
		Notice notice = null;
        //获得XmlPullParser解析器
        XmlPullParser xmlParser = Xml.newPullParser();
        try {
            xmlParser.setInput(inputStream, UTF8);
            //获得解析到的事件类别,这里有开始文档,结束文档,开始标签,结束标签,文本等等事件。
            int evtType=xmlParser.getEventType();
			//一直循环,直到文档结束
			while(evtType!=XmlPullParser.END_DOCUMENT){
	    		String tag = xmlParser.getName();
			    switch(evtType){
			    	case XmlPullParser.START_TAG:
			            //通知信息
			            if(tag.equalsIgnoreCase("notice"))
			    		{
			            	notice = new Notice();
			    		}
			            else if(notice != null)
			    		{
			    			if(tag.equalsIgnoreCase("atmeCount"))
				            {
			    				notice.setAtmeCount(StringUtils.toInt(xmlParser.nextText(),0));
				            }
				            else if(tag.equalsIgnoreCase("msgCount"))
				            {
				            	notice.setMsgCount(StringUtils.toInt(xmlParser.nextText(),0));
				            }
				            else if(tag.equalsIgnoreCase("reviewCount"))
				            {
				            	notice.setReviewCount(StringUtils.toInt(xmlParser.nextText(),0));
				            }
				            else if(tag.equalsIgnoreCase("newFansCount"))
				            {
				            	notice.setNewFansCount(StringUtils.toInt(xmlParser.nextText(),0));
				            }
			    		}
			    		break;
			    	case XmlPullParser.END_TAG:
				       	break;
			    }
			    //如果xml没有结束,则导航到下一个节点
			    evtType=xmlParser.next();
			}
        } catch (XmlPullParserException e) {
			throw AppException.xml(e);
        } finally {
        	inputStream.close();
        }
        return notice;
	}
}


text:
package ssh

import (
	"fmt"
	"io"
	"io/ioutil"
	"os"
	"os/exec"
	"runtime"
	"strings"

	"github.com/docker/docker/pkg/term"
	"github.com/docker/machine/libmachine/log"
	"github.com/docker/machine/libmachine/mcnutils"
	"golang.org/x/crypto/ssh"
	"golang.org/x/crypto/ssh/terminal"
)

type Client interface {
	Output(command string) (string, error)
	Shell(args ...string) error

	// Start starts the specified command without waiting for it to finish. You
	// have to call the Wait function for that.
	//
	// The first two io.ReadCloser are the standard output and the standard
	// error of the executing command respectively. The returned error follows
	// the same logic as in the exec.Cmd.Start function.
	Start(command string) (io.ReadCloser, io.ReadCloser, error)

	// Wait waits for the command started by the Start function to exit. The
	// returned error follows the same logic as in the exec.Cmd.Wait function.
	Wait() error
}

type ExternalClient struct {
	BaseArgs   []string
	BinaryPath string
	cmd        *exec.Cmd
}

type NativeClient struct {
	Config      ssh.ClientConfig
	Hostname    string
	Port        int
	openSession *ssh.Session
}

type Auth struct {
	Passwords []string
	Keys      []string
}

type ClientType string

const (
	maxDialAttempts = 10
)

const (
	External ClientType = "external"
	Native   ClientType = "native"
)

var (
	baseSSHArgs = []string{
		"-F", "/dev/null",
		"-o", "PasswordAuthentication=no",
		"-o", "StrictHostKeyChecking=no",
		"-o", "UserKnownHostsFile=/dev/null",
		"-o", "LogLevel=quiet", // suppress "Warning: Permanently added '[localhost]:2022' (ECDSA) to the list of known hosts."
		"-o", "ConnectionAttempts=3", // retry 3 times if SSH connection fails
		"-o", "ConnectTimeout=10", // timeout after 10 seconds
		"-o", "ControlMaster=no", // disable ssh multiplexing
		"-o", "ControlPath=none",
	}
	defaultClientType = External
)

func SetDefaultClient(clientType ClientType) {
	// Allow over-riding of default client type, so that even if ssh binary
	// is found in PATH we can still use the Go native implementation if
	// desired.
	switch clientType {
	case External:
		defaultClientType = External
	case Native:
		defaultClientType = Native
	}
}

func NewClient(user string, host string, port int, auth *Auth) (Client, error) {
	sshBinaryPath, err := exec.LookPath("ssh")
	if err != nil {
		log.Debug("SSH binary not found, using native Go implementation")
		client, err := NewNativeClient(user, host, port, auth)
		log.Debug(client)
		return client, err
	}

	if defaultClientType == Native {
		log.Debug("Using SSH client type: native")
		client, err := NewNativeClient(user, host, port, auth)
		log.Debug(client)
		return client, err
	}

	log.Debug("Using SSH client type: external")
	client, err := NewExternalClient(sshBinaryPath, user, host, port, auth)
	log.Debug(client)
	return client, err
}

func NewNativeClient(user, host string, port int, auth *Auth) (Client, error) {
	config, err := NewNativeConfig(user, auth)
	if err != nil {
		return nil, fmt.Errorf("Error getting config for native Go SSH: %s", err)
	}

	return &NativeClient{
		Config:   config,
		Hostname: host,
		Port:     port,
	}, nil
}

func NewNativeConfig(user string, auth *Auth) (ssh.ClientConfig, error) {
	var (
		authMethods []ssh.AuthMethod
	)

	for _, k := range auth.Keys {
		key, err := ioutil.ReadFile(k)
		if err != nil {
			return ssh.ClientConfig{}, err
		}

		privateKey, err := ssh.ParsePrivateKey(key)
		if err != nil {
			return ssh.ClientConfig{}, err
		}

		authMethods = append(authMethods, ssh.PublicKeys(privateKey))
	}

	for _, p := range auth.Passwords {
		authMethods = append(authMethods, ssh.Password(p))
	}

	return ssh.ClientConfig{
		User: user,
		Auth: authMethods,
	}, nil
}

func (client *NativeClient) dialSuccess() bool {
	if _, err := ssh.Dial("tcp", fmt.Sprintf("%s:%d", client.Hostname, client.Port), &client.Config); err != nil {
		log.Debugf("Error dialing TCP: %s", err)
		return false
	}
	return true
}

func (client *NativeClient) session(command string) (*ssh.Session, error) {
	if err := mcnutils.WaitFor(client.dialSuccess); err != nil {
		return nil, fmt.Errorf("Error attempting SSH client dial: %s", err)
	}

	conn, err := ssh.Dial("tcp", fmt.Sprintf("%s:%d", client.Hostname, client.Port), &client.Config)
	if err != nil {
		return nil, fmt.Errorf("Mysterious error dialing TCP for SSH (we already succeeded at least once) : %s", err)
	}

	return conn.NewSession()
}

func (client *NativeClient) Output(command string) (string, error) {
	session, err := client.session(command)
	if err != nil {
		return "", nil
	}

	output, err := session.CombinedOutput(command)
	defer session.Close()

	return string(output), err
}

func (client *NativeClient) OutputWithPty(command string) (string, error) {
	session, err := client.session(command)
	if err != nil {
		return "", nil
	}

	fd := int(os.Stdin.Fd())

	termWidth, termHeight, err := terminal.GetSize(fd)
	if err != nil {
		return "", err
	}

	modes := ssh.TerminalModes{
		ssh.ECHO:          0,
		ssh.TTY_OP_ISPEED: 14400,
		ssh.TTY_OP_OSPEED: 14400,
	}

	// request tty -- fixes error with hosts that use
	// "Defaults requiretty" in /etc/sudoers - I'm looking at you RedHat
	if err := session.RequestPty("xterm", termHeight, termWidth, modes); err != nil {
		return "", err
	}

	output, err := session.CombinedOutput(command)
	defer session.Close()

	return string(output), err
}

func (client *NativeClient) Start(command string) (io.ReadCloser, io.ReadCloser, error) {
	session, err := client.session(command)
	if err != nil {
		return nil, nil, err
	}

	stdout, err := session.StdoutPipe()
	if err != nil {
		return nil, nil, err
	}
	stderr, err := session.StderrPipe()
	if err != nil {
		return nil, nil, err
	}
	if err := session.Start(command); err != nil {
		return nil, nil, err
	}

	client.openSession = session
	return ioutil.NopCloser(stdout), ioutil.NopCloser(stderr), nil
}

func (client *NativeClient) Wait() error {
	err := client.openSession.Wait()
	_ = client.openSession.Close()
	client.openSession = nil
	return err
}

func (client *NativeClient) Shell(args ...string) error {
	var (
		termWidth, termHeight int
	)
	conn, err := ssh.Dial("tcp", fmt.Sprintf("%s:%d", client.Hostname, client.Port), &client.Config)
	if err != nil {
		return err
	}

	session, err := conn.NewSession()
	if err != nil {
		return err
	}

	defer session.Close()

	session.Stdout = os.Stdout
	session.Stderr = os.Stderr
	session.Stdin = os.Stdin

	modes := ssh.TerminalModes{
		ssh.ECHO: 1,
	}

	fd := os.Stdin.Fd()

	if term.IsTerminal(fd) {
		oldState, err := term.MakeRaw(fd)
		if err != nil {
			return err
		}

		defer term.RestoreTerminal(fd, oldState)

		winsize, err := term.GetWinsize(fd)
		if err != nil {
			termWidth = 80
			termHeight = 24
		} else {
			termWidth = int(winsize.Width)
			termHeight = int(winsize.Height)
		}
	}

	if err := session.RequestPty("xterm", termHeight, termWidth, modes); err != nil {
		return err
	}

	if len(args) == 0 {
		if err := session.Shell(); err != nil {
			return err
		}
		session.Wait()
	} else {
		session.Run(strings.Join(args, " "))
	}

	return nil
}

func NewExternalClient(sshBinaryPath, user, host string, port int, auth *Auth) (*ExternalClient, error) {
	client := &ExternalClient{
		BinaryPath: sshBinaryPath,
	}

	args := append(baseSSHArgs, fmt.Sprintf("%s@%s", user, host))

	// If no identities are explicitly provided, also look at the identities
	// offered by ssh-agent
	if len(auth.Keys) > 0 {
		args = append(args, "-o", "IdentitiesOnly=yes")
	}

	// Specify which private keys to use to authorize the SSH request.
	for _, privateKeyPath := range auth.Keys {
		if privateKeyPath != "" {
			// Check each private key before use it
			fi, err := os.Stat(privateKeyPath)
			if err != nil {
				// Abort if key not accessible
				return nil, err
			}
			if runtime.GOOS != "windows" {
				mode := fi.Mode()
				log.Debugf("Using SSH private key: %s (%s)", privateKeyPath, mode)
				// Private key file should have strict permissions
				if mode != 0600 {
					// Abort with correct message
					return nil, fmt.Errorf("Permissions %#o for '%s' are too open.", mode, privateKeyPath)
				}
			}
			args = append(args, "-i", privateKeyPath)
		}
	}

	// Set which port to use for SSH.
	args = append(args, "-p", fmt.Sprintf("%d", port))

	client.BaseArgs = args

	return client, nil
}

func getSSHCmd(binaryPath string, args ...string) *exec.Cmd {
	return exec.Command(binaryPath, args...)
}

func (client *ExternalClient) Output(command string) (string, error) {
	args := append(client.BaseArgs, command)
	cmd := getSSHCmd(client.BinaryPath, args...)
	output, err := cmd.CombinedOutput()
	return string(output), err
}

func (client *ExternalClient) Shell(args ...string) error {
	args = append(client.BaseArgs, args...)
	cmd := getSSHCmd(client.BinaryPath, args...)

	log.Debug(cmd)

	cmd.Stdin = os.Stdin
	cmd.Stdout = os.Stdout
	cmd.Stderr = os.Stderr

	return cmd.Run()
}

func (client *ExternalClient) Start(command string) (io.ReadCloser, io.ReadCloser, error) {
	args := append(client.BaseArgs, command)
	cmd := getSSHCmd(client.BinaryPath, args...)

	log.Debug(cmd)

	stdout, err := cmd.StdoutPipe()
	if err != nil {
		return nil, nil, err
	}
	stderr, err := cmd.StderrPipe()
	if err != nil {
		if closeErr := stdout.Close(); closeErr != nil {
			return nil, nil, fmt.Errorf("%s, %s", err, closeErr)
		}
		return nil, nil, err
	}
	if err := cmd.Start(); err != nil {
		stdOutCloseErr := stdout.Close()
		stdErrCloseErr := stderr.Close()
		if stdOutCloseErr != nil || stdErrCloseErr != nil {
			return nil, nil, fmt.Errorf("%s, %s, %s",
				err, stdOutCloseErr, stdErrCloseErr)
		}
		return nil, nil, err
	}

	client.cmd = cmd
	return stdout, stderr, nil
}

func (client *ExternalClient) Wait() error {
	err := client.cmd.Wait()
	client.cmd = nil
	return err
}


text:
package com.withinet.opaas.controller;

import java.io.File;

import org.apache.wicket.markup.html.form.upload.FileUpload;

import com.withinet.opaas.controller.common.FileControllerException;

public interface FileController {

	public String getUsedSpace (Long uid)throws FileControllerException;;

	public boolean flushUserDirectory (Long uid)throws FileControllerException;;

	public boolean flushProjectDirectory (Long pid)throws FileControllerException;;

	public File uploadTempFile (Long uid, FileUpload upload)throws FileControllerException;

	public File uploadToDestFile(Long uid, FileUpload upload, String dest)
			throws FileControllerException;

}


text:
require File.join( File.dirname(__FILE__), "..", "spec_helper" )

describe Batsir::FilterQueue do
  it "can add a filter to a queue" do
    queue = Batsir::FilterQueue.new
    queue.add("Filter")
    expect(queue).to include "Filter"
  end

  it "does not return nil as last operation when no acceptors or notifiers are added" do
    queue = Batsir::FilterQueue.new
    queue.add("AnotherFilter")
    ops = []
    queue.each do |op|
      ops << op
    end
    expect(ops.last).not_to be_nil
  end

  it "can add a notifier" do
    queue = Batsir::FilterQueue.new
    notifier = "Notifier"
    queue.add_notifier(notifier)
    expect(queue).to include notifier
  end

  it "can add multiple notifiers" do
    queue = Batsir::FilterQueue.new
    ops = []
    3.times do |index|
      ops << "Notifier #{index}"
      queue.add_notifier("Notifier #{index}")
    end
    ops.each {|op| expect(queue).to include op}
  end

  it "returns notifiers as the last operations" do
    notifier = "Notifier"
    queue = Batsir::FilterQueue.new
    queue.add("SomeFilter")
    queue.add_notifier(notifier)
    queue.add("AnotherFilter")

    ops = []
    queue.each do |op|
      ops << op
    end
    expect(ops.last).to eq(notifier)
  end

  it "responds true to #empty? when no operations are added" do
    queue = Batsir::FilterQueue.new
    expect(queue).to be_empty
  end

  it "is not empty when a notification operation is added" do
    queue = Batsir::FilterQueue.new
    operation = "Notifier"
    queue.add_notifier(operation)
    expect(queue).not_to be_empty
  end

  it "is not empty when a regular operation is added" do
    queue = Batsir::FilterQueue.new
    queue.add("SomeFilter")
    expect(queue).not_to be_empty
  end
end


text:
ACCEPTED

#### According to
Index Fungorum

#### Published in
Mycologia 37: 797 (1945)

#### Original name
Ceriomyces aureissimus Murrill

### Remarks
null


text:
import rospy
from std_msgs.msg import String
from nav_msgs.msg import Odometry
from geometry_msgs.msg import Pose
from sendemail.sendemailscript import sendmail
import time

class stateChecker:
    def __init__(self):
        self.start_time = time.time()
        self.prevPose = Pose()
        self.emailSent = False

        rospy.init_node('state_checker', anonymous=True)

        self.sender = rospy.get_param('~sender')
        self.sender_password = rospy.get_param('~password')
        self.receiver = rospy.get_param('~receiver')
        self.email_title = rospy.get_param('~email_title')
        self.email_body = rospy.get_param('~email_body')
        self.email_attachment= rospy.get_param('~email_attachment','')
        self.odometry_timeout = float(rospy.get_param('~timeout',90.0)) # seconds

        rospy.Subscriber("odom", Odometry, self.callback)
        print self.sender, self.sender_password, self.receiver, self.email_title, self.email_body

    def callback(self,data):
        if (data.pose.pose.position.x != self.prevPose.position.x):
            self.prevPose = data.pose.pose
            rospy.loginfo(rospy.get_name() + ": I heard %s" % data.pose.pose)
            self.emailSent = False
            self.start_time = time.time()
        else :
            elapsedTime = time.time() - self.start_time
            if (elapsedTime > self.odometry_timeout):
                if (not self.emailSent):
                    print "I haven't moved in ",elapsedTime," seconds. HELP!!!!"
                    sendmail(self.sender, self.sender_password,self.receiver, self.email_title,self.email_body,self.email_attachment)
                    self.emailSent = True

if __name__ == '__main__':
    state_checker = stateChecker()
    rospy.spin()


text:
CREATE FUNCTION tSQLt.Private_GetOriginalTableInfo(@TableObjectId INT)
RETURNS TABLE
AS
  RETURN SELECT CAST(value AS NVARCHAR(4000)) OrgTableName,
                OBJECT_ID(QUOTENAME(OBJECT_SCHEMA_NAME(@TableObjectId)) + '.' + QUOTENAME(CAST(value AS NVARCHAR(4000)))) OrgTableObjectId
    FROM sys.extended_properties
   WHERE class_desc = 'OBJECT_OR_COLUMN'
     AND major_id = @TableObjectId
     AND minor_id = 0
     AND name = 'tSQLt.FakeTable_OrgTableName';


text:
require 'rails_helper'

RSpec.describe DatabasesController, type: :controller do
  fixtures :users

  before(:example) do
    sign_in(User.find_by_login('aadmin'))
  end

  describe 'GET #new' do
    it 'populates @db_types' do
      mock_response = 'stub'
      allow(controller)
        .to receive(:available_db_types)
        .and_return(mock_response)
      get :new
      expect(assigns(:db_types)).to eq(mock_response)
    end
  end

  describe 'GET #edit' do
    let(:db) { FactoryGirl.create(:database) }
    it 'populates @db_types' do
      mock_response = 'stub'
      allow(controller)
        .to receive(:available_db_types)
        .and_return(mock_response)
      get :edit, params: { id: db.id }
      expect(assigns(:db_types)).to eq(mock_response)
    end
  end

  describe 'GET #edit' do
  end

  describe 'available_db_types' do
    describe 'when all dbs enabled' do
      it 'return expected db types' do
        expected_response = [
          %w(MySQL mysql), %w(PostgreSQL postgres), %w(Oracle oracle)
        ]
        feature_response('oracle_db', true)
        feature_response('mysql_db', true)
        feature_response('postgres_db', true)
        expect(controller.available_db_types).to eq(expected_response)
      end
    end
    describe 'when some dbs enabled' do
      it 'return expected db types' do
        expected_response = [
          %w(MySQL mysql)
        ]
        feature_response('oracle_db', false)
        feature_response('mysql_db', true)
        feature_response('postgres_db', false)
        expect(controller.available_db_types).to eq(expected_response)
      end
    end
    describe 'when no dbs enabled' do
      it 'return expected db types' do
        expected_response = [
          ['No DB types available', '']
        ]
        feature_response('oracle_db', false)
        feature_response('mysql_db', false)
        feature_response('postgres_db', false)
        expect(controller.available_db_types).to eq(expected_response)
      end
    end
  end
end

def feature_response(feature, response)
  allow(Rails.configuration.feature_settings)
    .to receive(:[])
    .with(feature)
    .and_return(response)
end


text:
/**
 *
 */
package org.hamster.weixinmp.service;

import static org.hamster.weixinmp.util.WxUtil.getAccessTokenParams;
import static org.hamster.weixinmp.util.WxUtil.sendRequest;

import java.util.Map;

import org.apache.commons.lang3.StringUtils;
import org.hamster.weixinmp.config.WxConfig;
import org.hamster.weixinmp.dao.entity.user.WxUserEntity;
import org.hamster.weixinmp.exception.WxException;
import org.hamster.weixinmp.model.user.WxUserGetJson;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpMethod;
import org.springframework.stereotype.Service;

/**
 * @author honey.zhao@aliyun.com
 * @version Dec 31, 2013
 *
 */
@Service
public class WxUserService {

	@Autowired
	private WxConfig config;

	public WxUserEntity remoteUserInfo(String accessToken, String openId) throws WxException {
		Map<String, String> params = getAccessTokenParams(accessToken);
		params.put("openid", openId);
		return sendRequest(config.getUserInfoUrl(), HttpMethod.GET,
				params, null, WxUserEntity.class);
 	}

	public WxUserGetJson remoteUserGet(String accessToken, String nextOpenId) throws WxException {
		Map<String, String> params = getAccessTokenParams(accessToken);
		if (!StringUtils.isBlank(nextOpenId)) {
			params.put("next_openid", nextOpenId);
		}
		return sendRequest(config.getUserGetUrl(), HttpMethod.GET,
				params, null, WxUserGetJson.class);
	}

	public WxUserGetJson remoteUserGet(String accessToken) throws WxException {
		return remoteUserGet(accessToken, "");
	}
}


text:
#include "charmony.h"

#include <stdio.h>
#include <string.h>

#define CFC_NEED_BASE_STRUCT_DEF
#include "CFCBase.h"
#include "CFCC.h"
#include "CFCCHtml.h"
#include "CFCCMan.h"
#include "CFCClass.h"
#include "CFCDocument.h"
#include "CFCHierarchy.h"
#include "CFCMethod.h"
#include "CFCUri.h"
#include "CFCUtil.h"

struct CFCC {
    CFCBase base;
    CFCHierarchy *hierarchy;
    CFCCHtml     *html_gen;
    char         *c_header;
    char         *c_footer;
    char         *man_header;
    char         *man_footer;
};

static const CFCMeta CFCC_META = {
    "Clownfish::CFC::Binding::C",
    sizeof(CFCC),
    (CFCBase_destroy_t)CFCC_destroy
};

CFCC*
CFCC_new(CFCHierarchy *hierarchy, const char *header, const char *footer) {
    CFCC *self = (CFCC*)CFCBase_allocate(&CFCC_META);
    return CFCC_init(self, hierarchy, header, footer);
}

CFCC*
CFCC_init(CFCC *self, CFCHierarchy *hierarchy, const char *header,
          const char *footer) {
    CFCUTIL_NULL_CHECK(hierarchy);
    CFCUTIL_NULL_CHECK(header);
    CFCUTIL_NULL_CHECK(footer);
    self->hierarchy  = (CFCHierarchy*)CFCBase_incref((CFCBase*)hierarchy);
    self->html_gen   = CFCCHtml_new(hierarchy, header, footer);
    self->c_header   = CFCUtil_make_c_comment(header);
    self->c_footer   = CFCUtil_make_c_comment(footer);
    self->man_header = CFCUtil_make_troff_comment(header);
    self->man_footer = CFCUtil_make_troff_comment(footer);
    return self;
}

void
CFCC_destroy(CFCC *self) {
    CFCBase_decref((CFCBase*)self->hierarchy);
    CFCBase_decref((CFCBase*)self->html_gen);
    FREEMEM(self->c_header);
    FREEMEM(self->c_footer);
    FREEMEM(self->man_header);
    FREEMEM(self->man_footer);
    CFCBase_destroy((CFCBase*)self);
}

void
CFCC_write_html_docs(CFCC *self) {
    CFCCHtml_write_html_docs(self->html_gen);
}

void
CFCC_write_man_pages(CFCC *self) {
    CFCHierarchy  *hierarchy = self->hierarchy;
    CFCClass     **ordered   = CFCHierarchy_ordered_classes(hierarchy);

    size_t num_classes = 0;
    for (size_t i = 0; ordered[i] != NULL; i++) {
        CFCClass *klass = ordered[i];
        if (!CFCClass_included(klass)) { ++num_classes; }
    }
    char **man_pages = (char**)CALLOCATE(num_classes, sizeof(char*));

    // Generate man pages, but don't write.  That way, if there's an error
    // while generating the pages, we leak memory but don't clutter up the file
    // system.
    for (size_t i = 0, j = 0; ordered[i] != NULL; i++) {
        CFCClass *klass = ordered[i];
        if (CFCClass_included(klass)) { continue; }

        char *man_page = CFCCMan_create_man_page(klass);
        man_pages[j++] = man_page;
    }

    const char *dest = CFCHierarchy_get_dest(hierarchy);
    char *man3_path
        = CFCUtil_sprintf("%s" CHY_DIR_SEP "man" CHY_DIR_SEP "man3", dest);
    if (!CFCUtil_is_dir(man3_path)) {
        CFCUtil_make_path(man3_path);
        if (!CFCUtil_is_dir(man3_path)) {
            CFCUtil_die("Can't make path %s", man3_path);
        }
    }

    // Write out any man pages that have changed.
    for (size_t i = 0, j = 0; ordered[i] != NULL; i++) {
        CFCClass *klass = ordered[i];
        if (CFCClass_included(klass)) { continue; }

        char *raw_man_page = man_pages[j++];
        if (!raw_man_page) { continue; }
        char *man_page = CFCUtil_sprintf("%s%s%s", self->man_header,
                                         raw_man_page, self->man_footer);

        const char *full_struct_sym = CFCClass_full_struct_sym(klass);
        char *filename = CFCUtil_sprintf("%s" CHY_DIR_SEP "%s.3", man3_path,
                                         full_struct_sym);
        CFCUtil_write_if_changed(filename, man_page, strlen(man_page));
        FREEMEM(filename);
        FREEMEM(man_page);
        FREEMEM(raw_man_page);
    }

    FREEMEM(man3_path);
    FREEMEM(man_pages);
    FREEMEM(ordered);
}

void
CFCC_write_hostdefs(CFCC *self) {
    const char pattern[] =
        "%s\n"
        "\n"
        "#ifndef H_CFISH_HOSTDEFS\n"
        "#define H_CFISH_HOSTDEFS 1\n"
        "\n"
        "#define CFISH_OBJ_HEAD \\\n"
        "    size_t refcount;\n"
        "\n"
        "#define CFISH_NO_DYNAMIC_OVERRIDES\n"
        "\n"
        "#endif /* H_CFISH_HOSTDEFS */\n"
        "\n"
        "%s\n";
    char *content
        = CFCUtil_sprintf(pattern, self->c_header, self->c_footer);

    // Unlink then write file.
    const char *inc_dest = CFCHierarchy_get_include_dest(self->hierarchy);
    char *filepath = CFCUtil_sprintf("%s" CHY_DIR_SEP "cfish_hostdefs.h",
                                     inc_dest);
    remove(filepath);
    CFCUtil_write_file(filepath, content, strlen(content));
    FREEMEM(filepath);

    FREEMEM(content);
}

char*
CFCC_link_text(CFCUri *uri_obj) {
    char *link_text = NULL;
    CFCUriType type = CFCUri_get_type(uri_obj);

    switch (type) {
        case CFC_URI_ERROR: {
            const char *error = CFCUri_get_error(uri_obj);
            link_text = CFCUtil_sprintf("[%s]", error);
            break;
        }

        case CFC_URI_NULL:
            link_text = CFCUtil_strdup("NULL");
            break;

        case CFC_URI_CLASS: {
            CFCClass *klass = CFCUri_get_class(uri_obj);
            const char *src = CFCClass_included(klass)
                              ? CFCClass_get_name(klass)
                              : CFCClass_get_struct_sym(klass);
            link_text = CFCUtil_strdup(src);
            break;
        }

        case CFC_URI_FUNCTION:
        case CFC_URI_METHOD: {
            const char *name = CFCUri_get_callable_name(uri_obj);
            link_text = CFCUtil_sprintf("%s()", name);
            break;
        }

        case CFC_URI_DOCUMENT: {
            CFCDocument *doc = CFCUri_get_document(uri_obj);
            const char *name = CFCDocument_get_name(doc);
            link_text = CFCUtil_strdup(name);
            break;
        }

        default:
            CFCUtil_die("Unsupported node type: %d", type);
            break;
    }

    return link_text;
}