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

#include "chrome/browser/ui/app_list/search/files/file_result.h"

#include <string>
#include <utility>
#include <vector>

#include "ash/constants/ash_features.h"
#include "ash/public/cpp/app_list/app_list_config.h"
#include "ash/public/cpp/app_list/app_list_types.h"
#include "ash/public/cpp/style/color_provider.h"
#include "base/bind.h"
#include "base/files/file.h"
#include "base/files/file_path.h"
#include "base/files/file_util.h"
#include "base/logging.h"
#include "base/metrics/histogram_functions.h"
#include "base/metrics/histogram_macros.h"
#include "base/no_destructor.h"
#include "base/strings/string_util.h"
#include "base/strings/utf_string_conversions.h"
#include "base/task/task_traits.h"
#include "base/task/thread_pool.h"
#include "base/threading/scoped_blocking_call.h"
#include "chrome/browser/platform_util.h"
#include "chrome/browser/ui/app_list/search/common/icon_constants.h"
#include "chrome/browser/ui/app_list/search/files/justifications.h"
#include "chrome/browser/ui/app_list/search/search_tags_util.h"
#include "chrome/browser/ui/ash/thumbnail_loader.h"
#include "chromeos/components/string_matching/tokenized_string_match.h"
#include "chromeos/ui/base/file_icon_util.h"
#include "third_party/skia/include/core/SkBitmap.h"
#include "ui/gfx/geometry/size.h"
#include "ui/gfx/image/image_skia.h"

namespace app_list {

namespace {

using chromeos::string_matching::TokenizedString;
using chromeos::string_matching::TokenizedStringMatch;

// The maximum penalty applied to a relevance by PenalizeRelevanceByAccessTime,
// which will multiply the relevance by a number in [`kMaxPenalty`, 1].
constexpr double kMaxPenalty = 0.6;

// The steepness of the penalty curve of PenalizeRelevanceByAccessTime. Larger
// values make the penalty increase faster as the last access time of the file
// increases. A value of 0.0029 results in a penalty multiplier of ~0.63 for a 1
// month old file.
constexpr double kPenaltyCoeff = 0.0029;

constexpr int64_t kMillisPerDay = 1000 * 60 * 60 * 24;

std::string StripHostedFileExtensions(const std::string& filename) {
  static const base::NoDestructor<std::vector<std::string>> hosted_extensions(
      {".GDOC", ".GSHEET", ".GSLIDES", ".GDRAW", ".GTABLE", ".GLINK", ".GFORM",
       ".GMAPS", ".GSITE"});

  for (const auto& extension : *hosted_extensions) {
    if (EndsWith(filename, extension, base::CompareCase::INSENSITIVE_ASCII)) {
      return filename.substr(0, filename.size() - extension.size());
    }
  }

  return filename;
}

void LogRelevance(ChromeSearchResult::ResultType result_type,
                  const double relevance) {
  // Relevance scores are between 0 and 1, so we scale to 0 to 100 for logging.
  DCHECK((relevance >= 0) && (relevance <= 1));
  const int scaled_relevance = floor(100 * relevance);
  switch (result_type) {
    case FileResult::ResultType::kFileSearch:
      UMA_HISTOGRAM_EXACT_LINEAR("Apps.AppList.FileSearchProvider.Relevance",
                                 scaled_relevance, /*exclusive_max=*/101);
      break;
    case FileResult::ResultType::kDriveSearch:
      UMA_HISTOGRAM_EXACT_LINEAR("Apps.AppList.DriveSearchProvider.Relevance",
                                 scaled_relevance, /*exclusive_max=*/101);
      break;
    case FileResult::ResultType::kZeroStateFile:
      UMA_HISTOGRAM_EXACT_LINEAR("Apps.AppList.ZeroStateFileProvider.Relevance",
                                 scaled_relevance, /*exclusive_max=*/101);
      break;
    case FileResult::ResultType::kZeroStateDrive:
      UMA_HISTOGRAM_EXACT_LINEAR(
          "Apps.AppList.ZeroStateDriveProvider.Relevance", scaled_relevance,
          /*exclusive_max=*/101);
      break;
    default:
      NOTREACHED();
  }
}

absl::optional<base::File::Info> GetFileInfo(const base::FilePath& path) {
  base::ScopedBlockingCall scoped_blocking_call(FROM_HERE,
                                                base::BlockingType::MAY_BLOCK);
  base::File::Info info;
  if (!base::GetFileInfo(path, &info))
    return absl::nullopt;
  return info;
}

}  // namespace

FileResult::FileResult(const std::string& schema,
                       const base::FilePath& filepath,
                       const absl::optional<std::u16string>& details,
                       ResultType result_type,
                       DisplayType display_type,
                       float relevance,
                       const std::u16string& query,
                       Type type,
                       Profile* profile)
    : filepath_(filepath), type_(type), profile_(profile) {
  DCHECK(profile);
  set_id(schema + filepath.value());
  SetCategory(Category::kFiles);
  SetDisplayType(display_type);

  set_relevance(relevance);
  if (display_type == DisplayType::kList) {
    // Chip and list results overlap, and only list results are fully launched.
    // So we only log metrics for list results.
    LogRelevance(result_type, relevance);
  }

  SetResultType(result_type);
  switch (result_type) {
    case ResultType::kDriveChip:
    case ResultType::kZeroStateDrive:
      SetMetricsType(ash::ZERO_STATE_DRIVE);
      break;
    case ResultType::kFileChip:
    case ResultType::kZeroStateFile:
      SetMetricsType(ash::ZERO_STATE_FILE);
      break;
    case ResultType::kFileSearch:
      SetMetricsType(ash::FILE_SEARCH);
      break;
    case ResultType::kDriveSearch:
      SetMetricsType(ash::DRIVE_SEARCH);
      break;
    default:
      NOTREACHED();
  }

  SetTitle(base::UTF8ToUTF16(
      StripHostedFileExtensions(filepath.BaseName().value())));
  SetTitleTags(CalculateTags(query, title()));

  if (details)
    SetDetails(details.value());

  // Launcher search results UI is light by default, so use icons for light
  // background if dark/light mode feature is not enabled. Productivity launcher
  // has dark background by default, so use icons for dark background in that
  // case.
  const bool dark_background =
      ash::features::IsDarkLightModeEnabled()
          ? ash::ColorProvider::Get()->IsDarkModeEnabled()
          : ash::features::IsProductivityLauncherEnabled();
  if (display_type == DisplayType::kChip) {
    SetChipIcon(chromeos::GetChipIconForPath(filepath, dark_background));
  } else if (display_type == DisplayType::kContinue) {
    // For Continue Section, if dark/light mode is disabled, we should use the
    // icon and not the chip icon with a dark background as default.
    const gfx::ImageSkia chip_icon =
        ash::features::IsDarkLightModeEnabled()
            ? chromeos::GetChipIconForPath(filepath, dark_background)
            : chromeos::GetIconForPath(filepath, /*dark_background=*/true);
    SetChipIcon(chip_icon);
  } else {
    switch (type) {
      case Type::kFile:
        SetIcon(IconInfo(chromeos::GetIconForPath(filepath, dark_background),
                         kSystemIconDimension));
        break;
      case Type::kDirectory:
        SetIcon(IconInfo(chromeos::GetIconFromType("folder", dark_background),
                         kSystemIconDimension));
        break;
      case Type::kSharedDirectory:
        SetIcon(IconInfo(chromeos::GetIconFromType("shared", dark_background),
                         kSystemIconDimension));
        break;
    }
  }
}

FileResult::~FileResult() = default;

void FileResult::Open(int event_flags) {
  switch (type_) {
    case Type::kFile:
      platform_util::OpenItem(profile_, filepath_,
                              platform_util::OpenItemType::OPEN_FILE,
                              platform_util::OpenOperationCallback());
      break;
    case Type::kDirectory:
    case Type::kSharedDirectory:
      platform_util::OpenItem(profile_, filepath_,
                              platform_util::OpenItemType::OPEN_FOLDER,
                              platform_util::OpenOperationCallback());
      break;
  }
}

absl::optional<std::string> FileResult::DriveId() const {
  return drive_id_;
}

// static
double FileResult::CalculateRelevance(
    const absl::optional<TokenizedString>& query,
    const base::FilePath& filepath) {
  const std::u16string raw_title =
      base::UTF8ToUTF16(StripHostedFileExtensions(filepath.BaseName().value()));
  const TokenizedString title(raw_title, TokenizedString::Mode::kWords);

  const bool use_default_relevance =
      !query || query.value().text().empty() || title.text().empty();
  UMA_HISTOGRAM_BOOLEAN("Apps.AppList.FileResult.DefaultRelevanceUsed",
                        use_default_relevance);
  if (use_default_relevance) {
    static constexpr double kDefaultRelevance = 0.5;
    return kDefaultRelevance;
  }

  TokenizedStringMatch match;
  match.Calculate(query.value(), title);
  return match.relevance();
}

void FileResult::RequestThumbnail(ash::ThumbnailLoader* thumbnail_loader) {
  // Thumbnails are only available for list results.
  DCHECK_EQ(display_type(), DisplayType::kList);

  // Request a thumbnail for all file types. For unsupported types, this will
  // just call OnThumbnailLoaded with an error.
  const gfx::Size size = gfx::Size(kThumbnailDimension, kThumbnailDimension);
  thumbnail_loader->Load({filepath_, size},
                         base::BindOnce(&FileResult::OnThumbnailLoaded,
                                        weak_factory_.GetWeakPtr()));
}

void FileResult::OnThumbnailLoaded(const SkBitmap* bitmap,
                                   base::File::Error error) {
  if (!bitmap) {
    DCHECK_NE(error, base::File::Error::FILE_OK);
    base::UmaHistogramExactLinear(
        "Apps.AppList.FileResult.ThumbnailLoadedError", -error,
        -base::File::FILE_ERROR_MAX);
    return;
  }

  DCHECK_EQ(error, base::File::Error::FILE_OK);

  const int dimension = kThumbnailDimension;
  const auto image = gfx::ImageSkia::CreateFromBitmap(*bitmap, 1.0f);

  SetIcon(ChromeSearchResult::IconInfo(image, dimension,
                                       ash::SearchResultIconShape::kCircle));
}

void FileResult::PenalizeRelevanceByAccessTime() {
  base::ThreadPool::PostTaskAndReplyWithResult(
      FROM_HERE, {base::MayBlock(), base::TaskPriority::USER_BLOCKING},
      base::BindOnce(&GetFileInfo, filepath_),
      base::BindOnce(&FileResult::OnFileInfoReturned,
                     weak_factory_.GetWeakPtr()));
}

void FileResult::OnFileInfoReturned(
    const absl::optional<base::File::Info>& info) {
  // Do not penalize relevance if we can't stat the file.
  if (!info) {
    return;
  }

  // Apply a gaussian penalty based on the time delta. `time_delta` is converted
  // into millisecond fractions of a day for numerical stability.
  double time_delta =
      static_cast<double>(
          (base::Time::Now() - info->last_accessed).InMilliseconds()) /
      kMillisPerDay;
  double penalty =
      kMaxPenalty +
      (1.0 - kMaxPenalty) * std::exp(-kPenaltyCoeff * time_delta * time_delta);
  DCHECK((penalty > 0.0) && (penalty <= 1.0));
  set_relevance(relevance() * penalty);
}

void FileResult::SetDetailsToJustificationString() {
  GetJustificationStringAsync(
      filepath_, base::BindOnce(&FileResult::OnJustificationStringReturned,
                                weak_factory_.GetWeakPtr()));
}

void FileResult::OnJustificationStringReturned(
    absl::optional<std::u16string> justification) {
  if (justification)
    SetDetails(justification.value());
}

::std::ostream& operator<<(::std::ostream& os, const FileResult& result) {
  return os << "{" << result.title() << ", " << result.relevance() << "}";
}

}  // namespace app_list


text:
"""Constants related to the Azure auth method and/or secrets engine."""

VALID_ENVIRONMENTS = [
    "AzurePublicCloud",
    "AzureUSGovernmentCloud",
    "AzureChinaCloud",
    "AzureGermanCloud",
]

redpajama_set_name: RedPajamaGithub


text:
* {padding: 0; margin: 0;}
svg {position: absolute; top: 0; right: 0; bottom: 0; left: 0; margin: auto; border: 1px solid #dfdfdf;}
path {stroke-dasharray: 2200; stroke-dashoffset: 2200; transition: stroke-dashoffset 3s;}
svg:hover path {stroke-dashoffset: 0;}

.text {width: 40px; height: 15px; position: absolute; top: 0; right: 0; bottom: 0; left: 0; margin: auto; font-size: 14px; text-align: center; padding-bottom: 4px; color: #333;}


text:
RequireScript("euphoria/classes/BaseClass.js");

function DebuggerClass() {
	var me = this;

	me.superClass = BaseClass;
	me.superClass();

	me.logObject = null;
	me.callStackObject = null;
	me.numberOfSpaces = 0;
	me.currentFunction = null;

	me.getLatestOpenFunction = function()
	{
		if (me.currentFunction === null)
			return null;

		return (function _getLatestOpenFunction(openFn){
			if (openFn.fn !== undefined && openFn.fn !== null)
			{
				return _getLatestOpenFunction(openFn.fn);
			}
			else
				return openFn;
		})(me.currentFunction);
	};

	me.getOpenFunctionByCallId = function(callId)
	{
		if (me.currentFunction === null)
			return null;

		return (function _getLatestOpenFunction(openFn){
			if (openFn.fn !== undefined && openFn.fn !== null)
			{
				if (openFn.fn.id === callId)
				{
					return openFn.fn;
				}

				return _getLatestOpenFunction(openFn.fn);
			}
		})(me.currentFunction);
	};

	me.log = function(message)
	{
		if (euphoria.generateLog)
		{
			if (me.logObject === null)
				me.logObject = OpenLog("log");

			me.logObject.write(message);
		}
	};

	me.logCallStack = function(message)
	{
		if (euphoria.generateCallStackFile)
		{
			if (me.callStackObject === null)
				me.callStackObject = OpenLog("callStack");

			if (me.numberOfSpaces > 0)
				message = message.pad(' ', me.numberOfSpaces);

			me.callStackObject.write(message);
		}
	};

	me.startedFunction = function(functionName, isCommonFunction)
	{
		if (isCommonFunction && !euphoria.generateCallStackOnLoops)
			return false;

		me.logCallStack('BEGIN ' + functionName);

		var openFn = me.getLatestOpenFunction();
		if (openFn === null)
		{
			me.currentFunction = {
				name : 'main',
				id : 0
			};
			openFn = me.currentFunction;
		}

		openFn.fn = {
			name : functionName,
			id : Math.random(),
			parent : openFn
		};

		me.numberOfSpaces++;

		return openFn.fn.id;
	};

	me.endFunction = function(callId, returnValue)
	{
		if (callId !== false)
		{
			var openFn = me.getOpenFunctionByCallId(callId);
			if (openFn)
			{
				me._returnFunction(openFn.name, returnValue);
			}

			openFn.parent.fn = undefined;
		}

		return returnValue;
	};

	me._returnFunction = function(functionName, returnValue)
	{
		var returnString = '';
		if (returnValue !== undefined)
		{
			returnString = ' RETURN ' + returnValue;
		}

		me.numberOfSpaces--;
		me.logCallStack('END   ' + functionName + returnString);

		return returnValue;
	};

	me.instantiate = function(functionName)
	{
		me.logCallStack('NEW   ' + functionName);
	};

	me.saveCallStack = function(errorMessage)
	{
		if (me.currentFunction === null || me.currentFunction === undefined)
			return;

		var numberOfSpaces = 0;
		(function _saveCallStack(fn){
			if (fn === null || fn === undefined)
				return;

			var message = '';

			if (fn.id > 0)
			{
				message = 'BEGIN ' + fn.name;
				me.log(message.pad(' ', numberOfSpaces));
				numberOfSpaces += 2;
			}

			if (fn.fn !== undefined && fn.fn !== null)
			{
				_saveCallStack(fn.fn, errorMessage);
			}
			else
			{
				me.log(errorMessage.pad(' ', numberOfSpaces));
			}

			if (fn.id > 0)
			{
				numberOfSpaces -= 2;
				message = 'END   ' + fn.name;
				me.log(message.pad(' ', numberOfSpaces));
			}
		})(me.currentFunction);
	};

	me.logArray = function(arrayObj)
	{
		for(var i = 0; i < arrayObj.length; i++)
		{
			if (typeof(arrayObj[i]) == 'object')
			{
				me.logObject(arrayObj[i]);
			}
			else
			{
				me.log(i + ': ' + arrayObj[i]);
			}
		}
	};

	me.logObjectInstance = function(obj)
	{
		if (obj.length !== undefined && obj.indexOf !== undefined)
		{
			me.logArray(obj);
		}
		else
		{
			for (var key in obj)
			{
				if (typeof(obj[key]) == 'object')
				{
					me.logObject(obj[key]);
				}
				else
					me.log(key + ': ' + obj[key]);
			}
		}
	};

	me.throwError = function(error)
	{
		me.saveCallStack('Exception: ' + error);
		throw error;
	};
}


text:
package org.apache.maven.plugins.enforcer;

import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.jar.JarEntry;
import java.util.jar.JarFile;
import java.util.regex.Pattern;

import org.apache.maven.artifact.Artifact;
import org.apache.maven.enforcer.rule.api.EnforcerRuleException;
import org.codehaus.plexus.util.FileUtils;

/**
 * Bans duplicate classes on the classpath.
 */
public class BanDuplicateClasses
    extends AbstractResolveDependencies
{

    /**
     * The failure message
     */
    private String message;

    /**
     * List of classes to ignore. Wildcard at the end accepted
     */
    private String[] ignoreClasses;

    /**
     * If {@code false} then the rule will fail at the first duplicate, if {@code true} then the rule will fail at
     * the end.
     */
    private boolean findAllDuplicates;

    private List<Dependency> dependencies;

    /**
     * Only verify dependencies with one of these scopes
     */
    private List<String> scopes;

    @Override
    protected void handleArtifacts( Set<Artifact> artifacts ) throws EnforcerRuleException
    {
        List<IgnorableDependency> ignorableDependencies = new ArrayList<IgnorableDependency>();
        if ( ignoreClasses != null )
        {
            IgnorableDependency ignorableDependency = new IgnorableDependency();
            ignorableDependency.applyIgnoreClasses( ignoreClasses, false );
            ignorableDependencies.add( ignorableDependency );
        }
        if ( dependencies != null )
        {
            for ( Dependency dependency : dependencies )
            {
                getLog().info( "Adding ignorable dependency: " + dependency );
                IgnorableDependency ignorableDependency = new IgnorableDependency();
                if ( dependency.getGroupId() != null )
                {
                    ignorableDependency.groupId = Pattern.compile( asRegex( dependency.getGroupId() ) );
                }
                if ( dependency.getArtifactId() != null )
                {
                    ignorableDependency.artifactId = Pattern.compile( asRegex( dependency.getArtifactId() ) );
                }
                if ( dependency.getType() != null )
                {
                    ignorableDependency.type = Pattern.compile( asRegex( dependency.getType() ) );
                }
                if ( dependency.getClassifier() != null )
                {
                    ignorableDependency.classifier = Pattern.compile( asRegex( dependency.getClassifier() ) );
                }
                ignorableDependency.applyIgnoreClasses( dependency.getIgnoreClasses(), true );
                ignorableDependencies.add( ignorableDependency );
            }
        }

        Map<String, Artifact> classNames = new HashMap<String, Artifact>();
        Map<String, Set<Artifact>> duplicates = new HashMap<String, Set<Artifact>>();
        for ( Artifact o : artifacts )
        {
            if( scopes != null && !scopes.contains( o.getScope() ) )
            {
                if( getLog().isDebugEnabled() )
                {
                    getLog().debug( "Skipping " + o.toString() + " due to scope" );
                }
                continue;
            }
            File file = o.getFile();
            getLog().debug( "Searching for duplicate classes in " + file );
            if ( file == null || !file.exists() )
            {
                getLog().warn( "Could not find " + o + " at " + file );
            }
            else if ( file.isDirectory() )
            {
                try
                {
                    for ( String name : (List<String>) FileUtils.getFileNames( file, null, null, false ) )
                    {
                        getLog().debug( "  " + name );
                        checkAndAddName( o, name, classNames, duplicates, ignorableDependencies );
                    }
                }
                catch ( IOException e )
                {
                    throw new EnforcerRuleException(
                        "Unable to process dependency " + o.toString() + " due to " + e.getLocalizedMessage(), e );
                }
            }
            else if ( file.isFile() && "jar".equals( o.getType() ) )
            {
                try
                {
                    //@todo use UnArchiver as defined per type
                    JarFile jar = new JarFile( file );
                    try
                    {
                        for ( JarEntry entry : Collections.<JarEntry>list( jar.entries() ) )
                        {
                            checkAndAddName( o, entry.getName(), classNames, duplicates, ignorableDependencies );
                        }
                    }
                    finally
                    {
                        try
                        {
                            jar.close();
                        }
                        catch ( IOException e )
                        {
                            // ignore
                        }
                    }
                }
                catch ( IOException e )
                {
                    throw new EnforcerRuleException(
                        "Unable to process dependency " + o.toString() + " due to " + e.getLocalizedMessage(), e );
                }
            }
        }
        if ( !duplicates.isEmpty() )
        {
            Map<Set<Artifact>, List<String>> inverted = new HashMap<Set<Artifact>, List<String>>();
            for ( Map.Entry<String, Set<Artifact>> entry : duplicates.entrySet() )
            {
                List<String> s = inverted.get( entry.getValue() );
                if ( s == null )
                {
                    s = new ArrayList<String>();
                }
                s.add( entry.getKey() );
                inverted.put( entry.getValue(), s );
            }
            StringBuilder buf = new StringBuilder( message == null ? "Duplicate classes found:" : message );
            buf.append( '\n' );
            for ( Map.Entry<Set<Artifact>, List<String>> entry : inverted.entrySet() )
            {
                buf.append( "\n  Found in:" );
                for ( Artifact a : entry.getKey() )
                {
                    buf.append( "\n    " );
                    buf.append( a );
                }
                buf.append( "\n  Duplicate classes:" );
                for ( String className : entry.getValue() )
                {
                    buf.append( "\n    " );
                    buf.append( className );
                }
                buf.append( '\n' );
            }
            throw new EnforcerRuleException( buf.toString() );
        }

    }

    private void checkAndAddName( Artifact artifact, String name, Map<String, Artifact> classNames,
                                  Map<String, Set<Artifact>> duplicates, Collection<IgnorableDependency> ignores )
        throws EnforcerRuleException
    {
        if ( !name.endsWith( ".class" ) )
        {
            return;
        }

        for ( IgnorableDependency c : ignores )
        {
            if ( c.matchesArtifact( artifact ) && c.matches( name ) )
            {
                if( classNames.containsKey( name ) )
                {
                    getLog().debug( "Ignoring excluded class " + name );
                }
                return;
            }
        }

        if ( classNames.containsKey( name ) )
        {
            Artifact dup = classNames.put( name, artifact );
            if ( !( findAllDuplicates && duplicates.containsKey( name ) ) )
            {
                for ( IgnorableDependency c : ignores )
                {
                    if ( c.matchesArtifact( artifact ) && c.matches(name) )
                    {
                        getLog().debug( "Ignoring duplicate class " + name );
                        return;
                    }
                }
            }

            if ( findAllDuplicates )
            {
                Set<Artifact> dups = duplicates.get( name );
                if ( dups == null )
                {
                    dups = new LinkedHashSet<Artifact>();
                    dups.add( dup );
                }
                dups.add( artifact );
                duplicates.put( name, dups );
            }
            else
            {
                StringBuilder buf = new StringBuilder( message == null ? "Duplicate class found:" : message );
                buf.append( '\n' );
                buf.append( "\n  Found in:" );
                buf.append( "\n    " );
                buf.append( dup );
                buf.append( "\n    " );
                buf.append( artifact );
                buf.append( "\n  Duplicate classes:" );
                buf.append( "\n    " );
                buf.append( name );
                buf.append( '\n' );
                buf.append( "There may be others but <findAllDuplicates> was set to false, so failing fast" );
                throw new EnforcerRuleException( buf.toString() );
            }
        }
        else
        {
            classNames.put( name, artifact );
        }
    }
}


text:
using System.Management.Automation;

using Microsoft.PowerShell.Commands.Internal.Format;

namespace Microsoft.PowerShell.Commands
{
    /// <summary>
    /// Implementation for the out-printer command.
    /// </summary>
    [Cmdlet(VerbsData.Out, "Printer", HelpUri = "https://go.microsoft.com/fwlink/?LinkID=2109553")]
    public class OutPrinterCommand : FrontEndCommandBase
    {
        /// <summary>
        /// Initializes a new instance of the <see cref="OutPrinterCommand"/> class
        /// and sets the inner command.
        /// </summary>
        public OutPrinterCommand()
        {
            this.implementation = new OutputManagerInner();
        }

        /// <summary>
        /// Optional name of the printer to print to.
        /// The alias allows "lp -P printer".
        /// </summary>
        [Parameter(Position = 0)]
        [Alias("PrinterName")]
        public string Name
        {
            get { return _printerName; }

            set { _printerName = value; }
        }

        private string _printerName;

        /// <summary>
        /// Read command line parameters.
        /// </summary>
        protected override void BeginProcessing()
        {
            // set up the Screen Host interface
            OutputManagerInner outInner = (OutputManagerInner)this.implementation;

            outInner.LineOutput = InstantiateLineOutputInterface();

            // finally call the base class for general hookup
            base.BeginProcessing();
        }

        /// <summary>
        /// One-time initialization: acquire a screen host interface by creating one on top of a memory buffer.
        /// </summary>
        private LineOutput InstantiateLineOutputInterface()
        {
            PrinterLineOutput printOutput = new(_printerName);
            return (LineOutput)printOutput;
        }
    }
}


text:
package org.woehlke.twitterwall.oodm.service.common;

import org.woehlke.twitterwall.oodm.model.common.DomainObjectWithScreenName;

/**
 * Created by tw on 14.07.17.
 */
public interface DomainServiceWithScreenName<T extends DomainObjectWithScreenName> extends DomainService<T> {

    T findByScreenName(String screenName);
}


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

namespace ChronicNetCore.Handlers
{
    public class ORGRHandler : IHandler
    {
        public Span Handle(IList<Token> tokens, Options options)
        {
            var outerSpan = tokens.Skip(2).Take(2).GetAnchor(options);
            return Utils.HandleORR(tokens.Take(2).ToList(), outerSpan, options);
        }
    }
}


text:
using System.Collections.Generic;

namespace MvcBootstrapTable.Config
{
    internal abstract class ConfigBase
    {
        protected ConfigBase()
        {
            CssClasses = new List<string>();
            State = ContextualState.Default;
        }

        public ContextualState State { get; set; }
        public IList<string> CssClasses { get; private set; }
    }
}


text:
'use strict';

var HTTP_METHODS = require('methods'),

    annotations = require('express-annotations'),
    util        = require('util'),

    pathTo = require('./lib/pathto');

exports.extend = extendApp;
exports.pathTo = pathTo;

function extendApp(app) {
    if (app['@map']) { return app; }

    // Add Express Annotations support to the `app`.
    annotations.extend(app);

    // Brand.
    Object.defineProperty(app, '@map', {value: true});

    app.map            = mapRoute;
    app.getRouteMap    = getRouteMap;
    app.getRouteParams = getRouteParams;

    // Sets up registry for simple param handlers that are either regular
    // expressions or basic, non-middleware functions. These param handlers are
    // exposed along with the exposed routes.
    app.params = {};
    app.param(registerParam.bind(app));

    return app;
}

// TODO: Should this accept an object of mappings? If so what should be the key,
// and what should be the value?
function mapRoute(routePath, name) {
    /* jshint validthis:true */
    var annotations = this.annotations[routePath],
        aliases     = ((annotations && annotations.aliases) || []).concat(name);

    name = (annotations && annotations.name) ||
            (Array.isArray(name) ? name[0] : name);

    // Annotate with a singular name (either existing or new), and the unique
    // set of aliases.
    return this.annotate(routePath, {
        name   : name,
        aliases: getUniqueAliases(aliases)
    });
}

function getRouteMap() {
    /* jshint validthis:true */

    var appAnnotations = this.annotations,
        routes;

    // Delegate call to `findAll()` which is provided by express-annotations.
    routes = this.findAll.apply(this, arguments);

    // Creates a mapping of name -> route object. The route objects are shallow
    // copies of a route's primary metadata.
    return HTTP_METHODS.reduce(function (map, method) {
        var methodRoutes = routes[method];

        if (!methodRoutes) { return map; }

        methodRoutes.forEach(function (route) {
            var pathAnnotations = appAnnotations[route.path],
                name            = pathAnnotations.name,
                entry;

            // Return early if the route has no canonical `name`, or if that
            // name has already been mapped, in which case none of its `aliases`
            // will be mapped.
            if (!name || map[name]) { return; }

            // The entry that represents the route in the route map.
            entry = {
                path       : route.path,
                keys       : route.keys,
                regexp     : route.regexp,
                annotations: pathAnnotations
            };

            // Map the route to all of its `aliases` which includes its `name`.
            pathAnnotations.aliases.forEach(function (alias) {
                map[alias] = entry;
            });
        });

        return map;
    }, {});
}

function getRouteParams(routeMap) {
    /* jshint validthis:true, expr:true */
    var params    = this.params,
        paramsMap = {};

    if (!params || !Object.keys(params).length) {
        return paramsMap;
    }

    routeMap || (routeMap = this.getRouteMap());

    // Creates a param -> handler map for the params used in the specified
    // `routeMap` which have handlers.
    return Object.keys(routeMap).reduce(function (map, routeName) {
        var route = routeMap[routeName];

        route.keys.forEach(function (p) {
            var paramName = p.name,
                param     = params[paramName];

            if (param) {
                map[paramName] = param;
            }
        });

        return map;
    }, paramsMap);
}

function registerParam(name, handler) {
    /*jshint validthis:true */

    // This unobtrusive params bookkeeper stores a reference to any param
    // handlers that are regular express or basic, non-middleware functions. It
    // is assumed that the Express Params package is the next param registration
    // function to be called.
    if (util.isRegExp(handler) || handler.length < 3) {
        this.params[name] = handler;
    }
}

// -- Helper Functions ---------------------------------------------------------

function getUniqueAliases(aliases) {
    var aliasesHash = aliases.reduce(function (unique, name) {
        if (name) { unique[name] = true; }
        return unique;
    }, {});

    return Object.keys(aliasesHash);
}


text:
#include <aws/network-firewall/model/ListRuleGroupsResult.h>
#include <aws/core/utils/json/JsonSerializer.h>
#include <aws/core/AmazonWebServiceResult.h>
#include <aws/core/utils/StringUtils.h>
#include <aws/core/utils/UnreferencedParam.h>

#include <utility>

using namespace Aws::NetworkFirewall::Model;
using namespace Aws::Utils::Json;
using namespace Aws::Utils;
using namespace Aws;

ListRuleGroupsResult::ListRuleGroupsResult()
{
}

ListRuleGroupsResult::ListRuleGroupsResult(const Aws::AmazonWebServiceResult<JsonValue>& result)
{
  *this = result;
}

ListRuleGroupsResult& ListRuleGroupsResult::operator =(const Aws::AmazonWebServiceResult<JsonValue>& result)
{
  JsonView jsonValue = result.GetPayload().View();
  if(jsonValue.ValueExists("NextToken"))
  {
    m_nextToken = jsonValue.GetString("NextToken");

  }

  if(jsonValue.ValueExists("RuleGroups"))
  {
    Array<JsonView> ruleGroupsJsonList = jsonValue.GetArray("RuleGroups");
    for(unsigned ruleGroupsIndex = 0; ruleGroupsIndex < ruleGroupsJsonList.GetLength(); ++ruleGroupsIndex)
    {
      m_ruleGroups.push_back(ruleGroupsJsonList[ruleGroupsIndex].AsObject());
    }
  }

  return *this;
}


text:
<?php
class Kwf_Component_Generator_Page_StaticHome extends Kwf_Component_Generator_Page_Static
{
    protected function _init()
    {
        parent::_init();
        if (count($this->_settings['component']) > 1) {
            throw new Kwf_Exception("StaticHome generator must have only a single component");
        }
    }

    protected function _formatSelectHome(Kwf_Component_Select $select)
    {
        return $select;
    }

    public function getGeneratorFlags()
    {
        $ret = parent::getGeneratorFlags();
        $ret['hasHome'] = true;
        return $ret;
    }
}


text:
<?php

namespace Propel\Generator\Behavior\I18n\Component;

use Propel\Generator\Builder\Om\Component\BuildComponent;
use Propel\Generator\Builder\Om\Component\NamingTrait;
use gossi\codegen\model\PhpParameter;
use Propel\Generator\Builder\Om\Component\Object\PropertySetterMethods;
use Propel\Generator\Model\NamingTool;

/**
 * Add setter methods to the entity.
 *
 * @author Cristiano Cinotti <cristianocinotti@gmail.com>
 */
class Setters extends BuildComponent
{
    use NamingTrait;

    public function process()
    {
        $behavior = $this->getBehavior();

        $this->addSetLocale($behavior);
        if ($alias = $behavior->getParameter('locale_alias')) {
            $this->addSetLocaleAlias($alias, $behavior);
        }
        $this->addSetTranslation($behavior);
        $this->addTranslatedColumnSetter($behavior);
    }

    private function addSetLocale($behavior)
    {
        $this->addMethod('set' . NamingTool::toUpperCamelCase($behavior->getLocaleField()->getName()))
            ->setDescription('Sets the locale for translations')
            ->addParameter(
                PhpParameter::create('locale')
                ->setType('string', "Locale to use for the translation, e.g. 'fr_FR'")
                ->setDefaultValue($behavior->getDefaultLocale())
            )
            ->setType('$this|' . $this->getClassNameFromEntity($behavior->getEntity()))
            ->setTypeDescription('The current object (for fluent API support)')
            ->setBody(
                "
\$this->currentLocale = \$locale;

return \$this;
"
            );
    }

    private function addSetLocaleAlias($alias, $behavior)
    {
        $this->addMethod('set' . NamingTool::toUpperCamelCase($alias))
            ->setDescription(
                "
Sets the locale for translations.
Alias for setLocale(), for BC purpose.
"
            )
            ->addParameter(
                PhpParameter::create('locale')
                ->setType('string', "Locale to use for the translation, e.g. 'fr_FR'")
                ->setDefaultValue($behavior->getDefaultLocale())
            )
            ->setType('$this|' . $this->getClassNameFromEntity($behavior->getEntity()))
            ->setTypeDescription('The current object (for fluent API support)')
            ->setBody(
                "
return \$this->set{$behavior->getLocaleField()->getName()}(\$locale);
"
            );
    }

    private function addSetTranslation($behavior)
    {
        $body = "
\$translation->set{$behavior->getLocaleField()->getName()}(\$locale);
\$this->add{$this->getClassNameFromEntity($behavior->getI18nEntity())}(\$translation);
\$this->currentTranslations[\$locale] = \$translation;

return \$this;
        ";

        $this->addMethod('setTranslation')
            ->setDescription('Sets the translation for a given locale')
            ->addParameter(
                PhpParameter::create('translation')
                ->setType($this->getClassNameFromEntity($behavior->getI18nEntity()))
                ->setDescription('The translation object')
            )
            ->addParameter(
                PhpParameter::create('locale')
                ->setType('string', "Locale to use for the translation, e.g. 'fr_FR'")
                ->setDefaultValue($behavior->getDefaultLocale())
            )
            ->setType('$this|' . $this->getClassNameFromEntity($behavior->getEntity()))
            ->setTypeDescription('The current object (for fluent API support)')
            ->setBody($body);
    }

    private function addTranslatedColumnSetter($behavior)
    {
        foreach ($behavior->getI18nFieldNamesFromConfig() as $fieldName) {
            $field = $behavior->getI18nEntity()->getField($fieldName);
            $methodName = 'set' . ucfirst($fieldName);
            $body = "
\$this->getCurrentTranslation()->{$methodName}(\${$fieldName});

return \$this;
 ";

            $method = $this->addMethod($methodName, $field->getAccessorVisibility())
                ->setType($this->getObjectClassName() . '|$this')
                ->setDescription("Sets the value of $fieldName.")
                ->setBody($body);

            if ($field->isNotNull()) {
                $method->addSimpleParameter($fieldName, $field->getPhpType());
            } else {
                $method->addSimpleParameter($fieldName, $field->getPhpType(), null);
            }
        }
    }
}


text:
// ArrayEntryLvalue.java.
// Copyright (C) 2004 Naom Nisan, Ziv Balshai, Amir Levy.
// See full copyright license terms in file ../GPL.txt

package SFE.Compiler;

/**
 * ArrayEntryLvalue represent as array entry l-value that can be defined
 * in a program. The ArrayEntryLvalue class extends the VarLvalue class.
 */
public class ArrayEntryLvalue extends VarLvalue {
  //~ Instance fields --------------------------------------------------------

  //data members

  /*
   * The array Lvalue (lvalue has ArrayType type)
   */
  private Lvalue array;

  /*
   * The offset int the array.
   */
  private int index;

  //~ Constructors -----------------------------------------------------------

  /**
   * Constructs a new ArrayEntryLvalue from a given lvalue and index
   * in the array.
   * @param array the array's l-value.
   * @param index the index of this ArrayEntryLvalue in the array.
   */
  public ArrayEntryLvalue(Lvalue array, int index) {
    super(new Variable(array.getName()+"["+index+"]",((ArrayType)array.getType()).getComponentType()), array.isOutput());
    this.array        = array;
    this.index        = index;
    //this.isOutput     = array.isOutput();
  }
}


text:
//
//  W A R N I N G
//  -------------
//
// This file is not part of the Qt API.  It exists for the convenience
// of other Qt classes.  This header file may change from version to
// version without notice, or even be removed.
//
// We mean it.
//

#ifndef QAUDIODEVICEINFOWIN_H
#define QAUDIODEVICEINFOWIN_H

#include <QtCore/qbytearray.h>
#include <QtCore/qstringlist.h>
#include <QtCore/qlist.h>
#include <QtCore/qdebug.h>

#include <QtMultimedia/qaudiodeviceinfo.h>
#include <QtMultimedia/qaudioengine.h>

QT_BEGIN_NAMESPACE

const unsigned int MAX_SAMPLE_RATES = 5;
const unsigned int SAMPLE_RATES[] = { 8000, 11025, 22050, 44100, 48000 };

class QAudioDeviceInfoInternal : public QAbstractAudioDeviceInfo
{
    Q_OBJECT

public:
    QAudioDeviceInfoInternal(QByteArray dev,QAudio::Mode mode);
    ~QAudioDeviceInfoInternal();

    bool open();
    void close();

    bool testSettings(const QAudioFormat& format) const;
    void updateLists();
    QAudioFormat preferredFormat() const;
    bool isFormatSupported(const QAudioFormat& format) const;
    QAudioFormat nearestFormat(const QAudioFormat& format) const;
    QString deviceName() const;
    QStringList codecList();
    QList<int> frequencyList();
    QList<int> channelsList();
    QList<int> sampleSizeList();
    QList<QAudioFormat::Endian> byteOrderList();
    QList<QAudioFormat::SampleType> sampleTypeList();
    static QByteArray defaultInputDevice();
    static QByteArray defaultOutputDevice();
    static QList<QByteArray> availableDevices(QAudio::Mode);

private:
    QAudio::Mode mode;
    QString device;
    QAudioFormat nearest;
    QList<int> freqz;
    QList<int> channelz;
    QList<int> sizez;
    QList<QAudioFormat::Endian> byteOrderz;
    QStringList codecz;
    QList<QAudioFormat::SampleType> typez;
};

QT_END_NAMESPACE

#endif


text:
#include <string>
#include <reactive/http/request.hpp>

namespace reactive {
namespace http {

    int request::on_message_begin(http_parser* parser_)
    {
        //request& r = *(static_cast<request*>(parser_->data));
        //r.setComplete(false);
        //r.setHeadersComplete(false);
        return (0);
    }

    int request::on_message_complete(http_parser* parser_)
    {
        //request& r = *static_cast<request*>(parser_->data);
        //r.setComplete(true);

        // Force the parser to stop after the request is parsed so clients
        // can process the request (or response).  This is to properly
        // handle HTTP/1.1 pipelined requests.
        //http_parser_pause(parser_, 1);

        return (0);
    }

    int request::on_header_field(http_parser* parser_, const char* data_, std::size_t size_)
    {
        request& r = *static_cast<request*>(parser_->data);

        if (!r.getCurrentValue().empty())
        {
            process_header(r, r.getCurrentField(), r.getCurrentValue());

            r.getCurrentField().clear();
            r.getCurrentValue().clear();
        }

        r.getCurrentField().append(data_, size_);

        return (0);
    }

    int request::on_header_value(http_parser* parser_, const char* data_, std::size_t size_)
    {
        request& r = *static_cast<request*>(parser_->data);
        r.getCurrentValue().append(data_, size_);
        return (0);
    }

    int request::on_headers_complete(http_parser* parser_)
    {
        request& r = *(static_cast<request*>(parser_->data));

        if (!r.getCurrentValue().empty())
        {
            process_header(r, r.getCurrentField(), r.getCurrentValue());
            r.getCurrentField().clear();
            r.getCurrentValue().clear();
        }

        //r.setHeadersComplete(true);

        // Force the parser to stop after the headers are parsed so clients
        // can process the request (or response).  This is to properly
        // handle HTTP/1.1 pipelined requests.
        //http_parser_pause(parser_, 1);

        return (0);
    }

    int request::on_url(http_parser* parser_, const char* data_, std::size_t size_)
    {
        std::string path;
        std::string query;
        bool is_path = true;

        for (std::size_t i = 0; i < size_; ++i)
        {
            char chr = data_[i];

            if (is_path)
            {
                if (chr == '?')
                {
                    is_path = false;
                    continue;
                }

                path += chr;
            }
            else
            {
                query += chr;
            }
        }

        request& r = *static_cast<request*>(parser_->data);

        r.getUrl().setPath(path);

        if (!query.empty())
        {
            r.getUrl().setQuery(query);
        }

        return (0);
    }

    int request::on_body(http_parser* parser_, const char* data_, std::size_t size_)
    {
        static_cast<request*>(parser_->data)->getContent().append(data_, size_);
        return (0);
    }

    void request::process_header(request& request_, const std::string& field_, const std::string& value_)
    {
        if (field_ == "Host")
        {
            request_.getUrl().setHost(value_);
        }
        else if (field_ == "User-Agent")
        {
            request_.setUserAgent(value_);
        }
        else if (field_ == "Cookie")
        {
            //@TODO convert this code in state machine parser
            std::vector<std::string> cookies;
            reactive::string::split(REACTIVE_HTTP_COOKIE_SEPARATOR, value_, cookies);

            for (std::size_t i = 0; i < cookies.size(); ++i)
            {
                std::vector<std::string> cookie_string;
                reactive::string::split("=", cookies.at(i), cookie_string);

                cookie_t cookie;
                cookie.name = reactive::uri::decode(cookie_string[0]);
                cookie.value = reactive::uri::decode(cookie_string[1]);
                cookie_string.clear();

                request_.getCookies().add(cookie);
            }
            cookies.clear();
        }
        else if (field_ == "X-Forwarded-For")
        {
            process_ip(request_, value_);
        }
        else if (field_ == "X-Client")
        {
            process_ip(request_, value_);
        }
        else if (field_ == "Content-Type")
        {
            request_.setContentType(value_);
        }

        request_.getHeaders().add(field_, value_);
    }

    void request::process_ip(request& request_, const std::string& ip_)
    {
        request_.info.by_proxy          = true;
        request_.info.proxy_ip_version  = request_.info.ip_version;
        request_.info.proxy_ip          = request_.info.ip;
        request_.info.proxy_port        = request_.info.port;

        std::size_t pos = ip_.find(",");

        request_.info.ip = ip_;

        if (pos != std::string::npos)
        {
            request_.info.ip = ip_.substr(0, pos);
        }

        try
        {
            boost::asio::ip::address ip_version = boost::asio::ip::address::from_string(request_.info.ip);

            if (ip_version.is_v4())
            {
                request_.info.ip_version = reactive::net::ip::IPV4;
            }
            else if (ip_version.is_v6())
            {
                request_.info.ip_version = reactive::net::ip::IPV6;
            }

        }
        catch (std::exception& e)
        {
            request_.info.ip_version = reactive::net::ip::UNDEFINED;
            //request_.info.by_proxy   = false;
        }

        // In this process we have no port information
        request_.info.port.clear();
    }

    request::request()
    {
        reset();

        memset(&m_settings, 0, sizeof(m_settings));

        // Setting state machine callbacks
        m_settings.on_message_begin    = &request::on_message_begin;
        m_settings.on_message_complete = &request::on_message_complete;
        m_settings.on_header_field     = &request::on_header_field;
        m_settings.on_header_value     = &request::on_header_value;
        m_settings.on_headers_complete = &request::on_headers_complete;
        m_settings.on_url              = &request::on_url;
        m_settings.on_body             = &request::on_body;

        memset(&m_parser, 0, sizeof(m_parser));
        http_parser_init(&m_parser, HTTP_REQUEST);
        m_parser.data = this;
    }

    request::~request()
    {
        // clear headers list
        m_headers.clear();

        // clear cookies list
        m_cookies.clear();
    }

    void request::reset()
    {
        info.reset();

        m_useragent = REACTIVE_HTTP_REQUEST_USER_AGENT;
        m_version   = protocol::VERSION_11;
        m_method    = protocol::METHOD_GET;

        // Resetting content and its type
        m_content       = "";
        m_content_type  = "";

        // unused undocumented variables
        //m_complete = false;
        //m_headers_complete = false;

        m_query.clear();
        m_body.clear();
    }

    std::size_t request::parse(const char* data_, std::size_t size_)
    {
        std::size_t parsed;

        if (size_ >= 0)
        {
            parsed = http_parser_execute(&m_parser, &m_settings, data_, size_);

            //if (parsed < size_)
            // LIMIT in reading is 80x1024
        }

        //const http_errno errno = static_cast<http_errno>(m_parser.http_errno);

        // The 'on_message_complete' and 'on_headers_complete' callbacks fail
        // on purpose to force the parser to stop between pipelined requests.
        // This allows the clients to reliably detect the end of headers and
        // the end of the message.  Make sure the parser is always unpaused
        // for the next call to 'feed'.
        /*if (herrno == HPE_PAUSED)
        {
            http_parser_pause(&m_parser, 0);
        }*/

        /*if (used < size_)
        {
            if (herrno == HPE_PAUSED)
            {
                // Make sure the byte that triggered the pause
                // after the headers is properly processed.
                if (!m_complete)
                {
                    used += http_parser_execute(&m_parser, &m_settings, data_+used, 1);
                }
            }
            else
            {
                throw (error(herrno));
            }
        }*/

        m_method  = std::string(http_method_str((http_method)m_parser.method));
        m_version = std::to_string(m_parser.http_major) + "." + std::to_string(m_parser.http_minor);

        if (!m_url.getQuery().empty())
        {
            m_query.parse(m_url.getQuery());
        }

        if (m_content_type == "application/x-www-form-urlencoded")
        {
            m_body.parse(m_content);
        }

        return (parsed);
    }

    bool request::shouldKeepAlive() const
    {
        return (http_should_keep_alive(const_cast<http_parser*>(&m_parser)) != 0);
    }

    const header_bag& request::getHeaders() const
    {
        return m_headers;
    }

    header_bag& request::getHeaders()
    {
        return m_headers;
    }

    const cookie_bag& request::getCookies() const
    {
        return m_cookies;
    }

    cookie_bag& request::getCookies()
    {
        return m_cookies;
    }

    void request::setMethod(const std::string& method_)
    {
        m_method = method_;
    }

    const std::string& request::getMethod() const
    {
        return m_method;
    }

    void request::setVersion(const std::string& version_)
    {
        m_version = version_;
    }

    const std::string& request::getVersion() const
    {
        return m_version;
    }

    void request::setUserAgent(const std::string& useragent_)
    {
        m_useragent = useragent_;
    }

    const std::string& request::getUserAgent() const
    {
        return m_useragent;
    }

    void request::setUrl(reactive::uri::url& url_)
    {
        m_url = url_;
    }

    void request::setUrl(const std::string& url_)
    {
        m_url = reactive::uri::url(url_);
    }

    const reactive::uri::url& request::getUrl() const
    {
        return m_url;
    }

    reactive::uri::url& request::getUrl()
    {
        return m_url;
    }

    void request::setContentType(const std::string& type_)
    {
        std::size_t pos = type_.find(";");

        if (pos != std::string::npos)
        {
            m_content_type = type_.substr(0, pos);
        }
        else
        {
            m_content_type = type_;
        }

        m_headers.add("Content-Type", m_content_type);
    }

    /**
     * Get content type
     *
     * @return The string of content type
     */
    const std::string& request::getContentType() const
    {
        return m_content_type;
    }

    void request::setContent(const std::string& content_)
    {
        m_content = content_;
    }

    /**
     * Get request content
     *
     * @return The string of request content
     */
    const std::string& request::getContent() const
    {
        return m_content;
    }

    /**
     * Get request content
     *
     * @return The string of request content that can be modified
     */
    std::string& request::getContent()
    {
        return m_content;
    }

    reactive::uri::query request::getData() const
    {
        return m_body;
    }

    reactive::json::value request::getJson() const
    {
        reactive::json::value retval;

        if (m_content_type == "application/json")
        {
            retval = reactive::json::decode(m_content);
        }

        return std::move(retval);
    }

    const bool request::hasQueryArgument(const std::string& key_) const
    {
        return m_query.has(key_);
    }

    const bool request::hasBodyArgument(const std::string& key_) const
    {
        return m_body.has(key_);
    }

    bool request::isXmlHttpRequest() const
    {
        if (m_headers.has("X-Requested-With") && m_headers.get("X-Requested-With").value == "XMLHttpRequest")
        {
            return true;
        }

        return false;
    }

    std::string request::toString() const
    {
        header_bag headers = m_headers;
        headers.add("Host", m_url.toString(reactive::uri::url::HOST | reactive::uri::url::PORT));

        if (!headers.has("Cache-Control"))
        {
            headers.add("Cache-Control", "max-age=0");
        }

        if (!headers.has("Accept"))
        {
            headers.add("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8");
        }

        if (!headers.has("User-Agent"))
        {
            headers.add("User-Agent", m_useragent);
        }

        if (!headers.has("Accept-Charset"))
        {
            headers.add("Accept-Charset", "ISO-8859-1,utf-8;q=0.7,*;q=0.3");
        }

        std::string reqstr = m_method
            + " "
            + m_url.toString(reactive::uri::url::PATH | reactive::uri::url::QUERY)
            + " HTTP/"
            + m_version
            + protocol::CRLF;

        // --- Constructing the cookie string
        std::string full_cookies;
        std::size_t count_cookie = m_cookies.size();
        for (std::size_t i = 0; i < count_cookie; ++i)
        {
            std::string cookie;

            cookie.append(reactive::uri::encode(m_cookies.at(i).name));
            cookie.append("=");
            cookie.append(reactive::uri::encode(m_cookies.at(i).value));

            if (i != (count_cookie - 1))
            {
                cookie.append(REACTIVE_HTTP_COOKIE_SEPARATOR);
            }

            full_cookies.append(cookie);
        }

        // --- Using the cookie string to build the header
        if (!full_cookies.empty())
        {
            headers.add("Cookie", full_cookies);
        }

        // In HTTP/1.1 the default connection type is Keep-Alive
        // while it is not fully supported in HTTP/1.0 it does not matter.
        //
        // Anyway this default header is set during connection and not here
        //headers.add("Connection", "Keep-Alive");

        reqstr.append(headers.toString() + protocol::CRLF);

        if (!m_content.empty())
        {
            reqstr.append(m_content);
        }

        return reqstr;
    }

    std::string request::toLog() const
    {
        std::string output;

        if (info.port.empty())
        {
            output += info.ip;
        }
        else
        {
            output += info.ip + ":" + info.port;
        }

        output += "<>";

        if (info.by_proxy)
        {
            output += info.proxy_ip + ":" + info.proxy_port;
            output += "<>";
        }

        output += info.local_ip + ":" + info.local_port;
        output += ", ";
        output += m_method + " ";
        output += reactive::string::substitute("%", "%%", m_url.getPath());

        if (!m_url.getQuery().empty())
        {
            output += "?" + reactive::string::substitute("%", "%%", m_url.getQuery());
        }

        output += " HTTP/" + m_version;
        output += ", " + (m_headers.has("User-Agent") ? m_headers.get("User-Agent").value : m_useragent);

        return output;
    }

} // end of http namespace
} // end of reactive namespace


text:
module DeliveryTruck
  module Helpers
    module Functional
      extend self

      # Look in the cookbook and return whether or not we can find a .kitchen.yml
      #
      # @param cookbook_path [String] Path to cookbook
      # @return [TrueClass, FalseClass]
      def has_kitchen_tests?(cookbook_path)
        File.exist?(File.join(cookbook_path, '.kitchen.docker.yml'))
      end
    end
  end

  module DSL

    # Can we find Test Kitchen files?
    def has_kitchen_tests?(cookbook_path)
      DeliveryTruck::Helpers::Functional.has_kitchen_tests?(cookbook_path)
    end
  end
end


text:
#include <stdio.h>
#include <stdlib.h>

#include <e-hal.h>  // Epiphany Hardware Abstraction Layer
                    // functionality for communicating with epiphany chip when
                    // the application runs on a host, typically the ARM µp

#define BUFOFFSET (0x01000000)  // SDRAM is at 0x8f00'0000,
                                // offset in e_read starts at 0x8e00'0000

unsigned rows, cols, i, j, ncores;

/*
 * Main entry
 */
int main(int argc, char * argv[]) {
  e_platform_t platform;  // platform infos
  e_epiphany_t dev;       // provides access to cores workgroup
  e_mem_t shared_result;           // shared memory buffer

  e_init(NULL);
  e_reset_system();
  e_get_platform_info(&platform);

  rows = platform.rows;
  cols = platform.cols;
  ncores = rows * cols;
  int result[ncores];

  // allocate a space to share data between e_cores and here
  // offset starts from 0x8e00'0000
  // sdram (share space) is at 0x8f00'0000
  // so 0x8e00'0000 + 0x0100'0000 = 0x8f00'0000
  e_alloc(&shared_result, BUFOFFSET, ncores*sizeof(float));

  e_open(&dev, 0, 0, rows, cols); // Create an epiphany cores workgroup
  for(i=0; i<rows; i++) {
    for(j=0; j<cols; j++) {
      e_load("emain.srec", &dev, i, j, E_FALSE);
      e_start(&dev, i, j);
    }
  }

  // Here we can select which eCore to unlock
  int ok = 1;
  e_write(&dev, 0, 1, 0x4000, &ok, sizeof(int));
  e_write(&dev, 0, 2, 0x4000, &ok, sizeof(int));

  usleep(2000);

  // we read from the allocated space and store it to result array
  e_read(&shared_result, 0, 0, 0x0, &result, ncores * sizeof(int)); // reads what's ben put in buffer

  for(i = 0; i < ncores; i++)
    printf("Result from core n°%02i is 0x%04x\n",i, result[i]);

  return 0;
}


text:
//
//  LBThemeItem.h
//  百思不得姐  LB
//
//  Created by xmg on 16/7/12.
//  Copyright © 2016年 LONGBO. All rights reserved.
//

#import <Foundation/Foundation.h>
@class  LBCommentItem ;
typedef enum : NSInteger {
    LBThemeTypeAll = 1,
    LBThemeTypePicture = 10,
    LBThemeTypeVoice = 31,
    LBThemeTypeVideo = 41,
    LBThemeTypeText = 29
}LBThemeType;

@interface LBThemeItem : NSObject

/** 顶部 */
@property(nonatomic,strong)NSString *profile_image;
@property(nonatomic,strong)NSString *text;
@property(nonatomic,strong)NSString *name;
@property(nonatomic,strong)NSString *created_at;

/** 照片*/

//@property(nonatomic,strong)NSString *cdn_img;
@property(nonatomic,strong)NSString *image0;
@property(nonatomic,strong)NSString *image1;
@property(nonatomic,strong)NSString *image2;
@property(nonatomic,assign)BOOL   is_gif;
@property(nonatomic,assign)BOOL  is_bigPicture;
@property(nonatomic,assign)NSInteger width;
@property(nonatomic,assign)NSInteger height;
@property(nonatomic,assign)LBThemeType type;

/** 声音*/
@property(nonatomic,assign)NSInteger  voicetime;
@property(nonatomic,strong)NSString  *playcount;

//视频播放时间
@property(nonatomic,assign)NSInteger  videotime;

//最热评论数组
@property(nonatomic,assign)NSArray  *top_cmt;
@property(nonatomic,strong)LBCommentItem *hotCommentItem;

/** 底部Button*/

@property(nonatomic,assign)NSInteger ding;
@property(nonatomic,assign)NSInteger cai;
@property(nonatomic,assign)NSInteger repost;
@property(nonatomic,assign)NSInteger comment;

@end


text:
<?xml version="1.0" encoding="utf-8"?>
<extension version="1.7" type="plugin" group="search">
	<name>Search - Weighttools</name>
	<author>HUBzero</author>
	<authorUrl>hubzero.org</authorUrl>
	<authorEmail>support@hubzero.org</authorEmail>
	<copyright>Copyright 2005-2019 HUBzero Foundation, LLC.</copyright>
	<license>http://opensource.org/licenses/MIT MIT</license>
	<description>Search plugin for weighttools</description>
	<files>
		<filename plugin="weighttools">weighttools.php</filename>
	</files>
	<languages>
		<language tag="en-GB">en-GB.plg_search_weighttools.ini</language>
	</languages>
	<config>
		<fields name="params">
		</fields>
	</config>
</extension>


text:
angular.module('CandyBeatApp').factory('Namer', function () {
  var titles = [
    "A Change Is Gonna Come",
    "A Couple More Years",
    "A Fool Such As I",
    "A Hard Rain's A-Gonna Fall",
    "A Satisfied Mind",
    "Abandoned Love",
    "Abraham, Martin And John",
    "Absolutely Sweet Marie",
    "Accidentally Like A Martyr",
    "Acne",
    "Across The Borderline",
    "Ain't A-Gonna Grieve",
    "Ain't Gonna Go To Hell For Anybody",
    "Ain't No More Cane",
    "Ain't Talkin'",
    "Alberta",
    "All Along The Watchtower",
    "All I Really Want To Do",
    "All My Tomorrows",
    "All Over You",
    "All The Tired Horses",
    "All You Have To Do Is Dream",
    "Almost Done",
    "Am I Your Stepchild",
    "Angel Flying Too Close To The Ground",
    "Angelina",
    "Answer Me",
    "Answerphone Message",
    "Any Way You Want Me",
    "Apple Suckling Tree",
    "Are You Ready",
    "Arthur McBride",
    "As I Went Out One Morning",
    "Baby I'm In The Mood For You",
    "Baby Let Me Follow You Down",
    "Baby Please Don't Go",
    "Baby Stop Crying",
    "Baby Won't You Be My Baby",
    "Back Door Blues",
    "Ballad For A Friend",
    "Ballad In Plain D",
    "Ballad Of A Thin Man",
    "The Ballad Of Donald White",
    "The Ballad Of Frankie Lee And Judas Priest",
    "Ballad Of Hollis Brown",
    "The Ballad Of Ira Hayes",
    "Ballad Of The Gliding Swan",
    "Band Of The Hand",
    "Banks Of The Royal Canal",
    "Barbara Allen",
    "Belle Isle",
    "Beyond The Horizon",
    "Beyond Here Lies Nothin'",
    "Big Yellow Taxi",
    "Billy",
    "Billy",
    "Black Cross",
    "Black Crow Blues",
    "Black Diamond Bay",
    "Black Jack Davey",
    "Black Muddy River",
    "Blessed Is The Name",
    "Blind Willie McTell",
    "Blood In My Eyes",
    "Blowin' In The Wind",
    "Blue Bonnet Girl",
    "Blue Moon",
    "Bob Dylan's 115th Dream",
    "Bob Dylan's Blues",
    "Bob Dylan's Dream",
    "Bob Dylan's New Orleans Rag",
    "Bonnie Ship The Diamond",
    "Boom Boom Mancini",
    "Boots Of Spanish Leather",
    "Born In Time",
    "Bound To Lose, Bound To Win",
    "The Boxer",
    "Broke Down Engine",
    "Brownsville Girl",
    "Buckets Of Rain",
    "Bye And Bye",
    "Call Letter Blues",
    "Can You Please Crawl Out Your Window",
    "Canadee-I-O",
    "I Can't Get You Off Of My Mind",
    "Can't Help Falling In Love",
    "Can't Wait",
    "Caribbean Wind",
    "Carrying A Torch",
    "Catfish",
    "Catskill Serenade",
    "Cat's In The Well",
    "A Change Is Gonna Come",
    "Change My Way Of Thinking",
    "Changing Of The Guards",
    "Chimes Of Freedom",
    "Christmas Blues",
    "Christmas Island",
    "The Christmas Song",
    "City Of Gold",
    "Clean-Cut Kid",
    "Climax Tobacco",
    "Clothes Line Saga",
    "Cocaine Blues",
    "Cold Irons Bound",
    "Coming From The Heart",
    "Confidential To Me",
    "Congratulations",
    "Copper Kettle",
    "Corrina, Corrina",
    "Country Pie",
    "Covenant Woman",
    "Cover Down, Break Through",
    "Crazy Love",
    "Cross The Green Mountain",
    "Cry Awhile",
    "Cuban Missile Crisis",
    "Cuckoo Is A Pretty Bird",
    "Dark As A Dungeon",
    "Dark Eyes",
    "Day Of The Locusts",
    "Days Of '49",
    "Dead Man, Dead Man",
    "Dear Landlord",
    "Dear Mrs. Roosevelt",
    "Death Is Not The End",
    "The Death Of Emmett Till",
    "Deep Ellem Blues",
    "Definitely/Positively Van Gogh",
    "Delia",
    "Deportee",
    "Desolation Row",
    "Diamond Joe",
    "Diamond Joe",
    "Dignity",
    "Dink's Song",
    "Dirge",
    "Dirt Road Blues",
    "Dirty Lies",
    "Dirty World",
    "Disease Of Conceit",
    "Dixie",
    "Do Right To Me Baby",
    "Do You Hear What I Hear",
    "Does She Need Me",
    "Don't Fall Apart On Me Tonight",
    "Don't Pity Me",
    "Don't Think Twice, It's All Right",
    "Don't Ya Tell Henry",
    "Down Along The Cove",
    "Down In The Flood",
    "Down The Highway",
    "Drifter's Escape",
    "Driftin' Too Far From Shore",
    "Duncan And Brady",
    "Dusty Old Fairgrounds",
    "Early Mornin' Rain",
    "Eileen Aroon",
    "Emotionally Yours",
    "The End Of The Innocence",
    "Enough Is Enough",
    "Eternal Circle",
    "Every Grain Of Sand",
    "Everything Is Broken",
    "Farewell",
    "Farewell Angelina",
    "Farewell To The Gold",
    "Father Of Night",
    "Female Rambling Sailor",
    "Fever",
    "First Noel",
    "Fixin' To Die",
    "Floater",
    "Foot Of Pride",
    "Forever Young",
    "Forgetful Heart",
    "Four Strong Winds",
    "Frankie & Albert",
    "Freedom For The Stallion",
    "Freight Train Blues",
    "The French Girl",
    "Friend Of The Devil",
    "Froggie Went A Courtin'",
    "From A Buick 6",
    "Gates Of Eden",
    "George Jackson",
    "The Girl I Left Behind",
    "Girl Of The North Country",
    "Girl On The Green Briar Shore",
    "Go 'Way Little Boy",
    "Nicolas Cage Knows",
    "Going Down To New Orleans",
    "Going Going Gone",
    "Goin' To Acapulco",
    "Golden Loom",
    "Golden Vanity",
    "Gonna Change My Way Of Thinking",
    "Gospel Plow",
    "Got My Mind Made Up",
    "Gotta Serve Somebody",
    "Gotta Travel On",
    "The Grand Coulee Dam",
    "Green Mountain",
    "The Groom's Still Waiting At The Altar",
    "Guess I'm Doin' Fine",
    "Gypsy Lou",
    "Had A Dream About You Baby",
    "Hallelujah",
    "Hallelujah I'm Ready To Go",
    "Handsome Molly",
    "Handy Dandy",
    "Hard Times",
    "Hard Times In New York Town",
    "Hard Travelin'",
    "The Harder They Come",
    "Hark The Herald Angels Sing",
    "The Lonesome Death Of",
    "Have Yourself A Merry Little Christmas",
    "Hazel",
    "He Was A Friend Of Mine",
    "Heart Of Mine",
    "Help Me Make It Through The Night",
    "Here Comes Santa Claus",
    "Hero Blues",
    "Hey La La",
    "Hiding Too Long",
    "Highlands",
    "Highwater",
    "Highway",
    "Hiram Hubbard",
    "Honest With Me",
    "Honey Just Allow Me One More Chance",
    "House Carpenter",
    "House Of The Rising Sun",
    "Humming Bird",
    "Hurricane",
    "I Ain't Got No Home",
    "I Am A Lonesome Hobo",
    "I Am The Man, Thomas",
    "I And I",
    "I Believe In You",
    "I Can't Get You Off Of My Mind",
    "I Can't Leave Her Behind",
    "I Don't Believe You",
    "I Don't Hurt Anymore",
    "I Dreamed I Saw St Augustine",
    "I Feel A Change Comin' On",
    "I Forgot More Than You'll Ever Know",
    "I Hear A Voice Calling",
    "I Pity The Poor Immigrant",
    "I Rode Out One Morning",
    "I Shall Be Free",
    "I Shall Be Free No. 10",
    "I Shall Be Released",
    "I Threw It All Away",
    "I Wanna Be Your Lover",
    "I Want You",
    "I Was Young When I Left Home",
    "I Will Love Him",
    "I Will Sing",
    "Idiot Wind",
    "I'd Hate To Be You On That Dreadful Day",
    "If Dogs Run Free",
    "If I Don't Be There By Morning",
    "If Not For You",
    "If You Belonged To Me",
    "If You Ever Go To Houston",
    "If You Gotta Go, Go Now",
    "If You See Her, Say Hello",
    "I'll Be Around",
    "I'll Be Home For Christmas",
    "I'll Be Your Baby Tonight",
    "I'll Keep It With Mine",
    "I'll Not Be A Stranger",
    "I'll Remember You",
    "I'm A Fool For You",
    "I'm In The Mood For Love",
    "I'm Movin' On",
    "I'm Not Supposed To Care",
    "I'm Not There",
    "I'm Your Teenage Prayer",
    "Important Words",
    "In My Time Of Dying",
    "In Search Of Little Sadie",
    "In The Evening",
    "In The Garden",
    "In The Pines",
    "In The Summertime",
    "Is Your Love In Vain",
    "Isis",
    "It Ain't Me, Babe",
    "It Hurts Me Too",
    "It Takes A Lot To Laugh, It Takes A Train To Cry",
    "It's All Good",
    "It's All Over Now, Baby Blue",
    "It's Alright Ma",
    "It's Hard To Be Blind",
    "I've Been All Around This World",
    "Jack-A-Roe",
    "James Alley Blues",
    "Jesus Met The Woman At The Well",
    "Jet Pilot",
    "Jim Jones",
    "Joey",
    "John Brown",
    "John Wesley Harding",
    "Jokerman",
    "Jolene",
    "Julius And Ethel",
    "Just Like A Woman",
    "Just Like Tom Thumb's Blues",
    "Kaatskill Serenade",
    "Key To The Highway",
    "Kindhearted Woman Blues",
    "Kingsport Town",
    "Knockin' On Heaven's Door",
    "The Lady Came From Baltimore",
    "Lady Of Carlisle",
    "Lakes Of Pontchartrain",
    "Lawyers Guns And Money",
    "Lay Down Your Weary Tune",
    "Lay, Lady, Lay",
    "Lenny Bruce",
    "Leopard-Skin Pill-Box Hat",
    "Let It Be Me",
    "Let Me Die In My Footsteps",
    "Let's Begin",
    "Let's Keep It Between Us",
    "Let's Stick Together",
    "The Levee's Gonna Break",
    "Licence To Kill",
    "Life Is Hard",
    "Like A Rolling Stone",
    "Like A Ship",
    "Lily Of The West",
    "Lily, Rosemary And The Jack Of Hearts",
    "Little Drummer Boy",
    "Little Maggie",
    "Little Moses",
    "Little Sadie",
    "Liverpool Gal",
    "Living The Blues",
    "Lo And Behold!",
    "Long Time Man",
    "Lone Pilgrim",
    "The Lonesome Death Of Hattie Carroll",
    "The Lonesome River",
    "Lonesome River Edge",
    "Lonesome Town",
    "Lonesome Day Blues",
    "Lonesome Whistle Blues",
    "Long Ago, Far Away",
    "Long Black Veil",
    "Long Time Gone",
    "Long Time Growing",
    "Lord Protect My Child",
    "Lost Highway",
    "Love Henry",
    "Love Is Just A Four-Letter Word",
    "Love Minus Zero/No Limit",
    "Love Sick",
    "Lucky Old Sun",
    "Maggie's Farm",
    "Main Title Theme",
    "Make You Feel My Love",
    "Mama You Been On My Mind",
    "Man Gave Names To All The Animals",
    "The Man In Me",
    "Man In The Long Black Coat",
    "Man Of Constant Sorrow",
    "Man Of Peace",
    "Man On The Street",
    "Mary Ann",
    "Mary Ann",
    "Mary Of The Wild Moor",
    "Masters Of War",
    "Maybe Someday",
    "Meet Me In The Morning",
    "Milk Cow's Calf Blues",
    "Million Dollar Bash",
    "Million Miles",
    "Minstrel Boy",
    "Miss The Mississippi And You",
    "Mississippi",
    "Mixed Up Confusion",
    "Moon River",
    "Moonlight",
    "Moonshiner",
    "Most Likely You Go Your Way And I'll Go Mine",
    "Most Of The Time",
    "Motherless Children",
    "Motorpsycho Nightmare",
    "Mozambique",
    "Mr Bojangles",
    "Mr Tambourine Man",
    "Must Be Santa",
    "Mutineer",
    "My Back Pages",
    "My Blue Eyed Jane",
    "Naomi Wise",
    "Nashville Skyline Rag",
    "Need A Woman",
    "Neighborhood Bully",
    "Never Gonna Be The Same Again",
    "Nettie Moore",
    "Never Let Me Go",
    "Never Say Goodbye",
    "New Danville Girl",
    "New Minglewood Blues",
    "New Orleans Rag",
    "New Morning",
    "New Pony",
    "Newry Highwayman",
    "Night After Night",
    "Ninety Miles An Hour",
    "No More Auction Block",
    "No More One More Time",
    "No Time To Think",
    "Nobody 'Cept You",
    "North Country Blues",
    "Not Dark Yet",
    "Not Fade Away",
    "Nothing Was Delivered",
    "Nuggets Of Rain",
    "O Come All Ye Faithful",
    "O Little Town Of Bethlehem",
    "Obviously Five Believers",
    "Odds And Ends",
    "Oh Babe It Ain't No Lie",
    "Oh Sister",
    "Old Five And Dimer",
    "Old Man",
    "Old Rock 'N' Roller",
    "On A Night Like This",
    "On A Rainy Afternoon",
    "On The Road Again",
    "One For The Road",
    "One Irish Rover",
    "One Man's Loss",
    "One More Cup Of Coffee",
    "One More Night",
    "One More Weekend",
    "One Of Us Must Know",
    "One Single River",
    "One Too Many Mornings",
    "Only A Hobo",
    "Only A Pawn In Their Game",
    "Open The Door, Homer",
    "Outlaw Blues",
    "Oxford Town",
    "Pancho And Lefty",
    "Pass Me Not O Gentle Savior",
    "Paths Of Victory",
    "Peace In The Valley",
    "Peggy Day",
    "People Get Ready",
    "People Putting People Down",
    "Percy's Song",
    "Please Mrs. Henry",
    "Pledging My Time",
    "Po' Boy",
    "Polly Vaughn",
    "Political World",
    "Poor Lazarus",
    "Positively 4th Street",
    "Positively Van Gogh",
    "Precious Angel",
    "Precious Memories",
    "Pressing On",
    "Pretty Boy Floyd",
    "Pretty Peggy-O",
    "Property Of Jesus",
    "Queen Jane Approximately",
    "Quinn The Eskimo",
    "Quit Your Low Down Ways",
    "Ragged And Dirty",
    "Railroad Bill",
    "Railroad Boy",
    "Rainy Day Women #12 & 35",
    "Rambler Gambler",
    "Ramblin' Down Through The World",
    "Rambling Gambling Willie",
    "Rank Strangers To Me",
    "Red Cadillac And A Black Moustache",
    "Remember Me",
    "Repossession Blues",
    "Restless Farewell",
    "Return To Me",
    "Ring Them Bells",
    "Rise Again",
    "Rita May",
    "Rock Me Mama",
    "Rock Of Ages",
    "Rock Salt And Nails",
    "Rocks And Gravel",
    "Roll On John",
    "Rollin' And Tumblin'",
    "Romance In Durango",
    "Roving Blade",
    "Roving Gambler",
    "Sad-Eyed Lady Of The Lowlands",
    "Sally Girl",
    "Sally Sue Brown",
    "San Francisco Bay Blues",
    "Santa Fe",
    "Sara",
    "Sarah Jane",
    "Saved",
    "Saving Grace",
    "Searching For A Soldier's Grave",
    "See That My Grave Is Kept Clean",
    "See You Later Allen Ginsberg",
    "Seeing The Real You At Last",
    "Señor",
    "Series Of Dreams",
    "Seven Curses",
    "Seven Days",
    "Seven Deadly Sins",
    "Shake Shake Mama",
    "Shake Sugaree",
    "She Belongs To Me",
    "Shelter From The Storm",
    "Shenandoah",
    "She's Love Crazy",
    "She's No Good",
    "She's Your Lover Now",
    "Shooting Star",
    "Shot Of Love",
    "Sign Language",
    "Sign On The Cross",
    "Sign On The Window",
    "Silent Weekend",
    "Silver Bells",
    "Silvio",
    "Simple Twist Of Fate",
    "Sitting On A Barbed-Wire Fence",
    "Sittin' On Top Of The World",
    "Sloppy Drunk",
    "Slow Train",
    "Smokestack Lightning",
    "Solid Rock",
    "Somebody Touched Me",
    "Someday Baby",
    "Someone's Got A Hold Of My Heart",
    "Something's Burning, Baby",
    "Something There Is About You",
    "Song For Canada",
    "Song To Woody",
    "Soon",
    "Spanish Harlem Incident",
    "Spanish Is The Loving Tongue",
    "Spirit On The Water",
    "Stack A Lee",
    "Stand By Me",
    "Standing In The Doorway",
    "Standing On The Highway",
    "Stealin'",
    "Steel Bars",
    "Step It Up And Go",
    "Still In Town",
    "Stone Walls And Steel Bars",
    "Stuck Inside Of Mobile With The Memphis Blues",
    "Subterranean Homesick Blues",
    "Sugar Baby",
    "Summer Days",
    "Suze",
    "Sweetheart Like You",
    "Take A Message To Mary",
    "Take Me As I Am",
    "Talking Bear Mountain Picnic Massacre Blues",
    "Talkin' Devil",
    "Talkin Hava Negeilah Blues",
    "Talkin' John Birch Paranoid Blues",
    "Talking New York Blues",
    "Talkin' World War Blues",
    "Tangled Up In Blue",
    "Tears Of Rage",
    "Telephone Response Song",
    "Telephone Wire",
    "Tell Me",
    "Tell Me, Momma",
    "Tell Me That It Isn't True",
    "Temporary Like Achilles",
    "Thank Nicolas Cage",
    "That Lucky Old Sun",
    "The Ballad Of Donald White",
    "The Ballad Of Frankie Lee And Judas Priest",
    "The Ballad Of Ira Hayes",
    "The Boxer",
    "The Death Of Emmett Till",
    "The End Of The Innocence",
    "The French Girl",
    "The Girl I Left Behind",
    "The Grand Coulee Dam",
    "The Groom's Still Waiting At The Altar",
    "The Lady Came From Baltimore",
    "The Levee's Gonna Break",
    "The Lonesome Death Of Hattie Carroll",
    "The Lonesome River",
    "The Man In Me",
    "The Times They Are A-Changin'",
    "The Times We've Known",
    "The Two Sisters",
    "The Usual",
    "The Water Is Wide",
    "The Wicked Messenger",
    "They Killed Him",
    "Thief On The Cross",
    "Things Have Changed",
    "This Dream Of You",
    "This Land Is Your Land",
    "This Was My Love",
    "This Wheel's On Fire",
    "This World Can't Stand Long",
    "Three Angels",
    "Thunder On The Mountain",
    "Tight Connection To My Heart",
    "'Til I Fell In Love With You",
    "Time Passes Slowly",
    "The Times They Are A-Changin'",
    "The Times We've Known",
    "Tiny Montgomery",
    "To Be Alone With You",
    "To Fall In Love With You",
    "To Ramona",
    "Tombstone Blues",
    "Tomorrow Is A Long Time",
    "Tomorrow Night",
    "Tonight I'll Be Staying Here With You",
    "Too Much Of Nothing",
    "Tough Mama",
    "Trail Of The Buffalo",
    "Train Of Love",
    "Trouble",
    "Trouble In Mind",
    "Troubled And I Don't Know Why",
    "True Love Tends To Forget",
    "Trust Yourself",
    "Try Me",
    "Tryin' To Get To Heaven",
    "The Two Sisters",
    "Tweedle Dee And Tweedle Dum",
    "Tweeter and the Monkey Man",
    "Two Soldiers",
    "Two Trains Running",
    "Ugliest Girl In The World",
    "Unbelievable",
    "Under The Red Sky",
    "Under Your Spell",
    "Union Sundown",
    "Up To Me",
    "The Usual",
    "Vincent Van Gogh",
    "Viola Lee Blues",
    "Visions Of Johanna",
    "Voice From On High",
    "Vomit Express",
    "Wagoner's Lad",
    "Wait For The Light To Shine",
    "Waitin' For You",
    "Walkin' Down The Line",
    "Wallflower",
    "Walls Of Red Wing",
    "Waltzing With Sin",
    "Wanted Man",
    "Watching The River Flow",
    "The Water Is Wide",
    "Watered-Down Love",
    "We Better Talk This Over",
    "We Had It All",
    "We Just Disagree",
    "We Three",
    "Wedding Song",
    "Weeping Willow",
    "Went To See The Gypsy",
    "West Texas",
    "What Can I Do For You",
    "What Good Am I",
    "What Kind Of Friend Is This",
    "What Was It You Wanted",
    "Whatcha Gonna Do",
    "When Did You Leave Heaven",
    "When First Unto This Country",
    "When He Returns",
    "When I Got Troubles",
    "When I Paint My Masterpiece",
    "When The Deal Goes Down",
    "When The Night Comes Falling From The Sky",
    "When The Ship Comes In",
    "When You Gonna Wake Up",
    "Where Are You Tonight",
    "Where Teardrops Fall",
    "White Dove",
    "Who Killed Davey Moore",
    "Why Do I Have To Choose",
    "Wichita Blues",
    "The Wicked Messenger",
    "Wieviele Strassen",
    "Wiggle Wiggle",
    "Wigwam",
    "Wild Mountain Thyme",
    "Willin'",
    "Winter Wonderland",
    "Winterlude",
    "With Nicolas Cage On Our Side",
    "Won't You Be My Baby",
    "Workingman's Blues",
    "World Gone Wrong",
    "Worried Blues",
    "Ye Shall Be Changed",
    "Yea! Heavy And A Bottle Of Bread",
    "Yonder Comes Sin",
    "You Ain't Goin' Nowhere",
    "You Angel You",
    "You Belong To Me",
    "You Changed My Life",
    "You Don't Know Me",
    "You Gotta Quit Kicking My Dog Around",
    "You Wanna Ramble",
    "Young But Daily Growin'",
    "You're A Big Girl Now",
    "You're Gonna Make Me Lonesome When You Go",
    "You're Gonna Quit Me Baby",
    "You're No Good",
    "You're Too Late",
    "You've Been Hiding Too Long"
  ];

  var terminals = {};
  var startwords = [];
  var wordstats = {};

  for (var i = 0; i < titles.length; i++) {
      var words = titles[i].split(' ');
      terminals[words[words.length - 1]] = true;
      startwords.push(words[0]);
      for (var j = 0; j < words.length - 1; j++) {
          if (wordstats.hasOwnProperty(words[j])) {
              wordstats[words[j]].push(words[j + 1]);
          } else {
              wordstats[words[j]] = [words[j + 1]];
          }
      }
  }

  var randSelect = function (a) {
      var i = Math.floor(a.length * Math.random());
      return a[i];
  };

  function make_title(min_length) {
    word = randSelect(startwords);
    var title = [word];
    while (wordstats.hasOwnProperty(word)) {
        var next_words = wordstats[word];
        word = randSelect(next_words);
        title.push(word);
        if (title.length > min_length && terminals.hasOwnProperty(word)) break;
    }
    if (title.length < min_length) return make_title(min_length);
    return title.join(' ');
  }
  return {
      newName:  make_title
    }

});


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>

    <groupId>zookeeper-play</groupId>
    <artifactId>zookeeper-play</artifactId>
    <version>1.0-SNAPSHOT</version>
    <packaging>jar</packaging>

    <name>zookeeper-play</name>
    <url>http://maven.apache.org</url>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    </properties>

    <dependencies>

        <dependency>
            <groupId>org.apache.zookeeper</groupId>
            <artifactId>zookeeper</artifactId>
            <version>3.4.6</version>
        </dependency>

        <dependency>
            <groupId>org.apache.curator</groupId>
            <artifactId>curator-recipes</artifactId>
            <version>2.4.2</version>
        </dependency>

        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>3.8.1</version>
            <scope>test</scope>
        </dependency>
    </dependencies>
</project>


text:
var expect = require('chai').expect;
var adhere = require('../../lib/adhere');

describe('multipleOf', function () {

  it('should validate numbers that are multiples of the keyword value', function () {
    var schema = {
      type: 'number',
      multipleOf: 10
    };

    var values = [10, -10, 80, -80];
    values.forEach(function (val) {
      var result = adhere.validate(val, schema);
      expect(result.valid).to.eql(true);
    });
  });

  it('should invalidate numbers that are not multiple of the keyword value', function () {
    var schema = {
      type: 'number',
      multipleOf: 7
    };

    var values = [10, -10, 80, -80];
    values.forEach(function (val) {
      var result = adhere.validate(val, schema);
      expect(result.valid).to.eql(false);
    });
  });

  it('should always invalidate numbers if the keyword value is Infinity', function () {
    var schema = {
      type: 'number',
      multipleOf: Infinity
    };

    var values = [10, -10, 80, -80];
    values.forEach(function (val) {
      var result = adhere.validate(val, schema);
      expect(result.valid).to.eql(false);
    });
  });

  it('should always invalidate numbers if the keyword value is zero', function () {
    var schema = {
      type: 'number',
      multipleOf: 0
    };

    var values = [10, -10, 80, -80];
    values.forEach(function (val) {
      var result = adhere.validate(val, schema);
      expect(result.valid).to.eql(false);
    });
  });

});


text:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-mapping PUBLIC
    "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
    "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">

<hibernate-mapping auto-import="false">
  <class name="com.krishagni.catissueplus.core.biospecimen.domain.CollectionProtocolSite" table="CATISSUE_SITE_CP">
    <id name="id" column="IDENTIFIER">
      <generator class="native">
        <param name="sequence">OS_SITE_CP_SEQ</param>
      </generator>
    </id>

    <many-to-one name="collectionProtocol" column="COLLECTION_PROTOCOL_ID"/>

    <many-to-one name="site" column="SITE_ID"/>

    <property name="code" column="CODE"/>
  </class>
</hibernate-mapping>


text:
module Brainstem
  module DSL
    class Conditional
      attr_reader :name, :type, :action, :options

      def initialize(name, type, action, options = {})
        @name = name
        @type = type
        @action = action
        @options = options
      end

      def description
        options[:info].presence
      end

      def matches?(model, helper_instance = Object.new, conditional_cache = { model: {}, request: {} })
        case type
          when :model
            conditional_cache[:model].fetch(name) { conditional_cache[:model][name] = helper_instance.instance_exec(model, &action) }
          when :request
            conditional_cache[:request].fetch(name) { conditional_cache[:request][name] = helper_instance.instance_exec(&action) }
          else
            raise "Unknown Brainstem Conditional type #{type}"
        end
      end
    end
  end
end


text:
using System.Net.Http;
using System.Threading.Tasks;
using VaultSharp.Core;
using VaultSharp.V1.Commons;

namespace VaultSharp.V1.SystemBackend.MFA
{
    /// <summary>
    /// The base MFA provider for all types.
    /// </summary>
    internal abstract class AbstractMFAProviderBase<TMFAConfig> : IMFAProviderBase<TMFAConfig> where TMFAConfig : AbstractMFAConfig
    {
        private readonly Polymath _polymath;

        protected AbstractMFAProviderBase(Polymath polymath) => _polymath = polymath;

        /// <summary>
        /// Gets the type of MFA method.
        /// </summary>
        public abstract string Type { get; }

        public async Task ConfigureAsync(TMFAConfig mfaConfig)
        {
            await _polymath.MakeVaultApiRequest("v1/sys/mfa/method/" + Type + "/" + mfaConfig.Name, HttpMethod.Post, mfaConfig).ConfigureAwait(_polymath.VaultClientSettings.ContinueAsyncTasksOnCapturedContext);
        }

        public async Task<Secret<TMFAConfig>> GetConfigAsync(string methodName)
        {
            return await _polymath.MakeVaultApiRequest<Secret<TMFAConfig>>("v1/sys/mfa/method/" + Type + "/" + methodName, HttpMethod.Get).ConfigureAwait(_polymath.VaultClientSettings.ContinueAsyncTasksOnCapturedContext);
        }

        public async Task DeleteConfigAsync(string methodName)
        {
            await _polymath.MakeVaultApiRequest("v1/sys/mfa/method/" + Type + "/" + methodName, HttpMethod.Delete).ConfigureAwait(_polymath.VaultClientSettings.ContinueAsyncTasksOnCapturedContext);
        }
    }
}


text:
<?php

namespace Collejo\App\Modules\Students\Http\Requests;

use Collejo\Foundation\Http\Requests\Request;

class UpdateStudentDetailsRequest extends Request
{
    public function rules()
    {
        $createRequest = new CreateStudentRequest();

        return array_merge($createRequest->rules(), [
                'admission_number' => 'required|unique:students,admission_number,'.$this->json('id'),
            ]);
    }

    public function attributes()
    {
        $createRequest = new CreateStudentRequest();

        return $createRequest->attributes();
    }
}


text:
package tardy

import "strings"

// SimplePrompt - a simple prompt to get a value with no restrictions. allows for
// a default.
func SimplePrompt(message string, required Optionality, defaultValue string) Prompt {
	return Prompt{
		Message:            message,
		DefaultValue:       defaultValue,
		Required:           required,
		RetryIfNoMatch:     true,
		CaseSensitiveMatch: false,
	}
}

// SimpleSecurePrompt - a simple prompt to get a value with no restrictions.
// entry is capture without local echo (typing not visible). allows for a default.
func SimpleSecurePrompt(message string, required Optionality, defaultValue string) Prompt {
	return Prompt{
		Message:            message,
		DefaultValue:       defaultValue,
		Required:           required,
		RetryIfNoMatch:     true,
		CaseSensitiveMatch: false,
		SecureEntry:        true,
	}
}

// YesNoPrompt - prompts for a yes or no answer. the final value will be a
// boolean. allows for a default.
func YesNoPrompt(message string, hint string, required Optionality, defaultValue bool) Prompt {
	return Prompt{
		Message:            message,
		ValueHint:          hint,
		DefaultValue:       defaultValue,
		Required:           required,
		RetryIfNoMatch:     true,
		FailIfNoMatch:      true,
		CaseSensitiveMatch: false,
		ValidationFunc: func(prompt *Prompt, value string) (string, Validity) {
			_, validity := isValidYesOrNoValue(value)
			return value, validity
		},
		ValueConverter: func(prompt *Prompt, value string) interface{} {
			return isPositiveStringValue(value, false)
		},
	}
}

// SingleValuePrompt - prompts for an answer from within a subset of valid
// answers. allows for a default.
func SingleValuePrompt(message string, hint string, values []string, required Optionality, defaultValue string) Prompt {
	return Prompt{
		Message:            message,
		ValueHint:          hint,
		DefaultValue:       defaultValue,
		Required:           required,
		RetryIfNoMatch:     true,
		FailIfNoMatch:      false,
		CaseSensitiveMatch: false,
		ValidationFunc: func(prompt *Prompt, value string) (string, Validity) {
			useValue := value
			originalValues := values
			checkStrings := values
			if prompt.CaseSensitiveMatch == false {
				useValue = strings.ToLower(useValue)
				checkStrings = mapStrings(checkStrings, func(s string) string {
					return strings.ToLower(s)
				})
			}
			for idx, v := range checkStrings {
				if useValue == v {
					return originalValues[idx], IsValid
				}
			}
			validity := IsValid
			if prompt.FailIfNoMatch {
				validity = IsNotValid
			}
			return defaultValue, validity
		},
	}
}

// helpers

func isValidYesOrNoValue(value string) (bool, Validity) {
	switch strings.ToLower(value) {
	case "yes", "y", "yo", "si", "yup", "ya", "yep":
		return true, IsValid
	case "no", "n", "nope", "no way", "nuh uh", "nah":
		return false, IsValid
	}
	return false, IsNotValid
}

// isPositiveStringValue - returns true if the string value matches the list of
// positive string values. empty or non-matched value will return the
// noMatchValue.
func isPositiveStringValue(value string, noMatchValue bool) bool {
	if value == "" {
		return noMatchValue
	}
	if boolVal, validity := isValidYesOrNoValue(value); validity == IsValid {
		return boolVal
	}
	return noMatchValue
}


text:
package com.google.android.mms;

import android.content.Context;
import android.database.Cursor;
import android.net.Uri;
import android.text.TextUtils;
import android.widget.Toast;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

public class APNHelper {

    public APNHelper(final Context context) {
        this.context = context;
    }

    @SuppressWarnings("unchecked")
    public List<APN> getMMSApns() {
        try {
            final Cursor apnCursor = this.context.getContentResolver().query(Uri.withAppendedPath(Uri.parse("content://telephony/carriers"), "current"), null, null, null, null);
            if (apnCursor == null) {
                return Collections.EMPTY_LIST;
            } else {
                final List<APN> results = new ArrayList<APN>();
                if (apnCursor.moveToFirst()) {
                    do {
                        final String type = apnCursor.getString(apnCursor.getColumnIndex("type"));
                        if (!TextUtils.isEmpty(type) && (type.equalsIgnoreCase("*") || type.equalsIgnoreCase("mms"))) {
                            final String mmsc = apnCursor.getString(apnCursor.getColumnIndex("mmsc"));
                            final String mmsProxy = apnCursor.getString(apnCursor.getColumnIndex("mmsproxy"));
                            final String port = apnCursor.getString(apnCursor.getColumnIndex("mmsport"));
                            final APN apn = new APN();
                            apn.MMSCenterUrl = mmsc;
                            apn.MMSProxy = mmsProxy;
                            apn.MMSPort = port;
                            results.add(apn);

                            Toast.makeText(context, mmsc + " " + mmsProxy + " " + port, Toast.LENGTH_LONG).show();
                        }
                    } while (apnCursor.moveToNext());
                }
                apnCursor.close();
                return results;
            }
        } catch (Exception e) {
            // insignificant permissions
            return Collections.EMPTY_LIST;
        }
    }

    private Context context;
}


text:
.class public Lcn/com/smartdevices/bracelet/eventbus/EventGoalsUpdated;
.super Ljava/lang/Object;

# direct methods
.method public constructor <init>()V
    .locals 0

    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    return-void
.end method


text:
<?php

use yii\helpers\Html;
use yii\widgets\ActiveForm;

/* @var $this yii\web\View */
/* @var $model app\models\RoleSearch */
/* @var $form yii\widgets\ActiveForm */
?>

    <?php $form = ActiveForm::begin([
        'action' => ['index'],
        'method' => 'get',
    ]); ?>

    <?= $form->field($model, 'role_id') ?>

    <?= $form->field($model, 'role_name') ?>

    <?= $form->field($model, 'action_list') ?>

    <?= $form->field($model, 'role_describe') ?>

        <?= Html::submitButton('Search', ['class' => 'btn btn-primary']) ?>
        <?= Html::resetButton('Reset', ['class' => 'btn btn-default']) ?>

    <?php ActiveForm::end(); ?>


text:
// import { enableProdMode } from '@angular/core';
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
import { AppModule } from './modules/app_module/app.module';

// 启用生产模式可以取消注释以下行
// enableProdMode();

platformBrowserDynamic().bootstrapModule(AppModule);


text:
using namespace boost::type_erasure;

template<class T = _self>
struct common : ::boost::mpl::vector<
    copy_constructible<T>,
    typeid_<T>
> {};

BOOST_AUTO_TEST_CASE(test_basic)
{
    typedef ::boost::mpl::vector<common<>, assignable<> > test_concept;
    any<test_concept> x(1);
    int* ip = any_cast<int*>(&x);
    any<test_concept> y(2);
    x = y;
    BOOST_CHECK_EQUAL(any_cast<int>(x), 2);
    // make sure that we're actually using assignment
    // of the underlying object, not copy and swap.
    BOOST_CHECK_EQUAL(any_cast<int*>(&x), ip);
}

BOOST_AUTO_TEST_CASE(test_basic_relaxed)
{
    typedef ::boost::mpl::vector<common<>, assignable<>, relaxed > test_concept;
    any<test_concept> x(1);
    int* ip = any_cast<int*>(&x);
    any<test_concept> y(2);
    x = y;
    BOOST_CHECK_EQUAL(any_cast<int>(x), 2);
    // make sure that we're actually using assignment
    // of the underlying object, not copy and swap.
    BOOST_CHECK_EQUAL(any_cast<int*>(&x), ip);
}

BOOST_AUTO_TEST_CASE(test_relaxed_no_copy)
{
    typedef ::boost::mpl::vector<
        destructible<>,
        typeid_<>,
        assignable<>,
        relaxed
    > test_concept;
    any<test_concept> x(1);
    int* ip = any_cast<int*>(&x);
    any<test_concept> y(2);
    x = y;
    BOOST_CHECK_EQUAL(any_cast<int>(x), 2);
    // make sure that we're actually using assignment
    // of the underlying object, not copy and swap.
    BOOST_CHECK_EQUAL(any_cast<int*>(&x), ip);
}

BOOST_AUTO_TEST_CASE(test_relaxed_no_assign)
{
    typedef ::boost::mpl::vector<
        common<>,
        relaxed
    > test_concept;
    any<test_concept> x(1);
    any<test_concept> y(2);
    x = y;
    BOOST_CHECK_EQUAL(any_cast<int>(x), 2);
}

BOOST_AUTO_TEST_CASE(test_dynamic_fallback)
{
    typedef ::boost::mpl::vector<common<>, assignable<>, relaxed> test_concept;
    any<test_concept> x(1);
    any<test_concept> y(2.0);
    x = y;
    BOOST_CHECK_EQUAL(any_cast<double>(x), 2.0);
}

BOOST_AUTO_TEST_CASE(test_dynamic_fail)
{
    typedef ::boost::mpl::vector<destructible<>, typeid_<>, assignable<>, relaxed> test_concept;
    any<test_concept> x(1);
    any<test_concept> y(2.0);
    BOOST_CHECK_THROW(x = y, bad_function_call);
}

BOOST_AUTO_TEST_CASE(test_basic_int)
{
    typedef ::boost::mpl::vector<common<>, assignable<_self, int> > test_concept;
    any<test_concept> x(1);
    int* ip = any_cast<int*>(&x);
    x = 2;
    BOOST_CHECK_EQUAL(any_cast<int>(x), 2);
    // make sure that we're actually using assignment
    // of the underlying object, not copy and swap.
    BOOST_CHECK_EQUAL(any_cast<int*>(&x), ip);
}

BOOST_AUTO_TEST_CASE(test_basic_relaxed_int)
{
    typedef ::boost::mpl::vector<common<>, assignable<_self, int>, relaxed > test_concept;
    any<test_concept> x(1);
    int* ip = any_cast<int*>(&x);
    x = 2;
    BOOST_CHECK_EQUAL(any_cast<int>(x), 2);
    // make sure that we're actually using assignment
    // of the underlying object, not copy and swap.
    BOOST_CHECK_EQUAL(any_cast<int*>(&x), ip);
}

BOOST_AUTO_TEST_CASE(test_relaxed_no_copy_int)
{
    typedef ::boost::mpl::vector<
        destructible<>,
        typeid_<>,
        assignable<_self, int>,
        relaxed
    > test_concept;
    any<test_concept> x(1);
    int* ip = any_cast<int*>(&x);
    x = 2;
    BOOST_CHECK_EQUAL(any_cast<int>(x), 2);
    // make sure that we're actually using assignment
    // of the underlying object, not copy and swap.
    BOOST_CHECK_EQUAL(any_cast<int*>(&x), ip);
}

BOOST_AUTO_TEST_CASE(test_relaxed_no_assign_int)
{
    typedef ::boost::mpl::vector<
        common<>,
        relaxed
    > test_concept;
    any<test_concept> x(1);
    x = 2;
    BOOST_CHECK_EQUAL(any_cast<int>(x), 2);
}

BOOST_AUTO_TEST_CASE(test_basic_ref)
{
    typedef ::boost::mpl::vector<common<>, assignable<> > test_concept;
    int i = 1;
    any<test_concept, _self&> x(i);
    any<test_concept> y(2);
    x = y;
    BOOST_CHECK_EQUAL(i, 2);
}

BOOST_AUTO_TEST_CASE(test_basic_relaxed_ref)
{
    typedef ::boost::mpl::vector<common<>, assignable<>, relaxed > test_concept;
    int i = 1;
    any<test_concept, _self&> x(i);
    any<test_concept> y(2);
    x = y;
    BOOST_CHECK_EQUAL(i, 2);
}

BOOST_AUTO_TEST_CASE(test_relaxed_no_assign_ref)
{
    typedef ::boost::mpl::vector<
        common<>,
        relaxed
    > test_concept;
    int i = 1;
    any<test_concept, _self&> x(i);
    any<test_concept> y(2);
    x = y;
    BOOST_CHECK_EQUAL(i, 1);
    BOOST_CHECK_EQUAL(any_cast<int*>(&x), any_cast<int*>(&y));
}

BOOST_AUTO_TEST_CASE(test_dynamic_fallback_ref)
{
    typedef ::boost::mpl::vector<common<>, assignable<>, relaxed> test_concept;
    int i = 1;
    any<test_concept, _self&> x(i);
    any<test_concept> y(2.0);
    x = y;
    BOOST_CHECK_EQUAL(any_cast<double>(x), 2.0);
}