text:
package httplog

import (
	"net/http"
)

func (httpLogger *internalHttpLogger) Gone(w http.ResponseWriter, cascade ...interface{}) {

	httpStatusCode := http.StatusGone
	httpStatusName :=  StatusNameGone

	httpLogger.jsonHttpResponse(w, httpStatusCode, httpStatusName, cascade...)
}


text:
pc.extend(pc, function () {
    'use strict';

    /**
     * @name pc.TransformFeedback
     * @class Transform feedback helper object
     * @description This object allows you to configure and use the transform feedback feature (WebGL2 only).
     *  How to use:

     *

     *
First, check that you're on WebGL2, by looking at the app.graphicsDevice.webgl2 value.

     *
Define the outputs in your vertex shader. The syntax is out vec3 out_vertex_position, note that there must be out_ in the name. You can then simply assign values to these outputs in VS. The order and size of shader outputs must match the output buffer layout.

     *
Create the shader using pc.TransformFeedback.createShader(device, vsCode, yourShaderName).

     *
Create/acquire the input vertex buffer. Can be any pc.VertexBuffer, either manually created, or from a pc.Mesh.

     *
Create the pc.TransformFeedback object: var tf = new pc.TransformFeedback(inputBuffer). This object will internally create an output buffer.

     *
Run the shader: tf.process(shader). Shader will take the input buffer, process it and write to the output buffer, then the input/output buffers will be automatically swapped, so you'll immediately see the result.

     *

     * @example
     * // *** shader asset ***
     * attribute vec3 vertex_position;
     * attribute vec3 vertex_normal;
     * attribute vec2 vertex_texCoord0;
     * attribute vec4 vertex_tangent;
     * out vec3 out_vertex_position;
     * out vec3 out_vertex_normal;
     * out vec2 out_vertex_texCoord0;
     * out vec4 out_vertex_tangent;
     * void main(void) {
     *     // read position and normal, write new position (push away)
     *     out_vertex_position = vertex_position + vertex_normal * 0.01;
     *     // pass other attributes unchanged
     *     out_vertex_normal = vertex_normal;
     *     out_vertex_texCoord0 = vertex_texCoord0;
     *     out_vertex_tangent = vertex_tangent;
     * }
     * @example
     * // *** script asset ***
     * var TransformExample = pc.createScript('transformExample');
     *
     * // attribute that references shader asset and material
     * TransformExample.attributes.add('shaderCode', { type: 'asset', assetType: 'shader' });
     * TransformExample.attributes.add('material', { type: 'asset', assetType: 'material' });
     *
     * TransformExample.prototype.initialize = function() {
     *     var device = this.app.graphicsDevice;
     *     var mesh = pc.createTorus(device, { tubeRadius: 0.01, ringRadius: 3 });
     *     var node = new pc.GraphNode();
     *     var meshInstance = new pc.MeshInstance(node, mesh, this.material.resource);
     *     var model = new pc.Model();
     *     model.graph = node;
     *     model.meshInstances = [ meshInstance ];
     *     this.app.scene.addModel(model);
     *
     *     // if webgl2 is not supported, TF is not available
     *     if (!device.webgl2) return;
     *     var inputBuffer = mesh.vertexBuffer;
     *     this.tf = new pc.TransformFeedback(inputBuffer);
     *     this.shader = pc.TransformFeedback.createShader(device, this.shaderCode.resource, "tfMoveUp");
     * };
     *
     * TransformExample.prototype.update = function(dt) {
     *     if (!this.app.graphicsDevice.webgl2) return;
     *     this.tf.process(this.shader);
     * };
     * @param {pc.VertexBuffer} inputBuffer The input vertex buffer
     * @param {Number} [usage] The optional usage type of the output vertex buffer (see pc.BUFFER_*). pc.BUFFER_GPUDYNAMIC is recommended for continuous update, and is the default value.
     */
    var TransformFeedback = function (inputBuffer, usage) {
        usage = usage || pc.BUFFER_GPUDYNAMIC;
        this.device = inputBuffer.device;
        var gl = this.device.gl;

        this._inputBuffer = inputBuffer;
        if (usage === pc.BUFFER_GPUDYNAMIC && inputBuffer.usage !== usage) {
            // have to recreate input buffer with other usage
            gl.bindBuffer(gl.ARRAY_BUFFER, inputBuffer.bufferId);
            gl.bufferData(gl.ARRAY_BUFFER, inputBuffer.storage, gl.DYNAMIC_COPY);
        }

        this._outputBuffer = new pc.VertexBuffer(inputBuffer.device, inputBuffer.format, inputBuffer.numVertices, usage, inputBuffer.storage);
    };

    /**
     * @function
     * @name pc.TransformFeedback#createShader
     * @description Creates a transform feedback ready vertex shader from code.
     * @param {pc.GraphicsDevice} graphicsDevice The graphics device used by the renderer.
     * @param {String} vsCode Vertex shader code. Should contain output variables starting with "out_".
     * @param {String} name Unique name for caching the shader.
     * @returns {pc.Shader} A shader to use in the process() function.
     */
    TransformFeedback.createShader = function (device, vsCode, name) {
        return pc.shaderChunks.createShaderFromCode(device, vsCode, null, name, true);
    };

    TransformFeedback.prototype = {
        /**
         * @function
         * @name pc.TransformFeedback#destroy
         * @description Destroys the transform feedback helper object
         */
        destroy: function () {
            this._outputBuffer.destroy();
        },

        /**
         * @function
         * @name pc.TransformFeedback#process
         * @description Runs the specified shader on the input buffer, writes results into the new buffer, then optionally swaps input/output.
         * @param {pc.Shader} shader A vertex shader to run. Should be created with pc.TransformFeedback.createShader.
         * @param {Boolean} [swap] Swap input/output buffer data. Useful for continuous buffer processing. Default is true.
         */
        process: function (shader, swap) {
            if (swap === undefined) swap = true;

            var device = this.device;
            device.setRenderTarget(null);
            device.updateBegin();
            device.setVertexBuffer(this._inputBuffer, 0);
            device.setRaster(false);
            device.setTransformFeedbackBuffer(this._outputBuffer);
            device.setShader(shader);
            device.draw({
                type: pc.PRIMITIVE_POINTS,
                base: 0,
                count: this._inputBuffer.numVertices,
                indexed: false
            });
            device.setTransformFeedbackBuffer(null);
            device.setRaster(true);
            device.updateEnd();

            // swap buffers
            if (swap) {
                var tmp = this._inputBuffer.bufferId;
                this._inputBuffer.bufferId = this._outputBuffer.bufferId;
                this._outputBuffer.bufferId = tmp;
            }
        }
    };

    /**
     * @readonly
     * @name pc.TransformFeedback#inputBuffer
     * @type pc.VertexBuffer
     * @description The current input buffer
     */
    Object.defineProperty(TransformFeedback.prototype, 'inputBuffer', {
        get: function () { return this._inputBuffer; },
    });

    /**
     * @readonly
     * @name pc.TransformFeedback#outputBuffer
     * @type pc.VertexBuffer
     * @description The current output buffer
     */
    Object.defineProperty(TransformFeedback.prototype, 'outputBuffer', {
        get: function () { return this._outputBuffer; },
    });

    return {
        TransformFeedback: TransformFeedback
    };
}());

redpajama_set_name: RedPajamaGithub


text:
"""
Interpose JSON schema loading through a registry of known schemas.
"""
import sys

from jsonschema import RefResolver, RefResolutionError, validate

from jsonschematypes.factory import TypeFactory
from jsonschematypes.files import iter_gzip, iter_tar, iter_schemas
from jsonschematypes.model import ARRAY, DEFINITIONS, ID, ITEMS, REF, TYPE
from jsonschematypes.modules import ModuleFinder

def iter_schema_refs(schema):
    """
    Iterate through all refs in a schema.
    """
    if REF in schema:
        yield schema[REF]
    for property_ in schema.get("properties", {}).values():
        if REF in property_:
            yield property_[REF]
        elif property_.get(TYPE) == ARRAY and REF in property_.get(ITEMS, {}):
            yield property_.get(ITEMS, {})[REF]

def do_not_resolve(uri):
    raise RefResolutionError(uri)

class Registry(dict):
    """
    A registry of loaded JSON schemas, mapped by id.

    JSON Schema ids are both unique names and URIs. Keeping a registry of
    known schemas avoids URI loading at runtime.
    """
    def __init__(self, mime_types=None):
        """
        :param mime_types: a mapping of mime types to schema loading functions.
        """
        super(Registry, self).__init__()
        self.mime_types = {
            "application/x-gzip": iter_gzip,
            "application/x-tar": iter_tar,
        }
        if mime_types:
            self.mime_types.update(mime_types)
        self.factory = TypeFactory(self)

    def load(self, *filenames):
        """
        Load one or more schemas from file.

        Files are evaluated according to their mime types, which allows
        archives (e.g. tars) to be loaded.
        """
        return [
            self.register(schema)
            for filename in filenames
            for schema in iter_schemas(filename, self.mime_types)
        ]

    def validate(self, instance, schema_id, skip_http=True):
        """
        Validate an instance against a registered schema.
        """
        schema = self[schema_id]
        handlers = {}
        if skip_http:
            handlers.update(
                http=do_not_resolve,
                https=do_not_resolve,
            )
        resolver = RefResolver.from_schema(
            schema,
            store=self,
            handlers=handlers,
        )
        return validate(instance, schema, resolver=resolver)

    def create_class(self, schema_id):
        """
        Create a Python class that maps to the given schema.
        """
        return self.factory.make_class(schema_id)

    def create_class_for(self, schema, ref):
        if ref is None:
            return None

        try:
            return self.create_class(self.expand_ref(schema, ref))
        except KeyError:
            # unable to resolve ref; fall through
            return None

    def configure_imports(self, basename="generated", keep_uri_parts=None):
        """
        Register an import handler that automatically creates classes.
        """
        sys.meta_path.append(ModuleFinder(
            factory=self.factory,
            basename=basename,
            keep_uri_parts=keep_uri_parts,
        ))

    def find_unresolved(self):
        """
        Return all unresolved schema references.
        """
        return {
            ref
            for schema in self.values()
            for ref in iter_schema_refs(schema)
            if self.expand_ref(schema, ref) not in self
        }

    def register(self, schema):
        """
        Register a schema.

        Schemas must define an `id` attribute.
        """
        schema_id = schema[ID]
        self[schema_id] = schema
        for definition in schema.get(DEFINITIONS, {}).values():
            self.register(definition)
        return schema_id

    def expand_ref(self, schema, ref):
        """
        Expand refs to internal definitions.
        """
        if ref is None:
            return ref

        if ref.startswith("#/definitions/"):
            definition = ref.split("#/definitions/", 1)[1]
            return schema.get(DEFINITIONS, {}).get(definition, {}).get(ID, ref)

        return ref


text:
package com.helger.schematron.pure.model;

import javax.annotation.Nullable;

/**
 * Base interface for all elements that may have an ID.
 * IHasID<String> is not used here, because it requires an ID
 * to be present!
 *
 * @author Philip Helger
 */
public interface IPSHasID
{
  /**
   * @return The optional ID of this element. May be null.
   */
  @Nullable
  String getID ();

  /**
   * @return true if an ID is present, false
   *         otherwise.
   */
  default boolean hasID ()
  {
    return getID () != null;
  }

  /**
   * Set an ID for this object.
   *
   * @param sID
   *        The ID to be set. May be null.
   */
  void setID (@Nullable String sID);
}


text:
#if !defined(XMLHOLDER_HPP)
#define XMLHOLDER_HPP

#include <xercesc/util/XMemory.hpp>

XERCES_CPP_NAMESPACE_BEGIN

template<class Type>
class XMLUTIL_EXPORT XMLHolder : public XMemory
{
public :
    // -----------------------------------------------------------------------
    //  Constructors and Destructor
    // -----------------------------------------------------------------------
    XMLHolder();

    ~XMLHolder();

    Type    fInstance;

    static XMLHolder<Type>*
    castTo(void* handle);

private :
    // -----------------------------------------------------------------------
    //  Unimplemented constructors and operators
    // -----------------------------------------------------------------------
    XMLHolder(const XMLHolder<Type>&);
    XMLHolder<Type>& operator=(const XMLHolder<Type>&);

};

XERCES_CPP_NAMESPACE_END

#if !defined(XERCES_TMPLSINC)
#include <xercesc/util/XMLHolder.c>
#endif

#endif


text:
layout: post
title: "co Ty na to, że Google Reader powraca?"
date: 2013-07-01 03:00:00
category: theory
tags: [google reader, google, marka, przyzwyczajenie]

description: "A co gdyby Google Reader jednak nie został zamknięty? Mielibyśmy do czynienia z jednym z największych poziomów wtf-level w historii internetu. Zdecydowanie przywiązaliśmy się do tej marki, a jej odejście spowodowało wielkie poruszenie w Internecie. No właśnie, a co gdyby jednak wrócił? Porozmawiajmy o przywiązaniu."
excerpt: "/assets/images/2013/9-route.jpg"

---

{% include JB/setup %}

A co gdyby Google Reader jednak nie został zamknięty? Mielibyśmy do czynienia z jednym z największych poziomów wtf-level w historii internetu. Zdecydowanie przywiązaliśmy się do tej marki, a jej odejście spowodowało wielkie poruszenie w Internecie. No właśnie, a co gdyby jednak wrócił? Porozmawiajmy o przywiązaniu.

<img src="/assets/images/2013/9-route.jpg" alt="route 66 @ USA" />

1) jak tam dzisiaj Twoje samopoczucie?
--------------------------------------

Przywiązanie jest istotne nie tylko dla marki. Ciekawy przypadek zafundował mi pewien znajomy, który regularnie pytał się o samopoczucie. Proste pytanie, nie wymagające dużej ilości pracy, a fest pozytywnie nacechowane emocjami (chciałem napisać ch\*lernie pozytywnie, ale ponoć to już podchodzi pod wulgaryzmy).

Po pewnym czasie nagle przestał zadawać te pytania. Zaczęło być to dziwne, aż samemu, w celu zapełnienia tej luki, zacząłem zadawać mu te same pytania. Czy podobnie da się zrobić z serwisem internetowym? Zmuszać użytkownika do regularnych wizyt, a potem odpuścić, aby sam z własnej woli nabijał ruch?

2) jak jedziesz do pracy i do domu?
-----------------------------------

Zastanawiałeś się kiedyś jak jedziesz do pracy i do domu? Podpowiem - automatycznie. Tak naprawdę po dłuższym czasie nie myślimy nad trasą, bo się do niej na tyle przyzwyczailiśmy, że nasz mózg sam nas nią kieruje.

Próbowaliście kiedyś zmienić drogę? Początkowo o tym pamiętaliście, ale z czasem rutyna wygrała. Sam nie raz tak próbowałem i dopiero na miejscu zauważałem, że przecież miałem po drodze coś załatwić.

3) Google Reader powraca!
-------------------------

Gdyby tak było, okazałoby się to największym zaskoczeniem dla jego ex-użytkowników. Gigant wydając jedną informację stworzył sobie genialną reklamę za darmo (ile to portali pisało, że google reader jest najlepszy?). Ciekaw jestem co by zrobili użytkownicy gdyby nagle stary czytnik nie zaprzestał działania.

Perfekcyjnie widać tutaj kwestię przyzwyczajenia. Google publikując darmowy czytnik o bardzo wysokiej jakości praktycznie usunął rynek płatnych czytników rss. Zostało kilka małych darmowych projektów, które za nic mu nie dorównywały. Nagle się okazało, że wszystko co dobre jest płatne, a darmowe odpowiednimi grzeszą niezbyt dobrą jakością.

4) Zmień swoją drogę do pracy.
------------------------------

Czasem zbyt często podążamy za rutyną nawet o tym nie wiedząc. Niejednokrotnie można się na tym przejechać chcąć odwiedzić Empik w drodze do domu albo zmieniając lokalizację kontaktu w pokoju. Gorzej, jeśli przyzwyczaimy się do imienia dziewczyny i zrobimy kosztowną pomyłkę przy nowej partnerce.

Spróbuj czasem zmienić drogę do domu czy pracy i zmienić swoje przyzwyczajenia. Jeśli udało się od razu... zdecydowanie jesteś wyjątkowym człowiekiem... albo masz problemy z przyzwyczajeniem :-)

foto: [flickr](http://www.flickr.com/photos/sovietuk/11937038/)


text:
var talib = require("talib");
var semver = require("semver");
var _ = require('lodash');

var talibError = 'Gekko was unable to configure talib indicator:\n\t';
var talibGTEv103 = semver.gte(talib.version, '1.0.3');

// Wrapper that executes a talib indicator
var execute = function(callback, params) {
    // talib callback style since talib-v1.0.3
    var talibCallback = function(err, result) {
        if(err) return callback(err);
        callback(null, result.result);
    };

    // talib legacy callback style before talib-v1.0.3
    var talibLegacyCallback = function(result) {
        var error = result.error;
        talibCallback.apply(this, [error, result]);
    };

    return talib.execute(params, talibGTEv103 ? talibCallback : talibLegacyCallback);
}

// Helper that makes sure all required parameters
// for a specific talib indicator are present.
var verifyParams = (methodName, params) => {
    var requiredParams = methods[methodName].requires;

    _.each(requiredParams, paramName => {
        if(!_.has(params, paramName))
            throw talibError + methodName + ' requires ' + paramName + '.';

        var val = params[paramName];

        if(!_.isNumber(val))
            throw talibError + paramName + ' needs to be a number';
    });
}

var methods = {};

methods.accbands = {
    requires: ['optInTimePeriod'],
    create: (params) => {
        verifyParams('accbands', params);

        return (data, callback) => execute(callback, {
            name: "ACCBANDS",
            high: data.high,
            low: data.low,
            close: data.close,
            startIdx: 0,
            endIdx: data.high.length - 1,
            optInTimePeriod: params.optInTimePeriod
        });
    }
}

methods.ad = {
    requires: ['optInTimePeriod'],
    create: (params) => {
        verifyParams('accbands', params);

        return (data, callback) => execute(callback, {
            name: "AD",
            high: data.high,
            low: data.low,
            close: data.close,
            volume: data.volume,
            startIdx: 0,
            endIdx: data.high.length - 1,
            optInTimePeriod: params.optInTimePeriod
        });
    }
}

methods.adosc = {
    requires: ['optInFastPeriod', 'optInSlowPeriod'],
    create: (params) => {
        verifyParams('adosc', params);

        return (data, callback) => execute(callback, {
            name: "ADOSC",
            high: data.high,
            low: data.low,
            close: data.close,
            volume: data.volume,
            startIdx: 0,
            endIdx: data.high.length - 1,
            optInFastPeriod: params.optInFastPeriod,
            optInSlowPeriod: params.optInSlowPeriod
        });
    }
}

methods.adx = {
    requires: ['optInTimePeriod'],
    create: (params) => {
        verifyParams('adx', params);

        return (data, callback) => execute(callback, {
            name: "ADX",
            high: data.high,
            low: data.low,
            close: data.close,
            startIdx: 0,
            endIdx: data.high.length - 1,
            optInTimePeriod: params.optInTimePeriod
        });
    }
}

methods.adxr = {
    requires: ['optInTimePeriod'],
    create: (params) => {
        verifyParams('adxr', params);

        return (data, callback) => execute(callback, {
            name: "ADXR",
            high: data.high,
            low: data.low,
            close: data.close,
            startIdx: 0,
            endIdx: data.high.length - 1,
            optInTimePeriod: params.optInTimePeriod
        });
    }
}

methods.apo = {
    requires: ['optInFastPeriod', 'optInSlowPeriod', 'optInMAType'],
    create: (params) => {
        verifyParams('apo', params);

        return (data, callback) => execute(callback, {
            name: "APO",
            inReal: data.close,
            startIdx: 0,
            endIdx: data.length - 1,
            optInFastPeriod: params.optInFastPeriod,
            optInSlowPeriod: params.optInSlowPeriod,
            optInMAType: params.optInMAType
        });
    }
}

methods.aroon = {
    requires: ['optInTimePeriod'],
    create: (params) => {
        verifyParams('aroon', params);

        return (data, callback) => execute(callback, {
            name: "AROON",
            high: data.high,
            low: data.low,
            startIdx: 0,
            endIdx: data.high.length - 1,
            optInTimePeriod: params.optInTimePeriod
        });
    }
}

methods.aroonosc = {
    requires: ['optInTimePeriod'],
    create: (params) => {
        verifyParams('aroonosc', params);

        return (data, callback) => execute(callback, {
            name: "AROONOSC",
            high: data.high,
            low: data.low,
            startIdx: 0,
            endIdx: data.high.length - 1,
            optInTimePeriod: params.optInTimePeriod
        });
    }
}

methods.atr = {
    requires: ['optInTimePeriod'],
    create: (params) => {
        verifyParams('atr', params);

        return (data, callback) => execute(callback, {
            name: "ATR",
            high: data.high,
            low: data.low,
            close: data.close,
            startIdx: 0,
            endIdx: data.high.length - 1,
            optInTimePeriod: params.optInTimePeriod
        });
    }
}

methods.avgprice = {
    requires: ['optInTimePeriod'],
    create: (params) => {
        verifyParams('avgprice', params);

        return (data, callback) => execute(callback, {
            name: "AVGPRICE",
            open: data.open,
            high: data.high,
            low: data.low,
            close: data.close,
            startIdx: 0,
            endIdx: data.open.length - 1,
            optInTimePeriod: params.optInTimePeriod
        });
    }
}

methods.bbands = {
    requires: ['optInTimePeriod', 'optInNbDevUp', 'optInNbDevDn', 'optInMAType'],
    create: (params) => {
        verifyParams('bbands', params);

        return (data, callback) => execute(callback, {
            name: "BBANDS",
            inReal: data.close,
            startIdx: 0,
            endIdx: data.close.length - 1,
            optInTimePeriod: params.optInTimePeriod,
            optInNbDevUp: params.optInNbDevUp,
            optInNbDevDn: params.optInNbDevDn,
            optInMAType: params.optInMAType
        });
    }
}

///////////////////////////////////////////////////////////////

// this.beta = function(data_0, data_1, period) {
//     return talibWrapper({
//         name: "BETA",
//         inReal0: data_0,
//         inReal1: data_1,
//         startIdx: 0,
//         endIdx: data_0.length - 1,
//         optInTimePeriod: period
//     });
// };

methods.bop = {
    requires: [],
    create: (params) => {
        verifyParams('bop', params);

        return (data, callback) => execute(callback, {
            name: "BOP",
            open: data.open,
            high: data.high,
            low: data.low,
            close: data.close,
            startIdx: 0,
            endIdx: data.high.length - 1
        });
    }
}

methods.cci = {
    requires: ['optInTimePeriod'],
    create: (params) => {
        verifyParams('cci', params);

        return (data, callback) => execute(callback, {
            name: "CCI",
            high: data.high,
            low: data.low,
            close: data.close,
            startIdx: 0,
            endIdx: data.high.length - 1,
            optInTimePeriod: params.optInTimePeriod
        });
    }
}

methods.cmo = {
    requires: ['optInTimePeriod'],
    create: (params) => {
        verifyParams('cmo', params);

        return (data, callback) => execute(callback, {
            name: "CMO",
            inReal: data.close,
            startIdx: 0,
            endIdx: data.close.length - 1,
            optInTimePeriod: params.optInTimePeriod
        });
    }
}

// this.correl = function(data_0, data_1, period) {
//     return talibWrapper({
//         name: "CORREL",
//         inReal0: data_0,
//         inReal1: data_1,
//         startIdx: 0,
//         endIdx: data_0.length - 1,
//         optInTimePeriod: period
//     });
// };

methods.dema = {
    requires: ['optInTimePeriod'],
    create: (params) => {
        verifyParams('dema', params);

        return (data, callback) => execute(callback, {
            name: "DEMA",
            inReal: data.close,
            startIdx: 0,
            endIdx: data.close.length - 1,
            optInTimePeriod: params.optInTimePeriod
        });
    }
}

methods.dx = {
    requires: ['optInTimePeriod'],
    create: (params) => {
        verifyParams('dx', params);

        return (data, callback) => execute(callback, {
            name: "DX",
            high: data.high,
            low: data.low,
            close: data.close,
            startIdx: 0,
            endIdx: data.high.length - 1,
            optInTimePeriod: params.optInTimePeriod
        });
    }
}

methods.ema = {
    requires: ['optInTimePeriod'],
    create: (params) => {
        verifyParams('ema', params);

        return (data, callback) => execute(callback, {
            name: "EMA",
            inReal: data.close,
            startIdx: 0,
            endIdx: data.close.length - 1,
            optInTimePeriod: params.optInTimePeriod
        });
    }
}

methods.ht_dcperiod = {
    requires: [],
    create: (params) => {
        verifyParams('ht_dcperiod', params);

        return (data, callback) => execute(callback, {
            name: "HT_DCPERIOD",
            inReal: data.close,
            startIdx: 0,
            endIdx: data.close.length - 1
        });
    }
}

methods.ht_dcphase = {
    requires: [],
    create: (params) => {
        verifyParams('ht_dcphase', params);

        return (data, callback) => execute(callback, {
            name: "HT_DCPHASE",
            inReal: data.close,
            startIdx: 0,
            endIdx: data.close.length - 1
        });
    }
}

methods.ht_phasor = {
    requires: [],
    create: (params) => {
        verifyParams('ht_phasor', params);

        return (data, callback) => execute(callback, {
            name: "HT_PHASOR",
            inReal: data.close,
            startIdx: 0,
            endIdx: data.close.length - 1
        });
    }
}

methods.ht_sine = {
    requires: [],
    create: (params) => {
        verifyParams('ht_sine', params);

        return (data, callback) => execute(callback, {
            name: "HT_SINE",
            inReal: data.close,
            startIdx: 0,
            endIdx: data.close.length - 1
        });
    }
}

methods.ht_trendline = {
    requires: [],
    create: (params) => {
        verifyParams('ht_trendline', params);

        return (data, callback) => execute(callback, {
            name: "HT_TRENDLINE",
            inReal: data.close,
            startIdx: 0,
            endIdx: data.close.length - 1
        });
    }
}

methods.ht_trendmode = {
    requires: [],
    create: (params) => {
        verifyParams('ht_trendmode', params);

        return (data, callback) => execute(callback, {
            name: "HT_TRENDMODE",
            inReal: data.close,
            startIdx: 0,
            endIdx: data.close.length - 1
        });
    }
}

methods.imi = {
    requires: ['optInTimePeriod'],
    create: (params) => {
        verifyParams('imi', params);

        return (data, callback) => execute(callback, {
            name: "IMI",
            open: data.open,
            close: data.close,
            startIdx: 0,
            endIdx: data.open.length - 1,
            optInTimePeriod: params.optInTimePeriod
        });
    }
}

methods.kama = {
    requires: ['optInTimePeriod'],
    create: (params) => {
        verifyParams('kama', params);

        return (data, callback) => execute(callback, {
            name: "KAMA",
            inReal: data.close,
            startIdx: 0,
            endIdx: data.close.length - 1,
            optInTimePeriod: params.optInTimePeriod
        });
    }
}

methods.linearreg = {
    requires: ['optInTimePeriod'],
    create: (params) => {
        verifyParams('linearreg', params);

        return (data, callback) => execute(callback, {
            name: "LINEARREG",
            inReal: data.close,
            startIdx: 0,
            endIdx: data.close.length - 1,
            optInTimePeriod: params.optInTimePeriod
        });
    }
}

methods.linearreg_angle = {
    requires: ['optInTimePeriod'],
    create: (params) => {
        verifyParams('linearreg_angle', params);

        return (data, callback) => execute(callback, {
            name: "LINEARREG_ANGLE",
            inReal: data.close,
            startIdx: 0,
            endIdx: data.close.length - 1,
            optInTimePeriod: params.optInTimePeriod
        });
    }
}

methods.linearreg_intercept = {
    requires: ['optInTimePeriod'],
    create: (params) => {
        verifyParams('linearreg_intercept', params);

        return (data, callback) => execute(callback, {
            name: "LINEARREG_INTERCEPT",
            inReal: data.close,
            startIdx: 0,
            endIdx: data.close.length - 1,
            optInTimePeriod: params.optInTimePeriod
        });
    }
}

methods.linearreg_slope = {
    requires: ['optInTimePeriod'],
    create: (params) => {
        verifyParams('linearreg_slope', params);

        return (data, callback) => execute(callback, {
            name: "LINEARREG_SLOPE",
            inReal: data.close,
            startIdx: 0,
            endIdx: data.close.length - 1,
            optInTimePeriod: params.optInTimePeriod
        });
    }
}

methods.ma = {
    requires: ['optInTimePeriod', 'optInMAType'],
    create: (params) => {
        verifyParams('ma', params);

        return (data, callback) => execute(callback, {
            name: "MA",
            inReal: data.close,
            startIdx: 0,
            endIdx: data.close.length - 1,
            optInTimePeriod: params.optInTimePeriod,
            optInMAType: params.optInMAType
        });
    }
}

methods.macd = {
    requires: ['optInFastPeriod', 'optInSlowPeriod', 'optInSignalPeriod'],
    create: (params) => {
        verifyParams('macd', params);

        return (data, callback) => execute(callback, {
            name: "MACD",
            inReal: data.close,
            startIdx: 0,
            endIdx: data.close.length - 1,
            optInFastPeriod: params.optInFastPeriod,
            optInSlowPeriod: params.optInSlowPeriod,
            optInSignalPeriod: params.optInSignalPeriod
        });
    }
}

methods.macdext = {
    requires: [
        'optInFastPeriod',
        'optInFastMAType',
        'optInSlowPeriod',
        'optInSlowMAType',
        'optInSignalPeriod',
        'optInSignalMAType'
    ],
    create: (params) => {
        verifyParams('macdext', params);

        return (data, callback) => execute(callback, {
            name: "MACDEXT",
            inReal: data.close,
            startIdx: 0,
            endIdx: data.close.length - 1,
            optInFastPeriod: params.optInFastPeriod,
            optInFastMAType: params.optInFastMAType,
            optInSlowPeriod: params.optInSlowPeriod,
            optInSlowMAType: params.optInSlowMAType,
            optInSignalPeriod: params.optInSignalPeriod,
            optInSignalMAType: params.optInSignalMAType
        });
    }
}

methods.macdfix = {
    requires: ['optInSignalPeriod'],
    create: (params) => {
        verifyParams('macdfix', params);

        return (data, callback) => execute(callback, {
            name: "MACDFIX",
            inReal: data.close,
            startIdx: 0,
            endIdx: data.close.length - 1,
            optInSignalPeriod: params.optInSignalPeriod
        });
    }
}

methods.mama = {
    requires: ['optInFastLimit', 'optInSlowLimit'],
    create: (params) => {
        verifyParams('mama', params);

        return (data, callback) => execute(callback, {
            name: "MAMA",
            inReal: data.close,
            startIdx: 0,
            endIdx: data.close.length - 1,
            optInFastLimit: params.optInFastLimit,
            optInSlowLimit: params.optInSlowLimit
        });
    }
}

methods.mavp = {
    requires: ['inPeriods', 'optInMinPeriod', 'optInMaxPeriod', 'optInMAType'],
    create: (params) => {
        verifyParams('mavp', params);

        return (data, callback) => execute(callback, {
            name: "MAVP",
            inReal: data.close,
            inPeriods: params.inPeriods,
            startIdx: 0,
            endIdx: data.close.length - 1,
            optInMinPeriod: params.optInMinPeriod,
            optInMaxPeriod: params.optInMaxPeriod,
            optInMAType: params.optInMAType
        });
    }
}

methods.max = {
    requires: ['optInTimePeriod'],
    create: (params) => {
        verifyParams('max', params);

        return (data, callback) => execute(callback, {
            name: "MAX",
            inReal: data.close,
            startIdx: 0,
            endIdx: data.close.length - 1,
            optInTimePeriod: params.optInTimePeriod
        });
    }
}

methods.maxindex = {
    requires: ['optInTimePeriod'],
    create: (params) => {
        verifyParams('maxindex', params);

        return (data, callback) => execute(callback, {
            name: "MAXINDEX",
            inReal: data.close,
            startIdx: 0,
            endIdx: data.close.length - 1,
            optInTimePeriod: params.optInTimePeriod
        });
    }
}

methods.medprice = {
    requires: ['optInTimePeriod'],
    create: (params) => {
        verifyParams('medprice', params);

        return (data, callback) => execute(callback, {
            name: "MEDPRICE",
            high: data.high,
            low: data.low,
            startIdx: 0,
            endIdx: data.high.length - 1,
            optInTimePeriod: params.optInTimePeriod
        });
    }
}

methods.mfi = {
    requires: ['optInTimePeriod'],
    create: (params) => {
        verifyParams('mfi', params);

        return (data, callback) => execute(callback, {
            name: "MFI",
            high: data.high,
            low: data.low,
            close: data.close,
            volume: data.volume,
            startIdx: 0,
            endIdx: data.high.length - 1,
            optInTimePeriod: params.optInTimePeriod
        });
    }
}

methods.midpoint = {
    requires: ['optInTimePeriod'],
    create: (params) => {
        verifyParams('midpoint', params);

        return (data, callback) => execute(callback, {
            name: "MIDPOINT",
            inReal: data.close,
            startIdx: 0,
            endIdx: data.close.length - 1,
            optInTimePeriod: params.optInTimePeriod
        });
    }
}

methods.midprice = {
    requires: ['optInTimePeriod'],
    create: (params) => {
        verifyParams('midprice', params);

        return (data, callback) => execute(callback, {
            name: "MIDPRICE",
            high: data.high,
            low: data.low,
            startIdx: 0,
            endIdx: data.high.length - 1,
            optInTimePeriod: params.optInTimePeriod
        });
    }
}

methods.min = {
    requires: ['optInTimePeriod'],
    create: (params) => {
        verifyParams('min', params);

        return (data, callback) => execute(callback, {
            name: "MIN",
            inReal: data.close,
            startIdx: 0,
            endIdx: data.close.length - 1,
            optInTimePeriod: params.optInTimePeriod
        });
    }
}

methods.minindex = {
    requires: ['optInTimePeriod'],
    create: (params) => {
        verifyParams('minindex', params);

        return (data, callback) => execute(callback, {
            name: "MININDEX",
            inReal: data.close,
            startIdx: 0,
            endIdx: data.close.length - 1,
            optInTimePeriod: params.optInTimePeriod
        });
    }
}

methods.minmax = {
    requires: ['optInTimePeriod'],
    create: (params) => {
        verifyParams('minmax', params);

        return (data, callback) => execute(callback, {
            name: "MINMAX",
            inReal: data.close,
            startIdx: 0,
            endIdx: data.close.length - 1,
            optInTimePeriod: params.optInTimePeriod
        });
    }
}

methods.minmaxindex = {
    requires: ['optInTimePeriod'],
    create: (params) => {
        verifyParams('minmaxindex', params);

        return (data, callback) => execute(callback, {
            name: "MINMAXINDEX",
            inReal: data.close,
            startIdx: 0,
            endIdx: data.length - 1,
            optInTimePeriod: params.optInTimePeriod
        });
    }
}

methods.minus_di = {
    requires: ['optInTimePeriod'],
    create: (params) => {
        verifyParams('minus_di', params);

        return (data, callback) => execute(callback, {
            name: "MINUS_DI",
            high: data.high,
            low: data.low,
            close: data.close,
            startIdx: 0,
            endIdx: data.high.length - 1,
            optInTimePeriod: params.optInTimePeriod
        });
    }
}

methods.minus_dm = {
    requires: ['optInTimePeriod'],
    create: (params) => {
        verifyParams('minus_dm', params);

        return (data, callback) => execute(callback, {
            name: "MINUS_DM",
            high: data.high,
            low: data.low,
            startIdx: 0,
            endIdx: data.high.length - 1,
            optInTimePeriod: params.optInTimePeriod
        });
    }
}

methods.mom = {
    requires: ['optInTimePeriod'],
    create: (params) => {
        verifyParams('mom', params);

        return (data, callback) => execute(callback, {
            name: "MOM",
            inReal: data.close,
            startIdx: 0,
            endIdx: data.close.length - 1,
            optInTimePeriod: params.optInTimePeriod
        });
    }
}

methods.natr = {
    requires: ['optInTimePeriod'],
    create: (params) => {
        verifyParams('natr', params);

        return (data, callback) => execute(callback, {
            name: "NATR",
            high: data.high,
            low: data.low,
            close: data.close,
            startIdx: 0,
            endIdx: data.high.length - 1,
            optInTimePeriod: params.optInTimePeriod
        });
    }
}

methods.obv = {
    requires: [],
    create: (params) => {
        verifyParams('obv', params);

        return (data, callback) => execute(callback, {
            name: "OBV",
            inReal: data.close,
            volume: data.volume,
            startIdx: 0,
            endIdx: data.close.length - 1
        });
    }
}

methods.plus_di = {
    requires: ['optInTimePeriod'],
    create: (params) => {
        verifyParams('plus_di', params);

        return (data, callback) => execute(callback, {
            name: "PLUS_DI",
            high: data.high,
            low: data.low,
            close: data.close,
            startIdx: 0,
            endIdx: data.high.length - 1,
            optInTimePeriod: params.optInTimePeriod
        });
    }
}

methods.plus_dm = {
    requires: ['optInTimePeriod'],
    create: (params) => {
        verifyParams('plus_dm', params);

        return (data, callback) => execute(callback, {
            name: "PLUS_DM",
            high: data.high,
            low: data.low,
            startIdx: 0,
            endIdx: data.high.length - 1,
            optInTimePeriod: params.optInTimePeriod
        });
    }
}

methods.ppo = {
    requires: ['optInFastPeriod', 'optInSlowPeriod', 'optInMAType'],
    create: (params) => {
        verifyParams('ppo', params);

        return (data, callback) => execute(callback, {
            name: "PPO",
            inReal: data.close,
            startIdx: 0,
            endIdx: data.close.length - 1,
            optInFastPeriod: params.optInFastPeriod,
            optInSlowPeriod: params.optInSlowPeriod,
            optInMAType: params.optInMAType
        });
    }
}

methods.roc = {
    requires: ['optInTimePeriod'],
    create: (params) => {
        verifyParams('roc', params);

        return (data, callback) => execute(callback, {
            name: "ROC",
            inReal: data.close,
            startIdx: 0,
            endIdx: data.close.length - 1,
            optInTimePeriod: params.optInTimePeriod
        });
    }
}

methods.rocp = {
    requires: ['optInTimePeriod'],
    create: (params) => {
        verifyParams('rocp', params);

        return (data, callback) => execute(callback, {
            name: "ROCP",
            inReal: data.close,
            startIdx: 0,
            endIdx: data.close.length - 1,
            optInTimePeriod: params.optInTimePeriod
        });
    }
}

methods.rocr = {
    requires: ['optInTimePeriod'],
    create: (params) => {
        verifyParams('rocr', params);

        return (data, callback) => execute(callback, {
            name: "ROCR",
            inReal: data.close,
            startIdx: 0,
            endIdx: data.close.length - 1,
            optInTimePeriod: params.optInTimePeriod
        });
    }
}

methods.rocr100 = {
    requires: ['optInTimePeriod'],
    create: (params) => {
        verifyParams('rocr100', params);

        return (data, callback) => execute(callback, {
            name: "ROCR100",
            inReal: data.close,
            startIdx: 0,
            endIdx: data.close.length - 1,
            optInTimePeriod: params.optInTimePeriod
        });
    }
}

methods.rsi = {
    requires: ['optInTimePeriod'],
    create: (params) => {
        verifyParams('rsi', params);

        return (data, callback) => execute(callback, {
            name: "RSI",
            inReal: data.close,
            startIdx: 0,
            endIdx: data.close.length - 1,
            optInTimePeriod: params.optInTimePeriod
        });
    }
}

methods.sar = {
    requires: ['optInAcceleration', 'optInMaximum'],
    create: (params) => {
        verifyParams('sar', params);

        return (data, callback) => execute(callback, {
            name: "SAR",
            high: data.high,
            low: data.low,
            startIdx: 0,
            endIdx: data.high.length - 1,
            optInAcceleration: params.optInAcceleration,
            optInMaximum: params.optInMaximum
        });
    }
}

methods.sarext = {
    requires: [
        'optInStartValue',
        'optInOffsetOnReverse',
        'optInAccelerationInitLong',
        'optInAccelerationLong',
        'optInAccelerationMaxLong',
        'optInAccelerationInitShort',
        'optInAccelerationShort',
        'optInAccelerationMaxShort'

    ],
    create: (params) => {
        verifyParams('sarext', params);

        return (data, callback) => execute(callback, {
            name: "SAREXT",
            high: data.high,
            low: data.low,
            startIdx: 0,
            endIdx: data.high.length - 1,

            optInStartValue: params.optInStartValue,
            optInOffsetOnReverse: params.optInOffsetOnReverse,
            optInAccelerationInitLong: params.optInAccelerationInitLong,
            optInAccelerationLong: params.optInAccelerationLong,
            optInAccelerationMaxLong: params.optInAccelerationMaxLong,
            optInAccelerationInitShort: params.optInAccelerationInitShort,
            optInAccelerationShort: params.optInAccelerationShort,
            optInAccelerationMaxShort: params.optInAccelerationMaxShort
        });
    }
}

methods.sma = {
    requires: ['optInTimePeriod'],
    create: (params) => {
        verifyParams('sma', params);

        return (data, callback) => execute(callback, {
            name: "SMA",
            inReal: data.close,
            startIdx: 0,
            endIdx: data.close.length - 1,
            optInTimePeriod: params.optInTimePeriod
        });
    }
}

methods.stddev = {
    requires: ['optInTimePeriod', 'optInNbDev'],
    create: (params) => {
        verifyParams('stddev', params);

        return (data, callback) => execute(callback, {
            name: "STDDEV",
            inReal: data.close,
            startIdx: 0,
            endIdx: data.close.length - 1,
            optInTimePeriod: params.optInTimePeriod,
            optInNbDev: params.optInNbDev
        });
    }
}

methods.stoch = {
    requires: [
        'optInFastK_Period',
        'optInSlowK_Period',
        'optInSlowK_MAType',
        'optInSlowD_Period',
        'optInSlowD_MAType'
    ],
    create: (params) => {
        verifyParams('stoch', params);

        return (data, callback) => execute(callback, {
            name: "STOCH",
            high: data.high,
            low: data.low,
            close: data.close,
            startIdx: 0,
            endIdx: data.close.length - 1,

            optInFastK_Period: params.optInFastK_Period,
            optInSlowK_Period: params.optInSlowK_Period,
            optInSlowK_MAType: params.optInSlowK_MAType,
            optInSlowD_Period: params.optInSlowD_Period,
            optInSlowD_MAType: params.optInSlowD_MAType
        });
    }
}

methods.stochf = {
    requires: [
        'optInFastK_Period',
        'optInFastD_Period',
        'optInFastD_MAType'
    ],
    create: (params) => {
        verifyParams('stochf', params);

        return (data, callback) => execute(callback, {
            name: "STOCHF",
            high: data.high,
            low: data.low,
            close: data.close,
            startIdx: 0,
            endIdx: data.high.length - 1,

            optInFastK_Period: params.optInFastK_Period,
            optInFastD_Period: params.optInFastD_Period,
            optInFastD_MAType: params.optInFastD_MAType
        });
    }
}

methods.stochrsi = {
    requires: [
        'optInTimePeriod',
        'optInFastK_Period',
        'optInFastD_Period',
        'optInFastD_MAType'
    ],
    create: (params) => {
        verifyParams('stochrsi', params);

        return (data, callback) => execute(callback, {
            name: "STOCHRSI",
            inReal: data.close,
            startIdx: 0,
            endIdx: data.close.length - 1,

            optInTimePeriod: params.optInTimePeriod,
            optInFastK_Period: params.optInFastK_Period,
            optInFastD_Period: params.optInFastD_Period,
            optInFastD_MAType: params.optInFastD_MAType
        });
    }
}

methods.t3 = {
    requires: [
        'optInTimePeriod',
        'optInFastK_Period',
        'optInFastD_Period',
        'optInFastD_MAType'
    ],
    create: (params) => {
        verifyParams('t3', params);

        return (data, callback) => execute(callback, {
            name: "T3",
            inReal: data.close,
            startIdx: 0,
            endIdx: data.close.length - 1,
            optInTimePeriod: params.optInTimePeriod,
            optInVFactor: params.optInVFactor
        });
    }
}

methods.tema = {
    requires: ['optInTimePeriod'],
    create: (params) => {
        verifyParams('tema', params);

        return (data, callback) => execute(callback, {
            name: "TEMA",
            inReal: data.close,
            startIdx: 0,
            endIdx: data.close.length - 1,
            optInTimePeriod: params.optInTimePeriod
        });
    }
}

methods.trange = {
    requires: ['optInTimePeriod'],
    create: (params) => {
        verifyParams('trange', params);

        return (data, callback) => execute(callback, {
            name: "TRANGE",
            high: data.high,
            low: data.low,
            close: data.close,
            startIdx: 0,
            endIdx: data.high.length - 1,
            optInTimePeriod: params.optInTimePeriod
        });
    }
}

methods.trima = {
    requires: ['optInTimePeriod'],
    create: (params) => {
        verifyParams('trima', params);

        return (data, callback) => execute(callback, {
            name: "TRIMA",
            inReal: data.close,
            startIdx: 0,
            endIdx: data.close.length - 1,
            optInTimePeriod: params.optInTimePeriod
        });
    }
}

methods.trix = {
    requires: ['optInTimePeriod'],
    create: (params) => {
        verifyParams('trix', params);

        return (data, callback) => execute(callback, {
            name: "TRIX",
            inReal: data.close,
            startIdx: 0,
            endIdx: data.close.length - 1,
            optInTimePeriod: params.optInTimePeriod
        });
    }
}

methods.tsf = {
    requires: ['optInTimePeriod'],
    create: (params) => {
        verifyParams('tsf', params);

        return (data, callback) => execute(callback, {
            name: "TSF",
            inReal: data.close,
            startIdx: 0,
            endIdx: data.close.length - 1,
            optInTimePeriod: params.optInTimePeriod
        });
    }
}

methods.typprice = {
    requires: ['optInTimePeriod'],
    create: (params) => {
        verifyParams('typprice', params);

        return (data, callback) => execute(callback, {
            name: "TYPPRICE",
            high: data.high,
            low: data.low,
            close: data.close,
            startIdx: 0,
            endIdx: data.high.length - 1,
            optInTimePeriod: params.optInTimePeriod
        });
    }
}

methods.ultosc = {
    requires: ['optInTimePeriod1', 'optInTimePeriod2', 'optInTimePeriod3'],
    create: (params) => {
        verifyParams('ultosc', params);

        return (data, callback) => execute(callback, {
            name: "ULTOSC",
            high: data.high,
            low: data.low,
            close: data.close,
            startIdx: 0,
            endIdx: data.high.length - 1,
            optInTimePeriod1: params.optInTimePeriod1,
            optInTimePeriod2: params.optInTimePeriod2,
            optInTimePeriod3: params.optInTimePeriod3
        });
    }
}

methods.variance = {
    requires: ['optInTimePeriod', 'optInNbDev'],
    create: (params) => {
        verifyParams('variance', params);

        return (data, callback) => execute(callback, {
            name: "VAR",
            inReal: data.close,
            startIdx: 0,
            endIdx: data.close.length - 1,
            optInTimePeriod: params.optInTimePeriod,
            optInNbDev: params.optInTimePeriod
        });
    }
}

methods.wclprice = {
    requires: ['optInTimePeriod'],
    create: (params) => {
        verifyParams('wclprice', params);

        return (data, callback) => execute(callback, {
            name: "WCLPRICE",
            high: data.high,
            low: data.low,
            close: data.close,
            startIdx: 0,
            endIdx: data.high.length - 1,
            optInTimePeriod: params.optInTimePeriod
        });
    }
}

methods.willr = {
    requires: ['optInTimePeriod'],
    create: (params) => {
        verifyParams('willr', params);

        return (data, callback) => execute(callback, {
            name: "WILLR",
            high: data.high,
            low: data.low,
            close: data.close,
            startIdx: 0,
            endIdx: data.high.length - 1,
            optInTimePeriod: params.optInTimePeriod
        });
    }
}

methods.wma = {
    requires: ['optInTimePeriod'],
    create: (params) => {
        verifyParams('wma', params);

        return (data, callback) => execute(callback, {
            name: "WMA",
            inReal: data.close,
            startIdx: 0,
            endIdx: data.close.length - 1,
            optInTimePeriod: params.optInTimePeriod
        });
    }
}

module.exports = methods;


text:
<?php

namespace Drupal\user\Plugin\migrate\source\d6;

use Drupal\migrate\Row;
use Drupal\migrate_drupal\Plugin\migrate\source\DrupalSqlBase;

/**
 * Drupal 6 role source from database.
 *
 * @MigrateSource(
 *   id = "d6_user_role"
 * )
 */
class Role extends DrupalSqlBase {

  /**
   * List of filter IDs per role IDs.
   *
   * @var array
   */
  protected $filterPermissions = array();

  /**
   * {@inheritdoc}
   */
  public function query() {
    $query = $this->select('role', 'r')
      ->fields('r', array('rid', 'name'))
      ->orderBy('rid');
    return $query;
  }

  /**
   * {@inheritdoc}
   */
  public function fields() {
    return array(
      'rid' => $this->t('Role ID.'),
      'name' => $this->t('The name of the user role.'),
    );
  }

  /**
   * {@inheritdoc}
   */
  protected function initializeIterator() {
    $filter_roles = $this->select('filter_formats', 'f')
      ->fields('f', array('format', 'roles'))
      ->execute()
      ->fetchAllKeyed();
    foreach ($filter_roles as $format => $roles) {
      // Drupal 6 code: $roles = ','. implode(',', $roles) .',';
      // Remove the beginning and ending comma.
      foreach (explode(',', trim($roles, ',')) as $rid) {
        $this->filterPermissions[$rid][] = $format;
      }
    }
    return parent::initializeIterator();
  }

  /**
   * {@inheritdoc}
   */
  public function prepareRow(Row $row) {
    $rid = $row->getSourceProperty('rid');
    $permissions = $this->select('permission', 'p')
      ->fields('p', array('perm'))
      ->condition('rid', $rid)
      ->execute()
      ->fetchField();
    $row->setSourceProperty('permissions', explode(', ', $permissions));
    if (isset($this->filterPermissions[$rid])) {
      $row->setSourceProperty("filter_permissions:$rid", $this->filterPermissions[$rid]);
    }
    return parent::prepareRow($row);
  }

  /**
   * {@inheritdoc}
   */
  public function getIds() {
    $ids['rid']['type'] = 'integer';
    return $ids;
  }

}


text:
package org.alljoyn.ioe.controlpaneladapter;

import android.view.View;

/**
 * Implement this interface to receive an event of creating a Root-Container-Element.
 */
public interface ContainerCreatedListener {

    /**
     * This method is called when the Root-Container-Element is created
     * @param container The container {@link View}.
     */
    void onContainerViewCreated(View container);
}


text:
			Size Charts
			<?php $this->load->view('includes/free_shipping'); ?>

			Size Charts

<a href="<?php echo base_url(); ?>images/RHS_Size_Charts_2015.pdf" target="_blank">Download RHS Size Charts


text:
<?php namespace ninja\repositories;

use Payment;
use Credit;
use Invoice;
use Client;
use Utils;

class PaymentRepository
{
	public function find($clientPublicId = null, $filter = null)
	{
        $query = \DB::table('payments')
                    ->join('clients', 'clients.id', '=','payments.client_id')
                    ->join('invoices', 'invoices.id', '=','payments.invoice_id')
                    ->join('contacts', 'contacts.client_id', '=', 'clients.id')
                    ->leftJoin('payment_types', 'payment_types.id', '=', 'payments.payment_type_id')
                    ->where('payments.account_id', '=', \Auth::user()->account_id)
                    ->where('clients.deleted_at', '=', null)
                    ->where('contacts.is_primary', '=', true)
                    ->select('payments.public_id', 'payments.transaction_reference', 'clients.name as client_name', 'clients.public_id as client_public_id', 'payments.amount', 'payments.payment_date', 'invoices.public_id as invoice_public_id', 'invoices.invoice_number', 'clients.currency_id', 'contacts.first_name', 'contacts.last_name', 'contacts.email', 'payment_types.name as payment_type', 'payments.account_gateway_id');

        if (!\Session::get('show_trash:payment'))
        {
            $query->where('payments.deleted_at', '=', null);
        }

        if ($clientPublicId)
        {
            $query->where('clients.public_id', '=', $clientPublicId);
        }

        if ($filter)
        {
            $query->where(function($query) use ($filter)
            {
                $query->where('clients.name', 'like', '%'.$filter.'%');
            });
        }

        return $query;
	}

    public function getErrors($input)
    {
        $rules = array(
            'client' => 'required',
            'invoice' => 'required',
            'amount' => 'required|positive'
        );

        if ($input['payment_type_id'] == PAYMENT_TYPE_CREDIT)
        {
            $rules['payment_type_id'] = 'has_credit:' . $input['client'] . ',' . $input['amount'];
        }

        $validator = \Validator::make($input, $rules);

        if ($validator->fails())
        {
            return $validator;
        }

        return false;
    }

	public function save($publicId = null, $input)
	{
        if ($publicId)
        {
            $payment = Payment::scope($publicId)->firstOrFail();
        }
        else
        {
            $payment = Payment::createNew();
        }

        $paymentTypeId = $input['payment_type_id'] ? $input['payment_type_id'] : null;
        $amount = Utils::parseFloat($input['amount']);

        if ($paymentTypeId == PAYMENT_TYPE_CREDIT)
        {
            $credits = Credit::scope()->where('balance', '>', 0)->orderBy('created_at')->get();
            $applied = 0;

            foreach ($credits as $credit)
            {
                $applied += $credit->apply($amount);

                if ($applied >= $amount)
                {
                    break;
                }
            }
        }

        $payment->client_id = Client::getPrivateId($input['client']);
        $payment->invoice_id = isset($input['invoice']) && $input['invoice'] != "-1" ? Invoice::getPrivateId($input['invoice']) : null;
        $payment->payment_type_id = $paymentTypeId;
        $payment->payment_date = Utils::toSqlDate($input['payment_date']);
        $payment->amount = $amount;
        $payment->transaction_reference = trim($input['transaction_reference']);
        $payment->save();

		return $payment;
	}

	public function bulk($ids, $action)
	{
        if (!$ids)
        {
            return 0;
        }

        $payments = Payment::scope($ids)->get();

        foreach ($payments as $payment)
        {
            if ($action == 'delete')
            {
                $payment->is_deleted = true;
                $payment->save();
            }

            $payment->delete();
        }

		return count($payments);
	}
}


text:
Bowerphp
========

An implementation of [bower](http://bower.io) in PHP.

https://bowerphp.github.io/

[![travis build](https://api.travis-ci.org/Bee-Lab/bowerphp.png)](https://travis-ci.org/Bee-Lab/bowerphp)
[![Code Climate](https://codeclimate.com/github/Bee-Lab/bowerphp/badges/gpa.svg)](https://codeclimate.com/github/Bee-Lab/bowerphp)
[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/Bee-Lab/bowerphp/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/Bee-Lab/bowerphp/?branch=master)
[![insight](https://insight.sensiolabs.com/projects/d1fbaca7-0e68-4782-979b-2372a9578c2d/mini.png)](https://insight.sensiolabs.com/projects/d1fbaca7-0e68-4782-979b-2372a9578c2d) [![Join the chat at https://gitter.im/Bee-Lab/bowerphp](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/Bee-Lab/bowerphp?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)

Installation
------------

```bash
$ composer require beelab/bowerphp
```

Configuration
-------------

Currently, you can configure your bower directory in `.bowerrc` file, just like the original Bower.

If you need many dependencies, you'll likely hit the Github API limit (currently 60 requests per hour).
To increase your limit to 5000 requests per hour, you can use a token.
See [Github help](https://help.github.com/articles/creating-an-access-token-for-command-line-use/).
Once you created your token, just store it in the `BOWERPHP_TOKEN` environment variable.

Status
------

This project is in stable version (no beta suffix), but still in `0` major version (BC not assured).

See currently open [issues](https://github.com/Bee-Lab/bowerphp/issues).

Contributing
------------

All contribution are welcome, just take a look at our [issues](https://github.com/Bee-Lab/bowerphp/issues) tracker if you want to start somewhere.

If you make a PR make sure that it follow the [PSR2 standard](http://www.php-fig.org/psr/psr-2/).
To make sure that your code comply with the standard, you can use a git hook with [php-cs-fixer](https://github.com/FriendsOfPHP/PHP-CS-Fixer).
There is one here that you only need to copy to your .git/hooks folder under the name of pre-commit and you are set.

Building the phar
-----------------

You can build the phar by simply running:

```bash
$ php bin/compile
```

Or you can use the [box command line utility](https://github.com/box-project/box2).
If you add the following content in a `box.json` file, you only just need to run `box build` command to
get a phar. Don't forget to give execution permission to your phar, using `chmod +x bowerphp.phar`.

```json
{
    "directories": ["src"],
    "files": ["LICENSE"],
    "finder": [
        {
            "name": "*.php",
            "exclude": ["Tests", "phpunit", "mockery"],
            "in": "vendor"
        }
    ],
    "main": "bin/bowerphp",
    "output": "bowerphp.phar",
    "stub": true
}
```


text:
package com.virtualpairprogrammers.controllers;

import java.math.BigDecimal;
import java.util.Date;

import javax.xml.bind.annotation.XmlRootElement;

@XmlRootElement
public class Position {
	private BigDecimal lat;
	private BigDecimal longitude;
	private Date timestamp;
	private boolean upToDate;

	public boolean isUpToDate() {
		return upToDate;
	}
	public void setUpToDate(boolean upToDate) {
		this.upToDate = upToDate;
	}
	public BigDecimal getLat() {
		return lat;
	}
	public void setLat(BigDecimal lat) {
		this.lat = lat;
	}
	public BigDecimal getLongitude() {
		return longitude;
	}
	public void setLongitude(BigDecimal longitude) {
		this.longitude = longitude;
	}
	public Date getTimestamp() {
		return timestamp;
	}
	public void setTimestamp(Date timestamp) {
		this.timestamp = timestamp;
	}

}


text:
package burlap.behavior.policy;

import burlap.behavior.singleagent.MDPSolverInterface;

/**
 * An interface for defining policies that refer to a {@link burlap.behavior.singleagent.MDPSolverInterface}
 * objects to defined the policy. For example, selecting actions based on the maximum Q-value that a solver computed.
 * @author James MacGlashan
 *
 */
public interface SolverDerivedPolicy {
	/**
	 * Sets the valueFunction whose results affect this policy.
	 * @param solver the solver from which this policy is derived
	 */
	public void setSolver(MDPSolverInterface solver);
}


text:
<?php

/**
 * Observer that handle configuration change of number of domains
 */
class Easy_MultipleDomains_Model_Observer extends Mage_Core_Model_Abstract
{

    /**
     * Initialize Easy_MultipleDomains_Model_Resource_Config as resource class
     */
    protected function _construct()
    {
        $this->_init('easy_multipledomains/config');
    }

    /**
     * Listen on "router_standard_url_should_secure_before" event
     * It will disable HTTPS if required and apply design specified in config
     * @param type $observer
     * @return null
     */
    public function handleCheckSecureAndThemeUpdate($observer)
    {
        $list = Mage::getSingleton('easy_multipledomains/domain')->getCollection();

        foreach ($list as $domain) {
            if ($domain->getBaseUrl() == Mage::app()->getRequest()->getHttpHost()) {
                $this->_checkSecure($observer, $domain);
                $this->_applyTheme($domain);
                return;
            }
        }
    }

    /**
     * Listen on "store_get_base_url_after" event
     * Will accept the usage of a domain if it's enabled in config
     * @param type $observer
     * @return null
     */
    public function handleDomains($observer)
    {
        foreach (Mage::getSingleton('easy_multipledomains/domain')->getCollection() as $domain) {
            if ($domain->getBaseUrl() == Mage::app()->getRequest()->getHttpHost()) {
                $uri = parse_url($observer->getSource()->getConfig('web/' . ($observer->getSecure() ? 'secure' : 'unsecure') . '/base_url'));
                $url = $this->_disableSecureInUrlIfRequired(
                    str_replace($uri['host'], $domain->getBaseUrl(), $observer->getUrl()), $domain
                );
                $observer->getSource()->setBaseUrlCache($observer->getCacheKey(), $url);
                return;
            }
        }
    }

    /**
     * Replace https by http in $url if specified $domain is configured to disable https
     * @param string $url
     * @param Varien_Object $domain
     * @return string
     */
    protected function _disableSecureInUrlIfRequired($url, $domain)
    {
        if ((bool) $domain->getDisableSecure()) {
            $url = str_replace('https://', 'http://', $url);
        }
        return $url;
    }

    /**
     * Disable https on router if domain configuration require it
     * This is a subfunction of handleCheckSecureAndThemeUpdate()
     * @param type $observer
     * @param Varien_Object $domain
     */
    protected function _checkSecure($observer, $domain)
    {
        if ((bool) $domain->getDisableSecure()) {
            $observer->getRouter()->setForceSecure(false);
        }
    }

    /**
     * Apply a package and theme design if domain require it
     * This is a subfunction of handleCheckSecureAndThemeUpdate()
     * @param Varien_Object $domain
     */
    protected function _applyTheme($domain)
    {
        if ($this->_isset($domain->getDesignPackage()) && $this->_isset($domain->getDesignTheme())) {
            Mage::app()->loadArea('frontend');
            Mage::getDesign()->setArea('frontend')
                    ->setPackageName($domain->getDesignPackage())
                    ->setTheme($domain->getDesignTheme());
        }
    }

    protected function _isset($value)
    {
        return (isset($value) && !empty($value));
    }

}


text:
<?php
defined('C5_EXECUTE') or die("Access Denied.");
$class = 'ccm-conversation-message ccm-conversation-message-topic';
if ($message->isConversationMessageDeleted()) {
    $class .= ' ccm-conversation-message-deleted';
}
if (!$message->isConversationMessageApproved()) {
    $class .= ' ccm-conversation-message-flagged';
}
$cnvMessageID = $message->getConversationMessageID();
if ((!$message->isConversationMessageDeleted() && $message->isConversationMessageApproved()) || $message->conversationMessageHasActiveChildren()) {
    ?>
	<div data-conversation-message-id="<?php echo $message->getConversationMessageID()?>" data-conversation-message-level="<?php echo $message->getConversationMessageLevel()?>" class="<?php echo $class?>">
		<a id="cnvMessage<?php echo $cnvMessageID?>">

<?php echo $message->getConversationMessageSubject()?>

			<?php echo $message->getConversationMessageBodyOutput()?>

				<?php
                if (count($message->getAttachments($message->getConversationMessageID()))) {
                    foreach ($message->getAttachments($message->getConversationMessageID()) as $attachment) {
                        $file = File::getByID($attachment['fID']);
                        if (is_object($file)) {
                            ?>
						<p rel="<?php echo $attachment['cnvMessageAttachmentID'];
                            ?>"><a href="<?php echo $file->getDownloadURL() ?>"><?php echo $file->getFileName() ?>
							<?php if (!$message->isConversationMessageDeleted()) {
    ?>
								<a rel="<?php echo $attachment['cnvMessageAttachmentID'];
    ?>" class="attachment-delete ccm-conversation-message-admin-control" href="#">Delete
							<?php
}
                            ?>

					<?php
                        }
                    }
                }
    ?>

			<?php if (!$message->isConversationMessageDeleted() && $message->isConversationMessageApproved()) {
    ?>

				<?php if ($enablePosting && $displayMode == 'threaded') {
    ?>

<a href="#" data-toggle="conversation-reply" data-post-parent-id="<?php echo $message->getConversationMessageID()?>"><?php echo t('Reply')?>

				<?php
}
    ?>

			<?php
}
    ?>

		<?php echo $message->getConversationMessageDateTimeOutput();
    Loader::element('conversation/social_share', array('cID' => $cID, 'message' => $message));
    ?>

		<?php if ($enableCommentRating) {
    $ratingTypes = ConversationRatingType::getList();
    foreach ($ratingTypes as $ratingType) {
        ?>
				<?php echo $ratingType->outputRatingTypeHTML();
        ?>
				<span class="ccm-conversation-message-rating-score" data-msg-rating="<?php echo $message->getConversationMessageID()?>" data-msg-rating-type="<?php echo $ratingType->getConversationRatingTypeHandle()?>"><?php echo $message->getConversationMessageRating($ratingType);
        ?>
			 <?php
    }
    ?>
		<?php
}
    ?>

	<?php

}
?>


text:
'use strict';

Object.defineProperty(exports, "__esModule", {
    value: true
});
exports.Link = exports.withRoute = exports.RouterProvider = exports.routeNode = exports.BaseLink = undefined;

var _BaseLink = require('./BaseLink');

var _BaseLink2 = _interopRequireDefault(_BaseLink);

var _routeNode = require('./routeNode');

var _routeNode2 = _interopRequireDefault(_routeNode);

var _RouterProvider = require('./RouterProvider');

var _RouterProvider2 = _interopRequireDefault(_RouterProvider);

var _withRoute = require('./withRoute');

var _withRoute2 = _interopRequireDefault(_withRoute);

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

var Link = (0, _withRoute2.default)(_BaseLink2.default);

exports.BaseLink = _BaseLink2.default;
exports.routeNode = _routeNode2.default;
exports.RouterProvider = _RouterProvider2.default;
exports.withRoute = _withRoute2.default;
exports.Link = Link;


text:
import cv2
import numpy as np
import math
import time
from position_vector import PositionVector
from vehicle_control import veh_control
from droneapi.lib import VehicleMode, Location, Attitude
import sc_config
from pl_util import shift_to_image

current_milli_time = lambda: int(round(time.time() * 1000))

'''
TODO
Intergrate config file

Long term enhancements:
Add in textured/tiled background
dynamic exposure levels / frame rate
Add google earth as background
'''

class PrecisionLandSimulator():

	def __init__(self):
		self.targetLocation = PositionVector()
		self.vehicleLocation = PositionVector()

		self.backgroundColor = (74,88,109)

		#load target
		filename = sc_config.config.get_string('simulator', 'target_location', '/home/dannuge/SmartCamera/target.jpg')
		target_size = sc_config.config.get_float('algorithm', 'outer_ring', 1.0)
		self.load_target(filename,target_size)

		#define camera
		self.camera_width = sc_config.config.get_integer('camera', 'width', 640)
		self.camera_height = sc_config.config.get_integer('camera', 'height', 640)
		self.camera_vfov = sc_config.config.get_float('camera', 'vertical-fov',72.42 )
		self.camera_hfov = sc_config.config.get_float('camera', 'horizontal-fov', 72.42)
		self.camera_fov = math.sqrt(self.camera_vfov**2 + self.camera_hfov**2)
		self.camera_frameRate = 30

	#load_target- load an image to simulate the target. Enter the actaul target size in meters(assuming the target is square)
	def load_target(self,filename, actualSize):
		self.target = cv2.imread(filename)
		self.target_width = self.target.shape[1]
		self.target_height = self.target.shape[0]

		self.actualSize = actualSize
		#scaling factor for real dimensions to simultor pixels
		self.pixels_per_meter = (self.target_height + self.target_width) / (2.0 * actualSize)

	#set_target_location- give the target a gps location
	def set_target_location(self, location):
		self.targetLocation.set_from_location(location)

	#refresh_simulator - update vehicle position info necessary to simulate an image
	def refresh_simulator(self, vehicleLocation, vehicleAttitude):
		#get gps location of vehicle
		self.vehicleLocation.set_from_location(vehicleLocation)

		self.vehicleAttitude = vehicleAttitude

	#main - code used to test the simulator. Must be run from sitl. Control vehicle in guided mode using arrow keys,r,t,q,e
	def main(self):
		veh_control.connect(local_connect())

		self.set_target_location(veh_control.get_location())

		while(veh_control.is_connected()):
		    location = veh_control.get_location()
		    attitude = veh_control.get_attitude()

		    self.refresh_simulator(location,attitude)
		    frame = self.get_frame()
		    cv2.imshow('frame',frame)

		    key = cv2.waitKey(1)
		    print key

		    if key ==1113938:
		    	veh_control.set_velocity(2,0,0) #forward
		    elif key == 1113940:
		    	veh_control.set_velocity(-2,0,0) #backward
		    elif key == 1113937:
		    	veh_control.set_velocity(0,-2,0) #left
		    elif key ==1113939:
		    	veh_control.set_velocity(0,2,0) #right
		    elif(key == 1048690):
		    	yaw = math.degrees(attitude.yaw) #yaw left
		    	veh_control.set_yaw(yaw - 5)
		    elif(key == 1048692):
		    	yaw = math.degrees(attitude.yaw) #yaw right
		    	veh_control.set_yaw(yaw + 5)
		    elif(key == 1048677):
		    	veh_control.set_velocity(0,0,-2) #down
		    elif(key == 1048689):
		    	veh_control.set_velocity(0,0,2) #up
		    else:
				veh_control.set_velocity(0,0,0) #still

	#project_3D_to_2D - project a 3d point onto a 2d plane. Covert from world perspective to camera perspective
	def project_3D_to_2D(self,thetaX,thetaY,thetaZ, aX, aY,aZ, cX, cY, cZ, height, width, fov):
		dX = math.cos(-thetaY) * (math.sin(-thetaZ)*(cY-aY) + math.cos(-thetaZ)*(cX-aX)) - math.sin(-thetaY)*(aZ-cZ)
		dY = math.sin(-thetaX) * (math.cos(-thetaY)*(aZ-cZ) + math.sin(-thetaY)*(math.sin(-thetaZ)*(cY-aY) + math.cos(-thetaZ)*(cX-aX))) + math.cos(-thetaX)*(math.cos(-thetaZ)*(cY-aY) - math.sin(-thetaZ) * (cX-aX))
		dZ = math.cos(-thetaX) * (math.cos(-thetaY)*(aZ-cZ) + math.sin(-thetaY)*(math.sin(-thetaZ)*(cY-aY) + math.cos(-thetaZ)*(cX-aX))) - math.sin(-thetaX)*(math.cos(-thetaZ)*(cY-aY) - math.sin(-thetaZ) * (cX-aX))

		#veiwer position
		eX = 0
		eY = 0
		eZ = 1.0/math.tan(math.radians(fov)/2.0)

		#2D point
		bX = (dX - eX)*(eZ/dZ)
		bY = (dY - eY)*(eZ/dZ)

		#scaled to resolution
		sX = bX * width
		sY = bY * height

		return (sX,sY)

	#simulate_target - simulate an image given the target position[aX,aY,aZ](pixels)and camera position[cX,cY,cZ](pixels) and camera orientation
	def simulate_target(self,thetaX,thetaY,thetaZ, aX, aY, aZ, cX, cY, cZ, camera_height, camera_width, fov):
		img_width = self.target_width
		img_height = self.target_height

		#point maps
		corners = np.float32([[-img_width/2,img_height/2],[img_width/2 ,img_height/2],[-img_width/2,-img_height/2],[img_width/2, -img_height/2]])
		newCorners = np.float32([[0,0],[0,0],[0,0],[0,0]])

		#calculate projection for four corners of image
		for i in range(0,len(corners)):

			#shift to world
			x = corners[i][0] + cX - img_width/2.0
			y = corners[i][1] + cY - img_height/2.0

			#calculate perspective and position
			x , y = self.project_3D_to_2D(thetaX,thetaY,thetaZ, aY, aX, aZ, y, x, cZ,camera_height,camera_width,fov)

			#shift to camera
			x , y = shift_to_image((x,y),camera_width,camera_height)
			newCorners[i] = x,y

		#project image
		M = cv2.getPerspectiveTransform(corners,newCorners)
		sim = cv2.warpPerspective(self.target,M,(self.camera_width,self.camera_height),borderValue=self.backgroundColor)

		return sim

	#get_frame - retreive a simulated camera image
	def get_frame(self):
		start = current_milli_time()

		#distance bewteen camera and target in meters
		aX,aY,aZ = self.targetLocation.x, self.targetLocation.y, self.targetLocation.z
		cX,cY,cZ = self.vehicleLocation.x, self.vehicleLocation.y, self.vehicleLocation.z

		#camera angle
		thetaX = self.vehicleAttitude.pitch
		thetaY = self.vehicleAttitude.roll
		thetaZ = self.vehicleAttitude.yaw

		#convert distance bewtween camera and target in pixels
		aX = aX * self.pixels_per_meter
		aY = aY * self.pixels_per_meter
		aZ = aZ * self.pixels_per_meter
		cX = cX * self.pixels_per_meter
		cY = cY * self.pixels_per_meter
		cZ = cZ * self.pixels_per_meter

		#render image
		sim = self.simulate_target(thetaX,thetaY,thetaZ, aX, aY, aZ, cX, cY, cZ, self.camera_height, self.camera_width, self.camera_fov)

		#simulate framerate
		while(1000/self.camera_frameRate > current_milli_time() - start):
			pass
		return sim

sim = PrecisionLandSimulator()

if __name__ == "__builtin__":
	sim.main()


text:
package io.fnx.backend.web;

import com.google.inject.Singleton;
import org.mint42.annotations.On;

import javax.servlet.http.HttpServletResponse;

@Singleton
public class HeadersDecorator {

    @On(stage = On.Stage.INIT)
    public void addHeaders(HttpServletResponse resp) {
        resp.addHeader("X-Frame-Options", "DENY");
    }
}


text:
package ir

import (
	"bytes"
	"fmt"
)

// Var represents a variable (or a general memory area).
// Var does not have a type referring to it; typing and
// type checking is the compiler's issue.
type Var struct {
	Name  string // just for debugging
	value int32  // the constant value

	onHeap bool // if it is allocated on the heap or the stack
	size   uint32
	index  int
	addr   uint32

	isConst bool // if it is a just a constant

	isVoid bool // if this variable is not a void spaceholder

	// a symbol for late binding
	// if it is a constant, then the value field is late binding
	// if it is a variable, then it must be onHeap
	// and the address is late binding
	isSymbol bool   // symbol for late binding
	modName  string // module
	symName  string // symbol name

	// TODO: think more about these optimization fields
	isVolatile bool // if the variable must be alloced in mem
}

func (v *Var) String() string {
	ret := new(bytes.Buffer)
	fmt.Fprintf(ret, "<")

	if v.isVoid {
		fmt.Fprintf(ret, "void")
	} else if v.isConst {
		fmt.Fprintf(ret, "C#%d", v.value)
	} else if v.onHeap {
		fmt.Fprintf(ret, "H#%d", v.index)
	} else {
		fmt.Fprintf(ret, "#%d", v.index)
	}

	if v.Name != "" {
		fmt.Fprintf(ret, " %q", v.Name)
	}

	fmt.Fprintf(ret, ">")
	return ret.String()
}

// IsConst returns true when the variable is a constant.
func (v *Var) IsConst() bool { return v.isConst }

// IsVoid returns true when the variable is the void placeholder.
func (v *Var) IsVoid() bool { return v.isVoid }

// IsAddressable return true when the variable is addressable.
func (v *Var) IsAddressable() bool { return !(v.isConst || v.isVoid) }

// NewConst returns a new constant variable.
func NewConst(v int32) *Var {
	ret := new(Var)
	ret.isConst = true
	ret.value = v
	return ret
}

func newSym(mod, name string) *Var {
	ret := new(Var)
	ret.isSymbol = true
	ret.modName = mod
	ret.symName = name
	ret.Name = fmt.Sprintf("%s.%s", mod, name)

	return ret
}

// NewConstSym retunrs a new constant symbol
func NewConstSym(mod, name string) *Var {
	ret := newSym(mod, name)
	ret.isConst = true

	return ret
}

// NewHeapSym retunrs a new heap symbol
func NewHeapSym(mod, name string) *Var {
	ret := new(Var)
	ret.onHeap = true
	return ret
}

// VoidVar is the variable that will be used as a placeholder for void
// return values.
var Void = &Var{isVoid: true}


text:
#include <ISerializer.h>
#include <AEInitQuoteRequest.h>
#include <AEInitQuoteResponse.h>
#include <IAESMLogic.h>

#include <stdlib.h>

#include <sgx_uae_service.h>

AEInitQuoteRequest::AEInitQuoteRequest(uint32_t timeout)
{
    inflateValues(timeout);
}

AEInitQuoteRequest::AEInitQuoteRequest(const AEInitQuoteRequest& other)
:IAERequest(other)
{
    CopyFields(other.mTimeout);
}

AEInitQuoteRequest::~AEInitQuoteRequest()
{
}

void AEInitQuoteRequest::ReleaseMemory()
{
    //empty for now
}

void AEInitQuoteRequest::CopyFields(uint32_t timeout)
{
    mTimeout = timeout;
}

AEMessage* AEInitQuoteRequest::serialize(ISerializer* serializer){
    return serializer->serialize(this);
}

IAERequest::RequestClass AEInitQuoteRequest::getRequestClass() {
    return QUOTING_CLASS;
}

void AEInitQuoteRequest::inflateValues(uint32_t timeout)
{
    ReleaseMemory();

    CopyFields(timeout);
}

bool AEInitQuoteRequest::operator==(const AEInitQuoteRequest& other) const
{
    if (this == &other)
        return true;

    if (mTimeout != other.mTimeout)
        return false;

    return true;    //no members , default to true
}

AEInitQuoteRequest& AEInitQuoteRequest::operator=(const AEInitQuoteRequest& other)
{
    if (this == &other)
        return *this;

    inflateValues(other.mTimeout);

    //do nothing - no members
    return *this;
}

void AEInitQuoteRequest::visit(IAERequestVisitor& visitor)
{
    visitor.visitInitQuoteRequest(*this);
}

IAEResponse* AEInitQuoteRequest::execute(IAESMLogic* aesmLogic) {
    uint8_t* target_info = new uint8_t[sizeof(sgx_target_info_t)];
    uint8_t* gid = new uint8_t[sizeof(sgx_epid_group_id_t)];
    uint32_t target_info_length=sizeof(sgx_target_info_t);
    uint32_t gid_length=sizeof(sgx_epid_group_id_t);

    aesm_error_t result= aesmLogic->initQuote(target_info,target_info_length,gid, gid_length);

    AEInitQuoteResponse * response = new AEInitQuoteResponse((uint32_t)result, gid_length, gid, target_info_length, target_info);

    delete [] target_info;
    delete [] gid;

    return response;
}


text:
import { Cacheable, CachedGetter } from '@d-fischer/cache-decorators';
import { Enumerable } from '@d-fischer/shared-utils';
import { DataObject, rawDataSymbol, rtfm } from '@twurple/common';
import type { ApiClient } from '../../../ApiClient';
import type { HelixDateRangeData } from '../HelixDateRangeData';
import type { HelixResponse } from '../HelixResponse';
import type { HelixBitsLeaderboardEntryData } from './HelixBitsLeaderboardEntry';
import { HelixBitsLeaderboardEntry } from './HelixBitsLeaderboardEntry';

/** @private */
export interface HelixBitsLeaderboardResponse extends HelixResponse<HelixBitsLeaderboardEntryData> {
	date_range: HelixDateRangeData;
	total: number;
}

/**
 * A leaderboard where the users who used the most bits to a broadcaster are listed.
 */
@Cacheable
@rtfm('api', 'HelixBitsLeaderboard')
export class HelixBitsLeaderboard extends DataObject<HelixBitsLeaderboardResponse> {
	@Enumerable(false) private readonly _client: ApiClient;

	/** @private */
	constructor(data: HelixBitsLeaderboardResponse, client: ApiClient) {
		super(data);
		this._client = client;
	}

	/**
	 * The entries of the leaderboard.
	 */
	@CachedGetter()
	get entries(): HelixBitsLeaderboardEntry[] {
		return this[rawDataSymbol].data.map(entry => new HelixBitsLeaderboardEntry(entry, this._client));
	}

	/**
	 * The total amount of people on the requested leaderboard.
	 */
	get totalCount(): number {
		return this[rawDataSymbol].total;
	}
}


text:
import numpy as np

from .elastic import *
from .tensors import *
from .stress import *
from .strain import *


text:
The goal of this library is to keep PDO mysql simple and easy to use, while making it easier to port your older mysql code.

You'll find this libary has a very similar api to php_mysql (http://php.net/manual/en/book.mysql.php), so if you are used to old-school mysql programming in php, learning this new library will be a breeze.

This library also supports parameterized queries, which you **should always use**  to prevent SQL Injection when accepting data from the user.

# Usage
```
$dbc = new pdo_mysql_helper("location/of/credentials.php");
```
"location/of/credentials.php" would contain the credentials used to connect to the database.
This file template is located in Examples/creds
```
//location/of/credentials.php
<?php
	$server = 'localhost';
	$user = '';
	$password = '';
	$database = 'pdo-mysql-helper-example';
	$port = 3306;
?>
```
Once you have your pdo_mysql_helper object set up, you can then start executing queries!
```
//Query
$dbc->query("SELECT * FROM users WHERE age > 25");
//Results
var_dump($dbc->fetch_all_assoc());
```

[More Documentation coming very shortly]

# Examples

**Note**: In order to run these examples, you will need to load the database dumps into your database (located at /Examples/example-database-dumps). You will also need to rename the creds.template.php to creds.php and then setup your database info inside it.

Current Examples:
* query.php - a basic mysql query example
* select_db.php - switching databases in mysql
* insert_id.php - Example showing the last insert id after a insert statement

# Changelog
## v0.2 - Beta
* The first beta release
* Finalized class structure
* Implemented all basic database methods
* Updated examples and added a "insert_id" example
* Updated example database dumps
* Properly Throws 'pdo_mysql_helper_exception' Exceptions on DB errors

#### Roadmap from here
* Testing testing testing! - I'll be using this in my own projects, so any issues I notice will be fixed immediately
* Full documentation of the library - I'd love to get some PHPDocs set up for this library. I also want to get some more examples set up to help with using the library.


text:
package graphene.util;

// >>>> Temporary solution - needs renaming at least

@SuppressWarnings("serial")
public class UtilRuntimeException extends RuntimeException {

	/**
	 * @param arg0
	 * @param arg1
	 */
	public UtilRuntimeException(String string, Throwable throwable) {
		super(string, throwable);
	}

	/**
	 * @param arg0
	 */
	public UtilRuntimeException(Throwable throwable) {
		super(throwable);
	}

	/**
	 * @param string
	 */
	public UtilRuntimeException(String string) {
		super(string);
	}

}


text:
package eu.ydp.empiria.player.client.module.feedback.text;

import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.xml.client.Element;
import com.google.gwtmockito.GwtMockitoTestRunner;
import eu.ydp.empiria.player.client.controller.feedback.processor.TextActionProcessor;
import eu.ydp.empiria.player.client.module.feedback.text.blend.FeedbackBlend;
import eu.ydp.empiria.player.client.module.mathjax.common.MathJaxNative;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.ArgumentCaptor;
import org.mockito.Captor;
import org.mockito.InjectMocks;
import org.mockito.Mock;

import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;

@RunWith(GwtMockitoTestRunner.class)
public class TextActionProcessorTest {

    @InjectMocks
    private TextActionProcessor testObj;
    @Mock
    private TextFeedback feedbackPresenter;
    @Mock
    private MathJaxNative mathJaxNative;
    @Mock
    private FeedbackBlend feedbackBlend;
    @Captor
    private ArgumentCaptor<ClickHandler> clickHandlerCaptor;

    @Test
    public void shouldShowFeedback() {
        //given
        Element element = mock(Element.class);
        testObj.initModule(element);
        verify(feedbackPresenter).addShowButtonClickHandler(clickHandlerCaptor.capture());
        ClickHandler clickHandler = clickHandlerCaptor.getValue();
        ClickEvent clickEvent = mock(ClickEvent.class);
        //when
        clickHandler.onClick(clickEvent);
        //then
        verify(feedbackPresenter).showFeedback();
        verify(feedbackBlend).show(feedbackPresenter);
    }

    @Test
    public void shouldHideFeedback() {
        //given
        Element element = mock(Element.class);
        testObj.initModule(element);
        verify(feedbackPresenter).addCloseButtonClickHandler(clickHandlerCaptor.capture());
        ClickHandler clickHandler = clickHandlerCaptor.getValue();
        ClickEvent clickEvent = mock(ClickEvent.class);

        //when
        clickHandler.onClick(clickEvent);

        //then
        verify(feedbackPresenter, times(2)).hideFeedback();
        verify(feedbackBlend, times(2)).hide();
    }
}