text:
namespace {

absl::optional<component_updater::ComponentInfo> GetComponent(
    const std::vector<component_updater::ComponentInfo>& components,
    const std::string& id) {
  auto it = std::find_if(
      components.begin(), components.end(),
      [id](const component_updater::ComponentInfo& component_info) {
        return component_info.id == id;
      });

  if (it != components.end())
    return *it;

  return absl::nullopt;
}

}  // namespace

namespace crosapi {

BrowserVersionServiceAsh::BrowserVersionServiceAsh(
    component_updater::ComponentUpdateService* component_update_service)
    : component_update_service_(component_update_service) {
  // The component_updater_service may be null in tests.
  if (component_update_service_)
    component_update_service_->AddObserver(this);
}

BrowserVersionServiceAsh::~BrowserVersionServiceAsh() {
  // May be null in tests.
  if (component_update_service_) {
    // Removing an observer is a no-op if the observer wasn't added.
    component_update_service_->RemoveObserver(this);
  }
}

void BrowserVersionServiceAsh::BindReceiver(
    mojo::PendingReceiver<mojom::BrowserVersionService> receiver) {
  receivers_.Add(this, std::move(receiver));
}

void BrowserVersionServiceAsh::AddBrowserVersionObserver(
    mojo::PendingRemote<mojom::BrowserVersionObserver> observer) {
  mojo::Remote<mojom::BrowserVersionObserver> remote(std::move(observer));

  // To avoid race conditions, trigger version notification on observer
  // registration.
  absl::optional<base::Version> browser_version = GetBrowserVersion();
  if (browser_version.has_value()) {
    remote->OnBrowserVersionInstalled(browser_version.value().GetString());
  }

  observers_.Add(std::move(remote));
}

void BrowserVersionServiceAsh::GetInstalledBrowserVersion(
    GetInstalledBrowserVersionCallback callback) {
  std::string version_str;

  auto browser_version = GetBrowserVersion();
  if (browser_version.has_value())
    version_str = browser_version.value().GetString();

  std::move(callback).Run(version_str);
}

void BrowserVersionServiceAsh::OnEvent(Events event, const std::string& id) {
  absl::optional<component_updater::ComponentInfo> component_info =
      GetComponent(component_update_service_->GetComponents(), id);
  // Check for notifications of the Lacros component being updated.
  if (event == Events::COMPONENT_UPDATED &&
      id == browser_util::GetLacrosComponentInfo().crx_id) {
    absl::optional<base::Version> browser_version = GetBrowserVersion();
    if (browser_version.has_value()) {
      std::string version_str = browser_version.value().GetString();
      for (auto& observer : observers_) {
        observer->OnBrowserVersionInstalled(version_str);
      }
    }
  }
}

absl::optional<base::Version> BrowserVersionServiceAsh::GetBrowserVersion() {
  absl::optional<component_updater::ComponentInfo> component_info =
      GetComponent(component_update_service_->GetComponents(),
                   browser_util::GetLacrosComponentInfo().crx_id);
  if (component_info.has_value()) {
    return component_info.value().version;
  }

  return absl::nullopt;
}

}  // namespace crosapi


text:
const assert = require('assert')
const util = require('util')

const parents = require('ldap-filter')

const Filter = require('./filter')

/// --- API

function GreaterThanEqualsFilter (options) {
  parents.GreaterThanEqualsFilter.call(this, options)
}
util.inherits(GreaterThanEqualsFilter, parents.GreaterThanEqualsFilter)
Filter.mixin(GreaterThanEqualsFilter)
module.exports = GreaterThanEqualsFilter

GreaterThanEqualsFilter.prototype.parse = function (ber) {
  assert.ok(ber)

  this.attribute = ber.readString().toLowerCase()
  this.value = ber.readString()

  return true
}

GreaterThanEqualsFilter.prototype._toBer = function (ber) {
  assert.ok(ber)

  ber.writeString(this.attribute)
  ber.writeString(this.value)

  return ber
}

redpajama_set_name: RedPajamaGithub


text:
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using FlatMate.Module.Common.DataAccess;

namespace FlatMate.Module.Account.DataAccess.Users
{
    [Table("UserRestrictedArea")]
    public class UserRestrictedAreaDbo : DboBase
    {
        [Required]
        public string Area { get; set; }

        [Required]
        public int UserId { get; set; }
    }
}


text:
<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE web-app PUBLIC
        "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
        "http://java.sun.com/dtd/web-app_2_3.dtd" >

<web-app id="WebApp_ID" version="2.4"
         xmlns="http://java.sun.com/xml/ns/j2ee"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
	     http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">

    <listener>
        <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
    </listener>

    <context-param>
        <param-name>contextConfigLocation</param-name>
        <param-value>/WEB-INF/security.xml /WEB-INF/app-context.xml</param-value>
    </context-param>

    <servlet>
        <servlet-name>dispatcher</servlet-name>
        <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
        <load-on-startup>1</load-on-startup>
    </servlet>

    <servlet-mapping>
        <servlet-name>dispatcher</servlet-name>
        <url-pattern>/</url-pattern>
    </servlet-mapping>

    <filter>
        <filter-name>encoding-filter</filter-name>
        <filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class>
        <init-param>
            <param-name>encoding</param-name>
            <param-value>UTF-8</param-value>
        </init-param>
        <init-param>
            <param-name>forceEncoding</param-name>
            <param-value>true</param-value>
        </init-param>
    </filter>
    <filter-mapping>
        <filter-name>encoding-filter</filter-name>
        <url-pattern>/*</url-pattern>
    </filter-mapping>

    <filter>
        <filter-name>springSecurityFilterChain</filter-name>
        <filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
    </filter>
    <filter-mapping>
        <filter-name>springSecurityFilterChain</filter-name>
        <url-pattern>/*</url-pattern>
    </filter-mapping>

</web-app>


text:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.7.1</version>
        <relativePath/> <!-- lookup parent from repository -->
    </parent>

    <artifactId>poc-spring-boot-rest-webflux</artifactId>
    <name>Spring Boot Rest Webflux</name>

    <properties>
        <java.version>17</java.version>
        <org.mapstruct.version>1.5.2.Final</org.mapstruct.version>

        <testcontainers.version>1.17.3</testcontainers.version>
        <project.testresult.directory>${project.build.directory}/test-results</project.testresult.directory>
        <maven-pmd-plugin.version>3.13.0</maven-pmd-plugin.version>
        <dependency-check-maven.version>7.1.1</dependency-check-maven.version>

        <fabric8-docker-maven.version>0.40.1</fabric8-docker-maven.version>
    </properties>

    <dependencies>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-jdbc</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-data-r2dbc</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-security</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-webflux</artifactId>
        </dependency>
        <dependency>
            <groupId>org.liquibase</groupId>
            <artifactId>liquibase-core</artifactId>
        </dependency>
        <dependency>
            <groupId>org.postgresql</groupId>
            <artifactId>r2dbc-postgresql</artifactId>
            <scope>runtime</scope>
        </dependency>
        <dependency>
            <groupId>org.postgresql</groupId>
            <artifactId>postgresql</artifactId>
            <scope>runtime</scope>
        </dependency>
        <dependency>
            <groupId>org.mapstruct</groupId>
            <artifactId>mapstruct</artifactId>
            <version>${org.mapstruct.version}</version>
        </dependency>
        <dependency>
            <groupId>org.projectlombok</groupId>
            <artifactId>lombok</artifactId>
            <optional>true</optional>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>io.projectreactor</groupId>
            <artifactId>reactor-test</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework.security</groupId>
            <artifactId>spring-security-test</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.testcontainers</groupId>
            <artifactId>junit-jupiter</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.testcontainers</groupId>
            <artifactId>postgresql</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.testcontainers</groupId>
            <artifactId>r2dbc</artifactId>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>org.testcontainers</groupId>
                <artifactId>testcontainers-bom</artifactId>
                <version>${testcontainers.version}</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
        </dependencies>
    </dependencyManagement>

    <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
                <configuration>
                    <excludes>
                        <exclude>
                            <groupId>org.projectlombok</groupId>
                            <artifactId>lombok</artifactId>
                        </exclude>
                    </excludes>
                </configuration>
                <executions>
                    <execution>
                        <goals>
                            <goal>build-info</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <configuration>
                    <source>${java.version}</source> <!-- depending on your project -->
                    <target>${java.version}</target> <!-- depending on your project -->
                    <annotationProcessorPaths>
                        <path>
                            <groupId>org.mapstruct</groupId>
                            <artifactId>mapstruct-processor</artifactId>
                            <version>${org.mapstruct.version}</version>
                        </path>
                        <!-- other annotation processors -->
                        <path>
                            <groupId>org.projectlombok</groupId>
                            <artifactId>lombok</artifactId>
                            <version>${lombok.version}</version>
                        </path>
                        <!-- This is needed when using Lombok 1.18.16 and above -->
                        <path>
                            <groupId>org.projectlombok</groupId>
                            <artifactId>lombok-mapstruct-binding</artifactId>
                            <version>0.2.0</version>
                        </path>
                    </annotationProcessorPaths>
                </configuration>
            </plugin>
            <plugin>
                <groupId>pl.project13.maven</groupId>
                <artifactId>git-commit-id-plugin</artifactId>
                <executions>
                    <execution>
                        <goals>
                            <goal>revision</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <failOnNoGitDirectory>false</failOnNoGitDirectory>
                    <failOnUnableToExtractRepoInfo>false</failOnUnableToExtractRepoInfo>
                    <includeOnlyProperties>
                        <includeOnlyProperty>^git.commit.id.abbrev$</includeOnlyProperty>
                        <includeOnlyProperty>^git.commit.id.describe$</includeOnlyProperty>
                        <includeOnlyProperty>^git.branch$</includeOnlyProperty>
                    </includeOnlyProperties>
                </configuration>
            </plugin>
            <!-- <plugin>
               <groupId>org.apache.maven.plugins</groupId>
               <artifactId>maven-pmd-plugin</artifactId>
               <version>${maven-pmd-plugin.version}</version>
               <configuration>
                 <rulesets>
                   <ruleset>build-config/pmd/pmd-ruleset.xml</ruleset>
                 </rulesets>
               </configuration>
               <executions>
                 <execution>
                   <goals>
                     <goal>check</goal>
                     <goal>cpd-check</goal>
                   </goals>
                 </execution>
               </executions>
             </plugin> -->
            <plugin>
                <groupId>io.fabric8</groupId>
                <artifactId>docker-maven-plugin</artifactId>
                <version>${fabric8-docker-maven.version}</version>
                <configuration>
                    <verbose>true</verbose>
                    <images>
                        <image>
                            <external>
                                <type>compose</type>
                                <basedir>docker</basedir>
                                <composeFile>docker-compose.yml</composeFile>
                            </external>
                            <run>
                                <wait>
                                    <time>5000</time>
                                    <!--<log>Docker databases are ready to accept connections</log>-->
                                </wait>
                            </run>
                        </image>
                    </images>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.owasp</groupId>
                <artifactId>dependency-check-maven</artifactId>
                <version>${dependency-check-maven.version}</version>
                <configuration>
                    <failOnError>false</failOnError>
                </configuration>
            </plugin>
        </plugins>
    </build>

</project>


text:
package drvregistry

import (
	"fmt"
	"strings"
	"sync"

	"github.com/docker/docker/pkg/plugingetter"
	"github.com/docker/libnetwork/driverapi"
	"github.com/docker/libnetwork/ipamapi"
	"github.com/docker/libnetwork/types"
)

type driverData struct {
	driver     driverapi.Driver
	capability driverapi.Capability
}

type ipamData struct {
	driver     ipamapi.Ipam
	capability *ipamapi.Capability
	// default address spaces are provided by ipam driver at registration time
	defaultLocalAddressSpace, defaultGlobalAddressSpace string
}

type driverTable map[string]*driverData
type ipamTable map[string]*ipamData

// DrvRegistry holds the registry of all network drivers and IPAM drivers that it knows about.
type DrvRegistry struct {
	sync.Mutex
	drivers      driverTable
	ipamDrivers  ipamTable
	dfn          DriverNotifyFunc
	ifn          IPAMNotifyFunc
	pluginGetter plugingetter.PluginGetter
}

// Functors definition

// InitFunc defines the driver initialization function signature.
type InitFunc func(driverapi.DriverCallback, map[string]interface{}) error

// IPAMWalkFunc defines the IPAM driver table walker function signature.
type IPAMWalkFunc func(name string, driver ipamapi.Ipam, cap *ipamapi.Capability) bool

// DriverWalkFunc defines the network driver table walker function signature.
type DriverWalkFunc func(name string, driver driverapi.Driver, capability driverapi.Capability) bool

// IPAMNotifyFunc defines the notify function signature when a new IPAM driver gets registered.
type IPAMNotifyFunc func(name string, driver ipamapi.Ipam, cap *ipamapi.Capability) error

// DriverNotifyFunc defines the notify function signature when a new network driver gets registered.
type DriverNotifyFunc func(name string, driver driverapi.Driver, capability driverapi.Capability) error

// New retruns a new driver registry handle.
func New(lDs, gDs interface{}, dfn DriverNotifyFunc, ifn IPAMNotifyFunc, pg plugingetter.PluginGetter) (*DrvRegistry, error) {
	r := &DrvRegistry{
		drivers:      make(driverTable),
		ipamDrivers:  make(ipamTable),
		dfn:          dfn,
		ifn:          ifn,
		pluginGetter: pg,
	}

	return r, nil
}

// AddDriver adds a network driver to the registry.
func (r *DrvRegistry) AddDriver(ntype string, fn InitFunc, config map[string]interface{}) error {
	return fn(r, config)
}

// WalkIPAMs walks the IPAM drivers registered in the registry and invokes the passed walk function and each one of them.
func (r *DrvRegistry) WalkIPAMs(ifn IPAMWalkFunc) {
	type ipamVal struct {
		name string
		data *ipamData
	}

	r.Lock()
	ivl := make([]ipamVal, 0, len(r.ipamDrivers))
	for k, v := range r.ipamDrivers {
		ivl = append(ivl, ipamVal{name: k, data: v})
	}
	r.Unlock()

	for _, iv := range ivl {
		if ifn(iv.name, iv.data.driver, iv.data.capability) {
			break
		}
	}
}

// WalkDrivers walks the network drivers registered in the registry and invokes the passed walk function and each one of them.
func (r *DrvRegistry) WalkDrivers(dfn DriverWalkFunc) {
	type driverVal struct {
		name string
		data *driverData
	}

	r.Lock()
	dvl := make([]driverVal, 0, len(r.drivers))
	for k, v := range r.drivers {
		dvl = append(dvl, driverVal{name: k, data: v})
	}
	r.Unlock()

	for _, dv := range dvl {
		if dfn(dv.name, dv.data.driver, dv.data.capability) {
			break
		}
	}
}

// Driver returns the actual network driver instance and its capability  which registered with the passed name.
func (r *DrvRegistry) Driver(name string) (driverapi.Driver, *driverapi.Capability) {
	r.Lock()
	defer r.Unlock()

	d, ok := r.drivers[name]
	if !ok {
		return nil, nil
	}

	return d.driver, &d.capability
}

// IPAM returns the actual IPAM driver instance and its capability which registered with the passed name.
func (r *DrvRegistry) IPAM(name string) (ipamapi.Ipam, *ipamapi.Capability) {
	r.Lock()
	defer r.Unlock()

	i, ok := r.ipamDrivers[name]
	if !ok {
		return nil, nil
	}

	return i.driver, i.capability
}

// IPAMDefaultAddressSpaces returns the default address space strings for the passed IPAM driver name.
func (r *DrvRegistry) IPAMDefaultAddressSpaces(name string) (string, string, error) {
	r.Lock()
	defer r.Unlock()

	i, ok := r.ipamDrivers[name]
	if !ok {
		return "", "", fmt.Errorf("ipam %s not found", name)
	}

	return i.defaultLocalAddressSpace, i.defaultGlobalAddressSpace, nil
}

// GetPluginGetter returns the plugingetter
func (r *DrvRegistry) GetPluginGetter() plugingetter.PluginGetter {
	return r.pluginGetter
}

// RegisterDriver registers the network driver when it gets discovered.
func (r *DrvRegistry) RegisterDriver(ntype string, driver driverapi.Driver, capability driverapi.Capability) error {
	if strings.TrimSpace(ntype) == "" {
		return fmt.Errorf("network type string cannot be empty")
	}

	r.Lock()
	dd, ok := r.drivers[ntype]
	r.Unlock()

	if ok && dd.driver.IsBuiltIn() {
		return driverapi.ErrActiveRegistration(ntype)
	}

	if r.dfn != nil {
		if err := r.dfn(ntype, driver, capability); err != nil {
			return err
		}
	}

	dData := &driverData{driver, capability}

	r.Lock()
	r.drivers[ntype] = dData
	r.Unlock()

	return nil
}

func (r *DrvRegistry) registerIpamDriver(name string, driver ipamapi.Ipam, caps *ipamapi.Capability) error {
	if strings.TrimSpace(name) == "" {
		return fmt.Errorf("ipam driver name string cannot be empty")
	}

	r.Lock()
	dd, ok := r.ipamDrivers[name]
	r.Unlock()
	if ok && dd.driver.IsBuiltIn() {
		return types.ForbiddenErrorf("ipam driver %q already registered", name)
	}

	locAS, glbAS, err := driver.GetDefaultAddressSpaces()
	if err != nil {
		return types.InternalErrorf("ipam driver %q failed to return default address spaces: %v", name, err)
	}

	if r.ifn != nil {
		if err := r.ifn(name, driver, caps); err != nil {
			return err
		}
	}

	r.Lock()
	r.ipamDrivers[name] = &ipamData{driver: driver, defaultLocalAddressSpace: locAS, defaultGlobalAddressSpace: glbAS, capability: caps}
	r.Unlock()

	return nil
}

// RegisterIpamDriver registers the IPAM driver discovered with default capabilities.
func (r *DrvRegistry) RegisterIpamDriver(name string, driver ipamapi.Ipam) error {
	return r.registerIpamDriver(name, driver, &ipamapi.Capability{})
}

// RegisterIpamDriverWithCapabilities registers the IPAM driver discovered with specified capabilities.
func (r *DrvRegistry) RegisterIpamDriverWithCapabilities(name string, driver ipamapi.Ipam, caps *ipamapi.Capability) error {
	return r.registerIpamDriver(name, driver, caps)
}


text:
\hypertarget{http__header__field__dispatcher__base_8cpp}{\section{http\-\_\-header\-\_\-field\-\_\-dispatcher\-\_\-base.\-cpp File Reference}
\label{http__header__field__dispatcher__base_8cpp}\index{http\-\_\-header\-\_\-field\-\_\-dispatcher\-\_\-base.\-cpp@{http\-\_\-header\-\_\-field\-\_\-dispatcher\-\_\-base.\-cpp}}
}

base class to be dispatched the class derived from \href{http::header::field::Base}{\tt http\-::header\-::field\-::\-Base}.

{\ttfamily \#include \char`\"{}precompiled.\-h\char`\"{}}\\*
{\ttfamily \#include \char`\"{}hryky/http/http\-\_\-header\-\_\-field\-\_\-dispatcher\-\_\-base.\-h\char`\"{}}\\*
{\ttfamily \#include \char`\"{}hryky/reduction.\-h\char`\"{}}\\*
\subsection*{Namespaces}
\begin{DoxyCompactItemize}
\item
namespace \hyperlink{namespacehryky}{hryky}
\begin{DoxyCompactList}\small\item\em the root of all namespaces in hryky-\/codebase. \end{DoxyCompactList}\item
namespace \hyperlink{namespacehryky_1_1http}{hryky\-::http}
\begin{DoxyCompactList}\small\item\em modules to manage H\-T\-T\-P. \end{DoxyCompactList}\end{DoxyCompactItemize}

\subsection{Detailed Description}
base class to be dispatched the class derived from \href{http::header::field::Base}{\tt http\-::header\-::field\-::\-Base}. \begin{DoxyAuthor}{Author}
H\-R\-Y\-K\-Y
\end{DoxyAuthor}
\begin{DoxyVersion}{Version}

\end{DoxyVersion}
\begin{DoxyParagraph}{Id\-:}
\hyperlink{http__header__field__dispatcher__base_8cpp}{http\-\_\-header\-\_\-field\-\_\-dispatcher\-\_\-base.\-cpp} 150 2013-\/02-\/10 10\-:08\-:03\-Z \href{mailto:hryky.private@gmail.com}{\tt hryky.\-private@gmail.\-com}
\end{DoxyParagraph}


text:
from __future__ import unicode_literals

from django.db import models, migrations

class Migration(migrations.Migration):

    dependencies = [
        ('server', '0024_auto_20151209_1457'),
    ]

    operations = [
        migrations.AddField(
            model_name='updatehistoryitem',
            name='uuid',
            field=models.CharField(max_length=100, null=True, editable=False, blank=True),
        ),
        migrations.AlterField(
            model_name='updatehistory',
            name='update_type',
            field=models.CharField(max_length=254, verbose_name=b'Update Type', choices=[(b'third_party', b'3rd Party'), (b'apple', b'Apple')]),
        ),
        migrations.AlterField(
            model_name='updatehistory',
            name='version',
            field=models.CharField(max_length=254, db_index=True),
        ),
        migrations.AlterField(
            model_name='updatehistoryitem',
            name='status',
            field=models.CharField(max_length=254, verbose_name=b'Status', choices=[(b'pending', b'Pending'), (b'error', b'Error'), (b'install', b'Install'), (b'removal', b'Removal')]),
        ),
    ]


text:
package manage.service;

import manage.TestUtils;
import manage.model.MetaData;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.io.ClassPathResource;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.TestPropertySource;
import org.springframework.test.context.junit4.SpringRunner;

import java.io.IOException;
import java.util.Arrays;
import java.util.Map;

import static org.junit.Assert.*;

@SuppressWarnings("unchecked")
@RunWith(SpringRunner.class)
@ContextConfiguration(classes = ExporterService.class)
@TestPropertySource(locations = "classpath:test.properties")
public class ExporterServiceTest implements TestUtils {

    @Autowired
    private ExporterService subject;

    @Test
    public void exportToXml() throws Exception {
        doExportToXml(this.metaData(), "/xml/expected_metadata_export_saml20_sp.xml");
    }

    @Test
    public void exportToMapNested() throws Exception {
        MetaData metaData = this.metaData();

        Map<String, Object> result = subject.exportToMap(metaData, true);

        String json = objectMapper.writerWithDefaultPrettyPrinter().writeValueAsString(result);
        String expected = readFile("/json/expected_metadata_export_saml20_sp_nested.json");
        assertEquals(expected, json);
    }

    @Test
    public void exportToMap() throws Exception {
        MetaData metaData = this.metaData();
        Map<String, Object> result = subject.exportToMap(metaData, false);

        ExporterService.excludedDataFields.forEach(Map.class.cast(metaData.getData())::remove);

        assertEquals(result, metaData.getData());
    }

    @Test
    public void exportToXmlWithOnlyNlOrganization() throws Exception {
        MetaData metaData = this.metaData();
        Map<String, Object> metaDataFields = (Map<String, Object>) metaData.getData().get("metaDataFields");
        Arrays.asList(new String[]{"OrganizationName:en", "OrganizationURL:en", "OrganizationDisplayName:en"})
                .forEach(metaDataFields::remove);

        doExportToXml(metaData, "/xml/expected_metadata_export_saml20_sp_org_nl.xml");
    }

    @Test
    public void exportToXmlWithClassCastExceptionAttributeConsumingService() throws IOException {
        MetaData metaData = objectMapper.readValue(readFile("/json/export_attribute_consumer.json"), MetaData.class);
        String xml = subject.exportToXml(metaData);
        assertTrue(xml.contains("<md:RequestedAttribute Name=\"attribute\"/>"));
    }

    private void doExportToXml(MetaData metaData, String path) throws IOException {
        String xml = subject.exportToXml(metaData);

        assertNotNull(xml);
        String expected = readFile(path);

        //We are in a different time-zone for travis
        expected = expected.replaceFirst("validUntil=\"(.*)\"", "");
        xml = xml.replaceFirst("validUntil=\"(.*)\"", "");
        assertEquals(expected, xml);
    }

    private MetaData metaData() throws IOException {
        return objectMapper.readValue(new ClassPathResource("/json/exported_metadata_saml20_sp.json").getInputStream
                (), MetaData.class);
    }

}


text:
DROP VIEW IF EXISTS view_persediaan_barang4_blhk;

CREATE VIEW view_persediaan_barang4_blhk AS

SELECT
*,
saldo * harga AS jumlah_harga

FROM
view_persediaan_barang3_blhk

WHERE
1 = 1  AND
saldo > 0 AND
id_skpd = 22;

GRANT ALL PRIVILEGES ON view_persediaan_barang4_blhk TO lap_blhk;
REVOKE INSERT, UPDATE, DELETE ON view_persediaan_barang4_blhk FROM lap_blhk;


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

#include "ash/system/bluetooth/bluetooth_detailed_view_controller.h"

#include "ash/constants/ash_switches.h"
#include "ash/public/cpp/bluetooth_config_service.h"
#include "ash/public/cpp/system_tray_client.h"
#include "ash/shell.h"
#include "ash/strings/grit/ash_strings.h"
#include "ash/system/model/system_tray_model.h"
#include "ash/system/unified/unified_system_tray_controller.h"
#include "base/check.h"
#include "base/command_line.h"
#include "base/memory/ptr_util.h"
#include "build/chromeos_buildflags.h"
#include "chromeos/ash/services/bluetooth_config/public/cpp/cros_bluetooth_config_util.h"
#include "mojo/public/cpp/bindings/clone_traits.h"
#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/views/view.h"

namespace ash {

using bluetooth_config::IsBluetoothEnabledOrEnabling;
using bluetooth_config::mojom::AudioOutputCapability;
using bluetooth_config::mojom::BatteryProperties;
using bluetooth_config::mojom::BluetoothDeviceProperties;
using bluetooth_config::mojom::BluetoothDevicePropertiesPtr;
using bluetooth_config::mojom::BluetoothSystemState;
using bluetooth_config::mojom::DeviceBatteryInfo;
using bluetooth_config::mojom::DeviceBatteryInfoPtr;
using bluetooth_config::mojom::DeviceConnectionState;
using bluetooth_config::mojom::DeviceType;
using bluetooth_config::mojom::PairedBluetoothDeviceProperties;
using bluetooth_config::mojom::PairedBluetoothDevicePropertiesPtr;

BluetoothDetailedViewController::BluetoothDetailedViewController(
    UnifiedSystemTrayController* tray_controller)
    : detailed_view_delegate_(
          std::make_unique<DetailedViewDelegate>(tray_controller)),
      tray_controller_(tray_controller) {
  GetBluetoothConfigService(
      remote_cros_bluetooth_config_.BindNewPipeAndPassReceiver());
  remote_cros_bluetooth_config_->ObserveSystemProperties(
      cros_system_properties_observer_receiver_.BindNewPipeAndPassRemote());
}

BluetoothDetailedViewController::~BluetoothDetailedViewController() = default;

std::unique_ptr<views::View> BluetoothDetailedViewController::CreateView() {
  DCHECK(!view_);
  std::unique_ptr<BluetoothDetailedView> bluetooth_detailed_view =
      BluetoothDetailedView::Factory::Create(detailed_view_delegate_.get(),
                                             /*delegate=*/this);
  view_ = bluetooth_detailed_view.get();
  device_list_controller_ = BluetoothDeviceListController::Factory::Create(
      bluetooth_detailed_view.get());
  BluetoothEnabledStateChanged();

  if (IsBluetoothEnabledOrEnabling(system_state_)) {
    device_list_controller_->UpdateDeviceList(connected_devices_,
                                              previously_connected_devices_);
  }

  // `bluetooth_detailed_view` is not a views::View, so we must GetAsView().
  return base::WrapUnique(bluetooth_detailed_view.release()->GetAsView());
}

std::u16string BluetoothDetailedViewController::GetAccessibleName() const {
  return l10n_util::GetStringUTF16(
      IDS_ASH_QUICK_SETTINGS_BUBBLE_BLUETOOTH_SETTINGS_ACCESSIBLE_DESCRIPTION);
}

void BluetoothDetailedViewController::OnPropertiesUpdated(
    bluetooth_config::mojom::BluetoothSystemPropertiesPtr properties) {
  if (properties->system_state == BluetoothSystemState::kUnavailable) {
    tray_controller_->TransitionToMainView(
        /*restore_focus=*/true);  // Deletes |this|.
    return;
  }

  const bool has_bluetooth_enabled_state_changed =
      system_state_ != properties->system_state;
  system_state_ = properties->system_state;

  if (has_bluetooth_enabled_state_changed)
    BluetoothEnabledStateChanged();

  connected_devices_.clear();
  previously_connected_devices_.clear();

  if (base::CommandLine::ForCurrentProcess()->HasSwitch(
          switches::kQsAddFakeBluetoothDevices)) {
    AddFakeBluetoothDevices();
  }

  for (auto& paired_device : properties->paired_devices) {
    if (paired_device->device_properties->connection_state ==
        DeviceConnectionState::kConnected) {
      connected_devices_.push_back(std::move(paired_device));
    } else {
      previously_connected_devices_.push_back(std::move(paired_device));
    }
  }
  if (device_list_controller_ && IsBluetoothEnabledOrEnabling(system_state_)) {
    device_list_controller_->UpdateDeviceList(connected_devices_,
                                              previously_connected_devices_);
  }
}

void BluetoothDetailedViewController::OnToggleClicked(bool new_state) {
  remote_cros_bluetooth_config_->SetBluetoothEnabledState(new_state);
}

void BluetoothDetailedViewController::OnPairNewDeviceRequested() {
  tray_controller_->CloseBubble();  // Deletes |this|.
  Shell::Get()->system_tray_model()->client()->ShowBluetoothPairingDialog(
      /*device_address=*/absl::nullopt);
}

void BluetoothDetailedViewController::OnDeviceListItemSelected(
    const bluetooth_config::mojom::PairedBluetoothDevicePropertiesPtr& device) {
  // When CloseBubble() is called |device| will be deleted so we need to make a
  // copy of the device ID that was selected.
  const std::string device_id = device->device_properties->id;

  // Non-HID devices can be explicitly connected to, so we detect when this is
  // the case and attempt to connect to the device instead of navigating to the
  // Bluetooth Settings.
  if (device->device_properties->audio_capability ==
          AudioOutputCapability::kCapableOfAudioOutput &&
      device->device_properties->connection_state ==
          DeviceConnectionState::kNotConnected) {
    remote_cros_bluetooth_config_->Connect(device_id,
                                           /*callback=*/base::DoNothing());
    return;
  }
  tray_controller_->CloseBubble();  // Deletes |this|.
  Shell::Get()->system_tray_model()->client()->ShowBluetoothSettings(device_id);
}

void BluetoothDetailedViewController::BluetoothEnabledStateChanged() {
  const bool bluetooth_enabled_state =
      IsBluetoothEnabledOrEnabling(system_state_);
  if (view_)
    view_->UpdateBluetoothEnabledState(bluetooth_enabled_state);
  if (device_list_controller_) {
    device_list_controller_->UpdateBluetoothEnabledState(
        bluetooth_enabled_state);
  }
}

void BluetoothDetailedViewController::AddFakeBluetoothDevices() {
#if !BUILDFLAG(IS_CHROMEOS_DEVICE)
  // Only add fake devices in the linux-chromeos emulator. We don't want to
  // increase the binary size for real devices.
  {
    PairedBluetoothDevicePropertiesPtr paired_device_properties =
        PairedBluetoothDeviceProperties::New();
    paired_device_properties->device_properties =
        BluetoothDeviceProperties::New();
    paired_device_properties->device_properties->id = "Unknown";
    paired_device_properties->device_properties->public_name = u"Unknown";
    paired_device_properties->device_properties->connection_state =
        DeviceConnectionState::kConnected;
    paired_device_properties->device_properties->device_type =
        DeviceType::kUnknown;

    connected_devices_.push_back(mojo::Clone(paired_device_properties));
  }
  {
    PairedBluetoothDevicePropertiesPtr paired_device_properties =
        PairedBluetoothDeviceProperties::New();
    paired_device_properties->device_properties =
        BluetoothDeviceProperties::New();
    paired_device_properties->device_properties->id = "Computer";
    paired_device_properties->device_properties->public_name = u"Computer";
    paired_device_properties->device_properties->device_type =
        DeviceType::kComputer;
    paired_device_properties->device_properties->connection_state =
        DeviceConnectionState::kConnected;
    paired_device_properties->device_properties->battery_info =
        DeviceBatteryInfo::New();
    paired_device_properties->device_properties->battery_info
        ->default_properties = BatteryProperties::New();
    paired_device_properties->device_properties->battery_info
        ->default_properties->battery_percentage = 75;

    connected_devices_.push_back(mojo::Clone(paired_device_properties));
  }
  {
    PairedBluetoothDevicePropertiesPtr paired_device_properties =
        PairedBluetoothDeviceProperties::New();
    paired_device_properties->device_properties =
        BluetoothDeviceProperties::New();
    paired_device_properties->device_properties->id = "Phone";
    paired_device_properties->device_properties->public_name = u"Phone";
    paired_device_properties->device_properties->device_type =
        DeviceType::kPhone;
    paired_device_properties->device_properties->connection_state =
        DeviceConnectionState::kConnected;
    paired_device_properties->device_properties->battery_info =
        DeviceBatteryInfo::New();
    paired_device_properties->device_properties->battery_info->left_bud_info =
        BatteryProperties::New();
    paired_device_properties->device_properties->battery_info->left_bud_info
        ->battery_percentage = 5;
    paired_device_properties->device_properties->battery_info->case_info =
        BatteryProperties::New();
    paired_device_properties->device_properties->battery_info->case_info
        ->battery_percentage = 64;
    paired_device_properties->device_properties->battery_info->right_bud_info =
        BatteryProperties::New();
    paired_device_properties->device_properties->battery_info->right_bud_info
        ->battery_percentage = 9;

    connected_devices_.push_back(mojo::Clone(paired_device_properties));
  }
  {
    PairedBluetoothDevicePropertiesPtr paired_device_properties =
        PairedBluetoothDeviceProperties::New();
    paired_device_properties->device_properties =
        BluetoothDeviceProperties::New();
    paired_device_properties->device_properties->id = "Game Controller";
    paired_device_properties->device_properties->public_name =
        u"Game Controller";
    paired_device_properties->device_properties->device_type =
        DeviceType::kGameController;

    connected_devices_.push_back(mojo::Clone(paired_device_properties));
  }
  {
    PairedBluetoothDevicePropertiesPtr paired_device_properties =
        PairedBluetoothDeviceProperties::New();
    paired_device_properties->device_properties =
        BluetoothDeviceProperties::New();
    paired_device_properties->device_properties->id = "Keyboard";
    paired_device_properties->device_properties->public_name = u"Keyboard";
    paired_device_properties->device_properties->device_type =
        DeviceType::kKeyboard;

    connected_devices_.push_back(mojo::Clone(paired_device_properties));
  }
  {
    PairedBluetoothDevicePropertiesPtr paired_device_properties =
        PairedBluetoothDeviceProperties::New();
    paired_device_properties->device_properties =
        BluetoothDeviceProperties::New();
    paired_device_properties->device_properties->id = "Mouse";
    paired_device_properties->device_properties->public_name = u"Mouse";
    paired_device_properties->device_properties->device_type =
        DeviceType::kMouse;

    connected_devices_.push_back(mojo::Clone(paired_device_properties));
  }
  {
    PairedBluetoothDevicePropertiesPtr paired_device_properties =
        PairedBluetoothDeviceProperties::New();
    paired_device_properties->device_properties =
        BluetoothDeviceProperties::New();
    paired_device_properties->device_properties->id = "Tablet";
    paired_device_properties->device_properties->public_name = u"Tablet";
    paired_device_properties->device_properties->device_type =
        DeviceType::kTablet;

    connected_devices_.push_back(mojo::Clone(paired_device_properties));
  }
  {
    PairedBluetoothDevicePropertiesPtr paired_device_properties =
        PairedBluetoothDeviceProperties::New();
    paired_device_properties->device_properties =
        BluetoothDeviceProperties::New();
    paired_device_properties->device_properties->id = "Headset";
    paired_device_properties->device_properties->public_name = u"Headset";
    paired_device_properties->device_properties->device_type =
        DeviceType::kHeadset;
    paired_device_properties->device_properties->connection_state =
        DeviceConnectionState::kConnecting;

    previously_connected_devices_.push_back(
        mojo::Clone(paired_device_properties));
  }
  {
    PairedBluetoothDevicePropertiesPtr paired_device_properties =
        PairedBluetoothDeviceProperties::New();
    paired_device_properties->device_properties =
        BluetoothDeviceProperties::New();
    paired_device_properties->device_properties->id = "Video Camera";
    paired_device_properties->device_properties->public_name =
        u"Video Camera with a very very very very very very very long name";
    paired_device_properties->device_properties->device_type =
        DeviceType::kVideoCamera;
    paired_device_properties->device_properties->connection_state =
        DeviceConnectionState::kNotConnected;

    previously_connected_devices_.push_back(
        mojo::Clone(paired_device_properties));
  }
#endif  // !BUILDFLAG(IS_CHROMEOS_DEVICE)
}

}  // namespace ash


text:
<?xml version="1.0" encoding="UTF-8"?>
<!--

    Copyright 2013 deib-polimi
    Contact: deib-polimi <marco.miglierina@polimi.it>

       Licensed 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.

-->
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" version="3.0">
  <servlet>
    <display-name>RegisterServlet</display-name>
    <servlet-name>RegisterServlet</servlet-name>
    <servlet-class>it.polimi.modaclouds.cloudapp.mic.servlet.RegisterServlet</servlet-class>
  </servlet>
  <servlet-mapping>
    <servlet-name>RegisterServlet</servlet-name>
    <url-pattern>/Register</url-pattern>
  </servlet-mapping>
  <servlet>
    <display-name>RedirectServlet</display-name>
    <servlet-name>RedirectServlet</servlet-name>
    <servlet-class>it.polimi.modaclouds.cloudapp.mic.servlet.RedirectServlet</servlet-class>
  </servlet>
  <servlet-mapping>
    <servlet-name>RedirectServlet</servlet-name>
    <url-pattern>/Redirect</url-pattern>
  </servlet-mapping>
  <servlet>
    <display-name>InitializedSQLTableServlet</display-name>
    <servlet-name>InitializedSQLTableServlet</servlet-name>
    <servlet-class>it.polimi.modaclouds.cloudapp.mic.servlet.InitializedSQLTableServlet</servlet-class>
  </servlet>
  <servlet-mapping>
    <servlet-name>InitializedSQLTableServlet</servlet-name>
    <url-pattern>/InitializedSQL</url-pattern>
  </servlet-mapping>
  <servlet>
    <display-name>LoginServlet</display-name>
    <servlet-name>LoginServlet</servlet-name>
    <servlet-class>it.polimi.modaclouds.cloudapp.mic.servlet.LoginServlet</servlet-class>
  </servlet>
  <servlet-mapping>
    <servlet-name>LoginServlet</servlet-name>
    <url-pattern>/Login</url-pattern>
  </servlet-mapping>
  <servlet>
    <display-name>LogoutServlet</display-name>
    <servlet-name>LogoutServlet</servlet-name>
    <servlet-class>it.polimi.modaclouds.cloudapp.mic.servlet.LogoutServlet</servlet-class>
  </servlet>
  <servlet-mapping>
    <servlet-name>LogoutServlet</servlet-name>
    <url-pattern>/Logout</url-pattern>
  </servlet-mapping>
  <servlet>
    <display-name>WritePostServlet</display-name>
    <servlet-name>WritePostServlet</servlet-name>
    <servlet-class>it.polimi.modaclouds.cloudapp.mic.servlet.WritePostServlet</servlet-class>
  </servlet>
  <servlet-mapping>
    <servlet-name>WritePostServlet</servlet-name>
    <url-pattern>/WritePost</url-pattern>
  </servlet-mapping>
  <servlet>
    <display-name>AnswerQuestionsServlet</display-name>
    <servlet-name>AnswerQuestionsServlet</servlet-name>
    <servlet-class>it.polimi.modaclouds.cloudapp.mic.servlet.AnswerQuestionsServlet</servlet-class>
  </servlet>
  <servlet-mapping>
    <servlet-name>AnswerQuestionsServlet</servlet-name>
    <url-pattern>/AnswerQuestions</url-pattern>
  </servlet-mapping>
  <servlet>
    <display-name>SaveAnswerServlet</display-name>
    <servlet-name>SaveAnswerServlet</servlet-name>
    <servlet-class>it.polimi.modaclouds.cloudapp.mic.servlet.SaveAnswerServlet</servlet-class>
  </servlet>
  <servlet-mapping>
    <servlet-name>SaveAnswerServlet</servlet-name>
    <url-pattern>/SaveAnswer</url-pattern>
  </servlet-mapping>
  <servlet>
    <display-name>DownloadFileServlet</display-name>
    <servlet-name>DownloadFileServlet</servlet-name>
    <servlet-class>it.polimi.modaclouds.cloudapp.mic.servlet.DownloadFileServlet</servlet-class>
  </servlet>
  <servlet-mapping>
    <servlet-name>DownloadFileServlet</servlet-name>
    <url-pattern>/DownloadFile</url-pattern>
  </servlet-mapping>
  <servlet>
    <display-name>DeleteFileServlet</display-name>
    <servlet-name>DeleteFileServlet</servlet-name>
    <servlet-class>it.polimi.modaclouds.cloudapp.mic.servlet.DeleteFileServlet</servlet-class>
  </servlet>
  <servlet-mapping>
    <servlet-name>DeleteFileServlet</servlet-name>
    <url-pattern>/DeleteFile</url-pattern>
  </servlet-mapping>
  <servlet>
    <display-name>DeleteMessageServlet</display-name>
    <servlet-name>DeleteMessageServlet</servlet-name>
    <servlet-class>it.polimi.modaclouds.cloudapp.mic.servlet.DeleteMessageServlet</servlet-class>
  </servlet>
  <servlet-mapping>
    <servlet-name>DeleteMessageServlet</servlet-name>
    <url-pattern>/DeleteMessage</url-pattern>
  </servlet-mapping>
  <servlet>
    <display-name>InsertQuestionsServlet</display-name>
    <servlet-name>InsertQuestionsServlet</servlet-name>
    <servlet-class>it.polimi.modaclouds.cloudapp.mic.servlet.InsertQuestionsServlet</servlet-class>
  </servlet>
  <servlet-mapping>
    <servlet-name>InsertQuestionsServlet</servlet-name>
    <url-pattern>/InsertQuestions</url-pattern>
  </servlet-mapping>
  <servlet>
    <display-name>ComputeSimilarity</display-name>
    <servlet-name>ComputeSimilarityServlet</servlet-name>
    <servlet-class>it.polimi.modaclouds.cloudapp.mic.servlet.ComputeSimilarityServlet</servlet-class>
  </servlet>
  <servlet-mapping>
    <servlet-name>ComputeSimilarityServlet</servlet-name>
    <url-pattern>/computeSimilarity</url-pattern>
  </servlet-mapping>
  <servlet>
    <display-name>UpdateAnswer</display-name>
    <servlet-name>UpdateAnswerServlet</servlet-name>
    <servlet-class>it.polimi.modaclouds.cloudapp.mic.servlet.UpdateAnswerServlet</servlet-class>
  </servlet>
  <servlet-mapping>
    <servlet-name>UpdateAnswerServlet</servlet-name>
    <url-pattern>/UpdateAnswer</url-pattern>
  </servlet-mapping>
  <servlet>
    <display-name>StatServlet</display-name>
    <servlet-name>StatServlet</servlet-name>
    <servlet-class>it.polimi.modaclouds.cloudapp.mic.servlet.StatServlet</servlet-class>
  </servlet>
  <servlet-mapping>
    <servlet-name>StatServlet</servlet-name>
    <url-pattern>/Stat</url-pattern>
  </servlet-mapping>
  <servlet>
    <display-name>DeleteUR</display-name>
    <servlet-name>DeleteUR</servlet-name>
    <servlet-class>it.polimi.modaclouds.cloudapp.mic.servlet.DeleteUR</servlet-class>
  </servlet>
  <servlet-mapping>
    <servlet-name>DeleteUR</servlet-name>
    <url-pattern>/DeleteUR</url-pattern>
  </servlet-mapping>
  <servlet>
	<display-name>GlassfishQueueServlet</display-name>
	<servlet-name>GlassfishQueueServlet</servlet-name>
	<servlet-class>it.polimi.modaclouds.cpimlibrary.taskqueuemng.GlassfishQueueServlet</servlet-class>
	<load-on-startup>1</load-on-startup>
  </servlet>
  <welcome-file-list>
    <welcome-file>Home.jsp</welcome-file>
  </welcome-file-list>
  <!-- servlet che crea errore nel deploy del backend perche non viene trovata -->
	<!--
	<servlet>
		<display-name>AmazonQueueServlet</display-name>
		<servlet-name>AmazonQueueServlet</servlet-name>
		<servlet-class>com.cloud.taskqueuemng.AmazonQueueServlet</servlet-class>
		<load-on-startup>1</load-on-startup>
	</servlet>
  -->

</web-app>


text:
package com.evolveum.midpoint.web.boot.actuator;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.actuate.info.Info.Builder;
import org.springframework.boot.actuate.info.InfoContributor;
import org.springframework.context.annotation.PropertySource;
import org.springframework.core.env.Environment;
import org.springframework.stereotype.Component;

/**
 * @author skublik
 */
@Component
@PropertySource("classpath:midpoint-system.properties")
public class MidpointInfoContributor implements InfoContributor {

    @Autowired
    private Environment env;

    @Override
    public void contribute(Builder builder) {
        builder.withDetail("name", "Midpoint");
        builder.withDetail("version", env.getProperty("midpoint.system.version"));
        builder.withDetail("build", env.getProperty("midpoint.system.build"));
        builder.withDetail("branch", env.getProperty("midpoint.system.branch"));
        builder.withDetail("buildTimestamp", env.getProperty("midpoint.system.buildTimestamp"));
        builder.withDetail("scm", env.getProperty("midpoint.system.scm"));
        builder.withDetail("jira", env.getProperty("midpoint.system.jira"));
        builder.withDetail("license", env.getProperty("midpoint.system.license"));

    }

}


text:
package io.debezium.connector.postgresql;

import static io.debezium.connector.postgresql.TestHelper.PK_FIELD;
import static io.debezium.connector.postgresql.TestHelper.topicName;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;

import java.sql.SQLException;
import java.util.List;
import java.util.Map;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.stream.Collectors;
import org.apache.kafka.connect.source.SourceRecord;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;

import io.debezium.data.Envelope;
import io.debezium.data.VerifyRecord;

/**
 * Integration test for {@link RecordsSnapshotProducerIT}
 *
 * @author Horia Chiorean (hchiorea@redhat.com)
 */
public class RecordsSnapshotProducerIT extends AbstractRecordsProducerTest {

    private RecordsSnapshotProducer snapshotProducer;
    private PostgresTaskContext context;

    @Before
    public void before() throws SQLException {
        TestHelper.dropAllSchemas();

        PostgresConnectorConfig config = new PostgresConnectorConfig(TestHelper.defaultConfig().build());
        context = new PostgresTaskContext(config, new PostgresSchema(config));
    }

    @After
    public void after() throws Exception {
        if (snapshotProducer != null) {
            snapshotProducer.stop();
        }
    }

    @Test
    public void shouldGenerateSnapshotsForDefaultDatatypes() throws Exception {
        snapshotProducer = new RecordsSnapshotProducer(context, new SourceInfo(TestHelper.TEST_SERVER), false);

        TestHelper.executeDDL("postgres_create_tables.ddl");
        TestConsumer consumer = testConsumer(ALL_STMTS.size());

        //insert data for each of different supported types
        String statementsBuilder = ALL_STMTS.stream().collect(Collectors.joining(";" + System.lineSeparator())) + ";";
        TestHelper.execute(statementsBuilder);

        //then start the producer and validate all records are there
        snapshotProducer.start(consumer);
        consumer.await(2, TimeUnit.SECONDS);

        Map<String, List<SchemaAndValueField>> expectedValuesByTableName = super.schemaAndValuesByTableName();
        consumer.process(record -> assertReadRecord(record, expectedValuesByTableName));

        // check the offset information for each record
        while (!consumer.isEmpty()) {
            SourceRecord record = consumer.remove();
            assertRecordOffset(record, true, consumer.isEmpty());
        }
    }

    @Test
    public void shouldGenerateSnapshotAndContinueStreaming() throws Exception {
        String insertStmt = "INSERT INTO s1.a (aa) VALUES (1);" +
                            "INSERT INTO s2.a (aa) VALUES (1);";

        String statements = "CREATE SCHEMA s1; " +
                            "CREATE SCHEMA s2; " +
                            "CREATE TABLE s1.a (pk SERIAL, aa integer, PRIMARY KEY(pk));" +
                            "CREATE TABLE s2.a (pk SERIAL, aa integer, PRIMARY KEY(pk));" +
                            insertStmt;
        TestHelper.execute(statements);

        snapshotProducer = new RecordsSnapshotProducer(context, new SourceInfo(TestHelper.TEST_SERVER), true);
        TestConsumer consumer = testConsumer(2);
        snapshotProducer.start(consumer);

        // first make sure we get the initial records from both schemas...
        consumer.await(2, TimeUnit.SECONDS);
        consumer.clear();

        // then insert some more data and check that we get it back
        TestHelper.execute(insertStmt);
        consumer.expects(2);
        consumer.await(2, TimeUnit.SECONDS);

        SourceRecord first = consumer.remove();
        VerifyRecord.isValidInsert(first, PK_FIELD, 2);
        assertEquals(topicName("s1.a"), first.topic());
        assertRecordOffset(first, false, false);

        SourceRecord second = consumer.remove();
        VerifyRecord.isValidInsert(second, PK_FIELD, 2);
        assertEquals(topicName("s2.a"), second.topic());
        assertRecordOffset(second, false, false);

        // now shut down the producers and insert some more records
        snapshotProducer.stop();
        TestHelper.execute(insertStmt);

        // start a new producer back up, take a new snapshot (we expect all the records to be read back)
        int expectedRecordsCount = 6;
        consumer = testConsumer(expectedRecordsCount);
        snapshotProducer = new RecordsSnapshotProducer(context, new SourceInfo(TestHelper.TEST_SERVER), true);
        snapshotProducer.start(consumer);
        consumer.await(2, TimeUnit.SECONDS);

        AtomicInteger counter = new AtomicInteger(0);
        consumer.process(record -> {
            int counterVal = counter.getAndIncrement();
            int expectedPk = (counterVal % 3) + 1; //each table has 3 entries keyed 1-3
            VerifyRecord.isValidRead(record, PK_FIELD, expectedPk);
            assertRecordOffset(record, true, counterVal == (expectedRecordsCount - 1));
        });
        consumer.clear();

        // now insert two more records and check that we only get those back from the stream
        TestHelper.execute(insertStmt);
        consumer.expects(2);

        consumer.await(2, TimeUnit.SECONDS);
        first = consumer.remove();
        VerifyRecord.isValidInsert(first, PK_FIELD, 4);
        assertRecordOffset(first, false, false);

        second = consumer.remove();
        VerifyRecord.isValidInsert(second, PK_FIELD, 4);
        assertRecordOffset(second, false, false);
    }

    private void assertReadRecord(SourceRecord record, Map<String, List<SchemaAndValueField>> expectedValuesByTableName) {
        VerifyRecord.isValidRead(record, PK_FIELD, 1);
        String actualTopicName = record.topic();
        String topicPrefix = topicName("public.");
        assertTrue("Invalid topic name for records", actualTopicName.startsWith(topicPrefix));
        String tableName = actualTopicName.replace(topicPrefix, "");
        List<SchemaAndValueField> expectedValuesAndSchemasForTable = expectedValuesByTableName.get(tableName);
        assertNotNull("No expected values for " + tableName + " found", expectedValuesAndSchemasForTable);
        assertRecordSchemaAndValues(expectedValuesAndSchemasForTable, record, Envelope.FieldName.AFTER);
    }
}


text:
module( "plugins.selectall" );
test( 'selectall', function () {
    var editor = te.obj[0], db = editor.body;
    editor.setContent( '
xxxx
ssss' );
    editor.focus();
    editor.execCommand( 'selectAll' );
    editor.execCommand( "bold" );
    if(ua.browser.gecko)
        equal(editor.getContent(db),"
xxxx

ssss
","after calling selectall command");
    else
        equal(editor.getContent(db),"
xxxx

ssss
","after calling selectall command");
} );

test( 'a part of the content is selected', function () {
    var editor = te.obj[0], range = te.obj[1], db = editor.body;
    //var d = editor.document;
    editor.setContent( '
xxxx
ssss' );
    range.selectNode( db.lastChild.firstChild ).select();
    editor.execCommand( "bold" );
    equal( editor.getContent(db), "
xxxx

ssss
", "before calling selectAll command" );
    editor.execCommand( 'selectAll' );
    editor.execCommand( "bold" );
    if(ua.browser.gecko)
        equal( editor.getContent(db), "
xxxx

ssss
", "after calling selectAll command" );
    else
        equal( editor.getContent(db), "
xxxx

ssss
", "after calling selectAll command" );
} );

test( 'content is null', function () {
    var editor = te.obj[0];
    var range = te.obj[1];
    editor.setContent( '

' );
    //TODO 现在必须先focus再selectall,trace1743
    editor.focus();
    range.setStart(editor.body.firstChild,0).collapse(true).select();
    editor.execCommand( 'selectAll' );
    equal( ua.getChildHTML( editor.body ), "

", "content is null" );
    //equal(UM.plugins['selectall'].notNeedUndo, 1, "notNeedUndo==1" );
    range.setStart( editor.body.firstChild, 0 ).collapse( 1 ).select();
    editor.execCommand( "bold" );
    ua.manualDeleteFillData( editor.body );
    equal( ua.getChildHTML( editor.body ), "

", "after calling command bold" );
} );

test( 'ctrl+a', function() {
    var editor = te.obj[0];
    var range = te.obj[1];
    var body = editor.body;
    editor.setContent( '
全选的文本1

全选的文本2
' );
    range.selectNode( body.firstChild ).select();
    var p = body.firstChild;
    ua.keydown(editor.body,{'keyCode':65,'ctrlKey':true});
    setTimeout( function() {
        var range = editor.selection.getRange();
        if ( ua.browser.gecko||ua.browser.chrome )
            ua.checkResult( range, body, body, 0, 2, false, '查看全选后的range' );
        else
            ua.checkResult( range, body.firstChild.firstChild, body.lastChild.firstChild, 0, 6, false, '查看全选后的range' );
        start();
    }, 150 );
    stop();
} );


text:
using EPiServer.Commerce.Catalog;
using EPiServer.Commerce.Catalog.ContentTypes;
using EPiServer.ServiceLocation;
using EPiServer.Web.Routing;
using Mediachase.Commerce;
using Mediachase.Commerce.Catalog;
using Mediachase.Commerce.Markets;
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Web;
using System.Web.Routing;
using TcbInternetSolutions.Vulcan.Commerce.Extensions;
using TcbInternetSolutions.Vulcan.Core;
using TcbInternetSolutions.Vulcan.Core.Extensions;

namespace TcbInternetSolutions.Vulcan.Commerce.GoogleProductFeed
{
    public class GoogleProductFeed<T> : IGoogleProductFeed<T> where T : VariationContent
    {
        public Injected<AssetUrlResolver> AssetUrlResolver { get; set; }

        public Injected<IMarketService> MarketService { get; set; }

        public Injected<ICurrentMarket> CurrentMarket { get; set; }

        public string UrlSegment { get; set; }

        public Route Route { get; set; }

        public Func<Nest.SearchDescriptor<T>, Nest.SearchDescriptor<T>> Query { get; set; } = q => q.Size(9999);

        public Injected<IVulcanHandler> VulcanHandler { get; set; }

        public Injected<ReferenceConverter> ReferenceConverter { get; set; }

        public Func<T, string> DescriptionSelector { get; set; }

        public Func<T, string> GTINSelector { get; set; }

        public Func<T, string> AvailabilitySelector { get; set; }

        public Func<T, string> GoogleProductCategorySelector { get; set; }

        public Func<T, string> BrandSelector { get; set; }

        public Func<T, string> MPNSelector { get; set; }

        public Func<T, string> ShippingSelector { get; set; }

        public Func<T, string> TaxSelector { get; set; }

        public Func<T, string> ConditionSelector { get; set; }

        public Func<T, string> AdultSelector { get; set; }

        public IList<GoogleProductFeedEntry> GetEntries(string market, string language, string currency)
        {
            var selectedMarket = string.IsNullOrWhiteSpace(market) ?
                CurrentMarket.Service.GetCurrentMarket() :
                MarketService.Service.GetAllMarkets()?.FirstOrDefault(m => m.MarketId.Value.Equals(market, StringComparison.InvariantCultureIgnoreCase));

            if(selectedMarket == null)
            {
                throw new ArgumentException("Selected market could not be found (or default could not be found if no market specified)");
            }

            market = selectedMarket.MarketId.Value; // ensure correct casing

            if (string.IsNullOrWhiteSpace(language))
            {
                language = selectedMarket.DefaultLanguage.Name;
            }

            if (string.IsNullOrWhiteSpace(currency))
            {
                currency = selectedMarket.DefaultCurrency.CurrencyCode;
            }

            currency = currency.ToUpper();

            var entries = new Dictionary<string, GoogleProductFeedEntry>();

            var client = VulcanHandler.Service.GetClient(new CultureInfo(language));

            var hits = client?.SearchContent(Query, false, new[] { ReferenceConverter.Service.GetRootLink() })?.GetHitContents();

            if (hits?.Any() == true)
            {
                foreach (var hit in hits)
                {
                    var product = hit.Value as T;

                    if (entries.ContainsKey(product.Code)) continue;

                    var price = hit.Key.Source.GetPrice(market, currency);

                    if (price == 0) continue;

                    var image = AssetUrlResolver.Service.GetAssetUrl(product);

                    if (string.IsNullOrWhiteSpace(image)) continue;

                    var description = DescriptionSelector == null
                        ? product.DisplayName
                        : DescriptionSelector.Invoke(product);
                    if (string.IsNullOrWhiteSpace(description))
                        description = product.DisplayName; // double-check in case it's empty

                    entries.Add(product.Code, new GoogleProductFeedEntry
                    {
                        Id = product.Code?.Replace('\t', ' '),
                        Title = product.DisplayName?.Replace('\t', ' '),
                        Description = description?.Replace('\t', ' '),
                        Availability =
                            AvailabilitySelector == null
                                ? "in stock"
                                : AvailabilitySelector.Invoke(product)?.Replace('\t', ' '),
                        Adult = AdultSelector == null ? "no" : AdultSelector.Invoke(product)?.Replace('\t', ' '),
                        Brand = BrandSelector?.Invoke(product)?.Replace('\t', ' '),
                        Condition = ConditionSelector == null
                            ? "new"
                            : ConditionSelector.Invoke(product)?.Replace('\t', ' '),
                        GoogleProductCategory = GoogleProductCategorySelector?.Invoke(product)?.Replace('\t', ' '),
                        GTIN = GTINSelector?.Invoke(product)?.Replace('\t', ' '),
                        MPN = MPNSelector?.Invoke(product)?.Replace('\t', ' '),
                        Shipping = ShippingSelector?.Invoke(product)?.Replace('\t', ' '),
                        Tax = TaxSelector?.Invoke(product)?.Replace('\t', ' '),
                        ImageLink = FullUrl(image),
                        Link = FullUrl(UrlResolver.Current.GetUrl(product)),
                        Price = price.ToString("F2", CultureInfo.InvariantCulture) + " " + currency.ToUpper()
                    });
                }
            }

            return entries.Values.ToList();
        }

        private static string FullUrl(string url)
        {
            if (string.IsNullOrWhiteSpace(url)) return null;

            // code from https://stackoverflow.com/questions/29897769/episerver-get-absolute-friendly-url-for-given-culture-for-page

            var uri = new Uri(url, UriKind.RelativeOrAbsolute);
            return uri.IsAbsoluteUri ? url : new Uri(HttpContext.Current.Request.Url, uri).ToString();
        }
    }
}


text:
#pragma warning disable 1591

using System;
using System.ComponentModel;
using System.Diagnostics;
using System.Xml;
using System.Xml.Serialization;

namespace DotNetCasClient.Validation.Schema.Saml20.Protocol
{
    [Serializable]
    [DebuggerStepThrough]
    [DesignerCategory("code")]
    [XmlType(Namespace="urn:oasis:names:tc:SAML:2.0:protocol")]
    [XmlRoot("StatusDetail", Namespace="urn:oasis:names:tc:SAML:2.0:protocol", IsNullable=false)]
    public class StatusDetailType {
        [XmlAnyElement]
        public XmlElement[] Any
        {
            get;
            set;
        }
    }
}

#pragma warning restore 1591


text:
package org.lamport.tla.toolbox.tool.tlc.ui.editor.page.results;

import java.util.Comparator;

import org.eclipse.jface.viewers.Viewer;
import org.eclipse.jface.viewers.ViewerComparator;
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Table;
import org.eclipse.swt.widgets.TableColumn;
import org.lamport.tla.toolbox.tool.tlc.output.data.ActionInformationItem;

public class CoverageViewerComparator extends ViewerComparator {

	@Override
	public int compare(final Viewer viewer, final Object e1, final Object e2) {
		final ActionInformationItem a1 = (ActionInformationItem) e1;
		final ActionInformationItem a2 = (ActionInformationItem) e2;

		final Table table = (Table) viewer.getControl();
		final TableColumn sortColumn = table.getSortColumn();
		if (sortColumn == null) {
			// a) Compare by distinct states first (we want actions with zero distinct states
			// to appear at the top).
			if (Long.compare(a1.getUnseen(), a2.getUnseen()) == 0L) {
				// b) Compare by location
				return a1.getModuleLocation().compareTo(a2.getModuleLocation());
			} else {
				return Long.compare(a1.getUnseen(), a2.getUnseen());
			}
		} else {
			// User requested to sort a specific column up or down.
			@SuppressWarnings("unchecked")
			final Comparator<ActionInformationItem> comp = (Comparator<ActionInformationItem>) sortColumn
					.getData(CoverageLabelProvider.COVERAGE_COMPARATOR);
			if (table.getSortDirection() == SWT.UP) {
				return comp.compare(a2, a1);
			} else {
				return comp.compare(a1, a2);
			}
		}
	}
}


text:
package net.imagej.legacy.convert.roi.line;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotEquals;

import net.imglib2.roi.geom.real.DefaultWritableLine;
import net.imglib2.roi.geom.real.WritableLine;

import org.junit.Before;
import org.junit.Test;

/**
 * Tests {@link LineWrapper}
 *
 * @author Alison Walter
 */
public class LineWrapperTest {

	private WritableLine l;
	private LineWrapper w;

	@Before
	public void setup() {
		l = new DefaultWritableLine(new double[] { 12, 14.5 }, new double[] { 23.25,
			67 }, false);
		w = new LineWrapper(l);
	}

	@Test
	public void testGetters() {
		assertEquals(l.endpointOne().getDoublePosition(0), w.x1d, 0);
		assertEquals(l.endpointOne().getDoublePosition(1), w.y1d, 0);
		assertEquals(l.endpointTwo().getDoublePosition(0), w.x2d, 0);
		assertEquals(l.endpointTwo().getDoublePosition(1), w.y2d, 0);
	}

	@Test
	public void testGetSource() {
		assertEquals(l, w.getSource());
	}

	@Test
	public void testSynchronize() {
		w.x1d = 3;
		w.y1d = 55.25;
		w.x2d = 100;
		w.y2d = 10;

		assertNotEquals(l.endpointOne().getDoublePosition(0), w.x1d, 0);
		assertNotEquals(l.endpointOne().getDoublePosition(1), w.y1d, 0);
		assertNotEquals(l.endpointTwo().getDoublePosition(0), w.x2d, 0);
		assertNotEquals(l.endpointTwo().getDoublePosition(1), w.y2d, 0);

		w.synchronize();

		assertEquals(l.endpointOne().getDoublePosition(0), w.x1d, 0);
		assertEquals(l.endpointOne().getDoublePosition(1), w.y1d, 0);
		assertEquals(l.endpointTwo().getDoublePosition(0), w.x2d, 0);
		assertEquals(l.endpointTwo().getDoublePosition(1), w.y2d, 0);

	}

	@Test
	public void testGetUpdatedSource() {
		w.x1d = 0;

		assertEquals(12, l.endpointOne().getDoublePosition(0), 0);
		assertEquals(14.5, l.endpointOne().getDoublePosition(1), 0);
		assertEquals(23.25, l.endpointTwo().getDoublePosition(0), 0);
		assertEquals(67, l.endpointTwo().getDoublePosition(1), 0);

		final WritableLine wl = w.getUpdatedSource();

		assertEquals(l, wl);
		assertEquals(0, l.endpointOne().getDoublePosition(0), 0);
		assertEquals(14.5, l.endpointOne().getDoublePosition(1), 0);
		assertEquals(23.25, l.endpointTwo().getDoublePosition(0), 0);
		assertEquals(67, l.endpointTwo().getDoublePosition(1), 0);
	}

	@Test
	public void testLineWithWidth() {
		ij.gui.Line.setWidth(2);
		w.synchronize();

		// Setting the width shouldn't change the ImgLib2 Line
		assertEquals(12, l.endpointOne().getDoublePosition(0), 0);
		assertEquals(14.5, l.endpointOne().getDoublePosition(1), 0);
		assertEquals(23.25, l.endpointTwo().getDoublePosition(0), 0);
		assertEquals(67, l.endpointTwo().getDoublePosition(1), 0);
	}
}


text:
package hudson.model;

import jenkins.model.RunAction2;

/**
 * @deprecated Use {@link RunAction2} instead: {@link #onLoad} does not work well with lazy loading if you are trying to persist the owner; and {@link #onBuildComplete} was never called.
 */
@Deprecated
public interface RunAction extends Action {
    /**
     * Called after the build is loaded and the object is added to the build list.
     *
     * Because {@link RunAction}s are persisted with {@link Run}, the implementation
     * can keep a reference to {@link Run} in a field (which is set via {@link #onAttached(Run)})
     */
    void onLoad();

    /**
     * Called when the action is added to the {@link Run} object.
     * @since 1.376
     */
    void onAttached(Run r);

    /**
     * Called after the build is finished.
     */
    void onBuildComplete();
}


text:
<!DOCTYPE html>

  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  <title>Semantic News Search: Results</title>

  <link id="stylesheet" type="text/css" rel="stylesheet" href="/css/style.css"/>

Semantic News Search

      <form id="search" action="/search/" method="get">
        <input type="text" placeholder="SEARCH" name="q" mt:value="" id="searchbox"/>
        <input type="submit" value="Search"/>
      </form>


text:
<?php $page = $settings['page']; ?>

<?php echo $article ?>

<?php
$pub_date = $slot->getOption('publication_date');
$date = isset($pub_date) ? $pub_date : $slot->getCreatedAt();
?>
<?php echo format_date($date, 'EEEE dd MMMM yyyy', $slot->getCulture()) ?> -
<a href="<?php echo sfPlopTools::urlForPage($page->getSlug(), '', $slot->getCulture()) ?>#disqus_thread"><?php echo __('Comments') ?>

<?php if($slot->getOption('share_on_twitter')): ?>

    Tweet

<?php endif; ?>

<?php if($slot->getOption('share_on_facebook')): ?>

    <iframe src="http://www.facebook.com/plugins/like.php?href=<?php echo urlencode(sfPlopTools::urlForPage($page->getSlug(), '', $slot->getCulture())) ?>&layout=button_count&show_faces=true&width=450&action=like&colorscheme=light&height=21" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:150px; height:21px;" allowTransparency="true">

<?php endif; ?>

<?php if($slot->getOption('disqus_id')): ?>

  <?php echo __('Please enable JavaScript to view the') ?> <a href="http://disqus.com/?ref_noscript=<?php echo $slot->getOption('disqus_id') ?>"><?php echo __('comments powered by') ?> Disqus.
  <?php echo __('Blog comments powered by') ?> Disqus
<?php endif; ?>


text:
import inspect
from app.services import auth

class InjectPlugin(object):

    name = 'inject'
    api = 2

    def __init__(self, keyword='inject', **kwargs):
        self.keyword = keyword

    def setup(self, app):
        self.app = app

    def apply(self, callback, context):
        args = inspect.getargspec(context.callback)[0]

        moreargs = {}
        if 'db' in args:
            moreargs['db'] = None
        if 'auth' in args:
            moreargs['auth'] = auth
        if 'logger' in args:
            moreargs['logger'] = logger

        if moreargs:
            def wrapper(*args, **kwargs):
                for k in moreargs:
                    kwargs[k] = moreargs[k]
                body = callback(*args, **kwargs)
                return body
            return wrapper
        else:
            return callback


text:
#import "NSObject.h"

#import "NSSecureCoding-Protocol.h"

@class NSString, NSURL;

@interface SLPlace : NSObject <NSSecureCoding>
{
    NSString *_identifier;
    NSString *_name;
    NSURL *_pictureURL;
    NSString *_category;
    double _latitude;
    double _longitude;
    double _distance;
}

+ (_Bool)supportsSecureCoding;
@property double distance; // @synthesize distance=_distance;
@property double longitude; // @synthesize longitude=_longitude;
@property double latitude; // @synthesize latitude=_latitude;
@property(retain) NSString *category; // @synthesize category=_category;
@property(retain) NSURL *pictureURL; // @synthesize pictureURL=_pictureURL;
@property(retain) NSString *name; // @synthesize name=_name;
@property(retain) NSString *identifier; // @synthesize identifier=_identifier;
- (void).cxx_destruct;
- (id)description;
- (void)encodeWithCoder:(id)arg1;
- (id)initWithCoder:(id)arg1;
- (id)encodableProperties;

@end


text:
#ifndef __ColourInterpolatorAffectorFactory_H__
#define __ColourInterpolatorAffectorFactory_H__

#include "OgreParticleFXPrerequisites.h"
#include "OgreParticleAffectorFactory.h"
#include "OgreColourInterpolatorAffector.h"

namespace Ogre {

    /** Factory class for ColourInterpolatorAffector. */
    class _OgreParticleFXExport ColourInterpolatorAffectorFactory : public ParticleAffectorFactory
    {
        /** See ParticleAffectorFactory */
        String getName() const { return "ColourInterpolator"; }

        /** See ParticleAffectorFactory */
        ParticleAffector* createAffector(ParticleSystem* psys)
        {
            ParticleAffector* p = new ColourInterpolatorAffector(psys);
            mAffectors.push_back(p);
            return p;
        }
    };

}

#endif


text:
var applicationSettingsModule = require("application-settings");
var observableModule = require("data/observable");
var frameModule = require("ui/frame");

var viewModel = {
    listItems: [
        { title: "Page Management", view: "page-management" },
        { title: "Navigation", view: "nav" },
        { title: "Data Binding", view: "data-binding" }
    ]
};
var page;

exports.loaded = function (args) {
    page = args.object;
    page.bindingContext = viewModel;

    // example of storing applciation settings
    applicationSettingsModule.setString("Name", "Mike Branstein");
    console.log(applicationSettingsModule.getString("Name")); // prints Mike Branstein
    console.log(applicationSettingsModule.hasKey("Name")); // prints true
    applicationSettingsModule.remove("Name"); // removes the "Name" key
    console.log(applicationSettingsModule.hasKey("Name")); // prints false
};

exports.onItemTap = function (args) {
    var item = args.view.bindingContext;
    var index = args.index;

    console.log("Index of tapped ListItem: " + index);
    console.log("Value of tapped ListItem: " + item.view);

    frameModule.topmost().navigate("views/" + item.view + "/" + item.view);
};


text:
Contrastive learning specialized losses.

## Classes

- [`class Barlow`](../TFSimilarity/losses/Barlow.md): Computes the Barlow Loss between two batches of embeddings.

- [`class CircleLoss`](../TFSimilarity/losses/CircleLoss.md): Computes the CircleLoss

- [`class MetricLoss`](../TFSimilarity/losses/MetricLoss.md): Wraps a loss function in the `Loss` class.

- [`class MultiSimilarityLoss`](../TFSimilarity/losses/MultiSimilarityLoss.md): Computes the multi similarity loss in an online fashion.

- [`class PNLoss`](../TFSimilarity/losses/PNLoss.md): Computes the PN loss in an online fashion.

- [`class SimCLRLoss`](../TFSimilarity/losses/SimCLRLoss.md): SimCLR Loss

- [`class SimSiamLoss`](../TFSimilarity/losses/SimSiamLoss.md): SimSiam Loss

- [`class SoftNearestNeighborLoss`](../TFSimilarity/losses/SoftNearestNeighborLoss.md): Computes the soft nearest neighbors loss in an online fashion.

- [`class TripletLoss`](../TFSimilarity/losses/TripletLoss.md): Computes the triplet loss in an online fashion.

- [`class VicReg`](../TFSimilarity/losses/VicReg.md): VicReg Loss


text:
<?php

namespace Nette\Templating;

use Nette,
	Nette\Caching,
	Latte;

/**
 * @deprecated
 */
class FileTemplate extends Template implements IFileTemplate
{
	/** @var string */
	private $file;

	/**
	 * Constructor.
	 * @param  string  template file path
	 */
	public function __construct($file = NULL)
	{
		//trigger_error(__CLASS__ . ' is deprecated.', E_USER_DEPRECATED);
		if ($file !== NULL) {
			$this->setFile($file);
		}
	}

	/**
	 * Sets the path to the template file.
	 * @param  string  template file path
	 * @return self
	 */
	public function setFile($file)
	{
		$this->file = realpath($file);
		if (!$this->file) {
			throw new Nette\FileNotFoundException("Missing template file '$file'.");
		}
		return $this;
	}

	/**
	 * Returns the path to the template file.
	 * @return string  template file path
	 */
	public function getFile()
	{
		return $this->file;
	}

	/**
	 * Returns template source code.
	 * @return string
	 */
	public function getSource()
	{
		return file_get_contents($this->file);
	}

	/********************* rendering ****************d*g**/

	/**
	 * Renders template to output.
	 * @return void
	 */
	public function render()
	{
		if ($this->file == NULL) { // intentionally ==
			throw new Nette\InvalidStateException('Template file name was not specified.');
		}

		if (!$this->getFilters()) {
			$this->onPrepareFilters($this);
		}

		if ($latte = $this->getLatte()) {
			return $latte->setLoader(new Latte\Loaders\FileLoader)->render($this->file, $this->getParameters());
		}

		$cache = new Caching\Cache($storage = $this->getCacheStorage(), 'Nette.FileTemplate');
		if ($storage instanceof Caching\Storages\PhpFileStorage) {
			$storage->hint = str_replace(dirname(dirname($this->file)), '', $this->file);
		}
		$cached = $compiled = $cache->load($this->file);

		if ($compiled === NULL) {
			try {
				$compiled = "<?php\n\n// source file: $this->file\n\n?>" . $this->compile();

			} catch (FilterException $e) {
				throw $e->setSource(file_get_contents($this->file), $e->sourceLine, $this->file);
			}

			$cache->save($this->file, $compiled, array(
				Caching\Cache::FILES => $this->file,
				Caching\Cache::CONSTS => 'Nette\Framework::REVISION',
			));
			$cached = $cache->load($this->file);
		}

		$isFile = $cached !== NULL && $storage instanceof Caching\Storages\PhpFileStorage;
		self::load($isFile ? $cached['file'] : $compiled, $this->getParameters(), $isFile);
	}

}


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

namespace Fort
{
    /// <summary>
    /// This service is used to manage Achievement actions like claiming achievement and checking if achievement is claimed
    /// </summary>
    public interface IAchievementService
    {
        /// <summary>
        /// Claiming none level base achievement
        /// </summary>
        /// <param name="noneLevelBaseType">The type of none level base achievement</param>
        void ClaimAchievement(Type noneLevelBaseType);
        /// <summary>
        /// Claiming level base achievement
        /// </summary>
        /// <param name="levelBaseType">The type of level base achievement</param>
        /// <param name="achivementLevelIndex">Level of achievement that must be claimed</param>
        void ClaimAchievement(Type levelBaseType, int achivementLevelIndex);
        /// <summary>
        /// Is none level base achievement claimed
        /// </summary>
        /// <param name="noneLevelBaseType">The type of none level base achievement</param>
        /// <returns></returns>
        bool IsAchievementClaimed(Type noneLevelBaseType);
        /// <summary>
        /// Return the index of claimed level base achievement -1 if not claimed yet
        /// </summary>
        /// <param name="levelBaseType">The type of level base achievement</param>
        /// <returns>index of claimed level base achievement</returns>
        int GetAchievementClaimedIndex(Type levelBaseType);
        /// <summary>
        /// Resolving the score and balance of an achievement or achievement level by Id
        /// </summary>
        /// <param name="id">Id of achievement or achievement level</param>
        /// <returns></returns>
        ScoreBalance ResolveAchievementScoreBalance(string id);
    }

    /// <summary>
    /// This class encapsulates score and balance
    /// </summary>
    [Serializable]
    public class ScoreBalance
    {
        public int Score { get; set; }
        public Balance Balance { get; set; }

        public bool IsEmpty()
        {
            return Score == 0 && (Balance == null || Balance.Values.All(pair => pair.Value == 0));
        }
    }
    public class ServerAchievement
    {
        public string Name { get; set; }
        public string AchievementId { get; set; }
        public int Score { get; set; }
        public Dictionary<string, int> Values { get; set; }
    }
}


text:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.jvivier.weatheranywhere">

    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />

    <application
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:roundIcon="@mipmap/ic_launcher_round"
        android:supportsRtl="true"
        android:theme="@style/AppTheme">

        <!-- ACTIVITIES -->

        <activity
            android:name=".MainActivity"
            android:theme="@style/AppTheme"
            android:label="Weather Anywhere">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>

        <activity
            android:name=".MapLocationActivity"
            android:label="Weather location"
            android:parentActivityName=".MainActivity">
            <meta-data
                android:name="android.support.PARENT_ACTIVITY"
                android:value=".MainActivity" />
        </activity>

        <activity
            android:name=".DetailActivity"
            android:label="Details"
            android:parentActivityName=".MainActivity"
            >
            <meta-data
                android:name="android.support.PARENT_ACTIVITY"
                android:value=".MainActivity" />
        </activity>

        <activity android:name=".SettingsActivity"
            android:label="Settings"/>

        <!-- SERVICES -->

        <service
            android:name=".sync.WeatherSyncIntentService"
            android:exported="false" />

        <service
            android:exported="false"
            android:name=".sync.WeatherFirebaseJobService">
            <intent-filter>
                <action android:name="com.firebase.jobdispatcher.ACTION_EXECUTE"/>
            </intent-filter>
        </service>

        <!-- CONTENT PROVIDERS -->

        <provider
            android:name=".data.WeatherProvider"
            android:authorities="@string/content_authority"
            android:exported="false" />

        <meta-data
            android:name="com.google.android.gms.version"
            android:value="@integer/google_play_services_version" />
        <meta-data
            android:name="com.google.android.maps.v2.API_KEY"
            android:value="@string/google_play_api_key" />

    </application>

</manifest>