text:
#pragma once
#include "core.h"
#include "units.h"
#include "particle.h"
#include "aux/pairmatrix.h"
#include "tabulate.h"
#include "functionparser.h"
#include "multipole.h"
#include <coulombgalore.h>
#include <array>
#include <functional>

/*
namespace CoulombGalore {
    class SchemeBase;
    class Splined;
}*/

namespace Faunus {
namespace Potential {

using namespace std::string_literals;

//! type of a matrix containing pair potential coefficients
typedef Eigen::MatrixXd TPairMatrix;
typedef std::shared_ptr<TPairMatrix> TPairMatrixPtr;
//! type of a function extracting a potential coefficient from the InteractionData, e.g., sigma or eps
typedef std::function<double(const InteractionData &)> TExtractorFunc;
//! type of a function defining a combination rule of a heterogeneous pair interaction
typedef std::function<double(double, double)> TCombinatorFunc;
//! type of a function modifying combinator's output
typedef std::function<double(double)> TModifierFunc;

/**
 * @brief Data for a custom (heterogeneous) interaction between two given atom types.
 *
 * The very same format is used as for a homogeneous interaction specified directly on an atom type.
 */
struct CustomInteractionData {
    std::array<AtomData::Tid, 2> atom_id;
    InteractionData interaction;
};

void from_json(const json &j, CustomInteractionData &interaction);
void to_json(json &j, const CustomInteractionData &interaction);

void from_json(const json &j, std::vector<CustomInteractionData> &interactions);

/**
 * @brief Known named combination rules for parameters of pair potential interaction.
 *
 * When adding a new one, add a json mapping. Also consider appending the PairMixer::getCombinator()
 * method to recognize the new rule.
 */
enum CombinationRuleType { COMB_UNDEFINED, COMB_ARITHMETIC, COMB_GEOMETRIC, COMB_LORENTZ_BERTHELOT };
NLOHMANN_JSON_SERIALIZE_ENUM(CombinationRuleType, {
                                                      {COMB_UNDEFINED, "undefined"},
                                                      {COMB_ARITHMETIC, "arithmetic"},
                                                      {COMB_GEOMETRIC, "geometric"},
                                                      {COMB_LORENTZ_BERTHELOT, "lorentz_berthelot"},
                                                      {COMB_LORENTZ_BERTHELOT, "LB"}, // alternative non-canonical name
                                                  })

/**
 * @brief Exception for handling pair potential initialization.
 */
struct PairPotentialException : public std::runtime_error {
    PairPotentialException(const std::string msg) : std::runtime_error(msg){};
};

/**
 * @brief PairMixer creates a matrix of pair potential coefficients based on the atom properties
 * and/or custom values using an arbitrary combination rule.
 *
 * PairMixer holds three functions that are applied in order extractor → combinator → modifier to create
 * a coefficient matrix for all possible interactions. The function createPairMatrix applies the functions
 * on all atom type pairs, and optionally also on the list of custom pair parameters (not the combinator
 * function).
 */
class PairMixer {
    TExtractorFunc extractor;   //!< Function extracting the coefficient from the InteractionData structure
    TCombinatorFunc combinator; //!< Function combining two values
    TModifierFunc modifier;     //!< Function modifying the result for fast computations, e.g., a square of

  public:
    PairMixer(TExtractorFunc extractor, TCombinatorFunc combinator, TModifierFunc modifier = &modIdentity)
        : extractor(extractor), combinator(combinator), modifier(modifier){};

    //! @return a square matrix of atoms.size()
    TPairMatrixPtr createPairMatrix(const std::vector<AtomData> &atoms);
    //! @return a square matrix of atoms.size()
    TPairMatrixPtr createPairMatrix(const std::vector<AtomData> &atoms,
                                    const std::vector<CustomInteractionData> &interactions);

    enum CoefficientType {COEF_ANY, COEF_SIGMA, COEF_EPSILON};
    static TCombinatorFunc getCombinator(CombinationRuleType combination_rule, CoefficientType coefficient = COEF_ANY);

    // when explicit custom pairs are the only option
    inline static constexpr double combUndefined(double = 0.0, double = 0.0) {
        return std::numeric_limits<double>::signaling_NaN();
    };
    inline static double combArithmetic(double a, double b) { return 0.5 * (a + b); }
    inline static double combGeometric(double a, double b) { return std::sqrt(a * b); }
    inline static double modIdentity(double x) { return x; }
    inline static double modSquared(double x) { return x * x; }
};

/**
 * @brief Base for all pair-potentials
 *
 * The `selfEnergy` functor is by default a nullptr. Coulombic potentials
 * may change this to add a self-energy stemming from charges and dipoles.
 * This term is important for for example Widom insertion and grand canonical
 * Monte Carlo schemes.
 */
struct PairPotentialBase {
    std::string name; //!< unique name per polymorphic call; used in FunctorPotential::combineFunc
    std::string cite; //!< Typically a short-doi litterature reference
    bool isotropic = true; //!< true if pair-potential is independent of particle orientation
    std::function<double(const Particle &)> selfEnergy = nullptr; //!< self energy of particle (kT)
    virtual void to_json(json &) const = 0;
    virtual void from_json(const json &) = 0;
    virtual ~PairPotentialBase() = default;
    virtual Point force(const Particle &, const Particle &, double, const Point &) const;
    virtual double operator()(const Particle &, const Particle &, double, const Point &) const = 0;

  protected:
    PairPotentialBase(const std::string &name = std::string(), const std::string &cite = std::string(),
                      bool isotropic = true);
};

void to_json(json &j, const PairPotentialBase &base);   //!< Serialize any pair potential to json
void from_json(const json &j, PairPotentialBase &base); //!< Serialize any pair potential from json

/**
 * @brief A common ancestor for potentials that use parameter matrices computed from atomic
 * properties and/or custom atom pair properties.
 *
 * The class and their descendants have now also a responsibility to create themselves from a json object
 * and store back. This is gradually becoming a complex task which shall be moved into other class.
 */
class MixerPairPotentialBase : public PairPotentialBase {
  protected:
    CombinationRuleType combination_rule;
    std::shared_ptr<std::vector<CustomInteractionData>> custom_pairs = std::make_shared<std::vector<CustomInteractionData>>();
    json json_extra_params;              //!< pickled extra parameters like a coefficient names mapping
    void init();                         //!< initialize the potential when data, e.g., atom parameters, are available
    virtual void initPairMatrices() = 0; //!< potential-specific initialization of parameter matrices
    virtual void extractorsFromJson(const json &) {}; //!< potential-specific assignment of coefficient extracting functions
  public:
    MixerPairPotentialBase(const std::string &name = std::string(), const std::string &cite = std::string(),
                           CombinationRuleType combination_rule = COMB_UNDEFINED, bool isotropic = true)
        : PairPotentialBase(name, cite, isotropic), combination_rule(combination_rule) {};
    virtual ~MixerPairPotentialBase() = default;
    void from_json(const json &) override;
    void to_json(json &) const override;
};

/**
 * @brief Statically combines two pair potentials at compile-time
 *
 * This is the most efficient way to combining pair-potentials due
 * to the possibility for compile-time optimisation.
 */
template <class T1, class T2> struct CombinedPairPotential : public PairPotentialBase {
    T1 first;  //!< First pair potential of type T1
    T2 second; //!< Second pair potential of type T2
    CombinedPairPotential(const std::string &name = "") : PairPotentialBase(name){};
    inline double operator()(const Particle &a, const Particle &b, double r2,
                             const Point &r = {0, 0, 0}) const override {
        return first(a, b, r2, r) + second(a, b, r2, r);
    } //!< Combine pair energy

    inline Point force(const Particle &a, const Particle &b, double r2, const Point &p) const override {
        return first.force(a, b, r2, p) + second.force(a, b, r2, p);
    } //!< Combine force

    void from_json(const json &j) override {
        Faunus::Potential::from_json(j, first);
        Faunus::Potential::from_json(j, second);
        name = first.name + "/" + second.name;
        if (first.selfEnergy or second.selfEnergy) { // combine self-energies
            selfEnergy = [u1 = first.selfEnergy, u2 = second.selfEnergy](const Particle &p) {
                if (u1 and u2) {
                    return u1(p) + u2(p);
                } else if (u1) {
                    return u1(p);
                }
                return u2(p);
            };
        } else {
            selfEnergy = nullptr;
        }
    }
    void to_json(json &j) const override {
        assert(j.is_object());
        auto &_j = j["default"] = json::array();
        _j.push_back(first);
        _j.push_back(second);
    }
};

template <class T1, class T2, class = typename std::enable_if<std::is_base_of<PairPotentialBase, T1>::value>::type,
          class = typename std::enable_if<std::is_base_of<PairPotentialBase, T2>::value>::type>
CombinedPairPotential<T1, T2> &operator+(const T1 &pot1, const T2 &) {
    return *(new CombinedPairPotential<T1, T2>(pot1.name));
} //!< Statically add two pair potentials at compile-time

struct Dummy : public PairPotentialBase {
    Dummy();
    inline double operator()(const Particle &, const Particle &, double, const Point &) const override { return 0.0; }
    void from_json(const json &) override;
    void to_json(json &) const override;
}; //!< A dummy pair potential that always returns zero

/**
 * @brief Lennard-Jones potential with an arbitrary combination rule.
 * @note Mixing data is _shared_ upon copying
 */
class LennardJones : public MixerPairPotentialBase {
    TExtractorFunc extract_sigma, extract_epsilon;

  protected:
    TPairMatrixPtr sigma_squared;     // sigma_ij * sigma_ij
    TPairMatrixPtr epsilon_quadruple; // 4 * epsilon_ij
    void initPairMatrices() override;
    void extractorsFromJson(const json &j) override;

  public:
    LennardJones(const std::string &name = "lennardjones", const std::string &cite = std::string(),
                 CombinationRuleType combination_rule = COMB_LORENTZ_BERTHELOT)
        : MixerPairPotentialBase(name, cite, combination_rule){};

    inline Point force(const Particle &a, const Particle &b, double r2, const Point &p) const override {
        double s6 = powi((*sigma_squared)(a.id, b.id), 3);
        double r6 = r2 * r2 * r2;
        double r14 = r6 * r6 * r2;
        return 6. * (*epsilon_quadruple)(a.id, b.id) * s6 * (2 * s6 - r6) / r14 * p;
    }

    inline double operator()(const Particle &a, const Particle &b, double r2, const Point &) const override {
        double x = (*sigma_squared)(a.id, b.id) / r2;              // s2/r2
        x = x * x * x;                                             // s6/r6
        return (*epsilon_quadruple)(a.id, b.id) * (x * x - x);
    }
};

/**
 * @brief Weeks-Chandler-Andersen pair potential
 * @details This is a Lennard-Jones type potential, cut and shifted to zero
 * at @f$r_c=2^{1/6}\sigma@f$. More info can be found in at
 * <http://doi.org/ct4kh9> and the functional form is:
 * @f[
 * \beta u = 4 \beta \epsilon \left ( (b/r)^{12} - (b/r)^6 + \frac{1}{4} \right )
 * @f]
 * where sigma, epsilon per default are set
 * using Lorentz-Berthelot mixing rules.
 *
 * @note Mixing data is _shared_ upon copying
 */
class WeeksChandlerAndersen : public LennardJones {
    static constexpr double onefourth = 0.25, twototwosixth = 1.2599210498948732;

    inline double operator()(const Particle &a, const Particle &b, double r2) const {
        double x = (*sigma_squared)(a.id, b.id); // s^2
        if (r2 > x * twototwosixth)
            return 0;
        x = x / r2;    // (s/r)^2
        x = x * x * x; // (s/r)^6
        return (*epsilon_quadruple)(a.id, b.id) * (x * x - x + onefourth);
    }

  public:
    WeeksChandlerAndersen(const std::string &name = "wca", const std::string &cite = "doi:ct4kh9",
                          CombinationRuleType combination_rule = COMB_LORENTZ_BERTHELOT);

    inline double operator()(const Particle &a, const Particle &b, double r2, const Point &) const override {
        return operator()(a, b, r2);
    }

    inline Point force(const Particle &a, const Particle &b, double r2, const Point &p) const override {
        double x = (*sigma_squared)(a.id, b.id); // s^2
        if (r2 > x * twototwosixth)
            return Point(0, 0, 0);
        x = x / r2;    // (s/r)^2
        x = x * x * x; // (s/r)^6
        return (*epsilon_quadruple)(a.id, b.id) * 6 * (2 * x * x - x) / r2 * p;
    }
}; // Weeks-Chandler-Andersen potential

/**
 * @brief Hardsphere potential
 *
 * Uses arithmetic mean for sigma as a default combination rule.
 * @note `PairMatrix` is _shared_ upon copying
 */
class HardSphere : public MixerPairPotentialBase {
    TExtractorFunc extract_sigma;

  protected:
    TPairMatrixPtr sigma_squared; // sigma_ij * sigma_ij
    void initPairMatrices() override;
    void extractorsFromJson(const json &j) override;

  public:
    HardSphere(const std::string &name = "hardsphere")
        : MixerPairPotentialBase(name, std::string(), COMB_ARITHMETIC) {};

    inline double operator()(const Particle &a, const Particle &b, double r2, const Point &) const override {
        return r2 < (*sigma_squared)(a.id, b.id) ? pc::infty : 0.0;
    }
};

/**
 * @brief Hertz potential
 * @details This is a repulsive potential, that for example, describes the change in elastic energy
 * of two deformable objects when subjected to an axial compression.
 * @f[
 *     u(r) = \epsilon \left(1 - \frac{r}{\sigma}\right)^{5/2}
 * @f]
 * where r_H corresponds to the particle's radius.
 *
 * More info: doi:10.1063/1.3186742
 */
class Hertz : public MixerPairPotentialBase {
    TExtractorFunc extract_sigma, extract_epsilon;

  protected:
    TPairMatrixPtr sigma_squared; // sigma_ij * sigma_ij
    TPairMatrixPtr epsilon;       // epsilon_ij
    void initPairMatrices() override;
    void extractorsFromJson(const json &j) override;

  public:
    Hertz(const std::string &name = "hertz")
        : MixerPairPotentialBase(name) {};
    inline double operator()(const Particle &a, const Particle &b, double r2, const Point &) const override {
        if (r2 <= (*sigma_squared)(a.id, b.id))
            return (*epsilon)(a.id, b.id) * pow((1 - (sqrt(r2 / (*sigma_squared)(a.id, b.id)))), 2.5);
        return 0.0;
    }
};

/**
 * @brief Square-well potential
 * @details This is an attractive potential described by
 * @f[
 *     u(r) = -\epsilon
 * @f]
 * when r < \sigma, and zero otherwise.
 */
class SquareWell : public MixerPairPotentialBase {
    TExtractorFunc extract_sigma, extract_epsilon;

  protected:
    TPairMatrixPtr sigma_squared; // sigma_ij * sigma_ij
    TPairMatrixPtr epsilon;       // epsilon_ij
    void extractorsFromJson(const json &j) override;
    void initPairMatrices() override;

  public:
    SquareWell(const std::string &name = "squarewell")
        : MixerPairPotentialBase(name) {};
    inline double operator()(const Particle &a, const Particle &b, double r2, const Point &) const override {
        return (r2 < (*sigma_squared)(a.id, b.id)) ? -(*epsilon)(a.id, b.id) : 0.0;
    }
};

struct RepulsionR3 : public PairPotentialBase {
    double f = 0, s = 0, e = 0;

    RepulsionR3(const std::string &name = "repulsionr3") : PairPotentialBase(name) {};
    void from_json(const json &j) override;
    void to_json(json &j) const override;

    inline double operator()(const Particle &, const Particle &, double r2, const Point &) const override {
        double r = sqrt(r2);
        return f / (r * r2) + e * std::pow(s / r, 12);
    }
};

/**
 * @brief Cosine attraction
 * @details This is an attractive potential used for coarse grained lipids
 * and has the form:
 * @f[
 *     \beta u(r) = -\epsilon \cos^2 [ \pi(r-r_c)/2w_c ]
 * @f]
 * for \f$r_c\leq r \leq r_c+w_c\f$. For \f$r<r_c\f$, \f$\beta u=-\epsilon\f$,
 * while zero for \f$r>r_c+w_c\f$.
 *
 * JSON keywords:
 *
 * Key     | Description
 * :-------| :---------------------------
 * `eps`   | Depth, \f$\epsilon\f$ [kJ/mol]
 * `rc`    | Width, r_c [angstrom]
 * `wc`    | Decay range, w_c [angstrom]
 *
 */
class CosAttract : public PairPotentialBase {
    double eps, wc, rc, rc2, c, rcwc2;

  public:
    CosAttract(const std::string &name = "cos2") : PairPotentialBase(name) {};

    /**
     * @todo
     * The function `x(c,r2,rc)` defined herein could be approximated
     * by a series expansion for `r2=rcwc2`. In this way one can
     * avoid `cos()` and `sqrt()`. C code for this could be generated
     * in Matlab:
     *
     * ~~~
     * with(CodeGeneration)
     * x := series(cos(c*(sqrt(r2)-rc)), r2 = rcwc2, 2)
     * convert(x, polynom)
     * C(%, resultname = "x")
     * ~~~
     */
    inline double operator()(const Particle &, const Particle &, double r2, const Point &) const override {
        if (r2 < rc2)
            return -eps;
        if (r2 > rcwc2)
            return 0;
        double x = std::cos(c * (sqrt(r2) - rc));
        return -eps * x * x;
    }

    inline Point force(const Particle &, const Particle &, double r2, const Point &p) const override {
        if (r2 < rc2 || r2 > rcwc2)
            return Point(0, 0, 0);
        double r = sqrt(r2);
        double x1 = std::cos(c * (r - rc));
        double x2 = std::sin(c * (r - rc));
        return -2 * c * eps * x1 * x2 / r * p;
    }

    void to_json(json &j) const override;
    void from_json(const json &j) override;
};

/**
 * @brief Pairwise SASA potential calculating the surface area of inter-secting spheres
 */
class SASApotential : public PairPotentialBase {
  private:
    bool shift = true; // shift potential to zero at large separations?
    double proberadius = 0, conc = 0;

    double area(double R, double r, double d_squared)
    const; //!< Total surface area of two intersecting spheres or radii R and r as a function of separation

  public:
    inline double operator()(const Particle &a, const Particle &b, double r2, const Point &) const override {
        double tfe = 0.5 * (atoms[a.id].tfe + atoms[b.id].tfe);
        double tension = 0.5 * (atoms[a.id].tension + atoms[b.id].tension);
        if (fabs(tfe) > 1e-6 or fabs(tension) > 1e-6)
            return (tension + conc * tfe) * area(0.5 * atoms[a.id].sigma, 0.5 * atoms[b.id].sigma, r2);
        return 0;
    }
    SASApotential(const std::string &name = "sasa", const std::string &cite = std::string()) :
        PairPotentialBase(name, cite) {};
    void to_json(json &j) const override;
    void from_json(const json &j) override;
};

/**
 * @brief Plain Coulomb potential
 */
struct Coulomb : public PairPotentialBase {
    Coulomb(const std::string &name = "coulomb");
    double bjerrum_length = 0.0; //!< Bjerrum length
    inline double operator()(const Particle &a, const Particle &b, double r2, const Point &) const override {
        return bjerrum_length * a.charge * b.charge / std::sqrt(r2);
    }
    void to_json(json &j) const override;
    void from_json(const json &j) override;
};

struct DipoleDipole : public PairPotentialBase {
    DipoleDipole(const std::string &name = "dipoledipole", const std::string &cite = std::string()) :
        PairPotentialBase(name, cite, false) {};
    double lB; //!< Bjerrum length
    inline double operator()(const Particle &a, const Particle &b, double, const Point &r) const override {
        return lB*mu2mu(a.getExt().mu, b.getExt().mu, a.getExt().mulen*b.getExt().mulen, r,1.0,0.0);
    }
    void to_json(json &j) const override;
    void from_json(const json &j) override;
};

/**
 * @brief Charge-nonpolar pair interaction
 * @note Pair data is _shared_ upon copying
 */
class Polarizability : public Coulomb {
  private:
    double epsr;
    std::shared_ptr<PairMatrix<double>> m_neutral, m_charged;

  public:
    Polarizability(const std::string &name = "polar") : Coulomb(name) {
        m_neutral = std::make_shared<PairMatrix<double>>();
        m_charged = std::make_shared<PairMatrix<double>>();
    };

    void from_json(const json &j) override;

    void to_json(json &j) const override { j = {{"epsr", epsr}}; }

    inline double operator()(const Particle &a, const Particle &b, double r2, const Point &) const override {
        double r4inv = 1 / (r2 * r2);
        if (fabs(a.charge) > 1e-9 or fabs(b.charge) > 1e-9)
            return (*m_charged)(a.id, b.id) * r4inv;
        else
            return (*m_neutral)(a.id, b.id) / r2 * r4inv;
    }

    inline Point force(const Particle &a, const Particle &b, double r2, const Point &p) const override {
        double r6inv = 1 / (r2 * r2 * r2);
        if (fabs(a.charge) > 1e-9 or fabs(b.charge) > 1e-9)
            return 4 * m_charged->operator()(a.id, b.id) * r6inv * p;
        else
            return 6 * m_neutral->operator()(a.id, b.id) / r2 * r6inv * p;
    }
};

/**
 * @brief Finite Extensible Nonlinear Elastic (FENE) potential
 *
 * This is an anharmonic bonding potential with the form:
 * @f[
 *     \beta u(r) = -\frac{k r_0^2}{2}\ln \left [ 1-(r/r_0)^2 \right ]
 * @f]
 * for \f$r<r_0\f$, otherwise infinity. JSON keywords:
 *
 * - `stiffness` Bond stiffness, `k` [kT]
 * - `maxsep` Maximum separation, `r_0` [angstrom]
 *
 * More info: doi:10.1103/PhysRevE.59.4248
 */
class FENE : public PairPotentialBase {
    double k, r02, r02inv;

  public:
    FENE(const std::string &name = "fene") : PairPotentialBase(name) {};
    void from_json(const json &j) override;
    void to_json(json &j) const override;

    /** @brief Energy in kT between two particles, r2 = squared distance */
    inline double operator()(const Particle &, const Particle &, double r2, const Point &) const override {
        return (r2 > r02) ? pc::infty : -0.5 * k * r02 * std::log(1 - r2 * r02inv);
    }

    inline Point force(const Particle &, const Particle &, double r2, const Point &p) const override {
        return (r2 > r02) ? -pc::infty * p : -k * r02 / (r02 - r2) * p;
    }
};

/**
 * @brief Wrapper for external CoulombGalore library
 */
class NewCoulombGalore : public PairPotentialBase {
  protected:
    ::CoulombGalore::Splined pot;
    virtual void setSelfEnergy();

  public:
    NewCoulombGalore(const std::string & = "coulomb");
    inline double operator()(const Particle &a, const Particle &b, double r2, const Point &) const override {
        return bjerrum_length *
               pot.ion_ion_energy(a.charge, b.charge, sqrt(r2) + std::numeric_limits<double>::epsilon());
    }
    Point force(const Particle &, const Particle &, double, const Point &) const override;
    void from_json(const json &) override;
    void to_json(json &) const override;
    double dielectric_constant(double M2V) { return pot.calc_dielectric(M2V); }
    double bjerrum_length; // Bjerrum length (angstrom)
};

/**
 * @brief Multipole interactions
 * @note Only dipole-dipole interactions are currently enabled
 */
class Multipole : public NewCoulombGalore {
  private:
    void setSelfEnergy() override;

  public:
    Multipole(const std::string & = "multipole");
    inline double operator()(const Particle &a, const Particle &b, double, const Point &r) const override {
        // Only dipole-dipole for now!
        Point mua = a.getExt().mu * a.getExt().mulen;
        Point mub = b.getExt().mu * b.getExt().mulen;
        double dipdip = pot.dipole_dipole_energy(mua, mub, r);
        return bjerrum_length * (dipdip);
    }

    Point force(const Particle &, const Particle &, double, const Point &) const override;
};

/**
 * @brief Custom pair-potential taking math. expressions at runtime
 */
class CustomPairPotential : public PairPotentialBase {
  private:
    // Only ExprFunction<double> is explicitly instantiated in functionparser.cpp. Other types as well as
    // the implicit template instantiation is disabled to save reasources during the compilation/build.
    ExprFunction<double> expr;
    struct Data {
        double r = 0, q1 = 0, q2 = 0, s1 = 0, s2 = 0;
    };
    double Rc2;
    std::shared_ptr<Data> d;
    json jin; // initial json input
  public:
    inline double operator()(const Particle &a, const Particle &b, double r2, const Point &) const override {
        if (r2 > Rc2)
            return 0;
        d->r = sqrt(r2);
        d->q1 = a.charge;
        d->q2 = b.charge;
        d->s1 = atoms[a.id].sigma;
        d->s2 = atoms[b.id].sigma;
        return expr();
    }
    CustomPairPotential(const std::string & = "custom");

    void from_json(const json &) override;
    void to_json(json &) const override;
};

/**
 * @brief Arbitrary potentials for specific atom types
 *
 * This maintains a species x species matrix with function pointers (`std::function`)
 * that wraps pair potentials. Flexibility over performance.
 *
 * @todo `to_json` should retrieve info from potentials instead of merely passing input
 * @warning Each atom pair will be assigned an instance of a pair-potential. This *could* be
 *          problematic if these have large memory requirements.
 */
class FunctorPotential : public PairPotentialBase {
    typedef std::function<double(const Particle &, const Particle &, double, const Point &)> uFunc;
    json _j; // storage for input json
    typedef CombinedPairPotential<Coulomb, HardSphere> PrimitiveModel;
    typedef CombinedPairPotential<Coulomb, WeeksChandlerAndersen> PrimitiveModelWCA;
    bool have_monopole_self_energy = false;
    bool have_dipole_self_energy = false;
    void registerSelfEnergy(PairPotentialBase *); //!< helper func to add to selv_energy_vector

    // List of pair-potential instances used when constructing functors.
    // Note that potentials w. large memory requirements (LJ, WCA etc.)
    // typically use `shared_ptr` so that the created functors _share_
    // the data. That is *only* put the pair-potential here if you can
    // share internal (shared) pointers.
    std::tuple<NewCoulombGalore,      // 0
               CosAttract,            // 1
               Polarizability,        // 2
               HardSphere,            // 3
               LennardJones,          // 4
               RepulsionR3,           // 5
               SASApotential,         // 6
               WeeksChandlerAndersen, // 7
               PrimitiveModel,        // 8
               PrimitiveModelWCA,     // 9
               Hertz,                 // 10
               SquareWell,            // 11
               Multipole              // 12
               >
        potlist;

    uFunc combineFunc(json &j); // parse json array of potentials to a single potential function object

  protected:
    PairMatrix<uFunc, true> umatrix; // matrix with potential for each atom pair; cannot be Eigen matrix

  public:
    FunctorPotential(const std::string &name = "functor potential");
    void to_json(json &j) const override;
    void from_json(const json &j) override;

    /**
     * @brief Potential energy between two particles
     * @param a First particle
     * @param b Second particle
     * @param r2 Squared distance
     * @param r Distance vector
     * @return Energy in kT
     */
    inline double operator()(const Particle &a, const Particle &b, double r2,
                             const Point &r = {0, 0, 0}) const override {
        return umatrix(a.id, b.id)(a, b, r2, r);
    }
};

/**
 * @brief Splined pair potentials
 *
 * This maintains a species x species matrix as in `FunctorPotential`
 * but with splined pair potentials. This avoids the functor lookup
 * and renders all potentials roughly the same speed.
 *
 * The spline range is automatically detected based on user-defined
 * energy thresholds. If below the range, the default behavior is to return
 * the EXACT energy, while if above ZERO is returned.
 */
class SplinedPotential : public FunctorPotential {
    /** @brief Expand spline data class to hold information about the sign of values for r<rmin */
    class KnotData : public Tabulate::TabulatorBase<double>::data {
      public:
        using base = Tabulate::TabulatorBase<double>::data;
        bool hardsphere_repulsion = false; //!< Use hardsphere repulsion for r smaller than rmin
        KnotData() = default;
        KnotData(const base &);
    };

    PairMatrix<KnotData> matrix_of_knots;                 //!< Matrix with tabulated potential for each atom pair
    Tabulate::Andrea<double> spline;                      //!< Spline method
    bool hardsphere_repulsion = false;                    //!< Use hardsphere repulsion for r smaller than rmin
    const int max_iterations = 1e6;                       //!< Max number of iterations when determining spline interval
    void stream_pair_potential(std::ostream &, int, int); //!< Stream pair potential to output stream
    void save_potentials();                               //!< Save splined and exact pair potentials to disk
    double findLowerDistance(int, int, double, double);   //!< Find lower distance for splining (rmin)
    double findUpperDistance(int, int, double, double);   //!< Find upper distance for splining (rmax)
    double dr = 1e-2;                                     //!< Distance interval when searching for rmin and rmax
    void createKnots(int, int, double, double);           //!< Create spline knots for pair of particles in [rmin:rmax]

  public:
    explicit SplinedPotential(const std::string &name = "splined");

    /**
     * Policies:
     *
     * 1. return splined potential if rmin>r<rmax
     * 2. return zero if r>=rmax
     * 3. return infinity if r<=rmin AND `hardsphere_repulsion` has been set to true
     * 4. return exact energy if r<=rmin
     */
    inline double operator()(const Particle &p1, const Particle &p2, double r2, const Point &) const override {
        auto &knots = matrix_of_knots(p1.id, p2.id);
        if (r2 >= knots.rmax2) {
            return 0.0;
        }
        if (r2 > knots.rmin2) {
            return spline.eval(knots, r2); // spline energy
        }
        if (knots.hardsphere_repulsion) {
            return pc::infty;
        }
        return FunctorPotential::operator()(p1, p2, r2, {0, 0, 0}); // exact energy
    }

    void from_json(const json &) override;
};

} // end of namespace Potential
} // end of namespace Faunus


Add a seasonal message to your fireplace this Christmas! Use raw-edged appliqué and free-motion embroidery to create the cute robin and Nöel lettering and completewith a beaded string on the centre flag. It is also a great scrap buster!


text:
Årsta slott är en slottsliknande herrgård och ett tidigare säteri samt gods i Österhaninge socken och Haninge kommun, Stockholms län. Årsta med rötter i medeltiden har varit huvudgård för Tyska Ordens svenska jordinnehav. Nuvarande byggnad uppfördes 1660–1667 för Claes Hansson Bielkenstierna och hans hustru Barbro Åkesdotter (Natt och Dag). Årsta ärvdes sedan via giften av släkterna Kurck, Soop och Fleming tills det inköptes 1805 av den finlandssvenske brukspatronen Karl Fredrik Bremer, far till författaren Fredrika Bremer. Slottet var Fredrika Bremers barndomshem.

Sedan 1969 ägs slottet med sina två fristående flyglar av Haninge kommun. På marken norr om slottet har Haninge golfklubb sina banor. Huvudbyggnaden visas för allmänheten sommartid och under vinterhalvåret för bokade grupper.

Allmänt

Årsta är beläget innanför Blista fjärd, en östersjöfjärd mellan Gålö och fastlandet. Platsen har ett skyddat läge bakom en skogklädd ås som hindrar blicken över fjärden. Ursprungligen gick vattnet betydligt längre in mot fastlandet. Genom landhöjningen har fjärdens strandlinje dragit sig tillbaka. På en av Erik Dahlberghs Sueciabilder från 1680 kunde man fortfarande se en liten blänk av havet (markerat med B: Portus Maris Baltici). Över Årstagodset existerar inga historiska kartor på Lantmäteriet utom Häradsekonomiska kartan som visar trakten på sekelskiftet 1900.

Byggherren
Dagens huvudbyggnad uppfördes 1660–1667 för Claes Hansson Bielkenstierna och hans hustru Barbro Åkesdotter (Natt och Dag). Man känner inte till namnen på byggmästare eller arkitekt, men enligt sägnen skall slottet ha uppförts på initiativ av Barbro Åkesdotter (Natt och Dag), utan makens vetskap. Den uppgiften kan dock avfärdas med tanke på den långa byggtiden. Vidare berättar sägnen, att "Barbro Åkesdotter valde plats och uppförde slottet under en av mannens sjöfärder och att han blev så rasande, när han kom hem och fann att han icke kunde se havet från det nya slottet, att han gav sin hustru en örfil. Barbro Åkesdotter skulle ha hämnats genom att låta en tjänare lönnmörda mannen vid ett femstenarör nära Brink." I Ilitteraturen figurerar emellanåt uppgiften att Erik Dahlbergh, som även ritat ett antal slott och gravkor, skulle kunna vara arkitekten. För detta antagande skulle det ovanligt ståtliga och något överdimensionerade trapphuset kunna tala, som avbildas i genomskärning i Dahlberghs Sueciaverk.

Barbro Åkesdotter (Natt och Dag), lät även uppföra ättens gravkor vid Österhaninge kyrka, Bielkenstiernska gravkoret, insatt i kyrkan år 1683. I fonden i Österhaninge kyrka utgör det Bielkenstiernska gravmonumentet ett dominerande inslag. Det är en pampig skulpturgrupp, som utfördes av den holländske mästaren, skulptören Nicolaes Millich.

Huvudbyggnaden och omgivningen

Anläggningen klarade sig undan rysshärjningarna 1719 tack vare sitt skyddade läge. Årsta är därför en intakt slottsexteriör från 1600-talets mitt. Huvudbyggnaden mäter cirka 36x16 meter och är uppförd av sten i två våningar med en stor, delvis oinredd vind i två etage under ett brant, valmat tak. Fasaderna är släta och vitputsade. Trapphusets utskjutande porttorn är försedd med en cirka 350 år gammal urtavla och tornets klockformade överdel är krönt av en lanternin.

På vinden huserar nu en mängd fladdermöss och vid norra gavelns insida är den hissanordning som användes vid byggnadens uppförande ännu bevarad. Sandstensportalen från 1600-talet har alliansvapen för ätterna Bielkenstierna och Natt och Dag. Innanför slottets bastanta ekport står ett antal granitpelare som lyfter upp trapphusets entré, varifrån man tar sig vidare till de övre våningarna. Från bottenvåningens entré leder även en brant trappa ner till källarens utrymmen med murade valv och gångar (se mer under avsnitt "Trapphus och inredning").

Slottets främre gård flankeras av två flyglar med planmått 27 x 8,5 meter. De är uppförda av sten i en våning och följer huvudbyggnadens arkitektur. De byggdes 1912–1914 under Gustaf Theodor Cedergren tid som ägare och ersatte två äldre timrade flyglar.

Anläggningen är delvis omgiven av en park som ligger i anslutning till vidsträckta golfbanor tillhörande Haninge Golfklubb. I parkens sydvästra del ligger en minneslund för familjen Saxenberg och strax nedanför denna står en pittoresk lekstuga som tillhört familjen Meeths barn. I parkens engelska del är ett antal ålderstigna träd som en gång planterades på Fredrika Bremers initiativ. Norr om slottet står ladugården med förvaltarbostaden och ekonomibyggnader för jordbruket. Mot norr leder den trädkantade allén till gamla Årsta. Vid södra infarten står Blistastenen, som på 1800-talet flyttades hit från byn Blista.

Öster om Årstas ekonomibyggnader står den så kallade Mönstringsladan. Enligt traditionen var det i denna timmerlada som kung Gustav II Adolf satt och skrev in traktens soldater inför avresan till kriget i Livland 1621.

Bilder, omgivningen

Historik

Forntid

Gravfält från järnåldern vittnar om att människor var bosatta här sedan forntiden. Ortnamnsformen Årsta med efterledet "–sta" är typiskt för järnåldern och betyder "bostaden vid ån", vilket stämmer bäst in på ett gravfält med ett 70-tal gravar som ligger ungefär 500 meter söder om slottet intill mynningen av Husbyån (RAÄ-nummer Österhaninge 35:1). Förmodligen har boplatsen flyttats någon gång under medeltid till platsen för gamla Årsta, möjligtvis i samband med att den blev förvaltningsgård för Tyska Orden, vilket bör ha skett någon gång kring sekelskiftet 1300. Resterna efter det gamla Årsta består av en större stengrund och flera mindre husgrunder cirka 500 meter norr om det nuvarande slottet.

Tyska Orden under medeltiden
Årstas anor sträcker sig tillbaka till slutet av 1200-talet. På 1300-talet låg här en huvudgård för Tyska ordens svenska jordinnehav som orden fått i arv efter riddaren Karl Ulfsson. Årsta nämns för första gången i de skriftliga källorna 1308. Under hela medeltiden ägdes Årsta av stormän. År 1467 sålde Tyska Orden alla sina svenska egendomar till riksföreståndaren Erik Axelsson av den mäktiga och berömda dansk-svenska släkten Tott. Erik Axelsson (Tott) överlät egendomen 1468 till sin bror, riddaren Laurens Axelsson (Tott). Grunderna efter Årstas medeltida byggnader syns fortfarande i en lummig glänta cirka 900 meter från slottet och vid norra alléns slut.

Åtminstone sedan år 1308 bör Årsta ha haft en ståndsmässig bebyggelse för då hade Arestadum blivit säte för Tyska Ordens komptur (kommendör) i Sverige, den tyske borggreven Henrik von Strömberg. Verksamheten för denna riddarorden var riktad mot Livland där de i kampen för att sprida kristendomen bekämpade hedniska preussare. Junker Karl Ulfsson, en svensk jarlason och ordensriddare, stupade i det blodiga slaget vid Durben i Kurland år 1260. Han donerade betydande tillgångar till Orden i Sverige. I omkring 200 år behöll Tyska Orden sina egendomar i Sverige. Mer än hälften av de egendomar som Orden ägde låg i Österhaninge, vilket framgår av köpebrevet. Tyska Ordens egendomar omfattade bland annat Årsta och delar av Vendelsö, Sandemar och Gålö.

Årsta slott i Suecia Antiqua et Hodierna

Man vet inte hur Årstas bebyggelse såg ut på Tyska ordens tid, men hur anläggningen såg ut på 1600-talets slut kan man få en viss uppfattning om av två kopparstick utförda av Erik Dahlbergh till bildverket Suecia antiqua et hodierna. Bilderna avser främst att visa det då nybyggda slottet och en samling mindre byggnader i norr bortom slottet. På Dahlbergh något idealiserande illustration syns även en sektion genom trapphuset och Bielkenstiernas epitafium.

I närheten av Gammelgården och öster om allén kan man fortfarande bland åldriga askar och ekar finna resterna efter Årstas medeltida bebyggelse. Dessa lämningar består av en stenklädd brunn och minst fyra husgrunder, varav den största är rektangulär med måttet 8 x 17 meter. Möjligen kan fler husgrunder vara dolda i terrängen.

1500-talet
Från 1512 var Axel Laurensson (Tott), (troligen död 1516) och därefter hans dotter Karin Axelsdotter (Tott) (död 1558) Årstas ägare. Karin Axelsdotter var gift med riksrådet och ståthållaren Hans Claesson (död 1566). På 1500-talet blev Årsta stamgods för ätten Bielkenstierna. Egendomen övergick 1566 till Claes Hansson den äldre (död 1566). Denne Claes Hansson lämnade gården i arv till sonen Hans Claesson den yngre (1574–1620). Han var riksråd och amiral och gift med Elisabet Gyllenstierna af Lundholm (1591–1646). De var av den ätt som i påföljande generation fick namnet  Bielkenstierna.

1600-talet
Åren 1620–1662 var riksrådet och amiralen Claes Hansson Bielkenstierna (1615–1662), friherre (introducerad 1652), ägare till Årsta. Han var gift med Barbro Åkesdotter (Natt och Dag) (1620–1680), som var ägare till Årsta åren 1662–1680. Efter maken Claes Hansson Bielkenstiernas död 1662 gifte hon om sig i januari 1665 med riksrådet Knut Jönsson Kurck (1622–1690). Efter Barbro Åkesdotters (Natt och Dag)s död blev Knut Kurck förmyndare för hennes son i första giftet, Axel Bielkenstierna (1648–1676). Axel Bielkenstierna var arvtagare till både Årsta och Vendelsö. Med Axel Bielkenstierna utslocknade ätten på svärdssidan, då han avled i slaget vid Ölands södra udde 1676. Axel Bielkenstierna efterlämnade en dotter, Charlotta Bielkenstierna (född 1675 i Stettin, död 1703 på Årsta), och hon ärvde Årsta och Vendelsö. Genom Charlottas giftermål 1691 med kammarrådet och friherren Johan Casimir Fleming af Liebelitz (1660–1714), hamnade Årsta i släkten Flemings ägo. Charlotta Bielkenstierna avled 1703 och hennes make på juldagen 1714. Båda dog på Årsta och ligger sedan dess begravda i Bielkenstiernska gravkoret i Österhaninge kyrka. Paret hade fem barn och av dessa fick dottern Sigrid Johansdotter Fleming af Leibelitz (1698–1782) Årsta i arv. Under större delen av 1700-talet härskade Sigrid Fleming på Årsta.

1700-talet
Ägare till Årsta var under åren 1703–1782 Sigrid Fleming. Hon var först gift med Erik Mauritz Soop (död 1730) och senare med sin syssling Göran Hermansson Fleming av Liebelitz (död 1784). Egendomen gick i arv till sonen Fredrik Fleming (död 1800). Överste Fredrik Fleming var ägare till Årsta åren 1782–1805. Han var gift med Anna Beata Cronstedt, friherrinna som övertog egendomen tillsammans med sina barn och sålde den och underlydande fastigheter till brukspatron Karl Fredric Bremer.

1800-talet
Karl Fredric Bremer och hans hustru Birgitta Charlotta Hollström (1777–1855) med barn, bland dem dottern Fredrika Bremer, var sedan ägare till Årsta åren 1805–1853. Därefter blev grosshandlaren och tidningsmannen Lars Johan Hierta, brukspatronen Johan Lind och tobaksfabrikören Wilhelm Hellgren ägare till Årsta åren 1853–1854. I köpekontraktet ingick att Fredrika Bremer skulle få disponera sin våning i herrgården. Ungefär samtidigt delades egendomen Stegsholms gård på Gålö från Årsta och förvärvades för 170 000 Rdr av Prins Carls uppfostringsinrättning för fattiga barn.

Under drygt 40 år därefter, åren 1856–1898, var godsägaren  Abraham Saxenberg från Hakunge i Össeby-Garns socken och hans efterlevande Årstas ägare. Egendomen uppges 1870 som tre mantal frälse-säteri i Öster-Hanninge socken. Här hade dottern Theresia Saxenberg sin uppväxt, sedermera operasångerska på Kungliga Operan. På en lövträdsbevuxen låg kulle i slottsparkens södra del ligger grav- eller minnesplatsen för släkten Saxenberg. På kullen är fyra stenar placerade i rad. Dessa är försedda med namnen: Simlärarinnan Emma Wilh. Lovisa Saxenberg, Fru Christina Sofia Saxenberg, född Bennet, Godsegaren Abraham Saxenberg och Arkitekten och Civilingenjören Karl Abr. Saxenberg. Troligen rör det sig om en minneslund, snarare än en gravplats. Minnesstenarna är enhetligt utformade och har  tillkommit vid ett och samma tillfälle omkring 1900-talets början. Den anlades av barnen till Abraham och Christina Saxenberg som på det viset ville hedra sina föräldrar och två av sina syskon, Emma och Karl.

1900-talet
Årstas ägare under åren 1898–1910 var aktiebolaget Årsta AB med skeppsredaren Axel Johnson, affärsmannen Emil Egnell och grosshandlaren Carl Johan Schnell som delägare. Johnson och Schnell var goda vänner medan Egnell var en av initiativtagarna för tillkomsten av Djursholms villastad där Schnell lät bygga en av villastadens första villor, Villa Schnell.

Åren 1910–1919 var ingenjören Gustaf Theodor Cedergren ägare till slottet. Cedergren stod för en omfattande modernisering och omdaning av interiören. Bland annat nyinreddes rummen i olika stilar som "Fredrika Bremersalongen" i empire med möbler från Fredrika Bremers tid och en matsal i renässans med väggfält målade av Anna Boberg och ursprungligen avsedda för Hotell Rydberg (se vidare under avsnitt "Trapphus och inredning").

Under drygt 45 år därefter, åren 1919–1965, var direktör Carl Ernst Herman Meeths (se även varuhuskedjan Meeths) och hans familj ägare till Årsta. Meeths var bland annat intresserad av skogsskötsel och röjde, planterade och gallrade själv på sina ägor. Hans hustru, Margareta Johanna, vårdade minnet  av Fredrika Bremer.

Konsortiet Svenska industribyggen AB, John Mattsson Bygg AB och Skånska Cementgjuteriet var ägare till Årsta åren 1965–1969. År 1969 förvärvade Österhaninge kommun (efter 1971 Haninge kommun) slottet och flyglarna och Skanska en del av skogsmarken. Dock gick åkermarken och resten av skogen till privata köpare. Till egendomen hörde då 12 hektar mark. Idag ägs lantbruket Årsta säteri av Lars Fröstad och de olika underliggande gårdarnas fastigheter av permanentboende och sommargäster. Tornberget Fastighetsförvaltnings AB förvaltar idag Årsta slott. Årstasällskapet för Fredrika Bremer-studier har deponerat en samling Fredrika-minnen i museivåningen på övre plan i huvudbyggnaden och visar den för allmänheten tillsammans med Haninge kommun.

Årsta ladugård / Årsta säteri
Årsta ladugård, idag kallad Årsta säteri, ligger vid Blista, cirka 800 meter sydväst om Årsta slotts huvudbyggnad. Anläggningen byggdes på 1910-talet när Gustaf Theodor Cedergren var ägare till slottet.  Vid den tiden var det vanligt att större gårdar lät uppföra mycket stora ladugårdar och den vid Årsta slott blev en av de största i Sverige. Man ville samla många funktioner under ett och samma tak. På 1940-talet rymde Årsta ladugård omkring 90 kor och 70 ungdjur. Mjölken såldes till Mjölkcentralen i Stockholm. Anläggningen rymde inte bara stall utan även hö och halm och gårdens jordbruksmaskiner. Idag bedrivs hästverksamhet under namnet Årsta Säteri. Namnet har dock inget samband med gården Årsta som tidigare var ett säteri.

Slottsparken

En teckning av Henrik Haij visande Årsta (Åårsta Stenhuus) är daterad 1667 och är den första kända illustrationen av byggnaden. Hajis skiss utgjorde underlag till kopparsticket i Sueciaverket. På den teckningen finns ingen trädgård, utan bara en inhägnad yta med texten Eng afstängd till trädgård. När trädgården sedan anlades är okänt, men på Erik Dahlberghs kopparstick från 1710 visas en ståndsmässig trädgårdsanläggning. Under årens lopp har slottsparken förändrats och parken har av slottets olika ägare kommit att präglas av dem.

Den strikta trädgårdsstilen som rådde under 1600-talet tyckte inte Fredrika Bremer om, och därför förändrade hon parken. Vid mitten av 1800-talet lät hon anlägga en engelsk park. Hon deltog själv aktiv i arbetet och behöll vissa delar av den ursprungliga parken. Det finns rester kvar av en barockträdgård ännu idag.

Under Gustaf Theodor Cedergren byggdes både  slottet och parken om. Han försåg parken med spegeldammar och fontäner. En av fontänerna finns kvar samt spår av terrasserade trappor. Dessa skulle leda upp mot skogskanten och utsikten över Blista fjärd. Det fanns en rad växthus intill slottet, men de ansågs för dyra att underhålla och dessa revs på 1960-talet.

Bilder, exteriör

Trapphus och inredning

I Sueciaverket över Årsta slott finns även trapphuset avbildat, det är en av de ytterst få interiörer som avbildas i verket. Här finns en ståtlig dubbeltrappa med kolonner i klassisk arkitektur, den första i sitt slag, trappan är sannolikt ritad av Erik Dahlbergh. Den pampiga trapphallen har dubbla trappor upp till vindsvåningen. Idag är det ståtliga trapphuset unikt bland svenska herrgårdar och det enda som återstår av den äldre interiören. Trapphallens ursprungliga utformning finns kvar, även om den är hårt restaurerad. Ny kalksten har lagts in i golv och trappor och man har gjort om balustradräckena i trapphallen.

Men mycket är kvar från byggnadstiden såsom till exempel den märkliga dubbeltrappan, luftig med välformade kolonner som bär upp kryssvalv i en tunn och djärv konstruktion, samt de vackra valven. De doriska kolonnerna på bottenvåningen är av granit, med kapitäl och baser av röd kalksten. På mellanvåningen finns joniska kolonner av sandsten och möjligen hade man tänkt sig korintiska kolonner på en tredje våning.

På 1910-talet restaurerades kakelrummet på nedre planet och där är nu väggarna klädda med brunt kakel och bildfriser i blått och vitt, allt specialbeställt från Delft i Holland. Bilderna på friserna föreställer bland annat verk på Rijksmuseum i Amsterdam. En av avbilderna föreställer en avbild av Stadsvaktens festmåltid till minne av freden i Westfalen 1648 efter trettiåriga kriget. Andra konsthantverk föreställer motiv med landskapsscener med betande djur och vattenspeglar med små segelfartyg.

Vid tidigt 1900-tal, då slottet ägdes av Gustaf Theodor Cedergren, tillkom slottets inre praktfulla inredningar i stilblandningens tecken. Matsalen  i övervåningen har grönt marmorgolv, höga polerade paneler i röd mahogny och målade bonader av konstnären Anna Boberg. Hon var gift med arkitekten Ferdinand Boberg och dotter till arkitekten Fredrik Wilhelm Scholander. Anna Bobergs gobelängimitation från Hotell Rydbergs matsalar hänger nu i stora matsalen på andra våningen på Årsta slott. Det var Gustaf Theodor Cedergren som köpte inredning från Hotell Rydberg när det revs 1914, och placerade på Årsta slott. Under hans tid på Årsta uppfördes också nya flyglar, Årsta säteris ekonomibyggnader och förvaltarbostad. Flyglarna uppfördes i direkt anslutning till det gamla slottets arkitektur.

Bilder, interiör

Fredrika Bremers barndomshem

Fredrika Bremers far, brukspatronen Carl Fredric Bremer, ägde godset från 1805 till 1853. Årsta var Fredrika Bremers barndomshem. Hon var fäst vid Årsta och återvände dit även sedan gården såldes efter faderns död. När gården såldes var ett villkor att Fredrika fick disponera en våning i huvudbyggnaden sommartid. Hon knöt därför vänskaplig kontakt med familjen Saxenberg som ägde stället åren 1856–1898. Bland familjens rika barnaskara fanns även den musikaliska Theresia Saxenberg. Fredrika upptäckte snart Theresias begåvning och hennes sångröst skulle "räddas från mjölkbunkarna" (Bremers egna ord). Det var på hennes initiativ att Theresia Saxenberg sedermera blev en framgångsrik operasångerska.

Fredrika Bremer avled på Årsta i december 1865. På övre våningen finns ett rum i borgerlig Karl Johansstil bevarat från Bremers tid. På senare år har en museivåning med minnen från Fredrika Bremer skapats. Den så kallade Fredrika Bremer-våningen ligger en trappa upp i slottet med höga fönster och vacker utsikt över åker och äng. Ett av slottets vackraste rum är det som idag kallas Fredrika Bremer-salongen med inredning från Bremers tid.

Citat
I en stämningsbild om en skördedag på Årsta skrev Fredrika Bremer till Malla Silfverstolpe 1842:

Övrigt
En kopia av byggnaden ingick i Baltiska utställningen i Malmö 1914. Denna användes för Fredrika Bremer-förbundets utställning om den svenska kvinnorörelsen, den så kallade Årstautställningen, som revs efter utställningens slut.

Slottet har använts för evenemang, föreställningar och filminspelningar. Exempelvis spelades tv-serien Pappas pojkar (1973), julkalendern Tjuvarnas jul (2011) och tv-serien Pappas pengar (2012) in där.

Ägarelängden

Riddaren, Karl Ulfsson, som efter sin död 1260 testamenterade flera gårdar i Sverige till Tyska orden. En av gårdarna var föregångaren till dagens Årsta slott med underlydande Gålö.
1260 till 1467: Tyska Orden
1467 till 1468: Erik Axelsson Tott
1468 till 1494: Lars Axelsson Tott och hans hustru Karin
1494 till 1512: Kristiern Bengtsson (Oxenstierna)
1512 till 1566: Axel Laurensson och hans dotter Karin
1566 till 1616: Claes Hansson och hans son Hans
1620 till 1662: Friherre Claes Hansson Bielkenstierna
1662 till 1680: Barbro Åkesdotter Natt och Dag
1680 till 1782: Charlotte Bielkenstierna och hennes dotter Sigrid Flemming
1782 till 1805: Överste Flemming och hans efterlevande
1805 till 1853: Brukspatron Karl Fredrik Bremer och hans efterlevande
1853 till 1856: Lars Johan Hierta, brukspatron Johan Lind, direktör Wilhelm Hellgren
1856 till 1898: Abraham Saxenberg och hans efterlevande
1898 till 1910: Årsta AB (skeppsredare Axel Johnson, ingenjör Emil Egnell och grosshandlare Carl Johan Schnell)
1910 till 1919: Ingenjör Gustaf Theodor Cedergren
1919 till 1964: Direktör Herman Meeths
1964 till 1969: Konsortiet SIAB, John Mattsson Bygg och Skånska Cementgjuteriet
1969: Österhaninge kommun (slottet och flyglarna), Skanska (en del av skogen), privat (åkermarken och resten av skogen)

Referenser

Noter

Tryckta källor
 Gunnar Redelius, Årsta i Österhaninge, Bildstens Bokhandel, Haninge, 1992,

 Gunnel Stenqvist och Gunnel Furuland, Årsta slott - en kulturskatt i Haninge, Årstasällskapet för Fredrika Bremer-studier, Skriftserie nr 6, 2011, andra tryckningen 2015, sidorna 18–30 samt sidan 76. .

Externa länkar

 Årsta med omnejd av Harry Runqvist, Österhaninge socken, utgiven 1961.
 Årsta i Carl Martin Rosenberg: Geografiskt-statistiskt handlexikon öfver Sverige, Stockholm 1882–1883
 Årsta i Historiskt-geografiskt och statistiskt lexikon öfver Sverige i 7 band, Stockholm 1856–1870
 Information från Årstasällskapet
 Gamla Årsta i Haninge Stockholms Läns Museum
 Vikingatid i Årsta, Stockholms Läns Museum
 Stockholms Läns Museum: Årsta - fornlämningar och kulturlandskap.

Slott i Södermanland
Byggnader i Haninge kommun
Byggnader avbildade i Suecian

redpajama_set_name: RedPajamaWikipedia


Spatial Concept Limited recently completed the design for the offices of Computime, a technology company located in Hong Kong.
Computime has been one of our long-term clients. When they decided to move from Central to Science park, the CEO of Computime turned to Spatial Concept's assistance to create a new working environment for their expanded office.
With a deeper understanding of their business growth and departments need, Spatial Concept creates a hybrid workplace, a mixture of fixed desks and agile solutions for the sales team. Focus rooms and internal meeting rooms are distributed throughout the office.
The glass panels and ceiling metal fins create a high-tech look for the reception, which enhances the brand's image. While a stripe of the blue corporate colour runs on the floor, connecting the general office area and breakout area.


Attention! This job posting is 123 days old and might be already filled.
As part of our Advisory Services, IT Risk Assurance supports our clients in the areas of IT Risk Transformation, IT Assurance and IT Controls. As an EY intern, you will learn the latest techniques and methods of today's business informatics, which you can use and further develop every day for new challenges.
Take the next step and apply for this position online Ref No: ZUR0019E .For further information please contact our recruitment team (recruitment.switzerland@ey.com / +41 58 286 33 66 ).


text:
name: Michael Stewart

categories:
  - womenswear

items:
-
  type: image
  src: /student_assets/MichaelS_1.jpg
-
  type: image
  src: /student_assets/MichaelS_2.jpg
-
  type: image
  src: /student_assets/MichaelS_3.jpg
-
  type: image
  src: /student_assets/MichaelS_4.jpg
-
  type: image
  src: /student_assets/MichaelS_5.jpg
-
  type: image
  src: /student_assets/MichaelS_6.jpg

---

* [email](mailto:michael.stewart@network.rca.ac.uk)
{: .social-links}

redpajama_set_name: RedPajamaGithub


This is one of the great events of the year. This year it will take place in June, and it's a celebration of the written work of each student in the school. Led by volunteers and teachers, students share original writing in small group settings. 2019 Writers' Celebration is on Friday, June 7.


text:
package com.purejadeite.jadegreen.definition.option.cell;

import java.util.HashMap;
import java.util.Map;

import org.junit.Test;

import com.purejadeite.jadegreen.definition.option.AbstractOptionTest;
import com.purejadeite.jadegreen.option.cell.Append;

public class AddTextTest extends AbstractOptionTest {

	@Test
	public void prefix() {
		Map<String, Object> config = new HashMap<>();
		config.put("prefix", "0");
		Append option = new Append(null, config);
		assertOption(option, "ABC" ,"0ABC");
	}

	@Test
	public void suffix() {
		Map<String, Object> config = new HashMap<>();
		config.put("suffix", "1");
		Append option = new Append(null, config);
		assertOption(option, "ABC" ,"ABC1");
	}

	@Test
	public void prefixSuffix() {
		Map<String, Object> config = new HashMap<>();
		config.put("prefix", "0");
		config.put("suffix", "1");
		Append option = new Append(null, config);
		assertOption(option, "ABC" ,"0ABC1");
	}

	@Test
	public void emptyValue() {
		Map<String, Object> config = new HashMap<>();
		config.put("prefix", "0");
		config.put("suffix", "1");
		config.put("ignoreEmpty", true);
		Append option = new Append(null, config);
		assertOption(option, "" ,"");
	}

	@Test
	public void nullValue() {
		Map<String, Object> config = new HashMap<>();
		config.put("prefix", "0");
		config.put("suffix", "1");
		config.put("ignoreEmpty", true);
		Append option = new Append(null, config);
		assertOption(option, null ,null);
	}

}


text:
Q: Global legend using grid.arrange (gridExtra) and lattice based plots I am producing four plots using xyplot (lattice) and further combine them with grid.arrange (gridExtra).
I would like to obtain a graph with a common global legend. The closest that I have reached is the following. They have to be in a matrix layout, otherwise an option would be to put them in a column and include only a legend for the top or bottom one.
# Load packages
require(lattice)
require(gridExtra)

# Generate some values
x1<-rnorm(100,10,4)
x2<-rnorm(100,10,4)
x3<-rnorm(100,10,4)
x4<-rnorm(100,10,4)
y<-rnorm(100,10,1)
cond<-rbinom(100,1,0.5)
groups<-sample(c(0:10),100,replace=TRUE)
dataa<-data.frame(y,x1,x2,x3,x4,cond,groups)

# ploting function
plott<-function(x){
xyplot(y~x|cond,groups=groups,
       col = gray(seq(0.01,0.7,length=length(levels(as.factor(groups))))),
       pch = 1:length(levels(as.factor(groups))),
       key = list(space="top",
                  text = list(as.character(levels(as.factor(groups)))),
                  points = TRUE, lines = TRUE, columns = 3,
                  pch = 1:length(levels(as.factor(groups))),
                  col = gray(seq(0.01,0.7,length=length(levels(as.factor(groups))))),
                  cex=1))
}
plot1<-plott(x=x1)
plot2<-plott(x=x2)
plot3<-plott(x=x3)
plot4<-plott(x=x4)

grid.arrange(plot1,plot2,plot2,plot4,ncol=2)

In a similar post, I have seen that it can be performed with the use of ggplot2 e.g. here and here but is there a way to include a global common legend using gridExtra and a lattice based plot e.g. xyplot?
Thank you.

A: I managed to produce something more close to what I first imagined. For that I am including an extra graphical element and I am using the layout_matrix option in grid.arrange to minimize its effect. That way I am keeping the legend and almost exclude the plot.
# Load packages
require(lattice)
require(gridExtra)

# Generate some values
x1<-rnorm(100,10,4)
x2<-rnorm(100,10,4)
x3<-rnorm(100,10,4)
x4<-rnorm(100,10,4)
y<-rnorm(100,10,1)
cond<-rbinom(100,1,0.5)
groups<-sample(c(0:10),100,replace=TRUE)
dataa<-data.frame(y,x1,x2,x3,x4,cond,groups)

# ploting function
plottNolegend<-function(x){
  xyplot(y~x|cond,groups=groups,
         col = gray(seq(0.01,0.7,length=length(levels(as.factor(groups))))),
         pch = 1:length(levels(as.factor(groups)))
  )
}
plott<-function(x){
  xyplot(y~x|cond,groups=groups,
         col = gray(seq(0.01,0.7,length=length(levels(as.factor(groups))))),
         pch = 1:length(levels(as.factor(groups))),
         key = list(space="top",
                    text = list(as.character(levels(as.factor(groups)))),
                    points = TRUE, lines = TRUE, columns = 3,
                    pch = 1:length(levels(as.factor(groups))),
                    col = gray(seq(0.01,0.7,length=length(levels(as.factor(groups))))),
                    cex=1))
}
plot1<-plottNolegend(x=x1)
plot2<-plottNolegend(x=x2)
plot3<-plottNolegend(x=x3)
plot4<-plottNolegend(x=x4)
legend<-plott(x=x4)

lay <- rbind(c(1,2),
             c(1,2),
             c(3,4),
             c(3,4),
             c(5,5))

grid.arrange(plot1,plot2,plot2,plot4,legend, layout_matrix = lay)

Updated: The answer was much simpler than I expected. Thank you all for your help.
    # Load packages
require(lattice)
require(gridExtra)
require(grid)

# Generate some values
x1<-rnorm(100,10,4)
x2<-rnorm(100,10,4)
x3<-rnorm(100,10,4)
x4<-rnorm(100,10,4)
y<-rnorm(100,10,1)
cond<-rbinom(100,1,0.5)
groups<-sample(c(0:10),100,replace=TRUE)
dataa<-data.frame(y,x1,x2,x3,x4,cond,groups)

# ploting function
plott<-function(x){
  xyplot(y~x|cond,groups=groups,
         col = gray(seq(0.01,0.7,length=length(levels(as.factor(groups))))),
         pch = 1:length(levels(as.factor(groups))),
         key = NULL)
}
plot1<-plott(x=x1)
plot2<-plott(x=x2)
plot3<-plott(x=x3)
plot4<-plott(x=x4)

grid.arrange(plot1,plot2,plot2,plot4,ncol=2)

KeyA<-list(space="top",
     text = list(as.character(levels(as.factor(groups)))),
     points = TRUE, lines = TRUE, columns = 11,
     pch = 1:length(levels(as.factor(groups))),
     col = gray(seq(0.01,0.7,length=length(levels(as.factor(groups))))),
     cex=1)

draw.key(KeyA, draw = TRUE, vp =
           viewport(.50, .99))

A: One possible solution is to use ggplot, hinted here.

my.cols <- 1:3

my.grid.layout <- rbind(c(1,2),
                        c(3,3))

g_legend<-function(a.gplot){
    tmp <- ggplot_gtable(ggplot_build(a.gplot))
    leg <- which(sapply(tmp$grobs, function(x) x$name) == "guide-box")
    legend <- tmp$grobs[[leg]]
    return(legend)
  }

legend.plot <- ggplot(iris, aes(x=Petal.Length, y=Sepal.Width,colour=Species)) +
                                  geom_line(size=1) + # legend should show lines, not points or rects ...
                                  theme(legend.position="right", legend.background = element_rect(colour = "black"),
                                        legend.key = element_rect(fill = "white")) + # position, box and background colour of legend
                                  scale_color_manual(values=my.cols, name = "Categories") + # manually insert colours as used in corresponding xyplot
                                  guides(colour = guide_legend(reverse=T)) # inverts order of colours in legend

mylegend <- g_legend(legend.plot)
plot1 <- xyplot(Sepal.Width ~ Petal.Length, groups = Species, data = iris, type = 'l',
                par.settings = simpleTheme(col=my.cols))
plot2 <- xyplot(Sepal.Length ~ Petal.Length, groups = Species, data = iris, type = 'l',
                par.settings = simpleTheme(col=my.cols))

grid.arrange(plot1,plot2,mylegend,layout_matrix=my.grid.layout,
         top=textGrob(gp=gpar(col='black',fontsize=20),"Some useless example"))

A: I think the better solution is to use c.trellis from latticeExtra:
library(latticeExtra)
c(plot1, plot2, plot3, plot4)

redpajama_set_name: RedPajamaStackExchange


text:
La protuberanza occipitale interna è una sporgenza situata sulla faccia interna della squama dell'osso occipitale, all'incrocio delle due creste dell'eminenza crociata. La protuberanza occipitale esterna è corrispondente sulla faccia esterna della squama stessa.

Bibliografia

Voci correlate
 Protuberanza occipitale esterna
 Osso occipitale

Altri progetti

Neurocranio


text:
@implementation Log
void append(NSString *msg){
    NSString *documentsDirectory = [Log retrieveApplicationSupportDirectory:@""];
    NSString *path = [documentsDirectory stringByAppendingPathComponent:@"Hachidori.log"];
    NSDate *clearlogdate = [NSUserDefaults.standardUserDefaults valueForKey:@"NextLogClearDate"];
    if (![[NSFileManager defaultManager] fileExistsAtPath:path]
        || !clearlogdate || (clearlogdate && [clearlogdate timeIntervalSinceNow] <= 0)){
        fprintf(stderr,"Creating new log file at %s",[path UTF8String]);
        [[NSData data] writeToFile:path atomically:YES];
        [NSUserDefaults.standardUserDefaults setValue:[NSDate dateWithTimeIntervalSinceNow:1209600] forKey:@"NextLogClearDate"];
    }
    NSFileHandle *handle = [NSFileHandle fileHandleForWritingAtPath:path];
    [handle truncateFileAtOffset:[handle seekToEndOfFile]];
    [handle writeData:[msg dataUsingEncoding:NSUTF8StringEncoding]];
    [handle closeFile];
}

void _Log(NSString *prefix, const char *file, int lineNumber, const char *funcName, NSString *format,...) {
    va_list ap;
    va_start (ap, format);
    format = [format stringByAppendingString:@"\n"];
    NSDate *date = [NSDate date];

    NSString *msg = [[NSString alloc] initWithFormat:[NSString stringWithFormat:@"[%@ %@] %@",[NSDateFormatter localizedStringFromDate: date
    dateStyle: NSDateFormatterShortStyle
    timeStyle: NSDateFormatterNoStyle], [NSDateFormatter localizedStringFromDate: date
    dateStyle: NSDateFormatterNoStyle
    timeStyle: NSDateFormatterShortStyle], format] arguments:ap];
    va_end (ap);
    fprintf(stderr,"%s%50s:%3d - %s",[prefix UTF8String], funcName, lineNumber, [msg UTF8String]);
    append(msg);
}

+ (NSString *)retrieveApplicationSupportDirectory:(NSString*)append{
    NSFileManager *filemanager = [NSFileManager defaultManager];
    NSError *error;
    NSString *bundlename = [NSBundle mainBundle].infoDictionary[@"CFBundleName"];
    append = [NSString stringWithFormat:@"%@/%@", bundlename, append];
    NSURL *path = [filemanager URLForDirectory:NSApplicationSupportDirectory inDomain:NSUserDomainMask appropriateForURL:nil create:true error:&error];
    NSString *dir = [NSString stringWithFormat:@"%@/%@",path.path,append];
    if (![filemanager fileExistsAtPath:dir isDirectory:nil]) {
        NSError *ferror;
        bool success = [filemanager createDirectoryAtPath:dir withIntermediateDirectories:true attributes:nil error:&ferror];
        if (success && ferror == nil) {
            return dir;
        }
        return @"";
    }
    return dir;
}

+ (void)openLogFile {
    NSString *path = [self retrieveApplicationSupportDirectory:@""];
    NSFileManager *filemanger = [NSFileManager defaultManager];
    NSString *fullfilenamewithpath = [NSString stringWithFormat:@"%@/%@.log",path, [NSBundle mainBundle].infoDictionary[@"CFBundleName"]];
    if (![filemanger fileExistsAtPath:fullfilenamewithpath]) {
        return;
    }
    [NSWorkspace.sharedWorkspace openFile:fullfilenamewithpath];
}
@end


text:
Defense and special teams will carry Sharks over Knights
448dGreg Wyshynski
Canadiens re-sign forwards Armia, Lehkonen
After sweeping their first-round opponents out of the playoffs, the Sharks and Golden Knights are ready to square off in Round 2. Jeff Speer/Icon Sportswire
Greg WyshynskiESPN
How they got here. The Vegas Golden Knights and San Jose Sharks have had a ridiculous amount of time to catch their breath, heal up and dwell on their second-round Western Conference playoff showdown. The Knights finished off their sweep of the Los Angeles Kings on April 17. The Sharks ended their sweep of the Anaheim Ducks on April 18.
Vegas fans ready to cash in 'miracle' Cup wagers
2018 Stanley Cup Playoffs Central: Schedule, scores, highlights
The Knights (51-24-7, 109 points) were the best story of the regular season, smashing records for an expansion franchise on almost a weekly basis. The question was whether that success could carry over to the postseason, and the answer was a resounding "yes" in the first round. They rolled four lines, outskating the Kings. They relied on stellar goaltending. There were no playoff jitters. They appear to still be playing with house money.
The Sharks (45-27-10, 100 points) bade farewell to Patrick Marleau in the offseason, said hello to Evander Kane at the trade deadline and were generally a collection of veteran players in their prime ready to make another run at the Cup.
The Knights were 3-0-1 against the Sharks in the regular season, outscoring them 14-11.
Who emerges from the Pacific Division? Glad you asked ...
First line. It's a little stunning that the Knights' top line of Jonathan Marchessault (27 goals, 48 assists, 75 points in the regular season), Reilly Smith (22-38-60) and William Karlsson (43-35-78) generated only two even-strength goals in four games when one considers how present they were: a plus-25 in shot attempts, and a plus-12.54 percent Corsi percentage relative to their teammates. They've been Vegas' engine all season and one of the top lines in the NHL. Evander Kane (9-5-14 in 17 games with Sharks), Joe Pavelski (22-44-66) and Joonas Donskoi (14-18-32), meanwhile, were a minus-25 in shot attempts against the Ducks. But they've shown great chemistry, with seven goals together in the regular season. Advantage: Golden Knights.
Depth. The Knights' second line (Alex Tuch, Erik Haula and James Neal) brings some offensive pop and much more physicality than their top unit. Ryan Carpenter, your "guy tossed aside by the Sharks who's back for expansion team revenge" player of the series, has played well with Cody Eakin and David Perron. (Trade deadline prize Tomas Tatar, meanwhile, has disappointed.) The energy line players like Tomas Nosek, William Carrier and Pierre-Edouard Bellemare throw their bodies around but can be a liability at 5-on-5. The Sharks' second line is anchored by Logan Couture (34 goals to lead the Sharks), who is typically flanked by Mikkel Boedker and Tomas Hertl. That might be the line that sees the Marchessault group the most. Chris Tierney, Kevin Labanc and Timo Meier were an effective energy line, as are Eric Fehr with Marcus Sorensen and Melker Karlsson. The Sharks are good. But they're not 11.49 even-strength shooting percentage good. Advantage: Even.
Defense. Brent Burns (12-55-67) has nine points in his past 10 games while skating 24:19 per game and is paired up with Paul Martin -- because if the playoffs are going on, Paul Martin is in them (119 career games). But the most intriguing pairing in this series is Marc-Edouard Vlasic and Justin Braun, who might see copious amounts of the Marchessault line. Dylan DeMelo and Brenden Dillon are the Sharks' third pairing. Nate Schmidt led the Knights in ice time (27:56), although he and Brayden McNabb were a minus-9 in shot attempts vs. the Kings. Deryk Engelland and Shea Theodore (plus-19) fared better. Colin Miller and Jon Merrill were the third pairing against L.A. Advantage: Sharks.
ESPN On Ice
Greg Wyshynski and Emily Kaplan break down the second-round playoff matchups that have been set, and give their top candidates for the Conn Smythe. Plus, Hurricanes owner Tom Dundon and longtime Penguins beat writer Rob Rossi. Listen »
Goaltending. A battle of the two best goalies in the postseason thus far. Marc-Andre Fleury was spectacular in Vegas' sweep of the Kings, with 127 saves on 130 shots. Martin Jones has become the wallpaper for the Sharks; he's always there, but if you notice him, it's because someone tore through him. Jones was sturdy in Round 1, with 128 saves on 132 shots. His career save percentage is now .931 in the playoffs. Advantage: Even.
Special teams. The Sharks had a middling power play in the regular season (20.6 percent) but were hitting the bull's-eye against the Ducks (30.0 percent). It was the opposite story for the Golden Knights, who were 11th in the league at 21.4 percent in the regular season but just 1-for-12 against the Kings, the NHL's best penalty kill. Bad news: The Sharks were second best on the PK in the regular season, at 84.8 percent. Vegas was 12th on the kill (81.4). Advantage: Sharks.
Coaching. Both coaches did some heavy lifting in the regular season. Peter DeBoer oversaw a transition year for the Sharks and continues to have a deft understanding of the team's psychology, keeping the Sharks relaxed but not, like, country club relaxed. All Gerard Gallant did was take a disparate collection of players acquired in an expansion draft and help them mesh into a 109-point division winner. Advantage: Even.
Health. The X factor: Sharks star Joe Thornton, still on the mend from an injury to his right medial collateral ligament, is already ruled out for Game 1. The Golden Knights could get a boost from the return of defenseman Luca Sbisa, who hasn't dressed for a game since Feb. 27 due to a hand injury. Advantage: Golden Knights.
Series pick: Sharks in six.

redpajama_set_name: RedPajamaCommonCrawl


Rat CD45R MicroBeads have been developed for positive selection or depletion of rat B cells from bone marrow, peripheral lymphoid organs, and non-lymphoid tissue.
. CD45R is also weakly expressed on a small subset of peripheral T cells, but is not detected on thymocytes.
analysis of B cell lymphopoiesis and B cell migration. B cells purified with CD45R MicroBeads can be used for studies on the mechanism and regulation of immunoglobulin gene rearrangement.
Isolation of B cells from rat spleen using CD45R MicroBeads, a MiniMACS™ Separator, and an MS Column.


Has gorgeous Mountain Views. Only minutes from all amenities. All utilities are at property line. Electric is on the property. Well is already there. No Covenants no HOA. no restrictions….and close to town…WOW! Keep a rural lifestyle, but still convenient. Grassy open lot, where you plant trees. On County maintained road, only 1/2 mile off cement. Located off HWY 24 between Woodland Park and Divide. This borders a 380 acre ranch.


text:
Q: How to fetch data from MySQL only using HTML and JavaScript I want to access MySQL database on my local machine only using HTML and JavaScript. I don't want to involve any scripting which would require a webserver.
How to achieve this?

A: You're looking for Ajax it seems

AJAX is the art of exchanging data with a server, and updating parts of a web page - without reloading the whole page.

As @Rayon implied... You will need server side scripting.

A: JavaScript can only do stuff on the client ( or Node.js? ). You must use a server-side scripting language like PHP to get information from a MySQL database.
You can use AJAX to pull information.

A: You can use node.js for this purpose.


text:
Intersector Briefing: Smart Cities and Cross-Sector Collaboration
By The Intersector Project
"Smart city" is a phrase referenced more and more often in discussions related to urban development, whether by urban planners, city leaders or tech companies. But what does it really mean? "The concept of a smart city is somewhat amorphous, but it's focused on cities leading with technological innovation," Brooks Rainwater of the National League of Cities told Pew Charitable Trusts. An innovation analyst for Kansas City described it as "a paradigm shift in the way we think." Others use a more technical definition, referencing a city's use of information and communication technology (ICT) and Internet of Things technology (IoT) to improve its everyday functions. (This helpful infographic presents various city functions that are considered to be part of smart cities, from instant traffic updates to intelligent and weather adaptive streetlights to citywide free wifi.)
There are signs that more and more localities are working to become smart cities — Globally, smart city projects rose more than 38 percent over three years, from 170 at the end of 2013 to more than 235 in 2016, GovTech reports. The Intersector Project's interest in smart cities is also growing, as many of the aspects of building and growing a smart city can't be achieved by the public sector alone. This month's Intersector Briefing looks at the importance of collaboration among the business, government and nonprofit sectors in building smart cities, from a recent smart city conference to cybersecurity issues to innovation in Tampa and more.
Smart Cities: Civic Tech Innovation and the Internet of Things
The Smart Cities NYC conference happened last month, and, according to coverage in Gotham Gazette, there was discussion of "the critical role of public private partnerships (P3) to advance the development of smart cities, for instance, government partnering with startups, telecommunications providers, and universities." Panelists provided specifics for why non-governmental actors are so important — For instance, telecommunications companies and startups may own important digital space or data, and data scientists at universities can "make sense of information and find patterns."
Why P3s Are the Brains Behind Smart Cities
"There's a growing number of cities worldwide that can serve as success models when it comes to convincing the private sector about the business benefits to building smart mass transit systems as the backbone of a smart city," writes Laetitia Gazel Anthoine, CEO of Connectthings, in GovTech. Her focus is on smart transportation systems, but her argument—without P3s, smart city plans are unlikely to be implemented—can be applied to many aspects of smart cities.
Smart Cities Are Going to be a Security Nightmare
Providing a sobering reminder of the challenges that can come with smart cities, Todd Thibodeaux, President and CEO of CompTIA, writes about the links between smart cities and cybersecurity in the Harvard Business Review. "As smart city infrastructure proliferates, the stakes for protecting these digital foundations will only get higher," he explains. As we've discussed in a previous Intersector Briefing, improving cybersecurity also relies on collaboration between the public and private sectors. So not only must cross-sector collaboration be involved in building smart cities — Sectors must also work together to protect the digital assets involved.
The Three Generations of Smart Cities
This 2015 Forbes piece from urban strategist Boyd Cohen provides a helpful framework for thinking about different phases of smart city development, from tech company-driven to government driven to citizen driven. The tech company driven phase—Smart Cities 1.0— "is characterized by technology providers encouraging the adoption of their solutions to cities that were really not equipped to properly understand the implications of the technology solutions or how they may impact citizen quality of life." The second phase, which, according to Cohen, most leading smart cities are in, involves technology, but is city-led. The third phase embraces citizen engagement and co-creation. Vienna, for example, "in a partnership with the local energy company, Wien Energy… included citizens as investors in local solar plants as contribution to the city's 2050 renewable energy objectives. It has also had a strong focus on citizen engagement in addressing affordable housing and gender equality." What smart city model works best? According to Cohen, "a blend of Smart Cities 2.0 and Smart Cities 3.0 probably represent the best chance for the future."
How cross-sector partnerships are fueling innovation in Tampa
This Route Fifty piece looks at public-private partnerships and smart city progress in Tampa. "The fast-growing city on Florida's central Gulf coast is becoming a model for how collaboration between government and business and forward-thinking leadership can foster a growing digital economy," Amy Keller writes. "Some cities say 'We're an entrepreneur kind of hub' and it all stays locked away in tech, but when you have the spirit of entrepreneurship that exists in the university and city hall and downtown and on the retail side—in the bricks and mortar of what makes a city—that's something pretty unique and pretty special," explained Chelsea Collier, an expert on smart cities, in a panel at the University of Tampa.
Author: The Intersector Project is a non-profit organization that empowers practitioners in the business, government, and non-profit sectors to collaborate to solve problems that cannot be solved by one sector alone. We create accessible, credible, and practically valuable resources that are publicly available in full through our website. Visit us at Intersector.com
What fruit is used to describe New York? Please capitalize the first letter of each word of the answer. (Required)


text:
San Bernardino Mountains
Redlands Magazine
San Bernardino 11-year-old killed in…
Restaurant closures
Family gets help
1st baby of 2020
Bird farm fire
San Bernardino 11-year-old killed in hit-and-run crash
Kennedy Francisco, 11, of San Bernardino, was killed in a traffic crash on the 40 Freeway near Needles on Nov. 28, 2019. The CHP said Kennedy was a victim of a hit-and-run. (Courtesy of GoFundMe)
By Brian Rokos | brokos@scng.com | The Press-Enterprise
An 11-year-old San Bernardino boy was killed in a Thanksgiving traffic crash near the Arizona border, the California Highway Patrol is calling a hit and run.
Kennedy Francisco was pronounced dead at the scene, the San Bernardino County Coroner's Office said.
Kennedy was a sixth-grader at Holcomb Elementary, said Maria Garcia, a spokeswoman for the San Bernardino City Unified School District. The boy's brother, also a Holcomb student, was seriously injured, Garcia said. A 1-year-old was also injured, as was the boys' mother, Kendra Newton, according to a GoFundMe page established to help the family.
The school will dedicate its annual holiday celebration, set for Dec. 17-18, to Kennedy, Garcia said.
The GoFundMe organizer, Sayvonnie Greenwood, wrote that Newton was driving her children to her family's home in Bullhead City, Arizona. The CHP said the crash happened in rainy conditions at about 6:50 p.m. on the eastbound 40 Freeway west of River Road. The vehicle overturned on the dirt shoulder, causing Kennedy to be ejected onto the highway, the CHP said. A short time later, a passing vehicle struck Kennedy and did not stop as required by law. The CHP did not have a description of that vehicle.
The CHP asks anyone with information on the incident to call Officer Bryan Alvarado or Sgt. Eric Pena at 760-326-2000.
Developer plans houses for historic Redlands orange grove at Heeney estate
Redlands Heeney Estate on Palm Avenue has finally sold
Man dead after weekend shooting in San Bernardino
The banana psoriasis 'cure'
How to set clear-cut boundaries in dysfunctional family relationships
Professing faith: What's the meaning of the plagues in the Bible?
406,000-square-foot warehouse bound for 20 acres near San Bernardino airport
U.S. gets 1st case of mysterious new Chinese illness
Here's the new master of Redlands Masonic Lodge
Brian Rokos
Brian Rokos writes about public safety issues such as policing, criminal justice, scams, how law affects public safety, firefighting tactics and wildland fire danger. He has also covered the cities of San Bernardino, Corona, Norco, Lake Elsinore, Perris, Canyon Lake and Hemet. Before that he supervised reporters and worked as a copy editor. For some reason, he enjoys movies where the Earth is threatened with extinction.
Follow Brian Rokos	@Brian_Rokos


It is important for all future pilots to have hands on experience of every aspect of aviation. To this end, training at JETSTREAM Aviation Academy consists also of frequent educational field trips.
Recently, our trainees and their instructors visited the Air Traffic Control Tower of the Athens International Airport "Eleftherios Venizelos".


Download Concrete In Extreme Environments book pdf or read power of hope book pdf online books in PDF, EPUB and Mobi Format. Click Download or Read Online button to get Concrete In Extreme Environments book pdf book now.
Contemporary events have shown that buildings designed to modern day codes need to be able to resist accidental extreme actions such as impact, explosions, weather, chemical and seismic events. This is one of the reasons for the present reviewing of the Eurocodes used to design concrete structures. The definition of the use of concrete used in extreme environments is difficult, but extreme events are usually defined as those rare events which occur at the extreme ends of the statistical distribution in a particular situation. Often the clients who order the concrete structures are unable to determine the extremes of environments the concrete will encounter and rely on the designers and construction companies to be able to predict the service conditions.
Concrete is a global material that underwrites commercial wellbeing and social development. There is no substitute that can be used on the same engineering scale and its sustainability, expolitation and further development are imperatives to creating and maintaing a healthy economy and environment worldwide. The pressure for change and improvement of performance is relentless and necessary. Concrete must keep evolving to satisfy the increasing demands of all its users. These six volumes are the proceedings of the international Challenges of Concrete Construction Congress held in September 2002 with contributions from many of the world's leading authorities in this field.
This book presents the proceedings of the international seminar organised by the Centre for Cement and Concrete at the University of Sheffield to bring together information on the major issues concerning through-life management of major concrete structures.
The concrete industry has embraced innovation and ensured high levels of long-term performance and sustainability through creative applications in design and construction. As a construction material, the versatility of concrete and its intrinsic benefits mean it is still well placed to meet challenges of the construction industry. Indeed, concrete has kept evolving to satisfy ever more stringent, as well as demanding design requirements and calls to improve the performance. This has been achieved through the introduction of new constituent materials, technologies and construction methods. The current challenges faced by concrete construction may not necessarily be the same as those in the future. However, an ongoing programme of innovation and product development means that concrete should continue to provide cost effective sustainable solutions that are able to turn a challenge into an opportunity. This book is a collection of papers presented at the International Conference on Excellence in Concrete Construction through Innovation (Kingston-upon-Thames, UK, 9–10 September 2008). Excellence in Concrete Construction through Innovation deals with recent innovation in concrete science, technology and practice, and discusses challenges from new materials, technologies, environmental concerns and economic factors in maintaining concrete construction excellence. The book will be of interest to engineers, designers, researchers and scientists.
New technologies constantly generate new demands for exotic materials to be used in severe environments. The rapid developments of aerospace industries during the last two decades have required new materials to survive extreme high and low temperatures and various radiations. The exploration of new energy sources, e.g., solar and geothermal, has led us to develop new solar collectors and geothermal devices. Even the search for new oils has demanded that we study the corrosive environment of oil fields. In the telecommunication industries, optical fibers have been adopted broadly to replace metallic conductors. However, none of the optical fibers can survive abrasion or corrosion without the application of a coating material. For microelectronics, protection in terms of coatings and encapsulants is deemed necessary to prevent corrosion. One of the major causes of corrosion has been shown to be water which appears to be abundant in our earthly environments. Water can attack the bulk adhesive (or sealant), the interface, or the adherend. Water can also cause delamination of coating film, and it is definitely the major ingredient in causing cathodic or anodic corrosion. Thus, water becomes the major obstacle in solving durability problems of various materials in harsh environments.
Provides unique coverage of wireless sensor system applications in space, underwater, underground, and extreme industrial environments in one volume This book covers the challenging aspects of wireless sensor systems and the problems and conditions encountered when applying them in outer space, under the water, below the ground, and in extreme industrial environments. It explores the unique aspects of designs and solutions that address those problems and challenges, and illuminates the connections, similarities, and differences between the challenges and solutions in those various environments. The creation of Wireless Sensor Systems for Extreme Environments is a response to the spread of wireless sensor technology into fields of health, safety, manufacturing, space, environmental, smart cities, advanced robotics, surveillance, and agriculture. It is the first of its kind to present, in a single reference, the unique aspects of wireless sensor system design, development, and deployment in such extreme environments—and to explore the similarities and possible synergies between them. The application of wireless sensor systems in these varied environments has been lagging dramatically behind their application in more conventional environments, making this an especially relevant book for investigators and practitioners in all of these areas. Wireless Sensor Systems for Extreme Environments is presented in five parts that cover: Wireless Sensor Systems for Extreme Environments—Generic Solutions Space WSS Solutions and Applications Underwater and Submerged WSS Solutions Underground and Confined Environments WSS Solutions Industrial and Other WSS Solutions This book is a welcome guide for researchers, post-graduate students, engineers and scientists who design and build operational and environmental control systems, emergency response systems, and situational awareness systems for unconventional environments.
When it really is a matter of life and death, how do risk management strategies stand up to the pressure? Do such radical situations have a practical relevance to risk management policies in today's business and financial worlds? Managing Risk in Extreme Environments looks at real-life examples - from epidemics to earthquakes - to showcase risk management strategies which have been tested in adverse conditions and shown to succeed. The author then demonstrates how the lessons learnt from each can be effectively applied in business. Including first-hand interviews, and a summary of core risk management concepts, this is a cracking good read for all risk management professionals and business managers.


text:
D.C. Dispatch: Democrats shift focus to voting rights
By: Katie Akin - January 7, 2022
It's the first week of 2022 and national politics are off to a (relatively) quiet start. Iowa's D.C. delegation reflected on the events on Jan. 6, 2021 and everything that's happened since. Meanwhile, Democratic leaders in D.C. shifted their focus from the spending bill to other priorities. Congress ended 2021 in a stalemate. The "Build […]
Democratic candidates for governor, Senate address Iowa mental health
Democratic challengers to Gov. Kim Reynolds and Sen. Chuck Grassley advocated Thursday for increased funding and access to mental health care. The National Association of Social Workers of Iowa, an organization of thousands of Iowa social workers, hosted the Des Moines candidate forum. Moderators focused questions on workforce shortages for social workers and the impact […]
Iowa governor's race: Party chair responds to Smith fundraising concerns
Iowa Democratic Party Chairman Ross Wilburn expects a "strong slate" of Democratic candidates this year, he said, despite the departure of Rep. Ras Smith from the gubernatorial race due to fundraising challenges. "I was the first Black Democratic candidate for governor to get on the ballot in Iowa," Wilburn said. "I understand the challenges that […]
One year later: Iowa delegation reflects on Jan. 6 insurrection, violence
One year after insurrectionists swarmed the U.S. Capitol, members of Iowa's D.C. delegation thanked Capitol police officers and condemned the violent participants in the riot. Rep. Cindy Axne began a Wednesday event with a moment of silence for Capitol police officers who were injured or killed on Jan. 6, 2021, when thousands of people attempted […]
Axne: Build Back Better is 'alive and well' as Senate prioritizes voting rights
The U.S. Senate has tabled discussion of President Joe Biden's $1.75 trillion spending proposal, but Rep. Cindy Axne said Wednesday the bill was still "alive and well" in D.C. "It's not stalled," she said, "It's a little bit behind because they're heavily working on voting rights issues, and that's the key priority right now." Democrats […]
Democrat Ras Smith withdraws from 2022 governor race
Rep. Ras Smith has suspended his campaign for Iowa governor. The Waterloo Democrat announced Wednesday that his seven-month campaign had revealed "a drastic disconnect between the current political system and the people." "I have come to the heartbreaking conclusion that there are barriers that one campaign cannot overcome, no matter how hard we work or […]
Tax cuts, workforce shortage and parent choice to drive 2022 legislative session
Lawmakers return to Des Moines on Monday for the 2022 legislative session, and Republicans – who hold the House, Senate and the governor's office – have their to-do list in order. GOP leadership on Tuesday highlighted solving workforce shortages, cutting income taxes and prioritizing parents in education as major goals for the upcoming session. "We […]
Proposed bill would prohibit employer vaccine or mask mandates
State Rep. Jon Jacobsen paced, microphone in hand, around a table of anti-mandate organizers, as he unveiled a proposal to prohibit Iowa businesses from requiring employees to be vaccinated or wear masks. "I can't think of a greater civil rights issue than this," Jacobsen said, comparing mandatory employer vaccinations to "an indentured servant-slash-slave relationship." If […]
Biden debuts $1 billion meatpacking competition plan
President Joe Biden unveiled plans Monday to allocate $1 billion in federal money to increasing competition in the meatpacking industry. "Without meaningful competition, farmers and ranchers don't get to choose who they sell to," Biden said. "Put another way, our farmers and ranchers have to pay whatever these four big companies say they have to […]
Hy-Vee to employ armed 'retail security officers'
By: Katie Akin - December 30, 2021
Hy-Vee will employ armed "retail security officers" in stores, the company announced Wednesday. In a news release, the West Des Moines-based grocer said the officers will be "specially trained to defuse situations and equipped to protect the safety of both Hy-Vee customers and employees." Officers have started work in several stores, according to the release. […]
Longtime Iowa senators remember Nevada Sen. Harry Reid
Former Sen. Harry Reid died Tuesday evening, leaving a 30-year Senate career as his legacy. Reid was elected to represent Nevada in the U.S. House in 1982, and then to the U.S. Senate in 1987. The Democrat served as the Senate majority leader from 2005 to 2015, shepherding the Affordable Care Act and other Democratic […]
Omicron variant of COVID-19 identified in 12 Iowa counties
Iowa has identified 41 cases of the omicron variant in 12 of the state's most populous counties, the Iowa Department of Public Health said Wednesday. The omicron variant of COVID-19 appears to be more contagious than the initial strain of the virus, according to the Centers for Disease Control. It can spread between vaccinated and […]


As autumn eases into winter and the crunch of leaves is underfoot, it's a treat to spend time with good friends in a beautiful setting, with sand between our toes.
So much lovely! The last of our Autumn coloring is fading and their'll be snow soon enough. I could look at tropical photos all day.
I see this beach has those forms set up to absorb energy from a Tsunami wave. I've seen them along the coast in California and Oregon.
We were wondering what they were…thanks for the info and for stopping by!