text:
<?php
/**
 * PHPTAL templating engine
 *
 * PHP Version 5
 *
 * @category HTML
 * @package  PHPTAL
 * @author   Laurent Bedubourg <lbedubourg@motion-twin.com>
 * @author   Kornel Lesiński <kornel@aardvarkmedia.co.uk>
 * @license  http://www.gnu.org/licenses/lgpl.html GNU Lesser General Public License
 * @version  SVN: $Id$
 * @link     http://phptal.org/
 */

/**
 * TAL Specifications 1.4
 *
 *       argument             ::= attribute_statement [';' attribute_statement]*
 *       attribute_statement  ::= attribute_name expression
 *       attribute_name       ::= [namespace ':'] Name
 *       namespace            ::= Name
 *
 * examples:
 *
 *      <a href="/sample/link.html"
 *         tal:attributes="href here/sub/absolute_url">
 *      <textarea rows="80" cols="20"
 *         tal:attributes="rows request/rows;cols request/cols">
 *
 * IN PHPTAL: attributes will not work on structured replace.
 *
 * @package PHPTAL
 * @subpackage Php.attribute.tal
 * @author Laurent Bedubourg <lbedubourg@motion-twin.com>
 */
class PHPTAL_Php_Attribute_TAL_Attributes
extends PHPTAL_Php_Attribute
implements PHPTAL_Php_TalesChainReader
{
    /** before creates several variables that need to be freed in after */
    private $vars_to_recycle = array();

    /**
     * value for default keyword
     */
    private $_default_escaped;

    public function before(PHPTAL_Php_CodeWriter $codewriter)
    {
        // split attributes using ; delimiter
        $attrs = $codewriter->splitExpression($this->expression);
        foreach ($attrs as $exp) {
            list($qname, $expression) = $this->parseSetExpression($exp);
            if ($expression) {
                $this->prepareAttribute($codewriter, $qname, $expression);
            }
        }
    }

    private function prepareAttribute(PHPTAL_Php_CodeWriter $codewriter, $qname, $expression)
    {
        $tales_code = $this->extractEchoType($expression);
        $code = $codewriter->evaluateExpression($tales_code);

        // XHTML boolean attribute does not appear when empty or false
        if (PHPTAL_Dom_Defs::getInstance()->isBooleanAttribute($qname)) {

            // I don't want to mix code for boolean with chained executor
            // so compile it again to simple expression
            if (is_array($code)) {
                $code = PHPTAL_Php_TalesInternal::compileToPHPExpression($tales_code);
            }
            return $this->prepareBooleanAttribute($codewriter, $qname, $code);
        }

        // if $code is an array then the attribute value is decided by a
        // tales chained expression
        if (is_array($code)) {
            return $this->prepareChainedAttribute($codewriter, $qname, $code);
        }

        // i18n needs to read replaced value of the attribute, which is not possible if attribute is completely replaced with conditional code
        if ($this->phpelement->hasAttributeNS('http://xml.zope.org/namespaces/i18n', 'attributes')) {
            $this->prepareAttributeUnconditional($codewriter, $qname, $code);
        } else {
            $this->prepareAttributeConditional($codewriter, $qname, $code);
        }
    }

    /**
     * attribute will be output regardless of its evaluated value. NULL behaves just like "".
     */
    private function prepareAttributeUnconditional(PHPTAL_Php_CodeWriter $codewriter, $qname, $code)
    {
        // regular attribute which value is the evaluation of $code
        $attkey = $this->getVarName($qname, $codewriter);
        if ($this->_echoType == PHPTAL_Php_Attribute::ECHO_STRUCTURE) {
            $value = $codewriter->stringifyCode($code);
        } else {
            $value = $codewriter->escapeCode($code);
        }
        $codewriter->doSetVar($attkey, $value);
        $this->phpelement->getOrCreateAttributeNode($qname)->overwriteValueWithVariable($attkey);
    }

    /**
     * If evaluated value of attribute is NULL, it will not be output at all.
     */
    private function prepareAttributeConditional(PHPTAL_Php_CodeWriter $codewriter, $qname, $code)
    {
        // regular attribute which value is the evaluation of $code
        $attkey = $this->getVarName($qname, $codewriter);

        $codewriter->doIf("null !== ($attkey = ($code))");

        if ($this->_echoType !== PHPTAL_Php_Attribute::ECHO_STRUCTURE)
            $codewriter->doSetVar($attkey, $codewriter->str(" $qname=\"").".".$codewriter->escapeCode($attkey).".'\"'");
        else
            $codewriter->doSetVar($attkey, $codewriter->str(" $qname=\"").".".$codewriter->stringifyCode($attkey).".'\"'");

        $codewriter->doElse();
        $codewriter->doSetVar($attkey, "''");
        $codewriter->doEnd('if');

        $this->phpelement->getOrCreateAttributeNode($qname)->overwriteFullWithVariable($attkey);
    }

    private function prepareChainedAttribute(PHPTAL_Php_CodeWriter $codewriter, $qname, $chain)
    {
        $this->_default_escaped = false;
        $this->_attribute = $qname;
        if ($default_attr = $this->phpelement->getAttributeNode($qname)) {
            $this->_default_escaped = $default_attr->getValueEscaped();
        }
        $this->_attkey = $this->getVarName($qname, $codewriter);
        $executor = new PHPTAL_Php_TalesChainExecutor($codewriter, $chain, $this);
        $this->phpelement->getOrCreateAttributeNode($qname)->overwriteFullWithVariable($this->_attkey);
    }

    private function prepareBooleanAttribute(PHPTAL_Php_CodeWriter $codewriter, $qname, $code)
    {
        $attkey = $this->getVarName($qname, $codewriter);

        if ($codewriter->getOutputMode() === PHPTAL::HTML5) {
            $value  = "' $qname'";
        } else {
            $value  = "' $qname=\"$qname\"'";
        }
        $codewriter->doIf($code);
        $codewriter->doSetVar($attkey, $value);
        $codewriter->doElse();
        $codewriter->doSetVar($attkey, '\'\'');
        $codewriter->doEnd('if');
        $this->phpelement->getOrCreateAttributeNode($qname)->overwriteFullWithVariable($attkey);
    }

    private function getVarName($qname, PHPTAL_Php_CodeWriter $codewriter)
    {
        $var = $codewriter->createTempVariable();
        $this->vars_to_recycle[] = $var;
        return $var;
    }

    public function after(PHPTAL_Php_CodeWriter $codewriter)
    {
        foreach ($this->vars_to_recycle as $var) $codewriter->recycleTempVariable($var);
    }

    public function talesChainNothingKeyword(PHPTAL_Php_TalesChainExecutor $executor)
    {
        $codewriter = $executor->getCodeWriter();
        $executor->doElse();
        $codewriter->doSetVar(
            $this->_attkey,
            "''"
        );
        $executor->breakChain();
    }

    public function talesChainDefaultKeyword(PHPTAL_Php_TalesChainExecutor $executor)
    {
        $codewriter = $executor->getCodeWriter();
        $executor->doElse();
        $attr_str = ($this->_default_escaped !== false)
            ? ' '.$this->_attribute.'='.$codewriter->quoteAttributeValue($this->_default_escaped)  // default value
            : '';                                 // do not print attribute
        $codewriter->doSetVar($this->_attkey, $codewriter->str($attr_str));
        $executor->breakChain();
    }

    public function talesChainPart(PHPTAL_Php_TalesChainExecutor $executor, $exp, $islast)
    {
        $codewriter = $executor->getCodeWriter();

        if (!$islast) {
            $condition = "!phptal_isempty($this->_attkey = ($exp))";
        } else {
            $condition = "null !== ($this->_attkey = ($exp))";
        }
        $executor->doIf($condition);

        if ($this->_echoType == PHPTAL_Php_Attribute::ECHO_STRUCTURE)
            $value = $codewriter->stringifyCode($this->_attkey);
        else
            $value = $codewriter->escapeCode($this->_attkey);

        $codewriter->doSetVar($this->_attkey, $codewriter->str(" {$this->_attribute}=\"").".$value.'\"'");
    }
}


text:
import random

# Refactored for Exercise 1 and Advanced Exercise 1
class Player(object):
    def __init__(self, name=None, level=1, **kwargs):
        self.name = name
        self.level = level
        self.set_health()
        for key, val in kwargs:
            setattr(self, key, val)

    def attack(self):
        return int(random.uniform(10, 50) * self.level)

    def set_health(self):
        setattr(self, 'health', 500 * pow(self.level, 2))

    def __str__(self):
        return self.name

redpajama_set_name: RedPajamaGithub


text:
package fr.fablabmars.vue;

import java.awt.CardLayout;
import java.util.ArrayList;

import fr.fablabmars.controler.menu.MenuAbstractControler;
import fr.fablabmars.model.CardMenu;
import fr.fablabmars.observer.Observable;
import fr.fablabmars.observer.Observer;

/**
 * Regroupement de plusieurs panels organisés en CardLayout
 * <p>
 * Observe le model et met le panel correspondant au menu courant au premier plan.
 * </p>
 * @author Guillaume Perouffe
 *
 */
public class CardMenuPanel extends ControlledPane implements Observer {

	private static final long serialVersionUID = 2108235528799058080L;

	/**
	 * Liste des noms des panneaux
	 */
	private ArrayList<String> listContent = new ArrayList<String>();

	/**
	 * CardLayout du Panel
	 */
	private CardLayout cl;

	/**
	 * Constructeur de CardMenuPanel
	 *
	 * @param panels
	 * 			Panneaux à ajouter dans le CardMenu
	 * @param controler
	 * 			Contrôleur du menu
	 *
	 * @see ControlledPane
	 * @see MenuAbstractControler
	 */
	public CardMenuPanel(ArrayList<ControlledPane> panels, MenuAbstractControler controler){
		super();

		controler.getObservable().addObserver(this);

		cl = new CardLayout();
		this.setLayout(cl);
		for(int i=0;i<panels.size();i++){
			ControlledPane pan = panels.get(i);
			pan.setControler(controler);
			listContent.add(new String(""+i));
			this.add(pan, listContent.get(i));
		}
	}

	@Override
	public void update(Observable obs) {
		if(obs instanceof CardMenu){
			cl.show(this, listContent.get(((CardMenu)obs).getState()));
		}
	}
}
;


text:
package com.freetymekiyan.algorithms.level.medium;

import java.util.*;

/**
 * 721. Accounts Merge
 *

 * Given a list accounts, each element accounts[i] is a list of strings, where the first element accounts[i][0] is a
 * name, and the rest of the elements are emails representing emails of the account.
 *

 * Now, we would like to merge these accounts. Two accounts definitely belong to the same person if there is some email
 * that is common to both accounts. Note that even if two accounts have the same name, they may belong to different
 * people as people could have the same name. A person can have any number of accounts initially, but all of their
 * accounts definitely have the same name.
 *

 * After merging the accounts, return the accounts in the following format: the first element of each account is the
 * name, and the rest of the elements are emails in sorted order. The accounts themselves can be returned in any order.
 *

 * Example 1:
 * Input:
 * |accounts =
 * |[
 * |  ["John", "johnsmith@mail.com", "john00@mail.com"],
 * |  ["John", "johnnybravo@mail.com"],
 * |  ["John", "johnsmith@mail.com", "john_newyork@mail.com"],
 * |  ["Mary", "mary@mail.com"]
 * |]
 *

 * Output:
 * |[
 * |  ["John", "john00@mail.com", "john_newyork@mail.com", "johnsmith@mail.com"],
 * |  ["John", "johnnybravo@mail.com"],
 * |  ["Mary", "mary@mail.com"]
 * |]
 *

 * Explanation:
 * The first and third John's are the same person as they have the common email "johnsmith@mail.com".
 * The second John and Mary are different people as none of their email addresses are used by other accounts.
 * We could return these lists in any order, for example the answer [['Mary', 'mary@mail.com'], ['John',
 * 'johnnybravo@mail.com'],
 * ['John', 'john00@mail.com', 'john_newyork@mail.com', 'johnsmith@mail.com']] would still be accepted.
 * Note:
 *

 * The length of accounts will be in the range [1, 1000].
 * The length of accounts[i] will be in the range [1, 10].
 * The length of accounts[i][j] will be in the range [1, 30].
 *

 * Related Topics: Depth-first Search, Union Find
 * Similar Questions: (M) Redundant Connection, (E) Sentence Similarity, (M) Sentence Similarity II
 */
public class AccountsMerge {

    /**
     * Union-Find.
     * Each person is a connected component.
     * Each email is just a graph node.
     * Generate an ID for each email, since email is the key to decide whether two accounts are the same.
     * Create an array of ID's, which has at most 9000.
     * Initialize each of them to be unique.
     * For each account:
     * | Generate one unique id for one unique email.
     * | Record which name an email points to.
     * | Union all emails to one single email so that we can use any one to judge whether 2 accounts are of same person.
     * Then group emails by ID to find out the emails of each person.
     * Then sort the emails and insert name to be the first element.
     */
    public List<List<String>> accountsMerge(List<List<String>> accounts) {
        Map<String, Integer> emailToId = new HashMap<>();
        Map<String, String> emailToName = new HashMap<>();
        int[] ids = new int[9000]; // 1000 account * 9 emails at most.
        for (int i = 0; i < ids.length; i++) ids[i] = i;
        int id = 0;
        for (List<String> account : accounts) {
            String name = null;
            for (String email : account) {
                if (name == null) {
                    name = email; // First element is the name of this account.
                } else {
                    emailToId.putIfAbsent(email, id); // Generate an ID for each email.
                    id++;
                    emailToName.put(email, name); // Record the name of each email.
                    union(email, account.get(1), emailToId, ids); // Union all emails to the first email.
                }
            }
        }
        Map<Integer, List<String>> idToEmails = new HashMap<>();
        for (Map.Entry<String, Integer> entry : emailToId.entrySet()) {
            // Same as: idToEmails.computeIfAbsent(find(entry.getValue(), ids), ArrayList::new).add(entry.getKey());
            int root = find(entry.getValue(), ids);
            if (!idToEmails.containsKey(root)) {
                idToEmails.put(root, new ArrayList<>());
            }
            idToEmails.get(root).add(entry.getKey());
        }
        for (List<String> emails : idToEmails.values()) {
            Collections.sort(emails);
            emails.add(0, emailToName.get(emails.get(0)));
        }
        return new ArrayList<>(idToEmails.values());
    }

    private void union(String email1, String email2, Map<String, Integer> emailToId, int[] ids) {
        int r1 = find(emailToId.get(email1), ids);
        int r2 = find(emailToId.get(email2), ids);
        if (r1 != r2) {
            ids[r1] = r2;
        }
    }

    private int find(int i, int[] ids) {
        while (i != ids[i]) {
            ids[i] = ids[ids[i]];
            i = ids[i];
        }
        return i;
    }

    /**
     * DFS.
     * Build a graph to connect adjacent emails together.
     * Traverse the graph.
     * If the email is not visited, dfs to get all emails. Sort and add the name.
     * If the email is visited, skip to the next.
     */
    public List<List<String>> accountsMerge2(List<List<String>> accounts) {
        Map<String, List<String>> graph = new HashMap<>();
        Map<String, String> emailToName = new HashMap<>();
        for (List<String> account : accounts) {
            String name = null;
            for (String s : account) {
                if (name == null) {
                    name = s;
                    continue;
                }
                emailToName.put(s, name);
                graph.computeIfAbsent(account.get(1), x -> new ArrayList<>()).add(s);
                graph.computeIfAbsent(s, x -> new ArrayList<>()).add(account.get(1));
            }
        }

        Set<String> visited = new HashSet<>();
        List<List<String>> merged = new ArrayList<>();
        for (String email : graph.keySet()) {
            if (!visited.contains(email)) {
                List<String> account = new ArrayList<>();
                Stack<String> stack = new Stack<>();
                stack.push(email);
                visited.add(email);
                while (!stack.isEmpty()) {
                    String top = stack.pop();
                    account.add(top);
                    for (String neighbor : graph.get(top)) {
                        if (!visited.contains(neighbor)) {
                            stack.push(neighbor);
                            visited.add(neighbor);
                        }
                    }
                }
                Collections.sort(account);
                account.add(0, emailToName.get(email));
                merged.add(account);
            }
        }
        return merged;
    }

    /**
     * Union-Find with a separate class.
     */
    public List<List<String>> accountsMerge3(List<List<String>> accounts) {
        UnionFind uf = new UnionFind();
        HashMap<String, Integer> emailToId = new HashMap<>(); // Email to id mapping.
        HashMap<String, String> emailToName = new HashMap<>(); // Email to name mapping.
        int id = 0;
        for (List<String> account : accounts) {
            String name = null;
            for (String email : account) {
                // First position is account name.
                if (name == null) {
                    name = email;
                    continue;
                }
                emailToId.putIfAbsent(email, id++);
                emailToName.put(email, name);
                uf.union(emailToId.get(account.get(1)), emailToId.get(email));
            }
        }
        // Group all the emails by connected component id.
        Map<Integer, List<String>> idToEmails = new HashMap<>();
        for (Map.Entry<String, Integer> entry : emailToId.entrySet()) {
            idToEmails.computeIfAbsent(uf.find(entry.getValue()), ArrayList::new).add(entry.getKey());
        }
        // Sort and insert name in the front of each list.
        for (List<String> emails : idToEmails.values()) {
            Collections.sort(emails);
            emails.add(0, emailToName.get(emails.get(0)));
        }
        return new ArrayList<>(idToEmails.values());
    }

    class UnionFind {

        // length of accounts * length of account.
        private static final int SIZE = 10000; // Even 9000 should enough.
        private int[] ids;

        public UnionFind() {
            this.ids = new int[SIZE];
            for (int i = 0; i < ids.length; i++) {
                ids[i] = i;
            }
        }

        public void union(int i1, int i2) {
            int id1 = find(i1);
            int id2 = find(i2);
            if (id1 != id2) {
                ids[id1] = id2;
            }
        }

        public int find(int i) {
            while (i != ids[i]) {
                ids[i] = ids[ids[i]]; // Path compression.
                i = ids[i];
            }
            return i;
        }
    }
}


text:
@interface JDRefreshDelegate : NSObject <JDBaseScrollViewRefreshDelegate>

@end


text:
/*
 * Copyright (c) 2002-2015, the original author or authors.
 *
 * This software is distributable under the BSD license. See the terms of the
 * BSD license in the documentation provided with this software.
 *
 * http://www.opensource.org/licenses/bsd-license.php
 */
/**
 * Console support.
 *
 * @since 2.0
 */
package jline.console;


text:
package v1

import (
	v1 "github.com/openshift/api/template/v1"
	corev1 "k8s.io/api/core/v1"
	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)

// TemplateInstanceConditionApplyConfiguration represents an declarative configuration of the TemplateInstanceCondition type for use
// with apply.
type TemplateInstanceConditionApplyConfiguration struct {
	Type               *v1.TemplateInstanceConditionType `json:"type,omitempty"`
	Status             *corev1.ConditionStatus           `json:"status,omitempty"`
	LastTransitionTime *metav1.Time                      `json:"lastTransitionTime,omitempty"`
	Reason             *string                           `json:"reason,omitempty"`
	Message            *string                           `json:"message,omitempty"`
}

// TemplateInstanceConditionApplyConfiguration constructs an declarative configuration of the TemplateInstanceCondition type for use with
// apply.
func TemplateInstanceCondition() *TemplateInstanceConditionApplyConfiguration {
	return &TemplateInstanceConditionApplyConfiguration{}
}

// WithType sets the Type field in the declarative configuration to the given value
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
// If called multiple times, the Type field is set to the value of the last call.
func (b *TemplateInstanceConditionApplyConfiguration) WithType(value v1.TemplateInstanceConditionType) *TemplateInstanceConditionApplyConfiguration {
	b.Type = &value
	return b
}

// WithStatus sets the Status field in the declarative configuration to the given value
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
// If called multiple times, the Status field is set to the value of the last call.
func (b *TemplateInstanceConditionApplyConfiguration) WithStatus(value corev1.ConditionStatus) *TemplateInstanceConditionApplyConfiguration {
	b.Status = &value
	return b
}

// WithLastTransitionTime sets the LastTransitionTime field in the declarative configuration to the given value
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
// If called multiple times, the LastTransitionTime field is set to the value of the last call.
func (b *TemplateInstanceConditionApplyConfiguration) WithLastTransitionTime(value metav1.Time) *TemplateInstanceConditionApplyConfiguration {
	b.LastTransitionTime = &value
	return b
}

// WithReason sets the Reason field in the declarative configuration to the given value
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
// If called multiple times, the Reason field is set to the value of the last call.
func (b *TemplateInstanceConditionApplyConfiguration) WithReason(value string) *TemplateInstanceConditionApplyConfiguration {
	b.Reason = &value
	return b
}

// WithMessage sets the Message field in the declarative configuration to the given value
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
// If called multiple times, the Message field is set to the value of the last call.
func (b *TemplateInstanceConditionApplyConfiguration) WithMessage(value string) *TemplateInstanceConditionApplyConfiguration {
	b.Message = &value
	return b
}


text:
package me.saghm.itstwittertime;

import android.app.Activity;
import android.os.AsyncTask;
import android.os.Bundle;
import android.util.Log;

import com.google.android.gms.common.ConnectionResult;
import com.google.android.gms.common.api.GoogleApiClient;
import com.google.android.gms.wearable.Wearable;

import twitter4j.Twitter;
import twitter4j.Paging;
import twitter4j.TwitterException;

import java.util.List;

public class Connector extends AsyncTask<Connector.ActivityAndString, Void, Connector.ActivityAndStrings> {
    private Twitter twitter;

    public static class ActivityAndString {
        Activity activity;
        String string;

        ActivityAndString(Activity activity, String string) {
            this.activity = activity;
            this.string  = string;
        }
    }

    class ActivityAndStrings extends ActivityAndString {
        String otherString;

        ActivityAndStrings(ActivityAndString activityAndString, String otherString) {
            super(activityAndString.activity, activityAndString.string);
            this.otherString = otherString;
        }
    }

    GoogleApiClient mGoogleAppiClient;

    protected ActivityAndStrings doInBackground(ActivityAndString...activities) {
        try {
            Start start = (Start)activities[0].activity;
            twitter     = start.twitter;
            twitter.setOAuthAccessToken(start.accessToken);
            Log.i("token", start.accessToken.getToken());
        } catch (Exception e) {
            Log.i("mobile", ExceptionParser.parse(e));
            return new ActivityAndStrings(activities[0], "%%%___%%%");
        }

        List<twitter4j.Status> statuses;
        try {
            statuses = twitter.getHomeTimeline(new Paging(1, 100));
        } catch (TwitterException e) {
            Log.i("exception", ExceptionParser.parse(e));
            String s = e.getErrorCode() == 88 ?
                        "###___###" :
                        "^^^___^^^";
            return new ActivityAndStrings(activities[0], s);
        }

        String all = "";

        for (twitter4j.Status status: statuses) {
            Tweet tweet = new Tweet(status);
            all += String.format("%s:$$$___$$$%s$$$___$$$%d&&&___&&&",
                                 tweet.getUsername(), tweet.getText(), tweet.getStatusId());
        }

        return new ActivityAndStrings(activities[0], all.trim());
    }

    protected void onPostExecute(final ActivityAndStrings aas) {
        mGoogleAppiClient = new GoogleApiClient.Builder(aas.activity)
                .addConnectionCallbacks(new GoogleApiClient.ConnectionCallbacks() {

                    @Override
                    public void onConnected(Bundle connectionHint) {
                        sendOnConnect(aas);
                    }

                    @Override
                    public void onConnectionSuspended(int cause) {
                        Log.d("crapcrap", "onConnectionSuspended: " + cause);
                    }
                })
                .addOnConnectionFailedListener(new GoogleApiClient.OnConnectionFailedListener() {
                    @Override
                    public void onConnectionFailed(ConnectionResult result) {
                        Log.d("crapcrap", "onConnectionFailed: " + result);
                    }
                })
                .addApi(Wearable.API)
                .build();

        mGoogleAppiClient.connect();
    }

    private void sendOnConnect(ActivityAndStrings activityAndString) {
        Wearable.MessageApi.sendMessage(mGoogleAppiClient, activityAndString.string, "/stream",
                activityAndString.otherString.getBytes());
    }
}


text:
package org.testcontainsers.examples;

import io.cucumber.java.After;
import io.cucumber.java.Before;
import io.cucumber.java.Scenario;
import io.cucumber.java.en.Given;
import io.cucumber.java.en.Then;
import io.cucumber.java.en.When;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeOptions;
import org.openqa.selenium.remote.RemoteWebDriver;
import org.testcontainers.containers.BrowserWebDriverContainer;
import org.testcontainers.lifecycle.TestDescription;

import java.io.File;
import java.util.List;
import java.util.Optional;

import static junit.framework.TestCase.assertEquals;
import static org.testcontainers.containers.BrowserWebDriverContainer.VncRecordingMode.RECORD_ALL;

public class Stepdefs {

    private BrowserWebDriverContainer container = new BrowserWebDriverContainer()
            .withCapabilities(new ChromeOptions())
            .withRecordingMode(RECORD_ALL, new File("build"));

    private String location;
    private String answer;

    @Before
    public void beforeScenario() {
        container.start();
    }

    @After
    public void afterScenario(Scenario scenario) {
        container.afterTest(new TestDescription() {
            @Override
            public String getTestId() {
                return scenario.getId();
            }

            @Override
            public String getFilesystemFriendlyName() {
                return scenario.getName();
            }
        }, Optional.of(scenario).filter(Scenario::isFailed).map(__ -> new RuntimeException()));
    }

    @Given("^location is \"([^\"]*)\"$")
    public void locationIs(String location) throws Exception {
        this.location = location;
    }

    @When("^I ask is it possible to search here$")
    public void iAskIsItPossibleToSearchHere() throws Exception {
        RemoteWebDriver driver = container.getWebDriver();
        driver.get(location);
        List<WebElement> searchInputs = driver.findElementsByTagName("input");
        answer = searchInputs != null && searchInputs.size() > 0 ? "YES" : "NOPE";
    }

    @Then("^I should be told \"([^\"]*)\"$")
    public void iShouldBeTold(String expected) throws Exception {
        assertEquals(expected, answer);
    }

}


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

import android.os.Bundle;

/**
 * A wrapper for {@link androidx.browser.trusted.TrustedWebActivityCallbackRemote} that we can
 * construct and use for testing.
 */
public interface TrustedWebActivityLocationCallback {
    /** Runs the callback with the given name and args. **/
    void run(String callbackName, Bundle args);
}


text:
using AspNetToDoApi.DAL;
using AspNetToDoApi.Models;
using System;
using System.Collections.Generic;
using System.Web.Http;

namespace AspNetToDoApi.Controllers
{
    public class ToDoController : ApiController
    {
        private static ToDoRepository _toDoRepository = new ToDoRepository();

         [HttpGet]
         public List<ToDoItem> GetAll()
        {
            return _toDoRepository.GetToDoItems();
        }

        [HttpGet]
        public ToDoItem GetById(Guid id)
        {
            return _toDoRepository.GetById(id);
        }

        [HttpPost]
        public ToDoItem Create(ToDoItem item)
        {
            _toDoRepository.CreateToDo(item);
            return item;
        }

        [HttpPut]
        public ToDoItem Update(ToDoItem item)
        {
            _toDoRepository.Update(item);
            return item;
        }

        [HttpDelete]
        public IHttpActionResult Delete(Guid id)
        {
            _toDoRepository.Delete(id);
            return Ok();
        }
    }
}


text:
################################################################################
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements.  See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership.  The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License.  You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
################################################################################
#
# This image is modified version of Knappek/docker-hadoop-secure
#   * Knappek/docker-hadoop-secure <https://github.com/Knappek/docker-hadoop-secure>
#
# With bits and pieces added from Lewuathe/docker-hadoop-cluster to extend it to start a proper kerberized Hadoop cluster:
#   * Lewuathe/docker-hadoop-cluster <https://github.com/Lewuathe/docker-hadoop-cluster>
#
# Creates multi-node, kerberized Hadoop cluster on Docker

FROM openjdk:8

RUN set -x \
    && addgroup hadoop \
    && useradd -d /home/hdfs -ms /bin/bash -G hadoop -p hdfs hdfs \
    && useradd -d /home/yarn -ms /bin/bash -G hadoop -p yarn yarn \
    && useradd -d /home/mapred -ms /bin/bash -G hadoop -p mapred mapred \
    && useradd -d /home/hadoop-user -ms /bin/bash -p hadoop-user hadoop-user

# install dev tools
RUN set -x \
    && apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y \
    curl tar sudo openssh-server openssh-client rsync unzip krb5-user net-tools build-essential

# Kerberos client
RUN set -x \
    && mkdir -p /var/log/kerberos \
    && touch /var/log/kerberos/kadmind.log

# passwordless ssh
RUN set -x \
    && rm -f /etc/ssh/ssh_host_dsa_key /etc/ssh/ssh_host_rsa_key /root/.ssh/id_rsa \
    && ssh-keygen -q -N "" -t dsa -f /etc/ssh/ssh_host_dsa_key \
    && ssh-keygen -q -N "" -t rsa -f /etc/ssh/ssh_host_rsa_key \
    && ssh-keygen -q -N "" -t rsa -f /root/.ssh/id_rsa \
    && cp /root/.ssh/id_rsa.pub /root/.ssh/authorized_keys

RUN sed -i 's/^#crypto.policy=unlimited/crypto.policy=unlimited/' $JAVA_HOME/jre/lib/security/java.security

ARG HADOOP_VERSION=2.8.5

COPY hadoop-${HADOOP_VERSION}.tar.gz /tmp/hadoop.tar.gz

RUN set -x \
    && tar -xf /tmp/hadoop.tar.gz -C /usr/local/ \
    && rm /tmp/hadoop.tar.gz*

WORKDIR /usr/local
RUN set -x \
    && ln -s /usr/local/hadoop-${HADOOP_VERSION} /usr/local/hadoop \
    && chown root:root -R /usr/local/hadoop-${HADOOP_VERSION}/ \
    && chown root:root -R /usr/local/hadoop/ \
    && chown root:yarn /usr/local/hadoop/bin/container-executor \
    && chmod 6050 /usr/local/hadoop/bin/container-executor \
    && mkdir -p /hadoop-data/nm-local-dirs \
    && mkdir -p /hadoop-data/nm-log-dirs \
    && chown yarn:yarn /hadoop-data \
    && chown yarn:yarn /hadoop-data/nm-local-dirs \
    && chown yarn:yarn /hadoop-data/nm-log-dirs \
    && chmod 755 /hadoop-data \
    && chmod 755 /hadoop-data/nm-local-dirs \
    && chmod 755 /hadoop-data/nm-log-dirs

ENV HADOOP_HOME /usr/local/hadoop
ENV HADOOP_COMMON_HOME /usr/local/hadoop
ENV HADOOP_HDFS_HOME /usr/local/hadoop
ENV HADOOP_MAPRED_HOME /usr/local/hadoop
ENV HADOOP_YARN_HOME /usr/local/hadoop
ENV HADOOP_CONF_DIR /usr/local/hadoop/etc/hadoop
ENV YARN_CONF_DIR /usr/local/hadoop/etc/hadoop
ENV HADOOP_LOG_DIR /var/log/hadoop
ENV HADOOP_BIN_HOME $HADOOP_HOME/bin
ENV PATH $PATH:$HADOOP_BIN_HOME

ENV KRB_REALM EXAMPLE.COM
ENV DOMAIN_REALM example.com
ENV KERBEROS_ADMIN admin/admin
ENV KERBEROS_ADMIN_PASSWORD admin
ENV KEYTAB_DIR /etc/security/keytabs

RUN mkdir /var/log/hadoop

ADD config/core-site.xml $HADOOP_HOME/etc/hadoop/core-site.xml
ADD config/hdfs-site.xml $HADOOP_HOME/etc/hadoop/hdfs-site.xml
ADD config/mapred-site.xml $HADOOP_HOME/etc/hadoop/mapred-site.xml
ADD config/yarn-site.xml $HADOOP_HOME/etc/hadoop/yarn-site.xml
ADD config/container-executor.cfg $HADOOP_HOME/etc/hadoop/container-executor.cfg
ADD config/krb5.conf /etc/krb5.conf
ADD config/ssl-server.xml $HADOOP_HOME/etc/hadoop/ssl-server.xml
ADD config/ssl-client.xml $HADOOP_HOME/etc/hadoop/ssl-client.xml
ADD config/keystore.jks $HADOOP_HOME/lib/keystore.jks

RUN set -x \
    && chmod 400 $HADOOP_HOME/etc/hadoop/container-executor.cfg \
    && chown root:yarn $HADOOP_HOME/etc/hadoop/container-executor.cfg

ADD config/ssh_config /root/.ssh/config
RUN set -x \
    && chmod 600 /root/.ssh/config \
    && chown root:root /root/.ssh/config

# workingaround docker.io build error
RUN set -x \
    && ls -la /usr/local/hadoop/etc/hadoop/*-env.sh \
    && chmod +x /usr/local/hadoop/etc/hadoop/*-env.sh \
    && ls -la /usr/local/hadoop/etc/hadoop/*-env.sh

# fix the 254 error code
RUN set -x \
    && sed  -i "/^[^#]*UsePAM/ s/.*/#&/"  /etc/ssh/sshd_config \
    && echo "UsePAM no" >> /etc/ssh/sshd_config \
    && echo "Port 2122" >> /etc/ssh/sshd_config

# Hdfs ports
EXPOSE 9000 50010 50020 50075 50090 50475 50091 8020
# Mapred ports
EXPOSE 19888
# Yarn ports
EXPOSE 8030 8031 8032 8033 8040 8042 8088 8188
# Other ports
EXPOSE 49707 2122

ADD bootstrap.sh /etc/bootstrap.sh
RUN chown root:root /etc/bootstrap.sh
RUN chmod 700 /etc/bootstrap.sh

ENV BOOTSTRAP /etc/bootstrap.sh

ENTRYPOINT ["/etc/bootstrap.sh"]
CMD ["-h"]


text:
package com.sun.imageio.plugins.gif;

import javax.imageio.metadata.IIOInvalidTreeException;
import javax.imageio.metadata.IIOMetadata;
import javax.imageio.metadata.IIOMetadataFormatImpl;
import org.w3c.dom.Node;

/**
 * Class which adds utility DOM element attribute access methods to
 * IIOMetadata for subclass use.
 */
abstract class GIFMetadata extends IIOMetadata {

    /**
     * Represents an undefined value of integer attributes.
     */
    static final int UNDEFINED_INTEGER_VALUE = -1;

    //
    // Note: These attribute methods were shamelessly lifted from
    // com.sun.imageio.plugins.png.PNGMetadata and modified.
    //

    // Shorthand for throwing an IIOInvalidTreeException
    protected static void fatal(Node node, String reason)
      throws IIOInvalidTreeException {
        throw new IIOInvalidTreeException(reason, node);
    }

    // Get an integer-valued attribute
    protected static String getStringAttribute(Node node, String name,
                                               String defaultValue,
                                               boolean required,
                                               String[] range)
      throws IIOInvalidTreeException {
        Node attr = node.getAttributes().getNamedItem(name);
        if (attr == null) {
            if (!required) {
                return defaultValue;
            } else {
                fatal(node, "Required attribute " + name + " not present!");
            }
        }
        String value = attr.getNodeValue();

        if (range != null) {
            if (value == null) {
                fatal(node,
                      "Null value for "+node.getNodeName()+
                      " attribute "+name+"!");
            }
            boolean validValue = false;
            int len = range.length;
            for (int i = 0; i < len; i++) {
                if (value.equals(range[i])) {
                    validValue = true;
                    break;
                }
            }
            if (!validValue) {
                fatal(node,
                      "Bad value for "+node.getNodeName()+
                      " attribute "+name+"!");
            }
        }

        return value;
    }

    // Get an integer-valued attribute
    protected static int getIntAttribute(Node node, String name,
                                         int defaultValue, boolean required,
                                         boolean bounded, int min, int max)
      throws IIOInvalidTreeException {
        String value = getStringAttribute(node, name, null, required, null);
        if (value == null || "".equals(value)) {
            return defaultValue;
        }

        int intValue = defaultValue;
        try {
            intValue = Integer.parseInt(value);
        } catch (NumberFormatException e) {
            fatal(node,
                  "Bad value for "+node.getNodeName()+
                  " attribute "+name+"!");
        }
        if (bounded && (intValue < min || intValue > max)) {
            fatal(node,
                  "Bad value for "+node.getNodeName()+
                  " attribute "+name+"!");
        }
        return intValue;
    }

    // Get a float-valued attribute
    protected static float getFloatAttribute(Node node, String name,
                                             float defaultValue,
                                             boolean required)
      throws IIOInvalidTreeException {
        String value = getStringAttribute(node, name, null, required, null);
        if (value == null) {
            return defaultValue;
        }
        return Float.parseFloat(value);
    }

    // Get a required integer-valued attribute
    protected static int getIntAttribute(Node node, String name,
                                         boolean bounded, int min, int max)
      throws IIOInvalidTreeException {
        return getIntAttribute(node, name, -1, true, bounded, min, max);
    }

    // Get a required float-valued attribute
    protected static float getFloatAttribute(Node node, String name)
      throws IIOInvalidTreeException {
        return getFloatAttribute(node, name, -1.0F, true);
    }

    // Get a boolean-valued attribute
    protected static boolean getBooleanAttribute(Node node, String name,
                                                 boolean defaultValue,
                                                 boolean required)
      throws IIOInvalidTreeException {
        Node attr = node.getAttributes().getNamedItem(name);
        if (attr == null) {
            if (!required) {
                return defaultValue;
            } else {
                fatal(node, "Required attribute " + name + " not present!");
            }
        }
        String value = attr.getNodeValue();
        // Allow lower case booleans for backward compatibility, #5082756
        if (value.equals("TRUE") || value.equals("true")) {
            return true;
        } else if (value.equals("FALSE") || value.equals("false")) {
            return false;
        } else {
            fatal(node, "Attribute " + name + " must be 'TRUE' or 'FALSE'!");
            return false;
        }
    }

    // Get a required boolean-valued attribute
    protected static boolean getBooleanAttribute(Node node, String name)
      throws IIOInvalidTreeException {
        return getBooleanAttribute(node, name, false, true);
    }

    // Get an enumerated attribute as an index into a String array
    protected static int getEnumeratedAttribute(Node node,
                                                String name,
                                                String[] legalNames,
                                                int defaultValue,
                                                boolean required)
      throws IIOInvalidTreeException {
        Node attr = node.getAttributes().getNamedItem(name);
        if (attr == null) {
            if (!required) {
                return defaultValue;
            } else {
                fatal(node, "Required attribute " + name + " not present!");
            }
        }
        String value = attr.getNodeValue();
        for (int i = 0; i < legalNames.length; i++) {
            if(value.equals(legalNames[i])) {
                return i;
            }
        }

        fatal(node, "Illegal value for attribute " + name + "!");
        return -1;
    }

    // Get a required enumerated attribute as an index into a String array
    protected static int getEnumeratedAttribute(Node node,
                                                String name,
                                                String[] legalNames)
      throws IIOInvalidTreeException {
        return getEnumeratedAttribute(node, name, legalNames, -1, true);
    }

    // Get a String-valued attribute
    protected static String getAttribute(Node node, String name,
                                         String defaultValue, boolean required)
      throws IIOInvalidTreeException {
        Node attr = node.getAttributes().getNamedItem(name);
        if (attr == null) {
            if (!required) {
                return defaultValue;
            } else {
                fatal(node, "Required attribute " + name + " not present!");
            }
        }
        return attr.getNodeValue();
    }

    // Get a required String-valued attribute
    protected static String getAttribute(Node node, String name)
      throws IIOInvalidTreeException {
        return getAttribute(node, name, null, true);
    }

    protected GIFMetadata(boolean standardMetadataFormatSupported,
                          String nativeMetadataFormatName,
                          String nativeMetadataFormatClassName,
                          String[] extraMetadataFormatNames,
                          String[] extraMetadataFormatClassNames) {
        super(standardMetadataFormatSupported,
              nativeMetadataFormatName,
              nativeMetadataFormatClassName,
              extraMetadataFormatNames,
              extraMetadataFormatClassNames);
    }

    public void mergeTree(String formatName, Node root)
      throws IIOInvalidTreeException {
        if (formatName.equals(nativeMetadataFormatName)) {
            if (root == null) {
                throw new IllegalArgumentException("root == null!");
            }
            mergeNativeTree(root);
        } else if (formatName.equals
                  (IIOMetadataFormatImpl.standardMetadataFormatName)) {
            if (root == null) {
                throw new IllegalArgumentException("root == null!");
            }
            mergeStandardTree(root);
        } else {
            throw new IllegalArgumentException("Not a recognized format!");
        }
    }

    protected byte[] getColorTable(Node colorTableNode,
                                   String entryNodeName,
                                   boolean lengthExpected,
                                   int expectedLength)
      throws IIOInvalidTreeException {
        byte[] red = new byte[256];
        byte[] green  = new byte[256];
        byte[] blue = new byte[256];
        int maxIndex = -1;

        Node entry = colorTableNode.getFirstChild();
        if (entry == null) {
            fatal(colorTableNode, "Palette has no entries!");
        }

        while (entry != null) {
            if (!entry.getNodeName().equals(entryNodeName)) {
                fatal(colorTableNode,
                      "Only a "+entryNodeName+" may be a child of a "+
                      entry.getNodeName()+"!");
            }

            int index = getIntAttribute(entry, "index", true, 0, 255);
            if (index > maxIndex) {
                maxIndex = index;
            }
            red[index] = (byte)getIntAttribute(entry, "red", true, 0, 255);
            green[index] = (byte)getIntAttribute(entry, "green", true, 0, 255);
            blue[index] = (byte)getIntAttribute(entry, "blue", true, 0, 255);

            entry = entry.getNextSibling();
        }

        int numEntries = maxIndex + 1;

        if (lengthExpected && numEntries != expectedLength) {
            fatal(colorTableNode, "Unexpected length for palette!");
        }

        byte[] colorTable = new byte[3*numEntries];
        for (int i = 0, j = 0; i < numEntries; i++) {
            colorTable[j++] = red[i];
            colorTable[j++] = green[i];
            colorTable[j++] = blue[i];
        }

        return colorTable;
    }

    protected abstract void mergeNativeTree(Node root)
      throws IIOInvalidTreeException;

   protected abstract void mergeStandardTree(Node root)
      throws IIOInvalidTreeException;
}


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

namespace _06.SpecialNumberTWO
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());

            for (int thousandths = 1; thousandths < 10; thousandths++)
            {
                for (int hundreds = 1; hundreds < 10; hundreds++)
                {
                    for (int tenths = 1; tenths < 10; tenths++)
                    {
                        for (int units = 1; units < 10; units++)
                        {
                            if (n % thousandths == 0 && n % hundreds == 0 && n % tenths == 0 && n % units == 0)
                            {
                                Console.Write("{0}{1}{2}{3} ", thousandths, hundreds, tenths, units);
                            }
                        }
                    }
                }
            }
        }
    }
}


text:
<?php

namespace Spartium\UploadedFileHandler\Tests\Unit;

use PHPUnit\Framework\TestCase;
use Spartium\UploadedFileHandler\Handlers\Image\ImageUploader;
use Spartium\UploadedFileHandler\Model\Image;
use Symfony\Component\HttpFoundation\File\UploadedFile;

class ImageUploaderTest extends TestCase
{
    const SOURCE_FILE = __DIR__.'/../files/1024px-Spartium_junceum_Colmenar_Viejo_1.jpg';

    private $tmpFile;

    protected function setUp()
    {
        $this->tmpFile = tempnam(sys_get_temp_dir(), 'test_image_');
        fwrite(fopen($this->tmpFile, 'w+'), file_get_contents(self::SOURCE_FILE));
    }

    /**
     * @expectedException \InvalidArgumentException
     * @expectedExceptionMessage You should specify base path first
     */
    public function testBasePathException()
    {
        $loader = new ImageUploader();
        $loader->save($this->getUploadedFile());
    }

    public function testUpload()
    {
        $loader = new ImageUploader();
        $loader->setBasePath(sys_get_temp_dir());

        $uploadedFile = $this->getUploadedFile();
        $image = $loader->save($uploadedFile);

        self::assertInstanceOf(Image::class, $image);
        self::assertEquals($this->tmpFile, $image->getRealPath());
    }

    public function testUploadWithNewName()
    {
        $loader = new ImageUploader();
        $loader->setBasePath(sys_get_temp_dir());

        $newFileName = uniqid('image_', true).'.jpg';
        $uploadedFile = $this->getUploadedFile();
        $image = $loader->save($uploadedFile, $newFileName);

        self::assertInstanceOf(Image::class, $image);
        self::assertEquals($newFileName, $image->getBasename());

        //for correct delete file
        $this->tmpFile = $image->getRealPath();
    }

    /**
     * @return UploadedFile
     */
    private function getUploadedFile()
    {
        return new UploadedFile(
            $this->tmpFile,
            '',
            null,
            null,
            null,
            true
        );
    }

    protected function tearDown()
    {
        unlink($this->tmpFile);
    }
}


text:
package org.apereo.cas.configuration.model.support.pac4j.oidc;

import org.apereo.cas.configuration.support.RequiredProperty;
import org.apereo.cas.configuration.support.RequiresModule;

import lombok.Getter;
import lombok.Setter;
import lombok.experimental.Accessors;

/**
 * This is {@link Pac4jKeyCloakOidcClientProperties}.
 *
 * @author Misagh Moayyed
 * @since 6.0.0
 */
@RequiresModule(name = "cas-server-support-pac4j-webflow")
@Getter
@Setter
@Accessors(chain = true)
public class Pac4jKeyCloakOidcClientProperties extends BasePac4jOidcClientProperties {
    private static final long serialVersionUID = 3209382317533639638L;

    /**
     * Keycloak realm used to construct metadata discovery URI.
     */
    @RequiredProperty
    private String realm;

    /**
     * Keycloak base URL used to construct metadata discovery URI.
     */
    @RequiredProperty
    private String baseUri;
}


text:
package com.github.jinahya.database.metadata.bind;

/**
 * A marker interface for representing a parent in the type hierarchy.
 *
 * @param <PARENT> parent type parameter
 * @author Jin Kwon <onacit_at_gmail.com>
 * @see ChildOf
 */
public interface ParentOf<PARENT extends MetadataType> {

}


text:
<!doctype html>

        <meta charset="utf-8">
        <meta http-equiv="x-ua-compatible" content="ie=edge">
        <title>angular-example-app documentation</title>
        <meta name="description" content="">
        <meta name="viewport" content="width=device-width, initial-scale=1">

        <link rel="icon" type="image/x-icon" href="../images/favicon.ico">
	   <link rel="stylesheet" href="../styles/style.css">
        <link rel="stylesheet" href="../styles/dark.css">

            angular-example-app documentation
            <button type="button" class="btn btn-default btn-menu ion-ios-menu" id="btn-menu"></button>

<input type="text" placeholder="Type to search">
            <compodoc-menu></compodoc-menu>

                   <compodoc-menu mode="normal"></compodoc-menu>

Modules

RootRoutingModule

        Info

        Source

File

            src/app/modules/root/root-routing.module.ts

import { NgModule } from '@angular/core';
import { RouterModule, Routes } from '@angular/router';
import { HomePageComponent } from './pages/home-page/home-page.component';
import { RoutesConfig } from '~app/configs/routes.config';
import { Error404PageComponent } from './pages/error404-page/error404-page.component';

const routesNames = RoutesConfig.routesNames;

const rootRoutes: Routes = [
  { path: routesNames.home, component: HomePageComponent, pathMatch: 'full' },
  { path: routesNames.error404, component: Error404PageComponent },
];

@NgModule({
  imports: [RouterModule.forChild(rootRoutes)],
  exports: [RouterModule],
})
export class RootRoutingModule {}

 results matching ""

No results matching ""

               <input type="checkbox">

                    <svg class="slider-icon" viewBox="0 0 24 24" fill="none" height="20" stroke="#000" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" width="20" xmlns="http://www.w3.org/2000/svg">
                    <path d="M21 12.79A9 9 0 1111.21 3 7 7 0 0021 12.79z"></path>
                    </svg>


text:
#ifndef WEBRTC_MODULES_RTP_RTCP_SOURCE_RTP_RTCP_IMPL_H_
#define WEBRTC_MODULES_RTP_RTCP_SOURCE_RTP_RTCP_IMPL_H_

#include <list>
#include <set>
#include <utility>
#include <vector>

#include "webrtc/base/scoped_ptr.h"
#include "webrtc/modules/rtp_rtcp/include/rtp_rtcp.h"
#include "webrtc/modules/rtp_rtcp/source/packet_loss_stats.h"
#include "webrtc/modules/rtp_rtcp/source/rtcp_receiver.h"
#include "webrtc/modules/rtp_rtcp/source/rtcp_sender.h"
#include "webrtc/modules/rtp_rtcp/source/rtp_sender.h"
#include "webrtc/test/testsupport/gtest_prod_util.h"

namespace webrtc {

class ModuleRtpRtcpImpl : public RtpRtcp {
 public:
  explicit ModuleRtpRtcpImpl(const RtpRtcp::Configuration& configuration);

  // Returns the number of milliseconds until the module want a worker thread to
  // call Process.
  int64_t TimeUntilNextProcess() override;

  // Process any pending tasks such as timeouts.
  int32_t Process() override;

  // Receiver part.

  // Called when we receive an RTCP packet.
  int32_t IncomingRtcpPacket(const uint8_t* incoming_packet,
                             size_t incoming_packet_length) override;

  void SetRemoteSSRC(uint32_t ssrc) override;

  // Sender part.

  int32_t RegisterSendPayload(const CodecInst& voice_codec) override;

  int32_t RegisterSendPayload(const VideoCodec& video_codec) override;

  int32_t DeRegisterSendPayload(int8_t payload_type) override;

  int8_t SendPayloadType() const;

  // Register RTP header extension.
  int32_t RegisterSendRtpHeaderExtension(RTPExtensionType type,
                                         uint8_t id) override;

  int32_t DeregisterSendRtpHeaderExtension(RTPExtensionType type) override;

  // Get start timestamp.
  uint32_t StartTimestamp() const override;

  // Configure start timestamp, default is a random number.
  void SetStartTimestamp(uint32_t timestamp) override;

  uint16_t SequenceNumber() const override;

  // Set SequenceNumber, default is a random number.
  void SetSequenceNumber(uint16_t seq) override;

  bool SetRtpStateForSsrc(uint32_t ssrc, const RtpState& rtp_state) override;
  bool GetRtpStateForSsrc(uint32_t ssrc, RtpState* rtp_state) override;

  uint32_t SSRC() const override;

  // Configure SSRC, default is a random number.
  void SetSSRC(uint32_t ssrc) override;

  void SetCsrcs(const std::vector<uint32_t>& csrcs) override;

  RTCPSender::FeedbackState GetFeedbackState();

  int CurrentSendFrequencyHz() const;

  void SetRtxSendStatus(int mode) override;
  int RtxSendStatus() const override;

  void SetRtxSsrc(uint32_t ssrc) override;

  void SetRtxSendPayloadType(int payload_type,
                             int associated_payload_type) override;
  std::pair<int, int> RtxSendPayloadType() const override;

  // Sends kRtcpByeCode when going from true to false.
  int32_t SetSendingStatus(bool sending) override;

  bool Sending() const override;

  // Drops or relays media packets.
  void SetSendingMediaStatus(bool sending) override;

  bool SendingMedia() const override;

  // Used by the codec module to deliver a video or audio frame for
  // packetization.
  int32_t SendOutgoingData(FrameType frame_type,
                           int8_t payload_type,
                           uint32_t time_stamp,
                           int64_t capture_time_ms,
                           const uint8_t* payload_data,
                           size_t payload_size,
                           const RTPFragmentationHeader* fragmentation = NULL,
                           const RTPVideoHeader* rtp_video_hdr = NULL) override;

  bool TimeToSendPacket(uint32_t ssrc,
                        uint16_t sequence_number,
                        int64_t capture_time_ms,
                        bool retransmission) override;

  // Returns the number of padding bytes actually sent, which can be more or
  // less than |bytes|.
  size_t TimeToSendPadding(size_t bytes) override;

  // RTCP part.

  // Get RTCP status.
  RtcpMode RTCP() const override;

  // Configure RTCP status i.e on/off.
  void SetRTCPStatus(RtcpMode method) override;

  // Set RTCP CName.
  int32_t SetCNAME(const char* c_name) override;

  // Get remote CName.
  int32_t RemoteCNAME(uint32_t remote_ssrc,
                      char c_name[RTCP_CNAME_SIZE]) const override;

  // Get remote NTP.
  int32_t RemoteNTP(uint32_t* received_ntp_secs,
                    uint32_t* received_ntp_frac,
                    uint32_t* rtcp_arrival_time_secs,
                    uint32_t* rtcp_arrival_time_frac,
                    uint32_t* rtcp_timestamp) const override;

  int32_t AddMixedCNAME(uint32_t ssrc, const char* c_name) override;

  int32_t RemoveMixedCNAME(uint32_t ssrc) override;

  // Get RoundTripTime.
  int32_t RTT(uint32_t remote_ssrc,
              int64_t* rtt,
              int64_t* avg_rtt,
              int64_t* min_rtt,
              int64_t* max_rtt) const override;

  // Force a send of an RTCP packet.
  // Normal SR and RR are triggered via the process function.
  int32_t SendRTCP(RTCPPacketType rtcpPacketType) override;

  int32_t SendCompoundRTCP(
      const std::set<RTCPPacketType>& rtcpPacketTypes) override;

  // Statistics of the amount of data sent and received.
  int32_t DataCountersRTP(size_t* bytes_sent,
                          uint32_t* packets_sent) const override;

  void GetSendStreamDataCounters(
      StreamDataCounters* rtp_counters,
      StreamDataCounters* rtx_counters) const override;

  void GetRtpPacketLossStats(
      bool outgoing,
      uint32_t ssrc,
      struct RtpPacketLossStats* loss_stats) const override;

  // Get received RTCP report, sender info.
  int32_t RemoteRTCPStat(RTCPSenderInfo* sender_info) override;

  // Get received RTCP report, report block.
  int32_t RemoteRTCPStat(
      std::vector<RTCPReportBlock>* receive_blocks) const override;

  // (REMB) Receiver Estimated Max Bitrate.
  bool REMB() const override;

  void SetREMBStatus(bool enable) override;

  void SetREMBData(uint32_t bitrate,
                   const std::vector<uint32_t>& ssrcs) override;

  // (TMMBR) Temporary Max Media Bit Rate.
  bool TMMBR() const override;

  void SetTMMBRStatus(bool enable) override;

  int32_t SetTMMBN(const TMMBRSet* bounding_set);

  uint16_t MaxPayloadLength() const override;

  uint16_t MaxDataPayloadLength() const override;

  int32_t SetMaxTransferUnit(uint16_t size) override;

  int32_t SetTransportOverhead(bool tcp,
                               bool ipv6,
                               uint8_t authentication_overhead = 0) override;

  // (NACK) Negative acknowledgment part.

  int SelectiveRetransmissions() const override;

  int SetSelectiveRetransmissions(uint8_t settings) override;

  // Send a Negative acknowledgment packet.
  int32_t SendNACK(const uint16_t* nack_list, uint16_t size) override;

  // Store the sent packets, needed to answer to a negative acknowledgment
  // requests.
  void SetStorePacketsStatus(bool enable, uint16_t number_to_store) override;

  bool StorePackets() const override;

  // Called on receipt of RTCP report block from remote side.
  void RegisterRtcpStatisticsCallback(
      RtcpStatisticsCallback* callback) override;
  RtcpStatisticsCallback* GetRtcpStatisticsCallback() override;

  bool SendFeedbackPacket(const rtcp::TransportFeedback& packet) override;
  // (APP) Application specific data.
  int32_t SetRTCPApplicationSpecificData(uint8_t sub_type,
                                         uint32_t name,
                                         const uint8_t* data,
                                         uint16_t length) override;

  // (XR) VOIP metric.
  int32_t SetRTCPVoIPMetrics(const RTCPVoIPMetric* VoIPMetric) override;

  // (XR) Receiver reference time report.
  void SetRtcpXrRrtrStatus(bool enable) override;

  bool RtcpXrRrtrStatus() const override;

  // Audio part.

  // Set audio packet size, used to determine when it's time to send a DTMF
  // packet in silence (CNG).
  int32_t SetAudioPacketSize(uint16_t packet_size_samples) override;

  // Send a TelephoneEvent tone using RFC 2833 (4733).
  int32_t SendTelephoneEventOutband(uint8_t key,
                                    uint16_t time_ms,
                                    uint8_t level) override;

  // Set payload type for Redundant Audio Data RFC 2198.
  int32_t SetSendREDPayloadType(int8_t payload_type) override;

  // Get payload type for Redundant Audio Data RFC 2198.
  int32_t SendREDPayloadType(int8_t* payload_type) const override;

  // Store the audio level in d_bov for header-extension-for-audio-level-
  // indication.
  int32_t SetAudioLevel(uint8_t level_d_bov) override;

  // Video part.

  int32_t SendRTCPSliceLossIndication(uint8_t picture_id) override;

  // Set method for requesting a new key frame.
  int32_t SetKeyFrameRequestMethod(KeyFrameRequestMethod method) override;

  // Send a request for a keyframe.
  int32_t RequestKeyFrame() override;

  void SetTargetSendBitrate(uint32_t bitrate_bps) override;

  void SetGenericFECStatus(bool enable,
                           uint8_t payload_type_red,
                           uint8_t payload_type_fec) override;

  void GenericFECStatus(bool* enable,
                        uint8_t* payload_type_red,
                        uint8_t* payload_type_fec) override;

  int32_t SetFecParameters(const FecProtectionParams* delta_params,
                           const FecProtectionParams* key_params) override;

  bool LastReceivedNTP(uint32_t* NTPsecs,
                       uint32_t* NTPfrac,
                       uint32_t* remote_sr) const;

  bool LastReceivedXrReferenceTimeInfo(RtcpReceiveTimeInfo* info) const;

  int32_t BoundingSet(bool* tmmbr_owner, TMMBRSet* bounding_set_rec);

  void BitrateSent(uint32_t* total_rate,
                   uint32_t* video_rate,
                   uint32_t* fec_rate,
                   uint32_t* nackRate) const override;

  int64_t SendTimeOfSendReport(uint32_t send_report);

  bool SendTimeOfXrRrReport(uint32_t mid_ntp, int64_t* time_ms) const;

  // Good state of RTP receiver inform sender.
  int32_t SendRTCPReferencePictureSelection(uint64_t picture_id) override;

  void RegisterSendChannelRtpStatisticsCallback(
      StreamDataCountersCallback* callback) override;
  StreamDataCountersCallback* GetSendChannelRtpStatisticsCallback()
      const override;

  void OnReceivedTMMBR();

  // Bad state of RTP receiver request a keyframe.
  void OnRequestIntraFrame();

  // Received a request for a new SLI.
  void OnReceivedSliceLossIndication(uint8_t picture_id);

  // Received a new reference frame.
  void OnReceivedReferencePictureSelectionIndication(uint64_t picture_id);

  void OnReceivedNACK(const std::list<uint16_t>& nack_sequence_numbers);

  void OnRequestSendReport();

 protected:
  bool UpdateRTCPReceiveInformationTimers();

  uint32_t BitrateReceivedNow() const;

  // Get remote SequenceNumber.
  uint16_t RemoteSequenceNumber() const;

  RTPSender rtp_sender_;

  RTCPSender rtcp_sender_;
  RTCPReceiver rtcp_receiver_;

  Clock* clock_;

 private:
  FRIEND_TEST_ALL_PREFIXES(RtpRtcpImplTest, Rtt);
  FRIEND_TEST_ALL_PREFIXES(RtpRtcpImplTest, RttForReceiverOnly);
  int64_t RtcpReportInterval();
  void SetRtcpReceiverSsrcs(uint32_t main_ssrc);

  void set_rtt_ms(int64_t rtt_ms);
  int64_t rtt_ms() const;

  bool TimeToSendFullNackList(int64_t now) const;

  const bool audio_;
  bool collision_detected_;
  int64_t last_process_time_;
  int64_t last_bitrate_process_time_;
  int64_t last_rtt_process_time_;
  uint16_t packet_overhead_;

  size_t padding_index_;

  // Send side
  NACKMethod nack_method_;
  int64_t nack_last_time_sent_full_;
  uint32_t nack_last_time_sent_full_prev_;
  uint16_t nack_last_seq_number_sent_;

  VideoCodec send_video_codec_;
  KeyFrameRequestMethod key_frame_req_method_;

  RemoteBitrateEstimator* remote_bitrate_;

  RtcpRttStats* rtt_stats_;

  PacketLossStats send_loss_stats_;
  PacketLossStats receive_loss_stats_;

  // The processed RTT from RtcpRttStats.
  rtc::scoped_ptr<CriticalSectionWrapper> critical_section_rtt_;
  int64_t rtt_ms_;
};

}  // namespace webrtc

#endif  // WEBRTC_MODULES_RTP_RTCP_SOURCE_RTP_RTCP_IMPL_H_


text:
require 'hyrax/ingest/errors'
require 'active_support/core_ext/hash/keys'

module Hyrax
  module Ingest
    class Configuration
      attr_reader :config_file_path

      def initialize(config_file_path:)
        @config_file_path = config_file_path.to_s
        raise Hyrax::Ingest::Errors::NoConfigFileFound.new(@config_file_path) unless File.exist? @config_file_path
        validate!
      end

      # @return [Array] Array of hashes, where each hash is the configuration options
      #   for an Ingester instance
      def ingester_configs
        @ingester_configs ||= config[:ingest]
      end

      private

        # @return [Hash] The config hash parsed from yaml file, and with keys
        #   converted from strings to symbols.
        def config
          @config ||= Psych.load_file(config_file_path).deep_symbolize_keys
        end

        # Validates the configuration.
        # @raise [Hyrax::Ingest::Errors::InvalidConfig] When the configuration is invalid.
        def validate!
          validate_top_level_key!
          validate_ingester_configs_array!
          validate_ingester_config_hashes!
        end

        # @raise [Hyrax::Ingest::Errors::InvalidConfig] When the top level
        #   'ingest' key is missing.
        def validate_top_level_key!
          raise Hyrax::Ingest::Errors::InvalidConfig.new(config_file_path, "Top-level key 'ingest' is missing.") unless config[:ingest]
        end

        def validate_ingester_configs_array!
          raise Hyrax::Ingest::Errors::InvalidConfig.new(config_file_path, "Value under top-level 'ingest' key must be an array containing the configuration for each ingester you want to use.") unless config[:ingest].respond_to?(:each)
        end

        def validate_ingester_config_hashes!
          config[:ingest].each do |ingest_config|
            raise Hyrax::Ingest::Errors::InvalidConfig.new(config_file_path, "Each ingester configuration must be a single key-value pair, where the key is the type of ingester, and the value is a hash containing the configuration for the ingester. But a #{ingester_config.class} was found instead.") unless ingest_config.respond_to? :keys
          end
        end
    end
  end
end


text:
title:  Les marques d'un économe
date:   03/02/2018
---

*SabbatAprès Midi*

**Lecture de la semaine:** Hébreux 11:8-12; Rom. 4:13, 18-21; Matthieu 6:24; Heb. 9:14; 1 Jean 5:2, 3; Luc 16:10-12.

>
Verset à mémoriser:

>« Ainsi, qu'on nous considère comme des serviteurs du Christ et des intendants des mystères de Dieu. Du reste, ce qu'on demande d'un intendant, c'est qu'il soit digne de confiance. » (1 Corinthiens 4:1, 2, NBS).

Les économes sont connus par leur marque, ou leur signe distinctif, tout comme les entreprises sont connues par leurs logos ou leurs noms de marque. En fait, beaucoup de gens sont devenus célèbres en se transformant en une marque de choix.

La marque d'un économe chrétien est le reflet de l'amour de Christ à travers la relation qu'il entretient avec Lui. Lorsque nous vivons et pratiquons les traits caractéristiques de Christ, notre vie révélera notre marque. Notre marque est Sa marque; notre identité est mêlée à la Sienne (1 Cor. 6:17).

Cette semaine, nous identifierons les traits caractéristiques d'un économe de Dieu, ce qui constitue son nom de marque. Ces traits de caractère nous poussent à attendre le retour de Jésus et à faire l'œuvre qu'Il nous a confiée en tant qu'économes fidèles de Sa vérité. Chaque caractéristique décrit une relation profonde, que nous pouvons avoir avec celui qui est venu chercher et sauver les perdus. Plus ces qualités sont étudiées, plus elles seront enracinées dans nos vies. L'amour en tant que caractère principal de Dieu, dans toute sa dynamique, deviendra notre marque et aura une influence sur tous les aspects de nos vies, aujourd'hui et éternellement.

** Étudiez cette leçon pour le sabbat 10 Février*


text:
<?php

namespace Mhor\MediaInfo\Checker;

abstract class AbstractAttributeChecker implements AttributeCheckerInterface
{
    /**
     * @param string $attribute
     *
     * @return bool
     */
    public function isMember(string $attribute): bool
    {
        return in_array($attribute, $this->getMembersFields());
    }
}


text:
package org.apache.pulsar.websocket.proxy;

import com.google.gson.Gson;
import com.google.gson.JsonObject;
import com.google.gson.JsonParseException;
import com.google.gson.JsonPrimitive;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicInteger;
import org.eclipse.jetty.websocket.api.RemoteEndpoint;
import org.eclipse.jetty.websocket.api.Session;
import org.eclipse.jetty.websocket.api.annotations.OnWebSocketClose;
import org.eclipse.jetty.websocket.api.annotations.OnWebSocketConnect;
import org.eclipse.jetty.websocket.api.annotations.OnWebSocketMessage;
import org.eclipse.jetty.websocket.api.annotations.WebSocket;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

@WebSocket(maxTextMessageSize = 64 * 1024)
public class SimpleConsumerSocket {
    private static final String X_PULSAR_MESSAGE_ID = "messageId";
    private final CountDownLatch closeLatch;
    private Session session;
    private final List<String> consumerBuffer;
    private final List<JsonObject> messages;
    private final AtomicInteger receivedMessages = new AtomicInteger();
    // Custom message handler to override standard message processing, if it's needed
    private SimpleConsumerMessageHandler customMessageHandler;

    public SimpleConsumerSocket() {
        this.closeLatch = new CountDownLatch(1);
        consumerBuffer = Collections.synchronizedList(new ArrayList<>());
        this.messages = Collections.synchronizedList(new ArrayList<>());
    }

    public boolean awaitClose(int duration, TimeUnit unit) throws InterruptedException {
        return this.closeLatch.await(duration, unit);
    }

    public void setMessageHandler(SimpleConsumerMessageHandler handler) {
        customMessageHandler = handler;
    }

    @OnWebSocketClose
    public void onClose(int statusCode, String reason) {
        log.info("Connection closed: {} - {}", statusCode, reason);
        this.session = null;
        this.closeLatch.countDown();
    }

    @OnWebSocketConnect
    public void onConnect(Session session) throws InterruptedException {
        log.info("Got connect: {}", session);
        this.session = session;
        log.debug("Got connected: {}", session);
    }

    @OnWebSocketMessage
    public synchronized void onMessage(String msg) throws JsonParseException, IOException {
        receivedMessages.incrementAndGet();
        JsonObject message = new Gson().fromJson(msg, JsonObject.class);
        this.messages.add(message);
        if (message.get(X_PULSAR_MESSAGE_ID) != null) {
            String messageId = message.get(X_PULSAR_MESSAGE_ID).getAsString();
            consumerBuffer.add(messageId);
            if (customMessageHandler != null) {
                this.getRemote().sendString(customMessageHandler.handle(messageId, message));
            } else {
                JsonObject ack = new JsonObject();
                ack.add("messageId", new JsonPrimitive(messageId));
                // Acking the proxy
                this.getRemote().sendString(ack.toString());
            }
        } else {
            consumerBuffer.add(message.toString());
        }
    }

    public void sendPermits(int nbPermits) throws IOException {
        JsonObject permitMessage = new JsonObject();
        permitMessage.add("type", new JsonPrimitive("permit"));
        permitMessage.add("permitMessages", new JsonPrimitive(nbPermits));
        this.getRemote().sendString(permitMessage.toString());
    }

    public void unsubscribe() throws IOException {
        JsonObject message = new JsonObject();
        message.add("type", new JsonPrimitive("unsubscribe"));
        this.getRemote().sendString(message.toString());
    }

    public void isEndOfTopic() throws IOException {
        JsonObject message = new JsonObject();
        message.add("type", new JsonPrimitive("isEndOfTopic"));
        this.getRemote().sendString(message.toString());
    }

    public RemoteEndpoint getRemote() {
        return this.session.getRemote();
    }

    public Session getSession() {
        return this.session;
    }

    public List<String> getBuffer() {
        return consumerBuffer;
    }

    public int getReceivedMessagesCount() {
        return receivedMessages.get();
    }

    private static final Logger log = LoggerFactory.getLogger(SimpleConsumerSocket.class);

    public List<JsonObject> getMessages() {
        return messages;
    }
}


text:
var kafka = require('kafka-node'),
    config = require('../config'),
    logger = require('../logger.js').logger,
    topicMap = [],

    client = new kafka.Client(config.kafka.zkConnect, config.kafka.clientId.http),
    getClient = function () {
        logger.trace('returning found client');
        return client;
    },

    exists = function (client, topic, callback) {
        client.topicExists([topic], function (err, data) {
            topicMap[topic] = {};
            callback(err, data);
        });
    },

    refresh = function (client, topic, callback) {
        logger.trace({topic: topic}, 'refreshing the topic information');
        exists(client, topic, function (err) {
            if (err) return callback(err);

            logger.trace({topic: topic}, 'refreshing the metadata');
            client.refreshMetadata([topic], callback);
        });
    },

    partitions = function (client, topic, callback) {
        logger.trace({ topic : topic}, 'loading partitions for topic');
        refresh(client, topic, function (err) {
            if (err) return callback(err);

            logger.trace({ topic : topic}, 'loading the topic partitions from kafka');
            callback(err, client.topicPartitions[topic].length);
        });
    };

module.exports = {
    exists: function (topic, callback) {
        if (!!client.topicPartitions[topic])
            return callback(undefined, true);
        return exists(getClient(), topic, callback);
    },
    refresh: function (topic, callback) {
        return refresh(getClient(), topic, callback);
    },
    partitions: function (topic, callback) {
        if (!!client.topicPartitions[topic])
            return callback(undefined, client.topicPartitions[topic].length);

        logger.trace('getting partitions');
        return partitions(getClient(), topic, callback);
    }
};


text:
<?php

use Illuminate\Database\Seeder;
use ViKon\EveSDE\Models\Station\StationType;
use ViKon\Utilities\ConsoleProgressbar;

class StaStationTypesSeeder extends Seeder {
    use ConsoleProgressbar;

    protected $output;

    protected $structure = [
        0  => 'station_type_id',
        1  => 'dock_entry_x',
        2  => 'dock_entry_y',
        3  => 'dock_entry_z',
        4  => 'dock_orientation_x',
        5  => 'dock_orientation_y',
        6  => 'dock_orientation_z',
        7  => 'operation_id',
        8  => 'office_slots',
        9  => 'reprocessing_efficiency',
        10 => 'conquerable',
    ];

    /**
     * Run the database seeds.
     *
     * @return void
     */
    public function run() {
        DB::table('sta_station_types')->delete();

        $this->output = $this->command->getOutput();

        $this->initProgressbar();
        $this->startProgress('<info>Inserting data:</info> sta_station_types');
        $this->setProgressMax(69);

        $data = include(__DIR__ . '/data/sta_station_types_table_data.php');
        foreach ($data as $row) {
            $this->create($row);
        }
    }

    protected function create($values) {
        $data = [];
        foreach ($this->structure as $i => $key) {
            $data[$key] = $values[$i];
        }
        StationType::create($data);
        $this->progress();
    }

}


text:
//
//  CSCollectionViewTransactionalDataSource.h
//  Pods
//
//  Created by Gao on 06/05/2017.
//
//

#import <UIKit/UIKit.h>
#import "CSComponentProvider.h"
#import "CSChangeSet.h"
#import "CSTransactionalDataSourceConfiguration.h"
@protocol CSSupplementaryViewDataSource;

NS_ASSUME_NONNULL_BEGIN

/// for CKCollectionViewTransactionalDataSource
NS_SWIFT_NAME(CSCollectionViewDataSource)
@interface CSCollectionViewTransactionalDataSource : NSObject

@property (readonly, nonatomic) UICollectionView *collectionView;

- (instancetype)init NS_UNAVAILABLE;

- (instancetype)initWithCollectionView:(UICollectionView *)collectionView
           supplementaryViewDataSource:(nullable id<CSSupplementaryViewDataSource>)supplementaryViewDataSource
                         configuration:(CSTransactionalDataSourceConfiguration *)configuration;

/**
 Applies a changeset either synchronously or asynchronously to the collection view.
 If a synchronous changeset is applied while asynchronous changesets are still pending, then the pending changesets will be applied synchronously
 before the new changeset is applied.
 */
- (void)applyChangeset:(CSChangeSet *)changeset
        asynchronously:(BOOL)asynchronously
              userInfo:(nullable NSDictionary *)userInfo NS_REFINED_FOR_SWIFT;

/**
 @return The model associated with a certain index path in the collectionView.

 As stated above components are generated asynchronously and on a backgorund thread. This means that a changeset is enqueued
 and applied asynchronously when the corresponding component tree is generated. For this reason always use this method when you
 want to retrieve the model associated to a certain index path in the table view (e.g in didSelectRowAtIndexPath: )
 */
- (nullable id<NSObject>)modelForItemAtIndexPath:(nullable NSIndexPath *)indexPath;

/**
 @return The layout size of the component tree at a certain indexPath. Use this to access the component sizes for instance in a
 `UICollectionViewLayout(s)` or in a `UICollectionViewDelegateFlowLayout`.
 */
- (CGSize)sizeForItemAtIndexPath:(NSIndexPath *)indexPath;

/** @see `CKTransactionalComponentDataSource` */
- (void)reloadAsynchronously:(BOOL)asynchronously
                    userInfo:(nullable NSDictionary *)userInfo NS_SWIFT_NAME(reload(asynchronously:userInfo:));

/** @see `CKTransactionalComponentDataSource` */
- (void)updateConfiguration:(CSTransactionalDataSourceConfiguration *)configuration
             asynchronously:(BOOL)asynchronously
                   userInfo:(nullable NSDictionary *)userInfo;

- (void)updateSizeRange:(CGSizeRange)sizeRange asynchronously:(BOOL)asynchronously NS_REFINED_FOR_SWIFT;

@end

// for CKSupplementaryViewDataSource
NS_SWIFT_NAME(SupplementaryViewDataSource)
@protocol CSSupplementaryViewDataSource<NSObject>

- (nullable UICollectionReusableView *)collectionView:(UICollectionView *)collectionView
                    viewForSupplementaryElementOfKind:(NSString *)kind
                                          atIndexPath:(NSIndexPath *)indexPath;
@end

NS_ASSUME_NONNULL_END


text:
namespace EOLib.Domain.Interact.Shop
{
    public class ShopItem : IShopItem
    {
        public int ID { get; }

        public int Buy { get; }

        public int Sell { get; }

        public int MaxBuy { get; }

        public ShopItem(int id, int buyPrice, int sellPrice, int maxBuy)
        {
            ID = id;
            Buy = buyPrice;
            Sell = sellPrice;
            MaxBuy = maxBuy;
        }
    }

    public interface IShopItem
    {
        int ID { get; }

        int Buy { get; }

        int Sell { get; }

        int MaxBuy { get; }
    }
}


text:
package javagene.io;

import javagene.seq.*;
import javagene.util.*;

import java.io.*;
import java.util.*;

/**
* Read and write sequences as Fasta files. A Fasta file has a single header line
* of the following format:
*<pre>
    >id description
</pre>
* where the > symbol is required, the id is a single word, and the description can
* be many words, extending to the end of line. The proper interpretation of the id and
* description fields is not fixed. Data lines immediately follow the header line. Multiple
* sequences in a single file are separated from one another by a blank line.
*
* @author Hanno Hinsch
*/
public class Fasta
{

	private Fasta() {};

	/**
	 * Read a Fasta file containing a single sequence into a SeqBig object.
	 *
	 * @param filename The path to the file.
	 * @return The SeqBig object.
	 * @throws IOException Something went wrong -- check exception detail message.
	 */
	public static SeqBig readBig( String filename )
	throws IOException
	{
		return new SeqBig( filename );
	}

	/**
	 * Read a file containing (possibly) multiple sequences.
	 *
	 * @param filename The path to the file.
	 * @param bufferSize An estimate of the size of the largest sequence (hint: unless
	 * you're short on RAM, generously round up. )
	 * @return An ArrayList of SeqMem objects.
	 * @throws IOException Something went wrong -- check exception detail message.
	 */
	public static ArrayList<SeqI> readMany( String filename, int bufferSize )
	throws IOException
	{
		Log.log( "Fasta: Reading " + filename );

		BufferedReader br = new BufferedReader(new FileReader( filename ));

		ArrayList<SeqI> sequences= new ArrayList<SeqI>();

		StringBuffer temp= new StringBuffer( bufferSize );

		SeqFast seq= null;
		String id= null;
		String description= null;

		for( String s= br.readLine(); null != s; s=br.readLine() )
		{
    		s= s.trim();
    		if( 0 < s.length() )	//skip blank lines
    		{
	    		if( s.charAt(0) == '>' )
	    		{
	    			//save current sequence, if any
	    			if( id != null )
	    			{
						seq= new SeqFast(temp.toString(), id, description );

						sequences.add( seq );
						Log.log( "Fasta: " + seq.id() + " loaded." );
						id= null;
						temp.setLength( 0 );	//empty the buffer
					}

	    			//id, desc line
	    			int i= s.indexOf( ' ' );
	    			if( i < 0 )
	    			{
	    				id= s.substring( 1 );	//whole line after >
	    				description="";
	    			}
	    			else
	    			{
		    			id= s.substring( 1, i );
		    			description= s.substring( i );
		    		}
		    	}
	    		else
	    		{
					//sequence data
					if( id != null )
					{
						temp.append( s );
					}
			    	else
			    	{
			    		throw new IOException( "Unexpected char before >" );
			    	}
				}

		    }

		}

		if( id != null )	//grab final sequence
		{
			seq= new SeqFast(temp.toString(), id, description );

			sequences.add( seq );
			Log.log( "Fasta: " + seq.id() + " loaded." );
		}

		br.close();

		return sequences;
	}

	/**
	 * Read a file containing a single sequence.
	 *
	 * @param filename The path to the file.
	 * @param bufferSize An estimate of the size of the sequence (hint: unless
	 * you're short on RAM, generously round up. )
	 * @return A SeqMem object.
	 * @throws IOException Something went wrong -- check exception detail message.
	 */
	public static SeqI read( String filename, int bufferSize )
	throws IOException
	{
		return ( readMany( filename, bufferSize )).get(0);
	}

	/**
	 * Write an ArrayList of sequences to file.
	 *
	 * @param sequences The ArrayList of SeqI sequences.
	 * @param filename The path to the file.
	 * @throws IOException Something went wrong -- check exception detail message.
	 */
	public static void write( ArrayList<SeqI> sequences, String filename )
	throws IOException
	{
		Log.log( "Fasta: Writing " + filename );

		BufferedWriter bw= new BufferedWriter( new FileWriter( filename ));

		for( SeqI seq: sequences )
		{

			bw.write( ">" + seq.id() + " " + seq.description() + " " + (seq.bounds().bioStart()) + "-" + seq.bounds().bioEnd() );
			bw.newLine();

			LocIterator li= seq.bounds().iterator( 60, 60 );
			while( li.hasNext() )
			{
				bw.write( seq.toString( li.next()) );
				bw.newLine();
			}

            bw.write( seq.toString( li.remainder()) );
            bw.newLine();

			bw.newLine();
		}

		bw.close();
	}

	/**
	 * Write a sequence to file.
	 *
	 * @param sequence The SeqI object to write.
	 * @param filename The path to the file.
	 * @throws IOException Something went wrong -- check exception detail message.
	 */
	public static void write( SeqI sequence, String filename )
	throws IOException
	{
		ArrayList<SeqI> list= new ArrayList<SeqI>();
		list.add( sequence );

		write( list, filename );
	}

	/**
	 * @deprecated
	 */
	public static void main( String args[] )
	throws IOException
	{
		ArrayList<SeqI> seqs= Fasta.readMany( "../rfam/rfam.fasta", 500 );

		int max= (seqs.size() < 10)?seqs.size():10;
		for( int i=0; i < max; i++ )
		{
			Log.log( seqs.get(i).id() + seqs.get(i).description() + "\n" );
			Log.log( seqs.get(i).toString() );
		}

	}
}


text:
package fr.openwide.core.imports.table.common.event.exception;

import fr.openwide.core.imports.table.common.location.TableImportLocation;

public class TableImportException extends Exception {

	private static final long serialVersionUID = -4988670342820463252L;

	private final TableImportLocation location;

	public TableImportException(String message) {
		super(message);
		this.location = null;
	}

	public TableImportException(Throwable cause) {
		super(cause);
		this.location = null;
	}

	public TableImportException(String message, Throwable cause) {
		super(message, cause);
		this.location = null;
	}

	public TableImportException(String message, TableImportLocation location) {
		super(message);
		this.location = location;
	}

	public TableImportException(Throwable cause, TableImportLocation location) {
		super(cause);
		this.location = location;
	}

	public TableImportException(String message, Throwable cause, TableImportLocation location) {
		super(message, cause);
		this.location = location;
	}

	public TableImportLocation getLocation() {
		return location;
	}
}


text:
function FileData_Pairs(x)
{
x.t("searching","snp");
x.t("available","registered");
x.t("subject","data");
x.t("type","subjects");
x.t("identify","regions");
x.t("500","records");
x.t("includes","following");
x.t("snp","subject");
x.t("snp","frequency");
x.t("snp","data");
x.t("browse","association");
x.t("association","finding");
x.t("regions","chromosomes");
x.t("regions","interest");
x.t("population","type");
x.t("population","frequency");
x.t("requesting","data");
x.t("determine","snp");
x.t("search","cagwas");
x.t("subjects","retrieve");
x.t("cancer","population");
x.t("patients","controls");
x.t("frequency","searching");
x.t("frequency","population");
x.t("frequency","determine");
x.t("registered","users");
x.t("chromosomes","associated");
x.t("retrieve","data");
x.t("finding","searching");
x.t("finding","identify");
x.t("section","includes");
x.t("interest","browse");
x.t("database","specific");
x.t("specific","patients");
x.t("specific","genes");
x.t("cagwas","database");
x.t("cagwas","data");
x.t("data","500");
x.t("data","association");
x.t("data","population");
x.t("data","requesting");
x.t("data","search");
x.t("data","specific");
x.t("data","browsing");
x.t("genes","regions");
x.t("browsing","cagwas");
x.t("users","section");
x.t("topics","searching");
x.t("controls","available");
x.t("following","topics");
x.t("associated","cancer");
}


text:
package oculus.aperture.common.util;

import java.io.File;
import java.io.IOException;
import java.io.InputStream;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.google.common.io.Files;

/**
 * Utility methods for operating on resources (files)
 *
 * @author rharper
 *
 */
public class ResourceHelper {

	static final Logger logger = LoggerFactory.getLogger(ResourceHelper.class);

	/**
	 * Load a resource give a path and a default (if the path is empty).  The path should
	 * be in the form res:// if it's a classpath resource, otherwise should be a filename.
	 * @param path
	 * @param defaultPath
	 * @return an inputstream or null if failure
	 * @throws IOException
	 */
	static public InputStream getStreamForPath( String path, String defaultPath ) throws IOException {
		if( path == null || path.isEmpty() ) {
			// If not specified use a JAR-local resource
			path = defaultPath;

			if (path == null) {
				return null;
			}
		}

		// Load properties
		InputStream inp = null;

		if (path.startsWith("res://")) {
			// A resource on the classpath
			path = path.substring(6);
			logger.info("Loading resource from: " + path);
			inp = ResourceHelper.class.getResourceAsStream(path);
		} else {
			// A file path
			try {
				File file = new File(path);
				logger.info("Loading file from: " + file.getAbsolutePath());
				inp = Files.newInputStreamSupplier(file).getInput();
			}
			catch (IOException e){
				if (defaultPath != null) {
					logger.info("Error loading file from: " + path);
					logger.info("Using default resource from: " + defaultPath);
					path = defaultPath.substring(6);
					inp = ResourceHelper.class.getResourceAsStream(path);
				}
			}
		}

		if (inp == null) {
			logger.warn("Failed to load resource.");
		}

		return inp;
	}
}


text:
DUMMY_CLASS(UIScreen_YYDebug)

@implementation UIScreen (YYAdd)

- (float)width
{
    return [UIScreen mainScreen].bounds.size.width;
}

- (float)height
{
    return [UIScreen mainScreen].bounds.size.height;
}

- (CGRect)currentBounds {
	return [self boundsForOrientation:[[UIApplication sharedApplication] statusBarOrientation]];
}

- (CGRect)boundsForOrientation:(UIInterfaceOrientation)orientation {
	CGRect bounds = [self bounds];

	if (UIInterfaceOrientationIsLandscape(orientation)) {
		CGFloat buffer = bounds.size.width;
		bounds.size.width = bounds.size.height;
		bounds.size.height = buffer;
	}
	return bounds;
}

// should not predicate
- (BOOL)isRetina {
    return self.scale == 2;
}

@end


text:
#include "JniUtil.h"

#ifndef JNI_GUI_CONTAINER_H
#define JNI_GUI_CONTAINER_H

/**
*@author Grégory Van den Borre
*/
#ifdef __cplusplus
extern "C" {
#endif
JNIEXPORT POINTER JNICALL Java_jni_JniGuiContainer_constructor(
    JNIEnv* env,
    jclass c,
    POINTER pointer,
    jstring name,
    jfloat width,
    jfloat height);
JNIEXPORT POINTER JNICALL Java_jni_JniGuiContainer_constructorParent(
    JNIEnv* env,
    jclass c,
    POINTER,
    jstring,
    jfloat,
    jfloat,
    POINTER);

JNIEXPORT void JNICALL Java_jni_JniGuiContainer_hide(
    JNIEnv* env,
    jobject o,
    POINTER pointer);

JNIEXPORT void JNICALL Java_jni_JniGuiContainer_setPosition(
    JNIEnv* env,
    jobject o,
    POINTER pointer,
    jfloat,
    jfloat);

JNIEXPORT void JNICALL Java_jni_JniGuiContainer_show(
    JNIEnv* env,
    jobject o,
    POINTER pointer);

JNIEXPORT void JNICALL Java_jni_JniGuiContainer_setSize(
    JNIEnv* env,
    jobject o,
    POINTER pointer,
    jfloat,
    jfloat);
JNIEXPORT jstring JNICALL Java_jni_JniGuiContainer_getElement(
    JNIEnv* env,
    jobject o,
    POINTER pointer,
    jfloat,
    jfloat);

JNIEXPORT void JNICALL Java_jni_JniGuiContainer_zoom(
    JNIEnv* env,
    jobject o,
    POINTER pointer,
    jfloat);

JNIEXPORT void JNICALL Java_jni_JniGuiContainer_setZ(
    JNIEnv* env,
    jobject o,
    POINTER pointer,
    jshort);

JNIEXPORT void JNICALL Java_jni_JniGuiContainer_setMaterial(
    JNIEnv* env,
    jobject o,
    POINTER,
    POINTER);

JNIEXPORT void JNICALL Java_jni_JniGuiContainer_addChildrenPosition(
    JNIEnv* env,
    jobject o,
    POINTER pointer,
    jint,
    jint);

#ifdef __cplusplus
}
#endif

#endif