text:
package net.imagej.ops.image.integral;

import net.imagej.ops.Contingent;
import net.imagej.ops.Ops;
import net.imagej.ops.Ops.Slice;
import net.imagej.ops.special.computer.Computers;
import net.imagej.ops.special.computer.UnaryComputerOp;
import net.imagej.ops.special.function.Functions;
import net.imagej.ops.special.function.UnaryFunctionOp;
import net.imagej.ops.special.hybrid.AbstractUnaryHybridCF;
import net.imagej.ops.special.hybrid.AbstractUnaryHybridCI;
import net.imglib2.Dimensions;
import net.imglib2.IterableInterval;
import net.imglib2.RandomAccessibleInterval;
import net.imglib2.type.numeric.IntegerType;
import net.imglib2.type.numeric.RealType;
import net.imglib2.type.numeric.integer.LongType;
import net.imglib2.type.numeric.real.DoubleType;
import net.imglib2.util.Util;
import net.imglib2.view.Views;

/**
 * Abstract base class for <i>n</i>-dimensional integral images.
 *
 * @param <I> The type of the input image.
 * @author Stefan Helfrich (University of Konstanz)
 */
@SuppressWarnings("rawtypes")
public abstract class AbstractIntegralImg<I extends RealType<I>> extends
	AbstractUnaryHybridCF<RandomAccessibleInterval<I>, RandomAccessibleInterval<RealType<?>>>
	implements Contingent
{

	private UnaryComputerOp[] slicewiseOps;
	private UnaryFunctionOp<Dimensions, RandomAccessibleInterval> createLongRAI;
	private UnaryFunctionOp<Dimensions, RandomAccessibleInterval> createDoubleRAI;

	@Override
	public void initialize() {
		if (in() != null) {
			slicewiseOps = new UnaryComputerOp[in().numDimensions()];

			for (int i = 0; i < in().numDimensions(); ++i) {
				slicewiseOps[i] = Computers.unary(ops(), Slice.class,
					RandomAccessibleInterval.class, RandomAccessibleInterval.class,
					getComputer(i), i);
			}
		}

		createLongRAI = Functions.unary(ops(), Ops.Create.Img.class,
			RandomAccessibleInterval.class, Dimensions.class, new LongType());
		createDoubleRAI = Functions.unary(ops(), Ops.Create.Img.class,
			RandomAccessibleInterval.class, Dimensions.class, new DoubleType());
	}

	@SuppressWarnings("unchecked")
	@Override
	public void compute(final RandomAccessibleInterval<I> input,
		final RandomAccessibleInterval<RealType<?>> output)
	{
		// TODO Should become obsolete (duplication of initialize())
		if (slicewiseOps == null) {
			slicewiseOps = new UnaryComputerOp[in().numDimensions()];

			for (int i = 0; i < in().numDimensions(); ++i) {
				slicewiseOps[i] = Computers.unary(ops(), Slice.class,
					RandomAccessibleInterval.class, RandomAccessibleInterval.class,
					getComputer(i), i);
			}
		}

		// HACK Generalized to most common supertype of input and output
		RandomAccessibleInterval<? extends RealType<?>> generalizedInput = input;

		// Create integral image
		for (int i = 0; i < input.numDimensions(); ++i) {
			// Slicewise integral addition in one direction
			slicewiseOps[i].compute(generalizedInput, output);
			generalizedInput = output;
		}
	}

	@SuppressWarnings("unchecked")
	@Override
	public RandomAccessibleInterval<RealType<?>> createOutput(
		final RandomAccessibleInterval<I> input)
	{
		// Create integral image
		if (Util.getTypeFromInterval(input) instanceof IntegerType) {
			return createLongRAI.calculate(input);
		}

		return createDoubleRAI.calculate(input);
	}

	@Override
	public boolean conforms() {
		return (in() != null && out() != null) ? Views.iterable(in())
			.iterationOrder().equals(Views.iterable(out())) : true;
	}

	/**
	 * Implements the row-wise addition required for computations of integral
	 * images.
	 */
	public abstract
		AbstractUnaryHybridCI<IterableInterval<I>, IterableInterval<I>> getComputer(
			int dimension);

}


text:
using System;
using System.Reflection;

[assembly: AssemblyProduct("Ditto.AsyncInit")]
[assembly: AssemblyCompany("Dmitry Shechtman")]
[assembly: AssemblyCopyright("Copyright © Dmitry Shechtman 2014-2015")]

[assembly: CLSCompliant(false)]

redpajama_set_name: RedPajamaGithub


text:
/*! @file   WorkLib.cpp EclipseIR WorkLib definitions
 */
#include "WorkLib.h"
#include "Version.h"
#include <CommonVersion.h>

#include <QtDebug>

DEFINE_SINGLETON(WorkLib)
const WorkLib * cgpWork = WorkLib::pointer();

/*! @fn WorkLib::WorkLib(void)
 *
 * @brief WorkLib::WorkLib initializes the WorkLib class.
 */
WorkLib::WorkLib(void)
    : ModuleInfo(MODULE_NAME)
{
    setVersion();
}


text:
<?php

class CloudMngrServerGluster extends CloudMngrServerModule{
	protected $module_display_name = "Gluster Filesystem";

	function __construct($group_id="", $region_id=""){
		parent::__construct($group_id, $region_id);
	}

}


text:
> Grunt task for generating CSS with 2x background-images.

## Getting Started
This task requires Grunt `~0.4.0`

If you haven't used [Grunt](http://gruntjs.com/) before, be sure to check out the [Getting Started](http://gruntjs.com/getting-started) guide, as it explains how to create a [Gruntfile](http://gruntjs.com/sample-gruntfile) as well as install and use Grunt plugins. Once you're familiar with that process, you may install this plugin. To install it you can simply clone it to your project node modules.
Once the plugin has been installed, it may be enabled inside your Gruntfile with this line of JavaScript:

```js
grunt.loadNpmTasks('grunt-retina-css');
```
### Settings

There are a number of options available, which are described below. Please review the [minimatch options](https://github.com/isaacs/minimatch#options) if you didn't before.

#### src
Type: `String|Array`

This defines what file patterns this task will take into account. Can be a string or an array of files and/or minimatch patterns.

#### cwd
Type: `String`

It defines base directory for source files.

#### dest

Type: `String`

It defines base directory for output files.

#### options.retinaPrefix
Type: `String`

This defines pattern to find retina images. It is used to determine background styles, which should be processed.

#### options.resultsCSSFileName
Type: `String|Undefined`

This option defines if we need to write all generated styles to the single file. If it is not defined, result would be appended to the copy of source file.

## Usage example

You can see usage example below. A couple of demos is also placed into repo.
Here is the task configuration example.

```javascript
"retinify": {
    "single": {
        "options": {
            // img1.jpg generates link to img1-x2.jpg
            "retinaPrefix": '-x2',
            // output file name (to write all generated styles into single file)
            "resultsCSSFileName": 'media.css'
        },
        "cwd": 'demo/src',
        "dest": 'demo/out',
        "src": ['*.css']
    }
}
```
Input css files examples:

styles1.css:

```css
.class-name2 > #some-id, .new-class {
    background: url('/demo/img/fxt1.gif');
}
```

styles2.css:

```css
.class-name2 > #some-id, .new-class {
    background-image: url('/demo/img/fxt2.gif');
}
```

Processing result is going to look like this.
media.css:

```css
@media (x2) {
    .class-name2 > #some-id, .new-class {
        background: url('/demo/img/fxt1-x2.gif');
    }
    .class-name2 > #some-id, .new-class {
        background-image: url('/demo/img/fxt2-x2.gif');
    }
}
```

## License

MIT


text:
// Copyright (c) Microsoft Corporation
// Licensed under the MIT license. See LICENSE file in the project root for full license information.

#pragma once

#define DEFAULT_LOGGER xbox::services::logger::get_logger()
#define IF_LOGGER_ENABLED(logger) if(logger != nullptr)

#define LOG(logger, level, category, msg) IF_LOGGER_ENABLED(logger) logger->add_log(xbox::services::log_entry(level, category, msg))
#define LOGS(logger, level, category) IF_LOGGER_ENABLED(logger) *logger += xbox::services::log_entry(level, category)

// default logging macro
const char defaultCategory[] = "";
#define IF_LOG_ERROR() IF_LOG_LEVEL_ENABLED(DEFAULT_LOGGER, xbox::services::log_level::error)
#define LOG_ERROR(msg) LOG(DEFAULT_LOGGER, xbox::services::log_level::error, defaultCategory, msg)
#define LOG_ERROR_IF(boolean_expression, msg) if(boolean_expression) LOG_ERROR(msg)
#define LOGS_ERROR LOGS(DEFAULT_LOGGER, xbox::services::log_level::error, defaultCategory)
#define LOGS_ERROR_IF(boolean_expression) if(boolean_expression) LOGS_ERROR

#define IF_LOG_WARN() IF_LOG_LEVEL_ENABLED(DEFAULT_LOGGER, xbox::services::log_level::warn)
#define LOG_WARN(msg) LOG(DEFAULT_LOGGER, xbox::services::log_level::warn, defaultCategory, msg)
#define LOG_WARN_IF(boolean_expression, msg) if(boolean_expression) LOG_WARN(msg)
#define LOGS_WARN LOGS(DEFAULT_LOGGER, xbox::services::log_level::warn, defaultCategory)
#define LOGS_WARN_IF(boolean_expression) if(boolean_expression) LOGS_WARN

#define IF_LOG_INFO() IF_LOG_LEVEL_ENABLED(DEFAULT_LOGGER, xbox::services::log_level::info)
#define LOG_INFO(msg) LOG(DEFAULT_LOGGER, xbox::services::log_level::info, defaultCategory, msg)
#define LOG_INFO_IF(boolean_expression, msg) if(boolean_expression) LOG_INFO(msg)
#define LOGS_INFO LOGS(DEFAULT_LOGGER, xbox::services::log_level::info, defaultCategory)
#define LOGS_INFO_IF(boolean_expression) if(boolean_expression) LOGS_INFO

#define IF_LOG_DEBUG() IF_LOG_LEVEL_ENABLED(DEFAULT_LOGGER, xbox::services::log_level::debug)
#define LOG_DEBUG(msg) LOG(DEFAULT_LOGGER, xbox::services::log_level::debug, defaultCategory, msg)
#define LOG_DEBUG_IF(boolean_expression, msg) if(boolean_expression) LOG_DEBUG(msg)
#define LOGS_DEBUG LOGS(DEFAULT_LOGGER, xbox::services::log_level::debug, defaultCategory)
#define LOGS_DEBUG_IF(boolean_expression) if(boolean_expression) LOGS_DEBUG

NAMESPACE_MICROSOFT_XBOX_SERVICES_CPP_BEGIN

enum class log_level
{
    off,
    error,
    warn,
    info,
    debug
};

class log_entry
{
public:
    log_entry(log_level level, std::string category);

    log_entry(log_level level, std::string category, std::string msg);

    std::string level_to_string() const;

    const std::stringstream& msg_stream() const { return m_message; }

    const std::string& category() const { return m_category; }
    log_level get_log_level() const { return m_logLevel;  }

    log_entry& operator<<(const char* data)
    {
        m_message << utility::conversions::to_utf8string(data);
        return *this;
    }

    log_entry& operator<<(const std::string& data)
    {
        m_message << utility::conversions::to_utf8string(data);
        return *this;
    }

#if !XSAPI_U
    log_entry& operator<<(const wchar_t* data)
    {
        m_message << utility::conversions::to_utf8string(data);
        return *this;
    }

    log_entry& operator<<(const std::wstring& data)
    {
        m_message << utility::conversions::to_utf8string(data);
        return *this;
    }
#endif

    template<typename T>
    log_entry& operator<<(const T& data)
    {
        m_message << data;
        return *this;
    }

private:
    log_level m_logLevel;
    std::string m_category;
    std::stringstream m_message;
};

enum log_output_level_setting
{
    use_logger_setting,
    use_own_setting
};

class log_output
{
public:
    // When log_output_type is set to use_logger_setting, the level parameter will be ignored.
    log_output(log_output_level_setting type, log_level level);

    virtual void add_log(_In_ const log_entry& entry);

    log_output_level_setting level_setting() const { return m_levelSetting; }

    bool log_level_enabled(log_level level) const { return level <= m_logLevel; }

    void set_log_level(log_level level) { m_logLevel = level; }

protected:
    // This function is to write the string to the final output, don't need to be thread safe.
    virtual void write(_In_ const std::string& msg);

    virtual std::string format_log(_In_ const log_entry& entry);

private:
    log_output_level_setting m_levelSetting;
    log_level m_logLevel;
    mutable std::mutex m_mutex;
};

class logger
{
public:
    logger() : m_logLevel(log_level::warn) {}

    static void create_logger() { get_xsapi_singleton()->m_logger = std::make_shared<logger>();  }
    static void release_logger()
    {
        auto singleton = get_xsapi_singleton(false);
        if( singleton ) singleton->m_logger = nullptr;
    }
    static const std::shared_ptr<logger>& get_logger() { return get_xsapi_singleton()->m_logger; }

    void set_log_level(log_level level);

    void add_log_output(std::shared_ptr<log_output> output);

    void add_log(const log_entry& entry);
    void operator+=(const log_entry& record);

private:
    std::vector<std::shared_ptr<log_output>> m_log_outputs;
    log_level m_logLevel;
};

NAMESPACE_MICROSOFT_XBOX_SERVICES_CPP_END


text:
package com.shunwang.api.request.pay;

import com.shunwang.api.mapping.SWApiDocs;
import com.shunwang.api.mapping.SWApiField;
import com.shunwang.api.response.pay.SWMoneyUnforstResponse;

import java.util.Map;

/**
 * @author min.da
 * @since 2015-12-25
 */
@SWApiDocs(code = "10", name = "实名认证后解冻", service = "money_unforst", methods = 2)
public class SWMoneyUnforstRequest extends AbstractSWRequest<SWMoneyUnforstResponse> {

    private static final long serialVersionUID = -8450811024149440414L;

    @SWApiField(max = 32, desc = "用户通行证账号", orderby = 99)
    private String userName;

    public SWMoneyUnforstRequest(String secretKey) {
        super(secretKey);
    }

    @Override
    public Map<String, String> buildRequestParams() {
        Map<String, String> params = super.buildRequestParams();
        params.put("userName", userName);
        return params;
    }

    @Override
    public Class<SWMoneyUnforstResponse> getResponseClass() {
        return SWMoneyUnforstResponse.class;
    }

    public String getUserName() {
        return userName;
    }

    public void setUserName(String userName) {
        this.userName = userName;
    }
}


text:
package com.tagdynamics.png.chunk.types.tIME;

import com.tagdynamics.png.api.IMutableChunk;
import com.tagdynamics.png.chunk.AbstractChunk;

public class tIMEChunk extends AbstractChunk
{
    int year;

    int month;

    int day;

    int hour;

    int minute;

    int second;

    public tIMEChunk(IMutableChunk chunk)
    {
        super(chunk);
    }

    @Override
    protected void processChunk()
    {
        year = chunk.getInt2(0);
        month = chunk.getInt1(2);
        day = chunk.getInt1(3);
        hour = chunk.getInt1(4);
        minute = chunk.getInt1(5);
        second = chunk.getInt1(6);
    }

    public int getYear()
    {
        return year;
    }

    public void setYear(int year)
    {
        this.year = year;
    }

    public int getMonth()
    {
        return month;
    }

    public void setMonth(int month)
    {
        this.month = month;
    }

    public int getDay()
    {
        return day;
    }

    public void setDay(int day)
    {
        this.day = day;
    }

    public int getHour()
    {
        return hour;
    }

    public void setHour(int hour)
    {
        this.hour = hour;
    }

    public int getMinute()
    {
        return minute;
    }

    public void setMinute(int minute)
    {
        this.minute = minute;
    }

    public int getSecond()
    {
        return second;
    }

    public void setSecond(int second)
    {
        this.second = second;
    }

    @Override
    public String toString()
    {
        return "tIMEChunk{" +
                "year=" + year +
                ", month=" + month +
                ", day=" + day +
                ", hour=" + hour +
                ", minute=" + minute +
                ", second=" + second +
                '}';
    }
}


text:
"""InputSpec tests."""

from __future__ import absolute_import
from __future__ import division
from __future__ import print_function

from tensorflow.python.frozen_keras.engine import input_spec
from tensorflow.python.platform import test

class InputSpecTest(test.TestCase):

  def test_axes_initialization(self):
    input_spec.InputSpec(shape=[1, None, 2, 3], axes={3: 5, '2': 2})
    with self.assertRaisesRegexp(ValueError, 'Axis 4 is greater than'):
      input_spec.InputSpec(shape=[1, None, 2, 3], axes={4: 5})
    with self.assertRaisesRegexp(TypeError, 'keys in axes must be integers'):
      input_spec.InputSpec(shape=[1, None, 2, 3], axes={'string': 5})

class InputSpecToTensorShapeTest(test.TestCase):

  def test_defined_shape(self):
    spec = input_spec.InputSpec(shape=[1, None, 2, 3])
    self.assertAllEqual(
        [1, None, 2, 3], input_spec.to_tensor_shape(spec).as_list())

  def test_defined_ndims(self):
    spec = input_spec.InputSpec(ndim=5)
    self.assertAllEqual(
        [None] * 5, input_spec.to_tensor_shape(spec).as_list())

    spec = input_spec.InputSpec(ndim=0)
    self.assertAllEqual(
        [], input_spec.to_tensor_shape(spec).as_list())

    spec = input_spec.InputSpec(ndim=3, axes={1: 3, -1: 2})
    self.assertAllEqual(
        [None, 3, 2], input_spec.to_tensor_shape(spec).as_list())

  def test_undefined_shapes(self):
    spec = input_spec.InputSpec(max_ndim=5)
    with self.assertRaisesRegexp(ValueError, 'unknown TensorShape'):
      input_spec.to_tensor_shape(spec).as_list()

    spec = input_spec.InputSpec(min_ndim=5, max_ndim=5)
    with self.assertRaisesRegexp(ValueError, 'unknown TensorShape'):
      input_spec.to_tensor_shape(spec).as_list()

if __name__ == '__main__':
  test.main()


text:
function ApplicationWindow() {
	//declare module dependencies
	var MenuBarView = require('ui/common/MenuBarView');
	//var AfrekenView = require('ui/common/shoppingCart/AfrekenView.js');

	//construct UI
	var menuBarView = new MenuBarView();

	//create Menubarview container
	var menuBarContainerWindow = Ti.UI.createWindow({
		title:'PLAN@OFFICE',
		//stabBarHidden: Titanium.UI.iPhone.StatusBar.LIGHT_CONTENT,
		fullscreen: true
	});
	menuBarContainerWindow.hideNavBar();
	menuBarContainerWindow.add(menuBarView);

	//create iOS specific navGroupHome UI
	var navGroup = Ti.UI.iOS.createNavigationWindow({
		window:menuBarContainerWindow,
		//window:afrekenContainerWindow,

	});

	return navGroup;
};

module.exports = ApplicationWindow;


text:
namespace NeuroProof {

struct FeatureCache {
    virtual unsigned int deserialize(char * bytes) = 0;
    virtual void serialize(std::string& buffer) = 0;
};

struct CountCache : public FeatureCache {
    CountCache() : count(0) {}
    signed long long count;

    virtual unsigned int deserialize(char * bytes)
    {
        assert(sizeof(signed long long) == 8);

        unsigned int bytes_read = 0;
        count = *((signed long long *) bytes);

        bytes_read = sizeof(signed long long);
        bytes += sizeof(signed long long);

        return bytes_read;
    }
    virtual void serialize(std::string& buffer)
    {
        assert(sizeof(signed long long) == 8);

        // write 64-bit count
        buffer += std::string((char*)(&count), sizeof(signed long long));
    }
};

struct MomentCache : public FeatureCache{
    MomentCache(unsigned int num_moments) : count(0), vals(num_moments, 0) {}
    // will overwrite previous cache
    virtual unsigned int deserialize(char * bytes)
    {
        assert(sizeof(unsigned long long) == 8);
        assert(sizeof(unsigned int) == 4);
        assert(sizeof(double) == 8);

        unsigned int bytes_read = 0;
        count = *((unsigned long long *) bytes);

        bytes_read = sizeof(unsigned long long);
        bytes += sizeof(unsigned long long);

        // num_moments specified must correspond to what was stored in the buffer
        unsigned int num_moments = *((unsigned int*) bytes);
        assert(num_moments == vals.size());

        bytes_read += sizeof(unsigned int);
        bytes += sizeof(unsigned int);

        for (unsigned int i = 0; i < num_moments; ++i) {
            double val = *((double*) bytes);
            bytes_read += sizeof(double);
            bytes += sizeof(double);
            vals[i] = val;
        }

        return bytes_read;
    }
    virtual void serialize(std::string& buffer)
    {
        assert(sizeof(unsigned long long) == 8);
        assert(sizeof(unsigned int) == 4);
        assert(sizeof(double) == 8);

        // write 64-bit count
        buffer += std::string((char*)(&count), sizeof(unsigned long long));

        // write number of moments (64 bit)
        unsigned int num_moments = vals.size();
        buffer += std::string((char*)(&num_moments), sizeof(unsigned int));

        // write all vals (double)
        for (unsigned int i = 0; i < num_moments; ++i) {
            buffer += std::string((char*)&vals[i], sizeof(double));
        }
    }

    unsigned long long count;
    std::vector<double> vals;
};

struct HistCache : public FeatureCache {
    HistCache(unsigned num_bins) : count(0), hist(num_bins, 0) {}
    unsigned long long count;
    std::vector<unsigned long long> hist;

    virtual unsigned int deserialize(char * bytes)
    {
        assert(sizeof(unsigned long long) == 8);
        assert(sizeof(unsigned int) == 4);

        unsigned int bytes_read = 0;
        count = *((unsigned long long *) bytes);

        bytes_read = sizeof(unsigned long long);
        bytes += sizeof(unsigned long long);

        // num_bins specified must correspond to what was stored in the buffer
        unsigned int num_bins = *((unsigned int*) bytes);
        assert(num_bins == hist.size());

        bytes_read += sizeof(unsigned int);
        bytes += sizeof(unsigned int);

        for (unsigned int i = 0; i < num_bins; ++i) {
            unsigned long long val = *((unsigned long long*) bytes);
            bytes_read += sizeof(unsigned long long);
            bytes += sizeof(unsigned long long);
            hist[i] = val;
        }

        return bytes_read;
    }
    virtual void serialize(std::string& buffer)
    {
        assert(sizeof(unsigned long long) == 8);
        assert(sizeof(unsigned int) == 4);

        // write 64-bit count
        buffer += std::string((char*)(&count), sizeof(unsigned long long));

        // write number of bins (64 bit)
        unsigned int num_bins = hist.size();
        buffer += std::string((char*)(&num_bins), sizeof(unsigned int));

        // write all hist (unsigned long long)
        for (unsigned int i = 0; i < num_bins; ++i) {
            buffer += std::string((char*)&hist[i], sizeof(unsigned long long));
        }
    }

};

}

#endif


text:
<?php

namespace sdk\Http\Exception;

class Http503Exception extends HttpException
{

    /**
     * @var   integer    HTTP 503 Service Unavailable
     */
    protected $_code = 503;

}


text:
require 'benchmark'

module Rake
  module DSL
    def bench_task(*task_args, &block)
      task(*task_args) do |t, args|
        puts Benchmark.measure {
          block.call(t, args) if block
        }
      end
    end
  end
end


text:
/* A note about these functions:

   We aren't really sure yet which bits of data libsvn_client needs about
   nodes.  In wc-1, we just grab the entry, and then use whatever we want
   from it.  Such a pattern is Bad.

   This file is intended to hold functions which retrieve specific bits of
   information about a node, and will hopefully give us a better idea about
   what data libsvn_client needs, and how to best provide that data in 1.7
   final.  As such, these functions should only be called from outside
   libsvn_wc; any internal callers are encouraged to use the appropriate
   information fetching function, such as svn_wc__db_read_info().
*/

#include <apr_pools.h>
#include <apr_time.h>

#include "svn_pools.h"
#include "svn_dirent_uri.h"
#include "svn_path.h"
#include "svn_hash.h"
#include "svn_types.h"

#include "wc.h"
#include "props.h"
#include "entries.h"
#include "wc_db.h"

#include "svn_private_config.h"
#include "private/svn_wc_private.h"

/* Set *CHILDREN_ABSPATHS to a new array of the full paths formed by joining
 * each name in REL_CHILDREN onto DIR_ABSPATH.
 *
 * Allocate the output array and its elements in RESULT_POOL. */
static void
make_absolute(const apr_array_header_t **children_abspaths,
              const char *dir_abspath,
              const apr_array_header_t *rel_children,
              apr_pool_t *result_pool)
{
  apr_array_header_t *children;
  int i;

  children = apr_array_make(result_pool, rel_children->nelts,
                            sizeof(const char *));
  for (i = 0; i < rel_children->nelts; i++)
    {
      const char *name = APR_ARRAY_IDX(rel_children, i, const char *);
      APR_ARRAY_PUSH(children, const char *) =
                        svn_dirent_join(dir_abspath, name,
                                        result_pool);
    }

  *children_abspaths = children;
}

svn_error_t *
svn_wc__node_get_children_of_working_node(const apr_array_header_t **children,
                                          svn_wc_context_t *wc_ctx,
                                          const char *dir_abspath,
                                          apr_pool_t *result_pool,
                                          apr_pool_t *scratch_pool)
{
  const apr_array_header_t *child_names;

  SVN_ERR(svn_wc__db_read_children_of_working_node(&child_names,
                                                   wc_ctx->db, dir_abspath,
                                                   scratch_pool, scratch_pool));
  make_absolute(children, dir_abspath, child_names, result_pool);
  return SVN_NO_ERROR;
}

svn_error_t *
svn_wc__node_get_not_present_children(const apr_array_header_t **children,
                                      svn_wc_context_t *wc_ctx,
                                      const char *dir_abspath,
                                      apr_pool_t *result_pool,
                                      apr_pool_t *scratch_pool)
{
  const apr_array_header_t *child_names;

  SVN_ERR(svn_wc__db_base_read_not_present_children(
                                   &child_names,
                                   wc_ctx->db, dir_abspath,
                                   scratch_pool, scratch_pool));
  make_absolute(children, dir_abspath, child_names, result_pool);
  return SVN_NO_ERROR;
}

svn_error_t *
svn_wc__node_get_repos_info(svn_revnum_t *revision,
                            const char **repos_relpath,
                            const char **repos_root_url,
                            const char **repos_uuid,
                            svn_wc_context_t *wc_ctx,
                            const char *local_abspath,
                            apr_pool_t *result_pool,
                            apr_pool_t *scratch_pool)
{
  return svn_error_trace(
            svn_wc__db_read_repos_info(revision,
                                       repos_relpath,
                                       repos_root_url,
                                       repos_uuid,
                                       wc_ctx->db, local_abspath,
                                       result_pool, scratch_pool));
}

/* Convert DB_KIND into the appropriate NODE_KIND value.
 * If SHOW_HIDDEN is TRUE, report the node kind as found in the DB
 * even if DB_STATUS indicates that the node is hidden.
 * Else, return svn_node_none for such nodes.
 *
 * ### This is a bit ugly. We should consider promoting svn_kind_t
 * ### to the de-facto node kind type instead of converting between them
 * ### in non-backwards compat code.
 * ### See also comments at the definition of svn_kind_t.
 *
 * ### In reality, the previous comment is out of date, as there is
 * ### now only one enumeration for node kinds, and that is
 * ### svn_node_kind_t (svn_kind_t was merged with that). But it's
 * ### still ugly.
 */
static svn_error_t *
convert_db_kind_to_node_kind(svn_node_kind_t *node_kind,
                             svn_node_kind_t db_kind,
                             svn_wc__db_status_t db_status,
                             svn_boolean_t show_hidden)
{
  *node_kind = db_kind;

  /* Make sure hidden nodes return svn_node_none. */
  if (! show_hidden)
    switch (db_status)
      {
        case svn_wc__db_status_not_present:
        case svn_wc__db_status_server_excluded:
        case svn_wc__db_status_excluded:
          *node_kind = svn_node_none;

        default:
          break;
      }

  return SVN_NO_ERROR;
}

svn_error_t *
svn_wc_read_kind2(svn_node_kind_t *kind,
                  svn_wc_context_t *wc_ctx,
                  const char *local_abspath,
                  svn_boolean_t show_deleted,
                  svn_boolean_t show_hidden,
                  apr_pool_t *scratch_pool)
{
  svn_node_kind_t db_kind;

  SVN_ERR(svn_wc__db_read_kind(&db_kind,
                               wc_ctx->db, local_abspath,
                               TRUE,
                               show_deleted,
                               show_hidden,
                               scratch_pool));

  if (db_kind == svn_node_dir)
    *kind = svn_node_dir;
  else if (db_kind == svn_node_file || db_kind == svn_node_symlink)
    *kind = svn_node_file;
  else
    *kind = svn_node_none;

  return SVN_NO_ERROR;
}

svn_error_t *
svn_wc__node_get_changed_info(svn_revnum_t *changed_rev,
                              apr_time_t *changed_date,
                              const char **changed_author,
                              svn_wc_context_t *wc_ctx,
                              const char *local_abspath,
                              apr_pool_t *result_pool,
                              apr_pool_t *scratch_pool)
{
  return svn_error_trace(
    svn_wc__db_read_info(NULL, NULL, NULL, NULL, NULL, NULL, changed_rev,
                         changed_date, changed_author, NULL, NULL, NULL,
                         NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
                         NULL, NULL, NULL, NULL, NULL, NULL, NULL,
                         wc_ctx->db, local_abspath, result_pool,
                         scratch_pool));
}

svn_error_t *
svn_wc__node_get_url(const char **url,
                     svn_wc_context_t *wc_ctx,
                     const char *local_abspath,
                     apr_pool_t *result_pool,
                     apr_pool_t *scratch_pool)
{
  const char *repos_root_url;
  const char *repos_relpath;

  SVN_ERR(svn_wc__db_read_repos_info(NULL, &repos_relpath, &repos_root_url,
                                     NULL,
                                     wc_ctx->db, local_abspath,
                                     scratch_pool, scratch_pool));

  *url = svn_path_url_add_component2(repos_root_url, repos_relpath,
                                     result_pool);

  return SVN_NO_ERROR;
}

/* A recursive node-walker, helper for svn_wc__internal_walk_children().
 *
 * Call WALK_CALLBACK with WALK_BATON on all children (recursively) of
 * DIR_ABSPATH in DB, but not on DIR_ABSPATH itself. DIR_ABSPATH must be a
 * versioned directory. If SHOW_HIDDEN is true, visit hidden nodes, else
 * ignore them. Restrict the depth of the walk to DEPTH.
 *
 * ### Is it possible for a subdirectory to be hidden and known to be a
 *     directory?  If so, and if show_hidden is true, this will try to
 *     recurse into it.  */
static svn_error_t *
walker_helper(svn_wc__db_t *db,
              const char *dir_abspath,
              svn_boolean_t show_hidden,
              const apr_hash_t *changelist_filter,
              svn_wc__node_found_func_t walk_callback,
              void *walk_baton,
              svn_depth_t depth,
              svn_cancel_func_t cancel_func,
              void *cancel_baton,
              apr_pool_t *scratch_pool)
{
  apr_pool_t *iterpool;
  const apr_array_header_t *items;
  int i;

  if (depth == svn_depth_empty)
    return SVN_NO_ERROR;

  iterpool = svn_pool_create(scratch_pool);

  SVN_ERR(svn_wc__db_read_children_walker_info(&items, db,
                                               dir_abspath, scratch_pool,
                                               iterpool));

  for (i = 0; i < items->nelts; i++)
    {
      struct svn_wc__db_walker_info_t *wi =
              APR_ARRAY_IDX(items, i, struct svn_wc__db_walker_info_t *);
      const char *child_name = wi->name;
      svn_node_kind_t child_kind = wi->kind;
      svn_wc__db_status_t child_status = wi->status;
      const char *child_abspath;

      svn_pool_clear(iterpool);

      /* See if someone wants to cancel this operation. */
      if (cancel_func)
        SVN_ERR(cancel_func(cancel_baton));

      child_abspath = svn_dirent_join(dir_abspath, child_name, iterpool);

      if (!show_hidden)
        switch (child_status)
          {
            case svn_wc__db_status_not_present:
            case svn_wc__db_status_server_excluded:
            case svn_wc__db_status_excluded:
              continue;
            default:
              break;
          }

      /* Return the child, if appropriate. */
      if ( (child_kind == svn_node_file
             || depth >= svn_depth_immediates)
           && svn_wc__internal_changelist_match(db, child_abspath,
                                                changelist_filter,
                                                scratch_pool) )
        {
          svn_node_kind_t kind;

          SVN_ERR(convert_db_kind_to_node_kind(&kind, child_kind,
                                               child_status, show_hidden));
          /* ### We might want to pass child_status as well because at least
           * ### one callee is asking for it.
           * ### But is it OK to use an svn_wc__db type in this API?
           * ###    Not yet, we need to get the node walker
           * ###    libsvn_wc-internal first. -hkw */
          SVN_ERR(walk_callback(child_abspath, kind, walk_baton, iterpool));
        }

      /* Recurse into this directory, if appropriate. */
      if (child_kind == svn_node_dir
            && depth >= svn_depth_immediates)
        {
          svn_depth_t depth_below_here = depth;

          if (depth == svn_depth_immediates)
            depth_below_here = svn_depth_empty;

          SVN_ERR(walker_helper(db, child_abspath, show_hidden,
                                changelist_filter,
                                walk_callback, walk_baton,
                                depth_below_here,
                                cancel_func, cancel_baton,
                                iterpool));
        }
    }

  svn_pool_destroy(iterpool);

  return SVN_NO_ERROR;
}

svn_error_t *
svn_wc__internal_walk_children(svn_wc__db_t *db,
                               const char *local_abspath,
                               svn_boolean_t show_hidden,
                               const apr_array_header_t *changelist_filter,
                               svn_wc__node_found_func_t walk_callback,
                               void *walk_baton,
                               svn_depth_t walk_depth,
                               svn_cancel_func_t cancel_func,
                               void *cancel_baton,
                               apr_pool_t *scratch_pool)
{
  svn_node_kind_t db_kind;
  svn_node_kind_t kind;
  svn_wc__db_status_t status;
  apr_hash_t *changelist_hash = NULL;
  const char *changelist = NULL;

  SVN_ERR_ASSERT(walk_depth >= svn_depth_empty
                 && walk_depth <= svn_depth_infinity);

  if (changelist_filter && changelist_filter->nelts)
    SVN_ERR(svn_hash_from_cstring_keys(&changelist_hash, changelist_filter,
                                       scratch_pool));

  /* Check if the node exists before the first callback */
  SVN_ERR(svn_wc__db_read_info(&status, &db_kind, NULL, NULL, NULL, NULL,
                               NULL, NULL, NULL, NULL, NULL, NULL,
                               NULL, NULL, NULL, NULL, NULL, NULL, NULL,
                               changelist_hash ? &changelist : NULL,
                               NULL, NULL, NULL, NULL, NULL, NULL, NULL,
                               db, local_abspath, scratch_pool, scratch_pool));

  SVN_ERR(convert_db_kind_to_node_kind(&kind, db_kind, status, show_hidden));

  if (!changelist_hash
      || (changelist && svn_hash_gets(changelist_hash, changelist)))
    {
      SVN_ERR(walk_callback(local_abspath, kind, walk_baton, scratch_pool));
    }

  if (db_kind == svn_node_file
      || status == svn_wc__db_status_not_present
      || status == svn_wc__db_status_excluded
      || status == svn_wc__db_status_server_excluded)
    return SVN_NO_ERROR;

  if (db_kind == svn_node_dir)
    {
      return svn_error_trace(
        walker_helper(db, local_abspath, show_hidden, changelist_hash,
                      walk_callback, walk_baton,
                      walk_depth, cancel_func, cancel_baton, scratch_pool));
    }

  return svn_error_createf(SVN_ERR_NODE_UNKNOWN_KIND, NULL,
                           _("'%s' has an unrecognized node kind"),
                           svn_dirent_local_style(local_abspath,
                                                  scratch_pool));
}

svn_error_t *
svn_wc__node_is_not_present(svn_boolean_t *is_not_present,
                            svn_boolean_t *is_excluded,
                            svn_boolean_t *is_server_excluded,
                            svn_wc_context_t *wc_ctx,
                            const char *local_abspath,
                            svn_boolean_t base_only,
                            apr_pool_t *scratch_pool)
{
  svn_wc__db_status_t status;

  if (base_only)
    {
      SVN_ERR(svn_wc__db_base_get_info(&status,
                                       NULL, NULL, NULL, NULL, NULL, NULL,
                                       NULL, NULL, NULL, NULL, NULL, NULL,
                                       NULL, NULL, NULL,
                                       wc_ctx->db, local_abspath,
                                       scratch_pool, scratch_pool));
    }
  else
    {
      SVN_ERR(svn_wc__db_read_info(&status,
                                   NULL, NULL, NULL, NULL, NULL, NULL, NULL,
                                   NULL, NULL, NULL, NULL, NULL, NULL, NULL,
                                   NULL, NULL, NULL, NULL, NULL, NULL, NULL,
                                   NULL, NULL, NULL, NULL, NULL,
                                   wc_ctx->db, local_abspath,
                                   scratch_pool, scratch_pool));
    }

  if (is_not_present)
    *is_not_present = (status == svn_wc__db_status_not_present);

  if (is_excluded)
    *is_excluded = (status == svn_wc__db_status_excluded);

  if (is_server_excluded)
    *is_server_excluded = (status == svn_wc__db_status_server_excluded);

  return SVN_NO_ERROR;
}

svn_error_t *
svn_wc__node_is_added(svn_boolean_t *is_added,
                      svn_wc_context_t *wc_ctx,
                      const char *local_abspath,
                      apr_pool_t *scratch_pool)
{
  svn_wc__db_status_t status;

  SVN_ERR(svn_wc__db_read_info(&status,
                               NULL, NULL, NULL, NULL, NULL, NULL, NULL,
                               NULL, NULL, NULL, NULL, NULL, NULL, NULL,
                               NULL, NULL, NULL, NULL, NULL, NULL, NULL,
                               NULL, NULL, NULL, NULL, NULL,
                               wc_ctx->db, local_abspath,
                               scratch_pool, scratch_pool));
  *is_added = (status == svn_wc__db_status_added);

  return SVN_NO_ERROR;
}

svn_error_t *
svn_wc__node_has_working(svn_boolean_t *has_working,
                         svn_wc_context_t *wc_ctx,
                         const char *local_abspath,
                         apr_pool_t *scratch_pool)
{
  svn_wc__db_status_t status;

  SVN_ERR(svn_wc__db_read_info(&status,
                               NULL, NULL, NULL, NULL, NULL, NULL, NULL,
                               NULL, NULL, NULL, NULL, NULL, NULL, NULL,
                               NULL, NULL, NULL, NULL, NULL, NULL, NULL,
                               NULL, NULL, NULL, NULL, has_working,
                               wc_ctx->db, local_abspath,
                               scratch_pool, scratch_pool));

  return SVN_NO_ERROR;
}

svn_error_t *
svn_wc__node_get_base(svn_node_kind_t *kind,
                      svn_revnum_t *revision,
                      const char **repos_relpath,
                      const char **repos_root_url,
                      const char **repos_uuid,
                      const char **lock_token,
                      svn_wc_context_t *wc_ctx,
                      const char *local_abspath,
                      svn_boolean_t ignore_enoent,
                      apr_pool_t *result_pool,
                      apr_pool_t *scratch_pool)
{
  svn_error_t *err;
  svn_wc__db_status_t status;
  svn_wc__db_lock_t *lock;
  svn_node_kind_t db_kind;

  err = svn_wc__db_base_get_info(&status, &db_kind, revision, repos_relpath,
                                 repos_root_url, repos_uuid, NULL,
                                 NULL, NULL, NULL, NULL, NULL,
                                 lock_token ? &lock : NULL,
                                 NULL, NULL, NULL,
                                 wc_ctx->db, local_abspath,
                                 result_pool, scratch_pool);

  if (err && err->apr_err != SVN_ERR_WC_PATH_NOT_FOUND)
    return svn_error_trace(err);
  else if (err
           || (status != svn_wc__db_status_normal
               && status != svn_wc__db_status_incomplete))
    {
      if (!ignore_enoent)
        {
          if (err)
            return svn_error_trace(err);
          else
            return svn_error_createf(SVN_ERR_WC_PATH_NOT_FOUND, NULL,
                                     _("The node '%s' was not found."),
                                     svn_dirent_local_style(local_abspath,
                                                            scratch_pool));
        }
      svn_error_clear(err);

      if (kind)
        *kind = svn_node_unknown;
      if (revision)
        *revision = SVN_INVALID_REVNUM;
      if (repos_relpath)
        *repos_relpath = NULL;
      if (repos_root_url)
        *repos_root_url = NULL;
      if (repos_uuid)
        *repos_uuid = NULL;
      if (lock_token)
        *lock_token = NULL;
      return SVN_NO_ERROR;
    }

  if (kind)
    *kind = db_kind;
  if (lock_token)
    *lock_token = lock ? lock->token : NULL;

  SVN_ERR_ASSERT(!revision || SVN_IS_VALID_REVNUM(*revision));
  SVN_ERR_ASSERT(!repos_relpath || *repos_relpath);
  SVN_ERR_ASSERT(!repos_root_url || *repos_root_url);
  SVN_ERR_ASSERT(!repos_uuid || *repos_uuid);
  return SVN_NO_ERROR;
}

svn_error_t *
svn_wc__node_get_pre_ng_status_data(svn_revnum_t *revision,
                                   svn_revnum_t *changed_rev,
                                   apr_time_t *changed_date,
                                   const char **changed_author,
                                   svn_wc_context_t *wc_ctx,
                                   const char *local_abspath,
                                   apr_pool_t *result_pool,
                                   apr_pool_t *scratch_pool)
{
  svn_wc__db_status_t status;
  svn_boolean_t have_base, have_more_work, have_work;

  SVN_ERR(svn_wc__db_read_info(&status, NULL, revision, NULL, NULL, NULL,
                               changed_rev, changed_date, changed_author,
                               NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
                               NULL, NULL, NULL, NULL, NULL, NULL, NULL,
                               &have_base, &have_more_work, &have_work,
                               wc_ctx->db, local_abspath,
                               result_pool, scratch_pool));

  if (!have_work
      || ((!changed_rev || SVN_IS_VALID_REVNUM(*changed_rev))
          && (!revision || SVN_IS_VALID_REVNUM(*revision)))
      || ((status != svn_wc__db_status_added)
          && (status != svn_wc__db_status_deleted)))
    {
      return SVN_NO_ERROR; /* We got everything we need */
    }

  if (have_base && !have_more_work)
    SVN_ERR(svn_wc__db_base_get_info(NULL, NULL, revision, NULL, NULL, NULL,
                                     changed_rev, changed_date, changed_author,
                                     NULL, NULL, NULL,
                                     NULL, NULL, NULL, NULL,
                                     wc_ctx->db, local_abspath,
                                     result_pool, scratch_pool));
  else if (status == svn_wc__db_status_deleted)
    /* Check the information below a WORKING delete */
    SVN_ERR(svn_wc__db_read_pristine_info(NULL, NULL, changed_rev,
                                          changed_date, changed_author, NULL,
                                          NULL, NULL, NULL, NULL,
                                          wc_ctx->db, local_abspath,
                                          result_pool, scratch_pool));

  return SVN_NO_ERROR;
}

svn_error_t *
svn_wc__node_clear_dav_cache_recursive(svn_wc_context_t *wc_ctx,
                                       const char *local_abspath,
                                       apr_pool_t *scratch_pool)
{
  return svn_error_trace(svn_wc__db_base_clear_dav_cache_recursive(
                              wc_ctx->db, local_abspath, scratch_pool));
}

svn_error_t *
svn_wc__node_get_lock_tokens_recursive(apr_hash_t **lock_tokens,
                                       svn_wc_context_t *wc_ctx,
                                       const char *local_abspath,
                                       apr_pool_t *result_pool,
                                       apr_pool_t *scratch_pool)
{
  return svn_error_trace(svn_wc__db_base_get_lock_tokens_recursive(
                              lock_tokens, wc_ctx->db, local_abspath,
                              result_pool, scratch_pool));
}

svn_error_t *
svn_wc__get_excluded_subtrees(apr_hash_t **server_excluded_subtrees,
                              svn_wc_context_t *wc_ctx,
                              const char *local_abspath,
                              apr_pool_t *result_pool,
                              apr_pool_t *scratch_pool)
{
  return svn_error_trace(
           svn_wc__db_get_excluded_subtrees(server_excluded_subtrees,
                                            wc_ctx->db,
                                            local_abspath,
                                            result_pool,
                                            scratch_pool));
}

svn_error_t *
svn_wc__internal_get_origin(svn_boolean_t *is_copy,
                            svn_revnum_t *revision,
                            const char **repos_relpath,
                            const char **repos_root_url,
                            const char **repos_uuid,
                            svn_depth_t *depth,
                            const char **copy_root_abspath,
                            svn_wc__db_t *db,
                            const char *local_abspath,
                            svn_boolean_t scan_deleted,
                            apr_pool_t *result_pool,
                            apr_pool_t *scratch_pool)
{
  const char *original_repos_relpath;
  const char *original_repos_root_url;
  const char *original_repos_uuid;
  svn_revnum_t original_revision;
  svn_wc__db_status_t status;
  svn_boolean_t have_more_work;
  svn_boolean_t op_root;

  const char *tmp_repos_relpath;

  if (copy_root_abspath)
    *copy_root_abspath = NULL;
  if (!repos_relpath)
    repos_relpath = &tmp_repos_relpath;

  SVN_ERR(svn_wc__db_read_info(&status, NULL, revision, repos_relpath,
                               repos_root_url, repos_uuid, NULL, NULL, NULL,
                               depth, NULL, NULL,
                               &original_repos_relpath,
                               &original_repos_root_url,
                               &original_repos_uuid, &original_revision,
                               NULL, NULL, NULL, NULL, NULL, &op_root, NULL,
                               NULL, NULL, &have_more_work, is_copy,
                               db, local_abspath, result_pool, scratch_pool));

  if (*repos_relpath)
    {
      return SVN_NO_ERROR; /* Returned BASE information */
    }

  if (status == svn_wc__db_status_deleted && !scan_deleted)
    {
      if (is_copy)
        *is_copy = FALSE; /* Deletes are stored in working; default to FALSE */

      return SVN_NO_ERROR; /* No info */
    }

  if (original_repos_relpath)
    {
      /* We an have a copy */
      *repos_relpath = original_repos_relpath;
      if (revision)
        *revision = original_revision;
      if (repos_root_url)
        *repos_root_url = original_repos_root_url;
      if (repos_uuid)
        *repos_uuid = original_repos_uuid;

      if (copy_root_abspath == NULL)
        return SVN_NO_ERROR;
      else if (op_root)
        {
          *copy_root_abspath = apr_pstrdup(result_pool, local_abspath);
          return SVN_NO_ERROR;
        }
    }

  {
    svn_boolean_t scan_working = FALSE;

    if (status == svn_wc__db_status_added
        || (status == svn_wc__db_status_deleted && have_more_work))
      scan_working = TRUE;

    if (scan_working)
      {
        const char *op_root_abspath;

        SVN_ERR(svn_wc__db_scan_addition(&status, &op_root_abspath, NULL,
                                         NULL, NULL, &original_repos_relpath,
                                         repos_root_url,
                                         repos_uuid, revision,
                                         db, local_abspath,
                                         result_pool, scratch_pool));

        if (status == svn_wc__db_status_added)
          {
            if (is_copy)
              *is_copy = FALSE;
            return SVN_NO_ERROR; /* Local addition */
          }

        /* We don't know how the following error condition can be fulfilled
         * but we have seen that happening in the wild.  Better to create
         * an error than a SEGFAULT. */
        if (status == svn_wc__db_status_incomplete && !original_repos_relpath)
          return svn_error_createf(SVN_ERR_WC_PATH_UNEXPECTED_STATUS, NULL,
                               _("Incomplete copy information on path '%s'."),
                                   svn_dirent_local_style(local_abspath,
                                                          scratch_pool));

        *repos_relpath = svn_relpath_join(
                                original_repos_relpath,
                                svn_dirent_skip_ancestor(op_root_abspath,
                                                         local_abspath),
                                result_pool);
        if (copy_root_abspath)
          *copy_root_abspath = op_root_abspath;
      }
    else /* Deleted, excluded, not-present, server-excluded, ... */
      {
        if (is_copy)
          *is_copy = FALSE;

        SVN_ERR(svn_wc__db_base_get_info(NULL, NULL, revision, repos_relpath,
                                         repos_root_url, repos_uuid, NULL,
                                         NULL, NULL, NULL, NULL, NULL, NULL,
                                         NULL, NULL, NULL,
                                         db, local_abspath,
                                         result_pool, scratch_pool));
      }

    return SVN_NO_ERROR;
  }
}

svn_error_t *
svn_wc__node_get_origin(svn_boolean_t *is_copy,
                        svn_revnum_t *revision,
                        const char **repos_relpath,
                        const char **repos_root_url,
                        const char **repos_uuid,
                        svn_depth_t *depth,
                        const char **copy_root_abspath,
                        svn_wc_context_t *wc_ctx,
                        const char *local_abspath,
                        svn_boolean_t scan_deleted,
                        apr_pool_t *result_pool,
                        apr_pool_t *scratch_pool)
{
  return svn_error_trace(svn_wc__internal_get_origin(is_copy, revision,
                           repos_relpath, repos_root_url, repos_uuid,
                           depth, copy_root_abspath,
                           wc_ctx->db, local_abspath, scan_deleted,
                           result_pool, scratch_pool));
}

svn_error_t *
svn_wc__node_get_commit_status(svn_boolean_t *added,
                               svn_boolean_t *deleted,
                               svn_boolean_t *is_replace_root,
                               svn_boolean_t *is_op_root,
                               svn_revnum_t *revision,
                               svn_revnum_t *original_revision,
                               const char **original_repos_relpath,
                               svn_wc_context_t *wc_ctx,
                               const char *local_abspath,
                               apr_pool_t *result_pool,
                               apr_pool_t *scratch_pool)
{
  svn_wc__db_status_t status;
  svn_boolean_t have_base;
  svn_boolean_t have_more_work;
  svn_boolean_t op_root;

  /* ### All of this should be handled inside a single read transaction */
  SVN_ERR(svn_wc__db_read_info(&status, NULL, revision, NULL,
                               NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
                               original_repos_relpath, NULL, NULL,
                               original_revision, NULL, NULL, NULL,
                               NULL, NULL,
                               &op_root, NULL, NULL,
                               &have_base, &have_more_work, NULL,
                               wc_ctx->db, local_abspath,
                               result_pool, scratch_pool));

  if (added)
    *added = (status == svn_wc__db_status_added);
  if (deleted)
    *deleted = (status == svn_wc__db_status_deleted);
  if (is_op_root)
    *is_op_root = op_root;

  if (is_replace_root)
    {
      if (status == svn_wc__db_status_added
          && op_root
          && (have_base || have_more_work))
        SVN_ERR(svn_wc__db_node_check_replace(is_replace_root, NULL, NULL,
                                              wc_ctx->db, local_abspath,
                                              scratch_pool));
      else
        *is_replace_root = FALSE;
    }

  /* Retrieve some information from BASE which is needed for replacing
     and/or deleting BASE nodes. */
  if (have_base
      && !have_more_work
      && op_root
      && (revision && !SVN_IS_VALID_REVNUM(*revision)))
    {
      SVN_ERR(svn_wc__db_base_get_info(NULL, NULL, revision, NULL, NULL, NULL,
                                       NULL, NULL, NULL, NULL, NULL, NULL,
                                       NULL, NULL, NULL, NULL,
                                       wc_ctx->db, local_abspath,
                                       scratch_pool, scratch_pool));
    }

  return SVN_NO_ERROR;
}

svn_error_t *
svn_wc__node_get_md5_from_sha1(const svn_checksum_t **md5_checksum,
                               svn_wc_context_t *wc_ctx,
                               const char *wri_abspath,
                               const svn_checksum_t *sha1_checksum,
                               apr_pool_t *result_pool,
                               apr_pool_t *scratch_pool)
{
  return svn_error_trace(svn_wc__db_pristine_get_md5(md5_checksum,
                                                     wc_ctx->db,
                                                     wri_abspath,
                                                     sha1_checksum,
                                                     result_pool,
                                                     scratch_pool));
}

svn_error_t *
svn_wc__get_not_present_descendants(const apr_array_header_t **descendants,
                                    svn_wc_context_t *wc_ctx,
                                    const char *local_abspath,
                                    apr_pool_t *result_pool,
                                    apr_pool_t *scratch_pool)
{
  return svn_error_trace(
                svn_wc__db_get_not_present_descendants(descendants,
                                                       wc_ctx->db,
                                                       local_abspath,
                                                       result_pool,
                                                       scratch_pool));
}

svn_error_t *
svn_wc__rename_wc(svn_wc_context_t *wc_ctx,
                  const char *from_abspath,
                  const char *dst_abspath,
                  apr_pool_t *scratch_pool)
{
  const char *wcroot_abspath;
  SVN_ERR(svn_wc__db_get_wcroot(&wcroot_abspath, wc_ctx->db, from_abspath,
                                scratch_pool, scratch_pool));

  if (! strcmp(from_abspath, wcroot_abspath))
    {
      SVN_ERR(svn_wc__db_drop_root(wc_ctx->db, wcroot_abspath, scratch_pool));

      SVN_ERR(svn_io_file_rename2(from_abspath, dst_abspath, FALSE,
                                  scratch_pool));
    }
  else
    return svn_error_createf(
                    SVN_ERR_WC_PATH_UNEXPECTED_STATUS, NULL,
                    _("'%s' is not the root of the working copy '%s'"),
                    svn_dirent_local_style(from_abspath, scratch_pool),
                    svn_dirent_local_style(wcroot_abspath, scratch_pool));

  return SVN_NO_ERROR;
}

svn_error_t *
svn_wc__check_for_obstructions(svn_wc_notify_state_t *obstruction_state,
                               svn_node_kind_t *kind,
                               svn_boolean_t *deleted,
                               svn_boolean_t *excluded,
                               svn_depth_t *parent_depth,
                               svn_wc_context_t *wc_ctx,
                               const char *local_abspath,
                               svn_boolean_t no_wcroot_check,
                               apr_pool_t *scratch_pool)
{
  svn_wc__db_status_t status;
  svn_node_kind_t db_kind;
  svn_node_kind_t disk_kind;
  svn_error_t *err;

  *obstruction_state = svn_wc_notify_state_inapplicable;
  if (kind)
    *kind = svn_node_none;
  if (deleted)
    *deleted = FALSE;
  if (excluded)
    *excluded = FALSE;
  if (parent_depth)
    *parent_depth = svn_depth_unknown;

  SVN_ERR(svn_io_check_path(local_abspath, &disk_kind, scratch_pool));

  err = svn_wc__db_read_info(&status, &db_kind, NULL, NULL, NULL, NULL, NULL,
                             NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
                             NULL, NULL, NULL, NULL, NULL, NULL, NULL,
                             NULL, NULL, NULL, NULL, NULL,
                             wc_ctx->db, local_abspath,
                             scratch_pool, scratch_pool);

  if (err && err->apr_err == SVN_ERR_WC_PATH_NOT_FOUND)
    {
      svn_error_clear(err);

      if (disk_kind != svn_node_none)
        {
          /* Nothing in the DB, but something on disk */
          *obstruction_state = svn_wc_notify_state_obstructed;
          return SVN_NO_ERROR;
        }

      err = svn_wc__db_read_info(&status, &db_kind, NULL, NULL, NULL, NULL,
                                 NULL, NULL, NULL, parent_depth, NULL, NULL,
                                 NULL, NULL, NULL, NULL, NULL, NULL, NULL,
                                 NULL, NULL, NULL, NULL, NULL, NULL, NULL,
                                 NULL,
                                 wc_ctx->db, svn_dirent_dirname(local_abspath,
                                                                scratch_pool),
                                 scratch_pool, scratch_pool);

      if (err && err->apr_err == SVN_ERR_WC_PATH_NOT_FOUND)
        {
          svn_error_clear(err);
          /* No versioned parent; we can't add a node here */
          *obstruction_state = svn_wc_notify_state_obstructed;
          return SVN_NO_ERROR;
        }
      else
        SVN_ERR(err);

      if (db_kind != svn_node_dir
          || (status != svn_wc__db_status_normal
              && status != svn_wc__db_status_added))
        {
          /* The parent doesn't allow nodes to be added below it */
          *obstruction_state = svn_wc_notify_state_obstructed;
        }

      return SVN_NO_ERROR;
    }
  else
    SVN_ERR(err);

  /* Check for obstructing working copies */
  if (!no_wcroot_check
      && db_kind == svn_node_dir
      && status == svn_wc__db_status_normal)
    {
      svn_boolean_t is_root;
      SVN_ERR(svn_wc__db_is_wcroot(&is_root, wc_ctx->db, local_abspath,
                                   scratch_pool));

      if (is_root)
        {
          /* Callers should handle this as unversioned */
          *obstruction_state = svn_wc_notify_state_obstructed;
          return SVN_NO_ERROR;
        }
    }

  if (kind)
    SVN_ERR(convert_db_kind_to_node_kind(kind, db_kind, status, FALSE));

  switch (status)
    {
      case svn_wc__db_status_deleted:
        if (deleted)
          *deleted = TRUE;
        /* Fall through to svn_wc__db_status_not_present */
      case svn_wc__db_status_not_present:
        if (disk_kind != svn_node_none)
          *obstruction_state = svn_wc_notify_state_obstructed;
        break;

      case svn_wc__db_status_excluded:
      case svn_wc__db_status_server_excluded:
        if (excluded)
          *excluded = TRUE;
        /* fall through */
      case svn_wc__db_status_incomplete:
        *obstruction_state = svn_wc_notify_state_missing;
        break;

      case svn_wc__db_status_added:
      case svn_wc__db_status_normal:
        if (disk_kind == svn_node_none)
          *obstruction_state = svn_wc_notify_state_missing;
        else
          {
            svn_node_kind_t expected_kind;

            SVN_ERR(convert_db_kind_to_node_kind(&expected_kind, db_kind,
                                                 status, FALSE));

            if (disk_kind != expected_kind)
              *obstruction_state = svn_wc_notify_state_obstructed;
          }
        break;
      default:
        SVN_ERR_MALFUNCTION();
    }

  return SVN_NO_ERROR;
}

svn_error_t *
svn_wc__node_was_moved_away(const char **moved_to_abspath,
                            const char **op_root_abspath,
                            svn_wc_context_t *wc_ctx,
                            const char *local_abspath,
                            apr_pool_t *result_pool,
                            apr_pool_t *scratch_pool)
{
  svn_wc__db_status_t status;

  if (moved_to_abspath)
    *moved_to_abspath = NULL;
  if (op_root_abspath)
    *op_root_abspath = NULL;

  SVN_ERR(svn_wc__db_read_info(&status,
                               NULL, NULL, NULL, NULL, NULL, NULL, NULL,
                               NULL, NULL, NULL, NULL, NULL, NULL, NULL,
                               NULL, NULL, NULL, NULL, NULL, NULL, NULL,
                               NULL, NULL, NULL, NULL, NULL,
                               wc_ctx->db, local_abspath,
                               scratch_pool, scratch_pool));

  if (status == svn_wc__db_status_deleted)
    SVN_ERR(svn_wc__db_scan_deletion(NULL, moved_to_abspath, NULL,
                                     op_root_abspath, wc_ctx->db,
                                     local_abspath,
                                     result_pool, scratch_pool));

  return SVN_NO_ERROR;
}

svn_error_t *
svn_wc__node_was_moved_here(const char **moved_from_abspath,
                            const char **delete_op_root_abspath,
                            svn_wc_context_t *wc_ctx,
                            const char *local_abspath,
                            apr_pool_t *result_pool,
                            apr_pool_t *scratch_pool)
{
  svn_error_t *err;

  if (moved_from_abspath)
    *moved_from_abspath = NULL;
  if (delete_op_root_abspath)
    *delete_op_root_abspath = NULL;

  err = svn_wc__db_scan_moved(moved_from_abspath, NULL, NULL,
                              delete_op_root_abspath,
                              wc_ctx->db, local_abspath,
                              result_pool, scratch_pool);

  if (err)
    {
      /* Return error for not added nodes */
      if (err->apr_err != SVN_ERR_WC_PATH_UNEXPECTED_STATUS)
        return svn_error_trace(err);

      /* Path not moved here */
      svn_error_clear(err);
      return SVN_NO_ERROR;
    }

  return SVN_NO_ERROR;
}


text:
Compiling/running Bonggerd unit tests
------------------------------------

Bonggerd unit tests are in the `src/test/` directory; they
use the Boost::Test unit-testing framework.

To compile and run the tests:

    cd src
    make -f makefile.unix test_Bongger  # Replace makefile.unix if you're not on unix
    ./test_Bongger   # Runs the unit tests

If all tests succeed the last line of output will be:
`*** No errors detected`

To add more tests, add `BOOST_AUTO_TEST_CASE` functions to the existing
.cpp files in the test/ directory or add new .cpp files that
implement new BOOST_AUTO_TEST_SUITE sections (the makefiles are
set up to add test/*.cpp to test_Bongger automatically).

Compiling/running Bongger-Qt unit tests
---------------------------------------

Bitcoin-Qt unit tests are in the src/qt/test/ directory; they
use the Qt unit-testing framework.

To compile and run the tests:

    qmake bitcoin-qt.pro BITCOIN_QT_TEST=1
    make
    ./Bongger-qt_test

To add more tests, add them to the `src/qt/test/` directory,
the `src/qt/test/test_main.cpp` file, and bitcoin-qt.pro.


text:
package org.jboss.aerogear.unifiedpush.jpa.dao.impl;

import java.util.List;

import javax.inject.Inject;
import javax.persistence.EntityManager;
import javax.persistence.TypedQuery;

import org.hibernate.Query;
import org.hibernate.Session;
import org.jboss.aerogear.unifiedpush.dao.GenericBaseDao;

public abstract class JPABaseDao<T, K> implements GenericBaseDao<T, K> {

    @Inject
    protected EntityManager entityManager;

    /**
     * Hook to manually inject an EntityManager.
     */
    public void setEntityManager(EntityManager entityManager) {
        this.entityManager = entityManager;
    }

    protected TypedQuery<T> createQuery(String jpql) {
        return entityManager.createQuery(jpql, getType());
    }

    protected <O> TypedQuery<O> createQuery(String jpql, Class<O> type) {
        return entityManager.createQuery(jpql, type);
    }

    protected Query createHibernateQuery(String hql) {
        Session session = (Session) entityManager.getDelegate();
        return session.createQuery(hql);
    }

    //because you can't do T.class
    public abstract Class<T> getType();

    public T find(K id) {
        return entityManager.find(getType(), id);
    }

    public void create(T entity) {
        entityManager.persist(entity);
    }

    public void update(T entity) {
        entityManager.merge(entity);
        entityManager.flush();
    }

    public void delete(T entity) {
        if (entity != null) {
            // making sure the entity in question,
            // is really part of this transaction
            if (! entityManager.contains(entity)) {
                entity = entityManager.merge(entity);
            }

            entityManager.remove(entity);
        }
    }

    /**
     * Write pending objects to the database and
     * clear session-scoped cache
     */
    public void flushAndClear() {
        entityManager.flush();
        entityManager.clear();
    }

    protected T getSingleResultForQuery(TypedQuery<T> query) {
        List<T> result = query.getResultList();

        if (!result.isEmpty()) {
            return result.get(0);
        } else {
            return null;
        }
    }
}


text:
export class IqServerResult {
  readonly component: Component;
  readonly matchState: string;
  readonly catalogDate: string;
  readonly licenseData: LicenseData;
  readonly securityData: SecurityData;
  readonly policyData: PolicyData;

  constructor(result: any) {
    this.component = new Component(result.component);
    this.matchState = result.matchState;
    this.catalogDate = result.catalogDate;
    this.licenseData = new LicenseData(result.licenseData);
    this.securityData = new SecurityData(result.securityData);
    this.policyData = new PolicyData(result.policyData);
  }

  public toAuditLog(): string {
    return `${this.component.packageUrl} - ${this.component.hash}`;
  }
}

class Component {
  readonly packageUrl: string;
  readonly hash: string;
  readonly componentIdentifier: {};
  readonly proprietary: boolean;

  constructor(component: any) {
    this.packageUrl = component.packageUrl;
    this.hash = component.hash;
    this.componentIdentifier = new ComponentIdentifier(component.componentIdentifier);
    this.proprietary = component.proprietary;
  }
}

class ComponentIdentifier {
  readonly format: string;
  readonly coordinates: Record<string, any>;

  constructor(componentIdentifier: any) {
    this.format = componentIdentifier.format;
    this.coordinates = componentIdentifier.coordinates;
  }
}

class LicenseData {
  readonly declaredLicenses: {};
  readonly observedLicenses: {};
  readonly overriddenLicenses: {};
  readonly status: string;

  constructor(licenseData: any) {
    this.declaredLicenses = licenseData.declaredLicenses;
    this.observedLicenses = licenseData.observedLicenses;
    this.overriddenLicenses = licenseData.overriddenLicenses;
    this.status = licenseData.status;
  }
}

class SecurityData {
  constructor(readonly securityData: any) {}
}

class PolicyData {
  constructor(readonly policyData: any) {}
}


text:
#undef __cplusplus

#include <stdio.h>
#include <stdlib.h>
#include "LeapC.h"
#include "ExampleConnection.h"

/** Callback for when the connection opens. */
void OnConnect(){
  printf("Connected.\n");
}

/** Callback for when a device is found. */
void OnDevice(const LEAP_DEVICE_INFO *props){
  printf("Found device %s.\n", props->serial);
}

/** Callback for when a frame of tracking data is available. */
void OnFrame(const LEAP_TRACKING_EVENT *frame){
  printf("Frame %lli with %i hands.\n", (long long int)frame->info.frame_id, frame->nHands);
  for(uint32_t h = 0; h < frame->nHands; h++){
    LEAP_HAND* hand = &frame->pHands[h];
    printf("    Hand id %i is a %s hand with position (%f, %f, %f).\n",
                hand->id,
                (hand->type == eLeapHandType_Left ? "left" : "right"),
                hand->palm.position.x,
                hand->palm.position.y,
                hand->palm.position.z);
  }
}

int main(int argc, char** argv) {
  //Set callback function pointers
  ConnectionCallbacks.on_connection          = &OnConnect;
  ConnectionCallbacks.on_device_found        = &OnDevice;
  ConnectionCallbacks.on_frame               = &OnFrame;

  OpenConnection();

  printf("Press Enter to exit program.\n");
  getchar();
  return 0;
}
//End-of-Sample.c


text:
package com.deathsnacks.wardroid.gson.badlands;

import com.google.gson.annotations.Expose;
import com.google.gson.annotations.SerializedName;

public class DefenderInfo {

    @SerializedName("BattlePayReserve")
    @Expose
    private Integer battlePayReserve;
    @SerializedName("CreditsTaxRate")
    @Expose
    private Integer creditsTaxRate;
    @SerializedName("DamagePerMission")
    @Expose
    private Integer damagePerMission;
    @SerializedName("DeploymentActivationTime")
    @Expose
    private DeploymentActivationTime deploymentActivationTime;
    @Expose
    private com.deathsnacks.wardroid.gson.badlands.TaxChangeAllowedTime TaxChangeAllowedTime;
    @SerializedName("HealRate")
    @Expose
    private Double healRate;
    @SerializedName("Id")
    @Expose
    private Id id;
    @SerializedName("IsAlliance")
    @Expose
    private Boolean isAlliance;
    @SerializedName("ItemsTaxRate")
    @Expose
    private Integer itemsTaxRate;
    @SerializedName("LastHealTime")
    @Expose
    private LastHealTime lastHealTime;
    @SerializedName("MOTD")
    @Expose
    private String mOTD;
    @SerializedName("MaxStrength")
    @Expose
    private Integer maxStrength;
    @SerializedName("MemberCreditsTaxRate")
    @Expose
    private Integer memberCreditsTaxRate;
    @SerializedName("MemberItemsTaxRate")
    @Expose
    private Integer memberItemsTaxRate;
    @SerializedName("MissionInfo")
    @Expose
    private MissionInfo missionInfo;
    @SerializedName("Name")
    @Expose
    private String name;
    @SerializedName("RailType")
    @Expose
    private String railType;
    @SerializedName("StrengthRemaining")
    @Expose
    private Integer strengthRemaining;
    private int MissionBattlePay;

    public Integer getBattlePayReserve() {
        return battlePayReserve;
    }

    public void setBattlePayReserve(Integer battlePayReserve) {
        this.battlePayReserve = battlePayReserve;
    }

    public Integer getCreditsTaxRate() {
        return creditsTaxRate;
    }

    public void setCreditsTaxRate(Integer creditsTaxRate) {
        this.creditsTaxRate = creditsTaxRate;
    }

    public Integer getDamagePerMission() {
        return damagePerMission;
    }

    public void setDamagePerMission(Integer damagePerMission) {
        this.damagePerMission = damagePerMission;
    }

    public DeploymentActivationTime getDeploymentActivationTime() {
        return deploymentActivationTime;
    }

    public void setDeploymentActivationTime(DeploymentActivationTime deploymentActivationTime) {
        this.deploymentActivationTime = deploymentActivationTime;
    }

    public Double getHealRate() {
        return healRate;
    }

    public void setHealRate(Double healRate) {
        this.healRate = healRate;
    }

    public Id getId() {
        return id;
    }

    public void setId(Id id) {
        this.id = id;
    }

    public Boolean getIsAlliance() {
        return isAlliance;
    }

    public void setIsAlliance(Boolean isAlliance) {
        this.isAlliance = isAlliance;
    }

    public Integer getItemsTaxRate() {
        return itemsTaxRate;
    }

    public void setItemsTaxRate(Integer itemsTaxRate) {
        this.itemsTaxRate = itemsTaxRate;
    }

    public LastHealTime getLastHealTime() {
        return lastHealTime;
    }

    public void setLastHealTime(LastHealTime lastHealTime) {
        this.lastHealTime = lastHealTime;
    }

    public String getMOTD() {
        return mOTD;
    }

    public void setMOTD(String mOTD) {
        this.mOTD = mOTD;
    }

    public Integer getMaxStrength() {
        return maxStrength;
    }

    public void setMaxStrength(Integer maxStrength) {
        this.maxStrength = maxStrength;
    }

    public Integer getMemberCreditsTaxRate() {
        return memberCreditsTaxRate;
    }

    public void setMemberCreditsTaxRate(Integer memberCreditsTaxRate) {
        this.memberCreditsTaxRate = memberCreditsTaxRate;
    }

    public Integer getMemberItemsTaxRate() {
        return memberItemsTaxRate;
    }

    public void setMemberItemsTaxRate(Integer memberItemsTaxRate) {
        this.memberItemsTaxRate = memberItemsTaxRate;
    }

    public MissionInfo getMissionInfo() {
        return missionInfo;
    }

    public void setMissionInfo(MissionInfo missionInfo) {
        this.missionInfo = missionInfo;
    }

    public String getName() {
        return name;
    }

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

    public String getRailType() {
        return railType;
    }

    public void setRailType(String railType) {
        this.railType = railType;
    }

    public Integer getStrengthRemaining() {
        return strengthRemaining;
    }

    public void setStrengthRemaining(Integer strengthRemaining) {
        this.strengthRemaining = strengthRemaining;
    }

    public TaxChangeAllowedTime getTaxChangeAllowedTime() {
        return TaxChangeAllowedTime;
    }

    public void setTaxChangeAllowedTime(TaxChangeAllowedTime taxChangeAllowedTime) {
        TaxChangeAllowedTime = taxChangeAllowedTime;
    }

    public int getMissionBattlePay() {
        return MissionBattlePay;
    }

    public void setMissionBattlePay(int missionBattlePay) {
        MissionBattlePay = missionBattlePay;
    }
}


text:
package com.dangdang.ddframe.rdb.integrate.dbtbl.common.statement;

import com.dangdang.ddframe.rdb.integrate.dbtbl.common.AbstractShardingBothTest;
import com.dangdang.ddframe.rdb.sharding.jdbc.ShardingDataSource;
import com.dangdang.ddframe.rdb.sharding.parser.result.router.SQLStatementType;
import lombok.AccessLevel;
import lombok.Getter;
import org.dbunit.DatabaseUnitException;
import org.junit.Before;
import org.junit.Test;

import java.sql.Connection;
import java.sql.SQLException;
import java.sql.Statement;

import static org.hamcrest.CoreMatchers.is;
import static org.junit.Assert.assertThat;

public abstract class AbstractShardingBothForStatementWithDMLTest extends AbstractShardingBothTest {

    @Getter(AccessLevel.PROTECTED)
    private ShardingDataSource shardingDataSource;

    @Before
    public void init() throws SQLException {
        shardingDataSource = getShardingDataSource();
    }

    @Test
    public void assertInsert() throws SQLException, DatabaseUnitException {
        String sql = "INSERT INTO `t_order` (`order_id`, `user_id`, `status`) VALUES (%s, %s, '%s')";
        for (int i = 1; i <= 10; i++) {
            for (int j = 1; j <= 10; j++) {
                try (Connection connection = shardingDataSource.getConnection("", "")) {
                    Statement stmt = connection.createStatement();
                    stmt.executeUpdate(String.format(sql, i, j, "insert"));
                }
            }
        }
        assertDataSet("insert", "insert");
    }

    @Test
    public void assertUpdate() throws SQLException, DatabaseUnitException {
        String sql = "UPDATE `t_order` SET `status` = '%s' WHERE `order_id` = %s AND `user_id` = %s";
        for (int i = 10; i < 20; i++) {
            for (int j = 0; j < 10; j++) {
                try (Connection connection = shardingDataSource.getConnection()) {
                    Statement stmt = connection.createStatement();
                    assertThat(stmt.executeUpdate(String.format(sql, "updated", i * 100 + j, i)), is(1));
                }
            }
        }
        assertDataSet("update", "updated");
    }

    @Test
    public void assertDelete() throws SQLException, DatabaseUnitException {
        String sql = "DELETE `t_order` WHERE `order_id` = %s AND `user_id` = %s";
        for (int i = 10; i < 20; i++) {
            for (int j = 0; j < 10; j++) {
                try (Connection connection = shardingDataSource.getConnection()) {
                    Statement stmt = connection.createStatement();
                    assertThat(stmt.executeUpdate(String.format(sql, i * 100 + j, i)), is(1));
                }
            }
        }
        assertDataSet("delete", "init");
    }

    protected void assertDataSet(final String expectedDataSetPattern, final String status) throws SQLException, DatabaseUnitException {
        for (int i = 0; i < 10; i++) {
            for (int j = 0; j < 10; j++) {
                assertDataSet(String.format("integrate/dataset/dbtbl/expect/%s/dbtbl_%s.xml", expectedDataSetPattern, i),
                        shardingDataSource.getConnection().getConnection(String.format("dataSource_dbtbl_%s", i), SQLStatementType.SELECT),
                        String.format("t_order_%s", j), String.format("SELECT * FROM `t_order_%s` WHERE `status`=?", j), status);
            }
        }
    }
}


text:
::Chef::Recipe.send(:include, AlAgents::Helpers)

execute "provision #{agent_basename}" do
  extend(AlAgents::Helpers)
  user 'root'
  cwd '/etc/init.d'
  command "./al-agent provision #{provision_options}"
  ignore_failure node['al_agents']['agent']['ignore_failure']
  not_if { ::File.exist?('/var/alertlogic/etc/host_key.pem') }
end


text:
/**
 * Implements the link stats view
 * @packageDocumentation
 */

import React from 'react';
import {
  Row,
  Space,
  Col,
  Spin,
  Select,
  Button,
  Popconfirm,
  Tabs,
  Typography,
  Card,
} from 'antd/lib';
import {
  ExclamationCircleFilled,
  ClearOutlined,
  CloudDownloadOutlined,
  LoadingOutlined,
} from '@ant-design/icons';
import { IoReturnUpBack } from 'react-icons/io5';
import Highcharts from 'highcharts';
import HighchartsReact from 'highcharts-react-official';
import moment from 'moment';

import { LinkInfo, AliasInfo } from '../../components/LinkInfo';
import { GeoipStats, MENU_ITEMS, GeoipChart } from './StatsCommon';
import { downloadVisitsCsv } from '../../components/Csv';

import '../../Base.less';
import './Stats.less';

/**
 * Props for the [[Stats]] component
 * @interface
 */
export interface Props {
  /**
   * The ID of the link
   * @property
   */
  id: string;
}

/**
 * General summary statistics
 * @interface
 */
interface OverallStats {
  /**
   * The total number of visits to the link
   * @property
   */
  total_visits: number;

  /**
   * The number of unique visits to the link
   * @property
   */
  unique_visits: number;
}

/**
 * Data for one day worth of visits to a link
 * @interface
 */
interface VisitDatum {
  /**
   * The date, represented as year/month/day numbers
   * @property
   */
  _id: { year: number; month: number; day: number };

  /**
   * The total number of visits on the date
   * @property
   */
  all_visits: number;

  /**
   * The number of first-time visits on the date
   * @property
   */
  first_time_visits: number;
}

/**
 * Time-series visit statistics
 * @property
 */
interface VisitStats {
  /**
   * A [[VisitDatum]] for every day in the link's history
   * @property
   */
  visits: VisitDatum[];
}

/**
 * Data for one slice of a pie chart
 * @interface
 */
interface PieDatum {
  /**
   * The name of the slice
   * @property
   */
  name: string;

  /**
   * The value of the slice
   * @property
   */
  y: number;
}

/**
 * Data pertaining to browsers and referers of visitors
 * @interface
 */
interface BrowserStats {
  /**
   * Data for the browser name pie chart
   * @property
   */
  browsers: PieDatum[];

  /**
   * Data for the platform name pie chart
   * @property
   */
  platforms: PieDatum[];

  /**
   * Data for the referer pie chart
   * @property
   */
  referers: PieDatum[];
}

/**
 * State for the [[Stats]] component
 * @interface
 */
interface State {
  /**
   * List of all aliases for the current link
   * @property
   */
  linkInfo: LinkInfo | null;

  /**
   * List of all aliases for the current link
   * @property
   */
  allAliases: AliasInfo[];

  /**
   * The alias for which stats should be displayed, or `null` to display
   * aggregate stats for all aliases
   * @property
   */
  selectedAlias: string | null;

  /**
   * The [[OverallStats]] for the current link/alias
   * @property
   */
  overallStats: OverallStats | null;

  /**
   * The [[VisitStats]] for the current link/alias
   * @property
   */
  visitStats: VisitStats | null;

  /**
   * The [[GeoipStats]] for the current link/alias
   * @property
   */
  geoipStats: GeoipStats | null;

  /**
   * The [[BrowserStats]] for the current link/property
   * @property
   */
  browserStats: BrowserStats | null;

  /**
   * Whether the user may edit the link
   * @property
   */
  mayEdit: boolean | null;

  /**
   * Loading state for download button
   * @property
   */
  loading: boolean;
}

/**
 * The [[InfoBox]] component displays the info for link
 * @param props The props
 */
const InfoBox: React.FC<{ infoLabel: string; data: string }> = (props) => (
  <Card className="info-box">

      <Typography.Text style={{ color: '#686b69' }}>
        {props.infoLabel}
      </Typography.Text>
      <Typography.Text className="data-text">{props.data}</Typography.Text>

  </Card>
);

/**
 * The [[VisitsChart]] component displays a line graph of total visits and unique
 * visits over time
 * @param props The props
 */
const VisitsChart: React.FC<{ visitStats: VisitStats | null }> = (props) => {
  if (props.visitStats === null) {
    return <Spin />;
  }

  const { visits } = props.visitStats;
  const getMsSinceEpoch = (datum: VisitDatum) =>
    Date.UTC(datum._id.year, datum._id.month - 1, datum._id.day);

  const options = {
    chart: { type: 'spline', zoomType: 'x' },
    plotOptions: { spline: { marker: { enabled: true } } },
    exporting: { buttons: { contextButton: { menuItems: MENU_ITEMS } } },
    title: { text: 'Visits' },
    subtitle: { text: 'Click and drag to zoom in' },
    xAxis: { title: { text: 'Date' }, type: 'datetime' },
    yAxis: { title: { text: 'Visits' }, min: 0 },
    series: [
      {
        name: 'Unique visits',
        color: '#fce2cc',
        data: visits.map((el) => [getMsSinceEpoch(el), el.first_time_visits]),
      },
      {
        name: 'Total visits',
        color: '#fc580c',
        data: visits.map((el) => [getMsSinceEpoch(el), el.all_visits]),
      },
    ],
  };

  return <HighchartsReact highcharts={Highcharts} options={options} />;
};

/**
 * The colors for each browser name
 * @constant
 */
const BROWSER_COLORS: Map<string, string> = new Map([
  ['Firefox', 'rgba(244,199,133,1.0)'],
  ['Chrome', 'rgba(200,240,97,1.0)'],
  ['Safari', 'rgba(155,186,238,1.0)'],
  ['Microsoft Internet Explorer', 'rgba(136,198,247,1.0)'],
  ['Microsoft Edge', 'rgba(136,198,247,1.0)'],
  ['Opera', 'rgba(238,120,124,1.0)'],
  ['Unknown', 'rgba(80,80,80,0.2)'],
]);

// TODO: iOS, *BSD, etc?
/**
 * The colors for each platform name
 * @constant
 */
const PLATFORM_COLORS: Map<string, string> = new Map([
  ['Linux', 'rgba(216,171,36,1.0)'],
  ['Windows', 'rgba(129,238,208,1.0)'],
  ['Mac', 'rgba(201,201,201,1.0)'],
  ['Android', 'rgba(200,227,120,1.0)'],
  ['Unknown', 'rgba(80,80,80,0.2)'],
]);

/**
 * The colors for each referer
 * @constant
 */
const REFERER_COLORS: Map<string, string> = new Map([
  ['Facebook', 'rgba(0,75,150,1.0)'],
  ['Twitter', 'rgba(147,191,241,1.0)'],
  ['Instagram', 'rgba(193,131,212,1.0)'],
  ['Reddit', 'rgba(241,155,123,1.0)'],
  ['Unknown', 'rgba(80,80,80,0.2)'],
]);

/**
 * The [[PieChart]] component displays a pie chart given an array of [[PieDatum]]
 * @param props The props
 */
const PieChart: React.FC<{ title: string; data: PieDatum[] }> = (props) => {
  const options = {
    chart: {
      plotBackgroundColor: null,
      plotBorderWidth: null,
      plotShadow: false,
      type: 'pie',
    },
    exporting: { buttons: { contextButton: { menuItems: MENU_ITEMS } } },
    title: { text: props.title },
    tooltip: { pointFormat: '{series.name}: {point.percentage:.1f}%' },
    plotOptions: {
      pie: {
        allowPointSelect: true,
        cursor: 'pointer',
        showInLegend: true,
        dataLabels: { enabled: false },
      },
    },
    series: [
      {
        name: props.title,
        colorByPoint: true,
        data: props.data,
      },
    ],
  };

  return <HighchartsReact highcharts={Highcharts} options={options} />;
};

/**
 * The [[BrowserCharts]] component displays a pie chart for each series of data
 * contained in the [[BrowserStats]] object
 * @param props The props
 */
const BrowserCharts: React.FC<{ browserStats: BrowserStats | null }> = (
  props,
) => {
  if (props.browserStats === null) {
    return <Spin />;
  }

  const processData = (data: PieDatum[], colors: Map<string, string>) =>
    data.map((datum) => ({ ...datum, color: colors.get(datum.name) }));

  const browserData = processData(props.browserStats.browsers, BROWSER_COLORS);
  const platformData = processData(
    props.browserStats.platforms,
    PLATFORM_COLORS,
  );
  const refererData = processData(props.browserStats.referers, REFERER_COLORS);

  return (
    <>
      <Col span={8}>
        <PieChart title="Browsers" data={browserData} />
      </Col>
      <Col span={8}>
        <PieChart title="Platforms" data={platformData} />
      </Col>
      <Col span={8}>
        <PieChart title="Referrers" data={refererData} />
      </Col>
    </>
  );
};

/**
 * The [[Stats]] component implements the link stats view. It allows the user
 * to optionally select an alias, then displays visit stats, GeoIP stats, User-Agent stats,
 * and referer stats
 * @class
 */
export class Stats extends React.Component<Props, State> {
  constructor(props: Props) {
    super(props);
    this.state = {
      linkInfo: null,
      allAliases: [],
      selectedAlias: null,
      overallStats: null,
      visitStats: null,
      geoipStats: null,
      browserStats: null,
      mayEdit: null,
      loading: false,
    };
  }

  async componentDidMount(): Promise<void> {
    await this.updateLinkInfo();
    await this.updateStats();
  }

  async componentDidUpdate(prevProps: Props, prevState: State): Promise<void> {
    if (this.props !== prevProps) {
      await this.updateLinkInfo();
    }

    if (
      this.props !== prevProps ||
      this.state.selectedAlias !== prevState.selectedAlias
    ) {
      await this.updateStats();
    }
  }

  /**
   * Execute API requests to get link info for the current link ID, then update state
   * @method
   */
  updateLinkInfo = async (): Promise<void> => {
    const linkInfo = (await fetch(`/api/v1/link/${this.props.id}`).then(
      (resp) => resp.json(),
    )) as LinkInfo;
    const aliases = linkInfo.aliases.filter((alias) => !alias.deleted);
    if (aliases.length === 0) {
      throw new Error(`link ${this.props.id} has no aliases!`);
    }

    this.setState({
      linkInfo,
      allAliases: aliases,
      selectedAlias: null,
      mayEdit: linkInfo.may_edit,
    });
  };

  /**
   * Execute API requests to fetch all stats for the current link and alias, then update
   * state
   * @method
   */
  updateStats = async (): Promise<void> => {
    const baseApiPath =
      this.state.selectedAlias === null
        ? `/api/v1/link/${this.props.id}/stats`
        : `/api/v1/link/${this.props.id}/alias/${this.state.selectedAlias}/stats`;

    const overallPromise = fetch(baseApiPath)
      .then((resp) => resp.json())
      .then((json) => this.setState({ overallStats: json as OverallStats }));
    const visitsPromise = fetch(`${baseApiPath}/visits`)
      .then((resp) => resp.json())
      .then((json) => this.setState({ visitStats: json as VisitStats }));
    const geoipPromise = fetch(`${baseApiPath}/geoip`)
      .then((resp) => resp.json())
      .then((json) => this.setState({ geoipStats: json as GeoipStats }));
    const browsersPromise = fetch(`${baseApiPath}/browser`)
      .then((resp) => resp.json())
      .then((json) => this.setState({ browserStats: json as BrowserStats }));
    await Promise.all([
      overallPromise,
      visitsPromise,
      geoipPromise,
      browsersPromise,
    ]);
  };

  /**
   * Set the alias and then update stats
   * @method
   * @param alias The name of an alias, or a number to select all aliases (stupid hack why did I even do that?)
   */
  setAlias = async (alias: number | string): Promise<void> => {
    if (typeof alias === 'number') {
      this.setState({ selectedAlias: null });
    } else {
      this.setState({ selectedAlias: alias });
    }

    await this.updateStats();
  };

  /**
   * Prompt the user to download a CSV file of visits to the selected alias
   * @method
   */
  downloadCsv = async (): Promise<void> => {
    this.setState({ loading: true });
    await downloadVisitsCsv(this.props.id, this.state.selectedAlias);
    this.setState({ loading: false });
  };

  /**
   * Execute API requests to clear visit data associated with a link
   * @method
   */
  clearVisitData = async (): Promise<void> => {
    await fetch(`/api/v1/link/${this.props.id}/clear_visits`, {
      method: 'POST',
    });
    await this.updateStats();
  };

  render(): React.ReactNode {
    return (
      <>
        <Row className="primary-row" justify="space-between">
          <Col span={16}>
            <Button
              type="text"
              href="/app/#/dash"
              icon={<IoReturnUpBack />}
              size="large"
            />

              Stats for {this.state.linkInfo?.title}

          </Col>

          {this.state.allAliases.length === 1 ? (
            <></>
          ) : (
            <Col span={4} className="btn-col">
              <Select onSelect={this.setAlias} defaultValue={0}>
                <Select.Option value={0}>
                  All aliases
                </Select.Option>

                {this.state.allAliases.map((alias) => (
                  <Select.Option key={alias.alias} value={alias.alias}>
                    {alias.alias}
                    {alias.description ? ({alias.description}) : <></>}
                  </Select.Option>
                ))}
              </Select>
            </Col>
          )}
        </Row>

          <Tabs type="card">
            <Tabs.TabPane tab="Link Info" key="1">
              <Row className="details-row">
                {this.state.linkInfo === null ? (
                  <></>
                ) : (
                  <Col>
                    <Typography.Title level={3}>Details</Typography.Title>
                    <InfoBox
                      infoLabel="Link Title"
                      data={this.state.linkInfo.title}
                    />
                    <InfoBox
                      infoLabel="Owner"
                      data={this.state.linkInfo.owner}
                    />
                    <InfoBox
                      infoLabel="Date Created"
                      data={moment(this.state.linkInfo.created_time).format(
                        'MMM D, YYYY',
                      )}
                    />
                    <InfoBox
                      infoLabel="Long URL"
                      data={this.state.linkInfo.long_url}
                    />
                    {this.state.selectedAlias === null ? (
                      <Card className="info-box">

                          <Typography.Text style={{ color: '#686b69' }}>
                            Aliases
                          </Typography.Text>
                          <Typography.Text className="data-text">
                            {this.state.linkInfo.aliases.map((alias) => (

{alias.alias}

                            ))}
                          </Typography.Text>

                      </Card>
                    ) : (
                      <InfoBox
                        infoLabel="Alias"
                        data={this.state.selectedAlias}
                      />
                    )}
                  </Col>
                )}
                {this.state.overallStats === null ? (
                  <></>
                ) : (
                  <Col>
                    <Typography.Title level={3}>Visits</Typography.Title>
                    <InfoBox
                      infoLabel="Total Visits"
                      data={this.state.overallStats.total_visits.toString()}
                    />
                    <InfoBox
                      infoLabel="First Time Visits"
                      data={this.state.overallStats.unique_visits.toString()}
                    />
                    <Space
                      style={{ position: 'relative', marginTop: '20px' }}
                      align="center"
                      wrap
                    >
                      <Button
                        icon={
                          this.state.loading ? (
                            <LoadingOutlined spin />
                          ) : (
                            <CloudDownloadOutlined />
                          )
                        }
                        onClick={this.downloadCsv}
                      >
                        Download visits as CSV
                      </Button>
                      {this.state.mayEdit ? (
                        <></>
                      ) : (
                        <Col span={4} className="btn-col">
                          <Popconfirm
                            placement="bottom"
                            title="Are you sure you want to clear all visit data associated with this link? This operation cannot be undone."
                            onConfirm={this.clearVisitData}
                            icon={
                              <ExclamationCircleFilled
                                style={{ color: 'red' }}
                              />
                            }
                          >
                            <Button danger>
                              <ClearOutlined /> Clear all visit data
                            </Button>
                          </Popconfirm>
                        </Col>
                      )}
                    </Space>
                  </Col>
                )}
              </Row>
            </Tabs.TabPane>
            <Tabs.TabPane tab="Visit Statistics" key="2">
              <Row className="primary-row">
                <Col span={24}>
                  <Card className="card">
                    <VisitsChart visitStats={this.state.visitStats} />
                  </Card>
                </Col>
              </Row>
            </Tabs.TabPane>
            <Tabs.TabPane tab="Location Statistics" key="3">
              <Row className="primary-row">
                <Col span={24}>
                  <Card className="card">
                    <GeoipChart geoipStats={this.state.geoipStats} />
                  </Card>
                </Col>
              </Row>
            </Tabs.TabPane>
            <Tabs.TabPane tab="Browser Statistics" key="4">
              <Row className="primary-row">
                <BrowserCharts browserStats={this.state.browserStats} />
              </Row>
            </Tabs.TabPane>
          </Tabs>

      </>
    );
  }
}


text:
'use strict';
var assert = require('assert');
var childProcess = require('child_process');
var shared = require('./shared');

assert.deepEqual(shared, ['foo', 'bar']);

function send(data) {
	if (process.send) {
		process.send(data);
		return;
	}
	console.log('data: ' +  JSON.stringify(data));
}

send({
	passed: 'child-1',
	shared: shared
});

childProcess
	.fork(require.resolve('./child-2.js'))
	.on('message', function (data) {
		if (data.passed === 'child-2') {
			send(data);
		}
	});