text:
namespace chromecast {

PlatformInfoSerializer ConvertAndValidate(
    const PlatformInfoSerializer& parser) {
  std::string base64 = parser.Serialize();
  absl::optional<PlatformInfoSerializer> deserialized_parser =
      PlatformInfoSerializer::Deserialize(base64);
  EXPECT_TRUE(deserialized_parser);
  EXPECT_EQ(parser.Serialize(), deserialized_parser->Serialize());
  return std::move(deserialized_parser.value());
}

class PlatformInfoSerializerTest : public testing::Test {
 public:
  PlatformInfoSerializerTest() = default;
  ~PlatformInfoSerializerTest() override = default;

 protected:
  PlatformInfoSerializer serializer_;
};

TEST_F(PlatformInfoSerializerTest, MaxWidth) {
  serializer_.SetMaxWidth(42);
  EXPECT_EQ(42, ConvertAndValidate(serializer_).MaxWidth().value());

  serializer_.SetMaxWidth(12);
  EXPECT_EQ(12, ConvertAndValidate(serializer_).MaxWidth().value());

  serializer_.SetMaxWidth(7);
  EXPECT_EQ(7, ConvertAndValidate(serializer_).MaxWidth().value());
}

TEST_F(PlatformInfoSerializerTest, MaxHeight) {
  serializer_.SetMaxHeight(42);
  EXPECT_EQ(42, ConvertAndValidate(serializer_).MaxHeight().value());

  serializer_.SetMaxHeight(12);
  EXPECT_EQ(12, ConvertAndValidate(serializer_).MaxHeight().value());

  serializer_.SetMaxHeight(7);
  EXPECT_EQ(7, ConvertAndValidate(serializer_).MaxHeight().value());
}

TEST_F(PlatformInfoSerializerTest, MaxFrameRate) {
  serializer_.SetMaxFrameRate(42);
  EXPECT_EQ(42, ConvertAndValidate(serializer_).MaxFrameRate().value());

  serializer_.SetMaxFrameRate(12);
  EXPECT_EQ(12, ConvertAndValidate(serializer_).MaxFrameRate().value());

  serializer_.SetMaxFrameRate(7);
  EXPECT_EQ(7, ConvertAndValidate(serializer_).MaxFrameRate().value());
}

TEST_F(PlatformInfoSerializerTest, SupportedCryptoBlockFormat) {
  serializer_.SetSupportedCryptoBlockFormat("foo");
  EXPECT_EQ(
      "foo",
      ConvertAndValidate(serializer_).SupportedCryptoBlockFormat().value());

  serializer_.SetSupportedCryptoBlockFormat("bar");
  EXPECT_EQ(
      "bar",
      ConvertAndValidate(serializer_).SupportedCryptoBlockFormat().value());

  serializer_.SetSupportedCryptoBlockFormat("");
  EXPECT_EQ(
      "", ConvertAndValidate(serializer_).SupportedCryptoBlockFormat().value());
}

TEST_F(PlatformInfoSerializerTest, MaxChannels) {
  serializer_.SetMaxChannels(42);
  EXPECT_EQ(42, ConvertAndValidate(serializer_).MaxChannels().value());

  serializer_.SetMaxChannels(12);
  EXPECT_EQ(12, ConvertAndValidate(serializer_).MaxChannels().value());

  serializer_.SetMaxChannels(7);
  EXPECT_EQ(7, ConvertAndValidate(serializer_).MaxChannels().value());
}

TEST_F(PlatformInfoSerializerTest, PcmSurroundSoundSupported) {
  serializer_.SetPcmSurroundSoundSupported(true);
  EXPECT_TRUE(
      ConvertAndValidate(serializer_).PcmSurroundSoundSupported().value());

  serializer_.SetPcmSurroundSoundSupported(false);
  EXPECT_FALSE(
      ConvertAndValidate(serializer_).PcmSurroundSoundSupported().value());
}

TEST_F(PlatformInfoSerializerTest, PlatformDolbyVisionEnabled) {
  serializer_.SetPlatformDolbyVisionEnabled(true);
  EXPECT_TRUE(
      ConvertAndValidate(serializer_).IsPlatformDolbyVisionEnabled().value());

  serializer_.SetPlatformDolbyVisionEnabled(false);
  EXPECT_FALSE(
      ConvertAndValidate(serializer_).IsPlatformDolbyVisionEnabled().value());
}

TEST_F(PlatformInfoSerializerTest, DolbyVisionSupported) {
  serializer_.SetDolbyVisionSupported(true);
  EXPECT_TRUE(ConvertAndValidate(serializer_).IsDolbyVisionSupported().value());

  serializer_.SetDolbyVisionSupported(false);
  EXPECT_FALSE(
      ConvertAndValidate(serializer_).IsDolbyVisionSupported().value());
}

TEST_F(PlatformInfoSerializerTest, DolbyVision4kP60Supported) {
  serializer_.SetDolbyVision4kP60Supported(true);
  EXPECT_TRUE(
      ConvertAndValidate(serializer_).IsDolbyVision4kP60Supported().value());

  serializer_.SetDolbyVision4kP60Supported(false);
  EXPECT_FALSE(
      ConvertAndValidate(serializer_).IsDolbyVision4kP60Supported().value());
}

TEST_F(PlatformInfoSerializerTest, DolbyVisionSupportedByCurrentHdmiMode) {
  serializer_.SetDolbyVisionSupportedByCurrentHdmiMode(true);
  EXPECT_TRUE(ConvertAndValidate(serializer_)
                  .IsDolbyVisionSupportedByCurrentHdmiMode()
                  .value());

  serializer_.SetDolbyVisionSupportedByCurrentHdmiMode(false);
  EXPECT_FALSE(ConvertAndValidate(serializer_)
                   .IsDolbyVisionSupportedByCurrentHdmiMode()
                   .value());
}

TEST_F(PlatformInfoSerializerTest, HdmiVideoModeSwitchEnabled) {
  serializer_.SetHdmiVideoModeSwitchEnabled(true);
  EXPECT_TRUE(
      ConvertAndValidate(serializer_).IsHdmiVideoModeSwitchEnabled().value());

  serializer_.SetHdmiVideoModeSwitchEnabled(false);
  EXPECT_FALSE(
      ConvertAndValidate(serializer_).IsHdmiVideoModeSwitchEnabled().value());
}

TEST_F(PlatformInfoSerializerTest, PlatformHevcEnabled) {
  serializer_.SetPlatformHevcEnabled(true);
  EXPECT_TRUE(ConvertAndValidate(serializer_).IsPlatformHevcEnabled().value());

  serializer_.SetPlatformHevcEnabled(false);
  EXPECT_FALSE(ConvertAndValidate(serializer_).IsPlatformHevcEnabled().value());
}

TEST_F(PlatformInfoSerializerTest, HdmiModeHdrCheckEnforced) {
  serializer_.SetHdmiModeHdrCheckEnforced(true);
  EXPECT_TRUE(
      ConvertAndValidate(serializer_).IsHdmiModeHdrCheckEnforced().value());

  serializer_.SetHdmiModeHdrCheckEnforced(false);
  EXPECT_FALSE(
      ConvertAndValidate(serializer_).IsHdmiModeHdrCheckEnforced().value());
}

TEST_F(PlatformInfoSerializerTest, HdrSupportedByCurrentHdmiMode) {
  serializer_.SetHdrSupportedByCurrentHdmiMode(true);
  EXPECT_TRUE(ConvertAndValidate(serializer_)
                  .IsHdrSupportedByCurrentHdmiMode()
                  .value());

  serializer_.SetHdrSupportedByCurrentHdmiMode(false);
  EXPECT_FALSE(ConvertAndValidate(serializer_)
                   .IsHdrSupportedByCurrentHdmiMode()
                   .value());
}

TEST_F(PlatformInfoSerializerTest, SmpteSt2084Supported) {
  serializer_.SetSmpteSt2084Supported(true);
  EXPECT_TRUE(ConvertAndValidate(serializer_).IsSmpteSt2084Supported().value());

  serializer_.SetSmpteSt2084Supported(false);
  EXPECT_FALSE(
      ConvertAndValidate(serializer_).IsSmpteSt2084Supported().value());
}

TEST_F(PlatformInfoSerializerTest, Hlg) {
  serializer_.SetHlgSupported(true);
  EXPECT_TRUE(ConvertAndValidate(serializer_).IsHlgSupported().value());

  serializer_.SetHlgSupported(false);
  EXPECT_FALSE(ConvertAndValidate(serializer_).IsHlgSupported().value());
}

TEST_F(PlatformInfoSerializerTest, HdrFeatureEnabled) {
  serializer_.SetHdrFeatureEnabled(true);
  EXPECT_TRUE(ConvertAndValidate(serializer_).IsHdrFeatureEnabled().value());

  serializer_.SetHdrFeatureEnabled(false);
  EXPECT_FALSE(ConvertAndValidate(serializer_).IsHdrFeatureEnabled().value());
}

TEST_F(PlatformInfoSerializerTest, SupportedLegacyVp9Levels) {
  std::vector<int> source{42, 24, 7};
  serializer_.SetSupportedLegacyVp9Levels(source);
  auto converted =
      ConvertAndValidate(serializer_).SupportedLegacyVp9Levels().value();

  ASSERT_EQ(source.size(), converted.size());
  for (int i = 0; i < static_cast<int>(source.size()); i++) {
    EXPECT_EQ(source[i], converted[i]);
  }
}

TEST_F(PlatformInfoSerializerTest, HdcpVersion) {
  serializer_.SetHdcpVersion(42);
  EXPECT_EQ(42, ConvertAndValidate(serializer_).HdcpVersion().value());

  serializer_.SetHdcpVersion(12);
  EXPECT_EQ(12, ConvertAndValidate(serializer_).HdcpVersion().value());

  serializer_.SetHdcpVersion(7);
  EXPECT_EQ(7, ConvertAndValidate(serializer_).HdcpVersion().value());
}

TEST_F(PlatformInfoSerializerTest, SpatialRenderingSupportMask) {
  serializer_.SetSpatialRenderingSupportMask(42);
  EXPECT_EQ(
      42,
      ConvertAndValidate(serializer_).SpatialRenderingSupportMask().value());

  serializer_.SetSpatialRenderingSupportMask(12);
  EXPECT_EQ(
      12,
      ConvertAndValidate(serializer_).SpatialRenderingSupportMask().value());

  serializer_.SetSpatialRenderingSupportMask(7);
  EXPECT_EQ(
      7, ConvertAndValidate(serializer_).SpatialRenderingSupportMask().value());
}

TEST_F(PlatformInfoSerializerTest, MaxFillRate) {
  serializer_.SetMaxFillRate(42);
  EXPECT_EQ(42, ConvertAndValidate(serializer_).MaxFillRate().value());

  serializer_.SetMaxFillRate(12);
  EXPECT_EQ(12, ConvertAndValidate(serializer_).MaxFillRate().value());

  serializer_.SetMaxFillRate(7);
  EXPECT_EQ(7, ConvertAndValidate(serializer_).MaxFillRate().value());
}

TEST_F(PlatformInfoSerializerTest, AudioCodecInfo) {
  PlatformInfoSerializer::AudioCodecInfo first{
      media::AudioCodec::kCodecAAC, media::SampleFormat::kSampleFormatU8, 42,
      16};
  PlatformInfoSerializer::AudioCodecInfo second{
      media::AudioCodec::kCodecOpus, media::SampleFormat::kSampleFormatS32, 18,
      34};
  PlatformInfoSerializer::AudioCodecInfo third{
      media::AudioCodec::kCodecAC3, media::SampleFormat::kSampleFormatPlanarS16,
      9, 99};

  std::vector<PlatformInfoSerializer::AudioCodecInfo> codec_infos{first, second,
                                                                  third};
  serializer_.SetSupportedAudioCodecs(codec_infos);

  auto converted = ConvertAndValidate(serializer_).SupportedAudioCodecs();
  ASSERT_TRUE(converted.has_value());
  ASSERT_EQ(codec_infos.size(), converted.value().size());
  for (int i = 0; i < static_cast<int>(codec_infos.size()); i++) {
    EXPECT_EQ(codec_infos[i], converted.value()[i]);
  }
}

TEST_F(PlatformInfoSerializerTest, VideoCodecInfo) {
  PlatformInfoSerializer::VideoCodecInfo first{
      media::VideoCodec::kCodecVP8, media::VideoProfile::kVP8ProfileAny};
  PlatformInfoSerializer::VideoCodecInfo second{
      media::VideoCodec::kCodecVP9, media::VideoProfile::kVP9Profile2};
  PlatformInfoSerializer::VideoCodecInfo third{
      media::VideoCodec::kCodecH264, media::VideoProfile::kH264Extended};

  std::vector<PlatformInfoSerializer::VideoCodecInfo> codec_infos{first, second,
                                                                  third};
  serializer_.SetSupportedVideoCodecs(codec_infos);

  auto converted = ConvertAndValidate(serializer_).SupportedVideoCodecs();
  ASSERT_TRUE(converted.has_value());
  ASSERT_EQ(codec_infos.size(), converted.value().size());
  for (int i = 0; i < static_cast<int>(codec_infos.size()); i++) {
    EXPECT_EQ(codec_infos[i], converted.value()[i]);
  }
}

}  // namespace chromecast


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

  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>Returns the current call stack as an array</title>

apd_breakpoint

apd_clunk

APD Functions

PHP Manual

apd_callstack

(PECL apd 0.2-0.4)

apd_callstack — Returns the current call stack as an array

Description

   array apd_callstack
    ( void
   )

   Returns the current call stack as an array

Return Values

   An array containing the current call stack.

Examples

Example #1 apd_callstack() example

<?php
print_r(apd_callstack());
?>

apd_breakpoint

apd_clunk

APD Functions

PHP Manual

redpajama_set_name: RedPajamaGithub


text:
define("eventmaster", [
    "mo/lang/es5",
    "mo/lang/mix",
    "mo/lang/struct"
], function(es5, _, struct){

    var fnQueue = struct.fnQueue,
        slice = Array.prototype.slice,
        pipes = ['notify', 'fire', 'error',
            'resolve', 'reject', 'reset', 'disable', 'enable'];

    function Promise(opt){
        var self = this;
        if (opt) {
            this.subject = opt.subject;
            this.trace = opt.trace;
            this.traceStack = opt.traceStack || [];
        }
        this.doneHandlers = fnQueue();
        this.failHandlers = fnQueue();
        this.observeHandlers = fnQueue();
        this._alterQueue = fnQueue();
        this._lastDoneQueue = [];
        this._lastFailQueue = [];
        this.status = 0;
        this._argsCache = [];
        this.pipe = {};
        pipes.forEach(function(i){
            this[i] = function(){
                return self[i].call(self, slice.call(arguments));
            };
        }, this.pipe);
    }

    var actors = Promise.prototype = {

        then: function(handler, errorHandler){
            var _status = this.status;
            if (errorHandler) { // error, reject
                if (_status === 2) {
                    this._resultCache = errorHandler.apply(this, this._argsCache);
                } else if (!_status) {
                    this.failHandlers.push(errorHandler);
                    this._lastFailQueue = this.failHandlers;
                }
            } else {
                this._lastFailQueue = [];
            }
            if (handler) { // fire, resolve
                if (_status === 1) {
                    this._resultCache = handler.apply(this, this._argsCache);
                } else if (!_status) {
                    this.doneHandlers.push(handler);
                    this._lastDoneQueue = this.doneHandlers;
                }
            } else {
                this._lastDoneQueue = [];
            }
            return this;
        },

        done: function(handler){ // fire, resolve
            return this.then(handler);
        },

        fail: function(handler){ // error, reject
            return this.then(false, handler);
        },

        cancel: function(handler, errorHandler){ // then
            if (handler) { // done
                this.doneHandlers.clear(handler);
            }
            if (errorHandler) { // fail
                this.failHandlers.clear(errorHandler);
            }
            return this;
        },

        bind: function(handler){
            if (this.status) { // resolve, reject
                handler.apply(this, this._argsCache);
            }
            this.observeHandlers.push(handler); // notify, fire, error
            return this;
        },

        unbind: function(handler){ // bind
            this.observeHandlers.clear(handler);
            return this;
        },

        progress: function(handler){ // notify, fire?, error?
            var self = this;
            this.observeHandlers.push(function(){
                if (!self.status) {
                    handler.apply(this, arguments);
                }
            });
            return this;
        },

        notify: function(args){ // progress, bind
            if (this._disalbed) {
                return this;
            }
            this.status = 0;
            this.observeHandlers.apply(this, args || []);
            return this;
        },

        fire: function(args){ // bind, progress?, then, done
            if (this._disalbed) {
                return this;
            }
            if (this.trace) {
                this._trace();
            }
            args = args || [];
            var onceHandlers = this.doneHandlers;
            this.doneHandlers = this._alterQueue;
            this.failHandlers.length = 0;
            this.observeHandlers.apply(this, args);
            onceHandlers.apply(this, args);
            onceHandlers.length = 0;
            this._alterQueue = onceHandlers;
            return this;
        },

        error: function(args){ // bind, progress?, then, fail
            if (this._disalbed) {
                return this;
            }
            if (this.trace) {
                this._trace();
            }
            args = args || [];
            var onceHandlers = this.failHandlers;
            this.failHandlers = this._alterQueue;
            this.doneHandlers.length = 0;
            this.observeHandlers.apply(this, args);
            onceHandlers.apply(this, args);
            onceHandlers.length = 0;
            this._alterQueue = onceHandlers;
            return this;
        },

        resolve: function(args){ // bind, then, done
            this.status = 1;
            this._argsCache = args || [];
            return this.fire(args);
        },

        reject: function(args){ // bind, then, fail
            this.status = 2;
            this._argsCache = args || [];
            return this.error(args);
        },

        reset: function(){ // resolve, reject
            this.status = 0;
            this._argsCache = [];
            this.doneHandlers.length = 0;
            this.failHandlers.length = 0;
            return this;
        },

        disable: function(){
            this._disalbed = true;
        },

        enable: function(){
            this._disalbed = false;
        },

        merge: function(promise){ // @TODO need testing
            _.merge(this.doneHandlers, promise.doneHandlers);
            _.merge(this.failHandlers, promise.failHandlers);
            _.merge(this.observeHandlers, promise.observeHandlers);
            var subject = promise.subject;
            _.mix(promise, this);
            promise.subject = subject;
        },

        _trace: function(){
            this.traceStack.unshift(this.subject);
            if (this.traceStack.length > this.trace) {
                this.traceStack.pop();
            }
        },

        follow: function(){
            var next = new Promise();
            next._prevActor = this;
            if (this.status) {
                pipe(this._resultCache, next);
            } else {
                var doneHandler = this._lastDoneQueue.pop();
                if (doneHandler) {
                    this._lastDoneQueue.push(function(){
                        return pipe(doneHandler.apply(this, arguments), next);
                    });
                }
                var failHandler = this._lastFailQueue.pop();
                if (failHandler) {
                    this._lastFailQueue.push(function(){
                        return pipe(failHandler.apply(this, arguments), next);
                    });
                }
            }
            return next;
        },

        end: function(){
            return this._prevActor;
        },

        all: function(){
            var fork = when.apply(this, this._when);
            return fork;
        },

        any: function(){
            var fork = when.apply(this, this._when);
            fork._count = fork._total = 1;
            return fork;
        },

        some: function(n){
            var fork = when.apply(this, this._when);
            fork._count = fork._total = n;
            return fork;
        }

    };

    function when(){
        var mutiArgs = [],
            completed = [],
            mutiPromise = new Promise();
        mutiPromise._when = [];
        mutiPromise._count = mutiPromise._total = arguments.length;
        Array.prototype.forEach.call(arguments, function(promise, i){
            var mutiPromise = this;
            mutiPromise._when.push(promise.bind(callback));
            function callback(args){
                if (!completed[i]) {
                    completed[i] = true;
                    mutiArgs[i] = args;
                    if (--mutiPromise._count === 0) {  // @TODO
                        completed.length = 0;
                        mutiPromise._count = mutiPromise._total;
                        mutiPromise.resolve.call(mutiPromise, mutiArgs);
                    }
                }
            }
        }, mutiPromise);
        return mutiPromise;
    }

    function pipe(prev, next){
        if (prev && prev.then) {
            prev.then(next.pipe.resolve, next.pipe.reject)
                .progress(next.pipe.notify);
        } else if (prev !== undefined) {
            next.resolve([prev]);
        }
        return prev;
    }

    function dispatchFactory(i){
        return function(subject){
            var promise = this.lib[subject];
            if (!promise) {
                promise = this.lib[subject] = new Promise({
                    subject: subject,
                    trace: this.trace,
                    traceStack: this.traceStack
                });
            }
            promise[i].apply(promise, slice.call(arguments, 1));
            return this;
        };
    }

    function Event(opt){
        if (opt) {
            this.trace = opt.trace;
            this.traceStack = opt.traceStack;
        }
        this.lib = {};
    }

    var EventAPI = Event.prototype = (function(methods){
        for (var i in actors) {
            methods[i] = dispatchFactory(i);
        }
        return methods;
    })({});

    EventAPI.once = EventAPI.wait = EventAPI.then;
    EventAPI.on = EventAPI.bind;
    EventAPI.off = EventAPI.unbind;

    EventAPI.promise = function(subject){
        var promise = this.lib[subject];
        if (!promise) {
            promise = this.lib[subject] = new Promise({
                subject: subject,
                trace: this.trace,
                traceStack: this.traceStack
            });
        }
        return promise;
    };

    EventAPI.when = function(){
        var args = [];
        for (var i = 0, l = arguments.length; i < l; i++) {
            args.push(this.promise(arguments[i]));
        }
        return when.apply(this, args);
    };

    function exports(opt){
        return new Event(opt);
    }

    exports.Promise = Promise;
    exports.Event = Event;
    exports.when = when;
    exports.pipe = pipe;

    exports.VERSION = '2.0.0';

    return exports;
});


text:
const slugify = require('slugify');
const path = require('path');

const CommandQueue = require('./lib/CommandQueue');
const Registry = require('./lib/Registry');
const Switch = require('./lib/Switch');

const COMMAND_DELAY = 1000;

let Service, Characteristic;
let command_queue, registry;

module.exports = function(homebridge) {
    Service = homebridge.hap.Service;
    Characteristic = homebridge.hap.Characteristic;

    command_queue = new CommandQueue(COMMAND_DELAY);

    const registry_dir = path.dirname(homebridge.user.configPath());
    registry = new Registry(path.join(registry_dir, "registry.kvs"));
    registry.reset();

    homebridge.registerAccessory("homebridge-energenie", "Energenie", EnergenieAccessory);
}

function EnergenieAccessory(log, config) {
    var self = this;
    self.log = log;
    self.name = config["name"];
    self.registry_name = slugify(self.name, "_").toLowerCase();
    self.type = config["type"];
    self.device_id = config["device_id"];

    self.state = false;

    self.service = new Service.Switch(self.name);

    self.service.getCharacteristic(Characteristic.On).value = self.state;

    self.service.getCharacteristic(Characteristic.On).on('get', function(cb) {
        cb(null, self.state);
    }.bind(self));

    self.service.getCharacteristic(Characteristic.On).on('set', function(state, cb) {
        self.state = state;

        command_queue.queue(function() {
            Switch(registry, self.state ? 'on' : 'off', self.registry_name, cb);
        });
    }.bind(self));

    registry.add(self);
}

EnergenieAccessory.prototype.getServices = function() {
    return [ this.service ];
}


text:
extern int debug;
extern bool rt11;
extern unsigned int codebase;

//!\brief enum for block types
//!
enum BlockTypes
{
	BLOCK_GSD = 1,		//!< GSD Global Symbol Directory
	BLOCK_ENDGSD = 2,	//!< End of GSD
	BLOCK_TXT = 3,		//!< Holds the actual binary of the program
	BLOCK_RLD = 4,		//!< RLD Relocation Directory
	BLOCK_ISD = 5,		//< ISD Internal Symbol Directory (not used by RT11)
	BLOCK_ENDMOD = 6,	//!< ENDMOD end of object module
	BLOCK_LIB = 7,		//!< LIB start of library
	BLOCK_ENDLIB = 8	//!< ENDLIB end of library
};

//!\brief enum describibg GSD types
//!
enum GSDTypes
{
	GSD_MODNAM = 0,		//!< Module Name
	GSD_CSECT = 1,		//!< c-sect
	GSD_ISN = 2,		//!< ISN Internal symbol name
	GSD_TA = 3,		//!< Transfer address
	GSD_GSN = 4,		//!< Global symbol name
	GSD_PSECT = 5,		//!< p-sect (prograam section)
	GSD_IDENT = 6,		//!< Program version Identification
	GSD_VSECT = 7		//!< vsect (Mapped array declaration)
};

//!\brief enum defining error code
//
enum ErrorCode
{
	ERROR_OK = 0,		//!< No error
	ERROR_EOF = 1,		//!< End of file reached
	ERROR_BADDATA		//!< Bad data read from object file
};

enum GSNFlags
{
	GSN_WEAK = 001,
	GSN_DEF = 010,
	GSN_REL  = 040
};

//**********************************************************************
// link11read.cc
//**********************************************************************

//! \brief Class to handle blocks of data from an object file
//!
//! Manage the reading of blocks of data from an object file.
//!
class ObjectBlock
{
public:
	int one;		//!< Two bytes, should be 1 if read is Ok
	int length;		//!< Block length.
	int type;		//!< Type of block
	unsigned char* block;	//!< 8-bit byte block containing data
	int checksum;		//!< Checksum.

public:
	//!\brief Constructor
	//
	inline ObjectBlock()
	{
		one = 0;
		length = 0;
		type = 0;
		block = 0;
		checksum = 0;
	}
	//!\brief destructor
	//
	inline ~ObjectBlock()
	{
		if (block)
		{
			delete[] block;
		}
	}
	int ReadBlock(std::ifstream &in);
	void Dump(int detail);
	void DumpGSD(int detail);
	void DumpRLD(int detail);
};

//!\brief class to hold an entire object file
//!
//! Stores all of the blocks read from one object file.
//!
class ObjectFile : public std::list<ObjectBlock>
{
public:
	std::string file;		//!< Name of file

public:
	int ReadFile(const std::string &filename);
	void Dump(int detail);
};

//**********************************************************************
// link11link.cc
//**********************************************************************
//
class LinkPsect;	// Forwars reference.
			// Defined later, but we need to be ablle to
			// point at it before it is defined. (recursive)

//!\brief Variables
//!
//! Contains definition of a single symbol
//!
class Variable
{
public:
	unsigned char name[4];		//!< Name of symbol in radix50
	LinkPsect *psect;		//!< psect the symbol belongs to
	unsigned int offset;		//!< offset address.
	unsigned int flags;		//!< flags
					//! 1=weak, 8=def, 32=relative
					//! Base address is in *psect.
	unsigned int absolute;		//!< Absolute address.

public:
	//!\brief Constructor
	//!
	inline Variable()
	{
		memset(name, 0, 4);
		psect = 0;
		offset = 0;
		flags = 0;
		absolute = 0;
	}

	//!\brief Copy name over
	//!
	inline void setname(
		const unsigned char *cn)	//!< Name to copy
	{
		memcpy(name, cn, 4);
	}
	void Dump(int level);
	void Reloc();
};

class VariableList : public std::list<Variable>
{
public:
	//!\brief Debugging dump of data
	//
	inline void Dump(int level)
	{
		for (auto loop = begin(); loop != end(); loop++)
		{
			(*loop).Dump(level);
		}
	}

	//!/brief Search for symbol in list
	//!
	//\returns pointer to variable definition if found,
	//! else returns 0.
	//!
	inline Variable *Search(
		const unsigned char *name)	//!< Symbol name to search for
	       					//!< in radix50
	{
		for (auto loop = begin(); loop != end(); loop++)
		{
			if (memcmp(name, (*loop).name, 4) == 0)
			{
				return &(*loop);
			}
		}

		return 0;	// not found
	}
};

//
//!\brief program section class
//!
class LinkPsect
{
public:
	unsigned char module[4];	//!< Name of module in radix50
	unsigned char name[4];		//!< Name of psect in radix50
	unsigned int flag;		//!< psect flags
	unsigned int length;		//!< Sise of data allocated
	unsigned int base;		//!< Base address.
	unsigned char *data;		//!< Code for this psect

public:
	//! \brief Constructor
	//
	inline LinkPsect()
	{
		flag = 0;
		length = 0;
		base = 0;
		data = 0;
	}
	//!\brief Destructor
	inline ~LinkPsect()
	{
		if (data)
		{
			delete[] data;
		}
	}
	void Dump(int level);
};

//!\brief list of program sections
//!
class LinkPsectList : public std::list<LinkPsect>
{
public:
	//!\brief Debugging dump of data
	//
	inline void Dump(int level)
	{
		for (auto loop = begin(); loop != end(); loop++)
		{
			(*loop).Dump(level);
		}
	}

	//!\brief scan for psect
	//!
	//! Looks for the LAST matching psect
	LinkPsect *Lookup(
		const unsigned char *psect)	//!< radix50 psect name
	{
		LinkPsect *result = 0;

		for (auto loop = begin(); loop != end(); loop++)
		{
			if (memcmp((*loop).name, psect, 4) == 0)
			{
				result = &(*loop);
			}
		}
		return result;
	}

	//!\brief scan for psect
	//!
	//! Looks for the LAST matching psect
	LinkPsect *Lookup(
		const unsigned char *module,	//!< radix50 module name
		const unsigned char *psect)	//!< radix50 psect name
	{
		LinkPsect *result = 0;

		for (auto loop = begin(); loop != end(); loop++)
		{
			if ((memcmp((*loop).module, module, 4) == 0) &&
				(memcmp((*loop).name, psect, 4) == 0))
			{
				result = &(*loop);
			}
		}
		return result;
	}
};

//!\brief Relocation class
//!
//! Used to save relocation nformation
//
class Reloc
{
public:
	LinkPsect *psect;		//!< Psect allocated to
	unsigned int length;		//!< Size of data.
					//!< Probably only importamt for type 017.
	unsigned char* data;		//!< Relocation data

public:
	inline Reloc()
	{
		psect = 0;
		data = 0;
	}
	inline ~Reloc()
	{
		if (data)
		{
			delete[] data;
		}
	}
	void Dump(int Level);
};

//!\brief List of Relocs
//!
class RelocList : public std::list<Reloc>
{
public:
	//!\brief Debugging dump of data
	//
	inline void Dump(int level)
	{
		for (auto loop = begin(); loop != end(); loop++)
		{
			(*loop).Dump(level);
		}
	}
};

//!\brief Link class
//!
//! Does the heavy lifting of the link process
//!
class Link
{
public:
	unsigned int base;		//!< Starting address for psects
	unsigned int current;		//!< Current address for psects
					//!< Holds ending address after reloc

	LinkPsectList psectlist;	//!< All Program sections
	VariableList globalvars;	//!< Global symbols
	RelocList reloclist;		//!< Relocations that still need
       					//! to be handled
	LinkPsect *currentpsect;	//!< Current psect being worked on
	unsigned char currentmodule[4];	//!< Current module being worked on

	unsigned int checksum;		//!< Used for checksum calculations

	Variable start;			//!< Starting address

public:
	//!/brief Constructor
	inline Link()
	{
		currentpsect = 0;
		memset(currentmodule, 0, 6);
		checksum = 0;
		base = codebase;
	}
	void Dump(int level);
	int Pass100(ObjectBlock &block);

	//!\brief Process all blocks in one file for Pass100.
	//!
	//!\returns an ErrorCode
	//!
	inline int Pass100(
		ObjectFile &block)	//!< File to be processed
	{
		int error = ERROR_OK;
		for (auto loop = block.begin();
			loop != block.end() && error == ERROR_OK;
			loop++)
		{
			error = Pass100(*loop);
		}
		return error;
	}
	int Pass100Psect(int type, const unsigned char *def);
	int Pass100Txt(ObjectBlock &block);
	int Pass100Gsn(const unsigned char *def);
	int Pass100Rld(ObjectBlock &block);

	int Pass200(void);
	int Pass200Rbl(void);
	int Pass200Rbl017(const unsigned char *, unsigned int reloc);

	int WriteAbs(const std::string &filename);
	int WriteSimh(const std::string &filename);
	int WriteMap(const std::string &filename);
	void WriteMapVar(std::ofstream &fout, const Variable &var);

	//!\brief Write character to bin, calculating checksum
	//!
	inline void putbyte(
		std::ofstream &fout,	//!< Binary stream to write to
		unsigned char ch)	//!< Single character to write
	{
		fout.put(ch);
		checksum -= ch;
	}
	//!\brief Write a two byte word to binary file, tracking checksum
	//!
	inline void putword(
		std::ofstream &fout,	//!< Binary stream to write to
		unsigned int wd)	//!< 16 bit word to write
	{
		putbyte(fout, wd & 0xff);
		putbyte(fout, (wd >> 8) & 0xff);
	}
	//!\brief Write an array of characters to binary file,
	//!tracking checksum
	//!
	inline void putbytes(
		std::ofstream &fout,		//!< Binary output stream
		const unsigned char *ch,	//!< Pointer to first byte
		unsigned int length)		//!< Number of bytes to write
	{
		while(length--)
		{
			putbyte(fout, *ch++);
		}
	}

	//!\bried output checksum to binary file
	//
	inline void putchecksum(
		std::ofstream &fout)	//!< stream to write to open
	       				//! in binary mode.
	{
		fout.put(checksum & 0xff);
		checksum = 0;
	}

};

//**********************************************************************
// link11util.cc
//**********************************************************************

std::string derad50(int x);

//!\brief convert 4 bytes to 6 radix50 characters.
//!
//! Common occurrence, so make it easier to code.
//!
//!\returns a 6 character std::string.
//
inline std::string derad504(
	unsigned char a,	//!< 1st vyte
	unsigned char b,	//!< 2nd byte
	unsigned char c,	//!< 3rd byte
	unsigned char d)	//!< 4th byte
{
	return derad50(a + (b << 8)) + derad50(c + (d << 8));
}

//!\brief convert 4 bytes to 6 radix50 characters.
//!
//! Common occurrence, so make it easier to code.
//!
//!]returns a 6 character std::string.
//
inline std::string derad504b(
	const unsigned char* a)	//!< Pointer to 4 bytes of radix50 characters
{
	return derad504(a[0], a[1], a[2], a[3]);
}

//!\brief Read one word (two bytes) from the object file
//!
//! Reads one word of data (2 bytes) from an object wil,
//! and handles the endianess of the data.
//!
//!\returns one word (16 bytes) integer.
//!
inline unsigned int deword(
	const unsigned char *a)		//!< Pointer to two bytes of data
{
	return a[0] + (a[1] << 8);
}

//!\brief Read one word (two bytes) from the object file
//!
//! Reads one word of data (2 bytes) from an object wil,
//! and handles the endianess of the data.
//!
//!\returns one word (16 bytes) integer.
//!
inline unsigned int deword(
	const unsigned char a,		//!< 1st byte
	const unsigned char b)		//!< 2nd byte
{
	return a + (b << 8);
}

//!\brief write word into pointer
//
inline void enword(unsigned char *ptr, unsigned int value)
{
	ptr[0] = value & 0xff;
	ptr[1] = (value >> 8) & 0xff;
}

std::string psect_attr(unsigned int attr);
std::string symbol_attr(unsigned int attr);

#endif


text:
<picture>
<source media="(max-width: 1000px)" srcset="{{site.baseurl}}/img/team-medium-1px.png 1x,
{{site.baseurl}}/img/team-medium-2px.png 2x">

<source media="(min-width: 1001px)" srcset="{{site.baseurl}}/img/team1px.png 1x,
{{site.baseurl}}/img/team.png 2x">

<img src="{{site.baseurl}}/img/team.png" alt="">

</picture>


text:
module OTT where

import Control.Monad

import Test.Tasty
import Test.Tasty.HUnit

import Kit.MissingLibrary
import Cochon.Model
import Evidences.Eval
import Evidences.Tm
import Evidences.PropositionalEquality
import Evidences.Operators
import ProofState.Edition.ProofContext
import Tactics.Record

import ProofState.Edition.Navigation
import Control.Applicative
import Cochon.PrettyProofState
import DisplayLang.Name
import DisplayLang.DisplayTm
import ProofState.Edition.GetSet
import ProofState.Interface.Name
import ProofState.Interface.NameResolution
import ProofState.Interface.Search
import ProofState.Edition.ProofState

coeCase :: Can VAL -> Can VAL -> VAL -> VAL -> VAL -> Assertion
coeCase a b p t expected = case halfZip a b of
    Nothing -> assertFailure "couldn't halfzip"
    Just z -> case coerce z p t of
        Left neu -> assertFailure "couldn't coerce"
        Right val -> assertEqual "" val expected

-- take two types, a proof they're equal, and a value,
-- and the expected resulting value of the second type and the expected proof
-- it's equal to the original value
coehCase :: TY -> TY -> VAL -> VAL -> VAL -> VAL -> Assertion
coehCase s t q v expectedVal expectedProof =
    assertEqual "" (coeh s t q v) (expectedVal, expectedProof)

propEqCase :: (TY :>: VAL) -> (TY :>: VAL) -> VAL -> Assertion
propEqCase v1 v2 expected =
    assertEqual "<->" expected (v1 <-> v2)

tests :: TestTree
tests = testGroup "OTT"

    [ testGroup "coe"
        [ testCase "coe empty empty"
            (coeCase (EnumT NILE) (EnumT NILE) (PRF TRIVIAL) ABSURD ABSURD)
        , testCase "coe unit unit"
            (coeCase Unit Unit (PRF TRIVIAL) VOID VOID)
        , testCase "coe unit unit"
            (coeCase Unit Unit (BOX (Irr (INH UNIT))) TRIVIAL TRIVIAL)
        -- , testCase "coe bool bool"
        --     (coeCase Unit Unit (PRF TRIVIAL) TRIVIAL TRIVIAL)
        ]

    , testGroup "coeh"
        [ testCase "coeh" $

            -- bleh, this is not right
            coehCase
                SET SET (N $ P refl $:$ [A SET, A UNIT]) UNIT
                UNIT (N $ P refl $:$ [A SET, A UNIT])

        ]

    , testGroup "propositional equality operator"
        [ testCase "Empty <-> Empty ~> trivial" $
            assertEqual "<->" TRIVIAL $ (UNIT :>: VOID) <-> (UNIT :>: VOID)

        , testCase "Unit <-> Unit ~> trivial" $
            assertEqual "<->" TRIVIAL $ (SET :>: UNIT) <-> (SET :>: UNIT)

        , testCase "P <-> Q ~> (P => Q) and (Q => P)" $
            -- p and q are meaningless -- "a proof of this bound variable
            -- implies a proposition
            let p = IMP (PRF (INH (NV 0))) PROP
                q = IMP (PRF (INH (NV 1))) PROP

                -- but the important thing is that equality reduction turns it
                -- into a couple implications
                result = AND (IMP p q) (IMP q p)
            in assertEqual "<->" result $ (PROP :>: p) <-> (PROP :>: q)

        -- TODO(joel) - I'm really not sure this is right...
        , testCase "(P x Q) <-> (Q x P) ~> trivial" $
            let p = IMP (PRF (INH (NV 0))) PROP
                q = IMP (PRF (INH (NV 1))) PROP
                left = PAIR p q
                right = PAIR q p
                ty = PRF (AND PROP PROP)
                result = TRIVIAL

            in assertEqual "<->" result $ (ty :>: left) <-> (ty :>: right)

--         , testCase "(A -> B) <-> (A -> B) ~> ?" $
--             let a = NV 1
--                 b = NV 0
--                 aTy = NV 4
--                 bTy = NV 3
--                 lam = LAV "a" b
--                 arr = PI aTy (LK bTy)
--                 expected = ALL aTy $ L "s1" $
--                     ALL aTy $ "s2" $
--                         IMP (EQBLUE aTy :>: NV 1) (...
--             in assertEqual "<->" ABSURD $ (arr :>: lam) <-> (arr :>: lam)

        , testCase "Can <-> Can ~> absurd" $
            assertEqual "<->" ABSURD $ (SET :>: UNIT) <-> (SET :>: SET)
        ]
    ]


text:
class Pair ;
class Center ;

class Measure
{
public:
    Measure() ;

    double single_Distance( Center center, Pair point ) ;
    double  total_Distance( Center center, std::vector<Pair> points, bool forAllPairs=false ) ;
    double  all_totalDistances( std::vector<Center> centers, std::vector<Pair> points ) ;
    double std_deviation( Center center, std::vector<Pair> points, bool forAllPairs=false );

    void set_closest_center( Pair* p_point, std::vector<Center> centers, int display = -1 ) ;
};


text:
exports.name = '.unfanme';
exports.hidden = false;
exports.enabled = true;
exports.matchStart = false;
exports.handler = function(data) {
    bot.removeFan(data.userid);
    var response = ('Whatever, psycho ' + data.name + '.');
    output({text: response, destination: data.source, userid: data.userid});
}


text:
package org.apache.carbondata.spark.testsuite.allqueries

import java.io.File

import org.scalatest.BeforeAndAfterAll

import org.apache.spark.sql.SaveMode
import org.apache.spark.sql.test.util.QueryTest

import org.apache.carbondata.core.constants.CarbonCommonConstants
import org.apache.carbondata.core.util.CarbonProperties

/**
  * Test Class for all query on multiple datatypes
  *
  */
class MeasureOnlyTableTestCases extends QueryTest with BeforeAndAfterAll {

  val rootPath = new File(this.getClass.getResource("/").getPath
    + "../../../..").getCanonicalPath
  val path = s"$rootPath/examples/spark2/src/main/resources/data.csv"
  override def beforeAll {
    clean
    sql(s"""
               | CREATE TABLE carbon_table(
               | shortField SMALLINT,
               | intField INT,
               | bigintField BIGINT,
               | doubleField DOUBLE,
               | floatField FLOAT,
               | decimalField DECIMAL(18,2)
               | )
               | STORED BY 'carbondata'
             """.stripMargin)

          val path = s"$rootPath/examples/spark2/src/main/resources/data.csv"

          sql(
            s"""
               | LOAD DATA LOCAL INPATH '$path'
               | INTO TABLE carbon_table
               | OPTIONS('FILEHEADER'='shortField,intField,bigintField,doubleField,stringField,timestampField,decimalField,dateField,charField,floatField,complexData',
               | 'COMPLEX_DELIMITER_LEVEL_1'='#')
             """.stripMargin)

    sql("create table if not exists carbon_table_hive (shortField SMALLINT,intField INT," +
      "bigintField BIGINT,doubleField DOUBLE,stringField STRING,timestampField TIMESTAMP," +
      "decimalField DECIMAL(18,2),dateField DATE,charField CHAR(5),floatField FLOAT,complexData ARRAY<STRING>)row format delimited fields terminated by ','")
    sql(s"""LOAD DATA LOCAL INPATH '$path' INTO table carbon_table_hive""")
  }

  def clean {
    sql("drop table if exists carbon_table")
    sql("drop table if exists carbon_table_hive")
  }

  override def afterAll {
    clean
    CarbonProperties.getInstance()
      .addProperty(CarbonCommonConstants.CARBON_TIMESTAMP_FORMAT, "dd-MM-yyyy")
  }

  test("SELECT sum(intField) FROM carbon_table where intField > 10") {
    checkAnswer(
      sql("SELECT sum(intField) FROM carbon_table where intField > 10"),
      sql("SELECT sum(intField) FROM carbon_table_hive where intField > 10")
    )
  }

  test("SELECT sum(intField),sum(doubleField) FROM carbon_table where intField > 10 OR doubleField > 10") {
    checkAnswer(
      sql("SELECT sum(intField),sum(doubleField) FROM carbon_table where intField > 10 OR " +
      "doubleField > 10"),
      sql("SELECT sum(intField),sum(doubleField) FROM carbon_table_hive where intField > 10 OR " +
        "doubleField > 10")
    )
  }

  test("SELECT sum(decimalField) FROM carbon_table") {
    checkAnswer(
      sql("SELECT sum(decimalField) FROM carbon_table"),
      sql("SELECT sum(decimalField) FROM carbon_table_hive")
    )
  }

  test("SELECT count(*), sum(intField) FROM carbon_table where intField > 10") {
    checkAnswer(
    sql("SELECT count(*), sum(intField) FROM carbon_table where intField > 10"),
      sql("SELECT count(*), sum(intField) FROM carbon_table_hive where intField > 10")
    )
  }

  test("SELECT count(*), sum(decimalField) b FROM carbon_table order by b") {
    checkAnswer(
    sql("SELECT count(*), sum(decimalField) b FROM carbon_table order by b"),
      sql("SELECT count(*), sum(decimalField) b FROM carbon_table_hive order by b")
    )
  }

  test("SELECT intField, sum(floatField) total FROM carbon_table group by intField order by " +
    "total") {
    checkAnswer(
    sql("SELECT intField, sum(floatField) total FROM carbon_table group by intField order by " +
      "total"),
      sql("SELECT intField, sum(floatField) total FROM carbon_table_hive group by intField order " +
        "by total")
    )
  }

  test("select shortField, avg(intField+ 10) as a from carbon_table group by shortField") {
    checkAnswer(
      sql("select shortField, avg(intField+ 10) as a from carbon_table group by shortField"),
      sql("select shortField, avg(intField+ 10) as a from carbon_table_hive group by shortField")
    )
  }

  test("select shortField, avg(intField+ 10) as a from carbon_table group by shortField order by " +
    "a") {
    checkAnswer(
      sql("select shortField, avg(intField+ 10) as a from carbon_table group by shortField order " +
        "by a"),
      sql("select shortField, avg(intField+ 10) as a from carbon_table_hive group by shortField " +
        "order by a")
    )
  }

  test("select shortField, avg(intField+ intField) as a from carbon_table group by shortField " +
    "order by a") {
    checkAnswer(
      sql("select shortField, avg(intField+ intField) as a from carbon_table group by shortField order " +
        "by a"),
      sql("select shortField, avg(intField+ intField) as a from carbon_table_hive group by " +
        "shortField order by a")
    )

  }

  test("select shortField, count(intField+ 10) as a from carbon_table group by shortField order " +
    "by a") {
    checkAnswer(
      sql("select shortField, count(intField+ 10) as a from carbon_table group by shortField " +
        "order by a"),
      sql("select shortField, count(intField+ 10) as a from carbon_table_hive group by shortField" +
        " order by a")
    )
  }

  test("select shortField, min(intField+ 10) as a from carbon_table group by shortField order " +
    "by a") {
    checkAnswer(
      sql("select shortField, min(intField+ 10) as a from carbon_table group by shortField " +
        "order by a"),
      sql("select shortField, min(intField+ 10) as a from carbon_table_hive group by shortField " +
        "order by a")
    )
  }

  test("select shortField, max(intField+ 10) as a from carbon_table group by shortField order " +
    "by a") {
    checkAnswer(
      sql("select shortField, count(intField+ 10) as a from carbon_table group by shortField " +
        "order by a"),
      sql("select shortField, count(intField+ 10) as a from carbon_table_hive group by shortField" +
        " order by a")
    )
  }

  test("select shortField, sum(distinct intField) + 10 as a from carbon_table group by shortField" +
    "order by a") {
    checkAnswer(
      sql("select shortField, sum(distinct intField) + 10 as a from carbon_table group by " +
        "shortField order by a"),
      sql("select shortField, sum(distinct intField) + 10 as a from carbon_table_hive group by " +
        "shortField order by a")
    )
  }

  test("select sum(doubleField) + 7.28 as a, intField from carbon_table group by intField") {
    checkAnswer(
      sql("select sum(doubleField) + 7.28 as a, intField from carbon_table group by intField"),
      sql("select sum(doubleField) + 7.28 as a, intField from carbon_table_hive group by intField")
    )
  }

  test("select count(floatField) + 7.28 a, intField from carbon_table group by intField") {
    checkAnswer(
      sql("select count(floatField) + 7.28 a, intField from carbon_table group by intField"),
      sql("select count(floatField) + 7.28 a, intField from carbon_table_hive group by intField")
    )
  }

  test("select count(distinct floatField) + 7.28 a, intField from carbon_table group by " +
    "intField") {
    checkAnswer(
      sql("select count(distinct floatField) + 7.28 a, intField from carbon_table group by intField"),
      sql("select count(distinct floatField) + 7.28 a, intField from carbon_table_hive group" +
        " by intField")
    )
  }

  test("select count (if(doubleField>100,NULL,doubleField))  a from carbon_table") {
    checkAnswer(
      sql("select count (if(doubleField>100,NULL,doubleField))  a from carbon_table"),
      sql("select count (if(doubleField>100,NULL,doubleField))  a from carbon_table_hive")
    )
  }

  test("select count (if(decimalField>100,NULL,decimalField))  a from carbon_table") {
    checkAnswer(
      sql("select count (if(decimalField>100,NULL,decimalField))  a from carbon_table"),
      sql("select count (if(decimalField>100,NULL,decimalField))  a from carbon_table_hive")
    )
  }

  test("select avg (if(floatField>100,NULL,floatField))  a from carbon_table") {
    checkAnswer(
      sql("select avg (if(floatField>100,NULL,floatField))  a from carbon_table"),
      sql("select avg (if(floatField>100,NULL,floatField))  a from carbon_table_hive")
    )
  }

  test("select min (if(intField>100,NULL,intField))  a from carbon_table") {
    checkAnswer(
      sql("select min (if(intField>3,NULL,intField))  a from carbon_table"),
      sql("select min (if(intField>3,NULL,intField))  a from carbon_table_hive")
    )
  }

  test("select max (if(intField>5,NULL,intField))  a from carbon_table")({
    checkAnswer(
      sql("select max (if(intField>5,NULL,intField))  a from carbon_table"),
      sql("select max (if(intField>5,NULL,intField))  a from carbon_table_hive")
    )
  })

  test("select variance(doubleField) as a from carbon_table")({
    checkAnswer(
      sql("select variance(doubleField) as a from carbon_table"),
      sql("select variance(doubleField) as a from carbon_table_hive")
    )
  })

  test("select var_samp(doubleField) as a  from carbon_table")({
    checkAnswer(
      sql("select var_samp(doubleField) as a  from carbon_table"),
      sql("select var_samp(doubleField) as a  from carbon_table_hive")
    )
  })

  test("select stddev_pop(doubleField) as a  from carbon_table")({
    checkAnswer(
      sql("select stddev_pop(doubleField) as a  from carbon_table"),
      sql("select stddev_pop(doubleField) as a  from carbon_table_hive")
    )
  })

  //TC_106
  test("select stddev_samp(doubleField)  as a from carbon_table")({
    checkAnswer(
      sql("select stddev_samp(doubleField)  as a from carbon_table"),
      sql("select stddev_samp(doubleField)  as a from carbon_table_hive")
    )
  })

  test("select covar_pop(doubleField,doubleField) as a  from carbon_table")({
    checkAnswer(
      sql("select covar_pop(doubleField,doubleField) as a  from carbon_table"),
      sql("select covar_pop(doubleField,doubleField) as a  from carbon_table_hive")
    )
  })

  test("select covar_samp(doubleField,doubleField) as a  from carbon_table")({
    checkAnswer(
      sql("select covar_samp(doubleField,doubleField) as a  from carbon_table"),
      sql("select covar_samp(doubleField,doubleField) as a  from carbon_table_hive")
    )
  })

  test("select corr(doubleField,doubleField)  as a from carbon_table")({
    checkAnswer(
      sql("select corr(doubleField,doubleField)  as a from carbon_table"),
      sql("select corr(doubleField,doubleField)  as a from carbon_table_hive")
    )
  })

  test("select percentile(bigintField,0.2) as  a  from carbon_table")({
    checkAnswer(
      sql("select percentile(bigintField,0.2) as  a  from carbon_table"),
      sql("select percentile(bigintField,0.2) as  a  from carbon_table_hive"))
  })

  test("select last(doubleField) a from carbon_table")({
    checkAnswer(
      sql("select last(doubleField) a from carbon_table"),
      sql("select last(doubleField) a from carbon_table_hive")
    )
  })

  test("select intField from carbon_table where carbon_table.intField IN (3,2)")({
    checkAnswer(
      sql("select intField from carbon_table where carbon_table.intField IN (3,2)"),
      sql("select intField from carbon_table_hive where carbon_table_hive.intField IN (3,2)")
    )
  })

  test("select intField from carbon_table where carbon_table.intField NOT IN (3,2)")({
    checkAnswer(
      sql("select intField from carbon_table where carbon_table.intField NOT IN (3,2)"),
      sql("select intField from carbon_table_hive where carbon_table_hive.intField NOT IN (3,2)")
    )
  })

  test("select intField,sum(floatField) a from carbon_table group by intField order by a " +
    "desc")({
    checkAnswer(
      sql("select intField,sum(floatField) a from carbon_table group by intField order by " +
        "a desc"),
      sql("select intField,sum(floatField) a from carbon_table_hive group by intField order by " +
        "a desc")
    )
  })

  test("select intField,sum(floatField) a from carbon_table group by intField order by a" +
    " asc")({
    checkAnswer(
      sql("select intField,sum(floatField) a from carbon_table group by intField order by " +
        "a asc"),
      sql("select intField,sum(floatField) a from carbon_table_hive group by intField order by " +
        "a asc")
    )
  })

  test("select doubleField from carbon_table where doubleField NOT BETWEEN intField AND floatField")({
    checkAnswer(
      sql("select doubleField from carbon_table where doubleField NOT BETWEEN intField AND floatField"),
      sql("select doubleField from carbon_table_hive where doubleField NOT BETWEEN intField AND " +
        "floatField")
    )
  })

  test("select cast(doubleField as int) as a from carbon_table limit 10")({
    checkAnswer(
      sql("select cast(doubleField as int) as a from carbon_table limit 10"),
      sql("select cast(doubleField as int) as a from carbon_table_hive limit 10")
    )
  })

  test("select percentile_approx(1, 0.5 ,5000) from carbon_table")({
    checkAnswer(
      sql("select percentile_approx(1, 0.5 ,5000) from carbon_table"),
      sql("select percentile_approx(1, 0.5 ,5000) from carbon_table_hive")
    )
  })

  test("CARBONDATA-60-union-defect")({
    sql("drop table if exists carbonunion")
    import sqlContext.implicits._
    val df = sqlContext.sparkContext.parallelize(1 to 1000).map(x => (x, (x+100))).toDF("c1", "c2")
    df.createOrReplaceTempView("sparkunion")
    df.write
      .format("carbondata")
      .mode(SaveMode.Overwrite)
      .option("tableName", "carbonunion")
      .save()
    checkAnswer(
      sql("select c1,count(c1) from (select c1 as c1,c2 as c2 from carbonunion union all select c2 as c1,c1 as c2 from carbonunion)t where c1=200 group by c1"),
      sql("select c1,count(c1) from (select c1 as c1,c2 as c2 from sparkunion union all select c2 as c1,c1 as c2 from sparkunion)t where c1=200 group by c1"))
    sql("drop table if exists carbonunion")
  })

  test("select b.intField from carbon_table a join carbon_table b on a.intField=b.intField")({
    checkAnswer(
      sql("select b.intField from carbon_table a join carbon_table b on a.intField=b.intField"),
      sql("select b.intField from carbon_table_hive a join carbon_table_hive b on a.intField=b.intField"))
  })
}


text:
require 'json'

def hello(event:, context:)
  { body: JSON.generate({'message' => 'Hello Ruby!'}), statusCode: 200 }
end


text:
// .NAME vtkCaptionActor2D - draw text label associated with a point
// .SECTION Description
// vtkCaptionActor2D is a hybrid 2D/3D actor that is used to associate text
// with a point (the AttachmentPoint) in the scene. The caption can be
// drawn with a rectangular border and a leader connecting
// the caption to the attachment point. Optionally, the leader can be
// glyphed at its endpoint to create arrow heads or other indicators.
//
// To use the caption actor, you normally specify the Position and Position2
// coordinates (these are inherited from the vtkActor2D superclass). (Note
// that Position2 can be set using vtkActor2D's SetWidth() and SetHeight()
// methods.)  Position and Position2 define the size of the caption, and a
// third point, the AttachmentPoint, defines a point that the caption is
// associated with.  You must also define the caption text,
// whether you want a border around the caption, and whether you want a
// leader from the caption to the attachment point. The font attributes of
// the text can be set through the vtkTextProperty associated to this actor.
// You also indicate whether you want
// the leader to be 2D or 3D. (2D leaders are always drawn over the
// underlying geometry. 3D leaders may be occluded by the geometry.) The
// leader may also be terminated by an optional glyph (e.g., arrow).
//
// The trickiest part about using this class is setting Position, Position2,
// and AttachmentPoint correctly. These instance variables are
// vtkCoordinates, and can be set up in various ways. In default usage, the
// AttachmentPoint is defined in the world coordinate system, Position is the
// lower-left corner of the caption and relative to AttachmentPoint (defined
// in display coordaintes, i.e., pixels), and Position2 is relative to
// Position and is the upper-right corner (also in display
// coordinates). However, the user has full control over the coordinates, and
// can do things like place the caption in a fixed position in the renderer,
// with the leader moving with the AttachmentPoint.

// .SECTION See Also
// vtkLegendBoxActor vtkTextMapper vtkTextActor vtkTextProperty
// vtkCoordinate

#ifndef vtkCaptionActor2D_h
#define vtkCaptionActor2D_h

#include "vtkRenderingAnnotationModule.h" // For export macro
#include "vtkActor2D.h"

class vtkActor;
class vtkAlgorithmOutput;
class vtkAppendPolyData;
class vtkCaptionActor2DConnection;
class vtkGlyph2D;
class vtkGlyph3D;
class vtkPolyData;
class vtkPolyDataMapper2D;
class vtkPolyDataMapper;
class vtkTextActor;
class vtkTextMapper;
class vtkTextProperty;

class VTKRENDERINGANNOTATION_EXPORT vtkCaptionActor2D : public vtkActor2D
{
public:
  vtkTypeMacro(vtkCaptionActor2D,vtkActor2D);
  void PrintSelf(ostream& os, vtkIndent indent);

  static vtkCaptionActor2D *New();

  // Description:
  // Define the text to be placed in the caption. The text can be multiple
  // lines (separated by "\n").
  virtual void SetCaption(const char* caption);
  virtual char* GetCaption();

  // Description:
  // Set/Get the attachment point for the caption. By default, the attachment
  // point is defined in world coordinates, but this can be changed using
  // vtkCoordinate methods.
  vtkWorldCoordinateMacro(AttachmentPoint);

  // Description:
  // Enable/disable the placement of a border around the text.
  vtkSetMacro(Border,int);
  vtkGetMacro(Border,int);
  vtkBooleanMacro(Border,int);

  // Description:
  // Enable/disable drawing a "line" from the caption to the
  // attachment point.
  vtkSetMacro(Leader,int);
  vtkGetMacro(Leader,int);
  vtkBooleanMacro(Leader,int);

  // Description:
  // Indicate whether the leader is 2D (no hidden line) or 3D (z-buffered).
  vtkSetMacro(ThreeDimensionalLeader,int);
  vtkGetMacro(ThreeDimensionalLeader,int);
  vtkBooleanMacro(ThreeDimensionalLeader,int);

  // Description:
  // Specify a glyph to be used as the leader "head". This could be something
  // like an arrow or sphere. If not specified, no glyph is drawn. Note that
  // the glyph is assumed to be aligned along the x-axis and is rotated about
  // the origin. SetLeaderGlyphData() directly uses the polydata without
  // setting a pipeline connection. SetLeaderGlyphConnection() sets up a
  // pipeline connection and causes an update to the input during render.
  virtual void SetLeaderGlyphData(vtkPolyData*);
  virtual void SetLeaderGlyphConnection(vtkAlgorithmOutput*);
  virtual vtkPolyData* GetLeaderGlyph();

  // Description:
  // Specify the relative size of the leader head. This is expressed as a
  // fraction of the size (diagonal length) of the renderer. The leader
  // head is automatically scaled so that window resize, zooming or other
  // camera motion results in proportional changes in size to the leader
  // glyph.
  vtkSetClampMacro(LeaderGlyphSize,double,0.0,0.1);
  vtkGetMacro(LeaderGlyphSize,double);

  // Description:
  // Specify the maximum size of the leader head (if any) in pixels. This
  // is used in conjunction with LeaderGlyphSize to cap the maximum size of
  // the LeaderGlyph.
  vtkSetClampMacro(MaximumLeaderGlyphSize,int,1,1000);
  vtkGetMacro(MaximumLeaderGlyphSize,int);

  // Description:
  // Set/Get the padding between the caption and the border. The value
  // is specified in pixels.
  vtkSetClampMacro(Padding, int, 0, 50);
  vtkGetMacro(Padding, int);

  // Description:
  // Get the text actor used by the caption. This is useful if you want to control
  // justification and other characteristics of the text actor.
  vtkGetObjectMacro(TextActor,vtkTextActor);

  // Description:
  // Set/Get the text property.
  virtual void SetCaptionTextProperty(vtkTextProperty *p);
  vtkGetObjectMacro(CaptionTextProperty,vtkTextProperty);

  // Description:
  // Shallow copy of this scaled text actor. Overloads the virtual
  // vtkProp method.
  void ShallowCopy(vtkProp *prop);

  // Description:
  // Enable/disable whether to attach the arrow only to the edge,
  // NOT the vertices of the caption border.
  vtkSetMacro(AttachEdgeOnly,int);
  vtkGetMacro(AttachEdgeOnly,int);
  vtkBooleanMacro(AttachEdgeOnly,int);

  // Description:
  // WARNING: INTERNAL METHOD - NOT INTENDED FOR GENERAL USE
  // DO NOT USE THIS METHOD OUTSIDE OF THE RENDERING PROCESS.
  // Release any graphics resources that are being consumed by this actor.
  // The parameter window could be used to determine which graphic
  // resources to release.
  virtual void ReleaseGraphicsResources(vtkWindow *);

  // Description:
  // WARNING: INTERNAL METHOD - NOT INTENDED FOR GENERAL USE
  // DO NOT USE THIS METHOD OUTSIDE OF THE RENDERING PROCESS.
  // Draw the legend box to the screen.
  int RenderOpaqueGeometry(vtkViewport* viewport);
  virtual int RenderTranslucentPolygonalGeometry(vtkViewport* ) {return 0;}
  int RenderOverlay(vtkViewport* viewport);

  // Description:
  // Does this prop have some translucent polygonal geometry?
  virtual int HasTranslucentPolygonalGeometry();

protected:
  vtkCaptionActor2D();
  ~vtkCaptionActor2D();

  vtkCoordinate *AttachmentPointCoordinate;

  int   Border;
  int   Leader;
  int   ThreeDimensionalLeader;
  double LeaderGlyphSize;
  int   MaximumLeaderGlyphSize;

  int   Padding;
  int   AttachEdgeOnly;

private:
  vtkTextActor        *TextActor;
  vtkTextProperty     *CaptionTextProperty;

  vtkPolyData         *BorderPolyData;
  vtkPolyDataMapper2D *BorderMapper;
  vtkActor2D          *BorderActor;

  vtkPolyData         *HeadPolyData;    // single attachment point for glyphing
  vtkGlyph3D          *HeadGlyph;       // for 3D leader
  vtkPolyData         *LeaderPolyData;  // line represents the leader
  vtkAppendPolyData   *AppendLeader;    // append head and leader

  // for 2D leader
  vtkCoordinate       *MapperCoordinate2D;
  vtkPolyDataMapper2D *LeaderMapper2D;
  vtkActor2D          *LeaderActor2D;

  // for 3D leader
  vtkPolyDataMapper   *LeaderMapper3D;
  vtkActor            *LeaderActor3D;

  vtkCaptionActor2DConnection* LeaderGlyphConnectionHolder;

private:
  vtkCaptionActor2D(const vtkCaptionActor2D&) VTK_DELETE_FUNCTION;
  void operator=(const vtkCaptionActor2D&) VTK_DELETE_FUNCTION;
};

#endif


text:
import configparser
import json
import requests
import time
from datetime import datetime, timezone

class Monitor:
    def __init__(self):
        self.sensors = {}
        self.config = configparser.ConfigParser()
        self.config.read('ipro_vault.ini')
        self.read_config()

    def read_config(self):
        #template
        #   if self.config['sensors'][''] == "1";
        #        from sensors. import
        #        self.sensors['']=

        if self.config['sensors']['temperature'] == "1":
            from sensors.dht11 import DHT11
            self.sensors['temperature']= DHT11()
        if self.config['sensors']['humidity'] == "1":
            # DHT11
            pass

        #BMP_180 reader
        if self.config['sensors']['pressure'] == "1":
            from sensors.BMP180 import BMP180
            self.sensors['pressure']= BMP180()

        #Wet Sensor
        if self.config['sensors']['wet'] == "1":
            from sonsors.Water import Water
            self.sensors['wet']= Water()

        # add other sensors here

        self.server_ip = self.config['server']['ip']
        self.server_port = self.config['server']['port']
        self.location = self.config['information']['location']
        self.serial_number = self.config['information']['serial_number']
        self.interval_min = int(self.config['information']['interval_min'])

    def send_json_to_server(self, sensor_data):
        """
        call getSensorJson to get all the sensor data and relay it
        to the REST Server
        """
        #Notes: POST should we also do authentication with a secret key?
        url = 'http://'+str(self.server_ip + ":" + self.server_port + "/api/sensor_data/"+str(self.serial_number))
        payload = {'location': self.location,
                  'serial_number':int(self.serial_number),
                  'datetime': datetime.now(timezone.utc).isoformat()}
        payload.update(sensor_data)
        print(payload)
        headers = {'content-type': 'application/json'}
        try:
            response = requests.post(url, data=json.dumps(payload), headers=headers)
        except:
            # we need to log this since there was an issue sending the data
            print("ERROR: Failed to send data")
            pass

    def get_sensor_data(self):
        """
        walk through the sensor object array
        and call getJson to get the values
        return
        """
        sensor_data = {}
        for key, value in self.sensors.items():
            sensor_data.update(value.get_json())

        return sensor_data

    def run(self):
        while True:
            time.sleep(self.interval_min)
            data = self.get_sensor_data()
            self.send_json_to_server(sensor_data=data)
            print(data)

if __name__ == "__main__":
    mon = Monitor()
    mon.run()


text:
namespace tamproxy {

struct Packet {
public:
    uint16_t id;
    uint8_t dest;
    std::vector<uint8_t> payload;
};

}
#endif


text:
require 'wavefile'
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')

describe SPBlocks::WavOutBlock do
  describe 'writing a file' do
    it 'should write values that can be read back later' do
      filename = "file_out_block_spec.wav"
      block = SPBlocks::WavOutBlock.new :sample_rate => 22050
      block.in_ports["FILE"].exec_command :open, filename
      values = [0.1,0.2,0.3,0.4,0.5]
      block.in_ports["INPUT"].enqueue_values values
      block.step values.count
      block.in_ports["FILE"].exec_command :close, nil

      reader = WaveFile::Reader.new(filename).each_buffer(values.size) do |buffer|
        converted_samples = buffer.samples.map {|sample| sample.to_f / SPBlocks::WavOutBlock::MAX_SAMPLE_VALUE }
        converted_samples.each_index do |i|
          converted_samples[i].should be_within(1e-9).of(values[i])
        end
      end
    end
  end
end


text:
package com.nfl.glitr.registry.datafetcher;

import graphql.schema.DataFetcher;

import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import java.lang.annotation.Annotation;
import java.lang.reflect.Field;
import java.lang.reflect.Method;

public interface AnnotationBasedDataFetcherFactory {

    DataFetcher create(@Nullable Field field, @Nonnull Method method, @Nonnull Class declaringClass, @Nonnull Annotation annotation);
}


text:
package com.datastax.spark.connector.rdd.reader

import com.datastax.driver.core.Row
import com.datastax.spark.connector.{CassandraRowMetadata, ColumnRef}

/** Transforms a Cassandra Java driver `Row` into high-level row representation, e.g. a tuple
  * or a user-defined case class object. The target type `T` must be serializable. */
trait RowReader[T] extends Serializable {

  /** Reads column values from low-level `Row` and turns them into higher level representation.
 *
    * @param row row fetched from Cassandra
    * @param rowMetaData column names and codec available in the `row` */
  def read(row: Row, rowMetaData: CassandraRowMetadata): T

  /** List of columns this `RowReader` is going to read.
    * Useful to avoid fetching the columns that are not needed. */
  def neededColumns: Option[Seq[ColumnRef]]

}


text:
#region New BSD License

// Copyright (c) 2012, John Batte
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification, are permitted
// provided that the following conditions are met:
//
// Redistributions of source code must retain the above copyright notice, this list of conditions
// and the following disclaimer.
//
// Redistributions in binary form must reproduce the above copyright notice, this list of conditions
// and the following disclaimer in the documentation and/or other materials provided with the distribution.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
// WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
// PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
// TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.

#endregion

using System;

namespace Patterns.Runtime
{
	/// <summary>
	/// 	Provides extensions for accessing and manipulating time-oriented constructs like <see cref="DateTime" /> and <see
	///  	cref="TimeSpan" /> .
	/// </summary>
	public static class TimeExtensions
	{
		/// <summary>
		/// 	Returns a <see cref="DateTime" /> with the same <see cref="DateTime.Year" /> , <see cref="DateTime.Month" /> , <see
		///  	cref="DateTime.Day" /> , <see cref="DateTime.Hour" /> , <see cref="DateTime.Minute" /> , and <see
		///  	cref="DateTime.Second" /> values.
		/// </summary>
		/// <param name="value"> The value. </param>
		public static DateTime AccurateToOneSecond(this DateTime value)
		{
			return new DateTime(value.Year, value.Month, value.Day, value.Hour, value.Minute, value.Second);
		}
	}
}


text:
published: true
title: Understanding CORS
tags: web security
---
> First of all, the **cross domain check is performed by the browser**, not the server. - [SO](https://stackoverflow.com/a/25845455/51386)

## [CORS - Why Is It Needed?](https://mobilejazz.com/blog/which-security-risks-do-cors-imply/)

Security Risk Scenario:

In your mail-sending API, api.yourwebsite.com, you decided to let everyone access your API instead of only yourwebsite.com.

If you are using authentication based on session cookies, you probably shouldn't allow CORS requests by everyone. A malicious website can issue e-mail sending requests to api.yoursebsite.com via an AJAX request without the specific permission of your user.

If the user has valid session cookies in their browser, they will be used to authenticate on api.yoursebsite.com and that would lead to unwanted e-mail sending. In most cases, dangerous requests will be "preflighted," which means the domain needs to be approved before they can even send a request. This will prevent any malicious activities from happening.


text:
package com.alekseyzhelo.evilislands.mobplugin.script.misc;

import com.alekseyzhelo.evilislands.mobplugin.script.psi.ScriptTypes;
import com.intellij.lang.BracePair;
import com.intellij.lang.PairedBraceMatcher;
import com.intellij.psi.PsiElement;
import com.intellij.psi.PsiFile;
import com.intellij.psi.tree.IElementType;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

public class EIPairedBraceMatcher implements PairedBraceMatcher {

    private final BracePair[] pairs = new BracePair[]{
            new BracePair(ScriptTypes.LPAREN, ScriptTypes.RPAREN, false)
    };

    @NotNull
    @Override
    public BracePair[] getPairs() {
        return pairs;
    }

    @Override
    public boolean isPairedBracesAllowedBeforeType(@NotNull IElementType lbraceType, @Nullable IElementType contextType) {
        // TODO v2: implement?
        return true;
    }

    @Override
    public int getCodeConstructStart(PsiFile file, int openingBraceOffset) {
        PsiElement element = file.findElementAt(openingBraceOffset);
        if (element == null || element instanceof PsiFile) return openingBraceOffset;

        PsiElement parent = element.getParent();
        if (parent != null) {
            return parent.getTextOffset();
        } else {
            return openingBraceOffset;
        }
    }
}


text:
package org.jasig.schedassist.oraclecalendar;

import java.net.URL;
import java.net.URLClassLoader;

import oracle.calendar.sdk.Api;
import oracle.calendar.sdk.Session;

import org.jasig.schedassist.oraclecalendar.OracleCalendarSDKSupport;
import org.junit.Assert;
import org.junit.Test;

/**
 * Default test case for {@link OracleCalendarSDKSupport}.
 * The testDefault method makes a new subclass of {@link OracleCalendarSDKSupport}
 * that has no implementation. This simply gets the class loaded, and as a result
 * it's static initializer gets run.
 *
 * Once the initializer has been run, it attempts to use some of the Oracle Calendar
 * SDK Apis that require no server configuration; specifically calls to Session.getCapabilities.
 *
 * Once the CSDK has been loaded and the initial tests have passed, a separate {@link ClassLoader}
 * is created to try and replicate the problem calling System.loadLibrary from two isolated
 * {@link ClassLoaders} in a servlet container. This part of the test asserts that an
 * {@link UnsatisfiedLinkError} is thrown by the second call to System.loadLibrary.
 *
 * @author Nicholas Blair, nblair@doit.wisc.edu
 * @version $Id: OracleCalendarSDKSupportTest.java 1821 2010-03-03 19:14:16Z npblair $
 */
public class OracleCalendarSDKSupportTest {

	/**
	 *
	 * @throws Exception
	 */
	@Test
	public void testDefault() throws Exception {
		new OracleCalendarSDKSupport() {};

		Session session = new Session();
		String version = session.getCapabilities(Api.CSDK_FLAG_NONE, Api.CSDK_CAPAB_CSDK_VERSION);
		String capabVersion = session.getCapabilities(Api.CSDK_FLAG_NONE, Api.CSDK_CAPAB_VERSION);
		Assert.assertNotNull(version);
		Assert.assertNotNull(capabVersion);

		System.out.println("CSDK version: " + version);
		System.out.println("CSDK capab version:" + capabVersion);

		// csdkjni has been successfully loaded,
		//now try to instantiate another class that calls System.loadLibrary("csdkjni")
		// with a different classloader
		URL jarUrl = this.getClass().getResource("/test-csdkjni-loader.jar");
		URLClassLoader classLoader = new URLClassLoader(new URL[] { jarUrl  });
		Assert.assertNotSame(classLoader, ClassLoader.getSystemClassLoader());

		try {
			Class<?> clazz = classLoader.loadClass("DuplicateCSDKLoader");
			clazz.newInstance();
			Assert.fail("UnsatisfiedLinkError not thrown");
		} catch (UnsatisfiedLinkError e) {
			// success
		}
	}
}


text:
#include "config.h"
#include "system.h"
#include "coretypes.h"
#include "tree.h"
#include "diagnostic.h"
#include "tree-diagnostic.h"
#include "langhooks.h"
#include "langhooks-def.h"
#include "vec.h"

/* Prints out, if necessary, the name of the current function
   that caused an error.  Called from all error and warning functions.  */
void
diagnostic_report_current_function (diagnostic_context *context,
				    diagnostic_info *diagnostic)
{
  diagnostic_report_current_module (context, diagnostic->location);
  lang_hooks.print_error_function (context, input_filename, diagnostic);
}

void
default_tree_diagnostic_starter (diagnostic_context *context,
				 diagnostic_info *diagnostic)
{
  diagnostic_report_current_function (context, diagnostic);
  pp_set_prefix (context->printer, diagnostic_build_prefix (context,
							    diagnostic));
}

/* This is a pair made of a location and the line map it originated
   from.  It's used in the maybe_unwind_expanded_macro_loc function
   below.  */
typedef struct
{
  const struct line_map *map;
  source_location where;
} loc_map_pair;

DEF_VEC_O (loc_map_pair);
DEF_VEC_ALLOC_O (loc_map_pair, heap);

/* Unwind the different macro expansions that lead to the token which
   location is WHERE and emit diagnostics showing the resulting
   unwound macro expansion trace.  Let's look at an example to see how
   the trace looks like.  Suppose we have this piece of code,
   artificially annotated with the line numbers to increase
   legibility:

    $ cat -n test.c
      1    #define OPERATE(OPRD1, OPRT, OPRD2) \
      2      OPRD1 OPRT OPRD2;
      3
      4    #define SHIFTL(A,B) \
      5      OPERATE (A,<<,B)
      6
      7    #define MULT(A) \
      8      SHIFTL (A,1)
      9
     10    void
     11    g ()
     12    {
     13      MULT (1.0);// 1.0 << 1; <-- so this is an error.
     14    }

   Here is the diagnostic that we want the compiler to generate:

    test.c: In function 'g':
    test.c:5:14: error: invalid operands to binary << (have 'double' and 'int')
    test.c:2:9: note: in expansion of macro 'OPERATE'
    test.c:5:3: note: expanded from here
    test.c:5:14: note: in expansion of macro 'SHIFTL'
    test.c:8:3: note: expanded from here
    test.c:8:3: note: in expansion of macro 'MULT2'
    test.c:13:3: note: expanded from here

   The part that goes from the third to the eighth line of this
   diagnostic (the lines containing the 'note:' string) is called the
   unwound macro expansion trace.  That's the part generated by this
   function.

   If FIRST_EXP_POINT_MAP is non-null, *FIRST_EXP_POINT_MAP is set to
   the map of the location in the source that first triggered the
   macro expansion.  This must be an ordinary map.  */

static void
maybe_unwind_expanded_macro_loc (diagnostic_context *context,
                                 diagnostic_info *diagnostic,
                                 source_location where,
                                 const struct line_map **first_exp_point_map)
{
  const struct line_map *map;
  VEC(loc_map_pair,heap) *loc_vec = NULL;
  unsigned ix;
  loc_map_pair loc, *iter;

  map = linemap_lookup (line_table, where);
  if (!linemap_macro_expansion_map_p (map))
    return;

  /* Let's unwind the macros that got expanded and led to the token
     which location is WHERE.  We are going to store these macros into
     LOC_VEC, so that we can later walk it at our convenience to
     display a somewhat meaningful trace of the macro expansion
     history to the user.  Note that the first macro of the trace
     (which is OPERATE in the example above) is going to be stored at
     the beginning of LOC_VEC.  */

  do
    {
      loc.where = where;
      loc.map = map;

      VEC_safe_push (loc_map_pair, heap, loc_vec, &loc);

      /* WHERE is the location of a token inside the expansion of a
         macro.  MAP is the map holding the locations of that macro
         expansion.  Let's get the location of the token inside the
         context that triggered the expansion of this macro.
         This is basically how we go "down" in the trace of macro
         expansions that led to WHERE.  */
      where = linemap_unwind_toward_expansion (line_table, where, &map);
    } while (linemap_macro_expansion_map_p (map));

  if (first_exp_point_map)
    *first_exp_point_map = map;

  /* Walk LOC_VEC and print the macro expansion trace, unless the
     first macro which expansion triggered this trace was expanded
     inside a system header.  */
  if (!LINEMAP_SYSP (map))
    FOR_EACH_VEC_ELT (loc_map_pair, loc_vec, ix, iter)
      {
        source_location resolved_def_loc = 0, resolved_exp_loc = 0;
        diagnostic_t saved_kind;
        const char *saved_prefix;
        source_location saved_location;

        /* Okay, now here is what we want.  For each token resulting
           from macro expansion we want to show: 1/ where in the
           definition of the macro the token comes from; 2/ where the
           macro got expanded.  */

        /* Resolve the location iter->where into the locus 1/ of the
           comment above.  */
        resolved_def_loc =
          linemap_resolve_location (line_table, iter->where,
                                    LRK_MACRO_DEFINITION_LOCATION, NULL);

        /* Resolve the location of the expansion point of the macro
           which expansion gave the token represented by def_loc.
           This is the locus 2/ of the earlier comment.  */
        resolved_exp_loc =
          linemap_resolve_location (line_table,
                                    MACRO_MAP_EXPANSION_POINT_LOCATION (iter->map),
                                    LRK_MACRO_DEFINITION_LOCATION, NULL);

        saved_kind = diagnostic->kind;
        saved_prefix = context->printer->prefix;
        saved_location = diagnostic->location;

        diagnostic->kind = DK_NOTE;
        diagnostic->location = resolved_def_loc;
        pp_base_set_prefix (context->printer,
                            diagnostic_build_prefix (context,
                                                     diagnostic));
        pp_newline (context->printer);
        pp_printf (context->printer, "in expansion of macro '%s'",
                   linemap_map_get_macro_name (iter->map));
        pp_destroy_prefix (context->printer);

        diagnostic->location = resolved_exp_loc;
        pp_base_set_prefix (context->printer,
                            diagnostic_build_prefix (context,
                                                     diagnostic));
        pp_newline (context->printer);
        pp_printf (context->printer, "expanded from here");
        pp_destroy_prefix (context->printer);

        diagnostic->kind = saved_kind;
        diagnostic->location = saved_location;
        context->printer->prefix = saved_prefix;
      }

  VEC_free (loc_map_pair, heap, loc_vec);
}

/*  This is a diagnostic finalizer implementation that is aware of
    virtual locations produced by libcpp.

    It has to be called by the diagnostic finalizer of front ends that
    uses libcpp and wish to get diagnostics involving tokens resulting
    from macro expansion.

    For a given location, if said location belongs to a token
    resulting from a macro expansion, this starter prints the context
    of the token.  E.g, for multiply nested macro expansion, it
    unwinds the nested macro expansions and prints them in a manner
    that is similar to what is done for function call stacks, or
    template instantiation contexts.  */
void
virt_loc_aware_diagnostic_finalizer (diagnostic_context *context,
				     diagnostic_info *diagnostic)
{
  maybe_unwind_expanded_macro_loc (context, diagnostic,
				   diagnostic->location,
				   NULL);
}


text:
package com.camnter.newlife.ui.activity.easyrecyclerviewsidebar;

import com.camnter.newlife.adapter.easyrecyclerviewsidebar.RoundImageSectionAdapter;
import com.camnter.newlife.bean.Contacts;
import com.camnter.newlife.constant.Constant;
import java.util.List;

/**
 * Description:RoundImageSectionActivity
 * Created by:CaMnter
 * Time:2016-04-12 00:02
 */
public class RoundImageSectionActivity extends SectionActivity {

    @Override public void setActivityTitle() {
        this.setTitle("RoundImageSectionActivity");
    }

    @Override public void initAdapter() {
        this.adapter = new RoundImageSectionAdapter();
    }

    @Override public List<Contacts> getData() {
        return Constant.roundImageSectionList;
    }

}


text:
static const size_t kMaxOutputStreams = 50;

static const int kMaxInputChannels = 2;

// Implementation of AudioManager.
bool AudioManagerLinux::HasAudioOutputDevices() {
  // TODO(ajwong): Make this actually query audio devices.
  return true;
}

bool AudioManagerLinux::HasAudioInputDevices() {
  // TODO(satish): Make this actually query audio devices.
  return true;
}

AudioOutputStream* AudioManagerLinux::MakeAudioOutputStream(
    AudioParameters params) {
  // Early return for testing hook.  Do this before checking for
  // |initialized_|.
  if (params.format == AudioParameters::AUDIO_MOCK) {
    return FakeAudioOutputStream::MakeFakeStream(params);
  }

  if (!initialized()) {
    return NULL;
  }

  // Don't allow opening more than |kMaxOutputStreams| streams.
  if (active_streams_.size() >= kMaxOutputStreams) {
    return NULL;
  }

  std::string device_name = AlsaPcmOutputStream::kAutoSelectDevice;
  if (CommandLine::ForCurrentProcess()->HasSwitch(
      switches::kAlsaOutputDevice)) {
    device_name = CommandLine::ForCurrentProcess()->GetSwitchValueASCII(
        switches::kAlsaOutputDevice);
  }
  AlsaPcmOutputStream* stream =
      new AlsaPcmOutputStream(device_name, params, wrapper_.get(), this,
                              GetMessageLoop());

  base::AutoLock l(lock_);
  active_streams_[stream] = scoped_refptr<AlsaPcmOutputStream>(stream);
  return stream;
}

AudioInputStream* AudioManagerLinux::MakeAudioInputStream(
    AudioParameters params) {
  if (!params.IsValid() || params.channels > kMaxInputChannels)
    return NULL;

  if (params.format == AudioParameters::AUDIO_MOCK) {
    return FakeAudioInputStream::MakeFakeStream(params);
  } else if (params.format != AudioParameters::AUDIO_PCM_LINEAR) {
    return NULL;
  }

  if (!initialized())
    return NULL;

  std::string device_name = AlsaPcmOutputStream::kAutoSelectDevice;
  if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kAlsaInputDevice)) {
    device_name = CommandLine::ForCurrentProcess()->GetSwitchValueASCII(
        switches::kAlsaInputDevice);
  }

  AlsaPcmInputStream* stream = new AlsaPcmInputStream(
      device_name, params, wrapper_.get());

  return stream;
}

AudioManagerLinux::AudioManagerLinux() {
}

AudioManagerLinux::~AudioManagerLinux() {
  // Make sure we stop the thread first. If we let the default destructor to
  // destruct the members, we may destroy audio streams before stopping the
  // thread, resulting an unexpected behavior.
  // This way we make sure activities of the audio streams are all stopped
  // before we destroy them.
  audio_thread_.Stop();

  // Free output dispatchers, closing all remaining open streams.
  output_dispatchers_.clear();

  active_streams_.clear();
}

void AudioManagerLinux::Init() {
  AudioManagerBase::Init();
  wrapper_.reset(new AlsaWrapper());
}

void AudioManagerLinux::MuteAll() {
  NOTIMPLEMENTED();
}

void AudioManagerLinux::UnMuteAll() {
  NOTIMPLEMENTED();
}

void AudioManagerLinux::ReleaseOutputStream(AlsaPcmOutputStream* stream) {
  if (stream) {
    base::AutoLock l(lock_);
    active_streams_.erase(stream);
  }
}

bool AudioManagerLinux::CanShowAudioInputSettings() {
  scoped_ptr<base::Environment> env(base::Environment::Create());
  base::nix::DesktopEnvironment desktop = base::nix::GetDesktopEnvironment(
      env.get());
  return (desktop == base::nix::DESKTOP_ENVIRONMENT_GNOME ||
          desktop == base::nix::DESKTOP_ENVIRONMENT_KDE3 ||
          desktop == base::nix::DESKTOP_ENVIRONMENT_KDE4 ||
          desktop == base::nix::DESKTOP_ENVIRONMENT_MEEGO);
}

void AudioManagerLinux::ShowAudioInputSettings() {
  scoped_ptr<base::Environment> env(base::Environment::Create());
  base::nix::DesktopEnvironment desktop = base::nix::GetDesktopEnvironment(
      env.get());
  switch (desktop) {
    case base::nix::DESKTOP_ENVIRONMENT_KDE3:
    case base::nix::DESKTOP_ENVIRONMENT_KDE4: {
      std::string command("kmix");
      base::LaunchApp(CommandLine(FilePath(command)), false, false, NULL);
      } break;
    case base::nix::DESKTOP_ENVIRONMENT_GNOME: {
        std::string command("gnome-volume-control");
        base::LaunchApp(CommandLine(FilePath(command)), false, false, NULL);
      } break;
    case base::nix::DESKTOP_ENVIRONMENT_MEEGO: {
        std::vector<std::string> argv;
        argv.push_back("meego-qml-launcher");
        argv.push_back("--app");
        argv.push_back("meego-ux-settings");
        argv.push_back("--fullscreen");
        argv.push_back("--opengl");
        argv.push_back("--cmd");
        argv.push_back("showPage");
        argv.push_back("--cdata");
        argv.push_back("General");

        base::file_handle_mapping_vector no_files;
        base::environment_vector env_vec;
        base::LaunchApp(argv, env_vec, no_files, false, NULL);
      } break;
    case base::nix::DESKTOP_ENVIRONMENT_OTHER:
    case base::nix::DESKTOP_ENVIRONMENT_XFCE:
    default:
      break;
  }
}

// static
AudioManager* AudioManager::CreateAudioManager() {
  return new AudioManagerLinux();
}


text:
from celery.schedules import crontab

#Schedule daily imports at midnight
CELERYBEAT_SCHEDULE = {
    'import-hotels': {
        'task': 'src.apps.hotel.tasks.import_cities',
        'schedule': crontab(minute=0, hour=0),
        'args': ()
    },
}

CELERY_TIMEZONE = 'UTC'


text:
package com.google.cloud.asset.v1.samples;

// [START asset_v1_generated_assetserviceclient_createfeed_sync]
import com.google.cloud.asset.v1.AssetServiceClient;
import com.google.cloud.asset.v1.CreateFeedRequest;
import com.google.cloud.asset.v1.Feed;

public class SyncCreateFeed {

  public static void main(String[] args) throws Exception {
    syncCreateFeed();
  }

  public static void syncCreateFeed() throws Exception {
    // This snippet has been automatically generated and should be regarded as a code template only.
    // It will require modifications to work:
    // - It may require correct/in-range values for request initialization.
    // - It may require specifying regional endpoints when creating the service client as shown in
    // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
    try (AssetServiceClient assetServiceClient = AssetServiceClient.create()) {
      CreateFeedRequest request =
          CreateFeedRequest.newBuilder()
              .setParent("parent-995424086")
              .setFeedId("feedId-1278410919")
              .setFeed(Feed.newBuilder().build())
              .build();
      Feed response = assetServiceClient.createFeed(request);
    }
  }
}
// [END asset_v1_generated_assetserviceclient_createfeed_sync]


text:
{% extends 'website/base.html' %}
{% load url from future %}
{% load date_diff %}
{% block "yourworkflowsactive" %}class="active"{% endblock %}
{% block 'container' %}

{{stream}}

                        Stream status
                        {% if stream.active %}Active{% else %}Inactive{% endif %}

                        Last heartbeat
                        {{ stream.last_executed|date_diff }}

                        Period
                        {{stream.period}} seconds

                        Workflow
                        {{stream.workflow}}

  {% if stream.active %}
  Deactivate
  {% else %}
  Activate
  {% endif %}
  Reset

Results widgets

    Widget title
    Results

  {% for w in stream.stream_visualization_widgets %}

    {{w}}
    View results

  {% endfor %}

{% endblock %}


text:
import decodeCharacterReferences from 'shared/decodeCharacterReferences';

export default function Triple$toString () {
	return ( this.value != undefined ? decodeCharacterReferences( '' + this.value ) : '' );
}


text:
package opensesim.gui;

/**
 *
 * @author 7u83 <7u83@mail.ru>
 */
public class WaitBox extends javax.swing.JPanel {

    /**
     * Creates new form WaitBox
     */
    public WaitBox() {
        initComponents();
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        progressBar = new javax.swing.JProgressBar();

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
        this.setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(progressBar, javax.swing.GroupLayout.DEFAULT_SIZE, 388, Short.MAX_VALUE)
                .addContainerGap())
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(progressBar, javax.swing.GroupLayout.PREFERRED_SIZE, 39, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
    }// </editor-fold>//GEN-END:initComponents

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JProgressBar progressBar;
    // End of variables declaration//GEN-END:variables
}