text:
BOOST_AUTO_TEST_CASE(omp_MultipleBasin_2Basin_numerical_difference)
{
    namespace test = mjolnir::test;

    mjolnir::LoggerManager::set_default_logger("test_omp_multiple_basin_forcefield.log");
    using traits_type      = mjolnir::OpenMPSimulatorTraits<double, mjolnir::UnlimitedBoundary>;
    using real_type        = traits_type::real_type;
    using coord_type       = traits_type::coordinate_type;
    using boundary_type    = traits_type::boundary_type;
    using system_type      = mjolnir::System<traits_type>;
    using potential_type   = mjolnir::HarmonicPotential<real_type>;
    using interaction_type = mjolnir::BondLengthInteraction<traits_type, potential_type>;

    const real_type k(10.0);
    const real_type native1(1.5);
    const real_type native2(2.0);

    mjolnir::LocalForceField<traits_type>    loc1, loc2, locc;
    mjolnir::GlobalForceField<traits_type>   glo1, glo2, gloc;
    mjolnir::ExternalForceField<traits_type> ext1, ext2, extc;

    std::vector<std::pair<std::array<std::size_t, 2>, potential_type>> param1, param2;
    param1.emplace_back(std::array<std::size_t, 2>{{0,1}}, potential_type(k, native1));
    param2.emplace_back(std::array<std::size_t, 2>{{0,1}}, potential_type(k, native2));

    loc1.emplace(mjolnir::make_unique<interaction_type>("none", std::move(param1)));
    loc2.emplace(mjolnir::make_unique<interaction_type>("none", std::move(param2)));

    std::unique_ptr<mjolnir::MultipleBasinUnitBase<traits_type>> unit1 =
        mjolnir::make_unique<mjolnir::MultipleBasin2BasinUnit<traits_type>>(
            -10.0, "short", "long", 0.0, 0.0,
            std::make_tuple(std::move(loc1), std::move(glo1), std::move(ext1)),
            std::make_tuple(std::move(loc2), std::move(glo2), std::move(ext2)),
            0.0, 0.0);

    std::vector<std::unique_ptr<mjolnir::MultipleBasinUnitBase<traits_type>>> units;
    units.push_back(std::move(unit1));

    std::mt19937 mt(123456789);
    std::uniform_real_distribution<real_type> uni(-1.0, 1.0);

    mjolnir::MultipleBasinForceField<traits_type> forcefield(
            std::make_tuple(std::move(locc), std::move(gloc), std::move(extc)),
            std::move(units));

    for(std::size_t i = 0; i < 100; ++i)
    {
        system_type sys(2, boundary_type{});

        test::clear_everything(sys);

        sys.position(0) = coord_type( 0.0 + 0.01 * uni(mt), 0.0 + 0.01 * uni(mt), 0.0 + 0.01 * uni(mt));
        sys.position(1) = coord_type( 1.0 + 0.01 * uni(mt), 1.0 + 0.01 * uni(mt), 1.0 + 0.01 * uni(mt));

        forcefield.initialize(sys); // don't forget this

        constexpr real_type tol = 1e-4;
        constexpr real_type dr  = 1e-5;

        test::check_force(sys, forcefield, tol, dr);
    }
}

// check difference of forces
BOOST_AUTO_TEST_CASE(omp_MultipleBasin_2Basin_consistency)
{
    namespace test = mjolnir::test;

    mjolnir::LoggerManager::set_default_logger("test_omp_multiple_basin_forcefield.log");
    using traits_type      = mjolnir::OpenMPSimulatorTraits<double, mjolnir::UnlimitedBoundary>;
    using real_type        = traits_type::real_type;
    using coord_type       = traits_type::coordinate_type;
    using boundary_type    = traits_type::boundary_type;
    using system_type      = mjolnir::System<traits_type>;
    using potential_type   = mjolnir::HarmonicPotential<real_type>;
    using interaction_type = mjolnir::BondLengthInteraction<traits_type, potential_type>;

    using default_traits_type      = mjolnir::SimulatorTraits<double, mjolnir::UnlimitedBoundary>;
    using default_system_type      = mjolnir::System<default_traits_type>;
    using default_potential_type   = mjolnir::HarmonicPotential<real_type>;
    using default_interaction_type = mjolnir::BondLengthInteraction<default_traits_type, default_potential_type>;

    const real_type k(10.0);
    const real_type native1(1.5);
    const real_type native2(2.0);
    const std::size_t Nparticle = 1000;

    mjolnir::MultipleBasinForceField<traits_type> ff_openmp = [&]()
    {
        mjolnir::LocalForceField<traits_type>    loc1, loc2, locc;
        mjolnir::GlobalForceField<traits_type>   glo1, glo2, gloc;
        mjolnir::ExternalForceField<traits_type> ext1, ext2, extc;

        std::vector<std::pair<std::array<std::size_t, 2>, potential_type>> param1, param2;
        for(std::size_t i=0; i<Nparticle-1; ++i)
        {
            param1.emplace_back(std::array<std::size_t, 2>{{i,i+1}}, potential_type(k, native1));
            param2.emplace_back(std::array<std::size_t, 2>{{i,i+1}}, potential_type(k, native2));
        }
        loc1.emplace(mjolnir::make_unique<interaction_type>("none", std::move(param1)));
        loc2.emplace(mjolnir::make_unique<interaction_type>("none", std::move(param2)));

        std::unique_ptr<mjolnir::MultipleBasinUnitBase<traits_type>> unit1 =
            mjolnir::make_unique<mjolnir::MultipleBasin2BasinUnit<traits_type>>(
                -10.0, "short", "long", 0.0, 0.0,
                std::make_tuple(std::move(loc1), std::move(glo1), std::move(ext1)),
                std::make_tuple(std::move(loc2), std::move(glo2), std::move(ext2)),
                0.0, 0.0);

        std::vector<std::unique_ptr<mjolnir::MultipleBasinUnitBase<traits_type>>> units;
        units.push_back(std::move(unit1));

        return mjolnir::MultipleBasinForceField<traits_type>(
                std::make_tuple(std::move(locc), std::move(gloc), std::move(extc)),
                std::move(units));
    }();

    mjolnir::MultipleBasinForceField<default_traits_type> ff_default = [&]()
    {
        mjolnir::LocalForceField<default_traits_type>    loc1, loc2, locc;
        mjolnir::GlobalForceField<default_traits_type>   glo1, glo2, gloc;
        mjolnir::ExternalForceField<default_traits_type> ext1, ext2, extc;

        std::vector<std::pair<std::array<std::size_t, 2>, default_potential_type>> param1, param2;
        for(std::size_t i=0; i<Nparticle-1; ++i)
        {
            param1.emplace_back(std::array<std::size_t, 2>{{i,i+1}}, default_potential_type(k, native1));
            param2.emplace_back(std::array<std::size_t, 2>{{i,i+1}}, default_potential_type(k, native2));
        }
        loc1.emplace(mjolnir::make_unique<default_interaction_type>("none", std::move(param1)));
        loc2.emplace(mjolnir::make_unique<default_interaction_type>("none", std::move(param2)));

        std::unique_ptr<mjolnir::MultipleBasinUnitBase<default_traits_type>> unit1 =
            mjolnir::make_unique<mjolnir::MultipleBasin2BasinUnit<default_traits_type>>(
                -10.0, "short", "long", 0.0, 0.0,
                std::make_tuple(std::move(loc1), std::move(glo1), std::move(ext1)),
                std::make_tuple(std::move(loc2), std::move(glo2), std::move(ext2)),
                0.0, 0.0);

        std::vector<std::unique_ptr<mjolnir::MultipleBasinUnitBase<default_traits_type>>> units;
        units.push_back(std::move(unit1));

        return mjolnir::MultipleBasinForceField<default_traits_type>(
                std::make_tuple(std::move(locc), std::move(gloc), std::move(extc)),
                std::move(units));
    }();

    std::mt19937 mt(123456789);
    std::uniform_real_distribution<real_type> uni(-1.0, 1.0);

    for(std::size_t i = 0; i < 100; ++i)
    {
        system_type         sys_openmp (Nparticle, boundary_type{});
        default_system_type sys_default(Nparticle, boundary_type{});

        test::clear_everything(sys_openmp);
        test::clear_everything(sys_default);

        for(std::size_t j=0; j<Nparticle; ++j)
        {
            const coord_type pos(j * 1.0 + 0.01 * uni(mt),
                                 j * 1.0 + 0.01 * uni(mt),
                                 j * 1.0 + 0.01 * uni(mt));

            sys_openmp.position(j) = pos;
            sys_default.position(j) = pos;
        }

        ff_openmp .initialize(sys_openmp ); // don't forget this
        ff_default.initialize(sys_default); // don't forget this

        constexpr real_type tol = 1e-4;

        // --------------------------------------------------------------------
        // check_force

        sys_openmp.preprocess_forces();
        ff_openmp .calc_force(sys_openmp);
        sys_openmp.postprocess_forces();

        ff_default.calc_force(sys_default);

        for(std::size_t j=0; j<Nparticle; ++j)
        {
            using namespace mjolnir::math;
            BOOST_TEST(X(sys_default.force(j)) == X(sys_openmp.force(j)),
                       boost::test_tools::tolerance(tol));

            BOOST_TEST(Y(sys_default.force(j)) == Y(sys_openmp.force(j)),
                       boost::test_tools::tolerance(tol));

            BOOST_TEST(Z(sys_default.force(j)) == Z(sys_openmp.force(j)),
                       boost::test_tools::tolerance(tol));
        }
        // check the virials are the same
        for(std::size_t j=0; j<9; ++j)
        {
            BOOST_TEST(sys_default.virial()[j] == sys_openmp.virial()[j], boost::test_tools::tolerance(tol));
        }

        // --------------------------------------------------------------------
        // check_force_and_virial

        test::clear_force(sys_openmp);
        test::clear_force(sys_default);

        sys_openmp.preprocess_forces();
        ff_openmp .calc_force_and_virial(sys_openmp);
        sys_openmp.postprocess_forces();

        ff_default.calc_force_and_virial(sys_default);

        for(std::size_t j=0; j<Nparticle; ++j)
        {
            using namespace mjolnir::math;
            BOOST_TEST(X(sys_default.force(j)) == X(sys_openmp.force(j)),
                       boost::test_tools::tolerance(tol));

            BOOST_TEST(Y(sys_default.force(j)) == Y(sys_openmp.force(j)),
                       boost::test_tools::tolerance(tol));

            BOOST_TEST(Z(sys_default.force(j)) == Z(sys_openmp.force(j)),
                       boost::test_tools::tolerance(tol));
        }
        // check the virials are the same
        for(std::size_t j=0; j<9; ++j)
        {
            BOOST_TEST(sys_default.virial()[j] == sys_openmp.virial()[j], boost::test_tools::tolerance(tol));
        }

        // --------------------------------------------------------------------
        // check_energy

        test::clear_force(sys_openmp);
        test::clear_force(sys_default);

        const auto omp_ene = ff_openmp .calc_energy(sys_openmp);
        const auto seq_ene = ff_default.calc_energy(sys_default);

        BOOST_TEST(omp_ene == seq_ene, boost::test_tools::tolerance(tol));
    }
}

BOOST_AUTO_TEST_CASE(MultipleBasin_3Basin_numerical_difference)
{
    namespace test = mjolnir::test;

    mjolnir::LoggerManager::set_default_logger("test_omp_multiple_basin_forcefield.log");
    using traits_type      = mjolnir::OpenMPSimulatorTraits<double, mjolnir::UnlimitedBoundary>;
    using real_type        = traits_type::real_type;
    using coord_type       = traits_type::coordinate_type;
    using boundary_type    = traits_type::boundary_type;
    using system_type      = mjolnir::System<traits_type>;
    using potential_type   = mjolnir::HarmonicPotential<real_type>;
    using interaction_type = mjolnir::BondLengthInteraction<traits_type, potential_type>;

    const real_type k(10.0);
    const real_type native1(1.6);
    const real_type native2(1.8);
    const real_type native3(1.9);

    mjolnir::LocalForceField<traits_type>    loc1, loc2, loc3, locc;
    mjolnir::GlobalForceField<traits_type>   glo1, glo2, glo3, gloc;
    mjolnir::ExternalForceField<traits_type> ext1, ext2, ext3, extc;

    std::vector<std::pair<std::array<std::size_t, 2>, potential_type>> param1, param2, param3;
    param1.emplace_back(std::array<std::size_t, 2>{{0,1}}, potential_type(k, native1));
    param2.emplace_back(std::array<std::size_t, 2>{{0,1}}, potential_type(k, native2));
    param3.emplace_back(std::array<std::size_t, 2>{{0,1}}, potential_type(k, native3));

    loc1.emplace(mjolnir::make_unique<interaction_type>("none", std::move(param1)));
    loc2.emplace(mjolnir::make_unique<interaction_type>("none", std::move(param2)));
    loc3.emplace(mjolnir::make_unique<interaction_type>("none", std::move(param3)));

    std::unique_ptr<mjolnir::MultipleBasinUnitBase<traits_type>> unit1 =
        mjolnir::make_unique<mjolnir::MultipleBasin3BasinUnit<traits_type>>(
            "short", "middle", "long", -10.0, -10.0, -10.0, 0.0, 0.0, 0.0,
            std::make_tuple(std::move(loc1), std::move(glo1), std::move(ext1)),
            std::make_tuple(std::move(loc2), std::move(glo2), std::move(ext2)),
            std::make_tuple(std::move(loc3), std::move(glo3), std::move(ext3)));

    std::vector<std::unique_ptr<mjolnir::MultipleBasinUnitBase<traits_type>>> units;
    units.push_back(std::move(unit1));

    std::mt19937 mt(123456789);
    std::uniform_real_distribution<real_type> uni(-1.0, 1.0);

    mjolnir::MultipleBasinForceField<traits_type> forcefield(
            std::make_tuple(std::move(locc), std::move(gloc), std::move(extc)),
            std::move(units));

    for(std::size_t i = 0; i < 100; ++i)
    {
        system_type sys(2, boundary_type{});

        test::clear_everything(sys);

        sys.position(0) = coord_type( 0.0 + 0.01 * uni(mt), 0.0 + 0.01 * uni(mt), 0.0 + 0.01 * uni(mt));
        sys.position(1) = coord_type( 1.0 + 0.01 * uni(mt), 1.0 + 0.01 * uni(mt), 1.0 + 0.01 * uni(mt));

        forcefield.initialize(sys); // don't forget this

        constexpr real_type tol = 1e-4;
        constexpr real_type dr  = 1e-5;
        test::check_force(sys, forcefield, tol, dr);
    }
}

// check difference of forces
BOOST_AUTO_TEST_CASE(omp_MultipleBasin_3Basin_consistency)
{
    namespace test = mjolnir::test;

    mjolnir::LoggerManager::set_default_logger("test_omp_multiple_basin_forcefield.log");
    using traits_type      = mjolnir::OpenMPSimulatorTraits<double, mjolnir::UnlimitedBoundary>;
    using real_type        = traits_type::real_type;
    using coord_type       = traits_type::coordinate_type;
    using boundary_type    = traits_type::boundary_type;
    using system_type      = mjolnir::System<traits_type>;
    using potential_type   = mjolnir::HarmonicPotential<real_type>;
    using interaction_type = mjolnir::BondLengthInteraction<traits_type, potential_type>;

    using default_traits_type      = mjolnir::SimulatorTraits<double, mjolnir::UnlimitedBoundary>;
    using default_system_type      = mjolnir::System<default_traits_type>;
    using default_potential_type   = mjolnir::HarmonicPotential<real_type>;
    using default_interaction_type = mjolnir::BondLengthInteraction<default_traits_type, default_potential_type>;

    const real_type k(10.0);
    const real_type native1(1.6);
    const real_type native2(1.8);
    const real_type native3(1.9);

    const std::size_t Nparticle = 1000;

    mjolnir::MultipleBasinForceField<traits_type> ff_openmp = [&]()
    {
        mjolnir::LocalForceField<traits_type>    loc1, loc2, loc3, locc;
        mjolnir::GlobalForceField<traits_type>   glo1, glo2, glo3, gloc;
        mjolnir::ExternalForceField<traits_type> ext1, ext2, ext3, extc;

        std::vector<std::pair<std::array<std::size_t, 2>, potential_type>> param1, param2, param3;
        for(std::size_t i=0; i<Nparticle-1; ++i)
        {
            param1.emplace_back(std::array<std::size_t, 2>{{i,i+1}}, potential_type(k, native1));
            param2.emplace_back(std::array<std::size_t, 2>{{i,i+1}}, potential_type(k, native2));
            param3.emplace_back(std::array<std::size_t, 2>{{i,i+1}}, potential_type(k, native3));
        }
        loc1.emplace(mjolnir::make_unique<interaction_type>("none", std::move(param1)));
        loc2.emplace(mjolnir::make_unique<interaction_type>("none", std::move(param2)));
        loc3.emplace(mjolnir::make_unique<interaction_type>("none", std::move(param3)));

        std::unique_ptr<mjolnir::MultipleBasinUnitBase<traits_type>> unit1 =
            mjolnir::make_unique<mjolnir::MultipleBasin3BasinUnit<traits_type>>(
                "short", "middle", "long", -10.0, -10.0, -10.0, 0.0, 0.0, 0.0,
                std::make_tuple(std::move(loc1), std::move(glo1), std::move(ext1)),
                std::make_tuple(std::move(loc2), std::move(glo2), std::move(ext2)),
                std::make_tuple(std::move(loc3), std::move(glo3), std::move(ext3)));

        std::vector<std::unique_ptr<mjolnir::MultipleBasinUnitBase<traits_type>>> units;
        units.push_back(std::move(unit1));

        return mjolnir::MultipleBasinForceField<traits_type>(
                std::make_tuple(std::move(locc), std::move(gloc), std::move(extc)),
                std::move(units));
    }();

    mjolnir::MultipleBasinForceField<default_traits_type> ff_default = [&]()
    {
        mjolnir::LocalForceField<default_traits_type>    loc1, loc2, loc3, locc;
        mjolnir::GlobalForceField<default_traits_type>   glo1, glo2, glo3, gloc;
        mjolnir::ExternalForceField<default_traits_type> ext1, ext2, ext3, extc;

        std::vector<std::pair<std::array<std::size_t, 2>, default_potential_type>> param1, param2, param3;
        for(std::size_t i=0; i<Nparticle-1; ++i)
        {
            param1.emplace_back(std::array<std::size_t, 2>{{i,i+1}}, default_potential_type(k, native1));
            param2.emplace_back(std::array<std::size_t, 2>{{i,i+1}}, default_potential_type(k, native2));
            param3.emplace_back(std::array<std::size_t, 2>{{i,i+1}}, default_potential_type(k, native3));
        }
        loc1.emplace(mjolnir::make_unique<default_interaction_type>("none", std::move(param1)));
        loc2.emplace(mjolnir::make_unique<default_interaction_type>("none", std::move(param2)));
        loc3.emplace(mjolnir::make_unique<default_interaction_type>("none", std::move(param3)));

        std::unique_ptr<mjolnir::MultipleBasinUnitBase<default_traits_type>> unit1 =
            mjolnir::make_unique<mjolnir::MultipleBasin3BasinUnit<default_traits_type>>(
                "short", "middle", "long", -10.0, -10.0, -10.0, 0.0, 0.0, 0.0,
                std::make_tuple(std::move(loc1), std::move(glo1), std::move(ext1)),
                std::make_tuple(std::move(loc2), std::move(glo2), std::move(ext2)),
                std::make_tuple(std::move(loc3), std::move(glo3), std::move(ext3)));

        std::vector<std::unique_ptr<mjolnir::MultipleBasinUnitBase<default_traits_type>>> units;
        units.push_back(std::move(unit1));

        return mjolnir::MultipleBasinForceField<default_traits_type>(
                std::make_tuple(std::move(locc), std::move(gloc), std::move(extc)),
                std::move(units));
    }();

    std::mt19937 mt(123456789);
    std::uniform_real_distribution<real_type> uni(-1.0, 1.0);

    for(std::size_t i = 0; i < 100; ++i)
    {
        system_type         sys_openmp (Nparticle, boundary_type{});
        default_system_type sys_default(Nparticle, boundary_type{});

        test::clear_everything(sys_openmp);
        test::clear_everything(sys_default);

        for(std::size_t j=0; j<Nparticle; ++j)
        {
            const coord_type pos(j * 1.0 + 0.01 * uni(mt),
                                 j * 1.0 + 0.01 * uni(mt),
                                 j * 1.0 + 0.01 * uni(mt));

            sys_openmp .position(j) = pos;
            sys_default.position(j) = pos;
        }

        ff_openmp .initialize(sys_openmp ); // don't forget this
        ff_default.initialize(sys_default); // don't forget this

        constexpr real_type tol = 1e-4;

        // --------------------------------------------------------------------
        // check_force

        sys_openmp.preprocess_forces();
        ff_openmp .calc_force(sys_openmp);
        sys_openmp.postprocess_forces();

        ff_default.calc_force(sys_default);

        for(std::size_t j=0; j<Nparticle; ++j)
        {
            using namespace mjolnir::math;
            BOOST_TEST(X(sys_default.force(j)) == X(sys_openmp.force(j)),
                       boost::test_tools::tolerance(tol));

            BOOST_TEST(Y(sys_default.force(j)) == Y(sys_openmp.force(j)),
                       boost::test_tools::tolerance(tol));

            BOOST_TEST(Z(sys_default.force(j)) == Z(sys_openmp.force(j)),
                       boost::test_tools::tolerance(tol));
        }
        // check the virials are the same
        for(std::size_t j=0; j<9; ++j)
        {
            BOOST_TEST(sys_default.virial()[j] == sys_openmp.virial()[j], boost::test_tools::tolerance(tol));
        }

        // --------------------------------------------------------------------
        // check_force_and_virial

        test::clear_force(sys_openmp);
        test::clear_force(sys_default);

        sys_openmp.preprocess_forces();
        ff_openmp .calc_force_and_virial(sys_openmp);
        sys_openmp.postprocess_forces();

        ff_default.calc_force_and_virial(sys_default);

        for(std::size_t j=0; j<Nparticle; ++j)
        {
            using namespace mjolnir::math;
            BOOST_TEST(X(sys_default.force(j)) == X(sys_openmp.force(j)),
                       boost::test_tools::tolerance(tol));

            BOOST_TEST(Y(sys_default.force(j)) == Y(sys_openmp.force(j)),
                       boost::test_tools::tolerance(tol));

            BOOST_TEST(Z(sys_default.force(j)) == Z(sys_openmp.force(j)),
                       boost::test_tools::tolerance(tol));
        }
        // check the virials are the same
        for(std::size_t j=0; j<9; ++j)
        {
            BOOST_TEST(sys_default.virial()[j] == sys_openmp.virial()[j], boost::test_tools::tolerance(tol));
        }

        // --------------------------------------------------------------------
        // check_energy

        test::clear_force(sys_openmp);
        test::clear_force(sys_default);

        const auto omp_ene = ff_openmp .calc_energy(sys_openmp);
        const auto seq_ene = ff_default.calc_energy(sys_default);

        BOOST_TEST(omp_ene == seq_ene, boost::test_tools::tolerance(tol));
    }
}


text:
package mobi

import (
	"github.com/atnet/gof"
	"github.com/atnet/gof/web"
	"github.com/atnet/gof/web/mvc"
	"go2o/src/core/domain/interface/partner"
	"go2o/src/core/service/dps"
	"net/http"
)

var (
	routes *web.RouteMap = new(web.RouteMap)
)

//处理请求
func Handle(ctx *web.Context) {
	routes.Handle(ctx)
}

func handleError(w http.ResponseWriter, err error) {
	w.Write([]byte(`<span style="color:red">` + err.Error() + `</span>`))
}

//注册路由
func RegisterRoutes(c gof.App) {
	mc := &mainC{App: c}

	getPartner := func(r *http.Request) (*partner.ValuePartner, error) {
		partnerId := dps.PartnerService.GetPartnerIdByHost(r.Host)
		return dps.PartnerService.GetPartner(partnerId)
	}

	routes.Add("/", func(ctx *web.Context) {
		r, w := ctx.Request, ctx.ResponseWriter
		if p, err := getPartner(r); err == nil {
			mvc.Handle(mc, ctx, true, p)
		} else {
			handleError(w, err)
		}
	})
}

redpajama_set_name: RedPajamaGithub


text:
Mongoose-Seed-Plus lets you populate and clear MongoDB documents with all the benefits of Mongoose validation

## ■ Installation

Use NPM or Yarn
```
$ npm install mongoose-seed-plus
```

## ■ Basic usage

```javascript
var seeder = require('mongoose-seed-plus');
var chalk  = require('chalk');
var path   = require('path');

var options = {
  mongodb: {
    host: "localhost",
    port: 27017,
    dbname: "mongoose-seed-plus-dev"
  },
  dump: {
    enable: true
  },
  models: [
    { path: 'models/User.js', name: 'User', clear: true },
    { path: 'models/Product.js', name: 'Product', clear: true }
  ],
  path: path.join(__dirname, '/migrations')
};

new seeder(options, function(err, result) {
  if (err) {
    throw err.message;
  }

  console.log(`Successfully connected to MongoDB: ${chalk.grey(result.db)}\n`);

  if (result.cleared) {
    console.log(`Cleared models: ${chalk.grey(result.cleared)}\n`);
  }

  console.log(chalk.cyan('Seeding Results'));
  for (var prop in result.populate) {
    console.log(`${prop}: ${chalk.grey(result.populate[prop])}`);
  }
  process.exit(1);
});
```

## ■ Data files

Create file `.json` in folder `migrations`.

#### Structure

```
├── seed.js
└─┬ migrations
  ├── users.json
  ├── products.json
```

#### Example
Data object containing seed data - documents organized by Model
```javascript
{
    "model": "User",
    "documents": [
        {
            "firstname": "John",
            "lastname": "Doe",
            "email": "john.doe@awesome.com",
            "password": "123456"
        }
    ]
}
```

## ■ Methods

### seeder(options, [callback])

| Options | Description | Default | Type | Required |
| --- | --- | --- | --- | --- |
| path | Path to folder migrations JSON files | "" | (string) | true |
| models | List of models | [] | (array) | true |
| models[].path | Path to a model | "" | (string) | true |
| models[].name | Name a model | "" | (string) | true |
| models[].clear | Clear collection mongo | true | (boolean) | false |
| dump | Option dump | {} | (object) | false |
| dump.bin | Path to bin mongodump | "/usr/local/bin/mongodump" | (string) | false |
| dump.args | Arguments for mongodump | [ '--db', "mongoose-seed-plus-dev", '--out', "", '--quiet' ] | (array) | false |
| dump.enable | Enable dump | false | (boolean) | false |
| mongodb | Option mongodb | {} | (object) | false |
| mongodb.host | Host to MongoDB | "localhost" | (string) | false |
| mongodb.port | Port to MongoDB | 27017 | (integer) | false |
| mongodb.dbname | DB name to MongoDB | "mongoose-seed-plus-dev" | (string) | false |


text:
<?php

namespace Arhitector\Transcoder\Traits;

use Arhitector\Transcoder\Exception\TranscoderException;

/**
 * Class FilePathAware.
 *
 * @package Arhitector\Transcoder\Traits
 */
trait FilePathAwareTrait
{

	/**
	 * @var string  The full path to the file.
	 */
	protected $filePath;

	/**
	 * Get the full path to the file.
	 *
	 * @return string
	 */
	public function getFilePath()
	{
		return $this->filePath;
	}

	/**
	 * Set file path.
	 *
	 * @param string $filePath
	 *
	 * @return $this
	 * @throws \InvalidArgumentException
	 * @throws \Arhitector\Transcoder\Exception\TranscoderException
	 */
	protected function setFilePath($filePath)
	{
		if ( ! is_string($filePath))
		{
			throw new \InvalidArgumentException('File path must be a string type.');
		}

		if (preg_match('~^(\w+:)?//~', $filePath) || is_link($filePath))
		{
			throw new \InvalidArgumentException('File path must be a local path.');
		}

		$filePath = realpath($filePath);

		if ( ! is_file($filePath))
		{
			throw new TranscoderException('File path not found.');
		}

		$this->filePath = $filePath;

		return $this;
	}

}


text:
/*
  +----------------------------------------------------------------------+
  | PHP Version 5                                                        |
  +----------------------------------------------------------------------+
  | (c) 2008-2015 Dmitry Zenovich                                        |
  +----------------------------------------------------------------------+
  | This source file is subject to the new BSD license,                  |
  | that is bundled with this package in the file LICENSE, and is        |
  | available through the world-wide-web at the following url:           |
  | http://www.opensource.org/licenses/BSD-3-Clause                      |
  | If you did not receive a copy of the license and are unable to       |
  | obtain it through the world-wide-web, please send a note to          |
  | dzenovich@gmail.com so we can mail you a copy immediately.           |
  +----------------------------------------------------------------------+
  | Author: Dmitry Zenovich <dzenovich@gmail.com>                        |
  +----------------------------------------------------------------------+
*/

#ifndef PHP_RUNKIT_SANDBOX_H
#define PHP_RUNKIT_SANDBOX_H

/* {{{ php_runkit_sandbox_has_property_int */
inline static int php_runkit_sandbox_has_property_int(int has_set_exists, zval *member TSRMLS_DC) {
	zval **tmpzval;
	int result = 0;

#if PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION < 1
	/* Map PHP 5.0 has_property flag to PHP 5.1+ flag */
	has_set_exists = (has_set_exists == 0) ? 2 : 1;
#endif

	if (zend_hash_find(&EG(symbol_table), Z_STRVAL_P(member), Z_STRLEN_P(member) + 1, (void*)&tmpzval) == SUCCESS) {
		switch (has_set_exists) {
			case 0:
				result = (Z_TYPE_PP(tmpzval) != IS_NULL);
				break;
			case 1:
				switch (Z_TYPE_PP(tmpzval)) {
					case IS_BOOL: case IS_LONG: case IS_RESOURCE:
						result = (Z_LVAL_PP(tmpzval) != 0);
						break;
					case IS_DOUBLE:
						result = (Z_DVAL_PP(tmpzval) != 0);
						break;
					case IS_STRING:
						result = (Z_STRLEN_PP(tmpzval) > 1 || (Z_STRLEN_PP(tmpzval) == 1 && Z_STRVAL_PP(tmpzval)[0] != '0'));
						break;
					case IS_ARRAY:
						result = zend_hash_num_elements(Z_ARRVAL_PP(tmpzval)) > 0;
						break;
					case IS_OBJECT:
						/* TODO: Use ZE2 logic for this rather than ZE1 logic */
						result = zend_hash_num_elements(Z_OBJPROP_PP(tmpzval)) > 0;
						break;
					case IS_NULL:
					default:
						result = 0;
				}
				break;
			case 2:
				result = 1;
				break;
		}
	} else {
		result = 0;
	}
	return result;
}
/* }}} */

/* {{{ php_runkit_sandbox_include_or_eval_int */
inline static zend_op_array *php_runkit_sandbox_include_or_eval_int(zval *return_value, zval *zcode, int type, int once, int *already_included TSRMLS_DC) {
	zend_op_array *op_array = NULL;

	if (type == ZEND_EVAL) {
		/* eval() */
		char *eval_desc = zend_make_compiled_string_description("Runkit_Sandbox Eval Code" TSRMLS_CC);
		op_array = compile_string(zcode, eval_desc TSRMLS_CC);
		efree(eval_desc);
	} else if (!once) {
		/* include() & requre() */
		op_array = compile_filename(type, zcode TSRMLS_CC);
	} else {
		/* include_once() & require_once() */
		int dummy = 1;
		zend_file_handle file_handle;

		if (SUCCESS == zend_stream_open(Z_STRVAL_P(zcode), &file_handle TSRMLS_CC)) {
			if (!file_handle.opened_path) {
				file_handle.opened_path = estrndup(Z_STRVAL_P(zcode), Z_STRLEN_P(zcode));
			}
			if (zend_hash_add(&EG(included_files), file_handle.opened_path, strlen(file_handle.opened_path)+1, (void*)&dummy, sizeof(int), NULL)==SUCCESS) {
				op_array = zend_compile_file(&file_handle, type TSRMLS_CC);
				zend_destroy_file_handle(&file_handle TSRMLS_CC);
			} else {
				RUNKIT_FILE_HANDLE_DTOR(&file_handle);
				RETVAL_TRUE;
				*already_included = 1;
			}
		}
	}
	return op_array;
}
/* }}} */

/* {{{ php_runkit_sandbox_call_int */
inline static void php_runkit_sandbox_call_int(zval *func_name, char **pname, zval **pretval, zval *args, zval *return_value, void *prior_context TSRMLS_DC) {
	HashPosition pos;
	int i;
	zval **tmpzval;
	int argc = zend_hash_num_elements(Z_ARRVAL_P(args));
	zval ***sandbox_args = safe_emalloc(sizeof(zval**), argc, 0);

	for(zend_hash_internal_pointer_reset_ex(Z_ARRVAL_P(args), &pos), i = 0;
		(zend_hash_get_current_data_ex(Z_ARRVAL_P(args), (void*)&tmpzval, &pos) == SUCCESS) && (i < argc);
		zend_hash_move_forward_ex(Z_ARRVAL_P(args), &pos), i++) {
		sandbox_args[i] = emalloc(sizeof(zval*));
		MAKE_STD_ZVAL(*sandbox_args[i]);
		**sandbox_args[i] = **tmpzval;

#if RUNKIT_ABOVE53
		if (Z_TYPE_P(*sandbox_args[i]) == IS_OBJECT && zend_get_class_entry(*sandbox_args[i], prior_context) == zend_ce_closure) {
			zend_closure *closure;
			zend_object_store_bucket *bucket;
			bucket = php_runkit_zend_object_store_get_obj(*sandbox_args[i], prior_context);
			closure = (zend_closure *) bucket->bucket.obj.object;
			(*sandbox_args[i])->value.obj.handle = zend_objects_store_put(closure, NULL, NULL, bucket->bucket.obj.clone TSRMLS_CC);
		} else
#endif
			PHP_SANDBOX_CROSS_SCOPE_ZVAL_COPY_CTOR(*sandbox_args[i]);
	}

	/* Shouldn't be necessary */
	argc = i;

	/* Note: If this function is disabled by disable_functions or disable_classes,
	 * The user will get a confusing error message about (null)() being disabled for security reasons on line 0
	 * This will be fixable with a properly set EG(function_state_ptr)....just not yet
	 */
	if (call_user_function_ex(EG(function_table), NULL, func_name, pretval, argc, sandbox_args, 0, NULL TSRMLS_CC) == SUCCESS) {
		if (*pretval) {
			*return_value = **pretval;
		} else {
			RETVAL_TRUE;
		}
	} else {
		php_error_docref1(NULL TSRMLS_CC, *pname, E_WARNING, "Unable to call function");
		RETVAL_FALSE;
	}
	if (*pname) {
		efree(*pname);
		*pname = NULL;
	}

	for(i = 0; i < argc; i++) {
#if RUNKIT_ABOVE53
		if (Z_TYPE_P(*sandbox_args[i]) == IS_OBJECT && zend_get_class_entry(*sandbox_args[i] TSRMLS_CC) == zend_ce_closure) {
			zend_object_store_bucket *bucket = php_runkit_zend_object_store_get_obj(*sandbox_args[i] TSRMLS_CC);
			zend_objects_store_del_ref(*sandbox_args[i] TSRMLS_CC);
			zval_ptr_dtor(sandbox_args[i]);
			bucket->bucket.obj.object = NULL;
		}
#endif
		zval_ptr_dtor(sandbox_args[i]);
		efree(sandbox_args[i]);
	}
	efree(sandbox_args);
}
/* }}} */

/* {{{ php_runkit_sandbox_return_property_value */
inline static zval *php_runkit_sandbox_return_property_value(int prop_found, zval *retval TSRMLS_DC) {
	if (prop_found) {
		zval *return_value;

		ALLOC_ZVAL(return_value);
		*return_value = *retval;

		/* ZE expects refcount == 0 for unowned values */
		INIT_PZVAL(return_value);
		PHP_SANDBOX_CROSS_SCOPE_ZVAL_COPY_CTOR(return_value);
		return_value->RUNKIT_REFCOUNT--;

		return return_value;
	} else {
		return EG(uninitialized_zval_ptr);
	}
}
/* }}} */

#endif


text:
using System;
using System.Runtime.InteropServices;
using System.Security.Cryptography;

namespace PerplexMail.SecurityDrivenDotNet
{
    internal class PBKDF2 : DeriveBytes
	{
		// Fields
		static CryptoRandom rng = new CryptoRandom();
		int BlockSize, endIndex, startIndex;
		uint block, iterations;
		byte[] buffer, salt;
		HMAC hmac;

		/// <summary>
		/// Default iteration count.
		/// </summary>
		public const int DefaultIterations = 10000;

		/// <summary>
		/// ctor
		/// </summary>
		/// <param name="password">password</param>
		/// <param name="saltSize">saltSize</param>
		public PBKDF2(Func<HMAC> hmacFactory, string password, int saltSize)
			: this(hmacFactory, password, saltSize, DefaultIterations)
		{
		}//ctor

		/// <summary>
		/// ctor
		/// </summary>
		/// <param name="password">password</param>
		/// <param name="salt">salt</param>
		public PBKDF2(Func<HMAC> hmacFactory, string password, byte[] salt)
			: this(hmacFactory, password, salt, DefaultIterations)
		{
		}//ctor

		/// <summary>
		/// ctor
		/// </summary>
		/// <param name="password">password</param>
		/// <param name="salt">salt</param>
		/// <param name="iterations">iterations</param>
		public PBKDF2(Func<HMAC> hmacFactory, string password, byte[] salt, int iterations)
			: this(hmacFactory, password.SerializeToBytes(), salt, iterations)
		{
		}//ctor

		/// <summary>
		/// ctor
		/// </summary>
		/// <param name="password">password</param>
		/// <param name="saltSize">saltSize</param>
		/// <param name="iterations">iterations</param>
		public PBKDF2(Func<HMAC> hmacFactory, string password, int saltSize, int iterations)
		{
			if (saltSize < 0)
			{
				throw new ArgumentOutOfRangeException("saltSize");
			}
			byte[] data = new byte[saltSize];
			rng.NextBytes(data);
			this.Salt = data;
			this.IterationCount = iterations;
			this.hmac = hmacFactory();
			this.hmac.Key = password.SerializeToBytes();
			this.BlockSize = hmac.HashSize / 8;
			this.Initialize();
		}//ctor

		/// <summary>
		/// ctor
		/// </summary>
		/// <param name="password"></param>
		/// <param name="salt"></param>
		/// <param name="iterations"></param>
		public PBKDF2(Func<HMAC> hmacFactory, byte[] password, byte[] salt, int iterations)
		{
			this.Salt = salt;
			this.IterationCount = iterations;
			this.hmac = hmacFactory();
			this.hmac.Key = password;
			this.BlockSize = hmac.HashSize / 8;
			this.Initialize();
		}//ctor

		/// <summary>
		/// Releases the unmanaged resources used, and optionally releases the managed resources.
		/// </summary>
		/// <param name="disposing">true to release both managed and unmanaged resources; false to release only managed resources.</param>
		protected override void Dispose(bool disposing)
		{
			base.Dispose(disposing);
			if (disposing)
			{
				if (this.hmac != null)
				{
					this.hmac.Dispose();
				}
				if (this.buffer != null)
				{
					Array.Clear(this.buffer, 0, this.buffer.Length);
				}
				if (this.salt != null)
				{
					Array.Clear(this.salt, 0, this.salt.Length);
				}
			}
		}//Dispose()

		static byte[] Int2(uint i)
		{
			var num = new IntStruct();
			num.Value = i;
			if (BitConverter.IsLittleEndian)
				return new byte[] { num.B4, num.B3, num.B2, num.B1 };
			else
				return new byte[] { num.B1, num.B2, num.B3, num.B4 };
		}

		[StructLayout(LayoutKind.Explicit, Pack = 1)]
		struct IntStruct
		{
			[FieldOffset(0)]
			public uint Value;
			[FieldOffset(0)]
			public byte B1;
			[FieldOffset(1)]
			public byte B2;
			[FieldOffset(2)]
			public byte B3;
			[FieldOffset(3)]
			public byte B4;
		}

		byte[] Func()
		{
			byte[] inputBuffer = Int2(this.block);
			this.hmac.TransformBlock(this.salt, 0, this.salt.Length, this.salt, 0);
			this.hmac.TransformFinalBlock(inputBuffer, 0, inputBuffer.Length);
			byte[] hash = this.hmac.Hash;
			this.hmac.Initialize();
			byte[] buffer3 = hash;
			for (int i = 2; i <= this.iterations; i++)
			{
				hash = this.hmac.ComputeHash(hash);
				for (int j = 0; j < BlockSize; j++)
				{
					buffer3[j] ^= hash[j];
				}
			}
			this.block++;
			return buffer3;
		}

		// Properties
		/// <summary>
		/// Gets or sets the number of iterations for the operation.
		/// </summary>
		public int IterationCount
		{
			get
			{
				return (int)this.iterations;
			}
			set
			{
				if (value <= 0)
				{
					throw new ArgumentOutOfRangeException("value");
				}
				this.iterations = (uint)value;
				this.Initialize();
			}
		}

		/// <summary>
		/// Gets or sets the key salt value for the operation.
		/// </summary>
		public byte[] Salt
		{
			get
			{
				return (byte[])this.salt.Clone();
			}
			set
			{
				if (value == null)
				{
					throw new ArgumentNullException("value");
				}
				if (value.Length < 8)
				{
					throw new ArgumentException("Salt is not at least 8 bytes.");
				}
				this.salt = (byte[])value.Clone();
				this.Initialize();
			}
		}

		// Methods
		/// <summary>
		/// Returns pseudo-random bytes.
		/// </summary>
		/// <param name="cb">The number of pseudo-random bytes to generate.</param>
		/// <returns></returns>
		public override byte[] GetBytes(int cb)
		{
			if (cb <= 0)
			{
				throw new ArgumentOutOfRangeException("cb", "Positive number required.");
			}
			byte[] dst = new byte[cb];
			int dstOffsetBytes = 0;
			int byteCount = this.endIndex - this.startIndex;
			if (byteCount > 0)
			{
				if (cb < byteCount)
				{
					Buffer.BlockCopy(this.buffer, this.startIndex, dst, 0, cb);
					this.startIndex += cb;
					return dst;
				}
				Buffer.BlockCopy(this.buffer, this.startIndex, dst, 0, byteCount);
				this.startIndex = this.endIndex = 0;
				dstOffsetBytes += byteCount;
			}//if

			while (dstOffsetBytes < cb)
			{
				byte[] src = this.Func();
				int num3 = cb - dstOffsetBytes;
				if (num3 > BlockSize)
				{
					Buffer.BlockCopy(src, 0, dst, dstOffsetBytes, BlockSize);
					dstOffsetBytes += BlockSize;
				}
				else
				{
					Buffer.BlockCopy(src, 0, dst, dstOffsetBytes, num3);
					dstOffsetBytes += num3;
					Buffer.BlockCopy(src, num3, this.buffer, this.startIndex, BlockSize - num3);
					this.endIndex += BlockSize - num3;
					return dst;
				}
			}//while
			return dst;
		}//GetBytes()

		void Initialize()
		{
			if (this.buffer != null)
			{
				Array.Clear(this.buffer, 0, this.buffer.Length);
			}
			this.buffer = new byte[BlockSize];
			this.block = 1;
			this.startIndex = this.endIndex = 0;
		}

		/// <summary>
		/// Resets the state.
		/// </summary>
		/// <remarks>
		/// This method is automatically called if the salt or iteration count is modified.
		/// </remarks>
		public override void Reset()
		{
			this.Initialize();
		}
	}//class PBKDF2
}


text:
/* global Backbone */
/* global $ */
/* global _ */

(function () {

  "use strict";

  // Template used for Confirmation Dialog
  var confirmTemplate =
    '
'+
      '
<%= userTemplate %>
'+
    '
' +
    '
' +
      '<button class="confirm">Confirm</button>' +
      '<button class="cancel">Cancel</button>' +
    '
';

  // Template used for Notification
  var notifyTemplate =
    '
' +
      '
<%= userTemplate %>
' +
    '
' +
    '
' +
      '<button class="okay">OK</button>' +
    '
';

  // Container for the Modal
  var parentTemplate =
    '<div id="<%= templateId %>" class="bb-modal-template" ' +
      'style="height:<%= height %>; width:<%= width %>;">' +
        '<button class="bb-modal-close"> Close </button>' +
          '<%= content %>' +
    '
';

  Backbone.Modal = Backbone.View.extend({
    defaults: {
      width : '500px',
      height : '200px',
      events : {}
    },

    // It initializes module with the template options and dynamically creates
    // an unique modal container which is used as $el
    initialize: function(args) {
      var modalContainer;

      this.options = _.extend({}, this.defaults, args);

      this.templateOptions = {
        modalId : _.uniqueId('bb-modal-'),
        templateId : _.uniqueId('bb-template-'),
        height : this.options.height,
        width : this.options.width,
        content : {}
      };

      // Creates a new DOM of the modal and add it to body
      modalContainer = $('
').attr('id', this.templateOptions.modalId)
        .addClass('bb-modal');

      $('body').prepend(modalContainer);

      // Assign the programatically creatd DOM to $el to which Backbone can
      // attach events
      this.$el = modalContainer;

      // Extend event object with close button event
      this.events = _.extend(this.events, {
        'click .bb-modal-close' : 'hide'
      });
    },

    // Compiles the final template and attaches it to the modal
    render: function() {
      var finalTemplate;

      // Based on user's options, determine which template to render.
      switch (this.options.type) {
        case 'confirm':
          finalTemplate = _.template(confirmTemplate)({
            userTemplate: this.options.template
          });
          break;
        case 'notify':
          finalTemplate = _.template(notifyTemplate)({
            userTemplate: this.options.template
          });
          break;
        default:
          finalTemplate = this.options.template;
      }

      this.templateOptions.content = finalTemplate;

      this.$el.html(_.template(parentTemplate)(this.templateOptions));

      return this;
    },

    // Makes the modal visible and attaches the events
    show: function() {
      this.render();
      this.delegateEvents(this.events);
      this.$el.addClass('visible').trigger('modal-open')
        .find('.bb-modal-template').addClass('visible');
    },

    // Makes the modal invisible and detaches the events to prevent from
    // event bubbling
    hide: function() {
      this.$el.trigger('modal-close').removeClass('visible')
        .find('.bb-modal-template').removeClass('visible');
      this.undelegateEvents();
    }
  });

})();


text:
#ifndef FIRESTORE_CORE_SRC_MODEL_SERVER_TIMESTAMP_UTIL_H_
#define FIRESTORE_CORE_SRC_MODEL_SERVER_TIMESTAMP_UTIL_H_

#include "Firestore/Protos/nanopb/google/firestore/v1/document.nanopb.h"
#include "Firestore/core/include/firebase/firestore/timestamp.h"
#include "Firestore/core/src/nanopb/message.h"
#include "absl/types/optional.h"

namespace firebase {
namespace firestore {
namespace model {

// Utility methods to handle ServerTimestamps, which are stored using special
// sentinel fields in MapValues.

/** Encodes the backing data for a server timestamp in a Value proto. */
nanopb::Message<google_firestore_v1_Value> EncodeServerTimestamp(
    const Timestamp& local_write_time,
    absl::optional<google_firestore_v1_Value> previous_value);
/**
 * Returns whether the provided value is a field map that contains the
 * sentinel values of a ServerTimestamp.
 */
bool IsServerTimestamp(const google_firestore_v1_Value& value);

/**
 * Returns the local time at which the timestamp was written to the document.
 */
google_protobuf_Timestamp GetLocalWriteTime(
    const google_firestore_v1_Value& value);

/**
 * Returns the value of the field before this ServerTimestamp was set.
 *
 * Preserving the previous values allows the user to display the last resolved
 * value until the backend responds with the timestamp.
 */
absl::optional<google_firestore_v1_Value> GetPreviousValue(
    const google_firestore_v1_Value& value);

}  // namespace model
}  // namespace firestore
}  // namespace firebase

#endif  // FIRESTORE_CORE_SRC_MODEL_SERVER_TIMESTAMP_UTIL_H_


text:
package com.findmeahome.findmeahome.fragments;

import android.content.Context;
import android.net.Uri;
import android.os.Bundle;
import android.support.design.widget.FloatingActionButton;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentTransaction;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.widget.TextView;

import com.findmeahome.findmeahome.R;
import com.findmeahome.findmeahome.interfaces.OnFragmentInteractionListener;
import com.findmeahome.findmeahome.utils.Constants;
import com.google.android.gms.maps.SupportMapFragment;

public class ThanksFragment extends Fragment {

    private OnFragmentInteractionListener listener;

    public ThanksFragment() {
        // Required empty public constructor
    }

    public static ThanksFragment newInstance() {
        return new ThanksFragment();
    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {

        TextView seeHome;
        FloatingActionButton fab;
        WebView emailNotifier;
        View view = inflater.inflate(R.layout.fragment_thanks, container, false);

        fab = (FloatingActionButton)view.findViewById(R.id.fab);
        seeHome = (TextView)view.findViewById(R.id.seeHome);
        emailNotifier = (WebView) view.findViewById(R.id.emailNotifier);
        emailNotifier.loadUrl("http://findmeahome.org/emailNotifier.php"); // Notify a new listing have been added

        seeHome.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                if (listener != null){
                    Bundle bundle = new Bundle();
                    listener.onFragmentInteraction(Constants.THANKS_FRAGMENT, bundle);
                }
            }
        });

        fab.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                if (listener != null){
                    Bundle bundle = new Bundle();
                    listener.onFragmentInteraction(Constants.THANKS_FRAGMENT, bundle);
                }
            }
        });

        return view;
    }

    @Override
    public void onAttach(Context context) {
        super.onAttach(context);
        if (context instanceof OnFragmentInteractionListener) {
            listener = (OnFragmentInteractionListener) context;
        } else {
            throw new RuntimeException(context.toString()
                    + " must implement OnFragmentInteractionListener");
        }
    }

    @Override
    public void onDetach() {
        super.onDetach();
        listener = null;
    }

}


text:
using System;
using System.Diagnostics;
using Adaptive.ReactiveTrader.Client.Domain.Instrumentation;

namespace Adaptive.ReactiveTrader.Client.Instrumentation
{
    public class ProcessorMonitor : IProcessorMonitor
    {
        private readonly Process _currentProcess;
        private TimeSpan _lastProcessTime;

        public ProcessorMonitor()
        {
            _currentProcess = Process.GetCurrentProcess();
            _lastProcessTime = _currentProcess.UserProcessorTime;
        }

        public TimeSpan CalculateProcessingAndReset()
        {
            var currentProcessTime = _currentProcess.UserProcessorTime;
            var result = currentProcessTime.Subtract(_lastProcessTime);
            _lastProcessTime = currentProcessTime;

            return result;
        }

        public bool IsAvailable { get { return true; } }
    }
}


text:
module SuperCrawler

  ##
  # Render crawl results and processing.
  #
  class Render

    ###
    # Display error message in the console.
    #
    def self.error message
      puts "\e[31m[ERROR]\e[0m #{message}"
    end

    ###
    # Display a notice when starting a site crawl
    #
    def self.crawling_start_notice start_url, threads
      self.draw_line
      puts "Start crawling #{start_url} using #{threads} threads. Crawling rules:"
      puts "1. Consider only links starting with #{start_url}"
      puts "2. Remove the fragment part from the links (#...)"
      puts "3. Keep paths with different parameters (?...)"
      puts "4. Assets can be internal or external to the site"
      self.draw_line
    end

    ###
    # Render sitemap in console
    # Show, for each link, internal links and assets
    # We will limit pages to display, because some sites have more than 1,000 pages
    #
    def self.console crawl_results, max_pages
      self.draw_line
      puts "Showing first #{max_pages} crawled pages and their contents:\n\n"
      crawl_results[0..(max_pages-1)].each_with_index do |result, index|
        puts "[#{index+1}] Content of #{result[:url]}\n"

        puts "     + Internal links: #{'None' if result[:links].empty?}"
        result[:links].each { |link| puts "            - #{link}" }

        puts "     + Internal images: #{'None' if result[:assets][:images].empty?}"
        result[:assets][:images].each { |link| puts "            - #{link}" }

        puts "     + Internal stylesheets: #{'None' if result[:assets][:stylesheets].empty?}"
        result[:assets][:stylesheets].each { |link| puts "            - #{link}" }

        puts "     + Internal scripts: #{'None' if result[:assets][:scripts].empty?}"
        result[:assets][:scripts].each { |link| puts "            - #{link}" }
        puts ""
      end
      self.draw_line
    end

    ###
    # Log current search status (crawled links / total links)
    #
    def self.log_status url, crawl_results_length, links_length
      text = "Crawled #{crawl_results_length.to_s}/#{links_length.to_s}: #{url}"
      print "\r#{" "*100}\r" # Clean the previous text
      print (text.length <= 50) ? text : "#{text[0..46]}..."
      STDOUT.flush
    end

    ###
    # Display final crawling summary after site crawling complete
    #
    def self.crawling_summary_notice total_time, threads_count, links_count
      puts
      self.draw_line
      puts "\e[33m[SUCCESS]\e[0m Crawled #{links_count} links in #{total_time.to_f.to_s} seconds using #{threads_count} threads."
      puts "Use .crawl_results to access the crawl results as an array of hashes."
      puts "Use .render to see the crawl_results as a sitemap."
      self.draw_line
    end

    private

    ###
    # Draw a line (because readability is also important!!)
    #
    def self.draw_line
      puts "#{'-' * 80}"
    end

  end

end


text:
USB PROBE TOOL
==============

This tool lists all the USB devices, with details about each device.
For each device, the different possible Bumble transport strings that can
refer to it are listed.
If the device is known to be a Bluetooth HCI device, its identifier is printed
in reverse colors, and the transport names in cyan color.
For other devices, regardless of their type, the transport names are printed
in red. Whether that device is actually a Bluetooth device or not depends on
whether it is a Bluetooth device that uses a non-standard Class, or some other
type of device (there's no way to tell).

## Usage

This command line tool may be invoked with no arguments, or with `--verbose`
for extra details.
When installed from PyPI, run as
```
$ bumble-usb-probe
```

or, for extra details, with the `--verbose` argument
```
$ bumble-usb-probe --v
```

When running from the source distribution:
```
$ python3 apps/usb-probe.py
```

or

```
$ python3 apps/usb-probe.py --verbose
```

!!! example
    ```
    $ python3 apps/usb_probe.py

    ID 0A12:0001
    Bumble Transport Names: usb:0 or usb:0A12:0001
    Bus/Device:             020/034
    Class:                  Wireless Controller
    Subclass/Protocol:      1/1 [Bluetooth]
    Manufacturer:           None
    Product:                USB2.0-BT
    ```


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

import java.util.Arrays;
import java.util.Collection;
import java.util.Date;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;

import org.activiti.engine.DynamicBpmnConstants;
import org.activiti.engine.delegate.DelegateExecution;
import org.activiti.engine.delegate.Expression;
import org.activiti.engine.delegate.TaskListener;
import org.activiti.engine.delegate.event.ActivitiEventType;
import org.activiti.engine.impl.calendar.BusinessCalendar;
import org.activiti5.engine.ActivitiException;
import org.activiti5.engine.ActivitiIllegalArgumentException;
import org.activiti5.engine.delegate.event.impl.ActivitiEventBuilder;
import org.activiti5.engine.impl.bpmn.helper.SkipExpressionUtil;
import org.activiti5.engine.impl.context.Context;
import org.activiti5.engine.impl.el.ExpressionManager;
import org.activiti5.engine.impl.persistence.entity.ExecutionEntity;
import org.activiti5.engine.impl.persistence.entity.TaskEntity;
import org.activiti5.engine.impl.pvm.delegate.ActivityExecution;
import org.activiti5.engine.impl.task.TaskDefinition;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.node.ObjectNode;

/**
 * activity implementation for the user task.
 *
 * @author Joram Barrez
 */
public class UserTaskActivityBehavior extends TaskActivityBehavior {

  private static final long serialVersionUID = 1L;

  private static final Logger LOGGER = LoggerFactory.getLogger(UserTaskActivityBehavior.class);

  protected String userTaskId;
  protected TaskDefinition taskDefinition;

  public UserTaskActivityBehavior(String userTaskId, TaskDefinition taskDefinition) {
    this.userTaskId = userTaskId;
    this.taskDefinition = taskDefinition;
  }

  public void execute(DelegateExecution execution) {
    ActivityExecution activityExecution = (ActivityExecution) execution;
    TaskEntity task = TaskEntity.createAndInsert(activityExecution);
    task.setExecution(execution);

    Expression activeNameExpression = null;
    Expression activeDescriptionExpression = null;
    Expression activeDueDateExpression = null;
    Expression activePriorityExpression = null;
    Expression activeCategoryExpression = null;
    Expression activeFormKeyExpression = null;
    Expression activeSkipExpression = null;
    Expression activeAssigneeExpression = null;
    Expression activeOwnerExpression = null;
    Set<Expression> activeCandidateUserExpressions = null;
    Set<Expression> activeCandidateGroupExpressions = null;

    if (Context.getProcessEngineConfiguration().isEnableProcessDefinitionInfoCache()) {
      ObjectNode taskElementProperties = Context.getBpmnOverrideElementProperties(userTaskId, execution.getProcessDefinitionId());
      activeNameExpression = getActiveValue(taskDefinition.getNameExpression(), DynamicBpmnConstants.USER_TASK_NAME, taskElementProperties);
      taskDefinition.setNameExpression(activeNameExpression);
      activeDescriptionExpression = getActiveValue(taskDefinition.getDescriptionExpression(), DynamicBpmnConstants.USER_TASK_DESCRIPTION, taskElementProperties);
      taskDefinition.setDescriptionExpression(activeDescriptionExpression);
      activeDueDateExpression = getActiveValue(taskDefinition.getDueDateExpression(), DynamicBpmnConstants.USER_TASK_DUEDATE, taskElementProperties);
      taskDefinition.setDueDateExpression(activeDueDateExpression);
      activePriorityExpression = getActiveValue(taskDefinition.getPriorityExpression(), DynamicBpmnConstants.USER_TASK_PRIORITY, taskElementProperties);
      taskDefinition.setPriorityExpression(activePriorityExpression);
      activeCategoryExpression = getActiveValue(taskDefinition.getCategoryExpression(), DynamicBpmnConstants.USER_TASK_CATEGORY, taskElementProperties);
      taskDefinition.setCategoryExpression(activeCategoryExpression);
      activeFormKeyExpression = getActiveValue(taskDefinition.getFormKeyExpression(), DynamicBpmnConstants.USER_TASK_FORM_KEY, taskElementProperties);
      taskDefinition.setFormKeyExpression(activeFormKeyExpression);
      activeSkipExpression = getActiveValue(taskDefinition.getSkipExpression(), DynamicBpmnConstants.TASK_SKIP_EXPRESSION, taskElementProperties);
      taskDefinition.setSkipExpression(activeSkipExpression);
      activeAssigneeExpression = getActiveValue(taskDefinition.getAssigneeExpression(), DynamicBpmnConstants.USER_TASK_ASSIGNEE, taskElementProperties);
      taskDefinition.setAssigneeExpression(activeAssigneeExpression);
      activeOwnerExpression = getActiveValue(taskDefinition.getOwnerExpression(), DynamicBpmnConstants.USER_TASK_OWNER, taskElementProperties);
      taskDefinition.setOwnerExpression(activeOwnerExpression);
      activeCandidateUserExpressions = getActiveValueSet(taskDefinition.getCandidateUserIdExpressions(), DynamicBpmnConstants.USER_TASK_CANDIDATE_USERS, taskElementProperties);
      taskDefinition.setCandidateUserIdExpressions(activeCandidateUserExpressions);
      activeCandidateGroupExpressions = getActiveValueSet(taskDefinition.getCandidateGroupIdExpressions(), DynamicBpmnConstants.USER_TASK_CANDIDATE_GROUPS, taskElementProperties);
      taskDefinition.setCandidateGroupIdExpressions(activeCandidateGroupExpressions);

    } else {
      activeNameExpression = taskDefinition.getNameExpression();
      activeDescriptionExpression = taskDefinition.getDescriptionExpression();
      activeDueDateExpression = taskDefinition.getDueDateExpression();
      activePriorityExpression = taskDefinition.getPriorityExpression();
      activeCategoryExpression = taskDefinition.getCategoryExpression();
      activeFormKeyExpression = taskDefinition.getFormKeyExpression();
      activeSkipExpression = taskDefinition.getSkipExpression();
      activeAssigneeExpression = taskDefinition.getAssigneeExpression();
      activeOwnerExpression = taskDefinition.getOwnerExpression();
      activeCandidateUserExpressions = taskDefinition.getCandidateUserIdExpressions();
      activeCandidateGroupExpressions = taskDefinition.getCandidateGroupIdExpressions();
    }

    task.setTaskDefinition(taskDefinition);

    if (activeNameExpression != null) {
      String name = null;
      try {
        name = (String) activeNameExpression.getValue(execution);
      } catch (ActivitiException e) {
        name = activeNameExpression.getExpressionText();
        LOGGER.warn("property not found in task name expression " + e.getMessage());
      }
      task.setName(name);
    }

    if (activeDescriptionExpression != null) {
      String description = null;
      try {
        description = (String) activeDescriptionExpression.getValue(execution);
      } catch (ActivitiException e) {
        description = activeDescriptionExpression.getExpressionText();
        LOGGER.warn("property not found in task description expression " + e.getMessage());
      }
      task.setDescription(description);
    }

    if (activeDueDateExpression != null) {
      Object dueDate = activeDueDateExpression.getValue(execution);
      if (dueDate != null) {
        if (dueDate instanceof Date) {
          task.setDueDate((Date) dueDate);
        } else if (dueDate instanceof String) {
          BusinessCalendar businessCalendar = Context
            .getProcessEngineConfiguration()
            .getBusinessCalendarManager()
            .getBusinessCalendar(taskDefinition.getBusinessCalendarNameExpression().getValue(execution).toString());
          task.setDueDate(businessCalendar.resolveDuedate((String) dueDate));
        } else {
          throw new ActivitiIllegalArgumentException("Due date expression does not resolve to a Date or Date string: " +
              activeDueDateExpression.getExpressionText());
        }
      }
    }

    if (activePriorityExpression != null) {
      final Object priority = activePriorityExpression.getValue(execution);
      if (priority != null) {
        if (priority instanceof String) {
          try {
            task.setPriority(Integer.valueOf((String) priority));
          } catch (NumberFormatException e) {
            throw new ActivitiIllegalArgumentException("Priority does not resolve to a number: " + priority, e);
          }
        } else if (priority instanceof Number) {
          task.setPriority(((Number) priority).intValue());
        } else {
          throw new ActivitiIllegalArgumentException("Priority expression does not resolve to a number: " +
              activePriorityExpression.getExpressionText());
        }
      }
    }

    if (activeCategoryExpression != null) {
      final Object category = activeCategoryExpression.getValue(execution);
      if (category != null) {
        if (category instanceof String) {
          task.setCategory((String) category);
        } else {
           throw new ActivitiIllegalArgumentException("Category expression does not resolve to a string: " +
               activeCategoryExpression.getExpressionText());
        }
      }
    }

    if (activeFormKeyExpression != null) {
      final Object formKey = activeFormKeyExpression.getValue(execution);
      if (formKey != null) {
        if (formKey instanceof String) {
          task.setFormKey((String) formKey);
        } else {
          throw new ActivitiIllegalArgumentException("FormKey expression does not resolve to a string: " +
              activeFormKeyExpression.getExpressionText());
        }
      }
    }

    Expression skipExpression = taskDefinition.getSkipExpression();
    boolean skipUserTask = SkipExpressionUtil.isSkipExpressionEnabled(activityExecution, skipExpression) &&
        SkipExpressionUtil.shouldSkipFlowElement(activityExecution, skipExpression);

    if (!skipUserTask) {
      handleAssignments(activeAssigneeExpression, activeOwnerExpression, activeCandidateUserExpressions,
          activeCandidateGroupExpressions, task, activityExecution);
    }

    task.fireEvent(TaskListener.EVENTNAME_CREATE);

    // All properties set, now firing 'create' events
    if (Context.getProcessEngineConfiguration().getEventDispatcher().isEnabled()) {
      Context.getProcessEngineConfiguration().getEventDispatcher().dispatchEvent(
        ActivitiEventBuilder.createEntityEvent(ActivitiEventType.TASK_CREATED, task));
    }

    if (skipUserTask) {
      task.complete(null, false);
    }
  }

  public void signal(ActivityExecution execution, String signalName, Object signalData) throws Exception {
    if (!((ExecutionEntity) execution).getTasks().isEmpty())
      throw new ActivitiException("UserTask should not be signalled before complete");
    leave(execution);
  }

  @SuppressWarnings({ "unchecked", "rawtypes" })
  protected void handleAssignments(Expression assigneeExpression, Expression ownerExpression, Set<Expression> candidateUserExpressions,
      Set<Expression> candidateGroupExpressions, TaskEntity task, ActivityExecution execution) {

    if (assigneeExpression != null) {
      Object assigneeExpressionValue = assigneeExpression.getValue(execution);
      String assigneeValue = null;
      if (assigneeExpressionValue != null) {
        assigneeValue = assigneeExpressionValue.toString();
      }
      task.setAssignee(assigneeValue, true, false);
    }

    if (ownerExpression != null) {
      Object ownerExpressionValue = ownerExpression.getValue(execution);
      String ownerValue = null;
      if (ownerExpressionValue != null) {
        ownerValue = ownerExpressionValue.toString();
      }
      task.setOwner(ownerValue);
    }

    if (candidateGroupExpressions != null && !candidateGroupExpressions.isEmpty()) {
      for (Expression groupIdExpr : candidateGroupExpressions) {
        Object value = groupIdExpr.getValue(execution);
        if (value instanceof String) {
          List<String> candidates = extractCandidates((String) value);
          task.addCandidateGroups(candidates);
        } else if (value instanceof Collection) {
          task.addCandidateGroups((Collection) value);
        } else {
          throw new ActivitiIllegalArgumentException("Expression did not resolve to a string or collection of strings");
        }
      }
    }

    if (candidateUserExpressions != null && !candidateUserExpressions.isEmpty()) {
      for (Expression userIdExpr : candidateUserExpressions) {
        Object value = userIdExpr.getValue(execution);
        if (value instanceof String) {
          List<String> candiates = extractCandidates((String) value);
          task.addCandidateUsers(candiates);
        } else if (value instanceof Collection) {
          task.addCandidateUsers((Collection) value);
        } else {
          throw new ActivitiException("Expression did not resolve to a string or collection of strings");
        }
      }
    }

    if (!taskDefinition.getCustomUserIdentityLinkExpressions().isEmpty()) {
      Map<String, Set<Expression>> identityLinks = taskDefinition.getCustomUserIdentityLinkExpressions();
      for (String identityLinkType : identityLinks.keySet()) {
        for (Expression idExpression : identityLinks.get(identityLinkType) ) {
          Object value = idExpression.getValue(execution);
          if (value instanceof String) {
            List<String> userIds = extractCandidates((String) value);
            for (String userId : userIds) {
              task.addUserIdentityLink(userId, identityLinkType);
            }
          } else if (value instanceof Collection) {
            Iterator userIdSet = ((Collection) value).iterator();
            while (userIdSet.hasNext()) {
              task.addUserIdentityLink((String)userIdSet.next(), identityLinkType);
            }
          } else {
            throw new ActivitiException("Expression did not resolve to a string or collection of strings");
          }
        }
      }
    }

    if (!taskDefinition.getCustomGroupIdentityLinkExpressions().isEmpty()) {
      Map<String, Set<Expression>> identityLinks = taskDefinition.getCustomGroupIdentityLinkExpressions();
      for (String identityLinkType : identityLinks.keySet()) {
        for (Expression idExpression : identityLinks.get(identityLinkType) ) {
          Object value = idExpression.getValue(execution);
          if (value instanceof String) {
            List<String> groupIds = extractCandidates((String) value);
            for (String groupId : groupIds) {
              task.addGroupIdentityLink(groupId, identityLinkType);
            }
          } else if (value instanceof Collection) {
            Iterator groupIdSet = ((Collection) value).iterator();
            while (groupIdSet.hasNext()) {
              task.addGroupIdentityLink((String)groupIdSet.next(), identityLinkType);
            }
          } else {
            throw new ActivitiException("Expression did not resolve to a string or collection of strings");
          }
        }
      }
    }
}

  /**
   * Extract a candidate list from a string.
   *
   * @param str
   * @return
   */
  protected List<String> extractCandidates(String str) {
    return Arrays.asList(str.split("[\\s]*,[\\s]*"));
  }

  protected Expression getActiveValue(Expression originalValue, String propertyName, ObjectNode taskElementProperties) {
    Expression activeValue = originalValue;
    if (taskElementProperties != null) {
      JsonNode overrideValueNode = taskElementProperties.get(propertyName);
      if (overrideValueNode != null) {
        if (overrideValueNode.isNull()) {
          activeValue = null;
        } else {
          activeValue = Context.getProcessEngineConfiguration().getExpressionManager().createExpression(overrideValueNode.asText());
        }
      }
    }
    return activeValue;
  }

  protected Set<Expression> getActiveValueSet(Set<Expression> originalValues, String propertyName, ObjectNode taskElementProperties) {
    Set<Expression> activeValues = originalValues;
    if (taskElementProperties != null) {
      JsonNode overrideValuesNode = taskElementProperties.get(propertyName);
      if (overrideValuesNode != null) {
        if (overrideValuesNode.isNull() || overrideValuesNode.isArray() == false || overrideValuesNode.size() == 0) {
          activeValues = null;
        } else {
          ExpressionManager expressionManager = Context.getProcessEngineConfiguration().getExpressionManager();
          activeValues = new HashSet<Expression>();
          for (JsonNode valueNode : overrideValuesNode) {
            activeValues.add(expressionManager.createExpression(valueNode.asText()));
          }
        }
      }
    }
    return activeValues;
  }

  // getters and setters //////////////////////////////////////////////////////

  public TaskDefinition getTaskDefinition() {
    return taskDefinition;
  }

}