text:
package org.aspenos.util.appinstall;

import java.util.*;
import java.sql.*;
import java.util.zip.*;
import java.io.*;

import org.aspenos.xml.*;
import org.aspenos.util.*;
import org.aspenos.db.*;
import org.aspenos.logging.*;
import org.aspenos.exception.*;
import org.aspenos.app.aoscontentserver.registry.*;
import org.aspenos.app.aossystemconsole.registry.*;
import org.aspenos.app.aoscontentserver.util.*;

/**
 * Uninstalls an Aspen application.
 * For use on the command line only.
 *
 * @author P. Mark Anderson
 **/
public class RunAppUninstaller {

	public static void main(String[] args) {

		if(args.length != 1) {
			System.err.println("\n\nUsage:  RunAppUninstaller <install properties file>");
			System.err.println("\nExample properties file:\n" +
				"aspen.install_dir=/opt/aspenos\n" +
				"app.jar_path=lib/myapp.jar\n" +
				"app.display_name=My App That Rocks\n" +
				"app.system_name=MyApp\n" +
				"app.registry_group=mygroup\n\n" +
				"vendor.system_name=my_vendor\n" +
				"vendor.display_name=My Vendor\n\n" +
				"aspen.db.protocol=jdbc:postgresql\n" +
				"aspen.db.host=ix\n" +
				"aspen.db.cs_dsn=aos_contentserver\n" +
				"aspen.db.console_dsn=aos_systemconsole\n" +
				"aspen.db.driver=postgresql.Driver\n");

			System.exit(1);
		}

		final String CS_JAR_NAME = "contentserver.jar";
		final String CS_LIB_PATH = "apps" + File.separator +
			"AOSContentServer" + File.separator + "lib" +
			File.separator;
		final String ASPEN_CLASS_DIR = "classes";

		LoggerWrapper lw = new LoggerWrapper();
		boolean success = false;

		// Set the logging so that it goes to the current directory
		lw.setDefaultLogs();

		PropLoader pl = new PropLoader();
		Properties props = null;
		try {
			props = pl.load(args[0]);
		} catch (Exception pex) {
			pex.printStackTrace();
			System.out.println("Unable to load props: " +
					pex.getMessage());
		}

		// Get the command line params
		String aspenInstallDir = pl.getString("aspen.install_dir");

		aspenInstallDir = new File(aspenInstallDir)
				.getAbsolutePath();

		// add a slash, if necessary
		if (!aspenInstallDir.endsWith(File.separator))
			aspenInstallDir += File.separator;

		// Load properties that are used and/or transformed here
		String appSysName = pl.getString("app.system_name");
		String appInstallDir = aspenInstallDir + "apps" +
			File.separator + appSysName;
		//String regGroup = pl.getString("app.registry_group").toLowerCase();
		String appDisplayName = pl.getString("app.display_name");
		String appJarPath = new File(pl.getString("app.jar_path"))
				.getAbsolutePath();

		String csJar = aspenInstallDir + CS_LIB_PATH + CS_JAR_NAME;
		String aspenClassDir = aspenInstallDir + ASPEN_CLASS_DIR;

		// Update the properties
		props.put("app.jar_path", appJarPath);
		props.put("app.install_dir", appInstallDir);
		//props.put("app.registry_group", regGroup);

		props.put("aspen.class_dir", aspenClassDir);
		props.put("aspen.install_dir", aspenInstallDir);
		props.put("aspen.cs_jar_path", csJar);

		lw.logMsg("=== START: " + appDisplayName + " ========================");

		lw.logMsg("Run:","\n\nLOADING PROPERTIES\n");
		lw.logMsg("Run:","App info: " + props.toString());

		// Create a registry bundle
		RegistryBundle rb = new RegistryBundle();
		DbConnectionPool csDbPool = null;
		DbConnectionPool consoleDbPool = null;

		String driver = props.getProperty("aspen.db.driver");
		try {
			if (driver != "") {
				System.out.println("Registering driver: " + driver);
				Class.forName (driver);
				Properties sysProps = System.getProperties();
				sysProps.put("jdbc.drivers", driver);
			}

			String protocol = props.getProperty("aspen.db.protocol");
			String host = props.getProperty("aspen.db.host");
			String user = props.getProperty("aspen.db.username");
			String pwd = props.getProperty("aspen.db.password");

			StringBuffer dbURL = new StringBuffer();
			dbURL.append(protocol);
			if (!dbURL.toString().endsWith(":"))
				dbURL.append(":");
			dbURL.append("//")
				.append(host)
				.append("/");

			// Make the database connections
			String consoleDsn = props.getProperty("aspen.db.console_dsn");
			String consoleURL = dbURL.toString() + consoleDsn;
			consoleDbPool = new DbConnectionPool(consoleURL, user, pwd, driver, 1, 1);

			String csDsn = props.getProperty("aspen.db.cs_dsn");
			String csURL = dbURL.toString() + csDsn;
			csDbPool = new DbConnectionPool(csURL, user, pwd, driver, 1, 1);

			// Turn off auto-commit so we can roll back if necessary
			consoleDbPool.getConnection().getConnection().setAutoCommit(false);
			csDbPool.getConnection().getConnection().setAutoCommit(false);

			success = true;

		} catch(Exception e) {
			e.printStackTrace();
			System.out.println("Error connecting to databases: " +
					e.getMessage());
			lw.logMsg("Run","Error connecting to databases: " +
					e.getMessage());
			success = false;
		}

		if (success) {
			try {
				lw.logMsg("Run:","\n\nLOADING APP JAR\n");

				lw.logMsg("Run:","Creating new AppInstaller for app: " +
						appDisplayName);
				AppInstaller ai = new AppInstaller(props, consoleDbPool, csDbPool, lw);

				lw.logMsg("Run:","\n\nINSTALLING APP\n");
				ai.install();

				lw.logMsg("Run:","\n\nCOMMITTING CHANGES TO DATABASES\n");
				csDbPool.getConnection().getConnection().commit();
				consoleDbPool.getConnection().getConnection().commit();

			} catch (Exception ex) {

				lw.logErr("Run:","Problem installing app:\n", ex);
				lw.logMsg("Run:","\n\nROLLING BACK DB TRANSACTIONS\n\n");
				try {
					csDbPool.getConnection().getConnection().rollback();
					consoleDbPool.getConnection().getConnection().rollback();
				} catch (SQLException re) {
					lw.logErr("Run:","Unable to rollback:", re);
				}
			}

		} else {
			System.out.println("Problem while installing the application");
			lw.logMsg("Run:","Problem while installing the application");
		}

		lw.logMsg(
				"", "=== DONE: " + appDisplayName + " ========================\n\n");
	}

}


text:
namespace PatientManagement.Administration.Endpoints
{
    using Serenity;
    using Serenity.Data;
    using Serenity.Services;
    using System.Data;
    using Microsoft.AspNetCore.Mvc;
    using MyRepository = Repositories.CouponsRepository;
    using MyRow = Entities.CouponsRow;

    [Route("Services/Administration/Coupons/[action]")]
    [ConnectionKey(typeof(MyRow)), ServiceAuthorize(typeof(MyRow))]
    public class CouponsController : ServiceEndpoint
    {
        [HttpPost, AuthorizeCreate(typeof(MyRow))]
        public SaveResponse Create(IUnitOfWork uow, SaveRequest<MyRow> request)
        {
            return new MyRepository().Create(uow, request);
        }

        [HttpPost, AuthorizeUpdate(typeof(MyRow))]
        public SaveResponse Update(IUnitOfWork uow, SaveRequest<MyRow> request)
        {
            return new MyRepository().Update(uow, request);
        }

        [HttpPost, AuthorizeDelete(typeof(MyRow))]
        public DeleteResponse Delete(IUnitOfWork uow, DeleteRequest request)
        {
            return new MyRepository().Delete(uow, request);
        }
        [HttpPost, AuthorizeDelete(typeof(MyRow))]
        public UndeleteResponse Undelete(IUnitOfWork uow, UndeleteRequest request)
        {
            return new MyRepository().Undelete(uow, request);
        }
        public RetrieveResponse<MyRow> Retrieve(IDbConnection connection, RetrieveRequest request)
        {
            return new MyRepository().Retrieve(connection, request);
        }

        public ListResponse<MyRow> List(IDbConnection connection, ListRequest request)
        {
            return new MyRepository().List(connection, request);
        }
    }
}

redpajama_set_name: RedPajamaGithub


text:
package org.fluentjava.iwant.api.core;

import junit.framework.TestCase;

public class StringFilterByEqualityTest extends TestCase {

	public void testMatchingAndNonMatching() {
		StringFilterByEquality a = new StringFilterByEquality("a");
		assertTrue(a.matches("a"));
		assertFalse(a.matches("b"));

		StringFilterByEquality b = new StringFilterByEquality("b");
		assertTrue(b.matches("b"));
		assertFalse(b.matches("a"));
	}

	public void testToString() {
		assertEquals("StringFilterByEquality:a",
				new StringFilterByEquality("a").toString());
		assertEquals("StringFilterByEquality:b",
				new StringFilterByEquality("b").toString());
	}

}


text:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
	<modelVersion>4.0.0</modelVersion>

	<groupId>cn.kunter</groupId>
	<artifactId>kunter-constant</artifactId>
	<version>0.0.1-SNAPSHOT</version>
	<packaging>jar</packaging>

	<name>Kunter Constant</name>
	<url>http://constant.kunter.cn</url>

	<licenses>
		<license>
			<name>Apache 2</name>
			<url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
			<distribution>repo</distribution>
			<comments>A business-friendly OSS license</comments>
		</license>
	</licenses>

	<organization>
		<name>Kunter</name>
		<url>http://kunter.cn</url>
	</organization>

	<developers>
		<developer>
			<id>nature</id>
			<name>Nature</name>
			<email>nature@kunter.cn</email>
			<url>http://nature.kunter.cn</url>
			<organization>Kunter</organization>
			<organizationUrl>http://kunter.cn</organizationUrl>
			<roles>
				<role>architect</role>
				<role>developer</role>
			</roles>
			<timezone>-6</timezone>
		</developer>
	</developers>

	<repositories>
		<repository>
			<id>maven.kunter.cn</id>
			<name>Kunter Repository</name>
			<url>http://maven.kunter.cn/content/groups/public/</url>
			<releases>
				<enabled>true</enabled>
			</releases>
			<snapshots>
				<enabled>true</enabled>
			</snapshots>
			<layout>default</layout>
		</repository>
	</repositories>

	<distributionManagement>
		<repository>
			<id>maven.kunter.cn-releases</id>
			<name>Kunter Nexus Release Repository</name>
			<url>http://maven.kunter.cn/content/repositories/releases/</url>
		</repository>
		<snapshotRepository>
			<id>maven.kunter.cn-snapshots</id>
			<name>Kunter Nexus Snapshot Repository</name>
			<url>http://maven.kunter.cn/content/repositories/snapshots/</url>
		</snapshotRepository>
	</distributionManagement>

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

	<dependencies>
		<dependency>
			<groupId>commons-io</groupId>
			<artifactId>commons-io</artifactId>
			<version>2.4</version>
		</dependency>
		<dependency>
			<groupId>org.apache.poi</groupId>
			<artifactId>poi</artifactId>
			<version>${poi_version}</version>
			<exclusions>
				<exclusion>
					<artifactId>commons-codec</artifactId>
					<groupId>commons-codec</groupId>
				</exclusion>
			</exclusions>
		</dependency>
		<dependency>
			<groupId>org.apache.poi</groupId>
			<artifactId>poi-ooxml</artifactId>
			<version>${poi_version}</version>
		</dependency>
		<dependency>
			<groupId>org.apache.poi</groupId>
			<artifactId>poi-ooxml-schemas</artifactId>
			<version>${poi_version}</version>
		</dependency>
		<dependency>
			<groupId>org.apache.xmlbeans</groupId>
			<artifactId>xmlbeans</artifactId>
			<version>2.6.0</version>
			<exclusions>
				<exclusion>
					<artifactId>stax-api</artifactId>
					<groupId>stax</groupId>
				</exclusion>
			</exclusions>
		</dependency>
		<dependency>
			<groupId>mysql</groupId>
			<artifactId>mysql-connector-java</artifactId>
			<version>8.0.16</version>
		</dependency>
		<dependency>
			<groupId>com.alibaba</groupId>
			<artifactId>fastjson</artifactId>
			<version>1.2.25.sec10</version>
		</dependency>
		<dependency>
			<groupId>junit</groupId>
			<artifactId>junit</artifactId>
			<version>4.13.1</version>
			<scope>test</scope>
		</dependency>
	</dependencies>

	<build>
		<finalName>${project.artifactId}-${project.version}</finalName>
		<plugins>
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-compiler-plugin</artifactId>
				<version>3.3</version>
				<configuration>
					<source>1.7</source>
					<target>1.7</target>
					<encoding>UTF8</encoding>
				</configuration>
			</plugin>
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-surefire-plugin</artifactId>
				<version>2.18.1</version>
				<configuration>
					<skipTests>true</skipTests>
				</configuration>
			</plugin>
		</plugins>
	</build>
</project>


text:
package com.elfec.cobranza.model;

import android.database.Cursor;

import com.activeandroid.Cache;
import com.activeandroid.Model;
import com.activeandroid.annotation.Column;
import com.activeandroid.annotation.Table;
import com.activeandroid.query.From;
import com.activeandroid.query.Select;

import java.math.BigDecimal;
/**
 * Almacena las CATEGORIAS
 * @author drodriguez
 *
 */
@Table(name = "Categories")
public class Category extends Model {
	/**
	 * IDCATEGORIA en Oracle
	 */
	@Column(name = "CategoryId", notNull=true, index=true)
	private String categoryId;
	/**
	 * IDTIPO_SRV en Oracle
	 */
	@Column(name = "ServiceTypeId")
	private int serviceTypeId;
	/**
	 * DESCRIPCION en Oracle
	 */
	@Column(name = "Description")
	private String description;
	/**
	 * IDTIPO_CATEG en Oracle
	 */
	@Column(name = "CategoryTypeId", notNull=true, index=true)
	private int categoryTypeId;
	/**
	 * CTROL_IVAS en Oracle
	 * Tipos de ivas que pueden tener los suministros de esta Categoria.
	 * Ejemplo: `(1,2,3)? donde 1 2 y 3 son distintos tipos de iva.
	 */
	@Column(name = "IVAsControl")
	private String IVAsControl;
	/**
	 * IDSTATUS en Oracle
	 */
	@Column(name = "StatusId")
	private short statusId;
	/**
	 * CLASIF en Oracle
	 * Clasificación de la categoría
	 */
	@Column(name = "Classification")
	private String classification;
	/**
	 * CTROL_TMEDID en Oracle
	 * Control de Tipos de Medidores
	 */
	@Column(name = "MeterTypeControl")
	private String meterTypeControl;
	/**
	 * CLASIF2 en Oracle
	 * MultiUso, creado por la exportacion de la res. 1434
	 */
	@Column(name = "Classification2")
	private String classification2;
	/**
	 * FACTOR_CARGA en Oracle
	 */
	@Column(name = "LoadFactor")
	private BigDecimal loadFactor;
	/**
	 * FACTURAR_DEM en Oracle
	 * facturar demanda
	 */
	@Column(name = "BillingDemand")
	private short billingDemand;

	public Category() {
		super();
	}

	public Category(String categoryId, int serviceTypeId, String description,
			int categoryTypeId, String IVAsControl, short statusId,
			String classification, String meterTypeControl,
			String classification2, BigDecimal loadFactor, short billingDemand) {
		super();
		this.categoryId = categoryId;
		this.serviceTypeId = serviceTypeId;
		this.description = description;
		this.categoryTypeId = categoryTypeId;
		this.IVAsControl = IVAsControl;
		this.statusId = statusId;
		this.classification = classification;
		this.meterTypeControl = meterTypeControl;
		this.classification2 = classification2;
		this.loadFactor = loadFactor;
		this.billingDemand = billingDemand;
	}

	/**
	 * Obtiene la cadena para mostrar de la categoría
	 * @param categoryId
	 * @return la cadena en formato DOMICILIARIA/PDBTR1
	 */
	public static String getFullCategoryDesc(String categoryId)
	{
		From query = new Select("trim(b.Description)||'/'||trim(a.Classification2) FullCategoryDesc")
	    .from(Category.class).as("a")
	    .innerJoin(SupplyCategoryType.class).as("b")
	    .on("a.CategoryTypeId = b.CategoryTypeId")
	    .where("a.CategoryId = ?", categoryId);

		Cursor cursor = Cache.openDatabase().rawQuery(query.toSql(), query.getArguments());
		if(cursor!=null)
		{
			cursor.moveToFirst();
			return cursor.getString(0);
		}
		return categoryId;//retorna el mismo id como categoría en caso de no encontrarse
	}

	//#region Getters y Setters
	public String getCategoryId() {
		return categoryId;
	}
	public void setCategoryId(String categoryId) {
		this.categoryId = categoryId;
	}
	public int getServiceTypeId() {
		return serviceTypeId;
	}
	public void setServiceTypeId(int serviceTypeId) {
		this.serviceTypeId = serviceTypeId;
	}
	public String getDescription() {
		return description;
	}
	public void setDescription(String description) {
		this.description = description;
	}
	public int getCategoryTypeId() {
		return categoryTypeId;
	}
	public void setCategoryTypeId(int categoryTypeId) {
		this.categoryTypeId = categoryTypeId;
	}
	public String getIVAsControl() {
		return IVAsControl;
	}
	public void setIVAsControl(String iVAsControl) {
		IVAsControl = iVAsControl;
	}
	public short getStatusId() {
		return statusId;
	}
	public void setStatusId(short statusId) {
		this.statusId = statusId;
	}
	public String getClassification() {
		return classification;
	}
	public void setClassification(String classification) {
		this.classification = classification;
	}
	public String getMeterTypeControl() {
		return meterTypeControl;
	}
	public void setMeterTypeControl(String meterTypeControl) {
		this.meterTypeControl = meterTypeControl;
	}
	public String getClassification2() {
		return classification2;
	}
	public void setClassification2(String classification2) {
		this.classification2 = classification2;
	}
	public BigDecimal getLoadFactor() {
		return loadFactor;
	}
	public void setLoadFactor(BigDecimal loadFactor) {
		this.loadFactor = loadFactor;
	}
	public short getBillingDemand() {
		return billingDemand;
	}
	public void setBillingDemand(short billingDemand) {
		this.billingDemand = billingDemand;
	}

	//#endregion

}


text:
require 'write_xlsx/worksheet'

module Writexlsx
  class Chartsheet < Worksheet
    include Writexlsx::Utility

    attr_writer :chart

    def initialize(workbook, index, name)
      super
      @drawings          = Drawings.new
      @is_chartsheet     = true
      @chart             = nil
      @charts            = [1]
      @zoom_scale_normal = 0
      @page_setup.orientation = false
    end

    #
    # Assemble and write the XML file.
    #
    def assemble_xml_file # :nodoc:
      return unless @writer

      write_xml_declaration do
        # Write the root chartsheet element.
        write_chartsheet do
          # Write the worksheet properties.
          write_sheet_pr
          # Write the sheet view properties.
          write_sheet_views
          # Write the sheetProtection element.
          write_sheet_protection
          # Write the printOptions element.
          write_print_options
          # Write the worksheet page_margins.
          write_page_margins
          # Write the worksheet page setup.
          write_page_setup
          # Write the headerFooter element.
          write_header_footer
          # Write the drawing element.
          write_drawings
          # Close the worksheet tag.
        end
      end
    end

    def protect(password = '', user_options = nil, options = {})
      # Objects are default on for chartsheets.
      if user_options
        options[:objects] = if user_options.has_key?(:objects)
                              if ptrue?(user_options[:objects])
                                0
                              else
                                1
                              end
                            else
                              0
                            end

        options[:content] = if user_options.has_key?(:content)
                              user_options[:content]
                            else
                              1
                            end
      else
        options[:objects] = 0
        options[:content] = 1
      end

      # Is objects and content are off then the chartsheet isn't locked.
      # except if it has a password.
      return if password == '' && ptrue?(options[:objects]) && !ptrue?(options[:content])

      @chart.protection = 1

      # Turn off worksheet defaults.
      options[:sheet]     = 0
      options[:scenarios] = 1

      super(password, options)
    end

    ###############################################################################
    #
    # Encapsulated Chart methods.
    #
    ###############################################################################

    def add_series(*args)
      @chart.add_series(*args)
    end

    def set_x_axis(*args)
      @chart.set_x_axis(*args)
    end

    def set_y_axis(*args)
      @chart.set_y_axis(*args)
    end

    def set_x2_axis(*args)
      @chart.set_x2_axis(*args)
    end

    def set_y2_axis(*args)
      @chart.set_y2_axis(*args)
    end

    def set_title(*args)
      @chart.set_title(*args)
    end

    def set_legend(*args)
      @chart.set_legend(*args)
    end

    def set_plotarea(*args)
      @chart.set_plotarea(*args)
    end

    def set_chartarea(*args)
      @chart.set_chartarea(*args)
    end

    def set_style(*args)
      @chart.set_style(*args)
    end

    def show_blanks_as(*args)
      @chart.show_blanks_as(*args)
    end

    def show_hidden_data(*args)
      @chart.show_hidden_data(*args)
    end

    def set_size(*args)
      @chart.set_size(*args)
    end

    def set_table(*args)
      @chart.set_table(*args)
    end

    def set_up_down_bars(*args)
      @chart.set_up_down_bars(*args)
    end

    def set_drop_lines(*args)
      @chart.set_drop_lines(*args)
    end

    def set_high_low_lines(*args)
      @chart.set_high_low_lines(*args)
    end

    #
    # Set up chart/drawings.
    #
    def prepare_chart(_index, chart_id, drawing_id) # :nodoc:
      @chart.id = chart_id - 1

      drawings  = Drawings.new
      @drawings = drawings
      @drawings.orientation = @page_setup.orientation

      @external_drawing_links << ['/drawing', "../drawings/drawing#{drawing_id}.xml"]

      @drawing_links << ['/chart', "../charts/chart#{chart_id}.xml"]
    end

    def external_links
      [@external_drawing_links]
    end

    private

    #
    # Write the <chartsheet> element. This is the root element of Chartsheet.
    #
    def write_chartsheet(&block) # :nodoc:
      schema                 = 'http://schemas.openxmlformats.org/'
      xmlns                  = schema + 'spreadsheetml/2006/main'
      xmlns_r                = schema + 'officeDocument/2006/relationships'

      attributes = [
        ['xmlns',   xmlns],
        ['xmlns:r', xmlns_r]
      ]

      @writer.tag_elements('chartsheet', attributes, &block)
    end

    #
    # Write the <sheetPr> element for Sheet level properties.
    #
    def write_sheet_pr # :nodoc:
      attributes = []

      attributes << ['filterMode', 1] if ptrue?(@filter_on)

      if ptrue?(@fit_page) || ptrue?(@tab_color)
        @writer.tag_elements('sheetPr', attributes) do
          write_tab_color
          write_page_set_up_pr
        end
      else
        @writer.empty_tag('sheetPr', attributes)
      end
    end
  end
end


text:
import unittest

from coremltools._deps import _HAS_SKLEARN, _HAS_XGBOOST

if _HAS_XGBOOST:

    pass

if _HAS_SKLEARN:
    from sklearn.tree import DecisionTreeRegressor

    from coremltools.converters import sklearn as skl_converter

@unittest.skipIf(not _HAS_SKLEARN, "Missing sklearn. Skipping tests.")
class DecisionTreeRegressorScikitTest(unittest.TestCase):
    """
    Unit test class for testing scikit-learn converter.
    """

    @classmethod
    def setUpClass(self):
        """
        Set up the unit test by loading the dataset and training a model.
        """
        from sklearn.datasets import load_boston
        from sklearn.tree import DecisionTreeRegressor

        scikit_data = load_boston()
        scikit_model = DecisionTreeRegressor(random_state=1)
        scikit_model.fit(scikit_data["data"], scikit_data["target"])

        # Save the data and the model
        self.scikit_data = scikit_data
        self.scikit_model = scikit_model

    def test_conversion(self):
        feature_names = self.scikit_data.feature_names
        output_name = "target"
        spec = skl_converter.convert(
            self.scikit_model, feature_names, "target"
        ).get_spec()
        self.assertIsNotNone(spec)

        # Test the model class
        self.assertIsNotNone(spec.description)
        self.assertIsNotNone(spec.treeEnsembleRegressor)

        # Test the interface class
        self.assertEqual(spec.description.predictedFeatureName, "target")

        # Test the inputs and outputs
        self.assertEqual(len(spec.description.output), 1)
        self.assertEqual(spec.description.output[0].name, "target")
        self.assertEqual(
            spec.description.output[0].type.WhichOneof("Type"), "doubleType"
        )
        for input_type in spec.description.input:
            self.assertEqual(input_type.type.WhichOneof("Type"), "doubleType")
        self.assertEqual(
            sorted(feature_names), sorted(map(lambda x: x.name, spec.description.input))
        )

        # Test the linear regression parameters.
        tr = spec.pipelineRegressor.pipeline.models[
            1
        ].treeEnsembleRegressor.treeEnsemble
        self.assertIsNotNone(tr)
        self.assertEqual(len(tr.nodes), self.scikit_model.tree_.node_count)

    def test_conversion_bad_inputs(self):
        # Error on converting an untrained model
        with self.assertRaises(Exception):
            model = DecisionTreeRegressor()
            spec = skl_converter.convert(model, "data", "out")

        # Check the expected class during covnersion.
        from sklearn.preprocessing import OneHotEncoder

        with self.assertRaises(Exception):
            model = OneHotEncoder()
            spec = skl_converter.convert(model, "data", "out")


text:
<!DOCTYPE html>

	<meta charset="utf-8" />
	<title></title>


text:
require 'socket'
server = TCPServer.open(2000)
client = server.accept
for i in 0..5
  ii = 5 - i
  client.puts "countdown - #{ii}"
  sleep 0.5
end
text = "GO Loops in Ruby are used to execute the same block of code a specified number of times. This chapter details all the loop statements supported by Ruby. Executes code while conditional is true. A while loop's conditional is separated from code by the reserved word do, a newline, backslash \, or a semicolon ;."
puts text
client.puts text
puts "waiting for text from client:"
loop do
  line = client.gets
  if match = line.match(/connect\s(.*)/)
    client_name = match.captures
    puts "#{client_name} connected!"
  else
    STDOUT.write "#{line.chomp} (code #{line[0].ord})"
  end
end
puts "closing..."
client.close


text:
CREATE SEQUENCE SEQ_KC_KRMS_TERM_FUN_PARM_ID INCREMENT BY 1 START WITH 1 NOCACHE
/


text:
/**
 * Created by DavidHong on 2015. 6. 25..
 */

module.exports = {
    secret: 'supersecretkey'
}


text:
package com.uber.jenkins.phabricator;

import com.cloudbees.plugins.credentials.CredentialsMatcher;
import com.cloudbees.plugins.credentials.CredentialsMatchers;
import com.cloudbees.plugins.credentials.CredentialsProvider;
import com.cloudbees.plugins.credentials.common.StandardCredentials;
import com.cloudbees.plugins.credentials.common.StandardListBoxModel;
import com.cloudbees.plugins.credentials.domains.DomainRequirement;
import com.uber.jenkins.phabricator.credentials.ConduitCredentials;
import hudson.model.Item;
import hudson.model.Job;
import hudson.security.ACL;
import hudson.util.ListBoxModel;
import jenkins.model.Jenkins;
import org.kohsuke.stapler.AncestorInPath;

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

public class ConduitCredentialsDescriptor {
    private static List<ConduitCredentials> availableCredentials(Job owner) {
        return CredentialsProvider.lookupCredentials(
                ConduitCredentials.class,
                owner,
                null,
                new ArrayList<DomainRequirement>()
        );
    }

    public static ConduitCredentials getCredentials(Job owner, String credentialsID) {
        List<ConduitCredentials> available = availableCredentials(owner);
        if (available.size() == 0) {
            return null;
        }
        CredentialsMatcher matcher;
        if (credentialsID != null) {
            matcher = CredentialsMatchers.allOf(CredentialsMatchers.withId(credentialsID));
        } else {
            matcher = CredentialsMatchers.always();
        }
        return CredentialsMatchers.firstOrDefault(
                available,
                matcher,
                available.get(0)
        );
    }

    public static ListBoxModel doFillCredentialsIDItems(@AncestorInPath Jenkins context) {
        if (context == null || !context.hasPermission(Item.CONFIGURE)) {
            return new StandardListBoxModel();
        }

        List<DomainRequirement> domainRequirements = new ArrayList<DomainRequirement>();
        return new StandardListBoxModel()
                .withEmptySelection()
                .withMatching(
                        CredentialsMatchers.anyOf(
                                CredentialsMatchers.instanceOf(ConduitCredentials.class)),
                        CredentialsProvider.lookupCredentials(
                                StandardCredentials.class,
                                context,
                                ACL.SYSTEM,
                                domainRequirements));
    }
}


text:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE studentStatuses PUBLIC "-//UniTime//UniTime Student Scheduling Statuses DTD/EN" "http://www.unitime.org/interface/StudentStatuses.dtd">

<!--
 * Licensed to The Apereo Foundation under one or more contributor license
 * agreements. See the NOTICE file distributed with this work for
 * additional information regarding copyright ownership.
 *
 * The Apereo Foundation licenses this file to you under the Apache License,
 * Version 2.0 (the "License"); you may not use this file except in
 * compliance with the License. You may obtain a copy of the License at:
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 -->
<studentStatuses created="Tue Apr 03 15:06:12 CEST 2018" dateFormat="yyyy/M/d" timeFormat="HHmm" incremental="true">
  <status reference="Disabled" name="Access disabled">
    <permissions assistantEnabled="false" assistantAdvisorEdit="false" emaiNotifications="true" mustHaveCourseType="false" waitListing="false" doNotScheduleInBatch="false" assistantStudentEdit="false" assistantAdminEdit="false" requestsStudentEdit="false" requestsEnabled="false" requestsAdvisorEdit="false" requestsAdminEdit="false" advisorCanSetStatus="true"/>
  </status>
  <status reference="Enabled" name="Access enabled">
    <permissions assistantEnabled="true" assistantAdvisorEdit="true" emaiNotifications="true" mustHaveCourseType="false" waitListing="false" doNotScheduleInBatch="false" assistantStudentEdit="true" assistantAdminEdit="true" requestsStudentEdit="true" requestsEnabled="true" requestsAdvisorEdit="true" requestsAdminEdit="true" advisorCanSetStatus="false"/>
  </status>
  <status reference="Enrollment" name="Scheduling Assistant Enabled">
    <permissions assistantEnabled="true" assistantAdvisorEdit="true" emaiNotifications="true" mustHaveCourseType="false" waitListing="false" doNotScheduleInBatch="false" assistantStudentEdit="true" assistantAdminEdit="true" requestsStudentEdit="false" requestsEnabled="false" requestsAdvisorEdit="false" requestsAdminEdit="false" advisorCanSetStatus="true"/>
    <effective-dates startDate="2018/7/1" stopDate="2018/7/31"/>
    <message>Enrollment is enabled.</message>
    <fallback reference="Disabled"/>
  </status>
  <status reference="No Email" name="Access enabled, no email notification">
    <permissions assistantEnabled="true" assistantAdvisorEdit="true" emaiNotifications="false" mustHaveCourseType="false" waitListing="false" doNotScheduleInBatch="false" assistantStudentEdit="true" assistantAdminEdit="true" requestsStudentEdit="true" requestsEnabled="true" requestsAdvisorEdit="true" requestsAdminEdit="true" advisorCanSetStatus="false"/>
  </status>
  <status reference="Not Available" name="Temporarily not available">
    <permissions assistantEnabled="true" assistantAdvisorEdit="true" emaiNotifications="true" mustHaveCourseType="false" waitListing="false" doNotScheduleInBatch="false" assistantStudentEdit="false" assistantAdminEdit="true" requestsStudentEdit="false" requestsEnabled="false" requestsAdvisorEdit="false" requestsAdminEdit="false" advisorCanSetStatus="false"/>
    <message>Access is temporarily disabled. Please try again later...</message>
  </status>
  <status reference="Requests" name="Course Requests Enabled">
    <permissions assistantEnabled="false" assistantAdvisorEdit="false" emaiNotifications="true" mustHaveCourseType="false" waitListing="false" doNotScheduleInBatch="false" assistantStudentEdit="false" assistantAdminEdit="false" requestsStudentEdit="true" requestsEnabled="true" requestsAdvisorEdit="true" requestsAdminEdit="true" advisorCanSetStatus="true"/>
    <effective-dates startDate="2018/4/1" startPeriod="0800" stopDate="2018/5/31" stopPeriod="2200"/>
    <message>Registration is enabled.</message>
    <fallback reference="Disabled"/>
  </status>
</studentStatuses>


text:
namespace {

using namespace tpie;

void usage() {
	std::cout << "Run without arguments to run test." << std::endl;
}

void print_version() {
	tpie::sysinfo si;
	std::cout << si << std::endl;
}

static const stream_size_type x = 0x100000001ull;
static const size_t timesPerWorker = 1000000;
static const size_t workers = 8;
static const stream_size_type expectedValue = x * timesPerWorker * workers;

void increase_stats_worker() {
	for (size_t i = 0; i < timesPerWorker; ++i) {
		tpie::increment_temp_file_usage(x);
	}
}

void increase_stats() {
	std::cout << "Run " << workers << " workers, each incrementing the statistic "
		<< timesPerWorker << " times." << std::endl;
	tpie::array<std::thread> threads(workers);
	for (size_t i = 0; i < workers; ++i) {
		std::thread t(increase_stats_worker);
		threads[i].swap(t);
	}
	for (size_t i = 0; i < workers; ++i) {
		threads[i].join();
	}
}

bool check_stats() {
	return tpie::get_temp_file_usage() == expectedValue;
}

} // unnamed namespace

int main(int argc, char ** argv) {
	for (int i = 1; i < argc; ++i) {
		std::string arg = argv[i];
		if (arg == "--help") {
			usage();
			return 1;
		}
		if (arg == "--version") {
			print_version();
			return 1;
		}
	}
	tpie::tpie_init();
	increase_stats();
	bool result = check_stats();
	tpie::tpie_finish();
	if (result) {
		std::cout << "Success!" << std::endl;
		return 0;
	} else {
		std::cout << "Wrong result." << std::endl;
		return 1;
	}
}


text:
package com.stabilise.util.io;

import java.io.IOException;

/**
 * Defines the two complementary methods {@code readData} and {@code writeData}
 * which allow an object to serialise and deserialise its state to and from
 * data streams.
 */
public interface Sendable {

    /**
     * Reads this object's data from the given DataInStream.
     *
     * @throws NullPointerException if {@code in} is {@code null}.
     * @throws IOException if an I/O error occurs.
     */
    void readData(DataInStream in) throws IOException;

    /**
     * Writes this object's data to the given DataOutStream.
     *
     * @throws NullPointerException if {@code out} is {@code null}.
     * @throws IOException if an I/O error occurs.
     */
    void writeData(DataOutStream out) throws IOException;

}


text:
[![Build Status](https://secure.travis-ci.org/tylingsoft/dagre-layout.png?branch=master)](http://travis-ci.org/tylingsoft/dagre-layout)
[![Coverage Status](https://coveralls.io/repos/github/tylingsoft/dagre-layout/badge.svg?branch=master)](https://coveralls.io/github/tylingsoft/dagre-layout?branch=master)

This project is an out-of-box replacement for [dagre](https://github.com/dagrejs/dagre).

This project isn't built from scratch. It's based on the original [dagre](https://github.com/dagrejs/dagre) project.

Dagre is a JavaScript library that makes it easy to lay out directed graphs on the client-side.

For more details, including examples and configuration options, please see our [wiki](https://github.com/dagrejs/dagre/wiki).

## Changes compared to dagrejs/dagre

- Upgrade all the dependencies (loadash 3 => 4)
- Yarn instead of NPM
- Get rid of PhantomJS
- ES6 instead of ES5
- Use webpack instead of browserify
- Use JavaScript Standard Style instead of JSHint
- Use Jest for testing
- Add test coverage report
- Remove Bower support
- Use 0 instead of `Number.NEGATIVE_INFINITY`
- Git ignore auto-generated code

## Setup

```
yarn install
```

## Build

```
yarn build
```

## Test

```
yarn test
```

## License

dagre-layout is licensed under the terms of the MIT License. See the LICENSE file for details.


text:
<?php

if (!defined('CPG_NUKE')) { exit; }
/* START languages/language/lang-*.php*/
define('_THISISAUTOMATED','This is an automated email to let you know that your banner advertising in our site has been completed.');
define('_THERESULTS','The results of your campaign are as follows:');
define('_TOTALIMPRESSIONS','Total Impression Made:');
define('_CLICKSRECEIVED','Clicks Received:');
define('_IMAGEURL','Image URL');
define('_CLICKURL','Click URL');
define('_ALTERNATETEXT','Alternate Text');
define('_HOPEYOULIKED','Hope you liked our service. We look forward to having you as an advertising customer again soon.');
define('_THANKSUPPORT','Thanks for your Support');
define('_BANNERSFINNISHED','Banners Ads Finished');
/* END languages/language/lang-*.php*/
/* START  languages/admin/language/lang-*.php */
define('_ACTIVEBANNERS','Current Active Banners');
define('_ACTIVEBANNERS2','Active Banners');
define('_IMPRESSIONS','Impressions');
define('_IMPLEFT','Imp. Left');
define('_CLICKS','Clicks');
define('_CLICKSPERCENT','% Clicks');
define('_CLIENTNAME','Client Name');
define('_FINISHEDBANNERS','Finished Banners');
define('_IMP','Imp.');
define('_DATESTARTED','Date Started');
define('_DATEENDED','Date Ended');
define('_ADVERTISINGCLIENTS','Advertising Clients');
define('_CONTACTNAME','Contact Name');
define('_CONTACTEMAIL','Contact Email');
define('_ADDNEWBANNER','Add a New Banner');
define('_PURCHASEDIMPRESSIONS','Purchased Impressions');
define('_NORMAL','Normal');
define('_INACTIVEBANNERS','Inactive Banners');
//define('_TYPE','Type');
/* END  languages/admin/language/lang-*.php */
/*NEW*/
define('_BANNERTITLE','This is where you can advertise your site or services');
define('BANNER_ID','Banner ID');
define('TEXT','Text: ');
define('_IMAGE_BANNER','Image Banner');
define('_TEXT_BANNER','Text Banner');
define('_TEXT_HGT','Text Box Height');
define('_TEXT_WIDTH','Text Box Width');
define('_TEXT_TITLE','Banner Text');
define('_TEXT_COLOR','Text Color');
define('_TEXT_BACKGROUND','Background of Banner');
define('_IMPRESSIONS_WANTED','Impressions You Want to purchase');
define('_TIMEPERIOD_WANTED','Time period to purchase');
define('_ADVERT','Advertisement');
//define('_BANNERS','Banners');
define('_NO_BANNERS','There are no banners yet for');


text:
<!DOCTYPE html>

    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">

    <meta name="description" content="">
    <meta name="author" content="">
    <link rel="icon" href="../../favicon.ico">

    <title>Dashboard Template for Bootstrap</title>

    <link href="<?php echo site_url('css/bootstrap.min.css');?>" rel="stylesheet">

     <link href="<?php echo site_url('css/dashboard.css');?>" rel="stylesheet">

          <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar">
            Toggle navigation

          </button>
          CMS

Dashboard

<a href="<?php echo site_url().'admin/dashboard/settings/'; ?>">Settings

<a href="<?php echo site_url().'users/logout/'; ?>">Logout

<a href="<?php echo site_url().'admin/dashboard'; ?>">Overview (current)

<a href="<?php echo site_url().'pages'; ?>">Pages

<a href="<?php echo site_url().'articles'; ?>">News

<a href="<?php echo site_url().'users'; ?>">Users

<a href="<?php echo site_url().'admin/dashboard/settings/'; ?>">Settings

Welcome

Add new Page

          <?php if(validation_errors() == NULL){

          }
          else {?>

<?php echo validation_errors(); ?>
<?php
          }
          ?>

           <?php

           echo form_open('pages/new_page');

           $title = array(
              'name'        => 'title',
              'id'          => 'title',
              'maxlength'   => '100',
              'size'        => '50',
            );

            $order = array(
              'name'        => 'order',
              'id'          => 'order',
              'maxlength'   => '100',
              'size'        => '50',
            );

            $content = array(
              'name'        => 'content',
              'id'          => 'content',
              'rows'        =>  '10',
              'cols'       => '51',
            );

            echo form_label('Page title', 'title');
            echo "
";
            echo form_input($title);
            echo "
";

            echo form_label('Page order', 'order');
            echo "
";
            echo form_input($order);
            echo "
";

            echo form_label('Content', 'about');
            echo "
";
            echo form_textarea($content);
            echo "
";

            echo form_submit('Create', 'Create Page');

            ?>


text:
<?php

namespace Valitor\Api\Test;

use Valitor\AbstractApi;
use Valitor\Authentication;
use Valitor\Exceptions\ClientException;
use GuzzleHttp\Psr7\Request;
use GuzzleHttp\Psr7\Response;
use Symfony\Component\OptionsResolver\OptionsResolver;

/**
 * This method requires no authentication and is presented for your system to test the connection to our system.
 */
class TestConnection extends AbstractApi
{

    /**
     * TestConnection constructor.
     * @param string $baseUrl
     */
    public function __construct($baseUrl = null)
    {
        $auth = new Authentication('', '', null);
        parent::__construct($auth);
        $this->baseUrl = $baseUrl;
    }

    /**
     * Is authentication required for this
     *
     * @return bool
     */
    protected function authRequired()
    {
        return false;
    }

    /**
     * Configure options
     *
     * @param OptionsResolver $resolver
     * @return void
     */
    protected function configureOptions(OptionsResolver $resolver)
    {
    }

    /**
     * Url to api call
     *
     * @param array $options Resolved options
     * @return string
     */
    protected function getUrl(array $options)
    {
        return 'testConnection';
    }

    /**
     * Handle response
     *
     * @param Request $request
     * @param Response $response
     * @return true
     */
    protected function handleResponse(Request $request, Response $response)
    {
        return true;
    }

    /**
     * Handle exception response
     *
     * @param ClientException $exception
     * @return false
     */
    protected function handleExceptionResponse(ClientException $exception)
    {
        return false;
    }
}


text:
package me.jefferey.imgur.ui;

import android.app.Fragment;
import android.app.FragmentManager;
import android.support.v13.app.FragmentPagerAdapter;

import me.jefferey.imgur.ui.account.MyAccountFragment;
import me.jefferey.imgur.ui.gallery.ImageListFragment;

/**
 * Created by jetpeter on 6/11/15.
 */
public class ImgurFragmentPagerAdapter extends FragmentPagerAdapter {

    public static final int FRAGMENT_COUNT = 2;

    private final ImageListFragment mImageListFragment;
    private final MyAccountFragment mMyAccountFragment;

    public ImgurFragmentPagerAdapter(FragmentManager fragmentManager,
                                     ImageListFragment imageListFragment,
                                     MyAccountFragment myAccountFragment) {
        super(fragmentManager);
        mImageListFragment = imageListFragment;
        mMyAccountFragment = myAccountFragment;
    }

    @Override
    public int getCount() {
        return FRAGMENT_COUNT;
    }

    @Override
    public Fragment getItem(int position) {
        switch (position) {
            case 0:
                return mImageListFragment;
            case 1:
                return mMyAccountFragment;
            default:
                return null;
        }
    }

    @Override
    public CharSequence getPageTitle(int position) {
        switch (position) {
            case 0:
                return mImageListFragment.getTitle();
            case 1:
                return mMyAccountFragment.getTitle();
            default:
                return "";
        }
    }
}


text:
import React from 'react';
import getMuiTheme from 'material-ui/styles/getMuiTheme';

import {
  SinglePageContainer,
  CircularProgressStyle,
  CharacterBodyContainer,
  LogoLinkContainer,
  ColumnAnimeinfo,
  ColumnBodyPage,
} from '../singleAnimePage';

const muiTheme = getMuiTheme();
describe('singleAnimePage style components', () => {
  it('Should render a SinglePageContainer Component', () => {
    const tree = renderer.create(<SinglePageContainer />).toJSON();
    expect(tree).toMatchSnapshot();
  });

  it('Should render a CircularProgressStyle Component', () => {
    const tree = shallow(
      <CircularProgressStyle />,
      {
        context: muiTheme,
      },
    );
    expect(toJson(tree)).toMatchSnapshot();
  });

  it('Should render a CharacterBodyContainer Component', () => {
    const tree = renderer.create(<CharacterBodyContainer />).toJSON();
    expect(tree).toMatchSnapshot();
  });

  it('Should render a LogoLinkContainer Component', () => {
    const tree = renderer.create(<LogoLinkContainer />).toJSON();
    expect(tree).toMatchSnapshot();
  });

  it('Should render a ColumnAnimeinfo Component', () => {
    const tree = renderer.create(<ColumnAnimeinfo />).toJSON();
    expect(tree).toMatchSnapshot();
  });

  it('Should render a ColumnBodyPage Component', () => {
    const tree = renderer.create(<ColumnBodyPage />).toJSON();
    expect(tree).toMatchSnapshot();
  });
});


text:
package org.waveprotocol.box.server.rpc.render.renderer;

import org.waveprotocol.wave.model.conversation.Conversation;
import org.waveprotocol.wave.model.conversation.ConversationBlip;
import org.waveprotocol.wave.model.conversation.ConversationThread;
import org.waveprotocol.wave.model.conversation.ConversationView;
import org.waveprotocol.wave.model.util.IdentityMap;
import org.waveprotocol.wave.model.util.StringMap;
import org.waveprotocol.wave.model.wave.ParticipantId;

/**
 * Defines the production rules that build renderings of model objects out of
 * renderings of their components.
 *
 * @param <R> rendering type (e.g., SafeHtml, UiBuilder, or a template closure)
 */
public interface RenderingRules<R> {

  /**
   * Renders a named document.
   *
   * @param replies renderings of reply threads that may need to be rendered
   *        inline in the document. This method removes any threads rendered
   *        inside the document from the supplied map.
   * @return the rendering of {@code document}, whatever that means.
   */
  R render(ConversationBlip blip, IdentityMap<ConversationThread, R> replies);

  /**
   * Renders a blip.
   *
   * @param blip blip to render
   * @param document rendering of the document
   * @param defaultAnchors renderings of the default anchors
   * @param nestedReplies renderings of all the nested replies to {@code blip}
   * @return the rendering of {@code blip}
   */
  R render(ConversationBlip blip, R document,
      IdentityMap<ConversationThread, R> defaultAnchors,
      IdentityMap<Conversation, R> nestedReplies);

  /**
   * Renders a thread.
   *
   * @param thread thread to render
   * @param blips renderings of all the blips in {@code thread}
   * @return the rendering of {@code thread}.
   */
  R render(ConversationThread thread, IdentityMap<ConversationBlip, R> blips);

  /**
   * Renders a conversation.
   *
   * @param conversation conversation to render
   * @param participants rendering of {@code conversation}'s participants
   * @param thread rendering of {@code conversation}'s root thread
   * @return the rendering of {@code conversation}.
   */
  R render(Conversation conversation, R participants, R thread);

  /**
   * Renders a participant.
   *
   * @param conversation conversation in which the participant participates (lacking in the model)
   * @param participant participant to render
   * @return the rendering of {@code participant}.
   */
  R render(Conversation conversation, ParticipantId participant);

  /**
   * Renders a collection of participants.
   *
   * @param conversation conversation whose participants are to be rendered
   * @param participants renderings of each participant
   * @return the rendering of {@code participants}.
   */
  R render(Conversation conversation, StringMap<R> participants);

  /**
   * Renders the conversations in a wave.
   *
   * @param wave collection of conversations to render
   * @param conversations renderings of all the conversations in {@code wave}
   * @return the rendering of {@code wave}.
   */
  R render(ConversationView wave, IdentityMap<Conversation, R> conversations);

  /**
   * Renders a default anchor for a thread.
   *
   * @param thread thread anchored at the anchor
   * @param threadR rendering of the thread in the anchor, or {@code null}
   * @return the rendering of a default anchor for the id {@code id}.
   */
  R render(ConversationThread thread, R threadR);
}


text:
package model

import (
	"fmt"
	"regexp"
	"strings"

	"go-common/app/service/main/antispam/util"
)

const (
	// OperationLimit .
	OperationLimit = "limit"
	// OperationRestrictLimit .
	OperationRestrictLimit = "restrict"
	// OperationPutToWhiteList .
	OperationPutToWhiteList = "white"
	// OperationIgnore .
	OperationIgnore = "ignore"
)

// Regexp .
type Regexp struct {
	ID        int64          `json:"id"`
	Area      string         `json:"area"`
	AdminID   int64          `json:"admin_id"`
	AdminName string         `json:"-"`
	Reg       *regexp.Regexp `json:"-"`
	Name      string         `json:"name"`
	Operation string         `json:"op"`
	Content   string         `json:"content"`
	State     string         `json:"state"`
	CTime     util.JSONTime  `json:"-"`
	MTime     util.JSONTime  `json:"mtime"`
}

// FindString .
func (r *Regexp) FindString(content string) string {
	if hits := r.Reg.FindStringSubmatch(content); len(hits) >= 2 {
		return strings.TrimSpace(hits[1])
	}
	return ""
}

func (r *Regexp) String() string {
	return fmt.Sprintf("name:%s, operation:%s, regexp:%s\n",
		r.Name, r.Operation, r.Content)
}


text:
/************************************************************************************
 * (c) 2015-2020 Master Technology
 * Licensed under the MIT license or contact me for a support, changes, enhancements,
 * and/or if you require a commercial licensing
 *
 * Any questions please feel free to email me or put a issue up on github
 * Nathan@master-technology.com                           http://nativescript.tools
 * Version 2.6.2 - iOS
 ***********************************************************************************/
/* global global, require, module */

"use strict";
const fs = require('tns-core-modules/file-system');

/* jshint undef: true, camelcase: false */
/* global Promise, NSFileManager, NSBundle, NSString, interop, sqlite3_open_v2, sqlite3_close, sqlite3_prepare_v2, sqlite3_step,
 sqlite3_finalize, sqlite3_bind_null, sqlite3_bind_text, sqlite3_column_type, sqlite3_column_int64,
 sqlite3_column_double, sqlite3_column_text, sqlite3_column_count, sqlite3_column_name, sqlite3_bind_blob */

let _DatabasePluginInits = [];
const TRANSIENT = new interop.Pointer(-1);

/***
 * Converts a string to a UTF-8 char array and wraps it in an adopted pointer
 * (which is GC managed and kept alive until it's referenced by a variable).
 * The reason for doing it is that iOS runtime marshals JS string arguments via
 * temporary buffers which are deallocated immediately after the call returns. In
 * some cases however, we need them to stay alive for subsequent native calls
 * because otherwise attempts to read the freed memory may lead to unpredictable
 * app crashes.
 * E.g. `sqlite3_step` function happens to use the stored `char *` passed as
 * `dbname` to `sqlite3_open_v2`.
 * @param str
 * @returns {AdoptedPointer} object
 */
function toCharPtr(str) {
    const objcStr = NSString.stringWithString(str);
    const bufferSize = strlen(objcStr.UTF8String) + 1;
    const buffer = interop.alloc(bufferSize);

    objcStr.getCStringMaxLengthEncoding(buffer, bufferSize, NSUTF8StringEncoding);

    return buffer;
}

/***
 * Creates a Cursor Tracking Statement for reading result sets
 * @param statement
 * @param resultType
 * @param valuesType
 * @constructor
 */
function CursorStatement(statement, resultType, valuesType) {
    this.statement = statement;
    this.resultType = resultType;
    this.valuesType = valuesType;
    this.built = false;
    this.columns = [];
}

//noinspection JSValidateJSDoc
/***
 * Database Constructor
 * @param dbname - Database Name
 * @param options - options
 * @param callback - Callback when Done
 * @returns {Promise} object
 * @constructor
 */
function Database(dbname, options, callback) {
    if (!this instanceof Database) { // jshint ignore:line
        //noinspection JSValidateTypes
        return new Database(dbname, options, callback);
    }
    this._isOpen = false;
    this._resultType = Database.RESULTSASARRAY;
    this._valuesType = Database.VALUESARENATIVE;

    if (typeof options === 'function') {
        callback = options;
        options = {};
    } else {
        options = options || {};
    }

    if (options && options.multithreading && typeof global.Worker === 'function') {
        delete options.multithreading;
        if (!Database.HAS_COMMERCIAL) {
            throw new Error("Commercial only feature; see http://nativescript.tools/product/10");
        }
        return new Database._multiSQL(dbname, options, callback);
    }
    this._options = options;

    // Check to see if it has a path, or if it is a relative dbname
    // DBNAME = "" - is a Temporary Database
    // DBNAME = ":memory:" - is a Memory only database
    if (dbname !== "" && dbname !== ":memory:") {
        let path;
        if (dbname.indexOf('/') === -1) {
            // noinspection JSUnresolvedVariable, JSUnresolvedFunction
            path = fs.knownFolders.documents().path;
            dbname = path + '/' + dbname;
        } else {
            path = dbname.substr(0, dbname.lastIndexOf('/') + 1);
        }

        // Create "databases" folder if it is missing.  This causes issues on Emulators if it is missing
        // So we create it if it is missing

        try {
            // noinspection JSUnresolvedVariable
            if (!fs.File.exists(path)) {
                //noinspection JSUnresolvedFunction
                const fileManager = iosProperty(NSFileManager, NSFileManager.defaultManager);
                //noinspection JSUnresolvedFunction
                if (!fileManager.createDirectoryAtPathWithIntermediateDirectoriesAttributesError(path, true, null, null)) {
                    console.warn("SQLITE.CONSTRUCTOR - Creating DB Folder Error");
                }
            }
        }
        catch (err) {
            console.warn("SQLITE.CONSTRUCTOR - Creating DB Folder Error", err);
        }
    }
    this._dbnamePtr = toCharPtr(dbname);
    const self = this;
    //noinspection JSUnresolvedFunction
    return new Promise(function (resolve, reject) {
        let error;
        try {
        	let flags = 0;
        	if (typeof options.iosFlags !== 'undefined') {
        		flags = options.iosFlags;
			}

            self._db = new interop.Reference();
            if (options && options.readOnly) {
                // SQLITE_OPEN_FULLMUTEX = 65536, SQLITE_OPEN_READONLY = 1 ---- 1 | 65536 = 65537
                error = sqlite3_open_v2(self._dbnamePtr, self._db, 65537 | flags, null);
            } else {
                // SQLITE_OPEN_FULLMUTEX = 65536, SQLITE_OPEN_CREATE = 4, SQLITE_OPEN_READWRITE = 2 --- 4 | 2 | 65536 = 65542
                error = sqlite3_open_v2(self._dbnamePtr, self._db, 65542 | flags, null);
            }
            self._db = self._db.value;
        } catch (err) {
            if (callback) { callback(err, null); }
            reject(err);
            return;
        }
        if (error) {
            if (callback) { callback(error, null); }
            reject(error);
            return;
        }

        self._isOpen = true;

        let doneCnt = _DatabasePluginInits.length, doneHandled = 0;
        const done = function(err) {
        	if (err) {
        		doneHandled = doneCnt;  // We don't want any more triggers after this
				if (callback) { callback(err, null); }
				reject(err);
        		return;
			}
			doneHandled++;
        	if (doneHandled === doneCnt) {
				if (callback) { callback(null, self); }
				resolve(self);
			}
		};

        if (doneCnt) {
        	try {
				for (let i = 0; i < doneCnt; i++) {
					_DatabasePluginInits[i].call(self, options, done);
				}
			} catch (err) {
        		done(err);
			}
		} else {
			if (callback) { callback(null, self); }
			resolve(self);
		}

    });
}

/***
 * Constant that this structure is a sqlite structure
 * @type {boolean}
 */
Database.prototype._isSqlite = true;

/***
 * This gets or sets the database version
 * @param valueOrCallback to set or callback(err, version)
 * @returns Promise
 */
Database.prototype.version = function(valueOrCallback) {
    return new Promise((resolve, reject) => {
        if (typeof valueOrCallback === 'function') {
            this.get('PRAGMA user_version', function (err, data) {
                const value = data && parseInt(data[0], 10);
                valueOrCallback(err, value);
                if (err) { reject(err); }
                else resolve(value);
            }, Database.RESULTSASARRAY);
        } else if (!isNaN(valueOrCallback + 0)) {
            this.execSQL('PRAGMA user_version=' + (valueOrCallback + 0).toString()).then(resolve, reject);
        } else {
            this.get('PRAGMA user_version', undefined, undefined, Database.RESULTSASARRAY).then((data) => {
                    resolve(data && parseInt(data[0], 10))
            }).catch(reject);
        }
    });
};

/***
 * Is the database currently open
 * @returns {boolean} - true if the db is open
 */
Database.prototype.isOpen = function() {
    return this._isOpen;
};

/***
 * Gets/Sets whether you get Arrays or Objects for the row values
 * @param value - Database.RESULTSASARRAY or Database.RESULTSASOBJECT
 * @returns {number} - Database.RESULTSASARRAY or Database.RESULTSASOBJECT
 */
Database.prototype.resultType = function(value) {
    if (value === Database.RESULTSASARRAY) {
        this._resultType = Database.RESULTSASARRAY;
    } else if (value === Database.RESULTSASOBJECT) {
        this._resultType = Database.RESULTSASOBJECT;
    }
    return this._resultType;
};

/***
 * Gets/Sets whether you get Native or Strings for the row values
 * @param value - Database.VALUESARENATIVE or Database.VALUESARESTRINGS
 * @returns {number} - Database.VALUESARENATIVE or Database.VALUESARESTRINGS
 */
Database.prototype.valueType = function(value) {
    if (value === Database.VALUESARENATIVE) {
        this._valuesType = Database.VALUESARENATIVE;
    } else if (value === Database.VALUESARESTRINGS) {
        this._valuesType = Database.VALUESARESTRINGS;
    }
    return this._valuesType;
};

/**
 * Dummy transaction function for public version
 * @param callback
 * @returns {Promise<T>}
 */
Database.prototype.begin = function(callback) {
    throw new Error("Transactions are a Commercial version feature.");
};

/**
 * Dummy prepare function for public version
 * @param sql
 * @returns {*}
 */
Database.prototype.prepare = function(sql) {
	throw new Error("Prepared statements are a Commercial version feature.");
};

// noinspection JSUnusedLocalSymbols
/**
 * Dummy sync enable tracking function for public version
 * @returns {*}
 */
Database.prototype.enableTracking = function(tables, options, callback) {
    throw new Error("Table sync is a Commercial version feature.");
};

/***
 * Closes this database, any queries after this will fail with an error
 * @param callback
 * @returns Promise
 */
Database.prototype.close = function(callback) {

    const self = this;
    return new Promise( function (resolve, reject) {
        if (!self._isOpen) {
            if (callback) {
                callback('SQLITE.CLOSE - Database is already closed');
            }
            reject('SQLITE.CLOSE - Database is already closed');
            return;

        }

        sqlite3_close(self._db);
        self._db = null;
        self._isOpen = false;
        if (callback) {
            callback(null, null);
        }
        resolve();
    });
};

/***
 * Exec SQL
 * @param sql - sql to use
 * @param params - optional array of parameters
 * @param callback - (err, result) - can be last_row_id for insert, and rows affected for update/delete
 * @returns Promise
 */
Database.prototype.execSQL = function(sql, params, callback) {
    if (typeof params === 'function') {
        callback = params;
        params = undefined;
    }

    const self = this;
    return new Promise( function(resolve, reject) {

        let hasCallback = true;
        if (typeof callback !== 'function') {
            callback = reject;
            hasCallback = false;
        }

        if (!self._isOpen) {
            callback("SQLITE.EXECSQL - Database is not open");
            return;
        }

        // Need to see if we have to run any status queries afterwords
        let flags = 0;
        let test = sql.trim().substr(0, 7).toLowerCase();
        if (test === 'insert ') {
            flags = 1;
        } else if (test === 'update ' || test === 'delete ') {
            flags = 2;
        }

        let res;
        try {
            let statement = new interop.Reference();
            res = sqlite3_prepare_v2(self._db, sql, -1, statement, null);
            statement = statement.value;
            if (res) {
                callback("SQLITE.ExecSQL Failed Prepare: " + res);
                return;
            }
            if (params !== undefined) {
                if (!self._bind(statement, params)) {
                    sqlite3_finalize(statement);
                    callback("SQLITE.ExecSQL Bind Error");
                    return;
                }
            }
            let result = sqlite3_step(statement);
            sqlite3_finalize(statement);
            if (result && result !== 100 && result !== 101) {
                callback("SQLITE.ExecSQL Failed " + result);
                return;
            }

        } catch (Err) {
            callback(Err, null);
            return;
        }

        switch (flags) {
            case 0:
                if (hasCallback) {
                    callback();
                }
                resolve();
                break;

            case 1:
                self.get('select last_insert_rowid()', function (err, data) {
                    if (hasCallback) {
                        callback(err, data && data[0]);
                    }
                    if (err) {
                        reject(err);
                    } else {
                        resolve(data && data[0]);
                    }
                }, Database.RESULTSASARRAY | Database.VALUESARENATIVE);
                break;

            case 2:
                self.get('select changes()', function (err, data) {
                    if (hasCallback) {
                        callback(err, data && data[0]);
                    }
                    if (err) {
                        reject(err);
                    } else {
                        resolve(data && data[0]);
                    }
                }, Database.RESULTSASARRAY | Database.VALUESARENATIVE);
                break;

            default:
                if (hasCallback) {
                    callback();
                }
                resolve();
        }
    });
};

/***
 * Get the first record result set
 * @param sql - sql to run
 * @param params - optional
 * @param callback - callback (error, results)
 * @param mode - allows you to manually override the results set to be a array or object
 * @returns Promise
 */
Database.prototype.get = function(sql, params, callback, mode) {
    if (typeof params === 'function') {
        mode = callback;
        callback = params;
        params = undefined;
    }

    const self = this;
    return new Promise( function (resolve, reject) {
        let hasCallback = true;

        if (typeof callback !== 'function') {
            callback = reject;
            hasCallback = false;
        }

        if (!self._isOpen) {
            callback("SQLITE.GET - Database is not open");
            return;
        }

        let cursor;
        try {
            let statement = new interop.Reference();
            let res = sqlite3_prepare_v2(self._db, sql, -1, statement, null);
            if (res) {
                callback("SQLITE.GET Failed Prepare: " + res);
                return;
            }
            statement = statement.value;
            let cursorStatement = new CursorStatement(statement, self._resultType, self._valuesType);

            if (params !== undefined) {
                if (!self._bind(statement, params)) {
                    sqlite3_finalize(statement);
                    callback("SQLITE.GET Bind Error");
                    return;
                }
            }

            let result = sqlite3_step(statement);
            if (result === 100) {
                cursor = self._getResults(cursorStatement, mode);
            }
            sqlite3_finalize(statement);
            if (result && result !== 100 && result !== 101) {
                callback("SQLITE.GET - Step Error" + result);
                return;
            }
        } catch (err) {
            callback(err);
            return;
        }

        // No Records
        if (!cursor) {
            if (hasCallback) {
                callback(null, null);
            }
            resolve(null);
            return;
        }

        if (hasCallback) {
            callback(null, cursor);
        }
        resolve(cursor);
    });
};

/***
 * This returns the entire result set in a array of rows
 * @param sql - Sql to run
 * @param params - optional
 * @param callback - (err, results)
 * @param mode - set a specific return mode
 * @returns Promise
 */
Database.prototype.all = function(sql, params, callback, mode) {
    if (typeof params === 'function') {
        callback = params;
        params = undefined;
    }

    const self = this;
    return new Promise(function(resolve, reject) {

        let hasCallback = true;
        if (typeof callback !== 'function') {
            callback = reject;
            hasCallback = false;
        }

        if (!self._isOpen) {
            callback("SQLITE.ALL - Database is not open");
            return;
        }

        let rows = [], res;
        try {
            let statement = new interop.Reference();
            res = sqlite3_prepare_v2(self._db, sql, -1, statement, null);
            if (res) {
                callback("SQLITE.ALL - Prepare Error " + res);
                return;
            }

            statement = statement.value;
            let cursorStatement = new CursorStatement(statement, self._resultType, self._valuesType);

            if (params !== undefined) {
                if (!self._bind(statement, params)) {
                    sqlite3_finalize(statement);
                    callback("SQLITE.ALL Bind Error");
                    return;
                }
            }

            let result;
            do {
                result = sqlite3_step(statement);
                if (result === 100) {
                    let cursor = self._getResults(cursorStatement, mode);
                    if (cursor) {
                        rows.push(cursor);
                    }
                } else if (result && result !== 101) {
                    sqlite3_finalize(statement);
                    callback("SQLITE.ALL - Database Error" + result);
                    return;
                }
            } while (result === 100);
            sqlite3_finalize(statement);
        } catch (err) {
            callback(err, null);
            return;
        }

        // No Records
        if (rows.length === 0) {
            if (hasCallback) {
                callback(null, []);
            }
            resolve([]);
            return;
        }

        if (hasCallback) {
            callback(null, rows);
        }
        resolve(rows);
    });
};

/***
 * This sends each row of the result set to the "Callback" and at the end calls the complete callback upon completion
 * @param sql - sql to run
 * @param params - optional
 * @param callback - callback (err, rowsResult)
 * @param complete - callback (err, recordCount)
 * @returns {Promise}
 */
Database.prototype.each = function(sql, params, callback, complete) {
    if (typeof params === 'function') {
        complete = callback;
        callback = params;
        params = undefined;
    }

    // Callback is required
    if (typeof callback !== 'function') {
        throw new Error("SQLITE.EACH - requires a callback");
    }

    const self = this;
    return new Promise (function(resolve, reject) {

        // Set the error Callback
        let errorCB = complete || callback;

        let count = 0, res;
        try {

            let statement = new interop.Reference();
            res = sqlite3_prepare_v2(self._db, sql, -1, statement, null);
            if (res) {
                errorCB("SQLITE.EACH Error in Prepare" + res);
                reject("SQLITE.EACH Error in Prepare" + res);
                return;
            }
            statement = statement.value;
            let cursorStatement = new CursorStatement(statement, self._resultType, self._valuesType);

            if (params !== undefined) {
                if (!self._bind(statement, params)) {
                    sqlite3_finalize(statement);
                    errorCB("SQLITE.EACH Bind Error");
                    reject("SQLITE.EACH Bind Error");
                    return;
                }
            }
            let result;
            do {
                result = sqlite3_step(statement);
                if (result === 100) {
                    let cursor = self._getResults(cursorStatement);
                    if (cursor) {
                        count++;
                        callback(null, cursor);
                    }
                } else if (result && result !== 101) {
                    sqlite3_finalize(statement);
                    errorCB("SQLITE.EACH - Database Error " + result);
                    reject("SQLITE.EACH - Database Error " + result);
                    return;
                }
            } while (result === 100);
            sqlite3_finalize(statement);
        } catch (err) {
            errorCB(err, null);
            reject(err);
            return;
        }

        if (complete) {
            complete(null, count);
        }
        resolve(count);
    });
};

/**
 * Binds the Parameters in a Statement
 * @param statement
 * @param params
 * @private
 */
Database.prototype._bind = function(statement, params) {
    let param, res;

	if (Array.isArray(params)) {
        const count = params.length;
        for (let i=0; i<count; ++i) {
            if (params[i] == null) { // jshint ignore:line
                res = sqlite3_bind_null(statement, i + 1);
            } else if (params[i].isKindOfClass && (params[i].isKindOfClass(NSData.class()))) {
                const obj = params[i];
                res = sqlite3_bind_blob(statement, i + 1, obj.bytes, obj.length, null)
            } else {
                param = params[i].toString();
                res = sqlite3_bind_text(statement, i+1, param, -1, TRANSIENT );
            }
            if (res) {
                console.error("SQLITE.Binding Error ", res);
                return false;
            }
        }
    } else {
        if (params == null) { // jshint ignore:line
            res = sqlite3_bind_null(statement, 1);
        } else {
            param = params.toString();
			res = sqlite3_bind_text(statement, 1, param, -1, TRANSIENT );
        }
        if (res) {
            console.error("SQLITE.Binding Error ", res);
            return false;
        }
    }
    return true;
};

Database.prototype._getNativeResult = function(statement, column) {
    const resultType = sqlite3_column_type(statement, column);
    switch (resultType) {
        case 1: // Int
            return sqlite3_column_int64(statement, column);
        case 2: // Float
            return sqlite3_column_double(statement, column);
        case 3: // Text
            //noinspection JSUnresolvedFunction
            return NSString.stringWithUTF8String(sqlite3_column_text(statement, column)).toString();
        case 4: // Blob
            return NSData.dataWithBytesLength(sqlite3_column_blob(statement, column), sqlite3_column_bytes(statement, column));
        case 5: // Null
            return null;
        default:
            //noinspection JSUnresolvedFunction
            return NSString.stringWithUTF8String(sqlite3_column_text(statement, column)).toString();
    }
};

Database.prototype._getStringResult = function(statement, column) {
    const resultType = sqlite3_column_type(statement, column);
    switch (resultType) {
        case 1: // Int
            //return sqlite3_column_int(statement, column).toString();
            return NSString.stringWithUTF8String(sqlite3_column_text(statement, column)).toString();
        case 2: // Float
            //return sqlite3_column_double(statement, column).toString();
            return NSString.stringWithUTF8String(sqlite3_column_text(statement, column)).toString();
        case 3: // Text
            //noinspection JSUnresolvedFunction
            return NSString.stringWithUTF8String(sqlite3_column_text(statement, column)).toString();
        case 4: // Blob
            return NSData.dataWithBytesLength(sqlite3_column_blob(statement, column), sqlite3_column_bytes(statement, column));
        case 5: // Null
            return null;
        default:
            //noinspection JSUnresolvedFunction
            return NSString.stringWithUTF8String(sqlite3_column_text(statement, column)).toString();
    }
};

Database.prototype._getResults = function(cursorStatement, mode) {
    let resultType, valueType;
    let statement = cursorStatement.statement;
    let i;

    if (!mode) {
        resultType = cursorStatement.resultType;
        valueType = cursorStatement.valuesType;
    } else {
        resultType = (mode & (Database.RESULTSASARRAY | Database.RESULTSASOBJECT));
        valueType = (mode & (Database.VALUESARENATIVE | Database.VALUESARESTRINGS));
        if (resultType <= 0) {
            resultType = cursorStatement.resultType;
        }
        if (valueType <= 0) {
            valueType = cursorStatement.valuesType;
        }
    }

    // Track this statements information so we don't have to build it each time
    if (!cursorStatement.built) {
        cursorStatement.count = sqlite3_column_count(statement);
        if (resultType === Database.RESULTSASOBJECT) {
            for (i=0;i<cursorStatement.count;i++) {
                //noinspection JSUnresolvedFunction
                let cn =  NSString.stringWithUTF8String(sqlite3_column_name(statement, i)).toString();
                if (!cn || cursorStatement.columns.indexOf(cn) >= 0) {
                    cn = "column"+i;
                }
                cursorStatement.columns.push(cn);
            }
        }
        cursorStatement.built=true;
    }

    let cnt = cursorStatement.count, data;
    if (cnt === 0) { return null; }
    if (resultType === Database.RESULTSASARRAY) {
        data = [];
        if (valueType === Database.VALUESARESTRINGS) {
            for (i = 0; i < cnt; i++) {
                data.push(this._getStringResult(statement, i));
            }
        } else {
            for (i = 0; i < cnt; i++) {
                data.push(this._getNativeResult(statement, i));
            }
        }
        return data;
    } else {
        let colName = cursorStatement.columns;
        data = {};
        if (valueType === Database.VALUESARESTRINGS) {
            for (i = 0; i < cnt; i++) {
                data[colName[i]] = this._getStringResult(statement, i);
            }
        } else {
            for (i = 0; i < cnt; i++) {
                data[colName[i]] = this._getNativeResult(statement, i);
            }
        }
        return data;
    }
};

/***
 * Is this a SQLite object
 * @param obj - possible sqlite object to check
 * @returns {boolean}
 */
Database.isSqlite = function(obj) {
    return obj && obj._isSqlite;
};

Database.exists = function(name) {
    if (name.indexOf('/') === -1) {
        name = fs.knownFolders.documents().path + '/' + name;
    }

    //noinspection JSUnresolvedFunction
    const fileManager = iosProperty(NSFileManager, NSFileManager.defaultManager);

    return fileManager.fileExistsAtPath(name);
};

Database.deleteDatabase = function(name) {
    //noinspection JSUnresolvedFunction
    const fileManager = iosProperty(NSFileManager, NSFileManager.defaultManager);

    let path;
    if (name.indexOf('/') === -1) {
        path = fs.knownFolders.documents().path + '/';
    } else {
        path = name.substr(0, name.lastIndexOf('/') + 1);
        name = name.substr(path.length);
    }

    if (!fileManager.fileExistsAtPath(path + name)) { return; }

    // Need to remove the trailing .sqlite
    let idx = name.lastIndexOf('.');
    if (idx) {
        name = name.substr(0,idx);
    }

    let files = fileManager.contentsOfDirectoryAtPathError(path, null);
    if (!files) {
        return;
    }

    for (let i = 0; i < files.count; i++) {
        const fileName = files.objectAtIndex(i);
        if (fileName.indexOf(name) !== -1) {
            fileManager.removeItemAtPathError(path + fileName, null);
        }
    }
};

Database.copyDatabase = function (name, destName) {
    //noinspection JSUnresolvedFunction

    const fileManager = iosProperty(NSFileManager, NSFileManager.defaultManager);

    let path;
    if (name.indexOf('/') === -1) {
        path = fs.knownFolders.documents().path + '/';
    } else {
        path = name.substr(0, name.lastIndexOf('/') + 1);
        name = name.substr(path.length);
    }

    let source = fs.knownFolders.currentApp().path + '/' + name;

    if (!destName) { destName = name; }
    else if (destName.indexOf("/") >= 0) {
        destName = destName.substring(destName.lastIndexOf('/') + 1);
    }

    let destination = path + destName;
    fileManager.copyItemAtPathToPathError(source, destination, null);
};

function UsePlugin(loadedSrc, DBModule) {
		if (loadedSrc.prototypes) {
			for (let key in loadedSrc.prototypes) {
                if (!loadedSrc.prototypes.hasOwnProperty(key)) { continue; }
                if (DBModule.prototype[key]) {
                    DBModule.prototype["_"+key] = DBModule.prototype[key];
                }
                DBModule.prototype[key] = loadedSrc.prototypes[key];
			}
		}
		if (loadedSrc.statics) {
			for (let key in loadedSrc.statics) {
                if (!loadedSrc.statics.hasOwnProperty(key)) { continue; }
				DBModule[key] = loadedSrc.statics[key];
			}
		}
		if (typeof loadedSrc.init === 'function') {
			_DatabasePluginInits.push(loadedSrc.init);
		}
}

function iosProperty(_this, property) {
    if (typeof property === "function") {
        // xCode < 8
        return property.call(_this);
    } else {
        // xCode >= 8
        return property;
    }
}

// Literal Defines
Database.prototype.RESULTSASARRAY   = Database.RESULTSASARRAY   = 1;
Database.prototype.RESULTSASOBJECT  = Database.RESULTSASOBJECT  = 2;
Database.prototype.VALUESARENATIVE  = Database.VALUESARENATIVE  = 4;
Database.prototype.VALUESARESTRINGS = Database.VALUESARESTRINGS = 8;

/** These are optional plugins, must have a static require statement for webpack **/
TryLoadingCommercialPlugin();
TryLoadingEncryptionPlugin();
TryLoadingSyncPlugin();

function TryLoadingCommercialPlugin() {
	try {
		const sqlCom = require('nativescript-sqlite-commercial');
		UsePlugin(sqlCom, Database);
	}
	catch (e) { /* Do Nothing if it doesn't exist as it is an optional plugin */
	}
}

function TryLoadingEncryptionPlugin() {
	try {
		const sqlEnc = require('nativescript-sqlite-encrypted');
		UsePlugin(sqlEnc, Database);
	}
	catch (e) { /* Do Nothing if it doesn't exist as it is an optional plugin */
	}
}

function TryLoadingSyncPlugin() {
    try {
        const sqlSync = require('nativescript-sqlite-sync');
        UsePlugin(sqlSync, Database);
    }
    catch (e) { /* Do Nothing if it doesn't exist as it is an optional plugin */
    }
}

module.exports = Database;


text:
package org.openeos.services.document.internal;

import java.util.List;

import org.openeos.services.document.EntityDocument;
import org.openeos.services.document.spi.EntityDocumentProviderResult;

public interface EntityDocumentServiceBackend {

	public <T> void saveResult(Class<T> entityClass, T entity, String documentId, EntityDocumentProviderResult result);

	public <T> List<EntityDocument> findDocuments(Class<T> entityClass, T entity);

}


text:
<?xml version="1.0" encoding="UTF-8"?>
<!--
  Licensed to the Apache Software Foundation (ASF) under one
  or more contributor license agreements.  See the NOTICE file
  distributed with this work for additional information
  regarding copyright ownership.  The ASF licenses this file
  to you under the Apache License, Version 2.0 (the
  "License"); you may not use this file except in compliance
  with the License.  You may obtain a copy of the License at

       http://www.apache.org/licenses/LICENSE-2.0

  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.
-->
<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2 http://maven.apache.org/xsd/assembly-1.1.2.xsd">
    <formats>
        <format>tar.gz</format>
        <format>zip</format>
    </formats>
    <id>bin</id>
    <baseDirectory>falcon-${project.version}</baseDirectory>
    <fileSets>
        <fileSet>
            <directory>../src/conf/</directory>
            <outputDirectory>conf</outputDirectory>
            <excludes>
                <exclude>prism-client.properties</exclude>
            </excludes>
        </fileSet>

        <fileSet>
            <directory>../client/target/dependency</directory>
            <outputDirectory>client/lib</outputDirectory>
            <fileMode>0644</fileMode>
            <directoryMode>0755</directoryMode>
        </fileSet>

        <fileSet>
            <directory>../scheduler/target/dependency</directory>
            <outputDirectory>client/lib</outputDirectory>
            <fileMode>0644</fileMode>
        </fileSet>

        <fileSet>
            <directory>../oozie-el-extensions/target/dependency</directory>
            <outputDirectory>oozie/libext</outputDirectory>
            <fileMode>0644</fileMode>
            <directoryMode>0755</directoryMode>
        </fileSet>

        <fileSet>
            <directory>../docs/target/site</directory>
            <outputDirectory>docs</outputDirectory>
            <directoryMode>0755</directoryMode>
        </fileSet>

        <fileSet>
            <directory>../webapp/target/apidocs</directory>
            <outputDirectory>apidocs</outputDirectory>
        </fileSet>

        <fileSet>
            <directory>../src/bin</directory>
            <outputDirectory>bin</outputDirectory>
            <fileMode>0755</fileMode>
            <directoryMode>0755</directoryMode>
            <excludes>
                <exclude>prism*</exclude>
                <exclude>package.sh</exclude>
            </excludes>
        </fileSet>

        <fileSet>
          <directory>target/hbase</directory>
	  <outputDirectory>hbase</outputDirectory>
          <fileMode>0755</fileMode>
          <directoryMode>0755</directoryMode>
        </fileSet>

        <fileSet>
            <directory>../logs</directory>
            <outputDirectory>logs</outputDirectory>
            <directoryMode>0777</directoryMode>
            <excludes>
                <exclude>*</exclude>
                <exclude>**/**</exclude>
            </excludes>
        </fileSet>

        <fileSet>
            <directory>../</directory>
            <outputDirectory>/</outputDirectory>
            <fileMode>0644</fileMode>
            <includes>
                <include>DISCLAIMER.txt</include>
                <include>NOTICE.txt</include>
                <include>LICENSE.txt</include>
                <include>README</include>
            </includes>
        </fileSet>

        <fileSet>
            <directory>../</directory>
            <outputDirectory>/</outputDirectory>
            <fileMode>0755</fileMode>
            <includes>
                <include>CHANGES.txt</include>
            </includes>
        </fileSet>

        <fileSet>
            <directory>../hadoop-dependencies/target/dependency</directory>
            <outputDirectory>hadooplibs</outputDirectory>
            <fileMode>0644</fileMode>
            <directoryMode>0755</directoryMode>
        </fileSet>

        <fileSet>
            <directory>../examples/app</directory>
            <outputDirectory>examples/app</outputDirectory>
            <directoryMode>0755</directoryMode>
        </fileSet>

        <fileSet>
            <directory>../examples/data</directory>
            <outputDirectory>examples/data</outputDirectory>
            <directoryMode>0755</directoryMode>
        </fileSet>

        <fileSet>
            <directory>../examples/entity</directory>
            <outputDirectory>examples/entity</outputDirectory>
            <directoryMode>0755</directoryMode>
        </fileSet>

        <fileSet>
            <directory>../addons/extensions/hdfs-mirroring/src/main/META</directory>
            <outputDirectory>extensions/hdfs-mirroring/META</outputDirectory>
            <fileMode>0755</fileMode>
            <directoryMode>0755</directoryMode>
        </fileSet>

        <fileSet>
            <directory>../</directory>
            <outputDirectory>extensions/hdfs-mirroring/libs/build</outputDirectory>
            <excludes>
                <exclude>*/**</exclude>
            </excludes>
            <fileMode>0755</fileMode>
            <directoryMode>0755</directoryMode>
        </fileSet>

        <fileSet>
            <directory>../</directory>
            <outputDirectory>extensions/hdfs-mirroring/libs/runtime</outputDirectory>
            <excludes>
                <exclude>*/**</exclude>
            </excludes>
            <fileMode>0755</fileMode>
            <directoryMode>0755</directoryMode>
        </fileSet>

        <fileSet>
            <directory>../addons/extensions/hdfs-mirroring/src/main/resources</directory>
            <outputDirectory>extensions/hdfs-mirroring/resources</outputDirectory>
            <fileMode>0755</fileMode>
            <directoryMode>0755</directoryMode>
        </fileSet>

        <fileSet>
            <directory>../</directory>
            <outputDirectory>extensions/hdfs-mirroring/resources/build</outputDirectory>
            <excludes>
                <exclude>*/**</exclude>
            </excludes>
            <fileMode>0755</fileMode>
            <directoryMode>0755</directoryMode>
        </fileSet>

        <fileSet>
            <directory>../addons/extensions/hdfs-snapshot-mirroring/src/main/META</directory>
            <outputDirectory>extensions/hdfs-snapshot-mirroring/META</outputDirectory>
            <fileMode>0755</fileMode>
            <directoryMode>0755</directoryMode>
        </fileSet>

        <fileSet>
            <directory>../</directory>
            <outputDirectory>extensions/hdfs-snapshot-mirroring/libs/build</outputDirectory>
            <excludes>
                <exclude>*/**</exclude>
            </excludes>
            <fileMode>0755</fileMode>
            <directoryMode>0755</directoryMode>
        </fileSet>

        <fileSet>
            <directory>../</directory>
            <outputDirectory>extensions/hdfs-snapshot-mirroring/libs/runtime</outputDirectory>
            <excludes>
                <exclude>*/**</exclude>
            </excludes>
            <fileMode>0755</fileMode>
            <directoryMode>0755</directoryMode>
        </fileSet>

        <fileSet>
            <directory>../addons/extensions/hdfs-snapshot-mirroring/src/main/resources</directory>
            <outputDirectory>extensions/hdfs-snapshot-mirroring/resources</outputDirectory>
            <fileMode>0755</fileMode>
            <directoryMode>0755</directoryMode>
        </fileSet>

        <fileSet>
            <directory>../</directory>
            <outputDirectory>extensions/hdfs-snapshot-mirroring/resources/build</outputDirectory>
            <excludes>
                <exclude>*/**</exclude>
            </excludes>
            <fileMode>0755</fileMode>
            <directoryMode>0755</directoryMode>
        </fileSet>

        <fileSet>
            <directory>../addons/extensions/hive-mirroring/src/main/META</directory>
            <outputDirectory>extensions/hive-mirroring/META</outputDirectory>
            <fileMode>0755</fileMode>
            <directoryMode>0755</directoryMode>
        </fileSet>

        <fileSet>
            <directory>../</directory>
            <fileMode>0755</fileMode>
            <outputDirectory>extensions/hive-mirroring/libs/build</outputDirectory>
            <excludes>
                <exclude>*/**</exclude>
            </excludes>
            <directoryMode>0755</directoryMode>
        </fileSet>

        <fileSet>
            <directory>../</directory>
            <outputDirectory>extensions/hive-mirroring/libs/runtime</outputDirectory>
            <excludes>
                <exclude>*/**</exclude>
            </excludes>
            <fileMode>0755</fileMode>
            <directoryMode>0755</directoryMode>
        </fileSet>

        <fileSet>
            <directory>../addons/extensions/hive-mirroring/src/main/resources</directory>
            <outputDirectory>extensions/hive-mirroring/resources</outputDirectory>
            <fileMode>0755</fileMode>
            <directoryMode>0755</directoryMode>
        </fileSet>

        <fileSet>
            <directory>../</directory>
            <outputDirectory>extensions/hive-mirroring/resources/build</outputDirectory>
            <excludes>
                <exclude>*/**</exclude>
            </excludes>
            <fileMode>0755</fileMode>
            <directoryMode>0755</directoryMode>
        </fileSet>

    </fileSets>

    <files>
        <file>
            <source>../client/target/falcon-client-${project.version}.jar</source>
            <outputDirectory>client/lib</outputDirectory>
            <fileMode>0644</fileMode>
        </file>

        <file>
            <source>../cli/target/falcon-cli-${project.version}.jar</source>
            <outputDirectory>client/lib</outputDirectory>
            <fileMode>0644</fileMode>
        </file>

        <file>
            <source>../shell/target/falcon-shell-${project.version}.jar</source>
            <outputDirectory>client/lib</outputDirectory>
            <fileMode>0644</fileMode>
        </file>

        <file>
            <source>../prism/target/prism.keystore</source>
            <outputDirectory>conf</outputDirectory>
            <destName>prism.keystore</destName>
            <fileMode>0644</fileMode>
        </file>

        <file>
            <source>../oozie-el-extensions/target/falcon-oozie-el-extension-${project.version}.jar</source>
            <outputDirectory>oozie/libext</outputDirectory>
            <fileMode>0644</fileMode>
        </file>

        <file>
            <source>../oozie-el-extensions/src/main/conf/oozie-site.xml</source>
            <outputDirectory>oozie/conf</outputDirectory>
            <fileMode>0644</fileMode>
        </file>

        <file>
            <source>../examples/target/falcon-examples-${project.version}.jar</source>
            <outputDirectory>examples/app/spark/lib</outputDirectory>
            <destName>falcon-examples.jar</destName>
            <fileMode>0644</fileMode>
        </file>

        <file>
            <source>../webapp/target/falcon-webapp-${project.version}.war</source>
            <outputDirectory>server/webapp</outputDirectory>
            <destName>falcon.war</destName>
            <fileMode>0644</fileMode>
        </file>

        <file>
            <source>../addons/extensions/hdfs-mirroring/README</source>
            <outputDirectory>extensions/hdfs-mirroring</outputDirectory>
            <fileMode>0755</fileMode>
        </file>

        <file>
            <source>../addons/extensions/hdfs-snapshot-mirroring/README</source>
            <outputDirectory>extensions/hdfs-snapshot-mirroring</outputDirectory>
            <fileMode>0755</fileMode>
        </file>

        <file>
            <source>../addons/extensions/hive-mirroring/README</source>
            <outputDirectory>extensions/hive-mirroring</outputDirectory>
            <fileMode>0755</fileMode>
        </file>
    </files>
</assembly>


text:
using System.Collections.Generic;
using System.ServiceModel;
using HyperServer.Common;

namespace HyperServer.Draft
{
	[ServiceContract(CallbackContract = typeof (IDraftCallback), SessionMode = SessionMode.Required)]
	public interface IDraft
	{
		[OperationContract(IsInitiating = true)]
		void Connect(DraftPlayer client);

		[OperationContract(IsOneWay = true,
			IsTerminating = true)]
		void Disconnect(DraftPlayer client);

		[OperationContract(IsOneWay = true)]
		void HostGame(int maxPlayers, int timeLimit, List<string> setCodes);

		[OperationContract(IsOneWay = true)]
		void Start();

		[OperationContract(IsOneWay = true)]
		void SendMessage(Message msg);

		[OperationContract(IsOneWay = true)]
		void Ready(DraftPlayer player);

		[OperationContract(IsOneWay = true)]
		void SendPack(DraftPlayer player);

		[OperationContract(IsOneWay = true)]
		void End();
	}
}


text:
typedef enum DISP_MODULE_ENUM_
{
    DISP_MODULE_ROT = 0,
    DISP_MODULE_SCL,
    DISP_MODULE_OVL,
    DISP_MODULE_OVL_PQ,
    DISP_MODULE_COLOR,
    DISP_MODULE_TDSHP,  // 5
    DISP_MODULE_BLS,
    DISP_MODULE_WDMA0,
    DISP_MODULE_WDMA1,
    DISP_MODULE_RDMA,
    DISP_MODULE_RDMA1,	// 10
    DISP_MODULE_GAMMA,
    DISP_MODULE_DBI,
    DISP_MODULE_DPI0,
    DISP_MODULE_DSI,
    DISP_MODULE_DPI1,	// 15
    DISP_MODULE_CONFIG,
    DISP_MODULE_CMDQ,
    DISP_MODULE_DSI_VDO,
    DISP_MODULE_DSI_CMD,
    DISP_MODULE_MAX
} DISP_MODULE_ENUM;

int disp_dump_reg(DISP_MODULE_ENUM module);

#define DDP_OVL_LAYER_MUN 4

struct DISP_REGION
{
    unsigned int x;
    unsigned int y;
    unsigned int width;
    unsigned int height;
};

struct disp_path_config_struct
{
    DISP_MODULE_ENUM srcModule;

	// if srcModule=RDMA0, set following value, else do not have to set following value
    unsigned int addr;
    unsigned int inFormat;
    unsigned int pitch;
    struct DISP_REGION srcROI;        // ROI

    OVL_CONFIG_STRUCT ovl_config;

    struct DISP_REGION bgROI;         // background ROI
    unsigned int bgColor;  // background color

    DISP_MODULE_ENUM dstModule;
    unsigned int outFormat;
    unsigned int dstAddr;  // only take effect when dstModule=DISP_MODULE_WDMA1
};

int disp_wait_timeout(BOOL flag, unsigned int timeout);
int disp_path_config(struct disp_path_config_struct* pConfig);
int disp_path_config_layer(OVL_CONFIG_STRUCT* pOvlConfig);
int disp_path_config_layer_addr(unsigned int layer, unsigned int addr);
int disp_path_get_mutex();
int disp_path_release_mutex();

int disp_path_ddp_clock_on();
int disp_path_ddp_clock_off();

void disp_regupdate_interrupt_clean(void);
void disp_wait_reg_update(void);
#endif