text:
using System.Windows.Input;
using Prism.Commands;
using Prism.Navigation;
using Xamarin.Camera.ViewModels.Interfaces;

namespace Xamarin.Camera.ViewModels
{

    public sealed class SettingPageViewModel : ViewModelBase, ISettingPageViewModel
    {

        #region Constructors

        public SettingPageViewModel(INavigationService navigationService)
            : base(navigationService)
        {
            this.Title = "Setting";
        }

        #endregion

        #region Properties

        private string _Title;

        public string Title
        {
            get => this._Title;
            private set => this.SetProperty(ref this._Title, value);
        }

        #endregion

        #region Methods

        #region Overrids

        #endregion

        #region Event Handlers

        #endregion

        #region Helpers

        #endregion

        #endregion

    }

}


text:
<?xml version="1.0" encoding="UTF-8"?>

<!--

 This file is part of the Sylius package.

 (c) Paweł Jędrzejewski

 For the full copyright and license information, please view the LICENSE
 file that was distributed with this source code.

-->

<container xmlns="http://symfony.com/schema/dic/services"
           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
           xsi:schemaLocation="http://symfony.com/schema/dic/services
                               http://symfony.com/schema/dic/services/services-1.0.xsd">

    <parameters>
        <parameter key="sylius.form.type.shipping_calculator_choice.class">Sylius\Bundle\ShippingBundle\Form\Type\CalculatorChoiceType</parameter>

        <parameter key="sylius.form.type.shipping_rule_item_count_configuration.class">Sylius\Bundle\ShippingBundle\Form\Type\Rule\ItemCountConfigurationType</parameter>

        <parameter key="sylius.shipping_methods_resolver.class">Sylius\Component\Shipping\Resolver\MethodsResolver</parameter>

        <parameter key="sylius.registry.shipping_calculator.class">Sylius\Component\Registry\ServiceRegistry</parameter>
        <parameter key="sylius.shipping_calculator.class">Sylius\Component\Shipping\Calculator\DelegatingCalculator</parameter>

        <parameter key="sylius.registry.shipping_rule_checker.class">Sylius\Component\Registry\ServiceRegistry</parameter>

        <parameter key="sylius.shipping_eligibility_checker.class">Sylius\Component\Shipping\Checker\ShippingMethodEligibilityChecker</parameter>
        <parameter key="sylius.shipping_rule_checker.item_count.class">Sylius\Component\Shipping\Checker\ItemCountRuleChecker</parameter>

        <parameter key="sylius.shipping_calculator.flat_rate.class">Sylius\Component\Shipping\Calculator\FlatRateCalculator</parameter>
        <parameter key="sylius.form.type.shipping_calculator.flat_rate.class">Sylius\Bundle\ShippingBundle\Form\Type\Calculator\FlatRateConfigurationType</parameter>

        <parameter key="sylius.shipping_calculator.per_item_rate.class">Sylius\Component\Shipping\Calculator\PerItemRateCalculator</parameter>
        <parameter key="sylius.form.type.shipping_calculator.per_item_rate.class">Sylius\Bundle\ShippingBundle\Form\Type\Calculator\PerItemRateConfigurationType</parameter>

        <parameter key="sylius.shipping_calculator.flexible_rate.class">Sylius\Component\Shipping\Calculator\FlexibleRateCalculator</parameter>
        <parameter key="sylius.form.type.shipping_calculator.flexible_rate.class">Sylius\Bundle\ShippingBundle\Form\Type\Calculator\FlexibleRateConfigurationType</parameter>

        <parameter key="sylius.shipping_calculator.weight_rate.class">Sylius\Component\Shipping\Calculator\WeightRateCalculator</parameter>
        <parameter key="sylius.form.type.shipping_calculator.weight_rate.class">Sylius\Bundle\ShippingBundle\Form\Type\Calculator\WeightRateConfigurationType</parameter>

        <parameter key="sylius.shipping_calculator.volume_rate.class">Sylius\Component\Shipping\Calculator\VolumeRateCalculator</parameter>
        <parameter key="sylius.form.type.shipping_calculator.volume_rate.class">Sylius\Bundle\ShippingBundle\Form\Type\Calculator\VolumeRateConfigurationType</parameter>

        <parameter key="sylius.form.type.shipment_tracking.class">Sylius\Bundle\ShippingBundle\Form\Type\ShipmentTrackingType</parameter>

        <parameter key="sylius.processor.shipment_processor.class">Sylius\Component\Shipping\Processor\ShipmentProcessor</parameter>
    </parameters>

    <services>
        <service id="sylius.form.type.shipping_rule_item_count_configuration" class="%sylius.form.type.shipping_rule_item_count_configuration.class%">
            <tag name="form.type" alias="sylius_shipping_rule_item_count_configuration" />
        </service>
        <service id="sylius.shipping_eligibility_checker" class="%sylius.shipping_eligibility_checker.class%">
            <argument type="service" id="sylius.registry.shipping_rule_checker" />
        </service>
        <service id="sylius.shipping_rule_checker.item_count" class="%sylius.shipping_rule_checker.item_count.class%">
            <tag name="sylius.shipping_rule_checker" type="item_count" label="Item count" />
        </service>

        <service id="sylius.registry.shipping_rule_checker" class="%sylius.registry.shipping_rule_checker.class%" >
                <argument>Sylius\Component\Shipping\Checker\RuleCheckerInterface</argument>
        </service>

        <service id="sylius.shipping_methods_resolver" class="%sylius.shipping_methods_resolver.class%">
            <argument type="service" id="sylius.repository.shipping_method" />
            <argument type="service" id="sylius.shipping_eligibility_checker" />
        </service>
        <service id="sylius.form.type.shipping_method_choice" class="%sylius.form.type.shipping_method_choice.class%">
            <argument type="service" id="sylius.shipping_methods_resolver" />
            <argument type="service" id="sylius.registry.shipping_calculator" />
            <argument type="service" id="sylius.repository.shipping_method" />
            <tag name="form.type" alias="sylius_shipping_method_choice" />
        </service>

        <service id="sylius.form.type.shipping_calculator_choice" class="%sylius.form.type.shipping_calculator_choice.class%">
            <argument>%sylius.shipping_calculators%</argument>
            <tag name="form.type" alias="sylius_shipping_calculator_choice" />
        </service>

        <service id="sylius.registry.shipping_calculator" class="%sylius.registry.shipping_calculator.class%" >
            <argument>Sylius\Component\Shipping\Calculator\CalculatorInterface</argument>
        </service>
        <service id="sylius.shipping_calculator" class="%sylius.shipping_calculator.class%">
            <argument type="service" id="sylius.registry.shipping_calculator" />
        </service>

        <service id="sylius.shipping_calculator.flat_rate" class="%sylius.shipping_calculator.flat_rate.class%">
            <tag name="sylius.shipping_calculator" calculator="flat_rate" label="sylius.form.shipping_calculator.flat_rate_configuration.label" />
        </service>
        <service id="sylius.form.type.shipping_calculator.flat_rate" class="%sylius.form.type.shipping_calculator.flat_rate.class%">
            <tag name="form.type" alias="sylius_shipping_calculator_flat_rate" />
        </service>

        <service id="sylius.shipping_calculator.per_item_rate" class="%sylius.shipping_calculator.per_item_rate.class%">
            <tag name="sylius.shipping_calculator" calculator="per_item_rate" label="sylius.form.shipping_calculator.per_item_rate_configuration.label" />
        </service>
        <service id="sylius.form.type.shipping_calculator.per_item_rate" class="%sylius.form.type.shipping_calculator.per_item_rate.class%">
            <tag name="form.type" alias="sylius_shipping_calculator_per_item_rate" />
        </service>

        <service id="sylius.shipping_calculator.flexible_rate" class="%sylius.shipping_calculator.flexible_rate.class%">
            <tag name="sylius.shipping_calculator" calculator="flexible_rate" label="sylius.form.shipping_calculator.flexible_rate_configuration.label" />
        </service>
        <service id="sylius.form.type.shipping_calculator.flexible_rate" class="%sylius.form.type.shipping_calculator.flexible_rate.class%">
            <tag name="form.type" alias="sylius_shipping_calculator_flexible_rate" />
        </service>

        <service id="sylius.shipping_calculator.weight_rate" class="%sylius.shipping_calculator.weight_rate.class%">
            <tag name="sylius.shipping_calculator" calculator="weight_rate" label="sylius.form.shipping_calculator.weight_rate_configuration.label" />
        </service>
        <service id="sylius.form.type.shipping_calculator.weight_rate" class="%sylius.form.type.shipping_calculator.weight_rate.class%">
            <tag name="form.type" alias="sylius_shipping_calculator_weight_rate" />
        </service>

        <service id="sylius.shipping_calculator.volume_rate" class="%sylius.shipping_calculator.volume_rate.class%">
            <tag name="sylius.shipping_calculator" calculator="volume_rate" label="sylius.form.shipping_calculator.volume_rate_configuration.label" />
        </service>
        <service id="sylius.form.type.shipping_calculator.volume_rate" class="%sylius.form.type.shipping_calculator.volume_rate.class%">
            <tag name="form.type" alias="sylius_shipping_calculator_volume_rate" />
        </service>

        <service id="sylius.form.type.shipment_tracking" class="%sylius.form.type.shipment_tracking.class%">
            <argument>%sylius.model.shipment.class%</argument>
            <tag name="form.type" alias="sylius_shipment_tracking" />
        </service>

        <service id="sylius.processor.shipment_processor" class="%sylius.processor.shipment_processor.class%">
            <argument type="service" id="sm.factory" />
        </service>
    </services>

</container>

redpajama_set_name: RedPajamaGithub


text:
package org.ligson.fw.core.facade.base.dto;

/**
 * 响应实体基础类
 */
@SuppressWarnings("serial")
public class BaseResponseDto extends BaseDto {
    private Boolean success;

    public Boolean getSuccess() {
        return success;
    }

    public void setSuccess(Boolean success) {
        this.success = success;
    }

    @Override
    public String toString() {
        return "BaseResponseDto{" +
                "success=" + success +
                '}';
    }
}


text:
/*
 * @include GeoExt/FeatureRenderer.js
 */

/**
 * An Ext.grid.column.Column pre-configured with a GeoExt.FeatureRenderer
 *
 * @class GeoExt.grid.column.Symbolizer
 */
Ext.define('GeoExt.grid.column.Symbolizer', {
    extend: 'Ext.grid.column.Column',
    alternateClassName: 'GeoExt.grid.SymbolizerColumn',
    alias: ['widget.gx_symbolizercolumn'],
    requires: ['GeoExt.FeatureRenderer'],

    /**
     * The default renderer Method for Features.
     */
    defaultRenderer: function(value, meta, record) {
        if (value) {
            var id = Ext.id();
            var symbolType = "Polygon";
            if (record) {
                var symbolType = "Line",
                    featureKey = GeoExt.isExt4 ? 'raw' : 'data',
                    featureGeom = record[featureKey].geometry,
                    className = featureGeom ? featureGeom.CLASS_NAME : null;

                if (className == "OpenLayers.Geometry.Point" ||
                        className == "OpenLayers.Geometry.MultiPoint") {
                    symbolType = "Point";
                }
                else if (className == "OpenLayers.Geometry.Polygon" ||
                        className == "OpenLayers.Geometry.MultiPolygon") {
                    symbolType = "Polygon";
                }
            }
            window.setTimeout(function() {
                var ct = Ext.get(id);
                // ct for old field may not exist any more during a grid update
                if (ct) {
                    var renderer = Ext.create('GeoExt.FeatureRenderer', {
                        renderTo: ct,
                        symbolizers: value instanceof Array ? value : [value],
                        symbolType: symbolType
                    });
                }
            }, 0);
            meta.css = "gx-grid-symbolizercol";
            return Ext.String.format('

', id);
        }
    }
});


text:
package main

import (
	"encoding/xml"
	"fmt"
	"io/ioutil"
	"os"
	"regexp"
	"strings"
)

func save(filename, content string) {
	fmt.Println("saving: " + filename)
	ioutil.WriteFile(filename, []byte(content), 0666)
}

func getFilename(filename string) string {
	return filename[:len(filename)-len(".xml")] + ".txt"
}

func convert(content string) (string, error) {
	v := new(RSS)
	err := xml.Unmarshal([]byte(content), &v)
	if err != nil {
		return "", err
	}
	return fmt.Sprintf("%v", v.RssChannel.Issue), nil
}

type RSS struct {
	XMLName    xml.Name `xml:"rss"`
	RssChannel Channel  `xml:"channel"`
}

type Channel struct {
	XMLName xml.Name
	Issue   Item `xml:"item"`
}

type Item struct {
	Description string  `xml:"description"`
	Key         string  `xml:"key"`
	Summary     string  `xml:"summary"`
	Component   string  `xml:"component"`
	Comments    Comment `xml:"comments"`
}

func (i Item) String() string {
	return fmt.Sprintf("%s - %s\nComponent: %s\n\n%s\n\n%v",
		i.Key, clean(i.Summary), i.Component, clean(i.Description), i.Comments)
}

type Comment struct {
	Content []string `xml:"comment"`
}

func (c Comment) String() string {
	comments := make([]string, len(c.Content), len(c.Content))
	for i, comment := range c.Content {
		comments[i] = clean(comment)
	}
	return fmt.Sprintf("\n%s", strings.Join(comments, "\n"))
}

func clean(s string) string {
	// todo use html parser to clean
	re := regexp.MustCompile("</?[^>]+>")
	return re.ReplaceAllString(s, "")
}

func main() {
	if len(os.Args) != 2 {
		fmt.Println("Please provide input file name")
		os.Exit(1)
	}

	filename := os.Args[1]
	content, err := ioutil.ReadFile(filename)
	if err != nil {
		fmt.Println("Error loading file", filename)
		os.Exit(1)
	}
	converted, err := convert(string(content))
	if err != nil {
		fmt.Println("Error converting file", filename)
		os.Exit(1)
	}
	save(getFilename(filename), converted)
}


text:
/*
 * Legal Notice
 *
 * This document and associated source code (the "Work") is a part of a
 * benchmark specification maintained by the TPC.
 *
 * The TPC reserves all right, title, and interest to the Work as provided
 * under U.S. and international laws, including without limitation all patent
 * and trademark rights therein.
 *
 * No Warranty
 *
 * 1.1 TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THE INFORMATION
 *     CONTAINED HEREIN IS PROVIDED "AS IS" AND WITH ALL FAULTS, AND THE
 *     AUTHORS AND DEVELOPERS OF THE WORK HEREBY DISCLAIM ALL OTHER
 *     WARRANTIES AND CONDITIONS, EITHER EXPRESS, IMPLIED OR STATUTORY,
 *     INCLUDING, BUT NOT LIMITED TO, ANY (IF ANY) IMPLIED WARRANTIES,
 *     DUTIES OR CONDITIONS OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR
 *     PURPOSE, OF ACCURACY OR COMPLETENESS OF RESPONSES, OF RESULTS, OF
 *     WORKMANLIKE EFFORT, OF LACK OF VIRUSES, AND OF LACK OF NEGLIGENCE.
 *     ALSO, THERE IS NO WARRANTY OR CONDITION OF TITLE, QUIET ENJOYMENT,
 *     QUIET POSSESSION, CORRESPONDENCE TO DESCRIPTION OR NON-INFRINGEMENT
 *     WITH REGARD TO THE WORK.
 * 1.2 IN NO EVENT WILL ANY AUTHOR OR DEVELOPER OF THE WORK BE LIABLE TO
 *     ANY OTHER PARTY FOR ANY DAMAGES, INCLUDING BUT NOT LIMITED TO THE
 *     COST OF PROCURING SUBSTITUTE GOODS OR SERVICES, LOST PROFITS, LOSS
 *     OF USE, LOSS OF DATA, OR ANY INCIDENTAL, CONSEQUENTIAL, DIRECT,
 *     INDIRECT, OR SPECIAL DAMAGES WHETHER UNDER CONTRACT, TORT, WARRANTY,
 *     OR OTHERWISE, ARISING IN ANY WAY OUT OF THIS OR ANY OTHER AGREEMENT
 *     RELATING TO THE WORK, WHETHER OR NOT SUCH AUTHOR OR DEVELOPER HAD
 *     ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES.
 *
 * Contributors:
 * Gradient Systems
 */
#include "config.h"
#include "porting.h"
#include <stdio.h>
#include "genrand.h"
#include "s_purchase.h"
#include "s_pline.h"
#include "s_store_returns.h"
#include "print.h"
#include "columns.h"
#include "build_support.h"
#include "tables.h"
#include "r_params.h"
#include "misc.h"
#include "scaling.h"
#include "parallel.h"

struct S_PURCHASE_TBL g_s_purchase;
struct S_PURCHASE_LINEITEM_TBL g_s_purchase_lineitem;
struct S_STORE_RETURNS_TBL g_s_store_return;
int nItemIndex;

/*
* Routine:
* Purpose:
* Algorithm:
* Data Structures:
*
* Params:
* Returns:
* Called By:
* Calls:
* Assumptions:
* Side Effects:
* TODO: None
*/
int
mk_master(void *pDest, ds_key_t kIndex)
{
   static int bInit = 0;
   struct S_PURCHASE_TBL *r;

	if (pDest == NULL)
		r = &g_s_purchase;
	else
		r = pDest;

	if (!bInit)
	{
		memset(&g_s_purchase, 0, sizeof(struct S_PURCHASE_TBL));
		bInit = 1;
	}

   r->kID = kIndex + getUpdateBase(S_PURCHASE);
	r->kStoreID = mk_join(S_PURCHASE_STORE_ID, STORE, 1);
	r->kCustomerID = mk_join(S_PURCHASE_CUSTOMER_ID, CUSTOMER, 1);
	jtodt(&r->dtPurchaseDate, getUpdateDate(S_PURCHASE, kIndex));
	genrand_integer(&r->nRegister, DIST_UNIFORM, 1, 17, 0, S_PURCHASE_REGISTER);
	genrand_integer(&r->nClerk, DIST_UNIFORM, 101, 300, 0, S_PURCHASE_CLERK);
	gen_text(&r->szComment[0], (int)(RS_S_PURCHASE_COMMENT * 0.6), RS_S_PURCHASE_COMMENT, S_PURCHASE_COMMENT);

   return(0);
}

int
mk_detail(int i, int bPrint)
{
   int nTemp;

		mk_s_pline(&g_s_purchase_lineitem, i);
		if (bPrint)
         pr_s_pline(&g_s_purchase_lineitem);
		genrand_integer(&nTemp, DIST_UNIFORM, 0, 99, 0, S_PLINE_IS_RETURNED);
		if (nTemp < WR_RETURN_PCT)
		{
			mk_s_store_returns(&g_s_store_return, 1);
			if (bPrint)
            pr_s_store_returns(&g_s_store_return);
		}

	return(0);
}

/*
* Routine:
* Purpose:
* Algorithm:
* Data Structures:
*
* Params:
* Returns:
* Called By:
* Calls:
* Assumptions:
* Side Effects:
* TODO: None
*/
int
pr_s_purchase(void *pSrc)
{
	struct S_PURCHASE_TBL *r;
   char szKey[RS_BKEY + 1];

   if (pSrc == NULL)
		r = &g_s_purchase;
	else
		r = pSrc;

	print_start(S_PURCHASE);
	print_key(S_PURCHASE_ID, r->kID, 1);
   mk_bkey(szKey, r->kID, 0);
   mk_bkey(szKey, r->kStoreID, 0);
	print_varchar(S_PURCHASE_STORE_ID, szKey, 1);
   mk_bkey(szKey, r->kCustomerID, 0);
	print_varchar(S_PURCHASE_CUSTOMER_ID, szKey, 1);
	print_date(S_PURCHASE_DATE, r->dtPurchaseDate.julian, 1);
	print_integer(S_PURCHASE_TIME, r->nPurchaseTime, 1);
	print_integer(S_PURCHASE_REGISTER, r->nRegister, 1);
	print_integer(S_PURCHASE_CLERK, r->nClerk, 1);
	print_varchar(S_PURCHASE_COMMENT, r->szComment, 0);
	print_end(S_PURCHASE);

	return(0);
}

int
mk_s_purchase(void *pDest, ds_key_t kIndex)
{
   int i;

   mk_master(pDest, kIndex);
   genrand_integer(&nItemIndex, DIST_UNIFORM, 1, (int)getIDCount(ITEM), 0, S_PLINE_ITEM_ID);
	for (i=1; i <= 12; i++)
	{
      mk_detail(i, 1);
   }

   return(0);
}

/*
* Routine:
* Purpose:
* Algorithm:
* Data Structures:
*
* Params:
* Returns:
* Called By:
* Calls:
* Assumptions:
* Side Effects:
* TODO: None
*/
int
ld_s_purchase(void *pSrc)
{
	struct S_PURCHASE_TBL *r;

	if (pSrc == NULL)
		r = &g_s_purchase;
	else
		r = pSrc;

	return(0);
}

int
vld_s_purchase(int nTable, ds_key_t kRow, int* bPermutation)
{
   int nLineitem,
      i;

   row_skip(S_PURCHASE, kRow - 1);
   row_skip(S_PURCHASE_LINEITEM, (kRow - 1));
   row_skip(S_STORE_RETURNS, (kRow - 1));

   mk_master(NULL, kRow);
   genrand_integer(&nLineitem, DIST_UNIFORM, 1, 12, 0, S_PLINE_NUMBER);
   genrand_integer(&nItemIndex, DIST_UNIFORM, 1, (int)getIDCount(ITEM), 0, S_PLINE_ITEM_ID);
   for (i=1; i < nLineitem; i++)
      mk_detail(i, 0);
   print_start(S_PURCHASE_LINEITEM);
   print_key(0, (kRow - 1) * 12 + nLineitem, 1);
   mk_detail(i, 1);

   return(0);
}


text:
class DlgHisto : public CDialogBar
{
// Construction
public:
	DlgHisto();
	virtual ~DlgHisto();

	BOOL Create(CWnd* pParentWnd, LPCTSTR lpszTemplateName, UINT nStyle, UINT nID );
	BOOL Create(CWnd* pParentWnd, UINT nIDTemplate, UINT nStyle, UINT nID );

	void InitDlg();

	//{{AFX_VIRTUAL(DlgHisto)
	protected:
	//}}AFX_VIRTUAL

// Implementation
protected:
	CxTargetButton	m_r;
	CxTargetButton	m_g;
	CxTargetButton	m_b;
	CxTargetButton	m_gray;
	int	m_ren;
	int	m_gen;
	int	m_ben;
	int	m_grayen;
	int	m_logen;
	bool m_initok;
	// Generated message map functions
	//{{AFX_MSG(DlgHisto)
	afx_msg void OnPaint();
	//}}AFX_MSG
	DECLARE_MESSAGE_MAP()
	virtual BOOL OnCommand(WPARAM wParam, LPARAM lParam);
};

//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.

#endif // !defined(AFX_DLGHISTO_H__4EA4FEE4_AE24_11D6_BB83_E5D7B698D37E__INCLUDED_)


text:
[![Build Status](https://travis-ci.org/firebase/php-jwt.png?branch=master)](https://travis-ci.org/firebase/php-jwt)

PHP-JWT
=======
A simple library to encode and decode JSON Web Tokens (JWT) in PHP. Should
conform to the [current spec](http://tools.ietf.org/html/draft-ietf-oauth-json-web-token-06)

Installation
------------

Use composer to manage your dependencies and download PHP-JWT:

```bash
composer require firebase/php-jwt
```

Example
-------
```php
<?php

$key = "example_key";
$token = array(
    "iss" => "http://example.org",
    "aud" => "http://example.com",
    "iat" => 1356999524,
    "nbf" => 1357000000
);

/**
 * IMPORTANT:
 * You must specify supported algorithms for your application. See
 * https://tools.ietf.org/html/draft-ietf-jose-json-web-algorithms-40
 * for a list of spec-compliant algorithms.
 */
$jwt = JWT::encode($token, $key);
$decoded = JWT::decode($jwt, $key, array('HS256'));

print_r($decoded);

/*
 NOTE: This will now be an object instead of an associative array. To get
 an associative array, you will need to cast it as such:
*/

$decoded_array = (array) $decoded;

?>
```

Changelog
---------

#### 2.0.0 / 2015-04-01
- **Note**: It is strongly recommended that you update to > v2.0.0 to address
  known security vulnerabilities in prior versions when both symmetric and
  asymmetric keys are used together.
- Update signature for `JWT::decode(...)` to require an array of supported
  algorithms to use when verifying token signatures.

Tests
-----
Run the tests using phpunit:

```bash
$ pear install PHPUnit
$ phpunit --configuration phpunit.xml.dist
PHPUnit 3.7.10 by Sebastian Bergmann.
.....
Time: 0 seconds, Memory: 2.50Mb
OK (5 tests, 5 assertions)
```

License
-------
[3-Clause BSD](http://opensource.org/licenses/BSD-3-Clause).


text:
- Leetcode 215. Kth Largest Element in an Array

## Idea

Method: **Divide and Conquer**

Similar to Quick Sort algorithm, the array is split into two. But there is no need to take care of the order of the split array only if the partition position is right ordered.

**partition() function**

There are many different versions of picking pivot in different ways.

Always pick first element as pivot.
Always pick last element as pivot (implemented below)
Pick a random element as pivot.
Pick median as pivot.

## Reference

- [QuickSort](https://www.geeksforgeeks.org/quick-sort/)


text:
var async = require('async');

module.exports = async(function *(resolve, reject, texts, finder, language) {
    "use strict";

    let fs = require('co-fs');

    yield finder.process();

    for (let key in finder.items) {

        let file = finder.items[key];
        if (file.extname !== '.json') {
            console.log('WARNING: invalid json file extname "'.yellow + (file.file).yellow.bold + '"'.yellow);
            continue;
        }

        let t = yield fs.readFile(file.file, {'encoding': 'utf8'});

        try {
            t = JSON.parse(t);
        }
        catch (exc) {

            let message = 'error processing a texts file "'.red + (file).red.bold + '", ' + (exc.message).red;
            console.error(message);
            reject(error(message));
            return;

        }

        if (typeof t !== 'object') {
            reject(error('texts file "'.red + (file).red.bold + '" is not an object'.red));
            return;
        }

        if (language) t = t[language];
        if (!t) continue;

        require('./merge')(texts, t);

    }

    resolve();

});


text:
package com.google.security.zynamics.binnavi.Gui.Debug.RemoteBrowser.FileBrowser;

import com.google.common.base.Preconditions;
import com.google.security.zynamics.binnavi.Gui.CProgressDialog;
import com.google.security.zynamics.binnavi.Gui.Debug.RemoteBrowser.Loader.CLoaderThread;
import com.google.security.zynamics.binnavi.config.ConfigManager;
import com.google.security.zynamics.binnavi.debug.debugger.interfaces.IDebugger;
import com.google.security.zynamics.binnavi.debug.models.remotebrowser.RemoteFileSystem;

import java.awt.Window;
import java.io.File;

import javax.swing.JFileChooser;

/**
 * Special file chooser that allows the user to browse remote file systems.
 */
public class CRemoteFileBrowser extends JFileChooser {
  private final Window parent;

  /**
   * Debugger that provides information about the remote file system.
   */
  private final IDebugger debugger;

  /**
   * Creates a new remote file browser.
   *
   * @param parent Parent window of the dialog.
   * @param debugger Debugger that provides information about the remote file system.
   * @param fileSystem Remote file system object that contains information about the remote file
   *        system.
   */
  public CRemoteFileBrowser(final Window parent, final IDebugger debugger,
      final RemoteFileSystem fileSystem) {
    super(new CRemoteFileSystemView(fileSystem));
    this.parent = Preconditions.checkNotNull(parent, "IE01494: Parent argument can not be null");
    this.debugger =
        Preconditions.checkNotNull(debugger, "IE01495: Debugger argument can not be null");

    setFileView(new CRemoteFileView());
    final String lastDir = ConfigManager.instance().getGeneralSettings().getLastDirectory();
    if (!lastDir.isEmpty()) {
      setCurrentDirectory(new CRemoteFile(lastDir, true /* is directory */));
    }
  }

  @Override
  public final void setCurrentDirectory(final File directory) {
    // Whenever we are switching to a new directory, we need to load the new information
    // from the debug client.
    if (debugger != null && getFileSystemView() != null && directory != null
        && !getCurrentDirectory().equals(directory)) {
      final String normalizedDirectory = directory.getAbsolutePath();

      final CLoaderThread thread = new CLoaderThread(this, debugger, normalizedDirectory);

      CProgressDialog.showEndless(parent,
          String.format("Loading content of directory '%s'", normalizedDirectory), thread);
      ConfigManager.instance().getGeneralSettings().setLastDirectory(normalizedDirectory);
    }
    super.setCurrentDirectory(directory);
  }
}


text:
package operators

import (
	"bytes"
	"fmt"
	"os"
	"strings"
	"text/tabwriter"
	"time"

	g "github.com/onsi/ginkgo"
	o "github.com/onsi/gomega"
	"github.com/stretchr/objx"

	"k8s.io/apimachinery/pkg/api/errors"
	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
	"k8s.io/apimachinery/pkg/runtime/schema"
	"k8s.io/apimachinery/pkg/util/wait"
	"k8s.io/client-go/dynamic"
	coreclient "k8s.io/client-go/kubernetes/typed/core/v1"
	e2e "k8s.io/kubernetes/test/e2e/framework"

	configv1 "github.com/openshift/api/config/v1"
	configclient "github.com/openshift/client-go/config/clientset/versioned"
)

const (
	operatorWait = 1 * time.Minute
	cvoWait      = 5 * time.Minute
)

var _ = g.Describe("[Feature:Platform][Smoke] Managed cluster should", func() {
	defer g.GinkgoRecover()

	g.It("start all core operators", func() {
		cfg, err := e2e.LoadConfig()
		o.Expect(err).NotTo(o.HaveOccurred())
		c, err := e2e.LoadClientset()
		o.Expect(err).NotTo(o.HaveOccurred())
		dc, err := dynamic.NewForConfig(cfg)
		o.Expect(err).NotTo(o.HaveOccurred())

		// presence of the CVO namespace gates this test
		g.By("checking for the cluster version operator")
		skipUnlessCVO(c.CoreV1().Namespaces())

		g.By("waiting for the cluster version to be applied")
		cvc := dc.Resource(schema.GroupVersionResource{Group: "config.openshift.io", Resource: "clusterversions", Version: "v1"})
		var lastErr error
		var lastCV objx.Map
		if err := wait.PollImmediate(3*time.Second, cvoWait, func() (bool, error) {
			obj, err := cvc.Get("version", metav1.GetOptions{})
			if err != nil {
				lastErr = err
				e2e.Logf("Unable to check for cluster version: %v", err)
				return false, nil
			}
			cv := objx.Map(obj.UnstructuredContent())
			lastErr = nil
			lastCV = cv
			if cond := condition(cv, "Progressing"); cond.Get("status").String() != "False" {
				e2e.Logf("ClusterVersion is still progressing: %s", cond.Get("message").String())
				return false, nil
			}
			if cond := condition(cv, "Available"); cond.Get("status").String() != "True" {
				e2e.Logf("ClusterVersion is not available: %s", cond.Get("message").String())
				return false, nil
			}
			e2e.Logf("ClusterVersion available: %s", condition(cv, "Progressing").Get("message").String())
			return true, nil
		}); err != nil {
			o.Expect(lastErr).NotTo(o.HaveOccurred())
			e2e.Logf("Last cluster version seen: %s", lastCV)
			if msg := condition(lastCV, "Failing").Get("message").String(); len(msg) > 0 {
				e2e.Logf("ClusterVersion is reporting a failure: %s", msg)
			}
			e2e.Failf("ClusterVersion never became available: %s", condition(lastCV, "Progressing").Get("message").String())
		}

		// gate on all clusteroperators being ready
		available := make(map[string]struct{})
		g.By(fmt.Sprintf("waiting for all cluster operators to be stable at the same time"))
		coc := dc.Resource(schema.GroupVersionResource{Group: "config.openshift.io", Resource: "clusteroperators", Version: "v1"})
		lastErr = nil
		var lastCOs []objx.Map
		wait.PollImmediate(time.Second, operatorWait, func() (bool, error) {
			obj, err := coc.List(metav1.ListOptions{})
			if err != nil {
				lastErr = err
				e2e.Logf("Unable to check for cluster operators: %v", err)
				return false, nil
			}
			cv := objx.Map(obj.UnstructuredContent())
			lastErr = nil
			items := objects(cv.Get("items"))
			lastCOs = items

			if len(items) == 0 {
				return false, nil
			}

			var unavailable []objx.Map
			var unavailableNames []string
			for _, co := range items {
				if condition(co, "Available").Get("status").String() != "True" {
					ns := co.Get("metadata.namespace").String()
					name := co.Get("metadata.name").String()
					unavailableNames = append(unavailableNames, fmt.Sprintf("%s/%s", ns, name))
					unavailable = append(unavailable, co)
					break
				}
				if condition(co, "Progressing").Get("status").String() != "False" {
					ns := co.Get("metadata.namespace").String()
					name := co.Get("metadata.name").String()
					unavailableNames = append(unavailableNames, fmt.Sprintf("%s/%s", ns, name))
					unavailable = append(unavailable, co)
					break
				}
				if condition(co, "Failing").Get("status").String() != "False" {
					ns := co.Get("metadata.namespace").String()
					name := co.Get("metadata.name").String()
					unavailableNames = append(unavailableNames, fmt.Sprintf("%s/%s", ns, name))
					unavailable = append(unavailable, co)
					break
				}
			}
			if len(unavailable) > 0 {
				e2e.Logf("Operators still doing work: %s", strings.Join(unavailableNames, ", "))
				return false, nil
			}
			return true, nil
		})

		o.Expect(lastErr).NotTo(o.HaveOccurred())
		var unavailable []string
		buf := &bytes.Buffer{}
		w := tabwriter.NewWriter(buf, 0, 4, 1, ' ', 0)
		fmt.Fprintf(w, "NAMESPACE\tNAME\tPROGRESSING\tAVAILABLE\tVERSION\tMESSAGE\n")
		for _, co := range lastCOs {
			ns := co.Get("metadata.namespace").String()
			name := co.Get("metadata.name").String()
			if condition(co, "Available").Get("status").String() != "True" {
				unavailable = append(unavailable, fmt.Sprintf("%s/%s", ns, name))
			} else {
				available[fmt.Sprintf("%s/%s", ns, name)] = struct{}{}
			}
			fmt.Fprintf(w, "%s\t%s\t%s\t%s\t%s\t%s\n",
				ns,
				name,
				condition(co, "Progressing").Get("status").String(),
				condition(co, "Available").Get("status").String(),
				co.Get("status.version").String(),
				condition(co, "Failing").Get("message").String(),
			)
		}
		w.Flush()
		e2e.Logf("ClusterOperators:\n%s", buf.String())

		if len(unavailable) > 0 {
			e2e.Failf("Some cluster operators never became available %s", strings.Join(unavailable, ", "))
		}
		// Check at least one core operator is available
		if len(available) == 0 {
			e2e.Failf("There must be at least one cluster operator")
		}
	})
})

var _ = g.Describe("[Feature:Platform] Managed cluster should", func() {
	defer g.GinkgoRecover()

	g.It("have operators on the cluster version", func() {
		if len(os.Getenv("TEST_UNSUPPORTED_ALLOW_VERSION_SKEW")) > 0 {
			e2e.Skipf("Test is disabled to allow cluster components to have different versions")
		}
		cfg, err := e2e.LoadConfig()
		o.Expect(err).NotTo(o.HaveOccurred())
		c := configclient.NewForConfigOrDie(cfg)
		coreclient, err := e2e.LoadClientset()
		o.Expect(err).NotTo(o.HaveOccurred())

		// presence of the CVO namespace gates this test
		g.By("checking for the cluster version operator")
		skipUnlessCVO(coreclient.CoreV1().Namespaces())

		// we need to get the list of versions
		cv, err := c.ConfigV1().ClusterVersions().Get("version", metav1.GetOptions{})
		o.Expect(err).NotTo(o.HaveOccurred())
		coList, err := c.ConfigV1().ClusterOperators().List(metav1.ListOptions{})
		o.Expect(err).NotTo(o.HaveOccurred())
		o.Expect(coList.Items).NotTo(o.BeEmpty())

		g.By("all cluster operators report an operator version in the first position equal to the cluster version")
		for _, co := range coList.Items {
			msg := fmt.Sprintf("unexpected operator status versions %s:\n%#v", co.Name, co.Status.Versions)
			o.Expect(co.Status.Versions).NotTo(o.BeEmpty(), msg)
			operator := findOperatorVersion(co.Status.Versions, "operator")
			o.Expect(operator).NotTo(o.BeNil(), msg)
			o.Expect(operator.Name).To(o.Equal("operator"), msg)
			o.Expect(operator.Version).To(o.Equal(cv.Status.Desired.Version), msg)
		}
	})
})

func skipUnlessCVO(c coreclient.NamespaceInterface) {
	err := wait.PollImmediate(time.Second, time.Minute, func() (bool, error) {
		_, err := c.Get("openshift-cluster-version", metav1.GetOptions{})
		if err == nil {
			return true, nil
		}
		if errors.IsNotFound(err) {
			e2e.Skipf("The cluster is not managed by a cluster-version operator")
		}
		e2e.Logf("Unable to check for cluster version operator: %v", err)
		return false, nil
	})
	o.Expect(err).NotTo(o.HaveOccurred())
}

func findOperatorVersion(versions []configv1.OperandVersion, name string) *configv1.OperandVersion {
	for i := range versions {
		if versions[i].Name == name {
			return &versions[i]
		}
	}
	return nil
}

func contains(names []string, name string) bool {
	for _, s := range names {
		if s == name {
			return true
		}
	}
	return false
}

func jsonString(from objx.Map) string {
	s, _ := from.JSON()
	return s
}

func objects(from *objx.Value) []objx.Map {
	var values []objx.Map
	switch {
	case from.IsObjxMapSlice():
		return from.ObjxMapSlice()
	case from.IsInterSlice():
		for _, i := range from.InterSlice() {
			if msi, ok := i.(map[string]interface{}); ok {
				values = append(values, objx.Map(msi))
			}
		}
	}
	return values
}

func condition(cv objx.Map, condition string) objx.Map {
	for _, obj := range objects(cv.Get("status.conditions")) {
		if obj.Get("type").String() == condition {
			return obj
		}
	}
	return objx.Map(nil)
}


text:
package org.openengsb.core.persistence.internal;

import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.Map;

import org.apache.commons.collections.CollectionUtils;
import org.openengsb.core.api.model.ConfigItem;
import org.openengsb.core.api.persistence.ConfigPersistenceBackendService;
import org.openengsb.core.api.persistence.ConfigPersistenceService;
import org.openengsb.core.api.persistence.InvalidConfigurationException;
import org.openengsb.core.api.persistence.PersistenceException;

/**
 * Default implementation of the {@link ConfigPersistenceService} registered by the ConfigPersistenceServiceFactory with
 * the correct properties at the right places. Basically this class does nothing than forwarding the backend services
 * and casting them to the right type.
 */
public class DefaultConfigPersistenceService implements ConfigPersistenceService {

    private final ConfigPersistenceBackendService<?> backendService;

    public DefaultConfigPersistenceService(ConfigPersistenceBackendService<?> backendService) {
        this.backendService = backendService;
    }

    @Override
    public boolean supports(Class<? extends ConfigItem<?>> configItemType) {
        return backendService.supports(configItemType);
    }

    @Override
    @SuppressWarnings("unchecked")
    public <ConfigType extends ConfigItem<?>> List<ConfigType> load(Map<String, String> metadata)
        throws PersistenceException, InvalidConfigurationException {
        List<ConfigType> configItems = new ArrayList<ConfigType>();
        Collection<ConfigItem<?>> result =
            CollectionUtils.typedCollection(backendService.load(metadata), ConfigItem.class);
        for (ConfigItem<?> configItem : result) {
            configItems.add((ConfigType) configItem);
        }
        return configItems;
    }

    @Override
    public void remove(Map<String, String> metadata) throws PersistenceException {
        backendService.remove(metadata);
    }

    @SuppressWarnings({ "unchecked", "rawtypes" })
    @Override
    public <ConfigType extends ConfigItem<?>> void persist(ConfigType configuration) throws PersistenceException,
        InvalidConfigurationException {
        backendService.persist((ConfigItem) configuration);
    }

}


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

#include <string>
#include <vector>

#include "base/bind.h"
#include "base/files/file_util.h"
#include "base/files/scoped_temp_dir.h"
#include "base/json/json_string_value_serializer.h"
#include "base/macros.h"
#include "base/memory/scoped_ptr.h"
#include "base/run_loop.h"
#include "base/values.h"
#include "chrome/browser/local_discovery/pwg_raster_converter.h"
#include "chrome/browser/ui/webui/print_preview/extension_printer_handler.h"
#include "chrome/test/base/testing_profile.h"
#include "extensions/browser/api/printer_provider/printer_provider_api.h"
#include "extensions/browser/api/printer_provider/printer_provider_api_factory.h"
#include "extensions/browser/api/printer_provider/printer_provider_print_job.h"
#include "printing/pdf_render_settings.h"
#include "printing/pwg_raster_settings.h"
#include "printing/units.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "ui/gfx/geometry/size.h"

using extensions::PrinterProviderAPI;
using extensions::PrinterProviderPrintJob;
using local_discovery::PWGRasterConverter;

namespace {

// Printer id used for requests in tests.
const char kPrinterId[] = "printer_id";

// Printer list used a result for getPrinters.
const char kPrinterDescriptionList[] =
    "[{"
    "  \"id\": \"printer1\","
    "  \"name\": \"Printer 1\""
    "}, {"
    "  \"id\": \"printer2\","
    "  \"name\": \"Printer 2\","
    "  \"description\": \"Test printer 2\""
    "}]";

// Printer capability for printer that supports all content types.
const char kAllContentTypesSupportedPrinter[] =
    "{"
    "  \"version\": \"1.0\","
    "  \"printer\": {"
    "    \"supported_content_type\": ["
    "      {\"content_type\": \"*/*\"}"
    "    ]"
    "  }"
    "}";

// Printer capability for a printer that supports PDF.
const char kPdfSupportedPrinter[] =
    "{"
    "  \"version\": \"1.0\","
    "  \"printer\": {"
    "    \"supported_content_type\": ["
    "      {\"content_type\": \"application/pdf\"},"
    "      {\"content_type\": \"image/pwg-raster\"}"
    "    ]"
    "  }"
    "}";

// Printer capability for a printer that supportd only PWG raster.
const char kPWGRasterOnlyPrinterSimpleDescription[] =
    "{"
    "  \"version\": \"1.0\","
    "  \"printer\": {"
    "    \"supported_content_type\": ["
    "      {\"content_type\": \"image/pwg-raster\"}"
    "    ]"
    "  }"
    "}";

// Printer capability for a printer that supportd only PWG raster that has
// options other that supported_content_type set.
const char kPWGRasterOnlyPrinter[] =
    "{"
    "  \"version\": \"1.0\","
    "  \"printer\": {"
    "    \"supported_content_type\": ["
    "      {\"content_type\": \"image/pwg-raster\"}"
    "    ],"
    "    \"pwg_raster_config\": {"
    "      \"document_sheet_back\": \"FLIPPED\","
    "      \"reverse_order_streaming\": true,"
    "      \"rotate_all_pages\": true"
    "    },"
    "    \"dpi\": {"
    "      \"option\": [{"
    "        \"horizontal_dpi\": 100,"
    "        \"vertical_dpi\": 200,"
    "        \"is_default\": true"
    "      }]"
    "    }"
    "  }"
    "}";

// Print ticket with no parameters set.
const char kEmptyPrintTicket[] = "{\"version\": \"1.0\"}";

// Print ticket that has duplex parameter set.
const char kPrintTicketWithDuplex[] =
    "{"
    "  \"version\": \"1.0\","
    "  \"print\": {"
    "    \"duplex\": {\"type\": \"LONG_EDGE\"}"
    "  }"
    "}";

const char kContentTypePDF[] = "application/pdf";
const char kContentTypePWG[] = "image/pwg-raster";

// Print request status considered to be successful by fake PrinterProviderAPI.
const char kPrintRequestSuccess[] = "OK";

// Used as a callback to StartGetPrinters in tests.
// Increases |*call_count| and records values returned by StartGetPrinters.
void RecordPrinterList(size_t* call_count,
                       scoped_ptr<base::ListValue>* printers_out,
                       bool* is_done_out,
                       const base::ListValue& printers,
                       bool is_done) {
  ++(*call_count);
  printers_out->reset(printers.DeepCopy());
  *is_done_out = is_done;
}

// Used as a callback to StartGetCapability in tests.
// Increases |*call_count| and records values returned by StartGetCapability.
void RecordCapability(size_t* call_count,
                      std::string* destination_id_out,
                      scoped_ptr<base::DictionaryValue>* capability_out,
                      const std::string& destination_id,
                      const base::DictionaryValue& capability) {
  ++(*call_count);
  *destination_id_out = destination_id;
  capability_out->reset(capability.DeepCopy());
}

// Used as a callback to StartPrint in tests.
// Increases |*call_count| and records values returned by StartPrint.
void RecordPrintResult(size_t* call_count,
                       bool* success_out,
                       std::string* status_out,
                       bool success,
                       const std::string& status) {
  ++(*call_count);
  *success_out = success;
  *status_out = status;
}

// Converts JSON string to base::ListValue object.
// On failure, returns NULL and fills |*error| string.
scoped_ptr<base::ListValue> GetJSONAsListValue(const std::string& json,
                                               std::string* error) {
  scoped_ptr<base::Value> deserialized(
      JSONStringValueDeserializer(json).Deserialize(NULL, error));
  if (!deserialized)
    return scoped_ptr<base::ListValue>();
  base::ListValue* list = nullptr;
  if (!deserialized->GetAsList(&list)) {
    *error = "Value is not a list.";
    return scoped_ptr<base::ListValue>();
  }
  return scoped_ptr<base::ListValue>(list->DeepCopy());
}

// Converts JSON string to base::DictionaryValue object.
// On failure, returns NULL and fills |*error| string.
scoped_ptr<base::DictionaryValue> GetJSONAsDictionaryValue(
    const std::string& json,
    std::string* error) {
  scoped_ptr<base::Value> deserialized(
      JSONStringValueDeserializer(json).Deserialize(NULL, error));
  if (!deserialized)
    return scoped_ptr<base::DictionaryValue>();
  base::DictionaryValue* dictionary;
  if (!deserialized->GetAsDictionary(&dictionary)) {
    *error = "Value is not a dictionary.";
    return scoped_ptr<base::DictionaryValue>();
  }
  return scoped_ptr<base::DictionaryValue>(dictionary->DeepCopy());
}

std::string RefCountedMemoryToString(
    const scoped_refptr<base::RefCountedMemory>& memory) {
  return std::string(memory->front_as<char>(), memory->size());
}

// Fake PWGRasterconverter used in the tests.
class FakePWGRasterConverter : public PWGRasterConverter {
 public:
  FakePWGRasterConverter() : fail_conversion_(false), initialized_(false) {}
  ~FakePWGRasterConverter() override = default;

  // PWGRasterConverter implementation. It writes |data| to a temp file.
  // Also, remembers conversion and bitmap settings passed into the method.
  void Start(base::RefCountedMemory* data,
             const printing::PdfRenderSettings& conversion_settings,
             const printing::PwgRasterSettings& bitmap_settings,
             const ResultCallback& callback) override {
    if (fail_conversion_) {
      callback.Run(false, base::FilePath());
      return;
    }

    if (!initialized_ && !temp_dir_.CreateUniqueTempDir()) {
      ADD_FAILURE() << "Unable to create target dir for cenverter";
      callback.Run(false, base::FilePath());
      return;
    }

    initialized_ = true;

    path_ = temp_dir_.path().AppendASCII("output.pwg");
    std::string data_str(data->front_as<char>(), data->size());
    int written = WriteFile(path_, data_str.c_str(), data_str.size());
    if (written != static_cast<int>(data_str.size())) {
      ADD_FAILURE() << "Failed to write pwg raster file.";
      callback.Run(false, base::FilePath());
      return;
    }

    conversion_settings_ = conversion_settings;
    bitmap_settings_ = bitmap_settings;

    callback.Run(true, path_);
  }

  // Makes |Start| method always return an error.
  void FailConversion() { fail_conversion_ = true; }

  const base::FilePath& path() { return path_; }
  const printing::PdfRenderSettings& conversion_settings() const {
    return conversion_settings_;
  }

  const printing::PwgRasterSettings& bitmap_settings() const {
    return bitmap_settings_;
  }

 private:
  base::ScopedTempDir temp_dir_;

  base::FilePath path_;
  printing::PdfRenderSettings conversion_settings_;
  printing::PwgRasterSettings bitmap_settings_;
  bool fail_conversion_;
  bool initialized_;

  DISALLOW_COPY_AND_ASSIGN(FakePWGRasterConverter);
};

// Information about received print requests.
struct PrintRequestInfo {
  PrinterProviderAPI::PrintCallback callback;
  PrinterProviderPrintJob job;
};

// Fake PrinterProviderAPI used in tests.
// It caches requests issued to API and exposes methods to trigger their
// callbacks.
class FakePrinterProviderAPI : public PrinterProviderAPI {
 public:
  FakePrinterProviderAPI() = default;
  ~FakePrinterProviderAPI() override = default;

  void DispatchGetPrintersRequested(
      const PrinterProviderAPI::GetPrintersCallback& callback) override {
    pending_printers_callbacks_.push_back(callback);
  }

  void DispatchGetCapabilityRequested(
      const std::string& destination_id,
      const PrinterProviderAPI::GetCapabilityCallback& callback) override {
    pending_capability_callbacks_.push_back(base::Bind(callback));
  }

  void DispatchPrintRequested(
      const PrinterProviderPrintJob& job,
      const PrinterProviderAPI::PrintCallback& callback) override {
    PrintRequestInfo request_info;
    request_info.callback = callback;
    request_info.job = job;

    pending_print_requests_.push_back(request_info);
  }

  size_t pending_get_printers_count() const {
    return pending_printers_callbacks_.size();
  }

  const PrinterProviderPrintJob* GetPrintJob(
      const extensions::Extension* extension,
      int request_id) const override {
    ADD_FAILURE() << "Not reached";
    return nullptr;
  }

  void TriggerNextGetPrintersCallback(const base::ListValue& printers,
                                      bool done) {
    ASSERT_GT(pending_get_printers_count(), 0u);
    pending_printers_callbacks_[0].Run(printers, done);
    pending_printers_callbacks_.erase(pending_printers_callbacks_.begin());
  }

  size_t pending_get_capability_count() const {
    return pending_capability_callbacks_.size();
  }

  void TriggerNextGetCapabilityCallback(
      const base::DictionaryValue& description) {
    ASSERT_GT(pending_get_capability_count(), 0u);
    pending_capability_callbacks_[0].Run(description);
    pending_capability_callbacks_.erase(pending_capability_callbacks_.begin());
  }

  size_t pending_print_count() const { return pending_print_requests_.size(); }

  const PrinterProviderPrintJob* GetNextPendingPrintJob() const {
    EXPECT_GT(pending_print_count(), 0u);
    if (pending_print_count() == 0)
      return NULL;
    return &pending_print_requests_[0].job;
  }

  void TriggerNextPrintCallback(const std::string& result) {
    ASSERT_GT(pending_print_count(), 0u);
    pending_print_requests_[0].callback.Run(result == kPrintRequestSuccess,
                                            result);
    pending_print_requests_.erase(pending_print_requests_.begin());
  }

 private:
  std::vector<PrinterProviderAPI::GetPrintersCallback>
      pending_printers_callbacks_;
  std::vector<PrinterProviderAPI::GetCapabilityCallback>
      pending_capability_callbacks_;
  std::vector<PrintRequestInfo> pending_print_requests_;

  DISALLOW_COPY_AND_ASSIGN(FakePrinterProviderAPI);
};

KeyedService* BuildTestingPrinterProviderAPI(content::BrowserContext* context) {
  return new FakePrinterProviderAPI();
}

}  // namespace

class ExtensionPrinterHandlerTest : public testing::Test {
 public:
  ExtensionPrinterHandlerTest() : pwg_raster_converter_(NULL) {}
  ~ExtensionPrinterHandlerTest() override = default;

  void SetUp() override {
    TestingProfile::Builder profile_builder;
    profile_builder.AddTestingFactory(
        extensions::PrinterProviderAPIFactory::GetInstance(),
        &BuildTestingPrinterProviderAPI);
    profile_ = profile_builder.Build();

    extension_printer_handler_.reset(new ExtensionPrinterHandler(
        profile_.get(), message_loop_.task_runner()));

    pwg_raster_converter_ = new FakePWGRasterConverter();
    extension_printer_handler_->SetPwgRasterConverterForTesting(
        scoped_ptr<PWGRasterConverter>(pwg_raster_converter_));
  }

 protected:
  FakePrinterProviderAPI* GetPrinterProviderAPI() {
    return static_cast<FakePrinterProviderAPI*>(
        extensions::PrinterProviderAPIFactory::GetInstance()
            ->GetForBrowserContext(profile_.get()));
  }

  scoped_ptr<ExtensionPrinterHandler> extension_printer_handler_;

  FakePWGRasterConverter* pwg_raster_converter_;

 private:
  base::MessageLoop message_loop_;

  scoped_ptr<TestingProfile> profile_;

  DISALLOW_COPY_AND_ASSIGN(ExtensionPrinterHandlerTest);
};

TEST_F(ExtensionPrinterHandlerTest, GetPrinters) {
  size_t call_count = 0;
  scoped_ptr<base::ListValue> printers;
  bool is_done = false;

  extension_printer_handler_->StartGetPrinters(
      base::Bind(&RecordPrinterList, &call_count, &printers, &is_done));

  EXPECT_FALSE(printers.get());
  FakePrinterProviderAPI* fake_api = GetPrinterProviderAPI();
  ASSERT_TRUE(fake_api);
  ASSERT_EQ(1u, fake_api->pending_get_printers_count());

  std::string error;
  scoped_ptr<base::ListValue> original_printers(
      GetJSONAsListValue(kPrinterDescriptionList, &error));
  ASSERT_TRUE(original_printers) << "Failed to deserialize printers: " << error;

  fake_api->TriggerNextGetPrintersCallback(*original_printers, true);

  EXPECT_EQ(1u, call_count);
  EXPECT_TRUE(is_done);
  ASSERT_TRUE(printers.get());
  EXPECT_TRUE(printers->Equals(original_printers.get()))
      << *printers << ", expected: " << *original_printers;
}

TEST_F(ExtensionPrinterHandlerTest, GetPrinters_Reset) {
  size_t call_count = 0;
  scoped_ptr<base::ListValue> printers;
  bool is_done = false;

  extension_printer_handler_->StartGetPrinters(
      base::Bind(&RecordPrinterList, &call_count, &printers, &is_done));

  EXPECT_FALSE(printers.get());
  FakePrinterProviderAPI* fake_api = GetPrinterProviderAPI();
  ASSERT_TRUE(fake_api);
  ASSERT_EQ(1u, fake_api->pending_get_printers_count());

  extension_printer_handler_->Reset();

  std::string error;
  scoped_ptr<base::ListValue> original_printers(
      GetJSONAsListValue(kPrinterDescriptionList, &error));
  ASSERT_TRUE(original_printers) << "Error deserializing printers: " << error;

  fake_api->TriggerNextGetPrintersCallback(*original_printers, true);

  EXPECT_EQ(0u, call_count);
}

TEST_F(ExtensionPrinterHandlerTest, GetCapability) {
  size_t call_count = 0;
  std::string destination_id;
  scoped_ptr<base::DictionaryValue> capability;

  extension_printer_handler_->StartGetCapability(
      kPrinterId,
      base::Bind(&RecordCapability, &call_count, &destination_id, &capability));

  EXPECT_EQ(0u, call_count);

  FakePrinterProviderAPI* fake_api = GetPrinterProviderAPI();
  ASSERT_TRUE(fake_api);
  ASSERT_EQ(1u, fake_api->pending_get_capability_count());

  std::string error;
  scoped_ptr<base::DictionaryValue> original_capability(
      GetJSONAsDictionaryValue(kPWGRasterOnlyPrinterSimpleDescription, &error));
  ASSERT_TRUE(original_capability)
      << "Error deserializing capability: " << error;

  fake_api->TriggerNextGetCapabilityCallback(*original_capability);

  EXPECT_EQ(1u, call_count);
  EXPECT_EQ(kPrinterId, destination_id);
  ASSERT_TRUE(capability.get());
  EXPECT_TRUE(capability->Equals(original_capability.get()))
      << *capability << ", expected: " << *original_capability;
}

TEST_F(ExtensionPrinterHandlerTest, GetCapability_Reset) {
  size_t call_count = 0;
  std::string destination_id;
  scoped_ptr<base::DictionaryValue> capability;

  extension_printer_handler_->StartGetCapability(
      kPrinterId,
      base::Bind(&RecordCapability, &call_count, &destination_id, &capability));

  EXPECT_EQ(0u, call_count);

  FakePrinterProviderAPI* fake_api = GetPrinterProviderAPI();
  ASSERT_TRUE(fake_api);
  ASSERT_EQ(1u, fake_api->pending_get_capability_count());

  extension_printer_handler_->Reset();

  std::string error;
  scoped_ptr<base::DictionaryValue> original_capability(
      GetJSONAsDictionaryValue(kPWGRasterOnlyPrinterSimpleDescription, &error));
  ASSERT_TRUE(original_capability)
      << "Error deserializing capability: " << error;

  fake_api->TriggerNextGetCapabilityCallback(*original_capability);

  EXPECT_EQ(0u, call_count);
}

TEST_F(ExtensionPrinterHandlerTest, Print_Pdf) {
  size_t call_count = 0;
  bool success = false;
  std::string status;

  scoped_refptr<base::RefCountedString> print_data(
      new base::RefCountedString());
  print_data->data() = "print data, PDF";

  extension_printer_handler_->StartPrint(
      kPrinterId, kPdfSupportedPrinter, kEmptyPrintTicket, gfx::Size(100, 100),
      print_data,
      base::Bind(&RecordPrintResult, &call_count, &success, &status));

  EXPECT_EQ(0u, call_count);
  FakePrinterProviderAPI* fake_api = GetPrinterProviderAPI();
  ASSERT_TRUE(fake_api);
  ASSERT_EQ(1u, fake_api->pending_print_count());

  const PrinterProviderPrintJob* print_job = fake_api->GetNextPendingPrintJob();
  ASSERT_TRUE(print_job);

  EXPECT_EQ(kPrinterId, print_job->printer_id);
  EXPECT_EQ(kEmptyPrintTicket, print_job->ticket_json);
  EXPECT_EQ(kContentTypePDF, print_job->content_type);
  EXPECT_TRUE(print_job->document_path.empty());
  ASSERT_TRUE(print_job->document_bytes);
  EXPECT_EQ(print_data->data(),
            RefCountedMemoryToString(print_job->document_bytes));

  fake_api->TriggerNextPrintCallback(kPrintRequestSuccess);

  EXPECT_EQ(1u, call_count);
  EXPECT_TRUE(success);
  EXPECT_EQ(kPrintRequestSuccess, status);
}

TEST_F(ExtensionPrinterHandlerTest, Print_Pdf_Reset) {
  size_t call_count = 0;
  bool success = false;
  std::string status;

  scoped_refptr<base::RefCountedString> print_data(
      new base::RefCountedString());
  print_data->data() = "print data, PDF";

  extension_printer_handler_->StartPrint(
      kPrinterId, kPdfSupportedPrinter, kEmptyPrintTicket, gfx::Size(100, 100),
      print_data,
      base::Bind(&RecordPrintResult, &call_count, &success, &status));

  EXPECT_EQ(0u, call_count);
  FakePrinterProviderAPI* fake_api = GetPrinterProviderAPI();
  ASSERT_TRUE(fake_api);
  ASSERT_EQ(1u, fake_api->pending_print_count());

  extension_printer_handler_->Reset();

  fake_api->TriggerNextPrintCallback(kPrintRequestSuccess);

  EXPECT_EQ(0u, call_count);
}

TEST_F(ExtensionPrinterHandlerTest, Print_All) {
  size_t call_count = 0;
  bool success = false;
  std::string status;

  scoped_refptr<base::RefCountedString> print_data(
      new base::RefCountedString());
  print_data->data() = "print data, PDF";

  extension_printer_handler_->StartPrint(
      kPrinterId, kAllContentTypesSupportedPrinter, kEmptyPrintTicket,
      gfx::Size(100, 100), print_data,
      base::Bind(&RecordPrintResult, &call_count, &success, &status));

  EXPECT_EQ(0u, call_count);

  FakePrinterProviderAPI* fake_api = GetPrinterProviderAPI();
  ASSERT_TRUE(fake_api);
  ASSERT_EQ(1u, fake_api->pending_print_count());

  const PrinterProviderPrintJob* print_job = fake_api->GetNextPendingPrintJob();
  ASSERT_TRUE(print_job);

  EXPECT_EQ(kPrinterId, print_job->printer_id);
  EXPECT_EQ(kEmptyPrintTicket, print_job->ticket_json);
  EXPECT_EQ(kContentTypePDF, print_job->content_type);
  EXPECT_TRUE(print_job->document_path.empty());
  ASSERT_TRUE(print_job->document_bytes);
  EXPECT_EQ(print_data->data(),
            RefCountedMemoryToString(print_job->document_bytes));

  fake_api->TriggerNextPrintCallback(kPrintRequestSuccess);

  EXPECT_EQ(1u, call_count);
  EXPECT_TRUE(success);
  EXPECT_EQ(kPrintRequestSuccess, status);
}

TEST_F(ExtensionPrinterHandlerTest, Print_Pwg) {
  size_t call_count = 0;
  bool success = false;
  std::string status;

  scoped_refptr<base::RefCountedString> print_data(
      new base::RefCountedString());
  print_data->data() = "print data, PDF";

  extension_printer_handler_->StartPrint(
      kPrinterId, kPWGRasterOnlyPrinterSimpleDescription, kEmptyPrintTicket,
      gfx::Size(100, 50), print_data,
      base::Bind(&RecordPrintResult, &call_count, &success, &status));

  EXPECT_EQ(0u, call_count);

  base::RunLoop().RunUntilIdle();

  FakePrinterProviderAPI* fake_api = GetPrinterProviderAPI();
  ASSERT_TRUE(fake_api);
  ASSERT_EQ(1u, fake_api->pending_print_count());

  EXPECT_EQ(printing::TRANSFORM_NORMAL,
            pwg_raster_converter_->bitmap_settings().odd_page_transform);
  EXPECT_FALSE(pwg_raster_converter_->bitmap_settings().rotate_all_pages);
  EXPECT_FALSE(pwg_raster_converter_->bitmap_settings().reverse_page_order);

  EXPECT_EQ(printing::kDefaultPdfDpi,
            pwg_raster_converter_->conversion_settings().dpi());
  EXPECT_TRUE(pwg_raster_converter_->conversion_settings().autorotate());
  EXPECT_EQ("0,0 208x416",  // vertically_oriented_size  * dpi / points_per_inch
            pwg_raster_converter_->conversion_settings().area().ToString());

  const PrinterProviderPrintJob* print_job = fake_api->GetNextPendingPrintJob();
  ASSERT_TRUE(print_job);

  EXPECT_EQ(kPrinterId, print_job->printer_id);
  EXPECT_EQ(kEmptyPrintTicket, print_job->ticket_json);
  EXPECT_EQ(kContentTypePWG, print_job->content_type);
  EXPECT_FALSE(print_job->document_bytes);
  EXPECT_FALSE(print_job->document_path.empty());
  EXPECT_EQ(pwg_raster_converter_->path(), print_job->document_path);
  EXPECT_EQ(static_cast<int64_t>(print_data->size()),
            print_job->file_info.size);

  fake_api->TriggerNextPrintCallback(kPrintRequestSuccess);

  EXPECT_EQ(1u, call_count);
  EXPECT_TRUE(success);
  EXPECT_EQ(kPrintRequestSuccess, status);
}

TEST_F(ExtensionPrinterHandlerTest, Print_Pwg_NonDefaultSettings) {
  size_t call_count = 0;
  bool success = false;
  std::string status;

  scoped_refptr<base::RefCountedString> print_data(
      new base::RefCountedString());
  print_data->data() = "print data, PDF";

  extension_printer_handler_->StartPrint(
      kPrinterId, kPWGRasterOnlyPrinter, kPrintTicketWithDuplex,
      gfx::Size(100, 50), print_data,
      base::Bind(&RecordPrintResult, &call_count, &success, &status));

  EXPECT_EQ(0u, call_count);

  base::RunLoop().RunUntilIdle();

  FakePrinterProviderAPI* fake_api = GetPrinterProviderAPI();
  ASSERT_TRUE(fake_api);
  ASSERT_EQ(1u, fake_api->pending_print_count());

  EXPECT_EQ(printing::TRANSFORM_FLIP_VERTICAL,
            pwg_raster_converter_->bitmap_settings().odd_page_transform);
  EXPECT_TRUE(pwg_raster_converter_->bitmap_settings().rotate_all_pages);
  EXPECT_TRUE(pwg_raster_converter_->bitmap_settings().reverse_page_order);

  EXPECT_EQ(200,  // max(vertical_dpi, horizontal_dpi)
            pwg_raster_converter_->conversion_settings().dpi());
  EXPECT_TRUE(pwg_raster_converter_->conversion_settings().autorotate());
  EXPECT_EQ("0,0 138x277",  // vertically_oriented_size  * dpi / points_per_inch
            pwg_raster_converter_->conversion_settings().area().ToString());

  const PrinterProviderPrintJob* print_job = fake_api->GetNextPendingPrintJob();
  ASSERT_TRUE(print_job);

  EXPECT_EQ(kPrinterId, print_job->printer_id);
  EXPECT_EQ(kPrintTicketWithDuplex, print_job->ticket_json);
  EXPECT_EQ(kContentTypePWG, print_job->content_type);
  EXPECT_FALSE(print_job->document_bytes);
  EXPECT_FALSE(print_job->document_path.empty());
  EXPECT_EQ(pwg_raster_converter_->path(), print_job->document_path);
  EXPECT_EQ(static_cast<int64_t>(print_data->size()),
            print_job->file_info.size);

  fake_api->TriggerNextPrintCallback(kPrintRequestSuccess);

  EXPECT_EQ(1u, call_count);
  EXPECT_TRUE(success);
  EXPECT_EQ(kPrintRequestSuccess, status);
}

TEST_F(ExtensionPrinterHandlerTest, Print_Pwg_Reset) {
  size_t call_count = 0;
  bool success = false;
  std::string status;

  scoped_refptr<base::RefCountedString> print_data(
      new base::RefCountedString());
  print_data->data() = "print data, PDF";

  extension_printer_handler_->StartPrint(
      kPrinterId, kPWGRasterOnlyPrinterSimpleDescription, kEmptyPrintTicket,
      gfx::Size(100, 50), print_data,
      base::Bind(&RecordPrintResult, &call_count, &success, &status));

  EXPECT_EQ(0u, call_count);

  base::RunLoop().RunUntilIdle();

  FakePrinterProviderAPI* fake_api = GetPrinterProviderAPI();
  ASSERT_TRUE(fake_api);
  ASSERT_EQ(1u, fake_api->pending_print_count());

  extension_printer_handler_->Reset();

  fake_api->TriggerNextPrintCallback(kPrintRequestSuccess);

  EXPECT_EQ(0u, call_count);
}

TEST_F(ExtensionPrinterHandlerTest, Print_Pwg_InvalidTicket) {
  size_t call_count = 0;
  bool success = false;
  std::string status;

  scoped_refptr<base::RefCountedString> print_data(
      new base::RefCountedString());
  print_data->data() = "print data, PDF";

  extension_printer_handler_->StartPrint(
      kPrinterId, kPWGRasterOnlyPrinterSimpleDescription, "{}" /* ticket */,
      gfx::Size(100, 100), print_data,
      base::Bind(&RecordPrintResult, &call_count, &success, &status));

  EXPECT_EQ(1u, call_count);

  EXPECT_FALSE(success);
  EXPECT_EQ("INVALID_TICKET", status);
}

TEST_F(ExtensionPrinterHandlerTest, Print_Pwg_FailedConversion) {
  size_t call_count = 0;
  bool success = false;
  std::string status;

  pwg_raster_converter_->FailConversion();

  scoped_refptr<base::RefCountedString> print_data(
      new base::RefCountedString());
  print_data->data() = "print data, PDF";

  extension_printer_handler_->StartPrint(
      kPrinterId, kPWGRasterOnlyPrinterSimpleDescription, kEmptyPrintTicket,
      gfx::Size(100, 100), print_data,
      base::Bind(&RecordPrintResult, &call_count, &success, &status));

  EXPECT_EQ(1u, call_count);

  EXPECT_FALSE(success);
  EXPECT_EQ("INVALID_DATA", status);
}


text:
package com.takin.emmet.log.log;

import java.util.Calendar;

public class DayRollLog extends RollLog {

    @Override
    public int getCalendarType() {
        return Calendar.DAY_OF_YEAR;
    }

}


text:
package originpolymorphichelpers

import (
	"k8s.io/apimachinery/pkg/api/meta"
	"k8s.io/cli-runtime/pkg/genericclioptions"
	"k8s.io/kubernetes/pkg/kubectl"
	"k8s.io/kubernetes/pkg/kubectl/polymorphichelpers"

	appsv1 "github.com/openshift/api/apps/v1"
	appsclient "github.com/openshift/client-go/apps/clientset/versioned"
	deploymentcmd "github.com/openshift/origin/pkg/oc/originpolymorphichelpers/deploymentconfigs"
)

func NewRollbackerFn(delegate polymorphichelpers.RollbackerFunc) polymorphichelpers.RollbackerFunc {
	return func(restClientGetter genericclioptions.RESTClientGetter, mapping *meta.RESTMapping) (kubectl.Rollbacker, error) {
		if appsv1.SchemeGroupVersion.WithKind("DeploymentConfig").GroupKind() == mapping.GroupVersionKind.GroupKind() {
			config, err := restClientGetter.ToRESTConfig()
			if err != nil {
				return nil, err
			}
			appsClient, err := appsclient.NewForConfig(config)
			if err != nil {
				return nil, err
			}
			return deploymentcmd.NewDeploymentConfigRollbacker(appsClient), nil
		}
		return delegate(restClientGetter, mapping)
	}
}


text:
import * as os from 'os';
import * as tl from 'vsts-task-lib/task';
import * as URL from 'url';
import * as ipaddress from 'ip-address';

import { NormalizeRegistry } from './npmrcparser';
import * as util from './util';

export interface INpmRegistry {
    url: string;
    auth: string;
    authOnly: boolean;
}

export class NpmRegistry implements INpmRegistry {
    public url: string;
    public auth: string;
    public authOnly: boolean;

    constructor(url: string, auth: string, authOnly?: boolean) {
        this.url = url;
        this.auth = auth;
        this.authOnly = authOnly || false;
    }

    public static FromServiceEndpoint(endpointId: string, authOnly?: boolean): NpmRegistry {
        let lineEnd = os.EOL;
        let endpointAuth: tl.EndpointAuthorization;
        let url: string;
        let nerfed: string;
        let auth: string;
        let username: string;
        let password: string;
        let email: string;
        let password64: string;
        let isVstsTokenAuth: boolean = false;
        try {
            endpointAuth = tl.getEndpointAuthorization(endpointId, false);
        } catch (exception) {
            throw new Error(tl.loc('ServiceEndpointNotDefined'));
        }

        try {
            let collectionUrl = tl.getVariable("System.TeamFoundationCollectionUri");
            let collectionUrlDomain = NpmRegistry.ParseHostnameForDomain(URL.parse(collectionUrl).hostname);
            url = NormalizeRegistry(tl.getEndpointUrl(endpointId, false));
            let epUrlDomain = NpmRegistry.ParseHostnameForDomain(URL.parse(url).hostname);

            // To the reader, this could be optimized here but it is broken out for readability
            if (endpointAuth.scheme === 'Token'){
                if (collectionUrlDomain === epUrlDomain){
                    // Same domain _OR_ matching IP addrs.  Use PAT+Basic
                    isVstsTokenAuth = true;
                } else if (epUrlDomain.toUpperCase() === 'VISUALSTUDIO.COM'){
                    // If the endpoint is VSTS, full stop.  Use PAT+Basic
                    isVstsTokenAuth = true;
                }
            }
            nerfed = util.toNerfDart(url);
        } catch (exception) {
            throw new Error(tl.loc('ServiceEndpointUrlNotDefined'));
        }

        switch (endpointAuth.scheme) {
            case 'UsernamePassword':
                username = endpointAuth.parameters['username'];
                password = endpointAuth.parameters['password'];
                email = username; // npm needs an email to be set in order to publish, this is ignored on npmjs
                password64 = (new Buffer(password).toString('base64'));

                auth = nerfed + ":username=" + username + lineEnd;
                auth += nerfed + ":_password=" + password64 + lineEnd;
                auth += nerfed + ":email=" + email + lineEnd;
                break;
            case 'Token':
                let apitoken = endpointAuth.parameters['apitoken'];
                if (!isVstsTokenAuth){
                    // Use Bearer auth as it was intended.
                    auth = nerfed + ":_authToken=" + apitoken + lineEnd;
                }else{
                    // VSTS does not support PATs+Bearer only JWTs+Bearer
                    email = 'VssEmail';
                    username = 'VssToken';
                    password64 = (new Buffer(apitoken).toString('base64'));
                    console.log("##vso[task.setvariable variable=" + endpointId + "BASE64_PASSWORD;issecret=true;]" + password64);

                    auth = nerfed + ":username=" + username + lineEnd;
                    auth += nerfed + ":_password=" + password64 + lineEnd;
                    auth += nerfed + ":email=" + email + lineEnd;
                }
                break;
        }

        auth += nerfed + ":always-auth=true";
        return new NpmRegistry(url, auth, authOnly);
    }

    public static async FromFeedId(feedId: string, authOnly?: boolean): Promise<NpmRegistry> {
        let url = NormalizeRegistry(await util.getFeedRegistryUrl(feedId));
        let nerfed = util.toNerfDart(url);
        let auth = `${nerfed}:_authToken=${util.getSystemAccessToken()}`;

        return new NpmRegistry(url, auth, authOnly);
    }

    /**
     * Helper function to return the domain name given a hostname.
     * @param hostname This should be the output from: url.parse('http://myserver.example.com').hostname
     * @returns Given a FQDN the domain name will be returned.  Given a hostname the
     * hostname will be return.  Given an IP address, the IP will be returned.
     */
    private static ParseHostnameForDomain(hostname: string): string {
        if (hostname &&
            (!new ipaddress.Address6(hostname).isValid() &&
             !new ipaddress.Address4(hostname).isValid())) {
                // We know we have a non-null string that is not an IP addr
                let hnAry = hostname.split('.');
                return hnAry.slice(-2).join('.')
        }
        return hostname;
    }
}


text:
<?php

namespace PHPExiftool\Driver\Tag\ASF;

use JMS\Serializer\Annotation\ExclusionPolicy;
use PHPExiftool\Driver\AbstractTag;

/**
 * @ExclusionPolicy("all")
 */
class MediaIsRepeat extends AbstractTag
{

    protected $Id = 'MediaIsRepeat';

    protected $Name = 'MediaIsRepeat';

    protected $FullName = 'ASF::ExtendedDescr';

    protected $GroupName = 'ASF';

    protected $g0 = 'ASF';

    protected $g1 = 'ASF';

    protected $g2 = 'Video';

    protected $Type = '?';

    protected $Writable = false;

    protected $Description = 'Media Is Repeat';

}


text:
package edu.common.dynamicextensions.ui.util;

import java.util.List;
import java.util.Map;

/**
 *
 * @author deepti_shelar
 *
 */
public class ControlsConfigurationObject
{
	private String controlName;
	private String displayLabel;
	private String jspName;
	private String imageFilePath;
	private List commonValidationRules ;
	private List commonImplicitRules ;
	private List commonExplicitRules ;
	private Map dataTypeValidationRules ;
	private List dataTypesList ;
	private Map dataTypeImplicitRules ;
	private Map dataTypeExplicitRules ;

	/**
	 * @return the controlName
	 */
	public String getControlName()
	{
		return controlName;
	}
	/**
	 * @param controlName the controlName to set
	 */
	public void setControlName(String controlName)
	{
		this.controlName = controlName;
	}
	/**
	 * @return the displayLabel
	 */
	public String getDisplayLabel()
	{
		return displayLabel;
	}
	/**
	 * @param displayLabel the displayLabel to set
	 */
	public void setDisplayLabel(String displayLabel)
	{
		this.displayLabel = displayLabel;
	}
	/**
	 * @return the jspName
	 */
	public String getJspName()
	{
		return jspName;
	}
	/**
	 * @param jspName the jspName to set
	 */
	public void setJspName(String jspName)
	{
		this.jspName = jspName;
	}
	/**
	 * @return the dataTypes
	 */
	public List getDataTypesList()
	{
		return dataTypesList;
	}
	/**
	 * @param dataTypesList the dataTypes to set
	 */
	public void setDataTypesList(List dataTypesList)
	{
		this.dataTypesList = dataTypesList;
	}
	/**
	 * @return the commonValidationRules
	 */
	public List getCommonValidationRules()
	{
		return commonValidationRules;
	}
	/**
	 * @param commonValidationRules the commonValidationRules to set
	 */
	public void setCommonValidationRules(List commonValidationRules)
	{
		this.commonValidationRules = commonValidationRules;
	}
	/**
	 * @return the dataTypeValidationRules
	 */
	public Map getDataTypeValidationRules()
	{
		return dataTypeValidationRules;
	}
	/**
	 * @param dataTypeValidationRules the dataTypeValidationRules to set
	 */
	public void setDataTypeValidationRules(Map dataTypeValidationRules)
	{
		this.dataTypeValidationRules = dataTypeValidationRules;
	}
	/**
	 * @return the dataTypeExplicitRules
	 */
	public Map getDataTypeExplicitRules()
	{
		return dataTypeExplicitRules;
	}
	/**
	 * @param dataTypeExplicitRules the dataTypeExplicitRules to set
	 */
	public void setDataTypeExplicitRules(Map dataTypeExplicitRules)
	{
		this.dataTypeExplicitRules = dataTypeExplicitRules;
	}
	/**
	 * @return the dataTypeImplicitRules
	 */
	public Map getDataTypeImplicitRules()
	{
		return dataTypeImplicitRules;
	}
	/**
	 * @param dataTypeImplicitRules the dataTypeImplicitRules to set
	 */
	public void setDataTypeImplicitRules(Map dataTypeImplicitRules)
	{
		this.dataTypeImplicitRules = dataTypeImplicitRules;
	}
	/**
	 * @return the commonExplicitRules
	 */
	public List getCommonExplicitRules()
	{
		return commonExplicitRules;
	}
	/**
	 * @param commonExplicitRules the commonExplicitRules to set
	 */
	public void setCommonExplicitRules(List commonExplicitRules)
	{
		this.commonExplicitRules = commonExplicitRules;
	}
	/**
	 * @return the commonImplicitRules
	 */
	public List getCommonImplicitRules()
	{
		return commonImplicitRules;
	}
	/**
	 * @param commonImplicitRules the commonImplicitRules to set
	 */
	public void setCommonImplicitRules(List commonImplicitRules)
	{
		this.commonImplicitRules = commonImplicitRules;
	}
	public String getImageFilePath()
	{
		return this.imageFilePath;
	}
	public void setImageFilePath(String imageFilePath)
	{
		this.imageFilePath = imageFilePath;
	}
}


text:
import React from 'react';
import CircularProgress from '@material-ui/core/CircularProgress';

const LoadingSearchResults = () => (
  <div className="PlaylistPanel-loading">
    <CircularProgress size="100%" />
  </div>
);

export default LoadingSearchResults;