text:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE generatorConfiguration PUBLIC "-//mybatis.org//DTD MyBatis Generator Configuration 1.0//EN" "http://mybatis.org/dtd/mybatis-generator-config_1_0.dtd">

<generatorConfiguration>
	<classPathEntry location="E:/jars/mysql-connector-java-5.1.13-bin.jar" />

	<context id="Ibatis2Java5" targetRuntime="Ibatis2Java5">

		<plugin type="org.mybatis.generator.plugins.SerializablePlugin" />
		<plugin type="org.mybatis.generator.plugins.AnnotationPlugin" />
		<plugin type="org.mybatis.generator.plugins.IbatisCriteriaPlugin" />
		<plugin type="org.mybatis.generator.plugins.IbatisServicePlugin">
			<property name="targetPackage" value="mysqlibatis2.service" />
			<property name="implementationPackage" value="mysqlibatis2.service.impl" />
			<property name="targetProject" value="../mybatis-generator-testor/src/main/java" />
			<property name="enableInsert" value="true" />
			<property name="enableUpdateByExampleSelective" value="true" />
			<property name="enableInsertSelective" value="true" />
			<property name="enableUpdateByPrimaryKey" value="true" />
			<property name="enableDeleteByPrimaryKey" value="true" />
			<property name="enableDeleteByExample" value="true" />
			<property name="enableUpdateByPrimaryKeySelective" value="true" />
			<property name="enableUpdateByExample" value="true" />
		</plugin>
		<jdbcConnection driverClass="com.mysql.jdbc.Driver" connectionURL="jdbc:mysql://localhost:3306/bank"
			userId="root" password="xinxin" />

		<javaModelGenerator targetPackage="mysqlibatis2.pojo" targetProject="../mybatis-generator-testor/src/main/java">
			<property name="enableSubPackages" value="true" />
		</javaModelGenerator>

		<sqlMapGenerator targetPackage="mysqlibatis2.sqlmap" targetProject="../mybatis-generator-testor/src/main/java">
			<property name="enableSubPackages" value="true" />
		</sqlMapGenerator>

		<javaClientGenerator type="SPRING" targetPackage="mysqlibatis2.dao" targetProject="../mybatis-generator-testor/src/main/java">
		</javaClientGenerator>

		<generatedKey column="id" sqlStatement="SELECT LAST_INSERT_ID()" />

	</context>

	<context id="MyBatis3" targetRuntime="MyBatis3">

		<plugin type="org.mybatis.generator.plugins.SerializablePlugin" />
		<plugin type="org.mybatis.generator.plugins.MybatisCriteriaPlugin" />
		<plugin type="org.mybatis.generator.plugins.MybatisServicePlugin">
			<property name="targetPackage" value="mysqlmybatis.service" />
			<property name="implementationPackage" value="mysqlmybatis.service.impl" />
			<property name="targetProject" value="../mybatis-generator-testor/src/main/java" />
			<property name="enableInsert" value="true" />
			<property name="enableUpdateByExampleSelective" value="true" />
			<property name="enableInsertSelective" value="true" />
			<property name="enableUpdateByPrimaryKey" value="true" />
			<property name="enableDeleteByPrimaryKey" value="true" />
			<property name="enableDeleteByExample" value="true" />
			<property name="enableUpdateByPrimaryKeySelective" value="true" />
			<property name="enableUpdateByExample" value="true" />
		</plugin>
		<jdbcConnection driverClass="com.mysql.jdbc.Driver" connectionURL="jdbc:mysql://localhost:3306/bank"
			userId="root" password="xinxin" />

		<javaModelGenerator targetPackage="mysqlmybatis.pojo" targetProject="../mybatis-generator-testor/src/main/java">
			<property name="enableSubPackages" value="true" />
		</javaModelGenerator>

		<sqlMapGenerator targetPackage="mysqlmybatis.sqlmap" targetProject="../mybatis-generator-testor/src/main/java">
			<property name="enableSubPackages" value="true" />
		</sqlMapGenerator>

		<javaClientGenerator type="XMLMAPPER" targetPackage="mysqlmybatis.dao" targetProject="../mybatis-generator-testor/src/main/java">
		</javaClientGenerator>

		<generatedKey column="id" sqlStatement="SELECT LAST_INSERT_ID()" />

	</context>
</generatorConfiguration>


text:
nohup python miniWEB.py $1> /tmp/miniweb.log &
sleep 1
echo 'start ok'

redpajama_set_name: RedPajamaGithub


text:
package core.webui.server.handlers.renderedobjects;

import core.keyChain.TaskActivationConstructor;
import core.userDefinedTask.UserDefinedAction;

public class RenderedDetailedUserDefinedAction {
	private String id;
	private String name;
	private String isEnabled;
	private String hasPreconditions;
	private RenderedTaskExecutionPreconditions preconditions;
	private RenderedTaskActivation activation;
	private String hasStatistics;
	private RenderedUserDefinedActionStatistics statistics;
	private String hasSourceHistory;
	private RenderedTaskSourceHistory sourceHistory;

	private RenderedDetailedUserDefinedAction() {}

	public static RenderedDetailedUserDefinedAction withEmptyTaskInfo(TaskActivationConstructor activationConstructor) {
		RenderedDetailedUserDefinedAction result = new RenderedDetailedUserDefinedAction();
		result.id = "";
		result.name = "";
		result.isEnabled = "";
		result.hasPreconditions = false + "";
		result.preconditions = null;
		result.activation = RenderedTaskActivation.fromActivation(activationConstructor);
		result.hasStatistics = false + "";
		result.statistics = null;
		result.hasSourceHistory = false + "";
		result.sourceHistory = null;
		return result;
	}

	public static RenderedDetailedUserDefinedAction fromHotkey(String id, String name, TaskActivationConstructor activationConstructor) {
		RenderedDetailedUserDefinedAction result = new RenderedDetailedUserDefinedAction();
		result.id = id;
		result.name = name;
		result.isEnabled = true + "";
		result.hasPreconditions = false + "";
		result.preconditions = null;
		result.activation = RenderedTaskActivation.fromActivation(activationConstructor);
		result.hasStatistics = false + "";
		result.statistics = null;
		result.hasSourceHistory = false + "";
		result.sourceHistory = null;
		return result;
	}

	public static RenderedDetailedUserDefinedAction fromUserDefinedAction(UserDefinedAction action, TaskActivationConstructor activationConstructor) {
		RenderedDetailedUserDefinedAction result = new RenderedDetailedUserDefinedAction();
		result.id = action.getActionId();
		result.name = action.getName();
		result.isEnabled = action.isEnabled() + "";
		result.hasPreconditions = true + "";
		result.preconditions = RenderedTaskExecutionPreconditions.of(action.getExecutionPreconditions());
		result.activation = RenderedTaskActivation.fromActivation(activationConstructor);
		result.hasStatistics = true + "";
		result.statistics = RenderedUserDefinedActionStatistics.fromUserDefinedActionStatistics(action.getStatistics());
		result.hasSourceHistory = true + "";
		result.sourceHistory = RenderedTaskSourceHistory.of(action.getActionId(), action.getTaskSourceHistory());
		return result;
	}

	public String getId() {
		return id;
	}
	public void setId(String id) {
		this.id = id;
	}
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	public String getHasPreconditions() {
		return hasPreconditions;
	}
	public void setHasPreconditions(String hasPreconditions) {
		this.hasPreconditions = hasPreconditions;
	}
	public RenderedTaskExecutionPreconditions getPreconditions() {
		return preconditions;
	}
	public void setPreconditions(RenderedTaskExecutionPreconditions preconditions) {
		this.preconditions = preconditions;
	}
	public RenderedTaskActivation getActivation() {
		return activation;
	}
	public void setActivation(RenderedTaskActivation activation) {
		this.activation = activation;
	}
	public String getHasStatistics() {
		return hasStatistics;
	}
	public void setHasStatistics(String hasStatistics) {
		this.hasStatistics = hasStatistics;
	}
	public RenderedUserDefinedActionStatistics getStatistics() {
		return statistics;
	}
	public void setStatistics(RenderedUserDefinedActionStatistics statistics) {
		this.statistics = statistics;
	}
	public String getHasSourceHistory() {
		return hasSourceHistory;
	}
	public RenderedTaskSourceHistory getSourceHistory() {
		return sourceHistory;
	}
	public String getIsEnabled() {
		return isEnabled;
	}
	public void setIsEnabled(String isEnabled) {
		this.isEnabled = isEnabled;
	}
}


text:
/**
 * @module LegalModule
 */ /** */
import { NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';

import { LegalComponent } from './legal.component';
/**
 * Child routes for the lazy-loaded {@link LegalModule}
 */
const routes: Routes = [
  { path: 'terms', component: LegalComponent },
  { path: 'privacy', component: LegalComponent }
];
/**
 * @whatItDoes Responsible for providing additional routes for the {@link LegalModule}.
 * @consumers {@link LegalModule}
 * @see [Angular 2 docs - Lazy loading modules with the Router](https://angular.io/docs/ts/latest/guide/ngmodule.html#lazy-load)
 */
@NgModule({
  imports: [RouterModule.forChild(routes)],
  exports: [RouterModule],
  providers: []
})
export class LegalRoutingModule { }


text:
Encode/decode base64 data into ArrayBuffers

## Getting Started
Install the module with: `npm install base64-arraybuffer`

## API
The library encodes and decodes base64 to and from ArrayBuffers

 - __encode(buffer)__ - Encodes `ArrayBuffer` into base64 string
 - __decode(str)__ - Decodes base64 string to `ArrayBuffer`

## Release History
0.1.0 - Initial version, basic decode/encode base64 to and from ArrayBuffer

## License
Copyright (c) 2012 Niklas von Hertzen
Licensed under the MIT license.


text:
Coding Standards Documentation
==============================

The Doctrine Coding Standards documentation is a reference guide to everything you need
to know about the coding standards project.

Getting Help
------------

If this documentation is not helping to answer questions you have about
Doctrine Coding Standards don't panic. You can get help from different sources:

-  The `Doctrine Mailing List <https://groups.google.com/group/doctrine-user>`_
-  Slack chat room `#coding-standard <https://www.doctrine-project.org/slack>`_
-  Report a bug on `GitHub <https://github.com/doctrine/coding-standard/issues>`_.
-  On `StackOverflow <https://stackoverflow.com/questions/tagged/doctrine-coding-standard>`_

Getting Started
---------------

The best way to get started is with the :doc:`Introduction <introduction>` section.
Use the sidebar to browse other documentation for the Doctrine PHP Coding Standards project.


text:
package com.eduworks.cruncher.math;

import java.io.InputStream;
import java.text.NumberFormat;
import java.util.Iterator;
import java.util.Map;

import org.json.JSONException;
import org.json.JSONObject;

import com.eduworks.resolver.Context;
import com.eduworks.resolver.Cruncher;

/**
 * Adds any number of numbers or strings. Will default to returning a number if all parameters are numbers, will return string if not.
 *
 * @class add
 * @module ew.levr.base
 * @author fritz.ray@eduworks.com
 */
/**
 * @method add
 * @param [any] {Number|String} Elements to add together.
 * @param [_string=false] {boolean} Forces output as a string. Useful for parameters that could end up being numbers.
 * @param [_fancyNumber=false] {boolean} Outputs number as a locale formatted string.
 */
public class CruncherAdd extends Cruncher
{
	@Override
	public Object resolve(Context c, Map<String, String[]> parameters, Map<String, InputStream> dataStreams) throws JSONException
	{
		double result = 0.0;
		boolean fancyNumber = optAsBoolean("_fancyNumber",false,c,parameters,dataStreams);
		StringBuilder resultStr = new StringBuilder();
		Iterator<String> i = this.sortedKeys();
		boolean enforceString = optAsBoolean("_string",false,c,parameters, dataStreams);
		while (i.hasNext())
		{
			String key = i.next();
			if (isSetting(key))
				continue;
			Object o = get(key,c,parameters, dataStreams);
			if (o == null)
				continue;
			if (o instanceof String && ((String) o).length() > 0 && Character.isLetter(((String) o).charAt(0)))
				enforceString = true;
			if (resultStr.length() == 0 && !enforceString)
				try
				{
					Double value = objectToDouble(o);
					result += value;
				}
				catch (NumberFormatException ex)
				{
					if (result != 0.0)
						resultStr.append(result);
					resultStr.append(objectToString(o));
				}
			else
				resultStr.append(objectToString(o));
		}
		if (resultStr.length() > 0 || enforceString)
			return resultStr.toString();
		if (fancyNumber)
			return NumberFormat.getNumberInstance(java.util.Locale.US).format(result);
		return result;
	}

	@Override
	public String getDescription()
	{
		return "Adds any number of numbers or strings. Will default to returning a number if all parameters are numbers, will return string if not.";
	}

	@Override
	public String getReturn()
	{
		return "Number|String";
	}

	@Override
	public String getAttribution()
	{
		return ATTRIB_NONE;
	}

	@Override
	public JSONObject getParameters() throws JSONException
	{
		return jo("<any>","Number|String","_string","Boolean","_fancyNumber","Boolean");
	}
}


text:
typedef NS_ENUM(NSUInteger, ABI43_0_0EXBackgroundNotificationResult) {
  ABI43_0_0EXBackgroundNotificationResultNoData = 1,
  ABI43_0_0EXBackgroundNotificationResultNewData = 2,
  ABI43_0_0EXBackgroundNotificationResultFailed = 3,
};

@interface ABI43_0_0EXBackgroundNotificationTasksModule : ABI43_0_0EXExportedModule <ABI43_0_0EXModuleRegistryConsumer>

@end


text:
class Ccc::SitrackEnumValue < ActiveRecord::Base

end


text:
create class picture
(caption set string,
image string);
insert INTO picture VALUES ({'s'},'s');

create vclass meal
class attribute (meal_type string shared 'a' unique)
(menu picture);

drop vclass meal;
drop class picture;


text:
namespace aria2 {

class DHTBucketTreeTest:public CppUnit::TestFixture {

  CPPUNIT_TEST_SUITE(DHTBucketTreeTest);
  CPPUNIT_TEST(testDig);
  CPPUNIT_TEST(testFindBucketFor);
  CPPUNIT_TEST(testFindClosestKNodes);
  CPPUNIT_TEST(testEnumerateBucket);
  CPPUNIT_TEST_SUITE_END();
public:
  void testDig();
  void testFindBucketFor();
  void testFindClosestKNodes();
  void testEnumerateBucket();
};

CPPUNIT_TEST_SUITE_REGISTRATION(DHTBucketTreeTest);

void DHTBucketTreeTest::testDig()
{
  unsigned char localNodeID[DHT_ID_LENGTH];
  memset(localNodeID, 0xff, DHT_ID_LENGTH);

  std::shared_ptr<DHTNode> localNode(new DHTNode(localNodeID));

  std::shared_ptr<DHTBucket> bucket1(new DHTBucket(localNode));
  std::shared_ptr<DHTBucket> bucket2 = bucket1->split();
  std::shared_ptr<DHTBucket> bucket3 = bucket1->split();
  // Tree: number is prefix
  //
  //           +
  //    +------+------+
  //   b2             |
  //   0       +------+------+
  //          b3             b1
  //          10             11
  //                         |
  //                     localNode is here
  {
    DHTBucketTreeNode b(bucket1);
    CPPUNIT_ASSERT(!b.dig(localNode->getID()));
  }
  {
    DHTBucketTreeNode* left = new DHTBucketTreeNode(bucket3);
    DHTBucketTreeNode* right = new DHTBucketTreeNode(bucket1);
    DHTBucketTreeNode b(left, right);
    CPPUNIT_ASSERT(b.dig(localNode->getID()) == right);
  }
}

void DHTBucketTreeTest::testFindBucketFor()
{
  unsigned char localNodeID[DHT_ID_LENGTH];
  memset(localNodeID, 0xaa, DHT_ID_LENGTH);

  std::shared_ptr<DHTNode> localNode(new DHTNode(localNodeID));

  std::shared_ptr<DHTBucket> bucket1(new DHTBucket(localNode));
  std::shared_ptr<DHTBucket> bucket2 = bucket1->split();
  std::shared_ptr<DHTBucket> bucket3 = bucket1->split();
  std::shared_ptr<DHTBucket> bucket4 = bucket3->split();
  std::shared_ptr<DHTBucket> bucket5 = bucket3->split();

  {
    DHTBucketTreeNode b(bucket5);
    CPPUNIT_ASSERT(*bucket5 == *dht::findBucketFor(&b, localNodeID));
  }
  {
    // Tree: number is prefix
    //
    //           +
    //    +------+------+
    //   b2             |
    //   0       +------+------+
    //           |             b1
    //     +-----+-----+      11
    //    b4           |
    //   100     +-----+-----+
    //          b5           b3
    //          1010         1011
    //           |
    //    localNode is here
    DHTBucketTreeNode* b1 = new DHTBucketTreeNode(bucket1);
    DHTBucketTreeNode* b2 = new DHTBucketTreeNode(bucket2);
    DHTBucketTreeNode* b3 = new DHTBucketTreeNode(bucket3);
    DHTBucketTreeNode* b4 = new DHTBucketTreeNode(bucket4);
    DHTBucketTreeNode* b5 = new DHTBucketTreeNode(bucket5);

    DHTBucketTreeNode* bp1 = new DHTBucketTreeNode(b5, b3);
    DHTBucketTreeNode* bp2 = new DHTBucketTreeNode(b4, bp1);
    DHTBucketTreeNode* bp3 = new DHTBucketTreeNode(bp2, b1);
    DHTBucketTreeNode bp4(b2, bp3);

    CPPUNIT_ASSERT(*bucket5 == *dht::findBucketFor(&bp4, localNode->getID()));
  }
}

void DHTBucketTreeTest::testFindClosestKNodes()
{
  unsigned char localNodeID[DHT_ID_LENGTH];
  memset(localNodeID, 0xaa, DHT_ID_LENGTH);

  std::shared_ptr<DHTNode> localNode(new DHTNode(localNodeID));

  std::shared_ptr<DHTBucket> bucket1(new DHTBucket(localNode));
  std::shared_ptr<DHTBucket> bucket2 = bucket1->split();
  std::shared_ptr<DHTBucket> bucket3 = bucket1->split();
  std::shared_ptr<DHTBucket> bucket4 = bucket3->split();
  std::shared_ptr<DHTBucket> bucket5 = bucket3->split();

  unsigned char id[DHT_ID_LENGTH];
  {
    DHTBucketTreeNode* b1 = new DHTBucketTreeNode(bucket1);
    DHTBucketTreeNode* b2 = new DHTBucketTreeNode(bucket2);
    DHTBucketTreeNode* b3 = new DHTBucketTreeNode(bucket3);
    DHTBucketTreeNode* b4 = new DHTBucketTreeNode(bucket4);
    DHTBucketTreeNode* b5 = new DHTBucketTreeNode(bucket5);

    DHTBucketTreeNode* bp1 = new DHTBucketTreeNode(b5, b3);
    DHTBucketTreeNode* bp2 = new DHTBucketTreeNode(b4, bp1);
    DHTBucketTreeNode* bp3 = new DHTBucketTreeNode(bp2, b1);
    DHTBucketTreeNode bp4(b2, bp3);

    for(size_t i = 0; i < 2; ++i) {
      bucket1->getRandomNodeID(id);
      bucket1->addNode(std::shared_ptr<DHTNode>(new DHTNode(id)));
      bucket2->getRandomNodeID(id);
      bucket2->addNode(std::shared_ptr<DHTNode>(new DHTNode(id)));
      bucket3->getRandomNodeID(id);
      bucket3->addNode(std::shared_ptr<DHTNode>(new DHTNode(id)));
      bucket4->getRandomNodeID(id);
      bucket4->addNode(std::shared_ptr<DHTNode>(new DHTNode(id)));
      bucket5->getRandomNodeID(id);
      bucket5->addNode(std::shared_ptr<DHTNode>(new DHTNode(id)));
    }
    {
      unsigned char targetID[DHT_ID_LENGTH];
      memset(targetID, 0x80, DHT_ID_LENGTH);
      std::vector<std::shared_ptr<DHTNode> > nodes;
      dht::findClosestKNodes(nodes, &bp4, targetID);
      CPPUNIT_ASSERT_EQUAL((size_t)8, nodes.size());
      CPPUNIT_ASSERT(bucket4->isInRange(nodes[0]));
      CPPUNIT_ASSERT(bucket4->isInRange(nodes[1]));
      CPPUNIT_ASSERT(bucket5->isInRange(nodes[2]));
      CPPUNIT_ASSERT(bucket5->isInRange(nodes[3]));
      CPPUNIT_ASSERT(bucket3->isInRange(nodes[4]));
      CPPUNIT_ASSERT(bucket3->isInRange(nodes[5]));
      CPPUNIT_ASSERT(bucket1->isInRange(nodes[6]));
      CPPUNIT_ASSERT(bucket1->isInRange(nodes[7]));
    }
    {
      unsigned char targetID[DHT_ID_LENGTH];
      memset(targetID, 0xf0, DHT_ID_LENGTH);
      std::vector<std::shared_ptr<DHTNode> > nodes;
      dht::findClosestKNodes(nodes, &bp4, targetID);
      CPPUNIT_ASSERT_EQUAL((size_t)8, nodes.size());
      CPPUNIT_ASSERT(bucket1->isInRange(nodes[0]));
      CPPUNIT_ASSERT(bucket1->isInRange(nodes[1]));
      CPPUNIT_ASSERT(bucket3->isInRange(nodes[2]));
      CPPUNIT_ASSERT(bucket3->isInRange(nodes[3]));
      CPPUNIT_ASSERT(bucket5->isInRange(nodes[4]));
      CPPUNIT_ASSERT(bucket5->isInRange(nodes[5]));
      CPPUNIT_ASSERT(bucket4->isInRange(nodes[6]));
      CPPUNIT_ASSERT(bucket4->isInRange(nodes[7]));
    }
    {
      for(size_t i = 0; i < 6; ++i) {
        bucket4->getRandomNodeID(id);
        bucket4->addNode(std::shared_ptr<DHTNode>(new DHTNode(id)));
      }
      unsigned char targetID[DHT_ID_LENGTH];
      memset(targetID, 0x80, DHT_ID_LENGTH);
      std::vector<std::shared_ptr<DHTNode> > nodes;
      dht::findClosestKNodes(nodes, &bp4, targetID);
      CPPUNIT_ASSERT_EQUAL((size_t)8, nodes.size());
      for(size_t i = 0; i < DHTBucket::K; ++i) {
        CPPUNIT_ASSERT(bucket4->isInRange(nodes[i]));
      }
    }
  }
}

void DHTBucketTreeTest::testEnumerateBucket()
{
  unsigned char localNodeID[DHT_ID_LENGTH];
  memset(localNodeID, 0xaa, DHT_ID_LENGTH);

  std::shared_ptr<DHTNode> localNode(new DHTNode(localNodeID));

  std::shared_ptr<DHTBucket> bucket1(new DHTBucket(localNode));
  std::shared_ptr<DHTBucket> bucket2 = bucket1->split();
  std::shared_ptr<DHTBucket> bucket3 = bucket1->split();
  std::shared_ptr<DHTBucket> bucket4 = bucket3->split();
  std::shared_ptr<DHTBucket> bucket5 = bucket3->split();

  {
    DHTBucketTreeNode b(bucket1);
    std::vector<std::shared_ptr<DHTBucket> > buckets;
    dht::enumerateBucket(buckets, &b);
    CPPUNIT_ASSERT_EQUAL((size_t)1, buckets.size());
    CPPUNIT_ASSERT(*bucket1 == *buckets[0]);
  }
  {
    DHTBucketTreeNode* b1 = new DHTBucketTreeNode(bucket1);
    DHTBucketTreeNode* b2 = new DHTBucketTreeNode(bucket2);
    DHTBucketTreeNode* b3 = new DHTBucketTreeNode(bucket3);
    DHTBucketTreeNode* b4 = new DHTBucketTreeNode(bucket4);
    DHTBucketTreeNode* b5 = new DHTBucketTreeNode(bucket5);

    DHTBucketTreeNode* bp1 = new DHTBucketTreeNode(b5, b3);
    DHTBucketTreeNode* bp2 = new DHTBucketTreeNode(b4, bp1);
    DHTBucketTreeNode* bp3 = new DHTBucketTreeNode(bp2, b1);
    DHTBucketTreeNode bp4(b2, bp3);

    std::vector<std::shared_ptr<DHTBucket> > buckets;
    dht::enumerateBucket(buckets, &bp4);
    CPPUNIT_ASSERT_EQUAL((size_t)5, buckets.size());
    CPPUNIT_ASSERT(*bucket2 == *buckets[0]);
    CPPUNIT_ASSERT(*bucket4 == *buckets[1]);
    CPPUNIT_ASSERT(*bucket5 == *buckets[2]);
    CPPUNIT_ASSERT(*bucket3 == *buckets[3]);
    CPPUNIT_ASSERT(*bucket1 == *buckets[4]);
  }
}

} // namespace aria2


text:
package com.openparts.base.service;

import com.cnpc.framework.base.entity.Dict;
import com.cnpc.framework.base.entity.Org;
import com.cnpc.framework.base.pojo.Result;
import com.cnpc.framework.base.pojo.TreeNode;
import com.cnpc.framework.base.service.BaseService;

import java.util.List;

public interface CarService extends BaseService {

    List<TreeNode> getTreeData();

    List<Org> getOrgsByCode(String code);

    boolean referByUser(String orgId);

    Result getOrgNames(String id);
}


text:
ACCEPTED

#### According to
International Plant Names Index

#### Published in
J. Bot. (Morot) 5:50. 1891

#### Original name
null

### Remarks
null


text:
ActiveRecord::Schema.define(:version => 20120818125943) do

  create_table "active_admin_comments", :force => true do |t|
    t.string   "resource_id",   :null => false
    t.string   "resource_type", :null => false
    t.integer  "author_id"
    t.string   "author_type"
    t.text     "body"
    t.datetime "created_at",    :null => false
    t.datetime "updated_at",    :null => false
    t.string   "namespace"
  end

  add_index "active_admin_comments", ["author_type", "author_id"], :name => "index_active_admin_comments_on_author_type_and_author_id"
  add_index "active_admin_comments", ["namespace"], :name => "index_active_admin_comments_on_namespace"
  add_index "active_admin_comments", ["resource_type", "resource_id"], :name => "index_admin_notes_on_resource_type_and_resource_id"

  create_table "admin_users", :force => true do |t|
    t.string   "email",                  :default => "", :null => false
    t.string   "encrypted_password",     :default => "", :null => false
    t.string   "reset_password_token"
    t.datetime "reset_password_sent_at"
    t.datetime "remember_created_at"
    t.integer  "sign_in_count",          :default => 0
    t.datetime "current_sign_in_at"
    t.datetime "last_sign_in_at"
    t.string   "current_sign_in_ip"
    t.string   "last_sign_in_ip"
    t.datetime "created_at",                             :null => false
    t.datetime "updated_at",                             :null => false
  end

  add_index "admin_users", ["email"], :name => "index_admin_users_on_email", :unique => true
  add_index "admin_users", ["reset_password_token"], :name => "index_admin_users_on_reset_password_token", :unique => true

  create_table "ecm_news_items", :force => true do |t|
    t.string   "title"
    t.string   "locale"
    t.text     "body"
    t.datetime "published_at"
    t.boolean  "link_to_more"
    t.string   "markup_language"
    t.string   "slug"
    t.datetime "created_at",      :null => false
    t.datetime "updated_at",      :null => false
  end

end


text:
/**
 * Renders charts marked with the class 'renderWithFlot'. Currently, data is
 * stored in the text of the element; this should be moved into the relevant
 * attributes.
 *
 * @requires jQuery
 * @requires Charts.js
 * @author Steven King <steven@winterwell.com>
**/
$(function () {
	var masterCharts = {},
		slaveCharts = {};

	$('.renderWithFlot').not('.ajaxed').each(function () {
		var type, // = $(this).attr('data-chart-type'),
			data = $(this).attr('data-chart-data'),
			options = $(this).attr('data-chart-options');

		$(this).addClass('ajaxed');

		if (data) {
			data = JSON.parse(data);
		}

		if (options) {
			options = JSON.parse(options);
		}

		// TODO Move to attribute (data-chart-type).
		if (!type) {
			if ($(this).hasClass('pie')) {
				type = 'pie';
			} else if ($(this).hasClass('timeseries')) {
				type = 'timeseries';
			} else if ($(this).hasClass('timedist')) {
				type = 'timedist';
			} else if ($(this).hasClass('time-of-day')) {
				delete options.xaxis.ticks; // This enables us to format the ticks correctly in Charts.js.

				type = 'timeofday';
			}
		}

		if ($(this).hasClass('chart-master')) {
			var masterChartId = $(this).prop('id');

			$(this).after('<div id="legend-' + masterChartId + '" class="chart-legend-external chart-legend-shared">');

			masterCharts[masterChartId] = {
				$el: $(this),
				type: type,
				data: data,
				options: options
			};
		} else if ($(this).attr('data-chart-master-id')) {
			var masterChartId = $(this).attr('data-chart-master-id');

			$('#' + masterChartId).after($(this));

			slaveCharts[masterChartId] = slaveCharts[masterChartId] || [];

			slaveCharts[masterChartId].push({
				$el: $(this),
				type: type,
				data: data,
				options: options
			});
		} else {
			charts.render({
				$el: $(this),
				type: type,
				data: data,
				options: options
			});
		}
	});

	for (var masterChartId in masterCharts) {
		charts.renderLinked({
			master: masterCharts[masterChartId],
			slaves: slaveCharts[masterChartId],
			$legend: $('#legend-' + masterChartId)
		});
	}

	// wkhtmltopdf trigger. This is required otherwise time isn't given to render graphs.
	window.status = 'FLOT_DONE';
});


text:
<!doctype html>

<title>CSS Test Reference</title>

Pass if the background is green.


text:
import {isEmpty} from "./utils";
import I18n from "i18n-js";

export const ROLES = {
    GUEST: "GUEST",
    MEMBER: "MEMBER",
    ADMIN: "ADMIN",
    MANAGER: "MANAGER",
    OWNER: "OWNER"
}
const getMembership = (team, user) => team.memberships.find(membership => membership.person.id === user.person.id);

export const getRole = (team, user) => {
    const membership = getMembership(team, user);
    if (!membership) {
        return ROLES.GUEST;
    }
    return ROLES[membership.role];
}

export function allowedToLeave(team, currentUser) {
    const isMember = team.memberships.find(membership => membership.urnPerson === currentUser.urn);
    const admins = team.memberships
        .filter(membership => (membership.role === ROLES.ADMIN || membership.role === ROLES.OWNER)
            && membership.urnPerson !== currentUser.urn);
    return (admins.length > 0 && !isEmpty(isMember)) || (!isEmpty(isMember) && isMember.role !== ROLES.ADMIN && isMember.role !== ROLES.OWNER);
}

export function hasOneAdmin(team, currentUser) {
    const pendingAdminInvitations = (team.invitations || []).filter(invitation => (invitation.intendedRole === ROLES.ADMIN ||
        invitation.intendedRole === ROLES.OWNER) && !invitation.declined);
    const hasPendingAdminInvitations = pendingAdminInvitations.length > 0;
    const admins = team.memberships
        .filter(membership => (membership.role === ROLES.ADMIN || membership.role === ROLES.OWNER)
            && membership.urnPerson !== currentUser.urn);
    const membership = team.memberships.find(membership => membership.urnPerson === currentUser.urn);
    const isAdmin = membership && membership.role === ROLES.ADMIN;
    return admins.length === 0 && !hasPendingAdminInvitations && isAdmin;
}

export function currentUserRoleInTeam(team, currentUser) {
    if (currentUser.superAdminModus) {
        return "SUPER_ADMIN";
    }
    return (team.memberships.find(membership => membership.urnPerson === currentUser.urn) || {role: ROLES.GUEST}).role;
}

export function isOnlyAdmin(team, currentUser) {
    const admins = team.memberships.filter(membership => membership.role === ROLES.ADMIN || membership.role === ROLES.OWNER);
    const userRoleInTeam = currentUserRoleInTeam(team, currentUser);
    return admins.length === 1 && (userRoleInTeam === ROLES.ADMIN || userRoleInTeam === ROLES.OWNER);
}

export const actionDropDownTitle = (team, user) => {
    const membership = getMembership(team, user);
    if (!membership) {
        return I18n.t("roles.title", {role: I18n.t("roles.guest")});
    }
    return I18n.t("roles.title", {role: I18n.t(`roles.${membership.role.toLowerCase()}`).toLowerCase()});
}


text:
#include "Layer.h"
#include "paddle/math/Matrix.h"
#include "paddle/utils/Logging.h"
#include "paddle/utils/Stat.h"

namespace paddle {
/**
 * @brief A layer for computing cosine similarity between a vector
 * and each row of a matrix
 * out[i] = cos_scale * cos(in1, in2(i,:));
 * @note used in NEURAL TURING MACHINE
 *
 * Input1: a vector (batchSize * dataDim)
 *
 * Input2: a matrix in vector form (batchSize * (weightDim*dataDim))
 *
 * Output: a vector (batchSize * weightDim)
 */

class CosSimVecMatLayer : public Layer {
 protected:
  MatrixPtr tmpMtx0;
  MatrixPtr tmpMtx1;
  MatrixPtr tmpRow0;
  MatrixPtr tmpRow1;
  MatrixPtr tmpRow2;
  MatrixPtr tmpRow3;

 public:
  explicit CosSimVecMatLayer(const LayerConfig& config) : Layer(config) {}

  ~CosSimVecMatLayer() {}

  bool init(const LayerMap& layerMap,
            const ParameterMap& parameterMap) override;

  void forward(PassType passType) override;
  void backward(const UpdateCallback& callback = nullptr) override;
};

REGISTER_LAYER(cos_vm, CosSimVecMatLayer);

bool CosSimVecMatLayer::init(const LayerMap& layerMap,
                             const ParameterMap& parameterMap) {
  Layer::init(layerMap, parameterMap);

  CHECK_EQ(inputLayers_.size(), 2U);

  size_t dataDim = inputLayers_[0]->getSize();
  size_t numKeys = getSize();
  size_t memoryDim = inputLayers_[1]->getSize();

  CHECK_EQ(dataDim * numKeys, memoryDim) << "Dimension mismatch";

  tmpRow0 = Matrix::create(nullptr,
                           /* height= */ 1,
                           dataDim,
                           /* trans= */ false,
                           useGpu_);
  tmpRow1 = Matrix::create(nullptr,
                           /* height= */ 1,
                           dataDim,
                           /* trans= */ false,
                           useGpu_);
  tmpRow2 = Matrix::create(nullptr,
                           /* height= */ numKeys,
                           1,
                           /* trans= */ false,
                           useGpu_);
  tmpRow3 = Matrix::create(nullptr,
                           /* height= */ numKeys,
                           1,
                           /* trans= */ false,
                           useGpu_);

  tmpMtx0 = Matrix::create(nullptr,
                           /* height= */ numKeys,
                           dataDim,
                           /* trans= */ false,
                           useGpu_);
  tmpMtx1 = Matrix::create(nullptr,
                           /* height= */ numKeys,
                           dataDim,
                           /* trans= */ false,
                           useGpu_);

  CHECK(tmpRow0 && tmpRow1 && tmpRow2 && tmpRow3 && tmpMtx0 && tmpMtx1);

  createFunction(forward_,
                 "CosSimForward",
                 FuncConfig().set("scale", (real)config_.cos_scale()));
  createFunction(backward_,
                 "CosSimBackward",
                 FuncConfig().set("scale", (real)config_.cos_scale()));

  return true;
}

void CosSimVecMatLayer::forward(PassType passType) {
  Layer::forward(passType);
  CHECK_EQ(forward_.size(), 1UL) << "Only one forward function needed";

  MatrixPtr inV0 = getInputValue(0);
  MatrixPtr inV1 = getInputValue(1);

  size_t batchSize = inV0->getHeight();
  size_t numKeys = getSize();

  CHECK_EQ(batchSize, inV1->getHeight());

  {
    REGISTER_TIMER_INFO("FwResetTimer", getName().c_str());
    reserveOutput(batchSize, numKeys);
  }

  MatrixPtr outV = getOutputValue();
  CHECK(outV && inV0 && inV1);
  REGISTER_TIMER_INFO("FwCosVMTimer", getName().c_str());
  for (size_t i = 0; i < batchSize; i++) {
    tmpRow0->setData(inV0->rowBuf(i));
    tmpMtx0->setData(inV1->rowBuf(i));
    tmpRow2->setData(outV->rowBuf(i));

    BufferArgs inputs;
    BufferArgs outputs;
    inputs.addArg(*tmpMtx0);
    inputs.addArg(*tmpRow0);
    outputs.addArg(*tmpRow2, ASSIGN_TO);
    forward_[0]->calc(inputs, outputs);
  }
}

void CosSimVecMatLayer::backward(const UpdateCallback& callback) {
  CHECK_EQ(backward_.size(), 1UL) << "Only one forward function needed";

  MatrixPtr inV0 = getInputValue(0);
  MatrixPtr inV1 = getInputValue(1);
  MatrixPtr inG0 = getInputGrad(0);
  MatrixPtr inG1 = getInputGrad(1);
  MatrixPtr outV = getOutputValue();
  MatrixPtr outG = getOutputGrad();

  size_t batchSize = inV0->getHeight();
  CHECK(inV0 && inV1 && inG0 && inG1 && outV && outG);
  REGISTER_TIMER_INFO("BwCosVMTimer", getName().c_str());

  for (size_t i = 0; i < batchSize; i++) {
    tmpRow0->setData(inV0->rowBuf(i));
    tmpRow1->setData(inG0->rowBuf(i));
    tmpMtx0->setData(inV1->rowBuf(i));
    tmpMtx1->setData(inG1->rowBuf(i));
    tmpRow2->setData(outV->rowBuf(i));
    tmpRow3->setData(outG->rowBuf(i));

    BufferArgs inputs;
    BufferArgs outputs;
    inputs.addArg(*tmpRow3);
    inputs.addArg(*tmpRow2);
    inputs.addArg(*tmpMtx0);
    inputs.addArg(*tmpRow0);
    outputs.addArg(*tmpMtx1, ADD_TO);
    outputs.addArg(*tmpRow1, ADD_TO);

    backward_[0]->calc(inputs, outputs);
  }
}

}  // namespace paddle


text:
// Copyright 2022 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

package org.chromium.chrome.browser.supervised_user;

import org.chromium.base.Callback;
import org.chromium.ui.base.WindowAndroid;
import org.chromium.url.GURL;

/**
 * The correct version of {@link ParentAuthDelegateImpl} will be determined at compile
 * time via build rules.
 */
public interface ParentAuthDelegate {
    /** @see {@link WebsiteParentApproval#isLocalApprovalSupported()} */
    boolean isLocalAuthSupported();

    /** @see {@link WebsiteParentApproval#requestLocalApproval()} */
    void requestLocalAuth(
            WindowAndroid windowAndroid, GURL url, Callback<Boolean> onCompletionCallback);
}


text:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical">

  <TextView
      android:id="@+id/training_title"
      android:layout_width="match_parent"
      android:layout_height="wrap_content"
      android:layout_marginTop="@dimen/training_padding_top"
      android:fontFamily="@string/accessibility_font"
      android:textStyle="bold"
      android:textColor="@color/training_text_color"
      android:textSize="@dimen/training_title_text_size"
      android:lineHeight="@dimen/training_title_height"/>

</LinearLayout>


text:
package edu.wustl.catissuecore.ctrp;

import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;

import java.net.URL;
import java.net.URLClassLoader;

import org.junit.After;
import org.junit.Before;
import org.junit.Test;

import edu.wustl.catissuecore.domain.CollectionProtocol;
import edu.wustl.catissuecore.domain.User;
import edu.wustl.common.util.logger.Logger;
import gov.nih.nci.coppa.po.Organization;
import gov.nih.nci.coppa.po.Person;
import gov.nih.nci.coppa.services.pa.StudyProtocol;

public class COPPAServiceClientTestCase {

	@Before
	public void setUp() throws Exception {
	}

	@After
	public void tearDown() throws Exception {
	}

	private transient final Logger logger = Logger
			.getCommonLogger(COPPAServiceClientTestCase.class);

	@Test
	public void testOrganizationSearch() throws Exception {
		try {
			COPPAServiceClient client = new COPPAServiceClient();
			String keyword = "Hospital";
			Organization[] results = client.searchOrganization(keyword);
			if (results != null && results.length > 0) {
				assertTrue(true);
			} else {
				logger.error("No search results for Organization. Keyword:"
						+ keyword);
				fail();
			}

			for (Organization o : results) {
				logger.debug("organization:"
						+ o.getName().getPart().get(0).getValue());
			}
		} catch (Exception e) {
			e.printStackTrace();
			fail();
		}
	}

	@Test
	public void testPersonSearch() throws Exception {
		try {
			COPPAServiceClient client = new COPPAServiceClient();
			String firstName = "Sirisha";
			String lastName = "Kilambi";
			User user = new User();
			user.setFirstName(firstName);
			user.setLastName(lastName);

			Person[] results = client.searchPerson(user);
			if (results != null && results.length > 0) {
				assertTrue(true);
			} else {
				logger.error("No search results for Organization. Keyword:"
						+ user.getFirstName() + " " + user.getLastName());
				fail();
			}

		} catch (Exception e) {
			e.printStackTrace();
			fail();
		}
	}

	@Test
	public void testStudyProtocolSearch() throws Exception {
		try {
			COPPAServiceClient client = new COPPAServiceClient();
			CollectionProtocol cp = new CollectionProtocol();
			String title = "ctgov is set to false 2nd via grid 3.3 test1";
			cp.setTitle(title);
			StudyProtocol[] results = client.searchSutdyProtocol(cp);
			if (results != null && results.length > 0) {
				assertTrue(true);
			} else {
				logger.error("No search results for Study Protocol. Keyword:"
						+ cp.getTitle());
				fail();
			}

		} catch (Exception e) {
			e.printStackTrace();
			fail();
		}
	}

	@Test
	public void testGetSutdyProtocolById() throws Exception {
		try {
			COPPAServiceClient client = new COPPAServiceClient();
			String coppaProtocolId = "135568";
			StudyProtocol result = client.getSutdyProtocolById(coppaProtocolId);
			if (result != null) {
				assertTrue(true);
			} else {
				logger.error("No study protocol found for id:"
						+ coppaProtocolId);
				fail();
			}

		} catch (Exception e) {
			e.printStackTrace();
			fail();
		}
	}

	@Test
	public void testGetPrincipalInvestigatorByStudyProtocolId() throws Exception {
		try {
			COPPAServiceClient client = new COPPAServiceClient();
			String coppaProtocolId = "135568";
			Person result = client.getPrincipalInvestigatorByStudyProtocolId(coppaProtocolId);
			if (result != null) {
				assertTrue(true);
			} else {
				logger.error("No study protocol found for id:"
						+ coppaProtocolId);
				fail();
			}

		} catch (Exception e) {
			e.printStackTrace();
			fail();
		}
	}}


text:
module Vines
  module Agent
    module Command
      class Init
        def run(opts)
          raise 'vines-agent init <domain>' unless opts[:args].size == 1
          domain = opts[:args].first.downcase
          dir = File.expand_path(domain)
          raise "Directory already initialized: #{domain}" if File.exists?(dir)
          Dir.mkdir(dir)

          FileUtils.cp_r(File.expand_path("../../../../../conf", __FILE__), dir)

          data, log, pid = %w[data log pid].map do |sub|
            File.join(dir, sub).tap {|subdir| Dir.mkdir(subdir) }
          end

          update_config(domain, File.expand_path('conf/config.rb', dir))
          fix_perms(dir)

          puts "Initialized agent directory: #{domain}"
          puts "Run 'cd #{domain} && vines-agent start' to begin"
        end

        private

        # The config.rb file contains the agent's password so restrict access
        # to just the agent user.
        def fix_perms(dir)
          File.chmod(0600, File.expand_path('conf/config.rb', dir))
        end

        def update_config(domain, config)
          text = File.read(config)
          File.open(config, 'w') do |f|
            replaced = text
              .gsub('wonderland.lit', domain.downcase)
              .gsub('secr3t', Kit.auth_token)
            f.write(replaced)
          end
        end
      end
    end
  end
end


text:
package com.github.czyzby.lml.parser.impl.attribute.scroll;

import com.badlogic.gdx.scenes.scene2d.ui.ScrollPane;
import com.github.czyzby.lml.parser.LmlParser;
import com.github.czyzby.lml.parser.tag.LmlAttribute;
import com.github.czyzby.lml.parser.tag.LmlTag;

/** See {@link ScrollPane#setScrollingDisabled(boolean, boolean)}. Mapped to "disable", "disabled".
 *
 * @author MJ */
public class ScrollDisabledLmlAttribute implements LmlAttribute<ScrollPane> {
    @Override
    public Class<ScrollPane> getHandledType() {
        return ScrollPane.class;
    }

    @Override
    public void process(final LmlParser parser, final LmlTag tag, final ScrollPane actor,
            final String rawAttributeData) {
        final boolean disabled = parser.parseBoolean(rawAttributeData, actor);
        actor.setScrollingDisabled(disabled, disabled);
    }
}


text:
namespace VisualPerception.Teacher
{
    partial class Form32
    {
        /// <summary>
        /// Required designer variable.
        /// </summary>
        private System.ComponentModel.IContainer components = null;

        /// <summary>
        /// Clean up any resources being used.
        /// </summary>
        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
        protected override void Dispose(bool disposing)
        {
            if (disposing && (components != null))
            {
                components.Dispose();
            }
            base.Dispose(disposing);
        }

        #region Windows Form Designer generated code

        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
        {
            this.button3 = new System.Windows.Forms.Button();
            this.button2 = new System.Windows.Forms.Button();
            this.button1 = new System.Windows.Forms.Button();
            this.dataGridView1 = new System.Windows.Forms.DataGridView();
            this.Column1 = new System.Windows.Forms.DataGridViewTextBoxColumn();
            this.Column2 = new System.Windows.Forms.DataGridViewTextBoxColumn();
            this.Column3 = new System.Windows.Forms.DataGridViewTextBoxColumn();
            this.Column4 = new System.Windows.Forms.DataGridViewTextBoxColumn();
            this.label1 = new System.Windows.Forms.Label();
            ((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).BeginInit();
            this.SuspendLayout();
            //
            // button3
            //
            this.button3.Location = new System.Drawing.Point(401, 202);
            this.button3.Name = "button3";
            this.button3.Size = new System.Drawing.Size(145, 23);
            this.button3.TabIndex = 19;
            this.button3.Text = "Удалить студента";
            this.button3.UseVisualStyleBackColor = true;
            this.button3.Click += new System.EventHandler(this.button3_Click);
            //
            // button2
            //
            this.button2.Location = new System.Drawing.Point(401, 161);
            this.button2.Name = "button2";
            this.button2.Size = new System.Drawing.Size(145, 35);
            this.button2.TabIndex = 18;
            this.button2.Text = "Просмотр детальных результатов";
            this.button2.UseVisualStyleBackColor = true;
            this.button2.Click += new System.EventHandler(this.button2_Click);
            //
            // button1
            //
            this.button1.Location = new System.Drawing.Point(12, 427);
            this.button1.Name = "button1";
            this.button1.Size = new System.Drawing.Size(75, 23);
            this.button1.TabIndex = 17;
            this.button1.Text = "Назад";
            this.button1.UseVisualStyleBackColor = true;
            this.button1.Click += new System.EventHandler(this.button1_Click);
            //
            // dataGridView1
            //
            this.dataGridView1.AllowUserToAddRows = false;
            this.dataGridView1.BackgroundColor = System.Drawing.SystemColors.Control;
            this.dataGridView1.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
            this.dataGridView1.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
            this.dataGridView1.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
            this.Column1,
            this.Column2,
            this.Column3,
            this.Column4});
            this.dataGridView1.Location = new System.Drawing.Point(13, 34);
            this.dataGridView1.Name = "dataGridView1";
            this.dataGridView1.ScrollBars = System.Windows.Forms.ScrollBars.Vertical;
            this.dataGridView1.Size = new System.Drawing.Size(382, 387);
            this.dataGridView1.TabIndex = 16;
            //
            // Column1
            //
            this.Column1.HeaderText = "№";
            this.Column1.Name = "Column1";
            this.Column1.ReadOnly = true;
            this.Column1.Width = 40;
            //
            // Column2
            //
            this.Column2.HeaderText = "Имя студента";
            this.Column2.Name = "Column2";
            this.Column2.Width = 200;
            //
            // Column3
            //
            this.Column3.HeaderText = "Номер группы";
            this.Column3.Name = "Column3";
            //
            // Column4
            //
            this.Column4.HeaderText = "Id";
            this.Column4.Name = "Column4";
            this.Column4.Visible = false;
            //
            // label1
            //
            this.label1.AutoSize = true;
            this.label1.Font = new System.Drawing.Font("Microsoft Sans Serif", 10F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
            this.label1.Location = new System.Drawing.Point(13, 13);
            this.label1.Name = "label1";
            this.label1.Size = new System.Drawing.Size(333, 17);
            this.label1.TabIndex = 15;
            this.label1.Text = "Список студентов прошедших эксперемент";
            //
            // Form32
            //
            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            this.ClientSize = new System.Drawing.Size(734, 462);
            this.Controls.Add(this.button3);
            this.Controls.Add(this.button2);
            this.Controls.Add(this.button1);
            this.Controls.Add(this.dataGridView1);
            this.Controls.Add(this.label1);
            this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow;
            this.Name = "Form32";
            this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
            this.Text = "Исследование избирательности восприятия";
            this.Activated += new System.EventHandler(this.Form32_Activated);
            ((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).EndInit();
            this.ResumeLayout(false);
            this.PerformLayout();

        }

        #endregion

        private System.Windows.Forms.Button button3;
        private System.Windows.Forms.Button button2;
        private System.Windows.Forms.Button button1;
        private System.Windows.Forms.DataGridView dataGridView1;
        private System.Windows.Forms.Label label1;
        private System.Windows.Forms.DataGridViewTextBoxColumn Column1;
        private System.Windows.Forms.DataGridViewTextBoxColumn Column2;
        private System.Windows.Forms.DataGridViewTextBoxColumn Column3;
        private System.Windows.Forms.DataGridViewTextBoxColumn Column4;
    }
}


text:
const {createTestEnv} = require('../harness');

// For now sandboxing is only supported on macOS.
if (process.platform === 'darwin') {

  let sandbox = createTestEnv({
    sandbox: __dirname,
    esyTest: false
  });

  test('catches violation (darwin)', () => {
    let res = sandbox.execAndExpectFailure(`
    rm -rf _build _install _esy_store
    ../../.bin/esy build`
    );
    expect(res.status).not.toBe(0);
    expect(sandbox.readFile('node_modules', 'should_be_GOOD')).toBe('GOOD');
  });

}

test('just some dummy case so jest does not fail on unsupported platforms', () => {});


text:
package controllers;

import javafx.application.Platform;
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.fxml.FXMLLoader;
import javafx.scene.control.Button;
import javafx.scene.layout.Pane;

import java.io.IOException;

public class MainMenuController {

    public Button solo;
    public Button duel;
    public Button options;
    public Button exit;
    public Button rank;

    private MainController mainController;

    @FXML
    public void soloPressed(ActionEvent actionEvent) {
        System.out.println(actionEvent);
        FXMLLoader loader = new FXMLLoader(this.getClass().getResource("/fxml/SoloPrepare.fxml"));
        Pane pane = null;

        try {
            pane = loader.load();
        } catch (IOException e) {
            e.printStackTrace();
        }

        SoloPrepareController controller = loader.getController();
        controller.setMainController(mainController);
        mainController.addToStackPane(pane);
    }

    @FXML
    public void duelPressed(ActionEvent actionEvent) {
        System.out.println(actionEvent);
        FXMLLoader loader = new FXMLLoader(this.getClass().getResource("/fxml/DuelPrepare.fxml"));
        Pane pane = null;

        try {
            pane = loader.load();
        } catch (IOException e) {
            e.printStackTrace();
        }

        DuelPrepareController controller = loader.getController();
        controller.setMainController(mainController);
        mainController.addToStackPane(pane);
    }

    @FXML
    public void RankingPressed(ActionEvent actionEvent) {
        System.out.println(actionEvent);
        FXMLLoader loader = new FXMLLoader(this.getClass().getResource("/fxml/RankingScreen.fxml"));
        Pane pane = null;

        try {
            pane = loader.load();
        } catch (IOException e) {
            e.printStackTrace();
        }

        RankingController controller = loader.getController();
        controller.setMainController(mainController);
        controller.loadRank();
        mainController.addToStackPane(pane);
    }

    @FXML
    public void optionsPressed(ActionEvent actionEvent) {
        System.out.println(actionEvent);
        FXMLLoader loader = new FXMLLoader(this.getClass().getResource("/fxml/Options.fxml"));
        Pane pane = null;

        try {
            pane = loader.load();
        } catch (IOException e) {
            e.printStackTrace();
        }

        OptionsController controller = loader.getController();
        controller.setMainController(mainController);
        mainController.addToStackPane(pane);
    }

    @FXML
    public void exitPressed(ActionEvent actionEvent) {
        System.out.println(actionEvent);
        Platform.exit();
    }

    public void setMainController(MainController mainController) {
        this.mainController = mainController;
    }
}


text:
using System;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Xml;
using System.Xml.Linq;
using System.IO;
using System.Reflection;

using Duality.IO;

namespace Duality.Serialization
{
	/// <summary>
	/// De/Serializes object data.
	/// </summary>
	[DontSerialize]
	public class XmlSerializer : Serializer
	{
		private class CustomSerialIO : CustomSerialIOBase<XmlSerializer>
		{
			public const string HeaderElement = "header";
			public const string BodyElement = "body";

			public void Serialize(XmlSerializer formatter, XElement element)
			{
				foreach (var pair in this.data)
				{
					XElement fieldElement = new XElement(GetXmlElementName(pair.Key));
					element.Add(fieldElement);
					formatter.WriteObjectData(fieldElement, pair.Value);
				}
				this.Clear();
			}
			public void Deserialize(XmlSerializer formatter, XElement element)
			{
				this.Clear();
				if (!element.IsEmpty)
				{
					object value;
					foreach (XElement fieldElement in element.Elements())
					{
						value = formatter.ReadObjectData(fieldElement);
						this.data.Add(GetCodeElementName(fieldElement.Name.LocalName), value);
					}
				}
			}
		}

		private const string DocumentSeparator = "<!-- XmlFormatterBase Document Separator -->";

		private	Stream		stream	= null;
		private	XDocument	doc		= null;

		public override bool CanWrite
		{
			get { return this.stream != null && this.stream.CanWrite; }
		}
		public override bool CanRead
		{
			get { return this.stream != null && this.stream.CanRead; }
		}

		public XmlSerializer(Stream stream)
		{
			this.stream = stream;
		}

		protected override void WriteObjectData(object obj)
		{
			this.WriteObjectData(this.doc.Root, obj);
		}
		protected override object ReadObjectData()
		{
			XElement objElement = this.doc.Root;
			if (!objElement.HasAttributes) objElement = objElement.Elements().FirstOrDefault();
			return this.ReadObjectData(objElement);
		}

		protected override void BeginReadOperation()
		{
			if (this.stream == null) throw new InvalidOperationException("Can't read data, because the Stream is unavailable.");
			if (!this.stream.CanRead) throw new InvalidOperationException("Can't read data, because the Stream doesn't support it.");

			base.BeginReadOperation();

			using (XmlReader reader = XmlReader.Create(ReadSingleDocument(this.stream), GetReaderSettings()))
			{
				this.doc = XDocument.Load(reader);
			}
		}
		protected override void EndReadOperation()
		{
			base.EndReadOperation();
			this.doc = null;
		}
		protected override void BeginWriteOperation()
		{
			if (this.stream == null) throw new InvalidOperationException("Can't write data, because the Stream is unavailable.");
			if (!this.stream.CanWrite) throw new InvalidOperationException("Can't write data, because the Stream doesn't support it.");

			base.BeginWriteOperation();
			this.doc = new XDocument(new XElement("root"));
		}
		protected override void EndWriteOperation()
		{
			base.EndWriteOperation();
			using (XmlWriter writer = XmlWriter.Create(this.stream, GetWriterSettings()))
			{
				this.doc.Save(writer);
			}

			// Insert "stop token" separator, so reading Xml data won't screw up
			// the underlying streams position when reading it again later.
			using (StreamWriter writer = new StreamWriter(this.stream.NonClosing()))
			{
				writer.WriteLine();
				writer.WriteLine(DocumentSeparator);
			}
		}

		private void WriteObjectData(XElement element, object obj)
		{
			// Null? Empty Element.
			if (obj == null) return;

			// Retrieve type data
			ObjectHeader header = this.PrepareWriteObject(obj);
			if (header == null) return;

			// Write data type header
			if (header.DataType != DataType.Unknown) element.SetAttributeValue("dataType", header.DataType.ToString());
			if (header.IsObjectTypeRequired && !string.IsNullOrEmpty(header.TypeString)) element.SetAttributeValue("type", header.TypeString);
			if (header.IsObjectIdRequired && header.ObjectId != 0) element.SetAttributeValue("id", XmlConvert.ToString(header.ObjectId));

			// Write object
			try
			{
				this.idManager.PushIdLevel();
				this.WriteObjectBody(element, obj, header);
			}
			catch (Exception e)
			{
				// Log the error
				this.LocalLog.WriteError("Error writing object: {0}", Log.Exception(e));
			}
			finally
			{
				this.idManager.PopIdLevel();
			}
		}
		private void WriteObjectBody(XElement element, object obj, ObjectHeader header)
		{
			if (header.IsPrimitive)							this.WritePrimitive		(element, obj);
			else if (header.DataType == DataType.Enum)		this.WriteEnum			(element, obj as Enum, header);
			else if (header.DataType == DataType.String)	element.Value = obj as string;
			else if (header.DataType == DataType.Struct)	this.WriteStruct		(element, obj, header);
			else if (header.DataType == DataType.ObjectRef)	element.Value = XmlConvert.ToString(header.ObjectId);
			else if	(header.DataType == DataType.Array)		this.WriteArray			(element, obj, header);
			else if (header.DataType == DataType.Delegate)	this.WriteDelegate		(element, obj, header);
			else if (header.DataType.IsMemberInfoType())	this.WriteMemberInfo	(element, obj, header);
		}
		private void WritePrimitive(XElement element, object obj)
		{
			if		(obj is bool)		element.Value = XmlConvert.ToString((bool)obj);
			else if (obj is byte)		element.Value = XmlConvert.ToString((byte)obj);
			else if (obj is char)		element.Value = XmlConvert.EncodeName(XmlConvert.ToString((char)obj));
			else if (obj is string)		element.Value = (string)obj;
			else if (obj is sbyte)		element.Value = XmlConvert.ToString((sbyte)obj);
			else if (obj is short)		element.Value = XmlConvert.ToString((short)obj);
			else if (obj is ushort)		element.Value = XmlConvert.ToString((ushort)obj);
			else if (obj is int)		element.Value = XmlConvert.ToString((int)obj);
			else if (obj is uint)		element.Value = XmlConvert.ToString((uint)obj);
			else if (obj is long)		element.Value = XmlConvert.ToString((long)obj);
			else if (obj is ulong)		element.Value = XmlConvert.ToString((decimal)(ulong)obj);
			else if (obj is float)		element.Value = XmlConvert.ToString((float)obj);
			else if (obj is double)		element.Value = XmlConvert.ToString((double)obj);
			else if (obj is decimal)	element.Value = XmlConvert.ToString((decimal)obj);
			else if (obj == null)
				throw new ArgumentNullException("obj");
			else
				throw new ArgumentException(string.Format("Type '{0}' is not a primitive.", obj.GetType()));
		}
		private void WriteMemberInfo(XElement element, object obj, ObjectHeader header)
		{
			if (obj is Type)
			{
				Type type = obj as Type;
				SerializeType cachedType = GetSerializeType(type);
				element.SetAttributeValue("value", cachedType.TypeString);
			}
			else if (obj is MemberInfo)
			{
				MemberInfo member = obj as MemberInfo;
				element.SetAttributeValue("value", member.GetMemberId());
			}
			else if (obj == null)
				throw new ArgumentNullException("obj");
			else
				throw new ArgumentException(string.Format("Type '{0}' is not a supported MemberInfo.", obj.GetType()));
		}
		private void WriteArray(XElement element, object obj, ObjectHeader header)
		{
			Array objAsArray = obj as Array;
			TypeInfo arrayTypeInfo = header.ObjectType;
			Type elementType = arrayTypeInfo.GetElementType();
			TypeInfo elementTypeInfo = elementType.GetTypeInfo();

			if (objAsArray.Rank != 1) throw new NotSupportedException("Non single-Rank arrays are not supported");
			if (objAsArray.GetLowerBound(0) != 0) throw new NotSupportedException("Non zero-based arrays are not supported");

			// If it's a primitive array, save the values as a comma-separated list
			if (elementType == typeof(bool))			this.WriteArrayData(element, objAsArray as bool[]);
			else if (elementType == typeof(byte))		this.WriteArrayData(element, objAsArray as byte[]);
			else if (elementType == typeof(sbyte))		this.WriteArrayData(element, objAsArray as sbyte[]);
			else if (elementType == typeof(short))		this.WriteArrayData(element, objAsArray as short[]);
			else if (elementType == typeof(ushort))		this.WriteArrayData(element, objAsArray as ushort[]);
			else if (elementType == typeof(int))		this.WriteArrayData(element, objAsArray as int[]);
			else if (elementType == typeof(uint))		this.WriteArrayData(element, objAsArray as uint[]);
			else if (elementType == typeof(long))		this.WriteArrayData(element, objAsArray as long[]);
			else if (elementType == typeof(ulong))		this.WriteArrayData(element, objAsArray as ulong[]);
			else if (elementType == typeof(float))		this.WriteArrayData(element, objAsArray as float[]);
			else if (elementType == typeof(double))		this.WriteArrayData(element, objAsArray as double[]);
			else if (elementType == typeof(decimal))	this.WriteArrayData(element, objAsArray as decimal[]);
			// Any non-trivial object data will be serialized recursively
			else
			{
				int nonDefaultElementCount = this.GetArrayNonDefaultElementCount(objAsArray, elementTypeInfo);

				// Write Array elements
				for (int i = 0; i < nonDefaultElementCount; i++)
				{
					XElement itemElement = new XElement("item");
					element.Add(itemElement);

					this.WriteObjectData(itemElement, objAsArray.GetValue(i));
				}

				// Write original length, in case trailing elements were omitted or we have an (XML-ambiguous) zero-element array.
				if (nonDefaultElementCount != objAsArray.Length || nonDefaultElementCount == 0)
				{
					element.SetAttributeValue("length", XmlConvert.ToString(objAsArray.Length));
				}
			}
		}
		private void WriteStruct(XElement element, object obj, ObjectHeader header)
		{
			ISerializeExplicit objAsCustom = obj as ISerializeExplicit;
			ISerializeSurrogate objSurrogate = GetSurrogateFor(header.ObjectType);

			// Write the structs data type
			if (objAsCustom != null)	element.SetAttributeValue("custom", XmlConvert.ToString(true));
			if (objSurrogate != null)	element.SetAttributeValue("surrogate", XmlConvert.ToString(true));

			if (objSurrogate != null)
			{
				objSurrogate.RealObject = obj;
				objAsCustom = objSurrogate.SurrogateObject;

				CustomSerialIO customIO = new CustomSerialIO();
				try { objSurrogate.WriteConstructorData(customIO); }
				catch (Exception e) { this.LogCustomSerializationError(header.ObjectId, header.ObjectType, e); }

				XElement customHeaderElement = new XElement(CustomSerialIO.HeaderElement);
				element.Add(customHeaderElement);
				customIO.Serialize(this, customHeaderElement);
			}

			if (objAsCustom != null)
			{
				CustomSerialIO customIO = new CustomSerialIO();
				try { objAsCustom.WriteData(customIO); }
				catch (Exception e) { this.LogCustomSerializationError(header.ObjectId, header.ObjectType, e); }

				XElement customBodyElement = new XElement(CustomSerialIO.BodyElement);
				element.Add(customBodyElement);
				customIO.Serialize(this, customBodyElement);
			}
			else
			{
				// Write the structs fields
				foreach (FieldInfo field in header.SerializeType.Fields)
				{
					if (this.IsFieldBlocked(field, obj)) continue;

					XElement fieldElement = new XElement(GetXmlElementName(field.Name));
					element.Add(fieldElement);

					this.WriteObjectData(fieldElement, field.GetValue(obj));
				}
			}
		}
		private void WriteDelegate(XElement element, object obj, ObjectHeader header)
		{
			bool multi = obj is MulticastDelegate;

			// Write the delegates type
			if (multi) element.SetAttributeValue("multi", XmlConvert.ToString(multi));

			if (!multi)
			{
				XElement methodElement = new XElement("method");
				XElement targetElement = new XElement("target");
				element.Add(methodElement);
				element.Add(targetElement);

				Delegate objAsDelegate = obj as Delegate;
				this.WriteObjectData(methodElement, objAsDelegate.GetMethodInfo());
				this.WriteObjectData(targetElement, objAsDelegate.Target);
			}
			else
			{
				XElement methodElement = new XElement("method");
				XElement targetElement = new XElement("target");
				XElement invocationListElement = new XElement("invocationList");
				element.Add(methodElement);
				element.Add(targetElement);
				element.Add(invocationListElement);

				MulticastDelegate objAsDelegate = obj as MulticastDelegate;
				Delegate[] invokeList = objAsDelegate.GetInvocationList();
				this.WriteObjectData(methodElement, objAsDelegate.GetMethodInfo());
				this.WriteObjectData(targetElement, objAsDelegate.Target);
				this.WriteObjectData(invocationListElement, invokeList);
			}
		}
		private void WriteEnum(XElement element, Enum obj, ObjectHeader header)
		{
			element.SetAttributeValue("name", obj.ToString());
			element.SetAttributeValue("value", XmlConvert.ToString(Convert.ToInt64(obj)));
		}

		private void WriteArrayData(XElement element, bool[] array)
		{
			this.WritePrimitiveArrayData(element, array, v => XmlConvert.ToString(v));
		}
		private void WriteArrayData(XElement element, byte[] array)
		{
			element.Value = Convert.ToBase64String(array);
		}
		private void WriteArrayData(XElement element, sbyte[] array)
		{
			this.WritePrimitiveArrayData(element, array, v => XmlConvert.ToString(v));
		}
		private void WriteArrayData(XElement element, short[] array)
		{
			this.WritePrimitiveArrayData(element, array, v => XmlConvert.ToString(v));
		}
		private void WriteArrayData(XElement element, ushort[] array)
		{
			this.WritePrimitiveArrayData(element, array, v => XmlConvert.ToString(v));
		}
		private void WriteArrayData(XElement element, int[] array)
		{
			this.WritePrimitiveArrayData(element, array, v => XmlConvert.ToString(v));
		}
		private void WriteArrayData(XElement element, uint[] array)
		{
			this.WritePrimitiveArrayData(element, array, v => XmlConvert.ToString(v));
		}
		private void WriteArrayData(XElement element, long[] array)
		{
			this.WritePrimitiveArrayData(element, array, v => XmlConvert.ToString(v));
		}
		private void WriteArrayData(XElement element, ulong[] array)
		{
			this.WritePrimitiveArrayData(element, array, v => XmlConvert.ToString(v));
		}
		private void WriteArrayData(XElement element, float[] array)
		{
			this.WritePrimitiveArrayData(element, array, v => XmlConvert.ToString(v));
		}
		private void WriteArrayData(XElement element, double[] array)
		{
			this.WritePrimitiveArrayData(element, array, v => XmlConvert.ToString(v));
		}
		private void WriteArrayData(XElement element, decimal[] array)
		{
			this.WritePrimitiveArrayData(element, array, v => XmlConvert.ToString(v));
		}
		private void WritePrimitiveArrayData<T>(XElement element, T[] array, Func<T,string> toString) where T : struct
		{
			StringBuilder listBuilder = new StringBuilder();
			for (int i = 0; i < array.Length; i++)
			{
				if (i != 0) listBuilder.Append(", ");
				listBuilder.Append(toString(array[i]));
			}
			element.Value = listBuilder.ToString();
		}

		private object ReadObjectData(XElement element)
		{
			// Empty element without type data? Return null
			if (element.IsEmpty && !element.HasAttributes)
				return null;

			// Read data type header
			string objIdString = element.GetAttributeValue("id");
			string dataTypeStr = element.GetAttributeValue("dataType");
			string typeStr = element.GetAttributeValue("type");

			uint objId = objIdString == null ? 0 : XmlConvert.ToUInt32(objIdString);

			DataType dataType = DataType.Unknown;
			if (!Enum.TryParse<DataType>(dataTypeStr, out dataType))
			{
				if (dataTypeStr == "Class") // Legacy support (Written 2014-03-10)
					dataType = DataType.Struct;
				if (dataTypeStr == "MethodInfo" || // Legacy support (Written 2015-06-07)
					dataTypeStr == "ConstructorInfo" ||
					dataTypeStr == "PropertyInfo" ||
					dataTypeStr == "FieldInfo" ||
					dataTypeStr == "EventInfo")
					dataType = DataType.MemberInfo;
				else
					dataType = DataType.Unknown;
			}

			Type type = null;
			if (typeStr != null) type = this.ResolveType(typeStr, objId);

			ObjectHeader header = new ObjectHeader(objId, dataType, GetSerializeType(type));
			if (header.DataType == DataType.Unknown)
			{
				this.LocalLog.WriteError("Unable to process DataType: {0}.", dataTypeStr);
				return null;
			}

			// Read object
			object result = null;
			try
			{
				// Read the objects body
				result = this.ReadObjectBody(element, header);
			}
			catch (Exception e)
			{
				this.LocalLog.WriteError("Error reading object: {0}", Log.Exception(e));
			}

			return result;
		}
		private object ReadObjectBody(XElement element, ObjectHeader header)
		{
			object result = null;

			if (header.IsPrimitive)							result = this.ReadPrimitive(element, header.DataType);
			else if (header.DataType == DataType.String)	result = element.Value;
			else if (header.DataType == DataType.Enum)		result = this.ReadEnum(element, header);
			else if (header.DataType == DataType.Struct)	result = this.ReadStruct(element, header);
			else if (header.DataType == DataType.ObjectRef)	result = this.ReadObjectRef(element);
			else if (header.DataType == DataType.Array)		result = this.ReadArray(element, header);
			else if (header.DataType == DataType.Delegate)	result = this.ReadDelegate(element, header);
			else if (header.DataType.IsMemberInfoType())	result = this.ReadMemberInfo(element, header);

			return result;
		}
		private object ReadPrimitive(XElement element, DataType dataType)
		{
			string val = element.Value;
			switch (dataType)
			{
				case DataType.Bool:			return XmlConvert.ToBoolean(val);
				case DataType.Byte:			return XmlConvert.ToByte(val);
				case DataType.SByte:		return XmlConvert.ToSByte(val);
				case DataType.Short:		return XmlConvert.ToInt16(val);
				case DataType.UShort:		return XmlConvert.ToUInt16(val);
				case DataType.Int:			return XmlConvert.ToInt32(val);
				case DataType.UInt:			return XmlConvert.ToUInt32(val);
				case DataType.Long:			return XmlConvert.ToInt64(val);
				case DataType.ULong:		return XmlConvert.ToUInt64(val);
				case DataType.Float:		return XmlConvert.ToSingle(val);
				case DataType.Double:		return XmlConvert.ToDouble(val);
				case DataType.Decimal:		return XmlConvert.ToDecimal(val);
				case DataType.Char:			return XmlConvert.ToChar(XmlConvert.DecodeName(val));
				case DataType.String:		return val;
				default:
					throw new ArgumentException(string.Format("DataType '{0}' is not a primitive.", dataType));
			}
		}
		private Array ReadArray(XElement element, ObjectHeader header)
		{
			Array arrObj;
			TypeInfo arrayTypeInfo = header.ObjectType;
			Type elementType = arrayTypeInfo.GetElementType();

			// Determine the array length based on child elements or explicit value
			string explicitLengthString = element.GetAttributeValue("length");
			int explicitLength = explicitLengthString == null ? -1 : XmlConvert.ToInt32(explicitLengthString);

			// Expect the "complex" array format, if there are child elements or an explicit length (children may be omitted)
			bool isComplex = element.Elements().Any() || explicitLength != -1;
			bool isEmpty = explicitLength == 0 || (!isComplex && string.IsNullOrEmpty(element.Value));

			// Early-out: Create an empty array
			if (isEmpty)
			{
				arrObj = header.ObjectType != null ? Array.CreateInstance(elementType, 0) : null;
				this.idManager.Inject(arrObj, header.ObjectId);
			}
			// Read a primitive value array
			else if (!isComplex)
			{
				if		(elementType == typeof(bool))		{ bool[]	array; this.ReadArrayData(element, out array); arrObj = array; }
				else if (elementType == typeof(byte))		{ byte[]	array; this.ReadArrayData(element, out array); arrObj = array; }
				else if (elementType == typeof(sbyte))		{ sbyte[]	array; this.ReadArrayData(element, out array); arrObj = array; }
				else if (elementType == typeof(short))		{ short[]	array; this.ReadArrayData(element, out array); arrObj = array; }
				else if (elementType == typeof(ushort))		{ ushort[]	array; this.ReadArrayData(element, out array); arrObj = array; }
				else if (elementType == typeof(int))		{ int[]		array; this.ReadArrayData(element, out array); arrObj = array; }
				else if (elementType == typeof(uint))		{ uint[]	array; this.ReadArrayData(element, out array); arrObj = array; }
				else if (elementType == typeof(long))		{ long[]	array; this.ReadArrayData(element, out array); arrObj = array; }
				else if (elementType == typeof(ulong))		{ ulong[]	array; this.ReadArrayData(element, out array); arrObj = array; }
				else if (elementType == typeof(float))		{ float[]	array; this.ReadArrayData(element, out array); arrObj = array; }
				else if (elementType == typeof(double))		{ double[]	array; this.ReadArrayData(element, out array); arrObj = array; }
				else if (elementType == typeof(decimal))	{ decimal[]	array; this.ReadArrayData(element, out array); arrObj = array; }
				else
				{
					this.LocalLog.WriteWarning("Can't read primitive value array. Unknown element type '{0}'. Discarding data.", Log.Type(elementType));
					arrObj = header.ObjectType != null ? Array.CreateInstance(elementType, 0) : null;
				}

				// Set object reference
				this.idManager.Inject(arrObj, header.ObjectId);
			}
			// Read a complex value array, where each item is an XML element
			else
			{
				int arrLength = explicitLength != -1 ? explicitLength : element.Elements().Count();

				// Prepare object reference
				arrObj = header.ObjectType != null ? Array.CreateInstance(elementType, arrLength) : null;
				this.idManager.Inject(arrObj, header.ObjectId);

				int itemIndex = 0;
				foreach (XElement itemElement in element.Elements())
				{
					object item = this.ReadObjectData(itemElement);
					if (arrObj != null) arrObj.SetValue(item, itemIndex);

					itemIndex++;
					if (itemIndex >= arrLength) break;
				}
			}

			return arrObj;
		}
		private object ReadStruct(XElement element, ObjectHeader header)
		{
			// Read struct type
			string	customString	= element.GetAttributeValue("custom");
			string	surrogateString	= element.GetAttributeValue("surrogate");
			bool	custom			= customString != null && XmlConvert.ToBoolean(customString);
			bool	surrogate		= surrogateString != null && XmlConvert.ToBoolean(surrogateString);

			// Retrieve surrogate if requested
			ISerializeSurrogate objSurrogate = null;
			if (surrogate && header.ObjectType != null) objSurrogate = GetSurrogateFor(header.ObjectType);

			// Construct object
			object obj = null;
			if (header.ObjectType != null)
			{
				if (objSurrogate != null)
				{
					custom = true;

					// Set fake object reference for surrogate constructor: No self-references allowed here.
					this.idManager.Inject(null, header.ObjectId);

					CustomSerialIO customIO = new CustomSerialIO();
					XElement customHeaderElement = element.Element(CustomSerialIO.HeaderElement) ?? element.Elements().FirstOrDefault();
					if (customHeaderElement != null)
					{
						customIO.Deserialize(this, customHeaderElement);
					}
					try { obj = objSurrogate.ConstructObject(customIO, header.ObjectType); }
					catch (Exception e) { this.LogCustomDeserializationError(header.ObjectId, header.ObjectType, e); }
				}
				if (obj == null) obj = header.ObjectType.CreateInstanceOf();
			}

			// Prepare object reference
			this.idManager.Inject(obj, header.ObjectId);

			// Read custom object data
			if (custom)
			{
				CustomSerialIO customIO = new CustomSerialIO();
				XElement customBodyElement = element.Element(CustomSerialIO.BodyElement) ?? element.Elements().ElementAtOrDefault(1);
				if (customBodyElement != null)
				{
					customIO.Deserialize(this, customBodyElement);
				}

				ISerializeExplicit objAsCustom;
				if (objSurrogate != null)
				{
					objSurrogate.RealObject = obj;
					objAsCustom = objSurrogate.SurrogateObject;
				}
				else
					objAsCustom = obj as ISerializeExplicit;

				if (objAsCustom != null)
				{
					try { objAsCustom.ReadData(customIO); }
					catch (Exception e) { this.LogCustomDeserializationError(header.ObjectId, header.ObjectType, e); }
				}
				else if (obj != null && header.ObjectType != null)
				{
					this.LocalLog.WriteWarning(
						"Object data (Id {0}) is flagged for custom deserialization, yet the objects Type ('{1}') does not support it. Guessing associated fields...",
						header.ObjectId,
						Log.Type(header.ObjectType));
					this.LocalLog.PushIndent();
					foreach (var pair in customIO.Data)
					{
						this.AssignValueToField(header.SerializeType, obj, pair.Key, pair.Value);
					}
					this.LocalLog.PopIndent();
				}
			}
			// Red non-custom object data
			else if (!element.IsEmpty)
			{
				// Read fields
				object fieldValue;
				foreach (XElement fieldElement in element.Elements())
				{
					fieldValue = this.ReadObjectData(fieldElement);
					this.AssignValueToField(header.SerializeType, obj, GetCodeElementName(fieldElement.Name.LocalName), fieldValue);
				}
			}

			return obj;
		}
		private object ReadObjectRef(XElement element)
		{
			object obj;
			uint objId = XmlConvert.ToUInt32(element.Value);

			if (!this.idManager.Lookup(objId, out obj)) throw new Exception(string.Format("Can't resolve object reference '{0}'.", objId));

			return obj;
		}
		private MemberInfo ReadMemberInfo(XElement element, ObjectHeader header)
		{
			MemberInfo result;
			try
			{
				if (header.DataType == DataType.Type)
				{
					string typeString = element.GetAttributeValue("value");
					result = this.ResolveType(typeString, header.ObjectId).GetTypeInfo();
				}
				else
				{
					string memberString = element.GetAttributeValue("value");
					result = this.ResolveMember(memberString, header.ObjectId);
				}
			}
			catch (Exception e)
			{
				result = null;
				this.LocalLog.WriteError(
					"An error occurred in deserializing MemberInfo object Id {0} of type '{1}': {2}",
					header.ObjectId,
					Log.Type(header.ObjectType),
					Log.Exception(e));
			}

			// Prepare object reference
			this.idManager.Inject(result, header.ObjectId);

			return result;
		}
		private Delegate ReadDelegate(XElement element, ObjectHeader header)
		{
			string multiString = element.GetAttributeValue("multi");
			bool multi = multiString != null && XmlConvert.ToBoolean(multiString);

			XElement methodElement = element.Element("method") ?? element.Elements().FirstOrDefault();
			XElement targetElement = element.Element("target") ?? element.Elements().ElementAtOrDefault(1);
			XElement invocationListElement = element.Element("invocationList") ?? element.Elements().ElementAtOrDefault(2);

			// Create the delegate without target and fix it later, so we can register its object id before loading its target object
			MethodInfo	method	= this.ReadObjectData(methodElement) as MethodInfo;
			object		target	= null;
			Delegate	del		= header.ObjectType != null && method != null ? method.CreateDelegate(header.ObjectType.AsType(), target) : null;

			// Prepare object reference
			this.idManager.Inject(del, header.ObjectId);

			// Read the target object now and replace the dummy
			target = this.ReadObjectData(targetElement);
			if (del != null && target != null)
			{
				FieldInfo targetField = header.ObjectType.DeclaredFields.FirstOrDefault(f => !f.IsStatic && f.Name == "_target");
				targetField.SetValue(del, target);
			}

			// Combine multicast delegates
			if (multi)
			{
				Delegate[] invokeList = (this.ReadObjectData(invocationListElement) as Delegate[]).NotNull().ToArray();
				del = invokeList.Length > 0 ? Delegate.Combine(invokeList) : null;
			}

			return del;
		}
		private Enum ReadEnum(XElement element, ObjectHeader header)
		{
			string name = element.GetAttributeValue("name");
			string valueString = element.GetAttributeValue("value");
			long val = valueString == null ? 0 : XmlConvert.ToInt64(valueString);
			return (header.ObjectType == null) ? null : this.ResolveEnumValue(header.ObjectType.AsType(), name, val);
		}

		private void ReadArrayData(XElement element, out bool[] array)
		{
			this.ReadPrimitiveArrayData(element, out array, s => XmlConvert.ToBoolean(s));
		}
		private void ReadArrayData(XElement element, out byte[] array)
		{
			array = Convert.FromBase64String(element.Value);
		}
		private void ReadArrayData(XElement element, out sbyte[] array)
		{
			this.ReadPrimitiveArrayData(element, out array, s => (sbyte)XmlConvert.ToInt16(s));
		}
		private void ReadArrayData(XElement element, out short[] array)
		{
			this.ReadPrimitiveArrayData(element, out array, s => XmlConvert.ToInt16(s));
		}
		private void ReadArrayData(XElement element, out ushort[] array)
		{
			this.ReadPrimitiveArrayData(element, out array, s => XmlConvert.ToUInt16(s));
		}
		private void ReadArrayData(XElement element, out int[] array)
		{
			this.ReadPrimitiveArrayData(element, out array, s => XmlConvert.ToInt32(s));
		}
		private void ReadArrayData(XElement element, out uint[] array)
		{
			this.ReadPrimitiveArrayData(element, out array, s => XmlConvert.ToUInt32(s));
		}
		private void ReadArrayData(XElement element, out long[] array)
		{
			this.ReadPrimitiveArrayData(element, out array, s => XmlConvert.ToInt64(s));
		}
		private void ReadArrayData(XElement element, out ulong[] array)
		{
			this.ReadPrimitiveArrayData(element, out array, s => XmlConvert.ToUInt64(s));
		}
		private void ReadArrayData(XElement element, out float[] array)
		{
			this.ReadPrimitiveArrayData(element, out array, s => XmlConvert.ToSingle(s));
		}
		private void ReadArrayData(XElement element, out double[] array)
		{
			this.ReadPrimitiveArrayData(element, out array, s => XmlConvert.ToDouble(s));
		}
		private void ReadArrayData(XElement element, out decimal[] array)
		{
			this.ReadPrimitiveArrayData(element, out array, s => XmlConvert.ToDecimal(s));
		}
		private void ReadPrimitiveArrayData<T>(XElement element, out T[] array, Func<string,T> fromString) where T : struct
		{
			string[] valueStrings = element.Value.Split(new char[] { ',' });
			array = new T[valueStrings.Length];
			try
			{
				for (int i = 0; i < array.Length; i++)
				{
					array[i] = fromString(valueStrings[i]);
				}
			}
			catch (Exception e)
			{
				this.LocalLog.WriteError("Error reading primitive value array of element type {0}: {1}", Log.Type(typeof(T)), Log.Exception(e));
			}
		}

		/// <summary>
		/// Determines the length of the longest Array element sequence that contains
		/// non-default values, beginning at index zero. It is the number of elements
		/// that actually needs to be serialized.
		/// </summary>
		/// <param name="array"></param>
		/// <param name="elementType"></param>
		/// <returns></returns>
		private int GetArrayNonDefaultElementCount(Array array, TypeInfo elementType)
		{
			if (array.Length == 0) return 0;

			int omitElementCount = 0;
			object defaultValue = elementType.GetDefaultOf();
			while (omitElementCount < array.Length && object.Equals(array.GetValue(array.Length - omitElementCount - 1), defaultValue))
			{
				omitElementCount++;
			}

			return array.Length - omitElementCount;
		}

		/// <summary>
		/// Returns whether the specified stream is an XML stream. The check requires a stream that is both readable and seekable.
		/// </summary>
		/// <param name="stream"></param>
		/// <returns></returns>
		[System.Diagnostics.DebuggerStepThrough]
		public static bool IsXmlStream(Stream stream)
		{
			if (!stream.CanRead) throw new InvalidOperationException("The specified stream is not readable.");
			if (!stream.CanSeek) throw new InvalidOperationException("The specified stream is not seekable. XML check aborted to maintain stream state.");
			if (stream.Length == 0) throw new InvalidOperationException("The specified stream is empty.");
			long oldPos = stream.Position;

			bool isXml = true;
			try
			{
				using (XmlReader xmlRead = XmlReader.Create(stream, GetReaderSettings()))
				{
					xmlRead.Read();
				}
			} catch (Exception) { isXml = false; }
			stream.Seek(oldPos, SeekOrigin.Begin);

			return isXml;
		}

		/// <summary>
		/// Wraps the specified <see cref="Stream"/> in a sub-stream that can only access the next available XML document section.
		/// </summary>
		/// <param name="stream"></param>
		/// <returns></returns>
		private static Stream ReadSingleDocument(Stream stream)
		{
			if (!stream.CanSeek) throw new InvalidOperationException("The specified stream needs to be seekable.");

			long oldPos = stream.Position;

			Encoding encoding = null;
			StringBuilder docDataBuilder = new StringBuilder();
			int byteOffset = 0;

			using (StreamReader reader = new StreamReader(stream.NonClosing()))
			{
				// Determine Encoding and preamble length when at the beginning of the stream
				encoding = reader.CurrentEncoding;
				if (stream.Position == 0)
				{
					byte[] preamble = encoding.GetPreamble();
					byte[] preambleRead = new byte[preamble.Length];
					if (stream.Read(preambleRead, 0, preambleRead.Length) == preamble.Length)
					{
						if (preamble.SequenceEqual(preambleRead))
						{
							byteOffset += preamble.Length;
						}
					}
					stream.Position = 0;
				}

				// Read the appropriate XML document portion of the stream.
				bool firstContentLine = true;
				while (!reader.EndOfStream)
				{
					string line = reader.ReadLine();
					int indexOf = line.IndexOf(DocumentSeparator);

					// Consume regular lines
					if (indexOf == -1)
					{
						docDataBuilder.AppendLine(line);
					}
					// Consume the separator when it occurs first
					else if (firstContentLine)
					{
						docDataBuilder.AppendLine(line.Remove(0, indexOf + DocumentSeparator.Length));
						byteOffset += reader.CurrentEncoding.GetBytes(DocumentSeparator).Length;
					}
					// Stop at the separator when it occurs last
					else
					{
						docDataBuilder.Append(line.Substring(0, indexOf));
						byteOffset += reader.CurrentEncoding.GetBytes(DocumentSeparator + Environment.NewLine).Length;
						break;
					}

					if (!string.IsNullOrWhiteSpace(line)) firstContentLine = false;
				}
			}

			// Create a MemoryStream from the desired subsection of the original Stream
			string reducedDoc = docDataBuilder.ToString();
			byte[] reducedData = encoding.GetBytes(reducedDoc);
			MemoryStream result = new MemoryStream(reducedData);

			// Reset the original Stream to the expected position and return the substream
			stream.Position = oldPos + byteOffset + reducedData.Length;
			return result;
		}

		private static string GetXmlElementName(string codeName)
		{
			return XmlConvert.EncodeName(codeName);
		}
		private static string GetCodeElementName(string xmlName)
		{
			// Legacy support. Remove later. (Written 2014-01-10)
			xmlName = xmlName.Replace("__sbo__", "<").Replace("__sbc__", ">");
			return XmlConvert.DecodeName(xmlName);
		}

		private static XmlReaderSettings GetReaderSettings()
		{
			XmlReaderSettings settings = new XmlReaderSettings();
			settings.DtdProcessing = DtdProcessing.Ignore;
			settings.IgnoreWhitespace = true;
			settings.IgnoreComments = true;
			settings.IgnoreProcessingInstructions = true;
			settings.CloseInput = false;
			return settings;
		}
		private static XmlWriterSettings GetWriterSettings()
		{
			XmlWriterSettings settings = new XmlWriterSettings();
			settings.OmitXmlDeclaration = true;
			settings.Indent = true;
			settings.CloseOutput = false;
			return settings;
		}
	}
}