text:
// Generated by xsd compiler for ios/objective-c
// DO NOT CHANGE!

/**
   Common header file
*/

#import "Shopping_GetItemStatusResponseType.h"
#import "Shopping_FindPopularItemsResponseType.h"
#import "Shopping_VariationType.h"
#import "Shopping_GetUserProfileResponseType.h"
#import "Shopping_DiscountPriceInfoType.h"
#import "Shopping_SimpleItemType.h"
#import "Shopping_GeteBayTimeResponseType.h"
#import "Shopping_SellingStatusType.h"
#import "Shopping_GetSingleItemResponseType.h"
#import "Shopping_FindReviewsAndGuidesResponseType.h"
#import "Shopping_ProductIDType.h"
#import "Shopping_FindProductsRequestType.h"
#import "Shopping_PicturesType.h"
#import "Shopping_DomainHistogramType.h"
#import "Shopping_ExternalProductIDType.h"
#import "Shopping_NameValueListType.h"
#import "Shopping_GeteBayTimeRequestType.h"
#import "Shopping_GetSingleItemRequestType.h"
#import "Shopping_TaxTableType.h"
#import "Shopping_HistogramEntryType.h"
#import "Shopping_PickUpInStoreDetailsType.h"
#import "Shopping_InternationalShippingServiceOptionType.h"
#import "Shopping_ErrorType.h"
#import "Shopping_GetShippingCostsRequestType.h"
#import "Shopping_ShippingServiceOptionType.h"
#import "Shopping_SalesTaxType.h"
#import "Shopping_ItemCompatibilityListType.h"
#import "Shopping_SimpleItemArrayType.h"
#import "Shopping_GetCategoryInfoRequestType.h"
#import "Shopping_UnitInfoType.h"
#import "Shopping_DistanceType.h"
#import "Shopping_VariationsType.h"
#import "Shopping_AddressType.h"
#import "Shopping_GetMultipleItemsResponseType.h"
#import "Shopping_CatalogProductType.h"
#import "Shopping_CharityType.h"
#import "Shopping_GetCategoryInfoResponseType.h"
#import "Shopping_GetMultipleItemsRequestType.h"
#import "Shopping_QuantityInfo.h"
#import "Shopping_StorefrontType.h"
#import "Shopping_AmountType.h"
#import "Shopping_CategoryArrayType.h"
#import "Shopping_NameValueListArrayType.h"
#import "Shopping_VATDetailsType.h"
#import "Shopping_BuyingGuideDetailsType.h"
#import "Shopping_FindHalfProductsResponseType.h"
#import "Shopping_FindPopularSearchesResponseType.h"
#import "Shopping_BusinessSellerDetailsType.h"
#import "Shopping_ReviewDetailsType.h"
#import "Shopping_FeedbackDetailType.h"
#import "Shopping_SimpleUserType.h"
#import "Shopping_ShippingDetailsType.h"
#import "Shopping_FeedbackPeriodType.h"
#import "Shopping_VariationSpecificPictureSetType.h"
#import "Shopping_FindProductsResponseType.h"
#import "Shopping_HalfProductsType.h"
#import "Shopping_GetShippingCostsResponseType.h"
#import "Shopping_GetItemStatusRequestType.h"
#import "Shopping_FindPopularSearchesRequestType.h"
#import "Shopping_ShippingCostSummaryType.h"
#import "Shopping_FindReviewsAndGuidesRequestType.h"
#import "Shopping_FindHalfProductsRequestType.h"
#import "Shopping_FindPopularItemsRequestType.h"
#import "Shopping_AbstractRequestType.h"
#import "Shopping_CategoryType.h"
#import "Shopping_AverageRatingDetailsType.h"
#import "Shopping_ErrorParameterType.h"
#import "Shopping_FeedbackHistoryType.h"
#import "Shopping_BuyingGuideType.h"
#import "Shopping_TaxJurisdictionType.h"
#import "Shopping_AbstractResponseType.h"
#import "Shopping_ReviewType.h"
#import "Shopping_PopularSearchesType.h"
#import "Shopping_GetUserProfileRequestType.h"
#import "Shopping_ReturnPolicyType.h"
#import "Shopping_ItemCompatibilityType.h"
#import "Shopping_HalfCatalogProductType.h"

#import "Shopping_ReviewSortCodeType.h"
#import "Shopping_TradingRoleCodeType.h"
#import "Shopping_SellerLevelCodeType.h"
#import "Shopping_MinimumAdvertisedPriceExposureCodeType.h"
#import "Shopping_SiteCodeType.h"
#import "Shopping_AckCodeType.h"
#import "Shopping_ExternalProductCodeType.h"
#import "Shopping_ListingTypeCodeType.h"
#import "Shopping_FeedbackRatingDetailCodeType.h"
#import "Shopping_ErrorClassificationCodeType.h"
#import "Shopping_CommentTypeCodeType.h"
#import "Shopping_ListingStatusCodeType.h"
#import "Shopping_ProductSortCodeType.h"
#import "Shopping_UserStatusCodeType.h"
#import "Shopping_FeedbackRatingStarCodeType.h"
#import "Shopping_CurrencyCodeType.h"
#import "Shopping_CharityStatusCodeType.h"
#import "Shopping_ShippingTypeCodeType.h"
#import "Shopping_CountryCodeType.h"
#import "Shopping_SeverityCodeType.h"
#import "Shopping_ProductIDCodeType.h"
#import "Shopping_QuantityAvailableHintCodeType.h"
#import "Shopping_SellerBusinessCodeType.h"
#import "Shopping_HalfItemConditionCodeType.h"
#import "Shopping_PricingTreatmentCodeType.h"
#import "Shopping_InsuranceOptionCodeType.h"
#import "Shopping_SortOrderCodeType.h"
#import "Shopping_ProductStateCodeType.h"
#import "Shopping_BuyerPaymentMethodCodeType.h"


text:
<!doctype html>

    <meta charset="utf-8">
    <meta content="IE=edge,chrome=1" http-equiv="X-UA-Compatible">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <title>API Documentation</title>

    <link href="../stylesheets/screen.css" rel="stylesheet" type="text/css" media="screen" />
    <link href="../stylesheets/print.css" rel="stylesheet" type="text/css" media="print" />

        NAV

Docker Cloud Events

Docker Cloud Event

Example

{
    "type": "action",
    "action": "update",
    "parents": [
        "/api/app/v1/container/0b0e3538-88df-4f07-9aed-3a3cc4175076/"
    ],
    "resource_uri": "/api/app/v1/action/49f0efe8-a704-4a10-b02f-f96344fabadd/",
    "state": "Success",
    "uuid": "093ba3bb-08dd-48f0-8f12-4d3b85ef85b3",
    "datetime": "2016-02-01T16:47:28Z"
}

Docker Cloud events are generated every time any of the following objects is created or changes state:

Stack

Service

Container

Node Cluster

Node

Action

Attributes

Attribute
Description

type
Type of object that was created or updated. For possible values, check the events types table below.

action
Type of action that was executed on the object. Posible values: create, update or delete

parents
List of resource URIs (REST API) of the parents of the object, according to the “Parent-child hierarchy” table below

resource_uri
Resource URI (REST API) of the object that was created or updated. You can do a GET operation on this URL to fetch its details

state
The current state of the object

uuid
Unique identifier for the event

datetime
Date and time of the event in ISO 8601 format

Event types

Type
Description

stack
Whenever a Stack is created or updated

service
Whenever a Service is created or updated

container
Whenever a Container is created or updated

nodecluster
Whenever a Node Cluster is created or updated

node
Whenever a Node is created or updated

action
Whenever a Action is created or updated

error
Sent when an error occurs on the websocket connection or as part of the authentication process

Parent-child hierarchy

Object type
Parent types

Stack
(None)

Service
Stack

Container
Service, Stack, Node, Node Cluster

Node Cluster
(None)

Node
Node Cluster

Action
(object to which the action applies to)

Listen to new Docker Cloud Events

import dockercloud

def process_event(event):
    print event

events = dockercloud.Events()
events.on_message(process_event)
events.run_forever()

import "github.com/docker/go-dockercloud/dockercloud"

c := make(chan dockercloud.Event)
e := make(chan error)

go dockercloud.Events(c, e)

for {
    select {
        case event := <-c:
            log.Println(event)
        case err := <-e:
            log.Println(err)
    }
}

GET /api/audit/v1/events/ HTTP/1.1
Host: ws.cloud.docker.com
Authorization: Basic dXNlcm5hbWU6YXBpa2V5
Connection: Upgrade
Upgrade: websocket

docker-cloud event

Listens for new Docker Cloud Events

Endpoint Type

Available in Docker Cloud’s STREAM API

HTTP Request

GET /api/audit/v1/events/

redpajama_set_name: RedPajamaGithub


text:
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

/*
Test the following matrix for classes with virtual newslot methods (implicit override):

Non-Generic virtual methods:
						Non-generic Interface	Generic Interface
		Non-generic type  			N/A			Test4
		Generic type				Test2			Test6

Generic virtual methods:
						Non-generic Interface	Generic Interface
		Non-generic type			Test1 			Test5
		Generic type				Test3			Test7

*/

using System;

public class A<T>
{}

public struct S<T>
{}

public interface I
{
	int method1();
	int method2<T>();
}

public interface IGen<T>
{
	int method1();
	int method2<M>();
}

public class C1 : I
{
	public virtual int method1()
	{
		return 1;
	}

	public virtual int method2<T>()
	{
		return 2;
	}
}

public class C2<T> : I
{
	public virtual int method1()
	{
		return 3;
	}

	public virtual int method2<U>()
	{
		return 4;
	}
}

public class C3Int : IGen<int>
{
	public virtual int method1()
	{
		return 5;
	}

	public virtual int method2<U>()
	{
		return 6;
	}
}

public class C3String : IGen<string>
{
	public virtual int method1()
	{
		return 5;
	}

	public virtual int method2<U>()
	{
		return 6;
	}
}

public class C3Object: IGen<object>
{
	public virtual int method1()
	{
		return 5;
	}

	public virtual int method2<U>()
	{
		return 6;
	}
}

public class C4<T> : IGen<T>
{
	public virtual int method1()
	{
		return 7;
	}

	public virtual int method2<U>()
	{
		return 8;
	}

}

public class Test
{

	public static int counter = 0;
	public static bool pass = true;

	public static void Eval(bool exp)
	{
		counter++;
		if (!exp)
		{
			pass = exp;
			Console.WriteLine("Test Failed at location: " + counter);
		}

	}

	public static void TestNonGenInterface_NonGenType()
	{
		I ic1 = new C1();

		// TEST1: test generic virtual method
		Eval( (ic1.method2<int>().ToString()).Equals("2") );
		Eval( (ic1.method2<string>() .ToString()).Equals("2") );
		Eval( (ic1.method2<object>().ToString()).Equals("2") );
		Eval( (ic1.method2<A<int>>().ToString()).Equals("2") );
		Eval( (ic1.method2<S<object>>().ToString()).Equals("2") );
	}

	public static void TestNonGenInterface_GenType()
	{
		I ic2Int = new C2<int>();
		I ic2Object = new C2<object>();
		I ic2String = new C2<string>();

		// TEST2: test non generic virtual method

 		Eval( (ic2Int.method1().ToString()).Equals("3") );
		Eval( (ic2String.method1().ToString()).Equals("3") );
		Eval( (ic2Object.method1().ToString()).Equals("3") );

		// TEST3: test generic virtual method

		Eval( (ic2Int.method2<int>().ToString()).Equals("4") );
		Eval( (ic2Int.method2<object>().ToString()).Equals("4") );
		Eval( (ic2Int.method2<string>().ToString()).Equals("4") );
		Eval( (ic2Int.method2<A<int>>().ToString()).Equals("4") );
		Eval( (ic2Int.method2<S<string>>().ToString()).Equals("4") );

		Eval( (ic2String.method2<int>().ToString()).Equals("4") );
		Eval( (ic2String.method2<object>().ToString()).Equals("4") );
		Eval( (ic2String.method2<string>().ToString()).Equals("4") );
		Eval( (ic2String.method2<A<int>>().ToString()).Equals("4") );
		Eval( (ic2String.method2<S<string>>().ToString()).Equals("4") );

		Eval( (ic2Object.method2<int>().ToString()).Equals("4") );
		Eval( (ic2Object.method2<object>().ToString()).Equals("4") );
		Eval( (ic2Object.method2<string>().ToString()).Equals("4") );
		Eval( (ic2Object.method2<A<int>>().ToString()).Equals("4") );
		Eval( (ic2Object.method2<S<string>>().ToString()).Equals("4") );

	}

	public static void TestGenInterface_NonGenType()
	{
		IGen<int> iIntc3 = new C3Int();
		IGen<object> iObjectc3 = new C3Object();
		IGen<string> iStringc3 = new C3String();

		// TEST4: test non generic virtual method

		Eval( (iIntc3.method1().ToString()).Equals("5") );
		Eval( (iObjectc3.method1().ToString()).Equals("5") );
		Eval( (iStringc3.method1().ToString()).Equals("5") );

		// TEST5: test generic virtual method

		Eval( (iIntc3.method2<int>().ToString()).Equals("6") );
		Eval( (iIntc3.method2<object>().ToString()).Equals("6") );
		Eval( (iIntc3.method2<string>().ToString()).Equals("6") );
		Eval( (iIntc3.method2<A<int>>().ToString()).Equals("6") );
		Eval( (iIntc3.method2<S<string>>().ToString()).Equals("6") );

		Eval( (iStringc3.method2<int>().ToString()).Equals("6") );
		Eval( (iStringc3.method2<object>().ToString()).Equals("6") );
		Eval( (iStringc3.method2<string>().ToString()).Equals("6") );
		Eval( (iStringc3.method2<A<int>>().ToString()).Equals("6") );
		Eval( (iStringc3.method2<S<string>>().ToString()).Equals("6") );

		Eval( (iObjectc3.method2<int>().ToString()).Equals("6") );
		Eval( (iObjectc3.method2<object>().ToString()).Equals("6") );
		Eval( (iObjectc3.method2<string>().ToString()).Equals("6") );
		Eval( (iObjectc3.method2<A<int>>().ToString()).Equals("6") );
		Eval( (iObjectc3.method2<S<string>>().ToString()).Equals("6") );

	}

	public static void TestGenInterface_GenType()
	{
		IGen<int> iGenC4Int = new C4<int>();
		IGen<object> iGenC4Object = new C4<object>();
		IGen<string> iGenC4String = new C4<string>();

		// TEST6: test non generic virtual method

		Eval( (iGenC4Int.method1().ToString()).Equals("7") );
		Eval( (iGenC4Object.method1().ToString()).Equals("7") );
		Eval( (iGenC4String.method1().ToString()).Equals("7") );

		// TEST7: test generic virtual method

		Eval( (iGenC4Int.method2<int>().ToString()).Equals("8") );
		Eval( (iGenC4Int.method2<object>().ToString()).Equals("8") );
		Eval( (iGenC4Int.method2<string>().ToString()).Equals("8") );
		Eval( (iGenC4Int.method2<A<int>>().ToString()).Equals("8") );
		Eval( (iGenC4Int.method2<S<string>>().ToString()).Equals("8") );

		Eval( (iGenC4String.method2<int>().ToString()).Equals("8") );
		Eval( (iGenC4String.method2<object>().ToString()).Equals("8") );
		Eval( (iGenC4String.method2<string>().ToString()).Equals("8") );
		Eval( (iGenC4String.method2<A<int>>().ToString()).Equals("8") );
		Eval( (iGenC4String.method2<S<string>>().ToString()).Equals("8") );

		Eval( (iGenC4Object.method2<int>().ToString()).Equals("8") );
		Eval( (iGenC4Object.method2<object>().ToString()).Equals("8") );
		Eval( (iGenC4Object.method2<string>().ToString()).Equals("8") );
		Eval( (iGenC4Object.method2<A<int>>().ToString()).Equals("8") );
		Eval( (iGenC4Object.method2<S<string>>().ToString()).Equals("8") );

	}

	public static int Main()
	{

		TestNonGenInterface_NonGenType();
		TestNonGenInterface_GenType();
		TestGenInterface_NonGenType();
		TestGenInterface_GenType();

		if (pass)
		{
			Console.WriteLine("PASS");
			return 100;
		}
		else
		{
			Console.WriteLine("FAIL");
			return 101;
		}

	}
}


text:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<meta http-equiv="Content-Type" content="text/html" charset="UTF-8">
<title>de.mash1t.chat.logging Class Hierarchy</title>
<meta name="date" content="2015-02-24">
<link rel="stylesheet" type="text/css" href="../../../../stylesheet.css" title="Style">

JavaScript is disabled on your browser.

Overview

Package

Class

Use

Tree

Deprecated

Index

Help

Prev

Next

Frames

No Frames

All Classes

Hierarchy For Package de.mash1t.chat.logging

Package Hierarchies:

All Packages

Class Hierarchy

java.lang.Object

de.mash1t.chat.logging.Counters

de.mash1t.chat.logging.Counters.Clients

de.mash1t.chat.logging.Counters.Totals

de.mash1t.chat.logging.Counters.Totals.Clients

de.mash1t.chat.logging.Counters.Totals.Messages

de.mash1t.chat.logging.CustomLogger

de.mash1t.chat.logging.LoggingController

Enum Hierarchy

java.lang.Object

java.lang.Enum<E> (implements java.lang.Comparable<T>, java.io.Serializable)

de.mash1t.chat.logging.LogPath

de.mash1t.chat.logging.LogDir

Overview

Package

Class

Use

Tree

Deprecated

Index

Help

Prev

Next

Frames

No Frames

All Classes


text:
package org.bouncycastle.openpgp.operator.jcajce;

import org.bouncycastle.asn1.ASN1ObjectIdentifier;

// temporary fix for 172.1 due to module export lacking in provider.
class CryptlibObjectIdentifiers
{
    public static final ASN1ObjectIdentifier cryptlib = new ASN1ObjectIdentifier("1.3.6.1.4.1.3029");

    public static final ASN1ObjectIdentifier ecc = cryptlib.branch("1").branch("5");

    public static final ASN1ObjectIdentifier curvey25519 = ecc.branch("1");
}


text:
using System.Collections.Generic;
using ZKWeb.Localize;
using ZKWebStandard.Extensions;
using ZKWebStandard.Ioc;

namespace ZKWeb.Plugins.Common.CustomTranslate.src.Components.Translates {
	/// <summary>
	/// 繁体中文翻译
	/// </summary>
	[ExportMany, SingletonReuse]
	public class zh_TW : ITranslateProvider {
		private static HashSet<string> Codes = new HashSet<string>() { "zh-TW" };
		private static Dictionary<string, string> Translates = new Dictionary<string, string>()
		{
			{ "CustomTranslate", "定制翻譯" },
			{ "Support custom translate through admin panel", "支持在管理後台中設置定制翻譯" },
			{ "Translation", "翻譯內容" },
			{ "Origin/Translated", "原文/譯文" },
			{ "OriginalText", "原文" },
			{ "TranslatedText", "譯文" }
		};

		public bool CanTranslate(string code) {
			return Codes.Contains(code);
		}

		public string Translate(string text) {
			return Translates.GetOrDefault(text);
		}
	}
}


text:
require 'rubygems'
require 'mechanize'

$FIRST_NAME = ''
$LAST_NAME = ''
$PHONE = ''
$EMAIL = ''

def start_url(eventId)
  return "https://www.weezevent.com/widget_billeterie.php?id_evenement=#{eventId}"
end

$url = start_url(ARGV[0])
$agent = Mechanize.new { |agent|
  agent.user_agent_alias = 'Mac Safari'
}

def get_ticket()
  # Get the start page
  start_page = $agent.get($url)
  # Bail if there are no reservations
  if start_page.forms.count != 1
    puts "Reservation unavailable"
    return false
  end

  # Fill in the details for the reservation
  start_form = start_page.forms.first
  start_form.field_with(:id => /quantite_[0-9]/).value = 1

  # Submit the details and get back the contact form
  contact_info_page = start_form.submit
  # Check for the existence and get the contact form
  contact_form = contact_info_page.forms.first

  # Fill in the contact details
  contact_form.field_with(:id => /champs_3/).value = $FIRST_NAME
  contact_form.field_with(:id => /champs_2/).value = $LAST_NAME
  contact_form.field_with(:id => /champs_5/).value = $EMAIL
  contact_form.field_with(:id => /champs_36/).value = $EMAIL
  contact_form.field_with(:id => /champs_7/).value = $PHONE
  contact_form.checkbox_with(:id => /accepte_cgv/).check
  # Submit the contact details and get confirmation page
  confirmation_page = contact_form.submit

  # Confirm the reservation
  puts "Got reservation"
  return true
end

# Running the script until we manage to get a ticket
while true
  result = get_ticket()
  break if result
end


text:
/************************************************************************
*
* Flood Project © (2008-201x)
* Licensed under the simplified BSD license. All rights reserved.
*
************************************************************************/

#pragma once

#include "API.h"
#include "StringExt.h"
#include "GfxContext.h"

#include <functional>
#include <array>
#include <vector>

namespace dit {

    //-----------------------------------//

    class InputBackend;
    typedef void* NativeWindowHandle;

    //-----------------------------------//

    enum class WindowStyles : uint32
    {
        None = 0
        , TopLevel = (1 << 1)     /// A top-level window is a window that is not a child.
        , MiniFrame = (1 << 2)    /// A miniframe is a window with minimal chrome.
        , Borderless = (1 << 3)   /// A borderless window has no chrome.
        , Fullscreen = (1 << 4)   /// Fullscreen windows take the full space of the screen.
    };

    //-----------------------------------//

    struct WindowSettings
    {
        WindowSettings() = default;
        WindowSettings(uint16 _width, uint16 _height, String _title, NativeWindowHandle _handle, WindowStyles _styles = WindowStyles::None)
            : width(_width), height(_height), styles(_styles), title(std::move(_title)), handle(_handle)
        {}

        uint16 width = 1280;
        uint16 height = 720;
        WindowStyles styles = WindowStyles::None;
        NativeWindowHandle handle = nullptr;
        String title = "";
    };

    //-----------------------------------//

    /**
     * Represents onscreen display areas in the target window system.
     */
    class Window : public GfxContext
    {
    public:
        typedef std::function<void(void)> DrawEventConsumer;
        typedef std::function<void(void)> UpdateEventConsumer;
        typedef std::function<void(uint16, uint16)> ResizeEventConsumer;
        typedef std::function<void(void)> CloseEventConsumer;
        typedef std::function<void(bool)> FocusEventConsumer;

    public:
        Window(const WindowSettings& settings);

        virtual GfxContext* CreateContext() = 0;

        virtual void Update()                               {}
        virtual void MakeCurrent()                          {}
        virtual void Show(bool visible = true)              {}
        virtual bool PumpEvents()                           { return true; }
        virtual void SetTitle(const String& title)          {}
        virtual void SetCursorVisible(bool state)           {}
        virtual bool IsCursorVisible() const                { return false; }
        virtual void SetCursorCapture(bool state)           {}
        std::array<int32, 2> GetCursorPosition() const      { return{ { 0, 0 } }; }
        virtual void SetCursorPosition(int32 x, int32 y)    {}
        virtual bool HasFocus() const                       { return false; }
        virtual InputBackend* GetInput()                    { return nullptr; }

    public:
        void HandleDraw();
        void HandleUpdate();
        void HandleResize();
        void HandleClose();
        void HandleFocus(bool focusLost);

    public:
        WindowSettings settings;
        GfxContext* ctx;

        std::vector<DrawEventConsumer> onDrawEvent;
        std::vector<UpdateEventConsumer> onUpdateEvent;
        std::vector<ResizeEventConsumer> onResizeEvent;
        std::vector<CloseEventConsumer> onCloseEvent;
        std::vector<FocusEventConsumer> onFocusEvent;
    };

    //-----------------------------------//

}


text:
    <button type="button"
        class="oui-header-tabs__slider oui-header-tabs__slider_left oui-icon oui-icon-chevron-left" aria-hidden="true"
        ng-click="$ctrl.scrollTo('left')"
        ng-show="$ctrl.canScroll && $ctrl.canScrollLeft">
    </button>

    <button type="button"
        class="oui-header-tabs__slider oui-header-tabs__slider_right oui-icon oui-icon-chevron-right" aria-hidden="true"
        ng-click="$ctrl.scrollTo('right')"
        ng-show="$ctrl.canScroll && $ctrl.canScrollRight">
    </button>


text:
UPGRADE FROM 2.x to 3.0
=======================

### StringLiteral

 * The `String` and `Null` classed and namespaces have been respectively renamed to
   `StringLiteral` and `NullValue` in order to be compatible with PHP 7.


text:
基于官方签名相关的工具apksigner的源码改造的安卓签名校验工具

## 使用事例

#### 查看帮助

	➜  java -jar ./CheckAndroidV2SignatureByAPKSig.jar
	usage:

		java -jar ./CheckAndroidV2SignatureByAPKSig.jar <command> [filePath]
		java -jar ./CheckAndroidV2SignatureByAPKSig.jar --version
		java -jar ./CheckAndroidV2SignatureByAPKSig.jar --help

	such as:

		java -jar ./CheckAndroidV2SignatureByAPKSig.jar ./test.apk
		java -jar ./CheckAndroidV2SignatureByAPKSig.jar --version
		java -jar ./CheckAndroidV2SignatureByAPKSig.jar --help

	after check,the result will be a string json such as:

		 {"ret":0,"msg":"ok","isV1OK":true,,"isV2":true"isV2OK":true}

		 ret: result code for check

			  0 : check File signature success
			 -1 : file not found
			 -2 : file not an Android APK file
			 -3 : check File signature error ,retry again

		 msg: result msg for check
		 isV1OK: whether the file's signature is ok or not
		 isV2: whether the file is use Android-V2 signature or not
		 isV2OK: whether the file's Android-V2 signature is ok or not

#### 查看版本

	➜  java -jar ./CheckAndroidV2SignatureByAPKSig.jar --version
com.tencent.ysdk.CheckAndroidV2Signature version 1.1.0 (CheckAndroidV2Signature - 4)

homepage : https://github.com/bihe0832/AndroidGetAPKInfo
blog : http://blog.bihe0832.com
github : https://github.com/bihe0832

#### 查看应用信息

	➜  java -jar ./CheckAndroidV2SignatureByAPKSig.jar ./YSDK_Android_1.3.1_629-debug-ysdktest-inner.apk
	{"ret":0,"msg":"","isV1OK":true,"isV2":false,"isV2OK":false,"keystoreMd5":"252e3ded833125ed3e3bb010bc24f4dc"}


text:
package com.microsoft.bingads.v12.reporting;

/**
 * Enum class for BidStrategyTypeReportFilter.
 */
public enum BidStrategyTypeReportFilter {

    MANUAL_CPC("ManualCpc"),
    ENHANCED_CPC("EnhancedCpc");

    private final String value;

    BidStrategyTypeReportFilter(String v) {
        value = v;
    }

    public String value() {
        return value;
    }

    public static BidStrategyTypeReportFilter fromValue(String v) {
        for (BidStrategyTypeReportFilter c : BidStrategyTypeReportFilter.values()) {
            if (c.value.equals(v)) {
                return c;
            }
        }
        throw new IllegalArgumentException(v);
    }
}


text:
package com.sun.mirror.apt;

import java.io.IOException;
import java.util.Collection;

/**
 * An annotation processor, used to examine and process the
 * annotations of program elements.  An annotation processor may,
 * for example, create new source files and XML documents to be used
 * in conjunction with the original code.
 *
 * <p> An annotation processor is constructed by a
 * {@linkplain AnnotationProcessorFactory factory}, which provides it with an
 * {@linkplain AnnotationProcessorEnvironment environment} that
 * encapsulates the state it needs.
 * Messages regarding warnings and errors encountered during processing
 * should be directed to the environment's {@link Messager},
 * and new files may be created using the environment's {@link Filer}.
 *
 * <p> Each annotation processor is created to process annotations
 * of a particular annotation type or set of annotation types.
 * It may use its environment to find the program elements with
 * annotations of those types.  It may freely examine any other program
 * elements in the course of its processing.
 *
 * @author Joseph D. Darcy
 * @author Scott Seligman
 * @since 1.5
 */

public interface AnnotationProcessor {

    /**
     * Process all program elements supported by this annotation processor.
     */
    void process();
}


text:
namespace storage {

STORAGE_COMMON_EXPORT std::string GetIdentifierFromOrigin(
    const GURL& origin);
STORAGE_COMMON_EXPORT GURL GetOriginFromIdentifier(
    const std::string& identifier);
STORAGE_COMMON_EXPORT bool IsValidOriginIdentifier(
    const std::string& identifier);

class STORAGE_COMMON_EXPORT DatabaseIdentifier {
 public:
  static const DatabaseIdentifier UniqueFileIdentifier();
  static DatabaseIdentifier CreateFromOrigin(const GURL& origin);
  static DatabaseIdentifier Parse(const std::string& identifier);
  ~DatabaseIdentifier();

  std::string ToString() const;
  GURL ToOrigin() const;

  std::string scheme() const { return scheme_; }
  std::string hostname() const { return hostname_; }
  int port() const { return port_; }
  bool is_unique() const { return is_unique_; }

 private:
  DatabaseIdentifier();
  DatabaseIdentifier(const std::string& scheme,
                     const std::string& hostname,
                     int port,
                     bool is_unique,
                     bool is_file);

  std::string scheme_;
  std::string hostname_;
  int port_;
  bool is_unique_;
  bool is_file_;
};

}  // namespace storage

#endif  // STORAGE_COMMON_DATABASE_DATABASE_IDENTIFIER_H_


text:
"""Tools and utils to create RLlib-ready recommender system envs using RecSim.

For examples on how to generate a RecSim env class (usable in RLlib):
See ray.rllib.examples.env.recommender_system_envs_with_recsim.py

For more information on google's RecSim itself:
https://github.com/google-research/recsim
"""

from collections import OrderedDict
import gym
from gym.spaces import Dict, Discrete, MultiDiscrete
import numpy as np
from recsim.document import AbstractDocumentSampler
from recsim.simulator import environment, recsim_gym
from recsim.user import AbstractUserModel, AbstractResponse
from typing import Callable, List, Optional, Type

from ray.rllib.env.env_context import EnvContext
from ray.rllib.utils.error import UnsupportedSpaceException
from ray.rllib.utils.spaces.space_utils import convert_element_to_space_type

class RecSimObservationSpaceWrapper(gym.ObservationWrapper):
    """Fix RecSim environment's observation space

    In RecSim's observation spaces, the "doc" field is a dictionary keyed by
    document IDs. Those IDs are changing every step, thus generating a
    different observation space in each time. This causes issues for RLlib
    because it expects the observation space to remain the same across steps.

    This environment wrapper fixes that by reindexing the documents by their
    positions in the list.
    """

    def __init__(self, env: gym.Env):
        super().__init__(env)
        obs_space = self.env.observation_space
        doc_space = Dict(
            OrderedDict(
                [
                    (str(k), doc)
                    for k, (_, doc) in enumerate(obs_space["doc"].spaces.items())
                ]
            )
        )
        self.observation_space = Dict(
            OrderedDict(
                [
                    ("user", obs_space["user"]),
                    ("doc", doc_space),
                    ("response", obs_space["response"]),
                ]
            )
        )
        self._sampled_obs = self.observation_space.sample()

    def observation(self, obs):
        new_obs = OrderedDict()
        new_obs["user"] = obs["user"]
        new_obs["doc"] = {str(k): v for k, (_, v) in enumerate(obs["doc"].items())}
        new_obs["response"] = obs["response"]
        new_obs = convert_element_to_space_type(new_obs, self._sampled_obs)
        return new_obs

class RecSimObservationBanditWrapper(gym.ObservationWrapper):
    """Fix RecSim environment's observation format

    RecSim's observations are keyed by document IDs, and nested under
    "doc" key.
    Our Bandits agent expects the observations to be flat 2D array
    and under "item" key.

    This environment wrapper converts obs into the right format.
    """

    def __init__(self, env: gym.Env):
        super().__init__(env)
        obs_space = self.env.observation_space

        num_items = len(obs_space["doc"])
        embedding_dim = next(iter(obs_space["doc"].values())).shape[-1]
        self.observation_space = Dict(
            OrderedDict(
                [
                    (
                        "item",
                        gym.spaces.Box(
                            low=-1.0, high=1.0, shape=(num_items, embedding_dim)
                        ),
                    ),
                ]
            )
        )
        self._sampled_obs = self.observation_space.sample()

    def observation(self, obs):
        new_obs = OrderedDict()
        new_obs["item"] = np.vstack(list(obs["doc"].values()))
        new_obs = convert_element_to_space_type(new_obs, self._sampled_obs)
        return new_obs

class RecSimResetWrapper(gym.Wrapper):
    """Fix RecSim environment's reset() and close() function

    RecSim's reset() function returns an observation without the "response"
    field, breaking RLlib's check. This wrapper fixes that by assigning a
    random "response".

    RecSim's close() function raises NotImplementedError. We change the
    behavior to doing nothing.
    """

    def __init__(self, env: gym.Env):
        super().__init__(env)
        self._sampled_obs = self.env.observation_space.sample()

    def reset(self):
        obs = super().reset()
        obs["response"] = self.env.observation_space["response"].sample()
        obs = convert_element_to_space_type(obs, self._sampled_obs)
        return obs

    def close(self):
        pass

class MultiDiscreteToDiscreteActionWrapper(gym.ActionWrapper):
    """Convert the action space from MultiDiscrete to Discrete

    At this moment, RLlib's DQN algorithms only work on Discrete action space.
    This wrapper allows us to apply DQN algorithms to the RecSim environment.
    """

    def __init__(self, env: gym.Env):
        super().__init__(env)

        if not isinstance(env.action_space, MultiDiscrete):
            raise UnsupportedSpaceException(
                f"Action space {env.action_space} "
                f"is not supported by {self.__class__.__name__}"
            )
        self.action_space_dimensions = env.action_space.nvec
        self.action_space = Discrete(np.prod(self.action_space_dimensions))

    def action(self, action: int) -> List[int]:
        """Convert a Discrete action to a MultiDiscrete action"""
        multi_action = [None] * len(self.action_space_dimensions)
        for idx, n in enumerate(self.action_space_dimensions):
            action, dim_action = divmod(action, n)
            multi_action[idx] = dim_action
        return multi_action

def recsim_gym_wrapper(
    recsim_gym_env: gym.Env,
    convert_to_discrete_action_space: bool = False,
    wrap_for_bandits: bool = False,
) -> gym.Env:
    """Makes sure a RecSim gym.Env can ba handled by RLlib.

    In RecSim's observation spaces, the "doc" field is a dictionary keyed by
    document IDs. Those IDs are changing every step, thus generating a
    different observation space in each time. This causes issues for RLlib
    because it expects the observation space to remain the same across steps.

    Also, RecSim's reset() function returns an observation without the
    "response" field, breaking RLlib's check. This wrapper fixes that by
    assigning a random "response".

    Args:
        recsim_gym_env: The RecSim gym.Env instance. Usually resulting from a
            raw RecSim env having been passed through RecSim's utility function:
            `recsim.simulator.recsim_gym.RecSimGymEnv()`.
        convert_to_discrete_action_space: Optional bool indicating, whether
            the action space of the created env class should be Discrete
            (rather than MultiDiscrete, even if slate size > 1). This is useful
            for algorithms that don't support MultiDiscrete action spaces,
            such as RLlib's DQN. If None, `convert_to_discrete_action_space`
            may also be provided via the EnvContext (config) when creating an
            actual env instance.
        wrap_for_bandits: Bool indicating, whether this RecSim env should be
            wrapped for use with our Bandits agent.

    Returns:
        An RLlib-ready gym.Env instance.
    """
    env = RecSimResetWrapper(recsim_gym_env)
    env = RecSimObservationSpaceWrapper(env)
    if convert_to_discrete_action_space:
        env = MultiDiscreteToDiscreteActionWrapper(env)
    if wrap_for_bandits:
        env = RecSimObservationBanditWrapper(env)
    return env

def make_recsim_env(
    recsim_user_model_creator: Callable[[EnvContext], AbstractUserModel],
    recsim_document_sampler_creator: Callable[[EnvContext], AbstractDocumentSampler],
    reward_aggregator: Callable[[List[AbstractResponse]], float],
) -> Type[gym.Env]:
    """Creates a RLlib-ready gym.Env class given RecSim user and doc models.

    See https://github.com/google-research/recsim for more information on how to
    build the required components from scratch in python using RecSim.

    Args:
        recsim_user_model_creator: A callable taking an EnvContext and returning
            a RecSim AbstractUserModel instance to use.
        recsim_document_sampler_creator: A callable taking an EnvContext and
            returning a RecSim AbstractDocumentSampler
            to use. This will include a AbstractDocument as well.
        reward_aggregator: Callable taking a list of RecSim
            AbstractResponse instances and returning a float (aggregated
            reward).

    Returns:
        An RLlib-ready gym.Env class to use inside a Trainer.
    """

    class _RecSimEnv(gym.Wrapper):
        def __init__(self, config: Optional[EnvContext] = None):

            # Override with default values, in case they are not set by the user.
            default_config = {
                "num_candidates": 10,
                "slate_size": 2,
                "resample_documents": True,
                "seed": 0,
                "convert_to_discrete_action_space": False,
                "wrap_for_bandits": False,
            }
            if config is None or isinstance(config, dict):
                config = EnvContext(config or default_config, worker_index=0)
            config.set_defaults(default_config)

            # Create the RecSim user model instance.
            recsim_user_model = recsim_user_model_creator(config)
            # Create the RecSim document sampler instance.
            recsim_document_sampler = recsim_document_sampler_creator(config)

            # Create a raw RecSim environment (not yet a gym.Env!).
            raw_recsim_env = environment.SingleUserEnvironment(
                recsim_user_model,
                recsim_document_sampler,
                config["num_candidates"],
                config["slate_size"],
                resample_documents=config["resample_documents"],
            )
            # Convert raw RecSim env to a gym.Env.
            gym_env = recsim_gym.RecSimGymEnv(raw_recsim_env, reward_aggregator)

            # Fix observation space and - if necessary - convert to discrete
            # action space (from multi-discrete).
            env = recsim_gym_wrapper(
                gym_env,
                config["convert_to_discrete_action_space"],
                config["wrap_for_bandits"],
            )
            # Call the super (Wrapper constructor) passing it the created env.
            super().__init__(env=env)

    return _RecSimEnv


text:
<!DOCTYPE html>
{% load staticfiles %}

        <title>Registro</title>
        <link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css">
        <link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap-theme.min.css">
        <link rel="stylesheet" href="{% static 'css/style.css' %}">

Registrate

        {% if registered %}
        Gracias por registrarte!
        Vuelve al homepage.

        {% else %}
        Registrate aquí!

        <form id="user_form" method="post" action="/rango/register/"
                enctype="multipart/form-data">

            {% csrf_token %}

            {{ user_form.as_p }}
            {{ profile_form.as_p }}

            <input type="submit" name="submit" value="Register" />
        </form>
        {% endif %}

Texto Grande

Texto Normal

Texto Chico


text:
package com.heliosapm.streams.jmx.metrics;

import java.lang.reflect.Method;

import javax.management.ImmutableDescriptor;
import javax.management.MBeanAttributeInfo;

import com.codahale.metrics.Gauge;
import com.codahale.metrics.Metric;
import com.codahale.metrics.Sampling;
import com.codahale.metrics.Snapshot;
import com.heliosapm.utils.collections.FluentMap;
import com.heliosapm.utils.reflect.PrivateAccessor;
import com.heliosapm.utils.tuples.NVP;

/**
 *
Title: MetricAttributeHandler

 *
Description: Generates MBeanInfo for a registered metric

 * @author Whitehead (nwhitehead AT heliosdev DOT org)
 *
com.heliosapm.streams.jmx.metrics.MetricAttributeHandler

 */

public interface MetricAttributeHandler {

	public NVP<Metric, MBeanAttributeInfo[]> minfo(final Metric metric);

	public static interface Getter {
		public Object get();
	}

	public static class AttributeGetter implements Getter {
		private final Object target;
		private final Method method;

		AttributeGetter(final Object target, final String methodName) {
			this.target = target;
			method = PrivateAccessor.findMethodFromClass(target.getClass(), methodName);
		}

		public Object get() {
			return PrivateAccessor.getMethodResult(method, target);
		}
	}

	public static class SnapshotAttributeGetter implements Getter {
		private final Snapshot target;
		private final Method method;

		SnapshotAttributeGetter(final Sampling target, final String methodName) {
			this.target = target.getSnapshot();
			method = PrivateAccessor.findMethodFromClass(Snapshot.class, methodName);
		}

		public Object get() {
			return PrivateAccessor.getMethodResult(method, target);
		}
	}

	public static class CounterMBeanInfoGenerator implements MetricAttributeHandler {
		@Override
		public NVP<Metric, MBeanAttributeInfo[]> minfo(final Metric metric) {
			return new NVP<Metric, MBeanAttributeInfo[]>(metric, new MBeanAttributeInfo[]{
				new MBeanAttributeInfo("Count", "long", "The counter's current value", true, false, false, new ImmutableDescriptor(FluentMap.newMap(String.class, Object.class)
						.fput("metricClass", com.codahale.metrics.Counter.class.getName())
						.fput("invoker", new AttributeGetter(metric, "getCount"))
						.fput("metricType", "counter")
					))
			});
		}
	}

	public static class GaugeMBeanInfoGenerator implements MetricAttributeHandler {
		@Override
		public NVP<Metric, MBeanAttributeInfo[]> minfo(final Metric metric) {
			final Object sample = ((Gauge<?>)metric).getValue();

			return new NVP<Metric, MBeanAttributeInfo[]>(metric, new MBeanAttributeInfo[]{
				new MBeanAttributeInfo("Gauge", sample.getClass().getName(), "The gauges's current value", true, false, false, new ImmutableDescriptor(FluentMap.newMap(String.class, Object.class)
						.fput("metricClass", com.codahale.metrics.Gauge.class.getName())
						.fput("invoker", new AttributeGetter(metric, "getValue"))
						.fput("metricType", "gauge")
					))
			});
		}
	}

	public static class MeterMBeanInfoGenerator implements MetricAttributeHandler {
		@Override
		public NVP<Metric, MBeanAttributeInfo[]> minfo(final Metric metric) {
			return new NVP<Metric, MBeanAttributeInfo[]>(metric, new MBeanAttributeInfo[]{
				new MBeanAttributeInfo("MeterCount", "long", "The number of events that have been marked", true, false, false, new ImmutableDescriptor(FluentMap.newMap(String.class, Object.class)
						.fput("metricClass", com.codahale.metrics.Meter.class.getName())
						.fput("invoker", new AttributeGetter(metric, "getCount"))
						.fput("metricType", "counter")
					)),
				new MBeanAttributeInfo("Rate15m", "double", "The fifteen-minute exponentially-weighted moving average rate at which events have occurred since the meter was created", true, false, false, new ImmutableDescriptor(FluentMap.newMap(String.class, Object.class)
						.fput("metricClass", com.codahale.metrics.Meter.class.getName())
						.fput("invoker", new AttributeGetter(metric, "getFifteenMinuteRate"))
						.fput("metricType", "gauge")
					)),
				new MBeanAttributeInfo("Rate5m", "double", "The five-minute exponentially-weighted moving average rate at which events have occurred since the meter was created", true, false, false, new ImmutableDescriptor(FluentMap.newMap(String.class, Object.class)
						.fput("metricClass", com.codahale.metrics.Meter.class.getName())
						.fput("invoker", new AttributeGetter(metric, "getFiveMinuteRate"))
						.fput("metricType", "gauge")
					)),
				new MBeanAttributeInfo("Rate1m", "double", "The one-minute exponentially-weighted moving average rate at which events have occurred since the meter was created", true, false, false, new ImmutableDescriptor(FluentMap.newMap(String.class, Object.class)
						.fput("metricClass", com.codahale.metrics.Meter.class.getName())
						.fput("invoker", new AttributeGetter(metric, "getOneMinuteRate"))
						.fput("metricType", "gauge")
					)),
				new MBeanAttributeInfo("MeanRate", "double", "The mean rate at which events have occurred since the meter was created", true, false, false, new ImmutableDescriptor(FluentMap.newMap(String.class, Object.class)
						.fput("metricClass", com.codahale.metrics.Meter.class.getName())
						.fput("invoker", new AttributeGetter(metric, "getMeanRate"))
						.fput("metricType", "gauge")
					))
			});
		}
	}

	public static class HistogramMBeanInfoGenerator implements MetricAttributeHandler {
		@Override
		public NVP<Metric, MBeanAttributeInfo[]> minfo(final Metric metric) {
			return new NVP<Metric, MBeanAttributeInfo[]>(metric, new MBeanAttributeInfo[]{
				new MBeanAttributeInfo("HistogramCount", "long", "The number of values that have been recorded", true, false, false, new ImmutableDescriptor(FluentMap.newMap(String.class, Object.class)
						.fput("metricClass", com.codahale.metrics.Histogram.class.getName())
						.fput("invoker", new AttributeGetter(metric, "getCount"))
						.fput("metricType", new AttributeGetter(metric, "counter"))
					)),
				new MBeanAttributeInfo("75thPct", "double", "The value at the 75th percentile in the distribution.", true, false, false, new ImmutableDescriptor(FluentMap.newMap(String.class, Object.class)
						.fput("metricClass", com.codahale.metrics.Histogram.class.getName())
						.fput("invoker", new AttributeGetter(metric, "get75thPercentile"))
						.fput("metricType", new SnapshotAttributeGetter((Sampling)metric, "gauge"))
					)),
				new MBeanAttributeInfo("95thPct", "double", "The value at the 95th percentile in the distribution.", true, false, false, new ImmutableDescriptor(FluentMap.newMap(String.class, Object.class)
						.fput("metricClass", com.codahale.metrics.Histogram.class.getName())
						.fput("invoker", new AttributeGetter(metric, "get95thPercentile"))
						.fput("metricType", new SnapshotAttributeGetter((Sampling)metric, "gauge"))
					)),
				new MBeanAttributeInfo("98thPct", "double", "The value at the 98th percentile in the distribution.", true, false, false, new ImmutableDescriptor(FluentMap.newMap(String.class, Object.class)
						.fput("metricClass", com.codahale.metrics.Histogram.class.getName())
						.fput("invoker", new AttributeGetter(metric, "get98thPercentile"))
						.fput("metricType", new SnapshotAttributeGetter((Sampling)metric, "gauge"))
					)),
				new MBeanAttributeInfo("99thPct", "double", "The value at the 99th percentile in the distribution.", true, false, false, new ImmutableDescriptor(FluentMap.newMap(String.class, Object.class)
						.fput("metricClass", com.codahale.metrics.Histogram.class.getName())
						.fput("invoker", new AttributeGetter(metric, "get99thPercentile"))
						.fput("metricType", new SnapshotAttributeGetter((Sampling)metric, "gauge"))
					)),
				new MBeanAttributeInfo("999thPct", "double", "The value at the 99.9th percentile in the distribution.", true, false, false, new ImmutableDescriptor(FluentMap.newMap(String.class, Object.class)
						.fput("metricClass", com.codahale.metrics.Histogram.class.getName())
						.fput("invoker", new AttributeGetter(metric, "get999thPercentile"))
						.fput("metricType", new SnapshotAttributeGetter((Sampling)metric, "gauge"))
					)),
				new MBeanAttributeInfo("HistogramMax", "double", "The highest value in the snapshot", true, false, false, new ImmutableDescriptor(FluentMap.newMap(String.class, Object.class)
						.fput("metricClass", com.codahale.metrics.Histogram.class.getName())
						.fput("invoker", new AttributeGetter(metric, "getMax"))
						.fput("metricType", new SnapshotAttributeGetter((Sampling)metric, "gauge"))
					)),
				new MBeanAttributeInfo("HistogramMin", "double", "The lowest value in the snapshot", true, false, false, new ImmutableDescriptor(FluentMap.newMap(String.class, Object.class)
						.fput("metricClass", com.codahale.metrics.Histogram.class.getName())
						.fput("invoker", new AttributeGetter(metric, "getMin"))
						.fput("metricType", new SnapshotAttributeGetter((Sampling)metric, "gauge"))
					)),
				new MBeanAttributeInfo("HistogramMean", "double", "The arithmetic mean of values in the snapshot", true, false, false, new ImmutableDescriptor(FluentMap.newMap(String.class, Object.class)
						.fput("metricClass", com.codahale.metrics.Histogram.class.getName())
						.fput("invoker", new AttributeGetter(metric, "getMean"))
						.fput("metricType", new SnapshotAttributeGetter((Sampling)metric, "gauge"))
					)),
				new MBeanAttributeInfo("HistogramMedian", "double", "The median of values in the snapshot", true, false, false, new ImmutableDescriptor(FluentMap.newMap(String.class, Object.class)
						.fput("metricClass", com.codahale.metrics.Histogram.class.getName())
						.fput("invoker", new AttributeGetter(metric, "getMedian"))
						.fput("metricType", new SnapshotAttributeGetter((Sampling)metric, "gauge"))
					)),
				new MBeanAttributeInfo("HistogramStdDev", "double", "The standard deviation of values in the snapshot", true, false, false, new ImmutableDescriptor(FluentMap.newMap(String.class, Object.class)
						.fput("metricClass", com.codahale.metrics.Histogram.class.getName())
						.fput("invoker", new AttributeGetter(metric, "getStdDev"))
						.fput("metricType", new SnapshotAttributeGetter((Sampling)metric, "gauge"))
					))
			});
		}
	}

	public static class TimerMBeanInfoGenerator implements MetricAttributeHandler {
		@Override
		public NVP<Metric, MBeanAttributeInfo[]> minfo(final Metric metric) {
			return new NVP<Metric, MBeanAttributeInfo[]>(metric, new MBeanAttributeInfo[]{
				new MBeanAttributeInfo("TimerCount", "long", "The number of events that have been marked", true, false, false, new ImmutableDescriptor(FluentMap.newMap(String.class, Object.class)
						.fput("metricClass", com.codahale.metrics.Timer.class.getName())
						.fput("invoker", new AttributeGetter(metric, "getCount"))
						.fput("metricType", new AttributeGetter(metric, "counter"))
					)),
				new MBeanAttributeInfo("TimerRate15m", "double", "The fifteen-minute exponentially-weighted moving average rate at which events have occurred since the meter was created", true, false, false, new ImmutableDescriptor(FluentMap.newMap(String.class, Object.class)
						.fput("metricClass", com.codahale.metrics.Meter.class.getName())
						.fput("invoker", new AttributeGetter(metric, "getFifteenMinuteRate"))
						.fput("metricType", "gauge")
					)),
				new MBeanAttributeInfo("TimerRate5m", "double", "The five-minute exponentially-weighted moving average rate at which events have occurred since the meter was created", true, false, false, new ImmutableDescriptor(FluentMap.newMap(String.class, Object.class)
						.fput("metricClass", com.codahale.metrics.Meter.class.getName())
						.fput("invoker", new AttributeGetter(metric, "getFiveMinuteRate"))
						.fput("metricType", "gauge")
					)),
				new MBeanAttributeInfo("TimerRate1m", "double", "The one-minute exponentially-weighted moving average rate at which events have occurred since the meter was created", true, false, false, new ImmutableDescriptor(FluentMap.newMap(String.class, Object.class)
						.fput("metricClass", com.codahale.metrics.Meter.class.getName())
						.fput("invoker", new AttributeGetter(metric, "getOneMinuteRate"))
						.fput("metricType", "gauge")
					)),
				new MBeanAttributeInfo("TimerMeanRate", "double", "The mean rate at which events have occurred since the meter was created", true, false, false, new ImmutableDescriptor(FluentMap.newMap(String.class, Object.class)
						.fput("metricClass", com.codahale.metrics.Meter.class.getName())
						.fput("invoker", new AttributeGetter(metric, "getMeanRate"))
						.fput("metricType", "gauge")
					)),

				new MBeanAttributeInfo("Timer75thPct", "double", "The value at the 75th percentile in the distribution.", true, false, false, new ImmutableDescriptor(FluentMap.newMap(String.class, Object.class)
						.fput("metricClass", com.codahale.metrics.Timer.class.getName())
						.fput("invoker", new AttributeGetter(metric, "get75thPercentile"))
						.fput("metricType", new SnapshotAttributeGetter((Sampling)metric, "gauge"))
					)),
				new MBeanAttributeInfo("Timer95thPct", "double", "The value at the 95th percentile in the distribution.", true, false, false, new ImmutableDescriptor(FluentMap.newMap(String.class, Object.class)
						.fput("metricClass", com.codahale.metrics.Timer.class.getName())
						.fput("invoker", new AttributeGetter(metric, "get95thPercentile"))
						.fput("metricType", new SnapshotAttributeGetter((Sampling)metric, "gauge"))
					)),
				new MBeanAttributeInfo("Timer98thPct", "double", "The value at the 98th percentile in the distribution.", true, false, false, new ImmutableDescriptor(FluentMap.newMap(String.class, Object.class)
						.fput("metricClass", com.codahale.metrics.Timer.class.getName())
						.fput("invoker", new AttributeGetter(metric, "get98thPercentile"))
						.fput("metricType", new SnapshotAttributeGetter((Sampling)metric, "gauge"))
					)),
				new MBeanAttributeInfo("Timer99thPct", "double", "The value at the 99th percentile in the distribution.", true, false, false, new ImmutableDescriptor(FluentMap.newMap(String.class, Object.class)
						.fput("metricClass", com.codahale.metrics.Timer.class.getName())
						.fput("invoker", new AttributeGetter(metric, "get99thPercentile"))
						.fput("metricType", new SnapshotAttributeGetter((Sampling)metric, "gauge"))
					)),
				new MBeanAttributeInfo("Timer999thPct", "double", "The value at the 99.9th percentile in the distribution.", true, false, false, new ImmutableDescriptor(FluentMap.newMap(String.class, Object.class)
						.fput("metricClass", com.codahale.metrics.Timer.class.getName())
						.fput("invoker", new AttributeGetter(metric, "get999thPercentile"))
						.fput("metricType", new SnapshotAttributeGetter((Sampling)metric, "gauge"))
					)),
				new MBeanAttributeInfo("TimerMax", "double", "The highest value in the snapshot", true, false, false, new ImmutableDescriptor(FluentMap.newMap(String.class, Object.class)
						.fput("metricClass", com.codahale.metrics.Timer.class.getName())
						.fput("invoker", new AttributeGetter(metric, "getMax"))
						.fput("metricType", new SnapshotAttributeGetter((Sampling)metric, "gauge"))
					)),
				new MBeanAttributeInfo("TimerMin", "double", "The lowest value in the snapshot", true, false, false, new ImmutableDescriptor(FluentMap.newMap(String.class, Object.class)
						.fput("metricClass", com.codahale.metrics.Timer.class.getName())
						.fput("invoker", new AttributeGetter(metric, "getMin"))
						.fput("metricType", new SnapshotAttributeGetter((Sampling)metric, "gauge"))
					)),
				new MBeanAttributeInfo("TimerMean", "double", "The arithmetic mean of values in the snapshot", true, false, false, new ImmutableDescriptor(FluentMap.newMap(String.class, Object.class)
						.fput("metricClass", com.codahale.metrics.Timer.class.getName())
						.fput("invoker", new AttributeGetter(metric, "getMean"))
						.fput("metricType", new SnapshotAttributeGetter((Sampling)metric, "gauge"))
					)),
				new MBeanAttributeInfo("TimerMedian", "double", "The median of values in the snapshot", true, false, false, new ImmutableDescriptor(FluentMap.newMap(String.class, Object.class)
						.fput("metricClass", com.codahale.metrics.Timer.class.getName())
						.fput("invoker", new AttributeGetter(metric, "getMedian"))
						.fput("metricType", new SnapshotAttributeGetter((Sampling)metric, "gauge"))
					)),
				new MBeanAttributeInfo("TimerStdDev", "double", "The standard deviation of values in the snapshot", true, false, false, new ImmutableDescriptor(FluentMap.newMap(String.class, Object.class)
						.fput("metricClass", com.codahale.metrics.Timer.class.getName())
						.fput("invoker", new AttributeGetter(metric, "getStdDev"))
						.fput("metricType", new SnapshotAttributeGetter((Sampling)metric, "gauge"))
					))
			});
		}
	}

}


text:
package com.google.cloud.bigtable.hbase.util;

import com.google.protobuf.ByteString;
import java.util.Arrays;
import java.util.List;
import java.util.Random;
import org.junit.Assert;
import org.junit.Test;

public class ZeroCopyByteStringUtilTest {

  private static final Random random = new Random(3141592653589L);

  @Test
  public void test_wrap() {
    List<byte[]> values = Arrays.asList(new byte[0], new byte[1], new byte[128], new byte[1024]);
    for (byte[] bytes : values) {
      random.nextBytes(bytes);
      ByteString byteString = ZeroCopyByteStringUtil.wrap(bytes);
      Assert.assertArrayEquals(bytes, byteString.toByteArray());
    }
  }

  @Test
  public void test_get() {
    List<ByteString> values =
        Arrays.asList(
            ByteString.EMPTY,
            ByteString.copyFromUtf8("x"),
            ByteString.copyFromUtf8("some text"),
            ByteString.copyFrom(new byte[128]),
            ByteString.copyFrom(new byte[1024]));

    ByteString rope = null;
    for (ByteString value : values) {
      Assert.assertArrayEquals(value.toByteArray(), ZeroCopyByteStringUtil.get(value));
      rope = rope == null ? value : rope.concat(value);
    }

    Assert.assertArrayEquals(rope.toByteArray(), ZeroCopyByteStringUtil.get(rope));
  }
}


text:
namespace TraktApiSharp.Tests.Modules.TraktUsersModule
{
    using FluentAssertions;
    using System;
    using System.Net;
    using System.Threading.Tasks;
    using TestUtils;
    using Traits;
    using TraktApiSharp.Exceptions;
    using TraktApiSharp.Objects.Get.Users;
    using TraktApiSharp.Responses;
    using Xunit;

    [Category("Modules.Users")]
    public partial class TraktUsersModule_Tests
    {
        private readonly string GET_FRIENDS_URI = $"users/{USERNAME}/friends";

        [Fact]
        public async Task Test_TraktUsersModule_GetFriends()
        {
            TraktClient client = TestUtility.GetMockClient(GET_FRIENDS_URI, FRIENDS_JSON);
            TraktListResponse<ITraktUserFriend> response = await client.Users.GetFriendsAsync(USERNAME);

            response.Should().NotBeNull();
            response.IsSuccess.Should().BeTrue();
            response.HasValue.Should().BeTrue();
            response.Value.Should().NotBeNull().And.HaveCount(2);
        }

        [Fact]
        public async Task Test_TraktUsersModule_GetFriends_With_OAuth_Enforced()
        {
            TraktClient client = TestUtility.GetOAuthMockClient(GET_FRIENDS_URI, FRIENDS_JSON);
            client.Configuration.ForceAuthorization = true;

            TraktListResponse<ITraktUserFriend> response = await client.Users.GetFriendsAsync(USERNAME);

            response.Should().NotBeNull();
            response.IsSuccess.Should().BeTrue();
            response.HasValue.Should().BeTrue();
            response.Value.Should().NotBeNull().And.HaveCount(2);
        }

        [Fact]
        public async Task Test_TraktUsersModule_GetFriends_With_ExtendedInfo()
        {
            TraktClient client = TestUtility.GetMockClient(
                $"{GET_FRIENDS_URI}?extended={EXTENDED_INFO}",
                FRIENDS_JSON);

            TraktListResponse<ITraktUserFriend> response =
                await client.Users.GetFriendsAsync(USERNAME, EXTENDED_INFO);

            response.Should().NotBeNull();
            response.IsSuccess.Should().BeTrue();
            response.HasValue.Should().BeTrue();
            response.Value.Should().NotBeNull().And.HaveCount(2);
        }

        [Fact]
        public void Test_TraktUsersModule_GetFriends_Throws_NotFoundException()
        {
            TraktClient client = TestUtility.GetMockClient(GET_FRIENDS_URI, HttpStatusCode.NotFound);
            Func<Task<TraktListResponse<ITraktUserFriend>>> act = () => client.Users.GetFriendsAsync(USERNAME);
            act.Should().Throw<TraktNotFoundException>();
        }

        [Fact]
        public void Test_TraktUsersModule_GetFriends_Throws_AuthorizationException()
        {
            TraktClient client = TestUtility.GetMockClient(GET_FRIENDS_URI, HttpStatusCode.Unauthorized);
            Func<Task<TraktListResponse<ITraktUserFriend>>> act = () => client.Users.GetFriendsAsync(USERNAME);
            act.Should().Throw<TraktAuthorizationException>();
        }

        [Fact]
        public void Test_TraktUsersModule_GetFriends_Throws_BadRequestException()
        {
            TraktClient client = TestUtility.GetMockClient(GET_FRIENDS_URI, HttpStatusCode.BadRequest);
            Func<Task<TraktListResponse<ITraktUserFriend>>> act = () => client.Users.GetFriendsAsync(USERNAME);
            act.Should().Throw<TraktBadRequestException>();
        }

        [Fact]
        public void Test_TraktUsersModule_GetFriends_Throws_ForbiddenException()
        {
            TraktClient client = TestUtility.GetMockClient(GET_FRIENDS_URI, HttpStatusCode.Forbidden);
            Func<Task<TraktListResponse<ITraktUserFriend>>> act = () => client.Users.GetFriendsAsync(USERNAME);
            act.Should().Throw<TraktForbiddenException>();
        }

        [Fact]
        public void Test_TraktUsersModule_GetFriends_Throws_MethodNotFoundException()
        {
            TraktClient client = TestUtility.GetMockClient(GET_FRIENDS_URI, HttpStatusCode.MethodNotAllowed);
            Func<Task<TraktListResponse<ITraktUserFriend>>> act = () => client.Users.GetFriendsAsync(USERNAME);
            act.Should().Throw<TraktMethodNotFoundException>();
        }

        [Fact]
        public void Test_TraktUsersModule_GetFriends_Throws_ConflictException()
        {
            TraktClient client = TestUtility.GetMockClient(GET_FRIENDS_URI, HttpStatusCode.Conflict);
            Func<Task<TraktListResponse<ITraktUserFriend>>> act = () => client.Users.GetFriendsAsync(USERNAME);
            act.Should().Throw<TraktConflictException>();
        }

        [Fact]
        public void Test_TraktUsersModule_GetFriends_Throws_ServerException()
        {
            TraktClient client = TestUtility.GetMockClient(GET_FRIENDS_URI, HttpStatusCode.InternalServerError);
            Func<Task<TraktListResponse<ITraktUserFriend>>> act = () => client.Users.GetFriendsAsync(USERNAME);
            act.Should().Throw<TraktServerException>();
        }

        [Fact]
        public void Test_TraktUsersModule_GetFriends_Throws_BadGatewayException()
        {
            TraktClient client = TestUtility.GetMockClient(GET_FRIENDS_URI, HttpStatusCode.BadGateway);
            Func<Task<TraktListResponse<ITraktUserFriend>>> act = () => client.Users.GetFriendsAsync(USERNAME);
            act.Should().Throw<TraktBadGatewayException>();
        }

        [Fact]
        public void Test_TraktUsersModule_GetFriends_Throws_PreconditionFailedException()
        {
            TraktClient client = TestUtility.GetMockClient(GET_FRIENDS_URI, (HttpStatusCode)412);
            Func<Task<TraktListResponse<ITraktUserFriend>>> act = () => client.Users.GetFriendsAsync(USERNAME);
            act.Should().Throw<TraktPreconditionFailedException>();
        }

        [Fact]
        public void Test_TraktUsersModule_GetFriends_Throws_ValidationException()
        {
            TraktClient client = TestUtility.GetMockClient(GET_FRIENDS_URI, (HttpStatusCode)422);
            Func<Task<TraktListResponse<ITraktUserFriend>>> act = () => client.Users.GetFriendsAsync(USERNAME);
            act.Should().Throw<TraktValidationException>();
        }

        [Fact]
        public void Test_TraktUsersModule_GetFriends_Throws_RateLimitException()
        {
            TraktClient client = TestUtility.GetMockClient(GET_FRIENDS_URI, (HttpStatusCode)429);
            Func<Task<TraktListResponse<ITraktUserFriend>>> act = () => client.Users.GetFriendsAsync(USERNAME);
            act.Should().Throw<TraktRateLimitException>();
        }

        [Fact]
        public void Test_TraktUsersModule_GetFriends_Throws_ServerUnavailableException_503()
        {
            TraktClient client = TestUtility.GetMockClient(GET_FRIENDS_URI, (HttpStatusCode)503);
            Func<Task<TraktListResponse<ITraktUserFriend>>> act = () => client.Users.GetFriendsAsync(USERNAME);
            act.Should().Throw<TraktServerUnavailableException>();
        }

        [Fact]
        public void Test_TraktUsersModule_GetFriends_Throws_ServerUnavailableException_504()
        {
            TraktClient client = TestUtility.GetMockClient(GET_FRIENDS_URI, (HttpStatusCode)504);
            Func<Task<TraktListResponse<ITraktUserFriend>>> act = () => client.Users.GetFriendsAsync(USERNAME);
            act.Should().Throw<TraktServerUnavailableException>();
        }

        [Fact]
        public void Test_TraktUsersModule_GetFriends_Throws_ServerUnavailableException_520()
        {
            TraktClient client = TestUtility.GetMockClient(GET_FRIENDS_URI, (HttpStatusCode)520);
            Func<Task<TraktListResponse<ITraktUserFriend>>> act = () => client.Users.GetFriendsAsync(USERNAME);
            act.Should().Throw<TraktServerUnavailableException>();
        }

        [Fact]
        public void Test_TraktUsersModule_GetFriends_Throws_ServerUnavailableException_521()
        {
            TraktClient client = TestUtility.GetMockClient(GET_FRIENDS_URI, (HttpStatusCode)521);
            Func<Task<TraktListResponse<ITraktUserFriend>>> act = () => client.Users.GetFriendsAsync(USERNAME);
            act.Should().Throw<TraktServerUnavailableException>();
        }

        [Fact]
        public void Test_TraktUsersModule_GetFriends_Throws_ServerUnavailableException_522()
        {
            TraktClient client = TestUtility.GetMockClient(GET_FRIENDS_URI, (HttpStatusCode)522);
            Func<Task<TraktListResponse<ITraktUserFriend>>> act = () => client.Users.GetFriendsAsync(USERNAME);
            act.Should().Throw<TraktServerUnavailableException>();
        }

        [Fact]
        public void Test_TraktUsersModule_GetFriends_ArgumentExceptions()
        {
            TraktClient client = TestUtility.GetMockClient(GET_FRIENDS_URI, FRIENDS_JSON);

            Func<Task<TraktListResponse<ITraktUserFriend>>> act = () => client.Users.GetFriendsAsync(null);
            act.Should().Throw<ArgumentNullException>();

            act = () => client.Users.GetFriendsAsync(string.Empty);
            act.Should().Throw<ArgumentException>();

            act = () => client.Users.GetFriendsAsync("user name");
            act.Should().Throw<ArgumentException>();
        }
    }
}


text:
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { CommonModule } from '@angular/common';
import { HttpClientModule } from '@angular/common/http';
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';

import { NgbModule, NgbDateParserFormatter, NgbDatepickerI18n } from '@ng-bootstrap/ng-bootstrap';
import { ToastrModule, ToastrService } from 'ngx-toastr';

import { UsedMaterialModule } from '../../shared/used-material.module';
import { EmployesService } from '../../service/employes.service';
import { Employe } from '../../shared/dto/employe';
import { inflexibilityPeriodListMock, areasMock } from '../../shared/tests-mocks/mocks';
import { EmployesComponent } from './employes.component';
import { EmployesModule } from '../employes.module';
import { EmployesDataSource } from '../employes-list/employes-list-datasource';
import { ConfirmationButtonModule } from '../../confirmation-button/confirmation-button.module';
import { ApplicationSharedData } from '../../shared/application-shared-data';
import { EmployeState, Profile } from '../../shared/enums';

let employeService: EmployesService;

const employes = <Employe[]>inflexibilityPeriodListMock[0].employes.concat(inflexibilityPeriodListMock[1].employes);
const loggedEmploye = JSON.parse(JSON.stringify(employes[0]));
const employe = new Employe();
loggedEmploye.id = 12;
loggedEmploye.name = 'name';
loggedEmploye.surname = 'surname';

const areas = areasMock;
employe.areaList = areas;

describe('EmployesComponent', () => {
  let component: EmployesComponent;
  let fixture: ComponentFixture<EmployesComponent>;
  beforeEach(async(() => {
    TestBed.configureTestingModule({
      providers: [EmployesService, ToastrService],
      imports: [
        CommonModule,
        BrowserAnimationsModule,
        HttpClientModule,
        FormsModule,
        ReactiveFormsModule,
        NgbModule.forRoot(),
        ToastrModule.forRoot(),
        EmployesModule,
        ConfirmationButtonModule,
        UsedMaterialModule
      ]
    })
      .compileComponents();
  }));

  beforeEach(async () => {
    fixture = TestBed.createComponent(EmployesComponent);
    component = fixture.componentInstance;
    employeService = fixture.debugElement.injector.get(EmployesService);

    const spyGetEmployes = spyOn(employeService, 'getEmployes').and.returnValue(Promise.resolve(employes));
    const spySaveEmploye = spyOn(employeService, 'saveEmploye').and.returnValue(Promise.resolve());
    const spyDeleteEmploye = spyOn(employeService, 'deleteEmploye').and.returnValue(Promise.resolve());
    const spyGetEmployesArea = spyOn(employeService, 'getAreas').and.returnValue(Promise.resolve(areas));
    fixture.detectChanges();

    component.employeModel = employe;
    employe.areaList = areas;
    component.areasAutocomplete.areas = areas;
    component.employesDataSource = new EmployesDataSource(employes);
    ApplicationSharedData.getInstance().loggedEmploye = loggedEmploye;
    fixture.detectChanges();
  });

  afterEach(function (done) {
    setTimeout(function () {
      done();
      ApplicationSharedData.getInstance().setEmpAutoCompInjectSearch(null);
    }, 30);
  });

  it('should be created', async () => {
    expect(component).toBeTruthy();
  });

  it('Trigger form validation.', async () => {
    component.employeForm.markAsTouched();
    fixture.detectChanges();
    expect(component.employeForm.invalid).toBe(true, 'Form validation should return true');
  });

  it('Trigger employe edit.', async () => {
    fixture.detectChanges();
    expect(function () {
      component['editEmploye'].call(component, employe);
    }).not.toThrow();
  });

  it('Trigger employe save.', async () => {
    fixture.detectChanges();
    expect(function () {
      component['saveEmploye'].call(component, employe);
    }).not.toThrow();
  });

  it('Trigger employe delete.', async () => {
    fixture.detectChanges();
    expect(function () {
      component['deleteEmploye'].call(component, employe);
    }).not.toThrow();
  });

  it('Select area.', async () => {
    fixture.detectChanges();
    component['selectedArea'].call(component, areas[0]);
    fixture.whenStable().then(() => {
      expect(component.employeModel.areaList[0].id).toBe(75);
    });
  });
});


text:
import '../polymer/polymer_bundled.min.js';
import '../paper-styles/default-theme.js';
import '../paper-styles/typography.js';

import {Polymer} from '../polymer/polymer_bundled.min.js';
import {html} from '../polymer/polymer_bundled.min.js';

import {PaperInputAddonBehavior} from './paper-input-addon-behavior.js';

/*
`<paper-input-error>` is an error message for use with
`<paper-input-container>`. The error is displayed when the
`<paper-input-container>` is `invalid`.

    <paper-input-container>
      <input pattern="[0-9]*">
      <paper-input-error slot="add-on">Only numbers are
allowed!</paper-input-error>
    </paper-input-container>

### Styling

The following custom properties and mixins are available for styling:

Custom property | Description | Default
----------------|-------------|----------
`--paper-input-container-invalid-color` | The foreground color of the error | `--error-color`
`--paper-input-error` | Mixin applied to the error | `{}`
*/
Polymer({
  _template: html`
    <style>
      :host {
        display: inline-block;
        visibility: hidden;

        color: var(--paper-input-container-invalid-color, var(--error-color));

        @apply --paper-font-caption;
        @apply --paper-input-error;
        position: absolute;
        left:0;
        right:0;
      }

      :host([invalid]) {
        visibility: visible;
      }

      #a11yWrapper {
        visibility: hidden;
      }

      :host([invalid]) #a11yWrapper {
        visibility: visible;
      }
    </style>

    <!--
    If the paper-input-error element is directly referenced by an
    \`aria-describedby\` attribute, such as when used as a paper-input add-on,
    then applying \`visibility: hidden;\` to the paper-input-error element itself
    does not hide the error.

    For more information, see:
    https://www.w3.org/TR/accname-1.1/#mapping_additional_nd_description
    -->
    <div id="a11yWrapper">
      <slot></slot>
    </div>
`,

  is: 'paper-input-error',
  behaviors: [PaperInputAddonBehavior],

  properties: {
    /**
     * True if the error is showing.
     */
    invalid: {readOnly: true, reflectToAttribute: true, type: Boolean}
  },

  /**
   * This overrides the update function in PaperInputAddonBehavior.
   * @param {{
   *   inputElement: (Element|undefined),
   *   value: (string|undefined),
   *   invalid: boolean
   * }} state -
   *     inputElement: The input element.
   *     value: The input value.
   *     invalid: True if the input value is invalid.
   */
  update: function(state) {
    this._setInvalid(state.invalid);
  }
});


text:
<!DOCTYPE html>

    <meta charset="utf-8" />
    <title>ESPrinkler2 Sched</title>
    <meta name="viewport" content="width=device-width, initial-scale=1">

    <link rel='stylesheet' href='/foundation.min.css'>

ESPrinkler2 Schedules

        Main Page

          <button id='save' class='button '>Save Schedules</button>
          <button id='load' class='button '>Load Schedules</button>

          <button id='save2' class='button '>Save Schedules</button>
          <button id='load2' class='button '>Load Schedules</button>


text:
/**
* Benchmark Boost `log1p`.
*/
#include <stdlib.h>
#include <stdio.h>
#include <math.h>
#include <time.h>
#include <sys/time.h>
#include <boost/random/mersenne_twister.hpp>
#include <boost/random/uniform_real_distribution.hpp>
#include <boost/math/special_functions/log1p.hpp>

using boost::random::uniform_real_distribution;
using boost::random::mt19937;

#define NAME "log1p"
#define ITERATIONS 1000000
#define REPEATS 3

/**
* Prints the TAP version.
*/
void print_version() {
	printf( "TAP version 13\n" );
}

/**
* Prints the TAP summary.
*
* @param total     total number of tests
* @param passing   total number of passing tests
*/
void print_summary( int total, int passing ) {
	printf( "#\n" );
	printf( "1..%d\n", total ); // TAP plan
	printf( "# total %d\n", total );
	printf( "# pass  %d\n", passing );
	printf( "#\n" );
	printf( "# ok\n" );
}

/**
* Prints benchmarks results.
*
* @param elapsed   elapsed time in seconds
*/
void print_results( double elapsed ) {
	double rate = (double)ITERATIONS / elapsed;
	printf( "  ---\n" );
	printf( "  iterations: %d\n", ITERATIONS );
	printf( "  elapsed: %0.9f\n", elapsed );
	printf( "  rate: %0.9f\n", rate );
	printf( "  ...\n" );
}

/**
* Returns a clock time.
*
* @return clock time
*/
double tic() {
	struct timeval now;
	gettimeofday( &now, NULL );
	return (double)now.tv_sec + (double)now.tv_usec/1.0e6;
}

/**
* Runs a benchmark.
*
* @return elapsed time in seconds
*/
double benchmark() {
	double elapsed;
	double x;
	double y;
	double t;
	int i;

	// Define a new pseudorandom number generator:
	mt19937 rng;

	// Define a uniform distribution for generating pseudorandom numbers as "doubles" between a minimum value (inclusive) and a maximum value (exclusive):
	uniform_real_distribution<> randu( 0.0, 1000.0 );

	t = tic();
	for ( i = 0; i < ITERATIONS; i++ ) {
		x = randu( rng );
		y = boost::math::log1p( x );
		if ( y != y ) {
			printf( "should not return NaN\n" );
			break;
		}
	}
	elapsed = tic() - t;
	if ( y != y ) {
		printf( "should not return NaN\n" );
	}
	return elapsed;
}

/**
* Main execution sequence.
*/
int main( void ) {
	double elapsed;
	int i;

	print_version();
	for ( i = 0; i < REPEATS; i++ ) {
		printf( "# cpp::boost::%s\n", NAME );
		elapsed = benchmark();
		print_results( elapsed );
		printf( "ok %d benchmark finished\n", i+1 );
	}
	print_summary( REPEATS, REPEATS );
	return 0;
}


text:
package com.garyhu.citypickerdemo.widget.behaviordemo;

import android.content.Context;
import android.support.design.widget.CoordinatorLayout;
import android.support.design.widget.TabLayout;
import android.util.AttributeSet;
import android.view.View;

import com.garyhu.citypickerdemo.R;

/**
 * Created by cqll on 2016/12/13.
 */

public class NameBehavior extends CoordinatorLayout.Behavior{
    private float mPaddingIcon, mPaddingScore,mIconSizeStart,mIconSizeEnd,mHeightToolbar,mChildWidth,mChildHeight,mWidth,mIconDistanceY,mIconDistanceX;
    private float mFractionScale=0.1f;//缩小的比例
    private int mTabMaxTranslation,mEditorPadding;
    public NameBehavior() {
    }

    public NameBehavior(Context context, AttributeSet attrs) {
        super(context, attrs);
        mHeightToolbar = context.getResources().getDimensionPixelOffset(R.dimen.toolbar_height);
        mIconSizeStart = context.getResources().getDimensionPixelOffset(R.dimen.img_icon_height_start);
        mIconSizeEnd = context.getResources().getDimensionPixelOffset(R.dimen.img_icon_height_end);
        mPaddingIcon = context.getResources().getDimensionPixelOffset(R.dimen.icon_padding);
        mPaddingScore = context.getResources().getDimensionPixelOffset(R.dimen.score_padding);
        mWidth=context.getResources().getDisplayMetrics().widthPixels;
        mEditorPadding =context.getResources().getDimensionPixelOffset(R.dimen.editor_padding);
    }

    //移动到指定位置
    @Override
    public boolean onLayoutChild(CoordinatorLayout parent, View child, int layoutDirection) {
        parent.onLayoutChild(child,layoutDirection);
        mChildWidth=child.getWidth();
        mChildHeight=child.getHeight();

        int scoreHeight=parent.findViewById(R.id.lyt_score).getHeight();
        mIconDistanceY =mChildHeight/2+ scoreHeight/2+ mPaddingScore +mIconSizeStart+mHeightToolbar-mHeightToolbar/4;
        mIconDistanceX = mWidth / 2 - parent.findViewById(R.id.img_back).getRight() - mIconSizeEnd - mPaddingIcon -mChildWidth/2;

        //tab最大的translation的距离
        mTabMaxTranslation= (int) (parent.findViewById(R.id.tab_layout).getTop()-mHeightToolbar-mEditorPadding);

        child.offsetTopAndBottom((int) (mHeightToolbar+mIconSizeStart+scoreHeight/2+ mPaddingScore ));
        child.offsetLeftAndRight((int) (mWidth/2-mChildWidth/2));
        return true;
    }

    @Override
    public boolean layoutDependsOn(CoordinatorLayout parent, View child, View dependency) {
        return dependency instanceof TabLayout;
    }

    @Override
    public boolean onDependentViewChanged(CoordinatorLayout parent, View child, View dependency) {
        //计算移动的比例 0~1
        float fraction = Math.abs(dependency.getTranslationY())/ mTabMaxTranslation;

        //缩小
        child.setPivotX(0);
        child.setPivotY(child.getHeight()/2);
        child.setScaleX(1-fraction*mFractionScale);
        child.setScaleY(1-fraction*mFractionScale);

        child.setTranslationY(-mIconDistanceY * fraction);
        child.setTranslationX(-mIconDistanceX * fraction);
        return true;
    }
}


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace SiteMapАndNavigation
{
    public partial class Plovdiv : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }
    }
}


text:
package com.opengamma.strata.function.calculation.rate.fra;

import com.opengamma.strata.finance.rate.fra.ExpandedFra;
import com.opengamma.strata.pricer.rate.RatesProvider;

/**
 * Calculates the par spread of a {@code FraTrade} for each of a set of scenarios.
 */
public class FraParSpreadFunction
    extends AbstractFraFunction<Double> {

  @Override
  protected Double execute(ExpandedFra product, RatesProvider provider) {
    return pricer().parSpread(product, provider);
  }

}


text:
using System.Collections.Generic;
using Nop.Core.Domain.Common;
using Nop.Core.Domain.Customers;
using Nop.Core.Domain.Orders;

namespace Nop.Core.Domain.Affiliates
{
    /// <summary>
    /// Represents an affiliate
    /// </summary>
    public partial class Affiliate : BaseEntity
    {
        private ICollection<Customer> _affiliatedCustomers;
        private ICollection<Order> _affiliatedOrders;

        public virtual int AddressId { get; set; }

        /// <summary>
        /// Gets or sets a value indicating whether the entity has been deleted
        /// </summary>
        public virtual bool Deleted { get; set; }

        /// <summary>
        /// Gets or sets a value indicating whether the entity is active
        /// </summary>
        public virtual bool Active { get; set; }

        public virtual Address Address { get; set; }

        public virtual ICollection<Customer> AffiliatedCustomers
        {
            get { return _affiliatedCustomers ?? (_affiliatedCustomers = new List<Customer>()); }
            protected set { _affiliatedCustomers = value; }
        }

        public virtual ICollection<Order> AffiliatedOrders
        {
            get { return _affiliatedOrders ?? (_affiliatedOrders = new List<Order>()); }
            protected set { _affiliatedOrders = value; }
        }
    }
}


text:
ACCEPTED

#### According to
Index Fungorum

#### Published in
null

#### Original name
Hercospora nigrescens Bonord.

### Remarks
null


text:
require 'test_helper'

class Api::CollectionTest < Api::BaseTest

  def setup
    super
    10.times.each { Api::Item.create( name: "Item #{ Time.now.to_i }", quantity: Random.new.rand( 100 ) ) }
  end

  test ".all" do
    items = Api::Item.all

    assert_kind_of Array, items
    assert_equal items.length, 10
    assert_kind_of Api::Item, items.first
  end

  test ".page" do
    ordered_items = Api::Item.order id: "asc"
    items = Api::Item.order(id: "asc").page(2).per(3)

    assert_equal items.length, 3
    assert_equal items.first.id, ordered_items[3].id
  end

  test ".order" do
    unordered_items = Api::Item.all
    ordered_items = Api::Item.order(id: "asc")

    unordered_items.sort! { |a,b| a.id <=> b.id }

    assert_equal ordered_items.length, unordered_items.length
    assert_equal ordered_items.first.id, unordered_items.first.id
    assert_equal ordered_items.last.id, unordered_items.last.id
  end

  test ".where" do
    items = Api::Item.all
    filtered_items = Api::Item.order(id: "desc").where(id: items.first.id )

    assert_equal filtered_items.length, 1
    assert_equal filtered_items.first.id, items.first.id
  end

  test ".remote_query" do
    searched_quantity = 40
    filtered_items = Api::Item.all.select{ |it| it.quantity > searched_quantity }
    remote_query = Api::Item.remote_query(resource: 'items/custom_resource', params: { quantity: searched_quantity }).remote_fetch

    assert_equal filtered_items.length, remote_query.length
  end

  test ".create" do
    item = Api::Item.create( name: "Item #{ Time.now.to_i }", quantity: 23.2 )
    assert_kind_of Integer, item.id
    assert_kind_of Api::Item, item
  end

  test ".find" do
    item = Api::Item.create( name: "Item #{ Time.now.to_i }", quantity: 23.2 )
    item2 = Api::Item.find item.id
    assert item.id == item2.id
    assert item.name == item2.name
    assert item.quantity == item2.quantity
    assert_kind_of Api::Item, item
    assert_kind_of Api::Item, item2
  end

  test ".each" do
    i = 0
    items = Api::Item.order(id: "asc").page(2).per(3)
    items.each do | it |
      i += 1
    end
    assert_equal items.length, i
  end

end


text:
/* eslint-disable no-underscore-dangle */
import { cleanConfig, defaultTheme, themeTemplate, validConfigValue } from './utils'

class Themer {
  constructor() {
    this._themeConfig = defaultTheme
    this._onChangeListeners = []
  }

  _callListeners() {
    this._onChangeListeners.forEach(listener => {
      listener(this._themeConfig)
    })
  }

  get themeConfig() {
    return this._themeConfig
  }

  set themeConfig(themeConfig) {
    this._themeConfig = cleanConfig(themeConfig)
    this._callListeners()
  }

  get(section, sectionKey) {
    if (!this._themeConfig) {
      console.warn(
        'Snacks theme error: No themeConfig defined. Please use Themer template: ',
        themeTemplate
      )
    } else if (validConfigValue(section, sectionKey)) {
      return this._themeConfig[section][sectionKey]
    }
  }

  set(section, sectionKey, themeValue) {
    if (validConfigValue(section, sectionKey)) {
      this._themeConfig[section][sectionKey] = themeValue
      this._callListeners()
    }
  }

  subscribe(listener) {
    this._onChangeListeners.push(listener)

    const unsubscribe = () => {
      const index = this._onChangeListeners.indexOf(listener)
      if (index === -1) {
        return
      }
      this._onChangeListeners.splice(index, 1)
    }

    return unsubscribe
  }
}

export default new Themer()


text:
<?php
namespace modmore\Gitify\Command;

use modmore\Gitify\BaseCommand;
use modmore\Gitify\Mixins\DownloadModx;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Question\Question;

/**
 * Class BuildCommand
 *
 * Installs a clean version of MODX.
 *
 * @package modmore\Gitify\Command
 */
class InstallModxCommand extends BaseCommand
{
    use DownloadModx;

    public $loadConfig = false;
    public $loadMODX = false;

    protected function configure()
    {
        $this
            ->setName('modx:install')
            ->setAliases(array('install:modx'))
            ->setDescription('Downloads, configures and installs a fresh MODX installation. [Note: <info>install:modx</info> will be removed in 1.0, use <info>modx:install</info> instead]')
            ->addArgument(
                'version',
                InputArgument::OPTIONAL,
                'The version of MODX to install, in the format 2.3.2-pl. Leave empty or specify "latest" to install the last stable release.',
                'latest'
            )
            ->addOption(
                'download',
                'd',
                InputOption::VALUE_NONE,
                'Force download the MODX package even if it already exists in the cache folder.'
            );
    }

    /**
     * Runs the command.
     *
     * @param InputInterface $input
     * @param OutputInterface $output
     * @return int
     */
    protected function execute(InputInterface $input, OutputInterface $output)
    {
        $version = $this->input->getArgument('version');
        $forced = $this->input->getOption('download');

        if (!$this->getMODX($version, $forced)) {
            return 1; // exit
        }

        // Create the XML config
        $config = $this->createMODXConfig();

        // Variables for running the setup
        $tz = date_default_timezone_get();
        $wd = GITIFY_WORKING_DIR;
        $output->writeln("Running MODX Setup...");

        // Actually run the CLI setup
        exec("php -d date.timezone={$tz} {$wd}setup/index.php --installmode=new --config={$config}", $setupOutput);
        $output->writeln("<comment>{$setupOutput[0]}</comment>");

        // Try to clean up the config file
        if (!unlink($config)) {
            $output->writeln("<warning>Warning:: could not clean up the setup config file, please remove this manually.</warning>");
        }

        $output->writeln('Done! ' . $this->getRunStats());
        return 0;
    }

    /**
     * Asks the user to complete a bunch of details and creates a MODX CLI config xml file
     */
    protected function createMODXConfig()
    {
        $directory = GITIFY_WORKING_DIR;

        // Creating config xml to install MODX with
        $this->output->writeln("Please complete following details to install MODX. Leave empty to use the [default].");

        $helper = $this->getHelper('question');

        $defaultDbName = basename(GITIFY_WORKING_DIR);
        $question = new Question("Database Name [{$defaultDbName}]: ", $defaultDbName);
        $dbName = $helper->ask($this->input, $this->output, $question);

        $question = new Question('Database User [root]: ', 'root');
        $dbUser = $helper->ask($this->input, $this->output, $question);

        $question = new Question('Database Password: ');
        $question->setHidden(true);
        $dbPass = $helper->ask($this->input, $this->output, $question);

        $question = new Question('Hostname [' . gethostname() . ']: ', gethostname());
        $host = $helper->ask($this->input, $this->output, $question);
        $host = rtrim(trim($host), '/');

        $defaultBaseUrl = '/';
        $question = new Question('Base URL [' . $defaultBaseUrl . ']: ', $defaultBaseUrl);
        $baseUrl = $helper->ask($this->input, $this->output, $question);
        $baseUrl = '/' . trim(trim($baseUrl), '/') . '/';
        $baseUrl = str_replace('//', '/', $baseUrl);

        $question = new Question('Manager Language [en]: ', 'en');
        $language = $helper->ask($this->input, $this->output, $question);

        $defaultMgrUser = basename(GITIFY_WORKING_DIR) . '_admin';
        $question = new Question('Manager User [' . $defaultMgrUser . ']: ', $defaultMgrUser);
        $managerUser = $helper->ask($this->input, $this->output, $question);

        $question = new Question('Manager User Password [generated]: ', 'generate');
        $question->setHidden(true);
        $question->setValidator(function ($value) {
            if (empty($value) || strlen($value) < 8) {
                throw new \RuntimeException(
                    'Please specify a password of at least 8 characters to continue.'
                );
            }

            return $value;
        });
        $managerPass = $helper->ask($this->input, $this->output, $question);

        if ($managerPass == 'generate') {
            $managerPass = substr(str_shuffle(md5(microtime(true))), 0, rand(8, 15));
            $this->output->writeln("<info>Generated Manager Password: {$managerPass}</info>");
        }

        $question = new Question('Manager Email: ');
        $managerEmail = $helper->ask($this->input, $this->output, $question);

        $configXMLContents = "<modx>
            <database_type>mysql</database_type>
            <database_server>localhost</database_server>
            <database>{$dbName}</database>
            <database_user>{$dbUser}</database_user>
            <database_password>{$dbPass}</database_password>
            <database_connection_charset>utf8</database_connection_charset>
            <database_charset>utf8</database_charset>
            <database_collation>utf8_general_ci</database_collation>
            <table_prefix>modx_</table_prefix>
            <https_port>443</https_port>
            <http_host>{$host}</http_host>
            <cache_disabled>0</cache_disabled>
            <inplace>1</inplace>
            <unpacked>0</unpacked>
            <language>{$language}</language>
            <cmsadmin>{$managerUser}</cmsadmin>
            <cmspassword>{$managerPass}</cmspassword>
            <cmsadminemail>{$managerEmail}</cmsadminemail>
            <core_path>{$directory}core/</core_path>
            <context_mgr_path>{$directory}manager/</context_mgr_path>
            <context_mgr_url>{$baseUrl}manager/</context_mgr_url>
            <context_connectors_path>{$directory}connectors/</context_connectors_path>
            <context_connectors_url>{$baseUrl}connectors/</context_connectors_url>
            <context_web_path>{$directory}</context_web_path>
            <context_web_url>{$baseUrl}</context_web_url>
            <remove_setup_directory>1</remove_setup_directory>
        </modx>";

        $fh = fopen($directory . 'config.xml', "w+");
        fwrite($fh, $configXMLContents);
        fclose($fh);

        return $directory . 'config.xml';
    }

}


text:
using System;

namespace LianZhao
{
    public class ExceptionEventArgs : EventArgs
    {
        private bool _handled;

        public Exception Exception { get; private set; }

        public bool Handled
        {
            get
            {
                return _handled;
            }
            set
            {
                if (value)
                {
                    _handled = true;
                }
            }
        }

        public ExceptionEventArgs(Exception exception)
        {
            Exception = exception;
        }
    }
}


text:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <parent>
    <groupId>alien4cloud</groupId>
    <artifactId>alien4cloud-parent</artifactId>
    <version>1.0.0-SM24</version>
  </parent>
  <artifactId>alien4cloud-common</artifactId>
  <name>Alien 4 Cloud Common</name>
  <description>Contains classes common to all alien's subprojects.</description>

  <properties>
    <sonar.java.coveragePlugin>jacoco</sonar.java.coveragePlugin>
    <sonar.dynamicAnalysis>reuseReports</sonar.dynamicAnalysis>
    <sonar.language>java</sonar.language>
    <sonar.jacoco.reportPath>${project.basedir}/../target/jacoco.exec</sonar.jacoco.reportPath>
    <sonar.jacoco.itReportPath>${project.basedir}/../target/jacoco-it.exec</sonar.jacoco.itReportPath>
  </properties>

  <dependencies>
    <dependency>
      <groupId>org.eclipse.jgit</groupId>
      <artifactId>org.eclipse.jgit</artifactId>
      <version>3.4.1.201406201815-r</version>
    </dependency>
    <dependency>
      <groupId>com.google.guava</groupId>
      <artifactId>guava</artifactId>
    </dependency>
    <dependency>
      <groupId>org.apache.commons</groupId>
      <artifactId>commons-lang3</artifactId>
    </dependency>
    <dependency>
      <groupId>org.apache.commons</groupId>
      <artifactId>commons-collections4</artifactId>
    </dependency>
    <dependency>
      <groupId>org.apache.commons</groupId>
      <artifactId>commons-compress</artifactId>
    </dependency>
    <dependency>
      <groupId>fr.lucboutier.elasticsearch</groupId>
      <artifactId>elasticsearch-mapping</artifactId>
    </dependency>
    <dependency>
      <groupId>org.yaml</groupId>
      <artifactId>snakeyaml</artifactId>
    </dependency>
    <dependency>
      <groupId>org.springframework</groupId>
      <artifactId>spring-beans</artifactId>
    </dependency>
    <dependency>
      <groupId>org.springframework</groupId>
      <artifactId>spring-aop</artifactId>
    </dependency>
    <dependency>
      <groupId>org.springframework</groupId>
      <artifactId>spring-aspects</artifactId>
    </dependency>
    <dependency>
      <groupId>org.springframework.boot</groupId>
      <artifactId>spring-boot-actuator</artifactId>
    </dependency>
    <dependency>
      <groupId>org.aspectj</groupId>
      <artifactId>aspectjrt</artifactId>
    </dependency>
    <dependency>
      <groupId>org.aspectj</groupId>
      <artifactId>aspectjweaver</artifactId>
    </dependency>
    <!-- Not every alien project need http client (rest utilities), the one who uses must add it by it-self in order to not to have to embark http-client in server
      web archive -->
    <dependency>
      <groupId>org.apache.httpcomponents</groupId>
      <artifactId>httpclient</artifactId>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>org.apache.httpcomponents</groupId>
      <artifactId>httpmime</artifactId>
      <scope>provided</scope>
    </dependency>
    <!-- Bean validations -->
    <dependency>
      <groupId>javax.validation</groupId>
      <artifactId>validation-api</artifactId>
    </dependency>
    <!-- logging -->
    <dependency>
      <groupId>org.slf4j</groupId>
      <artifactId>slf4j-api</artifactId>
    </dependency>
    <dependency>
      <groupId>org.slf4j</groupId>
      <artifactId>slf4j-log4j12</artifactId>
    </dependency>
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.mockito</groupId>
      <artifactId>mockito-all</artifactId>
    </dependency>
  </dependencies>

  <build>
    <resources>
      <resource>
        <directory>src/main/resources/</directory>
        <filtering>true</filtering>
      </resource>
    </resources>
  </build>
</project>


text:
require "spec_helper"

describe Derelict::Plugin do
  let(:name) { double("name") }
  let(:version) { double("version") }
  let(:plugin) { Derelict::Plugin.new name, version }
  subject { plugin }

  it "is autoloaded" do
    should be_a Derelict::Plugin
  end

  its(:name) { should be name }
  its(:version) { should be version }

  context "when comparing to an equivalent" do
    let(:other) { plugin.dup }

    it { should eq other }
    its(:hash) { should eq other.hash }

    specify "#eql?(other) should be true" do
      expect(subject.eql? other).to be true
    end
  end

  context "when comparing to a non-equivalent" do
    let(:other) { plugin.class.new "not_foo", "1.0" }

    it { should_not eq other }
    its(:hash) { should_not eq other.hash }

    specify "#eql?(other) should be false" do
      expect(subject.eql? other).to be false
    end
  end
end