text:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
	<modelVersion>4.0.0</modelVersion>

	<groupId>com.github.jtendermint</groupId>
	<artifactId>websocket-tendermint</artifactId>
	<version>0.0.3-SNAPSHOT</version>

	<repositories>
		<repository>
		    <id>jitpack.io</id>
		    <url>https://jitpack.io</url>
		</repository>
	</repositories>

	<build>
		<plugins>
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-compiler-plugin</artifactId>
				<version>3.5.1</version>
				<configuration>
					<source>1.8</source>
					<target>1.8</target>
				</configuration>
			</plugin>
		</plugins>
	</build>

	<dependencies>
		<dependency>
			<groupId>org.glassfish.tyrus</groupId>
			<artifactId>tyrus-client</artifactId>
			<version>1.13.1</version>
		</dependency>
		<dependency>
			<groupId>org.glassfish.tyrus</groupId>
			<artifactId>tyrus-container-grizzly-client</artifactId>
			<version>1.13.1</version>
		</dependency>
		<dependency>
			<groupId>org.glassfish.tyrus.ext</groupId>
			<artifactId>tyrus-client-java8</artifactId>
			<version>1.12</version>
		</dependency>
		<dependency>
			<groupId>com.google.code.gson</groupId>
			<artifactId>gson</artifactId>
			<version>2.8.2</version>
		</dependency>
		<dependency>
		    <groupId>com.github.jtendermint</groupId>
		    <artifactId>crypto</artifactId>
		    <version>-SNAPSHOT</version>
		</dependency>
        <!-- Testing -->
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.12</version>
            <scope>testing</scope>
        </dependency>
	</dependencies>
</project>


text:
//
//  rect.hpp
//  ChaosGL
//
//  Created by Fu Lam Diep on 12.03.16.
//  Copyright © 2016 Fu Lam Diep. All rights reserved.
//

#ifndef ChaosGL_rect_hpp
#define ChaosGL_rect_hpp

#include <glm/glm.hpp>
#include "size.hpp"

namespace chaosgl
{
		template<typename T, glm::precision P = glm::defaultp>
		struct t_rect
		{
		public:

			/// Describes its own type
			typedef t_rect<T, P> type;

			/// Describes the type of the elements of the generic members origin and size
			typedef T value_type;

			/// Provides the origin of the rectangle
			glm::tvec2<T, P> origin;

			/// Provides the size with width and height of the rectangle
			gl::t_size<T, P> size;

			/// Constructs the rect by passing origin and size objects
			t_rect (glm::tvec2<T, P> origin, gl::t_size<T, P> size) : origin(origin), size(size) {}

			/// Constructs the rect by passing a size objects and implictly set origin to zero
			t_rect (gl::t_size<T, P> size) : t_rect(glm::tvec2<T, P>(0, 0), size) {}

			/// Constructs the rect with components of the origin and size
			t_rect (T x, T y, T width, T height) : t_rect(glm::tvec2<T, P>(x, y), gl::size<T, P>(width, height)) {}

			/// Constructs the rect with comoponents of size
			t_rect (T width, T height) : t_rect(glm::tvec2<T, P>(), gl::t_size<T, P>(width, height)) {}

			/// Copy constructor
			t_rect (const t_rect& r) : t_rect(r.origin, r.size) {}

			/// Destructor
			virtual ~t_rect () {};
		};

		typedef t_rect<float, glm::highp> highp_rect;
		typedef highp_rect rect;
	}
}

#endif /* rect_h */

redpajama_set_name: RedPajamaGithub


text:
using namespace Halley;

static EGLint contextAttribs[] = {
    EGL_CONTEXT_MAJOR_VERSION_KHR, 3,
    EGL_NONE
};

AndroidGLContext::AndroidGLContext(AndroidGLContext* other)
    : config(other->config)
    , display(other->display)
    , shared(true)
    , ownsSurface(true)
{
    EGLint surfaceAttribs[] = {
        EGL_WIDTH, 1,
        EGL_HEIGHT, 1,
        EGL_NONE
    };
    surface = eglCreatePbufferSurface(display, config, surfaceAttribs);
    context = eglCreateContext(display, config, other->context, contextAttribs);
    if (!context) {
        throw Exception("Unable to create shared OpenGL context", HalleyExceptions::SystemPlugin);
    }
}

AndroidGLContext::AndroidGLContext(EGLConfig config, EGLDisplay display, EGLSurface surface)
    : config(config)
    , display(display)
    , surface(surface)
    , shared(false)
{
    context = eglCreateContext(display, config, EGL_NO_CONTEXT, contextAttribs);
    if (!context) {
        throw Exception("Unable to create OpenGL context", HalleyExceptions::SystemPlugin);
    }
}

AndroidGLContext::~AndroidGLContext()
{
    eglMakeCurrent(display, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
    if (ownsSurface) {
        eglDestroySurface(display, surface);
    }
    eglDestroyContext(display, context);
}

void AndroidGLContext::bind()
{
    eglMakeCurrent(display, surface, surface, context);
}

std::unique_ptr <GLContext> AndroidGLContext::createSharedContext()
{
    return std::make_unique<AndroidGLContext>(this);
}


text:
namespace Minesweeper
{
    using System;
    using System.Collections.Generic;

    public class PlayfieldManager
    {
        public void RevealCell(char[,] initialField, char[,] fieldWithMines, int row, int column)
        {
            char numberOfNeighbouringMines = this.GetNumberOfNeighbouringMines(fieldWithMines, row, column);
            fieldWithMines[row, column] = numberOfNeighbouringMines;
            initialField[row, column] = numberOfNeighbouringMines;
        }

        public char[,] CreatePlayfield(char fillingSymbol = MessageAndSymbolConstants.HiddenCellSymbol)
        {
            int rows = MinesweeperEngine.BoardRows;
            int cols = MinesweeperEngine.BoardColumns;
            char[,] board = new char[rows, cols];

            for (int i = 0; i < rows; i++)
            {
                for (int j = 0; j < cols; j++)
                {
                    board[i, j] = fillingSymbol;
                }
            }

            return board;
        }

        public char[,] PositionMines()
        {
            int rows = MinesweeperEngine.BoardRows;
            int cols = MinesweeperEngine.BoardColumns;
            char[,] mineField = this.CreatePlayfield(MessageAndSymbolConstants.EmptyCellSymbol);

            List<int> randomCellNumbers = new List<int>();
            int numberOfMines = (int)MinesweeperEngine.DifficultyLevel;
            int numberOfCells = rows * cols;

            while (randomCellNumbers.Count < numberOfMines)
            {
                Random random = new Random();
                int randomCellNumber = random.Next(numberOfCells);
                if (!randomCellNumbers.Contains(randomCellNumber))
                {
                    randomCellNumbers.Add(randomCellNumber);
                }
            }

            foreach (int randomCellNumber in randomCellNumbers)
            {
                int minePositionRow = randomCellNumber / cols;
                int minePositionCol = randomCellNumber % cols;
                if (minePositionCol == 0 && randomCellNumber != 0)
                {
                    minePositionRow--;
                    minePositionCol = cols;
                }
                else
                {
                    minePositionCol++;
                }

                mineField[minePositionRow, minePositionCol - 1] = MessageAndSymbolConstants.MineSymbol;
            }

            return mineField;
        }

        public char GetNumberOfNeighbouringMines(char[,] fieldWithMines, int row, int column)
        {
            int minesCount = 0;
            int rows = fieldWithMines.GetLength(0);
            int colums = fieldWithMines.GetLength(1);

            if (row - 1 >= 0)
            {
                if (fieldWithMines[row - 1, column] == MessageAndSymbolConstants.MineSymbol)
                {
                    minesCount++;
                }
            }

            if (row + 1 < rows)
            {
                if (fieldWithMines[row + 1, column] == MessageAndSymbolConstants.MineSymbol)
                {
                    minesCount++;
                }
            }

            if (column - 1 >= 0)
            {
                if (fieldWithMines[row, column - 1] == MessageAndSymbolConstants.MineSymbol)
                {
                    minesCount++;
                }
            }

            if (column + 1 < colums)
            {
                if (fieldWithMines[row, column + 1] == MessageAndSymbolConstants.MineSymbol)
                {
                    minesCount++;
                }
            }

            if ((row - 1 >= 0) && (column - 1 >= 0))
            {
                if (fieldWithMines[row - 1, column - 1] == MessageAndSymbolConstants.MineSymbol)
                {
                    minesCount++;
                }
            }

            if ((row - 1 >= 0) && (column + 1 < colums))
            {
                if (fieldWithMines[row - 1, column + 1] == MessageAndSymbolConstants.MineSymbol)
                {
                    minesCount++;
                }
            }

            if ((row + 1 < rows) && (column - 1 >= 0))
            {
                if (fieldWithMines[row + 1, column - 1] == MessageAndSymbolConstants.MineSymbol)
                {
                    minesCount++;
                }
            }

            if ((row + 1 < rows) && (column + 1 < colums))
            {
                if (fieldWithMines[row + 1, column + 1] == MessageAndSymbolConstants.MineSymbol)
                {
                    minesCount++;
                }
            }

            return char.Parse(minesCount.ToString());
        }
    }
}


text:
<?xml version="1.0" encoding="UTF-8"?>
<Form xmlns="http://v8.1c.ru/8.3/xcf/logform" xmlns:app="http://v8.1c.ru/8.2/managed-application/core" xmlns:cfg="http://v8.1c.ru/8.1/data/enterprise/current-config" xmlns:dcscor="http://v8.1c.ru/8.1/data-composition-system/core" xmlns:dcsset="http://v8.1c.ru/8.1/data-composition-system/settings" xmlns:ent="http://v8.1c.ru/8.1/data/enterprise" xmlns:lf="http://v8.1c.ru/8.2/managed-application/logform" xmlns:style="http://v8.1c.ru/8.1/data/ui/style" xmlns:sys="http://v8.1c.ru/8.1/data/ui/fonts/system" xmlns:v8="http://v8.1c.ru/8.1/data/core" xmlns:v8ui="http://v8.1c.ru/8.1/data/ui" xmlns:web="http://v8.1c.ru/8.1/data/ui/colors/web" xmlns:win="http://v8.1c.ru/8.1/data/ui/colors/windows" xmlns:xr="http://v8.1c.ru/8.3/xcf/readable" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
	<VerticalScroll>useIfNecessary</VerticalScroll>
	<UseForFoldersAndItems>Items</UseForFoldersAndItems>
	<AutoCommandBar name="ФормаКоманднаяПанель" id="-1">
		<ChildItems>
			<Button name="Закрыть" id="39">
				<Type>CommandBarButton</Type>
				<SkipOnInput>false</SkipOnInput>
				<CommandName>0</CommandName>
				<Parameter xsi:nil="true"/>
				<ExtendedTooltip name="ЗакрытьExtendedTooltip" id="73"/>
			</Button>
		</ChildItems>
	</AutoCommandBar>
	<Events>
		<Event name="AfterWrite">ПослеЗаписи</Event>
		<Event name="AfterWriteAtServer">ПослеЗаписиНаСервере</Event>
		<Event name="OnOpen">ПриОткрытии</Event>
		<Event name="OnCreateAtServer">ПриСозданииНаСервере</Event>
		<Event name="BeforeWriteAtServer">ПередЗаписьюНаСервере</Event>
	</Events>
	<ChildItems>
		<UsualGroup name="ГруппаНаименованиеКод" id="31">
			<Title>
				<v8:item>
					<v8:lang>ru</v8:lang>
					<v8:content>Группа наименование код</v8:content>
				</v8:item>
			</Title>
			<ToolTip>
				<v8:item>
					<v8:lang>ru</v8:lang>
					<v8:content>Группа наименование код</v8:content>
				</v8:item>
			</ToolTip>
			<Group>Horizontal</Group>
			<Representation>None</Representation>
			<ShowTitle>false</ShowTitle>
			<ExtendedTooltip name="ГруппаНаименованиеКодExtendedTooltip" id="74"/>
			<ChildItems>
				<InputField name="Наименование" id="3">
					<DataPath>Объект.Description</DataPath>
					<Wrap>false</Wrap>
					<ContextMenu name="НаименованиеКонтекстноеМеню" id="4"/>
					<ExtendedTooltip name="НаименованиеExtendedTooltip" id="75"/>
				</InputField>
				<InputField name="акКодСДР" id="69">
					<DataPath>Объект.акКодСДР</DataPath>
					<WarningOnEditRepresentation>Show</WarningOnEditRepresentation>
					<WarningOnEdit>
						<v8:item>
							<v8:lang>ru</v8:lang>
							<v8:content>Код СДР будет присвоен автоматически при записи проектной задачи</v8:content>
						</v8:item>
					</WarningOnEdit>
					<Width>8</Width>
					<ContextMenu name="акКодСДРКонтекстноеМеню" id="70"/>
					<ExtendedTooltip name="акКодСДРExtendedTooltip" id="76"/>
				</InputField>
				<InputField name="Код" id="1">
					<DataPath>Объект.Code</DataPath>
					<ReadOnly>true</ReadOnly>
					<Wrap>false</Wrap>
					<ContextMenu name="КодКонтекстноеМеню" id="2"/>
					<ExtendedTooltip name="КодExtendedTooltip" id="77"/>
				</InputField>
			</ChildItems>
		</UsualGroup>
		<UsualGroup name="ГруппаОсновная" id="40">
			<ToolTip>
				<v8:item>
					<v8:lang>ru</v8:lang>
					<v8:content>Группа основная</v8:content>
				</v8:item>
			</ToolTip>
			<Group>Horizontal</Group>
			<Representation>None</Representation>
			<ShowTitle>false</ShowTitle>
			<ExtendedTooltip name="ГруппаОсновнаяExtendedTooltip" id="78"/>
			<ChildItems>
				<UsualGroup name="ГруппаОсновнаяЛево" id="41">
					<Title>
						<v8:item>
							<v8:lang>ru</v8:lang>
							<v8:content>Группа основная лево</v8:content>
						</v8:item>
					</Title>
					<ToolTip>
						<v8:item>
							<v8:lang>ru</v8:lang>
							<v8:content>Группа основная лево</v8:content>
						</v8:item>
					</ToolTip>
					<Representation>None</Representation>
					<ShowTitle>false</ShowTitle>
					<ExtendedTooltip name="ГруппаОсновнаяЛевоExtendedTooltip" id="79"/>
					<ChildItems>
						<InputField name="Владелец" id="5">
							<DataPath>Объект.Owner</DataPath>
							<Wrap>false</Wrap>
							<ContextMenu name="ВладелецКонтекстноеМеню" id="6"/>
							<ExtendedTooltip name="ВладелецExtendedTooltip" id="80"/>
							<Events>
								<Event name="OnChange">ВладелецПриИзменении</Event>
							</Events>
						</InputField>
						<InputField name="Куратор" id="13">
							<DataPath>Объект.Куратор</DataPath>
							<Wrap>false</Wrap>
							<ContextMenu name="КураторКонтекстноеМеню" id="14"/>
							<ExtendedTooltip name="КураторExtendedTooltip" id="81"/>
						</InputField>
						<InputField name="Стадия" id="9">
							<DataPath>Объект.Стадия</DataPath>
							<Wrap>false</Wrap>
							<ContextMenu name="СтадияКонтекстноеМеню" id="10"/>
							<ExtendedTooltip name="СтадияExtendedTooltip" id="82"/>
							<Events>
								<Event name="OnChange">СтадияПриИзменении</Event>
							</Events>
						</InputField>
					</ChildItems>
				</UsualGroup>
				<UsualGroup name="ГруппаОсновнаяПраво" id="42">
					<Title>
						<v8:item>
							<v8:lang>ru</v8:lang>
							<v8:content>Группа основная право</v8:content>
						</v8:item>
					</Title>
					<ToolTip>
						<v8:item>
							<v8:lang>ru</v8:lang>
							<v8:content>Группа основная право</v8:content>
						</v8:item>
					</ToolTip>
					<Representation>None</Representation>
					<ShowTitle>false</ShowTitle>
					<ExtendedTooltip name="ГруппаОсновнаяПравоExtendedTooltip" id="83"/>
					<ChildItems>
						<InputField name="Родитель" id="7">
							<DataPath>Объект.Parent</DataPath>
							<Wrap>false</Wrap>
							<ContextMenu name="РодительКонтекстноеМеню" id="8"/>
							<ExtendedTooltip name="РодительExtendedTooltip" id="84"/>
							<Events>
								<Event name="OnChange">РодительПриИзменении</Event>
							</Events>
						</InputField>
						<InputField name="Исполнитель" id="15">
							<DataPath>Объект.Исполнитель</DataPath>
							<Wrap>false</Wrap>
							<ContextMenu name="ИсполнительКонтекстноеМеню" id="16"/>
							<ExtendedTooltip name="ИсполнительExtendedTooltip" id="85"/>
						</InputField>
						<UsualGroup name="ГруппаПроцентВыполненияЗакрыта" id="43">
							<Title>
								<v8:item>
									<v8:lang>ru</v8:lang>
									<v8:content>Группа процент выполнения закрыта</v8:content>
								</v8:item>
							</Title>
							<ToolTip>
								<v8:item>
									<v8:lang>ru</v8:lang>
									<v8:content>Группа процент выполнения закрыта</v8:content>
								</v8:item>
							</ToolTip>
							<Group>Horizontal</Group>
							<Representation>None</Representation>
							<ShowTitle>false</ShowTitle>
							<ExtendedTooltip name="ГруппаПроцентВыполненияЗакрытаExtendedTooltip" id="86"/>
							<ChildItems>
								<InputField name="ПроцентВыполнения" id="25">
									<DataPath>Объект.ПроцентВыполнения</DataPath>
									<Wrap>false</Wrap>
									<MaxValue xsi:type="xs:decimal">100</MaxValue>
									<ContextMenu name="ПроцентВыполненияКонтекстноеМеню" id="26"/>
									<ExtendedTooltip name="ПроцентВыполненияExtendedTooltip" id="87"/>
								</InputField>
								<CheckBoxField name="Закрыта" id="29">
									<DataPath>Объект.Закрыта</DataPath>
									<Enabled>false</Enabled>
									<TitleLocation>Right</TitleLocation>
									<CheckBoxType>Auto</CheckBoxType>
									<ContextMenu name="ЗакрытаКонтекстноеМеню" id="30"/>
									<ExtendedTooltip name="ЗакрытаExtendedTooltip" id="88"/>
								</CheckBoxField>
							</ChildItems>
						</UsualGroup>
					</ChildItems>
				</UsualGroup>
			</ChildItems>
		</UsualGroup>
		<Pages name="ГруппаСтраницы" id="48">
			<Title>
				<v8:item>
					<v8:lang>ru</v8:lang>
					<v8:content>Группа страницы</v8:content>
				</v8:item>
			</Title>
			<ToolTip>
				<v8:item>
					<v8:lang>ru</v8:lang>
					<v8:content>Группа страницы</v8:content>
				</v8:item>
			</ToolTip>
			<ExtendedTooltip name="ГруппаСтраницыExtendedTooltip" id="89"/>
			<ChildItems>
				<Page name="ГруппаОписания" id="33">
					<Title>
						<v8:item>
							<v8:lang>ru</v8:lang>
							<v8:content>Описание</v8:content>
						</v8:item>
					</Title>
					<ToolTip>
						<v8:item>
							<v8:lang>ru</v8:lang>
							<v8:content>Группа описания</v8:content>
						</v8:item>
					</ToolTip>
					<ExtendedTooltip name="ГруппаОписанияExtendedTooltip" id="90"/>
					<ChildItems>
						<UsualGroup name="ГруппаОписание" id="44">
							<Title>
								<v8:item>
									<v8:lang>ru</v8:lang>
									<v8:content>Описание задачи</v8:content>
								</v8:item>
							</Title>
							<TitleFont ref="sys:DefaultGUIFont" bold="true" italic="false" underline="false" strikeout="false" kind="WindowsFont"/>
							<ToolTip>
								<v8:item>
									<v8:lang>ru</v8:lang>
									<v8:content>Группа описание</v8:content>
								</v8:item>
							</ToolTip>
							<ExtendedTooltip name="ГруппаОписаниеExtendedTooltip" id="91"/>
							<ChildItems>
								<InputField name="ОписаниеЗадачи" id="11">
									<DataPath>Объект.ОписаниеЗадачи</DataPath>
									<TitleLocation>None</TitleLocation>
									<Wrap>false</Wrap>
									<ContextMenu name="ОписаниеЗадачиКонтекстноеМеню" id="12"/>
									<ExtendedTooltip name="ОписаниеЗадачиExtendedTooltip" id="92"/>
								</InputField>
								<UsualGroup name="ГруппаНачало" id="37">
									<Title>
										<v8:item>
											<v8:lang>ru</v8:lang>
											<v8:content>Группа начало</v8:content>
										</v8:item>
									</Title>
									<ToolTip>
										<v8:item>
											<v8:lang>ru</v8:lang>
											<v8:content>Группа начало</v8:content>
										</v8:item>
									</ToolTip>
									<Group>Horizontal</Group>
									<Representation>None</Representation>
									<ShowTitle>false</ShowTitle>
									<ExtendedTooltip name="ГруппаНачалоExtendedTooltip" id="93"/>
									<ChildItems>
										<InputField name="ПлановаяДатаНачала" id="17">
											<DataPath>Объект.ПлановаяДатаНачала</DataPath>
											<Wrap>false</Wrap>
											<ContextMenu name="ПлановаяДатаНачалаКонтекстноеМеню" id="18"/>
											<ExtendedTooltip name="ПлановаяДатаНачалаExtendedTooltip" id="94"/>
										</InputField>
										<InputField name="ПлановаяПродолжительность" id="21">
											<DataPath>Объект.ПлановаяПродолжительность</DataPath>
											<Wrap>false</Wrap>
											<ContextMenu name="ПлановаяПродолжительностьКонтекстноеМеню" id="22"/>
											<ExtendedTooltip name="ПлановаяПродолжительностьExtendedTooltip" id="95"/>
										</InputField>
										<LabelDecoration name="ДекорацияДней" id="46">
											<Title formatted="false">
												<v8:item>
													<v8:lang>ru</v8:lang>
													<v8:content>дней.</v8:content>
												</v8:item>
											</Title>
											<ContextMenu name="ДекорацияДнейКонтекстноеМеню" id="47"/>
											<ExtendedTooltip name="ДекорацияДнейExtendedTooltip" id="96"/>
										</LabelDecoration>
									</ChildItems>
								</UsualGroup>
							</ChildItems>
						</UsualGroup>
						<UsualGroup name="ГруппаРезультат" id="45">
							<Title>
								<v8:item>
									<v8:lang>ru</v8:lang>
									<v8:content>Результат выполнения задачи</v8:content>
								</v8:item>
							</Title>
							<TitleFont ref="sys:DefaultGUIFont" bold="true" italic="false" underline="false" strikeout="false" kind="WindowsFont"/>
							<ToolTip>
								<v8:item>
									<v8:lang>ru</v8:lang>
									<v8:content>Группа результат</v8:content>
								</v8:item>
							</ToolTip>
							<ExtendedTooltip name="ГруппаРезультатExtendedTooltip" id="97"/>
							<ChildItems>
								<InputField name="ОписаниеРезультата" id="27">
									<DataPath>Объект.ОписаниеРезультата</DataPath>
									<TitleLocation>None</TitleLocation>
									<Wrap>false</Wrap>
									<ContextMenu name="ОписаниеРезультатаКонтекстноеМеню" id="28"/>
									<ExtendedTooltip name="ОписаниеРезультатаExtendedTooltip" id="98"/>
								</InputField>
								<UsualGroup name="ГруппаОкончание" id="38">
									<Title>
										<v8:item>
											<v8:lang>ru</v8:lang>
											<v8:content>Группа окончание</v8:content>
										</v8:item>
									</Title>
									<ToolTip>
										<v8:item>
											<v8:lang>ru</v8:lang>
											<v8:content>Группа окончание</v8:content>
										</v8:item>
									</ToolTip>
									<Group>Horizontal</Group>
									<Representation>None</Representation>
									<ShowTitle>false</ShowTitle>
									<ExtendedTooltip name="ГруппаОкончаниеExtendedTooltip" id="99"/>
									<ChildItems>
										<InputField name="ДатаНачала" id="19">
											<DataPath>Объект.ДатаНачала</DataPath>
											<Title>
												<v8:item>
													<v8:lang>ru</v8:lang>
													<v8:content>Фактическая дата начала</v8:content>
												</v8:item>
											</Title>
											<Wrap>false</Wrap>
											<ContextMenu name="ДатаНачалаКонтекстноеМеню" id="20"/>
											<ExtendedTooltip name="ДатаНачалаExtendedTooltip" id="100"/>
										</InputField>
										<InputField name="ДатаОкончания" id="23">
											<DataPath>Объект.ДатаОкончания</DataPath>
											<Wrap>false</Wrap>
											<ContextMenu name="ДатаОкончанияКонтекстноеМеню" id="24"/>
											<ExtendedTooltip name="ДатаОкончанияExtendedTooltip" id="101"/>
										</InputField>
									</ChildItems>
								</UsualGroup>
							</ChildItems>
						</UsualGroup>
					</ChildItems>
				</Page>
				<Page name="ГруппаИсполнители" id="49">
					<Title>
						<v8:item>
							<v8:lang>ru</v8:lang>
							<v8:content>Исполнители</v8:content>
						</v8:item>
					</Title>
					<ToolTip>
						<v8:item>
							<v8:lang>ru</v8:lang>
							<v8:content>Группа исполнители</v8:content>
						</v8:item>
					</ToolTip>
					<ExtendedTooltip name="ГруппаИсполнителиExtendedTooltip" id="102"/>
					<ChildItems>

							<AutoInsertNewRow>true</AutoInsertNewRow>
							<EnableStartDrag>true</EnableStartDrag>
							<EnableDrag>true</EnableDrag>
							<DataPath>Объект.Исполнители</DataPath>
							<SearchStringLocation>None</SearchStringLocation>
							<ViewStatusLocation>None</ViewStatusLocation>
							<SearchControlLocation>None</SearchControlLocation>
							<RowFilter xsi:nil="true"/>
							<ContextMenu name="ИсполнителиКонтекстноеМеню" id="51"/>
							<AutoCommandBar name="ИсполнителиКоманднаяПанель" id="52"/>
							<ExtendedTooltip name="ИсполнителиExtendedTooltip" id="103"/>
							<SearchStringAddition name="ИсполнителиSearchString" id="104">
								<Source>
									<lf:elementId>50</lf:elementId>
									<lf:additionId>0</lf:additionId>
								</Source>
								<ContextMenu name="ИсполнителиSearchStringContextMenu" id="105"/>
								<ExtendedTooltip name="ИсполнителиSearchStringExtendedTooltip" id="106"/>
							</SearchStringAddition>
							<ViewStatusAddition name="ИсполнителиViewStatus" id="107">
								<Source>
									<lf:elementId>50</lf:elementId>
									<lf:additionId>1</lf:additionId>
								</Source>
								<ContextMenu name="ИсполнителиViewStatusContextMenu" id="108"/>
								<ExtendedTooltip name="ИсполнителиViewStatusExtendedTooltip" id="109"/>
							</ViewStatusAddition>
							<SearchControlAddition name="ИсполнителиSearchControl" id="110">
								<Source>
									<lf:elementId>50</lf:elementId>
									<lf:additionId>2</lf:additionId>
								</Source>
								<ContextMenu name="ИсполнителиSearchControlContextMenu" id="111"/>
								<ExtendedTooltip name="ИсполнителиSearchControlExtendedTooltip" id="112"/>
							</SearchControlAddition>
							<ChildItems>
								<LabelField name="ИсполнителиНомерСтроки" id="53">
									<DataPath>Объект.Исполнители.LineNumber</DataPath>
									<EditMode>EnterOnInput</EditMode>
									<ContextMenu name="ИсполнителиНомерСтрокиКонтекстноеМеню" id="54"/>
									<ExtendedTooltip name="ИсполнителиНомерСтрокиExtendedTooltip" id="113"/>
								</LabelField>
								<InputField name="ИсполнителиИсполнитель" id="55">
									<DataPath>Объект.Исполнители.Исполнитель</DataPath>
									<EditMode>EnterOnInput</EditMode>
									<ContextMenu name="ИсполнителиИсполнительКонтекстноеМеню" id="56"/>
									<ExtendedTooltip name="ИсполнителиИсполнительExtendedTooltip" id="114"/>
								</InputField>
							</ChildItems>

					</ChildItems>
				</Page>
				<Page name="ГруппаПредшесвенники" id="57">
					<Title>
						<v8:item>
							<v8:lang>ru</v8:lang>
							<v8:content>Предшесвенники</v8:content>
						</v8:item>
					</Title>
					<ToolTip>
						<v8:item>
							<v8:lang>ru</v8:lang>
							<v8:content>Группа предшесвенники</v8:content>
						</v8:item>
					</ToolTip>
					<ExtendedTooltip name="ГруппаПредшесвенникиExtendedTooltip" id="115"/>
					<ChildItems>

							<AutoInsertNewRow>true</AutoInsertNewRow>
							<EnableStartDrag>true</EnableStartDrag>
							<EnableDrag>true</EnableDrag>
							<DataPath>Объект.Предшественники</DataPath>
							<SearchStringLocation>None</SearchStringLocation>
							<ViewStatusLocation>None</ViewStatusLocation>
							<SearchControlLocation>None</SearchControlLocation>
							<RowFilter xsi:nil="true"/>
							<ContextMenu name="ПредшественникиКонтекстноеМеню" id="59"/>
							<AutoCommandBar name="ПредшественникиКоманднаяПанель" id="60"/>
							<ExtendedTooltip name="ПредшественникиExtendedTooltip" id="116"/>
							<SearchStringAddition name="ПредшественникиSearchString" id="117">
								<Source>
									<lf:elementId>58</lf:elementId>
									<lf:additionId>0</lf:additionId>
								</Source>
								<ContextMenu name="ПредшественникиSearchStringContextMenu" id="118"/>
								<ExtendedTooltip name="ПредшественникиSearchStringExtendedTooltip" id="119"/>
							</SearchStringAddition>
							<ViewStatusAddition name="ПредшественникиViewStatus" id="120">
								<Source>
									<lf:elementId>58</lf:elementId>
									<lf:additionId>1</lf:additionId>
								</Source>
								<ContextMenu name="ПредшественникиViewStatusContextMenu" id="121"/>
								<ExtendedTooltip name="ПредшественникиViewStatusExtendedTooltip" id="122"/>
							</ViewStatusAddition>
							<SearchControlAddition name="ПредшественникиSearchControl" id="123">
								<Source>
									<lf:elementId>58</lf:elementId>
									<lf:additionId>2</lf:additionId>
								</Source>
								<ContextMenu name="ПредшественникиSearchControlContextMenu" id="124"/>
								<ExtendedTooltip name="ПредшественникиSearchControlExtendedTooltip" id="125"/>
							</SearchControlAddition>
							<Events>
								<Event name="OnStartEdit">ПредшественникиПриНачалеРедактирования</Event>
							</Events>
							<ChildItems>
								<LabelField name="ПредшественникиНомерСтроки" id="61">
									<DataPath>Объект.Предшественники.LineNumber</DataPath>
									<EditMode>EnterOnInput</EditMode>
									<ContextMenu name="ПредшественникиНомерСтрокиКонтекстноеМеню" id="62"/>
									<ExtendedTooltip name="ПредшественникиНомерСтрокиExtendedTooltip" id="126"/>
								</LabelField>
								<InputField name="ПредшественникиПредшественник" id="63">
									<DataPath>Объект.Предшественники.Предшественник</DataPath>
									<EditMode>EnterOnInput</EditMode>
									<ChoiceParameterLinks>
										<xr:Link>
											<xr:Name>Отбор.Владелец</xr:Name>
											<xr:DataPath xsi:type="xs:string">Объект.Owner</xr:DataPath>
											<xr:ValueChange>Clear</xr:ValueChange>
										</xr:Link>
									</ChoiceParameterLinks>
									<ContextMenu name="ПредшественникиПредшественникКонтекстноеМеню" id="64"/>
									<ExtendedTooltip name="ПредшественникиПредшественникExtendedTooltip" id="127"/>
									<Events>
										<Event name="AutoComplete">ПредшественникиПредшественникАвтоПодбор</Event>
										<Event name="TextEditEnd">ПредшественникиПредшественникОкончаниеВводаТекста</Event>
									</Events>
								</InputField>
								<LabelField name="ПредшественникиПредшественникакКодСДР" id="71">
									<DataPath>Объект.Предшественники.Предшественник.акКодСДР</DataPath>
									<EditMode>EnterOnInput</EditMode>
									<Width>10</Width>
									<ContextMenu name="ПредшественникиПредшественникакКодСДРКонтекстноеМеню" id="72"/>
									<ExtendedTooltip name="ПредшественникиПредшественникакКодСДРExtendedTooltip" id="128"/>
								</LabelField>
								<InputField name="ПредшественникиТипЗависимости" id="65">
									<DataPath>Объект.Предшественники.ТипЗависимости</DataPath>
									<EditMode>EnterOnInput</EditMode>
									<ContextMenu name="ПредшественникиТипЗависимостиКонтекстноеМеню" id="66"/>
									<ExtendedTooltip name="ПредшественникиТипЗависимостиExtendedTooltip" id="129"/>
								</InputField>
								<InputField name="ПредшественникиЗадержка" id="67">
									<DataPath>Объект.Предшественники.Задержка</DataPath>
									<EditMode>EnterOnInput</EditMode>
									<ContextMenu name="ПредшественникиЗадержкаКонтекстноеМеню" id="68"/>
									<ExtendedTooltip name="ПредшественникиЗадержкаExtendedTooltip" id="130"/>
								</InputField>
							</ChildItems>

					</ChildItems>
				</Page>
			</ChildItems>
		</Pages>
		<UsualGroup name="ГруппаКонтроль" id="35">
			<Title>
				<v8:item>
					<v8:lang>ru</v8:lang>
					<v8:content>Группа контроль</v8:content>
				</v8:item>
			</Title>
			<ToolTip>
				<v8:item>
					<v8:lang>ru</v8:lang>
					<v8:content>Группа контроль</v8:content>
				</v8:item>
			</ToolTip>
			<Group>Horizontal</Group>
			<Representation>None</Representation>
			<ShowTitle>false</ShowTitle>
			<ExtendedTooltip name="ГруппаКонтрольExtendedTooltip" id="131"/>
		</UsualGroup>
		<UsualGroup name="ГруппаСтадияВыполнение" id="34">
			<Title>
				<v8:item>
					<v8:lang>ru</v8:lang>
					<v8:content>Группа стадия выполнение</v8:content>
				</v8:item>
			</Title>
			<ToolTip>
				<v8:item>
					<v8:lang>ru</v8:lang>
					<v8:content>Группа стадия выполнение</v8:content>
				</v8:item>
			</ToolTip>
			<Group>Horizontal</Group>
			<Representation>None</Representation>
			<ShowTitle>false</ShowTitle>
			<ExtendedTooltip name="ГруппаСтадияВыполнениеExtendedTooltip" id="132"/>
		</UsualGroup>
		<UsualGroup name="ГруппаСроки" id="36">
			<Title>
				<v8:item>
					<v8:lang>ru</v8:lang>
					<v8:content>Группа сроки</v8:content>
				</v8:item>
			</Title>
			<ToolTip>
				<v8:item>
					<v8:lang>ru</v8:lang>
					<v8:content>Группа сроки</v8:content>
				</v8:item>
			</ToolTip>
			<Group>Horizontal</Group>
			<Representation>None</Representation>
			<ShowTitle>false</ShowTitle>
			<ExtendedTooltip name="ГруппаСрокиExtendedTooltip" id="133"/>
		</UsualGroup>
	</ChildItems>
	<Attributes>
		<Attribute name="Объект" id="1">
			<Type>
				<v8:Type>cfg:CatalogObject.ЗадачиПроектов</v8:Type>
			</Type>
			<MainAttribute>true</MainAttribute>
			<SavedData>true</SavedData>
		</Attribute>
		<Attribute name="НеобходимоПересчитатьКодСДР" id="2">
			<Title>
				<v8:item>
					<v8:lang>ru</v8:lang>
					<v8:content>Необходимо пересчитать код СДР</v8:content>
				</v8:item>
			</Title>
			<Type>
				<v8:Type>xs:boolean</v8:Type>
			</Type>
		</Attribute>
		<Attribute name="ВладелецСтарый" id="3">
			<Title>
				<v8:item>
					<v8:lang>ru</v8:lang>
					<v8:content>Владелец старый</v8:content>
				</v8:item>
			</Title>
			<Type>
				<v8:TypeSet>cfg:CatalogRef</v8:TypeSet>
			</Type>
		</Attribute>
		<Attribute name="РодительСтарый" id="4">
			<Title>
				<v8:item>
					<v8:lang>ru</v8:lang>
					<v8:content>Родитель старый</v8:content>
				</v8:item>
			</Title>
			<Type>
				<v8:Type>cfg:CatalogRef.ЗадачиПроектов</v8:Type>
			</Type>
		</Attribute>
		<ConditionalAppearance>
			<dcsset:item>
				<dcsset:selection>
					<dcsset:item>
						<dcsset:field>ДатаОкончания</dcsset:field>
					</dcsset:item>
				</dcsset:selection>
				<dcsset:filter>
					<dcsset:item xsi:type="dcsset:FilterItemComparison">
						<dcsset:left xsi:type="dcscor:Field">Объект.Закрыта</dcsset:left>
						<dcsset:comparisonType>Equal</dcsset:comparisonType>
						<dcsset:right xsi:type="xs:boolean">true</dcsset:right>
					</dcsset:item>
					<dcsset:item xsi:type="dcsset:FilterItemComparison">
						<dcsset:left xsi:type="dcscor:Field">Объект.ДатаОкончания</dcsset:left>
						<dcsset:comparisonType>Equal</dcsset:comparisonType>
						<dcsset:right xsi:type="v8:StandardBeginningDate">
							<v8:variant xsi:type="v8:StandardBeginningDateVariant">Custom</v8:variant>
							<v8:date>0001-01-01T00:00:00</v8:date>
						</dcsset:right>
					</dcsset:item>
				</dcsset:filter>
				<dcsset:appearance>
					<dcscor:item xsi:type="dcsset:SettingsParameterValue">
						<dcscor:parameter>MarkIncomplete</dcscor:parameter>
						<dcscor:value xsi:type="xs:boolean">true</dcscor:value>
					</dcscor:item>
				</dcsset:appearance>
			</dcsset:item>
			<dcsset:item>
				<dcsset:selection>
					<dcsset:item>
						<dcsset:field>ДатаНачала</dcsset:field>
					</dcsset:item>
				</dcsset:selection>
				<dcsset:filter>
					<dcsset:item xsi:type="dcsset:FilterItemComparison">
						<dcsset:left xsi:type="dcscor:Field">Объект.Закрыта</dcsset:left>
						<dcsset:comparisonType>Equal</dcsset:comparisonType>
						<dcsset:right xsi:type="xs:boolean">true</dcsset:right>
					</dcsset:item>
					<dcsset:item xsi:type="dcsset:FilterItemComparison">
						<dcsset:left xsi:type="dcscor:Field">Объект.ДатаНачала</dcsset:left>
						<dcsset:comparisonType>Equal</dcsset:comparisonType>
						<dcsset:right xsi:type="v8:StandardBeginningDate">
							<v8:variant xsi:type="v8:StandardBeginningDateVariant">Custom</v8:variant>
							<v8:date>0001-01-01T00:00:00</v8:date>
						</dcsset:right>
					</dcsset:item>
				</dcsset:filter>
				<dcsset:appearance>
					<dcscor:item xsi:type="dcsset:SettingsParameterValue">
						<dcscor:parameter>MarkIncomplete</dcscor:parameter>
						<dcscor:value xsi:type="xs:boolean">true</dcscor:value>
					</dcscor:item>
				</dcsset:appearance>
			</dcsset:item>
			<dcsset:item>
				<dcsset:selection>
					<dcsset:item>
						<dcsset:field>ОписаниеРезультата</dcsset:field>
					</dcsset:item>
				</dcsset:selection>
				<dcsset:filter>
					<dcsset:item xsi:type="dcsset:FilterItemComparison">
						<dcsset:left xsi:type="dcscor:Field">Объект.Закрыта</dcsset:left>
						<dcsset:comparisonType>Equal</dcsset:comparisonType>
						<dcsset:right xsi:type="xs:boolean">true</dcsset:right>
					</dcsset:item>
					<dcsset:item xsi:type="dcsset:FilterItemComparison">
						<dcsset:left xsi:type="dcscor:Field">Объект.ОписаниеРезультата</dcsset:left>
						<dcsset:comparisonType>Equal</dcsset:comparisonType>
						<dcsset:right xsi:type="xs:string"/>
					</dcsset:item>
				</dcsset:filter>
				<dcsset:appearance>
					<dcscor:item xsi:type="dcsset:SettingsParameterValue">
						<dcscor:parameter>MarkIncomplete</dcscor:parameter>
						<dcscor:value xsi:type="xs:boolean">true</dcscor:value>
					</dcscor:item>
				</dcsset:appearance>
			</dcsset:item>
		</ConditionalAppearance>
	</Attributes>
</Form>


text:
var express = require('express');
var router  = express.Router();
var config  = require('../config');
var F       = require('../controllers/Functions');
var Refund  = require('../controllers/RefundsController');
var TPL     = "requerimiento-equipo";
var route   = __dirname;
var obj     = {
  title: config['localhost'].title,
  url: config['localhost'].url
};
route = route.replace("routes", "");

//routers

router.get('/', F.isAuthenticated, function(req, res) {
  var Language = require('../language/'+req.user.language);
  var response = "",
  state    = "";

 if ( F.verifyAccessRoles( TPL, req ) ) {
  response = F.infoPage(obj,TPL,Language,req);
      delete req.session.message;
   response.title = "Peticion de Equipo";
   var query  = { reportado_por : req.user.username };
   var fields = { ticket : 1,reportado_por:1, fecha_reportado : 1, titulo :1 ,tipo : 1, sede:1,estado : 1, detalle:1};
   var options= {};
  Refund.find(query,fields, options, function (data) {
    response.data   = data.data;
   F.getNotify(req.user.username, function (data) {
      response.notify = data;
res.render(TPL, response );
     });
   } );
  }
  else{
   res.redirect('/');
 }
});

router.post('/guardar',  F.isAuthenticated, function ( req , res ){
  if ( F.verifyAccessRoles( TPL, req ) ) {
    var data = req.body || req.params || req.query;
   Refund.getLastCorrelative({},function (response) {
     console.log(response);
     var peticion = {};
    peticion.ticket   = response.data + 1 ;
      peticion.titulo   = data.titulo;
     peticion.tipo      = data.tipo;
     peticion.sede     = data.cede;
     peticion.detalle     = data.detalle;
     peticion.reportado_por = req.user.username;
     peticion.fecha_reportado  = F.getDateTimezoneDefault();
     Refund.save(peticion,function (respond) {
       respond.ticket = peticion.ticket;
       return res.json(respond);
    });
   });
 }else{
   return res.json(F.notPermission);
  }
});
module.exports = router;


text:
package org.apache.cassandra.utils.btree;

import java.util.*;
import java.util.concurrent.ThreadLocalRandom;

import com.google.common.collect.Iterables;
import org.junit.Test;

import org.junit.Assert;

import static org.junit.Assert.*;

public class BTreeTest
{
    static Integer[] ints = new Integer[20];
    static
    {
        System.setProperty("cassandra.btree.branchshift", "2");
        for (int i = 0 ; i < ints.length ; i++)
            ints[i] = new Integer(i);
    }

    static final UpdateFunction<Integer, Integer> updateF = new UpdateFunction<Integer, Integer>()
    {
        public Integer merge(Integer replacing, Integer update)
        {
            return ints[update];
        }

        public void onAllocatedOnHeap(long heapSize)
        {
        }

        public Integer insert(Integer integer)
        {
            return ints[integer];
        }

        public Integer retain(Integer integer)
        {
            return ints[integer];
        }
    };

    private static List<Integer> seq(int count, int interval)
    {
        List<Integer> r = new ArrayList<>();
        for (int i = 0 ; i < count ; i++)
            if (i % interval == 0)
                r.add(i);
        return r;
    }

    private static List<Integer> seq(int count)
    {
        return seq(count, 1);
    }

    private static final Comparator<Integer> CMP = Integer::compare;

    @Test
    public void testBuilding_UpdateFunctionReplacement()
    {
        for (int i = 0; i < 20 ; i++)
            checkResult(i, BTree.build(seq(i), updateF));
    }

    @Test
    public void testUpdate_UpdateFunctionReplacement()
    {
        for (int i = 0; i < 20 ; i++)
            checkResult(i, BTree.update(BTree.build(seq(i)), BTree.build(seq(i)), CMP, updateF));
    }

    @Test
    public void testApply()
    {
        List<Integer> input = seq(71);
        Object[] btree = BTree.build(input);

        final List<Integer> result = new ArrayList<>();
        BTree.<Integer>apply(btree, i -> result.add(i));

        org.junit.Assert.assertArrayEquals(input.toArray(),result.toArray());
    }

    @Test
    public void inOrderAccumulation()
    {
        List<Integer> input = seq(71);
        Object[] btree = BTree.build(input);
        long result = BTree.<Integer>accumulate(btree, (o, l) -> {
            Assert.assertEquals((long) o, l + 1);
            return o;
        }, -1);
        Assert.assertEquals(result, 70);
    }

    @Test
    public void accumulateFrom()
    {
        int limit = 100;
        for (int interval=1; interval<=5; interval++)
        {
            List<Integer> input = seq(limit, interval);
            Object[] btree = BTree.build(input);
            for (int start=0; start<=limit; start+=interval)
            {
                int thisInterval = interval;
                String errMsg = String.format("interval=%s, start=%s", interval, start);
                long result = BTree.accumulate(btree, (o, l) -> {
                    Assert.assertEquals(errMsg, (long) o, l + thisInterval);
                    return o;
                }, Comparator.naturalOrder(), start, start - thisInterval);
                Assert.assertEquals(errMsg, result, (limit-1)/interval*interval);
            }
        }
    }

    /**
     * accumulate function should not be called if we ask it to start past the end of the btree
     */
    @Test
    public void accumulateFromEnd()
    {
        List<Integer> input = seq(100);
        Object[] btree = BTree.build(input);
        long result = BTree.accumulate(btree, (o, l) -> 1, Integer::compareTo, 101, 0L);
        Assert.assertEquals(0, result);
    }

    /**
     * Tests that the apply method of the UpdateFunction is only called once with each key update.
     * (see CASSANDRA-8018).
     */
    @Test
    public void testUpdate_UpdateFunctionCallBack()
    {
        Object[] btree = BTree.singleton(1);
        CallsMonitor monitor = new CallsMonitor();

        btree = BTree.update(btree, BTree.singleton(1), CMP, monitor);
        assertArrayEquals(new Object[] {1}, btree);
        assertEquals(1, monitor.getNumberOfCalls(1));

        monitor.clear();
        btree = BTree.update(btree, BTree.singleton(2), CMP, monitor);
        assertArrayEquals(new Object[] {1, 2, null}, btree);
        assertEquals(1, monitor.getNumberOfCalls(2));

        // with existing value
        monitor.clear();
        btree = BTree.update(btree, BTree.singleton(1), CMP, monitor);
        assertArrayEquals(new Object[] {1, 2, null}, btree);
        assertEquals(1, monitor.getNumberOfCalls(1));

        // with two non-existing values
        monitor.clear();
        btree = BTree.update(btree, BTree.build(Arrays.asList(3, 4)), CMP, monitor);
        assertArrayEquals(new Object[] {3, new Object[]{1, 2, null}, new Object[]{4}, new int[]{2, 4}}, btree);
        assertEquals(1, monitor.getNumberOfCalls(3));
        assertEquals(1, monitor.getNumberOfCalls(4));

        // with one existing value and one non existing value
        monitor.clear();
        btree = BTree.update(btree, BTree.build(Arrays.asList(2, 5)), CMP, monitor);
        assertArrayEquals(new Object[] {3, new Object[]{1, 2, null}, new Object[]{4, 5, null}, new int[]{2, 5}}, btree);
        assertEquals(1, monitor.getNumberOfCalls(2));
        assertEquals(1, monitor.getNumberOfCalls(5));
    }

    /**
     * Tests that the apply method of the UpdateFunction is only called once per value with each build call.
     */
    @Test
    public void testBuilding_UpdateFunctionCallBack()
    {
        CallsMonitor monitor = new CallsMonitor();
        Object[] btree = BTree.build(Arrays.asList(1), monitor);
        assertArrayEquals(new Object[] {1}, btree);
        assertEquals(1, monitor.getNumberOfCalls(1));

        monitor.clear();
        btree = BTree.build(Arrays.asList(1, 2), monitor);
        assertArrayEquals(new Object[] {1, 2, null}, btree);
        assertEquals(1, monitor.getNumberOfCalls(1));
        assertEquals(1, monitor.getNumberOfCalls(2));

        monitor.clear();
        btree = BTree.build(Arrays.asList(1, 2, 3), monitor);
        assertArrayEquals(new Object[] {1, 2, 3}, btree);
        assertEquals(1, monitor.getNumberOfCalls(1));
        assertEquals(1, monitor.getNumberOfCalls(2));
        assertEquals(1, monitor.getNumberOfCalls(3));
    }

    /**
     * Tests that the apply method of the QuickResolver is called exactly once per duplicate value
     */
    @Test
    public void testBuilder_QuickResolver()
    {
        // for numbers x in 1..N, we repeat x x times, and resolve values to their sum,
        // so that the resulting tree is of square numbers
        BTree.Builder.QuickResolver<Accumulator> resolver = (a, b) -> new Accumulator(a.base, a.sum + b.sum);

        for (int count = 0 ; count < 10 ; count ++)
        {
            BTree.Builder<Accumulator> builder;
            // first check we produce the right output for sorted input
            List<Accumulator> sorted = resolverInput(count, false);
            builder = BTree.builder(Comparator.naturalOrder());
            builder.setQuickResolver(resolver);
            for (Accumulator i : sorted)
                builder.add(i);
            // for sorted input, check non-resolve path works before checking resolution path
            checkResolverOutput(count, builder.build(), BTree.Dir.ASC);
            builder = BTree.builder(Comparator.naturalOrder());
            builder.setQuickResolver(resolver);
            for (int i = 0 ; i < 10 ; i++)
            {
                // now do a few runs of randomized inputs
                for (Accumulator j : resolverInput(count, true))
                    builder.add(j);
                checkResolverOutput(count, builder.build(), BTree.Dir.ASC);
                builder = BTree.builder(Comparator.naturalOrder());
                builder.setQuickResolver(resolver);
            }
            for (List<Accumulator> add : splitResolverInput(count))
            {
                if (ThreadLocalRandom.current().nextBoolean())
                    builder.addAll(add);
                else
                    builder.addAll(new TreeSet<>(add));
            }
            checkResolverOutput(count, builder.build(), BTree.Dir.ASC);
        }
    }

    @Test
    public void testBuilderReuse()
    {
        List<Integer> sorted = seq(20);
        BTree.Builder<Integer> builder = BTree.builder(Comparator.naturalOrder());
        builder.auto(false);
        for (int i : sorted)
            builder.add(i);
        checkResult(20, builder.build());

        builder.reuse();
        assertTrue(builder.build() == BTree.empty());
        for (int i = 0; i < 12; i++)
            builder.add(sorted.get(i));
        checkResult(12, builder.build());

        builder.auto(true);
        builder.reuse(Comparator.reverseOrder());
        for (int i = 0; i < 12; i++)
            builder.add(sorted.get(i));
        System.out.println(BTree.MAX_KEYS);
        System.out.println(BTree.MIN_KEYS);
        System.out.println(BTree.toString(builder.build()));
        checkResult(12, builder.build(), BTree.Dir.DESC);

        builder.reuse();
        assertTrue(builder.build() == BTree.empty());
    }

    private static class Accumulator extends Number implements Comparable<Accumulator>
    {
        final int base;
        final int sum;
        private Accumulator(int base, int sum)
        {
            this.base = base;
            this.sum = sum;
        }

        public int compareTo(Accumulator that) { return Integer.compare(base, that.base); }
        public int intValue() { return sum; }
        public long longValue() { return sum; }
        public float floatValue() { return sum; }
        public double doubleValue() { return sum; }
    }

    /**
     * Tests that the apply method of the Resolver is called exactly once per unique value
     */
    @Test
    public void testBuilder_ResolverAndReverse()
    {
        // for numbers x in 1..N, we repeat x x times, and resolve values to their sum,
        // so that the resulting tree is of square numbers
        BTree.Builder.Resolver resolver = (array, lb, ub) -> {
            int sum = 0;
            for (int i = lb ; i < ub ; i++)
                sum += ((Accumulator) array[i]).sum;
            return new Accumulator(((Accumulator) array[lb]).base, sum);
        };

        for (int count = 0 ; count < 10 ; count ++)
        {
            BTree.Builder<Accumulator> builder;
            // first check we produce the right output for sorted input
            List<Accumulator> sorted = resolverInput(count, false);
            builder = BTree.builder(Comparator.naturalOrder());
            builder.auto(false);
            for (Accumulator i : sorted)
                builder.add(i);
            // for sorted input, check non-resolve path works before checking resolution path
            Assert.assertTrue(Iterables.elementsEqual(sorted, BTree.iterable(builder.build())));

            builder = BTree.builder(Comparator.naturalOrder());
            builder.auto(false);
            for (Accumulator i : sorted)
                builder.add(i);
            // check resolution path
            checkResolverOutput(count, builder.resolve(resolver).build(), BTree.Dir.ASC);

            builder = BTree.builder(Comparator.naturalOrder());
            builder.auto(false);
            for (int i = 0 ; i < 10 ; i++)
            {
                // now do a few runs of randomized inputs
                for (Accumulator j : resolverInput(count, true))
                    builder.add(j);
                checkResolverOutput(count, builder.sort().resolve(resolver).build(), BTree.Dir.ASC);
                builder = BTree.builder(Comparator.naturalOrder());
                builder.auto(false);
                for (Accumulator j : resolverInput(count, true))
                    builder.add(j);
                checkResolverOutput(count, builder.sort().reverse().resolve(resolver).build(), BTree.Dir.DESC);
                builder = BTree.builder(Comparator.naturalOrder());
                builder.auto(false);
            }
        }
    }

    private static List<Accumulator> resolverInput(int count, boolean shuffled)
    {
        List<Accumulator> result = new ArrayList<>();
        for (int i = 1 ; i <= count ; i++)
            for (int j = 0 ; j < i ; j++)
                result.add(new Accumulator(i, i));
        if (shuffled)
        {
            ThreadLocalRandom random = ThreadLocalRandom.current();
            for (int i = 0 ; i < result.size() ; i++)
            {
                int swapWith = random.nextInt(i, result.size());
                Accumulator t = result.get(swapWith);
                result.set(swapWith, result.get(i));
                result.set(i, t);
            }
        }
        return result;
    }

    private static List<List<Accumulator>> splitResolverInput(int count)
    {
        List<Accumulator> all = resolverInput(count, false);
        List<List<Accumulator>> result = new ArrayList<>();
        while (!all.isEmpty())
        {
            List<Accumulator> is = new ArrayList<>();
            int prev = -1;
            for (Accumulator i : new ArrayList<>(all))
            {
                if (i.base == prev)
                    continue;
                is.add(i);
                all.remove(i);
                prev = i.base;
            }
            result.add(is);
        }
        return result;
    }

    private static void checkResolverOutput(int count, Object[] btree, BTree.Dir dir)
    {
        int i = 1;
        for (Accumulator current : BTree.<Accumulator>iterable(btree, dir))
        {
            Assert.assertEquals(i * i, current.sum);
            i++;
        }
        Assert.assertEquals(i, count + 1);
    }

    private static void checkResult(int count, Object[] btree)
    {
        checkResult(count, btree, BTree.Dir.ASC);
    }

    private static void checkResult(int count, Object[] btree, BTree.Dir dir)
    {
        assertTrue(BTree.isWellFormed(btree, BTree.Dir.DESC == dir ? CMP.reversed() : CMP));
        Iterator<Integer> iter = BTree.slice(btree, CMP, dir);
        int i = 0;
        while (iter.hasNext())
            assertEquals(iter.next(), ints[i++]);
        assertEquals(count, i);
    }

    /**
     * UpdateFunction that count the number of call made to apply for each value.
     */
    public static final class CallsMonitor implements UpdateFunction<Integer, Integer>
    {
        private int[] numberOfCalls = new int[20];

        @Override
        public Integer merge(Integer replacing, Integer update)
        {
            numberOfCalls[update] = numberOfCalls[update] + 1;
            return update;
        }

        @Override
        public void onAllocatedOnHeap(long heapSize)
        {

        }

        @Override
        public Integer insert(Integer integer)
        {
            numberOfCalls[integer] = numberOfCalls[integer] + 1;
            return integer;
        }

        public int getNumberOfCalls(Integer key)
        {
            return numberOfCalls[key];
        }

        public void clear()
        {
            Arrays.fill(numberOfCalls, 0);
        }
    }
}


text:
const express = require('express');
const next = require('next');

const dev = process.env.NODE_ENV !== 'production';
const app = next({ dev });
const handle = app.getRequestHandler();

const i18nextMiddleware = require('i18next-express-middleware');
const Backend = require('i18next-node-fs-backend');
const i18n = require('./i18n');

const port = process.env.PORT || 3000;
// init i18next with serverside settings
// using i18next-express-middleware
i18n
    .use(Backend)
    .use(i18nextMiddleware.LanguageDetector)
    .init(
        {
            preload: ['en'], // preload all langages
            ns: ['common', 'home'], // need to preload all the namespaces
            backend: {
                loadPath: __dirname + '/locales/{{lng}}/{{ns}}.json',
                addPath: __dirname + '/locales/{{lng}}/{{ns}}.missing.json'
            }
        },
        () => {
            // loaded translations we can bootstrap our routes
            app.prepare()
                .then(() => {
                    const server = express();

                    // enable middleware for i18next
                    server.use(i18nextMiddleware.handle(i18n));

                    // serve locales for client
                    server.use('/locales', express.static(__dirname + '/locales'));

                    // missing keys
                    server.post('/locales/add/:lng/:ns', i18nextMiddleware.missingKeyHandler(i18n));

                    // use next.js
                    server.get('/blog/p/:id/*', (req, res) => {
                        const actualPage = '/post';
                        const queryParams = { id: req.params.id};
                        app.render(req, res, actualPage, queryParams);
                    });
                    server.get('*', (req, res) => handle(req, res));

                    server.listen(port, (err) => {
                        if (err) throw err;
                        //eslint-disable-next-line no-console
                        console.log(`> Ready on http://localhost:${port}`);
                    });
                });

        }
    );


text:
namespace boost { namespace mpl {

template< typename Dummy = na > struct vector0;

template<> struct vector0<na>
{
#if defined(BOOST_MPL_CFG_TYPEOF_BASED_SEQUENCES)
    typedef aux::vector_tag tag;
    typedef vector0         type;
    typedef long_<32768>    lower_bound_;
    typedef lower_bound_    upper_bound_;
    typedef long_<0>        size;

    static aux::type_wrapper<void_> item_(...);
#else
    typedef aux::vector_tag<0> tag;
    typedef vector0 type;
    typedef void_ item0;

    typedef v_iter<vector0<>,0> begin;
    typedef v_iter<vector0<>,0> end;
#endif
};

}}

#endif // BOOST_MPL_VECTOR_AUX_VECTOR0_HPP_INCLUDED


text:
package org.allnix.sql;

import org.apache.commons.dbcp2.BasicDataSource;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.env.ConfigurableEnvironment;
import org.springframework.jdbc.core.JdbcTemplate;

/**
 *
 * @author Yi-Kun Yang >ykyang@gmail.com<
 */
@Configuration
public class HsqlJdbcConfig {
  static private Logger logger = LoggerFactory.getLogger(HsqlJdbcConfig.class);
  static public final String DATABASE_URL = HsqlJdbcConfig.class.getName() + ".database";

  @Autowired
  private ConfigurableEnvironment env;

  @Bean
  public BasicDataSource hsqlDataSource() {
    String url = env.getProperty(DATABASE_URL);
    logger.info("HSQL BasicDataSource URL: {}", url);

    // > Create H2 data source
    BasicDataSource bean = new BasicDataSource();
    bean.setUrl(url);

    return bean;
  }

  @Bean
  public JdbcTemplate hsqlJdbcTemplate() {
    JdbcTemplate bean = new JdbcTemplate();
    bean.setDataSource(hsqlDataSource());

    return bean;
  }

  @Bean
  public SqlJsonDao jsonDao() {
    SqlJsonDao bean = new SqlJsonDao();
    bean.setJdbcTemplate(hsqlJdbcTemplate());

    return bean;
  }
}


text:
require "test_helper"

describe "Fog::OpenStack::Baremetal | Baremetal port requests" do
  before do
    @baremetal = Fog::OpenStack::Baremetal.new

    @port_format = {
      'address' => String,
      'uuid'    => String
    }

    @detailed_port_format = {
      'address'    => String,
      'uuid'       => String,
      'created_at' => String,
      'updated_at' => Fog::Nullable::String,
      'extra'      => Hash,
      'node_uuid'  => String,
      'links'      => Array
    }
  end

  describe "success" do
    it "#list_ports" do
      @baremetal.list_ports.body.must_match_schema('ports' => [@port_format])
    end

    it "#list_ports_detailed" do
      @baremetal.list_ports_detailed.body.must_match_schema('ports' => [@detailed_port_format])
    end

    before do
      node_attributes = {:driver => 'pxe_ipmitool'}
      @instance = Fog::OpenStack::Baremetal.new.create_node(node_attributes).body

      port_attributes = {
        :address   => '00:c2:08:85:de:ca',
        :node_uuid => @instance['uuid']
      }
      @port = Fog::OpenStack::Baremetal.new.create_port(port_attributes).body
    end

    it "#create_port" do
      @port.must_match_schema(@detailed_port_format)
    end

    it "#get_port" do
      @baremetal.get_port(@port['uuid']).body.must_match_schema(@detailed_port_format)
    end

    it "#patch_port" do
      @baremetal.patch_port(
        @port['uuid'],
        [{'op' => 'add', 'path' => '/extra/name', 'value' => 'eth1'}]
      ).body.must_match_schema(@detailed_port_format)
    end

    it "#delete_port" do
      @baremetal.delete_port(@port['uuid']).status.must_equal 200
      @baremetal.delete_node(@instance['uuid']).status.must_equal 200
    end
  end
end


text:
// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team
//
// Permission is hereby granted, free of charge, to any person obtaining a copy of this
// software and associated documentation files (the "Software"), to deal in the Software
// without restriction, including without limitation the rights to use, copy, modify, merge,
// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons
// to whom the Software is furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all copies or
// substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.

namespace WPFDesign.Core.Extensions
{
    /// <summary>
    /// Instead of "DefaultInitializer" wich is only called for new objects,
    /// this Initializer is called for every Instance of a Design Item
    /// </summary>
    [ExtensionServer(typeof(NeverApplyExtensionsExtensionServer))]
    public abstract class DesignItemInitializer : Extension
    {
        /// <summary>
        /// Initializes the design item.
        /// </summary>
        public abstract void InitializeDesignItem(DesignItem item);
    }
}


text:
package org.unitime.timetable.onlinesectioning.model;

import java.io.Externalizable;
import java.io.IOException;
import java.io.ObjectInput;
import java.io.ObjectOutput;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.cpsolver.coursett.Constants;
import org.cpsolver.coursett.model.Lecture;
import org.cpsolver.coursett.model.Placement;
import org.cpsolver.coursett.model.RoomLocation;
import org.cpsolver.coursett.model.TimeLocation;
import org.cpsolver.ifs.util.DistanceMetric;
import org.cpsolver.studentsct.model.Section;
import org.infinispan.commons.marshall.Externalizer;
import org.infinispan.commons.marshall.SerializeWith;
import org.unitime.timetable.model.Assignment;
import org.unitime.timetable.model.ClassInstructor;
import org.unitime.timetable.model.Class_;
import org.unitime.timetable.model.CourseOffering;
import org.unitime.timetable.model.Location;
import org.unitime.timetable.onlinesectioning.OnlineSectioningHelper;

/**
 * @author Tomas Muller
 */
@SerializeWith(XSection.XSectionSerializer.class)
public class XSection implements Serializable, Comparable<XSection>, Externalizable {
    private static final long serialVersionUID = 1L;
	private Long iUniqueId = null;
    private String iName = null;
    private Map<Long, String> iNameByCourse = new HashMap<Long, String>();
    private Long iSubpartId = null;
    private Long iParentId = null;
    private int iLimit = 0;
    private String iNote = null;
    private XTime iTime = null;
    private List<XRoom> iRooms = new ArrayList<XRoom>();
    private List<XInstructor> iInstructors = new ArrayList<XInstructor>();
    private boolean iAllowOverlap = false;
    private String iInstructionalType = null;
    private String iSubpartName = null;
    private String iExternalId = null;
    private Map<Long, String> iExternalIdByCourse = new HashMap<Long, String>();
    private boolean iEnabledForScheduling = true;
    private boolean iCancelled = false;

    public XSection() {
    }

    public XSection(ObjectInput in) throws IOException, ClassNotFoundException {
    	readExternal(in);
    }

    public XSection(Class_ clazz, OnlineSectioningHelper helper) {
    	iUniqueId = clazz.getUniqueId();
    	iAllowOverlap = clazz.getSchedulingSubpart().isStudentAllowOverlap();
    	iName = (clazz.getClassSuffix() == null ? clazz.getSectionNumber(helper.getHibSession()) + clazz.getSchedulingSubpart().getSchedulingSubpartSuffix(helper.getHibSession()) : clazz.getClassSuffix());
        iInstructionalType = clazz.getSchedulingSubpart().getItypeDesc();
        iSubpartName = clazz.getSchedulingSubpart().getItype().getAbbv().trim();
    	Assignment assignment = clazz.getCommittedAssignment();
    	iEnabledForScheduling = clazz.isEnabledForStudentScheduling();
    	iCancelled = clazz.isCancelled();
        if (!clazz.isEnabledForStudentScheduling()) {
        	iLimit = 0;
        } else if (clazz.getSchedulingSubpart().getInstrOfferingConfig().isUnlimitedEnrollment()) {
        	iLimit = -1;
        } else {
        	iLimit = clazz.getMaxExpectedCapacity();
        	if (clazz.getExpectedCapacity() < clazz.getMaxExpectedCapacity() && assignment != null && !assignment.getRooms().isEmpty()) {
        		int roomSize = Integer.MAX_VALUE;
        		for (Location room: assignment.getRooms())
        			roomSize = Math.min(roomSize, room.getCapacity() == null ? 0 : room.getCapacity());
        		int roomLimit = (int) Math.floor(roomSize / (clazz.getRoomRatio() == null ? 1.0f : clazz.getRoomRatio()));
        		iLimit = Math.min(Math.max(clazz.getExpectedCapacity(), roomLimit), clazz.getMaxExpectedCapacity());
        	}
            if (iLimit >= 9999) iLimit = -1;
        }
        iParentId = (clazz.getParentClass() == null ? null : clazz.getParentClass().getUniqueId());
        iSubpartId = clazz.getSchedulingSubpart().getUniqueId();
        iNote = clazz.getSchedulePrintNote();
        iExternalId = clazz.getExternalUniqueId();
        if (iExternalId == null)
        	iExternalId = clazz.getClassLabel();
        for (CourseOffering course: clazz.getSchedulingSubpart().getInstrOfferingConfig().getInstructionalOffering().getCourseOfferings()) {
        	iNameByCourse.put(course.getUniqueId(), clazz.getClassSuffix(course));
        	String extId = clazz.getExternalId(course);
        	if (extId == null)
        		extId = clazz.getClassLabel(course);
        	iExternalIdByCourse.put(course.getUniqueId(), extId);
        }
        iNameByCourse.put(-1l, clazz.getSectionNumberString(helper.getHibSession()));
        if (assignment != null) {
        	iTime = new XTime(assignment, helper.getExactTimeConversion(), helper.getDatePatternFormat());
        	for (Location room: assignment.getRooms())
        		iRooms.add(new XRoom(room));
        }

        if (clazz.isDisplayInstructor())
            for (ClassInstructor ci: clazz.getClassInstructors()) {
            	iInstructors.add(new XInstructor(ci.getInstructor(), helper));
            }
    }

    public XSection(Section section) {
    	iUniqueId = section.getId();
    	iAllowOverlap = section.getSubpart().isAllowOverlap();
    	iName = section.getName();
    	iNameByCourse = section.getNameByCourse();
    	iSubpartName = section.getSubpart().getName();
    	iLimit = section.getLimit();
    	iParentId = (section.getParent() == null ? null : section.getParent().getId());
    	iSubpartId = section.getSubpart().getId();
    	iInstructionalType = section.getSubpart().getInstructionalType();
    	iNote = section.getNote();
    	iTime = section.getTime() == null ? null : new XTime(section.getTime());
    	iCancelled = section.isCancelled();
    	if (section.getNrRooms() > 0)
    		for (RoomLocation room: section.getRooms())
    			iRooms.add(new XRoom(room));
    	if (section.getChoice() != null && section.getChoice().getInstructorNames() != null) {
    		String[] ids = section.getChoice().getInstructorIds().split(":");
    		int i = 0;
    		for (String instructor: section.getChoice().getInstructorNames().split(":")) {
    			String[] nameEmail = instructor.split("\\|");
    			iInstructors.add(new XInstructor(
    					Long.valueOf(ids[i]),
    					null,
    					nameEmail[0],
    					nameEmail.length > 1 ? nameEmail[1] : null));
    			i++;
    		}
    	}
    }

    /** For testing only! */
    @Deprecated
    public XSection(String externalId) {
    	iExternalId = externalId;
    }

    /** Section id */
    public Long getSectionId() { return iUniqueId; }

    /**
     * Section limit. This is defines the maximal number of students that can be
     * enrolled into this section at the same time. It is -1 in the case of an
     * unlimited section
     */
    public int getLimit() { return iLimit; }

    /** Section name */
    public String getName() { return iName; }

    /** Scheduling subpart to which this section belongs */
    public Long getSubpartId() { return iSubpartId; }

    /**
     * Parent section of this section (can be null). If there is a parent
     * section defined, a student that is enrolled in this section has to be
     * enrolled in the parent section as well. Also, the same relation needs to
     * be defined between subpart of this section and the subpart of the parent
     * section.
     */
    public Long getParentId() { return iParentId; }

    /** Time placement of the section. */
    public XTime getTime() {
    	return iTime;
    }

    /** Number of rooms in which the section meet. */
    public int getNrRooms() {
        return (iRooms == null ? 0 : iRooms.size());
    }

    /**
     * Room placement -- list of
     * {@link org.cpsolver.coursett.model.RoomLocation}
     */
    public List<XRoom> getRooms() {
    	return iRooms;
    }

    public String toRoomString(String delim) {
    	String ret = "";
    	for (XRoom room: iRooms) {
    		if (!ret.isEmpty()) ret += delim;
    		ret += room.getName();
    	}
    	return ret;
    }

    @Override
    public String toString() {
    	return getSubpartName() + " " + getName() + " " + (getTime() == null ? "Arrange Hours" : getTime().toString()) + (getNrRooms() == 0 ? "" : " " + toRoomString(", "));
    }

    public String toString(Long coruseId) {
    	return getSubpartName() + " " + getName(coruseId) + " " + (getTime() == null ? "Arrange Hours" : getTime().toString()) + (getNrRooms() == 0 ? "" : " " + toRoomString(", "));
    }

    /**
     * Return course-dependent section name
     */
    public String getName(long courseId) {
        if (iNameByCourse == null) return getName();
        String name = iNameByCourse.get(courseId);
        return (name == null ? getName() : name);
    }

    /**
     * Return course-dependent external id
     */
    public String getExternalId(long courseId) {
        if (iExternalIdByCourse == null) return iExternalId;
        String externalId = iExternalIdByCourse.get(courseId);
        return (externalId == null ? iExternalId : externalId);
    }

    /**
     * Return course-dependent section names
     */
    public Map<Long, String> getNameByCourse() { return iNameByCourse; }

    @Override
    public boolean equals(Object o) {
        if (o == null || !(o instanceof XSection)) return false;
        return getSectionId().equals(((XSection)o).getSectionId());
    }

    @Override
    public int hashCode() {
        return (int) (getSectionId() ^ (getSectionId() >>> 32));
    }

    /**
     * Section note
     */
    public String getNote() { return iNote; }

    /**
     * Instructors
     */
    public List<XInstructor> getInstructors() { return iInstructors; }

    public String getInstructorIds() {
    	if (iInstructors == null || iInstructors.isEmpty()) return null;
    	StringBuffer ret = new StringBuffer();
    	for (XInstructor instructor: iInstructors) {
    		if (ret.length() > 0) ret.append(":");
    		ret.append(instructor.getIntructorId());
    	}
    	return ret.toString();
    }

    public String getInstructorNames() {
    	if (iInstructors == null || iInstructors.isEmpty()) return null;
    	StringBuffer ret = new StringBuffer();
    	for (XInstructor instructor: iInstructors) {
    		if (ret.length() > 0) ret.append(":");
    		ret.append(instructor.getName() + "|"  + (instructor.getEmail() == null ? "" : instructor.getEmail()));
    	}
    	return ret.toString();
    }

    /**
     * Returns true if student conflicts between this section and the given one are to be ignored
     */
    public boolean isToIgnoreStudentConflictsWith(Collection<XDistribution> distributions, Long sectionId) {
    	if (distributions == null) return false;
    	for (XDistribution distribution: distributions)
    		if (distribution.getDistributionType() == XDistributionType.IngoreConflicts &&
    			distribution.getSectionIds().contains(getSectionId()) &&
    			distribution.getSectionIds().contains(sectionId))
    			return true;
    	return false;
    }

	@Override
	public int compareTo(XSection section) {
		return getSectionId().compareTo(section.getSectionId());
	}

	private int getDistanceInMinutes(DistanceMetric m,  List<XRoom> other) {
        int dist = 0;
        for (XRoom r1 : getRooms())
            for (XRoom r2 : other) {
                dist = Math.max(dist, r1.getDistanceInMinutes(m, r2));
            }
        return dist;
	}

	public int getDistanceInMinutes(XSection other, DistanceMetric m) {
		if (getNrRooms() == 0 || other.getNrRooms() == 0) return 0;
		XTime t1 = getTime();
		XTime t2 = other.getTime();
		if (t1 == null || t2 == null || !t1.shareDays(t2) || !t1.shareWeeks(t2)) return 0;
        int a1 = t1.getSlot(), a2 = t2.getSlot();
        if (m.doComputeDistanceConflictsBetweenNonBTBClasses()) {
        	if (a1 + t1.getLength() <= a2) {
        		int dist = getDistanceInMinutes(m, other.getRooms());
        		if (dist > t1.getBreakTime() + Constants.SLOT_LENGTH_MIN * (a2 - a1 - t1.getLength()))
        			return dist;
        	}
        } else {
        	if (a1 + t1.getLength() == a2)
        		return getDistanceInMinutes(m, other.getRooms());
        }
        return 0;
    }

    /** Return true if overlaps are allowed, but the number of overlapping slots should be minimized. */
    public boolean isAllowOverlap() {
        return iAllowOverlap;
    }

    public String getSubpartName() {
    	return iSubpartName;
    }

    public String getInstructionalType() {
    	return iInstructionalType;
    }

    public boolean isEnabledForScheduling() {
    	return iEnabledForScheduling;
    }

    public boolean isCancelled() {
    	return iCancelled;
    }

    /**
     * True, if this section overlaps with the given assignment in time and
     * space
     */
    public boolean isOverlapping(Collection<XDistribution> distributions, XSection other) {
        if (isAllowOverlap() || other.isAllowOverlap()) return false;
        if (getTime() == null || other.getTime() == null) return false;
        if (isToIgnoreStudentConflictsWith(distributions, other.getSectionId())) return false;
        return getTime().hasIntersection(other.getTime());
    }

    /**
     * True, if this section overlaps with one of the given set of assignments
     * in time and space
     */
    public boolean isOverlapping(Collection<XDistribution> distributions, Collection<XSection> assignments) {
        if (isAllowOverlap()) return false;
        if (getTime() == null || assignments == null)
            return false;
        for (XSection assignment : assignments) {
            if (assignment.isAllowOverlap())
                continue;
            if (assignment.getTime() == null)
                continue;
            if (isToIgnoreStudentConflictsWith(distributions, assignment.getSectionId()))
                continue;
            if (getTime().hasIntersection(assignment.getTime()))
                return true;
        }
        return false;
    }

    public Placement toPlacement() {
    	if (getTime() == null) return null;
        List<RoomLocation> rooms = new ArrayList<RoomLocation>();
        for (XRoom r: getRooms())
        	rooms.add(new RoomLocation(r.getUniqueId(), r.getName(), null, 0, 0, r.getX(), r.getY(), r.getIgnoreTooFar(), null));
        return new Placement(
        		new Lecture(getSectionId(), null, getSubpartId(), getName(), new ArrayList<TimeLocation>(), new ArrayList<RoomLocation>(), getNrRooms(), null, getLimit(), getLimit(), 1.0),
        		getTime().toTimeLocation(),
        		rooms);
    }

	@Override
	public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
		iUniqueId = in.readLong();
		iName = (String)in.readObject();

		int nrNames = in.readInt();
		iNameByCourse.clear();
		for (int i = 0; i < nrNames; i++)
			iNameByCourse.put(in.readLong(), (String)in.readObject());

		iSubpartId = in.readLong();
		iParentId = in.readLong();
		if (iParentId < 0) iParentId = null;
		iLimit = in.readInt();
		iNote = (String)in.readObject();
		iTime = (in.readBoolean() ? new XTime(in) : null);

		int nrRooms = in.readInt();
		iRooms.clear();
		for (int i = 0; i < nrRooms; i++)
			iRooms.add(new XRoom(in));

		int nrInstructors = in.readInt();
		iInstructors.clear();
		for (int i = 0; i < nrInstructors; i++)
			iInstructors.add(new XInstructor(in));

		iAllowOverlap = in.readBoolean();
		iInstructionalType = (String)in.readObject();
		iSubpartName = (String)in.readObject();

		iExternalId = (String)in.readObject();
		int nrExtIds = in.readInt();
		iExternalIdByCourse.clear();
		for (int i = 0; i < nrExtIds; i++)
			iExternalIdByCourse.put(in.readLong(), (String)in.readObject());
		iEnabledForScheduling = in.readBoolean();
		iCancelled = in.readBoolean();
	}

	@Override
	public void writeExternal(ObjectOutput out) throws IOException {
		out.writeLong(iUniqueId);
		out.writeObject(iName);

		out.writeInt(iNameByCourse.size());
		for (Map.Entry<Long, String> entry: iNameByCourse.entrySet()) {
			out.writeLong(entry.getKey());
			out.writeObject(entry.getValue());
		}

		out.writeLong(iSubpartId);
		out.writeLong(iParentId == null ? -1l : iParentId);
		out.writeInt(iLimit);
		out.writeObject(iNote);

		out.writeBoolean(iTime != null);
		if (iTime != null)
			iTime.writeExternal(out);

		out.writeInt(iRooms.size());
		for (XRoom room: iRooms)
			room.writeExternal(out);

		out.writeInt(iInstructors.size());
		for (XInstructor instructor: iInstructors)
			instructor.writeExternal(out);

		out.writeBoolean(iAllowOverlap);
		out.writeObject(iInstructionalType);
		out.writeObject(iSubpartName);

		out.writeObject(iExternalId);
		out.writeInt(iExternalIdByCourse.size());
		for (Map.Entry<Long, String> entry: iExternalIdByCourse.entrySet()) {
			out.writeLong(entry.getKey());
			out.writeObject(entry.getValue());
		}
		out.writeBoolean(iEnabledForScheduling);
		out.writeBoolean(iCancelled);
	}

	public static class XSectionSerializer implements Externalizer<XSection> {
		private static final long serialVersionUID = 1L;

		@Override
		public void writeObject(ObjectOutput output, XSection object) throws IOException {
			object.writeExternal(output);
		}

		@Override
		public XSection readObject(ObjectInput input) throws IOException, ClassNotFoundException {
			return new XSection(input);
		}
	}
}


text:
package com.cognifide.slice.test.module;

import com.cognifide.slice.api.model.InitializableModel;
import com.cognifide.slice.mapper.annotation.JcrProperty;
import com.cognifide.slice.mapper.annotation.SliceResource;

/**
 * User: krzysztof.ryk@solsoft.pl Date: 4/21/15 1:28 PM
 */
@SliceResource
public class SimpleModel implements InitializableModel {

	@JcrProperty
	private String prop1;

	public String getProp1() {
		return prop1;
	}

	@Override
	public void afterCreated() {
		// empty implementation
	}
}


text:
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
  <appender name="console" class="ch.qos.logback.core.ConsoleAppender">
    <encoder>
      <pattern>%date{ISO8601} %-5level %marker [%thread] %logger{1} : %message%n</pattern>
    </encoder>
  </appender>

  <root level="off">
    <appender-ref ref="console" />
  </root>
</configuration>


text:
import {tableSchema} from '@nozbe/watermelondb';

import {MM_TABLES} from '@constants/database';

const {DRAFT} = MM_TABLES.SERVER;

export default tableSchema({
    name: DRAFT,
    columns: [
        {name: 'channel_id', type: 'string', isIndexed: true},
        {name: 'files', type: 'string'},
        {name: 'message', type: 'string'},
        {name: 'root_id', type: 'string', isIndexed: true},
    ],
});


text:
<?php

namespace ZendTest\Db\Sql\Ddl\Column;

use Zend\Db\Sql\Ddl\Column\Timestamp;

class TimestampTest extends \PHPUnit_Framework_TestCase
{
    /**
     * @covers Zend\Db\Sql\Ddl\Column\Timestamp::getExpressionData
     */
    public function testGetExpressionData()
    {
        $column = new Timestamp('foo');
        $this->assertEquals(
            [['%s %s NOT NULL', ['foo', 'TIMESTAMP'], [$column::TYPE_IDENTIFIER, $column::TYPE_LITERAL]]],
            $column->getExpressionData()
        );
    }
}


text:
package gov.hhs.fha.nhinc.mpi.adapter;

import gov.hhs.fha.nhinc.common.nhinccommon.AssertionType;
import gov.hhs.fha.nhinc.mpi.adapter.component.proxy.AdapterComponentMpiProxy;
import gov.hhs.fha.nhinc.mpi.adapter.component.proxy.AdapterComponentMpiProxyObjectFactory;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.hl7.v3.PRPAIN201305UV02;
import org.hl7.v3.PRPAIN201306UV02;

/**
 *
 * This is the business logic for the AdapterMpi. This is a thin layer,
 *
 * it simply takes the request and calls the AdapterComponentMpi.
 *
 *
 *
 * @author Les Westberg
 */

public class AdapterMpiOrchImpl

{

    private static Log log = LogFactory.getLog(AdapterMpiOrchImpl.class);

    /**
     *
     * Send the patient query request to the actual MPI that is implemented
     *
     *
     *
     * @param findCandidatesRequest The request containing the query information.
     *
     * @param assertion The assertion for this message.
     *
     * @return The results of the query.
     */

    public PRPAIN201306UV02 query(PRPAIN201305UV02 findCandidatesRequest, AssertionType assertion)

    {

        log.debug("Entering AdapterMpiOrchImpl.query method...");

        AdapterComponentMpiProxy oMpiProxy = null;

        AdapterComponentMpiProxyObjectFactory oFactory = new AdapterComponentMpiProxyObjectFactory();

        oMpiProxy = oFactory.getAdapterComponentMpiProxy();

        PRPAIN201306UV02 oResponse = oMpiProxy.findCandidates(findCandidatesRequest, assertion);

        return oResponse;

    }

}


text:
#include "../challenge_1_1/challenge_1_1.h"
#include "../challenge_1_3/challenge_1_3.h"

#include <string>
#include <vector>
#include <cstdint>
#include <iostream>
#include <fstream>

inline bool FileReadAllData(const std::string & filename, std::vector<unsigned char> & data)
{
    std::ifstream in(filename, std::ios::binary);
    if(!in.is_open())
        return false;
    data.clear();
    while (in)
    {
        char c;
        in.get(c);
        if (in)
            data.push_back(c);
    }
    return true;
}

inline bool FileReadAllText(const std::string & filename, std::string & str)
{
    std::vector<unsigned char> data;
    if (!FileReadAllData(filename, data))
        return false;
    str = VectorToString(data);
    return true;
}

inline bool FileReadAllLines(const std::string & filename, std::vector<std::string> & lines)
{
    std::string str;
    if (!FileReadAllText(filename, str))
        return false;
    lines.clear();
    std::string line;
    for (size_t i = 0; i < str.length(); i++)
    {
        if (str[i] == '\r')
            continue;
        if (str[i] == '\n')
        {
            lines.push_back(line);
            line.clear();
        }
        else
            line.push_back(str[i]);
    }
    if (line.length())
        lines.push_back(line);
    return true;
}

inline std::string RemoveWhitespace(const std::string & str)
{
    std::string result;
    result.reserve(str.length());
    for (size_t i = 0; i < str.length(); i++)
    {
        if (isspace(str[i]))
            continue;
        result.push_back(str[i]);
    }
    return std::move(result);
}

inline bool FileReadAllNoWhitespaceText(const std::string & filename, std::string & str)
{
    if (!FileReadAllText(filename, str))
        return false;
    str = RemoveWhitespace(str);
    return true;
}

inline void FindBestSingleXorCandidate(const std::vector<std::vector<unsigned char>> & dataList, size_t & bestIndex, unsigned char & bestKey, int & bestScore)
{
    bestScore = 0;
    for (size_t i = 0; i < dataList.size(); i++)
    {
        int score;
        unsigned char key;
        FindBestSingleXorKey(dataList[i], key, score);
        if (score > bestScore)
        {
            bestScore = score;
            bestKey = key;
            bestIndex = i;
        }
    }
}


text:
require "application_system_test_case"

class ArtistsTest < ApplicationSystemTestCase
  # test "visiting the index" do
  #   visit artists_url
  #
  #   assert_selector "h1", text: "Artist"
  # end
end