text:
r"""FuseSoc generator for UVM RAL package created with either regtool or
topgen tools.
"""
import argparse
import os
import subprocess
import sys
import logging as log
from shutil import copyfile
from collections import OrderedDict
import pathlib

import yaml

try:
    from yaml import CSafeLoader as YamlLoader, CSafeDumper as YamlDumper
except ImportError:
    from yaml import SafeLoader as YamlLoader, SafeDumper as YamlDumper

# RSTMGR root
RSTMGR_ROOT = "/../"

# Given a root dir and partial path, this function returns the full path.
def get_full_path(root_dir, partial_path):
    full_path = os.path.abspath(os.path.join(root_dir, partial_path))
    if not os.path.exists(full_path):
        print("Error: path appears to be invalid: {}".format(full_path))
        sys.exit(1)
    return full_path

def main():
    if len(sys.argv) != 2:
        print("ERROR: This script takes a single YAML file as input argument")
        sys.exit(1)

    gapi_filepath = sys.argv[1]
    gapi = yaml.load(open(gapi_filepath), Loader=YamlLoader)

    # This is just a wrapper around the reggen and topgen tools, which
    # are referenced from proj_root area.
    self_path = os.path.dirname(os.path.realpath(__file__))

    if 'verbose' in gapi['parameters']:
        if gapi['parameters'].get('verbose') == 1:
            log.basicConfig(format="%(levelname)s: %(message)s", level=log.DEBUG)
        else:
            log.basicConfig(format="%(levelname)s: %(message)s")

    # Retrieve the parameters from the yml.
    if 'path' not in gapi['parameters']:
        log.error("path to RTL not supplied")
        sys.exit(1)
    else:
        rtl_path = self_path + RSTMGR_ROOT + gapi['parameters']['path']
        print("RTL path %s" % (rtl_path, ))

    # Retrieve the command from the yml.
    cmd = ""
    if 'cmd' not in gapi['parameters']:
        log.error("command not given")
        sys.exit(1)
    else:
        cmd = gapi['parameters']['cmd']

    # Copy generated rtl files
    copyfile(rtl_path + "/rstmgr_pkg.sv", "rstmgr_pkg.sv")
    copyfile(rtl_path + "/rstmgr_reg_pkg.sv", "rstmgr_reg_pkg.sv")
    copyfile(rtl_path + "/rstmgr_reg_top.sv", "rstmgr_reg_top.sv")

    # Copy common rtl files
    common_path = self_path + RSTMGR_ROOT + "rtl"
    copyfile(rtl_path + "/rstmgr_ctrl.sv", "rstmgr_ctrl.sv")
    copyfile(rtl_path + "/rstmgr_por.sv", "rstmgr_por.sv")
    copyfile(rtl_path + "/rstmgr_info.sv", "rstmgr_info.sv")

    # list of core files to be generated
    cores = []

    # rstmgr register core
    core = OrderedDict()
    core["path"] = os.path.abspath("rstmgr_reg.core")
    core["text"] = {
        'name': "lowrisc:ip_gen:rstmgr_reg:0.1",
        'filesets': {
            'files_rtl': {
                'depend': [
                    "lowrisc:tlul:headers",
                ],
                'files': [
                    "rstmgr_reg_pkg.sv",
                    "rstmgr_reg_top.sv",
                ],
                'file_type': 'systemVerilogSource'
            },
        },
        'targets': {
            'default': {
                'filesets': [
                    'files_rtl',
                ],
            },
        },
    }
    cores.append(core)

    # rstmgr package core
    core = OrderedDict()
    core["path"] = os.path.abspath("rstmgr_pkg.core")
    core["text"] = {
        'name': "lowrisc:ip_gen:rstmgr_pkg:0.1",
        'filesets': {
            'files_rtl': {
                'depend': [
                    "lowrisc:constants:top_pkg",
                    "lowrisc:ip_gen:rstmgr_reg",
                    "lowrisc:ip:pwrmgr_pkg",
                ],
                'files': [
                    "rstmgr_pkg.sv",
                ],
                'file_type': 'systemVerilogSource'
            },
        },
        'targets': {
            'default': {
                'filesets': [
                    'files_rtl',
                ],
            },
        },
    }
    cores.append(core)

    # rstmgr package core
    core = OrderedDict()
    core["path"] = os.path.abspath("rstmgr_component.core")
    core["text"] = {
        'name': "lowrisc:ip_gen:rstmgr_component:0.1",
        'filesets': {
            'files_rtl': {
                'depend': [
                    "lowrisc:ip:tlul",
                    "lowrisc:ip_gen:rstmgr_reg",
                    "lowrisc:ip_gen:rstmgr_pkg",
                ],
                'files': [
                    "rstmgr_ctrl.sv",
                    "rstmgr_por.sv",
                    "rstmgr_info.sv",
                ],
                'file_type': 'systemVerilogSource'
            },
        },
        'targets': {
            'default': {
                'filesets': [
                    'files_rtl',
                ],
            },
        },
    }
    cores.append(core)

    print("cores {}".format(cores))

    for core in cores:
        with open(core['path'], 'w') as f:
            f.write("CAPI=2:\n")
            yaml.dump(core['text'],
                      f,
                      encoding="utf-8")
            print("core file written to {}".format(core['path']))

if __name__ == '__main__':
    main()

redpajama_set_name: RedPajamaGithub


text:
package server

import (
	"bytes"
	"fmt"
	"io/ioutil"
	"log"
	"net/http"
	"time"

	"github.com/jmartin82/mmock/v3/pkg/mock"
)

// HandleCallback makes a callback required after a request
func HandleCallback(cb mock.Callback) (*http.Response, error) {
	if d := cb.Delay.Duration; d > 0 {
		log.Printf("Delaying callback by: %s\n", d)
		time.Sleep(d)
	}

	url := cb.Url
	log.Printf("Making callback to %s\n", url)
	req, err := http.NewRequest(cb.Method, url, bytes.NewBufferString(cb.Body))
	if err != nil {
		return nil, fmt.Errorf("Error creating HTTP request: %w", err)
	}
	// add headers
	for h, vs := range cb.Headers {
		for _, v := range vs {
			req.Header.Set(h, v)
		}
	}

	// Default timeout 10s
	timeout := time.Second * 10
	if cb.Timeout.Duration > 0 {
		timeout = cb.Timeout.Duration
	}
	client := &http.Client{Timeout: timeout}
	resp, err := client.Do(req)
	if err != nil {
		return nil, fmt.Errorf("Error making HTTP request: %w", err)
	}
	statusCode := resp.StatusCode
	if statusCode >= 400 {
		body, errBody := ioutil.ReadAll(resp.Body)
		if errBody != nil {
			// Can't read a body, just log the statusCode
			err = fmt.Errorf("Unexpected HTTP response. Status code %d", statusCode)
			return resp, err
		}

		// Include the response body
		err = fmt.Errorf("Unexpected HTTP response. Status code %d, Body %s", statusCode, body)
		return resp, err
	}
	return resp, nil
}


text:
require 'raml/body'

describe Raml::Body do

  describe '.new' do
    subject { Raml::Body.new('the content_type') }
    its(:content_type) { should == 'the content_type' }
  end

  describe '#content_type' do
    let(:body) { Raml::Body.new('the content_type') }
    before { body.content_type = 'content_type' }
    subject { body.content_type }
    it { is_expected.to eq('content_type') }
  end

  describe '#schema' do
    let(:body) { Raml::Body.new('the content_type') }
    before { body.schema = 'schema' }
    subject { body.schema }
    it { is_expected.to eq('schema') }
  end

  describe '#example' do
    let(:body) { Raml::Body.new('the content_type') }
    before { body.example = 'example' }
    subject { body.example }
    it { is_expected.to eq('example') }
  end

end


text: react project template


text:
import os
from flask_script import Manager
from flask_migrate import Migrate, MigrateCommand
from main import db, app

migrate = Migrate(app, db)
manager = Manager(app)

manager.add_command('db', MigrateCommand)

if __name__ == '__main__':
    manager.run()


text:
Full example

/* Source: https://github.com/chrismalek/psoftToXML/blob/master/psftToXML.pcode */

class psoftToXML
	method RowsetToXML(&parentNode As XmlNode, &rowSetIn As Rowset) Returns XmlNode;
	method RecordToXML(&parentNode As XmlNode, &recordIn As Record) Returns XmlNode;
	method FieldToXML(&ParentNode As XmlNode, &fieldIn As Field) Returns XmlNode;
	method RowToXML(&ParentNode As XmlNode, &rowIn As Row) Returns XmlNode;
	method psoftToXML();
	property array of string fieldsToSkip;
private
	instance string &psObjectTypeString;
end-class;

method psoftToXML
	&psObjectTypeString = "PSOBJECTTYPE";
	%This.fieldsToSkip = CreateArrayRept("", 0);
end-method;

method FieldToXML
	/+ &ParentNode as XmlNode, +/
	/+ &fieldIn as Field +/
	/+ Returns XmlNode +/
	Local XmlNode &outNode;

	Local XmlNode &fldNode, &tempNode;

	&fldNode = &ParentNode.AddElement(&fieldIn.Name);

	&fldNode.AddAttribute("PSFIELDTYPE", &fieldIn.Type);
	&fldNode.AddAttribute(%This.psObjectTypeString, "FIELD");

	If &fieldIn.IsEditXlat Then
		&fldNode.AddAttribute("LongTranslateValue", &fieldIn.LongTranslateValue);
	End-If;

	Evaluate &fieldIn.Type
	When = "LONGCHAR"
	When = "IMAGE"
	When = "IMAGEREFERENCE"
		If All(&fieldIn.Value) Then

			&tempNode = &fldNode.AddCDataSection(&fieldIn.Value);
		End-If;
		Break;

	When = "NUMBER";
		&tempNode = &fldNode.AddText(&fieldIn.Value);
		Break;
	When-Other
		If All(&fieldIn.Value) Then
			&tempNode = &fldNode.AddText(&fieldIn.Value);
		End-If;

		Break;
	End-Evaluate;

	Return &outNode;
end-method;

method RecordToXML
	/+ &parentNode as XmlNode, +/
	/+ &recordIn as Record +/
	/+ Returns XmlNode +/

	Local XmlNode &outNode, &fieldNode;

	Local integer &i;

	&outNode = &parentNode.AddElement(&recordIn.Name);

	&outNode.AddAttribute(%This.psObjectTypeString, "RECORD");

	For &i = 1 To &recordIn.FieldCount

		If %This.fieldsToSkip.Find(&recordIn.GetField(&i).Name) <= 0 Then
			&fieldNode = %This.FieldToXML(&outNode, &recordIn.GetField(&i));
		End-If;
	End-For;

	Return &outNode;
end-method;

method RowToXML
	/+ &ParentNode as XmlNode, +/
	/+ &rowIn as Row +/
	/+ Returns XmlNode +/

	Local XmlNode &outNode, &recNode;

	Local integer &i;

	&outNode = &ParentNode.AddElement("ROW");
	&outNode.AddAttribute(&psObjectTypeString, "ROW");
	&outNode.AddAttribute("RowNumber", String(&rowIn.RowNumber));

	For &i = 1 To &rowIn.RecordCount
		&recNode = %This.RecordToXML(&outNode, &rowIn.GetRecord(&i));
	End-For;

	Local XmlNode &rsNode;
	For &i = 1 To &rowIn.ChildCount
		&rsNode = %This.RowsetToXML(&outNode, &rowIn.GetRowset(&i));

	End-For;

	Return &outNode;
end-method;

method RowsetToXML
	/+ &parentNode as XmlNode, +/
	/+ &rowSetIn as Rowset +/
	/+ Returns XmlNode +/

	Local XmlNode &outNode, &rowNode;

	Local integer &i;
	&outNode = &parentNode.AddElement(&rowSetIn.DBRecordName);
	&outNode.AddAttribute(&psObjectTypeString, "ROWSET");

	For &i = 1 To &rowSetIn.ActiveRowCount
		&rowNode = %This.RowToXML(&outNode, &rowSetIn.GetRow(&i));
	End-For;
	Return &outNode;
end-method;


text:
package component

import (
	"github.com/stnma7e/betuol/common"
	"github.com/stnma7e/betuol/math"
)

// GOiD stands for GameObject ID. It is the type used by all component managers to represent a specific GameObject.
type GOiD uint32

// NULLINDEX is a reserved GOiD that can be used internally by the component managers.
const NULLINDEX = 0

// ComponentManager is an interface to treat all component managers the same for the GameObject Factory.
type ComponentManager interface {
	DeleteComponent(GOiD)
}

// SceneManager is an interface used for location management. This can be a physics manager or simply a location manager.
type SceneManager interface {
	GetTransform4m(index GOiD) (math.Mat4x4, error)
	GetObjectLocation(index GOiD) (math.Vec3, error)
	SetTransform(id GOiD, newTransform math.Mat4x4)
	GetMatrixList() []math.Mat4x4
	SetLocationOverTime(id GOiD, newLocation math.Vec3, timeToMove float64) error
	GetObjectsInLocationRadius(loc math.Vec3, lookRange float32) *common.Queue
}

// Type used by the GameObject Factory for handling creation data for various component types.
type GameObject map[string][]byte

// Type used by the GameObject Factory for loading a list of GameObjects according to parameters specified in a map file.
type Map []MapLocation

// Type used to specify a single location or grid space in the map.
type MapLocation struct {
	Location math.Vec3
	Entities []MapEntity
}

// Type used to specify the type information and quantity of an entity on a map.
type MapEntity struct {
	Breed    string
	CompList GameObject
	Quantity int
}


text:
package net.orpiske.jms.listener;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import javax.jms.*;

/**
 * A simple, non-thread safe, server listener.
 */
public abstract class ServerListener implements MessageListener {
    public static final String MESSAGE_COUNT = "properties.message.count";
    public static final String LISTENER = "properties.listener.name";
    public static final String REPLY_BUILDER = "properties.reply.builder";

    private static final Logger logger = LoggerFactory.getLogger
            (ServerListener.class);

    /**
     * The current JMS session
     */
    private final Session session;

    /**
     * A message consumer to consume requests
     */
    private MessageConsumer messageConsumer;

    /**
     * A message produce to send replies
     */
    private MessageProducer replyProducer;

    /**
     * Used to count the number of processed messages
     */
    private int counter = 0;

    /**
     * Used to set the mock reply
     */
    private Message reply;

    /**
     * The time to live for the reply messages
     */
    private long timeToLive = Message.DEFAULT_TIME_TO_LIVE;

    /**
     * Constructor
     * @param session the JMS session
     * @param address the address to listen for requests
     * @throws JMSException
     */
    public ServerListener(Session session, final String address)
            throws JMSException
    {
        this.session = session;

        Destination origin = getDestination(session, address);

        messageConsumer = session.createConsumer(origin);
        messageConsumer.setMessageListener(this);

        replyProducer = session.createProducer(null);
        replyProducer.setDeliveryMode(DeliveryMode.NON_PERSISTENT);
    }

    protected Session getSession() {
        return session;
    }

    /**
     * For the given address, returns its destination object (it varies whether
     * the address refers to a queue or a topic)
     * @param session the JMS session in use
     * @param address the destination address
     * @return a destination object for the given address
     * @throws JMSException
     */
    protected abstract Destination getDestination(Session session,
                                                  String address)
            throws JMSException;

    /**
     * Processes the messages on the request queue. Note: exceptions are logged
     * but not handled
     * @param message the message to process
     */
    public void onMessage(Message message) {
        logger.debug("Processing message #{}: {}", counter, message.toString());
        counter++;

        try {
            reply = getReply(message);

            // Set the reply message properties
            reply.setJMSCorrelationID(message.getJMSCorrelationID());
            reply.setIntProperty(MESSAGE_COUNT, counter);
            reply.setStringProperty(LISTENER, this.getClass().getSimpleName());

            // Set the TTL for the message
            replyProducer.setTimeToLive(timeToLive);

            // Sends it
            replyProducer.send(message.getJMSReplyTo(), reply);

            /*
             We log the message after it has been sent because certain JMS
             message properties will be set after it has been sent (ie.:
             expired/TTL)
             */
            logger.debug("Sending reply #{}: {}", counter, reply.toString());
        } catch (JMSException e) {
            logger.error("Unable to process the message: {}", e.getMessage(),
                    e);
        } catch (ClassNotFoundException e) {
            logger.error("Unable to create a reply builder: {}", e
                    .getMessage(), e);
        } catch (InstantiationException e) {
            logger.error("Unable to instantiate a reply builder: {}", e
                    .getMessage(), e);
        } catch (IllegalAccessException e) {
            logger.error("Illegal access to the reply builder: {}", e
                    .getMessage(), e);
        }
    }

    private Message getReply(Message message) throws JMSException, ClassNotFoundException, IllegalAccessException, InstantiationException {
        String replyBuilderClass = message.getStringProperty(REPLY_BUILDER);
        if (replyBuilderClass != null && !replyBuilderClass.isEmpty()) {

            Class<?> builderClazz = Class.forName(replyBuilderClass);

            Object object = builderClazz.newInstance();

            if (object instanceof ReplyBuilder) {
                ReplyBuilder replyBuilder = (ReplyBuilder) object;

                return replyBuilder.build(session, message);
            }
            else {
                logger.warn("The reply class is not a ReplyBuilder instance.");
            }
        }
        else {
            logger.warn("The test did not set up a reply builder");
        }

        logger.warn("Returning null since a response couldn't be built");
        return null;
    }

    public void setTimeToLive(long expiration) {
        this.timeToLive = expiration;
    }

    public int processedCount() {
        return counter;
    }
}


text:
"use strict";

const EventEmitter = require("events");
const Redis = require("ioredis");

const DEFAULT_RETRY_MS = 2000;

function serialize(value) {
  if (value === null) {
    return "null";
  }

  if (value === undefined) {
    return "undefined";
  }

  return JSON.stringify(value);
}

function deserialize(value) {
  // Contract with exp-asynccache requires us to return undefined for missing keys
  // Redis client returns null for missing keys
  if (value === null) {
    return undefined;
  }

  if (value === "undefined") {
    return "undefined";
  }

  return JSON.parse(value);
}

function deserializeAll(values) {
  return values.map(deserialize);
}

class RedisCache extends EventEmitter {
  constructor(options = {}) {
    super(options);

    options.retryStrategy = options.retryStrategy || (() => DEFAULT_RETRY_MS);
    this.options = options;
    const isNumberRegEx = /^\d+$/;

    if (options.maxAge && options.maxAge !== "number" && !isNumberRegEx.test(options.maxAge)) {
      throw new Error(`Unparsable maxAge option: '${options.maxAge}'`);
    }
    this.poolResolveTimeMs = options.poolTime;
    this.resolveGetPoolTimer = false;
    this.getPool = [];
    this.client = new Redis(options);
    this.client.on("error", (err) => {
      this.emit("error", err);
    });
  }

  async get(key) {
    if (this.poolResolveTimeMs && this.poolResolveTimeMs > 0) {
      return this.addGetToPool(key);
    } else {
      const value = await this.client.get(key);
      return deserialize(value);
    }
  }

  async addGetToPool(key) {
    return new Promise((resolve, reject) => {
      const getVO = {
        key,
        resolve,
        reject
      };
      this.getPool.push(getVO);
      if (!this.resolveGetPoolTimer) {
        if (this.poolResolveTimeMs === 1) {
          this.resolveGetPoolTimer = true;
          setImmediate(this.resolveGetPool);
        } else {
          this.resolveGetPoolTimer = setTimeout(
            this.resolveGetPool,
            this.poolResolveTimeMs
          );
        }
      }
    });
  }

  resolveGetPool() {
    this.resolveGetPoolTimer = false;
    const localGetPool = this.getPool.slice(0);
    this.getPool = [];
    const keys = localGetPool.map((getVO) => getVO.key);
    this
      .getAll(keys)
      .then((serializedItems) => {
        localGetPool.forEach((getVO, index) => {
          getVO.resolve(serializedItems[index]);
        });
      })
      .catch((err) => {
        localGetPool.forEach((getVO) => {
          getVO.reject(err);
        });
      });
  }

  async getAll(keys) {
    const values = await this.client.mget(keys);
    return deserializeAll(values);
  }

  async peek(key) {
    return this.get(key);
  }

  async has(key) {
    const value = await this.client.get(key);
    return value !== null;
  }

  async set(key, value, maxAge) {
    const hasTtl = typeof maxAge === "number";
    const hasDefaultMaxAge = this.options.maxAge;

    if (hasTtl && maxAge <= 0) {
      return Promise.resolve();
    } else if (hasTtl && maxAge > 0) {
      return this.client.setex(
        key,
        Math.round(maxAge / 1000),
        serialize(value)
      );
    } else if (hasDefaultMaxAge) {
      return this.set(key, value, Number(this.options.maxAge));
    } else {
      return this.client.set(key, serialize(value));
    }
  }

  async del(key) {
    return this.client.del(key);
  }

  async reset() {
    const keys = await this.client.keys("*");
    const deleters = keys.map((key) => this.del(key));
    return Promise.all(deleters);
  }
}

module.exports = RedisCache;


text:
<?php

/*
 * This file is part of the Symfony framework.
 *
 * (c) Fabien Potencier <fabien@symfony.com>
 *
 * This source file is subject to the MIT license that is bundled
 * with this source code in the file LICENSE.
 */

namespace Symfony\Bundle\AsseticBundle\Twig;

use Assetic\Extension\Twig\AsseticFilterFunction;
use Symfony\Bundle\AsseticBundle\Exception\InvalidBundleException;
use Symfony\Component\Templating\TemplateNameParserInterface;

/**
 * Assetic node visitor.
 *
 * @author Kris Wallsmith <kris@symfony.com>
 */
class AsseticNodeVisitor implements \Twig_NodeVisitorInterface
{
    private $templateNameParser;
    private $enabledBundles;
    private $useNodeName;

    public function __construct(TemplateNameParserInterface $templateNameParser, array $enabledBundles)
    {
        $this->templateNameParser = $templateNameParser;
        $this->enabledBundles = $enabledBundles;

        $this->useNodeName = version_compare(\Twig_Environment::VERSION, '1.2.0-DEV', '<');
    }

    public function enterNode(\Twig_NodeInterface $node, \Twig_Environment $env)
    {
        return $node;
    }

    public function leaveNode(\Twig_NodeInterface $node, \Twig_Environment $env)
    {
        if (!$formula = $this->checkNode($node, $env, $name)) {
            return $node;
        }

        // check the bundle
        $templateRef = $this->templateNameParser->parse($env->getParser()->getStream()->getFilename());
        $bundle = $templateRef->get('bundle');
        if ($bundle && !in_array($bundle, $this->enabledBundles)) {
            throw new InvalidBundleException($bundle, "the $name() function", $templateRef->getLogicalName(), $this->enabledBundles);
        }

        list($input, $filters, $options) = $formula;
        $line = $node->getLine();

        // check context and call either asset() or path()
        return new \Twig_Node_Expression_Conditional(
            new \Twig_Node_Expression_GetAttr(
                new \Twig_Node_Expression_Name('assetic', $line),
                new \Twig_Node_Expression_Constant('use_controller', $line),
                new \Twig_Node_Expression_Array(array(), 0),
                \Twig_TemplateInterface::ARRAY_CALL,
                $line
            ),
            new \Twig_Node_Expression_Function(
                $this->useNodeName ? new \Twig_Node_Expression_Name('path', $line) : 'path',
                new \Twig_Node(array(
                    new \Twig_Node_Expression_Constant('_assetic_'.$options['name'], $line),
                )),
                $line
            ),
            new \Twig_Node_Expression_Function(
                $this->useNodeName ? new \Twig_Node_Expression_Name('asset', $line) : 'asset',
                new \Twig_Node(array($node, new \Twig_Node_Expression_Constant(isset($options['package']) ? $options['package'] : null, $line))),
                $line
            ),
            $line
        );
    }

    /**
     * Extracts formulae from filter function nodes.
     *
     * @return array|null The formula
     */
    private function checkNode(\Twig_NodeInterface $node, \Twig_Environment $env, & $name = null)
    {
        if ($node instanceof \Twig_Node_Expression_Function) {
            $name = $this->useNodeName
                ? $node->getNode('name')->getAttribute('name')
                : $node->getAttribute('name');
            if ($env->getFunction($name) instanceof AsseticFilterFunction) {
                $arguments = array();
                foreach ($node->getNode('arguments') as $argument) {
                    $arguments[] = eval('return '.$env->compile($argument).';');
                }

                $invoker = $env->getExtension('assetic')->getFilterInvoker($name);
                $factory = $invoker->getFactory();

                $inputs = isset($arguments[0]) ? (array) $arguments[0] : array();
                $filters = $invoker->getFilters();
                $options = array_replace($invoker->getOptions(), isset($arguments[1]) ? $arguments[1] : array());

                if (!isset($options['name'])) {
                    $options['name'] = $factory->generateAssetName($inputs, $filters);
                }

                return array($inputs, $filters, $options);
            }
        }
    }

    public function getPriority()
    {
        return 0;
    }
}


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Homeinns.Common.Net
{
    public class ECom
    {
        public ECom(System.Web.HttpCookieCollection cookies, System.String hostName, System.String profileID)
        {
            _gsver = "1.1.0.7";
            _gscmd = "ecom";
            _gssrvid = profileID;
            System.String hashCodeString = "";
            if (hostName.StartsWith("www."))
            {
                string[] subHostNames = hostName.Split(new char[] { '.' }, 2);
                if (subHostNames.Length > 1)
                {
                    hashCodeString = _gssrvid + "_" + subHostNames[1];
                }
                else
                {
                    hashCodeString = _gssrvid + "_" + hostName;
                }
            }
            else
            {
                hashCodeString = _gssrvid + "_" + hostName;
            }
            System.String tempgscs = "";
            System.String tempgscu = "";
            System.String cookieSuffix = this.getHashCode(hashCodeString, false);
            if (cookies != null)
            {
                for (int i = 0; i < cookies.Count; i++)
                {
                    System.String cookieName = cookies[i].Name;
                    if (cookieName.Equals("_gscs_" + cookieSuffix))
                    {
                        try
                        {
                            tempgscs = System.Web.HttpUtility.UrlDecode(cookies[cookieName].Value, System.Text.Encoding.UTF8);
                        }
                        catch (System.Exception ex1)
                        {

                        }
                    }
                    if (cookieName.Equals("_gscu_" + cookieSuffix))
                    {
                        try
                        {
                            tempgscu = System.Web.HttpUtility.UrlDecode(cookies[cookieName].Value, System.Text.Encoding.UTF8);
                        }
                        catch (System.Exception ex2)
                        {

                        }
                    }
                }
                try
                {
                    _gssid = tempgscs.Split(new char[] { '|' })[0];
                    System.String[] gscuSubStrs = tempgscu.Split(new char[] { '|' });
                    if (gscuSubStrs.Length == 1)
                    {
                        _gsuid = gscuSubStrs[0];
                    }
                    else
                    {
                        _gsuid = gscuSubStrs[1];
                    }
                }
                catch (System.Exception ex)
                {

                }
            }
            if (_gssid == null || _gssid.Equals(""))
            {
                _gssid = this.getASessionID();
            }
            if (_gsuid == null || _gsuid.Equals(""))
            {
                _gsuid = this.getRandomNumber();
            }
            _gsltime = ((System.DateTime.Now - new System.DateTime(1970, 1, 1)).Ticks / 10000).ToString();
            _gstmzone = this.getTimeZone();
            _gsrd = this.getRandomNumber();
        }

        private System.String _gifHostName = "http://www.webdissector.com/recv/gs.gif";
        private System.Collections.Generic.List<System.String> _additionalGifHostName = new System.Collections.Generic.List<System.String>();
        private System.String _urlString = "";
        private System.String getString = "";

        private System.String _gsver = "";
        private System.String _gscmd = "";
        private System.String _gssrvid = "";
        private System.String _gsuid = "";
        private System.String _gssid = "";
        private System.String _gsltime = "";
        private System.String _gstmzone = "";
        private System.String _gsrd = "";
        private System.String _gsorderid = "";
        private double _gstotal = 0;
        private int _gsquan = 0;
        private System.String _gsuserid = "";
        private System.String _gsproducts = "";
        private System.String _gsisserver = "1";

        private bool totalDone = false;
        private System.Collections.Generic.List<System.String> gsproducts = new System.Collections.Generic.List<System.String>();

        public void setServiceUrl(System.String gifHostName)
        {
            _gifHostName = gifHostName;
        }

        public void addAdditionalServiceUrl(System.String newGifHostName)
        {
            if (this._additionalGifHostName != null)
            {
                if (!this._additionalGifHostName.Contains(newGifHostName) && newGifHostName != this._gifHostName)
                {
                    this._additionalGifHostName.Add(newGifHostName);
                }
            }
        }

        public void clearAdditionalServiceUrls()
        {
            if (this._additionalGifHostName != null)
            {
                this._additionalGifHostName.Clear();
            }
        }

        public void addOrder(System.String orderID, double totalPrice, System.String userID)
        {
            _gsorderid = orderID;
            _gsuserid = userID;
            if (totalPrice > 0)
            {
                this._gstotal = totalPrice;
                this.totalDone = true;
            }
        }

        public void addProduct(System.String orderID, System.String productName, System.String sku, double unitPrice, int quantity, System.String category)
        {
            if (orderID == _gsorderid)
            {
                this._gsquan = this._gsquan + quantity;
                if (this.totalDone == false)
                {
                    this._gstotal = this._gstotal + unitPrice * quantity;
                }
                try
                {
                    System.Text.StringBuilder product = new System.Text.StringBuilder();
                    product.Append(System.Web.HttpUtility.UrlEncode("orderid::"));
                    product.Append(System.Web.HttpUtility.UrlEncode(orderID));
                    product.Append(System.Web.HttpUtility.UrlEncode(",,"));
                    product.Append(System.Web.HttpUtility.UrlEncode("name::"));
                    product.Append(System.Web.HttpUtility.UrlEncode(productName));
                    product.Append(System.Web.HttpUtility.UrlEncode(",,"));
                    product.Append(System.Web.HttpUtility.UrlEncode("sku::"));
                    product.Append(System.Web.HttpUtility.UrlEncode(sku));
                    product.Append(System.Web.HttpUtility.UrlEncode(",,"));
                    product.Append(System.Web.HttpUtility.UrlEncode("quantity::"));
                    product.Append(quantity);
                    product.Append(System.Web.HttpUtility.UrlEncode(",,"));
                    product.Append(System.Web.HttpUtility.UrlEncode("unitprice::"));
                    product.Append(unitPrice);
                    product.Append(System.Web.HttpUtility.UrlEncode(",,"));
                    product.Append(System.Web.HttpUtility.UrlEncode("price::"));
                    product.Append(System.Web.HttpUtility.UrlEncode((quantity * unitPrice).ToString()));
                    product.Append(System.Web.HttpUtility.UrlEncode(",,"));
                    product.Append(System.Web.HttpUtility.UrlEncode("category::"));
                    product.Append(System.Web.HttpUtility.UrlEncode(category));
                    gsproducts.Add(product.ToString());
                }
                catch (System.Exception ex)
                {

                }
            }
        }

        public void trackECom()
        {
            if (!_gsorderid.Equals("") && _gsorderid != null)
            {
                this.formatUrlString();
                try
                {
                    //如果url超过2000则按照一个一个产品单独发送
                    //.com
                    this.getString = _gifHostName + "?" + _urlString;
                    if (getString.Length > 2000)
                    {
                        for (int i = 0; i < gsproducts.Count; i++)
                        {
                            getString = _gifHostName + "?" + getUrlStringForEachProduct(i);
                            SendRequest(this.getString);
                        }
                    }
                    else
                    {
                        SendRequest(this.getString);
                    }

                    //.cn以及其他的服务器
                    if (this._additionalGifHostName != null)
                    {
                        int maxCount = this._additionalGifHostName.Count;
                        for (int i = 0; i < maxCount; i++)
                        {
                            System.String currentGifHostName = this._additionalGifHostName[i];
                            System.String destinationUrl = currentGifHostName + "?" + _urlString;
                            if (destinationUrl.Length > 2000)
                            {
                                for (int j = 0; j < gsproducts.Count; j++)
                                {
                                    destinationUrl = currentGifHostName + "?" + getUrlStringForEachProduct(j);
                                    SendRequest(destinationUrl);
                                }
                            }
                            else
                            {
                                SendRequest(destinationUrl);
                            }
                        }
                    }
                }
                catch (System.Exception e)
                {

                }
            }
        }

        private System.String getUrlStringForEachProduct(int index)
        {
            try
            {
                //不要用字符串加法
                System.Text.StringBuilder strbuf = new System.Text.StringBuilder();
                strbuf.Append("gsver=");
                strbuf.Append(System.Web.HttpUtility.UrlEncode(this._gsver));
                strbuf.Append("&gscmd=");
                strbuf.Append(System.Web.HttpUtility.UrlEncode(this._gscmd));
                strbuf.Append("&gssrvid=");
                strbuf.Append(System.Web.HttpUtility.UrlEncode(this._gssrvid));
                strbuf.Append("&gsuid=");
                strbuf.Append(System.Web.HttpUtility.UrlEncode(this._gsuid));
                strbuf.Append("&gssid=");
                strbuf.Append(System.Web.HttpUtility.UrlEncode(this._gssid));
                strbuf.Append("&gsltime=");
                strbuf.Append(System.Web.HttpUtility.UrlEncode(this._gsltime));
                strbuf.Append("&gstmzone=");
                strbuf.Append(System.Web.HttpUtility.UrlEncode(this._gstmzone));
                strbuf.Append("&gsrd=");
                strbuf.Append(System.Web.HttpUtility.UrlEncode(this._gsrd));
                strbuf.Append("&gsorderid=");
                strbuf.Append(System.Web.HttpUtility.UrlEncode(this._gsorderid));
                strbuf.Append("&gstotal=");
                strbuf.Append(System.Web.HttpUtility.UrlEncode(this._gstotal.ToString()));
                strbuf.Append("&gsquan=");
                strbuf.Append(System.Web.HttpUtility.UrlEncode(this._gsquan.ToString()));
                strbuf.Append("&gsuserid=");
                strbuf.Append(System.Web.HttpUtility.UrlEncode(this._gsuserid));
                if (gsproducts.Count > index)
                {
                    strbuf.Append("&gsproducts=");
                    //0.6.0.6版本不用二次编码
                    //strbuf.append(URLEncoder.encode(this._gsproducts,"UTF-8"));
                    strbuf.Append(gsproducts[index]);
                }
                strbuf.Append("&isserver=");
                strbuf.Append(_gsisserver);
                return strbuf.ToString();
            }
            catch (System.Exception e)
            {

            }
            return "";
        }

        private void formatUrlString()
        {
            this.formatGsProduct();
            try
            {
                //不要用字符串加法
                System.Text.StringBuilder strbuf = new System.Text.StringBuilder();
                strbuf.Append("gsver=");
                strbuf.Append(System.Web.HttpUtility.UrlEncode(this._gsver));
                strbuf.Append("&gscmd=");
                strbuf.Append(System.Web.HttpUtility.UrlEncode(this._gscmd));
                strbuf.Append("&gssrvid=");
                strbuf.Append(System.Web.HttpUtility.UrlEncode(this._gssrvid));
                strbuf.Append("&gsuid=");
                strbuf.Append(System.Web.HttpUtility.UrlEncode(this._gsuid));
                strbuf.Append("&gssid=");
                strbuf.Append(System.Web.HttpUtility.UrlEncode(this._gssid));
                strbuf.Append("&gsltime=");
                strbuf.Append(System.Web.HttpUtility.UrlEncode(this._gsltime));
                strbuf.Append("&gstmzone=");
                strbuf.Append(System.Web.HttpUtility.UrlEncode(this._gstmzone));
                strbuf.Append("&gsrd=");
                strbuf.Append(System.Web.HttpUtility.UrlEncode(this._gsrd));
                strbuf.Append("&gsorderid=");
                strbuf.Append(System.Web.HttpUtility.UrlEncode(this._gsorderid));
                strbuf.Append("&gstotal=");
                strbuf.Append(System.Web.HttpUtility.UrlEncode(this._gstotal.ToString()));
                strbuf.Append("&gsquan=");
                strbuf.Append(System.Web.HttpUtility.UrlEncode(this._gsquan.ToString()));
                strbuf.Append("&gsuserid=");
                strbuf.Append(System.Web.HttpUtility.UrlEncode(this._gsuserid));
                if (!this._gsproducts.Equals(""))
                {
                    strbuf.Append("&gsproducts=");
                    //0.6.0.6版本不用二次编码
                    //strbuf.append(URLEncoder.encode(this._gsproducts,"UTF-8"));
                    strbuf.Append(this._gsproducts);
                }
                strbuf.Append("&isserver=");
                strbuf.Append(_gsisserver);
                _urlString = strbuf.ToString();
            }
            catch (System.Exception e)
            {

            }
        }

        private void formatGsProduct()
        {
            int i = 0;
            if (gsproducts.Count >= 1)
            {
                for (i = 0; i < gsproducts.Count - 1; i++)
                {
                    _gsproducts = _gsproducts + gsproducts[i] + "||";
                }
                _gsproducts = _gsproducts + gsproducts[gsproducts.Count - 1];
            }
        }

        private System.String getASessionID()
        {
            System.Random r = new System.Random(System.DateTime.Now.Millisecond);
            r.Next();
            int rint = r.Next(90000) + 10000;
            return ((System.DateTime.Now - new System.DateTime(1970, 1, 1)).Ticks / 10000).ToString() + rint.ToString();
        }

        private System.String getTimeZone()
        {
            return System.TimeZone.CurrentTimeZone.GetUtcOffset(System.DateTime.Now).Hours.ToString();
        }

        private System.String getRandomNumber()
        {
            System.Random r = new System.Random(System.DateTime.Now.Millisecond);
            int rint = r.Next(90000) + 10000;
            return ((System.DateTime.Now - new System.DateTime(1970, 1, 1)).Ticks / 10000).ToString() + rint.ToString();
        }

        public void SendRequest(System.String destinationUrl)
        {
            try
            {
                //.com
                System.Net.HttpWebRequest request = (System.Net.HttpWebRequest)System.Net.WebRequest.Create(destinationUrl);
                request.Timeout = 10000;
                request.BeginGetResponse(delegate(IAsyncResult ar)
                {
                    try
                    {
                        request.EndGetResponse(ar);
                    }
                    catch (System.Exception)
                    {
                    }
                }, null);
            }
            catch (System.Exception ex)
            {
            }
        }

        //get hash code
        //para = profileid+"_"+hostname
        private System.String getHashCode(System.String str, bool caseSensitive)
        {
            int hash = 1315423911;
            int ch = 0;
            if (!caseSensitive)
            {
                str = str.ToLower();
            }

            for (int i = str.Length - 1; i >= 0; i--)
            {
                ch = (int)(str[i]);
                hash ^= ((hash << 5) + ch + (hash >> 2));
            }
            return (hash & 0x7FFFFFFF).ToString();
        }
    }
}


text:
require 'spec_helper'

include OpenEvaluation

describe User do
  describe "validations" do

    subject { build(:user) }

    describe "name" do
      it "is required" do
        expect(subject).to_not accept_values(:name, nil, '')
      end

      it "should be less than 30 characters" do
        expect(subject).to     accept_values(:name, 'a' * 30)
        expect(subject).to_not accept_values(:name, 'a' * 31)
      end
    end

    describe "email" do
      it "is required" do
        expect(subject).to_not accept_values(:email, nil, '', ' ')
      end

      it "is unique (case-insensitive" do
        create(:user, email: subject.email.camelcase)
        expect(subject).to_not accept_values(:email, subject.email.downcase, subject.email.upcase)
      end

      it "must be properly formatted" do
        expect(subject).to     accept_values(:email, 'a@b.com', 'a@b.c.com')
        expect(subject).to_not accept_values(:email, 'a@b', 'a.b.com')
      end

      it "must be unique" do
        subject.save
        stunt_double = subject.dup
        expect(stunt_double).to_not accept_values(:email, subject.email)
      end
    end

    describe "password" do

      subject { build(:admin) }

      it "the factory should validate" do
        expect(subject).to be_valid
      end

      it "should require a password for a new admin" do
        subject.password = subject.password_confirmation = nil
        expect(subject).to_not be_valid
      end

      it "should not require a password for an existing admin" do
        subject.save!
        subject.password = subject.password_confirmation = nil
        expect(subject).to be_valid
      end

      it "should expect a password if a user is converted to an admin" do
        subject.password = subject.password_confirmation = nil
        subject.admin=false
        subject.save!

        subject.reload
        subject.password = subject.password_confirmation = nil
        expect(subject).to be_valid
      end

      it "should not require a password for a new admin" do
        subject.admin = false
        subject.password = subject.password_confirmation = nil
        expect(subject).to be_valid
      end

      it "cannot be too short" do
        subject.password = subject.password_confirmation = 'a'*10
        expect(subject).to be_valid
        subject.password = subject.password_confirmation = 'a'*9
        expect(subject).to_not be_valid
      end

      it "should match" do
        subject.password              = 'a'*10
        subject.password_confirmation = 'x'*10
        expect(subject).to_not be_valid
      end

    end

  end

  describe ".create a normal user" do
    subject { User.create(name: "A B", email: "a@b.com", password:'new_password', password_confirmation:'new_password') }
    it "clears the password" do
      expect(subject.password).to be_nil
      expect(subject.crypted_password).to be_nil
    end
    it "sets the login hash" do
      expect(subject.login_hash).to be_present
    end
    it "does not change the login_hash when retrieving the user" do
      user = create :user
      current_login_hash = user.login_hash
      user.reload
      expect(user.login_hash).to eql(current_login_hash)
    end
  end

  describe ".create an admin user" do
    subject { User.create(admin:true, name: "A B", email: "a@b.com", password:'new_password', password_confirmation:'new_password') }
    it "sets a password" do
      expect(subject.crypted_password).not_to be_nil
    end
  end

  describe "#soft_delete!" do
    let(:user) { create :user }
    it "marks the user as deleted" do
      expect(user).to_not be_deleted
      user.soft_delete!
      expect(user).to be_deleted
    end
    it "saves the user" do
      user.soft_delete!
      user.reload
      expect(user).to be_deleted
    end
  end

  describe "#random_credentials" do
    before do
      @user = create :user
      @user.credentials.build(name: "first", value: "xyz")
      @user.credentials.build(name: "second", value: "abc")
      @user.credentials.build(name: "third", value: "123")
      @user.credentials.build(name: "fourth", value: "456")
      @user.credentials.build(name: "fifth", value: "999")
      @user.credentials.build(name: "sixth", value: "1a1")
      @user.save!
    end
    it "returns 3 credentials" do
      expect(@user.random_credentials).to have(3).items
      expect(@user.random_credentials.first).to be_a Credential
    end
    it "picks at random from the list of credential fields" do
      Array.any_instance.should_receive(:sample).with(3)
      @user.random_credentials
    end
    it "omits blank or nil credentials" do
      user = create(:user)
      user.credentials.build(name: "real", value: "actual")
      user.credentials.build(name: "blank", value: "")
      user.credentials.build(name: "missing", value: nil)
      user.save!

      credential_types = user.random_credentials.map(&:name)
      expect(credential_types).to include "real"
      expect(credential_types).to_not include "blank"
      expect(credential_types).to_not include "missing"
      expect(credential_types).to have(1).item
    end
  end

  describe "#toggle_admin!" do
    context "regular user" do
      let(:user) { create :user }
      it "updates the user" do
        User.any_instance.should_receive(:save)
        user.toggle_admin!
      end
      it "sets the admin flag to true" do
        expect {
          user.toggle_admin!
        }.to change(user, :admin).to(true)
      end
    end

    context "admin user" do
      let(:admin) { create :admin }
      it "updates the user" do
        User.any_instance.should_receive(:save)
        admin.toggle_admin!
      end
      it "sets the admin flag to false" do
        expect {
          admin.toggle_admin!
        }.to change(admin, :admin).to(false)
      end
    end

  end

  describe '#change_password!' do
    let(:user) { create :admin }

    it "succeeds" do
      expect( user.change_password!('new_password', 'new_password') ).to be_true
      expect(user.errors).to be_empty
    end

    it "changes the password" do
      pass = user.crypted_password
      salt = user.salt

      user.change_password!('new_password', 'new_password')

      expect(pass).not_to eq(user.crypted_password)
      expect(salt).not_to eq(user.salt)
    end

    it "clears the password reset token" do
      pass = user.crypted_password
      salt = user.salt
      user.reset_password_token = 'abcdef'

      user.change_password!('new_password', 'new_password')

      expect(user.reset_password_token).to be_nil
    end

    it "fails if the user is not an admin" do
      user.admin = false

      expect( user.change_password!('1234'*5,   '1234'*5) ).to be_false

      expect(user.errors).to be_present
    end

    it "fails if no password is provided" do
      expect( user.change_password!('',   ''   ) ).to be_false
      expect( user.change_password!(nil, nil   ) ).to be_false
      expect( user.change_password!(nil, 'x'*20) ).to be_false

      expect(user.errors).to be_present
    end

    it "fails if no confirmation is provided" do
      #expect( user.change_password!('x'*20, '' ) ).to be_false
      expect( user.change_password!('x'*20, nil) ).to be_false

      expect(user.errors).to be_present
    end

    it "fails if the confirmation does not match" do
      expect( user.change_password!('x'*20, 'y'*20 ) ).to be_false

      expect(user.errors).to be_present
    end

  end

  describe "finders" do

    it "should not create duplicate emails (case-insensitive) " do
      user1 = create :user, email: 'Test@example.com'

      expect( User.find_by_email( 'Test@example.com' ) ).to eq(user1)
      expect( User.find_by_email( 'test@example.com' ) ).to eq(user1)
      expect( User.find_by_email( 'TEST@example.com' ) ).to eq(user1)
    end

  end

  describe "::search" do

    before do
      User.delete_all
    end

    it "should find items matching the email" do
      u1 = create :user, email:'test1@email.com'
      u2 = create :user

      expect( User.search('test1') ).to eq( [ u1 ] )
    end

    it "email matching should be case insensitive" do
      u1 = create :user, email:'Test1@email.com'
      u2 = create :user

      expect( User.search('tEsT1') ).to eq( [ u1 ] )
    end

    it "should find items matching the name" do
      u1 = create :user, name:'Fred Flintstone'
      u2 = create :user

      expect( User.search('Fred') ).to eq( [ u1 ] )
    end

    it "name matching should be case insensitive" do
      u1 = create :user, name:'Fred Flintstone'
      u2 = create :user

      expect( User.search('freD') ).to eq( [ u1 ] )
    end

  end

end


text:
class App < ApplicationRecord
  include AppCommands
  include SSHKeyGenerator

  enum status: [:creating, :created, :busy, :not_exist, :not_synced, :syncing, :errored]

  belongs_to :server
  has_one :user, through: :server
  has_many :app_configs, dependent: :destroy
  has_many :plugin_instances, dependent: :destroy

  accepts_nested_attributes_for :app_configs, reject_if: :all_blank, allow_destroy: true

  validates :name, uniqueness: {scope: :server}

  def deploy_key
    self.host.public_key
  end

  def notify_user(message)
    NotificationChannel.broadcast_to "user_#{user.id}", message
  end

  def just_created?
    self.previous_changes['id'].present?
  end

  def to_s
    self.name
  end
end


text:
package OptimizationTests.NonTemporalMove.AccessArrayElementsLong_002;

//1 non-temporal move expected: accessing array in separate loop

public class Main {
    final int iterations = 133000;

    public long checkSum(long[] tab, int n) {
        long s = 0;
        for (int i = 0; i < n ; i++) {
            s = s + tab[i];
        }
        return s;
    }

    public long testLoop(long[] tab) {
        long s = 0;
        for (int i = 0; i < iterations; i++) {
            for (int j = 0; j < iterations; j++) {
                tab[j] = j;
            }
            s = s + tab[i]%2;
        }
        return checkSum(tab, iterations);
    }

    public void test()
    {
        long[] tab = new long[iterations];
        System.out.println(testLoop(tab));
    }

    public static void main(String[] args)
    {
        new Main().test();
    }

}


text:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical" >

    <RelativeLayout
        android:id="@+id/acChoo_relative_title"
        android:layout_height="56dp"
        android:layout_width="match_parent"
        android:padding="5dp"
        android:background="#EBEBEB"
        android:alpha="0.9" >

        <TextView
            android:id="@+id/acChoo_tv_title"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_centerInParent="true"
            android:textColor="#000000"
            android:textSize="24sp"
            android:textStyle="bold"
            />

        <ImageView
            android:id="@+id/acChoose_btn_back"
            style="@style/acWeather_btn_title"
            android:background="@drawable/title_btn"
            android:layout_alignParentBottom="true"
            android:layout_alignParentLeft="true"
            android:layout_alignParentTop="true"
            android:padding="10dp"
            android:src="@drawable/back_1" />

    </RelativeLayout>

	<View
    	android:layout_width="match_parent"
    	android:layout_height="8dp"
    	android:background="#D4D4D4"
    />

    <ListView
        android:id="@+id/list_view"
        android:layout_width="match_parent"
        android:layout_height="match_parent" >
    </ListView>

</LinearLayout>


text:
To create motion data for use with Cyclops, you'll need to install the After Effects Cyclops script panel. For more extensive instructions please take a look at [this Adobe Support page](http://helpx.adobe.com/en/after-effects/using/scripts.html), otherwise you can use the summarized instructions listed below.

## Install the Script

Copy `cyclops.jsx` folder into the `ScriptUI Panels` folder for After Effects.  By default, you can find the `ScriptUI Panels` folder in the following location:

##### Windows
`Program Files\Adobe\Adobe After Effects <version>\Support Files\Scripts\ScriptUI Panels`

##### Mac OS
`Applications/Adobe After Effects <version>/Scripts/ScriptUI Panels`

**Note:** The `ScriptUI Panels` folder may or may not exist, if it doesn't exist you can simply create the folder yourself.

## Allow Scripts to Write Files

By default, After Effects does not allow scripts to create files on your hard drive.  In order for Cyclops to save motion data into a file, this setting must be changed in the After Effects preferences.

To change this setting, open the **General** panel in the After Effects Preferences and make sure there is a check mark next to the option titled "Allow Scripts to Write Files and Access Network"

![](images/aftereffects-preferences.png "Title")

## Run the Script

After you have copied the script and updated the preferences, restart After Effects.  To launch the Cyclops panel open the `Window` menu and select `cyclops.jsx` from the list.  This will display the Cyclops window which you can leave as a free floating window or dock with into the After Effects UI.

![](images/cyclops-tool-window.png "Title")

## Select a Property for Export

Once you have created some motion for an element in your composition, highlight one of the transform properties and click the `Add Property` button in the cyclops UI panel.

![](images/selected-property.png "Title")

Next click **Add Property** in the Cyclops panel and you will be prompted to name the curve for the selected property.  By default the curve name will be the layer name and property name joined with a hyphen.  It's recommended that you choose a short but descriptive curve name that reflects the intended use of the curve.

![](images/add-property-popup.png "Title")

After you choose a curve name, a new row will appear in the Cyclops panel listing the name and source of the curve.

![](images/property-in-list.png "Title")

**If you change the name of a layer or object that is currently set to have any of its properties exported you will need to remove and re-add the property in the Cyclops Panel**

## Set Export Options

#### Export as JSON

The curve data can be stored in one of two ways, the first is as what's known as JSON data.  This is a sort of "raw" way of storing data and must be incorporated into your project through some sort of build process, or loaded asynchronously, copied/pasted into another JavaScript file, etc.  In other words, exporting JSON means you still have some work to do to get your project building.  However, it is more flexible for use with tools like Grunt as it is a more pure way to store the curve data.

#### Export as Named object

This option will create a JavaScript file that can be directly included in an existing HTML page.  It is similar to the JSON export option but it includes some extra syntax that results in fully-formed JavaScript code rather than raw data.  The input field is used to specify the variable name that will be used to store the curve data.

For instance, if you use `myAwesomeCurve` as the name, the resulting exported file would look like this:

	var myAwesomeCurve = { ... all the json data ... };

#### Choose an Output File

You can set Cyclops to put the curve data anywhere you'd like, just click the **Browse** button to select a folder and file name.  Once set, this file will be overwritten every time you click **Export Properties**.

## Export Data

Once you have added at least one property to the list and set your export options, you are ready to export the curve data.

Click `Export Properties` to create a JavaScript file from the motion data.  This JavaScript file will be used to reproduce the motion in the browser.  If you aren't a developer, you will need to work with whomever is writing the code for your project, it's important that you coordinate closely with them (especially when setting up the project initially).

The Cyclops script will save your export settings when the After Effects project is saved, so you will only need to configure the list of properties once and they will be there any time you open the project.

Once your composition and code are set up to use this motion data you will be able to make changes in After Effects and simply overwrite the old curve data without changing any code.


text:
import {Component, Inject, OnInit} from '@angular/core';
import {MAT_DIALOG_DATA, MatDialogRef} from '@angular/material/dialog';

@Component({
  selector: 'app-error-dialog',
  templateUrl: './error-dialog.component.html',
  styleUrls: ['./error-dialog.component.scss']
})
export class ErrorDialogComponent implements OnInit {

  public title: string;
  public message: string;
  public closeButtonName: string;
  private timeout: number;

  constructor(public dialogRef: MatDialogRef<ErrorDialogComponent>, @Inject(MAT_DIALOG_DATA) public data: any) {
    this.title = data.title;
    this.message = data.message;
    this.closeButtonName = data.closeButtonName;
    this.timeout = data.timeout;
  }

  ngOnInit() {
    if (this.timeout) {
      setTimeout(() => {
        this.dialogRef.close();
      }, this.timeout);
    }
  }
}


text:
<!DOCTYPE html>

<meta charset="UTF-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"/>
<title>Cube - Bootstrap Admin Template</title>

<link rel="stylesheet" type="text/css" href="css/bootstrap/bootstrap.min.css"/>

<link rel="stylesheet" type="text/css" href="css/libs/font-awesome.css"/>
<link rel="stylesheet" type="text/css" href="css/libs/nanoscroller.css"/>

<link rel="stylesheet" type="text/css" href="css/compiled/theme_styles.css"/>

<link type="image/x-icon" href="favicon.png" rel="shortcut icon"/>

<link href='//fonts.googleapis.com/css?family=Open+Sans:400,600,700,300|Titillium+Web:200,300,400' rel='stylesheet' type='text/css'>

<button class="navbar-toggle" data-target=".navbar-ex1-collapse" data-toggle="collapse" type="button">
Toggle navigation

</button>

8

You have 6 new notifications

New comment on 'Awesome P...
13 min.

New user registration
13 min.

New Message from George
13 min.

New purchase
13 min.

New order
13 min.

View all notifications

16

George Clooney

Look, just because I don't be givin' no man a foot massage don't make it
right for Marsellus to throw...

13 min.

Emma Watson

Look, just because I don't be givin' no man a foot massage don't make it
right for Marsellus to throw...

13 min.

Robert Downey Jr.

Look, just because I don't be givin' no man a foot massage don't make it
right for Marsellus to throw...

13 min.

View all messages

New Item

New Product

New Order

New Category

New Page

English

Spanish

German

Italian

<form role="search">

<input type="text" class="form-control" placeholder="Search...">

</form>

Scarlett Johansson

Profile

Settings

Messages

Logout

Scarlett J.

Profile

Settings

Messages

Logout

 Online

Navigation

Dashboard
28

Tables

Simple

Advanced

Users

FooTables

Email

Inbox

Detail

Compose

Graphs

Morris & Mixed

Flot

Dygraphs

xCharts

Widgets
New

Pages

Calendar

Gallery

Gallery v2

Pricing

Projects

Team Members

Timeline

Timeline Grid

User Profile

Search Results

Invoice

Tour Layout

Components

Forms

Elements

X-Editable

Wizard

Wizard popup

WYSIWYG

WYSIWYG Summernote

WYSIWYG CKEditor

Multiple File Upload

UI Kit

Elements

Notifications & Alerts

Modals

Video

Icons

Awesome Icons

Halflings Icons

Nestable List

Typography

3 Level Menu

3rd Level

3rd Level

3rd Level

Google Maps
Updated

Extra pages

FAQ

Email Templates

Login

Login Full

Registration

Registration Full

Forgot Password

Forgot Password Full

Lock Screen

Lock Screen Full

Error 404

Error 404 Nested

Error 500

Grid

AngularJS Demo

Home

Users

Users

 Add user

User
Created
Status
Email

Scarlett Johansson
Admin

2013/08/08

Inactive

[email protected]

Robert Downey Jr.
Member

2013/08/12

Active

[email protected]

Ryan Gossling
Registered

2013/03/03

Banned

jack@nicholson

Emma Watson
Registered

2004/01/24

Pending

[email protected]

Robert Downey Jr.
Admin

2013/12/31

Active

spencer@tracy

Mila Kunis
Admin

2013/08/08

Inactive

[email protected]

George Clooney
Member

2013/08/12

Active

[email protected]

Ryan Gossling
Registered

2013/03/03

Banned

jack@nicholson

Emma Watson
Registered

2004/01/24

Pending

[email protected]

Robert Downey Jr.
Admin

2013/12/31

Active

spencer@tracy

Powered by Cube Theme.

Layout Options

<input type="checkbox" id="config-fixed-header"/>

Fixed Header

<input type="checkbox" id="config-fixed-sidebar"/>

Fixed Left Menu

<input type="checkbox" id="config-fixed-footer"/>

Fixed Footer

<input type="checkbox" id="config-boxed-layout"/>

Boxed Layout

<input type="checkbox" id="config-rtl-layout"/>

Right-to-Left

Skin Color


text:
'use strict';
var ngEnter = function (scope, element, attrs) {
    element.bind("keydown keypress", function (event) {
        if(event.which === 13) {
            scope.$apply(function (){
                scope.$eval(attrs.ngEnter);
            });
            event.preventDefault();
        }
    });
};
module.exports = ngEnter;


text:
public class runme {
  static {
    try {
        System.loadLibrary("example");
    } catch (UnsatisfiedLinkError e) {
      System.err.println("Native code library failed to load. See the chapter on Dynamic Linking Problems in the SWIG Java documentation for help.\n" + e);
      System.exit(1);
    }
  }

  public static void main(String argv[])
  {
    // Print out the value of some enums
    System.out.println("*** color ***");
    System.out.println("    " + color.RED + " = " + color.RED.swigValue());
    System.out.println("    " + color.BLUE + " = " + color.BLUE.swigValue());
    System.out.println("    " + color.GREEN + " = " + color.GREEN.swigValue());

    System.out.println("\n*** Foo::speed ***");
    System.out.println("    Foo::" + Foo.speed.IMPULSE + " = " + Foo.speed.IMPULSE.swigValue());
    System.out.println("    Foo::" + Foo.speed.WARP + " = " + Foo.speed.WARP.swigValue());
    System.out.println("    Foo::" + Foo.speed.LUDICROUS + " = " + Foo.speed.LUDICROUS.swigValue());

    System.out.println("\nTesting use of enums with functions\n");

    example.enum_test(color.RED, Foo.speed.IMPULSE);
    example.enum_test(color.BLUE, Foo.speed.WARP);
    example.enum_test(color.GREEN, Foo.speed.LUDICROUS);

    System.out.println( "\nTesting use of enum with class method" );
    Foo f = new Foo();

    f.enum_test(Foo.speed.IMPULSE);
    f.enum_test(Foo.speed.WARP);
    f.enum_test(Foo.speed.LUDICROUS);
  }
}


text:
package org.apache.ignite.cache.hibernate;

import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.cache.Cache;
import javax.persistence.Cacheable;
import javax.persistence.Id;
import org.apache.ignite.configuration.CacheConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
import org.apache.ignite.internal.IgniteKernal;
import org.apache.ignite.internal.processors.cache.IgniteCacheProxy;
import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi;
import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder;
import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
import org.hamcrest.core.Is;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.Transaction;
import org.hibernate.boot.Metadata;
import org.hibernate.boot.MetadataSources;
import org.hibernate.boot.registry.StandardServiceRegistryBuilder;
import org.hibernate.cache.spi.access.AccessType;
import org.hibernate.mapping.PersistentClass;
import org.hibernate.mapping.RootClass;
import org.junit.Test;

import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL;
import static org.apache.ignite.cache.CacheMode.PARTITIONED;
import static org.apache.ignite.cache.hibernate.HibernateAccessStrategyFactory.REGION_CACHE_PROPERTY;
import static org.hibernate.cfg.AvailableSettings.USE_STRUCTURED_CACHE;
import static org.junit.Assert.assertThat;

/**
 * Tests Hibernate L2 cache configuration.
 */
@SuppressWarnings("unchecked")
public class HibernateL2CacheStrategySelfTest extends GridCommonAbstractTest {
    /** */
    private static final String ENTITY1_NAME = Entity1.class.getName();

    /** */
    private static final String ENTITY2_NAME = Entity2.class.getName();

    /** */
    private static final String ENTITY3_NAME = Entity3.class.getName();

    /** */
    private static final String ENTITY4_NAME = Entity4.class.getName();

    /** */
    private static final String TIMESTAMP_CACHE = "org.hibernate.cache.spi.UpdateTimestampsCache";

    /** */
    private static final String QUERY_CACHE = "org.hibernate.cache.internal.StandardQueryCache";

    /** */
    private static final String CONNECTION_URL = "jdbc:h2:mem:example;DB_CLOSE_DELAY=-1";

    /** */
    private SessionFactory sesFactory1;

    /** {@inheritDoc} */
    @Override protected void beforeTestsStarted() throws Exception {
        startGrid(0);
    }

    /** {@inheritDoc} */
    @Override protected void afterTest() throws Exception {
        for (IgniteCacheProxy<?, ?> cache : ((IgniteKernal)grid(0)).caches())
            cache.clear();
    }

    /** {@inheritDoc} */
    @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
        IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);

        ((TcpDiscoverySpi)cfg.getDiscoverySpi()).setIpFinder(new TcpDiscoveryVmIpFinder(true));

        cfg.setCacheConfiguration(cacheConfiguration(ENTITY3_NAME),
            cacheConfiguration(ENTITY4_NAME),
            cacheConfiguration("cache1"),
            cacheConfiguration("cache2"),
            cacheConfiguration(TIMESTAMP_CACHE),
            cacheConfiguration(QUERY_CACHE));

        return cfg;
    }

    /**
     * @param cacheName Cache name.
     * @return Cache configuration.
     */
    private CacheConfiguration cacheConfiguration(String cacheName) {
        CacheConfiguration cfg = new CacheConfiguration();

        cfg.setName(cacheName);
        cfg.setCacheMode(PARTITIONED);
        cfg.setAtomicityMode(TRANSACTIONAL);

        return cfg;
    }

    /**
     * @throws Exception If failed.
     */
    @Test
    public void testEntityCacheReadWrite() throws Exception {
        for (AccessType accessType : new AccessType[]{AccessType.READ_WRITE, AccessType.NONSTRICT_READ_WRITE})
            testEntityCacheReadWrite(accessType);
    }

    /**
     * @param accessType Cache access type.
     * @throws Exception If failed.
     */
    private void testEntityCacheReadWrite(AccessType accessType) throws Exception {
        log.info("Test access type: " + accessType);

        sesFactory1 = startHibernate(accessType, getTestIgniteInstanceName(0));

        try {
            // 1 Adding.
            Session ses = sesFactory1.openSession();

            try {
                Transaction tr = ses.beginTransaction();

                ses.save(new Entity1(1, "entity-1#name-1"));
                ses.save(new Entity2(1, "entity-2#name-1"));

                tr.commit();
            }
            finally {
                ses.close();
            }

            loadEntities(sesFactory1);

            assertEquals(1, grid(0).cache("cache1").size());
            assertEquals(1, grid(0).cache("cache2").size());
            assertThat(getEntityNameFromRegion(sesFactory1, "cache1", 1), Is.is("entity-1#name-1"));
            assertThat(getEntityNameFromRegion(sesFactory1, "cache2", 1), Is.is("entity-2#name-1"));

            // 2. Updating and adding.
            ses = sesFactory1.openSession();

            try {
                Transaction tx = ses.beginTransaction();

                Entity1 e1 = (Entity1)ses.load(Entity1.class, 1);

                e1.setName("entity-1#name-1#UPDATED-1");

                ses.update(e1);

                ses.save(new Entity2(2, "entity-2#name-2#ADDED"));

                tx.commit();
            }
            finally {
                ses.close();
            }

            loadEntities(sesFactory1);

            assertEquals(1, grid(0).cache("cache1").size());
            assertEquals(2, grid(0).cache("cache2").size());
            assertThat(getEntityNameFromRegion(sesFactory1, "cache1", 1), Is.is("entity-1#name-1#UPDATED-1"));
            assertThat(getEntityNameFromRegion(sesFactory1, "cache2", 1), Is.is("entity-2#name-1"));
            assertThat(getEntityNameFromRegion(sesFactory1, "cache2", 2), Is.is("entity-2#name-2#ADDED"));

            // 3. Updating, adding, updating.
            ses = sesFactory1.openSession();

            try {
                Transaction tx = ses.beginTransaction();

                Entity2 e2_1 = (Entity2)ses.load(Entity2.class, 1);

                e2_1.setName("entity-2#name-1#UPDATED-1");

                ses.update(e2_1);

                ses.save(new Entity1(2, "entity-1#name-2#ADDED"));

                Entity1 e1_1 = (Entity1)ses.load(Entity1.class, 1);

                e1_1.setName("entity-1#name-1#UPDATED-2");

                ses.update(e1_1);

                tx.commit();

            }
            finally {
                ses.close();
            }

            loadEntities(sesFactory1);

            assertEquals(2, grid(0).cache("cache1").size());
            assertEquals(2, grid(0).cache("cache2").size());
            assertThat(getEntityNameFromRegion(sesFactory1, "cache2", 1), Is.is("entity-2#name-1#UPDATED-1"));
            assertThat(getEntityNameFromRegion(sesFactory1, "cache1", 2), Is.is("entity-1#name-2#ADDED"));
            assertThat(getEntityNameFromRegion(sesFactory1, "cache1", 1), Is.is("entity-1#name-1#UPDATED-2"));

            ses = sesFactory1.openSession();

            sesFactory1.getStatistics().logSummary();

            ses.close();
        }
        finally {
            cleanup();
        }
    }

    /**
     * @param sesFactory Session factory.
     */
    private void loadEntities(SessionFactory sesFactory) {
        Session ses = sesFactory.openSession();

        try {
            List<Entity1> list1 = ses.createCriteria(ENTITY1_NAME).list();

            for (Entity1 e1 : list1)
                assertNotNull(e1.getName());

            List<Entity2> list2 = ses.createCriteria(ENTITY2_NAME).list();

            for (Entity2 e2 : list2)
                assertNotNull(e2.getName());
        }
        finally {
            ses.close();
        }
    }

    /**
     * @param sesFactory Session Factory.
     * @param regionName Region Name.
     * @param id Id.
     * @return Entity Name.
     */
    private String getEntityNameFromRegion(SessionFactory sesFactory, String regionName, int id) {
        Session ses = sesFactory.openSession();

        try {
            for (Cache.Entry<Object, Object> entry : grid(0).cache(regionName)) {
                if (((HibernateKeyWrapper)entry.getKey()).id().equals(id))
                    return (String) ((HashMap) entry.getValue()).get("name");
            }

            return null;
        }
        finally {
            ses.close();
        }
    }

    /**
     * @param accessType Cache access typr.
     * @param igniteInstanceName Name of the grid providing caches.
     * @return Session factory.
     */
    private SessionFactory startHibernate(AccessType accessType, String igniteInstanceName) {
        StandardServiceRegistryBuilder builder = new StandardServiceRegistryBuilder();

        builder.applySetting("hibernate.connection.url", CONNECTION_URL);

        for (Map.Entry<String, String> e : HibernateL2CacheSelfTest.hibernateProperties(igniteInstanceName, accessType.name()).entrySet())
            builder.applySetting(e.getKey(), e.getValue());

        builder.applySetting(USE_STRUCTURED_CACHE, "true");
        builder.applySetting(REGION_CACHE_PROPERTY + ENTITY1_NAME, "cache1");
        builder.applySetting(REGION_CACHE_PROPERTY + ENTITY2_NAME, "cache2");
        builder.applySetting(REGION_CACHE_PROPERTY + TIMESTAMP_CACHE, TIMESTAMP_CACHE);
        builder.applySetting(REGION_CACHE_PROPERTY + QUERY_CACHE, QUERY_CACHE);

        MetadataSources metadataSources = new MetadataSources(builder.build());

        metadataSources.addAnnotatedClass(Entity1.class);
        metadataSources.addAnnotatedClass(Entity2.class);
        metadataSources.addAnnotatedClass(Entity3.class);
        metadataSources.addAnnotatedClass(Entity4.class);

        Metadata metadata = metadataSources.buildMetadata();

        for (PersistentClass entityBinding : metadata.getEntityBindings()) {
            if (!entityBinding.isInherited())
                ((RootClass)entityBinding).setCacheConcurrencyStrategy(accessType.getExternalName());
        }

        return metadata.buildSessionFactory();
    }

    /**
     * Test Hibernate entity1.
     */
    @javax.persistence.Entity
    @SuppressWarnings({"PublicInnerClass", "UnnecessaryFullyQualifiedName"})
    @Cacheable
    public static class Entity1 {
        /** */
        private int id;

        /** */
        private String name;

        /**
         *
         */
        public Entity1() {
            // No-op.
        }

        /**
         * @param id ID.
         * @param name Name.
         */
        Entity1(int id, String name) {
            this.id = id;
            this.name = name;
        }

        /**
         * @return ID.
         */
        @Id
        public int getId() {
            return id;
        }

        /**
         * @param id ID.
         */
        public void setId(int id) {
            this.id = id;
        }

        /**
         * @return Name.
         */
        public String getName() {
            return name;
        }

        /**
         * @param name Name.
         */
        public void setName(String name) {
            this.name = name;
        }
    }

    /**
     * Test Hibernate entity2.
     */
    @javax.persistence.Entity
    @SuppressWarnings({"PublicInnerClass", "UnnecessaryFullyQualifiedName"})
    @Cacheable
    public static class Entity2 {
        /** */
        private int id;

        /** */
        private String name;

        /**
         *
         */
        public Entity2() {
           // No-op.
        }

        /**
         * @param id ID.
         * @param name Name.
         */
        Entity2(int id, String name) {
            this.id = id;
            this.name = name;
        }

        /**
         * @return ID.
         */
        @Id
        public int getId() {
            return id;
        }

        /**
         * @param id ID.
         */
        public void setId(int id) {
            this.id = id;
        }

        /**
         * @return Name.
         */
        public String getName() {
            return name;
        }

        /**
         * @param name Name.
         */
        public void setName(String name) {
            this.name = name;
        }
    }

    /**
     * Test Hibernate entity3.
     */
    @javax.persistence.Entity
    @SuppressWarnings({"PublicInnerClass", "UnnecessaryFullyQualifiedName"})
    @Cacheable
    public static class Entity3 {
        /** */
        private int id;

        /** */
        private String name;

        /**
         *
         */
        public Entity3() {
            // No-op.
        }

        /**
         * @param id ID.
         * @param name Name.
         */
        public Entity3(int id, String name) {
            this.id = id;
            this.name = name;
        }

        /**
         * @return ID.
         */
        @Id
        public int getId() {
            return id;
        }

        /**
         * @param id ID.
         */
        public void setId(int id) {
            this.id = id;
        }

        /**
         * @return Name.
         */
        public String getName() {
            return name;
        }

        /**
         * @param name Name.
         */
        public void setName(String name) {
            this.name = name;
        }
    }

    /**
     * Test Hibernate entity4.
     */
    @javax.persistence.Entity
    @SuppressWarnings({"PublicInnerClass", "UnnecessaryFullyQualifiedName"})
    @Cacheable
    public static class Entity4 {
        /** */
        private int id;

        /** */
        private String name;

        /**
         *
         */
        public Entity4() {
            // No-op.
        }

        /**
         * @param id ID.
         * @param name Name.
         */
        public Entity4(int id, String name) {
            this.id = id;
            this.name = name;
        }

        /**
         * @return ID.
         */
        @Id
        public int getId() {
            return id;
        }

        /**
         * @param id ID.
         */
        public void setId(int id) {
            this.id = id;
        }

        /**
         * @return Name.
         */
        public String getName() {
            return name;
        }

        /**
         * @param name Name.
         */
        public void setName(String name) {
            this.name = name;
        }
    }

    /**
     * Closes session factories and clears data from caches.
     *
     * @throws Exception If failed.
     */
    private void cleanup() throws Exception {
        if (sesFactory1 != null)
            sesFactory1.close();

        sesFactory1 = null;

        for (IgniteCacheProxy<?, ?> cache : ((IgniteKernal)grid(0)).caches())
            cache.clear();
    }
}


text:
#ifndef TENSORFLOW_COMPILER_XLA_SERVICE_EIGH_EXPANDER_H_
#define TENSORFLOW_COMPILER_XLA_SERVICE_EIGH_EXPANDER_H_

#include "absl/container/flat_hash_map.h"
#include "tensorflow/compiler/xla/client/xla_builder.h"
#include "tensorflow/compiler/xla/service/op_expander_pass.h"

namespace xla {

class EighExpander : public OpExpanderPass {
 public:
  absl::string_view name() const override { return "eigh_expander"; }

 protected:
  bool InstructionMatchesPattern(HloInstruction* instruction) override;

  StatusOr<HloInstruction*> ExpandInstruction(
      HloInstruction* instruction) override;

  virtual XlaOp BuildEigh(XlaOp a, bool lower, int64_t max_iter, float tol,
                          bool sort_eigenvalues);

  Status SortByEigenvalues(XlaOp& v, XlaOp& w);

 private:
  // Mapping from op signatures to existing computations.
  absl::flat_hash_map<std::string, HloComputation*> computation_cache_;
};

}  // namespace xla

#endif  // TENSORFLOW_COMPILER_XLA_SERVICE_EIGH_EXPANDER_H_


text:
<!DOCTYPE html>

  <meta charset="utf-8">
  <title>Redirecting…</title>
  <link rel="canonical" href="https://blog.newsblur.com/2011/04/23/where-we-are-in-april/">

  <meta http-equiv="refresh" content="0; url=https://blog.newsblur.com/2011/04/23/where-we-are-in-april/">
  <meta name="robots" content="noindex">

Redirecting…

  Click here if you are not redirected.


text:
title: "Study Article: Parens of the Dead"
date: 2020-12-28T13:52:45+03:00
draft: false
description: ""
tags:
categories: clojure
type: post
url:
author: "Mert Nuhoglu"
output:
  html_document:
    css: styles.css
state: wip

---

# Article: Parens of the Dead id=g11848

[Parens of the Dead](http://www.parens-of-the-dead.com/)

ref: `~/projects/study/clj/ex/art_parens_of_the_dead/e01/e01.Rmd`

## Episode01

[Parens of the Dead - Episode 1: Lying in the Ground - YouTube](https://www.youtube.com/embed/aWJPlRVZX90?hd=1)

```bash
rmarkdown::render('e01.Rmd')
```


text:
namespace SaNi.Mono.Graphics.Renderables
{
public sealed class Sprite
{
#region Fields
private Transform transform;
private Rectf globalbounds;
private Texture2D texture;
private bool visible;
private Color color;
#endregion

#region Properties
public Transform Transform
{
get
{
GetTransform(ref transform);
return transform;
}
set
{
SetTransform(value);
}
}
public Rectf LocalBounds
{

}
public Rectf GlobalBounds
{
get
{
GetGlobalBounds(ref globalbounds);
return globalbounds;
}

}
public Rectf TextureSource
{

}
public Texture2D Texture
{
get
{
GetTexture(ref texture);
return texture;
}
set
{
SetTexture(value);
}
}
public int ID
{

}
public bool Visible
{
get
{
GetVisible(ref visible);
return visible;
}
set
{
SetVisible(value);
}
}
public Color Color
{
get
{
GetColor(ref color);
return color;
}
set
{
SetColor(value);
}
}
#endregion

public Sprite()
{
transform = new Transform();
globalbounds = new Rectf();
texture = new Texture2D();
visible = new bool();
color = new Color();

}
#region Internal get/set methods
[MethodImpl(MethodImplOptions.InternalCall)]
private extern void GetTransform(ref Transform value);
[MethodImpl(MethodImplOptions.InternalCall)]
private extern void SetTransform(Transform value);

[MethodImpl(MethodImplOptions.InternalCall)]
private extern void GetGlobalBounds(ref Rectf value);
[MethodImpl(MethodImplOptions.InternalCall)]
private extern void SetGlobalBounds(Rectf value);

[MethodImpl(MethodImplOptions.InternalCall)]
private extern void GetTexture(ref Texture2D value);
[MethodImpl(MethodImplOptions.InternalCall)]
private extern void SetTexture(Texture2D value);

[MethodImpl(MethodImplOptions.InternalCall)]
private extern void GetVisible(ref bool value);
[MethodImpl(MethodImplOptions.InternalCall)]
private extern void SetVisible(bool value);

[MethodImpl(MethodImplOptions.InternalCall)]
private extern void GetColor(ref Color value);
[MethodImpl(MethodImplOptions.InternalCall)]
private extern void SetColor(Color value);
#endregion

public  void Destroy()
{
}

~Sprite()
{
}

}
}


text:
<?php

class m140812_180000_store_attribute_option_base extends yupe\components\DbMigration
{
    public function safeUp()
    {
        $this->createTable(
            "{{store_attribute_option}}",
            [
                "id" => "pk",
                "attribute_id" => "int(11) null default null",
                "position" => "tinyint(4) null default null",
                "value" => "varchar(255) null default ''",
            ],
            $this->getOptions()
        );

        //ix
        $this->createIndex("ix_{{store_attribute_option}}_attribute_id", "{{store_attribute_option}}", "attribute_id", false);
        $this->createIndex("ix_{{store_attribute_option}}_position", "{{store_attribute_option}}", "position", false);

        //fk
        $this->addForeignKey("fk_{{store_attribute_option}}_attribute", "{{store_attribute_option}}", "attribute_id", "{{store_attribute}}", "id", "CASCADE", "CASCADE");
    }

    public function safeDown()
    {
        $this->dropTable("{{store_attribute_option}}");
    }
}


text:
using System;
using UCommerce.EntitiesV2;

namespace Vertica.UCommerce.Utilities.Testing.Builders
{
    public class OrderStatusAuditBuilder : Builder<OrderStatusAudit>
    {
        public OrderStatusAuditBuilder()
            : base(new OrderStatusAudit())
        {
        }

        public OrderStatusAuditBuilder Change(Action<OrderStatusAudit> change)
        {
            if (change == null) throw new ArgumentNullException("change");

            change(Instance);

            return this;
        }
    }
}


text:
public class Biker {

    //TODO: Heading, (necessary to know which direction in which to move them)

    private long WAIT_TIME_MILLIS = 10;

    private Coordinate bikerCoordinate;     //Biker position

    private BikerAI ai;

    private boolean isAlive = true;                //True if the biker is still alive

    /** Constructs a Biker object
     * @param xPos starting position in x
     * @param yPos starting position in y
     * @param ai the biker's AI
     */
    public Biker(int xPos,int yPos, BikerAI ai){
        coordinate(xPos, yPos);
        this.ai = ai;
        this.isAlive = true; //alive to start
    }

    /** retrieves the next move of the biker, from it's AI.
     * This should implement a time limit in the future!
     * @param board : the current board,
     *        aligned such that the bike has been previously moving upwards
     * @return nextAction : the decision of the Biker's AI in terms of direction to move
     */
    public BikerActions getNextMove(BoardItem[][] board){
        BikerActions nextAction = ai.getNextAction(board);
        return nextAction;
    }

    /**
     * Updates biker's coordinate
     * @param x X coordinate
     * @param y Y coordinate
     */
    public void coordinate(int x, int y) {
        bikerCoordinate.x = x;
        bikerCoordinate.y = y;
    }

    /**
     * @return the bikers current coordinate
     */
    public Coordinate coordinate() {
        return bikerCoordinate;
    }

    /**
     * sets the status of the Biker to dead
     */
    public void murder() {
        isAlive = false;
    }

    /**
     * getter for life status of Biker
     * @return true if biker is alive.
     */
    public boolean isAlive(){
        return isAlive;
    }
}