text:
<?xml version="1.0" encoding="UTF-8"?>
<prefixROOT:root xmlns:prefixROOT="uriROOT">
	<child xmlns="uri"/>
</prefixROOT:root>

redpajama_set_name: RedPajamaGithub


text:
<?php

namespace Simplario\Checker\Tests\Checker;

use Simplario\Checker\Checker\AbstractChecker;
use Simplario\Checker\Checker\Filesystem;
use Simplario\Checker\ResultException\FailException;
use Simplario\Checker\ResultException\SuccessException;
use PHPUnit\Framework\TestCase;

/**
 * Class FileSystemTest
 *
 * @package Simplario\Checker\Tests\Checker
 */
class FileSystemTest extends TestCase
{
    /**
     * @return void
     */
    public function testInstance()
    {
        $checker = new Filesystem();

        $this->assertInstanceOf(AbstractChecker::class, $checker);
    }

    /**
     * @return void
     */
    public function testRunTestExists()
    {
        $this->expectException(SuccessException::class);

        $checker = new Filesystem();
        $checker->check(['path' => __FILE__, 'exists' => true]);
    }

    /**
     * @return void
     */
    public function testRunTestExistsNot()
    {
        $this->expectException(FailException::class);

        $checker = new Filesystem();
        $checker->check(['path' => __FILE__, 'exists' => false]);
    }

    /**
     * @return void
     */
    public function testRunTestFile()
    {
        $this->expectException(SuccessException::class);

        $checker = new Filesystem();
        $checker->check(['path' => __FILE__, 'file' => true]);
    }

    /**
     * @return void
     */
    public function testRunTesttFileNot()
    {
        $this->expectException(FailException::class);

        $checker = new Filesystem();
        $checker->check(['path' => __FILE__, 'file' => false]);
    }

    /**
     * @return void
     */
    public function testRunTestFolder()
    {
        $this->expectException(SuccessException::class);

        $checker = new Filesystem();
        $checker->check(['path' => __DIR__, 'folder' => true]);
    }

    /**
     * @return void
     */
    public function testRunTestFolderNot()
    {
        $this->expectException(FailException::class);

        $checker = new Filesystem();
        $checker->check(['path' => __DIR__, 'folder' => false]);
    }

    /**
     * @return void
     */
    public function testRunTestReadable()
    {
        $this->expectException(SuccessException::class);

        $checker = new Filesystem();
        $checker->check(['path' => __FILE__, 'readable' => true]);
    }

    /**
     * @return void
     */
    public function testRunTestReadableNot()
    {
        $this->expectException(FailException::class);

        $checker = new Filesystem();
        $checker->check(['path' => __FILE__, 'readable' => false]);
    }

    /**
     * @return void
     */
    public function testRunTestWritable()
    {
        $this->expectException(SuccessException::class);

        $checker = new Filesystem();
        $checker->check(['path' => __FILE__, 'writable' => true]);
    }

    /**
     * @return void
     */
    public function testRunTestWritableNot()
    {
        $this->expectException(FailException::class);

        $checker = new Filesystem();
        $checker->check(['path' => __FILE__, 'writable' => false]);
    }

    /**
     * @return void
     */
    public function testRunTestChmod()
    {
        $this->expectException(SuccessException::class);
        $currentChmod = substr(sprintf('%o', fileperms(__FILE__)), -4);

        $checker = new Filesystem();
        $checker->check(['path' => __FILE__, 'chmod' => $currentChmod]);
    }

    /**
     * @return void
     */
    public function testRunTestChmodNot()
    {
        $this->expectException(FailException::class);
        $currentChmod = '0987';

        $checker = new Filesystem();
        $checker->check(['path' => __FILE__, 'chmod' => $currentChmod]);
    }

    /**
     * @return void
     */
    public function testRunTestContain()
    {
        $findMe = 'UniqueSuperStringInThisFile-!@#';
        $this->expectException(SuccessException::class);

        $checker = new Filesystem();
        $checker->check(['path' => __FILE__, 'contain' => $findMe]);
    }

    /**
     * @return void
     */
    public function testRunTestContainNot()
    {
        $findMe = uniqid() . time();
        $this->expectException(FailException::class);

        $checker = new Filesystem();
        $checker->check(['path' => __FILE__, 'contain' => $findMe]);
    }
}


text:
#include <linux/config.h>
#include <linux/module.h>
#include <linux/types.h>

/* We really haven't played around with modules at all in our
 * port, but this is here as a starting point for when we do.
 * One thing to note is that the way the symbols of the mul/div
 * support routines are named is a mess, they all start with
 * a '.' which makes it a bitch to export, we'll see.
 */

extern void bcopy (const char *src, char *dst, int len);
extern void * memmove(void *,const void *,size_t);
extern void * memcpy(void *,const void *,size_t);

static struct symbol_table arch_symbol_table = {
#include <linux/symtab_begin.h>
	/* platform dependent support */
	X(bcopy),
	X(memmove),
	X(memcpy),
#include <linux/symtab_end.h>
};

void arch_syms_export(void)
{
	register_symtab(&arch_symbol_table);
}


text:
package example.webcrawler;

import java.io.IOException;
import java.util.ArrayList;
import java.util.List;

import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.Element;
import org.jsoup.select.Elements;

/**
 * Basic web crawler to show case how it works in one domain
 *
 * @author Admin
 *
 */
public class SimpleWebcrawler {

	private static int MAX_DEPTH = 2;
	private List<String> links;
	private static String DOMAIN;
	private static boolean searchOtherDomain;

	public SimpleWebcrawler() {
		links = new ArrayList<String>();
	}

	/**
	 * This accepts URL and depth to start the crawling in given domain.
	 *
	 * @param URL
	 *            String to crawl
	 * @param depthString
	 *            depth size for crawling
	 */
	public void getPageLinks(String URL, int depth) {
		if ((!links.contains(URL) && (depth <= MAX_DEPTH) && searchToGivenDomain(URL))) {

			try {
				Extracter.printWeb(URL);
				links.add(URL);

				Document document = Jsoup.connect(URL).get();
				Elements linksOnPage = document.select("a[href]");

				depth++;
				for (Element page : linksOnPage) {
					getPageLinks(page.attr("abs:href"), depth);
				}
			} catch (IOException e) {
				System.err.println("For '" + URL + "': " + e.getMessage());
			}
		}
	}

	private boolean searchToGivenDomain(String URL) {
		if (searchOtherDomain) {
			if (URL.startsWith(DOMAIN)) {
				return true;
			} else {
				return false;
			}
		} else {
			return true;
		}

	}

	public static void main(String[] args) {
		isTrue(args.length == 3, "usage: supply url to fetch");
		DOMAIN = args[0];
		MAX_DEPTH = Integer.parseInt(args[1]);
		searchOtherDomain = Boolean.parseBoolean(args[2]);
		new SimpleWebcrawler().getPageLinks(DOMAIN, 1);
	}

	/**
	 * Validates that the value is true
	 *
	 * @param val
	 *            boolean object to test
	 * @param msg
	 *            Stirng message to output if validation fails
	 */
	public static void isTrue(boolean val, String msg) {
		if (!val)
			throw new IllegalArgumentException(msg);
	}

}


text:
module Cryptoexchange::Exchanges
  module Dydx
    module Services
      class Market < Cryptoexchange::Services::Market
        class << self
          def supports_individual_ticker_query?
            false
          end
        end

        def fetch
          output = super(ticker_url)
          adapt_all(output)
        end

        def ticker_url
          "#{Cryptoexchange::Exchanges::Dydx::Market::API_URL}/stats/markets"
        end

        def adapt_all(output)
          output['markets'].map do |ticker, value|
            next if value["type"] == "PERPETUAL"

            base, target = ticker.split('-')
            market_pair = Cryptoexchange::Models::MarketPair.new(
              base: base,
              target: target,
              market: Dydx::Market::NAME
            )
            adapt(value, market_pair)
          end.compact
        end

        def adapt(output, market_pair)
          ticker           = Cryptoexchange::Models::Ticker.new
          ticker.base      = market_pair.base
          ticker.target    = market_pair.target
          ticker.market    = Dydx::Market::NAME
          ticker.last      = NumericHelper.to_d(output['last'])
          ticker.high      = NumericHelper.to_d(output['high'])
          ticker.low       = NumericHelper.to_d(output['low'])
          ticker.volume    = NumericHelper.to_d(output['baseVolume'])
          ticker.timestamp = nil
          ticker.payload   = output
          ticker
        end
      end
    end
  end
end


text:
"use strict";

module.exports = {
  "env": {
    "es6": false
  },
  "ecmaFeatures": {
    "modules": false
  },
  "rules": {
    // require parens in arrow function arguments
    "arrow-parens": 0,
    // require space before/after arrow function's arrow
    "arrow-spacing": 0,
    // verify super() callings in constructors
    "constructor-super": 0,
    // enforce the spacing around the * in generator functions
    "generator-star-spacing": 0,
    // disallow modifying variables of class declarations
    "no-class-assign": 0,
    // disallow modifying variables that are declared using const
    "no-const-assign": 0,
    // disallow to use this/super before super() calling in constructors.
    "no-this-before-super": 0,
    // require let or const instead of var
    "no-var": 0,
    // require method and property shorthand syntax for object literals
    "object-shorthand": 0,
    // suggest using of const declaration for variables that are never modified after declared
    "prefer-const": 0,
    // suggest using the spread operator instead of .apply()
    "prefer-spread": 0,
    // suggest using Reflect methods where applicable
    "prefer-reflect": 0,
    // disallow generator functions that do not have yield
    "require-yield": 0
  }
};


text:
using System;
using System.Collections.Generic;
using System.Linq;
using Foundation;
using UIKit;

namespace ManualStoryboard
{
	// The UIApplicationDelegate for the application. This class is responsible for launching the
	// User Interface of the application, as well as listening (and optionally responding) to
	// application events from iOS.
	[Register ("AppDelegate")]
	public partial class AppDelegate : UIApplicationDelegate
	{
		UIWindow window;
		public static UIStoryboard Storyboard = UIStoryboard.FromName ("MainStoryboard", null);
		public static UIViewController initialViewController;

		public override bool FinishedLaunching (UIApplication app, NSDictionary options)
		{
			window = new UIWindow (UIScreen.MainScreen.Bounds);

			initialViewController = Storyboard.InstantiateInitialViewController () as UIViewController;

			window.RootViewController = initialViewController;
			window.MakeKeyAndVisible ();
			return true;
		}

	}

}


text:
package openshift

import (
	"context"
	"crypto/tls"
	"crypto/x509"
	"encoding/json"
	"fmt"
	"io/ioutil"
	"net"
	"net/http"
	"strings"
	"time"

	"golang.org/x/oauth2"

	"github.com/dexidp/dex/connector"
	"github.com/dexidp/dex/pkg/groups"
	"github.com/dexidp/dex/pkg/log"
	"github.com/dexidp/dex/storage/kubernetes/k8sapi"
)

// Config holds configuration options for OpenShift login
type Config struct {
	Issuer       string   `json:"issuer"`
	ClientID     string   `json:"clientID"`
	ClientSecret string   `json:"clientSecret"`
	RedirectURI  string   `json:"redirectURI"`
	Groups       []string `json:"groups"`
	InsecureCA   bool     `json:"insecureCA"`
	RootCA       string   `json:"rootCA"`
}

var _ connector.CallbackConnector = (*openshiftConnector)(nil)

type openshiftConnector struct {
	apiURL       string
	redirectURI  string
	clientID     string
	clientSecret string
	cancel       context.CancelFunc
	logger       log.Logger
	httpClient   *http.Client
	oauth2Config *oauth2.Config
	insecureCA   bool
	rootCA       string
	groups       []string
}

type user struct {
	k8sapi.TypeMeta   `json:",inline"`
	k8sapi.ObjectMeta `json:"metadata,omitempty"`
	Identities        []string `json:"identities" protobuf:"bytes,3,rep,name=identities"`
	FullName          string   `json:"fullName,omitempty" protobuf:"bytes,2,opt,name=fullName"`
	Groups            []string `json:"groups" protobuf:"bytes,4,rep,name=groups"`
}

// Open returns a connector which can be used to login users through an upstream
// OpenShift OAuth2 provider.
func (c *Config) Open(id string, logger log.Logger) (conn connector.Connector, err error) {
	ctx, cancel := context.WithCancel(context.Background())

	wellKnownURL := strings.TrimSuffix(c.Issuer, "/") + "/.well-known/oauth-authorization-server"
	req, err := http.NewRequest(http.MethodGet, wellKnownURL, nil)

	openshiftConnector := openshiftConnector{
		apiURL:       c.Issuer,
		cancel:       cancel,
		clientID:     c.ClientID,
		clientSecret: c.ClientSecret,
		insecureCA:   c.InsecureCA,
		logger:       logger,
		redirectURI:  c.RedirectURI,
		rootCA:       c.RootCA,
		groups:       c.Groups,
	}

	if openshiftConnector.httpClient, err = newHTTPClient(c.InsecureCA, c.RootCA); err != nil {
		cancel()
		return nil, fmt.Errorf("failed to create HTTP client: %v", err)
	}

	var metadata struct {
		Auth  string `json:"authorization_endpoint"`
		Token string `json:"token_endpoint"`
	}

	resp, err := openshiftConnector.httpClient.Do(req.WithContext(ctx))
	if err != nil {
		cancel()
		return nil, fmt.Errorf("failed to query OpenShift endpoint %v", err)
	}

	defer resp.Body.Close()

	if err := json.NewDecoder(resp.Body).Decode(&metadata); err != nil {
		cancel()
		return nil, fmt.Errorf("discovery through endpoint %s failed to decode body: %v",
			wellKnownURL, err)
	}

	openshiftConnector.oauth2Config = &oauth2.Config{
		ClientID:     c.ClientID,
		ClientSecret: c.ClientSecret,
		Endpoint: oauth2.Endpoint{
			AuthURL: metadata.Auth, TokenURL: metadata.Token,
		},
		Scopes:      []string{"user:info"},
		RedirectURL: c.RedirectURI,
	}
	return &openshiftConnector, nil
}

func (c *openshiftConnector) Close() error {
	c.cancel()
	return nil
}

// LoginURL returns the URL to redirect the user to login with.
func (c *openshiftConnector) LoginURL(scopes connector.Scopes, callbackURL, state string) (string, error) {
	if c.redirectURI != callbackURL {
		return "", fmt.Errorf("expected callback URL %q did not match the URL in the config %q", callbackURL, c.redirectURI)
	}
	return c.oauth2Config.AuthCodeURL(state), nil
}

type oauth2Error struct {
	error            string
	errorDescription string
}

func (e *oauth2Error) Error() string {
	if e.errorDescription == "" {
		return e.error
	}
	return e.error + ": " + e.errorDescription
}

// HandleCallback parses the request and returns the user's identity
func (c *openshiftConnector) HandleCallback(s connector.Scopes, r *http.Request) (identity connector.Identity, err error) {
	q := r.URL.Query()
	if errType := q.Get("error"); errType != "" {
		return identity, &oauth2Error{errType, q.Get("error_description")}
	}

	ctx := r.Context()
	if c.httpClient != nil {
		ctx = context.WithValue(r.Context(), oauth2.HTTPClient, c.httpClient)
	}

	token, err := c.oauth2Config.Exchange(ctx, q.Get("code"))
	if err != nil {
		return identity, fmt.Errorf("oidc: failed to get token: %v", err)
	}

	client := c.oauth2Config.Client(ctx, token)

	user, err := c.user(ctx, client)
	if err != nil {
		return identity, fmt.Errorf("openshift: get user: %v", err)
	}

	if len(c.groups) > 0 {
		validGroups := validateAllowedGroups(user.Groups, c.groups)

		if !validGroups {
			return identity, fmt.Errorf("openshift: user %q is not in any of the required groups", user.Name)
		}
	}

	identity = connector.Identity{
		UserID:            user.UID,
		Username:          user.Name,
		PreferredUsername: user.Name,
		Email:             user.Name,
		Groups:            user.Groups,
	}

	return identity, nil
}

// user function returns the OpenShift user associated with the authenticated user
func (c *openshiftConnector) user(ctx context.Context, client *http.Client) (u user, err error) {
	url := c.apiURL + "/apis/user.openshift.io/v1/users/~"

	req, err := http.NewRequest("GET", url, nil)
	if err != nil {
		return u, fmt.Errorf("new req: %v", err)
	}

	resp, err := client.Do(req.WithContext(ctx))
	if err != nil {
		return u, fmt.Errorf("get URL %v", err)
	}
	defer resp.Body.Close()

	if resp.StatusCode != http.StatusOK {
		body, err := ioutil.ReadAll(resp.Body)
		if err != nil {
			return u, fmt.Errorf("read body: %v", err)
		}
		return u, fmt.Errorf("%s: %s", resp.Status, body)
	}

	if err := json.NewDecoder(resp.Body).Decode(&u); err != nil {
		return u, fmt.Errorf("JSON decode: %v", err)
	}

	return u, err
}

func validateAllowedGroups(userGroups, allowedGroups []string) bool {
	matchingGroups := groups.Filter(userGroups, allowedGroups)

	return len(matchingGroups) != 0
}

// newHTTPClient returns a new HTTP client
func newHTTPClient(insecureCA bool, rootCA string) (*http.Client, error) {
	tlsConfig := tls.Config{}

	if insecureCA {
		tlsConfig = tls.Config{InsecureSkipVerify: true}
	} else if rootCA != "" {
		tlsConfig = tls.Config{RootCAs: x509.NewCertPool()}
		rootCABytes, err := ioutil.ReadFile(rootCA)
		if err != nil {
			return nil, fmt.Errorf("failed to read root-ca: %v", err)
		}
		if !tlsConfig.RootCAs.AppendCertsFromPEM(rootCABytes) {
			return nil, fmt.Errorf("no certs found in root CA file %q", rootCA)
		}
	}

	return &http.Client{
		Transport: &http.Transport{
			TLSClientConfig: &tlsConfig,
			Proxy:           http.ProxyFromEnvironment,
			DialContext: (&net.Dialer{
				Timeout:   30 * time.Second,
				KeepAlive: 30 * time.Second,
				DualStack: true,
			}).DialContext,
			MaxIdleConns:          100,
			IdleConnTimeout:       90 * time.Second,
			TLSHandshakeTimeout:   10 * time.Second,
			ExpectContinueTimeout: 1 * time.Second,
		},
	}, nil
}


text:
package org.unitils.core.util;

import org.junit.Before;
import org.junit.Test;
import org.unitils.core.UnitilsException;
import org.unitils.mock.core.proxy.ProxyInvocation;
import org.unitils.mock.core.proxy.ProxyInvocationHandler;
import org.unitils.mock.core.proxy.ProxyService;
import org.unitils.mock.core.util.CloneService;
import org.unitils.mock.core.util.ObjectFactory;

import java.io.File;
import java.lang.annotation.RetentionPolicy;
import java.lang.reflect.Field;
import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;
import java.lang.reflect.Proxy;
import java.util.Date;
import java.util.LinkedHashMap;
import java.util.Map;

import static java.util.Arrays.asList;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.fail;
import static org.unitils.core.util.CollectionUtils.asSet;

/**
 * @author Tim Ducheyne
 */
public class ObjectFormatterFormatTest {

    private ObjectFormatter objectFormatter;

    private ProxyService proxyService;

    @Before
    public void initialize() {
        objectFormatter = new ObjectFormatter(2, 4);

        proxyService = new ProxyService(new CloneService(new ObjectFactory()));
    }

    @Test
    public void nullValue() {
        String result = objectFormatter.format(null);
        assertEquals("null", result);
    }

    @Test
    public void string() {
        String result = objectFormatter.format("value");
        assertEquals("\"value\"", result);
    }

    @Test
    public void number() {
        String result = objectFormatter.format(new Integer("5"));
        assertEquals("5", result);
    }

    @Test
    public void date() {
        Date date = new Date();
        String result = objectFormatter.format(date);
        assertEquals(date.toString(), result);
    }

    @Test
    public void objectToFormat() {
        String result = objectFormatter.format(new MyObjectToFormat());
        assertEquals("formatted", result);
    }

    @Test
    public void character() {
        String result = objectFormatter.format('c');
        assertEquals("'c'", result);
    }

    @Test
    @SuppressWarnings("UnnecessaryBoxing")
    public void characterWrapper() {
        String result = objectFormatter.format(new Character('c'));
        assertEquals("'c'", result);
    }

    @Test
    public void primitive() {
        String result = objectFormatter.format(5);
        assertEquals("5", result);
    }

    @Test
    public void enumValue() {
        String result = objectFormatter.format(RetentionPolicy.RUNTIME);
        assertEquals("RUNTIME", result);
    }

    @Test
    public void jdkProxy() {
        Object proxy = Proxy.newProxyInstance(getClass().getClassLoader(), new Class[]{MyInterface.class}, new InvocationHandler() {
            public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
                return null;
            }
        });
        String result = objectFormatter.format(proxy);
        assertEquals("Proxy<?>", result);
    }

    @Test
    public void cglibProxy() {
        Object proxy = proxyService.createProxy("1", "name", false, new ProxyInvocationHandler() {
            public Object handleInvocation(ProxyInvocation proxyInvocation) throws Throwable {
                return null;
            }
        }, Object.class, MyInterface.class);
        String result = objectFormatter.format(proxy);
        assertEquals("Proxy<name>", result);
    }

    @Test
    public void javaLang() {
        Class<?> clazz = getClass();
        String result = objectFormatter.format(clazz);
        assertEquals(clazz.toString(), result);
    }

    @Test
    public void array() {
        String result = objectFormatter.format(new int[]{3, 2, 1});
        assertEquals("[3, 2, 1]", result);
    }

    @Test
    public void arrayTruncatedWhenTooManyElements() {
        String result = objectFormatter.format(new int[]{1, 2, 3, 4, 5});
        assertEquals("[1, 2, 3, 4, ...]", result);
    }

    @Test
    public void list() {
        String result = objectFormatter.format(asList(3, 2, 1));
        assertEquals("[3, 2, 1]", result);
    }

    @Test
    public void listTruncatedWhenTooManyElements() {
        String result = objectFormatter.format(asList(1, 2, 3, 4, 5));
        assertEquals("[1, 2, 3, 4, ...]", result);
    }

    @Test
    public void set() {
        String result = objectFormatter.format(asSet(3, 2, 1));
        assertEquals("[3, 2, 1]", result);
    }

    @Test
    public void setTruncatedWhenTooManyElements() {
        String result = objectFormatter.format(asSet(1, 2, 3, 4, 5));
        assertEquals("[1, 2, 3, 4, ...]", result);
    }

    @Test
    public void map() {
        Map<String, String> map = new LinkedHashMap<String, String>();
        map.put("1", "11");
        map.put("2", "22");
        map.put("3", "33");
        String result = objectFormatter.format(map);
        assertEquals("{\"1\"=\"11\", \"2\"=\"22\", \"3\"=\"33\"}", result);
    }

    @Test
    public void mapTruncatedWhenTooManyElements() {
        Map<String, String> map = new LinkedHashMap<String, String>();
        map.put("1", "11");
        map.put("2", "22");
        map.put("3", "33");
        map.put("4", "44");
        map.put("5", "55");
        String result = objectFormatter.format(map);
        assertEquals("{\"1\"=\"11\", \"2\"=\"22\", \"3\"=\"33\", \"4\"=\"44\", ...}", result);
    }

    @Test
    public void file() {
        String result = objectFormatter.format(new File("path"));
        assertEquals("File<path>", result);
    }

    @Test
    public void object() {
        MyClass nestedValue = new MyClass();
        nestedValue.field1 = 55;
        nestedValue.field2 = "nested value";
        MyClass object = new MyClass();
        object.field1 = 44;
        object.field2 = "value";
        object.field3 = nestedValue;

        String result = objectFormatter.format(object);
        assertEquals("ObjectFormatterFormatTest.MyClass<field1=44, field2=\"value\", field3=ObjectFormatterFormatTest.MyClass<field1=55, field2=\"nested value\", field3=null>>", result);
    }

    @Test
    public void objectTruncatedWhenNestingTooDeep() {
        MyClass nestedValue1 = new MyClass();
        nestedValue1.field1 = 55;
        nestedValue1.field2 = "nested value 1";
        MyClass nestedValue2 = new MyClass();
        nestedValue2.field1 = 66;
        nestedValue2.field2 = "nested value 2";
        nestedValue2.field3 = nestedValue1;
        MyClass object = new MyClass();
        object.field1 = 44;
        object.field2 = "value";
        object.field3 = nestedValue2;

        String result = objectFormatter.format(object);
        assertEquals("ObjectFormatterFormatTest.MyClass<field1=44, field2=\"value\", field3=ObjectFormatterFormatTest.MyClass<field1=66, field2=\"nested value 2\", field3=ObjectFormatterFormatTest.MyClass<...>>>", result);
    }

    @Test
    public void hierarchy() {
        ClassA object = new ClassD();

        String result = objectFormatter.format(object);
        assertEquals("ObjectFormatterFormatTest.ClassD<fieldC=\"C\", fieldXX=\"33\", fieldB=\"B\", fieldXX=\"22\", fieldA=\"A\", fieldXX=\"11\">", result);
    }

    @Test
    public void exceptionWhenIllegalAccess() {
        ObjectFormatter objectFormatter = new ObjectFormatter() {
            @Override
            protected Object getFieldValue(Object object, Field field) throws IllegalAccessException {
                throw new IllegalAccessException("expected");
            }
        };
        try {
            objectFormatter.format(new MyClass());
            fail("UnitilsException expected");
        } catch (UnitilsException e) {
            assertEquals("Unable to format field private int org.unitils.core.util.ObjectFormatterFormatTest$MyClass.field1\n" +
                    "Reason: IllegalAccessException: expected", e.getMessage());
        }
    }

    @Test
    public void transientFieldsAreIgnored() {
        TransientFieldClass object = new TransientFieldClass();
        object.transientField = 777;

        String result = objectFormatter.format(object);
        assertEquals("ObjectFormatterFormatTest.TransientFieldClass<>", result);
    }

    @Test
    public void staticFieldsAreIgnored() {
        StaticFieldClass object = new StaticFieldClass();
        StaticFieldClass.staticField = 777;

        String result = objectFormatter.format(object);
        assertEquals("ObjectFormatterFormatTest.StaticFieldClass<>", result);
    }

    @Test
    public void syntheticFieldsAreIgnored() {
        NonStaticSyntheticFieldClass object = new NonStaticSyntheticFieldClass();

        String result = objectFormatter.format(object);
        assertEquals("ObjectFormatterFormatTest.NonStaticSyntheticFieldClass<>", result);
    }

    private static class MyObjectToFormat implements ObjectToFormat {

        public String $formatObject() {
            return "formatted";
        }
    }

    public static interface MyInterface {
    }

    public static class MyClass {

        private int field1;
        private String field2;
        private MyClass field3;
    }

    public static class ClassA {
        private String fieldA = "A";
        protected String fieldXX = "11";
    }

    public static class ClassB extends ClassA {
        private String fieldB = "B";
        protected String fieldXX = "22";
    }

    public static class ClassC extends ClassB {
        private String fieldC = "C";
        protected String fieldXX = "33";
    }

    public static class ClassD extends ClassC {
    }

    public class NonStaticSyntheticFieldClass {
    }

    public static class TransientFieldClass {

        private transient int transientField;
    }

    public static class StaticFieldClass {

        private static int staticField;
    }
}


text:
package servlets;

import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;

import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.annotation.MultipartConfig;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.Part;

import service.HeaderService;
import service.HtmlService;
import service.InvitedUserService;
import dto.UserDto;
import dto.Validator;

/**
 * Servlet implementation class InvitedUserServlet
 */

@WebServlet(name = "inviteduser", urlPatterns = { "/inviteduser" })
@MultipartConfig(maxFileSize = 10240)

public class InvitedUserServlet extends HttpServlet {
	private static final long serialVersionUID = 1L;

	private String mode = "1";
	private String messageAlert = "";
	private String messageLabel = "";
	private String outModal = "";

	private String firstName = "";
	private String lastName = "";
	private String emailAdd = "";
	private String password = "";
	private String keyPassword = "";
	private Part filePart = null;

	private String placeHoldFirstName = "Enter your first name here";
	private String placeHoldLastName = "Enter your last name here";
    /**
     * @see HttpServlet#HttpServlet()
     */
    public InvitedUserServlet() {
        super();
    }

	/**
	 * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

		if(!HeaderService.isTempUser(request)) {
			// if the user is not temp user, redirect to main.jsp
			messageAlert = HtmlService.drawMessageAlert("Select option to proceed", "");
			request.setAttribute("message_alert", messageAlert);

			RequestDispatcher rd = getServletContext().getRequestDispatcher("/main");
			rd.forward(request, response);
		} else {
			//if the user is a temp user:

			messageAlert = HtmlService.drawMessageAlert("Complete your registration", "");

			//Prepare login screen
			routineUpdateNewUserModal(request);

			request.setAttribute("mode", mode);
			request.setAttribute("message_alert", messageAlert);
			request.setAttribute("message_label", messageLabel);
			request.setAttribute("out_modal", outModal);
			request.setAttribute("message_alert", messageAlert);

			RequestDispatcher rd = getServletContext().getRequestDispatcher("/invitedUser.jsp");
			rd.forward(request, response);
		}	}

	/**
	 * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		if(!HeaderService.isTempUser(request)) {

			// if the user is not temp user, redirect to main.jsp
			messageAlert = HtmlService.drawMessageAlert("Select option to proceed", "");
			request.setAttribute("message_alert", messageAlert);
			RequestDispatcher rd = getServletContext().getRequestDispatcher("/main");
			rd.forward(request, response);
		}else{

			//Prepare login screen
			routineUpdateNewUserModal(request);

			if(request.getParameter("rdn_basic_signup") != null){
				//update new user with basic information:
				//get the values:
				firstName = request.getParameter("new_user_firstname");
				lastName = request.getParameter("new_user_lastname");
				emailAdd = HeaderService.getUserEmail(request);
				password = request.getParameter("new_user_password");

				//Do basic update:
				doBasicUpdate(request);
			}else if (request.getParameter("rdn_generate_new_keys") != null){
				//udpate new user with key protection password:
				//get the values:
				firstName = request.getParameter("new_user_firstname");
				lastName = request.getParameter("new_user_lastname");
				emailAdd = HeaderService.getUserEmail(request);
				password = request.getParameter("new_user_password");

				// get the protection password:
				keyPassword = request.getParameter("new_key_password");

				//Do update:
				doUpdateWithKeyProtectionPassword(request);
			}else if (request.getParameter("rdn_upload_key") != null){
				//update new user with uploaded key:
				//get the values:
				firstName = request.getParameter("new_user_firstname");
				lastName = request.getParameter("new_user_lastname");
				emailAdd = HeaderService.getUserEmail(request);
				password = request.getParameter("new_user_password");

				// obtains the upload file part in this multipart request
		        filePart = request.getPart("uploadFile");

		        //Do signup with pulic key:
				doUpdateWithPublicKey(request);
			}

			request.setAttribute("mode", mode);
			request.setAttribute("message_alert", messageAlert);
			request.setAttribute("message_label", messageLabel);
			request.setAttribute("out_modal", outModal);

			RequestDispatcher rd = getServletContext().getRequestDispatcher("/invitedUser.jsp");
			rd.forward(request, response);
		}
	}

	public void doBasicUpdate(HttpServletRequest request){
		resetGlobals();

		UserDto newUser = new UserDto();

		newUser.setFirstName(firstName);
		newUser.setLastName(lastName);
		newUser.setEmail(emailAdd);
		newUser.setPassword(password);

		Validator v = InvitedUserService.addUpdateUser(request, newUser);

		if (v.isVerified()){
			outModal = drawSuccessfullAdding(newUser.getFirstName());
			HeaderService.logout(request);
		}else{
			outModal = drawFailedAdding(v.getStatus());
		}

	}

	/**
	 * This function tries to add new user to the DB and generate keys:
	 */
	public void doUpdateWithKeyProtectionPassword(HttpServletRequest request){
		resetGlobals();

		UserDto newUser = new UserDto();

		newUser.setFirstName(firstName);
		newUser.setLastName(lastName);
		newUser.setEmail(emailAdd);
		newUser.setPassword(password);
		newUser.setTempPassword(keyPassword);

		Validator v = InvitedUserService.updateUserwithKeyProtectionPassword(request, newUser);

		if (v.isVerified()){
			outModal = drawSuccessfullAdding(newUser.getFirstName());
			HeaderService.logout(request);
		}else{
			outModal = drawFailedAdding(v.getStatus());
		}
	}

	/**
	 * This function tries to add new user to the DB and upload the user public key:
	 * @throws IOException
	 */
	public void doUpdateWithPublicKey(HttpServletRequest request) throws IOException{
		resetGlobals();

		InputStream inputStream = null; // input stream of the upload file

        if (filePart != null) {
            int fileSize = (int) filePart.getSize();

            if (fileSize == 0){
            	outModal = drawUploadingPageError();
            }else if (fileSize >= 10240){
            	outModal = drawUploadingPageError();
            }else{
            	//obtains input stream of the upload file
            	inputStream = filePart.getInputStream();

            	ByteArrayOutputStream buffer = new ByteArrayOutputStream();
    			int nRead;
    			byte[] data = new byte[16384];

    			while ((nRead = inputStream.read(data, 0, data.length)) != -1) {
    			  buffer.write(data, 0, nRead);
    			}

    			buffer.flush();

    			byte[] publicKeyBytes = buffer.toByteArray();

            	UserDto newUser = new UserDto();

        		newUser.setFirstName(firstName);
        		newUser.setLastName(lastName);
        		newUser.setEmail(emailAdd);
        		newUser.setPassword(password);
            	newUser.setPublicKeyBytes(publicKeyBytes);

            	Validator res = InvitedUserService.updateUserWithPublicKey(request, newUser);

            	if (res.isVerified()){
            		outModal = drawSuccessfullAdding(newUser.getFirstName());
        			HeaderService.logout(request);
                }else{
                	outModal = drawFailedAdding(res.getStatus());
                }
            }
        }

	}

	/**
	 * This function is to draw a welcome page after a successful adding user:
	 * @return HTML String
	 */
	public String drawSuccessfullAdding(String fName){
		String out = "";

		out += "
";
			out += "
Welcome " + fName + " to Certus Voting System!
";
			out += "Let's get started!";
		out += "
";

		return out;
	}

	/**
	 * This function is to draw a failure page after an unsuccessful adding user:
	 * @return HTML String
	 */
	public String drawFailedAdding(String status){
		String out = "
";

		out += "
";
			out += "
OOPS!
";
			out += "
We couldn't create a new account for you because "+ status +"
";
			out += "
Do you want to try again?
";

			out += "
";
				out += "
Try again
";
				out += "
Return to Login Page
";
			out += "
";
		out += "
";

		return out;
	}

    public String drawUploadingPageError(){
		String out = "";
		out += "
You didn't select a file!
";
		out += "
";
		out += "Your file size cannot be larger than 10 kilbytes.";
		out += "
";
		out += "
";
		out += "
";
		out += "Start again";
		out += "
";

		return out;
	}

	/**
	 * This function performs required actions to show add new new modal
	 */
	public void routineUpdateNewUserModal(HttpServletRequest request) {
		resetGlobals();
		outModal = drawUpdateUser(request);
	}

	/**
	 * This functions resets all global variables for this class
	 */
	private void resetGlobals() {
		this.messageAlert = "";
		this.mode = "1";
		messageLabel = "";
		outModal = "";
	}

	/**
	 *
	 * This method draws HTML modal output for a new user
	 * @return HTML output
	 */
	public String drawUpdateUser(HttpServletRequest request) {
		String out = "";

		out += "<form id=\"invited_form_user_new\" name=\"invited_form_user_new\" action=\"inviteduser\" method=\"post\" data-abide enctype=\"multipart/form-data\" onsubmit=\"return prepareInvitedForm()\" >";
		// draw basic user info
		out += "
";
			out += "
";
				out += "<fieldset>";
					out += "<legend>Basic Information</legend>";
					out += HtmlService.drawInputTextAlphanumeric("new_user_firstname", "First Name", placeHoldFirstName, "");
					out += HtmlService.drawInputTextAlphanumeric("new_user_lastname", "Last Name", placeHoldLastName, "");

					out += "
";
					out += "" + "E-mail Address" + " required";
					out += "<input disabled=\"none\" type=\"email\" name=\""+ "new_user_email" + "\" placeholder=\"" + "your@email.address" + "\" value=\"" + HeaderService.getUserEmail(request) + "\" required \">";
					out += "";
					out += "" + "E-mail Address" + " field can only contain letters and numbers and cannot be empty";
					out += "
";

					out += HtmlService.drawInputTextPasswordAndConfirmation("new_user_password", "Password", "new_user_password_confirm", "Confirm Password", false);
					out += "Note: this password will be used to protect your private key, if you want to setup a different "
								+ "password to protect your private key, or upload your own public key, click advanced options.";
					out += "
";
					out += "(Show Advanced Options)";
					out += "(Hide Advanced Options)";
					out += "
";

				out += "</fieldset>";

				// buttons
				out += "
";
				out += "<button class=\"radius button left\" type=\"submit\" name=\"button_basic_signup\">Update</button>";
				out += "
";

			out += "
";

			// RIGHT
			out += "
";
			//Basic Signup Radio:
			out += "<input type=\"radio\" name=\"rdn_basic_signup\" id=\"rdn_basic_signup\" value=\"rdn_basic_signup\" onMouseDown=\"onBasicSignupRadioClick()\" checked>Basic Information Only
";

			//Generate New key Radio:
			out += "<input type=\"radio\" name=\"rdn_generate_new_keys\" id=\"rdn_generate_new_keys\" value=\"rdn_generate_new_keys\" onMouseDown=\"onGenerateKeysRadioClick()\">Generate new protected private key
";

			//draw key protection fields:
			out += "
";
				out += "<fieldset>";
					out += "<legend>Key Protection Password</legend>";
					out += HtmlService.drawInputTextPasswordAndConfirmation("new_key_password", "Password", "new_key_password_confirm", "Confirm Password", true);

					//button
					out += "
";
					out += "Once you hit the submit button, we will create an account for you and send your protected private key to your email address.";
					out += "P.S. this might take few seconds, please wait.";
					out += "
";
				out += "</fieldset>";
			out += "
";
		out += "
";

		//Upload Old public key Radio:

		out += "
";
			out += "<input type=\"radio\"  onMouseDown=\"onUploadRadioClick()\" name=\"rdn_upload_key\" id=\"rdn_upload_key\" value=\"rdn_upload_key\" >Upload your own public key
";
			//Draw upload button
			out += "
";
				out += "<fieldset>";
					out += "<legend>Your Public Key path</legend>";

					//error messages:
					out += "

Please select a file.

";
					out += "

The file is larger than 10 kilobytes.

";
					out += "

The file API isn't supported on this browser yet.

";

					out += "
Your file size cannot be larger than 10 kilobytes.
";

					out += "<input name=\"uploadFile\" id=\"FileInput\" type=\"file\" size=\"10240\" disabled=\"disabled\">";

				out += "</fieldset>";
			out += "
";
		out += "
";
		out += "
";
	out += "</form>";

		return out;
	}

}


text:
// Copyright (C) 2015 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
es6id: 21.1.3.7
description: >
  Returns false if position is >= this.length and searchString.length > 0.
info: >
  21.1.3.7 String.prototype.includes ( searchString [ , position ] )

  ...
  11. Let len be the number of elements in S.
  12. Let start be min(max(pos, 0), len).
  13. Let searchLen be the number of elements in searchStr.
  14. If there exists any integer k not smaller than start such that k +
  searchLen is not greater than len, and for all nonnegative integers j less
  than searchLen, the code unit at index k+j of S is the same as the code unit
  at index j of searchStr, return true; but if there is no such integer k,
  return false.
  ...
---*/

var str = 'The future is cool!';

assert.sameValue(
  str.includes('!', str.length + 1), false,
  'str.includes("!", str.length + 1) returns false'
);

assert.sameValue(
  str.includes('!', 100), false,
  'str.includes("!", 100) returns false'
);

assert.sameValue(
  str.includes('!', Infinity), false,
  'str.includes("!", Infinity) returns false'
);

assert.sameValue(
  str.includes('!', str.length), false,
  'str.includes("!", str.length) returns false'
);


text:
using System;
using System.Web.Mvc;
using System.Web.UI;
using Umbraco.Core.Cache;
using Umbraco.Core.Composing;
using Umbraco.Core.Logging;
using Umbraco.Core.Services;
using Umbraco.Web.Security;
using Umbraco.Web.UI.Pages;
using Current = Umbraco.Web.Composing.Current;

namespace Umbraco.Web.UI.Controls
{
    /// <summary>
    /// A base class for all Presentation UserControls to inherit from
    /// </summary>
    public abstract class UmbracoUserControl : UserControl
    {
        private ClientTools _clientTools;
        private UrlHelper _url;

        /// <summary>
        /// Default constructor
        /// </summary>
        /// <param name="umbracoContext"></param>
        /// <param name="services"></param>
        protected UmbracoUserControl(UmbracoContext umbracoContext, ServiceContext services)
        {
            if (umbracoContext == null) throw new ArgumentNullException(nameof(umbracoContext));
            UmbracoContext = umbracoContext;
            Umbraco = new UmbracoHelper(umbracoContext, services);
            Members = Current.Factory.GetInstance<MembershipHelper>();

            // fixme inject somehow
            Logger = Current.Logger;
            ProfilingLogger = Current.ProfilingLogger;
            Services = Current.Services;
        }

        /// <summary>
        /// Empty constructor, uses Singleton to resolve the UmbracoContext
        /// </summary>
        protected UmbracoUserControl()
            : this(Current.UmbracoContext, Current.Services)
        { }

        // for debugging purposes
        internal Guid InstanceId { get; } = Guid.NewGuid();

        /// <summary>
        /// Gets the Umbraco helper.
        /// </summary>
        public UmbracoHelper Umbraco { get; }

        /// <summary>
        /// Gets the membership helper;
        /// </summary>
        public MembershipHelper Members { get; }

        /// <summary>
        /// Gets the web security helper.
        /// </summary>
        public WebSecurity Security => UmbracoContext.Security;

        /// <summary>
        /// Gets the logger.
        /// </summary>
        public ILogger Logger { get; }

        /// <summary>
        /// Gets the ProfilingLogger.
        /// </summary>
        public IProfilingLogger ProfilingLogger { get; }

        /// <summary>
        /// Gets the Umbraco context.
        /// </summary>
        public UmbracoContext UmbracoContext { get; }

        /// <summary>
        /// Gets the services context.
        /// </summary>
        public ServiceContext Services { get; }

        /// <summary>
        /// Gets an instance of ClientTools for access to the pages client API.
        /// </summary>
        public ClientTools ClientTools
        {
            get
            {
                var page = Page as BasePage;
                return _clientTools ?? (_clientTools = page != null ? page.ClientTools : new ClientTools(Page));
            }
        }

        /// <summary>
        /// Gets a Url helper.
        /// </summary>
        /// <remarks>This URL helper is created without any route data and an empty request context.</remarks>
        public UrlHelper Url => _url ?? (_url = new UrlHelper(Context.Request.RequestContext));
    }
}


text:
package com.sfl.pms.services.order.event;

import com.sfl.pms.services.system.event.model.ApplicationEvent;
import com.sfl.pms.services.system.event.model.ApplicationEventListener;

import javax.annotation.Nonnull;

/**
 * User: Ruben Dilanyan
 * Company: SFL LLC
 * Date: 1/30/15
 * Time: 6:09 PM
 */
public abstract class OrderStateChangedEventListenerAdapter implements ApplicationEventListener {

    /* Constructors */
    public OrderStateChangedEventListenerAdapter() {
    }

    @Override
    public boolean subscribed(@Nonnull final ApplicationEvent applicationEvent) {
        return (applicationEvent instanceof OrderStateChangedEvent);
    }

    @Override
    public void process(@Nonnull final ApplicationEvent applicationEvent) {
        processOrderStateChangedEvent((OrderStateChangedEvent) applicationEvent);
    }

    /* Abstract methods */
    protected abstract void processOrderStateChangedEvent(final OrderStateChangedEvent orderPaidEvent);
}


text:
require 'spec_helper'

RSpec.describe Cryptoexchange::Exchanges::Blockonix::Market do
  it { expect(described_class::NAME).to eq 'blockonix' }
  it { expect(described_class::API_URL).to eq 'https://dexserver.blockonix.com' }
end


text:
<!DOCTYPE html>

  <meta charset="UTF-8">
  <title>Login Form</title>
   <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1.0, user-scalable=no"/>

      <link rel="stylesheet" href="assets/mycss/loginStyle.css">

DRM

Login

			<form class="" action="Welcome/authen" method="POST">
                <?php
                    if(isset($_GET["Token"])){
                        if($_GET["Token"]!="null"){
                            ?>
                <input type="text" name="Token" value="<?=$_GET["Token"]?>">
                            <?php
                        }
                    }
                ?>

					<input type="text" class="login-field" value="" placeholder="Username" name="login-username" autofocus="">

					<input type="password" class="login-field" value="" placeholder="password" name="login-pass">

					<button class="btn btn-primary btn-large btn-block" type="submit">login</button>
					Lost your password?

			</form>

    <?php
        if(isset($_SESSION['drm']['flashData'])){
            if(trim($_SESSION['drm']['flashData'])!=""){
                ?>
                <?php
                unset($_SESSION['drm']['flashData']);
            }
        }
     ?>


text:
					<a href="<?php echo base_url(); ?>">Home

Add Image

				<form class="form-search">

						<input type="text" placeholder="Search ..." class="nav-search-input" id="nav-search-input" autocomplete="off" />

				</form>

					<?php if(isset($images)): echo "Update Image"; else: echo "Add Image"; endif; ?>

					<form class="form-horizontal" role="form" enctype="multipart/form-data"
					 method="post" id="<?php if(isset($images)): echo "image_update"; else: echo "image_master"; endif; ?>">

					 <?php if(isset($_SESSION['custFirstName'])): ?>

							Customer Name

    							<input type="hidden" name="cust" value="<?php echo $_SESSION['custId']; ?>">
    							<input type="text" name="custname" value="<?php echo $_SESSION['custFirstName'].' '.$_SESSION['custLastName']; ?>" readonly>

    				<?php else: ?>

						Select Customer

							<?php if(empty($images)) : ?>
								<select class="chosen-select form-control" name="cust" id="form-field-select-3" data-placeholder="Choose a Customer...">
								<option>---select---</option>
									<?php
										foreach ($customer as $val)
										{
											if($val->cust_id == $images[0]->cust_id)
											{
												echo '<option selected value="'.$val->cust_id.'">'.
												$val->cust_first_name." ".$val->cust_last_name.'</option>';
											}else
											{
												echo '<option value="'.$val->cust_id.'">'.
												$val->cust_first_name." ".$val->cust_last_name.'</option>';
											}
										}
									?>
								</select>
								<?php endif; ?>
								<?php if(!empty($images)) : ?>
								<input type="text" name="cust" id="cust" readonly value="<?php
								foreach ($customer as $val)
								{
									if($val->cust_id == $images[0]->cust_id)
									{
										echo $val->cust_first_name." ".$val->cust_last_name;
									}
								} ?>" />
								<?php endif; ?>

						<?php endif; ?>

                            Image Name*

                               <input type="text" id="imagename" name="imagename" placeholder="Enter Image Name" class="col-xs-10 col-sm-12"
                               value="<?php if(isset($images)): echo $images[0]->image_name; else: echo "image"; print_r( $imagename[0]['imgid']+1); endif; ?>" onKeyUp="javascript:return check_isalphanumeric(event,this);" readonly/>

							Select Image Status*

								<select class="chosen-select form-control" name="onlinestatus" id="onlinestatus">
								<option>--select--</option>
									<option value="0" <?php if(isset($images)) : if($images[0]->image_status==0) : echo "selected"; endif; endif; ?>>Offline</option>
									<option value="1" <?php if(isset($images)) : if($images[0]->image_status==1) : echo "selected"; endif; endif; ?>>Online</option>
								</select>

						<input type="hidden" value="<?php if(isset($images)): echo $images[0]->img_id; endif; ?>"
						 name="img_id" id="img_id">

							Enter URL

								<input type="text" id="urlpath" name="urlpath" placeholder="Enter URL Path" class="col-xs-10 col-sm-12 " value="<?php if(isset($images)): echo $images[0]->image_path; endif; ?>"/>

							Upload Image

								<input type="file" name="imagepath" />

								<input type="hidden" value="<?php if(isset($images)): echo $images[0]->image_basepath; endif; ?>" name="image_basepath"/>

							Image Description*

							<textarea  id="imagedesc" name="imagedesc" rows="6" cols="40" class="ckeditor">
								<?php if(isset($images)): echo $images[0]->img_desc; endif; ?></textarea>

								<button class="btn btn-info test" type="submit">

									<?php if(isset($images) && $images == true){
										echo "Update";
									}else{
										echo "Submit";
									} ?>
								</button>

								<button class="btn" type="reset">

									Reset
								</button>

					</form>


text:
template: layout.jade
title: Connecting
menusection: indices
menuitem: analyze
---

#Analyze

Performs the analysis process on the specified text and returns the token breakdown for the text.

## Analyze using default index's default analyzer

	var text = "this is a string with some spaces and stuff";
	var r = this.ConnectedClient.Analyze(text);

## Analyze using a fields analyzer

    var text = "this is a string with some spaces and stuff";
    var r = this.ConnectedClient.Analyze<ElasticSearchProject>(p => p.Content, text);

## Analyze using parameters

	var analyzer = new AnalyzeParams { Analyzer = "whitespace", Index = Test.Default.DefaultIndex + "_clone" };
	var r = this.ConnectedClient.Analyze(analyzer, text);


text:
mod us_presidential_frontrunners {
    use self::democrats::HILLARY_CLINTON as democrat;
    use self::republicans::DONALD_TRUMP as republican;

    mod democrats {
        pub const HILLARY_CLINTON: &'static str = "Hillary Clinton";
        pub const BERNIE_SANDERS: &'static str = "Bernie Sanders";
    }

    mod republicans {
        pub const DONALD_TRUMP: &'static str = "Donald Trump";
        pub const JEB_BUSH: &'static str = "Jeb Bush";
    }
}

fn main() {
    println!("candidates: {} and {}",
             us_presidential_frontrunners::democrat,
             us_presidential_frontrunners::republican);
}

// The us_presidential_frontrunners module is trying to present an external
// interface (the `democrat` and `republican` constants) that is different than
// its internal structure (the `democrats` and `republicans` modules and
// associated constants). It's almost there except for one keyword missing for
// each constant.
// One more hint: I wish the compiler error, instead of saying "unresolved name
// `us_presidential_frontrunners::democrat`", could say  "constant
// `us_presidential_frontrunners::democrat` is private"!


text:
package com.eztexting.api.client;

/**
 * Thrown by client in case of invalid instantiation
 *
 * @since 1.0
 */
public class EzTextingClientException extends RuntimeException {
    public EzTextingClientException() {
    }

    public EzTextingClientException(String message) {
        super(message);
    }

    public EzTextingClientException(String message, Throwable cause) {
        super(message, cause);
    }

    public EzTextingClientException(Throwable cause) {
        super(cause);
    }
}


text:
package com.plugin.commons.ui.my;

import java.util.List;

import android.content.Intent;
import android.os.Bundle;
import android.text.format.DateUtils;
import android.view.View;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.ListView;
import android.widget.Toast;

import com.handmark.pulltorefresh.library.PullToRefreshBase;
import com.handmark.pulltorefresh.library.PullToRefreshBase.OnLastItemVisibleListener;
import com.handmark.pulltorefresh.library.PullToRefreshBase.OnRefreshListener;
import com.handmark.pulltorefresh.library.PullToRefreshListView;
import com.plugin.R;
import com.plugin.commons.AppException;
import com.plugin.commons.ComApp;
import com.plugin.commons.CoreContants;
import com.plugin.commons.adapter.MyCollectListAdapter;
import com.plugin.commons.adapter.ZhKdBaseAdapter;
import com.plugin.commons.helper.ComUtil;
import com.plugin.commons.helper.DialogUtil;
import com.plugin.commons.helper.DingLog;
import com.plugin.commons.helper.SituoHttpAjax;
import com.plugin.commons.helper.SituoHttpAjax.SituoAjaxCallBack;
import com.plugin.commons.model.CacheModel;
import com.plugin.commons.model.ContentBean;
import com.plugin.commons.model.MyCollectInfoModel;
import com.plugin.commons.model.NewsInfoModel;
import com.plugin.commons.model.NewsTypeModel;
import com.plugin.commons.model.RspResultModel;
import com.plugin.commons.ui.askgov.AskDetailActivity;
import com.plugin.commons.ui.fragment.base.BaseFragment;
import com.zq.types.StBaseType;

/**
 * @author zhang
 * 右边我的-我的收藏
 */
public class MyCollectFragment extends BaseFragment {
	public DingLog log = new DingLog(MyCollectFragment.class);
	private static final String TAG = "MyCollectFragment";
	private MyCollectInfoModel dataList=new MyCollectInfoModel();
	List<ContentBean> colslist;
	private ZhKdBaseAdapter<ContentBean> mAdapter;

	protected void initViews(View view) {
		lv_news = (PullToRefreshListView) view.findViewById(R.id.lv_news);
		mAdapter = new MyCollectListAdapter(mActivity,dataList.getColslist());
		lv_news.setAdapter(mAdapter);
		lv_news.setOnRefreshListener(new OnRefreshListener<ListView>() {
			@Override
			public void onRefresh(PullToRefreshBase<ListView> refreshView) {
				String label = DateUtils.formatDateTime(mActivity, System.currentTimeMillis(),
						DateUtils.FORMAT_SHOW_TIME | DateUtils.FORMAT_SHOW_DATE | DateUtils.FORMAT_ABBREV_ALL);

				// Update the LastUpdatedLabel
				refreshView.getLoadingLayoutProxy().setLastUpdatedLabel(label);
				doRefresh(false);
			}
		});

		lv_news.setOnLastItemVisibleListener(new OnLastItemVisibleListener() {

			@Override
			public void onLastItemVisible() {
				Toast.makeText(mActivity, "已无更多加载", Toast.LENGTH_SHORT).show();
			}
		});
		lv_news.setOnItemClickListener(new OnItemClickListener(){

			@Override
			public void onItemClick(AdapterView<?> arg0, View arg1, int arg2,
					long arg3) {
				// TODO Auto-generated method stub
				if(colslist.get(arg2-1).getType()==CacheModel.CACHE_ASKBAOLIAO){
				}
				if(colslist.get(arg2-1).getType()==CacheModel.CACHE_ASKGOV){
					Intent intent = new Intent(mActivity,AskDetailActivity.class);
					intent.putExtra(CoreContants.PARAMS_MSG,dataList.getAskMsgById(dataList.getColslist().get(arg2-1).getId()));
					mActivity.startActivity(intent);
				}
				if(colslist.get(arg2-1).getType()==CacheModel.CACHE_ASKNEWS){
					NewsInfoModel item = dataList.getNewsById(dataList.getColslist().get(arg2-1).getId());
					NewsTypeModel type = new NewsTypeModel();
					type.setId(item.getArttype());
					type.setType(item.getNewtype());
					type.setHassub("0");
					ComUtil.goNewsDetail(mActivity, item, type);
				}
				if(colslist.get(arg2-1).getType()==CacheModel.CACHE_VIDEO){
					NewsInfoModel item = dataList.getNewsById(dataList.getColslist().get(arg2-1).getId());
					NewsTypeModel type = new NewsTypeModel();
					type.setId(item.getArttype());
					type.setType(CoreContants.NEWS_SUBTYPE_VIDEO);
					type.setHassub("0");
					ComUtil.goNewsDetail(mActivity, item, type);
				}
				if(colslist.get(arg2-1).getType()==CacheModel.CACHE_IMG_NEWS){
					NewsInfoModel item = dataList.getNewsById(dataList.getColslist().get(arg2-1).getId());
					NewsTypeModel type = new NewsTypeModel();
					type.setId(item.getArttype());
					type.setType(CoreContants.NEWS_SUBTYPE_PIC);
					type.setHassub("0");
					ComUtil.goNewsDetail(mActivity, item, type);
				}
				if(colslist.get(arg2-1).getType()==CacheModel.CACHE_ASKNEWS_EXT){//个性化图文
					NewsInfoModel item = dataList.getNewsById(dataList.getColslist().get(arg2-1).getId());
					NewsTypeModel type = new NewsTypeModel();
					type.setId(item.getArttype());
					type.setType(CoreContants.NEWS_SUBTYPE_WORD_EXT);
					type.setHassub("0");
					ComUtil.goNewsDetail(mActivity, item, type);
				}

			}

		});

	}

	protected void initDisplay() {
		doRefresh(true);
	}

	private void doRefresh(final boolean isInit)
	{
		ComUtil.showListNone(getView(), "努力加载中...", colslist);
		if(isInit){
//			DialogUtil.showProgressDialog(mActivity);
		}
		// Do work to refresh the list here.
		SituoHttpAjax.ajax(new SituoAjaxCallBack(){
			@Override
			public StBaseType requestApi() {
				RspResultModel rsp = null;
				try {
					rsp = ComApp.getInstance().getBlService().colectAll();
				} catch (AppException e) {
					// TODO Auto-generated catch block
					e.printStackTrace();
				}

				return rsp;
			}

			@Override
			public void callBack(StBaseType baseType) {
				if(isInit){
					DialogUtil.closeProgress(mActivity);
				}
				RspResultModel result = (RspResultModel)baseType;
				if(ComUtil.checkRsp(mActivity, result)){
					dataList=result.getColts();
					colslist = result.getColts().getColslist();
					log.info("newList:"+colslist.size());
					mAdapter.setDataList(colslist);
					lv_news.setAdapter(mAdapter);
					log.info("newList:"+colslist.size());
					mAdapter.notifyDataSetChanged();
				}
				if(!isInit){
					lv_news.onRefreshComplete();
				}
				ComUtil.showListNone(getView(), "暂无数据", colslist);
			}

		});

	}

	@Override
	public String getFragmentName() {
		return TAG;
	}
	public void onFrageSelect(int idnex){

	}

}


text:
#ifndef TIF_FLOAT_H_INCLUDED
#define TIF_FLOAT_H_INCLUDED

#include "cpl_port.h"

CPL_C_START
GUInt32 HalfToFloat( GUInt16 iHalf );
GUInt32 TripleToFloat( GUInt32 iTriple );
CPL_C_END

#endif // TIF_FLOAT_H_INCLUDED


text:
package com.ibm.mobilefirstplatform.appid;

import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.test.web.client.TestRestTemplate;
import org.springframework.http.*;
import org.springframework.test.context.junit4.SpringRunner;

import static org.junit.Assert.assertEquals;

@RunWith(SpringRunner.class)
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
public class ServerSdkApplicationTests {
    private static final String CORRECT_AUTH_TOKEN = "Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJodHRwczovL2p3dC1pZHAuZXhhbXBsZS5jb20iLCJzdWIiOiJtYWlsdG86bWlrZUBleGFtcGxlLmNvbSIsIm5iZiI6MTQ5MjU5ODY1NCwiZXhwIjoxNDkyNjAyMjU0LCJpYXQiOjE0OTI1OTg2NTQsImp0aSI6ImlkMTIzNDU2IiwidHlwIjoiaHR0cHM6Ly9leGFtcGxlLmNvbS9yZWdpc3RlciJ9.D9eq_ntTdO5AWvJzKIgZ734iGLoa10LtFPX2HWXNZ37Jrb2xK7H2NwNqOHiIsCm_MZboewQB9ki-gKZ_kPIpx7eSV9qMyG8FdS4gDmF_g4WhCFx_Jgg_5TPfl6s0ELr_uPdtShns63lUDKdII2hBdvkmZfOeF8j2mQLsRU3ACVErtg1KNAT7XElrMSht_XSp0VXkVKmIzl1Eha3xW3TBKGKSqPlySlSSSQb9gBx4mHMALcL1bMNcH47lAF7rA5EkRuxVJdOshZU4_5nTHoSnXgcelBS85izA3GoQTrqLkLUv4ngiJ_8lQ4ByVIXJsJ5lYNSHEWM4hBqrGz0DDHw3uw";
    private static final String INVALID_AUTH_TOKEN = "Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJodHRwczovL2p3dC1pZHAuZXhhbXBsZS5jb20iLCJzdWIiOiJtYWlsdG86bWlrZUBleGFtcGxlLmNvbSIsIm5iZiI6MTQ5MjYwMTg4OCwiZXhwIjoxNDkyNjA1NDg4LCJpYXQiOjE0OTI2MDE4ODgsImp0aSI6ImlkMTIzNDU2IiwidHlwIjoiaHR0cHM6Ly9leGFtcGxlLmNvbS9yZWdpc3RlciJ9.YNXLuwOmzibvPM4AixYX9Wbqe8hYCdNy0n0-kHy7syzlLdU7HsaozptBgNeBL389bqXtPFiKNraxbHDfD1UaopBqHkxG4Cc8kU6p4buyAKksLsaVYAYO1s8l18x21CwXObPMumm4NGbLK7dDBOc-z_KBicsURZbZl9SbSf_r50LzfmEL7BDn2OyJmGZXhPfSslPUiu27AAXoEFq7zG3TVjz9h6FugZ-0sCRRr77VfMONCftvVsFHITrXx1lqiDogs2CRPHG2gkGmqVrknrJUKfmvmx3Yiu8cL46nQjFuD0d0Ke7uB7XMg9TqrWXrzhgCWa9zkcmgTcVb1CbrMRhXtg";

    @Autowired
    private TestRestTemplate restTemplate;

    @Test
    public void shouldDenyAccessWithoutToken() throws Exception {
        ResponseEntity<String> res = restTemplate.getForEntity("/something", String.class);
        assertEquals(HttpStatus.FORBIDDEN, res.getStatusCode());
    }

    @Test
    public void shouldDenyAccessWithInvalidToken() throws Exception {
        ResponseEntity<String> res = requestForSomething(INVALID_AUTH_TOKEN);
        assertEquals(HttpStatus.FORBIDDEN, res.getStatusCode());
    }

    @Test
    public void shouldPermitAccessWithValidToken() throws Exception {
        ResponseEntity<String> res = requestForSomething(CORRECT_AUTH_TOKEN);
        assertEquals(HttpStatus.OK, res.getStatusCode());
        assertEquals("works", res.getBody());
    }

    private ResponseEntity<String> requestForSomething(String authToken) {
        HttpHeaders headers = new HttpHeaders();
        headers.add(HttpHeaders.AUTHORIZATION, authToken);
        HttpEntity req = new HttpEntity(headers);
        return restTemplate.exchange("/something", HttpMethod.GET, req, String.class);
    }
}


text:
package org.wikiup.core.impl.iterable;

import org.wikiup.core.impl.Null;

import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;

public class IterableCollection<E> implements Iterable<E> {
    private List<Iterable<E>> iterables = new LinkedList<Iterable<E>>();

    public IterableCollection(List<Iterable<E>> iterables) {
        this.iterables = iterables;
    }

    public IterableCollection(Iterable<E>... args) {
        append(args);
    }

    public IterableCollection<E> append(Iterable<E>... args) {
        for(Iterable<E> iterable : args)
            iterables.add(iterable);
        return this;
    }

    public Iterator<E> iterator() {
        return new CompositeIterator<E>(iterables);
    }

    private static class CompositeIterator<E> implements Iterator<E> {
        private List<Iterable<E>> iterables = new LinkedList<Iterable<E>>();
        private int cursor = 0;
        private Iterator<E> iterator = Null.getInstance();

        public CompositeIterator(List<Iterable<E>> iterables) {
            for(Iterable<E> iterable : iterables)
                this.iterables.add(iterable);
        }

        public boolean hasNext() {
            seekCurrentIterator();
            return iterator.hasNext();
        }

        public E next() {
            seekCurrentIterator();
            return iterator.next();
        }

        private void seekCurrentIterator() {
            while(!iterator.hasNext() && cursor < iterables.size())
                iterator = iterables.get(cursor++).iterator();
        }

        public void remove() {
            iterator.remove();
        }
    }
}


text:
NS_ASSUME_NONNULL_BEGIN

@interface LCTopView : UIView

@end

NS_ASSUME_NONNULL_END


text:
SELECT u.Username, u.Age
FROM Users AS u
ORDER BY u.Age,
		 u.Username DESC

-- 06. Unassigned Reports
SELECT r.[Description], r.OpenDate
FROM Reports AS r
WHERE r.EmployeeId IS NULL
ORDER BY r.OpenDate,
		 r.[Description]

-- 07. Employees & Reports
SELECT e.Firstname,
       e.Lastname,
       r.[Description],
       FORMAT(r.Opendate, 'yyyy-MM-dd') AS OpenDate
FROM Employees AS e
	JOIN Reports AS r ON r.EmployeeId = e.Id
ORDER BY e.Id,
		 r.OpenDate

-- 08. Most Reported Category
SELECT c.[Name] AS CategoryName,
	  COUNT(*) AS ReportsNumber
FROM Categories AS c
	JOIN Reports AS r ON r.CategoryId = c.Id
GROUP BY c.[Name]
ORDER BY ReportsNumber DESC,
		 CategoryName

-- 09. Employees in Category
SELECT c.[Name],
	  COUNT(c.Id) AS NumberEmployees
FROM Categories  AS c
	 JOIN Departments AS d ON d.Id = c.DepartmentId
	 JOIN Employees AS E ON e.DepartmentId = d.Id
GROUP BY c.[Name]

-- 10. Users per Employee
SELECT CONCAT(e.FirstName, ' ' ,e.LastName) AS FullName,
	  COUNT(DISTINCT r.UserId) AS UsersCount
FROM Employees AS e
	LEFT JOIN Reports AS r ON r.EmployeeId = e.Id
GROUP BY CONCAT(e.FirstName, ' ', e.LastName)
ORDER BY UsersCount DESC,
		 FullName

-- 11. Emergency Patrol
SELECT r.OpenDate,
	  r.[Description],
       u.Email AS [Reporter Email]
FROM Reports AS r
	JOIN Users AS u ON u.Id = r.UserId
	JOIN Categories c ON c.Id = r.CategoryId
	JOIN Departments d ON d.Id = c.DepartmentId
WHERE r.CloseDate IS NULL AND
	 r.[Description] LIKE '%str%' AND
	 d.Id IN (1, 4, 5)
ORDER BY r.OpenDate,
	    [Reporter Email]

-- 13. Numbers Coincidence
SELECT DISTINCT u.Username
FROM Users AS u
	 JOIN Reports AS r ON r.UserId = u.Id
	 JOIN Categories AS c ON c.Id = r.CategoryId
WHERE (Username LIKE '[0-9]_%' AND CAST(c.Id AS VARCHAR) = LEFT(u.Username, 1)) OR
      (Username LIKE '%_[0-9]' AND CAST(c.Id AS VARCHAR) = RIGHT(u.Username, 1))

-- 14. Open/Closed Statistics
SELECT CONCAT(e.FirstName, ' ', e.LastName) AS FullName,
	  ISNULL(CONVERT(VARCHAR, cc.ReportSum), '0') + '/' +
       ISNULL(CONVERT(VARCHAR, oc.ReportSum), '0') AS [Stats]
FROM Employees AS e
JOIN (SELECT EmployeeId, COUNT(1) AS ReportSum
	  FROM Reports r
	  WHERE  YEAR(OpenDate) = 2016
	  GROUP BY EmployeeId) AS oc ON oc.EmployeeId = e.Id
LEFT JOIN (SELECT EmployeeId, COUNT(1) AS ReportSum
	       FROM Reports AS r
	       WHERE YEAR(CloseDate) = 2016
	       GROUP BY EmployeeId) AS cc ON cc.Employeeid = e.Id
ORDER BY FullName

-- 15. Average Closing Time
SELECT d.[Name] AS Departmentname,
       ISNULL(CONVERT(VARCHAR, AVG(DATEDIFF(DAY, R.Opendate, R.Closedate))), 'no info') AS AverageTime
FROM Departments AS d
     JOIN Categories AS c ON c.DepartmentId = d.Id
     LEFT JOIN Reports AS r ON r.CategoryId = c.Id
GROUP BY d.[Name]
ORDER BY d.[Name]

-- 16. Favorite Categories
SELECT Department, Category, [Percentage]
FROM
(
	SELECT d.[Name] AS Department,
		    c.[Name] AS Category,
		    CAST(
			     ROUND(
				       COUNT(1) OVER(PARTITION BY c.Id) * 100.00 / COUNT(1) OVER(PARTITION BY d.Id), 0
					  ) AS INT
				) AS [Percentage]
     FROM Categories AS c
		  JOIN Reports AS r ON r.Categoryid = c.Id
		  JOIN Departments AS d ON d.Id = c.Departmentid
) AS [Stats]
GROUP BY Department,
         Category,
         [Percentage]
ORDER BY Department,
         Category,
         [Percentage]


text:
layout: post
title:  "Quotes: Glamourous Bulls"
date:   2015-07-13 09:41:32
categories: quote
author: Shane Leonard
image: /images/quote-neffs-success.jpg
---

Quote from [John Neff](https://en.wikipedia.org/wiki/John_Neff).

> Investment success does not require glamour stocks or bull markets.

We need to think long-term and avoid bubbles!

Do you have a favourite quote from a famous investor or stock market pundit? We'd love to hear it.

Please drop me a message [@shaneleonard121](https://twitter.com/shaneleonard121) or the full team [@stockflare](https://twitter.com/stockflare).

Shane Leonard

Managing Director

Stockflare


text:
use libnewsboat::logger;

#[cxx::bridge(namespace = "newsboat::logger")]
mod ffi {
    // This has to be in sync with logger::Level in rust/libnewsboat/src/logger.rs
    enum Level {
        USERERROR = 1,
        CRITICAL,
        ERROR,
        WARN,
        INFO,
        DEBUG,
    }

    extern "Rust" {
        fn unset_loglevel();
        fn set_logfile(logfile: &str);
        fn get_loglevel() -> i64;
        fn set_loglevel(level: Level);
        fn log_internal(level: Level, message: &str);
        fn set_user_error_logfile(user_error_logfile: &str);
    }
}

fn ffi_level_to_log_level(level: ffi::Level) -> logger::Level {
    match level {
        ffi::Level::USERERROR => logger::Level::UserError,
        ffi::Level::CRITICAL => logger::Level::Critical,
        ffi::Level::ERROR => logger::Level::Error,
        ffi::Level::WARN => logger::Level::Warn,
        ffi::Level::INFO => logger::Level::Info,
        ffi::Level::DEBUG => logger::Level::Debug,
        _ => panic!("Unknown log level"),
    }
}

fn unset_loglevel() {
    logger::get_instance().unset_loglevel();
}

fn set_logfile(logfile: &str) {
    logger::get_instance().set_logfile(logfile);
}

fn get_loglevel() -> i64 {
    logger::get_instance().get_loglevel() as i64
}

fn set_loglevel(level: ffi::Level) {
    let level = ffi_level_to_log_level(level);
    logger::get_instance().set_loglevel(level);
}

fn log_internal(level: ffi::Level, message: &str) {
    let level = ffi_level_to_log_level(level);
    logger::get_instance().log(level, message);
}

fn set_user_error_logfile(user_error_logfile: &str) {
    logger::get_instance().set_user_error_logfile(user_error_logfile);
}


text:
{% extends "base.html" %}
{% block sideBarContent %}

<form action="/instanzanlegen_nimbus" method="post" accept-charset="utf-8">
<input type="hidden" name="mobile" value="{{ mobile|safe }}">
<input type="hidden" name="image_id" value="{{ image|safe }}">
<input type="hidden" name="image_manifest" value="{{ manifest|safe }}">

ID:	{{ image|safe }}

Manifest:	{{ manifest|safe }}

<input type="submit" value="create instance">

</form>

{% endblock %}


text:
namespace ash {

class ASH_EXPORT DefaultSystemTrayDelegate : public SystemTrayDelegate {
 public:
  DefaultSystemTrayDelegate();
  virtual ~DefaultSystemTrayDelegate();

  // Overridden from SystemTrayDelegate:
  virtual void Initialize() OVERRIDE;
  virtual void Shutdown() OVERRIDE;
  virtual bool GetTrayVisibilityOnStartup() OVERRIDE;
  virtual user::LoginStatus GetUserLoginStatus() const OVERRIDE;
  virtual bool IsOobeCompleted() const OVERRIDE;
  virtual void ChangeProfilePicture() OVERRIDE;
  virtual const std::string GetEnterpriseDomain() const OVERRIDE;
  virtual const base::string16 GetEnterpriseMessage() const OVERRIDE;
  virtual const std::string GetLocallyManagedUserManager() const OVERRIDE;
  virtual const base::string16 GetLocallyManagedUserManagerName() const
      OVERRIDE;
  virtual const base::string16 GetLocallyManagedUserMessage() const OVERRIDE;
  virtual bool SystemShouldUpgrade() const OVERRIDE;
  virtual base::HourClockType GetHourClockType() const OVERRIDE;
  virtual void ShowSettings() OVERRIDE;
  virtual bool ShouldShowSettings() OVERRIDE;
  virtual void ShowDateSettings() OVERRIDE;
  virtual void ShowNetworkSettings(const std::string& service_path) OVERRIDE;
  virtual void ShowBluetoothSettings() OVERRIDE;
  virtual void ShowDisplaySettings() OVERRIDE;
  virtual void ShowChromeSlow() OVERRIDE;
  virtual bool ShouldShowDisplayNotification() OVERRIDE;
  virtual void ShowDriveSettings() OVERRIDE;
  virtual void ShowIMESettings() OVERRIDE;
  virtual void ShowHelp() OVERRIDE;
  virtual void ShowAccessibilityHelp() OVERRIDE;
  virtual void ShowAccessibilitySettings() OVERRIDE;
  virtual void ShowPublicAccountInfo() OVERRIDE;
  virtual void ShowEnterpriseInfo() OVERRIDE;
  virtual void ShowLocallyManagedUserInfo() OVERRIDE;
  virtual void ShowUserLogin() OVERRIDE;
  virtual bool ShowSpringChargerReplacementDialog() OVERRIDE;
  virtual bool IsSpringChargerReplacementDialogVisible() OVERRIDE;
  virtual bool HasUserConfirmedSafeSpringCharger() OVERRIDE;
  virtual void ShutDown() OVERRIDE;
  virtual void SignOut() OVERRIDE;
  virtual void RequestLockScreen() OVERRIDE;
  virtual void RequestRestartForUpdate() OVERRIDE;
  virtual void GetAvailableBluetoothDevices(BluetoothDeviceList* list) OVERRIDE;
  virtual void BluetoothStartDiscovering() OVERRIDE;
  virtual void BluetoothStopDiscovering() OVERRIDE;
  virtual void ConnectToBluetoothDevice(const std::string& address) OVERRIDE;
  virtual void GetCurrentIME(IMEInfo* info) OVERRIDE;
  virtual void GetAvailableIMEList(IMEInfoList* list) OVERRIDE;
  virtual void GetCurrentIMEProperties(IMEPropertyInfoList* list) OVERRIDE;
  virtual void SwitchIME(const std::string& ime_id) OVERRIDE;
  virtual void ActivateIMEProperty(const std::string& key) OVERRIDE;
  virtual void CancelDriveOperation(int32 operation_id) OVERRIDE;
  virtual void GetDriveOperationStatusList(
      ash::DriveOperationStatusList*) OVERRIDE;
  virtual void ShowNetworkConfigure(const std::string& network_id,
                                    gfx::NativeWindow parent_window) OVERRIDE;
  virtual bool EnrollNetwork(const std::string& network_id,
                             gfx::NativeWindow parent_window) OVERRIDE;
  virtual void ManageBluetoothDevices() OVERRIDE;
  virtual void ToggleBluetooth() OVERRIDE;
  virtual bool IsBluetoothDiscovering() OVERRIDE;
  virtual void ShowMobileSimDialog() OVERRIDE;
  virtual void ShowMobileSetupDialog(const std::string& service_path) OVERRIDE;
  virtual void ShowOtherNetworkDialog(const std::string& type) OVERRIDE;
  virtual bool GetBluetoothAvailable() OVERRIDE;
  virtual bool GetBluetoothEnabled() OVERRIDE;
  virtual void ChangeProxySettings() OVERRIDE;
  virtual VolumeControlDelegate* GetVolumeControlDelegate() const OVERRIDE;
  virtual void SetVolumeControlDelegate(
      scoped_ptr<VolumeControlDelegate> delegate) OVERRIDE;
  virtual bool GetSessionStartTime(
      base::TimeTicks* session_start_time) OVERRIDE;
  virtual bool GetSessionLengthLimit(
      base::TimeDelta* session_length_limit) OVERRIDE;
  virtual int GetSystemTrayMenuWidth() OVERRIDE;
  virtual void ActiveUserWasChanged() OVERRIDE;

 private:
  bool bluetooth_enabled_;
  scoped_ptr<VolumeControlDelegate> volume_control_delegate_;

  DISALLOW_COPY_AND_ASSIGN(DefaultSystemTrayDelegate);
};

}  // namespace ash

#endif  // ASH_SYSTEM_TRAY_DEFAULT_SYSTEM_TRAY_DELEGATE_H_


text:
LiveUpdate
==========

.. autoclass:: praw.models.LiveUpdate
   :inherited-members:


text:
package java.lang;

public class Short extends Number {
    private final short value;
    public static final Class<Short>  TYPE = (Class<Short>) Class.getPrimitiveClass("short");

    public static Short valueOf(short value) {
        return new Short(value);
    }

    public Short(short value) {
        this.value = value;
    }

    public String toString() {
        return Number.toString(value);
    }

    public short shortValue() {
        return value;
    }

    @Override
    public boolean equals(Object obj) {
        if(obj instanceof Short) {
            return value == ((Short)obj).shortValue();
        }
        return false;
    }

    @Override
    public int hashCode() {
        return (int) value;
    }
}


text:
/*============================================================================
                            O p e n M A X   w r a p p e r s
                             O p e n  M A X   C o r e

 This module contains the implementation of the OpenMAX core Macros which
 operate directly on the component.

*//*========================================================================*/

//////////////////////////////////////////////////////////////////////////////
//                             Include Files
//////////////////////////////////////////////////////////////////////////////
#include "qc_omx_common.h"
#include "omx_core_cmp.h"
#include "qc_omx_component.h"
#include <string.h>

void * qc_omx_create_component_wrapper(OMX_PTR obj_ptr)
{
    qc_omx_component *pThis        = (qc_omx_component *)obj_ptr;
    OMX_COMPONENTTYPE* component   = &(pThis->m_cmp);
    memset(&pThis->m_cmp,0,sizeof(OMX_COMPONENTTYPE));

    component->nSize               = sizeof(OMX_COMPONENTTYPE);
    component->nVersion.nVersion   = OMX_SPEC_VERSION;
    component->pApplicationPrivate = 0;
    component->pComponentPrivate   = obj_ptr;

    component->AllocateBuffer      = &qc_omx_component_allocate_buffer;
    component->FreeBuffer          = &qc_omx_component_free_buffer;
    component->GetParameter        = &qc_omx_component_get_parameter;
    component->SetParameter        = &qc_omx_component_set_parameter;
    component->SendCommand         = &qc_omx_component_send_command;
    component->FillThisBuffer      = &qc_omx_component_fill_this_buffer;
    component->EmptyThisBuffer     = &qc_omx_component_empty_this_buffer;
    component->GetState            = &qc_omx_component_get_state;
    component->GetComponentVersion = &qc_omx_component_get_version;
    component->GetConfig           = &qc_omx_component_get_config;
    component->SetConfig           = &qc_omx_component_set_config;
    component->GetExtensionIndex   = &qc_omx_component_get_extension_index;
    component->ComponentTunnelRequest = &qc_omx_component_tunnel_request;
    component->UseBuffer           = &qc_omx_component_use_buffer;
    component->SetCallbacks        = &qc_omx_component_set_callbacks;
    component->UseEGLImage         = &qc_omx_component_use_EGL_image;
    component->ComponentRoleEnum   = &qc_omx_component_role_enum;
    component->ComponentDeInit     = &qc_omx_component_deinit;
    return (void *)component;
}

/************************************************************************/
/*               COMPONENT INTERFACE                                    */
/************************************************************************/

OMX_ERRORTYPE
qc_omx_component_init(OMX_IN OMX_HANDLETYPE hComp, OMX_IN OMX_STRING componentName)
{
  OMX_ERRORTYPE eRet = OMX_ErrorBadParameter;
  qc_omx_component *pThis = (hComp)? (qc_omx_component *)(((OMX_COMPONENTTYPE *)hComp)->pComponentPrivate):NULL;
  DEBUG_PRINT("OMXCORE: qc_omx_component_init %x\n",(unsigned)hComp);

  if(pThis)
  {
    // call the init fuction
    eRet = pThis->component_init(componentName);

    if(eRet != OMX_ErrorNone)
    {
      //  in case of error, please destruct the component created
       delete pThis;
    }
  }
  return eRet;
}

OMX_ERRORTYPE
qc_omx_component_get_version(OMX_IN OMX_HANDLETYPE               hComp,
                    OMX_OUT OMX_STRING          componentName,
                    OMX_OUT OMX_VERSIONTYPE* componentVersion,
                    OMX_OUT OMX_VERSIONTYPE*      specVersion,
                    OMX_OUT OMX_UUIDTYPE*       componentUUID)
{
  OMX_ERRORTYPE eRet = OMX_ErrorBadParameter;
  qc_omx_component *pThis = (hComp)? (qc_omx_component *)(((OMX_COMPONENTTYPE *)hComp)->pComponentPrivate):NULL;
  DEBUG_PRINT("OMXCORE: qc_omx_component_get_version %x, %s , %x\n",(unsigned)hComp,componentName,(unsigned)componentVersion);
  if(pThis)
  {
    eRet = pThis->get_component_version(hComp,componentName,componentVersion,specVersion,componentUUID);
  }
  return eRet;
}

OMX_ERRORTYPE
qc_omx_component_send_command(OMX_IN OMX_HANDLETYPE hComp,
            OMX_IN OMX_COMMANDTYPE  cmd,
            OMX_IN OMX_U32       param1,
            OMX_IN OMX_PTR      cmdData)
{
  OMX_ERRORTYPE eRet = OMX_ErrorBadParameter;
  qc_omx_component *pThis = (hComp)? (qc_omx_component *)(((OMX_COMPONENTTYPE *)hComp)->pComponentPrivate):NULL;
  DEBUG_PRINT("OMXCORE: qc_omx_component_send_command %x, %d , %d\n",(unsigned)hComp,(unsigned)cmd,(unsigned)param1);

  if(pThis)
  {
    eRet = pThis->send_command(hComp,cmd,param1,cmdData);
  }
  return eRet;
}

OMX_ERRORTYPE
qc_omx_component_get_parameter(OMX_IN OMX_HANDLETYPE     hComp,
             OMX_IN OMX_INDEXTYPE paramIndex,
             OMX_INOUT OMX_PTR     paramData)
{
  OMX_ERRORTYPE eRet = OMX_ErrorBadParameter;
  qc_omx_component *pThis = (hComp)? (qc_omx_component *)(((OMX_COMPONENTTYPE *)hComp)->pComponentPrivate):NULL;
  DEBUG_PRINT("OMXCORE: qc_omx_component_get_parameter %x, %x , %d\n",(unsigned)hComp,(unsigned)paramData,paramIndex);

  if(pThis)
  {
    eRet = pThis->get_parameter(hComp,paramIndex,paramData);
  }
  return eRet;
}

OMX_ERRORTYPE
qc_omx_component_set_parameter(OMX_IN OMX_HANDLETYPE     hComp,
             OMX_IN OMX_INDEXTYPE paramIndex,
             OMX_IN OMX_PTR        paramData)
{
  OMX_ERRORTYPE eRet = OMX_ErrorBadParameter;
  qc_omx_component *pThis = (hComp)? (qc_omx_component *)(((OMX_COMPONENTTYPE *)hComp)->pComponentPrivate):NULL;
  DEBUG_PRINT("OMXCORE: qc_omx_component_set_parameter %x, %x , %d\n",(unsigned)hComp,(unsigned)paramData,paramIndex);

  if(pThis)
  {
    eRet = pThis->set_parameter(hComp,paramIndex,paramData);
  }
  return eRet;
}

 OMX_ERRORTYPE
qc_omx_component_get_config(OMX_IN OMX_HANDLETYPE      hComp,
          OMX_IN OMX_INDEXTYPE configIndex,
          OMX_INOUT OMX_PTR     configData)
{
  OMX_ERRORTYPE eRet = OMX_ErrorBadParameter;
  qc_omx_component *pThis = (hComp)? (qc_omx_component *)(((OMX_COMPONENTTYPE *)hComp)->pComponentPrivate):NULL;
  DEBUG_PRINT("OMXCORE: qc_omx_component_get_config %x\n",(unsigned)hComp);

  if(pThis)
  {
     eRet = pThis->get_config(hComp,
                              configIndex,
                              configData);
  }
  return eRet;
}

 OMX_ERRORTYPE
qc_omx_component_set_config(OMX_IN OMX_HANDLETYPE      hComp,
          OMX_IN OMX_INDEXTYPE configIndex,
          OMX_IN OMX_PTR        configData)
{
  OMX_ERRORTYPE eRet = OMX_ErrorBadParameter;
  qc_omx_component *pThis = (hComp)? (qc_omx_component *)(((OMX_COMPONENTTYPE *)hComp)->pComponentPrivate):NULL;
  DEBUG_PRINT("OMXCORE: qc_omx_component_set_config %x\n",(unsigned)hComp);

  if(pThis)
  {
     eRet = pThis->set_config(hComp,
                              configIndex,
                              configData);
  }
  return eRet;
}

 OMX_ERRORTYPE
qc_omx_component_get_extension_index(OMX_IN OMX_HANDLETYPE      hComp,
                  OMX_IN OMX_STRING      paramName,
                  OMX_OUT OMX_INDEXTYPE* indexType)
{
  OMX_ERRORTYPE eRet = OMX_ErrorBadParameter;
  qc_omx_component *pThis = (hComp)? (qc_omx_component *)(((OMX_COMPONENTTYPE *)hComp)->pComponentPrivate):NULL;
  if(pThis)
  {
    eRet = pThis->get_extension_index(hComp,paramName,indexType);
  }
  return eRet;
}

 OMX_ERRORTYPE
qc_omx_component_get_state(OMX_IN OMX_HANDLETYPE  hComp,
         OMX_OUT OMX_STATETYPE* state)
{
  OMX_ERRORTYPE eRet = OMX_ErrorBadParameter;
  qc_omx_component *pThis = (hComp)? (qc_omx_component *)(((OMX_COMPONENTTYPE *)hComp)->pComponentPrivate):NULL;
  DEBUG_PRINT("OMXCORE: qc_omx_component_get_state %x\n",(unsigned)hComp);

  if(pThis)
  {
    eRet = pThis->get_state(hComp,state);
  }
  return eRet;
}

 OMX_ERRORTYPE
qc_omx_component_tunnel_request(OMX_IN OMX_HANDLETYPE                hComp,
                       OMX_IN OMX_U32                        port,
                       OMX_IN OMX_HANDLETYPE        peerComponent,
                       OMX_IN OMX_U32                    peerPort,
                       OMX_INOUT OMX_TUNNELSETUPTYPE* tunnelSetup)
{
  DEBUG_PRINT("Error: qc_omx_component_tunnel_request Not Implemented\n");
  return OMX_ErrorNotImplemented;
}

 OMX_ERRORTYPE
qc_omx_component_use_buffer(OMX_IN OMX_HANDLETYPE                hComp,
          OMX_INOUT OMX_BUFFERHEADERTYPE** bufferHdr,
          OMX_IN OMX_U32                        port,
          OMX_IN OMX_PTR                     appData,
          OMX_IN OMX_U32                       bytes,
          OMX_IN OMX_U8*                      buffer)
{
  OMX_ERRORTYPE eRet = OMX_ErrorBadParameter;
  qc_omx_component *pThis = (hComp)? (qc_omx_component *)(((OMX_COMPONENTTYPE *)hComp)->pComponentPrivate):NULL;
  DEBUG_PRINT("OMXCORE: qc_omx_component_use_buffer %x\n",(unsigned)hComp);

  if(pThis)
  {
     eRet = pThis->use_buffer(hComp,
                              bufferHdr,
                              port,
                              appData,
                              bytes,
                              buffer);
  }
  return eRet;
}

// qc_omx_component_allocate_buffer  -- API Call
 OMX_ERRORTYPE
qc_omx_component_allocate_buffer(OMX_IN OMX_HANDLETYPE                hComp,
               OMX_INOUT OMX_BUFFERHEADERTYPE** bufferHdr,
               OMX_IN OMX_U32                        port,
               OMX_IN OMX_PTR                     appData,
               OMX_IN OMX_U32                       bytes)
{

  OMX_ERRORTYPE eRet = OMX_ErrorBadParameter;
  qc_omx_component *pThis = (hComp)? (qc_omx_component *)(((OMX_COMPONENTTYPE *)hComp)->pComponentPrivate):NULL;
  DEBUG_PRINT("OMXCORE: qc_omx_component_allocate_buffer %x, %x , %d\n",(unsigned)hComp,(unsigned)bufferHdr,(unsigned)port);

  if(pThis)
  {
    eRet = pThis->allocate_buffer(hComp,bufferHdr,port,appData,bytes);
  }
  return eRet;
}

 OMX_ERRORTYPE
qc_omx_component_free_buffer(OMX_IN OMX_HANDLETYPE         hComp,
           OMX_IN OMX_U32                 port,
           OMX_IN OMX_BUFFERHEADERTYPE* buffer)
{

  OMX_ERRORTYPE eRet = OMX_ErrorBadParameter;
  qc_omx_component *pThis = (hComp)? (qc_omx_component *)(((OMX_COMPONENTTYPE *)hComp)->pComponentPrivate):NULL;
  DEBUG_PRINT("OMXCORE: qc_omx_component_free_buffer[%d] %x, %x\n", (unsigned)port, (unsigned)hComp, (unsigned)buffer);

  if(pThis)
  {
    eRet = pThis->free_buffer(hComp,port,buffer);
  }
  return eRet;
}

 OMX_ERRORTYPE
qc_omx_component_empty_this_buffer(OMX_IN OMX_HANDLETYPE         hComp,
                OMX_IN OMX_BUFFERHEADERTYPE* buffer)
{
  OMX_ERRORTYPE eRet = OMX_ErrorBadParameter;
  qc_omx_component *pThis = (hComp)? (qc_omx_component *)(((OMX_COMPONENTTYPE *)hComp)->pComponentPrivate):NULL;
  DEBUG_PRINT("OMXCORE: qc_omx_component_empty_this_buffer %x, %x\n",(unsigned)hComp,(unsigned)buffer);

  if(pThis)
  {
    eRet = pThis->empty_this_buffer(hComp,buffer);
  }
  return eRet;
}

 OMX_ERRORTYPE
qc_omx_component_fill_this_buffer(OMX_IN OMX_HANDLETYPE         hComp,
               OMX_IN OMX_BUFFERHEADERTYPE* buffer)
{
  OMX_ERRORTYPE eRet = OMX_ErrorBadParameter;
  qc_omx_component *pThis = (hComp)? (qc_omx_component *)(((OMX_COMPONENTTYPE *)hComp)->pComponentPrivate):NULL;
  DEBUG_PRINT("OMXCORE: qc_omx_component_fill_this_buffer %x, %x\n",(unsigned)hComp,(unsigned)buffer);
  if(pThis)
  {
    eRet = pThis->fill_this_buffer(hComp,buffer);
  }
  return eRet;
}

 OMX_ERRORTYPE
qc_omx_component_set_callbacks(OMX_IN OMX_HANDLETYPE        hComp,
             OMX_IN OMX_CALLBACKTYPE* callbacks,
             OMX_IN OMX_PTR             appData)
{
  OMX_ERRORTYPE eRet = OMX_ErrorBadParameter;
  qc_omx_component *pThis = (hComp)? (qc_omx_component *)(((OMX_COMPONENTTYPE *)hComp)->pComponentPrivate):NULL;
  DEBUG_PRINT("OMXCORE: qc_omx_component_set_callbacks %x, %x , %x\n",(unsigned)hComp,(unsigned)callbacks,(unsigned)appData);

  if(pThis)
  {
    eRet = pThis->set_callbacks(hComp,callbacks,appData);
  }
  return eRet;
}

 OMX_ERRORTYPE
qc_omx_component_deinit(OMX_IN OMX_HANDLETYPE hComp)
{
  OMX_ERRORTYPE eRet = OMX_ErrorBadParameter;
  qc_omx_component *pThis = (hComp)? (qc_omx_component *)(((OMX_COMPONENTTYPE *)hComp)->pComponentPrivate):NULL;
  DEBUG_PRINT("OMXCORE: qc_omx_component_deinit %x\n",(unsigned)hComp);

  if(pThis)
  {
    // call the deinit fuction first
    OMX_STATETYPE state;
    pThis->get_state(hComp,&state);
    DEBUG_PRINT("Calling FreeHandle in state %d \n", state);
    eRet = pThis->component_deinit(hComp);
    // destroy the component.
    delete pThis;
  }
  return eRet;
}

 OMX_ERRORTYPE
qc_omx_component_use_EGL_image(OMX_IN OMX_HANDLETYPE                hComp,
            OMX_INOUT OMX_BUFFERHEADERTYPE** bufferHdr,
            OMX_IN OMX_U32                        port,
            OMX_IN OMX_PTR                     appData,
            OMX_IN void*                      eglImage)
{
  OMX_ERRORTYPE eRet = OMX_ErrorBadParameter;
  qc_omx_component *pThis = (hComp)? (qc_omx_component *)(((OMX_COMPONENTTYPE *)hComp)->pComponentPrivate):NULL;
  DEBUG_PRINT("OMXCORE: qc_omx_component_use_EGL_image %x, %x , %d\n",(unsigned)hComp,(unsigned)bufferHdr,(unsigned)port);
  if(pThis)
  {
    eRet = pThis->use_EGL_image(hComp,bufferHdr,port,appData,eglImage);
  }
  return eRet;
}

 OMX_ERRORTYPE
qc_omx_component_role_enum(OMX_IN OMX_HANDLETYPE hComp,
                  OMX_OUT OMX_U8*        role,
                  OMX_IN OMX_U32        index)
{
  OMX_ERRORTYPE eRet = OMX_ErrorBadParameter;
  qc_omx_component *pThis = (hComp)? (qc_omx_component *)(((OMX_COMPONENTTYPE *)hComp)->pComponentPrivate):NULL;
  DEBUG_PRINT("OMXCORE: qc_omx_component_role_enum %x, %x , %d\n",(unsigned)hComp,(unsigned)role,(unsigned)index);

  if(pThis)
  {
    eRet = pThis->component_role_enum(hComp,role,index);
  }
  return eRet;
}


text:
export * from "./naive-array-list";
export * from "./naive-immutable-map";
export * from "./set-axioms";
export * from "./ordered-map";
export * from "./sorted-set-array";


text:
package testutil

import (
	"archive/zip"
	"bytes"
	"io/ioutil"
	"strings"

	. "github.com/onsi/ginkgo"
	. "github.com/onsi/gomega"
)

func CreateZip(contents map[string]string) *bytes.Buffer {
	var result bytes.Buffer
	zipWriter := zip.NewWriter(&result)
	defer zipWriter.Close()
	for filename, fileContents := range contents {
		entryWriter, e := zipWriter.Create(filename)
		Expect(e).NotTo(HaveOccurred())
		entryWriter.Write([]byte(fileContents))

	}
	e := zipWriter.Close()
	Expect(e).NotTo(HaveOccurred())
	return &result
}

func VerifyZipFileEntry(reader *zip.Reader, expectedFilename string, expectedContent string) {
	var foundEntries []string
	for _, entry := range reader.File {
		if entry.Name == expectedFilename {
			content, e := entry.Open()
			Expect(e).NotTo(HaveOccurred())
			Expect(ioutil.ReadAll(content)).To(MatchRegexp(expectedContent), "for filename "+expectedFilename)
			return
		}
		foundEntries = append(foundEntries, entry.Name)
	}
	Fail("Did not find entry with name " + expectedFilename + ". Found only: " + strings.Join(foundEntries, ", "))
}


text:
using System;
using System.Security.Principal;
using Xunit;

public class WellKnownSidTypeTests
{
    public static bool AccountIsDomainJoined()
    {
        using (var identity = WindowsIdentity.GetCurrent())
            return identity.Owner.AccountDomainSid != null;
    }

    [ConditionalTheory(nameof(AccountIsDomainJoined))]
    [InlineData(WellKnownSidType.NullSid)]
    [InlineData(WellKnownSidType.WorldSid)]
    [InlineData(WellKnownSidType.LocalSid)]
    [InlineData(WellKnownSidType.CreatorOwnerSid)]
    [InlineData(WellKnownSidType.CreatorGroupSid)]
    [InlineData(WellKnownSidType.CreatorOwnerServerSid)]
    [InlineData(WellKnownSidType.CreatorGroupServerSid)]
    [InlineData(WellKnownSidType.NTAuthoritySid)]
    [InlineData(WellKnownSidType.DialupSid)]
    [InlineData(WellKnownSidType.NetworkSid)]
    [InlineData(WellKnownSidType.BatchSid)]
    [InlineData(WellKnownSidType.InteractiveSid)]
    [InlineData(WellKnownSidType.ServiceSid)]
    [InlineData(WellKnownSidType.AnonymousSid)]
    [InlineData(WellKnownSidType.ProxySid)]
    [InlineData(WellKnownSidType.EnterpriseControllersSid)]
    [InlineData(WellKnownSidType.SelfSid)]
    [InlineData(WellKnownSidType.AuthenticatedUserSid)]
    [InlineData(WellKnownSidType.RestrictedCodeSid)]
    [InlineData(WellKnownSidType.TerminalServerSid)]
    [InlineData(WellKnownSidType.RemoteLogonIdSid)]
    [InlineData(WellKnownSidType.LocalSystemSid)]
    [InlineData(WellKnownSidType.LocalServiceSid)]
    [InlineData(WellKnownSidType.NetworkServiceSid)]
    [InlineData(WellKnownSidType.BuiltinDomainSid)]
    [InlineData(WellKnownSidType.BuiltinAdministratorsSid)]
    [InlineData(WellKnownSidType.BuiltinUsersSid)]
    [InlineData(WellKnownSidType.BuiltinGuestsSid)]
    [InlineData(WellKnownSidType.BuiltinPowerUsersSid)]
    [InlineData(WellKnownSidType.BuiltinAccountOperatorsSid)]
    [InlineData(WellKnownSidType.BuiltinSystemOperatorsSid)]
    [InlineData(WellKnownSidType.BuiltinPrintOperatorsSid)]
    [InlineData(WellKnownSidType.BuiltinBackupOperatorsSid)]
    [InlineData(WellKnownSidType.BuiltinReplicatorSid)]
    [InlineData(WellKnownSidType.BuiltinPreWindows2000CompatibleAccessSid)]
    [InlineData(WellKnownSidType.BuiltinRemoteDesktopUsersSid)]
    [InlineData(WellKnownSidType.BuiltinNetworkConfigurationOperatorsSid)]
    [InlineData(WellKnownSidType.AccountAdministratorSid)]
    [InlineData(WellKnownSidType.AccountGuestSid)]
    [InlineData(WellKnownSidType.AccountKrbtgtSid)]
    [InlineData(WellKnownSidType.AccountDomainAdminsSid)]
    [InlineData(WellKnownSidType.AccountDomainUsersSid)]
    [InlineData(WellKnownSidType.AccountDomainGuestsSid)]
    [InlineData(WellKnownSidType.AccountComputersSid)]
    [InlineData(WellKnownSidType.AccountControllersSid)]
    [InlineData(WellKnownSidType.AccountCertAdminsSid)]
    [InlineData(WellKnownSidType.AccountSchemaAdminsSid)]
    [InlineData(WellKnownSidType.AccountEnterpriseAdminsSid)]
    [InlineData(WellKnownSidType.AccountPolicyAdminsSid)]
    [InlineData(WellKnownSidType.AccountRasAndIasServersSid)]
    [InlineData(WellKnownSidType.NtlmAuthenticationSid)]
    [InlineData(WellKnownSidType.DigestAuthenticationSid)]
    [InlineData(WellKnownSidType.SChannelAuthenticationSid)]
    [InlineData(WellKnownSidType.ThisOrganizationSid)]
    [InlineData(WellKnownSidType.OtherOrganizationSid)]
    [InlineData(WellKnownSidType.BuiltinIncomingForestTrustBuildersSid)]
    [InlineData(WellKnownSidType.BuiltinPerformanceMonitoringUsersSid)]
    [InlineData(WellKnownSidType.BuiltinPerformanceLoggingUsersSid)]
    [InlineData(WellKnownSidType.BuiltinAuthorizationAccessSid)]
    [InlineData(WellKnownSidType.WinBuiltinTerminalServerLicenseServersSid)]
    public void CanCreateSecurityIdentifierFromWellKnownSidType(WellKnownSidType sidType)
    {
        using (var identity = WindowsIdentity.GetCurrent())
        {
            var currentDomainSid = identity.Owner.AccountDomainSid;
            var wellKnownSidInstance = new SecurityIdentifier(sidType, currentDomainSid);

            Assert.True(wellKnownSidInstance.IsWellKnown(sidType));
        }
    }

    [SkipOnTargetFramework(TargetFrameworkMonikers.NetFramework, "This SidTypes are only available in .NET Core")]
    [ConditionalTheory(nameof(AccountIsDomainJoined))]
    [InlineData(WellKnownSidType.WinBuiltinDCOMUsersSid)]
    [InlineData(WellKnownSidType.WinBuiltinIUsersSid)]
    [InlineData(WellKnownSidType.WinIUserSid)]
    [InlineData(WellKnownSidType.WinBuiltinCryptoOperatorsSid)]
    [InlineData(WellKnownSidType.WinUntrustedLabelSid)]
    [InlineData(WellKnownSidType.WinLowLabelSid)]
    [InlineData(WellKnownSidType.WinMediumLabelSid)]
    [InlineData(WellKnownSidType.WinHighLabelSid)]
    [InlineData(WellKnownSidType.WinSystemLabelSid)]
    [InlineData(WellKnownSidType.WinWriteRestrictedCodeSid)]
    [InlineData(WellKnownSidType.WinCreatorOwnerRightsSid)]
    [InlineData(WellKnownSidType.WinCacheablePrincipalsGroupSid)]
    [InlineData(WellKnownSidType.WinNonCacheablePrincipalsGroupSid)]
    [InlineData(WellKnownSidType.WinEnterpriseReadonlyControllersSid)]
    [InlineData(WellKnownSidType.WinAccountReadonlyControllersSid)]
    [InlineData(WellKnownSidType.WinBuiltinEventLogReadersGroup)]
    [InlineData(WellKnownSidType.WinNewEnterpriseReadonlyControllersSid)]
    [InlineData(WellKnownSidType.WinBuiltinCertSvcDComAccessGroup)]
    [InlineData(WellKnownSidType.WinMediumPlusLabelSid)]
    // Test case for WinLocalLogonSid commented out, because of special Authority SID
    // Will require more specialized testing
    // [InlineData(WellKnownSidType.WinLocalLogonSid)]
    [InlineData(WellKnownSidType.WinConsoleLogonSid)]
    [InlineData(WellKnownSidType.WinThisOrganizationCertificateSid)]
    // Test case for WinApplicationPackageAuthoritySid commented out, because of special Authority SID
    // Will require more specialized testing
    // [InlineData(WellKnownSidType.WinApplicationPackageAuthoritySid)]
    [InlineData(WellKnownSidType.WinBuiltinAnyPackageSid)]
    [InlineData(WellKnownSidType.WinCapabilityInternetClientSid)]
    [InlineData(WellKnownSidType.WinCapabilityInternetClientServerSid)]
    [InlineData(WellKnownSidType.WinCapabilityPrivateNetworkClientServerSid)]
    [InlineData(WellKnownSidType.WinCapabilityPicturesLibrarySid)]
    [InlineData(WellKnownSidType.WinCapabilityVideosLibrarySid)]
    [InlineData(WellKnownSidType.WinCapabilityMusicLibrarySid)]
    [InlineData(WellKnownSidType.WinCapabilityDocumentsLibrarySid)]
    [InlineData(WellKnownSidType.WinCapabilitySharedUserCertificatesSid)]
    [InlineData(WellKnownSidType.WinCapabilityEnterpriseAuthenticationSid)]
    [InlineData(WellKnownSidType.WinCapabilityRemovableStorageSid)]
    public void CanCreateSecurityIdentifierFromWellKnownSidType_Netcoreapp(WellKnownSidType sidType)
    {
        using (var identity = WindowsIdentity.GetCurrent())
        {
            var currentDomainSid = identity.Owner.AccountDomainSid;
            var wellKnownSidInstance = new SecurityIdentifier(sidType, currentDomainSid);

            Assert.True(wellKnownSidInstance.IsWellKnown(sidType));
        }
    }

    [Theory]
    [InlineData((WellKnownSidType)(-1))]
    [InlineData((WellKnownSidType)((int)WellKnownSidType.WinCapabilityRemovableStorageSid + 1))]
    public void CreatingSecurityIdentifierOutsideWellKnownSidTypeDefinedRangeThrowsException(WellKnownSidType sidType)
    {
        var currentDomainSid = WindowsIdentity.GetCurrent().Owner.AccountDomainSid;
        Assert.Throws<ArgumentException>(() => new SecurityIdentifier(sidType, currentDomainSid));
    }

    [Fact]
    public void MaxDefinedHasLegacyValue()
    {
#pragma warning disable 0618
        Assert.Equal(WellKnownSidType.WinBuiltinTerminalServerLicenseServersSid, WellKnownSidType.MaxDefined);
#pragma warning restore 0618
    }
}