text:
require 'spec_helper'

describe Gitlab::Template::GitignoreTemplate do
  subject { described_class }

  describe '.all' do
    it 'strips the gitignore suffix' do
      expect(subject.all.first.name).not_to end_with('.gitignore')
    end

    it 'combines the globals and rest' do
      all = subject.all.map(&:name)

      expect(all).to include('Vim')
      expect(all).to include('Ruby')
    end
  end

  describe '.find' do
    it 'returns nil if the file does not exist' do
      expect(subject.find('mepmep-yadida')).to be nil
    end

    it 'returns the Gitignore object of a valid file' do
      ruby = subject.find('Ruby')

      expect(ruby).to be_a described_class
      expect(ruby.name).to eq('Ruby')
    end
  end

  describe '#content' do
    it 'loads the full file' do
      gitignore = subject.new(Rails.root.join('vendor/gitignore/Ruby.gitignore'))

      expect(gitignore.name).to eq 'Ruby'
      expect(gitignore.content).to start_with('*.gem')
    end
  end
end


text:
extensions = ['sphinx.ext.autodoc',
    'sphinx.ext.doctest',
    'sphinx.ext.intersphinx',
    'sphinx.ext.todo',
    'sphinx.ext.coverage',
    'sphinx.ext.mathjax',
    'sphinx.ext.ifconfig',
    'sphinx.ext.viewcode',
    'sphinx.ext.githubpages']

# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']

# The suffix(es) of source filenames.
# You can specify multiple suffix as a list of string:
#
# source_suffix = ['.rst', '.md']
from recommonmark.parser import CommonMarkParser

source_parsers = {
    '.md': CommonMarkParser,
}

source_suffix = ['.rst', '.md']

# The master toctree document.
master_doc = 'index'

# General information about the project.
project = u'restutils'
copyright = u'2017, Pulak Pattanayak'
author = u'Pulak Pattanayak'

# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
# built documents.
#
# The short X.Y version.
version = u'1.0.0'
# The full version, including alpha/beta/rc tags.
release = u'1.0.2'

# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
#
# This is also used if you do content translation via gettext catalogs.
# Usually you set "language" from the command line for these cases.
language = None

# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
# This patterns also effect to html_static_path and html_extra_path
exclude_patterns = []

# The name of the Pygments (syntax highlighting) style to use.
pygments_style = 'sphinx'

# If true, `todo` and `todoList` produce output, else they produce nothing.
todo_include_todos = True

# -- Options for HTML output ----------------------------------------------

# The theme to use for HTML and HTML Help pages.  See the documentation for
# a list of builtin themes.
#
html_theme = 'alabaster'

# Theme options are theme-specific and customize the look and feel of a theme
# further.  For a list of options available for each theme, see the
# documentation.
#
# html_theme_options = {}

# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = ['_static']

# -- Options for HTMLHelp output ------------------------------------------

# Output file base name for HTML help builder.
htmlhelp_basename = 'restutilsdoc'

# -- Options for LaTeX output ---------------------------------------------

latex_elements = {
    # The paper size ('letterpaper' or 'a4paper').
    #
    # 'papersize': 'letterpaper',

    # The font size ('10pt', '11pt' or '12pt').
    #
    # 'pointsize': '10pt',

    # Additional stuff for the LaTeX preamble.
    #
    # 'preamble': '',

    # Latex figure (float) alignment
    #
    # 'figure_align': 'htbp',
}

# Grouping the document tree into LaTeX files. List of tuples
# (source start file, target name, title,
#  author, documentclass [howto, manual, or own class]).
latex_documents = [
    (master_doc, 'restutils.tex', u'restutils Documentation',
     u'Pulak Pattanayak', 'manual'),
]

# -- Options for manual page output ---------------------------------------

# One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section).
man_pages = [
    (master_doc, 'restutils', u'restutils Documentation',
     [author], 1)
]

# -- Options for Texinfo output -------------------------------------------

# Grouping the document tree into Texinfo files. List of tuples
# (source start file, target name, title, author,
#  dir menu entry, description, category)
texinfo_documents = [
    (master_doc, 'restutils', u'restutils Documentation',
     author, 'restutils', 'One line description of project.',
     'Miscellaneous'),
]

# -- Options for Epub output ----------------------------------------------

# Bibliographic Dublin Core info.
epub_title = project
epub_author = author
epub_publisher = author
epub_copyright = copyright

# The unique identifier of the text. This can be a ISBN number
# or the project homepage.
#
# epub_identifier = ''

# A unique identification for the text.
#
# epub_uid = ''

# A list of files that should not be packed into the epub file.
epub_exclude_files = ['search.html']

# Example configuration for intersphinx: refer to the Python standard library.
intersphinx_mapping = {'https://docs.python.org/': None}

redpajama_set_name: RedPajamaGithub


text:
.class public abstract Landroid/util/FloatProperty;
.super Landroid/util/Property;
.source "FloatProperty.java"

# annotations
.annotation system Ldalvik/annotation/Signature;
    value = {
        "<T:",
        "Ljava/lang/Object;",
        ">",
        "Landroid/util/Property",
        "<TT;",
        "Ljava/lang/Float;",
        ">;"
    }
.end annotation

# direct methods
.method public constructor <init>(Ljava/lang/String;)V
    .locals 1
    .param p1, "name"    # Ljava/lang/String;

    .prologue
    .line 34
    .local p0, "this":Landroid/util/FloatProperty;, "Landroid/util/FloatProperty<TT;>;"
    const-class v0, Ljava/lang/Float;

    invoke-direct {p0, v0, p1}, Landroid/util/Property;-><init>(Ljava/lang/Class;Ljava/lang/String;)V

    .line 35
    return-void
.end method

# virtual methods
.method public final set(Ljava/lang/Object;Ljava/lang/Float;)V
    .locals 1
    .param p2, "value"    # Ljava/lang/Float;
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "(TT;",
            "Ljava/lang/Float;",
            ")V"
        }
    .end annotation

    .prologue
    .line 45
    .local p0, "this":Landroid/util/FloatProperty;, "Landroid/util/FloatProperty<TT;>;"
    .local p1, "object":Ljava/lang/Object;, "TT;"
    invoke-virtual {p2}, Ljava/lang/Float;->floatValue()F

    move-result v0

    invoke-virtual {p0, p1, v0}, Landroid/util/FloatProperty;->setValue(Ljava/lang/Object;F)V

    .line 46
    return-void
.end method

.method public bridge synthetic set(Ljava/lang/Object;Ljava/lang/Object;)V
    .locals 0

    .prologue
    .line 31
    .local p0, "this":Landroid/util/FloatProperty;, "Landroid/util/FloatProperty<TT;>;"
    check-cast p2, Ljava/lang/Float;

    invoke-virtual {p0, p1, p2}, Landroid/util/FloatProperty;->set(Ljava/lang/Object;Ljava/lang/Float;)V

    return-void
.end method

.method public abstract setValue(Ljava/lang/Object;F)V
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "(TT;F)V"
        }
    .end annotation
.end method


text:
'use strict'

const bitcoin = require('@tradle/bitcoinjs-lib')
const Wallet = require('./')

// wallet => transactor API (tradle/transactor)
module.exports = function transactorClient (opts) {
  const wallet = opts.wallet || new Wallet(opts)
  return {
    send: function (opts, cb) {
      const spender = wallet.send()
      opts.to.forEach(function (to) {
        let address = to.address
        if (!address) {
          address = bitcoin.ECPubKey.fromHex(to.pubKey)
            .getAddress(wallet.networkName)
            .toString()
        }

        spender.to(address, to.amount)
      })

      spender.execute(cb)
    }
  }
}


text:
<?php
/**
 * Created by PhpStorm.
 * User: higakiyuusuke
 * Date: 2014/06/17
 * Time: 11:08
 */
namespace Yusuke\SnapBundle\Command;

use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;

/**
 * TransitionPictureFromS3Command.
 */
class TransitionPictureFromS3Command extends ContainerAwareCommand
{
    protected function configure()
    {
        $this
            ->setName('yusuke:snap:transition-picture-from-s3')
            ->setDescription('S3から画像を移行する')
            ;
    }

    protected function execute(InputInterface $input, OutputInterface $output)
    {
        $modelRepository = $this->getContainer()->get('doctrine')->getRepository('YusukeSnapBundle:Model');
        $models = $modelRepository->selectAllModel();
        $uploadDir = $this->getContainer()->get('kernel')->getRootDir() . '/../web/img/model/original/';

        for ($i = 0 ; $i < count($models) ; $i++){
            if ($models[$i]->getPic1()) $data = file_get_contents($this->getContainer()->getParameter('amazon_s3_original').$models[$i]->getPic1());
            file_put_contents($uploadDir.$models[$i]->getPic1(), $data);
            if ($models[$i]->getPic2()) $data = file_get_contents($this->getContainer()->getParameter('amazon_s3_original').$models[$i]->getPic2());
            file_put_contents($uploadDir.$models[$i]->getPic2(), $data);
            if ($models[$i]->getPic3()) $data = file_get_contents($this->getContainer()->getParameter('amazon_s3_original').$models[$i]->getPic3());
            file_put_contents($uploadDir.$models[$i]->getPic3(), $data);
        }

        $output->writeln(sprintf('<info>S3から画像を移行しました</info>'));
    }
}


text:
CREATE TABLE buildStageTable (
  id INT NOT NULL AUTO_INCREMENT,
  build_id INT NOT NULL,
  name VARCHAR(80) NOT NULL,
  board VARCHAR(80),
  status ENUM('fail', 'pass') NOT NULL,
  log_url VARCHAR(240),
  duration_seconds INT NOT NULL,
  summary BLOB,
  PRIMARY KEY (id),
  FOREIGN KEY (build_id)
    REFERENCES buildTable(id),
  INDEX (build_id)
);

INSERT INTO schemaVersionTable (schemaVersion, scriptName) VALUES
  (4, '00004_create_buildstage_table.sql');


text:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">

<mapper namespace="com.bootdo.finance.dao.FinancialAcountDao">

	<!-- 可根据自己的需求,是否要使用 -->
    <resultMap type="com.bootdo.blog.entity.FinancialAcountEntity" id="financialAcountMap">
        <result property="id" column="id"/>
        <result property="expendId" column="expend_id"/>
        <result property="incomeId" column="income_id"/>
        <result property="acountType" column="acount_type"/>
        <result property="totalExpend" column="total_expend"/>
        <result property="totalIncome" column="total_income"/>
        <result property="totalAcount" column="total_acount"/>
        <result property="oldAcount" column="old_acount"/>
        <result property="createTime" column="create_time"/>
        <result property="updateTime" column="update_time"/>
        <result property="createUser" column="create_user"/>
        <result property="updateUser" column="update_user"/>
    </resultMap>

	<select id="queryObject" resultType="com.bootdo.blog.entity.FinancialAcountEntity">
		select * from financial_acount where id = #{value}
	</select>

	<select id="queryList" resultType="com.bootdo.blog.entity.FinancialAcountEntity">
		select * from financial_acount
        <choose>
            <when test="sidx != null and sidx.trim() != ''">
                order by ${sidx} ${order}
            </when>
			<otherwise>
                order by id desc
			</otherwise>
        </choose>
		<if test="offset != null and limit != null">
			limit #{offset}, #{limit}
		</if>
	</select>

 	<select id="queryTotal" resultType="int">
		select count(*) from financial_acount
	</select>

	<insert id="save" parameterType="com.bootdo.blog.entity.FinancialAcountEntity" useGeneratedKeys="true" keyProperty="id">
		insert into financial_acount
		(
			`expend_id`,
			`income_id`,
			`acount_type`,
			`total_expend`,
			`total_income`,
			`total_acount`,
			`old_acount`,
			`create_time`,
			`update_time`,
			`create_user`,
			`update_user`
		)
		values
		(
			#{expendId},
			#{incomeId},
			#{acountType},
			#{totalExpend},
			#{totalIncome},
			#{totalAcount},
			#{oldAcount},
			#{createTime},
			#{updateTime},
			#{createUser},
			#{updateUser}
		)
	</insert>

	<update id="update" parameterType="com.bootdo.blog.entity.FinancialAcountEntity">
		update financial_acount
		<set>
			<if test="expendId != null">`expend_id` = #{expendId}, </if>
			<if test="incomeId != null">`income_id` = #{incomeId}, </if>
			<if test="acountType != null">`acount_type` = #{acountType}, </if>
			<if test="totalExpend != null">`total_expend` = #{totalExpend}, </if>
			<if test="totalIncome != null">`total_income` = #{totalIncome}, </if>
			<if test="totalAcount != null">`total_acount` = #{totalAcount}, </if>
			<if test="oldAcount != null">`old_acount` = #{oldAcount}, </if>
			<if test="createTime != null">`create_time` = #{createTime}, </if>
			<if test="updateTime != null">`update_time` = #{updateTime}, </if>
			<if test="createUser != null">`create_user` = #{createUser}, </if>
			<if test="updateUser != null">`update_user` = #{updateUser}</if>
		</set>
		where id = #{id}
	</update>

	<delete id="delete">
		delete from financial_acount where id = #{value}
	</delete>

	<delete id="deleteBatch">
		delete from financial_acount where id in
		<foreach item="id" collection="array" open="(" separator="," close=")">
			#{id}
		</foreach>
	</delete>

</mapper>


text:
[![StyleCI](https://styleci.io/repos/96553078/shield?branch=master)](https://styleci.io/repos/96553078)
[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/Surge-Financial/laravel-salesforce/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/Surge-Financial/laravel-salesforce/?branch=master)
[![Build Status](https://travis-ci.org/Surge-Financial/laravel-salesforce.svg?branch=master)](https://travis-ci.org/Surge-Financial/laravel-salesforce)
# Salesforce package for Laravel

This package makes it easy to communicate with Salesforce.

## Installation

You can install the package via composer:

``` bash
composer require surge-financial/salesforce-laravel:"dev-master"
```

## .env Configs

Set the following variables in .env
``` bash
SALESFORCE_AUTH_ENDPOINT=<AUTH_ENDPOINT> (e.g. https://login.salesforce.com/services/oauth2/token for the salesforce live env)
SALESFORCE_CLIENT_ID=<CLIENT_ID>
SALESFORCE_CLIENT_SECRET=<SECRET>
SALESFORCE_USERNAME=<USERNAME>
SALESFORCE_PASSWORD=<PASSWORD>
SALESFORCE_URL=<URL> (e.g. https://eu6.salesforce.com)
SALESFORCE_LEAD_RT=<LEAD_RECORD_TYPE>
SALESFORCE_ACCOUNT_RT=<ACCOUNT_RECORD_TYPE>
SALESFORCE_OPPURTUNITY_RT=<OPPURTUNITY_RECORD_TYPE>
SALESFORCE_TASK_RT=<TASK_RECORD_TYPE>
SALESFORCE_BRAND=<BRAND>
SALESFORCE_BCC_EMAIL=<BBC_EMAIL>
```

## Service provider
Second you must install the service provider:

``` php
// config/app.php
'providers' => [
    ...
    Surge\LaravelSalesforce\SalesforceServiceProvider::class
],

'aliases' => [
    ...
    'Salesforce'   => Surge\LaravelSalesforce\Facade::class,
]

```

## Publish package files
Next publish the config with:

``` bash
php artisan vendor:publish --provider="Surge\LaravelSalesforce\SalesforceServiceProvider"
```

## Register log event
In order to log all Salesforce requests and responses - add the following code in Events/EventsServiceProvider $listen array.
``` php

RequestSent::class => [
    <YourListenerClass>::class,
]

ResponseReceived::class => [
    <YourListenerClass>::class,
]

```

## Usage:

``` php

use Salesforce;

//Get opportunity
Salesforce::getOpportunity($id);

//Create new account
Salesforce::createAccount($params);

//Check if account exists
Salesforce::existsAccount(['PersonEmail' => 'test@test.com']);

//To check for more than one parameter with OR condition
Salesforce::existsAccount(['PersonEmail' => 'test@test.com', 'Phone' => '07846000111'], 'OR');

```

## Working on local
By default on local environment it is disabled.
To enable the package to work on local mode:
``` bash
SALESFORCE_DISABLE_ON_LOCAL=false
```
## Using the salesforce sandbox
You must first setup a sandbox environment on salesforce.
Then modify the following variables in your .env.
``` bash
SALESFORCE_AUTH_ENDPOINT (e.g. https://test.salesforce.com/services/oauth2/token)
SALESFORCE_USERNAME
SALESFORCE_PASSWORD
```
Also if your Laravel env is local then ensure that the following key is set to false:
``` bash
SALESFORCE_DISABLE_ON_LOCAL=false
```
## Upgrading to version 0.2.5
Ensure that you republish the config file so that the following line appears at the top:
``` bash
return [
    'auth_endpoint'   => env('SALESFORCE_AUTH_ENDPOINT'),
    ...
    ]
```


text:
define(['jquery/form/validate'], function () {
    return {
        startup: function () {
            this._handleRegisterForm();
        },

        _handleRegisterForm: function () {
            // Validation
            $("#sky-form4").validate({
                // Rules for form validation
                rules: {
                    username: {
                        required: true
                    },
                    email: {
                        required: true,
                        email: true
                    },
                    password: {
                        required: true,
                        minlength: 3,
                        maxlength: 20
                    },
                    passwordConfirm: {
                        required: true,
                        minlength: 3,
                        maxlength: 20,
                        equalTo: '#password'
                    },
                    firstname: {
                        required: true
                    },
                    lastname: {
                        required: true
                    },
                    terms: {
                        required: true
                    }
                },

                // Messages for form validation
                messages: {
                    login: {
                        required: 'Please enter your login'
                    },
                    email: {
                        required: 'Please enter your email address',
                        email: 'Please enter a VALID email address'
                    },
                    password: {
                        required: 'Please enter your password'
                    },
                    passwordConfirm: {
                        required: 'Please enter your password one more time',
                        equalTo: 'Please enter the same password as above'
                    },
                    firstname: {
                        required: 'Please select your first name'
                    },
                    lastname: {
                        required: 'Please select your last name'
                    },
                    terms: {
                        required: 'You must agree with Terms and Conditions'
                    }
                },

                // Do not change code below
                errorPlacement: function (error, element) {
                    error.insertAfter(element.parent());
                }
            });
        }
    }
});


text:
package com.baidu.oped.apm.bootstrap.plugin.jdbc.bindvalue;

import com.baidu.oped.apm.bootstrap.util.StringUtils;

/**
 * @author emeroad
 */
public class SimpleTypeConverter implements Converter {
    @Override
    public String convert(Object[] args) {
        if (args == null) {
            return "null";
        }
        if (args.length == 2) {
            return StringUtils.drop(StringUtils.toString(args[1]));
        } else if (args.length == 3) {
            // need to handle 3rd arg?
            return StringUtils.drop(StringUtils.toString(args[1]));
        }
        return "error";
    }
}


text:
package bmp

import (
	"errors"

	clients "github.com/cloudfoundry-community/bosh-softlayer-tools/clients"
	cmds "github.com/cloudfoundry-community/bosh-softlayer-tools/cmds"
	common "github.com/cloudfoundry-community/bosh-softlayer-tools/common"
	config "github.com/cloudfoundry-community/bosh-softlayer-tools/config"
)

type loginCommand struct {
	options cmds.Options

	ui      common.UI
	printer common.Printer

	bmpClient clients.BmpClient
}

func NewLoginCommand(options cmds.Options, bmpClient clients.BmpClient) loginCommand {
	consoleUi := common.NewConsoleUi(options.Verbose)

	return loginCommand{
		options: options,

		ui:      consoleUi,
		printer: common.NewDefaultPrinter(consoleUi, options.Verbose),

		bmpClient: bmpClient,
	}
}

func (cmd loginCommand) Name() string {
	return "login"
}

func (cmd loginCommand) Description() string {
	return "Login to the Bare Metal Provision Server"
}

func (cmd loginCommand) Usage() string {
	return "bmp login --username[-u] <username> --password[-p] <password>"
}

func (cmd loginCommand) Options() cmds.Options {
	return cmd.options
}

func (cmd loginCommand) Validate() (bool, error) {
	_, err := cmd.printer.Printf("Validating %s command: options: %#v", cmd.Name(), cmd.options)
	if err != nil {
		return false, err
	}

	if cmd.options.Username == "" {
		return false, errors.New("cannot have empty username")
	}

	if cmd.options.Password == "" {
		return false, errors.New("cannot have empty password")
	}

	return true, nil
}

func (cmd loginCommand) Execute(args []string) (int, error) {
	_, err := cmd.printer.Printf("Executing %s comamnd: args: %#v, options: %#v", cmd.Name(), args, cmd.options)
	if err != nil {
		return 1, err
	}

	loginResponse, err := cmd.bmpClient.Login(cmd.options.Username, cmd.options.Password)
	if err != nil {
		return loginResponse.Status, err
	}

	if loginResponse.Status != 200 {
		return loginResponse.Status, nil
	}

	c := config.NewConfig(cmd.bmpClient.ConfigPath())
	configInfo, err := c.LoadConfig()
	if err != nil {
		return 1, err
	}

	configInfo.Username = cmd.options.Username
	configInfo.Password = cmd.options.Password

	err = c.SaveConfig(configInfo)
	if err != nil {
		return 1, err
	}

	_, err = cmd.ui.PrintfInfo("Login Successful!\n")
	if err != nil {
		return 1, err
	}
	return 0, nil
}


text:
This simple website is a catalog of all  the freeCodeCamp study groups around the world (that we know about).

If the user allows location access the groups closest to your browser location are displayed at the top of the page. Alternatively, you can search for groups by place name.

Find the directory here [freeCodeCamp Study Groups](https://study-group-directory.freecodecamp.org/)

If you wish to contribute by adding entries, fixing problems or otherwise improving the directory please refer to [CONTRIBUTING.md](https://github.com/freeCodeCamp/study-group-directory/blob/master/.github/CONTRIBUTING.md)


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/xsd/maven-4.0.0.xsd">

	<modelVersion>4.0.0</modelVersion>

	<groupId>com.selau.thoughtworks</groupId>
	<artifactId>railroad-services</artifactId>
	<version>1.0</version>
	<packaging>jar</packaging>

	<name>railroad-services</name>
	<url>https://br.linkedin.com/in/guilhermeselau</url>

	<properties>

		<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>

		<maven.compiler.source>1.7</maven.compiler.source>
		<maven.compiler.target>1.7</maven.compiler.target>

		<downloadSources>true</downloadSources>
		<downloadJavadocs>true</downloadJavadocs>

		<java.source.version>1.7</java.source.version>
		<java.target.version>1.7</java.target.version>

		<!-- Plugins -->
		<maven-compiler-plugin.version>3.3</maven-compiler-plugin.version>
		<maven-jar-plugin.version>2.6</maven-jar-plugin.version>

		<!-- Dependencies -->
		<junit.version>4.12</junit.version>

	</properties>

	<dependencyManagement>
		<dependencies>

			<!-- *** TEST *** -->
			<dependency>
				<groupId>junit</groupId>
				<artifactId>junit</artifactId>
				<version>${junit.version}</version>
				<scope>test</scope>
			</dependency>

		</dependencies>
	</dependencyManagement>

	<dependencies>

		<!-- *** TEST *** -->
		<dependency>
			<groupId>junit</groupId>
			<artifactId>junit</artifactId>
			<scope>test</scope>
		</dependency>

	</dependencies>

	<build>
		<plugins>

			<plugin>
				<!-- Build an executable JAR -->
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-jar-plugin</artifactId>
				<version>${maven-jar-plugin.version}</version>
				<configuration>
					<archive>
						<manifest>
							<addClasspath>true</addClasspath>
							<classpathPrefix>lib/</classpathPrefix>
							<mainClass>com.selau.thoughtworks.railroad.Main</mainClass>
						</manifest>
					</archive>
				</configuration>
			</plugin>

			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-compiler-plugin</artifactId>
				<version>${maven-compiler-plugin.version}</version>
				<configuration>
					<source>${java.source.version}</source>
					<target>${java.target.version}</target>
				</configuration>
			</plugin>

		</plugins>
	</build>

</project>


text:
package types

// ShardProfile type.
//
// https://github.com/elastic/elasticsearch-specification/blob/4ca0cc05d3ae3fa06c2cd7be91905b656a474334/specification/_global/search/_types/profile.ts#L132-L137
type ShardProfile struct {
	Aggregations []AggregationProfile `json:"aggregations"`
	Fetch        *FetchProfile        `json:"fetch,omitempty"`
	Id           string               `json:"id"`
	Searches     []SearchProfile      `json:"searches"`
}

// NewShardProfile returns a ShardProfile.
func NewShardProfile() *ShardProfile {
	r := &ShardProfile{}

	return r
}


text:
__revision__ = "test/implicit-cache/GetOption.py rel_2.5.1:3735:9dc6cee5c168 2016/11/03 14:02:02 bdbaddog"

"""
Verify that SetOption/GetOption('implicit_cache') works and can
be overridden from the command line.
"""

import TestSCons

test = TestSCons.TestSCons()

test.write('SConstruct', """
assert not GetOption('implicit_cache')
SetOption('implicit_cache', 1)
assert GetOption('implicit_cache')
""")

test.run()

test.write('SConstruct', """
assert GetOption('implicit_cache')
SetOption('implicit_cache', 0)
assert GetOption('implicit_cache')
""")

test.run(arguments='--implicit-cache')

test.pass_test()

# Local Variables:
# tab-width:4
# indent-tabs-mode:nil
# End:
# vim: set expandtab tabstop=4 shiftwidth=4:


text:
      {% if paginator.previous_page %}
        {% if paginator.previous_page == 1 %}

«

        {% else %}

«

        {% endif %}
      {% endif %}

Pagina {{paginator.page}} de {{paginator.total_pages}}

      {% if paginator.next_page %}

»

      {% endif %}


text:
<?php
namespace Tbbc\MoneyBundle\Pair;

/**
 * Interface StorageInterface
 * @package Tbbc\MoneyBundle\Pair
 * @author Philippe Le Van.
 */
interface StorageInterface
{
    /**
     * save ratio list in a storage
     *
     * @param array $ratioList
     */
    public function saveRatioList($ratioList);

    /**
     * load ratioList from the storage
     *
     * @param bool $force
     *
     * @return array of type array("EUR"=>1, "USD" => 1.25)
     */
    public function loadRatioList($force = false);
}


text:
using System;
using System.Runtime.InteropServices;
using Microsoft.Xna.Framework.Graphics;
using SharpDX.Direct3D9;
using DeviceType = SharpDX.Direct3D9.DeviceType;
using PresentInterval = SharpDX.Direct3D9.PresentInterval;
using Texture = SharpDX.Direct3D9.Texture;

namespace FellSky.Editor
{
    /// <summary>
    /// Represents a Direct3D 9 device required for Direct3D 11 interoperability.
    /// </summary>
    /// <remarks>
    /// It is not possible to set a Direct3D 11 resource (e.g. a texture or render target) in WPF
    /// directly because WPF requires Direct3D 9. The <see cref="D3D9"/> class creates a new
    /// Direct3D 9 device which can be used for sharing resources between Direct3D 11 and Direct3D
    /// 9. Call <see cref="GetSharedTexture"/> to convert a texture from Direct3D 11 to Direct3D 9.
    /// </remarks>
    internal class D3D9 : IDisposable
    {
        // The code requires Windows Vista and up using the Windows Display Driver Model (WDDM).
        // It does not work with the Windows 2000 Display Driver Model (XDDM).

        #region Fields
        private bool _disposed;
        private Direct3DEx _direct3D;
        private DeviceEx _device;
        #endregion

        #region Creation & Cleanup
        /// <summary>
        /// Initializes a new instance of the <see cref="D3D9"/> class.
        /// </summary>
        public D3D9()
        {
            // Create Direct3DEx device on Windows Vista/7/8 with a display configured to use
            // the Windows Display Driver Model (WDDM). Use Direct3D on any other platform.
            _direct3D = new Direct3DEx();

            PresentParameters presentparams = new PresentParameters
            {
                Windowed = true,
                SwapEffect = SwapEffect.Discard,
                PresentationInterval = PresentInterval.Default,

                // The device back buffer is not used.
                BackBufferFormat = Format.Unknown,
                BackBufferWidth = 1,
                BackBufferHeight = 1,

                // Use dummy window handle.
                DeviceWindowHandle = NativeMethods.GetDesktopWindow()
            };

            _device = new DeviceEx(_direct3D, 0, DeviceType.Hardware, IntPtr.Zero,
                                   CreateFlags.HardwareVertexProcessing | CreateFlags.Multithreaded | CreateFlags.FpuPreserve,
                                   presentparams);
        }

        /// <summary>
        /// Releases unmanaged resources before an instance of the <see cref="D3D9"/> class is
        /// reclaimed by garbage collection.
        /// </summary>
        /// <remarks>
        /// This method releases unmanaged resources by calling the virtual <see cref="Dispose(bool)"/>
        /// method, passing in <see langword="false"/>.
        /// </remarks>
        ~D3D9()
        {
            Dispose(false);
        }

        /// <summary>
        /// Releases all resources used by an instance of the <see cref="D3D9"/> class.
        /// </summary>
        /// <remarks>
        /// This method calls the virtual <see cref="Dispose(bool)"/> method, passing in
        /// <see langword="true"/>, and then suppresses finalization of the instance.
        /// </remarks>
        public void Dispose()
        {
            Dispose(true);
            GC.SuppressFinalize(this);
        }

        /// <summary>
        /// Releases the unmanaged resources used by an instance of the <see cref="D3D9"/> class
        /// and optionally releases the managed resources.
        /// </summary>
        /// <param name="disposing">
        /// <see langword="true"/> to release both managed and unmanaged resources;
        /// <see langword="false"/> to release only unmanaged resources.
        /// </param>
        protected virtual void Dispose(bool disposing)
        {
            if (!_disposed)
            {
                if (disposing)
                {
                    // Dispose managed resources.
                    if (_device != null)
                    {
                        _device.Dispose();
                        _device = null;
                    }
                    if (_direct3D != null)
                    {
                        _direct3D.Dispose();
                        _direct3D = null;
                    }
                }

                // Release unmanaged resources.
                _disposed = true;
            }
        }
        #endregion

        #region Methods

        static class NativeMethods
        {
            [DllImport("user32.dll", SetLastError = false)]
            internal static extern IntPtr GetDesktopWindow();
        }

        private void ThrowIfDisposed()
        {
            if (_disposed)
                throw new ObjectDisposedException(GetType().FullName);
        }

        /// <summary>
        /// Creates Direct3D 9 texture from the specified Direct3D 11 texture.
        /// (The content is shared between the devices.)
        /// </summary>
        /// <param name="renderTarget">The Direct3D 11 texture.</param>
        /// <returns>The Direct3D 9 texture.</returns>
        /// <exception cref="ArgumentException">
        /// The Direct3D 11 texture is not a shared resource, or the texture format is not
        /// supported.
        /// </exception>
        public Texture GetSharedTexture(Texture2D renderTarget)
        {
            ThrowIfDisposed();

            if (renderTarget == null)
                return null;

            IntPtr handle = renderTarget.GetSharedHandle();
            if (handle == IntPtr.Zero)
                throw new ArgumentException("Unable to access resource. The texture needs to be created as a shared resource.", "renderTarget");

            Format format;
            switch (renderTarget.Format)
            {
                case SurfaceFormat.Bgr32:
                    format = Format.X8R8G8B8;
                    break;
                case SurfaceFormat.Bgra32:
                    format = Format.A8R8G8B8;
                    break;
                default:
                    throw new ArgumentException("Unexpected surface format. Supported formats are: SurfaceFormat.Bgr32, SurfaceFormat.Bgra32.", "renderTarget");
            }

            return new Texture(_device, renderTarget.Width, renderTarget.Height, 1, Usage.RenderTarget, format, Pool.Default, ref handle);
        }
        #endregion
    }
}


text:
import Ember from 'ember';

var run = Ember.run;
var typeOf = Ember.typeOf;

export default Ember.Component.extend({

	tagName: 'span',
	classNames: ['ui-number-array-input'],
	// two-way bindings
	value: [],
	elements: null, // the number of elements in the array
	placeholder: null,
	align: 'left',
	size: null,
	min: null,
	max: null,
	correctionRules: null,
	status: null,
	statusVisualize: false,
	// available one-way bindings (aka, read-only)
	// --------------------------
	// provides an array of objects which represent the array elements
	// this just makes the templating easier and allows further ornamentation
	arrayElements: Ember.A([]),
	samples: [],
	sum: null,
	mean: null,
	median: null,
	statsPrecision: null,
	showMean: false,
	showMedian: false,
	showSum: false,
	// observers and event handlers
	// ----------------------------
	// on initialisation ensure element count is defaulted to
	// the value's array length (if not already specified)
	_elementsInit: function() {
		var value = this.get('value');
		var elements = this.get('elements');
		if(value && !elements) {
			this.set('elements', value.length);
		}
	}.on('didInsertElement'),
	_arrayElementsSourceChange: function() {
		run.next(this, function() {
			var elements = this.get('elements');
			var value = this.get('value');
			if (!value) {
				value = [];
			}
			var arrayElements = [];
			for(var i=0; i < elements; i++) {
				// ensure value always has full array length
				if(i >= value.length) {
					value[i] = null;
				}
				// assign base name/value pair
				arrayElements[i] = Ember.Object.create({ id: i, value: value[i] ? Number(value[i]) : null });
				// add appropriate ornamentation
				var o = this.getProperties('placeholder','min','max','align', 'size', 'correctionRules','status','statusVisualize');
				var alwaysArrayProps = ['correctionRules'];
				for (var property in o) {
					// if always an "array"
					if (alwaysArrayProps.contains(property) && o[property]) {
						o[property] = o[property].split(',');
					}
					// split comma-seperated list
					if (typeOf(o[property]) === 'string' && o[property].indexOf(',') !== -1) {
						o[property] = o[property].split(',');
					}
					// set
					if (['string','number','boolean','function'].contains(typeOf(o[property])) || property === 'correctionRules') {
						// uniform value across all inputs
						arrayElements[i][property] = o[property];
					} else if (typeOf(o[property]) === 'array') {
						// specific values
						arrayElements[i][property] = o[property][i];
					}
				};
			}
			this.set('arrayElements',arrayElements);
		});
	}.observes('elements','placeholder','align','min','max','size','correctionRules','status','statusVisualize').on('didInsertElement'),
	_arrayElementDidChange: function() {
		run.next(this, function() {
			var elements = this.get('arrayElements');
			this.set('value', elements.map(function(item,index){
				if (item.value) {
					return Number(item.value);
				} else {
					return null;
				}
			}));
			var sum = 0;
			var samples = [];
			elements.map(function(item) {
				if (item.value) {
					sum += Number(item.value);
					samples.pushObject(Number(item.value));
				} else {
					return false;
				}
			});
			samples.sort(function(a,b) {return a-b}); // put into order, lowest to highest
			this.set('samples', samples);
			this.set('sum', sum);
			// Stats
			var sampleSize = samples.length ? samples.length : 0;
			this.set('sampleSize', sampleSize);
			var precision = this.get('statsPrecision');
			var rounding = function(number) {
				if(precision) {
					return Math.round(number * Math.pow(10,precision)) / Math.pow(10,precision)
				} else {
					return number;
				}
			}
			var median;
			var midPoint = Math.floor(sampleSize / 2);
			if (sampleSize % 2 === 0 && sampleSize !== 0) {
				median = (samples[midPoint] + samples[midPoint - 1]) / 2;

			} else if (sampleSize !== 0) {
				median = samples[midPoint];
			} else {
				median = null;
			}
			this.set('median',rounding(median));
			var mean = samples.length === 0 ? null : sum / samples.length;
			this.set('mean', rounding(mean));
			this.set('minValue', samples ? samples[0] : null);
			this.set('maxValue', samples ? samples[samples.length -1] : null);
		});
	}.observes('arrayElements.@each.value')
});


text:
@implementation DNApplicationShortCutHelper

+ (void)application:(UIApplication *)application performActionForShortcutItem:(UIApplicationShortcutItem *)shortcutItem completionHandler:(void (^)(BOOL))completionHandler {
    NSString *type = [shortcutItem type];
    if ([type isEqualToString:@"DonkyNewChatMessage"]) {
        //Start new message:
        SEL newChatSelector = NSSelectorFromString(@"newShortCutConversation");
        id serviceInstance = NSClassFromString(@"DChatUIMainController");
        if ([serviceInstance respondsToSelector:newChatSelector]) {
            UINavigationController *newMessage = ((UINavigationController* (*)(id, SEL))[serviceInstance methodForSelector:newChatSelector])(serviceInstance, newChatSelector);
            if (newMessage) {
                [[UIViewController applicationRootViewController] presentViewController:newMessage animated:YES completion:nil];
            }
        }
        else {
            DNErrorLog(@"Couldn't load a new chat converastion, DCChatUIMainController class could not be found. Please ensure you have included the Donky-ChatMessage-Inbox module");
        }
    }
}

@end


text:
package moontime.alg;

import static org.fest.assertions.Assertions.*;

import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.EnumSet;
import java.util.List;
import java.util.TimeZone;

import moontime.Constants;
import moontime.Moon;
import moontime.MoonEvent;
import moontime.MoonEventType;
import moontime.MoonPhaseAlgorithm;
import moontime.MoonUtil;
import moontime.testsupport.AbstractTest;

import org.fest.assertions.Delta;
import org.junit.Test;

public abstract class AbstractMoonPhaseAlgorithmTest extends AbstractTest {

    /** allowed deviation */
    private final double _moonAgeDelta;
    private final double _moonFractionDelta;
    private final long _moonEventDeviationDelta;
    protected final MoonPhaseAlgorithm _algorithm;
    private final Calendar _calendar15Jan2011 = Calendar.getInstance();

    public AbstractMoonPhaseAlgorithmTest(MoonPhaseAlgorithm algorithm, double moonAgeDelta, double moonFractionDelta, long moonEventDeviationDelta) {
        _algorithm = algorithm;
        _moonAgeDelta = moonAgeDelta;
        _moonFractionDelta = moonFractionDelta;
        _moonEventDeviationDelta = moonEventDeviationDelta;
        _calendar15Jan2011.setTime(new Date(1295129899864L));
    }

    @Test
    public void testCalculateNexMoonEvents() {
        List<MoonEvent> events = _algorithm.getNextMoonEvents(_calendar15Jan2011, 5, EnumSet.of(MoonEventType.NEW_MOON, MoonEventType.FULL_MOON));
        assertThat(events).hasSize(5);
        List<MoonEvent> expectedEvents = new ArrayList<MoonEvent>();
        TimeZone UTC = TimeZone.getTimeZone("UTC");
        expectedEvents.add(new MoonEvent(MoonEventType.FULL_MOON, MoonUtil.newCalendar(2011, 0, 19, 21, 21, 0, UTC).getTime()));
        expectedEvents.add(new MoonEvent(MoonEventType.NEW_MOON, MoonUtil.newCalendar(2011, 1, 3, 2, 31, 0, UTC).getTime()));
        expectedEvents.add(new MoonEvent(MoonEventType.FULL_MOON, MoonUtil.newCalendar(2011, 1, 18, 8, 36, 0, UTC).getTime()));
        expectedEvents.add(new MoonEvent(MoonEventType.NEW_MOON, MoonUtil.newCalendar(2011, 2, 4, 20, 46, 0, UTC).getTime()));
        expectedEvents.add(new MoonEvent(MoonEventType.FULL_MOON, MoonUtil.newCalendar(2011, 2, 19, 18, 10, 0, UTC).getTime()));
        for (int i = 0; i < events.size(); i++) {
            printEvent(events.get(i), expectedEvents.get(i).getDate());
            assertThat(events.get(i).getType()).isEqualTo(expectedEvents.get(i).getType());
            assertDate(expectedEvents.get(i).getDate(), events.get(i).getDate(), _moonEventDeviationDelta);
            assertThat(events.get(i).getType()).isEqualTo(expectedEvents.get(i).getType());
        }
    }

    @Test
    public void testCalculateMoon() throws Exception {
        List<MoonEvent> events = _algorithm.getNextMoonEvents(_calendar15Jan2011, MoonEventType.values().length, EnumSet.allOf(MoonEventType.class));
        for (MoonEvent moonEvent : events) {
            Moon moon = _algorithm.calculate(MoonUtil.newCalendar(moonEvent.getDate()));
            System.out.println(moonEvent.getType() + ": " + moon);
            double expectedAge = Constants.SYNODIC_MONTH * moonEvent.getType().getFraction();
            double expectedFraction = moonEvent.getType().getFraction();
            if (moonEvent.getType() == MoonEventType.NEW_MOON && moon.getMoonAge() > 1) {
                expectedAge = Constants.SYNODIC_MONTH;
                expectedFraction = 1.0d;
            }
            assertThat(moon.getMoonAge()).describedAs("moon-age for " + moonEvent).isEqualTo(expectedAge, Delta.delta(_moonAgeDelta));
            assertThat(moon.getFraction()).describedAs("fraction for " + moonEvent).isEqualTo(expectedFraction, Delta.delta(_moonFractionDelta));
        }
    }

    private void printEvent(MoonEvent moonEvent, Date expectedDate) {
        System.out.println(moonEvent + " || " + getDifference(moonEvent, expectedDate));
    }

    private String getDifference(MoonEvent moonEvent, Date date) {
        long difference = date.getTime() - moonEvent.getDate().getTime();
        return (difference > 0 ? "-" : "+") + formatTimeDuration(Math.abs(difference));
    }

}


text:
require 'spec_helper'

module Calagator

describe Source, "in general", :type => :model do
  before(:each) do
    @event = mock_model(Event,
      :title => "Title",
      :description => "Description",
      :url => "http://my.url/",
      :start_time => Time.now + 1.day,
      :end_time => nil,
      :venue => nil,
      :duplicate_of_id => nil)
  end

  it "should create events for source from URL" do
    expect(@event).to receive(:save!)

    source = Source.new(:url => "http://my.url/")
    expect(source).to receive(:to_events).and_return([@event])
    expect(source.create_events!).to eq [@event]
  end

  it "should fail to create events for invalid sources" do
    source = Source.new(:url => '\not valid/')
    expect{ source.to_events }.to raise_error(ActiveRecord::RecordInvalid, /Url has invalid format/i)
  end
end

describe Source, "when reading name", :type => :model do
  before(:each) do
    @title = "title"
    @url = "http://my.url/"
  end

  before(:each) do
    @source = Source.new
  end

  it "should return nil if no title is available" do
    expect(@source.name).to be_nil
  end

  it "should use title if available" do
    @source.title = @title
    expect(@source.name).to eq @title
  end

  it "should use URL if available" do
    @source.url = @url
    expect(@source.name).to eq @url
  end

  it "should prefer to use title over URL if both are available" do
    @source.title = @title
    @source.url = @url

    expect(@source.name).to eq @title
  end
end

describe Source, "when parsing URLs", :type => :model do
  before(:each) do
    @http_url = 'http://upcoming.yahoo.com/event/390164/'
    @ical_url = 'webcal://upcoming.yahoo.com/event/390164/'
    @base_url = 'upcoming.yahoo.com/event/390164/'
  end

  before(:each) do
    @source = Source.new
  end

  it "should not modify supported url schemes" do
    @source.url = @http_url

    expect(@source.url).to eq @http_url
  end

  it "should substitute http for unsupported url schemes" do
    @source.url = @ical_url

    expect(@source.url).to eq @http_url
  end

  it "should add the http prefix to urls without one" do
    @source.url = @base_url

    expect(@source.url).to eq @http_url
  end

  it "should strip leading and trailing whitespace from URL" do
    source = Source.new
    source.url = "     #{@http_url}     "
    expect(source.url).to eq @http_url
  end

  it "should be invalid if given invalid URL" do
    source = Source.new
    source.url = '\O.o/'
    expect(source.url).to be_nil
    expect(source).not_to be_valid
  end
end

end


text:
import React from 'react'
import PropTypes from 'prop-types'
import styles from './styles.module.scss'

export default function InputView({ children, error, inputProps, width }) {
  return (

          {children}
          <input
            className={styles.input}
            type='text'
            {...inputProps}
          />

  )
}

InputView.propTypes = {
  children: PropTypes.any,
  error: PropTypes.any,
  inputProps: PropTypes.object.isRequired,
  width: PropTypes.oneOfType([
    PropTypes.string,
    PropTypes.number,
  ]),
}


text:
import {
    MENU_SIDEBAR_TOGGLE,
    MENU_SIDEBAR_IS_EXPANDED,
    MENU_SIDEBAR_IS_COLLAPSED
} from '../constants/actionTypes';

import api from '../api';

function menuSidebarIsExpanded(){
    return {type: MENU_SIDEBAR_IS_EXPANDED};
}
function menuSidebarIsCollapsed(){
    return {type: MENU_SIDEBAR_IS_COLLAPSED};
}
function menuSidebarToggle(){
    return {type: MENU_SIDEBAR_TOGGLE};
}

export function sidebarIsExpanded(){
    return (dispatch, getState)=>{
        dispatch(getState().menu.sidebar.expanded ?  menuSidebarIsExpanded() : menuSidebarIsCollapsed());
        return getState().menu.sidebar.expanded;
    };
}
export function sidebarToggle(){
    return (dispatch, getState)=>{
        dispatch(menuSidebarToggle());
        return dispatch(getState().menu.sidebar.expanded ?  menuSidebarIsExpanded() : menuSidebarIsCollapsed());
    };
}


text:
ACCEPTED

#### According to
The Catalogue of Life, 3rd January 2011

#### Published in
Bull. trimest. Soc. mycol. Fr. 95(3): 207 (1980)

#### Original name
Telamonia albovariegata Velen., 1921

### Remarks
null


text:
package com.asakusafw.directio.hive.serde;

import java.util.ArrayList;
import java.util.List;

import org.apache.hadoop.hive.serde2.objectinspector.StructField;
import org.apache.hadoop.hive.serde2.objectinspector.StructObjectInspector;

import com.asakusafw.runtime.value.ValueOption;

/**
 * Inspects an Asakusa Framework data model object.
 * @since 0.7.0
 */
public class DataModelInspector extends StructObjectInspector {

    private final DataModelDescriptor descriptor;

    /**
     * Creates a new instance.
     * @param descriptor the target data model descriptor
     */
    public DataModelInspector(DataModelDescriptor descriptor) {
        this.descriptor = descriptor;
    }

    @Override
    public Category getCategory() {
        return Category.STRUCT;
    }

    @Override
    public String getTypeName() {
        return descriptor.getDataModelClass().getName();
    }

    @Override
    public List<? extends StructField> getAllStructFieldRefs() {
        return descriptor.getPropertyDescriptors();
    }

    @Override
    public Object getStructFieldData(Object data, StructField field) {
        PropertyDescriptor propertyDescriptor = (PropertyDescriptor) field;
        ValueOption<?> property = propertyDescriptor.extract(data);
        return property.isNull() ? null : property;
    }

    @Override
    public StructField getStructFieldRef(String name) {
        return descriptor.findPropertyDescriptor(name);
    }

    @Override
    public List<Object> getStructFieldsDataAsList(Object data) {
        List<? extends StructField> refs = getAllStructFieldRefs();
        List<Object> results = new ArrayList<>(refs.size());
        for (StructField field : refs) {
            results.add(getStructFieldData(data, field));
        }
        return results;
    }
}


text:
var machine = {
	"memory":0,
	"device":0,

	"algorithm":"FCFS",
	"quantum":1,
	"priority":true,
	"changing":false,
	"readyOptimize":true,

	"tableInfo":[],
	"processor":[],

	"notInserted":[],
	"hold":[],
	"ready":[],
	"endQue":[],

	"running":null,
	"lastChecked":0,
	"time":0
}

function Process(name) {
	this.name = name;
	this.arrivedTime = 0;
	this.brustTime = 0;
	this.priority = 0;
	this.runTime = 0;

	this.running = false;
	this.isEnded = false;

	this.list = function() {
		return {
			"value":[this.name, this.arrivedTime, this.brustTime, this.priority],
			"category":["name", "arrivedTime", "brustTime", "priority"]
		};
	}

	this.turnaround = function() {
		return 0;
	}

	this.fork = function() {

	}

	this.ready = function() {
		if(p.memory <= machine.memory && p.device <= machine.device) {
			machine.memory -= p.memory
			machine.device -= p.device

			machine.readyQue.push(p)
			machine.holdQue.splice(i, 1)

			return true
		}
		return false
	}

	this.awake = function() {
		if(!this.isRunning) {
			machine.running = this

			// or may be this can be replaced with shift ope
			machine.readyQue.splice(machine.readyQue.indexOf(this),1)
		}
	}

	this.end = function() {
		if(this.isRunning && this.brustTime <= this.runTime) {
			this.endTime = machine.time
			this.isRunning = false
			this.isEnded = true

			machine.running = null
			machine.endQue.push(this)
		}
	}

	this.sleep = function() {
		if(this.isRunning) {
			this.isRunning = false

			machine.running = null
			machine.readyQue.push(this)
		}
	}

	return this;
}

var algorithms = ["FCFS", "SJF", "SRT", "NP", "RR"]
$("body").ready(init);

function init() {
	machine.readyOptimize = $("#MITTD_optiomize").is(":checked")
	machine.priority = $("#MITTD_priority").is(":checked")

	console.log(machine.readyOptimize, machine.priority)
	$(".MITTD")
		.css("cursor", "pointer")
		.click(clickIT)

	$("#AddProcessorBtn")
		.click(function() {
			var name = "P"+(machine.processor.length+1)
			var p = new Process(name)

			machine.processor.push(p)
			// #	arrived time	brust time	priority

			var str = "
", list = p.list()
			for(var i in list["value"])
				str += ""+list["value"][i]+"	"
			str += "
"

			$("#ProcessorTable tbody").append(str)
			$(".PTTD").click(clickIT)
			console.log(machine.processor)
		})
}

function clickIT(event) {
	var object = $(this)
	var text = object.text(), target = object.attr("target"), type = object.attr("class").split(' ')[0]
	console.log(type)
	if(!machine.changing) {
		if(type == "MITTD") {
			if(target == "algorithm") {
				var ind = (algorithms.indexOf(text)+1)%algorithms.length
				machine.algorithm = algorithms[ind]
				if(machine.algorithm == "RR") {
					$("#MachineInfoTable thead td:nth-child(5)").css("visibility", "visible")
					$("#MachineInfoTable thead td:nth-child(6)").css("visibility", "visible")
					$(".MITTD:nth-child(5)").css("visibility", "visible")
					$(".MITTD:nth-child(6)").css("visibility", "visible")
				} else {
					$("#MachineInfoTable thead td:nth-child(5)").css("visibility", "hidden")
					$("#MachineInfoTable thead td:nth-child(6)").css("visibility", "hidden")
					$(".MITTD:nth-child(5)").css("visibility", "hidden")
					$(".MITTD:nth-child(6)").css("visibility", "hidden")
				}
			} else if(target == "priority") {
				machine.priority = !machine.priority
				console.log(machine.priority)
			} else if(target == "optimize") {
				machine.readyOptimize = !machine.readyOptimize
				console.log(machine.readyOptimize)
			} else {
				machine.changing = true
	// <input type="number" min="0" inputmode="numeric" pattern="[0-9]*" title="Non-negative integral number">
				object
					.text("")
					.append("<input target=\""+target+"\" class=\"MachineChangeNumber col-md-12\" type=\"number\" inputmode=\"numeric\" pattern=\"[0-9]*\" min=\"0\" />")
				$(".MachineChangeNumber")
					.focus()
					.focusout(function(event) {
						ChangeMachineInfo(this)
					})
					.keydown(function(event) {
						if(event.which == 13)
							ChangeMachineInfo(this)
					})

			}
		} else if(type == "PTTD") {
			if(target != "name") {
				machine.changing = true
				console.log(object.parent().attr("index"))
				object
					.text("")
					.append("<input target=\""+target+"\" index=\""+object.parent().attr("index")+"\" class=\"MachineChangeNumber col-md-12\" type=\"number\" inputmode=\"numeric\" pattern=\"[0-9]*\" min=\"0\" width=\"100%\"/>")
				$(".MachineChangeNumber")
					.focus()
					.focusout(function(event) {
						ChangeMachineInfo(this)
					})
					.keydown(function(event) {
						if(event.which == 13)
							ChangeMachineInfo(this)
					})

			}
		}
	}
	refresh()
}

function ChangeMachineInfo(event) {
	console.log(event)
	var object = $(event), num = parseInt(object.val()) || 0, type = object.parent().attr("class").split(' ')[0], target=object.attr("target")
	console.log("type", type)
	// console.log(object.val(), num, object.attr("target"))
	if(type == "MITTD") {
		machine[target] = num
	} else if(type == "PTTD") {
		var ind = parseInt(object.attr("index"))
		console.log("index",object.attr("index"))
		if(!isNaN(ind)) {
			console.log(machine.processor[ind-1], target, num)
			machine.processor[ind-1][target] = num
		}
	}

	machine.changing = false

	refresh()
}

function refresh() {
	if(!machine.changing) {
		$(".MITTD:nth-child(2)").text(machine.memory)
		$(".MITTD:nth-child(3)").text(machine.device)
		$(".MITTD:nth-child(4)").text(machine.algorithm)
		$(".MITTD:nth-child(5)").text(machine.quantum)

		for(var i in machine.processor) {
			var p = machine.processor[i]
			var $tr = $("#Process_"+p.name)
			console.log(i, p, $tr, "#Process_"+p.name)
			$tr.children(":nth-child(1)").text(p.name)
			$tr.children(":nth-child(2)").text(p.arrivedTime)
			$tr.children(":nth-child(3)").text(p.brustTime)
			$tr.children(":nth-child(4)").text(p.priority)
		}
	}
}

/////////////////////////////////// ui source code end ///////////////////////////////////

////////////////////////////////// main algorithm start //////////////////////////////////

function run() {
	machine.time = 0
	for(machine.time;machine.time<100;machine.time++) {

	}
}

function SortHoldQue() {
	if(machine.algorithms == "SRT") {
		SortHoldQue_SRT(MACHINE.holdQue)
	} else if(machine.algorithms == "SJF") {
		SortHoldQue_SJF(MACHINE.holdQue)
	} else if(machine.algorithms == "RR") {
		if(machine.priority) {
			SortHoldQue_P(MACHINE.holdQue)
		}
	}
}

// order by priority
function SortHoldQue_P(queue) {

}

// order by remaining time
function SortHoldQue_SRT(queue) {
	var list = []
	//blah blah blah

	if(machine.priority)
		for(var i in list) {
			list[i] = SortHoldQue_P(list[i])
		}
}

// order by burst time
function SortHoldQue_SJF(queue) {
	var list = []
	//blah blah blah

	if(machine.priority)
		for(var i in list) {
			list[i] = SortHoldQue_P(list[i])
		}
}

function Fork() {
	for(var i in machine.notInserted) {
		var p = machine.notInserted[i]
		if(p.arrivedTime <= machine.time) {
			machine.hold.push(p)
			machine.notInserted.splice(i, 1)
		}
	}
	SortHoldQue()
}

// holdQue to readyQue
function Ready() {
	for(var i in machine.holdQue) {
		var ok = machine.holdQue[i].ready()

		if(ok && machine.readyOptimize) {
			break
		}
	}
}

// readyQue to running
function Awake() {
	var p = machine.running
	if(p) {
		if(p.brustTime <= p.runTime) {
			p.end()
		} else if(machine.lastChecked + machine.quantum <= machine.time) {
			p.sleep()
		}
	}

	p = machine.readyQue[0]
	p.awake()
}


text:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"
    android:padding="5dp">

    <TextView
        android:id="@+id/noticeTitle"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="center_horizontal"
        android:layout_marginTop="5dp"
        android:layout_marginBottom="5dp"
        android:text="title"
        android:textSize="20sp" />

    <LinearLayout
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="right"
        android:layout_marginBottom="5dp"
        android:orientation="horizontal" >

        <TextView
            android:id="@+id/noticeName"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginRight="5dp"
            android:text="name"
            android:textSize="12sp" />

        <TextView
            android:id="@+id/noticeTime"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginRight="5dp"
            android:text="time"
            android:textSize="12sp" />
    </LinearLayout>

    <View
        android:layout_width="match_parent"
        android:layout_height="2dp"
        android:background="#999"
        android:layout_marginBottom="5dp" />

    <ScrollView
        android:layout_width="match_parent"
    	android:layout_height="match_parent">
	    <TextView
	        android:id="@+id/noticeDesc"
	        android:layout_width="wrap_content"
	        android:layout_height="wrap_content"
	        android:text="desc" />
	</ScrollView>
</LinearLayout>


text:
layout: casestudy
title: "Mobile Device Management"
description: "Mobile Device Management is a something that has now become integral to modern business operations."
permalink: "/case-studies/mobile-device-management/"
img: "/img/case-studies/netlicensing-case-study-mobile-device-management.png"
tags:
- Case Studies
- Use Cases
- Usage Tracking
- MDM
industry:
- Mobile
use-case:
- Validation
- Auto-Activation
favorite-feature:
- Product Usage Tracking and Analytics
- Licensing Model "Rental"
---

### Challenge

Mobile Device Management is a something that has now become integral to modern business operations. There is an expectation that employees will work remotely and that they will be able to travel between locations and still operate as though they were at their desk. This has put pressure on businesses to supply their employees and executives with mobile devices. These devices must come equipped with all of the necessary software for business to carry on as normal whenever and wherever.

Managing these devices is a major part of the role of modern system administrators for reasons of both efficiency and security. Devices must be tracked at all times, and always be up to date with the latest required software.

### Approach

Recently we had a company approach us with this exact situation. They had recently deployed mobile devices across several locations and to a variety of different departments ranging from engineers to executive officers. The devices were purchased with a single goal; to improve the efficiency and connectivity of the company as a whole.

However, they had not accounted for how they would manage and track all of the different devices as they were spread across different departments and locations. Only a small number of employees were employed on a permanent contract and much of the work was done using short-term contractors who were brought in on specific projects to oversee their implementation.

Each department had their own specific software requirements and there would often be a multitude of projects being worked on at any one time. The problem that they faced then was how to ensure that all of the devices were kept up to date with the appropriate software whilst also keeping the devices secure and accounting for the circumstances under which a device might go missing and it would be necessary to locate it as soon as possible.

All fairly common challenges with mobile device management; but with a unique twist in that the devices were frequently rotated around between different departments and sites. This was where NetLicensing was able to help. Using NetLicensing the company was able to keep track of all of the devices and the corresponding contracts that designated the individuals to whom they were issued.

### Results

In essence, the company were able to deploy NetLicensing to track the device by serial number, the individual it had been issued to and the location where they were based. This meant that at all times they had a comprehensive database of all the devices and locations which then meant that they could deploy all necessary software and updates, as well as monitor all the devices, all of the time.


text:
双Stack.小心stack.peek()而不是 pop
        ```
/*
Design a stack that supports push, pop, top, and retrieving the minimum element in constant time.

push(x) -- Push element x onto stack.
pop() -- Removes the element on top of the stack.
top() -- Get the top element.
getMin() -- Retrieve the minimum element in the stack.

Tags: Stack, Design
Similar Problems: (H) Sliding Window Maximum

Thoughts:
Use a regular Stack: linked list.
Save that minimum integer in a HashMap with each stack value. At each level of the stack, it always stores the min till that moment.
Use another stack to hold that 'up-to-date' min values.

Note:
Stack: peek()

*/

class MinStack {
    Stack<Integer> stack = new Stack<Integer>();
    Stack<Integer> min = new Stack<Integer>();

    public void push(int x) {
        stack.push(x);
        if (min.isEmpty() || x < min.peek()) {
            min.push(x);
        } else {
            min.push(min.peek());
        }
    }

    public void pop() {
        stack.pop();
        min.pop();
    }

    public int top() {
        return stack.peek();
    }

    public int getMin() {
        return min.peek();
    }
}

```


text:
package jobbole.test02;

import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;

/**
 * http://tz.jobbole.com/4284/
 * 第二期,字典可以在winedt上下载,主帖有下载地址
 * 说明:
 * 		de_neu.dic等字典文件的编码需要改为UTF-8
 * 		测试文件的编码为UTF-8,测试文件的每一行被认为是一句完整的语句,单词之间用空格分隔
 * 实现:
 * 		将字典文件读入HashSet,使用contains判断该单词是否在该语言中
 * 		记录每一行的语种出现次数,如果有单词出现在多语言中,则取出这些多语言中在该行出现次数最多的语言作为该单词的语种
 * @author angilin
 *
 */
public class LanguageScanner {

	private static final String DictionaryRootPath = "I:/";
	private static final String TestFilePath = "I:/test.txt";

	public static void main(String args[]) throws Exception {
		HashMap<String,HashSet<String>> languageMap = new HashMap<String,HashSet<String>>();
		languageMap.put("engilish", loadDictionary(DictionaryRootPath+"eng_com.dic"));
		languageMap.put("germen", loadDictionary(DictionaryRootPath+"de_neu.dic"));
		languageMap.put("spanish", loadDictionary(DictionaryRootPath+"es.dic"));
		languageMap.put("france", loadDictionary(DictionaryRootPath+"fr.dic"));
		languageMap.put("portuguese", loadDictionary(DictionaryRootPath+"portugueseU.dic"));

        File file = new File(TestFilePath);
        BufferedReader reader = null;
        try {
            reader = new BufferedReader(new FileReader(file));
            String tempString = null;
            HashSet<String> languageTotalSet = new HashSet<String>();

            while ((tempString = reader.readLine()) != null) {
            	String text = new String(tempString.getBytes(),"UTF-8");
            	String[] words = text.split(" ");
            	HashSet<String> languagePerLineSet = new HashSet<String>();
            	HashMap<String,Integer> languagePerLineCounter = new HashMap<String,Integer>();
            	if(words.length==0)
            		continue;
            	HashSet[] wordsLanguage = new HashSet[words.length];
            	for(int i=0;i<words.length;i++){
            		Iterator<String> languageIt = languageMap.keySet().iterator();
            		HashSet<String> wordLanguage = new HashSet<String>();
            		while(languageIt.hasNext()){
            			String language = languageIt.next();
            			if(languageMap.get(language).contains(words[i])){
            				wordLanguage.add(language);
            				if(languagePerLineCounter.containsKey(language)){
            					languagePerLineCounter.put(language,languagePerLineCounter.get(language)+1);
            				}
            				else{
            					languagePerLineCounter.put(language, 1);
            				}
                		}
            		}
            		wordsLanguage[i] = wordLanguage;
            		showLanguageDetail(words[i], wordLanguage);
            	}
            	for(int i=0;i<wordsLanguage.length;i++){
            		HashSet<String> languageSet = wordsLanguage[i];
            		if(languageSet.size()==1){
            			String language = languageSet.iterator().next();
            			languageTotalSet.add(language);
            			languagePerLineSet.add(language);
            		}
            		else if(languageSet.size()>1){
            			int count = 0;
            			String language = null;
            			Iterator<String> it = languageSet.iterator();
            			while(it.hasNext()){
            				String languageMultiple = it.next();
            				if(languagePerLineCounter.get(languageMultiple)>count){
            					language = languageMultiple;
            					count = languagePerLineCounter.get(languageMultiple);
            				}
            			}
            			languageTotalSet.add(language);
            			languagePerLineSet.add(language);
            		}
            	}
            	showLanguageDetail(text, languagePerLineSet);
            }
            showLanguageDetail("the total language", languageTotalSet);
            reader.close();
        } catch (IOException e) {
            e.printStackTrace();
        } finally {
            if (reader != null) {
                try {
                    reader.close();
                } catch (IOException e1) {
                }
            }
        }
	}

	/**
	 * 加载字典文件
	 * @param filePath
	 * @return
	 */
	private static HashSet<String> loadDictionary(String filePath){
		HashSet<String> wordSet = new HashSet<String>();
		File file = new File(filePath);
        BufferedReader reader = null;
        try {
            reader = new BufferedReader(new FileReader(file));
            String tempString = null;

            int i=0;
            while ((tempString = reader.readLine()) != null) {
            	if(i==1000){
            		int test =1;
            		test++;
            	}
                if(!tempString.startsWith("%")){
                	wordSet.add(new String(tempString.getBytes(),"UTF-8"));
                }
                i++;
            }
            reader.close();
        } catch (IOException e) {
            e.printStackTrace();
        } finally {
            if (reader != null) {
                try {
                    reader.close();
                } catch (IOException e1) {
                }
            }
        }
        return wordSet;
	}

	/**
	 * 控制台打印详细语言信息
	 * @param text
	 * @param languageSet
	 */
	private static void showLanguageDetail(String text , HashSet<String> languageSet){
		StringBuilder s = new StringBuilder();
    	s.append("[").append(text).append("]").append(" is ");
    	if(languageSet.size()==0){
    		s.append("unkown ");
    	}
    	Iterator<String> it = languageSet.iterator();
    	while(it.hasNext()){
    		String language = it.next();
    		s.append(language).append(",");
    	}
    	System.out.println(s.substring(0, s.length()-1));
	}
}


text:
<?php

/**
 * sfGuardGroup module helper.
 *
 * @package    sfGuardPlugin
 * @subpackage sfGuardGroup
 * @author     Fabien Potencier
 * @version    SVN: $Id: sfGuardGroupGeneratorHelper.class.php 12896 2008-11-10 19:02:34Z fabien $
 */
class sfGuardGroupGeneratorHelper extends BaseSfGuardGroupGeneratorHelper
{
}


text:
require "shopping_cart/engine"

module ShoppingCart
  # Your code goes here...
end


text:
require('QClass');
require('../../common/AbstractProbe.js');
var utils = require('../../common/utils.js');
var QClass = window.QClass,
    ns = window.pfMonitor.common,
    probeNames = {
        'firstPaint' : 'getFirstPaintTime',
        'firstFrame' : 'getFirstFrameTime',
        'netWorkType' : 'checkNetWorkType',
        'DOMReady' : 'getDomReadyTime',
        'onLoad' : 'getOnLoadTime'
    },
    defalutProbeList = (function(){
        var a = [];
        for(var key in probeNames){
            a.push(key);
        }
        return a;
    })(),
    performanceTiming = window.performance && window.performance.timing || {},
    winSize = utils.winSize(window);

function updateDate(imageEl, winSize){
    if(imageEl){
        var imgPos = utils.position(imageEl);
        // if image is remove from DOM Tree
        // return
        if(imgPos.top !== imgPos.top || imgPos.left !== imgPos.left) return;
        if(winSize.height > imgPos.top && winSize.width > imgPos.left){
            return Date.now();
        }
    }
}

// updateDate被调用多少次后调用afterFn
updateDate.afterCalled = function(time, afterFn){
    var self = this,
        resultEnd;
    return function(){
        var result = self.apply(self, arguments);
        resultEnd = result || resultEnd;
        if((--time)<=0){
            return afterFn(resultEnd);
        }
        return result;
    }
}

QClass.define('pfMonitor.Probes.H5Probes.DefaultH5Probe',{
    'extend' : ns.AbstractProbe,

    'initialize' : function(opts){
        opts = opts || {};
        this.parent(opts);
        this.probeList = opts.probeList;
        this.probeData = {};
        this.todoChildTask = [];
        this.freshfirstFrame = opts.freshfirstFrame;
    },

    /**
     * 获得白屏时间
     * @return {[type]} [description]
     */
    'getFirstPaintTime' : function(){
        var self = this;
        if(self.probeData.first_paint) return self.probeData.first_paint;
        if (typeof window.chrome !== 'undefined') {
            // 支持chrome
            var loadTime = window.chrome.loadTimes();
            var first_paint_secs = loadTime && loadTime.firstPaintTime;
            if( !first_paint_secs ){
                window.requestAnimationFrame(function() {
                    loadTime = window.chrome.loadTime();
                    first_paint_secs = loadTime && loadTime.firstPaintTime;
                    self.probeData.first_paint = parseInt(first_paint_secs * 1000);
                    self.trigger('firstPaintEnd',self.probeData.first_paint);
                });
            }else{
                self.probeData.first_paint = parseInt(first_paint_secs * 1000);
                self.trigger('firstPaintEnd',self.probeData.first_paint);
            }
        } else if (window.performance && window.performance.timing && (window.performance.timing.msFirstPaint !== undefined)) {
            window.setTimeout(function() {
                self.probeData.first_paint = parseInt(window.performance.timing.msFirstPaint);
                self.trigger('firstPaintEnd',self.probeData.first_paint);
            }, 1000);
        } else {
            // 使用全局firstPaintTime
            self.probeData.first_paint = window.firstPaintTime || 0;
            self.trigger('firstPaintEnd',window.firstPaintTime);
        }
    },

    /**
     * 获得onLoad时间
     * @return {[type]} [description]
     */
    'getOnLoadTime' : function(){
        if(this.probeData.loadTime) return this.probeData.loadTime;
        var self = this;
        var cb = function(){
            self.probeData.loadTime = performanceTiming.loadEventEnd || Date.now();
            self.trigger('onLoadEnd',self.probeData.loadTime);
        };
        window.addEventListener( 'load', cb, false );
    },

    /**
     * 获得首屏时间
     * @return {[type]} [description]
     */
    'getFirstFrameTime' : function(){
        var self = this;
        if(this.probeData.first_frame_time !== undefined){
            return this.probeData.first_frame_time
        }
        if(!this.freshfirstFrame){
            utils.onDomReady(function(){
                self.updateFirstFrameTime(true);
            });
        }
    },

    'updateFirstFrameTime' : function(inner){
        var self = this;
        var images = Array.prototype.slice.call(document.getElementsByTagName('img'),0);
        if(images && images.length){
            var updateDateAfter = updateDate.afterCalled(images.length, function(date){
                if(!date) return;
                self.probeData.first_frame_time = date;
                self.trigger('firstFrameEnd',date);
            });
            images.forEach(function(image){
                var imgSrc = image.src;
                if(imgSrc){

                    var handler = function(){
                        updateDateAfter(image,winSize);
                        image.removeEventListener('load',handler);
                        image.removeEventListener('error',handler);
                        fakeImage.onload = undefined;
                        fakeImage.onerror = undefined;
                        fakeImage = undefined;
                    }

                    image.addEventListener('load',handler,false);

                    image.addEventListener('error',handler,false);

                    var fakeImage = new Image();
                    fakeImage.onload = handler;
                    fakeImage.onerror = handler;
                    fakeImage.src = imgSrc;
                }
            });
        }else{
            self.updateFirstFrameTime = utils.noop;
            self.probeData.first_frame_time = inner && self.getFirstPaintTime() || Date.now();
            self.trigger('firstFrameEnd',self.probeData.first_frame_time);
        }
    },

    /**
     * 获得domReady时间
     * @return {[type]} [description]
     */
    'getDomReadyTime' : function(){
        if(this.domReadyTime) return this.domReadyTime;
        var self = this;
        var cb = function(){
            self.probeData.domReadyTime = Date.now();
            self.trigger('DOMReadyEnd',self.probeData.domReadyTime);
        };
        utils.onDomReady(cb);
    },

    /**
     * 获取网络类型
     * @param  {Function} cb [description]
     * @return {[type]}      [description]
     */
    'checkNetWorkType' : function(cb){
        var self = this;
        var connectionInfo = window.navigator.connection || window.navigator.mozConnection || window.navigator.webkitConnection;
        checkNetInfo(connectionInfo,function(type){
            self.probeData.netWorkType = type;
            self.trigger('netWorkTypeEnd',self.probeData.netWorkType);
            cb && cb(type);
        });
    },

    'run' : function(){
        this.parent();
        if(window.addEventListener){
            loadProbes.call(this,this.probeList);
        }
    },

    'checkChildTask' : function(taskName){
        var index = this.todoChildTask.indexOf(taskName);
        if(index >= 0){
            this.todoChildTask.splice(index,1);
        }
        if (this.todoChildTask.length <= 0){
            this.trigger('workDone',this.probeData);
        }
    }
});

/**
 * [加载探针]
 * @param  {[type]} probeList [description]
 * @return {[type]}           [description]
 */
function loadProbes(probeList){
    var self = this,
        probes = probeList || defalutProbeList;
    if(utils.core_type(probes) === 'array'){
        probes.forEach(function(item){
            self.todoChildTask.push(item);
            self.on(item + 'End',function(measureData){
                self.checkChildTask(item, measureData);
                self.trigger('process',{
                    'processName' : item,
                    'value' : measureData
                });
            });
        });
        // 分开保证先push后执行
        probes.forEach(function(item){
            probeNames[item] && self[probeNames[item]]();
        });
    }
}

/**
 * 获得网络信息
 * @param  {[type]}   connectionInfo [description]
 * @param  {Function} cb             [回调]
 * @return {[type]}                  [description]
 */
function checkNetInfo(connectionInfo,cb){
    var type = connectionInfo && connectionInfo.type;
    var called = false;
    if(type){
        // 可以拿到navigator.connection
        if( !Number.isNaN(parseInt(type)) ){
            for(var key in connectionInfo){
                if(type === connectionInfo[key]){
                    type = key;
                    break;
                }
            }
        }
        !called && cb && cb(type);
        called = true;
    }else{
        // 如果有桥,那么通过桥
        if( window.WebViewJavascriptBridge && window.WebViewJavascriptBridge.invoke){
            window.WebViewJavascriptBridge.invoke('network.getType',function(data){
                if(data.ret && data.data && data.data.networkType){
                    !called && cb && cb(data.data.networkType);
                    called = true;
                }
            });
        }else{
            document.addEventListener('WebViewJavascriptBridgeReady', function(event) {
                var WagonBridge = event.bridge;
                WagonBridge.invoke && WagonBridge.invoke('network.getType',function(data){
                    if(data.ret && data.data && data.data.networkType){
                        !called && cb && cb(data.data.networkType);
                        called = true;
                    }
                })
            });
        }
        setTimeout(function(){
            !called && cb && cb();
            called = true;
        },2000);//2秒后超时防止android不回数
    }
}

module.exports = window.pfMonitor.Probes.H5Probes.DefaultH5Probe;


text:
#pragma once

/// \file
/// Definition of the Diligent::IQueryD3D12 interface

#include "../../GraphicsEngine/interface/Query.h"

DILIGENT_BEGIN_NAMESPACE(Diligent)

// {72D109BE-7D70-4E54-84EF-C649DA190B2C}
static const INTERFACE_ID IID_QueryD3D12 =
    {0x72d109be, 0x7d70, 0x4e54, {0x84, 0xef, 0xc6, 0x49, 0xda, 0x19, 0xb, 0x2c}};

#define DILIGENT_INTERFACE_NAME IQueryD3D12
#include "../../../Primitives/interface/DefineInterfaceHelperMacros.h"

#define IQueryD3D12InclusiveMethods \
    IQueryInclusiveMethods;         \
    IQueryD3D12Methods QueryD3D12

// clang-format off

/// Exposes Direct3D12-specific functionality of a Query object.
DILIGENT_BEGIN_INTERFACE(IQueryD3D12, IQuery)
{
    /// Returns the Direct3D12 query heap that internal query object resides in.
    VIRTUAL ID3D12QueryHeap* METHOD(GetD3D12QueryHeap)(THIS) PURE;

    /// Returns the index of a query object in Direct3D12 query heap.

    /// \param [in] QueryId - Query Id. For most query types this must be 0. An exception is
    ///                       QUERY_TYPE_DURATION, in which case allowed values are 0 for the
    ///                       beginning timestamp query, and 1 for the ending query.
    /// \return the index of a query object in Direct3D12 query heap
    VIRTUAL Uint32 METHOD(GetQueryHeapIndex)(THIS_
                                             Uint32 QueryId) CONST PURE;
};
DILIGENT_END_INTERFACE

// clang-format on

#include "../../../Primitives/interface/UndefInterfaceHelperMacros.h"

#if DILIGENT_C_INTERFACE

#    define IQueryD3D12_GetD3D12QueryHeap(This)      CALL_IFACE_METHOD(QueryD3D12, GetD3D12QueryHeap, This)
#    define IQueryD3D12_GetQueryHeapIndex(This, ...) CALL_IFACE_METHOD(QueryD3D12, GetQueryHeapIndex, This, __VA_ARGS__)

#endif

DILIGENT_END_NAMESPACE // namespace Diligent


text:
#ifndef _SIMPLE_QUEUE_
#define _SIMPLE_QUEUE_

#include <ostream>

#ifndef _QUEUE_
#include "execution/queues/queue.h"
#endif

#ifndef _MEMORY_MGR_
#include "execution/memory/memory_mgr.h"
#endif

/**
 * A simple implementation of a queue.  The queue has the following
 * characteristics:
 *
 * 1. Works with a fixed number of pages (got from memory manager).
 * 2. Allocates all pages @ start time.
 * 3. Does not grow / shrink dynamically (restatement of 1)
 */

namespace Execution {
	class SimpleQueue : public Queue {
	private:
		// System wide unique id assigned to me.
		int id;

		// Memory manager for the pages
		MemoryManager *memMgr;

		// Size of pages served by memory manager
		unsigned int pageSize;

		// Number of pages of memory that I am allowed to have
		unsigned int numPages;

		// Each page contains a pointer to the next page in the circular
		// buffer organization of the page: nextPtrOffset contains the
		// offset of this pointer from the start of the page
		unsigned int nextPtrOffset;

		// offset of next page pointer from the last element in a page: we
		// store this to efficiently move frm the last element of a page
		// to the first elmeent of the next page
		unsigned int nextPtrOffset_le;

		// number of elements that I can store in a page
		unsigned int numElementsPerPage;

		// Maximum number of elements that I can enqueue:
		// numElementsPerPage x numPages
		unsigned int maxElements;

		// Pointer to an element in the queue: contains the true pointer
		// and the position of the element within the page that it is
		// stored.
		struct EPtr {
			Element       *element;
			unsigned int   posInPage;
		};

		// The position where the next element is enqueued.
		EPtr nextEnqueue;

		// The position pointing to the next element that will be
		// dequeued.
		EPtr nextDequeue;

		// The number of elements that we currently have on the queue.
		unsigned int numElements;

		std::ostream& LOG;

	public:

		SimpleQueue (int id, std::ostream& LOG);
		virtual ~SimpleQueue();

		// Initialization routines.
		int setNumPages(unsigned int numPages);
		int setMemoryManager(MemoryManager *memMgr);
		int initialize();

		// Inherited from Queue.
		bool enqueue (Element element);
		bool dequeue (Element &element);
		bool peek (Element &element) const;
		bool isFull () const;
		bool isEmpty () const;

	private:
		int computePageLayout();
		int initState();
	};
}
#endif


text:
(function(cornerstoneTools) {

    'use strict';

    function toolStyleManager() {
        var defaultWidth = 1,
            activeWidth = 2;

        function setToolWidth(width){
            defaultWidth = width;
        }

        function getToolWidth(){
            return defaultWidth;
        }

        function setActiveToolWidth(width){
            activeWidth = width;
        }

        function getActiveToolWidth(){
            return activeWidth;
        }

        var toolStyle = {
            setToolWidth: setToolWidth,
            getToolWidth: getToolWidth,
            setActiveWidth: setActiveToolWidth,
            getActiveWidth: getActiveToolWidth
        };

        return toolStyle;
    }

    // module/private exports
    cornerstoneTools.toolStyle = toolStyleManager();

})(cornerstoneTools);


text:
// --------------------------------------------------------------------------------------------------------------------
// <copyright file="EventIds.cs" company="Email Hippo Ltd">
//   © Email Hippo Ltd
// </copyright>
// --------------------------------------------------------------------------------------------------------------------

#region License

// Copyright 2015 Email Hippo Ltd
// 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.
#endregion

namespace EmailHippo.EmailVerify.Api.Client.Diagnostics.Common
{
    /// <summary>
    /// The event ids.
    /// </summary>
    internal enum EventIds
    {
        /// <summary>
        ///     The none.
        /// </summary>
        None = 0,

        /// <summary>
        ///     The initializing.
        /// </summary>
        Initializing = 1100,

        /// <summary>
        ///     The initialized
        /// </summary>
        Initialized = 1101,

        /// <summary>
        ///     The timer logging
        /// </summary>
        TimerLogging = 3100,

        /// <summary>
        ///     The critical
        /// </summary>
        Critical = 9901,

        /// <summary>
        ///     The warning
        /// </summary>
        Warning = 4501,

        /// <summary>
        ///     The verbose
        /// </summary>
        Verbose = 3502,

        /// <summary>
        ///     The error
        /// </summary>
        Error = 5901,

        /// <summary>
        ///     The informational
        /// </summary>
        Informational = 3501,

        /// <summary>
        ///     The log always
        /// </summary>
        LogAlways = 3503,

        /// <summary>
        ///     The method enter
        /// </summary>
        MethodEnter = 3101,

        /// <summary>
        ///     The method exit
        /// </summary>
        MethodExit = 3102,

        /// <summary>
        /// The HTTP get request.
        /// </summary>
        HttpGetRequest = 3103,

        /// <summary>
        /// The REST response
        /// </summary>
        RestResponse = 3104
    }
}