text:
<def-group>
  <definition class="compliance"
  id="audit_rules_time_watch_localtime" version="1">
    <metadata>
      <title>Record Attempts to Alter Time Through the Localtime File</title>
      <affected family="unix">
        <platform>Red Hat Enterprise Linux 6</platform>
      </affected>
      <description>Record attempts to alter time through /etc/localtime
      </description>
    </metadata>
    <criteria comment="Test for localtime file being watched" >
      <criterion comment="watch localtime file"
      test_ref="test_audit_rules_time_watch_localtime" />
    </criteria>
  </definition>
  <ind:textfilecontent54_test check="all"
  check_existence="at_least_one_exists"
  comment="Tests the for presence etc localtime file in the rules file"
  id="test_audit_rules_time_watch_localtime" version="1">
    <ind:object object_ref="obj_audit_rules_time_watch_localtime" />
  </ind:textfilecontent54_test>
  <ind:textfilecontent54_object id="obj_audit_rules_time_watch_localtime"
  version="1">
    <ind:path>/etc/audit</ind:path>
    <ind:filename>audit.rules</ind:filename>
    <ind:pattern
    operation="pattern match">^[\s]*-w[\s]+\/etc\/localtime[\s]+-p[\s]+\b([rx]*w[rx]*a[rx]*|[rx]*a[rx]*w[rx]*)\b.*-k[\s]+[\S]+[\s]*$</ind:pattern>
    <ind:instance datatype="int">1</ind:instance>
  </ind:textfilecontent54_object>

</def-group>


text:
<xml xmlns:o="urn:schemas-microsoft-com:office:office">
 <o:MainFile HRef="../2017ClubChampionshipSeniors.htm"/>
 <o:File HRef="filelist.xml"/>
</xml>

redpajama_set_name: RedPajamaGithub


text:
<!DOCTYPE html>

    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <title>Class FlingTracker
   </title>
    <meta name="viewport" content="width=device-width">
    <meta name="title" content="Class FlingTracker
   ">
    <meta name="generator" content="docfx 2.59.4.0">

    <link rel="shortcut icon" href="../images/favicon.ico">
    <link rel="stylesheet" href="../styles/docfx.vendor.css">
    <link rel="stylesheet" href="../styles/docfx.css">
    <link rel="stylesheet" href="../styles/main.css">
    <meta property="docfx:navrel" content="../toc.html">
    <meta property="docfx:tocrel" content="toc.html">

    <meta property="docfx:rel" content="../">

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

              </button>

              <form class="navbar-form navbar-right" role="search" id="search">

                  <input type="text" class="form-control" id="search-query" placeholder="Search" autocomplete="off">

              </form>

Search Results for

          Show / Hide Table of Contents

Class FlingTracker

Inheritance

Object

FlingTracker

Namespace: Mapsui.UI.Utils

Assembly: Mapsui.UI.Eto.dll

Syntax

public class FlingTracker : object

Constructors

    |
    Improve this Doc

    View Source

FlingTracker()

Declaration

public FlingTracker()

Methods

    |
    Improve this Doc

    View Source

AddEvent(Int64, MPoint, Int64)

Declaration

public void AddEvent(long id, MPoint location, long ticks)

Parameters

        Type
        Name
        Description

        Int64
        id

        MPoint
        location

        Int64
        ticks

    |
    Improve this Doc

    View Source

CalcVelocity(Int64, Int64)

Declaration

public (double vx, double vy) CalcVelocity(long id, long now)

Parameters

        Type
        Name
        Description

        Int64
        id

        Int64
        now

Returns

        Type
        Description

        (, )<Double, Double>

    |
    Improve this Doc

    View Source

Clear()

Declaration

public void Clear()

    |
    Improve this Doc

    View Source

RemoveId(Int64)

Declaration

public void RemoveId(long id)

Parameters

        Type
        Name
        Description

        Int64
        id

                    Improve this Doc

                    View Source

In This Article

              Back to top

            Generated by DocFX


text:
/**
 * Created by mrivero on 28/02/2016.
 */

import {Injectable} from 'angular2/core';
import {Http, Headers, Response} from 'angular2/http';
import {Observable} from "rxjs/Observable";

/// <reference path="../d/gapi.d.ts" />

export interface User {
    email: string;
    displayName: string;
    picture?: string;
}

@Injectable()
export class GoogleService {

    gapi: any;
    apiKey = "AIzaSyCoRUmlrl47ty3dMkM4nk0hUK55syJkjQw";
    clientId = "63791508161-k9331fs3l9gh9iqf40en16j85mnhdlli.apps.googleusercontent.com";
    scopes = [
        'https://www.googleapis.com/auth/drive.install',
        'https://www.googleapis.com/auth/drive',
        'profile',
        'email'
    ];
    headers: Headers;

    constructor(public http: Http){
        this.gapi = gapi;
        this.gapi.client.setApiKey(this.apiKey);
        this.headers = new Headers();
    }

    authorize() {
        return new Promise((resolve, reject) => {
            let config: Object = {
                'client_id': this.clientId,
                'scope': this.scopes.join(' '),
                'immediate': true
            };
            this.gapi.auth.authorize(config,
                (token) => {
                    this.gapi.auth.setToken(token);
                    if (token && !token.error) {
                        resolve();
                    } else {
                        config['immediate'] = false;
                        gapi.auth.authorize(config, (token) => {
                            if (token && !token.error) {
                                resolve(token);
                            } else {
                                reject();
                            }
                        });
                    }
                })
        });
    }

    loadDriveFile(id: string) {
        let file: Object;

        return new Promise((resolve, reject)=> {
            this.gapi.client.load('drive', 'v2',
                () => {
                    let request = this.gapi.client.drive.files.get({'fileId': id});
                    request.execute((resp) => {
                        this.headers.append('Authorization', 'Bearer ' + this.gapi.auth.getToken().access_token);
                        resolve(resp);
                    });
                });
        });
    }

    getFileContent(downloadUrl: string){
        return  this.http.get(downloadUrl, {headers: this.headers});
    }

    getUserInfo(userId: any) {
        return new Promise((resolve, reject) => {
            let user: User;
            this.gapi.client.load('plus', 'v1').then(() => {
                let request = this.gapi.client.plus.people.get({
                    'userId': userId
                });

                request.execute((resp) => {
                    user = {
                        email: resp.emails[0].value,
                        displayName: resp.displayName,
                        picture: resp.image.url
                    };

                    resolve(user);
                });
            });
        });
    }

    saveFileToDrive(id: string, content: string) {
        var request = gapi.client.request({
            'path': '/upload/drive/v2/files/' + id,
            'method': 'PUT',
            'params': {'uploadType': 'media'},
            'headers': {
                'Content-Type': 'text/plain'
            },
            'body': content
        });

        request.execute(
            (resp) => {
                console.log('content updated');
            }
        );
    }

}


text:
package org.takes.rs;

import java.io.IOException;
import java.io.InputStream;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import lombok.EqualsAndHashCode;
import lombok.ToString;
import org.takes.Response;

/**
 * Response decorator, with an additional cookie.
 *
 * The decorator validates cookie name according
 * to RFC 2616
 * and cookie value according
 * to RFC 6265
 *
 *
Use this decorator in order to return a response with a "Set-Cookie"
 * header inside, for example:
 *
 *
 return new RsWithCookie(
 *   new RsText("hello, world!"),
 *   "u", "Jeff",
 *   "Path=/", "Expires=Wed, 13 Jan 2021 22:23:01 GMT"
 * );

 *
 *
This response will contain this header:
 *
 *
 Set-Cookie: u=Jeff;Path=/;Expires=Wed, 13 Jan 2021 22:23:01 GMT

 *
 *
The class is immutable and thread-safe.
 *
 * @author Yegor Bugayenko (yegor@teamed.io)
 * @version $Id$
 * @since 0.1
 */
@ToString(callSuper = true)
@EqualsAndHashCode(callSuper = true)
public final class RsWithCookie extends RsWrap {

    /**
     * Cookie value validation regexp.
     * @checkstyle LineLengthCheck (3 lines)
     */
    private static final Pattern CVALUE_PTRN = Pattern.compile(
        "[\\x21\\x23-\\x2B\\x2D-\\x3A\\x3C-\\x5B\\x5D-\\x7E]*|\"[\\x21\\x23-\\x2B\\x2D-\\x3A\\x3C-\\x5B\\x5D-\\x7E]*\""
    );

    /**
     * Cookie name validation regexp.
     */
    private static final Pattern CNAME_PTRN = Pattern.compile(
        "[\\x20-\\x7E&&[^()<>@,;:\\\"/\\[\\]?={} ]]+"
    );

    /**
     * Cookie header name.
     */
    private static final CharSequence SET_COOKIE = "Set-Cookie";

    /**
     * Pattern to get the current cookie value from header.
     */
    private static final Pattern COOKIE_PTRN = Pattern.compile(
        String.format("%s: ([^\\s].*)", RsWithCookie.SET_COOKIE)
    );

    /**
     * Ctor.
     * @param name Cookie name
     * @param value Value of it
     * @param attrs Optional attributes, for example "Path=/"
     */
    public RsWithCookie(final CharSequence name, final CharSequence value,
        final CharSequence... attrs) {
        this(new RsEmpty(), name, value, attrs);
    }

    /**
     * Ctor.
     * @param res Original response
     * @param name Cookie name
     * @param value Value of it
     * @param attrs Optional attributes, for example "Path=/"
     * @checkstyle ParameterNumberCheck (5 lines)
     */
    @SuppressWarnings("PMD.CallSuperInConstructor")
    public RsWithCookie(final Response res, final CharSequence name,
        final CharSequence value, final CharSequence... attrs) {
        super(
            new Response() {
                @Override
                public Iterable<String> head() throws IOException {
                    return new RsWithHeader(
                        new RsWithoutHeader(res, RsWithCookie.SET_COOKIE),
                        RsWithCookie.SET_COOKIE,
                        RsWithCookie.make(
                            RsWithCookie.previousValue(res),
                            name, value, attrs
                        )
                    ).head();
                }
                @Override
                public InputStream body() throws IOException {
                    return res.body();
                }
            }
        );
        RsWithCookie.checkName(name);
        RsWithCookie.checkValue(value);
    }

    /**
     * Build cookie string.
     * @param previous Previous Cookie value.
     * @param name Cookie name
     * @param value Value of it
     * @param attrs Optional attributes, for example "Path=/"
     * @return Text
     * @checkstyle ParameterNumberCheck (5 lines)
     */
    private static String make(final String previous, final CharSequence name,
        final CharSequence value, final CharSequence... attrs) {
        final StringBuilder text = new StringBuilder();
        if (!previous.isEmpty()) {
            text.append(String.format("%s,", previous));
        }
        text.append(String.format("%s=%s;", name, value));
        for (final CharSequence attr : attrs) {
            text.append(attr).append(';');
        }
        return text.toString();
    }

    /**
     * Retrieve potential previous cookie string.
     * @param res Current Response
     * @return Current cookie value or empty string.
     * @throws IOException If it fails.
     */
    private static String previousValue(final Response res) throws IOException {
        final StringBuilder cookie = new StringBuilder();
        final StringBuilder value = new StringBuilder();
        for (final String header : res.head()) {
            if (header.contains(RsWithCookie.SET_COOKIE)) {
                cookie.append(header);
                break;
            }
        }
        final Matcher matcher = RsWithCookie.COOKIE_PTRN
            .matcher(cookie.toString());
        if (matcher.find()) {
            value.append(matcher.group(1));
        }
        return value.toString();
    }

    /**
     * Checks value according RFC 6265 section 4.1.1.
     * @param value Cookie value
     * @return Cookie value
     */
    private static CharSequence checkValue(final CharSequence value) {
        if (!RsWithCookie.CVALUE_PTRN.matcher(value).matches()) {
            throw new IllegalArgumentException(
                String.format(
                    "Cookie value %s contains invalid characters",
                    value
                )
            );
        }
        return value;
    }

    /**
     * Checks name according RFC 2616, section 2.2.
     * @param name Cookie name;
     * @return Cookie name
     */
    private static CharSequence checkName(final CharSequence name) {
        if (!RsWithCookie.CNAME_PTRN.matcher(name).matches()) {
            throw new IllegalArgumentException(
                String.format(
                    "Cookie name %s contains invalid characters",
                    name
                )
            );
        }
        return name;
    }
}


text:
function sync(store, router, options) {
    var moduleName = (options || {}).moduleName || 'route'

    store.registerModule(moduleName, {
        namespaced: true,
        state: cloneRoute(router.currentRoute),
        mutations: {
            'ROUTE_CHANGED': function (state, transition) {
                store.state[moduleName] = cloneRoute(transition.to, transition.from)
            }
        }
    })

    var isTimeTraveling = false
    var currentPath

    // sync router on store change
    var storeUnwatch = store.watch(
        function (state) { return state[moduleName] },
        function (route) {
            if (route.fullPath === currentPath) {
                return
            }
            isTimeTraveling = true
            var methodToUse = currentPath == null
                ? 'replace'
                : 'push'
            currentPath = route.fullPath
            router[methodToUse](route)
        },
        { sync: true }
    )

    // sync store on router navigation
    var afterEachUnHook = router.afterEach(function (to, from) {
        if (isTimeTraveling) {
            isTimeTraveling = false
            return
        }
        currentPath = to.fullPath
        store.commit(moduleName + '/ROUTE_CHANGED', { to: to, from: from })
    })

    return function unsync() {
        // On unsync, remove router hook
        if (afterEachUnHook != null) {
            afterEachUnHook()
        }

        // On unsync, remove store watch
        if (storeUnwatch != null) {
            storeUnwatch();
        }

        // On unsync, unregister Module with store
        store.unregisterModule(moduleName)
    }
}

function cloneRoute (to, from) {
    var clone = {
        name: to.name,
        path: to.path,
        hash: to.hash,
        query: to.query,
        params: to.params,
        fullPath: to.fullPath,
        meta: to.meta
    }
    if (from) {
        clone.from = cloneRoute(from)
    }
    return Object.freeze(clone)
}


text:
namespace llvm {
namespace PBQP {

  /// Reduce a node of degree one.
  ///
  /// Propagate costs from the given node, which must be of degree one, to its
  /// neighbor. Notify the problem domain.
  template <typename GraphT>
  void applyR1(GraphT &G, typename GraphT::NodeId NId) {
    using NodeId = typename GraphT::NodeId;
    using EdgeId = typename GraphT::EdgeId;
    using Vector = typename GraphT::Vector;
    using Matrix = typename GraphT::Matrix;
    using RawVector = typename GraphT::RawVector;

    assert(G.getNodeDegree(NId) == 1 &&
           "R1 applied to node with degree != 1.");

    EdgeId EId = *G.adjEdgeIds(NId).begin();
    NodeId MId = G.getEdgeOtherNodeId(EId, NId);

    const Matrix &ECosts = G.getEdgeCosts(EId);
    const Vector &XCosts = G.getNodeCosts(NId);
    RawVector YCosts = G.getNodeCosts(MId);

    // Duplicate a little to avoid transposing matrices.
    if (NId == G.getEdgeNode1Id(EId)) {
      for (unsigned j = 0; j < YCosts.getLength(); ++j) {
        PBQPNum Min = ECosts[0][j] + XCosts[0];
        for (unsigned i = 1; i < XCosts.getLength(); ++i) {
          PBQPNum C = ECosts[i][j] + XCosts[i];
          if (C < Min)
            Min = C;
        }
        YCosts[j] += Min;
      }
    } else {
      for (unsigned i = 0; i < YCosts.getLength(); ++i) {
        PBQPNum Min = ECosts[i][0] + XCosts[0];
        for (unsigned j = 1; j < XCosts.getLength(); ++j) {
          PBQPNum C = ECosts[i][j] + XCosts[j];
          if (C < Min)
            Min = C;
        }
        YCosts[i] += Min;
      }
    }
    G.setNodeCosts(MId, YCosts);
    G.disconnectEdge(EId, MId);
  }

  template <typename GraphT>
  void applyR2(GraphT &G, typename GraphT::NodeId NId) {
    using NodeId = typename GraphT::NodeId;
    using EdgeId = typename GraphT::EdgeId;
    using Vector = typename GraphT::Vector;
    using Matrix = typename GraphT::Matrix;
    using RawMatrix = typename GraphT::RawMatrix;

    assert(G.getNodeDegree(NId) == 2 &&
           "R2 applied to node with degree != 2.");

    const Vector &XCosts = G.getNodeCosts(NId);

    typename GraphT::AdjEdgeItr AEItr = G.adjEdgeIds(NId).begin();
    EdgeId YXEId = *AEItr,
           ZXEId = *(++AEItr);

    NodeId YNId = G.getEdgeOtherNodeId(YXEId, NId),
           ZNId = G.getEdgeOtherNodeId(ZXEId, NId);

    bool FlipEdge1 = (G.getEdgeNode1Id(YXEId) == NId),
         FlipEdge2 = (G.getEdgeNode1Id(ZXEId) == NId);

    const Matrix *YXECosts = FlipEdge1 ?
      new Matrix(G.getEdgeCosts(YXEId).transpose()) :
      &G.getEdgeCosts(YXEId);

    const Matrix *ZXECosts = FlipEdge2 ?
      new Matrix(G.getEdgeCosts(ZXEId).transpose()) :
      &G.getEdgeCosts(ZXEId);

    unsigned XLen = XCosts.getLength(),
      YLen = YXECosts->getRows(),
      ZLen = ZXECosts->getRows();

    RawMatrix Delta(YLen, ZLen);

    for (unsigned i = 0; i < YLen; ++i) {
      for (unsigned j = 0; j < ZLen; ++j) {
        PBQPNum Min = (*YXECosts)[i][0] + (*ZXECosts)[j][0] + XCosts[0];
        for (unsigned k = 1; k < XLen; ++k) {
          PBQPNum C = (*YXECosts)[i][k] + (*ZXECosts)[j][k] + XCosts[k];
          if (C < Min) {
            Min = C;
          }
        }
        Delta[i][j] = Min;
      }
    }

    if (FlipEdge1)
      delete YXECosts;

    if (FlipEdge2)
      delete ZXECosts;

    EdgeId YZEId = G.findEdge(YNId, ZNId);

    if (YZEId == G.invalidEdgeId()) {
      YZEId = G.addEdge(YNId, ZNId, Delta);
    } else {
      const Matrix &YZECosts = G.getEdgeCosts(YZEId);
      if (YNId == G.getEdgeNode1Id(YZEId)) {
        G.updateEdgeCosts(YZEId, Delta + YZECosts);
      } else {
        G.updateEdgeCosts(YZEId, Delta.transpose() + YZECosts);
      }
    }

    G.disconnectEdge(YXEId, YNId);
    G.disconnectEdge(ZXEId, ZNId);

    // TODO: Try to normalize newly added/modified edge.
  }

#ifndef NDEBUG
  // Does this Cost vector have any register options ?
  template <typename VectorT>
  bool hasRegisterOptions(const VectorT &V) {
    unsigned VL = V.getLength();

    // An empty or spill only cost vector does not provide any register option.
    if (VL <= 1)
      return false;

    // If there are registers in the cost vector, but all of them have infinite
    // costs, then ... there is no available register.
    for (unsigned i = 1; i < VL; ++i)
      if (V[i] != std::numeric_limits<PBQP::PBQPNum>::infinity())
        return true;

    return false;
  }
#endif

  // Find a solution to a fully reduced graph by backpropagation.
  //
  // Given a graph and a reduction order, pop each node from the reduction
  // order and greedily compute a minimum solution based on the node costs, and
  // the dependent costs due to previously solved nodes.
  //
  // Note - This does not return the graph to its original (pre-reduction)
  //        state: the existing solvers destructively alter the node and edge
  //        costs. Given that, the backpropagate function doesn't attempt to
  //        replace the edges either, but leaves the graph in its reduced
  //        state.
  template <typename GraphT, typename StackT>
  Solution backpropagate(GraphT& G, StackT stack) {
    using NodeId = GraphBase::NodeId;
    using Matrix = typename GraphT::Matrix;
    using RawVector = typename GraphT::RawVector;

    Solution s;

    while (!stack.empty()) {
      NodeId NId = stack.back();
      stack.pop_back();

      RawVector v = G.getNodeCosts(NId);

#ifndef NDEBUG
      // Although a conservatively allocatable node can be allocated to a register,
      // spilling it may provide a lower cost solution. Assert here that spilling
      // is done by choice, not because there were no register available.
      if (G.getNodeMetadata(NId).wasConservativelyAllocatable())
        assert(hasRegisterOptions(v) && "A conservatively allocatable node "
                                        "must have available register options");
#endif

      for (auto EId : G.adjEdgeIds(NId)) {
        const Matrix& edgeCosts = G.getEdgeCosts(EId);
        if (NId == G.getEdgeNode1Id(EId)) {
          NodeId mId = G.getEdgeNode2Id(EId);
          v += edgeCosts.getColAsVector(s.getSelection(mId));
        } else {
          NodeId mId = G.getEdgeNode1Id(EId);
          v += edgeCosts.getRowAsVector(s.getSelection(mId));
        }
      }

      s.setSelection(NId, v.minIndex());
    }

    return s;
  }

} // end namespace PBQP
} // end namespace llvm

#endif // LLVM_CODEGEN_PBQP_REDUCTIONRULES_H


text:
[![Latest Stable Version](https://poser.pugx.org/expressly/php-common/version)]( https://packagist.org/packages/expressly/php-common)
[![Build Status](https://api.travis-ci.org/expressly/php-common.png)](https://travis-ci.org/expressly/php-common)
[![Code Climate](https://codeclimate.com/github/expressly/php-common/badges/gpa.svg)](https://codeclimate.com/github/expressly/php-common)
[![Test Coverage](https://codeclimate.com/github/expressly/php-common/badges/coverage.svg)](https://codeclimate.com/github/expressly/php-common/coverage)

The Expressly PHP SDK provides as much of the heavy-lifting of the Expressly Network API to help developers wishing to
integrate their rails e-commerce platform with the [Expressly network](https://buyexpressly.com).

## Getting Started

Requirements
PHP 5.3+
composer
All composer dependencies are included in the Expressly provided integration releases on GitHub.

Include
Inside your composer.json, you need to include:

    "require": {
        "expressly/php-common": "2.4.1""
    }

Or, run the command:

    composer require expressly/php-common:2.4.1

<!--
## Documentation

Documentation for this repository can be found [here](http://expressly.readthedocs.io/en/latest/)

Further resources including popular e-commerce platform modules can be found on the
[Expressly developer portal](http://developer.buyexpressly.com).

-->
## License

Copyright (c) 2016 Expressly. See LICENSE for further details.

## One-click customer acquisition

Expressly helps merchants grow by attracting new quality visitors from other online shops where people already buy,
while making it extremely convenient for them to convert to the new shop.


text:
from qiita_db.study import Study
from qiita_db.sql_connection import TRN

def searcher(df):
    search = r"\t|\n"

    return [col for col in df
            if df[col].str.contains(search, na=False, regex=True).any()]

studies = Study.get_by_status('private').union(
    Study.get_by_status('public')).union(Study.get_by_status('sandbox'))

# we will start search using pandas as is much easier and faster
# than using pgsql. remember that to_dataframe actually transforms what's
# in the db
to_fix = []
for s in studies:
    st = s.sample_template
    if st is None:
        continue
    cols = searcher(st.to_dataframe())
    if cols:
        to_fix.append((st, cols))

    for pt in s.prep_templates():
        if pt is None:
            continue
        cols = searcher(pt.to_dataframe())
        if cols:
            to_fix.append((pt, cols))

# now let's fix the database and regenerate the files
for infofile, cols in to_fix:
    with TRN:
        for col in cols:
            # removing tabs
            sql = """UPDATE qiita.{0}{1}
                        SET {2} = replace({2}, chr(9), ' ')""".format(
                            infofile._table_prefix, infofile.id, col)
            TRN.add(sql)

            # removing enters
            sql = """UPDATE qiita.{0}{1}
                        SET {2} = regexp_replace(
                            {2}, E'[\\n\\r\\u2028]+', ' ', 'g' )""".format(
                            infofile._table_prefix, infofile.id, col)
            TRN.add(sql)

        TRN.execute()

    infofile.generate_files()


text:
Normally, when evaluating programs within the editor, the results are displayed as structured data (that can then also be manipulated).  This data can be visualized as raw symbolic expressions, or with custom visualizations (e.g., viewing the data in some graphical form, or with a different notation that better matches the domain).

Beyond treating results as data, some can also be treated as interactive systems of their own (the editor itself can be thought of as such an interactive system).  For safety by default, these interactions are isolated/sandboxed, in that any events/effects they have are recorded in buffers, but don't otherwise escape.  If desired, their effects/events can be hooked up to capabilities that allow them to communicate with and manipulate external systems, including the host editor.

These embedded interactive systems should support logging, replaying, and arbitrary splicing/editing of incoming and generated events (event sourcing), to support exploration and debugging.

Bootstrapping goal: it should be possible to build new systems, such as games or editors, as embedded interactions for testing, and then reboot directly into the interaction to treat it as the new host system (shedding/garbage collecting any "dead code or data" not needed from the old host system).

### YSWYG/YAHWYS/WYSYAH editor
* what is the first UI you see/type-into when opening?
  * keyboard command pane on far right
  * named relation explorer on far left
  * definition/palette pane on the left
  * (multiple) view/result pane(s) on the right
* personalization
  * accessibility
  * color schemes: color blindness, solarized, vim, emacs, etc.
  * suggestion/hint/advice settings (new user, experienced user, power user)
  * user-configurable resource quotas

### self-extensible browser-based editor
* text-like editor mode
  * present an AST-editing interface that feels like text editing
  * how to move subterms to remote locations?
    * name-based contexts
    * how to close terms? is it even necessary anymore? probably only upon extraction, which shouldn't be a problem
  * left/right arrow keys navigate per-char; up/down quickly jump parent/child expressions, remembering last-visited child?
    * shift+arrow for larger movements
    * some way to toggle/reorder siblings, sort of like reversing a subrange of widgets
  * unit acts like a typing context, space opens a new such context
  * typing the first character in a new context should clearly indicate its syntactic category
  * numeric characters do the usual
  * alphabetic characters start a new variable
    * only prefixes for in-scope vars will work (open up an auto-complete list)
    * should have some way to start variable for non-alpha chars
  * { opens new pair; } leaves it
  * ( opens a new application; ) in the final context leaves it
  * \ begins a lambda, moving into the arg list (while showing "(lambda (")
    * ) leaves arg list; ) again leaves lam body
    * new contexts inside the arg list are like lam-wrapping
    * removing var applies that lam to unit

### smart editors
* non-textual
  * directly manipulate program structure
    * syntactically-correct programs by construction
    * non-textual modes of input and presentation possible
  * removes bias towards monolithic text files
    * many independently-developed code fragments grouped and combined in multiple ways
* context-aware editing and exploration
  * code completion/suggestions
  * "time-traveling" symbolic evaluation and debugging; better than a REPL
  * programmable state/output visualization and dependency/correlation tracing
    * which portions of the program determine a given component of the output?
  * generalization from examples
  * allows more intelligent version control
  * interact/inspect/debug under lambda: abstract bindings
  * debugging with provenance tracking
* layered program views and elaboration
  * infer lower levels from higher levels
    * specifications -> high-level implementations -> low-level representations
  * semi-manually intervene/optimize at any level
* programmable visualization and interaction
  * produce specialized WYSIWYG "editors" for creative tasks
* collaboration tools
  * simultaneous manipulation of shared spaces with other users
  * remote space/repository/DB publish/subscribe
* conveniently ubiquitous programming via html-embedded editor widgets
  * widget allows page-local manipulation/execution
  * can be rendered chrome-less (for seamless appearance) or expanded into the full editor in-page
  * can connect to externally hosted DBs to import/export additional programs/content
    * browsing a page with embedded code widgets and want to ...
      * ... interact with the embedded code later?
        * export a reference/copy to your personal DB
      * ... interact with the embedded code while incorporating some of your own code?
        * immediately import it from your personal DB
    * on top of serendipitous programming, enables working on personal projects from anywhere
      * assumes you trust the machine you run the browser on, or provide some other security mechanism
        * such as accessing revoke-able and/or read-only DB capabilities
  * editor can support more than just "code" editing
    * symbol manipulation (typical programming), graphics, sound, arbitrary html, other domain-specific editing
      * arbitrary html would mean you can run the editor in the editor...
      * similar ideas? http://blog.duangle.com/2015/01/conspire-programming-environment-for.html

### Visualization
* text
  * tokens
  * labels
  * input boxes
* UI elements
  * boolean
    * checkbox, radio, dropdown/list, lightswitch
  * numbers
    * slider, color selector
    * textual digits in different bases: 7 vs. #b111
  * tuples and sets
    * (labeled) lists/forms
    * tables
* graphics
  * numbers
    * stack/line/bundle of bullets/boxes/sticks
    * polygons
    * circular/rectangular/bar areas
    * points on a scale
    * scaled lines
    * colors
  * lists
    * numerical
      * cartesian/polar plots
      * vectors
      * areas, angular sweeps
      * images
    * general
      * juxtapose, superimpose
      * deltas, paths, motion/animation
  * sets
    * statistics and summaries
      * brackets/ranges, candlesticks
      * histograms

### Data representation
* metadata ideas
  * Annotating data with metadata supports choosing UI that depends on context.
  * uids
  * UI-related concerns such as element styling/layout/navigation-modes
  * provenance tracking
  * aspect info based on usage, such as syntax highlighting annotations for data treated as code
    * e.g., keyword, variable, literal, expr/component/grouping with type/arity
    * this information guides/augments editing/visualization interfaces
      * e.g., variable renaming, subexpr choices/constraints, syntax errors, rich literal editors/renderers
      * debuggers via hyperprogrammed small step evaluators
    * "parsing" code maps uids to corresponding aspect info
* mirror tree for annotating data with metadata
  * keep data structures separately interpretable in O(1) from their metadata
* design a DOM-compatible algebra
  * look at REBOL UI constructors for inspiration
  * mouse icons?
  * DOM-making capabilities
    * safe tags, attrs, styles (e.g., forbid `<script>` and `<style>`)
  * basic text
  * anchor
  * image
  * button
  * form, input
    * label
    * text
    * checkbox
    * radio
  * textarea
  * slider/range
  * progress
  * list (u/o)
  * table
  * select/dropdown
  * styling
    * position/size/spacing
    * overlay
    * emphasis/underline/etc.
    * color
    * highlighting
    * animation, fading, motion

### Misc design and UI ideas
* code layout/styling/navigation
  * configure absolute vs. hierarchical navigation per element
  * style information as data that's also manipulated in the editor
  * default vs. override
  * layout, direction
  * lanky, compact
  * styling for quote, quasiquote, unquote
    * generally, styling to preserve presentation close to original text
* highlight/animate changes
* clearly indicate UI element selection/selectability
* map simple data to document types?
  * visual indication
  * lists may change presentation to look like underlying pairs in hierarchical mode
  * absolute mode may force alignment with adjacent siblings along structural similarity
    * spreadsheet-like grid
* folder-like exploration
  * scopes and palettes
  * garbage area
* allow user to provide alternative UI and data values for cells
  * allows exploring alternate computations by just clicking a radio button, check box, etc.
* maybe infer lenses from editing actions
* possible sources of inspiration:
  * https://semantic-ui.com/
  * https://github.com/Shopify/draggable
  * https://conclave-team.github.io/conclave-site/
  * https://docs.google.com/presentation/d/1MD-CgzODFWzdpnYXr8bEgysfDmb8PDV6iCAjH5JIvaI/edit#slide=id.g1d7c11dd1b_0_304

### Example apps and ideas
* TodoMVC
* https://github.com/eugenkiss/7guis/wiki
* kill the bill: splitting a bill via collaborative editing
* https://foam-framework.github.io/foam/
* Drawing: https://make8bitart.com/
* deck of cards, board games
* etoys examples, dynamic systems, simulations, real-time games
* collab tools
  * secure identities/signing, peer-to-peer communication
  * shared whiteboard
  * room-based chat with offline/async/email-like support
  * rich text docs, spreadsheets
  * video calling

### Technical issues
* data persistence and ingestion
  * appcache
  * local storage
  * indexedDB
  * dumpfile download
  * file upload
  * link-only representations
    * e.g., inline image data to not depend on external source availability
  * tab synchronization
    * how would browser tabs coordinate shared state?
    * are they separate processes? who owns what?
    * is local storage and indexed db a separate process?
    * test localstorage tab count
* communication
  * cors without web server
  * webRTC, webcam
  * websockets
  * peer to peer connection (STUN servers?)
* events
  * simple tagged events
  * UI element event handlers
    * use data- attributes
      * get/setAttribute
    * define per element type
    * database of per element attributes/deltas/state to supplement crappy event fields
  * filtered event log view
  * think pygame?
  * http://quirksmode.org/js/contents.html#events
  * http://sprymedia.co.uk/
    * design/UI ideas, ve1+2
  * extensions
    * network, db, process control
      * processes as timer rules (time-triggered events)
    * reactive state changes
* UI
  * accessibility
  * can you program just with two thumbs? (mobile UI)
  * drag and drop
  * measure textarea ch units
  * DOM rendering/graphics/audio with diffing
* introduce revocation handles when distributing capabilities


text:
#include <QApplication>
#include "Arb2PWLWidget.h"

int main(int argc, char *argv[])
{
    QApplication app(argc, argv);
    Arb2PWLWidget arb2PWLWidget;

    arb2PWLWidget.show();
    return app.exec();
}


text:
"""
msort is the library backing the mediasort.py command line tool
"""

__version__ = "2.0"

class MSortError(Exception):
    """
    Generic msort based error
    """
    pass


text:
General informations

        Label
        <input type="text" class="form-control" id="label" required placeholder="{{event.label}}" ng-model="event.label">

        Description
        <input type="text " class="form-control" id="inputDescription" placeholder="{{event.description}}" ng-model="event.description">

        Url
        <input type="text " class="form-control" id="inputUrl" placeholder="{{event.url}}" ng-model="event.url">

Time & localization

        Start at

                <input type="text" class="form-control" id="inputStart" name="inputStart" placeholder="Start at" ng-model="event.startAt">

                <datetimepicker data-ng-model="event.startAt" data-datetimepicker-config="{ dropdownSelector: '#dropdown2' }"/>

 eventNewForm.eventEnd">
            The start date must be before the end date

        End at

                <input type="text" class="form-control" id="inputEnd" name="inputEnd" placeholder="End at" ng-model="event.endAt">

                <datetimepicker data-ng-model="event.endAt" data-datetimepicker-config="{ dropdownSelector: '#dropdown2' }"/>

        <div class="alert alert-danger" role="alert" ng-show="eventNewForm.eventStart.$dirty && eventNewForm.eventEnd < eventNewForm.eventStart ">
            The end date must be after the start date

Content

{{ role.person.label }}

            {{ role.roleLabel.label }}


text:
"""Unit tests and parser data tests for cclib."""

from .data import *
from .data import *
from test import test_data


text:
package com.thinkbiganalytics.spark.jdbc;

import org.apache.spark.sql.jdbc.JdbcDialect;
import org.apache.spark.sql.jdbc.JdbcType;
import org.apache.spark.sql.types.DataType;
import org.apache.spark.sql.types.MetadataBuilder;

import java.sql.Connection;

import javax.annotation.Nonnull;

import scala.Option;
import scala.collection.immutable.Map;

/**
 * Wraps a {@code JdbcDialect} and provides default implementations of Dialect methods.
 */
public class DefaultDialect extends Dialect {

    private static final long serialVersionUID = 3850581911354957856L;

    /**
     * JDBC dialect to delegate to
     */
    @Nonnull
    private final JdbcDialect delegate;

    /**
     * Constructs a {@code DefaultDialect} that forwards to the specified JDBC dialect.
     */
    public DefaultDialect(@Nonnull final JdbcDialect delegate) {
        this.delegate = delegate;
    }

    @Override
    public boolean canHandle(String url) {
        return delegate.canHandle(url);
    }

    @Override
    public Option<DataType> getCatalystType(int sqlType, String typeName, int size, MetadataBuilder md) {
        return delegate.getCatalystType(sqlType, typeName, size, md);
    }

    @Override
    public Option<JdbcType> getJDBCType(DataType dt) {
        return delegate.getJDBCType(dt);
    }

    @Override
    public String quoteIdentifier(String colName) {
        return delegate.quoteIdentifier(colName);
    }

    @Override
    public String getTableExistsQuery(String table) {
        return delegate.getTableExistsQuery(table);
    }

    @Override
    public void beforeFetch(Connection connection, Map<String, String> properties) {
        delegate.beforeFetch(connection, properties);
    }
}


text:
@interface BKBTableManager()<UITableViewDelegate, UITableViewDataSource> {

    BKBTableManagerInit *private_tableInit;
}

- (void)_updateCellNotification:(NSNotification *)notification;
- (void)_updateHeightCellNotification:(NSNotification *)notification;

@end

@implementation BKBTableManager

#pragma mark - LifeCycle
- (void)configureWithInit:(BKBTableManagerInit *)managerInit {

    private_tableInit = managerInit;
}

- (void)dealloc { }

#pragma mark - Notifications
- (void)_updateCellNotification:(NSNotification *)notification {

    bkb_MainQueue(^{

        [[private_tableInit.delegate tableView] beginUpdates];
        NSArray *indexPaths = notification.object[@"indexPath"];
        [[private_tableInit.delegate tableView] reloadRowsAtIndexPaths:indexPaths withRowAnimation:UITableViewRowAnimationAutomatic];
        [[private_tableInit.delegate tableView] endUpdates];
    });
}

- (void)_updateHeightCellNotification:(NSNotification *)notification {

    id<BKBTableItemModelProtocol> model = notification.object[kBKBTableItemNotification_IndexPathModel];
    NSNumber *value = notification.object[kBKBTableItemNotification_Value];
    NSIndexPath *indexPath = [private_tableInit.modelManager indexPathByModel:model];
    if (!indexPath) {

        return;
    }
    BKBTableItemCell *itemCell = [private_tableInit.cellManager itemCellAtIndexPath:indexPath];
    itemCell.rowHeight = ^CGFloat(NSIndexPath *indexPath) {

        return [value floatValue];
    };
    [private_tableInit.cellManager replaceItemCell:itemCell atIndexPath:indexPath];

    bkb_MainQueue(^{

        [[private_tableInit.delegate tableView] beginUpdates];
        [[private_tableInit.delegate tableView] reloadRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationAutomatic];
        [[private_tableInit.delegate tableView] endUpdates];
    });
}

#pragma mark - Work
- (void)startManaging {

    [private_tableInit.delegate tableView].delegate = self;
    [private_tableInit.delegate tableView].dataSource = self;

    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(_updateCellNotification:) name:kBKBTableItemNeedUpdate object:nil];
    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(_updateHeightCellNotification:) name:kBKBTableItemNeedHeightUpdate object:nil];

//header view
    if (private_tableInit.tableConfigure.topTableView) {

        [[private_tableInit.delegate tableView] addSubview:private_tableInit.tableConfigure.topTableView];
    }

//register cells
    NSArray *cellIds = [private_tableInit.tableConfigure cellKeys];
    for(NSString *cellId in cellIds) {

        UINib *nib = [UINib nibWithNibName:[private_tableInit.tableConfigure xibNameByKey:cellId] bundle:nil];
        [[private_tableInit.delegate tableView] registerNib:nib forCellReuseIdentifier:cellId];
    }

//register header
    NSArray *headerIds = [private_tableInit.tableConfigure headerKeys];
    for(NSString *headerId in headerIds) {

        UINib *nib = [UINib nibWithNibName:[private_tableInit.tableConfigure xibHeaderNameByKey:headerId] bundle:nil];
        [[private_tableInit.delegate tableView] registerNib:nib forHeaderFooterViewReuseIdentifier:headerId];
    }

    [self reloadAll];
}

- (void)stopManaging {

    [private_tableInit.delegate tableView].delegate = nil;
    [private_tableInit.delegate tableView].dataSource = nil;

    [[NSNotificationCenter defaultCenter] removeObserver:self];
}

#pragma mark - Table Routine
- (void)reloadAll {

    [[private_tableInit.delegate tableView] reloadData];
}

- (void)hideTable {

    [private_tableInit.delegate tableView].hidden = YES;
}

- (void)showTable {

    [private_tableInit.delegate tableView].hidden = NO;
}

- (void)clearAll {

    [private_tableInit.cellManager removeAllItems];
    [private_tableInit.modelManager removeAllItems];
}

- (void)reloadSection:(NSUInteger)section animation:(UITableViewRowAnimation)rowAnimation{

    NSIndexSet *indexSet = [NSIndexSet indexSetWithIndex:section];
    [[private_tableInit.delegate tableView] reloadSections:indexSet withRowAnimation:rowAnimation];
}

- (NSIndexPath *)indexPathByModel:(id<BKBTableItemModelProtocol>)model {

    NSIndexPath *indexPath = [private_tableInit.modelManager indexPathByModel:model];
    return indexPath;
}

#pragma mark - DataSource
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {

    return [private_tableInit.cellManager countInSection:section];
}

- (UITableViewCell *)tableView:(UITableView *)tableViewObject cellForRowAtIndexPath:(NSIndexPath *)indexPath {

    id<BKBTableItemModelProtocol> model = [private_tableInit.modelManager modelItemAtIndexPath:indexPath];
    BKBTableItemCell *itemCell = [private_tableInit.cellManager itemCellAtIndexPath:indexPath];
    UITableViewCell<BKBTableViewCellProtocol> *cell = [tableViewObject dequeueReusableCellWithIdentifier:itemCell.cellId];
    [cell updateModel:model];

    return cell;
}

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {

    return [private_tableInit.cellManager sectionsCount];
}

- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section {

    id<BKBTableSectionHeaderModelProtocol> model = [private_tableInit.headerModelManager modelItemForSection:section];
    if (!model) {

        return nil;
    }
    BKBTableItemSectionHeaderView *headerItemView = [private_tableInit.headerViewManager headerViewForSection:section];
    UITableViewHeaderFooterView<BKBTableSectionHeaderViewProtocol> *view = [tableView dequeueReusableHeaderFooterViewWithIdentifier:headerItemView.headerId];
    [view updateModel:model];

    return view;
}

#pragma mark - TableDelegate
- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section {

    BKBTableItemSectionHeaderView *headerItemView = [private_tableInit.headerViewManager headerViewForSection:section];
    if (headerItemView.headerHeight) {

        return headerItemView.headerHeight(section);
    }

    return 0.0f;
}

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {

    BKBTableItemCell *itemCell = [private_tableInit.cellManager itemCellAtIndexPath:indexPath];
    if (itemCell.rowHeight) {

        return itemCell.rowHeight(indexPath);
    }

    return 0.0f;
}

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {

    BKBTableItemCell *itemCell = [private_tableInit.cellManager itemCellAtIndexPath:indexPath];
    if (itemCell.isDeselectOnTap) {

        [tableView deselectRowAtIndexPath:indexPath animated:YES];
    }

    if (itemCell.didSelect) {

        itemCell.didSelect(indexPath);
    }
}

@end

#pragma mark - BKBTableManagerInit
@implementation BKBTableManagerInit

- (id)init {

    self = [super init];
    if (self) {

        self.tableConfigure = [BKBTableConfigure new];
        self.cellManager = [BKBTableCellManager new];
        self.modelManager = [BKBTableModelManager new];
    }
    return self;
}

@end


text:
"""Functions specific to build slaves, shared by several buildbot scripts.
"""

import datetime
import glob
import os
import re
import shutil
import subprocess
import sys
import tempfile
import time

from common import chromium_utils

# These codes used to distinguish true errors from script warnings.
ERROR_EXIT_CODE = 1
WARNING_EXIT_CODE = 88

def SlaveBuildName(chrome_dir):
  """Extracts the build name of this slave (e.g., 'chrome-release') from the
  leaf subdir of its build directory.
  """
  return os.path.basename(SlaveBaseDir(chrome_dir))

def SlaveBaseDir(chrome_dir):
  """Finds the full path to the build slave's base directory (e.g.
  'c:/b/chrome/chrome-release').  This is assumed to be the parent of the
  shallowest 'build' directory in the chrome_dir path.

  Raises chromium_utils.PathNotFound if there is no such directory.
  """
  result = ''
  prev_dir = ''
  curr_dir = chrome_dir
  while prev_dir != curr_dir:
    (parent, leaf) = os.path.split(curr_dir)
    if leaf == 'build':
      # Remember this one and keep looking for something shallower.
      result = parent
    if leaf == 'slave':
      # We are too deep, stop now.
      break
    prev_dir = curr_dir
    curr_dir = parent
  if not result:
    raise chromium_utils.PathNotFound('Unable to find slave base dir above %s' %
                                      chrome_dir)
  return result

def LogAndRemoveFiles(temp_dir, regex_pattern):
  """Removes files in |temp_dir| that match |regex_pattern|.
  This function prints out the name of each directory or filename before
  it deletes the file from disk."""
  regex = re.compile(regex_pattern)
  if not os.path.isdir(temp_dir):
    return
  for dir_item in os.listdir(temp_dir):
    if regex.search(dir_item):
      full_path = os.path.join(temp_dir, dir_item)
      print 'Removing leaked temp item: %s' % full_path
      try:
        if os.path.islink(full_path) or os.path.isfile(full_path):
          os.remove(full_path)
        elif os.path.isdir(full_path):
          chromium_utils.RemoveDirectory(full_path)
        else:
          print 'Temp item wasn\'t a file or directory?'
      except OSError, e:
        print >> sys.stderr, e
        # Don't fail.

def RemoveOldSnapshots(desktop):
  """Removes ChromiumSnapshot files more than one day old. Such snapshots are
  created when certain tests timeout (e.g., Chrome Frame integration tests)."""
  # Compute the file prefix of a snapshot created one day ago.
  yesterday = datetime.datetime.now() - datetime.timedelta(1)
  old_snapshot = yesterday.strftime('ChromiumSnapshot%Y%m%d%H%M%S')
  # Collect snapshots at least as old as that one created a day ago.
  to_delete = []
  for snapshot in glob.iglob(os.path.join(desktop, 'ChromiumSnapshot*.png')):
    if os.path.basename(snapshot) < old_snapshot:
      to_delete.append(snapshot)
  # Delete the collected snapshots.
  for snapshot in to_delete:
    print 'Removing old snapshot: %s' % snapshot
    try:
      os.remove(snapshot)
    except OSError, e:
      print >> sys.stderr, e

def RemoveChromeDesktopFiles():
  """Removes Chrome files (i.e. shortcuts) from the desktop of the current user.
  This does nothing if called on a non-Windows platform."""
  if chromium_utils.IsWindows():
    desktop_path = os.environ['USERPROFILE']
    desktop_path = os.path.join(desktop_path, 'Desktop')
    LogAndRemoveFiles(desktop_path, r'^(Chromium|chrome) \(.+\)?\.lnk$')
    RemoveOldSnapshots(desktop_path)

def RemoveJumpListFiles():
  """Removes the files storing jump list history.
  This does nothing if called on a non-Windows platform."""
  if chromium_utils.IsWindows():
    custom_destination_path = os.path.join(os.environ['USERPROFILE'],
                                           'AppData',
                                           'Roaming',
                                           'Microsoft',
                                           'Windows',
                                           'Recent',
                                           'CustomDestinations')
    LogAndRemoveFiles(custom_destination_path, '.+')

def RemoveTempDirContents():
  """Obliterate the entire contents of the temporary directory, excluding
  paths in sys.argv.
  """
  temp_dir = os.path.abspath(tempfile.gettempdir())
  print 'Removing contents of %s' % temp_dir

  print '  Inspecting args for files to skip'
  whitelist = set()
  for i in sys.argv:
    try:
      if '=' in i:
        i = i.split('=')[1]
      low = os.path.abspath(i.lower())
      if low.startswith(temp_dir.lower()):
        whitelist.add(low)
    except TypeError:
      # If the argument is too long, windows will freak out and pop a TypeError.
      pass
  if whitelist:
    print '  Whitelisting:'
    for w in whitelist:
      print '    %r' % w

  start_time = time.time()
  for root, dirs, files in os.walk(temp_dir):
    for f in files:
      p = os.path.join(root, f)
      if p.lower() not in whitelist:
        try:
          os.remove(p)
        except OSError:
          pass
      else:
        print '  Keeping file %r (whitelisted)' % p
    for d in dirs[:]:
      p = os.path.join(root, d)
      if p.lower() not in whitelist:
        try:
          # TODO(iannucci): Make this deal with whitelisted items which are
          # inside of |d|

          # chromium_utils.RemoveDirectory gives access denied error when called
          # in this loop.
          shutil.rmtree(p, ignore_errors=True)
          # Remove it so that os.walk() doesn't try to recurse into
          # a non-existing directory.
          dirs.remove(d)
        except OSError:
          pass
      else:
        print '  Keeping dir %r (whitelisted)' % p
  print '   Removing temp contents took %.1f s' % (time.time() - start_time)

def RemoveChromeTemporaryFiles():
  """A large hammer to nuke what could be leaked files from unittests or
  files left from a unittest that crashed, was killed, etc."""
  # NOTE: print out what is cleaned up so the bots don't timeout if
  # there is a lot to cleanup and also se we see the leaks in the
  # build logs.
  # At some point a leading dot got added, support with and without it.
  kLogRegex = r'^\.?(com\.google\.Chrome|org\.chromium)\.'
  if chromium_utils.IsWindows():
    RemoveTempDirContents()
    RemoveChromeDesktopFiles()
    RemoveJumpListFiles()
  elif chromium_utils.IsLinux():
    LogAndRemoveFiles(tempfile.gettempdir(), kLogRegex)
    LogAndRemoveFiles('/dev/shm', kLogRegex)
  elif chromium_utils.IsMac():
    nstempdir_path = '/usr/local/libexec/nstempdir'
    if os.path.exists(nstempdir_path):
      ns_temp_dir = subprocess.check_output([nstempdir_path]).strip()
      if ns_temp_dir:
        LogAndRemoveFiles(ns_temp_dir, kLogRegex)
    for i in ('Chromium', 'Google Chrome'):
      # Remove dumps.
      crash_path = '%s/Library/Application Support/%s/Crash Reports' % (
          os.environ['HOME'], i)
      LogAndRemoveFiles(crash_path, r'^.+\.dmp$')
  else:
    raise NotImplementedError(
        'Platform "%s" is not currently supported.' % sys.platform)

def WriteLogLines(logname, lines, perf=None):
  logname = logname.rstrip()
  lines = [line.rstrip() for line in lines]
  for line in lines:
    print '@@@STEP_LOG_LINE@%s@%s@@@' % (logname, line)
  if perf:
    perf = perf.rstrip()
    print '@@@STEP_LOG_END_PERF@%s@%s@@@' % (logname, perf)
  else:
    print '@@@STEP_LOG_END@%s@@@' % logname


text:
""" List of all possible 'tasks', i.e. ci configurations.

WARNING : this is siconos specific!!

A task, see :class:`machinery.ci_tasks.CiTask` must be defined with at least:
* a name (ci_config)
* a distribution (name:version)
* a list of dependencies (pkgs)

"""
from machinery.ci_task import CiTask
import os

# not generic, to be moved somewhere else
#

class SiconosCiTask(CiTask):

    def __init__(self, *args, **kwargs):
        return super(SiconosCiTask, self).__init__(*args, **kwargs)

    def template_maker(self):
        redundants = [
            'build-base', 'gfortran', 'gnu-c++', 'lpsolve', 'wget', 'xz',
            'asan', 'cppunit_clang', 'python-env', 'profiling',
            'python3-env', 'path', 'h5py3']
        return '-'.join([p.replace('+', 'x')
                         for p in self._pkgs if p not in redundants])

# PLEASE KEEP CONFIGS AS WHAT THEY MEAN.
# DO NOT ADD PACKAGES IF THEY ARE NOT NECESSARY.

#
# 1. where the packages configurations are defined
# Used in driver.py.
database = os.path.join('config', 'siconos.yml')

empty = SiconosCiTask()

base = empty.copy()(
    ci_config='default',
    pkgs=['build-base', 'gcc', 'gfortran', 'gnu-c++', 'atlas-lapack',
          'python-env'],
    srcs=['.'],
    targets={'.': ['all', 'test']})
#
# 2. the default task
#

default = SiconosCiTask(
    docker=True,
    ci_config='default',
    distrib='ubuntu:16.04',
    pkgs=['build-base', 'gcc', 'gfortran', 'gnu-c++', 'atlas-lapack',
          'python-env'],
    srcs=['.'],
    targets={'.': ['docker-build', 'docker-ctest', 'docker-submit']})

minimal = SiconosCiTask(
    docker=True,
    ci_config='minimal',
    distrib='ubuntu:16.10',
    pkgs=['build-base', 'gcc', 'gfortran', 'gnu-c++',
          'atlas-lapack', 'python-minimal'],
    srcs=['.'],
    targets={'.': ['docker-build', 'docker-ctest', 'docker-submit']})

minimal_with_python = SiconosCiTask(
    docker=True,
    ci_config='minimal_with_python',
    distrib='ubuntu:16.10',
    pkgs=['build-base', 'gcc', 'gfortran', 'gnu-c++',
          'atlas-lapack', 'python-env'],
    srcs=['.'],
    targets={'.': ['docker-build', 'docker-ctest', 'docker-submit']})

#
# 3. all the tasks
#

siconos_default = default

print (default.template_maker())

siconos_default_nix = default.copy()(
    ci_config='nix',
    distrib='nixos/nix:latest')

siconos_debian_latest = siconos_default.copy()(
    distrib='debian:latest')

siconos_ubuntu_14_04 = siconos_default.copy()(
    distrib='ubuntu:14.04')

siconos_ubuntu_15_04 = siconos_default.copy()(
    distrib='ubuntu:15.04')

siconos_ubuntu_15_10 = siconos_default.copy()(
    distrib='ubuntu:15.10')

siconos_ubuntu_16_10 = siconos_default.copy()(
    distrib='ubuntu:16.10')

siconos_ubuntu_17_10 = siconos_default.copy()(
    distrib='ubuntu:17.10')

siconos_fedora_latest = siconos_default.copy()(
    distrib='fedora:latest')

siconos_cxx_11_ubuntu_17_10 = siconos_default.copy()(
    distrib='ubuntu:17.10',
    ci_config='with_cxx11')

siconos_gazebo = siconos_default.copy()(
    distrib='nvidia/opengl:1.0-glvnd-devel-ubuntu16.04',
    ci_config=('with_cxx11', 'with_bullet', 'with_py3'),
    add_pkgs=['bullet','gazebo'],
    targets={'.': ['docker-build', 'docker-cmake', 'docker-make',
                   'docker-make-install', 'docker-cmd']})

siconos_with_lpsolve = siconos_default.copy()(
    add_pkgs=['lpsolve'])

import os
from os.path import expanduser
home = expanduser("~")

siconos_documentation = siconos_default.copy()(
    distrib='ubuntu:16.10',
    ci_config='with_documentation',
    add_pkgs=['documentation'],
    add_directories=[os.path.join(home, '.ssh:/root/.ssh')],
    targets={'.': ['docker-build', 'docker-cmake', 'docker-make',
                   'docker-make-install',
                   'docker-make-doc', 'docker-make-upload']})

siconos_ubuntu_15_10_with_mechanisms = siconos_default.copy()(
    ci_config='with_mechanisms_conda_version',
    add_pkgs=['pythonocc-conda', 'wget', 'bash', 'bzip2',
              'pythonocc-conda-dep'],
    cmake_cmd='Build/ci-scripts/conda.sh',
    distrib='debian:stretch')

siconos_debian_mechanisms = siconos_default.copy()(
    ci_config='with_mechanisms',
    add_pkgs=['wget', 'bash', 'bullet', 'h5py', 'oce-pythonocc-deps',
              'oce-pythonocc'],
    distrib='debian:latest')

siconos_ubuntu_latest_mechanisms = siconos_default.copy()(
    ci_config='with_mechanisms',
    add_pkgs=['wget', 'bash', 'bullet', 'h5py', 'oce-pythonocc-deps',
              'oce-pythonocc'],
    distrib='ubuntu:latest')

siconos_numerics_only = siconos_ubuntu_17_10.copy()(
    ci_config='no_cxx',
    remove_pkgs=['gnu-c++'])

siconos_profiling = siconos_ubuntu_17_10.copy()(
    build_configuration='Profiling',
    add_pkgs=['profiling'])

# note fedora/atlas-lapack in siconos.yml -> cmake does not detect blas
siconos_fedora_latest_with_umfpack = siconos_default.copy()(
    distrib='fedora:latest',
    ci_config=('with_umfpack',),
    remove_pkgs=['atlas-lapack', 'python-env'],
    add_pkgs=['openblas-lapacke', 'python3-env', 'umfpack'])

siconos_openblas_lapacke = siconos_default.copy()(
    remove_pkgs=['atlas-lapack'],
    add_pkgs=['openblas-lapacke'])

siconos_clang = siconos_ubuntu_17_10.copy()(
    ci_config=('with_bullet', 'with_py3'),
    remove_pkgs=['python-env'],
    add_pkgs=['clang-3.9', 'bullet', 'cppunit_clang-3.9', 'wget', 'xz', 'python3-env', 'path', 'h5py3'])  # h5py-3 for mechanics.io

siconos_clang_asan = siconos_clang.copy()(
    ci_config=('with_asan_clang', 'with_mumps', 'with_hdf5', 'with_serialization', 'with_py3'),
    add_pkgs=['mumps', 'hdf5', 'serialization'],
    build_configuration='Debug',)

# <clang-3.7.1 does not support linux 4.2
# This will likely hurt you
siconos_clang_msan = siconos_default.copy()(
    distrib='debian:jessie',
    ci_config='with_msan',
    build_configuration='Debug',
    add_pkgs=['clang-3.8', 'libcxx_msan', 'wget', 'xz', 'path'])

siconos_clang_cfi = siconos_default.copy()(
    distrib='debian:jessie',
    ci_config='with_cfi',
    build_configuration='Debug',
    add_pkgs=['mumps', 'hdf5', 'cfi'])

siconos_gcc_asan = siconos_fedora_latest.copy()(
    ci_config=('with_asan', 'with_mumps', 'with_hdf5', 'with_serialization'),
    cmake_cmd='Build/ci-scripts/fedora-mpi.sh',
    add_pkgs=['mumps', 'hdf5', 'asan', 'serialization', 'path', 'wget'],   # wget for path
    build_configuration='Debug')

siconos_gcc_asan_latest = siconos_fedora_latest.copy()(
    ci_config=('with_asan', 'with_mumps', 'with_hdf5', 'with_serialization'),
    distrib='fedora:rawhide',
    cmake_cmd='Build/ci-scripts/fedora-mpi.sh',
    add_pkgs=['mumps', 'hdf5', 'asan', 'serialization', 'path', 'wget'],   # wget for path
    build_configuration='Debug',
    fast=False)

# There is a bug in boost 1.58 distributed with Xenial (Ubuntu LTS 16.04).
# As long as it is not patched, we have to build on a newer ubuntu
siconos_serialization = siconos_ubuntu_17_10.copy()(
    ci_config='with_serialization',
    add_pkgs=['serialization'])

siconos_with_mumps = siconos_default.copy()(
    ci_config='with_mumps',
    add_pkgs=['mumps'])

siconos_with_umfpack = siconos_default.copy()(
    ci_config='with_umfpack',
    add_pkgs=['umfpack'])

# --- Config to run siconos examples ---

# Note FP/MB : this should be the only task(s) that run examples !!!
#        We may add later some 'examples-with-bullet' or 'examples-with-mechanisms' ... tasks later.
#        All tasks 'examples' should:
#         - conf, make and make install of siconos components (no tests!)
#         - conf, make and make test of siconos examples

# Case1 : siconos 'basics' components, numerics, kernel, control and related examples
siconos_light_examples = minimal_with_python.copy()(
    ci_config='examples_light',
    targets={'.': ['docker-build', 'docker-cmake', 'docker-make',
                   'docker-make-install', 'docker-make-clean'],
             'examples': ['docker-build', 'docker-ctest', 'docker-submit', 'docker-make-clean']},
    add_srcs=['examples'])

# Case2 : siconos with mechanics components and bullet + related examples
siconos_all_examples = minimal_with_python.copy()(
    ci_config='examples_all',
    add_pkgs=['bullet', 'h5py'],
    targets={'.': ['docker-build', 'docker-cmake', 'docker-make',
                   'docker-make-install', 'docker-make-clean'],
             'examples': ['docker-build', 'docker-ctest', 'docker-submit', 'docker-make-clean']},
    add_srcs=['examples'])

siconos_test_deb = SiconosCiTask(
    ci_config='examples',
    distrib='ubuntu:16.04',
    pkgs=['siconos'],
    srcs=['examples'])

siconos_test_rpm = SiconosCiTask(
    ci_config='examples',
    distrib='fedora:latest',
    pkgs=['siconos'],
    srcs=['examples'])

siconos_dev_mode_strict = siconos_default.copy()(
    ci_config='with_dev_mode_strict')

siconos_frama_c = siconos_default.copy()(
    ci_config='with_frama_c',
    add_pkgs=['opam', 'frama-c', 'libgtksourceview2.0-dev',
              'libgnomecanvas2-dev', 'aspcud', 'm4',
              'unzip', 'coq', 'ocaml', 'z3'])

#
# 4. dispatch based on hostname and distrib type (to min. disk requirement)
#
known_tasks = {'siconos---vm0':
               (siconos_gcc_asan,
                siconos_serialization,
                siconos_profiling,
                siconos_gcc_asan_latest,
                siconos_debian_mechanisms),

               'siconos---vm1':
               (minimal,
                minimal_with_python,
                siconos_documentation,
                siconos_dev_mode_strict,
                siconos_clang,
                siconos_clang_asan),

               'siconos---vm2':
               (siconos_clang_msan,
                siconos_ubuntu_15_10_with_mechanisms),

               'siconos---vm3':
               (siconos_light_examples,
                siconos_all_examples),

               'siconos---vm4':
               (siconos_numerics_only)}


text:
var NodeForkOutboundCylinderConnection = function(){};

NodeForkOutboundCylinderConnection.make = function(){
  var connection = new NodeForkOutboundCylinderConnection();
  return connection;
};

NodeForkOutboundCylinderConnection.create = function(){
  var connection = NodeForkOutboundCylinderConnection.make({});
  return connection;
};

NodeForkOutboundCylinderConnection.prototype.send_response = function(response){
  process.send(response);
};

module.exports = NodeForkOutboundCylinderConnection;


text:
package net.drewke.tdme.tests;

import java.util.logging.Level;
import java.util.logging.Logger;

import net.drewke.tdme.engine.Camera;
import net.drewke.tdme.engine.Engine;
import net.drewke.tdme.engine.Entity;
import net.drewke.tdme.engine.Light;
import net.drewke.tdme.engine.Object3D;
import net.drewke.tdme.engine.Object3DModel;
import net.drewke.tdme.engine.PointsParticleSystemEntity;
import net.drewke.tdme.engine.Rotation;
import net.drewke.tdme.engine.Rotations;
import net.drewke.tdme.engine.Transformations;
import net.drewke.tdme.engine.fileio.models.DAEReader;
import net.drewke.tdme.engine.model.Color4;
import net.drewke.tdme.engine.model.Face;
import net.drewke.tdme.engine.model.FacesEntity;
import net.drewke.tdme.engine.model.Group;
import net.drewke.tdme.engine.model.Material;
import net.drewke.tdme.engine.model.Model;
import net.drewke.tdme.engine.model.Model.UpVector;
import net.drewke.tdme.engine.model.ModelHelper;
import net.drewke.tdme.engine.model.RotationOrder;
import net.drewke.tdme.engine.model.TextureCoordinate;
import net.drewke.tdme.engine.physics.CollisionDetection;
import net.drewke.tdme.engine.physics.CollisionResponse;
import net.drewke.tdme.engine.primitives.BoundingVolume;
import net.drewke.tdme.engine.primitives.Capsule;
import net.drewke.tdme.engine.primitives.ConvexMesh;
import net.drewke.tdme.engine.primitives.OrientedBoundingBox;
import net.drewke.tdme.engine.primitives.PrimitiveModel;
import net.drewke.tdme.engine.primitives.Sphere;
import net.drewke.tdme.engine.subsystems.particlesystem.BoundingBoxParticleEmitter;
import net.drewke.tdme.engine.subsystems.particlesystem.CircleParticleEmitter;
import net.drewke.tdme.engine.subsystems.particlesystem.ParticleSystemEntity;
import net.drewke.tdme.engine.subsystems.particlesystem.SphereParticleEmitter;
import net.drewke.tdme.math.Vector3;
import net.drewke.tdme.utils.ArrayList;
import net.drewke.tdme.utils.Console;

import com.jogamp.newt.event.KeyEvent;
import com.jogamp.newt.event.KeyListener;
import com.jogamp.newt.event.MouseEvent;
import com.jogamp.newt.event.MouseListener;
import com.jogamp.newt.event.WindowEvent;
import com.jogamp.newt.event.WindowListener;
import com.jogamp.newt.event.WindowUpdateEvent;
import com.jogamp.newt.opengl.GLWindow;
import com.jogamp.opengl.GLAutoDrawable;
import com.jogamp.opengl.GLCapabilities;
import com.jogamp.opengl.GLEventListener;
import com.jogamp.opengl.GLProfile;
import com.jogamp.opengl.util.FPSAnimator;

/**
 * Engine test
 * @author andreas.drewke
 * @version $Id$
 */
public final class EngineTest implements GLEventListener, MouseListener, KeyListener, WindowListener {

	private Engine engine;
	private Engine osEngine;

	private CollisionResponse collision;
	private ArrayList<Object3D> players;
	private ArrayList<Object3D> playersBoundingVolumeModel;
	private BoundingVolume playerBoundingVolume;
	private Model playerBoundingVolumeModel;
	private ArrayList<BoundingVolume> playerBoundingVolumesTransformed;

	private Object3D cube;
	private Model cubeBoundingVolumeModel;
	private BoundingVolume cubeBoundingVolume;
	private BoundingVolume cubeBoundingVolumeTransformed;
	private BoundingVolume barrelBoundingVolume;
	private BoundingVolume barrelBoundingVolumeTransformed;

	private Transformations circleTransformations;

	Entity entityClicked;
	private int[] mouseClicked;

	private boolean keyLeft;
	private boolean keyRight;
	private boolean keyUp;

	private boolean keyW;
	private boolean keyA;
	private boolean keyS;
	private boolean keyD;

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		Logger.getLogger("").setLevel(Level.WARNING);

		// create GL canvas
		GLProfile glp = Engine.getProfile();
		GLCapabilities caps = new GLCapabilities(glp);

		// create GL window
		GLWindow glWindow = GLWindow.create(caps);
		glWindow.setTitle("EngineTest");

		// animator
		FPSAnimator animator = new FPSAnimator(glWindow, 60);

		// tdme level editor
		EngineTest engineTest = new EngineTest(glWindow, animator);

		// GL Window
		glWindow.addGLEventListener(engineTest);
		glWindow.setSize(800, 600);
		glWindow.setVisible(true);
		glWindow.addKeyListener(engineTest);
		glWindow.addMouseListener(engineTest);
		glWindow.addWindowListener(engineTest);

		// start animator
		animator.setUpdateFPSFrames(3, null);
		animator.start();
	}

	/**
	 * Engine test
	 * @param gl window
	 */
	public EngineTest(GLWindow glWindow, FPSAnimator fpsAnimator) {
		keyLeft = false;
		keyRight = false;
		keyUp = false;
		keyW = false;
		keyA = false;
		keyS = false;
		keyD = false;
		mouseClicked = null;
		entityClicked = null;
		collision = new CollisionResponse();
		engine = Engine.getInstance();
	}

	/**
	 * Create wall model
	 * @return
	 */
	private Model createWallModel() {
		// wall model
		Model wall = new Model("wall", "wall", UpVector.Y_UP, RotationOrder.XYZ, null);

		// wall material
		Material wallMaterial = new Material("wall");
		wall.getMaterials().put("wall", wallMaterial);

		//	group
		Group wallGroup = new Group(wall, null, "wall", "wall");

		//	faces entity
		//		far plane
		FacesEntity groupFacesEntityFarPlane = new FacesEntity(wallGroup, "wall");
		wallMaterial.getAmbientColor().set(1f,1f,1f,1f);
		wallMaterial.getDiffuseColor().set(1f,1f,1f,1f);
		groupFacesEntityFarPlane.setMaterial(wallMaterial);

		//	faces entity
		ArrayList<FacesEntity> groupFacesEntities = new ArrayList<FacesEntity>();
		groupFacesEntities.add(groupFacesEntityFarPlane);

		//	vertices
		ArrayList<Vector3> vertices = new ArrayList<Vector3>();

		// left, near, far plane
		vertices.add(new Vector3(-4f, 0f, +4f));
		// left, far, far plane
		vertices.add(new Vector3(-4f, +4f, +4f));
		// right far, far plane
		vertices.add(new Vector3(+4f, +4f, +4f));
		// right, near, far plane
		vertices.add(new Vector3(+4f, 0f, +4f));

		//	normals
		ArrayList<Vector3> normals = new ArrayList<Vector3>();
		//		far plane
		normals.add(new Vector3(0f, 0f, -1f));

		// texture coordinates
		ArrayList<TextureCoordinate> textureCoordinates = new ArrayList<TextureCoordinate>();
		textureCoordinates.add(new TextureCoordinate(0f, 0f));
		textureCoordinates.add(new TextureCoordinate(0f, 1f));
		textureCoordinates.add(new TextureCoordinate(1f, 1f));
		textureCoordinates.add(new TextureCoordinate(1f, 0f));

		//	faces ground far plane
		ArrayList<Face> facesFarPlane = new ArrayList<Face>();
		facesFarPlane.add(new Face(wallGroup,0,1,2,0,0,0,0,1,2));
		facesFarPlane.add(new Face(wallGroup,2,3,0,0,0,0,2,3,0));

		// set up faces entity
		groupFacesEntityFarPlane.setFaces(facesFarPlane);

		// setup ground group
		wallGroup.setVertices(vertices);
		wallGroup.setNormals(normals);
		wallGroup.setTextureCoordinates(textureCoordinates);
		wallGroup.setFacesEntities(groupFacesEntities);

		// determine features
		wallGroup.determineFeatures();

		// register group
		wall.getGroups().put("wall", wallGroup);
		wall.getSubGroups().put("wall", wallGroup);

		// prepare for indexed rendering
		ModelHelper.prepareForIndexedRendering(wall);

		//
		return wall;
	}

	/*
	 * (non-Javadoc)
	 * @see com.jogamp.opengl.GLEventListener#display(com.jogamp.opengl.GLAutoDrawable)
	 */
	public void display(GLAutoDrawable drawable) {
		circleTransformations.getTranslation().setX(players.get(0).getTranslation().getX());
		circleTransformations.getTranslation().setZ(players.get(0).getTranslation().getZ());
		circleTransformations.getTranslation().addY(0.1f);
		if (circleTransformations.getTranslation().getY() > 1.5f) {
			circleTransformations.getTranslation().setY(0f);
		}
		circleTransformations.update();
		((ParticleSystemEntity)engine.getEntity("circle")).getParticleEmitter().fromTransformations(circleTransformations);

		// player control
		doPlayerControl(0, keyLeft, keyRight, keyUp);
		doPlayerControl(1, keyA, keyD, keyW);

		// update bounding boxes
		for (int i = 0; i < players.size(); i++) {
			playersBoundingVolumeModel.get(i).fromTransformations(players.get(i));
		}

		// render
		osEngine.display(drawable);
		engine.display(drawable);

		// handle mouse clicked
		if (mouseClicked != null) {
			if (entityClicked != null) {
				entityClicked.getEffectColorMul().setRed(1.0f);
				entityClicked.getEffectColorMul().setGreen(1.0f);
				entityClicked.getEffectColorMul().setBlue(1.0f);
			}
			Entity _object3DClicked = engine.getObjectByMousePosition(mouseClicked[0], mouseClicked[1]);
			if (_object3DClicked != null) {
				_object3DClicked.getEffectColorMul().setRed(2.0f);
				_object3DClicked.getEffectColorMul().setGreen(2.0f);
				_object3DClicked.getEffectColorMul().setBlue(2.0f);
			}
			entityClicked = _object3DClicked;
			mouseClicked = null;
		}
	}

	/**
	 * Do player control
	 * @param idx
	 * @param key left
	 * @param key right
	 * @param key up
	 */
	private void doPlayerControl(int idx, boolean keyLeft, boolean keyRight, boolean keyUp) {
		float fps = engine.getTiming().getCurrentFPS();

		Object3D player = players.get(idx);
		BoundingVolume playerBoundingVolumeTransformed = playerBoundingVolumesTransformed.get(idx);

		Rotations rotations = player.getRotations();
		Rotation r = rotations.get(0);
		player.update();

		Vector3 movement = new Vector3();

		// left, right
		if (keyRight) r.setAngle(r.getAngle() - (135f / fps));
		if (keyLeft) r.setAngle(r.getAngle() + (135f / fps));
		if (keyRight || keyLeft) {
			player.update();
			playerBoundingVolumeTransformed.fromBoundingVolumeWithTransformations(playerBoundingVolume, player);
		}

		// forward
		if (keyUp) {
			// apply movement
			r.getQuaternion().multiply(new Vector3(0f,0f,1f), movement);
			movement.scale(1.50f / fps);
			player.getTranslation().add(
				movement
			);
			player.update();
			playerBoundingVolumeTransformed.fromBoundingVolumeWithTransformations(playerBoundingVolume, player);

			// walking animation
			if (player.getAnimation().equals("walk") == false) {
				player.setAnimation("walk");
			}
		} else {
			// still animation
			if (player.getAnimation().equals("walk") == true) {
				player.setAnimation("still");
			}
		}

		// check if collides with cube
		if (playerBoundingVolumeTransformed.doesCollideWith(
				cubeBoundingVolumeTransformed,
				movement,
				collision
			) == true &&
			collision.hasPenetration() == true) {
			Console.println("cube: " + collision);
			// yep, move object out of collision
			player.getTranslation().sub(
				collision.getNormal().clone().scale(collision.getPenetration())
			);
			player.update();
			playerBoundingVolumeTransformed.fromBoundingVolumeWithTransformations(playerBoundingVolume, player);
		}

		// check if collides with barrel
		if (CollisionDetection.getInstance().doCollide(
				(Capsule)playerBoundingVolumeTransformed,
				(ConvexMesh)barrelBoundingVolumeTransformed,
				movement,
				collision
			) == true &&
			collision.hasPenetration() == true) {
			Console.println("barrel: " + collision);
			// yep, move object out of collision
			player.getTranslation().sub(
				collision.getNormal().clone().scale(collision.getPenetration())
			);
			player.update();
			playerBoundingVolumeTransformed.fromBoundingVolumeWithTransformations(playerBoundingVolume, player);
		}

		// check if collides with other players
		for (int i = 0; i < players.size(); i++) {
			// do not check with same player
			if (idx == i) continue;

			// do collide?
			if (playerBoundingVolumeTransformed.doesCollideWith(
					playerBoundingVolumesTransformed.get(i),
					movement,
					collision
				) == true && collision.hasPenetration()) {
				Console.println("player: " + collision);

				// yep, move object out of collision
				player.getTranslation().sub(
					collision.getNormal().clone().scale(collision.getPenetration())
				);
				player.update();
				playerBoundingVolumeTransformed.fromBoundingVolumeWithTransformations(playerBoundingVolume, player);
			}
		}
	}

	/*
	 * (non-Javadoc)
	 * @see com.jogamp.opengl.GLEventListener#dispose(com.jogamp.opengl.GLAutoDrawable)
	 */
	public void dispose(GLAutoDrawable drawable) {
		engine.dispose(drawable);
	}

	/*
	 * (non-Javadoc)
	 * @see com.jogamp.opengl.GLEventListener#init(com.jogamp.opengl.GLAutoDrawable)
	 */
	public void init(GLAutoDrawable drawable) {
		engine.initialize(drawable);
		if (osEngine == null) {
			osEngine = Engine.createOffScreenInstance(drawable, 512, 512);

			//
			Light osLight0 = osEngine.getLightAt(0);
			osLight0.getAmbient().set(1.0f, 1.0f, 1.0f, 1.0f);
			osLight0.getDiffuse().set(1.0f, 1.0f, 1.0f, 1.0f);
			osLight0.getPosition().set(0.0f, -4f, -4f, 1.0f);
			osLight0.getSpotDirection().set(new Vector3(osLight0.getPosition().getArray())).sub(new Vector3(0f,0f,0f));
			osLight0.setEnabled(true);

			// cam
			Camera osCam = osEngine.getCamera();
			osCam.setZNear(0.10f);
			osCam.setZFar(50.00f);
			osCam.getLookFrom().set(0f, 4f, -4f);
			osCam.getLookAt().set(0f, 0.50f, 0f);
			osCam.computeUpVector(osCam.getLookFrom(), osCam.getLookAt(), osCam.getUpVector());

			// scene color
			osEngine.getSceneColor().set(0.5f, 0.0f, 0.0f, 1.0f);
		}

		// cam
		Camera cam = engine.getCamera();
		cam.setZNear(0.10f);
		cam.setZFar(50.00f);
		cam.getLookFrom().set(0f, 3f, -8f);
		cam.getLookAt().set(0f, 0.50f, 0f);
		cam.computeUpVector(cam.getLookFrom(), cam.getLookAt(), cam.getUpVector());

		// lights
		Light light0 = engine.getLightAt(0);
		light0.getAmbient().set(1.0f, 1.0f, 1.0f, 1.0f);
		light0.getDiffuse().set(0.5f,0.5f,0.5f,1f);
		light0.getSpecular().set(1f,1f,1f,1f);
		light0.getPosition().set(
			0f,
			20000f,
			0f,
			1f
		);
		light0.getSpotDirection().set(0f,0f,0f).sub(new Vector3(light0.getPosition().getArray()));
		light0.setConstantAttenuation(0.5f);
		light0.setLinearAttenuation(0f);
		light0.setQuadraticAttenuation(0f);
		light0.setSpotExponent(0f);
		light0.setSpotCutOff(180f);
		light0.setEnabled(true);
		Light light1 = engine.getLightAt(1);
		light1.getDiffuse().set(1.0f, 0.0f, 0.0f, 1.0f);
		light1.getPosition().set(-4.0f, 5.0f, -5.0f, 1.0f);
		light1.getSpotDirection().set(0f,0f,0f).sub(new Vector3(light1.getPosition().getArray()));
		light1.setEnabled(true);
		Light light2 = engine.getLightAt(2);
		light2.getDiffuse().set(0.0f, 1.0f, 0.0f, 1.0f);
		light2.getPosition().set(+4.0f, 5.0f, 0.0f, 1.0f);
		light2.getSpotDirection().set(0f,0f,0f).sub(new Vector3(light2.getPosition().getArray()));
		light2.setEnabled(true);

		// scene
		players = new ArrayList<Object3D>();
		playersBoundingVolumeModel = new ArrayList<Object3D>();
		playerBoundingVolumesTransformed = new ArrayList<BoundingVolume>();
		try {
			Model _barrel = DAEReader.read("resources/tests/models/barrel", "barrel.dae");
			Object3D barrel = new Object3D("barrel", _barrel);
			barrelBoundingVolume = new ConvexMesh(new Object3DModel(_barrel));
			barrel.getTranslation().set(1.5f,0.35f,-2f);
			barrel.setDynamicShadowingEnabled(true);
			barrel.setEnabled(true);
			barrel.update();
			barrelBoundingVolumeTransformed = barrelBoundingVolume.clone();
			barrelBoundingVolumeTransformed.fromBoundingVolumeWithTransformations(barrelBoundingVolume, barrel);
			engine.addEntity(barrel);

			// wall
			Model _farPlane = createWallModel();
			Object3D farPlane = new Object3D("wall", _farPlane);
			farPlane.bindDiffuseTexture("wall", "wall", osEngine.getFrameBuffer());
			engine.addEntity(farPlane);

			//
			Model _grass = DAEReader.read("resources/tests/models/grass", "grass.dae");
			Object3D grass = new Object3D("ground", _grass);
			grass.setEnabled(true);
			grass.getScale().set(8f,1f,8f);
			grass.update();
			engine.addEntity(grass);

			// players
			Model _player = DAEReader.read("resources/tests/models/dummy", "testDummy_textured.DAE");
			_player.addAnimationSetup("still", 3, 3, true);
			_player.addAnimationSetup("walk", 0, 18, true);

			// player bounding volume
			// playerBoundingVolume = Sphere.createBoundingVolume(new Vector3(0,90f/130f,0), 90f/130f);
			playerBoundingVolume = Capsule.createBoundingVolume(new Vector3(0,30f/130f,0), new Vector3(0,230f/130f,0), 25/130f);
			// playerBoundingVolume = BoundingBox.createBoundingVolume(new Vector3(-25f/130f, 0, -25f/130f), new Vector3(+25f/130f, 180f/130f, +25f/130f));

			/*
			playerBoundingVolume = OrientedBoundingBox.createBoundingVolume(
				new Vector3(0f, 90f/130f, 0f),
				new Vector3(1f, 0f, 0f),
				new Vector3(0f, 1f, 0f),
				new Vector3(0f, 0f, 1f),
				new Vector3(25f/130f, 90f/130f, 25f/130f)
			);
			*/

			playerBoundingVolumeModel = PrimitiveModel.createModel(playerBoundingVolume, "player_bv");

			// add player 1
			//	player
			Object3D player1 = new Object3D("player1", _player);
			player1.getTranslation().add(new Vector3(-1.50f,0f,0f));
			player1.setAnimation("still");
			player1.getRotations().add(new Rotation(0f, new Vector3(0f, 1f, 0f)));
			player1.update();
			player1.setEnabled(true);
			player1.setPickable(true);
			player1.setDynamicShadowingEnabled(true);
			engine.addEntity(player1);
			//	bounding volume transformed
			BoundingVolume player1BoundingVolumeTransformed = playerBoundingVolume.clone();
			player1BoundingVolumeTransformed.fromBoundingVolumeWithTransformations(playerBoundingVolume, player1);
			playerBoundingVolumesTransformed.add(player1BoundingVolumeTransformed);
			//	add to engine
			players.add(player1);

			//	bounding volume
			Object3D player1BoundingVolume = new Object3D("player1_bv", playerBoundingVolumeModel);
			player1BoundingVolume.fromTransformations(player1);
			player1BoundingVolume.setEnabled(true);
			playersBoundingVolumeModel.add(player1BoundingVolume);
			// engine.addEntity(player1BoundingVolume);

			// add player 2
			//	player
			Object3D player2 = new Object3D("player2", _player);
			player2.getTranslation().add(new Vector3(1.50f,0f,0f));
			player2.setAnimation("still");
			player2.getRotations().add(new Rotation(0f, new Vector3(0f, 1f, 0f)));
			player2.update();
			player2.setEnabled(true);
			player2.setPickable(true);
			player2.setDynamicShadowingEnabled(true);
			players.add(player2);
			//	bounding volume transformed
			BoundingVolume player2BoundingVolumeTransformed = playerBoundingVolume.clone();
			player2BoundingVolumeTransformed.fromBoundingVolumeWithTransformations(playerBoundingVolume, player2);
			playerBoundingVolumesTransformed.add(player2BoundingVolumeTransformed);
			//	add to engine
			engine.addEntity(player2);

			//	bounding volume
			Object3D player2BoundingVolume = new Object3D("player2_bv", playerBoundingVolumeModel);
			player2BoundingVolume.fromTransformations(player2);
			player2BoundingVolume.setEnabled(true);
			playersBoundingVolumeModel.add(player2BoundingVolume);
			// engine.addEntity(player2BoundingVolume);

			// add cube
			Model _cube = DAEReader.read("resources/tests/models/test", "cube.dae");
			cube = new Object3D("cube", _cube);
			cube.getTranslation().add(new Vector3(0f,0f,0f));
			cube.getScale().set(2f,2f,2f);
			cube.update();
			cube.setPickable(true);
			cube.setDynamicShadowingEnabled(true);
			cube.setEnabled(true);
			cubeBoundingVolume = cube.getBoundingBox();
			cubeBoundingVolumeTransformed = cubeBoundingVolume.clone();
			cubeBoundingVolumeTransformed.fromBoundingVolumeWithTransformations(cubeBoundingVolume, cube);
			engine.addEntity(cube);

			//
			cubeBoundingVolumeModel = PrimitiveModel.createModel(cubeBoundingVolume, "cube_bv");

			//	bounding volume
			Object3D cubeBoundingVolumeObject3D = new Object3D("cube_bv", cubeBoundingVolumeModel);
			cubeBoundingVolumeObject3D.fromTransformations(cube);
			cubeBoundingVolumeObject3D.setEnabled(true);
			engine.addEntity(cubeBoundingVolumeObject3D);

			// wall
			Model _wall = DAEReader.read("resources/tests/models/wall", "wall.dae");
			Object3D wall0 = new Object3D("wall0", _wall);
			wall0.getTranslation().add(new Vector3(-1.00f,0f,3.00f));
			wall0.update();
			wall0.setPickable(true);
			wall0.setEnabled(true);
			engine.addEntity(wall0);
			Object3D wall1 = new Object3D("wall1", _wall);
			wall1.getTranslation().add(new Vector3(0f,0f,3.00f));
			wall1.update();
			wall1.setPickable(true);
			wall1.setEnabled(true);
			engine.addEntity(wall1);

			// os engine test
			Object3D osCube = new Object3D("cube", _cube);
			osCube.getTranslation().add(new Vector3(0f,0f,0f));
			osCube.getScale().set(2f,2f,2f);
			osCube.update();
			osEngine.addEntity(osCube);

			//
			circleTransformations = new Transformations();
			engine.addEntity(
				new PointsParticleSystemEntity(
					"circle",
					false,
					new CircleParticleEmitter(
						3000,
						50,
						50,
						new Vector3(1f,0f,0f),
						new Vector3(0f,0f,1f),
						new Vector3(0f, 0f, 0f),
						0.4f,
						0f,
						0f,
						new Vector3(0f, 0.2f, 0f),
						new Vector3(0f, 0.2f, 0f),
						new Color4(1f, 1f, 1f, 0.3f),
						new Color4(1f, 1f, 1f, 0.3f)
					),
					1000,
					true
				)
			);
			engine.getEntity("circle").setEnabled(true);
			engine.addEntity(
				new PointsParticleSystemEntity(
					"water",
					true,
					new SphereParticleEmitter(
						4000,
						1000,
						0,
						0.1f,
						0.0f,
						new Sphere(new Vector3(-1f,1f,0f), 0.05f),
						new Vector3(-4f,0f,1f),
						new Vector3(-1f, 0f, 0f),
						new Color4(0.8f,0.8f,1f,0.25f),
						new Color4(0.8f,0.8f,1f,0.25f)
					),
					4000,
					true
				)
			);
			engine.getEntity("water").setEnabled(true);
			engine.addEntity(
				new PointsParticleSystemEntity(
					"snow",
					false,
					new BoundingBoxParticleEmitter(
						15,
						15000,
						1000,
						0,
						0,
						new OrientedBoundingBox(
							new Vector3(0f,4f,0f),
							new Vector3(1f,0f,0f),
							new Vector3(0f,1f,0f),
							new Vector3(0f,0f,1f),
							new Vector3(4f,0f,4f)
						),
						new Vector3(0f,-0.5f,0f),
						new Vector3(0f,-0.1f,0f),
						new Color4(0.8f,0.8f,1f,0.5f),
						new Color4(0.8f,0.8f,1f,0.5f)
					),
					1024,
					true
				)
			);
			engine.getEntity("snow").setEnabled(true);
			engine.addEntity(
				new PointsParticleSystemEntity(
					"firebase",
					false,
					new SphereParticleEmitter(
						2048,
						1024,
						2048,
						0,
						0,
						new Sphere(
							new Vector3(2.5f, 0.2f, 0f),
							0.2f
						),
						new Vector3(0f, 0.1f, 0f),
						new Vector3(0f, 0.1f, 0f),
						new Color4(0.0f, 0f, 0f, 0.5f),
						new Color4(0.4f, 0f, 0f, 0.5f)
					),
					2048,
					true
				)
			);
			engine.getEntity("firebase").setEnabled(true);
			//
			engine.addEntity(
				new PointsParticleSystemEntity(
					"firetop",
					false,
					new SphereParticleEmitter(
						2048,
						1024,
						2048,
						0,
						0,
						new Sphere(
							new Vector3(2.5f, 0.7f, 0f),
							0.1f
						),
						new Vector3(0f, 0.06f, 0f),
						new Vector3(0f, 0.12f, 0f),
						new Color4(0.75f, 0.0f, 0f, 0.5f),
						new Color4(1f, 1f, 0f, 0.5f)
					),
					2048,
					true
				)
			);
			engine.getEntity("firetop").setEnabled(true);
			//
			engine.addEntity(
				new PointsParticleSystemEntity(
					"firesmoke",
					false,
					new SphereParticleEmitter(
						2048,
						1024,
						2048,
						0,
						0,
						new Sphere(
							new Vector3(2.5f, 0.7f, 0f),
							0.1f
						),
						new Vector3(0f, 0.2f, 0f),
						new Vector3(0f, 0.4f, 0f),
						new Color4(0.8f, 0.8f, 0.8f, 0.1f),
						new Color4(0.8f, 0.8f, 0.8f, 0.1f)
					),
					2048,
					true
				)
			);
			engine.getEntity("firesmoke").setEnabled(true);
			((ParticleSystemEntity)engine.getEntity("circle")).setPickable(false);
			((ParticleSystemEntity)engine.getEntity("snow")).setPickable(false);
			((ParticleSystemEntity)engine.getEntity("firebase")).setPickable(true);
			((ParticleSystemEntity)engine.getEntity("firetop")).setPickable(true);
			((ParticleSystemEntity)engine.getEntity("firesmoke")).setPickable(true);
		} catch (Exception exception) {
			exception.printStackTrace();
			Console.println("Could not load object: " + exception.getMessage());
		}
	}

	/*
	 * (non-Javadoc)
	 * @see com.jogamp.opengl.GLEventListener#reshape(com.jogamp.opengl.GLAutoDrawable, int, int, int, int)
	 */
	public void reshape(GLAutoDrawable drawable, int x, int y, int width, int height) {
		engine.reshape(drawable, x, y, width, height);
	}

	/*
	 * (non-Javadoc)
	 * @see com.jogamp.newt.event.MouseListener#mouseClicked(com.jogamp.newt.event.MouseEvent)
	 */
	public void mouseClicked(MouseEvent e) {
	}

	/*
	 * (non-Javadoc)
	 * @see com.jogamp.newt.event.MouseListener#mouseEntered(com.jogamp.newt.event.MouseEvent)
	 */
	public void mouseEntered(MouseEvent e) {
	}

	/*
	 * (non-Javadoc)
	 * @see com.jogamp.newt.event.MouseListener#mouseExited(com.jogamp.newt.event.MouseEvent)
	 */
	public void mouseExited(MouseEvent e) {
	}

	/*
	 * (non-Javadoc)
	 * @see com.jogamp.newt.event.MouseListener#mousePressed(com.jogamp.newt.event.MouseEvent)
	 */
	public void mousePressed(MouseEvent e) {
		mouseClicked = new int[]{e.getX(), e.getY()};
	}

	/*
	 * (non-Javadoc)
	 * @see com.jogamp.newt.event.MouseListener#mouseReleased(com.jogamp.newt.event.MouseEvent)
	 */
	public void mouseReleased(MouseEvent e) {
	}

	/*
	 * (non-Javadoc)
	 * @see com.jogamp.newt.event.MouseListener#mouseDragged(com.jogamp.newt.event.MouseEvent)
	 */
	public void mouseDragged(MouseEvent e) {
	}

	/*
	 * (non-Javadoc)
	 * @see com.jogamp.newt.event.MouseListener#mouseMoved(com.jogamp.newt.event.MouseEvent)
	 */
	public void mouseMoved(MouseEvent e) {
	}

	/*
	 * (non-Javadoc)
	 * @see com.jogamp.newt.event.KeyListener#keyPressed(com.jogamp.newt.event.KeyEvent)
	 */
	public void keyPressed(KeyEvent e) {
		int keyCode = e.getKeyCode();
		char keyChar = Character.toLowerCase(e.getKeyChar());
		if (keyChar == 'w') keyW = true;
		if (keyChar == 'a') keyA = true;
		if (keyChar == 's') keyS = true;
		if (keyChar == 'd') keyD = true;
		if (keyCode == KeyEvent.VK_LEFT) keyLeft = true;
		if (keyCode == KeyEvent.VK_RIGHT) keyRight = true;
		if (keyCode == KeyEvent.VK_UP) keyUp = true;
	}

	/*
	 * (non-Javadoc)
	 * @see com.jogamp.newt.event.KeyListener#keyReleased(com.jogamp.newt.event.KeyEvent)
	 */
	public void keyReleased(KeyEvent e) {
		int keyCode = e.getKeyCode();
		char keyChar = Character.toLowerCase(e.getKeyChar());
		if (keyChar == 'w') keyW = false;
		if (keyChar == 'a') keyA = false;
		if (keyChar == 's') keyS = false;
		if (keyChar == 'd') keyD = false;
		if (keyCode == KeyEvent.VK_LEFT) keyLeft = false;
		if (keyCode == KeyEvent.VK_RIGHT) keyRight = false;
		if (keyCode == KeyEvent.VK_UP) keyUp = false;
	}

	/*
	 * (non-Javadoc)
	 * @see com.jogamp.newt.event.MouseListener#mouseWheelMoved(com.jogamp.newt.event.MouseEvent)
	 */
	public void mouseWheelMoved(MouseEvent arg0) {
	}

	/*
	 * (non-Javadoc)
	 * @see com.jogamp.newt.event.WindowListener#windowDestroyNotify(com.jogamp.newt.event.WindowEvent)
	 */
	public void windowDestroyNotify(WindowEvent arg0) {
	}

	/*
	 * (non-Javadoc)
	 * @see com.jogamp.newt.event.WindowListener#windowDestroyed(com.jogamp.newt.event.WindowEvent)
	 */
	public void windowDestroyed(WindowEvent arg0) {
		System.exit(0);
	}

	/*
	 * (non-Javadoc)
	 * @see com.jogamp.newt.event.WindowListener#windowGainedFocus(com.jogamp.newt.event.WindowEvent)
	 */
	public void windowGainedFocus(WindowEvent arg0) {
	}

	/*
	 * (non-Javadoc)
	 * @see com.jogamp.newt.event.WindowListener#windowLostFocus(com.jogamp.newt.event.WindowEvent)
	 */
	public void windowLostFocus(WindowEvent arg0) {
	}

	/*
	 * (non-Javadoc)
	 * @see com.jogamp.newt.event.WindowListener#windowMoved(com.jogamp.newt.event.WindowEvent)
	 */
	public void windowMoved(WindowEvent arg0) {
	}

	/*
	 * (non-Javadoc)
	 * @see com.jogamp.newt.event.WindowListener#windowRepaint(com.jogamp.newt.event.WindowUpdateEvent)
	 */
	public void windowRepaint(WindowUpdateEvent arg0) {
	}

	/*
	 * (non-Javadoc)
	 * @see com.jogamp.newt.event.WindowListener#windowResized(com.jogamp.newt.event.WindowEvent)
	 */
	public void windowResized(WindowEvent arg0) {
	}

}


text:
sap.ui.define([
		"sap/ui/test/Opa5",
		"sap/ui/test/actions/Press",
		"sap/ui/test/matchers/PropertyStrictEquals"
	], function(Opa5, Press, PropertyStrictEquals) {
		"use strict";

		return {

			createActions : function (sViewName) {
				return {
					iPressOnTheShareButton : function () {
						return this.waitFor({
							controlType : "sap.m.Button",
							viewName : sViewName,
							matchers : new PropertyStrictEquals({
								name : "icon",
								value : "sap-icon://action"
							}),
							actions : new Press(),
							errorMessage : "Did not find the share button"
						});
					}
				};
			},

			createAssertions : function (sViewName) {
				return {

					iShouldSeeTheShareEmailButton : function () {
						return this.waitFor({
							viewName : sViewName,
							controlType : "sap.m.Button",
							matchers : new PropertyStrictEquals({
								name : "icon",
								value : "sap-icon://email"
							}),
							success : function () {
								Opa5.assert.ok(true, "The E-Mail button is visible");
							},
							errorMessage : "The E-Mail button was not found"
						});
					},

					iShouldSeeTheShareTileButton : function () {
						return this.waitFor({
							id : "shareTile",
							viewName : sViewName,
							success : function () {
								Opa5.assert.ok(true, "The Save as Tile button is visible");
							},
							errorMessage : "The Save as Tile  button was not found"
						});
					},

					iShouldSeeTheShareJamButton : function () {
						return this.waitFor({
							id : "shareJam",
							viewName : sViewName,
							success : function () {
								Opa5.assert.ok(true, "The Jam share button is visible");
							},
							errorMessage : "The Jam share button was not found"
						});
					}

				};

			}

		};

	}
);


text:
#pragma once

#include "../comments_api.h"

#include "ModelBase/src/nodes/composite/CompositeNode.h"
#include "ModelBase/src/nodes/Text.h"
#include "ModelBase/src/nodes/Boolean.h"
#include "CommentDiagram.h"
#include "CommentFreeNode.h"
#include "CommentTable.h"

DECLARE_TYPED_LIST(COMMENTS_API, Comments, CommentNode)

namespace Comments {

class COMMENTS_API CommentNode : public Super<Model::CompositeNode> {
	COMPOSITENODE_DECLARE_STANDARD_METHODS(CommentNode)

	ATTRIBUTE(Model::TypedList<Model::Text>, lines, setLines)
	ATTRIBUTE(Model::TypedList<CommentDiagram>, diagrams, setDiagrams)
	ATTRIBUTE(Model::TypedList<CommentFreeNode>, codes, setCodes)
	ATTRIBUTE(Model::TypedList<CommentTable>, tables, setTables)

	public:
		CommentNode(const QString& text);
		CommentDiagram* diagram(const QString& name);
		CommentFreeNode* code(const QString& name);
		CommentTable* table(const QString& name);

		void synchronizeDiagramsToText();
		void synchronizeCodesToText();
		void synchronizeTablesToText();

	private:
		template <typename T, typename AppendFunction>
		void synchronizeItem(QString aString, T aList, AppendFunction appendFunction);
};

} /* namespace Comments */


text:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:minHeight="?android:attr/listPreferredItemHeight"
    android:gravity="center_vertical"
    android:paddingRight="?android:attr/scrollbarSize">

    <RelativeLayout
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginLeft="15dip"
        android:layout_marginRight="6dip"
        android:layout_marginTop="6dip"
        android:layout_marginBottom="6dip"
        android:layout_weight="1">

        <TextView android:id="@android:id/title"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:singleLine="true"
            android:textAppearance="?android:attr/textAppearanceLarge"
            android:ellipsize="marquee"
            android:fadingEdge="horizontal" />

        <TextView android:id="@android:id/summary"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_below="@android:id/title"
            android:layout_alignLeft="@android:id/title"
            android:textAppearance="?android:attr/textAppearanceSmall"
            android:maxLines="2" />

    </RelativeLayout>

    <!-- Preference should place its actual preference widget here. -->
    <LinearLayout android:id="@android:id/widget_frame"
        android:layout_width="wrap_content"
        android:layout_height="fill_parent"
        android:gravity="center_vertical"
        android:orientation="vertical" />

</LinearLayout>


text:
// ==========================================================================
//  Squidex Headless CMS
// ==========================================================================
//  Copyright (c) Squidex UG (haftungsbeschraenkt)
//  All rights reserved. Licensed under the MIT license.
// ==========================================================================

using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using OpenTelemetry.Trace;
using Squidex.Infrastructure;
using Squidex.Infrastructure.Plugins;

namespace Squidex.Extensions.APM.Zipkin;

public sealed class ZipkinPlugin : IPlugin
{
    private sealed class Configurator : ITelemetryConfigurator
    {
        private readonly IConfiguration config;

        public Configurator(IConfiguration config)
        {
            this.config = config;
        }

        public void Configure(TracerProviderBuilder builder)
        {
            builder.AddZipkinExporter(options =>
            {
                config.GetSection("logging:zipkin").Bind(options);
            });
        }
    }

    public void ConfigureServices(IServiceCollection services, IConfiguration config)
    {
        if (config.GetValue<bool>("logging:zipkin:enabled"))
        {
            services.AddSingleton<ITelemetryConfigurator,
                Configurator>();
        }
    }
}