text:
/**
 * Edge bundling laytout
 *
 * Use MINGLE algorithm
 * Multilevel agglomerative edge bundling for visualizing large graphs
 *
 * @module echarts/layout/EdgeBundling
 */
define(function (require) {

    var KDTree = require('../data/KDTree');
    var vec2 = require('zrender/tool/vector');
    var v2Create = vec2.create;
    var v2DistSquare = vec2.distSquare;
    var v2Dist = vec2.dist;
    var v2Copy = vec2.copy;

    function sqaredDistance(a, b) {
        a = a.array;
        b = b.array;

        var x = b[0] - a[0];
        var y = b[1] - a[1];
        var z = b[2] - a[2];
        var w = b[3] - a[3];

        return x * x + y * y + z * z + w * w;
    }

    function CoarsenedEdge(group) {
        this.points = [
            group.mp0, group.mp1
        ];

        this.group = group;
    };

    function Edge(edge) {
        var points = edge.points;
        // Sort on y
        if (
            points[0][1] < points[1][1]
            // If coarsened edge is flipped, the final composition of meet point
            // will be unordered
            || edge instanceof CoarsenedEdge
        ) {
            this.array = [points[0][0], points[0][1], points[1][0], points[1][1]];
            this._startPoint = points[0];
            this._endPoint = points[1];
        }
        else {
            this.array = [points[1][0], points[1][1], points[0][0], points[0][1]];
            this._startPoint = points[1];
            this._endPoint = points[0];
        }

        this.ink = v2Dist(points[0], points[1]);

        this.edge = edge;

        this.group = null;
    }

    Edge.prototype.getStartPoint = function () {
        return this._startPoint;
    };

    Edge.prototype.getEndPoint = function () {
        return this._endPoint;
    };

    function BundledEdgeGroup() {

        this.edgeList = [];

        this.mp0 = v2Create();
        this.mp1 = v2Create();

        this.ink = 0;
    }

    BundledEdgeGroup.prototype.addEdge = function (edge) {
        edge.group = this;
        this.edgeList.push(edge);
    };

    BundledEdgeGroup.prototype.removeEdge = function (edge) {
        edge.group = null;
        this.edgeList.splice(this.edgeList.indexOf(edge), 1);
    };

    /**
     * @constructor
     * @alias module:echarts/layout/EdgeBundling
     */
    function EdgeBundling() {
        this.maxNearestEdge = 6;
        this.maxTurningAngle = Math.PI / 4;
        this.maxIteration = 10;
    }

    EdgeBundling.prototype = {

        constructor: EdgeBundling,

        run: function (rawEdges) {
            var res = this._iterate(rawEdges);
            var nIterate = 0;
            while (nIterate++ < this.maxIteration) {
                var coarsenedEdges = [];
                for (var i = 0; i < res.groups.length; i++) {
                    coarsenedEdges.push(new CoarsenedEdge(res.groups[i]));
                }
                var newRes = this._iterate(coarsenedEdges);
                if (newRes.savedInk <= 0) {
                    break;
                } else {
                    res = newRes;
                }
            }

            // Get new edges
            var newEdges = [];

            var buildNewEdges = function (groups, fromEdge) {
                for (var i = 0; i < groups.length; i++) {
                    var group = groups[i];
                    if (
                        group.edgeList[0]
                        && (group.edgeList[0].edge instanceof CoarsenedEdge)
                    ) {
                        var newGroups = [];
                        for (var j = 0; j < group.edgeList.length; j++) {
                            newGroups.push(group.edgeList[j].edge.group);
                        }
                        if (! fromEdge) {
                            newEdge = [];
                        } else {
                            newEdge = fromEdge.slice();
                        }
                        newEdge.unshift(group.mp0);
                        newEdge.push(group.mp1);
                        buildNewEdges(newGroups, newEdge);
                    } else {
                        // console.log(group.edgeList.length);
                        for (var j = 0; j < group.edgeList.length; j++) {
                            var edge = group.edgeList[j];
                            if (! fromEdge) {
                                newEdge = [];
                            } else {
                                newEdge = fromEdge.slice();
                            }
                            newEdge.unshift(group.mp0);
                            newEdge.push(group.mp1);
                            newEdge.unshift(edge.getStartPoint());
                            newEdge.push(edge.getEndPoint());
                            newEdges.push(newEdge);
                        }
                    }
                }
            };

            buildNewEdges(res.groups);

            for (var i = 0; i < newEdges.length; i++) {
                newEdges[i] = {
                    points: newEdges[i],
                    rawEdge: rawEdges[i]
                }
            }

            return newEdges;
        },

        _iterate: function (rawEdges) {
            var edges = [];
            var groups = [];
            var totalSavedInk = 0;
            for (var i = 0; i < rawEdges.length; i++) {
                var edge = new Edge(rawEdges[i]);
                edges.push(edge);
            }

            var tree = new KDTree(edges, 4);

            var nearests = [];

            var _mp0 = v2Create();
            var _mp1 = v2Create();
            var _newGroupInk = 0;
            var mp0 = v2Create();
            var mp1 = v2Create();
            var newGroupInk = 0;
            for (var i = 0; i < edges.length; i++) {
                var edge = edges[i];
                if (edge.group) {
                    // Edge have been groupped
                    continue;
                }
                tree.nearestN(
                    edge, this.maxNearestEdge,
                    sqaredDistance, nearests
                );
                var maxSavedInk = 0;
                var mostSavingInkEdge = null;
                var lastCheckedGroup = null;
                for (var j = 0; j < nearests.length; j++) {
                    var nearest = nearests[j];
                    var savedInk = 0;
                    if (nearest.group) {
                        if (nearest.group !== lastCheckedGroup) {
                            lastCheckedGroup = nearest.group;
                            _newGroupInk = this._calculateGroupEdgeInk(
                                nearest.group, edge, _mp0, _mp1
                            );
                            savedInk = nearest.group.ink + edge.ink - _newGroupInk;
                        }
                    }
                    else {
                        _newGroupInk = this._calculateEdgeEdgeInk(
                            edge, nearest, _mp0, _mp1
                        );
                        savedInk = nearest.ink + edge.ink - _newGroupInk;
                    }
                    if (savedInk > maxSavedInk) {
                        maxSavedInk = savedInk;
                        mostSavingInkEdge = nearest;
                        v2Copy(mp1, _mp1);
                        v2Copy(mp0, _mp0);
                        newGroupInk = _newGroupInk;
                    }
                }
                if (mostSavingInkEdge) {
                    totalSavedInk += maxSavedInk;
                    if (! mostSavingInkEdge.group) {
                        var group = new BundledEdgeGroup();
                        groups.push(group);
                        group.addEdge(mostSavingInkEdge);
                    }
                    group = mostSavingInkEdge.group;
                    // Use the meet point and group ink calculated before
                    v2Copy(group.mp0, mp0);
                    v2Copy(group.mp1, mp1);
                    group.ink = newGroupInk;
                    mostSavingInkEdge.group.addEdge(edge);
                }
                else {
                    var group = new BundledEdgeGroup();
                    groups.push(group);
                    v2Copy(group.mp0, edge.getStartPoint());
                    v2Copy(group.mp1, edge.getEndPoint());
                    group.ink = edge.ink;
                    group.addEdge(edge);
                }
            }

            return {
                groups: groups,
                edges: edges,
                savedInk: totalSavedInk
            }
        },

        _calculateEdgeEdgeInk: (function () {
            var startPointSet = [];
            var endPointSet = [];
            return function (e0, e1, mp0, mp1) {
                startPointSet[0] = e0.getStartPoint();
                startPointSet[1] = e1.getStartPoint();
                endPointSet[0] = e0.getEndPoint();
                endPointSet[1] = e1.getEndPoint();

                this._calculateMeetPoints(
                    startPointSet, endPointSet, mp0, mp1
                );
                var ink = v2Dist(startPointSet[0], mp0)
                    + v2Dist(mp0, mp1)
                    + v2Dist(mp1, endPointSet[0])
                    + v2Dist(startPointSet[1], mp0)
                    + v2Dist(mp1, endPointSet[1]);

                return ink;
            };
        })(),

        _calculateGroupEdgeInk: function (group, edgeTryAdd, mp0, mp1) {
            var startPointSet = [];
            var endPointSet = [];
            for (var i = 0; i < group.edgeList.length; i++) {
                var edge = group.edgeList[i];
                startPointSet.push(edge.getStartPoint());
                endPointSet.push(edge.getEndPoint());
            }
            startPointSet.push(edgeTryAdd.getStartPoint());
            endPointSet.push(edgeTryAdd.getEndPoint());

            this._calculateMeetPoints(
                startPointSet, endPointSet, mp0, mp1
            );

            var ink = v2Dist(mp0, mp1);
            for (var i = 0; i < startPointSet.length; i++) {
                ink += v2Dist(startPointSet[i], mp0)
                    + v2Dist(endPointSet[i], mp1);
            }

            return ink;
        },

        /**
         * Calculating the meet points
         * @method
         * @param {Array} startPointSet Start points set of bundled edges
         * @param {Array} endPointSet End points set of bundled edges
         * @param {Array.<number>} mp0 Output meet point 0
         * @param {Array.<number>} mp1 Output meet point 1
         */
        _calculateMeetPoints: (function () {
            var cp0 = v2Create();
            var cp1 = v2Create();
            return function (startPointSet, endPointSet, mp0, mp1) {
                vec2.set(cp0, 0, 0);
                vec2.set(cp1, 0, 0);
                var len = startPointSet.length;
                // Calculate the centroid of start points set
                for (var i = 0; i < len; i++) {
                    vec2.add(cp0, cp0, startPointSet[i]);
                }
                vec2.scale(cp0, cp0, 1 / len);

                // Calculate the centroid of end points set
                len = endPointSet.length;
                for (var i = 0; i < len; i++) {
                    vec2.add(cp1, cp1, endPointSet[i]);
                }
                vec2.scale(cp1, cp1, 1 / len);

                this._limitTurningAngle(
                    startPointSet, cp0, cp1, mp0
                );
                this._limitTurningAngle(
                    endPointSet, cp1, cp0, mp1
                );
            }
        })(),

        _limitTurningAngle: (function () {
            var v10 = v2Create();
            var vTmp = v2Create();
            var project = v2Create();
            var tmpOut = v2Create();
            return function (pointSet, p0, p1, out) {
                // Limit the max turning angle
                var maxTurningAngleCos = Math.cos(this.maxTurningAngle);
                var maxTurningAngleTan = Math.tan(this.maxTurningAngle);

                vec2.sub(v10, p0, p1);
                vec2.normalize(v10, v10);

                // Simply copy the centroid point if no need to turn the angle
                vec2.copy(out, p0);

                var maxMovement = 0;
                for (var i = 0; i < pointSet.length; i++) {
                    var p = pointSet[i];
                    vec2.sub(vTmp, p, p0);
                    var len = vec2.len(vTmp);
                    vec2.scale(vTmp, vTmp, 1 / len);
                    var turningAngleCos = vec2.dot(vTmp, v10);
                    // Turning angle is to large
                    if (turningAngleCos < maxTurningAngleCos) {
                        // Calculat p's project point on vector p1-p0
                        // and distance to the vector
                        vec2.scaleAndAdd(
                            project, p0, v10, len * turningAngleCos
                        );
                        var distance = v2Dist(project, p);

                        // Use the max turning angle to calculate the new meet point
                        var d = distance / maxTurningAngleTan;
                        vec2.scaleAndAdd(tmpOut, project, v10, -d);

                        var movement = v2DistSquare(tmpOut, p0);
                        if (movement > maxMovement) {
                            maxMovement = movement;
                            vec2.copy(out, tmpOut);
                        }
                    }
                }
            };
        })()
    }

    return EdgeBundling;
});


text:
package com.example.collins.littlehearts.ui;

import android.os.Bundle;
import android.support.v4.view.ViewPager;
import android.support.v7.app.AppCompatActivity;

import com.example.collins.littlehearts.Constants;
import com.example.collins.littlehearts.R;
import com.example.collins.littlehearts.adapters.PetPagerAdapter;
import com.example.collins.littlehearts.models.Pet;

import org.parceler.Parcels;

import java.util.ArrayList;

import butterknife.Bind;
import butterknife.ButterKnife;

public class PetDetailActivity extends AppCompatActivity {
    @Bind(R.id.viewPager)
    ViewPager mViewPager;
    private PetPagerAdapter adapterViewPager;
    ArrayList<Pet> mPets = new ArrayList<>();
    private String mSource;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_pet_detail);
        ButterKnife.bind(this);

        mPets = Parcels.unwrap(getIntent().getParcelableExtra(Constants.EXTRA_KEY_PETS));
        int startingPosition =getIntent().getIntExtra(Constants.EXTRA_KEY_POSITION, 0);
        mSource = getIntent().getStringExtra(Constants.KEY_SOURCE);

        adapterViewPager = new PetPagerAdapter(getSupportFragmentManager(), mPets, mSource);
        mViewPager.setAdapter(adapterViewPager);
        mViewPager.setCurrentItem(startingPosition);
    }
}

redpajama_set_name: RedPajamaGithub


text: geth --datadir ~/Library/Ethereum/privatechain init CustomGenesis.json


text:
title: '#NMTrue Adventures in #Architecture #Travel : Los Poblanos in ABQ'
date: 2014-06-23T15:56:00.001-07:00
draft: false
slug: nmtrue-adventures-in-architecture
---

[Rachel Preston Prinz: #NMTrue Adventures in #Architecture #Travel : EXTR...](http://rachelprestonprinz.blogspot.com/2014/06/nmtrue-adventures-in-architecture_23.html?spref=bl): Today we filmed for our upcoming television show Built for Life: Southwest at the amazing Los Poblanos Historic Inn and Organic Farm in A...


text:
function jQueryMobile(_args) {
	var indicator;
	var win = Ti.UI.createWindow({
		title:_args.title,
		backgroundColor: '#fff'
	});
	var webview = Ti.UI.createWebView({
		url: 'http://jquerymobile.com/demos/1.1.0/'
	});
	win.add(webview);

	win.addEventListener('open', function(e) {
		indicator = Ti.UI.createActivityIndicator({
			message: 'Loading jQuery Mobile...'
		});
		indicator.show();
	});
	webview.addEventListener('load', function(e) {
		indicator.hide();
	});

	return win;
};

module.exports = jQueryMobile;


text:
package com.evolveum.midpoint.web.component;

import com.evolveum.midpoint.prism.PrismObject;
import com.evolveum.midpoint.schema.result.OperationResult;
import com.evolveum.midpoint.util.logging.Trace;
import com.evolveum.midpoint.util.logging.TraceManager;
import com.evolveum.midpoint.web.component.util.LoadableModel;
import com.evolveum.midpoint.web.component.util.SimplePanel;
import com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour;
import com.evolveum.midpoint.web.page.admin.configuration.component.ObjectPolicyDialog;
import com.evolveum.midpoint.web.page.admin.configuration.dto.ObjectPolicyConfigurationTypeDto;
import com.evolveum.midpoint.web.util.WebMiscUtil;
import com.evolveum.midpoint.web.util.WebModelUtils;
import com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectReferenceType;
import com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectTemplateType;
import org.apache.wicket.ajax.AjaxRequestTarget;
import org.apache.wicket.ajax.form.AjaxFormComponentUpdatingBehavior;
import org.apache.wicket.ajax.markup.html.AjaxLink;
import org.apache.wicket.behavior.AttributeAppender;
import org.apache.wicket.extensions.ajax.markup.html.modal.ModalWindow;
import org.apache.wicket.feedback.ComponentFeedbackMessageFilter;
import org.apache.wicket.markup.html.WebMarkupContainer;
import org.apache.wicket.markup.html.basic.Label;
import org.apache.wicket.markup.html.form.TextField;
import org.apache.wicket.markup.html.list.ListItem;
import org.apache.wicket.markup.html.list.ListView;
import org.apache.wicket.markup.html.panel.FeedbackPanel;
import org.apache.wicket.model.AbstractReadOnlyModel;
import org.apache.wicket.model.IModel;

import java.util.Iterator;
import java.util.List;

/**
 *  @author shood
 */

public class ObjectPolicyConfigurationEditor extends SimplePanel<List<ObjectPolicyConfigurationTypeDto>> {

    private static final Trace LOGGER = TraceManager.getTrace(ObjectPolicyConfigurationEditor.class);

    private static final String DOT_CLASS = ObjectPolicyConfigurationEditor.class.getName() + ".";

    private static final String OPERATION_LOAD_OBJECT_TEMPLATE = DOT_CLASS + "loadObjectTemplate";

    private static final String ID_TEMPLATE_CONFIG_MODAL = "templateConfigModal";

    private static final String ID_LABEL = "label";
    private static final String ID_REPEATER = "repeater";
    private static final String ID_TEXT_WRAPPER = "textWrapper";
    private static final String ID_BUTTON_EDIT = "edit";
    private static final String ID_NAME = "name";
    private static final String ID_FEEDBACK = "feedback";
    private static final String ID_BUTTON_GROUP = "buttonGroup";
    private static final String ID_BUTTON_REMOVE = "remove";
    private static final String ID_BUTTON_ADD = "add";

    private static final String CLASS_MULTI_VALUE = "multivalue-form";
    private static final String OFFSET_CLASS = "col-md-offset-4";

    public ObjectPolicyConfigurationEditor(String id, IModel<List<ObjectPolicyConfigurationTypeDto>> model){
        super(id, model);

        setOutputMarkupId(true);
    }

    @Override
    protected void initLayout(){

        final Label label = new Label(ID_LABEL, createStringResource("objectPolicyConfigurationEditor.label"));
        add(label);

        ListView repeater = new ListView<ObjectPolicyConfigurationTypeDto>(ID_REPEATER, getModel()) {

            @Override
            protected void populateItem(final ListItem item) {
                WebMarkupContainer textWrapper = new WebMarkupContainer(ID_TEXT_WRAPPER);
                textWrapper.add(AttributeAppender.prepend("class", new AbstractReadOnlyModel<String>(){

                    @Override
                    public String getObject(){
                        if(item.getIndex() > 0){
                            return OFFSET_CLASS + " " + CLASS_MULTI_VALUE;
                        }

                        return null;
                    }
                }));
                item.add(textWrapper);

                TextField name = new TextField<>(ID_NAME, createNameModel(item.getModel()));
                name.setOutputMarkupId(true);
                name.add(new AjaxFormComponentUpdatingBehavior("onblur") {
                    @Override
                    protected void onUpdate(AjaxRequestTarget target) {}
                });
                name.setEnabled(false);
                name.add(AttributeAppender.replace("placeholder", createStringResource("objectPolicyConfigurationEditor.name.placeholder")));
                textWrapper.add(name);

                FeedbackPanel feedback = new FeedbackPanel(ID_FEEDBACK, new ComponentFeedbackMessageFilter(name));
                textWrapper.add(feedback);

                AjaxLink edit = new AjaxLink(ID_BUTTON_EDIT) {

                    @Override
                    public void onClick(AjaxRequestTarget target) {
                        editPerformed(target, item);
                    }
                };
                textWrapper.add(edit);

                WebMarkupContainer buttonGroup = new WebMarkupContainer(ID_BUTTON_GROUP);
                buttonGroup.add(AttributeAppender.append("class", new AbstractReadOnlyModel<String>() {

                    @Override
                    public String getObject() {
                        if(item.getIndex() > 0){
                            return CLASS_MULTI_VALUE;
                        }

                        return null;
                    }
                }));
                item.add(buttonGroup);
                initButtons(buttonGroup, item);
            }
        };

        initDialog();
        repeater.setOutputMarkupId(true);
        add(repeater);
    }

    private void initDialog(){
        ModalWindow editor = new ObjectPolicyDialog(ID_TEMPLATE_CONFIG_MODAL, null){

            @Override
            protected void savePerformed(AjaxRequestTarget target){
                ObjectPolicyConfigurationTypeDto oldConfig = getModel().getObject().getConfig();
                ObjectPolicyConfigurationTypeDto newConfig = getModel().getObject().preparePolicyConfig();

                ObjectPolicyConfigurationEditor.this.replace(oldConfig, newConfig);

                target.add(ObjectPolicyConfigurationEditor.this);
                close(target);
            }
        };
        add(editor);
    }

    private void replace(ObjectPolicyConfigurationTypeDto old, ObjectPolicyConfigurationTypeDto newC){
        boolean added = false;

        List<ObjectPolicyConfigurationTypeDto> list = getModelObject();
        for(ObjectPolicyConfigurationTypeDto o: list){
            if(old.equals(o)){
                o.setConstraints(newC.getConstraints());
                o.setTemplateRef(newC.getTemplateRef());
                o.setType(newC.getType());
                added = true;
            }
        }

        if(!added){
            list.add(newC);
        }
    }

    private void initButtons(WebMarkupContainer buttonGroup, final ListItem item){
        AjaxLink add = new AjaxLink(ID_BUTTON_ADD) {

            @Override
            public void onClick(AjaxRequestTarget target) {
                addPerformed(target);
            }
        };
        add.add(new VisibleEnableBehaviour() {

            @Override
            public boolean isVisible() {
                return isAddButtonVisible(item);
            }
        });
        buttonGroup.add(add);

        AjaxLink remove = new AjaxLink(ID_BUTTON_REMOVE) {

            @Override
            public void onClick(AjaxRequestTarget target) {
                removePerformed(target, item);
            }
        };
        remove.add(new VisibleEnableBehaviour() {

            @Override
            public boolean isVisible() {
                return isRemoveButtonVisible();
            }
        });
        buttonGroup.add(remove);
    }

    protected boolean isAddButtonVisible(ListItem item) {
       int size = getModelObject().size();
        if (size <= 1) {
            return true;
        }
        if (item.getIndex() == size - 1) {
            return true;
        }

        return false;
    }

    protected boolean isRemoveButtonVisible() {
        int size = getModelObject().size();
        if (size > 0) {
            return true;
        }

        return false;
    }

    private IModel<String> createNameModel(final IModel<ObjectPolicyConfigurationTypeDto> model){
        return new LoadableModel<String>() {

            @Override
            public String load() {
                OperationResult result = new OperationResult(OPERATION_LOAD_OBJECT_TEMPLATE);
                StringBuilder sb = new StringBuilder();
                ObjectPolicyConfigurationTypeDto config = model.getObject();

                if(config != null){
                    ObjectReferenceType ref = config.getTemplateRef();

                    if(ref != null){
                        String oid = ref.getOid();

                        PrismObject<ObjectTemplateType> template = WebModelUtils.loadObject(ObjectTemplateType.class, oid, result, getPageBase());

                        if(template != null){
                            ObjectTemplateType tmp = template.asObjectable();
                            sb.append(WebMiscUtil.getOrigStringFromPoly(tmp.getName())).append(": ");
                        }
                    }

                    if(config.getType() != null){
                        sb.append(config.getType().getLocalPart());
                    }
                }

                return sb.toString();
            }
        };
    }

    private void addPerformed(AjaxRequestTarget target){
        List<ObjectPolicyConfigurationTypeDto> list = getModelObject();
        list.add(new ObjectPolicyConfigurationTypeDto());

        target.add(this);
    }

    private void removePerformed(AjaxRequestTarget target, ListItem item){
        List<ObjectPolicyConfigurationTypeDto> list = getModelObject();
        Iterator<ObjectPolicyConfigurationTypeDto> iterator = list.iterator();

        while (iterator.hasNext()){
            ObjectPolicyConfigurationTypeDto object = iterator.next();

            if(object.equals(item.getModelObject())){
                iterator.remove();
                break;
            }
        }

        if(list.size() == 0){
            list.add(new ObjectPolicyConfigurationTypeDto());
        }

        target.add(this);
    }

    private void editPerformed(AjaxRequestTarget target, ListItem item){
        ObjectPolicyDialog window = (ObjectPolicyDialog) get(ID_TEMPLATE_CONFIG_MODAL);
        window.updateModel(target, (ObjectPolicyConfigurationTypeDto)item.getModelObject());
        window.show(target);
    }

}


text:
package org.camunda.bpm.engine.test.api.repository;

import java.util.Collection;

import org.camunda.bpm.engine.impl.test.PluggableProcessEngineTestCase;
import org.camunda.bpm.engine.test.Deployment;
import org.camunda.bpm.model.dmn.DmnModelInstance;
import org.camunda.bpm.model.dmn.instance.Decision;
import org.camunda.bpm.model.dmn.instance.DecisionTable;
import org.camunda.bpm.model.dmn.instance.Input;
import org.camunda.bpm.model.dmn.instance.Output;
import org.camunda.bpm.model.dmn.instance.Rule;

public class DmnModelElementInstanceCmdTest extends PluggableProcessEngineTestCase {

  private final static String DECISION_KEY = "one";

  @Deployment(resources = "org/camunda/bpm/engine/test/repository/one.dmn")
  public void testRepositoryService() {
    String decisionDefinitionId = repositoryService
      .createDecisionDefinitionQuery()
      .decisionDefinitionKey(DECISION_KEY)
      .singleResult()
      .getId();

    DmnModelInstance modelInstance = repositoryService.getDmnModelInstance(decisionDefinitionId);
    assertNotNull(modelInstance);

    Collection<Decision> decisions = modelInstance.getModelElementsByType(Decision.class);
    assertEquals(1, decisions.size());

    Collection<DecisionTable> decisionTables = modelInstance.getModelElementsByType(DecisionTable.class);
    assertEquals(1, decisionTables.size());

    Collection<Input> inputs = modelInstance.getModelElementsByType(Input.class);
    assertEquals(1, inputs.size());

    Collection<Output> outputs = modelInstance.getModelElementsByType(Output.class);
    assertEquals(1, outputs.size());

    Collection<Rule> rules = modelInstance.getModelElementsByType(Rule.class);
    assertEquals(2, rules.size());
  }

}


text:
<?php

namespace BingAds\CampaignManagement;

/**
 * Updates the specified ad groups in a specified campaign.
 *
 * @link http://msdn.microsoft.com/en-us/library/dn277528(v=msads.90).aspx UpdateAdGroups Response Object
 *
 * @used-by BingAdsCampaignManagementService::UpdateAdGroups
 */
final class UpdateAdGroupsResponse
{
}


text:
<!DOCTYPE html>

  <title>Everything vs. Everything Scatter Plots</title>
  <meta http-equiv="content-type" content="text/html; charset=utf-8" />
  <link rel="stylesheet" href="style.css" />

      Column (X axis): <select id="selCol"></select>
      Row (Y axis): <select id="selRow"></select>

LOADING... Please be patient.

Axis Style

x axis:
          <input type="checkbox" class="style_checkbox" id="x_log">log scale</input>
          <input type="checkbox" class="style_checkbox" id="x_rev">reversed</input>

y axis:
          <input type="checkbox" class="style_checkbox" id="y_log">log scale</input>
          <input type="checkbox" class="style_checkbox" id="y_rev">reversed</input>

x limits: <input class="range_input" id="x_amin"></input> to <input class="range_input" id="x_amax"></input><button id="setLimits">Set</button>

y limits: <input class="range_input" id="y_amin"></input> to <input class="range_input" id="y_amax"></input><button id="clearLimits">Clear</button>

Setting limits is still an experimental function. For now you MUST specify all four numbers to set limits.

Selection

x range: <input class="range_input" id="xmin"></input> to <input class="range_input" id="xmax"></input><button id="selectRange">Select</button>

y range: <input class="range_input" id="ymin"></input> to <input class="range_input" id="ymax"></input><button id="clearRange">Unselect</button>

Jump to

History: <select id="history"></select>

Key: <input class="key_input" id="key"></input><button id="goKey">Go!</button>

Interface made by Yao-Yuan Mao, with Google Charts API.


text:
/*
 * This file is subject to the terms of the GFX License. If a copy of
 * the license was not distributed with this file, you can obtain one at:
 *
 *              http://ugfx.org/license.html
 */

#ifndef _GDISP_LLD_BOARD_H
#define _GDISP_LLD_BOARD_H

// For a multiple display configuration we would put all this in a structure and then
//	set g->board to that structure.
#define SET_CS    palSetPad(GPIOE, GPIOE_LCD_CS);
#define CLR_CS    palClearPad(GPIOE, GPIOE_LCD_CS);
#define SET_RS    palSetPad(GPIOE, GPIOE_LCD_RS);
#define CLR_RS    palClearPad(GPIOE, GPIOE_LCD_RS);
#define SET_WR    palSetPad(GPIOE, GPIOE_PMWR);
#define CLR_WR    palClearPad(GPIOE, GPIOE_PMWR);
#define SET_RD    palSetPad(GPIOE, GPIOE_PMRD);
#define CLR_RD    palClearPad(GPIOE, GPIOE_PMRD);

static GFXINLINE void init_board(GDisplay *g) {

	// As we are not using multiple displays we set g->board to NULL as we don't use it.
	g->board = 0;

	switch(g->controllerdisplay) {
	case 0:											// Set up for Display 0
		/* Configure the pins to a well know state */
		SET_RS;
		SET_RD;
		SET_WR;
		CLR_CS;
		break;
	}
}

static GFXINLINE void post_init_board(GDisplay *g) {
	(void) g;
}

static GFXINLINE void setpin_reset(GDisplay *g, bool_t state) {
	(void) g;
	if(state) {
		// reset lcd
		palClearPad(GPIOE, GPIOE_LCD_RST);
	} else {
		palSetPad(GPIOE, GPIOE_LCD_RST);
	}
}

static GFXINLINE void set_backlight(GDisplay *g, uint8_t percent) {
	(void) g;
	// TODO: can probably pwm this
	if(percent) {
		// turn back light on
		palSetPad(GPIOE, GPIOE_LCD_BLED);
	} else {
		// turn off
		palClearPad(GPIOE, GPIOE_LCD_BLED);
	}
}

static GFXINLINE void acquire_bus(GDisplay *g) {
	(void) g;
}

static GFXINLINE void release_bus(GDisplay *g) {
	(void) g;
}

/**
 * @brief   Short delay
 *
 * @param[in] dly		Length of delay
 *
 * @notapi
 */
static GFXINLINE void ili9341_delay(uint16_t dly) {
  static uint16_t i;
  for(i = 0; i < dly; i++)
    asm("nop");
}

static GFXINLINE void write_index(GDisplay *g, uint16_t index) {
	(void) g;
	palWriteGroup(GPIOE, 0x00FF, 0, index);
	CLR_RS; CLR_WR; ili9341_delay(1); SET_WR; ili9341_delay(1); SET_RS;
}

static GFXINLINE void write_data(GDisplay *g, uint16_t data) {
	(void) g;
	palWriteGroup(GPIOE, 0x00FF, 0, data);
	CLR_WR; ili9341_delay(1); SET_WR; ili9341_delay(1);
}

static GFXINLINE void setreadmode(GDisplay *g) {
	(void) g;
	// change pin mode to digital input
	palSetGroupMode(GPIOE, PAL_WHOLE_PORT, 0, PAL_MODE_INPUT);
}

static GFXINLINE void setwritemode(GDisplay *g) {
	(void) g;
	// change pin mode back to digital output
	palSetGroupMode(GPIOE, PAL_WHOLE_PORT, 0, PAL_MODE_OUTPUT_PUSHPULL);
}

static GFXINLINE uint16_t read_data(GDisplay *g) {
	uint16_t	value;
	(void) g;
	CLR_RD;
	value = palReadPort(GPIOE);
	value = palReadPort(GPIOE);
	SET_RD;
	return value;
}

#endif /* _GDISP_LLD_BOARD_H */


text:
module Mongoid
  module Socialization
    module Mentioner
      extend ActiveSupport::Concern

      included do
        field           :mentionables_count, type: Hash,  default: {}

        after_destroy   { mention_klass.remove_mentionables(self) }
      end

      def mentionables_count(klass=nil)
        if klass.nil?
          read_attribute(:mentionables_count).values.sum
        else
          read_attribute(:mentionables_count).fetch(klass.name, 0)
        end
      end

      def update_mentionables_count!(klass, count)
        hash = read_attribute(:mentionables_count)
        hash[klass.name] = count

        if Mongoid::VERSION.start_with?("3.1")
          set(:mentionables_count, hash)
        else
          set(mentionables_count: hash)
        end
      end

      def mention!(mentionable)
        mention_klass.validate_mentionable!(mentionable)

        mentionable.run_callbacks :mention do
          mention_klass.mention!(self, mentionable)
          mentionable.mentioner = self
        end
      end

      def mention(mentionable)
        mention!(mentionable)
      rescue
        false
      else
        true
      end

      def unmention!(mentionable)
        mention_klass.validate_mentionable!(mentionable)

        mentionable.run_callbacks :unmention do
          mention_klass.unmention!(self, mentionable)
          mentionable.unmentioner = self
        end
      end

      def unmention(mentionable)
        unmention!(mentionable)
      rescue
        false
      else
        true
      end

      def toggle_mention!(mentionable)
        mention_klass.toggle_mention!(self, mentionable)
      end

      def toggle_mention(mentionable)
        toggle_mention!(mentionable)
      rescue
        false
      else
        true
      end

      def mentioned?(mentionable)
        mention_klass.mentioned?(self, mentionable)
      rescue
        false
      end

      def mentionables(klass)
        mention_klass.mentionables(self, klass)
      end
    end
  end
end


text:
<!--
    Copyright 2009 the original author or authors. Licensed under the Apache
    License, Version 2.0 (the "License"); you may not use this file except
    in compliance with the License. You may obtain a copy of the License at
    http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable
    law or agreed to in writing, software distributed under the License is
    distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
    KIND, either express or implied. See the License for the specific
    language governing permissions and limitations under the License.
-->

<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xmlns:util="http://www.springframework.org/schema/util"
       xmlns:camel="http://camel.apache.org/schema/spring"
       xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/util
http://www.springframework.org/schema/util/spring-util.xsd
http://camel.apache.org/schema/spring
http://camel.apache.org/schema/spring/camel-spring.xsd">

    <import resource="classpath:common-mllp-beans.xml"/>

    <bean id="routeBuilder"
          class="org.openehealth.ipf.platform.camel.ihe.mllp.iti21.Iti21TestRouteBuilder">
    </bean>

    <bean id="hapiContext" class="ca.uhn.hl7v2.DefaultHapiContext">
        <property name="modelClassFactory" ref="modelClassFactory"/>
    </bean>

    <bean id="modelClassFactory" class="org.openehealth.ipf.modules.hl7.parser.CustomModelClassFactory">
        <constructor-arg>
            <util:map>
                <entry key="2.5" value="org.openehealth.ipf.commons.ihe.hl7v2.definitions.pdq.v25"/>
            </util:map>
        </constructor-arg>
    </bean>

    <bean id="dummyInterceptor"
          class="org.openehealth.ipf.platform.camel.ihe.mllp.iti21.DummyInterceptor$Factory"/>

    <bean id="authenticationInterceptor"
          class="org.openehealth.ipf.platform.camel.ihe.mllp.iti21.AuthenticationInterceptor$Factory"/>

    <camel:sslContextParameters id="sslContextParameters">
        <camel:secureSocketProtocols>
            <camel:secureSocketProtocol>TLSv1.2</camel:secureSocketProtocol>
        </camel:secureSocketProtocols>
        <camel:keyManagers keyPassword="changeit">
            <camel:keyStore type="PKCS12" password="changeit" resource="keystore.p12"/>
        </camel:keyManagers>
        <camel:trustManagers>
            <camel:keyStore type="PKCS12" password="changeit" resource="keystore.p12"/>
        </camel:trustManagers>
        <camel:clientParameters>
            <camel:cipherSuitesFilter>
                <camel:include>.*_RSA_WITH_AES_.*</camel:include>
                <camel:exclude>.*_DH_anon_.*</camel:exclude>
            </camel:cipherSuitesFilter>
        </camel:clientParameters>
    </camel:sslContextParameters>

    <bean id="hl7CorrelationManager" class="org.openehealth.ipf.platform.camel.ihe.mllp.core.Hl7CorrelationManager">
        <constructor-arg ref="hapiContext"/>
    </bean>

    <!--
    <bean id="sendTracingData"
          class="org.openehealth.ipf.platform.camel.ihe.hl7v2.intercept.producer.ProducerTracingInterceptor$Factory"/>

    <bean id="receiveTracingData"
          class="org.openehealth.ipf.platform.camel.ihe.hl7v2.intercept.consumer.ConsumerTracingInterceptor$Factory"/>
    -->
</beans>


text:
require 'resque/smtp/version'

module Resque
  module SMTP
    autoload :EmailJob,       'resque/smtp/email_job'
    autoload :DeliveryMethod, 'resque/smtp/delivery_method'

    class << self
      attr_accessor :smtp_settings
    end

  end
end

require 'resque/smtp/railtie' if defined? Rails


text:
// CountdownEvent.cs
//
// Authors:
//    Marek Safar  <marek.safar@gmail.com>
//
// Copyright (c) 2008 Jérémie "Garuma" Laval
// Copyright 2011 Xamarin Inc (http://www.xamarin.com).
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
//
//

namespace System.Threading
{
	[System.Diagnostics.DebuggerDisplayAttribute ("Initial Count={InitialCount}, Current Count={CurrentCount}")]
	public class CountdownEvent : IDisposable
	{
		int initialCount;
		int initial;
		ManualResetEventSlim evt;

		public CountdownEvent (int initialCount)
		{
			if (initialCount < 0)
				throw new ArgumentOutOfRangeException ("initialCount");

			evt = new ManualResetEventSlim (initialCount == 0);
			this.initial = this.initialCount = initialCount;
		}

		public int CurrentCount {
			get {
				return initialCount;
			}
		}

		public int InitialCount {
			get {
				return initial;
			}
		}

		public bool IsSet {
			get {
				return initialCount == 0;
			}
		}

		public WaitHandle WaitHandle {
			get {
				return evt.WaitHandle;
			}
		}

		public bool Signal ()
		{
			return Signal (1);
		}

		public bool Signal (int signalCount)
		{
			if (signalCount <= 0)
				throw new ArgumentOutOfRangeException ("signalCount");

			CheckDisposed ();

			int newValue;
			if (!ApplyOperation (-signalCount, out newValue))
				throw new InvalidOperationException ("The event is already set");

			if (newValue == 0) {
				evt.Set ();
				return true;
			}

			return false;
		}

		public void AddCount ()
		{
			AddCount (1);
		}

		public void AddCount (int signalCount)
		{
			if (!TryAddCount (signalCount))
				throw new InvalidOperationException ("The event is already signaled and cannot be incremented");
		}

		public bool TryAddCount ()
		{
			return TryAddCount (1);
		}

		public bool TryAddCount (int signalCount)
		{
			if (signalCount <= 0)
				throw new ArgumentOutOfRangeException ("signalCount");

			CheckDisposed ();

			int temp;
			return ApplyOperation (signalCount, out temp);
		}

		bool ApplyOperation (int num, out int newValue)
		{
			int oldCount;

			do {
				oldCount = initialCount;
				if (oldCount == 0) {
					newValue = 0;
					return false;
				}

				newValue = oldCount + num;

				if (newValue < 0)
					return false;
			} while (Interlocked.CompareExchange (ref initialCount, newValue, oldCount) != oldCount);

			return true;
		}

		public void Wait ()
		{
			evt.Wait ();
		}

		public void Wait (CancellationToken cancellationToken)
		{
			evt.Wait (cancellationToken);
		}

		public bool Wait (int millisecondsTimeout)
		{
			return evt.Wait (millisecondsTimeout);
		}

		public bool Wait(TimeSpan timeout)
		{
			return evt.Wait (timeout);
		}

		public bool Wait (int millisecondsTimeout, CancellationToken cancellationToken)
		{
			return evt.Wait (millisecondsTimeout, cancellationToken);
		}

		public bool Wait(TimeSpan timeout, CancellationToken cancellationToken)
		{
			return evt.Wait (timeout, cancellationToken);
		}

		public void Reset ()
		{
			Reset (initial);
		}

		public void Reset (int count)
		{
			if (count < 0)
				throw new ArgumentOutOfRangeException ("count");

			CheckDisposed ();

			initialCount = initial = count;
			if (count == 0)
				evt.Set ();
			else
				evt.Reset ();
		}

		public void Dispose ()
		{
			Dispose (true);
		}

		protected virtual void Dispose (bool disposing)
		{
			if (disposing)
				evt.Dispose ();
		}

		void CheckDisposed ()
		{
			if (evt.disposed.Value)
				throw new ObjectDisposedException ("CountdownEvent");
		}
	}
}


text:
template <class Tp>
struct SimpleAllocator
{
    typedef Tp value_type;

    SimpleAllocator()
    {
    }

    template <class T> SimpleAllocator(const SimpleAllocator<T>& other)
    {
    }

    Tp *allocate(std::size_t n)
    {
        return static_cast<Tp*>(::operator new(n * sizeof(Tp)));
    }

    void deallocate(Tp* p, std::size_t)
    {
        ::operator delete((void*) p);
    }
};

template <typename T>
void test_simple_allocator()
{
    test::check_instances check_;

    typedef boost::unordered::detail::allocator_traits<
        SimpleAllocator<T> > traits;

    BOOST_MPL_ASSERT((boost::is_same<typename traits::allocator_type, SimpleAllocator<T> >));

    BOOST_MPL_ASSERT((boost::is_same<typename traits::value_type, T>));

    BOOST_MPL_ASSERT((boost::is_same<typename traits::pointer, T* >));
    BOOST_MPL_ASSERT((boost::is_same<typename traits::const_pointer, T const*>));
    //BOOST_MPL_ASSERT((boost::is_same<typename traits::void_pointer, void* >));
    //BOOST_MPL_ASSERT((boost::is_same<typename traits::const_void_pointer, void const*>));

    BOOST_MPL_ASSERT((boost::is_same<typename traits::difference_type, std::ptrdiff_t>));

#if BOOST_UNORDERED_USE_ALLOCATOR_TRAITS == 1
    BOOST_MPL_ASSERT((boost::is_same<typename traits::size_type,
        std::make_unsigned<std::ptrdiff_t>::type>));
#else
    BOOST_MPL_ASSERT((boost::is_same<typename traits::size_type, std::size_t>));
#endif

    BOOST_TEST(!traits::propagate_on_container_copy_assignment::value);
    BOOST_TEST(!traits::propagate_on_container_move_assignment::value);
    BOOST_TEST(!traits::propagate_on_container_swap::value);

    // rebind_alloc
    // rebind_traits

    SimpleAllocator<T> a;

    T* ptr1 = traits::allocate(a, 1);
    //T* ptr2 = traits::allocate(a, 1, static_cast<void const*>(ptr1));

    traits::construct(a, ptr1, T(10));
    //traits::construct(a, ptr2, T(30), ptr1);

    BOOST_TEST(*ptr1 == T(10));
    //BOOST_TEST(*ptr2 == T(30));

    traits::destroy(a, ptr1);
    //traits::destroy(a, ptr2);

    //traits::deallocate(a, ptr2, 1);
    traits::deallocate(a, ptr1, 1);

    traits::max_size(a);
}

int main()
{
    test_simple_allocator<int>();
    test_simple_allocator<test::object>();

    return boost::report_errors();
}


text:
node-movie
==========
Please click on the following link for instructions
https://github.com/mickeyr007/node-movie/wiki


text:
import { click, currentRouteName, visit } from '@ember/test-helpers';
import {
  describe,
  it,
  beforeEach,
  afterEach
} from 'mocha';
import { expect } from 'chai';
import sinon from 'sinon'
import startApp from '../helpers/start-app';
import destroyApp from '../helpers/destroy-app';
import { setupApplicationTest } from 'ember-mocha';

describe('Acceptance: Smoke Test', function() {
  setupApplicationTest();
  let application, windowConfirmStub, sandbox;

  beforeEach(function() {
    application = startApp();
    sandbox = sinon.createSandbox();
    windowConfirmStub = sandbox.stub(window, 'confirm');
  });

  afterEach(function() {
    destroyApp(application);
    sandbox.restore();
  });

  it('does not confirm with the user if the record is not dirtied', async function() {
    await visit('/');
    await click('#foo-link');
    await click('#index-link');
    expect(windowConfirmStub.called).to.be.false;
  });

  it('confirms with the user if the record is dirtied', async function() {
    await visit('/');
    await click('#foo-link');
    await click('#dirty-record-button');
    await click('#index-link');
    expect(windowConfirmStub.calledOnce).to.be.true;
  });

  it('it allows navigation if the user confirms', async function() {
    windowConfirmStub.returns(true);

    await visit('/');
    await click('#foo-link');
    await click('#dirty-record-button');
    await click('#index-link');
    expect(currentRouteName()).to.equal('index');
  });

  it('it aborts navigation if the user declines', async function() {
    windowConfirmStub.returns(false);

    await visit('/');
    await click('#foo-link');
    await click('#dirty-record-button');
    await click('#index-link');
    expect(currentRouteName()).to.equal('foo');
  });

  it('passes the model to the custom message', async function() {
    await visit('/');
    await click('#foo-link');
    await click('#dirty-record-button');
    await click('#index-link');
    const msg = windowConfirmStub.getCall(0).args[0];
    expect(msg).to.contain('jasonmit');
  });
});


text:
- [Viewing datasets](#viewing-datasets)
    - [Default dataset view](#default-dataset-view)
        - [Summary view](#summary-view)
        - [Description view](#description-view)
        - [Dataset notes](#dataset-notes)
        - [Change view](#change-view)
    - [Download original files](#download-original-files)
    - [Metadata](#metadata)
- [Viewing tracks](#viewing-tracks)

## Viewing datasets

A dataset is a group of files that are linked together in one category.
Datasets could be arranged into hierarchy.

When NGB is opened, you will see a list of datasets in the **Datasets** panel to the right:
    ![NGB GUI](images/projects-1.png)

Grouped items can be expanded/collapsed, using an arrow icon next to a group name.

Each item in the datasets hierarchy shows corresponding genome name (e.g. `GRCh38`, `hg19`). It is located to the right from the items name.

Each file item in the hierarchy shows its type (e.g. BAM, VCF, WIG, BED, etc.) to left from the file's name.

Data can be opened:

- by clicking a checkbox next to a dataset name - this will open all files, contained in a dataset:
    ![NGB GUI](images/projects-6.png)
    ![NGB GUI](images/projects-7.png)
- by clicking a checkbox next to a specific file - this will open only the selected file and the dataset object (reference with annotation):
    ![NGB GUI](images/projects-8.png)
    ![NGB GUI](images/projects-9.png)

Data can be closed:

- by unselecting the dataset itself (unsetting the checkbox) - the dataset with its files will be closed:
    ![NGB GUI](images/projects-10.png)
    ![NGB GUI](images/projects-11.png)
- by unselecting the file - the file only will be closed. If all files in the dataset are unselected in such way - only dataset object itself will stay opened (reference with annotation):
    ![NGB GUI](images/projects-12.png)
    ![NGB GUI](images/projects-13.png)

> **_Note_**: the NGB has a restriction for maximum allowed count of the inner dataset files that can be opened automatically at once (default value - `10`).
> If any dataset has more files than this count and the user tries to open such dataset (by clicking a checkbox next to a dataset name) - checkbox will stay unselected, no files will be opened.
> When hovering such dataset object - a corresponding warning about large count of files will appear in a tooltip.
> User should expand such dataset and select necessary files manually.
> Described rules are applied as for simple dataset and for nested datasets (in this case, a number of all files in nested datasets is being counted).
>
> If user selects manually any file in this dataset - the dataset checkbox becomes selected too but still disabled:
> ![NGB GUI](images/projects-14.png)

### Default dataset view

When you select files from datasets - you can see the following forms in the "**Browser**" panel:

#### Summary view

This view is shown if a dataset has no additional descriptions.

![NGB GUI](images/projects-2.png)

If the one or more VCF files were selected (as on the picture above), the **Summary** view will show the charts depicting the variations' breakdown as follows:

- by chromosomes (_to open a chromosome, click the corresponding bar of the chart_)
- by type (_click any type to view statistics only by the specific variants type_)
- by quality

If no VCF files were selected, the **Summary** view will only show the list of loaded files:
    ![NGB GUI](images/projects-15.png)

#### Description view

Dataset may have an `html` description file:

- If a dataset has a description file - this file is shown in the "**Browser**" panel _by default_ when opening dataset
- This file is being attached to a dataset during its registration or can be added to the registered dataset separately
- Such file is not displayed in the datasets tree (at the "**Datasets**" panel)
    ![NGB GUI](images/projects-16.png)

#### Dataset notes

Additionally to description, each dataset may have any count of notes - text pages attached to the dataset.
This pages are created as plain text notes, `Markdown` formatting is supported as well.
To create new notes or edit/remove existing ones user shall have the `write` access to the dataset.
Any user that has access to the dataset, can open and view such notes.

Notes management is organized via the menu in the "**Browser**" panel header, where user can select what page should be shown in the panel until any position from the reference will be opened.
To create a new note page - click that menu and select the **Add note** item from the list:
    ![NGB GUI](images/projects-30.png)

A new form will appear in the "**Browser**" panel that contains:

- text field to specify a note title
- text field to specify a note content (description)
- buttons to save/cancel note creation
    ![NGB GUI](images/projects-31.png)

User should specify a title for a note (_mandatory_), content (_optional_) and click the **SAVE** button to create a new note, e.g.:
    ![NGB GUI](images/projects-32.png)

After, the just-created notes page will appear in the browser:

- note title is shown in the header of the "**Browser**" panel
- note content is shown in the "**Browser**" panel, `Markdown` formatting is applied
- additionally, button to edit the note is shown
    ![NGB GUI](images/projects-33.png)

Created notes pages are displayed and can be selected from the notes management section in the "**Browser**" display menu, e.g.:
    ![NGB GUI](images/projects-34.png)

If user opens a note and then clicks the **Edit** button for it, a form similar to the note creation one will be opened, where user has the ability:

- to edit a note title
- to edit a note content
- to save/cancel changes
- to remove the note
    ![NGB GUI](images/projects-35.png)

#### Change view

You may select the view as you wish. For that, use the selector in the "**Browser**" panel header:
    ![NGB GUI](images/projects-17.png)

**_Note_**: this selector is visible only if the dataset has an own description file.

### Metadata

NGB allows to attach text key-value metadata to datasets and files.
This can be used:

- to create specific tags/labels to datasets or files
- to find datasets and files by their metadata values
- to display tags as dataset/file details (in a tooltip or the summary page)

To manage metadata for a dataset/file - right-click the desired object in the **Datasets** panel and select the "_Edit attributes item_" in the context menu:
    ![NGB GUI](images/projects-23.png)

The pop-up will appear, where user can add/edit/remove attributes for the selected dataset/file.
By default, any dataset/file has no attributes:
    ![NGB GUI](images/projects-24.png)

Click the **Add** button to create a new attribute. A new pair of text fields will appear - for a key and a value of the attribute being created:
    ![NGB GUI](images/projects-25.png)

Then:

- specify a key and a value for a new attribute
- you can click the **Add** button again to add another attribute
- you can click the cross-button near the _Value_ field to remove the certain attribute

After all changes, click the **Save** button, e.g.:
    ![NGB GUI](images/projects-26.png)

**_Notes_**:

- there is no ability to save attributes if any of them has empty key or value
- there is no ability to save several attributes for a single dataset/file with the same key (case-insensitive)

Saved attributes can be viewed:

- in a tooltip when hovering over the object:
    ![NGB GUI](images/projects-27.png)
- in the **Summary** page of the dataset:
    ![NGB GUI](images/projects-28.png)

Search in the dataset panel supports the search by attributes (_only by values_) as well.
If a file/dataset is found by its attribute - near it, the label(s) of the corresponding attribute(s) appear with the selected match, e.g.:
    ![NGB GUI](images/projects-29.png)

### Download original files

You can download an original file from the files tree in the **Datasets** panel - use the context menu by the right-click on the desired file:
  ![NGB GUI](images/projects-21.png)

You can download files related to a dataset and invisible in the files tree (reference and annotation files) in the **Datasets** panel - use the context menu by the right-click on the dataset itself:
  ![NGB GUI](images/projects-22.png)

## Viewing tracks

Some simple ways you can view the loaded tracks as follows:

- Click a chromosome's bar in the chart at the **Summary** view to open the whole chromosome scale in the "**Browser**" panel:
    ![NGB GUI](images/projects-3.png)
    ![NGB GUI](images/projects-4.png)
- Use [**unified coordinates and search control**](tracks.md#using-unified-coordinates-and-search-control) in the header of the "**Browser**" panel to open a specific position or a feature (it can be found by the feature name):
    ![NGB GUI](images/projects-18.png)
- Click a variation in the "**Variants**" panel to open this variation (load the variation's position) at the VCF track in the "**Browser**" panel:
    ![NGB GUI](images/projects-19.png)
- Click a feature in the "**Genes**" panel to open this feature (load the feature's position) at the GENE track in the "**Browser**" panel:
    ![NGB GUI](images/projects-20.png)

Tick or untick a track in the **Datasets** panel to toggle its visibility in the "**Browser**" panel.

Each track has the following parts:

- the **header** that contains the track's type, name and optionally track's menu and actions
- the **content** of the track
    ![NGB GUI](images/projects-5.png)


text:
/**
 * Basic assertions
 * @module base
 */

var log = require("./log");
var to_string = require("./to_string").to_string;
var _ = require("lodash");

var exc_hook = null;

/**
 * set the callback function that will be executed if checking failed
 * @param  {hook} callback function
 * @return {any}  previous hook
 */
exports.set_exception_hook = function(hook) {
  var prev = exc_hook;
  exc_hook = hook;
  return prev;
};

/**
 * validate the condition and throw exception if failed
 * @param  {any} condition an expression
 * @param  {string} category  the category for this check
 * @return {any}           the evaluation result of the condition expression if succeed
 */
exports.check = function(condition, category) {
  if (condition) {
    return condition;
  }

  var args = _.toArray(arguments).slice(2);
  var msg = "", type;

  for (var i = 0; i < args.length; i++) {
    var a = args[i];
    if (typeof a === "string" && _.startsWith(a, "__HOPE_ERROR__")) {
      type = a;
    }
    else {
      if (msg.length > 0) {
        msg += " ";
      }
      msg += to_string(a);
    }
  }

  log.raw("error", 1, category, "<< CHECK >>", args);

  var e = new Error("[CHECK FAIL] " + msg);
  e.$check = true;

  if (exc_hook !== null) {
    exc_hook(e, category, msg, type);
  }
  throw e;
};

/**
 * validate the condition and report an warning only (not throw exception)
 * @param  {any} condition an expression
 * @param  {string} category  the category for this check
 * @return {any}           the evaluation result of the condition expression if succeed
 */
exports.check_warn = function(condition, category) {
  if (condition) {
    return condition;
  }
  var args = _.toArray(arguments);
  args.shift();
  args.shift();

  log.raw("warn", 1, category, "<< CHECK WARN >>", args);

  return condition;
};

/**
 * validate the condition and EXIT if failed
 * @param  {any} condition an expression
 * @param  {string} category  the category for this check
 * @return {any}           the evaluation result of the condition expression if succeed
 */
exports.assert = function(condition, category) {
  if (condition) {
    return condition;
  }
  var args = _.toArray(arguments);
  args.shift();
  args.shift();

  log.raw("error", 1, category, "<< CHECK >>", args);

  process.exit(1);
};


text:
@class NSData, UIImage, UIImagePickerController;

@protocol ImagePreviewDelegate <NSObject>

@optional
- (void)downloadFailInImagePreview;
- (void)returnFromImagePreview:(_Bool)arg1 andPicker:(UIImagePickerController *)arg2 andImage:(UIImage *)arg3;
- (void)selectFromImagePreview:(UIImagePickerController *)arg1 andImage:(UIImage *)arg2 andData:(NSData *)arg3;
@end


text:
using std::vector;

#include "supersonic/base/infrastructure/tuple_schema.h"
#include "supersonic/base/infrastructure/types_infrastructure.h"
#include "supersonic/base/infrastructure/variant_pointer.h"
#include "supersonic/proto/supersonic.pb.h"
#include "supersonic/testing/comparable_tuple_schema.h"
#include "supersonic/utils/strings/stringpiece.h"

namespace supersonic {

ComparableView::ComparableView(const View& view)
    : view_(view),
      view_printer_() {}

ComparableView::ComparableView(
    const View& view,
    bool include_header_in_representation,
    bool include_rows_in_representation)
    : view_(view),
      view_printer_(include_header_in_representation,
                    include_rows_in_representation) {}

void ComparableView::AppendToStream(std::ostream *s) const {
  view_printer_.AppendViewToStream(view_, s);
}

void ComparableView::AppendRowToStream(size_t row_id, std::ostream* s) const {
  view_printer_.AppendRowToStream(view_, row_id, s);
}

testing::AssertionResult ComparableView::operator==(
    const ComparableView& other) const {
  // Compare schemas.
  const testing::AssertionResult schemas_equal =
      ComparableTupleSchema(view_.schema())
          .Compare(ComparableTupleSchema(other.view_.schema()));
  if (!schemas_equal) {
    return testing::AssertionFailure()
        << "schema mismatch: " << schemas_equal.message();
  }

  // Compare row counts.
  if (view_.row_count() != other.view_.row_count()) {
    return testing::AssertionFailure()
        << "row count mismatch: "
        << view_.row_count() << " vs " << other.view_.row_count();
  }

  // Pairwise compare rows.
  vector<EqualityComparator> column_comparators;
  for (size_t c = 0; c < view_.schema().attribute_count(); c++) {
    column_comparators.push_back(
        GetEqualsComparator(
            view_.column(c).type_info().type(),
            other.view_.column(c).type_info().type(),
            false, false));
  }

  for (size_t row_id = 0; row_id < view_.row_count(); row_id++) {
    for (size_t c = 0; c < view_.schema().attribute_count(); c++) {
      const Column& my_column = view_.column(c);
      const Column& other_column = other.view_.column(c);
      VariantConstPointer value = my_column.is_null() != NULL &&
                                  my_column.is_null()[row_id]
          ? NULL
          : my_column.data_plus_offset(row_id);
      VariantConstPointer other_value = other_column.is_null() != NULL &&
                                        other_column.is_null()[row_id]
          ? NULL
          : other_column.data_plus_offset(row_id);
      if (!column_comparators[c](value, other_value)) {
        // We want NaN values for doubles to compare to true in testing
        // (while we still want the standard NaN =/= NaN in production code).
        if (my_column.type_info().type() == DOUBLE &&
            isnan(*value.as<DOUBLE>()) && isnan(*value.as<DOUBLE>()))
          continue;
        if (my_column.type_info().type() == FLOAT &&
            isnan(*value.as<FLOAT>()) && isnan(*value.as<FLOAT>()))
          continue;
        return testing::AssertionFailure()
            << "value mismatch in row " << row_id << ", column " << c;
      }
    }
  }

  return testing::AssertionSuccess();
}

testing::AssertionResult ViewsEqual(
    const char* a_str, const char* b_str,
    const View& a, const View& b) {
  ComparableView a_comparable(a);
  ComparableView b_comparable(b);
  testing::AssertionResult result = (a_comparable == b_comparable);
  if (!result) {
    result
        << "\nin ViewsEqual(" << a_str << ", " << b_str << ")\n"
        << "\n" << a_str << " = " << a_comparable
        << "\n" << b_str << " = " << b_comparable;
  }
  return result;
}

testing::AssertionResult RawDataEqual(const void* a, const void* b) {
  if (a != b) {
    return testing::AssertionFailure()
        << "The data is in different places in the two columns: "
        << a << " vs. " << b;
  }
  return testing::AssertionSuccess();
}

testing::AssertionResult DecorateForColumnsEqual(
    testing::AssertionResult result,
    const ComparableView& a, const ComparableView& b, rowcount_t c,
    const char* a_str, const char* b_str, const char* c_str) {
  result
      << "\nin ColumnsEqual(" << a_str << ", " << b_str << ", "
      << c_str << ")\n"
      << "\n" << a_str << " = " << a
      << "\n" << b_str << " = " << b
      << "\n" << c_str << " = " << c;
  return result;
}

testing::AssertionResult ColumnsEqual(
    const char* a_str, const char* b_str, const char* c_str,
    const Column& a, const Column& b, rowcount_t c) {
  ComparableView a_comparable(View(a, c));
  ComparableView b_comparable(View(b, c));
  testing::AssertionResult result = (a_comparable == b_comparable);
  if (!result)
    return DecorateForColumnsEqual(result, a_comparable, b_comparable, c,
                                   a_str, b_str, c_str);
  testing::AssertionResult data_result
      = RawDataEqual(a.data().raw(), b.data().raw());
  if (!data_result)
    return DecorateForColumnsEqual(data_result, a_comparable, b_comparable, c,
                                   a_str, b_str, c_str);
  return testing::AssertionSuccess();
}

bool VariableSizeColumnIsACopy(const Column& original,
                               const Column& copy,
                               size_t row_count) {
  const StringPiece* original_sp = original.typed_data<STRING>();
  const StringPiece* copy_sp = copy.typed_data<STRING>();
  for (size_t i = 0; i < row_count; i++) {
    const bool is_copy = (*original_sp == *copy_sp) &&
                         (original_sp->data() != copy_sp->data());
    if (!is_copy)
      return false;
  }
  return true;
}

}  // namespace supersonic


text:
from django.contrib import admin
from .models import Video

admin.site.register(Video)


text:
<?php

namespace SaintSystems\OData\Query\Tests;

use PHPUnit\Framework\TestCase;

use Illuminate\Support\Collection;
use SaintSystems\OData\ODataClient;
use SaintSystems\OData\QueryOptions;
use SaintSystems\OData\Query\Builder;
use SaintSystems\OData\Exception\ODataQueryException;

class BuilderTest extends TestCase
{
    protected $baseUrl;
    protected $client;

    public function setUp(): void
    {
        $this->baseUrl = 'https://services.odata.org/V4/TripPinService';
        $this->client = new ODataClient($this->baseUrl);
    }

    public function getBuilder()
    {
        return new Builder(
            $this->client, $this->client->getQueryGrammar(), $this->client->getPostProcessor()
        );
    }

    public function testConstructor()
    {
        $builder = $this->getBuilder();

        $this->assertNotNull($builder);
    }

    public function testEntitySet()
    {
        $builder = $this->getBuilder();

        $entitySet = 'People';

        $builder->from($entitySet);

        $expected = $entitySet;
        $actual = $builder->entitySet;

        $this->assertEquals($expected, $actual);

        $request = $builder->toRequest();
        $this->assertEquals($expected, $request);
    }

    public function testNoEntitySetFind()
    {
        $this->expectException(ODataQueryException::class);

        $builder = $this->getBuilder();
        $builder->find('russellwhyte');
    }

    public function testEntitySetFindStringKey()
    {
        $builder = $this->getBuilder();

        $entitySet = 'People';

        $builder->from($entitySet);

        $builder->whereKey('russellwhyte');

        $expected = $entitySet.'(\'russellwhyte\')';
        $actual = $builder->toRequest();

        $this->assertEquals($expected, $actual);
    }

    public function testEntitySetFindNumericKey()
    {
        $builder = $this->getBuilder();

        $entitySet = 'EntitySet';

        $builder->from($entitySet);

        $builder->whereKey(12345);

        $expected = $entitySet.'(12345)';
        $actual = $builder->toRequest();

        $this->assertEquals($expected, $actual);
    }

    public function testEntitySetWithSelect()
    {
        $builder = $this->getBuilder();

        $entitySet = 'People';

        $builder->select('FirstName','LastName')->from($entitySet);

        $expected = $entitySet.'?$select=FirstName,LastName';

        $request = $builder->toRequest();

        $this->assertEquals($expected, $request);
    }

    public function testEntitySetCount()
    {
        $builder = $this->getBuilder();

        $entitySet = 'People';

        //$expected = 55;

        $actual = $builder->from($entitySet)->count();

        $this->assertTrue(is_numeric($actual));
        $this->assertTrue($actual > 0);
        //$this->assertEquals($expected, $actual);
    }

    // public function testEntitySetCountWithWhere()
    // {
    //     $builder = $this->getBuilder();

    //     $entitySet = 'People';

    //     $expected = 1;

    //     $actual = $builder->from($entitySet)->where('FirstName','Russell')->get(QueryOptions::INCLUDE_REF | QueryOptions::INCLUDE_COUNT);

    //     $this->assertTrue(is_numeric($actual));
    //     $this->assertTrue($actual > 0);
    //     $this->assertEquals($expected, $actual);
    // }

    public function testEntitySetGet()
    {
        $builder = $this->getBuilder();

        $entitySet = 'People';

        $people = $builder->from($entitySet)->get();

        // dd($people);
        $this->assertTrue(is_array($people->toArray()));
        //$this->assertInstanceOf(Collection::class, $people);
        //$this->assertEquals($expected, $request);
    }

    public function testEntitySetGetWhere()
    {
        $builder = $this->getBuilder();

        $entitySet = 'People';

        $people = $builder->from($entitySet)->where('FirstName','Russell')->get();

        // dd($people);
        $this->assertTrue(is_array($people->toArray()));
        $this->assertTrue($people->count() == 1);
        //$this->assertInstanceOf(Collection::class, $people);
        //$this->assertEquals($expected, $request);
    }

    public function testEntitySetGetWhereOrWhere()
    {
        $builder = $this->getBuilder();

        $entitySet = 'People';

        $people = $builder->from($entitySet)->where('FirstName','Russell')->orWhere('LastName','Ketchum')->get();

        //dd($people);
        $this->assertTrue(is_array($people->toArray()));
        $this->assertTrue($people->count() == 2);
        //$this->assertInstanceOf(Collection::class, $people);
        //$this->assertEquals($expected, $request);
    }

    public function testEntitySetGetWhereNested()
    {
        $builder = $this->getBuilder();

        $entitySet = 'People';

        $people = $builder->from($entitySet)->where('FirstName','Russell')->orWhere(function($query) {
            $query->where('LastName','Ketchum')
                  ->where('FirstName','Scott');
        })->get();

        //dd($people);
        $this->assertTrue(is_array($people->toArray()));
        $this->assertTrue($people->count() == 2);
        //$this->assertInstanceOf(Collection::class, $people);
        //$this->assertEquals($expected, $request);
    }

    public function testEntityKeyString()
    {
        $builder = $this->getBuilder();

        $entityId = 'russellwhyte';

        $builder->whereKey($entityId);

        $expected = $entityId;
        $actual = $builder->entityKey;

        $this->assertEquals($expected, $actual);

        $expectedUri = "('$entityId')";
        $actualUri = $builder->toRequest();

        $this->assertEquals($expectedUri, $actualUri);
    }

    public function testEntityKeyNumeric()
    {
        $builder = $this->getBuilder();

        $entityId = 1;

        $builder->whereKey($entityId);

        $expected = $entityId;
        $actual = $builder->entityKey;

        $this->assertEquals($expected, $actual);

        $expectedUri = "($entityId)";
        $actualUri = $builder->toRequest();

        $this->assertEquals($expectedUri, $actualUri);
    }

    public function testEntityKeyUuid()
    {
        $builder = $this->getBuilder();

        $entityId = 'c78ae94b-0983-e511-80e5-3863bb35ddb8';

        $builder->whereKey($entityId);

        $expected = $entityId;
        $actual = $builder->entityKey;

        $this->assertEquals($expected, $actual);

        $expectedUri = "($entityId)";
        $actualUri = $builder->toRequest();

        $this->assertEquals($expectedUri, $actualUri);
    }

    public function testEntityKeyUuidNegative()
    {
        $builder = $this->getBuilder();

        $entityId = 'k78ae94b-0983-t511-80e5-3863bb35ddb8';

        $builder->whereKey($entityId);

        $expected = $entityId;
        $actual = $builder->entityKey;

        $this->assertEquals($expected, $actual);

        $expectedUri = "('$entityId')";
        $actualUri = $builder->toRequest();

        $this->assertEquals($expectedUri, $actualUri);
    }

    public function testEntityKeyComposite()
    {
        $builder = $this->getBuilder();

        $compositeKey = [
            'Property1' => 'Value1',
            'Property2' => 'Value2',
        ];

        $builder->whereKey($compositeKey);

        $expectedUri = "(Property1='Value1',Property2='Value2')";
        $actualUri = $builder->toRequest();

        $this->assertEquals($expectedUri, $actualUri);
    }

    public function testTake()
    {
        $builder = $this->getBuilder();

        $take = 1;

        $builder->take($take);

        $expected = $take;
        $actual = $builder->take;

        $this->assertEquals($expected, $actual);
    }

    public function testSkip()
    {
        $builder = $this->getBuilder();

        $skip = 5;

        $builder->skip($skip);

        $expected = $skip;
        $actual = $builder->skip;

        $this->assertEquals($expected, $actual);
    }

    public function testOrderColumnOnly()
    {
        $builder = $this->getBuilder();

        $builder->order('Name'); // default asc

        $expectedUri = '$orderby=Name asc';
        $actualUri = $builder->toRequest();

        $this->assertEquals($expectedUri, $actualUri);
    }

    public function testOrderWithDirection()
    {
        $builder = $this->getBuilder();

        $builder->order('Name', 'desc');

        $expectedUri = '$orderby=Name desc';
        $actualUri = $builder->toRequest();

        $this->assertEquals($expectedUri, $actualUri);
    }

    public function testOrderWithShortArray()
    {
        $builder = $this->getBuilder();

        $builder->order(['Name', 'desc']);

        $expectedUri = '$orderby=Name desc';
        $actualUri = $builder->toRequest();

        $this->assertEquals($expectedUri, $actualUri);
    }

    public function testOrderWithMultipleShortArray()
    {
        $builder = $this->getBuilder();

        $builder->order(['Id', 'asc'], ['Name', 'desc']);

        $expectedUri = '$orderby=Id asc,Name desc';
        $actualUri = $builder->toRequest();

        $this->assertEquals($expectedUri, $actualUri);
    }

    public function testOrderWithMultipleNestedShortArray()
    {
        $builder = $this->getBuilder();

        $builder->order(array(['Id', 'asc'], ['Name', 'desc']));

        $expectedUri = '$orderby=Id asc,Name desc';
        $actualUri = $builder->toRequest();

        $this->assertEquals($expectedUri, $actualUri);
    }

    public function testOrderWithArray()
    {
        $builder = $this->getBuilder();

        $builder->order(['column' => 'Name', 'direction' => 'desc']);

        $expectedUri = '$orderby=Name desc';
        $actualUri = $builder->toRequest();

        $this->assertEquals($expectedUri, $actualUri);
    }

    public function testOrderWithMultipleArray()
    {
        $builder = $this->getBuilder();

        $builder->order(['column' => 'Id', 'direction' => 'asc'], ['column' => 'Name', 'direction' => 'desc']);

        $expectedUri = '$orderby=Id asc,Name desc';
        $actualUri = $builder->toRequest();

        $this->assertEquals($expectedUri, $actualUri);
    }

    public function testOrderWithMultipleNestedArray()
    {
        $builder = $this->getBuilder();

        $builder->order(array(['column' => 'Id', 'direction' => 'asc'], ['column' => 'Name', 'direction' => 'desc']));

        $expectedUri = '$orderby=Id asc,Name desc';
        $actualUri = $builder->toRequest();

        $this->assertEquals($expectedUri, $actualUri);
    }

    public function testMultipleChainedQueryParams()
    {
        $builder = $this->getBuilder();

        $entitySet = 'People';

        $builder->from($entitySet)
                ->select('Name,Gender')
                ->where('Gender', '=', 'Female')
                ->order('Name', 'desc')
                ->take(5);

        $expectedUri = 'People?$select=Name,Gender&$filter=Gender eq \'Female\'&$orderby=Name desc&$top=5';
        $actualUri = $builder->toRequest();

        $this->assertEquals($expectedUri, $actualUri);
    }

    public function testEntityWithWhereEnum()
    {
        $builder = $this->getBuilder();

        $entitySet = 'People';
        $whereEnum = 'Microsoft.OData.Service.Sample.TrippinInMemory.Models.PersonGender\'Female\'';

        $builder->from($entitySet)
                ->where('Gender', '=', $whereEnum);

        $expectedUri = 'People?$filter=Gender eq Microsoft.OData.Service.Sample.TrippinInMemory.Models.PersonGender\'Female\'';
        $actualUri = $builder->toRequest();

        $this->assertEquals($expectedUri, $actualUri);
    }

    public function testEntityWithSingleExpand()
    {
        $builder = $this->getBuilder();

        $entitySet = 'People';
        $expand = 'PersonGender';

        $builder->from($entitySet)
                ->expand($expand);

        $expectedUri = 'People?$expand=PersonGender';
        $actualUri = $builder->toRequest();

        $this->assertEquals($expectedUri, $actualUri);
    }

    public function testEntityWithMultipleExpand()
    {
        $builder = $this->getBuilder();

        $entitySet = 'People';
        $expands = ['PersonGender', 'PersonOccupation'];

        $builder->from($entitySet)
                ->expand($expands);

        $expectedUri = 'People?$expand=PersonGender,PersonOccupation';
        $actualUri = $builder->toRequest();

        $this->assertEquals($expectedUri, $actualUri);
    }

    public function testEntityWithWhereColumn()
    {
        $builder = $this->getBuilder();

        $entitySet = 'People';

        $builder->from($entitySet)
                ->whereColumn('FirstName', 'LastName');

        $expectedUri = 'People?$filter=FirstName eq LastName';
        $actualUri = $builder->toRequest();

        $this->assertEquals($expectedUri, $actualUri);
    }

    public function testEntityWithOrWhereColumnO()
    {
        $builder = $this->getBuilder();

        $entitySet = 'People';

        $builder->from($entitySet)
                ->where('FirstName', '=', 'Russell')
                ->orWhereColumn('FirstName', 'LastName');

        $expectedUri = 'People?$filter=FirstName eq \'Russell\' or FirstName eq LastName';
        $actualUri = $builder->toRequest();

        $this->assertEquals($expectedUri, $actualUri);
    }

    public function testEntityWithWhereNull()
    {
        $builder = $this->getBuilder();

        $entitySet = 'People';

        $builder->from($entitySet)
                ->whereNull('FirstName');

        $expectedUri = 'People?$filter=FirstName eq null';
        $actualUri = $builder->toRequest();

        $this->assertEquals($expectedUri, $actualUri);
    }

    public function testEntityWithWhereNotNull()
    {
        $builder = $this->getBuilder();

        $entitySet = 'People';

        $builder->from($entitySet)
                ->whereNotNull('FirstName');

        $expectedUri = 'People?$filter=FirstName ne null';
        $actualUri = $builder->toRequest();

        $this->assertEquals($expectedUri, $actualUri);
    }

    public function testEntityWhereString()
    {
        $builder = $this->getBuilder();

        $entitySet = 'People';

        $builder->from($entitySet)
                ->where('FirstName', 'Russell');

        $expectedUri = 'People?$filter=FirstName eq \'Russell\'';
        $actualUri = $builder->toRequest();

        $this->assertEquals($expectedUri, $actualUri);
    }

    public function testEntityWhereNumeric()
    {
        $builder = $this->getBuilder();

        $entitySet = 'Photos';

        $builder->from($entitySet)
                ->where('Id', 1);

        $expectedUri = 'Photos?$filter=Id eq 1';
        $actualUri = $builder->toRequest();

        $this->assertEquals($expectedUri, $actualUri);
    }

    public function testEntityMultipleWheres()
    {
        $builder = $this->getBuilder();

        $entitySet = 'People';

        $builder->from($entitySet)
            ->where('FirstName', 'Russell')
            ->where('LastName', 'Whyte');

        $expectedUri = 'People?$filter=FirstName eq \'Russell\' and LastName eq \'Whyte\'';
        $actualUri = $builder->toRequest();

        $this->assertEquals($expectedUri, $actualUri);
    }

    public function testEntityMultipleWheresArray()
    {
        $builder = $this->getBuilder();

        $entitySet = 'People';

        $builder->from($entitySet)
            ->where([
                ['FirstName', 'Russell'],
                ['LastName', 'Whyte'],
            ]);

        $expectedUri = 'People?$filter=(FirstName eq \'Russell\' and LastName eq \'Whyte\')';
        $actualUri = $builder->toRequest();

        $this->assertEquals($expectedUri, $actualUri);
    }

    public function testEntityMultipleWheresArrayWithSelect()
    {
        $builder = $this->getBuilder();

        $entitySet = 'People';

        $builder->from($entitySet)
            ->select('Name')
            ->where([
                ['FirstName', 'Russell'],
                ['LastName', 'Whyte'],
            ]);

        $expectedUri = 'People?$select=Name&$filter=(FirstName eq \'Russell\' and LastName eq \'Whyte\')';
        $actualUri = $builder->toRequest();

        $this->assertEquals($expectedUri, $actualUri);
    }

    public function testEntityMultipleWheresNested()
    {
        $builder = $this->getBuilder();

        $entitySet = 'People';

        $builder->from($entitySet)
            ->where(function($query) {
                $query->where('FirstName','Russell');
                $query->where('LastName','Whyte');
            });

        $expectedUri = 'People?$filter=(FirstName eq \'Russell\' and LastName eq \'Whyte\')';
        $actualUri = $builder->toRequest();

        $this->assertEquals($expectedUri, $actualUri);
    }

    public function testEntityMultipleWheresNestedWithSelect()
    {
        $builder = $this->getBuilder();

        $entitySet = 'People';

        $builder->from($entitySet)
            ->select('Name')
            ->where(function($query) {
                $query->where('FirstName','Russell');
                $query->where('LastName','Whyte');
            });

        $expectedUri = 'People?$select=Name&$filter=(FirstName eq \'Russell\' and LastName eq \'Whyte\')';
        $actualUri = $builder->toRequest();

        $this->assertEquals($expectedUri, $actualUri);
    }

}


text:
@implementation NSString (CGTool)

#pragma mark -- 去除空格
-(NSString *)trim{
    return [self stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]];
}

#pragma mark - md5
-(NSString *)md5{
    if(self == nil || [self length] == 0) return nil;
    //
    const char *val = [self UTF8String];
    unsigned char outputBuf[CC_MD5_DIGEST_LENGTH];
    CC_MD5(val, (unsigned)strlen(val), outputBuf);
    //
    NSMutableString *outputStr = [[NSMutableString alloc] initWithCapacity:(CC_MD5_DIGEST_LENGTH * 2)];
    for(NSUInteger count = 0; count < CC_MD5_DIGEST_LENGTH; count++){
        [outputStr appendFormat:@"%02x", outputBuf[count]];
    }
    return outputStr;
}

@end


text:
"""
A series of tests to establish that the command-line bash completion works.
"""
import os
import sys
import unittest

from django.apps import apps
from django.core.management import ManagementUtility
from django.utils.six import StringIO

class BashCompletionTests(unittest.TestCase):
    """
    Testing the Python level bash completion code.
    This requires setting up the environment as if we got passed data
    from bash.
    """

    def setUp(self):
        self.old_DJANGO_AUTO_COMPLETE = os.environ.get('DJANGO_AUTO_COMPLETE')
        os.environ['DJANGO_AUTO_COMPLETE'] = '1'
        self.output = StringIO()
        self.old_stdout = sys.stdout
        sys.stdout = self.output

    def tearDown(self):
        sys.stdout = self.old_stdout
        if self.old_DJANGO_AUTO_COMPLETE:
            os.environ['DJANGO_AUTO_COMPLETE'] = self.old_DJANGO_AUTO_COMPLETE
        else:
            del os.environ['DJANGO_AUTO_COMPLETE']

    def _user_input(self, input_str):
        os.environ['COMP_WORDS'] = input_str
        os.environ['COMP_CWORD'] = str(len(input_str.split()) - 1)
        sys.argv = input_str.split(' ')

    def _run_autocomplete(self):
        util = ManagementUtility(argv=sys.argv)
        try:
            util.autocomplete()
        except SystemExit:
            pass
        return self.output.getvalue().strip().split('\n')

    def test_django_admin_py(self):
        "django_admin.py will autocomplete option flags"
        self._user_input('django-admin.py sqlall --v')
        output = self._run_autocomplete()
        self.assertEqual(output, ['--verbosity='])

    def test_manage_py(self):
        "manage.py will autocomplete option flags"
        self._user_input('manage.py sqlall --v')
        output = self._run_autocomplete()
        self.assertEqual(output, ['--verbosity='])

    def test_custom_command(self):
        "A custom command can autocomplete option flags"
        self._user_input('django-admin.py test_command --l')
        output = self._run_autocomplete()
        self.assertEqual(output, ['--list'])

    def test_subcommands(self):
        "Subcommands can be autocompleted"
        self._user_input('django-admin.py sql')
        output = self._run_autocomplete()
        self.assertEqual(output, ['sql sqlall sqlclear sqlcustom sqldropindexes sqlflush sqlindexes sqlmigrate sqlsequencereset'])

    def test_help(self):
        "No errors, just an empty list if there are no autocomplete options"
        self._user_input('django-admin.py help --')
        output = self._run_autocomplete()
        self.assertEqual(output, [''])

    def test_runfcgi(self):
        "Command arguments will be autocompleted"
        self._user_input('django-admin.py runfcgi h')
        output = self._run_autocomplete()
        self.assertEqual(output, ['host='])

    def test_app_completion(self):
        "Application names will be autocompleted for an AppCommand"
        self._user_input('django-admin.py sqlall a')
        output = self._run_autocomplete()
        a_labels = sorted(app_config.label
            for app_config in apps.get_app_configs()
            if app_config.label.startswith('a'))
        self.assertEqual(output, a_labels)


text:
int main(int argc, const char** argv) {
  blimp::engine::BlimpContentMainDelegate delegate;
  content::ContentMainParams params(&delegate);
  params.argc = argc;
  params.argv = argv;
  return content::ContentMain(params);
}


text:
@interface AddDropClassActionViewController ()

@property (weak, nonatomic) IBOutlet UIActivityIndicatorView *spinner;
@property (weak, nonatomic) IBOutlet UIView *formView;
@property (weak, nonatomic) IBOutlet UIBarButtonItem *cancelButton;

@end

@implementation AddDropClassActionViewController

-(void)viewDidLoad {
    [super viewDidLoad];
    self.state = AddDropClassActionViewControllerStateGettingUserInput;

    //If the form view is a UIScrollView, make it automatically dismiss the keyboard when scrolling begins
    if ([self.formView isKindOfClass:UIScrollView.class]) {
        ((UIScrollView *) self.formView).keyboardDismissMode = UIScrollViewKeyboardDismissModeOnDrag;
    }
}

-(void)setState:(AddDropClassActionViewControllerState)state {
    _state = state;
    switch (state) {
        case AddDropClassActionViewControllerStateGettingUserInput:
            [self.spinner stopAnimating];
            self.statusLabel.hidden = YES;
            self.formView.hidden = NO;
            self.cancelButton.enabled = YES;
            break;

        case AddDropClassActionViewControllerStateGotUserInput:
            [self.spinner startAnimating];
            self.statusLabel.hidden = NO;
            self.formView.hidden = YES;
            self.cancelButton.enabled = YES;
            self.state = AddDropClassActionViewControllerStatePerformingAction;
            [self performAction];
            break;

        case AddDropClassActionViewControllerStatePerformingAction:
            [self.spinner startAnimating];
            self.statusLabel.hidden = NO;
            self.formView.hidden = YES;
            self.cancelButton.enabled = YES;
            break;

        case AddDropClassActionViewControllerStateActionCanceled:
            [self.spinner stopAnimating];
            self.statusLabel.hidden = YES;
            self.formView.hidden = YES;
            self.cancelButton.enabled = NO;
            [self.delegate actionCanceled:self];
            break;

        case AddDropClassActionViewControllerStateActionFailed:
            [self.spinner stopAnimating];
            [self showErrorMessagesFromServiceCall];
            self.statusLabel.text = self.errorText;
            self.statusLabel.hidden = NO;
            self.formView.hidden = YES;
            self.cancelButton.enabled = NO;
            break;

        case AddDropClassActionViewControllerStateActionSucceeded:
            [self.spinner stopAnimating];
            self.statusLabel.text = self.successText;
            self.statusLabel.hidden = NO;
            self.formView.hidden = YES;
            self.cancelButton.enabled = NO;
            [self.delegate actionSucceeded:self];
            break;

        default:
            break;
    }
}

-(void)showErrorMessagesFromServiceCall {
    [self showError:self.error withTitle:self.errorText andCallback:^(UIAlertAction *action) {
        [self.delegate actionFailed:self];
    }];
}

-(void)performAction {
    //implement in subclasses
}

-(IBAction)cancelButtonTapped:(id)sender {
    self.state = AddDropClassActionViewControllerStateActionCanceled;
}

@end


text:
package org.jbromo.model.jpa.testutil.builder.field;

import java.lang.reflect.Field;

import org.jbromo.common.RandomUtil;
import org.jbromo.common.invocation.AnnotationUtil;
import org.jbromo.model.jpa.util.EntityUtil;

/**
 * Define a string field builder.
 * @author qjafcunuas
 */
public class FieldShortBuilder extends AbstractFieldNumberBuilder<Short> {

    /**
     * Default constructor.
     * @param fieldBuilderFactory the field builder factory to used.
     */
    FieldShortBuilder(final FieldBuilderFactory fieldBuilderFactory) {
        super(fieldBuilderFactory);
    }

    @Override
    protected Short max(final Number value, final boolean valid) {
        if (valid) {
            return value.shortValue();
        } else {
            return (short) (value.shortValue() + 1);
        }
    }

    @Override
    protected Short min(final Number value, final boolean valid) {
        if (valid) {
            return value.shortValue();
        } else {
            return (short) (value.shortValue() - 1);
        }
    }

    @Override
    public Short nextRandom(final boolean nullable, final Field field) {
        final Long min = AnnotationUtil.getMin(field);
        final Long max = AnnotationUtil.getMin(field);
        final boolean returnNull = nullable && EntityUtil.isNullable(field);
        if (min == null && max == null) {
            return RandomUtil.nextShort(returnNull);
        } else if (min == null) {
            return RandomUtil.nextShort(returnNull, max.shortValue());
        } else if (max == null) {
            return RandomUtil.nextShort(returnNull, min.shortValue(), Short.MAX_VALUE);
        } else {
            return RandomUtil.nextShort(returnNull, min.shortValue(), max.shortValue());
        }
    }

}


text:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>

  <name>rkt launcher report</name>

  <parent>
    <groupId>io.honnix</groupId>
    <artifactId>rkt-launcher</artifactId>
    <version>0.0.9-SNAPSHOT</version>
  </parent>

  <artifactId>rkt-launcher-report</artifactId>
  <packaging>pom</packaging>

  <dependencies>
    <dependency>
      <groupId>${project.groupId}</groupId>
      <artifactId>rkt-launcher-common</artifactId>
    </dependency>
    <dependency>
      <groupId>${project.groupId}</groupId>
      <artifactId>rkt-launcher-core</artifactId>
    </dependency>
    <dependency>
      <groupId>${project.groupId}</groupId>
      <artifactId>rkt-launcher-service</artifactId>
    </dependency>
    <dependency>
      <groupId>${project.groupId}</groupId>
      <artifactId>rkt-launcher-remote</artifactId>
    </dependency>
  </dependencies>

  <build>
    <plugins>
      <plugin>
        <groupId>org.jacoco</groupId>
        <artifactId>jacoco-maven-plugin</artifactId>
        <executions>
          <execution>
            <id>report-aggregate</id>
            <phase>verify</phase>
            <goals>
              <goal>report-aggregate</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>
</project>


text:
import { assert } from '@ember/debug';
import { guidFor } from '@ember/object/internals';
import EmberOrderedSet from '@ember/ordered-set';

export default class EmberDataOrderedSet<T> extends EmberOrderedSet<T> {
  static create() {
    return new this();
  }

  addWithIndex(obj: T, idx?: number) {
    let guid = guidFor(obj);
    let presenceSet = this.presenceSet;
    let list = this.list;

    if (presenceSet[guid] === true) {
      return;
    }

    presenceSet[guid] = true;

    if (idx === undefined || idx === null) {
      list.push(obj);
    } else {
      list.splice(idx, 0, obj);
    }

    this.size += 1;

    return this;
  }

  deleteWithIndex(obj: T | null, idx?: number): boolean {
    let guid = guidFor(obj);
    let presenceSet = this.presenceSet;
    let list = this.list;

    if (presenceSet[guid] === true) {
      delete presenceSet[guid];

      assert('object is not present at specified index', idx === undefined || list[idx] === obj);

      let index = idx !== undefined ? idx : list.indexOf(obj);
      if (index > -1) {
        list.splice(index, 1);
      }
      this.size = list.length;
      return true;
    } else {
      return false;
    }
  }
}


text:
<?php
/**
 * Logiciel : exemple d'utilisation de HTML2PDF
 *
 * Convertisseur HTML => PDF
 * Distribué sous la licence LGPL.
 *
 * @author		Laurent MINGUET <webmaster@html2pdf.fr>
 *
 * setTestTdInOnePage : permet de desactiver le test sur la taille des TD afin qu'ils rentrent sur une seule page
 *
 * isset($_GET['vuehtml']) n'est pas obligatoire
 * il permet juste d'afficher le résultat au format HTML
 * si le paramètre 'vuehtml' est passé en paramètre _GET
 */
 	// récupération du contenu HTML
	ob_start();
 	include(dirname(__FILE__).'/res/exemple11.php');
	$content = ob_get_clean();

	// conversion HTML => PDF
	require_once(dirname(__FILE__).'/../html2pdf.class.php');
	try
	{
		$html2pdf = new HTML2PDF('P','A4','fr',  false, 'ISO-8859-15');
		$html2pdf->setTestTdInOnePage(false);
		$html2pdf->writeHTML($content, isset($_GET['vuehtml']));
		$html2pdf->Output('exemple11.pdf');
	}
	catch(HTML2PDF_exception $e) { echo $e; }


text:
package gitbot

import (
	"encoding/json"
	"fmt"
	"io/ioutil"
	"net/http"

	"github.com/aarondl/cinotify"
	"github.com/aarondl/gitio"
)

// Constants
const (
	Name      = "gitbot"
	CommitMsg = "[%s/%s] %s"
	NoMsg     = "No message"
	Unknown   = "Unknown"
)

func init() {
	cinotify.Register(Name, gitHandler{})
}

type shortener interface {
	Shorten(string) (string, error)
}
type shortenFunc func(string) (string, error)

func (s shortenFunc) Shorten(url string) (string, error) {
	return s(url)
}

var shortURL shortener = shortenFunc(gitio.Shorten)

// gitHandler implements cinotify.Handler
type gitHandler struct {
}

// Handle the event by returning a stringer, if nil the event was not parseable
// or otherwise understood
func (gitHandler) Handle(r *http.Request) fmt.Stringer {
	path := r.URL.Path == "/"
	method := r.Method == http.MethodPost
	contentType := r.Header.Get("Content-Type") == "application/json"
	xGithubEvent := len(r.Header.Get("X-GITHUB-EVENT")) > 0
	if !path || !method || !contentType || !xGithubEvent {
		return nil
	}

	var payload interface{}

	switch r.Header.Get("X-GITHUB-EVENT") {
	case "create": // Branch creation
		payload = &PayloadCreate{}
	case "push": //Triggered when a repository branch is pushed to.
		payload = &PushPayload{}
	case "commit_comment": // Triggered when a commit comment is created.
		payload = &PayloadCommitComment{}
	case "delete": //Represents a deleted branch or tag.
		payload = &PayloadDelete{}
	case "fork": //Triggered when a user forks a repository.
		payload = &PayloadFork{}
	case "gollum": //Triggered when a Wiki page is created or updated.
		payload = &PayloadGollum{}
	case "issue_comment": //Triggered when an issue comment is created.
		payload = &PayloadIssueComment{}
	case "issues": //Triggered when an issue is created, closed or reopened.
		payload = &PayloadIssues{}
	case "member": //Triggered when a user is added as a collaborator to a repository.
		payload = &PayloadMember{}
	case "pull_request": //Triggered when a pull request is created, closed, reopened or synchronized.
		payload = &PayloadPullRequest{}
	case "pull_request_review_comment": //Triggered when a comment is created on a portion of the unified diff of a pull request.
		return nil
	case "release": //Triggered when a release is published.
		payload = &PayloadRelease{}
	case "team_add": //Triggered when a user is added to a team or when a repository is added to a team.
		payload = &PayloadTeamAdd{}
	case "star":
		payload = &PayloadStar{}
	case "watch":
		// Watch doesn't make sense anymore, ignore it intentionally
		return nil
	default:
		cinotify.DoLogf("cinotify/gitbot/%s: unknown event", r.Header.Get("X-GITHUB-EVENT"))
		return nil
	}

	b, err := ioutil.ReadAll(r.Body)
	if err != nil {
		return nil
	}

	if err := json.Unmarshal(b, payload); err != nil {
		cinotify.DoLogf("cinotify/gitbot/%s: Failed to decode json payload: %v",
			r.Header.Get("X-GITHUB-EVENT"), err)

		return nil
	}

	if payload != nil {
		if stringer, ok := payload.(fmt.Stringer); ok {
			return stringer
		}
	}
	return nil
}


text:
int load_q(struct tcds *t, time_t tic_start) ;
int exec_q(struct tcds *t, time_t tic_start) ;
int add_to_el(struct tcds *t, struct event *el) ;