text:
<title>Creating and Freeing a Hash Table - Untitled</title>
<meta http-equiv="Content-Type" content="text/html">
<meta name="description" content="Untitled">
<meta name="generator" content="makeinfo 4.13">
<link title="Top" rel="start" href="index.html#Top">
<link rel="up" href="Hash-Tables.html#Hash-Tables" title="Hash Tables">
<link rel="prev" href="Hash-Tables.html#Hash-Tables" title="Hash Tables">
<link rel="next" href="Looking-Up-or-Entering-a-String.html#Looking-Up-or-Entering-a-String" title="Looking Up or Entering a String">
<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">

<meta http-equiv="Content-Style-Type" content="text/css">

Next: Looking Up or Entering a String,
Previous: Hash Tables,
Up: Hash Tables

2.18.1 Creating and freeing a hash table

To create a hash table, create an instance of a struct
bfd_hash_table (defined in bfd.h) and call
bfd_hash_table_init (if you know approximately how many
entries you will need, the function bfd_hash_table_init_n,
which takes a <var>size</var> argument, may be used).
bfd_hash_table_init returns FALSE if some sort of
error occurs.

The function bfd_hash_table_init take as an argument a
function to use to create new entries.  For a basic hash
table, use the function bfd_hash_newfunc.  See Deriving a New Hash Table Type, for why you would want to use a
different value for this argument.

bfd_hash_table_init will create an objalloc which will be
used to allocate new entries.  You may allocate memory on this
objalloc using bfd_hash_allocate.

Use bfd_hash_table_free to free up all the memory that has
been allocated for a hash table.  This will not free up the
struct bfd_hash_table itself, which you must provide.

Use bfd_hash_set_default_size to set the default size of
hash table to use.

redpajama_set_name: RedPajamaGithub


text:
SYNONYM

#### According to
The Catalogue of Life, 3rd January 2011

#### Published in
Liliac. 3: t. 179. 1807

#### Original name
null

### Remarks
null


text:
require "chef/util/windows"
require "chef/win32/net"

# wrapper around a subset of the NetGroup* APIs.
class Chef::Util::Windows::NetGroup

  private

  def groupname
    @groupname
  end

  public

  def initialize(groupname)
    @groupname = groupname
  end

  def local_get_members
    Chef::ReservedNames::Win32::NetUser.net_local_group_get_members(nil, groupname)
  rescue Chef::Exceptions::Win32APIError => e
    raise ArgumentError, e
  end

  def local_add
    Chef::ReservedNames::Win32::NetUser.net_local_group_add(nil, groupname)
  rescue Chef::Exceptions::Win32APIError => e
    raise ArgumentError, e
  end

  def local_set_members(members)
    Chef::ReservedNames::Win32::NetUser.net_local_group_set_members(nil, groupname, members)
  rescue Chef::Exceptions::Win32APIError => e
    raise ArgumentError, e
  end

  def local_add_members(members)
    Chef::ReservedNames::Win32::NetUser.net_local_group_add_members(nil, groupname, members)
  rescue Chef::Exceptions::Win32APIError => e
    raise ArgumentError, e
  end

  def local_group_set_info(comment)
    Chef::ReservedNames::Win32::NetUser.net_local_group_set_info(nil, groupname, comment)
  rescue Chef::Exceptions::Win32APIError => e
    raise ArgumentError, e
  end

  def local_delete_members(members)
    Chef::ReservedNames::Win32::NetUser.net_local_group_del_members(nil, groupname, members)
  rescue Chef::Exceptions::Win32APIError => e
    raise ArgumentError, e
  end

  def local_delete
    Chef::ReservedNames::Win32::NetUser.net_local_group_del(nil, groupname)
  rescue Chef::Exceptions::Win32APIError => e
    raise ArgumentError, e
  end
end


text:
"""
Makes and checks secure hashed strings
for use as cookies to enable usernames
"""

import hashlib
import hmac
import myapp.tools.secret_stuff

def hash_str(name):
    """Hashes the var name along with a secret string"""
    return hmac.new(myapp.tools.secret_stuff.SECRET,
                    name.encode('utf-8'), hashlib.md5).hexdigest()

def make_secure_val(name):
    """Combines string name with a hash, separated by | """
    h_name = hash_str(name)
    return name + "|" + h_name

def check_secure_val(h_name):
    """checks the secure value, splitting the username before | and
    the hashed string after"""
    val = h_name.split('|')[0]
    if h_name == make_secure_val(val):
        return val


text:
class LinuxSDLEnvironment : public SDLEnvironment
{
public:
	LinuxSDLEnvironment();
	virtual ~LinuxSDLEnvironment() {;}

	// system
	virtual OS getOS();
	virtual void sleep(unsigned int us);
	virtual void openURLInDefaultBrowser(UString url);

	// user
	virtual UString getUsername();
	virtual UString getUserDataPath();

	// file IO
	virtual bool directoryExists(UString directoryName);
	virtual bool createDirectory(UString directoryName);
	virtual std::vector<UString> getFilesInFolder(UString folder);
	virtual std::vector<UString> getFoldersInFolder(UString folder);
	virtual std::vector<UString> getLogicalDrives();
	virtual UString getFolderFromFilePath(UString filepath);

private:
	static int getFilesInFolderFilter(const struct dirent *entry);
	static int getFoldersInFolderFilter(const struct dirent *entry);
};

#endif

#endif

#endif


text:
<?php

declare(strict_types=1);

namespace BlockHorizons\BlockSniper\commands\cloning;

use BlockHorizons\BlockSniper\cloning\types\CopyType;
use BlockHorizons\BlockSniper\cloning\types\TemplateType;
use BlockHorizons\BlockSniper\commands\BaseCommand;
use BlockHorizons\BlockSniper\data\Translation;
use BlockHorizons\BlockSniper\exceptions\InvalidBlockException;
use BlockHorizons\BlockSniper\Loader;
use BlockHorizons\BlockSniper\sessions\SessionManager;
use BlockHorizons\libschematic\Schematic;
use pocketmine\command\CommandSender;
use pocketmine\Player;
use pocketmine\utils\TextFormat;
use pocketmine\utils\TextFormat as TF;

class CloneCommand extends BaseCommand{

	public function __construct(Loader $loader){
		parent::__construct($loader, "clone", Translation::COMMANDS_CLONE_DESCRIPTION, "/clone <copy|schematic|template> [name]");
	}

	public function onExecute(CommandSender $sender, string $commandLabel, array $args) : void{
		/** @var Player $sender */
		if(!isset($args[0])){
			$sender->sendMessage($this->getUsage());

			return;
		}

		$center = $sender->getTargetBlock(100);
		if($center === null){
			throw new InvalidBlockException("No valid block could be found when attempting to clone.");
		}

		$session = SessionManager::getPlayerSession($sender);

		if(!$session->getSelection()->ready()){
			$sender->sendMessage(
				TextFormat::RED . Translation::get(Translation::COMMANDS_COMMON_WARNING_PREFIX) .
				Translation::get(Translation::BRUSH_SELECTION_ERROR)
			);

			return;
		}

		$size = SessionManager::getPlayerSession($sender)->getBrush()->size;
		$shape = $session->getBrush()->getShape($session->getSelection()->box());

		switch(strtolower($args[0])){
			default:
			case "copy":
				$cloneType = new CopyType($sender, false, $center, $shape);
				$cloneType->saveClone();
				$sender->sendMessage(TF::GREEN . Translation::get(Translation::COMMANDS_CLONE_COPY_SUCCESS));

				return;

			case "template":
				if(!isset($args[1])){
					$sender->sendMessage($this->getWarning() . Translation::get(Translation::COMMANDS_CLONE_TEMPLATE_MISSING_NAME));

					return;
				}
				$cloneType = new TemplateType($sender, false, $center, $shape, $args[1]);
				$cloneType->saveClone();
				$sender->sendMessage(TF::GREEN . Translation::get(Translation::COMMANDS_CLONE_TEMPLATE_SUCCESS, [$this->loader->getDataFolder() . "templates/" . $args[1] . ".template"]));

				return;

			case "scheme":
			case "schem":
			case "schematic":
				if(!isset($args[1])){
					$sender->sendMessage($this->getWarning() . Translation::get(Translation::COMMANDS_CLONE_SCHEMATIC_MISSING_NAME));

					return;
				}

				$blocks = [];
				foreach($shape->getBlocksInside() as $block){
					$blocks[] = $block;
				}

				$schematic = new Schematic();
				$schematic
					->setBlocks($blocks)
					->setMaterials(Schematic::MATERIALS_POCKET)
					->encode()
					->setLength($size * 2 + 1)
					->setHeight($size * 2 + 1)
					->setWidth($size * 2 + 1)
					->save($this->loader->getDataFolder() . "schematics/" . $args[1] . ".schematic");
				$sender->sendMessage(TF::GREEN . Translation::get(Translation::COMMANDS_CLONE_SCHEMATIC_SUCCESS, [$this->loader->getDataFolder() . "templates/" . $args[1] . ".schematic"]));
		}
	}
}


text:
package modules;

import modules.maps.CommonControlMap;

public interface CommonControl{
	public default void clickNext() {
		CommonControlMap btn = new CommonControlMap();
		//btn.
	}
}


text:
package org.develnext.jphp.core.tokenizer.token.stmt;

import org.develnext.jphp.core.tokenizer.TokenMeta;
import org.develnext.jphp.core.tokenizer.TokenType;

public class UsesStmtToken extends StmtToken {
    public UsesStmtToken(TokenMeta meta) {
        super(meta, TokenType.T_STRING);
    }
}


text:
/**
 *
 */
package net.paoding.rose.jade.plugin.sql.mapper;

import java.lang.annotation.Annotation;
import java.lang.reflect.GenericDeclaration;
import java.lang.reflect.Method;
import java.lang.reflect.ParameterizedType;
import java.lang.reflect.Type;
import java.lang.reflect.TypeVariable;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.List;

import net.paoding.rose.jade.annotation.SQLParam;
import net.paoding.rose.jade.plugin.sql.GenericDAO;
import net.paoding.rose.jade.plugin.sql.Plum;
import net.paoding.rose.jade.plugin.sql.annotations.IgnoreNull;
import net.paoding.rose.jade.statement.StatementMetaData;

/**
 * @author Alan.Geng[gengzhi718@gmail.com]
 *
 */
public class OperationMapper extends AbstractMapper<StatementMetaData> implements IOperationMapper {

	private IEntityMapper targetEntityMapper;

	private List<IParameterMapper> parameters;

	private EntityMapperManager entityMapperManager;

	private Class<?> entityType;

	private Class<?> primaryKeyType;

	private IgnoreNull ignoreNull;

	public static final List<IParameterMapper> NO_PARAMETER = Collections.unmodifiableList(new ArrayList<IParameterMapper>());

	public OperationMapper(StatementMetaData original) {
		super(original);
	}

	@Override
	public IEntityMapper getTargetEntityMapper() {
		return targetEntityMapper;
	}

	@Override
	protected void doMap() {
		ignoreNull = original.getAnnotation(IgnoreNull.class);
		mapGenericEntityType();
		mapTargetEntityMapper();
		mapParameters();
	}

	protected void mapGenericEntityType() {
		entityType = original.getDAOMetaData().resolveTypeVariable(GenericDAO.class, "E");
		primaryKeyType = original.getDAOMetaData().resolveTypeVariable(GenericDAO.class, "ID");
		if(entityType == null) {
			throw new MappingException("Cannot find the generic type.");
		}
	}

	protected void mapTargetEntityMapper() {
		targetEntityMapper = entityMapperManager.createGet((Class<?>) entityType);
	}

	protected void mapParameters() {
		Method method = original.getMethod();
		Type[] parameterTypes = method.getGenericParameterTypes();
		Annotation[][] parameterAnnotations = method.getParameterAnnotations();

		if(parameterTypes == null
				|| parameterTypes.length == 0) {
			parameters = NO_PARAMETER;

			if((getName() == OPERATION_INSERT
					|| getName() == OPERATION_DELETE
					|| getName() == OPERATION_UPDATE)
					&& parameters == NO_PARAMETER) {
				// 写操作必须存在参数
				throw new MappingException("The insert operation must has least 1 parameters.");
			}

			return;
		}

		parameters = new ArrayList<IParameterMapper>(parameterAnnotations.length);

		for(int i = 0; i < parameterAnnotations.length; i++) {
			// TODO: 是否要进行参数类型检查?
			IParameterMapper parameterMapper = createParameterMapper(resolveParameterType(parameterTypes[i]), parameterAnnotations[i], i);
			if(parameterMapper != null) {
				parameters.add(parameterMapper);
			}
		}
	}

	protected Class<?> resolveParameterType(Type type) {
		if(type instanceof Class) {
			return (Class<?>) type;
		} else if(type instanceof ParameterizedType
				&& ((ParameterizedType) type).getRawType() instanceof Class
				&& Collection.class.isAssignableFrom((Class<?>) ((ParameterizedType) type).getRawType())) {

			// GenericDAO中的集合泛型参数
			return resolveParameterType(((ParameterizedType) type).getActualTypeArguments()[0]);
		} else if(type instanceof TypeVariable) {

			// GenericDAO中的非集合泛型参数,或许是主键或许是实体。
			GenericDeclaration genericDeclaration = ((TypeVariable<?>) type).getGenericDeclaration();
			if(genericDeclaration == GenericDAO.class) {
				Type[] bounds = ((TypeVariable<?>) type).getBounds();

				if(bounds[0] == Object.class) {
					String name = ((TypeVariable<?>) type).getName();
					if("E".equals(name)) {
						return entityType;
					} else if("ID".equals(name)) {
						return primaryKeyType;
					} else {
						throw new MappingException("Unknown type variable \"" + type + "\".");
					}
				} else {
					return resolveParameterType(bounds[0]);
				}
			} else {
				throw new MappingException("Unsupported generic declaration \"" + genericDeclaration + "\".");
			}
		}
		throw new MappingException("Unknown type \"" + type + "\".");
	}

	protected Type[] getCollectionTypeBounds(Class<?> collectionType) {
		TypeVariable<?>[] typeParameters = collectionType.getTypeParameters();
		if(typeParameters.length == 0) {
			throw new MappingException("The generic type of collection must be specified.");
		}
		TypeVariable<?> typeVariable = collectionType.getTypeParameters()[0];
		return typeVariable.getBounds();
	}

	protected IParameterMapper createParameterMapper(Class<?> type, Annotation[] annotations, int index) {
		SQLParam sp = null;

		if(annotations != null && annotations.length > 0) {
			for(Annotation annotation : annotations) {
				if(annotation.annotationType().equals(SQLParam.class)) {
					sp = (SQLParam) annotation;
					break;
				}
			}
		}

		IParameterMapper param = null;
		if(isExpandableParameterType(type)) {
			param = new ExpandableParameterMapper(this, sp, (Class<?>) type);
			((ExpandableParameterMapper) param).setEntityMapperManager(entityMapperManager);
		} else {
			param = new ParameterMapper(this, sp, type, annotations);
		}
		param.map();

		return param;
	}

	protected boolean isExpandableParameterType(Class<?> type) {
		if(entityType.isAssignableFrom(type)) {
			return true;
		}
		return false;
	}

	@Override
	public boolean containsParameter() {
		return parameters != NO_PARAMETER;
	}

	@Override
	protected String generateOriginalName() {
		return original.getMethod().getName();
	}

	@Override
	public String generateName(String source) {
		for(int i = 0; i < OPERATION_PREFIX.length; i++) {
			String[] prefixs = OPERATION_PREFIX[i];
			for(int j = 0; j < prefixs.length; j++) {
				if(source.startsWith(prefixs[j])) {
					return OPERATION_KEYS[i];
				}
			}
		}
		throw new MappingException("Unsupported method \"" + source + "\".");
	}

	public void setEntityMapperManager(EntityMapperManager entityMapperManager) {
		this.entityMapperManager = entityMapperManager;
	}

	@Override
	public List<IParameterMapper> getParameters() {
		return parameters;
	}

	public Class<?> getPrimaryKeyType() {
		return primaryKeyType;
	}

	public Class<?> getEntityType() {
		return entityType;
	}

	@Override
	public boolean isIgnoreNull() {
		return ignoreNull == null ? true : Plum.DEFAULT_IGNORE_NULL;
	}

	@Override
	public IgnoreNull getIgnoreNull() {
		return ignoreNull;
	}

}


text:
"""
Use this file to initialize all authentication plugins.

The "setup" method will be executed by hubcommander on startup.
"""
#from auth_plugins.duo.plugin import DuoPlugin

AUTH_PLUGINS = {
    #"duo": DuoPlugin()
}


text:
package org.spongepowered.common.item.inventory.lens.impl.slots;

import org.spongepowered.api.item.ItemType;
import org.spongepowered.api.item.inventory.Inventory;
import org.spongepowered.api.item.inventory.ItemStack;
import org.spongepowered.common.item.inventory.adapter.InventoryAdapter;
import org.spongepowered.common.item.inventory.adapter.impl.slots.CraftingOutputAdapter;
import org.spongepowered.common.item.inventory.lens.Fabric;
import org.spongepowered.common.item.inventory.lens.slots.CraftingOutputSlotLens;

import java.util.function.Predicate;

public class CraftingOutputSlotLensImpl extends OutputSlotLensImpl implements CraftingOutputSlotLens {

    public CraftingOutputSlotLensImpl(int index, Predicate<ItemStack> stackFilter, Predicate<ItemType> typeFilter) {
        this(index, CraftingOutputAdapter.class, stackFilter, typeFilter);
    }

    public CraftingOutputSlotLensImpl(int index, Class<? extends Inventory> adapterType, Predicate<ItemStack> stackFilter, Predicate<ItemType> typeFilter) {
        super(index, adapterType, stackFilter, typeFilter);
    }

    @Override
    public InventoryAdapter getAdapter(Fabric inv, Inventory parent) {
        return new CraftingOutputAdapter(inv, this, parent);
    }

}


text:
package com.ketayao.fensy.util;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.nio.channels.FileChannel;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;

public class FileUtils {
    /**
     * The number of bytes in a kilobyte.
     */
    public static final long    ONE_KB                = 1024;

    /**
     * The number of bytes in a megabyte.
     */
    public static final long    ONE_MB                = ONE_KB * ONE_KB;

    /**
     * The file copy buffer size (30 MB)
     */
    private static final long   FILE_COPY_BUFFER_SIZE = ONE_MB * 30;
    private static final String MSG_NOT_A_DIRECTORY   = "Not a directory: ";
    private static final String MSG_NOT_FOUND         = "Not found: ";
    private static final String MSG_NOT_A_FILE        = "Not a file: ";
    private static final String MSG_UNABLE_TO_DELETE  = "Unable to delete: ";

    public static void deleteDir(File dest) throws IOException {
        deleteDir(dest, true);
    }

    /**
     * Deletes a directory.
     */
    public static void deleteDir(File dest, boolean recursive) throws IOException {
        cleanDir(dest, recursive);
        if (dest.delete() == false) {
            throw new IOException(MSG_UNABLE_TO_DELETE + dest);
        }
    }

    /**
     * Cleans a directory without deleting it.
     */
    public static void cleanDir(File dest, boolean recursive) throws IOException {
        if (dest.exists() == false) {
            throw new FileNotFoundException(MSG_NOT_FOUND + dest);
        }

        if (dest.isDirectory() == false) {
            throw new IOException(MSG_NOT_A_DIRECTORY + dest);
        }

        File[] files = dest.listFiles();
        if (files == null) {
            throw new IOException("Failed to list contents of: " + dest);
        }

        for (File file : files) {
            try {
                if (file.isDirectory()) {
                    if (recursive == true) {
                        deleteDir(file, recursive);
                    }
                } else {
                    file.delete();
                }
            } catch (IOException ioex) {
                throw ioex;
            }
        }
    }

    public static Collection<File> listFiles(File root, String[] suffix, boolean recursive) {
        List<File> files = new ArrayList<File>();
        listFiles(files, root, suffix, recursive);
        return files;
    }

    static void listFiles(List<File> files, File dir, String[] suffix, boolean recursive) {
        File[] listFiles = dir.listFiles();
        for (File f : listFiles) {
            if (f.isFile()) {
                String extension = FilenameUtils.getExtension(f.getName());
                for (String e : suffix) {
                    if (StringUtils.endsWithIgnoreCase(e, extension)) {
                        files.add(f);
                        break;
                    }
                }
            } else if (f.isDirectory() && recursive) {
                listFiles(files, f, suffix, recursive);
            }
        }
    }

    /**
     * Copies a file to a new location preserving the file date.
     *

     * This method copies the contents of the specified source file to the
     * specified destination file. The directory holding the destination file is
     * created if it does not exist. If the destination file exists, then this
     * method will overwrite it.
     *

     * Note: This method tries to preserve the file's last
     * modified date/times using {@link File#setLastModified(long)}, however
     * it is not guaranteed that the operation will succeed.
     * If the modification operation fails, no indication is provided.
     *
     * @param srcFile  an existing file to copy, must not be {@code null}
     * @param destFile  the new file, must not be {@code null}
     *
     * @throws NullPointerException if source or destination is {@code null}
     * @throws IOException if source or destination is invalid
     * @throws IOException if an IO error occurs during copying
     * @see #copyFileToDirectory(File, File)
     */
    public static void copyFile(File srcFile, File destFile) throws IOException {
        copyFile(srcFile, destFile, true);
    }

    /**
     * Copies a file to a new location.
     *

     * This method copies the contents of the specified source file
     * to the specified destination file.
     * The directory holding the destination file is created if it does not exist.
     * If the destination file exists, then this method will overwrite it.
     *

     * Note: Setting preserveFileDate to
     * {@code true} tries to preserve the file's last modified
     * date/times using {@link File#setLastModified(long)}, however it is
     * not guaranteed that the operation will succeed.
     * If the modification operation fails, no indication is provided.
     *
     * @param srcFile  an existing file to copy, must not be {@code null}
     * @param destFile  the new file, must not be {@code null}
     * @param preserveFileDate  true if the file date of the copy
     *  should be the same as the original
     *
     * @throws NullPointerException if source or destination is {@code null}
     * @throws IOException if source or destination is invalid
     * @throws IOException if an IO error occurs during copying
     * @see #copyFileToDirectory(File, File, boolean)
     */
    public static void copyFile(File srcFile, File destFile,
                                boolean preserveFileDate) throws IOException {
        if (srcFile == null) {
            throw new NullPointerException("Source must not be null");
        }
        if (destFile == null) {
            throw new NullPointerException("Destination must not be null");
        }
        if (srcFile.exists() == false) {
            throw new FileNotFoundException("Source '" + srcFile + "' does not exist");
        }
        if (srcFile.isDirectory()) {
            throw new IOException("Source '" + srcFile + "' exists but is a directory");
        }
        if (srcFile.getCanonicalPath().equals(destFile.getCanonicalPath())) {
            throw new IOException(
                "Source '" + srcFile + "' and destination '" + destFile + "' are the same");
        }
        File parentFile = destFile.getParentFile();
        if (parentFile != null) {
            if (!parentFile.mkdirs() && !parentFile.isDirectory()) {
                throw new IOException(
                    "Destination '" + parentFile + "' directory cannot be created");
            }
        }
        if (destFile.exists() && destFile.canWrite() == false) {
            throw new IOException("Destination '" + destFile + "' exists but is read-only");
        }
        doCopyFile(srcFile, destFile, preserveFileDate);
    }

    /**
     * Internal copy file method.
     *
     * @param srcFile  the validated source file, must not be {@code null}
     * @param destFile  the validated destination file, must not be {@code null}
     * @param preserveFileDate  whether to preserve the file date
     * @throws IOException if an error occurs
     */
    private static void doCopyFile(File srcFile, File destFile,
                                   boolean preserveFileDate) throws IOException {
        if (destFile.exists() && destFile.isDirectory()) {
            throw new IOException("Destination '" + destFile + "' exists but is a directory");
        }

        FileInputStream fis = null;
        FileOutputStream fos = null;
        FileChannel input = null;
        FileChannel output = null;
        try {
            fis = new FileInputStream(srcFile);
            fos = new FileOutputStream(destFile);
            input = fis.getChannel();
            output = fos.getChannel();
            long size = input.size();
            long pos = 0;
            long count = 0;
            while (pos < size) {
                count = size - pos > FILE_COPY_BUFFER_SIZE ? FILE_COPY_BUFFER_SIZE : size - pos;
                pos += output.transferFrom(input, pos, count);
            }
        } finally {
            IOUtils.closeQuietly(output);
            IOUtils.closeQuietly(fos);
            IOUtils.closeQuietly(input);
            IOUtils.closeQuietly(fis);
        }

        if (srcFile.length() != destFile.length()) {
            throw new IOException(
                "Failed to copy full contents from '" + srcFile + "' to '" + destFile + "'");
        }
        if (preserveFileDate) {
            destFile.setLastModified(srcFile.lastModified());
        }
    }

    public static void deleteFile(File dest) throws IOException {
        if (dest.exists() == false) {
            throw new FileNotFoundException(MSG_NOT_FOUND + dest);
        }
        if (dest.isFile() == false) {
            throw new IOException(MSG_NOT_A_FILE + dest);
        }
        if (dest.delete() == false) {
            throw new IOException(MSG_UNABLE_TO_DELETE + dest);
        }
    }
}


text:
// -----------------------------------------------------------------------
//  <copyright file="IDbContextOptionsBuilderDriveHandler.cs" company="OSharp开源团队">
//      Copyright (c) 2014-2019 OSharp. All rights reserved.
//  </copyright>
//  <site>http://www.osharp.org</site>
//  <last-editor>郭明锋</last-editor>
//  <last-date>2019-03-27 3:06</last-date>
// -----------------------------------------------------------------------

using System.Data.Common;

using Microsoft.EntityFrameworkCore;

namespace OSharp.Entity
{
    /// <summary>
    /// 定义<see cref="DbContextOptionsBuilder"/> 数据库驱动差异处理器
    /// </summary>
    public interface IDbContextOptionsBuilderDriveHandler
    {
        /// <summary>
        /// 获取 数据库类型名称,如 SQLSERVER,MYSQL,SQLITE等
        /// </summary>
        DatabaseType Type { get; }

        /// <summary>
        /// 处理<see cref="DbContextOptionsBuilder"/>驱动差异
        /// </summary>
        /// <param name="builder">创建器</param>
        /// <param name="connectionString">连接字符串</param>
        /// <param name="existingConnection">已存在的连接对象</param>
        /// <returns></returns>
        DbContextOptionsBuilder Handle(DbContextOptionsBuilder builder, string connectionString, DbConnection existingConnection);
    }
}


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Drawing;
using System.Globalization;
using ApkQuickReader;
using System.IO;

namespace ApkShellext2 {
    /// <summary>
    /// This is the base class for package reader
    /// defines common method a package reader should have
    /// for reusing and simplify in the code
    /// </summary>
    public class AppPackageReader : IDisposable{
        public const string extAPK = ".apk";
        public const string extIPA = ".ipa";
        public const string extAPPX = ".appx";
        public const string extAPPXBUNDLE = ".appxbundle";

        public enum AppType {
            AndroidApp,
            iOSApp,
            WindowsPhoneAppBundle,
            WindowsPhoneApp
        }
        private Dictionary<string, object> Flags;

        public virtual string FileName { get; protected set; }
        // App name
        public virtual string AppName { get { return ""; } }
        // Package Name
        public virtual string PackageName { get { return ""; } }

        // App version
        public virtual string Version { get { return ""; } }
        // Sub version
        public virtual string Revision { get { return ""; } }

        public virtual CultureInfo Culture { get; set; }

        // Publisher
        public virtual string Publisher { get { return ""; } }

        public virtual Bitmap Icon { get { return null; } }

        public virtual string AppID { get { return ""; } }

        public virtual AppType Type { get { return AppType.AndroidApp; } }

        // use for other information, or file type specific info
        public virtual void setFlag(string flag, object value) {
            if (Flags == null)
                Flags = new Dictionary<string, object>();
            Flags[flag] = value;
        }

        public virtual object getFlag(string flag) {
            if (Flags != null && Flags.ContainsKey(flag))
                return Flags[flag];
            else
                return null;
        }

        public virtual Bitmap getIcon(Size size) {
            return Utility.ResizeBitmap(Icon, size);
        }

        // Public implementation of Dispose pattern callable by consumers.
        public void Dispose() {
            Dispose(true);
            GC.SuppressFinalize(this);
        }

        bool disposed;
        // Protected implementation of Dispose pattern.
        protected virtual void Dispose(bool disposing) {
            if (disposed)
                return;
            if (Flags != null)
                Flags.Clear();
            Flags = null;
            disposed = true;
        }

        public static AppType getAppType(string path) {
            string suffix = Path.GetExtension(path);
            if (suffix == extAPK) {
                return AppType.AndroidApp;
            } else if (suffix == extIPA) {
                return AppType.iOSApp;
            } else if (suffix == extAPPXBUNDLE) {
                return AppType.WindowsPhoneAppBundle;
            } else if (suffix == extAPPX) {
                return AppType.WindowsPhoneApp;
            } else {
                throw new NotSupportedException(suffix + " type is not supported.");
            }
        }

        public static AppPackageReader Read(string path) {
            switch (getAppType(path)) {
                case AppType.AndroidApp:
                    return new ApkReader(path);
                case AppType.iOSApp:
                    return new IpaReader(path);
                case AppType.WindowsPhoneAppBundle:
                    return new AppxBundleReader(path);
                case AppType.WindowsPhoneApp:
                    return new AppxReader(path);
                default :
                    throw new NotSupportedException("File type is not supported.");
            }
        }

        protected void Log(string message) {
            Utility.Log(this, Path.GetFileName(FileName), message);
        }
    }
}


text:
define(['jquery','jqueryui/datepicker'], function (jQuery) {
/* Croatian i18n for the jQuery UI date picker plugin. */
/* Written by Vjekoslav Nesek. */
jQuery(function($){
	$.datepicker.regional['hr'] = {
		closeText: 'Zatvori',
		prevText: '<',
		nextText: '>',
		currentText: 'Danas',
		monthNames: ['Siječanj','Veljača','Ožujak','Travanj','Svibanj','Lipanj',
		'Srpanj','Kolovoz','Rujan','Listopad','Studeni','Prosinac'],
		monthNamesShort: ['Sij','Velj','Ožu','Tra','Svi','Lip',
		'Srp','Kol','Ruj','Lis','Stu','Pro'],
		dayNames: ['Nedjelja','Ponedjeljak','Utorak','Srijeda','Četvrtak','Petak','Subota'],
		dayNamesShort: ['Ned','Pon','Uto','Sri','Čet','Pet','Sub'],
		dayNamesMin: ['Ne','Po','Ut','Sr','Če','Pe','Su'],
		weekHeader: 'Tje',
		dateFormat: 'dd.mm.yy.',
		firstDay: 1,
		isRTL: false,
		showMonthAfterYear: false,
		yearSuffix: ''};
	$.datepicker.setDefaults($.datepicker.regional['hr']);
});

});


text:
package com.thoughtworks.go.domain;

import com.thoughtworks.go.config.Agent;
import org.junit.jupiter.api.Nested;
import org.junit.jupiter.api.Test;

import static com.thoughtworks.go.config.JobConfig.RESOURCES;
import static java.util.Arrays.asList;
import static java.util.Collections.emptyList;
import static java.util.Collections.singletonList;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.*;
import static org.junit.jupiter.api.Assertions.*;

class AgentTest {
    @Test
    void shouldCopyAllFieldsFromAnotherAgentObjectUsingCopyConstructor() {
        Agent origAgent = new Agent("uuid", "host", "127.0.0.1", "cookie");
        origAgent.addResources(asList("Resource1", "Resource2"));
        origAgent.addEnvironments(asList("dev", "test"));

        Agent copiedAgent = new Agent(origAgent);
        assertEquals(origAgent, copiedAgent);
    }

    @Test
    void cookieAssignedShouldReturnTrueWhenAgentHasCookie() {
        Agent agent = new Agent("uuid", "host", "127.0.0.1", "cookie");
        assertThat(agent.cookieAssigned(), is(true));
    }

    @Test
    void cookieAssignedShouldReturnFalseWhenAgentDoesNotHaveCookie() {
        Agent agent = new Agent("uuid", "host", "127.0.0.1");
        assertThat(agent.cookieAssigned(), is(false));
    }

    @Nested
    class IPAddress {
        @Test
        void agentWithNoIpAddressShouldBeValid() {
            Agent agent = new Agent("uuid", null, null);
            agent.validate();
            assertFalse(agent.hasErrors());
        }

        @Test
        void shouldValidateIpCorrectIPv4Address() {
            shouldBeValid("127.0.0.1");
            shouldBeValid("0.0.0.0");
            shouldBeValid("255.255.0.0");
            shouldBeValid("0:0:0:0:0:0:0:1");
        }

        @Test
        void shouldValidateIpCorrectIPv6Address() {
            shouldBeValid("0:0:0:0:0:0:0:1");
        }

        @Test
        void shouldFailValidationIfIPAddressIsInvalid1() {
            Agent agent = new Agent("uuid", "host", "blahinvalid");
            agent.validate();
            assertThat(agent.errors().on(Agent.IP_ADDRESS), is("'blahinvalid' is an invalid IP address."));

            agent = new Agent("uuid", "host", "blah.invalid");
            agent.validate();
            assertThat(agent.errors().on(Agent.IP_ADDRESS), is("'blah.invalid' is an invalid IP address."));
        }

        @Test
        void shouldFailValidationIfIPAddressIsInvalid2() {
            Agent agent = new Agent("uuid", "host", "399.0.0.1");
            agent.validate();
            assertThat(agent.errors().on(Agent.IP_ADDRESS), is("'399.0.0.1' is an invalid IP address."));
        }

        @Test
        void shouldInvalidateEmptyIpAddress() {
            Agent agent = new Agent("uuid", "host", "");
            agent.validate();
            assertThat(agent.errors().on(Agent.IP_ADDRESS), is("IpAddress cannot be empty if it is present."));
        }

        private void shouldBeValid(String ipAddress) {
            Agent agent = new Agent("some-dummy-uuid");
            agent.setIpaddress(ipAddress);
            agent.validate();
            assertThat(agent.errors().on(Agent.IP_ADDRESS), is(nullValue()));
        }
    }

    @Nested
    class Resources {
        @Nested
        class AddResources {
            @Test
            void shouldAddResourceWithValidResourceName() {
                Agent agent = new Agent("uuid", "cookie", "host", "127.0.0.1");
                assertThat(agent.getResources(), is(emptyString()));

                agent.addResource("r1");
                assertThat(agent.getResources(), is("r1"));

                agent.addResource("r2");
                assertThat(agent.getResources(), is("r1,r2"));
            }

            @Test
            void shouldAddResourceWithResourceNameContainingLeadingAndTrailingSpaces() {
                Agent agent = new Agent("uuid", "cookie", "host", "127.0.0.1");
                assertThat(agent.getResources(), is(emptyString()));

                agent.addResource("  r1");
                assertThat(agent.getResources(), is("r1"));

                agent.addResource("r2      ");
                assertThat(agent.getResources(), is("r1,r2"));

                agent.addResource(" r3 ");
                assertThat(agent.getResources(), is("r1,r2,r3"));
            }

            @Test
            void shouldDoNothingWhenEmptyResourceNameIsSpecified() {
                Agent agent = new Agent("uuid", "cookie", "host", "127.0.0.1");
                assertThat(agent.getResources(), is(emptyString()));

                agent.addResource("  ");
                assertThat(agent.getResources(), is(emptyString()));

                agent.addResource("");
                assertThat(agent.getResources(), is(emptyString()));
            }

            @Test
            void shouldDoNothingWhenNullCommaSeparatedStringOfResourceNamesIsSpecified() {
                Agent agent = new Agent("uuid", "cookie", "host", "127.0.0.1");
                agent.setResources(null);
                assertThat(agent.getResources(), is(nullValue()));
            }

            @Test
            void shouldDoNothingWhenNullResourceNameIsSpecified() {
                Agent agent = new Agent("uuid", "cookie", "host", "127.0.0.1");
                assertThat(agent.getResources(), is(emptyString()));

                agent.addResource(null);
                assertThat(agent.getResources(), is(emptyString()));
            }

            @Test
            void shouldAddResourcesWithValidListOfResourceNames() {
                Agent agent = new Agent("uuid", "cookie", "host", "127.0.0.1");

                agent.addResources(asList("r1", "r2"));
                assertThat(agent.getResources(), is("r1,r2"));

                agent.addResources(asList("r3"));
                assertThat(agent.getResources(), is("r1,r2,r3"));
            }

            @Test
            void shouldDoNothingWhenNullIsSpecifiedAsListOfResourceNames() {
                Agent agent = new Agent("uuid", "cookie", "host", "127.0.0.1");
                agent.addResources(null);
                assertThat(agent.getResources(), is(emptyString()));
            }

            @Test
            void shouldAddResourcesWithListOfResourceNamesContainingLeadingTrailingSpaces() {
                Agent agent = new Agent("uuid", "cookie", "host", "127.0.0.1");

                agent.addResources(asList("r1", "r2"));
                assertThat(agent.getResources(), is("r1,r2"));

                agent.addResources(asList("  r3", "r4  ", "  r5  ", "r6", "   ", " "));
                assertThat(agent.getResources(), is("r1,r2,r3,r4,r5,r6"));
            }
        }

        @Nested
        class RemoveResources{
            @Test
            void shouldRemoveResourcesFromExistingResources() {
                Agent agent = new Agent("uuid", "cookie", "host", "127.0.0.1");
                agent.setResources("r1,r2");
                agent.removeResources(asList("r1", "r3"));
                assertThat(agent.getResources(), is("r2"));
            }

            @Test
            void shouldDoNothingWhenListOfResourcesToRemoveDoesNotExist() {
                Agent agent = new Agent("uuid", "cookie", "host", "127.0.0.1");
                agent.removeResources(asList("r1", "r2"));
                assertNull(agent.getResources());
            }

            @Test
            void shouldDoNothingWhenListOfResourcesToRemoveIsEmpty() {
                Agent agent = new Agent("uuid", "cookie", "host", "127.0.0.1");
                agent.removeResources(emptyList());
                assertThat(agent.getResources(), is(emptyString()));
            }

            @Test
            void shouldDoNothingWhenListOfResourcesToRemoveIsNull() {
                Agent agent = new Agent("uuid", "cookie", "host", "127.0.0.1");
                agent.removeResources(null);
                assertThat(agent.getResources(), is(emptyString()));
            }

            @Test
            void shouldTrimEachResourceNameInTheListOfResourcesToRemove() {
                Agent agent = new Agent("uuid", "cookie", "host", "127.0.0.1");
                agent.setResourcesFromList(asList("r1","r2", "r3"));
                agent.removeResources(asList("  r1 ","r2 ", " r3"));
                assertNull(agent.getResources());
            }

            @Test
            void shouldNotConsiderNullOrEmptyResourceNamesInTheListOfResourcesToRemove() {
                Agent agent = new Agent("uuid", "cookie", "host", "127.0.0.1");
                agent.setResourcesFromList(asList("r1","r2", "r3"));
                agent.removeResources(asList(null," ", ""));
                assertThat(agent.getResources(), is("r1,r2,r3"));
            }
        }

        @Test
        void shouldAllowResourcesOnNonElasticAgents() {
            Agent agent = new Agent("uuid", "hostname", "10.10.10.10");

            agent.setResources("foo");
            agent.validate();
            assertThat(agent.errors().isEmpty(), is(true));
        }

        @Test
        void shouldNotAllowResourcesElasticAgents() {
            Agent agent = new Agent("uuid", "hostname", "10.10.10.10");
            agent.setElasticPluginId("com.example.foo");
            agent.setElasticAgentId("foobar");
            agent.setResources("foo");
            agent.validate();

            assertEquals(1, agent.errors().size());
            assertThat(agent.errors().on(RESOURCES), is("Elastic agents cannot have resources."));
        }
    }

    @Nested
    class UUID {
        @Test
        void shouldPassValidationWhenUUidIsAvailable() {
            Agent agent = new Agent("uuid");
            agent.validate();
            assertThat(agent.errors().on(Agent.UUID), is(nullValue()));
        }

        @Test
        void shouldFailValidationWhenUUidIsBlank() {
            Agent agent = new Agent("");
            agent.validate();
            assertThat(agent.errors().on(Agent.UUID), is("UUID cannot be empty"));
            agent = new Agent("");
            agent.validate();
            assertThat(agent.errors().on(Agent.UUID), is("UUID cannot be empty"));
        }
    }

    @Nested
    class Environments {
        @Nested
        class SetEnvironments {
            @Test
            void shouldSetEnvironmentsWithValidCommaSeparatedStringOfEnvironmentNames() {
                Agent agent = new Agent("uuid", "cookie", "host", "127.0.0.1");
                agent.setEnvironments("env1,env2,env3");
                assertThat(agent.getEnvironments(), is("env1,env2,env3"));

                agent.setEnvironments("env4,env5");
                assertThat(agent.getEnvironments(), is("env4,env5"));
            }

            @Test
            void shouldSetEnvironmentsAsNullWhenEmptyCommaSeparatedStringOfEnvironmentNamesIsSpecified() {
                Agent agent = new Agent("uuid", "cookie", "host", "127.0.0.1");
                agent.setEnvironments("      ");
                assertThat(agent.getEnvironments(), is(nullValue()));
            }

            @Test
            void shouldSetEnvironmentsAsNullWhenNullCommaSeparatedStringOfEnvironmentNamesIsSpecified() {
                Agent agent = new Agent("uuid", "cookie", "host", "127.0.0.1");
                agent.setEnvironments(null);
                assertThat(agent.getEnvironments(), is(nullValue()));
            }

            @Test
            void shouldSetEnvironmentsAsNullWhenInvalidCommaSeparatedStringOfEnvironmentNamesIsSpecified() {
                Agent agent = new Agent("uuid", "cookie", "host", "127.0.0.1");
                agent.setEnvironments("   , ,, ,");
                assertThat(agent.getEnvironments(), is(nullValue()));
            }

            @Test
            void shouldSetEnvironmentsWithValidListOfEnvironmentNames() {
                Agent agent = new Agent("uuid", "cookie", "host", "127.0.0.1");
                agent.setEnvironmentsFrom(asList("env1","env2","env3"));
                assertThat(agent.getEnvironments(), is("env1,env2,env3"));

                agent.setEnvironmentsFrom(asList("env4","env5"));
                assertThat(agent.getEnvironments(), is("env4,env5"));
            }

            @Test
            void shouldSetEnvironmentsFromEmptyListOrListContainingEmptyEnvironmentNames() {
                Agent agent = new Agent("uuid", "cookie", "host", "127.0.0.1");
                agent.setEnvironmentsFrom(emptyList());
                assertThat(agent.getEnvironments(), is(nullValue()));

                agent.setEnvironmentsFrom(asList("      "," ","  ","","","  "));
                assertThat(agent.getEnvironments(), is(nullValue()));

                agent.setEnvironmentsFrom(singletonList("      , ,  ,,,  "));
                assertThat(agent.getEnvironments(), is(", ,  ,,,"));
            }

            @Test
            void shouldSetEnvironmentsAsNullWhenNullListOfEnvironmentNamesIsSpecified() {
                Agent agent = new Agent("uuid", "cookie", "host", "127.0.0.1");
                agent.setEnvironmentsFrom(null);
                assertThat(agent.getEnvironments(), is(nullValue()));
            }
        }

        @Nested
        class AddEnvironments {
            @Test
            void shouldAddEnvironmentWithValidEnvironmentName() {
                Agent agent = new Agent("uuid", "cookie", "host", "127.0.0.1");
                assertThat(agent.getEnvironments(), is(emptyString()));

                agent.addEnvironment("env1");
                assertThat(agent.getEnvironments(), is("env1"));

                agent.addEnvironment("env2");
                assertThat(agent.getEnvironments(), is("env1,env2"));
            }

            @Test
            void shouldTrimAndAddEnvironmentWhenEnvironmentNameIsSpecifiedAsContainingLeadingAndTrailingSpaces() {
                Agent agent = new Agent("uuid", "cookie", "host", "127.0.0.1");
                assertThat(agent.getEnvironments(), is(emptyString()));

                agent.addEnvironment("  env1");
                assertThat(agent.getEnvironments(), is("env1"));

                agent.addEnvironment("env2      ");
                assertThat(agent.getEnvironments(), is("env1,env2"));

                agent.addEnvironment(" env3 ");
                assertThat(agent.getEnvironments(), is("env1,env2,env3"));
            }

            @Test
            void shouldDoNothingWhenEmptyEnvironmentNameIsSpecified() {
                Agent agent = new Agent("uuid", "cookie", "host", "127.0.0.1");
                assertThat(agent.getEnvironments(), is(emptyString()));

                agent.addEnvironment("  ");
                assertThat(agent.getEnvironments(), is(emptyString()));

                agent.addEnvironment("");
                assertThat(agent.getEnvironments(), is(emptyString()));
            }

            @Test
            void shouldDoNothingWhenNullEnvironmentNameIsSpecified() {
                Agent agent = new Agent("uuid", "cookie", "host", "127.0.0.1");
                assertThat(agent.getEnvironments(), is(emptyString()));

                agent.addEnvironment(null);
                assertThat(agent.getEnvironments(), is(emptyString()));
            }

            @Test
            void shouldAddEnvironmentsWithValidListOfEnvironmentNames() {
                Agent agent = new Agent("uuid", "cookie", "host", "127.0.0.1");

                agent.addEnvironments(asList("env1", "env2"));
                assertThat(agent.getEnvironments(), is("env1,env2"));

                agent.addEnvironments(asList("env3"));
                assertThat(agent.getEnvironments(), is("env1,env2,env3"));
            }

            @Test
            void shouldDoNothingWhenNullIsSpecifiedAsListOfEnvironmentNames() {
                Agent agent = new Agent("uuid", "cookie", "host", "127.0.0.1");
                agent.addEnvironments(null);
                assertThat(agent.getEnvironments(), is(emptyString()));
            }

            @Test
            void shouldAddEnvironmentsWithListOfEnvironmentNamesContainingLeadingTrailingSpaces() {
                Agent agent = new Agent("uuid", "cookie", "host", "127.0.0.1");

                agent.addEnvironments(asList("env1", "env2"));
                assertThat(agent.getEnvironments(), is("env1,env2"));

                agent.addEnvironments(asList("  env3", "env4  ", "  env5  ", "env6", "   ", " "));
                assertThat(agent.getEnvironments(), is("env1,env2,env3,env4,env5,env6"));
            }
        }

        @Nested
        class RemoveEnvironments{
            @Test
            void shouldRemoveEnvironmentsFromExistingEnvironments() {
                Agent agent = new Agent("uuid", "cookie", "host", "127.0.0.1");
                agent.setEnvironments("env1,env2");
                agent.removeEnvironments(asList("env1", "env3"));
                assertThat(agent.getEnvironments(), is("env2"));
            }

            @Test
            void shouldDoNothingWhenListOfEnvironmentsToRemoveDoesNotExist() {
                Agent agent = new Agent("uuid", "cookie", "host", "127.0.0.1");
                agent.removeEnvironments(asList("env1", "env3"));
                assertNull(agent.getEnvironments());
            }

            @Test
            void shouldDoNothingWhenListOfEnvironmentsToRemoveIsEmpty() {
                Agent agent = new Agent("uuid", "cookie", "host", "127.0.0.1");
                agent.removeEnvironments(emptyList());
                assertNull(agent.getEnvironments());
            }

            @Test
            void shouldDoNothingWhenListOfEnvironmentsToRemoveIsNull() {
                Agent agent = new Agent("uuid", "cookie", "host", "127.0.0.1");
                agent.removeEnvironments(null);
                assertNull(agent.getEnvironments());
            }

            @Test
            void shouldTrimEachEnvironmentNameInTheListOfEnvironmentsToRemove() {
                Agent agent = new Agent("uuid", "cookie", "host", "127.0.0.1");
                agent.setEnvironmentsFrom(asList("e1","e2", "e3"));
                agent.removeEnvironments(asList("  e1 ","e2 ", " e3"));
                assertNull(agent.getEnvironments());
            }

            @Test
            void shouldNotConsiderNullOrEmptyEnvironmentNamesInTheListOfEnvironmentsToRemove() {
                Agent agent = new Agent("uuid", "cookie", "host", "127.0.0.1");
                agent.setEnvironmentsFrom(asList("e1","e2", "e3"));
                agent.removeEnvironments(asList(null," ", ""));
                assertThat(agent.getEnvironments(), is("e1,e2,e3"));
            }
        }

        @Test
        void shouldReturnEmptyListIfEnvironmentIsNullOrEmpty() {
            Agent agent = new Agent("uuid", "cookie", "host", "127.0.0.1");

            assertThat(agent.getEnvironments(), is(emptyString()));
            assertThat(agent.getEnvironmentsAsList(), is(empty()));

            agent.setEnvironments("");

            assertThat(agent.getEnvironments(), is(nullValue()));
            assertThat(agent.getEnvironmentsAsList(), is(empty()));
        }

        @Test
        void shouldReturnEnvAsListSplitOnComma() {
            Agent agent = new Agent("uuid", "cookie", "host", "127.0.0.1");
            assertThat(agent.getEnvironments(), is(emptyString()));
            assertThat(agent.getEnvironmentsAsList(), is(empty()));

            agent.setEnvironments("env1,env2");

            assertThat(agent.getEnvironments(), not(nullValue()));
            assertThat(agent.getEnvironments(), is("env1,env2"));
            assertThat(agent.getEnvironmentsAsList(), is(asList("env1", "env2")));
        }
    }

    @Nested
    class hasAllResources {
        @Test
        void shouldMakeACaseInsensitiveComparisonOfResources() {
            Agent agent = new Agent("uuid", "host", "ip", asList("Postgres DB", "Linux-1", "W1nd0ws", "Mac OS"));

            assertTrue(agent.hasAllResources(asList("posTgres db", "linux-1", "w1nd0ws")));
        }
    }
}


text:
@implementation KratosEmptyView

+ (instancetype)KratosEmptyViewWithIconName:(NSString *)iconname;
{
    KratosEmptyView *emptyView = [[KratosEmptyView alloc] initWithIconName:iconname];

    return emptyView;
}

- (instancetype)initWithIconName:(NSString *)iconName;
{
    if (self = [super init]) {
        self.contentMode = UIViewContentModeCenter;
        self.image = iconName.length == 0? [UIImage imageNamed:KratosExtensionSrcName(@"icon_map_search_empty.png")] ?:
                                           [UIImage imageNamed: KratosExtensionFrameworkSrcName(@"icon_map_search_empty.png")] :
                                           [UIImage imageNamed:iconName] ;
    }
    return self;
}

- (void)didMoveToSuperview
{
    if (self.superview) {
        [self autoPinEdgesToSuperviewEdgesWithInsets:UIEdgeInsetsZero];
    }
}

@end


text:
<?php

namespace RayRutjes\DddBootstrap\Messaging;

use RayRutjes\DddEssentials\Messaging\Message;

class FQCNameResolver implements MessageNameResolver
{
    /**
     * @param Message $message
     *
     * @return string
     */
    public function resolve(Message $message): string
    {
        return get_class($message);
    }
}


text:
export * from './stats.component';
export * from './stats.routes';
export * from './stats.pipes';


text:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Windows.Forms;
using XenAdmin.Core;
using XenAdmin.Network;
using XenAPI;

namespace XenAdmin.Controls
{
    class FilterLocationToolStripDropDownButton : ToolStripDropDownButton
    {
        [Browsable(true)]
        public event Action FilterChanged;

        /// <summary>
        /// Maintain a list of all the objects we currently have events on for clearing out on rebuild
        /// </summary>
        private List<IXenConnection> connectionsWithEvents = new List<IXenConnection>();
        private List<Pool> poolsWithEvents = new List<Pool>();
        private List<Host> hostsWithEvents = new List<Host>();
        /// <summary>
        /// Store only host check states because the pools can be in an
        /// indeterminate state.
        /// </summary>
        private Dictionary<string, bool> HostCheckStates = new Dictionary<string, bool>();
        private readonly CollectionChangeEventHandler m_hostCollectionChangedWithInvoke;
        private bool inFilterListUpdate;
        private bool retryFilterListUpdate;

        private ToolStripMenuItem toolStripMenuItemAll;

        public FilterLocationToolStripDropDownButton()
        {
            ConnectionsManager.XenConnections.CollectionChanged += XenConnections_CollectionChanged;
            m_hostCollectionChangedWithInvoke = Program.ProgramInvokeHandler(Host_CollectionChanged);
        }

        protected override void Dispose(bool disposing)
        {
            DeregisterEvents();
            ConnectionsManager.XenConnections.CollectionChanged -= XenConnections_CollectionChanged;
            base.Dispose(disposing);
        }

        private void OnFilterChanged()
        {
            if (FilterChanged != null)
                FilterChanged();
        }

        /// <summary>
        /// Build the list of hosts to filter by for the first time and set all
        /// of them to be checked
        /// </summary>
        public void InitializeHostList()
        {
            foreach (IXenConnection c in ConnectionsManager.XenConnectionsCopy)
            {
                foreach (Host h in c.Cache.Hosts)
                    HostCheckStates[h.uuid] = true;
            }
        }

        public void RefreshLists()
        {
            BuildFilterList();
            OnFilterChanged();
        }

        public void BuildFilterList()
        {
            Program.AssertOnEventThread();

            if (inFilterListUpdate)
            {
                // queue up an update after the current one has finished,
                // in case the update has missed the relevant change
                retryFilterListUpdate = true;
                return;
            }

            inFilterListUpdate = true;

            try
            {
                DropDownItems.Clear();
                DeregisterEvents();
                RegisterEvents();

                foreach (var c in ConnectionsManager.XenConnectionsCopy)
                {
                    var p = Helpers.GetPool(c);

                    if (p == null)// Stand alone host
                    {
                        if (c.Cache.Hosts.Length > 0)
                        {
                            var host = c.Cache.Hosts.First();
                            var item = GenerateFilterItem(host, host.uuid);
                            item.Checked = HostCheckStates.ContainsKey(host.uuid);
                            DropDownItems.Add(item);
                        }
                    }
                    else
                        DropDownItems.Add(GeneratePoolFilterItem(p));
                }

                if (DropDownItems.Count > 0)
                {
                    toolStripMenuItemAll = new ToolStripMenuItem
                        {
                            Text = Messages.FILTER_SHOW_ALL,
                            Enabled = FilterIsOn
                        };

                    DropDownItems.AddRange(new ToolStripItem[]
                        {
                            new ToolStripSeparator(),
                            toolStripMenuItemAll
                        });
                }

                Enabled = DropDownItems.Count > 0;
            }
            finally
            {
                inFilterListUpdate = false;
                if (retryFilterListUpdate)
                {
                    // there was a request to update while we were building,
                    // rebuild in case we missed something
                    retryFilterListUpdate = false;
                    BuildFilterList();
                }
            }
        }

        public bool HideByLocation(string hostUuid)
        {
            if (hostUuid == null)
                return false;

            if (HostCheckStates.ContainsKey(hostUuid) && !HostCheckStates[hostUuid])
                return true;

            return false;
        }

        public bool HideByLocation(List<string> hostUuids)
        {
            if (hostUuids.Count == 0)
                return false;

            return hostUuids.TrueForAll(uuid => HostCheckStates.ContainsKey(uuid) && !HostCheckStates[uuid]);
        }

        public bool FilterIsOn
        {
            get { return HostCheckStates.ContainsValue(false); }
        }

        private ToolStripMenuItem GeneratePoolFilterItem(Pool p)
        {
            List<ToolStripMenuItem> subItems = new List<ToolStripMenuItem>();

            foreach (Host h in p.Connection.Cache.Hosts)
            {
                var hostItem = GenerateFilterItem(h, h.uuid);
                hostItem.Checked = HostCheckStates.ContainsKey(h.uuid);
                subItems.Add(hostItem);
            }

            var poolItem = GenerateFilterItem(p, p.uuid);
            poolItem.DropDownItems.AddRange(subItems.ToArray());
            poolItem.CheckState = subItems.TrueForAll(item => item.Checked)
                                      ? CheckState.Checked
                                      : subItems.TrueForAll(item => !item.Checked)
                                            ? CheckState.Unchecked
                                            : CheckState.Indeterminate;
            poolItem.DropDownItemClicked += poolItem_DropDownItemClicked;
            return poolItem;
        }

        private ToolStripMenuItem GenerateFilterItem(IXenObject xenObject, string xenObjectUuid)
        {
            var item = new ToolStripMenuItem
                           {
                               Text = Helpers.GetName(xenObject),
                               Tag = xenObjectUuid
                           };
            return item;
        }

        private void RegisterEvents()
        {
            foreach (IXenConnection c in ConnectionsManager.XenConnectionsCopy)
            {
                c.ConnectionStateChanged += connection_ConnectionStateChanged;
                c.Cache.RegisterCollectionChanged<Host>(m_hostCollectionChangedWithInvoke);
                c.CachePopulated += connection_CachePopulated;
                connectionsWithEvents.Add(c);

                foreach (var pool in c.Cache.Pools)
                {
                    pool.PropertyChanged += pool_PropertyChanged;
                    poolsWithEvents.Add(pool);
                }

                foreach (Host host in c.Cache.Hosts)
                {
                    RegisterHostEvents(host);
                    hostsWithEvents.Add(host);
                }
            }
        }

        private void DeregisterEvents()
        {
            foreach (IXenConnection c in connectionsWithEvents)
            {
                c.ConnectionStateChanged -= connection_ConnectionStateChanged;
                c.Cache.DeregisterCollectionChanged<Host>(m_hostCollectionChangedWithInvoke);
                c.CachePopulated -= connection_CachePopulated;
            }

            foreach (var pool in poolsWithEvents)
                pool.PropertyChanged -= pool_PropertyChanged;

            foreach (Host h in hostsWithEvents)
                DeregisterHostEvents(h);

            connectionsWithEvents.Clear();
            poolsWithEvents.Clear();
            hostsWithEvents.Clear();
        }

        private void RegisterHostEvents(Host host)
        {
            Host_metrics metrics = host.Connection.Resolve(host.metrics);
            if (metrics != null)
                metrics.PropertyChanged += hostMetrics_PropertyChanged;
            host.PropertyChanged += host_PropertyChanged;
        }

        private void DeregisterHostEvents(Host host)
        {
            Host_metrics metrics = host.Connection.Resolve(host.metrics);
            if (metrics != null)
                metrics.PropertyChanged -= hostMetrics_PropertyChanged;
            host.PropertyChanged -= host_PropertyChanged;
        }

        private void connection_ConnectionStateChanged(IXenConnection conn)
        {
            Program.Invoke(Program.MainWindow, RefreshLists);
        }

        private void connection_CachePopulated(IXenConnection conn)
        {
            Program.Invoke(Program.MainWindow, RefreshLists);
        }

        private void XenConnections_CollectionChanged(object sender, CollectionChangeEventArgs e)
        {
            if (e.Action == CollectionChangeAction.Add)
            {
                IXenConnection connection = e.Element as IXenConnection;

                foreach (Host host in connection.Cache.Hosts)
                    HostCheckStates[host.uuid] = true;
            }
        }

        private void Host_CollectionChanged(object sender, CollectionChangeEventArgs e)
        {
            if (e.Action == CollectionChangeAction.Add)
                HostCheckStates[((Host)e.Element).uuid] = true;

            Program.Invoke(Parent, RefreshLists);
        }

        private void pool_PropertyChanged(object obj, PropertyChangedEventArgs e)
        {
            if (e.PropertyName == "other_config" || e.PropertyName == "name_label")
                Program.Invoke(Parent, RefreshLists);
        }

        private void hostMetrics_PropertyChanged(object sender, PropertyChangedEventArgs e)
        {
            if (e.PropertyName == "live")
                Program.Invoke(Parent, RefreshLists);
        }

        private void host_PropertyChanged(object sender, PropertyChangedEventArgs e)
        {
            if (e.PropertyName == "name_label" || e.PropertyName == "metrics")
                Program.Invoke(Parent, RefreshLists);
        }

        protected override void OnDropDownItemClicked(ToolStripItemClickedEventArgs e)
        {
            //this method pertains to pool or stand alone host items
            base.OnDropDownItemClicked(e);
            HandleItemClicked(e.ClickedItem as ToolStripMenuItem);
        }

        private void poolItem_DropDownItemClicked(object sender, ToolStripItemClickedEventArgs e)
        {
            HandleItemClicked(e.ClickedItem as ToolStripMenuItem);
        }

        private void HandleItemClicked(ToolStripMenuItem item)
        {
            if (item == null)
                return;

            string uuid = (string)item.Tag;

            if (item.HasDropDownItems)
            {
                //this is a pool node

                item.CheckState = item.CheckState == CheckState.Checked
                                      ? CheckState.Unchecked
                                      : CheckState.Checked;

                foreach (ToolStripMenuItem child in item.DropDownItems)
                {
                    child.Checked = item.Checked;
                    string hostUuid = (string)child.Tag;
                    HostCheckStates[hostUuid] = child.Checked;
                }

                toolStripMenuItemAll.Enabled = FilterIsOn;
            }
            else if (item == toolStripMenuItemAll)
            {
                toolStripMenuItemAll.Enabled = false;
                InitializeHostList();
                BuildFilterList();
            }
            else
            {
                //this is a host node

                item.Checked = !item.Checked;
                HostCheckStates[uuid] = item.Checked;

                ToolStripMenuItem poolItem = item.OwnerItem as ToolStripMenuItem;

                if (poolItem != null)
                {
                    //this is not a standalone host; change the parent pool's check state

                    var itemArray = new ToolStripMenuItem[poolItem.DropDownItems.Count];
                    poolItem.DropDownItems.CopyTo(itemArray, 0);

                    poolItem.CheckState = Array.TrueForAll(itemArray, i => i.Checked)
                                              ? CheckState.Checked
                                              : Array.TrueForAll(itemArray, i => !i.Checked)
                                                    ? CheckState.Unchecked
                                                    : CheckState.Indeterminate;
                }

                toolStripMenuItemAll.Enabled = FilterIsOn;
            }

            OnFilterChanged();
        }
    }
}


text:
package com.exacttarget.fuelsdk.audiencebuilder;

import org.junit.BeforeClass;
import org.junit.FixMethodOrder;
import org.junit.Test;
import org.junit.runners.MethodSorters;
import static org.junit.Assert.*;

import com.exacttarget.fuelsdk.ETClient;
import com.exacttarget.fuelsdk.ETConfiguration;
import com.exacttarget.fuelsdk.ETResponse;
import com.exacttarget.fuelsdk.ETResult;
import com.exacttarget.fuelsdk.ETSdkException;

@FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class AudienceBuilderTest {
    private static ETClient client = null;

    @BeforeClass
    public static void setUpBeforeClass()
        throws ETSdkException
    {
        ETConfiguration configuration = new ETConfiguration("/fuelsdk-test.properties");
        configuration.set("clientId", configuration.get("audienceBuilderClientId"));
        configuration.set("clientSecret", configuration.get("audienceBuilderClientSecret"));
        configuration.set("soapEndpoint", configuration.get("audienceBuilderSoapEndpoint"));
        client = new ETClient(configuration);
    }

    @Test
    public void _01_TestRetrieveDimensions()
        throws ETSdkException
    {
        ETResponse<ETDimension> response = client.retrieve(ETDimension.class);
        assertNotNull(response.getRequestId());
        if (client.getConfiguration().equals("audienceBuilderApi", "soap")) {
            assertEquals("OK", response.getResponseCode());
        } else {
            assertEquals("200", response.getResponseCode());
        }
        assertEquals("OK", response.getResponseMessage());
        assertEquals((Integer) 1, response.getPage());
        assertEquals((Integer) 50, response.getPageSize());
        assertEquals((Integer) 719, response.getTotalCount());
        assertTrue(response.hasMoreResults());
    }

    @Test
    public void _02_TestRetrieveDimensionsFilteredEquals()
        throws ETSdkException
    {
        ETResponse<ETDimension> response = client.retrieve(ETDimension.class,
                                                           "count = 3");
        assertNotNull(response.getRequestId());
        if (client.getConfiguration().equals("audienceBuilderApi", "soap")) {
            assertEquals("OK", response.getResponseCode());
        } else {
            assertEquals("200", response.getResponseCode());
        }
        assertEquals("OK", response.getResponseMessage());
        assertEquals((Integer) 1, response.getPage());
        assertEquals((Integer) 10, response.getPageSize());
        assertEquals((Integer) 10, response.getTotalCount());
        assertFalse(response.hasMoreResults());
    }

    @Test
    public void _03_TestRetrieveDimensionsFilteredNotEquals()
        throws ETSdkException
    {
        ETResponse<ETDimension> response = client.retrieve(ETDimension.class,
                                                           "count != 3");
        assertNotNull(response.getRequestId());
        if (client.getConfiguration().equals("audienceBuilderApi", "soap")) {
            assertEquals("OK", response.getResponseCode());
        } else {
            assertEquals("200", response.getResponseCode());
        }
        assertEquals("OK", response.getResponseMessage());
        assertEquals((Integer) 1, response.getPage());
        assertEquals((Integer) 50, response.getPageSize());
        assertEquals((Integer) 225, response.getTotalCount());
        assertTrue(response.hasMoreResults());
    }

    @Test
    public void _04_TestRetrieveDimensionsFilteredLessThan()
        throws ETSdkException
    {
        ETResponse<ETDimension> response = client.retrieve(ETDimension.class,
                                                           "count < 3");
        assertNotNull(response.getRequestId());
        if (client.getConfiguration().equals("audienceBuilderApi", "soap")) {
            assertEquals("OK", response.getResponseCode());
        } else {
            assertEquals("200", response.getResponseCode());
        }
        assertEquals("OK", response.getResponseMessage());
        assertEquals((Integer) 1, response.getPage());
        assertEquals((Integer) 41, response.getPageSize());
        assertEquals((Integer) 41, response.getTotalCount());
        assertFalse(response.hasMoreResults());
    }

    @Test
    public void _05_TestRetrieveDimensionsFilteredLessThanOrEquals()
        throws ETSdkException
    {
        ETResponse<ETDimension> response = client.retrieve(ETDimension.class,
                                                           "count <= 3");
        assertNotNull(response.getRequestId());
        if (client.getConfiguration().equals("audienceBuilderApi", "soap")) {
            assertEquals("OK", response.getResponseCode());
        } else {
            assertEquals("200", response.getResponseCode());
        }
        assertEquals("OK", response.getResponseMessage());
        assertEquals((Integer) 1, response.getPage());
        assertEquals((Integer) 50, response.getPageSize());
        assertEquals((Integer) 51, response.getTotalCount());
        assertTrue(response.hasMoreResults());
    }

    @Test
    public void _06_TestRetrieveDimensionsFilteredGreaterThan()
        throws ETSdkException
    {
        ETResponse<ETDimension> response = client.retrieve(ETDimension.class,
                                                           "count > 3");
        assertNotNull(response.getRequestId());
        if (client.getConfiguration().equals("audienceBuilderApi", "soap")) {
            assertEquals("OK", response.getResponseCode());
        } else {
            assertEquals("200", response.getResponseCode());
        }
        assertEquals("OK", response.getResponseMessage());
        assertEquals((Integer) 1, response.getPage());
        assertEquals((Integer) 50, response.getPageSize());
        assertEquals((Integer) 184, response.getTotalCount());
        assertTrue(response.hasMoreResults());
    }

    @Test
    public void _07_TestRetrieveDimensionsFilteredGreaterThanOrEquals()
        throws ETSdkException
    {
        ETResponse<ETDimension> response = client.retrieve(ETDimension.class,
                                                           "count >= 3");
        assertNotNull(response.getRequestId());
        if (client.getConfiguration().equals("audienceBuilderApi", "soap")) {
            assertEquals("OK", response.getResponseCode());
        } else {
            assertEquals("200", response.getResponseCode());
        }
        assertEquals("OK", response.getResponseMessage());
        assertEquals((Integer) 1, response.getPage());
        assertEquals((Integer) 50, response.getPageSize());
        assertEquals((Integer) 194, response.getTotalCount());
        assertTrue(response.hasMoreResults());
    }

    @Test
    public void _08_TestRetrieveDimensionsFilteredIn1()
        throws ETSdkException
    {
        ETResponse<ETDimension> response = client.retrieve(ETDimension.class,
                                                           "count in (3, 6)");
        assertNotNull(response.getRequestId());
        if (client.getConfiguration().equals("audienceBuilderApi", "soap")) {
            assertEquals("OK", response.getResponseCode());
        } else {
            assertEquals("200", response.getResponseCode());
        }
        assertEquals("OK", response.getResponseMessage());
        assertEquals((Integer) 1, response.getPage());
        assertEquals((Integer) 22, response.getPageSize());
        assertEquals((Integer) 22, response.getTotalCount());
        assertFalse(response.hasMoreResults());
    }

    @Test
    public void _09_TestRetrieveDimensionsFilteredIn2()
        throws ETSdkException
    {
        ETResponse<ETDimension> response = client.retrieve(ETDimension.class,
                                                           "count in (3, 6, 9)");
        assertNotNull(response.getRequestId());
        if (client.getConfiguration().equals("audienceBuilderApi", "soap")) {
            assertEquals("OK", response.getResponseCode());
        } else {
            assertEquals("200", response.getResponseCode());
        }
        assertEquals("OK", response.getResponseMessage());
        assertEquals((Integer) 1, response.getPage());
        assertEquals((Integer) 28, response.getPageSize());
        assertEquals((Integer) 28, response.getTotalCount());
        assertFalse(response.hasMoreResults());
    }

    @Test
    public void _10_TestRetrieveDimensionsFilteredIn3()
        throws ETSdkException
    {
        ETResponse<ETDimension> response = client.retrieve(ETDimension.class,
                                                           "count in (3, 6, 9, 12)");
        assertNotNull(response.getRequestId());
        if (client.getConfiguration().equals("audienceBuilderApi", "soap")) {
            assertEquals("OK", response.getResponseCode());
        } else {
            assertEquals("200", response.getResponseCode());
        }
        assertEquals("OK", response.getResponseMessage());
        assertEquals((Integer) 1, response.getPage());
        assertEquals((Integer) 40, response.getPageSize());
        assertEquals((Integer) 40, response.getTotalCount());
        assertFalse(response.hasMoreResults());
    }

    //@Test
    public void _11_TestRetrieveDimensionsOrderBy()
        throws ETSdkException
    {
    }

    //@Test
    public void _12_TestRetrieveDimensionsFields()
        throws ETSdkException
    {
    }

    private static String age = null;

    @Test
    public void _13_TestRetrieveDimension1()
        throws ETSdkException
    {
        //
        // Retrieve "age" dimension and values:
        //

        ETResponse<ETDimension> response = client.retrieve(ETDimension.class,
                                                           "id=528"); // age
        if (client.getConfiguration().equals("audienceBuilderApi", "soap")) {
            assertEquals("OK", response.getResponseCode());
        } else {
            assertEquals("200", response.getResponseCode());
        }
        assertEquals("OK", response.getResponseMessage());
        assertEquals(1, response.getObjects().size());
        ETDimension dimension = response.getObject();
        assertEquals("528", dimension.getId());
        assertEquals((Integer) 1, dimension.getType());
        assertEquals("d4493c60-24e8-453a-b0bc-bf111c10aa42",
                     dimension.getFieldId());
        assertEquals("name",
                     dimension.getFieldName());
        assertEquals((Integer) 9, dimension.getCount());
        assertEquals(9, dimension.getValues().size());
        ETDimensionValue value1 = dimension.getValues().get(0);
        assertEquals("1", value1.getKey());
        assertEquals("less than 14", value1.getName());
        assertEquals((Integer) 0, value1.getCount());
        ETDimensionValue value2 = dimension.getValues().get(1);
        assertEquals("3", value2.getKey());
        assertEquals("18 24", value2.getName());
        assertEquals((Integer) 2475583, value2.getCount());
        ETDimensionValue value3 = dimension.getValues().get(2);
        assertEquals("7", value3.getKey());
        assertEquals("55 - 64", value3.getName());
        assertEquals((Integer) 2167700, value3.getCount());
        ETDimensionValue value4 = dimension.getValues().get(3);
        assertEquals("-1", value4.getKey());
        assertEquals("no age available", value4.getName());
        assertEquals((Integer) 197084, value4.getCount());
        ETDimensionValue value5 = dimension.getValues().get(4);
        assertEquals("2", value5.getKey());
        assertEquals("14 - 17", value5.getName());
        assertEquals((Integer) 1230269, value5.getCount());
        ETDimensionValue value6 = dimension.getValues().get(5);
        assertEquals("8", value6.getKey());
        assertEquals("65+", value6.getName());
        assertEquals((Integer) 1066716, value6.getCount());
        ETDimensionValue value7 = dimension.getValues().get(6);
        assertEquals("6", value7.getKey());
        assertEquals("45 - 54", value7.getName());
        assertEquals((Integer) 2165739, value7.getCount());
        ETDimensionValue value8 = dimension.getValues().get(7);
        assertEquals("4", value8.getKey());
        assertEquals("25 - 34", value8.getName());
        assertEquals((Integer) 2513502, value8.getCount());
        ETDimensionValue value9 = dimension.getValues().get(8);
        assertEquals("5", value9.getKey());
        assertEquals("35 - 44", value9.getName());
        assertEquals((Integer) 2167923, value9.getCount());
        // save fieldId for later
        age = dimension.getFieldId();
    }

    private static String gender = null;

    @Test
    public void _14_TestRetrieveDimension2()
        throws ETSdkException
    {
        //
        // Retrieve "gender" dimension and values:
        //

        ETResponse<ETDimension> response = client.retrieve(ETDimension.class,
                                                           "id=278"); // gender
        if (client.getConfiguration().equals("audienceBuilderApi", "soap")) {
            assertEquals("OK", response.getResponseCode());
        } else {
            assertEquals("200", response.getResponseCode());
        }
        assertEquals("OK", response.getResponseMessage());
        assertEquals(1, response.getObjects().size());
        ETDimension dimension = response.getObject();
        assertEquals("278", dimension.getId());
        assertEquals((Integer) 1, dimension.getType());
        assertEquals("b8b49d1a-74a4-4fb1-b92d-0aed1ab522a3",
                     dimension.getFieldId());
        assertEquals("name",
                     dimension.getFieldName());
        assertEquals((Integer) 3, dimension.getCount());
        assertEquals(3, dimension.getValues().size());
        ETDimensionValue value1 = dimension.getValues().get(0);
        assertEquals("Unknown", value1.getKey());
        assertEquals("unknown", value1.getName());
        assertEquals((Integer) 119415, value1.getCount());
        ETDimensionValue value2 = dimension.getValues().get(1);
        assertEquals("M", value2.getKey());
        assertEquals("male", value2.getName());
        assertEquals((Integer) 6959736, value2.getCount());
        ETDimensionValue value3 = dimension.getValues().get(2);
        assertEquals("F", value3.getKey());
        assertEquals("female", value3.getName());
        assertEquals((Integer) 6961047, value3.getCount());
        // save fieldId for later
        gender = dimension.getFieldId();
    }

    @Test
    public void _15_TestRetrieveAudienceCount()
        throws ETSdkException
    {
        Integer audienceCount = ETAudience.retrieveAudienceCount(client, age + "='25 - 34'");
        assertEquals((Integer) 2513502, audienceCount);
    }

    private static Integer totalCount = null;

//    @Test
//    public void _16_TestRetrieveAudiences1()
//        throws ETSdkException
//    {
//        ETResponse<ETAudience> response = client.retrieve(ETAudience.class);
//        assertNotNull(response.getRequestId());
//        if (client.getConfiguration().equals("audienceBuilderApi", "soap")) {
//            assertEquals("OK", response.getResponseCode());
//        } else {
//            assertEquals("200", response.getResponseCode());
//        }
//        assertEquals("OK", response.getResponseMessage());
//        assertEquals((Integer) 1, response.getPage());
//        assertEquals((Integer) 50, response.getPageSize());
//        // totalCount changes frequently, so we don't check it
//        totalCount = response.getTotalCount();
//        assertTrue(response.hasMoreResults());
//    }

    private static ETAudience audience = null;

    @Test
    public void _17_TestCreateAudience()
        throws ETSdkException
    {
        audience = client.instantiate(ETAudience.class);
        audience.setName("people age 25-34");
        audience.setFilter(age + "='25 - 34'");
        audience.setPublishedDataExtensionName("fuel-java test");
        ETResponse<ETAudience> response = client.create(audience);
        audience = response.getObject();
        assertNull(response.getRequestId());
        assertNull(response.getResponseCode());
        assertNull(response.getResponseMessage());
        assertNull(response.getPage());
        assertNull(response.getPageSize());
        assertNull(response.getTotalCount());
        assertFalse(response.hasMoreResults());
        assertEquals(1, response.getResults().size());
        ETResult<ETAudience> result = response.getResult();
        assertNotNull(result.getRequestId());
        if (client.getConfiguration().equals("audienceBuilderApi", "soap")) {
            assertEquals("OK", result.getResponseCode());
            //assertEquals("Audience created.", result.getResponseMessage());
            assertEquals("OK", result.getResponseMessage());
        } else {
            assertEquals("201", result.getResponseCode());
            assertEquals("Created", result.getResponseMessage());
        }
        assertNull(result.getErrorCode());
        assertNotNull(result.getObjectId());
    }

//    @Test
//    public void _18_TestRetrieveAudiences2()
//        throws ETSdkException
//    {
//        ETResponse<ETAudience> response = client.retrieve(ETAudience.class);
//        assertNotNull(response.getRequestId());
//        if (client.getConfiguration().equals("audienceBuilderApi", "soap")) {
//            assertEquals("OK", response.getResponseCode());
//        } else {
//            assertEquals("200", response.getResponseCode());
//        }
//        assertEquals("OK", response.getResponseMessage());
//        assertEquals((Integer) 1, response.getPage());
//        assertEquals((Integer) 50, response.getPageSize());
//        assertEquals((Integer) (totalCount + 1), response.getTotalCount());
//        assertTrue(response.hasMoreResults());
//    }

//    @Test
//    public void _19_TestRetrieveAudience1()
//        throws ETSdkException
//    {
//        ETResponse<ETAudience> response = client.retrieve(ETAudience.class,
//                                                          "id=" + id);
//        assertNotNull(response.getRequestId());
//        if (client.getConfiguration().equals("audienceBuilderApi", "soap")) {
//            assertEquals("OK", response.getResponseCode());
//        } else {
//            assertEquals("200", response.getResponseCode());
//        }
//        assertEquals("OK", response.getResponseMessage());
//        assertEquals(1, response.getObjects().size());
//        ETAudience audience = response.getObject();
//        assertEquals(id, audience.getId());
//        assertEquals("people age 25-34", audience.getName());
//        assertNull(audience.getDescription());
//        assertEquals("people age 25-34", audience.getAudienceCode());
//        assertEquals((Integer) 0, audience.getPublishCount());
//        assertNotNull(audience.getPublishCountDate());
//        assertEquals(1, audience.getSegments().size());
//        ETSegment segment = audience.getSegments().get(0);
//        assertNotNull(segment.getId());
//        assertEquals(audience.getId(), segment.getAudienceId());
//        assertEquals("Remainder", segment.getName());
//        assertEquals((Integer) Integer.MAX_VALUE, segment.getPriority());
//        assertEquals((Integer) 0, segment.getCap());
//        assertEquals((Integer) 0, segment.getCapPercent());
//        assertEquals(true, segment.getIncludeInPublish());
//    }

//    @Test
//    public void _20_TestUpdateAudience()
//        throws ETSdkException
//    {
//        ETResponse<ETAudience> response = client.update(ETAudience.class,
//                                                        "id=" + id,
//                                                        "description='people age 25-34'");
//        assertNotNull(response.getRequestId());
//        if (client.getConfiguration().equals("audienceBuilderApi", "soap")) {
//            assertEquals("OK", response.getResponseCode());
//        } else {
//            assertEquals("200", response.getResponseCode());
//        }
//        assertEquals("OK", response.getResponseMessage());
//        assertEquals(1, response.getObjects().size());
//        ETAudience audience = response.getObject();
//        assertEquals(id, audience.getId());
//        assertEquals("people age 25-34", audience.getName());
//        assertEquals("people age 25-34", audience.getDescription());
//        assertEquals("people age 25-34", audience.getAudienceCode());
//        assertEquals((Integer) 0, audience.getPublishCount());
//        assertNotNull(audience.getPublishCountDate());
//        assertEquals(1, audience.getSegments().size());
//        ETSegment segment = audience.getSegments().get(0);
//        assertNotNull(segment.getId());
//        assertEquals(audience.getId(), segment.getAudienceId());
//        assertEquals("Remainder", segment.getName());
//        assertEquals((Integer) Integer.MAX_VALUE, segment.getPriority());
//        assertEquals((Integer) 0, segment.getCap());
//        assertEquals((Integer) 0, segment.getCapPercent());
//        assertEquals(true, segment.getIncludeInPublish());
//    }

//    @Test
//    public void _21_TestRetrieveAudience2()
//        throws ETSdkException
//    {
//        ETResponse<ETAudience> response = client.retrieve(ETAudience.class,
//                                                          "id=" + id);
//        assertNotNull(response.getRequestId());
//        if (client.getConfiguration().equals("audienceBuilderApi", "soap")) {
//            assertEquals("OK", response.getResponseCode());
//        } else {
//            assertEquals("200", response.getResponseCode());
//        }
//        assertEquals("OK", response.getResponseMessage());
//        assertEquals(1, response.getObjects().size());
//        ETAudience audience = response.getObject();
//        assertEquals(id, audience.getId());
//        assertEquals("people age 25-34", audience.getName());
//        assertEquals("people age 25-34", audience.getDescription());
//        assertEquals("people age 25-34", audience.getAudienceCode());
//        assertEquals((Integer) 0, audience.getPublishCount());
//        assertNotNull(audience.getPublishCountDate());
//        assertEquals(1, audience.getSegments().size());
//        ETSegment segment = audience.getSegments().get(0);
//        assertNotNull(segment.getId());
//        assertEquals(audience.getId(), segment.getAudienceId());
//        assertEquals("Remainder", segment.getName());
//        assertEquals((Integer) Integer.MAX_VALUE, segment.getPriority());
//        assertEquals((Integer) 0, segment.getCap());
//        assertEquals((Integer) 0, segment.getCapPercent());
//        assertEquals(true, segment.getIncludeInPublish());
//    }

    @Test
    public void _22_TestPublishAudience()
        throws ETSdkException
    {
        audience.publish();

        do {
            try {
                Thread.sleep(5000); // wait 5 seconds
            } catch (Exception ex) {
                throw new ETSdkException(ex);
            }

            audience.updatePublishStatus();

            System.out.println(audience.getStatus()
                    + ": "
                    + audience.getSubscribersCopied()
                    + " copied.");
        } while (!audience.getStatus().equals("READY") &&
                 !audience.getStatus().equals("ERROR"));

        // XXX this doesn't actually test anything..
    }

//    @Test
//    public void _23_TestRetrieveAudience3()
//        throws ETSdkException
//    {
//        ETResponse<ETAudience> response = client.retrieve(ETAudience.class,
//                                                          "id=" + id);
//        assertNotNull(response.getRequestId());
//        if (client.getConfiguration().equals("audienceBuilderApi", "soap")) {
//            assertEquals("OK", response.getResponseCode());
//        } else {
//            assertEquals("200", response.getResponseCode());
//        }
//        assertEquals("OK", response.getResponseMessage());
//        assertEquals(1, response.getObjects().size());
//        ETAudience audience = response.getObject();
//        assertEquals(id, audience.getId());
//        assertEquals("people age 25-34", audience.getName());
//        assertEquals("people age 25-34", audience.getDescription());
//        assertNull(audience.getDescription());
//        assertEquals("people age 25-34", audience.getAudienceCode());
//        assertEquals((Integer) 0, audience.getPublishCount());
//        assertNotNull(audience.getPublishCountDate());
//        assertEquals(1, audience.getSegments().size());
//        ETSegment segment = audience.getSegments().get(0);
//        assertNotNull(segment.getId());
//        assertEquals(audience.getId(), segment.getAudienceId());
//        assertEquals("Remainder", segment.getName());
//        assertEquals((Integer) Integer.MAX_VALUE, segment.getPriority());
//        assertEquals((Integer) 0, segment.getCap());
//        assertEquals((Integer) 0, segment.getCapPercent());
//        assertEquals(true, segment.getIncludeInPublish());
//    }

    //@Test
    public void _24_TestExportDataExtension1()
        throws ETSdkException
    {
    }

    //@Test
    public void _25_TestExportDataExtension2()
        throws ETSdkException
    {
    }

    @Test
    public void _26_TestDeleteAudience()
        throws ETSdkException
    {
        ETResponse<ETAudience> response = client.delete(audience);
        assertNull(response.getRequestId());
        assertNull(response.getResponseCode());
        assertNull(response.getResponseMessage());
        assertNull(response.getPage());
        assertNull(response.getPageSize());
        assertNull(response.getTotalCount());
        assertFalse(response.hasMoreResults());
    }

//    @Test
//    public void _27_TestRetrieveAudiences3()
//        throws ETSdkException
//    {
//        ETResponse<ETAudience> response = client.retrieve(ETAudience.class);
//        assertNotNull(response.getRequestId());
//        if (client.getConfiguration().equals("audienceBuilderApi", "soap")) {
//            assertEquals("OK", response.getResponseCode());
//        } else {
//            assertEquals("200", response.getResponseCode());
//        }
//        assertEquals("OK", response.getResponseMessage());
//        assertEquals((Integer) 1, response.getPage());
//        assertEquals((Integer) 50, response.getPageSize());
//        assertEquals(totalCount, response.getTotalCount());
//        assertTrue(response.hasMoreResults());
//    }

    //@Test
    public void _28_TestCube1()
        throws ETSdkException
    {

    }

    //@Test
    public void _29_TestCube2()
        throws ETSdkException
    {

    }
}


text:
This plugin show how to insert the contents of one content control into another.

It is called "Example work with content controls content" in the interface and isn't installed by default in cloud, [self-hosted](https://github.com/ONLYOFFICE/DocumentServer) and [desktop version](https://github.com/ONLYOFFICE/DesktopEditors) of ONLYOFFICE editors.

## How to use

1. Add two content control (1 - with tag 11, 2 - with tag 14).
2. Open the Plugins tab and press "Example work with content controls content" (content from content control with tag 11 will be inserted into content control with tag 14).

If you need more information about how to use or write your own plugin, please see this https://api.onlyoffice.com/plugin/basic


text:
namespace WebApiSeed.Data.Domain.Mappings
{
    using System.ComponentModel.DataAnnotations.Schema;
    using System.Data.Entity.Infrastructure.Annotations;
    using System.Data.Entity.ModelConfiguration;

    public class UserMap : EntityTypeConfiguration<User>
    {
        public UserMap()
        {
            // Primary Key
            HasKey(user => user.Id);

            // Properties
            Property(user => user.UserName)
                .IsOptional()
                .HasMaxLength(20);

            //Optional: if no access token is present,
            //user is considered to be offline/logged out
            Property(user => user.AccessToken)
                .IsOptional();

            Property(user => user.Gender)
                .IsOptional();

            // Table & Column Mappings
            ToTable("User");
            Property(user => user.Id).HasColumnName("Id");
            Property(user => user.AccessToken).HasColumnName("AccessToken");
            Property(user => user.UserName).HasColumnName("UserName");
            Property(user => user.Gender).HasColumnName("Gender");
        }
    }
}


text:
(function() {

  "use strict";

  angular
    .module('ngClassifieds', ['ngMaterial', 'ui.router'])
    .config(function($mdThemingProvider, $stateProvider, $urlRouterProvider) {

      $mdThemingProvider.theme('default')
        .primaryPalette('teal')
        .accentPalette('orange');

      $urlRouterProvider.otherwise('/classifieds');

      $stateProvider
        .state('classifieds', {
          url: '/classifieds',
          templateUrl: 'components/classifieds/classifieds.tpl.html',
          controller: 'classifiedsController as vm'
        })
        .state('classifieds.new', {
          url: '/new',
          templateUrl: 'components/classifieds/new/classifieds.new.tpl.html',
          controller: 'newClassifiedsController as vm'
        })
        .state('classifieds.edit', {
          url: '/:id/edit',
          templateUrl: 'components/classifieds/edit/classifieds.edit.tpl.html',
          controller: 'editClassifiedsController as vm',
          params: {
            classified: null
          }
        });
    });

})();


text:
/**
 * @file		icomponent.hpp
 * @brief		Component(Shared Library) interface
 * @author		Byunghun Hwang<bhhwang@nsynapse.com>
 * @date 		2015. 6. 21
 * @details		Component interface class
 */

#ifndef _COSSB_ICOMPONENT_HPP_
#define _COSSB_ICOMPONENT_HPP_

#include <string>
#include <interface/iprofile.hpp>
#include <interface/ilog.hpp>
#include <base/message_any.hpp>
#include <cassert>

using namespace std;

namespace cossb {

namespace component {
	enum class status : unsigned int { IDLE=0, RUNNING, STOPPED };
}

namespace driver { class component_driver; }

namespace interface {
/**
* @brief		component interface class
* @details		base component interface, lifecycle is (setup-run-stop)
* @author		Byunghun Hwang<bhhwang@nsynapse.com>
* @date		2015. 6. 22
*/
class icomponent {

	friend driver::component_driver;

public:
	/**
	 * @brief
	 */
	virtual ~icomponent() {
		if(_profile)
			delete _profile;

		if(_logger)
			delete _logger;
	}

	/**
	 * @brief		initialization
	 * @details	this function will be called once when load component
	 * @return		true if it is success
	 */
	virtual bool setup() = 0;

	/**
	 * @brief		start signal comes in, this function will be called
	 * @details
	 */
	virtual bool run() = 0;

	/**
	 * @brief	stop interface
	 * @brief	stop signal comes in, this function will be called
	 */
	virtual bool stop() = 0;

	/**
	 * @brief	message subscribe
	 * @details	if subscribe message comes in, this function will be called
	 */
	virtual void subscribe(cossb::message* const msg) = 0;

	/**
	 * @brief
	 */
	const char* get_name() const {
		return _name.c_str();
	}

	/**
	 * @brief
	 */
	iprofile* get_profile() const {
		return _profile;
	}

	/*
	 * @brief
	 */
	/*bool has(service::methodtype type, const char* topic = nullptr){
		for(auto& srv:_profile->h){

		}
		return false;
	}*/

	/**
	 * @brief	getting status
	 */
	component::status get_status() { return _status; }

protected:
	explicit icomponent(const char* name)
	:_name(name), _status(component::status::IDLE) {

	}

private:
	/**
	 * @brief	component name
	 */
	string _name;

	/**
	 * @brief	component profile interface
	 */
	iprofile* _profile = nullptr;

	/**
	 * @brief	component log interface
	 */
	ilog* _logger = nullptr;

protected:
	component::status _status;

	ilog* logger() {
		assert(_logger!=nullptr);
		return _logger;
	}

};

} /* namespace interface */

typedef interface::icomponent*(*create_component)(void);
typedef void(*destroy_component)(void);

/**
 * @brief	Component interface macro
 */
#define USE_COMPONENT_INTERFACE(classname)	static classname* _instance = nullptr; \
											cossb::interface::icomponent* create() { if(_instance==nullptr) _instance = new classname(); return _instance; } \
											void destroy(){ if(_instance!=nullptr){ delete _instance; _instance=nullptr; }}

#define COMPONENT_EXPORT				extern "C" { cossb::interface::icomponent* create(); void destroy(void); }

#define COMPONENT(classname) #classname

} /* namespace cossb */

#endif /* _COSSB_ICOMPONENT_HPP_ */