text:
#include "em3d.h"
#include "make_graph.h"

#if defined(SIMICS)
#include <simics/magic-instruction.h>
#endif

extern int NumNodes;

int DebugFlag;

void print_graph(graph_t *graph, int id)
{
  node_t *cur_node;
  cur_node=graph->e_nodes[id];

  for(; cur_node; cur_node=cur_node->next)
    {
      chatting("E: value %f, from_count %d\n", *cur_node->value,
	       cur_node->from_count);
    }
  cur_node=graph->h_nodes[id];
  for(; cur_node; cur_node=cur_node->next)
    {
      chatting("H: value %f, from_count %d\n", *cur_node->value,
	       cur_node->from_count);
    }
}

extern int nonlocals;

int main(int argc, char *argv[])
{
  int i;
  graph_t *graph;

  dealwithargs(argc,argv);

#if !defined(SIMICS)
  chatting("Hello world--Doing em3d with args %d %d %d %d\n",
           n_nodes,d_nodes,local_p,NumNodes);
#endif

  graph=initialize_graph();

  if (DebugFlag)
    for(i=0; i<NumNodes;i++)
      print_graph(graph,i);

  compute_nodes(graph->e_nodes[0]);
  compute_nodes(graph->h_nodes[0]);

#if !defined(SIMICS)
  chatting("nonlocals = %d\n",nonlocals);
#endif

  printstats();

  return 0;

}


text:
Database and queries for UK STATS19 traffic collision data using MySQL. This is based on [Philip Shore's stat19 project](https://github.com/pshore/stats19) but adapted for MySQL rather than PostGIS.

This project creates a MySQL spatial database of the UKs STATS19 road casualty data (accidents, casualties and vehicles). For more information about STATS19 see here: https://www.gov.uk/government/collections/road-accidents-and-safety-statistics

# Instructions
## Download the data from data.gov.uk
The STATS19 datasets can be downloaded from data.gov.uk here: https://data.gov.uk/dataset/road-accidents-safety-data You can now (as January 2016) download all data from 2005 to 2014 in one file. This is the one you want.

Unzip the files (Accidents0514.csv, Casualties0514.csv and Vehicles0514.csv) into /data/core-tables.

## Run queries to create the database

Run each of these in order.

1. MySQL queries for for creating the MySQL database and tables are in /sql/Create Tables.sql

2. Queries importing data are in /sql/Populate Tables.sql, you will need to update the path for each of the files to the project directory

3. For creating views are in /sql/Create Views.sql

## Query the data
Examples of queries are in /sql/Example queries.sql

If you need to get a MySQL server set up quickly on Windows then [XAMPP](https://www.apachefriends.org) will help you (although they've switched to MariaDB recently, it should be compatable)

I recommend the [MySQL Workbench](https://www.mysql.com/products/workbench/) tool for running these queries.

The database includes geometry data so GIS packages that support MySQL databases like [QGIS](http://www.qgis.org/) will be able to import and display the data easily.

redpajama_set_name: RedPajamaGithub


text:
using namespace std;
using namespace ngraph;

std::string ngraph::to_cplusplus_sourcecode_literal(bool val)
{
    return val ? "true" : "false";
}

void ngraph::dump(ostream& out, const void* _data, size_t _size)
{
    auto flags = out.flags();
    const uint8_t* data = reinterpret_cast<const uint8_t*>(_data);
    size_t len = _size;
    size_t index = 0;
    while (index < len)
    {
        out << std::hex << std::setw(8) << std::setfill('0') << index;
        for (int i = 0; i < 8; i++)
        {
            if (index + i < len)
            {
                out << " " << std::hex << std::setw(2) << std::setfill('0')
                    << static_cast<uint32_t>(data[i]);
            }
            else
            {
                out << "   ";
            }
        }
        out << "  ";
        for (int i = 8; i < 16; i++)
        {
            if (index + i < len)
            {
                out << " " << std::hex << std::setw(2) << std::setfill('0')
                    << static_cast<uint32_t>(data[i]);
            }
            else
            {
                out << "   ";
            }
        }
        out << "  ";
        for (int i = 0; i < 16; i++)
        {
            char ch = (index + i < len ? data[i] : ' ');
            out << ((ch < 32) ? '.' : ch);
        }
        out << "\n";
        data += 16;
        index += 16;
    }
    out.flags(flags);
}

std::string ngraph::to_lower(const std::string& s)
{
    std::string rc = s;
    std::transform(rc.begin(), rc.end(), rc.begin(), ::tolower);
    return rc;
}

std::string ngraph::to_upper(const std::string& s)
{
    std::string rc = s;
    std::transform(rc.begin(), rc.end(), rc.begin(), ::toupper);
    return rc;
}

string ngraph::trim(const string& s)
{
    string rc = s;
    // trim trailing spaces
    size_t pos = rc.find_last_not_of(" \t");
    if (string::npos != pos)
    {
        rc = rc.substr(0, pos + 1);
    }

    // trim leading spaces
    pos = rc.find_first_not_of(" \t");
    if (string::npos != pos)
    {
        rc = rc.substr(pos);
    }
    return rc;
}

vector<string> ngraph::split(const string& src, char delimiter, bool do_trim)
{
    size_t pos;
    string token;
    size_t start = 0;
    vector<string> rc;
    while ((pos = src.find(delimiter, start)) != std::string::npos)
    {
        token = src.substr(start, pos - start);
        start = pos + 1;
        if (do_trim)
        {
            token = trim(token);
        }
        rc.push_back(token);
    }
    if (start <= src.size())
    {
        token = src.substr(start);
        if (do_trim)
        {
            token = trim(token);
        }
        rc.push_back(token);
    }
    return rc;
}

size_t ngraph::hash_combine(const std::vector<size_t>& list)
{
    size_t seed = 0;
    for (size_t v : list)
    {
        seed ^= v + 0x9e3779b9 + (seed << 6) + (seed >> 2);
    }
    return seed;
}

void* ngraph::ngraph_malloc(size_t size)
{
    auto ptr = malloc(size);
    if (size != 0 && !ptr)
    {
        NGRAPH_ERR << "malloc failed to allocate memory of size " << size;
        throw std::bad_alloc();
    }
    return ptr;
}

void ngraph::ngraph_free(void* ptr)
{
    if (ptr)
    {
        free(ptr);
    }
}

size_t ngraph::round_up(size_t size, size_t alignment)
{
    if (alignment == 0)
    {
        return size;
    }

    size_t remainder = size % alignment;
    if (remainder == 0)
    {
        return size;
    }

    return size + alignment - remainder;
}

ngraph::FpropCache ngraph::cache_fprop(std::shared_ptr<ngraph::Function> fprop,
                                       std::shared_ptr<ngraph::Function> bprop)
{
    using namespace ngraph;

    // Create a fprop_cache object to store the results of this analysis
    FpropCache fprop_cache;

    // Traverse bprop to find all of the nodes in the bprop graph
    std::set<Output<Node>> in_bprop;
    ngraph::traverse_nodes(bprop, [&in_bprop](std::shared_ptr<Node> node) {
        for (auto value : node->outputs())
        {
            in_bprop.insert(value);
        }
    });

    // Traverse fprop to make a map that stores parameters with the same
    // shape and element type as the nodes in fprop iff they are in bprop
    // and aren't inputs to bprop
    OutputVector bprop_inputs;
    for (auto param : bprop->get_parameters())
    {
        bprop_inputs.push_back(param);
    }
    ngraph::traverse_nodes(
        fprop, [&fprop_cache, &in_bprop, &bprop_inputs](std::shared_ptr<Node> node) {
            for (auto value : node->outputs())
            {
                if (in_bprop.count(value) != 0 &&
                    std::find(bprop_inputs.begin(), bprop_inputs.end(), value) ==
                        bprop_inputs.end())
                {
                    fprop_cache.node_param_map[value] = std::make_shared<op::v0::Parameter>(
                        value.get_element_type(), value.get_shape());
                }
            }
        });

    // clone the nodes in bprop, replacing fprop-related nodes with the
    // intermediate parameters from fprop_cache. This breaks connections in the
    // bprop graph such that only intermediate values from fprop needed by bprop
    // are still connected to the bprop graph as parameters
    ngraph::clone_nodes(bprop->get_ops(), fprop_cache.node_param_map);

    // invert the fprop_cache cloned node map for easy back and for acces.
    std::map<Output<Node>, RawNodeOutput> inverted_node_map;
    for (auto kv : fprop_cache.node_param_map)
    {
        inverted_node_map[kv.second] = kv.first;
    }

    // get cloned bprop results
    ResultVector cloned_results;
    NodeVector result_nodes;
    for (auto node : bprop->get_results())
    {
        auto result = as_type_ptr<op::v0::Result>(
            fprop_cache.node_param_map.at(Output<Node>(node)).get_node_shared_ptr());
        if (!result)
        {
            throw ngraph_error(
                "Expected op::v0::Result values for op::v0::Result keys in node_param_map");
        }
        cloned_results.push_back(result);
        result_nodes.push_back(result);
    }

    // Utility for getting bprop parameters with fprop cache.
    auto get_bprop_params = [&bprop_inputs, &fprop_cache]() {
        // get cloned bprop parameters
        ParameterVector bprop_input_params;
        for (auto param : bprop_inputs)
        {
            bprop_input_params.push_back(as_type_ptr<op::v0::Parameter>(
                fprop_cache.node_param_map.at(Output<Node>(param)).get_node_shared_ptr()));
        }

        // add the cached fprop nodes as inputs to bprop
        for (auto x : fprop_cache.fprop_output_nodes)
        {
            bprop_input_params.push_back(as_type_ptr<op::v0::Parameter>(
                fprop_cache.node_param_map.at(x).get_node_shared_ptr()));
        }
        return bprop_input_params;
    };

    // Traverse the graph from the cloned results of bprop. If we find a parameter
    // that's not an original input of bprop, this is an intermediate value of
    // fprop that needs to be returned from fprop and send to bprop
    auto cloned_bprop_inputs = get_bprop_params();
    ngraph::traverse_nodes(
        result_nodes,
        [&cloned_bprop_inputs, &fprop_cache, &inverted_node_map](std::shared_ptr<Node> node) {
            auto pnode = as_type_ptr<op::v0::Parameter>(node);
            if (pnode && std::find(cloned_bprop_inputs.begin(), cloned_bprop_inputs.end(), pnode) ==
                             cloned_bprop_inputs.end())
            {
                fprop_cache.fprop_output_nodes.push_back(inverted_node_map.at(Output<Node>(node)));
            }
        });

    // create the new outputs for fprop and the new fprop function
    ResultVector fprop_outputs = fprop->get_results();

    for (auto fpirn : fprop_cache.fprop_output_nodes)
    {
        if (as_type_ptr<op::v0::Result>(fpirn.node->shared_from_this()))
        {
            throw ngraph_error("Unexpected op::v0::Result in fprop->get_results()");
        }
        fprop_outputs.push_back(std::make_shared<op::v0::Result>(fpirn));
    }

    fprop_cache.fprop = std::make_shared<Function>(fprop_outputs, fprop->get_parameters());

    // Create the new bprop function with cloned results and cached parameters.
    fprop_cache.bprop = std::make_shared<Function>(cloned_results, get_bprop_params());

    return fprop_cache;
}

size_t stopwatch::get_call_count() const
{
    return m_total_count;
}

size_t stopwatch::get_seconds() const
{
    return chrono::duration_cast<chrono::seconds>(get_timer_value()).count();
}

size_t stopwatch::get_milliseconds() const
{
    return chrono::duration_cast<chrono::milliseconds>(get_timer_value()).count();
}

size_t stopwatch::get_microseconds() const
{
    return chrono::duration_cast<chrono::microseconds>(get_timer_value()).count();
}

size_t stopwatch::get_nanoseconds() const
{
    return get_timer_value().count();
}

chrono::nanoseconds stopwatch::get_timer_value() const
{
    if (m_active)
    {
        return (m_clock.now() - m_start_time);
    }
    else
    {
        return m_last_time;
    }
}

size_t stopwatch::get_total_seconds() const
{
    return chrono::duration_cast<chrono::seconds>(m_total_time).count();
}

size_t stopwatch::get_total_milliseconds() const
{
    return chrono::duration_cast<chrono::milliseconds>(m_total_time).count();
}

size_t stopwatch::get_total_microseconds() const
{
    return chrono::duration_cast<chrono::microseconds>(m_total_time).count();
}

size_t stopwatch::get_total_nanoseconds() const
{
    return m_total_time.count();
}

namespace ngraph
{
    template <>
    float parse_string<float>(const std::string& s)
    {
        const char* tmp = s.c_str();
        char* end;
        float result = strtof(tmp, &end);
        if (*end != 0)
        {
            throw std::runtime_error("Could not parse literal '" + s + "'");
        }
        return result;
    }

    template <>
    double parse_string<double>(const std::string& s)
    {
        const char* tmp = s.c_str();
        char* end;
        double result = strtod(tmp, &end);
        if (*end != 0)
        {
            throw std::runtime_error("Could not parse literal '" + s + "'");
        }
        return result;
    }

    template <>
    int8_t parse_string<int8_t>(const std::string& s)
    {
        char* err;
        int8_t result = strtol(s.c_str(), &err, 10);

        // Check that (1) parsing succeeded and (2) the entire string was used.
        if (*err != 0)
        {
            throw std::runtime_error("Could not parse literal '" + s + "'");
        }

        return result;
    }

    template <>
    uint8_t parse_string<uint8_t>(const std::string& s)
    {
        char* err;
        uint8_t result = strtol(s.c_str(), &err, 10);

        // Check that (1) parsing succeeded and (2) the entire string was used.
        if (*err != 0)
        {
            throw std::runtime_error("Could not parse literal '" + s + "'");
        }

        return result;
    }
}

std::ostream& operator<<(std::ostream& os, const ngraph::NodeVector& nv)
{
    std::vector<std::string> names;
    for (auto n : nv)
    {
        names.push_back(n->get_name());
    }
    os << vector_to_string(names);
    return os;
}

void ngraph::check_fp_values_isinf(const char* name, const float* array, size_t n)
{
    for (size_t i = 0; i < n; i++)
    {
        if (std::isinf(array[i]))
        {
            throw std::runtime_error("Discovered Inf in '" + string(name) + "'");
        }
    }
}

void ngraph::check_fp_values_isinf(const char* name, const double* array, size_t n)
{
    for (size_t i = 0; i < n; i++)
    {
        if (std::isinf(array[i]))
        {
            throw std::runtime_error("Discovered Inf in '" + string(name) + "'");
        }
    }
}

void ngraph::check_fp_values_isnan(const char* name, const float* array, size_t n)
{
    for (size_t i = 0; i < n; i++)
    {
        if (std::isnan(array[i]))
        {
            throw std::runtime_error("Discovered NaN in '" + string(name) + "'");
        }
    }
}

void ngraph::check_fp_values_isnan(const char* name, const double* array, size_t n)
{
    for (size_t i = 0; i < n; i++)
    {
        if (std::isnan(array[i]))
        {
            throw std::runtime_error("Discovered NaN in '" + string(name) + "'");
        }
    }
}

bool ngraph::is_valid_permutation(ngraph::AxisVector permutation, ngraph::Rank rank)
{
    std::vector<bool> axis_occurs(permutation.size(), false);

    // Check bounds if rank is static
    if (rank.is_static())
    {
        auto bound = rank.get_length();
        for (auto axis : permutation)
        {
            if (static_cast<decltype(bound)>(axis) >= bound)
            {
                return false;
            }
        }
    }

    for (auto& axis : permutation)
    {
        axis_occurs[axis] = true;
    }

    for (size_t axis = 0; axis < permutation.size(); axis++)
    {
        if (!axis_occurs[axis])
        {
            return false;
        }
    }

    return (rank.is_dynamic() || permutation.size() == rank.get_length());
}

template <typename T>
T ngraph::apply_permutation(T input, AxisVector order)
{
    NGRAPH_CHECK(is_valid_permutation(order, input.size()),
                 "Permutation ",
                 order,
                 " is not valid for ",
                 input);

    T output(input.size());

    for (size_t i = 0; i < order.size(); i++)
    {
        output[i] = input.at(order.at(i));
    }

    return output;
}

template AxisVector ngraph::apply_permutation<AxisVector>(AxisVector input, AxisVector order);
template Shape ngraph::apply_permutation<Shape>(Shape input, AxisVector order);
template ngraph::Coordinate ngraph::apply_permutation<ngraph::Coordinate>(ngraph::Coordinate input,
                                                                          ngraph::AxisVector order);
template ngraph::CoordinateDiff
    ngraph::apply_permutation<ngraph::CoordinateDiff>(ngraph::CoordinateDiff input,
                                                      ngraph::AxisVector order);
template ngraph::Strides ngraph::apply_permutation<ngraph::Strides>(ngraph::Strides input,
                                                                    ngraph::AxisVector order);

namespace ngraph
{
    template <>
    PartialShape apply_permutation(PartialShape input, AxisVector order)
    {
        NGRAPH_CHECK(is_valid_permutation(order, input.rank()),
                     "Permutation ",
                     order,
                     " is not valid for ",
                     input);

        // Here's the special part: if AxisVector is a viable permutation of _some_ rank, and input
        // has dynamic rank, we just stick with dynamic rank.
        if (input.rank().is_dynamic())
        {
            return input;
        }

        PartialShape output{PartialShape::dynamic(order.size())};

        for (size_t i = 0; i < order.size(); i++)
        {
            output[i] = input[order.at(i)];
        }

        return output;
    }
}

AxisVector ngraph::get_default_order(const Shape& shape)
{
    return get_default_order(shape.size());
}

AxisVector ngraph::get_default_order(size_t rank)
{
    AxisVector default_order(rank);
    std::iota(begin(default_order), end(default_order), 0);
    return default_order;
}

AxisVector ngraph::get_permutation_to_default_order(const AxisVector& axis_order)
{
    AxisVector out(axis_order.size());
    for (size_t i = 0; i < axis_order.size(); i++)
    {
        out.at(axis_order[i]) = i;
    }
    return out;
}

void ngraph::parse_version_string(
    std::string version, size_t& major, size_t& minor, size_t& patch, string& extra)
{
    // Since regex is broken in gcc 4.8 I will just manually parse the version string
    // Version strings look like `0.25.0-rc.0+7c32240` or `v0.25.0-rc.0+7c32240`
    size_t start;
    size_t end;
    extra = "";
    start = (version[0] == 'v' ? 1 : 0);
    end = version.find_first_of('.', start);
    string major_str = version.substr(start, end - start);
    start = end + 1;

    end = version.find_first_of('.', start);
    string minor_str = version.substr(start, end - start);
    start = end + 1;

    end = version.find_first_of("-+", start);
    string patch_str = version.substr(start, end - start);
    start = end;

    if (start != string::npos)
    {
        extra = version.substr(start);
    }

    size_t err;
    bool error = false;
    try
    {
        major = stoi(major_str, &err);
        if (err != major_str.size())
        {
            error = true;
        }
        minor = stoi(minor_str, &err);
        if (err != minor_str.size())
        {
            error = true;
        }
        patch = stoi(patch_str, &err);
        if (err != patch_str.size())
        {
            error = true;
        }
    }
    catch (...)
    {
        error = true;
    }
    if (error)
    {
        throw runtime_error("Error parsing version string '" + version + "'");
    }
}

template <typename T>
std::vector<T> read_vector(std::shared_ptr<ngraph::runtime::Tensor> tv)
{
    if (ngraph::element::from<T>() != tv->get_element_type())
    {
        throw std::invalid_argument("read_vector type must match Tensor type");
    }
    size_t element_count = ngraph::shape_size(tv->get_shape());
    size_t size = element_count * sizeof(T);
    std::vector<T> rc(element_count);
    if (size > 0)
    {
        tv->read(rc.data(), size);
    }
    return rc;
}

vector<float> read_float_vector(shared_ptr<runtime::Tensor> tv)
{
    vector<float> float_vec;
    element::Type element_type = tv->get_tensor_layout()->get_element_type();

    if (element_type == element::boolean)
    {
        vector<char> vec = read_vector<char>(tv);
        // Changed from vector ctor to explicit for loop to add static_cast
        // This silences MSVC warnings
        for (char value : vec)
        {
            float_vec.push_back(static_cast<float>(value));
        }
    }
    else if (element_type == element::bf16)
    {
        vector<bfloat16> vec = read_vector<bfloat16>(tv);
        float_vec = bfloat16::to_float_vector(vec);
    }
    else if (element_type == element::f16)
    {
        vector<float16> vec = read_vector<float16>(tv);
        for (float16 value : vec)
        {
            float_vec.push_back(static_cast<float>(value));
        }
    }
    else if (element_type == element::f32)
    {
        vector<float> vec = read_vector<float>(tv);
        for (float value : vec)
        {
            float_vec.push_back(static_cast<float>(value));
        }
    }
    else if (element_type == element::f64)
    {
        vector<double> vec = read_vector<double>(tv);
        for (double value : vec)
        {
            float_vec.push_back(static_cast<float>(value));
        }
    }
    else if (element_type == element::i8)
    {
        vector<int8_t> vec = read_vector<int8_t>(tv);
        for (int8_t value : vec)
        {
            float_vec.push_back(static_cast<float>(value));
        }
    }
    else if (element_type == element::i16)
    {
        vector<int16_t> vec = read_vector<int16_t>(tv);
        for (int16_t value : vec)
        {
            float_vec.push_back(static_cast<float>(value));
        }
    }
    else if (element_type == element::i32)
    {
        vector<int32_t> vec = read_vector<int32_t>(tv);
        for (int32_t value : vec)
        {
            float_vec.push_back(static_cast<float>(value));
        }
    }
    else if (element_type == element::i64)
    {
        vector<int64_t> vec = read_vector<int64_t>(tv);
        for (int64_t value : vec)
        {
            float_vec.push_back(static_cast<float>(value));
        }
    }
    else if (element_type == element::u8)
    {
        vector<uint8_t> vec = read_vector<uint8_t>(tv);
        for (uint8_t value : vec)
        {
            float_vec.push_back(static_cast<float>(value));
        }
    }
    else if (element_type == element::u16)
    {
        vector<uint16_t> vec = read_vector<uint16_t>(tv);
        for (uint16_t value : vec)
        {
            float_vec.push_back(static_cast<float>(value));
        }
    }
    else if (element_type == element::u32)
    {
        vector<uint32_t> vec = read_vector<uint32_t>(tv);
        for (uint32_t value : vec)
        {
            float_vec.push_back(static_cast<float>(value));
        }
    }
    else if (element_type == element::u64)
    {
        vector<uint64_t> vec = read_vector<uint64_t>(tv);
        for (uint64_t value : vec)
        {
            float_vec.push_back(static_cast<float>(value));
        }
    }
    else
    {
        throw ngraph_error("Unsupported nGraph element type.");
    }

    return float_vec;
}

vector<int64_t> read_index_vector(shared_ptr<runtime::Tensor> tv)
{
    vector<int64_t> index_vec;
    element::Type element_type = tv->get_tensor_layout()->get_element_type();

    if (element_type == element::boolean)
    {
        vector<char> vec = read_vector<char>(tv);
        // Changed from vector ctor to explicit for loop to add static_cast
        // This silences MSVC warnings
        for (char value : vec)
        {
            index_vec.push_back(static_cast<int64_t>(value));
        }
    }
    else if (element_type == element::bf16)
    {
        vector<bfloat16> vec = read_vector<bfloat16>(tv);
        vector<float> float_vec = bfloat16::to_float_vector(vec);
        for (float value : float_vec)
        {
            index_vec.push_back(static_cast<int64_t>(value));
        }
    }
    else if (element_type == element::f16)
    {
        vector<float16> vec = read_vector<float16>(tv);
        for (float16 value : vec)
        {
            index_vec.push_back(static_cast<int64_t>(static_cast<float>(value)));
        }
    }
    else if (element_type == element::f32)
    {
        vector<float> vec = read_vector<float>(tv);
        for (float value : vec)
        {
            index_vec.push_back(static_cast<int64_t>(value));
        }
    }
    else if (element_type == element::f64)
    {
        vector<double> vec = read_vector<double>(tv);
        for (double value : vec)
        {
            index_vec.push_back(static_cast<int64_t>(value));
        }
    }
    else if (element_type == element::i8)
    {
        vector<int8_t> vec = read_vector<int8_t>(tv);
        for (int8_t value : vec)
        {
            index_vec.push_back(static_cast<int64_t>(value));
        }
    }
    else if (element_type == element::i16)
    {
        vector<int16_t> vec = read_vector<int16_t>(tv);
        for (int16_t value : vec)
        {
            index_vec.push_back(static_cast<int64_t>(value));
        }
    }
    else if (element_type == element::i32)
    {
        vector<int32_t> vec = read_vector<int32_t>(tv);
        for (int32_t value : vec)
        {
            index_vec.push_back(static_cast<int64_t>(value));
        }
    }
    else if (element_type == element::i64)
    {
        index_vec = read_vector<int64_t>(tv);
    }
    else if (element_type == element::u8)
    {
        vector<uint8_t> vec = read_vector<uint8_t>(tv);
        for (uint8_t value : vec)
        {
            index_vec.push_back(static_cast<int64_t>(value));
        }
    }
    else if (element_type == element::u16)
    {
        vector<uint16_t> vec = read_vector<uint16_t>(tv);
        for (uint16_t value : vec)
        {
            index_vec.push_back(static_cast<int64_t>(value));
        }
    }
    else if (element_type == element::u32)
    {
        vector<uint32_t> vec = read_vector<uint32_t>(tv);
        for (uint32_t value : vec)
        {
            index_vec.push_back(static_cast<int64_t>(value));
        }
    }
    else if (element_type == element::u64)
    {
        vector<uint64_t> vec = read_vector<uint64_t>(tv);
        for (uint64_t value : vec)
        {
            index_vec.push_back(static_cast<int64_t>(value));
        }
    }
    else
    {
        throw ngraph_error("Unsupported nGraph element type.");
    }

    return index_vec;
}


text:
#ifndef __ETHERCAT_H__
#define __ETHERCAT_H__

#ifdef USE_ETHERCAT

#include "setup.h"

#define MAX_PDO_ENTRY_SIZE 30

#define EC_WATCHDOG_US 5000		//Signal an EC error if no PDO activity for this period
#define EC_SYS_TIME_ADDR 0x0910   //RJK edit for DC
#define EC_LATCH0_POS_EDG_ADDR 0x09B0
#define EC_LATCH1_POS_EDG_ADDR 0x09C0

int step_ethercat(void);
void setup_ethercat(void);
int eeprom_loaded(void);
void setup_spi(void);

extern unsigned long long dc_timestamp;  //RJK edit for DC
extern int ec_debug[];
extern int ec_flags[];
extern  int ec_wd_expired;
extern long ec_wd_timestamp;

typedef M3ActX1PdoV3Status ec_stat_t;
typedef M3ActX1PdoV3Cmd ec_cmd_t;

#define NUM_DBG_CH 1

#define PDO_COMMAND_SIZE MAX_PDO_ENTRY_SIZE*2
#define PDO_STATUS_SIZE MAX_PDO_ENTRY_SIZE*2

extern ec_cmd_t  ec_cmd;
extern ec_stat_t   ec_stat;

#endif
#endif


text:
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision: 338645 $ -->

<refentry xml:id="mongodate.tostring" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
 <refnamediv>
  <refname>MongoDate::__toString</refname>
  <refpurpose>Returns a string representation of this date</refpurpose>
 </refnamediv>

 <refsynopsisdiv role="soft-deprecation-notice">
  <sidebar>
   &mongo.alternative.method.note;
   <simplelist role="alternatives">
    <member><methodname>MongoDB\BSON\UTCDateTime::__toString</methodname></member>
   </simplelist>
  </sidebar>
 </refsynopsisdiv>

 <refsect1 role="description">
  &reftitle.description;
  <methodsynopsis>
   <modifier>public</modifier> <type>string</type><methodname>MongoDate::__toString</methodname>
   <void />
  </methodsynopsis>
  <para>
   Returns a string representation of this date, similar to the representation returned by <function>microtime</function>.
  </para>
 </refsect1>

 <refsect1 role="parameters">
  &reftitle.parameters;
  &no.function.parameters;
 </refsect1>

 <refsect1 role="returnvalues">
  &reftitle.returnvalues;
  <para>
   This date.
  </para>
 </refsect1>
</refentry>

<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->


text:
import { CodedError } from 'expo-modules-core';

import { SMSResponse } from './SMS.types';

export default {
  get name(): string {
    return 'ExpoSMS';
  },
  async isAvailableAsync(): Promise<boolean> {
    return false;
  },
  async sendSMSAsync(addresses: string[], message: string): Promise<SMSResponse> {
    throw new CodedError('E_SMS_UNAVAILABLE', 'SMS not available');
  },
};


text:
<?php

namespace Symfony\Component\Messenger\Tests\Transport\Doctrine;

use Doctrine\DBAL\DBALException;
use Doctrine\DBAL\Driver\Statement;
use Doctrine\DBAL\Platforms\AbstractPlatform;
use Doctrine\DBAL\Query\QueryBuilder;
use Doctrine\DBAL\Schema\Synchronizer\SchemaSynchronizer;
use PHPUnit\Framework\TestCase;
use Symfony\Component\Messenger\Tests\Fixtures\DummyMessage;
use Symfony\Component\Messenger\Transport\Doctrine\Connection;

class ConnectionTest extends TestCase
{
    public function testGetAMessageWillChangeItsStatus()
    {
        $queryBuilder = $this->getQueryBuilderMock();
        $driverConnection = $this->getDBALConnectionMock();
        $schemaSynchronizer = $this->getSchemaSynchronizerMock();
        $stmt = $this->getStatementMock([
            'id' => 1,
            'body' => '{"message":"Hi"}',
            'headers' => \json_encode(['type' => DummyMessage::class]),
        ]);

        $driverConnection
            ->method('createQueryBuilder')
            ->willReturn($queryBuilder);
        $queryBuilder
            ->method('getSQL')
            ->willReturn('');
        $queryBuilder
            ->method('getParameters')
            ->willReturn([]);
        $driverConnection
            ->method('prepare')
            ->willReturn($stmt);

        $connection = new Connection([], $driverConnection, $schemaSynchronizer);
        $doctrineEnvelope = $connection->get();
        $this->assertEquals(1, $doctrineEnvelope['id']);
        $this->assertEquals('{"message":"Hi"}', $doctrineEnvelope['body']);
        $this->assertEquals(['type' => DummyMessage::class], $doctrineEnvelope['headers']);
    }

    public function testGetWithNoPendingMessageWillReturnNull()
    {
        $queryBuilder = $this->getQueryBuilderMock();
        $driverConnection = $this->getDBALConnectionMock();
        $schemaSynchronizer = $this->getSchemaSynchronizerMock();
        $stmt = $this->getStatementMock(false);

        $queryBuilder
            ->method('getParameters')
            ->willReturn([]);
        $driverConnection->expects($this->once())
            ->method('createQueryBuilder')
            ->willReturn($queryBuilder);
        $driverConnection->method('prepare')
            ->willReturn($stmt);
        $driverConnection->expects($this->never())
            ->method('update');

        $connection = new Connection([], $driverConnection, $schemaSynchronizer);
        $doctrineEnvelope = $connection->get();
        $this->assertNull($doctrineEnvelope);
    }

    /**
     * @expectedException \Symfony\Component\Messenger\Exception\TransportException
     */
    public function testItThrowsATransportExceptionIfItCannotAcknowledgeMessage()
    {
        $driverConnection = $this->getDBALConnectionMock();
        $driverConnection->method('delete')->willThrowException(new DBALException());

        $connection = new Connection([], $driverConnection);
        $connection->ack('dummy_id');
    }

    /**
     * @expectedException \Symfony\Component\Messenger\Exception\TransportException
     */
    public function testItThrowsATransportExceptionIfItCannotRejectMessage()
    {
        $driverConnection = $this->getDBALConnectionMock();
        $driverConnection->method('delete')->willThrowException(new DBALException());

        $connection = new Connection([], $driverConnection);
        $connection->reject('dummy_id');
    }

    private function getDBALConnectionMock()
    {
        $driverConnection = $this->getMockBuilder(\Doctrine\DBAL\Connection::class)
            ->disableOriginalConstructor()
            ->getMock();
        $platform = $this->getMockBuilder(AbstractPlatform::class)
            ->getMock();
        $platform->method('getWriteLockSQL')->willReturn('FOR UPDATE');
        $driverConnection->method('getDatabasePlatform')->willReturn($platform);

        return $driverConnection;
    }

    private function getQueryBuilderMock()
    {
        $queryBuilder = $this->getMockBuilder(QueryBuilder::class)
            ->disableOriginalConstructor()
            ->getMock();

        $queryBuilder->method('select')->willReturn($queryBuilder);
        $queryBuilder->method('update')->willReturn($queryBuilder);
        $queryBuilder->method('from')->willReturn($queryBuilder);
        $queryBuilder->method('set')->willReturn($queryBuilder);
        $queryBuilder->method('where')->willReturn($queryBuilder);
        $queryBuilder->method('andWhere')->willReturn($queryBuilder);
        $queryBuilder->method('orderBy')->willReturn($queryBuilder);
        $queryBuilder->method('setMaxResults')->willReturn($queryBuilder);
        $queryBuilder->method('setParameter')->willReturn($queryBuilder);
        $queryBuilder->method('setParameters')->willReturn($queryBuilder);

        return $queryBuilder;
    }

    private function getStatementMock($expectedResult)
    {
        $stmt = $this->getMockBuilder(Statement::class)
            ->disableOriginalConstructor()
            ->getMock();
        $stmt->expects($this->once())
            ->method('fetch')
            ->willReturn($expectedResult);

        return $stmt;
    }

    private function getSchemaSynchronizerMock()
    {
        return $this->getMockBuilder(SchemaSynchronizer::class)
            ->getMock();
    }

    /**
     * @dataProvider buildConfigurationProvider
     */
    public function testBuildConfiguration($dsn, $options, $expectedManager, $expectedTableName, $expectedRedeliverTimeout, $expectedQueue)
    {
        $config = Connection::buildConfiguration($dsn, $options);
        $this->assertEquals($expectedManager, $config['connection']);
        $this->assertEquals($expectedTableName, $config['table_name']);
        $this->assertEquals($expectedRedeliverTimeout, $config['redeliver_timeout']);
        $this->assertEquals($expectedQueue, $config['queue_name']);
    }

    public function buildConfigurationProvider()
    {
        return [
            [
                'dsn' => 'doctrine://default',
                'options' => [],
                'expectedManager' => 'default',
                'expectedTableName' => 'messenger_messages',
                'expectedRedeliverTimeout' => 3600,
                'expectedQueue' => 'default',
            ],
            // test options from options array
            [
                'dsn' => 'doctrine://default',
                'options' => [
                    'table_name' => 'name_from_options',
                    'redeliver_timeout' => 1800,
                    'queue_name' => 'important',
                ],
                'expectedManager' => 'default',
                'expectedTableName' => 'name_from_options',
                'expectedRedeliverTimeout' => 1800,
                'expectedQueue' => 'important',
            ],
            // tests options from dsn
            [
                'dsn' => 'doctrine://default?table_name=name_from_dsn&redeliver_timeout=1200&queue_name=normal',
                'options' => [],
                'expectedManager' => 'default',
                'expectedTableName' => 'name_from_dsn',
                'expectedRedeliverTimeout' => 1200,
                'expectedQueue' => 'normal',
            ],
            // test options from options array wins over options from dsn
            [
                'dsn' => 'doctrine://default?table_name=name_from_dsn&redeliver_timeout=1200&queue_name=normal',
                'options' => [
                    'table_name' => 'name_from_options',
                    'redeliver_timeout' => 1800,
                    'queue_name' => 'important',
                ],
                'expectedManager' => 'default',
                'expectedTableName' => 'name_from_options',
                'expectedRedeliverTimeout' => 1800,
                'expectedQueue' => 'important',
            ],
        ];
    }

    /**
     * @expectedException \Symfony\Component\Messenger\Exception\InvalidArgumentException
     */
    public function testItThrowsAnExceptionIfAnExtraOptionsInDefined()
    {
        Connection::buildConfiguration('doctrine://default', ['new_option' => 'woops']);
    }

    /**
     * @expectedException \Symfony\Component\Messenger\Exception\InvalidArgumentException
     */
    public function testItThrowsAnExceptionIfAnExtraOptionsInDefinedInDSN()
    {
        Connection::buildConfiguration('doctrine://default?new_option=woops');
    }
}


text:
package ch.alv.components.core.beans.factory;

import ch.alv.components.core.file.flat.reader.FlatFileObjectHandle;

import java.io.InputStream;

/**
 * Transforms a text string to a java object. Supports two modes of operation.
 * In one mode you can pass a line to the transformer and get back a java object
 * with the initialized data. In the second approach you can pass in the entire
 * file and expect to receive notifications for each line in the file (with
 * either the java object or the line itself if the transformed could not map it
 * to a java class).
 *
 * @since 1.0.0
 */
public interface StringBeanFactory<T> {

	/**
	 * Loads a String into an instance of the specified type. In the case that
	 * the record format cannot be located a null is returned.
	 *
	 * @param line a line, representing a record.
	 * @throws ch.alv.components.core.file.flat.reader.FlatFileConverterException if error occurs while parsing the line
	 */
	public T convert(String line);

	/**
	 * Parses the input and for every record matched, notifies the listener with
	 * the fully loaded bean. If record could not be matched then notify the
	 * listener with the record line so that it may do any custom processing.
	 *
	 * @param stream Input stream with file contents to parse
	 * @param listener listener to notify found and notfound events
	 */
	public void convert(InputStream stream, FlatFileObjectHandle<T> listener);
}


text:
'use strict';
var path = require('path');
var eachAsync = require('each-async');
var assign = require('object-assign');
var sass = require('node-sass');

module.exports = function (grunt) {
	grunt.verbose.writeln('\n' + sass.info() + '\n');

	grunt.registerMultiTask('sass', 'Compile Sass to CSS', function () {
		eachAsync(this.files, function (el, i, next) {
			var opts = this.options({
				precision: 10
			});

			var src = el.src[0];

			if (!src || path.basename(src)[0] === '_') {
				next();
				return;
			}

			sass.render(assign({}, opts, {
				file: src,
				outFile: el.dest,
				success: function (res) {
					grunt.file.write(el.dest, res.css);

					if (opts.sourceMap) {
						grunt.file.write(opts.sourceMap === true ? (el.dest + '.map') : path.relative(process.cwd(), opts.sourceMap), res.map);
					}

					next();
				},
				error: function (err) {
					grunt.log.error(err.message + '\n  ' + 'Line ' + err.line + '  Column ' + err.column + '  ' + path.relative(process.cwd(), err.file) + '\n');
					grunt.warn('');
					next(err);
				}
			}));
		}.bind(this), this.async());
	});
};


text:
package org.openengsb.core.workflow.drools.internal.persistence;

import java.util.Collection;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;

import org.openengsb.core.api.persistence.ConfigPersistenceService;
import org.openengsb.core.api.persistence.PersistenceException;
import org.openengsb.core.workflow.api.RuleBaseException;
import org.openengsb.core.workflow.api.model.RuleBaseElementId;
import org.openengsb.core.workflow.api.model.RuleBaseElementType;
import org.openengsb.core.workflow.drools.internal.AbstractRuleManager;
import org.openengsb.core.workflow.drools.model.GlobalConfiguration;
import org.openengsb.core.workflow.drools.model.GlobalDeclaration;
import org.openengsb.core.workflow.drools.model.ImportConfiguration;
import org.openengsb.core.workflow.drools.model.ImportDeclaration;
import org.openengsb.core.workflow.drools.model.RuleBaseConfiguration;
import org.openengsb.core.workflow.drools.model.RuleBaseElement;

public class PersistenceRuleManager extends AbstractRuleManager {

    private ConfigPersistenceService rulePersistence;
    private ConfigPersistenceService globalPersistence;
    private ConfigPersistenceService importPersistence;

    public synchronized void init() {
        builder.reloadRulebase();
    }

    @Override
    public void add(RuleBaseElementId name, String code) throws RuleBaseException {
        try {
            List<RuleBaseConfiguration> existingRules =
                rulePersistence.load(new RuleBaseElement(name).toMetadata());
            if (!existingRules.isEmpty()) {
                throw new RuleBaseException("rule already exists");
            }
        } catch (PersistenceException e1) {
            throw new RuleBaseException("could not load existing rules from persistence service", e1);
        }

        RuleBaseElement objectToPersist = new RuleBaseElement(name, code);
        Map<String, String> metaData = objectToPersist.toMetadata();
        RuleBaseConfiguration conf = new RuleBaseConfiguration(metaData, objectToPersist);

        try {
            rulePersistence.persist(conf);
        } catch (PersistenceException e) {
            throw new RuleBaseException(e);
        }
        try {
            builder.reloadPackage(name.getPackageName());
        } catch (RuleBaseException e) {
            try {
                rulePersistence.remove(metaData);
                throw e;
            } catch (PersistenceException e1) {
                throw new RuleBaseException("could not remove previously added rule, that broke the rulebase", e1);
            }
        }
    }

    @Override
    public String get(RuleBaseElementId name) {
        try {
            List<RuleBaseConfiguration> existingRules =
                rulePersistence.load(new RuleBaseElement(name).toMetadata());
            if (existingRules.isEmpty()) {
                return null;
            } else {
                return existingRules.get(0).getContent().getCode();
            }
        } catch (PersistenceException e) {
            throw new RuleBaseException("error reading rule from persistence", e);
        }
    }

    @Override
    public void update(RuleBaseElementId name, String newCode) throws RuleBaseException {
        RuleBaseElement newBean = new RuleBaseElement(name, newCode);
        RuleBaseConfiguration conf = new RuleBaseConfiguration(newBean);

        try {
            rulePersistence.persist(conf);
        } catch (PersistenceException e) {
            throw new RuleBaseException(e);
        }
        builder.reloadPackage(name.getPackageName());
    }

    @Override
    public void delete(RuleBaseElementId name) throws RuleBaseException {
        try {
            Map<String, String> metaData = new RuleBaseElement(name).toMetadata();
            rulePersistence.remove(metaData);
        } catch (PersistenceException e) {
            throw new RuleBaseException(e);
        }
        builder.reloadPackage(name.getPackageName());
    }

    @Override
    public Collection<RuleBaseElementId> listAll(RuleBaseElementType type) {
        RuleBaseElementId example = new RuleBaseElementId();
        example.setPackageName(null);
        example.setType(type);
        return listByExample(example);
    }

    @Override
    public Collection<RuleBaseElementId> list(RuleBaseElementType type, String packageName) {
        RuleBaseElementId example = new RuleBaseElementId();
        example.setType(type);
        example.setPackageName(packageName);
        return listByExample(example);
    }

    private Collection<RuleBaseElementId> listByExample(RuleBaseElementId example) {
        List<RuleBaseConfiguration> queryResult;
        try {
            queryResult = rulePersistence.load(new RuleBaseElement(example).toMetadata());
        } catch (PersistenceException e) {
            throw new RuleBaseException("error reading rule from persistence", e);
        }

        Collection<RuleBaseElementId> result = new HashSet<RuleBaseElementId>();
        for (RuleBaseConfiguration element : queryResult) {
            result.add(element.getContent().generateId());
        }
        return result;
    }

    @Override
    public void addImport(String className) throws RuleBaseException {
        ImportDeclaration imp = new ImportDeclaration(className);
        Map<String, String> metaData = imp.toMetadata();
        ImportConfiguration cnf = new ImportConfiguration(metaData, imp);
        try {
            if (importPersistence.load(metaData).isEmpty()) {
                importPersistence.persist(cnf);
            }
        } catch (PersistenceException e) {
            throw new RuleBaseException(e);
        }
        try {
            builder.reloadRulebase();
        } catch (RuleBaseException e) {
            importPersistence.remove(cnf.getMetaData());
            throw e;
        }
    }

    @Override
    public void removeImport(String className) throws RuleBaseException {
        try {
            ImportDeclaration imp = new ImportDeclaration(className);
            Map<String, String> metaData = imp.toMetadata();
            importPersistence.remove(metaData);
        } catch (PersistenceException e) {
            throw new RuleBaseException(e);
        }
        builder.reloadRulebase();
    }

    @Override
    public Collection<String> listImports() {
        ImportDeclaration imp = new ImportDeclaration();
        Map<String, String> metaData = imp.toMetadata();
        List<ImportConfiguration> queryResult;
        try {
            queryResult = importPersistence.load(metaData);
        } catch (PersistenceException e) {
            throw new RuleBaseException(e);
        }
        Collection<String> result = new HashSet<String>();
        for (ImportConfiguration i : queryResult) {
            result.add(i.getContent().getClassName());
        }
        return result;
    }

    @Override
    public void addGlobal(String className, String name) throws RuleBaseException {
        GlobalDeclaration globalDeclaration = new GlobalDeclaration(name);
        Map<String, String> metaData = globalDeclaration.toMetadata();
        List<GlobalConfiguration> queryResult;
        try {
            queryResult = globalPersistence.load(metaData);
        } catch (PersistenceException e) {
            throw new RuleBaseException(e);
        }
        if (!queryResult.isEmpty()) {
            throw new RuleBaseException(String.format("Global with name \"%s\" already exists", name));
        }
        globalDeclaration.setClassName(className);
        GlobalConfiguration cnf = new GlobalConfiguration(metaData, globalDeclaration);
        try {
            globalPersistence.persist(cnf);
        } catch (PersistenceException e) {
            throw new RuleBaseException(e);
        }
        try {
            builder.reloadRulebase();
        } catch (RuleBaseException e) {
            globalPersistence.remove(cnf.getMetaData());
            throw e;
        }

    }

    @Override
    public void removeGlobal(String name) throws RuleBaseException {
        GlobalDeclaration globalDeclaration = new GlobalDeclaration(name);
        Map<String, String> metaData = globalDeclaration.toMetadata();
        try {
            globalPersistence.remove(metaData);
        } catch (PersistenceException e) {
            throw new RuleBaseException(e);
        }
        builder.reloadRulebase();
    }

    @Override
    public Map<String, String> listGlobals() {
        GlobalDeclaration globalDeclaration = new GlobalDeclaration();
        Map<String, String> metaData = globalDeclaration.toMetadata();
        List<GlobalConfiguration> queryResult;
        try {
            queryResult = globalPersistence.load(metaData);
        } catch (PersistenceException e) {
            throw new RuleBaseException(e);
        }
        Map<String, String> globals = new HashMap<String, String>();
        for (GlobalConfiguration g : queryResult) {
            globals.put(g.getContent().getVariableName(), g.getContent().getClassName());
        }
        return globals;
    }

    public void setGlobalPersistence(ConfigPersistenceService globalPersistence) {
        this.globalPersistence = globalPersistence;
    }

    public void setImportPersistence(ConfigPersistenceService importPersistence) {
        this.importPersistence = importPersistence;
    }

    public void setRulePersistence(ConfigPersistenceService rulePersistence) {
        this.rulePersistence = rulePersistence;
    }
}


text:
package org.apache.ignite.internal.processors.cache.index;

import java.math.BigDecimal;
import java.math.MathContext;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.apache.ignite.Ignite;
import org.apache.ignite.IgniteCache;
import org.apache.ignite.cache.QueryEntity;
import org.apache.ignite.cache.query.SqlFieldsQuery;
import org.apache.ignite.cache.query.annotations.QuerySqlField;
import org.apache.ignite.configuration.CacheConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
import org.apache.ignite.internal.IgniteEx;
import org.jetbrains.annotations.NotNull;

import static java.math.RoundingMode.HALF_UP;
import static java.util.Arrays.asList;

/**
 * Test to check decimal columns.
 */
public class IgniteDecimalSelfTest extends AbstractSchemaSelfTest {
    /** */
    private static final int PRECISION = 9;

    /** */
    private static final int SCALE = 8;

    /** */
    private static final String DEC_TAB_NAME = "DECIMAL_TABLE";

    /** */
    private static final String VALUE = "VALUE";

    /** */
    private static final String SALARY_TAB_NAME = "SALARY";

    /** */
    private static final MathContext MATH_CTX = new MathContext(PRECISION);

    /** */
    private static final BigDecimal VAL_1 = new BigDecimal("123456789", MATH_CTX).setScale(SCALE, HALF_UP);

    /** */
    private static final BigDecimal VAL_2 = new BigDecimal("12345678.12345678", MATH_CTX).setScale(SCALE, HALF_UP);

    /** */
    private static final BigDecimal VAL_3 = new BigDecimal(".123456789", MATH_CTX).setScale(SCALE, HALF_UP);

    /** {@inheritDoc} */
    @Override protected void beforeTestsStarted() throws Exception {
        super.beforeTestsStarted();

        IgniteEx grid = startGrid(0);

        execute(grid, "CREATE TABLE " + DEC_TAB_NAME +
            "(id LONG PRIMARY KEY, " + VALUE + " DECIMAL(" + PRECISION + ", " + SCALE + "))");

        String insertQry = "INSERT INTO " + DEC_TAB_NAME + " VALUES (?, ?)";

        execute(grid, insertQry, 1, VAL_1);
        execute(grid, insertQry, 2, VAL_2);
        execute(grid, insertQry, 3, VAL_3);
    }

    /** {@inheritDoc} */
    @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
        IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);

        CacheConfiguration<Integer, Salary> ccfg = cacheCfg(SALARY_TAB_NAME, "salary_cache");

        cfg.setCacheConfiguration(ccfg);

        return cfg;
    }

    /** */
    @NotNull private CacheConfiguration<Integer, Salary> cacheCfg(String tabName, String cacheName) {
        CacheConfiguration<Integer, Salary> ccfg = new CacheConfiguration<>(cacheName);

        QueryEntity queryEntity = new QueryEntity(Integer.class.getName(), Salary.class.getName());

        queryEntity.setTableName(tabName);

        queryEntity.addQueryField("id", Integer.class.getName(), null);
        queryEntity.addQueryField("amount", BigDecimal.class.getName(), null);

        Map<String, Integer> precision = new HashMap<>();
        Map<String, Integer> scale = new HashMap<>();

        precision.put("amount",PRECISION);
        scale.put("amount", SCALE);

        queryEntity.setFieldsPrecision(precision);
        queryEntity.setFieldsScale(scale);

        ccfg.setQueryEntities(Collections.singletonList(queryEntity));

        return ccfg;
    }

    /**
     * @throws Exception If failed.
     */
    public void testConfiguredFromDdl() throws Exception {
        checkPrecisionAndScale(DEC_TAB_NAME, VALUE, PRECISION, SCALE);
    }

    /**
     * @throws Exception If failed.
     */
    public void testConfiguredFromQueryEntity() throws Exception {
        checkPrecisionAndScale(SALARY_TAB_NAME, "amount", PRECISION, SCALE);
    }

    /**
     * @throws Exception If failed.
     */
    public void testConfiguredFromQueryEntityInDynamicallyCreatedCache() throws Exception {
        IgniteEx grid = grid(0);

        String tabName = SALARY_TAB_NAME + "2";

        CacheConfiguration<Integer, Salary> ccfg = cacheCfg(tabName, "SalaryCache-2");

        IgniteCache<Integer, Salary> cache = grid.createCache(ccfg);

        checkPrecisionAndScale(tabName, "amount", PRECISION, SCALE);
    }

    /**
     * @throws Exception If failed.
     */
    public void testConfiguredFromAnnotations() throws Exception {
        IgniteEx grid = grid(0);

        CacheConfiguration<Integer, Salary> ccfg = new CacheConfiguration<>("SalaryCache-3");

        ccfg.setIndexedTypes(Integer.class, SalaryWithAnnotations.class);

        grid.createCache(ccfg);

        checkPrecisionAndScale(SalaryWithAnnotations.class.getSimpleName().toUpperCase(), "amount", PRECISION, SCALE);
    }

    /** */
    public void testSelectDecimal() throws Exception {
        IgniteEx grid = grid(0);

        List rows = execute(grid, "SELECT id, value FROM " + DEC_TAB_NAME + " order by id");

        assertEquals(rows.size(), 3);

        assertEquals(asList(1L, VAL_1), rows.get(0));
        assertEquals(asList(2L, VAL_2), rows.get(1));
        assertEquals(asList(3L, VAL_3), rows.get(2));
    }

    /** */
    private void checkPrecisionAndScale(String tabName, String colName, Integer precision, Integer scale) {
        QueryEntity queryEntity = findTableInfo(tabName);

        assertNotNull(queryEntity);

        Map<String, Integer> fieldsPrecision = queryEntity.getFieldsPrecision();

        assertNotNull(precision);

        assertEquals(fieldsPrecision.get(colName), precision);

        Map<String, Integer> fieldsScale = queryEntity.getFieldsScale();

        assertEquals(fieldsScale.get(colName), scale);

        assertNotNull(scale);
    }

    /**
     * @param tabName Table name.
     * @return QueryEntity of table.
     */
    private QueryEntity findTableInfo(String tabName) {
        IgniteEx ignite = grid(0);

        Collection<String> cacheNames = ignite.cacheNames();
        for (String cacheName : cacheNames) {
            CacheConfiguration ccfg = ignite.cache(cacheName).getConfiguration(CacheConfiguration.class);

            Collection<QueryEntity> entities = ccfg.getQueryEntities();

            for (QueryEntity entity : entities)
                if (entity.getTableName().equalsIgnoreCase(tabName))
                    return entity;
        }

        return null;
    }

    /**
     * Execute DDL statement on given node.
     *
     * @param node Node.
     * @param sql Statement.
     */
    private List<List<?>> execute(Ignite node, String sql, Object... args) {
        SqlFieldsQuery qry = new SqlFieldsQuery(sql)
            .setArgs(args)
            .setSchema("PUBLIC");

        return queryProcessor(node).querySqlFields(qry, true).getAll();
    }

    /** */
    private static class Salary {
        /** */
        private BigDecimal amount;

        /** */
        public BigDecimal getAmount() {
            return amount;
        }

        /** */
        public void setAmount(BigDecimal amount) {
            this.amount = amount;
        }
    }

    /** */
    private static class SalaryWithAnnotations {
        /** */
        @QuerySqlField(index = true, precision = PRECISION, scale = SCALE)
        private BigDecimal amount;

        /** */
        public BigDecimal getAmount() {
            return amount;
        }

        /** */
        public void setAmount(BigDecimal amount) {
            this.amount = amount;
        }
    }
}


text:
__author__ = 'Daniel'

import pickle
import configparser

class UserData:
    _filename = "score.db"
    db = {}

    def __init__(self, filename=None):
        if filename is not None:
            self._filename = filename

    def save_db(self):
        pickle.dump(self.db, open(self._filename, 'wb'))

    def load_or_create_db(self):
        """Tries to load the share and lookup dictionaries. Throws an
        exception if file does not exist.
        """
        try:
            with open(self._filename, 'rb') as f:
                self.db = pickle.load(f)
        except FileNotFoundError:
            pass

_config_file = 'setting.ini'
config = configparser.ConfigParser()

def gen_default_config_file():
    config.add_section('General')
    config.set('General', 'SHOW_TIMER', 'true')
    config.set('General', 'PAUSE_AFTER_QUESTION', 'false')
    config.add_section('Debug')
    config.set("Debug", 'Mode', 'false')
    with open(_config_file, 'w') as f:
        config.write(f)

def read_config_file():
    try:
        open(_config_file)
        config.read(_config_file)
    except FileNotFoundError as e:
        raise e

try:
    read_config_file()
except FileNotFoundError:
    gen_default_config_file()


text:
"""Fix the name of modules

This module is useful when you want to rename many of the modules in
your project.  That can happen specially when you want to change their
naming style.

For instance::

  fixer = FixModuleNames(project)
  changes = fixer.get_changes(fixer=str.lower)
  project.do(changes)

Here it renames all modules and packages to use lower-cased chars.
You can tell it to use any other style by using the ``fixer``
argument.

"""
from rope.base import taskhandle
from rope.contrib import changestack
from rope.refactor import rename

class FixModuleNames(object):

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

    def get_changes(self, fixer=str.lower,
                    task_handle=taskhandle.NullTaskHandle()):
        """Fix module names

        `fixer` is a function that takes and returns a `str`.  Given
        the name of a module, it should return the fixed name.

        """
        stack = changestack.ChangeStack(self.project, 'Fixing module names')
        jobset = task_handle.create_jobset('Fixing module names',
                                           self._count_fixes(fixer) + 1)
        try:
            while True:
                for resource in self._tobe_fixed(fixer):
                    jobset.started_job(resource.path)
                    renamer = rename.Rename(self.project, resource)
                    changes = renamer.get_changes(fixer(self._name(resource)))
                    stack.push(changes)
                    jobset.finished_job()
                    break
                else:
                    break
        finally:
            jobset.started_job('Reverting to original state')
            stack.pop_all()
            jobset.finished_job()
        return stack.merged()

    def _count_fixes(self, fixer):
        return len(list(self._tobe_fixed(fixer)))

    def _tobe_fixed(self, fixer):
        for resource in self.project.pycore.get_python_files():
            modname = self._name(resource)
            if modname != fixer(modname):
                yield resource

    def _name(self, resource):
        modname = resource.name.rsplit('.', 1)[0]
        if modname == '__init__':
            modname = resource.parent.name
        return modname


text:
package com.amazonaws.services.ec2.model;

import java.io.Serializable;
import com.amazonaws.AmazonWebServiceRequest;
import com.amazonaws.Request;
import com.amazonaws.services.ec2.model.transform.DescribeExportTasksRequestMarshaller;

/**
 *

 * Contains the parameters for DescribeExportTasks.
 *

 */
public class DescribeExportTasksRequest extends AmazonWebServiceRequest
        implements Serializable, Cloneable,
        DryRunSupportedRequest<DescribeExportTasksRequest> {

    /**
     *

     * One or more export task IDs.
     *

     */
    private com.amazonaws.internal.SdkInternalList<String> exportTaskIds;

    /**
     *

     * One or more export task IDs.
     *

     *
     * @return One or more export task IDs.
     */

    public java.util.List<String> getExportTaskIds() {
        if (exportTaskIds == null) {
            exportTaskIds = new com.amazonaws.internal.SdkInternalList<String>();
        }
        return exportTaskIds;
    }

    /**
     *

     * One or more export task IDs.
     *

     *
     * @param exportTaskIds
     *        One or more export task IDs.
     */

    public void setExportTaskIds(java.util.Collection<String> exportTaskIds) {
        if (exportTaskIds == null) {
            this.exportTaskIds = null;
            return;
        }

        this.exportTaskIds = new com.amazonaws.internal.SdkInternalList<String>(
                exportTaskIds);
    }

    /**
     *

     * One or more export task IDs.
     *

     *

     * NOTE: This method appends the values to the existing list (if
     * any). Use {@link #setExportTaskIds(java.util.Collection)} or
     * {@link #withExportTaskIds(java.util.Collection)} if you want to override
     * the existing values.
     *

     *
     * @param exportTaskIds
     *        One or more export task IDs.
     * @return Returns a reference to this object so that method calls can be
     *         chained together.
     */

    public DescribeExportTasksRequest withExportTaskIds(String... exportTaskIds) {
        if (this.exportTaskIds == null) {
            setExportTaskIds(new com.amazonaws.internal.SdkInternalList<String>(
                    exportTaskIds.length));
        }
        for (String ele : exportTaskIds) {
            this.exportTaskIds.add(ele);
        }
        return this;
    }

    /**
     *

     * One or more export task IDs.
     *

     *
     * @param exportTaskIds
     *        One or more export task IDs.
     * @return Returns a reference to this object so that method calls can be
     *         chained together.
     */

    public DescribeExportTasksRequest withExportTaskIds(
            java.util.Collection<String> exportTaskIds) {
        setExportTaskIds(exportTaskIds);
        return this;
    }

    /**
     * This method is intended for internal use only. Returns the marshaled
     * request configured with additional parameters to enable operation
     * dry-run.
     */
    @Override
    public Request<DescribeExportTasksRequest> getDryRunRequest() {
        Request<DescribeExportTasksRequest> request = new DescribeExportTasksRequestMarshaller()
                .marshall(this);
        request.addParameter("DryRun", Boolean.toString(true));
        return request;
    }

    /**
     * Returns a string representation of this object; useful for testing and
     * debugging.
     *
     * @return A string representation of this object.
     *
     * @see java.lang.Object#toString()
     */
    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append("{");
        if (getExportTaskIds() != null)
            sb.append("ExportTaskIds: " + getExportTaskIds());
        sb.append("}");
        return sb.toString();
    }

    @Override
    public boolean equals(Object obj) {
        if (this == obj)
            return true;
        if (obj == null)
            return false;

        if (obj instanceof DescribeExportTasksRequest == false)
            return false;
        DescribeExportTasksRequest other = (DescribeExportTasksRequest) obj;
        if (other.getExportTaskIds() == null ^ this.getExportTaskIds() == null)
            return false;
        if (other.getExportTaskIds() != null
                && other.getExportTaskIds().equals(this.getExportTaskIds()) == false)
            return false;
        return true;
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int hashCode = 1;

        hashCode = prime
                * hashCode
                + ((getExportTaskIds() == null) ? 0 : getExportTaskIds()
                        .hashCode());
        return hashCode;
    }

    @Override
    public DescribeExportTasksRequest clone() {
        return (DescribeExportTasksRequest) super.clone();
    }
}


text:
/**
 * Created by ZhangLiwei on 2017/2/20.
 */
const Doc=require("../../server/modal/Doc.modal.js");
const DB=require("../../server/lib/transactionDB.class.js");
const co=require("co");
const {getTestPool}=require("../config");

module.exports={
    "test create Doc table":function(test){
        var pool=getTestPool();
        co(function*(){
            yield new Doc().drop(pool);
            yield new Doc().create(pool);
            test.ok(true);
            test.done();
        }).catch(err=>{
            console.error(err);
            test.fail(err);
            test.done();
        });
    }
}


text:
void objc_exchangeInstanceMethodImplementations(const char* className, SEL originlSelector, SEL replacementSelector) {
	Class class = objc_getClass(className);
	Method originalMethod = class_getInstanceMethod(class, originlSelector);
	Method replacementMethod = class_getInstanceMethod(class, replacementSelector);
	method_exchangeImplementations(originalMethod, replacementMethod);
}

@implementation GrowlReeder
+ (void)load {
	objc_exchangeInstanceMethodImplementations("ReaderFetchItems", @selector(item:), @selector(growl_reeder_item:));
	objc_exchangeInstanceMethodImplementations("SubscriptionsViewController", @selector(readerDidSync:), @selector(growl_reeder_readerDidSync:));

	[GrowlApplicationBridge setGrowlDelegate:[self sharedInstance]];

	NSLog(@"GrowlReeder loaded");
}

#pragma mark -
#pragma mark Instantiations

+ (GrowlReeder *)sharedInstance {
	static id sharedInstance = nil;
	if(! sharedInstance) {
		sharedInstance = [[self alloc] init];
	}
	return sharedInstance;
}

- (id)init {
	self = [super init];
	if(self) {
		items = [[NSMutableArray alloc] init];
	}
	return self;
}

- (void)dealloc {
	[items release];
	[super dealloc];
}

#pragma mark -
#pragma mark Helpers

- (NSImage *)displayIconForFeedId:(NSString *)feedId {
	Class readerUserMetaClass = objc_getClass("ReaderUser");
	id user = objc_msgSend(readerUserMetaClass, @selector(defaultUser));
	if(user) {
		id store = objc_msgSend(user, @selector(store));
		id feed = objc_msgSend(store, @selector(feedWithId:), feedId);
		if(feed) {
			NSImage *icon = objc_msgSend(feed, @selector(displayIcon));
			return icon;
		}
	}
	return nil;
}

- (void)growl:(NSString *)message withTitle:(NSString *)title withIconData:(NSData *)iconData {
	[GrowlApplicationBridge notifyWithTitle:title
								description:message
						   notificationName:NEW_ARTICLE_NOTIFICATION_NAME
								   iconData:iconData
								   priority:0
								   isSticky:NO
							   clickContext:nil];
}

#pragma mark -
#pragma mark Interfaces for Reeder

- (void)fetchedReederItem:(NSDictionary *)item {
	NSArray *categories = [item valueForKey:@"categories"];
	BOOL read = NO;
	for(id obj in categories) {
		if([obj isKindOfClass:[NSString class]]) {
			NSString *category = (NSString *)obj;
			if([category hasSuffix:@"/read"]) {
				read = YES;
				break;
			}
		}
	}

	if(! read) {
		[items addObject:item];
	}
}

- (void)growlItems {
	int i, count = [items count];
	for(i = 0; i < count && i < MAX_NOTIFICATIONS_AT_ONCE; i++) {
		NSDictionary *item = [items objectAtIndex:i];

		NSDictionary *origin = [item valueForKey:@"origin"];
		NSData *iconData = nil;
		NSImage *icon = [self displayIconForFeedId:[origin valueForKey:@"streamId"]];
		if(icon) {
			iconData = [NSData dataWithData:[icon TIFFRepresentation]];
		}

		[self growl:[item valueForKey:@"title"] withTitle:[origin valueForKey:@"title"] withIconData:iconData];
	}

	int remains = count - i;
	if(remains > 0) {
		[self growl:[NSString stringWithFormat:@"And %d unread articles", remains] withTitle:@"Reeder" withIconData:nil];
	}

	[items removeAllObjects];
}

#pragma mark -
#pragma mark GrowlApplicationBridgeDelegate

- (NSDictionary *)registrationDictionaryForGrowl {
	NSArray *allNotifications = [NSArray arrayWithObjects:NEW_ARTICLE_NOTIFICATION_NAME, nil];
	return [NSDictionary dictionaryWithObjectsAndKeys:
			allNotifications, GROWL_NOTIFICATIONS_ALL,
			allNotifications, GROWL_NOTIFICATIONS_DEFAULT,
			nil];
}
@end

@implementation NSObject (GrowlReeder)

#pragma mark -
#pragma mark ReaderFetchItems

- (void)growl_reeder_item:(id)item {
#ifdef DEBUG
	NSLog(@"GrowlReeder: -growl_reeder_item:%@", item);
#endif
	[[GrowlReeder sharedInstance] fetchedReederItem:item];
	[self growl_reeder_item:item];
}

#pragma mark -
#pragma mark ReederMacAppDelegate

- (void)growl_reeder_readerDidSync:(NSNotification *)notification {
#ifdef DEBUG
	NSLog(@"GrowlReeder: -growl_reeder_readerDidSync:%@", notification);
#endif

	if([[notification name] isEqualToString:@"ReaderDidSync"]) {
		[[GrowlReeder sharedInstance] growlItems];
	}
	[self growl_reeder_readerDidSync:notification];
}
@end


text:
define(function(require, exports, module) {
    require("nav").init();
    require("menuleft").init();
    require("menuright").init();
    require("banner");
    require("focuswork");
    require("livetab").init();
    require("hotlesson").init();
    require("title").init();
    require("excelesson").init();
    require("wiki").init();
    require("strategy");
    require("toggleArrow").init();
    require("footer").init();
});


text:
<?php

/*
 * This file is part of the Active Collab DatabaseStructure project.
 *
 * (c) A51 doo <info@activecollab.com>. All rights reserved.
 */

namespace ActiveCollab\DatabaseStructure\Test\Fixtures\JsonField;

use ActiveCollab\DatabaseStructure\Field\Scalar\DateField;
use ActiveCollab\DatabaseStructure\Field\Scalar\JsonField;
use ActiveCollab\DatabaseStructure\Field\Scalar\JsonField\BoolValueExtractor;
use ActiveCollab\DatabaseStructure\Field\Scalar\JsonField\DateTimeValueExtractor;
use ActiveCollab\DatabaseStructure\Field\Scalar\JsonField\DateValueExtractor;
use ActiveCollab\DatabaseStructure\Field\Scalar\JsonField\FloatValueExtractor;
use ActiveCollab\DatabaseStructure\Field\Scalar\JsonField\IntValueExtractor;
use ActiveCollab\DatabaseStructure\Field\Scalar\JsonField\ValueExtractor;
use ActiveCollab\DatabaseStructure\Index;
use ActiveCollab\DatabaseStructure\Structure;

class JsonFieldStructure extends Structure
{
    public function configure()
    {
        $this->addType('stats_snapshots')->addFields(
            new DateField('day'),
            (new JsonField('stats'))
                ->extractValue('plan_name', '$.plan_name', null, ValueExtractor::class, true, true)
                ->extractValue('number_of_active_users', '$.users.num_active', null, IntValueExtractor::class, true)
                ->extractValue('is_used_on_day', '$.is_used_on_day', null, BoolValueExtractor::class, false)
                ->addValueExtractor(new FloatValueExtractor('execution_time', '$.exec_time', 0))
                ->addValueExtractor(new DateValueExtractor('important_date_1', '$.important_date_1', '2013-10-02'))
                ->addValueExtractor(new DateTimeValueExtractor('important_date_2_with_time', '$.important_date_2_with_time', '2016-05-09 09:11:00')),
        )->addIndex(new Index('day'));
    }
}


text:
package com.angkorteam.plugin.query.model;

import java.io.Serializable;

public class Field implements Serializable {

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

    private String name;

    private Object value;

    private String clazz;

    public Field() {
    }

    public Field(String name, Object value, String clazz) {
        super();
        this.name = name;
        this.value = value;
        this.clazz = clazz;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Object getValue() {
        return value;
    }

    public void setValue(Object value) {
        this.value = value;
    }

    public String getClazz() {
        return clazz;
    }

    public void setClazz(String clazz) {
        this.clazz = clazz;
    }
}


text:
require 'spec_helper'

RSpec.describe Phaxio do
  subject { Phaxio }

  it 'sets the api key' do
    subject.api_key = 'test-api-key'
    expect(subject.api_key).to eq('test-api-key')
  end

  it 'sets the api secret' do
    subject.api_secret = 'test-api-secret'
    expect(subject.api_secret).to eq('test-api-secret')
  end

  it 'sets the callback token' do
    subject.callback_token = 'test-callback-token'
    expect(subject.callback_token).to eq('test-callback-token')
  end
end


text:
<?
   include("security.php");
?>

<?
   include("header.php");
      if (empty($_POST['subject']) || empty($_POST['text']))
      {
?>
         <form method = 'post' action = 'clar.php'>

Subject: <input type='text' name='subject' size='30' maxlength='50' />

Text:

<textarea cols='50' rows='20' name='text'></textarea>

<input type='submit' value='Request clarification' class='mbutt'>

         </form>
<?
      }
      else
      {
         writeLog("$user sends question");
         $num = (int) trim(file_get_contents("data/clarcnt"));
         write_string("data/clarcnt", $num + 1);
         write_string("data/clars/$num.subj", $_POST['subject']);
         write_string("data/clars/$num.text", $_POST['text']);
         write_string("data/clars/$num.user", $user);
         print "

Request was successfully sent.

";
      }
?>


text:
ACCEPTED

#### According to
Index Fungorum

#### Published in
in Hooker, Fl. Crypt. Antilles Franç. 1(II): 200 (1844)

#### Original name
Porina granulata Hook. f. & Taylor

### Remarks
null


text:
class AddShowMcqAnswerToCourseAssessments < ActiveRecord::Migration[5.2]
  def change
    add_column :course_assessments, :show_mcq_answer, :boolean, default: true
  end
end


text:
ACCEPTED

#### According to
Index Fungorum

#### Published in
Florule Finistère (Paris) 39 (1867)

#### Original name
Hypomyces albus P. Crouan & H. Crouan

### Remarks
null


text:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
	<modelVersion>4.0.0</modelVersion>
	<groupId>com.autodesk.icp</groupId>
	<artifactId>community</artifactId>
	<version>1.0.1-SNAPSHOT</version>
	<packaging>pom</packaging>

	<!-- Project Modules -->
	<modules>
		<module>community-server</module>
		<module>community-common</module>
		<module>community-mobile-android</module>
	</modules>

	<properties>
		<java.version>1.7</java.version>
		<slf4j.version>1.7.12</slf4j.version>
		<jackson.version>2.5.2</jackson.version>
		<junit.version>4.12</junit.version>
		<powermock.version>1.5.6</powermock.version>
		<spring.version>4.1.6.RELEASE</spring.version>
		<aspectj.version>1.8.5</aspectj.version>
	</properties>

	<build>
		<pluginManagement>
			<plugins>
				<plugin>
					<groupId>org.apache.maven.plugins</groupId>
					<artifactId>maven-compiler-plugin</artifactId>
					<version>3.1</version>
					<configuration>
						<source>${java.version}</source>
						<target>${java.version}</target>
						<encoding>UTF-8</encoding>
					</configuration>
				</plugin>
				<plugin>
					<groupId>org.apache.maven.plugins</groupId>
					<artifactId>maven-resources-plugin</artifactId>
					<version>2.5</version>
					<configuration>
						<encoding>UTF-8</encoding>
					</configuration>
				</plugin>
				<plugin>
					<groupId>org.apache.maven.plugins</groupId>
					<artifactId>maven-dependency-plugin</artifactId>
					<version>2.9</version>
				</plugin>
				<plugin>
					<groupId>org.apache.maven.plugins</groupId>
					<artifactId>maven-javadoc-plugin</artifactId>
					<version>2.9.1</version>
				</plugin>
				<plugin>
					<groupId>org.apache.maven.plugins</groupId>
					<artifactId>maven-release-plugin</artifactId>
					<version>2.5</version>
					<dependencies>
						<dependency>
							<groupId>org.apache.maven.scm</groupId>
							<artifactId>maven-scm-provider-perforce</artifactId>
							<version>1.8</version>
						</dependency>
					</dependencies>
				</plugin>
				<plugin>
					<groupId>org.apache.maven.plugins</groupId>
					<artifactId>maven-clean-plugin</artifactId>
					<version>2.5</version>
				</plugin>
				<plugin>
					<groupId>org.apache.maven.plugins</groupId>
					<artifactId>maven-surefire-plugin</artifactId>
					<version>2.16</version>
				</plugin>
				<plugin>
					<groupId>org.apache.maven.plugins</groupId>
					<artifactId>maven-failsafe-plugin</artifactId>
					<version>2.16</version>
					<executions>
						<execution>
							<goals>
								<goal>integration-test</goal>
								<goal>verify</goal>
							</goals>
						</execution>
					</executions>
				</plugin>
				<plugin>
					<groupId>org.apache.maven.plugins</groupId>
					<artifactId>maven-install-plugin</artifactId>
					<version>2.5.1</version>
				</plugin>
				<plugin>
					<groupId>org.apache.maven.plugins</groupId>
					<artifactId>maven-assembly-plugin</artifactId>
					<version>2.2</version>
				</plugin>
				<plugin>
					<groupId>org.apache.maven.plugins</groupId>
					<artifactId>maven-site-plugin</artifactId>
					<version>3.2</version>
				</plugin>
				<plugin>
					<groupId>org.apache.maven.plugins</groupId>
					<artifactId>maven-deploy-plugin</artifactId>
					<version>2.7</version>
				</plugin>
				<plugin>
					<groupId>org.apache.maven.plugins</groupId>
					<artifactId>maven-source-plugin</artifactId>
					<version>2.3</version>
				</plugin>
				<plugin>
					<groupId>org.apache.maven.plugins</groupId>
					<artifactId>maven-scm-plugin</artifactId>
					<version>1.4</version>
					<dependencies>
						<dependency>
							<groupId>com.perforce</groupId>
							<artifactId>p4maven</artifactId>
							<version>[2011,2012)</version>
						</dependency>
					</dependencies>
				</plugin>
				<plugin>
					<groupId>org.apache.maven.plugins</groupId>
					<artifactId>maven-shade-plugin</artifactId>
					<version>2.3</version>
				</plugin>
				<plugin>
					<groupId>org.codehaus.mojo</groupId>
					<artifactId>cobertura-maven-plugin</artifactId>
					<version>2.6</version>
				</plugin>
				<plugin>
					<groupId>org.codehaus.mojo</groupId>
					<artifactId>versions-maven-plugin</artifactId>
					<version>2.1</version>
					<configuration>
						<includesList>com.autodesk.infraworks360.traffic</includesList>
						<generateBackupPoms>false</generateBackupPoms>
						<allowSnapshots>true</allowSnapshots>
						<allowIncrementalUpdates>true</allowIncrementalUpdates>
						<allowMinorUpdates>true</allowMinorUpdates>
						<allowMajorUpdates>true</allowMajorUpdates>
					</configuration>
				</plugin>
			</plugins>
		</pluginManagement>
	</build>

	<dependencyManagement>
		<dependencies>
			<!-- Autodesk internal modules -->
			<dependency>
				<groupId>com.autodesk.security</groupId>
				<artifactId>cred-storage-util</artifactId>
				<version>1.0.0</version>
			</dependency>

			<!-- Apache/Jakarta -->
			<dependency>
				<groupId>commons-codec</groupId>
				<artifactId>commons-codec</artifactId>
				<version>1.9</version>
			</dependency>
			<dependency>
				<groupId>commons-lang</groupId>
				<artifactId>commons-lang</artifactId>
				<version>2.6</version>
			</dependency>
			<dependency>
				<groupId>commons-fileupload</groupId>
				<artifactId>commons-fileupload</artifactId>
				<version>1.3.1</version>
			</dependency>
			<dependency>
				<groupId>commons-io</groupId>
				<artifactId>commons-io</artifactId>
				<version>2.4</version>
			</dependency>
			<dependency>
				<groupId>commons-discovery</groupId>
				<artifactId>commons-discovery</artifactId>
				<version>0.5</version>
			</dependency>
			<dependency>
				<groupId>commons-pool</groupId>
				<artifactId>commons-pool</artifactId>
				<version>1.6</version>
			</dependency>

			<!-- Logging -->
			<dependency>
				<groupId>org.slf4j</groupId>
				<artifactId>slf4j-api</artifactId>
				<version>${slf4j.version}</version>
			</dependency>
			<dependency>
				<groupId>org.slf4j</groupId>
				<artifactId>log4j-over-slf4j</artifactId>
				<version>${slf4j.version}</version>
			</dependency>
			<dependency>
				<groupId>org.slf4j</groupId>
				<artifactId>slf4j-log4j12</artifactId>
				<version>${slf4j.version}</version>
			</dependency>
			<dependency>
				<groupId>org.slf4j</groupId>
				<artifactId>slf4j-android</artifactId>
				<version>${slf4j.version}</version>
			</dependency>
			<dependency>
				<groupId>org.slf4j</groupId>
				<artifactId>jcl-over-slf4j</artifactId>
				<version>${slf4j.version}</version>
			</dependency>
			<dependency>
				<groupId>org.slf4j</groupId>
				<artifactId>jul-to-slf4j</artifactId>
				<version>${slf4j.version}</version>
			</dependency>

			<!-- XML Processing -->
			<dependency>
				<groupId>org.jdom</groupId>
				<artifactId>jdom</artifactId>
				<version>1.1</version>
			</dependency>
			<dependency>
				<groupId>javax.xml.bind</groupId>
				<artifactId>jaxb-api</artifactId>
				<version>2.1</version>
			</dependency>
			<dependency>
				<groupId>xerces</groupId>
				<artifactId>xercesImpl</artifactId>
				<version>2.8.1</version>
			</dependency>

			<!-- Spring -->
			<dependency>
				<groupId>org.springframework</groupId>
				<artifactId>spring-core</artifactId>
				<version>${spring.version}</version>
			</dependency>
			<dependency>
				<groupId>org.springframework</groupId>
				<artifactId>spring-beans</artifactId>
				<version>${spring.version}</version>
			</dependency>
			<dependency>
				<groupId>org.springframework</groupId>
				<artifactId>spring-context</artifactId>
				<version>${spring.version}</version>
			</dependency>
			<dependency>
				<groupId>org.springframework</groupId>
				<artifactId>spring-web</artifactId>
				<version>${spring.version}</version>
			</dependency>
			<dependency>
				<groupId>org.springframework</groupId>
				<artifactId>spring-webmvc</artifactId>
				<version>${spring.version}</version>
			</dependency>
			<dependency>
				<groupId>org.springframework</groupId>
				<artifactId>spring-oxm</artifactId>
				<version>${spring.version}</version>
			</dependency>
			<dependency>
				<groupId>org.springframework</groupId>
				<artifactId>spring-aop</artifactId>
				<version>${spring.version}</version>
			</dependency>
			<dependency>
				<groupId>org.springframework</groupId>
				<artifactId>spring-websocket</artifactId>
				<version>${spring.version}</version>
			</dependency>
			<dependency>
				<groupId>org.springframework</groupId>
				<artifactId>spring-messaging</artifactId>
				<version>${spring.version}</version>
			</dependency>

			<!-- Aspectj -->
			<dependency>
				<groupId>org.aspectj</groupId>
				<artifactId>aspectjrt</artifactId>
				<version>${aspectj.version}</version>
			</dependency>
			<dependency>
				<groupId>org.aspectj</groupId>
				<artifactId>aspectjweaver</artifactId>
				<version>${aspectj.version}</version>
			</dependency>

			<!-- Caching -->
			<dependency>
				<groupId>net.sf.ehcache</groupId>
				<artifactId>ehcache</artifactId>
				<version>1.5.0</version>
			</dependency>

			<!-- Http Client -->
			<dependency>
				<groupId>org.apache.httpcomponents</groupId>
				<artifactId>httpclient</artifactId>
				<version>4.3.2</version>
			</dependency>
			<dependency>
				<groupId>org.apache.httpcomponents</groupId>
				<artifactId>httpcore</artifactId>
				<version>4.3.1</version>
			</dependency>

			<!-- Jackson -->
			<dependency>
				<groupId>com.fasterxml.jackson.core</groupId>
				<artifactId>jackson-core</artifactId>
				<version>${jackson.version}</version>
			</dependency>
			<dependency>
				<groupId>com.fasterxml.jackson.core</groupId>
				<artifactId>jackson-databind</artifactId>
				<version>${jackson.version}</version>
			</dependency>
			<dependency>
				<groupId>com.fasterxml.jackson.jaxrs</groupId>
				<artifactId>jackson-jaxrs-json-provider</artifactId>
				<version>${jackson.version}</version>
			</dependency>

			<!-- Testing -->
			<dependency>
				<groupId>org.springframework</groupId>
				<artifactId>spring-test</artifactId>
				<version>${spring.version}</version>
				<scope>test</scope>
			</dependency>
			<dependency>
				<groupId>junit</groupId>
				<artifactId>junit</artifactId>
				<version>${junit.version}</version>
				<scope>test</scope>
			</dependency>
			<dependency>
				<groupId>org.mockito</groupId>
				<artifactId>mockito-all</artifactId>
				<version>1.9.5</version>
				<scope>test</scope>
			</dependency>
			<dependency>
				<groupId>org.powermock</groupId>
				<artifactId>powermock-module-junit4</artifactId>
				<version>${powermock.version}</version>
				<scope>test</scope>
			</dependency>
			<dependency>
				<groupId>org.powermock</groupId>
				<artifactId>powermock-api-mockito</artifactId>
				<version>${powermock.version}</version>
				<scope>test</scope>
			</dependency>
			<dependency>
				<groupId>org.powermock</groupId>
				<artifactId>powermock-module-junit4-rule-agent</artifactId>
				<version>${powermock.version}</version>
				<scope>test</scope>
			</dependency>
		</dependencies>
	</dependencyManagement>

	<dependencies>
		<dependency>
			<groupId>org.slf4j</groupId>
			<artifactId>slf4j-api</artifactId>
		</dependency>
		<dependency>
			<groupId>junit</groupId>
			<artifactId>junit</artifactId>
		</dependency>
		<dependency>
			<groupId>org.mockito</groupId>
			<artifactId>mockito-all</artifactId>
		</dependency>
		<dependency>
			<groupId>org.powermock</groupId>
			<artifactId>powermock-module-junit4</artifactId>
		</dependency>
		<dependency>
			<groupId>org.powermock</groupId>
			<artifactId>powermock-api-mockito</artifactId>
		</dependency>
		<dependency>
			<groupId>org.powermock</groupId>
			<artifactId>powermock-module-junit4-rule-agent</artifactId>
		</dependency>
	</dependencies>
</project>


text:
urlwait
./bin/run-common.sh
exec python3 manage.py runserver 0.0.0.0:8000


text:
package com.google.zxing;

import java.util.Map;

// Referenced classes of package com.google.zxing:
//            BinaryBitmap, Result

public interface Reader
{

    public abstract Result decode(BinaryBitmap binarybitmap);

    public abstract Result decode(BinaryBitmap binarybitmap, Map map);

    public abstract void reset();
}


text:
using System;
using System.Collections.Generic;
using Marklight;
using UnityEditor;
using UnityEngine;

namespace MarkLight.Editor
{
    /// <summary>
    /// Custom inspector for ViewPresenter components.
    /// </summary>
    [CustomEditor(typeof(ViewPresenter))]
    public class ViewPresenterInspector : UnityEditor.Editor
    {
        #region Methods

        /// <summary>
        /// Called when inspector GUI is to be rendered.
        /// </summary>
        public override void OnInspectorGUI() {
            //DrawDefaultInspector();

            var presenter = (ViewPresenter) target;

            // main view selection
            var selectedIndex = presenter.ViewTypeNames.IndexOf(presenter.MainView) + 1;

            // .. add empty selection
            var mainOptions = new List<string>(presenter.ViewTypeNames);
            mainOptions.Insert(0, "-- none --");

            // .. add drop-down logic
            var newSelectedIndex = EditorGUILayout.Popup("Main View", selectedIndex, mainOptions.ToArray());

            presenter.MainView = newSelectedIndex > 0
                ? presenter.ViewTypeNames[newSelectedIndex - 1]
                : String.Empty;

            if (newSelectedIndex != selectedIndex)
            {
                // .. trigger reload on view presenter
                if (!presenter.DisableAutomaticReload)
                    ViewData.GenerateViews();
            }

            // default theme selection
            var selectedThemeIndex = presenter.ThemeNames.IndexOf(presenter.DefaultTheme) + 1;

            // .. add empty selection
            var themeOptions = new List<string>(presenter.ThemeNames);
            themeOptions.Insert(0, "-- none --");

            // .. add drop-down logic
            var newSelectedThemeIndex =
                EditorGUILayout.Popup("Default Theme", selectedThemeIndex, themeOptions.ToArray());

            presenter.DefaultTheme = newSelectedThemeIndex > 0
                ? presenter.ThemeNames[newSelectedThemeIndex - 1]
                : String.Empty;

            if (newSelectedThemeIndex != selectedThemeIndex)
            {
                // .. trigger reload on view presenter
                if (!presenter.DisableAutomaticReload)
                    ViewData.GenerateViews();
            }

            // hex color type
            var hexColorTypeContent = new GUIContent("Hex Color Type",
                "The type of hex color codes used when dealing alpha values.");
            var newHexColorType = EditorGUILayout.EnumPopup(hexColorTypeContent, presenter.HexColorType);
            if (!presenter.HexColorType.Equals(newHexColorType))
            {
                presenter.HexColorType = (HexColorType)newHexColorType;
            }

            // unit size option
            var unitSizeContent = new GUIContent("Unit Size",
                "User-defined unit size that can be used in XUML, e.g. Offset=\"12ux, 4uy\"");
            var newUnitSize = EditorGUILayout.Vector3Field(unitSizeContent, presenter.UnitSize);
            if (newUnitSize != presenter.UnitSize)
            {
                presenter.UnitSize = newUnitSize;
            }

            // base directory
            var baseDirectoryContent = new GUIContent("Base Directory",
                "Base directory that will be prepended to assets paths in XUML. E.g. \"Assets/Path/To/Folder/\"");
            var newBaseDirectory = EditorGUILayout.TextField(baseDirectoryContent, presenter.BaseDirectory);
            if (newBaseDirectory != presenter.BaseDirectory)
            {
                presenter.BaseDirectory = newBaseDirectory;
            }

            // default resource dictionary language
            var defaultLanguageContent = new GUIContent("Default Language",
                "Default language to be set on the resource dictionary");
            var defaultLanguage = EditorGUILayout.TextField(defaultLanguageContent, presenter.DefaultLanguage);
            if (defaultLanguage != presenter.DefaultLanguage)
            {
                presenter.DefaultLanguage = defaultLanguage;
            }

            // default resource dictionary platform
            var defaultPlatformContent = new GUIContent("Default Platform",
                "Default platform to be set on the resource dictionary");
            var defaultPlatform = EditorGUILayout.TextField(defaultPlatformContent, presenter.DefaultPlatform);
            if (defaultPlatform != presenter.DefaultPlatform)
            {
                presenter.DefaultPlatform = defaultPlatform;
            }

            // disable automatic reload option
            var disableReloadContent = new GUIContent("Disable Automatic Reload",
                "When checked views are only reloaded when the \"Reload Views\" button is clicked.");
            presenter.DisableAutomaticReload =
                EditorGUILayout.Toggle(disableReloadContent, presenter.DisableAutomaticReload);

            // generate XSD schema
            var generateSchemaContent = new GUIContent("Generate Schema",
                "Generates a new XSD schema for all the views. Used to get intellisense when editing XUML in "+
                "visual studio. Schema need to be generated when new views are added, renamed or new view "+
                "fields are added.");
            if (GUILayout.Button(generateSchemaContent))
            {
                ViewPostprocessor.GenerateXsdSchema();
            }

            // reload button
            var reloadViewsContent = new GUIContent("Reload Views",
                "Reloads the views in the scene. Views are automatically reloaded when XUML changes. "+
                "The views need to be manually reloaded when XUML has been edited while the editor was closed "+
                "or when only code (view models) has been modified.");
            if (GUILayout.Button(reloadViewsContent))
            {
                // .. trigger reload of views
                ViewPostprocessor.ProcessViewAssets();
            }
        }

        #endregion
    }
}


text:
package com.sequenceiq.cloudbreak.core.flow2.chain;

import static com.sequenceiq.cloudbreak.core.flow2.externaldatabase.terminate.config.ExternalDatabaseTerminationEvent.START_EXTERNAL_DATABASE_TERMINATION_EVENT;

import java.util.Queue;
import java.util.concurrent.ConcurrentLinkedQueue;

import org.springframework.stereotype.Component;

import com.sequenceiq.cloudbreak.common.event.Selectable;
import com.sequenceiq.cloudbreak.core.flow2.cluster.termination.ClusterTerminationEvent;
import com.sequenceiq.cloudbreak.core.flow2.stack.termination.StackTerminationEvent;
import com.sequenceiq.cloudbreak.reactor.api.event.StackEvent;
import com.sequenceiq.cloudbreak.reactor.api.event.stack.TerminationEvent;
import com.sequenceiq.flow.core.chain.FlowEventChainFactory;
import com.sequenceiq.flow.core.chain.config.FlowTriggerEventQueue;

@Component
public class TerminationFlowEventChainFactory implements FlowEventChainFactory<TerminationEvent> {
    @Override
    public String initEvent() {
        return FlowChainTriggers.TERMINATION_TRIGGER_EVENT;
    }

    @Override
    public FlowTriggerEventQueue createFlowTriggerEventQueue(TerminationEvent event) {
        Queue<Selectable> flowEventChain = new ConcurrentLinkedQueue<>();
        flowEventChain.add(new StackEvent(ClusterTerminationEvent.TERMINATION_EVENT.event(), event.getResourceId(), event.accepted()));
        flowEventChain.add(new TerminationEvent(START_EXTERNAL_DATABASE_TERMINATION_EVENT.event(), event.getResourceId(), event.getTerminationType(),
                event.accepted()));
        flowEventChain.add(new TerminationEvent(StackTerminationEvent.TERMINATION_EVENT.event(), event.getResourceId(), event.getTerminationType(),
                event.accepted()));
        return new FlowTriggerEventQueue(getName(), event, flowEventChain);
    }
}


text:
module Sprockets
  module Utils
    class Gzip
      # Private: Generates a gzipped file based off of reference file.
      def initialize(asset)
        @content_type  = asset.content_type
        @source        = asset.source
        @charset       = asset.charset
      end

      # What non-text mime types should we compress? This list comes from:
      # https://www.fastly.com/blog/new-gzip-settings-and-deciding-what-compress
      COMPRESSABLE_MIME_TYPES = {
        "application/vnd.ms-fontobject" => true,
        "application/x-font-opentype" => true,
        "application/x-font-ttf" => true,
        "image/x-icon" => true,
        "image/svg+xml" => true
      }

      # Private: Returns whether or not an asset can be compressed.
      #
      # We want to compress any file that is text based.
      # You do not want to compress binary
      # files as they may already be compressed and running them
      # through a compression algorithm would make them larger.
      #
      # Return Boolean.
      def can_compress?(mime_types)
        # The "charset" of a mime type is present if the value is
        # encoded text. We can check this value to see if the asset
        # can be compressed.
        #
        # We also check against our list of non-text compressible mime types
        @charset || COMPRESSABLE_MIME_TYPES.include?(@content_type)
      end

      # Private: Opposite of `can_compress?`.
      #
      # Returns Boolean.
      def cannot_compress?(mime_types)
        !can_compress?(mime_types)
      end

      # Private: Generates a gzipped file based off of reference asset.
      #
      # Compresses the target asset's contents and puts it into a file with
      # the same name plus a `.gz` extension in the same folder as the original.
      # Does not modify the target asset.
      #
      # Returns nothing.
      def compress(target)
        mtime = PathUtils.stat(target).mtime
        PathUtils.atomic_write("#{target}.gz") do |f|
          gz = Zlib::GzipWriter.new(f, Zlib::BEST_COMPRESSION)
          gz.mtime = mtime
          gz.write(@source)
          gz.close

          File.utime(mtime, mtime, f.path)
        end

        nil
      end
    end
  end
end