text:
#ifndef REALM_BINARY_DATA_HPP
#define REALM_BINARY_DATA_HPP

#include <cstddef>
#include <algorithm>
#include <string>
#include <ostream>

#include <realm/util/features.h>
#include <realm/utilities.hpp>

namespace realm {

/// A reference to a chunk of binary data.
///
/// This class does not own the referenced memory, nor does it in any other way
/// attempt to manage the lifetime of it.
///
/// \sa StringData
class BinaryData {
public:
    BinaryData() noexcept : m_data(0), m_size(0) {}
    BinaryData(const char* data, std::size_t size) noexcept: m_data(data), m_size(size) {}
    template<std::size_t N> explicit BinaryData(const char (&data)[N]): m_data(data), m_size(N) {}
    template<class T, class A> explicit BinaryData(const std::basic_string<char, T, A>&);

#if REALM_HAVE_CXX11_EXPLICIT_CONV_OPERATORS
    template<class T, class A> explicit operator std::basic_string<char, T, A>() const;
#endif

    char operator[](std::size_t i) const noexcept { return m_data[i]; }

    const char* data() const noexcept { return m_data; }
    std::size_t size() const noexcept { return m_size; }

    /// Is this a null reference?
    ///
    /// An instance of BinaryData is a null reference when, and only when the
    /// stored size is zero (size()) and the stored pointer is the null pointer
    /// (data()).
    ///
    /// In the case of the empty byte sequence, the stored size is still zero,
    /// but the stored pointer is **not** the null pointer. Note that the actual
    /// value of the pointer is immaterial in this case (as long as it is not
    /// zero), because when the size is zero, it is an error to dereference the
    /// pointer.
    ///
    /// Conversion of a BinaryData object to `bool` yields the logical negation
    /// of the result of calling this function. In other words, a BinaryData
    /// object is converted to true if it is not the null reference, otherwise
    /// it is converted to false.
    ///
    /// It is important to understand that all of the functions and operators in
    /// this class, and most of the functions in the Realm API in general
    /// makes no distinction between a null reference and a reference to the
    /// empty byte sequence. These functions and operators never look at the
    /// stored pointer if the stored size is zero.
    bool is_null() const noexcept;

    friend bool operator==(const BinaryData&, const BinaryData&) noexcept;
    friend bool operator!=(const BinaryData&, const BinaryData&) noexcept;

    //@{
    /// Trivial bytewise lexicographical comparison.
    friend bool operator<(const BinaryData&, const BinaryData&) noexcept;
    friend bool operator>(const BinaryData&, const BinaryData&) noexcept;
    friend bool operator<=(const BinaryData&, const BinaryData&) noexcept;
    friend bool operator>=(const BinaryData&, const BinaryData&) noexcept;
    //@}

    bool begins_with(BinaryData) const noexcept;
    bool ends_with(BinaryData) const noexcept;
    bool contains(BinaryData) const noexcept;

    template<class C, class T>
    friend std::basic_ostream<C,T>& operator<<(std::basic_ostream<C,T>&, const BinaryData&);

#ifdef REALM_HAVE_CXX11_EXPLICIT_CONV_OPERATORS
    explicit operator bool() const noexcept;
#else
    typedef const char* BinaryData::*unspecified_bool_type;
    operator unspecified_bool_type() const noexcept;
#endif

private:
    const char* m_data;
    std::size_t m_size;
};

// Implementation:

template<class T, class A> inline BinaryData::BinaryData(const std::basic_string<char, T, A>& s):
    m_data(s.data()),
    m_size(s.size())
{
}

#if REALM_HAVE_CXX11_EXPLICIT_CONV_OPERATORS

template<class T, class A> inline BinaryData::operator std::basic_string<char, T, A>() const
{
    return std::basic_string<char, T, A>(m_data, m_size);
}

#endif

inline bool BinaryData::is_null() const noexcept
{
    return !m_data;
}

inline bool operator==(const BinaryData& a, const BinaryData& b) noexcept
{
    return a.m_size == b.m_size && a.is_null() == b.is_null() && safe_equal(a.m_data, a.m_data + a.m_size, b.m_data);
}

inline bool operator!=(const BinaryData& a, const BinaryData& b) noexcept
{
    return !(a == b);
}

inline bool operator<(const BinaryData& a, const BinaryData& b) noexcept
{
    if (a.is_null() || b.is_null())
        return !a.is_null() < !b.is_null();

    return std::lexicographical_compare(a.m_data, a.m_data + a.m_size,
                                        b.m_data, b.m_data + b.m_size);
}

inline bool operator>(const BinaryData& a, const BinaryData& b) noexcept
{
    return b < a;
}

inline bool operator<=(const BinaryData& a, const BinaryData& b) noexcept
{
    return !(b < a);
}

inline bool operator>=(const BinaryData& a, const BinaryData& b) noexcept
{
    return !(a < b);
}

inline bool BinaryData::begins_with(BinaryData d) const noexcept
{
    if (is_null() && !d.is_null())
        return false;

    return d.m_size <= m_size && safe_equal(m_data, m_data + d.m_size, d.m_data);
}

inline bool BinaryData::ends_with(BinaryData d) const noexcept
{
    if (is_null() && !d.is_null())
        return false;

    return d.m_size <= m_size && safe_equal(m_data + m_size - d.m_size, m_data + m_size, d.m_data);
}

inline bool BinaryData::contains(BinaryData d) const noexcept
{
    if (is_null() && !d.is_null())
        return false;

    return d.m_size == 0 ||
        std::search(m_data, m_data + m_size, d.m_data, d.m_data + d.m_size) != m_data + m_size;
}

template<class C, class T>
inline std::basic_ostream<C,T>& operator<<(std::basic_ostream<C,T>& out, const BinaryData& d)
{
    out << "BinaryData("<<static_cast<const void*>(d.m_data)<<", "<<d.m_size<<")";
    return out;
}

#ifdef REALM_HAVE_CXX11_EXPLICIT_CONV_OPERATORS
inline BinaryData::operator bool() const noexcept
{
    return !is_null();
}
#else
inline BinaryData::operator unspecified_bool_type() const noexcept
{
    return is_null() ? 0 : &BinaryData::m_data;
}
#endif

} // namespace realm

#endif // REALM_BINARY_DATA_HPP


text:
/***************************  LICENSE  *******************************
* This file is part of UBL.
*
* UBL is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* UBL is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with UBL.  If not, see <http://www.gnu.org/licenses/>.
***********************************************************************/

import learn.*;
import lambda.*;
import parser.*;

public class DevTrain extends Train {

	public static void main(String[] args){

	PType.addTypesFromFile("geo-lambda.types");
	Lang.loadLangFromFile("geo-lambda.lang");

	int runNum = Integer.parseInt(args[0]);
	int splitNum = Integer.parseInt(args[1]);
	String language = args[2];

	DataSet train = new DataSet("data/"+language+"/run-"+runNum+"/fold-"+splitNum+"/train");
	System.out.println("Train Size: "+train.size());

	DataSet test = new DataSet("data/"+language+"/run-"+runNum+"/fold-"+splitNum+"/test");
	System.out.println("Test Size: "+test.size());

	String giza_probs = "data/"+language+"/run-"+runNum+"/fold-"+splitNum+"/w-c.giza_probs";
	LexiconFeatSet.loadCoOccCounts(giza_probs);

	String fixedlex =null;
	fixedlex =  language+"-np-fixedlex.geo";

	Lexicon fixed = new Lexicon();
	fixed.addEntriesFromFile(fixedlex,true);

	Train.EPOCHS=10;
	Train.alpha_0 = 1.0;
	Train.c = 0.00001;
	Train.maxSentLen=50;

	LexiconFeatSet.initWeightMultiplier = 10.0;
	LexiconFeatSet.initLexWeight = 10.0;
	Parser.pruneN=200;

	System.out.println("alpha_0 = "+Train.alpha_0);
	System.out.println("C = "+Train.c);
	System.out.println("initialMultiplier = "+LexiconFeatSet.initWeightMultiplier);
	System.out.println("NP init = "+LexiconFeatSet.initLexWeight);
	System.out.println("Parser beam  = "+Parser.pruneN);

	Parser p = new Parser(fixed);
	p.makeFeatures();

	Train t = new Train();
	t.setDataSet(train);
	t.setTestSet(test);

	Train.verbose = true;
	t.stocGradTrain(p,true);

	t.test(p,Train.pruneLex);

	}
}

redpajama_set_name: RedPajamaGithub


text:
import sys
sys.path.insert(1,"../../../")
import time

from h2o.estimators.xgboost import *
from tests import pyunit_utils

'''
The goal of this test is to compare the results of H2OXGBoost and natibve XGBoost for binomial classification.
The dataset contains only enum columns.
'''
def comparison_test():
    if sys.version.startswith("2"):
        print("native XGBoost tests only supported on python3")
        return
    import xgboost as xgb
    assert H2OXGBoostEstimator.available() is True
    ret = h2o.cluster()
    if len(ret.nodes) == 1:
        runSeed = 1
        dataSeed = 17
        ntrees = 17
        responseL = 11
        # CPU Backend is forced for the results to be comparable
        h2oParamsS = {"ntrees":ntrees, "max_depth":4, "seed":runSeed, "learn_rate":0.7, "col_sample_rate_per_tree" : 0.9,
                      "min_rows" : 5, "score_tree_interval": ntrees+1, "dmatrix_type":"sparse", "tree_method": "exact", "backend":"cpu"}
        nativeParam = {'colsample_bytree': h2oParamsS["col_sample_rate_per_tree"],
                       'tree_method': 'exact',
                       'seed': h2oParamsS["seed"],
                       'booster': 'gbtree',
                       'objective': 'multi:softprob',
                       'eta': h2oParamsS["learn_rate"],
                       'grow_policy': 'depthwise',
                       'alpha': 0.0,
                       'subsample': 1.0,
                       'colsample_bylevel': 1.0,
                       'max_delta_step': 0.0,
                       'min_child_weight': h2oParamsS["min_rows"],
                       'gamma': 0.0,
                       'max_depth': h2oParamsS["max_depth"],
                       'num_class':responseL}

        nrows = 10000
        ncols = 10
        factorL = 11
        numCols = 0
        enumCols = ncols-numCols

        trainFile = pyunit_utils.genTrainFrame(nrows, numCols, enumCols=enumCols, enumFactors=factorL, miscfrac=0.5,
                                               responseLevel=responseL, randseed=dataSeed)       # load in dataset and add response column
        print(trainFile)
        myX = trainFile.names
        y='response'
        myX.remove(y)
        nativeTrain = pyunit_utils.convertH2OFrameToDMatrixSparse(trainFile, y, enumCols=myX)

        h2oModelS = H2OXGBoostEstimator(**h2oParamsS)
        # gather, print and save performance numbers for h2o model
        h2oModelS.train(x=myX, y=y, training_frame=trainFile)
        h2oTrainTimeS = h2oModelS._model_json["output"]["run_time"]
        time1 = time.time()
        h2oPredictS = h2oModelS.predict(trainFile)
        h2oPredictTimeS = time.time()-time1

        # train the native XGBoost
        nrounds = ntrees
        nativeModel = xgb.train(params=nativeParam, dtrain=nativeTrain, num_boost_round=nrounds)
        modelInfo = nativeModel.get_dump()
        print(modelInfo)
        print("num_boost_round: {1}, Number of trees built: {0}".format(len(modelInfo), nrounds))
        nativeTrainTime = time.time()-time1
        time1=time.time()
        nativePred = nativeModel.predict(data=nativeTrain, ntree_limit=ntrees)
        nativeScoreTime = time.time()-time1

        print("Comparing H2OXGBoost results with native XGBoost result when DMatrix is set to sparse.....")
        pyunit_utils.summarizeResult_multinomial(h2oPredictS, nativePred, h2oTrainTimeS, nativeTrainTime, h2oPredictTimeS,
                                              nativeScoreTime, tolerance=1e-6)
    else:
        print("********  Test skipped.  This test cannot be performed in multinode environment.")

if __name__ == "__main__":
    pyunit_utils.standalone_test(comparison_test)
else:
    comparison_test()


text:
@implementation CHMessageTextEvent

@end


text:
package cn.liuyb.app.portal.web;

//this is a mark interface that make a controller access by user,
public interface NeedLoginController {
//设置需要登录的访问
}


text:
require "thread"

require "log4r"

module Vagrant
  module Action
    module Builtin
      # This built-in middleware handles the `box` setting by verifying
      # the box is already installed, downloading the box if it isn't,
      # updating the box if it is requested, etc.
      class HandleBox
        @@big_lock = Mutex.new
        @@small_locks = Hash.new { |h,k| h[k] = Mutex.new }

        def initialize(app, env)
          @app = app
          @logger = Log4r::Logger.new("vagrant::action::builtin::handle_box")
        end

        def call(env)
          machine = env[:machine]

          if !machine.config.vm.box || machine.config.vm.box.to_s.empty?
            @logger.info("Skipping HandleBox because no box is set")
            return @app.call(env)
          end

          # Acquire a lock for this box to handle multi-threaded
          # environments.
          lock = nil
          @@big_lock.synchronize do
            lock = @@small_locks[machine.config.vm.box]
          end

          box_updated = false
          lock.synchronize do
            if machine.box
              @logger.info("Machine already has box. HandleBox will not run.")
              next
            end

            handle_box(env)
            box_updated = true
          end

          if box_updated
            # Reload the environment and set the VM to be the new loaded VM.
            new_machine = machine.vagrantfile.machine(
              machine.name, machine.provider_name,
              machine.env.boxes, machine.data_dir, machine.env)
            env[:machine].box = new_machine.box
            env[:machine].config = new_machine.config
            env[:machine].provider_config = new_machine.provider_config
          end

          @app.call(env)
        end

        def handle_box(env)
          machine = env[:machine]

          # Determine the set of formats that this box can be in
          box_download_ca_cert = machine.config.vm.box_download_ca_cert
          box_download_ca_path = machine.config.vm.box_download_ca_path
          box_download_client_cert = machine.config.vm.box_download_client_cert
          box_download_insecure = machine.config.vm.box_download_insecure
          box_download_checksum_type = machine.config.vm.box_download_checksum_type
          box_download_checksum = machine.config.vm.box_download_checksum
          box_download_location_trusted = machine.config.vm.box_download_location_trusted
          box_extra_download_options = machine.config.vm.box_extra_download_options
          box_formats = machine.provider_options[:box_format] ||
            machine.provider_name

          version_ui = machine.config.vm.box_version
          version_ui ||= ">= 0"

          env[:ui].output(I18n.t(
            "vagrant.box_auto_adding", name: machine.config.vm.box))
          env[:ui].detail("Box Provider: #{Array(box_formats).join(", ")}")
          env[:ui].detail("Box Version: #{version_ui}")

          begin
            env[:action_runner].run(Vagrant::Action.action_box_add, env.merge({
              box_name: machine.config.vm.box,
              box_url: machine.config.vm.box_url || machine.config.vm.box,
              box_server_url: machine.config.vm.box_server_url,
              box_provider: box_formats,
              box_version: machine.config.vm.box_version,
              box_download_client_cert: box_download_client_cert,
              box_download_ca_cert: box_download_ca_cert,
              box_download_ca_path: box_download_ca_path,
              box_download_insecure: box_download_insecure,
              box_checksum_type: box_download_checksum_type,
              box_checksum: box_download_checksum,
              box_download_location_trusted: box_download_location_trusted,
              box_extra_download_options: box_extra_download_options,
            }))
          rescue Errors::BoxAlreadyExists
            # Just ignore this, since it means the next part will succeed!
            # This can happen in a multi-threaded environment.
          end
        end
      end
    end
  end
end


text:
BEGIN;

/* Use unlogged if you want more speed / feeling brave
CREATE UNLOGGED TABLE rqd2_jobs (
*/

CREATE TABLE rqd2_jobs (
  id          bigserial PRIMARY KEY,
  q_name      varchar(255) not null,
  klass       text not null check (length(klass) > 0),
  args        json not null,
  attempts    integer not null default 0,
  locked_by   integer,
  enqueued_at timestamp without time zone NOT NULL DEFAULT NOW(),
  locked_at   timestamp without time zone,
  failed_at   timestamp without time zone
) WITH (OIDS=FALSE);

ALTER SEQUENCE rqd2_jobs_id_seq CACHE 500;

COMMIT;


text:
namespace clover {
namespace util {

/// Wrapper for std::atomic allowing copying and moving
/// @note Copying and moving aren't atomic operations
template <typename T, typename Enable= void>
class Atomic {
public:
	Atomic()= default;
	Atomic(T v): value(std::move(v)){}
	Atomic(const Atomic& other): value(other.value.load()){}
	Atomic(Atomic&& other): value(other.value.load()){}

	Atomic& operator=(const Atomic& other){ value= other.value.load(); return *this; }
	Atomic& operator=(Atomic&& other){ value= other.value.load(); return *this; }

	void store(T v){ value.store(std::move(v)); }
	T load() const { return value.load(); }
	operator T() const { return value; }

	/// @todo Rest of std::atomic operations

private:
	std::atomic<T> value;
};

template <typename T>
class Atomic<T*> : public Atomic<T*, int> {
public:
	using Base= Atomic<T*, int>;

	using Base::Base;

	T& operator*(){ return *Base::load(); }
	T* operator->(){ return Base::load(); }
};

/// Atomic wrapper for classes
template <typename T>
class Atomic<T, typename std::enable_if<	!std::is_integral<T>::value &&
											!std::is_enum<T>::value &&
											!std::is_pointer<T>::value >::type> {
public:
	template <typename U>
	class Proxy {
	public:

		Proxy(U& v, RecursiveMutex& m): value(&v), mutex(&m){ mutex->lock(); }
		Proxy(Proxy&&)= default;
		Proxy(const Proxy&)= delete;
		~Proxy(){ if (mutex) mutex->unlock(); }

		U* operator->(){ return value.get(); }

	private:
		TidyPtr<U> value;
		TidyPtr<RecursiveMutex> mutex;
	};

	Atomic()= default;
	Atomic(T v): value(std::move(v)){}

	Proxy<T> operator->(){ return Proxy<T>(value, access); }
	Proxy<const T> operator->() const { return Proxy<const T>(value, access); }

private:

	T value;
	mutable RecursiveMutex access;
};

} // util
} // clover

#endif // CLOVER_UTIL_ATOMIC_HPP


text:
package starlark

import (
	"errors"
	"fmt"
	"reflect"
	"strings"

	"github.com/influxdata/telegraf"
	"go.starlark.net/starlark"
)

// FieldDict is a starlark.Value for the metric fields.  It is heavily based on the
// starlark.Dict.
type FieldDict struct {
	*Metric
}

func (d FieldDict) String() string {
	buf := new(strings.Builder)
	buf.WriteString("{")
	sep := ""
	for _, item := range d.Items() {
		k, v := item[0], item[1]
		buf.WriteString(sep)
		buf.WriteString(k.String())
		buf.WriteString(": ")
		buf.WriteString(v.String())
		sep = ", "
	}
	buf.WriteString("}")
	return buf.String()
}

func (d FieldDict) Type() string {
	return "Fields"
}

func (d FieldDict) Freeze() {
	d.frozen = true
}

func (d FieldDict) Truth() starlark.Bool {
	return len(d.metric.FieldList()) != 0
}

func (d FieldDict) Hash() (uint32, error) {
	return 0, errors.New("not hashable")
}

// AttrNames implements the starlark.HasAttrs interface.
func (d FieldDict) AttrNames() []string {
	return builtinAttrNames(FieldDictMethods)
}

// Attr implements the starlark.HasAttrs interface.
func (d FieldDict) Attr(name string) (starlark.Value, error) {
	return builtinAttr(d, name, FieldDictMethods)
}

var FieldDictMethods = map[string]builtinMethod{
	"clear":      dictClear,
	"get":        dictGet,
	"items":      dictItems,
	"keys":       dictKeys,
	"pop":        dictPop,
	"popitem":    dictPopitem,
	"setdefault": dictSetdefault,
	"update":     dictUpdate,
	"values":     dictValues,
}

// Get implements the starlark.Mapping interface.
func (d FieldDict) Get(key starlark.Value) (v starlark.Value, found bool, err error) {
	if k, ok := key.(starlark.String); ok {
		gv, found := d.metric.GetField(k.GoString())
		if !found {
			return starlark.None, false, nil
		}

		v, err := asStarlarkValue(gv)
		if err != nil {
			return starlark.None, false, err
		}
		return v, true, nil
	}

	return starlark.None, false, errors.New("key must be of type 'str'")
}

// SetKey implements the starlark.HasSetKey interface to support map update
// using x[k]=v syntax, like a dictionary.
func (d FieldDict) SetKey(k, v starlark.Value) error {
	if d.fieldIterCount > 0 {
		return fmt.Errorf("cannot insert during iteration")
	}

	key, ok := k.(starlark.String)
	if !ok {
		return errors.New("field key must be of type 'str'")
	}

	gv, err := asGoValue(v)
	if err != nil {
		return err
	}

	d.metric.AddField(key.GoString(), gv)
	return nil
}

// Items implements the starlark.IterableMapping interface.
func (d FieldDict) Items() []starlark.Tuple {
	items := make([]starlark.Tuple, 0, len(d.metric.FieldList()))
	for _, field := range d.metric.FieldList() {
		key := starlark.String(field.Key)
		sv, err := asStarlarkValue(field.Value)
		if err != nil {
			continue
		}
		pair := starlark.Tuple{key, sv}
		items = append(items, pair)
	}
	return items
}

func (d FieldDict) Clear() error {
	if d.fieldIterCount > 0 {
		return fmt.Errorf("cannot delete during iteration")
	}

	keys := make([]string, 0, len(d.metric.FieldList()))
	for _, field := range d.metric.FieldList() {
		keys = append(keys, field.Key)
	}

	for _, key := range keys {
		d.metric.RemoveField(key)
	}
	return nil
}

func (d FieldDict) PopItem() (v starlark.Value, err error) {
	if d.fieldIterCount > 0 {
		return nil, fmt.Errorf("cannot delete during iteration")
	}

	for _, field := range d.metric.FieldList() {
		k := field.Key
		v := field.Value

		d.metric.RemoveField(k)

		sk := starlark.String(k)
		sv, err := asStarlarkValue(v)
		if err != nil {
			return nil, fmt.Errorf("could not convert to starlark value")
		}

		return starlark.Tuple{sk, sv}, nil
	}

	return nil, errors.New("popitem(): field dictionary is empty")
}

func (d FieldDict) Delete(k starlark.Value) (v starlark.Value, found bool, err error) {
	if d.fieldIterCount > 0 {
		return nil, false, fmt.Errorf("cannot delete during iteration")
	}

	if key, ok := k.(starlark.String); ok {
		value, ok := d.metric.GetField(key.GoString())
		if ok {
			d.metric.RemoveField(key.GoString())
			sv, err := asStarlarkValue(value)
			return sv, ok, err
		}
	}

	return starlark.None, false, errors.New("key must be of type 'str'")
}

// Items implements the starlark.Mapping interface.
func (d FieldDict) Iterate() starlark.Iterator {
	d.fieldIterCount++
	return &FieldIterator{Metric: d.Metric, fields: d.metric.FieldList()}
}

type FieldIterator struct {
	*Metric
	fields []*telegraf.Field
}

// Next implements the starlark.Iterator interface.
func (i *FieldIterator) Next(p *starlark.Value) bool {
	if len(i.fields) == 0 {
		return false
	}

	field := i.fields[0]
	i.fields = i.fields[1:]
	*p = starlark.String(field.Key)

	return true
}

// Done implements the starlark.Iterator interface.
func (i *FieldIterator) Done() {
	i.fieldIterCount--
}

// AsStarlarkValue converts a field value to a starlark.Value.
func asStarlarkValue(value interface{}) (starlark.Value, error) {
	v := reflect.ValueOf(value)
	switch v.Kind() {
	case reflect.Slice:
		length := v.Len()
		array := make([]starlark.Value, length)
		for i := 0; i < length; i++ {
			sVal, err := asStarlarkValue(v.Index(i).Interface())
			if err != nil {
				return starlark.None, err
			}
			array[i] = sVal
		}
		return starlark.NewList(array), nil
	case reflect.Map:
		dict := starlark.NewDict(v.Len())
		iter := v.MapRange()
		for iter.Next() {
			sKey, err := asStarlarkValue(iter.Key().Interface())
			if err != nil {
				return starlark.None, err
			}
			sValue, err := asStarlarkValue(iter.Value().Interface())
			if err != nil {
				return starlark.None, err
			}
			dict.SetKey(sKey, sValue)
		}
		return dict, nil
	case reflect.Float32, reflect.Float64:
		return starlark.Float(v.Float()), nil
	case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:
		return starlark.MakeInt64(v.Int()), nil
	case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64:
		return starlark.MakeUint64(v.Uint()), nil
	case reflect.String:
		return starlark.String(v.String()), nil
	case reflect.Bool:
		return starlark.Bool(v.Bool()), nil
	}

	return starlark.None, errors.New("invalid type")
}

// AsGoValue converts a starlark.Value to a field value.
func asGoValue(value interface{}) (interface{}, error) {
	switch v := value.(type) {
	case starlark.Float:
		return float64(v), nil
	case starlark.Int:
		n, ok := v.Int64()
		if !ok {
			return nil, errors.New("cannot represent integer as int64")
		}
		return n, nil
	case starlark.String:
		return string(v), nil
	case starlark.Bool:
		return bool(v), nil
	}

	return nil, errors.New("invalid starlark type")
}


text:
package com.application.restaurantreservation.utils;

import android.content.res.AssetManager;
import android.util.Log;
import android.util.SparseArray;

import java.io.InputStream;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;

import io.reactivex.Observable;

public class Utils {

    private static final String TAG = "Utils";

    /**
     * read file from assets, depending on filename provided
     * @param assets
     * @param filename
     * @return
     */
    public static String readFileFromAssets(AssetManager assets, String filename) {
        try {
            InputStream is = assets.open(filename);
            int size = is.available();

            // Read the entire asset into a local byte buffer.
            byte[] buffer = new byte[size];
            is.read(buffer);
            is.close();

            // Convert the buffer into a string.
            return new String(buffer);
        } catch (Exception e) {
            return null;
        }
    }

    public static String stringify(List<Boolean> list) {
        return Arrays.toString(list.toArray());
    }

}


text:
<?xml version="1.0" encoding="ISO-8859-1"?>
<project name="WSO2 Eclipse Web Service Authoring Tools">
    <body>

        <menu name="WSO2 Eclipse IDE Tools">
            <item name="Release Notes" href="release_notes.html"/>
            <item name="Install" href="install_guide.html"/>
        </menu>

        <menu name="Downloads">
            <item name="Releases" href="http://wso2.org/download/tools/wsas/wsas-authoring"/>
        </menu>

        <menu name="Documentation" href="index_docs.html">
            <item name="Create Web Service" href="create_webservice.html"/>
            <item name="Web Service Client" href="top_down_client.html"/>
            <item name="Top Down Web Service" href="top_down_ws.html"/>
            <item name="WSO2 Tools" href="wso2_tools.html"/>
        </menu>

        <menu name="Get Involved" href="overview.html">
            <item name="Checkout the Source" href="source-repository.html"/>
            <item name="Mailing Lists" href="mail-lists.html"/>
        </menu>

        <menu name="Project Information">
            <item name="License"
                  href="http://www.apache.org/licenses/LICENSE-2.0.html"/>
        </menu>

    </body>
</project>


text:
package tr.edu.izu.iprocess.matrix;

import tr.edu.izu.iprocess.matrix.operation.IBasicMatrixOperation;

public abstract class AbstractMatrix<T extends Number> implements IBasicMatrixOperation<T> {

	private T[][] datas = null;
	private int rowsCount = 0;
	private int columnsCount = 0;

	public AbstractMatrix(int aRow, int aCol) {
		this(aRow, aCol, null);
	}

	public AbstractMatrix(int aRow, int aCol, T defaultValue) {
		setRowsCount(aRow);
		setColumnsCount(aCol);
		this.setDatas(initMatris(defaultValue));
	}

	protected abstract T[][] initMatris(T defaultValue);

	protected void setRowsCount(int aRowsCount) {
		this.rowsCount = aRowsCount;
	}

	protected void setColumnsCount(int aColumsCount) {
		this.columnsCount = aColumsCount;
	}

	public int getRowsCount() {
		return rowsCount;
	}

	public int getColumnsCount() {
		return columnsCount;
	}

	protected void checkIndices(int row, int col) {
		String exceptionMessage = null;

		if (row < 0 || col < 0) {
			exceptionMessage = "Row and/or Column must be non negative";
			throw new RuntimeException(exceptionMessage, new IndexOutOfBoundsException(exceptionMessage));

		}

		if (row >= this.rowsCount || col >= this.columnsCount) {
			exceptionMessage = "[" + row + "," + col + "] is greater than [" + this.rowsCount + "," + this.columnsCount
					+ "]";
			throw new RuntimeException(exceptionMessage, new IndexOutOfBoundsException(exceptionMessage));
		}
	}

	public void setValue(int row, int col, T value) {
		checkIndices(row, col);
		getDatas()[row][col] = value;
	}

	public T getValue(int row, int col) {
		checkIndices(row, col);
		return getDatas()[row][col];
	}

	public T[][] getDatas() {
		return datas;
	}

	public void setDatas(T[][] datas) {
		this.datas = datas;
	}

}


text:
/*
 * arch/arm/plat-orion/common.c
 *
 * Marvell Orion SoC common setup code used by multiple mach-/common.c
 *
 * This file is licensed under the terms of the GNU General Public
 * License version 2.  This program is licensed "as is" without any
 * warranty of any kind, whether express or implied.
 */

#include <linux/kernel.h>
#include <linux/init.h>
#include <linux/platform_device.h>
#include <linux/dma-mapping.h>
#include <linux/serial_8250.h>
#include <linux/ata_platform.h>
#include <linux/clk.h>
#include <linux/clkdev.h>
#include <linux/mv643xx_eth.h>
#include <linux/mv643xx_i2c.h>
#include <net/dsa.h>
#include <linux/platform_data/dma-mv_xor.h>
#include <linux/platform_data/usb-ehci-orion.h>
#include <plat/common.h>

/* Create a clkdev entry for a given device/clk */
void __init orion_clkdev_add(const char *con_id, const char *dev_id,
			     struct clk *clk)
{
	clkdev_create(clk, con_id, "%s", dev_id);
}

/* Create clkdev entries for all orion platforms except kirkwood.
   Kirkwood has gated clocks for some of its peripherals, so creates
   its own clkdev entries. For all the other orion devices, create
   clkdev entries to the tclk. */
void __init orion_clkdev_init(struct clk *tclk)
{
	orion_clkdev_add(NULL, "orion_spi.0", tclk);
	orion_clkdev_add(NULL, "orion_spi.1", tclk);
	orion_clkdev_add(NULL, MV643XX_ETH_NAME ".0", tclk);
	orion_clkdev_add(NULL, MV643XX_ETH_NAME ".1", tclk);
	orion_clkdev_add(NULL, MV643XX_ETH_NAME ".2", tclk);
	orion_clkdev_add(NULL, MV643XX_ETH_NAME ".3", tclk);
	orion_clkdev_add(NULL, "orion_wdt", tclk);
	orion_clkdev_add(NULL, MV64XXX_I2C_CTLR_NAME ".0", tclk);
}

/* Fill in the resources structure and link it into the platform
   device structure. There is always a memory region, and nearly
   always an interrupt.*/
static void fill_resources(struct platform_device *device,
			   struct resource *resources,
			   resource_size_t mapbase,
			   resource_size_t size,
			   unsigned int irq)
{
	device->resource = resources;
	device->num_resources = 1;
	resources[0].flags = IORESOURCE_MEM;
	resources[0].start = mapbase;
	resources[0].end = mapbase + size;

	if (irq != NO_IRQ) {
		device->num_resources++;
		resources[1].flags = IORESOURCE_IRQ;
		resources[1].start = irq;
		resources[1].end = irq;
	}
}

/*****************************************************************************
 * UART
 ****************************************************************************/
static unsigned long __init uart_get_clk_rate(struct clk *clk)
{
	clk_prepare_enable(clk);
	return clk_get_rate(clk);
}

static void __init uart_complete(
	struct platform_device *orion_uart,
	struct plat_serial8250_port *data,
	struct resource *resources,
	void __iomem *membase,
	resource_size_t mapbase,
	unsigned int irq,
	struct clk *clk)
{
	data->mapbase = mapbase;
	data->membase = membase;
	data->irq = irq;
	data->uartclk = uart_get_clk_rate(clk);
	orion_uart->dev.platform_data = data;

	fill_resources(orion_uart, resources, mapbase, 0xff, irq);
	platform_device_register(orion_uart);
}

/*****************************************************************************
 * UART0
 ****************************************************************************/
static struct plat_serial8250_port orion_uart0_data[] = {
	{
		.flags		= UPF_SKIP_TEST | UPF_BOOT_AUTOCONF,
		.iotype		= UPIO_MEM,
		.regshift	= 2,
	}, {
	},
};

static struct resource orion_uart0_resources[2];

static struct platform_device orion_uart0 = {
	.name			= "serial8250",
	.id			= PLAT8250_DEV_PLATFORM,
};

void __init orion_uart0_init(void __iomem *membase,
			     resource_size_t mapbase,
			     unsigned int irq,
			     struct clk *clk)
{
	uart_complete(&orion_uart0, orion_uart0_data, orion_uart0_resources,
		      membase, mapbase, irq, clk);
}

/*****************************************************************************
 * UART1
 ****************************************************************************/
static struct plat_serial8250_port orion_uart1_data[] = {
	{
		.flags		= UPF_SKIP_TEST | UPF_BOOT_AUTOCONF,
		.iotype		= UPIO_MEM,
		.regshift	= 2,
	}, {
	},
};

static struct resource orion_uart1_resources[2];

static struct platform_device orion_uart1 = {
	.name			= "serial8250",
	.id			= PLAT8250_DEV_PLATFORM1,
};

void __init orion_uart1_init(void __iomem *membase,
			     resource_size_t mapbase,
			     unsigned int irq,
			     struct clk *clk)
{
	uart_complete(&orion_uart1, orion_uart1_data, orion_uart1_resources,
		      membase, mapbase, irq, clk);
}

/*****************************************************************************
 * UART2
 ****************************************************************************/
static struct plat_serial8250_port orion_uart2_data[] = {
	{
		.flags		= UPF_SKIP_TEST | UPF_BOOT_AUTOCONF,
		.iotype		= UPIO_MEM,
		.regshift	= 2,
	}, {
	},
};

static struct resource orion_uart2_resources[2];

static struct platform_device orion_uart2 = {
	.name			= "serial8250",
	.id			= PLAT8250_DEV_PLATFORM2,
};

void __init orion_uart2_init(void __iomem *membase,
			     resource_size_t mapbase,
			     unsigned int irq,
			     struct clk *clk)
{
	uart_complete(&orion_uart2, orion_uart2_data, orion_uart2_resources,
		      membase, mapbase, irq, clk);
}

/*****************************************************************************
 * UART3
 ****************************************************************************/
static struct plat_serial8250_port orion_uart3_data[] = {
	{
		.flags		= UPF_SKIP_TEST | UPF_BOOT_AUTOCONF,
		.iotype		= UPIO_MEM,
		.regshift	= 2,
	}, {
	},
};

static struct resource orion_uart3_resources[2];

static struct platform_device orion_uart3 = {
	.name			= "serial8250",
	.id			= 3,
};

void __init orion_uart3_init(void __iomem *membase,
			     resource_size_t mapbase,
			     unsigned int irq,
			     struct clk *clk)
{
	uart_complete(&orion_uart3, orion_uart3_data, orion_uart3_resources,
		      membase, mapbase, irq, clk);
}

/*****************************************************************************
 * SoC RTC
 ****************************************************************************/
static struct resource orion_rtc_resource[2];

void __init orion_rtc_init(unsigned long mapbase,
			   unsigned long irq)
{
	orion_rtc_resource[0].start = mapbase;
	orion_rtc_resource[0].end = mapbase + SZ_32 - 1;
	orion_rtc_resource[0].flags = IORESOURCE_MEM;
	orion_rtc_resource[1].start = irq;
	orion_rtc_resource[1].end = irq;
	orion_rtc_resource[1].flags = IORESOURCE_IRQ;

	platform_device_register_simple("rtc-mv", -1, orion_rtc_resource, 2);
}

/*****************************************************************************
 * GE
 ****************************************************************************/
static __init void ge_complete(
	struct mv643xx_eth_shared_platform_data *orion_ge_shared_data,
	struct resource *orion_ge_resource, unsigned long irq,
	struct platform_device *orion_ge_shared,
	struct platform_device *orion_ge_mvmdio,
	struct mv643xx_eth_platform_data *eth_data,
	struct platform_device *orion_ge)
{
	orion_ge_resource->start = irq;
	orion_ge_resource->end = irq;
	eth_data->shared = orion_ge_shared;
	orion_ge->dev.platform_data = eth_data;

	platform_device_register(orion_ge_shared);
	if (orion_ge_mvmdio)
		platform_device_register(orion_ge_mvmdio);
	platform_device_register(orion_ge);
}

/*****************************************************************************
 * GE00
 ****************************************************************************/
static struct mv643xx_eth_shared_platform_data orion_ge00_shared_data;

static struct resource orion_ge00_shared_resources[] = {
	{
		.name	= "ge00 base",
	},
};

static struct platform_device orion_ge00_shared = {
	.name		= MV643XX_ETH_SHARED_NAME,
	.id		= 0,
	.dev		= {
		.platform_data	= &orion_ge00_shared_data,
	},
};

static struct resource orion_ge_mvmdio_resources[] = {
	{
		.name	= "ge00 mvmdio base",
	}, {
		.name	= "ge00 mvmdio err irq",
	},
};

static struct platform_device orion_ge_mvmdio = {
	.name		= "orion-mdio",
	.id		= -1,
};

static struct resource orion_ge00_resources[] = {
	{
		.name	= "ge00 irq",
		.flags	= IORESOURCE_IRQ,
	},
};

static struct platform_device orion_ge00 = {
	.name		= MV643XX_ETH_NAME,
	.id		= 0,
	.num_resources	= 1,
	.resource	= orion_ge00_resources,
	.dev		= {
		.coherent_dma_mask	= DMA_BIT_MASK(32),
	},
};

void __init orion_ge00_init(struct mv643xx_eth_platform_data *eth_data,
			    unsigned long mapbase,
			    unsigned long irq,
			    unsigned long irq_err,
			    unsigned int tx_csum_limit)
{
	fill_resources(&orion_ge00_shared, orion_ge00_shared_resources,
		       mapbase + 0x2000, SZ_16K - 1, NO_IRQ);
	fill_resources(&orion_ge_mvmdio, orion_ge_mvmdio_resources,
			mapbase + 0x2004, 0x84 - 1, irq_err);
	orion_ge00_shared_data.tx_csum_limit = tx_csum_limit;
	ge_complete(&orion_ge00_shared_data,
		    orion_ge00_resources, irq, &orion_ge00_shared,
		    &orion_ge_mvmdio,
		    eth_data, &orion_ge00);
}

/*****************************************************************************
 * GE01
 ****************************************************************************/
static struct mv643xx_eth_shared_platform_data orion_ge01_shared_data;

static struct resource orion_ge01_shared_resources[] = {
	{
		.name	= "ge01 base",
	}
};

static struct platform_device orion_ge01_shared = {
	.name		= MV643XX_ETH_SHARED_NAME,
	.id		= 1,
	.dev		= {
		.platform_data	= &orion_ge01_shared_data,
	},
};

static struct resource orion_ge01_resources[] = {
	{
		.name	= "ge01 irq",
		.flags	= IORESOURCE_IRQ,
	},
};

static struct platform_device orion_ge01 = {
	.name		= MV643XX_ETH_NAME,
	.id		= 1,
	.num_resources	= 1,
	.resource	= orion_ge01_resources,
	.dev		= {
		.coherent_dma_mask	= DMA_BIT_MASK(32),
	},
};

void __init orion_ge01_init(struct mv643xx_eth_platform_data *eth_data,
			    unsigned long mapbase,
			    unsigned long irq,
			    unsigned long irq_err,
			    unsigned int tx_csum_limit)
{
	fill_resources(&orion_ge01_shared, orion_ge01_shared_resources,
		       mapbase + 0x2000, SZ_16K - 1, NO_IRQ);
	orion_ge01_shared_data.tx_csum_limit = tx_csum_limit;
	ge_complete(&orion_ge01_shared_data,
		    orion_ge01_resources, irq, &orion_ge01_shared,
		    NULL,
		    eth_data, &orion_ge01);
}

/*****************************************************************************
 * GE10
 ****************************************************************************/
static struct mv643xx_eth_shared_platform_data orion_ge10_shared_data;

static struct resource orion_ge10_shared_resources[] = {
	{
		.name	= "ge10 base",
	}
};

static struct platform_device orion_ge10_shared = {
	.name		= MV643XX_ETH_SHARED_NAME,
	.id		= 2,
	.dev		= {
		.platform_data	= &orion_ge10_shared_data,
	},
};

static struct resource orion_ge10_resources[] = {
	{
		.name	= "ge10 irq",
		.flags	= IORESOURCE_IRQ,
	},
};

static struct platform_device orion_ge10 = {
	.name		= MV643XX_ETH_NAME,
	.id		= 2,
	.num_resources	= 1,
	.resource	= orion_ge10_resources,
	.dev		= {
		.coherent_dma_mask	= DMA_BIT_MASK(32),
	},
};

void __init orion_ge10_init(struct mv643xx_eth_platform_data *eth_data,
			    unsigned long mapbase,
			    unsigned long irq,
			    unsigned long irq_err)
{
	fill_resources(&orion_ge10_shared, orion_ge10_shared_resources,
		       mapbase + 0x2000, SZ_16K - 1, NO_IRQ);
	ge_complete(&orion_ge10_shared_data,
		    orion_ge10_resources, irq, &orion_ge10_shared,
		    NULL,
		    eth_data, &orion_ge10);
}

/*****************************************************************************
 * GE11
 ****************************************************************************/
static struct mv643xx_eth_shared_platform_data orion_ge11_shared_data;

static struct resource orion_ge11_shared_resources[] = {
	{
		.name	= "ge11 base",
	},
};

static struct platform_device orion_ge11_shared = {
	.name		= MV643XX_ETH_SHARED_NAME,
	.id		= 3,
	.dev		= {
		.platform_data	= &orion_ge11_shared_data,
	},
};

static struct resource orion_ge11_resources[] = {
	{
		.name	= "ge11 irq",
		.flags	= IORESOURCE_IRQ,
	},
};

static struct platform_device orion_ge11 = {
	.name		= MV643XX_ETH_NAME,
	.id		= 3,
	.num_resources	= 1,
	.resource	= orion_ge11_resources,
	.dev		= {
		.coherent_dma_mask	= DMA_BIT_MASK(32),
	},
};

void __init orion_ge11_init(struct mv643xx_eth_platform_data *eth_data,
			    unsigned long mapbase,
			    unsigned long irq,
			    unsigned long irq_err)
{
	fill_resources(&orion_ge11_shared, orion_ge11_shared_resources,
		       mapbase + 0x2000, SZ_16K - 1, NO_IRQ);
	ge_complete(&orion_ge11_shared_data,
		    orion_ge11_resources, irq, &orion_ge11_shared,
		    NULL,
		    eth_data, &orion_ge11);
}

/*****************************************************************************
 * Ethernet switch
 ****************************************************************************/
static struct resource orion_switch_resources[] = {
	{
		.start	= 0,
		.end	= 0,
		.flags	= IORESOURCE_IRQ,
	},
};

static struct platform_device orion_switch_device = {
	.name		= "dsa",
	.id		= 0,
	.num_resources	= 0,
	.resource	= orion_switch_resources,
};

void __init orion_ge00_switch_init(struct dsa_platform_data *d, int irq)
{
	int i;

	if (irq != NO_IRQ) {
		orion_switch_resources[0].start = irq;
		orion_switch_resources[0].end = irq;
		orion_switch_device.num_resources = 1;
	}

	d->netdev = &orion_ge00.dev;
	for (i = 0; i < d->nr_chips; i++)
		d->chip[i].host_dev = &orion_ge_mvmdio.dev;
	orion_switch_device.dev.platform_data = d;

	platform_device_register(&orion_switch_device);
}

/*****************************************************************************
 * I2C
 ****************************************************************************/
static struct mv64xxx_i2c_pdata orion_i2c_pdata = {
	.freq_n		= 3,
	.timeout	= 1000, /* Default timeout of 1 second */
};

static struct resource orion_i2c_resources[2];

static struct platform_device orion_i2c = {
	.name		= MV64XXX_I2C_CTLR_NAME,
	.id		= 0,
	.dev		= {
		.platform_data	= &orion_i2c_pdata,
	},
};

static struct mv64xxx_i2c_pdata orion_i2c_1_pdata = {
	.freq_n		= 3,
	.timeout	= 1000, /* Default timeout of 1 second */
};

static struct resource orion_i2c_1_resources[2];

static struct platform_device orion_i2c_1 = {
	.name		= MV64XXX_I2C_CTLR_NAME,
	.id		= 1,
	.dev		= {
		.platform_data	= &orion_i2c_1_pdata,
	},
};

void __init orion_i2c_init(unsigned long mapbase,
			   unsigned long irq,
			   unsigned long freq_m)
{
	orion_i2c_pdata.freq_m = freq_m;
	fill_resources(&orion_i2c, orion_i2c_resources, mapbase,
		       SZ_32 - 1, irq);
	platform_device_register(&orion_i2c);
}

void __init orion_i2c_1_init(unsigned long mapbase,
			     unsigned long irq,
			     unsigned long freq_m)
{
	orion_i2c_1_pdata.freq_m = freq_m;
	fill_resources(&orion_i2c_1, orion_i2c_1_resources, mapbase,
		       SZ_32 - 1, irq);
	platform_device_register(&orion_i2c_1);
}

/*****************************************************************************
 * SPI
 ****************************************************************************/
static struct resource orion_spi_resources;

static struct platform_device orion_spi = {
	.name		= "orion_spi",
	.id		= 0,
};

static struct resource orion_spi_1_resources;

static struct platform_device orion_spi_1 = {
	.name		= "orion_spi",
	.id		= 1,
};

/* Note: The SPI silicon core does have interrupts. However the
 * current Linux software driver does not use interrupts. */

void __init orion_spi_init(unsigned long mapbase)
{
	fill_resources(&orion_spi, &orion_spi_resources,
		       mapbase, SZ_512 - 1, NO_IRQ);
	platform_device_register(&orion_spi);
}

void __init orion_spi_1_init(unsigned long mapbase)
{
	fill_resources(&orion_spi_1, &orion_spi_1_resources,
		       mapbase, SZ_512 - 1, NO_IRQ);
	platform_device_register(&orion_spi_1);
}

/*****************************************************************************
 * XOR
 ****************************************************************************/
static u64 orion_xor_dmamask = DMA_BIT_MASK(32);

/*****************************************************************************
 * XOR0
 ****************************************************************************/
static struct resource orion_xor0_shared_resources[] = {
	{
		.name	= "xor 0 low",
		.flags	= IORESOURCE_MEM,
	}, {
		.name	= "xor 0 high",
		.flags	= IORESOURCE_MEM,
	}, {
		.name   = "irq channel 0",
		.flags  = IORESOURCE_IRQ,
	}, {
		.name   = "irq channel 1",
		.flags  = IORESOURCE_IRQ,
	},
};

static struct mv_xor_channel_data orion_xor0_channels_data[2];

static struct mv_xor_platform_data orion_xor0_pdata = {
	.channels = orion_xor0_channels_data,
};

static struct platform_device orion_xor0_shared = {
	.name		= MV_XOR_NAME,
	.id		= 0,
	.num_resources	= ARRAY_SIZE(orion_xor0_shared_resources),
	.resource	= orion_xor0_shared_resources,
	.dev            = {
		.dma_mask               = &orion_xor_dmamask,
		.coherent_dma_mask      = DMA_BIT_MASK(64),
		.platform_data          = &orion_xor0_pdata,
	},
};

void __init orion_xor0_init(unsigned long mapbase_low,
			    unsigned long mapbase_high,
			    unsigned long irq_0,
			    unsigned long irq_1)
{
	orion_xor0_shared_resources[0].start = mapbase_low;
	orion_xor0_shared_resources[0].end = mapbase_low + 0xff;
	orion_xor0_shared_resources[1].start = mapbase_high;
	orion_xor0_shared_resources[1].end = mapbase_high + 0xff;

	orion_xor0_shared_resources[2].start = irq_0;
	orion_xor0_shared_resources[2].end = irq_0;
	orion_xor0_shared_resources[3].start = irq_1;
	orion_xor0_shared_resources[3].end = irq_1;

	dma_cap_set(DMA_MEMCPY, orion_xor0_channels_data[0].cap_mask);
	dma_cap_set(DMA_XOR, orion_xor0_channels_data[0].cap_mask);

	dma_cap_set(DMA_MEMCPY, orion_xor0_channels_data[1].cap_mask);
	dma_cap_set(DMA_XOR, orion_xor0_channels_data[1].cap_mask);

	platform_device_register(&orion_xor0_shared);
}

/*****************************************************************************
 * XOR1
 ****************************************************************************/
static struct resource orion_xor1_shared_resources[] = {
	{
		.name	= "xor 1 low",
		.flags	= IORESOURCE_MEM,
	}, {
		.name	= "xor 1 high",
		.flags	= IORESOURCE_MEM,
	}, {
		.name   = "irq channel 0",
		.flags  = IORESOURCE_IRQ,
	}, {
		.name   = "irq channel 1",
		.flags  = IORESOURCE_IRQ,
	},
};

static struct mv_xor_channel_data orion_xor1_channels_data[2];

static struct mv_xor_platform_data orion_xor1_pdata = {
	.channels = orion_xor1_channels_data,
};

static struct platform_device orion_xor1_shared = {
	.name		= MV_XOR_NAME,
	.id		= 1,
	.num_resources	= ARRAY_SIZE(orion_xor1_shared_resources),
	.resource	= orion_xor1_shared_resources,
	.dev            = {
		.dma_mask               = &orion_xor_dmamask,
		.coherent_dma_mask      = DMA_BIT_MASK(64),
		.platform_data          = &orion_xor1_pdata,
	},
};

void __init orion_xor1_init(unsigned long mapbase_low,
			    unsigned long mapbase_high,
			    unsigned long irq_0,
			    unsigned long irq_1)
{
	orion_xor1_shared_resources[0].start = mapbase_low;
	orion_xor1_shared_resources[0].end = mapbase_low + 0xff;
	orion_xor1_shared_resources[1].start = mapbase_high;
	orion_xor1_shared_resources[1].end = mapbase_high + 0xff;

	orion_xor1_shared_resources[2].start = irq_0;
	orion_xor1_shared_resources[2].end = irq_0;
	orion_xor1_shared_resources[3].start = irq_1;
	orion_xor1_shared_resources[3].end = irq_1;

	dma_cap_set(DMA_MEMCPY, orion_xor1_channels_data[0].cap_mask);
	dma_cap_set(DMA_XOR, orion_xor1_channels_data[0].cap_mask);

	dma_cap_set(DMA_MEMCPY, orion_xor1_channels_data[1].cap_mask);
	dma_cap_set(DMA_XOR, orion_xor1_channels_data[1].cap_mask);

	platform_device_register(&orion_xor1_shared);
}

/*****************************************************************************
 * EHCI
 ****************************************************************************/
static struct orion_ehci_data orion_ehci_data;
static u64 ehci_dmamask = DMA_BIT_MASK(32);

/*****************************************************************************
 * EHCI0
 ****************************************************************************/
static struct resource orion_ehci_resources[2];

static struct platform_device orion_ehci = {
	.name		= "orion-ehci",
	.id		= 0,
	.dev		= {
		.dma_mask		= &ehci_dmamask,
		.coherent_dma_mask	= DMA_BIT_MASK(32),
		.platform_data		= &orion_ehci_data,
	},
};

void __init orion_ehci_init(unsigned long mapbase,
			    unsigned long irq,
			    enum orion_ehci_phy_ver phy_version)
{
	orion_ehci_data.phy_version = phy_version;
	fill_resources(&orion_ehci, orion_ehci_resources, mapbase, SZ_4K - 1,
		       irq);

	platform_device_register(&orion_ehci);
}

/*****************************************************************************
 * EHCI1
 ****************************************************************************/
static struct resource orion_ehci_1_resources[2];

static struct platform_device orion_ehci_1 = {
	.name		= "orion-ehci",
	.id		= 1,
	.dev		= {
		.dma_mask		= &ehci_dmamask,
		.coherent_dma_mask	= DMA_BIT_MASK(32),
		.platform_data		= &orion_ehci_data,
	},
};

void __init orion_ehci_1_init(unsigned long mapbase,
			      unsigned long irq)
{
	fill_resources(&orion_ehci_1, orion_ehci_1_resources,
		       mapbase, SZ_4K - 1, irq);

	platform_device_register(&orion_ehci_1);
}

/*****************************************************************************
 * EHCI2
 ****************************************************************************/
static struct resource orion_ehci_2_resources[2];

static struct platform_device orion_ehci_2 = {
	.name		= "orion-ehci",
	.id		= 2,
	.dev		= {
		.dma_mask		= &ehci_dmamask,
		.coherent_dma_mask	= DMA_BIT_MASK(32),
		.platform_data		= &orion_ehci_data,
	},
};

void __init orion_ehci_2_init(unsigned long mapbase,
			      unsigned long irq)
{
	fill_resources(&orion_ehci_2, orion_ehci_2_resources,
		       mapbase, SZ_4K - 1, irq);

	platform_device_register(&orion_ehci_2);
}

/*****************************************************************************
 * SATA
 ****************************************************************************/
static struct resource orion_sata_resources[2] = {
	{
		.name	= "sata base",
	}, {
		.name	= "sata irq",
	},
};

static struct platform_device orion_sata = {
	.name		= "sata_mv",
	.id		= 0,
	.dev		= {
		.coherent_dma_mask	= DMA_BIT_MASK(32),
	},
};

void __init orion_sata_init(struct mv_sata_platform_data *sata_data,
			    unsigned long mapbase,
			    unsigned long irq)
{
	orion_sata.dev.platform_data = sata_data;
	fill_resources(&orion_sata, orion_sata_resources,
		       mapbase, 0x5000 - 1, irq);

	platform_device_register(&orion_sata);
}

/*****************************************************************************
 * Cryptographic Engines and Security Accelerator (CESA)
 ****************************************************************************/
static struct resource orion_crypto_resources[] = {
	{
		.name   = "regs",
	}, {
		.name   = "crypto interrupt",
	}, {
		.name   = "sram",
		.flags  = IORESOURCE_MEM,
	},
};

static struct platform_device orion_crypto = {
	.name           = "mv_crypto",
	.id             = -1,
};

void __init orion_crypto_init(unsigned long mapbase,
			      unsigned long srambase,
			      unsigned long sram_size,
			      unsigned long irq)
{
	fill_resources(&orion_crypto, orion_crypto_resources,
		       mapbase, 0xffff, irq);
	orion_crypto.num_resources = 3;
	orion_crypto_resources[2].start = srambase;
	orion_crypto_resources[2].end = srambase + sram_size - 1;

	platform_device_register(&orion_crypto);
}


text: Solutions to bioinformatics problems from http://rosalind.info


text:
package gov.nih.nci.caintegrator.domain.application;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import gov.nih.nci.caintegrator.application.query.InvalidCriterionException;

import java.util.Set;

import org.junit.Test;

/**
 * Tests validation of various compound criteria.
 *
 * @author Abraham J. Evans-EL <aevansel@5amsolutions.com>
 */
public class CompoundCriterionTest {

    /**
     * Tests valid fold change.
     *
     * @throws InvalidCriterionException on unexpected error
     */
    @Test
    public void validFoldChange() throws InvalidCriterionException {
        FoldChangeCriterion allGenesCriterion = new FoldChangeCriterion();

        CompoundCriterion compoundCriterion = new CompoundCriterion();
        compoundCriterion.getCriterionCollection().add(allGenesCriterion);
        compoundCriterion.validateGeneExpressionCriterion();
    }

    /**
     *  Tests that duplicate all genes fold change criterion result in a validation exception.
     *
     * @throws InvalidCriterionException on expected invalid criterion exception
     */
    @Test(expected = InvalidCriterionException.class)
    public void invalidDuplicateAllGenesFoldChangeCriterion() throws InvalidCriterionException {
        FoldChangeCriterion allGenesCriterion = new FoldChangeCriterion();
        FoldChangeCriterion otherAllGeneCriterion = new FoldChangeCriterion();

        CompoundCriterion compoundCriterion = new CompoundCriterion();
        compoundCriterion.getCriterionCollection().add(allGenesCriterion);
        compoundCriterion.getCriterionCollection().add(otherAllGeneCriterion);
        compoundCriterion.validateGeneExpressionCriterion();
    }

    /**
     *  Tests that a fold change criterion with a single gene and one with all genes result in a validation exception.
     *
     * @throws InvalidCriterionException on expected invalid criterion exception
     */
    @Test(expected = InvalidCriterionException.class)
    public void invalidAllGenesAndOneGeneFoldChangeCriterion() throws InvalidCriterionException {
        FoldChangeCriterion allGenesCriterion = new FoldChangeCriterion();
        FoldChangeCriterion singleGeneCriterion = new FoldChangeCriterion();
        singleGeneCriterion.setGeneSymbol("egfr");

        CompoundCriterion compoundCriterion = new CompoundCriterion();
        compoundCriterion.getCriterionCollection().add(allGenesCriterion);
        compoundCriterion.getCriterionCollection().add(singleGeneCriterion);
        compoundCriterion.validateGeneExpressionCriterion();
    }

    /**
     * Tests that two gene fold change criterion with different separate genes results is a valid criteria.
     *
     * @throws InvalidCriterionException on unexpected error
     */
    @Test
    public void validTwoGeneFoldChangeCriterion() throws InvalidCriterionException {
        FoldChangeCriterion brca1GenesCriterion = new FoldChangeCriterion();
        brca1GenesCriterion.setGeneSymbol("brac1");
        FoldChangeCriterion egfrGeneCriterion = new FoldChangeCriterion();
        egfrGeneCriterion.setGeneSymbol("egfr");

        CompoundCriterion compoundCriterion = new CompoundCriterion();
        compoundCriterion.getCriterionCollection().add(brca1GenesCriterion);
        compoundCriterion.getCriterionCollection().add(egfrGeneCriterion);
        compoundCriterion.validateGeneExpressionCriterion();
    }

    /**
     * Tests that a gene game and fold change criterion cannot be mixed.
     *
     * @throws InvalidCriterionException on the expected invalid criterion exception
     */
    @Test(expected = InvalidCriterionException.class)
    public void invalidFoldChangeAndGeneName() throws InvalidCriterionException {
        FoldChangeCriterion egfrGeneCriterion = new FoldChangeCriterion();
        egfrGeneCriterion.setGeneSymbol("egfr");
        GeneNameCriterion nameCriterion = new GeneNameCriterion();

        CompoundCriterion compoundCriterion = new CompoundCriterion();
        compoundCriterion.getCriterionCollection().add(egfrGeneCriterion);
        compoundCriterion.getCriterionCollection().add(nameCriterion);
        compoundCriterion.validateGeneExpressionCriterion();
    }

    /**
     * Tests that an expression level criterion's (upper level > lower level) when using the inside range type.
     *
     * @throws InvalidCriterionException  on the expected invalid criterion exception
     */
    @Test(expected = InvalidCriterionException.class)
    public void invalidInsideRangeExpressionLevelCriterion() throws InvalidCriterionException {
        ExpressionLevelCriterion expressionLevelCriterion = new ExpressionLevelCriterion();
        expressionLevelCriterion.setLowerLimit(2.0f);
        expressionLevelCriterion.setUpperLimit(1.0f);
        expressionLevelCriterion.setRangeType(RangeTypeEnum.INSIDE_RANGE);

        CompoundCriterion compoundCriterion = new CompoundCriterion();
        compoundCriterion.getCriterionCollection().add(expressionLevelCriterion);
        compoundCriterion.validateGeneExpressionCriterion();
    }

    /**
     * Tests that an expression level criterion's (upper level > lower level) when using the outside range type.
     *
     * @throws InvalidCriterionException  on the expected invalid criterion exception
     */
    @Test(expected = InvalidCriterionException.class)
    public void invalidOutsideRangeExpressionLevelCriterion() throws InvalidCriterionException {
        ExpressionLevelCriterion expressionLevelCriterion = new ExpressionLevelCriterion();
        expressionLevelCriterion.setLowerLimit(2.0f);
        expressionLevelCriterion.setUpperLimit(1.0f);
        expressionLevelCriterion.setRangeType(RangeTypeEnum.OUTSIDE_RANGE);

        CompoundCriterion compoundCriterion = new CompoundCriterion();
        compoundCriterion.getCriterionCollection().add(expressionLevelCriterion);
        compoundCriterion.validateGeneExpressionCriterion();
    }

    /**
     * Tests that an expression level criterion's (upper level > lower level) doesn't matter
     * when using the >= range type.
     *
     * @throws InvalidCriterionException on an unexpected validation error
     */
    @Test
    public void validGreaterThanEqualToExpressionLevelCriterion() throws InvalidCriterionException {
        ExpressionLevelCriterion expressionLevelCriterion = new ExpressionLevelCriterion();
        expressionLevelCriterion.setLowerLimit(2.0f);
        expressionLevelCriterion.setUpperLimit(1.0f);
        expressionLevelCriterion.setRangeType(RangeTypeEnum.GREATER_OR_EQUAL);

        CompoundCriterion compoundCriterion = new CompoundCriterion();
        compoundCriterion.getCriterionCollection().add(expressionLevelCriterion);
        compoundCriterion.validateGeneExpressionCriterion();
    }

    /**
     * Tests that an expression level criterion's (upper level > lower level) is valid for outside range types.
     *
     * @throws InvalidCriterionException on an unexpected validation error
     */
    @Test
    public void validOutsideRangeExpressionLevelCriterion() throws InvalidCriterionException {
        ExpressionLevelCriterion expressionLevelCriterion = new ExpressionLevelCriterion();
        expressionLevelCriterion.setLowerLimit(1.0f);
        expressionLevelCriterion.setUpperLimit(2.0f);
        expressionLevelCriterion.setRangeType(RangeTypeEnum.OUTSIDE_RANGE);

        CompoundCriterion compoundCriterion = new CompoundCriterion();
        compoundCriterion.getCriterionCollection().add(expressionLevelCriterion);
        compoundCriterion.validateGeneExpressionCriterion();
    }

    /**
     * Tests retrieval of compound criterion platform names.
     */
    @Test
    public void allPlatformNames() {
        FoldChangeCriterion brca1GenesCriterion = new FoldChangeCriterion();
        brca1GenesCriterion.setGeneSymbol("brac1");
        brca1GenesCriterion.setPlatformName("Test Platform");

        CompoundCriterion compoundCriterion = new CompoundCriterion();
        compoundCriterion.getCriterionCollection().add(brca1GenesCriterion);

        Set<String> platformNames = compoundCriterion.getAllPlatformNames(GenomicCriterionTypeEnum.GENE_EXPRESSION);
        assertFalse(platformNames.isEmpty());
        assertEquals(1, platformNames.size());
        assertTrue(platformNames.contains("Test Platform"));
    }
}


text:
package com.dtolabs.rundeck.core.common;

import com.dtolabs.rundeck.core.execution.dispatch.NodeDispatcher;
import com.dtolabs.rundeck.core.execution.service.FileCopier;
import com.dtolabs.rundeck.core.execution.service.NodeExecutor;
import com.dtolabs.rundeck.core.execution.workflow.WorkflowExecutor;
import com.dtolabs.rundeck.core.execution.workflow.WorkflowStrategy;
import com.dtolabs.rundeck.core.execution.workflow.steps.StepExecutor;
import com.dtolabs.rundeck.core.execution.workflow.steps.node.NodeStepExecutor;
import com.dtolabs.rundeck.core.plugins.PluggableProviderService;
import com.dtolabs.rundeck.core.plugins.ServiceProviderLoader;
import com.dtolabs.rundeck.core.resources.ResourceModelSourceFactory;
import com.dtolabs.rundeck.core.resources.format.ResourceFormatGenerator;
import com.dtolabs.rundeck.core.resources.format.ResourceFormatParser;
import com.dtolabs.rundeck.plugins.ServiceTypes;
import com.dtolabs.rundeck.plugins.orchestrator.OrchestratorPlugin;
import lombok.Getter;
import lombok.Setter;
import org.rundeck.core.plugins.PluginProviderServices;

/**
 * Implement PluginProviderServices by accessing the framework execution provider services
 */
public class FrameworkExecutionProviderServices
        implements PluginProviderServices

{
    @Getter @Setter private IExecutionServices frameworkExecutionServices;

    @Override
    public <T> boolean hasServiceFor(final Class<T> serviceType, final String serviceName) {
        Class<?> aClass = ServiceTypes.EXECUTION_TYPES.get(serviceName);
        return aClass !=null && aClass.equals(serviceType);
    }

    @Override
    public <T> PluggableProviderService<T> getServiceProviderFor(
            final Class<T> serviceType,
            final String serviceName,
            final ServiceProviderLoader loader
    )
    {
        if(serviceType.equals(NodeExecutor.class)){
            return (PluggableProviderService<T>) frameworkExecutionServices.getNodeExecutorService();
        }else if(serviceType.equals(FileCopier.class)){
            return (PluggableProviderService<T>) frameworkExecutionServices.getFileCopierService();
        }else if(serviceType.equals(WorkflowStrategy.class)){
            return (PluggableProviderService<T>) frameworkExecutionServices.getWorkflowStrategyService();
        }else if(serviceType.equals(StepExecutor.class)){
            return (PluggableProviderService<T>) frameworkExecutionServices.getStepExecutionService();
        }else if(serviceType.equals(NodeStepExecutor.class)){
            return (PluggableProviderService<T>) frameworkExecutionServices.getNodeStepExecutorService();
        }else if(serviceType.equals(ResourceModelSourceFactory.class)){
            return (PluggableProviderService<T>) frameworkExecutionServices.getResourceModelSourceService();
        }else if(serviceType.equals(ResourceFormatGenerator.class)){
            return (PluggableProviderService<T>) frameworkExecutionServices.getResourceFormatGeneratorService();
        }else if(serviceType.equals(ResourceFormatParser.class)){
            return (PluggableProviderService<T>) frameworkExecutionServices.getResourceFormatParserService();
        }else if(serviceType.equals(WorkflowExecutor.class)){
            return (PluggableProviderService<T>) frameworkExecutionServices.getWorkflowExecutionService();
        }else if(serviceType.equals(OrchestratorPlugin.class)){
            return (PluggableProviderService<T>) frameworkExecutionServices.getOrchestratorService();
        }else if(serviceType.equals(NodeDispatcher.class)){
            return (PluggableProviderService<T>) frameworkExecutionServices.getNodeDispatcherService();
        }
        return null;
    }
}


text:
class Game
  def initialize(fields)
    @field_length = fields.count
    @fields = Stringstructure.new(fields)
  end

  def tick
    @fields.tick
  end

  def fields
    # return the new fields
    @fields.to_array
  end
end


text:
class SemanticblogsController < ApplicationController
end


text:
function varargout = drawAxis3d(varargin)
%DRAWAXIS3D Draw a coordinate system and an origin.
%
%   drawAxis3d
%	Adds three 3D arrows to the current axis, corresponding to the
%	directions of the 3 basis vectors Ox, Oy and Oz.
%	Ox vector is red, Oy vector is green, and Oz vector is blue.
%
%   drawAxis3d(L, R)
%   Specifies the length L and the radius of the cylinders representing the
%   different axes.
%
%   drawAxis3d(..., 'TFM', TRANSFORM)
%   Transforms the coordinate system before drawing using TRANSFORM.
%
%   H = drawAxis3d(...) returns the group handle of the axis object.
%
%   Example
%   drawAxis3d
%
%   figure;
%   drawAxis3d(20, 1);
%   view([135,15]); lighting('phong'); camlight('head'); axis('equal')
%   xlabel X; ylabel Y; zlabel Z
%
%   See also
%   drawAxisCube
%
% ------
% Author: David Legland
% e-mail: david.legland@nantes.inra.fr
% Created: 2007-08-14,    using Matlab 7.4.0.287 (R2007a)
% Copyright 2007 INRA - BIA PV Nantes - MIAJ Jouy-en-Josas.

% Check if axes handle is specified
hAx = gca;
if ~isempty(varargin)
    if isAxisHandle(varargin{1})
        hAx = varargin{1};
        varargin(1)=[];
    end
end

% Parsing
p = inputParser;
addOptional(p,'L',1, @(x)validateattributes(x,{'numeric'},...
    {'scalar','nonempty','real','finite','positive','nonnan'}));
addOptional(p,'R',[], @(x)validateattributes(x,{'numeric'},...
    {'scalar','nonempty','real','finite','positive','nonnan'}));
addParameter(p,'TFM',eye(4), @isTransform3d);
parse(p,varargin{:});

L = p.Results.L;
R = p.Results.R;
if isempty(R)
    R=L/10;
elseif R/L > 0.1
    R = (0.1-eps)*L;
    warning('Value of R is invalid and was ignored!')
end
TFM = p.Results.TFM;

% geometrical data
origin = transformPoint3d(zeros(3,3), TFM);
vector = transformVector3d(eye(3,3), TFM);
color = eye(3,3);

% draw three arrows and a ball
hold on;
sh=drawArrow3d(hAx, origin, vector*L, color, 'arrowRadius', R/L);
sh(4)=drawSphere(hAx,[origin(1,:) 2*R], 'faceColor', 'black');
gh = hggroup(hAx);
set(sh,'Parent',gh)

if nargout > 0
    varargout = {gh};
end


text:
'use strict';

var constants   = require('../../constants');

module.exports = function(app, mongoose) {
  var schema = new mongoose.Schema({
    title: { type: String, default: '' },
    content: { type: String, default: '' },
    source: { type: String, default: '' }, // Link to original content or URL
    file: {
      name: { type: String, default: ''}, // If present, indicates an inline file artifact
      type: { type: String },
      size: { type: Number },
      lastModifiedDate: { type: Date }
    },
    contentPreview: { type: String}, // A preview lines of text to display in list view
    friendlyUrl: { type: String },
    screening: {
      status: { type: Number, default: constants.SCREENING_STATUS.status0.code}, // SCREENING_STATUS
      history: [{
        userId: { type: mongoose.Schema.ObjectId, ref: 'User' },
        date: { type: Date, default: Date.now },
        status: { type: Number } // SCREENING_STATUS
      }]
    },
    ownerId: { type: mongoose.Schema.ObjectId },
    ownerType: { type: Number }, // MODEL_TYPES
    parentId: { type: mongoose.Schema.ObjectId, default: null }, // Artifacts can have sub-artifacts
    private: { type: Boolean, default: false }, // if true, should be restricted to group/user owners and not included in public backup
    createDate: { type: Date, default: Date.now },
    createUserId: { type: mongoose.Schema.ObjectId, ref: 'User' },
    editDate: { type: Date, default: Date.now },
    editUserId: { type: mongoose.Schema.ObjectId, ref: 'User' },
    categoryId: { type: mongoose.Schema.ObjectId, ref: 'Topic' }, // the root topic where this entry belong
    tags: [ { type: Number } ], // OBJECT_TAGS
    childrenCount: {
      artifacts: {
        total: { type: Number, default: 0 },
        accepted: { type: Number, default: 0 },
        pending: { type: Number, default: 0 },
        rejected: { type: Number, default: 0 }
      },
      arguments: {
        total: { type: Number, default: 0 },
        accepted: { type: Number, default: 0 },
        pending: { type: Number, default: 0 },
        rejected: { type: Number, default: 0 }
      },
      questions: {
        total: { type: Number, default: 0 },
        accepted: { type: Number, default: 0 },
        pending: { type: Number, default: 0 },
        rejected: { type: Number, default: 0 }
      },
      issues: {
        total: { type: Number, default: 0 },
        accepted: { type: Number, default: 0 },
        pending: { type: Number, default: 0 },
        rejected: { type: Number, default: 0 },
        acceptedCritical: { type: Number, default: 0 }
      },
      opinions: {
        total: { type: Number, default: 0 },
        accepted: { type: Number, default: 0 },
        pending: { type: Number, default: 0 },
        rejected: { type: Number, default: 0 }
      }
    },
    extras: { type: mongoose.Schema.Types.Mixed }
  });
  schema.methods.getType = function() {
    return constants.OBJECT_TYPES.artifact;
  };
  schema.methods.getFolder = function(username) {
    return '/media/artifacts/' + (username ? 'users/' + username + '/' : '');
  };
  schema.methods.getFilePath = function(username) {
    return this.getFolder(username) + this._id + '_' + this.file.name;
  };
  schema.methods.getThumbnailPath = function(username) {
    if(this.isImage()) {
      return this.getFolder(username) + this._id + '_thumbnail_' + this.file.name;
    }
    return null;
  };
  schema.methods.isImage = function() {
    return this.file.type.startsWith('image');
  };
  schema.methods.setThumbnailPath = function (username) {
    if(this.file.name) {
      this.filePath = this.getFilePath(username);
      if(this.isImage()) {
        this.thumbnailPath = this.getThumbnailPath(username);
      }
    }
  };
  schema.plugin(require('../plugins/pagedFind'));
  schema.index({ title: 1 });
  schema.index({
    title: "text",
    content: "text",
    source: "text"
  }, {
    weights: {
      title: 10,
      content: 8,
      source: 6
    },
    name: "TextIndex"
  });
  schema.set('autoIndex', true); // (app.get('env') === 'development'));
  app.db.model('Artifact', schema);
};


text:
===================
Manual installation
===================

This page covers the basic installation of horizon in a production
environment. If you are looking for a developer environment, see
:ref:`quickstart`.

For the system dependencies, see :doc:`system-requirements`.

Installation
============

.. note::

  In the commands below, substitute "<release>" for your version of choice,
  such as "queens" or "rocky".

  If you use the development version, replace "stable/<release>" with "master".

#. Clone Horizon

   .. code-block:: console

     $ git clone https://git.openstack.org/openstack/horizon -b stable/<release> --depth=1
     $ cd horizon

#. Install the horizon python module into your system

   .. code-block:: console

     $ sudo pip install -c https://git.openstack.org/cgit/openstack/requirements/plain/upper-constraints.txt?h=stable/<release> .

Configuration
=============

This section contains a small summary of the critical settings required to run
horizon. For more details, please refer to :ref:`install-settings`.

Settings
--------

Create ``openstack_dashboard/local/local_settings.py``. It is usually a good
idea to copy ``openstack_dashboard/local/local_settings.py.example`` and
edit it. As a minimum, the follow settings will need to be modified:

``DEBUG``
  Set to ``False``
``ALLOWED_HOSTS``
  Set to your domain name(s)
``OPENSTACK_HOST``
  Set to the IP of your Keystone endpoint. You may also
  need to alter ``OPENSTACK_KEYSTONE_URL``

.. note::

  The following steps in the "Configuration" section are optional, but highly
  recommended in production.

Translations
------------

Compile translation message catalogs for internationalization. This step is
not required if you do not need to support languages other than US English.
GNU ``gettext`` tool is required to compile message catalogs.

.. code-block:: console

  $ sudo apt-get install gettext
  $ ./manage.py compilemessages

Static Assets
-------------

Compress your static files by adding ``COMPRESS_OFFLINE = True`` to your
``local_settings.py``, then run the following commands

.. code-block:: console

  $ ./manage.py collectstatic
  $ ./manage.py compress

Logging
-------

Horizons uses Django's logging configuration mechanism, which can be customized
by altering the ``LOGGING`` dictionary in ``local_settings.py``. By default,
Horizon's logging example sets the log level to ``INFO``.

Horizon also uses a number of 3rd-party clients which log separately. The
log level for these can still be controlled through Horizon's ``LOGGING``
config, however behaviors may vary beyond Horizon's control.

For more information regarding configuring logging in Horizon, please
read the `Django logging directive`_ and the `Python logging directive`_
documentation. Horizon is built on Python and Django.

.. _Django logging directive: https://docs.djangoproject.com/en/dev/topics/logging
.. _Python logging directive: https://docs.python.org/2/library/logging.html

Session Storage
---------------

Horizon uses `Django's sessions framework`_ for handling session data. There
are numerous session backends available, which are selected through the
``SESSION_ENGINE`` setting in your ``local_settings.py`` file.

.. _Django's sessions framework: https://docs.djangoproject.com/en/dev/topics/http/sessions/

Memcached
~~~~~~~~~

.. code-block:: python

  SESSION_ENGINE = 'django.contrib.sessions.backends.cache'
  CACHES = {
      'BACKEND': 'django.core.cache.backends.memcached.MemcachedCache'
      'LOCATION': 'my_memcached_host:11211',
  }

External caching using an application such as memcached offers persistence
and shared storage, and can be very useful for small-scale deployment and/or
development. However, for distributed and high-availability scenarios
memcached has inherent problems which are beyond the scope of this
documentation.

Requirements:

* Memcached service running and accessible
* Python memcached module installed

Database
~~~~~~~~

.. code-block:: python

  SESSION_ENGINE = 'django.core.cache.backends.db.DatabaseCache'
  DATABASES = {
      'default': {
          # Database configuration here
      }
  }

Database-backed sessions are scalable (using an appropriate database strategy),
persistent, and can be made high-concurrency and highly-available.

The downside to this approach is that database-backed sessions are one of the
slower session storages, and incur a high overhead under heavy usage. Proper
configuration of your database deployment can also be a substantial
undertaking and is far beyond the scope of this documentation.

Cached Database
~~~~~~~~~~~~~~~

To mitigate the performance issues of database queries, you can also consider
using Django's ``cached_db`` session backend which utilizes both your database
and caching infrastructure to perform write-through caching and efficient
retrieval. You can enable this hybrid setting by configuring both your database
and cache as discussed above and then using

.. code-block:: python

  SESSION_ENGINE = "django.contrib.sessions.backends.cached_db"

Deployment
==========

#. Set up a web server with WSGI support. For example, install Apache web
   server on Ubuntu

   .. code-block:: console

     $ sudo apt-get install apache2 libapache2-mod-wsgi

   You can either use the provided ``openstack_dashboard/wsgi.py`` or
   generate a ``openstack_dashboard/horizon_wsgi.py`` file with the following
   command (which detects if you use a virtual environment or not to
   automatically build an adapted WSGI file)

   .. code-block:: console

     $ ./manage.py make_web_conf --wsgi

   Then configure the web server to host OpenStack dashboard via WSGI.
   For apache2 web server, you may need to create
   ``/etc/apache2/sites-available/horizon.conf``.
   The template in DevStack is a good example of the file.
   https://git.openstack.org/cgit/openstack-dev/devstack/tree/files/apache-horizon.template
   Or you can automatically generate an apache configuration file. If you
   previously generated an ``openstack_dashboard/horizon_wsgi.py`` file it will
   use that, otherwise will default to using ``openstack_dashboard/wsgi.py``

   .. code-block:: console

     $ ./manage.py make_web_conf --apache > /etc/apache2/sites-available/horizon.conf

   Same as above but if you want SSL support

   .. code-block:: console

     $ ./manage.py make_web_conf --apache --ssl --sslkey=/path/to/ssl/key --sslcert=/path/to/ssl/cert > /etc/apache2/sites-available/horizon.conf

   By default the apache configuration will launch a number of apache processes
   equal to the number of CPUs + 1 of the machine on which you launch the
   ``make_web_conf`` command. If the target machine is not the same or if you
   want to specify the number of processes, add the ``--processes`` option

   .. code-block:: console

     $ ./manage.py make_web_conf --apache --processes 10 > /etc/apache2/sites-available/horizon.conf

#. Enable the above configuration and restart the web server

   .. code-block:: console

     $ sudo a2ensite horizon
     $ sudo service apache2 restart

Next Steps
==========

* :ref:`install-settings` lists the available settings for horizon.
* :ref:`install-customizing` describes how to customize horizon.


text:
@class DAYTeammate;

@interface DAYTeam : NSManagedObject

@property (nonatomic, retain) NSString * name;
@property (nonatomic, retain) NSSet *persons;
@end

@interface DAYTeam (CoreDataGeneratedAccessors)

- (void)addPersonsObject:(DAYTeammate *)value;
- (void)removePersonsObject:(DAYTeammate *)value;
- (void)addPersons:(NSSet *)values;
- (void)removePersons:(NSSet *)values;

@end


text:
<!doctype html>
<html>
<head>
  <meta charset="utf-8">
  <title>Book Store Material App</title>
  <base href="/">

  <meta name="viewport" content="width=device-width, initial-scale=1">
  <link rel="icon" type="image/x-icon" href="favicon.ico">

  <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto:300,400,500">
  <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Material+Icons">
  <link rel="stylesheet" href="../node_modules/@angular/material/prebuilt-themes/indigo-pink.css">
</head>
<body>
  <app-root fxFlex>Loading...</app-root>
</body>
</html>


text:
void configureATIEncoder(DShowCaptureInfo* pCapInfo, SageTVMPEG2EncodingParameters *pythonParams,
							JNIEnv *env);


text:
package org.apache.spark.network.nio

import java.io.IOException
import java.nio._

import scala.concurrent.duration._
import scala.concurrent.{Await, TimeoutException}
import scala.language.postfixOps

import org.apache.spark.{SecurityManager, SparkConf, SparkFunSuite}
import org.apache.spark.util.Utils

/**
  * Test the ConnectionManager with various security settings.
  * 测试各种安全设置的连接管理器
  */
class ConnectionManagerSuite extends SparkFunSuite {

  test("security default off") {//安全默认关闭
    val conf = new SparkConf
    val securityManager = new SecurityManager(conf)
    val manager = new ConnectionManager(0, conf, securityManager)
    var receivedMessage = false
    manager.onReceiveMessage((msg: Message, id: ConnectionManagerId) => {
      receivedMessage = true
      None
    })
    //10485760字节是10MB
    val size = 10 * 1024 * 1024
    //ByteBuffer.allocate在能够读和写之前,必须有一个缓冲区,用静态方法 allocate() 来分配缓冲区
    val buffer = ByteBuffer.allocate(size).put(Array.tabulate[Byte](size)(x => x.toByte))
    buffer.flip

    val bufferMessage = Message.createBufferMessage(buffer.duplicate)
    //Await.result或者Await.ready会导致当前线程被阻塞,并等待actor通过它的应答来完成Future
    Await.result(manager.sendMessageReliably(manager.id, bufferMessage), 10 seconds)

    assert(receivedMessage == true)

    manager.stop()
  }

  test("security on same password") {//安全相同密码
    val conf = new SparkConf
     //是否启用内部身份验证
    conf.set("spark.authenticate", "true")
    //设置组件之间进行身份验证的密钥
    conf.set("spark.authenticate.secret", "good")
    conf.set("spark.app.id", "app-id")
    val securityManager = new SecurityManager(conf)
    val manager = new ConnectionManager(0, conf, securityManager)
    var numReceivedMessages = 0

    manager.onReceiveMessage((msg: Message, id: ConnectionManagerId) => {
      numReceivedMessages += 1
      None
    })
    val managerServer = new ConnectionManager(0, conf, securityManager)
    var numReceivedServerMessages = 0
    managerServer.onReceiveMessage((msg: Message, id: ConnectionManagerId) => {
      numReceivedServerMessages += 1
      None
    })
    //10485760字节是10MB
    val size = 10 * 1024 * 1024
    val count = 10
    //ByteBuffer.allocate在能够读和写之前,必须有一个缓冲区,用静态方法 allocate() 来分配缓冲区
    val buffer = ByteBuffer.allocate(size).put(Array.tabulate[Byte](size)(x => x.toByte))
    buffer.flip

    (0 until count).map(i => {
      val bufferMessage = Message.createBufferMessage(buffer.duplicate)
      Await.result(manager.sendMessageReliably(managerServer.id, bufferMessage), 10 seconds)
    })

    assert(numReceivedServerMessages == 10)
    assert(numReceivedMessages == 0)

    manager.stop()
    managerServer.stop()
  }

  test("security mismatch password") {//不匹配的密码
    val conf = new SparkConf
     //是否启用内部身份验证
    conf.set("spark.authenticate", "true")
    conf.set("spark.app.id", "app-id")
    //设置组件之间进行身份验证的密钥
    conf.set("spark.authenticate.secret", "good")
    val securityManager = new SecurityManager(conf)
    val manager = new ConnectionManager(0, conf, securityManager)
    var numReceivedMessages = 0

    manager.onReceiveMessage((msg: Message, id: ConnectionManagerId) => {
      numReceivedMessages += 1
      None
    })
  //设置组件之间进行身份验证的密钥
    val badconf = conf.clone.set("spark.authenticate.secret", "bad")
    val badsecurityManager = new SecurityManager(badconf)
    val managerServer = new ConnectionManager(0, badconf, badsecurityManager)
    var numReceivedServerMessages = 0

    managerServer.onReceiveMessage((msg: Message, id: ConnectionManagerId) => {
      numReceivedServerMessages += 1
      None
    })
    //10485760字节是10MB
    val size = 10 * 1024 * 1024
    //ByteBuffer.allocate在能够读和写之前,必须有一个缓冲区,用静态方法 allocate() 来分配缓冲区
    val buffer = ByteBuffer.allocate(size).put(Array.tabulate[Byte](size)(x => x.toByte))
    buffer.flip
    val bufferMessage = Message.createBufferMessage(buffer.duplicate)
    // Expect managerServer to close connection, which we'll report as an error:
    //预期managerServer关闭连接,我们将作为一个错误报告:
    intercept[IOException] {
    //Await.result或者Await.ready会导致当前线程被阻塞,并等待actor通过它的应答来完成Future
      Await.result(manager.sendMessageReliably(managerServer.id, bufferMessage), 10 seconds)
    }

    assert(numReceivedServerMessages == 0)
    assert(numReceivedMessages == 0)

    manager.stop()
    managerServer.stop()
  }

  test("security mismatch auth off") {//不匹配的安全认证
    val conf = new SparkConf
     //是否启用内部身份验证
    conf.set("spark.authenticate", "false")
    //设置组件之间进行身份验证的密钥
    conf.set("spark.authenticate.secret", "good")
    val securityManager = new SecurityManager(conf)
    val manager = new ConnectionManager(0, conf, securityManager)
    var numReceivedMessages = 0

    manager.onReceiveMessage((msg: Message, id: ConnectionManagerId) => {
      numReceivedMessages += 1
      None
    })

    val badconf = new SparkConf
     //是否启用内部身份验证
    badconf.set("spark.authenticate", "true")
    //设置组件之间进行身份验证的密钥
    badconf.set("spark.authenticate.secret", "good")
    val badsecurityManager = new SecurityManager(badconf)
    val managerServer = new ConnectionManager(0, badconf, badsecurityManager)
    var numReceivedServerMessages = 0
    managerServer.onReceiveMessage((msg: Message, id: ConnectionManagerId) => {
      numReceivedServerMessages += 1
      None
    })
    //10485760字节是10MB
    val size = 10 * 1024 * 1024
    //ByteBuffer.allocate在能够读和写之前,必须有一个缓冲区,用静态方法 allocate() 来分配缓冲区
    val buffer = ByteBuffer.allocate(size).put(Array.tabulate[Byte](size)(x => x.toByte))
    buffer.flip
    val bufferMessage = Message.createBufferMessage(buffer.duplicate)
    (0 until 1).map(i => {
      val bufferMessage = Message.createBufferMessage(buffer.duplicate)
      manager.sendMessageReliably(managerServer.id, bufferMessage)
    }).foreach(f => {
      try {
        val g = Await.result(f, 1 second)
        assert(false)
      } catch {
        case i: IOException =>
          assert(true)
        case e: TimeoutException => {
          // we should timeout here since the client can't do the negotiation
          //我们应该在这里暂停,因为客户端无法进行协商
          assert(true)
        }
      }
    })

    assert(numReceivedServerMessages == 0)
    assert(numReceivedMessages == 0)
    manager.stop()
    managerServer.stop()
  }

  test("security auth off") {//安全认证
    val conf = new SparkConf
     //是否启用内部身份验证
    conf.set("spark.authenticate", "false")
    val securityManager = new SecurityManager(conf)
    val manager = new ConnectionManager(0, conf, securityManager)
    var numReceivedMessages = 0

    manager.onReceiveMessage((msg: Message, id: ConnectionManagerId) => {
      numReceivedMessages += 1
      None
    })

    val badconf = new SparkConf
    badconf.set("spark.authenticate", "false")
    val badsecurityManager = new SecurityManager(badconf)
    val managerServer = new ConnectionManager(0, badconf, badsecurityManager)
    var numReceivedServerMessages = 0

    managerServer.onReceiveMessage((msg: Message, id: ConnectionManagerId) => {
      numReceivedServerMessages += 1
      None
    })
    //10485760字节是10MB
    val size = 10 * 1024 * 1024
    //ByteBuffer.allocate在能够读和写之前,必须有一个缓冲区,用静态方法 allocate() 来分配缓冲区
    val buffer = ByteBuffer.allocate(size).put(Array.tabulate[Byte](size)(x => x.toByte))
    buffer.flip
    val bufferMessage = Message.createBufferMessage(buffer.duplicate)
    (0 until 10).map(i => {
      val bufferMessage = Message.createBufferMessage(buffer.duplicate)
      manager.sendMessageReliably(managerServer.id, bufferMessage)
    }).foreach(f => {
      try {
        val g = Await.result(f, 1 second)
      } catch {
        case e: Exception => {
          assert(false)
        }
      }
    })
    assert(numReceivedServerMessages == 10)
    assert(numReceivedMessages == 0)

    manager.stop()
    managerServer.stop()
  }

  test("Ack error message") {//ACK错误消息
    val conf = new SparkConf
     //是否启用内部身份验证
    conf.set("spark.authenticate", "false")
    val securityManager = new SecurityManager(conf)
    val manager = new ConnectionManager(0, conf, securityManager)
    val managerServer = new ConnectionManager(0, conf, securityManager)
    managerServer.onReceiveMessage((msg: Message, id: ConnectionManagerId) => {
      throw new Exception("Custom exception text")
    })
    //10485760字节是10MB
    val size = 10 * 1024 * 1024
    //ByteBuffer.allocate在能够读和写之前,必须有一个缓冲区,用静态方法 allocate() 来分配缓冲区
    val buffer = ByteBuffer.allocate(size).put(Array.tabulate[Byte](size)(x => x.toByte))
    buffer.flip
    val bufferMessage = Message.createBufferMessage(buffer)

    val future = manager.sendMessageReliably(managerServer.id, bufferMessage)

    val exception = intercept[IOException] {
      Await.result(future, 1 second)
    }
    assert(Utils.exceptionString(exception).contains("Custom exception text"))

    manager.stop()
    managerServer.stop()

  }

  test("sendMessageReliably timeout") {//sendMessageReliably超时
    val clientConf = new SparkConf
    clientConf.set("spark.authenticate", "false")
    val ackTimeoutS = 30
    clientConf.set("spark.core.connection.ack.wait.timeout", s"${ackTimeoutS}s")

    val clientSecurityManager = new SecurityManager(clientConf)
    val manager = new ConnectionManager(0, clientConf, clientSecurityManager)

    val serverConf = new SparkConf
    serverConf.set("spark.authenticate", "false")
    val serverSecurityManager = new SecurityManager(serverConf)
    val managerServer = new ConnectionManager(0, serverConf, serverSecurityManager)
    managerServer.onReceiveMessage((msg: Message, id: ConnectionManagerId) => {
      // sleep 60 sec > ack timeout for simulating server slow down or hang up
      //睡眠60秒> ack超时模拟服务器减慢或挂断
      Thread.sleep(ackTimeoutS * 3 * 1000)
      None
    })
    //10485760字节是10MB
    val size = 10 * 1024 * 1024
    //ByteBuffer.allocate在能够读和写之前,必须有一个缓冲区,用静态方法 allocate() 来分配缓冲区
    val buffer = ByteBuffer.allocate(size).put(Array.tabulate[Byte](size)(x => x.toByte))
    buffer.flip
    val bufferMessage = Message.createBufferMessage(buffer.duplicate)

    val future = manager.sendMessageReliably(managerServer.id, bufferMessage)

    // Future should throw IOException in 30 sec.
    // Otherwise TimeoutExcepton is thrown from Await.result.
    // We expect TimeoutException is not thrown.
    //Future应该在30秒内抛出IOException,否则TimeoutExcepton将从Await.result抛出,
    // 我们预计不会抛出TimeoutException。
    intercept[IOException] {
      Await.result(future, (ackTimeoutS * 2) second)
    }

    manager.stop()
    managerServer.stop()
  }

}


text:
namespace hue { namespace ast {

// size_t Structure::indexOf(const Text& name) const {
//   NameMap::const_iterator it = nameMap_.find(name);
//   if (it != nameMap_.end()) {
//     return it->second;
//   } else {
//     return SIZE_MAX;
//   }
// }

void Structure::update() {
  const ExpressionList& expressions = block_->expressions();

  StructType::Member::List stmembers;
  stmembers.reserve(expressions.size());

  members_.clear();

  ExpressionList::const_iterator I = expressions.begin(), E = expressions.end();
  for (;I != E; ++I) {
    const Expression* expr = *I;
    assert(expr->isAssignment());
    const Assignment* ass = static_cast<const Assignment*>(expr);
    const Text& name = ass->variable()->name();

    size_t index = stmembers.size();
    stmembers.push_back(StructType::Member(ass->resultType(), name, (unsigned)index));

    Member& member = members_[name];
    member.index = (unsigned)index;
    member.value = ass->rhs();
  }

  structType_ = StructType::get(stmembers);
}

const Structure::Member* Structure::operator[](const Text& name) const {
  MemberMap::const_iterator it = members_.find(name);
  if (it != members_.end()) {
    return &(it->second);
  } else {
    return 0;
  }
}

}} // namespace hue::ast


text:
'use strict';

var kafka = require('..'),
    Producer = kafka.Producer,
    Client = kafka.Client,
    KeyedMessage = kafka.KeyedMessage;

var client, producer, noAckProducer, producerKeyed;

var TOPIC_POSTFIX = '_test_' + Date.now();
var EXISTS_TOPIC_3 = '_exists_3' + TOPIC_POSTFIX;

var host = process.env['KAFKA_TEST_HOST'] || '';

// Helper method
function randomId () {
    return Math.floor(Math.random() * 10000);
}

before(function (done) {
    client = new Client(host);
    producer = new Producer(client);
    noAckProducer = new Producer(client, { requireAcks: 0 });
    producerKeyed = new Producer(client, { partitionerType: Producer.PARTITIONER_TYPES.keyed });

    producer.on('ready', function () {
        producerKeyed.on('ready', function () {
            producer.createTopics([EXISTS_TOPIC_3], false, function (err, created) {
                if (err) return done(err);
                setTimeout(done, 500);
            });
        });
    });
});

describe('Producer', function () {
    describe('#send', function () {
        before(function(done) {
            // Ensure that first message gets the `0`
            producer.send([{ topic: EXISTS_TOPIC_3, messages: '_initial' }], function (err, message) {
                message.should.be.ok;
                message[EXISTS_TOPIC_3].should.have.property('0', 0);
                done(err);
            });
        });

        it('should send message successfully', function (done) {
            producer.send([{ topic: EXISTS_TOPIC_3, messages: 'hello kafka' }], function (err, message) {
                message.should.be.ok;
                message[EXISTS_TOPIC_3]['0'].should.be.above(0);
                done(err);
            });
        });

        it('should send buffer message successfully', function (done) {
            var message = new Buffer('hello kafka');
            producer.send([{ topic: EXISTS_TOPIC_3, messages: message }], function (err, message) {
                message.should.be.ok;
                message[EXISTS_TOPIC_3]['0'].should.be.above(0);
                done(err);
            });
        });

        it('should send null message successfully', function (done) {
            var message = null;
            producer.send([{ topic: EXISTS_TOPIC_3, messages: message }], function (err, message) {
                message.should.be.ok;
                message[EXISTS_TOPIC_3]['0'].should.be.above(0);
                done(err);
            });
        });

        it('should convert none buffer message to string', function (done) {
            var message = -1;
            producer.send([{ topic: EXISTS_TOPIC_3, messages: message }], function (err, message) {
                message.should.be.ok;
                message[EXISTS_TOPIC_3]['0'].should.be.above(0);
                done(err);
            });
        })

        it('should send Message struct successfully', function(done) {
            var message = new KeyedMessage('test-key', 'test-message');
            producer.send([{ topic: EXISTS_TOPIC_3, messages: message }], function (err, message) {
                message.should.be.ok;
                message[EXISTS_TOPIC_3]['0'].should.be.above(0);
                done(err);
            });
        });

        it('should support multi messages in one topic', function (done) {
            producer.send([{ topic: EXISTS_TOPIC_3, messages: ['hello kafka', 'hello kafka'] }], function (err, message) {
                message.should.be.ok;
                message[EXISTS_TOPIC_3]['0'].should.be.above(0);
                done(err);
            });
        });

        it('should support snappy compression', function (done) {
            producer.send([{
                topic: EXISTS_TOPIC_3,
                messages: ['hello kafka', 'hello kafka'],
                attributes: 2
            }], function (err, message) {
                if (err) return done(err);
                message.should.be.ok;
                message[EXISTS_TOPIC_3]['0'].should.be.above(0);
                done();
            });
        });

        it('should support gzip compression', function (done) {
            producer.send([{
                topic: EXISTS_TOPIC_3,
                messages: ['hello kafka', 'hello kafka'],
                attributes: 1
            }], function (err, message) {
                if (err) return done(err);
                message.should.be.ok;
                message[EXISTS_TOPIC_3]['0'].should.be.above(0);
                done();
            });
        });

        it('should send message without ack', function (done) {
            noAckProducer.send([{
                topic: EXISTS_TOPIC_3, messages: 'hello kafka'
            }], function (err, message) {
                if (err) return done(err);
                message.result.should.equal('no ack');
                done();
            });
        });

        it('should send message to specified partition even when producer configured with keyed partitioner', function (done) {
            producerKeyed.send([{ key: '12345', partition: 0, topic: EXISTS_TOPIC_3, messages: 'hello kafka' }], function (err, message) {
                message.should.be.ok;
                message[EXISTS_TOPIC_3]['0'].should.be.above(0);
                done(err);
            });
        });

        it('should send message to partition determined by keyed partitioner', function (done) {
            producerKeyed.send([{ key: '12345', topic: EXISTS_TOPIC_3, messages: 'hello kafka' }], function (err, message) {
                message.should.be.ok;
                message[EXISTS_TOPIC_3].should.have.property('1', 0);
                done(err);
            });
        });
    });

    describe('#createTopics', function () {
        it('should return All requests sent when async is true', function (done) {
            producer.createTopics(['_exist_topic_'+ randomId() +'_test'], true, function (err, data) {
                data.should.equal('All requests sent');
                done(err);
            });
        });

        it('async should be true if not present', function (done) {
            producer.createTopics(['_exist_topic_'+ randomId() +'_test'], function (err, data) {
                data.should.equal('All requests sent');
                done(err);
            });
        });

        it('should return All created when async is false', function (done) {
            producer.createTopics(['_exist_topic_'+ randomId() +'_test'], false, function (err, data) {
                data.should.equal('All created');
                done(err);
            });
        });
    });

    describe('#close', function () {
        it('should close successfully', function (done) {
            producer.close(done);
        });
    });
});


text: Gibt den Vorgabewert für dieses Feld an.