text:
Contributing
============

There are a number of ways to contribute to Scrapy Cluster.

.. _report_issue:

Raising Issues
----------------

If you're thinking about raising an issue because you think you've found a problem with Scrapy Cluster, you'd like to make a request for a new feature in the codebase, or any other reason… please read this first.

The GitHub issue tracker is the preferred channel for `Bug Reports`_, `Feature Requests`_, or `Change Requests`_, but please respect the following restrictions:

* Please **search for existing issues**. Help us keep duplicate issues to a minimum by checking to see if someone has already reported your problem or requested your idea.

* Please **do not** use the issue tracker for personal setup or support requests. If the symptom doesn't appear in the :ref:`vagrant_setup` but appears in your production setup, it is not a Scrapy Cluster issue.

For all other chatter, feel free to join the `Community Chat`_ set up for Scrapy Cluster.

Bug Reports
^^^^^^^^^^^

A bug is a *demonstrable problem* that is caused by the code in the repository.
Good bug reports are extremely helpful - thank you!

Guidelines for bug reports:

    #. **Use the GitHub issue search**, check if the issue has already been reported.

    #. **Check if the issue has been fixed**, try to reproduce it using the
       latest `dev` branch or look for closed issues in the current milestone.

    #. **Isolate the problem**, ideally create a minimal test case to demonstrate a problem with the current build.

    #. **Include as much info as possible!** This includes but is not limited to, version of Kafka, Zookeeper, Redis, Scrapy Cluster (release, branch, or commit), OS, Pip Packages, or anything else that may impact the issue you are raising.

A good bug report shouldn't leave others needing to chase you up for more information.

Feature Requests
^^^^^^^^^^^^^^^^

If you've got a great idea, we want to hear about it! Please label the issue you create with ``feature request`` to distinguish it from other issues.

Before making a suggestion, here are a few handy tips on what to consider:

#. Visit the `Milestones <https://github.com/istresearch/scrapy-cluster/milestones>`_ and search through the known `feature requests <https://github.com/istresearch/scrapy-cluster/issues?utf8=%E2%9C%93&q=label%3A%22feature+request%22+>`_ to see if the feature has already been requested, or is on our roadmap already.

#. Check out `Working on Scrapy Cluster Core`_ - this explains the guidelines for what fits into the scope and aims of the project.

#. Think about whether your feature is for the Kafka Monitor, Redis Monitor, the Crawlers, or does it affect multiple areas? This can help when describing your idea.

#. Remember, it's up to *you* to make a strong case to convince the project's leaders of the merits of a new feature. Please provide as much detail and context as possible - this means explaining the use case and why it is likely to be common.

Change Requests
^^^^^^^^^^^^^^^

Change requests cover both architectural and functional changes to how Scrapy Cluster works. If you have an idea for a new or different dependency, a refactor, or an improvement to a feature, etc - please be sure to:

1. **Use the GitHub search** and check someone else didn't get there first

2. Take a moment to think about the best way to make a case for, and explain what you're thinking as it's up to you to convince the project's leaders the change is worthwhile. Some questions to consider are:

    - Is it really one idea or is it many?
    - What problem are you solving?
    - Why is what you are suggesting better than what's already there?

3. Label your issue with ``change request`` to help identify it within the issue tracker.

Community Chat
^^^^^^^^^^^^^^

If you would like to add a comment about Scrapy Cluster or to interact with the community surrounding and supporting Scrapy Cluster, feel free to join our `Gitter <https://gitter.im/istresearch/scrapy-cluster?utm_source=share-link&utm_medium=link&utm_campaign=share-link>`_ chat room. This is a place where both developers and community users can get together to talk about and discuss Scrapy Cluster.

.. _pull_requests:

Submitting Pull Requests
------------------------

Pull requests are awesome! Sometimes we simply do not have enough time in the day to get to everything we want to cover, or did not think of a different use case for Scrapy Cluster.

If you're looking to raise a PR for something which doesn't have an open issue, please think carefully about raising an issue which your PR can close, especially if you're fixing a bug. This makes it more likely that there will be enough information available for your PR to be properly tested and merged.

To make sure your PR is accepted as quickly as possible, please ensure you hit the following points:

    * You can run ``./run_tests_offline.sh`` **and** ``./run_tests_online.sh`` in your Vagrant test environment to ensure nothing is broken.

    * Did you add new code? That means it is probably unit-testable and should have a new unit test associated with it.

    * Your PR encapsulates a single alteration or enhancement to Scrapy Cluster, please do not try to fix multiple issues with a single PR without raising it on Github first.

    * If you are adding a significant feature, please put it in the :ref:`changelog` for the current Milestone we are driving towards.

Once you have a minimal pull request please submit it to the ``dev`` branch. That is where our core development work is conducted and we would love to have it in the latest bleeding edge build.

Testing and Quality Assurance
-----------------------------

Never underestimate just how useful quality assurance is. If you're looking to get involved with the code base and don't know where to start, checking out and testing a pull requests or the latest ``dev`` branch is one of the most useful things you can help with.

Essentially:

    1. Checkout the latest ``dev`` branch.
    2. Follow one of our :ref:`quickstart` guides to get your cluster up and running.
    3. Poke around our documentation, try to follow any of the other guides or ensure that we are explaining ourselves as clear as possible.
    4. Find anything odd? Please follow the `Bug Reports`_ guidelines and let us know!

Documentation
^^^^^^^^^^^^^

Scrapy Cluster's documentation can be found on `Read the Docs <http://scrapy-cluster.readthedocs.org/en/latest/>`_. If you have feedback or would like to write some user documentation, please let us know in our `Community Chat`_ room or by raising and issue and submitting a PR on how our documentation could be improved.

Working on Scrapy Cluster Core
------------------------------

Are you looking to help develop core functionality for Scrapy Cluster? Awesome!
Please see the :ref:`vagrant_setup` guide for a Vagrant Image to use to test small scale deployments of Scrapy Cluster. If you are looking to do large scale testing and development, please first ensure you can work with the Vagrant Image first.

If something goes wrong, please see the :ref:`debugging` guide first.

.. _lfstwo:

Looking for something to work on?
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

If you're interested in contributing to Scrapy Cluster and don't know where to start, here's a few things to consider.

* **We are trying to build an generic framework for large scale, distributed web crawling.** Code that is applicable only to your setup, installation, or use case may not be helpful to everyone else. The framework and code we create should be extendable, helpful, and improve the ability to succeed in this mission.

* Look for issues that are labeled with the **current** milestone and see if someone is already working on it. Leave a comment stating why you would like to work on this or the skills you can contribute to help complete the task.

* **Do not** begin development on features or issues outside of the current milestone. If you must, please submit an issue or comment and explain your motivation for working on something that we haven't quite gotten to yet.

* Do you have a neat idea or implementation for a new plugin or extenstion to any of the three core areas? We would love to hear about it or help guide you in building it.

* Test and use the `Scrapy Cluster Utils Package <https://pypi.python.org/pypi/scutils>`_ in your other projects! We would love feedback on how to improve the utilities package, it has been extremely helpful to us in developing Scrapy Cluster. More documentation can be found in the :ref:`scutils` section.

* Feel like you have a pretty good grasp with Scrapy Cluster? Please consider doing **large scale testing** of crawlers (10-20 machines at least, with 10-20 spiders per machine), and have the cluster crawl what ever your heart desires. Where are the runtime bottlenecks? Where can our algorithms be improved? Does certain cluster setups slow down crawling considerably? We are always looking to improve.

* Are you an expert in some other field where we lack? (Docker, Mesos, Conda, Python 3, etc) Please consider how you you can contribute to the project and talk with us on where we think you can best help.

If you're still stuck, feel free to send any of the core developers an message in the `Community Chat`_ as we are always happy to help.

Key Branches
^^^^^^^^^^^^

* ``master`` - (`link to master <https://github.com/istresearch/scrapy-cluster>`_) this branch reflects the lastest stable release. Hotfixes done to this branch should also be reflected in the ``dev`` branch

* ``dev`` - (`link to dev <https://github.com/istresearch/scrapy-cluster/tree/dev>`_) the main developer branch. Go here for the latest bleeding edge code

Other branches represent other features core developers are working on and will be merged back into the main ``dev`` branch once the feature is complete.


text:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class PannelAutoSize : MonoBehaviour {

    [SerializeField]
    int textLength;

    public void reSize(string hint_text)
    {

        textLength = hint_text.Length;

        Debug.Log(this.gameObject.GetComponent<RectTransform>().rect.width);
        Debug.Log(this.gameObject.GetComponent<RectTransform>().rect.height);

        this.gameObject.GetComponent<RectTransform>().sizeDelta = new Vector2(this.gameObject.GetComponent<RectTransform>().rect.width + (textLength * 2), this.gameObject.GetComponent<RectTransform>().rect.height);
    }
}

redpajama_set_name: RedPajamaGithub


text:
DWebAppStarter
==============

Empty webapp project, with react, browserify, browserSync, and other goodies.. Not very useful yet.

## Getting started
Download the repository
```
$ git clone https://github.com/dsdeur/DWebAppStarter.git
$ cd DWebAppStarter
```

Install the npm modules (might need sudo)
```
$ npm install
```

Start gulp
```
$ gulp
```

(I assume you have Node, NPM, Gulp etc.)

## TODO
* SASS basics: normalize, font imports, maybe icon set, grid framework (jeet or foundation)
* Basic html template
* Basic React page
* Other cool stuff


text:
<?php

use yii\helpers\Html;
use yii\widgets\ActiveForm;

/* @var $this yii\web\View */
/* @var $model frontend\models\ApplicationsSearch */
/* @var $form yii\widgets\ActiveForm */
?>

    <?php $form = ActiveForm::begin([
        'action' => ['index'],
        'method' => 'get',
    ]); ?>

    <?= $form->field($model, 'application_id') ?>

    <?= $form->field($model, 'name') ?>

    <?= $form->field($model, 'nic') ?>

    <?= $form->field($model, 'dob') ?>

    <?= $form->field($model, 'email') ?>

    <?php // echo $form->field($model, 'mobile') ?>

    <?php // echo $form->field($model, 'phone') ?>

    <?php // echo $form->field($model, 'nationality') ?>

    <?php // echo $form->field($model, 'gender') ?>

    <?php // echo $form->field($model, 'address') ?>

    <?php // echo $form->field($model, 'country') ?>

    <?php // echo $form->field($model, 'city') ?>

    <?php // echo $form->field($model, 'f_name') ?>

    <?php // echo $form->field($model, 'f_nic') ?>

    <?php // echo $form->field($model, 'f_dob') ?>

    <?php // echo $form->field($model, 'f_email') ?>

    <?php // echo $form->field($model, 'f_mobile') ?>

    <?php // echo $form->field($model, 'f_phone') ?>

    <?php // echo $form->field($model, 'f_nationality') ?>

    <?php // echo $form->field($model, 'f_current_address') ?>

    <?php // echo $form->field($model, 'f_country') ?>

    <?php // echo $form->field($model, 'f_city') ?>

    <?php // echo $form->field($model, 'campus') ?>

    <?php // echo $form->field($model, 'test_center') ?>

    <?php // echo $form->field($model, 'student_type') ?>

    <?php // echo $form->field($model, 'f_income') ?>

    <?php // echo $form->field($model, 'f_perminant_Address') ?>

    <?php // echo $form->field($model, 'hostal_flag') ?>

    <?php // echo $form->field($model, 'enable_flag') ?>

    <?php // echo $form->field($model, 'last_updated_date') ?>

    <?php // echo $form->field($model, 'last_updated_by') ?>

    <?php // echo $form->field($model, 'creation_date') ?>

    <?php // echo $form->field($model, 'created_by') ?>

    <?php // echo $form->field($model, 'last_update_login') ?>

    <?php // echo $form->field($model, 'print_id') ?>

        <?= Html::submitButton(Yii::t('app', 'Search'), ['class' => 'btn btn-primary']) ?>
        <?= Html::resetButton(Yii::t('app', 'Reset'), ['class' => 'btn btn-default']) ?>

    <?php ActiveForm::end(); ?>


text:
Template for a single Idyll post.

## Installation

- Make sure you have `idyll` installed (`npm i -g idyll`).
- Clone this repo and run `npm install`.

## Developing a post locally

Run `idyll`.

## Building a post for production

Run `idyll build`. The output will appear in the top-level `build` folder. To change the output location, change the `output` option in `package.json`.

## Deploying

Make sure your post has been built, then deploy the docs folder via any static hosting service.

## Dependencies

You can install custom dependencies by running `npm install <package-name> --save`. Note that any collaborators will also need download the package locally by running `npm install` after pulling the changes.


text:
import { State } from './reducers';

export default State;


text:
/* tslint:disable:max-line-length */
/**
 * Test Swagger
 * v1
 * example.com/api-base-path
 */

import {createFeatureSelector} from '@ngrx/store';

import {HttpErrorResponse} from '@angular/common/http';
import * as __model from '../../../../model';
import * as actions from './actions';

export interface RestAuthUserUpdateState {
  data: __model.UserDetails | null;
  loading: boolean;
  error: HttpErrorResponse | null;
}

export const initialRestAuthUserUpdateState: RestAuthUserUpdateState = {
  data: null,
  loading: false,
  error: null,
};

export const selectorName = 'RestAuth_RestAuthUserUpdate';
export const getRestAuthUserUpdateStateSelector = createFeatureSelector<RestAuthUserUpdateState>(selectorName);

export function RestAuthUserUpdateReducer(
  state: RestAuthUserUpdateState = initialRestAuthUserUpdateState,
  action: actions.RestAuthUserUpdateAction): RestAuthUserUpdateState {
  switch (action.type) {
    case actions.Actions.START: return {...state, loading: true, error: null};
    case actions.Actions.SUCCESS: return {...state, data: action.payload, loading: false};
    case actions.Actions.ERROR: return {...state, error: action.payload, loading: false};
    default: return state;
  }
}


text:
            Status:
            Active

            Unit of Measure:
            Each

            Current Revision:
            1

            Revision history

            Base Price:
            14.99 USD

            Base price currency matrix |
            Complex pricing

                    <input type="checkbox" value="isPurchased">
                    Is Purchased?

                    <input type="checkbox" value="isManufactured">
                    Is Manufactured?

                    <input type="checkbox" value="isSaleable">
                    Is Saleable?

                    <input type="checkbox" value="isDigital">
                    Is Digital?

                    <input type="checkbox" value="isUnlimitedQuantity">
                    Is Unlimited?


text:
const ee = require('sepal/ee')
const _ = require('lodash')
const {concat, map, switchMap, toArray} = require('rxjs')
const {sequence} = require('sepal/utils/array')

const filterTable = ({tableId, columnName, columnValue}) => {
    const table = ee.FeatureCollection(tableId)
    if (columnName) {
        const filters = [ee.Filter.eq(columnName, columnValue)]
        if (_.isFinite(_.toNumber(columnValue))) {
            filters.push(ee.Filter.eq(columnName, _.toNumber(columnValue)))
        }
        return table
            .limit(table.size())
            .filter(ee.Filter.or(...filters))
    } else {
        return table
    }
}

const ROW_CHUNK_SIZE = 5000

const getRows$ = (collection, description) => {
    const collectionSize$ =
        ee.getInfo$(
            collection.size(),
            'count rows'
        )

    const chunkCollection = size => {
        if (size <= ROW_CHUNK_SIZE)
            return [collection]

        const indexes = collection.aggregate_array('system:index')
            .zip(ee.List.sequence(0, size - 1))
            .map(indexTuple => ee.Feature(null, {
                systemIndex: ee.List(indexTuple).get(0),
                position: ee.List(indexTuple).get(1)
            }))
        const joined = ee.Join.saveFirst('__position__')
            .apply(collection, indexes, ee.Filter.equals({leftField: 'system:index', rightField: 'systemIndex'}))
            .map(feature => {
                const position = ee.Feature(feature.get('__position__'))
                    .getNumber('position')
                return feature.set('__position__', position)
            })
        const startPositions = sequence(0, size - 1, ROW_CHUNK_SIZE)
        return startPositions
            .map(start => {
                start = ee.Number(start)
                const end = start.add(ROW_CHUNK_SIZE)
                return joined
                    .filter(ee.Filter.and(
                        ee.Filter.greaterThanOrEquals('__position__', start),
                        ee.Filter.lessThan('__position__', end)
                    ))
                    .map(feature => ee.Feature(feature.geometry())
                        .copyProperties({source: feature, exclude: ['__position__']})
                    )
            })

    }

    const loadCollection$ = collection =>
        ee.getInfo$(collection, description)

    const mergeCollections = collections => {
        const features = collections.map(collection => collection.features).flat()
        if (features.length) {
            const columns = features[0].properties
            return {columns, features}
        } else {
            return {columns: [], features}
        }
    }

    return collectionSize$.pipe(
        switchMap(size =>
            concat(
                ...chunkCollection(size)
                    .map(collection => loadCollection$(collection))
            ).pipe(
                toArray()
            )),
        map(collections => mergeCollections(collections))
    )
}

module.exports = {
    filterTable,
    getRows$
}


text:
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/errno.h>
#include <linux/init.h>
#include <linux/mman.h>
#include <linux/nodemask.h>
#include <linux/memblock.h>
#include <linux/fs.h>
#include <linux/bootmem.h>
#include <linux/io.h>

#include <asm/cputype.h>
#include <asm/sections.h>
#include <asm/setup.h>
#include <asm/sizes.h>
#include <asm/tlb.h>
#include <asm/memblock.h>

#include <mach/map.h>

#include "mm.h"

/*
 * empty_zero_page is a special page that is used for
 * zero-initialized data and COW.
 */
struct page *empty_zero_page;
EXPORT_SYMBOL(empty_zero_page);

/*
 * The pmd table for the upper-most set of pages.
 */
pmd_t *top_pmd;

pgprot_t pgprot_user;
EXPORT_SYMBOL(pgprot_user);

pgprot_t pgprot_kernel;
EXPORT_SYMBOL(pgprot_kernel);

static int __init noalign_setup(char *__unused)
{
	cr_alignment &= ~CR_A;
	cr_no_alignment &= ~CR_A;
	set_cr(cr_alignment);
	return 1;
}
__setup("noalign", noalign_setup);

void adjust_cr(unsigned long mask, unsigned long set)
{
	unsigned long flags;

	mask &= ~CR_A;

	set &= mask;

	local_irq_save(flags);

	cr_no_alignment = (cr_no_alignment & ~mask) | set;
	cr_alignment = (cr_alignment & ~mask) | set;

	set_cr((get_cr() & ~mask) | set);

	local_irq_restore(flags);
}

struct map_desc {
	unsigned long virtual;
	unsigned long pfn;
	unsigned long length;
	unsigned int type;
};

#define PROT_PTE_DEVICE		(PTE_PRESENT | PTE_YOUNG |	\
				PTE_DIRTY | PTE_READ | PTE_WRITE)
#define PROT_SECT_DEVICE	(PMD_TYPE_SECT | PMD_PRESENT |	\
				PMD_SECT_READ | PMD_SECT_WRITE)

static struct mem_type mem_types[] = {
	[MT_DEVICE] = {		  /* Strongly ordered */
		.prot_pte	= PROT_PTE_DEVICE,
		.prot_l1	= PMD_TYPE_TABLE | PMD_PRESENT,
		.prot_sect	= PROT_SECT_DEVICE,
	},
	/*
	 * MT_KUSER: pte for vecpage -- cacheable,
	 *       and sect for unigfx mmap -- noncacheable
	 */
	[MT_KUSER] = {
		.prot_pte  = PTE_PRESENT | PTE_YOUNG | PTE_DIRTY |
				PTE_CACHEABLE | PTE_READ | PTE_EXEC,
		.prot_l1   = PMD_TYPE_TABLE | PMD_PRESENT,
		.prot_sect = PROT_SECT_DEVICE,
	},
	[MT_HIGH_VECTORS] = {
		.prot_pte  = PTE_PRESENT | PTE_YOUNG | PTE_DIRTY |
				PTE_CACHEABLE | PTE_READ | PTE_WRITE |
				PTE_EXEC,
		.prot_l1   = PMD_TYPE_TABLE | PMD_PRESENT,
	},
	[MT_MEMORY] = {
		.prot_pte  = PTE_PRESENT | PTE_YOUNG | PTE_DIRTY |
				PTE_WRITE | PTE_EXEC,
		.prot_l1   = PMD_TYPE_TABLE | PMD_PRESENT,
		.prot_sect = PMD_TYPE_SECT | PMD_PRESENT | PMD_SECT_CACHEABLE |
				PMD_SECT_READ | PMD_SECT_WRITE | PMD_SECT_EXEC,
	},
	[MT_ROM] = {
		.prot_sect = PMD_TYPE_SECT | PMD_PRESENT | PMD_SECT_CACHEABLE |
				PMD_SECT_READ,
	},
};

const struct mem_type *get_mem_type(unsigned int type)
{
	return type < ARRAY_SIZE(mem_types) ? &mem_types[type] : NULL;
}
EXPORT_SYMBOL(get_mem_type);

/*
 * Adjust the PMD section entries according to the CPU in use.
 */
static void __init build_mem_type_table(void)
{
	pgprot_user   = __pgprot(PTE_PRESENT | PTE_YOUNG | PTE_CACHEABLE);
	pgprot_kernel = __pgprot(PTE_PRESENT | PTE_YOUNG |
				 PTE_DIRTY | PTE_READ | PTE_WRITE |
				 PTE_EXEC | PTE_CACHEABLE);
}

#define vectors_base()	(vectors_high() ? 0xffff0000 : 0)

static void __init *early_alloc(unsigned long sz)
{
	void *ptr = __va(memblock_alloc(sz, sz));
	memset(ptr, 0, sz);
	return ptr;
}

static pte_t * __init early_pte_alloc(pmd_t *pmd, unsigned long addr,
		unsigned long prot)
{
	if (pmd_none(*pmd)) {
		pte_t *pte = early_alloc(PTRS_PER_PTE * sizeof(pte_t));
		__pmd_populate(pmd, __pa(pte) | prot);
	}
	BUG_ON(pmd_bad(*pmd));
	return pte_offset_kernel(pmd, addr);
}

static void __init alloc_init_pte(pmd_t *pmd, unsigned long addr,
				  unsigned long end, unsigned long pfn,
				  const struct mem_type *type)
{
	pte_t *pte = early_pte_alloc(pmd, addr, type->prot_l1);
	do {
		set_pte(pte, pfn_pte(pfn, __pgprot(type->prot_pte)));
		pfn++;
	} while (pte++, addr += PAGE_SIZE, addr != end);
}

static void __init alloc_init_section(pgd_t *pgd, unsigned long addr,
				      unsigned long end, unsigned long phys,
				      const struct mem_type *type)
{
	pmd_t *pmd = pmd_offset((pud_t *)pgd, addr);

	/*
	 * Try a section mapping - end, addr and phys must all be aligned
	 * to a section boundary.
	 */
	if (((addr | end | phys) & ~SECTION_MASK) == 0) {
		pmd_t *p = pmd;

		do {
			set_pmd(pmd, __pmd(phys | type->prot_sect));
			phys += SECTION_SIZE;
		} while (pmd++, addr += SECTION_SIZE, addr != end);

		flush_pmd_entry(p);
	} else {
		/*
		 * No need to loop; pte's aren't interested in the
		 * individual L1 entries.
		 */
		alloc_init_pte(pmd, addr, end, __phys_to_pfn(phys), type);
	}
}

/*
 * Create the page directory entries and any necessary
 * page tables for the mapping specified by `md'.  We
 * are able to cope here with varying sizes and address
 * offsets, and we take full advantage of sections.
 */
static void __init create_mapping(struct map_desc *md)
{
	unsigned long phys, addr, length, end;
	const struct mem_type *type;
	pgd_t *pgd;

	if (md->virtual != vectors_base() && md->virtual < TASK_SIZE) {
		printk(KERN_WARNING "BUG: not creating mapping for "
		       "0x%08llx at 0x%08lx in user region\n",
		       __pfn_to_phys((u64)md->pfn), md->virtual);
		return;
	}

	if ((md->type == MT_DEVICE || md->type == MT_ROM) &&
	    md->virtual >= PAGE_OFFSET && md->virtual < VMALLOC_END) {
		printk(KERN_WARNING "BUG: mapping for 0x%08llx at 0x%08lx "
		       "overlaps vmalloc space\n",
		       __pfn_to_phys((u64)md->pfn), md->virtual);
	}

	type = &mem_types[md->type];

	addr = md->virtual & PAGE_MASK;
	phys = (unsigned long)__pfn_to_phys(md->pfn);
	length = PAGE_ALIGN(md->length + (md->virtual & ~PAGE_MASK));

	if (type->prot_l1 == 0 && ((addr | phys | length) & ~SECTION_MASK)) {
		printk(KERN_WARNING "BUG: map for 0x%08lx at 0x%08lx can not "
		       "be mapped using pages, ignoring.\n",
		       __pfn_to_phys(md->pfn), addr);
		return;
	}

	pgd = pgd_offset_k(addr);
	end = addr + length;
	do {
		unsigned long next = pgd_addr_end(addr, end);

		alloc_init_section(pgd, addr, next, phys, type);

		phys += next - addr;
		addr = next;
	} while (pgd++, addr != end);
}

static void * __initdata vmalloc_min = (void *)(VMALLOC_END - SZ_128M);

/*
 * vmalloc=size forces the vmalloc area to be exactly 'size'
 * bytes. This can be used to increase (or decrease) the vmalloc
 * area - the default is 128m.
 */
static int __init early_vmalloc(char *arg)
{
	unsigned long vmalloc_reserve = memparse(arg, NULL);

	if (vmalloc_reserve < SZ_16M) {
		vmalloc_reserve = SZ_16M;
		printk(KERN_WARNING
			"vmalloc area too small, limiting to %luMB\n",
			vmalloc_reserve >> 20);
	}

	if (vmalloc_reserve > VMALLOC_END - (PAGE_OFFSET + SZ_32M)) {
		vmalloc_reserve = VMALLOC_END - (PAGE_OFFSET + SZ_32M);
		printk(KERN_WARNING
			"vmalloc area is too big, limiting to %luMB\n",
			vmalloc_reserve >> 20);
	}

	vmalloc_min = (void *)(VMALLOC_END - vmalloc_reserve);
	return 0;
}
early_param("vmalloc", early_vmalloc);

static phys_addr_t lowmem_limit __initdata = SZ_1G;

static void __init sanity_check_meminfo(void)
{
	int i, j;

	lowmem_limit = __pa(vmalloc_min - 1) + 1;
	memblock_set_current_limit(lowmem_limit);

	for (i = 0, j = 0; i < meminfo.nr_banks; i++) {
		struct membank *bank = &meminfo.bank[j];
		*bank = meminfo.bank[i];
		j++;
	}
	meminfo.nr_banks = j;
}

static inline void prepare_page_table(void)
{
	unsigned long addr;
	phys_addr_t end;

	/*
	 * Clear out all the mappings below the kernel image.
	 */
	for (addr = 0; addr < MODULES_VADDR; addr += PGDIR_SIZE)
		pmd_clear(pmd_off_k(addr));

	for ( ; addr < PAGE_OFFSET; addr += PGDIR_SIZE)
		pmd_clear(pmd_off_k(addr));

	/*
	 * Find the end of the first block of lowmem.
	 */
	end = memblock.memory.regions[0].base + memblock.memory.regions[0].size;
	if (end >= lowmem_limit)
		end = lowmem_limit;

	/*
	 * Clear out all the kernel space mappings, except for the first
	 * memory bank, up to the end of the vmalloc region.
	 */
	for (addr = __phys_to_virt(end);
	     addr < VMALLOC_END; addr += PGDIR_SIZE)
		pmd_clear(pmd_off_k(addr));
}

/*
 * Reserve the special regions of memory
 */
void __init uc32_mm_memblock_reserve(void)
{
	/*
	 * Reserve the page tables.  These are already in use,
	 * and can only be in node 0.
	 */
	memblock_reserve(__pa(swapper_pg_dir), PTRS_PER_PGD * sizeof(pgd_t));
}

/*
 * Set up device the mappings.  Since we clear out the page tables for all
 * mappings above VMALLOC_END, we will remove any debug device mappings.
 * This means you have to be careful how you debug this function, or any
 * called function.  This means you can't use any function or debugging
 * method which may touch any device, otherwise the kernel _will_ crash.
 */
static void __init devicemaps_init(void)
{
	struct map_desc map;
	unsigned long addr;
	void *vectors;

	/*
	 * Allocate the vector page early.
	 */
	vectors = early_alloc(PAGE_SIZE);

	for (addr = VMALLOC_END; addr; addr += PGDIR_SIZE)
		pmd_clear(pmd_off_k(addr));

	/*
	 * Create a mapping for the machine vectors at the high-vectors
	 * location (0xffff0000).  If we aren't using high-vectors, also
	 * create a mapping at the low-vectors virtual address.
	 */
	map.pfn = __phys_to_pfn(virt_to_phys(vectors));
	map.virtual = VECTORS_BASE;
	map.length = PAGE_SIZE;
	map.type = MT_HIGH_VECTORS;
	create_mapping(&map);

	/*
	 * Create a mapping for the kuser page at the special
	 * location (0xbfff0000) to the same vectors location.
	 */
	map.pfn = __phys_to_pfn(virt_to_phys(vectors));
	map.virtual = KUSER_VECPAGE_BASE;
	map.length = PAGE_SIZE;
	map.type = MT_KUSER;
	create_mapping(&map);

	/*
	 * Finally flush the caches and tlb to ensure that we're in a
	 * consistent state wrt the writebuffer.  This also ensures that
	 * any write-allocated cache lines in the vector page are written
	 * back.  After this point, we can start to touch devices again.
	 */
	local_flush_tlb_all();
	flush_cache_all();
}

static void __init map_lowmem(void)
{
	struct memblock_region *reg;

	/* Map all the lowmem memory banks. */
	for_each_memblock(memory, reg) {
		phys_addr_t start = reg->base;
		phys_addr_t end = start + reg->size;
		struct map_desc map;

		if (end > lowmem_limit)
			end = lowmem_limit;
		if (start >= end)
			break;

		map.pfn = __phys_to_pfn(start);
		map.virtual = __phys_to_virt(start);
		map.length = end - start;
		map.type = MT_MEMORY;

		create_mapping(&map);
	}
}

/*
 * paging_init() sets up the page tables, initialises the zone memory
 * maps, and sets up the zero page, bad page and bad page tables.
 */
void __init paging_init(void)
{
	void *zero_page;

	build_mem_type_table();
	sanity_check_meminfo();
	prepare_page_table();
	map_lowmem();
	devicemaps_init();

	top_pmd = pmd_off_k(0xffff0000);

	/* allocate the zero page. */
	zero_page = early_alloc(PAGE_SIZE);

	bootmem_init();

	empty_zero_page = virt_to_page(zero_page);
	__flush_dcache_page(NULL, empty_zero_page);
}

/*
 * In order to soft-boot, we need to insert a 1:1 mapping in place of
 * the user-mode pages.  This will then ensure that we have predictable
 * results when turning the mmu off
 */
void setup_mm_for_reboot(char mode)
{
	unsigned long base_pmdval;
	pgd_t *pgd;
	int i;

	/*
	 * We need to access to user-mode page tables here. For kernel threads
	 * we don't have any user-mode mappings so we use the context that we
	 * "borrowed".
	 */
	pgd = current->active_mm->pgd;

	base_pmdval = PMD_SECT_WRITE | PMD_SECT_READ | PMD_TYPE_SECT;

	for (i = 0; i < FIRST_USER_PGD_NR + USER_PTRS_PER_PGD; i++, pgd++) {
		unsigned long pmdval = (i << PGDIR_SHIFT) | base_pmdval;
		pmd_t *pmd;

		pmd = pmd_off(pgd, i << PGDIR_SHIFT);
		set_pmd(pmd, __pmd(pmdval));
		flush_pmd_entry(pmd);
	}

	local_flush_tlb_all();
}

/*
 * Take care of architecture specific things when placing a new PTE into
 * a page table, or changing an existing PTE.  Basically, there are two
 * things that we need to take care of:
 *
 *  1. If PG_dcache_clean is not set for the page, we need to ensure
 *     that any cache entries for the kernels virtual memory
 *     range are written back to the page.
 *  2. If we have multiple shared mappings of the same space in
 *     an object, we need to deal with the cache aliasing issues.
 *
 * Note that the pte lock will be held.
 */
void update_mmu_cache(struct vm_area_struct *vma, unsigned long addr,
	pte_t *ptep)
{
	unsigned long pfn = pte_pfn(*ptep);
	struct address_space *mapping;
	struct page *page;

	if (!pfn_valid(pfn))
		return;

	/*
	 * The zero page is never written to, so never has any dirty
	 * cache lines, and therefore never needs to be flushed.
	 */
	page = pfn_to_page(pfn);
	if (page == ZERO_PAGE(0))
		return;

	mapping = page_mapping(page);
	if (!test_and_set_bit(PG_dcache_clean, &page->flags))
		__flush_dcache_page(mapping, page);
	if (mapping)
		if (vma->vm_flags & VM_EXEC)
			__flush_icache_all();
}


text:
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">

    <item android:drawable="@drawable/umeng_socialize_button_grey" android:state_pressed="false" android:state_window_focused="false"/>
    <item android:drawable="@drawable/umeng_socialize_button_blue" android:state_pressed="true" android:state_window_focused="true"/>
    <item android:drawable="@drawable/umeng_socialize_button_blue" android:state_focused="true"/>

</selector>


text:
/*!
 * \file tvm/src/pass/lower_custom_datatypes.cc
 * \brief Pass for lowering custom datatypes
 */

#include <tvm/runtime/registry.h>
#include <tvm/target/target.h>
#include <tvm/tir/op.h>
#include <tvm/tir/stmt_functor.h>
#include <tvm/tir/transform.h>

#include "../../target/datatype/registry.h"

namespace tvm {
namespace tir {

/*!
 * \brief Helper mutator to implement lowering of custom datatypes.
 *
 * Lowering datatypes works as follows: for every expression containing a custom
 * datatype, we search for a global (registered by the implementer of the custom
 * datatype) for lowering this type of expression, and uses it to lower the
 * expression.
 */
class CustomDatatypesLowerer : public StmtExprMutator {
 public:
  explicit CustomDatatypesLowerer(const std::string& target) : target_(target) {}

  inline PrimExpr VisitExpr_(const CastNode* op) final {
    auto type_code = op->dtype.code();
    auto src_type_code = op->value.dtype().code();
    // If either datatype is a registered custom datatype, we must lower.
    bool toBeLowered = datatype::Registry::Global()->GetTypeRegistered(type_code) ||
                       datatype::Registry::Global()->GetTypeRegistered(src_type_code);
    PrimExpr expr = StmtExprMutator::VisitExpr_(op);
    if (toBeLowered) {
      auto lower = datatype::GetCastLowerFunc(target_, type_code, src_type_code);
      ICHECK(lower) << "Cast lowering function for target " << target_ << " destination type "
                    << static_cast<unsigned>(type_code) << " source type "
                    << static_cast<unsigned>(src_type_code) << " not found";
      return (*lower)(expr);
    }
    return expr;
  }

  inline PrimExpr VisitExpr_(const FloatImmNode* imm) final {
    auto type_code = imm->dtype.code();
    auto e = GetRef<PrimExpr>(imm);
    if (datatype::Registry::Global()->GetTypeRegistered(type_code)) {
      auto lower = datatype::GetFloatImmLowerFunc(target_, type_code);
      ICHECK(lower) << "FloatImm lowering function for target " << target_ << " type "
                    << static_cast<unsigned>(type_code) << " not found";
      return (*lower)(e);
    }
    return e;
  }

  inline Stmt VisitStmt_(const AllocateNode* allocate) final {
    bool toBeLowered = datatype::Registry::Global()->GetTypeRegistered(allocate->dtype.code());
    Stmt stmt = StmtExprMutator::VisitStmt_(allocate);
    allocate = stmt.as<AllocateNode>();

    if (toBeLowered) {
      auto new_allocate_type = DataType::UInt(allocate->dtype.bits(), allocate->dtype.lanes());
      return Allocate(allocate->buffer_var, new_allocate_type, allocate->extents,
                      allocate->condition, allocate->body);
    }
    return stmt;
  }

  inline PrimExpr VisitExpr_(const LoadNode* load) final {
    bool toBeLowered = datatype::Registry::Global()->GetTypeRegistered(load->dtype.code());
    PrimExpr expr = StmtExprMutator::VisitExpr_(load);
    load = expr.as<LoadNode>();
    if (toBeLowered) {
      auto new_load_type = DataType::UInt(load->dtype.bits());
      return Load(new_load_type, load->buffer_var, load->index, load->predicate);
    }
    return expr;
  }

  inline PrimExpr VisitExpr_(const CallNode* call) final {
    bool toBeLowered = datatype::Registry::Global()->GetTypeRegistered(call->dtype.code());
    PrimExpr expr = StmtExprMutator::VisitExpr_(call);
    call = expr.as<CallNode>();
    if (toBeLowered) {
      auto op = call->op.as<OpNode>();
      ICHECK(op != nullptr) << "Lowering non-intrinsic Calls not implemented";
      auto lower = datatype::GetIntrinLowerFunc(target_, op->name, call->dtype.code());
      ICHECK(lower) << "Intrinsic lowering function for target " << target_ << ", intrinsic name "
                    << op->name << ", type " << static_cast<unsigned>(call->dtype.code())
                    << " not found";
      return (*lower)(expr);
    }
    return expr;
  }

#define DEFINE_MUTATE(OP, NodeName)                                                \
  inline PrimExpr VisitExpr_(const NodeName* op) final {                           \
    auto type_code = op->dtype.code();                                             \
    bool toBeLowered = datatype::Registry::Global()->GetTypeRegistered(type_code); \
    PrimExpr expr = StmtExprMutator::VisitExpr_(op);                               \
    op = expr.as<NodeName>();                                                      \
    if (toBeLowered) {                                                             \
      auto lower = datatype::Get##OP##LowerFunc(target_, type_code);               \
      ICHECK(lower) << #OP " lowering function for target " << target_ << " type " \
                    << static_cast<unsigned>(type_code) << " not found";           \
      return (*lower)(expr);                                                       \
    }                                                                              \
    return expr;                                                                   \
  }

  DEFINE_MUTATE(Add, AddNode);
  DEFINE_MUTATE(Sub, SubNode);
  DEFINE_MUTATE(Mul, MulNode);
  DEFINE_MUTATE(Div, DivNode);
  DEFINE_MUTATE(Mod, ModNode);
  DEFINE_MUTATE(Min, MinNode);
  DEFINE_MUTATE(Max, MaxNode);
  DEFINE_MUTATE(EQ, EQNode);
  DEFINE_MUTATE(NE, NENode);
  DEFINE_MUTATE(LT, LTNode);
  DEFINE_MUTATE(LE, LENode);
  DEFINE_MUTATE(GT, GTNode);
  DEFINE_MUTATE(GE, GENode);
  // Later changes may need to add more mutate functions as we support workloads with more ops.

 private:
  std::string target_;
};

namespace transform {

Pass LowerCustomDatatypes() {
  auto pass_func = [](PrimFunc f, IRModule m, PassContext ctx) {
    auto* n = f.CopyOnWrite();
    auto target = f->GetAttr<Target>(tvm::attr::kTarget);
    ICHECK(target.defined()) << "LowerCustomDatatypes: Require the target attribute";

    n->body = CustomDatatypesLowerer(target.value()->kind->name)(std::move(n->body));
    return f;
  };
  return CreatePrimFuncPass(pass_func, 0, "tir.LowerCustomDatatypes", {});
}

TVM_REGISTER_GLOBAL("tir.transform.LowerCustomDatatypes").set_body_typed(LowerCustomDatatypes);

}  // namespace transform

}  // namespace tir
}  // namespace tvm


text:
<?php

$id = new \Dkd\PhpCmis\DataObjects\PropertyIdDefinition('cmis:id');
$id->setPropertyType(\Dkd\PhpCmis\Enum\PropertyType::cast(\Dkd\PhpCmis\Enum\PropertyType::ID));
$id->setLocalName('cmis:idValue');
$id->setQueryName('cmis:idValue');
$id->setIsInherited(false);
$id->setIsOpenChoice(false);
$id->setIsOrderable(true);
$id->setDescription('This is a id property.');
$id->setUpdatability(\Dkd\PhpCmis\Enum\Updatability::cast(\Dkd\PhpCmis\Enum\Updatability::READONLY));
$id->setLocalNamespace('local');
$id->setDisplayName('Id property');
$id->setIsRequired(true);
$id->setCardinality(\Dkd\PhpCmis\Enum\Cardinality::cast(\Dkd\PhpCmis\Enum\Cardinality::SINGLE));
$id->setIsQueryable(true);

$string = new \Dkd\PhpCmis\DataObjects\PropertyStringDefinition('cmis:string');
$string->setPropertyType(\Dkd\PhpCmis\Enum\PropertyType::cast(\Dkd\PhpCmis\Enum\PropertyType::STRING));
$string->setLocalName('cmis:stringValue');
$string->setQueryName('cmis:stringValue');
$string->setIsInherited(true);
$string->setIsOpenChoice(true);
$string->setIsOrderable(false);
$string->setDescription('This is a string property.');
$string->setUpdatability(\Dkd\PhpCmis\Enum\Updatability::cast(\Dkd\PhpCmis\Enum\Updatability::READWRITE));
$string->setLocalNamespace('namespace');
$string->setDisplayName('String property');
$string->setIsRequired(false);
$string->setCardinality(\Dkd\PhpCmis\Enum\Cardinality::cast(\Dkd\PhpCmis\Enum\Cardinality::MULTI));
$string->setIsQueryable(false);
$string->setMaxLength(100);

$boolean = new \Dkd\PhpCmis\DataObjects\PropertyBooleanDefinition('cmis:boolean');
$boolean->setPropertyType(\Dkd\PhpCmis\Enum\PropertyType::cast(\Dkd\PhpCmis\Enum\PropertyType::BOOLEAN));
$boolean->setLocalName('cmis:booleanValue');
$boolean->setQueryName('cmis:booleanValue');
$boolean->setIsInherited(true);
$boolean->setIsOpenChoice(true);
$boolean->setIsOrderable(false);
$boolean->setDescription('This is a boolean property.');
$boolean->setUpdatability(\Dkd\PhpCmis\Enum\Updatability::cast(\Dkd\PhpCmis\Enum\Updatability::READWRITE));
$boolean->setLocalNamespace('namespace');
$boolean->setDisplayName('Boolean property');
$boolean->setIsRequired(false);
$boolean->setCardinality(\Dkd\PhpCmis\Enum\Cardinality::cast(\Dkd\PhpCmis\Enum\Cardinality::MULTI));
$boolean->setIsQueryable(true);

$uri = new \Dkd\PhpCmis\DataObjects\PropertyUriDefinition('cmis:uri');
$uri->setPropertyType(\Dkd\PhpCmis\Enum\PropertyType::cast(\Dkd\PhpCmis\Enum\PropertyType::URI));
$uri->setLocalName('cmis:uriValue');
$uri->setQueryName('cmis:uriValue');
$uri->setIsInherited(true);
$uri->setIsOpenChoice(true);
$uri->setIsOrderable(false);
$uri->setDescription('This is a uri property.');
$uri->setUpdatability(\Dkd\PhpCmis\Enum\Updatability::cast(\Dkd\PhpCmis\Enum\Updatability::READWRITE));
$uri->setLocalNamespace('namespace');
$uri->setDisplayName('Uri property');
$uri->setIsRequired(false);
$uri->setCardinality(\Dkd\PhpCmis\Enum\Cardinality::cast(\Dkd\PhpCmis\Enum\Cardinality::MULTI));
$uri->setIsQueryable(true);

$decimal = new \Dkd\PhpCmis\DataObjects\PropertyDecimalDefinition('cmis:decimal');
$decimal->setPropertyType(\Dkd\PhpCmis\Enum\PropertyType::cast(\Dkd\PhpCmis\Enum\PropertyType::DECIMAL));
$decimal->setLocalName('cmis:decimalValue');
$decimal->setQueryName('cmis:decimalValue');
$decimal->setIsInherited(true);
$decimal->setIsOpenChoice(true);
$decimal->setIsOrderable(false);
$decimal->setDescription('This is a decimal property.');
$decimal->setUpdatability(\Dkd\PhpCmis\Enum\Updatability::cast(\Dkd\PhpCmis\Enum\Updatability::READWRITE));
$decimal->setLocalNamespace('namespace');
$decimal->setDisplayName('Decimal property');
$decimal->setIsRequired(false);
$decimal->setCardinality(\Dkd\PhpCmis\Enum\Cardinality::cast(\Dkd\PhpCmis\Enum\Cardinality::MULTI));
$decimal->setIsQueryable(true);
$decimal->setMinValue(5);
$decimal->setMaxValue(15);
$decimal->setPrecision(\Dkd\PhpCmis\Enum\DecimalPrecision::cast(\Dkd\PhpCmis\Enum\DecimalPrecision::BITS64));

$html = new \Dkd\PhpCmis\DataObjects\PropertyHtmlDefinition('cmis:html');
$html->setPropertyType(\Dkd\PhpCmis\Enum\PropertyType::cast(\Dkd\PhpCmis\Enum\PropertyType::HTML));
$html->setLocalName('cmis:htmlValue');
$html->setQueryName('cmis:htmlValue');
$html->setIsInherited(true);
$html->setIsOpenChoice(true);
$html->setIsOrderable(false);
$html->setDescription('This is a html property.');
$html->setUpdatability(\Dkd\PhpCmis\Enum\Updatability::cast(\Dkd\PhpCmis\Enum\Updatability::READWRITE));
$html->setLocalNamespace('namespace');
$html->setDisplayName('Html property');
$html->setIsRequired(false);
$html->setCardinality(\Dkd\PhpCmis\Enum\Cardinality::cast(\Dkd\PhpCmis\Enum\Cardinality::MULTI));
$html->setIsQueryable(true);

$integer = new \Dkd\PhpCmis\DataObjects\PropertyIntegerDefinition('cmis:integer');
$integer->setPropertyType(\Dkd\PhpCmis\Enum\PropertyType::cast(\Dkd\PhpCmis\Enum\PropertyType::INTEGER));
$integer->setLocalName('cmis:integerValue');
$integer->setQueryName('cmis:integerValue');
$integer->setIsInherited(true);
$integer->setIsOpenChoice(true);
$integer->setIsOrderable(false);
$integer->setDescription('This is a integer property.');
$integer->setUpdatability(\Dkd\PhpCmis\Enum\Updatability::cast(\Dkd\PhpCmis\Enum\Updatability::READWRITE));
$integer->setLocalNamespace('namespace');
$integer->setDisplayName('Integer property');
$integer->setIsRequired(false);
$integer->setCardinality(\Dkd\PhpCmis\Enum\Cardinality::cast(\Dkd\PhpCmis\Enum\Cardinality::MULTI));
$integer->setIsQueryable(true);
$integer->setMinValue(5);
$integer->setMaxValue(100);

$datetime = new \Dkd\PhpCmis\DataObjects\PropertyDateTimeDefinition('cmis:datetime');
$datetime->setPropertyType(\Dkd\PhpCmis\Enum\PropertyType::cast(\Dkd\PhpCmis\Enum\PropertyType::DATETIME));
$datetime->setLocalName('cmis:datetimeValue');
$datetime->setQueryName('cmis:datetimeValue');
$datetime->setIsInherited(true);
$datetime->setIsOpenChoice(true);
$datetime->setIsOrderable(false);
$datetime->setDescription('This is a datetime property.');
$datetime->setUpdatability(\Dkd\PhpCmis\Enum\Updatability::cast(\Dkd\PhpCmis\Enum\Updatability::READWRITE));
$datetime->setLocalNamespace('namespace');
$datetime->setDisplayName('Datetime property');
$datetime->setIsRequired(false);
$datetime->setCardinality(\Dkd\PhpCmis\Enum\Cardinality::cast(\Dkd\PhpCmis\Enum\Cardinality::MULTI));
$datetime->setIsQueryable(true);
$datetime->setDateTimeResolution(
    \Dkd\PhpCmis\Enum\DateTimeResolution::cast(\Dkd\PhpCmis\Enum\DateTimeResolution::TIME)
);

return [
    'cmis:id' => $id,
    'cmis:string' => $string,
    'cmis:boolean' => $boolean,
    'cmis:uri' => $uri,
    'cmis:decimal' => $decimal,
    'cmis:html' => $html,
    'cmis:integer' => $integer,
    'cmis:datetime' => $datetime
];


text:
using System;
using AutoMapper;
using CoreDocker.Core.Framework.MessageUtil.Models;
using CoreDocker.Shared.Models.Shared;

namespace CoreDocker.Api.Mappers
{
    public static partial class MapApi
    {
        private static readonly Lazy<IMapper> _mapper;

        static MapApi()
        {
            _mapper = new Lazy<IMapper>(InitializeMapping);
        }

        public static IMapper GetInstance()
        {
            return _mapper.Value;
        }

        public static ValueUpdateModel<TModel> ToValueUpdateModel<T, TModel>(this DalUpdateMessage<T> updateMessage)
        {
            return new ValueUpdateModel<TModel>(GetInstance().Map<T, TModel>(updateMessage.Value),
                (UpdateTypeCodes) updateMessage.UpdateType);
        }

        public static void AssertConfigurationIsValid()
        {
            GetInstance().ConfigurationProvider.AssertConfigurationIsValid();
        }

        #region Private Methods

        private static IMapper InitializeMapping()
        {
            var config = new MapperConfiguration(cfg =>
            {
                MapUserModel(cfg);
                MapProjectModel(cfg);
                MapUserGrantModel(cfg);
            });
            return config.CreateMapper();
        }

        #endregion
    }
}


text:
import taskflow.engines

from taskflow import exceptions as exc
from taskflow import test
from taskflow.tests import utils

class ArgumentsPassingTest(utils.EngineTestBase):

    def test_save_as(self):
        flow = utils.TaskOneReturn(name='task1', provides='first_data')
        engine = self._make_engine(flow)
        engine.run()
        self.assertEquals(engine.storage.fetch_all(), {'first_data': 1})

    def test_save_all_in_one(self):
        flow = utils.TaskMultiReturn(provides='all_data')
        engine = self._make_engine(flow)
        engine.run()
        self.assertEquals(engine.storage.fetch_all(),
                          {'all_data': (1, 3, 5)})

    def test_save_several_values(self):
        flow = utils.TaskMultiReturn(provides=('badger', 'mushroom', 'snake'))
        engine = self._make_engine(flow)
        engine.run()
        self.assertEquals(engine.storage.fetch_all(), {
            'badger': 1,
            'mushroom': 3,
            'snake': 5
        })

    def test_save_dict(self):
        flow = utils.TaskMultiDictk(provides=set(['badger',
                                                  'mushroom',
                                                  'snake']))
        engine = self._make_engine(flow)
        engine.run()
        self.assertEquals(engine.storage.fetch_all(), {
            'badger': 0,
            'mushroom': 1,
            'snake': 2,
        })

    def test_bad_save_as_value(self):
        with self.assertRaises(TypeError):
            utils.TaskOneReturn(name='task1', provides=object())

    def test_arguments_passing(self):
        flow = utils.TaskMultiArgOneReturn(provides='result')
        engine = self._make_engine(flow)
        engine.storage.inject({'x': 1, 'y': 4, 'z': 9, 'a': 17})
        engine.run()
        self.assertEquals(engine.storage.fetch_all(), {
            'x': 1, 'y': 4, 'z': 9, 'a': 17,
            'result': 14,
        })

    def test_arguments_missing(self):
        flow = utils.TaskMultiArg()
        engine = self._make_engine(flow)
        engine.storage.inject({'a': 1, 'b': 4, 'x': 17})
        with self.assertRaises(exc.MissingDependencies):
            engine.run()

    def test_partial_arguments_mapping(self):
        flow = utils.TaskMultiArgOneReturn(provides='result',
                                           rebind={'x': 'a'})
        engine = self._make_engine(flow)
        engine.storage.inject({'x': 1, 'y': 4, 'z': 9, 'a': 17})
        engine.run()
        self.assertEquals(engine.storage.fetch_all(), {
            'x': 1, 'y': 4, 'z': 9, 'a': 17,
            'result': 30,
        })

    def test_all_arguments_mapping(self):
        flow = utils.TaskMultiArgOneReturn(provides='result',
                                           rebind=['a', 'b', 'c'])
        engine = self._make_engine(flow)
        engine.storage.inject({
            'a': 1, 'b': 2, 'c': 3, 'x': 4, 'y': 5, 'z': 6
        })
        engine.run()
        self.assertEquals(engine.storage.fetch_all(), {
            'a': 1, 'b': 2, 'c': 3, 'x': 4, 'y': 5, 'z': 6,
            'result': 6,
        })

    def test_invalid_argument_name_map(self):
        flow = utils.TaskMultiArg(rebind={'z': 'b'})
        engine = self._make_engine(flow)
        engine.storage.inject({'a': 1, 'y': 4, 'c': 9, 'x': 17})
        with self.assertRaises(exc.MissingDependencies):
            engine.run()

    def test_invalid_argument_name_list(self):
        flow = utils.TaskMultiArg(rebind=['a', 'z', 'b'])
        engine = self._make_engine(flow)
        engine.storage.inject({'a': 1, 'b': 4, 'c': 9, 'x': 17})
        with self.assertRaises(exc.MissingDependencies):
            engine.run()

    def test_bad_rebind_args_value(self):
        with self.assertRaises(TypeError):
            utils.TaskOneArg(rebind=object())

class SingleThreadedEngineTest(ArgumentsPassingTest,
                               test.TestCase):
    def _make_engine(self, flow, flow_detail=None):
        return taskflow.engines.load(flow,
                                     flow_detail=flow_detail,
                                     engine_conf='serial',
                                     backend=self.backend)

class MultiThreadedEngineTest(ArgumentsPassingTest,
                              test.TestCase):
    def _make_engine(self, flow, flow_detail=None, executor=None):
        engine_conf = dict(engine='parallel',
                           executor=executor)
        return taskflow.engines.load(flow, flow_detail=flow_detail,
                                     engine_conf=engine_conf,
                                     backend=self.backend)


text:
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu-framework/master/LICENCE

using osu.Framework.Allocation;
using osu.Framework.Timing;
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;

namespace osu.Framework.Statistics
{
    internal class PerformanceMonitor
    {
        private readonly StopwatchClock ourClock = new StopwatchClock(true);

        private readonly Stack<PerformanceCollectionType> currentCollectionTypeStack = new Stack<PerformanceCollectionType>();

        private readonly InvokeOnDisposal[] endCollectionDelegates = new InvokeOnDisposal[FrameStatistics.NUM_PERFORMANCE_COLLECTION_TYPES];

        private FrameStatistics currentFrame;

        private const int spike_time = 100;

        private const int max_pending_frames = 100;

        internal readonly ConcurrentQueue<FrameStatistics> PendingFrames = new ConcurrentQueue<FrameStatistics>();
        internal readonly ObjectStack<FrameStatistics> FramesHeap = new ObjectStack<FrameStatistics>(max_pending_frames);
        private readonly bool[] activeCounters = new bool[FrameStatistics.NUM_STATISTICS_COUNTER_TYPES];

        internal bool[] ActiveCounters => (bool[])activeCounters.Clone();

        private double consumptionTime;

        internal IFrameBasedClock Clock;

        public double FrameAimTime => 1000.0 / (Clock as ThrottledFrameClock)?.MaximumUpdateHz ?? double.MaxValue;

        internal PerformanceMonitor(IFrameBasedClock clock, IEnumerable<StatisticsCounterType> counters)
        {
            Clock = clock;
            currentFrame = FramesHeap.ReserveObject();

            foreach (var c in counters)
                activeCounters[(int)c] = true;

            for (int i = 0; i < FrameStatistics.NUM_PERFORMANCE_COLLECTION_TYPES; i++)
            {
                var t = (PerformanceCollectionType)i;
                endCollectionDelegates[i] = new InvokeOnDisposal(() => endCollecting(t));
            }
        }

        /// <summary>
        /// Start collecting a type of passing time.
        /// </summary>
        public InvokeOnDisposal BeginCollecting(PerformanceCollectionType type)
        {
            if (currentCollectionTypeStack.Count > 0)
            {
                PerformanceCollectionType t = currentCollectionTypeStack.Peek();

                if (!currentFrame.CollectedTimes.ContainsKey(t)) currentFrame.CollectedTimes[t] = 0;
                currentFrame.CollectedTimes[t] += consumeStopwatchElapsedTime();
            }

            currentCollectionTypeStack.Push(type);

            return endCollectionDelegates[(int)type];
        }

        /// <summary>
        /// End collecting a type of passing time (that was previously started).
        /// </summary>
        /// <param name="type"></param>
        private void endCollecting(PerformanceCollectionType type)
        {
            currentCollectionTypeStack.Pop();

            if (!currentFrame.CollectedTimes.ContainsKey(type)) currentFrame.CollectedTimes[type] = 0;
            currentFrame.CollectedTimes[type] += consumeStopwatchElapsedTime();
        }

        private readonly int[] lastAmountGarbageCollects = new int[3];

        public bool HandleGC = true;

        /// <summary>
        /// Resets all frame statistics. Run exactly once per frame.
        /// </summary>
        public void NewFrame()
        {
            // Reset the counters we keep track of
            for (int i = 0; i < activeCounters.Length; ++i)
                if (activeCounters[i])
                {
                    currentFrame.Counts[(StatisticsCounterType)i] = FrameStatistics.COUNTERS[i];
                    FrameStatistics.COUNTERS[i] = 0;
                }

            PendingFrames.Enqueue(currentFrame);
            if (PendingFrames.Count >= max_pending_frames)
            {
                FrameStatistics oldFrame;
                PendingFrames.TryDequeue(out oldFrame);
                FramesHeap.FreeObject(oldFrame);
            }

            currentFrame = FramesHeap.ReserveObject();
            currentFrame.Clear();

            if (HandleGC)
            {
                for (int i = 0; i < lastAmountGarbageCollects.Length; ++i)
                {
                    int amountCollections = GC.CollectionCount(i);
                    if (lastAmountGarbageCollects[i] != amountCollections)
                    {
                        lastAmountGarbageCollects[i] = amountCollections;
                        currentFrame.GarbageCollections.Add(i);
                    }
                }
            }

            //check for dropped (stutter) frames
            if (Clock.ElapsedFrameTime > spike_time)
                newDroppedFrame();

            //reset frame totals
            currentCollectionTypeStack.Clear();
            //backgroundMonitorStackTrace = null;
            consumeStopwatchElapsedTime();
        }

        private double consumeStopwatchElapsedTime()
        {
            double last = consumptionTime;
            consumptionTime = ourClock.CurrentTime;
            return consumptionTime - last;
        }

        private void newDroppedFrame()
        {
        }

        internal double FramesPerSecond => Clock.FramesPerSecond;
        internal double AverageFrameTime => Clock.AverageFrameTime;
    }
}


text:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
		"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

	<title>CSS Top Menu Combination–Sea Mus N Squirrel</title>
	<link rel="stylesheet" type="text/css" href="newcss2.css" title="Working" />
	<link rel="alternate stylesheet" type="text/css" href="newcss.css" title="Original" />

CSS Top Menu Combination–Sea Mus N Squirrel

Home

New

Edit

Manage

Logout

Place your cursor over the menu label in the upper left-hand corner to see the example.

This is a example of combining four different <acronym title="Cascading StyleSheet">CSS</acronym> tricks:
Hover Sidebar,
Enlarger Button Menu,
Background-Image to Replace Text,
Pure CSS Popups.

In the working stylesheet, all the CSS is of level 1 and 2.

Screenshots in Mozilla

The HTML Code

<div id="nav">
<ul>
   <li><a href="/" class="home"><span>Home</span></a></li>
   <li><a href="new/" class="new"><span>New</span></a></li>
   <li><a href="edit/" class="edit"><span>Edit</span></a></li>
   <li><a href="manage/" class="manage"><span>Manage</span></a></li>
   <li><a href="logout/" class="logout"><span>Logout</span></a></li>
</ul>
</div>

The CSS Code

Check out the working stylesheet and dissect it.
You can also view the original stylesheet that makes more sense to me but does not work as well.

Compatibility

First off, from my testing it does not work in Internet Explorer 6.0.
It does work in Mozilla 1.4., Opera 6.0.,
and Safari 1.0. Thanks to Tom, Daniel Von Fange, and Paul Hammond for the testing it in Safari.

Return to CSS Play

© 2003 Seamus P. H. Leahy

You may take and improve upon this.


text:
import os

from flask import Flask, render_template, g
from flask_bootstrap import Bootstrap
from flask_wtf import Form as FlaskForm
import sijax
import flask_sijax
import flask_visujax
from wtforms import Form, IntegerField
from werkzeug import MultiDict
from wtforms.validators import DataRequired
# include Form from wtforms instead of flask_wtf, in order to
# pass 'form_data' received from Ajax, instead of the normal Flask
# object comming form Post, that flask_wtf automatically passed.

from flask_visujax import BootstrapRow, Column, Content, Label, \
    PlotReplace, Button, BaseResponse, prettify
from flask_visujax import Form as WidgetForm
from util import Master

path = os.path.join('.', os.path.dirname(__file__), 'static/js/sijax')

app = Flask(__name__)
app.config['SIJAX_STATIC_PATH'] = path
app.config['SIJAX_JSON_URI'] = '/static/js/sijax/json2.js'
app.config['WTF_CSRF_ENABLED'] = False
app.config['WTF_CSRF_SECRET_KEY'] = 'a random string'
flask_sijax.Sijax(app)
flask_visujax.Visujax(app)
Bootstrap(app)

class ControlForm(Form):
    number = IntegerField('Number of seconds', validators=[DataRequired()])

class Response(BaseResponse):

    def __init__(self,*args,**kwargs):
        BaseResponse.__init__(self,*args,**kwargs)
        self.status = Label('status',self)
        self.time = Label('time',self)
        self.plot = PlotReplace('foo',self)

class Handler(object):

    @staticmethod
    def run(resp,form_data):
        form = ControlForm(MultiDict(form_data))
        if not form.validate():
            resp.status.set_text("Number of seconds missing!")
            return
        m.nseconds = form.number.data
        m.start()
        resp.update_data(x=m.x())
        resp.status.set_text('running')
        resp.timeout('update',250)

    @staticmethod
    def update(resp):
        resp.time.set_text("%.2f" % m.time())
        resp.update_data(y=m.y())
        resp.plot.replot('x','y')
        if m.is_alive():
            resp.timeout("update",250)
        else:
            if m.stopped():
                resp.status.set_text("stopped!")
            else:
                resp.status.set_text("complete!")

    @staticmethod
    def stop(resp):
        m.stop()

class ControlFlaskForm(FlaskForm):
    number = IntegerField('Number of seconds', validators=[DataRequired()])

class StatusRow(BootstrapRow):
    col = Column(twelfth=12)
    status = Label('status')

class TimeRow(BootstrapRow):
    col = Column(twelfth=12)
    time = Label('time')

class MainRow(BootstrapRow):
    left_col = Column(twelfth=6)
    chart = PlotReplace("foo")

    right_col = Column(twelfth=6)
    form = WidgetForm(ControlFlaskForm,'visujax_form_control')
    run = Button('Run','visujax.SijaxForm',['run','visujax_form_control'])
    clear = Button('Clear','visujax.plot.clear',['foo'])
    stop = Button('Stop','visujax.SijaxClick',['stop'])

@flask_sijax.route(app,'/')
def home():
    if g.sijax.is_sijax_request:
        g.sijax.register_object(Handler, response_class=Response)
        return g.sijax.process_request()
    return prettify(render_template('visujax/content.html',content=content))

if __name__ == "__main__":
    content = Content(StatusRow(), TimeRow(), MainRow())
    m = Master()
    app.run(debug=True)


text:
import sys

VAR_MAPPINGS = {
    # Add mapped items here
    'test-old': 'test-new'
}

def update_variables(old_contents):
    """Replace all references to old variables.

    This includes comments and references within values for other variables.
    """
    new_contents = []

    for line in old_contents:
        words = line.split()

        for word in words:
            # Using the whitespace split above, the keys in the yaml file will
            # have a : at the end, so we need to strip that off before
            # replacing
            if word.endswith(':'):
                word = word[:-1]

            if word in VAR_MAPPINGS.keys():
                line = line.replace(word, VAR_MAPPINGS[word])

        new_contents.append(line)

    return new_contents

def main(filename):
    with open(filename, 'r') as f:
        contents = f.readlines()

    new_contents = update_variables(contents)

    with open(filename, 'w') as f:
        f.write(''.join(new_contents))

if __name__ == '__main__':
    if len(sys.argv) < 3:
        sys.exit("Filename and flag file reference required.")

    filename = sys.argv[1]
    flag_ref = sys.argv[2]
    main(filename)

    flag_file = '/etc/openstack_deploy.PIKE/VARS_MIGRATED_%s' % flag_ref
    with open(flag_file, 'w') as f:
        f.write('OpenStack-Ansible variables migrated.')


text:
[//]: # (title: Opt-in requirements)

The Kotlin standard library provides a mechanism for requiring and giving explicit consent for using certain elements of APIs.
This mechanism lets library developers inform users of their APIs about specific conditions that require opt-in,
for example, if an API is in the experimental state and is likely to change in the future.

To prevent potential issues, the compiler warns users of such APIs about these conditions and
requires them to opt in before using the API.

## Opt in to using API

If a library author marks a declaration from a library's API as _[requiring opt-in](#require-opt-in-for-api)_,
you should give an explicit consent for using it in your code.
There are several ways to opt in to such APIs, all applicable without technical limitations.
You are free to choose the way that you find best for your situation.

### Propagating opt-in

When you use an API in the code intended for third-party use (a library), you can propagate its opt-in requirement to your API as well.
To do this, annotate your declaration with the _[opt-in requirement annotation](#create-opt-in-requirement-annotations)_ of the API used in its body.
This enables you to use API elements that require opt-in.

```kotlin
// Library code
@RequiresOptIn(message = "This API is experimental. It may be changed in the future without notice.")
@Retention(AnnotationRetention.BINARY)
@Target(AnnotationTarget.CLASS, AnnotationTarget.FUNCTION)
annotation class MyDateTime // Opt-in requirement annotation

@MyDateTime
class DateProvider // A class requiring opt-in
```

```kotlin
// Client code
fun getYear(): Int {
    val dateProvider: DateProvider // Error: DateProvider requires opt-in
    // ...
}

@MyDateTime
fun getDate(): Date {
    val dateProvider: DateProvider // OK: the function requires opt-in as well
    // ...
}

fun displayDate() {
    println(getDate()) // Error: getDate() requires opt-in
}
```

As you can see in this example, the annotated function appears to be a part of the `@MyDateTime` API.
So, such an opt-in propagates the opt-in requirement to the client code; its clients will see the same warning message
and be required to consent as well.

Implicit usages of APIs that require opt-in also require opt-in. If an API element doesn't have an opt-in requirement
annotation but its signature includes a type declared as requiring opt-in, its usage will still raise a warning.
See the example below.

```kotlin
// Client code
fun getDate(dateProvider: DateProvider): Date { // Error: DateProvider requires opt-in
    // ...
}

fun displayDate() {
    println(getDate()) // Warning: the signature of getDate() contains DateProvider, which requires opt-in
}
```

To use multiple APIs that require opt-in, mark the declaration with all their opt-in requirement annotations.

### Non-propagating opt-in

In modules that don't expose their own API, such as applications, you can opt in to using APIs without propagating
the opt-in requirement to your code. In this case, mark your declaration with [`@OptIn`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-opt-in/)
 passing the opt-in requirement annotation as its argument:

```kotlin
// Library code
@RequiresOptIn(message = "This API is experimental. It may be changed in the future without notice.")
@Retention(AnnotationRetention.BINARY)
@Target(AnnotationTarget.CLASS, AnnotationTarget.FUNCTION)
annotation class MyDateTime // Opt-in requirement annotation

@MyDateTime
class DateProvider // A class requiring opt-in
```

```kotlin
// Client code
@OptIn(MyDateTime::class)
fun getDate(): Date { // Uses DateProvider; doesn't propagate the opt-in requirement
    val dateProvider: DateProvider
    // ...
}

fun displayDate() {
    println(getDate()) // OK: opt-in is not required
}
```

When somebody calls the function `getDate()`, they won't be informed about the opt-in requirements for APIs used in its body.

Note that if `@OptIn` applies to the declaration whose signature contains a type declared as requiring opt-in,
the opt-in will still propagate:

```kotlin
// Client code
@OptIn(MyDateTime::class)
fun getDate(dateProvider: DateProvider): Date { // Has DateProvider as a part of a signature; propagates the opt-in requirement
    // ...
}

fun displayDate() {
    println(getDate()) // Warning: getDate() requires opt-in
}
```

To use an API that requires opt-in in all functions and classes in a file, add the file-level annotation `@file:OptIn`
to the top of the file before the package specification and imports.

 ```kotlin
 // Client code
 @file:OptIn(MyDateTime::class)
 ```

### Module-wide opt-in

> The `-opt-in` compiler option is available since Kotlin 1.6.0. For earlier Kotlin versions, use `-Xopt-in`.
>
{type="note"}

If you don't want to annotate every usage of APIs that require opt-in, you can opt in to them for your whole module.
To opt in to using an API in a module, compile it with the argument `-opt-in`,
specifying the fully qualified name of the opt-in requirement annotation of the API you use: `-opt-in=org.mylibrary.OptInAnnotation`.
Compiling with this argument has the same effect as if every declaration in the module had the annotation`@OptIn(OptInAnnotation::class)`.

If you build your module with Gradle, you can add arguments like this:

<tabs group="build-script">
<tab title="Kotlin" group-key="kotlin">

```kotlin
tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile>().configureEach {
    kotlinOptions.freeCompilerArgs += "-opt-in=org.mylibrary.OptInAnnotation"
}
```

</tab>
<tab title="Groovy" group-key="groovy">

```groovy
tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).configureEach {
    kotlinOptions {
        freeCompilerArgs += "-opt-in=org.mylibrary.OptInAnnotation"
    }
}
```

</tab>
</tabs>

If your Gradle module is a multiplatform module, use the `optIn` method:

<tabs group="build-script">
<tab title="Kotlin" group-key="kotlin">

```kotlin
sourceSets {
    all {
        languageSettings.optIn("org.mylibrary.OptInAnnotation")
    }
}
```

</tab>
<tab title="Groovy" group-key="groovy">

```groovy
sourceSets {
    all {
        languageSettings {
            optIn('org.mylibrary.OptInAnnotation')
        }
    }
}
```

</tab>
</tabs>

For Maven, it would be:

```xml
<build>
    <plugins>
        <plugin>
            <groupId>org.jetbrains.kotlin</groupId>
            <artifactId>kotlin-maven-plugin</artifactId>
            <version>${kotlin.version}</version>
            <executions>...</executions>
            <configuration>
                <args>
                    <arg>-opt-in=org.mylibrary.OptInAnnotation</arg>
                </args>
            </configuration>
        </plugin>
    </plugins>
</build>
```

To opt in to multiple APIs on the module level, add one of the described arguments for each opt-in requirement marker used in your module.

## Require opt-in for API

### Create opt-in requirement annotations

If you want to require explicit consent to using your module's API, create an annotation class to use as an _opt-in requirement annotation_.
This class must be annotated with [@RequiresOptIn](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-requires-opt-in/):

```kotlin
@RequiresOptIn
@Retention(AnnotationRetention.BINARY)
@Target(AnnotationTarget.CLASS, AnnotationTarget.FUNCTION)
annotation class MyDateTime
```

Opt-in requirement annotations must meet several requirements:
* `BINARY` or `RUNTIME` [retention](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.annotation/-retention/)
* No `EXPRESSION`, `FILE`, `TYPE`, or `TYPE_PARAMETER` among [targets](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.annotation/-target/)
* No parameters.

An opt-in requirement can have one of two severity [levels](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-requires-opt-in/-level/):
* `RequiresOptIn.Level.ERROR`. Opt-in is mandatory. Otherwise, the code that uses marked API won't compile. Default level.
* `RequiresOptIn.Level.WARNING`. Opt-in is not mandatory, but advisable. Without it, the compiler raises a warning.

To set the desired level, specify the `level` parameter of the `@RequiresOptIn` annotation.

Additionally, you can provide a `message` to inform API users about special condition of using the API.
The compiler will show it to users that use the API without opt-in.

```kotlin
@RequiresOptIn(level = RequiresOptIn.Level.WARNING, message = "This API is experimental. It can be incompatibly changed in the future.")
@Retention(AnnotationRetention.BINARY)
@Target(AnnotationTarget.CLASS, AnnotationTarget.FUNCTION)
annotation class ExperimentalDateTime
```

If you publish multiple independent features that require opt-in, declare an annotation for each.
This makes the use of API safer for your clients: they can use only the features that they explicitly accept.
This also lets you remove the opt-in requirements from the features independently.

### Mark API elements

To require an opt-in to using an API element, annotate its declaration with an opt-in requirement annotation:

```kotlin
@MyDateTime
class DateProvider

@MyDateTime
fun getTime(): Time {}
```

Note that for some language elements, an opt-in requirement annotation is not applicable:
* You cannot annotate a backing field or a getter of a property, just the property itself.
* You cannot annotate a local variable or a value parameter.

## Opt-in requirements for pre-stable APIs

If you use opt-in requirements for features that are not stable yet, carefully handle the API graduation to avoid
breaking the client code.

Once your pre-stable API graduates and is released in a stable state, remove its opt-in requirement annotations from declarations.
The clients will be able to use them without restriction. However, you should leave the annotation classes in modules so that
the existing client code remains compatible.

To let the API users update their modules accordingly (remove the annotations
from their code and recompile), mark the annotations as [`@Deprecated`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-deprecated/)
and provide the explanation in the deprecation message.

```kotlin
@Deprecated("This opt-in requirement is not used anymore. Remove its usages from your code.")
@RequiresOptIn
annotation class ExperimentalDateTime
```


text:
package gaia3d.persistence;

import gaia3d.domain.simulation.SimulationLog;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface SimulationLogMapper {
    Long getSimulationLogTotalCount(SimulationLog simulationLog);
    List<SimulationLog> getListSimulationLog(SimulationLog simulationLog);
    SimulationLog getSimulationLog(Long simulationLogId);
    int insertSimulationLog(SimulationLog simulationLog);
    int insertSimulationDetailLog(SimulationLog simulationLog);
    int updateSimulationLog(SimulationLog simulationLog);
    int updateSimulationDetailLog(SimulationLog simulationLog);
    int deleteSimulationLog(SimulationLog simulationLog);
    int deleteSimulationDetailLog(SimulationLog simulationLog);
}


text:
package org.atlasapi.criteria;

/**
 * I represent a query that is never satisfied by any content.  Intermediate query processors may
 * replace satisfiable queries (or subqueries) with me to indicate that they have determined that no
 * content matches a query.
 *
 * @author John Ayres (john@metabroadcast.com)
 */
public class MatchesNothing extends AtomicQuery {

    private static MatchesNothing INSTANCE = new MatchesNothing();

    public static MatchesNothing get() {
        return INSTANCE;
    }

    private MatchesNothing() { /* SINGLETON */ }

    public <V> V accept(QueryVisitor<V> visitor) {
        return visitor.visit(this);
    }
}


text:
ORM library for Go Golang

## Import

	import "github.com/dotcoo/orm"

## Environment

### Database

	DROP TABLE IF EXISTS test_user;
	CREATE TABLE test_user (
	  id int(11) NOT NULL AUTO_INCREMENT,
	  username varchar(16) CHARACTER SET ascii NOT NULL,
	  password varchar(32) CHARACTER SET ascii NOT NULL,
	  reg_time int(11) NOT NULL,
	  reg_ip int(11) NOT NULL,
	  update_time int(11) NOT NULL,
	  update_ip int(11) NOT NULL,
	  PRIMARY KEY (id),
	  UNIQUE KEY username_UNIQUE (username)
	) ENGINE=InnoDB DEFAULT CHARSET=utf8;

	DROP TABLE IF EXISTS test_blog;
	CREATE TABLE test_blog (
	  id int(11) NOT NULL AUTO_INCREMENT,
	  user_id int(11) NOT NULL,
	  title varchar(45) NOT NULL,
	  content text NOT NULL,
	  add_time int(11) NOT NULL,
	  update_time int(11) NOT NULL,
	  PRIMARY KEY (id)
	) ENGINE=InnoDB DEFAULT CHARSET=utf8;

## Models

	type User struct {
		ID         int `orm:"pk"`
		Username   string
		Password   string
		RegTime    int `orm:"created"`
		RegIP      uint32
		UpdateTime int `orm:"updated"`
		UpdateIP   uint32
		OtherField string `orm:"-"`
	}

	type Blog struct {
		ID         int `orm:"pk"`
		UserID     int
		Title      string
		Content    string
		AddTime    int `orm:"created"`
		UpdateTime int `orm:"updated"`
	}

## Initialization

### SetDB

	db, err := sql.Open("mysql", "root:123456@/mingo?charset=utf8")
	if err != nil {
		panic(err)
	}
	orm.SetDB(db)

### SetPrefix

	orm.SetPrefix("test_")

### Variables

	var user *User
	var users []User
	var users_map map[int]User
	var result sql.Result
	var ok bool
	var sq *orm.SQL
	var n int

## CRUD

### Create

	user = new(User)
	user.Username = "dotcoo"
	user.Password = "123456"

	result = orm.Add(user)
	// result = orm.Add(user, "id", "username")

	log.Println(user.ID)
	log.Println(result.LastInsertId())

### Read/Retrieve

	user = new(User)
	user.ID = 1

	ok = orm.Get(user)
	// ok = orm.Get(user, "id", "username")

	if ok {
		log.Println(user)
	} else {
		log.Println("user not find")
	}

#### GetBy

	user = new(User)
	user.Username = "dotcoo"
	ok = orm.GetBy(user, "username")
	// ok = orm.GetBy(user, "id", "username")

	if ok {
		log.Println(user)
	} else {
		log.Println("user not find")
	}

### Update

	user = new(User)
	user.ID = 1
	user.Password = "654321"

	result = orm.Up(user, "password")
	// result = orm.Up(user, "id", "username")

	log.Println(result.RowsAffected())

### Delete

	user = new(User)
	user.ID = 1

	result = orm.Del(user)

	log.Println(result.RowsAffected())

### Save

	// insert
	user = new(User)
	user.ID = 0
	user.Username = "dotcoo2"
	user.Password = "123456"

	result = orm.Save(user)
	// result = orm.Save(user, "id", "username")

	log.Println(result.LastInsertId())
	log.Println(result.RowsAffected())

	// update
	user = new(User)
	user.ID = 2
	user.Username = "dotcoo2"
	user.Password = "654321"

	result = orm.Save(user, "username, password")

	log.Println(result.LastInsertId())
	log.Println(result.RowsAffected())

## SQL CRUD

### Insert

	user = new(User)
	user.ID = 1
	user.Username = "dotcoo"
	user.Password = "123456"

	result = orm.Insert(user, "id, username, password")
	// result = orm.Insert(user, "id", "username", "password")

	log.Println(result.LastInsertId())

### Select Model

	sq = orm.NewSQL().Where("username = ?", "dotcoo")

	user = new(User)

	ok = orm.Select(sq, user)
	// ok = orm.Select(sq, user, "id", "username", "password")

	if ok {
		log.Println(user)
	} else {
		log.Println("user not find")
	}

### Select Models

#### Slice

	sq = orm.NewSQL().Where("username like ?", "dotcoo%")

	users = make([]User, 0, 10)

	ok = orm.Select(sq, &users)
	// ok = orm.Select(sq, &users, "id", "username", "password")

	log.Println(users)

#### Map

	sq = orm.NewSQL().Where("username like ?", "dotcoo%")

	users_map = make(map[int]User)

	ok = orm.Select(sq, &users_map)
	// ok = orm.Select(sq, &users_map, "id", "username", "password")

	log.Println(users_map)

### Count

	n = orm.Count(sq)

	log.Println(n)

### Select Row

	sq = orm.NewSQL("user").Columns("count(*)", "sum(id)", "avg(id)")

	var count, sum int
	var avg float64

	ok = orm.SelectVal(sq, &count, &sum, &avg)

	log.Println(count, sum, avg)

### Update

	sq = orm.NewSQL().Where("username like ?", "dotcoo%")

	user = new(User)
	user.Password = "123321"

	result = orm.Update(sq, user, "password")
	// result = orm.Update(sq, user) // Error
	// result = orm.Update(sq, user, "*") // Correct

	log.Println(result.RowsAffected())

### Delete

	sq = orm.NewSQL().Where("username like ?", "dotcoo%")

	user = new(User)

	result = orm.Delete(sq, user)

	log.Println(result.RowsAffected())

## SQL

### Where

	orm.NewSQL("user").Where("username = ?", "dotcoo").ToSelect()
	// SELECT * FROM `test_user` WHERE username = ? [dotcoo]

### Where OR

	orm.NewSQL("user").Where("(username = ?", "dotcoo").Where(" OR username = ?)", "dotcoo2").ToSelect()
	// SELECT * FROM `test_user` WHERE (username = ? OR username = ?) [dotcoo dotcoo2]

### Columns and Table

	orm.NewSQL().Columns("id", "username").From("user").Where("username = ?", "dotcoo").ToSelect()
	// SELECT id, username FROM `test_user` WHERE username = ? [dotcoo]

### Group

	orm.NewSQL("user").Group("username").Having("id > ?", 100).ToSelect()
	// SELECT * FROM `test_user` GROUP BY username HAVING id > ? [100]

### Order

	orm.NewSQL("user").Group("username desc, id asc").ToSelect()
	// SELECT * FROM `test_user` GROUP BY username desc, id asc []

### Limit Offset

	orm.NewSQL("user").Limit(10).Offset(30).ToSelect()
	// SELECT * FROM `test_user` LIMIT 10 OFFSET 30 []

### Join

	orm.NewSQL().From("blog AS b").Join("user AS u", "b.user_id = u.id").ToSelect()
	SELECT * FROM `test_blog` AS `b` LEFT JOIN `test_user` AS `u` ON b.user_id = u.id []

### Update

	orm.NewSQL("user").Set("password", "123123").Set("age", 28).Where("id = ?", 1).ToUpdate()
	// UPDATE `test_user` SET `password` = ?, `age` = ? WHERE id = ? [123123 28 1]

### Delete

	orm.NewSQL("user").Where("id = ?", 1).ToDelete()
	// DELETE FROM `test_user` WHERE id = ? [1]

### Plus

	orm.NewSQL("user").Plus("age", 1).Where("id = ?", 1).ToUpdate()
	// UPDATE `test_user` SET `age` = `age` + ? WHERE id = ? [1 1]

### Incr

	orm.NewSQL("user").Incr("age", 1).Where("id = ?", 1).ToUpdate()
	// UPDATE `test_user` SET `age` = last_insert_id(`age` + ?) WHERE id = ? [1 1]

## Custom SQL

### Exec

	result = orm.Exec("delete from test_user where id < ?", 10)

### Query

	rows := orm.Query("select * from test_user where id < ?", 10)

### QueryRow

	row := orm.Query("select * from test_user where id = ?", 10)

## Other Method

### BatchInsert

	users = []User{
		{Username: "dotcoo3", Password: "123456", RegTime: 100},
		{Username: "dotcoo4", Password: "123456", RegTime: 101},
	}
	orm.BatchInsert(&users, "username, password, reg_time")

### BatchReplace

	users = []User{
		{ID: 3, Username: "dotcoo3", Password: "654321"},
		{ID: 4, Username: "dotcoo4", Password: "654321"},
	}
	orm.BatchReplace(&users, "id, username, password")

### ForeignKey

	blogs := []Blog{
		{ID: 1, Title: "blog title 1", UserID: 3},
		{ID: 2, Title: "blog title 2", UserID: 4},
		{ID: 3, Title: "blog title 3", UserID: 3},
	}

	users_map = make(map[int]User)

	orm.ForeignKey(&blogs, "user_id", &users_map, "id")
	// orm.ForeignKey(&blogs, "user_id", &users_map, "id", "id", "username", "password")

	for _, b := range blogs {
		log.Println(b.ID, b.Title, users_map[b.UserID].Username)
	}

## Transaction

	o := orm.DefaultORM

	otx := o.Begin()

	sq = otx.NewSQL().Where("id = ?", 3).ForUpdate()
	user = new(User)
	ok = otx.Select(sq, user)

	if !ok {
		otx.Rollback()
		log.Println("Rollback")
	} else {
		user.RegTime++
		otx.Up(user, "reg_time")

		otx.Commit()
		log.Println("Commit")
	}

## ModelInfo

	m := orm.DefaultORM.Manager()

	user = new(User)

	mi := m.Get(reflect.ValueOf(user).Elem().Type())

	if mi == nil {
		// if not exist, modify table name
		mi = orm.NewModelInfo(user, "prefix_", "users")
	} else {
		// if exist, modify table name
		mi.Table = "prefix_users"
	}

	m.Set(mi)


text:
namespace blink {
namespace {

class StubWebMediaPlayer : public EmptyWebMediaPlayer {
 public:
  StubWebMediaPlayer(WebMediaPlayerClient* client) : client_(client) {}

  const cc::Layer* GetCcLayer() { return layer_.get(); }

  // WebMediaPlayer
  LoadTiming Load(LoadType, const WebMediaPlayerSource&, CorsMode) override {
    network_state_ = kNetworkStateLoaded;
    client_->NetworkStateChanged();
    ready_state_ = kReadyStateHaveEnoughData;
    client_->ReadyStateChanged();
    layer_ = cc::Layer::Create();
    layer_->SetIsDrawable(true);
    layer_->SetHitTestable(true);
    client_->SetCcLayer(layer_.get());
    return LoadTiming::kImmediate;
  }
  NetworkState GetNetworkState() const override { return network_state_; }
  ReadyState GetReadyState() const override { return ready_state_; }

 private:
  WebMediaPlayerClient* client_;
  scoped_refptr<cc::Layer> layer_;
  NetworkState network_state_ = kNetworkStateEmpty;
  ReadyState ready_state_ = kReadyStateHaveNothing;
};

class VideoStubLocalFrameClient : public EmptyLocalFrameClient {
 public:
  // LocalFrameClient
  std::unique_ptr<WebMediaPlayer> CreateWebMediaPlayer(
      HTMLMediaElement&,
      const WebMediaPlayerSource&,
      WebMediaPlayerClient* client) override {
    return std::make_unique<StubWebMediaPlayer>(client);
  }
};

class VideoPainterTestForCAP : private ScopedCompositeAfterPaintForTest,
                               public PaintControllerPaintTestBase {
 public:
  VideoPainterTestForCAP()
      : ScopedCompositeAfterPaintForTest(true),
        PaintControllerPaintTestBase(
            MakeGarbageCollected<VideoStubLocalFrameClient>()) {}

  void SetUp() override {
    EnableCompositing();
    PaintControllerPaintTestBase::SetUp();
    GetDocument().SetURL(KURL(NullURL(), "https://example.com/"));
  }

  bool HasLayerAttached(const cc::Layer& layer) {
    return GetChromeClient().HasLayer(layer);
  }
};

TEST_F(VideoPainterTestForCAP, VideoLayerAppearsInLayerTree) {
  // Insert a <video> and allow it to begin loading.
  SetBodyInnerHTML("<video width=300 height=300 src=test.ogv>");
  test::RunPendingTasks();

  // Force the page to paint.
  UpdateAllLifecyclePhasesForTest();

  // Fetch the layer associated with the <video>, and check that it was
  // correctly configured in the layer tree.
  auto* element = To<HTMLMediaElement>(GetDocument().body()->firstChild());
  StubWebMediaPlayer* player =
      static_cast<StubWebMediaPlayer*>(element->GetWebMediaPlayer());
  const cc::Layer* layer = player->GetCcLayer();
  ASSERT_TRUE(layer);
  EXPECT_TRUE(HasLayerAttached(*layer));
  // The layer bounds reflects the aspect ratio and object-fit of the video.
  EXPECT_EQ(gfx::Vector2dF(0, 75), layer->offset_to_transform_parent());
  EXPECT_EQ(gfx::Size(300, 150), layer->bounds());
}

class VideoPaintPreviewTest : public testing::Test,
                              public PaintTestConfigurations {
 public:
  void SetUp() override {
    web_view_helper_.Initialize();

    WebLocalFrameImpl& frame_impl = GetLocalMainFrame();
    frame_impl.ViewImpl()->MainFrameWidget()->Resize(WebSize(bounds().size()));

    frame_test_helpers::LoadFrame(&GetLocalMainFrame(), "about:blank");
    GetDocument().View()->SetParentVisible(true);
    GetDocument().View()->SetSelfVisible(true);
  }

  void SetBodyInnerHTML(const std::string& content) {
    frame_test_helpers::LoadHTMLString(&GetLocalMainFrame(), content,
                                       KURL("http://test.com"));
  }

  Document& GetDocument() { return *GetFrame()->GetDocument(); }

  WebLocalFrameImpl& GetLocalMainFrame() {
    return *web_view_helper_.LocalMainFrame();
  }

  const gfx::Rect& bounds() { return bounds_; }

 private:
  LocalFrame* GetFrame() { return GetLocalMainFrame().GetFrame(); }

  frame_test_helpers::WebViewHelper web_view_helper_;
  gfx::Rect bounds_ = {0, 0, 640, 480};
};

INSTANTIATE_PAINT_TEST_SUITE_P(VideoPaintPreviewTest);

TEST_P(VideoPaintPreviewTest, URLIsRecordedWhenPaintingPreview) {
  // Insert a <video> and allow it to begin loading. The image was taken from
  // the RFC for the data URI scheme https://tools.ietf.org/html/rfc2397.
  SetBodyInnerHTML(R"HTML(
    <style>body{margin:0}</style>
    <video width=300 height=300 src="test.ogv" poster="data:image/gif;base64,R0
      lGODdhMAAwAPAAAAAAAP///ywAAAAAMAAwAAAC8IyPqcvt3wCcDkiLc7C0qwyGHhSWpjQu5yq
      mCYsapyuvUUlvONmOZtfzgFzByTB10QgxOR0TqBQejhRNzOfkVJ+5YiUqrXF5Y5lKh/DeuNcP
      5yLWGsEbtLiOSpa/TPg7JpJHxyendzWTBfX0cxOnKPjgBzi4diinWGdkF8kjdfnycQZXZeYGe
      jmJlZeGl9i2icVqaNVailT6F5iJ90m6mvuTS4OK05M0vDk0Q4XUtwvKOzrcd3iq9uisF81M1O
      IcR7lEewwcLp7tuNNkM3uNna3F2JQFo97Vriy/Xl4/f1cf5VWzXyym7PHhhx4dbgYKAAA7"
      controls>
  )HTML");
  test::RunPendingTasks();

  auto token = base::UnguessableToken::Create();
  const base::UnguessableToken embedding_token =
      base::UnguessableToken::Create();
  const bool is_main_frame = true;

  cc::PaintRecorder recorder;
  paint_preview::PaintPreviewTracker tracker(token, embedding_token,
                                             is_main_frame);
  cc::PaintCanvas* canvas =
      recorder.beginRecording(bounds().width(), bounds().height());
  canvas->SetPaintPreviewTracker(&tracker);

  EXPECT_EQ(0lu, tracker.GetLinks().size());
  GetLocalMainFrame().CapturePaintPreview(WebRect(bounds()), canvas);

  ASSERT_EQ(1lu, tracker.GetLinks().size());
  EXPECT_EQ("http://test.com/", tracker.GetLinks()[0]->url);
  EXPECT_EQ(gfx::Rect(300, 300), tracker.GetLinks()[0]->rect);
}

}  // namespace
}  // namespace blink