text:
<!DOCTYPE html>

    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="robots" content="index,follow">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="description" content="A Music Informatics and Performance Technologies Lab based in the School of Media, Film and Music at the University of Sussex">

    <title>Choreography and Composition of Internal Time - Emute Lab</title>

    <link rel="canonical" href="http://www.emutelab.org/blog/choreography">

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

    <link rel="stylesheet" href="/css/clean-blog.css">

    <link rel="stylesheet" href="/css/syntax.css">

    <link href="//maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css" rel="stylesheet" type="text/css">
    <link href='//fonts.googleapis.com/css?family=Lora:400,700,400italic,700italic' rel='stylesheet' type='text/css'>

    <link type="application/atom+xml" rel="alternate" href="http://www.emutelab.org/feed.xml" title="Emute Lab" />

            <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
                Toggle navigation

            </button>
            Emute Lab

                    Blog

                    About

                    Events

                    People

                    Contact

Choreography and Composition of Internal Time

                    Posted by thor magnusson on November 7, 2014

Visiting lecture with composer John MacCallum and dancer/choreographer Teoma Naccarato

Friday, November 14th, Silverstone Building, Room 121, 4pm.

Composer John MacCallum and choreographer Teoma Naccarato, currently research fellows at Ircam in Paris, will present their current collaborative project that examines the use of real-time, heart rate data from contemporary dancers to drive a polytemporal composition for instrumental ensemble with live electronics.

The work explores both the external expression and internal state of each dancer – physical, emotional, and psychological – in order to drive intentional arcs in heart activity over time. ECG data from the dancers provides an underlying clock for each musician, producing dynamic textures of time in the poly-temporal score.

MacCallum and Naccarato will discuss the challenges of developing a facile choreographic and compositional environment for real-time interaction with biosensors, as well as questions regarding internal-external perception and interaction.

##BIOS

##John MacCallum

John MacCallum is a composer based, since 2004, in Oakland, CA. From 2008–2011 he held a position as Musical Applications Programmer at the Center for New Music and Audio Technologies (CNMAT). While there, he designed a number of software tools including one useful for composing and performing music with multiple, independent, smoothly-varying tempos, which resulted in his composition aberration (2010) for percussion trio, the recording of which was supported by a grant from the American Composer's Forum, and Delicate Texture of Time (2012–13) for eight players commissioned by the Eco Ensemble with a grant from the Mellon Foundation. In addition to his interest in polytemporal music, MacCallum's compositional work is heavily reliant on technology both as a compositional tool and as an integral aspect of the performance of a piece. His works often employ carefully constrained algorithms that are allowed to evolve differently and yet predictably each time they are performed.

John holds degrees from the University of California, Berkeley (Ph.D. in Music Composition), McGill University (M.M. in Composition), and the University of the Pacific (B.M. in Composition/Theory).

##Teoma Naccarato

Teoma Naccarato is a contemporary dancer, choreographer, educator, and scholar based in Montreal, Canada. Naccarato received an MFA in Dance and Technology at the Ohio State University in 2011, and a BFA in Contemporary Dance at Concordia University in 2004. Naccarato's creations integrate contemporary dance with responsive video, audio and sensor technologies to explore vulnerability and intimacy in embodied and virtual interactions.

Since 2004 Naccarato Dance has shared work across Canada, the United States, South America, and Europe, with recent presentations at the Hemispheric Institute Encuentro (Montreal 2014), the Rapid Pulse International Performance Art Festival (Chicago 2014), the ReNew Digital Arts Festival (Copenhagen, Denmark (2013), and the TimeWave International (Cyber) Festival (London, UK 2013).  Naccarato is involved with interactive media and movement research at the Centre for New Music and Audio Technologies at UC Berkeley (2013-present), the Topological Media Lab at Concordia University (2011-2014), and the Experimental Media and Movement Arts Lab at the Ohio State University (2010-2011).

                        ← Previous Post

                        Next Post →

Copyright © Emute Lab 2017


text:
"use strict";

var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard");

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;

var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));

var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));

var React = _interopRequireWildcard(require("react"));

var _propTypes = _interopRequireDefault(require("prop-types"));

var _unstyled = require("@material-ui/unstyled");

var _experimentalStyled = _interopRequireWildcard(require("../styles/experimentalStyled"));

var _useThemeProps = _interopRequireDefault(require("../styles/useThemeProps"));

var _Typography = _interopRequireDefault(require("../Typography"));

var _dialogContentTextClasses = require("./dialogContentTextClasses");

var _jsxRuntime = require("react/jsx-runtime");

const useUtilityClasses = styleProps => {
  const {
    classes
  } = styleProps;
  const slots = {
    root: ['root']
  };
  const composedClasses = (0, _unstyled.unstable_composeClasses)(slots, _dialogContentTextClasses.getDialogContentTextUtilityClass, classes);
  return (0, _extends2.default)({}, classes, composedClasses);
};

const DialogContentTextRoot = (0, _experimentalStyled.default)(_Typography.default, {
  shouldForwardProp: prop => (0, _experimentalStyled.rootShouldForwardProp)(prop) || prop === 'classes'
}, {
  name: 'MuiDialogContentText',
  slot: 'Root',
  overridesResolver: (props, styles) => styles.root
})({
  marginBottom: 12
});
const DialogContentText = /*#__PURE__*/React.forwardRef(function DialogContentText(inProps, ref) {
  const props = (0, _useThemeProps.default)({
    props: inProps,
    name: 'MuiDialogContentText'
  });
  const styleProps = (0, _objectWithoutPropertiesLoose2.default)(props, ["children"]);
  const classes = useUtilityClasses(styleProps);
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(DialogContentTextRoot, (0, _extends2.default)({
    component: "p",
    variant: "body1",
    color: "text.secondary",
    ref: ref,
    styleProps: styleProps
  }, props, {
    classes: classes
  }));
});
process.env.NODE_ENV !== "production" ? DialogContentText.propTypes
/* remove-proptypes */
= {
  // ----------------------------- Warning --------------------------------
  // | These PropTypes are generated from the TypeScript type definitions |
  // |     To update them edit the d.ts file and run "yarn proptypes"     |
  // ----------------------------------------------------------------------

  /**
   * The content of the component.
   */
  children: _propTypes.default.node,

  /**
   * Override or extend the styles applied to the component.
   */
  classes: _propTypes.default.object,

  /**
   * The system prop that allows defining system overrides as well as additional CSS styles.
   */
  sx: _propTypes.default.object
} : void 0;
var _default = DialogContentText;
exports.default = _default;

redpajama_set_name: RedPajamaGithub


text:
namespace mchp
{
	template <typename T>
	class CEvent;

	template<typename Type>
	using Lambda = std::function < void( const CEvent<Type>& rEvent, const Type& rData ) >;

	//a specialized listener used as a wrapper for lambdas
	template<typename TDataType>
	class LambdaEventListener
		: public TEventListener<TDataType>
		, public IRecycleable
	{
	public:

		LambdaEventListener( )
		{
		}

		LambdaEventListener( const Lambda<TDataType>& lambda )
		{
			Initialize( lambda );
		}

		void Initialize( const Lambda<TDataType>& lambda )
		{
			m_lambda = lambda;
		}

		virtual void OnEvent( const CEvent<TDataType>& rEvent, const TDataType& rData ) override
		{
			m_lambda( rEvent, rData );
		}

	private:

		//the wrapped lambda
		Lambda<TDataType> m_lambda;
	};

};


text:
package org.flywaydb.core.internal.dbsupport;

import org.flywaydb.core.api.FlywayException;

import org.flywaydb.core.internal.util.PlaceholderReplacer;
import org.flywaydb.core.internal.util.StringUtils;
import org.flywaydb.core.api.logging.Log;
import org.flywaydb.core.api.logging.LogFactory;
import org.flywaydb.core.internal.util.scanner.LoadableResource;
import org.flywaydb.core.internal.util.scanner.Resource;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.Reader;
import java.io.StringReader;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;

/**
 * Sql script containing a series of statements terminated by a delimiter (eg: ;).
 * Single-line (--) and multi-line (/* * /) comments are stripped and ignored.
 */
public class SqlScript {
    private static final Log LOG = LogFactory.getLog(SqlScript.class);

    /**
     * The database-specific support.
     */
    private final DbSupport dbSupport;

    /**
     * Whether to allow mixing transactional and non-transactional statements within the same migration.
     */
    private final boolean mixed;

    /**
     * The sql statements contained in this script.
     */
    private final List<SqlStatement> sqlStatements;

    /**
     * The resource containing the statements.
     */
    private final Resource resource;

    /**
     * Whether this SQL script contains at least one transactional statement.
     */
    private boolean transactionalStatementFound;

    /**
     * Whether this SQL script contains at least one non-transactional statement.
     */
    private boolean nonTransactionalStatementFound;

    /**
     * Creates a new sql script from this source.
     *
     * @param sqlScriptSource The sql script as a text block with all placeholders already replaced.
     * @param dbSupport       The database-specific support.
     */
    public SqlScript(String sqlScriptSource, DbSupport dbSupport) {
        this.dbSupport = dbSupport;
        this.mixed = false;
        this.sqlStatements = parse(sqlScriptSource);
        this.resource = null;

    }

    /**
     * Creates a new sql script from this resource.
     *
     * @param dbSupport           The database-specific support.
     * @param sqlScriptResource   The resource containing the statements.
     * @param placeholderReplacer The placeholder replacer.
     * @param encoding            The encoding to use.
     * @param mixed               Whether to allow mixing transactional and non-transactional statements within the same migration.

     */
    public SqlScript(DbSupport dbSupport, LoadableResource sqlScriptResource, PlaceholderReplacer placeholderReplacer, String encoding, boolean mixed

    ) {
        this.dbSupport = dbSupport;
        this.resource = sqlScriptResource;
        this.mixed = mixed;

        String sqlScriptSource = sqlScriptResource.loadAsString(encoding);
        this.sqlStatements = parse(placeholderReplacer.replacePlaceholders(sqlScriptSource));

    }

    /**
     * Whether the execution should take place inside a transaction. This is useful for databases
     * like PostgreSQL where certain statement can only execute outside a transaction.
     *
     * @return {@code true} if a transaction should be used (highly recommended), or {@code false} if not.
     */
    public boolean executeInTransaction() {
        return !nonTransactionalStatementFound;
    }

    /**
     * For increased testability.
     *
     * @return The sql statements contained in this script.
     */
    public List<SqlStatement> getSqlStatements() {
        return sqlStatements;
    }

    /**
     * @return The resource containing the statements.
     */
    public Resource getResource() {
        return resource;
    }

    /**
     * Executes this script against the database.
     *
     * @param jdbcTemplate The jdbc template to use to execute this script.
     */
    public void execute(final JdbcTemplate jdbcTemplate) {
        for (SqlStatement sqlStatement : sqlStatements) {
            String sql = sqlStatement.getSql();
            LOG.debug("Executing SQL: " + sql);

            try {
                sqlStatement.execute(jdbcTemplate.getConnection());
            } catch (final SQLException e) {

                throw new FlywaySqlScriptException(resource, sqlStatement, e);
            }
        }
    }

    /**
     * Parses this script source into statements.
     *
     * @param sqlScriptSource The script source to parse.
     * @return The parsed statements.
     */
    /* private -> for testing */
    List<SqlStatement> parse(String sqlScriptSource) {
        if (resource != null) {
            LOG.debug("Parsing " + resource.getFilename() + " ...");
        }
        return linesToStatements(readLines(new StringReader(sqlScriptSource)));
    }

    /**
     * Turns these lines in a series of statements.
     *
     * @param lines The lines to analyse.
     * @return The statements contained in these lines (in order).
     */
    /* private -> for testing */
    List<SqlStatement> linesToStatements(List<String> lines) {
        List<SqlStatement> statements = new ArrayList<SqlStatement>();

        Delimiter nonStandardDelimiter = null;
        SqlStatementBuilder sqlStatementBuilder = dbSupport.createSqlStatementBuilder();

        for (int lineNumber = 1; lineNumber <= lines.size(); lineNumber++) {
            String line = lines.get(lineNumber - 1);

            if (sqlStatementBuilder.isEmpty()) {
                if (!StringUtils.hasText(line)) {
                    // Skip empty line between statements.
                    continue;
                }

                Delimiter newDelimiter = sqlStatementBuilder.extractNewDelimiterFromLine(line);
                if (newDelimiter != null) {
                    nonStandardDelimiter = newDelimiter;
                    // Skip this line as it was an explicit delimiter change directive outside of any statements.
                    continue;
                }

                sqlStatementBuilder.setLineNumber(lineNumber);

                // Start a new statement, marking it with this line number.
                if (nonStandardDelimiter != null) {
                    sqlStatementBuilder.setDelimiter(nonStandardDelimiter);
                }
            }

            try {
                sqlStatementBuilder.addLine(line);
            } catch (Exception e) {
                throw new FlywayException("Flyway parsing bug (" + e.getMessage() + ") at line " + lineNumber + ": " + line);
            }

            if (sqlStatementBuilder.canDiscard()) {
                sqlStatementBuilder = dbSupport.createSqlStatementBuilder();
            } else if (sqlStatementBuilder.isTerminated()) {
                addStatement(statements, sqlStatementBuilder);
                sqlStatementBuilder = dbSupport.createSqlStatementBuilder();
            }
        }

        // Catch any statements not followed by delimiter.
        if (!sqlStatementBuilder.isEmpty()) {
            addStatement(statements, sqlStatementBuilder);
        }

        return statements;
    }

    private void addStatement(List<SqlStatement> statements, SqlStatementBuilder sqlStatementBuilder) {
        SqlStatement sqlStatement = sqlStatementBuilder.getSqlStatement();
        statements.add(sqlStatement);

        if (sqlStatementBuilder.executeInTransaction()) {
            transactionalStatementFound = true;
        } else {
            nonTransactionalStatementFound = true;
        }

        if (!mixed && transactionalStatementFound && nonTransactionalStatementFound) {
            throw new FlywayException(
                    "Detected both transactional and non-transactional statements within the same migration"
                            + " (even though mixed is false). Offending statement found at line "
                            + sqlStatement.getLineNumber() + ": " + sqlStatement.getSql()
                            + (sqlStatementBuilder.executeInTransaction() ? "" : " [non-transactional]"));
        }

        LOG.debug("Found statement at line " + sqlStatement.getLineNumber() + ": " + sqlStatement.getSql() + (sqlStatementBuilder.executeInTransaction() ? "" : " [non-transactional]"));
    }

    /**
     * Parses the textual data provided by this reader into a list of lines.
     *
     * @param reader The reader for the textual data.
     * @return The list of lines (in order).
     * @throws IllegalStateException Thrown when the textual data parsing failed.
     */
    private List<String> readLines(Reader reader) {
        List<String> lines = new ArrayList<String>();

        BufferedReader bufferedReader = new BufferedReader(reader);
        String line;

        try {
            while ((line = bufferedReader.readLine()) != null) {
                lines.add(line);
            }
        } catch (IOException e) {
            String message = resource == null ?
                    "Unable to parse lines" :
                    "Unable to parse " + resource.getLocation() + " (" + resource.getLocationOnDisk() + ")";
            throw new FlywayException(message, e);
        }

        return lines;
    }
}


text:
<?php
class Chartex_model extends CI_Model {

	public function __construct()
	{
		$this->load->database();
	}

/***************
SEARCH PANEL
***************/

	//Gets a list of collections.
	//Called from the index function to populate the search collections checkboxes.
	public function get_collections()
	{
		$query = $this->db->get('collections');
		return $query->result_array();
	}

	//Gets the list of entity types
	//Called from the index function to populate the search entities checkboxes.
	//Called from the document function to populate the highlighting checkboxes.
	public function get_entities()
	{
		$query = $this->db->get('entity_types');
		return $query->result_array();
	}
	//Gets the search results relating to documents.
	//Called from the results function to populate the documents results table.
	public function get_results_documents($search_form_query, $chk_collections, $chk_entities)
	{
		$this->db->select('documents.document_id, documents.document_name, documents.document_text, collections.collection_name');
		$this->db->from('documents');
		$this->db->join('collections', 'documents.collection_id = collections.collection_id');
		$this->db->like('documents.document_text', $search_form_query);
		$this->db->where_in('collections.collection_name', $chk_collections);

		$query = $this->db->get();

		return $query->result_array();
	}
	//Gets the search results relating to documents.
	//Called from the results function to populate the entities results table.
	public function get_results_entities($search_form_query, $chk_collections, $chk_entities)
	{
		//$this->db->select('SUBSTRING( documents.document_text FROM entities.text_start -10 FOR entities.text_length +20 ),
		//$this->db->select('SUBSTRING( documents.document_text FROM entities.text_start +1 FOR entities.text_length ) as snippet,
		$this->db->select('
			documents.document_text,
			documents.document_char_count,
			entities.text_start,
			entities.text_end,
			entities.text_length,
			entities.entity_id,
			entities.entity_name,
			entities.entity_type_id,
			entity_types.entity_type_name,
			documents.document_id,
			documents.document_name,
			collections.collection_name,
			dm_entities.dm_entity_id');
		$this->db->from('documents');
		$this->db->join('entities', 'entities.document_id = documents.document_id');
		$this->db->join('collections', 'collections.collection_id = documents.collection_id');
		$this->db->join('entity_types', 'entity_types.entity_type_id = entities.entity_type_id');
		$this->db->join('dm_entities', 'dm_entities.entity_id = entities.entity_id');
		$this->db->like('entities.entity_name', $search_form_query);
		$this->db->where_in('collections.collection_name', $chk_collections);
		$this->db->where_in('entity_types.entity_type_name', $chk_entities);

		$query = $this->db->get();
		return $query->result_array();
	}

	//Gets the data for a document.
	//Called from the tooltip function to populate a tooltip with details about a document.
	public function get_document($document_id)
	{
		$this->db->select('documents.document_id, documents.document_name, documents.document_text, collections.collection_name');
		$this->db->from('documents');
		$this->db->join('collections', 'documents.collection_id = collections.collection_id');
		$this->db->where(array('documents.document_id' => $document_id));
		$query = $this->db->get();

		return $query->row_array();
	}

/***************
DOCUMENTS PANEL
***************/

	//Gets the data on the entities within a document (for highlighting).
	//Called from document function to populate the document text with entities to be highlighted.
	public function get_document_entities($document_id)
	{
		$this->db->select('documents.document_id,
		documents.document_name,
		documents.document_text,
		collections.collection_id,
		collections.collection_name,
		entities.entity_id,
		entities.text_fragment,
		entities.text_start,
		entities.text_end,
		entities.text_length,
		entity_types.entity_type_name,
		dm_entities.dm_entity_id');
		$this->db->from('documents');
		$this->db->join('collections', 'documents.collection_id = collections.collection_id');
		$this->db->join('entities', 'documents.document_id = entities.document_id');
		$this->db->join('entity_types', 'entities.entity_type_id = entity_types.entity_type_id');
		$this->db->join('dm_entities', 'dm_entities.entity_id = entities.entity_id');
		$this->db->where(array('documents.document_id' => $document_id));
		$this->db->order_by("entities.text_end", "desc");
		$query = $this->db->get();

		return $query->result_array();
	}

	//Gets the entities in a document and the relationships between them.
	//Called from the document function to populate the document visualisation in the Document Viewer.
	public function get_document_vis($document_id)
	{
		$query = $this->db->query('
		SELECT collections.collection_name, relations10.* FROM collections
RIGHT JOIN
	(SELECT entity_types.entity_type_name, relations9.* FROM entity_types
	RIGHT JOIN
		(SELECT entities.entity_type_id, relations8.* FROM entities
		RIGHT JOIN
			(SELECT dm_entities.dm_entity_id, relations7.* FROM dm_entities
			RIGHT JOIN
				(SELECT documents.collection_id, documents.document_name, relations6.* FROM documents
				RIGHT JOIN
					(SELECT relations5.*, entity_types.entity_type_name AS object_type_name FROM entity_types
					RIGHT JOIN
						(SELECT relations4.document_id, relations4.entity_id, relations4.subject_entity_id, relations4.subject_name, relations4.subject_type_id, entity_types.entity_type_name AS subject_type_name, relations4.relation_id, relations4.relation_name, relations4.object_entity_id, relations4.object_name, relations4.object_type_id FROM entity_types
						RIGHT JOIN
							(SELECT entities.document_id, relations3.*, entities.entity_name AS object_name, entities.entity_type_id AS object_type_id FROM entities
							RIGHT JOIN
								(SELECT relations2.entity_id, relations2.relation_id, relations2.subject_entity_id, entities.entity_name AS subject_name, entities.entity_type_id AS subject_type_id, relations2.relation_name, relations2.object_entity_id FROM entities
								RIGHT JOIN
									(SELECT relations1.entity_id, relations1.relation_id, relations1.subject_entity_id, relations.relation_name, relations1.object_entity_id FROM relations
									RIGHT JOIN
										(SELECT query2.*, entity_relations.* FROM entity_relations
										RIGHT JOIN
											(SELECT documents.document_name, query1.* FROM documents
											RIGHT JOIN
												(SELECT entities.* FROM entities WHERE entities.document_id = '.$document_id.') AS query1
											ON documents.document_id = query1.document_id) AS query2
										ON entity_relations.subject_entity_id = query2.entity_id OR entity_relations.object_entity_id = query2.entity_id) AS relations1
									ON relations.relation_id = relations1.relation_id) AS relations2
								ON entities.entity_id = relations2.subject_entity_id) AS relations3
							ON entities.entity_id = relations3.object_entity_id) AS relations4
						ON entity_types.entity_type_id = relations4.subject_type_id) AS relations5
					ON entity_types.entity_type_id = relations5.object_type_id) AS relations6
				ON documents.document_id = relations6.document_id) AS relations7
			ON dm_entities.entity_id = relations7.entity_id) AS relations8
		ON entities.entity_id = relations8.entity_id) AS relations9
	ON entity_types.entity_type_id = relations9.entity_type_id) AS relations10
ON collections.collection_id = relations10.collection_id
ORDER BY document_id, entity_type_id, entity_id, relation_id, subject_type_id, object_type_id;');
		return $query->result_array();
	}

/***************
ENTITIES PANEL
***************/

	//Gets the entities that are definitely the SAME AS a particular PERSON or SITE or OTHER entity.
	//Called from the entity function to populate the different data visualisations in the Entity Viewer.
	public function get_sameas_entity($entity_id)
	{
		$query = $this->db->query('
		SELECT relations11.*, entity_types.entity_type_name AS object_type_name FROM entity_types
RIGHT JOIN
	(SELECT relations10.*, entities.entity_name AS object_name, entities.text_start AS object_text_start, entities.text_end AS object_text_end, entities.entity_type_id AS object_type_id FROM entities
	RIGHT JOIN
		(SELECT relations9.*, relations.relation_name AS relation_name FROM relations
		RIGHT JOIN
			(SELECT relations8.*, entity_types.entity_type_name AS subject_type_name from entity_types
			RIGHT JOIN
				(SELECT relations6.*, entities.entity_name as subject_name, entities.text_start AS subject_text_start, entities.text_end AS subject_text_end, entities.entity_type_id AS subject_type_id FROM entities
				RIGHT JOIN
						(SELECT relations5.*, entity_relations.subject_entity_id, entity_relations.relation_id, entity_relations.object_entity_id FROM entity_relations
						RIGHT JOIN
							(SELECT relations4.*, entity_types.entity_type_name FROM entity_types
							RIGHT JOIN
								(SELECT collections.collection_name, relations3.* FROM collections
								RIGHT JOIN
									(SELECT documents.collection_id, documents.document_name, relations2.* FROM documents
									RIGHT JOIN
										(SELECT entities.document_id, relations1.*, entities.entity_name, entities.text_start, entities.text_end, entities.entity_type_id FROM entities
										RIGHT JOIN
											(SELECT dm_entities.entity_id from dm_entities
											RIGHT JOIN
												(SELECT dm_entities.dm_entity_id FROM dm_entities
												WHERE dm_entities.entity_id = '.$entity_id.') relations0
											ON dm_entities.dm_entity_id = relations0.dm_entity_id) AS relations1
										ON entities.entity_id = relations1.entity_id) AS relations2
									ON documents.document_id  = relations2.document_id) AS relations3
								ON collections.collection_id = relations3.collection_id) AS relations4
							ON entity_types.entity_type_id = relations4.entity_type_id) AS relations5
						ON entity_relations.subject_entity_id = relations5.entity_id) AS relations6
				ON entities.entity_id = relations6.subject_entity_id) AS relations8
			ON entity_types.entity_type_id = relations8.subject_type_id) AS relations9
		ON relations.relation_id = relations9.relation_id) AS relations10
	ON entities.entity_id = relations10.object_entity_id) AS relations11
ON entity_types.entity_type_id = relations11.object_type_id;');
		return $query->result_array();
	}

	//Gets the entities that are POSSIBLY ALSO the same as a particular PERSON or OTHER entity.
	//Called from the entity function to populate the different data visualisations in the Entity Viewer.
	public function get_possibly_entity($dm_entity_id)
	{
		$query = $this->db->query('SELECT relations13.* FROM (SELECT collections.collection_name, relations12.* FROM collections
		JOIN
			(SELECT relations11.*, entity_types.entity_type_name AS object_type_name FROM entity_types
			JOIN
				(SELECT relations10.*, entities.entity_name AS object_name, entities.text_start AS object_text_start, entities.text_end AS object_text_end, entities.entity_type_id AS object_type_id FROM entities
				JOIN
					(SELECT relations9.*, relations.relation_name AS relation_name FROM relations
					JOIN
						(SELECT relations8.*, entity_types.entity_type_name AS subject_type_name from entity_types
						JOIN
							(SELECT relations7.*, entities.entity_name as subject_name, entities.text_start AS subject_text_start, entities.text_end AS subject_text_end, entities.entity_type_id AS subject_type_id FROM entities
							JOIN
								(SELECT relations6.* FROM entity_relations
								RIGHT JOIN
									(SELECT relations5.*, entity_relations.subject_entity_id, entity_relations.relation_id, entity_relations.object_entity_id FROM entity_relations
									RIGHT JOIN
										(SELECT documents.collection_id, documents.document_name, relations4.* FROM documents
										JOIN
											(SELECT relations3.document_id, relations3.related_dm_entity_id, relations3.entity_id, relations3.entity_name, relations3.entity_type_id, entity_types.entity_type_name, relations3.confidence FROM entity_types
											JOIN
												(SELECT entities.document_id, relations2.related_dm_entity_id, relations2.entity_id, entities.entity_name, entities.entity_type_id, relations2.confidence FROM entities
												JOIN
													(SELECT relations1.related_dm_entity_id, dm_entities.entity_id, relations1.confidence FROM dm_entities
													JOIN
														(SELECT dm_person_candidates.object_dm_entity_id AS related_dm_entity_id, dm_person_candidates.confidence FROM dm_person_candidates WHERE dm_person_candidates.subject_dm_entity_id = '.$dm_entity_id.'
														UNION DISTINCT
														SELECT dm_person_candidates.subject_dm_entity_id AS related_dm_entity_id, dm_person_candidates.confidence FROM dm_person_candidates WHERE dm_person_candidates.object_dm_entity_id = '.$dm_entity_id.'
														) AS relations1
													ON dm_entities.dm_entity_id = relations1.related_dm_entity_id ORDER BY entity_id) AS relations2
												ON entities.entity_id = relations2.entity_id ORDER BY entities.document_id) AS relations3
										ON entity_types.entity_type_id = relations3.entity_type_id) as relations4
									ON documents.document_id = relations4.document_id ORDER BY documents.collection_id) AS relations5
								ON entity_relations.subject_entity_id = relations5.entity_id) AS relations6
							ON entity_relations.object_entity_id = relations6.entity_id) AS relations7
						ON entities.entity_id = relations7.subject_entity_id) AS relations8
					ON entity_types.entity_type_id = relations8.subject_type_id) AS relations9
				ON relations.relation_id = relations9.relation_id) AS relations10
				ON entities.entity_id = relations10.object_entity_id) AS relations11
			ON entity_types.entity_type_id = relations11.object_type_id) AS relations12
		ON collections.collection_id = relations12.collection_id) AS relations13 WHERE relations13.confidence > 0.1');
		return $query->result_array();
	}

	//Gets the entities that are POSSIBLY ALSO the same as a particular SITE entity.
	//Called from the entity function to populate the different data visualisations in the Entity Viewer.
	public function get_possibly_entity_site($entity_id)
	{
		$query = $this->db->query('
		SELECT documents.document_name, inferred_site_transactions.* FROM documents
		RIGHT JOIN
		(SELECT entities.document_id, entities.entity_id, entities.entity_type_id, entities.entity_name FROM entities
		JOIN
		(SELECT dm_entities.entity_id FROM dm_entities
		JOIN
		(SELECT DISTINCT(dm_entities.dm_entity_id) FROM dm_entities
		JOIN (SELECT dm_site_candidates.subject_dm_entity_id, dm_site_candidates.object_dm_entity_id
		FROM dm_site_candidates
		JOIN
		(SELECT dm_entities.dm_entity_id, related_transactions.entity_id FROM dm_entities
		JOIN
		(SELECT entities.entity_id FROM entities
		JOIN
		(SELECT DISTINCT(entity_relations.subject_entity_id) AS related_entity_id FROM entity_relations
		JOIN entities ON entity_relations.object_entity_id = entities.entity_id
		WHERE entity_id = '.$entity_id.'
		UNION DISTINCT
		SELECT DISTINCT(entity_relations.object_entity_id) AS related_entity_id FROM entity_relations
		JOIN entities ON entity_relations.subject_entity_id = entities.entity_id
		WHERE entity_id = '.$entity_id.') AS all_relations
		ON entities.entity_id = all_relations.related_entity_id
		WHERE entities.entity_type_id = 12) as related_transactions
		ON dm_entities.entity_id = related_transactions.entity_id) as dm_transactions
		ON dm_site_candidates.subject_dm_entity_id = dm_transactions.dm_entity_id OR dm_site_candidates.object_dm_entity_id = dm_transactions.dm_entity_id) AS dm_trans_relations
		ON dm_entities.dm_entity_id = dm_trans_relations.subject_dm_entity_id OR dm_entities.dm_entity_id = dm_trans_relations.object_dm_entity_id) AS related_dm_entity_ids
		ON dm_entities.dm_entity_id = related_dm_entity_ids.dm_entity_id) related_entity_ids
		ON entities.entity_id = related_entity_ids.entity_id
		WHERE entities.entity_type_id = 12) AS inferred_site_transactions
		ON documents.document_id = inferred_site_transactions.document_id');
		return $query->result_array();
	}
}


text:
using System.Diagnostics;
using System.Threading;
using NLua;
using Watertight.Mods;
using System;
using System.Collections.Generic;
using Watertight.Networking;
using System.Collections.Concurrent;
using Lidgren.Network;

namespace Watertight
{

    class WatertightServer : Engine
    {

        List<NetworkedTask> networkTasks = new List<NetworkedTask>();
        NetServer server;

        public override void Start(int rate)
        {

            int rateInMillies = (int)((1f / rate) * 1000);
            float dt = 0;
            GameConsole.ConsoleMessage("Starting Server");
            NetPeerConfiguration config = new NetPeerConfiguration(Watertight.ImplName + Watertight.Version);
            config.Port = 2861;
            config.UseMessageRecycling = true;

            server = new NetServer(config);

            server.Start();

            PacketManager.GetPacket(0);

            RunGameLoop();
        }

        public override string GetName()
        {
            return Watertight.ImplName + " Server";
        }

        public override Platform GetPlatform()
        {
            return Platform.Server;
        }

        public override void Tick(float dt)
        {
            NetIncomingMessage message = null;
            while ((message = server.ReadMessage()) != null)
            {
                switch (message.MessageType)
                {
                    case NetIncomingMessageType.VerboseDebugMessage:
                    case NetIncomingMessageType.DebugMessage:
                    case NetIncomingMessageType.WarningMessage:
                    case NetIncomingMessageType.ErrorMessage:
                        Console.WriteLine(message.ReadString());
                        break;

                    case NetIncomingMessageType.StatusChanged:
                        NetConnectionStatus status = (NetConnectionStatus)message.ReadByte();
                        if (status == NetConnectionStatus.Connected)
                        {
                            //
                            // A new player just connected!
                            //
                            Console.WriteLine(NetUtility.ToHexString(message.SenderConnection.RemoteUniqueIdentifier) + " connected!");

                            Packet p = PacketManager.HandleMessage(message.SenderConnection.RemoteHailMessage);
                            GameConsole.ConsoleMessage("Username: " + (p as ConnectPacket).Name);

                        }
                        if (status == NetConnectionStatus.Disconnected)
                        {
                            GameConsole.ConsoleMessage(NetUtility.ToHexString(message.SenderConnection.RemoteUniqueIdentifier) + " connected!");
                        }
                        break;
                    case NetIncomingMessageType.Data:
                        GameConsole.ConsoleMessage("Got a data message");

                        break;
                }
            }

            foreach (Mod m in ModManager.Mods())
            {
                m.OnTick(dt);
            }
        }
    }
}


text:
package net.morimekta.diff;

import java.util.LinkedList;

/**
 * Find the 'middle snake' of a diff, split the problem in two
 * and return the recursively constructed diff.
 * See Myers 1986 paper: An O(ND) Difference Algorithm and Its Variations.
 */
public class Bisect extends DiffBase {
    /**
     * Bisect two strings.
     *
     * @param text1 Source (old) string.
     * @param text2 Target (new) string.
     */
    public Bisect(String text1, String text2) {
        this(text1, text2, DiffOptions.defaults());
    }

    /**
     * Bisect two strings.
     * @param text1 Source (old) string.
     * @param text2 Target (new) string.
     * @param options DiffOptions to use.
     */
    public Bisect(String text1, String text2, DiffOptions options) {
        this(text1, text2, options, getDeadline(options));
    }

    Bisect(String text1, String text2, DiffOptions options, long deadline) {
        super(options, deadline);

        // Check for null inputs.
        if (text1 == null || text2 == null) {
            throw new IllegalArgumentException("Null inputs. (diff_main)");
        }

        this.changeList = bisect(text1, text2);
    }

    Bisect(LinkedList<Change> changeList) {
        super(DiffOptions.defaults(), 0);
        this.changeList = changeList;
    }

    @Override
    public LinkedList<Change> getChangeList() {
        return changeList;
    }

    /**
     * Given the original text1, and an encoded string which describes the
     * operations required to transform text1 into text2, compute the full diff.
     * @param text1 Source string for the diff.
     * @param delta Delta text.
     * @return Array of DiffBase objects or null if invalid.
     * @throws IllegalArgumentException If invalid input.
     */
    public static Bisect fromDelta(String text1, String delta)
            throws IllegalArgumentException {
        return new Bisect(changesFromDelta(text1, delta));
    }

    private final LinkedList<Change> changeList;
}


text:
namespace WebKit {
class WebKeyboardEvent;
}  // namespace WebKit

namespace webkit {
namespace ppapi {

// Returns a 32-bit "USB Key Code" for the key identifier by the supplied
// WebKeyboardEvent. The supplied event must be a KeyDown or KeyUp.
// The code consists of the USB Page (in the high-order 16-bit word) and
// USB Usage Id of the key.  If no translation can be performed then zero
// is returned.
uint32_t UsbKeyCodeForKeyboardEvent(const WebKit::WebKeyboardEvent& key_event);

}  // namespace ppapi
}  // namespace webkit

#endif  // WEBKIT_PLUGINS_PPAPI_USB_KEY_CODE_CONVERSION_H_


text:
package org.knowm.xchange.gemini.v1.dto.account;

import java.math.BigDecimal;

import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonRawValue;

public class GeminiWithdrawalRequest {

  @JsonProperty("request")
  protected String request;

  @JsonProperty("nonce")
  protected String nonce;

  @JsonProperty("options")
  @JsonRawValue
  protected String options;

  @JsonProperty("withdraw_type")
  private final String withdrawType;

  @JsonProperty("walletselected")
  private final String walletSelected;
  @JsonProperty("amount")
  private final String amount;
  @JsonProperty("address")
  private final String address;

  /**
   * Constructor
   *
   * @param nonce
   * @param withdrawType
   * @param walletSelected
   * @param amount
   * @param address
   */
  public GeminiWithdrawalRequest(String nonce, String withdrawType, String walletSelected, BigDecimal amount, String address) {

    this.request = "/v1/withdraw";
    this.nonce = String.valueOf(nonce);
    this.options = "[]";
    this.withdrawType = withdrawType;
    this.walletSelected = walletSelected;
    this.amount = amount.toString();
    this.address = address;
  }

  public String getRequest() {

    return request;
  }

  public void setRequest(String request) {

    this.request = request;
  }

  public String getNonce() {

    return nonce;
  }

  public void setNonce(String nonce) {

    this.nonce = nonce;
  }

  public String getOptions() {

    return options;
  }

  public void setOptions(String options) {

    this.options = options;
  }

  public String getWithdrawType() {
    return withdrawType;
  }

  public String getWalletSelected() {
    return walletSelected;
  }

  public String getAmount() {
    return amount;
  }

  public String getAddress() {
    return address;
  }
}


text:
package gov.nih.nci.cagrid.introduce.extensions;

import gov.nih.nci.cagrid.core.CycleTestCase;
import junit.framework.TestResult;
import junit.framework.TestSuite;
import junit.textui.TestRunner;

public class ExtentionsCycleTestCase extends CycleTestCase {

    public ExtentionsCycleTestCase(String name) {
        super(name);
    }

    public static void main(String args[]) {
        TestRunner runner = new TestRunner();
        TestResult result = runner.doRun(new TestSuite(ExtentionsCycleTestCase.class));
        System.exit(result.errorCount() + result.failureCount());
    }
}


text:
// by kezunlin
// date 2015-9-16
//
var map;
var vector,vectoranno,image,imageanno;
var center;

var csv,layer1,layer2,layer3;

require([
	"dojo/on",
	"dojo/dom",
	"dojo/parser",
	"esri/graphic",
	"esri/layers/GraphicsLayer",
	"esri/layers/CSVLayer",
	"esri/Color",
	"esri/symbols/SimpleMarkerSymbol",
	"esri/symbols/PictureMarkerSymbol",
        "esri/renderers/SimpleRenderer",
        "esri/InfoTemplate",
        "esri/urlUtils",

        "esri/map",
	"esri/dijit/OverviewMap",
	"esri/dijit/HomeButton",
        "esri/dijit/Basemap",
        "esri/dijit/BasemapLayer",
        "esri/dijit/BasemapGallery",
        "esri/dijit/BasemapToggle",
        "esri/dijit/LayerList",
        "esri/arcgis/utils",
	"esri/geometry/Extent",
	"esri/geometry/Point",
	"js/tdt/TdtVectorLayer",
	"js/tdt/TdtVectorAnnoLayer",
	"js/tdt/TdtImageLayer",
	"js/tdt/TdtImageAnnoLayer",
	"js/baidu/BaiduVectorLayer",
	"js/baidu/BaiduAnnoLayer",
	"js/baidu/BaiduImageLayer",
        "esri/dijit/Measurement",
        "esri/dijit/Scalebar",
	"dijit/layout/BorderContainer",
	"dijit/layout/ContentPane",
        "dijit/TitlePane",
	"dojo/domReady!"
      ], function (
 	on,
	dom,
        parser,
	Graphic,
	GraphicsLayer,
	CSVLayer,
	Color,
	SimpleMarkerSymbol,
	PictureMarkerSymbol,
	SimpleRenderer,
	InfoTemplate,
	urlUtils,
        Map,
	OverviewMap,
	HomeButton,
	Basemap,
	BasemapLayer,
	BasemapGallery,
	BasemapToggle,
	LayerList,
        arcgisUtils,
	Extent,
	Point,
	TdtVectorLayer,
	TdtVectorAnnoLayer,
	TdtImageLayer,
	TdtImageAnnoLayer,
	BaiduVectorLayer,
	BaiduAnnoLayer,
	BaiduImageLayer,
	Measurement,
	Scalebar
      ) {
        parser.parse();
	main();

	function main(){
		initExtent = new Extent({"xmin":113.0582,"ymin":23.0209,"xmax":113.17527,"ymax":23.0366,"spatialReference":{"wkid":4326}});
		center = new Point({"x": 113.1030, "y": 23.0298, "spatialReference": {"wkid": 4326 } });
		map = new Map("map", {
	    		center: center,
			zoom: 14,
	    		logo: false
		});
		map.on("load",onMapLoad);
		map.on("click",onMapClick);

		//initImageLayer();
		//initBasemapGallery();
		//initBasemapToggle();

		initHomeButton();
		initVectorLayer();

		// for html ui
		registerUIEvents();
	}

	function onMapLoad(e){
		addLayer();
	}
	function onMapClick(e){
		// e.mapPoint e.screenPoint
		// e.graphics
		// geometry,
		console.log(e.mapPoint);
	}
	function initHomeButton(){
		var home = new HomeButton({
        		map: map
      		}, "HomeButton");
      		home.startup();
	}
	function initLayerList(){
		var layerList = new LayerList({
    			map: map,
    			layers: [csv]
  		},"LayerList");
		layerList.on('toggle',onToggleLayerList);
		layerList.startup();
	}
	function onToggleLayerList(e){
		// layerIndex visible
		console.log(e);
	}

	function addLayer(){
		var urlprefix = "http://localhost";
		var data_url = urlprefix + "/map/data/layer.json";

		csv = new GraphicsLayer();
		csv.id = "jinggai";
        	var orangeRed = new Color([238, 69, 0, 0.5]); // hex is #ff4500
        	var marker = new SimpleMarkerSymbol("solid", 15, null, orangeRed);
		var marker = new PictureMarkerSymbol(urlprefix+"/map/image/jinggai.jpg", 15, 15);
        	var renderer = new SimpleRenderer(marker);
        	csv.setRenderer(renderer);
        	var template = new InfoTemplate("ID: ${id}", "Address: ${address} </br> Image: <img src='${image}'/>");
        	csv.setInfoTemplate(template);

		// get json data
		$.ajax({
			type:"GET",
			url:data_url,
			dataType:"json",
			success: function (data) {
				$.each(data, function(i,e){
					var pt = new Point(e.longitude,e.latitude,map.spatialReference);
					//console.log(pt);
		 			var attr = {"id":e.id,"address":e.address,"image":urlprefix+"/map/image/jinggai.jpg"};
  					var graphic = new Graphic(pt,marker,attr,template);
					csv.add(graphic);
				});
				csv.on("mouse-over",onMouseOver);
				csv.on("mouse-out",onMouseOut);
        			map.addLayer(csv);
			},
			error: function (data) {
				console.log(data);
			}
		});

		/*
		data.forEach( function(e){
			var pt = new Point(e.longitude,e.latitude,map.spatialReference);
			//console.log(pt);
  			var attr = {"id":e.id,"address":e.address,"image":urlprefix+"/map/image/jinggai.jpg"};
  			var graphic = new Graphic(pt,marker,attr,template);
			csv.add(graphic);
		})
		csv.on("mouse-over",onMouseOver);
		csv.on("mouse-out",onMouseOut);
        	map.addLayer(csv);
		*/
	}

	function onMouseOver(e){
		map.setCursor("pointer");
	}
	function onMouseOut(e){
		map.setCursor("default");
	}

	function initVectorLayer(){
		vector = new TdtVectorLayer();
		map.addLayer(vector);

		vectoranno = new TdtVectorAnnoLayer();
		map.addLayer(vectoranno);
	}

	function initImageLayer(){
		image = new TdtImageLayer();
		map.addLayer(image);

		imageanno = new TdtImageAnnoLayer();
		map.addLayer(imageanno);
	}

	function initOverviewMap(){
		overviewMap = new OverviewMap({
    			map: map
  		}, dom.byId('OverviewMap'));
        	overviewMap.startup();
	}

	function initScalebar(){
		var scalebar = new Scalebar({
        		map: map,
        		scalebarUnit: "dual"
        	});
	}

	function initBasemapGallery(){
      		//add the basemap gallery, in this case we'll display maps from ArcGIS.com including bing maps
      		var basemapGallery = new BasemapGallery({
        		showArcGISBasemaps: false,
        		map: map
      		}, "basemapGallery");
      		basemapGallery.startup();
      		basemapGallery.on("error", function(msg) {
        		console.log("basemap gallery error:  ", msg);
      		});
	}

	function initBasemapToggle(){
		vector = new TdtVectorLayer();
		image = new TdtImageLayer();

		basemap = BasemapLayer();
      		var toggle = new BasemapToggle({
        		map: map,
        		basemap: "satellite"
      		}, "BasemapToggle");
      		toggle.startup();
	}

	function initMeasurement(){
        	var measurement = new Measurement({
        		map: map
        	}, dom.byId("measurementDiv"));
        	measurement.startup();
	}

	// for html ui events
	function registerUIEvents(){
		$("#button").bind('click',onclick);
	}
	function onclick(e){
		console.log(e);
		initImageLayer();
	}

});


text:
package serve

import (
	"net/http"
	"net/http/httptest"
	"testing"

	"github.com/cloudflare/cfssl/cli"
)

func TestServe(t *testing.T) {
	registerHandlers()
	ts := httptest.NewServer(http.DefaultServeMux)
	defer ts.Close()
	expected := make(map[string]int)
	for endpoint := range endpoints {
		expected[v1APIPath(endpoint)] = http.StatusOK
	}

	// Disabled endpoints should return '404 Not Found'
	expected[v1APIPath("sign")] = http.StatusNotFound
	expected[v1APIPath("authsign")] = http.StatusNotFound
	expected[v1APIPath("newcert")] = http.StatusNotFound
	expected[v1APIPath("info")] = http.StatusNotFound
	expected[v1APIPath("ocspsign")] = http.StatusNotFound
	expected[v1APIPath("crl")] = http.StatusNotFound
	expected[v1APIPath("gencrl")] = http.StatusNotFound
	expected[v1APIPath("revoke")] = http.StatusNotFound

	// Enabled endpoints should return '405 Method Not Allowed'
	expected[v1APIPath("init_ca")] = http.StatusMethodNotAllowed
	expected[v1APIPath("newkey")] = http.StatusMethodNotAllowed
	expected[v1APIPath("bundle")] = http.StatusMethodNotAllowed
	expected[v1APIPath("certinfo")] = http.StatusMethodNotAllowed
	expected[v1APIPath("certadd")] = http.StatusMethodNotAllowed

	// POST-only endpoints should return '400 Bad Request'
	expected[v1APIPath("scan")] = http.StatusBadRequest

	// Redirected HTML endpoints should return '200 OK'
	expected["/scan"] = http.StatusOK
	expected["/bundle"] = http.StatusOK

	// Non-existent endpoints should return '404 Not Found'
	expected["/bad_endpoint"] = http.StatusNotFound

	for endpoint, status := range expected {
		resp, err := http.Get(ts.URL + endpoint)
		if err != nil {
			t.Error(err)
		}
		if resp.StatusCode != status {
			t.Fatalf("%s: '%s' (expected '%s')", endpoint, resp.Status, http.StatusText(status))
		}
	}

	var c cli.Config
	var test = []string{"test"}
	if err := serverMain(test, c); err == nil {
		t.Fatalf("There should be an error for argument")
	}
}


text:
package de.neofonie.surlgen.processor.spring;

import de.neofonie.surlgen.processor.classwriter.UrlFactoryServiceWriter;
import de.neofonie.surlgen.processor.core.AbstractGenerator;
import de.neofonie.surlgen.processor.core.data.UrlMethod;

public class UrlFactoryServiceGenerator extends AbstractGenerator {

    @Override
    protected void handleElement(UrlMethod urlMethod) {
        final String name = urlMethod.getClazz().toString();
        final UrlFactoryServiceWriter urlFactoryServiceWriter = UrlFactoryServiceWriter.create(name);
        urlFactoryServiceWriter.appendMethod(urlMethod);
    }
}


text:
<?xml version='1.0' encoding='utf-8'?>
<package format="2">
  <name>bitbots_basler_camera</name>
  <version>1.0.0</version>
  <description>This sets up the basler camera</description>

  <maintainer email="bestmann@informatik.uni-hamburg.de">Marc Bestmann</maintainer>
  <maintainer email="info@bit-bots.de">Hamburg Bit-Bots</maintainer>
  <author email="info@bit-bots.de">Hamburg Bit-Bots</author>
  <license>MIT</license>

  <depend>bitbots_docs</depend>
  <depend>pylon_ros2_camera_wrapper</depend>
  <depend>image_proc</depend>

  <buildtool_depend>ament_cmake</buildtool_depend>

  <export>
     <bitbots_documentation>
      <status>unknown</status>
    </bitbots_documentation>
    <build_type>ament_cmake</build_type>
  </export>
</package>


text:
'use strict';

angular.module('skuapso-init', [
    'skuapso-http',
    'ui.bootstrap',
    'websocket.bullet',
    'isolated-scope'
])
.service('skuapso-init', [
    'isolatedScope',
    '$rootScope',
    '$modal',
    'skuapso-http',
    'bullet',
    'digest',
    'watcherExp',
    '$filter',
    function(is, root, modal, http, bullet, digest, watcherExp, filter) {
      var types = {
        group: {sortingValue: 0},
        object: {sortingValue: 1}
      };
      var data = this;

      this.update = function(src) {
        var item = this.data.get(src);
        angular.extend(item, src);
        item.$digest();
        root.$digest();
      };

      this.new = function(t, i, prop) {
        var o = is(), data = this, type = t, id = i;
        delete o['this'];
        angular.extend(o, prop || {});

        Object.defineProperty(o, 'sortingValue', {
          get: function() {return types[this.type].sortingValue;}
        });

        Object.defineProperty(o, 'ref', {
          get: function() {
            var obj = {};
            obj[this.type] = this.id;
            return obj;
          }
        });

        Object.defineProperty(o, 'type', {
          get: function() {
            return type;
          },
          set: function(newType) {
            if (type != newType) throw('skuapso', 'types not match');
            return this;
          }
        });

        Object.defineProperty(o, 'id', {
          get: function() {
            return id;
          },
          set: function(newId) {
            if (id != newId) throw('skuapso', 'ids not match');
            return this;
          }
        });

        o.edit = function() {
          var scope = root.$new(true);
          scope.header = 'Редактирование группы';
          scope.title = this.title;
          scope.modal = data[this.type](this);

          data.modal(scope, 'update');
        };

        return o;
      };

      this.delete = function(src) {
        var item = this.data.get(src);
        if (!item) return;
        var parent_item = this.data.get(item.parent);
        bullet.send({unsubscribe: item.ref});
        var i = 0, l = item.childs ? item.childs.length : 0;
        for (i; i < l; i++) {
          this.delete(item.childs[i]);
        }
        delete this.data[src.type + 's'][src.id];
        if (item.parent) {
          i = parent_item.childs.remove(item);
          parent_item.$digest();
        }
        root.$digest();
      };

      this.create = function(props) {
        var item, parentChilds, parentChildsId;
        if (this.data.get(props)) return;
        if (!this.data[props.type + 's']) {
          console.warn('undefined type %s', props.type);
          return;
        }
        if (!this[props.type]) {
          console.warn('undefined type %s', props.type);
          return;
        }
        item = this.data[props.type + 's'][props.id] = this[props.type](props);
        bullet.send({subscribe: item.ref});
        item.$on('destroed', function() {
          var ev = arguments[0],
            watchers = ev.currentScope.$$watchers,
            updated = new Array(),
            i = 0,
            l = watchers.length,
            keep;
          delete arguments[0];
          for (i; i < l; i++) {
            keep = true;
            angular.forEach(arguments, function(exp) {
              if (watcherExp(watchers[i]).indexOf(exp) > -1) {
                keep = false;
              }
            });
            if (keep) {
              updated.push(watchers[i]);
            }
          }
          ev.currentScope.$$watchers = updated;
        });
        if (!item.parent) return;
        parentChildsId = item.parent.type + '_' + item.parent.id;
        if (!this.childs[parentChildsId]) {
          this.childs[parentChildsId] = [];
        }
        parentChilds = this.childs[parentChildsId];
        parentChilds.push(item);
        Object.defineProperty(item, 'childs', {
          get: function() {
            return data.childs[this.type + '_' + this.id]
          ? data.childs[this.type + '_' + this.id]
          : emptyArray;
          }
        });
        item.$watch('parent', function(newVal, oldVal, scope) {
          if (newVal && oldVal && newVal.id == oldVal.id && newVal.type == oldVal.type) return;
          var i= oldVal.type + '_' + oldVal.id;
          data.childs[i].remove(scope);
          digest.add(data.data.get(oldVal) ? data.data.get(oldVal) : root);
          i = newVal.type + '_' + newVal.id;
          if (!data.childs[i]) data.childs[i] = [];
          data.childs[i].push(scope);
          data.childs[i] = filter('orderBy')(data.childs[i], ['sortingValue', 'title']);
          digest.add(data.data.get(newVal) ? data.data.get(newVal) : root);
          digest.add(root);
        }, angular.equals);
        if (root.loaded) {
          this.childs[parentChildsId] = filter('orderBy')(parentChilds, ['sortingValue', 'title']);
          this.data.get(item.parent).$digest();
        }
      };

      this.modal = function(scope, method, on) {
        var modalActions, modalOpts, modalWin;

        var uri = '/' + scope.modal.type;
        if (scope.modal.id !== null) uri += '/' + scope.modal.id;

        scope.data = this.data;

        scope.button = {
          save: 'Сохранить',
          close: 'Отменить'
        };

        scope.diff = function() {
          var id, diff = null, original = data.data[this.modal.type + 's'][this.modal.id];
          for (id in this.modal) {
            if (id.charAt(0) == '$') continue;
            if (!original
                || (typeof original[id] == 'undefined')
                || (typeof this.modal[id] == 'undefined')
                || (this.modal[id] != original[id])) {
              if (angular.isFunction(this.modal[id])) continue;
              if (!diff) diff = {};
              diff[id] = this.modal[id];
            }
          }
          return diff;
        };

        scope.typeaheadTitle = function(type) {
          return this.modal[type] ? this.modal[type].title : '';
        };

        modalActions = ['$scope', '$modalInstance', function(scope, modal) {
          scope.cancel = function() {
            if (on && on.cancel && angular.isFunction(on.cancel)) on.cancel(modal);
            modal.dismiss('canceled');
          };
          scope.save = function() {
            var data = Bert.encode(angular.safe_copy(this.diff())).hex;
            scope.disabled = true;
            http[method](uri, data)
              .success(function(data) {
                if (on && on.success && angular.isFunction(on.success)) on.success(data, modal);
                scope.disabled = false;
              })
              .error(function(data) {
                if (on && on.error && angular.isFunction(on.error)) on.error(data, modal);
                scope.disable = false;
              });
          };
        }];

        modalOpts = {
          scope: scope,
          controller: modalActions,
          templateUrl: '/static/tpl/skuapso/edit/' + scope.modal.type + '.tpl.html'
        };

        modalWin = modal.open(modalOpts);
      };

    }])
.service('skuapso-data', [
    'skuapso-http',
    '$rootScope',
    '$filter',
    'bullet',
    'digest',
    'skuapso-init',
    'skuapso-object',
    'skuapso-group',
    'skuapso-object-model',
    'skuapso-object-sensor',
    'skuapso-object-tool',
    'skuapso-specialization',
    'skuapso-terminal',
    'skuapso-terminal-model',
    'skuapso-sensor',
    'skuapso-geo',
    function(http, root, filter, bullet, digest,
      init, objects, groups, objectsModels, objectsSensors, objectsTools,
      spec, terminals, terminalsModels, sensors, geo) {
      var data = this, childs = {};

      root.loaded = false;
      this.objects = objects;
      this.groups = groups;
      this.object_models = objectsModels;
      this.object_sensors = objectsSensors;
      this.object_tools = objectsTools;
      this.specializations = spec;
      this.terminals = terminals;
      this.terminal_models = terminalsModels;
      this.sensors = sensors;
      this.geos = geo;
      init.data = this;
      init.childs = childs;
      this.get = function(obj) {
        if (!obj) return;
        var keys = Object.keys(obj);
        var type, id;
        if (keys.length == 1) {
          type = keys[0] + 's';
          id = obj[keys[0]];
        } else {
          type = obj.type + 's';
          id = obj.id;
        }
        if (this[type]) {
          return this[type][id];
        } else {
          console.warn("undefined type %o", obj);
          return;
        }
      };
      this.childs = function(obj) {
        return childs[obj.type + '_' + obj.id]
          ? childs[obj.type + '_' + obj.id]
          : emptyArray;
      };
      http.get('items').success(function(items) {
        var i = 0, l = items.length;
        for (i; i < l; i++) {
          init.create(items[i]);
        }
        for (i in childs) {
          childs[i] = filter('orderBy')(childs[i], ['sortingValue', 'sortingTitle', 'title']);
        }
        Object.defineProperty(root, 'childs', {
          get: function() {
            return childs['group_null']
              ? childs['group_null']
              : emptyArray;
          }
        });
        root.loaded = true;
      });
      bullet.on = {
        message: function(e) {
          var d = angular.fromJson(e.data);
          init[d.action](d.data);
        },
        send: function(obj) {
          var data = Bert.encode(obj).hex;
          return data;
        }
      };
    }])
;


text:
package May2021Leetcode;

public class _0747LargestNumberAtLeastTwiceOfOthers {
	public static void main(String[] args) {
		System.out.println(dominantIndex(new int[] { 3, 6, 1, 0 }));
		System.out.println(dominantIndex(new int[] { 1, 2, 3, 4 }));
	}

	public static int dominantIndex(int[] nums) {

	}
}


text:
package org.olat.repository.delete;

import java.util.List;

import org.olat.core.gui.UserRequest;
import org.olat.core.gui.components.Component;
import org.olat.core.gui.components.panel.Panel;
import org.olat.core.gui.components.table.ColumnDescriptor;
import org.olat.core.gui.components.table.DefaultColumnDescriptor;
import org.olat.core.gui.components.table.StaticColumnDescriptor;
import org.olat.core.gui.components.table.Table;
import org.olat.core.gui.components.table.TableController;
import org.olat.core.gui.components.table.TableEvent;
import org.olat.core.gui.components.table.TableGuiConfiguration;
import org.olat.core.gui.components.velocity.VelocityContainer;
import org.olat.core.gui.control.Controller;
import org.olat.core.gui.control.Event;
import org.olat.core.gui.control.WindowControl;
import org.olat.core.gui.control.controller.BasicController;
import org.olat.core.gui.translator.PackageTranslator;
import org.olat.core.util.Util;
import org.olat.repository.RepositoryEntry;
import org.olat.repository.RepositoryEntryTypeColumnDescriptor;
import org.olat.repository.RepositoryManager;
import org.olat.repository.delete.service.RepositoryDeletionManager;

/**
 * Controller for tab 'Learning-resource selection'
 *
 * @author Christian Guretzki
 */
public class StatusController extends BasicController {
	private static final String PACKAGE_REPOSITORY_MANAGER = Util.getPackageName(RepositoryManager.class);
	private static final String MY_PACKAGE = Util.getPackageName(StatusController.class);

	private static final String ACTION_SINGLESELECT_CHOOSE = "ssc";

	private final VelocityContainer myContent;
	private final Panel repositoryDeleteStatusPanel;
	private TableController tableCtr;
	private RepositoryEntryDeleteTableModel redtm;

	/**
	 * @param ureq
	 * @param wControl
	 * @param cancelbutton
	 */
	public StatusController(final UserRequest ureq, final WindowControl wControl) {
		super(ureq, wControl);

		final PackageTranslator fallbackTrans = new PackageTranslator(PACKAGE_REPOSITORY_MANAGER, ureq.getLocale());
		this.setTranslator(new PackageTranslator(MY_PACKAGE, ureq.getLocale(), fallbackTrans));
		myContent = createVelocityContainer("deletestatus");

		repositoryDeleteStatusPanel = new Panel("repositoryDeleteStatusPanel");
		repositoryDeleteStatusPanel.addListener(this);
		myContent.put("repositoryDeleteStatusPanel", repositoryDeleteStatusPanel);
		myContent.contextPut("header",
				translate("status.delete.email.header", new String[] { Integer.toString(RepositoryDeletionManager.getInstance().getDeleteEmailDuration()) }));
		initializeTableController(ureq);

		putInitialPanel(myContent);
	}

	/**
	 * @see org.olat.core.gui.control.DefaultController#event(org.olat.core.gui.UserRequest, org.olat.core.gui.components.Component, org.olat.core.gui.control.Event)
	 */
	@Override
	public void event(final UserRequest ureq, final Component source, final Event event) {
		//
	}

	/**
	 * @see org.olat.core.gui.control.DefaultController#event(org.olat.core.gui.UserRequest, org.olat.core.gui.control.Controller, org.olat.core.gui.control.Event)
	 */
	@Override
	public void event(final UserRequest ureq, final Controller source, final Event event) {
		if (source == tableCtr) {
			if (event.getCommand().equals(Table.COMMANDLINK_ROWACTION_CLICKED)) {
				final TableEvent te = (TableEvent) event;
				if (te.getActionId().equals(ACTION_SINGLESELECT_CHOOSE)) {
					final int rowid = te.getRowId();
					RepositoryManager.setLastUsageNowFor((RepositoryEntry) redtm.getObject(rowid));
					updateRepositoryEntryList();
				}
			}
		}
	}

	private void initializeTableController(final UserRequest ureq) {
		final TableGuiConfiguration tableConfig = new TableGuiConfiguration();
		tableConfig.setTableEmptyMessage(translate("error.no.repository.found"));

		removeAsListenerAndDispose(tableCtr);
		tableCtr = new TableController(tableConfig, ureq, getWindowControl(), getTranslator());
		listenTo(tableCtr);
		tableCtr.addColumnDescriptor(new RepositoryEntryTypeColumnDescriptor("table.header.typeimg", 0, null, getLocale(), ColumnDescriptor.ALIGNMENT_LEFT));
		tableCtr.addColumnDescriptor(new DefaultColumnDescriptor("table.header.displayname", 1, null, ureq.getLocale()));
		tableCtr.addColumnDescriptor(new DefaultColumnDescriptor("table.header.author", 2, null, ureq.getLocale()));
		tableCtr.addColumnDescriptor(new DefaultColumnDescriptor("table.header.lastusage", 3, null, ureq.getLocale()));
		tableCtr.addColumnDescriptor(new DefaultColumnDescriptor("table.header.deleteEmail", 4, null, ureq.getLocale()));
		tableCtr.addColumnDescriptor(new StaticColumnDescriptor(ACTION_SINGLESELECT_CHOOSE, "table.header.action", myContent.getTranslator().translate("action.activate")));

		updateRepositoryEntryList();
		tableCtr.setMultiSelect(false);
		repositoryDeleteStatusPanel.setContent(tableCtr.getInitialComponent());
	}

	protected void updateRepositoryEntryList() {
		final List l = RepositoryDeletionManager.getInstance().getReprositoryEntriesInDeletionProcess(RepositoryDeletionManager.getInstance().getDeleteEmailDuration());
		redtm = new RepositoryEntryDeleteTableModel(l);
		tableCtr.setTableDataModel(redtm);
	}

	/**
	 * @see org.olat.core.gui.control.DefaultController#doDispose(boolean)
	 */
	@Override
	protected void doDispose() {
		//
	}

}


text:
define(['winjs'], function (WinJS) {
    "use strict";

    var itemHeight = 130;

    function ScrollHandler(repeater, scrollableElement, defaultValueIndex) {
        this.repeater = repeater;
        this.value = WinJS.Binding.as({
            index: defaultValueIndex
        });
        this.scrollableElement = scrollableElement;

        this.init();
    }

    ScrollHandler.prototype.init = function () {
        var self = this;

        self.moveToItem(self.value.index);

        self.scrollableElement.onfocus = self.onfocus.bind(self);
        self.scrollableElement.onblur = self.onblur.bind(self);
        self.scrollableElement.onscroll = self.onScroll.bind(self);
        self.scrollableElement.onclick = self.onClickItem.bind(self);
    };

    ScrollHandler.prototype.dispose = function () {
        this.scrollableElement.onfocus = null;
        this.scrollableElement.onblur = null;
        this.scrollableElement.onclick = null;
        this.scrollableElement.onscroll = null;
        this.scrollableElement = null;
        this.repeater = null;
    };

    ScrollHandler.prototype.onfocus = function () {
        if (!WinJS.Utilities.hasClass(this.scrollableElement, "active")) {
            WinJS.Utilities.addClass(this.scrollableElement, "active");
        }
    };

    ScrollHandler.prototype.onblur = function () {
        if (WinJS.Utilities.hasClass(this.scrollableElement, "active")) {
            WinJS.Utilities.removeClass(this.scrollableElement, "active");
        }
    };

    ScrollHandler.prototype.moveToItem = function (itemIndex) {
        var self = this,
            itemElement = self.repeater.elementFromIndex(itemIndex),
            newPosition;

        if (!itemElement) {
            return;
        }

        newPosition = itemIndex * itemHeight;
        self.scrollableElement.scrollTop = newPosition;
        self.selectItem(itemIndex);
    };

    ScrollHandler.prototype.selectItem = function (itemIndex) {
        var self = this,
            itemElement = self.repeater.elementFromIndex(itemIndex),
            oldItemElement;

        if (!itemElement) {
            return;
        }

        oldItemElement = self.repeater.elementFromIndex(self.value.index);
        if (oldItemElement) {
            WinJS.Utilities.removeClass(oldItemElement, "selected");
        }

        WinJS.Utilities.addClass(itemElement, "selected");
        self.value.index = itemIndex;
    };

    ScrollHandler.prototype.onScroll = function (/*ev*/) {
        var self = this,
            scrollDistance = self.scrollableElement.scrollTop,
            itemIndex = Math.round(scrollDistance / itemHeight);

        self.selectItem(itemIndex);
    };

    ScrollHandler.prototype.onClickItem = function (ev) {
        var clickElement = ev.target,
            clickParentElement = clickElement.parentElement,
            repeaterItems = this.repeater.element.children,
            clickItemIndex = null,
            i, childNode;

        for (i = 0; i < repeaterItems.length; i++) {
            childNode = repeaterItems[i];

            if (clickItemIndex === null && (childNode === clickElement || childNode === clickParentElement)) {
                clickItemIndex = i;
            }
        }

        this.moveToItem(clickItemIndex);
    };

    ScrollHandler.prototype.getIndex = function () {
        return this.value.index;
    };

    return ScrollHandler;
});


text:
import { Component, OnInit, ElementRef, ViewChild, AfterViewInit, ChangeDetectorRef, AfterContentChecked, HostListener } from '@angular/core';
import { LoginService } from '@insights/app/login/login.service';
import { InsightsInitService } from '@insights/common/insights-initservice';
import { RestAPIurlService } from '@insights/common/rest-apiurl.service'
import { RestCallHandlerService } from '@insights/common/rest-call-handler.service';
import { CookieService } from 'ngx-cookie-service';//ngx-cookie
import { Router, ActivatedRoute, ParamMap, Params } from '@angular/router';
import { FormGroup, FormControl, Validators } from '@angular/forms';
import { DatePipe } from '@angular/common';
import { LogService } from '@insights/common/log-service';
import { DataSharedService } from '@insights/common/data-shared-service';
import { ImageHandlerService } from '@insights/common/imageHandler.service';
import { MessageDialogService } from '@insights/app/modules/application-dialog/message-dialog-service';
import { GrafanaAuthenticationService } from '@insights/common/grafana-authentication-service';
import { AutheticationProtocol } from '@insights/common/insights-enum';
import { DomSanitizer } from '@angular/platform-browser'

export interface ILoginComponent {
  createAndValidateForm(): void;
  userAuthentication(): void;

}

@Component({
  selector: 'app-login',
  templateUrl: './login.component.html',
  styleUrls: ['./login.component.css'],
  providers: [LogService, DatePipe]
})
export class LoginComponent implements OnInit, ILoginComponent, AfterViewInit {

  logMsg: string;
  isLoginError: boolean;
  isDisabled: boolean;
  kerberosToken: string;
  showThrobber: boolean = false;
  cookies: string;
  username: string;
  password: string;
  imageSrc: string = "";
  resourceImage: any;
  loginForm: FormGroup;
  imageAlt: String = "";
  displayLoginPage: boolean = true;
  loginRequestSent: boolean = false;
  year: any;
  eventData: string;
  version: any;

  constructor(private loginService: LoginService, private restAPIUrlService: RestAPIurlService,
    private restCallHandlerService: RestCallHandlerService, private cookieService: CookieService,
    private router: Router, private logger: LogService, private dataShare: DataSharedService,
    private datePipe: DatePipe, private imageHandeler: ImageHandlerService,
    private route: ActivatedRoute, public messageDialog: MessageDialogService,
    private grafanaService: GrafanaAuthenticationService, private activatedRoute: ActivatedRoute, private sanitizer:DomSanitizer) {
    var self = this;
    this.loginRequestSent = false
    console.log(" in login constructer")
  }

  ngOnInit() {
    var self = this
    this.version=InsightsInitService.version;
    console.log("autheticationProtocol " + InsightsInitService.autheticationProtocol)
    if (InsightsInitService.autheticationProtocol == AutheticationProtocol.SAML.toString() || InsightsInitService.autheticationProtocol == AutheticationProtocol.Kerberos.toString()) {
      console.log(" SSO is enable calling saml login");
      this.dataShare.storeTimeZone();
      this.deleteAllPreviousCookies();
      this.displayLoginPage = false;
      setTimeout(() => {
        this.loginService.loginSSO();
      }, 1000);
    } else if (InsightsInitService.autheticationProtocol == AutheticationProtocol.NativeGrafana.toString()) {
      console.log("Continue on login page ")
      this.deleteAllPreviousCookies();
      this.createAndValidateForm();
      this.dataShare.storeTimeZone();
      this.dataShare.removeAuthorization();
      this.dataShare.setWebAuthToken("-");
    } else if (InsightsInitService.autheticationProtocol == AutheticationProtocol.JWT.toString()) {
      console.log("JWT SSO is enable ");
      this.dataShare.storeTimeZone();
      this.deleteAllPreviousCookies();
      this.createAndValidateForm();
      this.dataShare.storeTimeZone();
      this.dataShare.removeAuthorization();
      this.dataShare.setWebAuthToken("-");
      this.displayLoginPage = false;
      console.log("Event Data " + this.eventData)

    }
    this.year = this.dataShare.getCurrentYear();
  }

  ngAfterViewInit() {
    console.log(" ngAfterViewInit ");
    var self = this;
    if(InsightsInitService.autheticationProtocol == AutheticationProtocol.NativeGrafana.toString() || InsightsInitService.autheticationProtocol == AutheticationProtocol.JWT.toString() ){
      this.getImageAsyncData();
    }
    function receiveMessage(event) {
      console.log(" in receiveMessage ngAfterViewInit event origin " + event.origin)
      //console.log(event.source)
      if (event.origin == InsightsInitService.jwtTokenOriginServerURL) {
        console.log(event.data)
        self.eventData = event.data;
        console.log(event)
        console.log(" origin " + event.origin)
        console.log(" event origin " + InsightsInitService.jwtTokenOriginServerURL + "  " + event.origin);
        self.callJWTAUTH();
      } else {
        //console.error(" JWT token origin mismatched " + InsightsInitService.jwtTokenOriginServerURL + "  " + event.origin)
      }
    }
    if (InsightsInitService.autheticationProtocol == AutheticationProtocol.JWT.toString()) {
      console.log(" in ngAfterViewInit for  " + AutheticationProtocol.JWT.toString() + "  " + this.eventData)
      window.addEventListener("message", receiveMessage, false);
    }
  }

  public createAndValidateForm() {
    this.loginForm = new FormGroup({
      username: new FormControl('', Validators.required),
      password: new FormControl('', Validators.required)
    });
  }

  callJWTAUTH() {
    console.log("callJWTAUTH Event Data " + this.eventData)
    if (this.eventData != undefined) {
      var tokenData = JSON.parse(this.eventData);
      console.log(tokenData);
      var messageToken = tokenData.insightsMessageToken;
      console.log(" JWT SSO is enable token received  " + messageToken);
      if (messageToken != undefined) {
        setTimeout(() => {
          this.loginService.loginSSOJWT(messageToken);
        }, 1000);
      } else {
        console.error(" Unable to parse received token  " + this.eventData);
      }
    } else {
      console.error(" data not received from parent ")
    }
  }

   async getImageAsyncData() {
    try {
      this.resourceImage = await this.grafanaService.getLogoImage();
      this.dataShare.removeCustomerLogoFromSesssion()
      if (this.resourceImage) {
        this.imageSrc =  this.sanitizer.sanitize(0,'data:image/jpg;base64,' + this.resourceImage.data.encodedString);
        this.imageHandeler.addImage("customer_logo_uploded", this.imageSrc);
        this.dataShare.uploadOrFetchLogo(this.imageSrc);
        (<HTMLInputElement>document.getElementById("logoimg")).src=this.imageSrc;
      } else {
        this.imageSrc = this.sanitizer.sanitize(0,'icons/svg/landingPage/Insights_Logo.png');
        (<HTMLInputElement>document.getElementById("logoimg")).src=this.imageSrc;
        this.imageAlt = 'Cognizant log';
        this.dataShare.uploadOrFetchLogo("DefaultLogo");
      }
    } catch (error) {
     console.log(error);
    }
  }

  public userAuthentication(): void {
    this.deleteAllPreviousCookies();
    this.loginRequestSent = true;
    this.username = this.loginForm.value.username;
    this.password = this.loginForm.value.password;
    this.kerberosToken = this.loginForm.value.kerberosToken;
    if ((this.username === '' || this.password === '') && this.kerberosToken === '') {
      this.logMsg = '';
    } else if (InsightsInitService.autheticationProtocol == AutheticationProtocol.NativeGrafana.toString()) {
      var self = this;
      this.isDisabled = true;
      this.showThrobber = true;
      var token = 'Basic ' + btoa(this.username + ":" + this.password);
      this.dataShare.setAuthorizationToken(token);
      this.loginService.loginUserAuthentication(this.username, this.password)
        .then((data) => {
          var grafcookies = data.data;
          if (data.status === 'success') { //SUCCESS
            self.showThrobber = false;
            var date = new Date();
            var minutes = 30;
            date.setTime(date.getTime() + (minutes * 60 * 1000));

            this.dataShare.setAuthorizationToken(token);
            this.dataShare.setSession();
            this.cookies = "";
            console.log(grafcookies);
            for (var key in grafcookies) {
              if (key != "jtoken" && key != "postLogoutURL" && key != "insights-sso-givenname") {
                this.cookieService.set(key, grafcookies[key], 0, '/');
              }else if (key == "jtoken") {
                this.dataShare.setAuthorizationToken(grafcookies["jtoken"]);
              }
            }
            setTimeout(() => {
              //self.showThrobber = false;
              self.router.navigate(['/InSights/Home']);
            }, 2000);
          } else if (data.status === "failure") {
            self.showThrobber = false;
            self.isLoginError = true;
            self.logMsg = data.message;
            self.isDisabled = false;
            self.loginRequestSent = false
          }
        })
        .catch(function (data) {

          if (data.status == 500) {
            self.logMsg = "Internal server error"
          } else if (data.status == 404) {
            self.logMsg = "Server Not found"
          } else if (data.status == 401 || data.status == 814) {
            self.logMsg = "Invalid Credentials. Please try again."
          } else {
            self.logMsg = "Internal server error";
          }
          self.loginRequestSent = false
          self.showThrobber = false;
          self.isLoginError = true;
          self.isDisabled = false;
        });
    } else if (InsightsInitService.autheticationProtocol == AutheticationProtocol.Kerberos.toString()) {
      console.log('kerberosToken ' + this.kerberosToken)
      this.dataShare.setAuthorizationToken(this.kerberosToken);
      /*  setTimeout(() => {
         this.router.navigate(['/ssologin']);
       }, 1000); */
    } else if (InsightsInitService.autheticationProtocol == AutheticationProtocol.JWT.toString()) {
      setTimeout(() => {
        this.loginService.loginSSOJWT(this.password);
      }, 1000);
    }
  }

  deleteAllPreviousCookies(): void {
    console.log("in delete all cookies ");
    let allCookies = this.cookieService.getAll();
    let grafana_session_cookie = this.cookieService.get('grafana_session');
    if (grafana_session_cookie != undefined || grafana_session_cookie != '') {
      this.cookieService.set('grafana_session', undefined);
    }
    this.dataShare.deleteAllPreviousCookies();
    this.cookieService.deleteAll('/');
    for (let key of Object.keys(allCookies)) {
      this.cookieService.delete(key, '/');
    }
    console.log(" deleted all cookies ");
  }
}


text:
namespace SceneEngine
{
    using namespace RenderCore;

    class RTShadowsBox
    {
    public:
        class Desc
        {
        public:
            unsigned _width, _height;
            unsigned _storageCount;
            unsigned _indexDepth;   // 16 or 32
            unsigned _triangleCount;

            Desc(unsigned width, unsigned height, unsigned storageCount, unsigned indexDepth, unsigned triangleCount)
                : _width(width), _height(height), _storageCount(storageCount), _indexDepth(indexDepth), _triangleCount(triangleCount) {}
        };

        using ResLocator = intrusive_ptr<BufferUploads::ResourceLocator>;
        using RTV = RenderCore::Metal::RenderTargetView;
        using UAV = RenderCore::Metal::UnorderedAccessView;
        using SRV = RenderCore::Metal::ShaderResourceView;

        UAV _gridBufferUAV;
        SRV _gridBufferSRV;
        UAV _listsBufferUAV;
        SRV _listsBufferSRV;
        ResLocator _gridBuffer;
        ResLocator _listsBuffer;

        RTV _dummyRTV;
        ResLocator _dummyTarget;

        ResLocator              _triangleBufferRes;
        Metal::VertexBuffer     _triangleBufferVB;
        SRV                     _triangleBufferSRV;

        Metal::ViewportDesc _gridBufferViewport;

        RTShadowsBox(const Desc&);
        ~RTShadowsBox();
    };

    RTShadowsBox::RTShadowsBox(const Desc& desc)
    {
        // we need 2 main buffers:
        //  1. "grid buffer" -- for each cell in the screen space grid, this has the starting
        //          point of the linked list of triangles
        //  2. "lists buffer" -- this contains all of the linked lists; interleaved together

        using namespace BufferUploads;
        using namespace Metal::NativeFormat;

        auto& uploads = GetBufferUploads();
        auto indexFormat = (desc._indexDepth==16) ? R16_UINT : R32_UINT;
        unsigned indexSize = (desc._indexDepth==16) ? 2 : 4;

        _gridBuffer = uploads.Transaction_Immediate(
            CreateDesc(
                BindFlag::UnorderedAccess | BindFlag::ShaderResource,
                0, GPUAccess::Read | GPUAccess::Write,
                BufferUploads::TextureDesc::Plain2D(desc._width, desc._height, indexFormat),
                "RTShadowsGrid"));

        _listsBuffer = uploads.Transaction_Immediate(
            CreateDesc(
                BindFlag::UnorderedAccess | BindFlag::ShaderResource | BindFlag::StructuredBuffer,
                0, GPUAccess::Read | GPUAccess::Write,
                BufferUploads::LinearBufferDesc::Create(indexSize*2*desc._storageCount, indexSize*2),
                "RTShadowsList"));

            // note that if we want to use alpha test textures on the triangles,
            // we will need to leave space for the texture coordinates as well.
        unsigned triangleSize = 52;
        _triangleBufferRes = uploads.Transaction_Immediate(
            CreateDesc(
                BindFlag::StreamOutput | BindFlag::ShaderResource | BindFlag::VertexBuffer | BindFlag::RawViews,
                0, GPUAccess::Read | GPUAccess::Write,
                BufferUploads::LinearBufferDesc::Create(triangleSize*desc._triangleCount, triangleSize),
                "RTShadowsTriangles"));

        _triangleBufferVB = Metal::VertexBuffer(_triangleBufferRes->GetUnderlying());
        _triangleBufferSRV = SRV::RawBuffer(_triangleBufferRes->GetUnderlying(), triangleSize*desc._triangleCount);

        _gridBufferUAV = UAV(_gridBuffer->GetUnderlying());
        _gridBufferSRV = SRV(_gridBuffer->GetUnderlying());
        _listsBufferUAV = UAV(_listsBuffer->GetUnderlying(), UAV::Flags::AttachedCounter);
        _listsBufferSRV = SRV(_listsBuffer->GetUnderlying());

        _dummyTarget = uploads.Transaction_Immediate(
            CreateDesc(
                BindFlag::RenderTarget,
                0, GPUAccess::Read | GPUAccess::Write,
                BufferUploads::TextureDesc::Plain2D(desc._width, desc._height, R8_UINT),
                "RTShadowsDummy"));
        _dummyRTV = RTV(_dummyTarget->GetUnderlying());

        _gridBufferViewport = Metal::ViewportDesc { 0.f, 0.f, float(desc._width), float(desc._height), 0.f, 1.f };
    }

    RTShadowsBox::~RTShadowsBox() {}

    static const utf8* StringShadowCascadeMode = u("SHADOW_CASCADE_MODE");

    PreparedRTShadowFrustum PrepareRTShadows(
        IThreadContext& context,
        Metal::DeviceContext& metalContext,
        LightingParserContext& parserContext,
        PreparedScene& preparedScene,
        const ShadowProjectionDesc& frustum,
        unsigned shadowFrustumIndex)
    {
        SceneParseSettings sceneParseSettings(
            SceneParseSettings::BatchFilter::RayTracedShadows,
            ~SceneParseSettings::Toggles::BitField(0),
            shadowFrustumIndex);
        if (!parserContext.GetSceneParser()->HasContent(sceneParseSettings))
            return PreparedRTShadowFrustum();

        Metal::GPUProfiler::DebugAnnotation anno(metalContext, L"Prepare-RTShadows");

        auto& box = Techniques::FindCachedBox2<RTShadowsBox>(256, 256, 1024*1024, 32, 64*1024);
        auto oldSO = Metal::GeometryShader::GetDefaultStreamOutputInitializers();

        static const Metal::InputElementDesc soVertex[] =
        {
            Metal::InputElementDesc("A", 0, Metal::NativeFormat::R32G32B32A32_FLOAT),
            Metal::InputElementDesc("B", 0, Metal::NativeFormat::R32G32_FLOAT),
            Metal::InputElementDesc("C", 0, Metal::NativeFormat::R32G32B32A32_FLOAT),
            Metal::InputElementDesc("D", 0, Metal::NativeFormat::R32G32B32_FLOAT)
        };

        static const Metal::InputElementDesc il[] =
        {
            Metal::InputElementDesc("A", 0, Metal::NativeFormat::R32G32B32A32_FLOAT),
            Metal::InputElementDesc("B", 0, Metal::NativeFormat::R32G32_FLOAT),
            Metal::InputElementDesc("C", 0, Metal::NativeFormat::R32G32B32A32_FLOAT),
            Metal::InputElementDesc("D", 0, Metal::NativeFormat::R32G32B32_FLOAT)
        };

        metalContext.UnbindPS<Metal::ShaderResourceView>(5, 3);

        const unsigned bufferCount = 1;
        unsigned strides[] = { 52 };
        unsigned offsets[] = { 0 };
        Metal::GeometryShader::SetDefaultStreamOutputInitializers(
            Metal::GeometryShader::StreamOutputInitializers(soVertex, dimof(soVertex), strides, 1));

        static_assert(bufferCount == dimof(strides), "Stream output buffer count mismatch");
        static_assert(bufferCount == dimof(offsets), "Stream output buffer count mismatch");
        metalContext.BindSO(MakeResourceList(box._triangleBufferVB));

            // set up the render state for writing into the grid buffer
        SavedTargets savedTargets(metalContext);
        metalContext.Bind(box._gridBufferViewport);
        metalContext.Unbind<Metal::RenderTargetView>();
        metalContext.Bind(Techniques::CommonResources()._blendOpaque);
        metalContext.Bind(Techniques::CommonResources()._defaultRasterizer);    // for newer video cards, we need "conservative raster" enabled

        PreparedRTShadowFrustum preparedResult;
        preparedResult.InitialiseConstants(&metalContext, frustum._projections);
        using TC = Techniques::TechniqueContext;
        parserContext.SetGlobalCB(metalContext, TC::CB_ShadowProjection, &preparedResult._arbitraryCBSource, sizeof(preparedResult._arbitraryCBSource));
        parserContext.SetGlobalCB(metalContext, TC::CB_OrthoShadowProjection, &preparedResult._orthoCBSource, sizeof(preparedResult._orthoCBSource));

        parserContext.GetTechniqueContext()._runtimeState.SetParameter(
            StringShadowCascadeMode,
            (preparedResult._mode == ShadowProjectionDesc::Projections::Mode::Ortho)?2:1);

            // Now, we need to transform the object's triangle buffer into shadow
            // projection space during this step (also applying skinning, wind bending, and
            // any other animation effects.
            //
            // Each object that will be used with projected shadows must have a buffer
            // containing the triangle information.
            //
            // We can deal with this in a number of ways:
            //      1. rtwritetiles shader writes triangles out in a stream-output step
            //      2. transform triangles first, then pass that information through the rtwritetiles shader
            //      3. transform triangles completely separately from the rtwritetiles step
            //
            // Method 1 would avoid extra transformations of the input data, and actually
            // simplifies some of the shader work. We don't need any special input buffers
            // or extra input data. The shaders just take generic model information, and build
            // everything they need, as they need it.
            //
            // We can also choose to reject backfacing triangles at this point, as well as
            // removing triangles that are culled from the frustum.
            //
        Float4x4 savedWorldToProjection = parserContext.GetProjectionDesc()._worldToProjection;
        parserContext.GetProjectionDesc()._worldToProjection = frustum._worldToClip;
        auto cleanup = MakeAutoCleanup(
            [&parserContext, &savedWorldToProjection]() {
                parserContext.GetProjectionDesc()._worldToProjection = savedWorldToProjection;
                parserContext.GetTechniqueContext()._runtimeState.SetParameter(StringShadowCascadeMode, 0);
            });

        CATCH_ASSETS_BEGIN
            parserContext.GetSceneParser()->ExecuteScene(
                context, parserContext, sceneParseSettings,
                preparedScene, TechniqueIndex_RTShadowGen);
        CATCH_ASSETS_END(parserContext)

        metalContext.UnbindSO();
        Metal::GeometryShader::SetDefaultStreamOutputInitializers(oldSO);

            // We have the list of triangles. Let's render then into the final
            // grid buffer viewport. This should create a list of triangles for
            // each cell in the grid. The goal is to reduce the number of triangles
            // that the ray tracing shader needs to look at.
            //
            // We could attempt to do this in the same step above. But that creates
            // some problems with frustum cull and back face culling. This order
            // allows us reduce the total triangle count before we start assigning
            // primitive ids.
            //
            // todo -- also calculate min/max for each grid during this step
        CATCH_ASSETS_BEGIN
            auto& shader = ::Assets::GetAssetDep<Metal::ShaderProgram>(
                "game/xleres/shadowgen/rtwritetiles.sh:vs_passthrough:vs_*",
                "game/xleres/shadowgen/consraster.sh:gs_conservativeRasterization:gs_*",
                "game/xleres/shadowgen/rtwritetiles.sh:ps_main:ps_*",
                "OUTPUT_PRIM_ID=1;INPUT_RAYTEST_TRIS=1");
            metalContext.Bind(shader);

            Metal::BoundInputLayout inputLayout(Metal::InputLayout(il, dimof(il)), shader);
            metalContext.Bind(inputLayout);

                // no shader constants/resources required

            unsigned clearValues[] = { 0, 0, 0, 0 };
            metalContext.Clear(box._gridBufferUAV, clearValues);

            metalContext.Bind(Techniques::CommonResources()._blendOpaque);
            metalContext.Bind(Techniques::CommonResources()._dssDisable);
            metalContext.Bind(Techniques::CommonResources()._cullDisable);
            metalContext.Bind(Metal::Topology::PointList);
            metalContext.Bind(MakeResourceList(box._triangleBufferVB), strides[0], offsets[0]);

            metalContext.Bind(
                MakeResourceList(box._dummyRTV), nullptr,
                MakeResourceList(box._gridBufferUAV, box._listsBufferUAV));
            metalContext.DrawAuto();
        CATCH_ASSETS_END(parserContext)

        metalContext.Bind(Metal::Topology::TriangleList);
        savedTargets.ResetToOldTargets(metalContext);

        preparedResult._listHeadSRV = box._gridBufferSRV;
        preparedResult._linkedListsSRV = box._listsBufferSRV;
        preparedResult._trianglesSRV = box._triangleBufferSRV;
        return std::move(preparedResult);
    }

    void RTShadows_DrawMetrics(
        RenderCore::Metal::DeviceContext& context,
        LightingParserContext& parserContext, MainTargetsBox& mainTargets)
    {
        SavedTargets savedTargets(context);
        auto restoreMarker = savedTargets.MakeResetMarker(context);

        context.GetUnderlying()->OMSetRenderTargets(1, savedTargets.GetRenderTargets(), nullptr); // (unbind depth)

        context.BindPS(MakeResourceList(5, mainTargets._gbufferRTVsSRV[0], mainTargets._gbufferRTVsSRV[1], mainTargets._gbufferRTVsSRV[2], mainTargets._msaaDepthBufferSRV));
        const bool useMsaaSamplers = mainTargets._desc._sampling._sampleCount > 1;

        StringMeld<256> defines;
        defines << "SHADOW_CASCADE_MODE=2";
        if (useMsaaSamplers) defines << ";MSAA_SAMPLERS=1";

        auto& debuggingShader = ::Assets::GetAssetDep<Metal::ShaderProgram>(
            "game/xleres/basic2D.vsh:fullscreen:vs_*",
            "game/xleres/shadowgen/rtshadmetrics.sh:ps_main:ps_*",
            defines.get());
        Metal::BoundUniforms uniforms(debuggingShader);
        Techniques::TechniqueContext::BindGlobalUniforms(uniforms);
        uniforms.BindShaderResources(1, {"RTSListsHead", "RTSLinkedLists", "RTSTriangles", "DepthTexture"});
        uniforms.BindConstantBuffers(1, {"OrthogonalShadowProjection", "ScreenToShadowProjection"});

        context.Bind(debuggingShader);
        context.Bind(Techniques::CommonResources()._blendStraightAlpha);
        SetupVertexGeneratorShader(context);

        for (const auto& p:parserContext._preparedRTShadows) {
            const Metal::ShaderResourceView* srvs[] =
                { &p.second._listHeadSRV, &p.second._linkedListsSRV, &p.second._trianglesSRV, &mainTargets._msaaDepthBufferSRV };

            SharedPkt constants[2];
            const Metal::ConstantBuffer* prebuiltConstants[2] = {nullptr, nullptr};
            prebuiltConstants[0] = &p.second._orthoCB;
            constants[1] = BuildScreenToShadowConstants(
                p.second, parserContext.GetProjectionDesc()._cameraToWorld,
                parserContext.GetProjectionDesc()._cameraToProjection);

            uniforms.Apply(
                context, parserContext.GetGlobalUniformsStream(),
                Metal::UniformsStream(constants, prebuiltConstants, dimof(constants), srvs, dimof(srvs)));
        }

        context.Draw(4);
    }

}


text:
<?php

namespace Spatie\Backup\Commands;

use Spatie\Backup\Events\HealthyBackupWasFound;
use Spatie\Backup\Events\UnhealthyBackupWasFound;
use Spatie\Backup\Tasks\Monitor\BackupDestinationStatus;
use Spatie\Backup\Tasks\Monitor\BackupDestinationStatusFactory;

class MonitorCommand extends BaseCommand
{
    /** @var string */
    protected $signature = 'backup:monitor';

    /** @var string */
    protected $description = 'Monitor the health of all backups.';

    public function handle()
    {
        $statuses = BackupDestinationStatusFactory::createForMonitorConfig(config('laravel-backup.monitorBackups'));

        $statuses->each(function (BackupDestinationStatus $backupDestinationStatus) {
            if ($backupDestinationStatus->isHealthy()) {
                $this->info("The backups on {$backupDestinationStatus->diskName()} are considered healthy.");
                event(new HealthyBackupWasFound($backupDestinationStatus));

                return;
            }

            $this->error("The backups on {$backupDestinationStatus->diskName()} are considered unhealthy!");
            event(new UnHealthyBackupWasFound($backupDestinationStatus));
        });
    }
}