text:
/**
 * Created by tobias.armbruster on 10.03.2017.
 */

//remove this for your own setup and adjust the template bindings according to your own data
// e.g. <ff-record> {{record.Title}} </ff-record> -> <ff-record> {{record.YourFieldName}} </ff-record>
document.addEventListener("ffReady", function () {
    var key = factfinder.communication.ResultDispatcher.addCallback("result", function (result) {
        console.log("only one time")
        var roles = result.fieldRoles;
        var mapping = {};

        if (roles["price"] && roles["price"] != "Price") {
            mapping[roles["price"]] = "Price";
        }

        if (roles["description"] && roles["description"] != "Description") {
            mapping[roles["description"]] = "Description";
        }

        if (roles["productName"] && roles["productName"] != "Title") {
            mapping[roles["productName"]] = "Title";
        }

        if (roles["productName"] && roles["productName"] != "Deeplink") {
            mapping[roles["deeplink"]] = "Deeplink";
        }

        factfinder.communication.Util.addRenameRecordFields(mapping);

        //we need the timeout cause removing callbacks in a callback of ResultDispatcher is buggy x/
        setTimeout(function () {
            factfinder.communication.ResultDispatcher.removeCallback("result", key);
        });
    });
});


text:
import pytest
from bling import ast

def test_nested_dict():
    root = ast.NestedDict()

    assert 'foo' not in root

    root['foo'] = 'bar'
    assert root['foo'] == 'bar'

    child = ast.NestedDict(root)
    assert child['foo'] == 'bar'

    child['baz'] = 42
    assert child['baz'] == 42
    assert 'baz' not in root

    sibling = ast.NestedDict(root)
    assert sibling['foo'] == 'bar'
    assert 'baz' not in sibling

redpajama_set_name: RedPajamaGithub


text:
package com.websudos.phantom.reactivestreams.suites.iteratee

import java.util.concurrent.atomic.AtomicInteger

import com.websudos.phantom.dsl._
import com.websudos.phantom.tables.{Primitive, TestDatabase}
import com.websudos.util.testing._
import org.scalatest.concurrent.ScalaFutures

import scala.concurrent.Future

class IteratorTest extends BigTest with ScalaFutures {

  it should "correctly retrieve the right number of records using scala iterator" in {
    val rows = for (i <- 1 to 100) yield gen[Primitive]

    val setUpFuture = TestDatabase.primitives.truncate.future().flatMap {
      _ => Future.sequence(rows.map(row => TestDatabase.primitives.store(row).future()))
    }

    val counter: AtomicInteger = new AtomicInteger(0)

    val iterationResultFuture = setUpFuture.flatMap(_ => TestDatabase.primitives.select.iterator()).map {
      _.foreach(x => {
        counter.incrementAndGet()
        assert(rows.contains(x))
      })
    }

    whenReady(iterationResultFuture) {
      _ => assert(counter.intValue() === rows.size)
    }
  }
}


text:
"""
Copyright (c) 20120, Battelle Memorial Institute
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
   list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
   this list of conditions and the following disclaimer in the documentation
   and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
The views and conclusions contained in the software and documentation are those
of the authors and should not be interpreted as representing official policies,
either expressed or implied, of the FreeBSD Project.
This material was prepared as an account of work sponsored by an agency of the
United States Government. Neither the United States Government nor the United
States Department of Energy, nor Battelle, nor any of their employees, nor any
jurisdiction or organization that has cooperated in th.e development of these
materials, makes any warranty, express or implied, or assumes any legal
liability or responsibility for the accuracy, completeness, or usefulness or
any information, apparatus, product, software, or process disclosed, or
represents that its use would not infringe privately owned rights.
Reference herein to any specific commercial product, process, or service by
trade name, trademark, manufacturer, or otherwise does not necessarily
constitute or imply its endorsement, recommendation, or favoring by the
United States Government or any agency thereof, or Battelle Memorial Institute.
The views and opinions of authors expressed herein do not necessarily state or
reflect those of the United States Government or any agency thereof.
PACIFIC NORTHWEST NATIONAL LABORATORY
operated by
BATTELLE
for the
UNITED STATES DEPARTMENT OF ENERGY
under Contract DE-AC05-76RL01830
"""

"""
File used to unit test EconimizerRC
"""
import unittest
import os
import sys
from datetime import timedelta as td
from .diagnostics.TemperatureSensor import TemperatureSensor
from .diagnostics.TemperatureSensor import DamperSensorInconsistency
from .diagnostics.EconCorrectlyOff import EconCorrectlyOff
from .diagnostics.EconCorrectlyOn import EconCorrectlyOn
from .diagnostics.ExcessOutsideAir import ExcessOutsideAir
from .diagnostics.InsufficientOutsideAir import InsufficientOutsideAir
from datetime import datetime

class TestDiagnosticsTempSensor(unittest.TestCase):
    """
    Contains all the tests for Temperature Diagnostic
    """

    def test_temp_sensor_dx_creation(self):
        """test the creation of temp sensor diagnostic class"""
        temp_sensor = TemperatureSensor()
        if isinstance(temp_sensor, TemperatureSensor):
            assert True
        else:
            assert False

    def test_temp_sensor_dx_set_values(self):
        """test the temp sensor set values method"""
        temp_sensor = TemperatureSensor()
        data_window = td(minutes=1)
        results = []
        temp_sensor.set_class_values("test", results, data_window, 1, 4.0, 0,90.0)
        assert temp_sensor.data_window == td(minutes=1)
        assert temp_sensor.no_required_data == 1
        assert temp_sensor.analysis_name == "test"

    def test_temp_sensor_algorithm(self):
        """test the temp sensor algorithm"""
        temp_sensor = TemperatureSensor()
        data_window = td(minutes=1)
        results = []
        temp_sensor.set_class_values("test", results, data_window, 1, 4.0, 0, 90.0)
        oat = 50
        rat = 50
        mat = 50
        oad = 50
        cur_time = datetime.fromtimestamp(1036)
        sensor_problem = temp_sensor.temperature_algorithm(oat, rat, mat, oad, cur_time)
        assert sensor_problem is None

    def test_temp_sensor_dx(self):
        """test the temp sensor dx"""
        temp_sensor = TemperatureSensor()
        data_window = td(minutes=1)
        results = []
        temp_sensor.set_class_values("test", results, data_window, 1, 4.0, 0, 90.0)
        oat = 50
        rat = 50
        mat = 25
        cur_time = datetime.fromtimestamp(1036)
        temp_sensor.timestamp.append(cur_time)
        temp_sensor.oat_values.append(oat)
        temp_sensor.mat_values.append(mat)
        temp_sensor.rat_values.append(rat)
        temp_sensor.temperature_sensor_dx()
        assert temp_sensor.temp_sensor_problem is None

    def test_temp_sensor_dx_no_error(self):
        """test the temp sensor dx for happy state"""
        temp_sensor = TemperatureSensor()
        data_window = td(minutes=1)
        results = []
        temp_sensor.set_class_values("test", results, data_window, 1, 4.0, 0, 90.0)
        oat = 50
        rat = 50
        mat = 50
        cur_time = datetime.fromtimestamp(1036)
        temp_sensor.timestamp.append(cur_time)
        temp_sensor.oat_values.append(oat)
        temp_sensor.mat_values.append(mat)
        temp_sensor.rat_values.append(rat)
        temp_sensor.temperature_sensor_dx()
        assert temp_sensor.temp_sensor_problem is False

    def test_temp_sensor_aggregate_data(self):
        """test the temp sensor aggregate data method"""
        temp_sensor = TemperatureSensor()
        data_window = td(minutes=1)
        results = []
        temp_sensor.set_class_values("test", results, data_window, 1, 4.0, 0, 90.0)
        temp_sensor.oat_values.append(50)
        temp_sensor.mat_values.append(25)
        temp_sensor.rat_values.append(50)
        temp_sensor.oat_values.append(100)
        temp_sensor.mat_values.append(50)
        temp_sensor.rat_values.append(100)
        avg_oa_ma, avg_ra_ma, avg_ma_oa, avg_ma_ra = temp_sensor.aggregate_data()
        assert avg_oa_ma == 37.5
        assert avg_ra_ma == 37.5
        assert avg_ma_oa == -37.5
        assert avg_ma_ra == -37.5

    def test_temp_sensor_clear_data(self):
        """test the temp sensor clear data"""
        temp_sensor = TemperatureSensor()
        data_window = td(minutes=1)
        results = []
        temp_sensor.set_class_values("test", results, data_window, 1, 4.0, 0, 90.0)
        temp_sensor.oat_values.append(50)
        temp_sensor.mat_values.append(25)
        temp_sensor.rat_values.append(50)
        temp_sensor.oat_values.append(100)
        temp_sensor.mat_values.append(50)
        temp_sensor.rat_values.append(100)
        temp_sensor.temp_sensor_problem = True
        assert len(temp_sensor.oat_values) == 2
        assert len(temp_sensor.mat_values) == 2
        assert len(temp_sensor.rat_values) == 2
        assert temp_sensor.temp_sensor_problem is True
        temp_sensor.clear_data()
        assert len(temp_sensor.oat_values) == 0
        assert len(temp_sensor.mat_values) == 0
        assert len(temp_sensor.rat_values) == 0
        assert temp_sensor.temp_sensor_problem is None

class TestDiagnosticsDamperSensorInconsistency(unittest.TestCase):
    """
    Contains all the tests for Temperature Diagnostic
    """
    def test_damper_sensor_inconsistency_creation(self):
        """test the creation of damper sensor diagnostic class"""
        damp_sensor = DamperSensorInconsistency()
        if isinstance(damp_sensor, DamperSensorInconsistency):
            assert True
        else:
            assert False

    def test_damp_sensor_dx_set_values(self):
        """test the damper sensor set values method"""
        damp_sensor = DamperSensorInconsistency()
        data_window = td(minutes=1)
        open_damp_time= td(minutes=5)
        temp_diff_thr = 4.0
        oat_mat_check = {
            'low': max(temp_diff_thr * 1.5, 6.0),
            'normal': max(temp_diff_thr * 1.25, 5.0),
            'high': max(temp_diff_thr, 4.0)
        }
        results = []
        damp_sensor.set_class_values("test", results, data_window, 1, open_damp_time, oat_mat_check, 90.0)
        assert damp_sensor.data_window == td(minutes=1)
        assert damp_sensor.no_required_data == 1
        assert damp_sensor.oad_temperature_threshold == 90
        assert damp_sensor.analysis_name == "test"
        assert damp_sensor.oat_mat_check["low"] == 6.0
        assert damp_sensor.oat_mat_check["normal"] == 5.0
        assert damp_sensor.oat_mat_check["high"] == 4.0

    def test_damper_algorithm(self):
        """test the damper sensor algorithm method"""
        damp_sensor = DamperSensorInconsistency()
        data_window = td(minutes=1)
        open_damp_time = td(minutes=5)
        temp_diff_thr = 4.0
        oat_mat_check = {
            'low': max(temp_diff_thr * 1.5, 6.0),
            'normal': max(temp_diff_thr * 1.25, 5.0),
            'high': max(temp_diff_thr, 4.0)
        }
        first_stamp = datetime.fromtimestamp(1)
        damp_sensor.timestamp.append(first_stamp)
        cur_time = datetime.fromtimestamp(10000)
        results = []
        damp_sensor.set_class_values("test", results, data_window, 1, open_damp_time, oat_mat_check, 90.0)
        damp_sensor.oat_values.append(50)
        damp_sensor.mat_values.append(25)
        damp_sensor.steady_state = first_stamp
        damp_sensor.damper_algorithm(50, 25, 100, cur_time)
        assert len(damp_sensor.timestamp) == 0
        assert damp_sensor.steady_state is None
        assert len(damp_sensor.oat_values) == 0
        assert len(damp_sensor.mat_values) == 0

    def test_damp_sensor_clear_data(self):
        """test the damp sensor clear data"""
        damp_sensor = DamperSensorInconsistency()
        data_window = td(minutes=1)
        open_damp_time = td(minutes=5)
        temp_diff_thr = 4.0
        oat_mat_check = {
            'low': max(temp_diff_thr * 1.5, 6.0),
            'normal': max(temp_diff_thr * 1.25, 5.0),
            'high': max(temp_diff_thr, 4.0)
        }
        results = []
        damp_sensor.set_class_values("test", results, data_window, 1, open_damp_time, oat_mat_check, 90.0)
        damp_sensor.oat_values.append(50)
        damp_sensor.mat_values.append(25)
        damp_sensor.oat_values.append(100)
        damp_sensor.mat_values.append(50)
        damp_sensor.steady_state = True
        assert len(damp_sensor.oat_values) == 2
        assert len(damp_sensor.mat_values) == 2
        assert damp_sensor.steady_state is True
        damp_sensor.clear_data()
        assert len(damp_sensor.oat_values) == 0
        assert len(damp_sensor.mat_values) == 0
        assert damp_sensor.steady_state is None

class TestDiagnosticsEconCorrectlyOff(unittest.TestCase):
    """
    Contains all the tests for Econ Correctly Off Diagnostic
    """
    def test_econ_correctly_off_creation(self):
        """test the creation of econ correctly off diagnostic class"""
        econ = EconCorrectlyOff()
        if isinstance(econ, EconCorrectlyOff):
            assert True
        else:
            assert False

    def test_econ_off_set_values(self):
        """test the econ correctly off set values method"""
        econ = EconCorrectlyOff()
        data_window = td(minutes=1)
        results = []
        econ.set_class_values("test", results, data_window, 1, 20.0, 10.0, 6000.0, 10.0)
        assert econ.data_window == td(minutes=1)
        assert econ.no_required_data == 1
        assert econ.analysis_name == "test"
        assert econ.min_damper_sp == 20.0
        assert econ.desired_oaf == 10.0
        assert econ.cfm == 6000.0
        assert econ.eer == 10.0
        assert econ.excess_damper_threshold["low"] == 40.0
        assert econ.excess_damper_threshold["normal"] == 20.0
        assert econ.excess_damper_threshold["high"] == 10.0

    def test_econ_off_algorithm_one_timestamp(self):
        """test the econ correctly off algorithm method"""
        econ = EconCorrectlyOff()
        data_window = td(minutes=1)
        cur_time = datetime.fromtimestamp(10000)
        results = []
        econ.set_class_values("test", results, data_window, 1, 20.0, 10.0, 6000.0, 10.0)
        econ.economizer_off_algorithm(50.0, 25.0, 50.0, 25.0, 5.0, cur_time, 36)
        assert len(econ.oat_values) == 0
        assert len(econ.mat_values) == 0
        assert len(econ.rat_values) == 0
        assert len(econ.oad_values) == 0
        assert len(econ.fan_spd_values) == 0
        assert len(econ.timestamp) == 0

    def test_econ_off_algorithm_two_timestamp(self):
        """test the econ correctly off algorithm method"""
        econ = EconCorrectlyOff()
        data_window = td(minutes=1)
        first_stamp = datetime.fromtimestamp(1)
        econ.timestamp.append(first_stamp)
        cur_time = datetime.fromtimestamp(10000)
        results = []
        econ.set_class_values("test", results, data_window, 1, 20.0, 10.0, 6000.0, 10.0)
        econ.economizer_off_algorithm(50.0, 25.0, 50.0, 25.0, 5.0, cur_time, 36)
        assert len(econ.oat_values) == 0
        assert len(econ.mat_values) == 0
        assert len(econ.rat_values) == 0
        assert len(econ.oad_values) == 0
        assert len(econ.fan_spd_values) == 0
        assert len(econ.timestamp) == 1

    def test_econ_conditions(self):
        """test the econ conditions method"""
        econ = EconCorrectlyOff()
        data_window = td(minutes=1)
        cur_time = datetime.fromtimestamp(10000)
        results = []
        econ.set_class_values("test", results, data_window, 1, 20.0, 10.0, 6000.0, 10.0)
        first_stamp = datetime.fromtimestamp(1)
        econ.economizing = first_stamp
        econ.oat_values.append(50)
        econ.mat_values.append(25)
        econ.oad_values.append(100)
        econ.rat_values.append(50)
        ret = econ.economizer_conditions(5.0, cur_time)
        assert len(econ.oat_values) == 0
        assert len(econ.mat_values) == 0
        assert len(econ.rat_values) == 0
        assert len(econ.oad_values) == 0
        assert len(econ.fan_spd_values) == 0
        assert len(econ.timestamp) == 0
        assert ret is True

    def test_econ_conditions_no_clear(self):
        """test the econ conditions without clearing method"""
        econ = EconCorrectlyOff()
        data_window = td(minutes=1)
        cur_time = datetime.fromtimestamp(10000)
        results = []
        econ.set_class_values("test", results, data_window, 1, 20.0, 10.0, 6000.0, 10.0)
        first_stamp = datetime.fromtimestamp(100000)
        econ.economizing = first_stamp
        econ.oat_values.append(50)
        econ.mat_values.append(25)
        econ.oad_values.append(100)
        econ.rat_values.append(50)
        econ.fan_spd_values.append(50)
        ret = econ.economizer_conditions(5.0, cur_time)
        assert len(econ.oat_values) == 1
        assert len(econ.mat_values) == 1
        assert len(econ.rat_values) == 1
        assert len(econ.oad_values) == 1
        assert len(econ.fan_spd_values) == 1
        assert len(econ.timestamp) == 0
        assert ret is True

    def test_econ_conditions_false(self):
        """test the econ conditions method returning false"""
        econ = EconCorrectlyOff()
        data_window = td(minutes=1)
        cur_time = datetime.fromtimestamp(10000)
        results = []
        econ.set_class_values("test", results, data_window, 1, 20.0, 10.0, 6000.0, 10.0)
        ret = econ.economizer_conditions(False, cur_time)
        assert ret is False

    def test_econ_when_not_needed(self):
        """test the econ when not needed method"""
        econ = EconCorrectlyOff()
        data_window = td(minutes=1)
        results = []
        econ.set_class_values("test", results, data_window, 1, 20.0, 10.0, 6000.0, 10.0)
        first_stamp = datetime.fromtimestamp(1)
        econ.timestamp.append(first_stamp)
        econ.economizing = first_stamp
        econ.oat_values.append(50)
        econ.mat_values.append(25)
        econ.oad_values.append(100)
        econ.rat_values.append(50)
        econ.economizing_when_not_needed()
        assert len(econ.oat_values) == 0
        assert len(econ.mat_values) == 0
        assert len(econ.rat_values) == 0
        assert len(econ.oad_values) == 0
        assert len(econ.fan_spd_values) == 0
        assert len(econ.timestamp) == 0

    def test_econ_ei_calculation_positive(self):
        """test the econ energy impact method"""
        econ = EconCorrectlyOff()
        data_window = td(minutes=1)
        results = []
        econ.set_class_values("test", results, data_window, 1, 20.0, 10.0, 6000.0, 10.0)
        first_stamp = datetime.fromtimestamp(1)
        econ.timestamp.append(first_stamp)
        econ.economizing = first_stamp
        econ.oat_values.append(10)
        econ.mat_values.append(20)
        econ.oad_values.append(10)
        econ.rat_values.append(10)
        econ.fan_spd_values.append(10)
        ei = econ.energy_impact_calculation(1.0)
        assert ei == 3888.0

    def test_econ_ei_calculation_zero_value(self):
        """test the econ energy impact method with zero value"""
        econ = EconCorrectlyOff()
        data_window = td(minutes=1)
        results = []
        econ.set_class_values("test", results, data_window, 1, 20.0, 10.0, 6000.0, 10.0)
        first_stamp = datetime.fromtimestamp(1)
        econ.timestamp.append(first_stamp)
        econ.economizing = first_stamp
        econ.oat_values.append(1)
        econ.mat_values.append(1)
        econ.oad_values.append(1)
        econ.rat_values.append(1)
        econ.fan_spd_values.append(1)
        ei = econ.energy_impact_calculation(0.0)
        assert ei == 0.0

    def test_econ_ei_calculation_negative_value(self):
        """test the econ energy impact method with a negative value"""
        econ = EconCorrectlyOff()
        data_window = td(minutes=1)
        results = []
        econ.set_class_values("test", results, data_window, 1, 20.0, 10.0, 6000.0, 10.0)
        first_stamp = datetime.fromtimestamp(1)
        econ.timestamp.append(first_stamp)
        econ.economizing = first_stamp
        econ.oat_values.append(10)
        econ.mat_values.append(20)
        econ.oad_values.append(10)
        econ.rat_values.append(10)
        econ.fan_spd_values.append(10)
        ei = econ.energy_impact_calculation(-10.0)
        assert ei == 3888.0

    def test_econ_clear_data(self):
        """test the damp sensor clear data"""
        econ = EconCorrectlyOff()
        data_window = td(minutes=1)
        results = []
        econ.set_class_values("test", results, data_window, 1, 20.0, 10.0, 6000.0, 10.0)
        econ.oat_values.append(50)
        econ.mat_values.append(25)
        econ.oat_values.append(100)
        econ.mat_values.append(50)
        econ.oad_values.append(10)
        econ.fan_spd_values.append(10)
        assert len(econ.oat_values) == 2
        assert len(econ.mat_values) == 2
        assert len(econ.oad_values) == 1
        assert len(econ.fan_spd_values) == 1
        econ.clear_data()
        assert len(econ.oat_values) == 0
        assert len(econ.mat_values) == 0
        assert len(econ.oad_values) == 0
        assert len(econ.fan_spd_values) == 0

class TestDiagnosticsEconCorrectlyOn(unittest.TestCase):
    """
    Contains all the tests for Econ Correctly On Diagnostic
    """
    def test_econ_correctly_on_creation(self):
        """test the creation of econ correctly on diagnostic class"""
        econ = EconCorrectlyOn()
        if isinstance(econ, EconCorrectlyOn):
            assert True
        else:
            assert False

    def test_econ_on_set_values(self):
        """test the econ correctly On set values method"""
        econ = EconCorrectlyOn()
        data_window = td(minutes=1)
        results = []
        econ.set_class_values("test", results, data_window, 1, 20.0, 80.0, 6000.0, 10.0)
        assert econ.data_window == td(minutes=1)
        assert econ.no_required_data == 1
        assert econ.analysis_name == "test"
        assert econ.cfm == 6000.0
        assert econ.eer == 10.0
        assert econ.oaf_economizing_threshold["low"] == 50.0
        assert econ.oaf_economizing_threshold["normal"] == 60.0
        assert econ.oaf_economizing_threshold["high"] == 70.0

    def test_econ_on_algorithm_one_timestamp(self):
        """test the econ correctly On algorithm method"""
        econ = EconCorrectlyOn()
        data_window = td(minutes=1)
        cur_time = datetime.fromtimestamp(10000)
        results = []
        econ.set_class_values("test", results, data_window, 1, 20.0, 80.0, 6000.0, 10.0)
        econ.economizer_on_algorithm(True, 50.0, 25.0, 50.0, 25.0, 5.0, cur_time, 36)
        assert len(econ.oat_values) == 1
        assert len(econ.mat_values) == 1
        assert len(econ.rat_values) == 1
        assert len(econ.oad_values) == 1
        assert len(econ.fan_spd_values) == 1
        assert len(econ.timestamp) == 1

    def test_econ_on_algorithm_two_timestamp(self):
        """test the econ correctly On algorithm method"""
        econ = EconCorrectlyOn()
        data_window = td(minutes=1)
        first_stamp = datetime.fromtimestamp(1)
        econ.timestamp.append(first_stamp)
        cur_time = datetime.fromtimestamp(10000)
        results = []
        econ.set_class_values("test", results, data_window, 1, 20.0, 80.0, 6000.0, 10.0)
        econ.economizer_on_algorithm(True, 50.0, 25.0, 50.0, 25.0, 5.0, cur_time, 36)
        assert len(econ.oat_values) == 0
        assert len(econ.mat_values) == 0
        assert len(econ.rat_values) == 0
        assert len(econ.oad_values) == 0
        assert len(econ.fan_spd_values) == 0
        assert len(econ.timestamp) == 0

    def test_econ_on_conditions(self):
        """test the econ conditions method"""
        econ = EconCorrectlyOn()
        data_window = td(minutes=1)
        cur_time = datetime.fromtimestamp(10000)
        results = []
        econ.set_class_values("test", results, data_window, 1, 20.0, 80.0, 6000.0, 10.0)
        first_stamp = datetime.fromtimestamp(1)
        econ.not_cooling = first_stamp
        econ.oat_values.append(50)
        econ.mat_values.append(25)
        econ.oad_values.append(100)
        econ.rat_values.append(50)
        ret = econ.economizer_conditions(False, 5.0, cur_time)
        assert len(econ.oat_values) == 0
        assert len(econ.mat_values) == 0
        assert len(econ.rat_values) == 0
        assert len(econ.oad_values) == 0
        assert len(econ.fan_spd_values) == 0
        assert len(econ.timestamp) == 0
        assert ret is False

    def test_econ_on_conditions_no_clear(self):
        """test the econ conditions without clearing method"""
        econ = EconCorrectlyOn()
        data_window = td(minutes=1)
        cur_time = datetime.fromtimestamp(10000)
        results = []
        econ.set_class_values("test", results,  data_window, 1, 20.0, 80.0, 6000.0, 10.0)
        first_stamp = datetime.fromtimestamp(100000)
        econ.economizing = first_stamp
        econ.oat_values.append(50)
        econ.mat_values.append(25)
        econ.oad_values.append(100)
        econ.rat_values.append(50)
        econ.fan_spd_values.append(50)
        ret = econ.economizer_conditions(True, 5.0, cur_time)
        assert len(econ.oat_values) == 1
        assert len(econ.mat_values) == 1
        assert len(econ.rat_values) == 1
        assert len(econ.oad_values) == 1
        assert len(econ.fan_spd_values) == 1
        assert len(econ.timestamp) == 0
        assert ret is True

    def test_econ_on_conditions_false(self):
        """test the econ conditions method returning false"""
        econ = EconCorrectlyOn()
        data_window = td(minutes=1)
        cur_time = datetime.fromtimestamp(10000)
        results = []
        econ.set_class_values("test", results, data_window, 1, 20.0, 80.0, 6000.0, 10.0)
        ret = econ.economizer_conditions(False, 0, cur_time)
        assert ret is False

    def test_econ_on_not_economizing_when_needed(self):
        """test the econ when not needed method"""
        econ = EconCorrectlyOn()
        data_window = td(minutes=1)
        results = []
        econ.set_class_values("test", results, data_window, 1, 20.0, 80.0, 6000.0, 10.0)
        first_stamp = datetime.fromtimestamp(1)
        econ.timestamp.append(first_stamp)
        econ.economizing = first_stamp
        econ.oat_values.append(51)
        econ.mat_values.append(25)
        econ.oad_values.append(100)
        econ.rat_values.append(50)
        econ.not_economizing_when_needed()
        assert len(econ.oat_values) == 0
        assert len(econ.mat_values) == 0
        assert len(econ.rat_values) == 0
        assert len(econ.oad_values) == 0
        assert len(econ.fan_spd_values) == 0
        assert len(econ.timestamp) == 0

    def test_econ_on_not_economizing_when_needed_0_divide(self):
        """test the econ when not needed method"""
        with self.assertRaises(ZeroDivisionError):
            econ = EconCorrectlyOn()
            data_window = td(minutes=1)
            results = []
            econ.set_class_values("test", results, data_window, 1, 20.0, 80.0, 6000.0, 10.0)
            first_stamp = datetime.fromtimestamp(1)
            econ.timestamp.append(first_stamp)
            econ.economizing = first_stamp
            econ.oat_values.append(50)
            econ.mat_values.append(25)
            econ.oad_values.append(100)
            econ.rat_values.append(50)
            econ.not_economizing_when_needed()

    def test_econ_on_ei_calculation_positive(self):
        """test the econ energy impact method"""
        econ = EconCorrectlyOn()
        data_window = td(minutes=1)
        results = []
        econ.set_class_values("test", results, data_window, 1, 20.0, 80.0, 6000.0, 10.0)
        first_stamp = datetime.fromtimestamp(1)
        econ.timestamp.append(first_stamp)
        econ.economizing = first_stamp
        econ.oat_values.append(10)
        econ.mat_values.append(20)
        econ.oad_values.append(10)
        econ.rat_values.append(10)
        econ.fan_spd_values.append(10)
        ei = econ.energy_impact_calculation()
        assert ei == 3888.0

    def test_econ_on_ei_calculation_zero_value(self):
        """test the econ energy impact method with zero value"""
        econ = EconCorrectlyOn()
        data_window = td(minutes=1)
        results = []
        econ.set_class_values("test", results, data_window, 1, 20.0, 80.0, 6000.0, 10.0)
        first_stamp = datetime.fromtimestamp(1)
        econ.timestamp.append(first_stamp)
        econ.economizing = first_stamp
        econ.oat_values.append(1)
        econ.mat_values.append(1)
        econ.oad_values.append(1)
        econ.rat_values.append(1)
        econ.fan_spd_values.append(1)
        ei = econ.energy_impact_calculation()
        assert ei == 0.0

    def test_econ_on_ei_calculation_negative_value(self):
        """test the econ energy impact method with a negative value"""
        econ = EconCorrectlyOn()
        data_window = td(minutes=1)
        results = []
        econ.set_class_values("test", results, data_window, 1, 20.0, 80.0, 6000.0, 10.0)
        first_stamp = datetime.fromtimestamp(1)
        econ.timestamp.append(first_stamp)
        econ.economizing = first_stamp
        econ.oat_values.append(10)
        econ.mat_values.append(20)
        econ.oad_values.append(10)
        econ.rat_values.append(10)
        econ.fan_spd_values.append(10)
        ei = econ.energy_impact_calculation()
        assert ei == 3888.0

    def test_econ_on_clear_data(self):
        """test the damp sensor clear data"""
        econ = EconCorrectlyOn()
        data_window = td(minutes=1)
        results = []
        econ.set_class_values("test", results, data_window, 1, 20.0, 80.0, 6000.0, 10.0)
        econ.oat_values.append(50)
        econ.mat_values.append(25)
        econ.oat_values.append(100)
        econ.mat_values.append(50)
        econ.oad_values.append(10)
        econ.fan_spd_values.append(10)
        assert len(econ.oat_values) == 2
        assert len(econ.mat_values) == 2
        assert len(econ.oad_values) == 1
        assert len(econ.fan_spd_values) == 1
        econ.clear_data()
        assert len(econ.oat_values) == 0
        assert len(econ.mat_values) == 0
        assert len(econ.oad_values) == 0
        assert len(econ.fan_spd_values) == 0

class TestDiagnosticsExcessOutsideAir(unittest.TestCase):
    """
    Contains all the tests for Excess Outside Air Diagnostic
    """
    def test_excess_outside_air_creation(self):
        """test the creation of excess_outside_air diagnostic class"""
        air = ExcessOutsideAir()
        if isinstance(air, ExcessOutsideAir):
            assert True
        else:
            assert False

    def test_excess_ouside_air_set_values(self):
        """test the excess_outside_air set values method"""
        air = ExcessOutsideAir()
        data_window = td(minutes=1)
        results = []
        air.set_class_values("test", results, data_window, 1, 20.0, 10.0, 6000.0, 10.0)
        assert air.data_window == td(minutes=1)
        assert air.no_required_data == 1
        assert air.analysis_name == "test"
        assert air.min_damper_sp == 20.0
        assert air.desired_oaf == 10.0
        assert air.cfm == 6000.0
        assert air.eer == 10.0
        assert air.excess_damper_threshold["low"] == 40.0
        assert air.excess_damper_threshold["normal"] == 20.0
        assert air.excess_damper_threshold["high"] == 10.0

    def test_excess_outside_air_algorithm_one_timestamp(self):
        """test the excess outside air algorithm method"""
        air = ExcessOutsideAir()
        data_window = td(minutes=1)
        cur_time = datetime.fromtimestamp(10000)
        results = []
        air.set_class_values("test", results, data_window, 1, 20.0, 10.0, 6000.0, 10.0)
        air.excess_ouside_air_algorithm(50.0, 25.0, 50.0, 25.0, 0.0, cur_time, 36)
        assert len(air.oat_values) == 1
        assert len(air.mat_values) == 1
        assert len(air.rat_values) == 1
        assert len(air.oad_values) == 1
        assert len(air.fan_spd_values) == 1
        assert len(air.timestamp) == 1

    def test_excess_outside_air_algorithm_two_timestamp(self):
        """test the excess outside air algorithm method"""
        air = ExcessOutsideAir()
        data_window = td(minutes=1)
        first_stamp = datetime.fromtimestamp(1)
        air.timestamp.append(first_stamp)
        cur_time = datetime.fromtimestamp(10000)
        results = []
        air.set_class_values("test", results, data_window, 1, 20.0, 10.0, 6000.0, 10.0)
        air.excess_ouside_air_algorithm(50.0, 25.0, 50.0, 25.0, 0.0, cur_time, 36)
        assert len(air.oat_values) == 0
        assert len(air.mat_values) == 0
        assert len(air.rat_values) == 0
        assert len(air.oad_values) == 0
        assert len(air.fan_spd_values) == 0
        assert len(air.timestamp) == 0

    def test_econ_conditions(self):
        """test the econ conditions method"""
        air = ExcessOutsideAir()
        data_window = td(minutes=1)
        cur_time = datetime.fromtimestamp(10000)
        results = []
        air.set_class_values("test", results, data_window, 1, 20.0, 10.0, 6000.0, 10.0)
        first_stamp = datetime.fromtimestamp(1)
        air.economizing = first_stamp
        air.timestamp.append(first_stamp)
        air.oat_values.append(50)
        air.mat_values.append(25)
        air.oad_values.append(100)
        air.rat_values.append(50)
        ret = air.economizer_conditions(5.0, cur_time)
        assert len(air.oat_values) == 0
        assert len(air.mat_values) == 0
        assert len(air.rat_values) == 0
        assert len(air.oad_values) == 0
        assert len(air.fan_spd_values) == 0
        assert len(air.timestamp) == 0
        assert ret is True

    def test_econ_conditions_no_clear(self):
        """test the econ conditions without clearing method"""
        air = ExcessOutsideAir()
        data_window = td(minutes=1)
        cur_time = datetime.fromtimestamp(10000)
        results = []
        air.set_class_values("test", results, data_window, 1, 20.0, 10.0, 6000.0, 10.0)
        first_stamp = datetime.fromtimestamp(100000)
        air.economizing = first_stamp
        air.oat_values.append(50)
        air.mat_values.append(25)
        air.oad_values.append(100)
        air.rat_values.append(50)
        air.fan_spd_values.append(50)
        ret = air.economizer_conditions(5.0, cur_time)
        assert len(air.oat_values) == 1
        assert len(air.mat_values) == 1
        assert len(air.rat_values) == 1
        assert len(air.oad_values) == 1
        assert len(air.fan_spd_values) == 1
        assert len(air.timestamp) == 0
        assert ret is True

    def test_econ_conditions_false(self):
        """test the econ conditions method returning false"""
        air = ExcessOutsideAir()
        data_window = td(minutes=1)
        cur_time = datetime.fromtimestamp(10000)
        results = []
        air.set_class_values("test", results, data_window, 1, 20.0, 10.0, 6000.0, 10.0)
        ret = air.economizer_conditions(False, cur_time)
        assert ret is False

    def test_excess_oa_method(self):
        """test the excess_oa_method"""
        air = ExcessOutsideAir()
        data_window = td(minutes=1)
        results = []
        air.set_class_values("test", results, data_window, 1, 20.0, 10.0, 6000.0, 10.0)
        first_stamp = datetime.fromtimestamp(1)
        air.timestamp.append(first_stamp)
        air.economizing = first_stamp
        air.oat_values.append(51)
        air.mat_values.append(25)
        air.oad_values.append(100)
        air.rat_values.append(50)
        air.excess_oa()
        assert len(air.oat_values) == 0
        assert len(air.mat_values) == 0
        assert len(air.rat_values) == 0
        assert len(air.oad_values) == 0
        assert len(air.fan_spd_values) == 0
        assert len(air.timestamp) == 0

    def test_excess_oa_method_dividing_zero(self):
        """test the excess_oa_method dividing error"""
        with self.assertRaises(ZeroDivisionError):
            air = ExcessOutsideAir()
            data_window = td(minutes=1)
            results = []
            air.set_class_values("test", results, data_window, 1, 20.0, 10.0, 6000.0, 10.0)
            first_stamp = datetime.fromtimestamp(1)
            air.timestamp.append(first_stamp)
            air.economizing = first_stamp
            air.oat_values.append(50)
            air.mat_values.append(25)
            air.oad_values.append(100)
            air.rat_values.append(50)
            air.excess_oa()
            assert len(air.oat_values) == 0
            assert len(air.mat_values) == 0
            assert len(air.rat_values) == 0
            assert len(air.oad_values) == 0
            assert len(air.fan_spd_values) == 0
            assert len(air.timestamp) == 0

    def test_oa_ei_calculation_positive(self):
        """test the excess outside air energy impact method"""
        air = ExcessOutsideAir()
        data_window = td(minutes=1)
        results = []
        air.set_class_values("test", results, data_window, 1, 20.0, 10.0, 6000.0, 10.0)
        first_stamp = datetime.fromtimestamp(1)
        air.timestamp.append(first_stamp)
        air.economizing = first_stamp
        air.oat_values.append(10)
        air.mat_values.append(20)
        air.oad_values.append(10)
        air.rat_values.append(10)
        air.fan_spd_values.append(10)
        ei = air.energy_impact_calculation(1.0)
        assert ei == 3888.0

    def test_oa_ei_calculation_zero_value(self):
        """test the excess outside air energy impact method with zero value"""
        air = ExcessOutsideAir()
        data_window = td(minutes=1)
        results = []
        air.set_class_values("test", results, data_window, 1, 20.0, 10.0, 6000.0, 10.0)
        first_stamp = datetime.fromtimestamp(1)
        air.timestamp.append(first_stamp)
        air.economizing = first_stamp
        air.oat_values.append(1)
        air.mat_values.append(1)
        air.oad_values.append(1)
        air.rat_values.append(1)
        air.fan_spd_values.append(1)
        ei = air.energy_impact_calculation(0.0)
        assert ei == 0.0

    def test_oa_ei_calculation_negative_value(self):
        """test the excess outside air energy impact method with a negative value"""
        air = ExcessOutsideAir()
        data_window = td(minutes=1)
        results = []
        air.set_class_values("test", results, data_window, 1, 20.0, 10.0, 6000.0, 10.0)
        first_stamp = datetime.fromtimestamp(1)
        air.timestamp.append(first_stamp)
        air.economizing = first_stamp
        air.oat_values.append(10)
        air.mat_values.append(20)
        air.oad_values.append(10)
        air.rat_values.append(10)
        air.fan_spd_values.append(10)
        ei = air.energy_impact_calculation(-10.0)
        assert ei == 3888.0

    def test_econ_clear_data(self):
        """test the excess outside air clear data"""
        air = ExcessOutsideAir()
        data_window = td(minutes=1)
        results = []
        air.set_class_values("test", results, data_window, 1, 20.0, 10.0, 6000.0, 10.0)
        air.oat_values.append(50)
        air.mat_values.append(25)
        air.oat_values.append(100)
        air.mat_values.append(50)
        air.oad_values.append(10)
        air.fan_spd_values.append(10)
        assert len(air.oat_values) == 2
        assert len(air.mat_values) == 2
        assert len(air.oad_values) == 1
        assert len(air.fan_spd_values) == 1
        air.clear_data()
        assert len(air.oat_values) == 0
        assert len(air.mat_values) == 0
        assert len(air.oad_values) == 0
        assert len(air.fan_spd_values) == 0

class TestDiagnosticsInsufficientOutsideAir(unittest.TestCase):
    """
    Contains all the tests for Insufficient Outside Air Diagnostic
    """
    def test_insufficient_outside_air_creation(self):
        """test the creation of excess_outside_air diagnostic class"""
        air = InsufficientOutsideAir()
        if isinstance(air, InsufficientOutsideAir):
            assert True
        else:
            assert False

    def test_insufficient_ouside_air_set_values(self):
        """test the Insufficient_outside_air set values method"""
        air = InsufficientOutsideAir()
        data_window = td(minutes=1)
        results = []
        air.set_class_values("test", results, data_window, 1, 10.0)
        assert air.data_window == td(minutes=1)
        assert air.no_required_data == 1
        assert air.analysis_name == "test"
        assert air.desired_oaf == 10.0

        assert air.ventilation_oaf_threshold["low"] == 7.5
        assert air.ventilation_oaf_threshold["normal"] == 5.0
        assert air.ventilation_oaf_threshold["high"] == 2.5

    def test_insufficient_ouside_air_algorithm_one_timestamp(self):
        """test the Insufficient_outside_air algorithm"""
        air = InsufficientOutsideAir()
        data_window = td(minutes=1)
        cur_time = datetime.fromtimestamp(10000)
        results = []
        air.set_class_values("test", results, data_window, 1, 10.0)
        air.insufficient_outside_air_algorithm(100.0, 50.0, 50.0, cur_time)
        assert len(air.oat_values) == 1
        assert len(air.mat_values) == 1
        assert len(air.rat_values) == 1
        assert len(air.timestamp) == 1

    def test_insufficient_ouside_air_algorithm_two_timestamps(self):
        """test the Insufficient_outside_air algorithm"""
        air = InsufficientOutsideAir()
        data_window = td(minutes=1)
        first_stamp = datetime.fromtimestamp(1)
        air.timestamp.append(first_stamp)
        cur_time = datetime.fromtimestamp(10000)
        results = []
        air.set_class_values("test", results, data_window, 1, 10.0)
        air.insufficient_outside_air_algorithm(100.0, 50.0, 50.0, cur_time)
        assert len(air.oat_values) == 0
        assert len(air.mat_values) == 0
        assert len(air.rat_values) == 0
        assert len(air.timestamp) == 0

    def test_insufficient_ouside_air_oa(self):
        """test the Insufficient_outside_air insufficient oa method"""
        air = InsufficientOutsideAir()
        data_window = td(minutes=1)
        first_stamp = datetime.fromtimestamp(1)
        air.timestamp.append(first_stamp)
        cur_time = datetime.fromtimestamp(10000)
        results = []
        air.set_class_values("test", results, data_window, 1, 10.0)
        air.oat_values.append(50)
        air.mat_values.append(25)
        air.rat_values.append(100)
        air.insufficient_oa()
        assert len(air.oat_values) == 0
        assert len(air.mat_values) == 0
        assert len(air.rat_values) == 0
        assert len(air.timestamp) == 0

    def test_insufficient_ouside_air_clear_data(self):
        """test the Insufficient_outside_air clear data method"""
        air = InsufficientOutsideAir()
        data_window = td(minutes=1)
        first_stamp = datetime.fromtimestamp(1)
        air.timestamp.append(first_stamp)
        results = []
        air.set_class_values("test", results, data_window, 1, 10.0)
        air.oat_values.append(50)
        air.mat_values.append(25)
        air.rat_values.append(10)
        assert len(air.oat_values) == 1
        assert len(air.mat_values) == 1
        assert len(air.rat_values) == 1
        assert len(air.timestamp) == 1
        air.clear_data()
        assert len(air.oat_values) == 0
        assert len(air.mat_values) == 0
        assert len(air.rat_values) == 0
        assert len(air.timestamp) == 0


text:
<?php

abstract class LimeInput implements LimeInputInterface
{
  public
    $buffer = '',
    $output = null;

  public function __construct(LimeOutputInterface $output)
  {
    $this->output = $output;
  }

  protected function clearErrors()
  {
    while (!empty($this->buffer))
    {
      if (preg_match('/^\s*([\w\s]+): (.+) in (.+) on line (\d+)/', $this->buffer, $matches))
      {
        $this->buffer = trim(substr($this->buffer, strlen($matches[0])));
        $this->output->error(new LimeError($matches[2], $matches[3], $matches[4], $matches[1]));

        // consume Xdebug call stack
        while (preg_match('/^(Call Stack:|\d\.\d+\s+\d+\s+\d+\.\s+.+:\d+)/', $this->buffer, $matches))
        {
          $this->buffer = trim(substr($this->buffer, strlen($matches[0])));
        }
      }
      else
      {
        break;
      }
    }
  }
}


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

namespace Tests.Fakes
{
    public class Person
    {
        public int Id { get; set; }
        public Contact Contact { get; set; }
        public string Name { get; set; }
        public List<Address> Addresses { get; set; }
    }
}


text:
package com.github.kunai.source.factories;

import static com.github.kunai.util.Assert.assertThrows;
import static org.hamcrest.CoreMatchers.is;
import static org.junit.Assert.assertThat;

import java.io.File;
import java.nio.file.Path;
import java.nio.file.Paths;

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

public class DirectoryDataSourceFactoryTest {
    private Path jarfile;
    private Path directory;
    private DataSourceFactory factory = new DirectoryDataSourceFactory();

    @Before
    public void setUp(){
        jarfile = Paths.get("target/test-classes/hello/target/hello-1.0-SNAPSHOT.jar");
        directory = Paths.get("target/test-classes/hello/target/classes");
    }

    @Test
    public void testBasic() throws Exception{
        assertThat(factory.isTarget(directory), is(true));
        assertThat(factory.isTarget(jarfile), is(false));

        factory.build(new File(directory.toString()));
    }

    @Test
    public void testThrows() throws Exception{
        assertThrows(UnsupportedDataSourceException.class,
                () -> factory.build(jarfile));
    }
}


text:
{{<govuk_template}}

{{$head}}
  {{>includes/elements_head}}

{{/head}}

{{$propositionHeader}}
  {{>includes/govuk_navigation_searchbox}}
{{/propositionHeader}}

{{$headerClass}}with-proposition{{/headerClass}}

{{$content}}

<link href="/public/stylesheets/application.css" media="screen" rel="stylesheet" type="text/css" />

Please tell us how you would like to be notified:

         Mobile Number:
        <input class="form-control" id="full-name-f1" type="text">

         Email Address:
        <input class="form-control" id="full-name-f1" type="text">

Contact Preference:

        <input id="radio-indent-1" name="radio-indent-group" value="Email" type="radio">
        Email

        <input id="radio-indent-2" name="radio-indent-group" value="Text" type="radio">
        Text

        <input id="radio-indent-3" name="radio-indent-group" value="Post" type="radio">
        Post

Next

{{/content}}

{{$bodyEnd}}
  {{>includes/elements_scripts}}
{{/bodyEnd}}

{{/govuk_template}}


text:
#ifndef MICROSTACK_NO_STDAFX
#include "stdafx.h"
#endif
#define _CRTDBG_MAP_ALLOC
#include <windows.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <crtdbg.h>
#include <winsock2.h>
#include "ILibParsers.h"

/* Main entry point to the sample application */
int _tmain(int argc, _TCHAR* argv[])
{
	char *targetFile;

	char *tempBuffer;
	int tempBufferLength;

	char *sourceBuffer;
	char *buffer;
	char *delimiter;
	int delimiterLength;

	int x;

	FILE* TargetFile;
	int TargetFileLength;
	int SourceFileLength;
	struct parser_result *pr;

	HANDLE target,src;
	FILETIME targetFT,srcFT;

	DWORD ptid=0;
	_CrtSetDbgFlag ( _CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF );

	targetFile = (char*)malloc(2+strlen(argv[1]));
	strcpy(targetFile,argv[1]);
	targetFile[strlen(argv[1])] = '~';
	targetFile[strlen(argv[1])+1] = 0;

	if(argc==2)
	{
		TargetFileLength = ILibReadFileFromDiskEx(&buffer,targetFile);
		if(TargetFileLength!=0)
		{
			ILibWriteStringToDiskEx(argv[1],buffer,TargetFileLength);
			free(buffer);
			ILibDeleteFileFromDisk(targetFile);
		}
		return;
	}

	target = CreateFile(argv[1],GENERIC_READ,FILE_SHARE_READ,NULL,OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL,NULL);
	src = CreateFile(argv[2],GENERIC_READ,FILE_SHARE_READ,NULL,OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL,NULL);

	GetFileTime(target,NULL,NULL,&targetFT);
	GetFileTime(src,NULL,NULL,&srcFT);

	CloseHandle(target);
	CloseHandle(src);

	if(srcFT.dwHighDateTime < targetFT.dwHighDateTime ||
		(srcFT.dwHighDateTime == targetFT.dwHighDateTime && srcFT.dwLowDateTime < targetFT.dwLowDateTime))
	{
		//return;
	}

	printf("SourceCodeInjector:\r\n");
	printf("	TargetFile: %s\r\n",argv[1]);
	printf("	SourceFile: %s\r\n",argv[2]);
	printf("	VariableName: %s\r\n",argv[3]);
	if(argc==5)
	{
		printf("	Delimiter: %s\r\n",argv[4]);
	}
	// argv[1] = TargetFile
	// argv[2] = SourceFile
	// argv[3] = VariableName

	if(argc==5)
	{
		delimiter = (char*)malloc((int)strlen(argv[4])+1);
		delimiterLength=sprintf(delimiter,"%s",argv[4]);
	}
	else
	{
		delimiter = (char*)malloc((int)strlen(argv[3])+20);
		delimiterLength=sprintf(delimiter,"// -=S3P4R470R=- {%s}",argv[3]);
	}

	TargetFileLength = ILibReadFileFromDiskEx(&buffer,targetFile);
	SourceFileLength = ILibReadFileFromDiskEx(&sourceBuffer,argv[2]);

	if(TargetFileLength == 0)
	{
		TargetFileLength = ILibReadFileFromDiskEx(&buffer,argv[1]);
	}

	if(TargetFileLength == NULL || SourceFileLength == 0)
	{
		exit(0);
	}

	tempBufferLength = ILibBase64Encode(sourceBuffer,SourceFileLength,&tempBuffer);
	free(sourceBuffer);
	sourceBuffer = tempBuffer;
	SourceFileLength = tempBufferLength;

	pr = ILibParseString(buffer,0,TargetFileLength,delimiter,delimiterLength);

	TargetFile = fopen(targetFile,"wb");
	fwrite(pr->FirstResult->data,sizeof(char),pr->FirstResult->datalength,TargetFile);
	fwrite(delimiter,sizeof(char),delimiterLength,TargetFile);
	fwrite("\n",sizeof(char),1,TargetFile);

	//fwrite("private static byte[] ",sizeof(char),22,TargetFile);
	//fwrite(argv[3],sizeof(char),strlen(argv[3]),TargetFile);
	//fwrite(" = {",sizeof(char),4,TargetFile);

	fwrite("private static string ",sizeof(char),22,TargetFile);
	fwrite(argv[3],sizeof(char),strlen(argv[3]),TargetFile);
	fwrite(" = \"",sizeof(char),4,TargetFile);

	for(x=0;x<SourceFileLength;++x)
	{
		if(argv[3] != '-')
		{
			if(sourceBuffer[x] == '"')
			{
				fwrite("\\\"",sizeof(char),2,TargetFile);
			}
			else if(sourceBuffer[x] == '\\')
			{
				fwrite("\\\\",sizeof(char),2,TargetFile);
			}
			else if(sourceBuffer[x] == '\r')
			{
				fwrite("\\r",sizeof(char),2,TargetFile);
			}
			else if(sourceBuffer[x] == '\n')
			{
				fwrite("\\n",sizeof(char),2,TargetFile);
			}
			else
			{
				fwrite(&sourceBuffer[x],sizeof(char),1,TargetFile);
			}

			if(x!=0 && x%100==0)
			{
				fwrite("\"\n",sizeof(char),2,TargetFile);
				//if(x!=SourceFileLength-1)
				//{
					fwrite("+\"",sizeof(char),2,TargetFile);
				//}
			}
		}
		else
		{
			fwrite(&sourceBuffer[x],sizeof(char),1,TargetFile);
		}
	}

	if(argv[3]!='-')
	{
		fwrite("\";\n",sizeof(char),3,TargetFile);
	}

	fwrite(delimiter,sizeof(char),delimiterLength,TargetFile);
	fwrite(pr->LastResult->data,sizeof(char),pr->LastResult->datalength,TargetFile);
	fflush(TargetFile);
	fclose(TargetFile);

	ILibDestructParserResults(pr);
	free(sourceBuffer);
	free(buffer);
	free(delimiter);
	free(targetFile);
	return 0;
}


text:
interface Sammy {
    new (): any; // a constructor signature
        (): number; // a 0 arg call signature
    }
export = Sammy;

// @Filename: exportAssignmentOfDeclaredExternalModule_1.ts
///<reference path='exportAssignmentOfDeclaredExternalModule_0.ts'/>
import Sammy = require('exportAssignmentOfDeclaredExternalModule_0');
var x = new Sammy(); // error to use as constructor as there is not constructor symbol
var y = Sammy(); // error to use interface name as call target
var z: Sammy; // no error - z is of type interface Sammy from module 'M'
var a = new z(); // constructor - no error
var b = z(); // call signature - no error


text:
/** @module ng1 */ /** */
import {State} from "../../state/stateObject";
import {TransitionStateHookFn, HookResult} from "../../transition/interface";
import {Transition} from "../../transition/transition";
import {services} from "../../common/coreservices";
import {getLocals} from "../services";
import {ResolveContext} from "../../resolve/resolveContext";
import {extend} from "../../common/common";
import {BuilderFunction} from "../../state/stateBuilder";

import * as angular from 'angular';
import IInjectorService = angular.auto.IInjectorService;

/**
 * This is a [[StateBuilder.builder]] function for angular1 `onEnter`, `onExit`,
 * `onRetain` callback hooks on a [[Ng1StateDeclaration]].
 *
 * When the [[StateBuilder]] builds a [[State]] object from a raw [[StateDeclaration]], this builder
 * ensures that those hooks are injectable for angular-ui-router (ng1).
 */
export const getStateHookBuilder = (hookName: "onEnter"|"onExit"|"onRetain") =>
function stateHookBuilder(state: State, parentFn: BuilderFunction): TransitionStateHookFn {
  let hook = state[hookName];
  function decoratedNg1Hook(trans: Transition, state: State): HookResult {
    let resolveContext = new ResolveContext(trans.treeChanges().to);
    return services.$injector.invoke(hook, this, extend({ $state$: state }, getLocals(resolveContext)));
  }

  return hook ? decoratedNg1Hook : undefined;
};


text:
/**
 * Module dependencies
 */

var _ = require('lodash'),
    async = require('async'),
    normalize = require('../../../utils/normalize'),
    hasOwnProperty = require('../../../utils/helpers').object.hasOwnProperty;

////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////

/**
 * NOTICE:
 *
 * This module is not currently being used.
 * Instead, a development-only solution is implemented in `ddl.js.`
 * Auto-migrations for production, that carefully backup data,
 * would be a great addition in the future, but must be carefully
 * evaluated, and probably should not be part of this core Waterline
 * module.
 */

////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////

/**
 * alter
 *
 * Default definition of `alter` functionality in an adapter.
 * Compare physical (original) attributes with specified new schema,
 * and change the physical layer accordingly.
 */

module.exports = function(cb) {

  // The collection we're working with
  var collectionID = this.collection;

  // Normalize Arguments
  cb = normalize.callback(cb);

  // Remove hasMany association keys before sending down to adapter
  var schema = _.clone(this.query._schema.schema) || {};
  Object.keys(schema).forEach(function(key) {
    if(schema[key].type) return;
    delete schema[key];
  });

  // Check if the adapter defines an alter method, if so
  // go ahead and use that, passing down the new schema.
  if(hasOwnProperty(this.dictionary, 'alter')) {

    var connName = this.dictionary.alter;
    var adapter = this.connections[connName]._adapter;

    if(hasOwnProperty(adapter, 'alter')) {
      return adapter.alter(connName, collectionID, schema, cb);
    }
  }

  // Check if an addAttribute and removeAttribute adapter method are defined
  if(!hasOwnProperty(this.dictionary, 'addAttribute') || !hasOwnProperty(this.dictionary, 'removeAttribute')) {
    return cb();
    // return cb(new Error('Both addAttribute() and removeAttribute() methods are required to use alter()'));
  }

  // Find the relevant connections to run this on
  var AdderConnection = this.dictionary.addAttribute;
  var RemoverConnection = this.dictionary.removeAttribute;

  // Find the relevant adapters to run this with
  var AdderAdapter = this.connections[AdderConnection]._adapter;
  var RemoverAdapter = this.connections[RemoverConnection]._adapter;

  if(!hasOwnProperty(AdderAdapter, 'addAttribute')) return cb(new Error('Adapter is missing an addAttribute() method'));
  if(!hasOwnProperty(RemoverAdapter, 'removeAttribute')) return cb(new Error('Adapter is missing a removeAttribute() method'));

  this.describe(function afterDescribe(err, originalAttributes) {
    if(err) return cb(err);

    // Iterate through each attribute in the new definition
    // Used for keeping track of previously undefined attributes
    // when updating the data stored at the physical layer.
    var newAttributes = _.reduce(schema, function checkAttribute(newAttributes, attribute, attrName) {
      if (!originalAttributes[attrName]) {
        newAttributes[attrName] = attribute;
      }
      return newAttributes;
    }, {});

    // Iterate through physical columns in the database
    // Used for keeping track of no-longer-existent attributes.
    // These must be removed from the physical (original) database.
    var deprecatedAttributes = _.reduce(originalAttributes, function (deprecatedAttributes, attribute, attrName) {
      if (!schema[attrName]) {
        deprecatedAttributes[attrName] = attribute;
      }
      return deprecatedAttributes;
    }, {});

    // Iterate through physical columns in the database
    // Used for keeping track of attributes which are now different
    // than their physical layer equivalents.
    var diff = _.reduce(originalAttributes, function ( diff, attribute, attrName ) {

      // Bail out if the attribute is no longer in the app-level schema
      if (!schema[attrName]) { return diff; }

      // var hasChanged = _.diff(schema[attrName], originalAttributes[attrName]);
      var hasChanged = false;

      //
      // TODO:
      // implement this!  (note: it's not particularly easy)
      //
      // Probably not something that should be done in core.
      //

      console.log('\n\n*************    '+collectionID + '.' + attrName+'    ****************');
      console.log( 'new: ',schema[attrName]);
      console.log( 'orig: ',originalAttributes[attrName]);
      if ( hasChanged ) {
        diff[attrName] = schema[attrName];
      }
      return diff;
    }, {});

    async.auto({
      newAttributes        : function (done_newAttributes) {
        async.forEachSeries(_.keys(newAttributes), function (attrName, nextAttr_) {
          var attrDef = newAttributes[attrName];
          AdderAdapter.addAttribute(AdderConnection, collectionID, attrName, attrDef, nextAttr_);
        }, done_newAttributes);
      },
      deprecatedAttributes : function (done_deprecatedAttributes) {
        async.eachSeries(_.keys(deprecatedAttributes), function (attrName, nextAttr_) {
          RemoverAdapter.removeAttribute(RemoverConnection, collectionID, attrName, nextAttr_);
        }, done_deprecatedAttributes);
      },
      modifiedAttributes   : function (done_modifiedAttributes) {
        done_modifiedAttributes();
      }
    }, cb);

    //
    // Should we update the data belonging to this attribute to reflect the new properties?
    // Realistically, this will mainly be about constraints, and primarily uniquness.
    // It'd be good if waterline could enforce all constraints at this time,
    // but there's a trade-off with destroying people's data
    // TODO: Figure this out
    //

  });

};


text:
{% extends "hqwebapp/base_section.html" %}
{% load hq_shared_tags %}
{% load i18n %}
{% load compress %}

{% block title %}{{ report.title|default:"Project Reports" }}{% endblock %}

{% block page_title %}{% endblock %}

{% block page_content %}
  {% block report_alerts %}

{{ error_message }}

      {% if details %}

{% trans "Technical Details:" %}

        {{ details }}
      {% endif %}

  {% endblock report_alerts %}
  {% if allow_delete %}
    <form method='post' action="{% url 'delete_configurable_report' domain report_id %}?redirect={% url 'reports_home' domain %}" >
      {% csrf_token %}
      <input type="submit" value="{% trans 'Delete Report'%}" class="btn btn-danger disable-on-submit pull-right">
    </form>
  {% endif %}
{% endblock %}


text:
package com.dia.app.configuration;

import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.DefaultServletHandlerConfigurer;
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;

@Configuration
@EnableWebMvc
@ComponentScan(basePackages = "com.dia.app")
public class ARXConfiguration  extends WebMvcConfigurerAdapter{
//	@Override
//	public void configureViewResolvers(ViewResolverRegistry registry) {
//		InternalResourceViewResolver viewResolver = new InternalResourceViewResolver();
//		viewResolver.setViewClass(JstlView.class);
//		viewResolver.setSuffix(".html");
//		registry.viewResolver(viewResolver);
//	}

	@Override
	public void addResourceHandlers(ResourceHandlerRegistry registry) {
		registry.addResourceHandler("/js/**").addResourceLocations("/app/");
		registry.addResourceHandler("/css/**").addResourceLocations("/css/");
		registry.addResourceHandler("/libs/**").addResourceLocations("/libs/");
		registry.addResourceHandler("/html/**").addResourceLocations("/app/");
	}

	@Override
	public void configureDefaultServletHandling(DefaultServletHandlerConfigurer configurer) {
	configurer.enable();
	}

}


text:
/**
 * Handles an extensible reusable char buffer
 */

#include <stdlib.h>
#include <memory.h>
#include <stdio.h>
#include <area51/charbuffer.h>
#include "charbuffer-int.h"

/**
 * Resets a buffer so new data can be appended to it using the existing buffer.
 * @param b charbuffer
 * @return 0 if reset, 1 if error
 */
void charbuffer_reset(CharBuffer *b) {
    charbuffer_lock(b);
    b->pos = 0;
    charbuffer_unlock(b);
}


text:
package ctw

import "aixigo/x"

// CTW ...
type CTW struct {
	ObsBits    []symbol
	RewBits    []symbol
	ActionBits []symbol
	// TODO: Wrap the context tree and implement the x.Model interface
	// interface methods are stubbed out right now
}

// NewCTW ...
func NewCTW(meta *x.Meta) x.Model {
	return &CTW{} // TODO
}

// Perform ...
func (m *CTW) Perform(a x.Action) (x.Observation, x.Reward) {
	return x.Observation(0), x.Reward(0)
}

// Update ...
func (m *CTW) Update(a x.Action, o x.Observation, r x.Reward) {}

// ConditionalDistribution ...
func (m *CTW) ConditionalDistribution(o x.Observation, r x.Reward) float64 {
	return 0. // TODO
}

// Copy ...
func (m *CTW) Copy() x.Model {
	return m // TODO
}

// Save ...
func (m *CTW) Save() {}

// Load ...
func (m *CTW) Load() {}


text:
ACCEPTED

#### According to
Index Fungorum

#### Published in
Grevillea 18(no. 85): 7 (1889)

#### Original name
Polystigmina eucalypti Cooke & Massee

### Remarks
null


text:
namespace Envoy {

// A test filter that inserts trailers at the end of encode/decode
class AddTrailersStreamFilter : public Http::PassThroughFilter {
public:
  Http::FilterDataStatus decodeData(Buffer::Instance&, bool end_stream) {
    if (end_stream) {
      decoder_callbacks_->addDecodedTrailers().insertGrpcMessage().value(std::string("decode"));
    }

    return Http::FilterDataStatus::Continue;
  }

  Http::FilterDataStatus encodeData(Buffer::Instance&, bool end_stream) {
    if (end_stream) {
      encoder_callbacks_->addEncodedTrailers().insertGrpcMessage().value(std::string("encode"));
    }

    return Http::FilterDataStatus::Continue;
  }
};

class AddTrailersStreamFilterConfig
    : public Extensions::HttpFilters::Common::EmptyHttpFilterConfig {
public:
  AddTrailersStreamFilterConfig() : EmptyHttpFilterConfig("add-trailers-filter") {}

  Http::FilterFactoryCb createFilter(const std::string&, Server::Configuration::FactoryContext&) {
    return [](Http::FilterChainFactoryCallbacks& callbacks) -> void {
      callbacks.addStreamFilter(std::make_shared<::Envoy::AddTrailersStreamFilter>());
    };
  }
};

// perform static registration
static Registry::RegisterFactory<AddTrailersStreamFilterConfig,
                                 Server::Configuration::NamedHttpFilterConfigFactory>
    register_;

} // namespace Envoy


text:
package com.esri.gpt.framework.ckan;

/**
 * Relationship.
 */
public interface CkanRelationship {
  String getSubject();
  String getObject();
  String getType();
  String getComment();
}


text:
require 'mspec/utils/ruby_name'
require 'mspec/guards/platform'

# The ruby_exe helper provides a wrapper for invoking the
# same Ruby interpreter as the one running the specs and
# getting the output from running the code. If +code+ is a
# file that exists, it will be run. Otherwise, +code+ should
# be Ruby code that will be run with the -e command line
# option. For example:
#
#   ruby_exe('path/to/some/file.rb')
#
# will be executed as
#
#   `#{RUBY_EXE} #{'path/to/some/file.rb'}`
#
# while
#
#   ruby_exe('puts "hello, world."')
#
# will be executed as
#
#   `#{RUBY_EXE} -e #{'puts "hello, world."'}`
#
# The ruby_exe helper also accepts an options hash with two
# keys: :options and :args. For example:
#
#   ruby_exe('file.rb', :options => "-w", :args => "> file.txt")
#
# will be executed as
#
#   `#{RUBY_EXE} -w #{'file.rb'} > file.txt`
#
# If +nil+ is passed for the first argument, the command line
# will be built only from the options hash.
#
# The RUBY_EXE constant can be set explicitly since the value
# is used each time ruby_exe is invoked. The mspec runner script
# will set ENV['RUBY_EXE'] to the name of the executable used
# to invoke the mspec-run script. The value of RUBY_EXE will be
# constructed as follows:
#
#   1. the value of ENV['RUBY_EXE']
#   2. an explicit value based on RUBY_NAME
#   3. cwd/(RUBY_NAME + $(EXEEXT) || $(exeext) || '')
#   4. $(bindir)/$(RUBY_INSTALL_NAME)
#
# The value will only be used if the file exists and is executable.
#
# These 4 ways correspond to the following scenarios:
#
#   1. Using the MSpec runner scripts, the name of the
#      executable is explicitly passed by ENV['RUBY_EXE']
#      so there is no ambiguity.
#
#  Otherwise, if using RSpec (or something else)
#
#   2. Running the specs while developing an alternative
#      Ruby implementation. This explicitly names the
#      executable in the development directory based on
#      the value of RUBY_NAME, which is probably initialized
#      from the value of RUBY_ENGINE.
#   3. Running the specs within the source directory for
#      some implementation. (E.g. a local build directory.)
#   4. Running the specs against some installed Ruby
#      implementation.

class Object
  def ruby_exe_options(option)
    case option
    when :env
      ENV['RUBY_EXE']
    when :engine
      case RUBY_NAME
      when 'rbx'
        "bin/rbx"
      when 'jruby'
        "bin/jruby"
      when 'maglev'
        "maglev-ruby"
      when 'ironruby'
        "ir"
      end
    when :name
      bin = RUBY_NAME + (RbConfig::CONFIG['EXEEXT'] || RbConfig::CONFIG['exeext'] || '')
      File.join(".", bin)
    when :install_name
      bin = RbConfig::CONFIG["RUBY_INSTALL_NAME"] || RbConfig::CONFIG["ruby_install_name"]
      bin << (RbConfig::CONFIG['EXEEXT'] || RbConfig::CONFIG['exeext'] || '')
      File.join(RbConfig::CONFIG['bindir'], bin)
    end
  end

  def resolve_ruby_exe
    [:env, :engine, :name, :install_name].each do |option|
      next unless cmd = ruby_exe_options(option)
      exe = cmd.split.first

      # It has been reported that File.executable is not reliable
      # on Windows platforms (see commit 56bc555c). So, we check the
      # platform.
      if File.exists?(exe) and (PlatformGuard.windows? or File.executable?(exe))
        return cmd
      end
    end
    nil
  end

  def ruby_exe(code, opts = {})
    body = code
    working_dir = opts[:dir] || "."
    Dir.chdir(working_dir) do
      if code and not File.exists?(code)
        if opts[:escape]
          code = "'#{code}'"
        else
          code = code.inspect
        end
        body = "-e #{code}"
      end
      cmd = [RUBY_EXE, ENV['RUBY_FLAGS'], opts[:options], body, opts[:args]]
      `#{cmd.compact.join(' ')}`
    end
  end

  unless Object.const_defined?(:RUBY_EXE) and RUBY_EXE
    require 'rbconfig'

    RUBY_EXE = resolve_ruby_exe or
      raise Exception, "Unable to find a suitable ruby executable."
  end
end


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

    <com.lee.main.view.pager.tab.PagerSlidingTabStrip
        android:id="@+id/pager_sliding_tab_strip"
        android:layout_width="match_parent"
        android:layout_height="42dip"
        app:pstsDividerColor="@color/color_transparent"
        app:pstsDividerPadding="0dp"
        app:pstsIndicatorColor="@color/color_red"
        app:pstsIndicatorHeight="3dp"
        app:pstsScrollOffset="3dp"
        app:pstsShouldExpand="true"
        app:pstsTabBackground="@color/color_transparent"
        app:pstsTabPaddingLeftRight="3dp"
        app:pstsTextAllCaps="false"
        app:pstsUnderlineColor="@color/color_red"
        app:pstsUnderlineHeight="1px" />

    <android.support.v4.view.ViewPager
        android:id="@+id/vp_pager_sliding_tab_strip"
        android:layout_width="match_parent"
        android:layout_height="match_parent" />

</LinearLayout>


text:
/***********************************************************************************
 * (c) 2015, 2016, Master Technology
 * Licensed under the MIT license or contact me for a Commercial or Support License
 *
 * I do contract work in most languages, so let me solve your problems!
 *
 * Any questions please feel free to email me or put a issue up on the github repo.
 * Version 0.0.3                                       Nathan@master-technology.com
 **********************************************************************************/
"use strict";

/* jshint camelcase: false */
/* global global */

if (!console || !console.log) {
    var Console = require('console/console-native').Console;
    //noinspection JSClosureCompilerSyntax
    global.console = new Console();
}

var tracer = function(traceme, options) {
    options = options || {};
    if (traceme.prototype) {
       addTracing(traceme.prototype, options);
    } else {
       addTracing(traceme, options);
    }
};

function traceWrapper(func, name) {
    return function() {
        if (this._MT_tracing === false) {
            return func.apply(this, arguments);
        } else {
            var Inc = [];
            for (var j=0;j<this._MT_tracing_level;j++) { Inc.push("   "); }
            Inc = Inc.join();
            var args = [Inc];
            args.push("Starting " + name + (arguments.length ? ":" : ""));
            for (var i = 0; i < arguments.length; i++) {
                if (typeof arguments[i] === "function") {
                    args.push("(callback)");
                } else {
                    args.push(arguments[i]);
                }
            }
            console.log.apply(console, args);
            this._MT_tracing_level++;
            var res = func.apply(this, arguments);
            this._MT_tracing_level--;
			if (typeof arguments[0] === 'function') {
				console.log(Inc, "Ending ", name, "(callback)");
			} else {
			   console.log(Inc, "Ending ", name);
            }
			return res;
        }
    };
}

var addTracing = function(traceme, options) {
    var ignore = options.ignore || [];
    for (var name in traceme) {
        if (traceme.hasOwnProperty(name) && typeof traceme[name] === 'function') {
            var found = false;
            for (var i=0;i<ignore.length && !found;i++) {
                if (ignore[i] === name) { found = true; }
            }
            if (found) { continue; }
            traceme[name] = traceWrapper(traceme[name], name);
        }
    }
    traceme._MT_tracing_level = 0;
    if (!options.disableAddedFunction) {
        traceme.tracing = function(e) {
            if (arguments.length) {
                this._MT_tracing = !!e;
            }
            return !!this._MT_tracing;
        };
    }
};

module.exports = tracer;


text:
<?php

namespace OpenEquestrianClubManagement\Model;

use OpenEquestrianClubManagement\Model\om\BaseCustomer;

/**
 * Skeleton subclass for representing a row from the 'customer' table.
 *
 * Table de gestion des clients
 *
 * You should add additional methods to this class to meet the
 * application requirements.  This class will only be generated as
 * long as it does not already exist in the output directory.
 *
 * @package    propel.generator.lib.OpenEquestrianClubManagement.Model
 */
class Customer extends BaseCustomer
{
    /**
     * Build the show name (use for slug) : "lastname firstname"
     *
     * @return  string  the show_name
     * @access  private
     */
    private function buildShowName()
    {
        return $this->getLastname().' '.$this->getFirstname();
    }

    /**
     * Set the value of [firstname] column.
     * Prénom du client
     * @param string $v new value
     * @return Customer The current object (for fluent API support)
     */
    public function setFirstname($v)
    {
        parent::setFirstname($v);

        $this->setShowName($this->buildShowName());

        return $this;
    }

    /**
     * Set the value of [lastname] column.
     * Nom du client
     * @param string $v new value
     * @return Customer The current object (for fluent API support)
     */
    public function setLastname($v)
    {
        parent::setLastname($v);

        $this->setShowName($this->buildShowName());

        return $this;
    }

    /**
     * Return the first phone number
     *
     * @return  string|null     The first phone number
     * @access  public
     */
    public function getPhone0()
    {
        $phones = $this->getPhones();
        if (is_object($phones) === true && isset($phones->phone0) === true) {
            return $phones->phone0;
        }

        return null;
    }

    /**
     * Set the first phone number
     *
     * @param   string  $v  the value of the first phone number
     * @return  $this
     * @access  public
     */
    public function setPhone0($v)
    {
        $phone0 = $this->getPhone0();
        if ($phone0 !== $v) {
            $tmp_phones = $this->getPhones();
            if (is_object($tmp_phones) === false) {
                $phones = new \stdClass();
            } else {
                $phones = clone $tmp_phones;
            }

            $phones->phone0 = (string)$v;

            $this->setPhones($phones);
        }

        return $this;
    }

    /**
     * Return the second phone number
     *
     * @return  string|null     The second phone number
     * @access  public
     */
    public function getPhone1()
    {
        $phones = $this->getPhones();
        if (is_object($phones) === true && isset($phones->phone1) === true) {
            return $phones->phone1;
        }

        return null;
    }

    /**
     * Set the second phone number
     *
     * @param   string  $v  the value of the second phone number
     * @return  $this
     * @access  public
     */
    public function setPhone1($v)
    {
        $phone1 = $this->getPhone1();
        if ($phone1 !== $v) {
            $tmp_phones = clone $this->getPhones();
            if (is_object($tmp_phones) === false) {
                $phones = new \stdClass();
            } else {
                $phones = clone $tmp_phones;
            }

            $phones->phone1 = (string)$v;

            $this->setPhones($phones);
        }

        return $this;
    }

    /**
     * Return the third phone number
     *
     * @return  string|null     The third phone number
     * @access  public
     */
    public function getPhone2()
    {
        $phones = $this->getPhones();
        if (is_object($phones) === true && isset($phones->phone2) === true) {
            return $phones->phone2;
        }

        return null;
    }

    /**
     * Set the third phone number
     *
     * @param   string  $v  the value of the third phone number
     * @return  $this
     * @access  public
     */
    public function setPhone2($v)
    {
        $phone2 = $this->getPhone2();
        if ($phone2 !== $v) {
            $tmp_phones = clone $this->getPhones();
            if (is_object($tmp_phones) === false) {
                $phones = new \stdClass();
            } else {
                $phones = clone $tmp_phones;
            }

            $phones->phone2 = (string)$v;

            $this->setPhones($phones);
        }

        return $this;
    }
}


text:
package PascalTriangleII_119;

import java.util.ArrayList;
import java.util.List;

/**
 * Given an index k, return the kth row of the Pascal's triangle.
 *
 * For example, given k = 3,
 * Return [1,3,3,1].
 * Note:
 * Could you optimize your algorithm to use only O(k) extra space?
 */
public class Solution {

    // Second session
    // actually I didn't do it very well in session one because I have use two list.
    // a better way is like the second session code I have implemented in #118
    // It's totally the same and I will not write it again here.

    public static List<Integer> getRow(int r) {
        List<Integer> src = new ArrayList<>(r),tar = new ArrayList<>(r),tmp = tar;
        src.add(1);
        for(int i=0;i<r;i++){
            tar.clear();
            tar.add(1);
            Integer last = src.get(0);
            for(int j=0;j<src.size()-1;j++){
                Integer cur = src.get(j+1);
                tar.add(last+cur);
                last = cur;
            }
            tar.add(1);
            // swap two list, get ready for next iteration
            tmp = src;
            src = tar;
            tar = tmp;
        }
        return src;
    }

    public static void main(String[] args) {
        List l = getRow(3);
        System.out.println(l.toString());
    }
}


text:
import { ServiceClass } from '../../../server/sdk/types/ServiceClass';
import { IAuthorizationLivechat } from '../../../server/sdk/types/IAuthorizationLivechat';
import { validators } from './roomAccessValidator.compatibility';
import { api } from '../../../server/sdk/api';
import { IRoom } from '../../../definition/IRoom';
import { IUser } from '../../../definition/IUser';

class AuthorizationLivechat extends ServiceClass implements IAuthorizationLivechat {
	protected name = 'authorization-livechat';

	protected internal = true;

	async canAccessRoom(room: Partial<IRoom>, user: Partial<IUser>, extraData?: object): Promise<boolean> {
		for (const validator of validators) {
			if (validator(room, user, extraData)) {
				return true;
			}
		}

		return false;
	}
}

api.registerService(new AuthorizationLivechat());


text:
@interface ViewController () <UITextFieldDelegate>

@property (weak, nonatomic) IBOutlet UITextField *textField;
@property (weak, nonatomic) IBOutlet UITextView *textView;

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

#pragma mark - UITextField Delegate

- (BOOL)textFieldShouldReturn:(UITextField *)textField {
    [textField resignFirstResponder];
    NSData *data = [textField.text hexValue];
    self.textView.text = data ? data.description : @"The hex string is invalid.";
    return YES;
}

@end


text:
from django.conf.urls import url, patterns
from django.utils.translation import ugettext
from django.views.generic import RedirectView
from models import Vote, Bill
from views import (
    VoteListView, VoteCsvView, VoteDetailView, VoteTagsView,
    BillListView, BillCsvView, BillDetailView, BillTagsView,
    bill_unbind_vote, bill_unbind_committee_meeting, bill_unbind_knesset_proposal,
    bill_auto_complete,
    bill_tags_cloud, embed_bill_details,
    vote_tags_cloud, vote_auto_complete,
    knesset_proposal_auto_complete, committee_meeting_auto_complete)
import feeds

vote_view = VoteListView(queryset=Vote.objects.all(),
                         paginate_by=20,
                         extra_context={'votes': True,
                                        'title': ugettext('Votes')})
bill_list_view = BillListView(
    queryset=Bill.objects.all().filter(
        law__merged_into=None).order_by('-stage_date'),
    paginate_by=20, extra_context={'title': ugettext('Bills')})
bill_detail_view = BillDetailView.as_view()
vote_list_view = VoteListView(queryset=Vote.objects.all(),
                              paginate_by=20,
                              extra_context={'votes': True,
                                             'title': ugettext('Votes')})
vote_detail_view = VoteDetailView.as_view()

lawsurlpatterns = patterns(
    '',
    url(r'^bill/$', bill_list_view, name='bill-list'),
    url(r'^bill/tag/$', bill_tags_cloud, name='bill-tags-cloud'),
    url(r'^bill/rss/$', feeds.Bills(), name='bills-feed'),
    url(r'^bill/csv/$', BillCsvView.as_view()),
    url(r'^bill/tag/(?P<tag>.*)/$', BillTagsView.as_view(), name='bill-tag'),
    url(r'^bill/knesset-booklet/(?P<booklet_num>\d+)/$', RedirectView.as_view(
        url='/bill/?booklet=%(booklet_num)s', permanent=True)),
    url(r'^bill/(?P<pk>\d+)/$', bill_detail_view, name='bill-detail'),
    url(r'^bill/(?P<object_id>\d+)/embed/$',
        embed_bill_details, name='embed-bill-details'),
    url(r'^bill/(?P<object_id>\d+)/unbind-vote/(?P<vote_id>\d+)/$',
        bill_unbind_vote, name='bill-unbind-vote'),
    url(r'^bill/(?P<object_id>\d+)/unbind-committee-meeting/(?P<cm_id>\d+)/(?P<cm_stage>\d+)/$',
        bill_unbind_committee_meeting, name='bill-unbind-committee-meeting'),
    url(r'^bill/(?P<object_id>\d+)/unbind-knesset-proposal/$',
        bill_unbind_knesset_proposal, name='bill-unbind-knesset-proposal'),
    url(r'^bill/auto_complete/$',
        bill_auto_complete, name='bill-auto-complete'),
    url(r'^bill/auto_complete_knesset_proposal/$',
        knesset_proposal_auto_complete, name='knesset-proposal-auto-complete'),
    url(r'^bill/auto_complete_committee_meeting/$',
        committee_meeting_auto_complete, name='committee-meeting-auto-complete'),
    url(r'^bill/(?P<slug>[\w\-\"]+)/(?P<pk>\d+)/$',
        bill_detail_view, name='bill-detail-with-slug'),
    url(r'^vote/$', vote_list_view, name='vote-list'),
    url(r'^vote/csv/$', VoteCsvView.as_view()),
    url(r'^vote/tag/$', vote_tags_cloud, name='vote-tags-cloud'),
    url(r'^vote/rss/$', feeds.Votes(), name='votes-feed'),
    url(r'^vote/tag/(?P<tag>.*)/$', VoteTagsView.as_view(), name='vote-tag'),
    url(r'^vote/(?P<pk>\d+)/$', vote_detail_view, name='vote-detail'),
    url(r'^vote/(?P<object_id>\d+)/$', vote_view, name='vote-detail'),
    # TODO:the next url is hardcoded in a js file
    url(r'^vote/auto_complete/$',
        vote_auto_complete, name='vote-auto-complete'),
)


text:
cask 'macdependency' do
  version '1.1.0'
  sha256 '02679873bd4c3b686a82ecafd26ae270b8def2c832ca5e70720ca29b104bd973'

  url "https://github.com/kwin/macdependency/releases/download/#{version}/MacDependency-#{version}.dmg"
  appcast 'https://github.com/kwin/macdependency/releases.atom',
          checkpoint: '1739dc7303d6bf8e085bf93f777a3961f142530d62ab22b91ce3d83bc1d66be7'
  name 'MacDependency'
  homepage 'https://github.com/kwin/macdependency'

  app 'MacDependency.app'
end


text:
/**
 * The IfInputEmptyComponent lets you display content when the input is empty.
 *
 * @type {IfInputEmptyComponent}
 */
EasySearch.IfInputEmptyComponent = class IfInputEmptyComponent extends BaseComponent {
  /**
   * Return true if the input is empty.
   *
   * @returns {boolean}
   */
  inputEmpty() {
    return !!this.eachIndex(function (index, name) {
      return index.getComponentMethods(name).searchIsEmpty();
    }, 'every');
  }
};

EasySearch.IfInputEmptyComponent.register('EasySearch.IfInputEmpty');


text:
seo:
  title: Migrating
  description: Migrating Unsubscribes from Legacy Newsletter into Marketing Campaigns
  keywords: drop, unsubscribe, unsub, export, import, migrate, asm, suppression
title: Migrating Unsubscribes from Legacy Newsletter into Marketing Campaigns
weight: 0
layout: page
zendesk_id: 207009597
navigation:
  show: true
---

<iframe src="https://player.vimeo.com/video/136013004" width="640" height="360" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe>

To continue to seamlessly honor the subscription preferences of your recipients as you migrate from Legacy Newsletter to Marketing Campaigns, you'll need to manually migrate your Legacy Newsletter unsubscribes. Our Legacy Newsletter [Migration Toolkit]({{root_url}}/User_Guide/Legacy_Newsletter/Legacy_Newsletter_Migration/index.html) provides [detailed step-by-step instructions]({{root_url}}/User_Guide/Legacy_Newsletter/Legacy_Newsletter_Migration/Migration_Tutorials/migrating_unsubscribes.html) on how to migrate these subscription preferences].


text:
module JmPlayer
  module Data
    module Mongoid
      module Player
        module Queries
          def self.included(klass)
            klass.extend ClassMethods
          end

          module ClassMethods
            def find(uuid)
              self.where(uuid: uuid).limit(1).first
            end
          end
        end
      end
    end
  end
end


text:
package com.smartdevicelink.SdlConnection;

import com.smartdevicelink.protocol.ProtocolMessage;
import com.smartdevicelink.protocol.enums.SessionType;
import com.smartdevicelink.transport.BaseTransportConfig;

import java.util.List;

public interface ISdlConnectionListener {
	@Deprecated
	void onTransportDisconnected(String info);

	void onTransportDisconnected(String info, boolean availablePrimary, BaseTransportConfig transportConfig);

	void onTransportError(String info, Exception e);

	void onProtocolMessageReceived(ProtocolMessage msg);

	void onProtocolSessionStartedNACKed(SessionType sessionType,
			byte sessionID, byte version, String correlationID, List<String> rejectedParams);

	void onProtocolSessionStarted(SessionType sessionType,
			byte sessionID, byte version, String correlationID, int hashID, boolean isEncrypted);

	void onProtocolSessionEnded(SessionType sessionType,
			byte sessionID, String correlationID);

	void onProtocolSessionEndedNACKed(SessionType sessionType,
	byte sessionID, String correlationID);

	void onProtocolError(String info, Exception e);

	@Deprecated
	void onHeartbeatTimedOut(byte sessionID);

	void onProtocolServiceDataACK(SessionType sessionType, int dataSize, byte sessionID);

	void onAuthTokenReceived(String authToken, byte sessionID);
}


text:
/*---
description: Should not test in strict mode
flags: [raw]
---*/
var seemsStrict;
try {
  x = 1;
} catch (err) {
  seemsStrict = err.constructor === ReferenceError;
}

if (seemsStrict) {
  throw new Error('Script erroneously interpreted in strict mode.');
}


text:
echo "To run a specific test:"
echo "  mvn test -Dtest=[testclass]"


text:
package org.summerb.stringtemplate.api;

/**
 * Interface for interacting with string template compiler. Compiler able to
 * parse template and provide compiled result.
 *
 * @author skarpushin
 *
 */
public interface StringTemplateCompiler {
	StringTemplate compile(String template);
}


text:
<?php

/**
 * Class Tribe__Events__Admin__Organizer_Chooser_Meta_Box
 *
 * Handles the Organizer section inside the Events meta box
 */
class Tribe__Events__Admin__Organizer_Chooser_Meta_Box {
	/**
	 * @var WP_Post
	 */
	protected $event;

	/**
	 * @var Tribe__Events__Main
	 */
	protected $tribe;

	public function __construct( $event = null ) {
		$this->tribe = Tribe__Events__Main::instance();
		$this->get_event( $event );
	}

	/**
	 * Work with the specifed event object or else use a placeholder if we are in
	 * the middle of creating a new event.
	 *
	 * @param null $event
	 */
	protected function get_event( $event = null ) {
		global $post;

		if ( $event === null ) {
			$this->event = $post;
		} elseif ( $event instanceof WP_Post ) {
			$this->event = $event;
		} else {
			$this->event = new WP_Post( (object) array( 'ID' => 0 ) );
		}
	}

	/**
	 * Render the organizer chooser section for the events meta box
	 *
	 */
	public function render() {
		$this->render_dropdowns();
		$this->render_add_organizer_button();
		include $this->tribe->pluginPath . 'src/admin-views/new-organizer-meta-section.php';
	}

	/**
	 * displays the saved organizer dropdown in the event metabox
	 * Used to be a PRO only feature, but as of 3.0, it is part of Core.
	 *
	 */
	public function render_dropdowns() {
		$post_id = $this->event->ID;
		$current_organizers = get_post_meta( $post_id, '_EventOrganizerID', false );
		if ( $this->use_default_organizer( $current_organizers ) ) {
			$current_organizers = array( $this->tribe->defaults()->organizer_id() );
		}
		$current_organizers = (array) apply_filters( 'tribe_display_event_organizer_dropdown_id', $current_organizers );

		/* if the user can't create organizers, then remove any empty values
		   from the $current_organizers array. This prevents the automatic
		   selection of an organizer every time the event is edited. */
		$organizer_pto = get_post_type_object( Tribe__Events__Main::ORGANIZER_POST_TYPE );
		if ( ! current_user_can( $organizer_pto->cap->create_posts ) ) {
			$current_organizers = array_filter( $current_organizers );
		}

		?><?php

		foreach ( $current_organizers as $organizer_id ) {
			echo '
';
			$this->single_organizer_dropdown( $organizer_id );
			echo '
';
		}
	}

	/**
	 * Render a single row of the organizers table
	 *
	 * @param int $organizer_id
	 *
	 */
	protected function single_organizer_dropdown( $organizer_id ) {
		?>

			<?php
				$this->move_handle();
				?><label data-l10n-create-organizer="<?php printf( esc_attr__( 'Create New %s', 'the-events-calendar' ), $this->tribe->singular_organizer_label ); ?>"><?php printf( esc_html__( 'Use Saved %s:', 'the-events-calendar' ), $this->tribe->singular_organizer_label ); ?>

			<?php
				$this->tribe->saved_organizers_dropdown( $organizer_id, 'organizer[OrganizerID][]' );
				$this->edit_organizer_link( $organizer_id );
				$this->delete_handle();
			?>

	<?php
	}

	/**
	 * Render a link to edit the organizer post
	 *
	 * @param int $organizer_id
	 *
	 */
	protected function edit_organizer_link( $organizer_id ) {
		$organizer_pto = get_post_type_object( Tribe__Events__Main::ORGANIZER_POST_TYPE );
		if (
			empty( $organizer_pto->cap->create_posts )
			|| ! current_user_can( $organizer_pto->cap->create_posts )
		) {
			return;
		}
		?>

<a
				<?php if ( empty( $organizer_id ) ) { ?> style="display:none;"<?php } ?>
				data-admin-url="<?php echo esc_url( admin_url( 'post.php?action=edit&post=' ) ); ?>"
				href="<?php echo esc_url( admin_url( sprintf( 'post.php?action=edit&post=%s', $organizer_id ) ) ); ?>"
				target="_blank"><?php printf( esc_html__( 'Edit %s', 'the-events-calendar' ), esc_html( tribe_get_organizer_label_singular() ) ); ?>

		<?php
	}

	/**
	 * Determine if the event can use the default organizer setting
	 *
	 * @param array $current_organizers
	 *
	 * @return bool
	 */
	protected function use_default_organizer( $current_organizers ) {
		if ( ! empty( $current_organizers ) ) {
			return false; // the event already has organizers
		}
		if ( ! empty( $this->event->ID ) && get_post_status( $this->event->ID ) != 'auto-draft' ) {
			return false; // the event has already been saved
		}
		if ( is_admin() ) {
			return Tribe__Admin__Helpers::instance()->is_action( 'add' );
		} else {
			return true; // a front-end submission form (e.g., community)
		}
	}

	/**
	 * Renders the "Add Another Organizer" button
	 *
	 */
	protected function render_add_organizer_button() {
		?>

				<?php echo esc_html( sprintf( __( 'Add another %s', 'the-events-calendar' ), strtolower( tribe_get_organizer_label_singular() ) ) ); ?>

		<?php
	}

	/**
	 * Renders the handle for sorting organizers
	 *
	 */
	protected function move_handle() {
		echo '';
	}

	/**
	 * Renders the handle for deleting an organizer
	 *
	 */
	protected function delete_handle() {
		echo '';
	}

}


text:
using System;

namespace Raksha.Asn1.Cmp
{
	public class RevReqContent
		: Asn1Encodable
	{
		private readonly Asn1Sequence content;

		private RevReqContent(Asn1Sequence seq)
		{
			content = seq;
		}

		public static RevReqContent GetInstance(object obj)
		{
			if (obj is RevReqContent)
				return (RevReqContent)obj;

			if (obj is Asn1Sequence)
				return new RevReqContent((Asn1Sequence)obj);

			throw new ArgumentException("Invalid object: " + obj.GetType().Name, "obj");
		}

		public RevReqContent(params RevDetails[] revDetails)
		{
			this.content = new DerSequence(revDetails);
		}

		public virtual RevDetails[] ToRevDetailsArray()
		{
			RevDetails[] result = new RevDetails[content.Count];
			for (int i = 0; i != result.Length; ++i)
			{
				result[i] = RevDetails.GetInstance(content[i]);
			}
			return result;
		}

		/**
		 * <pre>
		 * RevReqContent ::= SEQUENCE OF RevDetails
		 * </pre>
		 * @return a basic ASN.1 object representation.
		 */
		public override Asn1Object ToAsn1Object()
		{
			return content;
		}
	}
}


text:
package jnn.functions.nlp.aux.readers;

import java.io.BufferedReader;
import java.io.File;
import java.io.FileNotFoundException;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.Scanner;

import org.apache.commons.math3.util.FastMath;

import vocab.Vocab;
import vocab.WordEntry;

public class WindowDataset {
	String file;
	Scanner reader;
	int windowSize;
	int numberOfWords;
	LinkedList<String> currentWindow = new LinkedList<String>();
	boolean isEnd = false;

	public WindowDataset(String file, int windowSize) {
		this.file = file;
		this.windowSize = windowSize;
		try {
			reader = new Scanner(new File(file));
		} catch (FileNotFoundException e) {
			e.printStackTrace();
		}
		numberOfWords = windowSize*2+1;
		for(int i = 0; i < numberOfWords; i++){
			currentWindow.addLast(reader.next());
		}
	}

	public String[][][] readWindowsEquivalent(int batchSize, int numberOfBatches, Vocab vocab){
		String[][][] ret = new String[numberOfBatches][][];
		for(int i = 0; i < numberOfBatches; i++){
			ret[i] = new String[batchSize][];
			for(int j = 0; j < batchSize; j++){
				ret[i][j] = readWindow();

				WordEntry centerEntry = vocab.getEntry(ret[i][j][windowSize]);
				while(centerEntry == null){
					ret[i][j] = readWindow();
					centerEntry =vocab.getEntry(ret[i][j][windowSize]);
				}
			}
		}
		return ret;
	}

	public String[][][] readWindowsEquivalentSkip(int batchSize, int numberOfBatches, Vocab vocab){
		String[][][] ret = new String[numberOfBatches][][];
		for(int i = 0; i < numberOfBatches; i++){
			ret[i] = new String[batchSize][];
			for(int j = 0; j < batchSize; j++){
				ret[i][j] = readWindow();
				WordEntry centerEntry =vocab.getEntry(ret[i][j][windowSize]);
				while(centerEntry == null ||
						(centerEntry.count > 1 &&
								FastMath.random() < 1-((FastMath.log(centerEntry.count)+1)/centerEntry.count))){
					ret[i][j] = readWindow();
					centerEntry =vocab.getEntry(ret[i][j][windowSize]);
				}
			}
		}
		return ret;
	}

	public String[] readWindow(){
		String[] ret = new String[numberOfWords];
		Iterator<String> it = currentWindow.iterator();
		for(int i = 0; i < numberOfWords; i++){
			ret[i] = it.next();
		}
		String word = reader.next();
		currentWindow.removeFirst();
		currentWindow.addLast(word);
		if(!reader.hasNext()){
			try {
				reader = new Scanner(new File(file));
			} catch (FileNotFoundException e) {
				e.printStackTrace();
			}
			isEnd = true;
		}
		return ret;
	}

	public void reset(){
		try {
			reader.close();
			reader = new Scanner(new File(file));
		} catch (FileNotFoundException e) {
			e.printStackTrace();
		}
		for(int i = 0; i < numberOfWords; i++){
			currentWindow.addLast(reader.next());
		}
	}
}


text:
'use strict';

var toString = Object.prototype.toString

  , id = toString.call(/a/);

module.exports = function (x) {
  return (x && (x instanceof RegExp || (toString.call(x) === id))) || false;
};


text:
NS_ASSUME_NONNULL_BEGIN

@interface MWKEvent ()

- (instancetype)initWithEvent:(const boost::shared_ptr<mw::Event> &)event;

@property(nonatomic, readonly) const boost::shared_ptr<mw::Event> &event;

@end

NS_ASSUME_NONNULL_END


text:
var expect = require("chai").expect;
var domData = require("../../../../src/runtime/components/dom-data");
var vElementByDOMNode = domData.___vElementByDOMNode;

function isSameNode(virtualEl, realEl) {
  var vFromEl = vElementByDOMNode.get(realEl);
  var constId = virtualEl.___constId;
  if (constId !== undefined && vFromEl.___constId === constId) {
    return true;
  }

  return false;
}

module.exports = function (helpers) {
  var div = helpers.vdom.createElement(
    "div",
    null,
    null /* key */,
    null /* component */,
    0 /* childCount */,
    null,
    { i: "abc123" /* key */ }
  );
  var span = helpers.vdom.createElement(
    "span",
    null,
    null /* key */,
    null /* component */,
    0 /* childCount */
  );

  var divClone = div.___cloneNode();
  // expect(div.___isSameNode(divClone)).to.equal(true);
  // expect(divClone.___isSameNode(div)).to.equal(true);
  //
  // expect(div.___isSameNode(span)).to.equal(false);
  // expect(span.___isSameNode(div)).to.equal(false);

  var realDiv = divClone.___actualize(helpers.document);

  expect(isSameNode(div, realDiv)).to.equal(true);
  expect(isSameNode(divClone, realDiv)).to.equal(true);

  var realSpan = span.___actualize(helpers.document);
  expect(isSameNode(div, realSpan)).to.equal(false);

  return div;
};


text:
package org.onetwo.boot.dsrouter;

import org.apache.commons.lang3.StringUtils;

/**
 * @author wayshall
 * <br/>
 */
public interface LookupKeyStrategy {

	default String getName() {
		String name = this.getClass().getSimpleName();
		String postfix = LookupKeyStrategy.class.getSimpleName();
		if(name.endsWith(postfix)){
			name = name.substring(0, name.length()-postfix.length());
			name = StringUtils.uncapitalize(name);
		}
		return name;
	}

	Object lookup();

}