<?xml version="1.0" encoding="UTF-8"?>
<!--
  Licensed to the Apache Software Foundation (ASF) under one or more
  contributor license agreements.  See the NOTICE file distributed with
  this work for additional information regarding copyright ownership.
  The ASF licenses this file to You 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.
-->

<!--
  Document   : domain-suffixes.xsd
  Author     : Enis Soztutar - enis.soz.nutch@gmail.com
  Description: This document is the schema for valid domain-suffixes
  definitions. For successful parsing of domain-suffixes xml files,
  the xml file should be validated with this xsd.
  See        : org.apache.nutch.util.domain.DomainSuffixesReader.java
-->

<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
  targetNamespace="http://lucene.apache.org/nutch"
  xmlns="http://lucene.apache.org/nutch"
  elementFormDefault="qualified">

  <xs:element name="domains">
    <xs:complexType>
      <xs:sequence>
        <xs:element name="tlds">
          <xs:complexType>
            <xs:sequence>
              <xs:element name="itlds">
                <xs:complexType>
                  <xs:sequence>
                    <xs:element name="tld" maxOccurs="unbounded"
                      type="gtld" />
                  </xs:sequence>
                </xs:complexType>
              </xs:element>

              <xs:element name="gtlds">
                <xs:complexType>
                  <xs:sequence>
                    <xs:element name="tld" maxOccurs="unbounded"
                      type="gtld" />
                  </xs:sequence>
                </xs:complexType>
              </xs:element>

              <xs:element name="cctlds">
                <xs:complexType>
                  <xs:sequence>
                    <xs:element name="tld" maxOccurs="unbounded"
                      type="cctld" />
                  </xs:sequence>
                </xs:complexType>
              </xs:element>

            </xs:sequence>
          </xs:complexType>
        </xs:element>

        <xs:element name="suffixes">
          <xs:complexType>
            <xs:sequence>
              <xs:element name="suffix" maxOccurs="unbounded"
                type="sldType" />
            </xs:sequence>
          </xs:complexType>
        </xs:element>
      </xs:sequence>
    </xs:complexType>
  </xs:element>

  <xs:complexType name="gtld">
    <xs:sequence>
      <xs:element name="status" minOccurs="0">
        <xs:simpleType>
          <xs:restriction base="xs:string">
            <xs:enumeration value="INFRASTRUCTURE" />
            <xs:enumeration value="SPONSORED" />
            <xs:enumeration value="UNSPONSORED" />
            <xs:enumeration value="STARTUP" />
            <xs:enumeration value="PROPOSED" />
            <xs:enumeration value="DELETED" />
            <xs:enumeration value="PSEUDO_DOMAIN" />
          </xs:restriction>
        </xs:simpleType>
      </xs:element>
      <xs:element name="boost" type="xs:float" minOccurs="0" />
      <xs:element name="description" type="xs:string" minOccurs="0" />
    </xs:sequence>
    <xs:attribute name="domain" type="xs:string" />
  </xs:complexType>

  <xs:complexType name="cctld">
    <xs:sequence>
      <xs:element name="country" type="xs:string" />
      <xs:element name="status" type="statusType" minOccurs="0" />
      <xs:element name="boost" type="xs:float" minOccurs="0" />
      <xs:element name="description" type="xs:string" minOccurs="0" />
    </xs:sequence>
    <xs:attribute name="domain" type="xs:string" />
  </xs:complexType>

  <xs:complexType name="sldType">
    <xs:sequence>
      <xs:element name="status" type="statusType" minOccurs="0" />
      <xs:element name="boost" type="xs:float" minOccurs="0" />
      <xs:element name="description" type="xs:string" minOccurs="0" />
    </xs:sequence>
    <xs:attribute name="domain" type="xs:string" />
  </xs:complexType>

  <xs:simpleType name="statusType">
    <xs:restriction base="xs:string">
      <xs:enumeration value="IN_USE" />
      <xs:enumeration value="NOT_IN_USE" />
      <xs:enumeration value="DELETED" />
    </xs:restriction>
  </xs:simpleType>

</xs:schema>

{'repo_name': 'CrawlScript/nutcher', 'stars': '118', 'repo_language': 'HTML', 'file_name': 'nutch-conf.xsl', 'mime_type': 'text/xml', 'hash': 386231731948192068, 'source_dataset': 'data'}


<template>

</template>

{'repo_name': 'zmts/beauty-vuejs-boilerplate', 'stars': '487', 'repo_language': 'Vue', 'file_name': 'index.html', 'mime_type': 'text/html', 'hash': 5002033441085675405, 'source_dataset': 'data'}


--------------------------------
-- @module Speed
-- @extend Action
-- @parent_module cc

--------------------------------
--  Replace the interior action.

-- param action The new action, it will replace the running action.
-- @function [parent=#Speed] setInnerAction
-- @param self
-- @param #cc.ActionInterval action
-- @return Speed#Speed self (return value: cc.Speed)

--------------------------------
--  Return the speed.

-- return The action speed.
-- @function [parent=#Speed] getSpeed
-- @param self
-- @return float#float ret (return value: float)

--------------------------------
--  Alter the speed of the inner function in runtime.

-- param speed Alter the speed of the inner function in runtime.
-- @function [parent=#Speed] setSpeed
-- @param self
-- @param #float speed
-- @return Speed#Speed self (return value: cc.Speed)

--------------------------------
--  Initializes the action.
-- @function [parent=#Speed] initWithAction
-- @param self
-- @param #cc.ActionInterval action
-- @param #float speed
-- @return bool#bool ret (return value: bool)

--------------------------------
--  Return the interior action.

-- return The interior action.
-- @function [parent=#Speed] getInnerAction
-- @param self
-- @return ActionInterval#ActionInterval ret (return value: cc.ActionInterval)

--------------------------------
--  Create the action and set the speed.

-- param action An action.

-- param speed The action speed.
-- @function [parent=#Speed] create
-- @param self
-- @param #cc.ActionInterval action
-- @param #float speed
-- @return Speed#Speed ret (return value: cc.Speed)

--------------------------------
--
-- @function [parent=#Speed] startWithTarget
-- @param self
-- @param #cc.Node target
-- @return Speed#Speed self (return value: cc.Speed)

--------------------------------
--
-- @function [parent=#Speed] reverse
-- @param self
-- @return Speed#Speed ret (return value: cc.Speed)

--------------------------------
--
-- @function [parent=#Speed] clone
-- @param self
-- @return Speed#Speed ret (return value: cc.Speed)

--------------------------------
--
-- @function [parent=#Speed] stop
-- @param self
-- @return Speed#Speed self (return value: cc.Speed)

--------------------------------
-- param dt in seconds.
-- @function [parent=#Speed] step
-- @param self
-- @param #float dt
-- @return Speed#Speed self (return value: cc.Speed)

--------------------------------
--  Return true if the action has finished.

-- return Is true if the action has finished.
-- @function [parent=#Speed] isDone
-- @param self
-- @return bool#bool ret (return value: bool)

--------------------------------
--
-- @function [parent=#Speed] Speed
-- @param self
-- @return Speed#Speed self (return value: cc.Speed)

return nil

{'repo_name': 'yuanfengyun/mj_client', 'stars': '182', 'repo_language': 'C++', 'file_name': 'version.json', 'mime_type': 'text/plain', 'hash': -6014196236170331840, 'source_dataset': 'data'}


# Contributing

Find an area you can help with and do it. Open source is about collaboration and open participation. Try to make your code look like what already exists and submit a pull request.

The [list of issues](https://github.com/mimblewimble/grin/issues) is a good place to start, especially the ones tagged as "help wanted" (but don't let that stop you from looking at others). If you're looking for additional ideas, the code includes `TODO` comments for minor to major improvements. Use _Search in files_ in your code editor, or `grep "TODO" -r --exclude-dir=target --exclude-dir=.git .`.

Additional tests are rewarded with an immense amount of positive karma.

More documentation or updates/fixes to existing documentation are also very welcome.

# PR Guidelines

We generally prefer you to PR your work earlier rather than later. This ensures everyone else has a better idea of what's being worked on, and can help reduce wasted effort. If work on your PR has just begun, please feel free to create the PR with [WIP] (work in progress) in the PR title, and let us know when it's ready for review in the comments.

Since mainnet has been released, the bar for having PRs accepted has been raised. Before submitting your PR for approval, please be ensure it:
* Includes a proper description of what problems the PR addresses, as well as a detailed explanation as to what it changes
* Explains whether/how the change is consensus breaking or breaks existing client functionality
* Contains unit tests exercising new/changed functionality
* Fully considers the potential impact of the change on other parts of the system
* Describes how you've tested the change (e.g. against Floonet, etc)
* Updates any documentation that's affected by the PR

If submitting a PR consisting of documentation changes only, please try to ensure that the change is significantly more substantial than one or two lines. For example, working through an install document and making changes and updates throughout as you find issues is worth a PR. For typos and other small changes, either contact one of the developers, or if you think it's a significant enough error to cause problems for other users, please feel free to open an issue.

The development team will be happy to help and guide you with any of these points and work with you getting your PR submitted for approval. Create a PR with [WIP] in the title and ask for specific assistance within the issue, or contact the dev team on any of the channels below.

# Find Us

When you are starting to contribute to grin, we really would appreciate if you come by the gitter chat channels.

In case of problems with trying out grin, before starting to contribute, there's the [Support chat](https://gitter.im/grin_community/support). Write there about what you've done, what you want to do, and maybe paste logs through a text paste webservice.

* Please [join the grin Lobby](https://gitter.im/grin_community/Lobby) to get a feeling for the community.
* And [see the developers chat](https://gitter.im/grin_community/dev) if you have questions about source code files.
  If you explain what you're looking at and what you want to do, we'll try to help you along the way.
* Also see `docs/*.md` and the folder structure explanations, and [the wiki](https://github.com/mimblewimble/docs/wiki).
* Further information and discussions are in the [Forum](https://forum.grin.mw), the [website](https://grin.mw), the [mailing list](https://lists.launchpad.net/mimblewimble/) and news channels like the [@grincouncil](https://twitter.com/grincouncil) and a (mostly unfiltered!) Twitter bot that collects headlines, mailing list posts, and reddit posts related to Mimblewimble/Grin: [@grinmw](https://twitter.com/grinmw)

## Testing

Run all tests with `cargo test --all` and please remember to test locally before creating a PR on github.

### Check Travis output

After creating a PR on github, the code will be tested automatically by Travis CI, and from the results you'll get a red or green light. The test can take a while, and you'll have a "yellow traffic light" on your PR until Travis CI is done testing.

### Building quality

The most important thing you can do alongside - or even before - changing code, is adding tests for how grin should and should not work. See the various `tests` folders and derive test that are already there in grin.

After that, if you want to raise code quality another level, you can use `cargo check`, `cargo cov test` and `cargo tarpaulin`. Install them with `cargo install cargo-check cargo-cov; RUSTFLAGS="--cfg procmacro2_semver_exempt" cargo install cargo-tarpaulin`. Run with `cargo cov test` and `cargo tarpaulin`. The quality check tools are often integrated with `rustc` and as a side-effect only activated when some code is compiled. Because of this, if you want a complete check you'll need to `cargo clean` first.

We have some details on [code coverage and historical numbers on the wiki](https://github.com/mimblewimble/docs/wiki/Code-coverage-and-metrics).

# Pull-Request Title Prefix

**Note**: *[draft part! to be reviewed and discussed]*

Please consider putting one of the following prefixes in the title of your pull-request:
- **feat**:     A new feature
- **fix**:      A bug fix
- **docs**:     Documentation only changes
- **style**:    Formatting, missing semi-colons, white-space, etc
- **refactor**: A code change that neither fixes a bug nor adds a feature
- **perf**:     A code change that improves performance
- **test**:     Adding missing tests
- **chore**:    Maintain. Changes to the build process or auxiliary tools/libraries/documentation

For example: `fix: a panick on xxx when grin exiting`. Please don't worry if you can't find a suitable prefix, this's just optional, not mandatory.

# Grin Style Guide

This project uses `rustfmt` to maintain consistent formatting. We've made sure that rustfmt runs **automatically**, but you must install rustfmt manually first.

## Install rustfmt

**Note**: To work with grin you must use `rustup`. Linux package managers typically carry a too old rust version.
See [build docs](doc/build.md) for more info.

First ensure you have a new enough rustfmt:
```
rustup update
rustup component add rustfmt
rustfmt --version
```

and verify you did get version `rustfmt 1.0.0-stable (43206f4 2018-11-30)` or newer.

Then run `cargo build` to activate a git `pre-commit` hook that automates the rustfmt usage so you don't have to worry much about it. Read on for how to make this work in your advantage.

## Creating git commits

When you make a commit, rustfmt will be run and we also **automatically** reformat the .rs files that your commit is touching.

Please separate the rustfmt changes into one (or several) separate commits. This is best practice.

Easiest is to make your commit as normal and if rustfmt stops you, just redo the commit again, since it should always be allowed on the second try. Then add all rustfmt:ed files (`git add -u`) and commit them (`git commit -m "rustfmt"`).

You do have to remember to do this manually.

**Note**: The pre-commit hook will not prevent commits if style issues are present, instead it will indicate any files that need formatting, and it will automatically run `rustfmt` on your changed files, each time when you try to do `git commit`.

### Manually configuring git hooks

If you are developing new or changed git hooks, or are curious, you can config hooks manually like this `git config core.hooksPath ./.hooks` and to verify the effect do `git config --list | grep hook` and expect the output to be `core.hookspath=./.hooks`

### Running rustfmt manually

Not recommended, but you can run rustfmt on a file like this: `rustfmt client.rs`

**Notes**:
1. *Please keep rustfmt corrections in a separate commit. This is best practice and makes reviewing and merging your contribution work better.*

2. *If unsure about code formatting, it's just fine if you ignore and discard any rustfmt changes. It's only a nice-to-have. Your contribution and code changes is the priority here. Hope you're happy to contribute on this open source project!*

3. Please don't ~~`cargo +nightly fmt`~~ because all grin developers are using stable rustfmt. Also please don't rustfmt files that your code changes does not touch to avoid causing merge conflicts.

## Thanks for any contribution

Even one word correction are welcome! Our objective is to encourage you to get interested in Grin and contribute in any way possible. Thanks for any help!

{'repo_name': 'mimblewimble/grin', 'stars': '4682', 'repo_language': 'Rust', 'file_name': 'test_coinbase_maturity.rs', 'mime_type': 'text/plain', 'hash': -3667098192816864526, 'source_dataset': 'data'}


\name{cluster_within_group}
\alias{cluster_within_group}
\title{
Cluster within and between Groups
}
\description{
Cluster within and between Groups
}
\usage{
cluster_within_group(mat, factor)
}
\arguments{

  \item{mat}{A matrix where clustering is applied on columns.}
  \item{factor}{A categorical vector.}

}
\details{
The clustering is firstly applied in each group, then clustering is applied
to group means. The within-group dendrograms and between-group dendrogram
are finally connected by \code{\link{merge_dendrogram}}.

In the final dendrogram, the within group dendrograms are enforced to be
flat lines to emphasize that the within group dendrograms have no sense to
compare to between-group dendrogram.
}
\value{
A \code{\link{dendrogram}} object. The order of columns can be retrieved by \code{\link[stats]{order.dendrogram}}.
}
\examples{
m = matrix(rnorm(120), nc = 12)
colnames(m) = letters[1:12]
fa = rep(c("a", "b", "c"), times = c(2, 4, 6))
dend = cluster_within_group(m, fa)
grid.dendrogram(dend, test = TRUE)
}

{'repo_name': 'jokergoo/ComplexHeatmap', 'stars': '520', 'repo_language': 'R', 'file_name': 'Legends-class.Rd', 'mime_type': 'text/plain', 'hash': -2502303478364215816, 'source_dataset': 'data'}


name: crone_B
type: crone

art:
commonfx: .deathfx death_medium
skill: .id "curse_vulnerability" .anim "attack_spell" .fx "curse_vulnerability" .targchestfx "curse_vulnerability_target" .area_pos_offset 0 25 .target_area_pos_offset 0 25
skill: .id "fetid_censer" .anim "attack_ranged" .fx "fetid_censer" .targfx "fetid_censer_target" .area_pos_offset 0 25 .target_area_pos_offset 0 25
skill: .id "embrace_the_dark" .anim "attack_spell" .fx "embrace_the_dark"
.end

info:
display: .size 1
enemy_type: .id "man"
stats: .hp 19 .def 28.75% .prot 0 .spd 9 .stun_resist 30% .poison_resist 60% .bleed_resist 40% .debuff_resist 60% .move_resist 30%
skill: .id "curse_vulnerability" .type "ranged" .atk 88.75% .dmg 1 2 .crit 6%  .effect "Crone Curse 3" "Mark Target" .launch 4321 .target 1234 .extra_targets_count 1 .extra_targets_chance 0.6
skill: .id "fetid_censer" .type "melee" .atk 88.75% .dmg 2 3 .crit 11%  .effect "Stress 1" "Blight 3" "Crone Fetid Disease 3" .launch 21 .target ~12
skill: .id "embrace_the_dark" .type "ranged" .atk 88.75% .dmg 0 0 .crit 0%  .effect "Stress 1" "Darkness 2" .launch 4321 .target 1234 .extra_targets_count 1 .extra_targets_chance 0.5 .is_crit_valid False
personality: .prefskill -1
loot: .code "A" .count 1
initiative: .number_of_turns_per_round 1
monster_brain: .id crone_B
death_class: .monster_class_id corpse_B .is_valid_on_crit False .type "corpse"
battle_modifier: .disable_stall_penalty False .can_surprise True .can_be_surprised True .always_surprise False .always_be_surprised False
.end

{'repo_name': 'Reinisch/Darkest-Dungeon-Unity', 'stars': '328', 'repo_language': 'C#', 'file_name': 'AudioManager.asset', 'mime_type': 'text/plain', 'hash': 8678772499205580552, 'source_dataset': 'data'}


/*
 *  /MathJax/jax/output/SVG/fonts/TeX/AMS/Regular/LatinExtendedA.js
 *
 *  Copyright (c) 2009-2015 The MathJax Consortium
 *
 *  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.
 */

MathJax.Hub.Insert(MathJax.OutputJax.SVG.FONTDATA.FONTS.MathJax_AMS,{295:[695,13,540,42,562,"182 599Q182 611 174 615T133 619Q118 619 114 621T109 630Q109 636 114 656T122 681Q125 685 202 688Q272 695 286 695Q304 695 304 684Q304 682 295 644T282 597Q282 592 360 592H399Q430 592 445 587T460 563Q460 552 451 541L442 535H266L251 468Q247 453 243 436T236 409T233 399Q233 395 244 404Q295 441 357 441Q405 441 445 417T485 333Q485 284 449 178T412 58T426 44Q447 44 466 68Q485 87 500 130L509 152H531H543Q562 152 562 144Q562 128 546 93T494 23T415 -13Q385 -13 359 3T322 44Q318 52 318 77Q318 99 352 196T386 337Q386 386 346 386Q318 386 286 370Q267 361 245 338T211 292Q207 287 193 235T162 113T138 21Q128 7 122 4Q105 -12 83 -12Q66 -12 54 -2T42 26L166 530Q166 534 161 534T129 535Q127 535 122 535T112 534Q74 534 74 562Q74 570 77 576T84 585T96 589T109 591T124 592T138 592L182 595V599"]});MathJax.Ajax.loadComplete(MathJax.OutputJax.SVG.fontDir+"/AMS/Regular/LatinExtendedA.js");

{'repo_name': 'staticfile/static', 'stars': '1265', 'repo_language': 'None', 'file_name': 'ko.json', 'mime_type': 'text/plain', 'hash': -37476754344873564, 'source_dataset': 'data'}


SET DEFAULT_STORAGE_ENGINE = 'tokudb';
# Establish connection conn1 (user = root)
DROP TABLE IF EXISTS foo;
set session transaction isolation level repeatable read;
create table foo (a int, b varchar (100), primary key (a))engine=TokuDB;
set session transaction isolation level repeatable read;
begin;
# should return nothing
select * from foo;
a	b
insert into foo values (1, "G");
replace into foo values (1, "Ga");
replace into foo values (1, "Gar");
replace into foo values (1, "Garb");
replace into foo values (1, "Garba");
replace into foo values (1, "a");
begin;
# Should read (1, "a")
select * from foo;
a	b
1	a
# Should be empty
select * from foo;
a	b
commit;
commit;
set session transaction isolation level serializable;
DROP TABLE foo;

{'repo_name': 'percona/tokudb-engine', 'stars': '610', 'repo_language': 'C++', 'file_name': 'handlerton-lock', 'mime_type': 'text/plain', 'hash': 8599584270308294457, 'source_dataset': 'data'}


/* Copyright (c) 2015-2018, EPFL/Blue Brain Project
 * All rights reserved. Do not distribute without permission.
 * Responsible Author: Daniel.Nachbaur@epfl.ch
 *
 * This file is part of Brayns <https://github.com/BlueBrain/Brayns>
 *
 * This library is free software; you can redistribute it and/or modify it under
 * the terms of the GNU Lesser General Public License version 3.0 as published
 * by the Free Software Foundation.
 *
 * This library 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 Lesser General Public License for more
 * details.
 *
 * You should have received a copy of the GNU Lesser General Public License
 * along with this library; if not, write to the Free Software Foundation, Inc.,
 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 */

#pragma once

#include <brayns/common/tasks/Task.h>
#include <brayns/common/tasks/TaskRuntimeError.h>

namespace brayns
{
const auto ERROR_ID_MISSING_PARAMS = -1731;
const auto ERROR_ID_UNSUPPORTED_TYPE = -1732;
const auto ERROR_ID_INVALID_BINARY_RECEIVE = -1733;
const auto ERROR_ID_LOADING_BINARY_FAILED = -1734;

const TaskRuntimeError MISSING_PARAMS{"Missing params",
                                      ERROR_ID_MISSING_PARAMS};

const TaskRuntimeError UNSUPPORTED_TYPE{"Unsupported type",
                                        ERROR_ID_UNSUPPORTED_TYPE};

const TaskRuntimeError INVALID_BINARY_RECEIVE{
    "Invalid binary received; no more files expected or "
    "current file is complete",
    ERROR_ID_INVALID_BINARY_RECEIVE};

inline TaskRuntimeError LOADING_BINARY_FAILED(const std::string& error)
{
    return {error, ERROR_ID_LOADING_BINARY_FAILED};
}
}

{'repo_name': 'BlueBrain/Brayns', 'stars': '212', 'repo_language': 'C++', 'file_name': 'BasicSimulationRenderer.h', 'mime_type': 'text/x-c++', 'hash': -371904270024012877, 'source_dataset': 'data'}


//Sudoku Solver
#include <bits/stdc++.h>

using namespace std;

#define N 9

/*
0 0 5  0 0 0  0 0 0
0 0 0  0 0 7  0 3 1
0 0 8  6 0 0  0 4 0

0 9 4  8 0 0  0 0 0
0 5 0  0 0 6  0 0 0
8 1 0  0 0 5  0 0 0

0 0 0  3 7 0  4 0 5
0 0 1  4 0 0  0 6 0
0 7 0  0 0 0  0 0 0
*/
/*
8 0 1  7 0 2  0 4 0
0 0 6  4 0 0  0 3 0
3 0 0  5 0 0  0 0 0

0 0 7  3 9 0  0 0 0
0 6 8  1 0 5  4 9 0
0 0 0  0 2 8  7 0 0

0 0 0  0 0 6  0 0 2
0 3 0  0 0 7  9 0 0
0 4 0  2 0 3  5 0 7

*/

/*
0 0 0 2 6 0 7 0 1
6 8 0 0 7 0 0 9 0
1 9 0 0 0 4 5 0 0
8 2 0 1 0 0 0 4 0
0 0 4 6 0 2 9 0 0
0 5 0 0 0 3 0 2 8
0 0 9 3 0 0 0 7 4
0 4 0 0 5 0 0 3 6
7 0 3 0 1 8 0 0 0

*/

void print(std::vector<std::vector<int> > grid)
{
    cout<<"\n";
    for(int i=0;i<N;i++)
    {
        for(int j=0;j<N;j++)
            cout<<grid[i][j]<<" ";
        std::cout  << '\n';
    }
}

bool nonviolate(std::vector<std::vector<int> > grid)
{
    //cout<<"Checking violation...";
    //print(grid);
    for(int i=0;i<N;i++)
    {
        for(int j=0;j<N;j++)
        {
            for(int k=j+1;k<N;k++)
            {
                if(grid[i][k]&&grid[i][j]==grid[i][k])
                    return false;
                if(grid[j][i]&&grid[j][i]==grid[k][i])
                    return false;
            }
        }
    }
    for(int i=0;i<3;i++)
    {
        for(int j=0;j<3;j++)
        {
            for(int k=0;k<N;k++)
            {
                for(int l=k+1;l<N;l++)
                {
                    if(grid[3*i+k/3][3*j+k%3]&&grid[3*i+k/3][3*j+k%3]==grid[3*i+l/3][3*j+l%3])
                        return false;
                }
            }
        }
    }
}

bool complete(std::vector<std::vector<int> > grid)
{
    //print(grid);
    for(int i=0;i<N;i++)
    {
        for(int j=0;j<N;j++)
        {
            if(!grid[i][j])
                return false;
        }
    }
    //print(grid);
    return true;
}

std::vector<std::vector<int> > solve(std::vector<std::vector<int> > grid,int curr_i=0,int curr_j=0)
{
    std::vector<std::vector<int> > temp(N,std::vector<int> (N,0));
    if(curr_i*N+curr_j>=N*N)
    {
        return grid;
    }
    if(grid[curr_i][curr_j])
    {
        return solve(grid,curr_i+(curr_j+1)/N,(curr_j+1)%N);
    }
    for(int i=1;i<=N;i++)
    {
        grid[curr_i][curr_j]=i;
        //cout<<curr_i<<" "<<curr_j<<" "<<i<<"\n";
        if(nonviolate(grid))
        {
            //cout<<"Doesn't violate!\n\n";
            temp=solve(grid,curr_i+(curr_j+1)/N,(curr_j+1)%N);
            if(complete(temp))
            {
                //cout<<"Return from "<<curr_i<<","<<curr_j<<"\n";
                return temp;
            }
        }
        //else
            //cout<<"Violates\n\n";
        grid[curr_i][curr_j]=0;
    }
    return grid;

}

int main(int argc, char const *argv[])
{
    std::vector<std::vector<int> > grid(N,std::vector<int> (N,0));

    for(int i=0;i<N;i++)
    {
        for(int j=0;j<N;j++)
            cin>>grid[i][j];
    }

    grid=solve(grid);
    if(!complete(grid))
    {
        cout<<"Unsolvable\n";
        return 0;
    }
    print(grid);
    return 0;
}
//

{'repo_name': 'Aniket965/Hello-world', 'stars': '1465', 'repo_language': 'Jupyter Notebook', 'file_name': 'hello_world.fish', 'mime_type': 'text/plain', 'hash': -449231514061419672, 'source_dataset': 'data'}


<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2015 The Android Open Source Project

   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.
-->

<vector xmlns:android="http://schemas.android.com/apk/res/android"
    android:width="24dp"
    android:height="24dp"
    android:viewportWidth="48"
    android:viewportHeight="48">
    <path
        android:pathData="M0 0h48v48H0z" />
    <path
        android:fillColor="#000000"
        android:pathData="M36 16h-2v-4c0-5.52-4.48-10-10-10S14 6.48 14 12v4h-2c-2.21 0-4 1.79-4 4v20c0
2.21 1.79 4 4 4h24c2.21 0 4-1.79 4-4V20c0-2.21-1.79-4-4-4zM24 34c-2.21
0-4-1.79-4-4s1.79-4 4-4 4 1.79 4 4-1.79 4-4 4zm6.2-18H17.8v-4c0-3.42 2.78-6.2
6.2-6.2 3.42 0 6.2 2.78 6.2 6.2v4z" />
</vector>

{'repo_name': 'ResurrectionRemix/android_frameworks_base', 'stars': '101', 'repo_language': 'Java', 'file_name': 'NsdServiceInfo.java', 'mime_type': 'text/x-java', 'hash': 3146788662116039040, 'source_dataset': 'data'}


#ifndef BOOST_BASIC_RECURSIVE_MUTEX_WIN32_HPP
#define BOOST_BASIC_RECURSIVE_MUTEX_WIN32_HPP

//  basic_recursive_mutex.hpp
//
//  (C) Copyright 2006-8 Anthony Williams
//  (C) Copyright 2011-2012 Vicente J. Botet Escriba
//
//  Distributed under the Boost Software License, Version 1.0. (See
//  accompanying file LICENSE_1_0.txt or copy at
//  http://www.boost.org/LICENSE_1_0.txt)

#include <boost/thread/win32/thread_primitives.hpp>
#include <boost/thread/win32/basic_timed_mutex.hpp>
#ifdef BOOST_THREAD_USES_CHRONO
#include <boost/chrono/system_clocks.hpp>
#include <boost/chrono/ceil.hpp>
#endif

#include <boost/config/abi_prefix.hpp>

namespace boost
{
    namespace detail
    {
        template<typename underlying_mutex_type>
        struct basic_recursive_mutex_impl
        {
            long recursion_count;
            long locking_thread_id;
            underlying_mutex_type mutex;

            void initialize()
            {
                recursion_count=0;
                locking_thread_id=0;
                mutex.initialize();
            }

            void destroy()
            {
                mutex.destroy();
            }

            bool try_lock() BOOST_NOEXCEPT
            {
                long const current_thread_id=win32::GetCurrentThreadId();
                return try_recursive_lock(current_thread_id) || try_basic_lock(current_thread_id);
            }

            void lock()
            {
                long const current_thread_id=win32::GetCurrentThreadId();
                if(!try_recursive_lock(current_thread_id))
                {
                    mutex.lock();
                    BOOST_INTERLOCKED_EXCHANGE(&locking_thread_id,current_thread_id);
                    recursion_count=1;
                }
            }
#if defined BOOST_THREAD_USES_DATETIME
            bool timed_lock(::boost::system_time const& target)
            {
                long const current_thread_id=win32::GetCurrentThreadId();
                return try_recursive_lock(current_thread_id) || try_timed_lock(current_thread_id,target);
            }
            template<typename Duration>
            bool timed_lock(Duration const& timeout)
            {
                return timed_lock(get_system_time()+timeout);
            }
#endif

#ifdef BOOST_THREAD_USES_CHRONO
        template <class Rep, class Period>
        bool try_lock_for(const chrono::duration<Rep, Period>& rel_time)
        {
                long const current_thread_id=win32::GetCurrentThreadId();
                return try_recursive_lock(current_thread_id) || try_timed_lock_for(current_thread_id,rel_time);
        }
        template <class Clock, class Duration>
        bool try_lock_until(const chrono::time_point<Clock, Duration>& t)
        {
                long const current_thread_id=win32::GetCurrentThreadId();
                return try_recursive_lock(current_thread_id) || try_timed_lock_until(current_thread_id,t);
        }
#endif
            void unlock()
            {
                if(!--recursion_count)
                {
                    BOOST_INTERLOCKED_EXCHANGE(&locking_thread_id,0);
                    mutex.unlock();
                }
            }

        private:
            bool try_recursive_lock(long current_thread_id) BOOST_NOEXCEPT
            {
                if(::boost::detail::interlocked_read_acquire(&locking_thread_id)==current_thread_id)
                {
                    ++recursion_count;
                    return true;
                }
                return false;
            }

            bool try_basic_lock(long current_thread_id) BOOST_NOEXCEPT
            {
                if(mutex.try_lock())
                {
                    BOOST_INTERLOCKED_EXCHANGE(&locking_thread_id,current_thread_id);
                    recursion_count=1;
                    return true;
                }
                return false;
            }

#if defined BOOST_THREAD_USES_DATETIME
            bool try_timed_lock(long current_thread_id,::boost::system_time const& target)
            {
                if(mutex.timed_lock(target))
                {
                    BOOST_INTERLOCKED_EXCHANGE(&locking_thread_id,current_thread_id);
                    recursion_count=1;
                    return true;
                }
                return false;
            }
#endif
            template <typename TP>
            bool try_timed_lock_until(long current_thread_id,TP const& target)
            {
                if(mutex.try_lock_until(target))
                {
                    BOOST_INTERLOCKED_EXCHANGE(&locking_thread_id,current_thread_id);
                    recursion_count=1;
                    return true;
                }
                return false;
            }
            template <typename D>
            bool try_timed_lock_for(long current_thread_id,D const& target)
            {
                if(mutex.try_lock_for(target))
                {
                    BOOST_INTERLOCKED_EXCHANGE(&locking_thread_id,current_thread_id);
                    recursion_count=1;
                    return true;
                }
                return false;
            }
        };

        typedef basic_recursive_mutex_impl<basic_timed_mutex> basic_recursive_mutex;
        typedef basic_recursive_mutex_impl<basic_timed_mutex> basic_recursive_timed_mutex;
    }
}

#define BOOST_BASIC_RECURSIVE_MUTEX_INITIALIZER {0}

#include <boost/config/abi_suffix.hpp>

#endif

{'repo_name': 'FantasticLBP/Hotels', 'stars': '312', 'repo_language': 'Objective-C', 'file_name': 'IQKeyboardManager.strings', 'mime_type': 'text/plain', 'hash': 5736143021872045837, 'source_dataset': 'data'}


import tensorflow as tf

from .registry import register

@register("default")
def default():
  return tf.contrib.training.HParams(
      type="image",
      batch_size=64,
      learning_rate=0.01,
      lr_scheme="exp",
      delay=0,
      staircased=False,
      learning_rate_decay_interval=2000,
      learning_rate_decay_rate=0.1,
      clip_grad_norm=1.0,
      l2_loss=0.0,
      label_smoothing=0.1,
      init_scheme="random",
      warmup_steps=10000)

{'repo_name': 'for-ai/CipherGAN', 'stars': '112', 'repo_language': 'Python', 'file_name': '__init__.py', 'mime_type': 'text/x-python', 'hash': -3108014323139386362, 'source_dataset': 'data'}


[< Previous](../find-k-th-smallest-pair-distance "Find K-th Smallest Pair Distance")

[Next >](../accounts-merge "Accounts Merge")

## [720. Longest Word in Dictionary (Easy)](https://leetcode.com/problems/longest-word-in-dictionary "词典中最长的单词")

Given a list of strings words representing an English Dictionary, find the longest word in words that can be built one character at a time by other words in words.  If there is more than one possible answer, return the longest word with the smallest lexicographical order.
  If there is no answer, return the empty string.

Example 1:

Input:
words = ["w","wo","wor","worl", "world"]
Output: "world"
Explanation:
The word "world" can be built one character at a time by "w", "wo", "wor", and "worl".

Example 2:

Input:
words = ["a", "banana", "app", "appl", "ap", "apply", "apple"]
Output: "apple"
Explanation:
Both "apply" and "apple" can be built from other words in the dictionary. However, "apple" is lexicographically smaller than "apply".

Note:

All the strings in the input will only contain lowercase letters.

The length of words will be in the range [1, 1000].

The length of words[i] will be in the range [1, 30].

### Related Topics
  [[Trie](../../tag/trie/README.md)]
  [[Hash Table](../../tag/hash-table/README.md)]

### Similar Questions
  1. [Longest Word in Dictionary through Deleting](../longest-word-in-dictionary-through-deleting) (Medium)
  1. [Implement Magic Dictionary](../implement-magic-dictionary) (Medium)

### Hints

Hint 1
For every word in the input list, we can check whether all prefixes of that word are in the input list by using a Set.

{'repo_name': 'openset/leetcode', 'stars': '127', 'repo_language': 'Go', 'file_name': '601-900.md', 'mime_type': 'text/html', 'hash': -1278666440277111226, 'source_dataset': 'data'}


name: Publish to NPM

on:
  push:
    tags:
      - '*'

jobs:
  publish-npm:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v1
      - uses: actions/setup-node@v1
        with:
          node-version: 10.16.3
      - name: Download & Build Icons
        run: npm ci --progress=false && npm i @iconscout/unicons@latest && npm run generate
      - name: Publish to NPM
        run: echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > ~/.npmrc && npm publish
        env:
          NPM_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}

{'repo_name': 'Iconscout/react-unicons', 'stars': '198', 'repo_language': 'JavaScript', 'file_name': 'index.html', 'mime_type': 'text/html', 'hash': 1610668643276527574, 'source_dataset': 'data'}


Changelog
---------

### Version 0.2

* Land the new learning module (initial version from [@graux-pierre](https://github.com/graux-pierre))
* Add documentation on how-to-learn a function, associated principle and limits
* Mine function address from IDA in sibyl func
* Support multiple strategy for trace pruning
* Add support for API stubbing
* Radare2 find script from [@m-1-k-3](https://github.com/m-1-k-3)
* Toshiba MeP support from [@guedou](https://github.com/guedou)

Minors :

* Various fixes from [@serpilliere](https://github.com/serpilliere)
* Reflect API changes for Miasm v0.1.1
* Add configuration associated with PIN (PIN_ROOT + tracer path)
* Add regression tests for the learning module
* Support expanduser in config
* Restrict `bzero` implementation to avoid false positive
* Adds support for function returning a non-allocated pointer

### Version 0.1

This is the initial release, including:

* Sibyl as a Python module
* CLI `sibyl`
* IDA stub
* Configuration management
* Support for Miasm, QEMU engine
* Support for a few ABI
* Support for a few functions of _string.h_, _ctype.h_ and _stdlib.h_
* Regression tests
* PoC of a learning module
* Documentation

{'repo_name': 'cea-sec/Sibyl', 'stars': '432', 'repo_language': 'Python', 'file_name': 'ADD_ABI.md', 'mime_type': 'text/x-python', 'hash': -6794176643756497320, 'source_dataset': 'data'}


/*
Copyright 2015 The Kubernetes Authors.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

package storage

import (
	"context"
	"fmt"

	"k8s.io/apimachinery/pkg/api/meta"
	"k8s.io/apimachinery/pkg/fields"
	"k8s.io/apimachinery/pkg/labels"
	"k8s.io/apimachinery/pkg/runtime"
	"k8s.io/apimachinery/pkg/types"
	"k8s.io/apimachinery/pkg/watch"
)

// Versioner abstracts setting and retrieving metadata fields from database response
// onto the object ot list. It is required to maintain storage invariants - updating an
// object twice with the same data except for the ResourceVersion and SelfLink must be
// a no-op. A resourceVersion of type uint64 is a 'raw' resourceVersion,
// intended to be sent directly to or from the backend. A resourceVersion of
// type string is a 'safe' resourceVersion, intended for consumption by users.
type Versioner interface {
	// UpdateObject sets storage metadata into an API object. Returns an error if the object
	// cannot be updated correctly. May return nil if the requested object does not need metadata
	// from database.
	UpdateObject(obj runtime.Object, resourceVersion uint64) error
	// UpdateList sets the resource version into an API list object. Returns an error if the object
	// cannot be updated correctly. May return nil if the requested object does not need metadata from
	// database. continueValue is optional and indicates that more results are available if the client
	// passes that value to the server in a subsequent call. remainingItemCount indicates the number
	// of remaining objects if the list is partial. The remainingItemCount field is omitted during
	// serialization if it is set to nil.
	UpdateList(obj runtime.Object, resourceVersion uint64, continueValue string, remainingItemCount *int64) error
	// PrepareObjectForStorage should set SelfLink and ResourceVersion to the empty value. Should
	// return an error if the specified object cannot be updated.
	PrepareObjectForStorage(obj runtime.Object) error
	// ObjectResourceVersion returns the resource version (for persistence) of the specified object.
	// Should return an error if the specified object does not have a persistable version.
	ObjectResourceVersion(obj runtime.Object) (uint64, error)

	// ParseResourceVersion takes a resource version argument and
	// converts it to the storage backend. For watch we should pass to helper.Watch().
	// Because resourceVersion is an opaque value, the default watch
	// behavior for non-zero watch is to watch the next value (if you pass
	// "1", you will see updates from "2" onwards).
	ParseResourceVersion(resourceVersion string) (uint64, error)
}

// ResponseMeta contains information about the database metadata that is associated with
// an object. It abstracts the actual underlying objects to prevent coupling with concrete
// database and to improve testability.
type ResponseMeta struct {
	// TTL is the time to live of the node that contained the returned object. It may be
	// zero or negative in some cases (objects may be expired after the requested
	// expiration time due to server lag).
	TTL int64
	// The resource version of the node that contained the returned object.
	ResourceVersion uint64
}

// IndexerFunc is a function that for a given object computes
// <value of an index> for a particular <index>.
type IndexerFunc func(obj runtime.Object) string

// IndexerFuncs is a mapping from <index name> to function that
// for a given object computes <value for that index>.
type IndexerFuncs map[string]IndexerFunc

// Everything accepts all objects.
var Everything = SelectionPredicate{
	Label: labels.Everything(),
	Field: fields.Everything(),
}

// MatchValue defines a pair (<index name>, <value for that index>).
type MatchValue struct {
	IndexName string
	Value     string
}

// Pass an UpdateFunc to Interface.GuaranteedUpdate to make an update
// that is guaranteed to succeed.
// See the comment for GuaranteedUpdate for more details.
type UpdateFunc func(input runtime.Object, res ResponseMeta) (output runtime.Object, ttl *uint64, err error)

// ValidateObjectFunc is a function to act on a given object. An error may be returned
// if the hook cannot be completed. The function may NOT transform the provided
// object.
type ValidateObjectFunc func(ctx context.Context, obj runtime.Object) error

// ValidateAllObjectFunc is a "admit everything" instance of ValidateObjectFunc.
func ValidateAllObjectFunc(ctx context.Context, obj runtime.Object) error {
	return nil
}

// Preconditions must be fulfilled before an operation (update, delete, etc.) is carried out.
type Preconditions struct {
	// Specifies the target UID.
	// +optional
	UID *types.UID `json:"uid,omitempty"`
	// Specifies the target ResourceVersion
	// +optional
	ResourceVersion *string `json:"resourceVersion,omitempty"`
}

// NewUIDPreconditions returns a Preconditions with UID set.
func NewUIDPreconditions(uid string) *Preconditions {
	u := types.UID(uid)
	return &Preconditions{UID: &u}
}

func (p *Preconditions) Check(key string, obj runtime.Object) error {
	if p == nil {
		return nil
	}
	objMeta, err := meta.Accessor(obj)
	if err != nil {
		return NewInternalErrorf(
			"can't enforce preconditions %v on un-introspectable object %v, got error: %v",
			*p,
			obj,
			err)
	}
	if p.UID != nil && *p.UID != objMeta.GetUID() {
		err := fmt.Sprintf(
			"Precondition failed: UID in precondition: %v, UID in object meta: %v",
			*p.UID,
			objMeta.GetUID())
		return NewInvalidObjError(key, err)
	}
	if p.ResourceVersion != nil && *p.ResourceVersion != objMeta.GetResourceVersion() {
		err := fmt.Sprintf(
			"Precondition failed: ResourceVersion in precondition: %v, ResourceVersion in object meta: %v",
			*p.ResourceVersion,
			objMeta.GetResourceVersion())
		return NewInvalidObjError(key, err)
	}
	return nil
}

// Interface offers a common interface for object marshaling/unmarshaling operations and
// hides all the storage-related operations behind it.
type Interface interface {
	// Returns Versioner associated with this interface.
	Versioner() Versioner

	// Create adds a new object at a key unless it already exists. 'ttl' is time-to-live
	// in seconds (0 means forever). If no error is returned and out is not nil, out will be
	// set to the read value from database.
	Create(ctx context.Context, key string, obj, out runtime.Object, ttl uint64) error

	// Delete removes the specified key and returns the value that existed at that spot.
	// If key didn't exist, it will return NotFound storage error.
	Delete(ctx context.Context, key string, out runtime.Object, preconditions *Preconditions, validateDeletion ValidateObjectFunc) error

	// Watch begins watching the specified key. Events are decoded into API objects,
	// and any items selected by 'p' are sent down to returned watch.Interface.
	// resourceVersion may be used to specify what version to begin watching,
	// which should be the current resourceVersion, and no longer rv+1
	// (e.g. reconnecting without missing any updates).
	// If resource version is "0", this interface will get current object at given key
	// and send it in an "ADDED" event, before watch starts.
	Watch(ctx context.Context, key string, resourceVersion string, p SelectionPredicate) (watch.Interface, error)

	// WatchList begins watching the specified key's items. Items are decoded into API
	// objects and any item selected by 'p' are sent down to returned watch.Interface.
	// resourceVersion may be used to specify what version to begin watching,
	// which should be the current resourceVersion, and no longer rv+1
	// (e.g. reconnecting without missing any updates).
	// If resource version is "0", this interface will list current objects directory defined by key
	// and send them in "ADDED" events, before watch starts.
	WatchList(ctx context.Context, key string, resourceVersion string, p SelectionPredicate) (watch.Interface, error)

	// Get unmarshals json found at key into objPtr. On a not found error, will either
	// return a zero object of the requested type, or an error, depending on ignoreNotFound.
	// Treats empty responses and nil response nodes exactly like a not found error.
	// The returned contents may be delayed, but it is guaranteed that they will
	// be have at least 'resourceVersion'.
	Get(ctx context.Context, key string, resourceVersion string, objPtr runtime.Object, ignoreNotFound bool) error

	// GetToList unmarshals json found at key and opaque it into *List api object
	// (an object that satisfies the runtime.IsList definition).
	// The returned contents may be delayed, but it is guaranteed that they will
	// be have at least 'resourceVersion'.
	GetToList(ctx context.Context, key string, resourceVersion string, p SelectionPredicate, listObj runtime.Object) error

	// List unmarshalls jsons found at directory defined by key and opaque them
	// into *List api object (an object that satisfies runtime.IsList definition).
	// The returned contents may be delayed, but it is guaranteed that they will
	// be have at least 'resourceVersion'.
	List(ctx context.Context, key string, resourceVersion string, p SelectionPredicate, listObj runtime.Object) error

	// GuaranteedUpdate keeps calling 'tryUpdate()' to update key 'key' (of type 'ptrToType')
	// retrying the update until success if there is index conflict.
	// Note that object passed to tryUpdate may change across invocations of tryUpdate() if
	// other writers are simultaneously updating it, so tryUpdate() needs to take into account
	// the current contents of the object when deciding how the update object should look.
	// If the key doesn't exist, it will return NotFound storage error if ignoreNotFound=false
	// or zero value in 'ptrToType' parameter otherwise.
	// If the object to update has the same value as previous, it won't do any update
	// but will return the object in 'ptrToType' parameter.
	// If 'suggestion' can contain zero or one element - in such case this can be used as
	// a suggestion about the current version of the object to avoid read operation from
	// storage to get it.
	//
	// Example:
	//
	// s := /* implementation of Interface */
	// err := s.GuaranteedUpdate(
	//     "myKey", &MyType{}, true,
	//     func(input runtime.Object, res ResponseMeta) (runtime.Object, *uint64, error) {
	//       // Before each invocation of the user defined function, "input" is reset to
	//       // current contents for "myKey" in database.
	//       curr := input.(*MyType)  // Guaranteed to succeed.
	//
	//       // Make the modification
	//       curr.Counter++
	//
	//       // Return the modified object - return an error to stop iterating. Return
	//       // a uint64 to alter the TTL on the object, or nil to keep it the same value.
	//       return cur, nil, nil
	//    },
	// )
	GuaranteedUpdate(
		ctx context.Context, key string, ptrToType runtime.Object, ignoreNotFound bool,
		precondtions *Preconditions, tryUpdate UpdateFunc, suggestion ...runtime.Object) error

	// Count returns number of different entries under the key (generally being path prefix).
	Count(key string) (int64, error)
}

{'repo_name': 'gardener/gardener', 'stars': '1570', 'repo_language': 'Go', 'file_name': 'gardener_seed_admission_controller.go', 'mime_type': 'text/plain', 'hash': -5148822818339120745, 'source_dataset': 'data'}


DEFAULT coreos

LABEL coreos
    KERNEL
    APPEND initrd= cloud-config-url=http://foreman.some.host.fqdn/unattended/provision

{'repo_name': 'theforeman/foreman', 'stars': '1857', 'repo_language': 'Ruby', 'file_name': 'gce.rb', 'mime_type': 'text/plain', 'hash': -490832395414032634, 'source_dataset': 'data'}


#ifndef RENAMED_H
#define RENAMED_H

#include "renamed_on_export_export.h"

struct RENAMED_ON_EXPORT_EXPORT Renamed
{
  int foo();
};

#endif

{'repo_name': 'Kitware/CMake', 'stars': '3239', 'repo_language': 'C', 'file_name': 'qt.tools.cmake.xx.qs.in', 'mime_type': 'text/plain', 'hash': -1159095804535961053, 'source_dataset': 'data'}


//
//  Project_11___PlayLocalVideoUITests.swift
//  Project 11 - PlayLocalVideoUITests
//
//  Created by 陈炯 on 16/5/23.
//  Copyright © 2016年 Jiong. All rights reserved.
//

import XCTest

class Project_11___PlayLocalVideoUITests: XCTestCase {

    override func setUp() {
        super.setUp()

        // Put setup code here. This method is called before the invocation of each test method in the class.

        // In UI tests it is usually best to stop immediately when a failure occurs.
        continueAfterFailure = false
        // UI tests must launch the application that they test. Doing this in setup will make sure it happens for each test method.
        XCUIApplication().launch()

        // In UI tests it’s important to set the initial state - such as interface orientation - required for your tests before they run. The setUp method is a good place to do this.
    }

    override func tearDown() {
        // Put teardown code here. This method is called after the invocation of each test method in the class.
        super.tearDown()
    }

    func testExample() {
        // Use recording to get started writing UI tests.
        // Use XCTAssert and related functions to verify your tests produce the correct results.
    }

}

{'repo_name': 'cjiong/LearnSwift', 'stars': '616', 'repo_language': 'Swift', 'file_name': 'module.modulemap', 'mime_type': 'text/plain', 'hash': -2154358822471045488, 'source_dataset': 'data'}


/** Copyright 2017 Amazon.com. All rights reserved. */

#pragma once

#include "com/amazonaws/kinesis/video/client/Include.h"

namespace com { namespace amazonaws { namespace kinesis { namespace video {

/**
* Kinesis Video client level callback provider
*
*   getClientReadyCallback();
*   getStorageOverflowPressureCallback();
*
*/
class ClientCallbackProvider {
public:
    /**
     * Returns the custom data for this object to be used with the callbacks.
     *
     * @return Custom data
     */
    virtual UINT64 getCallbackCustomData() = 0;

    /**
     * Reports a ready state for the client.
     *
     * Optional callback
     *
     *  @return a function pointer conforming to the description above.
     */
    virtual ClientReadyFunc getClientReadyCallback() {
        return nullptr;
    };

    /**
     * Reports storage overflow/pressure
     *
     * Optional callback
     *
     *  @return a function pointer conforming to the description above.
     */
    virtual StorageOverflowPressureFunc getStorageOverflowPressureCallback() {
        return nullptr;
    };

    virtual ~ClientCallbackProvider() {};
};

} // namespace video
} // namespace kinesis
} // namespace amazonaws
} // namespace com

{'repo_name': 'awslabs/amazon-kinesis-video-streams-producer-sdk-cpp', 'stars': '198', 'repo_language': 'C++', 'file_name': 'gstkvstest.cpp', 'mime_type': 'text/x-c++', 'hash': -254170654568122680, 'source_dataset': 'data'}


<annotation verified="yes">
	<folder>images</folder>
	<filename>raccoon-116.jpg</filename>
	<path>/Users/datitran/Desktop/raccoon/images/raccoon-116.jpg</path>
	<source>
		<database>Unknown</database>
	</source>
	<size>
		<width>660</width>
		<height>432</height>
		<depth>3</depth>
	</size>
	<segmented>0</segmented>
	<object>
		<name>raccoon</name>
		<pose>Unspecified</pose>
		<truncated>1</truncated>
		<difficult>0</difficult>
		<bndbox>
			<xmin>3</xmin>
			<ymin>1</ymin>
			<xmax>436</xmax>
			<ymax>430</ymax>
		</bndbox>
	</object>
</annotation>

{'repo_name': 'datitran/raccoon_dataset', 'stars': '1079', 'repo_language': 'Jupyter Notebook', 'file_name': 'object-detection.pbtxt', 'mime_type': 'text/plain', 'hash': 5877854559937913965, 'source_dataset': 'data'}


---
title: App model
description: Windows Mixed Reality uses the app model provided by the Universal Windows Platform, a model and environment for modern Windows apps.
author: thetuvix
ms.author: alexturn
ms.date: 03/21/2018
ms.topic: article
keywords: UWP, app model, lifecycle, suspend, resume, tile, views, contracts
---

# App model

Windows Mixed Reality uses the app model provided by the [Universal Windows Platform](https://docs.microsoft.com/windows/uwp/get-started/) (UWP), a model and environment for modern Windows apps. The UWP app model defines how apps are installed, updated, versioned and removed safely and completely. It governs the application life cycle - how apps execute, sleep and terminate - and how they can preserve state. It also covers integration and interaction with the operating system, files and other apps.

![2D apps arranged in the Windows Mixed Reality home in a breakfast area](images/20160112-055908-hololens-500px.jpg)

*Apps with a 2D view arranged in the Windows Mixed Reality home*

## App lifecycle

The lifecycle of a mixed reality app involves standard app concepts such as placement, launch, termination and removal.

### Placement is launch

Every app starts in mixed reality by placing an app tile (just a [Windows secondary tile](https://docs.microsoft.com/uwp/api/Windows.UI.StartScreen.SecondaryTile)) in the [Windows Mixed Reality home](../discover/navigating-the-windows-mixed-reality-home.md). These app tiles, on placement, will start running the app. These app tiles persist and stay at the location where they are placed, acting like launchers for anytime you want to get back to the app.

![Placement puts a secondary tile in the world](images/slide1-600px.png)

*Placement puts a secondary tile in the world*

As soon as placement completes (unless the placement was started by an [app to app](app-model.md#protocols) launch), the app starts launching. Windows Mixed Reality can run a limited number of apps at one time. As soon as you place and launch an app, other active apps may suspend, leaving a screenshot of the app's last state on its app tile wherever you placed it. See [Windows 10 UWP app lifecycle](https://docs.microsoft.com/windows/uwp/launch-resume/app-lifecycle) for more information on handling resume and other app life cycle events.

![After placing a tile, the app starts running](images/slide2-500px.png) ![State diagram for app running, suspended or not running](images/ic576232-500px.png)

*Left: after placing a tile, the app starts running. Right: state diagram for app running, suspended, or not running.*

### Remove is close/terminate process

When you remove a placed app tile from the world, this closes the underlying processes. This can be useful for ensuring your app is terminated or restarting a problematic app.

### App suspension/termination

In the [Windows Mixed Reality home](../discover/navigating-the-windows-mixed-reality-home.md), the user is able to create multiple entry points for an app. They do this by launching your app from the Start menu and placing the app tile in the world. Each app tile behaves as a different entry point, and has a separate tile instance in the system. A query for [SecondaryTile.FindAllAsync](https://docs.microsoft.com/uwp/api/Windows.UI.StartScreen.SecondaryTile#Windows_UI_StartScreen_SecondaryTile_FindAllAsync) will result in a **SecondaryTile** for each app instance.

When a UWP app suspends, a screenshot is taken of the current state.

![Screenshots are shown for suspended apps](images/slide9-800px.png)

*Screenshots are shown for suspended apps*

One key difference from other Windows 10 shells is how the app is informed of an app instance activation via the [CoreApplication.Resuming](https://docs.microsoft.com/uwp/api/Windows.ApplicationModel.Core.CoreApplication#Windows_ApplicationModel_Core_CoreApplication_Resuming) and [CoreWindow.Activated](https://docs.microsoft.com/uwp/api/windows.ui.core.corewindow#Windows_UI_Core_CoreWindow_Activated) events.

|  Scenario |  Resuming  |  Activated |
|----------|----------|----------|
|  Launch new instance of app from the Start menu  |   |  **Activated** with a new [TileId](https://docs.microsoft.com/uwp/api/windows.ui.startscreen.secondarytile#Windows_UI_StartScreen_SecondaryTile_TileId) |
|  Launch second instance of app from the Start menu  |   |  **Activated** with a new **TileId** |
|  Select the instance of the app that is not currently active  |   |  **Activated** with the **TileId** associated with the instance |
|  Select a different app, then select the previously active instance  |  **Resuming** raised  |  |
|  Select a different app, then select the instance that was previously inactive  |  **Resuming** raised  |  Then **Activated** with the **TileId** associated with the instance |

### Extended execution

Sometimes your app needs to continue doing work in the background or playing audio. [Background tasks](https://docs.microsoft.com/windows/uwp/launch-resume/declare-background-tasks-in-the-application-manifest) are available on HoloLens.

![Apps can run in the background](images/slide10-800px.png)

*Apps can run in the background*

## App views

When your app activates, you can choose what type of view you'd like to display. For an app's **CoreApplication**, there is always a primary [app view](https://docs.microsoft.com/uwp/api/Windows.UI.ViewManagement.ApplicationView) and any number of further app views you would like to create. On desktop, you can think of an app view as a window. Our mixed reality app templates create a Unity project where the primary app view is [immersive](app-views.md).

Your app can create an additional 2D app view using technology like XAML, to use Windows 10 features such as in-app purchase. If your app started as a UWP app for other Windows 10 devices, your primary view is 2D, but you could "light up" in mixed reality by adding an additional app view that's immersive to show an experience volumetrically. Imagine building a photo viewer app in XAML where the slideshow button switched to an immersive app view that flew photos from the app across the world and surfaces.

![The running app can have a 2D view or an immersive view](images/slide3-800px.png)

*The running app can have a 2D view or an immersive view*

### Creating an immersive view

Mixed reality apps are those that create an immersive view, which is achieved with the [HolographicSpace](https://docs.microsoft.com/uwp/api/windows.graphics.holographic.holographicspace) type.

An app that is purely immersive should always create an immersive view on launch, even if launched from the desktop. Immersive views always show up in the headset, regardless of where they were created from. Activating an immersive view will display the Mixed Reality Portal and guide the user to put on their headset.

An app that starts with a 2D view on the desktop monitor may create a secondary immersive view to show content in the headset. An example of this is a 2D Edge window on the monitor displaying a 360-degree video in the headset.

![Apps running in immersive view are the only one visible](images/slide4-800px.png)

*An app running in an immersive view is the only one visible*

### 2D view in the Windows Mixed Reality home

Anything other than an immersive view is rendered as a 2D view in your world.

An app may have 2D views on both the desktop monitor and in the headset. Note that a new 2D view will be placed in the same shell as the view that created it, either on the monitor or in the headset. It is not currently possible for an app or a user to move a 2D view between the Mixed Reality home and the monitor.

![Apps running in 2D view share the space in the mixed world with other apps](images/slide5-800px.png)

*Apps running in a 2D view share the space with other apps*

### Placement of additional app tiles

You can place as many apps with a 2D view in your world as you want with the [Secondary Tile APIs](https://docs.microsoft.com/windows/uwp/design/shell/tiles-and-notifications/secondary-tiles). These "pinned" tiles will appear as splash screens that users must place and then can later use to launch your app. Windows Mixed Reality does not currently support rendering any of the 2D tile content as live tiles.

![Apps can have multiple placements using secondary tiles](images/slide6-800px.png)

*Apps can have multiple placements using secondary tiles*

### Switching views

#### Switching from the 2D XAML view to the immersive view

If the app uses XAML, then the XAML [IFrameworkViewSource](https://docs.microsoft.com/uwp/api/windows.applicationmodel.core.iframeworkviewsource) will control the first view of the app. The app will need to switch to the immersive view before activating the **CoreWindow**, to ensure the app launches directly into the immersive experience.

Use [CoreApplication.CreateNewView](https://docs.microsoft.com/uwp/api/Windows.ApplicationModel.Core.CoreApplication#Windows_ApplicationModel_Core_CoreApplication_CreateNewView_Windows_ApplicationModel_Core_IFrameworkViewSource_) and [ApplicationViewSwitcher.SwitchAsync](https://docs.microsoft.com/uwp/api/Windows.UI.ViewManagement.ApplicationViewSwitcher#Windows_UI_ViewManagement_ApplicationViewSwitcher_SwitchAsync_System_Int32_) to make it the active view.

> [!NOTE]
>* Do not specify the [ApplicationViewSwitchingOptions.ConsolidateViews](https://docs.microsoft.com/uwp/api/windows.ui.viewmanagement.applicationviewswitchingoptions) flag to **SwitchAsync** when switching from the XAML view to the immersive view, or the slate that launched the app will be removed from the world.
>* **SwitchAsync** should be called using the [Dispatcher](https://docs.microsoft.com/uwp/api/windows.ui.core.corewindow#Windows_UI_Core_CoreWindow_Dispatcher) associated with the view you are switching into.
>* You will need to **SwitchAsync** back to the XAML view if you need to launch a virtual keyboard or want to activate another app.

![Apps can switch between 2D views and immersive views](images/slide7-600px.png) ![When an app goes into an immersive view, the mixed world and other apps disappear](images/slide8-600px.png)

*Left: apps can switch between 2D view and immersive view. Right: when an app goes into an immersive view, the Windows Mixed Reality home and other apps disappear.*

#### Switching from the immersive view back to a keyboard XAML view

One common reason for switching back-and-forth between views is displaying a keyboard in a mixed reality app. The shell is only able to display the system keyboard if the app is showing a 2D view. If the app needs to get text input, it may provide a custom XAML view with a text input field, switch to it, and then switch back after the input is complete.

Like in the previous section, you can use **ApplicationViewSwitcher.SwitchAsync** to transition back to a XAML view from your immersive view.

## App size

2D app views always appear in a fixed virtual slate. This makes all 2D views show the exact same amount of content. Here are some further details about the size of your app's 2D view:
* The aspect ratio of the app is preserved while resizing.
* App [resolution and scale factor](../develop/porting-apps/building-2d-apps.md#2d-app-view-resolution-and-scale-factor) are not changed by resizing.
* Apps are not able to query their actual size in the world.

![2D apps appear with fixed window sizes](images/12493521-10104043956964683-6118765685995662420-o-500px.jpg)

*Apps with a 2D view appear with fixed window sizes*

## App tiles

The Start menu uses the standard small tile and medium tile for pins and the **All Apps** list in mixed reality.

![The Start menu for Windows Mixed Reality](images/start-500px.png)

*The Start menu for Windows Mixed Reality*

## App to app interactions

As you build apps, you have access to the rich app to app communication mechanisms available on Windows 10. Many of the new Protocol APIs and file registrations work perfectly on HoloLens to enable app launching and communication.

Note that for desktop headsets, the app associated with a given file extension or protocol may be a Win32 app that can only appear on the desktop monitor or in the desktop slate.

### Protocols

HoloLens supports app to app launching via the [Windows.System.Launcher APIs](https://docs.microsoft.com/uwp/api/Windows.System.Launcher).

There are some things to consider when launching another application:

* When doing a non-modal launch, such as [LaunchUriAsync](https://docs.microsoft.com/uwp/api/Windows.System.Launcher#Windows_System_Launcher_LaunchUriAsync_Windows_Foundation_Uri_), the user must place the app before interacting with it.

* When doing a modal launch, such as through [LaunchUriForResultsAsync](https://docs.microsoft.com/uwp/api/Windows.System.Launcher#Windows_System_Launcher_LaunchUriForResultsAsync_Windows_Foundation_Uri_Windows_System_LauncherOptions_Windows_Foundation_Collections_ValueSet_), the modal app is placed on top of the window.

* Windows Mixed Reality cannot overlay applications on top of exclusive views. In order to show the launched app, Windows takes the user back to the world to display the application.

### File pickers

HoloLens supports both [FileOpenPicker](https://docs.microsoft.com/uwp/api/Windows.Storage.Pickers.FileOpenPicker) and [FileSavePicker](https://docs.microsoft.com/uwp/api/Windows.Storage.Pickers.FileSavePicker) contracts. However, no app comes pre-installed that fulfills the file picker contracts. These apps - OneDrive, for example - can be installed from the Microsoft Store.

If you have more than one file picker app installed, you will not see any disambiguation UI for choosing which app to launch; instead, the first file picker installed will be chosen. When saving a file, the filename is generated which includes the timestamp. This cannot be changed by the user.

By default, the following extensions are supported locally:

|  App  |  Extensions |
|----------|----------|
|  Photos  |  bmp, gif, jpg, png, avi, mov, mp4, wmv |
|  Microsoft Edge  |  htm, html, pdf, svg, xml |

### App contracts and Windows Mixed Reality extensions

App contracts and extension points allow you to register your app to take advantage of deeper operating system features like handling a file extension or using background tasks. This is a list of the supported and unsupported contracts and extension points on HoloLens.

|  Contract or Extension  |  Supported? |
|----------|----------|
| [Account Picture Provider (extension)](https://msdn.microsoft.com/library/windows/desktop/hh464906.aspx#account_picture_provider) | Unsupported |
| [Alarm](https://msdn.microsoft.com/library/windows/desktop/hh464906.aspx#alarm) | Unsupported |
| [App service](https://msdn.microsoft.com/library/windows/desktop/hh464906.aspx#app_service) | Supported but not fully functional |
| [Appointments provider](https://msdn.microsoft.com/library/windows/desktop/hh464906.aspx#appointmnets_provider) | Unsupported |
| [AutoPlay (extension)](https://msdn.microsoft.com/library/windows/desktop/hh464906.aspx#autoplay) | Unsupported |
| [Background tasks (extension)](https://msdn.microsoft.com/library/windows/desktop/hh464906.aspx#background_tasts) | Partially Supported (not all triggers work) |
| [Update task (extension)](https://msdn.microsoft.com/library/windows/desktop/hh464906.aspx#update_task) | Supported |
| [Cached file updater contract](https://msdn.microsoft.com/library/windows/desktop/hh464906.aspx#cached_file_updater) | Supported |
| [Camera settings (extension)](https://msdn.microsoft.com/library/windows/desktop/hh464906.aspx#camera_settings) | Unsupported |
| [Dial protocol](https://msdn.microsoft.com/library/windows/desktop/hh464906.aspx#dial_protocol) | Unsupported |
| [File activation (extension)](https://msdn.microsoft.com/library/windows/desktop/hh464906.aspx#file_activation) | Supported |
| [File Open Picker contract](https://msdn.microsoft.com/library/windows/desktop/hh464906.aspx#file_open_picker_contract) | Supported |
| [File Save Picker contract](https://msdn.microsoft.com/library/windows/desktop/hh464906.aspx#file_save_picker_contract) | Supported |
| [Lock screen call](https://msdn.microsoft.com/library/windows/desktop/hh464906.aspx#lock_screen_call) | Unsupported |
| [Media playback](https://msdn.microsoft.com/library/windows/desktop/hh464906.aspx#media_playback) | Unsupported |
| [Play To contract](https://msdn.microsoft.com/library/windows/desktop/hh464906.aspx#playto_contract) | Unsupported |
| [Preinstalled config task](https://msdn.microsoft.com/library/windows/desktop/hh464906.aspx#preinstalled_config_task) | Unsupported |
| [Print 3D Workflow](https://msdn.microsoft.com/library/windows/desktop/hh464906.aspx#print_3d_workflow) | Supported |
| [Print task settings (extension)](https://msdn.microsoft.com/library/windows/desktop/hh464906.aspx#print_task_settings) | Unsupported |
| [URI activation (extension)](https://msdn.microsoft.com/library/windows/desktop/hh464906.aspx#protocol_activation) | Supported |
| [Restricted launch](https://msdn.microsoft.com/library/windows/desktop/hh464906.aspx#restricted_launch) | Unsupported |
| [Search contract](https://msdn.microsoft.com/library/windows/desktop/hh464906.aspx#search_contract) | Unsupported |
| [Settings contract](https://msdn.microsoft.com/library/windows/desktop/hh464906.aspx#settings_contract) | Unsupported |
| [Share contract](https://msdn.microsoft.com/library/windows/desktop/hh464906.aspx#share_contract) | Unsupported |
| [SSL/certificates (extension)](https://msdn.microsoft.com/library/windows/desktop/hh464906.aspx#ssl_certificates) | Supported |
| [Web account provider](https://msdn.microsoft.com/library/windows/desktop/hh464906.aspx#web_account_provider) | Supported |

## App file storage

All storage is through the [Windows.Storage namespace](https://docs.microsoft.com/uwp/api/Windows.Storage). See the following documentation for more details. HoloLens does not support app storage sync/roaming.

* [Files, folders, and libraries](https://docs.microsoft.com/windows/uwp/files/index)
* [Store and retrieve settings and other app data](https://docs.microsoft.com/windows/uwp/design/app-settings/store-and-retrieve-app-data)

### Known folders

See [KnownFolders](https://docs.microsoft.com/uwp/api/Windows.Storage.KnownFolders) for the full details for UWP apps.

 Property	 Supported on HoloLens	 Supported on immersive headsets	 Description

AppCaptures	✔	✔	Gets the App Captures folder.

CameraRoll	✔	✔	Gets the Camera Roll folder.

DocumentsLibrary	✔	✔	Gets the Documents library. The Documents library is not intended for general use.

MusicLibrary	✔	✔	Gets the Music library.

Objects3D	✔	✔	Gets the Objects 3D folder.

PicturesLibrary	✔	✔	Gets the Pictures library.

Playlists	✔	✔	Gets the play lists folder.

SavedPictures	✔	✔	Gets the Saved Pictures folder.

VideosLibrary	✔	✔	Gets the Videos library.

HomeGroup		✔	Gets the HomeGroup folder.

MediaServerDevices		✔	Gets the folder of media server (Digital Living Network Alliance (DLNA)) devices.

RecordedCalls		✔	Gets the recorded calls folder.

RemovableDevices		✔	Gets the removable devices folder.

## App package

With Windows 10 you no longer target an operating system but instead [target your app to one or more device families](https://docs.microsoft.com/windows/uwp/get-started/universal-application-platform-guide#device-families). A device family identifies the APIs, system characteristics, and behaviors that you can expect across devices within the device family. It also determines the set of devices on which your app can be installed from the [Microsoft Store](../distribute/submitting-an-app-to-the-microsoft-store.md#specifying-target-device-families).

* To target both desktop headsets and HoloLens, target your app to the **Windows.Universal** device family.
* To target just desktop headsets, target your app to the **Windows.Desktop** device family.
* To target just HoloLens, target your app to the **Windows.Holographic** device family.

## See also

* [App views](app-views.md)
* [Updating 2D UWP apps for mixed reality](../develop/porting-apps/building-2d-apps.md)
* [3D app launcher design guidance](../distribute/3d-app-launcher-design-guidance.md)
* [Implementing 3D app launchers](../distribute/implementing-3d-app-launchers.md)

{'repo_name': 'MicrosoftDocs/mixed-reality', 'stars': '128', 'repo_language': 'PowerShell', 'file_name': 'direct-manipulation.md', 'mime_type': 'text/html', 'hash': 5590852019983562057, 'source_dataset': 'data'}


/*
 * Copyright 2020 ThoughtWorks, Inc.
 *
 * 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 com.thoughtworks.go.config.elastic;

import com.thoughtworks.go.config.ConfigCollection;
import com.thoughtworks.go.config.ConfigTag;
import com.thoughtworks.go.config.PluginProfiles;
import com.thoughtworks.go.config.Validatable;

import java.util.Arrays;

@ConfigTag("clusterProfiles")
@ConfigCollection(ClusterProfile.class)
public class ClusterProfiles extends PluginProfiles<ClusterProfile> implements Validatable {

    public ClusterProfiles() {
    }

    public ClusterProfiles(ClusterProfile... clusters) {
        super(Arrays.asList(clusters));
    }

}

{'repo_name': 'gocd/gocd', 'stars': '5700', 'repo_language': 'Java', 'file_name': 'message.properties', 'mime_type': 'text/plain', 'hash': 8678155937881115393, 'source_dataset': 'data'}


// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.

using osu.Game.Rulesets.Mods;

namespace osu.Game.Rulesets.Taiko.Mods
{
    public class TaikoModEasy : ModEasy
    {
        public override string Description => @"Beats move slower, less accuracy required, and three lives!";
    }
}

{'repo_name': 'ppy/osu', 'stars': '5092', 'repo_language': 'C#', 'file_name': 'AndroidManifest.xml', 'mime_type': 'text/xml', 'hash': 3680121232752016666, 'source_dataset': 'data'}


<?php
/**
 * ChartJsGeneratorTest.php
 * Copyright (c) 2019 james@firefly-iii.org
 *
 * This file is part of Firefly III (https://github.com/firefly-iii).
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Affero 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 Affero General Public License for more details.
 *
 * You should have received a copy of the GNU Affero General Public License
 * along with this program.  If not, see <https://www.gnu.org/licenses/>.
 */

declare(strict_types=1);

namespace Tests\Unit\Generator\Chart\Basic;

use FireflyIII\Generator\Chart\Basic\ChartJsGenerator;
use Log;
use Tests\TestCase;

/**
 *
 * Class ChartJsGeneratorTest
 * @SuppressWarnings(PHPMD.CouplingBetweenObjects)
 * @SuppressWarnings(PHPMD.ExcessiveMethodLength)
 * @SuppressWarnings(PHPMD.TooManyPublicMethods)
 */
class ChartJsGeneratorTest extends TestCase
{
    /**
     *
     */
    public function setUp(): void
    {
        self::markTestIncomplete('Incomplete for refactor.');

        return;
        parent::setUp();
        Log::info(sprintf('Now in %s.', get_class($this)));
    }

    /**
     * @covers \FireflyIII\Generator\Chart\Basic\ChartJsGenerator
     */
    public function testBasic(): void
    {

        $data = [
            [
                'label'   => 'Today',
                'fill'    => '#abcdef',
                'yAxisID' => 'a',
                'entries' => [
                    'one'   => 1,
                    'two'   => 2,
                    'three' => 3,
                    'four'  => 4,
                    'five'  => 5,
                ],
            ],
            [

                'currency_symbol' => 'X',
                'backgroundColor' => '#123456',
                'label'           => 'Tomorrow',
                'entries'         => [
                    'one'   => 6,
                    'two'   => 7,
                    'three' => 8,
                    'four'  => 9,
                    'five'  => 10,
                ],
            ],
        ];

        /** @var ChartJsGenerator $generator */
        $generator = app(ChartJsGenerator::class);

        $result = $generator->multiSet($data);
        $this->assertEquals('one', $result['labels'][0]);
        $this->assertEquals(2, $result['count']);
        $this->assertCount(2, $result['datasets']);

        $this->assertEquals('a', $result['datasets'][0]['yAxisID']);
        $this->assertEquals('#abcdef', $result['datasets'][0]['fill']);

        $this->assertEquals('X', $result['datasets'][1]['currency_symbol']);
        $this->assertEquals('#123456', $result['datasets'][1]['backgroundColor']);
    }

    /**
     * @covers \FireflyIII\Generator\Chart\Basic\ChartJsGenerator
     */
    public function testMultiCurrencyPieChart(): void
    {

        $data = [
            'one'   => ['amount' => -1, 'currency_symbol' => 'a'],
            'two'   => ['amount' => -2, 'currency_symbol' => 'b'],
            'three' => ['amount' => -3, 'currency_symbol' => 'c'],
        ];

        /** @var ChartJsGenerator $generator */
        $generator = app(ChartJsGenerator::class);
        $result    = $generator->multiCurrencyPieChart($data);

        $this->assertEquals('three', $result['labels'][0]);
        $this->assertEquals(3.0, $result['datasets'][0]['data'][0]);

    }

    /**
     * @covers \FireflyIII\Generator\Chart\Basic\ChartJsGenerator
     */
    public function testMultiCurrencyPieChartPositive(): void
    {

        $data = [
            'one'   => ['amount' => 1, 'currency_symbol' => 'a'],
            'two'   => ['amount' => 2, 'currency_symbol' => 'b'],
            'three' => ['amount' => 3, 'currency_symbol' => 'c'],
        ];

        /** @var ChartJsGenerator $generator */
        $generator = app(ChartJsGenerator::class);
        $result    = $generator->multiCurrencyPieChart($data);

        $this->assertEquals('three', $result['labels'][0]);
        $this->assertEquals(3.0, $result['datasets'][0]['data'][0]);

    }

    /**
     * @covers \FireflyIII\Generator\Chart\Basic\ChartJsGenerator
     */
    public function testPieChart(): void
    {

        $data = [
            'one'   => -1,
            'two'   => -2,
            'three' => -3,
        ];

        /** @var ChartJsGenerator $generator */
        $generator = app(ChartJsGenerator::class);
        $result    = $generator->pieChart($data);

        $this->assertEquals('three', $result['labels'][0]);
        $this->assertEquals(3.0, $result['datasets'][0]['data'][0]);

    }

    /**
     * @covers \FireflyIII\Generator\Chart\Basic\ChartJsGenerator
     */
    public function testPieChartReversed(): void
    {

        $data = [
            'one'   => 1,
            'two'   => 2,
            'three' => 3,
        ];

        /** @var ChartJsGenerator $generator */
        $generator = app(ChartJsGenerator::class);
        $result    = $generator->pieChart($data);

        $this->assertEquals('three', $result['labels'][0]);
        $this->assertEquals(3.0, $result['datasets'][0]['data'][0]);

    }

    /**
     * @covers \FireflyIII\Generator\Chart\Basic\ChartJsGenerator
     */
    public function testSingleSet(): void
    {
        $data = [
            'one'   => '1',
            'two'   => '2',
            'three' => '3',
        ];

        /** @var ChartJsGenerator $generator */
        $generator = app(ChartJsGenerator::class);
        $result    = $generator->singleSet('Some label', $data);

        $this->assertEquals('one', $result['labels'][0]);
        $this->assertEquals(1.0, $result['datasets'][0]['data'][0]);
    }

}

{'repo_name': 'firefly-iii/firefly-iii', 'stars': '4718', 'repo_language': 'PHP', 'file_name': 'gf-source.css', 'mime_type': 'text/plain', 'hash': 5471242681865048308, 'source_dataset': 'data'}


// Copyright (c) 2012-2017 VideoStitch SAS
// Copyright (c) 2018 stitchEm
//
// Basic input unpacking tests.

#include "gpu/testing.hpp"
#include "gpu/exampleKernel.hpp"
#include "gpu/memcpy.hpp"
#include "gpu/uniqueBuffer.hpp"
#include "libvideostitch/context.hpp"
#include "util/pnm.hpp"

#include <cmath>
#include <future>
#include <thread>

namespace VideoStitch {
namespace Testing {

static const int NUM_PARALLEL_INVOCATIONS = 3;
static const int NUM_ITERATIONS = 3;

void testDummyKernel(float mult) {
  const int nbElements = 123;

  // init input
  float mem_host[nbElements];
  for (int i = 0; i < nbElements; ++i) {
    mem_host[i] = static_cast<float>(i);
  }
  auto inputBuff = GPU::uniqueBuffer<float>(nbElements, "dummyKernelTest");
  ENSURE(inputBuff.status());

  auto outputBuff = GPU::uniqueBuffer<float>(nbElements, "dummyKernelTest");
  ENSURE(outputBuff.status());

  auto potUniqStream = GPU::UniqueStream::create();
  ENSURE(potUniqStream.status());
  auto stream = potUniqStream.ref().borrow();

  // transfer and compute
  ENSURE(GPU::memcpyAsync(inputBuff.borrow(), mem_host, stream));
  Status status = Core::callDummyKernel(outputBuff.borrow(), inputBuff.borrow(), nbElements, mult, stream);
  ENSURE(status);
  ENSURE(GPU::memcpyAsync(mem_host, outputBuff.borrow().as_const(), stream));
  stream.synchronize();

  // compare results
  for (int i = 0; i < nbElements; ++i) {
    float targetValue = mult * static_cast<float>(i);
    ENSURE_APPROX_EQ(mem_host[i], targetValue, 1e-6f);
  }
}

void testParallelKernelCall() {
  std::vector<std::thread> threads;
  ENSURE(VideoStitch::GPU::setDefaultBackendDevice(0));
  for (int start = 0; start <= NUM_PARALLEL_INVOCATIONS; start++) {
    std::thread t([=]() {
      ENSURE(VideoStitch::GPU::useDefaultBackendDevice());
      for (int it = 0; it <= NUM_ITERATIONS; it++) {
        testDummyKernel(start * it);
      }
    });
    threads.push_back(std::move(t));
  }
  for (std::thread& t : threads) {
    t.join();
  }
}

}  // namespace Testing
}  // namespace VideoStitch

int main() {
  VideoStitch::Testing::initTest();
  VideoStitch::Testing::ENSURE(VideoStitch::GPU::setDefaultBackendDevice(0));
  VideoStitch::Testing::testDummyKernel(2.f);

#ifndef OCLGRIND
  // current oclgrind implementation does not seem to handle parallel kernel invocations correctly
  VideoStitch::Testing::testParallelKernelCall();
#endif
  return 0;
}

{'repo_name': 'stitchEm/stitchEm', 'stars': '110', 'repo_language': 'C++', 'file_name': 'ximea_unpack.cu', 'mime_type': 'text/x-c', 'hash': 7892034900836037664, 'source_dataset': 'data'}