text:
package com.youzu.android.framework.json.serializer;

import java.io.IOException;
import java.lang.reflect.Type;

/**
 * @author wenshao<szujobs@hotmail.com>
 */
public class StringSerializer implements ObjectSerializer {

    public static StringSerializer instance = new StringSerializer();

    public void write(JSONSerializer serializer, Object object, Object fieldName, Type fieldType) throws IOException {
        write(serializer, (String) object);
    }

    public void write(JSONSerializer serializer, String value) {
        SerializeWriter out = serializer.getWriter();

        if (value == null) {
            if (out.isEnabled(SerializerFeature.WriteNullStringAsEmpty)) {
                out.writeString("");
            } else {
                out.writeNull();
            }
            return;
        }

        out.writeString(value);
    }
}


text:
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>value::value (8 of 35 overloads)</title>
<link rel="stylesheet" href="../../../../../../../../doc/src/boostbook.css" type="text/css">
<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
<link rel="home" href="../../../../index.html" title="Chapter 1. Boost.JSON">
<link rel="up" href="../value.html" title="value::value">
<link rel="prev" href="overload7.html" title="value::value (7 of 35 overloads)">
<link rel="next" href="overload9.html" title="value::value (9 of 35 overloads)">

Home
Libraries
People
FAQ
More

value::value
          (8 of 35 overloads)

            Construct a null.

<h7>
            Synopsis
          </h7>
value(
    std::nullptr_t,
    storage_ptr sp = {});

<h7>
            Description
          </h7>

            A null value is a monostate.

<h7>
            Complexity
          </h7>

            Constant.

<h7>
            Exception
            Safety
          </h7>

            No-throw guarantee.

<h7>
            Parameters
          </h7>

<colgroup>
<col>
<col>
</colgroup>

                      Name

                      Description

                      sp

                      A pointer to the memory_resource to
                      use. The container will acquire shared ownership of the memory
                      resource.

Copyright © 2019, 2020 Vinnie Falco
Copyright © 2020 Krystian Stasiowski

        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)

redpajama_set_name: RedPajamaGithub


text:
// Copyright (c) 2016 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

// @ts-nocheck
// TODO(crbug.com/1011811): Enable TypeScript compiler checks

import * as ARIAUtils from './ARIAUtils.js';
import {Toolbar} from './Toolbar.js';
import {VBox} from './Widget.js';

/**
 * @unrestricted
 */
export class ReportView extends VBox {
  /**
   * @param {string=} title
   */
  constructor(title) {
    super(true);
    this.registerRequiredCSS('ui/reportView.css');

    this._contentBox = this.contentElement.createChild('div', 'report-content-box');
    this._headerElement = this._contentBox.createChild('div', 'report-header vbox');
    this._titleElement = this._headerElement.createChild('div', 'report-title');
    this._titleElement.textContent = title;
    ARIAUtils.markAsHeading(this._titleElement, 1);

    this._sectionList = this._contentBox.createChild('div', 'vbox');
  }

  /**
   * @param {string} title
   */
  setTitle(title) {
    if (this._titleElement.textContent === title) {
      return;
    }
    this._titleElement.textContent = title;
  }

  /**
   * @param {string} subtitle
   */
  setSubtitle(subtitle) {
    if (this._subtitleElement && this._subtitleElement.textContent === subtitle) {
      return;
    }
    if (!this._subtitleElement) {
      this._subtitleElement = this._headerElement.createChild('div', 'report-subtitle');
    }
    this._subtitleElement.textContent = subtitle;
  }

  /**
   * @param {?Element} link
   */
  setURL(link) {
    if (!this._urlElement) {
      this._urlElement = this._headerElement.createChild('div', 'report-url link');
    }
    this._urlElement.removeChildren();
    if (link) {
      this._urlElement.appendChild(link);
    }
  }

  /**
   * @return {!Toolbar}
   */
  createToolbar() {
    const toolbar = new Toolbar('');
    this._headerElement.appendChild(toolbar.element);
    return toolbar;
  }

  /**
   * @param {string} title
   * @param {string=} className
   * @return {!Section}
   */
  appendSection(title, className) {
    const section = new Section(title, className);
    section.show(this._sectionList);
    return section;
  }

  /**
   * @param {function(!Section, !Section): number} comparator
   */
  sortSections(comparator) {
    const sections = /** @type {!Array<!Section>} */ (this.children().slice());
    const sorted = sections.every((e, i, a) => !i || comparator(a[i - 1], a[i]) <= 0);
    if (sorted) {
      return;
    }

    this.detachChildWidgets();
    sections.sort(comparator);
    for (const section of sections) {
      section.show(this._sectionList);
    }
  }

  /**
   * @param {boolean} visible
   */
  setHeaderVisible(visible) {
    this._headerElement.classList.toggle('hidden', !visible);
  }

  /**
   * @param {boolean} scrollable
   */
  setBodyScrollable(scrollable) {
    this._contentBox.classList.toggle('no-scroll', !scrollable);
  }
}

/**
 * @unrestricted
 */
export class Section extends VBox {
  /**
   * @param {string} title
   * @param {string=} className
   */
  constructor(title, className) {
    super();
    this.element.classList.add('report-section');
    if (className) {
      this.element.classList.add(className);
    }
    this._headerElement = this.element.createChild('div', 'report-section-header');
    this._titleElement = this._headerElement.createChild('div', 'report-section-title');
    this.setTitle(title);
    ARIAUtils.markAsHeading(this._titleElement, 2);
    this._fieldList = this.element.createChild('div', 'vbox');
    /** @type {!Map.<string, !Element>} */
    this._fieldMap = new Map();
  }

  /**
   * @return {string}
   */
  title() {
    return this._titleElement.textContent;
  }

  /**
   * @param {string} title
   */
  setTitle(title) {
    if (this._titleElement.textContent !== title) {
      this._titleElement.textContent = title;
    }
    this._titleElement.classList.toggle('hidden', !this._titleElement.textContent);
  }

  /**
   * Declares the overall container to be a group and assigns a title.
   * @param {string} groupTitle
   */
  setUiGroupTitle(groupTitle) {
    ARIAUtils.markAsGroup(this.element);
    ARIAUtils.setAccessibleName(this.element, groupTitle);
  }

  /**
   * @return {!Toolbar}
   */
  createToolbar() {
    const toolbar = new Toolbar('');
    this._headerElement.appendChild(toolbar.element);
    return toolbar;
  }

  /**
   * @param {string} title
   * @param {string=} textValue
   * @return {!Element}
   */
  appendField(title, textValue) {
    let row = this._fieldMap.get(title);
    if (!row) {
      row = this._fieldList.createChild('div', 'report-field');
      row.createChild('div', 'report-field-name').textContent = title;
      this._fieldMap.set(title, row);
      row.createChild('div', 'report-field-value');
    }
    if (textValue) {
      row.lastElementChild.textContent = textValue;
    }
    return /** @type {!Element} */ (row.lastElementChild);
  }

  /**
  * @param {string} title
  * @param {string=} textValue
  * @return {!Element}
  */
  appendFlexedField(title, textValue) {
    const field = this.appendField(title, textValue);
    field.classList.add('report-field-value-is-flexed');
    return field;
  }

  /**
   * @param {string} title
   */
  removeField(title) {
    const row = this._fieldMap.get(title);
    if (row) {
      row.remove();
    }
    this._fieldMap.delete(title);
  }

  /**
   * @param {string} title
   * @param {boolean} visible
   */
  setFieldVisible(title, visible) {
    const row = this._fieldMap.get(title);
    if (row) {
      row.classList.toggle('hidden', !visible);
    }
  }

  /**
   * @param {string} title
   * @return {?Element}
   */
  fieldValue(title) {
    const row = this._fieldMap.get(title);
    return row ? row.lastElementChild : null;
  }

  /**
   * @return {!Element}
   */
  appendRow() {
    return this._fieldList.createChild('div', 'report-row');
  }

  /**
   * @return {!Element}
   */
  appendSelectableRow() {
    return this._fieldList.createChild('div', 'report-row report-row-selectable');
  }

  clearContent() {
    this._fieldList.removeChildren();
    this._fieldMap.clear();
  }

  markFieldListAsGroup() {
    ARIAUtils.markAsGroup(this._fieldList);
    ARIAUtils.setAccessibleName(this._fieldList, this.title());
  }

  /**
   * @param {boolean} masked
   */
  setIconMasked(masked) {
    this.element.classList.toggle('show-mask', masked);
  }
}


text:
import { Next, Request, Response } from "restify";

export interface PaginationMiddlewareConfig {
    perPage?: number;
    count: number;
}

export interface PaginatedResponse extends Response {
    sendPaginatedResponse(status?: any, body?: any, headers?: { [header: string]: string }): any;
}

export interface PaginatedRequest extends Request {
    per_page: number;
    page: number;
}

export class PaginationMiddleware {
    /**
     * Pagination Middleware Request handler
     *
     * @param config pagination options
     */
    public handlePagination(config: PaginationMiddlewareConfig) {
        if (config.perPage === undefined) {
            config.perPage = 30;
        }

        return (req: PaginatedRequest, res: PaginatedResponse, next: Next) => {
            const page = (req.query.page !== undefined) ? Number(req.query.page) : 1;
            const perPage = (req.query.per_page !== undefined) ? Number(req.query.per_page) : config.perPage;

            res.sendPaginatedResponse = (code: number, object: any, headers?: { [header: string]: string }): any => {
                const link: string[] = [];
                const baseUrl: string = (req.isSecure() ? "https://" : "http://") + req.headers.host;
                const lastPage = config.count / perPage;

                // If we are not on the last page, display the last page and next
                if (page < lastPage) {
                    link.push("<" + baseUrl + "?page=" + (page + 1) + "&per_page=" + perPage + '>; rel="next"');
                    link.push("<" + baseUrl + "?page=" + lastPage + "&per_page=" + perPage + '>; rel="last"');
                }

                // If we are not on the first page, display the first page
                if (page > 1) {
                    link.push("<" + baseUrl + "?page=1&per_page=" + perPage + '>; rel="first"');
                    link.push("<" + baseUrl + "?page=" + (page - 1) + "&per_page=" + perPage + '>; rel="prev"');
                }

                res.setHeader("link", link);
                res.send(code, object, headers);
            };

            next();
        };
    }
}


text:
<?php

namespace MadWeb\Seoable\Test;

class SeoableOpenGraphTest extends TestCase
{
    protected $seoOpenGraph;

    /**
     * {@inheritdoc}
     */
    public function setUp(): void
    {
        parent::setUp();

        $this->seoOpenGraph = $this->app->make('seotools.opengraph');
    }

    /** @test */
    public function filling_meta_tags()
    {
        $this->setUpModel();

        $title = $this->app['translator']->get(
            'seo.'.\MadWeb\Seoable\Test\Models\Post::class.'.open_graph.title',
            ['title' => $this->testPost->title]
        );

        $description = $this->app['translator']->get(
            'seo.'.\MadWeb\Seoable\Test\Models\Post::class.'.open_graph.description',
            ['description' => $this->testPost->description]
        );

        $fullHeader = '';
        $fullHeader .= "<meta property=\"og:title\" content=\"$title\">";
        $fullHeader .= "<meta property=\"og:description\" content=\"$description\">";
        $fullHeader .= "<meta property=\"og:site_name\" content=\"{$this->testPost->site}\">";
        $fullHeader .= "<meta property=\"og:name\" content=\"{$this->testPost->title}\">";
        $fullHeader .= "<meta property=\"og:foo\" content=\"{$this->testPost->description}\">";
        $fullHeader .= "<meta property=\"og:bar\" content=\"{$this->testPost->title}\">";
        $fullHeader .= "<meta property=\"og:bar\" content=\"{$this->testPost->slug}\">";
        $fullHeader .= "<meta property=\"og:url\" content=\"{$this->testPost->url}\">";
        $fullHeader .= "<meta property=\"og:image\" content=\"{$this->testPost->image}\">";
        $fullHeader .= "<meta property=\"og:image\" content=\"{$this->testPost->image}\">";

        $this->setRightAssertion($fullHeader);
    }

    protected function generatedTags()
    {
        return $this->seoOpenGraph->generate(true);
    }

    protected function setUpModel()
    {
        $this->testPost->seoable()
        ->opengraph()
            ->setTitle('title')
            ->setDescription(['description'])
            ->setUrl('url')
            ->setSiteName('site')
            ->setImages(['image', 'image'])
            ->setProperties([
                [
                    'key' => 'name',
                    'value' => 'title',
                ],
                [
                    'key' => 'foo',
                    'value' => 'description',
                ],
            ])
            ->addProperty('bar', ['title', 'slug']);
    }
}


text:
**bloc** is a **b**etter **loc**ate which is capable of quickly finding any file/archive you have stored in your computer with as much flexibility as needed. The speed increase may be of up to 10 times faster compared to normal locate, and up to 30 times compared to find. (Pictures will be available in a future release)

### How it works
`bloc`works pretty much in the same way that locate does: it is a cli searching tool that creates a database where it looks for the specified file or directory and outputs its name/location to STDOUT. The 2 major differences here are that:

* 1: `bloc` does not compress the database.
whereas this means that the database file is larger, it also means that it doesn't have to waste time decompressing the database before searching for certain query. Moreover, most tests reported that locate can only decrease database size to about a third of the original's, which, nowadays, isn't that much of a problem for most computers.

* 2: `bloc` uses [rg](https://github.com/BurntSushi/ripgrep) to search for it's files, which provides a much faster result than most other search tools.

### Prerequisites
* [rg](https://github.com/BurntSushi/ripgrep) (Optional if you change the default searching tool in the bloc file)

### Installation

Installation of `bloc` can be made by running the install script provided, it needs two arguments, or it won't work. The first is the install directory. As of now, the script will create a symbolic link into that specified install folder, and add that folder to $PATH, a later release will allow you to choose whether to have it symlinked or hard copied. The second argument is the place where you want to store the database, and where the database will be stored by default on future updates. Please keep in mind that neither of these values have a default yet, it shall be added soon though.

The other option that you have is to follow below instructions, in case you have any problems with the installation script.

**1.** Clone this repo to your local machine

    git clone https://github.com/bootzin/bloc

**2** Add `bloc` to your local bin folder so that you can execute it from anywhere. I usually keep them on a separate folder and symlink them to ~/bin (which must be in $PATH).

**3** Edit the default path for database file in bloc/bloc-populate. They default to ~/Software/bloc, but make sure that folder exists before running the program.

**4.** Run `bloc-populate` or `bloc -p` in order to create the initial database (In a future release `bloc` will automatically do this before it's first run)

    bloc --populate

**5.** [Optional] Add on your autostart script an execution command to populate bloc database, so that when you start the system it gets automatically updated

### Usage

    Usage: bloc [OPTIONS] FILE
    Searches system for a file or directory
        -h, --help 		displays this help message and exits.
        -c <database>		specifies where to load the database from
        -s <searcher>		specifies searcher to be used. Defaults to ripgrep. Additional commands may be used within '' i.e. 'grep -v'
        -v, --verbose		verbose
        -v2, -vv		Second verbosity level, more information is shown
        -p, --populate <output>	populate bloc database and saves it to <output>. Default saves to ~/Software/bloc.db

### Autoupdate

As of now there are two main ways of performing automatic updates of `bloc`. The first one is to use [cron](https://en.wikipedia.org/wiki/Cron) to schedule regular interval updates by adding

    */5 * * * bloc -p

in your cronstab file, which will perform the update every 5 minutes. The other one is by using a useful program created by z3bra called [wendy](https://github.com/z3bra/wendy). What this program does is it checks for changes under certain directory and executes a command if any changes are detected. The command you'd use in this case would be

    wendy -f /home/user/ -t 300 bloc -p

which would check at every 5 minutes if there's been a change in your $HOME dir and if there is, it would perform an update. This would work because every time you run a shell command it gets registered under your history file (.bash-history, .zsh-history, etc), and wendy would detect that change. If your shell doesn't have a history then you have to stick with the first method.

### Tips

* By default `bloc` does not detect files/directories you do not normally have access to. To change this, simply run `bloc -p` as sudo, and it will detect /root/ files as well
* You can use any searching toll you want with bloc (grep, ag, ack ...), as long as you pass it as an argument using the `-s` tag or change the default searcher command in the bloc file
* If you want to add any arguments to the searcher (i.e. -v, -E, -N) you can do so by specifing them with the `-s` tag, they should all work just right! (Remember to also add the searcher you're using, i.e 'rg -vE')
* You can populate `bloc` database by running `bloc -p` instead of `bloc-populate`
* bloc-populate can recieve an output file as an argument when used with the `-o` tag
* You can use the `-c` tag on `bloc` to make it search for inside file, not just its database

### Troubleshooting

If you're getting /root/path/to/db instead of /home/user/path/to/db in when running `bloc-populate` as sudo make sure you have the following line in your sudoers file:

	Default env_keep += "HOME"

Besides that, leave me an Issue reporting the steps necessary to reproduce the error you've got and I'll look into it

### License

This Project is Lincensed under the MIT License

#### Disclaimer
This is a WIP, I intend to implement more functionalities to `bloc` to make it even better. For now, if you have any ideas you wish to contribute, please feel free to contact me (:


text:
package com.example.android.sunshine.app;

import android.graphics.Color;
import android.net.Uri;
import android.util.Log;

import com.google.android.gms.common.api.GoogleApiClient;
import com.google.android.gms.common.api.ResultCallback;
import com.google.android.gms.wearable.DataApi;
import com.google.android.gms.wearable.DataItem;
import com.google.android.gms.wearable.DataMap;
import com.google.android.gms.wearable.DataMapItem;
import com.google.android.gms.wearable.NodeApi;
import com.google.android.gms.wearable.PutDataMapRequest;
import com.google.android.gms.wearable.Wearable;

public final class DigitalWatchFaceUtil {
    private static final String TAG = "DigitalWatchFaceUtil";

    /**
     * The {@link DataMap} key for {@link DigitalWatchFaceService} background color name.
     * The color name must be a {@link String} recognized by {@link Color#parseColor}.
     */
    public static final String KEY_BACKGROUND_COLOR = "BACKGROUND_COLOR";

    /**
     * The {@link DataMap} key for {@link DigitalWatchFaceService} hour digits color name.
     * The color name must be a {@link String} recognized by {@link Color#parseColor}.
     */
    public static final String KEY_HOURS_COLOR = "HOURS_COLOR";

    /**
     * The {@link DataMap} key for {@link DigitalWatchFaceService} minute digits color name.
     * The color name must be a {@link String} recognized by {@link Color#parseColor}.
     */
    public static final String KEY_MINUTES_COLOR = "MINUTES_COLOR";

    /**
     * The {@link DataMap} key for {@link DigitalWatchFaceService} second digits color name.
     * The color name must be a {@link String} recognized by {@link Color#parseColor}.
     */
    public static final String KEY_SECONDS_COLOR = "SECONDS_COLOR";

    /**
     * The path for the {@link DataItem} containing {@link DigitalWatchFaceService} configuration.
     */
    public static final String PATH_WITH_FEATURE = "/watch_face_config/Digital";

    public static final String IMAGE_PATH = "/image";
    public static final String IMAGE_KEY = "photo";

    /**
     * Name of the default interactive mode background color and the ambient mode background color.
     */
    public static final String COLOR_NAME_DEFAULT_AND_AMBIENT_BACKGROUND = "Black";
    public static final int COLOR_VALUE_DEFAULT_AND_AMBIENT_BACKGROUND =
            parseColor(COLOR_NAME_DEFAULT_AND_AMBIENT_BACKGROUND);

    /**
     * Name of the default interactive mode hour digits color and the ambient mode hour digits
     * color.
     */
    public static final String COLOR_NAME_DEFAULT_AND_AMBIENT_HOUR_DIGITS = "White";
    public static final int COLOR_VALUE_DEFAULT_AND_AMBIENT_HOUR_DIGITS =
            parseColor(COLOR_NAME_DEFAULT_AND_AMBIENT_HOUR_DIGITS);

    /**
     * Name of the default interactive mode minute digits color and the ambient mode minute digits
     * color.
     */
    public static final String COLOR_NAME_DEFAULT_AND_AMBIENT_MINUTE_DIGITS = "White";
    public static final int COLOR_VALUE_DEFAULT_AND_AMBIENT_MINUTE_DIGITS =
            parseColor(COLOR_NAME_DEFAULT_AND_AMBIENT_MINUTE_DIGITS);

    /**
     * Name of the default interactive mode second digits color and the ambient mode second digits
     * color.
     */
    public static final String COLOR_NAME_DEFAULT_AND_AMBIENT_SECOND_DIGITS = "Gray";
    public static final int COLOR_VALUE_DEFAULT_AND_AMBIENT_SECOND_DIGITS =
            parseColor(COLOR_NAME_DEFAULT_AND_AMBIENT_SECOND_DIGITS);

    /**
     * Callback interface to perform an action with the current config {@link DataMap} for
     * {@link DigitalWatchFaceService}.
     */
    public interface FetchConfigDataMapCallback {
        /**
         * Callback invoked with the current config {@link DataMap} for
         * {@link DigitalWatchFaceService}.
         */
        void onConfigDataMapFetched(DataMap config);
    }

    private static int parseColor(String colorName) {
        return Color.parseColor(colorName.toLowerCase());
    }

    /**
     * Asynchronously fetches the current config {@link DataMap} for {@link DigitalWatchFaceService}
     * and passes it to the given callback.
     *

     * If the current config {@link DataItem} doesn't exist, it isn't created and the callback
     * receives an empty DataMap.
     */
    public static void fetchConfigDataMap(final GoogleApiClient client,
            final FetchConfigDataMapCallback callback) {
        Wearable.NodeApi.getLocalNode(client).setResultCallback(
                new ResultCallback<NodeApi.GetLocalNodeResult>() {
                    @Override
                    public void onResult(NodeApi.GetLocalNodeResult getLocalNodeResult) {
                        String localNode = getLocalNodeResult.getNode().getId();
                        Uri uri = new Uri.Builder()
                                .scheme("wear")
                                .path(DigitalWatchFaceUtil.PATH_WITH_FEATURE)
                                .authority(localNode)
                                .build();
                        Wearable.DataApi.getDataItem(client, uri)
                                .setResultCallback(new DataItemResultCallback(callback));
                    }
                }
        );
    }

    /**
     * Overwrites (or sets, if not present) the keys in the current config {@link DataItem} with
     * the ones appearing in the given {@link DataMap}. If the config DataItem doesn't exist,
     * it's created.
     *

     * It is allowed that only some of the keys used in the config DataItem appear in
     * {@code configKeysToOverwrite}. The rest of the keys remains unmodified in this case.
     */
    public static void overwriteKeysInConfigDataMap(final GoogleApiClient googleApiClient,
            final DataMap configKeysToOverwrite) {

        DigitalWatchFaceUtil.fetchConfigDataMap(googleApiClient,
                new FetchConfigDataMapCallback() {
                    @Override
                    public void onConfigDataMapFetched(DataMap currentConfig) {
                        DataMap overwrittenConfig = new DataMap();
                        overwrittenConfig.putAll(currentConfig);
                        overwrittenConfig.putAll(configKeysToOverwrite);
                        DigitalWatchFaceUtil.putConfigDataItem(googleApiClient, overwrittenConfig);
                    }
                }
        );
    }

    /**
     * Overwrites the current config {@link DataItem}'s {@link DataMap} with {@code newConfig}.
     * If the config DataItem doesn't exist, it's created.
     */
    public static void putConfigDataItem(GoogleApiClient googleApiClient, DataMap newConfig) {
        PutDataMapRequest putDataMapRequest = PutDataMapRequest.create(PATH_WITH_FEATURE);
        putDataMapRequest.setUrgent();
        DataMap configToPut = putDataMapRequest.getDataMap();
        configToPut.putAll(newConfig);
        Wearable.DataApi.putDataItem(googleApiClient, putDataMapRequest.asPutDataRequest())
                .setResultCallback(new ResultCallback<DataApi.DataItemResult>() {
                    @Override
                    public void onResult(DataApi.DataItemResult dataItemResult) {
                        if (Log.isLoggable(TAG, Log.DEBUG)) {
                            Log.d(TAG, "putDataItem result status: " + dataItemResult.getStatus());
                        }
                    }
                });
    }

    private static class DataItemResultCallback implements ResultCallback<DataApi.DataItemResult> {

        private final FetchConfigDataMapCallback mCallback;

        public DataItemResultCallback(FetchConfigDataMapCallback callback) {
            mCallback = callback;
        }

        @Override
        public void onResult(DataApi.DataItemResult dataItemResult) {
            if (dataItemResult.getStatus().isSuccess()) {
                if (dataItemResult.getDataItem() != null) {
                    DataItem configDataItem = dataItemResult.getDataItem();
                    DataMapItem dataMapItem = DataMapItem.fromDataItem(configDataItem);
                    DataMap config = dataMapItem.getDataMap();
                    mCallback.onConfigDataMapFetched(config);
                } else {
                    mCallback.onConfigDataMapFetched(new DataMap());
                }
            }
        }
    }

    private DigitalWatchFaceUtil() { }
}


text:
package jdbm.recman;

import junit.framework.TestCase;
import junit.framework.TestSuite;

/**
 * This class contains all Unit tests for {@link Location}.
 */
public class TestLocation extends TestCase {

	public TestLocation(String name) {
		super(name);
	}

	/**
	 * Basic tests
	 */
	public void testBasics() {

		long loc = Location.toLong(10, (short) 20);

		assertEquals("block2", 10, Location.getBlock(loc));
		assertEquals("offset2", 20, Location.getOffset(loc));

	}

	/**
	 * Runs all tests in this class
	 */
	public static void main(String[] args) {
		junit.textui.TestRunner.run(new TestSuite(TestLocation.class));
	}
}


text:
/*
 * Copyright 2014 Twitter, 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 io.netty.handler.codec.http2;

import io.netty.buffer.ByteBuf;
import io.netty.util.AsciiString;
import io.netty.util.ByteProcessor;
import io.netty.util.internal.ObjectUtil;
import io.netty.util.internal.ThrowableUtil;

import static io.netty.handler.codec.http2.Http2Error.COMPRESSION_ERROR;
import static io.netty.handler.codec.http2.Http2Exception.connectionError;

final class HpackHuffmanDecoder {

    private static final Http2Exception EOS_DECODED = ThrowableUtil.unknownStackTrace(
            connectionError(COMPRESSION_ERROR, "HPACK - EOS Decoded"), HpackHuffmanDecoder.class, "decode(..)");
    private static final Http2Exception INVALID_PADDING = ThrowableUtil.unknownStackTrace(
            connectionError(COMPRESSION_ERROR, "HPACK - Invalid Padding"), HpackHuffmanDecoder.class, "decode(..)");

    private static final Node ROOT = buildTree(HpackUtil.HUFFMAN_CODES, HpackUtil.HUFFMAN_CODE_LENGTHS);

    private final DecoderProcessor processor;

    HpackHuffmanDecoder(int initialCapacity) {
        processor = new DecoderProcessor(initialCapacity);
    }

    /**
     * Decompresses the given Huffman coded string literal.
     *
     * @param buf the string literal to be decoded
     * @return the output stream for the compressed data
     * @throws Http2Exception EOS Decoded
     */
    public AsciiString decode(ByteBuf buf, int length) throws Http2Exception {
        processor.reset();
        buf.forEachByte(buf.readerIndex(), length, processor);
        buf.skipBytes(length);
        return processor.end();
    }

    private static final class Node {

        private final int symbol;      // terminal nodes have a symbol
        private final int bits;        // number of bits matched by the node
        private final Node[] children; // internal nodes have children

        /**
         * Construct an internal node
         */
        Node() {
            symbol = 0;
            bits = 8;
            children = new Node[256];
        }

        /**
         * Construct a terminal node
         *
         * @param symbol the symbol the node represents
         * @param bits the number of bits matched by this node
         */
        Node(int symbol, int bits) {
            assert bits > 0 && bits <= 8;
            this.symbol = symbol;
            this.bits = bits;
            children = null;
        }

        private boolean isTerminal() {
            return children == null;
        }
    }

    private static Node buildTree(int[] codes, byte[] lengths) {
        Node root = new Node();
        for (int i = 0; i < codes.length; i++) {
            insert(root, i, codes[i], lengths[i]);
        }
        return root;
    }

    private static void insert(Node root, int symbol, int code, byte length) {
        // traverse tree using the most significant bytes of code
        Node current = root;
        while (length > 8) {
            if (current.isTerminal()) {
                throw new IllegalStateException("invalid Huffman code: prefix not unique");
            }
            length -= 8;
            int i = (code >>> length) & 0xFF;
            if (current.children[i] == null) {
                current.children[i] = new Node();
            }
            current = current.children[i];
        }

        Node terminal = new Node(symbol, length);
        int shift = 8 - length;
        int start = (code << shift) & 0xFF;
        int end = 1 << shift;
        for (int i = start; i < start + end; i++) {
            current.children[i] = terminal;
        }
    }

    private static final class DecoderProcessor implements ByteProcessor {
        private final int initialCapacity;
        private byte[] bytes;
        private int index;
        private Node node;
        private int current;
        private int currentBits;
        private int symbolBits;

        DecoderProcessor(int initialCapacity) {
            this.initialCapacity = ObjectUtil.checkPositive(initialCapacity, "initialCapacity");
        }

        void reset() {
            node = ROOT;
            current = 0;
            currentBits = 0;
            symbolBits = 0;
            bytes = new byte[initialCapacity];
            index = 0;
        }

        /*
         * The idea here is to consume whole bytes at a time rather than individual bits. node
         * represents the Huffman tree, with all bit patterns denormalized as 256 children. Each
         * child represents the last 8 bits of the huffman code. The parents of each child each
         * represent the successive 8 bit chunks that lead up to the last most part. 8 bit bytes
         * from buf are used to traverse these tree until a terminal node is found.
         *
         * current is a bit buffer. The low order bits represent how much of the huffman code has
         * not been used to traverse the tree. Thus, the high order bits are just garbage.
         * currentBits represents how many of the low order bits of current are actually valid.
         * currentBits will vary between 0 and 15.
         *
         * symbolBits is the number of bits of the the symbol being decoded, *including* all those
         * of the parent nodes. symbolBits tells how far down the tree we are. For example, when
         * decoding the invalid sequence {0xff, 0xff}, currentBits will be 0, but symbolBits will be
         * 16. This is used to know if buf ended early (before consuming a whole symbol) or if
         * there is too much padding.
         */
        @Override
        public boolean process(byte value) throws Http2Exception {
            current = (current << 8) | (value & 0xFF);
            currentBits += 8;
            symbolBits += 8;
            // While there are unconsumed bits in current, keep consuming symbols.
            do {
                node = node.children[(current >>> (currentBits - 8)) & 0xFF];
                currentBits -= node.bits;
                if (node.isTerminal()) {
                    if (node.symbol == HpackUtil.HUFFMAN_EOS) {
                        throw EOS_DECODED;
                    }
                    append(node.symbol);
                    node = ROOT;
                    // Upon consuming a whole symbol, reset the symbol bits to the number of bits
                    // left over in the byte.
                    symbolBits = currentBits;
                }
            } while (currentBits >= 8);
            return true;
        }

        AsciiString end() throws Http2Exception {
            /*
             * We have consumed all the bytes in buf, but haven't consumed all the symbols. We may be on
             * a partial symbol, so consume until there is nothing left. This will loop at most 2 times.
             */
            while (currentBits > 0) {
                node = node.children[(current << (8 - currentBits)) & 0xFF];
                if (node.isTerminal() && node.bits <= currentBits) {
                    if (node.symbol == HpackUtil.HUFFMAN_EOS) {
                        throw EOS_DECODED;
                    }
                    currentBits -= node.bits;
                    append(node.symbol);
                    node = ROOT;
                    symbolBits = currentBits;
                } else {
                    break;
                }
            }

            // Section 5.2. String Literal Representation
            // A padding strictly longer than 7 bits MUST be treated as a decoding error.
            // Padding not corresponding to the most significant bits of the code
            // for the EOS symbol (0xFF) MUST be treated as a decoding error.
            int mask = (1 << symbolBits) - 1;
            if (symbolBits > 7 || (current & mask) != mask) {
                throw INVALID_PADDING;
            }

            return new AsciiString(bytes, 0, index, false);
        }

        private void append(int i) {
            if (bytes.length == index) {
                // Choose an expanding strategy depending on how big the buffer already is.
                // 1024 was choosen as a good guess and we may be able to investigate more if there are better choices.
                // See also https://github.com/netty/netty/issues/6846
                final int newLength = bytes.length >= 1024 ? bytes.length + initialCapacity : bytes.length << 1;
                byte[] newBytes = new byte[newLength];
                System.arraycopy(bytes, 0, newBytes, 0, bytes.length);
                bytes = newBytes;
            }
            bytes[index++] = (byte) i;
        }
    }
}


text:
// Copyright 2014 The Bazel Authors. All rights reserved.
//
// 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.google.devtools.build.lib.analysis.actions;

import com.google.common.base.Preconditions;
import com.google.common.collect.ImmutableSet;
import com.google.devtools.build.lib.actions.AbstractAction;
import com.google.devtools.build.lib.actions.ActionEnvironment;
import com.google.devtools.build.lib.actions.ActionExecutionContext;
import com.google.devtools.build.lib.actions.ActionExecutionException;
import com.google.devtools.build.lib.actions.ActionKeyContext;
import com.google.devtools.build.lib.actions.ActionOwner;
import com.google.devtools.build.lib.actions.ActionResult;
import com.google.devtools.build.lib.actions.Artifact;
import com.google.devtools.build.lib.analysis.Runfiles;
import com.google.devtools.build.lib.analysis.config.BuildConfiguration;
import com.google.devtools.build.lib.collect.nestedset.NestedSetBuilder;
import com.google.devtools.build.lib.collect.nestedset.Order;
import com.google.devtools.build.lib.concurrent.ThreadSafety.Immutable;
import com.google.devtools.build.lib.skyframe.serialization.autocodec.AutoCodec;
import com.google.devtools.build.lib.util.Fingerprint;
import com.google.devtools.build.lib.vfs.PathFragment;
import javax.annotation.Nullable;

/**
 * Action responsible for the symlink tree creation.
 * Used to generate runfiles and fileset symlink farms.
 */
@Immutable
@AutoCodec
public final class SymlinkTreeAction extends AbstractAction {

  private static final String GUID = "7a16371c-cd4a-494d-b622-963cd89f5212";

  @Nullable private final Artifact inputManifest;
  private final Runfiles runfiles;
  private final Artifact outputManifest;
  @Nullable private final String filesetRoot;
  private final boolean enableRunfiles;
  private final boolean inprocessSymlinkCreation;
  private final boolean skipRunfilesManifests;

  /**
   * Creates SymlinkTreeAction instance.
   *
   * @param owner action owner
   * @param config the action owners build configuration
   * @param inputManifest the input runfiles manifest
   * @param runfiles the input runfiles
   * @param outputManifest the generated symlink tree manifest (must have "MANIFEST" base name).
   *     Symlink tree root will be set to the artifact's parent directory.
   * @param filesetRoot non-null if this is a fileset symlink tree
   */
  public SymlinkTreeAction(
      ActionOwner owner,
      BuildConfiguration config,
      Artifact inputManifest,
      @Nullable Runfiles runfiles,
      Artifact outputManifest,
      String filesetRoot) {
    this(
        owner,
        inputManifest,
        runfiles,
        outputManifest,
        filesetRoot,
        config.getActionEnvironment(),
        config.runfilesEnabled(),
        config.inprocessSymlinkCreation(),
        config.skipRunfilesManifests());
  }

  /**
   * Creates SymlinkTreeAction instance. Prefer the constructor that takes a {@link
   * BuildConfiguration} instance; it is less likely to require changes in the future if we add more
   * command-line flags that affect this action.
   *
   * @param owner action owner
   * @param inputManifest the input runfiles manifest
   * @param runfiles the input runfiles
   * @param outputManifest the generated symlink tree manifest (must have "MANIFEST" base name).
   *     Symlink tree root will be set to the artifact's parent directory.
   * @param filesetRoot non-null if this is a fileset symlink tree,
   */
  @AutoCodec.Instantiator
  public SymlinkTreeAction(
      ActionOwner owner,
      Artifact inputManifest,
      @Nullable Runfiles runfiles,
      Artifact outputManifest,
      @Nullable String filesetRoot,
      ActionEnvironment env,
      boolean enableRunfiles,
      boolean inprocessSymlinkCreation,
      boolean skipRunfilesManifests) {
    super(
        owner,
        skipRunfilesManifests && enableRunfiles && (filesetRoot == null)
            ? NestedSetBuilder.emptySet(Order.STABLE_ORDER)
            : NestedSetBuilder.create(Order.STABLE_ORDER, inputManifest),
        ImmutableSet.of(outputManifest),
        env);
    Preconditions.checkArgument(outputManifest.getPath().getBaseName().equals("MANIFEST"));
    Preconditions.checkArgument(
        (runfiles == null) == (filesetRoot != null),
        "Runfiles must be null iff this is a fileset action");
    this.runfiles = runfiles;
    this.outputManifest = outputManifest;
    this.filesetRoot = filesetRoot;
    this.enableRunfiles = enableRunfiles;
    this.inprocessSymlinkCreation = inprocessSymlinkCreation;
    this.skipRunfilesManifests = skipRunfilesManifests && enableRunfiles && (filesetRoot == null);
    this.inputManifest = this.skipRunfilesManifests ? null : inputManifest;
  }

  public Artifact getInputManifest() {
    return inputManifest;
  }

  @Nullable
  public Runfiles getRunfiles() {
    return runfiles;
  }

  public Artifact getOutputManifest() {
    return outputManifest;
  }

  public boolean isFilesetTree() {
    return filesetRoot != null;
  }

  public PathFragment getFilesetRoot() {
    return PathFragment.create(filesetRoot);
  }

  public boolean isRunfilesEnabled() {
    return enableRunfiles;
  }

  public boolean inprocessSymlinkCreation() {
    return inprocessSymlinkCreation;
  }

  @Override
  public String getMnemonic() {
    return "SymlinkTree";
  }

  @Override
  protected String getRawProgressMessage() {
    return (isFilesetTree() ? "Creating Fileset tree " : "Creating runfiles tree ")
        + outputManifest.getExecPath().getParentDirectory().getPathString();
  }

  @Override
  protected void computeKey(
      ActionKeyContext actionKeyContext,
      @Nullable Artifact.ArtifactExpander artifactExpander,
      Fingerprint fp) {
    fp.addString(GUID);
    fp.addNullableString(filesetRoot);
    fp.addBoolean(enableRunfiles);
    fp.addBoolean(inprocessSymlinkCreation);
    fp.addBoolean(skipRunfilesManifests);
    env.addTo(fp);
    // We need to ensure that the fingerprints for two different instances of this action are
    // different. Consider the hypothetical scenario where we add a second runfiles object to this
    // class, which could also be null: the sequence
    //    if (r1 != null) r1.fingerprint(fp);
    //    if (r2 != null) r2.fingerprint(fp);
    // would *not* be safe; we'd get a collision between an action that has only r1 set, and another
    // that has only r2 set. Prefixing with a boolean indicating the presence of runfiles makes it
    // safe to add more fields in the future.
    fp.addBoolean(runfiles != null);
    if (runfiles != null) {
      runfiles.fingerprint(fp);
    }
  }

  @Override
  public ActionResult execute(ActionExecutionContext actionExecutionContext)
      throws ActionExecutionException, InterruptedException {
    actionExecutionContext
        .getContext(SymlinkTreeActionContext.class)
        .createSymlinks(this, actionExecutionContext);
    return ActionResult.EMPTY;
  }

  @Override
  public boolean mayInsensitivelyPropagateInputs() {
    return true;
  }
}


text:
/*
 *  Copyright (c) 2011, Michael Bedward. All rights reserved.
 *
 *  Redistribution and use in source and binary forms, with or without modification,
 *  are permitted provided that the following conditions are met:
 *
 *  - Redistributions of source code must retain the above copyright notice, this
 *    list of conditions and the following disclaimer.
 *
 *  - Redistributions in binary form must reproduce the above copyright notice, this
 *    list of conditions and the following disclaimer in the documentation and/or
 *    other materials provided with the distribution.
 *
 *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
 *  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
 *  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
 *  DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
 *  ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
 *  (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
 *  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
 *  ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 *  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
 *  SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */

package it.geosolutions.jaiext.jiffle.runtime;

import java.awt.Point;
import java.awt.geom.AffineTransform;
import java.awt.geom.Point2D;

/**
 * Wraps an AffineTransform object for use as a Jiffle {@link CoordinateTransform}.
 *
 * @author Michael Bedward
 * @since 0.1
 * @version $Id$
 */
public class AffineCoordinateTransform implements CoordinateTransform {
    private final AffineTransform affine;
    private Point2D p2D;

    /**
     * Creates a new instance to wrap the given {@code AffineTransform}. If
     * {@code tr} is {@code null} an identity transform will be used. The
     * input transform is copied.
     *
     * @param affine the transform
     */
    public AffineCoordinateTransform(AffineTransform affine) {
        this.affine = affine == null ? new AffineTransform() : new AffineTransform(affine);
        p2D = new Point2D.Double();
    }

    /**
     * {@inheritDoc}
     */
    public Point worldToImage(double x, double y, Point p) {
        p2D.setLocation(x, y);
        affine.transform(p2D, p2D);

        if (p != null) {
            p.x = (int) Math.round(p2D.getX());
            p.y = (int) Math.round(p2D.getY());
        } else {
            p = new Point((int) Math.round(p2D.getX()), (int) Math.round(p2D.getY()));
        }

        return p;
    }

}


text:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">

    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <meta name="viewport" content="target-densitydpi=device-dpi, width=device-width, user-scalable=yes"/>
    <title>Альфа-Банк</title>
    <link rel="stylesheet" href="css/all.css" type="text/css"/>

Сумма платежа

загрузка

        <form action="" method="post" id="bindingPaymentForm" class="data-form">

Код безопасности

                        Последние 3 цифры кода
на полосе для подписи.

                        <input inputmode="numeric" pattern="[0-9]*" maxlength="3" class="code" type="password" name="$CVC" id="cvc" maxlength="3" type="password" autocomplete="off" />

                        Показать код

                        Что это?

                <input class="submit-btn" value="Оплатить" type="button" id="sendPayment" title="Оплатить"/>

        </form>
        <form id="acs" method="post" action="">
            <input type="hidden" id="md" name="MD"/>
            <input type="hidden" id="paReq" name="PaReq"/>
            <input type="hidden" id="termUrl" name="TermUrl"/>
        </form>

Платеж безопасен


text:
<?php

namespace common\models;

use Yii;
use yii\base\Model;
use yii\data\ActiveDataProvider;
use common\models\Books;

/**
 * BooksSearch represents the model behind the search form about `common\models\Books`.
 */
class BooksSearch extends Books
{
    public $date_from;
    public $date_to;

    /**
     * @inheritdoc
     */
    public function rules()
    {
        return [
            [['id', 'author_id'], 'integer'],
            [['date_from', 'date_to'], 'date', 'format' => Yii::$app->params['dateFormat']],
            [['name', 'date', 'preview'], 'safe'],
        ];
    }

    /**
     * @inheritdoc
     */
    public function scenarios()
    {
        // bypass scenarios() implementation in the parent class
        return Model::scenarios();
    }

    /**
     * Creates data provider instance with search query applied
     *
     * @param array $params
     *
     * @return ActiveDataProvider
     */
    public function search($params)
    {
        $query = Books::find();

        $dataProvider = new ActiveDataProvider([
            'query' => $query,
        ]);

        $this->load($params);

        if (!$this->validate()) {
            // uncomment the following line if you do not want to return any records when validation fails
            // $query->where('0=1');
            return $dataProvider;
        }

        $query->andFilterWhere([
            'id' => $this->id,
            'date_create' => $this->date_create,
            'date_update' => $this->date_update,
            'date' => $this->date,
            'author_id' => $this->author_id,
        ]);
        // adding some extra filters for search purposes
        $query->andFilterWhere(['like', 'name', $this->name])
            ->andFilterWhere(['like', 'preview', $this->preview]);

        $query
            ->andFilterWhere(['>=', 'date', $this->date_from ? strtotime($this->date_from . ' 00:00:00') : null])
            ->andFilterWhere(['<=', 'date', $this->date_to ? strtotime($this->date_to . ' 23:59:59') : null]);

        return $dataProvider;
    }
}


text:
chmake - create a channel

# SYNOPSIS

**#include <libdill.h>**

**int chmake(size_t **_itemsz_**);**

# DESCRIPTION

Creates a channel. _itemsz_ is the byte size of the items to be sent through the channel.

A channel is a synchronization primitive, not a container. It doesn't store any items.

# RETURN VALUE

Returns a channel handle. In the case of an error, it returns -1 and sets _errno_ to one of the values below.

# ERRORS

* **ECANCELED**: Current coroutine is in the process of shutting down.
* **ENOMEM**: Not enough memory to allocate a new channel.

# EXAMPLE

```c
int ch = chmake(sizeof(int));
if(ch == -1) {
    perror("Cannot create channel");
    exit(1);
}
```


text:
//----------------------------------------------------------------
// <copyright company="Microsoft Corporation">
//     Copyright (c) Microsoft Corporation.  All rights reserved.
// </copyright>
//----------------------------------------------------------------

namespace System.Activities.Presentation.FreeFormEditing
{
    using System;
    using System.Activities.Presentation.Internal.PropertyEditing;
    using System.Activities.Presentation.Model;
    using System.Activities.Presentation.View;
    using System.Diagnostics.CodeAnalysis;
    using System.Globalization;
    using System.Runtime;
    using System.Windows;
    using System.Windows.Automation;
    using System.Windows.Automation.Peers;
    using System.Windows.Controls;
    using System.Windows.Documents;
    using System.Windows.Media;

    internal class Connector : UserControl
    {
        public const double ArrowShapeWidth = 5;

        public static readonly DependencyProperty PointsProperty = DependencyProperty.Register(
            "Points",
            typeof(PointCollection),
            typeof(Connector),
            new FrameworkPropertyMetadata(new PointCollection()));

        public static readonly DependencyProperty IsSelectedProperty = DependencyProperty.Register(
            "IsSelected",
            typeof(bool),
            typeof(Connector),
            new FrameworkPropertyMetadata(false));

        public static readonly DependencyProperty LabelTextProperty = DependencyProperty.Register(
            "LabelText",
            typeof(string),
            typeof(Connector),
            new FrameworkPropertyMetadata(null));

        public static readonly DependencyProperty HighlightOnHoverProperty = DependencyProperty.Register(
            "HighlightOnHover",
            typeof(bool),
            typeof(Connector),
            new FrameworkPropertyMetadata(false));

        public static readonly DependencyProperty IsHighlightedForAutoSplitProperty = DependencyProperty.Register(
            "IsHighlightedForAutoSplit",
            typeof(bool),
            typeof(Connector),
            new FrameworkPropertyMetadata(false));

        public static readonly DependencyProperty IdentityProperty = DependencyProperty.Register(
            "Identity",
            typeof(Guid),
            typeof(Connector));

        // Label will be shown only if there is one segment in the connector whose length is greater than this.
        internal const int MinConnectorSegmentLengthForLabel = 30;

        private DesignerConfigurationService designerConfigurationService = null;

        private FreeFormPanel panel = null;

        public Connector()
        {
            this.Loaded += (sender, e) =>
            {
                this.Identity = Guid.NewGuid();
            };
        }

        [SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly",
            Justification = "PointCollection is a special WPF class and got special Clone logic, the setter of this property is used several places.")]
        public PointCollection Points
        {
            get { return (PointCollection)GetValue(Connector.PointsProperty); }
            set { SetValue(Connector.PointsProperty, value); }
        }

        public bool IsSelected
        {
            get { return (bool)GetValue(Connector.IsSelectedProperty); }
            set { SetValue(Connector.IsSelectedProperty, value); }
        }

        public string LabelText
        {
            get { return (string)GetValue(Connector.LabelTextProperty); }
            set { SetValue(Connector.LabelTextProperty, value); }
        }

        public bool HighlightOnHover
        {
            get { return (bool)GetValue(Connector.HighlightOnHoverProperty); }
            set { SetValue(Connector.HighlightOnHoverProperty, value); }
        }

        public bool IsHighlightedForAutoSplit
        {
            get { return (bool)GetValue(Connector.IsHighlightedForAutoSplitProperty); }
            set { SetValue(Connector.IsHighlightedForAutoSplitProperty, value); }
        }

        public Guid Identity
        {
            get { return (Guid)GetValue(Connector.IdentityProperty); }
            set { SetValue(Connector.IdentityProperty, value); }
        }

        public UIElement SourceShape
        {
            get
            {
                ConnectionPoint sourceConnectionPoint = FreeFormPanel.GetSourceConnectionPoint(this);
                if (sourceConnectionPoint != null)
                {
                    return sourceConnectionPoint.ParentDesigner;
                }

                return null;
            }
        }

        public UIElement DestinationShape
        {
            get
            {
                ConnectionPoint destinationConnectionPoint = FreeFormPanel.GetDestinationConnectionPoint(this);
                if (destinationConnectionPoint != null)
                {
                    return destinationConnectionPoint.ParentDesigner;
                }

                return null;
            }
        }

        public IAutoSplitContainer AutoSplitContainer
        {
            get;
            set;
        }

        public virtual FrameworkElement StartDot
        {
            get
            {
                return null;
            }
        }

        private FreeFormPanel Panel
        {
            get
            {
                if (this.panel == null)
                {
                    this.panel = VisualTreeUtils.FindVisualAncestor<FreeFormPanel>(this);
                }

                return this.panel;
            }
        }

        private bool AutoSplitEnabled
        {
            get
            {
                if (this.designerConfigurationService == null)
                {
                    DesignerView view = VisualTreeUtils.FindVisualAncestor<DesignerView>(this);
                    if (view != null)
                    {
                        this.designerConfigurationService = view.Context.Services.GetService<DesignerConfigurationService>();
                        return this.designerConfigurationService.AutoSplitEnabled;
                    }
                    else
                    {
                        return false;
                    }
                }
                else
                {
                    return this.designerConfigurationService.AutoSplitEnabled;
                }
            }
        }

        public virtual void SetLabelToolTip(object toolTip)
        {
            // subclass should be able to override this method to provide ToolTip of connector
        }

        protected override AutomationPeer OnCreateAutomationPeer()
        {
            return new ConnectorAutomationPeer(this, base.OnCreateAutomationPeer());
        }

        protected override void OnDragEnter(DragEventArgs e)
        {
            if (this.AutoSplitEnabled && this.AutoSplitContainer != null && DragDropHelper.GetDraggedObjectCount(e) == 1 && this.AutoSplitContainer.CanAutoSplit(e))
            {
                this.HighlightForAutoSplit();
                this.Panel.RemoveAutoConnectAdorner();
                this.Panel.CurrentAutoSplitTarget = this;
            }

            base.OnDragEnter(e);
        }

        protected override void OnDragLeave(DragEventArgs e)
        {
            if (this.IsHighlightedForAutoSplit)
            {
                this.DehighlightForAutoSplit();
                this.Panel.CurrentAutoSplitTarget = null;
            }

            base.OnDragLeave(e);
        }

        protected override void OnDrop(DragEventArgs e)
        {
            if (this.AutoSplitEnabled && this.IsHighlightedForAutoSplit)
            {
                try
                {
                    this.AutoSplitContainer.DoAutoSplit(e, this);
                }
                finally
                {
                    this.DehighlightForAutoSplit();
                    this.Panel.CurrentAutoSplitTarget = null;
                    e.Handled = true;
                }
            }

            base.OnDrop(e);
        }

        private void AddAutoSplitAdorner(UIElement shape)
        {
            AdornerLayer adornerLayer = AdornerLayer.GetAdornerLayer(shape);
            Fx.Assert(adornerLayer != null, "AdornerLayer should not be null.");
            adornerLayer.Add(new AutoSplitAdorner(shape));
        }

        private void RemoveAutoSplitAdorner(UIElement shape)
        {
            AdornerLayer adornerLayer = AdornerLayer.GetAdornerLayer(shape);
            Fx.Assert(adornerLayer != null, "AdornerLayer should not be null.");
            Adorner[] adorners = adornerLayer.GetAdorners(shape);
            foreach (Adorner adorner in adorners)
            {
                if (adorner is AutoSplitAdorner)
                {
                    adornerLayer.Remove(adorner);
                    return;
                }
            }
        }

        private void HighlightForAutoSplit()
        {
            this.IsHighlightedForAutoSplit = true;
            this.AddAutoSplitAdorner(this.SourceShape);
            this.AddAutoSplitAdorner(this.DestinationShape);
        }

        private void DehighlightForAutoSplit()
        {
            this.IsHighlightedForAutoSplit = false;
            this.RemoveAutoSplitAdorner(this.SourceShape);
            this.RemoveAutoSplitAdorner(this.DestinationShape);
        }

        private class ConnectorAutomationPeer : UIElementAutomationPeer
        {
            private AutomationPeer wrappedAutomationPeer;

            public ConnectorAutomationPeer(FrameworkElement owner, AutomationPeer wrappedAutomationPeer)
                : base(owner)
            {
                this.wrappedAutomationPeer = wrappedAutomationPeer;
            }

            protected override string GetItemStatusCore()
            {
                UIElement sourceDesigner = VirtualizedContainerService.TryGetVirtualizedElement(FreeFormPanel.GetSourceConnectionPoint(this.Owner).ParentDesigner);
                string sourceId = sourceDesigner.GetValue(AutomationProperties.ItemStatusProperty) as string;
                UIElement destinationDesigner = VirtualizedContainerService.TryGetVirtualizedElement(FreeFormPanel.GetDestinationConnectionPoint(this.Owner).ParentDesigner);
                string destinationId = destinationDesigner.GetValue(AutomationProperties.ItemStatusProperty) as string;
                return string.Format(CultureInfo.InvariantCulture, "Source={0} Destination={1} Points={2}", sourceId, destinationId, ((Connector)this.Owner).Points);
            }

            protected override string GetClassNameCore()
            {
                return this.wrappedAutomationPeer.GetClassName();
            }

            protected override string GetNameCore()
            {
                return this.wrappedAutomationPeer.GetName();
            }

            protected override string GetAutomationIdCore()
            {
                return this.wrappedAutomationPeer.GetAutomationId();
            }
        }
    }
}


text:
Bug fix: making a feature-update request that fails strict params checks now returns a sensible error instead of throwing an exception

Improvement: better failed-to-update error messages

Support Matrix changes: add Rails 5.0, drop Rails 3.2, add Ruby 2.1.7, add Ruby 2.2.3, drop Ruby 1.9.3

## v2.1.0

Bug fix: `Arturo::SpecialHandling` always compares symbols as strings

Improvmement: Rails 4.2 compatibility

Improvement: relax minitest version constraints

Improvement: add `set_feature!` method to complement `enable_feature!`and `disable_feature!`

## v2.0.0

Bug fix: add missing require to initializer.

Improvement: Remove support for `[feature]_enabled_for?` methods.

Improvement: Use more specific gem versions for development dependencies.

## v1.11.0

Depreaction: `[feature]_enabled_for?` methods

Bug fix: `Arturo.respond_to?` takes an optional second argument, per
`Object.respond_to?`'s signature.

Improvement: support Rails 4.1.

Improvement: use Travis's multiple builds instead of Appraisal.

## v1.10.0

Improvement: Arturo no longer declares a hard runtime dependency on Rails, but
instead only on ActiveRecord. This makes it possible to use `Arturo::Feature`
in non-Rails settings. Feature *management* is still expressed as a Rails engine
and requires `actionpack` and other parts of Rails.

## v1.9.0

Improvement: `Arturo::Feature` is defined in `lib/arturo/feature.rb` instead of
`app/models/arturo/feature.rb`, which means consuming applications can load it
without loading the whole engine.

Improvement: `Arturo::Engine` no longer eagerly loads all engine files; instead,
it uses Rails's `autoload_paths` to ensure classes are loaded as necessary.

Bug fix: the route to `arturo/features_controller#update_all` is now called
`features_update_all`; it had been called simply `features`, which caused
conflict problems in Rails 4.0.

## v1.8.0

Improvement: "All" caching strategy is now smarter about its use of the
`update_at` attribute. It handles the case when a Feature's `updated_at` is
`nil` and queries the database less often to figure out whether any features
have changed.

Bug fix: the engine's `source_root` relied on its `root_path`, which is not
available on all versions of Rails.

## v1.7.0

`Arturo::FeaturesHelper#error_messages_for` has been removed. This only affects
people who have written their own feature-management pages that use this helper.

## v1.6.1

`Arturo::FeaturesHelper#error_messages_for` has been deprecated in favor of
`error_messages_for_feature` because it conflicts with a Rails and DynamicForm
method. It will be removed in v1.7.0. This only affects people who have written
their own feature-management pages that use this helper.

## v1.6.0

Formerly, whitelists and blacklists had to be *feature-specific*:

    Arturo::Feature.whitelist(:foo) do |recipient|
      recipient.plan.has_foo?
    end

Now whitelists and blacklists can be global. The block takes the feature
as the first argument:

    Arturo::Feature.whitelist do |feature, recipient|
      recipient.plan.has?(feature.to_sym)
    end

## v1.5.3

Set `signing_key` in gemspec only if the file exists.

The `FeaturesController` docs erroneously said to override `#permitted?`.
The correct method name is `may_manage_features?`.

## v1.5.2

The gem is now signed. The public key is
[gem-public_cert.pem](./gem-public_cert.pem).

## v1.5.1

Use just ActiveRecord, not all of Rails, when defining different behavior
for different versions.

Unify interface of `Feature` and `NoSuchFeature` so the latter fulfills the
null-object pattern.

## v1.5.0

This project is now licensed under the
[APLv2](https://www.apache.org/licenses/LICENSE-2.0.html).

Arturo now works on Rails 3.0 and Rails 4.0. Helpers are no longer mixed into
the global view, but are under the `arturo_engine` namespace, as is the
convention in Rails 3.1+.

The feature cache will return `NoSuchFeature` for cache misses instead of `nil`,
which clients can treat like a `Feature` that is always off.

Better error messages when managing features, and the addition of the
`arturo_flash_messages` helper method.

Add `Feature.last_updated_at` to get the most recent `updated_at` among all
`Feature`s.

## v1.3.0

Add `Arturo::Middleware`, which passes requests down the stack if an only if
a particular feature is available.

`TestSupport` methods use `Feature.to_feature`.

## v 1.1.0 - cleanup

 * changed `require_feature!` to `require_feature`
 * replaced `Arturo.permit_management` and `Arturo.feature_recipient`
   blocks with instance methods
   `Arturo::FeatureManagement.may_manage_features?` and
   `Arturo::FeatureAvailability.feature_recipient`

## v 1.0.0 - Initial Release

 * `require_feature!` controller filter
 * `if_feature_enabled` controller and view method
 * `feature_enabled?` controller and view method
 * CRUD for features
 * `Arturo.permit_management` to configure management permission
 * `Arturo.feature_recipient` to configure on what basis features are deployed
 * whitelists and blacklists


text:
from __future__ import unicode_literals

from django.apps import AppConfig

class DwitterAppConfig(AppConfig):
    name = 'dwitter_app'


text:
'use strict';

/**
 * This file should only generate one failure per spec despite the fact that
 * Mocha is capable of detecting two distinct exceptions during test execution.
 */

it('fails exactly once when a global error is thrown first', function(done) {
  setTimeout(function() {
    throw new Error('global error');

    setTimeout(function() {
      done(new Error('test error'));
    }, 0);
  }, 0);
});

it('fails exactly once when a global error is thrown second', function(done) {
  setTimeout(function() {
    done(new Error('test error'));
  }, 0);

  setTimeout(function() {
    throw new Error('global error');
  }, 0);
});


text:
package com.intellij.openapi.vfs.impl;

import com.intellij.openapi.Disposable;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.openapi.vfs.pointers.VirtualFilePointer;
import com.intellij.openapi.vfs.pointers.VirtualFilePointerListener;
import org.jetbrains.annotations.NotNull;

import java.util.Map;

class IdentityVirtualFilePointer extends VirtualFilePointerImpl implements VirtualFilePointer, Disposable {
  private final Map<String, IdentityVirtualFilePointer> myUrlToIdentity;
  private final VirtualFilePointerManagerImpl myVirtualFilePointerManager;
  private final VirtualFile myFile;
  private final String myUrl;

  IdentityVirtualFilePointer(VirtualFile file, @NotNull String url, Map<String, IdentityVirtualFilePointer> urlToIdentity,
                             @NotNull VirtualFilePointerManagerImpl virtualFilePointerManager,
                             VirtualFilePointerListener listener) {
    super(listener);
    myVirtualFilePointerManager = virtualFilePointerManager;
    myUrlToIdentity = urlToIdentity;
    myFile = file;
    myUrl = url;
  }

  @Override
  @NotNull
  public String getFileName() {
    return getUrl();
  }

  @Override
  public VirtualFile getFile() {
    return isValid() ? myFile : null;
  }

  @Override
  @NotNull
  public String getUrl() {
    return myUrl;
  }

  @Override
  @NotNull
  public String getPresentableUrl() {
    return getUrl();
  }

  @Override
  public boolean isValid() {
    return myFile == null || myFile.isValid();
  }

  @Override
  public void dispose() {
    synchronized (myVirtualFilePointerManager) {
      incrementUsageCount(-1);
      myUrlToIdentity.remove(myUrl);
    }
  }

  @Override
  public String toString() {
    return "identity: url='" + myUrl + "'; file=" + myFile;
  }
}


text:
.class Lcom/android/server/location/LocationFudger$1;
.super Landroid/database/ContentObserver;
.source "LocationFudger.java"

# annotations
.annotation system Ldalvik/annotation/EnclosingMethod;
    value = Lcom/android/server/location/LocationFudger;-><init>(Landroid/content/Context;Landroid/os/Handler;)V
.end annotation

.annotation system Ldalvik/annotation/InnerClass;
    accessFlags = 0x0
    name = null
.end annotation

# instance fields
.field final synthetic this$0:Lcom/android/server/location/LocationFudger;

# direct methods
.method constructor <init>(Lcom/android/server/location/LocationFudger;Landroid/os/Handler;)V
    .locals 0
    .parameter
    .parameter "x0"

    .prologue
    .line 147
    iput-object p1, p0, Lcom/android/server/location/LocationFudger$1;->this$0:Lcom/android/server/location/LocationFudger;

    invoke-direct {p0, p2}, Landroid/database/ContentObserver;-><init>(Landroid/os/Handler;)V

    return-void
.end method

# virtual methods
.method public onChange(Z)V
    .locals 2
    .parameter "selfChange"

    .prologue
    .line 150
    iget-object v0, p0, Lcom/android/server/location/LocationFudger$1;->this$0:Lcom/android/server/location/LocationFudger;

    iget-object v1, p0, Lcom/android/server/location/LocationFudger$1;->this$0:Lcom/android/server/location/LocationFudger;

    #calls: Lcom/android/server/location/LocationFudger;->loadCoarseAccuracy()F
    invoke-static {v1}, Lcom/android/server/location/LocationFudger;->access$000(Lcom/android/server/location/LocationFudger;)F

    move-result v1

    #calls: Lcom/android/server/location/LocationFudger;->setAccuracyInMeters(F)V
    invoke-static {v0, v1}, Lcom/android/server/location/LocationFudger;->access$100(Lcom/android/server/location/LocationFudger;F)V

    .line 151
    return-void
.end method


text:
Troubleshoot Telemetry
~~~~~~~~~~~~~~~~~~~~~~

Logging in Telemetry
--------------------

The Telemetry service has similar log settings as the other OpenStack
services. Multiple options are available to change the target of
logging, the format of the log entries and the log levels.

The log settings can be changed in ``ceilometer.conf``. The list of
configuration options are listed in the logging configuration options
table in the `Telemetry
section <http://docs.openstack.org/mitaka/config-reference/telemetry.html>`__
in the OpenStack Configuration Reference.

By default ``stderr`` is used as standard output for the log messages.
It can be changed to either a log file or syslog. The ``debug`` and
``verbose`` options are also set to false in the default settings, the
default log levels of the corresponding modules can be found in the
table referred above.

Recommended order of starting services
--------------------------------------

As it can be seen in `Bug
1355809 <https://bugs.launchpad.net/devstack/+bug/1355809>`__, the wrong
ordering of service startup can result in data loss.

When the services are started for the first time or in line with the
message queue service restart, it takes time while the
``ceilometer-collector`` service establishes the connection and joins or
rejoins to the configured exchanges. Therefore, if the
``ceilometer-agent-compute``, ``ceilometer-agent-central``, and the
``ceilometer-agent-notification`` services are started before
the ``ceilometer-collector`` service, the ``ceilometer-collector`` service
may lose some messages while connecting to the message queue service.

The possibility of this issue to happen is higher, when the polling
interval is set to a relatively short period. In order to avoid this
situation, the recommended order of service startup is to start or
restart the ``ceilometer-collector`` service after the message queue. All
the other Telemetry services should be started or restarted after and
the ``ceilometer-agent-compute`` should be the last in the sequence, as this
component emits metering messages in order to send the samples to the
collector.

Notification agent
------------------

In the Icehouse release of OpenStack a new service was introduced to be
responsible for consuming notifications that are coming from other
OpenStack services.

If the ``ceilometer-agent-notification`` service is not installed and
started, samples originating from notifications will not be generated.
In case of the lack of notification based samples, the state of this
service and the log file of Telemetry should be checked first.

For the list of meters that are originated from notifications, see the
`Telemetry Measurements
Reference <http://docs.openstack.org/developer/ceilometer/measurements.html>`__.

Recommended ``auth_url`` to be used
-----------------------------------

When using the Telemetry command-line client, the credentials and the
``os_auth_url`` have to be set in order for the client to authenticate
against OpenStack Identity. For further details
about the credentials that have to be provided see the `Telemetry Python
API <http://docs.openstack.org/developer/python-ceilometerclient/>`__.

The service catalog provided by OpenStack Identity contains the
URLs that are available for authentication. The URLs have
different ``port``\s, based on whether the type of the given URL is
``public``, ``internal`` or ``admin``.

OpenStack Identity is about to change API version from v2 to v3. The
``adminURL`` endpoint (which is available via the port: ``35357``)
supports only the v3 version, while the other two supports both.

The Telemetry command line client is not adapted to the v3 version of
the OpenStack Identity API. If the ``adminURL`` is used as
``os_auth_url``, the :command:`ceilometer` command results in the following
error message:

.. code-block:: console

   $ ceilometer meter-list
     Unable to determine the Keystone version to authenticate with \
     using the given auth_url: http://10.0.2.15:35357/v2.0

Therefore when specifying the ``os_auth_url`` parameter on the command
line or by using environment variable, use the ``internalURL`` or
``publicURL``.

For more details check the bug report `Bug
1351841 <https://bugs.launchpad.net/python-ceilometerclient/+bug/1351841>`__.

.. TODO (karenb) The content in this file needs updating.


text:
<?xml version="1.0" encoding="utf-8"?>
<resources>
    <!-- From: file:/Users/tand6053/Documents/workspace/AdMobBanner1/app/build/intermediates/exploded-aar/com.android.support/appcompat-v7/23.0.1/res/values-w360dp/values-w360dp.xml -->
    <eat-comment/>
    <integer name="abc_max_action_buttons">3</integer>
</resources>


text:
package io.motown.domain.api.chargingstation;

public enum AuthorizationListUpdateType {
    FULL,
    DIFFERENTIAL
}


text:
var FieldBoolean=NFView.extend({
    _name: "field_boolean",
    className: "form-group nf-field",
    events: {
        "change input": "onchange",
        "click input": "click",
        "blur select": "blur",
        "change select": "onchange_select",
        "focus input": "on_focus",
        "keydown input": "keydown"
    },

    initialize: function(options) {
        var that=this;
        NFView.prototype.initialize.call(this,options);
        var name=this.options.name;
        var model=this.context.model;
        model.on("change:"+name,function() {
            log("field_boolean.rerender");
            that.render();
        },this);
        this.listen_attrs();
    },

    render: function() {
        //log("field_boolean render",this.options.name,this);
        var name=this.options.name;
        var model=this.context.model;
        this.data.value=model.get(name);
        var field=model.get_field(name);
        this.data.string=field.string;
        var readonly=field.readonly||this.options.readonly||this.context.readonly;
        var form_layout=this.options.form_layout||"stacked";
        this.data.horizontal=form_layout=="horizontal";
        NFView.prototype.render.call(this);
        var attrs=this.eval_attrs();
        if (readonly) {
            this.$el.find("input").attr("disabled","disabled");
        }
        if (this.options.invisible || attrs.invisible) {
            this.$el.hide();
        } else {
            this.$el.show();
        }
        if (this.options.span) {
            this.$el.addClass("col-sm-"+this.options.span);
        }
        if (this.options.offset) {
            this.$el.addClass("offset"+this.options.offset);
        }
        if (this.options.width) {
            this.$el.find("select").width(this.options.width);
            this.$el.width(this.options.width);
        }
        if (this.options.nomargin) {
            this.$el.find("input").css({margin:"0"});
            this.$el.css({margin:"0"});
        }
    },

    click: function(e) {
        e.stopPropagation();
    },

    onchange: function() {
        log("field_boolean.onchange",this);
        var val=this.$el.find("input").is(":checked");
        var name=this.options.name;
        var model=this.context.model;
        log("val",val);
        model.set(name,val);
        this.$el.find("input").focus();
        if (this.options.onchange) {
            var path=model.get_path(name);
            var form=this.context.form;
            form.do_onchange(this.options.onchange,path);
        }
    },

    onchange_select: function() {
        var val=this.$el.find("select").val();
        if (val=="1") val=true;
        else if (val=="0") val=false;
        else val=null;
        var name=this.options.name;
        var model=this.context.model;
        model.set(name,val);
        if (this.options.onchange) {
            var path=model.get_path(name);
            var form=this.context.form;
            form.do_onchange(this.options.onchange,path);
        }
    },

    focus: function() {
        this.$el.find("select").focus();
    },

    blur: function() {
        log("XXX boolean blur");
        this.trigger("blur");
    },

    on_focus: function(e) {
        $(e.target).select();
        register_focus(e.target);
    },

    keydown: function (e) {
        if (e.keyCode==13 && this.options.submit_form) return;
        if (e.keyCode==9||e.keyCode==13) {
            e.preventDefault();
            if (e.shiftKey) {
                this.trigger("focus_prev");
                if (!this.options.disable_focus_change) {
                    focus_prev();
                }
            } else {
                this.trigger("focus_next");
                if (!this.options.disable_focus_change) {
                    focus_next();
                }
            }
        } else if (e.keyCode==40) {
            this.trigger("focus_down");
        } else if (e.keyCode==38) {
            this.trigger("focus_up");
        }
    },

    eval_attrs: function() {
        var str=this.options.attrs;
        //log("eval_attrs",this,str);
        if (!str) return {};
        var expr=JSON.parse(str);
        var model=this.context.model;
        var attrs={};
        for (var attr in expr) {
            var conds=expr[attr];
            var attr_val=true;
            for (var i in conds) {
                var clause=conds[i];
                var n=clause[0];
                var op=clause[1];
                var cons=clause[2];
                var v=model.get(n);
                var clause_v;
                if (op=="=") {
                    clause_v=v==cons;
                } else if (op=="!=") {
                    clause_v=v!=cons;
                } else if (op=="in") {
                    clause_v=_.contains(cons,v);
                } else {
                    throw "Invalid operator: "+op;
                }
                if (!clause_v) {
                    attr_val=false;
                    break;
                }
            }
            attrs[attr]=attr_val;
        }
        //log("==>",attrs);
        return attrs;
    },

    listen_attrs: function() {
        var str=this.options.attrs;
        //log("listen_attrs",this,str);
        if (!str) return;
        var expr=JSON.parse(str);
        var attrs={};
        var depends=[];
        for (var attr in expr) {
            var conds=expr[attr];
            for (var i in conds) {
                var clause=conds[i];
                var n=clause[0];
                depends.push(n);
            }
        }
        //log("==> depends",depends);
        var model=this.context.model;
        for (var i in depends) {
            var n=depends[i];
            //log("...listen "+n);
            model.on("change:"+n,this.render,this);
        }
    }
});

FieldBoolean.register();


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

namespace Miracle.FileZilla.Api
{
    /// <summary>
    /// Class representing a FileZilla group
    /// </summary>
    public class Group : IBinarySerializable
    {
        /// <summary>
        /// Group name. On Users, this is a reference to an existing group name
        /// </summary>
        public string GroupName { get; set; }
        /// <summary>
        /// Connection limit per IP. 0=no limit
        /// </summary>
        public int IpLimit { get; set; }
        /// <summary>
        /// Connection limit per group/user. 0=no limit
        /// </summary>
        public int UserLimit { get; set; }
        /// <summary>
        /// Bypass userlimit on server
        /// </summary>
        public TriState BypassUserLimit
        {
            get { return _bypassUserLimit; }
            set
            {
                if(value == TriState.Default && GetType() == typeof(Group))
                    throw new ApiException("Groups are not allowed to use TriState." + TriState.Default);
                _bypassUserLimit = value;
            }
        }
        private TriState _bypassUserLimit;
        /// <summary>
        /// Is user/group enabled
        /// </summary>
        public TriState Enabled
        {
            get { return _enabled; }
            set
            {
                if (value == TriState.Default && GetType() == typeof(Group))
                    throw new ApiException("Groups are not allowed to use TriState." + TriState.Default);
                _enabled = value;
            }
        }
        private TriState _enabled;
        /// <summary>
        /// List of disallowed IP's (IP Filter)
        /// </summary>
        public List<string> DisallowedIPs { get; set; }
        /// <summary>
        /// List of allowed IP's (IP Filter)
        /// </summary>
        public List<string> AllowedIPs { get; set; }
        /// <summary>
        /// Use 8+3 filenames? This property is'nt available in the admin interface.
        /// Better leave it alone... Removed in later versions
        /// </summary>
        protected bool EightPlusThree { get; set; }
        /// <summary>
        /// List of permissions
        /// </summary>
        public List<SharedFolder> SharedFolders { get; set; }
        /// <summary>
        /// Download speed limit
        /// </summary>
        public SpeedLimit DownloadSpeedLimit { get; set; }
        /// <summary>
        /// Upload speed limit
        /// </summary>
        public SpeedLimit UploadSpeedLimit { get; set; }
        /// <summary>
        /// Comment for user/group
        /// </summary>
        public string Comment { get; set; }
        /// <summary>
        /// Force the use of SSL
        /// </summary>
        public TriState ForceSsl { get; set; }

        /// <summary>
        /// Default constructor (sets defaults as in FileZilla server interface)
        /// </summary>
        public Group()
        {
            BypassUserLimit = TriState.No;
            Enabled = TriState.Yes;
            DisallowedIPs = new List<string>();
            AllowedIPs = new List<string>();
            SharedFolders = new List<SharedFolder>();
            DownloadSpeedLimit = new SpeedLimit(GetType() == typeof(Group));
            UploadSpeedLimit = new SpeedLimit(GetType() == typeof(Group));
	        ForceSsl = TriState.Default;
        }

        /// <summary>
        /// Deserialise FileZilla binary data into object
        /// </summary>
        /// <param name="reader">Binary reader to read data from</param>
        /// <param name="protocolVersion">Current FileZilla protocol version</param>
        /// <param name="index">The 0 based index of this item in relation to any parent list</param>
        public virtual void Deserialize(BinaryReader reader, int protocolVersion, int index)
        {
            GroupName = reader.ReadText();
            IpLimit = reader.ReadInt32();
            UserLimit = reader.ReadInt32();
            var options = reader.ReadByte();
            BypassUserLimit = (TriState)(options & 0x3);
            Enabled = (TriState)((options >> 2) & 0x3);
            DisallowedIPs = reader.ReadTextList();
            AllowedIPs = reader.ReadTextList();
            if (protocolVersion < ProtocolVersions.Sha512)
            {
                EightPlusThree = reader.ReadBoolean();
            }
            SharedFolders = reader.ReadList16<SharedFolder>(protocolVersion);
            DownloadSpeedLimit = reader.Read<SpeedLimit>(protocolVersion);
            UploadSpeedLimit = reader.Read<SpeedLimit>(protocolVersion);
            Comment = reader.ReadText();
	        var forceSsl = reader.ReadByte();
			ForceSsl = (TriState)(forceSsl & 0x3);
        }

        /// <summary>
        /// Serialise object into FileZilla binary data
        /// </summary>
        /// <param name="writer">Binary writer to write data to</param>
        /// <param name="protocolVersion">Current FileZilla protocol version</param>
        /// <param name="index">The 0 based index of this item in relation to any parent list</param>
        public virtual void Serialize(BinaryWriter writer, int protocolVersion, int index)
        {
            // Switch user Enabled 'Default' to 'Yes' when not assigned a group.
            if (Enabled == TriState.Default && GetType() == typeof(User) && string.IsNullOrEmpty(GroupName))
                Enabled=TriState.Yes;

            writer.WriteText(GroupName);
            writer.Write(IpLimit);
            writer.Write(UserLimit);
            byte options = (byte)(((byte)BypassUserLimit & 0x3) | ((byte)Enabled << 2));
            writer.Write(options);
            writer.WriteTextList(DisallowedIPs);
            writer.WriteTextList(AllowedIPs);
            if (protocolVersion < ProtocolVersions.Sha512)
            {
                writer.Write(EightPlusThree);
            }
            writer.WriteList16(SharedFolders, protocolVersion);
            writer.Write(DownloadSpeedLimit, protocolVersion);
            writer.Write(UploadSpeedLimit, protocolVersion);
            writer.WriteText(Comment);
            writer.Write((byte)ForceSsl);
        }
    }
}


text:
import React from 'react';
import Enzyme, { shallow } from 'enzyme';
import Adapter from '@wojtekmaj/enzyme-adapter-react-17';
import ToggleRefinement from '../ToggleRefinement';

Enzyme.configure({ adapter: new Adapter() });

describe('ToggleRefinement', () => {
  const defaultProps = {
    currentRefinement: true,
    label: 'toggle the refinement',
    canRefine: true,
    refine: () => {},
  };

  it('expect to render with a positive currentRefinement', () => {
    const props = {
      ...defaultProps,
    };

    const wrapper = shallow(<ToggleRefinement {...props} />);

    expect(wrapper).toMatchSnapshot();
  });

  it('expect to render with a negative currentRefinement', () => {
    const props = {
      ...defaultProps,
      currentRefinement: false,
    };

    const wrapper = shallow(<ToggleRefinement {...props} />);

    expect(wrapper).toMatchSnapshot();
  });

  it('expect to render with a negative canRefine', () => {
    const props = {
      ...defaultProps,
      canRefine: false,
    };

    const wrapper = shallow(<ToggleRefinement {...props} />);

    expect(wrapper).toMatchSnapshot();
  });

  it('expect to render with custom className', () => {
    const props = {
      ...defaultProps,
      className: 'MyCustomToggleRefinement',
    };

    const wrapper = shallow(<ToggleRefinement {...props} />);

    expect(wrapper).toMatchSnapshot();
  });

  it('expect to call refine onChange', () => {
    const props = {
      ...defaultProps,
      refine: jest.fn(),
    };

    const wrapper = shallow(<ToggleRefinement {...props} />);

    expect(props.refine).not.toHaveBeenCalled();

    wrapper.find('input[type="checkbox"]').simulate('change', {
      target: {
        checked: false,
      },
    });

    expect(props.refine).toHaveBeenCalledWith(false);
  });
});


text:
require "concurrent"
require "google/cloud/errors"

module Google
  module Cloud
    module ErrorReporting
      ##
      # # AsyncErrorReporterError
      #
      # @private Used to indicate a problem reporting errors asynchronously.
      # This can occur when there are not enough resources allocated for the
      # amount of usage.
      #
      class AsyncErrorReporterError < Google::Cloud::Error
        # @!attribute [r] error_event
        #   @return [Array<Google::Cloud::ErrorReporting::ErrorEvent>] The
        #   individual error event that was not reported to Error
        #   Reporting service.
        attr_reader :error_event

        def initialize message, error_event = nil
          super message
          @error_event = error_event
        end
      end

      ##
      # # ErrorReporterError
      #
      # @private Used to indicate a problem reporting errors. This can occur
      # when the calling the API returns an error.
      #
      class ErrorReporterError < Google::Cloud::Error
        # @!attribute [r] error_event
        #   @return [Array<Google::Cloud::ErrorReporting::ErrorEvent>] The
        #   individual error event that was not reported to Error
        #   Reporting service.
        attr_reader :error_event

        def initialize message, error_event = nil
          super message
          @error_event = error_event
        end
      end

      ##
      # # AsyncErrorReporter
      #
      # @private Used by {Google::Cloud::ErrorReporting} and
      # {Google::Cloud::ErrorReporting::Middleware} to asynchronously submit
      # error events to Error Reporting service when used in
      # Ruby applications.
      class AsyncErrorReporter
        ##
        # @private Implementation accessors
        attr_reader :error_reporting, :max_queue, :threads, :thread_pool

        ##
        # @private Creates a new AsyncErrorReporter instance.
        def initialize error_reporting, max_queue: 1000, threads: 10
          @error_reporting = error_reporting

          @max_queue = max_queue
          @threads   = threads

          @thread_pool = Concurrent::ThreadPoolExecutor.new \
            max_threads: @threads, max_queue: @max_queue

          @error_callbacks = []

          # Make sure all queued calls are completed when process exits.
          at_exit { stop! }
        end

        ##
        # Add the error event to the queue. This will raise if there are no
        # resources available to make the API call.
        def report error_event
          Concurrent::Promises.future_on @thread_pool, error_event do |error|
            report_sync error
          end
        rescue Concurrent::RejectedExecutionError => e
          raise AsyncErrorReporterError,
                "Error reporting error_event asynchronously: #{e.message}",
                error_event
        end

        ##
        # Begins the process of stopping the reporter. ErrorEvents already
        # in the queue will be published, but no new ErrorEvent can be added.
        # Use {#wait!} to block until the reporter is fully stopped and all
        # pending error_events have been pushed to the API.
        #
        # @return [AsyncErrorReporter] returns self so calls can be chained.
        def stop
          @thread_pool&.shutdown

          self
        end

        ##
        # Stop this asynchronous reporter and block until it has been stopped.
        #
        # @param [Number] timeout Timeout in seconds.
        #
        def stop! timeout = nil
          stop
          wait! timeout
        end

        ##
        # Blocks until the reporter is fully stopped, all pending error_events
        # have been published, and all callbacks have completed. Does not stop
        # the reporter. To stop the reporter, first call {#stop} and then call
        # {#wait!} to block until the reporter is stopped.
        #
        # @return [AsyncErrorReporter] returns self so calls can be chained.
        def wait! timeout = nil
          if @thread_pool
            @thread_pool.shutdown
            @thread_pool.wait_for_termination timeout
          end

          self
        end

        ##
        # Whether the reporter has been started.
        #
        # @return [boolean] `true` when started, `false` otherwise.
        #
        def started?
          @thread_pool&.running?
        end

        ##
        # Whether the reporter has been stopped.
        #
        # @return [boolean] `true` when stopped, `false` otherwise.
        #
        def stopped?
          !started?
        end

        ##
        # Register to be notified of errors when raised.
        #
        # If an unhandled error has occurred the reporter will attempt to
        # recover from the error and resume reporting error_events.
        #
        # Multiple error handlers can be added.
        #
        # @yield [callback] The block to be called when an error is raised.
        # @yieldparam [Exception] error The error raised.
        #
        def on_error &block
          @error_callbacks << block
        end

        protected

        # Calls all error callbacks.
        def error! error
          error_callbacks = @error_callbacks
          error_callbacks = default_error_callbacks if error_callbacks.empty?
          error_callbacks.each { |error_callback| error_callback.call error }
        end

        def default_error_callbacks
          # This is memoized to reduce calls to the configuration.
          @default_error_callbacks ||= begin
            error_cb = Google::Cloud::ErrorReporting.configure.on_error
            error_cb ||= Google::Cloud.configure.on_error
            if error_cb
              [error_cb]
            else
              []
            end
          end
        end

        def report_sync error_event
          error_reporting.report error_event
        rescue StandardError => e
          sync_error = ErrorReporterError.new(
            "Error reporting error_event: #{e.message}",
            error_event
          )
          # Manually set backtrace so we don't have to raise
          sync_error.set_backtrace caller
          error! sync_error
        end
      end
    end
  end
end