text:
<?php

/**
 * Database wrapper, provides a database API for the framework but hides details of implementation.
 *
 */
class CDatabase {

  /**
   * Members
   */
  private $options;                   // Options used when creating the PDO object
  private $db   = null;               // The PDO object
  private $stmt = null;               // The latest statement used to execute a query
  private static $numQueries = 0;     // Count all queries made
  private static $queries = array();  // Save all queries for debugging purpose
  private static $params = array();   // Save all parameters for debugging purpose

  /**
   * Constructor creating a PDO object connecting to a choosen database.
   *
   * @param array $options containing details for connecting to the database.
   *
   */
  public function __construct($options) {
    $default = array(
      'dsn' => null,
      'username' => null,
      'password' => null,
      'driver_options' => null,
      'fetch_style' => PDO::FETCH_OBJ,
    );
    $this->options = array_merge($default, $options);

    try {
      $this->db = new PDO($this->options['dsn'], $this->options['username'], $this->options['password'], $this->options['driver_options']);
    }
    catch(Exception $e) {
      //throw $e; // For debug purpose, shows all connection details
      throw new PDOException('Could not connect to database, hiding connection details.'); // Hide connection details.
    }

    $this->db->SetAttribute(PDO::ATTR_DEFAULT_FETCH_MODE, $this->options['fetch_style']);
  }

  /**
   * Execute a select-query with arguments and return the resultset.
   *
   * @param string $query the SQL query with ?.
   * @param array $params array which contains the argument to replace ?.
   * @param boolean $debug defaults to false, set to true to print out the sql query before executing it.
   * @return array with resultset.
   */
  public function ExecuteSelectQueryAndFetchAll($query, $params=array(), $debug=false) {

    self::$queries[] = $query;
    self::$params[]  = $params;
    self::$numQueries++;

    if($debug) {
      echo "
Query =

{$query}

Num query = " . self::$numQueries . "

".print_r($params, 1)."

";
    }

    $this->stmt = $this->db->prepare($query);
    $this->stmt->execute($params);
    return $this->stmt->fetchAll();
  }

  /**
   * Get a html representation of all queries made, for debugging and analysing purpose.
   *
   * @return string with html.
   */
  public function Dump() {
    $html  = '
You have made ' . self::$numQueries . ' database queries.

';
    foreach(self::$queries as $key => $val) {
      $params = empty(self::$params[$key]) ? null : htmlentities(print_r(self::$params[$key], 1)) . '

';
      $html .= $val . '

' . $params;
    }
    return $html . '
';
  }

  /**
   * Execute a SQL-query and ignore the resultset.
   *
   * @param string $query the SQL query with ?.
   * @param array $params array which contains the argument to replace ?.
   * @param boolean $debug defaults to false, set to true to print out the sql query before executing it.
   * @return boolean returns TRUE on success or FALSE on failure.
   */
  public function ExecuteQuery($query, $params = array(), $debug=false) {

    self::$queries[] = $query;
    self::$params[]  = $params;
    self::$numQueries++;

    if($debug) {
      echo "
Query =

{$query}

Num query = " . self::$numQueries . "

".print_r($params, 1)."

";
    }

    $this->stmt = $this->db->prepare($query);
    return $this->stmt->execute($params);
  }

  /**
   * Return last insert id.
   */
  public function LastInsertId() {
    return $this->db->lastInsertid();
  }

  /**
   * Save debug information in session, useful as a flashmemory when redirecting to another page.
   *
   * @param string $debug enables to save some extra debug information.
   */
  public function SaveDebug($debug=null) {
    if($debug) {
      self::$queries[] = $debug;
      self::$params[] = null;
    }

    self::$queries[] = 'Saved debuginformation to session.';
    self::$params[] = null;

    $_SESSION['CDatabase']['numQueries'] = self::$numQueries;
    $_SESSION['CDatabase']['queries']    = self::$queries;
    $_SESSION['CDatabase']['params']     = self::$params;
  }

  /**
   * Return rows affected of last INSERT, UPDATE, DELETE
   */
  public function RowCount() {
    return is_null($this->stmt) ? $this->stmt : $this->stmt->rowCount();
  }

  /**
 * Use the current querystring as base, modify it according to $options and return the modified query string.
 *
 * @param array $options to set/change.
 * @param string $prepend this to the resulting query string
 * @return string with an updated query string.
 */
public function getQueryString($options, $prepend='?') {
  // parse query string into array
  $query = array();
  parse_str($_SERVER['QUERY_STRING'], $query);

  // Modify the existing query string with new options
  $query = array_merge($query, $options);

  // Return the modified querystring
  return $prepend . http_build_query($query);
}

/**
 * Create links for hits per page.
 *
 * @param array $hits a list of hits-options to display.
 * @return string as a link to this page.
 */
public function getHitsPerPage($hits) {
  $nav = "Träffar per sida: ";
  foreach($hits AS $val) {
    $nav .= "getQueryString(array('hits' => $val)) . "'>$val ";
  }
  return $nav;
}

/**
 * Create navigation among pages.
 *
 * @param integer $hits per page.
 * @param integer $page current page.
 * @param integer $max number of pages.
 * @param integer $min is the first page number, usually 0 or 1.
 * @return string as a link to this page.
 */
public function getPageNavigation($hits, $page, $max, $min=1) {
	$nav  = "getQueryString(array('page' => $min)) . "'><< ";
  	$nav .= "getQueryString(array('page' => ($page > $min ? $page - 1 : $min) )) . "'>< ";

  for($i=$min; $i<=$max; $i++) {
    $nav .= "getQueryString(array('page' => $i)) . "'>$i ";
  }

  $nav .= "getQueryString(array('page' => ($page < $max ? $page + 1 : $max) )) . "'>> ";
  $nav .= "getQueryString(array('page' => $max)) . "'>>> ";
  return $nav;

}

/**
 * Function to create links for sorting
 *
 * @param string $column the name of the database column to sort by
 * @return string with links to order by column.
 */
public function orderby($column) {
  return "↓↑";
}

/**
 * Function to create SQL query for multiple searches
 *
 * @param string $title string from title searching
 * @param integer $year1 movies newer than
 * @param integer $year1 movies older than
 * @param string $genre string from genre searching
 * @param integer $hits number of hits to display
 * @param integer $page current page
 * @param array $orderby order by what
 * @param array $order asc or desc
 * @return string containing sql query.
 */
 public function searchquery($title, $year1, $year2, $genre, $hits, $page, $orderby, $order) {

 $sql = "select id,
title as 'Titel',
year as 'År',
image as 'Bild',
genre as 'Genre'
from VMovie Where 1 ";

if($title) {
  // prepare SQL for search
  $sql .= "and title like '$title'";
}
if($year1) {
  // prepare SQL for search
  $sql .= "and year > '$year1'";
}
if($year2) {
  // prepare SQL for search
  $sql .= "and year < '$year2'";
}
if($genre) {
  // prepare SQL for search
  $sql .= "and genre like '%$genre%'";
}

$sql .= " order by $orderby $order LIMIT $hits OFFSET " . (($page - 1) * $hits) .
";";

return $sql;

 }

 public function searchquerymax($title, $year1, $year2, $genre) {

 $sql = "select
title as 'Titel',
year as 'År',
image as 'Bild',
genre as 'Genre'
from VMovie Where 1 ";

if($title) {
  // prepare SQL for search
  $sql .= "and title like '$title'";
}
if($year1) {
  // prepare SQL for search
  $sql .= "and year > '$year1'";
}
if($year2) {
  // prepare SQL for search
  $sql .= "and year < '$year2'";
}
if($genre) {
  // prepare SQL for search
  $sql .= "and genre like '%$genre%'";
}

$sql .= ";";

return $sql;

 }

/**
   * Return textual representation of last error, see PDO::errorInfo().
   *
   * @return array with information on the error.
   */
  public function ErrorInfo() {
    return $this->stmt->errorInfo();
  }

}


text:
Drive impulse slave clocks and voltmeters with a Raspberry Pi. Companion to [carillon](https://github.com/clockspot/carillon).

## What's it do?
**Time-of-day display.** Using a standard GPIO pin, master-clock will output a signal to control an amplifier circuit to drive an impulse slave clock(s). It will keep its own nonvolatile record of the displayed time, and will keep the clock in sync with the system clock (itself synced via `ntpd` ideally). It will also fast-forward the clock in case of power loss, DST changes, you stopped the daemon to watch a movie undisturbed, etc.

**Seconds and status display.** Using a GPIO pin that supports pulse-width modulation, it will control the PWM duty cycle to directly control a 3VDC voltmeter. It includes ballistics control to move the needle quickly but gently, and (hopefully) never cause it to peg violently.

## Why?
I got a harebrained scheme to build an indoor carillon in two loosely-coupled parts:

* **the Clock,** a Raspberry Pi living inside and controlling a 1960s Gents slave clock, synced to NTP (via `ntpd`), and outputting MIDI (via `amidi` and `aplaymidi`) on schedule (see companion project [carillon](https://github.com/clockspot/carillon)); and
* **the Bells**, a small glockenspiel rigged with solenoids wired up to [a purpose-made MIDI decoder card from Orgautomatech](http://www.orgautomatech.com/), receiving MIDI from the Clock.

Because the only link between the Clock and Bells is MIDI, the Clock can control other MIDI instruments, and the Bells can be played with other MIDI controllers.

## How to use
* **Install packages** if not present: `python`, `python-daemon`
* **Make settings file** `settings.py` as a copy of `settings-sample.py`, and modify to suit. Other instructions within (e.g. file permissions).
* **Set up the voltmeter.** If you like, replace or modify the dial with a seconds scale (on a 3VDC meter scale, each 0.5V corresponds to 10 seconds). Run `calibrate-meter.py` to find good calibration points – that is, find the input values that make the needle point to N seconds on the scale. At minimum, you need a point at the max end of the scale (59 seconds), but as your meter probably won't have a perfectly linear response, you can pick more points along the scale as needed to fine-tune it.
* **Build the amplifier circuit** ([example](http://www.instructables.com/id/Make-an-Atom-Synchronised-Clock-from-a-1950s-Slav/)) and attach to your clock. Run `calibrate-clock.py` to tell master-clock what time the clock is displaying. If you don't have one yet, you can connect an LED+resistor in its place for testing. Run `test-clock.py` to test impulses of various lengths to the clock pin.
* **Run the script,** e.g. `./master-clock.py`, directly or at startup. It will detach from the shell and run as a daemon. No start/stop service controls just yet; for now, stop with `stop.sh` or e.g. `pkill -f master-clock.py`.
* The meter will display as follows:
  * Daemon not running: 0s
  * *[TODO]* No network connection: 10s
  * *[TODO]* No confirmed NTP sync: 20s
  * Slave clock is being adjusted: 30s
  * Normal: running seconds

## Files herein
* `master-clock.py` - Where the magic happens.
* `settings-sample.py` - Duplicate to `settings.py` and edit accordingly.
* `calibrate-meter.py` - Use this to calibrate your 3VDC meter.
* `calibrate-clock.py` - Use this to tell master-clock what time your slave clock reads.
* `test-clock.py` - Use this to manually impulse the clock pin and find the right duration.
* `stop.sh` - Lazy way of stopping the daemon.

## Best-laid plans
* Admin via web console?
* Details on hardware construction of amplifier circuit

## Credit where due!
* [Make an Atom Synchronised Clock from a 1950s Slave Clock on Instructables](http://www.instructables.com/id/Make-an-Atom-Synchronised-Clock-from-a-1950s-Slav/)

redpajama_set_name: RedPajamaGithub


text:
package log

import (
	"golang.org/x/net/context"
)

type Options struct {
	// the current log level
	Level Level
	// the output to write to
	Outputs []Output
	// include a set of fields
	Fields Fields

	// Alternative options
	Context context.Context
}

type OutputOptions struct {
	// filepath, url, etc
	Name string
}

// Log options

func WithLevel(l Level) Option {
	return func(o *Options) {
		o.Level = l
	}
}

func WithOutput(ot Output) Option {
	return func(o *Options) {
		o.Outputs = append(o.Outputs, ot)
	}
}

func WithFields(f Fields) Option {
	return func(o *Options) {
		o.Fields = f
	}
}

// Output options

func OutputName(name string) OutputOption {
	return func(o *OutputOptions) {
		o.Name = name
	}
}


text:
#pragma once
#include "AcDbAssocGlobal.h"
#include "AcDbCompoundObjectId.h"
#pragma pack (push, 8)

/// <summary> <para>
/// AcDbAssocDependencies represent information about which AcDbAssocActions depend
/// on or modify which AcDbObjects. This is how the associativity in the drawing is
/// represented. Dependencies are owned by actions and are attached to the objects
/// as persistent reactors. When the dependent-on object changes, it notifies the
/// dependency via the persistent reactor mechanism. The dependency checks
/// whether the change is relevant, such as when the dependency is on an endpoint
/// of a line but the color of the line changed, or the other endpoint changed,
/// and if yes, it changes its status indicating that it needs to be evaluated,
/// and also changes the status of the owning action indicating that it needs
/// to be evaluated (and the action changes the status of the AcDbAssocNetwork
/// that owns it).
/// </para> <para>
/// The base AcDbAssocDependency class can be used as it but there are also
/// provided a few concrete derived dependency classes that represent particular
/// kinds of dependencies on particular objects or subobjects, such as
/// on subentities (faces, edges, vertices) of geometric entities, on objects
/// that provide a numerical value, etc. For example, the dependency on a
/// subentity of a geometric entity keeps AcDbAssocPersSubentId of the subentity
/// and the cached subentity geometry (such as the [x,y,z] of a vertex
/// subentity, the AcDbCurve of an edge subentity, etc.). It can then check
/// whether the subentity really changed by obtaining the subentity geometry
/// from the geometric entity and comparing it with the cached geometry. If they
/// are the same, the change notification is ignored.
/// </para> <para>
/// A better way to add a custom dependency class is to derive a custom
/// AcDbAssocDependencyBody class (see comments at the AcDbAssocDependencyBody
/// class) and make objects of this class owned by the parent AcDbAssocDependency
/// objects. The relation between AcDbAssocDependency and AcDbAssocDependencyBody
/// classes is analogous to the relation between AcDbAssocAction and AcDbAssocActionBody
/// classes, so please read the comments at the AcDbAssocAction class for more
/// information. In particular, the dependency  body is fully owned by its parent
/// dependency, such as when the parent dependency is erased, it also erases the
/// owned dependency body.
/// </para> <para>
/// A more memory efficient way to implement custom dependency behavior is to
/// use objects of the AcDbAssocDependency base class and let them delegate to
/// the owning action (see the isDelegatingToOwningAction() property). The
/// AcDbAssocActionBody owned by the action owning the dependency then overrides
/// methods like AcDbAssocActionBody::isRelevantDependencyChangeOverride() to
/// implement the custom dependency behavior.
///
/// </para> </summary>
///
class ACDB_PORT AcDbAssocDependency : public AcDbObject
{
public:
    ACRX_DECLARE_MEMBERS(AcDbAssocDependency);

    /// <summary> Default constructor. </summary>
    /// <param name="createImpObject"> See AcDbAssocCreateImpObject. </param>
    ///
    explicit AcDbAssocDependency(AcDbAssocCreateImpObject createImpObject = kAcDbAssocCreateImpObject);

    /// <summary>
    /// Returns AcDbObjectId of an object of a class derived from
    /// AcDbAssocDependencyBody, or a null id if no dependency body object
    /// has been set. The AcDbAssocDependencyBody object is owned by this
    /// AcDbAssocDependency object and implements the body of the custom
    /// dependency. See the comments at the AcDbAssocDependencyBody class for
    /// more information.
    /// </summary>
    /// <returns>
    /// AcDbObjectId of an object of a class derived from AcDbAssocDependencyBody
    /// or null id.
    /// </returns>
    ///
    AcDbObjectId dependencyBody() const;

    /// <summary>
    /// Sets AcDbObjectId of an object of a class derived from
    /// AcDbAssocDependencyBody. The AcDbAssocDependencyBody object becomes
    /// owned by this AcDbAssocDependency object and implements the body of
    /// the custom dependency. See the comments at the AcDbAssocDependencyBody
    /// class for more information.
    /// </summary>
    /// <param name="dependencyBodyId">
    /// AcDbObjectId of an object of a class derived from AcDbAssocDependencyBody
    /// or null id.
    /// </param>
    /// <returns> Acad::ErrorStatus. </returns>
    ///
    Acad::ErrorStatus setDependencyBody(const AcDbObjectId& dependencyBodyId);

    /// <summary> Get the current AcDbAssocStatus of this dependency. </summary>
    /// <returns> The AcDbAssocStatus of this dependency. </returns>
    ///
    AcDbAssocStatus status() const;

    /// <summary> <para>
    /// Sets the AcDbAssocStatus of the dependency. If the status is one of the
    /// codes that indicate that the action owning the dependency will need to
    /// be evaluated (the isEvaluationRequest() predicate  returns true for such
    /// a status), it can also notify the action owning the dependency to change
    /// its status indicating that it needs to be evaluated. The action may change
    /// its status and notify the network owning the action. The network may change
    /// its status and notify its owning network, etc. until all the networks
    /// in the hirearchy are notified that they contain an action that needs to
    /// be evaluated.
    /// </para> <para>
    /// If the new status satisfies the isEvaluationRequest() predicate and
    /// evaluationRequestSeverityLevel() of the new status is lower than the
    /// current evaluation request status of the dependency, the current higher
    /// status of the dependency is kept and not overwritten by the new lower
    /// status. Also, if the current status of the dependency satisfies the
    /// isTobeSkipped() predicate, it is not overwritten by any new status that
    /// isEvaluationRequest(). To change the dependency status in such a case, the
    /// dependency status needs to be first changed to kIsUpToDateAssocStatus,
    /// and after that it can be changed to an isEvaluationRequest() status.
    /// </para> </summary>
    /// <param name="newStatus"> The new AcDbAssocStatus of the dependency. </param>
    /// <param name="notifyOwningAction">
    /// If true, and the passed-in status indicates that the dependency needs to
    /// be evaluated, the status of the AcDbAssocAction owning this dependency
    /// is set to the same status (unless the action evaluation status is already
    /// more severe than the new one). The action then notifies its owning network.
    /// </param>
    /// <returns> Acad::ErrorStatus. </returns>
    ///
    Acad::ErrorStatus setStatus(AcDbAssocStatus newStatus,
                                bool            notifyOwningAction = true);

    /// <summary>
    /// Returns true iff the AcDbAssocAction owning the dependency uses the
    /// value of the dependent-on AcDbObject. It just returns the value of a bool
    /// data member owned by AcDbAssocDependency. The default value of this flag
    /// is false.
    /// </summary>
    /// <returns>
    /// <para> true  = Action uses the value of the dependent-on object. </para>
    /// <para> false = Action does not use the value of the dependent-on object. </para>
    /// </returns>
    ///
    bool isReadDependency() const;

    /// <summary>
    /// Returns true iff the AcDbAssocAction owning the dependency changes the
    /// value of the dependent-on AcDbObject. It just returns the value of a bool
    /// data member owned by AcDbAssocDependency. The default value of this flag
    /// is false.
    /// </summary>
    /// <returns>
    /// <para> true  = Action changes the value of the dependent-on object. </para>
    /// <para> false = Action does not change the value of the dependent-on object. </para>
    /// </returns>
    ///
    bool isWriteDependency() const;

    /// <summary>
    /// Sets what isReadDependency() should return.
    /// </summary>
    /// <param name="yesNo"> Value that isReadDependency() should return. </param>
    ///
    void setIsReadDependency(bool yesNo);

    /// <summary>
    /// Sets what isWriteDependency() should return.
    /// </summary>
    /// <param name="yesNo"> Value that isWriteDependency() should return. </param>
    ///
    void setIsWriteDependency(bool yesNo);

    /// <summary> <para>
    /// Returns true iff the AcDbAssocAction owning the dependency requires the
    /// dependent-on AcDbObject to be in the expected "object state" with
    /// respect to the list of dependencies on the object, before the action can
    /// be evaluated.
    /// </para> <para>
    /// It means actions that own write-type dependencies on the object that
    /// precede this dependency in the list of all dependencies on the object
    /// need to be evaluated, and actions owning write-type dependencies on the
    /// object that follow this dependency in the list must not be evaluated.
    /// This also means the object is in the object state just after evaluation
    /// of the immediately preceding action that modified the object but before
    /// evaluation of the next action that would modify the object again and
    /// bring it to the next object state.
    /// </para> <para>
    /// It just returns the value of a bool data member owned by AcDbAssocDependency.
    /// The default value of this flag is true.
    /// </para> </summary>
    /// <returns>
    /// <para>
    /// true = Dependency is object state dependent, i.e. its position in the
    /// list of dependencies on the object matters.
    /// </para>
    /// <para>
    /// false = Dependency is not object state dependent, i.e. its position in
    /// the list of dependencies on the object matters.
    /// </para>
    /// </returns>
    ///
    bool isObjectStateDependent() const;

    /// <summary>
    /// Sets what isObjectStateDependent() should return. It just sets the bool
    /// data member owned by AcDbAssocDependency.
    /// </summary>
    /// <param name="yesNo"> Value that isObjectStateDependent() should return. </param>
    ///
    void setIsObjectStateDependent(bool yesNo);

    /// <summary> <para>
    /// Returns order of the dependency, i.e. the order where it should be
    /// positioned in the list of all dependencies on an AcDbObject. Dependencies
    /// with lower order() are positioned in the list before the dependencies
    /// with higher order(). Dependencies with the same order() are ordered
    /// based on how they were added to the object, the dependencies added
    /// later are positioned after the dependencies added earlier.
    /// </para> <para>
    /// It just returns the value of an int data member owned by AcDbAssocDependency.
    /// Default value of this data member is 0.
    /// </para> </summary>
    /// <returns>
    /// Order is any integer value stored in the dependency. The default
    /// value is 0.
    /// </returns>
    ///
    int order() const;

    /// <summary>
    /// Sets what order() should return. It just sets the int data member owned
    /// by AcDbAssocDependency. Notice that if a dependency has already been
    /// attached to an object by calling attachToObject(), calling setOrder()
    /// does not reposition the dependency in the list and should not be done.
    /// </summary>
    /// <param name="yesNo"> Value that order() should return. </param>
    ///
    void setOrder(int newOrder);

    /// <summary>
    /// Every dependency is owned (in the logical as well as in the AutoCAD
    /// database sense) by an AcDbAssocAction.
    /// </summary>
    /// <returns> The owning AcDbAssocAction. </returns>
    ///
    AcDbObjectId owningAction() const { return ownerId(); }

    /// <summary> <para>
    /// Every dependency is owned (in the logical as well as in the AutoCAD
    /// database sense) by an AcDbAssocAction.
    /// </para> <para>
    /// This method should not be called directly, AcDbAssocAction::add/removeDependency()
    /// should be used, which in turn calls setOwningAction(), but it does more.
    /// </para> </summary>
    /// <param name="actionId"> The AcDbAssocAction owning this dependency. </param>
    /// <returns> Acad::ErrorStatus. </returns>
    ///
    Acad::ErrorStatus setOwningAction(const AcDbObjectId& actionId);

    /// <summary>
    /// A dependency is attached to the dependent-on AcDbObject as a persistent
    /// reactor.
    /// </summary>
    /// <returns>
    /// The AcDbObject this dependency is attached to, or AcDbObjectId::kNull
    /// if the dependency is not attached to any object.
    /// </returns>
    ///
    AcDbObjectId dependentOnObject() const;

    /// <summary>
    /// A dependency is attached as a persistent reactors to all objects of
    /// the AcDbCompoundObjectId. If the dependency does not use AcDbCompoundObjectId,
    /// the returned AcDbCompoundObjectId is of the dependentOnObject() converted
    /// to an AcDbCompoundObjectId.
    /// </summary>
    /// <param name="compoundId">
    /// The AcDbCompoundObjectId, either directly kept in this dependency, or
    /// created from the dependentOnObject() AcDbObjectId.
    /// </param>
    /// <returns> Acad::ErrorStatus. </returns>
    ///
    Acad::ErrorStatus getDependentOnCompoundObject(AcDbCompoundObjectId& compoundId) const;

    /// <summary>
    /// Returns true if the dependency is using AcDbCompoundObjectId to depend
    /// on the dependent-on-object.
    /// </summary>
    /// <returns>
    /// True iff AcDbCompoundObjectId is used to identify the dependent-on-object.
    /// </returns>
    ///
    bool isDependentOnCompoundObject() const;

    /// <summary>
    /// All dependencies attached to the same AcDbObject are kept in a doubly-linked
    /// list. The order in the list is determied by the order() property of the
    /// dependencies in the list.
    /// </summary>
    /// <returns>
    /// The previous dependency in the list of dependencies of an AcDbObject or
    /// AcDbObjectId::kNull if it is the first dependency in the list.
    /// </returns>
    ///
    AcDbObjectId prevDependencyOnObject() const;

    /// <summary>
    /// All dependencies attached to the same AcDbObject are kept in a doubly-linked
    /// list. The order in the list is determied by the order() property of the
    /// dependencies in the list.
    /// </summary>
    /// <returns>
    /// The next dependency in the list of dependencies of an AcDbObject or
    /// AcDbObjectId::kNull if it is the last dependency in the list.
    /// </returns>
    ///
    AcDbObjectId nextDependencyOnObject() const;

    /// <summary>
    /// A dependency is attached to the dependent-on AcDbObject as a persistent
    /// reactor, but it may also not be attached to any object. In this case
    /// AcDbAssocDependency::dependentOnObject() returns AcDbObjectId::kNull.
    /// </summary>
    /// <returns> true iff the dependency it attached to an object. </returns>
    ///
    bool isAttachedToObject() const { return !dependentOnObject().isNull(); }

    /// <summary> <para>
    /// Attaches this dependency to a given AcDbCompoundObjectId as a persistent
    /// reactor and also orders it to be at the correct position in the list
    /// of dependencies on the object, based on the dependency order(). The
    /// dependency that is being attached must not be currently attached to
    /// any object.
    /// </para> <para>
    /// When the AcDbCompoundObjectId contains multiple ids, it attaches the
    /// dependency to the AcDbCompoundObjectId::topId(), and also attaches this
    /// dependency as a persistent reactor to all the other objects that the
    /// AcDbCompoundObjectId references.
    /// </para> <para>
    /// The object may refuse dependencies being attached to it by deriving from
    /// AcDbAssocDependencyPE AcRx protocol extension class, implementing the
    /// allowsDependencies() predicate and attaching the protocol extension to
    /// the object. In this case attachToObject() then returns eVetoed error status.
    /// The client code should check the returned error status and do not assume
    /// that it is always eOk. The AcDbAssocDependencyPE also allows the object
    /// to redirect the dependency attachment to another object by implementing
    /// the redirectDependencyAttachment() method.
    /// </para> </summary>
    /// <param name="compoundId"> The AcDbCompoundObjectId to attach the
    /// dependency to. If regular AcDbObjectId is passed in, it is automatically
    /// converted to AcDbCompoundObjectId.
    /// </param>
    /// <returns> Acad::ErrorStatus. </returns>
    ///
    Acad::ErrorStatus attachToObject(const AcDbCompoundObjectId& compoundId);

    /// <summary>
    /// Transfers the dependency from the current object to another object.
    /// It does it by first detaching it from its current object and then attaching
    /// to the new one. It is similar to calling detachFromObject() followed
    /// by attachToObject(), but it also redirects other information in the dependency,
    /// such as the AcDbAssocPersSubentId owned by AcDbAssocGeomDependency.
    /// </summary>
    ///
    Acad::ErrorStatus transferToObject(const AcDbCompoundObjectId& compoundId);

    /// <summary>
    /// Returns current status of the dependentOnObject, can be eOk,
    /// eNotInitializedYet or eInvalidObjectId.
    /// </summary>
    /// <returns> Acad::ErrorStatus. </returns>
    ///
    Acad::ErrorStatus dependentOnObjectStatus() const;

    /// <summary>
    /// Detaches this dependency from the AcDbObject it is currently attached
    /// to. It also detatches it from the list of persistent reactors of the
    /// dependent-on-object, and if the dependency is on a compound object,
    /// it detaches this dependency from the persistent reactor lists of all
    /// objects the dependency is currently attached to.
    /// </summary>
    /// <returns> Acad::ErrorStatus. </returns>
    ///
    Acad::ErrorStatus detachFromObject();

    /// <summary> <para>
    /// Updates the object the dependency depends on, based on the information
    /// the dependency obtains from the owning action. If the dependency owns
    /// an AcDbAssocDependencyBody object, its updateDependentOnObject() method
    /// is called, otherwise the default implementation of this method does
    /// nothing.
    /// </para> <para>
    /// The dependency object must be opened at least for read. This method is
    /// not made "const" because it could potentially update some cache kept in
    /// the dependency, but it is not expected to do so.
    /// </para> </summary>
    /// <returns> Acad::ErrorStatus. </returns>
    ///
    Acad::ErrorStatus updateDependentOnObject();

    /// <summary> <para>
    /// Sets the dependent-on object of this dependency to be the given
    /// AcDbCompoundObjectId.
    /// </para><para>
    /// Unlike attachToObject(), it does not add this dependency to the list of
    /// persistent reactors of the object. Therefore the dependency is in limbo,
    /// neither attached nor non-attached. To really attach this dependency
    /// to an object after setDependentOnObject() has already been called with a
    /// non-null AcDbObjectId, setDependentOnObject() needs to be called first
    /// with a null compoundId before attachToObject() is called.
    /// </para> <para>
    /// This method can mess-up the dependency and the client code should not
    /// have (m)any reasons to call it.
    /// </para> </summary>
    /// <param name="compoundId">
    /// The AcDbCompoundObjectId the dependency should depend-on (may be null).
    /// </param>
    ///
    void setDependentOnObject(const AcDbCompoundObjectId& compoundId);

    /// <summary>
    /// Gets the first dependency on the given AcDbObject. Dependencies are attached
    /// to AcDbObjects in the form of persistent reactors and are ordered on the
    /// object based on their order(). The first dependency in this ordered
    /// list is returned.
    /// </summary>
    /// <param name="pObject">
    /// The AcDbObject whose first dependency is requested. The object needs
    /// to be open at least for read.
    /// </param>
    /// <param name="firstDependencyId">
    /// The returned first dependency on the AcDbObject, or AcDbObjectId::kNull
    /// if there are no dependencies attached to the AcDbObject.
    /// </param>
    /// <returns> Acad::ErrorStatus. </returns>
    ///
    static Acad::ErrorStatus getFirstDependencyOnObject(const AcDbObject* pObject,
                                                        AcDbObjectId& firstDependencyId);

    /// <summary>
    /// Gets all dependencies on the given AcDbObject. Dependencies are attached
    /// to AcDbObjects in the form of persistent reactors and are ordered on the
    /// object based on their order(). The retuned array contains the dependencies
    /// properly ordered.
    /// </summary>
    /// <param name="pObject">
    /// The AcDbObject whose dependencies are requested. The object needs
    /// to be open at least for read.
    /// </param>
    /// <param name="readDependenciesWanted">  Read-type dependencies wanted. </param>
    /// <param name="writeDependenciesWanted"> Write-type dependencies wanted. </param>
    /// <param name="dependencyIds"> Returned AcDbObjectIds of the AcDbAssocDependencies. </param>
    /// <returns> Acad::ErrorStatus. </returns>
    ///
    static Acad::ErrorStatus getDependenciesOnObject(const AcDbObject* pObject,
                                                     bool readDependenciesWanted,
                                                     bool writeDependenciesWanted,
                                                     AcDbObjectIdArray& dependencyIds);

    /// <summary>
    /// Gets all dependencies on the given AcDbObject and notifies them about a
    /// change by setting their status. It notifies both the primary dependencies
    /// on the object (when the object is the dependentOnObject() of the dependency)
    /// as well as secondary dependencies (when the object is one of the objects
    /// in the AcDbCompoundObjectId of the dependency).
    /// </summary>
    /// <param name="pObject">
    /// The AcDbObject whose dependencies are to be notified. The object needs
    /// to be open at least for read.
    /// </param>
    /// <param name="newStatus"> The new status to be set to the dependencies. </param>
    /// <returns> Acad::ErrorStatus. </returns>
    ///
    static Acad::ErrorStatus notifyDependenciesOnObject(const AcDbObject* pObject,
                                                        AcDbAssocStatus   newStatus);

    /// <summary> <para>
    /// Returns whether some dependency methods delegate to the action that
    /// owns the dependency if the method is not directly implemented in the
    /// dependency or in the AcDbAssocDependencyBody object that the dependency
    /// may own. The default is true, i.e. the delegation takes place.
    /// Examples of dependency methods that perform the delegation to the owning
    /// action are methods like isRelevantChange(), hasCachedValue(), isEqualTo(),
    /// isDependentOnTheSameThingAs(), evaluate(), etc.
    /// </para> <para>
    /// The reason for this delegation is to give developers of custom actions
    /// more freedom in their choice where to keep the data related to the
    /// dependencies owned by their custom actions, and to reduce the need
    /// to derive new dependency body classes.
    /// </para> </summary>
    /// <returns>
    /// Returns whether some dependency methods delegate to the owning action.
    /// The default is yes, i.e. the dependencies do delegate.
    /// </returns>
    ///
    bool isDelegatingToOwningAction() const;

    /// <summary> <para>
    /// Controls whether some dependency methods delegate to the action that
    /// owns the dependency if the method is not directly implemented in the
    /// dependency or in the AcDbAssocDependencyBody object that the dependency
    /// may own. The default is true, i.e. the delegation takes place.
    /// Examples of dependency methods that perform the delegation to the owning
    /// action are methods like isRelevantChange(), hasCachedValue(), isEqualTo(),
    /// isDependentOnTheSameThingAs(), evaluate(), etc.
    /// </para> <para>
    /// The reason for this delegation is to give developers of custom actions
    /// more freedom in their choice where to keep the data related to the
    /// dependencies owned by their custom actions, and to reduce the need
    /// to derive new dependency body classes.
    /// </para> </summary>
    /// <param name="yesNo">
    /// Controls whether some dependency methods delegate to the owning action.
    /// The default is yes, i.e. the dependencies do delegate.
    /// </param>
    ///
    void setIsDelegatingToOwningAction(bool yesNo);

    /// <summary> <para>
    /// Returns true iff the dependency currently holds the cached value of the
    /// "thing" it depends on. It does not necessarily mean that the cached value
    /// is current and the same as the current value of the dependent-on "thing".
    /// If the thing changed, the cached value the dependency holds may still be
    /// the previously cached value. But if the dependency status is
    /// kIsUpToDateAssocStatus, the cached value should be in sync with the
    /// "thing" the dependency depends on.
    /// </para> <para>
    /// The default implementation of this predicate calls the owning
    /// action's AcDbAssocAction::hasDependencyCachedValue(), i.e. it delegates
    /// the decision to the action that owns the dependency. This delegation
    /// can be turned off by calling setIsDelegatingToOwningAction(false). The
    /// default implementation of AcDbAssocAction::hasDependencyCachedValue(),
    /// or if there is delegation, returns false.
    /// </para> <para>
    /// If the dependency owns an AcDbAssocDependencyBody object that overrides
    /// the hasCachedValueOverride() predicate, this predicate is called and it
    /// supersedes the default implementation.
    /// </para> </summary>
    /// <returns>
    /// Returns true iff the dependency holds a cached value. By default
    /// returns false.
    /// </returns>
    ///
    bool hasCachedValue() const;

    /// <summary> <para>
    /// This predicate returns true iff the dependent-on "thing" really changed
    /// in such a way that the change is relevant to this particular dependency
    /// type. For example, if the dependency is on a subentity of a geometric
    /// entity, it should check whether the geometry of this subentity is really
    /// different from what it was before (such as by comparing it with the
    /// cached geometry).
    /// </para> <para>
    /// Using this predicate it is possible to filter-out false or irrelevant
    /// change notifications and thus avoid unnecessary action reevaluations.
    /// When this predicate returns false, the change notification from the
    /// dependent-on object is ignored and the status of this dependency is
    /// not changed.
    /// </para> <para>
    /// The default implementation of this predicate calls the owning
    /// action's AcDbAssocAction::isRelevantDependencyChange() predicate, i.e.
    /// it delegates the decision to the action that owns the dependency. This
    /// delegation can be turned off by calling setIsDelegatingToOwningAction(false).
    /// The default implementation of AcDbAssocAction::isRelevantDependencyChange(),
    /// or if there is no delegation, returns true.
    /// </para> <para>
    /// If the dependency owns an AcDbAssocDependencyBody object that overrides
    /// the isRelevantChangeOverride() predicate, this predicate is called and it
    /// supersedes the default implementation.
    /// </para> </summary>
    /// <returns>
    /// <para> true  = The object change is relevant (default). </para>
    /// <para> false = The object change is irrelevant and can be ignored. </para>
    /// </returns>
    ///
    bool isRelevantChange() const;

    /// <summary>
    /// Dependencies can be notified about arbitrary events using the following
    /// method.
    /// </summary>
    ///
    Acad::ErrorStatus notification(AcDbAssocNotificationData* pNotifData);

    /// <summary> <para>
    /// This method returns  true iff this dependency depends on exactly the
    /// same "thing" (such as on the same subentity of the same entity) as the
    /// other dependency.
    /// </para> <para>
    /// The default implementation compares the AcDbObjectIds of the
    /// two dependent-on objects and if they are not equal, returns false.
    /// Otherwise it calls the owning action's
    /// AcDbAssocAction::areDependenciesOnTheSameThing(), i.e. it
    /// delegates the decision to the action that owns the dependency. This
    /// delegation can be turned off by calling setIsDelegatingToOwningAction(false).
    /// The default implementation of AcDbAssocAction::areDependenciesOnTheSameThing(),
    /// or if there is no delegation, returns true.
    /// returns true
    /// </para> <para>
    /// If the dependency owns an AcDbAssocDependencyBody object that overrides
    /// the isDependentOnTheSameThingAsOverride() predicate, this predicate is
    /// called and it supersedes the default implementation.
    /// </para> </summary>
    /// <param name="pOtherDependency"> The other dependency needs to be open for read. </param>
    /// <returns>
    /// <para> true  = Both dependencies depend on exactly the same "thing". </para>
    /// <para> false = They depend on different "things". </para>
    /// </returns>
    ///
    bool isDependentOnTheSameThingAs(const AcDbAssocDependency* pOtherDependency) const;

    /// <summary>
    /// Returns true iff the dependent on object is read-only, i.e. the object
    /// is not allowed to be changed. The default implementation returns true
    /// if the dependent-on object is an AcDbEntity on locked layer, otherwise
    /// it returns false.
    /// </summary>
    /// <returns> True the dependent-on object is not allowed to be changed. </returns>
    ///
    bool isDependentOnObjectReadOnly() const;

    /// <summary> <para>
    /// Compares this dependency with the given dependency and returns true if
    /// and only if they are equal (whatever it means). Both dependencies need
    /// be open at least for read.
    /// </para> <para>
    /// The default implementation does some general tests and if they turn
    /// out that the dependencies are not equal, it returns false. Otherwise
    /// it calls the owning action's AcDbAssocAction::areDependenciesEqual(),
    /// i.e. it delegates the decision to the action that owns the dependency.
    /// This delegation can be turned off by calling setIsDelegatingToOwningAction(false).
    /// The default implementation of AcDbAssocAction::areDependenciesEqual(),
    /// or if there is no delegation, returns true.
    /// </para> <para>
    /// If the dependency owns an AcDbAssocDependencyBody object that overrides
    /// the isEqualToOverride() predicate, this predicate is called and it
    /// supersedes the default implementation.
    /// </para> </summary>
    /// <param name="pOtherDependency"> The other dependency needs to be open for read. </param>
    /// <returns> True iff the two dependencies are equal. </returns>
    ///
    bool isEqualTo(const AcDbAssocDependency* pOtherDependency) const;

    /// <summary> <para>
    /// Predicate that returns true iff the system is currently evaluating an
    /// action or a network of actions.
    /// </para> <para>
    /// Notice that when action evaluation is in progress, dependency notifications
    /// are disabled. When an object that has dependencies attached to itself is
    /// changed, the dependencies ignore this notification and consequently also
    /// do not notify the actions owning the dependencies. This is necessary because
    /// otherwise if one action evaluation modified some objects, the dependencies
    /// on these objects would be notified and the status of other actions owning
    /// these dependencies would be changed, requesting the actions to be evaluated
    /// again. This would lead to infinite loops.
    /// </para> </summary>
    /// <returns> True iff action evaluation is in progress. </returns>
    ///
    bool isActionEvaluationInProgress() const;

    /// <summary>
    /// Returns the current AcDbAssocEvaluationCallback set by the
    /// AcDbAssocAction::evaluate() call, or NULL if no action evaluation
    /// is in progress. Notice that when action evaluation is in progress, there
    /// always is a non-NULL AcDbAssocEvaluationCallback.
    /// </summary>
    /// <returns> The current AcDbAssocEvaluationCallback or NULL. </returns>
    ///
    AcDbAssocEvaluationCallback* currentEvaluationCallback() const;

    /// <summary> <para>
    /// Called by the AcDbAssocAction::evaluateDependencies() to update the
    /// "dirty" dependencies of the action. The custom dependency classes
    /// can implement code to cache the dependent-on data in order to allow
    /// filtering-out irrelevant notifications, or do some other work.
    /// </para> <para>
    /// The evalaute() method calls AcDbAssocDependencyBody::evaluateOverride()
    /// to do the real work.
    /// </para> <para>
    /// If there is no owned dependency body object, the default implementation
    /// calls AcDbAssocAction::evaluateDependency(), i.e. it delegates the work
    /// to the action that owns the dependency. The default implementation of
    /// AcDbAssocAction::evaluateDependency() just sets the dependency status
    /// to kIsUpToDateAssocStatus. This delegation can be turned off by calling
    /// setIsDelegatingToOwningAction(false).
    /// </para> </summary>
    ///
    void evaluate();

    /// <summary> <para>
    /// Implementation of the persistent reactor notification callback.
    /// </para> <para>
    /// If the dependency owns an AcDbAssocDependencyBody object, its
    /// erasedOverride() method is called at the end of the default
    /// implementation.
    /// </para> </summary>
    /// <param name="dbObj"> </param>
    /// <param name="isErasing"> </param>
    ///
    virtual void erased(const AcDbObject* dbObj, Adesk::Boolean isErasing = true);

    /// <summary> <para>
    /// Implementation of the persistent reactor notification callback.
    /// </para> <para>
    /// If the dependency owns an AcDbAssocDependencyBody object, its
    /// modifiedOverride() method is called at the end of the default
    /// implementation.
    /// </para> </summary>
    /// <param name="dbObj"> </param>
    ///
    virtual void modified(const AcDbObject* dbObj);

    /// <summary> <para>
    /// Implementation of the persistent reactor notification callback.
    /// </para> <para>
    /// If the dependency owns an AcDbAssocDependencyBody object, its
    /// clonedOverride() method is called. After that the owning action's
    /// AcDbAssocAction::dependentObjectCloned() callback method is called
    /// to notify the action that an object the action depends on has been
    /// cloned.
    /// </para> </summary>
    /// <param name="pDbObj"> The original object. </param>
    /// <param name="pNewObj"> The newly created clone. </param>
    ///
    virtual void copied(const AcDbObject* pDbObj, const AcDbObject* pNewObj);

private:
    void setPrevDependencyOnObject(const AcDbObjectId& depId);
    void setNextDependencyOnObject(const AcDbObjectId& depId);

    friend class AcDbImpAssocDependency;
    friend class AcDbAssocDeepCloneRxEventReactor;
    friend class AcDbAssocDeepCloneData;

}; // class AcDbAssocDependency

/// <summary>
/// Allows to disable change notifications to AcDbAssocDependencies.
/// </summary>
///
class ACDB_PORT AcDbAssocDependencyNotificationDisabler
{
public:
    explicit AcDbAssocDependencyNotificationDisabler(bool disableIt = true);
    ~AcDbAssocDependencyNotificationDisabler();
    static bool isDisabled();
private:
    const bool mPrev;
};

#pragma pack ( pop )


text:
package org.openxava.test.calculators;

import java.sql.*;

import org.apache.commons.logging.*;
import org.openxava.calculators.*;
import org.openxava.component.*;
import org.openxava.util.*;

/**
 * @author Javier Paniza
 */
public class DetailsCountCalculator implements IJDBCCalculator {

	private IConnectionProvider provider;
	private int year;
	private int number;

	public void setConnectionProvider(IConnectionProvider proveedor) {
		this.provider = proveedor;
	}

	public Object calculate() throws Exception {
		Connection con = provider.getConnection();
		try {
			String table = MetaComponent.get("Invoice").getAggregateMapping("InvoiceDetail").getTable();
			PreparedStatement ps = con.prepareStatement("select count(*) from " + table + " where INVOICE_YEAR = ? and INVOICE_NUMBER = ?");
			ps.setInt(1, getYear());
			ps.setInt(2, getNumber());
			ResultSet rs = ps.executeQuery();
			rs.next();
			Integer result = new Integer(rs.getInt(1));
			ps.close();
			return result;
		}
		finally {
			con.close();
		}
	}

	public int getYear() {
		return year;
	}

	public int getNumber() {
		return number;
	}

	public void setYear(int year) {
		this.year = year;
	}

	public void setNumber(int numero) {
		this.number = numero;
	}

}


text:
import { moduleForModel, test } from 'ember-qunit';

moduleForModel('observation-component', 'Unit | Model | Observation_Component', {
  needs: [
    'model:meta',
    'model:narrative',
    'model:resource',
    'model:extension',
    'model:codeable-concept',
    'model:quantity',
    'model:range',
    'model:ratio',
    'model:sampled-data',
    'model:attachment',
    'model:period',
    'model:observation-reference-range'
  ]
});

test('it exists', function(assert) {
  const model = this.subject();
  assert.ok(!!model);
});


text:
<?xml version="1.0" encoding="utf-8"?>
<resources>
    <color name="paper_button_shadow_color">#000000</color>
</resources>


text:
#include "UploadManager.h"
#include <d3d12.h>
#include "d3dx12.h"
#include "Device.h"
#include <atomic>
#include "CommandQueue.h"
#include <vxEngineLib/Event.h>
#include "FrameData.h"

namespace UploadManagerCpp
{
	const u64 g_bufferSize = d3d::AlignedSize<20u MBYTE, 64u KBYTE>::size;;
}

struct UploadManager::UploadTask
{
	UploadTaskType type;
	union
	{
		UploadTaskBuffer buffer;
		UploadTaskTexture texture;
	};
	Event evt;

	UploadTask() {}
};

struct QueuedBufferTask
{
	ID3D12Resource* dst;
	u32 dstOffset;
	u32 size;
	u32 state;
};

struct UploadManager::QueuedUploadTask
{
	UploadTaskType type;
	std::unique_ptr<u8[]> m_data;
	union
	{
		UploadTaskTextureDesc texture;
		QueuedBufferTask buffer;
	};

	QueuedUploadTask() {}
};

struct UploadManager::UploadDesc
{
	D3D12_RANGE range;
	const u8* data;
	u32 size;
};

UploadManager::UploadManager()
	:m_taskMutex(),
	m_tasks(),
	m_queueMutex(),
	m_queue(),
	m_capacity(0),
	m_size(0),
	m_currentCommandList(nullptr),
	m_buildList(0),
	m_commandLists(),
	m_uploadBuffer(),
	m_heap()
{

}

UploadManager::~UploadManager()
{

}

bool UploadManager::createHeap(ID3D12Device* device)
{
	if (!m_heap.createBufferHeap(UploadManagerCpp::g_bufferSize * 2, D3D12_HEAP_TYPE_UPLOAD, device))
		return false;

	m_heap.setName(L"UploadManagerHeap");

	return true;
}
bool UploadManager::initialize(ID3D12Device* device, FrameData* frameData, u32 frameCount)
{
	m_bufferIndex = 0;

	if (!createHeap(device))
		return false;

	d3d::HeapCreateBufferResourceDesc desc;
	desc.size = UploadManagerCpp::g_bufferSize;
	desc.state = D3D12_RESOURCE_STATE_GENERIC_READ;
	desc.resource = m_uploadBuffer[0].getAddressOf();
	desc.flags = D3D12_RESOURCE_FLAG_NONE;
	if (!m_heap.createResourceBuffer(desc))
		return false;

	desc.resource = m_uploadBuffer[1].getAddressOf();
	if (!m_heap.createResourceBuffer(desc))
		return false;

	m_commandLists = std::make_unique<d3d::GraphicsCommandList[]>(frameCount);
	for (u32 i = 0; i < frameCount; ++i)
	{
		if (!m_commandLists[i].create(device, D3D12_COMMAND_LIST_TYPE_DIRECT, frameData[i].m_allocatorUpload.get(), nullptr))
			return false;
	}

	m_capacity = UploadManagerCpp::g_bufferSize;

	return true;
}

void UploadManager::shutdown()
{
	m_capacity = 0;

	m_commandLists.reset();
	m_uploadBuffer[0].destroy();
	m_uploadBuffer[1].destroy();
	m_heap.destroy();
}

void UploadManager::uploadData(const UploadDesc &desc)
{
	u8* ptr = nullptr;
	auto hresult = m_uploadBuffer[m_bufferIndex]->Map(0, &desc.range, (void**)&ptr);

	ptr = ptr + desc.range.Begin;
	memcpy(ptr, desc.data, desc.size);
	m_uploadBuffer[m_bufferIndex]->Unmap(0, &desc.range);
}

void UploadManager::pushTaskBuffer(ID3D12Resource* dstBuffer, u32 offset, u32 dstOffset, u32 size, u32 state)
{
	UploadTask job;
	job.type = UploadTaskType::Buffer;
	job.buffer.dst = dstBuffer;
	job.buffer.srcOffset = offset;
	job.buffer.dstOffset = dstOffset;
	job.buffer.size = size;
	job.buffer.state = state;

	std::lock_guard<std::mutex> lock(m_taskMutex);
	m_tasks.push_back(job);
}

void UploadManager::pushTaskTexture(const UploadTaskTextureDesc &desc, u32 srcOffset)
{
	UploadTask job;
	job.type = UploadTaskType::Texture;
	job.texture.dst = desc.dst;
	job.texture.dim = desc.dim;
	job.texture.format = desc.format;
	job.texture.rowPitch = desc.rowPitch;
	job.texture.srcOffset = srcOffset;
	job.texture.dstOffset = desc.slice;
	job.texture.state = desc.state;

	std::lock_guard<std::mutex> lock(m_taskMutex);
	m_tasks.push_back(job);
}

bool UploadManager::tryUploadBuffer(const u8* data, ID3D12Resource* dstBuffer, u32 dstOffset, u32 size, u32 state)
{
	auto offset = d3d::getAlignedSize(m_size, 256u);
	auto alignedSize = d3d::getAlignedSize(size, 256u);
	auto newSize = offset + alignedSize;
	if (newSize >= m_capacity)
	{
		return false;
	}

	UploadDesc desc;
	desc.range.Begin = offset;
	desc.range.End = offset + alignedSize;
	desc.data = data;
	desc.size = size;

	uploadData(desc);
	pushTaskBuffer(dstBuffer, offset, dstOffset, size, state);

	m_size = newSize;

	return true;
}

void UploadManager::pushQueueTask(QueuedUploadTask &&task)
{
	std::lock_guard<std::mutex> lock(m_queueMutex);
	m_queue.push_back(std::move(task));
}

void UploadManager::pushUploadBuffer(const u8* data, ID3D12Resource* dstBuffer, u32 dstOffset, u32 size, u32 state)
{
	Event emptyEvt;

	pushUploadBuffer(data, dstBuffer, dstOffset, size, state, emptyEvt);
}

void UploadManager::pushUploadBuffer(const u8* data, ID3D12Resource* dstBuffer, u32 dstOffset, u32 size, u32 state, const Event &evt)
{
	if (!tryUploadBuffer(data, dstBuffer, dstOffset, size, state))
	{
		QueuedUploadTask queuedTask;
		queuedTask.type = UploadTaskType::Buffer;
		queuedTask.m_data = std::make_unique<u8[]>(size);
		queuedTask.buffer.dst = dstBuffer;
		queuedTask.buffer.state = state;
		queuedTask.buffer.dstOffset = dstOffset;
		queuedTask.buffer.size = size;

		memcpy(queuedTask.m_data.get(), data, size);

		pushQueueTask(std::move(queuedTask));
	}
}

bool UploadManager::tryUploadTexture(const UploadTaskTextureDesc &desc)
{
	auto offset = d3d::getAlignedSize(m_size, 512u);
	auto alignedSize = d3d::getAlignedSize(desc.dataSize, 256u);

	auto newSize = offset + alignedSize;
	if (newSize >= m_capacity)
	{
		return false;
	}

	UploadDesc uploadDesc;
	uploadDesc.range.Begin = offset;
	uploadDesc.range.End = offset + alignedSize;
	uploadDesc.data = desc.data;
	uploadDesc.size = desc.dataSize;
	uploadData(uploadDesc);

	pushTaskTexture(desc, offset);

	m_size = newSize;

	return true;
}

void UploadManager::pushUploadTexture(const UploadTaskTextureDesc &desc)
{
	VX_ASSERT(desc.dst != nullptr);

	if (!tryUploadTexture(desc))
	{
		QueuedUploadTask queuedTask;
		queuedTask.type = UploadTaskType::Texture;
		queuedTask.m_data = std::make_unique<u8[]>(desc.dataSize);
		queuedTask.texture = desc;
		queuedTask.texture.data = queuedTask.m_data.get();

		memcpy(queuedTask.m_data.get(), desc.data, desc.dataSize);

		pushQueueTask(std::move(queuedTask));
	}
}

void UploadManager::processQueue()
{
	std::lock_guard<std::mutex> lock(m_queueMutex);

	if (m_queue.empty())
		return;

	std::vector<QueuedUploadTask> newQueue;
	newQueue.reserve(m_queue.size());

	for (auto &it : m_queue)
	{
		switch (it.type)
		{
		case UploadTaskType::Buffer:
		{
			if (!tryUploadBuffer(it.m_data.get(), it.buffer.dst, it.buffer.dstOffset, it.buffer.size, it.buffer.state))
			{
				newQueue.push_back(std::move(it));
			}
		}break;
		case UploadTaskType::Texture:
		{
			if (!tryUploadTexture(it.texture))
			{
				newQueue.push_back(std::move(it));
			}

		}break;
		default:
			break;
		}
	}

	newQueue.swap(m_queue);
}

void UploadManager::processTasks(d3d::GraphicsCommandList* commandList)
{
	for (auto &it : m_tasksBack)
	{
		switch (it.type)
		{
		case UploadTaskType::Buffer:
		{
			(*commandList)->ResourceBarrier(1, &CD3DX12_RESOURCE_BARRIER::Transition(it.buffer.dst, (D3D12_RESOURCE_STATES)it.buffer.state, D3D12_RESOURCE_STATE_COPY_DEST));

			(*commandList)->CopyBufferRegion(it.buffer.dst, it.buffer.dstOffset, m_uploadBuffer[m_bufferIndex].get(), it.buffer.srcOffset, it.buffer.size);
			(*commandList)->ResourceBarrier(1, &CD3DX12_RESOURCE_BARRIER::Transition(it.buffer.dst, D3D12_RESOURCE_STATE_COPY_DEST, (D3D12_RESOURCE_STATES)it.buffer.state));
		}break;
		case UploadTaskType::Texture:
		{
			(*commandList)->ResourceBarrier(1, &CD3DX12_RESOURCE_BARRIER::Transition(it.texture.dst, (D3D12_RESOURCE_STATES)it.texture.state, D3D12_RESOURCE_STATE_COPY_DEST));

			D3D12_PLACED_SUBRESOURCE_FOOTPRINT footprint = {};
			footprint.Offset = it.texture.srcOffset;
			footprint.Footprint.Depth = 1;
			footprint.Footprint.Format = (DXGI_FORMAT)it.texture.format;
			footprint.Footprint.Height = it.texture.dim.y;
			footprint.Footprint.RowPitch = it.texture.rowPitch;
			footprint.Footprint.Width = it.texture.dim.x;

			CD3DX12_TEXTURE_COPY_LOCATION Dst(it.texture.dst, it.texture.dstOffset);
			CD3DX12_TEXTURE_COPY_LOCATION Src(m_uploadBuffer[m_bufferIndex].get(), footprint);
			(*commandList)->CopyTextureRegion(&Dst, 0, 0, 0, &Src, nullptr);

			(*commandList)->ResourceBarrier(1, &CD3DX12_RESOURCE_BARRIER::Transition(it.texture.dst, D3D12_RESOURCE_STATE_COPY_DEST, (D3D12_RESOURCE_STATES)it.texture.state));
		}break;
		}

		if (it.evt.isValid())
		{
			it.evt.setStatus(EventStatus::Complete);
		}
	}

	m_tasksBack.clear();
}

void UploadManager::buildCommandList(FrameData* currentFrameData, u32 frameIndex)
{
	processQueue();

	{
		std::unique_lock<std::mutex> lock(m_taskMutex);
		m_tasksBack.swap(m_tasks);
		lock.unlock();
	}
	auto allocator = currentFrameData->m_allocatorUpload.get();

	if (!m_tasksBack.empty())
	{
		auto hr = allocator->Reset();

		auto& commandList = m_commandLists[frameIndex];
		hr = commandList->Reset(allocator, nullptr);

		processTasks(&commandList);

		commandList->Close();

		/*if (hr != 0)
		{
			puts("errror");
		}

		if (hr != 0)
		{
			puts("errror");
		}

		processTasks(m_currentCommandList);

		auto hresult = (*m_currentCommandList)->Close();

		if (hresult != 0)
		{
			//printf("error upload\n");
			VX_ASSERT(false);
		}*/

		m_currentCommandList = &commandList;
		m_buildList = 1;

		m_bufferIndex = (m_bufferIndex + 1) & 1;
	}

	m_size = 0;
}

void UploadManager::submitCommandList(d3d::CommandQueue* queue)
{
	if (m_buildList != 0)
	{
		queue->pushCommandList(m_currentCommandList);
		m_buildList = 0;
	}
}


text:
import { RouteRecordRaw } from 'vue-router';

export const routeQuestsView: RouteRecordRaw = {
	name: 'quests.view',
	path: ':id',
	component: () => import('./RouteQuestsView.vue'),
};


text:
<?xml version="1.0"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <modelVersion>4.0.0</modelVersion>
  <parent>
    <groupId>ru.assignment</groupId>
    <artifactId>assignment-chat</artifactId>
    <version>1.0-SNAPSHOT</version>
  </parent>

  <artifactId>client-chat</artifactId>

  <name>client-chat</name>
  <url>http://maven.apache.org</url>
  <properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
  </properties>
  <dependencies>
    <dependency>
            <groupId>ru.assignment</groupId>
            <artifactId>common-chat</artifactId>
			<version>1.0-SNAPSHOT</version>
</dependency>

  </dependencies>
</project>


text:
<meta charset="UTF-8" name="viewport" content="width=device-width, initial-scale=1.0">

    <title></title>
    <link rel="stylesheet" href="map.css">


text:
cask "signal" do
  version "1.34.5"
  sha256 "718e0c68f8475f7816b49d84fd26f215f9202e18576abeb38f0517c9262e1776"

  url "https://updates.signal.org/desktop/signal-desktop-mac-#{version}.dmg"
  appcast "https://github.com/signalapp/Signal-Desktop/releases.atom"
  name "Signal"
  homepage "https://signal.org/"

  auto_updates true

  app "Signal.app"

  zap trash: [
    "~/Library/Application Support/Signal",
    "~/Library/Preferences/org.whispersystems.signal-desktop.helper.plist",
    "~/Library/Preferences/org.whispersystems.signal-desktop.plist",
    "~/Library/Saved Application State/org.whispersystems.signal-desktop.savedState",
  ]
end


text:
package org.springframework.ldap.core.support;

import org.junit.Before;
import org.junit.Test;
import org.springframework.ldap.core.DirContextAdapter;
import org.springframework.ldap.core.NameAwareAttributes;
import org.springframework.ldap.support.LdapUtils;

import javax.naming.CompositeName;
import javax.naming.Context;
import javax.naming.InvalidNameException;
import javax.naming.Name;
import javax.naming.directory.Attributes;
import javax.naming.directory.BasicAttributes;
import java.util.Hashtable;

import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;

public class DefaultDirObjectFactoryTest {

	private Context contextMock;

	private static final Name DN = LdapUtils.newLdapName("ou=some unit, dc=jayway, dc=se");

	private static final String DN_STRING = "ou=some unit, dc=jayway, dc=se";

	private DefaultDirObjectFactory tested;

	private Context contextMock2;

	@Before
	public void setUp() throws Exception {
		contextMock = mock(Context.class);
		contextMock2 = mock(Context.class);

		tested = new DefaultDirObjectFactory();
	}

	@Test
	public void testGetObjectInstance() throws Exception {
		Attributes expectedAttributes = new NameAwareAttributes();
		expectedAttributes.put("someAttribute", "someValue");

		DirContextAdapter adapter = (DirContextAdapter) tested.getObjectInstance(contextMock, DN, null,
				new Hashtable(), expectedAttributes);

		verify(contextMock).close();

		assertThat(adapter.getDn()).isEqualTo(DN);
		assertThat(adapter.getAttributes()).isEqualTo(expectedAttributes);
	}

	@Test
	public void testGetObjectInstance_CompositeName() throws Exception {
		Attributes expectedAttributes = new NameAwareAttributes();
		expectedAttributes.put("someAttribute", "someValue");

		CompositeName name = new CompositeName();
		name.add(DN_STRING);

		DirContextAdapter adapter = (DirContextAdapter) tested.getObjectInstance(contextMock, name, null,
				new Hashtable(), expectedAttributes);

		verify(contextMock).close();

		assertThat(adapter.getDn()).isEqualTo(DN);
		assertThat(adapter.getAttributes()).isEqualTo(expectedAttributes);
	}

	@Test
	public void testGetObjectInstance_nullObject() throws Exception {
		Attributes expectedAttributes = new NameAwareAttributes();
		expectedAttributes.put("someAttribute", "someValue");

		DirContextAdapter adapter = (DirContextAdapter) tested.getObjectInstance(null, DN, null, new Hashtable(),
				expectedAttributes);

		assertThat(adapter.getDn()).isEqualTo(DN);
		assertThat(adapter.getAttributes()).isEqualTo(expectedAttributes);
	}

	@Test
	public void testGetObjectInstance_ObjectNotContext() throws Exception {
		Attributes expectedAttributes = new NameAwareAttributes();
		expectedAttributes.put("someAttribute", "someValue");

		DirContextAdapter adapter = (DirContextAdapter) tested.getObjectInstance(new Object(), DN, null,
				new Hashtable(), expectedAttributes);

		assertThat(adapter.getDn()).isEqualTo(DN);
		assertThat(adapter.getAttributes()).isEqualTo(expectedAttributes);
	}

	/**
	 * Make sure that the base suffix is stripped off from the DN.
	 *
	 * @throws Exception
	 */
	@Test
	public void testGetObjectInstance_BaseSet() throws Exception {
		Attributes expectedAttributes = new NameAwareAttributes();
		expectedAttributes.put("someAttribute", "someValue");

		when(contextMock2.getNameInNamespace()).thenReturn("dc=jayway, dc=se");

		DirContextAdapter adapter = (DirContextAdapter) tested.getObjectInstance(contextMock, LdapUtils.newLdapName(
				"ou=some unit"), contextMock2, new Hashtable(), expectedAttributes);

		verify(contextMock).close();

		assertThat(adapter.getDn().toString()).isEqualTo("ou=some unit");
		assertThat(adapter.getNameInNamespace()).isEqualTo("ou=some unit,dc=jayway,dc=se");
		assertThat(adapter.getAttributes()).isEqualTo(expectedAttributes);
	}

	@Test
	public void testConstructAdapterFromName() throws InvalidNameException {
		CompositeName name = new CompositeName();
		name.add("ldap://localhost:389/ou=People,o=JNDITutorial");
		DefaultDirObjectFactory tested = new DefaultDirObjectFactory();
		DirContextAdapter result = tested.constructAdapterFromName(new BasicAttributes(), name, "");

		assertThat(result.getDn().toString()).isEqualTo("ou=People,o=JNDITutorial");
		assertThat(result.getReferralUrl().toString()).isEqualTo("ldap://localhost:389");
	}

	@Test
	public void testConstructAdapterFromName_Ldaps() throws InvalidNameException {
		CompositeName name = new CompositeName();
		name.add("ldaps://localhost:389/ou=People,o=JNDITutorial");
		DefaultDirObjectFactory tested = new DefaultDirObjectFactory();
		DirContextAdapter result = tested.constructAdapterFromName(new BasicAttributes(), name, "");

		assertThat(result.getDn().toString()).isEqualTo("ou=People,o=JNDITutorial");
		assertThat(result.getReferralUrl().toString()).isEqualTo("ldaps://localhost:389");
	}

	@Test
	public void testConstructAdapterFromName_EmptyName() throws InvalidNameException {
		CompositeName name = new CompositeName();
		name.add("ldap://localhost:389");
		DefaultDirObjectFactory tested = new DefaultDirObjectFactory();
		DirContextAdapter result = tested.constructAdapterFromName(new BasicAttributes(), name, "");

		assertThat(result.getDn().toString()).isEqualTo("");
		assertThat(result.getReferralUrl().toString()).isEqualTo("ldap://localhost:389");
	}

	@Test
	public void testConstructAdapterFromName_OnlySlash() throws InvalidNameException {
		CompositeName name = new CompositeName();
		name.add("ldap://localhost:389/");
		DefaultDirObjectFactory tested = new DefaultDirObjectFactory();
		DirContextAdapter result = tested.constructAdapterFromName(new BasicAttributes(), name, "");

		assertThat(result.getDn().toString()).isEqualTo("");
		assertThat(result.getReferralUrl().toString()).isEqualTo("ldap://localhost:389");
	}
}


text:
var Node = require('./Node');

module.exports = FragColorNode;

function FragColorNode(options){
	options = options || {};
	Node.call(this, options);
}
FragColorNode.prototype = Object.create(Node.prototype);
FragColorNode.prototype.constructor = FragColorNode;

Node.registerClass('fragColor', FragColorNode);

FragColorNode.prototype.getInputPorts = function(key){
	return ['rgba'];
};

FragColorNode.prototype.getInputTypes = function(key){
	return ['vec4'];
};

FragColorNode.prototype.buildShader = function(){
	return function(){
		this.graph.sortNodes();
		var input = (this.getInputVariableName('rgba') || 'vec4(1)');
		return [
			this.graph.renderVaryingDeclarations(),
			this.graph.renderUniformDeclarations(),
			'void main(void){',
				this.graph.renderConnectionVariableDeclarations(),
				this.graph.renderNodeCodes(),
				'{',
					'gl_FragColor = ' + input + ';',
				'}',
			'}'
		].join('\n');

	}.bind(this);
};


text:
export const fields = {
  nameInput: {
    name: 'nameInput',
    value: '',
    initialValue: '',
    valid: false,
    invalid: true,
    dirty: false,
    pristine: true,
    error: 'Value Required',
    active: false,
    touched: true,
    visited: true,
    autofilled: false,
  },
  startDateInput: {
    name: 'startDateInput',
    value: '',
    initialValue: '',
    valid: false,
    invalid: true,
    dirty: false,
    pristine: true,
    error: 'Value Required',
    active: false,
    touched: false,
    visited: false,
    autofilled: false,
  },
  endDateInput: {
    name: 'endDateInput',
    value: '',
    initialValue: '',
    valid: false,
    invalid: true,
    dirty: false,
    pristine: true,
    error: 'Value Required',
    active: false,
    touched: false,
    visited: false,
    autofilled: false,
  },
  typeInput: {
    name: 'typeInput',
    value: '',
    initialValue: '',
    valid: false,
    invalid: true,
    dirty: false,
    pristine: true,
    error: 'Value Required',
    active: false,
    touched: false,
    visited: false,
    autofilled: false,
  },
  hostInput: {
    name: 'hostInput',
    value: '',
    initialValue: '',
    valid: false,
    invalid: true,
    dirty: false,
    pristine: true,
    error: 'Value Required',
    active: false,
    touched: false,
    visited: false,
    autofilled: false,
  },
  locationInput: {
    name: 'locationInput',
    value: '',
    initialValue: '',
    valid: false,
    invalid: true,
    dirty: false,
    pristine: true,
    error: 'Value Required',
    active: false,
    touched: false,
    visited: false,
    autofilled: false,
  },
  guestsInput: {
    name: 'guestsInput',
    value: '',
    initialValue: '',
    valid: true,
    invalid: false,
    dirty: false,
    pristine: true,
    active: false,
    touched: false,
    visited: false,
    autofilled: false,
  },
  messageInput: {
    name: 'messageInput',
    value: '',
    initialValue: '',
    valid: true,
    invalid: false,
    dirty: false,
    pristine: true,
    active: false,
    touched: false,
    visited: false,
    autofilled: false,
  },
};

export const guestList = ['David Harris'];

export const pastGuests = [{ name: 'Bilbo Baggins' }, { name: 'David Harris' }];

export const pastHosts = [{ name: 'Miss Ayden Dach' }, { name: 'Joaquin West' }];

export const eventTypes = ['birthday', 'conference', 'office', 'wedding', 'other'];

export const mockFn = (e) => e;


text:
package tests

import (
	"fmt"
	"testing"
	"time"

	"github.com/go-xorm/xorm"
)

func joinSameMapper(engine *xorm.Engine, t *testing.T) {
	var users []Userinfo
	err := engine.Join("LEFT", "`Userdetail`", "`Userinfo`.`(id)`=`Userdetail`.`Id`").Find(&users)
	if err != nil {
		t.Error(err)
		panic(err)
	}
}

func join(engine *xorm.Engine, t *testing.T) {
	var users []Userinfo
	err := engine.Join("LEFT", "userdetail", "userinfo.id=userdetail.id").Find(&users)
	if err != nil {
		t.Error(err)
		panic(err)
	}

	join2(engine, t)
	join3(engine, t)
	joinCond(engine, t)
	joinCount(engine, t)
	joinCount2(engine, t)
}

func joinCond(engine *xorm.Engine, t *testing.T) {
	var users []Userinfo
	err := engine.Join("LEFT", "userdetail", "userinfo.id=userdetail.id AND userinfo.id > ?", 0).Find(&users,
		&Userinfo{Uid: 1})
	if err != nil {
		t.Error(err)
		panic(err)
	}

	var user Userinfo
	_, err = engine.Join("LEFT", "userdetail", "userinfo.id=userdetail.id AND userinfo.id > ?", 0).Id(1).Get(&user)
	if err != nil {
		t.Error(err)
		panic(err)
	}

	total, err := engine.Join("LEFT", "userdetail", "userinfo.id=userdetail.id AND userinfo.id > ?", 0).Where("userinfo.id = ?", 1).Count(&Userinfo{})
	if err != nil {
		t.Error(err)
		panic(err)
	}
	fmt.Println(total)

	err = engine.Join("LEFT", "userdetail", "userinfo.id=userdetail.id AND userinfo.id > ?", 0).Iterate(&Userinfo{Uid: 1}, func(i int, bean interface{}) error {
		fmt.Println(i)
		return nil
	})
	if err != nil {
		t.Error(err)
		panic(err)
	}

	rows, err := engine.Join("LEFT", "userdetail", "userinfo.id=userdetail.id AND userinfo.id > ?", 0).Rows(&Userinfo{Uid: 1})
	if err != nil {
		t.Error(err)
		panic(err)
	}

	var user2 Userinfo
	for rows.Next() {
		err = rows.Scan(&user2)
		if err != nil {
			t.Error(err)
			panic(err)
		}
	}
}

func join2(engine *xorm.Engine, t *testing.T) {
	var users []Userinfo
	err := engine.Join("LEFT", "userdetail", "userinfo.id=userdetail.id").Find(&users,
		&Userinfo{Uid: 1})
	if err != nil {
		t.Error(err)
		panic(err)
	}
}

func join3(engine *xorm.Engine, t *testing.T) {
	_, err := engine.Join("LEFT", "userdetail", "userinfo.id=userdetail.id").Get(&Userinfo{Uid: 1})
	if err != nil {
		t.Error(err)
		panic(err)
	}
}

func joinCount(engine *xorm.Engine, t *testing.T) {
	count, err := engine.Join("LEFT", "userdetail", "userinfo.id=userdetail.id").Count(&Userinfo{Uid: 1})
	if err != nil {
		t.Error(err)
		panic(err)
	}
	fmt.Println(count)
}

type History struct {
	Rid       int64
	Uid       int64
	DeletedAt time.Time `xorm:"deleted"`
}

type Resource struct {
	Rid int64
}

type NewUser struct {
	Uid int64
}

func (NewUser) TableName() string {
	return "user"
}

func joinCount2(engine *xorm.Engine, t *testing.T) {
	err := engine.Sync2(new(History), new(Resource), new(NewUser))
	if err != nil {
		t.Error(err)
		panic(err)
	}

	var where = "`history`.`deleted_at` > '0001-01-01 00:00:00'"
	count, err := engine.Table("history").Join("LEFT", "resource", "`resource`.`rid`=`history`.`rid`").Join("LEFT", "user", "`user`.`uid`=`history`.`uid`").Where(where).Count(new(History))
	if err != nil {
		t.Error(err)
		panic(err)
	}
	fmt.Println(count)
}


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

namespace A7
{
    class Program
    {
        static void Main(string[] args)
        {
            List<int> nums = Console.ReadLine().Split(' ').Select(int.Parse).ToList();
            int n = int.Parse(Console.ReadLine());
            nums.Sort();
            for(int i = nums.Count - 1; i > nums.Count - 1 - n; --i)
            {
                Console.Write(nums[i] + " ");
            }
        }
    }
}


text:
import { Euler, MathUtils, Matrix4, Object3D, Quaternion, Vector3 } from '../Three';
import { CAMERA_OFFSET } from '../core/constants';

const __v1 = new Vector3();
const __v2 = new Vector3();
const __v3 = new Vector3();
const __m4 = new Matrix4();
const __e = new Euler();

class CameraMove {

	constructor ( controls, renderFunction ) {

		const endCameraPosition = new Vector3();
		const endPOI = new Vector3();
		const endQuaternion = new Quaternion();
		const cameraManager = controls.cameraManager;

		let endZoom = 1;
		let frameCount = 0;
		let skipNext = false;
		let rotation = 0;
		let delta = 0;
		let running = false;
		let animationFunction = null;
		let rafID = 0;

		function getCardinalAxis ( targetAxis ) {

			cameraManager.activeCamera.getWorldDirection( __v1 );

			const x = Math.abs( __v1.x );
			const y = Math.abs( __v1.y );
			const z = Math.abs( __v1.z );

			if ( x > y && x > z ) {

				targetAxis.set( Math.sign( __v1.x ), 0, 0 );

			} else if ( y > z ) {

				targetAxis.set( 0, Math.sign( __v1.y ), 0 );

			} else {

				targetAxis.set( 0, 0, Math.sign( __v1.z ) );

			}

		}

		function prepareRotation ( endCamera, orientation ) {

			const camera = cameraManager.activeCamera;

			__v1.copy( endCamera ).sub( endPOI ).normalize();

			const zDot = __v1.dot( Object3D.DefaultUp );

			if ( Math.abs( zDot ) > 0.99999 && orientation !== undefined ) {

				// apply correction if looking verticaly to set to required cardinal direction for 'up'
				endCamera.add( orientation.multiplyScalar( 0.02 * __v1.z ) );

			}

			// calculate end state rotation of camera

			__m4.lookAt( endCamera, endPOI, Object3D.DefaultUp );

			endQuaternion.setFromRotationMatrix( __m4 ).normalize();

			// rotation to nearest degree
			rotation = Math.round( 2 * Math.acos( Math.abs( MathUtils.clamp( endQuaternion.dot( camera.quaternion ), - 1, 1 ) ) ) * MathUtils.RAD2DEG );

		}

		this.prepare = function ( endBox, requiredTargetAxis ) {

			if ( running ) return this;

			const targetAxis = __v2;
			const orientation = __v3;

			const camera = cameraManager.activeCamera;
			const cameraStart = camera.position;

			skipNext = false;

			// move camera to cardinal axis closest to current camera direction
			// or axis provided by caller

			if ( requiredTargetAxis === undefined ) {

				getCardinalAxis( targetAxis );

				if ( targetAxis.z !== 0 ) {

					// set orientation from current orientation, snapping to cardinals
					__e.setFromQuaternion( camera.quaternion );

					const direction = Math.round( 2 * ( __e.z + Math.PI ) / Math.PI );

					switch ( direction ) {

					case 0:
					case 4:

						orientation.set( 0, 1, 0 ); // S
						break;

					case 1:

						orientation.set( -1, 0, 0 ); // E
						break;

					case 2:

						orientation.set( 0, -1, 0 ); // N
						break;

					case 3:

						orientation.set( 1, 0, 0 ); // W
						break;

					default:

						orientation.set( 0, -1, 0 ); // up = N when looking vertically

					}

				}

			} else {

				targetAxis.copy( requiredTargetAxis );
				orientation.set( 0, -1, 0 ); // up = N when looking vertically

			}

			const fit = fitBox( camera, endBox, targetAxis );

			endBox.getCenter( endPOI );
			endZoom = fit.zoom;

			endCameraPosition.copy( endPOI ).add( targetAxis.negate().multiplyScalar( fit.elevation ) );

			// skip move if extremely small

			const cameraOffset = cameraStart.distanceTo( endCameraPosition );

			// calculate end state rotation of camera

			prepareRotation( endCameraPosition, orientation );

			if ( cameraOffset < 0.1 * endCameraPosition.z ) {

				// simple rotation of camera, minimal camera position change

				skipNext = ( rotation === 0 );

			} else {

				rotation = 0;

			}

			animationFunction = animateMove;

			return this;

		};

		this.preparePoint = function ( endPOIIn ) {

			if ( running ) return this;

			const camera = cameraManager.activeCamera;

			// calculate end state rotation of camera
			endPOI.copy( endPOIIn );
			endCameraPosition.copy( camera.position );

			prepareRotation( camera.position );

			// minimal camera rotation or no change of POI
			skipNext = ( rotation === 0 );

			animationFunction = animateMove;

			return this;

		};

		this.start = function ( timed ) {

			if ( running || skipNext ) return;

			if ( timed ) {

				frameCount = ( rotation > 0 ) ? Math.max( 1, Math.round( rotation / 2 ) ) : 30;

			} else {

				frameCount = 1;

			}

			controls.enabled = false;

			running = true;

			animate();

		};

		this.cancel = function () {

			if ( rafID !== 0 ) window.cancelAnimationFrame( rafID );

			if ( ! running ) return;

			frameCount = 1;
			running = false;
			rafID = 0;

			animate();

			controls.enabled = true;
			controls.autoRotate = false;

		};

		function animate () {

			if ( controls.autoRotate ) {

				controls.update();

			} else if ( animationFunction ) {

				animationFunction();

				if ( --frameCount === 0 ) {

					animationFunction = null;
					endAnimation();

				}

			}

			if ( running ) rafID = window.requestAnimationFrame( animate );

		}

		function endAnimation () {

			controls.target.copy( endPOI );
			cameraManager.activeCamera.position.copy( endCameraPosition );

			running = false;
			rotation = 0;
			rafID = 0;

			controls.enabled = true;
			controls.end();

		}

		function animateMove () {

			// update camera position

			const camera = cameraManager.activeCamera;
			const target = controls.target;
			const dt = 1 - ( frameCount - 1 ) / frameCount;

			if ( ! rotation ) {

				camera.position.lerp( endCameraPosition, dt);
				camera.zoom = camera.zoom + ( endZoom - camera.zoom ) * dt;

				if ( camera.isOrthographicCamera ) camera.updateProjectionMatrix();

				camera.lookAt( target.lerp( endPOI, dt ) );

			}

			camera.quaternion.slerp( endQuaternion, dt );

			renderFunction();

		}

		function setAngleCommon ( deltaIn ) {

			frameCount = Math.max( 1, Math.round( Math.abs( deltaIn ) * 90 / Math.PI ) );
			delta = deltaIn / frameCount;
			running = true;

			animate();

		}

		function animateAzimuthMove () {

			controls.rotateLeft( delta );

		}

		this.setAzimuthAngle = function ( targetAngle ) {

			if ( running || controls.autoRotate ) return this;

			let delta = ( controls.getAzimuthalAngle() - targetAngle );
			const deltaSize = Math.abs( delta );

			if ( deltaSize > Math.PI ) delta = 2 * Math.PI - deltaSize;

			animationFunction = animateAzimuthMove;
			setAngleCommon( delta );

		};

		function animatePolarMove () {

			controls.rotateUp( delta );

		}

		this.setPolarAngle = function ( targetAngle ) {

			if ( running ) return this;

			animationFunction = animatePolarMove;

			setAngleCommon( controls.getPolarAngle() - targetAngle );

		};

		this.setAutoRotate = function ( state ) {

			if ( state ) {

				if ( running ) return;

				controls.autoRotate = true;

				running = true;
				animationFunction = false;

				animate();

			} else {

				if ( controls.autoRotate ) running = false;

				controls.autoRotate = false;
				controls.enabled = true;
				rafID = 0;

			}

		};

		function fitBox ( camera, box, viewAxis ) {

			const size = box.getSize( __v1 );

			let elevation = CAMERA_OFFSET;
			let zoom = 1;

			let dX, dY, dZ;

			if ( viewAxis === undefined || viewAxis.z !== 0 ) {

				dX = size.x;
				dY = size.y;
				dZ = size.z;

			} else if ( viewAxis.x !== 0 ) {

				dX = size.y;
				dY = size.z;
				dZ = size.x;

			} else {

				dX = size.x;
				dY = size.z;
				dZ = size.y;

			}

			if ( camera.isPerspectiveCamera ) {

				const tan2 = 2 * Math.tan( MathUtils.DEG2RAD * 0.5 * camera.getEffectiveFOV() );

				const e1 = dY / tan2;
				const e2 = ( 1 / camera.aspect ) * dX / tan2;

				elevation = Math.max( e1, e2 ) * 1.1 + dZ / 2;

				if ( elevation === 0 ) elevation = 100;

			} else {

				const hRatio = ( camera.right - camera.left ) / dX;
				const vRatio = ( camera.top - camera.bottom ) / dY;

				zoom = Math.min( hRatio, vRatio ) * 1 / 1.1;

			}

			return { zoom: zoom, elevation: elevation };

		}

	}

}

export { CameraMove };


text:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Uses of Package com.vaadin.tapio.googlemaps.client.events (GoogleMaps Add-on 1.0.2.3 API)</title>
<meta name="date" content="2018-09-06">
<link rel="stylesheet" type="text/css" href="../../../../../../stylesheet.css" title="Style">

JavaScript is disabled on your browser.

Skip navigation links

Overview

Package

Class

Use

Tree

Deprecated

Index

Help

Prev

Next

Frames

No Frames

All Classes

Uses of Package
com.vaadin.tapio.googlemaps.client.events

Packages that use com.vaadin.tapio.googlemaps.client.events

Package
Description

com.vaadin.tapio.googlemaps

com.vaadin.tapio.googlemaps.client

Classes in com.vaadin.tapio.googlemaps.client.events used by com.vaadin.tapio.googlemaps

Class and Description

InfoWindowClosedListener

Interface for listening info window close events initiated by the user.

MapClickListener

Interface for listening map click events.

MapMoveListener

Interface for listening map move and zoom events.

MarkerClickListener

Interface for listening marker click events.

MarkerDragListener

Interface for listening marker drag events.

PolylineClickListener

Created by mattc on 4/3/14.

Classes in com.vaadin.tapio.googlemaps.client.events used by com.vaadin.tapio.googlemaps.client

Class and Description

InfoWindowClosedListener

Interface for listening info window close events initiated by the user.

MapClickListener

Interface for listening map click events.

MapMoveListener

Interface for listening map move and zoom events.

MarkerClickListener

Interface for listening marker click events.

MarkerDragListener

Interface for listening marker drag events.

PolylineClickListener

Created by mattc on 4/3/14.

Skip navigation links

Overview

Package

Class

Use

Tree

Deprecated

Index

Help

Prev

Next

Frames

No Frames

All Classes

Copyright © 2018. All Rights Reserved.


text:
package com.xinfan.wxshop.business.entity;

import java.util.Date;

import com.xinfan.wxshop.common.base.BaseEntity;

public class Transfer extends BaseEntity{
    private Integer transferId;

    private Integer walletId;

    private String wxOpenid;

    private Integer customerId;

    private Date transferDate;

    private Float amount;

    private String orderNo;

    private String clientIp;

    private Integer checkState;

    private Date checkDate;

    private String checkMsg;

    public Integer getTransferId() {
        return transferId;
    }

    public void setTransferId(Integer transferId) {
        this.transferId = transferId;
    }

    public Integer getWalletId() {
        return walletId;
    }

    public void setWalletId(Integer walletId) {
        this.walletId = walletId;
    }

    public String getWxOpenid() {
        return wxOpenid;
    }

    public void setWxOpenid(String wxOpenid) {
        this.wxOpenid = wxOpenid == null ? null : wxOpenid.trim();
    }

    public Integer getCustomerId() {
        return customerId;
    }

    public void setCustomerId(Integer customerId) {
        this.customerId = customerId;
    }

    public Date getTransferDate() {
        return transferDate;
    }

    public void setTransferDate(Date transferDate) {
        this.transferDate = transferDate;
    }

    public Float getAmount() {
        return amount;
    }

    public void setAmount(Float amount) {
        this.amount = amount;
    }

    public String getOrderNo() {
        return orderNo;
    }

    public void setOrderNo(String orderNo) {
        this.orderNo = orderNo == null ? null : orderNo.trim();
    }

    public String getClientIp() {
        return clientIp;
    }

    public void setClientIp(String clientIp) {
        this.clientIp = clientIp == null ? null : clientIp.trim();
    }

    public Integer getCheckState() {
        return checkState;
    }

    public void setCheckState(Integer checkState) {
        this.checkState = checkState;
    }

    public Date getCheckDate() {
        return checkDate;
    }

    public void setCheckDate(Date checkDate) {
        this.checkDate = checkDate;
    }

    public String getCheckMsg() {
        return checkMsg;
    }

    public void setCheckMsg(String checkMsg) {
        this.checkMsg = checkMsg == null ? null : checkMsg.trim();
    }
}


text:
package ds.tree;

/**
 * excepion thrown if a duplicate key is inserted in a {@link RadixTree}
 *
 * @author Tahseen Ur Rehman
 * email: tahseen.ur.rehman {at.spam.me.not} gmail.com
 */
public class DuplicateKeyException extends RuntimeException
{
	private static final long serialVersionUID = 3141795907493885706L;

	public DuplicateKeyException(String msg)
	{
		super(msg);
	}
}


text:
package org.sagebionetworks.repo.model.dbo.dao.table;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;

import java.util.Set;

import org.junit.After;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.sagebionetworks.repo.model.dbo.DBOBasicDao;
import org.sagebionetworks.repo.model.query.jdo.SqlConstants;
import org.sagebionetworks.repo.model.table.ViewType;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.namedparam.MapSqlParameterSource;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

import com.google.common.collect.Sets;

@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = { "classpath:jdomodels-test-context.xml" })
public class ViewScopeDaoImplTest {

	@Autowired
	ViewScopeDao viewScopeDao;
	@Autowired
	DBOBasicDao basicDao;

	@After
	public void after(){
		viewScopeDao.truncateAll();
	}

	@Test
	public void testSetViewScopeGetViewScoped(){
		long viewId1 = 123L;
		Set<Long> containers = Sets.newHashSet(444L,555L);
		// one
		viewScopeDao.setViewScopeAndType(viewId1, containers, ViewType.file);
		// find the intersection
		Set<Long> fetched = viewScopeDao.getViewScope(viewId1);
		assertEquals(containers, fetched);
		assertEquals(ViewType.file, viewScopeDao.getViewType(viewId1));
	}

	@Test
	public void testSetViewScopeUpdateEtagChange(){
		long viewId1 = 123L;
		Set<Long> containers = Sets.newHashSet(444L,555L);
		// one
		viewScopeDao.setViewScopeAndType(viewId1, containers, ViewType.file);

		// check the value in the database.
		MapSqlParameterSource param = new MapSqlParameterSource();
		param.addValue("viewId", viewId1);
		DBOViewType dboType = basicDao.getObjectByPrimaryKey(DBOViewType.class, param);
		assertNotNull(dboType);
		assertEquals(new Long(viewId1), dboType.getViewId());
		assertNotNull(dboType.getEtag());
		assertEquals(ViewType.file.name(), dboType.getViewType());
		String startEtag = dboType.getEtag();

		// update one
		containers = Sets.newHashSet(444L);
		// one
		viewScopeDao.setViewScopeAndType(viewId1, containers, ViewType.file);
		// check the etag
		dboType = basicDao.getObjectByPrimaryKey(DBOViewType.class, param);
		assertNotNull(dboType.getEtag());
		assertFalse("Etag should have changed",startEtag.equals(dboType.getEtag()));
	}

	@Test
	public void testSetViewScopeAndFind(){
		long viewId1 = 123L;
		Set<Long> containers = Sets.newHashSet(444L,555L);
		// one
		viewScopeDao.setViewScopeAndType(viewId1, containers, ViewType.file);
		// find the intersection
		Set<Long> intersection = viewScopeDao.findViewScopeIntersectionWithPath(containers);
		assertNotNull(intersection);
		assertEquals(1, intersection.size());
		assertTrue(intersection.contains(viewId1));
	}

	@Test
	public void testViewScopeUpdate(){
		long viewId1 = 123L;
		Set<Long> containers = Sets.newHashSet(444L,555L);
		// one
		viewScopeDao.setViewScopeAndType(viewId1, containers, ViewType.file);
		// change the values
		containers = Sets.newHashSet(555L,777L);
		viewScopeDao.setViewScopeAndType(viewId1, containers, ViewType.file);
		// The 444 container should no longer intersect with view 123
		Set<Long> intersection = viewScopeDao.findViewScopeIntersectionWithPath(Sets.newHashSet(444L));
		assertNotNull(intersection);
		assertEquals(0, intersection.size());
		// view 123 should intersect with 555
		intersection = viewScopeDao.findViewScopeIntersectionWithPath(Sets.newHashSet(555L));
		assertNotNull(intersection);
		assertEquals(1, intersection.size());
		assertTrue(intersection.contains(viewId1));
		// view 123 should intersect with 777
		intersection = viewScopeDao.findViewScopeIntersectionWithPath(Sets.newHashSet(777L));
		assertNotNull(intersection);
		assertEquals(1, intersection.size());
		assertTrue(intersection.contains(viewId1));
	}

	@Test
	public void testViewScopeMultipleOverlap(){
		long viewId1 = 123L;
		long viewId2 = 456L;
		// one
		viewScopeDao.setViewScopeAndType(viewId1, Sets.newHashSet(444L,555L), ViewType.file);
		// two
		viewScopeDao.setViewScopeAndType(viewId2, Sets.newHashSet(555L,888L), ViewType.file);
		// 555 should intersect with views 123 and 456
		Set<Long> results = viewScopeDao.findViewScopeIntersectionWithPath(Sets.newHashSet(555L));
		assertEquals(Sets.newHashSet(viewId1, viewId2), results);
		// 444 should intersect with view 123
		results = viewScopeDao.findViewScopeIntersectionWithPath(Sets.newHashSet(444L));
		assertEquals(Sets.newHashSet(viewId1), results);
		// 888 should intersect with view 456
		results = viewScopeDao.findViewScopeIntersectionWithPath(Sets.newHashSet(888L));
		assertEquals(Sets.newHashSet(viewId2), results);

	}

	@Test
	public void testSetViewScopeNull(){
		long viewId1 = 123L;
		Set<Long> containers = Sets.newHashSet(444L,555L);
		// one
		viewScopeDao.setViewScopeAndType(viewId1, containers, ViewType.file);
		// find the intersection
		Set<Long> intersection = viewScopeDao.findViewScopeIntersectionWithPath(containers);
		assertNotNull(intersection);
		assertEquals(1, intersection.size());
		assertTrue(intersection.contains(viewId1));

		// set the scope null
		containers = null;
		viewScopeDao.setViewScopeAndType(viewId1, containers, ViewType.file);

		// No intersection should be found
		intersection = viewScopeDao.findViewScopeIntersectionWithPath(Sets.newHashSet(444L,555L));
		assertNotNull(intersection);
		assertEquals(0, intersection.size());
	}
}


text:
<?php

namespace Puli\AssetPlugin\Tests\Console;

use PHPUnit_Framework_TestCase;
use Puli\AssetPlugin\Api\AssetPlugin;
use Puli\Cli\PuliApplicationConfig;
use Puli\Manager\Api\Puli;
use Symfony\Component\Filesystem\Filesystem;
use Webmozart\Console\Api\Application\Application;
use Webmozart\Console\Api\Formatter\Formatter;
use Webmozart\Console\ConsoleApplication;
use Webmozart\Console\Formatter\PlainFormatter;
use Webmozart\Console\IO\BufferedIO;

/**
 * @since  1.0
 * @author Bernhard Schussek <bschussek@gmail.com>
 */
abstract class AbstractCommandHandlerTest extends PHPUnit_Framework_TestCase
{
    /**
     * @var string
     */
    protected static $tempDir;

    /**
     * @var Application
     */
    protected static $application;

    /**
     * @var Formatter
     */
    protected static $formatter;

    /**
     * @var BufferedIO
     */
    protected $io;

    public static function setUpBeforeClass()
    {
        while (false === @mkdir(self::$tempDir = sys_get_temp_dir().'/puli-web-plugin/AbstractCommandHandlerTest'.rand(10000, 99999), 0777, true)) {}

        $puli = new Puli(self::$tempDir);
        $config = new PuliApplicationConfig($puli);
        $plugin = new AssetPlugin();
        $plugin->activate($puli);

        self::$application = new ConsoleApplication($config);
        self::$formatter = new PlainFormatter(self::$application->getConfig()->getStyleSet());
    }

    public static function tearDownAfterClass()
    {
        $filesystem = new Filesystem();
        $filesystem->remove(self::$tempDir);
    }

    protected function setUp()
    {
        $this->io = new BufferedIO('', self::$formatter);
    }
}


text:
# VB.NET TableReader Example

This example project shows how to use the `TableReader` component of [RfcConnector](http://rfcconnector.com/)
to read data from a SAP table.

Reading the contents of an SAP table involves the following steps:

1. Connect to the SAP system using a `Session` instance
2. Create a `TableReader` instance
3. Set query parameters (optional) and retrieve the data

```vbnet
' create a session instance
Dim session As New NWRfcSession

' configure the connection (using connection data from SAPLogon entry)
session.RfcSystemData.ConnectString = "SAPLOGON_ID=my_system_id"

' fill in credentials
session.LogonData.Client = "000"
session.LogonData.User = "myuser"
session.LogonData.Password = "***"
session.LogonData.Language = "EN"

' connect to the SAP system
session.Connect()

' create `TableReader` instance
TableReader tr = session.GetTableReader("SFLIGHT")

' set up query parameters
tr.Query.Add("CARRID EQ 'LH'");

' read rows
tr.Read(0, 0);

' process the result
For Each row As RfcFields In tr.Rows
	Console.WriteLine(row("CONNID").value + " " + row("FLDATE").value + " " + row("CARRID").value)
Next
```

For more information, please visit [http://rfcconnector.com/](http://rfcconnector.com/)


text:
BEGIN;

ALTER TABLE symbol_history RENAME series_id TO module_path_id;
ALTER TABLE symbol_history RENAME v1path_id TO package_path_id;

END;


text:
API
======

API of super secret project

##Install
`npm install`

`git submodule init`

`git submodule update`

`brew install protobuf`

`grunt build`

`grunt server`

##Change config
rename lib/api/example_config.js to config.js
fill it in according to your setup.

##Deploy
[Wiki](https://github.com/GoBitcoin/API/wiki/Deploy)

##API
### CREATE
**Example:**`localhost:8001/create?address={address}&amount={amount}&memo={memo}&ackmemo={ackmemo}`
####Create flow:
  1. when the server receives the four properties of payment details (**address, amount, memo, ackmemo**) from the POST, the first thing we do is hash it and check if the hash already exists in our database. This is to avoid create duplicate records
  2. If the duplication check returns no result, we now know this is a new payment detail. We insert it to the database, and the database would return us the id of the new record
  3. After we get the id from the database, we will now construct the payment details protobuf and send it to the signing server to get it signed.
  4. The signing server will return us the protobuf of payment request. We will now store this payment request into our database into the same row as above.
  5. We then generate a link /pay/{id} and return that to the user

## PAY
**Example:**`localhost:8001/pay/{id}`
####Pay flow:
  1. After create generates the pay URL, the user will open it up (in some wallet app)
  2. When we receive the get for /pay/{id} we simply look it up in the db and return the corresponding payment request protobuf. The client (wallet on user's phone) is responsible for verifying the signing, as well as displaying the payment info
  3. User confirms the payment, and the wallet will send a post to our /send/{id}

## SEND
**Example:**`localhost:8001/send/{id}`
####Send flow:
  1. Here we will receive the Payment protobuf from the user's wallet, we will deserialize it
  2. Find the payment request protobuf corresponds to the id passed in from the database, and construct the "BroadcastPayment" protobuf
  3. POST that protobuf to the broadcast server