text:
GPUTracer = function ()
{
	this.canvas = null;
	this.context = null;
	this.size = null;
	this.traceShader = null;
	this.renderShader = null;
	this.texturePingPong = null;
	this.camera = null;
	this.iteration = null;
	this.maxIteration = null;
	this.callbacks = null;
	this.previewMode = null;
	this.previewTimeout = null;
};

GPUTracer.prototype.Init = function (canvas, camera, maxIteration, callbacks)
{
	if (!this.InitContext (canvas)) {
		return false;
	}

	if (!this.InitShaders ()) {
		return false;
	}

	if (!this.InitBuffers (maxIteration)) {
		return false;
	}

	if (!this.InitNavigation (camera, callbacks)) {
		return false;
	}

	return true;
};

GPUTracer.prototype.Compile = function (fragmentShader, onError)
{
	var vertexShader = this.GetVertexShader ();
	this.traceShader = JSM.WebGLInitShaderProgram (this.context, vertexShader, fragmentShader, onError);
	if (this.traceShader === null) {
		return false;
	}

	this.context.useProgram (this.traceShader);
	this.InitVertexBuffer (this.traceShader);

	this.context.uniform1f (this.context.getUniformLocation (this.traceShader, 'uSize'), this.size);
	this.context.uniform1i (this.context.getUniformLocation (this.traceShader, 'uOriginalTextureSampler'), 0);

	this.traceShader.frameBuffer = this.context.createFramebuffer ();
	this.context.bindFramebuffer (this.context.FRAMEBUFFER, this.traceShader.frameBuffer);
	this.context.bindFramebuffer (this.context.FRAMEBUFFER, null);

	this.traceShader.cameraUniform = this.context.getUniformLocation (this.traceShader, 'uCameraData');
	this.traceShader.iterationUniform = this.context.getUniformLocation (this.traceShader, 'uIteration');
	this.traceShader.previewUniform = this.context.getUniformLocation (this.traceShader, 'uPreview');

	return true;
};

GPUTracer.prototype.GetNavigation = function ()
{
	return this.navigation;
};

GPUTracer.prototype.Start = function ()
{
	this.StartInNormalMode ();
};

GPUTracer.prototype.ToDataURL = function ()
{
	return this.canvas.toDataURL ('image/png');
};

GPUTracer.prototype.StartInPreviewMode = function ()
{
	var isRendering = this.iteration > 0;
	this.iteration = 0;
	this.previewMode = true;
	if (!isRendering) {
		this.Callback ('startInPreviewMode');
		this.RenderFrame ();
	}
};

GPUTracer.prototype.StartInNormalMode = function ()
{
	var isRendering = this.iteration > 0;
	this.iteration = 0;
	this.previewMode = false;
	if (!isRendering) {
		this.Callback ('startInNormalMode');
		this.RenderFrame ();
	}
};

GPUTracer.prototype.AddTextureBuffer = function (data, name)
{
	this.context.useProgram (this.traceShader);
	var index = this.textureBuffers.length + 1;
	var textureSize = JSM.WebGLGetFloatTextureBufferSize (data);
	var textureBuffer = JSM.WebGLCreateFloatTextureBuffer (this.context, data, textureSize);
	this.context.uniform1i (this.context.getUniformLocation (this.traceShader, 'u' + name + 'Sampler'), index);
	this.context.uniform1f (this.context.getUniformLocation (this.traceShader, 'u' + name + 'Size'), textureSize);
	this.textureBuffers.push (textureBuffer);
};

GPUTracer.prototype.SetUniformFloat = function (name, value)
{
	this.context.useProgram (this.traceShader);
	var location = this.context.getUniformLocation (this.traceShader, name);
	this.context.uniform1f (location, value);
};

GPUTracer.prototype.SetUniformVector = function (name, value)
{
	this.context.useProgram (this.traceShader);
	var location = this.context.getUniformLocation (this.traceShader, name);
	var floatArray = new Float32Array (value);
	this.context.uniform3fv (location, floatArray);
};

GPUTracer.prototype.SetUniformArray = function (name, value)
{
	this.context.useProgram (this.traceShader);
	var location = this.context.getUniformLocation (this.traceShader, name);
	var floatArray = new Float32Array (value);
	this.context.uniform1fv (location, floatArray, value.length);
};

GPUTracer.prototype.RenderFrame = function ()
{
	this.context.useProgram (this.traceShader);

	this.context.uniform3fv (this.traceShader.cameraUniform, new Float32Array ([
		this.camera.eye.x, this.camera.eye.y, this.camera.eye.z,
		this.camera.center.x, this.camera.center.y, this.camera.center.z,
		this.camera.up.x, this.camera.up.y, this.camera.up.z
	]));

	this.context.uniform1f (this.traceShader.iterationUniform, this.previewMode ? 0 : this.iteration);
	this.context.uniform1i (this.traceShader.previewUniform, this.previewMode);
	this.context.activeTexture (this.context.TEXTURE0);
	this.context.bindTexture (this.context.TEXTURE_2D, this.texturePingPong[0]);

	var i;
	for (i = 0; i < this.textureBuffers.length; i++) {
		this.context.activeTexture (this.context['TEXTURE' + (i + 1)]);
		this.context.bindTexture (this.context.TEXTURE_2D, this.textureBuffers[i]);
	}

	this.context.bindFramebuffer (this.context.FRAMEBUFFER, this.traceShader.frameBuffer);
	this.context.framebufferTexture2D (this.context.FRAMEBUFFER, this.context.COLOR_ATTACHMENT0, this.context.TEXTURE_2D, this.texturePingPong[1], 0);

	this.context.bindBuffer (this.context.ARRAY_BUFFER, this.traceShader.vertexBuffer);
	this.context.clear (this.context.COLOR_BUFFER_BIT | this.context.DEPTH_BUFFER_BIT);
	this.context.drawArrays (this.context.TRIANGLE_FAN, 0, 4);

	this.context.bindFramebuffer (this.context.FRAMEBUFFER, null);

	this.context.useProgram (this.renderShader);

	this.context.activeTexture (this.context.TEXTURE0);
	this.context.bindTexture (this.context.TEXTURE_2D, this.texturePingPong[1]);

	this.context.clear (this.context.COLOR_BUFFER_BIT | this.context.DEPTH_BUFFER_BIT);
	this.context.drawArrays (this.context.TRIANGLE_FAN, 0, 4);

	this.texturePingPong.reverse ();
	if (this.previewMode) {
		if (this.previewTimeout !== null) {
			window.clearTimeout (this.previewTimeout);
			this.previewTimeout = null;
		}
		this.previewTimeout = window.setTimeout (this.StartInNormalMode.bind (this), 2000);
	} else if (this.iteration < this.maxIteration) {
		this.iteration += 1;
		requestAnimationFrame (this.RenderFrame.bind (this));
	} else {
		this.iteration = 0;
		this.Callback ('renderFinished');
	}
};

GPUTracer.prototype.Resize = function ()
{

};

GPUTracer.prototype.Callback = function (name)
{
	if (this.callbacks !== undefined && this.callbacks !== null) {
		var callback = this.callbacks[name];
		if (callback !== undefined && callback !== null) {
			callback ();
		}
	}
};

GPUTracer.prototype.InitContext = function (canvas)
{
	this.canvas = canvas;
	this.context = JSM.WebGLInitContext (this.canvas);
	if (this.context === null) {
		return false;
	}

	var floatExtension = this.context.getExtension ('OES_texture_float');
	if (floatExtension === null) {
		return false;
	}

	this.size = this.canvas.width;
	return true;
};

GPUTracer.prototype.InitShaders = function ()
{
	var vertexShader = this.GetVertexShader ();
	var renderFragmentShader = this.GetRenderFragmentShader ();
	this.renderShader = JSM.WebGLInitShaderProgram (this.context, vertexShader, renderFragmentShader);
	if (this.renderShader === null) {
		return false;
	}

	return true;
};

GPUTracer.prototype.InitBuffers = function (maxIteration)
{
	this.context.useProgram (this.renderShader);
	this.InitVertexBuffer (this.renderShader);
	this.context.uniform1i (this.context.getUniformLocation (this.renderShader, 'uOriginalTextureSampler'), 0);

	this.textureBuffers = [];
	this.texturePingPong = [
		JSM.WebGLCreateFloatTextureBuffer (this.context, null, this.size),
		JSM.WebGLCreateFloatTextureBuffer (this.context, null, this.size)
	];

	this.iteration = 0;
	this.maxIteration = maxIteration;
	return true;
};

GPUTracer.prototype.InitVertexBuffer = function (shader)
{
	var vertices = new Float32Array ([-1.0, -1.0, 1.0, -1.0, 1.0, 1.0, -1.0, 1.0]);
	var vertexAttribLocation = this.context.getAttribLocation (shader, 'aVertexPosition');
	shader.vertexBuffer = this.context.createBuffer ();
	this.context.bindBuffer (this.context.ARRAY_BUFFER, shader.vertexBuffer);
	this.context.bufferData (this.context.ARRAY_BUFFER, vertices, this.context.STATIC_DRAW);
	this.context.vertexAttribPointer (vertexAttribLocation, 2, this.context.FLOAT, false, 0, 0);
	this.context.enableVertexAttribArray (vertexAttribLocation);
	this.context.bindBuffer (this.context.ARRAY_BUFFER, null);
};

GPUTracer.prototype.InitNavigation = function (camera, callbacks)
{
	this.camera = camera;
	this.navigation = new JSM.Navigation ();
	if (!this.navigation.Init (this.canvas, this.camera, this.StartInPreviewMode.bind (this), this.Resize.bind (this))) {
		return false;
	}

	this.callbacks = callbacks;
	return true;
};

GPUTracer.prototype.GetVertexShader = function ()
{
	var vertexShader = [
		'precision highp float;',
		'attribute vec2 aVertexPosition;',
		'varying vec2 vVertexPosition;',
		'void main (void)',
		'{',
		'	vVertexPosition = aVertexPosition;',
		'	gl_Position = vec4 (aVertexPosition.x, aVertexPosition.y, 0.0, 1.0);',
		'}'
	].join('\n');
	return vertexShader;
};

GPUTracer.prototype.GetRenderFragmentShader = function ()
{
	var vertexShader = [
		'precision highp float;',
		'uniform sampler2D uOriginalTextureSampler;',
		'varying vec2 vVertexPosition;',
		'void main (void)',
		'{',
		'	vec2 position = (vVertexPosition + vec2 (1.0, 1.0)) / 2.0;',
		'	gl_FragColor = texture2D (uOriginalTextureSampler, position);',
		'}'
	].join('\n');
	return vertexShader;
};


text:
package com.frenchfriedtechnology.horseandriderscompanion.data.entity;

import android.support.annotation.NonNull;

import com.google.firebase.database.IgnoreExtraProperties;

import org.parceler.Parcel;

/**
 * Model for Skill Tree Category
 */

@Parcel
@IgnoreExtraProperties
public class Category implements Comparable<Category> {

    public Category() {
        //required
    }

    String id;

    String name;

    String description;

    String lastEditBy;

    long lastEditDate;

    int position = -1;

    public int getPosition() {
        return position;
    }

    public void setPosition(int position) {
        this.position = position;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getLastEditBy() {
        return lastEditBy;
    }

    public void setLastEditBy(String lastEditBy) {
        this.lastEditBy = lastEditBy;
    }

    public long getLastEditDate() {
        return lastEditDate;
    }

    public void setLastEditDate(long lastEditDate) {
        this.lastEditDate = lastEditDate;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    @Override
    public int compareTo(@NonNull Category category) {
        if (this.getPosition() > category.getPosition())
            return 1;
        else if (this.getPosition() < category.getPosition())
            return -1;
        else return 0;
    }
}

redpajama_set_name: RedPajamaGithub


text:
namespace Ui {
class UserWindow;
}

class UserWindow : public QWidget {
  Q_OBJECT

 public:
  explicit UserWindow(Instance *instance, QWidget *parent = 0);
  ~UserWindow();

 public slots:
  void reload();
  void loadOnline();
  bool isOnline(QString username);
  void reloadUserStatus(QString username);
  QString lastConnection(QString username);

 private:
  Ui::UserWindow *ui;

 protected:
  Instance *instance;
 private slots:
  void on_newUserButton_clicked();
  void on_listWidget_currentTextChanged(const QString &currentText);
  void on_firstnameEdit_editingFinished();
  void on_lastnameEdit_editingFinished();
  void on_mailEdit_editingFinished();
  void on_deviceIdEdit_editingFinished();
  void on_saveButton_clicked();
};

#endif  // USERWINDOW_H


text:
package org.apache.carbondata.core.cache.dictionary;

/**
 * This class will be used for dictionary key and value look up
 */
public class ReverseDictionary implements Dictionary {

  /**
   * Object which will hold the information related to this dictionary column
   */
  private ColumnReverseDictionaryInfo columnReverseDictionaryInfo;

  /**
   * @param columnReverseDictionaryInfo
   */
  public ReverseDictionary(ColumnReverseDictionaryInfo columnReverseDictionaryInfo) {
    this.columnReverseDictionaryInfo = columnReverseDictionaryInfo;
  }

  /**
   * This method will find and return the surrogate key for a given dictionary value
   * Applicable scenario:
   * 1. Incremental data load : Dictionary will not be generated for existing values. For
   * that values have to be looked up in the existing dictionary cache.
   * 2. Filter scenarios where from value surrogate key has to be found.
   *
   * @param value dictionary value
   * @return if found returns key else INVALID_SURROGATE_KEY
   */
  @Override public int getSurrogateKey(String value) {
    return columnReverseDictionaryInfo.getSurrogateKey(value);
  }

  /**
   * This method will find and return the surrogate key for a given dictionary value
   * Applicable scenario:
   * 1. Incremental data load : Dictionary will not be generated for existing values. For
   * that values have to be looked up in the existing dictionary cache.
   * 2. Filter scenarios where from value surrogate key has to be found.
   *
   * @param value dictionary value as byte array
   * @return if found returns key else INVALID_SURROGATE_KEY
   */
  @Override public int getSurrogateKey(byte[] value) {
    return columnReverseDictionaryInfo.getSurrogateKey(value);
  }

  /**
   * This method will find and return the dictionary value for a given surrogate key.
   * Applicable scenarios:
   * 1. Query final result preparation : While convert the final result which will
   * be surrogate key back to original dictionary values this method will be used
   *
   * @param surrogateKey a unique ID for a dictionary value
   * @return value if found else null
   */
  @Override public String getDictionaryValueForKey(int surrogateKey) {
    return columnReverseDictionaryInfo.getDictionaryValueForKey(surrogateKey);
  }

  /**
   * This method will find and return the sort index for a given dictionary id.
   * Applicable scenarios:
   * 1. Used in case of order by queries when data sorting is required
   *
   * @param surrogateKey a unique ID for a dictionary value
   * @return if found returns key else 0
   */
  @Override public int getSortedIndex(int surrogateKey) {
    return columnReverseDictionaryInfo.getSortedIndex(surrogateKey);
  }

  /**
   * This method will find and return the dictionary value from sorted index.
   * Applicable scenarios:
   * 1. Query final result preparation in case of order by queries:
   * While convert the final result which will
   * be surrogate key back to original dictionary values this method will be used
   *
   * @param sortedIndex sort index of dictionary value
   * @return value if found else null
   */
  @Override public String getDictionaryValueFromSortedIndex(int sortedIndex) {
    return columnReverseDictionaryInfo.getDictionaryValueFromSortedIndex(sortedIndex);
  }

  /**
   * The method return the dictionary chunks wrapper of a column
   * The wrapper wraps the list<list<bye[]>> and provide the iterator to retrieve the chunks
   * members.
   * Applications Scenario:
   * For preparing the column Sort info while writing the sort index file.
   *
   * @return
   */
  @Override public DictionaryChunksWrapper getDictionaryChunks() {
    return columnReverseDictionaryInfo.getDictionaryChunks();
  }

  /**
   * This method will release the objects and set default value for primitive types
   */
  @Override public void clear() {
    if (null != columnReverseDictionaryInfo) {
      columnReverseDictionaryInfo.clear();
      columnReverseDictionaryInfo = null;
    }
  }

}


text:
<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/maven-v4_0_0.xsd">

    <modelVersion>4.0.0</modelVersion>

    <groupId>info.rmapproject</groupId>
    <artifactId>rmap-parent</artifactId>
    <packaging>pom</packaging>
    <version>2.1.0-beta</version>

    <name>RMap Project</name>
    <url>http://rmap-project.info</url>

    <modules>
        <module>api</module>
        <module>core</module>
        <module>auth</module>
        <module>testdata</module>
        <module>webapp</module>
        <module>integration</module>
        <module>spring-util</module>
        <module>integration-util</module>
        <module>indexing-solr</module>
        <module>indexing-solr-resources</module>
        <module>kafka-shared</module>
        <module>idservice-api</module>
        <module>idservice-ark</module>
        <module>idservice-http</module>
        <module>idservice-rand</module>
    </modules>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <scp.port>22</scp.port>

        <java-version>1.8</java-version>
        <org.springframework-version>5.1.3.RELEASE</org.springframework-version>
        <org.aspectj-version>1.6.10</org.aspectj-version>
        <org.powermock-version>1.6.6</org.powermock-version>
        <org.slf4j-version>1.7.25</org.slf4j-version>
        <jackson.version>2.10.1</jackson.version>
        <logback.version>1.2.3</logback.version>
        <rdf4j.version>2.2.2</rdf4j.version>
        <httpclient.version>4.5.2</httpclient.version>
        <jsonld-java.version>0.5.1</jsonld-java.version>
        <commons-collections.version>4.0</commons-collections.version>
        <commons-configuration.version>1.10</commons-configuration.version>
        <commons-dbcp.version>1.4</commons-dbcp.version>
        <junit.version>4.12</junit.version>
        <jstl.version>1.2</jstl.version>
        <jsp-api.version>2.1</jsp-api.version>
        <servlet-api.version>3.1.0</servlet-api.version>
        <jsoup.version>1.8.3</jsoup.version>
        <hibernate.version>5.2.10.Final</hibernate.version>
        <hibernate-validator.version>5.2.5.Final</hibernate-validator.version>
        <mysql-connector.version>5.1.6</mysql-connector.version>
        <postgres-jdbc.version>42.2.1.jre7</postgres-jdbc.version>
        <mockito.version>2.11.0</mockito.version>
        <scribejava.version>2.1.0</scribejava.version>
        <org-json.version>20151123</org-json.version>
        <apache-cxf.version>3.1.4</apache-cxf.version>
        <derby.version>10.13.1.1</derby.version>
        <build-helper.plugin.version>3.0.0</build-helper.plugin.version>
        <okhttp.version>3.8.0</okhttp.version>
        <ant.version>1.10.1</ant.version>
        <solr.version>8.3.0</solr.version>
        <spring-data-solr.version>4.0.3.RELEASE</spring-data-solr.version>
        <spring-kafka.version>2.1.4.RELEASE</spring-kafka.version>
        <kafka.version>1.0.1</kafka.version>
        <joda-time.version>2.9.9</joda-time.version>
        <javax-el.version>3.0.1-b08</javax-el.version>
        <h2-mvstore.version>1.4.196</h2-mvstore.version>
        <ezid.version>1.0.1</ezid.version>
        <assertj.version>3.8.0</assertj.version>
        <maven.war.plugin.version>3.2.0</maven.war.plugin.version>
        <maven.deploy.plugin.version>2.8.2</maven.deploy.plugin.version>
        <wagon.ssh.version>2.10</wagon.ssh.version>
    </properties>

    <profiles>

        <profile>
            <id>external</id>
            <activation>
                <property>
                    <name>external</name>
                </property>
            </activation>
            <properties>
                <scp.port>122</scp.port>
            </properties>
        </profile>

    </profiles>

    <build>

        <pluginManagement>

            <plugins>

                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-compiler-plugin</artifactId>
                    <version>2.5.1</version>
                    <configuration>
                        <source>${java-version}</source>
                        <target>${java-version}</target>
                        <compilerArgument>-Xlint:all</compilerArgument>
                        <showWarnings>true</showWarnings>
                        <showDeprecation>true</showDeprecation>
                    </configuration>
                </plugin>

                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-surefire-plugin</artifactId>
                    <version>2.20.1</version>
                </plugin>

                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-failsafe-plugin</artifactId>
                    <version>2.20.1</version>
                </plugin>

                <plugin>
                    <groupId>org.codehaus.mojo</groupId>
                    <artifactId>build-helper-maven-plugin</artifactId>
                    <version>${build-helper.plugin.version}</version>
                </plugin>

                <plugin>
                    <groupId>com.github.genthaler</groupId>
                    <artifactId>beanshell-maven-plugin</artifactId>
                    <version>1.4</version>
                </plugin>

                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-jar-plugin</artifactId>
                    <version>3.0.2</version>
                    <executions>
                        <execution>
                            <goals>
                                <goal>test-jar</goal>
                            </goals>
                        </execution>
                    </executions>
                </plugin>

                <plugin>
                    <groupId>io.fabric8</groupId>
                    <artifactId>docker-maven-plugin</artifactId>
                    <version>0.23.0</version>
                </plugin>

                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-resources-plugin</artifactId>
                    <version>3.0.2</version>
                </plugin>

                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-remote-resources-plugin</artifactId>
                    <version>1.5</version>
                </plugin>

                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-war-plugin</artifactId>
                    <version>${maven.war.plugin.version}</version>
                </plugin>

                <plugin>
                    <artifactId>maven-deploy-plugin</artifactId>
                    <version>${maven.deploy.plugin.version}</version>
                    <configuration>
                        <retryFailedDeploymentCount>5</retryFailedDeploymentCount>
                    </configuration>
                    <!-- See https://jira.codehaus.org/browse/WAGON-393 -->
                    <dependencies>
                        <dependency>
                            <groupId>org.apache.maven.wagon</groupId>
                            <artifactId>wagon-ssh</artifactId>
                            <version>${wagon.ssh.version}</version>
                        </dependency>
                    </dependencies>
                </plugin>

                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-dependency-plugin</artifactId>
                    <version>3.0.2</version>
                </plugin>

            </plugins>

        </pluginManagement>

    </build>

    <dependencyManagement>
        <dependencies>

            <!-- logging api -->
            <dependency>
                <groupId>org.slf4j</groupId>
                <artifactId>slf4j-api</artifactId>
                <version>${org.slf4j-version}</version>
            </dependency>

            <!-- logging impl -->
            <dependency>
                <groupId>ch.qos.logback</groupId>
                <artifactId>logback-classic</artifactId>
                <version>${logback.version}</version>
            </dependency>
            <dependency>
                <groupId>org.slf4j</groupId>
                <artifactId>log4j-over-slf4j</artifactId>
                <version>${org.slf4j-version}</version>
            </dependency>
            <dependency>
                <groupId>org.slf4j</groupId>
                <artifactId>jcl-over-slf4j</artifactId>
                <version>${org.slf4j-version}</version>
            </dependency>

            <!-- Eclipse RDF4J -->
            <dependency>
                <groupId>org.eclipse.rdf4j</groupId>
                <artifactId>rdf4j-runtime</artifactId>
                <version>${rdf4j.version}</version>
            </dependency>
            <dependency>
                <groupId>org.eclipse.rdf4j</groupId>
                <artifactId>rdf4j-http-server</artifactId>
                <type>war</type>
                <version>${rdf4j.version}</version>
            </dependency>
            <dependency>
                <groupId>org.eclipse.rdf4j</groupId>
                <artifactId>rdf4j-http-workbench</artifactId>
                <type>war</type>
                <version>${rdf4j.version}</version>
            </dependency>

            <dependency>
                <groupId>org.apache.httpcomponents</groupId>
                <artifactId>httpclient</artifactId>
                <version>${httpclient.version}</version>
                <exclusions>
                    <exclusion>
                        <groupId>commons-logging</groupId>
                        <artifactId>commons-logging</artifactId>
                    </exclusion>
                </exclusions>
            </dependency>
            <dependency>
                <groupId>com.github.jsonld-java</groupId>
                <artifactId>jsonld-java</artifactId>
                <version>${jsonld-java.version}</version>
            </dependency>
            <dependency>
                <groupId>org.apache.commons</groupId>
                <artifactId>commons-collections4</artifactId>
                <version>${commons-collections.version}</version>
            </dependency>
            <dependency>
                <groupId>commons-configuration</groupId>
                <artifactId>commons-configuration</artifactId>
                <version>${commons-configuration.version}</version>
                <exclusions>
                    <exclusion>
                        <groupId>commons-logging</groupId>
                        <artifactId>commons-logging</artifactId>
                    </exclusion>
                </exclusions>
            </dependency>

            <!-- spring framework -->
            <dependency>
                <groupId>org.springframework</groupId>
                <artifactId>spring-core</artifactId>
                <version>${org.springframework-version}</version>
                <exclusions>
                    <exclusion>
                        <groupId>commons-logging</groupId>
                        <artifactId>commons-logging</artifactId>
                    </exclusion>
                </exclusions>
            </dependency>
            <dependency>
                <groupId>org.springframework</groupId>
                <artifactId>spring-context</artifactId>
                <version>${org.springframework-version}</version>
                <exclusions>
                    <!-- Exclude Commons Logging in favor of SLF4j -->
                    <exclusion>
                        <groupId>commons-logging</groupId>
                        <artifactId>commons-logging</artifactId>
                    </exclusion>
                </exclusions>
            </dependency>
            <dependency>
                <groupId>org.springframework</groupId>
                <artifactId>spring-web</artifactId>
                <version>${org.springframework-version}</version>
            </dependency>
            <dependency>
                <groupId>org.springframework</groupId>
                <artifactId>spring-webmvc</artifactId>
                <version>${org.springframework-version}</version>
            </dependency>
            <dependency>
                <groupId>org.springframework</groupId>
                <artifactId>spring-test</artifactId>
                <version>${org.springframework-version}</version>
            </dependency>
            <dependency>
                <groupId>org.springframework</groupId>
                <artifactId>spring-tx</artifactId>
                <version>${org.springframework-version}</version>
            </dependency>
            <dependency>
                <groupId>org.springframework</groupId>
                <artifactId>spring-orm</artifactId>
                <version>${org.springframework-version}</version>
            </dependency>
            <dependency>
                <groupId>org.springframework</groupId>
                <artifactId>spring-jdbc</artifactId>
                <version>${org.springframework-version}</version>
            </dependency>
            <dependency>
                <groupId>org.springframework</groupId>
                <artifactId>spring-beans</artifactId>
                <version>${org.springframework-version}</version>
            </dependency>

            <!-- Spring Data -->
            <dependency>
                <groupId>org.springframework.data</groupId>
                <artifactId>spring-data-solr</artifactId>
                <version>${spring-data-solr.version}</version>
            </dependency>

            <!-- Spring Kafka -->
            <dependency>
                <groupId>org.springframework.kafka</groupId>
                <artifactId>spring-kafka</artifactId>
                <version>${spring-kafka.version}</version>
                <exclusions>
                    <exclusion>
                        <groupId>log4j</groupId>
                        <artifactId>log4j</artifactId>
                    </exclusion>
                </exclusions>
            </dependency>

            <dependency>
                <groupId>org.springframework.kafka</groupId>
                <artifactId>spring-kafka-test</artifactId>
                <version>${spring-kafka.version}</version>
                <exclusions>
                    <exclusion>
                        <groupId>log4j</groupId>
                        <artifactId>log4j</artifactId>
                    </exclusion>
                </exclusions>
            </dependency>

            <dependency>
                <groupId>org.apache.kafka</groupId>
                <artifactId>kafka-clients</artifactId>
                <version>${kafka.version}</version>
            </dependency>

            <!-- testing -->
            <dependency>
                <groupId>junit</groupId>
                <artifactId>junit</artifactId>
                <version>${junit.version}</version>
            </dependency>
            <dependency>
                <groupId>info.rmapproject</groupId>
                <artifactId>rmap-testdata</artifactId>
                <version>${project.parent.version}</version>
            </dependency>
            <dependency>
                <groupId>org.mockito</groupId>
                <artifactId>mockito-core</artifactId>
                <version>${mockito.version}</version>
            </dependency>
            <dependency>
                <groupId>org.apache.derby</groupId>
                <artifactId>derby</artifactId>
                <version>${derby.version}</version>
            </dependency>
            <dependency>
                <groupId>org.apache.derby</groupId>
                <artifactId>derbyclient</artifactId>
                <version>${derby.version}</version>
            </dependency>
            <dependency>
                <groupId>org.apache.derby</groupId>
                <artifactId>derbynet</artifactId>
                <version>${derby.version}</version>
            </dependency>
            <dependency>
                <groupId>org.apache.tomcat</groupId>
                <artifactId>apache-tomcat</artifactId>
                <version>8.0.44</version>
            </dependency>

            <!-- webapp -->
            <dependency>
                <groupId>org.json</groupId>
                <artifactId>json</artifactId>
                <version>${org-json.version}</version>
            </dependency>
            <dependency>
                <groupId>org.jsoup</groupId>
                <artifactId>jsoup</artifactId>
                <version>${jsoup.version}</version>
            </dependency>

            <!-- oauth plugin -->
            <dependency>
                <groupId>com.github.scribejava</groupId>
                <artifactId>scribejava-apis</artifactId>
                <version>${scribejava.version}</version>
            </dependency>

            <!-- servlet-related apis -->
            <dependency>
                <groupId>javax.servlet</groupId>
                <artifactId>javax.servlet-api</artifactId>
                <version>${servlet-api.version}</version>
            </dependency>
            <dependency>
                <groupId>javax.servlet.jsp</groupId>
                <artifactId>jsp-api</artifactId>
                <version>${jsp-api.version}</version>
            </dependency>
            <dependency>
                <groupId>javax.servlet</groupId>
                <artifactId>jstl</artifactId>
                <version>${jstl.version}</version>
            </dependency>

            <!-- db / hibernate -->
            <dependency>
                <groupId>org.hibernate</groupId>
                <artifactId>hibernate-core</artifactId>
                <version>${hibernate.version}</version>
            </dependency>
            <dependency>
                <groupId>org.hibernate</groupId>
                <artifactId>hibernate-entitymanager</artifactId>
                <version>${hibernate.version}</version>
            </dependency>
            <dependency>
                <groupId>org.hibernate</groupId>
                <artifactId>hibernate-validator</artifactId>
                <version>${hibernate-validator.version}</version>
            </dependency>
            <dependency> <!-- runtime dep of hibernate-validator -->
                <groupId>org.glassfish</groupId>
                <artifactId>javax.el</artifactId>
                <version>${javax-el.version}</version>
            </dependency>
            <dependency>
                <groupId>commons-dbcp</groupId>
                <artifactId>commons-dbcp</artifactId>
                <version>${commons-dbcp.version}</version>
            </dependency>
            <dependency>
                <artifactId>postgresql</artifactId>
                <groupId>org.postgresql</groupId>
                <version>${postgres-jdbc.version}</version>
            </dependency>
            <!-- needed for testing db on desktop -->
            <dependency>
                <groupId>mysql</groupId>
                <artifactId>mysql-connector-java</artifactId>
                <version>${mysql-connector.version}</version>
            </dependency>

            <!-- AspectJ -->
            <dependency>
                <groupId>org.aspectj</groupId>
                <artifactId>aspectjrt</artifactId>
                <version>${org.aspectj-version}</version>
            </dependency>

            <dependency>
                <groupId>org.apache.cxf</groupId>
                <artifactId>cxf-rt-frontend-jaxrs</artifactId>
                <version>${apache-cxf.version}</version>
            </dependency>

            <dependency>
                <groupId>com.fasterxml.jackson.core</groupId>
                <artifactId>jackson-core</artifactId>
                <version>${jackson.version}</version>
            </dependency>
            <dependency>
                <groupId>com.fasterxml.jackson.core</groupId>
                <artifactId>jackson-databind</artifactId>
                <version>${jackson.version}</version>
            </dependency>

            <dependency>
                <groupId>com.fasterxml.jackson.core</groupId>
                <artifactId>jackson-annotations</artifactId>
                <version>${jackson.version}</version>
            </dependency>

            <dependency>
                <groupId>com.fasterxml.jackson.jaxrs</groupId>
                <artifactId>jackson-jaxrs-json-provider</artifactId>
                <version>${jackson.version}</version>
            </dependency>

            <dependency>
                <groupId>com.squareup.okhttp3</groupId>
                <artifactId>okhttp</artifactId>
                <version>${okhttp.version}</version>
            </dependency>

            <dependency>
                <groupId>org.apache.ant</groupId>
                <artifactId>ant</artifactId>
                <version>${ant.version}</version>
            </dependency>

            <!-- EZID service dependencies -->
            <dependency>
                <groupId>com.h2database</groupId>
                <artifactId>h2-mvstore</artifactId>
                <version>${h2-mvstore.version}</version>
            </dependency>

            <dependency>
                <groupId>edu.ucsb.nceas</groupId>
                <artifactId>ezid</artifactId>
                <version>${ezid.version}</version>
                <exclusions>
                    <exclusion>
                        <groupId>commons-logging</groupId>
                        <artifactId>commons-logging</artifactId>
                    </exclusion>
                </exclusions>
            </dependency>

            <dependency>
                <groupId>org.apache.solr</groupId>
                <artifactId>solr-core</artifactId>
                <version>${solr.version}</version>
                <exclusions>
                    <exclusion>
                        <groupId>log4j</groupId>
                        <artifactId>log4j</artifactId>
                    </exclusion>
                    <exclusion>
                        <groupId>javax.servlet</groupId>
                        <artifactId>javax.servlet-api</artifactId>
                    </exclusion>
                </exclusions>
            </dependency>

            <dependency>
                <groupId>joda-time</groupId>
                <artifactId>joda-time</artifactId>
                <version>${joda-time.version}</version>
            </dependency>

            <dependency>
                <groupId>org.assertj</groupId>
                <artifactId>assertj-core</artifactId>
                <version>${assertj.version}</version>
            </dependency>

        </dependencies>
    </dependencyManagement>

    <repositories>

        <repository>
            <id>dataconservancy.org</id>
            <url>http://maven.dataconservancy.org/public/releases/</url>
            <releases>
                <enabled>true</enabled>
            </releases>
            <snapshots>
                <enabled>false</enabled>
            </snapshots>
        </repository>

        <repository>
            <id>boundless</id>
            <url>http://repo.boundlessgeo.com/main/</url>
            <releases>
                <enabled>true</enabled>
            </releases>
            <snapshots>
                <enabled>false</enabled>
            </snapshots>
        </repository>

    </repositories>

    <distributionManagement>

        <repository>
            <id>dc.public.releases</id>
            <name>Data Conservancy Release Maven Repository</name>
            <url>scp://maven.dataconservancy.org:${scp.port}/data/maven-dc/public/releases/</url>
        </repository>

        <snapshotRepository>
            <id>dc.public.snapshots</id>
            <name>Data Conservancy Snapshot Maven Repository</name>
            <url>scp://maven.dataconservancy.org:${scp.port}/data/maven-dc/public/snapshots/</url>
            <uniqueVersion>false</uniqueVersion>
        </snapshotRepository>

    </distributionManagement>

</project>


text:
import { ChangeDetectionStrategy, Component, OnInit } from '@angular/core';
import { HttpClient } from '@angular/common/http';
import { Observable } from 'rxjs';
import { FormControl, FormGroup, Validators } from '@angular/forms';
import { PostService } from '../post.service';
import { Router } from '@angular/router';
import { Post } from '../common';

@Component({
  selector: 'codelab-form',
  templateUrl: './form.component.html',
  styleUrls: ['./form.component.scss'],
  changeDetection: ChangeDetectionStrategy.OnPush
})
export class FormComponent {
  title = new FormControl('', Validators.required);
  author = new FormControl('', Validators.required);
  text = new FormControl('', Validators.required);
  date: Date;
  post: Observable<Post>;
  myform = new FormGroup({
    title: this.title,
    author: this.author,
    text: this.text
  });
  statusMessage = '';
  error = false;

  constructor(
    private http: HttpClient,
    private postService: PostService,
    private router: Router
  ) {}

  onSubmit() {
    const formValues: any = this.myform.getRawValue();
    this.postService
      .addPost(formValues)
      .then(({ key }) => {
        this.myform.reset();
        this.router.navigateByUrl(`post/${key}`);
      })
      .catch(() => {
        this.statusMessage = 'Error';
        this.error = true;
      });
  }
}


text:
    <select id="interactions_function">
        <option value="networks">networks</option>
        <option value="users">users</option>
        <option value="owner sites">sites</option>
        <option value="instance_sites">instance_sites</option>
        <option value="instance_nodes">instance_nodes</option>
    </select>

Slice Interactions


text:
#ifndef WEBRTC_WINDOWRENDERER_H
#define WEBRTC_WINDOWRENDERER_H

#include "Common.h"
#include "MediaSource.h"

namespace WebRTC {
  class WindowRenderer : public MediaSource  {
    public:
      static void Init();
      static void Init(v8::Local<v8::Object> constructor);

      virtual void End();

    private:
      explicit WindowRenderer(v8::Local<v8::Object> properties);
      virtual ~WindowRenderer();

      static NAN_METHOD(New);

      virtual void On(Event *event);

    protected:
      int _id;
      int _width;
      int _height;
      void* _window;
      bool _fullScreen;
      webrtc::VideoRender* _module;
      webrtc::VideoRenderType _type;
      webrtc::VideoRenderCallback* _renderer;

      static int StreamId;
  };
};

#endif


text:
import pandas as pd
import codecs
from util import smart_read_df

def dump_message_ids(interactions_path, output_path):
    df = smart_read_df(interactions_path)
    with codecs.open(output_path, 'w', 'utf8') as f:
        for i, r in df.iterrows():
            f.write(
                u'{}\n'.format(r['message_id'])
                )

if __name__ == '__main__':
    import argparse
    parser = argparse.ArgumentParser('dump message ids')
    parser.add_argument('--interactions_path', required=True)
    parser.add_argument('--output_path', required=True)

    args = parser.parse_args()
    dump_message_ids(args.interactions_path,
                     args.output_path)


text:
// <copyright file="RobinsonProcessor.cs" company="James Jackson-South">
// Copyright (c) James Jackson-South and contributors.
// Licensed under the Apache License, Version 2.0.
// </copyright>

namespace ImageSharp.Processing.Processors
{
    using System;
    using System.Diagnostics.CodeAnalysis;

    using ImageSharp.Memory;
    using ImageSharp.PixelFormats;

    /// <summary>
    /// The Kirsch operator filter.
    /// <see href="http://www.tutorialspoint.com/dip/Robinson_Compass_Mask.htm"/>
    /// </summary>
    /// <typeparam name="TPixel">The pixel format.</typeparam>
    [SuppressMessage("ReSharper", "StaticMemberInGenericType", Justification = "We want to use only one instance of each array field for each generic type.")]
    internal class RobinsonProcessor<TPixel> : EdgeDetectorCompassProcessor<TPixel>
        where TPixel : struct, IPixel<TPixel>
    {
        /// <summary>
        /// The North gradient operator
        /// </summary>
        private static readonly Fast2DArray<float> RobinsonNorth =
            new float[,]
            {
               { 1, 2, 1 },
               { 0,  0, 0 },
               { -1, -2, -1 }
            };

        /// <summary>
        /// The NorthWest gradient operator
        /// </summary>
        private static readonly Fast2DArray<float> RobinsonNorthWest =
            new float[,]
            {
               { 2,  1, 0 },
               { 1,  0, -1 },
               { 0, -1, -2 }
            };

        /// <summary>
        /// The West gradient operator
        /// </summary>
        private static readonly Fast2DArray<float> RobinsonWest =
            new float[,]
            {
               { 1, 0, -1 },
               { 2, 0, -2 },
               { 1, 0, -1 }
            };

        /// <summary>
        /// The SouthWest gradient operator
        /// </summary>
        private static readonly Fast2DArray<float> RobinsonSouthWest =
            new float[,]
            {
               { 0, -1, -2 },
               { 1, 0, -1 },
               { 2, 1,  0 }
            };

        /// <summary>
        /// The South gradient operator
        /// </summary>
        private static readonly Fast2DArray<float> RobinsonSouth =
            new float[,]
            {
               { -1, -2, -1 },
               { 0,  0, 0 },
               { 1,  2,  1 }
            };

        /// <summary>
        /// The SouthEast gradient operator
        /// </summary>
        private static readonly Fast2DArray<float> RobinsonSouthEast =
            new float[,]
            {
               { -2, -1, 0 },
               { -1,  0, 1 },
               { 0,  1,  2 }
            };

        /// <summary>
        /// The East gradient operator
        /// </summary>
        private static readonly Fast2DArray<float> RobinsonEast =
            new float[,]
            {
               { -1, 0, 1 },
               { -2, 0, 2 },
               { -1, 0, 1 }
            };

        /// <summary>
        /// The NorthEast gradient operator
        /// </summary>
        private static readonly Fast2DArray<float> RobinsonNorthEast =
            new float[,]
            {
               { 0,  1,  2 },
               { -1,  0, 1 },
               { -2, -1, 0 }
            };

        /// <inheritdoc/>
        public override Fast2DArray<float> North => RobinsonNorth;

        /// <inheritdoc/>
        public override Fast2DArray<float> NorthWest => RobinsonNorthWest;

        /// <inheritdoc/>
        public override Fast2DArray<float> West => RobinsonWest;

        /// <inheritdoc/>
        public override Fast2DArray<float> SouthWest => RobinsonSouthWest;

        /// <inheritdoc/>
        public override Fast2DArray<float> South => RobinsonSouth;

        /// <inheritdoc/>
        public override Fast2DArray<float> SouthEast => RobinsonSouthEast;

        /// <inheritdoc/>
        public override Fast2DArray<float> East => RobinsonEast;

        /// <inheritdoc/>
        public override Fast2DArray<float> NorthEast => RobinsonNorthEast;
    }
}


text:
import binascii
import copy
import hashlib

from .collections import BitCollection, SecretKeyCollection
from .exceptions import ConfigError
from .random import MT19937

class TokenLayer:
    """Provides a common interface for several token layer types."""

    TYPES = [
        'BitCollection',
        'int',
        'bytes',
        'hex',
    ]
    """The list of valid types."""

    def __init__(self, d):
        """Takes a dictionary of settings and ingests it as a layer."""

        # Must be a dictionary.
        if not isinstance(d, dict):
            raise ConfigError('layers must each be a dict')
        self.config = d

        # What is this layer's type?
        self.type = d.get('type', None)
        if self.type not in self.TYPES:
            err = 'layer type must be in %s' % ', '.join(self.TYPES)
            raise ConfigError(err)

        # Init the bits.
        self.bits = d.get('bits', None)
        if self.bits != None and not isinstance(self.bits, int):
            raise ConfigError('layer bits key must be a positive int')

        # Init the length.
        self.length = d.get('length', None)
        if not self.length and not self.bits:
            raise ConfigError('layer bits key must be a positive int')
        if self.length:
            if not isinstance(self.length, int) or self.length < 1:
                raise ConfigError('layer length must be a positive int')

        # Bits and ints require bits.
        if self.type in ['BitCollection','int']:
            if not self.bits:
                err = 'layer %s bits key must be a positive int'
                raise ConfigError(err % self.type)
            self.length = self.bits

        # Bytes are 8 bits each.
        elif self.type == 'bytes':
            if self.bits:
                if (self.bits % 8) != 0:
                    raise ConfigError('layer bytes bits must be divisible by 0')
                self.length = self.bits // 8
            else:
                self.bits = self.length * 8

        # Hex are 16 bits per character.
        elif self.type == 'hex':
            if self.bits:
                if (self.bits % 4) != 0:
                    raise ConfigError('layer hex bits must be divisible by 16')
                self.length = self.bits // 4
            else:
                self.bits = self.length * 4

        # Type doesn't count.
        else:
            raise ConfigError('invalid layer type')

        # Every type has the optional 'positions' key
        self.positions = None
        positions = d.get('positions', None)
        if positions:

            # Make sure the positions are syntacticly valid
            err = 'positions must be a list of non-negative ints'
            if not isinstance(positions, list):
                raise ConfigError(err)
            for value in positions:
                if not isinstance(value, int) or value < 0:
                    raise ConfigError(err)

            # Do the number of positions match the number of bits?
            if len(positions) != self.bits:
                raise ConfigError('number of layer positions must match bits')

            # Positions is valid
            self.positions = positions

        self.seed_bits = None
        if 'seed_bits' in d:
            seed_bits = d.get('seed_bits')
            if not isinstance(seed_bits, int) or seed_bits < 0:
                raise ConfigError('seed bits must be a non-negative int')
            self.seed_bits = seed_bits

    def to_bitcollection(self, v):
        """Get the BitCollection for this layer."""

        # Is it a BitCollection?
        if self.type == 'BitCollection':
            if not isinstance(v, BitCollection):
                raise ValueError('layer value must be a BitCollection')
            if v.length() != self.bits:
                raise ValueError('layer value has incorrect number of bits')
            return v

        # Is it an int?
        if self.type == 'int':
            if not isinstance(v, int):
                raise ValueError('layer value must be an int')
            if v.bit_length() > self.bits:
                raise ValueError('layer value is too many bits')
            return BitCollection.from_int(v, bits=self.bits)

        # Is it bytes?
        if self.type == 'bytes':
            if not isinstance(v, bytes):
                raise ValueError('layer value must be bytes')
            if len(v) != self.length:
                raise ValueError('layer value is incorrect length')
            return BitCollection.from_bytes(v)

        # Is it string?
        if self.type == 'hex':
            if not isinstance(v, str):
                raise ValueError('layer value must be str')
            if len(v) != self.length:
                raise ValueError('layer value is incorrect length')
            return BitCollection.from_hex(v)

        # Something failed here, which should be impossible.
        raise ConfigError('unable to create BitCollection')

    def from_bitcollection(self, b):
        """Convert to original format."""
        if self.type == 'BitCollection':
            return b
        if self.type == 'int':
            return b.to_int()
        if self.type == 'bytes':
            return b.to_bytes()
        if self.type == 'hex':
            return b.to_hex()
        raise ConfigError('unable to convert to original format')

class TokenResult:
    """Object created from decoding a token.

    The Token object only carries configuration information. It's
    resulting collection carries its results.
    """

    def __init__(self, private_token=None, public_token=None, layers=None):
        """Populate the collection once with everything it'll ever have.

        """
        self.layers = layers
        self.public_token = public_token
        self.private_token = private_token

class Token:
    """Generate and encode tokens based on ordered parameters.

    TokenGenerator methods affect how the final token will be created.
    Some methods overwrite their previous values, while others append
    to ordered lists.

    A token option can optionally be given a single config dictionary
    with all the necessary parameters. This is an easier method of
    sharing token configurations between functions and modules.

    A sample config could be stored as and submitted as the following:
        config = {
            "secret_key": "the length of this should be long",
            "private_token_bits": 512,
            "seed_bits": 4,
            "layers": [
                {
                    'type': 'int',
                    'bits': 64, # 64 bits
                },
                {
                    'type': 'int',
                    'bits': 5,
                    'positions': [1,5,2,3,5], # Manual bit positions
                },
            ],
        }

    Here is a sample usage:
        >>> token = Token(config)
        >>> result1 = token.encode(1,2)
        >>> result2 = token.decode(result1.public_token)
        >>> result2.layers[1] == 2
        True

    """

    def __init__(self, config=None):
        """Set default object properties."""

        # The secret string to use for predictable randomness.
        self.secret_key = None

        # Number of bits saying how many automatic positions exist.
        self.seed_bits = 0

        # What should the random token look like?
        self.private_token_bits = 0

        # Values getting spliced into the public token.
        self.layers = []

        # Is config here?
        self.config = {}
        if config:
            self.set_config(config)

    def set_config(self, config):
        """Ingest a config dictionary.

        Raises:
            ConfigError: layers must be lists or ints.

        """
        # Keep this config.
        self.config = config

        # Ingest the secret used to seed everything.
        secret = config.get('secret_key', None)
        if secret:
            if not isinstance(secret, str):
                raise ConfigError('secret key must be a string')
            self.secret_key = secret

        # Might have to use global secret if available
        else:
            from token_cloak import secret_key
            if not secret_key:
                raise ConfigError('secret key is not set')
            self.secret_key = secret_key

        # Get the secret key collection going.
        self.secret_key_collection = SecretKeyCollection(self.secret_key)

        # Determines the length of stored token.
        self.private_token_bits = 0
        private_token_bits = config.get('private_token_bits', None)
        if private_token_bits:

            # Is it a direct injection?
            if isinstance(private_token_bits, BitCollection):
                self.private_token_bits = private_token_bits

            # Is it just a length for random generation?
            else:
                if (not isinstance(private_token_bits, int)
                        or private_token_bits < 0):
                    raise ConfigError('random bits must be a non-negative int')

                # Generate the token now
                self.private_token_bits = private_token_bits

        # Determines how many possible seeds there can be.
        seed_bits = config.get('seed_bits', None)
        if seed_bits:
            if not isinstance(seed_bits, int) or seed_bits < 0:
                raise ConfigError('seed bits must be a non-negative int')
            self.seed_bits = seed_bits

        # Ingest the layers sequence and sizes.
        self.layers = []
        if config.get('layers', None):
            if not isinstance(config.get('layers'), list):
                raise ConfigError('layers must be a list')

            # Ingest layers as TokenLayers.
            for row in config.get('layers'):
                self.layers.append(TokenLayer(row)) # Raises ConfigError

        # Make sure the secret is long enough for layers.
        if len(self.layers) > len(self.secret_key):
            err = "secret key length cannot be less than number of layers"
            raise ConfigError(err)

    def encode(self, *args):
        """Make the public token based on the input values.

        If arguments are supplied with this method, then they will
        override any current settings on the object.

        Returns:
            BitCollection: public token.

        Raises:
            ConfigError: number of args doesn't match number of layers.

        """
        # Ensure the input matches
        stored_token = None
        if len(args) != len(self.layers):

            # Is there not just one more than before?
            if len(args) != (len(self.layers) + 1):
                err = 'number of args doesn\'t match number of layers'
                raise ConfigError(err)

            # The first argument will be treated as a token.
            stored_token = args[0]
            if not isinstance(args[0], BitCollection):
                raise ValueError('token must be a BitCollection')

            # Is it the correct length?
            if stored_token.length() != self.private_token_bits:
                err = 'token must be %d bits long, is currently %d'
                err = err % (self.private_token_bits, stored_token.length(),)
                raise ValueError(err)

            # Adjust the args for proper use.
            args = tuple(list(args)[1:])

        # Generate a new stored token.
        if not stored_token:
            if self.private_token_bits and self.private_token_bits > 0:
                stored_token = BitCollection.from_random(self.private_token_bits)
            else:
                stored_token = BitCollection()

        # Start the new public token.
        public_token = copy.deepcopy(stored_token)

        # Are there any layers?
        if not self.layers:
            return TokenResult(
                    public_token=public_token,
                    private_token=stored_token)

        # Decide on predictable seed positions up front
        seed_sources = []
        need_seeds = self.needed_seeds()
        if need_seeds > 0:
            for chunk in self.secret_key_collection.chunk(need_seeds):
                seed_sources.append(chunk)
            seed_sources = seed_sources[::-1]

        # Go through each layer in order
        stored_layers = []
        for index, layer in enumerate(self.layers):

            # Does this layer have positions?
            seed_bits = None
            layer_seed_seed = None
            layer_seed_value = 0
            layer_positions = layer.positions
            if not layer_positions:

                # Get the seed prepared.
                layer_seed_value = seed_sources.pop()
                seed_bits = layer.seed_bits
                if seed_bits is None:
                    seed_bits = self.seed_bits
                if seed_bits:
                    layer_seed_seed = layer_seed_value
                    b = BitCollection.from_random(seed_bits)
                    layer_seed_value = b.to_int()

                # Generate the layer positions using the seed.
                layer_positions = self.generate_bit_positions(
                        seed=layer_seed_value,
                        max_position=public_token.length(),
                        bits=layer.bits)

            # Sew in the new bits.
            public_token.insert(
                    layer.to_bitcollection(
                            args[index]), positions=layer_positions)

            # Save the content.
            stored_layers.append(args[index])

            # Was there an automatic seed?
            if layer_seed_seed:

                # Generate the seed positions.
                seed_positions = self.generate_bit_positions(
                        seed=layer_seed_seed,
                        max_position=public_token.length(),
                        bits=seed_bits)

                # Sew in the seed bits.
                public_token.insert_int(
                        layer_seed_value, positions=seed_positions)

        # All spliced - return results.
        return TokenResult(
                public_token=public_token,
                private_token=stored_token,
                layers=stored_layers)

    def decode(self, token, data_type=None, **kwargs):
        """Decode a token created by this class.

        For accurate decoding, it is essential that the input
        parameters used to create the token are provided in the same
        manner as they were for generation.

        The main difference is the 'values' attribute will be updated
        with the decoded values from the token.

        Args:
            token (mixed): public token in a variety of possible types.
            data_type (Optional[str]): How the token is encoded on a
                data level. Optional if not string or if in config.

        Returns:
            If successful, dict. Otherwise, None.

        """
        # Get data_type from somewhere else.
        if not data_type:
            data_type = self.config.get('public_token_type', None)

        # Start with the expected length.
        expected_length = self.public_token_bit_length()
        bit_remainder = 0

        # Put the token into a BitCollection based on data_type.
        if not data_type:
            if not isinstance(token, BitCollection):
                raise ValueError('token\'s data type does not match')
            public_token = token

        # Decode from base64.
        elif data_type == 'base64':
            try:
                public_token = BitCollection.from_base64(
                        token, url_safe=kwargs.get('url_safe', None))
            except binascii.Error:
                return None
            bit_remainder = self.remainder_by_divisor(expected_length, 8)

        # Decode from bytes.
        elif data_type == 'bytes':
            public_token = BitCollection.from_bytes(token)
            bit_remainder = self.remainder_by_divisor(expected_length, 8)

        # Decode from hex.
        elif data_type == 'hex':
            public_token = BitCollection.from_hex(token)
            bit_remainder = self.remainder_by_divisor(expected_length, 4)

        # Decode from int.
        elif data_type == 'int':
            if token.bit_length() > self.public_token_bit_length():
                return None
            public_token = BitCollection.from_int(
                    token, bits=self.public_token_bit_length())

        # Invalid type.
        else:
            raise ValueError('invalid data_type')

        # Adjust if a remainder exists.
        for i in range(bit_remainder):
            public_token.pop()

        # Validate the token by its length.
        if expected_length != public_token.length():
            return None

        # Setup the stored token.
        stored_token = copy.deepcopy(public_token)

        # Are there layers?
        if not self.layers:
            return TokenResult(
                    public_token=public_token,
                    private_token=stored_token)

        # Setup for peeling away layers.
        stored_layers = []
        seed_sources = []
        need_seeds = self.needed_seeds()
        if need_seeds > 0:
            for chunk in self.secret_key_collection.chunk(need_seeds):
                seed_sources.append(chunk)

        # Start off with the layers!
        for index, layer in enumerate(self.layers[::-1]):

            # Does it have a seeded position?
            layer_seed_seed = None
            layer_seed_value = 0
            layer_positions = layer.positions
            if not layer_positions:

                # Get the seed from the token.
                layer_seed_value = seed_sources.pop()
                seed_bits = layer.seed_bits
                if seed_bits is None:
                    seed_bits = self.seed_bits
                if seed_bits:
                    seed_positions = self.generate_bit_positions(
                            seed=layer_seed_value,
                            max_position=stored_token.length() - seed_bits,
                            bits=seed_bits)

                    # Extract in the seed bits.
                    layer_seed_value = stored_token.extract_int(
                            positions=seed_positions[::-1])

                # Generate the layer positions using the seed.
                layer_positions = self.generate_bit_positions(
                        seed=layer_seed_value,
                        max_position=stored_token.length() - layer.bits,
                        bits=layer.bits)

            # Get the layer value from the token based on format.
            layer_value = stored_token.extract(
                    positions=layer_positions[::-1])

            # Store the value away as its original datatype.
            stored_layers.append(layer.from_bitcollection(layer_value))

        # Reverse the stored_layers in order to match how layers are added.
        stored_layers = stored_layers[::-1]

        # All done!
        return TokenResult(
                public_token=public_token,
                private_token=stored_token,
                layers=stored_layers)

    def hash_seed(self, seed):
        """
        Takes a seed and returns another seed that's been hashed with
        this token's secret key.

        Args:
            seed (int): Randomly generated seed value.

        Returns:
            int: hashed with this token's secret key.

        """
        # Start up our SHA256 object.
        m = hashlib.sha256()

        # Insert the bytes from our original seed.
        b = BitCollection.from_int(seed, bits=seed.bit_length())
        m.update(b.to_bytes())

        # Insert the bytes from the secret key.
        m.update(self.secret_key.encode('ascii'))

        # Get 32-bits worth of the resulting hash.
        c = BitCollection.from_bytes(m.digest()[:4])
        return c.to_int()

    def needed_seeds(self):
        """Calculates number of layer seeds needed to be generated."""
        need_seeds = 0
        for layer in self.layers:
            if not layer.positions:
                need_seeds += 1
        return need_seeds

    def public_token_bit_length(self):
        """
        Helper function to calculate supposed bit length for token.

        Args:
            with_padding (Optional[str]): Data type to pad for.

        Returns:
            int: number of bits expected for the public token.

        """
        # How many random bits are there?
        total_bits = self.private_token_bits

        # Do the math for each layer
        if self.layers:
            for layer in self.layers:

                # Add bits for included seed
                if not layer.positions:
                    seed_bits = layer.seed_bits
                    if seed_bits is None:
                        seed_bits = self.seed_bits
                    total_bits += seed_bits

                # Add the number of bits the actual value can be
                total_bits += layer.bits

        # Return the tally
        return total_bits

    @staticmethod
    def remainder_by_divisor(expected, divisor):
        """Shortcut to get the remainder from the expected length.

        Since several input formats are chunked in even, multi-bit
        blocks, sometimes ending bits need to be sliced off in order to
        reproduce the original token.

        The resulting remainder is that number of bits.

        Args:
            expected (int): Length of expected public token.
            divisor (int): Multible by which the input data format is
                chunked by.

        Returns:
            int: from 0 to divisor - 1.

        """
        mod = expected % divisor
        if mod:
            return divisor - mod
        return 0

    def generate_bit_positions(self, seed, max_position, bits):
        """
        Generates an ordered list of integer positions based on the
        provided elements.

        Args:
            seed (mixed): Hashable value to create predictable randomness.
            max_position (int): Highest allowed position to generate.
            bits (int): Number of positions needed for this operation.

        Returns:
            positions (list): List of integers, denoting the position in
                the public token for bits to reside.

        """
        # Seed the randomness according to the seed
        r = MT19937(self.hash_seed(seed))

        # Start generating
        positions = []
        for i in range(bits):
            positions.append(r.rand_int(0, max_position + i))

        # Return the list of integers
        return positions


text:
import pytest

from ansible.playbook.play_context import PlayContext

from openshift_health_check import ActionModule, resolve_checks
from openshift_health_check import copy_remote_file_to_dir, write_result_to_output_dir, write_to_output_file
from openshift_checks import OpenShiftCheckException, FileToSave

def fake_check(name='fake_check', tags=None, is_active=True, run_return=None, run_exception=None,
               run_logs=None, run_files=None, changed=False, get_var_return=None):
    """Returns a new class that is compatible with OpenShiftCheck for testing."""

    _name, _tags = name, tags

    class FakeCheck(object):
        name = _name
        tags = _tags or []

        def __init__(self, **_):
            self.changed = False
            self.failures = []
            self.logs = run_logs or []
            self.files_to_save = run_files or []

        def is_active(self):
            if isinstance(is_active, Exception):
                raise is_active
            return is_active

        def run(self):
            self.changed = changed
            if run_exception is not None:
                raise run_exception
            return run_return

        def get_var(*args, **_):
            return get_var_return

        def register_failure(self, exc):
            self.failures.append(OpenShiftCheckException(str(exc)))
            return

    return FakeCheck

# Fixtures

@pytest.fixture
def plugin():
    task = FakeTask('openshift_health_check', {'checks': ['fake_check']})
    plugin = ActionModule(task, FakeConnection(), PlayContext(), None, None, None)
    return plugin

class FakeShell(object):
    def __init__(self):
        self.tmpdir = None

class FakeConnection(object):
    def __init__(self):
        self._shell = FakeShell()

class FakeTask(object):
    def __init__(self, action, args):
        self.action = action
        self.args = args
        self.async = 0
        self.async_val = 0
        self._supports_async = True

@pytest.fixture
def task_vars():
    return dict(openshift=dict(), ansible_host='unit-test-host')

# Assertion helpers

def failed(result, msg_has=None):
    if msg_has is not None:
        assert 'msg' in result
        for term in msg_has:
            assert term.lower() in result['msg'].lower()
    return result.get('failed', False)

def changed(result):
    return result.get('changed', False)

# tests whether task is skipped, not individual checks
def skipped(result):
    return result.get('skipped', False)

# Tests

@pytest.mark.parametrize('task_vars', [
    None,
    {},
])
def test_action_plugin_missing_openshift_facts(plugin, task_vars, monkeypatch):
    monkeypatch.setattr(plugin, 'load_known_checks', lambda *_: {})
    monkeypatch.setattr('openshift_health_check.resolve_checks', lambda *args: ['fake_check'])
    result = plugin.run(tmp=None, task_vars=task_vars)

    assert failed(result, msg_has=['openshift_facts'])

def test_action_plugin_cannot_load_checks_with_the_same_name(plugin, task_vars, monkeypatch):
    FakeCheck1 = fake_check('duplicate_name')
    FakeCheck2 = fake_check('duplicate_name')
    checks = [FakeCheck1, FakeCheck2]
    monkeypatch.setattr('openshift_checks.OpenShiftCheck.subclasses', classmethod(lambda cls: checks))

    result = plugin.run(tmp=None, task_vars=task_vars)

    assert failed(result, msg_has=['duplicate', 'duplicate_name', 'FakeCheck'])

@pytest.mark.parametrize('is_active, skipped_reason', [
    (False, "Not active for this host"),
    (Exception("borked"), "exception"),
])
def test_action_plugin_skip_non_active_checks(is_active, skipped_reason, plugin, task_vars, monkeypatch):
    checks = [fake_check(is_active=is_active)]
    monkeypatch.setattr('openshift_checks.OpenShiftCheck.subclasses', classmethod(lambda cls: checks))

    result = plugin.run(tmp=None, task_vars=task_vars)

    assert result['checks']['fake_check'].get('skipped')
    assert skipped_reason in result['checks']['fake_check'].get('skipped_reason')
    assert not failed(result)
    assert not changed(result)
    assert not skipped(result)

@pytest.mark.parametrize('to_disable', [
    'fake_check',
    ['fake_check', 'spam'],
    '*,spam,eggs',
])
def test_action_plugin_skip_disabled_checks(to_disable, plugin, task_vars, monkeypatch):
    checks = [fake_check('fake_check', is_active=True)]
    monkeypatch.setattr('openshift_checks.OpenShiftCheck.subclasses', classmethod(lambda cls: checks))

    task_vars['openshift_disable_check'] = to_disable
    result = plugin.run(tmp=None, task_vars=task_vars)

    assert result['checks']['fake_check'] == dict(skipped=True, skipped_reason="Disabled by user request")
    assert not failed(result)
    assert not changed(result)
    assert not skipped(result)

def test_action_plugin_run_list_checks(monkeypatch):
    task = FakeTask('openshift_health_check', {'checks': []})
    plugin = ActionModule(task, FakeConnection(), PlayContext(), None, None, None)
    monkeypatch.setattr(plugin, 'load_known_checks', lambda *_: {})
    result = plugin.run()

    assert failed(result, msg_has="Available checks")
    assert not changed(result)
    assert not skipped(result)

def test_action_plugin_run_check_ok(plugin, task_vars, monkeypatch):
    check_return_value = {'ok': 'test'}
    check_class = fake_check(run_return=check_return_value, run_files=[None])
    monkeypatch.setattr(plugin, 'load_known_checks', lambda *_: {'fake_check': check_class()})
    monkeypatch.setattr('openshift_health_check.resolve_checks', lambda *args: ['fake_check'])

    result = plugin.run(tmp=None, task_vars=task_vars)

    assert result['checks']['fake_check'] == check_return_value
    assert not failed(result)
    assert not changed(result)
    assert not skipped(result)

def test_action_plugin_run_check_changed(plugin, task_vars, monkeypatch):
    check_return_value = {'ok': 'test'}
    check_class = fake_check(run_return=check_return_value, changed=True)
    monkeypatch.setattr(plugin, 'load_known_checks', lambda *_: {'fake_check': check_class()})
    monkeypatch.setattr('openshift_health_check.resolve_checks', lambda *args: ['fake_check'])

    result = plugin.run(tmp=None, task_vars=task_vars)

    assert result['checks']['fake_check'] == check_return_value
    assert changed(result['checks']['fake_check'])
    assert not failed(result)
    assert changed(result)
    assert not skipped(result)

def test_action_plugin_run_check_fail(plugin, task_vars, monkeypatch):
    check_return_value = {'failed': True, 'msg': 'this is a failure'}
    check_class = fake_check(run_return=check_return_value)
    monkeypatch.setattr(plugin, 'load_known_checks', lambda *_: {'fake_check': check_class()})
    monkeypatch.setattr('openshift_health_check.resolve_checks', lambda *args: ['fake_check'])

    result = plugin.run(tmp=None, task_vars=task_vars)

    assert result['checks']['fake_check'] == check_return_value
    assert failed(result, msg_has=['failed'])
    assert not changed(result)
    assert not skipped(result)

@pytest.mark.parametrize('exc_class, expect_traceback', [
    (OpenShiftCheckException, False),
    (Exception, True),
])
def test_action_plugin_run_check_exception(plugin, task_vars, exc_class, expect_traceback, monkeypatch):
    exception_msg = 'fake check has an exception'
    run_exception = exc_class(exception_msg)
    check_class = fake_check(run_exception=run_exception, changed=True)
    monkeypatch.setattr(plugin, 'load_known_checks', lambda *_: {'fake_check': check_class()})
    monkeypatch.setattr('openshift_health_check.resolve_checks', lambda *args: ['fake_check'])

    result = plugin.run(tmp=None, task_vars=task_vars)

    assert failed(result['checks']['fake_check'], msg_has=exception_msg)
    assert expect_traceback == ("Traceback" in result['checks']['fake_check']['msg'])
    assert failed(result, msg_has=['failed'])
    assert changed(result['checks']['fake_check'])
    assert changed(result)
    assert not skipped(result)

def test_action_plugin_run_check_output_dir(plugin, task_vars, tmpdir, monkeypatch):
    check_class = fake_check(
        run_return={},
        run_logs=[('thing', 'note')],
        run_files=[
            FileToSave('save.file', 'contents', None),
            FileToSave('save.file', 'duplicate', None),
            FileToSave('copy.file', None, 'foo'),  # note: copy runs execute_module => exception
        ],
    )
    task_vars['openshift_checks_output_dir'] = str(tmpdir)
    check_class.get_var = lambda self, name, **_: task_vars.get(name)
    monkeypatch.setattr(plugin, 'load_known_checks', lambda *_: {'fake_check': check_class()})
    monkeypatch.setattr('openshift_health_check.resolve_checks', lambda *args: ['fake_check'])

    plugin.run(tmp=None, task_vars=task_vars)
    assert any(path.basename == task_vars['ansible_host'] for path in tmpdir.listdir())
    assert any(path.basename == 'fake_check.log.json' for path in tmpdir.visit())
    assert any(path.basename == 'save.file' for path in tmpdir.visit())
    assert any(path.basename == 'save.file.2' for path in tmpdir.visit())

def test_action_plugin_resolve_checks_exception(plugin, task_vars, monkeypatch):
    monkeypatch.setattr(plugin, 'load_known_checks', lambda *_: {})

    result = plugin.run(tmp=None, task_vars=task_vars)

    assert failed(result, msg_has=['unknown', 'name'])
    assert not changed(result)
    assert not skipped(result)

@pytest.mark.parametrize('names,all_checks,expected', [
    ([], [], set()),
    (
        ['a', 'b'],
        [
            fake_check('a'),
            fake_check('b'),
        ],
        set(['a', 'b']),
    ),
    (
        ['a', 'b', '@group'],
        [
            fake_check('from_group_1', ['group', 'another_group']),
            fake_check('not_in_group', ['another_group']),
            fake_check('from_group_2', ['preflight', 'group']),
            fake_check('a'),
            fake_check('b'),
        ],
        set(['a', 'b', 'from_group_1', 'from_group_2']),
    ),
])
def test_resolve_checks_ok(names, all_checks, expected):
    assert resolve_checks(names, all_checks) == expected

@pytest.mark.parametrize('names,all_checks,words_in_exception', [
    (
        ['testA', 'testB'],
        [],
        ['check', 'name', 'testA', 'testB'],
    ),
    (
        ['@group'],
        [],
        ['tag', 'name', 'group'],
    ),
    (
        ['testA', 'testB', '@group'],
        [],
        ['check', 'name', 'testA', 'testB', 'tag', 'group'],
    ),
    (
        ['testA', 'testB', '@group'],
        [
            fake_check('from_group_1', ['group', 'another_group']),
            fake_check('not_in_group', ['another_group']),
            fake_check('from_group_2', ['preflight', 'group']),
        ],
        ['check', 'name', 'testA', 'testB'],
    ),
])
def test_resolve_checks_failure(names, all_checks, words_in_exception):
    with pytest.raises(Exception) as excinfo:
        resolve_checks(names, all_checks)
    for word in words_in_exception:
        assert word in str(excinfo.value)

@pytest.mark.parametrize('give_output_dir, result, expect_file', [
    (False, None, False),
    (True, dict(content="c3BhbQo=", encoding="base64"), True),
    (True, dict(content="encoding error", encoding="base64"), False),
    (True, dict(content="spam", no_encoding=None), True),
    (True, dict(failed=True, msg="could not slurp"), False),
])
def test_copy_remote_file_to_dir(give_output_dir, result, expect_file, tmpdir):
    check = fake_check()()
    check.execute_module = lambda *args, **_: result
    copy_remote_file_to_dir(check, "remote_file", str(tmpdir) if give_output_dir else "", "local_file")
    assert expect_file == any(path.basename == "local_file" for path in tmpdir.listdir())

def test_write_to_output_exceptions(tmpdir, monkeypatch, capsys):

    class Spam(object):
        def __str__(self):
            raise Exception("break str")

    test = {1: object(), 2: Spam()}
    test[3] = test
    write_result_to_output_dir(str(tmpdir), test)
    assert "Error writing" in test["output_files"]

    output_dir = tmpdir.join("eggs")
    output_dir.write("spam")  # so now it's not a dir
    write_to_output_file(str(output_dir), "somefile", "somedata")
    assert "Could not write" in capsys.readouterr()[1]

    monkeypatch.setattr("openshift_health_check.prepare_output_dir", lambda *_: False)
    write_result_to_output_dir(str(tmpdir), test)
    assert "Error creating" in test["output_files"]


text:
#region Licence...

#endregion Licence...

using Microsoft.Win32;

namespace WixSharp
{
    /// <summary>
    /// Defines WiX custom property assigned by MSI runtime during the installation to the RegistrySearch result.
    /// <para>
    /// <see cref="RegValueProperty"/> is used to set a property from the registry value when accessing the registry is inconvenient for
    /// a custom action.
    ///
    /// <para><c>RegistrySearch</c> returns raw data thus data will always contain prefix indicating data type: </para>
    /// <para><c>DWORD:</c> Starts with '#' optionally followed by '+' or '-'.</para>
    /// <para><c>REG_BINARY:</c> Starts with '#x' and the installer converts and saves each hexadecimal digit (nibble) as an ASCII character prefixed by '#x'.</para>
    /// <para><c>REG_EXPAND_SZ:</c> Starts with '#%'.</para>
    /// <para><c>REG_MULTI_SZ:</c> Starts with '[~]' and ends with '[~]'.</para>
    /// <para><c>REG_SZ:</c> No prefix, but if the first character of the registry value is '#', the installer escapes the character by prefixing it with another '#'.</para>
    /// </para>
    /// </summary>
    /// <remarks>In Wix# the preferred way of setting a property value is assigning it from <see cref="T:WixSharp.ManagedAction"/>.
    /// However <see cref="T:WixSharp.ManagedAction"/> may not be an available option if the target system does not have .NET installed.
    /// In such cases <see cref="RegValueProperty"/> should be used.</remarks>
    ///<example>The following is an example of installing <c>DotNET Manual.txt</c> file only if .NET v2.0 is installed.
    ///<code>
    ///
    /// var project =
    ///         new Project("MyProduct",
    ///             new Dir(@"%ProgramMenu%\My Company\My Product",
    ///                 new File(@"Files\DotNET Manual.txt")
    ///                     {
    ///                         Condition = new Condition("NETFRAMEWORK20=\"#1\"")
    ///                     },
    ///     ...
    ///             new RegValueProperty("NETFRAMEWORK20",
    ///                                  RegistryHive.LocalMachine,
    ///                                  @"Software\Microsoft\NET Framework Setup\NDP\v2.0.50727",
    ///                                  "Install",
    ///                                  "not_defined"),
    ///
    ///
    /// </code>
    /// </example>
    public partial class RegValueProperty : Property
    {
        /// <summary>
        /// Initializes a new instance of the <see cref="RegValueProperty"/> class.
        /// </summary>
        public RegValueProperty()
        {
        }

        /// <summary>
        /// Initializes a new instance of the <see cref="RegValueProperty"/> class with properties/fields initialized with specified parameters.
        /// </summary>
        /// <param name="name">The name of the property.</param>
        /// <param name="root">The registry hive name.</param>
        /// <param name="key">The registry key name.</param>
        /// <param name="entryName">The registry entry name.</param>
        /// <param name="defaultValue">The registry entry default value.</param>
        public RegValueProperty(string name, RegistryHive root, string key, string entryName, string defaultValue = "")
        {
            Name = name;
            Root = root;
            EntryName = entryName;
            Key = key;
            Value = defaultValue;
        }

        /// <summary>
        /// Initializes a new instance of the <see cref="RegValueProperty"/> class with properties/fields initialized with specified parameters.
        /// </summary>
        /// <param name="id">The explicit <see cref="Id"></see> to be associated with <see cref="RegValueProperty"/> instance.</param>
        /// <param name="name">The name of the property.</param>
        /// <param name="root">The registry hive name.</param>
        /// <param name="key">The registry key name.</param>
        /// <param name="entryName">The registry entry name.</param>
        /// <param name="defaultValue">The registry entry default value.</param>
        public RegValueProperty(Id id, string name, RegistryHive root, string key, string entryName, string defaultValue = "")
        {
            Id = id.Value;
            Name = name;
            Root = root;
            EntryName = entryName;
            Key = key;
            Value = defaultValue;
        }

        /// <summary>
        /// The registry hive name.
        /// <para>Default value is <c>RegistryHive.CurrentUser</c></para>
        /// </summary>
        public RegistryHive Root = RegistryHive.CurrentUser;

        /// <summary>
        /// The registry key name.
        /// <para>Default value is <c>String.Empty</c></para>
        /// </summary>
        public string Key = "";

        /// <summary>
        /// The registry entry name.
        /// <para>Default value is <c>String.Empty</c></para>
        /// </summary>
        public string EntryName = "";

        /// <summary>
        /// Instructs the search to look in the 64-bit registry when the value is 'yes'.
        /// When the value is 'no', the search looks in the 32-bit registry.
        /// <para>
        /// This is how WiX defines defaults.
        /// </para>
        /// <para>
        /// The default value is based on the platform set by the -arch switch to candle.exe or the
        /// InstallerPlatform property in a .wixproj MSBuild project: For x86 and ARM, the default
        /// value is 'no'. For x64 and IA64, the default value is 'yes'.
        /// </para>
        /// <para>
        /// However this WiX approach creates non-intuitive behaver when the build outcome may depend on the
        /// architecture of the build machine.</para>
        /// <para>Thus WixSharp always uses consistent default value for this property: <c>false</c>.</para>
        /// </summary>
        public bool Win64
        {
            get => win64;
            set { win64 = value; win64_SetByUser = true; }
        }

        // cannot use bool? as (while WiX allows this) it's not acceptable to skip this argument. Skipping will lead to
        // non-intuitive defaults (see comments above). And yet it's important to know if the value was explicitly
        // set by the user so AutoElements assignments do not overwrite it.
        bool win64 = false;

        internal bool win64_SetByUser = false;
    }
}


text:
class SafeError extends Error {
  constructor(message, statusCode, headers) {
    super(message);

    this.headers = headers;
    this.statusCode = statusCode;
  }
}

module.exports = SafeError;


text:
layout: tag
tag_name: Design
title: Design
---


text:
{-# LANGUAGE PatternSynonyms, ForeignFunctionInterface, JavaScriptFFI #-}
module GHCJS.DOM.JSFFI.Generated.SVGCircleElement
       (js_getCx, getCx, js_getCy, getCy, js_getR, getR, SVGCircleElement,
        castToSVGCircleElement, gTypeSVGCircleElement)
       where
import Prelude ((.), (==), (>>=), return, IO, Int, Float, Double, Bool(..), Maybe, maybe, fromIntegral, round, fmap, Show, Read, Eq, Ord)
import Data.Typeable (Typeable)
import GHCJS.Types (JSVal(..), JSString)
import GHCJS.Foreign (jsNull)
import GHCJS.Foreign.Callback (syncCallback, asyncCallback, syncCallback1, asyncCallback1, syncCallback2, asyncCallback2, OnBlocked(..))
import GHCJS.Marshal (ToJSVal(..), FromJSVal(..))
import GHCJS.Marshal.Pure (PToJSVal(..), PFromJSVal(..))
import Control.Monad.IO.Class (MonadIO(..))
import Data.Int (Int64)
import Data.Word (Word, Word64)
import GHCJS.DOM.Types
import Control.Applicative ((<$>))
import GHCJS.DOM.EventTargetClosures (EventName, unsafeEventName)
import GHCJS.DOM.JSFFI.Generated.Enums

foreign import javascript unsafe "$1[\"cx\"]" js_getCx ::
        SVGCircleElement -> IO (Nullable SVGAnimatedLength)

-- | <https://developer.mozilla.org/en-US/docs/Web/API/SVGCircleElement.cx Mozilla SVGCircleElement.cx documentation>
getCx ::
      (MonadIO m) => SVGCircleElement -> m (Maybe SVGAnimatedLength)
getCx self = liftIO (nullableToMaybe <$> (js_getCx (self)))

foreign import javascript unsafe "$1[\"cy\"]" js_getCy ::
        SVGCircleElement -> IO (Nullable SVGAnimatedLength)

-- | <https://developer.mozilla.org/en-US/docs/Web/API/SVGCircleElement.cy Mozilla SVGCircleElement.cy documentation>
getCy ::
      (MonadIO m) => SVGCircleElement -> m (Maybe SVGAnimatedLength)
getCy self = liftIO (nullableToMaybe <$> (js_getCy (self)))

foreign import javascript unsafe "$1[\"r\"]" js_getR ::
        SVGCircleElement -> IO (Nullable SVGAnimatedLength)

-- | <https://developer.mozilla.org/en-US/docs/Web/API/SVGCircleElement.r Mozilla SVGCircleElement.r documentation>
getR ::
     (MonadIO m) => SVGCircleElement -> m (Maybe SVGAnimatedLength)
getR self = liftIO (nullableToMaybe <$> (js_getR (self)))


text:
var neo4j = require('neo4j-driver'),
    config = require('../config/db'),
    logger = require('../logger');

var driver = neo4j.driver("bolt://localhost", neo4j.auth.basic(config.username, config.password), {
    Logging: logger,
    connectionPoolSize: 50
});

module.exports = driver;


text:
package com.klarna.hiverunner;

import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.hive.serde.Constants;
import org.apache.hadoop.hive.serde2.AbstractSerDe;
import org.apache.hadoop.hive.serde2.SerDeException;
import org.apache.hadoop.hive.serde2.SerDeStats;
import org.apache.hadoop.hive.serde2.objectinspector.ObjectInspector;
import org.apache.hadoop.hive.serde2.objectinspector.ObjectInspectorFactory;
import org.apache.hadoop.hive.serde2.objectinspector.primitive.PrimitiveObjectInspectorFactory;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.io.Writable;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Properties;

public class ToUpperCaseSerDe extends AbstractSerDe {

    private List<String> columns;

    @Override
    public void initialize(Configuration configuration, Properties properties) throws SerDeException {
        columns = Arrays.asList(((String) properties.get(Constants.LIST_COLUMNS)).split(","));
    }

    @Override
    public Class<? extends Writable> getSerializedClass() {
        return Text.class;
    }

    @Override
    public Writable serialize(Object o, ObjectInspector objectInspector) throws SerDeException {
        throw new SerDeException("Not implemented in test fixture");
    }

    @Override
    public Object deserialize(Writable writable) throws SerDeException {
        String[] values = writable.toString().toUpperCase().split(",");
        return Arrays.asList(values);
    }

    @Override
    public ObjectInspector getObjectInspector() throws SerDeException {
        // Constructing the row ObjectInspector:
        // The row consists of some string columns, each column will be a java
        // String object.
        List<ObjectInspector> columnOIs = new ArrayList<ObjectInspector>(columns.size());

        for (int i = 0; i < columns.size(); i++) {
            columnOIs.add(PrimitiveObjectInspectorFactory.javaStringObjectInspector);
        }

        // Standard Struct uses ArrayList to store the row.
        return ObjectInspectorFactory.getStandardStructObjectInspector(columns, columnOIs);

    }

    @Override
    public SerDeStats getSerDeStats() {
        return null;
    }
}