text:
/**
 * Internal utility class that provides default configuration for cell editing.
 * @private
 */
Ext.define('Ext.grid.CellEditor', {
    extend: 'Ext.Editor',

    // Editor must appear at the top so that it does not contribute to scrollbars
    y: 0,

    constructor: function(config) {
        config = Ext.apply({}, config);

        if (config.field) {
            config.field.monitorTab = false;
        }
        this.callParent([config]);
    },

    // Set the grid that owns this editor.
    // Usually this will only *change* once, and the renderTo will cause
    // rendering into the owning grid.
    // However in a Lockable assembly the editor has to swap sides if the column is moved across.
    // Called by CellEditing#getEditor
    setGrid: function(grid) {
        var me = this,
            oldGrid = me.grid,
            view,
            viewListeners;

        if (grid !== oldGrid) {
            viewListeners = {
                beforerefresh: me.beforeViewRefresh,
                refresh: me.onViewRefresh,
                scope: me
            };
            // Remove previous refresh listener
            if (oldGrid) {
                oldGrid.getView().un(viewListeners);
            }

            // Set the renderTo target to reflect new grid view ownership
            view = grid.getView();
            me.renderTo = view.getTargetEl().dom;
            me.grid = me.ownerCt = grid;

            // On view refresh, we need to copy our DOM into the detached body to prevent it from being garbage collected.
            view.on(viewListeners);
        }
    },

    // @private
    // @override
    // Final position is decided upon by the Editor's realign() call which syncs position over the edited element.
    adjustPosition: function() {
        return {x:0,y:0};
    },

    beforeViewRefresh: function() {
        var me = this,
            dom = me.el && me.el.dom;

        if (dom) {
            if (me.editing && !(me.field.column && me.field.column.sorting)) {

                // Clear the Panel's containsFocus flag prior to removing it from the DOM
                // This will prevent the Panels onFocusLeave from processing the resulting blurring.
                me.grid.containsFocus = false;

                // Set the Editor.allowBlur setting so that it does not process the upcoming field blur event and terminate the edit
                me.wasAllowBlur = me.allowBlur;
                me.allowBlur = false;
            }

            // Remove the editor from the view to protect it from anihilation: https://sencha.jira.com/browse/EXTJSIV-11713
            if (dom.parentNode) {
                dom.parentNode.removeChild(dom);
            }
        }
    },

    onViewRefresh: function() {
        var me = this,
            dom = me.el && me.el.dom,
            sorting;

        if (dom) {
            sorting = me.field.column && me.field.column.sorting;

            // If the view was refreshed while we were editing, replace it.
            if (me.editing && !sorting) {
                me.allowBlur = me.wasAllowBlur;
                me.renderTo.appendChild(dom);

                // The removal will have blurred, so avoid the processing in onFocusEnter by restoring the previous
                // containsFocus setting
                me.grid.containsFocus = true;

                me.field.focus();
            } else if (!sorting) {
                Ext.getDetachedBody().dom.appendChild(dom);
            }

            // If the column was sorted while editing, we must detect that and complete the edit
            // because the view will be refreshed and the editor will be removed from the dom.
            if (me.editing && sorting) {
                me.completeEdit();
            }
        }
    },

    /**
     * @private
     * Shows the editor, end ensures that it is rendered into the correct view
     * Hides the grid cell inner element when a cell editor is shown.
     */
    onShow: function() {
        var me = this,
            innerCell = me.boundEl.first();

        // If we have had our owning grid changed (by a column switching sides in a Lockable assembly)
        // or, if a view refresh has removed us from the DOM
        // append this component into its renderTo target.
        if (me.el.dom.parentNode !== me.renderTo) {
            me.renderTo.appendChild(me.el.dom);
        }

        if (innerCell) {
            if (me.isForTree) {
                innerCell = innerCell.child(me.treeNodeSelector);
            }
            innerCell.hide();
        }

        me.callParent(arguments);
    },

    onEditComplete: function(remainVisible) {
        // When being asked to process edit completion, if we are not hiding, restore the cell now
        if (remainVisible) {
            this.restoreCell();
        }
        this.callParent(arguments);
    },

    /**
     * @private
     * Shows the grid cell inner element when a cell editor is hidden
     */
    onHide: function() {
        this.restoreCell();
        this.callParent(arguments);
    },

    restoreCell: function() {
        var me = this,
            innerCell = me.boundEl.first();

        if (innerCell) {
            if (me.isForTree) {
                innerCell = innerCell.child(me.treeNodeSelector);
            }
            innerCell.show();
        }
    },

    /**
     * @private
     * Fix checkbox blur when it is clicked.
     */
    afterRender: function() {
        var me = this,
            field = me.field;

        me.callParent(arguments);

        if (field.isCheckbox) {
            field.mon(field.inputEl, {
                mousedown: me.onCheckBoxMouseDown,
                click: me.onCheckBoxClick,
                scope: me
            });
        }

        // listen for the "unstoppable" mousedown event so we can be sure to blur and hide
        // the editor if the document is clicked, even if another handler stops the event
        Ext.on('mousedown', me.onDocMouseDown, me);
    },

    /**
     * @private
     * Because when checkbox is clicked it loses focus  completeEdit is bypassed.
     */
    onCheckBoxMouseDown: function() {
        this.completeEdit = Ext.emptyFn;
    },

    onDocMouseDown: function(e) {
        var field = this.field;

        if (field && field.hasFocus && !field.owns(e.target)) {
            field.blur();
        }
    },

    /**
     * @private
     * Restore checkbox focus and completeEdit method.
     */
    onCheckBoxClick: function() {
        delete this.completeEdit;
        this.field.focus(false, 10);
    },

    /**
     * @private
     * Realigns the Editor to the grid cell, or to the text node in the grid inner cell
     * if the inner cell contains multiple child nodes.
     */
    realign: function(autoSize) {
        var me = this,
            boundEl = me.boundEl,
            innerCell = boundEl.first(),
            innerCellTextNode = innerCell.dom.firstChild,
            width = boundEl.getWidth(),
            offsets = Ext.Array.clone(me.offsets),
            grid = me.grid,
            xOffset,
            v = '',

            // innerCell is empty if there are no children, or there is one text node, and it contains whitespace
            isEmpty = !innerCellTextNode || (innerCellTextNode.nodeType === 3 && !(Ext.String.trim(v = innerCellTextNode.data).length));

        if (me.isForTree) {
            // When editing a tree, adjust the width and offsets of the editor to line
            // up with the tree cell's text element
            xOffset = me.getTreeNodeOffset(innerCell);
            width -= Math.abs(xOffset);
            offsets[0] += xOffset;
        }

        if (grid.columnLines) {
            // Subtract the column border width so that the editor displays inside the
            // borders. The column border could be either on the left or the right depending
            // on whether the grid is RTL - using the sum of both borders works in both modes.
            width -= boundEl.getBorderWidth('rl');
        }

        if (autoSize === true) {
            me.field.setWidth(width);
        }

        // https://sencha.jira.com/browse/EXTJSIV-10871 Ensure the data bearing element has a height from text.
        if (isEmpty) {
            innerCell.dom.innerHTML = 'X';
        }
        me.alignTo(innerCell, me.alignment, offsets);
        if (isEmpty) {
            innerCell.dom.firstChild.data = v;
        }
    },

    // private
    getTreeNodeOffset: function(innerCell) {
        return innerCell.child(this.treeNodeSelector).getOffsetsTo(innerCell)[0];
    },

    onEditorTab: function(e){
        var field = this.field;
        if (field.onEditorTab) {
            field.onEditorTab(e);
        }
    },

    onFieldBlur : function() {
        this.callParent(arguments);
        // Reset the flag that may have been set by CellEditing#startEdit to prevent
        // Ext.Editor#onFieldBlur from canceling editing.
        this.selectSameEditor = false;
    },

    alignment: "l-l",
    hideEl : false,
    cls: Ext.baseCSSPrefix + 'small-editor ' +
        Ext.baseCSSPrefix + 'grid-editor ' +
        Ext.baseCSSPrefix + 'grid-cell-editor',
    treeNodeSelector: '.' + Ext.baseCSSPrefix + 'tree-node-text',
    shim: false,
    shadow: false
});


text:
package org.ehcache.clustered.client.docs;

import org.ehcache.PersistentCacheManager;
import org.ehcache.clustered.client.config.Timeouts;
import org.ehcache.clustered.client.config.builders.ClusteringServiceConfigurationBuilder;
import org.ehcache.clustered.client.config.builders.TimeoutsBuilder;
import org.ehcache.clustered.client.internal.UnitTestConnectionService;
import org.ehcache.config.builders.CacheManagerBuilder;
import org.ehcache.config.units.MemoryUnit;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;

import java.net.URI;
import java.time.Duration;

public class Resilience {

  @Before
  public void resetPassthroughServer() throws Exception {
    UnitTestConnectionService.add("terracotta://localhost/my-application",
      new UnitTestConnectionService.PassthroughServerBuilder()
        .resource("primary-server-resource", 128, MemoryUnit.MB)
        .resource("secondary-server-resource", 96, MemoryUnit.MB)
        .build());
  }

  @After
  public void removePassthroughServer() throws Exception {
    UnitTestConnectionService.remove("terracotta://localhost/my-application");
  }

  @Test
  public void clusteredCacheManagerExample() throws Exception {
    // tag::timeoutsExample[]
    CacheManagerBuilder<PersistentCacheManager> clusteredCacheManagerBuilder =
      CacheManagerBuilder.newCacheManagerBuilder()
        .with(ClusteringServiceConfigurationBuilder.cluster(URI.create("terracotta://localhost/my-application"))
          .timeouts(TimeoutsBuilder.timeouts() // <1>
            .read(Duration.ofSeconds(10)) // <2>
            .write(Timeouts.DEFAULT_OPERATION_TIMEOUT) // <3>
            .connection(Timeouts.INFINITE_TIMEOUT)) // <4>
          .autoCreate(c -> c));
    // end::timeoutsExample[]
  }
}

redpajama_set_name: RedPajamaGithub


text:
<?php
include __DIR__ . '/../common.php';

$state->setAreaCode('base');

$productId = 1;
$objectManager = \Magento\Framework\App\ObjectManager::getInstance();
$product_obj = $objectManager->create('\Magento\Catalog\Model\Product')->load($productId);

getDefaultGroup($product_obj);
getAnyGroup($product_obj);

function getDefaultGroup($product_obj) {
	$tier_price = $product_obj->getTierPrice();

	if(count($tier_price) > 0){
		echo "price_id\tprice_qty\tprice\twebsite_price\n";

		foreach($tier_price as $price){
			echo $price['price_id'];
			echo "\t";
			echo $price['price_qty'];
			echo "\t";
			echo $price['price'];
			echo "\t";
			echo $price['website_price'];
			echo "\n";
		}
	} else {
		echo 'There is no tiering price for the default group.' . PHP_EOL;
	}
}

function getAnyGroup($product_obj) {
	$tier_price = $product_obj->getTierPrices();

	if(count($tier_price) > 0){
		echo "price_qty\tprice\tCustomerGroupId\n";

		foreach($tier_price as $price){
			echo $price->getQty();
			echo "\t";
			echo $price->getValue();
			echo "\t";
			echo $price->getCustomerGroupId();
			echo "\t";
			echo "\n";
			print_r($price->getData());
			echo "\t";
			echo "\n";
		}
	}
}

#print_r($tier_price);
#print_r(get_class_methods($price));


text:
<!DOCTYPE html>
<title>SASL - Simple Authentication and Security Layer (SASL)</title>

 [
   Tcllib Home
| Main Table Of Contents
| Table Of Contents
| Keyword Index
| Categories
| Modules
| Applications
 ]

SASL(n) 1.3.3 tcllib "Simple Authentication and Security Layer (SASL)"

Name

SASL - Implementation of SASL mechanisms for Tcl

Table Of Contents

Table Of Contents

Synopsis

Description

COMMANDS

OPTIONS

CALLBACK PROCEDURE

MECHANISMS

EXAMPLES

REFERENCES

AUTHORS

Bugs, Ideas, Feedback

Keywords

Category

Copyright

Synopsis

package require Tcl 8.2

package require SASL ?1.3.3?

::SASL::new option value ?...?

::SASL::configure option value ?...?

::SASL::step context challenge ?...?

::SASL::response context

::SASL::reset context

::SASL::cleanup context

::SASL::mechanisms ?type? ?minimum?

::SASL::register mechanism preference clientproc ?serverproc?

Description

The Simple Authentication and Security Layer (SASL) is a framework
for providing authentication and authorization to comunications
protocols. The SASL framework is structured to permit negotiation
among a number of authentication mechanisms. SASL may be used in
SMTP, IMAP and HTTP authentication. It is also in use in XMPP, LDAP
and BEEP. See MECHANISMS for the set of available SASL
mechanisms provided with tcllib.

The SASL framework operates using a simple multi-step challenge
response mechanism. All the mechanisms work the same way although the
number of steps may vary. In this implementation a callback procedure
must be provided from which the SASL framework will obtain users
details. See CALLBACK PROCEDURE for details of this
procedure.

COMMANDS

::SASL::new option value ?...?

Contruct a new SASL context. See OPTIONS for details of the
possible options to this command. A context token is required for most
of the SASL procedures.

::SASL::configure option value ?...?

Modify and inspect the SASL context option. See OPTIONS for
further details.

::SASL::step context challenge ?...?

This is the core procedure for using the SASL framework. The
step procedure should be called until it returns 0. Each step takes a
server challenge string and the response is calculated and stored in
the context. Each mechanism may require one or more steps. For some
steps there may be no server challenge required in which case an empty
string should be provided for this parameter. All mechanisms should accept
an initial empty challenge.

::SASL::response context

Returns the next response string that should be sent to the server.

::SASL::reset context

Re-initialize the SASL context. Discards any internal state and
permits the token to be reused.

::SASL::cleanup context

Release all resources associated with the SASL context. The context
token may not be used again after this procedure has been called.

::SASL::mechanisms ?type? ?minimum?

Returns a list of all the available SASL mechanisms. The list is
sorted by the mechanism preference value (see register) with the
preferred mechanisms and the head of the list. Any mechanism with a
preference value less than theminimum (which defaults to 0) is removed
from the returned list. This permits a security threshold to be set. Mechanisms
with a preference less that 25 transmit authentication are particularly
susceptible to eavesdropping and should not be provided unless a secure
channel is in use (eg: tls).

The type parameter
may be one of client or server and defaults to client.
Only mechanisms that have an implementation matching the type are
returned (this permits servers to correctly declare support only for
mechanisms that actually provide a server implementation).

::SASL::register mechanism preference clientproc ?serverproc?

New mechanisms can be added to the package by registering the
mechanism name and the implementing procedures. The server procedure
is optional. The preference value is an integer that is used to order
the list returned by the mechanisms command. Higher values
indicate a preferred mechanism. If the mechanism is already registered
then the recorded values are updated.

OPTIONS

-callback

Specify a command to be evaluated when the SASL mechanism requires
information about the user. The command is called with the current
SASL context and a name specifying the information desired. See
EXAMPLES.

-mechanism

Set the SASL mechanism to be used. See mechanisms for a list of
supported authentication mechanisms.

-service

Set the service type for this context. Some mechanisms may make use of
this parameter (eg DIGEST-MD5, GSSAPI and Kerberos). If not set it
defaults to an empty string. If the -type is set to 'server'
then this option should be set to a valid service identity. Some
examples of valid service names are smtp, ldap, beep and xmpp.

-server

This option is used to set the server name used in SASL challenges
when operating as a SASL server.

-type

The context type may be one of 'client' or 'server'. The default is to
operate as a client application and respond to server
challenges. Mechanisms may be written to support server-side SASL and
setting this option will cause each step to issue the next
challenge. A new context must be created for each incoming client
connection when in server mode.

CALLBACK PROCEDURE

When the SASL framework requires any user details it will call the
procedure provided when the context was created with an argument that
specfies the item of information required.

In all cases a single response string should be returned.

login

The callback procedure should return the users authorization identity.
Return an empty string unless this is to be different to the authentication
identity. Read [1] for a discussion about the specific meaning of
authorization and authentication identities within SASL.

username

The callback procedure should return the users authentication identity.
Read [1] for a discussion about the specific meaning of
authorization and authentication identities within SASL.

password

The callback procedure should return the password that matches the
authentication identity as used within the current realm.

For server mechanisms the password callback should always be called with
the authentication identity and the realm as the first two parameters.

realm

Some SASL mechanisms use realms to partition authentication identities.
The realm string is protocol dependent and is often the current DNS
domain or in the case of the NTLM mechanism it is the Windows NT domain name.

hostname

Returns the client host name - typically [info host].

MECHANISMS

ANONYMOUS

As used in FTP this mechanism only passes an email address for
authentication. The ANONYMOUS mechanism is specified in [2].

PLAIN

This is the simplest mechanism. The users authentication details are
transmitted in plain text. This mechanism should not be provided
unless an encrypted link is in use - typically after SSL or TLS has
been negotiated.

LOGIN

The LOGIN [1] mechanism transmits the users details with base64
encoding. This is no more secure than PLAIN and likewise should not be
used without a secure link.

CRAM-MD5

This mechanism avoids sending the users password over the network in
plain text by hashing the password with a server provided random value
(known as a nonce). A disadvantage of this mechanism is that the
server must maintain a database of plaintext passwords for
comparison. CRAM-MD5 was defined in [4].

DIGEST-MD5

This mechanism improves upon the CRAM-MD5 mechanism by avoiding the
need for the server to store plaintext passwords. With digest
authentication the server needs to store the MD5 digest of the users
password which helps to make the system more secure. As in CRAM-MD5
the password is hashed with a server nonce and other data before being
transmitted across the network. Specified in [3].

OTP

OTP is the One-Time Password system described in RFC 2289 [6].
This mechanism is secure against replay attacks and also avoids storing
password or password equivalents on the server. Only a digest of a seed
and a passphrase is ever transmitted across the network. Requires the
otp package from tcllib and one or more of the cryptographic
digest packages (md5 or sha-1 are the most commonly used).

NTLM

This is a proprietary protocol developed by Microsoft [5] and is
in common use for authenticating users in a Windows network
environment. NTLM uses DES encryption and MD4 digests of the users
password to authenticate a connection. Certain weaknesses have been
found in NTLM and thus there are a number of versions of the protocol.
As this mechanism has additional dependencies it is made available as
a separate sub-package. To enable this mechanism your application must
load the SASL::NTLM package.

X-GOOGLE-TOKEN

This is a proprietary protocol developed by Google and used for
authenticating users for the Google Talk service. This mechanism makes
a pair of HTTP requests over an SSL channel and so this mechanism
depends upon the availability of the tls and http packages. To enable
this mechanism your application must load the SASL::XGoogleToken package.
In addition you are recommended to make use of the autoproxy package to
handle HTTP proxies reasonably transparently.

SCRAM

This is a protocol specified in RFC 5802 [7]. To enable this mechanism
your application must load the SASL::SCRAM package.

EXAMPLES

See the examples subdirectory for more complete samples using SASL
with network protocols. The following should give an idea how the SASL
commands are to be used. In reality this should be event
driven. Each time the step command is called, the last server
response should be provided as the command argument so that the SASL
mechanism can take appropriate action.

proc ClientCallback {context command args} {
    switch -exact -- $command {
        login    { return "" }
        username { return $::tcl_platform(user) }
        password { return "SecRet" }
        realm    { return "" }
        hostname { return [info host] }
        default  { return -code error unxpected }
    }
}
proc Demo {{mech PLAIN}} {
    set ctx [SASL::new -mechanism $mech -callback ClientCallback]
    set challenge ""
    while {1} {
        set more_steps [SASL::step $ctx challenge]
        puts "Send '[SASL::response $ctx]'"
        puts "Read server response into challenge var"
        if {!$more_steps} {break}
    }
    SASL::cleanup $ctx
}

REFERENCES

Myers, J. "Simple Authentication and Security Layer (SASL)",
    RFC 2222, October 1997.
    (http://www.ietf.org/rfc/rfc2222.txt)

Newman, C. "Anonymous SASL Mechanism",
    RFC 2245, November 1997.
    (http://www.ietf.org/rfc/rfc2245.txt)

Leach, P., Newman, C. "Using Digest Authentication as a SASL
    Mechanism", RFC 2831, May 2000,
    (http://www.ietf.org/rfc/rfc2831.txt)

Klensin, J., Catoe, R. and Krumviede, P.,
    "IMAP/POP AUTHorize Extension for Simple Challenge/Response"
    RFC 2195, September 1997.
    (http://www.ietf.org/rfc/rfc2195.txt)

No official specification is available. However,
    http://davenport.sourceforge.net/ntlm.html provides a good
    description.

Haller, N. et al., "A One-Time Password System",
    RFC 2289, February 1998,
    (http://www.ieft.org/rfc/rfc2289.txt)

Newman, C. et al., "Salted Challenge Response Authentication Mechanism (SCRAM) SASL and GSS-API Mechanisms",
    RFC 5802, July 2010,
    (http://www.ieft.org/rfc/rfc5802.txt)

AUTHORS

Pat Thoyts

Bugs, Ideas, Feedback

This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category sasl of the
Tcllib Trackers.
Please also report any ideas for enhancements you may have for either
package and/or documentation.

When proposing code changes, please provide unified diffs,
i.e the output of diff -u.

Note further that attachments are strongly preferred over
inlined patches. Attachments can be made by going to the Edit
form of the ticket immediately after its creation, and then using the
left-most button in the secondary navigation bar.

Keywords

SASL, authentication

Category

Networking

Copyright

Copyright © 2005-2006, Pat Thoyts <patthoyts@users.sourceforge.net>


text:
<?php

class Google_Service_Compute_SubnetworksScopedList extends Google_Collection
{
  protected $collection_key = 'subnetworks';
  protected $subnetworksType = 'Google_Service_Compute_Subnetwork';
  protected $subnetworksDataType = 'array';
  protected $warningType = 'Google_Service_Compute_SubnetworksScopedListWarning';
  protected $warningDataType = '';

  /**
   * @param Google_Service_Compute_Subnetwork[]
   */
  public function setSubnetworks($subnetworks)
  {
    $this->subnetworks = $subnetworks;
  }
  /**
   * @return Google_Service_Compute_Subnetwork[]
   */
  public function getSubnetworks()
  {
    return $this->subnetworks;
  }
  /**
   * @param Google_Service_Compute_SubnetworksScopedListWarning
   */
  public function setWarning(Google_Service_Compute_SubnetworksScopedListWarning $warning)
  {
    $this->warning = $warning;
  }
  /**
   * @return Google_Service_Compute_SubnetworksScopedListWarning
   */
  public function getWarning()
  {
    return $this->warning;
  }
}


text:
// Copyright 2013 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.

package org.chromium.content.browser.test.util;

import android.os.IBinder;
import android.os.ResultReceiver;
import android.view.View;
import android.view.inputmethod.EditorInfo;
import android.view.inputmethod.InputConnection;

import org.chromium.content.browser.ContentViewCore;
import org.chromium.content.browser.input.InputMethodManagerWrapper;

/**
 * Overrides InputMethodManagerWrapper for testing purposes.
 */
public class TestInputMethodManagerWrapper extends InputMethodManagerWrapper {
    /**
     * A simple class to set start and end in int type.
     */
    public static class Range {
        private int mStart;
        private int mEnd;

        public Range(int start, int end) {
            mStart = start;
            mEnd = end;
        }

        public void set(int start, int end) {
            mStart = start;
            mEnd = end;
        }

        public int start() {
            return mStart;
        }

        public int end() {
            return mEnd;
        }

        @Override
        public boolean equals(Object o) {
            if (!(o instanceof Range)) return false;
            if (o == this) return true;
            Range r = (Range) o;
            return mStart == r.mStart && mEnd == r.mEnd;
        }

        @Override
        public int hashCode() {
            final int prime = 31;
            return prime * mStart + mEnd;
        }

        @Override
        public String toString() {
            return "[ " + mStart + ", " + mEnd + " ]";
        }
    }

    private final ContentViewCore mContentViewCore;
    private InputConnection mInputConnection;
    private int mShowSoftInputCounter = 0;
    private int mUpdateSelectionCounter = 0;
    private EditorInfo mEditorInfo;
    private final Range mSelection = new Range(0, 0);
    private final Range mComposition = new Range(-1, -1);

    public TestInputMethodManagerWrapper(ContentViewCore contentViewCore) {
        super(null);
        mContentViewCore = contentViewCore;
    }

    @Override
    public void restartInput(View view) {
        mEditorInfo = new EditorInfo();
        mInputConnection = mContentViewCore.onCreateInputConnection(mEditorInfo);
    }

    @Override
    public void showSoftInput(View view, int flags, ResultReceiver resultReceiver) {
        mShowSoftInputCounter++;
        if (mInputConnection != null) return;
        mEditorInfo = new EditorInfo();
        mInputConnection = mContentViewCore.onCreateInputConnection(mEditorInfo);
    }

    @Override
    public boolean isActive(View view) {
        if (mInputConnection == null) return false;
        return true;
    }

    @Override
    public boolean hideSoftInputFromWindow(IBinder windowToken, int flags,
            ResultReceiver resultReceiver) {
        boolean retVal = mInputConnection == null;
        mInputConnection = null;
        return retVal;
    }

    @Override
    public void updateSelection(View view, int selStart, int selEnd,
            int candidatesStart, int candidatesEnd) {
        mUpdateSelectionCounter++;
        mSelection.set(selStart, selEnd);
        mComposition.set(candidatesStart, candidatesEnd);
    }

    public int getShowSoftInputCounter() {
        return mShowSoftInputCounter;
    }

    public int getUpdateSelectionCounter() {
        return mUpdateSelectionCounter;
    }

    public EditorInfo getEditorInfo() {
        return mEditorInfo;
    }

    public Range getSelection() {
        return mSelection;
    }

    public Range getComposition() {
        return mComposition;
    }
}


text:
package org.apache.hadoop.hbase.constraint;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;

import java.util.List;

import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.hbase.HTableDescriptor;
import org.apache.hadoop.hbase.testclassification.MiscTests;
import org.apache.hadoop.hbase.testclassification.SmallTests;
import org.apache.hadoop.hbase.TableName;
import org.apache.hadoop.hbase.client.Put;
import org.apache.hadoop.hbase.constraint.TestConstraint.CheckWasRunConstraint;
import org.apache.hadoop.hbase.constraint.WorksConstraint.NameConstraint;
import org.apache.hadoop.hbase.util.Pair;
import org.junit.Test;
import org.junit.experimental.categories.Category;

/**
 * Test reading/writing the constraints into the {@link HTableDescriptor}
 */
@Category({MiscTests.class, SmallTests.class})
public class TestConstraints {

  @SuppressWarnings("unchecked")
  @Test
  public void testSimpleReadWrite() throws Throwable {
    HTableDescriptor desc = new HTableDescriptor(TableName.valueOf("table"));
    Constraints.add(desc, WorksConstraint.class);

    List<? extends Constraint> constraints = Constraints.getConstraints(desc,
        this.getClass().getClassLoader());
    assertEquals(1, constraints.size());

    assertEquals(WorksConstraint.class, constraints.get(0).getClass());

    // Check that we can add more than 1 constraint and that ordering is
    // preserved
    Constraints.add(desc, AlsoWorks.class, NameConstraint.class);
    constraints = Constraints.getConstraints(desc, this.getClass()
        .getClassLoader());
    assertEquals(3, constraints.size());

    assertEquals(WorksConstraint.class, constraints.get(0).getClass());
    assertEquals(AlsoWorks.class, constraints.get(1).getClass());
    assertEquals(NameConstraint.class, constraints.get(2).getClass());

  }

  @SuppressWarnings("unchecked")
  @Test
  public void testReadWriteWithConf() throws Throwable {
    HTableDescriptor desc = new HTableDescriptor(TableName.valueOf("table"));
    Constraints.add(
        desc,
        new Pair<Class<? extends Constraint>, Configuration>(
            CheckConfigurationConstraint.class, CheckConfigurationConstraint
                .getConfiguration()));

    List<? extends Constraint> c = Constraints.getConstraints(desc, this
        .getClass().getClassLoader());
    assertEquals(1, c.size());

    assertEquals(CheckConfigurationConstraint.class, c.get(0).getClass());

    // check to make sure that we overwrite configurations
    Constraints.add(desc, new Pair<Class<? extends Constraint>, Configuration>(
        CheckConfigurationConstraint.class, new Configuration(false)));

    try {
      Constraints.getConstraints(desc, this.getClass().getClassLoader());
      fail("No exception thrown  - configuration not overwritten");
    } catch (IllegalArgumentException e) {
      // expect to have the exception, so don't do anything
    }
  }

  /**
   * Test that Constraints are properly enabled, disabled, and removed
   *
   * @throws Exception
   */
  @SuppressWarnings("unchecked")
  @Test
  public void testEnableDisableRemove() throws Exception {
    HTableDescriptor desc = new HTableDescriptor(TableName.valueOf("table"));
    // check general enabling/disabling of constraints
    // first add a constraint
    Constraints.add(desc, AllPassConstraint.class);
    // make sure everything is enabled
    assertTrue(Constraints.enabled(desc, AllPassConstraint.class));
    assertTrue(desc.hasCoprocessor(ConstraintProcessor.class.getName()));

    // check disabling
    Constraints.disable(desc);
    assertFalse(desc.hasCoprocessor(ConstraintProcessor.class.getName()));
    // make sure the added constraints are still present
    assertTrue(Constraints.enabled(desc, AllPassConstraint.class));

    // check just removing the single constraint
    Constraints.remove(desc, AllPassConstraint.class);
    assertFalse(Constraints.has(desc, AllPassConstraint.class));

    // Add back the single constraint
    Constraints.add(desc, AllPassConstraint.class);

    // and now check that when we remove constraints, all are gone
    Constraints.remove(desc);
    assertFalse(desc.hasCoprocessor(ConstraintProcessor.class.getName()));
    assertFalse(Constraints.has(desc, AllPassConstraint.class));

  }

  /**
   * Test that when we update a constraint the ordering is not modified.
   *
   * @throws Exception
   */
  @SuppressWarnings("unchecked")
  @Test
  public void testUpdateConstraint() throws Exception {
    HTableDescriptor desc = new HTableDescriptor(TableName.valueOf("table"));
    Constraints.add(desc, CheckConfigurationConstraint.class,
        CheckWasRunConstraint.class);
    Constraints.setConfiguration(desc, CheckConfigurationConstraint.class,
        CheckConfigurationConstraint.getConfiguration());

    List<? extends Constraint> constraints = Constraints.getConstraints(desc,
        this.getClass().getClassLoader());

    assertEquals(2, constraints.size());

    // check to make sure the order didn't change
    assertEquals(CheckConfigurationConstraint.class, constraints.get(0)
        .getClass());
    assertEquals(CheckWasRunConstraint.class, constraints.get(1).getClass());
  }

  /**
   * Test that if a constraint hasn't been set that there are no problems with
   * attempting to remove it.
   *
   * @throws Throwable
   *           on failure.
   */
  @Test
  public void testRemoveUnsetConstraint() throws Throwable {
    HTableDescriptor desc = new HTableDescriptor(TableName.valueOf("table"));
    Constraints.remove(desc);
    Constraints.remove(desc, AlsoWorks.class);
  }

  @Test
  public void testConfigurationPreserved() throws Throwable {
    Configuration conf = new Configuration();
    conf.setBoolean("_ENABLED", false);
    conf.setLong("_PRIORITY", 10);
    HTableDescriptor desc = new HTableDescriptor(TableName.valueOf("table"));
    Constraints.add(desc, AlsoWorks.class, conf);
    Constraints.add(desc, WorksConstraint.class);
    assertFalse(Constraints.enabled(desc, AlsoWorks.class));
    List<? extends Constraint> constraints = Constraints.getConstraints(desc,
        this.getClass().getClassLoader());
    for (Constraint c : constraints) {
      Configuration storedConf = c.getConf();
      if (c instanceof AlsoWorks)
        assertEquals(10, storedConf.getLong("_PRIORITY", -1));
      // its just a worksconstraint
      else
        assertEquals(2, storedConf.getLong("_PRIORITY", -1));

    }

  }

  // ---------- Constraints just used for testing

  /**
   * Also just works
   */
  public static class AlsoWorks extends BaseConstraint {
    @Override
    public void check(Put p) {
      // NOOP
    }
  }

}


text:
namespace Shuttle.Esb.Unity.Tests.Duplicate
{
    public class DuplicateCommand
    {
        public string Name { get; set; }
    }
}


text:
import os
import sys
import uuid

from designateclient import v1
from oslo_config import cfg
from oslo_log import log as logging

cfg.CONF.register_cli_opts([
    cfg.StrOpt("domain_id", help="ID of domain to use."),
    cfg.IntOpt("records", default=100,
               help="Records to create (name will be <uuid>.<domain name>.")
])

LOG = logging.getLogger(__name__)

if __name__ == '__main__':
    logging.register_options(cfg.CONF)
    cfg.CONF(sys.argv[1:], project="designate")
    logging.setup(cfg.CONF, "designate")

    project_name = os.environ.get(
        'OS_PROJECT_NAME', os.environ.get('OS_TENANT_NAME'))

    client = v1.Client(
        auth_url=os.environ.get('OS_AUTH_URL'),
        username=os.environ.get('OS_USERNAME'),
        password=os.environ.get('OS_PASSWORD'),
        project_name=project_name
    )

    domain = client.domains.get(cfg.CONF.domain_id)

    msg = "Creating %s records" % cfg.CONF.records
    LOG.info(msg)
    for i in xrange(0, cfg.CONF.records):
        name = '%s.%s' % (str(uuid.uuid4()), domain.name)
        record = {"name": name, "type": "A", "data": "10.0.0.1"}
        client.records.create(domain, record)


text:
import {SUPPORTED_LANGUAGES} from './languages'

export default {
  type: 'object',
  name: 'localeSlug',
  fields: SUPPORTED_LANGUAGES.map((lang) => ({
    name: lang.id,
    type: 'slug',
    title: lang.title,
    options: {
      source: (document) => (document && document.title ? document.title[lang.id] : ''),
      maxLength: 96,
      auto: true,
    },
  })),
}


text:
define(['knockout', 'app-lib/environment', 'ko-postbox'], function(ko, env, postbox) {
    var colors = require('colors');
    var spawn = require('child_process').spawn;
    var exec = require('child_process').exec;
    var q = require('q');
    var fs = require('fs');

    var Vagrant = function() {
        this.commandRunning = ko.observable(false).syncWith('vagrant.commandRunning');
    };

    Vagrant.prototype.executeCommand = function(fullPath, command, args, callback) {
        var self = this;
        this.commandRunning(true);

        if (args == undefined) {
            args = [];
        }
        args = [command].concat(args);

        postbox.publish('Term.main', colors.bold('cd ' + fullPath + ' && ' + env.exeFile('vagrant') + ' ' + args.join(' ') + '\r\n'));

        var process = spawn(env.exeFile('vagrant'), args, {
            cwd: fullPath
        });

        process.stdout.on('data', function(data) {
            ('' + data).split('\n').forEach(function(value, key) {
                postbox.publish('Term.main', colors.green(value + '\r\n'));
            });
        });
        process.stderr.on('data', function(data) {
            ('' + data).split('\n').forEach(function(value, key) {
                postbox.publish('Term.main', colors.red(value + '\r\n'));
            });
        });

        process.on('close', function (code) {
            postbox.publish('Term.main', colors.rainbow('command completed.\r\n'));
            self.commandRunning(false);
            if (typeof callback == 'function') {
                callback();
            }
        });
    };

    Vagrant.prototype.installPlugin = function(plugin, fullPath, callback) {
        this.executeCommand(fullPath, 'plugin', ['install', plugin], callback);
    };

    Vagrant.prototype.addBox = function(name, box, fullPath, callback) {
        this.executeCommand(fullPath, 'box', ['add', name, box, '-f'], callback);
    };

    Vagrant.prototype.up = function(fullPath, machine, callback, args) {
        args = args ? args.unshift(machine) : [machine];
        this.executeCommand(fullPath, 'up', args, callback);
    };

    Vagrant.prototype.provision = function(fullPath, machine, callback) {
        this.executeCommand(fullPath, 'provision', [machine], callback);
    };

    Vagrant.prototype.halt = function(fullPath, machine, callback) {
        this.executeCommand(fullPath, 'halt', [machine], callback);
    };

    Vagrant.prototype.reload = function(fullPath, machine, callback) {
        this.executeCommand(fullPath, 'reload', [machine], callback);
    };

    Vagrant.prototype.destroy = function(fullPath, machine, callback) {
        this.executeCommand(fullPath, 'destroy', [machine, '-f'], callback);
    };

    Vagrant.prototype.getStatus = function(fullPath, machine) {

        var deferred = q.defer();
        machine = machine || '';
        var path = fs.lstatSync(fullPath);
        var self = this;
        this.commandRunning(true);
        if (path.isDirectory()) {
            exec('cd ' + fullPath + ' && ' + env.exeFile('vagrant') + ' ' + 'status ' + machine, function (error, stdout, stderr) {

                if (error) {
                    console.error(stderr);
                    self.commandRunning(false);
                    deferred.reject('error');
                } else {
                    var rows = stdout.split('\n');
                    for (var j = 0; j < rows.length; j++) {
                        var result = rows[j].split(/[ ]+/).filter(function (n) {
                            return n != '';
                        });
                        if (result[0] == machine) {
                            self.commandRunning(false);
                            result.shift(); //remove from end
                            result.pop(); //remove from start
                            deferred.resolve(result.join(' ').trim());
                        }
                    }
                    deferred.resolve('not setup');
                }
            });
        } else {
            deferred.resolve('not folder');
        }
        return deferred.promise;

    };
    return Vagrant;
});