text:
#ifndef DRTTYPES_H
#define DRTTYPES_H

#include "dcmtk/config/osconfig.h"   /* make sure OS specific configuration is included first */

#include "dcmtk/ofstd/oftypes.h"
#include "dcmtk/ofstd/ofcond.h"
#include "dcmtk/ofstd/ofvector.h"
#include "dcmtk/oflog/oflog.h"

#include "dcmtk/dcmdata/dctk.h"

#include "dcmtk/ofstd/ofdefine.h"

#ifdef dcmrt_EXPORTS
#define DCMTK_DCMRT_EXPORT DCMTK_DECL_EXPORT
#else
#define DCMTK_DCMRT_EXPORT DCMTK_DECL_IMPORT
#endif

// include this file in doxygen documentation

/** @file drttypes.h
 *  @brief type definitions, constants and helper functions for the dcmrt module
 */

/*-----------------------*
 *  contant definitions  *
 *-----------------------*/

/** @name specific error conditions for module dcmrt.
 *  These error codes can be used in addition to the general purpose
 *  codes defined in module dcmdata.
 */
//@{

/// error: a value is invalid according to the standard
extern DCMTK_DCMRT_EXPORT const OFConditionConst RT_EC_InvalidValue;

/// error: a value is not supported by this implementation
extern DCMTK_DCMRT_EXPORT const OFConditionConst RT_EC_UnsupportedValue;

/// error: the object is invalid, see isValid() method in IOD class
extern DCMTK_DCMRT_EXPORT const OFConditionConst RT_EC_InvalidObject;

//@}

// global definitions for logging mechanism provided by the oflog module

extern DCMTK_DCMRT_EXPORT OFLogger DCM_dcmrtLogger;

#define DCMRT_TRACE(msg) OFLOG_TRACE(DCM_dcmrtLogger, msg)
#define DCMRT_DEBUG(msg) OFLOG_DEBUG(DCM_dcmrtLogger, msg)
#define DCMRT_INFO(msg)  OFLOG_INFO(DCM_dcmrtLogger, msg)
#define DCMRT_WARN(msg)  OFLOG_WARN(DCM_dcmrtLogger, msg)
#define DCMRT_ERROR(msg) OFLOG_ERROR(DCM_dcmrtLogger, msg)
#define DCMRT_FATAL(msg) OFLOG_FATAL(DCM_dcmrtLogger, msg)

/*---------------------*
 *  class declaration  *
 *---------------------*/

/** General purpose class hiding global functions, constants and types from the
 *  global namespace.  Some of them might be moved to 'ofstd' or 'dcmdata' later on.
 *  All functions and constants are static and can, therefore, be accessed without
 *  creating an instance of this class.
 */
class DCMTK_DCMRT_EXPORT DRTTypes
{

  public:

  // --- destructor ---

    /** destructor. (only needed to avoid compiler warnings)
     */
    virtual ~DRTTypes();

  // --- DICOM data structure access functions ---

    /** add given element to the dataset.
     *  The element is only added if 'result' is EC_Normal and the 'element' pointer is not NULL.
     *  @param  result      reference to status variable (checked before adding and updated afterwards!)
     *  @param  dataset     reference to DICOM dataset to which the element should be added
     *  @param  element     pointer to DICOM element which should be added. deleted if not inserted.
     *  @param  vm          value multiplicity (according to the data dictionary) to be checked for.
     *                      (See DcmElement::checkVM() for a list of valid values.)
     *                      Interpreted as cardinality (number of items) for sequence attributes.
     *  @param  type        value type (valid value: "1", "2" or something else which is not checked)
     *  @param  moduleName  optional module name to be printed (default: "RT object" if NULL)
     *  @return current value of 'result', EC_Normal if successful, an error code otherwise
     */
    static OFCondition addElementToDataset(OFCondition &result,
                                           DcmItem &dataset,
                                           DcmElement *element,
                                           const OFString &vm,
                                           const OFString &type,
                                           const char *moduleName = NULL);

    /** get element from dataset
     *  @param  dataset  reference to DICOM dataset from which the element should be retrieved.
     *                   (Would be 'const' if the methods from 'dcmdata' would also be 'const'.)
     *  @param  element  reference to DICOM element which should be retrieved.  The return value
     *                   is also stored in this parameter.
     *  @return status, EC_Normal if successful, an error code otherwise
     */
    static OFCondition getElementFromDataset(DcmItem &dataset,
                                             DcmElement &element);

    /** get string value from element
     *  @param  element      reference to DICOM element from which the string value should be retrieved
     *  @param  stringValue  reference to character string where the result should be stored
     *  @param  pos          index of the value to get (0..vm-1), -1 for all components
     *  @return reference character string if successful, empty string otherwise
     */
    static OFCondition getStringValueFromElement(const DcmElement &element,
                                                 OFString &stringValue,
                                                 const signed long pos = 0);

    /** get string value from dataset
     *  @param  dataset      reference to DICOM dataset from which the string should be retrieved.
     *                       (Would be 'const' if the methods from 'dcmdata' would also be 'const'.)
     *  @param  tagKey       DICOM tag specifying the attribute from which the string should be retrieved
     *  @param  stringValue  reference to character string in which the result should be stored.
     *                       (This parameter is automatically cleared if the tag could not be found.)
     *  @return status, EC_Normal if successful, an error code otherwise
     */
    static OFCondition getStringValueFromDataset(DcmItem &dataset,
                                                 const DcmTagKey &tagKey,
                                                 OFString &stringValue);

    /** put string value to dataset
     *  @param  dataset      reference to DICOM dataset to which the string should be put.
     *  @param  tag          DICOM tag specifying the attribute to which the string should be put
     *  @param  stringValue  character string specifying the value to be set
     *  @param  allowEmpty   allow empty element to be inserted if OFTrue.
     *                       Do not insert empty element otherwise.
     *  @return status, EC_Normal if successful, an error code otherwise
     */
    static OFCondition putStringValueToDataset(DcmItem &dataset,
                                               const DcmTag &tag,
                                               const OFString &stringValue,
                                               const OFBool allowEmpty = OFTrue);

    /** check element value for correct value multiplicity and type
     *  @param  element     DICOM element to be checked
     *  @param  vm          value multiplicity (according to the data dictionary) to be checked for.
     *                      (See DcmElement::checkVM() for a list of valid values.)
     *                      Interpreted as cardinality (number of items) for sequence attributes.
     *  @param  type        value type (valid value: "1", "1C", "2" or something else which is not checked)
     *  @param  searchCond  optional flag indicating the status of a previous 'search' function call
     *  @param  moduleName  optional module name to be printed (default: "RT object" if NULL)
     *  @return OFTrue if element value is correct, OFFalse otherwise
     */
    static OFBool checkElementValue(DcmElement &element,
                                    const OFString &vm,
                                    const OFString &type,
                                    const OFCondition &searchCond = EC_Normal,
                                    const char *moduleName = NULL);

    /** get element from dataset and check it for correct value multiplicity and type.
     *  This functions calls the above one to check the element value.
     *  @param  dataset     reference to DICOM dataset from which the element should be retrieved.
     *                      (Would be 'const' if the methods from 'dcmdata' would also be 'const'.)
     *  @param  element     DICOM element used to store the value
     *  @param  vm          value multiplicity (according to the data dictionary) to be checked for.
     *                      (See DcmElement::checkVM() for a list of valid values.)
     *                      Interpreted as cardinality (number of items) for sequence attributes.
     *  @param  type        value type (valid value: "1", "1C", "2" or something else which is not checked)
     *  @param  moduleName  optional module name to be printed (default: "RT object" if NULL)
     *  @return status, EC_Normal if element could be retrieved and value is correct, an error code otherwise
     */
    static OFCondition getAndCheckElementFromDataset(DcmItem &dataset,
                                                     DcmElement &element,
                                                     const OFString &vm,
                                                     const OFString &type,
                                                     const char *moduleName = NULL);

    /** get string value from dataset and check it for correct value multiplicity and type.
     *  This functions calls the above one to check the element value.
     *  @param  dataset      reference to DICOM dataset from which the element should be retrieved.
     *                       (Would be 'const' if the methods from 'dcmdata' would also be 'const'.)
     *  @param  tagKey       DICOM tag specifying the attribute from which the string should be retrieved
     *  @param  stringValue  reference to character string in which the result should be stored.
     *                       (This parameter is automatically cleared if the tag could not be found.)
     *  @param  vm           value multiplicity (according to the data dictionary) to be checked for.
     *                       (See DcmElement::checkVM() for a list of valid values.)
     *                       Interpreted as cardinality (number of items) for sequence attributes.
     *  @param  type         value type (valid value: "1", "1C", "2" or something else which is not checked)
     *  @param  moduleName   optional module name to be printed (default: "RT object" if NULL)
     *  @return status, EC_Normal if element could be retrieved and value is correct, an error code otherwise
     */
    static OFCondition getAndCheckStringValueFromDataset(DcmItem &dataset,
                                                         const DcmTagKey &tagKey,
                                                         OFString &stringValue,
                                                         const OFString &vm,
                                                         const OFString &type,
                                                         const char *moduleName = NULL);
};

#endif


text:
GWEN
====

A fork of GWEN, a C++ GUI library.

The original library can be found here: https://github.com/garrynewman/GWEN

About
=====

This repository is a fork of GWEN which I use in my personal projects.  Since the original repository no longer appears active, I decided to upload this version.

This fork contains a subset of the original repository's widgets.  If I did not directly need the widget, I removed it.  In addition, the only supported rendering and input systems are both SDL2.

Building
========

For my personal projects, I use CMake.  So, I do not have any solution files to upload which would be of any value.  However, I included a sample CMakeLists file to act as a starting point.  You will need to modify it to operate in your CMake ecosystem.  In addition, you could use the sample CMakeLists file as a guide to integrate the files into your build environment.  Sorry. :(

Integrating
===========

Here's some pseudo code to get started:

```

// Somewhere in your code base while the application is starting up...

// Create the renderer.
gwen_renderer = new Gwen::Renderer::SDL2(...);
gwen_renderer->Initialize();

// Create the skin.
gwen_skin = new Gwen::Skin::TexturedBase(gwen_renderer);
gwen_skin->Initialize(...);

// Create the canvas.
gwen_canvas = new Gwen::Controls::Canvas(gwen_skin);

// Create the input system.
gwen_input = new Gwen::Input::SDL2();
gwen_input->Initialize(gwen_canvas);

...

YourGameLoop()
{
    SDL_Event the_event;
    while (SDL_PollEvent(&the_event))
    {
        // Process events.
        gwen_input->ProcessEvent(the_event);

        ...

    }

    ...

    // Draw the canvas.
    gwen_canvas->RenderCanvas();
}

// Make sure to clean up the pointers.

...

```

In addition, to add a control:

```

button = new Gwen::Controls::Button(gwen_canvas);
button->SetText("Hello World");

```

redpajama_set_name: RedPajamaGithub


text:
---
date: 2015-02-22T04:10:06Z
description: "Hugo 0.13 is the largest Hugo release to date. The release introduced some long sought after features (pagination, sequencing, data loading, tons of template improvements) as well as major internal improvements. In addition to the code changes, the Hugo community has grown significantly and now has over 3000 stars on GitHub, 134 contributors, 24 themes and 1000s of happy users."
title: "Hugo 0.13"
categories: ["Releases"]
---

The v0.13.0 release is the largest Hugo release to date. The release introduced
some long sought after features (pagination, sequencing, data loading, tons of
template improvements) as well as major internal improvements. In addition to
the code changes, the Hugo community has grown significantly and now has over
3000 stars on GitHub, 134 contributors, 24 themes and 1000s of happy users.

This release represents **448 contributions by 65 contributors**

A special shout out to [@bep](https://github.com/bep) and
[@anthonyfok](https://github.com/anthonyfok) for their new role as Hugo
maintainers and their tremendous contributions this release.

### New major features
- Support for [data files](http://gohugo.io/extras/datafiles/) in [YAML](http://yaml.org/),
  [JSON](http://www.json.org/), or [TOML](https://github.com/toml-lang/toml)
  located in the `data` directory ([#885](https://github.com/spf13/hugo/issues/885))
- Support for [dynamic content](http://gohugo.io/extras/dynamiccontent/) by loading JSON & CSV
  from remote sources via GetJson and GetCsv in short codes or other layout
  files ([#748](https://github.com/spf13/hugo/issues/748))
- [Pagination support](http://gohugo.io/extras/pagination/) for home page, sections and
  taxonomies ([#750](https://github.com/spf13/hugo/issues/750))
- Universal sequencing support
  - A new, generic Next/Prev functionality is added to all lists of pages
    (sections, taxonomies, etc.)
  - Add in-section [Next/Prev](http://gohugo.io/templates/variables/) content pointers
- `Scratch` -- [a "scratchpad"](http://gohugo.io/extras/scratch) for your node- and page-scoped
  variables
- [Cross Reference](http://gohugo.io/extras/crossreferences/) support to easily link documents
  together with the ref and relref shortcodes.
- [Ace](http://ace.yoss.si/) template engine support ([#541](https://github.com/spf13/hugo/pull/541))
- A new [shortcode](http://gohugo.io/extras/shortcodes/) token of `{{</* */>}}` (raw HTML)
  alongside the existing `{{%/* */%}}` (Markdown)
- A top level `Hugo` variable (on Page & Node) is added with various build
  information
- Several new ways to order and group content:
  - `ByPublishDate`
  - `GroupByPublishDate(format, order)`
  - `GroupByParam(key, order)`
  - `GroupByParamDate(key, format, order)`
- Hugo has undergone a major refactoring, with a new handler system and a
  generic file system. This sounds and is technical, but will pave the way for
  new features and make Hugo even speedier

### Notable enhancements to existing features
- The [shortcode](http://gohugo.io/extras/shortcodes/) handling is rewritten for speed and
  better error messages.
- Several improvements to the [template functions](http://gohugo.io/templates/functions/):
  - `where` is now even more powerful and accepts SQL-like syntax with the
    operators `==`, `eq`; `!=`, `<>`, `ne`; `>=`, `ge`; `>`, `gt`; `<=`,
    `le`; `<`, `lt`; `in`, `not in`
  - `where` template function now also accepts dot chaining key argument
    (e.g. `"Params.foo.bar"`)
- New template functions:
  - `apply`
  - `chomp`
  - `delimit`
  - `sort`
  - `markdownify`
  - `in` and `intersect`
  - `trim`
  - `replace`
  - `dateFormat`
- Several [configurable improvements related to Markdown
  rendering](http://gohugo.io/overview/configuration/#configure-blackfriday-rendering:a66b35d20295cb764719ac8bd35837ec):
  - Configuration of footnote rendering
  - Optional support for smart angled quotes, e.g. `"Hugo"` → «Hugo»
  - Enable descriptive header IDs
- URLs in XML output is now correctly canonified ([#725](https://github.com/spf13/hugo/issues/725), [#728](https://github.com/spf13/hugo/issues/728), and part
  of [#789](https://github.com/spf13/hugo/issues/789))

### Other improvements
- Internal change to use byte buffer pool significantly lowering memory usage
  and providing measurable performance improvements overall
- Changes to docs:
  - A new [Troubleshooting](http://gohugo.io/troubleshooting/overview/) section is added
  - It's now searchable through Google Custom Search ([#753](https://github.com/spf13/hugo/issues/753))
  - Some new great tutorials:
    - [Automated deployments with
      Wercker](http://gohugo.io/tutorials/automated-deployments/)
    - [Creating a new theme](http://gohugo.io/tutorials/creating-a-new-theme/)
- [`hugo new`](http://gohugo.io/content/archetypes/) now copies the content in addition to the front matter
- Improved unit test coverage
- Fixed a lot of Windows-related path issues
- Improved error messages for template and rendering errors
- Enabled soft LiveReload of CSS and images ([#490](https://github.com/spf13/hugo/pull/490))
- Various fixes in RSS feed generation ([#789](https://github.com/spf13/hugo/issues/789))
- `HasMenuCurrent` and `IsMenuCurrent` is now supported on Nodes
- A bunch of [bug fixes](https://github.com/spf13/hugo/commits/master)


text:
<?php

namespace App;

use Silex\Application\TwigTrait;
use Silex\Application as SilexApplication;

class Application extends SilexApplication
{
    use TwigTrait;

    /**
     * Get the base path of the application
     *
     * @return string
     * @author Ronan Chilvers <ronan@d3r.com>
     */
    public function getBasePath()
    {
        return realpath(__DIR__ . '/../..');
    }
}


text:
<?php

/*
* <auto-generated>
*     This code was generated by a Codezu.
*
*     Changes to this file may cause incorrect behavior and will be lost if
*     the code is regenerated.
* </auto-generated>
*/

namespace Mozu\Api\Contracts\Customer;

/**
*	Properties of the commerce summary associated with a customer account, which includes details about the shopper's most recent order, wish lists, and total order value over time.
*/
class CommerceSummary
{
	/**
	*The date and time the shopper last submitted an order for any site associated with the tenant.
	*/
	public $lastOrderDate;

	/**
	*The total number of order the shopper submitted across all sites associated with the tenant.
	*/
	public $orderCount;

	/**
	*The number of visits to a site associated with a customer account.
	*/
	public $visitsCount;

	/**
	*The number of wish lists associated with a customer account. This number represents the total number of a shopper's wish lists across all sites associated with a tenant.
	*/
	public $wishlistCount;

	/**
	*The aggregate total amount of all orders the shopper submitted, across all sites associated with the tenant.
	*/
	public $totalOrderAmount;

}

?>


text:
<title>Memory Map Format - Debugging with GDB</title>
<meta http-equiv="Content-Type" content="text/html">
<meta name="description" content="Debugging with GDB">
<meta name="generator" content="makeinfo 4.8">
<link title="Top" rel="start" href="index.html#Top">
<link rel="up" href="Remote-Protocol.html#Remote-Protocol" title="Remote Protocol">
<link rel="prev" href="Library-List-Format-for-SVR4-Targets.html#Library-List-Format-for-SVR4-Targets" title="Library List Format for SVR4 Targets">
<link rel="next" href="Thread-List-Format.html#Thread-List-Format" title="Thread List Format">
<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">

<meta http-equiv="Content-Style-Type" content="text/css">

Next: Thread List Format,
Previous: Library List Format for SVR4 Targets,
Up: Remote Protocol

E.16 Memory Map Format

To be able to write into flash memory, gdb needs to obtain a
memory map from the target.  This section describes the format of the
memory map.

The memory map is obtained using the `<samp>qXfer:memory-map:read</samp>'
(see qXfer memory map read) packet and is an XML document that
lists memory regions.

gdb must be linked with the Expat library to support XML
memory maps.  See Expat.

The top-level structure of the document is shown below:

     <?xml version="1.0"?>
     <!DOCTYPE memory-map
               PUBLIC "+//IDN gnu.org//DTD GDB Memory Map V1.0//EN"
                      "http://sourceware.org/gdb/gdb-memory-map.dtd">
     <memory-map>
         region...
     </memory-map>

Each region can be either:

A region of RAM starting at <var>addr</var> and extending for <var>length</var>
bytes from there:

          <memory type="ram" start="<var>addr</var>" length="<var>length</var>"/>

A region of read-only memory:

          <memory type="rom" start="<var>addr</var>" length="<var>length</var>"/>

A region of flash memory, with erasure blocks <var>blocksize</var>
bytes in length:

          <memory type="flash" start="<var>addr</var>" length="<var>length</var>">
            <property name="blocksize"><var>blocksize</var></property>
          </memory>

Regions must not overlap.  gdb assumes that areas of memory not covered
by the memory map are RAM, and uses the ordinary `<samp><span class="samp">M</span></samp>' and `<samp>X</samp>'
packets to write to addresses in such ranges.

The formal DTD for memory map format is given below:

     <!-- ................................................... -->
     <!-- Memory Map XML DTD ................................ -->
     <!-- File: memory-map.dtd .............................. -->
     <!-- .................................... .............. -->
     <!-- memory-map.dtd -->
     <!-- memory-map: Root element with versioning -->
     <!ELEMENT memory-map (memory | property)>
     <!ATTLIST memory-map    version CDATA   #FIXED  "1.0.0">
     <!ELEMENT memory (property)>
     <!-- memory: Specifies a memory region,
                  and its type, or device. -->
     <!ATTLIST memory        type    CDATA   #REQUIRED
                             start   CDATA   #REQUIRED
                             length  CDATA   #REQUIRED
                             device  CDATA   #IMPLIED>
     <!-- property: Generic attribute tag -->
     <!ELEMENT property (#PCDATA | property)*>
     <!ATTLIST property      name    CDATA   #REQUIRED>


text:
package org.vaadin.teemu.wizards.event;

import org.vaadin.teemu.wizards.Wizard;

@SuppressWarnings("serial")
public class WizardCancelledEvent extends AbstractWizardEvent {

    public WizardCancelledEvent(Wizard source) {
        super(source);
    }

}


text:
const assert = require('assert');
const css = require('css');
const addIterations = require('css-ast-iterations');
const bnnHeight = require('../src/core/bnnHeight.js');

describe('bnnHeight()', () => {

  // --------------------------

  it('Should return a responsive combination of height' +
    ' and max-height values.', () => {

    const ast = css.parse('.a{bnn-height: 300px;}');
    addIterations(ast);

    ast.stylesheet.rules.forEach((rule) => {
      if (rule.selectors) bnnHeight(rule);
    });

    const result = css.stringify(ast);
    const expect = '.a {\n  height: 100%;\n  max-height: 300px;\n}';

    assert.equal(result, expect);
  });

});


text:
describe('fuse', function () {
  'use strict';

  var EventEmitter = require('events').EventEmitter
    , chai = require('chai')
    , fuse = require('../')
    , expect = chai.expect;

  it('exports it self as function', function() {
    expect(fuse).to.be.a('function');
  });

  it('returns the Base', function () {
    function Base() {} function Case() {}

    expect(fuse(Base, Case)).to.equal(Base);
  });

  it('does optional inherit', function () {
    function Base() {}

    expect(fuse(Base).prototype).to.equal(Base.prototype);
  });

  it('exposes the extend method', function () {
    function Base() {} function Case() {}
    fuse(Base, Case);

    expect(Base.extend).to.be.a('function');
  });

  it('exposes the mixin method', function () {
    function Base() {} function Case() {}
    fuse(Base, Case);

    expect(Base.prototype.mixin).to.be.a('function');
  });

  it('exposes the merge method', function () {
    function Base() {} function Case() {}
    fuse(Base, Case);

    expect(Base.prototype.merge).to.be.a('function');
  });

  it('adds writable and readable methods to the class', function () {
    function Base() {} function Case() {}
    fuse(Base, Case);

    expect(Base.writable).to.be.a('function');
    expect(Base.readable).to.be.a('function');

    expect(Base.prototype.foo).to.equal(undefined);
    expect(Base.prototype.bar).to.equal(undefined);

    Base.readable('foo', 'foo');
    Base.writable('bar', 'bar');

    expect(Base.prototype.foo).to.equal('foo');
    expect(Base.prototype.bar).to.equal('bar');
  });

  it('sets the constructor back to the Base', function () {
    function Base() {} function Case() {}
    fuse(Base, Case);

    expect(Base.prototype.constructor).to.equal(Base);
    expect(new Base()).to.be.instanceOf(Base);
    expect(new Base()).to.be.instanceOf(Case);
  });

  it('doesnt add the default methods if we dont want it', function () {
    function Base() {} function Case() {}
    fuse(Base, Case, { defaults: false });

    var base = new Base();

    expect(base).to.be.instanceOf(Base);
    expect(base).to.be.instanceOf(Case);

    expect(base.emits).to.equal(undefined);
    expect(base.mixin).to.equal(undefined);
  });

  it('allows disabling of individual methods', function () {
    function Base() {} function Case() {}
    fuse(Base, Case, { mixin: false });

    var base = new Base();

    expect(base).to.be.instanceOf(Base);
    expect(base).to.be.instanceOf(Case);

    expect(base.emits).to.be.a('function');
    expect(base.mixin).to.equal(undefined);
  });

  it('accepts options as second argument', function () {
    function Base() {}
    fuse(Base, { mixin: false });

    var base = new Base();

    expect(base.emits).to.be.a('function');
    expect(base.mixin).to.equal(undefined);
  });

  describe('emits', function () {
    it('adds the emits function to the prototype', function () {
      function Base() {} function Case() {}
      fuse(Base, Case);

      expect(Base.prototype.emits).to.be.a('function');
    });

    it('returns a function that emits the given event', function (done) {
      function Base() {}
      fuse(Base, EventEmitter);

      var base = new Base()
        , emits = base.emits('event');

      base.once('event', function (data) {
        expect(data).to.equal('foo');
        done();
      });

      emits('foo');
    });

    it('accepts a parser method that transforms the emitted values', function (done) {
      function Base() {}
      fuse(Base, EventEmitter);

      var base = new Base()
        , emits = base.emits('event', function (arg) {
            expect(arg).to.equal('bar');
            return 'foo';
          });

      base.once('event', function (data) {
        expect(data).to.equal('foo');
        done();
      });

      emits('bar');
    });

    it('curries arguments', function (done) {
      function Base() {}
      fuse(Base, EventEmitter);

      var base = new Base()
        , emits = base.emits('event', 'foo');

      base.once('event', function (data, foo) {
        expect(data).to.equal('foo');
        expect(foo).to.equal('bar');
        done();
      });

      emits('bar');
    });

    it('can prefix events', function (done) {
      function Base() {}
      fuse(Base, EventEmitter, {
        prefix: 'foo::'
      });

      var base = new Base()
        , emits = base.emits('event', 'foo');

      base.once('foo::event', function (data, foo) {
        expect(data).to.equal('foo');
        expect(foo).to.equal('bar');
        done();
      });

      emits('bar');
    });
  });
});


text:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <parent>
        <artifactId>mini-examples</artifactId>
        <groupId>de.saxsys.mvvmfx</groupId>
        <version>1.9.0-SNAPSHOT</version>
    </parent>
    <modelVersion>4.0.0</modelVersion>

    <artifactId>async-todoapp-futures</artifactId>

    <dependencies>
        <dependency>
            <groupId>de.saxsys</groupId>
            <artifactId>mvvmfx</artifactId>
        </dependency>
        <dependency>
            <groupId>de.saxsys</groupId>
            <artifactId>mvvmfx-easydi</artifactId>
        </dependency>
        <dependency>
            <groupId>org.fxmisc.easybind</groupId>
            <artifactId>easybind</artifactId>
            <version>1.0.3</version>
        </dependency>
    </dependencies>

</project>


text:
using System;

namespace AceQL.Client.Api
{
    /// <summary>
    /// <see cref="AceQLCredential"/> provides a more secure way than using a connection string to specify the username, password or Session ID for a login attempt.
    /// <para/>Note that this version does not encrypt the password. This could and should be done in a future version.
    /// </summary>
    public sealed  class AceQLCredential
    {
        private readonly string username;
        private readonly char[] password;
        private readonly string sessionId;

        /// <summary>
        /// Creates an object of type <see cref="AceQLCredential"/>.
        /// </summary>
        /// <param name="username">The username.</param>
        /// <param name="password">The password.</param>
        /// <exception cref="System.ArgumentNullException">If username or password is null. </exception>
        public AceQLCredential(string username, char[] password)
        {
            this.username = username ?? throw new ArgumentNullException("username is null!");
            this.password = password ?? throw new ArgumentNullException("password is null!");
        }

        /// <summary>
        /// Initializes a new instance of the <see cref="AceQLCredential"/> class. This constructor allows authentication without a password using a
        /// session_id value returned by AceQL login API on server side.
        /// </summary>
        /// <param name="username">The username.</param>
        /// <param name="sessionId">The session_id value returned by AceQL login API on server side.</param>
        public AceQLCredential(string username, string sessionId)
        {
            this.username = username ?? throw new ArgumentNullException("username is null!");
            this.sessionId = sessionId ?? throw new ArgumentNullException("sessionId is null!");
        }

        /// <summary>
        /// Returns the username component of the <see cref="AceQLCredential" /> object.
        /// </summary>
        /// <value>The username.</value>
        public string Username { get => username; }

        /// <summary>
        /// Returns the password component of the <see cref="AceQLCredential" /> object.
        /// </summary>
        /// <value>The password.</value>
        public char[] Password { get => password; }

        /// <summary>
        /// Gets the Session ID created by AceQL on server side.
        /// </summary>
        /// <value>The Session ID created by AceQL on server side.</value>
        public string SessionId { get => sessionId;}
    }
}


text:
package Dec2020Leetcode;

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

public class _0697DegreeOfAnArray {

	public static void main(String[] args) {
		System.out.println(findShortestSubArray(new int[] { 1, 2, 2, 3, 1 }));
		System.out.println(findShortestSubArray(new int[] { 1, 2, 2, 3, 1, 4, 2 }));
		System.out.println(findShortestSubArray(new int[] { 1, 2, 2, 3, 3, 3, 2 }));
		System.out.println(findShortestSubArray(new int[] { 2, 1, 1, 2, 1, 3, 3, 3, 1, 3, 1, 3, 2 }));
	}

	public static int findShortestSubArray(int[] nums) {
		HashMap<Integer, Integer> startIndex = new HashMap<Integer, Integer>();
		HashMap<Integer, Integer> endIndex = new HashMap<Integer, Integer>();
		HashMap<Integer, Integer> counts = new HashMap<Integer, Integer>();
		List<Integer> maxCountElements = new ArrayList<Integer>();
		int max = 0;
		for (int i = 0; i < nums.length; i++) {
			counts.compute(nums[i], (k, v) -> v == null ? 1 : v + 1);
			if (counts.get(nums[i]) > max) {
				max = counts.get(nums[i]);
				maxCountElements.clear();
				maxCountElements.add(nums[i]);
			} else if (counts.get(nums[i]) == max) {
				maxCountElements.add(nums[i]);
			}

			if (endIndex.containsKey(nums[i])) {
				endIndex.put(nums[i], i);
			} else {
				startIndex.put(nums[i], i);
				endIndex.put(nums[i], i);
			}
		}
		int minLen = Integer.MAX_VALUE;
		for (Integer num : maxCountElements) {
			minLen = Math.min(endIndex.get(num) - startIndex.get(num) + 1, minLen);
		}
		return minLen;
	}
}


text:
package riviere.blitzcrank;

import com.jagrosh.jdautilities.command.CommandClientBuilder;
import com.merakianalytics.orianna.Orianna;
import com.merakianalytics.orianna.types.common.Region;
import com.sun.management.OperatingSystemMXBean;
import net.dv8tion.jda.bot.sharding.DefaultShardManagerBuilder;
import net.dv8tion.jda.bot.sharding.ShardManager;
import net.dv8tion.jda.core.OnlineStatus;
import net.dv8tion.jda.core.entities.Game;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import riviere.blitzcrank.commands.league.ArgumentParser;
import riviere.blitzcrank.commands.league.CurrentGameCommand;
import riviere.blitzcrank.commands.league.MasteryCommand;
import riviere.blitzcrank.commands.league.SearchCommand;
import riviere.blitzcrank.commands.misc.*;
import riviere.blitzcrank.database.Database;

import javax.security.auth.login.LoginException;
import java.io.File;
import java.io.IOException;
import java.lang.management.ManagementFactory;
import java.nio.file.Files;
import java.nio.file.NoSuchFileException;
import java.nio.file.Paths;
import java.time.LocalDateTime;
import java.util.*;
import java.util.concurrent.CopyOnWriteArrayList;
import java.util.stream.Collectors;

public class Blitzcrank {
    private ShardManager shards = null;
    private final static Logger LOG = LoggerFactory.getLogger(Blitzcrank.class);

    private Blitzcrank() throws IOException, LoginException {
        // should have five lines
        // 0 - bot token
        // 1 - riot api key
        // 2 - db api key
        // 3 - dbl api key
        // 4 - bot owner
        List<String> tokens;
        try {
             tokens = Files.readAllLines(Paths.get("config.txt"));
        } catch (NoSuchFileException e) {
            System.out.println("Required config file missing, aborting");
            return;
        }

        String botToken = tokens.get(0);
        String riotAPIKey = tokens.get(1);
        String dbAPIKey = tokens.get(2);
        String dblAPIKey = tokens.get(3);
        String ownerId = tokens.get(4);

        LocalDateTime start = LocalDateTime.now();
        OperatingSystemMXBean bean = (com.sun.management.OperatingSystemMXBean) ManagementFactory.getOperatingSystemMXBean();
        Orianna.loadConfiguration(new File("orianna-config.json"));
        Orianna.setRiotAPIKey(riotAPIKey);
        String game = "b!help | Fleshling Compatibility Service";
        Database db = new Database();
        ArgumentParser ap = new ArgumentParser(db);

        CommandClientBuilder client = new CommandClientBuilder()
                .setOwnerId(ownerId)
                .setPrefix("b!")
                .setAlternativePrefix("@mention")
                .useHelpBuilder(false)
                .setDiscordBotsKey(dbAPIKey)
                .setDiscordBotListKey(dblAPIKey)
                .setGame(Game.playing(game));

        client.addCommands(
                // league commands
                new SearchCommand(ap),
                new MasteryCommand(ap),
                new CurrentGameCommand(ap),

                //misc commands
                new PingCommand(this),
                new InviteCommand(),
                new SupportCommand(),
                new HelpCommand(),
                new UptimeCommand(start),
                new ShutdownCommand(this),
                new InfoCommand(this, bean),
                new RegionCommands(db),
                new ShardsCommand(this)
        );

        Orianna.setRiotAPIKey(riotAPIKey);
        Orianna.setDefaultRegion(Region.NORTH_AMERICA);

        shards = new DefaultShardManagerBuilder()
                .setToken(botToken)
                .setStatus(OnlineStatus.DO_NOT_DISTURB)
                .setGame(Game.playing("loading..."))
                .build();

        List<BlitzcrankShard> blitzcrankShards = new ArrayList<>();
        for (int i = 0; i < shards.getShardsTotal(); i++) {
            BlitzcrankShard shard = new BlitzcrankShard(i);
            shards.getShardById(i).setEventManager(new ShardEventManager(shard));
            shards.getShardById(i).addEventListener(new Listener(this), client.build());
            blitzcrankShards.add(shard);
            try {
                Thread.sleep(5000L);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }

       new Thread(() -> {
            while (true) {
                try {
                    Thread.sleep(600000);
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
                LOG.info("Checking for zombie shards...");
                final List<BlitzcrankShard> deadShards = blitzcrankShards.stream()
                        .filter(e -> System.currentTimeMillis() - e.getLastJDAEventTime() > 300000).collect(Collectors.toList());
                if (!deadShards.isEmpty()) {
                    LOG.info("Resurrecting zombie shards: " + Arrays.toString(deadShards.stream()
                            .map(e -> "#" + e.getShard() + ": " + e.getLastJDAEventTime()).toArray()));
                    final Collection<Integer> shardsToRebuild = new CopyOnWriteArrayList<>();
                    deadShards.forEach(shard -> {
                        shardsToRebuild.add(shard.getShard());
                        shards.shutdown(shard.getShard());
                    });
                    shardsToRebuild.forEach(shard -> {
                        blitzcrankShards.removeIf(e -> e.getShard() == shard);
                        final BlitzcrankShard newShard = new BlitzcrankShard(shard);
                        blitzcrankShards.add(newShard);
                        LOG.info("Resurrected shard " + shard);
                        shards.start(shard);
                        try {
                            Thread.sleep(5000L);
                        } catch(final InterruptedException e) {
                            e.printStackTrace();
                        }
                    });
                    blitzcrankShards.sort(Comparator.comparingInt(BlitzcrankShard::getShard));
                } else {
                    LOG.info("No zombie shards found!");
                }
            }
        }).start();
    }

    public ShardManager getShardManager() {
        return shards;
    }

    public static void main(String[] args) {
        try {
            new Blitzcrank();
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

}


text:
__author__ = 'Властелин Вселенной'
from model.project import Project

def test_delete_project(app):
 #   app.session.login("administrator", "root")
    username = app.config["webadmin"]["username"]
    password = app.config["webadmin"]["password"]
    app.project.open_project_page()
#    k= app.project.check_project_names(Project(name="delete"))
    if  app.project.check_project_names(Project(name="delete")) != True:
        project = Project(name="delete", status="release", view="private", description="desc")
        app.project.create_project(project)

    old_projects = app.soap.get_projects_list(username, password)
    app.project.delete_project(project)
    new_projects = app.soap.get_projects_list(username, password)
    assert len(old_projects)-1 == len(new_projects)


text:
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var rxjs_1 = require("rxjs");
var max_1 = require("../../operator/max");
rxjs_1.Observable.prototype.max = max_1.max;
//# sourceMappingURL=max.js.map


text:
<?php defined('SYSPATH') OR die('No direct access allowed.');

class Captcha_Word_Driver extends Captcha_Basic_Driver {

	/**
	 * Generates a new Captcha challenge.
	 *
	 * @return  string  the challenge answer
	 */
	public function generate_challenge()
	{
		// Load words from the current language and randomize them
		$words = Kohana::lang('captcha.words');
		shuffle($words);

		// Loop over each word...
		foreach ($words as $word)
		{
			// ...until we find one of the desired length
			if (abs(Captcha::$config['complexity'] - strlen($word)) < 2)
				return strtoupper($word);
		}

		// Return any random word as final fallback
		return strtoupper($words[array_rand($words)]);
	}

} // End Captcha Word Driver Class


text:
using Shouldly;
using StructureMap.Testing.Widget3;
using System.Diagnostics;
using Xunit;

namespace StructureMap.Testing.Graph
{
    public class ConventionBasedSetterInjectionTester
    {
        // SAMPLE: using-setter-policy
        public class ClassWithNamedProperties
        {
            public int Age { get; set; }
            public string LastName { get; set; }
            public string FirstName { get; set; }
            public IGateway Gateway { get; set; }
            public IService Service { get; set; }
        }

        [Fact]
        public void specify_setter_policy_and_construct_an_object()
        {
            var theService = new ColorService("red");

            var container = new Container(x =>
            {
                x.For<IService>().Use(theService);
                x.For<IGateway>().Use<DefaultGateway>();

                x.ForConcreteType<ClassWithNamedProperties>().Configure.Setter<int>().Is(5);

                x.Policies.SetAllProperties(
                    policy => policy.WithAnyTypeFromNamespace("StructureMap.Testing.Widget3"));
            });

            var description = container.Model.For<ClassWithNamedProperties>().Default.DescribeBuildPlan();
            Debug.WriteLine(description);

            var target = container.GetInstance<ClassWithNamedProperties>();
            target.Service.ShouldBeTheSameAs(theService);
            target.Gateway.ShouldBeOfType<DefaultGateway>();
        }

        // ENDSAMPLE

        [Fact]
        public void specify_setter_policy_by_of_type_and_construct_an_object()
        {
            var theService = new ColorService("red");

            var container = new Container(x =>
            {
                x.For<IService>().Use(theService);
                x.For<IGateway>().Use<DefaultGateway>();

                x.ForConcreteType<ClassWithNamedProperties>().Configure.Setter<int>().Is(5);

                x.Policies.SetAllProperties(policy => policy.OfType<IService>());
            });

            var description = container.Model.For<ClassWithNamedProperties>().Default.DescribeBuildPlan();
            Debug.WriteLine(description);

            var target = container.GetInstance<ClassWithNamedProperties>();
            target.Service.ShouldBeTheSameAs(theService);
            target.Gateway.ShouldBeNull();
        }

        [Fact]
        public void specify_setter_policy_by_a_predicate_on_property_type()
        {
            var theService = new ColorService("red");

            var container = new Container(x =>
            {
                x.For<IService>().Use(theService);
                x.For<IGateway>().Use<DefaultGateway>();

                x.Policies.SetAllProperties(policy => { policy.TypeMatches(type => type == typeof(IService)); });
            });

            var target = container.GetInstance<ClassWithNamedProperties>();
            target.Service.ShouldBeTheSameAs(theService);
            target.Gateway.ShouldBeNull();
        }
    }
}


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ComponentModel.Composition;
using Treefrog.Framework.Model;
using Treefrog.Presentation;
using Treefrog.Presentation.Layers;
using Treefrog.Render.Layers;

namespace Treefrog.Extensibility
{
    [MetadataAttribute]
    [AttributeUsage(AttributeTargets.Method)]
    public class LevelLayerPresenterExportAttribute : ExportAttribute
    {
        public LevelLayerPresenterExportAttribute ()
            : base(typeof(Func<Layer, ILayerContext, LevelLayerPresenter>))
        { }

        public Type LayerType { get; set; }
        public Type TargetType { get; set; }
    }

    [MetadataAttribute]
    [AttributeUsage(AttributeTargets.Method)]
    public class LayerFromPresenterExportAttribute : ExportAttribute
    {
        public LayerFromPresenterExportAttribute ()
            : base(typeof(Func<LayerPresenter, string, Layer>))
        { }

        public Type SourceType { get; set; }
        public Type TargetType { get; set; }
    }

    [MetadataAttribute]
    [AttributeUsage(AttributeTargets.Method)]
    public class CanvasLayerExportAttribute : ExportAttribute
    {
        public CanvasLayerExportAttribute ()
            : base(typeof(Func<LayerPresenter, CanvasLayer>))
        { }

        public Type LayerType { get; set; }
        public Type TargetType { get; set; }
    }
}


text:
//
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.8-b130911.1802
// See http://java.sun.com/xml/jaxb
// Any modifications to this file will be lost upon recompilation of the source schema.
// Generated on: 2015.12.16 at 05:58:11 PM CET
//

package eu.fbk.das.adaptation.ensemble;

import java.util.ArrayList;
import java.util.List;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlSchemaType;
import javax.xml.bind.annotation.XmlType;
import javax.xml.bind.annotation.adapters.CollapsedStringAdapter;
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;

/**
 * Main type of an ensemble, defined by a name, a sequence
 * 					of roles and a list of variables
 *
 *
 *
Java class for anonymous complex type.
 *
 *
The following schema fragment specifies the expected content contained within this class.
 *
 *

 * <complexType>
 *   <complexContent>
 *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
 *       <sequence>
 *         <sequence>
 *           <element name="role" type="{http://das.fbk.eu/Ensemble}Role" maxOccurs="unbounded"/>
 *         </sequence>
 *         <element name="variable" type="{http://www.w3.org/2001/XMLSchema}NMTOKEN" maxOccurs="unbounded" minOccurs="0"/>
 *       </sequence>
 *       <attribute name="name" type="{http://www.w3.org/2001/XMLSchema}string" />
 *     </restriction>
 *   </complexContent>
 * </complexType>
 *

 *
 *
 */
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = {
    "role",
    "variable"
})
@XmlRootElement(name = "ensemble", namespace = "http://das.fbk.eu/Ensemble")
public class Ensemble {

    @XmlElement(namespace = "http://das.fbk.eu/Ensemble", required = true)
    protected List<Role> role;
    @XmlElement(namespace = "http://das.fbk.eu/Ensemble")
    @XmlJavaTypeAdapter(CollapsedStringAdapter.class)
    @XmlSchemaType(name = "NMTOKEN")
    protected List<String> variable;
    @XmlAttribute(name = "name")
    protected String name;

    /**
     * Gets the value of the role property.
     *
     *

     * This accessor method returns a reference to the live list,
     * not a snapshot. Therefore any modification you make to the
     * returned list will be present inside the JAXB object.
     * This is why there is not a set method for the role property.
     *
     *

     * For example, to add a new item, do as follows:
     *

     *    getRole().add(newItem);
     *

     *
     *
     *

     * Objects of the following type(s) are allowed in the list
     * {@link Role }
     *
     *
     */
    public List<Role> getRole() {
        if (role == null) {
            role = new ArrayList<Role>();
        }
        return this.role;
    }

    /**
     * Gets the value of the variable property.
     *
     *

     * This accessor method returns a reference to the live list,
     * not a snapshot. Therefore any modification you make to the
     * returned list will be present inside the JAXB object.
     * This is why there is not a set method for the variable property.
     *
     *

     * For example, to add a new item, do as follows:
     *

     *    getVariable().add(newItem);
     *

     *
     *
     *

     * Objects of the following type(s) are allowed in the list
     * {@link String }
     *
     *
     */
    public List<String> getVariable() {
        if (variable == null) {
            variable = new ArrayList<String>();
        }
        return this.variable;
    }

    /**
     * Gets the value of the name property.
     *
     * @return
     *     possible object is
     *     {@link String }
     *
     */
    public String getName() {
        return name;
    }

    /**
     * Sets the value of the name property.
     *
     * @param value
     *     allowed object is
     *     {@link String }
     *
     */
    public void setName(String value) {
        this.name = value;
    }

}


text:
import * as H from 'history';
import { HistoryRoutes } from './History';

declare function useRoutes<T>(createHistory: H.CreateHistory<T>): H.CreateHistory<T & HistoryRoutes>;
export default useRoutes;


text:
<Type Name="AudioFormatAvailability" FullName="MonoMac.AudioToolbox.AudioFormatAvailability">
  <TypeSignature Language="C#" Value="public static class AudioFormatAvailability" />
  <TypeSignature Language="ILAsm" Value=".class public auto ansi abstract sealed beforefieldinit AudioFormatAvailability extends System.Object" />
  <AssemblyInfo>
    <AssemblyName>MonoMac</AssemblyName>
    <AssemblyVersion>0.0.0.0</AssemblyVersion>
  </AssemblyInfo>
  <Base>
    <BaseTypeName>System.Object</BaseTypeName>
  </Base>
  <Interfaces />
  <Docs>
    To be added.
    <remarks>To be added.</remarks>
  </Docs>
  <Members>
    <Member MemberName="GetAvailableEncodeBitRates">
      <MemberSignature Language="C#" Value="public static MonoMac.AudioToolbox.AudioValueRange[] GetAvailableEncodeBitRates (MonoMac.AudioToolbox.AudioFormatType format);" />
      <MemberSignature Language="ILAsm" Value=".method public static hidebysig valuetype MonoMac.AudioToolbox.AudioValueRange[] GetAvailableEncodeBitRates(valuetype MonoMac.AudioToolbox.AudioFormatType format) cil managed" />
      <MemberType>Method</MemberType>
      <AssemblyInfo>
        <AssemblyVersion>0.0.0.0</AssemblyVersion>
      </AssemblyInfo>
      <ReturnValue>
        <ReturnType>MonoMac.AudioToolbox.AudioValueRange[]</ReturnType>
      </ReturnValue>
      <Parameters>
        <Parameter Name="format" Type="MonoMac.AudioToolbox.AudioFormatType" />
      </Parameters>
      <Docs>
        <param name="format">To be added.</param>
        To be added.
        <returns>To be added.</returns>
        <remarks>To be added.</remarks>
      </Docs>
    </Member>
    <Member MemberName="GetAvailableEncodeSampleRates">
      <MemberSignature Language="C#" Value="public static MonoMac.AudioToolbox.AudioValueRange[] GetAvailableEncodeSampleRates (MonoMac.AudioToolbox.AudioFormatType format);" />
      <MemberSignature Language="ILAsm" Value=".method public static hidebysig valuetype MonoMac.AudioToolbox.AudioValueRange[] GetAvailableEncodeSampleRates(valuetype MonoMac.AudioToolbox.AudioFormatType format) cil managed" />
      <MemberType>Method</MemberType>
      <AssemblyInfo>
        <AssemblyVersion>0.0.0.0</AssemblyVersion>
      </AssemblyInfo>
      <ReturnValue>
        <ReturnType>MonoMac.AudioToolbox.AudioValueRange[]</ReturnType>
      </ReturnValue>
      <Parameters>
        <Parameter Name="format" Type="MonoMac.AudioToolbox.AudioFormatType" />
      </Parameters>
      <Docs>
        <param name="format">To be added.</param>
        To be added.
        <returns>To be added.</returns>
        <remarks>To be added.</remarks>
      </Docs>
    </Member>
    <Member MemberName="GetDecoders">
      <MemberSignature Language="C#" Value="public static MonoMac.AudioToolbox.AudioClassDescription[] GetDecoders (MonoMac.AudioToolbox.AudioFormatType format);" />
      <MemberSignature Language="ILAsm" Value=".method public static hidebysig valuetype MonoMac.AudioToolbox.AudioClassDescription[] GetDecoders(valuetype MonoMac.AudioToolbox.AudioFormatType format) cil managed" />
      <MemberType>Method</MemberType>
      <AssemblyInfo>
        <AssemblyVersion>0.0.0.0</AssemblyVersion>
      </AssemblyInfo>
      <ReturnValue>
        <ReturnType>MonoMac.AudioToolbox.AudioClassDescription[]</ReturnType>
      </ReturnValue>
      <Parameters>
        <Parameter Name="format" Type="MonoMac.AudioToolbox.AudioFormatType" />
      </Parameters>
      <Docs>
        <param name="format">To be added.</param>
        To be added.
        <returns>To be added.</returns>
        <remarks>To be added.</remarks>
      </Docs>
    </Member>
    <Member MemberName="GetEncoders">
      <MemberSignature Language="C#" Value="public static MonoMac.AudioToolbox.AudioClassDescription[] GetEncoders (MonoMac.AudioToolbox.AudioFormatType format);" />
      <MemberSignature Language="ILAsm" Value=".method public static hidebysig valuetype MonoMac.AudioToolbox.AudioClassDescription[] GetEncoders(valuetype MonoMac.AudioToolbox.AudioFormatType format) cil managed" />
      <MemberType>Method</MemberType>
      <AssemblyInfo>
        <AssemblyVersion>0.0.0.0</AssemblyVersion>
      </AssemblyInfo>
      <ReturnValue>
        <ReturnType>MonoMac.AudioToolbox.AudioClassDescription[]</ReturnType>
      </ReturnValue>
      <Parameters>
        <Parameter Name="format" Type="MonoMac.AudioToolbox.AudioFormatType" />
      </Parameters>
      <Docs>
        <param name="format">To be added.</param>
        To be added.
        <returns>To be added.</returns>
        <remarks>To be added.</remarks>
      </Docs>
    </Member>
  </Members>
</Type>


text:
import './Promise';
import './Object.assign';
import './requestAnimationFrame';
import './Math.sign';
import './Number.isInteger';

if (!self.ArrayBuffer)
{
    (self as any).ArrayBuffer = Array;
}

if (!self.Float32Array)
{
    (self as any).Float32Array = Array;
}

if (!self.Uint32Array)
{
    (self as any).Uint32Array = Array;
}

if (!self.Uint16Array)
{
    (self as any).Uint16Array = Array;
}

if (!self.Uint8Array)
{
    (self as any).Uint8Array = Array;
}

if (!self.Int32Array)
{
    (self as any).Int32Array = Array;
}


text:
import { Component, OnInit } from '@angular/core';
import { LocalStorageService } from 'ng2-webstorage';
import { Router } from '@angular/router';
import { ChannelEvent, ChannelService } from '../../shared/services/channel/';
import { ConnectionState } from '../../shared/services/channel/connection-state.enum';

@Component({
  selector: 'app-entry',
  templateUrl: './entry.component.html',
  styleUrls: ['./entry.component.scss']
})
export class EntryComponent implements OnInit {
  public nick: string;

  constructor(
    private storage: LocalStorageService,
    private router: Router,
    private channelService: ChannelService
  ) { }

  public ngOnInit() {
    this.channelService.connectionState$.subscribe((state: ConnectionState) => {
      if (state === ConnectionState.Connected) {
        this.subscribeEvents();
      }
    });
  }

  public entry() {
    this.storage.store('nick', this.nick);

    const event = new ChannelEvent();

    event.Name = 'nickEntry';
    event.Data = {
      nick: this.nick
    };

    this.channelService.publish(event);

    this.router
      .navigate(['game/editor'])
      .then(() => {});
  }

  /**
   * Method to subscribe all the needed events and create necessary subscriptions.
   */
  private subscribeEvents(): void {
    this.channelService.sub('nicks').subscribe(
      (event: ChannelEvent) => {
        if (event.Name === 'login') {
          this.storage.store('guid', event.Data);

          this.router
            .navigate(['game/editor'])
            .then(() => {});
        }
      }
    );
  }
}


text:
* Chef Resource Provider for RunDeck utilizing the `RESOURCE-JSON` format
* RunDeck Options Provider for State of Provisioning
* Proxy to Chef Server for Client/Node Object Deletion

## Background
This project started out to act as a proxy for administrative Chef Server interactions, namely client/node deletion.

If you are familiar with Chef & Terraform, you are likely aware that Terraform currently does not remove the client/node pair from the Chef server upon destruction.  Additionally, you are likely aware that deletion of client/node objects requires elevated privileges on the Chef server; privileges that the validation client does not provide.
To work around this, one might use `knife` configured with administrative client.  When combined with RunDeck, the security outlook does not look good as one might easily run a `cat` on the PEM file from the Command interface, allowing them to view the credential.  Unless otherwise orchestrated, any/all local commands will run under the context of the RunDeck user, likely the same user with ownership of said PEM file, so using `knife` under the RunDeck context is inherently insecure if the RunDeck is used for other things and/or the Command interface is exposed.

The idea here is to run this Gem under a different user's context, proxying administrative commands via simple GET/POST requests.  The administrative PEM is then owned by a seperate user, preventing one from easily accessing it.  Additionally, a simple `state` endpoint can be used to maintain an audit trail of who created what node, and allow said user to then delete the node.  Deletion is limited to only member nodes of the `state`, and only by the original creator, unless the user is an administrator.  The security here is rather primitive, as the user is passed in as a query parameter, but better than nothing.  I had the idea of combining this with a sort of API key unique to the user, but have yet to implement it.  The limitation of only deleting nodes belonging to the current `state` is the current stop gap.  Also, this means if you have existing nodes, you'll likely want to populate your `state` file with them.  A sample state object is available at `config/state.json`.

**NOTE:** This API should **NOT** be exposed to the world unless you plan to secure it with a reverse-proxy or something.  It is intended to only be bound to `localhost` on the same server as RunDeck.

## RunDeck Options Provider
This gem also serves as a RunDeck options provider, delivering node search results in the RunDeck `RESOURCE-JSON` format.
* This project **ONLY** uses partial search.  You can add additional values to the search filter with the `extras` param (comma-separated) or inside project-specific config (Array).
* The search/return is customizable, either by passing query parameters, or by creating project-specific configuration and hitting the project endpoint.
* Query parameters will overrule project-specific configuration.
* You don't have to pass in a user, granting the ability to set that sort of configuration in the RunDeck project configuration.

* Chef node attributes `rd_hostname`, `rd_ssh_port`, `rd_winrm_port`, or `rd_username` will override values set elsewhere.

## State Functions
* Display the State - GET - http://localhost:9125/chef/v1/state
* List the Node's for a User - GET -  http://localhost:9125/chef/v1/list/${USERNAME}
* Add a node to the State - POST - http://localhost:9125/chef/v1/add/${NODENAME}/${USERNAME} - type=${TYPE} can be specified as query_param in URL or POST Body
** Subsequent calls to this endpoint for an existing node will add to the audit trail of the node in it's `Last_Modified:` field.  Type cannot be edited after inception.
* Delete a node from the State and Chef Server - POST - http://localhost:9125/chef/v1/delete/${NODENAME} - auth_user=${USERNAME} as query_param in URL or POST Body

## Other API Functions
### Node Search - Return the Node Object in JSON Format
* Exact Case Match - `http://localhost:9125/chef/v1/node/BD-MBPro.local`
* Case-Insensitive Match - `http://localhost:9125/chef/v1/node/Bd-MbPrO.lOcAl?regex=1`

## Node List - JSON Array of all Node Object Name's on the Chef Server (No Search Parameters)
* `http://localhost:9125/chef/v1/list`

## Configuration
This project can use a JSON configuration file to seed configuration parameters.  Most configuration can also be passed in via the CLI, except Project definitions.
* You can (and should) opt to use regular credentials for Unprivileged Chef API calls.  This does not have to be a validation client; a regular client can suffice.  This is passed in via `chef-api-client-name` & `chef-api-client-key`
* Priviledged Chef Server credentials can be passed in via `chef-api-admin-name` and `chef-api-admin-key`. Be sure to keep the permissions tight on the PEM file.

## Running as a Service
You'll likely want to run this as a service, `SystemD` or `Upstart` will likely be your friend in this regard.

## Security
You should lock down permissions on all configuration files in this project to only the user which this runs as...

To run this project securely, **DON'T** run it as the RunDeck user.

## Caching
This leans on `rack-cache` to serve as a caching mechanism.  The objective here was to make sure we don't pummel the Chef API with redundant queries.
* Timeout can be configured via the `cache_timeout` setting. **Default:** *30 seconds*

## Credits
This Gem leans heavily on Seth Vargo's `ChefAPI` gem.  I also took many ideas from his Gem to build this one, as I've never written anything like this before.  Thank you, Seth, for both the `ChefAPI` gem and for your consistent high quality contributions to the DevOps community.

Also, thank you to Adam Jacob for initially developing the `chef-rundeck` gem which served as a baseline for building the Resource Provider portion of this one. Thanks for Chef, you've greatly reduce the amount of chaos in my work life!

## Installation

Add this line to your application's Gemfile:

```ruby
gem 'chef-rundeck2'
```

And then execute:

    $ bundle

Or install it yourself as:

    $ gem install chef-rundeck2

## Usage

TODO: Write usage instructions here

## Development

After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.

To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).

## Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/bdwyertech/chef-rundeck. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.

## License

The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).


text:
using System.Collections.Generic;
using System.IO;
using System.Linq;
using int32.Utils.Windows.Files.Links;

namespace int32.Utils.Windows.Files
{
    public static class Finder
    {
        public static IEnumerable<Link> GetLinks(string path)
        {
            return Directory.GetFiles(path, "*.lnk", SearchOption.AllDirectories).Select(i => new Link {Path = i});
        }
    }
}


text:
class GrappaAssertionError(AssertionError):
    """
    GrappaAssertionError represents an internal grappa assertion error
    and it is used internally to encapsulate and share state on
    assertion errors.

    Attributes:
        error (Exception): stores original error exception.
        reasons (list|tuple[str]): stores error reason details.
        operator (Operator): original operator instance that failed.
    """

    def __init__(self, error=None, reasons=None, operator=None):
        self.error = error
        self.reasons = reasons or getattr(error, 'reasons', None)
        self.operator = operator


text:
<?xml version="1.0" encoding="utf-8"?>
<selector
  xmlns:android="http://schemas.android.com/apk/res/android">
    <item android:state_pressed="true" android:drawable="@drawable/chatting_setmode_keyboard_btn_pressed" />
    <item android:state_selected="true" android:drawable="@drawable/chatting_setmode_keyboard_btn_pressed" />
    <item android:state_focused="true" android:drawable="@drawable/chatting_setmode_keyboard_btn_pressed" />
    <item android:drawable="@drawable/chatting_setmode_keyboard_btn_normal" />
</selector>


text:
using System;
using System.Linq;
using System.Collections.Generic;
using OpenSSL.Core;
using OpenSSL.Crypto;
using System.Xml.Serialization;

namespace scallion
{
	public class XmlPublicKey
	{
		public XmlPublicKey() { }
		public XmlPublicKey(BigNumber publicModulus)
		{
			PublicModulus = publicModulus;
		}

        [XmlIgnore]
		public BigNumber PublicModulus { get; set; }

        /// <summary>
        /// This is for serialization!
        /// </summary>
		public byte[] PublicModulusBytes
		{
			get {
				byte[] bytes = new byte[PublicModulus.Bytes];
				PublicModulus.ToBytes(bytes);
				return bytes;
			}

			set {
				PublicModulus = BigNumber.FromArray(value);
			}
		}
	}

	public class XmlKeyDictionary
	{
		public XmlKeyDictionary()
		{
			PublicModToPrivateKeyPEMMap = new List<KeyValuePair<byte[], string>>();
		}

		// Map the public modulus (as a byte array) to the private key (as a base64-encoded string)
		public List<KeyValuePair<byte[], string>> PublicModToPrivateKeyPEMMap { get; set; }

		public void AddKey(RSAWrapper rsa)
		{
			byte[] pubMod = new byte[rsa.Rsa.PublicModulus.Bytes];
			rsa.Rsa.PublicModulus.ToBytes(pubMod);

			string privKey = rsa.Rsa.PrivateKeyAsPEM;

			PublicModToPrivateKeyPEMMap.Add(new KeyValuePair<byte[], string>(pubMod, privKey));
		}

		public RSAWrapper FindKey(BigNumber publicModulus)
		{
			byte[] pubMod = new byte[publicModulus.Bytes];
			publicModulus.ToBytes(pubMod);

			foreach (var kvp in PublicModToPrivateKeyPEMMap) {
				if (Enumerable.SequenceEqual(kvp.Key, pubMod)) { // TODO: determine if this is too slow
					RSAWrapper rsa = new RSAWrapper();
					rsa.FromPrivateKeyPEM(kvp.Value);
					return rsa;
				}
			}

			return null; // it failed
		}
	}

	public class XmlMatchOutput
	{
		public XmlMatchOutput() { }

		public DateTime GeneratedDate { get; set; }
        [XmlIgnore]
		public BigNumber PublicModulus { get; set; }
        [XmlIgnore]
		public BigNumber PublicExponent { get; set; }
		public string Hash { get; set; }
		public string PrivateKey { get; set; }

        /// <summary>
        /// This is for serialization!
        /// </summary>
		public byte[] PublicModulusBytes {
			get {
				byte[] bytes = new byte[PublicModulus.Bytes];
				PublicModulus.ToBytes(bytes);
				return bytes;
			}

			set {
				PublicModulus = BigNumber.FromArray(value);
			}
		}

        /// <summary>
        /// This is for serialization!
        /// </summary>
		public byte[] PublicExponentBytes {
			get {
				byte[] bytes = new byte[PublicExponent.Bytes];
				PublicExponent.ToBytes(bytes);
				return bytes;
			}

			set {
				PublicExponent = BigNumber.FromArray(value);
			}
		}
	}
}


text:
using System;
using QuantConnect.Data;

namespace QuantConnect.Indicators
{
    /// <summary>
    /// KEEPING THIS INTERFACE FOR BACKWARDS COMPATIBILITY.
    /// Represents an indicator that can receive data updates and emit events when the value of
    /// the indicator has changed.
    /// </summary>
    public interface IIndicator<T> : IComparable<IIndicator<T>>, IComparable, IIndicator
        where T : IBaseData
    {
    }

    /// <summary>
    /// Represents an indicator that can receive data updates and emit events when the value of
    /// the indicator has changed.
    /// </summary>
    public interface IIndicator
    {
        /// <summary>
        /// Event handler that fires after this indicator is updated
        /// </summary>
        event IndicatorUpdatedHandler Updated;

        /// <summary>
        /// Gets a name for this indicator
        /// </summary>
        string Name { get; }

        /// <summary>
        /// Gets a flag indicating when this indicator is ready and fully initialized
        /// </summary>
        bool IsReady { get; }

        /// <summary>
        /// Gets the current state of this indicator. If the state has not been updated
        /// then the time on the value will equal DateTime.MinValue.
        /// </summary>
        IndicatorDataPoint Current { get; }

        /// <summary>
        /// Gets the number of samples processed by this indicator
        /// </summary>
        long Samples { get; }

        /// <summary>
        /// Updates the state of this indicator with the given value and returns true
        /// if this indicator is ready, false otherwise
        /// </summary>
        /// <param name="input">The value to use to update this indicator</param>
        /// <returns>True if this indicator is ready, false otherwise</returns>
        bool Update(IBaseData input);

        /// <summary>
        /// Resets this indicator to its initial state
        /// </summary>
        void Reset();
    }
}


text:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="edu.cs4730.filesystemdemo">

   <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
   <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" android:maxSdkVersion="29" />
    <uses-permission android:name="android.permission.MANAGE_EXTERNAL_STORAGE" android:minSdkVersion="29" />

    <!-- android:requestLegacyExternalStorage="true"-->
    <application
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" >
        <activity
            android:name="edu.cs4730.filesystemdemo.MainActivity"
            android:label="@string/app_name" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    </application>

</manifest>


text:
from __future__ import unicode_literals

from django.db import migrations, models

class Migration(migrations.Migration):

    dependencies = [
        ('icekit_plugins_image', '0015_auto_20170310_2004'),
    ]

    operations = [
    ]


text:
__author__ = 'joh12041'

# Code largely taken from: https://gist.github.com/endolith/2837160
#  with some help from https://github.com/ahwolf/meetup_location/blob/master/code/geo_median.py
#  and adapted to support great circle distances over Euclidean.

from geopy.distance import vincenty
from geopy.distance import great_circle
import csv
import numpy
import traceback

LIMIT_MAD = 30  # acceptable km limit to median absolute deviation of points
LIMIT_POINTS = 3  # acceptable minimum number of GPS points for a user
DISTANCE_THRESHOLD = 1  # distance (meters) between iterations that determines end of search
DATA_POINTS_FILE = '../sample_dataset/post_location_info.csv'
OUTPUT_MEDIANS = '../sample_dataset/users.home-locations.geo-median.tsv'
SNAP_TO_USER_POINTS = True
OUTPUT_ALL_USERS = False
OUTPUT_DELIMITER = '\t'

def main():
    compute_medians()

def compute_medians(iterations=1000, already_computed=None):

    numIter = iterations  # numIter depends on how long it take to get a suitable convergence of objFunc
    count = 0
    medians_found = 0

    already_computed_users = {}
    if already_computed:
        for file in already_computed:
            with open(file, 'r') as fin:
                csvreader = csv.reader(fin)
                assert next(csvreader) == ['uid', 'median']
                for line in csvreader:
                    already_computed_users[line[0]] = True

    with open(DATA_POINTS_FILE, 'r') as fin:
        csvreader = csv.reader(fin)
        assert next(csvreader) == ['uid','lat','lon']
        with open(OUTPUT_MEDIANS, 'w') as fout:
            csvwriter = csv.writer(fout, delimiter=OUTPUT_DELIMITER)
            csvwriter.writerow(['uid','lat','lon'])
            line = next(csvreader)
            dataPoints = [(float(line[1]), float(line[2]))]
            current_uid = line[0]
            for line in csvreader:
                if line[0] == current_uid:
                    dataPoints.append((float(line[1]), float(line[2])))
                else:
                    count += 1
                    if count % 2500 == 0:
                        print("Processed {0} users and {1} medians found.".format(count, medians_found))

                    if current_uid not in already_computed_users:
                        medians_found += compute_user_median(dataPoints, numIter, csvwriter, current_uid)

                    # set user and restart array for new current user
                    current_uid = line[0]
                    dataPoints = [(float(line[1]), float(line[2]))]
            # compute final user's median
            medians_found += compute_user_median(dataPoints, numIter, csvwriter, current_uid)
    print("Processed {0} users and {1} medians found.".format(count, medians_found))

def compute_user_median(dataPoints, numIter, csvwriter, current_uid):
    if len(dataPoints) < LIMIT_POINTS:  # Insufficient points for the user - don't record median
        if OUTPUT_ALL_USERS:
            csvwriter.writerow([current_uid, None, None])
        return 0
    else:
        if SNAP_TO_USER_POINTS: # ensure median is one of the user's points
            lowestDev = float("inf")
            for point in dataPoints:
                tmpAbsDev = objfunc(point, dataPoints)
                if tmpAbsDev < lowestDev:
                    lowestDev = tmpAbsDev
                    testMedian = point
        else:
            testMedian = candMedian(dataPoints)  # Calculate centroid more or less as starting point
            if objfunc(testMedian, dataPoints) != 0:  # points aren't all the same

                #iterate to find reasonable estimate of median
                for x in range(0, numIter):
                    denom = denomsum(testMedian, dataPoints)
                    nextLat = 0.0
                    nextLon = 0.0

                    for y in range(0, len(dataPoints)):
                        nextLat += (dataPoints[y][0] * numersum(testMedian, dataPoints[y]))/denom
                        nextLon += (dataPoints[y][1] * numersum(testMedian, dataPoints[y]))/denom

                    prevMedian = testMedian
                    testMedian = (nextLat, nextLon)
                    try:
                        if vincenty(prevMedian, testMedian).meters < DISTANCE_THRESHOLD:  # 1 meter
                            break
                    except:
                        if great_circle(prevMedian, testMedian).meters < DISTANCE_THRESHOLD:  # 1 meter
                            break

                if x == numIter - 1:
                    print('{0}: failed to converge. Last change between iterations was {1} meters.'.format(current_uid, great_circle(prevMedian, testMedian).meters))

        # Check if user points are under the limit median absolute deviation
        if checkMedianAbsoluteDeviation(dataPoints, testMedian) <= LIMIT_MAD:
            csvwriter.writerow([current_uid, round(testMedian[0],6), round(testMedian[1],6)])
            return 1
        else:
            if OUTPUT_ALL_USERS:
                csvwriter.writerow([current_uid, None, None])
            return 0

def candMedian(dataPoints):
    #Calculate the first candidate median as the geometric mean
    tempLat = 0.0
    tempLon = 0.0

    for i in range(0, len(dataPoints)):
        tempLat += dataPoints[i][0]
        tempLon += dataPoints[i][1]

    return (tempLat / len(dataPoints), tempLon / len(dataPoints))

def checkMedianAbsoluteDeviation(dataPoints, median):
    # Calculate Median Absolute Deviation of a set of points
    distances = []
    for i in range(0, len(dataPoints)):
        try:
            distances.append(vincenty(median, dataPoints[i]).kilometers)
        except ValueError:
            # Vincenty doesn't always converge so fall back on great circle distance which is less accurate but always converges
            distances.append(great_circle(median, dataPoints[i]).kilometers)
    return(numpy.median(distances))

def numersum(testMedian, dataPoint):
    # Provides the denominator of the weiszfeld algorithm depending on whether you are adjusting the candidate x or y
    try:
        return 1 / vincenty(testMedian, dataPoint).kilometers
    except ZeroDivisionError:
        traceback.print_exc()
        return 0  # filter points that equal the median out (otherwise no convergence)
    except ValueError:
        # Vincenty doesn't always converge so fall back on great circle distance which is less accurate but always converges
        return 1 / great_circle(testMedian, dataPoint).kilometers

def denomsum(testMedian, dataPoints):
    # Provides the denominator of the weiszfeld algorithm
    temp = 0.0
    for i in range(0, len(dataPoints)):
        try:
            temp += 1 / vincenty(testMedian, dataPoints[i]).kilometers
        except ZeroDivisionError:
            print('zerodivisionerror', dataPoints[i])
            continue  # filter points that equal the median out (otherwise no convergence)
        except ValueError:
            # Vincenty doesn't always converge so fall back on great circle distance which is less accurate but always converges
            temp += 1 / great_circle(testMedian, dataPoints[i]).kilometers
    return temp

def objfunc(testMedian, dataPoints):
    # This function calculates the sum of linear distances from the current candidate median to all points
    # in the data set, as such it is the objective function that we are minimising.
    temp = 0.0
    for i in range(0, len(dataPoints)):
        try:
            temp += vincenty(testMedian, dataPoints[i]).kilometers
        except ValueError:
            # Vincenty doesn't always converge so fall back on great circle distance which is less accurate but always converges
            temp += great_circle(testMedian, dataPoints[i]).kilometers
    return temp

if __name__ == "__main__":
    main()


text:
#ifndef __IVOODOOPLAYER_DISPATCHER_H__
#define __IVOODOOPLAYER_DISPATCHER_H__

#define IVOODOOPLAYER_METHOD_ID_AddRef       1
#define IVOODOOPLAYER_METHOD_ID_Release      2
#define IVOODOOPLAYER_METHOD_ID_GetApps      3
#define IVOODOOPLAYER_METHOD_ID_LaunchApp    4
#define IVOODOOPLAYER_METHOD_ID_StopInstance 5
#define IVOODOOPLAYER_METHOD_ID_WaitInstance 6
#define IVOODOOPLAYER_METHOD_ID_GetInstances 7

#endif


text:
package com.themillhousegroup.gasket.traits

import com.google.gdata.data.BaseEntry

trait ScalaEntry[T <: BaseEntry[T]] {
  /** Access to the underlying Google *Entry object */
  val googleEntry: T

  lazy val title = googleEntry.getTitle.getPlainText

  override def toString = title

  // Avoid precondition-failed problems based on the resource versioning used by Google:
  //http://stackoverflow.com/questions/19006892/com-google-gdata-util-preconditionfailedexception-on-listentry-update-in-googl
  googleEntry.setEtag("*")
}


text:
describe CommentsController do
end


text:
CREATE TABLE [dbo].[Builds] (
    [id]           INT          IDENTITY (1, 1) NOT NULL,
    [BuildVersion] VARCHAR (50) NOT NULL,
    [BranchId]     INT          NOT NULL,
    CONSTRAINT [PK_Builds] PRIMARY KEY CLUSTERED ([id] ASC) WITH (FILLFACTOR = 40),
    CONSTRAINT [FK_Builds_Branches] FOREIGN KEY ([BranchId]) REFERENCES [dbo].[ProjectBranches] ([id])
);


text:
package org.apache.flink.util;

import org.apache.flink.annotation.PublicEvolving;
import org.apache.flink.api.common.functions.InvalidTypesException;
import org.apache.flink.api.common.typeinfo.TypeInformation;
import org.apache.flink.api.java.typeutils.TypeExtractor;

import java.io.Serializable;

/**
 * An {@link OutputTag} is a typed and named tag to use for tagging side outputs
 * of an operator.
 *
 *
An {@code OutputTag} must always be an anonymous inner class so that Flink can derive
 * a {@link TypeInformation} for the generic type parameter.
 *
 *
Example:
 *
{@code
 * OutputTag<Tuple2<String, Long>> info = new OutputTag<Tuple2<String, Long>>("late-data"){});
 * }

 *
 * @param <T> the type of elements in the side-output stream.
 */
@PublicEvolving
public class OutputTag<T> implements Serializable {

	private static final long serialVersionUID = 2L;

	private final String id;

	private final TypeInformation<T> typeInfo;

	/**
	 * Creates a new named {@code OutputTag} with the given id.
	 *
	 * @param id The id of the created {@code OutputTag}.
     */
	public OutputTag(String id) {
		Preconditions.checkNotNull(id, "OutputTag id cannot be null.");
		Preconditions.checkArgument(!id.isEmpty(), "OutputTag id must not be empty.");
		this.id = id;

		try {
			this.typeInfo = TypeExtractor.createTypeInfo(this, OutputTag.class, getClass(), 0);
		}
		catch (InvalidTypesException e) {
			throw new InvalidTypesException("Could not determine TypeInformation for the OutputTag type. " +
					"The most common reason is forgetting to make the OutputTag an anonymous inner class. " +
					"It is also not possible to use generic type variables with OutputTags, such as 'Tuple2'.", e);
		}
	}

	/**
	 * Creates a new named {@code OutputTag} with the given id and output {@link TypeInformation}.
	 *
	 * @param id The id of the created {@code OutputTag}.
	 * @param typeInfo The {@code TypeInformation} for the side output.
	 */
	public OutputTag(String id, TypeInformation<T> typeInfo) {
		Preconditions.checkNotNull(id, "OutputTag id cannot be null.");
		Preconditions.checkArgument(!id.isEmpty(), "OutputTag id must not be empty.");
		this.id = id;
		this.typeInfo = Preconditions.checkNotNull(typeInfo, "TypeInformation cannot be null.");
	}

	// ------------------------------------------------------------------------

	public String getId() {
		return id;
	}

	public TypeInformation<T> getTypeInfo() {
		return typeInfo;
	}

	// ------------------------------------------------------------------------

	@Override
	public boolean equals(Object obj) {
		return obj instanceof OutputTag
			&& ((OutputTag) obj).id.equals(this.id);
	}

	@Override
	public int hashCode() {
		return id.hashCode();
	}

	@Override
	public String toString() {
		return "OutputTag(" + getTypeInfo() + ", " + id + ")";
	}
}


text:
package net.soliddesign.iumpr.ui;

import static org.junit.Assert.assertEquals;

import org.junit.Before;
import org.junit.Test;

/**
 * Unit tests for the {@link SwingExecutor} class
 *
 * @author Matt Gumbel (matt@soliddesign.net)
 *
 */
public class SwingExecutorTest {

    private SwingExecutor instance;

    @Before
    public void setUp() throws Exception {
        instance = new SwingExecutor();
    }

    @Test
    public void testExecute() throws Exception {
        int[] count = new int[] { 0 };
        instance.execute(() -> count[0] = count[0] + 1);
        Thread.sleep(300);
        assertEquals(1, count[0]);
    }

}


text:
Tutorial
========

Creating a Jackson collection is done by calling one of the `wrap()` factory methods on `JacksonDBCollection`:

    JacksonDBCollection<BlogPost, String> coll = JacksonDBCollection.wrap(dbCollection, BlogPost.class,
            String.class);

Inserting looks very similar to using the MongoDB Java driver:

    BlogPost blogPost = ...
    WriteResult<BlogPost, String> result = coll.insert(blogPost);

The returned `WriteResult` has the same methods as the MongoDB Java driver, but also gives you access to the ID the object was saved under, useful for when you are letting the database generate an ID for you:

    String id = result.getSavedId();

You can now load the object by that id:

    BlogPost foundBlogPost = coll.findOneById(id);

Querying can be done using chained query builders:

    DBCursor<BlogPost> cursor = coll.find().is("published", true).in("tags", "mongodb", "java", "jackson");
    if (cursor.hasNext()) {
        BlogPost firstObject = cursor.next();
    }

Or using the `DBQuery` builder directly:

    DBCursor<BlogPost> cursor = coll.find(DBQuery.or(
            DBQuery.is("author", "jsmith"),
            DBQuery.size("comments", 3));

More information about building queries can be found [here](./queries.html).

The collection, cursor and write result interfaces are very similar to the standard Java MongoDB driver. Most methods have been copied across, with generic typing added where appropriate, and overloading to use the generic type where sometimes the generic type is not powerful enough, such as for queries and specifying fields for partial objects.

When it comes to mapping your objects, generally all you need to use is the Jackson annotations, such as `@JsonProperty` and `@JsonCreator`.  If you want a type of `ObjectId`, you have two options, either make your field be of type `ObjectId`, or you can also use `String`, as long as you annotate *both* the serialising and deserialising properties with `@net.vz.mongodb.jackson.ObjectId`.  For example:

    public class BlogPost {
      private String id;
      @ObjectId
      @JsonProperty("_id")
      public String getId() {
        return id;
      }
      @ObjectId
      @JsonProperty("_id")
      public void setId(String id) {
        this.id = id;
      }
    }

Now your id property will be stored in the database as an object ID, and you can let MongoDB generate it for you.  More information about ObjectIds can be found [here](./object-ids.html).  You might not like annotating your ids with `@JsonProperty("_id")`, the mapper supports `@javax.persistence.Id` as a short hand for this:

    public class BlogPost {
      @Id
      public Long id;
    }

Another useful implication of this is if you want to use the same object for database objects and objects to return on the web, you can name the id whatever you want for the web, and you don't need to use Jackson views to to specify which property gets mapped to what name for the database and for the web.

The only limitation to using the id annotation is if you are using `@Creator` annotated constructors or factory methods, because `@javax.persistence.Id` is not supported on method parameters.  For this reason, the mapper provides the annotation `@net.vz.mongodb.jackson.Id`, and it can be used like so:

    public class BlogPost {
      private final String id;
      @JsonCreator
      public BlogPost(@Id @ObjectId id) {
        this.id = id;
      }
      @Id
      @ObjectId
      public String getId() {
        return id;
      }
    }

As you can see, immutable objects are also supported because Jackson supports them, something that most other frameworks don't support.

The mapper also provides an update builder for running updates using the MongoDB [modifier operations](http://www.mongodb.org/display/DOCS/Updating#Updating-ModifierOperations).  This supports serialisation of embedded objects, and can be used like this:

    coll.updateById("someid", DBUpdate.inc("numResponses").push("comments", new Comment("Great post!")));

If you're using references, the mapper makes it easy to work with them.  You can declare a property to be of type `net.vz.mongodb.jackson.DBRef`, which can be instantiated by supplying the ID and the collection name for the reference.  Alternatively, you can supply the class of that reference, if that class is annotated with `@MongoCollection`.  Having loaded the saved object with the reference, you can load the reference by calling `fetch()`:

    @MongoCollection("comments")
    public class Comment {
        @Id
        public String id;
        public String text;
    }

    public class BlogPost {
        @Id
        public String id;
        @ObjectId
        public List<DBRef<Comment, String>> comments;
    }

    BlogPost post = coll.findOneById(someId);
    for (DBRef<Comment, String> comment : post.comments) {
        System.out.println(comment.fetch().text);
    }

To avoid the *n+1 selects* issue, you can use the more efficient `fetch()` method on `JacksonDBCollection`:

    List<Comment> comments = coll.fetch(post.comments);

More information about DBRefs can be found [here](./dbrefs.html).

If you're using your data objects for both storage and web views, you might want to take advantage of Jacksons views feature, so that generated/transient properties aren't persisted, and properties that you don't want leaked and serialised to the web.  The mapper supports this easily, by letting you pass in a view to the wrap method:

    JacksonDBCollection<BlogPost, String> coll = JacksonDBCollection.wrap(DBCollection dbCollection, BlogPost.class,
            String.class, DatabaseView.class);

Of course, if you really want to control things and Jackson's annotations aren't enough, the wrap method is also overloaded to accept an `ObjectMapper`.  When doing this, you must make sure to configure the object mapper to use the mongo custom jackson configuration:

    ObjectMapper myObjectMapper = ...
    MongoJacksonMapperModule.configure(myObjectMapper);
    JacksonDBCollection<BlogPost, String> coll = JacksonDBCollection.wrap(DBCollection dbCollection, BlogPost.class,
            String.class, myObjectMapper);


text:
name: Devin Bayly
role: BSc Student
photo: headshots/devin.png
website: http://mental-landscapes.cs.arizona.edu/
last: "Honors thesis on VR for Neuroscience"
---


text:
<?php

declare(strict_types=1);

namespace Doctrine\Tests\ORM\Functional;

use Doctrine\Common\Collections\Collection;
use Doctrine\Common\Collections\Criteria;
use Doctrine\Tests\Models\Cache\Country;
use Doctrine\Tests\Models\Cache\State;

/**
 * @group DDC-2183
 */
class SecondLevelCacheCriteriaTest extends SecondLevelCacheAbstractTest
{
    public function testMatchingPut()
    {
        $this->evictRegions();

        $this->loadFixturesCountries();
        $this->evictRegions();
        $this->em->clear();

        self::assertFalse($this->cache->containsEntity(Country::class, $this->countries[0]->getId()));

        $repository = $this->em->getRepository(Country::class);
        $queryCount = $this->getCurrentQueryCount();
        $name       = $this->countries[0]->getName();
        $result1    = $repository->matching(new Criteria(
            Criteria::expr()->eq('name', $name)
        ));

        // Because matching returns lazy collection, we force initialization
        $result1->toArray();

        self::assertEquals($queryCount + 1, $this->getCurrentQueryCount());
        self::assertEquals($this->countries[0]->getId(), $result1[0]->getId());
        self::assertEquals($this->countries[0]->getName(), $result1[0]->getName());

        self::assertTrue($this->cache->containsEntity(Country::class, $this->countries[0]->getId()));

        $this->em->clear();

        $result2 = $repository->matching(new Criteria(
            Criteria::expr()->eq('name', $name)
        ));

        self::assertEquals($queryCount + 1, $this->getCurrentQueryCount());
        self::assertCount(1, $result2);

        self::assertInstanceOf(Country::class, $result2[0]);

        self::assertEquals($result1[0]->getId(), $result2[0]->getId());
        self::assertEquals($result1[0]->getName(), $result2[0]->getName());
    }

    public function testRepositoryMatching()
    {
        $this->evictRegions();

        $this->loadFixturesCountries();
        $this->em->clear();

        self::assertTrue($this->cache->containsEntity(Country::class, $this->countries[0]->getId()));

        $repository = $this->em->getRepository(Country::class);
        $queryCount = $this->getCurrentQueryCount();
        $result1    = $repository->matching(new Criteria(
            Criteria::expr()->eq('name', $this->countries[0]->getName())
        ));

        // Because matching returns lazy collection, we force initialization
        $result1->toArray();

        self::assertCount(1, $result1);
        self::assertEquals($queryCount + 1, $this->getCurrentQueryCount());
        self::assertEquals($this->countries[0]->getId(), $result1[0]->getId());
        self::assertEquals($this->countries[0]->getName(), $result1[0]->getName());

        $this->em->clear();

        $result2 = $repository->matching(new Criteria(
            Criteria::expr()->eq('name', $this->countries[0]->getName())
        ));

        // Because matching returns lazy collection, we force initialization
        $result2->toArray();

        self::assertEquals($queryCount + 1, $this->getCurrentQueryCount());
        self::assertCount(1, $result2);

        self::assertInstanceOf(Country::class, $result2[0]);

        self::assertEquals($this->countries[0]->getId(), $result2[0]->getId());
        self::assertEquals($this->countries[0]->getName(), $result2[0]->getName());

        $result3 = $repository->matching(new Criteria(
            Criteria::expr()->eq('name', $this->countries[1]->getName())
        ));

        // Because matching returns lazy collection, we force initialization
        $result3->toArray();

        self::assertEquals($queryCount + 2, $this->getCurrentQueryCount());
        self::assertCount(1, $result3);

        self::assertInstanceOf(Country::class, $result3[0]);

        self::assertEquals($this->countries[1]->getId(), $result3[0]->getId());
        self::assertEquals($this->countries[1]->getName(), $result3[0]->getName());

        $result4 = $repository->matching(new Criteria(
            Criteria::expr()->eq('name', $this->countries[1]->getName())
        ));

        self::assertEquals($queryCount + 2, $this->getCurrentQueryCount());
        self::assertCount(1, $result4);

        self::assertInstanceOf(Country::class, $result4[0]);

        self::assertEquals($this->countries[1]->getId(), $result4[0]->getId());
        self::assertEquals($this->countries[1]->getName(), $result4[0]->getName());
    }

    public function testCollectionMatching()
    {
        $this->loadFixturesCountries();
        $this->loadFixturesStates();
        $this->loadFixturesCities();
        $this->em->clear();
        $this->secondLevelCacheLogger->clearStats();

        $entity     = $this->em->find(State::class, $this->states[0]->getId());
        $itemName   = $this->states[0]->getCities()->get(0)->getName();
        $queryCount = $this->getCurrentQueryCount();
        $collection = $entity->getCities();
        $matching   = $collection->matching(new Criteria(
            Criteria::expr()->eq('name', $itemName)
        ));

        self::assertEquals($queryCount + 1, $this->getCurrentQueryCount());
        self::assertInstanceOf(Collection::class, $matching);
        self::assertCount(1, $matching);

        $this->em->clear();

        $entity     = $this->em->find(State::class, $this->states[0]->getId());
        $queryCount = $this->getCurrentQueryCount();
        $collection = $entity->getCities();
        $matching   = $collection->matching(new Criteria(
            Criteria::expr()->eq('name', $itemName)
        ));

        self::assertEquals($queryCount, $this->getCurrentQueryCount());
        self::assertInstanceOf(Collection::class, $matching);
        self::assertCount(1, $matching);
    }
}