text:
package com.alibaba.dubbo.remoting.transport.netty;

import com.alibaba.dubbo.common.Constants;
import com.alibaba.dubbo.common.utils.DubboAppender;
import com.alibaba.dubbo.common.utils.LogUtil;
import com.alibaba.dubbo.common.utils.NetUtils;
import com.alibaba.dubbo.remoting.Channel;
import com.alibaba.dubbo.remoting.Client;
import com.alibaba.dubbo.remoting.RemotingException;
import com.alibaba.dubbo.remoting.Server;
import com.alibaba.dubbo.remoting.exchange.Exchangers;
import com.alibaba.dubbo.remoting.exchange.support.ExchangeHandlerAdapter;

import org.apache.log4j.Level;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;

/**
 * 客户端重连测试
 *
 * @author chao.liuc
 */
public class ClientReconnectTest {
    public static void main(String[] args) {
        System.out.println(3 % 1);
    }

    @Before
    public void clear() {
        DubboAppender.clear();
    }

    @Test
    public void testReconnect() throws RemotingException, InterruptedException {
        {
            int port = NetUtils.getAvailablePort();
            Client client = startClient(port, 200);
            Assert.assertEquals(false, client.isConnected());
            Server server = startServer(port);
            for (int i = 0; i < 100 && !client.isConnected(); i++) {
                Thread.sleep(10);
            }
            Assert.assertEquals(true, client.isConnected());
            client.close(2000);
            server.close(2000);
        }
        {
            int port = NetUtils.getAvailablePort();
            Client client = startClient(port, 20000);
            Assert.assertEquals(false, client.isConnected());
            Server server = startServer(port);
            for (int i = 0; i < 5; i++) {
                Thread.sleep(200);
            }
            Assert.assertEquals(false, client.isConnected());
            client.close(2000);
            server.close(2000);
        }
    }

    /**
     * 重连日志的校验,时间不够shutdown time时,不能有error日志,但必须有一条warn日志
     */
    @Test
    public void testReconnectWarnLog() throws RemotingException, InterruptedException {
        int port = NetUtils.getAvailablePort();
        DubboAppender.doStart();
        String url = "exchange://127.0.0.2:" + port + "/client.reconnect.test?check=false&"
                + Constants.RECONNECT_KEY + "=" + 1; //1ms reconnect,保证有足够频率的重连
        try {
            Exchangers.connect(url);
        } catch (Exception e) {
            //do nothing
        }
        Thread.sleep(1500);//重连线程的运行
        //时间不够长,不会产生error日志
        Assert.assertEquals("no error message ", 0, LogUtil.findMessage(Level.ERROR, "client reconnect to "));
        //第一次重连失败就会有warn日志
        Assert.assertEquals("must have one warn message ", 1, LogUtil.findMessage(Level.WARN, "client reconnect to "));
        DubboAppender.doStop();
    }

 /*   *//**
     * 重连日志的校验,不能一直抛出error日志.
     *//*
    @Test
    public void testReconnectErrorLog() throws RemotingException, InterruptedException {
        int port = NetUtils.getAvailablePort();
        DubboAppender.doStart();
        String url = "exchange://127.0.0.3:" + port + "/client.reconnect.test?check=false&"
                + Constants.RECONNECT_KEY + "=" + 1 + //1ms reconnect,保证有足够频率的重连
                "&" + Constants.SHUTDOWN_TIMEOUT_KEY + "=1";//shutdown时间足够短,确保error日志输出
        try {
            Exchangers.connect(url);
        } catch (Exception e) {
            //do nothing
        }
        Thread.sleep(1500);//重连线程的运行
        Assert.assertEquals("only one error message ", 1, LogUtil.findMessage(Level.ERROR, "client reconnect to "));
        DubboAppender.doStop();
    }

    *//**
     * 测试client重连方法不会导致重连线程失效.
     *//*
    @Test
    public void testClientReconnectMethod() throws RemotingException, InterruptedException {
        int port = NetUtils.getAvailablePort();
        String url = "exchange://127.0.0.3:" + port + "/client.reconnect.test?check=false&"
                + Constants.RECONNECT_KEY + "=" + 10 //1ms reconnect,保证有足够频率的重连
                + "&reconnect.waring.period=1";
        DubboAppender.doStart();
        Client client = Exchangers.connect(url);
        try {
            client.reconnect();
        } catch (Exception e) {
            //do nothing
        }
        Thread.sleep(1500);//重连线程的运行
        Assert.assertTrue("have more then one warn msgs . bug was :" + LogUtil.findMessage(Level.WARN, "client reconnect to "), LogUtil.findMessage(Level.WARN, "client reconnect to ") > 1);
        DubboAppender.doStop();
    }

    *//**
     * 重连日志的校验
     *//*
    @Test
    public void testReconnectWaringLog() throws RemotingException, InterruptedException {
        int port = NetUtils.getAvailablePort();
        DubboAppender.doStart();
        String url = "exchange://127.0.0.4:" + port + "/client.reconnect.test?check=false&"
                + Constants.RECONNECT_KEY + "=" + 1 //1ms reconnect,保证有足够频率的重连
                + "&" + Constants.SHUTDOWN_TIMEOUT_KEY + "=1"//shutdown时间足够短,确保error日志输出
                + "&reconnect.waring.period=100";//每隔多少warning记录一次
        try {
            Exchangers.connect(url);
        } catch (Exception e) {
            //do nothing
        }
        int count = 0;
        for (int i = 0; i < 100; i++) {
            count = LogUtil.findMessage(Level.WARN, "client reconnect to ");
            if (count >= 1) {
                break;
            }
            Thread.sleep(50);//重连线程的运行
        }
        Assert.assertTrue("warning message count must >= 1, real :" + count, count >= 1);
        DubboAppender.doStop();
    }*/

    public Client startClient(int port, int reconnectPeriod) throws RemotingException {
        final String url = "exchange://127.0.0.1:" + port + "/client.reconnect.test?check=false&" + Constants.RECONNECT_KEY + "=" + reconnectPeriod;
        return Exchangers.connect(url);
    }

    public Server startServer(int port) throws RemotingException {
        final String url = "exchange://127.0.0.1:" + port + "/client.reconnect.test";
        return Exchangers.bind(url, new HandlerAdapter());
    }

    static class HandlerAdapter extends ExchangeHandlerAdapter {
        public void connected(Channel channel) throws RemotingException {
        }

        public void disconnected(Channel channel) throws RemotingException {
        }

        public void caught(Channel channel, Throwable exception) throws RemotingException {
        }
    }
}


text:
function save_counts(infilename, data, not_outliers, nonblankidx)
    outfilename = strcat(infilename(1:end-5), '_new', infilename(end-4:end));

    write_header(infilename, outfilename);

    % retain baseline counts before and after main reading
    startidx = nonblankidx(1);
    endidx = nonblankidx(end);
    start_baseline = data(1:startidx-1, :);
    end_baseline = data(endidx-1:end, :);

    % append baseline data to filtered counts
    output_data = [start_baseline; data(not_outliers, :); end_baseline];

    % append to file
    dlmwrite(outfilename, output_data, '-append', 'precision', 16);
end

redpajama_set_name: RedPajamaGithub


text:
<?xml version="1.0" encoding="ascii"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
          "DTD/xhtml1-transitional.dtd">

  <title>http_api_utils</title>
  <link rel="stylesheet" href="epydoc.css" type="text/css" />

Module http_api_utils

Functions

    _create_field_value_group

    generate_reports_html
    is_valid_report_json

[hide private]


text:
package com.stabilise.entity.component;

import com.stabilise.entity.Entity;
import com.stabilise.entity.event.EThroughPortalIntra;
import com.stabilise.entity.event.EntityEvent;
import com.stabilise.util.Checks;
import com.stabilise.util.Log;
import com.stabilise.util.io.data.DataCompound;
import com.stabilise.world.World;

/**
 * A component that tracks an entity and the world it is in. This component is
 * mainly here for convenience of external-to-the-world code, such as the world
 * renderer and such.
 */
public class CEntityTracker extends AbstractComponent {

    /** A persistent reference to the entity. Updated when the entity changes
     * dimensions and is internally swapped out with a phantom. */
    public Entity entity = null;
    /** A reference to the world that the entity is in. Updated when the entity
     * changes dimensions (via a portal). */
    public World world = null;

    @Override
    public void init(Entity e) {
        entity = e; // initial set
    }

    @Override
    public void update(World w, Entity e, float dt) {
        // No convenient way to do an initial set of world, so this'll have to
        // do.
        if(world == null)
            world = w;
    }

    @Override
    public boolean handle(World w, Entity e, EntityEvent ev) {
        if(ev instanceof EThroughPortalIntra)
            handleThroughPortal(w, e, (EThroughPortalIntra)ev);
        return false;
    }

    protected void handleThroughPortal(World w, Entity e, EThroughPortalIntra ev) {
        world = w;
        entity = e;
    }

    @Override
    public int getWeight() {
        return Component.WEIGHT_TRACKER;
    }

    @Override
    public Action resolve(Component c) {
        Log.get().postWarning("[CEntityTracker] Multiple trackers on the same entity?");
        return Action.KEEP_BOTH;
    }

    @Override
    public void importFromCompound(DataCompound c) {
        Checks.TODO();
    }

    @Override
    public void exportToCompound(DataCompound c) {
        Checks.TODO();
    }

}


text:
package org.apache.hyracks.algebricks.core.algebra.typing;

import java.util.ArrayList;
import java.util.List;

import org.apache.commons.lang3.mutable.Mutable;
import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
import org.apache.hyracks.algebricks.core.algebra.base.ILogicalOperator;
import org.apache.hyracks.algebricks.core.algebra.base.LogicalVariable;
import org.apache.hyracks.algebricks.core.algebra.expressions.IExpressionTypeComputer;
import org.apache.hyracks.algebricks.core.algebra.expressions.IVariableTypeEnvironment;
import org.apache.hyracks.algebricks.core.algebra.metadata.IMetadataProvider;

public class PropagateOperatorInputsTypeEnvironment extends AbstractTypeEnvironment {

    private final List<LogicalVariable> nonNullVariables = new ArrayList<LogicalVariable>();
    private final List<List<LogicalVariable>> correlatedNullableVariableLists = new ArrayList<List<LogicalVariable>>();
    private final ILogicalOperator op;
    private final ITypingContext ctx;

    public PropagateOperatorInputsTypeEnvironment(ILogicalOperator op, ITypingContext ctx,
            IExpressionTypeComputer expressionTypeComputer, IMetadataProvider<?, ?> metadataProvider) {
        super(expressionTypeComputer, metadataProvider);
        this.op = op;
        this.ctx = ctx;
    }

    public List<LogicalVariable> getNonNullVariables() {
        return nonNullVariables;
    }

    @Override
    public Object getVarType(LogicalVariable var, List<LogicalVariable> nonNullVariableList,
            List<List<LogicalVariable>> correlatedNullableVariableLists) throws AlgebricksException {
        nonNullVariableList.addAll(nonNullVariables);
        return getVarTypeFullList(var, nonNullVariableList, correlatedNullableVariableLists);
    }

    private Object getVarTypeFullList(LogicalVariable var, List<LogicalVariable> nonNullVariableList,
            List<List<LogicalVariable>> correlatedNullableVariableLists) throws AlgebricksException {
        Object t = varTypeMap.get(var);
        if (t != null) {
            return t;
        }
        for (Mutable<ILogicalOperator> r : op.getInputs()) {
            ILogicalOperator c = r.getValue();
            IVariableTypeEnvironment env = ctx.getOutputTypeEnvironment(c);
            Object t2 = env.getVarType(var, nonNullVariableList, correlatedNullableVariableLists);
            if (t2 != null) {
                return t2;
            }
        }
        return null;
    }

    @Override
    public Object getVarType(LogicalVariable var) throws AlgebricksException {
        return getVarTypeFullList(var, nonNullVariables, correlatedNullableVariableLists);
    }

}


text:
Storage Class
===============

Storage class for freebird

## Table of Contents

* [Constructor](#Constructor)
* [Properties](#Properties)
* [Methods](#Methods)
* [Private Constructor](#Private)

## Constructor

Storage(fileName, maxNum)

**Arguments:**

1. `fileName` (_String_): The path to the file where the data is persisted.
2. `maxNum` (_Number_): The maximum number that can be stored in this class.

**Returns:**

* (_Object_) objectBox (instance of Storage class)

## Properties

**Examples**

```js
{
    // private
    _count: Number
    _maxNum: Number
    _maxIndex: Number
    _box: Object         //created by Dict class
    _db: Object          //persistent datastore
}
```

**Notice**: id start from 1

## Methods

* isEmpty()
    - whether the box is empty
    - return Boolean

* has(id) (?)
    - is objectBox has the object of specify id
    - id (_Number_): object id
    - return Boolean

* get(id)
    - get the object of specify id
    - id (_Number_): object id
    - return Object

* set(id, obj, callback)
    - store object to the box and specify the object id, store object to database
    - id (_Number_): object id
    - obj (_Object_): object to be stored
    - callback (_Function): get called when store to objectBox and database

* add(obj, callback)
    - store object to the box and store object to database
    - obj (_Object_): object to be stored
    - callback (_Function): get called when store to objectBox and database

* remove(id, callback)
    - remove the object of specify id and remove object from database
    - id (_Number_): object id
    - callback (_Function): get called when remove from objectBox and database

* getMaxNum() (?)
    - get the maximum number of box
    - return Number

* getCount() (?)
    - obtain the number of objects in a box
    - return Number

* filter(path, value)
    - iterates box and filter out the match object
    - path (_String_): path to the object value
    - value (_Depends_): the value you want to compare to each object in object box
    - return Object[]

* find(predicate)
    - find the object in the box which is match predicate
    - predicate (_Array|Function|Object|String_)
    - return Object

* exportAllIds()
    - export all object id
    - return Number[]

* modify(id, path, snippet, callback)
    - modify the value of given object path to database
    - id (_Number_): device id
    - path (_String_): path to the value which you want to modify
    - snippet (_Depends_): the value of the object refer by path will be modified to snippet
    - callback (_Function): get called when modification is completed

* replace(id, path, value, callback)
    - replace the value of given object path to database
    - id (_Number_): device id
    - path (_String_): path to the value which you want to replace
    - value (_Depends_): the value of the object refer by path will be replaced to this value
    - callback (_Function_): get called when replace property to database is completed

* reload(callback)
    - load each object from database to box
    - callback (_Function_): get called when reload from database is completed

* isFulfilled(callback)
    - check whether the need to reload the box in each instance
    - callback (_Function_): get called when the check is complete

* mailtain(callback)
    - Synchronize data between database and storage box, and update each data object to database.
    - callback (_Function_): get called when maintain storage box is complete

## Private Constructor

Dict()

#### Property
* elements (_Object_)

#### Method
* has(key)
    - check element of given has in dictionary or not
* get(key)
    - get element by given key
* set(key, val)
    - add element to dictionary by given key
* remove(key)
    - remove element by given key


text:
package proxy

import (
	"context"
	"encoding/json"

	"github.com/centrifugal/centrifugo/v4/internal/proxyproto"

	"github.com/centrifugal/centrifuge"
)

// RPCRequest ...
type RPCRequest struct {
	Method    string
	Data      []byte
	ClientID  string
	UserID    string
	Transport centrifuge.TransportInfo
}

// RPCData ...
type RPCData struct {
	Data       json.RawMessage `json:"data"`
	Base64Data string          `json:"b64data"`
}

// RPCReply ...
type RPCReply struct {
	Result     *RPCData               `json:"result"`
	Error      *centrifuge.Error      `json:"error"`
	Disconnect *centrifuge.Disconnect `json:"disconnect"`
}

// RPCProxy allows to proxy RPC requests to application backend.
type RPCProxy interface {
	ProxyRPC(context.Context, *proxyproto.RPCRequest) (*proxyproto.RPCResponse, error)
	// Protocol for metrics and logging.
	Protocol() string
	// UseBase64 for bytes in requests from Centrifugo to application backend.
	UseBase64() bool
	// IncludeMeta ...
	IncludeMeta() bool
}


text:
@implementation PackageUtil

- (BOOL)enumeratePackages:(NSArray *)packages
                    error:(NSError **)error
      prevailingErrorCode:(NSInteger)prevailingErrorCode
         errorDescription:(NSString *)errorDescription
                    block:(PackagePathBlock)block
{
    if (!packages || packages.count <= 0)
    {
        return YES;
    }

    BOOL result = YES;
    NSUInteger packagesAltered = 0;
    NSMutableArray *errors = [NSMutableArray array];

    for (RMPackage *package in packages)
    {
        NSError *anError;
        if (!block(package, &anError))
        {
            [errors addObject:anError];
            result = NO;
        }
        else
        {
            packagesAltered++;
        }
    }

    if (errors.count > 0)
    {
        [NSError setNewErrorWithErrorPointer:error code:prevailingErrorCode userInfo:@{NSLocalizedDescriptionKey : errorDescription, @"errors" : errors}];
    }

    return result;
}

@end


text:
#ifndef MESSAGE_HPP_
#define MESSAGE_HPP_
#include "messaging.hpp"
#include <stdlib.h>

#ifdef __ARM__
#include <string>
#include <sstream>      // std::ostringstream
#include <stdio.h>
#endif

using callback = void (*)(void*, void*,uint16_t);
namespace PeripheralMessages {

struct PayloadHeader
{
	MessageId mMessageId;
	uint8_t mNodeSensorId; //0-256 sensor id each sensor must have number to be used by handler
	uint8_t mReserved; /*reserved? maybe version*/
} __attribute__((packed));

struct MessageBuffer
{
	uint8_t* mBuffer;
	uint8_t mSize;
};

template<MessageId _messageId, class _messageStruct>
class Message
{
public:
	static constexpr uint8_t BUFFER_SIZE = sizeof(PayloadHeader) + sizeof(_messageStruct);

#ifdef __ARM__
	Message(const std::string& mqtt_message) :
		Message()
	{

	}
#endif

	Message(uint8_t sensorId=0) :
	mMessageAllocated(true)
	{
		//Careful this should work now in MSP430, given there is implementation from the c library
		mMessageBuffer.mBuffer = (uint8_t*)malloc( BUFFER_SIZE );
		mMessageBuffer.mSize = BUFFER_SIZE;
		Initialize(mMessageBuffer.mBuffer,mMessageBuffer.mSize,true,sensorId);
	}

	//Pass in already allocated buffer to be filled with message.
	Message(uint8_t* buffer, uint8_t bufferLength,uint8_t sensorId=0) :
	mMessageAllocated(false)
	{
		Initialize(buffer,bufferLength,true,sensorId);
	}

   //Creates new message if true
	Message(uint8_t* buffer, uint8_t bufferLength, bool createMessage,uint8_t sensorId=0) :
	mMessageAllocated(false)
	{
		Initialize(buffer,bufferLength,createMessage,sensorId);
	}

	~Message()
	{

		if(mMessageAllocated) {
			//PRINT("dtor",ENDL)
			mMessageAllocated = false;
			//PRINT("free start",ENDL)
			free( (void*)mMessageBuffer.mBuffer );
			mMessageBuffer.mSize = 0;
			//PRINT("free end",ENDL)
		}
	}

	static void set_callback(callback cb)
	{
		mCallback = cb;
	}

	static void set_callback_arguments(void* ca)
	{
		mCallbackArgs = ca;
	}

	static void default_callback(void* args, void* msg, uint16_t callingId) {
		//Do nothing
	}

	static void trigger_callback(void* msg, uint16_t calling_id)  //add default callback that warns in compiler? or Assert to force it.
	{
		mCallback(mCallbackArgs, msg, calling_id);
	}

	const char* get_message_id_string() const
	{
		return MessageIdStrings[static_cast<uint16_t>(_messageId)];
	}

	const MessageBuffer&  get_message_buffer() const
	{
		return mMessageBuffer;
	}

	void set_sensor_id(const uint8_t sensorId)
	{
		mHeader->mNodeSensorId = sensorId;
	}

	bool isMessageValid()
	{
		return mMessageBuffer.mBuffer != nullptr &&
			mMessageBuffer.mSize != 0 &&
			mHeader != nullptr &&
			mMessage != nullptr;
	}

	bool is_message_valid()
	{
		return ( nullptr != mMessageBuffer.mBuffer || mMessageBuffer.mSize > 0);
	}

#ifdef __ARM__

	void get_message_as_mqtt_topic(char* buffer, const size_t size)
	{

		mMessage->to_mqtt_string(buffer,size);
	}

#if 0
	static inline std::string message_to_mqtt(uint16_t msgId, SwitchMessage* const msg)
	{
		std::ostringstream ostr;
		ostr << MessageIdStrings[msgId] << "/" << (int)msg->switchNumber << "/" << msg->state;
		return ostr.str();
	}

	static inline std::string message_to_mqtt(uint16_t msgId, TemperatureMessage* const msg)
	{
		std::ostringstream ostr;
		ostr << MessageIdStrings[msgId] << "/" << msg->temperature;
		return ostr.str();
	}

	static inline std::string message_to_mqtt(uint16_t msgId, EmptyMessage* const msg)
	{
		std::ostringstream ostr;
		ostr << MessageIdStrings[msgId];
		return ostr.str();
	}

	static inline std::string message_to_mqtt(uint16_t msgId, VersionMessage* const msg)
	{
		std::ostringstream ostr;
		ostr << MessageIdStrings[msgId] << "/" << msg->major << "/" << msg->minor;
		return ostr.str();
	}

	static inline std::string message_to_mqtt(uint16_t msgId, PingPongMessage* const msg)
	{
		std::ostringstream ostr;
		ostr << MessageIdStrings[msgId] << "/" << msg->count;
		return ostr.str();
	}

	void set_message_from_mqtt(std::vector<std::string>& msg_sub_strings)
	{
		msg_sub_strings(mMessage);

	}
#endif
	void set_message_from_mqtt_topic(char* message)
	{
		mMessage->from_mqtt_string(message);
	}

#endif

	//Operator used when passing this message class as an argument
	//expecting a MessageBuffer struct, this is due to the MSP430 not
	//having the ability to use virtual and thus interface class.
	operator const MessageBuffer&() const { return get_message_buffer(); }

	PayloadHeader* const get_message_header() const
	{
		return mHeader;
	}

	//Be careful returns a pointer that can be modified by user
	//Will return a nullptr if things are not setup correctly check return
	_messageStruct* get_message_payload()
	{
		return mMessage;
	}

private:

	void Initialize(uint8_t* buffer, uint8_t bufferLength, bool createMessage, uint8_t sensorId)
	{
		if( nullptr == buffer || bufferLength < sizeof(PayloadHeader) + sizeof(_messageStruct)) {
			mMessageBuffer.mBuffer = nullptr;
			mMessageBuffer.mSize = 0;
			mHeader = nullptr;
			mMessage = nullptr;
		}
		else {
			mMessageBuffer.mBuffer = buffer;
			mMessageBuffer.mSize = sizeof(PayloadHeader) + sizeof(_messageStruct);
			mHeader = reinterpret_cast<PayloadHeader*>(buffer);
			mMessage = reinterpret_cast<_messageStruct*>(buffer + sizeof(PayloadHeader));
			//After looking at this I dont know if I like this...Maybe fix this to be more clear due to addition of
			if(createMessage) {
				create_message(sensorId);
			}
		}

	}

	//Assumes pointers are correct no need to check again
	inline void create_message(uint8_t sensorId)
	{
		mHeader->mMessageId = _messageId;
		mHeader->mNodeSensorId = sensorId;
	}

	bool mMessageAllocated;
	MessageBuffer mMessageBuffer;
    PayloadHeader* mHeader;
	_messageStruct* mMessage;
	static callback mCallback;
	static void* mCallbackArgs;
};
template<MessageId m, class t>
callback Message<m,t>::mCallback = Message<m,t>::default_callback;
template<MessageId m, class t>
void* Message<m,t>::mCallbackArgs = nullptr;

using SwitchEventMsg  = Message<MessageId::SwitchEvent,SwitchMessage>;
using SwitchDataMsg  = Message<MessageId::SwitchData,SwitchMessage>;
using SwitchQueryMsg = Message<MessageId::SwitchQuery,SwitchMessage>;
using SwitchRequestMsg = Message<MessageId::SwitchRequest,SwitchMessage>;

using TemperatureEventMsg  = Message<MessageId::TemperatureEvent,TemperatureMessage>;
using TemperatureDataMsg  = Message<MessageId::TemperatureData,TemperatureMessage>;
using TemperatureQueryMsg = Message<MessageId::TemperatureQuery,EmptyMessage>;
using TemperatureRequestMsg = Message<MessageId::TemperatureRequest,EmptyMessage>;

using VersionDataMsg  = Message<MessageId::VersionData,VersionMessage>;
using VersionQueryMsg = Message<MessageId::VersionQuery,EmptyMessage>;

using PingPongDataMsg  = Message<MessageId::PingPongData,PingPongMessage>;
using PingPongQueryMsg = Message<MessageId::PingPongQuery,PingPongMessage>;

using HeartbeatDataMsg  = Message<MessageId::HeartbeatData,HeartbeatMessage>;
using HeartbeatQueryMsg = Message<MessageId::HeartbeatQuery,HeartbeatMessage>;

using DistanceSensorDataMsg  = Message<MessageId::DistanceSensorData,DistanceSensorMessage>;
using DistanceSensorQueryMsg = Message<MessageId::DistanceSensorQuery,DistanceSensorMessage>;

}
#endif //MESSAGE_HPP_


text:
<!DOCTYPE html>

        <title>Animations in Angular</title>

{{city.country}} - {{city.city}}

{{city.country}} - {{city.city}}

Hello World


text:
<!doctype html>

    <title>Code coverage report for nock/tests/test_s3.js</title>
    <meta charset="utf-8" />
    <link rel="stylesheet" href="../../prettify.css" />
    <link rel="stylesheet" href="../../base.css" />
    <meta name="viewport" content="width=device-width, initial-scale=1">

      All files / nock/tests test_s3.js

        90.91%
        Statements
        30/33

        50%
        Branches
        3/6

        100%
        Functions
        6/6

        100%
        Lines
        30/30

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100

1x
1x
1x

1x
1x

1x

1x

1x

1x

1x
1x
1x

1x
1x

1x

1x

1x

1x

1x
1x
1x

1x
1x

1x

1x

1x

1x

1x
1x
1x

'use strict';

var nock = require('../');
var AWS = require('aws-sdk');
var test = require('tap').test;

test('works with s3, body < 1024 ^ 2', function (t) {
  var REGION = 'us-east-1';

  AWS.config.update({
    region: REGION,
    sslEnabled: true,
    accessKeyId: 'ACCESSKEYID',
    secretAccessKey: 'SECRETACCESSKEY'
  });

  var bucket = new AWS.S3({
    apiVersion: '2006-03-01',
    params: {
      Bucket: 'bucket'
    }
  });

  nock('https://bucket.s3.amazonaws.com').put('/key').reply(200);

  bucket.putObject({
      Key: 'key',
      Body: new Buffer(1024 * 1024 - 1), // works
      // Body: new Buffer(1024 * 1024), // doesn't work
      ContentType: 'binary/octet-stream'
    },
    function (err, resp) {
      Iif (err) throw err;
      t.deepEqual(resp, {});
      t.end();
    });
});

test('works with s3, body = 10 * 1024 ^ 2', function (t) {
  var REGION = 'us-east-1';

  AWS.config.update({
    region: REGION,
    sslEnabled: true,
    accessKeyId: 'ACCESSKEYID',
    secretAccessKey: 'SECRETACCESSKEY'
  });

  var bucket = new AWS.S3({
    apiVersion: '2006-03-01',
    params: {
      Bucket: 'bucket'
    }
  });

  nock('https://bucket.s3.amazonaws.com').put('/key').reply(200);

  bucket.putObject({
      Key: 'key',
      Body: new Buffer(10 * 1024 * 1024), // doesn't work
      ContentType: 'binary/octet-stream'
    },
    function (err, resp) {
      Iif (err) throw err;
      t.deepEqual(resp, {});
      t.end();
    });
});

test('works with s3, body = 16 * 1024 ^ 2', function (t) {
  var REGION = 'us-east-1';

  AWS.config.update({
    region: REGION,
    sslEnabled: true,
    accessKeyId: 'ACCESSKEYID',
    secretAccessKey: 'SECRETACCESSKEY'
  });

  var bucket = new AWS.S3({
    apiVersion: '2006-03-01',
    params: {
      Bucket: 'bucket'
    }
  });

  nock('https://bucket.s3.amazonaws.com').put('/key').reply(200);

  bucket.putObject({
      Key: 'key',
      Body: new Buffer(16 * 1024 * 1024), // doesn't work
      ContentType: 'binary/octet-stream'
    },
    function (err, resp) {
      Iif (err) throw err;
      t.deepEqual(resp, {});
      t.end();
    });
});

  Code coverage
  generated by istanbul at Mon Oct 10 2016 17:01:16 GMT+0100 (BST)


text:
from __future__ import unicode_literals

import addons.wiki.models
from django.db import migrations, models

class Migration(migrations.Migration):

    dependencies = [
        ('addons_wiki', '0002_auto_20161019_1116'),
    ]

    operations = [
        migrations.AlterField(
            model_name='nodewikipage',
            name='page_name',
            field=models.CharField(max_length=200, validators=[addons.wiki.models.validate_page_name]),
        ),
    ]


text:
package Aarron.WallpaperCraft.blocks.wool;

import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material;
import net.minecraft.block.properties.PropertyEnum;
import Aarron.WallpaperCraft.blockStates.BlockStates;
import Aarron.WallpaperCraft.blockStates.BlockTypes2;
import Aarron.WallpaperCraft.blocks.IMetaBlock2;

public class WoolCyan extends IMetaBlock2<BlockTypes2> {

	public WoolCyan() {
		super(Material.CLOTH, "woolcyan");
		this.setSoundType(SoundType.CLOTH);
		this.setHardness(0.4F);
	}

	@Override
	protected BlockTypes2 getDefaultStateVariant() {
		return BlockTypes2.Zero;
	}

	@Override
	protected BlockTypes2 fromMeta(int meta) {
		return BlockTypes2.fromMeta(meta);
	}

	@Override
	protected PropertyEnum<BlockTypes2> getVariantEnum() {
		return BlockStates.WPblocks2;
	}
}


text:
package org.lnu.is.extractor.department.address;

import static org.junit.Assert.assertEquals;
import static org.mockito.Matchers.anyLong;
import static org.mockito.Mockito.doThrow;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;

import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.lnu.is.dao.dao.Dao;
import org.lnu.is.dao.exception.EntityNotFoundException;
import org.lnu.is.domain.address.type.AddressType;
import org.lnu.is.domain.admin.unit.AdminUnit;
import org.lnu.is.domain.common.RowStatus;
import org.lnu.is.domain.department.Department;
import org.lnu.is.domain.department.address.DepartmentAddress;
import org.lnu.is.domain.street.type.StreetType;
import org.lnu.is.security.service.SessionService;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.runners.MockitoJUnitRunner;

@RunWith(MockitoJUnitRunner.class)
public class DepartmentAddressParametersExtractorTest {

	@Mock
	private Dao<Department, Department, Long> departmentDao;

	@Mock
	private Dao<AddressType, AddressType, Long> addressTypeDao;

	@Mock
	private Dao<AdminUnit, AdminUnit, Long> adminUnitDao;

	@Mock
	private Dao<StreetType, StreetType, Long> streetTypeDao;

	@InjectMocks
	private DepartmentAddressParametersExtractor unit;

	@Mock
	private SessionService sessionService;

	private Boolean active = true;
	private Boolean security = true;

	private String group1 = "developers";
	private String group2 = "students";

	private List<String> groups = Arrays.asList(group1, group2);

	@Before
	public void setup() {
		unit.setActive(active);
		unit.setSecurity(security);

		when(sessionService.getGroups()).thenReturn(groups);
	}

	@Test
	public void testGetParameters() throws Exception {
		// Given
		String zipCode = "zip code";
		String street = "Street";
		String apartment = "apartment";
		String house = "house";

		Long departmentId = 1L;
		Department department = new Department();
		department.setId(departmentId);

		Long addressTypeId = 2L;
		AddressType addressType = new AddressType();
		addressType.setId(addressTypeId);

		Long adminUnitId = 3L;
		AdminUnit adminUnit = new AdminUnit();
		adminUnit.setId(adminUnitId);

		Long streetTypeId = 4L;
		StreetType streetType = new StreetType();
		streetType.setId(streetTypeId);

		DepartmentAddress entity = new DepartmentAddress();
		entity.setDepartment(department);
		entity.setAddressType(addressType);
		entity.setAdminUnit(adminUnit);
		entity.setStreetType(streetType);
		entity.setZipCode(zipCode);
		entity.setStreet(street);
		entity.setHouse(house);
		entity.setApartment(apartment);

		Map<String, Object> expected = new HashMap<>();
		expected.put("status", RowStatus.ACTIVE);
		expected.put("userGroups", groups);
		expected.put("department", department);
		expected.put("addressType", addressType);
		expected.put("streetType", streetType);
		expected.put("adminUnit", adminUnit);
		expected.put("zipCode", zipCode);
		expected.put("street", street);
		expected.put("house", house);
		expected.put("apartment", apartment);

		// When
		when(departmentDao.getEntityById(anyLong())).thenReturn(department);
		when(addressTypeDao.getEntityById(anyLong())).thenReturn(addressType);
		when(adminUnitDao.getEntityById(anyLong())).thenReturn(adminUnit);
		when(streetTypeDao.getEntityById(anyLong())).thenReturn(streetType);
		Map<String, Object> actual = unit.getParameters(entity);

		// Then
		verify(departmentDao).getEntityById(departmentId);
		verify(addressTypeDao).getEntityById(addressTypeId);
		verify(adminUnitDao).getEntityById(adminUnitId);
		verify(streetTypeDao).getEntityById(streetTypeId);
		assertEquals(expected, actual);
	}

	@Test
	public void testGetParametersWithEmptyParameters() throws Exception {
		// Given

		DepartmentAddress entity = new DepartmentAddress();

		Map<String, Object> expected = new HashMap<>();
		expected.put("status", RowStatus.ACTIVE);
		expected.put("userGroups", groups);

		// When
		Map<String, Object> actual = unit.getParameters(entity);

		// Then
		assertEquals(expected, actual);
	}

	@Test(expected = EntityNotFoundException.class)
	public void testGetParametersWithException() throws Exception {
		// Given
		String zipCode = "zip code";
		String street = "Street";
		String apartment = "apartment";
		String house = "house";

		Long departmentId = 1L;
		Department department = new Department();
		department.setId(departmentId);

		DepartmentAddress entity = new DepartmentAddress();
		entity.setDepartment(department);
		entity.setZipCode(zipCode);
		entity.setStreet(street);
		entity.setHouse(house);
		entity.setApartment(apartment);

		// When
		doThrow(EntityNotFoundException.class).when(departmentDao).getEntityById(anyLong());
		unit.getParameters(entity);

		// Then
		verify(departmentDao).getEntityById(departmentId);
	}
}


text:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.10"/>
<title>HE_Mesh: Member List</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>

<link href="navtree.css" rel="stylesheet" type="text/css"/>

<link href="search/search.css" rel="stylesheet" type="text/css"/>

<link href="doxygen.css" rel="stylesheet" type="text/css" />

HE_Mesh
    6.0.1

Main Page

Packages

Classes

Files

          <input type="text" id="MSearchField" value="Search" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)"
               onblur="searchBox.OnSearchFieldFocus(false)"
               onkeyup="searchBox.OnSearchFieldChange(event)"/>

Class List

Class Index

Class Hierarchy

Class Members

wblut.geom.WB_IsoValues3D.ImageStack3D Member List

This is the complete list of members for wblut.geom.WB_IsoValues3D.ImageStack3D, including all inherited members.

currentK	wblut.geom.WB_IsoValues3D.ImageStack3D	private

fillSlice(final int k, final double[][] values)	wblut.geom.WB_IsoValues3D.ImageStack3D	private

getBinaryGrid3D(final int sizeX, final int sizeY, final int sizeZ, final double threshold)	wblut.geom.WB_IsoValues3D

getSingleSliceValue(final PImage img, final int i, final int j)	wblut.geom.WB_IsoValues3D.ImageStack3D	private

getSizeI()	wblut.geom.WB_IsoValues3D.ImageStack3D

getSizeJ()	wblut.geom.WB_IsoValues3D.ImageStack3D

getSizeK()	wblut.geom.WB_IsoValues3D.ImageStack3D

getValue(final int i, final int j, final int k)	wblut.geom.WB_IsoValues3D.ImageStack3D

wblut::geom::WB_IsoValues3D.getValue(int i, int j, int k)	wblut.geom.WB_IsoValues3D

home	wblut.geom.WB_IsoValues3D.ImageStack3D	private

images	wblut.geom.WB_IsoValues3D.ImageStack3D	private

ImageStack3D(final String[] images, final PApplet home, final int sizeI, final int sizeJ, final int sizeK, final Mode mode)	wblut.geom.WB_IsoValues3D.ImageStack3D

ImageStack3D(final String[] images, final PApplet home, final int sizeI, final int sizeJ, final int sizeK)	wblut.geom.WB_IsoValues3D.ImageStack3D

incrementSlice()	wblut.geom.WB_IsoValues3D.ImageStack3D	private

initialize()	wblut.geom.WB_IsoValues3D.ImageStack3D	private

mode	wblut.geom.WB_IsoValues3D.ImageStack3D	private

sizeI	wblut.geom.WB_IsoValues3D.ImageStack3D	private

slice	wblut.geom.WB_IsoValues3D.ImageStack3D	private

sliceK	wblut.geom.WB_IsoValues3D.ImageStack3D	private

updateSlice(final int k)	wblut.geom.WB_IsoValues3D.ImageStack3D	private

Generated on Tue Dec 19 2017 21:20:23 for HE_Mesh by

     1.8.10


text:
package gslb

type Gslbdomaingslbvserverbinding struct {
	Backuplbmethod     string `json:"backuplbmethod,omitempty"`
	Cip                string `json:"cip,omitempty"`
	Customheaders      string `json:"customheaders,omitempty"`
	Dnsrecordtype      string `json:"dnsrecordtype,omitempty"`
	Dynamicweight      string `json:"dynamicweight,omitempty"`
	Edr                string `json:"edr,omitempty"`
	Lbmethod           string `json:"lbmethod,omitempty"`
	Mir                string `json:"mir,omitempty"`
	Name               string `json:"name,omitempty"`
	Netmask            string `json:"netmask,omitempty"`
	Persistenceid      int    `json:"persistenceid,omitempty"`
	Persistencetype    string `json:"persistencetype,omitempty"`
	Persistmask        string `json:"persistmask,omitempty"`
	Servicetype        string `json:"servicetype,omitempty"`
	Sitename           string `json:"sitename,omitempty"`
	Sitepersistence    string `json:"sitepersistence,omitempty"`
	Siteprefix         string `json:"siteprefix,omitempty"`
	State              string `json:"state,omitempty"`
	Statechangetimesec string `json:"statechangetimesec,omitempty"`
	V6netmasklen       int    `json:"v6netmasklen,omitempty"`
	V6persistmasklen   int    `json:"v6persistmasklen,omitempty"`
	Vservername        string `json:"vservername,omitempty"`
}


text:
/**
 */
package person.zhoujg.feature.impl;

import org.eclipse.emf.common.notify.Notification;

import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.InternalEObject;

import org.eclipse.emf.ecore.impl.ENotificationImpl;
import org.eclipse.emf.ecore.impl.MinimalEObjectImpl;

import person.zhoujg.feature.Feature;
import person.zhoujg.feature.FeaturePackage;
import person.zhoujg.feature.Literal;

/**
 *
 * An implementation of the model object 'Literal'.
 *
 *

 * The following features are implemented:
 *

 *
{@link person.zhoujg.feature.impl.LiteralImpl#getStr Str}

 *
{@link person.zhoujg.feature.impl.LiteralImpl#getInt Int}

 *
{@link person.zhoujg.feature.impl.LiteralImpl#getBool Bool}

 *
{@link person.zhoujg.feature.impl.LiteralImpl#getName Name}

 *

 *

 *
 * @generated
 */
public class LiteralImpl extends MinimalEObjectImpl.Container implements Literal
{
  /**
   * The default value of the '{@link #getStr() Str}' attribute.
   *
   *
   * @see #getStr()
   * @generated
   * @ordered
   */
  protected static final String STR_EDEFAULT = null;

  /**
   * The cached value of the '{@link #getStr() Str}' attribute.
   *
   *
   * @see #getStr()
   * @generated
   * @ordered
   */
  protected String str = STR_EDEFAULT;

  /**
   * The default value of the '{@link #getInt() Int}' attribute.
   *
   *
   * @see #getInt()
   * @generated
   * @ordered
   */
  protected static final int INT_EDEFAULT = 0;

  /**
   * The cached value of the '{@link #getInt() Int}' attribute.
   *
   *
   * @see #getInt()
   * @generated
   * @ordered
   */
  protected int int_ = INT_EDEFAULT;

  /**
   * The default value of the '{@link #getBool() Bool}' attribute.
   *
   *
   * @see #getBool()
   * @generated
   * @ordered
   */
  protected static final String BOOL_EDEFAULT = null;

  /**
   * The cached value of the '{@link #getBool() Bool}' attribute.
   *
   *
   * @see #getBool()
   * @generated
   * @ordered
   */
  protected String bool = BOOL_EDEFAULT;

  /**
   * The cached value of the '{@link #getName() Name}' reference.
   *
   *
   * @see #getName()
   * @generated
   * @ordered
   */
  protected Feature name;

  /**
   *
   *
   * @generated
   */
  protected LiteralImpl()
  {
    super();
  }

  /**
   *
   *
   * @generated
   */
  @Override
  protected EClass eStaticClass()
  {
    return FeaturePackage.Literals.LITERAL;
  }

  /**
   *
   *
   * @generated
   */
  public String getStr()
  {
    return str;
  }

  /**
   *
   *
   * @generated
   */
  public void setStr(String newStr)
  {
    String oldStr = str;
    str = newStr;
    if (eNotificationRequired())
      eNotify(new ENotificationImpl(this, Notification.SET, FeaturePackage.LITERAL__STR, oldStr, str));
  }

  /**
   *
   *
   * @generated
   */
  public int getInt()
  {
    return int_;
  }

  /**
   *
   *
   * @generated
   */
  public void setInt(int newInt)
  {
    int oldInt = int_;
    int_ = newInt;
    if (eNotificationRequired())
      eNotify(new ENotificationImpl(this, Notification.SET, FeaturePackage.LITERAL__INT, oldInt, int_));
  }

  /**
   *
   *
   * @generated
   */
  public String getBool()
  {
    return bool;
  }

  /**
   *
   *
   * @generated
   */
  public void setBool(String newBool)
  {
    String oldBool = bool;
    bool = newBool;
    if (eNotificationRequired())
      eNotify(new ENotificationImpl(this, Notification.SET, FeaturePackage.LITERAL__BOOL, oldBool, bool));
  }

  /**
   *
   *
   * @generated
   */
  public Feature getName()
  {
    if (name != null && name.eIsProxy())
    {
      InternalEObject oldName = (InternalEObject)name;
      name = (Feature)eResolveProxy(oldName);
      if (name != oldName)
      {
        if (eNotificationRequired())
          eNotify(new ENotificationImpl(this, Notification.RESOLVE, FeaturePackage.LITERAL__NAME, oldName, name));
      }
    }
    return name;
  }

  /**
   *
   *
   * @generated
   */
  public Feature basicGetName()
  {
    return name;
  }

  /**
   *
   *
   * @generated
   */
  public void setName(Feature newName)
  {
    Feature oldName = name;
    name = newName;
    if (eNotificationRequired())
      eNotify(new ENotificationImpl(this, Notification.SET, FeaturePackage.LITERAL__NAME, oldName, name));
  }

  /**
   *
   *
   * @generated
   */
  @Override
  public Object eGet(int featureID, boolean resolve, boolean coreType)
  {
    switch (featureID)
    {
      case FeaturePackage.LITERAL__STR:
        return getStr();
      case FeaturePackage.LITERAL__INT:
        return getInt();
      case FeaturePackage.LITERAL__BOOL:
        return getBool();
      case FeaturePackage.LITERAL__NAME:
        if (resolve) return getName();
        return basicGetName();
    }
    return super.eGet(featureID, resolve, coreType);
  }

  /**
   *
   *
   * @generated
   */
  @Override
  public void eSet(int featureID, Object newValue)
  {
    switch (featureID)
    {
      case FeaturePackage.LITERAL__STR:
        setStr((String)newValue);
        return;
      case FeaturePackage.LITERAL__INT:
        setInt((Integer)newValue);
        return;
      case FeaturePackage.LITERAL__BOOL:
        setBool((String)newValue);
        return;
      case FeaturePackage.LITERAL__NAME:
        setName((Feature)newValue);
        return;
    }
    super.eSet(featureID, newValue);
  }

  /**
   *
   *
   * @generated
   */
  @Override
  public void eUnset(int featureID)
  {
    switch (featureID)
    {
      case FeaturePackage.LITERAL__STR:
        setStr(STR_EDEFAULT);
        return;
      case FeaturePackage.LITERAL__INT:
        setInt(INT_EDEFAULT);
        return;
      case FeaturePackage.LITERAL__BOOL:
        setBool(BOOL_EDEFAULT);
        return;
      case FeaturePackage.LITERAL__NAME:
        setName((Feature)null);
        return;
    }
    super.eUnset(featureID);
  }

  /**
   *
   *
   * @generated
   */
  @Override
  public boolean eIsSet(int featureID)
  {
    switch (featureID)
    {
      case FeaturePackage.LITERAL__STR:
        return STR_EDEFAULT == null ? str != null : !STR_EDEFAULT.equals(str);
      case FeaturePackage.LITERAL__INT:
        return int_ != INT_EDEFAULT;
      case FeaturePackage.LITERAL__BOOL:
        return BOOL_EDEFAULT == null ? bool != null : !BOOL_EDEFAULT.equals(bool);
      case FeaturePackage.LITERAL__NAME:
        return name != null;
    }
    return super.eIsSet(featureID);
  }

  /**
   *
   *
   * @generated
   */
  @Override
  public String toString()
  {
    if (eIsProxy()) return super.toString();

    StringBuffer result = new StringBuffer(super.toString());
    result.append(" (str: ");
    result.append(str);
    result.append(", int: ");
    result.append(int_);
    result.append(", bool: ");
    result.append(bool);
    result.append(')');
    return result.toString();
  }

} //LiteralImpl


text:
ALTER TABLE user DROP COLUMN IF EXISTS location_public;

--;;

ALTER TABLE user DROP COLUMN IF EXISTS location_lng;

--;;

ALTER TABLE user DROP COLUMN IF EXISTS location_lat;

--;;

ALTER TABLE user_badge DROP COLUMN IF EXISTS location_lng;

--;;

ALTER TABLE user_badge DROP COLUMN IF EXISTS location_lat;

--;;


text:
package org.wso2.siddhi.core.query.window;

import junit.framework.Assert;
import org.apache.log4j.Logger;
import org.junit.Before;
import org.junit.Test;
import org.wso2.siddhi.core.ExecutionPlanRuntime;
import org.wso2.siddhi.core.SiddhiManager;
import org.wso2.siddhi.core.event.Event;
import org.wso2.siddhi.core.query.output.callback.QueryCallback;
import org.wso2.siddhi.core.stream.input.InputHandler;
import org.wso2.siddhi.core.util.EventPrinter;

public class TimeBatchWindowTestCase {
    private static final Logger log = Logger.getLogger(TimeBatchWindowTestCase.class);
    private int inEventCount;
    private int removeEventCount;
    private boolean eventArrived;

    @Before
    public void init() {
        inEventCount = 0;
        removeEventCount = 0;
        eventArrived = false;
    }

    @Test
    public void timeWindowBatchTest1() throws InterruptedException {

        SiddhiManager siddhiManager = new SiddhiManager();

        String cseEventStream = "" +
                "define stream cseEventStream (symbol string, price float, volume int);";
        String query = "" +
                "@info(name = 'query1') " +
                "from cseEventStream#window.timeBatch(1 sec) " +
                "select symbol,sum(price) as sumPrice,volume " +
                "insert all events into outputStream ;";

        ExecutionPlanRuntime executionPlanRuntime = siddhiManager.createExecutionPlanRuntime(cseEventStream + query);

        executionPlanRuntime.addCallback("query1", new QueryCallback() {
            @Override
            public void receive(long timeStamp, Event[] inEvents, Event[] removeEvents) {
                EventPrinter.print(timeStamp, inEvents, removeEvents);
                if (inEventCount == 0) {
                    Assert.assertTrue("Remove Events will only arrive after the second time period. ", removeEvents == null);
                }
                if (inEvents != null) {
                    inEventCount = inEventCount + inEvents.length;
                } else if (removeEvents != null) {
                    removeEventCount = removeEventCount + removeEvents.length;
                }
                eventArrived = true;
            }

        });

        InputHandler inputHandler = executionPlanRuntime.getInputHandler("cseEventStream");
        executionPlanRuntime.start();
        inputHandler.send(new Object[]{"IBM", 700f, 0});
        inputHandler.send(new Object[]{"WSO2", 60.5f, 1});
        Thread.sleep(3000);
        Assert.assertEquals(1, inEventCount);
        Assert.assertEquals(1, removeEventCount);
        Assert.assertTrue(eventArrived);
        executionPlanRuntime.shutdown();

    }

    @Test
    public void timeWindowBatchTest2() throws InterruptedException {

        SiddhiManager siddhiManager = new SiddhiManager();

        String cseEventStream = "" +
                "define stream cseEventStream (symbol string, price float, volume int);";
        String query = "" +
                "@info(name = 'query1') " +
                "from cseEventStream#window.timeBatch(1 sec) " +
                "select symbol, sum(price) as price " +
                "insert all events into outputStream ;";

        ExecutionPlanRuntime executionPlanRuntime = siddhiManager.createExecutionPlanRuntime(cseEventStream + query);

        executionPlanRuntime.addCallback("query1", new QueryCallback() {
            @Override
            public void receive(long timeStamp, Event[] inEvents, Event[] removeEvents) {
                EventPrinter.print(timeStamp, inEvents, removeEvents);
                if (inEvents != null) {
                    inEventCount = inEventCount + inEvents.length;
                }
                if (removeEvents != null) {
                    Assert.assertTrue("InEvents arrived before RemoveEvents", inEventCount > removeEventCount);
                    removeEventCount = removeEventCount + removeEvents.length;
                }
                eventArrived = true;
            }

        });

        InputHandler inputHandler = executionPlanRuntime.getInputHandler("cseEventStream");
        executionPlanRuntime.start();
        inputHandler.send(new Object[]{"IBM", 700f, 1});
        Thread.sleep(1100);
        inputHandler.send(new Object[]{"WSO2", 60.5f, 2});
        inputHandler.send(new Object[]{"IBM", 700f, 3});
        inputHandler.send(new Object[]{"WSO2", 60.5f, 4});
        Thread.sleep(1100);
        inputHandler.send(new Object[]{"IBM", 700f, 5});
        inputHandler.send(new Object[]{"WSO2", 60.5f, 6});
        Thread.sleep(2000);
        Assert.assertEquals(3, inEventCount);
        Assert.assertEquals(1, removeEventCount);
        Assert.assertTrue(eventArrived);
        executionPlanRuntime.shutdown();
    }

    @Test
    public void timeWindowBatchTest3() throws InterruptedException {

        SiddhiManager siddhiManager = new SiddhiManager();

        String cseEventStream = "" +
                "define stream cseEventStream (symbol string, price float, volume int);";
        String query = "" +
                "@info(name = 'query1') " +
                "from cseEventStream#window.timeBatch(1 sec) " +
                "select symbol, sum(price) as price " +
                "insert into outputStream ;";

        ExecutionPlanRuntime executionPlanRuntime = siddhiManager.createExecutionPlanRuntime(cseEventStream + query);

        executionPlanRuntime.addCallback("query1", new QueryCallback() {
            @Override
            public void receive(long timeStamp, Event[] inEvents, Event[] removeEvents) {
                EventPrinter.print(timeStamp, inEvents, removeEvents);
                if (inEvents != null) {
                    inEventCount = inEventCount + inEvents.length;
                }
                if (removeEvents != null) {
                    removeEventCount = removeEventCount + removeEvents.length;
                }
                Assert.assertTrue("Remove events should not arrive ", removeEvents == null);
                eventArrived = true;
            }

        });

        InputHandler inputHandler = executionPlanRuntime.getInputHandler("cseEventStream");
        executionPlanRuntime.start();
        inputHandler.send(new Object[]{"IBM", 700f, 1});
        Thread.sleep(1100);
        inputHandler.send(new Object[]{"WSO2", 60.5f, 2});
        inputHandler.send(new Object[]{"IBM", 700f, 3});
        inputHandler.send(new Object[]{"WSO2", 60.5f, 4});
        Thread.sleep(1100);
        inputHandler.send(new Object[]{"IBM", 700f, 5});
        inputHandler.send(new Object[]{"WSO2", 60.5f, 6});
        Thread.sleep(2000);
        Assert.assertEquals(3, inEventCount);
        Assert.assertEquals(0, removeEventCount);
        Assert.assertTrue(eventArrived);
        executionPlanRuntime.shutdown();
    }

    @Test
    public void timeWindowBatchTest4() throws InterruptedException {

        SiddhiManager siddhiManager = new SiddhiManager();

        String cseEventStream = "" +
                "define stream cseEventStream (symbol string, price float, volume int);";
        String query = "" +
                "@info(name = 'query1') " +
                "from cseEventStream#window.timeBatch(1 sec) " +
                "select symbol, sum(price) as price " +
                "insert expired events into outputStream ;";

        ExecutionPlanRuntime executionPlanRuntime = siddhiManager.createExecutionPlanRuntime(cseEventStream + query);

        executionPlanRuntime.addCallback("query1", new QueryCallback() {
            @Override
            public void receive(long timeStamp, Event[] inEvents, Event[] removeEvents) {
                EventPrinter.print(timeStamp, inEvents, removeEvents);
                if (inEvents != null) {
                    inEventCount = inEventCount + inEvents.length;
                }
                if (removeEvents != null) {
                    removeEventCount = removeEventCount + removeEvents.length;
                }
                Assert.assertTrue("inEvents should not arrive ", inEvents == null);
                eventArrived = true;
            }

        });

        InputHandler inputHandler = executionPlanRuntime.getInputHandler("cseEventStream");
        executionPlanRuntime.start();
        inputHandler.send(new Object[]{"IBM", 700f, 1});
        Thread.sleep(1100);
        inputHandler.send(new Object[]{"WSO2", 60.5f, 2});
        inputHandler.send(new Object[]{"IBM", 700f, 3});
        inputHandler.send(new Object[]{"WSO2", 60.5f, 4});
        Thread.sleep(1100);
        inputHandler.send(new Object[]{"IBM", 700f, 5});
        inputHandler.send(new Object[]{"WSO2", 60.5f, 6});
        Thread.sleep(2000);
        Assert.assertEquals(0, inEventCount);
        Assert.assertEquals(3, removeEventCount);
        Assert.assertTrue(eventArrived);
        executionPlanRuntime.shutdown();
    }

    @Test
    public void timeWindowBatchTest5() throws InterruptedException {
        log.info("timeWindowBatch Test5");

        SiddhiManager siddhiManager = new SiddhiManager();
        String streams = "" +
                "define stream cseEventStream (symbol string, price float, volume int); " +
                "define stream twitterStream (user string, tweet string, company string); ";
        String query = "" +
                "@info(name = 'query1') " +
                "from cseEventStream#window.timeBatch(1 sec) join twitterStream#window.timeBatch(1 sec) " +
                "on cseEventStream.symbol== twitterStream.company " +
                "select cseEventStream.symbol as symbol, twitterStream.tweet, cseEventStream.price " +
                "insert all events into outputStream ;";

        ExecutionPlanRuntime executionPlanRuntime = siddhiManager.createExecutionPlanRuntime(streams + query);
        try {
            executionPlanRuntime.addCallback("query1", new QueryCallback() {
                @Override
                public void receive(long timeStamp, Event[] inEvents, Event[] removeEvents) {
                    EventPrinter.print(timeStamp, inEvents, removeEvents);
                    if (inEvents != null) {
                        inEventCount += (inEvents.length);
                    }
                    if (removeEvents != null) {
                        removeEventCount += (removeEvents.length);
                    }
                    eventArrived = true;
                }
            });
            InputHandler cseEventStreamHandler = executionPlanRuntime.getInputHandler("cseEventStream");
            InputHandler twitterStreamHandler = executionPlanRuntime.getInputHandler("twitterStream");
            executionPlanRuntime.start();
            cseEventStreamHandler.send(new Object[]{"WSO2", 55.6f, 100});
            twitterStreamHandler.send(new Object[]{"User1", "Hello World", "WSO2"});
            cseEventStreamHandler.send(new Object[]{"IBM", 75.6f, 100});
            Thread.sleep(1100);
            cseEventStreamHandler.send(new Object[]{"WSO2", 57.6f, 100});
            Thread.sleep(1000);
            Assert.assertTrue("In Events can be 1 or 2 ", inEventCount == 1 || inEventCount == 2);
            Assert.assertTrue("Removed Events can be 1 or 2 ", removeEventCount == 1 || removeEventCount == 2);
            Assert.assertTrue(eventArrived);
        } finally {
            executionPlanRuntime.shutdown();
        }
    }

    @Test
    public void timeWindowBatchTest6() throws InterruptedException {
        log.info("timeWindowBatch Test6");

        SiddhiManager siddhiManager = new SiddhiManager();
        String streams = "" +
                "define stream cseEventStream (symbol string, price float, volume int); " +
                "define stream twitterStream (user string, tweet string, company string); ";
        String query = "" +
                "@info(name = 'query1') " +
                "from cseEventStream#window.timeBatch(1 sec) join twitterStream#window.timeBatch(1 sec) " +
                "on cseEventStream.symbol== twitterStream.company " +
                "select cseEventStream.symbol as symbol, twitterStream.tweet, cseEventStream.price " +
                "insert into outputStream ;";

        ExecutionPlanRuntime executionPlanRuntime = siddhiManager.createExecutionPlanRuntime(streams + query);
        try {
            executionPlanRuntime.addCallback("query1", new QueryCallback() {
                @Override
                public void receive(long timeStamp, Event[] inEvents, Event[] removeEvents) {
                    EventPrinter.print(timeStamp, inEvents, removeEvents);
                    if (inEvents != null) {
                        inEventCount += (inEvents.length);
                    }
                    if (removeEvents != null) {
                        removeEventCount += (removeEvents.length);
                    }
                    eventArrived = true;
                }
            });
            InputHandler cseEventStreamHandler = executionPlanRuntime.getInputHandler("cseEventStream");
            InputHandler twitterStreamHandler = executionPlanRuntime.getInputHandler("twitterStream");
            executionPlanRuntime.start();
            cseEventStreamHandler.send(new Object[]{"WSO2", 55.6f, 100});
            twitterStreamHandler.send(new Object[]{"User1", "Hello World", "WSO2"});
            cseEventStreamHandler.send(new Object[]{"IBM", 75.6f, 100});
            Thread.sleep(1500);
            cseEventStreamHandler.send(new Object[]{"WSO2", 57.6f, 100});
            Thread.sleep(1000);
            Assert.assertTrue("In Events can be 1 or 2 ", inEventCount == 1 || inEventCount == 2);
            Assert.assertEquals(0, removeEventCount);
            Assert.assertTrue(eventArrived);
        } finally {
            executionPlanRuntime.shutdown();
        }
    }

    @Test
    public void timeWindowBatchTest7() throws InterruptedException {

        SiddhiManager siddhiManager = new SiddhiManager();

        String cseEventStream = "" +
                "define stream cseEventStream (symbol string, price float, volume int);";
        String query = "" +
                "@info(name = 'query1') " +
                "from cseEventStream#window.timeBatch(2 sec , 0) " +
                "select symbol, sum(price) as sumPrice, volume " +
                "insert into outputStream ;";

        ExecutionPlanRuntime executionPlanRuntime = siddhiManager.createExecutionPlanRuntime(cseEventStream + query);

        executionPlanRuntime.addCallback("query1", new QueryCallback() {
            @Override
            public void receive(long timeStamp, Event[] inEvents, Event[] removeEvents) {
                EventPrinter.print(timeStamp, inEvents, removeEvents);
                if (inEventCount == 0) {
                    Assert.assertTrue("Remove Events will only arrive after the second time period. ", removeEvents == null);
                }
                if (inEvents != null) {
                    inEventCount = inEventCount + inEvents.length;
                } else if (removeEvents != null) {
                    removeEventCount = removeEventCount + removeEvents.length;
                }
                eventArrived = true;
            }

        });

        InputHandler inputHandler = executionPlanRuntime.getInputHandler("cseEventStream");
        executionPlanRuntime.start();
        // Start sending events in the beginning of a cycle
        while (System.currentTimeMillis() % 2000 != 0) ;
        inputHandler.send(new Object[]{"IBM", 700f, 0});
        inputHandler.send(new Object[]{"WSO2", 60.5f, 1});
        Thread.sleep(8500);
        inputHandler.send(new Object[]{"WSO2", 60.5f, 1});
        inputHandler.send(new Object[]{"II", 60.5f, 1});
        Thread.sleep(13000);
        inputHandler.send(new Object[]{"TT", 60.5f, 1});
        inputHandler.send(new Object[]{"YY", 60.5f, 1});
        Thread.sleep(5000);
        Assert.assertEquals(3, inEventCount);
        Assert.assertEquals(0, removeEventCount);
        Assert.assertTrue(eventArrived);
        executionPlanRuntime.shutdown();

    }

//    @Test
//    public void timeWindowBatchStartTimeTest() throws InterruptedException {
//
//        SiddhiManager siddhiManager = new SiddhiManager();
//
//        String cseEventStream = "define stream cseEventStream (symbol string, price float, volume int);";
//        String query = "@info(name = 'query1') from cseEventStream#window.timeBatch(1 sec, 0) select symbol, sum(price) as price" +
//                " insert all events into outputStream ;";
//
//        ExecutionPlanRuntime executionPlanRuntime = siddhiManager.createExecutionPlanRuntime(cseEventStream + query);
//
//        executionPlanRuntime.addCallback("query1", new QueryCallback() {
//            @Override
//            public void receive(long timeStamp, Event[] inEvents, Event[] removeEvents) {
//                EventPrinter.print(timeStamp, inEvents, removeEvents);
//                if (inEvents != null) {
//                    inEventCount = inEventCount + inEvents.length;
//                }
//                if (removeEvents != null) {
//                    Assert.assertTrue("InEvents arrived before RemoveEvents", inEventCount > removeEventCount);
//                    // checking whether events are emitted close to a round time with 10% error.
//                    long timestamp = removeEvents[0].getTimestamp();
//                    Assert.assertTrue("Remove events timestamps are close to round times", (timestamp % 1000) < 100);
//                    removeEventCount = removeEventCount + removeEvents.length;
//                }
//                eventArrived = true;
//            }
//
//        });
//
//        InputHandler inputHandler = executionPlanRuntime.getInputHandler("cseEventStream");
//        executionPlanRuntime.start();
//        inputHandler.send(new Object[]{"IBM", 700f, 1});
//        Thread.sleep(1100);
//        inputHandler.send(new Object[]{"WSO2", 60.5f, 2});
//        inputHandler.send(new Object[]{"IBM", 700f, 3});
//        inputHandler.send(new Object[]{"WSO2", 60.5f, 4});
//        Thread.sleep(1100);
//        inputHandler.send(new Object[]{"IBM", 700f, 5});
//        inputHandler.send(new Object[]{"WSO2", 60.5f, 6});
//        Thread.sleep(3000);
//        inputHandler.send(new Object[]{"WSO2", 60.5f, 6});
//        Thread.sleep(5000);
//
//        Assert.assertEquals(4, inEventCount);
//        Assert.assertEquals(2, removeEventCount);
//        Assert.assertTrue(eventArrived);
//        executionPlanRuntime.shutdown();
//    }

}


text:
import sys
import json
import logging
from time import sleep
from urlparse import urlparse

from redis import Redis
from elasticsearch import Elasticsearch
from elasticsearch.exceptions import NotFoundError

import settings

# Stuff to init
logger = redis = es = None

# Import views to Elasticsearch
def import_view(json_data):
    data = json.loads(json_data)
    logger.debug('+View on client {0}: {1}'.format(data['client_key'], data['url']))

    # Check if the client exists
    try:
        es.get(index='fizzstat', doc_type='client', id=data['client_key'])
    except NotFoundError:
        # Add the client
        logger.debug('Client not found, adding {0}'.format(data['client_key']))
        es.index(index='fizzstat', doc_type='client', id=data['client_key'], body={
            'ip': data['client_data']['ip'],
            'browser': data['client_data']['browser'],
            'hash': data['client_data']['hash']
        })

    # Parse the url
    urlbits = urlparse(data['url'])
    port = urlbits.port
    if not port:
        if urlbits.scheme == 'http':
            port = 80
        elif urlbits.scheme == 'https':
            port = 433

    # Add the view
    es.index(index='fizzstat', doc_type='view', id=data['view_key'], body={
        'client': data['client_key'],
        'date': data['datetime'],
        'url': data['url'],
        'host': urlbits.hostname,
        'port': port,
        'path': urlbits.path,
        'query': urlbits.query
    })

# Import events to Elasticsearch
def import_event(json_data):
    data = json.loads(json_data)
    logger.debug('+Event on view {0}: {1}/{2}'.format(data['view_key'], data['event_type'], data['value']))

    # Check the view exists
    try:
        result = es.get(index='fizzstat', doc_type='view', id=data['view_key'])
        view = result['_source']
    except NotFoundError:
        logger.warning('Invalid event on non-existant view: {0}'.format(data['view_key']))
        return

    # Add the event
    es.index(index='fizzstat', doc_type='event', body={
        'client': view['client'],
        'view': data['view_key'],
        'date': data['datetime'],
        'type': data['event_type'],
        'value': data['value'],
        'data': data['data']
    })

if __name__ == '__main__':
    # Init logging
    logger = logging.getLogger('fizzstat')
    logging.basicConfig(level=(logging.DEBUG if settings.DEBUG else logging.WARNING))

    # Init Redis
    logger.debug('Connecting to Redis...')
    redis = Redis(host=settings.REDIS_HOST, port=settings.REDIS_PORT)

    # Init Elasticsearch
    logger.debug('Connecting to Elasticsearch...')
    es = Elasticsearch(settings.ES_NODES, timeout=10)

    # The loop
    logger.debug('Starting loop...')
    try:
        while True:
            # Views always before events
            view = redis.rpop('fizzstat_views')
            if view:
                import_view(view)
            else:
                # Events
                event = redis.rpop('fizzstat_events')
                if event:
                    import_event(event)

            if not view:
                logger.debug('No views or events, sleeping for {0}s'.format(settings.IMPORT_INTERVAL))
                sleep(settings.IMPORT_INTERVAL)
    except KeyboardInterrupt:
        logger.debug('Exiting on ctrl+c')
        sys.exit(0)


text:
"""
    `Unit tests for cargo.builder.create_user`
--·--·--·--·--·--·--·--·--·--·--·--·--·--·--·--·--·--·--·--·--·--·--·--·--·--·--
   2016 Jared Lunde © The MIT License (MIT)
   http://github.com/jaredlunde
"""
import unittest
import psycopg2

from vital.security import randkey

from cargo import ORM, db, fields, Function, Clause
from cargo.builder import create_type
from cargo.builder.types import Type

def new_field(type='text', value=None, name=None, table=None):
    field = getattr(fields, type.title())(value=value)
    field.field_name = name or randkey(24, keyspace='aeioughrstlnmy')
    field.table = table or randkey(24, keyspace='aeioughrstlnmy')
    return field

class TestCreateType(unittest.TestCase):
    orm = ORM()

    def test_create(self):
        attrs = ((new_field(), Clause('COLLATE', 'LATIN1')),
                 (new_field(), Clause('COLLATE', 'LATIN1')),)
        type = create_type(self.orm, 'foo', attrs=attrs, dry=True)
        print(type.query.mogrified)

        type = Type(self.orm, 'foo')
        type.options(input=Function('foo_in').func,
                     output=Function('foo_out').func,
                     internallength=16,
                     element='float4')
        print(type.query)
        print(type.query.mogrified)

        type = Type(self.orm,
                    'foo',
                    Clause('PASSEDBYVALUE'),
                    input=Function('foo_in').func,
                    output=Function('foo_out').func,
                    internallength=16,
                    element='float4')
        print(type.query)
        print(type.query.mogrified)

if __name__ == '__main__':
    # Unit test
    unittest.main()


text:
ynab-reconcile
==============

Reconciles a Mint data dump with a YNAB register

Usage
=====

Point the program at the directories where your YNAB and Mint exports live. It'll find the latest one of each.

`./yr.py --ynab-dir ~/ynab_exports --mint-dir ~/Downloads`

You can also point it at a specific file:

`./yr.py --ynab ~/ynab_export.csv --mint ~/Downloads/transactions.csv`

You may also apply a start date parameter (`--start-date 2014-01-31`) to only show unmatched transactions starting on a certain date.

For New YNAB support, which exports all accounts to the same file, you may prepend the `account <account name>` argument to only get matches for the specified account.


text:
namespace Xilium.CefGlue;

using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Runtime.InteropServices;
using Xilium.CefGlue.Interop;

/// <summary>
/// Implemented by the client to observe MediaRouter events and registered via
/// CefMediaRouter::AddObserver. The methods of this class will be called on the
/// browser process UI thread.
/// </summary>
public abstract unsafe partial class CefMediaObserver
{
    private void on_sinks(cef_media_observer_t* self, UIntPtr sinksCount, cef_media_sink_t** sinks)
    {
        CheckSelf(self);

        var mSinksCount = checked((int)sinksCount);
        var mSinks = new CefMediaSink[mSinksCount];
        for (var i = 0; i < mSinksCount; i++)
        {
            mSinks[i] = CefMediaSink.FromNative(sinks[i]);
        }

        OnSinks(mSinks);
    }

    /// <summary>
    /// The list of available media sinks has changed or
    /// CefMediaRouter::NotifyCurrentSinks was called.
    /// </summary>
    protected abstract void OnSinks(CefMediaSink[] sinks);

    private void on_routes(cef_media_observer_t* self, UIntPtr routesCount, cef_media_route_t** routes)
    {
        CheckSelf(self);

        var mRoutesCount = checked((int)routesCount);
        var mRoutes = new CefMediaRoute[mRoutesCount];
        for (var i = 0; i < mRoutesCount; i++)
        {
            mRoutes[i] = CefMediaRoute.FromNative(routes[i]);
        }

        OnRoutes(mRoutes);
    }

    /// <summary>
    /// The list of available media routes has changed or
    /// CefMediaRouter::NotifyCurrentRoutes was called.
    /// </summary>
    protected abstract void OnRoutes(CefMediaRoute[] routes);

    private void on_route_state_changed(cef_media_observer_t* self, cef_media_route_t* route, CefMediaRouteConnectionState state)
    {
        CheckSelf(self);

        var mRoute = CefMediaRoute.FromNative(route);
        OnRouteStateChanged(mRoute, state);
    }

    /// <summary>
    /// The connection state of |route| has changed.
    /// </summary>
    protected abstract void OnRouteStateChanged(CefMediaRoute route, CefMediaRouteConnectionState state);

    private void on_route_message_received(cef_media_observer_t* self, cef_media_route_t* route, void* message, UIntPtr message_size)
    {
        CheckSelf(self);

        var mRoute = CefMediaRoute.FromNative(route);
        var mMessageSize = checked((int)message_size);

        OnRouteMessageReceived(mRoute, (IntPtr)message, mMessageSize);
    }

    /// <summary>
    /// A message was recieved over |route|. |message| is only valid for
    /// the scope of this callback and should be copied if necessary.
    /// </summary>
    protected abstract void OnRouteMessageReceived(CefMediaRoute route, IntPtr message, int messageSize);
}


text:
package org.apache.druid.data.input;

import com.google.common.base.Preconditions;
import com.google.common.collect.Iterables;
import org.apache.druid.java.util.common.parsers.ParseException;
import org.apache.druid.utils.CollectionUtils;

import javax.annotation.Nullable;
import java.util.Collections;
import java.util.List;
import java.util.Map;

/**
 * A triple of a list of {@link InputRow}s, a {@link Map} of raw values, and a {@link ParseException}.
 * The rawValues map contains the raw values before being parsed into InputRows. Note that a single map can be parsed
 * into multiple InputRows, for example, with explodeSpec.
 * The ParseException is the exception thrown when parsing bytes into either the rawValues map or the list of InputRows.
 *
 * In any case, one of triple must not be null.
 */
public class InputRowListPlusRawValues
{
  @Nullable
  private final List<InputRow> inputRows;

  @Nullable
  private final List<Map<String, Object>> rawValues;

  @Nullable
  private final ParseException parseException;

  public static InputRowListPlusRawValues of(@Nullable InputRow inputRow, Map<String, Object> rawColumns)
  {
    return of(inputRow == null ? null : Collections.singletonList(inputRow), rawColumns);
  }

  public static InputRowListPlusRawValues of(@Nullable List<InputRow> inputRows, Map<String, Object> rawColumns)
  {
    return new InputRowListPlusRawValues(inputRows,
                                         Collections.singletonList(Preconditions.checkNotNull(rawColumns, "rawColumns")),
                                         null);
  }

  public static InputRowListPlusRawValues of(@Nullable Map<String, Object> rawColumns, ParseException parseException)
  {
    return new InputRowListPlusRawValues(
        null,
        rawColumns == null ? null : Collections.singletonList(rawColumns),
        Preconditions.checkNotNull(parseException, "parseException")
    );
  }

  public static InputRowListPlusRawValues ofList(@Nullable List<Map<String, Object>> rawColumnsList, ParseException parseException)
  {
    return ofList(rawColumnsList, null, parseException);
  }

  /**
   * Create an instance of {@link InputRowListPlusRawValues}
   *
   * Make sure the size of given rawColumnsList and inputRows are the same if both of them are not null
   */
  public static InputRowListPlusRawValues ofList(@Nullable List<Map<String, Object>> rawColumnsList,
                                                 @Nullable List<InputRow> inputRows)
  {
    return ofList(rawColumnsList, inputRows, null);
  }

  /**
   * Create an instance of {@link InputRowListPlusRawValues}
   *
   * Make sure the size of given rawColumnsList and inputRows are the same if both of them are not null
   */
  public static InputRowListPlusRawValues ofList(@Nullable List<Map<String, Object>> rawColumnsList,
                                                 @Nullable List<InputRow> inputRows,
                                                 @Nullable ParseException parseException)
  {
    if (rawColumnsList != null && inputRows != null && rawColumnsList.size() != inputRows.size()) {
      throw new ParseException(null, "Size of rawColumnsList([%s]) does not correspond to size of inputRows([%s])", rawColumnsList, inputRows);
    }

    return new InputRowListPlusRawValues(
        inputRows,
        rawColumnsList,
        parseException
    );
  }

  private InputRowListPlusRawValues(
      @Nullable List<InputRow> inputRows,
      @Nullable List<Map<String, Object>> rawValues,
      @Nullable ParseException parseException
  )
  {
    this.inputRows = inputRows;
    this.rawValues = rawValues;
    this.parseException = parseException;
  }

  @Nullable
  public List<InputRow> getInputRows()
  {
    return inputRows;
  }

  /**
   * This method is left here only for test cases
   */
  @Nullable
  public Map<String, Object> getRawValues()
  {
    return CollectionUtils.isNullOrEmpty(rawValues) ? null : Iterables.getOnlyElement(rawValues);
  }

  public List<Map<String, Object>> getRawValuesList()
  {
    return rawValues;
  }

  @Nullable
  public ParseException getParseException()
  {
    return parseException;
  }
}


text:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<title>Using the GNU Compiler Collection (GCC): Bug Criteria</title>

<meta name="description" content="Using the GNU Compiler Collection (GCC): Bug Criteria">
<meta name="keywords" content="Using the GNU Compiler Collection (GCC): Bug Criteria">
<meta name="resource-type" content="document">
<meta name="distribution" content="global">
<meta name="Generator" content="makeinfo">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link href="index.html#Top" rel="start" title="Top">
<link href="Option-Index.html#Option-Index" rel="index" title="Option Index">
<link href="index.html#SEC_Contents" rel="contents" title="Table of Contents">
<link href="Bugs.html#Bugs" rel="up" title="Bugs">
<link href="Bug-Reporting.html#Bug-Reporting" rel="next" title="Bug Reporting">
<link href="Bugs.html#Bugs" rel="prev" title="Bugs">

Next: Bug Reporting, Up: Bugs   [Contents][Index]

12.1 Have You Found a Bug?

If you are not sure whether you have found a bug, here are some guidelines:

If the compiler gets a fatal signal, for any input whatever, that is a
compiler bug.  Reliable compilers never crash.

If the compiler produces invalid assembly code, for any input whatever
(except an asm statement), that is a compiler bug, unless the
compiler reports errors (not just warnings) which would ordinarily
prevent the assembler from being run.

If the compiler produces valid assembly code that does not correctly
execute the input source code, that is a compiler bug.

However, you must double-check to make sure, because you may have a
program whose behavior is undefined, which happened by chance to give
the desired results with another C or C++ compiler.

For example, in many nonoptimizing compilers, you can write ‘<samp>x;</samp>’
at the end of a function instead of ‘<samp>return x;</samp>’, with the same
results.  But the value of the function is undefined if return
is omitted; it is not a bug when GCC produces different results.

Problems often result from expressions with two increment operators,
as in f (*p++, *p++).  Your previous compiler might have
interpreted that expression the way you intended; GCC might
interpret it another way.  Neither compiler is wrong.  The bug is
in your code.

After you have localized the error to a single source line, it should
be easy to check for these things.  If your program is correct and
well defined, you have found a compiler bug.

 If the compiler produces an error message for valid input, that is a
compiler bug.

If the compiler does not produce an error message for invalid input,
that is a compiler bug.  However, you should note that your idea of
“invalid input” might be someone else’s idea of “an extension” or
“support for traditional practice”.

 If you are an experienced user of one of the languages GCC supports, your
suggestions for improvement of GCC are welcome in any case.

Next: Bug Reporting, Up: Bugs   [Contents][Index]


text:
<!doctype html>

	<meta charset="utf-8">
	<meta http-equiv="X-UA-Compatible" content="IE=edge">
	<title>catreact-html</title>
	<meta name="description" content="">
	<meta name="viewport" content="width=device-width, initial-scale=1">
	<link rel="stylesheet" href="assets/css/main.css">

						Search
						<input id="tsd-search-field" type="text" />

Preparing search index...

The search index is not available

					catreact-html

						Options

								All

Public

Public/Protected

All

							<input type="checkbox" id="tsd-filter-inherited" checked />
							Inherited
							<input type="checkbox" id="tsd-filter-externals" checked />
							Externals
							<input type="checkbox" id="tsd-filter-only-exported" />
							Only exported

					Menu

					Globals

 catreact-html

Index

External modules

"catreact-<wbr>html"

"ext/<wbr>CvCell<wbr>Value<wbr>Def"

"ext/<wbr>CvData<wbr>Anno"

"ext/<wbr>CvDetails<wbr>Panel"

"ext/<wbr>CvForm<wbr>Panel"

"ext/<wbr>CvGraph<wbr>Panel"

"ext/<wbr>CvGraphical<wbr>Workbench"

"ext/<wbr>CvGraphical<wbr>Workbench<wbr>Menu"

"ext/<wbr>CvGrid<wbr>Panel"

"ext/<wbr>CvHero<wbr>Header"

"ext/<wbr>CvHtml<wbr>Prop"

"ext/<wbr>CvHtml<wbr>Resource"

"ext/<wbr>CvImage"

"ext/<wbr>CvList<wbr>Panel"

"ext/<wbr>CvLogin<wbr>Panel"

"ext/<wbr>CvMap<wbr>Panel"

"ext/<wbr>CvMenu"

"ext/<wbr>CvMessage<wbr>Panel"

"ext/<wbr>CvNavigator"

"ext/<wbr>CvPrint<wbr>Panel"

"ext/<wbr>CvReact<wbr>Html"

"ext/<wbr>CvSearch<wbr>Panel"

"ext/<wbr>CvSignature<wbr>Popup"

"ext/<wbr>CvView<wbr>Menu"

"ext/<wbr>CvWeb<wbr>Navigator"

"ext/<wbr>CvWorkbench<wbr>Manager"

"ext/catreact-<wbr>html"

"ext/version"

						Globals

						Internals

						"catreact-<wbr>html"

						Externals

						"ext/<wbr>CvCell<wbr>Value<wbr>Def"

						"ext/<wbr>CvData<wbr>Anno"

						"ext/<wbr>CvDetails<wbr>Panel"

						"ext/<wbr>CvForm<wbr>Panel"

						"ext/<wbr>CvGraph<wbr>Panel"

						"ext/<wbr>CvGraphical<wbr>Workbench"

						"ext/<wbr>CvGraphical<wbr>Workbench<wbr>Menu"

						"ext/<wbr>CvGrid<wbr>Panel"

						"ext/<wbr>CvHero<wbr>Header"

						"ext/<wbr>CvHtml<wbr>Prop"

						"ext/<wbr>CvHtml<wbr>Resource"

						"ext/<wbr>CvImage"

						"ext/<wbr>CvList<wbr>Panel"

						"ext/<wbr>CvLogin<wbr>Panel"

						"ext/<wbr>CvMap<wbr>Panel"

						"ext/<wbr>CvMenu"

						"ext/<wbr>CvMessage<wbr>Panel"

						"ext/<wbr>CvNavigator"

						"ext/<wbr>CvPrint<wbr>Panel"

						"ext/<wbr>CvReact<wbr>Html"

						"ext/<wbr>CvSearch<wbr>Panel"

						"ext/<wbr>CvSignature<wbr>Popup"

						"ext/<wbr>CvView<wbr>Menu"

						"ext/<wbr>CvWeb<wbr>Navigator"

						"ext/<wbr>CvWorkbench<wbr>Manager"

						"ext/catreact-<wbr>html"

						"ext/version"

Legend

Module

Object literal

Variable

Function

Function with type parameter

Index signature

Type alias

Enumeration

Enumeration member

Property

Method

Interface

Interface with type parameter

Constructor

Property

Method

Index signature

Class

Class with type parameter

Constructor

Property

Method

Accessor

Index signature

Inherited constructor

Inherited property

Inherited method

Inherited accessor

Protected property

Protected method

Protected accessor

Private property

Private method

Private accessor

Static property

Static method

Generated using TypeDoc


text:
<!DOCTYPE html>

    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

    <title>mne.label_sign_flip — MNE 0.12.0 documentation</title>

    <link rel="stylesheet" href="../_static/basic.css" type="text/css" />
    <link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
    <link rel="stylesheet" href="../_static/gallery.css" type="text/css" />
    <link rel="stylesheet" href="../_static/bootswatch-3.3.4/flatly/bootstrap.min.css" type="text/css" />
    <link rel="stylesheet" href="../_static/bootstrap-sphinx.css" type="text/css" />
    <link rel="stylesheet" href="../_static/style.css" type="text/css" />

    <link rel="shortcut icon" href="../_static/favicon.ico"/>
    <link rel="top" title="MNE 0.12.0 documentation" href="../index.html" />
    <link rel="up" title="Python API Reference" href="../python_reference.html" />
    <link rel="next" title="mne.morph_data" href="mne.morph_data.html" />
    <link rel="prev" title="mne.grow_labels" href="mne.grow_labels.html" />

<link href='http://fonts.googleapis.com/css?family=Open+Sans:400italic,700italic,400,700' rel='stylesheet' type='text/css'>

  <link rel="canonical" href="https://mne.tools/stable/index.html" />

        <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".nav-collapse">

        </button>

        0.12.0

Get started

Tutorials

Gallery

API

Manual

FAQ

  Site

Getting started

Tutorials

Examples Gallery

Frequently Asked Questions

Contribute to MNE

Python API Reference

User Manual

What’s new

How to cite MNE

Related publications

Publications from MNE users

  Page

mne.label_sign_flip

<form class="navbar-form navbar-right" action="../search.html" method="get">

  <input type="text" name="q" class="form-control" placeholder="Search" />

  <input type="hidden" name="check_keywords" value="yes" />
  <input type="hidden" name="area" value="default" />
</form>

mne.label_sign_flip

    « mne.grow_labels

    mne.morph_data »

<form action="../search.html" method="get">

  <input type="text" name="q" class="form-control" placeholder="Search" />

  <input type="hidden" name="check_keywords" value="yes" />
  <input type="hidden" name="area" value="default" />
</form>

mne.label_sign_flip¶

mne.label_sign_flip(label, src)¶

Compute sign for label averaging

<col class="field-name" />
<col class="field-body" />

Parameters:
label : Label

A label.

src : list of dict

The source space over which the label is defined.

Returns:
flip : array

Sign flip vector (contains 1 or -1)

      Back to top

        © Copyright 2012-2016, MNE Developers. Last updated on 2016-05-10.


text:
var express = require('express');
var app = express();

var MongoClient = require('mongodb').MongoClient;

var places;

MongoClient.connect('mongodb://felipefontana.com.br:27017/hotzii', function (err, database) {

    if (err) {
        throw err;
    }

    places = database.collection('places');
});

app.use(function(req, res, next) {
  res.header("Access-Control-Allow-Origin", "*");
  res.header("Access-Control-Allow-Headers", "Origin, X-Requested-With, Content-Type, Accept");
  next();
});

app.get('/', function (req, res) {

    var message = `<p>Obter todos os bairros: <a href="/bairros/">/bairros/</a></p>` +
                  `<p>Obter rank dos bairros: <a href="/bairros/rank">/bairros/rank</a></p>` +
                  `<p>Obter bairros agrupados: <a href="/bairros/agrupados">/bairros/agrupados</a></p>` +
                  `<p>Obter bairros específicos: <a href="/bairros/pedra 90 i,cpa 3">/bairros/pedra 90 i,cpa 3</a></p>`;

    res.send(message);
});

app.get('/bairros/rank', function (req, res) {

    console.log('obtendo rank de bairros.');

    var result = places.aggregate([{ $group: { "_id": "$NM_BAIRRO", 'count': { $sum: 1 } } }, { $sort: { 'count': -1, '_id': 1 } }]);

    result.toArray(function (err, r) {
        return res.json(r);
    });
});

app.get('/bairros/agrupados', function (req, res) {

    console.log('obtendo bairros agrupados por nome.');

    var result = places.aggregate([{ $group: { "_id": "$NM_BAIRRO", 'count': { $sum: 1 } } }, { $sort: { '_id': 1 } }]);

    result.toArray(function (err, r) {
        return res.json(r);
    });
});

app.get('/bairros/:bairros?', function (req, res) {

    console.log('obtendo bairros.');

    var select = req.params.bairros || '' ;

    console.log(req.params);

    var where = {};

    if (select != '') {
        var bairros = select.toUpperCase().split(',');

        where = { 'NM_BAIRRO': { $in: bairros } };
    }

    var result = places.find(where, { 'RESULT': 0 });

    result.toArray(function (err, r) {

        return res.json(r);
    });
});

app.listen(8080, function () {
    console.log('Example app listening on port 8080!');
});