text:
package ch.trivadis.com.lesson4;

import java.util.List;

/**
 * Created by Andy Moncsek on 07.06.16.
 */
public class Person implements Comparable<Person> {

    private final String firstName;
    private final String lastName;
    private final int age;
    private final String street;
    private final String zip;
    private final List<Address> addresses;

    private Person(String firstName, String lastName, int age, String street, String zip, List<Address> addresses) {
        this.firstName = firstName;
        this.lastName = lastName;
        this.age = age;
        this.street = street;
        this.zip = zip;
        this.addresses = addresses;
    }

    public String getFirstName() {
        return firstName;
    }

    public String getLastName() {
        return lastName;
    }

    public int getAge() {
        return age;
    }

    public String getStreet() {
        return street;
    }

    public String getZip() {
        return zip;
    }

    public List<Address> getAddresses() {
        return addresses;
    }

    // Start your Builder always with the last member you want to add (if order matters), the last builder interface always returns the type of the Object you want to build

    public interface AddressesBuilder {
        Person addresses(List<Address> addresses);
    }

    public interface ZipBuilder {
        AddressesBuilder zip(String zip);
    }

    public interface StreetBuilder {
        ZipBuilder street(String street);
    }

    public interface AgeBuilder {
        StreetBuilder age(int age);
    }

    public interface LastNameBuilder {
        AgeBuilder lastName(String lastName);
    }

    public interface FirstNameBuilder {
        LastNameBuilder firstName(String firstName);
    }

    // the static "build" method returns always with the first builder interface

    public static FirstNameBuilder build() {
        return firstName -> lastName -> age -> street -> zip -> addresses -> new Person(firstName, lastName, age, street, zip, addresses);
    }

    @Override
    public String toString() {
        return "Person{" +
                "firstName='" + firstName + '\'' +
                ", lastName='" + lastName + '\'' +
                ", age=" + age +
                ", street='" + street + '\'' +
                ", zip='" + zip + '\'' +
                ", addresses=" + addresses +
                '}';
    }

    @Override
    public int compareTo(Person o) {
        return firstName.compareTo(o.firstName);
    }
}


text:
package ru.rkhaustov.list;

import java.util.Iterator;
import java.util.NoSuchElementException;

/**
 * Created by rvkha_000 on 17.06.2017.
 * @param <E> type object.
 */
public class LinkedArraySynch<E> implements SynchronizedList<E> {
    /**
     * size array.
     */
    private int size = 0;
    /**
     * Ponter first value.
     */
    private Node<E> first;
    /**
     * Ponter last value.
     */
    private Node<E> last;

    /**
     * @param e e value objects.
     * @return current index position
     */

    @Override
    public synchronized int add(E e) {
        final Node<E> l = last;
        final Node<E> newNode = new Node<>(l, e, null);
        last = newNode;
        if (l == null) {
            first = newNode;
        } else {
            l.next = newNode;
        }
        return size++;
    }

    /**
     * @param index position number.
     * @return value object.
     */
    @Override
    public synchronized E get(int index) {
        return (index >= 0 && index < size) ? getNode(index).object : null;
    }

    /**
     * @param index index
     * @return node Object
     */
    public Node<E> getNode(int index) {
        if (index == 0) {
            return first;
        } else if (index < (size >> 1)) {
            Node<E> node = first;
            for (int atFirst = 0; atFirst < index; atFirst++) {
                node = node.next;
            }
            return node;
        } else {
            Node<E> node = last;
            for (int fromEnd = size - 1; fromEnd > index; fromEnd--) {
                node = node.prev;
            }
            return node;
        }
    }

    /**
     * @param index index position number.
     * @param e  E
     */
    public void add(int index, E e) {
        if (index == size) {
            add(e);
        } else {
            final Node<E> succ = getNode(index);
            final Node<E> pred = succ.prev;
            final Node<E> newNode = new Node<>(pred, e, succ);
            succ.prev = newNode;
            if (pred == null) {
                first = newNode;
            } else {
                pred.next = newNode;
            }
            size++;
        }
    }

    /**
     * @return size array.
     */
    public int size() {
        return size;
    }

    /**
     * Method delete first element.
     */
    public void removeFirst() {
        if (size > 0) {
            Node<E> secondObject = this.first.next;
            secondObject.prev = null;
            this.first = secondObject;
            this.size--;
        } else {
            throw new NoSuchElementException();
        }
    }
    /**
     * Method delete last element.
     */
    public void removeLast() {
        if (size > 0) {
            Node<E> prevObjectLast = this.last.prev;
            prevObjectLast.next = null;
            this.last = prevObjectLast;
            this.size--;
        } else {
            throw new NoSuchElementException();
        }
    }

    /**
     * Returns an iterator over elements of type {@code T}.
     *
     * @return an Iterator.
     */
    @Override
    public Iterator<E> iterator() {
        return new LinkedArrayIterator();
    }

    /**
     * Node class storege pointer.
     * @param <E> type object.
     */
    public static class Node<E> {
        /**
         * object.
         */
        private E  object = null;
        /**
         * next pointer.
         */
        private Node<E> next;
        /**
         * prev pointer.
         */
        private Node<E> prev;

        /**
         * @param prev prev pointer.
         * @param element object.
         * @param next next pointer.
         */
        Node(Node<E> prev, E element, Node<E> next) {
            this.object = element;
            this.next = next;
            this.prev = prev;
        }

    }

    /**
     * implements Iterator methods.
     */
    public class LinkedArrayIterator implements Iterator<E> {
        /**
         * indexIterator.
         */
        private int indexIterator = 0;
        /**
         * nodeIterator.
         */
        private Node<E> nodeIterator = first;

        /**
         * Returns {@code true} if the iteration has more elements.
         * (In other words, returns {@code true} if {@link #next} would
         * return an element rather than throwing an exception.)
         *
         * @return {@code true} if the iteration has more elements
         */
        @Override
        public boolean hasNext() {
            return indexIterator < size ? true : false;
        }

        /**
         * Returns the next element in the iteration.
         *
         * @return the next element in the iteration
         * @throws NoSuchElementException if the iteration has no more elements
         */
        @Override
        public E next() {
            if (!hasNext()) {
                throw new NoSuchElementException();
            }
            if (indexIterator++ != 0) {
                nodeIterator = nodeIterator.next;
            }
            return nodeIterator.object;
        }
    }
}

redpajama_set_name: RedPajamaGithub


text:
package net.bytebuddy.implementation.bind.annotation;

import net.bytebuddy.description.type.TypeDescription;
import net.bytebuddy.implementation.bind.MethodDelegationBinder;
import net.bytebuddy.implementation.bytecode.assign.Assigner;
import org.junit.Before;
import org.junit.Test;
import org.mockito.Mock;

import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.mockito.Mockito.*;

public class SuperBinderTest extends AbstractAnnotationBinderTest<Super> {

    @Mock
    private TypeDescription targetType;

    @Mock
    private TypeDescription.Generic genericTargetType;

    @Mock
    private Super.Instantiation instantiation;

    public SuperBinderTest() {
        super(Super.class);
    }

    @Override
    @Before
    public void setUp() throws Exception {
        super.setUp();
        when(target.getType()).thenReturn(genericTargetType);
        when(genericTargetType.asErasure()).thenReturn(targetType);
        when(annotation.strategy()).thenReturn(instantiation);
        when(instantiation.proxyFor(targetType, implementationTarget, annotationDescription)).thenReturn(stackManipulation);
        when(annotation.constructorParameters()).thenReturn(new Class<?>[0]);
        when(targetType.asErasure()).thenReturn(targetType);
    }

    @Override
    protected TargetMethodAnnotationDrivenBinder.ParameterBinder<Super> getSimpleBinder() {
        return Super.Binder.INSTANCE;
    }

    @Test
    public void testAssignableBinding() throws Exception {
        doReturn(void.class).when(annotation).proxyType();
        when(stackManipulation.isValid()).thenReturn(true);
        when(instrumentedType.isAssignableTo(targetType)).thenReturn(true);
        MethodDelegationBinder.ParameterBinding<?> parameterBinding = Super.Binder.INSTANCE
                .bind(annotationDescription, source, target, implementationTarget, assigner, Assigner.Typing.STATIC);
        assertThat(parameterBinding.isValid(), is(true));
        verify(instantiation).proxyFor(targetType, implementationTarget, annotationDescription);
    }

    @Test
    public void testIllegalBindingForNonAssignableType() throws Exception {
        doReturn(void.class).when(annotation).proxyType();
        MethodDelegationBinder.ParameterBinding<?> parameterBinding = Super.Binder.INSTANCE
                .bind(annotationDescription, source, target, implementationTarget, assigner, Assigner.Typing.STATIC);
        assertThat(parameterBinding.isValid(), is(false));
    }

    @Test
    public void testIllegalBindingStaticMethod() throws Exception {
        doReturn(void.class).when(annotation).proxyType();
        when(source.isStatic()).thenReturn(true);
        MethodDelegationBinder.ParameterBinding<?> parameterBinding = Super.Binder.INSTANCE
                .bind(annotationDescription, source, target, implementationTarget, assigner, Assigner.Typing.STATIC);
        assertThat(parameterBinding.isValid(), is(false));
    }

    @Test(expected = IllegalStateException.class)
    public void testPrimitiveParameterType() throws Exception {
        when(genericTargetType.isPrimitive()).thenReturn(true);
        Super.Binder.INSTANCE.bind(annotationDescription, source, target, implementationTarget, assigner, Assigner.Typing.STATIC);
    }

    @Test(expected = IllegalStateException.class)
    public void testArrayParameterType() throws Exception {
        when(genericTargetType.isArray()).thenReturn(true);
        Super.Binder.INSTANCE.bind(annotationDescription, source, target, implementationTarget, assigner, Assigner.Typing.STATIC);
    }

    @Test(expected = IllegalStateException.class)
    public void testPrimitiveProxyType() throws Exception {
        doReturn(int.class).when(annotation).proxyType();
        Super.Binder.INSTANCE.bind(annotationDescription, source, target, implementationTarget, assigner, Assigner.Typing.STATIC);
    }

    @Test(expected = IllegalStateException.class)
    public void testArrayProxyType() throws Exception {
        doReturn(Object[].class).when(annotation).proxyType();
        Super.Binder.INSTANCE.bind(annotationDescription, source, target, implementationTarget, assigner, Assigner.Typing.STATIC);
    }

    @Test(expected = IllegalStateException.class)
    public void testNonAssignableType() throws Exception {
        doReturn(Void.class).when(annotation).proxyType();
        Super.Binder.INSTANCE.bind(annotationDescription, source, target, implementationTarget, assigner, Assigner.Typing.STATIC);
    }

    @Test(expected = IllegalStateException.class)
    public void testFinalProxyType() throws Exception {
        doReturn(void.class).when(annotation).proxyType();
        when(targetType.isFinal()).thenReturn(true);
        Super.Binder.INSTANCE.bind(annotationDescription, source, target, implementationTarget, assigner, Assigner.Typing.STATIC);
    }
}


text:
using System.Collections.Generic;
using Azure.Core;
using Azure.ResourceManager.ProviderHub;

namespace Azure.ResourceManager.ProviderHub.Models
{
    /// <summary> The DefaultRolloutSpecification. </summary>
    public partial class DefaultRolloutSpecification
    {
        /// <summary> Initializes a new instance of DefaultRolloutSpecification. </summary>
        public DefaultRolloutSpecification()
        {
            ResourceTypeRegistrations = new ChangeTrackingList<ResourceTypeRegistrationData>();
        }

        /// <summary> Initializes a new instance of DefaultRolloutSpecification. </summary>
        /// <param name="expeditedRollout"></param>
        /// <param name="canary"></param>
        /// <param name="lowTraffic"></param>
        /// <param name="mediumTraffic"></param>
        /// <param name="highTraffic"></param>
        /// <param name="restOfTheWorldGroupOne"></param>
        /// <param name="restOfTheWorldGroupTwo"></param>
        /// <param name="providerRegistration"></param>
        /// <param name="resourceTypeRegistrations"></param>
        internal DefaultRolloutSpecification(DefaultRolloutSpecificationExpeditedRollout expeditedRollout, DefaultRolloutSpecificationCanary canary, DefaultRolloutSpecificationLowTraffic lowTraffic, DefaultRolloutSpecificationMediumTraffic mediumTraffic, DefaultRolloutSpecificationHighTraffic highTraffic, DefaultRolloutSpecificationRestOfTheWorldGroupOne restOfTheWorldGroupOne, DefaultRolloutSpecificationRestOfTheWorldGroupTwo restOfTheWorldGroupTwo, DefaultRolloutSpecificationProviderRegistration providerRegistration, IList<ResourceTypeRegistrationData> resourceTypeRegistrations)
        {
            ExpeditedRollout = expeditedRollout;
            Canary = canary;
            LowTraffic = lowTraffic;
            MediumTraffic = mediumTraffic;
            HighTraffic = highTraffic;
            RestOfTheWorldGroupOne = restOfTheWorldGroupOne;
            RestOfTheWorldGroupTwo = restOfTheWorldGroupTwo;
            ProviderRegistration = providerRegistration;
            ResourceTypeRegistrations = resourceTypeRegistrations;
        }

        /// <summary> Gets or sets the expedited rollout. </summary>
        internal DefaultRolloutSpecificationExpeditedRollout ExpeditedRollout { get; set; }
        /// <summary> Indicates whether expedited rollout is enabled/disabled. </summary>
        public bool? ExpeditedRolloutEnabled
        {
            get => ExpeditedRollout is null ? default : ExpeditedRollout.Enabled;
            set
            {
                if (ExpeditedRollout is null)
                    ExpeditedRollout = new DefaultRolloutSpecificationExpeditedRollout();
                ExpeditedRollout.Enabled = value;
            }
        }

        /// <summary> Gets or sets the canary. </summary>
        public DefaultRolloutSpecificationCanary Canary { get; set; }
        /// <summary> Gets or sets the low traffic. </summary>
        public DefaultRolloutSpecificationLowTraffic LowTraffic { get; set; }
        /// <summary> Gets or sets the medium traffic. </summary>
        public DefaultRolloutSpecificationMediumTraffic MediumTraffic { get; set; }
        /// <summary> Gets or sets the high traffic. </summary>
        public DefaultRolloutSpecificationHighTraffic HighTraffic { get; set; }
        /// <summary> Gets or sets the rest of the world group one. </summary>
        public DefaultRolloutSpecificationRestOfTheWorldGroupOne RestOfTheWorldGroupOne { get; set; }
        /// <summary> Gets or sets the rest of the world group two. </summary>
        public DefaultRolloutSpecificationRestOfTheWorldGroupTwo RestOfTheWorldGroupTwo { get; set; }
        /// <summary> Gets or sets the provider registration. </summary>
        public DefaultRolloutSpecificationProviderRegistration ProviderRegistration { get; set; }
        /// <summary> Gets the resource type registrations. </summary>
        public IList<ResourceTypeRegistrationData> ResourceTypeRegistrations { get; }
    }
}


text:
"use strict";

var expect = chai.expect;

describe('Page integration', function () {
    describe('proxy object', function () {
        it('should exist on page', function () {
            expect(PUBNUB_AS2JS_PROXY).to.be.a('object');
            expect(PUBNUB_AS2JS_PROXY).to.respondTo('setFlashObjectId');
        });

        it('should respond to common delegated methods', function () {
            expect(PUBNUB_AS2JS_PROXY).to.respondTo('publish');
            expect(PUBNUB_AS2JS_PROXY).to.respondTo('subscribe');
        })
    });

    describe('flash object getter', function () {
        it("should query dom for flash object if it's local value is null", function () {
            var flashObject = document.getElementById('pubnubFlashObject');

            PUBNUB_AS2JS_PROXY.flashObject = null;

            expect(PUBNUB_AS2JS_PROXY.getFlashObject()).to.equal(flashObject);
        });
    });
});


text:
from django.core.management.base import BaseCommand
from django.db import connection
from pollingstations.models import PollingStation, PollingDistrict, ResidentialAddress

"""
Clear PollingDistrict, PollingStation and ResidentialAddress models
Clear report, num_addresses, num_districts and num_stations
fields in DataQuality model
"""
class Command(BaseCommand):

    def handle(self, *args, **kwargs):
        PollingDistrict.objects.all().delete()
        PollingStation.objects.all().delete()
        ResidentialAddress.objects.all().delete()
        # use raw SQL so we don't have to loop over every single record one-by-one
        cursor = connection.cursor()
        cursor.execute("UPDATE data_collection_dataquality SET report='', num_addresses=0, num_districts=0, num_stations=0")


text:
package com.hankcs.test.corpus;

import com.hankcs.hanlp.HanLP;
import com.hankcs.hanlp.corpus.dictionary.DictionaryMaker;
import com.hankcs.hanlp.corpus.dictionary.item.Item;
import com.hankcs.hanlp.corpus.io.IOUtil;
import com.hankcs.hanlp.dictionary.CoreDictionary;
import com.hankcs.hanlp.dictionary.common.CommonStringDictionary;
import com.hankcs.hanlp.dictionary.nt.OrganizationDictionary;
import com.hankcs.hanlp.seg.Dijkstra.DijkstraSegment;
import com.hankcs.hanlp.utility.LexiconUtility;
import junit.framework.TestCase;

import java.util.Map;
import java.util.Set;

/**
 * @author hankcs
 */
public class TestNTRecognition extends TestCase
{
    public void testSeg() throws Exception
    {
        HanLP.Config.enableDebug();
        DijkstraSegment segment = new DijkstraSegment();
        segment.enableCustomDictionary(false);

        segment.enableOrganizationRecognize(true);
        System.out.println(segment.seg("东欧的球队"));
    }

    public void testGeneratePatternJavaCode() throws Exception
    {
        CommonStringDictionary commonStringDictionary = new CommonStringDictionary();
        commonStringDictionary.load("data/dictionary/organization/nt.pattern.txt");
        StringBuilder sb = new StringBuilder();
        Set<String> keySet = commonStringDictionary.keySet();
        CommonStringDictionary secondDictionary = new CommonStringDictionary();
        secondDictionary.load("data/dictionary/organization/outerNT.pattern.txt");
        keySet.addAll(secondDictionary.keySet());
        for (String pattern : keySet)
        {
            sb.append("trie.addKeyword(\"" + pattern + "\");\n");
        }
        IOUtil.saveTxt("data/dictionary/organization/code.txt", sb.toString());
    }

    public void testRemoveP() throws Exception
    {
        DictionaryMaker maker = DictionaryMaker.load(HanLP.Config.OrganizationDictionaryPath);
        for (Map.Entry<String, Item> entry : maker.entrySet())
        {
            String word = entry.getKey();
            Item item = entry.getValue();
            CoreDictionary.Attribute attribute = LexiconUtility.getAttribute(word);
            if (attribute == null) continue;
            if (item.containsLabel("P") && attribute.hasNatureStartsWith("u"))
            {
                System.out.println(item + "\t" + attribute);
                item.removeLabel("P");
            }
        }
        maker.saveTxtTo(HanLP.Config.OrganizationDictionaryPath);
    }
}


text:
%% MATLAB Publish Utilities
% This file when published in MATLAB will illustrate new dynamic elements
% for HTML. Please note this only applies for HTML publishing.
% Copyright 2014 The MathWorks, Inc.Gareth Thomas
%

%% LineChart
%

mycountry = {'Portugal';'Germany';'Spain';'China'};
values = [12;122;1231;1213];
mytable1 = table(mycountry,values);

myChartOptions.isStacked = 'false';
disp(makeLineChart(mytable1,myChartOptions));


text:
export LC_ALL="C"

cd ./NFMasterServer
chmod -R 777  NFPluginLoader_d
./NFPluginLoader_d -d
cd ../

cd ./NFWorldServer
chmod -R 777  NFPluginLoader_d
./NFPluginLoader_d -d
cd ../

cd ./NFLoginServer
chmod -R 777  NFPluginLoader_d
./NFPluginLoader_d -d
cd ../

cd ./NFGameServer1
chmod -R 777  NFPluginLoader_d
./NFPluginLoader_d -d
cd ../

cd ./NFProxyServer1
chmod -R 777  NFPluginLoader_d
./NFPluginLoader_d -d
cd ../

ps -A|grep NF


text:
from doajtest.helpers import DoajTestCase
from portality.bll import DOAJ
from portality import models
from doajtest.mocks.events_Consumer import MockConsumer
from portality.bll.services.events import EventsService
from io import StringIO
import logging

class TestBLLEvents(DoajTestCase):

    def setUp(self):
        super(TestBLLEvents, self).setUp()

        self.event_consumers = EventsService.EVENT_CONSUMERS
        EventsService.EVENT_CONSUMERS = [MockConsumer]
        MockConsumer.reset()

        self.svc = DOAJ.eventsService()

        # Register a new log handler so we can inspect the info logs
        self.info_stream = StringIO()
        self.read_info = logging.StreamHandler(self.info_stream)
        self.read_info.setLevel(logging.INFO)
        self.app_test.logger.addHandler(self.read_info)

    def tearDown(self):
        super(TestBLLEvents, self).tearDown()

        EventsService.EVENT_CONSUMERS = self.event_consumers
        MockConsumer.reset()

        # Blank the info_stream and remove the error handler from the app
        self.info_stream.truncate(0)
        self.app_test.logger.removeHandler(self.read_info)

    def test_01_consumed(self):
        self.svc.trigger(models.Event("test:event", "testuser"))

        assert len(MockConsumer.CONSUMED) == 1
        assert MockConsumer.CONSUMED[0].id == "test:event"

        assert len(MockConsumer.CONSUMES) == 1
        assert MockConsumer.CONSUMES[0].id == "test:event"

    def test_02_not_consumed(self):
        MockConsumer.CONSUME_RESULT = False

        self.svc.trigger(models.Event("test:event", "testuser"))

        assert len(MockConsumer.CONSUMED) == 0

        assert len(MockConsumer.CONSUMES) == 1
        assert MockConsumer.CONSUMES[0].id == "test:event"

    def test_03_consume_fail(self):
        MockConsumer.CONSUME_ERROR = "CONSUME ERROR"

        self.svc.trigger(models.Event("test:event", "testuser"))

        assert len(MockConsumer.CONSUMED) == 1
        assert MockConsumer.CONSUMED[0].id == "test:event"

        assert len(MockConsumer.CONSUMES) == 1
        assert MockConsumer.CONSUMES[0].id == "test:event"

        # Use the captured info stream to get email send logs
        info_stream_contents = self.info_stream.getvalue()
        assert "CONSUME ERROR" in info_stream_contents


text:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="horizontal">

    <LinearLayout
        android:orientation="vertical"
        android:layout_width="0dp"
        android:layout_weight="1"
        android:layout_height="match_parent">

        <TextView
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:text="@string/title_drinks"
            android:textAllCaps="true"
            android:textSize="18sp"
            android:gravity="center"
            android:background="#33b5e5"
            android:paddingBottom="4dp"
            android:paddingTop="4dp"
            android:textColor="#fff"
            android:layout_gravity="center_vertical" />

        <FrameLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:id="@+id/drinks_list_container" />
    </LinearLayout>

    <LinearLayout
        android:orientation="vertical"
        android:layout_width="0dp"
        android:layout_weight="1"
        android:layout_height="match_parent">

        <TextView
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:text="@string/title_liquors"
            android:textAllCaps="true"
            android:textSize="18sp"
            android:gravity="center"
            android:background="#33b5e5"
            android:paddingBottom="4dp"
            android:paddingTop="4dp"
            android:textColor="#fff"
            android:layout_gravity="center_vertical" />

        <FrameLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:id="@+id/liquors_list_container" />
    </LinearLayout>

</LinearLayout>


text:
local dpdk		= require "dpdk"
local memory	= require "memory"
local device	= require "device"
local stats		= require "stats"
local timer		= require "timer"

memory.enableCache()

-- TODO: this
function master(port1, port2)
	if not port1 or not port2 then
		return print("Usage: port1 port2")
	end
	local dev2 = device.config(port1)
	local dev1 = device.config(port2)
	device.waitForLinks()
	for size = 60, 1518 do
		print("Running test for packet size = " .. size)
		local task = dpdk.launchLua("loadSlave", dev1:getTxQueue(0), dev2:getTxQueue(0), size)
		local avg = task:wait()
		if not dpdk.running() then
			break
		end
	end
	dpdk.waitForSlaves()
end

function loadSlave(queue1, queue2, size)
	local mem = memory.createMemPool(function(buf)
		buf:getEthernetPacket():fill{
			pktLength = size,
			ethSrc = queue,
			ethDst = "10:11:12:13:14:15",
		}
	end)
	bufs = mem:bufArray()
	local ctr1 = stats:newDevTxCounter(queue1.dev, "plain")
	local ctr2 = stats:newDevTxCounter(queue2.dev, "plain")
	local runtime = timer:new(10)
	while runtime:running() and dpdk.running() do
		bufs:alloc(size)
		queue1:send(bufs)
		ctr1:update()
		bufs:alloc(size)
		queue2:send(bufs)
		ctr2:update()
	end
	ctr1:finalize()
	ctr2:finalize()
	return nil -- TODO
end


text:
package org.apache.nifi.atlas;

import org.apache.atlas.model.typedef.AtlasEntityDef;
import org.apache.atlas.model.typedef.AtlasStructDef.AtlasAttributeDef;
import org.apache.atlas.model.typedef.AtlasStructDef.AtlasConstraintDef;

import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;

public class NiFiTypes {

    public static final String TYPE_ASSET = "Asset";
    public static final String TYPE_REFERENCEABLE = "Referenceable";
    public static final String TYPE_PROCESS = "Process";
    public static final String TYPE_DATASET = "DataSet";
    public static final String TYPE_NIFI_COMPONENT = "nifi_component";
    public static final String TYPE_NIFI_FLOW = "nifi_flow";
    public static final String TYPE_NIFI_FLOW_PATH = "nifi_flow_path";
    public static final String TYPE_NIFI_DATA = "nifi_data";
    public static final String TYPE_NIFI_QUEUE = "nifi_queue";
    public static final String TYPE_NIFI_INPUT_PORT = "nifi_input_port";
    public static final String TYPE_NIFI_OUTPUT_PORT = "nifi_output_port";

    public static final String ATTR_GUID = "guid";
    public static final String ATTR_TYPENAME = "typeName";
    public static final String ATTR_NAME = "name";
    public static final String ATTR_CLUSTER_NAME = "clusterName";
    public static final String ATTR_DESCRIPTION = "description";
    public static final String ATTR_INPUTS = "inputs";
    public static final String ATTR_OUTPUTS = "outputs";
    public static final String ATTR_URL = "url";
    public static final String ATTR_URI = "uri";
    public static final String ATTR_PATH = "path";
    public static final String ATTR_QUALIFIED_NAME = "qualifiedName";
    public static final String ATTR_NIFI_FLOW = "nifiFlow";
    public static final String ATTR_FLOW_PATHS = "flowPaths";
    public static final String ATTR_QUEUES = "queues";
    public static final String ATTR_INPUT_PORTS = "inputPorts";
    public static final String ATTR_OUTPUT_PORTS = "outputPorts";

    @FunctionalInterface
    interface EntityDefinition {
        void define(AtlasEntityDef entity, Set<String> superTypes, List<AtlasAttributeDef> attributes);
    }

    private static String arrayOf(String typeName) {
        return "array<" + typeName + ">";
    }

    private static EntityDefinition NIFI_FLOW = (entity, superTypes, attributes) -> {
        entity.setVersion(1L);
        superTypes.add(TYPE_REFERENCEABLE);
        superTypes.add(TYPE_ASSET);

        final AtlasAttributeDef url = new AtlasAttributeDef(ATTR_URL, "string");

        final AtlasAttributeDef flowPaths = new AtlasAttributeDef(ATTR_FLOW_PATHS, arrayOf(TYPE_NIFI_FLOW_PATH));
        flowPaths.setIsOptional(true);
        // Set ownedRef so that child flowPaths entities those no longer exist can be deleted when a NiFi is updated.
        final AtlasConstraintDef ownedRef = new AtlasConstraintDef("ownedRef");
        flowPaths.addConstraint(ownedRef);

        final AtlasAttributeDef queues = new AtlasAttributeDef(ATTR_QUEUES, arrayOf(TYPE_NIFI_QUEUE));
        queues.setIsOptional(true);
        queues.addConstraint(ownedRef);

        final AtlasAttributeDef inputPorts = new AtlasAttributeDef(ATTR_INPUT_PORTS, arrayOf(TYPE_NIFI_INPUT_PORT));
        inputPorts.setIsOptional(true);
        inputPorts.addConstraint(ownedRef);

        final AtlasAttributeDef outputPorts = new AtlasAttributeDef(ATTR_OUTPUT_PORTS, arrayOf(TYPE_NIFI_OUTPUT_PORT));
        outputPorts.setIsOptional(true);
        outputPorts.addConstraint(ownedRef);

        attributes.add(url);
        attributes.add(flowPaths);
        attributes.add(queues);
        attributes.add(inputPorts);
        attributes.add(outputPorts);
    };

    private static EntityDefinition NIFI_COMPONENT = (entity, superTypes, attributes) -> {
        entity.setVersion(1L);

        final AtlasAttributeDef nifiFlow = new AtlasAttributeDef(ATTR_NIFI_FLOW, TYPE_NIFI_FLOW);
        nifiFlow.setIsOptional(true);

        attributes.add(nifiFlow);
    };

    private static EntityDefinition NIFI_FLOW_PATH = (entity, superTypes, attributes) -> {
        entity.setVersion(1L);
        superTypes.add(TYPE_PROCESS);
        superTypes.add(TYPE_NIFI_COMPONENT);

        final AtlasAttributeDef url = new AtlasAttributeDef(ATTR_URL, "string");

        attributes.add(url);
    };

    private static EntityDefinition NIFI_DATA = (entity, superTypes, attributes) -> {
        entity.setVersion(1L);
        superTypes.add(TYPE_DATASET);
        superTypes.add(TYPE_NIFI_COMPONENT);
    };

    private static EntityDefinition NIFI_QUEUE = (entity, superTypes, attributes) -> {
        entity.setVersion(1L);
        superTypes.add(TYPE_DATASET);
        superTypes.add(TYPE_NIFI_COMPONENT);
    };

    private static EntityDefinition NIFI_INPUT_PORT = (entity, superTypes, attributes) -> {
        entity.setVersion(1L);
        superTypes.add(TYPE_DATASET);
        superTypes.add(TYPE_NIFI_COMPONENT);
    };

    private static EntityDefinition NIFI_OUTPUT_PORT = (entity, superTypes, attributes) -> {
        entity.setVersion(1L);
        superTypes.add(TYPE_DATASET);
        superTypes.add(TYPE_NIFI_COMPONENT);
    };

    static Map<String, EntityDefinition> ENTITIES = new HashMap<>();
    static {
        ENTITIES.put(TYPE_NIFI_COMPONENT, NIFI_COMPONENT);
        ENTITIES.put(TYPE_NIFI_DATA, NIFI_DATA);
        ENTITIES.put(TYPE_NIFI_QUEUE, NIFI_QUEUE);
        ENTITIES.put(TYPE_NIFI_INPUT_PORT, NIFI_INPUT_PORT);
        ENTITIES.put(TYPE_NIFI_OUTPUT_PORT, NIFI_OUTPUT_PORT);
        ENTITIES.put(TYPE_NIFI_FLOW_PATH, NIFI_FLOW_PATH);
        ENTITIES.put(TYPE_NIFI_FLOW, NIFI_FLOW);
    }

    static final String[] NIFI_TYPES = ENTITIES.keySet().toArray(new String[ENTITIES.size()]);

}


text:
package io.druid.indexing.common.actions;

import com.fasterxml.jackson.core.type.TypeReference;
import io.druid.indexing.common.TaskLock;
import io.druid.indexing.common.task.Task;

import java.util.List;

public class LockListAction implements TaskAction<List<TaskLock>>
{
  public TypeReference<List<TaskLock>> getReturnTypeReference()
  {
    return new TypeReference<List<TaskLock>>() {};
  }

  @Override
  public List<TaskLock> perform(Task task, TaskActionToolbox toolbox)
  {
    return toolbox.getTaskLockbox().findLocksForTask(task);
  }

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

  @Override
  public String toString()
  {
    return "LockListAction{}";
  }
}


text:
/**
* @file WorldConf_Spines_test.cpp
* @brief Contains a test of the data presented at 6WCSCM
* $Id$
*/

// This application
#include "examples/learningSpines/TetrahedralComplex/FlemonsSpineModelLearning.h"
#include "examples/learningSpines/BaseSpineCPGControl.h"
#include "examples/learningSpines/KinematicSpineCPGControl.h"
// This library
#include "core/tgModel.h"
#include "core/tgSimView.h"
#include "core/tgSimViewGraphics.h"
#include "core/tgSimulation.h"
#include "core/tgWorld.h"
#include "helpers/FileHelpers.h"
// The C++ Standard Library
#include <iostream>
#include <fstream>
// Google Test
#include "gtest/gtest.h"

using namespace std;

namespace {

	// The fixture for testing class FileHelpers.
	class SpinesTest : public ::testing::Test {
		protected:
			// You can remove any or all of the following functions if its body
			// is empty.

			SpinesTest() {

			}

			virtual ~SpinesTest() {
				// You can do clean-up work that doesn't throw exceptions here.
			}

			// If the constructor and destructor are not enough for setting up
			// and cleaning up each test, you can define the following methods:
			virtual void SetUp() {
				// Code here will be called immediately after the constructor (right
				// before each test).
			}

			virtual void TearDown() {
				// Code here will be called immediately after each test (right
				// before the destructor).
			}

			// Objects declared here can be used by all tests in the test case for FileHelpers.
	};

	TEST_F(SpinesTest, WorldConf_Spines) {
				std::string filePath = FileHelpers::getResourcePath("learningSpines/TetrahedralComplex/logs/scores.csv");

				// Clear the file before we start
				ofstream clearResults;
				clearResults.open(filePath.c_str(), ios::trunc);

				clearResults.close();

						// First create the world
				const tgWorld::Config config(981); // gravity, cm/sec^2
				tgWorld world(config);

				// Second create the view
				const double stepSize = 1.0/1000.0; // Seconds
				const double renderRate = 1.0/60.0; // Seconds
				tgSimView view(world, stepSize, renderRate);

				// Third create the simulation
				tgSimulation simulation(view);

				// Fourth create the models with their controllers and add the models to the
				// simulation
				const int segments = 12;
				FlemonsSpineModelLearning* myModel =
				  new FlemonsSpineModelLearning(segments);

				/* Required for setting up learning file input/output. */
				const std::string suffix("default");

				const int segmentSpan = 3;
				const int numMuscles = 8;
				const int numParams = 2;
				const int segNumber = 6; // For learning results
				const double controlTime = .01;
				const double lowPhase = -1 * M_PI;
				const double highPhase = M_PI;
				const double lowAmplitude = -30.0;
				const double highAmplitude = 30.0;
				const double kt = 0.0;
				const double kp = 1000.0;
				const double kv = 210.0;
				const bool def = true;

				// Overridden by def being true
				const double cl = 10.0;
				const double lf = -30.0;
				const double hf = 30.0;

				BaseSpineCPGControl::Config control_config(segmentSpan,
															numMuscles,
															numMuscles,
															numParams,
															segNumber,
															controlTime,
															lowAmplitude,
															highAmplitude,
															lowPhase,
															highPhase,
															kt,
															kp,
															kv,
															def,
															cl,
															lf,
															hf
															);

				KinematicSpineCPGControl* const myControl =
				  new KinematicSpineCPGControl(control_config, suffix, "learningSpines/TetrahedralComplex/");
				myModel->attach(myControl);

				simulation.addModel(myModel);

				simulation.run(15000);
				simulation.reset();

				double dist = FileHelpers::getFinalScore(filePath);

				EXPECT_EQ(dist, 215.278);

				// Will print out another set of dist moved on teardown
	}

} // namespace

int main(int argc, char **argv) {
	::testing::InitGoogleTest(&argc, argv);
	return RUN_ALL_TESTS();
}


text:
package piotrsliwa.blackbocs.execution;

import java.io.IOException;
import java.io.InputStream;
import org.junit.Test;
import static org.junit.Assert.*;
import static org.mockito.Mockito.*;

public class CustomCommandExecTest {

    private final static String DUMMY_COMMAND = "dummyCommand";

    private final Runtime runtimeMock = mock(Runtime.class);
    private final Process processMock = mock(Process.class);
    private final InputStream inputStreamMock = mock(InputStream.class);

    private final CustomCommandExec sut = new CustomCommandExec(DUMMY_COMMAND, runtimeMock);

    private void configSuccessfulCommandExecution() throws IOException {
        when(runtimeMock.exec(any(String.class))).thenReturn(processMock);
        when(processMock.getInputStream()).thenReturn(inputStreamMock);
        when(processMock.getErrorStream()).thenReturn(inputStreamMock);
        when(processMock.isAlive()).thenReturn(true);
    }

    @Test
    public void isNotRunningByDefault() {
        assertFalse(sut.isRunning());
    }

    @Test
    public void isNotFinishedByDefault() {
        assertFalse(sut.isFinished());
    }

    @Test
    public void shallNotBeRunningAndErrorOccuredShallReturnTrueWhenNullCommandProvided() {
        CustomCommandExec sut = new CustomCommandExec(null, null);
        sut.run();
        assertFalse(sut.isRunning());
        assertTrue(sut.errorOccured());
    }

    @Test
    public void shallRunCustomProcessAndBeRunningThen() throws IOException {
        configSuccessfulCommandExecution();
        sut.run();
        verify(runtimeMock).exec(DUMMY_COMMAND);
        assertFalse(sut.errorOccured());
        assertTrue(sut.isRunning());
    }

    @Test
    public void finishShallNotDoAnythingWhenExecIsNotRun() throws IOException {
        configSuccessfulCommandExecution();
        sut.finish();
        verify(processMock, never()).destroy();
        assertFalse(sut.isFinished());
    }

    @Test
    public void shallBeAbleToFinishExecProcess() throws IOException {
        configSuccessfulCommandExecution();
        sut.run();
        sut.finish();
        verify(processMock).destroy();
    }

    @Test
    public void shallBeFinishedWhenFinishedAfterRun() throws IOException {
        configSuccessfulCommandExecution();
        sut.run();
        sut.finish();
        assertTrue(sut.isFinished());
    }

    @Test
    public void shallBeNotFinishedAgainWhenRerun() throws IOException {
        configSuccessfulCommandExecution();
        sut.run();
        sut.finish();
        sut.run();
        assertFalse(sut.isFinished());
    }

    @Test
    public void errorOccuredShallReturnFalseByDefault() {
        assertFalse(sut.errorOccured());
    }

    @Test
    public void errorOccuredShallReturnTrueWhenExceptionCauchtDuringRun() throws IOException {
        when(runtimeMock.exec(DUMMY_COMMAND)).thenThrow(new IOException());
        sut.run();
        assertTrue(sut.errorOccured());
    }

}


text:
using System;
using System.Linq;
using Moq;
using NUnit.Framework;
using Sharpduino.Base;
using Sharpduino.Constants;
using Sharpduino.Exceptions;
using Sharpduino.Handlers;
using Sharpduino.Messages;
using Sharpduino.Messages.TwoWay;

namespace Sharpduino.Library.Tests.Handlers
{
    [TestFixture]
    public class AnalogMessageHandlerTest : BaseMessageHandlerTest<AnalogMessageHandler>
    {
        protected override AnalogMessageHandler CreateHandler()
        {
            return new AnalogMessageHandler(mockBroker.Object);
        }

        [Test]
        public void Successfull_Analog_Message()
        {
            var bytes = new byte[]
                            {
								// Analog Message 					 Pin
                                (byte) (handler.START_MESSAGE | 0x01),
                                0x01, //LSB bits 0-6
                                0x71, //MSB bits 0-6
                            };

            for (int index = 0; index < bytes.Length - 1; index++)
            {
                var b = bytes[index];
                Assert.IsTrue(handler.CanHandle(b));
                Assert.IsTrue(handler.Handle(b));
            }

            Assert.IsTrue(handler.CanHandle(bytes.Last()));
            Assert.IsFalse(handler.Handle(bytes.Last()));

            // Check to see if the handler has reset and can handle a new analog message
            Assert.IsTrue(handler.CanHandle(bytes[0]));

            mockBroker.Verify(
                p => p.CreateEvent(
                    It.Is<AnalogMessage>(
                    mes => mes.Pin == (bytes[0] & MessageConstants.MESSAGEPINMASK) &&
					mes.Value == BitHelper.BytesToInt(bytes[1],bytes[2]))),Times.Once());
        }

        [Test]
        public override void Ignores_All_Other_Messages()
        {
            for (byte i = 0; i < byte.MaxValue; i++)
            {
                if ((i & MessageConstants.MESSAGETYPEMASK) != handler.START_MESSAGE)
                    Assert.IsFalse(handler.CanHandle(i));
                else
                    Assert.IsTrue(handler.CanHandle(i));
            }
        }

        [Test]
        public override void Throws_Error_If_Forced_Other_Message()
        {
            for (byte i = 0; i < byte.MaxValue; i++)
            {
                if ((i & MessageConstants.MESSAGETYPEMASK) != handler.START_MESSAGE)
                    Assert.Throws<MessageHandlerException>(() => handler.Handle(i));
                else
                    Assert.DoesNotThrow(() => handler.Handle(i));
                handler = CreateHandler();
            }
        }
    }
}


text:
package com.sleepycat.je.tree;

import java.nio.ByteBuffer;
import java.util.Arrays;

import com.sleepycat.je.CacheMode;
import com.sleepycat.je.DatabaseEntry;
import com.sleepycat.je.DatabaseException;
import com.sleepycat.je.cleaner.LocalUtilizationTracker;
import com.sleepycat.je.dbi.DatabaseId;
import com.sleepycat.je.dbi.DatabaseImpl;
import com.sleepycat.je.dbi.EnvironmentImpl;
import com.sleepycat.je.dbi.INList;
import com.sleepycat.je.dbi.MemoryBudget;
import com.sleepycat.je.log.LogEntryType;
import com.sleepycat.je.log.LogException;
import com.sleepycat.je.log.LogUtils;
import com.sleepycat.je.log.Loggable;
import com.sleepycat.je.log.ReplicationContext;
import com.sleepycat.je.log.entry.DeletedDupLNLogEntry;
import com.sleepycat.je.log.entry.LNLogEntry;
import com.sleepycat.je.txn.Locker;
import com.sleepycat.je.txn.Txn;
import com.sleepycat.je.txn.WriteLockInfo;
import com.sleepycat.je.utilint.DbLsn;

/**
 * An LN represents a Leaf Node in the JE tree.
 */
public class LN extends Node implements Loggable {
    private static final String BEGIN_TAG = "<ln>";
    private static final String END_TAG = "</ln>";

    private byte[] data;

    /*
     * Flags: bit fields
     *
     * -Dirty means that the in-memory version is not present on disk.
     * -The last logged bits store the total size of the last logged entry.
     */
    private static final int DIRTY_BIT = 0x80000000;
    private static final int CLEAR_DIRTY_BIT = ~DIRTY_BIT;
    private static final int LAST_LOGGED_SIZE_MASK = 0x7FFFFFFF;
    private static final int CLEAR_LAST_LOGGED_SIZE = ~LAST_LOGGED_SIZE_MASK;
    private int flags; // not persistent

    /**
     * Create an empty LN, to be filled in from the log.
     */
    public LN() {
        this.data = null;
    }

    /**
     * Create a new LN from a byte array.
     */
    public LN(byte[] data, EnvironmentImpl envImpl, boolean replicated) {
        super(envImpl, replicated);
        if (data == null) {
            this.data = null;
        } else {
            init(data, 0, data.length);
        }
        setDirty();
    }

    /**
     * Create a new LN from a DatabaseEntry.
     */
    public LN(DatabaseEntry dbt, EnvironmentImpl envImpl, boolean replicated) {
        super(envImpl, replicated);
        byte[] data = dbt.getData();
        if (data == null) {
            this.data = null;
        } else if (dbt.getPartial()) {
            init(data,
                 dbt.getOffset(),
                 dbt.getPartialOffset() + dbt.getSize(),
                 dbt.getPartialOffset(),
                 dbt.getSize());
        } else {
            init(data, dbt.getOffset(), dbt.getSize());
        }
        setDirty();
    }

    private void init(byte[] data, int off, int len, int doff, int dlen) {
	if (len == 0) {
	    this.data = LogUtils.ZERO_LENGTH_BYTE_ARRAY;
	} else {
	    this.data = new byte[len];
	    System.arraycopy(data, off, this.data, doff, dlen);
	}
    }

    private void init(byte[] data, int off, int len) {
        init(data, off, len, 0, len);
    }

    public byte[] getData() {
        return data;
    }

    public byte[] copyData() {
        int len = data.length;
        byte[] ret = new byte[len];
        System.arraycopy(data, 0, ret, 0, len);
        return ret;
    }

    public boolean isDeleted() {
        return (data == null);
    }

    void makeDeleted() {
        data = null;
    }

    public boolean isDirty() {
        return ((flags & DIRTY_BIT) != 0);
    }

    public void setDirty() {
        flags |= DIRTY_BIT;
    }

    private void clearDirty() {
        flags &= CLEAR_DIRTY_BIT;
    }

    /*
     * If you get to an LN, this subtree isn't valid for delete. True, the LN
     * may have been deleted, but you can't be sure without taking a lock, and
     * the validate -subtree-for-delete process assumes that bin compressing
     * has happened and there are no committed, deleted LNS hanging off the
     * BIN.
     */
    boolean isValidForDelete() {
        return false;
    }

    /**
     * Returns true by default, but is overridden by MapLN to prevent eviction
     * of open databases.  This method is meant to be a fast but not guaranteed
     * check and is used during selection of BINs for LN stripping.  [#13415]
     */
    boolean isEvictableInexact() {
        return true;
    }

    /**
     * Returns true by default, but is overridden by MapLN to prevent eviction
     * of open databases.  This method is meant to be a guaranteed check and is
     * used after a BIN has been selected for LN stripping but before actually
     * stripping an LN. [#13415]
     */
    boolean isEvictable()
        throws DatabaseException {

        return true;
    }

    /**
     * A LN can never be a child in the search chain.
     */
    protected boolean isSoughtNode(long nid, CacheMode cacheMode) {
        return false;
    }

    /**
     * A LN can never be the ancestor of another node.
     */
    protected boolean canBeAncestor(boolean targetContainsDuplicates) {
        return false;
    }

    /**
     * Delete this LN's data and log the new version.
     */
    public long delete(DatabaseImpl database,
		       byte[] lnKey,
		       byte[] dupKey,
		       long oldLsn,
                       Locker locker,
                       ReplicationContext repContext)
        throws DatabaseException {

        makeDeleted();
        setDirty();

        /* Log if necessary */
        EnvironmentImpl env = database.getDbEnvironment();
        long newLsn = DbLsn.NULL_LSN;
        if (dupKey != null) {

            /*
             * If this is a deferred write database, and the LN has
             * never been logged, we don't need to log the delete either,
             * since we are currently running in non-txnal mode. This
             * will have to be adapted when we support txnal mode.
             */
            if (database.isDeferredWriteMode() &&
                oldLsn == DbLsn.NULL_LSN) {
                clearDirty();
            } else {

                /*
                 * Log as a deleted duplicate LN by passing dupKey.  Note that
                 * we log a deleted duplicate LN even in Deferred Write mode,
                 * because the data (dupKey) is set to null when it is deleted,
                 * so logging it later is not possible.
                 */
                newLsn = log(env, database, lnKey, dupKey, oldLsn, locker,
                             false,  // isProvisional
                             false, // backgroundIO
                             repContext);
            }
        } else {

            /*
             * Non duplicate LN, just log the normal way.
             */
            newLsn = optionalLog(env, database, lnKey, oldLsn,
                                 locker, repContext);
        }
        return newLsn;
    }

    /**
     * Modify the LN's data and log the new version.
     * @param repContext indicates whether this LN is part of the replication
     * stream. If this environment is a client node, repContext has the VLSN to
     * be used when logging the LN. If this environment is a master, it
     * indicates that the LN should be broadcast.
     */
    public long modify(byte[] newData,
		       DatabaseImpl database,
		       byte[] lnKey,
		       long oldLsn,
                       Locker locker,
                       ReplicationContext repContext)
        throws DatabaseException {

        data = newData;
        setDirty();

        /* Log the new LN. */
        EnvironmentImpl env = database.getDbEnvironment();
        long newLsn = optionalLog(env, database,
                                  lnKey, oldLsn, locker,
                                  repContext);
        return newLsn;
    }

    /**
     * Add yourself to the in memory list if you're a type of node that should
     * belong.
     */
    @Override
    void rebuildINList(INList inList) {
        /*
         * Don't add, LNs don't belong on the list.
         */
    }

    /**
     * No need to do anything, stop the search.
     */
    void accountForSubtreeRemoval(INList inList,
                                  LocalUtilizationTracker localTracker) {
        /* Don't remove, LNs not on this list. */
    }

    /**
     * Compute the approximate size of this node in memory for evictor
     * invocation purposes.
     */
    @Override
    public long getMemorySizeIncludedByParent() {
        int size = MemoryBudget.LN_OVERHEAD;
        if (data != null) {
            size += MemoryBudget.byteArraySize(data.length);
        }
        return size;
    }

    /**
     * Release the memory budget for any objects referenced by this
     * LN. For now, only release treeAdmin memory, because treeMemory
     * is handled in aggregate at the IN level. Over time, transition
     * all of the LN's memory budget to this, so we update the memory
     * budget counters more locally. Called when we are releasing a LN
     * for garbage collection.
     */
    public void releaseMemoryBudget() {
        // nothing to do for now, no treeAdmin memory
    }

    /*
     * Dumping
     */

    public String beginTag() {
        return BEGIN_TAG;
    }

    public String endTag() {
        return END_TAG;
    }

    @Override
    public String dumpString(int nSpaces, boolean dumpTags) {
        StringBuffer self = new StringBuffer();
        if (dumpTags) {
	    self.append(TreeUtils.indent(nSpaces));
            self.append(beginTag());
            self.append('\n');
        }

        self.append(super.dumpString(nSpaces + 2, true));
        self.append('\n');
        if (data != null) {
            self.append(TreeUtils.indent(nSpaces+2));
            self.append("<data>");
            self.append(Key.DUMP_TYPE.dumpByteArray(data));
            self.append("</data>");
            self.append('\n');
        }
        if (dumpTags) {
            self.append(TreeUtils.indent(nSpaces));
            self.append(endTag());
        }
        return self.toString();
    }

    /*
     * Logging Support
     */

    /**
     * Log this LN and clear the dirty flag. Whether it's logged as a
     * transactional entry or not depends on the type of locker.
     * @param env the environment.
     * @param dbId database id of this node. (Not stored in LN)
     * @param key key of this node. (Not stored in LN)
     * @param oldLsn is the LSN of the previous version or null.
     * @param locker owning locker.
     * @param repContext indicates whether this LN is part of the replication
     * stream. If this environment is a client node, repContext has the VLSN to
     * be used when logging the LN. If this environment is a master, it
     * indicates that the LN should be broadcast.
     */
    public long log(EnvironmentImpl env,
		    DatabaseImpl databaseImpl,
		    byte[] key,
		    long oldLsn,
		    Locker locker,
                    boolean backgroundIO,
                    ReplicationContext repContext)
        throws DatabaseException {

        return log(env, databaseImpl, key, null, /* delDupKey */
                   oldLsn, locker, backgroundIO, false, /* provisional */
                   repContext);
    }

    /**
     * Log this LN if it's not part of a deferred-write db.  Whether it's
     * logged as a transactional entry or not depends on the type of locker.
     * @param env the environment.
     * @param dbId database id of this node. (Not stored in LN)
     * @param key key of this node. (Not stored in LN)
     * @param oldLsn is the LSN of the previous version or NULL_LSN.
     * @param locker owning locker.
     * @param repContext indicates whether this LN is part of the replication
     * stream. If this environment is a client node, repContext has the VLSN to
     * be used when logging the LN. If this environment is a master, it
     * indicates that the LN should be broadcast.
     */
    public long optionalLog(EnvironmentImpl env,
                            DatabaseImpl databaseImpl,
                            byte[] key,
                            long oldLsn,
                            Locker locker,
                            ReplicationContext repContext)
        throws DatabaseException {

        if (databaseImpl.isDeferredWriteMode()) {
            return DbLsn.NULL_LSN;
        } else {
            return log(env,
                       databaseImpl,
                       key,
                 null,   // delDupKey
                 oldLsn, locker,
                 false,  // backgroundIO
                       false,  // provisional
                       repContext);
        }
    }

    /**
     * Log a provisional, non-txnal version of an LN.
     * @param env the environment.
     * @param dbId database id of this node. (Not stored in LN)
     * @param key key of this node. (Not stored in LN)
     * @param oldLsn is the LSN of the previous version or NULL_LSN.
     */
    public long optionalLogProvisional(EnvironmentImpl env,
                                       DatabaseImpl databaseImpl,
                                       byte[] key,
                                       long oldLsn,
                                       ReplicationContext repContext)
        throws DatabaseException {

        if (databaseImpl.isDeferredWriteMode()) {
            return DbLsn.NULL_LSN;
        } else {
            return log(env, databaseImpl, key,
                 null,   // delDupKey
                 oldLsn,
                 null,  // locker
                 false, // backgroundIO
                       true,   // provisional
                       repContext);
        }
    }

    /**
     * Log this LN. Clear dirty bit. Whether it's logged as a transactional
     * entry or not depends on the type of locker.
     * @param env the environment.
     * @param dbId database id of this node. (Not stored in LN)
     * @param key key of this node. (Not stored in LN)
     * @param delDupKey if non-null, the dupKey for deleting the LN.
     * @param oldLsn is the LSN of the previous version or NULL_LSN.
     * @param locker owning locker.
     */
    long log(EnvironmentImpl env,
             DatabaseImpl dbImpl,
             byte[] key,
             byte[] delDupKey,
             long oldLsn,
             Locker locker,
             boolean backgroundIO,
             boolean isProvisional,
             ReplicationContext repContext)
        throws DatabaseException {

        boolean isDelDup = (delDupKey != null);
        LogEntryType entryType;
        long logAbortLsn;
	boolean logAbortKnownDeleted;
        Txn logTxn;
        if (locker != null && locker.isTransactional()) {
            entryType = isDelDup ? LogEntryType.LOG_DEL_DUPLN_TRANSACTIONAL
                                 : getTransactionalLogType();
	    WriteLockInfo info = locker.getWriteLockInfo(getNodeId());
	    logAbortLsn = info.getAbortLsn();
	    logAbortKnownDeleted = info.getAbortKnownDeleted();
            logTxn = locker.getTxnLocker();
            assert logTxn != null;
            if (oldLsn == logAbortLsn) {
                info.setAbortInfo(dbImpl, getLastLoggedSize());
            }
        } else {
            entryType = isDelDup ? LogEntryType.LOG_DEL_DUPLN
                                 : getLogType();
            logAbortLsn = DbLsn.NULL_LSN;
	    logAbortKnownDeleted = false;
            logTxn = null;
        }

        /* Don't count abortLsn as obsolete, this is done during commit. */
        if (oldLsn == logAbortLsn) {
            oldLsn = DbLsn.NULL_LSN;
        }

        LNLogEntry logEntry = createLogEntry(entryType,
                                             dbImpl,
                                             key,
                                             delDupKey,
                                             logAbortLsn,
                                             logAbortKnownDeleted,
                                             logTxn,
                                             repContext);

        /*
         * Always log temporary DB LNs as provisional.  This prevents the
         * possibility of a LogFileNotFoundException during recovery, since
         * temporary DBs are not checkpointed.  And it speeds recovery --
         * temporary DBs are removed during recovery anyway.
         */
        if (dbImpl.isTemporary()) {
            isProvisional = true;
        }

        long lsn = DbLsn.NULL_LSN;
	try {
	    lsn = env.getLogManager().log(logEntry, isProvisional,
					  backgroundIO, oldLsn, dbImpl,
					  repContext);
	} catch (DatabaseException DE) {

	    /*
	     * If any exception happens during logging, then force this txn
	     * to onlyAbortable. [#15768]
	     */
	    locker.setOnlyAbortable();
	    throw DE;
	}
        clearDirty();
        return lsn;
    }

    /*
     * Each LN knows what kind of log entry it uses to log itself. Overridden
     * by subclasses.
     */
    LNLogEntry createLogEntry(LogEntryType entryType,
                              DatabaseImpl dbImpl,
                              byte[] key,
                              byte[] delDupKey,
                              long logAbortLsn,
                              boolean logAbortKnownDeleted,
                              Txn logTxn,
                              ReplicationContext repContext) {

        DatabaseId dbId = dbImpl.getId();
        boolean isDelDup = (delDupKey != null);
        if (isDelDup) {

            /*
             * Deleted Duplicate LNs are logged with two keys -- the one
             * that identifies the main tree (the dup key) and the one that
             * places them in the duplicate tree (really the data) since we
             * can't recreate the latter because the data field has been
             * nulled. Note that the dupKey is passed to the log manager
             * FIRST, because the dup key is the one that navigates us in
             * the main tree. The "key" is the one that navigates us in the
             * duplicate tree.
             */
            return new DeletedDupLNLogEntry(entryType,
                                            this,
                                            dbId,
                                            delDupKey,
                                            key,
                                            logAbortLsn,
                                            logAbortKnownDeleted,
                                            logTxn);
        } else {
            /* Not a deleted duplicate LN -- use a regular LNLogEntry. */
            return new LNLogEntry(entryType,
                                  this,
                                  dbId,
                                  key,
                                  logAbortLsn,
                                  logAbortKnownDeleted,
                                  logTxn);
        }
    }

    /**
     * Log type for transactional entries
     */
    protected LogEntryType getTransactionalLogType() {
        return LogEntryType.LOG_LN_TRANSACTIONAL;
    }

    /**
     * @see Node#getLogType()
     */
    public LogEntryType getLogType() {
        return LogEntryType.LOG_LN;
    }

    /**
     * Returns the total last logged log size, including the LNLogEntry
     * overhead of this LN when it was last logged and the log entry
     * header.  Used for computing obsolete size when an LNLogEntry is not in
     * hand.
     */
    public int getLastLoggedSize() {
        return flags & LAST_LOGGED_SIZE_MASK;
    }

    /**
     * Saves the last logged size.
     */
    public void setLastLoggedSize(int size) {
        /* Clear the old size and OR in the new size. */
        flags = (flags & CLEAR_LAST_LOGGED_SIZE) | size;
    }

    /**
     * @see Loggable#getLogSize
     */
    @Override
    public int getLogSize() {
        int size = super.getLogSize();

        if (isDeleted()) {
            size += LogUtils.getPackedIntLogSize(-1);
        } else {
            int len = data.length;
            size += LogUtils.getPackedIntLogSize(len);
            size += len;
        }

        return size;
    }

    /**
     * @see Loggable#writeToLog
     */
    @Override
    public void writeToLog(ByteBuffer logBuffer) {
        super.writeToLog(logBuffer);

        if (isDeleted()) {
            LogUtils.writePackedInt(logBuffer, -1);
        } else {
            LogUtils.writePackedInt(logBuffer, data.length);
            LogUtils.writeBytesNoLength(logBuffer, data);
        }
    }

    /**
     * @see Loggable#readFromLog
     */
    @Override
    public void readFromLog(ByteBuffer itemBuffer, byte entryVersion)
        throws LogException {

        super.readFromLog(itemBuffer, entryVersion);

        if (entryVersion < 6) {
            boolean dataExists = LogUtils.readBoolean(itemBuffer);
            if (dataExists) {
                data = LogUtils.readByteArray(itemBuffer, true/*unpacked*/);
            }
        } else {
            int size = LogUtils.readInt(itemBuffer, false/*unpacked*/);
            if (size >= 0) {
                data = LogUtils.readBytesNoLength(itemBuffer, size);
            }
        }
    }

    /**
     * @see Loggable#logicalEquals
     */
    public boolean logicalEquals(Loggable other) {

        if (!(other instanceof LN))
            return false;

        LN otherLN = (LN) other;

        if (getNodeId() != otherLN.getNodeId())
            return false;

        if (!Arrays.equals(getData(), otherLN.getData()))
            return false;

        return true;
    }

    /**
     * @see Loggable#dumpLog
     */
    @Override
    public void dumpLog(StringBuffer sb, boolean verbose) {
        sb.append(beginTag());
        super.dumpLog(sb, verbose);

        if (data != null) {
            sb.append("<data>");
            if (verbose) {
                sb.append(Key.DUMP_TYPE.dumpByteArray(data));
            } else {
                sb.append("hidden");
            }
            sb.append("</data>");
        }

        dumpLogAdditional(sb, verbose);

        sb.append(endTag());
    }

    /*
     * Allows subclasses to add additional fields before the end tag.
     */
    protected void dumpLogAdditional(StringBuffer sb, boolean verbose) {
    }
}


text:
using Chutzpah.Models;
using System.Collections.Generic;
using System.Text.RegularExpressions;
using Chutzpah.FileProcessors;

namespace Chutzpah.FrameworkDefinitions
{

    /// <summary>
    /// Definition that describes the Jasmine framework.
    /// </summary>
    public class JasmineDefinition : BaseFrameworkDefinition
    {
        private IEnumerable<IJasmineReferencedFileProcessor> fileProcessors;
        private IDictionary<string, IEnumerable<string>> fileDependencies = new Dictionary<string, IEnumerable<string>>();
        private IDictionary<string, string> testHarness = new Dictionary<string, string>();
        private IDictionary<string, string> testRunner = new Dictionary<string, string>();

        /// <summary>
        /// Initializes a new instance of the JasmineDefinition class.
        /// </summary>
        public JasmineDefinition(IEnumerable<IJasmineReferencedFileProcessor> fileProcessors)
        {
            this.fileProcessors = fileProcessors;
            fileDependencies["1"] = new[]
                {
                    "chutzpah_boot.js",
                    @"jasmine\v1\jasmine.css",
                    @"jasmine\v1\jasmine.js",
                    @"jasmine\v1\jasmine-html.js",
                    @"jasmine\v1\jasmine_favicon.png",
                    @"jasmine\v1\jasmine-ddescribe-iit.js"
                };

            fileDependencies["2"] = new[]
                {
                    "chutzpah_boot.js",
                    @"jasmine\v2\jasmine.css",
                    @"jasmine\v2\jasmine.js",
                    @"jasmine\v2\jasmine-html.js",
                    @"jasmine\v2\boot.js",
                    @"jasmine\v2\jasmine_favicon.png"
                };

            testHarness["1"] = @"jasmine\v1\jasmine.html";
            testHarness["2"] = @"jasmine\v2\jasmine.html";

            testRunner["1"] = @"JSRunners\jasmineRunnerV1.js";
            testRunner["2"] = @"JSRunners\jasmineRunnerV2.js";
        }

        /// <summary>
        /// Gets a list of file dependencies to bundle with the Jasmine test harness.
        /// </summary>
        /// <param name="chutzpahTestSettings"></param>
        public override IEnumerable<string> GetFileDependencies(ChutzpahTestSettingsFile chutzpahTestSettings)
        {
            return fileDependencies[GetVersion(chutzpahTestSettings)];
        }

        public override string GetTestHarness(ChutzpahTestSettingsFile chutzpahTestSettings)
        {
            return testHarness[GetVersion(chutzpahTestSettings)];
        }

        public override string GetTestRunner(ChutzpahTestSettingsFile chutzpahTestSettings)
        {
            return testRunner[GetVersion(chutzpahTestSettings)];
        }

        public override string GetBlanketScriptName(ChutzpahTestSettingsFile chutzpahTestSettings)
        {
            var version = GetVersion(chutzpahTestSettings);
            return "blanket_jasmine_v" + version + ".js";
        }

        /// <summary>
        /// Gets a short, file system friendly key for the Jasmine library.
        /// </summary>
        public override string FrameworkKey
        {
            get
            {
                return "jasmine";
            }
        }

        /// <summary>
        /// Gets a regular expression pattern to match a testable Jasmine file in a JavaScript file.
        /// </summary>
        protected override Regex FrameworkSignatureJavaScript
        {
            get
            {
                return RegexPatterns.JasmineTestRegexJavaScript;
            }
        }

        /// <summary>
        /// Gets a regular expression pattern to match a testable Jasmine file in a CoffeeScript file.
        /// </summary>
        protected override Regex FrameworkSignatureCoffeeScript
        {
            get
            {
                return RegexPatterns.JasmineTestRegexCoffeeScript;
            }
        }

        /// <summary>
        /// Gets a list of file processors to call within the Process method.
        /// </summary>
        protected override IEnumerable<IReferencedFileProcessor> FileProcessors
        {
            get
            {
                return this.fileProcessors;
            }
        }

        private string GetVersion(ChutzpahTestSettingsFile testSettingsFile)
        {
            if (!string.IsNullOrEmpty(testSettingsFile.FrameworkVersion)
                && (testSettingsFile.FrameworkVersion == "1" || testSettingsFile.FrameworkVersion.StartsWith("1.")))
            {
                return "1";
            }

            return "2";
        }
    }
}


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Simpl.Serialization.Attributes;
using Simpl.Serialization;

namespace Simpl.Tutorials
{
    public class Book
    {
        [SimplScalar]
        String title;

        [SimplScalar]
        String authorName;

        [SimplScalar]
        [SimplTag("book_number")]
        int bookID;
        //We're going to map bookID to "book_number"
        //These sorts of mappings can be handy, especially for handling old/pre-existing data schemas.
        // [simpl_other_tags()] is also a great tool for this

        public Book()
        {
            /* If we had a field like:
             * [simple_collection] private List<int>() myList;
             *  We would initialize it here like so: */
            // myList = new ArrayList<Integer>();
            // To select our default implementation behind the interface.
            // In this case, we don't have to initialize anything

        }
        public void setAuthorName(String newName)
        {
            authorName = newName;
        }

        public void setTitle(String newTitle)
        {
            title = newTitle;
        }

        public void setBookID(int newID)
        {
            bookID = newID;
        }

        public void initBook()
        {
            this.setAuthorName("Michael Feathers");
            this.setBookID(1337);
            this.setTitle("Working Effectively with Legacy Code");
        }

        public String getTitle()
        {
            return title;
        }
        public String getAuthor()
        {
            return authorName;
        }
        public int getBookID()
        {
            return bookID;
        }
    }
}


text:
var __extends = (this && this.__extends) || function (d, b) {
    for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
    function __() { this.constructor = d; }
    d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
import { DomAdapter } from '../dom/dom_adapter';
import { StringMapWrapper } from '../facade/collection';
import { isFunction, isPresent } from '../facade/lang';
/**
 * Provides DOM operations in any browser environment.
 *
 * @security Tread carefully! Interacting with the DOM directly is dangerous and
 * can introduce XSS risks.
 */
export var GenericBrowserDomAdapter = (function (_super) {
    __extends(GenericBrowserDomAdapter, _super);
    function GenericBrowserDomAdapter() {
        var _this = this;
        _super.call(this);
        this._animationPrefix = null;
        this._transitionEnd = null;
        try {
            var element = this.createElement('div', this.defaultDoc());
            if (isPresent(this.getStyle(element, 'animationName'))) {
                this._animationPrefix = '';
            }
            else {
                var domPrefixes = ['Webkit', 'Moz', 'O', 'ms'];
                for (var i = 0; i < domPrefixes.length; i++) {
                    if (isPresent(this.getStyle(element, domPrefixes[i] + 'AnimationName'))) {
                        this._animationPrefix = '-' + domPrefixes[i].toLowerCase() + '-';
                        break;
                    }
                }
            }
            var transEndEventNames = {
                WebkitTransition: 'webkitTransitionEnd',
                MozTransition: 'transitionend',
                OTransition: 'oTransitionEnd otransitionend',
                transition: 'transitionend'
            };
            StringMapWrapper.forEach(transEndEventNames, function (value, key) {
                if (isPresent(_this.getStyle(element, key))) {
                    _this._transitionEnd = value;
                }
            });
        }
        catch (e) {
            this._animationPrefix = null;
            this._transitionEnd = null;
        }
    }
    GenericBrowserDomAdapter.prototype.getDistributedNodes = function (el) { return el.getDistributedNodes(); };
    GenericBrowserDomAdapter.prototype.resolveAndSetHref = function (el, baseUrl, href) {
        el.href = href == null ? baseUrl : baseUrl + '/../' + href;
    };
    GenericBrowserDomAdapter.prototype.supportsDOMEvents = function () { return true; };
    GenericBrowserDomAdapter.prototype.supportsNativeShadowDOM = function () {
        return isFunction(this.defaultDoc().body.createShadowRoot);
    };
    GenericBrowserDomAdapter.prototype.getAnimationPrefix = function () {
        return isPresent(this._animationPrefix) ? this._animationPrefix : '';
    };
    GenericBrowserDomAdapter.prototype.getTransitionEnd = function () { return isPresent(this._transitionEnd) ? this._transitionEnd : ''; };
    GenericBrowserDomAdapter.prototype.supportsAnimation = function () {
        return isPresent(this._animationPrefix) && isPresent(this._transitionEnd);
    };
    return GenericBrowserDomAdapter;
}(DomAdapter));
//# sourceMappingURL=generic_browser_adapter.js.map


text:
package cz.muni.fi.pv243.mustech.service;

import cz.muni.fi.pv243.mustech.dal.UserRepository;
import cz.muni.fi.pv243.mustech.model.User;

import javax.inject.Named;
import javax.persistence.NoResultException;
import javax.transaction.Transactional;

/**
 * User service implementing and initializing generic service
 * @author Milan
 */
@Named
@Transactional
public class UserService extends AbstractGenericService<User, UserRepository> {

    public User findByEmail(String email) {
        if(email == null)
        {
            throw new IllegalArgumentException("email cannot be null");
        }

        try
        {
            return repository.findByEmail(email);
        } catch (NoResultException e)
        {
            return null;
        }
    }

    @Override
    public boolean canAccess(String principalName, User entity) {
        return principalName.equals(entity.getEmail());
    }
}


text:
 #import <Foundation/Foundation.h>

@protocol FBSDKModelManagerDelegate;

NS_ASSUME_NONNULL_BEGIN

NS_SWIFT_NAME(SuggestedEventsIndexer)
@interface FBSDKSuggestedEventsIndexer : NSObject

@property (class, nonatomic, strong, readonly) FBSDKSuggestedEventsIndexer *shared;

- (void)enable;

@end

NS_ASSUME_NONNULL_END

#endif


text:
import Text.ParserCombinators.Parsec

{- A CSV file contains 0 or more lines, each of which is terminated
   by the end-of-line character (eol). -}
csvFile :: GenParser Char st [[String]]
csvFile =
    do result <- many line
       eof
       return result

-- Each line contains 1 or more cells, separated by a comma
line :: GenParser Char st [String]
line =
    commentChar <|>
    do result <- cells
       eol                       -- end of line
       return result

commentChar :: GenParser Char st [String]
commentChar =
    do
      _ <- char '#'
      _ <- many (noneOf "\n")
      return []

-- Build up a list of cells.  Try to parse the first cell, then figure out
-- what ends the cell.
cells :: GenParser Char st [String]
cells =
    do first <- cellContent
       next <- remainingCells
       return (first : next)

-- The cell either ends with a comma, indicating that 1 or more cells follow,
-- or it doesn't, indicating that we're at the end of the cells for this line
remainingCells :: GenParser Char st [String]
remainingCells =
    (char ',' >> cells)            -- Found comma?  More cells coming
    <|> return []                -- No comma?  Return [], no more cells

-- Each cell contains 0 or more characters, which must not be a comma or
-- EOL
cellContent :: GenParser Char st String
cellContent =
    many (noneOf ",\n")

-- The end of line character is \n
eol :: GenParser Char st Char
eol = char '\n'

parseCSV :: String -> Either ParseError [[String]]
parseCSV = parse csvFile "(unknown)"
-- parseCSV input = parse csvFile "(unknown)" input

main :: IO ()
main = do
  x <- getContents
  case parseCSV x of
    Left e -> print e
    Right r -> mapM_ print r


text:
package version

import (
	"fmt"

	semver "github.com/cppforlife/go-semi-semantic/version"
)

func GetSemver(versionStr string) (major int, minor int, patch int, err error) {
	version, err := semver.NewVersionFromString(versionStr)
	if err != nil {
		return
	}

	if len(version.Release.Components) == 3 {
		major = version.Release.Components[0].(semver.VerSegCompInt).I
		minor = version.Release.Components[1].(semver.VerSegCompInt).I
		patch = version.Release.Components[2].(semver.VerSegCompInt).I
	} else {
		err = fmt.Errorf("Wrong number of components")
		return
	}

	return major, minor, patch, nil
}

func IsDev(versionStr string) bool {
	version, err := semver.NewVersionFromString(versionStr)
	if err != nil {
		return false
	}

	for _, item := range version.PreRelease.Components {
		if item.AsString() == "dev" {
			return true
		}
	}

	for _, item := range version.PostRelease.Components {
		if item.AsString() == "dev" {
			return true
		}
	}
	return false
}


text:
import { module } from 'ember-qunit';
import { resolve } from 'rsvp';
import startApp from '../helpers/start-app';
import destroyApp from '../helpers/destroy-app';

export default function(name, options = {}) {
  module(name, {
    beforeEach() {
      this.application = startApp();

      if (options.beforeEach) {
        return options.beforeEach(...arguments);
      }
    },

    afterEach() {
      let afterEach = options.afterEach && options.afterEach(...arguments);
      return resolve(afterEach).then(() => destroyApp(this.application));
    }
  });
}


text:
Vagrant plugin for displaying custom box info in vagrant self-hosted environments
via metadata. (more on Vagrant metadata file
[here](http://docs.vagrantup.com/v2/boxes/format.html)).

## Installation

Add this line to your application's Gemfile:

```
$ vagrant plugin install vagrant-boxinfo
```

## Usage

```
$ vagrant boxinfo <url or box_name>
```

## Example

Imagine you host vagrant boxes which are used for LAMP development. Different box
versions can have different versions of MySQL, PHP, etc.

Suppose you have `metadata.json` with following content on your server:

```json
{
  "name": "lampbox",
  "description": "Vagrant box for LAMP development based on Ubuntu 14.04",
  "versions": [
    {
      "version": "1.0.1",
      "php_version": "5.5.22",
      "mysql_version": "5.6.23",
      "apache_version": "2.4.12",
      "providers": [
        {
          "name": "virtualbox",
          "url": "http://myvagranthost.com/lambox-1.0.1.box",
        }
      ]
    },
    {
      "version": "1.0.0",
      "php_version": "5.5.21",
      "mysql_version": "5.6.22",
      "apache_version": "2.4.12",
      "providers": [
        {
          "name": "virtualbox",
          "url": "http://myvagranthost.com/lambox-1.0.0.box",
        }
      ]
    }
  ]
}
```

```
$ vagrant box list
lampbox    (virtualbox, 1.0.0)

$ vagrant boxinfo lambox

Reading url http://myvagranthost.com/metadata.json...
Box name: lampbox
Description: Vagrant box for LAMP development based on Ubuntu 14.04

1.0.1
    php_version: 5.5.22
    mysql_version: 5.6.23
    apache_version: 2.4.12
    downloaded: false
1.0.0
    php_version: 5.5.21
    mysql_version: 5.6.22
    apache_version: 2.4.12
    downloaded: true
```

If you currently don't have downloaded any version of *lampbox*, you have to pass
full url of `metadata.json` to *boxinfo* command.

## Contributing

1. Fork it ( https://github.com/[my-github-username]/vagrant-boxinfo/fork )
2. Create your feature branch (`git checkout -b my-new-feature`)
3. Commit your changes (`git commit -am 'Add some feature'`)
4. Push to the branch (`git push origin my-new-feature`)
5. Create a new Pull Request


text:
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

/*============================================================
**
** Source: test.c
**
** Purpose: Test for wsprintfA() function
**
**
**=========================================================*/

#include <palsuite.h>

/* memcmp is used to verify the results, so this test is dependent on it. */
/* ditto with strlen */

char * ErrorMessage;
char buf[256];

BOOL test1()
{
    int pos = 0x1234ab;

    /* Test 1 */
    wsprintf(buf, "foo %x", pos);
    if (memcmp(buf, "foo 1234ab", strlen(buf) + 1) != 0)
    {
        ErrorMessage = "ERROR: (Test 1) Failed. The correct "
            "string is 'foo 1234ab' and the result returned was ";
        return FAIL;
    }

    /* Test 2 */
    wsprintf(buf, "foo %lx", pos);
    if (memcmp(buf, "foo 1234ab", strlen(buf) + 1) != 0)
    {
        ErrorMessage = "ERROR: (Test 2) Failed. The correct "
            "string is 'foo 1234ab' and the result returned was ";
        return FAIL;
    }

    /* Test 3 */
    wsprintf(buf, "foo %7x", pos);
    if (memcmp(buf, "foo  1234ab", strlen(buf) + 1) != 0)
    {
        ErrorMessage = "ERROR: (Test 3) Failed. The correct string is "
            "'foo  1234ab' and the result returned was ";
        return FAIL;
    }

    /* Test 4 */
    wsprintf(buf, "foo %-7x", pos);
    if (memcmp(buf, "foo 1234ab ", strlen(buf) + 1) != 0)
    {
        ErrorMessage = "ERROR: (Test 4) Failed. The correct string is "
            "'foo 1234ab' and the result returned was ";
        return FAIL;
    }

    /* Test 5 */
    wsprintf(buf, "foo %.1x", pos);
    if (memcmp(buf, "foo 1234ab", strlen(buf) + 1) != 0)
    {
        ErrorMessage = "ERROR: (Test 5) Failed. The correct string is "
            "'foo 1234ab' and the result returned was ";
        return FAIL;
    }

    /* Test 6 */
    wsprintf(buf, "foo %.7x", pos);
    if (memcmp(buf, "foo 01234ab", strlen(buf) + 1) != 0)
    {
        ErrorMessage = "ERROR: (Test 6) Failed. The correct string is "
            "'foo 01234ab' and the result returned was ";
        return FAIL;
    }

    /*  Test 7 */
    wsprintf(buf, "foo %07x", pos);
    if (memcmp(buf, "foo 01234ab", strlen(buf) + 1) != 0)
    {
        ErrorMessage = "ERROR: (Test 7) Failed. The correct string is "
            "'foo 01234ab' and the result returned was ";
        return FAIL;
    }

    /* Test 8 */
    wsprintf(buf, "foo %#x", pos);
    if (memcmp(buf, "foo 0x1234ab", strlen(buf) + 1) != 0)
    {
        ErrorMessage = "ERROR: (Test 8) Failed. The correct string is "
            "'foo 0x1234ab' and the result returned was ";
        return FAIL;
    }

    return PASS;
}

int __cdecl main(int argc, char *argv[])
{

    if(0 != (PAL_Initialize(argc, argv)))
    {
       return FAIL;
    }

    if(test1())
    {
       Fail("%s '%s'\n",ErrorMessage,buf);
    }

  PAL_Terminate();
  return PASS;
}


text:
passport-google-id-token
========================

[![Build Status](https://travis-ci.org/jmreyes/passport-google-id-token.svg?branch=master)](https://travis-ci.org/jmreyes/passport-google-id-token)

Google ID token authentication strategy for [Passport](http://passportjs.org/) and [Node.js](http://nodejs.org/).

This module lets you authenticate using Google ID tokens in your Node.js applications.
This is useful for scenarios where we don't want to perform API calls to Google on behalf of the client, but we only want to authenticate it to our server. In short, we only validate the identity of the user by token verification, so there is no server-side OAuth operation.

Official Google documentation:

- [Authenticate with a backend server](https://developers.google.com/identity/sign-in/android/backend-auth)

More information about ID token use cases:

- [Client-Server Authentication with ID tokens](http://www.riskcompletefailure.com/2013/11/client-server-authentication-with-id.html)
- [Verifying Back-End Calls from Android Apps](http://android-developers.blogspot.in/2013/01/verifying-back-end-calls-from-android.html)

## Install

    $ npm install passport-google-id-token

## Usage

#### Configure Strategy

The strategy requires a `verify` callback which accepts the `idToken` coming from the user to be authenticated, and then calls the `done` callback supplying a `parsedToken` (with all its information in visible form) and the `googleId`.

The strategy also requires the Google client ID(s) inside the passed `options`.
An optional `getGoogleCerts` function can be specified to customize the way the Google certificates are retrieved, interesting e.g. in case a caching mechanism is needed. If not specified, the default mechanism will query the Google servers every time.

```js
var GoogleTokenStrategy = require('passport-google-id-token');

passport.use(new GoogleTokenStrategy({
    clientID: GOOGLE_CLIENT_ID,
    getGoogleCerts: optionalCustomGetGoogleCerts
  },
  function(parsedToken, googleId, done) {
    User.findOrCreate({ googleId: googleId }, function (err, user) {
      return done(err, user);
    });
  }
));
```

#### Authenticate Requests

Use `passport.authenticate()`, specifying the `'google-id-token'` strategy, to authenticate requests.

```js
app.post('/auth/google',
  passport.authenticate('google-id-token'),
  function (req, res) {
    // do something with req.user
    res.send(req.user? 200 : 401);
  }
);
```

The post request to this route should include a JSON object with the key `id_token` set to the one the client received from Google (e.g. after successful Google+ sign-in).

#### About JWT validation

This library leverages [node-jsonwebtoken](https://github.com/auth0/node-jsonwebtoken) for JWT token validation. An optional `jwtOptions` can be specified to customize the way this validation is performed as per [the documentation](https://github.com/auth0/node-jsonwebtoken#jwtverifytoken-secretorpublickey-options-callback).

## Credits

  - [Juanma Reyes](http://github.com/jmreyes)
  - [Mike Nicholson](http://github.com/themikenicholson)
  - [Marco Sanson](http://github.com/marcosanson)
  - [Michal Kubenka](https://github.com/mkubenka)
  - [Tom Hoag](https://github.com/tomhoag)
  - [Bence Ferdinandy](https://github.com/priestoferis)
  - [Jonas Scheffner](https://github.com/jscheffner)

## License

(The MIT License)

Copyright (c) 2014-2018 Juan Manuel Reyes

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.


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

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

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

     Unless required by applicable law or agreed to in writing, software
     distributed under the License is distributed on an "AS IS" BASIS,
     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     See the License for the specific language governing permissions and
     limitations under the License.
-->
<resources>
  <string name="exo_controls_previous_description">"Előző szám"</string>
  <string name="exo_controls_next_description">"Következő szám"</string>
  <string name="exo_controls_pause_description">"Szünet"</string>
  <string name="exo_controls_play_description">"Lejátszás"</string>
  <string name="exo_controls_stop_description">"Leállítás"</string>
  <string name="exo_controls_rewind_description">"Visszatekerés"</string>
  <string name="exo_controls_fastforward_description">"Előretekerés"</string>
  <string name="exo_controls_repeat_all_description">"Összes ismétlése"</string>
  <string name="exo_controls_repeat_off_description">"Nincs ismétlés"</string>
  <string name="exo_controls_repeat_one_description">"Egy ismétlése"</string>
  <string name="exo_controls_shuffle_description">"Véletlenszerű lejátszás"</string>
  <string name="exo_controls_fullscreen_description">Teljes képernyős mód</string>
</resources>


text:
For examples of hello-world in different programming languages see inside the BaseFunctions folder:

* [Base Functions](https://github.com/openfaas/faas/tree/master/sample-functions/BaseFunctions)

## Demo functions from closing keynote @ Dockercon

* Demo functions - [fass-dockercon](https://github.com/alexellis/faas-dockercon/)
* Video recording from Dockercon [on YouTube](https://youtu.be/-h2VTE9WnZs?t=15m52s)

## Sample functions from the FaaS stack

* [FaaS-And_Furious Community functions](https://github.com/faas-and-furious) (new)

> Also see the [community page](https://github.com/openfaas/faas/blob/master/community.md) for functions created by FaaS users and contributors.

Here is a list of some of the sample functions included this repository.

| Name                     | Details |
|--------------------------|-----------------------------------------                          |
| AlpineFunction           | BusyBox - a useful base image with busybox utilities pre-installed        |
| apikey-secret            | Example in Golang showing how to read a secret from a HTTP header and validate with a Kubernetes secret |
| CaptainsIntent           | Alexa skill - find the count of Docker Captains |
| ChangeColorIntent        | Alexa skill - change the colour of IoT-connected lights |
| CHelloWorld              | Use C to build a function |
| echo                     | Uses `cat` from BusyBox to provide an echo function |
| DockerHubStats           | Golang function gives the count of repos a user has on the Docker hub |
| figlet                   | Generate ascii logos through the use of a binary |
| gif-maker                | Use gifsicle and ffmpeg packages from Alpine Linux to make gifs from video |
| HostnameIntent           | Prints the hostname of a container |
| MarkdownRender           | Use a Go function with vendoring to convert Markdown to HTML |
| Nmap                     | The network scanning tool as a binary-based function |
| NodeInfo                 | Node.js - gives CPU/network info on the current container |
| Phantomjs                | Use Phantomjs to scrape/automate web-pages |
| ResizeImageMagick        | Resizes an image using the imagemagick binary |
| SentimentAnalysis        | Perform sentiment analysis with the TextBlob library |
| WebhookStash             | Golang function provides way to capture webhooks - JSON/text/binary into the container filesystem |
| WordCountFunction        | BusyBox `wc` is exposed as a function / service through FaaS |


text:
Luo avaimia

		<button type="submit" class="btn btn-info">Luo</button>

	<input type="text"></input>