text:
<?php

/*
 * This file is part of the overtrue/wechat.
 *
 * (c) overtrue <i@overtrue.me>
 *
 * This source file is subject to the MIT license that is bundled
 * with this source code in the file LICENSE.
 */

use EasyWeChat\Stats\Stats;

class StatsStatsTest extends TestCase
{
    public function getStats()
    {
        $stats = Mockery::mock('EasyWeChat\Stats\Stats[parseJSON]', [Mockery::mock('EasyWeChat\Core\AccessToken')]);
        $stats->shouldReceive('parseJSON')->andReturnUsing(function ($method, $params) {
            return [
                'api' => $params[0],
                'params' => empty($params[1]) ? null : $params[1],
            ];
        });

        return $stats;
    }

    /**
     * Test userSummary().
     */
    public function testuserSummary()
    {
        $stats = $this->getStats();

        $result = $stats->userSummary(1, 2);
        $this->assertEquals(Stats::API_USER_SUMMARY, $result['api']);
        $this->assertEquals(['begin_date' => 1, 'end_date' => 2], $result['params']);
    }

    /**
     * Test userCumulate().
     */
    public function testuserCumulate()
    {
        $stats = $this->getStats();

        $result = $stats->userCumulate(1, 2);
        $this->assertEquals(Stats::API_USER_CUMULATE, $result['api']);
        $this->assertEquals(['begin_date' => 1, 'end_date' => 2], $result['params']);
    }

    /**
     * Test articleSummary().
     */
    public function testarticleSummary()
    {
        $stats = $this->getStats();

        $result = $stats->articleSummary(1, 2);
        $this->assertEquals(Stats::API_ARTICLE_SUMMARY, $result['api']);
        $this->assertEquals(['begin_date' => 1, 'end_date' => 2], $result['params']);
    }

    /**
     * Test articleTotal().
     */
    public function testarticleTotal()
    {
        $stats = $this->getStats();

        $result = $stats->articleTotal(1, 2);
        $this->assertEquals(Stats::API_ARTICLE_TOTAL, $result['api']);
        $this->assertEquals(['begin_date' => 1, 'end_date' => 2], $result['params']);
    }

    /**
     * Test userReadSummary().
     */
    public function testuserReadSummary()
    {
        $stats = $this->getStats();

        $result = $stats->userReadSummary(1, 2);
        $this->assertEquals(Stats::API_USER_READ_SUMMARY, $result['api']);
        $this->assertEquals(['begin_date' => 1, 'end_date' => 2], $result['params']);
    }

    /**
     * Test userReadHourly().
     */
    public function testuserReadHourly()
    {
        $stats = $this->getStats();

        $result = $stats->userReadHourly(1, 2);
        $this->assertEquals(Stats::API_USER_READ_HOURLY, $result['api']);
        $this->assertEquals(['begin_date' => 1, 'end_date' => 2], $result['params']);
    }

    /**
     * Test userShareSummary().
     */
    public function testuserShareSummary()
    {
        $stats = $this->getStats();

        $result = $stats->userShareSummary(1, 2);
        $this->assertEquals(Stats::API_USER_SHARE_SUMMARY, $result['api']);
        $this->assertEquals(['begin_date' => 1, 'end_date' => 2], $result['params']);
    }

    /**
     * Test userShareHourly().
     */
    public function testuserShareHourly()
    {
        $stats = $this->getStats();

        $result = $stats->userShareHourly(1, 2);
        $this->assertEquals(Stats::API_USER_SHARE_HOURLY, $result['api']);
        $this->assertEquals(['begin_date' => 1, 'end_date' => 2], $result['params']);
    }

    /**
     * Test upstreamMessageSummary().
     */
    public function testupstreamMessageSummary()
    {
        $stats = $this->getStats();

        $result = $stats->upstreamMessageSummary(1, 2);
        $this->assertEquals(Stats::API_UPSTREAM_MSG_SUMMARY, $result['api']);
        $this->assertEquals(['begin_date' => 1, 'end_date' => 2], $result['params']);
    }

    /**
     * Test upstreamMessageHourly().
     */
    public function testupstreamMessageHourly()
    {
        $stats = $this->getStats();

        $result = $stats->upstreamMessageHourly(1, 2);
        $this->assertEquals(Stats::API_UPSTREAM_MSG_HOURLY, $result['api']);
        $this->assertEquals(['begin_date' => 1, 'end_date' => 2], $result['params']);
    }

    /**
     * Test upstreamMessageWeekly().
     */
    public function testupstreamMessageWeekly()
    {
        $stats = $this->getStats();

        $result = $stats->upstreamMessageWeekly(1, 2);
        $this->assertEquals(Stats::API_UPSTREAM_MSG_WEEKLY, $result['api']);
        $this->assertEquals(['begin_date' => 1, 'end_date' => 2], $result['params']);
    }

    /**
     * Test upstreamMessageMonthly().
     */
    public function testupstreamMessageMonthly()
    {
        $stats = $this->getStats();

        $result = $stats->upstreamMessageMonthly(1, 2);
        $this->assertEquals(Stats::API_UPSTREAM_MSG_MONTHLY, $result['api']);
        $this->assertEquals(['begin_date' => 1, 'end_date' => 2], $result['params']);
    }

    /**
     * Test upstreamMessageDistSummary().
     */
    public function testupstreamMessageDistSummary()
    {
        $stats = $this->getStats();

        $result = $stats->upstreamMessageDistSummary(1, 2);
        $this->assertEquals(Stats::API_UPSTREAM_MSG_DIST_SUMMARY, $result['api']);
        $this->assertEquals(['begin_date' => 1, 'end_date' => 2], $result['params']);
    }

    /**
     * Test upstreamMessageDistWeekly().
     */
    public function testupstreamMessageDistWeekly()
    {
        $stats = $this->getStats();

        $result = $stats->upstreamMessageDistWeekly(1, 2);
        $this->assertEquals(Stats::API_UPSTREAM_MSG_DIST_WEEKLY, $result['api']);
        $this->assertEquals(['begin_date' => 1, 'end_date' => 2], $result['params']);
    }

    /**
     * Test upstreamMessageDistMonthly().
     */
    public function testupstreamMessageDistMonthly()
    {
        $stats = $this->getStats();

        $result = $stats->upstreamMessageDistMonthly(1, 2);
        $this->assertEquals(Stats::API_UPSTREAM_MSG_DIST_MONTHLY, $result['api']);
        $this->assertEquals(['begin_date' => 1, 'end_date' => 2], $result['params']);
    }

    /**
     * Test interfaceSummary().
     */
    public function testinterfaceSummary()
    {
        $stats = $this->getStats();

        $result = $stats->interfaceSummary(1, 2);
        $this->assertEquals(Stats::API_INTERFACE_SUMMARY, $result['api']);

        $this->assertEquals(['begin_date' => 1, 'end_date' => 2], $result['params']);
    }

    /**
     * Test interfaceSummaryHourly().
     */
    public function testinterfaceSummaryHourly()
    {
        $stats = $this->getStats();

        $result = $stats->interfaceSummaryHourly(1, 2);
        $this->assertEquals(Stats::API_INTERFACE_SUMMARY_HOURLY, $result['api']);

        $this->assertEquals(['begin_date' => 1, 'end_date' => 2], $result['params']);
    }

    //拉取卡券概况数据接口.
    public function testCardSummary()
    {
        $stats = $this->getStats();

        $beginDate = '2016-06-20';
        $endDate = '2016-06-28';
        $condSource = 1; //卡券来源,0为公众平台创建的卡券数据、1是API创建的卡券数据

        $result = $stats->cardSummary($beginDate, $endDate, $condSource);
        $this->assertStringStartsWith(Stats::API_CARD_SUMMARY, $result['api']);
        $this->assertEquals($beginDate, $result['params']['begin_date']);
        $this->assertEquals($endDate, $result['params']['end_date']);
        $this->assertEquals($condSource, $result['params']['cond_source']);
    }

    //获取免费券数据接口.
    public function testFreeCardSummary()
    {
        $stats = $this->getStats();

        $beginDate = '2016-06-20';
        $endDate = '2016-06-28';
        $condSource = 1; //卡券来源,0为公众平台创建的卡券数据、1是API创建的卡券数据
        $cardId = '';

        $result = $stats->freeCardSummary($beginDate, $endDate, $condSource, $cardId);
        $this->assertStringStartsWith(Stats::API_FREE_CARD_SUMMARY, $result['api']);
        $this->assertEquals($beginDate, $result['params']['begin_date']);
        $this->assertEquals($endDate, $result['params']['end_date']);
        $this->assertEquals($condSource, $result['params']['cond_source']);
        $this->assertEquals($cardId, $result['params']['card_id']);
    }

    //拉取会员卡数据接口.
    public function testMemberCardSummary()
    {
        $stats = $this->getStats();

        $beginDate = '2015-05-20';
        $endDate = '2015-07-20';
        $condSource = 1; //卡券来源,0为公众平台创建的卡券数据、1是API创建的卡券数据

        $result = $stats->memberCardSummary($beginDate, $endDate, $condSource);
        $this->assertStringStartsWith(Stats::API_MEMBER_CARD_SUMMARY, $result['api']);
        $this->assertEquals($beginDate, $result['params']['begin_date']);
        $this->assertEquals($endDate, $result['params']['end_date']);
        $this->assertEquals($condSource, $result['params']['cond_source']);
    }
}


text:
"""
Macro handling.

Macros are expanded on block-by-block
"""
from __future__ import absolute_import, print_function, division

# Expose the Macro object from the corresponding IR rewrite pass
from .rewrites.macros import Macro

redpajama_set_name: RedPajamaGithub


text:
classdef ImageHeader < handle

    properties

        version = uint16([]);                % First unsigned int indicates the version %
        data_type = uint16([]);              % e.g. unsigned short, float, complex float, etc. */
        flags = uint64([]);                  % bit field with flags %
        measurement_uid = uint32([]);        % Unique ID for the measurement %
        matrix_size = uint16([]);            % Pixels in the 3 spatial dimensions
        field_of_view = single([]);          % Size (in mm) of the 3 spatial dimensions %
        channels = uint16([]);               % Number of receive channels %
        position = single([]);               % Three-dimensional spatial offsets from isocenter %
        read_dir = single([]);               % Directional cosines of the readout/frequency encoding %
        phase_dir = single([]);              % Directional cosines of the phase encoding %
        slice_dir = single([]);              % Directional cosines of the slice %
        patient_table_position = single([]); % Patient table off-center %
        average = uint16([]);                % e.g. signal average number %
        slice = uint16([]);                  % e.g. imaging slice number %
        contrast = uint16([]);               % e.g. echo number in multi-echo %
        phase = uint16([]);                  % e.g. cardiac phase number %
        repetition = uint16([]);             % e.g. dynamic number for dynamic scanning %
        set = uint16([]);                    % e.g. flow encodning set %
        acquisition_time_stamp = uint32([]); % Acquisition clock %
        physiology_time_stamp = uint32([]);  % Physiology time stamps, e.g. ecg, breating, etc. %
        image_type = uint16([]);             % e.g. magnitude, phase, complex, real, imag, etc. %
        image_index = uint16([]);			 % e.g. image number in series of images  %
        image_series_index = uint16([]);     % e.g. series number %
        user_int = int32([]);                % Free user parameters %
        user_float = single([]);             % Free user parameters %
        attribute_string_len = uint32([]);

    end

    properties(Constant)
        FLAGS = struct( ...
            'IMAGE_IS_NAVIGATION_DATA',  1, ...
            'IMAGE_USER1',              57, ...
            'IMAGE_USER2',              58, ...
            'IMAGE_USER3',              59, ...
            'IMAGE_USER4',              60, ...
            'IMAGE_USER5',              61, ...
            'IMAGE_USER6',              62, ...
            'IMAGE_USER7',              63, ...
            'IMAGE_USER8',              64);

        DATA_TYPE = struct( ...
            'USHORT',   uint16(1), ...
            'SHORT',    uint16(2), ...
            'UINT',     uint16(3), ...
            'INT',      uint16(4), ...
            'FLOAT',    uint16(5), ...
            'DOUBLE',   uint16(6), ...
            'CXFLOAT',  uint16(7), ...
            'CXDOUBLE', uint16(8));

        IMAGE_TYPE = struct( ...
            'MAGNITUDE', uint16(1), ...
            'PHASE',     uint16(2), ...
            'REAL',      uint16(3), ...
            'IMAG',      uint16(4), ...
            'COMPLEX',   uint16(5));

    end

    methods

        function obj = ImageHeader(arg)
            switch nargin
                case 0
                    % No argument constructor
                    % initialize to a single image header
                    extend(obj,1);

                case 1
                    % One argument constructor
                    if isstruct(arg)
                        % plain struct
                        fromStruct(obj,arg);
                    elseif (length(arg)==1 && ismrmrd.util.isInt(arg)) == 1
                        % number
                        extend(obj,arg);
                    elseif isa(arg,'uint8')
                        % Byte array
                        fromBytes(obj,arg);
                    else
                        % Unknown type
                        error('Unknown argument type.')
                    end

                otherwise
                    error('Wrong number of arguments.')

            end
        end

        function nacq = getNumber(obj)
            nacq = length(obj.version);
        end

        function hdr = select(obj, range)
            % Return a copy of a range of image headers

            % create an empty image header
            M = length(range);
            hdr = ismrmrd.ImageHeader(M);

            % Fill
            hdr.version = obj.version(range);
            hdr.flags = obj.flags(range);
            hdr.measurement_uid = obj.measurement_uid(range);
            hdr.matrix_size = obj.matrix_size(:,range);
            hdr.field_of_view = obj.field_of_view(:,range);
            hdr.channels = obj.channels(:,range);
            hdr.position = obj.position(:,range);
            hdr.read_dir = obj.read_dir(:,range);
            hdr.phase_dir = obj.phase_dir(:,range);
            hdr.slice_dir = obj.slice_dir(:,range);
            hdr.patient_table_position = obj.patient_table_position(:,range);
            hdr.average = obj.average(range);
            hdr.slice = obj.slice(range);
            hdr.contrast = obj.contrast(range);
            hdr.phase = obj.phase(range);
            hdr.repetition = obj.repetition(range);
            hdr.set = obj.set(range);
            hdr.acquisition_time_stamp = obj.acquisition_time_stamp(range);
            hdr.physiology_time_stamp = obj.physiology_time_stamp(:,range);
            hdr.data_type = obj.data_type(range);
            hdr.image_type = obj.image_type(range);
            hdr.image_index = obj.image_index(range);
            hdr.image_series_index = obj.image_series_index(range);
            hdr.user_int = obj.user_int(:,range);
            hdr.user_float = obj.user_float(:,range);
            hdr.attribute_string_len = obj.attribute_string_len(:,range);

        end

        function extend(obj,N)
            % Extend with blank header

            range = obj.getNumber + (1:N);
            obj.version(1,range)                  = zeros(1,N,'uint16');
            obj.flags(1,range)                    = zeros(1,N,'uint64');
            obj.measurement_uid(1,range)          = zeros(1,N,'uint32');
            obj.matrix_size(1:3,range)            = zeros(3,N,'uint16');
            obj.field_of_view(1:3,range)          = zeros(3,N,'single');
            obj.channels(1,range)                 = zeros(1,N,'uint16');
            obj.position(1:3,range)               = zeros(3,N,'single');
            obj.read_dir(1:3,range)               = zeros(3,N,'single');
            obj.phase_dir(1:3,range)              = zeros(3,N,'single');
            obj.slice_dir(1:3,range)              = zeros(3,N,'single');
            obj.patient_table_position(1:3,range) = zeros(3,N,'single');
            obj.average(1,range)                  = zeros(1,N,'uint16');
            obj.slice(1,range)                    = zeros(1,N,'uint16');
            obj.contrast(1,range)                 = zeros(1,N,'uint16');
            obj.phase(1,range)                    = zeros(1,N,'uint16');
            obj.repetition(1,range)               = zeros(1,N,'uint16');
            obj.set(1,range)                      = zeros(1,N,'uint16');
            obj.acquisition_time_stamp(1,range)   = zeros(1,N,'uint32');
            obj.physiology_time_stamp(1:3,range)  = zeros(3,N,'uint32');
            obj.data_type(1,range)                = zeros(1,N,'uint16');
            obj.image_type(1,range)               = zeros(1,N,'uint16');
            obj.image_index(1,range)              = zeros(1,N,'uint16');
            obj.image_series_index(1,range)       = zeros(1,N,'uint16');
            obj.user_int(1:8,range)               = zeros(8,N,'int32');
            obj.user_float(1:8,range)             = zeros(8,N,'single');
            obj.attribute_string_len              = zeros(1,N,'uint32');
        end

        function append(obj, head)
            Nstart = obj.getNumber + 1;
            Nend   = obj.getNumber + length(head.version);
            Nrange = Nstart:Nend;
            obj.version(Nrange) = hdr.version;
            obj.flags(Nrange) = hdr.flags;
            obj.measurement_uid(Nrange) = hdr.measurement_uid;
            obj.matrix_size(:,Nrange) = hdr.matrix_size;
            obj.field_of_view(:,Nrange) = hdr.field_of_view;
            obj.channels(Nrange) = hdr.channels;
            obj.position(:,Nrange) = hdr.position;
            obj.read_dir(:,Nrange) = hdr.read_dir;
            obj.phase_dir(:,Nrange) = hdr.phase_dir;
            obj.slice_dir(:,Nrange) = hdr.slice_dir;
            obj.patient_table_position(:,Nrange) = hdr.patient_table_position;
            obj.average(Nrange) = hdr.average;
            obj.slice(Nrange) = hdr.slice;
            obj.contrast(Nrange) = hdr.contrast;
            obj.phase(Nrange) = hdr.phase;
            obj.repetition(Nrange) = hdr.repetition;
            obj.set(Nrange) = hdr.set;
            obj.acquisition_time_stamp(Nrange) = hdr.acquisition_time_stamp;
            obj.physiology_time_stamp(:,Nrange) = hdr.physiology_time_stamp;
            obj.data_type(Nrange) = hdr.data_type;
            obj.image_type(Nrange) = hdr.image_type;
            obj.image_index(Nrange) = hdr.image_index;
            obj.image_series_index(Nrange) = hdr.image_series_index;
            obj.user_int(:,Nrange) = hdr.user_int;
            obj.user_float(:,Nrange) = hdr.user_float;
            obj.attribute_string_len(Nrange) = hdr.attribute_string_len;

        end

        function fromStruct(obj, hdr)
            %warning! no error checking
            obj.version = hdr.version;
            obj.flags = hdr.flags;
            obj.measurement_uid = hdr.measurement_uid;
            obj.matrix_size = hdr.matrix_size;
            obj.field_of_view = hdr.field_of_view;
            obj.channels = hdr.channels;
            obj.position = hdr.position;
            obj.read_dir = hdr.read_dir;
            obj.phase_dir = hdr.phase_dir;
            obj.slice_dir = hdr.slice_dir;
            obj.patient_table_position = hdr.patient_table_position;
            obj.average = hdr.average;
            obj.slice = hdr.slice;
            obj.contrast = hdr.contrast;
            obj.phase = hdr.phase;
            obj.repetition = hdr.repetition;
            obj.set = hdr.set;
            obj.acquisition_time_stamp = hdr.acquisition_time_stamp;
            obj.physiology_time_stamp = hdr.physiology_time_stamp;
            obj.data_type = hdr.data_type;
            obj.image_type = hdr.image_type;
            obj.image_index = hdr.image_index;
            obj.image_series_index = hdr.image_series_index;
            obj.user_int = hdr.user_int;
            obj.user_float = hdr.user_float;
            obj.attribute_string_len = hdr.attribute_string_len;
        end

        function hdr = toStruct(obj)
            %warning! no error checking
            hdr = struct();
            hdr.version = obj.version;
            hdr.flags = obj.flags;
            hdr.measurement_uid = obj.measurement_uid;
            hdr.matrix_size = obj.matrix_size;
            hdr.field_of_view = obj.field_of_view;
            hdr.channels = obj.channels;
            hdr.position = obj.position;
            hdr.read_dir = obj.read_dir;
            hdr.phase_dir = obj.phase_dir;
            hdr.slice_dir = obj.slice_dir;
            hdr.patient_table_position = obj.patient_table_position;
            hdr.average = obj.average;
            hdr.slice = obj.slice;
            hdr.contrast = obj.contrast;
            hdr.phase = obj.phase;
            hdr.repetition = obj.repetition;
            hdr.set = obj.set;
            hdr.acquisition_time_stamp = obj.acquisition_time_stamp;
            hdr.physiology_time_stamp = obj.physiology_time_stamp;
            hdr.data_type = obj.data_type;
            hdr.image_type = obj.image_type;
            hdr.image_index = obj.image_index;
            hdr.image_series_index = obj.image_series_index;
            hdr.user_int = obj.user_int;
            hdr.user_float = obj.user_float;
            hdr.attribute_string_len = obj.attribute_string_len;
        end

        function fromBytes(obj, bytearray)
            % Convert from a byte array to an ISMRMRD ImageHeader
	    % This conforms to the memory layout of the C-struct
            if size(bytearray,1) ~= 198
                error('Wrong number of bytes for ImageHeader.')
            end
            N = size(bytearray,2);
            for p = 1:N
                obj.version(p)                  = typecast(bytearray(1:2,p),     'uint16');
                obj.data_type(p)                = typecast(bytearray(3:4,p), 'uint16');
                obj.flags(p)                    = typecast(bytearray(5:12,p),    'uint64');
                obj.measurement_uid(p)          = typecast(bytearray(13:16,p),   'uint32');
                obj.matrix_size(:,p)            = typecast(bytearray(17:22,p),   'uint16');
                obj.field_of_view(:,p)          = typecast(bytearray(23:34,p),   'single');
                obj.channels(p)                 = typecast(bytearray(35:36,p),   'uint16');
                obj.position(:,p)               = typecast(bytearray(37:48,p),   'single');
                obj.read_dir(:,p)               = typecast(bytearray(49:60,p),   'single');
                obj.phase_dir(:,p)              = typecast(bytearray(61:72,p),   'single');
                obj.slice_dir(:,p)              = typecast(bytearray(73:84,p),   'single');
                obj.patient_table_position(:,p) = typecast(bytearray(85:96,p),   'single');
                obj.average(p)                  = typecast(bytearray(97:98,p),   'uint16');
                obj.slice(p)                    = typecast(bytearray(99:100,p),   'uint16');
                obj.contrast(p)                 = typecast(bytearray(101:102,p),  'uint16');
                obj.phase(p)                    = typecast(bytearray(103:104,p), 'uint16');
                obj.repetition(p)               = typecast(bytearray(105:106,p), 'uint16');
                obj.set(p)                      = typecast(bytearray(107:108,p), 'uint16');
                obj.acquisition_time_stamp(p)   = typecast(bytearray(109:112,p), 'uint32');
                obj.physiology_time_stamp(:,p)  = typecast(bytearray(113:124,p), 'uint32');
                obj.image_type(p)               = typecast(bytearray(125:126,p), 'uint16');
                obj.image_index(p)              = typecast(bytearray(127:128,p), 'uint16');
                obj.image_series_index(p)       = typecast(bytearray(129:130,p), 'uint16');
                obj.user_int(:,p)               = typecast(bytearray(131:162,p), 'uint32');
                obj.user_float(:,p)             = typecast(bytearray(163:194,p), 'single');
                obj.attribute_string_len        = typecast(bytearray(195:198,p), 'uint32');

            end
        end

        function bytes = toBytes(obj)
            % Convert an ISMRMRD AcquisitionHeader to a byte array
	    % This conforms to the memory layout of the C-struct

            N = obj.getNumber;
            bytes = zeros(198,N,'uint8');
            for p = 1:N
                off = 1;
                bytes(off:off+1,p)   = typecast(obj.version(p)                 ,'uint8'); off=off+2;
                bytes(off:off+1,p)   = typecast(obj.data_type(p)               ,'uint8'); off=off+2;
                bytes(off:off+7,p)   = typecast(obj.flags(p)                   ,'uint8'); off=off+8;
                bytes(off:off+3,p)   = typecast(obj.measurement_uid(p)         ,'uint8'); off=off+4;
                bytes(off:off+5,p)   = typecast(obj.matrix_size(:,p)           ,'uint8'); off=off+6;
                bytes(off:off+11,p)  = typecast(obj.field_of_view(:,p)         ,'uint8'); off=off+12;
                bytes(off:off+1,p)   = typecast(obj.channels(p)                ,'uint8'); off=off+2;
                bytes(off:off+11,p)  = typecast(obj.position(:,p)              ,'uint8'); off=off+12;
                bytes(off:off+11,p)  = typecast(obj.read_dir(:,p)              ,'uint8'); off=off+12;
                bytes(off:off+11,p)  = typecast(obj.phase_dir(:,p)             ,'uint8'); off=off+12;
                bytes(off:off+11,p)  = typecast(obj.slice_dir(:,p)             ,'uint8'); off=off+12;
                bytes(off:off+11,p)  = typecast(obj.patient_table_position(:,p),'uint8'); off=off+12;
                bytes(off:off+1,p)   = typecast(obj.average(p)                 ,'uint8'); off=off+2;
                bytes(off:off+1,p)   = typecast(obj.slice(p)                   ,'uint8'); off=off+2;
                bytes(off:off+1,p)   = typecast(obj.contrast(p)                ,'uint8'); off=off+2;
                bytes(off:off+1,p)   = typecast(obj.phase(p)                   ,'uint8'); off=off+2;
                bytes(off:off+1,p)   = typecast(obj.repetition(p)              ,'uint8'); off=off+2;
                bytes(off:off+1,p)   = typecast(obj.set(p)                     ,'uint8'); off=off+2;
                bytes(off:off+3,p)   = typecast(obj.acquisition_time_stamp(p)  ,'uint8'); off=off+4;

                bytes(off:off+11,p)  = typecast(obj.physiology_time_stamp(:,p) ,'uint8'); off=off+12;

                bytes(off:off+1,p)   = typecast(obj.image_type(p)              ,'uint8'); off=off+2;
                bytes(off:off+1,p)   = typecast(obj.image_index(p)             ,'uint8'); off=off+2;
                bytes(off:off+1,p)   = typecast(obj.image_series_index(p)      ,'uint8'); off=off+2;
                bytes(off:off+31,p)  = typecast(obj.user_int(:,p)              ,'uint8'); off=off+32;
                bytes(off:off+31,p)  = typecast(obj.user_float(:,p)            ,'uint8'); off=off+32;
                bytes(off:off+3,p)  = typecast(obj.attribute_string_len(:,p)   ,'uint8');

            end
        end

        function obj = check(obj)
            % Check and fix the obj types

            % Check the number of elements for each entry
            N = obj.getNumber();
            if (size(obj.flags) ~= N)
                error('Size of flags is not correct.');
            end
            if ((size(obj.measurement_uid,1) ~= 1) || ...
                (size(obj.measurement_uid,2) ~= N))
                error('Size of measurement_uid is not correct.');
            end
            if ((size(obj.matrix_size,1) ~= 3) || ...
                (size(obj.matrix_size,2) ~= N))
                error('Size of matrix_size is not correct.');
            end
            if ((size(obj.field_of_view,1) ~= 3) || ...
                (size(obj.field_of_view,2) ~= N))
                error('Size of field_of_view is not correct.');
            end
            if ((size(obj.channels,1) ~= 1) || ...
                (size(obj.channels,2) ~= N))
                error('Size of field_of_view is not correct.');
            end
            if ((size(obj.position,1) ~= 3) || ...
                (size(obj.position,2) ~= N))
                error('Size of position is not correct.');
            end
            if ((size(obj.read_dir,1) ~= 3) || ...
                (size(obj.read_dir,2) ~= N))
                error('Size of read_dir is not correct.');
            end
            if ((size(obj.phase_dir,1) ~= 3) || ...
                (size(obj.phase_dir,2) ~= N))
                error('Size of phase_dir is not correct.');
            end
            if ((size(obj.slice_dir,1) ~= 3) || ...
                (size(obj.slice_dir,2) ~= N))
                error('Size of slice_dir is not correct.');
            end
            if ((size(obj.patient_table_position,1) ~= 3) || ...
                (size(obj.patient_table_position,2) ~= N))
                error('Size of patient_table_position is not correct.');
            end
            if ((size(obj.average,1) ~= 1) || ...
                (size(obj.average,2) ~= N))
                error('Size of average is not correct.');
            end
            if ((size(obj.slice,1) ~= 1) || ...
                (size(obj.slice,2) ~= N))
                error('Size of slice is not correct.');
            end
            if ((size(obj.contrast,1) ~= 1) || ...
                (size(obj.contrast,2) ~= N))
                error('Size of contrast is not correct.');
            end
            if ((size(obj.phase,1) ~= 1) || ...
                (size(obj.phase,2) ~= N))
                error('Size of phase is not correct.');
            end
            if ((size(obj.repetition,1) ~= 1) || ...
                (size(obj.repetition,2) ~= N))
                error('Size of repetition is not correct.');
            end
            if ((size(obj.set,1) ~= 1) || ...
                (size(obj.set,2) ~= N))
                error('Size of set is not correct.');
            end
            if ((size(obj.acquisition_time_stamp,1) ~= 1) || ...
                (size(obj.acquisition_time_stamp,2) ~= N))
                error('Size of acquisition_time_stamp is not correct.');
            end
            if ((size(obj.physiology_time_stamp,1) ~= 3) || ...
                (size(obj.physiology_time_stamp,2) ~= N))
                error('Size of physiology_time_stamp is not correct.');
            end
            if ((size(obj.data_type,1) ~= 1) || ...
                (size(obj.data_type,2) ~= N))
                error('Size of image_data_type is not correct.');
            end
            if ((size(obj.image_type,1) ~= 1) || ...
                (size(obj.image_type,2) ~= N))
                error('Size of image_type is not correct.');
            end
            if ((size(obj.image_index,1) ~= 1) || ...
                (size(obj.image_index,2) ~= N))
                error('Size of image_index is not correct.');
            end
            if ((size(obj.image_series_index,1) ~= 1) || ...
                (size(obj.image_series_index,2) ~= N))
                error('Size of image_series_index is not correct.');
            end
            if ((size(obj.user_int,1) ~= 8) || ...
                (size(obj.user_int,2) ~= N))
                error('Size of user_int is not correct.');
            end
            if ((size(obj.user_float,1) ~= 8) || ...
                (size(obj.user_float,2) ~= N))
                error('Size of user_float is not correct.');
            end

            % Fix the type of all the elements
            obj.version = uint16(obj.version);
            obj.flags = uint64(obj.flags);
            obj.measurement_uid = uint32(obj.measurement_uid);
            obj.matrix_size = uint16(obj.matrix_size);
            obj.field_of_view = single(obj.field_of_view);
            obj.channels = uint16(obj.channels);
            obj.position = single(obj.position);
            obj.read_dir = single(obj.read_dir);
            obj.phase_dir = single(obj.phase_dir);
            obj.slice_dir = single(obj.slice_dir);
            obj.patient_table_position = single(obj.patient_table_position);
            obj.average = uint16(obj.average);
            obj.slice = uint16(obj.slice);
            obj.contrast = uint16(obj.contrast);
            obj.phase = uint16(obj.phase);
            obj.repetition = uint16(obj.repetition);
            obj.set = uint16(obj.set);
            obj.acquisition_time_stamp = uint32(obj.acquisition_time_stamp);
            obj.physiology_time_stamp = uint32(obj.physiology_time_stamp);
            obj.data_type = uint16(obj.data_type);
            obj.image_type = uint16(obj.image_type);
            obj.image_index = uint16(obj.image_index);
            obj.image_series_index = uint16(obj.image_series_index);
            obj.user_int = int32(obj.user_int);
            obj.user_float = single(obj.user_float);
            obj.attribute_string_len = uint32(obj.attribute_string_len);

        end

        function ret = flagIsSet(obj, flag, range)
            if nargin < 3
                range = 1:obj.getNumber;
            end
            if isa(flag, 'char')
                b = obj.FLAGS.(flag);
            elseif (flag>0)
                b = uint64(flag);
            else
                error('Flag is of the wrong type.');
            end
            bitmask = bitshift(uint64(1),(b-1));
            ret = zeros(size(range));
            for p = 1:length(range)
                ret(p) = (bitand(obj.flags(range(p)), bitmask)>0);
            end
        end

        function flagSet(obj, flag, range)
            if nargin < 3
                range = 1:obj.getNumber;
            end
            if isa(flag, 'char')
                b = obj.FLAGS.(flag);
            elseif (flag>0)
                b = uint64(flag);
            else
                error('Flag is of the wrong type.');
            end
            bitmask = bitshift(uint64(1),(b-1));

            alreadyset = obj.flagIsSet(flag,range);
            for p = 1:length(range)
                if ~alreadyset(p)
                    obj.flags(range(p)) = obj.flags(range(p)) + bitmask;
                end
            end
        end

        function flagClear(obj, flag, range)
            if nargin < 3
                range = 1:obj.getNumber;
            end

            if isa(flag, 'char')
                b = obj.FLAGS.(flag);
            elseif (flag>0)
                b = uint64(flag);
            else
                error('Flag is of the wrong type.');
            end
            bitmask = bitshift(uint64(1),(b-1));

            alreadyset = obj.flagIsSet(flag,range);
            for p = 1:length(range)
                if alreadyset(p)
                    obj.flags(range(p)) = obj.flags(range(p)) - bitmask;
                end
            end

        end

    end

end


text:
/// Copyright (c) 2012 Ecma International.  All rights reserved.
/// Ecma International makes this code available under the terms and conditions set
/// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the
/// "Use Terms").   Any redistribution of this code must retain the above
/// copyright and this notice and otherwise comply with the Use Terms.
/**
 * @path ch15/15.4/15.4.4/15.4.4.22/15.4.4.22-3-23.js
 * @description Array.prototype.reduceRight uses inherited valueOf method when 'length' is an object with an own toString and inherited valueOf methods
 */

function testcase() {

        var testResult1 = true;
        var testResult2 = false;
        var valueOfAccessed = false;
        var toStringAccessed = false;

        var proto = {
            valueOf: function () {
                valueOfAccessed = true;
                return 2;
            }
        };
        var Con = function () { };
        Con.prototype = proto;
        var child = new Con();

        function callbackfn(prevVal, curVal, idx, obj) {
            if (idx > 1) {
                testResult1 = false;
            }

            if (idx === 1) {
                testResult2 = true;
            }
            return false;
        }

        child.toString = function () {
            toStringAccessed = true;
            return '1';
        };

        var obj = {
            0: 12,
            1: 11,
            2: 9,
            length: child
        };

        Array.prototype.reduceRight.call(obj, callbackfn, 1);
        return testResult1 && testResult2 && valueOfAccessed && !toStringAccessed;
    }
runTestCase(testcase);


text:
types:
  - string
  - conditions
id: 02db0ee5-585b-4e40-ab2b-f15a596b341c
---
Returns `true` if variable is a number or numeric string.

```.language-yaml
sequence: 4815162342
another_sequence: just type 4 8 15 16 23 42
```

```
{{ if sequence | is_numeric }}
{{ if another_sequence | is_numeric }}
```

```.language-output
true
false
```


text:
using System.Collections.Generic;
using Antlr4.Runtime;
using Spect.Net.EvalParser.SyntaxTree;

// ReSharper disable once CheckNamespace
namespace Spect.Net.EvalParser.Generated
{
    public partial class Z80EvalParser
    {
        ///
        /// Syntax errors caught during the parsing phase
        ///
        public List<Z80EvalParserErrorInfo> SyntaxErrors { get; } = new List<Z80EvalParserErrorInfo>();

        /// Resets the parser's state
        public override void Reset()
        {
            base.Reset();
            RemoveErrorListeners();
            AddErrorListener(new Z80TestErrorListener(this));
        }

        private class Z80TestErrorListener : IAntlrErrorListener<IToken>
        {
            ///
            /// The parser that utilizes this error listener
            ///
            private Z80EvalParser Parser { get; }

            /// Initializes a new instance of the <see cref="T:System.Object" /> class.
            public Z80TestErrorListener(Z80EvalParser parser)
            {
                Parser = parser;
            }

            /// Upon syntax error, notify any interested parties.
            /// <remarks>
            /// Upon syntax error, notify any interested parties. This is not how to
            /// recover from errors or compute error messages.
            /// <see cref="T:Antlr4.Runtime.IAntlrErrorStrategy" />
            /// specifies how to recover from syntax errors and how to compute error
            /// messages. This listener's job is simply to emit a computed message,
            /// though it has enough information to create its own message in many cases.
            ///
The
            /// <see cref="T:Antlr4.Runtime.RecognitionException" />
            /// is non-null for all syntax errors except
            /// when we discover mismatched token errors that we can recover from
            /// in-line, without returning from the surrounding rule (via the single
            /// token insertion and deletion mechanism).

            /// </remarks>
            /// <param name="recognizer">
            /// What parser got the error. From this
            /// object, you can access the context as well
            /// as the input stream.
            /// </param>
            /// <param name="offendingSymbol">
            /// The offending token in the input token
            /// stream, unless recognizer is a lexer (then it's null). If
            /// no viable alternative error,
            /// <paramref name="e" />
            /// has token at which we
            /// started production for the decision.
            /// </param>
            /// <param name="line">The line number in the input where the error occurred.</param>
            /// <param name="charPositionInLine">The character position within that line where the error occurred.</param>
            /// <param name="msg">The message to emit.</param>
            /// <param name="e">
            /// The exception generated by the parser that led to
            /// the reporting of an error. It is null in the case where
            /// the parser was able to recover in line without exiting the
            /// surrounding rule.
            /// </param>
            public void SyntaxError(IRecognizer recognizer, IToken offendingSymbol, int line, int charPositionInLine, string msg,
                RecognitionException e)
            {
                Parser.SyntaxErrors.Add(new Z80EvalParserErrorInfo
                {
                    Position = charPositionInLine,
                    Token = offendingSymbol.Text,
                    ParserException = e
                });
            }
        }
    }
}


text:
package org.batfish.collections;

import java.util.TreeMap;

public class PredicateSemantics extends TreeMap<String, String> {

   private static final long serialVersionUID = 1L;

}


text:
package org.apache.accumulo.examples.twitter;

import java.io.FileNotFoundException;
import java.io.IOException;
import org.apache.accumulo.core.client.AccumuloException;
import org.apache.accumulo.core.client.AccumuloSecurityException;
import org.apache.accumulo.core.client.Connector;
import org.apache.accumulo.core.client.TableNotFoundException;
import org.apache.accumulo.core.client.ZooKeeperInstance;
import org.apache.accumulo.core.client.security.tokens.PasswordToken;
import org.apache.accumulo.examples.util.MiniAccumulo;
import org.apache.accumulo.examples.schema.SchemaQueryClient;
import org.apache.accumulo.examples.twitter.TweetSchema.TwitterUser;
import org.apache.log4j.Level;
import org.apache.log4j.Logger;

public class TwitterQueryApp {

	public static void main(String[] args) throws AccumuloException, AccumuloSecurityException, TableNotFoundException, FileNotFoundException, IOException {

		Logger.getRootLogger().setLevel(Level.WARN);

		System.out.println("connecting ...");
		ZooKeeperInstance instance = new ZooKeeperInstance("miniInstance", MiniAccumulo.getZooHost());
		Connector conn = instance.getConnector("root", new PasswordToken("password"));
		String[] auths = new String[0]; // no authorizations needed

		SchemaQueryClient<TwitterUser> client = new SchemaQueryClient<>(conn, "twitter", "twitterIndex", TwitterUserQuerySchema.getInstance());

		// lookup all users with usernames beginning with 'a'
		System.out.println("===== usernames beginning with 'jo' =====");
		Iterable<TwitterUser> results = client.wildcardObjectLookup("jo", auths);

		for(TwitterUser user : results) {
			System.out.println(user.name);
		}

		// index lookup for tweets containing a word
		System.out.println("===== tweets containing the word 'today' in 'text' field =====");
		results = client.indexLookup("today", "text", auths);
		for(TwitterUser user : results) {
			System.out.println(user);
		}
	}
}


text:
package core.adapt.iterator;

import com.google.common.io.ByteStreams;
import core.adapt.Query;
import org.apache.hadoop.io.Text;

import java.io.DataInput;
import java.io.DataOutput;
import java.io.IOException;
import java.io.Serializable;

public class PostFilterIterator extends PartitionIterator implements
        Serializable {
    private static final long serialVersionUID = 1L;

    public PostFilterIterator() {

    }

    public PostFilterIterator(Query q) {
        super(q);
    }

    public PostFilterIterator(String iteratorString) {
        try {
            readFields(ByteStreams.newDataInput(iteratorString.getBytes()));
        } catch (IOException e) {
            e.printStackTrace();
            throw new RuntimeException("Failed to read the fields");
        }
    }

    public static PostFilterIterator read(DataInput in) throws IOException {
        PostFilterIterator it = new PostFilterIterator();
        it.readFields(in);
        return it;
    }

    @Override
    protected boolean isRelevant(IteratorRecord record) {
        // return query.qualifies(record);
        return query.qualifies(record);
    }

    @Override
    public void write(DataOutput out) throws IOException {
        query.write(out);
    }

    @Override
    public void readFields(DataInput in) throws IOException {
        String predicateString = Text.readString(in);
        query = new Query(predicateString);
    }
}


text:
import * as pointer from 'json-pointer'
import { CustomError } from 'ts-custom-error'

export default abstract class JsonStrictifyError extends CustomError {
    public readonly references: string[]
    public readonly path: string

    public constructor(message: string, references: string[]) {
        super(message)

        this.path = pointer.compile(references)
        this.references = references
    }
}


text:
namespace Apache.Ignite.Core.Discovery.Tcp
{
    using System;
    using System.ComponentModel;
    using Apache.Ignite.Core.Binary;
    using Apache.Ignite.Core.Impl.Binary;

    /// <summary>
    /// TCP discover service provider.
    /// </summary>
    public class TcpDiscoverySpi : IDiscoverySpi
    {
        /// <summary>
        /// Default socket timeout.
        /// </summary>
        public static readonly TimeSpan DefaultSocketTimeout = TimeSpan.FromMilliseconds(5000);

        /// <summary>
        /// Default acknowledgement timeout.
        /// </summary>
        public static readonly TimeSpan DefaultAckTimeout = TimeSpan.FromMilliseconds(5000);

        /// <summary>
        /// Default maximum acknowledgement timeout.
        /// </summary>
        public static readonly TimeSpan DefaultMaxAckTimeout = TimeSpan.FromMinutes(10);

        /// <summary>
        /// Default network timeout.
        /// </summary>
        public static readonly TimeSpan DefaultNetworkTimeout = TimeSpan.FromMilliseconds(5000);

        /// <summary>
        /// Default join timeout.
        /// </summary>
        public static readonly TimeSpan DefaultJoinTimeout = TimeSpan.Zero;

        /// <summary>
        /// Default value for the <see cref="ReconnectCount"/> property.
        /// </summary>
        public const int DefaultReconnectCount = 10;

        /// <summary>
        /// Default value for the <see cref="LocalPort"/> property.
        /// </summary>
        public const int DefaultLocalPort = 47500;

        /// <summary>
        /// Default value for the <see cref="LocalPortRange"/> property.
        /// </summary>
        public const int DefaultLocalPortRange = 100;

        /// <summary>
        /// Default value for the <see cref="IpFinderCleanFrequency"/> property.
        /// </summary>
        public static readonly TimeSpan DefaultIpFinderCleanFrequency = TimeSpan.FromSeconds(60);

        /// <summary>
        /// Default value for the <see cref="ThreadPriority"/> property.
        /// </summary>
        public const int DefaultThreadPriority = 10;

        /// <summary>
        /// Default value for the <see cref="TopologyHistorySize"/> property.
        /// </summary>
        public const int DefaultTopologyHistorySize = 1000;

        /// <summary>
        /// Initializes a new instance of the <see cref="TcpDiscoverySpi"/> class.
        /// </summary>
        public TcpDiscoverySpi()
        {
            SocketTimeout = DefaultSocketTimeout;
            AckTimeout = DefaultAckTimeout;
            MaxAckTimeout = DefaultMaxAckTimeout;
            NetworkTimeout = DefaultNetworkTimeout;
            JoinTimeout = DefaultJoinTimeout;
            ReconnectCount = DefaultReconnectCount;
            LocalPort = DefaultLocalPort;
            LocalPortRange = DefaultLocalPortRange;
            IpFinderCleanFrequency = DefaultIpFinderCleanFrequency;
            ThreadPriority = DefaultThreadPriority;
            TopologyHistorySize = DefaultTopologyHistorySize;
        }

        /// <summary>
        /// Initializes a new instance of the <see cref="TcpDiscoverySpi"/> class.
        /// </summary>
        /// <param name="reader">The reader.</param>
        internal TcpDiscoverySpi(IBinaryRawReader reader)
        {
            IpFinder = reader.ReadBoolean() ? TcpDiscoveryIpFinderBase.ReadInstance(reader) : null;

            SocketTimeout = reader.ReadLongAsTimespan();
            AckTimeout = reader.ReadLongAsTimespan();
            MaxAckTimeout = reader.ReadLongAsTimespan();
            NetworkTimeout = reader.ReadLongAsTimespan();
            JoinTimeout = reader.ReadLongAsTimespan();

            ForceServerMode = reader.ReadBoolean();
            ClientReconnectDisabled = reader.ReadBoolean();
            LocalAddress = reader.ReadString();
            ReconnectCount = reader.ReadInt();
            LocalPort = reader.ReadInt();
            LocalPortRange = reader.ReadInt();
            StatisticsPrintFrequency = reader.ReadLongAsTimespan();
            IpFinderCleanFrequency = reader.ReadLongAsTimespan();
            ThreadPriority = reader.ReadInt();
            TopologyHistorySize = reader.ReadInt();
        }

        /// <summary>
        /// Gets or sets the IP finder which defines how nodes will find each other on the network.
        /// </summary>
        public ITcpDiscoveryIpFinder IpFinder { get; set; }

        /// <summary>
        /// Gets or sets the socket timeout.
        /// </summary>
        [DefaultValue(typeof(TimeSpan), "00:00:05")]
        public TimeSpan SocketTimeout { get; set; }

        /// <summary>
        /// Gets or sets the timeout for receiving acknowledgement for sent message.
        /// </summary>
        [DefaultValue(typeof(TimeSpan), "00:00:05")]
        public TimeSpan AckTimeout { get; set; }

        /// <summary>
        /// Gets or sets the maximum timeout for receiving acknowledgement for sent message.
        /// </summary>
        [DefaultValue(typeof(TimeSpan), "00:10:00")]
        public TimeSpan MaxAckTimeout { get; set; }

        /// <summary>
        /// Gets or sets the network timeout.
        /// </summary>
        [DefaultValue(typeof(TimeSpan), "00:00:05")]
        public TimeSpan NetworkTimeout { get; set; }

        /// <summary>
        /// Gets or sets the join timeout.
        /// </summary>
        public TimeSpan JoinTimeout { get; set; }

        /// <summary>
        /// Gets or sets a value indicating whether TcpDiscoverySpi is started in server mode
        /// regardless of <see cref="IgniteConfiguration.ClientMode"/> setting.
        /// </summary>
        public bool ForceServerMode { get; set; }

        /// <summary>
        /// Gets or sets a value indicating whether client does not try to reconnect after
        /// server detected client node failure.
        /// </summary>
        public bool ClientReconnectDisabled { get; set; }

        /// <summary>
        /// Gets or sets the local host IP address that discovery SPI uses.
        /// </summary>
        public string LocalAddress { get; set; }

        /// <summary>
        /// Gets or sets the number of times node tries to (re)establish connection to another node.
        /// </summary>
        [DefaultValue(DefaultReconnectCount)]
        public int ReconnectCount { get; set; }

        /// <summary>
        /// Gets or sets the local port to listen to.
        /// </summary>
        [DefaultValue(DefaultLocalPort)]
        public int LocalPort { get; set; }

        /// <summary>
        /// Gets or sets the range for local ports. Local node will try to bind on first available port starting from
        /// <see cref="LocalPort"/> up until (<see cref="LocalPort"/> + <see cref="LocalPortRange"/>).
        /// </summary>
        [DefaultValue(DefaultLocalPortRange)]
        public int LocalPortRange { get; set; }

        /// <summary>
        /// Gets or sets the statistics print frequency.
        /// <see cref="TimeSpan.Zero"/> for no statistics.
        /// </summary>
        public TimeSpan StatisticsPrintFrequency { get; set; }

        /// <summary>
        /// Gets or sets the IP finder clean frequency.
        /// </summary>
        [DefaultValue(typeof(TimeSpan), "0:1:0")]
        public TimeSpan IpFinderCleanFrequency { get; set; }

        /// <summary>
        /// Sets thread priority, 1 (lowest) to 10 (highest). All threads within SPI will be started with it.
        /// </summary>
        [DefaultValue(DefaultThreadPriority)]
        public int ThreadPriority { get; set; }

        /// <summary>
        /// Gets or sets the size of topology snapshots history.
        /// </summary>
        [DefaultValue(DefaultTopologyHistorySize)]
        public int TopologyHistorySize { get; set; }

        /// <summary>
        /// Writes this instance to the specified writer.
        /// </summary>
        internal void Write(IBinaryRawWriter writer)
        {
            var ipFinder = IpFinder;

            if (ipFinder != null)
            {
                writer.WriteBoolean(true);

                var finder = ipFinder as TcpDiscoveryIpFinderBase;

                if (finder == null)
                    throw new InvalidOperationException("Unsupported IP finder: " + ipFinder.GetType());

                finder.Write(writer);
            }
            else
                writer.WriteBoolean(false);

            writer.WriteLong((long) SocketTimeout.TotalMilliseconds);
            writer.WriteLong((long) AckTimeout.TotalMilliseconds);
            writer.WriteLong((long) MaxAckTimeout.TotalMilliseconds);
            writer.WriteLong((long) NetworkTimeout.TotalMilliseconds);
            writer.WriteLong((long) JoinTimeout.TotalMilliseconds);

            writer.WriteBoolean(ForceServerMode);
            writer.WriteBoolean(ClientReconnectDisabled);
            writer.WriteString(LocalAddress);
            writer.WriteInt(ReconnectCount);
            writer.WriteInt(LocalPort);
            writer.WriteInt(LocalPortRange);
            writer.WriteLong((long) StatisticsPrintFrequency.TotalMilliseconds);
            writer.WriteLong((long) IpFinderCleanFrequency.TotalMilliseconds);
            writer.WriteInt(ThreadPriority);
            writer.WriteInt(TopologyHistorySize);
        }
    }
}


text:
/* scheduler-base */
.scheduler-base-content {
    overflow: hidden;
}

.scheduler-base-hd {
    position: relative;
    padding: 5px 0;
}

.scheduler-base-controls .scheduler-base-current-date {
    font-weight: bold;
}

.scheduler-base-controls .scheduler-base-view-date {
    margin-left: 10px;
}

.scheduler-base-controls .scheduler-base-today {
    margin-right: 3px;
}

.scheduler-base-content .scheduler-base-views {
    float: right;
    white-space: normal;
    width: auto;
}

@media (max-width: 768px) {
    .scheduler-base-content .scheduler-base-views {
        float: left;
        margin-top: 5px;
    }
}

.scheduler-base-views .yui3-button {
    margin: 0 6px 0 0;
}

.scheduler-base-views {
    line-height: 27px;
    text-align: right;
}

.yui3-button-selected {
    background: #f8f8f8;
}

.scheduler-base .yui3-widget-hd .yui3-button {
    padding: 5px 10px 5px 10px;
}

.yui3-skin-sam .yui3-button-primary, .yui3-skin-sam .yui3-button-selected {
    -moz-box-shadow: none;
    -moz-text-shadow: none;
    -webkit-box-shadow: none;
    -webkit-text-shadow: none;
    box-shadow: none;
    text-shadow: none;
}
/* scheduler-base-view */
.scheduler-view {
    border: 1px solid #ddd;
}

.scheduler-view-scrollable {
    overflow: scroll;
    overflow-x: hidden;
    overflow-y: scroll;
    position: relative;
}

.scheduler-view-noscroll {
    overflow: hidden;
    overflow-x: hidden;
    overflow-y: hidden;
    position: relative;
}

.scheduler-view-content {
    position: relative;
}

.scheduler-view-colgrid {
    background: #dddddd;
}

.scheduler-view-colgrid td {
    padding: 0 0 0 1px;
}

.scheduler-view-grid {
    background: #fff;
    position: relative;
}

.scheduler-view-markers {
    position: absolute;
    width: 100%;
    z-index: 0;
}

.scheduler-view-markercell {
    height: 52px;
}

.scheduler-view-marker-division {
    border-bottom: 1px dotted #ddd;
    border-top: 1px solid #ddd;
    height: 25px;
}
/* scheduler-base-event */
.scheduler-event-hidden {
    display: none;
}

.scheduler-event-content {
    font-size: 16px;
    font-weight: 600;
    padding: 2px 4px;
    text-align: left;
}

.scheduler-event-content:hover {
    cursor: pointer;
    text-decoration: underline;
}

.scheduler-event-short .scheduler-event-content {
    display: inline;
    white-space: nowrap;
}

.scheduler-event-title {
    display: inline;
    font-size: 16px;
    font-weight: 300;
    line-height: 25px;
    overflow: hidden;
    padding: 2px 0 2px 4px;
    text-align: left;
    white-space: nowrap;
}

.yui3-dd-proxy .scheduler-event, .scheduler-event-past {
    filter: alpha(opacity=70);
    opacity: .7;
}

.scheduler-event.scheduler-event-proxy {
    filter: alpha(opacity=70);
    opacity: .7;
    position: relative;
    width: 99.88%;
}

.scheduler-event {
    color: rgba(0, 0, 0, .5);
    height: 70px;
    left: 0;
    overflow: hidden;
    position: absolute;
    top: 0;
    width: 95%;
    z-index: 400;
}

.scheduler-today {
    background: #f6f6f6;
}

.scheduler-today-hd {
    border: 3px solid #009be6;
    border-top: 0;
    border-right: 0;
    border-left: 0;
    color: #333333;
    font-weight: bold;
}

.scheduler-event {
    -moz-border-radius: 3px;
    -webkit-border-radius: 3px;
    border-radius: 3px;
}


text:
<?php
/**
 * Author: Andreas Geisler
 * Date: 06.06.16
 *
 * Description:
 * Simple config file
 */

// Feed url
define("FEEDURL", "YOURFEEDURL");

// Database credentials
define("DATABASE", "");
define("HOST", "localhost");
define("DBLOGIN", "root");
define("DBPASS", "");


text:
namespace Graph3D.Vrml.Fields {
    public enum FieldAccessType {
        EventIn = 22,
        EventOut = 23,
        ExposedField = 24

    }
}


text:
package viewVerktyg;

	import javafx.application.Application;
	import javafx.application.Platform;
	import javafx.event.ActionEvent;
	import javafx.event.EventHandler;
	import javafx.scene.Scene;
	import javafx.scene.control.Button;
	import javafx.scene.control.Label;
	import javafx.scene.control.TextField;
	import javafx.scene.layout.AnchorPane;
	import javafx.scene.layout.BorderPane;
	import javafx.scene.layout.HBox;
	import javafx.scene.layout.VBox;
	import javafx.stage.Stage;

	public class InlogGui {

		String name1 = "";
		String pass1 = "";

		public InlogGui() {

			BorderPane layout = new BorderPane();

			AnchorPane center = new AnchorPane();

			VBox vbox = new VBox(30);

			Label name = new Label("Name");
			center.setTopAnchor(name, 30.0);
			center.setLeftAnchor(name, 30.0);

			TextField text = new TextField();
			center.setTopAnchor(text, 65.0);
			center.setLeftAnchor(text, 10.0);

			Label pass = new Label("Password");
			center.setTopAnchor(pass, 40.0);
			center.setLeftAnchor(pass, 40.0);

			TextField text1 = new TextField();
			center.setTopAnchor(text1, 20.0);
			center.setLeftAnchor(text1, 10.0);

			Button btn = new Button();
			center.setTopAnchor(btn, 350.0);
			center.setLeftAnchor(btn, 350.0);
			btn.setText("OK");

			vbox.getChildren().addAll(name,pass);
			center.getChildren().addAll(btn, vbox, text, text1);

			 Stage stage1 = new Stage();
			stage1.setScene(new Scene(center, 400, 400));
	         stage1.setTitle("Log in");
			stage1.show();
			btn.setOnAction(event -> {
		           name1=text.getText();
		           pass1=text1.getText();
		           stage1.close();

		        });
		}

		public static void main(String[] args) {
			Application.launch(args);
		}

		public String getName (){

			return name1;
		}

		public String getPass (){

			return pass1;
		}
	}


text:
import re
import itertools

from django.db import models
from django.db.models.fields import FieldDoesNotExist
from django.db.models.fields.related import (
    ManyRelatedObjectsDescriptor,
    RelatedObject,
)

from django.core.exceptions import ImproperlyConfigured

from drf_nested_resource.compat import singular_noun, GenericForeignKey, GenericRelation, GenericRel

def is_generic_relationship_pair(parent_field, child_field):
    """
    Given a field from the parent model and a field from the child model
    """
    if not isinstance(child_field, GenericForeignKey):
        return False

    if not isinstance(parent_field, GenericRelation):
        return False

    child_model = child_field.model

    ct_field = child_model._meta.get_field(child_field.ct_field)
    fk_field = child_model._meta.get_field(child_field.fk_field)

    expected_ct_field = child_model._meta.get_field(
        parent_field.content_type_field_name,
    )
    expected_fk_field = child_model._meta.get_field(
        parent_field.object_id_field_name,
    )

    return (
        ct_field == expected_ct_field and fk_field == expected_fk_field
    )

def find_child_to_parent_accessor_name(parent_model, child_model):
    # ForeignKey relationship
    for field in child_model._meta.fields:
        if isinstance(field, models.ForeignKey) and field.rel.to is parent_model:
            return field.name

    # ManyToMany relationship where the field is declared on the `child_model`
    for field in child_model._meta.many_to_many:
        if field.rel.to is parent_model:
            return field.attname

    # ManyToMany relationship where the field is declared on the `parent_model`
    for field in parent_model._meta.many_to_many:
        if field.rel.to is child_model:
            return field.rel.related_name

    # GenericForeignKey relationship
    for parent_field, child_field in itertools.product(parent_model._meta.virtual_fields, child_model._meta.virtual_fields):
        if is_generic_relationship_pair(parent_field, child_field):
            return child_field.name

    raise ImproperlyConfigured(
        "Parent model '{0}' cannot be found for model '{1}'.".format(
            parent_model._meta.model_name, child_model._meta.model_name)
    )

def find_child_to_parent_serializer_field(serializer_class, parent_accessor_name):
    """
    Given a serializer class (for the child model) and the name of the
    attribute on the child model which references the parent model, find the
    name of the serializer field that *likely* references the parent model.
    """
    serializer = serializer_class()

    def is_serializer_field(name):
        return name in serializer.get_fields()

    # keep track of the values that were checked for nice error message reporting.
    checked = [parent_accessor_name]

    # there may be a serializer field by the exact name of the child to
    # parent accessor attribute.
    if is_serializer_field(parent_accessor_name):
        return parent_accessor_name

    # it may be something like a ForeignKey whech has the `_id` suffix.
    child_model = serializer.Meta.model
    try:
        field = child_model._meta.get_field(parent_accessor_name)
        checked.append(field.attname)
        if is_serializer_field(field.attname):
            return field.attname
    except FieldDoesNotExist:
        pass

    raise ImproperlyConfigured(
        "Unable to find field on serializer that parent model.  Checked {0}. "
        "You may need to declare `parent_serializer_field` on your view if the "
        "field is not in one of these locations.".format(
            checked,
        )
    )

def get_virtual_field(model, field_name):
    matched_fields = filter(
        lambda f: f.name == field_name,
        model._meta.virtual_fields,
    )

    if len(matched_fields) == 1:
        return matched_fields[0]
    raise FieldDoesNotExist(
        "{!r} has no virtual field named {!r}".format(
            model,
            field_name,
        )
    )

def camel_case_to_snake_case(value):
    """
    source: http://stackoverflow.com/questions/1175208/elegant-python-function-to-convert-camelcase-to-camel-case
    """
    s1 = re.sub('(.)([A-Z][a-z]+)', r'\1_\2', value)
    return re.sub('([a-z0-9])([A-Z])', r'\1_\2', s1).lower()

def compute_default_url_kwarg_for_parent(parent_model, child_model):
    """
    Given a `parent_model` and a `child_model` which
    """
    parent_accessor_name = find_child_to_parent_accessor_name(
        parent_model=parent_model,
        child_model=child_model,
    )

    # ForeignKey and ManyToManyField strategies
    try:
        field = child_model._meta.get_field(parent_accessor_name)
    except FieldDoesNotExist:
        pass
    else:
        if isinstance(field, models.ManyToManyField):
            # this isn't generic enough as it only accounts for fields that
            # are named with the pluralization of the other model that ends
            # with an `s`.
            return '{0}_{1}'.format(singular_noun(field.name), 'pk')
        elif isinstance(field, models.ForeignKey):
            return '{0}_{1}'.format(field.name, 'pk')
        else:
            raise ImproperlyConfigured(
                "No known strategy for computing url kwarg for field of type {!r}".format(
                    type(field),
                )
            )

    # GenericForeignKey strategy
    try:
        field = get_virtual_field(child_model, parent_accessor_name)
    except FieldDoesNotExist:
        pass
    else:
        return '{0}_{1}'.format(
            camel_case_to_snake_case(parent_model._meta.object_name),
            'pk',
        )

    # ManyToManyField from *other* side of the relationship.
    child_to_parent_accessor = getattr(child_model, parent_accessor_name, None)
    if isinstance(child_to_parent_accessor, ManyRelatedObjectsDescriptor):
        return '{0}_{1}'.format(
            singular_noun(parent_accessor_name),
            'pk',
        )

    raise ImproperlyConfigured(
        "No known strategy found for computing the url parameter for model "
        "{!r}.  You may need to declare `parent_url_kwarg` on your "
        "view.".format(
            parent_model,
        )
    )

def get_all_virtual_relations(model):
    generic_relations = filter(
        lambda f: isinstance(f, GenericRelation),
        model._meta.virtual_fields,
    )
    return [field.rel for field in generic_relations]

def find_parent_to_child_manager(parent_obj, child_model):
    def is_relation_to_child_model(rel):
        if isinstance(rel, GenericRel):
            return issubclass(rel.to, child_model)
        if isinstance(rel, RelatedObject):
            if isinstance(parent_obj, rel.parent_model) and issubclass(rel.model, child_model):
                return True
            # reverse
            if issubclass(rel.parent_model, child_model):
                if isinstance(parent_obj, rel.model):
                    return True
        else:
            assert False, "This code path should not be possible"

    related_objects = filter(
        is_relation_to_child_model,
        itertools.chain(
            # ForeignKey relations
            parent_obj._meta.get_all_related_objects(),
            # GenericForeignKey relations
            get_all_virtual_relations(parent_obj),
            # ManyToMany relations
            parent_obj._meta.get_all_related_many_to_many_objects(),
            # ManyToMany relations (from the other model)
            child_model._meta.get_all_related_many_to_many_objects(),
        )
    )
    if len(set(related_objects)) < 1:
        raise ImproperlyConfigured(
            "Unable to find manager from {!r} to {!r}.  You may need to declare "
            "`parent_to_child_manager_attr` on your view if the manager is in a "
            "custom location.".format(
                parent_obj.__class__, child_model,
            )
        )
    elif len(set(related_objects)) > 1:
        raise ImproperlyConfigured(
            "Found multiple valid related objects while trying to find manager "
            "from {!r} to {!r}.  You may need to declare "
            "`parent_to_child_manager_attr` on your view.  Found related objects "
            "{!r}".format(
                parent_obj.__class__, child_model, related_objects,
            )
        )

    rel = related_objects[0]

    if isinstance(rel, GenericRel):
        return getattr(parent_obj, rel.field.attname)
    elif issubclass(rel.model, child_model):
        if rel.model == rel.parent_model:
            # Self referencing ManyToManyField
            return getattr(parent_obj, rel.field.attname)
        else:
            return getattr(parent_obj, rel.get_accessor_name())
    elif isinstance(parent_obj, rel.model):
        return getattr(parent_obj, rel.field.attname)


text:
namespace java.security
{
	[global::MonoJavaBridge.JavaClass(typeof(global::java.security.KeyPairGenerator_))]
	public abstract partial class KeyPairGenerator : java.security.KeyPairGeneratorSpi
	{
		internal new static global::MonoJavaBridge.JniGlobalHandle staticClass;
		protected KeyPairGenerator(global::MonoJavaBridge.JNIEnv @__env) : base(@__env)
		{
		}
		private static global::MonoJavaBridge.MethodId _m0;
		public static global::java.security.KeyPairGenerator getInstance(java.lang.String arg0)
		{
			global::MonoJavaBridge.JNIEnv @__env = global::MonoJavaBridge.JNIEnv.ThreadEnv;
			if (global::java.security.KeyPairGenerator._m0.native == global::System.IntPtr.Zero)
				global::java.security.KeyPairGenerator._m0 = @__env.GetStaticMethodIDNoThrow(global::java.security.KeyPairGenerator.staticClass, "getInstance", "(Ljava/lang/String;)Ljava/security/KeyPairGenerator;");
			return global::MonoJavaBridge.JavaBridge.WrapJavaObject(@__env.CallStaticObjectMethod(java.security.KeyPairGenerator.staticClass, global::java.security.KeyPairGenerator._m0, global::MonoJavaBridge.JavaBridge.ConvertToValue(arg0))) as java.security.KeyPairGenerator;
		}
		private static global::MonoJavaBridge.MethodId _m1;
		public static global::java.security.KeyPairGenerator getInstance(java.lang.String arg0, java.lang.String arg1)
		{
			global::MonoJavaBridge.JNIEnv @__env = global::MonoJavaBridge.JNIEnv.ThreadEnv;
			if (global::java.security.KeyPairGenerator._m1.native == global::System.IntPtr.Zero)
				global::java.security.KeyPairGenerator._m1 = @__env.GetStaticMethodIDNoThrow(global::java.security.KeyPairGenerator.staticClass, "getInstance", "(Ljava/lang/String;Ljava/lang/String;)Ljava/security/KeyPairGenerator;");
			return global::MonoJavaBridge.JavaBridge.WrapJavaObject(@__env.CallStaticObjectMethod(java.security.KeyPairGenerator.staticClass, global::java.security.KeyPairGenerator._m1, global::MonoJavaBridge.JavaBridge.ConvertToValue(arg0), global::MonoJavaBridge.JavaBridge.ConvertToValue(arg1))) as java.security.KeyPairGenerator;
		}
		private static global::MonoJavaBridge.MethodId _m2;
		public static global::java.security.KeyPairGenerator getInstance(java.lang.String arg0, java.security.Provider arg1)
		{
			global::MonoJavaBridge.JNIEnv @__env = global::MonoJavaBridge.JNIEnv.ThreadEnv;
			if (global::java.security.KeyPairGenerator._m2.native == global::System.IntPtr.Zero)
				global::java.security.KeyPairGenerator._m2 = @__env.GetStaticMethodIDNoThrow(global::java.security.KeyPairGenerator.staticClass, "getInstance", "(Ljava/lang/String;Ljava/security/Provider;)Ljava/security/KeyPairGenerator;");
			return global::MonoJavaBridge.JavaBridge.WrapJavaObject(@__env.CallStaticObjectMethod(java.security.KeyPairGenerator.staticClass, global::java.security.KeyPairGenerator._m2, global::MonoJavaBridge.JavaBridge.ConvertToValue(arg0), global::MonoJavaBridge.JavaBridge.ConvertToValue(arg1))) as java.security.KeyPairGenerator;
		}
		private static global::MonoJavaBridge.MethodId _m3;
		public virtual void initialize(java.security.spec.AlgorithmParameterSpec arg0)
		{
			global::MonoJavaBridge.JavaBridge.CallVoidMethod(this, global::java.security.KeyPairGenerator.staticClass, "initialize", "(Ljava/security/spec/AlgorithmParameterSpec;)V", ref global::java.security.KeyPairGenerator._m3, global::MonoJavaBridge.JavaBridge.ConvertToValue(arg0));
		}
		private static global::MonoJavaBridge.MethodId _m4;
		public override void initialize(java.security.spec.AlgorithmParameterSpec arg0, java.security.SecureRandom arg1)
		{
			global::MonoJavaBridge.JavaBridge.CallVoidMethod(this, global::java.security.KeyPairGenerator.staticClass, "initialize", "(Ljava/security/spec/AlgorithmParameterSpec;Ljava/security/SecureRandom;)V", ref global::java.security.KeyPairGenerator._m4, global::MonoJavaBridge.JavaBridge.ConvertToValue(arg0), global::MonoJavaBridge.JavaBridge.ConvertToValue(arg1));
		}
		private static global::MonoJavaBridge.MethodId _m5;
		public virtual void initialize(int arg0)
		{
			global::MonoJavaBridge.JavaBridge.CallVoidMethod(this, global::java.security.KeyPairGenerator.staticClass, "initialize", "(I)V", ref global::java.security.KeyPairGenerator._m5, global::MonoJavaBridge.JavaBridge.ConvertToValue(arg0));
		}
		private static global::MonoJavaBridge.MethodId _m6;
		public override void initialize(int arg0, java.security.SecureRandom arg1)
		{
			global::MonoJavaBridge.JavaBridge.CallVoidMethod(this, global::java.security.KeyPairGenerator.staticClass, "initialize", "(ILjava/security/SecureRandom;)V", ref global::java.security.KeyPairGenerator._m6, global::MonoJavaBridge.JavaBridge.ConvertToValue(arg0), global::MonoJavaBridge.JavaBridge.ConvertToValue(arg1));
		}
		private static global::MonoJavaBridge.MethodId _m7;
		public virtual global::java.lang.String getAlgorithm()
		{
			return global::MonoJavaBridge.JavaBridge.CallSealedClassObjectMethod<java.lang.String>(this, global::java.security.KeyPairGenerator.staticClass, "getAlgorithm", "()Ljava/lang/String;", ref global::java.security.KeyPairGenerator._m7) as java.lang.String;
		}
		private static global::MonoJavaBridge.MethodId _m8;
		public virtual global::java.security.Provider getProvider()
		{
			return global::MonoJavaBridge.JavaBridge.CallObjectMethod(this, global::java.security.KeyPairGenerator.staticClass, "getProvider", "()Ljava/security/Provider;", ref global::java.security.KeyPairGenerator._m8) as java.security.Provider;
		}
		private static global::MonoJavaBridge.MethodId _m9;
		public virtual global::java.security.KeyPair genKeyPair()
		{
			return global::MonoJavaBridge.JavaBridge.CallSealedClassObjectMethod<java.security.KeyPair>(this, global::java.security.KeyPairGenerator.staticClass, "genKeyPair", "()Ljava/security/KeyPair;", ref global::java.security.KeyPairGenerator._m9) as java.security.KeyPair;
		}
		private static global::MonoJavaBridge.MethodId _m10;
		public override global::java.security.KeyPair generateKeyPair()
		{
			return global::MonoJavaBridge.JavaBridge.CallSealedClassObjectMethod<java.security.KeyPair>(this, global::java.security.KeyPairGenerator.staticClass, "generateKeyPair", "()Ljava/security/KeyPair;", ref global::java.security.KeyPairGenerator._m10) as java.security.KeyPair;
		}
		private static global::MonoJavaBridge.MethodId _m11;
		protected KeyPairGenerator(java.lang.String arg0) : base(global::MonoJavaBridge.JNIEnv.ThreadEnv)
		{
			global::MonoJavaBridge.JNIEnv @__env = global::MonoJavaBridge.JNIEnv.ThreadEnv;
			if (global::java.security.KeyPairGenerator._m11.native == global::System.IntPtr.Zero)
				global::java.security.KeyPairGenerator._m11 = @__env.GetMethodIDNoThrow(global::java.security.KeyPairGenerator.staticClass, "<init>", "(Ljava/lang/String;)V");
			global::MonoJavaBridge.JniLocalHandle handle = @__env.NewObject(java.security.KeyPairGenerator.staticClass, global::java.security.KeyPairGenerator._m11, global::MonoJavaBridge.JavaBridge.ConvertToValue(arg0));
			Init(@__env, handle);
		}
		static KeyPairGenerator()
		{
			global::MonoJavaBridge.JNIEnv @__env = global::MonoJavaBridge.JNIEnv.ThreadEnv;
			global::java.security.KeyPairGenerator.staticClass = @__env.NewGlobalRef(@__env.FindClass("java/security/KeyPairGenerator"));
		}
	}

	[global::MonoJavaBridge.JavaProxy(typeof(global::java.security.KeyPairGenerator))]
	internal sealed partial class KeyPairGenerator_ : java.security.KeyPairGenerator
	{
		internal new static global::MonoJavaBridge.JniGlobalHandle staticClass;
		internal KeyPairGenerator_(global::MonoJavaBridge.JNIEnv @__env) : base(@__env)
		{
		}
		static KeyPairGenerator_()
		{
			global::MonoJavaBridge.JNIEnv @__env = global::MonoJavaBridge.JNIEnv.ThreadEnv;
			global::java.security.KeyPairGenerator_.staticClass = @__env.NewGlobalRef(@__env.FindClass("java/security/KeyPairGenerator"));
		}
	}
}