text:
import * as ts from 'typescript/lib/tsserverlibrary';  // used as value
import * as lsp from 'vscode-languageserver';

import {tsDiagnosticToLspDiagnostic} from './diagnostic';
import {projectLoadingNotification} from './protocol';
import {filePathToUri} from './utils';

// NOTE:
// There are three types of `project`:
// 1. Configured project - basically all source files that belong to a tsconfig
// 2. Inferred project - other files that do not belong to a tsconfig
// 3. External project - not used in this context
// For more info, see link below.
// https://github.com/Microsoft/TypeScript/wiki/Standalone-Server-%28tsserver%29#project-system

/**
 * `ProjectService` is a singleton service for the entire lifespan of the
 * language server. This specific implementation is a very thin wrapper
 * around TypeScript's `ProjectService`. On creation, it spins up tsserver and
 * loads `@angular/language-service` as a tsserver plugin.
 * Care must be taken to load `@angular/language-service` from the project or
 * workspace. This extension shoud not bundle its own
 * `@angular/language-service`, not even as a backup. This is to ensure that
 * the extension becomes a no-op when non-Angular TS projects are opened.
 * `ProjectService` is used to manage both TS document as well as HTML.
 * Using tsserver to handle non-TS files is fine as long as the ScriptKind is
 * configured correctly and `getSourceFile()` is never called on non-TS files.
 */
export class ProjectService {
  public readonly tsProjSvc: ts.server.ProjectService;

  constructor(
      serverHost: ts.server.ServerHost,
      logger: ts.server.Logger,
      private readonly connection: lsp.IConnection,
      options: Map<string, string>,
  ) {
    const pluginProbeLocation =
        options.get('pluginProbeLocation') || serverHost.getCurrentDirectory();
    connection.console.info(`Angular LS probe location: ${pluginProbeLocation}`);
    // TODO: Should load TypeScript from workspace.
    this.tsProjSvc = new ts.server.ProjectService({
      host: serverHost,
      logger,
      cancellationToken: ts.server.nullCancellationToken,
      useSingleInferredProject: true,
      useInferredProjectPerProjectRoot: true,
      typingsInstaller: ts.server.nullTypingsInstaller,
      suppressDiagnosticEvents: false,
      eventHandler: (e) => this.handleProjectServiceEvent(e),
      globalPlugins: ['@angular/language-service'],
      pluginProbeLocations: [pluginProbeLocation],
      allowLocalPluginLoads: false,  // do not load plugins from tsconfig.json
    });

    this.tsProjSvc.setHostConfiguration({
      formatOptions: this.tsProjSvc.getHostFormatCodeOptions(),
      extraFileExtensions: [
        {
          extension: '.html',
          isMixedContent: false,
          scriptKind: ts.ScriptKind.External,
        },
      ],
    });

    this.tsProjSvc.configurePlugin({
      pluginName: '@angular/language-service',
      configuration: {
        'angularOnly': true,
      },
    });

    const globalPlugins = this.tsProjSvc.globalPlugins;
    if (globalPlugins.includes('@angular/language-service')) {
      // TODO: Even if the plugin fails to load, it still remains a global plugin
      // in TS ProjectService. Figure out a a better way to determine the status
      // of the plugin. For now, best way to check is manually inspect the
      // log file.
      connection.console.info('Success: @angular/language-service loaded');
    } else {
      connection.console.error('Failed to load @angular/language-service');
    }
  }

  /**
   * Return the default project for the specified `scriptInfo` if it is already
   * a configured project. If not, attempt to find a relevant config file and
   * make that project its default. This method is to ensure HTML files always
   * belong to a configured project instead of the default behavior of being in
   * an inferred project.
   * @param scriptInfo
   */
  getDefaultProjectForScriptInfo(scriptInfo: ts.server.ScriptInfo): ts.server.Project|undefined {
    let project = this.tsProjSvc.getDefaultProjectForFile(
        scriptInfo.fileName,
        // ensureProject tries to find a default project for the scriptInfo if
        // it does not already have one. It is not needed here because we are
        // going to assign it a project below if it does not have one.
        false  // ensureProject
    );

    // TODO: verify that HTML files are attached to Inferred project by default.
    // If they are already part of a ConfiguredProject then the following is
    // not needed.
    if (!project || project.projectKind !== ts.server.ProjectKind.Configured) {
      const {configFileName} = this.tsProjSvc.openClientFile(scriptInfo.fileName);
      if (!configFileName) {
        // Failed to find a config file. There is nothing we could do.
        return;
      }
      project = this.tsProjSvc.findProject(configFileName);
      if (!project) {
        return;
      }
      scriptInfo.detachAllProjects();
      scriptInfo.attachToProject(project);
    }

    return project;
  }

  /**
   * An event handler that gets invoked whenever the program changes and
   * TS ProjectService sends `ProjectUpdatedInBackgroundEvent`. This particular
   * event is used to trigger diagnostic checks.
   * @param event
   */
  private handleProjectServiceEvent(event: ts.server.ProjectServiceEvent) {
    switch (event.eventName) {
      case ts.server.ProjectLoadingStartEvent:
        this.connection.sendNotification(
            projectLoadingNotification.start, event.data.project.projectName);
        break;
      case ts.server.ProjectLoadingFinishEvent:
        this.connection.sendNotification(
            projectLoadingNotification.finish, event.data.project.projectName);
        break;
      case ts.server.ProjectsUpdatedInBackgroundEvent:
        // ProjectsUpdatedInBackgroundEvent is sent whenever diagnostics are
        // requested via project.refreshDiagnostics()
        this.refreshDiagnostics(event.data.openFiles);
        break;
    }
  }

  private refreshDiagnostics(openFiles: string[]) {
    for (const fileName of openFiles) {
      const scriptInfo = this.tsProjSvc.getScriptInfo(fileName);
      if (!scriptInfo) {
        continue;
      }
      const project = this.getDefaultProjectForScriptInfo(scriptInfo);
      if (!project || !project.languageServiceEnabled) {
        continue;
      }
      const ngLS = project.getLanguageService();
      const diagnostics = ngLS.getSemanticDiagnostics(fileName);
      // Need to send diagnostics even if it's empty otherwise editor state will
      // not be updated.
      this.connection.sendDiagnostics({
        uri: filePathToUri(fileName),
        diagnostics: diagnostics.map(d => tsDiagnosticToLspDiagnostic(d, scriptInfo)),
      });
    }
  }
}


text:
#pragma once

#include <stdint.h> //uintxx_t types
#include "cbc.h" //Cipher size macros

/*
 * Used internally to cbc encrypt 256bit blocks
 */
void cbc256Encrypt(ThreefishKey_t* key,
		   const uint64_t* iv,
		   uint64_t* plain_text,
		   const uint64_t num_blocks);

/*
 * Used internally to cbc encrypt 512bit blocks
 */
void cbc512Encrypt(ThreefishKey_t* key,
		const uint64_t* iv,
		uint64_t* plain_text,
		const uint64_t num_blocks);

/*
 * Used internally to cbc encrypt 1024bit blocks
 */
void cbc1024Encrypt(ThreefishKey_t* key,
		    const uint64_t* iv,
		    uint64_t* plain_text,
		    const uint64_t num_blocks);

/*
* This function assumes padding and allocation has already been taken care of
* Chain is the iv if the plaintext passed in is the first block otherwise it is the last block of cipher text that is cbc encrypted
*/
void encryptInPlace(ThreefishKey_t* key,
                    const uint64_t* chain,
                    uint64_t* plain_text,
                    const uint64_t num_blocks);

redpajama_set_name: RedPajamaGithub


text:
/*********************************************************************\
	File name        : SubDialog.cpp
	Description      :
	Created at       : 03.09.01, @ 20:53:18
	Created by       : Thomas Kunert
	Modified by      :
\*********************************************************************/

#include "stdafx.h"
#include "globals.h"
#include "DialogDoc.h"
#include "DialogItem.h"
#include "DialogItemSettings.h"

#if (defined _DEBUG) && (defined USE_CPP_NEW_DELETE)
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

CDialogSubDlg::CDialogSubDlg(CDialogDoc* pDoc)
{
	m_strName = GeLoadString(IDS_SUB_DIALOG);
	m_strDescr = m_strName;
	m_type = SubDialogControl;
	m_lFlags = BFH_LEFT | BFV_TOP;
	m_lInitW = 0;
	m_lInitH = 0;
	m_pDocument = pDoc;
	m_strControlID = CreateControlID();
}

/*********************************************************************\
	Function name    : CDialogSubDlg::CreateElementBegin
	Description      :
	Created at       : 03.09.01, @ 20:53:17
	Created by       : Thomas Kunert
	Modified by      :
\*********************************************************************/
void CDialogSubDlg::CreateElementBegin(Int32 lID, GeDialog *pDlg)
{
	if (pDlg->Get()) C4DOS.Cd->AddGadget(pDlg->Get(), DIALOG_SUBDIALOG, lID, 0, m_lFlags, CONVERT_WIDTH(m_lInitW), CONVERT_HEIGHT(m_lInitH), 0, nullptr, nullptr);
}

/*********************************************************************\
	Function name    : CDialogSubDlg::Load
	Description      :
	Created at       : 03.09.01, @ 21:02:18
	Created by       : Thomas Kunert
	Modified by      :
\*********************************************************************/
Bool CDialogSubDlg::Load(BaseContainer* bc)
{
	return CDialogItem::Load(bc);
}

/*********************************************************************\
	Function name    : CDialogSubDlg::Save
	Description      :
	Created at       : 03.09.01, @ 21:02:20
	Created by       : Thomas Kunert
	Modified by      :
\*********************************************************************/
Bool CDialogSubDlg::Save(BaseFile* pFile, String strFill)
{
	WriteString(pFile, "SUBDIALOG ");
	WriteString(pFile, m_strControlID);
	WriteString(pFile, " { ");
	SaveAlignment(pFile, false, false);
	WriteString(pFile, "}");
	return true;
}

CSubDialogSettings::CSubDialogSettings()
{
	m_lTabPageID = IDC_SUB_DLG_SETTINGS_TAB;
}

CSubDialogSettings::~CSubDialogSettings()
{
}

/*********************************************************************\
	Function name    : CSubDialogSettings::SetData
	Description      :
	Created at       : 03.09.01, @ 20:56:19
	Created by       : Thomas Kunert
	Modified by      :
\*********************************************************************/
void CSubDialogSettings::SetData()
{
	_Init();
}

/*********************************************************************\
	Function name    : CSubDialogSettings::Command
	Description      :
	Created at       : 03.09.01, @ 20:56:17
	Created by       : Thomas Kunert
	Modified by      :
\*********************************************************************/
Bool CSubDialogSettings::Command(Int32 lID, const BaseContainer &msg)
{
	return true;
}


text:
package docker

import (
	"context"
	"errors"
	"fmt"
	"net/http"
	"path/filepath"
	"sort"
	"strings"
	"sync"

	"github.com/docker/docker/client"
	"github.com/docker/go-connections/tlsconfig"

	"github.com/GoogleContainerTools/skaffold/pkg/skaffold/cluster"
	"github.com/GoogleContainerTools/skaffold/pkg/skaffold/config"
	"github.com/GoogleContainerTools/skaffold/pkg/skaffold/output/log"
	"github.com/GoogleContainerTools/skaffold/pkg/skaffold/util"
	"github.com/GoogleContainerTools/skaffold/pkg/skaffold/version"
)

// minikube 1.13.0 renumbered exit codes
const minikubeDriverConfictExitCode = 51
const minikubeExGuestUnavailable = 89
const oldMinikubeBadUsageExitCode = 64

// For testing
var (
	NewAPIClient = NewAPIClientImpl
)

var (
	dockerAPIClientOnce sync.Once
	dockerAPIClient     LocalDaemon
	dockerAPIClientErr  error
)

type Config interface {
	Prune() bool
	ContainerDebugging() bool
	GlobalConfig() string
	GetKubeContext() string
	MinikubeProfile() string
	GetInsecureRegistries() map[string]bool
	Mode() config.RunMode
}

// NewAPIClientImpl guesses the docker client to use based on current Kubernetes context.
func NewAPIClientImpl(ctx context.Context, cfg Config) (LocalDaemon, error) {
	dockerAPIClientOnce.Do(func() {
		env, apiClient, err := newAPIClient(ctx, cfg.GetKubeContext(), cfg.MinikubeProfile())
		dockerAPIClient = NewLocalDaemon(apiClient, env, cfg.Prune(), cfg)
		dockerAPIClientErr = err
	})

	return dockerAPIClient, dockerAPIClientErr
}

// TODO(https://github.com/GoogleContainerTools/skaffold/issues/3668):
// remove minikubeProfile from here and instead detect it by matching the
// kubecontext API Server to minikube profiles

// newAPIClient guesses the docker client to use based on current Kubernetes context.
func newAPIClient(ctx context.Context, kubeContext string, minikubeProfile string) ([]string, client.CommonAPIClient, error) {
	if minikubeProfile != "" { // skip validation if explicitly specifying minikubeProfile.
		return newMinikubeAPIClient(ctx, minikubeProfile)
	}
	if cluster.GetClient().IsMinikube(ctx, kubeContext) {
		return newMinikubeAPIClient(ctx, kubeContext)
	}
	return newEnvAPIClient()
}

// newEnvAPIClient returns a docker client based on the environment variables set.
// It will "negotiate" the highest possible API version supported by both the client
// and the server if there is a mismatch.
func newEnvAPIClient() ([]string, client.CommonAPIClient, error) {
	cli, err := client.NewClientWithOpts(client.FromEnv, client.WithHTTPHeaders(getUserAgentHeader()))
	if err != nil {
		return nil, nil, fmt.Errorf("error getting docker client: %s", err)
	}
	cli.NegotiateAPIVersion(context.Background())

	return nil, cli, nil
}

type ExitCoder interface {
	ExitCode() int
}

// newMinikubeAPIClient returns a docker client using the environment variables
// provided by minikube.
func newMinikubeAPIClient(ctx context.Context, minikubeProfile string) ([]string, client.CommonAPIClient, error) {
	env, err := getMinikubeDockerEnv(ctx, minikubeProfile)
	if err != nil {
		// When minikube uses the infamous `none` driver, `minikube docker-env` will exit with
		// code 51 (>= 1.13.0) or 64 (< 1.13.0).  Note that exit code 51 was unused prior to 1.13.0
		// so it is safe to check here without knowing the minikube version.
		var exitError ExitCoder
		if errors.As(err, &exitError) && (exitError.ExitCode() == minikubeDriverConfictExitCode || exitError.ExitCode() == oldMinikubeBadUsageExitCode || exitError.ExitCode() == minikubeExGuestUnavailable) {
			// Let's ignore the error and fall back to local docker daemon.
			log.Entry(context.TODO()).Warnf("Could not get minikube docker env, falling back to local docker daemon: %s", err)
			return newEnvAPIClient()
		}

		return nil, nil, err
	}

	var httpclient *http.Client
	if dockerCertPath := env["DOCKER_CERT_PATH"]; dockerCertPath != "" {
		options := tlsconfig.Options{
			CAFile:             filepath.Join(dockerCertPath, "ca.pem"),
			CertFile:           filepath.Join(dockerCertPath, "cert.pem"),
			KeyFile:            filepath.Join(dockerCertPath, "key.pem"),
			InsecureSkipVerify: env["DOCKER_TLS_VERIFY"] == "",
		}
		tlsc, err := tlsconfig.Client(options)
		if err != nil {
			return nil, nil, err
		}

		httpclient = &http.Client{
			Transport: &http.Transport{
				TLSClientConfig: tlsc,
			},
			CheckRedirect: client.CheckRedirect,
		}
	}

	host := env["DOCKER_HOST"]
	if host == "" {
		host = client.DefaultDockerHost
	}

	api, err := client.NewClientWithOpts(
		client.WithHost(host),
		client.WithHTTPClient(httpclient),
		client.WithHTTPHeaders(getUserAgentHeader()))
	if err != nil {
		return nil, nil, err
	}

	if api != nil {
		api.NegotiateAPIVersion(context.Background())
	}

	if host != client.DefaultDockerHost {
		log.Entry(context.TODO()).Infof("Using minikube docker daemon at %s", host)
	}

	// Keep the minikube environment variables
	var environment []string
	for k, v := range env {
		environment = append(environment, fmt.Sprintf("%s=%s", k, v))
	}
	sort.Strings(environment)

	return environment, api, err
}

func getUserAgentHeader() map[string]string {
	userAgent := fmt.Sprintf("skaffold-%s", version.Get().Version)
	log.Entry(context.TODO()).Debugf("setting Docker user agent to %s", userAgent)
	return map[string]string{
		"User-Agent": userAgent,
	}
}

func getMinikubeDockerEnv(ctx context.Context, minikubeProfile string) (map[string]string, error) {
	if minikubeProfile == "" {
		return nil, fmt.Errorf("empty minikube profile")
	}
	cmd, err := cluster.GetClient().MinikubeExec(ctx, "docker-env", "--shell", "none", "-p", minikubeProfile)
	if err != nil {
		return nil, fmt.Errorf("executing minikube command: %w", err)
	}
	out, err := util.RunCmdOut(ctx, cmd)
	if err != nil {
		return nil, fmt.Errorf("getting minikube env: %w", err)
	}

	env := map[string]string{}
	for _, line := range strings.Split(string(out), "\n") {
		if line == "" || strings.HasPrefix(line, "#") {
			continue
		}
		kv := strings.SplitN(line, "=", 2)
		if len(kv) != 2 {
			return nil, fmt.Errorf("unable to parse minikube docker-env keyvalue: %s, line: %s, output: %s", kv, line, string(out))
		}
		env[kv[0]] = kv[1]
	}

	return env, nil
}


text:
namespace enterprise_reporting {

// Returns the obfusted `file_path` string with SHA256 algorithm.
std::string ObfuscateFilePath(const std::string& file_path);
}  // namespace enterprise_reporting

#endif  // COMPONENTS_ENTERPRISE_BROWSER_REPORTING_REPORT_UTIL_H_


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

package org.chromium.chromium_linker_test_apk;

import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;

import org.chromium.base.BaseSwitches;
import org.chromium.base.CommandLine;
import org.chromium.base.library_loader.LibraryLoader;
import org.chromium.base.library_loader.Linker;
import org.chromium.base.library_loader.ProcessInitException;
import org.chromium.content.browser.BrowserStartupController;
import org.chromium.content.browser.ContentView;
import org.chromium.content.browser.ContentViewClient;
import org.chromium.content_shell.Shell;
import org.chromium.content_shell.ShellManager;
import org.chromium.ui.base.ActivityWindowAndroid;
import org.chromium.ui.base.WindowAndroid;

/**
 * Test activity used for verifying the different configuration options for the ContentLinker.
 */
public class ChromiumLinkerTestActivity extends Activity {
    public static final String COMMAND_LINE_FILE =
            "/data/local/tmp/chromium-linker-test-command-line";

    private static final String TAG = "ChromiumLinkerTestActivity";

    public static final String COMMAND_LINE_ARGS_KEY = "commandLineArgs";

    // Use this on the command-line to simulate a low-memory device, otherwise
    // a regular device is simulated by this test, independently from what the
    // target device running the test really is.
    private static final String LOW_MEMORY_DEVICE = "--low-memory-device";

    private ShellManager mShellManager;
    private WindowAndroid mWindowAndroid;

    @Override
    public void onCreate(final Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        // Initializing the command line must occur before loading the library.
        if (!CommandLine.isInitialized()) {
            CommandLine.initFromFile(COMMAND_LINE_FILE);
            String[] commandLineParams = getCommandLineParamsFromIntent(getIntent());
            if (commandLineParams != null) {
                CommandLine.getInstance().appendSwitchesAndArguments(commandLineParams);
            }
        }
        waitForDebuggerIfNeeded();

        // CommandLine.getInstance().hasSwitch() doesn't work here for some funky
        // reason, so parse the command-line differently here:
        boolean hasLowMemoryDeviceSwitch = false;
        String[] cmdline = CommandLine.getJavaSwitchesOrNull();
        if (cmdline == null)
            Log.i(TAG, "Command line is null");
        else {
            Log.i(TAG, "Command line is:");
            for (int n = 0; n < cmdline.length; ++n) {
                Log.i(TAG, "  '" + cmdline[n] + "'");
                if (cmdline[n].equals(LOW_MEMORY_DEVICE))
                    hasLowMemoryDeviceSwitch = true;
            }
        }

        // Determine which kind of device to simulate from the command-line.
        int memoryDeviceConfig = Linker.MEMORY_DEVICE_CONFIG_NORMAL;
        if (hasLowMemoryDeviceSwitch)
            memoryDeviceConfig = Linker.MEMORY_DEVICE_CONFIG_LOW;
        Linker.setMemoryDeviceConfig(memoryDeviceConfig);

        // Register the test runner class by name.
        Linker.setTestRunnerClassName(LinkerTests.class.getName());

        // Load the library in the browser process, this will also run the test
        // runner in this process.
        try {
            LibraryLoader.ensureInitialized(null);
        } catch (ProcessInitException e) {
            Log.i(TAG, "Cannot load chromium_linker_test:" +  e);
        }

        // Now, start a new renderer process by creating a new view.
        // This will run the test runner in the renderer process.

        BrowserStartupController.get(getApplicationContext()).initChromiumBrowserProcessForTests();

        LayoutInflater inflater =
                (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);
        View view = inflater.inflate(R.layout.test_activity, null);
        mShellManager = (ShellManager) view.findViewById(R.id.shell_container);
        mWindowAndroid = new ActivityWindowAndroid(this);
        mShellManager.setWindow(mWindowAndroid);

        mShellManager.setStartupUrl("about:blank");

        try {
            BrowserStartupController.get(this).startBrowserProcessesAsync(
                    new BrowserStartupController.StartupCallback() {
                @Override
                public void onSuccess(boolean alreadyStarted) {
                    finishInitialization(savedInstanceState);
                }

                @Override
                public void onFailure() {
                    initializationFailed();
                }
            });
        } catch (ProcessInitException e) {
            Log.e(TAG, "Unable to load native library.", e);
            finish();
        }

        // TODO(digit): Ensure that after the content view is initialized,
        // the program finishes().
    }

    private void finishInitialization(Bundle savedInstanceState) {
        String shellUrl = ShellManager.DEFAULT_SHELL_URL;
        mShellManager.launchShell(shellUrl);
        getActiveContentView().setContentViewClient(new ContentViewClient());
    }

    private void initializationFailed() {
        Log.e(TAG, "ContentView initialization failed.");
        finish();
    }

    @Override
    protected void onSaveInstanceState(Bundle outState) {
        super.onSaveInstanceState(outState);
        mWindowAndroid.saveInstanceState(outState);
    }

    private void waitForDebuggerIfNeeded() {
        if (CommandLine.getInstance().hasSwitch(BaseSwitches.WAIT_FOR_JAVA_DEBUGGER)) {
            Log.e(TAG, "Waiting for Java debugger to connect...");
            android.os.Debug.waitForDebugger();
            Log.e(TAG, "Java debugger connected. Resuming execution.");
        }
    }

    @Override
    protected void onStop() {
        super.onStop();

        ContentView view = getActiveContentView();
        if (view != null) view.onHide();
    }

    @Override
    protected void onStart() {
        super.onStart();

        ContentView view = getActiveContentView();
        if (view != null) view.onShow();
    }

    @Override
    public void onActivityResult(int requestCode, int resultCode, Intent data) {
        super.onActivityResult(requestCode, resultCode, data);
        mWindowAndroid.onActivityResult(requestCode, resultCode, data);
    }

    private static String[] getCommandLineParamsFromIntent(Intent intent) {
        return intent != null ? intent.getStringArrayExtra(COMMAND_LINE_ARGS_KEY) : null;
    }

    /**
     * @return The {@link ContentView} owned by the currently visible {@link Shell} or null if one
     *         is not showing.
     */
    public ContentView getActiveContentView() {
        if (mShellManager == null)
            return null;

        Shell shell = mShellManager.getActiveShell();
        if (shell == null)
            return null;

        return shell.getContentView();
    }
}


text:
var qiniu = require('../');
var _ = require('underscore');
var should = require('should');
var path = require('path');
var sleep = require('sleep');

qiniu.conf.setConf({accessKey:process.env.QINIU_ACCESS_KEY,
                    secretKey:process.env.QINIU_SECRET_KEY});

var imgFile = path.join(__dirname, 'gogopher.jpg');
var bucket1 = qiniu.bucket(process.env.QINIU_TEST_BUCKET, {dnHost: process.env.QINIU_TEST_DOMAIN, isPublic: false});
var prefix = '';

before(function(done) {
  if (!process.env.QINIU_ACCESS_KEY) {
    console.log('should run command `source test-env.sh` first\n');
    process.exit(0);
  }
  done();
});

describe('test start', function() {
  var keys = [];

  after(function(done) {
    var batch = qiniu.batch();
    batch.remove(keys, function(err, ret) {
      should.not.exist(err);
      done();
    });
  });

  describe('test key', function() {
    var rskey;
    it('upload file', function(done) {
      var key = bucket1.key(r());
      key.putFile(imgFile, function(err, ret) {
        should.not.exist(err);
        rskey = key;
        keys.push(key);
        done();
      });
    });

    it('upload file(no such file)', function(done) {
      var key = bucket1.key(r());
      key.putFile('no such file', function(err, ret) {
        err.code.should.equal(-1);
        done();
      });
    });

    it('upload', function(done) {
      var key = bucket1.key(r());
      key.put(r(), function(err, ret) {
        should.not.exist(err);
        keys.push(key);
        done();
      });
    });

    it('upload with bucket token', function(done) {
      var key = bucket1.key(r());
      var token = bucket1.upToken(1800);
      key.put(r(), token, function(err, ret) {
        should.not.exist(err);
        keys.push(key);
        done();
      });
    });

    it('rs stat&move&copy&remove', function(done) {
      var rskey1 = bucket1.key(r());
      rskey.stat()
        .then(function(ret) {
          ret.should.have.keys('putTime', 'hash', 'mimeType', 'fsize');
          return rskey.move(rskey1);
        })
        .then(function(ret) {
          return rskey1.copy(rskey);
        })
        .then(function(ret) {
          return rskey1.remove();
        })
        .then(function() {
          done();
        }, function(err) {
          should.not.exist(err);
          done();
        });
    });
  });

  describe('test batch', function() {
    var batch = qiniu.batch();
    it('stat', function(done) {
      batch.stat(keys, function(err, ret) {
        should.not.exist(err);
        ret.length.should.be.above(0);
        done();
      });
    });

    it('move&copy', function(done) {
      var keys1 = [];
      for (var i in keys) {
        keys1.push(bucket1.key(r()));
      }
      sleep.sleep(3);
      var keyPairs0 = _.zip(keys, keys1);
      var keyPairs1 = _.zip(keys1, keys);
      batch.move(keyPairs0)
      .then(function() {
        return batch.copy(keyPairs1);
      })
      .then(function() {
        keys = _.union(keys, keys1);
        done();
      }, should.not.exist);
    });
  });

  describe('test fop', function() {
    var imgKey = bucket1.key(r());
    before(function(done) {
      imgKey.putFile(imgFile, function(err, ret) {
        should.not.exist(err);
        done();
      });
    });
    after(function(done) {
      keys.push(imgKey);
      done();
    });

    it('imageInfo', function(done) {
      imgKey.imageInfoCall(function(err, ret) {
        should.not.exist(err);
        ret.should.have.keys('width', 'height', 'format', 'colorModel');
        done();
      });
    });

    it('exif', function(done) {
      imgKey.exifCall(function(err, ret) {
        should.not.exist(err);
        ret.should.be.type('object');
        done();
      });
    });

    it('pfop', function(done) {
      imgKey.pfop('exif', {force: true}, function(err, ret) {
        should.not.exist(err);
        ret.should.be.type('object');
        ret.should.have.keys('persistentId');
        done();
      });
    });
  });

  describe('test bucket', function() {
    it('list all', function(done) {
      var items = [];
      var callback = function(err, ret) {
        should.not.exist(err);
        items = _.union(items, ret.items);
        if (ret.marker) {
          bucket1.list({prefix: prefix}, callback);
        } else {
          items.length.should.equal(keys.length);
          done();
        };
      }
      bucket1.list({prefix: prefix}, callback);
    });
  });

});

function r() {
  if (prefix == '') {
    prefix = Math.floor(Math.random(1000)*10000) + '';
  }
  return prefix + Math.random(1000);
}


text:
Sources:

1. KJ Friston, N Trujillo-Barreto, and J Daunizeau (2008) "DEM: A variational treatment of dynamic systems" NeuroImage
2. KJ Friston, KE Stephan, B Li, and J Daunizeau (2010) "Generalised filtering" Mathematical Problems in Engineering


text:
package de.codecentric.zucchini.bdd.dsl.impl.steps;

import de.codecentric.zucchini.bdd.dsl.Step;

/**
 * A non-operational step is a dummy step that does nothing.
 */
public class NonOperationalStep implements Step {
	/**
	 * This method does nothing.
	 */
	@SuppressWarnings("EmptyMethod")
    @Override
	public void go() {
		// Intentionally left blank.
	}
}


text:
{# example login template using locally-branded cas login button #}
{% extends 'admin/login.html' %}
{% load static %}

{% block stylesheets %}
  {{ block.super }}
  <link type="text/css" rel="stylesheet" href="{% static 'pucas/pu-login.css' %}"/>
{% endblock %}

{% block content %}
    {% include 'pucas/pu-cas-login.html' %}
    {{ block.super }}
{% endblock %}


text:
{% extends "layout.html" %}
{% block body %}
{{ body }}
{% endblock body %}


text:
import logging
import time

import psycopg2
from psycopg2.extras import DictCursor

LOG = logging.getLogger()

class DBConn:
    def __init__(self, dsn, statement_timeout=0, num_retries=120, retry_wait=1, use_dict_cursor = False):
        self.dsn = dsn
        self.conn = None
        self.cursor = None
        self.server_side_cursor = None
        self.statement_timeout = statement_timeout
        self.num_retries = num_retries
        self.retry_wait = retry_wait
        self.use_dict_cursor = use_dict_cursor

    def __enter__(self):
        options = f'-c statement_timeout={self.statement_timeout}'
        trial = 0
        while trial < self.num_retries:
            try:
                self.conn = psycopg2.connect(self.dsn, options=options)
                self.conn.autocommit = True
                self.cursor = self.conn.cursor(cursor_factory = DictCursor if self.use_dict_cursor else None)
                self.server_side_cursor = self.conn.cursor('server-side-cursor')
                break

            except psycopg2.Error as exc:
                LOG.info(f'Cannot connect to DB. Retrying. Error: {exc}')
                trial += 1
                time.sleep(self.retry_wait)

        assert self.conn, 'There is no connection.'
        assert self.cursor, 'There is no cursor.'
        assert self.server_side_cursor, 'There is no server-side cursor.'

        return self

    def __exit__(self, *args):
        self.cursor.close()
        self.conn.close()


text:
from ._extensions_operations import ExtensionsOperations
from ._operation_status_operations import OperationStatusOperations
from ._flux_configurations_operations import FluxConfigurationsOperations
from ._flux_config_operation_status_operations import FluxConfigOperationStatusOperations
from ._source_control_configurations_operations import SourceControlConfigurationsOperations
from ._operations import Operations

__all__ = [
    'ExtensionsOperations',
    'OperationStatusOperations',
    'FluxConfigurationsOperations',
    'FluxConfigOperationStatusOperations',
    'SourceControlConfigurationsOperations',
    'Operations',
]


text:
<?php
namespace Scalr\Tests\Service\Aws\DataType;

use Scalr\Service\Aws\Ec2\DataType\IpPermissionList;
use Scalr\Service\Aws\Ec2\DataType\BlockDeviceMappingData;
use Scalr\Service\Aws\Ec2\DataType\ResourceTagSetData;
use Scalr\Service\Aws\Ec2\DataType\ResourceTagSetList;
use Scalr\Service\Aws\Elb\DataType\LoadBalancerDescriptionData;
use Scalr\Service\Aws\Elb\DataType\ListenerDescriptionList;
use Scalr\Service\Aws\Elb\DataType\ListenerDescriptionData;
use Scalr\Service\Aws\Elb\DataType\LoadBalancerDescriptionList;
use Scalr\Service\Aws;
use Scalr\Tests\Service\AwsTestCase;
use Scalr\Service\Aws\Elb\DataType\ListenerData;
use Scalr\Service\Aws\Elb\DataType\InstanceData;
use Scalr\Service\Aws\DataType\ListDataType;

/**
 * AWS ListDataType test
 *
 * @author    Vitaliy Demidov   <vitaliy@scalr.com>
 * @since     25.09.2012
 */
class ListDataTypeTest extends AwsTestCase
{

    const CLASS_INSTANCE_DATA = 'Scalr\\Service\\Aws\\Elb\\DataType\\InstanceData';

    const CLASS_LISTENER_DATA = 'Scalr\\Service\\Aws\\Elb\\DataType\\ListenerData';

    /**
     * {@inheritdoc}
     * @see Scalr\Tests\Service.AwsTestCase::setUp()
     */
    protected function setUp()
    {
        parent::setUp();
    }

    /**
     * {@inheritdoc}
     * @see Scalr\Tests\Service.AwsTestCase::tearDown()
     */
    protected function tearDown()
    {
        parent::tearDown();
    }

    /**
     * Data provider
     *
     * @return array
     */
    public function provider()
    {
        $instanceData = new InstanceData();
        $instanceData->instanceId = 1;

        $instanceData2 = clone $instanceData;
        $instanceData2->instanceId = 2;

        $instanceData3 = clone $instanceData;
        $instanceData3->instanceId = 3;

        $listener = new ListenerData();
        $listener->instancePort = 901;
        $listener->protocol = 'HTTP';
        $listener->loadBalancerPort = 18901;

        $listener2 = new ListenerData();
        $listener2->instancePort = 902;
        $listener2->protocol = 'HTTPS';
        $listener2->loadBalancerPort = 18902;

        return array(
            //Single element is passed as list
            array(
                'loadBalancerOne',
                'loadBalancerNames',
                null,
                array(
                    'LoadBalancerNames.member.1' => 'loadBalancerOne'
                )
            ),
            //Array of the values is passed as list
            array(
                array(
                    'loadBalancerOne',
                    'loadBalancerTwo',
                    'loadBalancerThree'
                ),
                'loadBalancerNames',
                null,
                array(
                    'LoadBalancerNames.member.1' => 'loadBalancerOne',
                    'LoadBalancerNames.member.2' => 'loadBalancerTwo',
                    'LoadBalancerNames.member.3' => 'loadBalancerThree'
                )
            ),
            //Associative array is passed as list
            array(
                array(
                    array(
                        'loadBalancerNames' => 'loadBalancerOne',
                        'anoterprop' => true
                    ),
                    array(
                        'different_prop' => 'different value',
                        'loadBalancerNames' => 'loadBalancerTwo',
                        'anoter_prop' => ''
                    )
                ),
                'loadBalancerNames',
                null,
                array(
                    'LoadBalancerNames.member.1' => 'loadBalancerOne',
                    'LoadBalancerNames.member.2' => 'loadBalancerTwo'
                )
            ),
            //Single DataType object is passed as list
            array(
                $instanceData,
                'instanceId',
                null,
                array(
                    'InstanceId.member.1' => 1
                ),
                'InstanceId.member.1=1'
            ),
            //Array of DataType objects is passed as list
            array(
                array(
                    $instanceData,
                    $instanceData2,
                    $instanceData3
                ),
                'instanceId',
                self::CLASS_INSTANCE_DATA,
                array(
                    'InstanceId.member.1' => $instanceData->instanceId,
                    'InstanceId.member.2' => $instanceData2->instanceId,
                    'InstanceId.member.3' => $instanceData3->instanceId
                )
            ),
            //Array of DataType objects is passed as list with complex propertyName
            array(
                array(
                    $listener,
                    $listener2
                ),
                array(
                    'protocol',
                    'instancePort',
                    'loadBalancerPort'
                ),
                self::CLASS_LISTENER_DATA,
                array(
                    'Undefined.member.1.Protocol' => 'HTTP',
                    'Undefined.member.1.InstancePort' => 901,
                    'Undefined.member.1.LoadBalancerPort' => 18901,
                    'Undefined.member.2.Protocol' => 'HTTPS',
                    'Undefined.member.2.InstancePort' => 902,
                    'Undefined.member.2.LoadBalancerPort' => 18902
                )
            ),
            //Array of Associative arrays is passed as list with complex propertyName
            array(
                array(
                    array(
                        'loadBalancerPort' => 901,
                        'instancePort' => 901,
                        'protocol' => 'HTTP'
                    ),
                    array(
                        'loadBalancerPort' => 902,
                        'instancePort' => 902,
                        'protocol' => 'HTTPS'
                    )
                ),
                array(
                    'protocol',
                    'instancePort',
                    'loadBalancerPort'
                ),
                self::CLASS_LISTENER_DATA,
                array(
                    'Undefined.member.1.Protocol' => 'HTTP',
                    'Undefined.member.1.InstancePort' => 901,
                    'Undefined.member.1.LoadBalancerPort' => 901,
                    'Undefined.member.2.Protocol' => 'HTTPS',
                    'Undefined.member.2.InstancePort' => 902,
                    'Undefined.member.2.LoadBalancerPort' => 902
                )
            )
        );
    }

    /**
     * @test
     * @dataProvider provider
     */
    public function testConstructor($aListData, $propertyName, $dataClassName = null, $opt = array())
    {
        $list = new ListDataType($aListData, $propertyName, $dataClassName);
        $this->assertEquals($opt, $list->getQueryArray(), 'Unexpected options array');
        $this->assertEquals(count($opt), (is_array($propertyName) ? count($propertyName) : 1) * count($list), 'Different number of arguments');
        $this->assertInstanceOf('Iterator', $list, 'List does not implement Iterator interface.');
        $this->assertInstanceOf('Countable', $list, 'List does not implement Countable interface.');
        if (!is_array($propertyName)) {
            $keys = array_keys($opt);
            foreach ($list->getQueryArray() as $key => $value) {
                $this->assertContains($key, $keys, 'Missing key');
                $this->assertContains($value, $opt, 'Missing value');
            }
            $this->assertEquals(array_values($opt), $list->getComputed(), 'Unexpected out of getComputed() method.');
        } else if ($dataClassName != null) {
            foreach ($list as $value) {
                $this->assertInstanceOf($dataClassName, $value);
            }
        }
        unset($list);
    }

    /**
     * @test
     * @expectedException   \InvalidArgumentException
     */
    public function testIllegalObject()
    {
        $instanceData = new InstanceData();
        $instanceData->instanceId = 1;
        $list = new ListDataType($instanceData, 'instanceId', 'stdClass');
        $list->getComputed();
    }

    /**
     * @test
     */
    public function testPropertyInheritance()
    {
        $lbName = 'test-load-balancer';
        $elbStub = $this->getServiceInterfaceMock(Aws::SERVICE_INTERFACE_ELB);
        $elbClassName = get_class($elbStub);
        $lbList = new LoadBalancerDescriptionList();
        $lbList->setElb($elbStub);
        $lbList2 = clone $lbList;
        $listenerDescriptionList = new ListenerDescriptionList();
        for ($i = 0; $i < 3; $i++) {
            $listenerDescription = new ListenerDescriptionData();
            $listenerDescription->listener = new ListenerData();
            $listenerDescription->listener->instancePort = 1024 + $i;
            $listenerDescriptionList->append($listenerDescription);
            unset($listenerDescription);
        }
        $lb = new LoadBalancerDescriptionData();
        $lb->setLoadBalancerName($lbName);
        $lb->listenerDescriptions = $listenerDescriptionList;
        $lb2 = clone $lb;
        //Append test
        $lbList->append($lb);
        $this->assertInstanceOf($elbClassName, $lb->getElb());
        $this->assertEquals($lbName, $lb->getLoadBalancerName());
        $this->assertInstanceOf($elbClassName, $lb->listenerDescriptions->getElb());
        $this->assertEquals($lbName, $lb->listenerDescriptions->getLoadBalancerName());
        /* @var $listenerDescription ListenerDescriptionData */
        foreach ($lb->listenerDescriptions as $listenerDescription) {
            $this->assertInstanceOf($elbClassName, $listenerDescription->getElb());
            $this->assertEquals($lbName, $listenerDescription->getLoadBalancerName());
            $this->assertInstanceOf($elbClassName, $listenerDescription->listener->getElb());
            $this->assertEquals($lbName, $listenerDescription->listener->getLoadBalancerName());
        }
        //Array access set test
        $lbList2[0] = $lb2;
        $this->assertInstanceOf($elbClassName, $lb2->getElb());
        $this->assertInstanceOf($elbClassName, $lb2->listenerDescriptions->getElb());
        /* @var $listenerDescription ListenerDescriptionData */
        foreach ($lb2->listenerDescriptions as $listenerDescription) {
            $this->assertInstanceOf($elbClassName, $listenerDescription->getElb());
        }
    }

    /**
     * @test
     */
    public function testIssetMemberOfTheList()
    {
        $list = new ResourceTagSetList();
        $list->append(new ResourceTagSetData('key-0', 'value-0'));
        $this->assertFalse(isset($list[46]));
        $this->assertFalse(isset($list[1]->key));
        $this->assertTrue(isset($list[0]->value));
        $this->assertTrue(isset($list->get(0)->value));
        $this->assertTrue(empty($list->get(3)->value));

        //non-existent variable test
        $this->assertFalse(isset($foo[0]->missing[12]->none_xistent));
    }

    /**
     * @test
     * @expectedException \InvalidArgumentException
     */
    public function testNonReflectionProperties()
    {
        $data = new BlockDeviceMappingData();
        $data->newOption = 'new-option';
    }

    /**
     * @test
     */
    public function testConstructorFromArrayPartialProperties()
    {
        //We provide there not all the properties from the property array
        $list = new IpPermissionList(array(array(
            'ipProtocol' => 'tcp',
        )));
        $this->assertInstanceOf($this->getEc2ClassName('DataType\\IpPermissionData'), $list[0]);
        $this->assertEquals('tcp', $list[0]->ipProtocol);
    }
}


text:
An example non-Yesod application that is compatible with `yesod devel`. Steps
to use it:

* `stack build yesod-bin`
* `stack exec -- yesod devel`


text:
void lab_menu_training_done(component *c, void *userdata) {
    trnmenu_finish(c->parent);
}

static const button_details details_list[] = {
    {NULL, "POWER", TEXT_HORIZONTAL, TEXT_CENTER, TEXT_TOP, 2, 0, 0, 0},
    {NULL, "AGILITY", TEXT_HORIZONTAL, TEXT_CENTER, TEXT_TOP, 2, 0, 0, 0},
    {NULL, "ENDUR.", TEXT_HORIZONTAL, TEXT_CENTER, TEXT_TOP, 2, 0, 0, 0},
    {lab_menu_training_done, "DONE", TEXT_VERTICAL, TEXT_CENTER, TEXT_MIDDLE, 0, 0, 0, 0},
};

component* lab_menu_training_create(scene *s) {
    animation *main_sheets = &bk_get_info(&s->bk_data, 1)->ani;
    animation *main_buttons = &bk_get_info(&s->bk_data, 9)->ani;
    animation *hand_of_doom = &bk_get_info(&s->bk_data, 29)->ani;

    // Initialize menu, and set button sheet
    sprite *msprite = animation_get_sprite(main_sheets, 1);
    component *menu = trnmenu_create(msprite->data, msprite->pos.x, msprite->pos.y);

    // Default text configuration
    text_settings tconf;
    text_defaults(&tconf);
    tconf.font = FONT_SMALL;
    tconf.cforeground = color_create(0, 0, 123, 255);

    // Init GUI buttons with locations from the "select" button sprites
    for(int i = 0; i < animation_get_sprite_count(main_buttons); i++) {
        tconf.valign = details_list[i].valign;
        tconf.halign = details_list[i].halign;
        tconf.padding.top = details_list[i].top;
        tconf.padding.bottom = details_list[i].bottom;
        tconf.padding.left = details_list[i].left;
        tconf.padding.right = details_list[i].right;
        tconf.direction = details_list[i].dir;

        sprite *bsprite = animation_get_sprite(main_buttons, i);
        component *button = spritebutton_create(&tconf, details_list[i].text, bsprite->data, COM_ENABLED, details_list[i].cb, s);
        component_set_size_hints(button, bsprite->data->w, bsprite->data->h);
        component_set_pos_hints(button, bsprite->pos.x, bsprite->pos.y);
        trnmenu_attach(menu, button);
    }

    // Bind hand animation
    trnmenu_bind_hand(menu, hand_of_doom, s->gs);

    return menu;
}


text:
package android.hardware.camera2.legacy;

import android.graphics.Rect;
import android.hardware.Camera;
import android.hardware.Camera.Parameters;
import android.hardware.camera2.CameraCharacteristics;
import android.hardware.camera2.CaptureRequest;
import android.hardware.camera2.params.MeteringRectangle;
import android.hardware.camera2.utils.ListUtils;
import android.hardware.camera2.utils.ParamsUtils;
import android.location.Location;
import android.util.Log;
import android.util.Range;
import android.util.Size;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Objects;

import static android.hardware.camera2.CaptureRequest.*;

/**
 * Provide legacy-specific implementations of camera2 CaptureRequest for legacy devices.
 */
@SuppressWarnings("deprecation")
public class LegacyRequestMapper {
    private static final String TAG = "LegacyRequestMapper";
    private static final boolean DEBUG = false;

    /** Default quality for android.jpeg.quality, android.jpeg.thumbnailQuality */
    private static final byte DEFAULT_JPEG_QUALITY = 85;

    /**
     * Set the legacy parameters using the {@link LegacyRequest legacy request}.
     *
     *
The legacy request's parameters are changed as a side effect of calling this
     * method.

     *
     * @param legacyRequest a non-{@code null} legacy request
     */
    public static void convertRequestMetadata(LegacyRequest legacyRequest) {
        CameraCharacteristics characteristics = legacyRequest.characteristics;
        CaptureRequest request = legacyRequest.captureRequest;
        Size previewSize = legacyRequest.previewSize;
        Camera.Parameters params = legacyRequest.parameters;

        Rect activeArray = characteristics.get(CameraCharacteristics.SENSOR_INFO_ACTIVE_ARRAY_SIZE);

        /*
         * scaler.cropRegion
         */
        ParameterUtils.ZoomData zoomData;
        {
            zoomData = ParameterUtils.convertScalerCropRegion(activeArray,
                    request.get(SCALER_CROP_REGION),
                    previewSize,
                    params);

            if (params.isZoomSupported()) {
                params.setZoom(zoomData.zoomIndex);
            } else if (DEBUG) {
                Log.v(TAG, "convertRequestToMetadata - zoom is not supported");
            }
        }

        /*
         * colorCorrection.*
         */
        // colorCorrection.aberrationMode
        {
            int aberrationMode = ParamsUtils.getOrDefault(request,
                    COLOR_CORRECTION_ABERRATION_MODE,
                    /*defaultValue*/COLOR_CORRECTION_ABERRATION_MODE_FAST);

            if (aberrationMode != COLOR_CORRECTION_ABERRATION_MODE_FAST) {
                Log.w(TAG, "convertRequestToMetadata - Ignoring unsupported " +
                        "colorCorrection.aberrationMode = " + aberrationMode);
            }
        }

        /*
         * control.ae*
         */
        // control.aeAntibandingMode
        {
        String legacyMode;
            Integer antiBandingMode = request.get(CONTROL_AE_ANTIBANDING_MODE);
            if (antiBandingMode != null) {
                legacyMode = convertAeAntiBandingModeToLegacy(antiBandingMode);
            } else {
                legacyMode = ListUtils.listSelectFirstFrom(params.getSupportedAntibanding(),
                        new String[] {
                            Parameters.ANTIBANDING_AUTO,
                            Parameters.ANTIBANDING_OFF,
                            Parameters.ANTIBANDING_50HZ,
                            Parameters.ANTIBANDING_60HZ,
                        });
            }

            if (legacyMode != null) {
                params.setAntibanding(legacyMode);
            }
        }

        /*
         * control.aeRegions, afRegions
         */
        {
            // aeRegions
            {
                // Use aeRegions if available, fall back to using awbRegions if present
                MeteringRectangle[] aeRegions = request.get(CONTROL_AE_REGIONS);
                if (request.get(CONTROL_AWB_REGIONS) != null) {
                    Log.w(TAG, "convertRequestMetadata - control.awbRegions setting is not " +
                            "supported, ignoring value");
                }
                int maxNumMeteringAreas = params.getMaxNumMeteringAreas();
                List<Camera.Area> meteringAreaList = convertMeteringRegionsToLegacy(
                        activeArray, zoomData, aeRegions, maxNumMeteringAreas,
                        /*regionName*/"AE");

                // WAR: for b/17252693, some devices can't handle params.setFocusAreas(null).
                if (maxNumMeteringAreas > 0) {
                    params.setMeteringAreas(meteringAreaList);
                }
            }

            // afRegions
            {
                MeteringRectangle[] afRegions = request.get(CONTROL_AF_REGIONS);
                int maxNumFocusAreas = params.getMaxNumFocusAreas();
                List<Camera.Area> focusAreaList = convertMeteringRegionsToLegacy(
                        activeArray, zoomData, afRegions, maxNumFocusAreas,
                        /*regionName*/"AF");

                // WAR: for b/17252693, some devices can't handle params.setFocusAreas(null).
                if (maxNumFocusAreas > 0) {
                    params.setFocusAreas(focusAreaList);
                }
            }
        }

        // control.aeTargetFpsRange
        Range<Integer> aeFpsRange = request.get(CONTROL_AE_TARGET_FPS_RANGE);
        if (aeFpsRange != null) {
            int[] legacyFps = convertAeFpsRangeToLegacy(aeFpsRange);

            int[] rangeToApply = null;
            for(int[] range : params.getSupportedPreviewFpsRange()) {
                // Round range up/down to integer FPS value
                int intRangeLow = (int) Math.floor(range[0] / 1000.0) * 1000;
                int intRangeHigh = (int) Math.ceil(range[1] / 1000.0) * 1000;
                if (legacyFps[0] == intRangeLow && legacyFps[1] == intRangeHigh) {
                    rangeToApply = range;
                    break;
                }
            }
            if (rangeToApply != null) {
                params.setPreviewFpsRange(rangeToApply[Camera.Parameters.PREVIEW_FPS_MIN_INDEX],
                        rangeToApply[Camera.Parameters.PREVIEW_FPS_MAX_INDEX]);
            } else {
                Log.w(TAG, "Unsupported FPS range set [" + legacyFps[0] + "," + legacyFps[1] + "]");
            }
        }

        /*
         * control
         */

        // control.aeExposureCompensation
        {
            Range<Integer> compensationRange =
                    characteristics.get(CameraCharacteristics.CONTROL_AE_COMPENSATION_RANGE);
            int compensation = ParamsUtils.getOrDefault(request,
                    CONTROL_AE_EXPOSURE_COMPENSATION,
                    /*defaultValue*/0);

            if (!compensationRange.contains(compensation)) {
                Log.w(TAG,
                        "convertRequestMetadata - control.aeExposureCompensation " +
                        "is out of range, ignoring value");
                compensation = 0;
            }

            params.setExposureCompensation(compensation);
        }

        // control.aeLock
        {
            Boolean aeLock = getIfSupported(request, CONTROL_AE_LOCK, /*defaultValue*/false,
                    params.isAutoExposureLockSupported(),
                    /*allowedValue*/false);

            if (aeLock != null) {
                params.setAutoExposureLock(aeLock);
            }

            if (DEBUG) {
                Log.v(TAG, "convertRequestToMetadata - control.aeLock set to " + aeLock);
            }

            // TODO: Don't add control.aeLock to availableRequestKeys if it's not supported
        }

        // control.aeMode, flash.mode
        mapAeAndFlashMode(request, /*out*/params);

        // control.afMode
        {
            int afMode = ParamsUtils.getOrDefault(request, CONTROL_AF_MODE,
                    /*defaultValue*/CONTROL_AF_MODE_OFF);
            String focusMode = LegacyMetadataMapper.convertAfModeToLegacy(afMode,
                    params.getSupportedFocusModes());

            if (focusMode != null) {
                params.setFocusMode(focusMode);
            }

            if (DEBUG) {
                Log.v(TAG, "convertRequestToMetadata - control.afMode "
                        + afMode + " mapped to " + focusMode);
            }
        }

        // control.awbMode
        {
            Integer awbMode = getIfSupported(request, CONTROL_AWB_MODE,
                    /*defaultValue*/CONTROL_AWB_MODE_AUTO,
                    params.getSupportedWhiteBalance() != null,
                    /*allowedValue*/CONTROL_AWB_MODE_AUTO);

            String whiteBalanceMode = null;
            if (awbMode != null) { // null iff AWB is not supported by camera1 api
                whiteBalanceMode = convertAwbModeToLegacy(awbMode);
                params.setWhiteBalance(whiteBalanceMode);
            }

            if (DEBUG) {
                Log.v(TAG, "convertRequestToMetadata - control.awbMode "
                        + awbMode + " mapped to " + whiteBalanceMode);
            }
        }

        // control.awbLock
        {
            Boolean awbLock = getIfSupported(request, CONTROL_AWB_LOCK, /*defaultValue*/false,
                    params.isAutoWhiteBalanceLockSupported(),
                    /*allowedValue*/false);

            if (awbLock != null) {
                params.setAutoWhiteBalanceLock(awbLock);
            }

         // TODO: Don't add control.awbLock to availableRequestKeys if it's not supported
        }

        // control.captureIntent
        {
            int captureIntent = ParamsUtils.getOrDefault(request,
                    CONTROL_CAPTURE_INTENT,
                    /*defaultValue*/CONTROL_CAPTURE_INTENT_PREVIEW);

            captureIntent = filterSupportedCaptureIntent(captureIntent);

            params.setRecordingHint(
                    captureIntent == CONTROL_CAPTURE_INTENT_VIDEO_RECORD ||
                    captureIntent == CONTROL_CAPTURE_INTENT_VIDEO_SNAPSHOT);
        }

        // control.videoStabilizationMode
        {
            Integer stabMode = getIfSupported(request, CONTROL_VIDEO_STABILIZATION_MODE,
                    /*defaultValue*/CONTROL_VIDEO_STABILIZATION_MODE_OFF,
                    params.isVideoStabilizationSupported(),
                    /*allowedValue*/CONTROL_VIDEO_STABILIZATION_MODE_OFF);

            if (stabMode != null) {
                params.setVideoStabilization(stabMode == CONTROL_VIDEO_STABILIZATION_MODE_ON);
            }
        }

        // lens.focusDistance
        {
            boolean infinityFocusSupported =
                    ListUtils.listContains(params.getSupportedFocusModes(),
                            Parameters.FOCUS_MODE_INFINITY);
            Float focusDistance = getIfSupported(request, LENS_FOCUS_DISTANCE,
                    /*defaultValue*/0f, infinityFocusSupported, /*allowedValue*/0f);

            if (focusDistance == null || focusDistance != 0f) {
                Log.w(TAG,
                        "convertRequestToMetadata - Ignoring android.lens.focusDistance "
                                + infinityFocusSupported + ", only 0.0f is supported");
            }
        }

        // control.sceneMode, control.mode
        {
            // TODO: Map FACE_PRIORITY scene mode to face detection.

            if (params.getSupportedSceneModes() != null) {
                int controlMode = ParamsUtils.getOrDefault(request, CONTROL_MODE,
                    /*defaultValue*/CONTROL_MODE_AUTO);
                String modeToSet;
                switch (controlMode) {
                    case CONTROL_MODE_USE_SCENE_MODE: {
                        int sceneMode = ParamsUtils.getOrDefault(request, CONTROL_SCENE_MODE,
                                /*defaultValue*/CONTROL_SCENE_MODE_DISABLED);
                        String legacySceneMode = LegacyMetadataMapper.
                                convertSceneModeToLegacy(sceneMode);
                        if (legacySceneMode != null) {
                            modeToSet = legacySceneMode;
                        } else {
                            modeToSet = Parameters.SCENE_MODE_AUTO;
                            Log.w(TAG, "Skipping unknown requested scene mode: " + sceneMode);
                        }
                        break;
                    }
                    case CONTROL_MODE_AUTO: {
                        modeToSet = Parameters.SCENE_MODE_AUTO;
                        break;
                    }
                    default: {
                        Log.w(TAG, "Control mode " + controlMode +
                                " is unsupported, defaulting to AUTO");
                        modeToSet = Parameters.SCENE_MODE_AUTO;
                    }
                }
                params.setSceneMode(modeToSet);
            }
        }

        // control.effectMode
        {
            if (params.getSupportedColorEffects() != null) {
                int effectMode = ParamsUtils.getOrDefault(request, CONTROL_EFFECT_MODE,
                    /*defaultValue*/CONTROL_EFFECT_MODE_OFF);
                String legacyEffectMode = LegacyMetadataMapper.convertEffectModeToLegacy(effectMode);
                if (legacyEffectMode != null) {
                    params.setColorEffect(legacyEffectMode);
                } else {
                    params.setColorEffect(Parameters.EFFECT_NONE);
                    Log.w(TAG, "Skipping unknown requested effect mode: " + effectMode);
                }
            }
        }

        /*
         * sensor
         */

        // sensor.testPattern
        {
            int testPatternMode = ParamsUtils.getOrDefault(request, SENSOR_TEST_PATTERN_MODE,
                    /*defaultValue*/SENSOR_TEST_PATTERN_MODE_OFF);
            if (testPatternMode != SENSOR_TEST_PATTERN_MODE_OFF) {
                Log.w(TAG, "convertRequestToMetadata - ignoring sensor.testPatternMode "
                        + testPatternMode + "; only OFF is supported");
            }
        }

        /*
         * jpeg.*
         */

        // jpeg.gpsLocation
        {
            Location location = request.get(JPEG_GPS_LOCATION);
            if (location != null) {
                if (checkForCompleteGpsData(location)) {
                    params.setGpsAltitude(location.getAltitude());
                    params.setGpsLatitude(location.getLatitude());
                    params.setGpsLongitude(location.getLongitude());
                    params.setGpsProcessingMethod(location.getProvider().toUpperCase());
                    params.setGpsTimestamp(location.getTime());
                } else {
                    Log.w(TAG, "Incomplete GPS parameters provided in location " + location);
                }
            } else {
                params.removeGpsData();
            }
        }

        // jpeg.orientation
        {
            Integer orientation = request.get(CaptureRequest.JPEG_ORIENTATION);
            params.setRotation(ParamsUtils.getOrDefault(request, JPEG_ORIENTATION,
                    (orientation == null) ? 0 : orientation));
        }

        // jpeg.quality
        {
            params.setJpegQuality(0xFF & ParamsUtils.getOrDefault(request, JPEG_QUALITY,
                    DEFAULT_JPEG_QUALITY));
        }

        // jpeg.thumbnailQuality
        {
            params.setJpegThumbnailQuality(0xFF & ParamsUtils.getOrDefault(request,
                    JPEG_THUMBNAIL_QUALITY, DEFAULT_JPEG_QUALITY));
        }

        // jpeg.thumbnailSize
        {
            List<Camera.Size> sizes = params.getSupportedJpegThumbnailSizes();

            if (sizes != null && sizes.size() > 0) {
                Size s = request.get(JPEG_THUMBNAIL_SIZE);
                boolean invalidSize = (s == null) ? false : !ParameterUtils.containsSize(sizes,
                        s.getWidth(), s.getHeight());
                if (invalidSize) {
                    Log.w(TAG, "Invalid JPEG thumbnail size set " + s + ", skipping thumbnail...");
                }
                if (s == null || invalidSize) {
                    // (0,0) = "no thumbnail" in Camera API 1
                    params.setJpegThumbnailSize(/*width*/0, /*height*/0);
                } else {
                    params.setJpegThumbnailSize(s.getWidth(), s.getHeight());
                }
            }
        }

        /*
         * noiseReduction.*
         */
        // noiseReduction.mode
        {
            int mode = ParamsUtils.getOrDefault(request,
                    NOISE_REDUCTION_MODE,
                    /*defaultValue*/NOISE_REDUCTION_MODE_FAST);

            if (mode != NOISE_REDUCTION_MODE_FAST) {
                Log.w(TAG, "convertRequestToMetadata - Ignoring unsupported " +
                        "noiseReduction.mode = " + mode);
            }
        }
    }

    private static boolean checkForCompleteGpsData(Location location) {
        return location != null && location.getProvider() != null && location.getTime() != 0;
    }

    static int filterSupportedCaptureIntent(int captureIntent) {
        switch (captureIntent) {
            case CONTROL_CAPTURE_INTENT_CUSTOM:
            case CONTROL_CAPTURE_INTENT_PREVIEW:
            case CONTROL_CAPTURE_INTENT_STILL_CAPTURE:
            case CONTROL_CAPTURE_INTENT_VIDEO_RECORD:
            case CONTROL_CAPTURE_INTENT_VIDEO_SNAPSHOT:
                break;
            case CONTROL_CAPTURE_INTENT_ZERO_SHUTTER_LAG:
            case CONTROL_CAPTURE_INTENT_MANUAL:
                captureIntent = CONTROL_CAPTURE_INTENT_PREVIEW;
                Log.w(TAG, "Unsupported control.captureIntent value " + captureIntent
                        + "; default to PREVIEW");
            default:
                captureIntent = CONTROL_CAPTURE_INTENT_PREVIEW;
                Log.w(TAG, "Unknown control.captureIntent value " + captureIntent
                        + "; default to PREVIEW");
        }

        return captureIntent;
    }

    private static List<Camera.Area> convertMeteringRegionsToLegacy(
            Rect activeArray, ParameterUtils.ZoomData zoomData,
            MeteringRectangle[] meteringRegions, int maxNumMeteringAreas, String regionName) {
        if (meteringRegions == null || maxNumMeteringAreas <= 0) {
            if (maxNumMeteringAreas > 0) {
                return Arrays.asList(ParameterUtils.CAMERA_AREA_DEFAULT);
            } else {
                return null;
            }
        }

        // Add all non-zero weight regions to the list
        List<MeteringRectangle> meteringRectangleList = new ArrayList<>();
        for (MeteringRectangle rect : meteringRegions) {
            if (rect.getMeteringWeight() != MeteringRectangle.METERING_WEIGHT_DONT_CARE) {
                meteringRectangleList.add(rect);
            }
        }

        if (meteringRectangleList.size() == 0) {
            Log.w(TAG, "Only received metering rectangles with weight 0.");
            return Arrays.asList(ParameterUtils.CAMERA_AREA_DEFAULT);
        }

        // Ignore any regions beyond our maximum supported count
        int countMeteringAreas =
                Math.min(maxNumMeteringAreas, meteringRectangleList.size());
        List<Camera.Area> meteringAreaList = new ArrayList<>(countMeteringAreas);

        for (int i = 0; i < countMeteringAreas; ++i) {
            MeteringRectangle rect = meteringRectangleList.get(i);

            ParameterUtils.MeteringData meteringData =
                    ParameterUtils.convertMeteringRectangleToLegacy(activeArray, rect, zoomData);
            meteringAreaList.add(meteringData.meteringArea);
        }

        if (maxNumMeteringAreas < meteringRectangleList.size()) {
            Log.w(TAG,
                    "convertMeteringRegionsToLegacy - Too many requested " + regionName +
                            " regions, ignoring all beyond the first " + maxNumMeteringAreas);
        }

        if (DEBUG) {
            Log.v(TAG, "convertMeteringRegionsToLegacy - " + regionName + " areas = "
                    + ParameterUtils.stringFromAreaList(meteringAreaList));
        }

        return meteringAreaList;
    }

    private static void mapAeAndFlashMode(CaptureRequest r, /*out*/Parameters p) {
        int flashMode = ParamsUtils.getOrDefault(r, FLASH_MODE, FLASH_MODE_OFF);
        int aeMode = ParamsUtils.getOrDefault(r, CONTROL_AE_MODE, CONTROL_AE_MODE_ON);

        List<String> supportedFlashModes = p.getSupportedFlashModes();

        String flashModeSetting = null;

        // Flash is OFF by default, on cameras that support flash
        if (ListUtils.listContains(supportedFlashModes, Parameters.FLASH_MODE_OFF)) {
            flashModeSetting = Parameters.FLASH_MODE_OFF;
        }

        /*
         * Map all of the control.aeMode* enums, but ignore AE_MODE_OFF since we never support it
         */

        // Ignore flash.mode controls unless aeMode == ON
        if (aeMode == CONTROL_AE_MODE_ON) {
            if (flashMode == FLASH_MODE_TORCH) {
                    if (ListUtils.listContains(supportedFlashModes, Parameters.FLASH_MODE_TORCH)) {
                        flashModeSetting = Parameters.FLASH_MODE_TORCH;
                    } else {
                        Log.w(TAG, "mapAeAndFlashMode - Ignore flash.mode == TORCH;" +
                                "camera does not support it");
                    }
            } else if (flashMode == FLASH_MODE_SINGLE) {
                if (ListUtils.listContains(supportedFlashModes, Parameters.FLASH_MODE_ON)) {
                    flashModeSetting = Parameters.FLASH_MODE_ON;
                } else {
                    Log.w(TAG, "mapAeAndFlashMode - Ignore flash.mode == SINGLE;" +
                            "camera does not support it");
                }
            } else {
                // Use the default FLASH_MODE_OFF
            }
        } else if (aeMode == CONTROL_AE_MODE_ON_ALWAYS_FLASH) {
                if (ListUtils.listContains(supportedFlashModes, Parameters.FLASH_MODE_ON)) {
                    flashModeSetting = Parameters.FLASH_MODE_ON;
                } else {
                    Log.w(TAG, "mapAeAndFlashMode - Ignore control.aeMode == ON_ALWAYS_FLASH;" +
                            "camera does not support it");
                }
        } else if (aeMode == CONTROL_AE_MODE_ON_AUTO_FLASH) {
            if (ListUtils.listContains(supportedFlashModes, Parameters.FLASH_MODE_AUTO)) {
                flashModeSetting = Parameters.FLASH_MODE_AUTO;
            } else {
                Log.w(TAG, "mapAeAndFlashMode - Ignore control.aeMode == ON_AUTO_FLASH;" +
                        "camera does not support it");
            }
        } else if (aeMode == CONTROL_AE_MODE_ON_AUTO_FLASH_REDEYE) {
                if (ListUtils.listContains(supportedFlashModes, Parameters.FLASH_MODE_RED_EYE)) {
                    flashModeSetting = Parameters.FLASH_MODE_RED_EYE;
                } else {
                    Log.w(TAG, "mapAeAndFlashMode - Ignore control.aeMode == ON_AUTO_FLASH_REDEYE;"
                            + "camera does not support it");
                }
        } else {
            // Default to aeMode == ON, flash = OFF
        }

        if (flashModeSetting != null) {
            p.setFlashMode(flashModeSetting);
        }

        if (DEBUG) {
                Log.v(TAG,
                        "mapAeAndFlashMode - set flash.mode (api1) to " + flashModeSetting
                        + ", requested (api2) " + flashMode
                        + ", supported (api1) " + ListUtils.listToString(supportedFlashModes));
        }
    }

    /**
     * Returns null if the anti-banding mode enum is not supported.
     */
    private static String convertAeAntiBandingModeToLegacy(int mode) {
        switch (mode) {
            case CONTROL_AE_ANTIBANDING_MODE_OFF: {
                return Parameters.ANTIBANDING_OFF;
            }
            case CONTROL_AE_ANTIBANDING_MODE_50HZ: {
                return Parameters.ANTIBANDING_50HZ;
            }
            case CONTROL_AE_ANTIBANDING_MODE_60HZ: {
                return Parameters.ANTIBANDING_60HZ;
            }
            case CONTROL_AE_ANTIBANDING_MODE_AUTO: {
                return Parameters.ANTIBANDING_AUTO;
            }
            default: {
                return null;
            }
        }
    }

    private static int[] convertAeFpsRangeToLegacy(Range<Integer> fpsRange) {
        int[] legacyFps = new int[2];
        legacyFps[Parameters.PREVIEW_FPS_MIN_INDEX] = fpsRange.getLower() * 1000;
        legacyFps[Parameters.PREVIEW_FPS_MAX_INDEX] = fpsRange.getUpper() * 1000;
        return legacyFps;
    }

    private static String convertAwbModeToLegacy(int mode) {
        switch (mode) {
            case CONTROL_AWB_MODE_AUTO:
                return Camera.Parameters.WHITE_BALANCE_AUTO;
            case CONTROL_AWB_MODE_INCANDESCENT:
                return Camera.Parameters.WHITE_BALANCE_INCANDESCENT;
            case CONTROL_AWB_MODE_FLUORESCENT:
                return Camera.Parameters.WHITE_BALANCE_FLUORESCENT;
            case CONTROL_AWB_MODE_WARM_FLUORESCENT:
                return Camera.Parameters.WHITE_BALANCE_WARM_FLUORESCENT;
            case CONTROL_AWB_MODE_DAYLIGHT:
                return Camera.Parameters.WHITE_BALANCE_DAYLIGHT;
            case CONTROL_AWB_MODE_CLOUDY_DAYLIGHT:
                return Camera.Parameters.WHITE_BALANCE_CLOUDY_DAYLIGHT;
            case CONTROL_AWB_MODE_TWILIGHT:
                return Camera.Parameters.WHITE_BALANCE_TWILIGHT;
            case CONTROL_AWB_MODE_SHADE:
                return Parameters.WHITE_BALANCE_SHADE;
            default:
                Log.w(TAG, "convertAwbModeToLegacy - unrecognized control.awbMode" + mode);
                return Camera.Parameters.WHITE_BALANCE_AUTO;
        }
    }

    /**
     * Return {@code null} if the value is not supported, otherwise return the retrieved key's
     * value from the request (or the default value if it wasn't set).
     *
     *
If the fetched value in the request is equivalent to {@code allowedValue},
     * then omit the warning (e.g. turning off AF lock on a camera
     * that always has the AF lock turned off is a silent no-op), but still return {@code null}.

     *
     *
Logs a warning to logcat if the key is not supported by api1 camera device.</p.
     */
    private static <T> T getIfSupported(
            CaptureRequest r, CaptureRequest.Key<T> key, T defaultValue, boolean isSupported,
            T allowedValue) {
        T val = ParamsUtils.getOrDefault(r, key, defaultValue);

        if (!isSupported) {
            if (!Objects.equals(val, allowedValue)) {
                Log.w(TAG, key.getName() + " is not supported; ignoring requested value " + val);
            }
            return null;
        }

        return val;
    }
}


text:
printf "{\n  \"max-concurrent-indexers\" : 2,\n   \"dbpath\" : \"data\",\n   \"repos\" : {\n"

#fetch all aws repos
while read repositoryName ; do
    printf "    \"$repositoryName\" : {\n      \"url\" : \"https://git-codecommit.us-east-1.amazonaws.com/v1/repos/$repositoryName\"\n    },\n"
done < <(aws codecommit list-repositories | jq -r '.repositories[]|"\(.repositoryName)"')

#enter any manual repo defs here
printf "    \"LocalFolder\" : {\n     \"url\" : \"file://dummypath\"\n    }\n"

#finish json
printf "    }\n   }\n}\n"


text:
Ember follows the [legacy decorators "stage 1" proposal API](https://github.com/loganfsmyth/babel-plugin-transform-decorators-legacy#why-legacy).
The decorators proposal is currently being redesigned for stage 3, and the
champions have [publicly stated that this is the recommended path forward](https://github.com/tc39/proposal-decorators#how-should-i-use-decorators-in-transpilers-today).


text:
using System;
using System.Collections.Generic;
using RepositoryPatternWeb.Models;
using RepositoryPatternWeb.Repository;
using System.Linq;

namespace RepositoryPatternWeb.Repository
{
    public class PlanetRepository : IPlanetRepository
    {
        public List<Planet> List()
        {
            List<Planet> planetList = new List<Planet>();

            // SqlConnection code would actually go here, this is to keep things simple.
            planetList.Add(new Planet(1, "Mercury", false));
            planetList.Add(new Planet(2, "Venus", true));
            planetList.Add(new Planet(3, "Earth", true));
            planetList.Add(new Planet(4, "Mars", true));
            planetList.Add(new Planet(5, "Jupiter", false));
            planetList.Add(new Planet(6, "Saturn", false));
            planetList.Add(new Planet(7, "Uranus", false));
            planetList.Add(new Planet(8, "Neptune", false));
            planetList.Add(new Planet(9, "Pluto", false));

            return planetList;
        }

        public List<Planet> List(int Id, string filtro1, string filtro2, string filtro3)
        {
            List<Planet> planetList = new List<Planet>();

            // SqlConnection code would actually go here, this is to keep things simple.
            planetList.Add(new Planet(1, "Mercury", false));
            planetList.Add(new Planet(2, "Venus", true));
            planetList.Add(new Planet(3, "Earth", true));
            planetList.Add(new Planet(4, "Mars", true));
            planetList.Add(new Planet(5, "Jupiter", false));
            planetList.Add(new Planet(6, "Saturn", false));
            planetList.Add(new Planet(7, "Uranus", false));
            planetList.Add(new Planet(8, "Neptune", false));
            planetList.Add(new Planet(9, "Pluto", false));

            return planetList;
        }
        public void Delete(int Id)
        {

        }

        public Planet GetById(int Id)
        {
            List<Planet> planetList = new List<Planet>();

            // SqlConnection code would actually go here, this is to keep things simple.
            planetList.Add(new Planet(1, "Mercury", false));
            planetList.Add(new Planet(2, "Venus", true));
            planetList.Add(new Planet(3, "Earth", true));
            planetList.Add(new Planet(4, "Mars", true));
            planetList.Add(new Planet(5, "Jupiter", false));
            planetList.Add(new Planet(6, "Saturn", false));
            planetList.Add(new Planet(7, "Uranus", false));
            planetList.Add(new Planet(8, "Neptune", false));
            planetList.Add(new Planet(9, "Pluto", false));

            return planetList.Where(m => m.Id == Id).FirstOrDefault();
        }

        public void Save(Planet entity)
        {

        }

        public void Update(Planet entity)
        {

        }
    }
}


text:
using UnityEngine;
using UnityEngine.UI;
using System.Collections;

public class PlayerScoreScript : MonoBehaviour
{

	public enum OwningPlayer
	{
		Player1,
		Player2
	}
	public OwningPlayer player;

	private Image playerImage;
	private Text playerScoreText;

	// Use this for initialization
	void Start()
	{

		FindObjects();
		FillInfo();

	}

	// Update is called once per frame
	void Update()
	{

	}

	void FindObjects()
	{

		playerImage = this.GetComponentInChildren<Image>();
		playerScoreText = this.GetComponentInChildren<Text>();

	}

	void FillInfo()
	{

		// set icon
		string imageName = "sprite_icon_p";
		string postfix = "";
		if (player == OwningPlayer.Player1)
		{
			postfix = "1";
		}
		else
		{
			postfix = "2";
		}
		imageName += postfix;
		playerImage.sprite = Resources.Load<Sprite>("Sprites/HUD/Player icons/" + imageName);

		// set score
		string keyName = "scorePlayer";
		keyName += postfix;

		int score = 0;
		if (PlayerPrefs.HasKey(keyName) == true)
		{
			score = PlayerPrefs.GetInt(keyName);
		}
		string scoreText = "";
		scoreText += score;
		playerScoreText.text = scoreText;

	}

}


text:
height:21px;
overflow:hidden;
}

input#topsearchbox {
-moz-border-radius-bottomleft:5px;
-moz-border-radius-topleft:5px;
-webkit-border-bottom-left-radius:5px;
-webkit-border-top-left-radius:5px;
border:0 none;
margin-right:-2px;
width:156px;
padding:3px 0 3px 10px;
}

input#topsearchsubmit {
-moz-border-radius-bottomright:5px;
-moz-border-radius-topright:5px;
-webkit-border-bottom-right-radius:5px;
-webkit-border-top-right-radius:5px;
background-color:#363;
border:0 none;
color:#FFF;
font-weight:700;
width:52px;
padding:2px 3px 2px 0;
}

#other_media {
margin-top:1px;
width:70px;
}

h2.section {
-moz-border-radius:4px;
-webkit-border-radius:4px;
background-color:#555;
color:#FFF;
font-size:14px;
margin-bottom:10px;
padding:6px 10px 3px;
}

h2.sectionmove {
-moz-border-radius:4px;
-webkit-border-radius:4px;
background-color:#827;
color:#FFF;
font-size:14px;
margin-bottom:10px;
padding:6px 10px 3px;
}

h2.sectionblack {
-moz-border-radius:4px;
-webkit-border-radius:4px;
background-color:#000;
color:#FFF;
font-size:14px;
margin-bottom:10px;
padding:6px 10px 3px;
}

h2.sectionblack a:hover {
color:#009830;
}

table.calendar {
font-size:20px;
margin:0 auto 5px;
}

.calendar thead {
border-left:1px solid #000;
}

.calendar tbody {
border-left:1px solid #CCC;
}

.calendar td,.calendar th {
width:30px;
height:30px;
text-align:center;
vertical-align:middle;
color:#000;
}

.calendar td {
border-bottom:1px solid #CCC;
border-right:1px solid #CCC;
font-size:16px;
}

.calendar th {
height:30px;
font-weight:700;
font-size:11px;
color:#FFF;
background-color:#000;
}

.calendar .today.date_has_event {
background-color:#363;
}

.calendar .inactive {
background-color:#CCC;
}

.calendar td.today {
background-color:#666;
color:#FFF;
}

.calendar a:hover {
color:#999;
text-decoration:none;
}

.calendar a.tooltip span {
-webkit-box-shadow:0 2px 12px 1px #333;
display:none;
margin-top:4px;
width:180px;
padding:2px 0;
}

.calendar a.tooltip:hover span {
-webkit-box-shadow:0 2px 12px 1px #333;
background:#fff;
border:1px solid #DDD;
color:#999;
display:none;
position:absolute;
text-align:left;
}

td.date_has_event a.tooltip:hover span {
-moz-border-radius:15px;
-moz-box-shadow:0 2px 12px 1px #333;
-webkit-border-radius:15px;
background:#fff;
border:3px solid #696;
color:#999;
display:block;
position:absolute;
text-align:left;
}

p.header {
border-bottom:1px solid #666;
color:#666;
display:block;
font-size:14px;
margin-bottom:0!important;
padding:0 10px;
}

p.eventname {
border-bottom:0 none;
border-top:1px solid #AAA;
color:#000;
display:block;
font-size:13px;
margin-bottom:0!important;
padding:5px 10px;
}

p.empty {
font-size:6px;
}

p.eventdate {
display:block;
font-size:12px;
margin-bottom:0!important;
padding:0 10px 5px;
}

#content_wide {
padding:0;
}

#fp_section_articles {
width:629px;
}

.ui-tabs-panel {
height:380px;
padding-right:2px;
}

#top_story {
height:410px;
}

.big_horiz {
width:380px;
}

.big_vert {
float:left;
}

#gallery,#gallery li {
overflow:hidden;
}

#top-stories ul.ui-tabs-nav,#top-stories-newsburst-fix ul.ui-tabs-nav {
position:absolute;
padding-left:8px;
top:0;
left:390px;
list-style:none;
border-left:1px dotted #BBB;
}

#gallery .ui-tabs-nav .ui-tabs-nav-item {
font-size:14px;
font-weight:700;
margin:6px 0;
}

#top-stories .ui-tabs-panel,#top-stories-newsburst-fix .ui-tabs-panel {
width:382px;
height:370px;
position:relative;
overflow:hidden;
}

#top_other {
margin-left:0;
margin-right:0;
}

.otltitle {
display:none;
font-size:16px;
font-weight:700;
}

.top_story_image_0 {
padding-right:2px;
margin:0 auto;
}

.ui-tabs-nav .ui-tabs-nav-item {
border:0 none;
float:none;
width:211px;
padding:7px 5px 7px 4px;
}

.ui-tabs-nav .ui-tabs-selected {
-moz-border-radius:5px;
-webkit-border-radius:5px;
background-color:#EFEFEF;
border:1px solid #BBB;
padding:6px 4px 6px 3px;
}

#fp_section_articles img {
border:1px solid #BBB;
margin:0 0 5px;
}

#fp_section_articles .ui-tabs-nav-item img {
float:left;
width:60px;
margin:2px 6px 2px 0;
}

.slider_text {
float:right;
font-size:13px;
width:143px;
}

.ui-tabs-nav-item p {
float:none;
font-size:13px;
}

.clearer {
clear:both;
}

#top-stories,#top-stories-newsburst-fix {
padding-right:239px;
position:relative;
height:370px;
background:#FFF;
border:0 none;
}

#top-stories-newsburst-fix {
margin-top:80px;
}

#ViewPort12 {
float:left;
height:370px;
overflow:hidden;
}

#top_stories_newsburst_fix {
height:440px;
}

#blogs_onlineonly_tabs {
height:300px;
overflow:hidden;
}

.NewsTab {
height:400px;
}

#top_other h2.blog_post {
margin-bottom:3px;
}

h1 p {
font-size:25px;
}

h2 {
margin-bottom:10px;
}

.tabbedcontent,.TopOnlineTab {
height:480px;
overflow:hidden;
}

.fan_box .connect_top {
background-color:#ECEFF5;
border:1px solid #94A3C4;
}

.NewsTab h2 a {
color:#BBB;
}

ul.tab_navigation {
height:30px;
position:absolute;
z-index:2;
}

.ArtsTabs ul.tab_navigation {
width:220px;
}

h2.Mtab1light {
background-color:#827;
color:#FFF;
font-size:14px;
margin-bottom:7px;
padding:6px 10px 3px;
}

.tab_marker {
background-color:#BBB;
height:2px;
margin-bottom:4px;
}

.TopOnlineTabs .tab_wrapper {
height:190px;
margin-bottom:5px;
overflow:hidden;
position:relative;
z-index:1;
}

.TopOnlineTabs .tab_wrapper #TopOnline0,.TopOnlineTabs .tab_wrapper #TopOnline1 {
height:160px;
padding-top:28px;
position:relative;
}

.blog_online_tabs .tab_wrapper {
height:175px;
overflow:hidden;
position:relative;
z-index:1;
}

.blog_online_tabs .tab_wrapper #BlogOnline0,.blog_online_tabs .tab_wrapper #BlogOnline1 {
height:145px;
padding-top:28px;
position:relative;
}

.ArtsTabs .tab_wrapper {
height:292px;
overflow:hidden;
position:relative;
z-index:1;
}

.ArtsTabs .tab_wrapper #movearts0,.ArtsTabs .tab_wrapper #movearts1 {
height:264px;
padding-top:28px;
position:relative;
}

.ArtsTabs .tab_wrapper #movearts0 .tab_marker {
margin-left:3px;
margin-right:111px;
}

.ArtsTabs .tab_wrapper #movearts1 .tab_marker {
margin-left:110px;
margin-right:3px;
}

h3.move a {
color:#827;
}

span.section_description {
color:#999;
font-size:12px;
font-weight:400;
padding-left:10px;
}

a.move {
color:#906;
}

#fp_calendar {
padding:0 0 10px 10px;
}

#fp_section_more_articles {
border-right:1px dotted #777;
padding-right:10px;
}

#Mtab1,#Mtab2 {
width:150px;
}

#Mtab1light,#Mtab2light {
float:left;
width:110px;
}

h2.Mtab1,h2.Mtab1light {
-moz-border-radius-bottomleft:4px;
-moz-border-radius-topleft:4px;
-webkit-border-bottom-left-radius:4px;
-webkit-border-top-left-radius:4px;
border-right:1px solid #FFF;
padding-right:9px;
}

h2.Mtab2,h2.Mtab2light {
-moz-border-radius-bottomright:4px;
-moz-border-radius-topright:4px;
-webkit-border-bottom-right-radius:4px;
-webkit-border-top-right-radius:4px;
padding-right:10px;
}

.Mtabpassive h2 {
background-color:#EFEFEF;
border:1px solid #BBB;
width:129px;
padding:5px 9px 2px;
}

.Mtablightpassive h2 {
background-color:#EFEFEF;
border:1px solid #BBB;
width:89px;
padding:5px 9px 2px;
}

p.tweet {
margin-bottom:10px!important;
}

span.tweet_text {
font-size:11px;
}

span.tweet_info {
color:#666;
font-size:10px;
}

#news_burst_container {
-moz-border-radius:10px;
-webkit-border-radius:10px;
background-color:#9A0001;
margin-top:10px;
color:#FFF;
font-size:19px;
display:table-cell;
vertical-align:middle;
padding:0;
}

#news_burst_label {
color:#FFF;
font-size:17px;
padding:5px 0 0 10px;
}

#news_burst_content {
-moz-border-radius:10px;
-webkit-border-radius:10px;
background-color:#333;
width:610px;
z-index:2;
margin:0;
padding:5px 0 5px 9px;
}

#news_burst_content ul {
margin-bottom:0;
}

#news_burst_content h1 {
color:#FFF;
font-size:24px;
font-weight:400;
margin-bottom:0;
padding-right:10px;
}

#news_burst_content h1 a {
color:#FFF;
text-decoration:none;
}

#news_burst_content p {
color:#CCC;
margin-bottom:0;
padding-right:10px;
}

#news_burst_content p a:hover {
color:#CCC;
text-decoration:none;
}

#fp_mam_ad {
margin-top:0;
padding-top:5px;
}

#top_other p.top_online {
color:#777;
font-size:11px;
font-weight:700;
margin-bottom:5px;
padding-left:1px;
}

#sitemap {
background-color:#333;
padding:15px 15px 10px 10px;
}

#sitemap_header {
padding-bottom:20px;
}

#sitemap ul.inline {
margin-bottom:5px;
}

#sitemap h1 {
color:#FFF;
display:inline;
font-size:24px;
padding-right:10px;
}

#sitemap h2 {
color:#FFF;
display:inline;
}

#sitemap h2.heading {
border-bottom:1px dotted #FFF;
display:block;
}

#sitemap h4 {
padding-left:15px;
}

#sitemap img {
color:#009830;
font-size:33px;
font-weight:700;
}

#slogan {
margin-top:20px;
}

#footer li.first {
display:block;
}

h2.section a,h2.sectionmove a,h2.sectionblack a,.calendar tdrefresh_apache-.date_has_event,.calendar td.today a,.tab_navigation h2 a,.tab_navigation h2 a:hover,#news_burst_content p a,#sitemap h3,#sitemap h3 a:hover {
color:#FFF;
}

h2.section a:hover,h2.sectionmove a:hover,#news_burst_content h1 a:hover,#sitemap h3 a,#sitemap h4 a:hover {
color:#CCC;
}

.listedevent,#top-stories .ui-tabs-hide,#top-stories-newsburst-fix .ui-tabs-hide,#footer li {
display:none;
}

.calendar td.date_has_event,.calendar td.date_has_event a {
color:#363;
}

.calendar td.date_has_event a:hover,h2.title a,.ui-tabs-nav-item a:hover,h3.move a:hover,#sitemap h4 a {
color:#999;
}

.calendar a,h2.title a:hover,.ui-tabs-nav-item a,.NewsTab h2 a:hover {
color:#000;
}

#WideDiv12,#top_stories {
height:370px;
overflow:hidden;
}

p,#top_other,#top_other h2,#top_other p,#fp_mam_ad p {
font-size:12px;
}

.top_article_cdeck p,h3,h3 p {
font-size:13px;
}

h2.title,#sitemap ul {
margin-bottom:15px;
}

.TopOnlineTabs ul.tab_navigation,.blog_online_tabs ul.tab_navigation {
width:300px;
}

h2.Mtab1,h2.Mtab2,h2.Mtab2light {
background-color:#555;
color:#FFF;
font-size:14px;
margin-bottom:7px;
padding:6px 10px 3px;
}

.TopOnlineTabs .tab_wrapper #TopOnline0 .tab_marker,.blog_online_tabs .tab_wrapper #BlogOnline0 .tab_marker {
margin-left:3px;
margin-right:151px;
}

.TopOnlineTabs .tab_wrapper #TopOnline1 .tab_marker,.blog_online_tabs .tab_wrapper #BlogOnline1 .tab_marker {
margin-left:150px;
margin-right:3px;
}

.Mtabpassive h2 a,.Mtablightpassive h2 a {
color:#777;
}

.Mtabpassive h2 a:hover,.Mtablightpassive h2 a:hover {
color:#AAA;
}


text:
package com.wuyu.plugin.qiniu.auth;

/**
 * organization www.wuyushuo.com
 * created on 2016/02/05 by elon su
 * email addr (</>git_wuyu@163.com)
 * @version 1.0.0
 */
public interface AuthKey {

    public String getAccessKey();

    public String getSecretKey();

}


text:
<?php

class GuideController extends CController
{
	public $defaultAction='view';
	public $languageNames=array(
		'de'=>'German',
		'en'=>'English',
		'es'=>'Spanish',
		'fr'=>'French',
		'he'=>'Hebrew',
		'hu'=>'Hungarian',
		'id'=>'Indonesian',
		'it'=>'Italian',
		'nl'=>'Dutch',
		'no'=>'Norwegian',
		'ja'=>'Japanese',
		'pl'=>'Polish',
		'pt'=>'Portuguese',
		'pt_br'=>'Portuguese (Brazilian)',
		'ru'=>'Russian',
		'sv'=>'Swedish',
		'ta_in'=>'Tamil',
		'vi'=>'Vietnamese',
		'uk' => 'Ukrainian',
		'zh_cn'=>'Simplified Chinese',
		'zh_tw'=>'Traditional Chinese',
	);
	private $_languages;
	private $_language;
	private $_topics;

	public function actionView()
	{
		$topic=$this->getTopic();
		$file=Yii::getPathOfAlias("docs.guide.{$this->language}").DIRECTORY_SEPARATOR.$topic.'.txt';

		if(!is_file($file))
			$file=Yii::getPathOfAlias("docs.guide").DIRECTORY_SEPARATOR.$topic.'.txt';

		if(!strcasecmp($topic,'toc') || !is_file($file))
			throw new CHttpException(404,'The page you looked for does not exist.');

		$content=file_get_contents($file);
		$markdown=new MarkdownParser;
		$content=$markdown->safeTransform($content);

		$imageUrl=Yii::app()->baseUrl.'/guide/images';
		$content=preg_replace('/
\s*\s*<\/p>/',
			"

\\3

",$content);

		$content=preg_replace_callback('/href="\/doc\/guide\/(.*?)\/?"/',array($this,'replaceGuideLink'),$content);
		$content=preg_replace('/href="(\/doc\/api\/.*?)"/','href="https://www.yiiframework.com$1"',$content);

		$this->pageTitle='The Definitive Guide to Yii';
		if($topic!=='index' && preg_match('/
]*>(.*?)</',$content,$matches))
			$this->pageTitle.=' - '.CHtml::encode($matches[1]);

		$this->render('view',array('content'=>$content));
	}

	public function replaceGuideLink($matches)
	{
		if(($pos=strpos($matches[1],'#'))!==false)
		{
			$anchor=substr($matches[1],$pos);
			$matches[1]=substr($matches[1],0,$pos);
		}
		else
			$anchor='';
		return 'href="'.$this->createUrl('view',array('lang'=>$this->language,'page'=>$matches[1])).$anchor.'"';
	}

	public function getTopic()
	{
		if(!isset($_GET['page']) || empty($_GET['page']))
			return 'index';
		else
			return str_replace(array('/','\\'),'',trim($_GET['page']));
	}

	public function getTopics()
	{
		if($this->_topics===null)
		{
			$file=Yii::getPathOfAlias("docs.guide.{$this->language}.toc").'.txt';
			if(!is_file($file))
				$file=Yii::getPathOfAlias('docs.guide.toc').'.txt';
			$lines=file($file);
			$chapter='';
			foreach($lines as $line)
			{
				if(($line=trim($line))==='')
					continue;
				if($line[0]==='*')
					$chapter=trim($line,'* ');
				else if($line[0]==='-' && preg_match('/\[(.*?)\]\((.*?)\)/',$line,$matches))
					$this->_topics[$chapter][$matches[2]]=$matches[1];
			}
		}
		return $this->_topics;
	}

	public function getLanguage()
	{
		if($this->_language===null)
		{
			if(isset($_GET['lang']) && preg_match('/^[a-z_]+$/',$_GET['lang']))
				$this->_language=$_GET['lang'];
			else
				$this->_language='en';
		}
		return $this->_language;
	}

	public function getLanguages()
	{
		if($this->_languages===null)
		{
			$basePath=Yii::getPathOfAlias('docs.guide');
			$dir=opendir($basePath);
			$this->_languages=array('en'=>'English');
			while(($file=readdir($dir))!==false)
			{
				if(!is_dir($basePath.DIRECTORY_SEPARATOR.$file) || $file==='.' || $file==='..' || $file==='source')
					continue;
				if(isset($this->languageNames[$file]))
					$this->_languages[$file]=$this->languageNames[$file];
			}
			ksort($this->_languages);
		}
		return $this->_languages;
	}
}


text:
ACCEPTED

#### According to
Index Fungorum

#### Published in
null

#### Original name
Pannaria brasiliensis Zahlbr.

### Remarks
null


text:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <parent>
        <groupId>org.javaee7.ejb</groupId>
        <artifactId>ejb-samples</artifactId>
        <version>1.0-SNAPSHOT</version>
        <relativePath>../pom.xml</relativePath>
    </parent>

    <groupId>org.javaee7.ejb</groupId>
    <artifactId>embeddable</artifactId>
    <version>1.0-SNAPSHOT</version>
    <packaging>war</packaging>

    <dependencies>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.10</version>
            <scope>test</scope>
            <type>jar</type>
        </dependency>
    </dependencies>

</project>