text:
/*
 *   This program is free software: you can redistribute it and/or modify
 *   it under the terms of the GNU General Public License as published by
 *   the Free Software Foundation, either version 3 of the License, or
 *   (at your option) any later version.
 *
 *   This program is distributed in the hope that it will be useful,
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *   GNU General Public License for more details.
 *
 *   You should have received a copy of the GNU General Public License
 *   along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

/*
 * DbUtils.java
 * Copyright (C) 2005-2012 University of Waikato, Hamilton, New Zealand
 *
 */

package weka.gui.sql;

import java.sql.Connection;

import weka.core.RevisionUtils;
import weka.experiment.DatabaseUtils;

/**
 * A little bit extended DatabaseUtils class.
 *
 * @see       DatabaseUtils
 * @see       #execute(String)
 * @author    FracPete (fracpete at waikato dot ac dot nz)
 * @version   $Revision: 8034 $
 */
public class DbUtils
  extends DatabaseUtils {

  /** for serialization. */
  private static final long serialVersionUID = 103748569037426479L;

  /**
   * initializes the object.
   *
   * @throws Exception      in case something goes wrong in the init of the
   *                        DatabaseUtils constructor
   * @see     DatabaseUtils
   */
  public DbUtils() throws Exception {
    super();
  }

  /**
   * returns the current database connection.
   *
   * @return        the current connection instance
   */
  public Connection getConnection() {
    return m_Connection;
  }

  /**
   * Returns the revision string.
   *
   * @return		the revision
   */
  public String getRevision() {
    return RevisionUtils.extract("$Revision: 8034 $");
  }
}


text:
package com.tremolosecurity.proxy.auth;

import java.io.IOException;
import java.util.HashMap;

import javax.servlet.ServletContext;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import com.tremolosecurity.config.util.UrlHolder;
import com.tremolosecurity.proxy.auth.util.AuthStep;
import com.tremolosecurity.proxy.util.ProxyConstants;
import com.tremolosecurity.saml.Attribute;

public class MappingAuthmech implements AuthMechanism {

	public void doDelete(HttpServletRequest request, HttpServletResponse response, AuthStep step)
			throws IOException, ServletException {
		this.doGet(request, response, step);

	}

	public void doGet(HttpServletRequest request, HttpServletResponse response, AuthStep step)
			throws IOException, ServletException {
		HttpSession session = ((HttpServletRequest) request).getSession();
		UrlHolder holder = (UrlHolder) request.getAttribute(ProxyConstants.AUTOIDM_CFG);
		if (holder == null) {
			throw new ServletException("Holder is null");
		}

		RequestHolder reqHolder = ((AuthController) session.getAttribute(ProxyConstants.AUTH_CTL)).getHolder();

		HashMap<String,Attribute> authParams = (HashMap<String,Attribute>) session.getAttribute(ProxyConstants.AUTH_MECH_PARAMS);

		Attribute map = authParams.get("map");
		for (String mapping : map.getValues()) {
			String newName = mapping.substring(0,mapping.indexOf('='));
			String oldName = mapping.substring(mapping.indexOf('=') + 1);

			AuthController ac = ((AuthController) request.getSession().getAttribute(ProxyConstants.AUTH_CTL));
			Attribute attr = ac.getAuthInfo().getAttribs().get(oldName);

			if (attr != null) {
				Attribute newAttr = new Attribute(newName);
				newAttr.getValues().addAll(attr.getValues());

				ac.getAuthInfo().getAttribs().remove(oldName);
				ac.getAuthInfo().getAttribs().put(newName, newAttr);
			}
		}

		step.setSuccess(true);
		holder.getConfig().getAuthManager().nextAuth(request, response,session,false);
	}

	public void doHead(HttpServletRequest request, HttpServletResponse response, AuthStep step)
			throws IOException, ServletException {
		this.doGet(request, response, step);

	}

	public void doOptions(HttpServletRequest request, HttpServletResponse response, AuthStep step)
			throws IOException, ServletException {
		this.doGet(request, response, step);

	}

	public void doPost(HttpServletRequest request, HttpServletResponse response, AuthStep step)
			throws IOException, ServletException {
		this.doGet(request, response, step);

	}

	public void doPut(HttpServletRequest request, HttpServletResponse response, AuthStep step)
			throws IOException, ServletException {
		this.doGet(request, response, step);

	}

	public String getFinalURL(HttpServletRequest request, HttpServletResponse response) {

		return null;
	}

	public void init(ServletContext context, HashMap<String, Attribute> config) {

	}

}

redpajama_set_name: RedPajamaGithub


text:
//
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.5-2
// See http://java.sun.com/xml/jaxb
// Any modifications to this file will be lost upon recompilation of the source schema.
// Generated on: 2013.11.14 at 09:56:36 PM GMT
//

package org.openprovenance.prov.xml;

import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlSeeAlso;
import javax.xml.bind.annotation.XmlType;
import org.apache.commons.lang.builder.EqualsBuilder;
import org.apache.commons.lang.builder.HashCodeBuilder;
import org.apache.commons.lang.builder.ToStringBuilder;
import org.openprovenance.prov.xml.builder.Equals;
import org.openprovenance.prov.xml.builder.HashCode;
import org.openprovenance.prov.xml.builder.ToString;
import org.openprovenance.prov.xml.builder.JAXBEqualsBuilder;
import org.openprovenance.prov.xml.builder.JAXBHashCodeBuilder;
import org.openprovenance.prov.xml.builder.JAXBToStringBuilder;

/**
 *
Java class for Dictionary complex type.
 *
 *
The following schema fragment specifies the expected content contained within this class.
 *
 *

 * <complexType name="Dictionary">
 *   <complexContent>
 *     <extension base="{http://www.w3.org/ns/prov#}Collection">
 *     </extension>
 *   </complexContent>
 * </complexType>
 *

 *
 *
 */
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "Dictionary")
@XmlSeeAlso({
    EmptyDictionary.class
})
public class Dictionary
    extends Collection
    implements Equals, HashCode, ToString
{

    public void equals(Object object, EqualsBuilder equalsBuilder) {
        if (!(object instanceof Dictionary)) {
            equalsBuilder.appendSuper(false);
            return ;
        }
        if (this == object) {
            return ;
        }
        super.equals(object, equalsBuilder);
    }

    public boolean equals(Object object) {
        if (!(object instanceof Dictionary)) {
            return false;
        }
        if (this == object) {
            return true;
        }
        final EqualsBuilder equalsBuilder = new JAXBEqualsBuilder();
        equals(object, equalsBuilder);
        return equalsBuilder.isEquals();
    }

    public void hashCode(HashCodeBuilder hashCodeBuilder) {
        super.hashCode(hashCodeBuilder);
    }

    public int hashCode() {
        final HashCodeBuilder hashCodeBuilder = new JAXBHashCodeBuilder();
        hashCode(hashCodeBuilder);
        return hashCodeBuilder.toHashCode();
    }

    public void toString(ToStringBuilder toStringBuilder) {
        super.toString(toStringBuilder);
    }

    public String toString() {
        final ToStringBuilder toStringBuilder = new JAXBToStringBuilder(this);
        toString(toStringBuilder);
        return toStringBuilder.toString();
    }

}


text:
<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/maven-v4_0_0.xsd">
	<modelVersion>4.0.0</modelVersion>
	<artifactId>java-core-web</artifactId>
	<name>Java Core Web</name>
	<packaging>jar</packaging>
	<description>Java Core Web</description>

	<parent>
		<groupId>com.justcloud.core</groupId>
		<artifactId>java-core</artifactId>
		<version>0.0.1-SNAPSHOT</version>
	</parent>

	<dependencies>
		<!-- Servlet -->
		<dependency>
			<groupId>org.springframework</groupId>
			<artifactId>spring-webmvc</artifactId>
			<version>${org.springframework-version}</version>
		</dependency>
		<dependency>
			<groupId>org.apache.geronimo.specs</groupId>
			<artifactId>geronimo-servlet_3.0_spec</artifactId>
			<version>1.0</version>
			<scope>provided</scope>
		</dependency>
		<dependency>
			<groupId>javax.servlet.jsp</groupId>
			<artifactId>jsp-api</artifactId>
			<version>2.1</version>
			<scope>provided</scope>
		</dependency>
		<dependency>
			<groupId>javax.servlet</groupId>
			<artifactId>jstl</artifactId>
			<version>1.2</version>
		</dependency>
		<dependency>
			<groupId>commons-fileupload</groupId>
			<artifactId>commons-fileupload</artifactId>
			<version>1.2.2</version>
		</dependency>

		<!-- Sitemesh -->
		<dependency>
			<groupId>opensymphony</groupId>
			<artifactId>sitemesh</artifactId>
			<version>2.4.2</version>
		</dependency>

		<!-- Freemarker -->
		<dependency>
			<groupId>org.freemarker</groupId>
			<artifactId>freemarker</artifactId>
			<version>2.3.18</version>
		</dependency>

		<!-- Oauth -->
		<dependency>
			<groupId>org.scribe</groupId>
			<artifactId>scribe</artifactId>
			<version>1.3.0</version>
		</dependency>
	</dependencies>

</project>


text:
'use strict';

window.smartRApp.directive('fetchButton', [
    '$rootScope',
    'rServeService',
    'smartRUtils',
    function($rootScope, rServeService, smartRUtils) {
        return {
            restrict: 'E',
            scope: {
                loaded: '=',
                running: '=',
                conceptMap: '=',
                biomarkers: '=?',
                showSummaryStats: '=?',
                summaryData: '=?',
                allSamples: '=?',
                subsets: '=?'
            },
            templateUrl: $rootScope.smartRPath +  '/js/smartR/_angular/templates/fetchButton.html',
            link: function(scope, element) {

                var template_btn = element.children()[0],
                    template_msg = element.children()[1];

                var _init = function () {
                    template_btn.disabled = true;
                    scope.summaryData = {}; // reset
                    scope.allSamples = 0;
                    scope.subsets = 0;
                    scope.running = true;
                    template_msg.innerHTML = 'Fetching data, please wait _';
                };

                var _onSuccess = function() {
                    template_msg.innerHTML = 'Task completed!';
                    scope.subsets = smartRUtils.countCohorts();
                    scope.loaded = true;
                    template_btn.disabled = false;
                    scope.running = false;
                };

                var _onFailure = function(msg) {
                    template_msg.innerHTML = 'Failure: ' + msg;
                    scope.loaded = false;
                    template_btn.disabled = false;
                    scope.running = false;
                };

                // we add this conditional $watch because there is some crazy promise resolving for allSamples
                // going on. This is a workaround which observes allSamples and uses it as criteria for successful
                // completion.
                if (scope.showSummaryStats) {
                    scope.$watch('summaryData', function(newValue) {
                        // prevents initial firing
                        if (scope.running && Object.keys(newValue).indexOf('subsets') !== -1) {
                            scope.allSamples = scope.summaryData.allSamples;
                            _onSuccess();
                        }
                    }, true);
                }

                var _getDataConstraints = function (biomarkers) {
                    if (typeof biomarkers !== 'undefined' && biomarkers.length > 0) {
                        var searchKeywordIds = biomarkers.map(function(biomarker) {
                            return String(biomarker.id);
                        });
                        return {
                            search_keyword_ids: {
                                keyword_ids: searchKeywordIds
                            }
                        };
                    }
                };

                var _afterDataFetched = function() {
                    if (!scope.showSummaryStats) {
                        _onSuccess();
                        return;
                    }

                    template_msg.innerHTML =
                        'Execute summary statistics, please wait _';

                    return rServeService.executeSummaryStats('fetch')
                        .then(function(data) {
                            scope.summaryData = data.result;
                        }, _onFailure);
                };

                template_btn.onclick = function() {
                    _init();
                    var conceptKeys = smartRUtils.conceptBoxMapToConceptKeys(scope.conceptMap);
                    var dataConstraints = _getDataConstraints(scope.biomarkers);
                    rServeService.loadDataIntoSession(conceptKeys, dataConstraints)
                        .then(_afterDataFetched, _onFailure);
                };
            }
        };
    }]);


text:
/* ###
 * IP: GHIDRA
 *
 * 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.
 */
package ghidra.util.table.field;

import ghidra.docking.settings.Settings;
import ghidra.framework.plugintool.ServiceProvider;
import ghidra.program.model.address.Address;
import ghidra.program.model.address.GlobalNamespace;
import ghidra.program.model.listing.*;
import ghidra.program.model.symbol.Symbol;
import ghidra.program.model.symbol.SymbolTable;
import ghidra.program.util.*;

public class NamespaceTableColumn
		extends ProgramBasedDynamicTableColumnExtensionPoint<ProgramLocation, String> {

	@Override
	public String getColumnName() {
		return "Namespace";
	}

	@Override
	public String getValue(ProgramLocation rowObject, Settings settings, Program program,
			ServiceProvider serviceProvider) throws IllegalArgumentException {
		if (rowObject instanceof LabelFieldLocation) {
			LabelFieldLocation labelFieldLocation = (LabelFieldLocation) rowObject;
			String parentPath = labelFieldLocation.getSymbolPath().getParentPath();
			return parentPath == null ? GlobalNamespace.GLOBAL_NAMESPACE_NAME : parentPath;
		}
		Symbol symbol = getSymbol(rowObject, program);
		if (symbol != null) {
			return symbol.getParentNamespace().getName(true);
		}
		Function function =
			program.getFunctionManager().getFunctionContaining(rowObject.getAddress());
		if (function != null) {
			return function.getSymbol().getName(true);
		}
		return null;
	}

	private Symbol getSymbol(ProgramLocation rowObject, Program program)
			throws IllegalArgumentException {
		ProgramLocation location = rowObject;
		if (rowObject instanceof VariableLocation) {
			Variable var = ((VariableLocation) rowObject).getVariable();
			if (var != null) {
				return var.getSymbol();
			}
		}
		Address address = location.getAddress();
		SymbolTable symbolTable = program.getSymbolTable();
		Symbol symbol = symbolTable.getPrimarySymbol(address);
		if (symbol != null) {
			return symbol;
		}
		return null;
	}

}


text:
   server.method( 'processMessage', function ( parsedEventJson ) {

            return new Promise( function ( resolve, reject ) {

                // copy the event into a new variable
                // since we'll be messing with it and want to return the original
                // as part of the http response
                var eventJson = _.cloneDeep(parsedEventJson);

                // insert event logging here later
                Promise
                .map( eventJson.recipient, function ( recipientId ) {
                    // search for group names and expand them to the member ids
                    return internals.GroupFind( { groupid: recipientId } );
                })
                .reduce( function ( finalRecipientList, resultArray ) {
                    // collect all the group member ids
                    if ( resultArray.length > 0 ) {
                        _.remove(eventJson.recipient, function ( id ) {
                            // remove the groupid from the recipient list
                            return (id === resultArray[0].groupId);
                        });
                        // and replace the groupid with the group's members' ids
                        return _.union(finalRecipientList, resultArray[0].memberIds);
                    }
                    return _.union(finalRecipientList, []);
                }, [])
                .then( function (finalGroupRecipientList) {
                    // merge and deduplicate recipient list after expanding groups
                    return _.union(eventJson.recipient, finalGroupRecipientList);
                })
                .map( function (userid) {
                    // for each userid, search for the user to send the alert to
                    // emails will be sent in parallel
                    return internals.UserFind( { userid: userid } )
                    .then( function ( userObject ) {
                        // once the user is found, email the user
                        if (userObject.length === 0) {
                            server.log(['mailer', 'error'], { error: 'unknown user id', userid: userid, message: parsedEventJson });
                        } else {
                            // assemble and deliver the email message in the background
                            internals.deliverMessage( eventJson, userObject[0] );
                        }
                        return Promise.resolve(userObject);
                    })
                    .error( function (e) {

                        return Promise.reject(e);
                    });
                })
                /*.map( function ( userObject ) {
                    // assemble and deliver the email message in the background
                    internals.deliverMessage( eventJson, userObject[0] );
                    return Promise.resolve(userObject);
                })
                .then( function (userObject) {
                    // this dosn't execute if there were any failures (except for email delivery) along the way
                    // returns a 200 along with the original alert in JSON
                    resolve(parsedEventJson);
                })*/
                .timeout(10000, 'Timeout reached! (10000ms)')
                .catch( Promise.TimeoutError, function (e) {
                    // if a timeout error occurs, return a 400 error with the problem
                    reject(Boom.clientTimeout(e));
                })
                .error( function (e) {
                    // if an isOperational error was found, return a 417 error with the problem
                    reject(Boom.expectationFailed(e));
                })
                .catch( function (e) {
                    // if a different error was found, return a 400 error with the problem
                    reject(Boom.badRequest(e));
                })
                .done( function (resultArray) {
                    // return original alert as parsed json
                    return resolve(parsedEventJson);
         server.method( 'processMessage', function ( parsedEventJson ) {

            return new Promise( function ( resolve, reject ) {

                // copy the event into a new variable
                // since we'll be messing with it and want to return the original
                // as part of the http response
                var eventJson = _.cloneDeep(parsedEventJson);

                // insert event logging here later
                Promise
                .map( eventJson.recipient, function ( recipientId ) {
                    // search for group names and expand them to the member ids
                    return internals.GroupFind( { groupid: recipientId } );
                })
                .reduce( function ( finalRecipientList, resultArray ) {
                    // collect all the group member ids
                    if ( resultArray.length > 0 ) {
                        _.remove(eventJson.recipient, function ( id ) {
                            // remove the groupid from the recipient list
                            return (id === resultArray[0].groupId);
                        });
                        // and replace the groupid with the group's members' ids
                        return _.union(finalRecipientList, resultArray[0].memberIds);
                    }
                    return _.union(finalRecipientList, []);
                }, [])
                .then( function (finalGroupRecipientList) {
                    // merge and deduplicate recipient list after expanding groups
                    return _.union(eventJson.recipient, finalGroupRecipientList);
                })
                .map( function (userid) {
                    // for each userid, search for the user to send the alert to
                    // emails will be sent in parallel
                    return internals.UserFind( { userid: userid } )
                    .then( function ( userObject ) {
                        // once the user is found, email the user
                        if (userObject.length === 0) {
                            server.log(['mailer', 'error'], { error: 'unknown user id', userid: userid, message: parsedEventJson });
                        } else {
                            // assemble and deliver the email message in the background
                            internals.deliverMessage( eventJson, userObject[0] );
                        }
                        return Promise.resolve(userObject);
                    })
                    .error( function (e) {

                        return Promise.reject(e);
                    });
                })
                /*.map( function ( userObject ) {
                    // assemble and deliver the email message in the background
                    internals.deliverMessage( eventJson, userObject[0] );
                    return Promise.resolve(userObject);
                })
                .then( function (userObject) {
                    // this dosn't execute if there were any failures (except for email delivery) along the way
                    // returns a 200 along with the original alert in JSON
                    resolve(parsedEventJson);
                })*/
                .timeout(10000, 'Timeout reached! (10000ms)')
                .catch( Promise.TimeoutError, function (e) {
                    // if a timeout error occurs, return a 400 error with the problem
                    reject(Boom.clientTimeout(e));
                })
                .error( function (e) {
                    // if an isOperational error was found, return a 417 error with the problem
                    reject(Boom.expectationFailed(e));
                })
                .catch( function (e) {
                    // if a different error was found, return a 400 error with the problem
                    reject(Boom.badRequest(e));
                })
                .done( function (resultArray) {
                    // return original alert as parsed json
                    return resolve(parsedEventJson);
                })


text: VERY rudimentary Python Fantasy AGE random character generator


text:
srs.librtmp
===========

The client library srs-librtmp of SRS(https://github.com/simple-rtmp-server/srs)

This repository is exported by SRS2.0+, please read the wiki(
[CN](https://github.com/simple-rtmp-server/srs/wiki/v2_CN_SrsLibrtmp#export-srs-librtmp),
[EN](https://github.com/simple-rtmp-server/srs/wiki/v2_EN_SrsLibrtmp#export-srs-librtmp)
).

When you program on linux, the exported project or files can be direclty used.

For windows, I provides a visual studio project example.

Winlin 2014.11


text:
import { isolateFocus, rgbToHex } from '../util.js';
import { map } from '../map.js';
import { controllers } from './Controller.js';
import { TimeSeriesButton } from './timeSeriesButton.js';
import { simVars } from '../simVars.js';

export class TimeSeriesMarker extends HTMLElement {
    constructor(latLon) {
        super();
        const roundLatLon = (num) => Math.round(num*100)/100;
        this.innerHTML = `

                    hide

                        Add name:
                        <input id='timeseries-custom-name'></input>

                        lat: ${roundLatLon(latLon.lat)} lon: ${roundLatLon(latLon.lng)}
                        No layer with colorbar to show values

                    <button class='timeSeriesButton' id='open-timeseries-menu'>generate timeseries</button>

                    cancel

        `;
        this.chartColor = null;
        this.colorInputted = false;
        this.clrbarLocation = null;
        this.hideOnChart = false;
        this.infoOpen = false;
        this.timeSeriesButton = this.createTimeSeriesButton();
    }

    createTimeSeriesButton() {
        let timeSeriesButton = new TimeSeriesButton();
        const timeSeriesMenu = this.querySelector('#timeseries-menu');
        timeSeriesMenu.appendChild(timeSeriesButton);
        return timeSeriesButton;
    }

    connectedCallback() {
        this.initializeTimeseriesMenu();
        isolateFocus(this.querySelector('#timeseries-custom-name'));
    }

    initializeTimeseriesMenu() {
        const generateTimeseries = this.querySelector('#open-timeseries-menu');
        const markerMenu = this.querySelector('#marker-menu');
        const timeseriesMenu = this.querySelector('#timeseries-menu');
        const closeTimeseriesMenu = this.querySelector('#close-timeseries-menu');
        generateTimeseries.onpointerdown = () => {
            markerMenu.classList.add('hidden');
            timeseriesMenu.classList.remove('hidden');
        }
        closeTimeseriesMenu.onpointerdown = () => {
            markerMenu.classList.remove('hidden');
            timeseriesMenu.classList.add('hidden');
        }
    }

    getChartColor() {
        return this.chartColor;
    }

    setChartColor(chartColor) {
        this.chartColor = chartColor;
        this.colorInputted = true;
    }

    setName(name) {
        this.querySelector('#timeseries-custom-name').value = name;
    }

    getName() {
        return this.querySelector('#timeseries-custom-name').value;
    }

    bindHide(fun) {
        const hideButton = this.querySelector('#hideMenu');
        hideButton.onclick = fun;
    }

    bindName(fun) {
        const nameMarker = this.querySelector('#timeseries-custom-name');
        nameMarker.oninput = () => {
            fun();
        }
    }

    setRGBValues(rgb, clrbarLocation) {
        let [r, g, b] = rgb;
        if ((r + g + b) > 745) {
            [r, g, b] = [0, 0, 0];
        }
        if (!this.colorInputted) {
            let hexValue = rgbToHex(r, g, b);
            this.chartColor = hexValue;
        }
        this.clrbarLocation = clrbarLocation;
        const clrbarP = this.querySelector('#colorbar-location');
        const rgbP = this.querySelector('#rgb-value');
        clrbarP.style.display = 'none';
        rgbP.innerHTML = 'No layer with colorbar to show values of';
        rgbP.style.color = 'black';
        if (clrbarLocation != null) {
            this.enableTimeSeriesButtons();
            clrbarP.style.display = 'block';
            clrbarP.innerHTML = 'colorbar location: ' + clrbarLocation;
            rgbP.style.color = `rgb(${r},${g},${b})`;
            rgbP.innerHTML = `pixel value: R${r} G${g} B${b}`;
        } else {
            this.disableTimeSeriesButtons();
        }
    }

    disableTimeSeriesButtons() {
        const openTimeSeriesButton = this.querySelector('#open-timeseries-menu');
        openTimeSeriesButton.disabled = true;
        this.timeSeriesButton.getButton().disabled = true;
    }

    enableTimeSeriesButtons() {
        const openTimeSeriesButton = this.querySelector('#open-timeseries-menu');
        openTimeSeriesButton.disabled = false;
        this.timeSeriesButton.getButton().disabled = false;
    }
}

export class Marker {
    constructor(latLon, coords) {
        this._latlng = latLon;
        this.imageCoords = coords;

        this.popup = L.popup({closeOnClick: false, autoClose: false, autoPan: false}).setLatLng(latLon).addTo(map);
        this.timeSeriesMarker = new TimeSeriesMarker(latLon, coords);
        this.timeSeriesMarker.bindHide(() => this.hideMarkerInfo());
        this.timeSeriesMarker.bindName(() => {
            let markerController = controllers.timeSeriesMarkers;
            let markers = markerController.getValue();
            markerController.broadcastEvent(markerController.UPDATE_EVENT, markers.indexOf(this));
        });
        this.popup.setContent(this.timeSeriesMarker);
        let display = simVars.showMarkers ? 'block' : 'none';
        this.popup.getElement().style.display = display;

        let svgString = `<svg xmlns='http://www.w3.org/2000/svg' width='24' height='24'>
                                <path d="M0 0h24v24H0V0z" fill="none"></path>
                                <path d="M7 10l5 5 5-5H7z"></path>
                              </svg>`;
        let myIconUrl = encodeURI("data:image/svg+xml," + svgString).replace('#','%23');
        let markerIcon = L.icon({iconUrl: myIconUrl, iconAnchor: [13, 16]});

        this.marker = L.marker(latLon, {icon: markerIcon, autoPan: false}).addTo(map);
        this.popup.on('remove', () => {
            controllers.timeSeriesMarkers.remove(this);
            this.marker.removeFrom(map);
        });
        this.marker.on('mousedown', () => {
            if (this.timeSeriesMarker.infoOpen) {
                this.hideMarkerInfo();
            } else {
                this.showMarkerInfo();
            }
        });
    }

    hideMarkerInfo() {
        let popupElem = this.popup.getElement();
        popupElem.style.display = 'none';
        this.timeSeriesMarker.infoOpen = false;
    }

    showMarkerInfo() {
        let popupElem = this.popup.getElement();
        popupElem.style.display = 'block';
        this.timeSeriesMarker.infoOpen = true;
    }

    getContent() {
        return this.timeSeriesMarker;
    }

    setName(name) {
        this.timeSeriesMarker.setName(name);
    }

    getName() {
        return this.timeSeriesMarker.getName();
    }
}

window.customElements.define('time-series-marker', TimeSeriesMarker);


text:
package com.mygdx.proj.entity.EnemyEntities;

import com.badlogic.gdx.graphics.g2d.Animation;
import com.badlogic.gdx.graphics.g2d.Sprite;
import com.badlogic.gdx.graphics.g2d.TextureRegion;
import com.mygdx.proj.entity.EnemyEntity;

public class Enemy3Entity extends EnemyEntity {
    public Enemy3Entity(float x, float y, Animation<Sprite> animation, int behaviour) {
        super(x,y,x+1, y+1, animation, 10, 10, behaviour, 40);
    }
}


text:
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto">

    <group android:checkableBehavior="single">
        <item
            android:id="@+id/nav_home"
            android:icon="@drawable/ic_home_black_24dp"
            android:title="Home" />
        <item
            android:id="@+id/nav_about"
            android:icon="@drawable/ic_info_black_24dp"
            android:title="About" />
        <item
            android:id="@+id/nav_academics"
            android:icon="@drawable/ic_school_black_24dp"
            android:title="Academics" />
        <item
            android:id="@+id/nav_student"
            android:icon="@drawable/ic_group_black_24dp"
            android:title="Student" />
    </group>

    <!--<item-->
    <!--android:id="@+id/nav_account"-->
    <!--android:visible="false">-->
    <!--<menu>-->
    <group
        android:id="@+id/nav_account"
        android:icon="@drawable/ic_supervisor_account_black_24dp"
        android:checkableBehavior="single">
        <item
            android:id="@+id/nav_dashboard"
            android:icon="@drawable/ic_dashboard_black_24dp"
            android:title="Dashboard" />
        <item
            android:id="@+id/nav_class_test"
            android:icon="@drawable/ic_equalizer_black_24dp"
            android:title="Class Test" />
        <item
            android:id="@+id/nav_attendance"
            android:icon="@drawable/ic_equalizer_black_24dp"
            android:title="Attendance" />
        <item
            android:id="@+id/nav_account_changepass"
            android:icon="@drawable/ic_vpn_key_black_24dp"
            android:title="Change Password" />
        <item
            android:id="@+id/nav_signout"
            android:icon="@drawable/ic_lock_black_24dp"
            android:checkable="false"
            android:title="Sign Out" />
    </group>

    <group
        android:id="@+id/nav_admin"
        android:icon="@drawable/ic_supervisor_account_black_24dp"
        android:checkableBehavior="single">
        <item
            android:id="@+id/nav_admin_dashboard"
            android:icon="@drawable/ic_dashboard_black_24dp"
            android:title="Dashboard" />
        <item
            android:id="@+id/nav_upload"
            android:icon="@drawable/ic_file_upload_black_24dp"
            android:title="Upload Notice" />

        <item
            android:id="@+id/nav_bin"
            android:icon="@drawable/ic_delete_black_24dp"
            android:title="Bin" />

        <item
            android:id="@+id/nav_admin_changepass"
            android:icon="@drawable/ic_visibility_off_black_24dp"
            android:title="Change Password" />
        <item
            android:id="@+id/nav_admin_signout"
            android:icon="@drawable/ic_lock_black_24dp"
            android:checkable="false"
            android:title="Sign Out" />
    </group>
</menu>


text:
package wan.wanmarcos.utils;

import android.app.Activity;
import android.content.Context;

import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.squareup.okhttp.OkHttpClient;

import retrofit.GsonConverterFactory;
import retrofit.Retrofit;

/**
 * Created by javier on 25/09/15.
 */
public class RestClient {

    private ConsumerService consumerService;

    public RestClient() {

        Retrofit retrofit = new Retrofit
                .Builder()
                .baseUrl(Constants.WANMARCOS_API_BASE_URL)
                .addConverterFactory(GsonConverterFactory.create())
                .build();

        consumerService = retrofit.create(ConsumerService.class);
    }

    public RestClient(Context context) {
        OkHttpClient okHttpClient = new OkHttpClient();
        okHttpClient.interceptors().add(new TokenInterceptor(context));
        Retrofit retrofit = new Retrofit
                .Builder().client(okHttpClient)
                .baseUrl(Constants.WANMARCOS_API_BASE_URL)
                .addConverterFactory(GsonConverterFactory.create())
                .build();

        consumerService = retrofit.create(ConsumerService.class);
    }

    public ConsumerService getConsumerService() {
        return consumerService;
    }

}


text:
/*
 * Example using libnice to negotiate a UDP connection between two clients,
 * possibly on the same network or behind different NATs and/or stateful
 * firewalls.
 *
 * Build:
 *   gcc -o simple-example simple-example.c `pkg-config --cflags --libs nice`
 *
 * 分别作为发送端和接收端启动示例,由(0,1)标识, 在启动示例时,输入STUN服务器地址
 * Run two clients, one controlling and one controlled:
 *   ./simple-example 0 $(host -4 -t A stun.stunprotocol.org | awk '{ print $4 }')
 *   ./simple-example 1 $(host -4 -t A stun.stunprotocol.org | awk '{ print $4 }')
 */
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <ctype.h>

#include <agent.h>

#include <gio/gnetworking.h>

// WebRtc音视频实时通信--libnice库介绍 https://blog.csdn.net/chenFteng/article/details/77429453

static GMainLoop *gloop;
static GIOChannel* io_stdin;
static guint stream_id;

static const gchar *candidate_type_name[] = {"host", "srflx", "prflx", "relay"};

static const gchar *state_name[] = {"disconnected", "gathering", "connecting",
                                    "connected", "ready", "failed"};

static int print_local_data(NiceAgent *agent, guint stream_id,
    guint component_id);
static int parse_remote_data(NiceAgent *agent, guint stream_id,
    guint component_id, char *line);
static void cb_candidate_gathering_done(NiceAgent *agent, guint stream_id,
    gpointer data);
static void cb_new_selected_pair(NiceAgent *agent, guint stream_id,
    guint component_id, gchar *lfoundation,
    gchar *rfoundation, gpointer data);
static void cb_component_state_changed(NiceAgent *agent, guint stream_id,
    guint component_id, guint state,
    gpointer data);
static void cb_nice_recv(NiceAgent *agent, guint stream_id, guint component_id,
    guint len, gchar *buf, gpointer data);
static gboolean stdin_remote_info_cb (GIOChannel *source, GIOCondition cond,
    gpointer data);
static gboolean stdin_send_data_cb (GIOChannel *source, GIOCondition cond,
    gpointer data);

int
main(int argc, char *argv[])
{
  // 创建一个Libnice Agent实例对象,一个agent可理解为一个连接通道
  NiceAgent *agent;
  gchar *stun_addr = NULL;  // STUN服务器地址
  guint stun_port = 0;      // STUN服务器端口
  gboolean controlling;

  // 解析输入参数以获取STUN服务器地址信息和当前端角色(控制或被控制)
  if (argc > 4 || argc < 2 || argv[1][1] != '\0') {
    fprintf(stderr, "Usage: %s 0|1 stun_addr [stun_port]\n", argv[0]);
    return EXIT_FAILURE;
  }
  controlling = argv[1][0] - '0';
  if (controlling != 0 && controlling != 1) {
    fprintf(stderr, "Usage: %s 0|1 stun_addr [stun_port]\n", argv[0]);
    return EXIT_FAILURE;
  }

  if (argc > 2) {
    stun_addr = argv[2];
    if (argc > 3)
      stun_port = atoi(argv[3]);
    else
      stun_port = 3478;

    g_debug("Using stun server '[%s]:%u'\n", stun_addr, stun_port);
  }

  g_networking_init();

  gloop = g_main_loop_new(NULL, FALSE);
#ifdef G_OS_WIN32
  io_stdin = g_io_channel_win32_new_fd(_fileno(stdin));
#else
  io_stdin = g_io_channel_unix_new(fileno(stdin));
#endif

  // 创建一个连接对象,并指定所遵循的ICE协议
  agent = nice_agent_new(g_main_loop_get_context (gloop),
      NICE_COMPATIBILITY_RFC5245);
  if (agent == NULL)
    g_error("Failed to create agent");

  // Set the STUN settings and controlling mode
  if (stun_addr) {
    g_object_set(agent, "stun-server", stun_addr, NULL);
    g_object_set(agent, "stun-server-port", stun_port, NULL);
  }
  g_object_set(agent, "controlling-mode", controlling, NULL);

  // Connect to the signals
  // 为agent绑定事件响应,本端候选地址全部收集完成时调用方法cb_candidate_gathering_done
  g_signal_connect(agent, "candidate-gathering-done",
      G_CALLBACK(cb_candidate_gathering_done), NULL);
  // 为agent绑定事件响应,本端在接收到对端的连接候选地址,在尝试连接后,
  // 发现一个新的可通信的连接地址对时,调用方法cb_new_selected_pair
  // 一个可选地址对由本端一个候选地址和对端的一个候选地址组成
  g_signal_connect(agent, "new-selected-pair",
      G_CALLBACK(cb_new_selected_pair), NULL);
  // 为agent绑定事件响应,当通道的连接状态发生变化时回调方法cb_component_state_changed
  // 一个agent可包含多个component,可视为多路复用一个链路
  g_signal_connect(agent, "component-state-changed",
      G_CALLBACK(cb_component_state_changed), NULL);

  // Create a new stream with one component
  stream_id = nice_agent_add_stream(agent, 1);
  if (stream_id == 0)
    g_error("Failed to add stream");

  // Attach to the component to receive the data
  // Without this call, candidates cannot be gathered
  // 为agent绑定事件响应,当agent链路的1号通道(component)接口有数据包到来时
  nice_agent_attach_recv(agent, stream_id, 1,
      g_main_loop_get_context (gloop), cb_nice_recv, NULL);

  // Start gathering local candidates
  if (!nice_agent_gather_candidates(agent, stream_id))
    g_error("Failed to start candidate gathering");

  g_debug("waiting for candidate-gathering-done signal...");

  // Run the mainloop. Everything else will happen asynchronously
  // when the candidates are done gathering.
  g_main_loop_run (gloop);

  g_main_loop_unref(gloop);
  g_object_unref(agent);
  g_io_channel_unref (io_stdin);

  return EXIT_SUCCESS;
}

static void
cb_candidate_gathering_done(NiceAgent *agent, guint _stream_id,
    gpointer data)
{

  g_debug("SIGNAL candidate gathering done\n");

  // Candidate gathering is done. Send our local candidates on stdout
  printf("Copy this line to remote client:\n");
  printf("\n  ");
  print_local_data(agent, _stream_id, 1);
  printf("\n");

  // Listen on stdin for the remote candidate list
  printf("Enter remote data (single line, no wrapping):\n");
  g_io_add_watch(io_stdin, G_IO_IN, stdin_remote_info_cb, agent);
  printf("> ");
  fflush (stdout);
}

static gboolean
stdin_remote_info_cb (GIOChannel *source, GIOCondition cond,
    gpointer data)
{
  NiceAgent *agent = data;
  gchar *line = NULL;
  int rval;
  gboolean ret = TRUE;

  if (g_io_channel_read_line (source, &line, NULL, NULL, NULL) ==
      G_IO_STATUS_NORMAL) {

    // Parse remote candidate list and set it on the agent
    rval = parse_remote_data(agent, stream_id, 1, line);
    if (rval == EXIT_SUCCESS) {
      // Return FALSE so we stop listening to stdin since we parsed the
      // candidates correctly
      ret = FALSE;
      g_debug("waiting for state READY or FAILED signal...");
    } else {
      fprintf(stderr, "ERROR: failed to parse remote data\n");
      printf("Enter remote data (single line, no wrapping):\n");
      printf("> ");
      fflush (stdout);
    }
    g_free (line);
  }

  return ret;
}

static void
cb_component_state_changed(NiceAgent *agent, guint _stream_id,
    guint component_id, guint state,
    gpointer data)
{

  g_debug("SIGNAL: state changed %d %d %s[%d]\n",
      _stream_id, component_id, state_name[state], state);

  if (state == NICE_COMPONENT_STATE_CONNECTED) {
    NiceCandidate *local, *remote;

    // Get current selected candidate pair and print IP address used
    if (nice_agent_get_selected_pair (agent, _stream_id, component_id,
                &local, &remote)) {
      gchar ipaddr[INET6_ADDRSTRLEN];

      nice_address_to_string(&local->addr, ipaddr);
      printf("\nNegotiation complete: ([%s]:%d,",
          ipaddr, nice_address_get_port(&local->addr));
      nice_address_to_string(&remote->addr, ipaddr);
      printf(" [%s]:%d)\n", ipaddr, nice_address_get_port(&remote->addr));
    }

    // Listen to stdin and send data written to it
    printf("\nSend lines to remote (Ctrl-D to quit):\n");
    g_io_add_watch(io_stdin, G_IO_IN, stdin_send_data_cb, agent);
    printf("> ");
    fflush (stdout);
  } else if (state == NICE_COMPONENT_STATE_FAILED) {
    g_main_loop_quit (gloop);
  }
}

static gboolean
stdin_send_data_cb (GIOChannel *source, GIOCondition cond,
    gpointer data)
{
  NiceAgent *agent = data;
  gchar *line = NULL;

  if (g_io_channel_read_line (source, &line, NULL, NULL, NULL) ==
      G_IO_STATUS_NORMAL) {
    nice_agent_send(agent, stream_id, 1, strlen(line), line);
    g_free (line);
    printf("> ");
    fflush (stdout);
  } else {
    nice_agent_send(agent, stream_id, 1, 1, "\0");
    // Ctrl-D was pressed.
    g_main_loop_quit (gloop);
  }

  return TRUE;
}

static void
cb_new_selected_pair(NiceAgent *agent, guint _stream_id,
    guint component_id, gchar *lfoundation,
    gchar *rfoundation, gpointer data)
{
  g_debug("SIGNAL: selected pair %s %s", lfoundation, rfoundation);
}

static void
cb_nice_recv(NiceAgent *agent, guint _stream_id, guint component_id,
    guint len, gchar *buf, gpointer data)
{
  if (len == 1 && buf[0] == '\0')
    g_main_loop_quit (gloop);
  printf("%.*s", len, buf);
  fflush(stdout);
}

// 解析收集到的自已的或接收到的对方的candidate候选地址.
// 一个候选地址主要由编号,优先级,IP地址,端口号,网络类型等几个元素组成
static NiceCandidate *
parse_candidate(char *scand, guint _stream_id)
{
  NiceCandidate *cand = NULL;
  NiceCandidateType ntype;
  gchar **tokens = NULL;
  guint i;

  tokens = g_strsplit (scand, ",", 5);
  for (i = 0; tokens[i]; i++);
  if (i != 5)
    goto end;

  for (i = 0; i < G_N_ELEMENTS (candidate_type_name); i++) {
    if (strcmp(tokens[4], candidate_type_name[i]) == 0) {
      ntype = i;
      break;
    }
  }
  if (i == G_N_ELEMENTS (candidate_type_name))
    goto end;

  cand = nice_candidate_new(ntype);
  cand->component_id = 1;
  cand->stream_id = _stream_id;
  cand->transport = NICE_CANDIDATE_TRANSPORT_UDP;
  strncpy(cand->foundation, tokens[0], NICE_CANDIDATE_MAX_FOUNDATION);
  cand->foundation[NICE_CANDIDATE_MAX_FOUNDATION - 1] = 0;
  cand->priority = atoi (tokens[1]);

  if (!nice_address_set_from_string(&cand->addr, tokens[2])) {
    g_message("failed to parse addr: %s", tokens[2]);
    nice_candidate_free(cand);
    cand = NULL;
    goto end;
  }

  nice_address_set_port(&cand->addr, atoi (tokens[3]));

 end:
  g_strfreev(tokens);

  return cand;
}

static int
print_local_data (NiceAgent *agent, guint _stream_id, guint component_id)
{
  int result = EXIT_FAILURE;
  gchar *local_ufrag = NULL;
  gchar *local_password = NULL;
  gchar ipaddr[INET6_ADDRSTRLEN];
  GSList *cands = NULL, *item;

  if (!nice_agent_get_local_credentials(agent, _stream_id,
      &local_ufrag, &local_password))
    goto end;

  cands = nice_agent_get_local_candidates(agent, _stream_id, component_id);
  if (cands == NULL)
    goto end;

  printf("%s %s", local_ufrag, local_password);

  for (item = cands; item; item = item->next) {
    NiceCandidate *c = (NiceCandidate *)item->data;

    nice_address_to_string(&c->addr, ipaddr);

    // (foundation),(prio),(addr),(port),(type)
    printf(" %s,%u,%s,%u,%s",
        c->foundation,
        c->priority,
        ipaddr,
        nice_address_get_port(&c->addr),
        candidate_type_name[c->type]);
  }
  printf("\n");
  result = EXIT_SUCCESS;

 end:
  if (local_ufrag)
    g_free(local_ufrag);
  if (local_password)
    g_free(local_password);
  if (cands)
    g_slist_free_full(cands, (GDestroyNotify)&nice_candidate_free);

  return result;
}

static int
parse_remote_data(NiceAgent *agent, guint _stream_id,
    guint component_id, char *line)
{
  GSList *remote_candidates = NULL;
  gchar **line_argv = NULL;
  const gchar *ufrag = NULL;
  const gchar *passwd = NULL;
  int result = EXIT_FAILURE;
  int i;

  line_argv = g_strsplit_set (line, " \t\n", 0);
  for (i = 0; line_argv && line_argv[i]; i++) {
    if (strlen (line_argv[i]) == 0)
      continue;

    // first two args are remote ufrag and password
    if (!ufrag) {
      ufrag = line_argv[i];
    } else if (!passwd) {
      passwd = line_argv[i];
    } else {
      // Remaining args are serialized canidates (at least one is required)
      NiceCandidate *c = parse_candidate(line_argv[i], _stream_id);

      if (c == NULL) {
        g_message("failed to parse candidate: %s", line_argv[i]);
        goto end;
      }
      remote_candidates = g_slist_prepend(remote_candidates, c);
    }
  }
  if (ufrag == NULL || passwd == NULL || remote_candidates == NULL) {
    g_message("line must have at least ufrag, password, and one candidate");
    goto end;
  }

  if (!nice_agent_set_remote_credentials(agent, _stream_id, ufrag, passwd)) {
    g_message("failed to set remote credentials");
    goto end;
  }

  // Note: this will trigger the start of negotiation.
  if (nice_agent_set_remote_candidates(agent, _stream_id, component_id,
      remote_candidates) < 1) {
    g_message("failed to set remote candidates");
    goto end;
  }

  result = EXIT_SUCCESS;

 end:
  if (line_argv != NULL)
    g_strfreev(line_argv);
  if (remote_candidates != NULL)
    g_slist_free_full(remote_candidates, (GDestroyNotify)&nice_candidate_free);

  return result;
}


text:
import markdownit from "markdown-it"
import {schema} from "./schema"
import {Mark, MarkType, Node, Attrs, Schema, NodeType} from "prosemirror-model"

// FIXME
type Token = any
type MarkdownIt = any

function maybeMerge(a: Node, b: Node): Node | undefined {
  if (a.isText && b.isText && Mark.sameSet(a.marks, b.marks))
    return (a as any).withText(a.text! + b.text!)
}

// Object used to track the context of a running parse.
class MarkdownParseState {
  stack: {type: NodeType, attrs: Attrs | null, content: Node[], marks: readonly Mark[]}[]

  constructor(
    readonly schema: Schema,
    readonly tokenHandlers: {[token: string]: (stat: MarkdownParseState, token: Token, tokens: Token[], i: number) => void}
  ) {
    this.stack = [{type: schema.topNodeType, attrs: null, content: [], marks: Mark.none}]
  }

  top() {
    return this.stack[this.stack.length - 1]
  }

  push(elt: Node) {
    if (this.stack.length) this.top().content.push(elt)
  }

  // Adds the given text to the current position in the document,
  // using the current marks as styling.
  addText(text: string) {
    if (!text) return
    let top = this.top(), nodes = top.content, last = nodes[nodes.length - 1]
    let node = this.schema.text(text, top.marks), merged
    if (last && (merged = maybeMerge(last, node))) nodes[nodes.length - 1] = merged
    else nodes.push(node)
  }

  // Adds the given mark to the set of active marks.
  openMark(mark: Mark) {
    let top = this.top()
    top.marks = mark.addToSet(top.marks)
  }

  // Removes the given mark from the set of active marks.
  closeMark(mark: MarkType) {
    let top = this.top()
    top.marks = mark.removeFromSet(top.marks)
  }

  parseTokens(toks: Token[]) {
    for (let i = 0; i < toks.length; i++) {
      let tok = toks[i]
      let handler = this.tokenHandlers[tok.type]
      if (!handler)
        throw new Error("Token type `" + tok.type + "` not supported by Markdown parser")
      handler(this, tok, toks, i)
    }
  }

  // Add a node at the current position.
  addNode(type: NodeType, attrs: Attrs | null, content?: readonly Node[]) {
    let top = this.top()
    let node = type.createAndFill(attrs, content, top ? top.marks : [])
    if (!node) return null
    this.push(node)
    return node
  }

  // Wrap subsequent content in a node of the given type.
  openNode(type: NodeType, attrs: Attrs | null) {
    this.stack.push({type: type, attrs: attrs, content: [], marks: Mark.none})
  }

  // Close and return the node that is currently on top of the stack.
  closeNode() {
    let info = this.stack.pop()!
    return this.addNode(info.type, info.attrs, info.content)
  }
}

function attrs(spec: ParseSpec, token: Token, tokens: Token[], i: number) {
  if (spec.getAttrs) return spec.getAttrs(token, tokens, i)
  // For backwards compatibility when `attrs` is a Function
  else if (spec.attrs instanceof Function) return spec.attrs(token)
  else return spec.attrs
}

// Code content is represented as a single token with a `content`
// property in Markdown-it.
function noCloseToken(spec: ParseSpec, type: string) {
  return spec.noCloseToken || type == "code_inline" || type == "code_block" || type == "fence"
}

function withoutTrailingNewline(str: string) {
  return str[str.length - 1] == "\n" ? str.slice(0, str.length - 1) : str
}

function noOp() {}

function tokenHandlers(schema: Schema, tokens: {[token: string]: ParseSpec}) {
  let handlers: {[token: string]: (stat: MarkdownParseState, token: Token, tokens: Token[], i: number) => void} =
    Object.create(null)
  for (let type in tokens) {
    let spec = tokens[type]
    if (spec.block) {
      let nodeType = schema.nodeType(spec.block)
      if (noCloseToken(spec, type)) {
        handlers[type] = (state, tok, tokens, i) => {
          state.openNode(nodeType, attrs(spec, tok, tokens, i))
          state.addText(withoutTrailingNewline(tok.content))
          state.closeNode()
        }
      } else {
        handlers[type + "_open"] = (state, tok, tokens, i) => state.openNode(nodeType, attrs(spec, tok, tokens, i))
        handlers[type + "_close"] = state => state.closeNode()
      }
    } else if (spec.node) {
      let nodeType = schema.nodeType(spec.node)
      handlers[type] = (state, tok, tokens, i) => state.addNode(nodeType, attrs(spec, tok, tokens, i))
    } else if (spec.mark) {
      let markType = schema.marks[spec.mark]
      if (noCloseToken(spec, type)) {
        handlers[type] = (state, tok, tokens, i) => {
          state.openMark(markType.create(attrs(spec, tok, tokens, i)))
          state.addText(withoutTrailingNewline(tok.content))
          state.closeMark(markType)
        }
      } else {
        handlers[type + "_open"] = (state, tok, tokens, i) => state.openMark(markType.create(attrs(spec, tok, tokens, i)))
        handlers[type + "_close"] = state => state.closeMark(markType)
      }
    } else if (spec.ignore) {
      if (noCloseToken(spec, type)) {
        handlers[type] = noOp
      } else {
        handlers[type + "_open"] = noOp
        handlers[type + "_close"] = noOp
      }
    } else {
      throw new RangeError("Unrecognized parsing spec " + JSON.stringify(spec))
    }
  }

  handlers.text = (state, tok) => state.addText(tok.content)
  handlers.inline = (state, tok) => state.parseTokens(tok.children)
  handlers.softbreak = handlers.softbreak || (state => state.addText("\n"))

  return handlers
}

/// Object type used to specify how Markdown tokens should be parsed.
export interface ParseSpec {
  /// This token maps to a single node, whose type can be looked up
  /// in the schema under the given name. Exactly one of `node`,
  /// `block`, or `mark` must be set.
  node?: string

  /// This token (unless `noCloseToken` is true) comes in `_open`
  /// and `_close` variants (which are appended to the base token
  /// name provides a the object property), and wraps a block of
  /// content. The block should be wrapped in a node of the type
  /// named to by the property's value. If the token does not have
  /// `_open` or `_close`, use the `noCloseToken` option.
  block?: string

  /// This token (again, unless `noCloseToken` is true) also comes
  /// in `_open` and `_close` variants, but should add a mark
  /// (named by the value) to its content, rather than wrapping it
  /// in a node.
  mark?: string

  /// Attributes for the node or mark. When `getAttrs` is provided,
  /// it takes precedence.
  attrs?: Attrs | null

  /// A function used to compute the attributes for the node or mark
  /// that takes a [markdown-it
  /// token](https://markdown-it.github.io/markdown-it/#Token) and
  /// returns an attribute object.
  getAttrs?: (token: Token, tokenStream: Token[], index: number) => Attrs | null

  /// Indicates that the [markdown-it
  /// token](https://markdown-it.github.io/markdown-it/#Token) has
  /// no `_open` or `_close` for the nodes. This defaults to `true`
  /// for `code_inline`, `code_block` and `fence`.
  noCloseToken?: boolean

  /// When true, ignore content for the matched token.
  ignore?: boolean
}

/// A configuration of a Markdown parser. Such a parser uses
/// [markdown-it](https://github.com/markdown-it/markdown-it) to
/// tokenize a file, and then runs the custom rules it is given over
/// the tokens to create a ProseMirror document tree.
export class MarkdownParser {
  /// @internal
  tokenHandlers: {[token: string]: (stat: MarkdownParseState, token: Token, tokens: Token[], i: number) => void}

  /// Create a parser with the given configuration. You can configure
  /// the markdown-it parser to parse the dialect you want, and provide
  /// a description of the ProseMirror entities those tokens map to in
  /// the `tokens` object, which maps token names to descriptions of
  /// what to do with them. Such a description is an object, and may
  /// have the following properties:
  constructor(
    /// The parser's document schema.
    readonly schema: Schema,
    /// This parser's markdown-it tokenizer.
    readonly tokenizer: MarkdownIt,
    /// The value of the `tokens` object used to construct this
    /// parser. Can be useful to copy and modify to base other parsers
    /// on.
    readonly tokens: {[name: string]: ParseSpec}
  ) {
    this.tokenHandlers = tokenHandlers(schema, tokens)
  }

  /// Parse a string as [CommonMark](http://commonmark.org/) markup,
  /// and create a ProseMirror document as prescribed by this parser's
  /// rules.
  ///
  /// The second argument, when given, is passed through to the
  /// [Markdown
  /// parser](https://markdown-it.github.io/markdown-it/#MarkdownIt.parse).
  parse(text: string, markdownEnv: Object = {}) {
    let state = new MarkdownParseState(this.schema, this.tokenHandlers), doc
    state.parseTokens(this.tokenizer.parse(text, markdownEnv))
    do { doc = state.closeNode() } while (state.stack.length)
    return doc || this.schema.topNodeType.createAndFill()
  }
}

function listIsTight(tokens: readonly Token[], i: number) {
  while (++i < tokens.length)
    if (tokens[i].type != "list_item_open") return tokens[i].hidden
  return false
}

/// A parser parsing unextended [CommonMark](http://commonmark.org/),
/// without inline HTML, and producing a document in the basic schema.
export const defaultMarkdownParser = new MarkdownParser(schema, markdownit("commonmark", {html: false}), {
  blockquote: {block: "blockquote"},
  paragraph: {block: "paragraph"},
  list_item: {block: "list_item"},
  bullet_list: {block: "bullet_list", getAttrs: (_, tokens, i) => ({tight: listIsTight(tokens, i)})},
  ordered_list: {block: "ordered_list", getAttrs: (tok, tokens, i) => ({
    order: +tok.attrGet("start") || 1,
    tight: listIsTight(tokens, i)
  })},
  heading: {block: "heading", getAttrs: tok => ({level: +tok.tag.slice(1)})},
  code_block: {block: "code_block", noCloseToken: true},
  fence: {block: "code_block", getAttrs: tok => ({params: tok.info || ""}), noCloseToken: true},
  hr: {node: "horizontal_rule"},
  image: {node: "image", getAttrs: tok => ({
    src: tok.attrGet("src"),
    title: tok.attrGet("title") || null,
    alt: tok.children[0] && tok.children[0].content || null
  })},
  hardbreak: {node: "hard_break"},

  em: {mark: "em"},
  strong: {mark: "strong"},
  link: {mark: "link", getAttrs: tok => ({
    href: tok.attrGet("href"),
    title: tok.attrGet("title") || null
  })},
  code_inline: {mark: "code", noCloseToken: true}
})


text:
namespace voidum
{
  class Driver;
  class Package;
  class Task;

  class VOIDUM_API Host
  {
  public:
    //find host by name
    static Host* Find(const text& name);

    //find host for package
    static Host* Find(const Package& package);

  protected:
    text name_;
    text endpoint_;
    List<Package>* packages_;

  public:
    Host(const text& name);
    virtual ~Host();

  public:
    //get alias name
    const text& GetName();

    //get end point
    const text& GetEndPoint();

  public:
    //test if host has package
    bool Contains(const Package& package);

    //get package by name
    //try to load if found nothing
    Package* GetPackage(const text& name);

  public:
    //get driver
    //todo: consider rename GetDriver
    virtual Driver* GetDriver(const text& runtime) = 0;

    //connect to endpoint
    virtual bool Connect(const text& endpoint) = 0;

    //request source
    virtual const text& Request(const text& source) = 0;

  public:
    //enable host
    void Enable();

    //disable host
    void Disable();
  };
}

#endif


text:
require 'spec_helper'

describe "Comment" do
  let(:article) { Article.create }
  let(:user) { User.create }
  context "creating from the root collection" do
    it "should create document in root collection" do
      c = Comment.create(:article => article, :contents => "root", :author => "root_author" )
      Comment.where(:contents => "root").first.should == c
    end

    it "should create similar document in each embedding collection" do
      c  = Comment.create(:article => article, :user => user, :contents => "root", :author => "root_author" )
      article.reload
      article.comments.find(c.id.to_s).should_not be_nil
      user.reload
      user.comments.find(c.id.to_s).should_not be_nil
    end

  end

  context "creating from the embedding collection" do
    it "should create document in root collection" do
      c = article.comments.create(:contents => "embedding", :author => "embedding_author")
      Comment.find(c.id).should_not be_nil
    end

    it "should create similar document in embedding collection" do
      c = article.comments.create(:contents => "embedding", :author => "embedding_author")
      article.reload
      c.article.should == article
    end

    it "should replicate document to sibling collections" do
      c = article.comments.create(:user_id => user.id, :contents => "embedding", :author => "embedding_author")
      user.reload
      user.comments.find(c.id).should_not be_nil
    end
  end

  context "updating from the root collection" do
    it "should update document in root collection" do
      c  = Comment.create(:article => article, :contents => "root", :author => "root_author" )
      c.update_attributes(:contents => "new_root", :author => "new_author_root")
      Comment.where(:contents => "new_root", :author => "new_author_root").first.should == c

    end

    it "should update document in embedding collection with new attributes" do
      c  = Comment.create(:article => article, :user => user, :contents => "root", :author => "root_author" )
      c.update_attributes(:contents => "new_root", :author => "new_author_root")
      article.reload
      article.comments.where(:contents => "new_root", :author => "new_author_root").first.id.should == c.id
      user.reload
      user.comments.where(:contents => "new_root", :author => "new_author_root").first.id.should == c.id
    end
    context "switching embedding document" do
      it "should delete comment from embedding original collection" do
        c = article.comments.create(:contents => "embedding", :author => "embedding_author")
        Comment.first.update_attributes(:article_id =>  Article.create.id, :user_id => User.create.id)
        article.reload
        # puts article.inspect
        # puts article.comments.inspect
        # puts Comment.all.to_a.inspect
        article.comments.should be_empty
        user.reload
        user.comments.should be_empty
      end
      it "should create comment in new embedding collection" do
        c = article.comments.create(:contents => "embedding", :author => "embedding_author")
        Comment.first.update_attribute(:article_id, Article.create.id)
        Article.last.comments.where(:contents => "embedding").should_not be_empty
      end
    end
  end

  context "updating from the embedding collection" do
    it "should update document in root collection with new attributes" do
      c = article.comments.create(:contents => "embedding", :author => "embedding_author")
      c.update_attributes(:contents => "new_embedding", :author => "new_author_embedding")
      Comment.where(:contents => "new_embedding", :author => "new_author_embedding").first.id.should == c.id
    end

    it "should update similar document in embedding collection" do
      c = article.comments.create(:contents => "embedding", :author => "embedding_author")
      c.update_attributes(:contents => "new_embedding", :author => "new_author_embedding")
      article.reload
      article.comments.where(:contents => "new_embedding", :author => "new_author_embedding").first.id.should == c.id
    end

    it "should replicate changes to sibling collections" do
      c = article.comments.create(:user_id => user.id, :contents => "embedding", :author => "embedding_author")
      c.update_attributes(:contents => "new_embedding", :author => "new_author_embedding")
      user.reload
      user.comments.find(c.id).contents.should == "new_embedding"
    end
  end

  context "destroying from the root collection" do
    it "should destroy document in root collection" do
      c  = Comment.create(:article => article, :user => user, :contents => "root", :author => "root_author" )
      c.destroy
      Comment.where(:contents => "root").should be_empty
    end

    it "should destroy similar document in each embedding collection" do
      c  = Comment.create(:article => article, :user => user, :contents => "root", :author => "root_author" )
      c.destroy
      article.reload
      article.comments.where(:contents => "root").should be_empty
      user.reload
      user.comments.where(:contents => "root").should be_empty
    end
  end

  context "destroy from the embedding collection" do
    it "should destroy document in root collection" do
      c = article.comments.create(:contents => "embedding", :author => "embedding_author")
      c.destroy
      Comment.where(:contents => "embedding").should be_empty
    end

    it "should destroy similar document from embedding collection" do
      c = article.comments.create(:contents => "embedding", :author => "embedding_author")
      c.destroy
      article.reload
      article.comments.where(:contents => "embedding").should be_empty
    end

    it "should destroy document from sibling collections" do
      c = article.comments.create(:user_id => user.id, :contents => "embedding", :author => "embedding_author")
      c.destroy
      user.reload
      user.comments.where(:_id => c.id).should be_empty
    end
  end

  context "shared methods between root and mirrored classes" do
    it "should be able to call shared methods from the root collection" do
      Comment.new.foo.should == "bar"
    end
    it "should be able to call shared methods from the mirrored collection" do
      article.comments.new.foo.should == "bar"
    end
  end

end


text:
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="wrap_content" >

	<LinearLayout
	    android:layout_width="match_parent"
	    android:layout_height="wrap_content"
	    android:orientation="vertical"
	    android:paddingLeft="@dimen/activity_horizontal_margin"
	    android:paddingRight="@dimen/activity_horizontal_margin"
	    android:paddingBottom="@dimen/activity_vertical_margin" >

        <!-- Button (Default) -->
        <TextView
            android:text="@string/button_category_default"
            style="@style/SectionTextViewStyle" />
        <View style="@style/SectionDividerStyle" />

		<LinearLayout
		    android:layout_width="wrap_content"
		    android:layout_height="wrap_content"
		    android:orientation="horizontal" >
			<Button
			    style="@null"
			    android:id="@+id/listPopupButton"
			    android:layout_width="wrap_content"
			    android:layout_height="wrap_content"
			    android:text="@string/button_default" />

			<Button
			    style="@null"
			    android:layout_width="wrap_content"
			    android:layout_height="wrap_content"
			    android:enabled="false"
			    android:text="@string/button_disabled" />

			<Button
			    style="?android:attr/buttonStyleSmall"
			    android:layout_width="wrap_content"
			    android:layout_height="wrap_content"
			    android:text="@string/button_small" />
		</LinearLayout>

        <!-- Colored button -->
        <TextView
            android:text="@string/button_category_colored"
            style="@style/SectionTextViewStyle" />
        <View style="@style/SectionDividerStyle" />

        <LinearLayout
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:orientation="horizontal" >
            <Button
                android:id="@+id/coloredButton"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:color="?colorPrimary"
                android:text="@string/button_default" />

            <Button
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:color="?colorPrimary"
                android:enabled="false"
                android:text="@string/button_disabled" />

            <Button
                style="?android:attr/buttonStyleSmall"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:color="?colorPrimary"
                android:text="@string/button_small" />
        </LinearLayout>

        <LinearLayout
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:orientation="horizontal" >
            <Button
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:color="?colorPrimaryDark"
                android:text="@string/button_default" />

            <Button
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:color="?colorPrimaryDark"
                android:enabled="false"
                android:text="@string/button_disabled" />

            <Button
                style="?android:attr/buttonStyleSmall"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:color="?colorPrimaryDark"
                android:text="@string/button_small" />
        </LinearLayout>

        <LinearLayout
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:orientation="horizontal" >
            <Button
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:color="@color/button_color"
                android:text="@string/button_default" />

            <Button
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:enabled="false"
                android:text="@string/button_disabled" />

            <Button
                style="?android:attr/buttonStyleSmall"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:color="@color/button_color"
                android:text="@string/button_small" />
        </LinearLayout>

		<!-- Borderless button -->
        <TextView
            android:text="@string/button_category_borderless"
            style="@style/SectionTextViewStyle" />
        <View style="@style/SectionDividerStyle" />

		<LinearLayout
		    android:layout_width="wrap_content"
		    android:layout_height="wrap_content"
		    android:orientation="horizontal" >

            <Button
                style="?android:attr/borderlessButtonStyle"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="@string/button_borderless_default" />

            <Button
                style="?android:attr/borderlessButtonStyle"
                android:enabled="false"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="@string/button_borderless_disabled" />

            <Button
                style="?android:attr/borderlessButtonStyle"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:textColor="?attr/colorAccent"
                android:text="@string/button_borderless_colored" />

		</LinearLayout>

		<!-- Image buttons -->
        <TextView
            android:text="@string/button_category_imagebutton"
            style="@style/SectionTextViewStyle" />
        <View style="@style/SectionDividerStyle" />

        <LinearLayout
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:orientation="horizontal" >

            <ImageButton
                android:contentDescription="@string/button_image_default"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:padding="16dp"
                android:src="@drawable/ic_logo" />

            <ImageButton
                android:contentDescription="@string/button_image_colored"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:color="?colorPrimary"
                android:padding="16dp"
                android:src="@drawable/ic_logo" />

            <ImageButton
                android:contentDescription="@string/button_image_colored_bright"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:color="?colorPrimaryDark"
                android:padding="16dp"
                android:src="@drawable/ic_logo" />

        </LinearLayout>

		<!-- Toggle Button -->
        <TextView
            android:text="@string/button_category_toggle"
            style="@style/SectionTextViewStyle" />
        <View style="@style/SectionDividerStyle" />

		<LinearLayout
		    android:layout_width="match_parent"
		    android:layout_height="wrap_content"
		    android:orientation="horizontal" >
			<ToggleButton
			    android:layout_width="wrap_content"
			    android:layout_height="wrap_content" />
			<ToggleButton
			    android:layout_width="wrap_content"
			    android:layout_height="wrap_content"
			    android:enabled="false"
			    android:checked="false" />
			<ToggleButton
			    android:layout_width="wrap_content"
			    android:layout_height="wrap_content"
			    android:enabled="false"
			    android:checked="true" />
		</LinearLayout>

		<!-- Switch -->
        <TextView
            android:text="@string/button_category_switch"
            style="@style/SectionTextViewStyle" />
        <View style="@style/SectionDividerStyle" />

		<LinearLayout
		    android:layout_width="wrap_content"
		    android:layout_height="wrap_content"
		    android:orientation="horizontal" >
			<android.support.v7.widget.SwitchCompat
			    android:checked="true"
			    android:layout_width="wrap_content"
			    android:layout_height="wrap_content" />
			<android.support.v7.widget.SwitchCompat
			    android:enabled="false"
			    android:checked="true"
			    android:layout_width="wrap_content"
			    android:layout_height="wrap_content" />
			<android.support.v7.widget.SwitchCompat
			    android:enabled="false"
			    android:checked="false"
			    android:layout_width="wrap_content"
			    android:layout_height="wrap_content" />
		</LinearLayout>

	</LinearLayout>
</ScrollView>


text:
let Marionette = require('backbone.marionette');

let PanelModel = require('../models/accessionpanel');
let PanelCollection = require('../collections/accessionpanel');
let PanelListView = require('../views/accession/panel/panellist');
let EntityListFilterView = require('../../descriptor/views/entitylistfilter');
let DefaultLayout = require('../../main/views/defaultlayout');
let ScrollingMoreView = require('../../main/views/scrollingmore');
let TitleView = require('../../main/views/titleview');
let PanelLayout = require('../views/accession/panel/panellayout');

let Router = Marionette.AppRouter.extend({
    routes: {
        "app/accession/accessionpanel/": "getPanelList",
        "app/accession/accessionpanel/:id/*tab": "getPanel"
    },

    getPanelList: function (options) {
        options || (options = {});

        let collection = new PanelCollection({
            filters: (options.filters || {})
        });

        let defaultLayout = new DefaultLayout({});
        window.application.main.showContent(defaultLayout);

        defaultLayout.showChildView('title', new TitleView({title: _t("List of accession panels")}));

        let columns = window.application.main.cache.lookup({
            type: 'entity_columns',
            format: {model: 'accession.accessionpanel'}
        });

        columns.done(function (data) {
            let panelListView = new PanelListView({collection: collection, columns: data[0].value});

            defaultLayout.showChildView('content', panelListView);
            defaultLayout.showChildView('content-bottom', new ScrollingMoreView({
                collection: collection,
                targetView: panelListView
            }));

            defaultLayout.showChildView('bottom', new EntityListFilterView({
                collection: collection, columns: data[0].value
            }));

            panelListView.query();
        });
    },

    getPanel: function (id, tab) {
        tab || (tab = "accessions");

        let panel = new PanelModel({id: id});

        let defaultLayout = new DefaultLayout();
        window.application.main.showContent(defaultLayout);

        panel.fetch().then(function () {
            if (!defaultLayout.isRendered()) {
                return;
            }

            defaultLayout.showChildView('title', new TitleView({title: _t("Accession panel"), model: panel}));

            let panelLayout = new PanelLayout({model: panel, initialTab: tab.replace('/', '')});
            defaultLayout.showChildView('content', panelLayout);
        });
    }
});

module.exports = Router;


text:
package org.aming.web.qq;

import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;

@RunWith(SpringRunner.class)
@SpringBootTest
public class WebQqApplicationTests {

	@Test
	public void contextLoads() {
	}

}


text:
var t = db.geo_2d_explain;

load("jstests/libs/analyze_plan.js");

t.drop();

var n = 1000;

// insert n documents with integer _id, a can be 1-5, loc is close to [40, 40]
t.drop();
t.ensureIndex({loc: "2d", _id: 1});

var x = 40;
var y = 40;
for (var i = 0; i < n; i++) {
    // random number in range [1, 5]
    var a = Math.floor(Math.random() * 5) + 1;
    var dist = 4.0;
    var dx = (Math.random() - 0.5) * dist;
    var dy = (Math.random() - 0.5) * dist;
    var loc = [x + dx, y + dy];
    t.save({_id: i, a: a, loc: loc});
}

var explain = t.find({loc: {$near: [40, 40]}, _id: {$lt: 50}}).explain("executionStats");

var stats = explain.executionStats;
assert.eq(stats.nReturned, 50);
assert.lte(stats.nReturned, stats.totalDocsExamined);
assert.eq(stats.executionSuccess, true);

// Check for the existence of a indexVersion field in explain output.
var indexStages = getPlanStages(explain.queryPlanner.winningPlan, "GEO_NEAR_2D");
print(tojson(indexStages));
assert.gt(indexStages.length, 0);
for (var i = 0; i < indexStages.length; i++) {
    assert.gte(indexStages[i].indexVersion, 1);
}


text:
<?php
set_include_path(get_include_path().PATH_SEPARATOR.
                realpath("../src"));

require_once 'com/mikebevz/xsd2php/Wsdl.php';
require_once 'data/expected/ContactPersonWsdl/services/NavService.php';

use dk\nordsign\application\services;
use com\mikebevz\xsd2php\wsdl;

class WsdlTest extends PHPUnit_Framework_TestCase
{
/**
     * XSD to PHP convertor class
     * @var com\mikebevz\xsd2php\AbstractWsdl
     */
    private $tclass;

    private $expDir = "data/expected/ContactPersonWsdl";
    private $genDir = "data/generated/ContactPersonWsdl";

    protected function setUp ()
    {
        //$this->xsd = dirname(__FILE__)."/../resources/ubl2.0/maindoc/UBL-Order-2.0.xsd";
        $this->tclass = new wsdl\WsdlFactory();
    }
    protected function tearDown ()
    {
        $this->tclass = null;
    }

    public function testWsdlNavService() {

        if (file_exists($this->genDir)) {
            rmdir_recursive($this->genDir);
        }

        mkdir($this->genDir."/public/schemas", 0777, true);

        $service = new services\NavService();
        $this->tclass->setService($service);
        $this->tclass = $this->tclass->getImplementation($service);
        $this->tclass->setLocation("http://mylocation.com/soap/");
        $this->tclass->setSchemasPath("../resources/ContactWsdl");
        $this->tclass->setPublicPath(realpath($this->genDir."/public/schemas"));
        $this->tclass->setPublicUrl("/schemas");
        $this->tclass->setDebug(true);

        $schemas = array("CodeList_CurrencyCode_ISO_7_04.xsd",
                         "CodeList_LanguageCode_ISO_7_04.xsd",
                         "CodeList_MIMEMediaTypeCode_IANA_7_04.xsd",
                         "CodeList_UnitCode_UNECE_7_04.xsd",
                         "ContactCompany.xsd",
                         "ContactPerson.xsd",
                         "UBL-CommonAggregateComponents-2.0.xsd",
                         "UBL-CommonBasicComponents-2.0.xsd",
                         "UBL-QualifiedDatatypes-2.0.xsd",
                         "UnqualifiedDataTypeSchemaModule-2.0.xsd");

        $wsdl = $this->tclass->toXml();

        //print_r($wsdl);
        //file_put_contents($this->expDir."/NavService.wsdl", $wsdl);
        $expected = file_get_contents($this->expDir."/NavService.wsdl");

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

        foreach ($schemas as $schema) {
            $exp = file_get_contents($this->expDir."/public/schemas/".$schema);
            $act = file_get_contents($this->genDir."/public/schemas/".$schema);
            $this->assertEquals($exp, $act);
        }

        if (file_exists($this->genDir)) {
            rmdir_recursive($this->genDir);
        }
    }
}


text:
DIRECTORYTEST="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
echo $DIRECTORYTEST
set -o errexit
set -o verbose
rm -rf $1
mkdir $1
cp gerbers/* README.txt stackup.pdf $1
cp "$(basename $DIRECTORYTEST)".csv $1/bill_of_materials.csv
rm -f $1.zip
zip -r $1.zip $1


text:
package com.aspose.slides.maven.examples;

import com.aspose.slides.maven.utils.AbstractTask;
import com.aspose.slides.maven.utils.AsposeConstants;
import com.aspose.slides.maven.utils.AsposeMavenProjectManager;
import com.aspose.slides.maven.utils.AsposeSlidesJavaAPI;
import javax.swing.*;
import javax.swing.tree.TreePath;
import java.awt.*;
import javax.swing.tree.DefaultTreeModel;
import org.netbeans.api.progress.BaseProgressUtils;
import org.openide.WizardDescriptor;
import org.openide.util.Exceptions;
import org.openide.util.NbBundle;

public final class AsposeExamplePanel extends JPanel {

    AsposeExampleWizardPanel panel;

    /**
     * Creates new form AsposeExamplePanel
     *
     * @param panel
     */
    public AsposeExamplePanel(AsposeExampleWizardPanel panel) {
        initComponents();
        initComponentsUser();
        this.panel = panel;

    }

    private void initComponentsUser() {

        CustomMutableTreeNode top = new CustomMutableTreeNode("");

        DefaultTreeModel model = (DefaultTreeModel) getExamplesTree().getModel();
        model.setRoot(top);
        model.reload(top);

        validateDialog();
    }

    @Override
    public String getName() {
        return AsposeConstants.API_NAME + " for Java API - Code Examples";
    }

    private void initComponents() {

        jPanel1 = new JPanel();
        jLabel2 = new JLabel();
        componentSelection = new JComboBox();

        jLabel1 = new JLabel();
        jLabelMessage = new JLabel();
        jLabelMessage.setOpaque(true);
        jScrollPane1 = new JScrollPane();

        examplesTree = new JTree();

        jPanel1.setBackground(new Color(255, 255, 255));
        jPanel1.setBorder(BorderFactory.createEtchedBorder());
        jPanel1.setForeground(new Color(255, 255, 255));

        jLabel2.setIcon(icon); // NOI18N
        jLabel2.setText("");
        jLabel2.setHorizontalAlignment(SwingConstants.CENTER);
        jLabel2.setDoubleBuffered(true);
        jLabel2.setOpaque(true);
        jLabel2.addComponentListener(new java.awt.event.ComponentAdapter() {
            @Override
            public void componentResized(java.awt.event.ComponentEvent evt) {
                jLabel2ComponentResized(evt);
            }
        });

        GroupLayout jPanel1Layout = new GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
                jPanel1Layout.createParallelGroup()
                .addComponent(jLabel2, GroupLayout.PREFERRED_SIZE, 390, Short.MAX_VALUE)
        );
        jPanel1Layout.setVerticalGroup(
                jPanel1Layout.createParallelGroup()
                .addGroup(GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
                        .addComponent(jLabel2)
                        .addGap(0, 0, Short.MAX_VALUE))
        );
        componentSelection.setModel(new DefaultComboBoxModel());

        componentSelection.addPropertyChangeListener(new java.beans.PropertyChangeListener() {
            @Override
            public void propertyChange(java.beans.PropertyChangeEvent evt) {
                componentSelection_Propertychanged(evt);
            }
        });
        jLabel1.setText(NbBundle.getMessage(AsposeExamplePanel.class, "AsposeExample.jLabel1_text"));
        jLabelMessage.setText("");
        examplesTree.addMouseListener(new java.awt.event.MouseAdapter() {
            @Override
            //public void mouseClicked(java.awt.event.MouseEvent evt) { //here
            public void mousePressed(java.awt.event.MouseEvent evt) {
                examplesTree_clicked(evt);
            }
        });
        jScrollPane1.setViewportView(examplesTree);

        GroupLayout layout = new GroupLayout(this);
        this.setLayout(layout);
        layout.setHorizontalGroup(
                layout.createParallelGroup(GroupLayout.Alignment.LEADING)
                .addComponent(jScrollPane1)
                .addGroup(layout.createSequentialGroup()
                        .addComponent(jLabel1)
                        .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(componentSelection, GroupLayout.PREFERRED_SIZE, 198, GroupLayout.PREFERRED_SIZE))
                .addComponent(jLabelMessage, GroupLayout.PREFERRED_SIZE, 361, GroupLayout.PREFERRED_SIZE)
                .addComponent(jPanel1, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
        );
        layout.setVerticalGroup(
                layout.createParallelGroup(GroupLayout.Alignment.LEADING)
                .addGroup(layout.createSequentialGroup()
                        .addComponent(jPanel1, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(layout.createParallelGroup(GroupLayout.Alignment.BASELINE)
                                .addComponent(componentSelection, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
                                .addComponent(jLabel1, GroupLayout.PREFERRED_SIZE, 23, GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jScrollPane1, GroupLayout.PREFERRED_SIZE, 229, GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jLabelMessage, GroupLayout.PREFERRED_SIZE, 20, GroupLayout.PREFERRED_SIZE))
        );
    }

    private void jLabel2ComponentResized(java.awt.event.ComponentEvent evt) {
        int labelwidth = jLabel2.getWidth();
        int labelheight = jLabel2.getHeight();
        Image img = icon.getImage();
        jLabel2.setIcon(new ImageIcon(img.getScaledInstance(labelwidth, labelheight, Image.SCALE_FAST)));
    }

    /**
     *
     * @return
     */
    public String getSelectedProjectRootPath() {
        return AsposeMavenProjectManager.getInstance().getProjectDir().getPath();
    }

    void read() {
        retrieveAPIDependency();
        retrieveAPIExamples();
    }

    /**
     *
     * @return
     */
    private boolean retrieveAPIDependency() {
        getComponentSelection().removeAllItems();
        String versionNo = AsposeMavenProjectManager.getInstance().getDependencyVersionFromPOM(AsposeConstants.API_MAVEN_DEPENDENCY);
        if (versionNo == null) {
            getComponentSelection().addItem(AsposeConstants.API_DEPENDENCY_NOT_FOUND);
        } else {
            getComponentSelection().addItem(versionNo);
        }
        return true;
    }

    private void retrieveAPIExamples() {

        final String item = (String) getComponentSelection().getSelectedItem();

        if (item != null && !item.equals(AsposeConstants.API_DEPENDENCY_NOT_FOUND)) {

            // Downloading Aspose API mvn based examples
            AbstractTask downloadExamples = AsposeMavenProjectManager.getInstance().createDownloadExamplesTask(AsposeSlidesJavaAPI.getInstance());
            // Execute the tasks
            BaseProgressUtils.showProgressDialogAndRun(downloadExamples, NbBundle.getMessage(AsposeExamplePanel.class, "AsposeManager.updateExamplesMessage"));

            // Populating Aspose API mvn based examples
            Runnable popuplateExamples = AsposeMavenProjectManager.getInstance().populateExamplesTask(AsposeSlidesJavaAPI.getInstance(), this);
            // Execute the tasks
            BaseProgressUtils.showProgressDialogAndRun(popuplateExamples, NbBundle.getMessage(AsposeExamplePanel.class, "AsposeManager.populateExamplesMessage"));

            validateDialog();

        }

    }

    boolean valid(WizardDescriptor wizardDescriptor) {

        return validateDialog();
    }

    @Override
    public void validate() {

    }

    /**
     *
     * @return
     */
    public boolean validateDialog() {
        if (isExampleSelected()) {
            clearMessage();
            return true;
        }
        final String item = (String) getComponentSelection().getSelectedItem();
        if (item == null || item.equals(AsposeConstants.API_DEPENDENCY_NOT_FOUND)) {
            diplayMessage("Please first add maven dependency of " + AsposeConstants.API_NAME + " for java API", true);
            return false;
        } else if (!isExampleSelected()) {
            diplayMessage(AsposeConstants.ASPOSE_SELECT_EXAMPLE, true);
            return false;
        }
        clearMessage();
        return true;
    }

    /**
     *
     * @return
     */
    private boolean isExampleSelected() {
        CustomMutableTreeNode comp = (CustomMutableTreeNode) getExamplesTree().getLastSelectedPathComponent();
        if (comp == null) {
            return false;
        }
        try {

            if (!comp.isFolder()) {
                return false;
            }
        } catch (Exception ex) {
            Exceptions.printStackTrace(ex);
            return false;
        }
        return true;
    }

    /**
     *
     * @param message
     * @param error
     */
    public void diplayMessage(String message, boolean error) {

        if (error) {
            jLabelMessage.setForeground(Color.RED);
        } else {
            jLabelMessage.setForeground(Color.GREEN);
        }
        jLabelMessage.setText(message);
    }

    private void clearMessage() {
        jLabelMessage.setText("");

    }

    /**
     *
     * @param title
     * @param message
     * @param buttons
     * @param icon
     * @return
     */
    public int showMessage(String title, String message, int buttons, int icon) {
        int result = JOptionPane.showConfirmDialog(null, message, title, buttons, icon);
        return result;
    }

    private void componentSelection_Propertychanged(java.beans.PropertyChangeEvent evt) {

    }

    private void examplesTree_clicked(java.awt.event.MouseEvent evt) {
        TreePath path = getExamplesTree().getSelectionPath();
        panel.fireChangeEvent();
    }

    // Variables declaration
    private JComboBox componentSelection;
    private JTree examplesTree;
    private JLabel jLabel1;
    private JLabel jLabel2;
    private JLabel jLabelMessage;
    private JPanel jPanel1;
    private JScrollPane jScrollPane1;
    private ImageIcon icon = new ImageIcon(getClass().getResource("/resources/long-banner.png"));
    // End of variables declaration

    /**
     * @return the examplesTree
     */
    public JTree getExamplesTree() {
        return examplesTree;
    }

    /**
     * @return the componentSelection
     */
    public JComboBox getComponentSelection() {
        return componentSelection;
    }
}


text:
import PopupCoordinator from '../popup-coordinator';

export default class ComponentPopup extends PopupCoordinator {}


text:
package org.elasticsearch.xpack.ml.action;

import org.elasticsearch.action.ActionListener;
import org.elasticsearch.action.support.ActionFilters;
import org.elasticsearch.action.support.master.TransportMasterNodeAction;
import org.elasticsearch.client.Client;
import org.elasticsearch.cluster.ClusterState;
import org.elasticsearch.cluster.block.ClusterBlockException;
import org.elasticsearch.cluster.block.ClusterBlockLevel;
import org.elasticsearch.cluster.metadata.IndexNameExpressionResolver;
import org.elasticsearch.cluster.service.ClusterService;
import org.elasticsearch.common.inject.Inject;
import org.elasticsearch.common.io.stream.StreamInput;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.common.xcontent.NamedXContentRegistry;
import org.elasticsearch.persistent.PersistentTasksCustomMetaData;
import org.elasticsearch.tasks.Task;
import org.elasticsearch.threadpool.ThreadPool;
import org.elasticsearch.transport.TransportService;
import org.elasticsearch.xpack.core.ml.MlTasks;
import org.elasticsearch.xpack.core.ml.action.PutDatafeedAction;
import org.elasticsearch.xpack.core.ml.action.UpdateDatafeedAction;
import org.elasticsearch.xpack.core.ml.datafeed.DatafeedState;
import org.elasticsearch.xpack.core.ml.job.messages.Messages;
import org.elasticsearch.xpack.core.ml.utils.ExceptionsHelper;
import org.elasticsearch.xpack.ml.MlConfigMigrationEligibilityCheck;
import org.elasticsearch.xpack.ml.datafeed.persistence.DatafeedConfigProvider;
import org.elasticsearch.xpack.ml.job.persistence.JobConfigProvider;

import java.io.IOException;
import java.util.Map;

public class TransportUpdateDatafeedAction extends
    TransportMasterNodeAction<UpdateDatafeedAction.Request, PutDatafeedAction.Response> {

    private final Client client;
    private final DatafeedConfigProvider datafeedConfigProvider;
    private final JobConfigProvider jobConfigProvider;
    private final MlConfigMigrationEligibilityCheck migrationEligibilityCheck;

    @Inject
    public TransportUpdateDatafeedAction(Settings settings, TransportService transportService, ClusterService clusterService,
                                         ThreadPool threadPool, ActionFilters actionFilters,
                                         IndexNameExpressionResolver indexNameExpressionResolver,
                                         Client client, NamedXContentRegistry xContentRegistry) {
        super(UpdateDatafeedAction.NAME, transportService, clusterService, threadPool, actionFilters, UpdateDatafeedAction.Request::new,
                indexNameExpressionResolver);

        this.client = client;
        this.datafeedConfigProvider = new DatafeedConfigProvider(client, xContentRegistry);
        this.jobConfigProvider = new JobConfigProvider(client, xContentRegistry);
        this.migrationEligibilityCheck = new MlConfigMigrationEligibilityCheck(settings, clusterService);
    }

    @Override
    protected String executor() {
        return ThreadPool.Names.SAME;
    }

    @Override
    protected PutDatafeedAction.Response read(StreamInput in) throws IOException {
        return new PutDatafeedAction.Response(in);
    }

    @Override
    protected void masterOperation(Task task, UpdateDatafeedAction.Request request, ClusterState state,
                                   ActionListener<PutDatafeedAction.Response> listener) throws Exception {

        if (migrationEligibilityCheck.datafeedIsEligibleForMigration(request.getUpdate().getId(), state)) {
            listener.onFailure(ExceptionsHelper.configHasNotBeenMigrated("update datafeed", request.getUpdate().getId()));
            return;
        }

        final Map<String, String> headers = threadPool.getThreadContext().getHeaders();

        // Check datafeed is stopped
        PersistentTasksCustomMetaData tasks = state.getMetaData().custom(PersistentTasksCustomMetaData.TYPE);
        if (MlTasks.getDatafeedTask(request.getUpdate().getId(), tasks) != null) {
            listener.onFailure(ExceptionsHelper.conflictStatusException(
                    Messages.getMessage(Messages.DATAFEED_CANNOT_UPDATE_IN_CURRENT_STATE,
                            request.getUpdate().getId(), DatafeedState.STARTED)));
            return;
        }

        datafeedConfigProvider.updateDatefeedConfig(
            request.getUpdate().getId(),
            request.getUpdate(),
            headers,
            jobConfigProvider::validateDatafeedJob,
            ActionListener.wrap(
                updatedConfig -> listener.onResponse(new PutDatafeedAction.Response(updatedConfig)),
                listener::onFailure));
    }

    @Override
    protected ClusterBlockException checkBlock(UpdateDatafeedAction.Request request, ClusterState state) {
        return state.blocks().globalBlockedException(ClusterBlockLevel.METADATA_WRITE);
    }
}


text:
//
//  const.h
//  d3key
//
//  Created by sunghyuk on 2016. 3. 3..
//  Copyright © 2016년 sunghyuk. All rights reserved.
//

#ifndef const_h
#define const_h

static NSString * const kDiablo3AppId = @"com.blizzard.diablo3";
//static NSString * const kDiablo3AppId = @"com.github.atom";

static NSString * const kD3KeyConfigUserDefaultsKey = @"d3keyconfig";

static NSString * const kD3KeyStartStopNotification = @"d3keystartstopnote";
static NSString * const kD3KeyConfigChangedNotification = @"d3keyconfigchanged";
static NSString * const kD3KeyActivatedNotification = @"d3keyactivated";
static NSString * const kD3KeyDeactivatedNotification = @"d3keydeactivated";

#ifdef DEBUG
#   define NSLog(...) NSLog(__VA_ARGS__)
#else
#   define NSLog(...)
#endif

#endif /* const_h */