text:
import { Param } from "../../core/context/Param";
import { ToneAudioNode, ToneAudioNodeOptions } from "../../core/context/ToneAudioNode";
import { Degrees, GainFactor } from "../../core/type/Units";
import { optionsFromArguments } from "../../core/util/Defaults";
import "../../core/context/Listener";

export interface Panner3DOptions extends ToneAudioNodeOptions {
	coneInnerAngle: Degrees;
	coneOuterAngle: Degrees;
	coneOuterGain: GainFactor;
	distanceModel: DistanceModelType;
	maxDistance: number;
	orientationX: number;
	orientationY: number;
	orientationZ: number;
	panningModel: PanningModelType;
	positionX: number;
	positionY: number;
	positionZ: number;
	refDistance: number;
	rolloffFactor: number;
}

/**
 * A spatialized panner node which supports equalpower or HRTF panning.
 * @category Component
 */
export class Panner3D extends ToneAudioNode<Panner3DOptions> {

	readonly name: string = "Panner3D";

	/**
	 * The panning object
	 */
	private _panner: PannerNode;
	readonly input: PannerNode;
	readonly output: PannerNode;

	readonly positionX: Param<"number">;
	readonly positionY: Param<"number">;
	readonly positionZ: Param<"number">;

	readonly orientationX: Param<"number">;
	readonly orientationY: Param<"number">;
	readonly orientationZ: Param<"number">;

	/**
	 * @param positionX The initial x position.
	 * @param positionY The initial y position.
	 * @param positionZ The initial z position.
	 */
	constructor(positionX: number, positionY: number, positionZ: number);
	constructor(options?: Partial<Panner3DOptions>);
	constructor() {

		super(optionsFromArguments(Panner3D.getDefaults(), arguments, ["positionX", "positionY", "positionZ"]));
		const options = optionsFromArguments(Panner3D.getDefaults(), arguments, ["positionX", "positionY", "positionZ"]);

		this._panner = this.input = this.output = this.context.createPanner();
		// set some values
		this.panningModel = options.panningModel;
		this.maxDistance = options.maxDistance;
		this.distanceModel = options.distanceModel;
		this.coneOuterGain = options.coneOuterGain;
		this.coneOuterAngle = options.coneOuterAngle;
		this.coneInnerAngle = options.coneInnerAngle;
		this.refDistance = options.refDistance;
		this.rolloffFactor = options.rolloffFactor;

		this.positionX = new Param({
			context: this.context,
			param: this._panner.positionX,
			value: options.positionX,
		});
		this.positionY = new Param({
			context: this.context,
			param: this._panner.positionY,
			value: options.positionY,
		});
		this.positionZ = new Param({
			context: this.context,
			param: this._panner.positionZ,
			value: options.positionZ,
		});
		this.orientationX = new Param({
			context: this.context,
			param: this._panner.orientationX,
			value: options.orientationX,
		});
		this.orientationY = new Param({
			context: this.context,
			param: this._panner.orientationY,
			value: options.orientationY,
		});
		this.orientationZ = new Param({
			context: this.context,
			param: this._panner.orientationZ,
			value: options.orientationZ,
		});
	}

	static getDefaults(): Panner3DOptions {
		return Object.assign(ToneAudioNode.getDefaults(), {
			coneInnerAngle: 360,
			coneOuterAngle: 360,
			coneOuterGain: 0,
			distanceModel: "inverse" as DistanceModelType,
			maxDistance: 10000,
			orientationX: 0,
			orientationY: 0,
			orientationZ: 0,
			panningModel: "equalpower" as PanningModelType,
			positionX: 0,
			positionY: 0,
			positionZ: 0,
			refDistance: 1,
			rolloffFactor: 1,
		});
	}

	/**
	 * Sets the position of the source in 3d space.
	 */
	setPosition(x: number, y: number, z: number): this {
		this.positionX.value = x;
		this.positionY.value = y;
		this.positionZ.value = z;
		return this;
	}

	/**
	 * Sets the orientation of the source in 3d space.
	 */
	setOrientation(x: number, y: number, z: number): this {
		this.orientationX.value = x;
		this.orientationY.value = y;
		this.orientationZ.value = z;
		return this;
	}

	/**
	 * The panning model. Either "equalpower" or "HRTF".
	 */
	get panningModel(): PanningModelType {
		return this._panner.panningModel;
	}
	set panningModel(val) {
		this._panner.panningModel = val;
	}

	/**
	 * A reference distance for reducing volume as source move further from the listener
	 */
	get refDistance(): number {
		return this._panner.refDistance;
	}
	set refDistance(val) {
		this._panner.refDistance = val;
	}

	/**
	 * Describes how quickly the volume is reduced as source moves away from listener.
	 */
	get rolloffFactor(): number {
		return this._panner.rolloffFactor;
	}
	set rolloffFactor(val) {
		this._panner.rolloffFactor = val;
	}

	/**
	 * The distance model used by,  "linear", "inverse", or "exponential".
	 */
	get distanceModel(): DistanceModelType {
		return this._panner.distanceModel;
	}
	set distanceModel(val) {
		this._panner.distanceModel = val;
	}

	/**
	 * The angle, in degrees, inside of which there will be no volume reduction
	 */
	get coneInnerAngle(): Degrees {
		return this._panner.coneInnerAngle;
	}
	set coneInnerAngle(val) {
		this._panner.coneInnerAngle = val;
	}

	/**
	 * The angle, in degrees, outside of which the volume will be reduced
	 * to a constant value of coneOuterGain
	 */
	get coneOuterAngle(): Degrees {
		return this._panner.coneOuterAngle;
	}
	set coneOuterAngle(val) {
		this._panner.coneOuterAngle = val;
	}

	/**
	 * The gain outside of the coneOuterAngle
	 */
	get coneOuterGain(): GainFactor {
		return this._panner.coneOuterGain;
	}
	set coneOuterGain(val) {
		this._panner.coneOuterGain = val;
	}

	/**
	 * The maximum distance between source and listener,
	 * after which the volume will not be reduced any further.
	 */
	get maxDistance(): number {
		return this._panner.maxDistance;
	}
	set maxDistance(val) {
		this._panner.maxDistance = val;
	}

	dispose(): this {
		super.dispose();
		this._panner.disconnect();
		this.orientationX.dispose();
		this.orientationY.dispose();
		this.orientationZ.dispose();
		this.positionX.dispose();
		this.positionY.dispose();
		this.positionZ.dispose();
		return this;
	}
}


text:
@interface PhotoSlider : UIView

- (void)updateView;

@end

redpajama_set_name: RedPajamaGithub


text:
module Azure::PolicyInsights::Mgmt::V2017_08_09_preview
  module Models
    #
    # Metadata about the query results.
    #
    class PolicyEventsQueryResultsTableMetadata

      include MsRestAzure

      # @return [String] Internal query generated. Used for diagnostics
      # purposes.
      attr_accessor :generated_query

      #
      # Mapper for PolicyEventsQueryResultsTableMetadata class as Ruby Hash.
      # This will be used for serialization/deserialization.
      #
      def self.mapper()
        {
          client_side_validation: true,
          required: false,
          serialized_name: 'PolicyEventsQueryResultsTable_metadata',
          type: {
            name: 'Composite',
            class_name: 'PolicyEventsQueryResultsTableMetadata',
            model_properties: {
              generated_query: {
                client_side_validation: true,
                required: false,
                serialized_name: 'generatedQuery',
                type: {
                  name: 'String'
                }
              }
            }
          }
        }
      end
    end
  end
end


text:
'use strict';

var updateGrammar = require('vscode-grammar-updater');

updateGrammar.update('jeff-hykin/cpp-textmate-grammar', 'syntaxes/c.tmLanguage.json', './syntaxes/c.tmLanguage.json', undefined, 'master', 'source/languages/cpp/');
updateGrammar.update('jeff-hykin/cpp-textmate-grammar', 'syntaxes/cpp.tmLanguage.json', './syntaxes/cpp.tmLanguage.json', undefined, 'master', 'source/languages/cpp/');
updateGrammar.update('jeff-hykin/cpp-textmate-grammar', 'syntaxes/cpp.embedded.macro.tmLanguage.json', './syntaxes/cpp.embedded.macro.tmLanguage.json', undefined, 'master', 'source/languages/cpp/');

updateGrammar.update('NVIDIA/cuda-cpp-grammar', 'syntaxes/cuda-cpp.tmLanguage.json', './syntaxes/cuda-cpp.tmLanguage.json', undefined, 'master');

// `source.c.platform` which is still included by other grammars
updateGrammar.update('textmate/c.tmbundle', 'Syntaxes/Platform.tmLanguage', './syntaxes/platform.tmLanguage.json');


text:
#ifndef __HTTPD_H__
#define __HTTPD_H__

#include "lwip/opt.h"
#include "lwip/err.h"
#include "lwip/pbuf.h"

/** Set this to 1 to support CGI */
#ifndef LWIP_HTTPD_CGI
#define LWIP_HTTPD_CGI            1
#endif

/** Set this to 1 to support SSI (Server-Side-Includes) */
#ifndef LWIP_HTTPD_SSI
#define LWIP_HTTPD_SSI            1
#endif

/** Set this to 1 to support HTTP POST */
#ifndef LWIP_HTTPD_SUPPORT_POST
#define LWIP_HTTPD_SUPPORT_POST   0
#endif

#if LWIP_HTTPD_CGI

/*
 * Function pointer for a CGI script handler.
 *
 * This function is called each time the HTTPD server is asked for a file
 * whose name was previously registered as a CGI function using a call to
 * http_set_cgi_handler. The iIndex parameter provides the index of the
 * CGI within the ppcURLs array passed to http_set_cgi_handler. Parameters
 * pcParam and pcValue provide access to the parameters provided along with
 * the URI. iNumParams provides a count of the entries in the pcParam and
 * pcValue arrays. Each entry in the pcParam array contains the name of a
 * parameter with the corresponding entry in the pcValue array containing the
 * value for that parameter. Note that pcParam may contain multiple elements
 * with the same name if, for example, a multi-selection list control is used
 * in the form generating the data.
 *
 * The function should return a pointer to a character string which is the
 * path and filename of the response that is to be sent to the connected
 * browser, for example "/thanks.htm" or "/response/error.ssi".
 *
 * The maximum number of parameters that will be passed to this function via
 * iNumParams is defined by LWIP_HTTPD_MAX_CGI_PARAMETERS. Any parameters in the incoming
 * HTTP request above this number will be discarded.
 *
 * Requests intended for use by this CGI mechanism must be sent using the GET
 * method (which encodes all parameters within the URI rather than in a block
 * later in the request). Attempts to use the POST method will result in the
 * request being ignored.
 *
 */
typedef const char *(*tCGIHandler)(int iIndex, int iNumParams, char *pcParam[],
                             char *pcValue[]);

/*
 * Structure defining the base filename (URL) of a CGI and the associated
 * function which is to be called when that URL is requested.
 */
typedef struct
{
    const char *pcCGIName;
    tCGIHandler pfnCGIHandler;
} tCGI;

void http_set_cgi_handlers(const tCGI *pCGIs, int iNumHandlers);

/* The maximum number of parameters that the CGI handler can be sent. */
#ifndef LWIP_HTTPD_MAX_CGI_PARAMETERS
#define LWIP_HTTPD_MAX_CGI_PARAMETERS 16
#endif

#endif /* LWIP_HTTPD_CGI */

#if LWIP_HTTPD_SSI

/** LWIP_HTTPD_SSI_MULTIPART==1: SSI handler function is called with 2 more
 * arguments indicating a counter for insert string that are too long to be
 * inserted at once: the SSI handler function must then set 'next_tag_part'
 * which will be passed back to it in the next call. */
#ifndef LWIP_HTTPD_SSI_MULTIPART
#define LWIP_HTTPD_SSI_MULTIPART    0
#endif

/*
 * Function pointer for the SSI tag handler callback.
 *
 * This function will be called each time the HTTPD server detects a tag of the
 * form <!--#name--> in a .shtml, .ssi or .shtm file where "name" appears as
 * one of the tags supplied to http_set_ssi_handler in the ppcTags array.  The
 * returned insert string, which will be appended after the the string
 * "<!--#name-->" in file sent back to the client,should be written to pointer
 * pcInsert.  iInsertLen contains the size of the buffer pointed to by
 * pcInsert.  The iIndex parameter provides the zero-based index of the tag as
 * found in the ppcTags array and identifies the tag that is to be processed.
 *
 * The handler returns the number of characters written to pcInsert excluding
 * any terminating NULL or a negative number to indicate a failure (tag not
 * recognized, for example).
 *
 * Note that the behavior of this SSI mechanism is somewhat different from the
 * "normal" SSI processing as found in, for example, the Apache web server.  In
 * this case, the inserted text is appended following the SSI tag rather than
 * replacing the tag entirely.  This allows for an implementation that does not
 * require significant additional buffering of output data yet which will still
 * offer usable SSI functionality.  One downside to this approach is when
 * attempting to use SSI within JavaScript.  The SSI tag is structured to
 * resemble an HTML comment but this syntax does not constitute a comment
 * within JavaScript and, hence, leaving the tag in place will result in
 * problems in these cases.  To work around this, any SSI tag which needs to
 * output JavaScript code must do so in an encapsulated way, sending the whole
 * HTML <script>...</script> section as a single include.
 */
typedef u16_t (*tSSIHandler)(int iIndex, char *pcInsert, int iInsertLen
#if LWIP_HTTPD_SSI_MULTIPART
                             , u16_t current_tag_part, u16_t *next_tag_part
#endif /* LWIP_HTTPD_SSI_MULTIPART */
#if LWIP_HTTPD_FILE_STATE
                             , void *connection_state
#endif /* LWIP_HTTPD_FILE_STATE */
                             );

void http_set_ssi_handler(tSSIHandler pfnSSIHandler,
                          const char **ppcTags, int iNumTags);

/* The maximum length of the string comprising the tag name */
#ifndef LWIP_HTTPD_MAX_TAG_NAME_LEN
#define LWIP_HTTPD_MAX_TAG_NAME_LEN 1
#endif

/* The maximum length of string that can be returned to replace any given tag */
#ifndef LWIP_HTTPD_MAX_TAG_INSERT_LEN
#define LWIP_HTTPD_MAX_TAG_INSERT_LEN 192
#endif

#endif /* LWIP_HTTPD_SSI */

#if LWIP_HTTPD_SUPPORT_POST

/* These functions must be implemented by the application */

/** Called when a POST request has been received. The application can decide
 * whether to accept it or not.
 *
 * @param connection Unique connection identifier, valid until httpd_post_end
 *        is called.
 * @param uri The HTTP header URI receiving the POST request.
 * @param http_request The raw HTTP request (the first packet, normally).
 * @param http_request_len Size of 'http_request'.
 * @param content_len Content-Length from HTTP header.
 * @param response_uri Filename of response file, to be filled when denying the
 *        request
 * @param response_uri_len Size of the 'response_uri' buffer.
 * @param post_auto_wnd Set this to 0 to let the callback code handle window
 *        updates by calling 'httpd_post_data_recved' (to throttle rx speed)
 *        default is 1 (httpd handles window updates automatically)
 * @return ERR_OK: Accept the POST request, data may be passed in
 *         another err_t: Deny the POST request, send back 'bad request'.
 */
err_t httpd_post_begin(void *connection, const char *uri, const char *http_request,
                       u16_t http_request_len, int content_len, char *response_uri,
                       u16_t response_uri_len, u8_t *post_auto_wnd);

/** Called for each pbuf of data that has been received for a POST.
 * ATTENTION: The application is responsible for freeing the pbufs passed in!
 *
 * @param connection Unique connection identifier.
 * @param p Received data.
 * @return ERR_OK: Data accepted.
 *         another err_t: Data denied, http_post_get_response_uri will be called.
 */
err_t httpd_post_receive_data(void *connection, struct pbuf *p);

/** Called when all data is received or when the connection is closed.
 * The application must return the filename/URI of a file to send in response
 * to this POST request. If the response_uri buffer is untouched, a 404
 * response is returned.
 *
 * @param connection Unique connection identifier.
 * @param response_uri Filename of response file, to be filled when denying the request
 * @param response_uri_len Size of the 'response_uri' buffer.
 */
void httpd_post_finished(void *connection, char *response_uri, u16_t response_uri_len);

#ifndef LWIP_HTTPD_POST_MANUAL_WND
#define LWIP_HTTPD_POST_MANUAL_WND  0
#endif

#if LWIP_HTTPD_POST_MANUAL_WND
void httpd_post_data_recved(void *connection, u16_t recved_len);
#endif /* LWIP_HTTPD_POST_MANUAL_WND */

#endif /* LWIP_HTTPD_SUPPORT_POST */

void httpd_init(void);

#endif /* __HTTPD_H__ */


text:
<!--

    Copyright (C) 2016 Geny Isam Hamud Herrera (geny.herrera@gmail.com)

    Licensed under the Apache License, Version 2.0 (the "License");
    you may not use this file except in compliance with the License.
    You may obtain a copy of the License at

            http://www.apache.org/licenses/LICENSE-2.0

    Unless required by applicable law or agreed to in writing, software
    distributed under the License is distributed on an "AS IS" BASIS,
    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    See the License for the specific language governing permissions and
    limitations under the License.

-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>com.genyherrera.performancelog</groupId>
  <artifactId>performance-log</artifactId>
  <version>1.2-SNAPSHOT</version>
  <name>Performance Log</name>
  <description>Annotation API for measuring performance (How log it takes for run)</description>
  <url>http://github.com/genyherrera/performance-log</url>
<inceptionYear>2016</inceptionYear>

  <properties>
		<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
		<spring.version>3.2.2.RELEASE</spring.version>
		<slf4j.version>1.6.1</slf4j.version>
		<aspectj.version>1.8.1</aspectj.version>
		<java.version>1.8</java.version>
  </properties>

  <licenses>
  		<license>
			<name>The Apache License, Version 2.0</name>
			<url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
		</license>
	</licenses>

	<developers>
		<developer>
			<name>Geny Isam Hamud Herrera</name>
			<email>geny.herrera@gmail.com</email>
			<organization>Self</organization>
			<organizationUrl>http://www.genyherrera.com</organizationUrl>
		</developer>
	</developers>

	<scm>
		<connection>scm:git:git@github.com:genyherrera/performance-log.git</connection>
		<developerConnection>scm:git:git@github.com:genyherrera/performance-log.git</developerConnection>
		<url>git@github.com:genyherrera/performance-log.git</url>
	</scm>

	<distributionManagement>
		<snapshotRepository>
			<id>ossrh</id>
			<name>Sonatype OSS</name>
			<url>https://oss.sonatype.org/content/repositories/snapshots</url>
		</snapshotRepository>
		<repository>
			<id>ossrh</id>
			<name>Nexus Release Repository</name>
			<url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
		</repository>
	</distributionManagement>

	<build>
		<plugins>
			<plugin>
				<groupId>org.sonatype.plugins</groupId>
				<artifactId>nexus-staging-maven-plugin</artifactId>
				<version>1.6.3</version>
				<extensions>true</extensions>
				<configuration>
					<serverId>ossrh</serverId>
					<nexusUrl>https://oss.sonatype.org/</nexusUrl>
					<autoReleaseAfterClose>true</autoReleaseAfterClose>
				</configuration>
			</plugin>
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-release-plugin</artifactId>
				<version>2.1</version>
				<configuration>
					<autoVersionSubmodules>true</autoVersionSubmodules>
					<mavenExecutorId>forked-path</mavenExecutorId>
					<useReleaseProfile>false</useReleaseProfile>
					<releaseProfiles>sonatype-oss-release</releaseProfiles>
					<goals>deploy</goals>
					<arguments>-Psonatype-oss-release</arguments>
					<checkModificationExcludes>
			            <checkModificationExclude>pom.xml</checkModificationExclude>
			        </checkModificationExcludes>
				</configuration>
			</plugin>
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-compiler-plugin</artifactId>
				<version>3.0</version>
				<configuration>
					<source>${java.version}</source>
					<target>${java.version}</target>
					<encoding>${project.build.sourceEncoding}</encoding>
				</configuration>
			</plugin>
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-resources-plugin</artifactId>
				<version>2.4.3</version>
				<configuration>
					<encoding>${project.build.sourceEncoding}</encoding>
				</configuration>
			</plugin>
			<plugin>
				<groupId>com.mycila</groupId>
				<artifactId>license-maven-plugin</artifactId>
				<version>2.6</version>
				<configuration>
					<header>com/mycila/maven/plugin/license/templates/APACHE-2.txt</header>
					<properties>
						<owner>Geny Isam Hamud Herrera</owner>
						<email>geny.herrera@gmail.com</email>
					</properties>
					<excludes>
						<exclude>src/test/resources/**</exclude>
						<exclude>src/main/resources/**</exclude>
						<exclude>**README.MD</exclude>
						<exclude>**LICENSE**</exclude>
					</excludes>
				</configuration>
				<executions>
					<execution>
						<goals>
							<goal>check</goal>
						</goals>
					</execution>
				</executions>
			</plugin>
			<plugin>
				<groupId>org.codehaus.mojo</groupId>
				<artifactId>aspectj-maven-plugin</artifactId>
				<version>1.7</version>
				<dependencies>
					<dependency>
						<groupId>org.aspectj</groupId>
						<artifactId>aspectjrt</artifactId>
						<version>${aspectj.version}</version>
					</dependency>
					<dependency>
						<groupId>org.aspectj</groupId>
						<artifactId>aspectjtools</artifactId>
						<version>${aspectj.version}</version>
					</dependency>
				</dependencies>
				<executions>
					<execution>
						<goals>
							<goal>compile</goal>
							<goal>test-compile</goal>
						</goals>
					</execution>
				</executions>
				<configuration>
					<outxml>true</outxml>
					<aspectLibraries>
						<aspectLibrary>
							<groupId>org.springframework</groupId>
							<artifactId>spring-aspects</artifactId>
						</aspectLibrary>
					</aspectLibraries>
					<complianceLevel>${java.version}</complianceLevel>
					<source>${java.version}</source>
					<target>${java.version}</target>
				</configuration>
			</plugin>
		</plugins>
		<pluginManagement>
			<plugins>
				<plugin>
					<groupId>org.apache.maven.plugins</groupId>
					<artifactId>maven-surefire-plugin</artifactId>
					<version>2.4.3</version>
				</plugin>
			</plugins>
		</pluginManagement>
	</build>

	<dependencies>
		<dependency>
			<groupId>log4j</groupId>
			<artifactId>log4j</artifactId>
			<version>1.2.16</version>
		</dependency>
		<dependency>
			<groupId>junit</groupId>
			<artifactId>junit</artifactId>
			<version>4.12</version>
			<scope>test</scope>
		</dependency>
		<dependency>
			<groupId>org.slf4j</groupId>
			<artifactId>slf4j-api</artifactId>
			<version>${slf4j.version}</version>
		</dependency>
		<dependency>
			<groupId>org.slf4j</groupId>
			<artifactId>jcl-over-slf4j</artifactId>
			<version>${slf4j.version}</version>
		</dependency>
		<dependency>
			<groupId>org.slf4j</groupId>
			<artifactId>slf4j-log4j12</artifactId>
			<version>${slf4j.version}</version>
		</dependency>
		<!-- Spring dependencies -->
		<dependency>
			<groupId>org.springframework</groupId>
			<artifactId>spring-core</artifactId>
			<version>${spring.version}</version>
			<exclusions>
				<exclusion>
					<groupId>commons-logging</groupId>
					<artifactId>commons-logging</artifactId>
				</exclusion>
			</exclusions>
		</dependency>
		<dependency>
			<groupId>org.springframework</groupId>
			<artifactId>spring-test</artifactId>
			<version>${spring.version}</version>
			<scope>test</scope>
			<exclusions>
				<exclusion>
					<groupId>commons-logging</groupId>
					<artifactId>commons-logging</artifactId>
				</exclusion>
			</exclusions>
		</dependency>
		<dependency>
			<groupId>org.springframework</groupId>
			<artifactId>spring-context</artifactId>
			<version>${spring.version}</version>
		</dependency>
		<dependency>
			<groupId>org.springframework</groupId>
			<artifactId>spring-aop</artifactId>
			<version>${spring.version}</version>
		</dependency>
		<dependency>
			<groupId>org.springframework</groupId>
			<artifactId>spring-aspects</artifactId>
			<version>${spring.version}</version>
		</dependency>
		<dependency>
			<groupId>org.springframework</groupId>
			<artifactId>spring-tx</artifactId>
			<version>${spring.version}</version>
		</dependency>
		<dependency>
			<groupId>com.h2database</groupId>
			<artifactId>h2</artifactId>
			<version>1.2.144</version>
		</dependency>
        <dependency>
            <groupId>org.hibernate</groupId>
            <artifactId>hibernate-core</artifactId>
            <version>3.5.5-Final</version>
        </dependency>
        <dependency>
            <groupId>org.hibernate</groupId>
            <artifactId>hibernate-entitymanager</artifactId>
            <version>3.5.5-Final</version>
            <exclusions>
                <exclusion>
                    <groupId>cglib</groupId>
                    <artifactId>cglib</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>dom4j</groupId>
                    <artifactId>dom4j</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>org.hibernate.javax.persistence</groupId>
            <artifactId>hibernate-jpa-2.0-api</artifactId>
            <version>1.0.0.Final</version>
        </dependency>
        <dependency>
            <groupId>org.hibernate</groupId>
            <artifactId>hibernate-validator</artifactId>
            <version>4.1.0.Final</version>
            <exclusions>
                <exclusion>
                    <groupId>javax.xml.bind</groupId>
                    <artifactId>jaxb-api</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>com.sun.xml.bind</groupId>
                    <artifactId>jaxb-impl</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
		<dependency>
			<groupId>javax.validation</groupId>
			<artifactId>validation-api</artifactId>
			<version>1.0.0.GA</version>
		</dependency>
		<dependency>
			<groupId>org.aspectj</groupId>
			<artifactId>aspectjrt</artifactId>
			<version>${aspectj.version}</version>
		</dependency>
		<dependency>
			<groupId>org.aspectj</groupId>
			<artifactId>aspectjweaver</artifactId>
			<version>${aspectj.version}</version>
		</dependency>
	</dependencies>

	<profiles>
		<profile>
			<id>sonatype-oss-release</id>
			<build>
				<plugins>
					<plugin>
						<groupId>org.apache.maven.plugins</groupId>
						<artifactId>maven-source-plugin</artifactId>
						<version>2.1.2</version>
						<executions>
							<execution>
								<id>attach-sources</id>
								<goals>
									<goal>jar-no-fork</goal>
								</goals>
							</execution>
						</executions>
					</plugin>
					<plugin>
						<groupId>org.apache.maven.plugins</groupId>
				       <artifactId>maven-javadoc-plugin</artifactId>
				       <version>2.9.1</version>
				       <executions>
				         <execution>
				           <id>attach-javadocs</id>
				           <goals>
				             <goal>jar</goal>
				           </goals>
				           <configuration>
			                <additionalparam>-Xdoclint:none</additionalparam>
			               </configuration>
				         </execution>
				       </executions>
					 </plugin>
					 <plugin>
						<groupId>org.apache.maven.plugins</groupId>
						<artifactId>maven-gpg-plugin</artifactId>
						<version>1.5</version>
						<executions>
							<execution>
								<id>sign-artifacts</id>
								<phase>verify</phase>
								<goals>
									<goal>sign</goal>
								</goals>
							</execution>
						</executions>
					</plugin>
				</plugins>
			</build>
		</profile>
	</profiles>
</project>


text:
% mQuant = getNoiseMatrix(obj, pos, par)
%   mQuant is (Nrf * Nout) x Nnoise
%
% returns a matrix of noise vectors which correspond to
% the quantum noises which enter the Optickle system.
%
% The BeamSplitter is a combination of 2 mirrors, so it has
% up to 14 internal loss points.  See @Mirror/getNoiseMatrix.

function mQuant = getNoiseMatrix(obj, pos, par)

  pos = pos + obj.Optic.pos;		% mirror position, with offset
  phi = -2 * (2 * pi / par.lambda) * pos * cos(pi * obj.aoi / 180);

  % get noise powers
  mNPa = getNoiseAmp(obj.Thr, obj.Lhr, obj.Rar, obj.Lmd, phi, ...
    obj.Optic.in(1:2), par.minQuant);
  mNPb = getNoiseAmp(obj.Thr, obj.Lhr, obj.Rar, obj.Lmd, phi, ...
    obj.Optic.in(3:4), par.minQuant);
  mNP = blkdiag(mNPa, mNPb);

  % convert to noise amplitudes for all RF components
  mNA = blkdiagN(mNP, par.Nrf);

  % these noises are unsqueezed, so make amplitude and phase
  mQuant = [mNA, i * mNA];


text:
module HotelReservation
  class Hotel
    private_class_method :new
    attr_accessor :rates_policy

    def self.build(namer, ratinger)
      new(namer, ratinger)
    end

    def initialize(namer, ratinger)
      @namer = namer
      @ratinger = ratinger
    end

    def name
      @namer.name
    end

    def name=(v)
      @namer.name = v
    end

    def rating
      @ratinger.rating
    end

    def rating=(v)
      @ratinger.rating = v
    end
  end
end


text:
package com.restfb.types;

import static org.junit.jupiter.api.Assertions.assertNotNull;

import org.junit.jupiter.api.Test;

import com.restfb.AbstractJsonMapperTests;

class LikesTest extends AbstractJsonMapperTests {

  @Test
  void checkLikesObject() {
    Likes likes = createJsonMapper().toJavaObject(jsonFromClasspath("v2_5/likes"), Likes.class);
    assertNotNull(likes);
  }
}


text:
import logging
import pyclamd
from laikaboss.util import get_option
from laikaboss.si_module import SI_MODULE

class SCAN_CLAMAV(SI_MODULE):
    '''
    Laika module for scanning with the ClamAV Daemon
    '''
    def __init__(self,):
        self.module_name = "SCAN_CLAMAV"
        self.flag_prefix = "clam"

    def _run(self, scanObject, result, depth, args):
        '''
        Arguments:
        unix_socket     -- Path to the clamd unix socket (str)
        max_bytes       -- Maximum number of bytes to scan (0 is unlimited) (int)
        timeout         -- Max number of seconds to scan (float)

        Returns:
        Flags           -- Virus name hits
        Metadata        -- Unix socket or daemon errors
        '''
        moduleResult = []

        # Defualt max of 20 MB
        default_max_bytes = 20000000
        # Default timeout of 10.0 seconds
        default_timeout = 10.0
        # Default clamd unix socket
        default_unix_socket = '/var/run/clamav/clamd.sock'

        unix_socket = str(get_option(args, 'unixsocket', 'scanclamavunixsocket', default_unix_socket))
        max_bytes = int(get_option(args, 'maxbytes', 'scanclamavmaxbytes', default_max_bytes))
        timeout = float(get_option(args, 'timeout', 'scanclamavtimeout', default_timeout))

        if timeout < 0.01:
            timeout = default_timeout

        # Connect to daemon
        try:
            clam = pyclamd.ClamdUnixSocket(filename=unix_socket, timeout=timeout)
        except IOError:
            logging.debug('IOError: Cannot connect to clamd unix socket file')
            scanObject.addMetadata(self.module_name, 'Error', 'IOError: clamd socket')
            return moduleResult

        errmsg = None
        try:
            # Scan the buffer with clamav
            if max_bytes <= 0:
                clam_result = clam.scan_stream(scanObject.buffer)
            else:
                clam_result = clam.scan_stream(str(buffer(scanObject.buffer, 0, max_bytes)))

            # Process a result
            if clam_result:
                status, virusname = clam_result['stream']
                scanObject.addFlag("%s:%s" % (self.flag_prefix, str(virusname)))
        except ValueError as e:
            errmsg = "ValueError (BufferTooLong): %s" % e
        except IOError as e:
            errmsg = "IOError (ScanError): %s" % e
        except Exception as e:
            errmsg = "Unexpected error: %s" % e

        if errmsg:
            logging.debug(errmsg)
            scanObject.addMetadata(self.module_name, 'Error', errmsg)

        return moduleResult


text:
package com.glassdoor.planout4j.planout.ops.utils;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;

import org.apache.commons.lang3.StringUtils;
import com.google.common.base.Strings;
import com.google.common.collect.ImmutableMap;

import com.glassdoor.planout4j.planout.ops.base.PlanOutOp;
import com.glassdoor.planout4j.planout.ops.core.*;
import com.glassdoor.planout4j.planout.ops.random.*;
import com.glassdoor.planout4j.util.Helper;

import static com.google.common.base.Preconditions.*;
import static java.lang.String.format;

/**
 * All supported operators mapped to the {@link com.glassdoor.planout4j.planout.ops.base.PlanOutOp} descendant classes.
 * Also various util methods.
 */
public class Operators {

    /** maps operator string representation to implementing class */
    public static final Map<String, Class<? extends PlanOutOp>> operators;
    static {
        operators = new ImmutableMap.Builder<String, Class<? extends PlanOutOp>>()
                .put("literal", Literal.class)
                .put("get", Get.class)
                .put("seq", Seq.class)
                .put("set", Set.class)
                .put("return", Return.class)
                .put("index", Index.class)
                .put("array", Array.class)
                .put("equals", Equals.class)
                .put("cond", Cond.class)
                .put("and", And.class)
                .put("or", Or.class)
                .put(">", GreaterThan.class)
                .put("<", LessThan.class)
                .put(">=", GreaterThanOrEqualTo.class)
                .put("<=", LessThanOrEqualTo.class)
                .put("%", Mod.class)
                .put("/", Divide.class)
                .put("not", Not.class)
                .put("round", Round.class)
                .put("negative", Negative.class)
                .put("min", Min.class)
                .put("max", Max.class)
                .put("length", Length.class)
                .put("coalesce", Coalesce.class)
                .put("product", Product.class)
                .put("sum", Sum.class)
                .put("randomFloat", RandomFloat.class)
                .put("randomInteger", RandomInteger.class)
                .put("bernoulliTrial", BernoulliTrial.class)
                .put("bernoulliFilter", BernoulliFilter.class)
                .put("uniformChoice", UniformChoice.class)
                .put("weightedChoice", WeightedChoice.class)
                .put("sample", Sample.class)
                .build();
    }

    public static boolean isOperator(final Object op) {
        return op instanceof Map && ((Map)op).containsKey("op");
    }

    public static PlanOutOp operatorInstance(final Object params) {
        final String op = op(params);
        final Class<? extends PlanOutOp> implClass = operators.get(op);
        checkState(implClass != null, "Unknown operator: %s", op);
        try {
            return implClass.getConstructor(Map.class).newInstance(params);
        } catch (Exception e) {
            throw new RuntimeException(format("Failed to instantiate %s", implClass), e);
        }
    }

    public static String prettyParamFormat(final Map<String, Object> params) {
        final List<String> ps = new ArrayList<>();
        for (Entry<String, Object> entry : params.entrySet()) {
            if (!"op".equals(entry.getKey())) {
                ps.add(format("%s=%s", entry.getKey(), pretty(entry.getValue())));
            }
        }
        return StringUtils.join(ps, ", ");
    }

    public static String pretty(final Object params) {
        if (isOperator(params)) {
            try {
                return operatorInstance(params).pretty();
            } catch (Exception e) {
                return params.toString();
            }
        } else if (params instanceof List) {
            return format("[%s]", join((List)params));
        } else {
            return params.toString();
        }
    }

    public static Object stripArray(final Object params) {
        if (params instanceof List) {
            return params;
        } else if (isOperator(params) && "array".equals(op(params))) {
            return get(params, "values");
        } else {
            return params;
        }
    }

    private static String op(final Object params) {
        checkState(isOperator(params));
        return String.valueOf(get(params, "op"));
    }

    public static Object get(final Object params, final String name) {
        return ((Map)params).get(name);
    }

    public static void set(final Object params, final String name, final Object value) {
        final Map<String, Object> map = Helper.cast(params);
        map.put(name, value);
    }

    /**
     * Pretty-format all items of the list and combine into single string.
     * @param params List of items
     * @param sep separator string
     * @return String joined pretty representations of all params
     */
    public static String join(final List params, final String sep) {
        final List<String> list = new ArrayList<>();
        for (Object value : params) {
            list.add(pretty(value));
        }
        return StringUtils.join(list, sep);
    }

    /**
     * Pretty-format all items of the list and combine into single string.
     * @param params List of items
     * @return String joined pretty representations of all params
     */
    public static String join(final List params) {
        return join(params, ", ");
    }

    public static String indent(final String s, final int n) {
        final List<String> l = new ArrayList<>();
        for (String i : s.split("\n")) {
            l.add(Strings.repeat("  ", n) + i);
        }
        return StringUtils.join(l, '\n');
    }

    private Operators() {}

}


text:
package org.drools.compiler.phreak;

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

import org.drools.core.common.InternalFactHandle;
import org.drools.core.common.InternalWorkingMemory;
import org.drools.core.common.PhreakPropagationContext;
import org.drools.core.reteoo.BetaMemory;
import org.drools.core.reteoo.BetaNode;
import org.drools.core.reteoo.RightTuple;
import org.drools.core.reteoo.RightTupleMemory;
import org.drools.core.reteoo.SegmentMemory;

import static org.junit.Assert.fail;

public class RightMemory {

    private Scenario scenario;

    public RightMemory(Scenario scenario, Object... objects) {
        this.scenario = scenario;
        scenario.getRightMemory().addAll( getRightTuples( objects ) );
    }

    public List<RightTuple> getRightTuples(Object... objects) {
        BetaNode node = scenario.getBetaNode();
        BetaMemory bm = scenario.getBm();
        RightTupleMemory rtm = bm.getRightTupleMemory();
        InternalWorkingMemory wm = scenario.getWorkingMemory();

        if ( objects == null ) {
            objects = new Object[0];
        }

        List<RightTuple> rightTuples = new ArrayList<RightTuple>();
        for ( Object object : objects ) {
            InternalFactHandle fh = (InternalFactHandle) wm.insert( object );
            RightTuple expectedRightTuple = new RightTuple( fh, node ); //node.createLeftTuple( fh, node, true );
            expectedRightTuple.setPropagationContext( new PhreakPropagationContext() );
            rightTuples.add( expectedRightTuple );
        }

        scenario.setTestRightMemory( true );

        return rightTuples;
    }

    public StagedBuilder result() {
        StagedBuilder stagedBuilder = new StagedBuilder( scenario, null );
        scenario.setExpectedResultBuilder( stagedBuilder );
        return stagedBuilder;
    }

    public StagedBuilder preStaged(SegmentMemory sm) {
        StagedBuilder stagedBuilder = new StagedBuilder( scenario, sm );
        scenario.addPreStagedBuilder( stagedBuilder );
        return stagedBuilder;
    }

    public StagedBuilder postStaged(SegmentMemory sm) {
        StagedBuilder stagedBuilder = new StagedBuilder( scenario, sm );
        scenario.addPostStagedBuilder( stagedBuilder );
        return stagedBuilder;
    }

    public Scenario run() {
        return this.scenario.run();
    }

}


text:
The documentation is designed for a specific purpose to help you to apply the features on your side. What is ByteScout Premium Suite? It is the set that includes 12 SDK products from ByteScout including tools and components for PDF, barcodes, spreadsheets, screen video recording. It can help you to read from live camera with barcode reader sdk in your ASP.NET MVC C# application.

The SDK samples given below describe how to quickly make your application do read from live camera with barcode reader sdk in ASP.NET MVC C# with the help of ByteScout Premium Suite. This ASP.NET MVC C# sample code is all you need for your app. Just copy and paste the code, add references (if needs to) and you are all set! Enjoy writing a code with ready-to-use sample ASP.NET MVC C# codes.

ByteScout provides the free trial version of ByteScout Premium Suite along with the documentation and source code samples.

## REQUEST FREE TECH SUPPORT

[Click here to get in touch](https://bytescout.zendesk.com/hc/en-us/requests/new?subject=ByteScout%20Premium%20Suite%20Question)

or just send email to [support@bytescout.com](mailto:support@bytescout.com?subject=ByteScout%20Premium%20Suite%20Question)

## ON-PREMISE OFFLINE SDK

[Get Your 60 Day Free Trial](https://bytescout.com/download/web-installer?utm_source=github-readme)
[Explore SDK Docs](https://bytescout.com/documentation/index.html?utm_source=github-readme)
[Sign Up For Online Training](https://academy.bytescout.com/)

## ON-DEMAND REST WEB API

[Get your API key](https://pdf.co/documentation/api?utm_source=github-readme)
[Explore Web API Documentation](https://pdf.co/documentation/api?utm_source=github-readme)
[Explore Web API Samples](https://github.com/bytescout/ByteScout-SDK-SourceCode/tree/master/PDF.co%20Web%20API)

## VIDEO REVIEW

[https://www.youtube.com/watch?v=NEwNs2b9YN8](https://www.youtube.com/watch?v=NEwNs2b9YN8)

<!-- code block begin -->

##### ****!!!ReadmeFIRST.txt:**

```
This sample supports all browsers by using 2 modes:

(required mode is automatically detected by the javascript)
- HTML5 based web camera capture (supported by Google Chrome, Firefox, Safari, Safari on iOS browsers)
- Flash based web camera capture (supported by Internet Explorer 9+ and any browser with flash support)

IMPORTANT about HTML5 webcamera support (Chrome, Firefox, Safari on desktop and iOS): it is required to run your website (even test website) via SSL connection. Otherwise, web camera won't initialize at all as it requies SSL connection.

Visual Studio 2008/2010 or higher is required for this sample to run!

1) Install evaluation copy of BarCode Reader SDK from www.bytescout.com
2) in Visual Studio use File - Open - Web-Site.. and open the folder with this sample
3) Add a reference to ByteScout BarCode Reader dll using the menu: Website - Add Reference (find Bytescout Barcode Reader SDK on .NET tab, select and click OK to add a reference)
4) Right-click on "Default.aspx" file and select "Set As Start Page"
5) Run the project in debug mode
6) Visual Studio will run your project in Internet Explorer or another browser
If it run Internet Explorer then better copy the link from the IE and copy-and-paste to another browser with HTML5 web cam support like Google Chrome, Firefox or Safari
7) When browser asks for permission to access web-cam click "Allow" to allow access to web cam
8) click "START BARCODE SCAN.." button so the page will start automatically to grab frames from video and sending it to server-side code to read barcodes using Barcode Reader SDK
9) IMPORTANT: barcode should be in focus. Some webcams are not focusing on small barcodes, you may need to adjust the focus on your webcam so it will work OK with small images like barcodes

10) Click Stop to stop barcode scanning
Select barcode type to scan if need to scan a particular barcode type (by default scans for all known types)

TESTING:
- we recommend to use the Conveyor plugin to test your web app from local net or public url: https://marketplace.visualstudio.com/items?itemName=vs-publisher-1448185.ConveyorbyKeyoti

```

<!-- code block end -->

<!-- code block begin -->

##### ****BarcodeReader.sln:**

```

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 14
VisualStudioVersion = 14.0.25420.1
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "app", "app\BarcodeReader.csproj", "{A6EE57E5-62C7-4567-9BC0-E573686BF043}"
EndProject
Global
	GlobalSection(SolutionConfigurationPlatforms) = preSolution
		Debug|Any CPU = Debug|Any CPU
		Release|Any CPU = Release|Any CPU
	EndGlobalSection
	GlobalSection(ProjectConfigurationPlatforms) = postSolution
		{A6EE57E5-62C7-4567-9BC0-E573686BF043}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
		{A6EE57E5-62C7-4567-9BC0-E573686BF043}.Debug|Any CPU.Build.0 = Debug|Any CPU
		{A6EE57E5-62C7-4567-9BC0-E573686BF043}.Release|Any CPU.ActiveCfg = Release|Any CPU
		{A6EE57E5-62C7-4567-9BC0-E573686BF043}.Release|Any CPU.Build.0 = Release|Any CPU
	EndGlobalSection
	GlobalSection(SolutionProperties) = preSolution
		HideSolutionNode = FALSE
	EndGlobalSection
EndGlobal

```

<!-- code block end -->


text:
package org.hibernate.metamodel.source.annotations.attribute;

import org.jboss.jandex.AnnotationInstance;

import org.hibernate.AssertionFailure;
import org.hibernate.internal.util.StringHelper;
import org.hibernate.metamodel.source.annotations.JPADotNames;
import org.hibernate.metamodel.source.annotations.JandexHelper;

/**
 * Contains the information about a single {@link javax.persistence.AttributeOverride}. Instances of this class
 * are creating during annotation processing and then applied onto the persistence attributes.
 *
 * @author Hardy Ferentschik
 * @todo Take care of prefixes of the form 'element', 'key' and 'value'. Add another type enum to handle this. (HF)
 */
public class AttributeOverride {
	private static final String PROPERTY_PATH_SEPARATOR = ".";
	private final ColumnValues columnValues;
	private final String attributePath;

	public AttributeOverride(AnnotationInstance attributeOverrideAnnotation) {
		this( null, attributeOverrideAnnotation );
	}

	public AttributeOverride(String prefix, AnnotationInstance attributeOverrideAnnotation) {
		if ( attributeOverrideAnnotation == null ) {
			throw new IllegalArgumentException( "An AnnotationInstance needs to be passed" );
		}

		if ( !JPADotNames.ATTRIBUTE_OVERRIDE.equals( attributeOverrideAnnotation.name() ) ) {
			throw new AssertionFailure( "A @AttributeOverride annotation needs to be passed to the constructor" );
		}

		columnValues = new ColumnValues(
				JandexHelper.getValue(
						attributeOverrideAnnotation,
						"column",
						AnnotationInstance.class
				)
		);
		attributePath = createAttributePath(
				prefix,
				JandexHelper.getValue( attributeOverrideAnnotation, "name", String.class )
		);
	}

	public ColumnValues getColumnValues() {
		return columnValues;
	}

	public String getAttributePath() {
		return attributePath;
	}

	@Override
	public String toString() {
		final StringBuilder sb = new StringBuilder();
		sb.append( "AttributeOverride" );
		sb.append( "{columnValues=" ).append( columnValues );
		sb.append( ", attributePath='" ).append( attributePath ).append( '\'' );
		sb.append( '}' );
		return sb.toString();
	}

	@Override
	public boolean equals(Object o) {
		if ( this == o ) {
			return true;
		}
		if ( o == null || getClass() != o.getClass() ) {
			return false;
		}

		AttributeOverride that = (AttributeOverride) o;

		if ( attributePath != null ? !attributePath.equals( that.attributePath ) : that.attributePath != null ) {
			return false;
		}
		if ( columnValues != null ? !columnValues.equals( that.columnValues ) : that.columnValues != null ) {
			return false;
		}

		return true;
	}

	@Override
	public int hashCode() {
		int result = columnValues != null ? columnValues.hashCode() : 0;
		result = 31 * result + ( attributePath != null ? attributePath.hashCode() : 0 );
		return result;
	}

	private String createAttributePath(String prefix, String name) {
		String path = "";
		if ( StringHelper.isNotEmpty( prefix ) ) {
			path += prefix;
		}
		if ( StringHelper.isNotEmpty( path ) && !path.endsWith( PROPERTY_PATH_SEPARATOR ) ) {
			path += PROPERTY_PATH_SEPARATOR;
		}
		path += name;
		return path;
	}
}


text:
define( [
    'osg/Utils',
    'osg/Vec3',
    'osg/Node',
    'osg/BoundingBox'
], function ( MACROUTILS, Vec3, Node, BoundingBox ) {

    'use strict';

    /**
     * Geometry manage array and primitives to draw a geometry.
     * @class Geometry
     */
    var Geometry = function () {
        Node.call( this );
        this.primitives = [];
        this.attributes = {};
        this._boundingBox = new BoundingBox();
        this._boundingBoxComputed = false;
        this.cacheAttributeList = {};
        this._shape = null;
    };

    /** @lends Geometry.prototype */
    Geometry.prototype = MACROUTILS.objectLibraryClass( MACROUTILS.objectInherit( Node.prototype, {
        releaseGLObjects: function () {
            if ( this.stateset !== undefined ) this.stateset.releaseGLObjects();
            var keys = Object.keys( this.attributes );
            var value;
            for ( var i = 0, l = keys.length; i < l; i++ ) {
                value = this.attributes[ keys[ i ] ];
                value.releaseGLObjects();
            }
            for ( var j = 0, h = this.primitives.length; j < h; j++ ) {
                var prim = this.primitives[ j ];
                if ( prim.getIndices !== undefined ) {
                    if ( prim.getIndices() !== undefined && prim.getIndices() !== null ) {
                        prim.indices.releaseGLObjects();
                    }
                }
            }
        },
        dirtyBound: function () {
            if ( this._boundingBoxComputed === true ) {
                this._boundingBoxComputed = false;
            }
            Node.prototype.dirtyBound.call( this );
        },

        dirty: function () {
            this.cacheAttributeList = {};
        },
        getPrimitives: function () {
            return this.primitives;
        },
        getAttributes: function () {
            return this.attributes;
        },
        getShape: function () {
            return this._shape;
        },
        setShape: function ( shape ) {
            this._shape = shape;
        },
        getVertexAttributeList: function () {
            return this.attributes;
        },
        getPrimitiveSetList: function () {
            return this.primitives;
        },

        drawImplementation: function ( state ) {
            var program = state.getLastProgramApplied();
            var prgID = program.getInstanceID();
            if ( this.cacheAttributeList[ prgID ] === undefined ) {
                var attribute;

                var attributesCacheKeys = program._attributesCache.getKeys();
                var attributesCacheMap = program._attributesCache;

                var generated = '//generated by Geometry::implementation\n';
                generated += 'state.lazyDisablingOfVertexAttributes();\n';
                generated += 'var attr;\n';

                for ( var i = 0, l = attributesCacheKeys.length; i < l; i++ ) {
                    var key = attributesCacheKeys[ i ];
                    attribute = attributesCacheMap[ key ];
                    var attr = this.attributes[ key ];
                    if ( attr === undefined ) {
                        continue;
                    }

                    // dont display the geometry if missing data
                    generated += 'attr = this.attributes[\'' + key + '\'];\n';
                    generated += 'if (!attr.isValid()) { return; }\n';
                    generated += 'state.setVertexAttribArray(' + attribute + ', attr, false);\n';
                }
                generated += 'state.applyDisablingOfVertexAttributes();\n';
                var primitives = this.primitives;
                generated += 'var primitives = this.primitives;\n';
                for ( var j = 0, m = primitives.length; j < m; ++j ) {
                    generated += 'primitives[' + j + '].draw(state);\n';
                }

                /*jshint evil: true */
                this.cacheAttributeList[ prgID ] = new Function( 'state', generated );
                /*jshint evil: false */
            }
            this.cacheAttributeList[ prgID ].call( this, state );
        },

        // for testing disabling drawing
        drawImplementationDummy: function ( state ) {
            /*jshint unused: true */
            // for testing only that's why the code is not removed
            var program = state.getLastProgramApplied();
            var attribute;
            var attributeList = [];
            var attributesCache = program._attributesCache;

            var primitives = this.primitives;
            //state.disableVertexAttribsExcept(attributeList);

            for ( var j = 0, m = primitives.length; j < m; ++j ) {
                //primitives[j].draw(state);
            }
            /*jshint unused: false */
        },

        getBoundingBox: function () {
            if ( !this._boundingBoxComputed ) {
                this.computeBoundingBox( this._boundingBox );
                this._boundingBoxComputed = true;
            }
            return this._boundingBox;
        },

        setBound: function ( bb ) {
            this._boundingBox = bb;
            this._boundingBoxComputed = true;
        },

        computeBoundingBox: function ( boundingBox ) {

            var vertexArray = this.getAttributes().Vertex;
            var v = [ 0.0, 0.0, 0.0 ];
            if ( vertexArray !== undefined &&
                vertexArray.getElements() !== undefined &&
                vertexArray.getItemSize() > 2 ) {
                var vertexes = vertexArray.getElements();
                Vec3.init( v );
                for ( var idx = 0, l = vertexes.length; idx < l; idx += 3 ) {
                    v[ 0 ] = vertexes[ idx ];
                    v[ 1 ] = vertexes[ idx + 1 ];
                    v[ 2 ] = vertexes[ idx + 2 ];
                    boundingBox.expandByVec3( v );
                }
            }
            return boundingBox;
        },

        computeBound: function ( boundingSphere ) {
            boundingSphere.init();
            var bb = this.getBoundingBox();
            boundingSphere.expandByBoundingBox( bb );
            return boundingSphere;
        }
    } ), 'osg', 'Geometry' );

    MACROUTILS.setTypeID( Geometry );

    return Geometry;
} );


text:
define([
  '../../../../../oclazyload/examples/example2/js/jquery',
  '../utils'
], function ($, Utils) {
  function AttachBody (decorated, $element, options) {
    this.$dropdownParent = options.get('dropdownParent') || $(document.body);

    decorated.call(this, $element, options);
  }

  AttachBody.prototype.bind = function (decorated, container, $container) {
    var self = this;

    var setupResultsEvents = false;

    decorated.call(this, container, $container);

    container.on('open', function () {
      self._showDropdown();
      self._attachPositioningHandler(container);

      if (!setupResultsEvents) {
        setupResultsEvents = true;

        container.on('results:all', function () {
          self._positionDropdown();
          self._resizeDropdown();
        });

        container.on('results:append', function () {
          self._positionDropdown();
          self._resizeDropdown();
        });
      }
    });

    container.on('close', function () {
      self._hideDropdown();
      self._detachPositioningHandler(container);
    });

    this.$dropdownContainer.on('mousedown', function (evt) {
      evt.stopPropagation();
    });
  };

  AttachBody.prototype.destroy = function (decorated) {
    decorated.call(this);

    this.$dropdownContainer.remove();
  };

  AttachBody.prototype.position = function (decorated, $dropdown, $container) {
    // Clone all of the container classes
    $dropdown.attr('class', $container.attr('class'));

    $dropdown.removeClass('select2');
    $dropdown.addClass('select2-container--open');

    $dropdown.css({
      position: 'absolute',
      top: -999999
    });

    this.$container = $container;
  };

  AttachBody.prototype.render = function (decorated) {
    var $container = $('');

    var $dropdown = decorated.call(this);
    $container.append($dropdown);

    this.$dropdownContainer = $container;

    return $container;
  };

  AttachBody.prototype._hideDropdown = function (decorated) {
    this.$dropdownContainer.detach();
  };

  AttachBody.prototype._attachPositioningHandler =
      function (decorated, container) {
    var self = this;

    var scrollEvent = 'scroll.select2.' + container.id;
    var resizeEvent = 'resize.select2.' + container.id;
    var orientationEvent = 'orientationchange.select2.' + container.id;

    var $watchers = this.$container.parents().filter(Utils.hasScroll);
    $watchers.each(function () {
      $(this).data('select2-scroll-position', {
        x: $(this).scrollLeft(),
        y: $(this).scrollTop()
      });
    });

    $watchers.on(scrollEvent, function (ev) {
      var position = $(this).data('select2-scroll-position');
      $(this).scrollTop(position.y);
    });

    $(window).on(scrollEvent + ' ' + resizeEvent + ' ' + orientationEvent,
      function (e) {
      self._positionDropdown();
      self._resizeDropdown();
    });
  };

  AttachBody.prototype._detachPositioningHandler =
      function (decorated, container) {
    var scrollEvent = 'scroll.select2.' + container.id;
    var resizeEvent = 'resize.select2.' + container.id;
    var orientationEvent = 'orientationchange.select2.' + container.id;

    var $watchers = this.$container.parents().filter(Utils.hasScroll);
    $watchers.off(scrollEvent);

    $(window).off(scrollEvent + ' ' + resizeEvent + ' ' + orientationEvent);
  };

  AttachBody.prototype._positionDropdown = function () {
    var $window = $(window);

    var isCurrentlyAbove = this.$dropdown.hasClass('select2-dropdown--above');
    var isCurrentlyBelow = this.$dropdown.hasClass('select2-dropdown--below');

    var newDirection = null;

    var position = this.$container.position();
    var offset = this.$container.offset();

    offset.bottom = offset.top + this.$container.outerHeight(false);

    var container = {
      height: this.$container.outerHeight(false)
    };

    container.top = offset.top;
    container.bottom = offset.top + container.height;

    var dropdown = {
      height: this.$dropdown.outerHeight(false)
    };

    var viewport = {
      top: $window.scrollTop(),
      bottom: $window.scrollTop() + $window.height()
    };

    var enoughRoomAbove = viewport.top < (offset.top - dropdown.height);
    var enoughRoomBelow = viewport.bottom > (offset.bottom + dropdown.height);

    var css = {
      left: offset.left,
      top: container.bottom
    };

    // Fix positioning with static parents
    if (this.$dropdownParent[0].style.position !== 'static') {
      var parentOffset = this.$dropdownParent.offset();

      css.top -= parentOffset.top;
      css.left -= parentOffset.left;
    }

    if (!isCurrentlyAbove && !isCurrentlyBelow) {
      newDirection = 'below';
    }

    if (!enoughRoomBelow && enoughRoomAbove && !isCurrentlyAbove) {
      newDirection = 'above';
    } else if (!enoughRoomAbove && enoughRoomBelow && isCurrentlyAbove) {
      newDirection = 'below';
    }

    if (newDirection == 'above' ||
      (isCurrentlyAbove && newDirection !== 'below')) {
      css.top = container.top - dropdown.height;
    }

    if (newDirection != null) {
      this.$dropdown
        .removeClass('select2-dropdown--below select2-dropdown--above')
        .addClass('select2-dropdown--' + newDirection);
      this.$container
        .removeClass('select2-container--below select2-container--above')
        .addClass('select2-container--' + newDirection);
    }

    this.$dropdownContainer.css(css);
  };

  AttachBody.prototype._resizeDropdown = function () {
    var css = {
      width: this.$container.outerWidth(false) + 'px'
    };

    if (this.options.get('dropdownAutoWidth')) {
      css.minWidth = css.width;
      css.width = 'auto';
    }

    this.$dropdown.css(css);
  };

  AttachBody.prototype._showDropdown = function (decorated) {
    this.$dropdownContainer.appendTo(this.$dropdownParent);

    this._positionDropdown();
    this._resizeDropdown();
  };

  return AttachBody;
});


text:
if [[ $SKIP_UBUNTU_UPDATE ]];then
    echo "Skipping Ubuntu Update"
else
    echo "Updating Ubuntu Software"
    apt-get update
fi

if [[ $SKIP_UBUNTU_UPGRADE ]];then
    echo "Skipping Ubuntu Upgrade"
else
    echo "Upgrading Ubuntu Software"
    apt-get upgrade
fi

apt-get install unzip curl apt-transport-https gnupg


text:
package uk.nhs.ciao.docs.finalizer.state;

import static uk.nhs.ciao.logging.CiaoLogMessage.logMsg;

import org.apache.camel.Exchange;
import org.apache.camel.Message;
import org.apache.camel.ProducerTemplate;
import org.apache.camel.impl.DefaultExchange;
import org.apache.camel.spi.IdempotentRepository;

import uk.nhs.ciao.logging.CiaoLogger;

import com.google.common.base.Preconditions;

/**
 * A transition listener which ensures a delegate listener is only executed once
 * by using a {@link IdempotentRepository} configured Camel route
 */
public class IdempotentTransitionListener implements TransitionListener {
	private static final CiaoLogger LOGGER = CiaoLogger.getLogger(IdempotentTransitionListener.class);

	public static final String HEADER_ID = "ciao.idempotentTransitionListener.id";
	public static final String HEADER_PROCESS = "ciao.idempotentTransitionListener.process";
	public static final String HEADER_TRANSITION = "ciao.idempotentTransitionListener.transition";

	private final String targetUri;
	private final ProducerTemplate producerTemplate;
	private final TransitionListener delegate;

	public IdempotentTransitionListener(final String targetUri, final ProducerTemplate producerTemplate,
			final TransitionListener delegate) {
		this.targetUri = Preconditions.checkNotNull(targetUri);
		this.producerTemplate = Preconditions.checkNotNull(producerTemplate);
		this.delegate = Preconditions.checkNotNull(delegate);
	}

	@Override
	public void onTransition(final DocumentTransferProcess process, final Transition transition) {
		final String id = calculateId(process, transition);

		final Exchange exchange = new DefaultExchange(producerTemplate.getCamelContext());

		final Message in = exchange.getIn();
		in.setHeader(HEADER_ID, id);
		in.setHeader(HEADER_PROCESS, process);
		in.setHeader(HEADER_TRANSITION, transition);
		in.setBody(delegate);

		producerTemplate.send(targetUri, exchange);
		if (exchange.getException() != null) {
			LOGGER.error(logMsg("Unable to process transition")
				.documentId(process.getCorrelationId())
				.fromState(transition.getFromState())
				.toState(transition.getToState())
				.eventName("idempotent-" + transition.getEvent().getFileSuffix() + "-failed"));
		}
	}

	private String calculateId(final DocumentTransferProcess process, final Transition transition) {
		return process.getCorrelationId() + ":" + transition.getEvent() + ":" + transition.getFromState() + ":" + transition.getToState();
	}
}


text:
using System.Globalization;
using System.Text;

using Carbon.Data.Expressions;

namespace Amazon.DynamoDb;

using static ExpressionKind;

public sealed class DynamoExpression
{
    private readonly StringBuilder sb = new();

    private int expressionCount = 0;

    public DynamoExpression()
        : this(new Dictionary<string, string>(), new AttributeCollection())
    { }

    public DynamoExpression(
        Dictionary<string, string> attributeNames,
        AttributeCollection attributeValues)
    {
        AttributeNames = attributeNames;
        AttributeValues = attributeValues;
    }

    public Dictionary<string, string> AttributeNames { get; }

    public AttributeCollection AttributeValues { get; }

    public bool HasAttributeNames => AttributeNames.Keys.Count > 0;

    public bool HasAttributeValues => AttributeValues.Count > 0;

    public string Text => sb.ToString();

    public void AddRange(Expression[] expressions)
    {
        foreach (Expression expression in expressions)
        {
            Add(expression);
        }
    }

    public void Add(Expression expression)
    {
        if (expressionCount > 0)
        {
            sb.Append(" and ");
        }

        WritePrimary(expression);

        expressionCount++;
    }

    #region Writers

    private void WritePrimary(Expression expression)
    {
        switch (expression)
        {
            case BinaryExpression binary: WriteBinaryExpression(binary); break;
            case BetweenExpression between: WriteBetweenExpression(between); break;
            case FunctionExpression func: WriteFunctionExpression(func); break;
            default: throw new Exception($"Invalid primary expression. Was {expression.Kind}");
        }
    }

    private void WriteBetweenExpression(BetweenExpression e)
    {
        WriteName(e.Expression.Name);

        sb.Append(" between ");

        Write(e.Start);
        sb.Append(" and ");
        Write(e.End);
    }

    public void WriteBinaryExpression(BinaryExpression e)
    {
        Write(e.Left);

        sb.Append(' ');
        sb.Append(GetName(e.Kind));
        sb.Append(' ');

        Write(e.Right);
    }

    private void Write(Expression e)
    {
        switch (e)
        {
            case Symbol symbol: WriteName(symbol.Name); break;
            case BinaryExpression binary: WriteBinaryExpression(binary); break;
            case Constant constant: WriteValue(constant); break;
            case FunctionExpression func: WriteFunctionExpression(func); break;
            case BetweenExpression between: WriteBetweenExpression(between); break;
            default:
                throw new Exception($"Invalid expression. Was {e.Kind}");
        }
    }

    // https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Expressions.OperatorsAndFunctions.html
    // attribute_exists(path)
    // attribute_not_exists(path)
    // attribute_type(path, type)
    // begins_with(path, substr)
    // contains(path, operand)
    // size(path)

    private void WriteFunctionExpression(FunctionExpression funcExp)
    {
        sb.Append(funcExp.Name switch
        {
            "isNotNull"  => "attribute_exists",
            "exists"     => "attribute_exists",
            "notExists"  => "attribute_not_exists",
            "isNull"     => "attribute_not_exists",
            "startsWith" => "begins_with",
            _            => funcExp.Name
        });

        sb.Append('(');

        int i = 0;

        foreach (Expression e in funcExp.Args)
        {
            if (i != 0) sb.Append(", ");

            Write(e);

            i++;
        }

        sb.Append(')');
    }

    private void WriteName(string name)
    {
        sb.WriteName(name, AttributeNames);
    }

    private void WriteValue(Constant constant)
    {
        var variableName = string.Create(CultureInfo.InvariantCulture, $":v{AttributeValues.Count}");

        var convertor = DbValueConverterFactory.Get(constant.Value.GetType());

        AttributeValues[variableName] = convertor.FromObject(constant.Value);

        sb.Append(variableName);
    }

    #endregion

    public static DynamoExpression Conjunction(params Expression[] expressions)
    {
        var result = new DynamoExpression();

        result.AddRange(expressions);

        return result;
    }

    public static DynamoExpression FromExpression(Expression expression)
    {
        var result = new DynamoExpression();

        result.Add(expression);

        return result;
    }

    private static string GetName(ExpressionKind kind) => kind switch
    {
        And => "and",
        AndAlso => "and",
        Or => "or",
        OrElse => "or",
        Not => "not",
        Equal => "=",
        NotEqual => "<>",
        Gt => ">",
        Gte => ">=",
        Lt => "<",
        Lte => "<=",
        _ => throw new Exception($"Invalid expression. Was {kind}")
    };
}

// Used in filters, queries, scans, and conditional updates


text:
package com.tlongdev.spicio.exception;

import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.ResponseStatus;

/**
 * @author longi
 * @since 2016.04.03.
 */
@ResponseStatus(HttpStatus.NOT_FOUND)
public class DocumentNotFoundException extends RuntimeException {
}


text:
angular.module('currencyJa', [])
  .controller('TradersCtrl', ['$scope', 'traderService', function($scope, traderService) {
    $scope.currency = 'USD';
    $scope.traders = traderService.findByCurrency($scope.currency);

    $scope.multiplyByBase = function(amount) {
      var base = parseFloat($scope.base) || 1;
      if (amount) {
        return amount * base;
      }
    };

    $scope.changeCurrency = function(currency) {
      $scope.currency = currency;
      $scope.traders = traderService.findByCurrency($scope.currency);
    };
  }])
  .service('traderService', function() {
    this.findByCurrency = function(currency) {
      var statusMessages = {
        green: 'All good',
        red: 'Warning! outdated currencies'
      };

      return gon.traders.map(function(trader) {
        return {
          name: trader.name,
          shortName: trader.short_name,
          status: trader.status,
          statusMessage: statusMessages[trader.status],
          buyCash: trader.currencies[currency]['buy_cash'],
          buyDraft: trader.currencies[currency]['buy_draft'],
          sellCash: trader.currencies[currency]['sell_cash'],
          sellDraft: trader.currencies[currency]['sell_draft']
        };
      });
    };
  });


text:
if [ "$APPVEYOR" == "True" ]; then
  url="https://download-chromium.appspot.com/dl/Win?type=snapshots"
else
  url="https://download-chromium.appspot.com/dl/Linux_x64?type=snapshots"
fi

if [ x"$LIGHTHOUSE_CHROMIUM_PATH" == x ]; then
  echo "Error: Environment variable LIGHTHOUSE_CHROMIUM_PATH not set"
  exit 1
fi

if [ -e "$LIGHTHOUSE_CHROMIUM_PATH" ]; then
  echo "cached chrome found"
else
  wget "$url" --no-check-certificate -q -O chrome.zip && unzip -q chrome.zip
fi


text:
title: XAPI2 by QuantBox
tags: [quant_trading, quant_api]
keywords: xapi2
summary: "XAPI2"
sidebar: quant_trading_sidebar
permalink: quant_trading_xapi2.html
folder: quant_trading
---

## Overview

{% include links.html %}


text:
case "$TRAVIS_OS_NAME" in
"osx")
    brew update
    brew outdated pyenv || brew upgrade pyenv
    eval "$(pyenv init -)"
    pyenv install $PYTHONVERSION
    pyenv local $PYTHONVERSION
    ;;
"linux")
    # nothing to install
    ;;
*)
    echo "Unknown travis OS $TRAVIS_OS_NAME"
    exit 1
esac


text:
module SkeletonTemplates.Fold where

import AstMappings
import qualified AbsCAL as C
import qualified AbsRIPL as R
import Data.List
import qualified Data.Map as Map
import Data.Maybe
import Debug.Trace
import SkeletonTemplates.CalTypes
import Types
import SkeletonTemplates.Common

foldActor :: String -> [R.Ident] -> R.Exp -> R.Exp -> R.TwoVarProc -> VarInfo -> C.Actor
foldActor actorName outputs expState rhsExp fun@(R.TwoVarProcC vars1 vars2 stmts) varInfo =
  let ports =
        ( map (\var -> C.PortDcl (intType 32) (idRiplToCal var)) (inputPorts rhsExp varInfo)
        , map (\name -> C.PortDcl (intType 32) (idRiplToCal name)) outputs)

      countNumStates (R.ExprTuple xs) = length xs
      countNumStates _ = 1

      (foldedOverCountVarName,foldedOverDimension) =
        case rhsExp of
          R.ExprVar (R.VarC (R.Ident rhsId)) ->
            (rhsId,fst ( fromJust (Map.lookup (R.Ident rhsId) varInfo)))
          R.ExprRangeArray rangeExp ->
            (actorName ++ "_range" , fst (dimensionFromTuple rangeExp Sequential))
      actions =
        [
        -- consumeAction rhsId
          if length (inputPorts rhsExp varInfo) > 0
          then (foldActionInputPorts foldedOverDimension foldedOverCountVarName vars2 stmts,True)
          else (foldActionRange actorName (newIdentsInStatements fun) foldedOverDimension vars2 stmts,True)
        ]
        ++
        map
        (\((outIdent,initialiseExp),outputLhs,bindingIdx) ->
           let tupleArray =
                 case initialiseExp of
                   R.ExprGenArray e -> e
                   R.ExprGenRGB e -> e
           in
          (
          outputAction
          outputs
          (outIdent,initialiseExp)
          outputLhs
          foldedOverDimension
          (fst (dimensionFromStateExp initialiseExp bindingIdx))
          -- (fst (dimensionFromTuple tupleArray Sequential))
          -- (case dimensionFromStateExp expState bindingIdx of
          --    (_,Sequential) ->
          --      fst (dimensionFromTuple tupleArray Sequential)
          --    (_,Parallel) ->
          --      fst (dimensionFromTuple tupleArray Parallel)
          -- )

          actorName
          foldedOverCountVarName
          expState
          bindingIdx
          , True
          )
        )
        (zip3 stateBindings outputs ([0,1..] :: [Int]))

      stateBindings = stateExpNameBindings expState vars1
      preloads =
        -- trace ("preloads: " ++ show (processGlobalVarsTwoVarProc dataflow fun)) $
        processGlobalVarsTwoVarProc varInfo fun

      dimensionCountsForGenArray dimensions boundArrayName =
            map (\i ->
                    C.GlobVarDecl
                    (C.VDeclExpMut
                     (uintType 32)
                     (C.Ident (boundArrayName ++ "_d" ++ show i)) [] (mkInt 0))
                ) [1..dimensions]

      -- stateVarsGenArrays (R.ExprGenArray (R.ExprTuple es)) =
      --   case vars1 of
      --     R.IdentsOneId (R.Ident bindVarNameS) ->
      --       dimensionCountsForGenArray (length es) bindVarNameS
      --     R.IdentsManyIds boundIdents ->
      --       concatMap
      --       (dimensionCountsForGenArray (length es))
      --       (map (\(R.Ident s) -> s) boundIdents)

      -- stateVarsGenArrays (R.ExprTuple xs) =
      --   concatMap stateVarsGenArrays xs

      stateVars = genState vars1 expState
                  ++
                  [ C.GlobVarDecl (C.VDeclExpMut (uintType 32) (C.Ident (foldedOverCountVarName ++ "_count")) [] (mkInt 0)) ]
                  ++
                  (map (\x ->
                    C.GlobVarDecl (C.VDeclExpMut (uintType 32) (C.Ident ((idRiplShow (fst x)) ++ "_output_count")) [] (mkInt 0)))
                    stateBindings)
                  ++
                  (case vars2 of
                     R.IdentsOneId ident ->
                       [ C.GlobVarDecl (C.VDeclExpMut (uintType 32) (idRiplToCal ident) [] (mkInt 0))]
                     R.IdentsManyIds idents ->
                       map (\ident ->
                              C.GlobVarDecl (C.VDeclExpMut (uintType 32) (idRiplToCal ident) [] (mkInt 0))
                           )
                       idents)

                  -- ++
                  -- [ C.GlobVarDecl (C.VDeclExpMut (intType 16) (C.Ident (actorName ++ "_output_count")) [] (mkInt 0)) ]

                  -- TODO this is needed
                  -- (map (\x ->
                  --         (C.GlobVarDecl (C.VDeclExpMut (intType 16) (C.Ident ("output_count")) [] (mkInt 0)))
                  --         (fst x))
                  --   stateBindings)
                  -- ++

  in actor preloads stateVars actions actorName ports stateBindings vars2

genState :: R.Idents -> R.Exp -> [C.GlobalVarDecl]
genState foldStateVarTuple expInitState  =
  case foldStateVarTuple of
    R.IdentsOneId bindVarName ->
      case expInitState of
        (R.ExprGenArray (R.ExprTuple es)) ->
          mkGlobVar es bindVarName
        (R.ExprGenArray intExp@R.ExprInt{}) ->
          mkGlobVar [intExp] bindVarName
        (intExp@R.ExprInt{}) ->
          mkGlobVar [intExp] bindVarName
    (R.IdentsManyIds idents) ->
      case expInitState of
        (R.ExprTuple xs) ->
          concatMap (\(i,ident) ->
                  let (R.ExprGenArray (R.ExprTuple es)) = xs !! i
                  in mkGlobVar es ident
              ) (zip [0..] idents)
        (R.ExprGenArray (R.ExprTuple es)) ->
          mkGlobVar es (head idents)
        (R.ExprGenRGB (R.ExprTuple es)) ->
          -- add a 3rd dimension on X/Y for R, G and B
          let rgbTuple = es ++ [R.ExprInt 3]
          in
          mkGlobVar rgbTuple (head idents)

  where mkGlobVar es bindVarName@(R.Ident bindVarNameS) =
          C.GlobVarDecl
           (C.VDecl
           (intType 32)
           (idRiplToCal bindVarName)
           (map (C.BExp . expRiplToCal) es))
          :
           map (\i ->
                   C.GlobVarDecl
                   (C.VDeclExpMut
                     (uintType 32)
                     (C.Ident (bindVarNameS ++ "_d" ++ show i)) [] (mkInt 0))
               ) [1..length es]

consumeAction (R.Ident rhsId) = ("consume_" ++ rhsId, action)
  where
    inputPattern = undefined -- riplVarToInputPattern vars
    outputPattern = undefined -- riplExpToOutputPattern exp
    actionHead = C.ActnHead inputPattern outputPattern
    action = undefined

foldActionInputPorts rhsIdDimension rhsId streamVars stmtsRhs = ("fold", action)
  where
    action =
      C.ActionCode $ C.AnActn $
      C.ActnTagsStmts tag actionHead statements
    tag = C.ActnTagDecl [C.Ident "fold_action"]
    actionHead =
      C.ActnHeadGuarded inputPatterns outputPatterns [guardExp]
    inputPatterns =
      case streamVars of
        R.IdentsOneId ident ->
          [ C.InPattTagIds
            (C.Ident rhsId)
            [idRiplToCal ident]
          ]
        R.IdentsManyIds idents ->
          map (\(tokenName,i) ->
                 C.InPattTagIds
                (C.Ident (rhsId ++ show i))
                [idRiplToCal tokenName])
          (zip idents [1 .. inputArgCount streamVars])
    outputPatterns =
      []
    guardExp =
      (guardFromDimensionLT
      rhsId
      -- TODO: only if the input stream is Parallel should the
      -- last dimension be dropped, because the last dimension
      -- comes in via parallel ports.
      (dropLastDimension rhsIdDimension))

    statements =
      [ varIncr (rhsId ++ "_count") ]
      -- , C.SemiColonSeparatedStmt (calExpToStmt expRhs)
      ++ catMaybes (map stmtRiplToCal stmtsRhs)

foldActionRange actorName implicitLoadedIdents rhsIdDimension streamVars stmtsRhs = ("fold", action)
  where
    action =
      C.ActionCode $ C.AnActn $
      C.ActnTagsStmts tag actionHead statements
    tag = C.ActnTagDecl [C.Ident "fold_action"]
    actionHead =
      case concatMap actionVars stmtsRhs of
        [] ->
          C.ActnHeadGuarded inputPatterns outputPatterns [guardExp]
        xs ->
          C.ActnHeadGuardedVars inputPatterns outputPatterns [guardExp] (C.LocVarsDecl xs)
    guardExp =
      guardFromDimension
      C.BELT
      (case streamVars of
         R.IdentsOneId ident ->
           C.EIdent (idRiplToCal ident)
         R.IdentsManyIds [ident1,ident2] ->
           C.BEMult (C.EIdent (idRiplToCal ident1)) (C.EIdent (idRiplToCal ident2))
      )
      rhsIdDimension
      -- (guardFromDimensionLT
      -- ("rob")
      -- (dropLastDimension rhsIdDimension))
    inputPatterns =
      []
    outputPatterns =
      []
    statements =
      (map
       (\(R.Ident ident) ->
          varSetInt (ident ++ "_count") 0
       )
       implicitLoadedIdents)
      ++
      catMaybes (map stmtRiplToCal stmtsRhs)
      ++
      (case streamVars of
          R.IdentsOneId ident ->
            -- [ varIncr identS ]
            updateRangeCounters [ident] rhsIdDimension
          R.IdentsManyIds idents ->
            updateRangeCounters idents rhsIdDimension
            -- map (\(R.Ident identS) ->
            --        varIncr identS
            --     )
            -- idents
      )
      -- [
        -- loopOverDimension
        -- rhsIdDimension
        -- (case streamVars of
        --    R.IdentsOneId ident -> [idRiplToCal ident]
        --    R.IdentsManyIds idents -> map idRiplToCal idents)
      --   (catMaybes (map stmtRiplToCal stmtsRhs))
      -- ]
      ++
      [ varIncr (actorName ++ "_range_count") ]
      -- fold actions with nested for loops don't need guards
      -- guardExp =
      --
      -- [ guardFromDimensionLT (actorName ++ "_range") rhsIdDimension ]

updateRangeCounters [ident1] (Dim1 x) =
  varIncr (idRiplShow ident1)
  :
  [
  C.EndSeparatedStmt
  (C.IfStt
   (C.IfOneSt
    (C.BEEQ (C.EIdent (idRiplToCal ident1)) (mkInt x))
    [varSetInt (idRiplShow ident1) 0]
   )
  )
  ]

updateRangeCounters [ident1,ident2] (Dim2 x y) =
  varIncr (idRiplShow ident2)
  :
  [
  C.EndSeparatedStmt
  (C.IfStt
   (C.IfSt
    (C.BEAnd
     (C.BEEQ (C.EIdent (idRiplToCal ident2)) (mkInt y))
     (C.BELT (C.EIdent (idRiplToCal ident1)) (mkInt (x-1))))
    (varSetInt (idRiplShow ident2) 0
     :
     updateRangeCounters [ident1] (Dim1 x)
    )

   [C.EndSeparatedStmt
    (C.IfStt
     (C.IfOneSt
      (C.BEAnd
       (C.BEEQ (C.EIdent (idRiplToCal ident2)) (mkInt y))
       (C.BEEQ (C.EIdent (idRiplToCal ident1)) (mkInt (x-1))))
      ([varIncr (idRiplShow ident1)])
     ))
   ]
   )
  )
  ]

updateRangeCounters idents dim =
  error $ "updateRangeCounters: unmatched idents/dimensions - " ++ concatMap idRiplShow idents ++ " , " ++ show dim

stateExpNameBindings :: R.Exp -> R.Idents -> [(R.Ident,R.Exp)]
stateExpNameBindings expState stateLambdaName =
  case stateLambdaName of
    R.IdentsOneId ident ->
      [(ident,expState)]
    R.IdentsManyIds idents ->
      case expState of
        R.ExprTuple states ->
          zip idents states
        R.ExprGenArray tupleExpr ->
          case length idents of
            -- don't know why IdentsOneId isn't being matched here
            1 -> [(head idents, expState)]
        R.ExprGenRGB tupleExpr ->
          case length idents of
            -- don't know why IdentsOneId isn't being matched here
            1 -> [(head idents, expState)]

-- TODO: where there are multiple output states, the actor function
-- should map over this outputAction function, one output function for
-- each initialised state variable.
outputAction outputs stateBinding@(lambdaBindingVar,initialiseExp) (R.Ident lhsId) rhsIdDimension lhsIdDimension actorName rhsId expState bindingIdx =
  ("output_" ++ lhsId ++ "_" ++ actorName, action)
  where
    action =
      C.ActionCode $ C.AnActn $
      C.ActnTagsStmts tag actionHead statements
    tag = C.ActnTagDecl [C.Ident ("output_" ++ lhsId ++ "_" ++ actorName ++ "_action")]
    actionHead =
      C.ActnHeadGuarded inputPatterns outputPatterns guardExp
    inputPatterns = []
    outputPatterns =
      case dimensionFromStateExp expState bindingIdx of
        (dim,Sequential) -> [outputSequential]
        (dim,Parallel)   ->
          case dim of
            Dim1{} -> [outputSequential]
            Dim2{} -> outputParallel 2
            Dim3{} -> outputParallel 3

    outputParallel n =
      -- trace (show outputs) $
      map
      (\(outputPort,i) ->
      C.OutPattTagIds
      (idRiplToCal outputPort)
      [
        C.OutTokenExp $
        (let es = case initialiseExp of
                    R.ExprGenArray (R.ExprTuple es) -> es
                    R.ExprGenRGB (R.ExprTuple es) -> es
         in
           C.EIdentArr
           (idRiplToCal lambdaBindingVar)
           (map
            (\j ->
                C.BExp (C.EIdent (C.Ident (idRiplShow lambdaBindingVar ++ "_d" ++ show j)))
            )
            [1..length es]
           ++
           [ C.BExp (mkInt i) ]
           )
        )
      ]
      )
      (zip outputs [0,1..])

    outputSequential =
      C.OutPattTagIds
      (idRiplToCal (R.Ident lhsId))
      [
        C.OutTokenExp $
        (let es = case initialiseExp of
                    R.ExprGenArray (R.ExprTuple es) -> es
                    R.ExprGenArray intExpr@R.ExprInt{} -> [intExpr]
                    intExpr@R.ExprInt{} -> [intExpr]
                    R.ExprGenRGB (R.ExprTuple es) -> es
         in
           C.EIdentArr
           (idRiplToCal lambdaBindingVar)
           (map (\i ->
                    C.BExp (C.EIdent (C.Ident (idRiplShow lambdaBindingVar ++ "_d" ++ show i)))
                ) [1..length es])
        )
      ]

    outputDimension =
      case dimensionFromStateExp expState bindingIdx of
        (dim,Sequential) -> lhsIdDimension
        (dim,Parallel)   ->
          case dim of
            Dim1{} -> lhsIdDimension
            Dim2{} -> dropLastDimension lhsIdDimension
            Dim3{} -> dropLastDimension lhsIdDimension

    guardExp =
      [
        -- (guardFromDimensionLT (idRiplShow output ++ "_output") undefined)
        -- ,
      (guardFromDimensionLT (idRiplShow lambdaBindingVar ++ "_output") outputDimension)
      ]
    statements =
      ifResetStatementsAll
      ++
      ifOutputCountDoneStatements
      -- ++
      -- [ varIncr (idRiplShow lambdaBindingVar ++ "_output_count") ]

    resetBodyStatement =
      [C.SemiColonSeparatedStmt $
        C.AssignStt
        (C.AssStmtIdx
         (idRiplToCal lambdaBindingVar)
         -- (C.Idx (map C.BExp index))
         (C.Idx (map C.BExp
                (case lhsIdDimension of
                   Dim3 x y z ->
                     map (\i -> C.EIdent (C.Ident ("x"++show i))) [0..2]
                     --map mkInt [x,y,z]
                   Dim2 x y ->
                     map (\i -> C.EIdent (C.Ident ("x"++show i))) [0..1]
                     --map mkInt [x,y]
                   Dim1 x ->
                     map (\i -> C.EIdent (C.Ident ("x"++show i))) [0]
                     --map mkInt [x])))
                )))
         (mkInt 0))
      ]

    ifOutputCountDoneStatements =
      [C.EndSeparatedStmt
      (C.IfStt
       (C.IfSt
       (guardFromDimensionEQ (idRiplShow lambdaBindingVar ++ "_output") outputDimension)
         -- then
         [ loopOverDimension lhsIdDimension (map (\i -> C.Ident ("x" ++ show i)) [0..]) resetBodyStatement
         , varSetInt (rhsId ++ "_count") 0
         -- , varSetInt (idRiplShow lambdaBindingVar ++ "_output_count") 0
         ]
         -- else
         [ varIncr (idRiplShow lambdaBindingVar ++ "_output_count") ]
       ))
      ]

    ifResetStatementsAll =
      -- concatMap ifResetStatements (stateBindings::[(R.Ident,R.Exp)])
      ifResetStatements stateBinding

    ifResetStatements (bindingName,exp) =
      let es = case exp of
            R.ExprGenArray (R.ExprTuple es) -> es
            R.ExprGenArray intExpr@R.ExprInt{} -> [intExpr]
            intExpr@R.ExprInt{} -> [intExpr]
            R.ExprGenRGB (R.ExprTuple es) -> es
      in
          ifThenGo
          bindingName
          (length es)
          (map (\(R.ExprInt i) -> i) es)
          0

    ifThenGo (R.Ident bindNameS) 1 sizes tuplePos =
      [ varIncr (bindNameS ++ "_d" ++ show (tuplePos+1)) ]
      ++
      [C.EndSeparatedStmt
      (C.IfStt
       (C.IfOneSt
       -- condition
       (C.BEEQ
         (C.EIdent (C.Ident (bindNameS ++ ("_d"++show (tuplePos+1)))))
         (mkInt ((sizes!!tuplePos))))
       -- then branch
       ([ varSetInt (bindNameS ++ "_d"++show (tuplePos+1)) 0 ]
       )))
      ]

    ifThenGo bindName@(R.Ident bindNameS) recur sizes tuplePos =
      [ varIncr (bindNameS ++ "_d" ++ show (tuplePos+1)) ]
      ++
      [C.EndSeparatedStmt
      (C.IfStt
       (C.IfOneSt
       -- condition
       (C.BEEQ
         (C.EIdent (C.Ident (bindNameS ++ "_d" ++ show (tuplePos+1))))
         (mkInt ((sizes!!tuplePos))))
       -- then branch
       ([ varSetInt (bindNameS ++ "_d" ++ show (tuplePos+1)) 0
        -- , varIncr (bindNameS ++ "_d" ++ show (tuplePos+2))
        ]
        ++ ifThenGo bindName (recur-1) sizes (tuplePos+1))
       -- else branch
       -- [  ]
       ))
       ]

actor preloads stateVars riplActions actorName (ins,outs) stateBindings vars2 =
  C.ActrSchd
       (C.PathN [C.PNameCons (C.Ident "cal")])
       []
       (C.Ident actorName)
       []
       (C.IOSg (ins ++ concatMap (\(_,portDecl,_) -> portDecl) preloads) outs)
       (stateVars ++ (concatMap (\(globarVars,_,_) -> globarVars) preloads))
       (map snd (map (\(_,_,act) -> act) preloads) ++ map (snd . fst) riplActions ++ [resetAction])
       schedule
       [priorityBlock]
  where
    priorityBlock =
      C.PriOrd $
      (
        concatMap
        (\preloadActionName ->
           map
          (\riplActionName ->
             C.PriInEQ (C.Ident preloadActionName) (C.Ident (riplActionName ++ "_action")) []
          )
          (map (fst . fst) riplActions)
        )
      )
      (map (\(_,_,(x,_)) -> x) preloads)
      ++
      map
      (\riplAction ->
          C.PriInEQ (C.Ident (riplAction ++ "_action")) (C.Ident ("resetAction")) []
      )
      (map (fst . fst) riplActions)

      -- (zip (map fst preloads) (map fst riplActions))

    -- transLoad = map (\(i,(name,action)) -> C.StTrans (C.Ident ("s" ++ show i)) (C.Ident name) (C.Ident ("s" ++ show (i+1)))) (zip [0,1..] (map (\(_,_,act) -> act) preloads))
    -- riplActionTrans i = [] -- [C.StTrans (C.Ident ("s" ++ show i)) (C.Ident riplActionName) (C.Ident ("s" ++ show (i)))]
    schedule =
      C.SchedfsmFSM
      (C.Ident "s0")
       --C.StTrans (C.Ident ("s" ++ show sNum)) (C.Ident actionLabel) (C.Ident ("s" ++ show (sNum+1))))
      ( concatMap
         (\((_,_,(actionLabel,_)),sNum) ->
            transitionsRepeat actionLabel sNum)
         (zip preloads [0,1..])
         ++
         concatMap
         (\(((actionLabel,_action),shouldRepeat),sNum) ->
            if shouldRepeat
            then transitionsRepeat (actionLabel++"_action") sNum
            else transitionsNoRepeat (actionLabel++"_action") sNum
            )
         (zip riplActions [length preloads..])
        -- ++
        -- transitionsRepeat "fold_action" (length preloads)
        -- ++
        -- (concatMap (\(i,C.PortDcl _ (C.Ident outVar)) -> outputTransitions outVar i) (zip [length preloads+1..] ([head outs] {- big hack -})))
        ++
        [ C.StTrans (C.Ident ("s" ++ show (length preloads + {-length outs + {big hack} -} 2))) (C.Ident "resetAction") (C.Ident ("s0")) ]
      )

    transitionsNoRepeat actionLabel i =
      [ C.StTrans (C.Ident ("s" ++ show i)) (C.Ident actionLabel) (C.Ident ("s" ++ show (i+1)))
      ]

    transitionsRepeat actionLabel i =
      [ C.StTrans (C.Ident ("s" ++ show i)) (C.Ident actionLabel) (C.Ident ("s" ++ show (i+1)))
      , C.StTrans (C.Ident ("s" ++ show (i+1))) (C.Ident actionLabel) (C.Ident ("s" ++ show (i+1)))
      ]

    outputTransitions outputVarName i =
      [ C.StTrans (C.Ident ("s" ++ show i)) (C.Ident ("output_" ++ outputVarName ++ "_" ++ actorName ++ "_action")) (C.Ident ("s" ++ show (i+1)))
      , C.StTrans (C.Ident ("s" ++ show (i+1))) (C.Ident ("output_" ++ outputVarName ++ "_" ++ actorName ++ "_action")) (C.Ident ("s" ++ show (i+1)))
      ]

    outputTransitionsLast outputVarName i =
      [ C.StTrans (C.Ident ("s" ++ show i)) (C.Ident ("output_" ++ outputVarName ++ "_" ++ actorName ++ "_action")) (C.Ident ("s" ++ show (i+1)))
      , C.StTrans (C.Ident ("s" ++ show (i+1))) (C.Ident ("output_" ++ outputVarName ++ "_" ++ actorName ++ "_action")) (C.Ident ("s" ++ show (i+1)))
      ]

    resetAction =
      C.ActionCode
      (C.AnActn
       (C.ActnTagsStmts
        (C.ActnTagDecl [C.Ident "resetAction"])
        (C.ActnHead [] [])
        (map (\(R.Ident outIdentS) ->
                varSetInt (outIdentS++"_output_count") 0
             )
          (map fst stateBindings)
          ++
         map (\(R.Ident rangeCountId) ->
                varSetInt rangeCountId 0
             )
          (case vars2 of
             R.IdentsOneId ident -> [ident]
             R.IdentsManyIds idents -> idents))))


text:
package edu.virginia.lab1test;

import edu.virginia.engine.display.DisplayObject;
import edu.virginia.engine.display.PickedUpItem;
import edu.virginia.engine.display.Sprite;
import edu.virginia.engine.events.Event;
import edu.virginia.engine.events.IEventListener;
import edu.virginia.engine.tween.Tween;
import edu.virginia.engine.tween.TweenJuggler;
import edu.virginia.engine.tween.TweenTransitions;
import edu.virginia.engine.tween.TweenableParam;
import edu.virginia.engine.tween.TweenEvent;

public class QuestManager implements IEventListener{
	TweenJuggler myTweenJuggler;
	public QuestManager(){
		myTweenJuggler = TweenJuggler.getInstance();
	}

	@Override
	public void handleEvent(Event event) {
		if (event.getEventType().equals(PickedUpEvent.KEY_PICKED_UP)) {
			System.out.println("Quest is complete!");
			Sprite pickedUpItem = (Sprite) event.getSource();
			Tween tween1 = new Tween(pickedUpItem, TweenTransitions.LINEAR);
			myTweenJuggler.add(tween1);
			//System.out.println(myTweenJuggler.g);
			tween1.animate(TweenableParam.POS_X, pickedUpItem.getxPos(), 175, 1000);
			tween1.animate(TweenableParam.POS_Y, pickedUpItem.getyPos(), 75, 1000);
			tween1.animate(TweenableParam.SCALE_X, 1, 4, 1000);
			tween1.animate(TweenableParam.SCALE_Y, 1, 4, 1000);
		}
		else if (event.getEventType().equals(TweenEvent.TWEEN_COMPLETE_EVENT)) {
			//System.out.println("Tween is complete!");
			PickedUpItem pickedUpItem = (PickedUpItem) event.getSource();
			if (pickedUpItem.getAlpha() < 0.5) { //has faded out already
				pickedUpItem.setVisible(false);
			}
			if (pickedUpItem.isVisible()) {
				Tween tween2 = new Tween(pickedUpItem, TweenTransitions.LINEAR);
				myTweenJuggler.add(tween2);
				tween2.animate(TweenableParam.ALPHA, 1, 0, 1000);
			}

			//pickedUpItem.setVisible(false);
		}

	}

}


text:
package org.apache.jackrabbit.oak.jcr;

import java.lang.ref.WeakReference;
import java.util.Properties;

import javax.jcr.Repository;
import javax.jcr.RepositoryException;
import javax.jcr.Session;

import com.mongodb.BasicDBObject;
import org.apache.jackrabbit.oak.plugins.document.DocumentMK;
import org.apache.jackrabbit.oak.plugins.document.DocumentNodeStore;
import org.apache.jackrabbit.oak.plugins.document.util.MongoConnection;
import org.apache.jackrabbit.oak.query.QueryEngineSettings;

/**
 * A repository stub using the DocumentNodeStore.
 */
public class OakMongoNSRepositoryStub extends OakRepositoryStub {

    protected static final String HOST =
            System.getProperty("mongo.host", "127.0.0.1");

    protected static final int PORT =
            Integer.getInteger("mongo.port", 27017);

    protected static final String DB =
            System.getProperty("mongo.db", "MongoMKDB");

    private final MongoConnection connection;
    private final Repository repository;

    /**
     * Constructor as required by the JCR TCK.
     *
     * @param settings repository settings
     * @throws javax.jcr.RepositoryException If an error occurs.
     */
    public OakMongoNSRepositoryStub(Properties settings) throws RepositoryException {
        super(settings);
        Session session = null;
        try {
            this.connection = new MongoConnection(HOST, PORT, DB);
            this.repository = createRepository(connection);

            session = getRepository().login(superuser);
            TestContentLoader loader = new TestContentLoader();
            loader.loadTestContent(session);
        } catch (Exception e) {
            throw new RepositoryException(e);
        } finally {
            if (session != null) {
                session.logout();
            }
        }
        Runtime.getRuntime().addShutdownHook(
                new Thread(new ShutdownHook(connection)));
    }

    private static Repository createRepository(MongoConnection connection) {
        DocumentNodeStore store = new DocumentMK.Builder().
                setClusterId(1).
                memoryCacheSize(64 * 1024 * 1024).
                setPersistentCache("target/persistentCache,time").
                setMongoDB(connection.getDB()).
                getNodeStore();
        QueryEngineSettings qs = new QueryEngineSettings();
        qs.setFullTextComparisonWithoutIndex(true);
        return new Jcr(store).with(qs).createRepository();
    }

    /**
     * A shutdown hook that closed the MongoDB connection if needed.
     */
    private static class ShutdownHook implements Runnable {

        private final WeakReference<MongoConnection> reference;

        public ShutdownHook(MongoConnection connection) {
            this.reference = new WeakReference<MongoConnection>(connection);
        }

        @Override
        public void run() {
            MongoConnection connection = reference.get();
            if (connection != null) {
                connection.close();
            }
        }
    }

    public static boolean isMongoDBAvailable() {
        MongoConnection connection = null;
        try {
            connection = createConnection(DB);
            return true;
        } catch (Exception e) {
            return false;
        } finally {
            if (connection != null) {
                connection.close();
            }
        }
    }

    static MongoConnection createConnection(String db) throws Exception {
        boolean success = false;
        MongoConnection con = new MongoConnection(HOST, PORT, db);
        try {
            con.getDB().command(new BasicDBObject("ping", 1));
            success = true;
        } finally {
            if (!success) {
                con.close();
            }
        }
        return con;
    }

    /**
     * Returns the configured repository instance.
     *
     * @return the configured repository instance.
     */
    @Override
    public synchronized Repository getRepository() {
        return repository;
    }

}


text:
@implementation KMMovieDetailsViewAllCommentsCell

#pragma mark - Cell Init Methods

+ (KMMovieDetailsViewAllCommentsCell *)movieDetailsAllCommentsCell;
{
    KMMovieDetailsViewAllCommentsCell* cell = [[[NSBundle mainBundle] loadNibNamed:@"KMMovieDetailsViewAllCommentsCell" owner:self options:nil] objectAtIndex:0];

    cell.selectionStyle = UITableViewCellSelectionStyleNone;

    return cell;
}

@end


text:
from unittest import TestCase as StdTestCase

class TestCase(StdTestCase):
    """
    A parent class for our tests if we ever want to
    implement other methods in our tests.
    """

    pass