text:
--TEST--
Check for null serialisation
--SKIPIF--
--FILE--
<?php
if(!extension_loaded('igbinary')) {
	dl('igbinary.' . PHP_SHLIB_SUFFIX);
}

function test($type, $variable) {

	echo $type, "\n";
	$serialized = igbinary_serialize($variable);

	echo substr(bin2hex($serialized), 8), "\n";

	$unserialized = igbinary_unserialize("\0\0\0\x02");
	echo $unserialized === $variable ? 'OK' : 'ERROR';
	echo "\n";
}

test('null', null);

/*
 * you can add regression tests for your extension here
 *
 * the output of your test code has to be equal to the
 * text in the --EXPECT-- section below for the tests
 * to pass, differences between the output and the
 * expected text are interpreted as failure
 *
 * see php5/README.TESTING for further information on
 * writing regression tests
 */
?>
--EXPECT--
null
00
OK


text:
package no.stelar7.api.r4j.basic.ratelimiting;

import no.stelar7.api.r4j.basic.exceptions.APIDataNotParseableException;

import java.util.stream.Stream;

public enum RateLimitType
{
    LIMIT_USER("application", "Application ratelimit reached"),
    LIMIT_SERVICE("service", "Service ratelimit reached"),
    LIMIT_METHOD("method", "Method ratelimit reached"),
    LIMIT_UNDERLYING("", "Underlying service limit reached");

    private final String value;
    private final String reason;

    RateLimitType(String value, String reason)
    {
        this.value = value;
        this.reason = reason;
    }

    public static RateLimitType getBestMatch(String data)
    {
        if (data == null)
        {
            return LIMIT_UNDERLYING;
        }
        return Stream.of(values()).filter(s -> s.getValue().equalsIgnoreCase(data)).findFirst().orElseThrow(() -> new APIDataNotParseableException(data));
    }

    public String getValue()
    {
        return value;
    }

    public String getReason()
    {
        return reason;
    }

}

redpajama_set_name: RedPajamaGithub


text:
<?php

	namespace vps\tools\helpers;

	use Yii;
	use yii\base\InvalidConfigException;
	use yii\i18n\PhpMessageSource;

	/**
	 * Class HumanHelper
	 *
	 * @package vps\tools\helpers
	 */
	class ConfigurationHelper
	{
		/**
		 * Adds i18n app configuration. If configuration with given name exists filemap is populated.
		 * ```php
		 * ConfigurationHelper::addTranslation('setting', [ 'setting' => 'setting.php' ]);
		 * // In that case if 'setting' i18n configuration exists, filemap will be merged with new one.
		 * // If not - exception will be raised since $basePath is not a directory.
		 * ```
		 *
		 * @param string      $name
		 * @param array       $fileMap
		 * @param string|null $basePath
		 *
		 * @throws \yii\base\InvalidConfigException
		 */
		public static function addTranslation ($name, $fileMap, $basePath = null)
		{
			$name .= '*';
			if (isset(Yii::$app->i18n->translations[ $name ]))
			{
				Yii::$app->i18n->translations[ $name ]->fileMap = array_merge(
					Yii::$app->i18n->translations[ $name ]->fileMap,
					$fileMap
				);
			}
			else
			{
				if (!is_dir($basePath))
					throw new InvalidConfigException("Directory does not exist: " . $basePath);

				Yii::$app->i18n->translations[ $name ] = new PhpMessageSource([
					'basePath'         => $basePath,
					'forceTranslation' => true,
					'sourceLanguage'   => 'en',
					'fileMap'          => $fileMap
				]);
			}
		}
	}


text:
import { Directive, ElementRef, Input, Renderer } from '@angular/core';
import { Config } from '../../config/config';
import { DomController } from '../../platform/dom-controller';
import { GestureController } from '../../gestures/gesture-controller';
import { Ion } from '../ion';
import { isTrueProperty } from '../../util/util';
import { ItemSlidingGesture } from '../item/item-sliding-gesture';
import { Platform } from '../../platform/platform';
/**
 * The List is a widely used interface element in almost any mobile app,
 * and can include content ranging from basic text all the way to
 * buttons, toggles, icons, and thumbnails.
 *
 * Both the list, which contains items, and the list items themselves
 * can be any HTML element.
 *
 * Using the List and Item components make it easy to support various
 * interaction modes such as swipe to edit, drag to reorder, and
 * removing items.
 *
 * @demo /docs/v2/demos/src/list/
 * @see {@link /docs/v2/components#lists List Component Docs}
 * @advanced
 *
 * Enable the sliding items.
 *
 * ```ts
 * import { Component, ViewChild } from '@angular/core';
 * import { List } from 'ionic-angular';
 *
 * @Component({...})
 * export class MyClass {
 *   @ViewChild(List) list: List;
 *
 *   constructor() { }
 *
 *   stopSliding() {
 *     this.list.enableSlidingItems(false);
 *   }
 * }
 * ```
 *
 */
export class List extends Ion {
    constructor(config, elementRef, renderer, _plt, _gestureCtrl, _domCtrl) {
        super(config, elementRef, renderer, 'list');
        this._plt = _plt;
        this._gestureCtrl = _gestureCtrl;
        this._domCtrl = _domCtrl;
        this._enableSliding = true;
        this._containsSlidingItems = false;
    }
    /**
     * @input {string} The mode determines which platform styles to use.
     * Possible values are: `"ios"`, `"md"`, or `"wp"`.
     * For more information, see [Platform Styles](/docs/v2/theming/platform-specific-styles).
     */
    set mode(val) {
        this._setMode(val);
    }
    /**
     * @input {boolean} If true, the sliding items will be enabled.
     */
    get sliding() {
        return this._enableSliding;
    }
    set sliding(val) {
        this._enableSliding = isTrueProperty(val);
        this._updateSlidingState();
    }
    /**
     * @private
     */
    containsSlidingItem(contains) {
        this._containsSlidingItems = contains;
        this._updateSlidingState();
    }
    _updateSlidingState() {
        let shouldSlide = this._enableSliding && this._containsSlidingItems;
        if (!shouldSlide) {
            this._slidingGesture && this._slidingGesture.destroy();
            this._slidingGesture = null;
        }
        else if (!this._slidingGesture) {
            (void 0) /* console.debug */;
            this._slidingGesture = new ItemSlidingGesture(this._plt, this, this._gestureCtrl, this._domCtrl);
            this._slidingGesture.listen();
        }
    }
    /**
     * Close any sliding items that are open.
     */
    closeSlidingItems() {
        this._slidingGesture && this._slidingGesture.closeOpened();
    }
    /**
     * @private
     */
    destroy() {
        this._slidingGesture && this._slidingGesture.destroy();
    }
}
List.decorators = [
    { type: Directive, args: [{
                selector: 'ion-list',
            },] },
];
/** @nocollapse */
List.ctorParameters = [
    { type: Config, },
    { type: ElementRef, },
    { type: Renderer, },
    { type: Platform, },
    { type: GestureController, },
    { type: DomController, },
];
List.propDecorators = {
    'mode': [{ type: Input },],
    'sliding': [{ type: Input },],
};
//# sourceMappingURL=list.js.map


text:
from datetime import datetime, timedelta

import pytest
from sqlalchemy import func
from sqlalchemy.future import select

from pycroft.helpers.interval import closedopen, starting_from
from pycroft.model.property import current_property, evaluate_properties
from pycroft.model.user import Group, Membership, PropertyGroup, User
from tests import factories
from tests.factories.property import MembershipFactory, PropertyGroupFactory

@pytest.fixture(scope='module')
def user(module_session):
    return factories.UserFactory()

PROP1 = 'test1'
PROP2 = 'test2'

@pytest.fixture(scope='module')
def property_group1(module_session):
    with module_session.begin_nested():
        return factories.PropertyGroupFactory(granted={PROP1})

@pytest.fixture(scope='module')
def property_group2(module_session):
    with module_session.begin_nested():
        return factories.PropertyGroupFactory(granted={PROP1, PROP2})

def test_fixtures_correct(session, user, property_group1, property_group2):
    """simply test that fixtures work
    """
    assert session.scalar(func.count(Membership.id)) == 0

    assert not user.has_property(PROP1)
    assert not user.has_property(PROP2)

    assert len(property_group1.properties) == 1
    assert len(property_group2.properties) == 2
    assert PROP1 in property_group1.properties
    assert PROP1 in property_group2.properties
    assert PROP2 in property_group2.properties

class Test_PropertyResolving:
    def test_add_membership(self, session, utcnow, user, property_group1, property_group2):
        # add membership to group1
        with session.begin_nested():
            session.add(
                Membership(
                    active_during=starting_from(utcnow),
                    user=user,
                    group=property_group1,
                )
            )
        session.refresh(user)
        assert user.has_property(PROP1)
        assert not user.has_property(PROP2)

        # add membership to group2
        with session.begin_nested():
            session.add(
                Membership(
                    active_during=starting_from(utcnow),
                    user=user,
                    group=property_group2,
                )
            )
        session.refresh(user)
        assert user.has_property(PROP1)
        assert user.has_property(PROP2)

    def test_add_timed_membership(self, session, utcnow, user, property_group1, property_group2):
        with session.begin_nested():
            session.add(Membership(
                active_during=closedopen(utcnow, utcnow + timedelta(days=3)),
                user=user,
                group=property_group1
            ))
        session.refresh(user)
        assert user.has_property(PROP1)
        assert not user.has_property(PROP2)

        with session.begin_nested():
            # add expired membership to group2
            session.add(Membership(
                active_during=closedopen(utcnow - timedelta(hours=2), utcnow - timedelta(hours=1)),
                user=user,
                group=property_group2
            ))
        session.refresh(user)
        assert user.has_property(PROP1)
        assert not user.has_property(PROP2)

    def test_disable_membership(self, session, utcnow, user, property_group1, property_group2):
        # add membership to group1
        membership = Membership(
            active_during=starting_from(utcnow - timedelta(hours=2)),
            user=user,
            group=property_group1
        )
        with session.begin_nested():
            session.add(membership)
        session.refresh(user)
        assert user.has_property(PROP1)

        with session.begin_nested():
            membership.disable(utcnow - timedelta(hours=1))
        session.refresh(user)
        assert property_group1 not in user.active_property_groups()
        assert not user.has_property(PROP1)

        with session.begin_nested():
            # add membership to group1
            session.add(
                Membership(
                    active_during=starting_from(utcnow),
                    user=user,
                    group=property_group1,
                )
            )
        session.refresh(user)
        assert user.has_property(PROP1)

        # add membership to group2
        membership = Membership(
            active_during=starting_from(utcnow - timedelta(hours=2)),
            user=user,
            group=property_group2
        )
        with session.begin_nested():
            session.add(membership)
        session.refresh(user)
        assert user.has_property(PROP1)
        assert user.has_property(PROP2)

        # disables membership in group2
        with session.begin_nested():
            membership.disable(utcnow - timedelta(hours=1))
        session.refresh(user)
        assert user.has_property(PROP1)
        assert not user.has_property(PROP2)

class Test_View_Only_Shortcut_Properties:
    def test_group_users(self, session, utcnow, user, property_group1, property_group2):
        assert len(property_group1.users) == 0
        assert len(property_group1.active_users()) == 0

        # add membership to group1
        p1 = Membership(
            active_during=starting_from(utcnow - timedelta(hours=2)),
            user=user,
            group=property_group1,
        )
        with session.begin_nested():
            session.add(p1)
        session.refresh(property_group1)
        assert len(property_group1.users) == 1
        assert len(property_group1.active_users()) == 1

        with session.begin_nested():
            p1.disable(utcnow - timedelta(hours=1))
        session.refresh(property_group1)
        assert len(property_group1.users) == 1
        assert len(property_group1.active_users()) == 0

    def test_user_property_groups(self, session, utcnow, user, property_group1, property_group2):
        # first have no property group
        assert len(user.property_groups) == 0
        assert len(user.active_property_groups()) == 0

        # add one active property group
        p1 = Membership(
            active_during=starting_from(utcnow - timedelta(hours=2)),
            user=user,
            group=property_group1,
        )
        with session.begin_nested():
            session.add(p1)
        session.refresh(user)
        f = Membership.q.first()
        assert utcnow in f.active_during
        assert len(user.property_groups) == 1
        assert len(user.active_property_groups()) == 1

        # add a second active property group - count should be 2
        p1 = Membership(
            active_during=starting_from(utcnow - timedelta(hours=2)),
            user=user,
            group=property_group2,
        )
        with session.begin_nested():
            session.add(p1)
        session.refresh(user)
        assert len(user.property_groups) == 2
        assert len(user.active_property_groups()) == 2

        # disable the second group. active should be one, all 2
        with session.begin_nested():
            p1.disable(utcnow - timedelta(hours=1))
        session.refresh(user)
        assert len(user.property_groups) == 2
        assert len(user.active_property_groups()) == 1

        # test a join
        res = session.query(
            User, PropertyGroup.id
        ).join(User.property_groups).filter(
            User.id == user.id
        ).distinct().count()
        assert res == 2

        # reenable it - but with a deadline - both counts should be 2
        with session.begin_nested():
            p1.active_during = closedopen(p1.active_during.begin,
                                          utcnow + timedelta(days=1))
        session.refresh(user)
        assert len(user.property_groups) == 2
        assert len(user.active_property_groups()) == 2

        # test a join
        res = session.query(
            User, PropertyGroup
        ).join(User.property_groups).filter(
            User.id == user.id
        ).distinct().count()
        assert res == 2

h = lambda x: timedelta(hours=x)
d = lambda x: timedelta(days=x)

class Test_Membership:
    @pytest.mark.parametrize('rel_begin, rel_end, active_expected', [
        (- h(2), None, True),
        (+ h(2), None, False),
        (- h(2), None, True),
        (+ d(2), None, False),
        (+ d(2), + d(3), False),
        (- d(1), + d(3), True),
    ])
    def test_active_instance_property(
        self,
        rel_begin, rel_end, active_expected,
        session, utcnow, user, property_group1
    ):
        interval = closedopen(utcnow + rel_begin, rel_end and utcnow + rel_end)
        mem = Membership(active_during=interval, user=user, group=property_group1)
        with session.begin_nested():
            session.add(mem)
        session.refresh(mem)
        assert (utcnow in mem.active_during) == active_expected

    def test_active_disable(self, session, utcnow, user, property_group1):
        mem = Membership(
            active_during=starting_from(utcnow - timedelta(hours=2)),
            user=user,
            group=property_group1,
        )
        with session.begin_nested():
            session.add(mem)
        assert utcnow in mem.active_during

        # disable: [NOW - 2h,) → [NOW - 2h, NOW - 1h)
        with session.begin_nested():
            mem.disable(utcnow - timedelta(hours=1))
        session.refresh(mem)
        assert utcnow not in mem.active_during

class TestGroup:
    @pytest.fixture(scope='class')
    def membership(self, class_session, user, utcnow, property_group1):
        return Membership(
            user=user,
            group=property_group1,
            active_during=starting_from(utcnow),
        )

    @pytest.fixture
    def add_membership(self, membership, session):
        def _add_membership():
            with session.begin_nested():
                session.add(membership)
        return _add_membership

    def test_active_users(self, session, user, add_membership, property_group1):
        assert property_group1.active_users() == []
        add_membership()
        session.refresh(property_group1)
        assert property_group1.active_users() == [user]

    @pytest.fixture
    def create_active_users_query(self, session, property_group1):
        def _create_active_users_query():
            active_users = Group.active_users().where(
                Group.id == property_group1.id)
            return session.query(User).from_statement(active_users)
        return _create_active_users_query

    def test_active_users_expression(self, session, user, property_group1,
                                     create_active_users_query, add_membership):
        query = create_active_users_query()
        assert query.all() == []
        add_membership()
        query = create_active_users_query()
        assert query.all() == [user]

class TestCurrentPropertyView:
    @pytest.fixture(scope='class')
    def groups(self, class_session):
        property_group_data = {
            # name, granted, denied
            'active': ({'login', 'mail'}, set()),
            'mail_only': ({'mail'}, set()),
            'violation': (set(), {'login'}),
        }
        return {
            name: PropertyGroupFactory.create(
                name=name, granted=granted, denied=denied
            )
            for name, (granted, denied) in property_group_data.items()
        }

    @pytest.fixture(scope='class')
    def users(self, class_session):
        return {
            key: factories.UserFactory.create(login=f'user-{key}')
            for key in 'active mail violator former'.split()
        }

    @pytest.fixture(scope='class', autouse=True)
    def memberships(self, class_session, users, groups):
        mem_data = [
            # user, group, delta_days_start, delta_days_end
            ('active', 'active', -1, None),
            ('mail', 'mail_only', -1, +1),
            ('mail', 'active', +2, None),
            ('violator', 'active', -1, None),
            ('violator', 'violation', -1, None),
            ('former', 'active', -10, -1),
            ('former', 'violation', -9, -5),
        ]
        memberships = [MembershipFactory.create(
            user=users[username],
            group=groups[groupname],
            active_during=(closedopen(
                (datetime.now() + timedelta(delta_days_start)
                 if delta_days_start is not None else None),
                (datetime.now() + timedelta(delta_days_end)
                 if delta_days_end is not None else None),
            )))
            for username, groupname, delta_days_start, delta_days_end in mem_data
        ]
        return memberships

    def test_current_properties_of_user(self, session, users):
        rows = (session.query(current_property.table.c.property_name)
                .add_columns(User.login.label('login'))
                .join(User.current_properties)
                .all())
        login = users['active'].login
        expected_results = [
            # name, granted, denied
            ('active', ['mail', 'login'], []),
            ('mail', ['mail'], ['login']),
            ('former', [], ['mail', 'login']),
            ('violator', ['mail'], ['login'])
        ]
        for user_key, granted, denied in expected_results:
            login = users[user_key].login
            for granted_prop in granted:
                assert (granted_prop, login) in rows
            for denied_prop in denied:
                assert (denied_prop, login) not in rows

    def test_current_granted_or_denied_properties_of_user(self, session, users):
        rows = (session.query(current_property.table.c.property_name)
                .add_columns(User.login.label('login'))
                .join(User.current_properties_maybe_denied)
                .all())
        # This checks that the violator's 'login' property is in the view as well
        # when ignoring the `denied` column
        assert ('login', users['violator'].login) in rows

def _iso(date):
    return datetime.fromisoformat(f'{date}T00:00:00+00:00')

class TestEvaluateProperties:
    @pytest.fixture(scope='class')
    def groups(self, class_session):
        return [
            PropertyGroupFactory(granted={'good', 'other'}),
            PropertyGroupFactory(granted={'bad'}, denied={'good'}),
        ]

    @pytest.fixture(scope='class')
    def mem1(self, class_session, user, groups):
        # mem1: [2000-01-01 ---------------------- 2000-01-03)
        return MembershipFactory.create(
            user=user,
            active_during=closedopen(_iso('2000-01-01'), _iso('2000-01-03')),
            group=groups[0],
        )

    @pytest.fixture(scope='class')
    def mem2(self, class_session, user, groups):
        # mem2:                  [2000-01-02 ---------------------- 2000-01-04)
        return MembershipFactory.create(
            user=user,
            active_during=closedopen(_iso('2000-01-02'), _iso('2000-01-04')),
            group=groups[1],
        )

    @pytest.fixture
    def props_at(self, session, user):
        def _props_at(when) -> set:
            props = evaluate_properties(when=when, name='props')
            stmt = (
                select(props.c.property_name, props.c.denied)
                    .select_from(props)
                    .join(User, onclause=User.id == props.c.user_id)
                    .where(User.id == user.id)
            )
            rows = session.execute(stmt).all()
            return set(rows)
        return _props_at

    @pytest.fixture
    def mems_at(self, session):
        def _mems_at(when):
            stmt = select(Membership).where(Membership.active_during.contains(when))
            return {m for m, *_ in session.execute(stmt).all()}
        return _mems_at

    def test_beginning(self, session, mems_at, props_at, mem1):
        when = _iso('2000-01-01')
        assert mems_at(when) == {mem1}
        assert props_at(when) \
               == {('good', False), ('other', False)}

    def test_right_at_new_membership(self, mems_at, props_at, mem1, mem2):
        when = _iso('2000-01-02')
        assert mems_at(when) == {mem1, mem2}
        assert props_at(when) \
               == {('bad', False), ('other', False),
                   ('good', True)}  # 'good' has beed denied

    def test_one_ended(self, mems_at, props_at, mem2):
        when = _iso('2000-01-03')
        assert mems_at(when) == {mem2}
        # 'good' has beed denied – but never granted, so it does not show up in the list!
        assert props_at(when) \
               == {('bad', False)}

    def test_right_after(self, mems_at, props_at):
        when = _iso('2000-01-04')
        assert mems_at(when) == set()
        assert props_at(when) == set()


text:
package com.hs.mail.imap.message.builder;

import java.io.StringReader;
import java.util.LinkedList;

import junit.framework.TestCase;

import com.hs.mail.imap.message.ImapRequestFactory;
import com.hs.mail.imap.message.SequenceRange;
import com.hs.mail.imap.message.request.ImapRequest;
import com.hs.mail.imap.message.request.SearchRequest;
import com.hs.mail.imap.message.search.AndKey;
import com.hs.mail.imap.message.search.FromStringKey;
import com.hs.mail.imap.message.search.HeaderKey;
import com.hs.mail.imap.message.search.SearchKey;
import com.hs.mail.imap.message.search.SequenceKey;
import com.hs.mail.imap.parser.CommandParser;
import com.hs.mail.imap.parser.Token;
import com.hs.mail.imap.server.codec.ImapMessage;
import com.hs.mail.imap.test.MockImapMessage;

public class SearchRequestBuilderTest extends TestCase {

	protected void setUp() throws Exception {
		super.setUp();
	}

	public void testSequence() throws Exception {
		SequenceRange[] range = new SequenceRange[] {
				new SequenceRange(100, Long.MAX_VALUE), new SequenceRange(110),
				new SequenceRange(200, 201),
				new SequenceRange(400, Long.MAX_VALUE) };
		check(new SearchKey[] { new SequenceKey(range) },
				"T SEARCH *:100,110,200:201,400:*");
	}

	public void testUidSequence() throws Exception {
		SequenceRange[] range = new SequenceRange[] {
				new SequenceRange(100, Long.MAX_VALUE), new SequenceRange(110),
				new SequenceRange(200, 201),
				new SequenceRange(400, Long.MAX_VALUE) };
		check(new SearchKey[] { new SequenceKey(range, true) },
				"T SEARCH UID *:100,110,200:201,400:*");
	}

	public void testFromHeader() throws Exception {
		check(new SearchKey[] { new HeaderKey("FROM", "Smith") },
				"T SEARCH HEADER FROM Smith");
	}

	public void testStringUnquoted() throws Exception {
		check(new SearchKey[] { new FromStringKey("Smith") },
				"T SEARCH FROM Smith");
	}

	public void testStringQuoted() throws Exception {
		check(new SearchKey[] { new FromStringKey("Smith And Jones") },
				"T SEARCH FROM \"Smith And Jones\"");
	}

	private void check(SearchKey[] keys, String command) {
		ImapMessage message = new MockImapMessage(parse(command));
		ImapRequest request = ImapRequestFactory.createImapRequest(message);
		assertTrue(request instanceof SearchRequest);
		SearchKey searchKey = null;
		if (keys.length > 1) {
			searchKey = new AndKey();
			for (int i = 0; i < keys.length; i++) {
				((AndKey) searchKey).addKey(keys[i]);
			}
		} else {
			searchKey = keys[0];
		}
		assertEquals(((SearchRequest) request).getSearchKey(), searchKey);
	}

	protected void tearDown() throws Exception {
		super.tearDown();
	}

	private LinkedList<Token> parse(String command) {
		CommandParser parser = new CommandParser(new StringReader(command + "\r\n"));
		return parser.command();
	}

}


text:
A website for scouting Splatoon teams, players, and events.

## Vision
The Blue Squad aims to be the best place to find information about Splatoon 2 teams, players, and events, assisting the scouting efforts of players looking to join teams, teams looking to recruit players, teams looking to compete against other teams, fans looking to learn about the best teams, and more.

## Scope
This is not intended to be an all-encompassing hub for the competitive community. In order to execute the vision we focus on the following set of features:
* Player profiles
* Team profiles
* Event details
* Links to Player, Team, and Event statistics
  * may incorporate some aggregated stats in the future
* Links to and/or embedded streams and videos of matches and events
* Opportunities for players and teams to contact each other

## Stack
* [Material Design Lite](https://getmdl.io/index.html)
* [Vue](https://vuejs.org/)
* [Firebase](https://firebase.google.com/)


text:
package com.ncs.moa.impl.flowMessage;

import org.springframework.beans.factory.InitializingBean;
import org.springframework.util.Assert;
import com.ncs.moa.service.flowMessage.FlowMessageService;
import com.rizon.apollo.moa.flowMessage.service.MoaFlowMessageService;

/**
 * ´ý°ìÁбíÐÅÏ¢·þÎñµÄȱʡʵÏÖ
 *
 *
 * @author zhangff
 * @version 2017-6-12
 */
public class FlowMessageServiceImpl implements FlowMessageService, InitializingBean {
	private MoaFlowMessageService moaFlowMessageService;

	public MoaFlowMessageService getMoaFlowMessageService() {
		return moaFlowMessageService;
	}

	public void setMoaFlowMessageService(MoaFlowMessageService moaFlowMessageService) {
		this.moaFlowMessageService = moaFlowMessageService;
	}

	@Override
	public void afterPropertiesSet() throws Exception {
		Assert.notNull(moaFlowMessageService, "moaFlowMessageService is required!");
	}

	@Override
	public String getFlowMessage(String account, long id, String type, String flowName) {
		return moaFlowMessageService.getFlowMessage(account, id, type, flowName);
	}
}


text:
<?xml version="1.0" encoding="UTF-8"?>
<plugin xmlns="http://apache.org/cordova/ns/plugins/1.0"
        id="com.telerik.plugins.healthkit"
        version="0.3.3">

  <name>HealthKit</name>

  <description>
    Interact with the iOS8 HealthKit SDK
  </description>

  <author>Eddy Verbruggen / Telerik</author>

  <license>MIT</license>

  <keywords>Health, HealthKit, Fit, Fitness, Birthdate, Gender, Height, Weight, Workout</keywords>

  <repo>https://github.com/Telerik-Verified-Plugins/HealthKit.git</repo>

  <issue>https://github.com/Telerik-Verified-Plugins/HealthKit/issues</issue>

  <engines>
    <engine name="cordova" version=">=3.0.0"/>
  </engines>

  <js-module src="www/HealthKit.js" name="HealthKit">
    <clobbers target="window.plugins.healthkit" />
  </js-module>

  <!-- ios -->
  <platform name="ios">

    <config-file target="config.xml" parent="/*">
      <feature name="HealthKit">
        <param name="ios-package" value="HealthKit"/>
      </feature>
    </config-file>

    <!-- commented this because it means you can't use the app on iPad -->
    <!--config-file target="*-Info.plist" parent="UIRequiredDeviceCapabilities">
      <array>
        <string>healthkit</string>
      </array>
    </config-file-->

    <header-file src="src/ios/WorkoutActivityConversion.h"/>
    <source-file src="src/ios/WorkoutActivityConversion.m"/>
    <header-file src="src/ios/HKHealthStore+AAPLExtensions.h"/>
    <source-file src="src/ios/HKHealthStore+AAPLExtensions.m"/>
    <header-file src="src/ios/HealthKit.h"/>
    <source-file src="src/ios/HealthKit.m"/>

    <framework src="HealthKit.framework" weak="true" />
  </platform>

</plugin>


text:
namespace v8 {
namespace internal {

class BackgroundCompileTaskTest : public TestWithNativeContext {
 public:
  BackgroundCompileTaskTest() : allocator_(isolate()->allocator()) {}
  ~BackgroundCompileTaskTest() override = default;
  BackgroundCompileTaskTest(const BackgroundCompileTaskTest&) = delete;
  BackgroundCompileTaskTest& operator=(const BackgroundCompileTaskTest&) =
      delete;

  AccountingAllocator* allocator() { return allocator_; }

  static void SetUpTestCase() {
    CHECK_NULL(save_flags_);
    save_flags_ = new SaveFlags();
    // TODO(leszeks): Support background finalization in compiler dispatcher.
    FLAG_finalize_streaming_on_background = false;
    TestWithNativeContext::SetUpTestCase();
  }

  static void TearDownTestCase() {
    TestWithNativeContext::TearDownTestCase();
    CHECK_NOT_NULL(save_flags_);
    delete save_flags_;
    save_flags_ = nullptr;
  }

  BackgroundCompileTask* NewBackgroundCompileTask(
      Isolate* isolate, Handle<SharedFunctionInfo> shared,
      size_t stack_size = FLAG_stack_size) {
    UnoptimizedCompileState state(isolate);
    std::unique_ptr<ParseInfo> outer_parse_info =
        test::OuterParseInfoForShared(isolate, shared, &state);
    AstValueFactory* ast_value_factory =
        outer_parse_info->GetOrCreateAstValueFactory();
    AstNodeFactory ast_node_factory(ast_value_factory,
                                    outer_parse_info->zone());

    const AstRawString* function_name =
        ast_value_factory->GetOneByteString("f");
    DeclarationScope* script_scope =
        outer_parse_info->zone()->New<DeclarationScope>(
            outer_parse_info->zone(), ast_value_factory);
    DeclarationScope* function_scope =
        outer_parse_info->zone()->New<DeclarationScope>(
            outer_parse_info->zone(), script_scope, FUNCTION_SCOPE);
    function_scope->set_start_position(shared->StartPosition());
    function_scope->set_end_position(shared->EndPosition());
    std::vector<void*> buffer;
    ScopedPtrList<Statement> statements(&buffer);
    const FunctionLiteral* function_literal =
        ast_node_factory.NewFunctionLiteral(
            function_name, function_scope, statements, -1, -1, -1,
            FunctionLiteral::kNoDuplicateParameters,
            FunctionSyntaxKind::kAnonymousExpression,
            FunctionLiteral::kShouldEagerCompile, shared->StartPosition(), true,
            shared->function_literal_id(), nullptr);

    return new BackgroundCompileTask(
        outer_parse_info.get(), function_name, function_literal,
        isolate->counters()->worker_thread_runtime_call_stats(),
        isolate->counters()->compile_function_on_background(), FLAG_stack_size);
  }

 private:
  AccountingAllocator* allocator_;
  static SaveFlags* save_flags_;
};

SaveFlags* BackgroundCompileTaskTest::save_flags_ = nullptr;

TEST_F(BackgroundCompileTaskTest, Construct) {
  Handle<SharedFunctionInfo> shared =
      test::CreateSharedFunctionInfo(isolate(), nullptr);
  ASSERT_FALSE(shared->is_compiled());
  std::unique_ptr<BackgroundCompileTask> task(
      NewBackgroundCompileTask(isolate(), shared));
}

TEST_F(BackgroundCompileTaskTest, SyntaxError) {
  test::ScriptResource* script = new test::ScriptResource("^^^", strlen("^^^"));
  Handle<SharedFunctionInfo> shared =
      test::CreateSharedFunctionInfo(isolate(), script);
  std::unique_ptr<BackgroundCompileTask> task(
      NewBackgroundCompileTask(isolate(), shared));

  task->Run();
  ASSERT_FALSE(Compiler::FinalizeBackgroundCompileTask(
      task.get(), shared, isolate(), Compiler::KEEP_EXCEPTION));
  ASSERT_TRUE(isolate()->has_pending_exception());

  isolate()->clear_pending_exception();
}

TEST_F(BackgroundCompileTaskTest, CompileAndRun) {
  const char raw_script[] =
      "function g() {\n"
      "  f = function(a) {\n"
      "        for (var i = 0; i < 3; i++) { a += 20; }\n"
      "        return a;\n"
      "      }\n"
      "  return f;\n"
      "}\n"
      "g();";
  test::ScriptResource* script =
      new test::ScriptResource(raw_script, strlen(raw_script));
  Handle<JSFunction> f = RunJS<JSFunction>(script);
  Handle<SharedFunctionInfo> shared = handle(f->shared(), isolate());
  ASSERT_FALSE(shared->is_compiled());
  std::unique_ptr<BackgroundCompileTask> task(
      NewBackgroundCompileTask(isolate(), shared));

  task->Run();
  ASSERT_TRUE(Compiler::FinalizeBackgroundCompileTask(
      task.get(), shared, isolate(), Compiler::KEEP_EXCEPTION));
  ASSERT_TRUE(shared->is_compiled());

  Smi value = Smi::cast(*RunJS("f(100);"));
  ASSERT_TRUE(value == Smi::FromInt(160));
}

TEST_F(BackgroundCompileTaskTest, CompileFailure) {
  std::string raw_script("() { var a = ");
  for (int i = 0; i < 10000; i++) {
    // TODO(leszeks): Figure out a more "unit-test-y" way of forcing an analysis
    // failure than a binop stack overflow.

    // Alternate + and - to avoid n-ary operation nodes.
    raw_script += "'x' + 'x' - ";
  }
  raw_script += " 'x'; }";
  test::ScriptResource* script =
      new test::ScriptResource(raw_script.c_str(), strlen(raw_script.c_str()));
  Handle<SharedFunctionInfo> shared =
      test::CreateSharedFunctionInfo(isolate(), script);
  std::unique_ptr<BackgroundCompileTask> task(
      NewBackgroundCompileTask(isolate(), shared, 100));

  task->Run();
  ASSERT_FALSE(Compiler::FinalizeBackgroundCompileTask(
      task.get(), shared, isolate(), Compiler::KEEP_EXCEPTION));
  ASSERT_TRUE(isolate()->has_pending_exception());

  isolate()->clear_pending_exception();
}

class CompileTask : public Task {
 public:
  CompileTask(BackgroundCompileTask* task, base::Semaphore* semaphore)
      : task_(task), semaphore_(semaphore) {}
  ~CompileTask() override = default;
  CompileTask(const CompileTask&) = delete;
  CompileTask& operator=(const CompileTask&) = delete;

  void Run() override {
    task_->Run();
    semaphore_->Signal();
  }

 private:
  BackgroundCompileTask* task_;
  base::Semaphore* semaphore_;
};

TEST_F(BackgroundCompileTaskTest, CompileOnBackgroundThread) {
  const char* raw_script =
      "(a, b) {\n"
      "  var c = a + b;\n"
      "  function bar() { return b }\n"
      "  var d = { foo: 100, bar : bar() }\n"
      "  return bar;"
      "}";
  test::ScriptResource* script =
      new test::ScriptResource(raw_script, strlen(raw_script));
  Handle<SharedFunctionInfo> shared =
      test::CreateSharedFunctionInfo(isolate(), script);
  std::unique_ptr<BackgroundCompileTask> task(
      NewBackgroundCompileTask(isolate(), shared));

  base::Semaphore semaphore(0);
  auto background_task = std::make_unique<CompileTask>(task.get(), &semaphore);

  V8::GetCurrentPlatform()->CallOnWorkerThread(std::move(background_task));
  semaphore.Wait();
  ASSERT_TRUE(Compiler::FinalizeBackgroundCompileTask(
      task.get(), shared, isolate(), Compiler::KEEP_EXCEPTION));
  ASSERT_TRUE(shared->is_compiled());
}

TEST_F(BackgroundCompileTaskTest, EagerInnerFunctions) {
  const char raw_script[] =
      "function g() {\n"
      "  f = function() {\n"
      "    // Simulate an eager IIFE with brackets.\n "
      "    var e = (function () { return 42; });\n"
      "    return e;\n"
      "  }\n"
      "  return f;\n"
      "}\n"
      "g();";
  test::ScriptResource* script =
      new test::ScriptResource(raw_script, strlen(raw_script));
  Handle<JSFunction> f = RunJS<JSFunction>(script);
  Handle<SharedFunctionInfo> shared = handle(f->shared(), isolate());
  ASSERT_FALSE(shared->is_compiled());
  std::unique_ptr<BackgroundCompileTask> task(
      NewBackgroundCompileTask(isolate(), shared));

  task->Run();
  ASSERT_TRUE(Compiler::FinalizeBackgroundCompileTask(
      task.get(), shared, isolate(), Compiler::KEEP_EXCEPTION));
  ASSERT_TRUE(shared->is_compiled());

  Handle<JSFunction> e = RunJS<JSFunction>("f();");

  ASSERT_TRUE(e->shared().is_compiled());
}

TEST_F(BackgroundCompileTaskTest, LazyInnerFunctions) {
  const char raw_script[] =
      "function g() {\n"
      "  f = function() {\n"
      "    function e() { return 42; };\n"
      "    return e;\n"
      "  }\n"
      "  return f;\n"
      "}\n"
      "g();";
  test::ScriptResource* script =
      new test::ScriptResource(raw_script, strlen(raw_script));
  Handle<JSFunction> f = RunJS<JSFunction>(script);
  Handle<SharedFunctionInfo> shared = handle(f->shared(), isolate());
  ASSERT_FALSE(shared->is_compiled());
  std::unique_ptr<BackgroundCompileTask> task(
      NewBackgroundCompileTask(isolate(), shared));

  task->Run();
  ASSERT_TRUE(Compiler::FinalizeBackgroundCompileTask(
      task.get(), shared, isolate(), Compiler::KEEP_EXCEPTION));
  ASSERT_TRUE(shared->is_compiled());

  Handle<JSFunction> e = RunJS<JSFunction>("f();");

  ASSERT_FALSE(e->shared().is_compiled());
}

}  // namespace internal
}  // namespace v8


text:
package domainapp.dom;

import org.apache.isis.applib.ModuleAbstract;

public class HelloWorldModule extends ModuleAbstract {

}


text:
package org.wso2.carbon.identity.application.authenticator.openid.ext;

import org.wso2.carbon.identity.application.authentication.framework.context.AuthenticationContext;
import org.wso2.carbon.identity.application.authentication.framework.exception.AuthenticationFailedException;
import org.wso2.carbon.identity.application.authenticator.openid.OpenIDAuthenticator;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

public class GoogleOpenIDAuthenticator extends OpenIDAuthenticator {

    /**
     *
     */
    private static final long serialVersionUID = -5947608036809026467L;

    @Override
    public String getFriendlyName() {
        return "google";
    }

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

    protected String getOpenIDServerUrl() {
        return "https://www.google.com/accounts/o8/id";
    }

    @Override
    protected void processAuthenticationResponse(HttpServletRequest request,
                                                 HttpServletResponse response, AuthenticationContext context)
            throws AuthenticationFailedException {
        super.processAuthenticationResponse(request, response, context);

        String subject = super.getSubjectFromUserIDClaimURI(context);
        if (subject != null) {
            context.getSubject().setAuthenticatedSubjectIdentifier(subject);
        }
    }

}


text:
var assert = require('assert');
var _ = require('lodash');

describe('spatial feature', function () {
  var Waterline = require('waterline');
  var defaults = { migrate: 'alter' };
  var waterline;

  var Models = require('../support/models.js');
  var Fixtures = require('../support/fixtures.js');
  var Model;

  describe('geojson', function () {

    it('shoud create geometries', function (done) {
      Model.create({
          name: 'pointA',
          prop1: 'foo',
          marker: Fixtures.point
        })
        .then(function (model) {
          //console.log('model', model);
          assert(_.isObject(model.marker));
          assert.equal(model.marker.type, 'Point');
          assert(model.id);

          done();
        })
    })

    it('should return geojson features if queried normally', function (done) {
      Model.find().then(function (models) {
        assert(models);
        assert(models.length)
        done();
      });
    });
    it.skip('should return a FeatureCollection if queried with .asGeojson()', function (done) {
      done();
    })
  });

  describe('#procedure()', function () {

    describe('#Find_SRID', function () {
      it('should return the srid of a column', function () {
        //console.log(Adapter)
        return Adapter.procedure('geoConnection', 'Find_SRID', [ 'public', 'geomodelTable', 'marker' ])
          .then(function (srid) {
            console.log('srid', srid);
            assert(srid);
          });
      });
    });

  });

  before(function(done) {
    waterline = new Waterline();
    waterline.loadCollection(Models);

    var connections = { geoConnection: _.clone(Connections.test) };
    Adapter.teardown('geoConnection', function adapterTeardown(){
      waterline.initialize({ adapters: { wl_tests: Adapter }, connections: connections, defaults: defaults }, function(err, ontology) {
        if(err) return done(err);
        Model = ontology.collections['geomodel'];
        done();
      });
    });
  });
  after(function(done) {
    done()
      /*
    if(!Adapter.hasOwnProperty('drop')) {
      waterline.teardown(done);
      done()
    } else {
      Model.drop(function(err1) {
        done()
        waterline.teardown(function(err2) {
          return done(err1 || err2);
        });
      });
    }
    */
  });

});;


text:
import java.util.*;

// This will run a complex calculation on every element of an array
// of the size passed in as a parameter.
// It will do so synchronously (that is, work on the first element, then
// the second, then the third, etc.)

public class SynchronousCalculator {

    /**
     * Helper method for printing out arrays.
     * @param int[] arr Array of integers to print
     */
    public static void printArray(int[] arr) {
	System.out.print("[ ");
	for (int j=0; j < (arr.length - 1); j++) {
	    System.out.print(arr[j] + ", ");
	}
	if (arr.length > 0) {
	    System.out.print(arr[arr.length - 1]);
	}
	System.out.println(" ]");

    }

    /**
     * Generate initial array, where location 0 has
     * value 0, location 1 value 1, etc.
     */

    private static int[] generateInitialArray(int n) {
	int[] toReturn = new int[n];
	for (int j = 0; j < n; j++) {
	    toReturn[j] = j;
	}
	return toReturn;
    }

    /**
     * Placeholder for complex calculation
     */

    private static int calculate(int n) {
	int x = n;
	for (int j = 0; j < 100000; j++) {
	    for (int k = 0; k < 20; k++) {
		x += k * Math.atan(n);
	    }
	    x += Math.acos(n);
	    x -= j * Math.sin(n);
	}
	return x;
    }

    public static void main(String[] args) {

	int n = -1;

	try {
	    n = Integer.parseInt(args[0]);
	    if (n < 1) {
		throw new Exception();
	    }
	} catch (Exception ex) {
	    System.out.println("Expected positive int as argument!");
	    System.exit(1);
	}

	int[] initialArray = generateInitialArray(n);
	int[] newArray = new int[initialArray.length];

	printArray(initialArray);

	for (int j = 0; j < initialArray.length; j++) {
	    newArray[j] = calculate(initialArray[j]);
	    System.out.println("Finished calculating " + j);
	}

	printArray(newArray);

    }
}


text:
/*
** NOTE: This file is generated by Gulp and should not be edited directly!
** Any changes made directly to this file will be overwritten next time its asset group is processed by Gulp.
*/

/* http://keith-wood.name/calendars.html
   Finnish localisation for calendars datepicker for jQuery.
   Written by Harri Kilpiö (harrikilpio@gmail.com). */
(function ($) {
    $.calendarsPicker.regionalOptions['fi'] = {
        renderer: $.calendarsPicker.defaultRenderer,
        prevText: '«Edellinen', prevStatus: '',
        prevJumpText: '<<', prevJumpStatus: '',
        nextText: 'Seuraava»', nextStatus: '',
        nextJumpText: '>>', nextJumpStatus: '',
        currentText: 'Tänään', currentStatus: '',
        todayText: 'Tänään', todayStatus: '',
        clearText: 'Tyhjennä', clearStatus: '',
        closeText: 'Sulje', closeStatus: '',
        yearStatus: '', monthStatus: '',
        weekText: 'Vk', weekStatus: '',
        dayStatus: 'DD, M d', defaultStatus: '',
        isRTL: false
    };
    $.calendarsPicker.setDefaults($.calendarsPicker.regionalOptions['fi']);
})(jQuery);


text:
package org.apache.flink.streaming.api.operators.collect;

import org.apache.flink.api.common.typeutils.TypeSerializer;
import org.apache.flink.api.common.typeutils.base.IntSerializer;
import org.apache.flink.core.memory.DataOutputView;
import org.apache.flink.core.memory.DataOutputViewStreamWrapper;

import org.junit.Assert;
import org.junit.Test;

import java.io.ByteArrayOutputStream;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;

/** Tests for {@link AbstractCollectResultBuffer} and its subclasses. */
public class CollectResultBufferTest {

    private static final TypeSerializer<Integer> serializer = IntSerializer.INSTANCE;

    @Test
    public void testUncheckpointedValidResponse() throws Exception {
        String version = "version";
        AbstractCollectResultBuffer<Integer> buffer =
                new UncheckpointedCollectResultBuffer<>(serializer, false);

        // first response to sync version, no data
        CollectCoordinationResponse response =
                new CollectCoordinationResponse(version, 0, Collections.emptyList());
        buffer.dealWithResponse(response, 0);

        List<Integer> expected = Arrays.asList(1, 2, 3);
        response = new CollectCoordinationResponse(version, 0, createSerializedResults(expected));
        buffer.dealWithResponse(response, 0);
        // for uncheckpointed buffer, results can be instantly seen by user
        for (Integer expectedValue : expected) {
            Assert.assertEquals(expectedValue, buffer.next());
        }

        expected = Arrays.asList(4, 5);
        // 3 is a retransmitted value, it should be skipped
        response =
                new CollectCoordinationResponse(
                        version, 0, createSerializedResults(Arrays.asList(3, 4, 5)));
        buffer.dealWithResponse(response, 2);
        for (Integer expectedValue : expected) {
            Assert.assertEquals(expectedValue, buffer.next());
        }
        Assert.assertNull(buffer.next());
    }

    @Test
    public void testUncheckpointedFaultTolerance() throws Exception {
        String version = "version";
        AbstractCollectResultBuffer<Integer> buffer =
                new UncheckpointedCollectResultBuffer<>(serializer, true);

        // first response to sync version, no data
        CollectCoordinationResponse response =
                new CollectCoordinationResponse(version, 0, Collections.emptyList());
        buffer.dealWithResponse(response, 0);

        List<Integer> expected = Arrays.asList(1, 2, 3);
        response = new CollectCoordinationResponse(version, 0, createSerializedResults(expected));
        buffer.dealWithResponse(response, 0);
        for (Integer expectedValue : expected) {
            Assert.assertEquals(expectedValue, buffer.next());
        }

        // version changed, job restarted
        version = "another";
        response = new CollectCoordinationResponse(version, 0, Collections.emptyList());
        buffer.dealWithResponse(response, 0);

        // retransmit same data
        response = new CollectCoordinationResponse(version, 0, createSerializedResults(expected));
        buffer.dealWithResponse(response, 0);
        for (Integer expectedValue : expected) {
            Assert.assertEquals(expectedValue, buffer.next());
        }
    }

    @Test(expected = RuntimeException.class)
    public void testUncheckpointedNotFaultTolerance() throws Exception {
        String version = "version";
        AbstractCollectResultBuffer<Integer> buffer =
                new UncheckpointedCollectResultBuffer<>(serializer, false);

        // first response to sync version, no data
        CollectCoordinationResponse response =
                new CollectCoordinationResponse(version, 0, Collections.emptyList());
        buffer.dealWithResponse(response, 0);

        List<Integer> expected = Arrays.asList(1, 2, 3);
        response = new CollectCoordinationResponse(version, 0, createSerializedResults(expected));
        buffer.dealWithResponse(response, 0);
        for (Integer expectedValue : expected) {
            Assert.assertEquals(expectedValue, buffer.next());
        }

        // version changed, job restarted
        version = "another";
        response = new CollectCoordinationResponse(version, 0, Collections.emptyList());
        buffer.dealWithResponse(response, 0);
    }

    @Test
    public void testCheckpointedValidResponse() throws Exception {
        String version = "version";
        AbstractCollectResultBuffer<Integer> buffer =
                new CheckpointedCollectResultBuffer<>(serializer);

        // first response to sync version, no data
        CollectCoordinationResponse response =
                new CollectCoordinationResponse(version, 0, Collections.emptyList());
        buffer.dealWithResponse(response, 0);

        List<Integer> expected = Arrays.asList(1, 2, 3);
        response = new CollectCoordinationResponse(version, 0, createSerializedResults(expected));
        buffer.dealWithResponse(response, 0);
        // for checkpointed buffer, results can only be seen after a checkpoint
        Assert.assertNull(buffer.next());

        response =
                new CollectCoordinationResponse(
                        version, 3, createSerializedResults(Arrays.asList(4, 5, 6)));
        buffer.dealWithResponse(response, 3);
        // results before checkpoint can be seen now
        for (Integer expectedValue : expected) {
            Assert.assertEquals(expectedValue, buffer.next());
        }

        expected = Arrays.asList(4, 5, 6);
        // 6 is a retransmitted value, it should be skipped
        response =
                new CollectCoordinationResponse(
                        version, 6, createSerializedResults(Arrays.asList(6, 7)));
        buffer.dealWithResponse(response, 5);
        // results before checkpoint can be seen now
        for (Integer expectedValue : expected) {
            Assert.assertEquals(expectedValue, buffer.next());
        }

        buffer.complete();
        Assert.assertEquals((Integer) 7, buffer.next());
        Assert.assertNull(buffer.next());
    }

    @Test
    public void testCheckpointedRestart() throws Exception {
        String version = "version";
        AbstractCollectResultBuffer<Integer> buffer =
                new CheckpointedCollectResultBuffer<>(serializer);

        // first response to sync version, no data
        CollectCoordinationResponse response =
                new CollectCoordinationResponse(version, 0, Collections.emptyList());
        buffer.dealWithResponse(response, 0);

        response =
                new CollectCoordinationResponse(
                        version, 0, createSerializedResults(Arrays.asList(1, 2, 3)));
        buffer.dealWithResponse(response, 0);
        // for checkpointed buffer, results can only be seen after a checkpoint
        Assert.assertNull(buffer.next());

        // version changed, job restarted
        version = "another";
        response = new CollectCoordinationResponse(version, 0, Collections.emptyList());
        buffer.dealWithResponse(response, 0);

        List<Integer> expected = Arrays.asList(4, 5, 6);
        // transmit some different data, they should overwrite previous ones
        response = new CollectCoordinationResponse(version, 0, createSerializedResults(expected));
        buffer.dealWithResponse(response, 0);
        // checkpoint still not done
        Assert.assertNull(buffer.next());

        // checkpoint completed
        response = new CollectCoordinationResponse(version, 3, Collections.emptyList());
        buffer.dealWithResponse(response, 0);
        for (Integer expectedValue : expected) {
            Assert.assertEquals(expectedValue, buffer.next());
        }
        Assert.assertNull(buffer.next());
    }

    @Test
    public void testImmediateAccumulatorResult() throws Exception {
        String version = "version";
        AbstractCollectResultBuffer<Integer> buffer =
                new UncheckpointedCollectResultBuffer<>(serializer, false);

        // job finished before the first request,
        // so the first and only response is from the accumulator and contains results
        List<Integer> expected = Arrays.asList(1, 2, 3);
        CollectCoordinationResponse response =
                new CollectCoordinationResponse(version, 0, createSerializedResults(expected));
        buffer.dealWithResponse(response, 0);
        buffer.complete();

        for (Integer expectedValue : expected) {
            Assert.assertEquals(expectedValue, buffer.next());
        }
        Assert.assertNull(buffer.next());
    }

    private List<byte[]> createSerializedResults(List<Integer> values) throws Exception {
        List<byte[]> serializedResults = new ArrayList<>();
        for (int value : values) {
            ByteArrayOutputStream baos = new ByteArrayOutputStream();
            DataOutputView wrapper = new DataOutputViewStreamWrapper(baos);
            serializer.serialize(value, wrapper);
            serializedResults.add(baos.toByteArray());
        }
        return serializedResults;
    }
}


text:
\hypertarget{classnetflex_1_1parsing_1_1message__body__deflate__parser}{}\section{netflex\+:\+:parsing\+:\+:message\+\_\+body\+\_\+deflate\+\_\+parser Class Reference}
\label{classnetflex_1_1parsing_1_1message__body__deflate__parser}\index{netflex\+::parsing\+::message\+\_\+body\+\_\+deflate\+\_\+parser@{netflex\+::parsing\+::message\+\_\+body\+\_\+deflate\+\_\+parser}}

{\ttfamily \#include $<$message\+\_\+body\+\_\+deflate\+\_\+parser.\+hpp$>$}

Inheritance diagram for netflex\+:\+:parsing\+:\+:message\+\_\+body\+\_\+deflate\+\_\+parser\+:\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[height=2.000000cm]{classnetflex_1_1parsing_1_1message__body__deflate__parser}
\end{center}
\end{figure}
\subsection*{Public Member Functions}
\begin{DoxyCompactItemize}
\item
\hyperlink{classnetflex_1_1parsing_1_1message__body__deflate__parser_a50f8b3c3bc5a6ad1b8bd63803d92c455}{message\+\_\+body\+\_\+deflate\+\_\+parser} (\hyperlink{classnetflex_1_1http_1_1request}{http\+::request} \&request)
\item
\mbox{\Hypertarget{classnetflex_1_1parsing_1_1message__body__deflate__parser_ad28b9d807733d8d04c9c238b95a00cca}\label{classnetflex_1_1parsing_1_1message__body__deflate__parser_ad28b9d807733d8d04c9c238b95a00cca}}
\hyperlink{classnetflex_1_1parsing_1_1message__body__deflate__parser_ad28b9d807733d8d04c9c238b95a00cca}{$\sim$message\+\_\+body\+\_\+deflate\+\_\+parser} (void)=default
\begin{DoxyCompactList}\small\item\em default dtor \end{DoxyCompactList}\item
\mbox{\Hypertarget{classnetflex_1_1parsing_1_1message__body__deflate__parser_a883c098ee9b13ef7c0986c1634794b0d}\label{classnetflex_1_1parsing_1_1message__body__deflate__parser_a883c098ee9b13ef7c0986c1634794b0d}}
\hyperlink{classnetflex_1_1parsing_1_1message__body__deflate__parser_a883c098ee9b13ef7c0986c1634794b0d}{message\+\_\+body\+\_\+deflate\+\_\+parser} (const \hyperlink{classnetflex_1_1parsing_1_1message__body__deflate__parser}{message\+\_\+body\+\_\+deflate\+\_\+parser} \&)=delete
\begin{DoxyCompactList}\small\item\em copy ctor \end{DoxyCompactList}\item
\mbox{\Hypertarget{classnetflex_1_1parsing_1_1message__body__deflate__parser_a5d5b893c9f2e32b2ec09cf16ada13c36}\label{classnetflex_1_1parsing_1_1message__body__deflate__parser_a5d5b893c9f2e32b2ec09cf16ada13c36}}
\hyperlink{classnetflex_1_1parsing_1_1message__body__deflate__parser}{message\+\_\+body\+\_\+deflate\+\_\+parser} \& \hyperlink{classnetflex_1_1parsing_1_1message__body__deflate__parser_a5d5b893c9f2e32b2ec09cf16ada13c36}{operator=} (const \hyperlink{classnetflex_1_1parsing_1_1message__body__deflate__parser}{message\+\_\+body\+\_\+deflate\+\_\+parser} \&)=delete
\begin{DoxyCompactList}\small\item\em assignment operator \end{DoxyCompactList}\item
\hyperlink{classnetflex_1_1parsing_1_1parser__iface}{parser\+\_\+iface} \& \hyperlink{classnetflex_1_1parsing_1_1message__body__deflate__parser_ad307d37f712b3e425bb2535f88546791}{operator$<$$<$} (std\+::string \&data)
\item
bool \hyperlink{classnetflex_1_1parsing_1_1message__body__deflate__parser_a2e80b1cc5a930497653e200c72adc4e5}{is\+\_\+done} (void) const
\end{DoxyCompactItemize}
\subsection*{Additional Inherited Members}

\subsection{Detailed Description}
parser for a deflated body

\subsection{Constructor \& Destructor Documentation}
\mbox{\Hypertarget{classnetflex_1_1parsing_1_1message__body__deflate__parser_a50f8b3c3bc5a6ad1b8bd63803d92c455}\label{classnetflex_1_1parsing_1_1message__body__deflate__parser_a50f8b3c3bc5a6ad1b8bd63803d92c455}}
\index{netflex\+::parsing\+::message\+\_\+body\+\_\+deflate\+\_\+parser@{netflex\+::parsing\+::message\+\_\+body\+\_\+deflate\+\_\+parser}!message\+\_\+body\+\_\+deflate\+\_\+parser@{message\+\_\+body\+\_\+deflate\+\_\+parser}}
\index{message\+\_\+body\+\_\+deflate\+\_\+parser@{message\+\_\+body\+\_\+deflate\+\_\+parser}!netflex\+::parsing\+::message\+\_\+body\+\_\+deflate\+\_\+parser@{netflex\+::parsing\+::message\+\_\+body\+\_\+deflate\+\_\+parser}}
\subsubsection{\texorpdfstring{message\+\_\+body\+\_\+deflate\+\_\+parser()}{message\_body\_deflate\_parser()}}
{\footnotesize\ttfamily netflex\+::parsing\+::message\+\_\+body\+\_\+deflate\+\_\+parser\+::message\+\_\+body\+\_\+deflate\+\_\+parser (\begin{DoxyParamCaption}\item[{\hyperlink{classnetflex_1_1http_1_1request}{http\+::request} \&}]{request }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [explicit]}}

default ctor

\begin{DoxyParams}{Parameters}
{\em request} & request to be initialized \\
\hline
\end{DoxyParams}

\subsection{Member Function Documentation}
\mbox{\Hypertarget{classnetflex_1_1parsing_1_1message__body__deflate__parser_a2e80b1cc5a930497653e200c72adc4e5}\label{classnetflex_1_1parsing_1_1message__body__deflate__parser_a2e80b1cc5a930497653e200c72adc4e5}}
\index{netflex\+::parsing\+::message\+\_\+body\+\_\+deflate\+\_\+parser@{netflex\+::parsing\+::message\+\_\+body\+\_\+deflate\+\_\+parser}!is\+\_\+done@{is\+\_\+done}}
\index{is\+\_\+done@{is\+\_\+done}!netflex\+::parsing\+::message\+\_\+body\+\_\+deflate\+\_\+parser@{netflex\+::parsing\+::message\+\_\+body\+\_\+deflate\+\_\+parser}}
\subsubsection{\texorpdfstring{is\+\_\+done()}{is\_done()}}
{\footnotesize\ttfamily bool netflex\+::parsing\+::message\+\_\+body\+\_\+deflate\+\_\+parser\+::is\+\_\+done (\begin{DoxyParamCaption}\item[{void}]{ }\end{DoxyParamCaption}) const\hspace{0.3cm}{\ttfamily [virtual]}}

\begin{DoxyReturn}{Returns}
whether the parsing is done or not
\end{DoxyReturn}

Implements \hyperlink{classnetflex_1_1parsing_1_1parser__iface_afebd1cc50d5958f712dfac0c023fd162}{netflex\+::parsing\+::parser\+\_\+iface}.

\mbox{\Hypertarget{classnetflex_1_1parsing_1_1message__body__deflate__parser_ad307d37f712b3e425bb2535f88546791}\label{classnetflex_1_1parsing_1_1message__body__deflate__parser_ad307d37f712b3e425bb2535f88546791}}
\index{netflex\+::parsing\+::message\+\_\+body\+\_\+deflate\+\_\+parser@{netflex\+::parsing\+::message\+\_\+body\+\_\+deflate\+\_\+parser}!operator$<$$<$@{operator$<$$<$}}
\index{operator$<$$<$@{operator$<$$<$}!netflex\+::parsing\+::message\+\_\+body\+\_\+deflate\+\_\+parser@{netflex\+::parsing\+::message\+\_\+body\+\_\+deflate\+\_\+parser}}
\subsubsection{\texorpdfstring{operator$<$$<$()}{operator<<()}}
{\footnotesize\ttfamily \hyperlink{classnetflex_1_1parsing_1_1parser__iface}{parser\+\_\+iface}\& netflex\+::parsing\+::message\+\_\+body\+\_\+deflate\+\_\+parser\+::operator$<$$<$ (\begin{DoxyParamCaption}\item[{std\+::string \&}]{data }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [virtual]}}

consume input data to parse it and init the request if not enough data is passed in, this method would need to be called again later input data is modified whenever a token is consumed by parsing, even if parsing is incomplete or invalid invalid data would lead to a raised exception

\begin{DoxyParams}{Parameters}
{\em data} & input data to be parsed \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
reference to the current object
\end{DoxyReturn}

Implements \hyperlink{classnetflex_1_1parsing_1_1parser__iface_a6b092567e70a5c0bf7568e94d06f7154}{netflex\+::parsing\+::parser\+\_\+iface}.

The documentation for this class was generated from the following file\+:\begin{DoxyCompactItemize}
\item
includes/netflex/parsing/message\+\_\+body\+\_\+deflate\+\_\+parser.\+hpp\end{DoxyCompactItemize}


text:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<META http-equiv="Content-Type" content="text/html; charset=utf-8">
<TITLE>
Uses of Package org.apache.solr.search.function (Solr 4.2.1 API)
</TITLE>

<META NAME="date" CONTENT="2013-03-26">

<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../../../stylesheet.css" TITLE="Style">

      Overview
      Package
      Class
    Use
      Tree
      Deprecated
      Help

 PREV
 NEXT

  FRAMES
 NO FRAMES

  All Classes

Uses of Package
org.apache.solr.search.function

Packages that use org.apache.solr.search.function

org.apache.solr.schema

IndexSchema and FieldType implementations for powering schema.xml

org.apache.solr.search

APIs and classes for parsing and processing search requests

Classes in org.apache.solr.search.function used by org.apache.solr.schema

FileFloatSource

          Obtains float field values from an external file.

Classes in org.apache.solr.search.function used by org.apache.solr.search

ValueSourceRangeFilter

          RangeFilter over a ValueSource.

      Overview
      Package
      Class
    Use
      Tree
      Deprecated
      Help

 PREV
 NEXT

  FRAMES
 NO FRAMES

  All Classes

          Copyright © 2000-2013 Apache Software Foundation.  All Rights Reserved.


text:
use ty::BuiltinType;

pub static PARAM_OFFSET: i32 = 16;

pub fn next_param_offset(param_offset: i32, _: BuiltinType) -> i32 {
    param_offset + 8
}


text:
package com.ghub.utils.jafw.filewatcher;

import java.io.File;
import java.net.URI;

import com.ghub.utils.jafw.filewatcher.core.AbstractFileListAdapter;
import com.ghub.utils.jafw.filewatcher.core.AbstractFileWatcher;
import com.ghub.utils.jafw.filewatcher.event.FileWatcherListener;
import com.ghub.utils.jafw.filewatcher.filter.FileFilter;

public class FileWatcher extends AbstractFileWatcher {

    /**
     * @param file
     */
    public FileWatcher(File file) {
	super(file, new DefaultFileListAdapter());
	setFileFilter(new DefaultFileFilter());
    }

    /**
     * @param filePath
     */
    public FileWatcher(URI filePath) {
	super(filePath, new DefaultFileListAdapter());
	setFileFilter(new DefaultFileFilter());
    }

    /**
     * accepts a File path, you can add your own FileListAdapter here e.g.
     * database? and a FileFilter for files that should be filtered when
     * processing the watch.
     *
     * @param file
     * @param fileListAdapter
     * @param fileFilter
     */
    public FileWatcher(File file, AbstractFileListAdapter fileListAdapter,
	    FileFilter fileFilter) {
	super(file, fileListAdapter);
	setFileFilter(fileFilter);
    }

    /**
     * accepts a URI file path, you can add your own FileListAdapter here e.g.
     * database? and a FileFilter for files that should be filtered when
     * processing the watch.
     *
     * @param filePath
     * @param fileListAdapter
     * @param fileFilter
     */
    public FileWatcher(URI filePath, AbstractFileListAdapter fileListAdapter,
	    FileFilter fileFilter) {
	super(filePath, fileListAdapter);
	setFileFilter(fileFilter);
    }

    /**
     * accepts a File, you can add your own FileListAdapter here e.g. database?
     *
     * @param file
     * @param fileListAdapter
     */
    public FileWatcher(File file, AbstractFileListAdapter fileListAdapter) {
	super(file, fileListAdapter);
	setFileFilter(new DefaultFileFilter());
    }

    /**
     * accepts a URI file path, you can add your own FileListAdapter here e.g.
     * database?
     *
     * @param filePath
     * @param fileListAdapter
     */
    public FileWatcher(URI filePath, AbstractFileListAdapter fileListAdapter) {
	super(filePath, fileListAdapter);
	setFileFilter(new DefaultFileFilter());
    }

    /*
     * (non-Javadoc)
     *
     * @see
     * com.ghub.utils.jafw.filewatcher.core.AbstractFileWatcher#addListener(
     * com.ghub.utils.jafw.filewatcher.event.FileWatcherListener)
     */
    public void addListener(FileWatcherListener listener) {
	super.addListener(listener);
    }

    /*
     * (non-Javadoc)
     *
     * @see java.lang.Runnable#run()
     */
    public void run() {
	while (!shouldStop) {
	    compare(getFile());
	}

    }

}


text:
layout: places
title: 24 Hours Street
lang: en
---

## 24 Hours Street

Opened in 1991, the 24 Hours Street was reopened in November 2011 and once again became a reference and meeting point for people looking for good food, gifts, reading and leisure downtown.

After the renovation, the Street displays again the architecture that made it known worldwide, with the large arches and the 24-hour clock, reopening with a varied mix of commerce and services.

It is also the venue of the Enjoy Curitiba space, a Tourist Care Center. There, visitors can find a wide range of tourist information about the city and can organize their stay in the capital of  Paraná, purchase products and tourist services.

*Address:*
Between Visconde de Nácar St. and Visconde do Rio Branco St.

*Opening hours:*
Daily.

*Access:*
Cândido Lopes St. / Carlos de Carvalho St. / Visconde de Nácar St.

<iframe style="width:100%; height:500px;" src="https://a.tiles.mapbox.com/v4/nolram.imlbm6c3/attribution,zoompan,zoomwheel,geocoder,share.html?access_token=pk.eyJ1Ijoibm9scmFtIiwiYSI6ImxwQndGSTQifQ.CiUt2RoqzvarItHA-wtPag"></iframe>


text:
@interface TCArrayViewerController : UITableViewController
- (id)initWithObject:(NSArray*)array;
@end


text:
(function(){
	"use strict";

	Meteor.publish("genres", function(){
		return Genres.find();
	});

	Meteor.publish("movies", function(){
		return Movies.find();
	});

}());


text:
<!DOCTYPE html>
<html>
  <head>
    <title>
      Test k-rate AudioParams
    </title>
    <script src="../../resources/testharness.js"></script>
    <script src="../../resources/testharnessreport.js"></script>
    <script src="../resources/audit-util.js"></script>
    <script src="../resources/audit.js"></script>
  </head>
  <body>
    <script id="layout-test-code">
      let sampleRate = 48000;
      let renderLength = 2048;
      let eventEndTime = 0.015;

      let audit = Audit.createTaskRunner()

      audit.define(
          {label: 'validate', description: 'Validate test parameters'},
          function(task, should) {
            should(eventEndTime, 'eventTime')
                .beLessThan(renderLength / sampleRate);
            task.done();
          });

      audit.define(
          {
            label: 'playbackrate+detune',
            description: 'Test k-rate AudioBufferSourceNode AudioParams'
          },
          function(task, should) {

            let context = new OfflineAudioContext(1, renderLength, sampleRate);
            let buffer = createConstantBuffer(context, renderLength, 1);
            let node = new AudioBufferSourceNode(context, {buffer: buffer});

            node.connect(context.destination);

            // Initialize detune and playbackRate to some non-zero value
            // (because we're using exponential ramps.  Then add exponential
            // ramp to some non-zero end value.  The actual values don't matter
            // as long as they're strictly positive.
            node.detune.setValueAtTime(0.125, 0);
            node.playbackRate.setValueAtTime(1, 0);

            node.detune.exponentialRampToValueAtTime(0.75, 0.015);
            node.playbackRate.exponentialRampToValueAtTime(0.5, 0.015);

            node.start();

            context.startRendering()
                .then(function() {
                  // The final values for each attribute should be the expected
                  // final value.
                  should(node.detune.value, 'Final node.detune.value')
                      .beEqualTo(0.75);
                  should(
                      node.playbackRate.value, 'Final node.playbackRate.value')
                      .beEqualTo(0.5);
                })
                .then(task.done.bind(task));
          });

      audit.define(
          {
            label: 'panner-k-rate',
            description:
                'Test k-rate PannerNode and AudioListenerNode AudioParams'
          },
          function(task, should) {

            let context = new OfflineAudioContext(1, renderLength, sampleRate);
            let buffer = createConstantBuffer(context, renderLength, 1);
            let source = new AudioBufferSourceNode(context, {buffer: buffer});

            let panner = new PannerNode(context, {panningModel: 'HRTF'});

            source.connect(panner).connect(context.destination);

            // Initialize the k-rate parameters to some positive value.  Then
            // add exponential ramp to some non-zero end value.  The actual
            // values don't matter as long as they're strictly positive.
            panner.orientationX.setValueAtTime(1, 0);
            panner.orientationY.setValueAtTime(1, 0);
            panner.orientationZ.setValueAtTime(1, 0);

            panner.positionX.setValueAtTime(5, 0);
            panner.positionY.setValueAtTime(5, 0);
            panner.positionZ.setValueAtTime(5, 0);

            context.listener.forwardX.setValueAtTime(1, 0);
            context.listener.forwardY.setValueAtTime(1, 0);
            context.listener.forwardZ.setValueAtTime(1, 0);

            context.listener.positionX.setValueAtTime(.5, 0);
            context.listener.positionY.setValueAtTime(.5, 0);
            context.listener.positionZ.setValueAtTime(.5, 0);

            context.listener.upX.setValueAtTime(1, 0);
            context.listener.upY.setValueAtTime(1, 0);
            context.listener.upZ.setValueAtTime(1, 0);

            panner.orientationX.exponentialRampToValueAtTime(2.5, 0.015);
            panner.orientationY.exponentialRampToValueAtTime(2.5, 0.015);
            panner.orientationZ.exponentialRampToValueAtTime(2.5, 0.015);

            panner.positionX.exponentialRampToValueAtTime(11, 0.015);
            panner.positionY.exponentialRampToValueAtTime(11, 0.015);
            panner.positionZ.exponentialRampToValueAtTime(11, 0.015);

            context.listener.forwardX.exponentialRampToValueAtTime(3, 0.015);
            context.listener.forwardY.exponentialRampToValueAtTime(3, 0.015);
            context.listener.forwardZ.exponentialRampToValueAtTime(3, 0.015);

            context.listener.positionX.exponentialRampToValueAtTime(0.5, 0.015);
            context.listener.positionY.exponentialRampToValueAtTime(0.5, 0.015);
            context.listener.positionZ.exponentialRampToValueAtTime(0.5, 0.015);

            context.listener.upX.exponentialRampToValueAtTime(4, 0.015);
            context.listener.upY.exponentialRampToValueAtTime(4, 0.015);
            context.listener.upZ.exponentialRampToValueAtTime(4, 0.015);

            source.start();

            context.startRendering()
                .then(function() {
                  // The final values for each attribute should be the expected
                  // final value.
                  should(
                      panner.orientationX.value,
                      'Final panner.orientationX.value')
                      .beEqualTo(2.5);
                  should(
                      panner.orientationY.value,
                      'Final panner.orientationY.value')
                      .beEqualTo(2.5);
                  should(
                      panner.orientationZ.value,
                      'Final panner.orientationZ.value')
                      .beEqualTo(2.5);
                  should(panner.positionX.value, 'Final panner.positionX.value')
                      .beEqualTo(11);
                  should(panner.positionY.value, 'Final panner.positionY.value')
                      .beEqualTo(11);
                  should(panner.positionZ.value, 'Final panner.positionZ.value')
                      .beEqualTo(11);

                  should(
                      context.listener.forwardX.value,
                      'Final context.listener.forwardX.value')
                      .beEqualTo(3);
                  should(
                      context.listener.forwardY.value,
                      'Final context.listener.forwardY.value')
                      .beEqualTo(3);
                  should(
                      context.listener.forwardZ.value,
                      'Final context.listener.forwardZ.value')
                      .beEqualTo(3);
                  should(
                      context.listener.positionX.value,
                      'Final context.listener.positionX.value')
                      .beEqualTo(0.5);
                  should(
                      context.listener.positionY.value,
                      'Final context.listener.positionY.value')
                      .beEqualTo(0.5);
                  should(
                      context.listener.positionZ.value,
                      'Final context.listener.positionZ.value')
                      .beEqualTo(0.5);
                  should(
                      context.listener.upX.value,
                      'Final context.listener.upX.value')
                      .beEqualTo(4);
                  should(
                      context.listener.upY.value,
                      'Final context.listener.upY.value')
                      .beEqualTo(4);
                  should(
                      context.listener.upZ.value,
                      'Final context.listener.upZ.value')
                      .beEqualTo(4);
                })
                .then(task.done.bind(task));
          });

      audit.run();
    </script>
  </body>
</html>


text:
from contextlib import contextmanager
import os
import subprocess

@contextmanager
def open_sorted_file(infile):
    temp_sorted_file = f'/tmp/find_longest_prefixes_{os.getpid()}.txt'
    cmd = f'sort < {infile}  > {temp_sorted_file}'
    subprocess.check_call(cmd, shell=True)
    try:
        with open(temp_sorted_file) as fin:
            yield fin
    finally:
        os.unlink(temp_sorted_file)

def verify_ordered(fin):
    """Pass-through generator, verifies the input file is sorted."""
    # For example, `$ env LC_COLLATE=C sort` might differ from python ordering.
    prev = ''
    for line in fin:
        assert prev <= line, line
        yield line

def longest_prefix_match(a, b):
    i = len(a)
    if (len(b) >= i
            and a == b[:i]):  # Fast path, new line B doesn't change the prefix A.
        return i

    i = 0  # Just in case A & B are the empty string.
    for i in range(min(map(len, (a, b)))):
        if a[i] != b[i]:
            assert a[:i] == b[:i]
            return i
    assert a[:i] == b[:i]
    return i

def longest_prefixes(infile):
    """Given a set of redis keys, or syslog messages, find the generating prefixes.

    For example:
        redis.set(f'bar-{guid}')
        redis.set(f'bazz-{guid}')
    would elicit two prefixes: ['bar-', 'bazz-'].
    Other services, such as syslog, would work similarly.
        syslog(f'bar-{guid} at {timestamp}')
        syslog(f'bazz-{guid} at {timestamp}')
    """

    assert ' ' not in infile, infile  # Why would we want quoting craziness?
    assert os.path.isfile(infile), infile
    pfx, prev_i = None, 0
    with open_sorted_file(infile) as fin:
        for line in verify_ordered(fin):
            line = line.rstrip()
            if len(line) == 0:
                continue  # Else an empty-string prefix could explain ALL lines.
            if pfx is None:
                pfx = line
                prev_i = len(line)
            i = longest_prefix_match(pfx, line)
            if i < prev_i:
                yield pfx
                pfx = line
            else:
                pfx = line[:i]
            prev_i = i
        yield pfx


text:
layout: post
title: Gelişimin Temel İlkerleri
date: 2011-12-02 10:23
author: admin
comments: true
tags: [baştan Ayağa İçten Dışa Doğrudur, Eğitim Bilimleri, Eğitim Bilimleri, Genelden Özele Doğrudur, Hızı Dönemlere Göre Değişebilir, Nöbetleşe Devam Eder, Yordanabilir (tahmin) edilebilir Sıra izler]
---
1- Süreklidir - Belirli Aşamalar Halinde Gerçekleşir

Döllenmeden başlayıp ölünceye kadar devam eder. İleriye doğrudur birikimli bir süreçtir. Her aşama kendinden öncekine dayalı sonraki aşamanın hazırlayıcısıdır. Bu aşamalar basitten karmaşığa doğrudur.

2- Yordanabilir (tahmin) edilebilir Bir Sıra izler

Bir sonraki olacak gelişim şeklinin tahmin edilebilmesidir.  Örn: gelişimle ilgili yapılan araştırmalar, akranlarına göre konuşmayı geç öğrenenlerin okumayı da geç öğrendikleri saptanmıştır. (kpss-2011)

3- Gelişim Nöbetleşe Devam Eder

Bir gelişim alanı hızlandığında bir başka gelişim alanı duraklayabilir. Örn: dil gelişimi ile yürüme gelişimi aynı döneme(0-2 yaş) denk gelir, bu durumda dil gelişimi bir süre duraklayabilir.

4- Gelişim Hızı Dönemlere Göre Değişebilir

Gelişimin hızlandığı veya yavaşladığı dönemler vardır. Örn: fiziksel gelişim en hızlı anne karnındayken son çocukluk döneminde yavaşlar ergenlikte ise tekrar artar.

5- Gelişim baştan Ayağa İçten Dışa Doğrudur

Önce başın hareketi kontrol eldir. Daha sonra göğüs, karın, bacaklar ve ayağın kontrolü sağlanır. Anne karnında önce iç organların oluşumu sonra ise el, kol bacaklar oluşur.

6- Gelişim Genelden Özele Doğrudur

Çocuklar önce tüm vücutlarıyla hareket eder sonra ise uygun kaslarını kullanırlar. Önce kalemi eliyle tutan bir çocuk sonra ise kalemi eli ile tutmaya başlar.

7- Gelişim Bir Bütündür

Gelişim alanları birbirleriyle etkileşim içindedir. Bir gelişim alanı diğer gelişim alanlarını olumlu ya da olumsuz etkileyebilir. Fiziksel olarak zayıf olan bir çocuğu arkadaşları oyunlarına dahil etmediklerinde, bu durum onun kişilik ve sosyal gelişimini etkileyecektir.

8- Gelişim Kalıtım ve Çevrenin Etkileşimin Ürünüdür

Fiziksel özelliklerimiz büyük oranda kalıtım belirlerken; psikolojik özelliklerimizi çevre belirler.

9- Gelişimde Kritik Dönemler Vardır

Organizmanın gelişmeye ve öğrenmeye eğimli ve duyarlı olduğu dönemler vardır. 6-7 yaşları yazma dil öğrenme açısından kritik dönemdirler.

10- Gelişimde Bireysel  Farklar Vardır

Her birey biriciktir. Tüm bireyler gelişimde aynı aşamalardan geçse de çevre kalıtsal durumlar nedeni ile aralarında farklılıklar olur.

<address> </address><address>bu çalışmanın oluşturulmasında   eğitim psikolojisi kitabı anı yay. ve yediiklim kpss kitaplarından yararlanılmıştır.</address>


text:
package org.apache.flink.streaming.api.functions.sink;

import java.io.Serializable;

import org.apache.flink.annotation.Public;
import org.apache.flink.api.common.functions.Function;

/**
 * Interface for implementing user defined sink functionality.
 *
 * @param <IN> Input type parameter.
 */
@Public
public interface SinkFunction<IN> extends Function, Serializable {

	/**
	 * Function for standard sink behaviour. This function is called for every record.
	 *
	 * @param value The input record.
	 * @throws Exception
	 */
	void invoke(IN value) throws Exception;
}


text:
namespace PseudoCQRS.Controllers
{
	public interface IViewPath
	{
		string ViewPath { get; }
	}
}


text:
"""
    AIs used to determine which move to pick in a battle.
"""
import random

class RandomMoveAi:
    """
        AI which just selects any move at random from the pool of available
        ones (i.e. those with PP > 0).
    """

    def __init__(self, battle_creature):
        self.battle_creature = battle_creature

    def select_move(self):
        """
            Should use struggle if the creature has no moves. Just doesn't
            select a move for now.
        """
        pp_moves = [move for move in self.battle_creature.creature.moves if move.pp > 0]
        if len(pp_moves) == 0:
            return None

        return random.choice(pp_moves)


text:
package org.nd4j.linalg.api.ops.impl.transforms;

import org.nd4j.linalg.api.complex.IComplexNumber;
import org.nd4j.linalg.api.ndarray.INDArray;
import org.nd4j.linalg.api.ops.BaseTransformOp;
import org.nd4j.linalg.api.ops.Op;
import org.nd4j.linalg.factory.Nd4j;

/**
 * Max out activation:
 * http://arxiv.org/pdf/1302.4389.pdf
 *
 * @author Adam Gibson
 */
public class MaxOut extends BaseTransformOp {

    private IComplexNumber maxComplex = Nd4j.createComplexNumber(Double.NaN, Double.NaN);
    private Number max = Double.NaN;

    public MaxOut() {
    }

    public MaxOut(INDArray x, INDArray z) {
        super(x, z);
    }

    public MaxOut(INDArray x, INDArray z, int n) {
        super(x, z, n);
    }

    public MaxOut(INDArray x, INDArray y, INDArray z, int n) {
        super(x, y, z, n);
    }

    public MaxOut(INDArray x) {
        super(x);
    }

    @Override
    public String name() {
        return "maxout";
    }

    @Override
    public IComplexNumber op(IComplexNumber origin, double other) {
        setMax(extraArgs);
        return maxComplex;
    }

    @Override
    public IComplexNumber op(IComplexNumber origin, float other) {
        setMax(extraArgs);
        return maxComplex;
    }

    @Override
    public IComplexNumber op(IComplexNumber origin, IComplexNumber other) {
        setMax(extraArgs);
        return maxComplex;
    }

    @Override
    public float op(float origin, float other) {
        setMax(extraArgs);
        return max.floatValue();
    }

    @Override
    public double op(double origin, double other) {
        setMax(extraArgs);
        return max.doubleValue();
    }

    @Override
    public double op(double origin) {
        setMax(extraArgs);
        return max.doubleValue();
    }

    @Override
    public float op(float origin) {
        setMax(extraArgs);
        return max.floatValue();
    }

    @Override
    public IComplexNumber op(IComplexNumber origin) {
        setMax(extraArgs);
        return maxComplex;
    }

    private void setMax(Object[] extraArgs) {
        if (extraArgs.length < 1)
            throw new IllegalArgumentException("Please specify a max value");
        if (Double.isNaN(max.doubleValue()) && extraArgs[0] instanceof Number) {
            max = Double.valueOf(extraArgs[0].toString());
        } else if (Double.isNaN(maxComplex.realComponent().doubleValue()) && extraArgs[0] instanceof IComplexNumber) {
            maxComplex = (IComplexNumber) extraArgs[0];
        }
    }

    @Override
    public Op opForDimension(int index, int dimension) {
        INDArray xAlongDimension = x.vectorAlongDimension(index, dimension);

        if (y() != null)
            return new MaxOut(xAlongDimension, y.vectorAlongDimension(index, dimension), z.vectorAlongDimension(index, dimension), xAlongDimension.length());
        else
            return new MaxOut(xAlongDimension, z.vectorAlongDimension(index, dimension), xAlongDimension.length());

    }

    @Override
    public Op opForDimension(int index, int... dimension) {
        INDArray xAlongDimension = x.tensorAlongDimension(index, dimension);

        if (y() != null)
            return new MaxOut(xAlongDimension, y.tensorAlongDimension(index, dimension), z.tensorAlongDimension(index, dimension), xAlongDimension.length());
        else
            return new MaxOut(xAlongDimension, z.tensorAlongDimension(index, dimension), xAlongDimension.length());

    }

}


text:
""" A script to build specific fasta databases """
from __future__ import print_function

import collections
import sys

Sequence = collections.namedtuple('Sequence', ['header', 'sequence'])

def FASTAReader_gen(fasta_filename):
    with open(fasta_filename) as fasta_file:
        line = fasta_file.readline()
        while True:
            if not line:
                return
            assert line.startswith('>'), "FASTA headers must start with >"
            header = line.rstrip()
            sequence_parts = []
            line = fasta_file.readline()
            while line and line[0] != '>':
                sequence_parts.append(line.rstrip())
                line = fasta_file.readline()
            sequence = "".join(sequence_parts)
            yield Sequence(header, sequence)

def target_match(target, search_entry):
    ''' Matches '''
    search_entry = search_entry.upper()
    for atarget in target:
        if search_entry.find(atarget) > -1:
            return atarget
    return None

def main():
    used_sequences = set()
    work_summary = {'wanted': 0, 'found': 0, 'duplicates': 0}

    with open(sys.argv[1]) as f_target:
        targets = [">%s" % _.strip().upper() for _ in f_target]

    work_summary['wanted'] = len(targets)

    for entry in FASTAReader_gen(sys.argv[2]):
        target_matched_results = target_match(targets, entry.header)
        if target_matched_results:
            work_summary['found'] += 1
            targets.remove(target_matched_results)
            sequence = entry.sequence
            used_sequences.add(sequence)
            print(entry.header)
            print(sequence)

if __name__ == "__main__":
    main()


text:
/*jslint browser: true, white: true*/
"use strict";

var api = window.api || {};

// Class: Creature
// ======================================
api.Creature = function () {

  // id - String: lowercase only
  // name - String
  // team - arrayIndex
  // player - arrayIndex
  // location - Pt
  // visibleTiles - [[Tile]]
  // actionQueue - []
  // inventory - [Equipment]
  // conditions - [Condition]
  // spells - [Spell]
  // spellsPerSchool - int
  // spellSchoolsKnown - [spellSchoolID];
  // graphics - JSON

  /* Integer Stats
  ********************/
  // body, bodyToltal
  // mind, mindTotal
  // move, moveTotal, moveDice
  // attack, attackChance
  // defence, defenceChance
  // disarmChance
  // actions, actionsTotal
  // attacks, attacksTotal
  // searches, searchesTotal, searchRadius

  /* Boolean Stats
  ********************/
  // canActivateTriggers
  // canActivateWalls
  // canRevealMap

  /* Methods
  ********************/
  // rollMove() - rolls moveDice + moveTotal
  // heal(amount)
  // damage(amount)
  // die()
  // move(Pt)
  // attack(Creature)
  // defend() - returns defence rolls [int]
  // search(Furniture) - for treasure
  // search(Pt) - for traps
  // activate(Wall) - eg. open door
  // activate(Trigger) - eg. step on trap
  // trade(Creature|Furniture, Equipment, quantity)
  // add(Equipment, quantity)
  // remove(Equipment, quantity)
  // drop(Equipment, quantity)
  // buy(Equipment, quantity)
  // addCondition(Condition)
  // removeCondition(Condition)

  /* Check methods (Return Boolean)
  ********************/
  // canMove(Pt)
  // canAttack(Creature)
  // .. pretty much most methods with 'can'

};


text:
<?php namespace Cmsable\Controller;

use Route;

trait ControllerRouteTrait{

    public static $crudDefaults = [

        // list resources: GET $path/
        'index'   => [
            'verb' => 'get',
            'path' => ''
         ],

         // show the page (form) to create a resource: GET $path/create
        'create'  => [
            'verb' => 'get',
            'path' => '/create'
        ],

        // create the resource: POST $path/create
        'store'   => [
            'verb' => 'post',
            'path' => '/create'
        ],

        // show a resource: GET $path/show/{id}
        'show'    => [
            'verb' => 'get',
            'path' => '/show/{id}'
        ],

        // show the page (form) to edit a resource: GET $path/edit/{id}
        'edit'    => [
            'verb' => 'get',
            'path' => '/edit/{id}'
        ],

        // update the resource (after submitting edit form): POST $path/edit/{id}
        'update'  => [
            'verb' => 'post',
            'path' => '/edit/{id}'
        ],

        // delete a resource: GET $path/destroy
        'destroy' => [
            'verb' => 'get',
            'path' => '/destroy/{id?}'
        ]
    ];

    public static $treeDefaults = [

        // Show the tree: GET $path/tree
        'tree' => [
            'verb' => 'get',
            'path' => '/tree/{id?}'
        ],

        // Move a node: GET $path/move/{id}
        'move' => [
            'verb' => 'get',
            'path' => '/move/{id}'
        ]

    ];

    /**
     * @brief Creates all routes to edit a resource. Laravel own
     *        Route::resource uses put/patch and delete verbs, which are not
     *        valid HTML in form methods. The method I prefer is to have the
     *        same url for create/store and edit/delete to simply set form
     *        actions
     *
     * @param string $path Your route path
     * @param string $class The controller class (if not passed this)
     * @param string $name A manual passed name
     **/
    public static function crudRoute($path, $class=NULL, $name=NULL){

        $class = ($class === NULL) ? get_called_class() : $class;

        $name = ($name === NULL) ? str_replace('/','.',trim($path,'/')) : $name;

        $path = rtrim($path,'/');

        static::assignRoutes($path, $class, $name, static::$crudDefaults);

    }

    public static function crudTreeRoute($path, $class=NULL, $name=NULL){

        $class = ($class === NULL) ? get_called_class() : $class;

        $name = ($name === NULL) ? str_replace('/','.',trim($path,'/')) : $name;

        $path = rtrim($path,'/');

        $routeData = array_merge(static::$crudDefaults, static::$treeDefaults);

        static::assignRoutes($path, $class, $name, $routeData);

    }

    protected static function assignRoutes($path, $class, $name, array $routeData){

        $router = Route::getFacadeRoot();

        foreach($routeData as $method=>$data){

            $router->{$data['verb']}($path.$data['path'],[
                'as' => "$name.$method",
                'uses' => "$class@$method"
            ]);

        }

    }

}


text:
this.nbl = {
	c: document,
	q: {}, // The dictionary that will hold the script-queue
  n: null,

  // The loader function
  //
  // Called with an array, it will interpret the options array
  // Called without an array it will try to load the options from the script-tag's data-nbl attribute
	l: function(a) {
    var b, c, x, y, z, s, l, i = j = 0, m = this; m.h = m.c.head || m.c.body || m.c.documentElement || m.h;

    // The timeout counter, counts backwards every 50ms from 50 ticks (50*50=2500ms by default)
    if (!m.i) {
      m.s = m.f = 0; // Reset counters: completed, created, timeout function
      m.i = setInterval(
        function() {
          // If the timeout counter dips below zero, or the amount of completed scripts equals the amount
          // of created script-tags, we can clear the interval
          if (m.o < 0 || m.s == 0) {
            m.i = clearInterval(m.i);
            // If the amount of completed scripts is smaller than the amount of created script-tags,
            // and there is a timeout function available, call it with the current script-queue.
            (m.s > 0 && m.f) && m.f(m.q)
          }
          m.o--
        },
        m.o = 50 // Set the initial ticks at 50, as well as the interval at 50ms
      );
    }

    // If no arguments were given (a == l, which is null), try to load the options from the script tag
    if (a == m.n) {
      s = m.c.getElementsByTagName("script"); // Get all script tags in the current document
      while (j < s.length) {
        if ((a = eval("("+s[j].getAttribute("data-nbl")+")")) && a) { // Check for the data-nbl attribute
          m.h = s[j].parentNode;
          break
        }
        j++
      }
    }

    // If an options array was provided, proceed to interpret it
    if (a&&a.shift) {
	    while (i < a.length) { // Loop through the options
        b = a[i]; // Get the current element
        c = a[i+1]; // Get the next element
        x = 'function';
        y = typeof b;
        z = typeof c;
        l = (z == x) ? c : (y == x) ? b : m.n; // Check whether the current or next element is a function and store it
        if (y == 'number') m.o = b/50; // If the current element is a number, set the timeout interval to this number/50
        // If the current element is a string, call this.a() with the string as a one-element array and the callback function l
        if (y == 'string') m.a([b], l);
        // If the current element is an array, call this.a() with a two-element array of the string and the next element
        // as well as the callback function l
        b.shift && m.a([b.shift(), b], l);
        if (!m.f && l) m.f = l; // Store the function l as the timeout function if it hasn't been set yet
        i++
      }
    }
  },
  a: function(u,l) {
    var s, m = this, n = u[0].replace(/.+\/|\.min\.js|\.js|\?.+|\W/gi, ''); // Clean up the name of the script for storage in the queue
    s = m.q[n] = m.c.createElement("script");
		s.setAttribute("src", u[0]);
		// When this script completes loading, it will trigger a callback function consisting of two things:
		// 1. It will call nbl.l() with the remaining items in u[1] (if there are any)
		// 2. It will execute the function l (if it is a function)
    s.onload = s.onreadystatechange = function(){
      var s = this, d = function(){
        var s = m, r = u[1];
        s.q[n] = true; // Set the entry for this script in the script-queue to true
        r && s.l(r); // Call nbl.l() with the remaining elements of the original array
        l && l(); // Call the callback function l
        s.s--
      };
      if ( !s.readyState || /de|te/.test( s.readyState ) ) {
        s.onload = s.onreadystatechange = m.n; d() // On completion execute the callback function as defined above
      }
    };
		m.s++;
		m.h.appendChild(s) // Add the script to the document
  }
};
nbl.l()