text:
enum MenuEntries {
  NAME = 0,
  CONFIGURE,
  HIDE,
  DISABLE,
  UNINSTALL,
  MANAGE,
  INSPECT_POPUP
};

ExtensionContextMenuModel::ExtensionContextMenuModel(
    const Extension* extension,
    Browser* browser,
    PopupDelegate* delegate)
    : ALLOW_THIS_IN_INITIALIZER_LIST(SimpleMenuModel(this)),
      extension_id_(extension->id()),
      browser_(browser),
      profile_(browser->profile()),
      delegate_(delegate) {
  extension_action_ = extension->browser_action();
  if (!extension_action_)
    extension_action_ = extension->page_action();

  InitCommonCommands();

  if (profile_->GetPrefs()->GetBoolean(prefs::kExtensionsUIDeveloperMode) &&
      delegate_) {
    AddSeparator();
    AddItemWithStringId(INSPECT_POPUP, IDS_EXTENSION_ACTION_INSPECT_POPUP);
  }
}

ExtensionContextMenuModel::~ExtensionContextMenuModel() {
}

void ExtensionContextMenuModel::InitCommonCommands() {
  const Extension* extension = GetExtension();

  // The extension pointer should only be null if the extension was uninstalled,
  // and since the menu just opened, it should still be installed.
  DCHECK(extension);

  AddItem(NAME, UTF8ToUTF16(extension->name()));
  AddSeparator();
  AddItemWithStringId(CONFIGURE, IDS_EXTENSIONS_OPTIONS);
  AddItemWithStringId(DISABLE, IDS_EXTENSIONS_DISABLE);
  AddItemWithStringId(UNINSTALL, IDS_EXTENSIONS_UNINSTALL);
  if (extension->browser_action())
    AddItemWithStringId(HIDE, IDS_EXTENSIONS_HIDE_BUTTON);
  AddSeparator();
  AddItemWithStringId(MANAGE, IDS_MANAGE_EXTENSIONS);
}

bool ExtensionContextMenuModel::IsCommandIdChecked(int command_id) const {
  return false;
}

bool ExtensionContextMenuModel::IsCommandIdEnabled(int command_id) const {
  const Extension* extension = this->GetExtension();
  if (!extension)
    return false;

  if (command_id == CONFIGURE) {
    return extension->options_url().spec().length() > 0;
  } else if (command_id == NAME) {
    // The NAME links to the Homepage URL. If the extension doesn't have a
    // homepage, we just disable this menu item.
    return extension->GetHomepageURL().is_valid();
  } else if (command_id == INSPECT_POPUP) {
    TabContents* contents = browser_->GetSelectedTabContents();
    if (!contents)
      return false;

    return extension_action_->HasPopup(ExtensionTabUtil::GetTabId(contents));
  } else if (command_id == DISABLE || command_id == UNINSTALL) {
    // Some extension types can not be disabled or uninstalled.
    return Extension::UserMayDisable(extension->location());
  }
  return true;
}

bool ExtensionContextMenuModel::GetAcceleratorForCommandId(
    int command_id, ui::Accelerator* accelerator) {
  return false;
}

void ExtensionContextMenuModel::ExecuteCommand(int command_id) {
  const Extension* extension = GetExtension();
  if (!extension)
    return;

  switch (command_id) {
    case NAME: {
      browser_->OpenURL(extension->GetHomepageURL(), GURL(),
                        NEW_FOREGROUND_TAB, PageTransition::LINK);
      break;
    }
    case CONFIGURE:
      DCHECK(!extension->options_url().is_empty());
      profile_->GetExtensionProcessManager()->OpenOptionsPage(extension,
                                                              browser_);
      break;
    case HIDE: {
      ExtensionService* extension_service = profile_->GetExtensionService();
      extension_service->SetBrowserActionVisibility(extension, false);
      break;
    }
    case DISABLE: {
      ExtensionService* extension_service = profile_->GetExtensionService();
      extension_service->DisableExtension(extension_id_);
      break;
    }
    case UNINSTALL: {
      AddRef();  // Balanced in Accepted() and Canceled()
      extension_uninstall_dialog_.reset(new ExtensionUninstallDialog(profile_));
      extension_uninstall_dialog_->ConfirmUninstall(this, extension);
      break;
    }
    case MANAGE: {
      browser_->OpenURL(GURL(chrome::kChromeUIExtensionsURL), GURL(),
                        SINGLETON_TAB, PageTransition::LINK);
      break;
    }
    case INSPECT_POPUP: {
      delegate_->InspectPopup(extension_action_);
      break;
    }
    default:
     NOTREACHED() << "Unknown option";
     break;
  }
}

void ExtensionContextMenuModel::ExtensionDialogAccepted() {
  if (GetExtension())
    profile_->GetExtensionService()->UninstallExtension(extension_id_, false,
                                                        NULL);

  Release();
}

void ExtensionContextMenuModel::ExtensionDialogCanceled() {
  Release();
}

const Extension* ExtensionContextMenuModel::GetExtension() const {
  ExtensionService* extension_service = profile_->GetExtensionService();
  return extension_service->GetExtensionById(extension_id_, false);
}


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-dependencies</artifactId>
		<version>${revision}</version>
		<relativePath>../spring-boot-dependencies</relativePath>
	</parent>
	<artifactId>spring-boot-parent</artifactId>
	<packaging>pom</packaging>
	<name>Spring Boot Parent</name>
	<description>Spring Boot Parent</description>
	<organization>
		<name>Pivotal Software, Inc.</name>
		<url>https://spring.io</url>
	</organization>
	<properties>
		<main.basedir>${basedir}/../..</main.basedir>
		<disable.checks>false</disable.checks>
		<java.version>1.8</java.version>
		<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
		<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
		<aether.version>1.0.2.v20150114</aether.version>
		<maven.version>3.1.1</maven.version>
		<spock.version>1.0-groovy-2.4</spock.version>
	</properties>
	<scm>
		<url>http://github.com/spring-projects/spring-boot</url>
		<connection>scm:git:git://github.com/spring-projects/spring-boot.git</connection>
		<developerConnection>scm:git:ssh://git@github.com/spring-projects/spring-boot.git</developerConnection>
	</scm>
	<issueManagement>
		<system>Github</system>
		<url>https://github.com/spring-projects/spring-boot/issues</url>
	</issueManagement>
	<prerequisites>
		<maven>3.5</maven>
	</prerequisites>
	<dependencyManagement>
		<dependencies>
			<!-- Internal unpublished Spring Boot dependencies -->
			<dependency>
				<groupId>org.springframework.boot</groupId>
				<artifactId>spring-boot-test-support</artifactId>
				<version>${revision}</version>
			</dependency>
			<!-- Additional Spring Boot only Dependencies (not useful for users) -->
			<dependency>
				<!-- deprecated but recent version required by 3rd party libs -->
				<groupId>log4j</groupId>
				<artifactId>log4j</artifactId>
				<version>1.2.17</version>
			</dependency>
			<dependency>
				<groupId>commons-fileupload</groupId>
				<artifactId>commons-fileupload</artifactId>
				<version>1.3.3</version>
			</dependency>
			<dependency>
				<groupId>com.nhaarman</groupId>
				<artifactId>mockito-kotlin</artifactId>
				<version>1.5.0</version>
				<exclusions>
					<exclusion>
						<groupId>org.jetbrains.kotlin</groupId>
						<artifactId>kotlin-stdlib</artifactId>
					</exclusion>
					<exclusion>
						<groupId>org.jetbrains.kotlin</groupId>
						<artifactId>kotlin-reflect</artifactId>
					</exclusion>
					<exclusion>
						<groupId>org.mockito</groupId>
						<artifactId>mockito-core</artifactId>
					</exclusion>
				</exclusions>
			</dependency>
			<dependency>
				<groupId>com.squareup.okhttp</groupId>
				<artifactId>okhttp</artifactId>
				<version>2.7.5</version>
			</dependency>
			<dependency>
				<groupId>com.squareup.okhttp3</groupId>
				<artifactId>okhttp</artifactId>
				<version>3.9.0</version>
			</dependency>
			<dependency>
				<groupId>com.squareup.okhttp3</groupId>
				<artifactId>mockwebserver</artifactId>
				<version>3.9.0</version>
			</dependency>
			<dependency>
				<groupId>org.testcontainers</groupId>
				<artifactId>testcontainers</artifactId>
				<version>1.7.2</version>
			</dependency>
			<dependency>
				<groupId>com.vaadin.external.google</groupId>
				<artifactId>android-json</artifactId>
				<version>0.0.20131108.vaadin1</version>
			</dependency>
			<dependency>
				<groupId>io.spring.gradle</groupId>
				<artifactId>dependency-management-plugin</artifactId>
				<version>1.0.6.RELEASE</version>
			</dependency>
			<dependency>
				<groupId>jline</groupId>
				<artifactId>jline</artifactId>
				<version>2.11</version>
			</dependency>
			<dependency>
				<groupId>net.sf.jopt-simple</groupId>
				<artifactId>jopt-simple</artifactId>
				<version>4.6</version>
			</dependency>
			<dependency>
				<groupId>org.apache.commons</groupId>
				<artifactId>commons-compress</artifactId>
				<version>1.14</version>
			</dependency>
			<dependency>
				<groupId>org.apache.ivy</groupId>
				<artifactId>ivy</artifactId>
				<version>2.3.0</version>
			</dependency>
			<dependency>
				<groupId>org.apache.maven</groupId>
				<artifactId>maven-aether-provider</artifactId>
				<version>3.2.1</version>
			</dependency>
			<dependency>
				<groupId>org.apache.maven</groupId>
				<artifactId>maven-archiver</artifactId>
				<version>2.6</version>
			</dependency>
			<dependency>
				<groupId>org.apache.maven</groupId>
				<artifactId>maven-artifact</artifactId>
				<version>${maven.version}</version>
			</dependency>
			<dependency>
				<groupId>org.apache.maven</groupId>
				<artifactId>maven-core</artifactId>
				<version>${maven.version}</version>
			</dependency>
			<dependency>
				<groupId>org.apache.maven</groupId>
				<artifactId>maven-model</artifactId>
				<version>${maven.version}</version>
			</dependency>
			<dependency>
				<groupId>org.apache.maven</groupId>
				<artifactId>maven-plugin-api</artifactId>
				<version>${maven.version}</version>
			</dependency>
			<dependency>
				<groupId>org.apache.maven</groupId>
				<artifactId>maven-settings</artifactId>
				<version>${maven.version}</version>
			</dependency>
			<dependency>
				<groupId>org.apache.maven</groupId>
				<artifactId>maven-settings-builder</artifactId>
				<version>${maven.version}</version>
			</dependency>
			<dependency>
				<groupId>org.apache.maven.shared</groupId>
				<artifactId>maven-common-artifact-filters</artifactId>
				<version>1.4</version>
			</dependency>
			<dependency>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-shade-plugin</artifactId>
				<version>2.2</version>
			</dependency>
			<dependency>
				<groupId>org.apache.maven.plugin-tools</groupId>
				<artifactId>maven-plugin-annotations</artifactId>
				<version>3.2</version>
			</dependency>
			<dependency>
				<groupId>org.codehaus.plexus</groupId>
				<artifactId>plexus-archiver</artifactId>
				<version>2.8.1</version>
			</dependency>
			<dependency>
				<groupId>org.codehaus.plexus</groupId>
				<artifactId>plexus-component-api</artifactId>
				<version>1.0-alpha-33</version>
			</dependency>
			<dependency>
				<groupId>org.codehaus.plexus</groupId>
				<artifactId>plexus-utils</artifactId>
				<version>3.0.24</version>
			</dependency>
			<dependency>
				<groupId>org.eclipse.aether</groupId>
				<artifactId>aether-api</artifactId>
				<version>${aether.version}</version>
			</dependency>
			<dependency>
				<groupId>org.eclipse.aether</groupId>
				<artifactId>aether-connector-basic</artifactId>
				<version>${aether.version}</version>
			</dependency>
			<dependency>
				<groupId>org.eclipse.aether</groupId>
				<artifactId>aether-impl</artifactId>
				<version>${aether.version}</version>
			</dependency>
			<dependency>
				<groupId>org.eclipse.aether</groupId>
				<artifactId>aether-spi</artifactId>
				<version>${aether.version}</version>
			</dependency>
			<dependency>
				<groupId>org.eclipse.aether</groupId>
				<artifactId>aether-transport-file</artifactId>
				<version>${aether.version}</version>
			</dependency>
			<dependency>
				<groupId>org.eclipse.aether</groupId>
				<artifactId>aether-transport-http</artifactId>
				<version>${aether.version}</version>
			</dependency>
			<dependency>
				<groupId>org.eclipse.aether</groupId>
				<artifactId>aether-util</artifactId>
				<version>${aether.version}</version>
			</dependency>
			<dependency>
				<groupId>org.sonatype.plexus</groupId>
				<artifactId>plexus-build-api</artifactId>
				<version>0.0.7</version>
			</dependency>
			<dependency>
				<groupId>org.spockframework</groupId>
				<artifactId>spock-core</artifactId>
				<version>${spock.version}</version>
				<exclusions>
					<exclusion>
						<groupId>org.codehaus.groovy</groupId>
						<artifactId>groovy-all</artifactId>
					</exclusion>
				</exclusions>
			</dependency>
			<dependency>
				<groupId>org.spockframework</groupId>
				<artifactId>spock-spring</artifactId>
				<version>${spock.version}</version>
			</dependency>
			<dependency>
				<groupId>org.zeroturnaround</groupId>
				<artifactId>zt-zip</artifactId>
				<version>1.7</version>
			</dependency>
		</dependencies>
	</dependencyManagement>
	<dependencies>
		<!-- Generally Useful Test Dependencies -->
		<dependency>
			<groupId>junit</groupId>
			<artifactId>junit</artifactId>
			<scope>test</scope>
		</dependency>
		<dependency>
			<groupId>org.assertj</groupId>
			<artifactId>assertj-core</artifactId>
			<scope>test</scope>
		</dependency>
		<dependency>
			<groupId>org.mockito</groupId>
			<artifactId>mockito-core</artifactId>
			<scope>test</scope>
		</dependency>
		<dependency>
			<groupId>org.hamcrest</groupId>
			<artifactId>hamcrest-library</artifactId>
			<scope>test</scope>
		</dependency>
		<dependency>
			<groupId>org.springframework</groupId>
			<artifactId>spring-test</artifactId>
			<scope>test</scope>
		</dependency>
	</dependencies>
	<build>
		<pluginManagement>
			<plugins>
				<plugin>
					<groupId>org.jetbrains.kotlin</groupId>
					<artifactId>kotlin-maven-plugin</artifactId>
					<version>${kotlin.version}</version>
					<configuration>
						<jvmTarget>${java.version}</jvmTarget>
						<apiVersion>1.1</apiVersion>
						<languageVersion>1.1</languageVersion>
						<javaParameters>true</javaParameters>
					</configuration>
				</plugin>
				<plugin>
					<groupId>org.asciidoctor</groupId>
					<artifactId>asciidoctor-maven-plugin</artifactId>
					<version>1.5.5</version>
				</plugin>
				<plugin>
					<groupId>org.apache.maven.plugins</groupId>
					<artifactId>maven-failsafe-plugin</artifactId>
					<executions>
						<execution>
							<goals>
								<goal>integration-test</goal>
								<goal>verify</goal>
							</goals>
						</execution>
					</executions>
				</plugin>
				<plugin>
					<groupId>org.apache.maven.plugins</groupId>
					<artifactId>maven-plugin-plugin</artifactId>
					<version>3.5</version>
				</plugin>
				<plugin>
					<groupId>org.apache.maven.plugins</groupId>
					<artifactId>maven-site-plugin</artifactId>
				</plugin>
				<plugin>
					<groupId>org.basepom.maven</groupId>
					<artifactId>duplicate-finder-maven-plugin</artifactId>
					<version>1.3.0</version>
				</plugin>
				<plugin>
					<groupId>org.codehaus.cargo</groupId>
					<artifactId>cargo-maven2-plugin</artifactId>
					<version>1.6.7</version>
				</plugin>
				<plugin>
					<groupId>org.codehaus.gmavenplus</groupId>
					<artifactId>gmavenplus-plugin</artifactId>
					<version>1.5</version>
				</plugin>
				<plugin>
					<groupId>org.codehaus.mojo</groupId>
					<artifactId>sonar-maven-plugin</artifactId>
					<version>3.3.0.603</version>
				</plugin>
				<!--This plugin's configuration is used to store Eclipse m2e settings
					only. It has no influence on the Maven build itself. -->
				<plugin>
					<groupId>org.eclipse.m2e</groupId>
					<artifactId>lifecycle-mapping</artifactId>
					<version>1.0.0</version>
					<configuration>
						<lifecycleMappingMetadata>
							<pluginExecutions>
								<pluginExecution>
									<pluginExecutionFilter>
										<groupId>org.basepom.maven</groupId>
										<artifactId>duplicate-finder-maven-plugin</artifactId>
										<versionRange>[1,2)</versionRange>
										<goals>
											<goal>check</goal>
										</goals>
									</pluginExecutionFilter>
									<action>
										<ignore />
									</action>
								</pluginExecution>
								<pluginExecution>
									<pluginExecutionFilter>
										<groupId>
											org.apache.maven.plugins
										</groupId>
										<artifactId>
											maven-enforcer-plugin
										</artifactId>
										<versionRange>
											[1.3.1,)
										</versionRange>
										<goals>
											<goal>enforce</goal>
										</goals>
									</pluginExecutionFilter>
									<action>
										<ignore />
									</action>
								</pluginExecution>
								<pluginExecution>
									<pluginExecutionFilter>
										<groupId>
											org.apache.maven.plugins
										</groupId>
										<artifactId>
											maven-dependency-plugin
										</artifactId>
										<versionRange>
											[2.8,)
										</versionRange>
										<goals>
											<goal>copy</goal>
										</goals>
									</pluginExecutionFilter>
									<action>
										<ignore />
									</action>
								</pluginExecution>
								<pluginExecution>
									<pluginExecutionFilter>
										<groupId>
											org.apache.maven.plugins
										</groupId>
										<artifactId>
											maven-plugin-plugin
										</artifactId>
										<versionRange>
											[3.2,)
										</versionRange>
										<goals>
											<goal>descriptor</goal>
											<goal>helpmojo</goal>
										</goals>
									</pluginExecutionFilter>
									<action>
										<ignore />
									</action>
								</pluginExecution>
								<pluginExecution>
									<pluginExecutionFilter>
										<groupId>
											org.codehaus.mojo
										</groupId>
										<artifactId>
											build-helper-maven-plugin
										</artifactId>
										<versionRange>
											[1.9.1,)
										</versionRange>
										<goals>
											<goal>
												reserve-network-port
											</goal>
										</goals>
									</pluginExecutionFilter>
									<action>
										<ignore />
									</action>
								</pluginExecution>
								<pluginExecution>
									<pluginExecutionFilter>
										<groupId>
											org.apache.maven.plugins
										</groupId>
										<artifactId>
											maven-checkstyle-plugin
										</artifactId>
										<versionRange>
											[2.16,)
										</versionRange>
										<goals>
											<goal>
												check
											</goal>
										</goals>
									</pluginExecutionFilter>
									<action>
										<ignore />
									</action>
								</pluginExecution>
								<pluginExecution>
									<pluginExecutionFilter>
										<groupId>
											org.apache.maven.plugins
										</groupId>
										<artifactId>
											maven-invoker-plugin
										</artifactId>
										<versionRange>
											[1.0.0,)
										</versionRange>
										<goals>
											<goal>
												install
											</goal>
										</goals>
									</pluginExecutionFilter>
									<action>
										<ignore />
									</action>
								</pluginExecution>
								<pluginExecution>
									<pluginExecutionFilter>
										<groupId>
											org.codehaus.mojo
										</groupId>
										<artifactId>
											flatten-maven-plugin
										</artifactId>
										<versionRange>
											[1.0.0,)
										</versionRange>
										<goals>
											<goal>flatten</goal>
										</goals>
									</pluginExecutionFilter>
									<action>
										<ignore></ignore>
									</action>
								</pluginExecution>
							</pluginExecutions>
						</lifecycleMappingMetadata>
					</configuration>
				</plugin>
			</plugins>
		</pluginManagement>
		<plugins>
			<plugin>
				<groupId>org.codehaus.mojo</groupId>
				<artifactId>build-helper-maven-plugin</artifactId>
				<executions>
					<execution>
						<id>regex-property</id>
						<goals>
							<goal>regex-property</goal>
						</goals>
						<configuration>
							<name>modulename</name>
							<value>${project.artifactId}</value>
							<regex>-</regex>
							<replacement>.</replacement>
							<failIfNoMatch>true</failIfNoMatch>
						</configuration>
					</execution>
				</executions>
			</plugin>
			<plugin>
				<groupId>org.codehaus.mojo</groupId>
				<artifactId>flatten-maven-plugin</artifactId>
				<inherited>true</inherited>
				<executions>
					<execution>
						<!-- Tidy up all POMs before they are published -->
						<id>flatten</id>
						<phase>process-resources</phase>
						<goals>
							<goal>flatten</goal>
						</goals>
						<configuration>
							<updatePomFile>true</updatePomFile>
							<flattenMode>oss</flattenMode>
							<pomElements>
								<parent>expand</parent>
								<distributionManagement>remove</distributionManagement>
								<repositories>remove</repositories>
							</pomElements>
						</configuration>
					</execution>
				</executions>
			</plugin>
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-compiler-plugin</artifactId>
				<configuration>
					<source>${java.version}</source>
					<target>${java.version}</target>
					<parameters>true</parameters>
				</configuration>
			</plugin>
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-enforcer-plugin</artifactId>
				<executions>
					<execution>
						<id>enforce-rules</id>
						<goals>
							<goal>enforce</goal>
						</goals>
						<configuration>
							<rules>
								<requireJavaVersion>
									<version>[1.8,)</version>
								</requireJavaVersion>
								<requireMavenVersion>
									<version>[3.5.0,)</version>
								</requireMavenVersion>
								<requireProperty>
									<property>main.basedir</property>
								</requireProperty>
								<requireProperty>
									<property>project.name</property>
								</requireProperty>
								<requireProperty>
									<property>project.description</property>
								</requireProperty>
								<requireReleaseDeps>
									<onlyWhenRelease>true</onlyWhenRelease>
								</requireReleaseDeps>
							</rules>
							<fail>true</fail>
						</configuration>
					</execution>
				</executions>
			</plugin>
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-jar-plugin</artifactId>
				<configuration>
					<archive>
						<addMavenDescriptor>false</addMavenDescriptor>
						<manifest>
							<addDefaultImplementationEntries>false</addDefaultImplementationEntries>
							<addDefaultSpecificationEntries>false</addDefaultSpecificationEntries>
						</manifest>
						<manifestEntries>
							<Implementation-Title>${project.name}</Implementation-Title>
							<Automatic-Module-Name>${modulename}</Automatic-Module-Name>
							<Implementation-Version>${project.version}</Implementation-Version>
							<Built-By>Spring</Built-By>
						</manifestEntries>
					</archive>
				</configuration>
			</plugin>
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-surefire-plugin</artifactId>
				<configuration>
					<includes>
						<include>**/*Tests.java</include>
					</includes>
					<excludes>
						<exclude>**/Abstract*.java</exclude>
					</excludes>
					<systemPropertyVariables>
						<java.security.egd>file:/dev/./urandom</java.security.egd>
						<java.awt.headless>true</java.awt.headless>
					</systemPropertyVariables>
					<argLine>-Xmx1024m</argLine>
					<trimStackTrace>false</trimStackTrace>
					<redirectTestOutputToFile>true</redirectTestOutputToFile>
					<runOrder>alphabetical</runOrder>
				</configuration>
			</plugin>
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-war-plugin</artifactId>
			</plugin>
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-source-plugin</artifactId>
				<executions>
					<execution>
						<id>attach-sources</id>
						<goals>
							<goal>jar-no-fork</goal>
						</goals>
					</execution>
				</executions>
			</plugin>
		</plugins>
	</build>
	<profiles>
		<profile>
			<id>fast</id>
			<activation>
				<property>
					<name>fast</name>
				</property>
			</activation>
			<properties>
				<disable.checks>true</disable.checks>
			</properties>
		</profile>
		<profile>
			<id>full</id>
			<activation>
				<property>
					<name>full</name>
				</property>
			</activation>
			<build>
				<plugins>
					<plugin>
						<groupId>org.apache.maven.plugins</groupId>
						<artifactId>maven-javadoc-plugin</artifactId>
						<executions>
							<execution>
								<id>attach-javadocs</id>
								<goals>
									<goal>jar</goal>
								</goals>
								<inherited>true</inherited>
							</execution>
						</executions>
						<dependencies>
							<dependency>
								<groupId>org.apache.commons</groupId>
								<artifactId>commons-lang3</artifactId>
								<version>3.7</version>
							</dependency>
						</dependencies>
					</plugin>
				</plugins>
			</build>
		</profile>
		<profile>
			<id>eclipse.profile</id>
			<activation>
				<property>
					<name>m2e.version</name>
				</property>
			</activation>
			<properties>
				<m2e.jaxrs.activation>false</m2e.jaxrs.activation>
				<m2e.jpa.activation>false</m2e.jpa.activation>
				<m2e.jsf.activation>false</m2e.jsf.activation>
				<m2e.cdi.activation>false</m2e.cdi.activation>
			</properties>
		</profile>
		<profile>
			<id>java9</id>
			<activation>
				<jdk>[9,)</jdk>
			</activation>
			<build>
				<plugins>
					<plugin>
						<groupId>org.apache.maven.plugins</groupId>
						<artifactId>maven-surefire-plugin</artifactId>
						<configuration>
							<argLine>--add-modules java.base,java.xml.bind</argLine>
						</configuration>
					</plugin>
				</plugins>
			</build>
		</profile>
		<profile>
			<id>java10</id>
			<activation>
				<jdk>10</jdk>
			</activation>
			<properties>
				<maven-failsafe-plugin.version>2.21.0</maven-failsafe-plugin.version>
				<maven-site-plugin.version>3.7</maven-site-plugin.version>
				<maven-surefire-plugin.version>2.21.0</maven-surefire-plugin.version>
			</properties>
		</profile>
	</profiles>
</project>

redpajama_set_name: RedPajamaGithub


text:
package org.gluu.oxauth.service.external.context;

import org.gluu.model.custom.script.conf.CustomScriptConfiguration;
import org.gluu.oxauth.model.jwt.Jwt;
import org.json.JSONObject;

import javax.servlet.http.HttpServletRequest;

/**
 * @author Yuriy Zabrovarnyy
 */
public class DynamicClientRegistrationContext extends ExternalScriptContext {

    private CustomScriptConfiguration script;
    private JSONObject registerRequest;
    private Jwt softwareStatement;

    public DynamicClientRegistrationContext(HttpServletRequest httpRequest, JSONObject registerRequest, CustomScriptConfiguration script) {
        super(httpRequest);
        this.script = script;
        this.registerRequest = registerRequest;
    }

    public Jwt getSoftwareStatement() {
        return softwareStatement;
    }

    public void setSoftwareStatement(Jwt softwareStatement) {
        this.softwareStatement = softwareStatement;
    }

    public CustomScriptConfiguration getScript() {
        return script;
    }

    public void setScript(CustomScriptConfiguration script) {
        this.script = script;
    }

    public JSONObject getRegisterRequest() {
        return registerRequest;
    }

    public void setRegisterRequest(JSONObject registerRequest) {
        this.registerRequest = registerRequest;
    }

    @Override
    public String toString() {
        return "DynamicClientRegistrationContext{" +
                "softwareStatement=" + softwareStatement +
                "registerRequest=" + registerRequest +
                "script=" + script +
                "} " + super.toString();
    }
}


text:
package org.apache.beam.runners.direct;

import static org.hamcrest.Matchers.containsInAnyOrder;
import static org.hamcrest.Matchers.equalTo;
import static org.hamcrest.Matchers.not;
import static org.hamcrest.Matchers.nullValue;
import static org.junit.Assert.assertThat;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;

import java.io.Serializable;
import org.apache.beam.runners.direct.DirectRunner.CommittedBundle;
import org.apache.beam.runners.direct.DirectRunner.UncommittedBundle;
import org.apache.beam.runners.direct.WatermarkManager.TimerUpdate;
import org.apache.beam.sdk.coders.StringUtf8Coder;
import org.apache.beam.sdk.testing.TestPipeline;
import org.apache.beam.sdk.transforms.Create;
import org.apache.beam.sdk.transforms.OldDoFn;
import org.apache.beam.sdk.transforms.ParDo;
import org.apache.beam.sdk.transforms.windowing.BoundedWindow;
import org.apache.beam.sdk.transforms.windowing.GlobalWindow;
import org.apache.beam.sdk.transforms.windowing.IntervalWindow;
import org.apache.beam.sdk.transforms.windowing.OutputTimeFns;
import org.apache.beam.sdk.transforms.windowing.PaneInfo;
import org.apache.beam.sdk.util.TimeDomain;
import org.apache.beam.sdk.util.TimerInternals.TimerData;
import org.apache.beam.sdk.util.WindowedValue;
import org.apache.beam.sdk.util.state.BagState;
import org.apache.beam.sdk.util.state.StateNamespace;
import org.apache.beam.sdk.util.state.StateNamespaces;
import org.apache.beam.sdk.util.state.StateTag;
import org.apache.beam.sdk.util.state.StateTags;
import org.apache.beam.sdk.util.state.WatermarkHoldState;
import org.apache.beam.sdk.values.KV;
import org.apache.beam.sdk.values.PCollection;
import org.apache.beam.sdk.values.TupleTag;
import org.hamcrest.Matchers;
import org.joda.time.Duration;
import org.joda.time.Instant;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;

/**
 * Tests for {@link ParDoSingleEvaluatorFactory}.
 */
@RunWith(JUnit4.class)
public class ParDoSingleEvaluatorFactoryTest implements Serializable {
  private transient BundleFactory bundleFactory = ImmutableListBundleFactory.create();

  @Test
  public void testParDoInMemoryTransformEvaluator() throws Exception {
    TestPipeline p = TestPipeline.create();

    PCollection<String> input = p.apply(Create.of("foo", "bara", "bazam"));
    PCollection<Integer> collection =
        input.apply(
            ParDo.of(
                new OldDoFn<String, Integer>() {
                  @Override
                  public void processElement(ProcessContext c) {
                    c.output(c.element().length());
                  }
                }));
    CommittedBundle<String> inputBundle =
        bundleFactory.createBundle(input).commit(Instant.now());

    EvaluationContext evaluationContext = mock(EvaluationContext.class);
    UncommittedBundle<Integer> outputBundle = bundleFactory.createBundle(collection);
    when(evaluationContext.createBundle(collection)).thenReturn(outputBundle);
    DirectExecutionContext executionContext =
        new DirectExecutionContext(null, null, null, null);
    when(evaluationContext.getExecutionContext(collection.getProducingTransformInternal(),
        inputBundle.getKey())).thenReturn(executionContext);
    AggregatorContainer container = AggregatorContainer.create();
    AggregatorContainer.Mutator mutator = container.createMutator();
    when(evaluationContext.getAggregatorContainer()).thenReturn(container);
    when(evaluationContext.getAggregatorMutator()).thenReturn(mutator);

    org.apache.beam.runners.direct.TransformEvaluator<String> evaluator =
        new ParDoSingleEvaluatorFactory(evaluationContext)
            .forApplication(
                collection.getProducingTransformInternal(), inputBundle);

    evaluator.processElement(WindowedValue.valueInGlobalWindow("foo"));
    evaluator.processElement(
        WindowedValue.timestampedValueInGlobalWindow("bara", new Instant(1000)));
    evaluator.processElement(
        WindowedValue.valueInGlobalWindow("bazam", PaneInfo.ON_TIME_AND_ONLY_FIRING));

    TransformResult result = evaluator.finishBundle();
    assertThat(result.getOutputBundles(), Matchers.<UncommittedBundle<?>>contains(outputBundle));
    assertThat(result.getWatermarkHold(), equalTo(BoundedWindow.TIMESTAMP_MAX_VALUE));
    assertThat(result.getAggregatorChanges(), equalTo(mutator));

    assertThat(
        outputBundle.commit(Instant.now()).getElements(),
        Matchers.<WindowedValue<Integer>>containsInAnyOrder(
            WindowedValue.valueInGlobalWindow(3),
            WindowedValue.timestampedValueInGlobalWindow(4, new Instant(1000)),
            WindowedValue.valueInGlobalWindow(5, PaneInfo.ON_TIME_AND_ONLY_FIRING)));
  }

  @Test
  public void testSideOutputToUndeclaredSideOutputSucceeds() throws Exception {
    TestPipeline p = TestPipeline.create();

    PCollection<String> input = p.apply(Create.of("foo", "bara", "bazam"));
    final TupleTag<Integer> sideOutputTag = new TupleTag<Integer>() {};
    PCollection<Integer> collection =
        input.apply(
            ParDo.of(
                new OldDoFn<String, Integer>() {
                  @Override
                  public void processElement(ProcessContext c) {
                    c.sideOutput(sideOutputTag, c.element().length());
                  }
                }));
    CommittedBundle<String> inputBundle =
        bundleFactory.createBundle(input).commit(Instant.now());

    EvaluationContext evaluationContext = mock(EvaluationContext.class);
    UncommittedBundle<Integer> outputBundle = bundleFactory.createBundle(collection);
    when(evaluationContext.createBundle(collection)).thenReturn(outputBundle);
    DirectExecutionContext executionContext =
        new DirectExecutionContext(null, null, null, null);
    when(evaluationContext.getExecutionContext(collection.getProducingTransformInternal(),
        inputBundle.getKey())).thenReturn(executionContext);
    AggregatorContainer container = AggregatorContainer.create();
    AggregatorContainer.Mutator mutator = container.createMutator();
    when(evaluationContext.getAggregatorContainer()).thenReturn(container);
    when(evaluationContext.getAggregatorMutator()).thenReturn(mutator);

    TransformEvaluator<String> evaluator =
        new ParDoSingleEvaluatorFactory(evaluationContext)
            .forApplication(
                collection.getProducingTransformInternal(), inputBundle);

    evaluator.processElement(WindowedValue.valueInGlobalWindow("foo"));
    evaluator.processElement(
        WindowedValue.timestampedValueInGlobalWindow("bara", new Instant(1000)));
    evaluator.processElement(
        WindowedValue.valueInGlobalWindow("bazam", PaneInfo.ON_TIME_AND_ONLY_FIRING));

    TransformResult result = evaluator.finishBundle();
    assertThat(
        result.getOutputBundles(), Matchers.<UncommittedBundle<?>>containsInAnyOrder(outputBundle));
    assertThat(result.getWatermarkHold(), equalTo(BoundedWindow.TIMESTAMP_MAX_VALUE));
    assertThat(result.getAggregatorChanges(), equalTo(mutator));
  }

  @Test
  public void finishBundleWithStatePutsStateInResult() throws Exception {
    TestPipeline p = TestPipeline.create();

    PCollection<String> input = p.apply(Create.of("foo", "bara", "bazam"));

    final StateTag<Object, WatermarkHoldState<BoundedWindow>> watermarkTag =
        StateTags.watermarkStateInternal("myId", OutputTimeFns.outputAtEarliestInputTimestamp());
    final StateTag<Object, BagState<String>> bagTag = StateTags.bag("myBag", StringUtf8Coder.of());
    final StateNamespace windowNs =
        StateNamespaces.window(GlobalWindow.Coder.INSTANCE, GlobalWindow.INSTANCE);
    ParDo.Bound<String, KV<String, Integer>> pardo =
        ParDo.of(
            new OldDoFn<String, KV<String, Integer>>() {
              @Override
              public void processElement(ProcessContext c) {
                c.windowingInternals()
                    .stateInternals()
                    .state(StateNamespaces.global(), watermarkTag)
                    .add(new Instant(124443L - c.element().length()));
                c.windowingInternals()
                    .stateInternals()
                    .state(
                        StateNamespaces.window(GlobalWindow.Coder.INSTANCE, GlobalWindow.INSTANCE),
                        bagTag)
                    .add(c.element());
              }
            });
    PCollection<KV<String, Integer>> mainOutput = input.apply(pardo);

    CommittedBundle<String> inputBundle =
        bundleFactory.createBundle(input).commit(Instant.now());

    EvaluationContext evaluationContext = mock(EvaluationContext.class);
    UncommittedBundle<KV<String, Integer>> mainOutputBundle =
        bundleFactory.createBundle(mainOutput);

    when(evaluationContext.createBundle(mainOutput)).thenReturn(mainOutputBundle);

    DirectExecutionContext executionContext = new DirectExecutionContext(null,
        StructuralKey.of("myKey", StringUtf8Coder.of()),
        null, null);
    when(evaluationContext.getExecutionContext(mainOutput.getProducingTransformInternal(),
        inputBundle.getKey()))
        .thenReturn(executionContext);
    AggregatorContainer container = AggregatorContainer.create();
    AggregatorContainer.Mutator mutator = container.createMutator();
    when(evaluationContext.getAggregatorContainer()).thenReturn(container);
    when(evaluationContext.getAggregatorMutator()).thenReturn(mutator);

    org.apache.beam.runners.direct.TransformEvaluator<String> evaluator =
        new ParDoSingleEvaluatorFactory(evaluationContext)
            .forApplication(
                mainOutput.getProducingTransformInternal(), inputBundle);

    evaluator.processElement(WindowedValue.valueInGlobalWindow("foo"));
    evaluator.processElement(
        WindowedValue.timestampedValueInGlobalWindow("bara", new Instant(1000)));
    evaluator.processElement(
        WindowedValue.valueInGlobalWindow("bazam", PaneInfo.ON_TIME_AND_ONLY_FIRING));

    TransformResult result = evaluator.finishBundle();
    assertThat(result.getWatermarkHold(), equalTo(new Instant(124438L)));
    assertThat(result.getState(), not(nullValue()));
    assertThat(
        result.getState().state(StateNamespaces.global(), watermarkTag).read(),
        equalTo(new Instant(124438L)));
    assertThat(
        result.getState().state(windowNs, bagTag).read(),
        containsInAnyOrder("foo", "bara", "bazam"));
  }

  @Test
  public void finishBundleWithStateAndTimersPutsTimersInResult() throws Exception {
    TestPipeline p = TestPipeline.create();

    PCollection<String> input = p.apply(Create.of("foo", "bara", "bazam"));

    final TimerData addedTimer =
        TimerData.of(
            StateNamespaces.window(
                IntervalWindow.getCoder(),
                new IntervalWindow(
                    new Instant(0).plus(Duration.standardMinutes(5)),
                    new Instant(1)
                        .plus(Duration.standardMinutes(5))
                        .plus(Duration.standardHours(1)))),
            new Instant(54541L),
            TimeDomain.EVENT_TIME);
    final TimerData deletedTimer =
        TimerData.of(
            StateNamespaces.window(
                IntervalWindow.getCoder(),
                new IntervalWindow(new Instant(0), new Instant(0).plus(Duration.standardHours(1)))),
            new Instant(3400000),
            TimeDomain.SYNCHRONIZED_PROCESSING_TIME);

    ParDo.Bound<String, KV<String, Integer>> pardo =
        ParDo.of(
            new OldDoFn<String, KV<String, Integer>>() {
              @Override
              public void processElement(ProcessContext c) {
                c.windowingInternals().stateInternals();
                c.windowingInternals()
                    .timerInternals()
                    .setTimer(
                        TimerData.of(
                            StateNamespaces.window(
                                IntervalWindow.getCoder(),
                                new IntervalWindow(
                                    new Instant(0).plus(Duration.standardMinutes(5)),
                                    new Instant(1)
                                        .plus(Duration.standardMinutes(5))
                                        .plus(Duration.standardHours(1)))),
                            new Instant(54541L),
                            TimeDomain.EVENT_TIME));
                c.windowingInternals()
                    .timerInternals()
                    .deleteTimer(
                        TimerData.of(
                            StateNamespaces.window(
                                IntervalWindow.getCoder(),
                                new IntervalWindow(
                                    new Instant(0),
                                    new Instant(0).plus(Duration.standardHours(1)))),
                            new Instant(3400000),
                            TimeDomain.SYNCHRONIZED_PROCESSING_TIME));
              }
            });
    PCollection<KV<String, Integer>> mainOutput = input.apply(pardo);

    StructuralKey<?> key = StructuralKey.of("myKey", StringUtf8Coder.of());
    CommittedBundle<String> inputBundle =
        bundleFactory.createBundle(input).commit(Instant.now());

    EvaluationContext evaluationContext = mock(EvaluationContext.class);
    UncommittedBundle<KV<String, Integer>> mainOutputBundle =
        bundleFactory.createBundle(mainOutput);

    when(evaluationContext.createBundle(mainOutput)).thenReturn(mainOutputBundle);

    DirectExecutionContext executionContext = new DirectExecutionContext(null,
        key,
        null,
        null);
    when(evaluationContext.getExecutionContext(mainOutput.getProducingTransformInternal(),
        inputBundle.getKey()))
        .thenReturn(executionContext);
    AggregatorContainer container = AggregatorContainer.create();
    AggregatorContainer.Mutator mutator = container.createMutator();
    when(evaluationContext.getAggregatorContainer()).thenReturn(container);
    when(evaluationContext.getAggregatorMutator()).thenReturn(mutator);

    TransformEvaluator<String> evaluator =
        new ParDoSingleEvaluatorFactory(evaluationContext)
            .forApplication(
                mainOutput.getProducingTransformInternal(), inputBundle);

    evaluator.processElement(WindowedValue.valueInGlobalWindow("foo"));

    TransformResult result = evaluator.finishBundle();
    assertThat(result.getTimerUpdate(),
        equalTo(TimerUpdate.builder(StructuralKey.of("myKey", StringUtf8Coder.of()))
            .setTimer(addedTimer)
            .deletedTimer(deletedTimer)
            .build()));
  }
}


text:
package org.inaetics.dronessimulator.gameengine.ruleprocessors.rules.teamplay;

import org.inaetics.dronessimulator.common.protocol.EntityType;
import org.inaetics.dronessimulator.gameengine.common.state.Drone;
import org.inaetics.dronessimulator.gameengine.common.state.GameEntity;
import org.inaetics.dronessimulator.gameengine.identifiermapper.IdentifierMapper;
import org.inaetics.dronessimulator.gameengine.ruleprocessors.rules.AbstractGameFinishedRule;

import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;

public class TeamplayGameFinished extends AbstractGameFinishedRule {
    private Map<String, Long> dronesPerTeam;

    private static final org.apache.log4j.Logger log = org.apache.log4j.Logger.getLogger(TeamplayGameFinished.class);

    public TeamplayGameFinished(IdentifierMapper idMapper) {
        super(idMapper);
    }

    @Override
    protected boolean gameIsFinished(List<GameEntity> currentState) {
        dronesPerTeam = currentState.stream().filter(gameEntity -> EntityType.DRONE.equals(gameEntity.getType())).map(gameEntity -> ((Drone) gameEntity))
                .filter(drone -> drone.getHp() > 0).collect(Collectors.groupingBy(
                        Drone::getTeamname, Collectors.counting()
                ));
        log.info("Checking winconditions for teamplay. This is the current map: " + Arrays.toString(dronesPerTeam.entrySet().toArray()));
        return dronesPerTeam.size() == 1;
    }

    @Override
    protected String getWinner() {
        return dronesPerTeam.keySet().iterator().next();
    }
}


text:
from noteProcessors.continuousNoteProcessor.constants import Constants
from noteProcessors.continuousNoteProcessor.message import Message, MessageType, NewNoteMessage
import utils

# ColumnProcessor operates on the data of its manager.
# A few columns would be selected to process based on the frequency of the note assigned to this processor.

# Having access to the manager's buffer of data, this class operates on the data buffer sort of like an assembly line.
# At certain buffer indices, data is being processed and prepped for future operations.
class ColumnProcessor:
	def __init__(self, note, sampleRate, samplesPerFrame, modifiedFrequency, maxHarmonic, manager):
		self.note = note # Note this processor is associated with
		self.maxHarmonic = maxHarmonic # Maximum harmonic processor will look for

		self.centerIndex = int(round(modifiedFrequency * samplesPerFrame / sampleRate)) # Index frequency is centered on
		self.firstIndex = self.centerIndex - int(Constants.COLUMN_PROCESSOR_DATA_WIDTH / 2)	# First and last frequency index the processor operates on
		self.lastIndex = self.centerIndex + int(Constants.COLUMN_PROCESSOR_DATA_WIDTH / 2)

		self.peakIndex = 0 # row index a peak was detected at
		self.preNoteOffset = 0 # index offset of the start of the note from peak
		self.peakValue = 0 # Value of peak
		self.maxValue = 0 # maximum value detected since the first peak
		self.preNoteValue = 0 # value before the note is detected
		self.offTuneIndex = 0 # If the note is offtune, this is the shift from the origina firstIndex and lastIndex
		self.manager = manager # The manager where data comes from
		self.previousLoudness = 0 # loudness of the previous note detected using this processor
		self.processingIndex = 0 # Current row index that is being processed.
		self.maxFrequencyIndex = len(self.manager.data[0])

	# Resets all data relating to the peak value.
	def resetPeak(self):
		self.firstIndex -= self.offTuneIndex
		self.lastIndex -= self.offTuneIndex
		if self.offTuneIndex != 0:
			if self.offTuneIndex < 0:
				for i in range(self.lastIndex + self.offTuneIndex + 1, self.lastIndex + 1):
					self.propagateUpColumn(i)
			else:
				for i in range(self.firstIndex, self.firstIndex + self.offTuneIndex):
					self.propagateUpColumn(i)

		self.preNoteOffset = 0
		self.peakIndex = 0
		self.peakValue = 0
		self.maxValue = 0
		self.preNoteValue = 0
		self.offTuneIndex = 0

	# This function is vaguely based on Jenks Natural Breaks Optimization.
	# We make many simplifications here:
	# 1. There are always 3 classes: the pre-note class, the note class, and the post-note class.
	# 2. The pre-note end index will be one of the first 3 values, since having arrived at this stage in the
	# code implies that the peak is within the first 3 values.
	# 3. An exhaustive search will then be made to find the start index of the post-note class.
	# arr is input array
	# Indices is start index of each class/group
	def getNaturalBreaks(self, arr):
		minVariance = -1
		preNoteIndex = 0
		middleIndex = max(4, int(len(arr) / 2))
		for i in range(0, 3):
			var1 = utils.getVariance(arr[0 : i + 1])
			var2 = utils.getVariance(arr[i + 1: middleIndex])
			if var2 + var1 < minVariance or minVariance < 0:
				minVariance = var1 + var2
				preNoteIndex = i + 1

		minVariance = -1
		postNoteIndex = 0
		for i in range(preNoteIndex, len(arr) - 1):
			var1 = utils.getVariance(arr[preNoteIndex : i + 1])
			var2 = utils.getVariance(arr[i + 1: len(arr)])
			if var2 + var1 < minVariance or minVariance < 0:
				minVariance = var1 + var2
				postNoteIndex = i + 1
		return preNoteIndex, postNoteIndex

	# This is very expensive but is acceptable since it processes on each real note.
	def getMoreAccurateIndices(self, startIndex, endIndex):
		sums = []
		for i in range(startIndex - 1, endIndex + 2):
			sums.append(sum(self.manager.data[i][self.firstIndex: self.lastIndex + 1]))
		indices = self.getNaturalBreaks(sums)
		return indices[0] + startIndex - 1, indices[1] + startIndex - 1

	def getNoteMessage(self, startIndex, endIndex):
		if endIndex - startIndex < Constants.MINIMAL_NOTE_LENGTH:	# Too short note implies anomoly.
			self.resetPeak()
			return Message(MessageType.NO_EVENT)
		else:
			startIndex, endIndex = self.getMoreAccurateIndices(startIndex, endIndex)
			if endIndex - startIndex < Constants.MINIMAL_NOTE_LENGTH:	# Seems redudant but doing this saves a lot of time
				self.resetPeak()
				return Message(MessageType.NO_EVENT)

			# Absolute loudness is the sum of all values in the current rectangle described by startIndex, endIndex,
			# firstIndex, and lastIndex, divided by the number of rows.
			absoluteLoudness = sum([
				sum(
					[self.manager.data[r][c] for c in range(self.firstIndex, self.lastIndex + 1)]
				) for r in range(startIndex, endIndex)
			]) / (endIndex - startIndex)

			# Add in magnitudes from harmonics
			originalCenter = (self.firstIndex + self.lastIndex) / 2
			for h in range(2, self.maxHarmonic + 1):
				centerIndex = int(originalCenter * h)
				if centerIndex >= self.maxFrequencyIndex:
					break
				firstIndex = centerIndex - int(Constants.COLUMN_PROCESSOR_DATA_WIDTH / 2)
				lastIndex = centerIndex + int(Constants.COLUMN_PROCESSOR_DATA_WIDTH / 2)
				for i in range(firstIndex, lastIndex + 1):
					self.propagateUpColumn(i)
				harmonicLoudness = sum([
					sum(
						[self.manager.data[r][c] for c in range(firstIndex, lastIndex + 1)]
					) for r in range(startIndex, endIndex)
				]) / (endIndex - startIndex)
				absoluteLoudness += harmonicLoudness
			self.resetPeak()
			# Update the preciousLoudness if this loudness is greater or similar in value
			if absoluteLoudness > self.previousLoudness or utils.percentDiff(absoluteLoudness, self.previousLoudness) < 0.3:
				self.previousLoudness = absoluteLoudness
			return NewNoteMessage(startIndex, endIndex, self.note, absoluteLoudness, self.centerIndex + self.offTuneIndex)

	# Sum a column
	def getColumnSum(self, columnIndex, propagateColumn=False):
		if propagateColumn:
			self.propagateUpColumn(columnIndex)
		return sum([self.manager.data[i][columnIndex] for i in range(self.peakIndex, self.processingIndex + 1)])

	# get the column sums at firstIndex and lastIndex
	def getSideColumnSums(self):
		leftColumnSum = self.getColumnSum(self.firstIndex)
		rightColumnSum = self.getColumnSum(self.lastIndex)
		return leftColumnSum, rightColumnSum

	# This function is called on a column if we want to erase the column's value and use interpolated values instead.
	# Should only be callued if the column is full of 0's
	def interpolateColumn(self, columnIndex):
		index = self.peakIndex
		for index in range(self.peakIndex, self.processingIndex):
			self.manager.data[index][columnIndex] = (self.manager.data[index][columnIndex - 1] + self.manager.data[index][columnIndex + 1]) / 2

		# We search down here
		index = self.processingIndex
		while index != Constants.MAX_BUFFER_SIZE:
			# We interpolate past the current processingIndex until the values become non-zero, indicating the values have
			# become normal again
			if self.manager.data[index][columnIndex] == 0:
				if self.manager.data[index][columnIndex - 1] > 0 and self.manager.data[index][columnIndex - 1] > 0:
					self.manager.data[index][columnIndex] = (self.manager.data[index][columnIndex - 1] + self.manager.data[index][columnIndex + 1]) / 2
				else:
					break
			else:
				break
			index += 1

	# Attempts to detect a note's offtune amount and shift the firstIndex and lastIndex accordingly.
	# The function will check the column left of firstIndex and compare with column at lastIndex.
	# A swap is made if it is greater, indicating the center of the note is likely to the left.
	# Logic repeated with lastIndex
	def tryOfftuneShift(self):
		shiftIndex = 0
		# Try left shift first
		rightColumnSum = self.getColumnSum(self.lastIndex)
		leftOverColumnSum = self.getColumnSum(self.firstIndex - 1, True)
		while leftOverColumnSum > rightColumnSum or leftOverColumnSum == 0:
			if leftOverColumnSum == 0:
				self.interpolateColumn(self.firstIndex - 1)
				leftOverColumnSum = self.getColumnSum(self.firstIndex - 1)
			if leftOverColumnSum - rightColumnSum > 0:
				shiftIndex -= 1
				self.firstIndex -= 1
				self.lastIndex -= 1
			else:
				break
			leftOverColumnSum = self.getColumnSum(self.firstIndex - 1, True)
			rightColumnSum = self.getColumnSum(self.lastIndex)
		if shiftIndex != 0:
			self.offTuneIndex += shiftIndex
			return True
		# Try right shift if not left shift
		leftColumnSum = self.getColumnSum(self.firstIndex)
		rightOverColumnSum = self.getColumnSum(self.lastIndex + 1, True)
		while rightOverColumnSum > leftColumnSum or rightOverColumnSum == 0:
			if rightOverColumnSum == 0:
				self.interpolateColumn(self.lastIndex + 1)
				rightOverColumnSum = self.getColumnSum(self.lastIndex + 1)
			if rightOverColumnSum - leftColumnSum > 0:
				shiftIndex += 1
				self.firstIndex += 1
				self.lastIndex += 1
			else:
				break
			rightOverColumnSum = self.getColumnSum(self.lastIndex + 1, True)
			leftColumnSum = self.getColumnSum(self.firstIndex)
		if shiftIndex != 0:
			self.offTuneIndex += shiftIndex
			return True
		return False

	# Checks if offtune shift is now too far from ideal frequency
	def checkNoteShift(self):
		if utils.percentDiff((self.firstIndex + self.lastIndex) / 2, self.centerIndex) > 0.02:
			return True
		return False

	# Checks if the currentSum dominates referenceSum
	def checkPeak(self, currentSum, referenceSum):
		if currentSum - referenceSum > self.manager.runningMaximum / 10 * Constants.COLUMN_PROCESSOR_DATA_WIDTH:
			if utils.percentDiff(currentSum, referenceSum) > 3:
				return True
		return False

	# Propagates negative values in the current row up the columns
	# The negative number will be pushed up, neutralising (sum to 0) values until it becomes 0.
	def propagateUpNegativeRow(self):

		for j in range(self.firstIndex, self.lastIndex + 1):
			if self.manager.data[self.processingIndex][j] < 0:	# Propagate negative number up
				rIndex = self.processingIndex
				while rIndex > 0:
					rIndex -= 1
					if self.manager.data[rIndex][j] > -self.manager.data[self.processingIndex][j]:
						self.manager.data[rIndex][j] += self.manager.data[self.processingIndex][j]
						self.manager.data[self.processingIndex][j] = 0
						break
					else:
						self.manager.data[self.processingIndex][j] += self.manager.data[rIndex][j]
						self.manager.data[rIndex][j] = 0
				self.manager.data[self.processingIndex][j] = 0

	# Similar to propageUpNegativeRow, but column based.
	# Function will propagate up all negative values in the column
	def propagateUpColumn(self, columnIndex):
		dataIndex = Constants.MAX_BUFFER_SIZE
		negativeCollector = 0
		while dataIndex >= self.peakIndex - 3 - self.preNoteOffset:
			dataIndex -= 1
			if self.manager.data[dataIndex][columnIndex] < 0:	# Propagate negative number up
				negativeCollector += self.manager.data[dataIndex][columnIndex]
				self.manager.data[dataIndex][columnIndex] = 0
			else:
				if negativeCollector < 0:
					if self.manager.data[dataIndex][columnIndex] > -negativeCollector:
						self.manager.data[dataIndex][columnIndex] += negativeCollector
						negativeCollector = 0
					else:
						negativeCollector += self.manager.data[dataIndex][columnIndex]
						self.manager.data[dataIndex][columnIndex] = 0

	# Logic for detecting missed peaks. Under revision...
	def checkPossibleMissedPeak(self, currentSum, currentIndex):
		if self.checkPeak(currentSum, self.peakValue):
			if self.checkPeak(currentSum, sum(self.manager.data[currentIndex - 8][self.firstIndex: self.lastIndex + 1])):
				return True
		return False

	# This function accounts for the comb-like shapes that occur when two identical notes are present in the same frame
	# TODO: Really need to do more for these "eclipsed" shapes.
	# 1. Not really accounting for their harmonics. ie if some enough pixels are filled, harmonics are doubled.
	# 2. I dont really know if this approximation method is sufficient
	def fillComb(self):
		for j in range(self.firstIndex, self.lastIndex + 1):
			if self.manager.data[self.processingIndex][j] == 0:
				if self.manager.data[self.processingIndex][j - 1] > 0 and self.manager.data[self.processingIndex][j + 1] > 0:
					self.manager.data[self.processingIndex][j] = (self.manager.data[self.processingIndex][j - 1] + self.manager.data[self.processingIndex][j + 1]) / 2

	def processNewDataRow(self):
		# Manager class appends new data to deque so all relative indices are shifted down 1
		self.peakIndex -= 1
		# Buffer overflow. We would ideally have a longer buffer to account for longer notes. Currently we would have to discard this potential note.
		if self.peakIndex - self.preNoteOffset - 2 < 0:
			self.resetPeak()
			self.peakIndex -= 1
		# Propagate up the row upon data entry into buffer
		self.processingIndex = Constants.MAX_BUFFER_SIZE - 1
		self.propagateUpNegativeRow()
		# Further up the buffer, perform other processes...
		self.processingIndex = int(Constants.MAX_BUFFER_SIZE / 2)
		self.fillComb()

		row = self.manager.data[self.processingIndex][self.firstIndex: self.lastIndex + 1]
		initialSum = sum(row)
		referenceSum = sum(self.manager.data[self.processingIndex - 2][self.firstIndex: self.lastIndex + 1])
		# If there is no peak, look for a peak. Else look for the end of the peak.
		if self.peakIndex < 0:
			# Look for new peak
			if self.checkPeak(initialSum, referenceSum):
				self.preNoteValue = referenceSum
				self.peakIndex = self.processingIndex
				self.peakValue = initialSum
				self.maxValue = self.peakValue
		else:
			if initialSum > self.maxValue:
				self.maxValue = initialSum
			# Look for possible new peak, and end of peak.
			# Criteria would be different than looking for fresh peak

			# TODO: This logic is somewhat unstable because a fake peak could override a real one
			if initialSum > self.peakValue and utils.percentDiff(initialSum, self.peakValue) > 2:
				if self.checkPeak(initialSum, referenceSum):
					indexFromLastPeak = self.processingIndex - self.peakIndex
					# If the 2 peaks are close, we shift the peakIndex only.
					if indexFromLastPeak <= 2:
						self.preNoteOffset += indexFromLastPeak
					else:
						self.preNoteValue = referenceSum
					self.peakIndex = self.processingIndex
					self.peakValue = initialSum
			cutOff = self.maxValue / 10 + 9 * self.preNoteValue / 10
			# Being lower than cutOff suggests a potential end of note
			if initialSum < cutOff or utils.percentDiff(initialSum, cutOff) < 0.2:
				# Check if note is offtune, which implies a possible longer duration
				if self.tryOfftuneShift():
					# If the note is offTune by a noticeable amount, it is discarded.
					# It should have been caught by another processor in this case.
					if self.checkNoteShift():
						self.resetPeak()
						return Message(MessageType.NO_EVENT)
					self.peakValue = sum(self.manager.data[self.peakIndex][self.firstIndex: self.lastIndex + 1])
					self.preNoteValue = sum(self.manager.data[self.peakIndex - 2 - self.preNoteOffset][self.firstIndex: self.lastIndex + 1])	# TODO: Negative?
					# Check if it also satisfies note end after shift:
					cutOff = self.maxValue / 10 + 9 * self.preNoteValue / 10
					initialSum = sum(self.manager.data[self.processingIndex][self.firstIndex: self.lastIndex + 1])
					if initialSum < cutOff or utils.percentDiff(initialSum, cutOff) < 0.2:
						return self.getNoteMessage(self.peakIndex - self.preNoteOffset, self.processingIndex)
				else:
					return self.getNoteMessage(self.peakIndex - self.preNoteOffset, self.processingIndex)

		# Im currently revising this logic, but something similar to it is greatly beneficial.
		# Essentially, current logic to check for peak may miss them.

		# if self.checkPossibleMissedPeak(referenceSum, self.processingIndex - 2):
		# 	if self.note.name == "F#5/Gb5":
		# 		if self.manager.globalIndex >= 330:
		# 			print (self.manager.globalIndex)
		# 	baseIndex = self.processingIndex
		# 	prevSum = initialSum
		# 	firstDerivatives = []
		# 	# In the case of a missed peak, we expect that there is a strictly non-decreasing climb from the base of the peak.
		# 	while baseIndex > 0:
		# 		baseIndex -= 1
		# 		currentSum = sum(self.manager.data[baseIndex][self.firstIndex: self.lastIndex])
		# 		if currentSum > prevSum:
		# 			break
		# 		firstDerivatives.append(prevSum - currentSum)
		# 		prevSum = currentSum
		# 	if self.checkPeak(initialSum, prevSum):
		# 		# If there is a big enough height for this "gradual peak", we decide where the base is
		# 		# by looking for the biggest first derivative. Ofcourse, we give more weight to the elements
		# 		# closer to the base of the peak.
		# 		modifiedFD = [firstDerivatives[i] * i for i in range(len(firstDerivatives))]
		# 		trueBaseIndex = modifiedFD.index(max(modifiedFD))

		# 		self.preNoteValue = sum(self.manager.data[self.processingIndex - trueBaseIndex - 2][self.firstIndex: self.lastIndex])
		# 		self.peakIndex = self.processingIndex - trueBaseIndex
		# 		self.peakValue = initialSum
		# 		self.maxValue = self.peakValue

		return Message(MessageType.NO_EVENT)


text:
package org.knowm.xchange.exceptions;

import org.knowm.xchange.currency.CurrencyPair;

/**
 * Exception indicating that a request was made with a {@link CurrencyPair} that is not supported on
 * this exchange.
 *
 * @author bryant_harris
 */
public class CurrencyPairNotValidException extends ExchangeException {
  private CurrencyPair currencyPair;

  public CurrencyPairNotValidException() {
    super("Invalid currency pair for this operation");
  }

  public CurrencyPairNotValidException(String message, Throwable cause, CurrencyPair currencyPair) {
    super(message, cause);
    this.currencyPair = currencyPair;
  }

  public CurrencyPairNotValidException(String message, Throwable cause) {
    super(message, cause);
  }

  public CurrencyPairNotValidException(String message) {
    super(message);
  }

  public CurrencyPairNotValidException(String message, CurrencyPair currencyPair) {
    super(message);
    this.currencyPair = currencyPair;
  }

  public CurrencyPairNotValidException(Throwable cause) {
    super(cause);
  }

  public CurrencyPairNotValidException(Throwable cause, CurrencyPair currencyPair) {
    super(currencyPair + " is not valid for this operation", cause);
    this.currencyPair = currencyPair;
  }

  public CurrencyPairNotValidException(CurrencyPair currencyPair) {
    this(currencyPair + " is not valid for this operation");
    this.currencyPair = currencyPair;
  }

  /** @return The currency pair that caused the exception. */
  public CurrencyPair getCurrencyPair() {
    return currencyPair;
  }
}


text:
package org.apache.camel.processor.async;

import org.apache.camel.ContextTestSupport;
import org.apache.camel.Exchange;
import org.apache.camel.Processor;
import org.apache.camel.RecipientList;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.spi.Registry;
import org.junit.jupiter.api.Test;

import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;

public class AsyncEndpointRecipientListBeanTest extends ContextTestSupport {

    private static String beforeThreadName;
    private static String afterThreadName;

    @Override
    protected Registry createRegistry() throws Exception {
        Registry jndi = super.createRegistry();
        jndi.bind("myBean", new MyRecipientBean());
        return jndi;
    }

    @Test
    public void testAsyncEndpoint() throws Exception {
        getMockEndpoint("mock:before").expectedBodiesReceived("Hello Camel");
        getMockEndpoint("mock:after").expectedBodiesReceived("Bye Camel");
        getMockEndpoint("mock:result").expectedBodiesReceived("Bye Camel");

        String reply = template.requestBody("direct:start", "Hello Camel", String.class);
        assertEquals("Bye Camel", reply);

        assertFalse(beforeThreadName.equalsIgnoreCase(afterThreadName), "Should use different threads");
    }

    @Override
    protected RouteBuilder createRouteBuilder() throws Exception {
        return new RouteBuilder() {
            @Override
            public void configure() throws Exception {
                context.addComponent("async", new MyAsyncComponent());

                from("direct:start").to("mock:before").to("log:before").process(new Processor() {
                    public void process(Exchange exchange) throws Exception {
                        beforeThreadName = Thread.currentThread().getName();
                    }
                }).bean("myBean").process(new Processor() {
                    public void process(Exchange exchange) throws Exception {
                        afterThreadName = Thread.currentThread().getName();
                    }
                }).to("log:after").to("mock:after").to("mock:result");
            }
        };
    }

    public static class MyRecipientBean {
        @RecipientList
        public String doSomething() {
            return "async:bye:camel";
        }
    }
}


text:
/*--
    Modal:Scroll
 --*/

/*define scrollbar size*/
::-webkit-scrollbar {
    width: 4px;
    height: 4px;
    background-color: #F5F5F5;
}

/*define scrollbar track*/
::-webkit-scrollbar-track, ::-webkit-scrollbar-corner {
    -webkit-box-shadow: inset 0 0 4px rgba(0,0,0,0.3);
    border-radius: 2px;
    background-color: #F5F5F5;
}

/*define scrollbar slider*/
::-webkit-scrollbar-thumb {
    border-radius: 4px;
    -webkit-box-shadow: inset 0 0 6px rgba(0,0,0,.3);
    background-color: #c1c1c1;
}

/*--
    Modal: Back Top
 --*/
#scrollup {
    display: none; /* Hidden by default */
    position: fixed; /* Fixed/sticky position */
    bottom: 55px; /* Place the button at the bottom of the page */
    right: 10px; /* Place the button 30px from the right */
    z-index: 99; /* Make sure it does not overlap */
    border: none; /* Remove borders */
    outline: none; /* Remove outline */
    background-color: #605ca8; /* Set a background color */
    color: white; /* Text color */
    cursor: pointer; /* Add a mouse pointer on hover */
    padding: 8px; /* Some padding */
    border-radius: 10px; /* Rounded corners */
}

    #scrollup:hover {
        background-color: #555; /* Add a dark-grey background on hover */
    }

/*--
    Modal:Layout UI
 --*/
body {
    -moz-user-select: none;
    -webkit-user-select: none;
    -ms-user-select: none;
    -khtml-user-select: none;
    user-select: none;
}


text:
{% extends 'dash/base.html' %}

{% block sub_title %}
  Oops
{% endblock sub_title %}

{% block sub_heading %}
  Oops
{% endblock sub_heading %}

{% block content %}

Oops

        Looks like something went wrong!

        We track these errors, but if the problem persists feel free to contact us.

{% endblock content %}


text:
#include "modules/dreamview/backend/teleop/teleop.h"

#include "cyber/common/log.h"
#include "cyber/time/time.h"
#include "google/protobuf/util/json_util.h"
#include "modules/common/util/message_util.h"

#include <iomanip>
#include <sstream>

namespace apollo {
namespace dreamview {

using Json = nlohmann::json;
using apollo::cyber::Time;
using apollo::planning::ADCTrajectory;
using apollo::planning::DrivingAction;
using apollo::planning::PadMessage;
using apollo::planning::ScenarioConfig;
using ::google::protobuf::util::MessageToJsonString;
using modules::teleop::daemon::DaemonCmd;
using modules::teleop::daemon::DaemonRpt;
using modules::teleop::modem::ModemInfo;

// modem ids
const std::string modem0_id = "0";
const std::string modem1_id = "1";
const std::string modem2_id = "2";

// number of simultaneous video encoders
static const unsigned int kEncoderCount = 3;
// delay between to consecutive  msg writes
static const unsigned int kWriteWaitMs = 50;

const std::string start_cmd = "start";
const std::string stop_cmd = "kill";

// channels
const std::string modem0_channel = "/apollo/teleop/modem/modem0";
const std::string modem1_channel = "/apollo/teleop/modem/modem1";
const std::string modem2_channel = "/apollo/teleop/modem/modem2";
const std::string remote_daemon_cmd_channel =
    "/apollo/teleop/daemon/remote/cmd";
const std::string remote_daemon_rpt_channel =
    "/apollo/teleop/daemon/remote/rpt";
const std::string local_daemon_cmd_channel = "/apollo/teleop/daemon/local/cmd";
const std::string local_daemon_rpt_channel = "/apollo/teleop/daemon/local/rpt";
const std::string planning_channel = "/apollo/planning";
const std::string planning_pad_channel = "/apollo/planning/pad";

TeleopService::TeleopService(WebSocketHandler *websocket)
    : node_(cyber::CreateNode("teleop")), websocket_(websocket) {
  RegisterMessageHandlers();

  teleop_status_["audio"] = false;
  teleop_status_["audio_starting"] = false;
  teleop_status_["audio_stopping"] = false;
  teleop_status_["mic"] = false;
  teleop_status_["mic_starting"] = false;
  teleop_status_["mic_stopping"] = false;
  teleop_status_["video"] = false;
  teleop_status_["video_starting"] = false;
  teleop_status_["video_stopping"] = false;
  teleop_status_["pulling_over"] = false;
  teleop_status_["e_stopping"] = false;
  teleop_status_["resuming_autonomy"] = false;
}

void TeleopService::Start() {
  // TODO get topic names from proto
  // TODO update proto to get all modems' info combined with rank

  modem0_info_reader_ = node_->CreateReader<ModemInfo>(
      modem0_channel, [this](const std::shared_ptr<ModemInfo> &msg) {
        UpdateModem(modem0_id, msg);
      });

  modem1_info_reader_ = node_->CreateReader<ModemInfo>(
      modem1_channel, [this](const std::shared_ptr<ModemInfo> &msg) {
        UpdateModem(modem1_id, msg);
      });

  modem2_info_reader_ = node_->CreateReader<ModemInfo>(
      modem2_channel, [this](const std::shared_ptr<ModemInfo> &msg) {
        UpdateModem(modem2_id, msg);
      });

  planning_reader_ = node_->CreateReader<ADCTrajectory>(
      planning_channel, [this](const std::shared_ptr<ADCTrajectory> &msg) {
        UpdatePlanning(msg);
      });

  remote_daemon_cmd_writer_ =
      node_->CreateWriter<DaemonCmd>(remote_daemon_cmd_channel);

  local_daemon_cmd_writer_ =
      node_->CreateWriter<DaemonCmd>(local_daemon_cmd_channel);

  remote_daemon_rpt_reader_ = node_->CreateReader<DaemonRpt>(
      remote_daemon_rpt_channel,
      [this](const std::shared_ptr<DaemonRpt> &msg) {
        UpdateCarDaemonRpt(msg);
      });

  local_daemon_rpt_reader_ = node_->CreateReader<DaemonRpt>(
      local_daemon_rpt_channel,
      [this](const std::shared_ptr<DaemonRpt> &msg) {
        UpdateOperatorDaemonRpt(msg);
      });

  pad_message_writer_ = node_->CreateWriter<PadMessage>(planning_pad_channel);
}

void TeleopService::RegisterMessageHandlers() {
  // Send current teleop status to the new client.
  websocket_->RegisterConnectionReadyHandler(
      [this](WebSocketHandler::Connection *conn) { SendStatus(conn); });
  // Start/Stop local and remote audio
  websocket_->RegisterMessageHandler(
      "ToggleAudio",
      [this](const Json &json, WebSocketHandler::Connection *conn) {
        {
          bool start = false;  // false means stop
          // create a scope for the mutex lock
          {
            boost::unique_lock<boost::shared_mutex> writer_lock(mutex_);
            // toggle depending on current state change
            if (teleop_status_["audio_starting"]) {
              teleop_status_["audio_starting"] = false;
              teleop_status_["audio_stopping"] = true;
            } else if (teleop_status_["audio_stopping"]) {
              teleop_status_["audio_starting"] = true;
              teleop_status_["audio_stopping"] = false;
            }
            // not currently starting or stopping video
            else {
              // toggle depending on current state
              if (teleop_status_["audio"]) {
                teleop_status_["audio_stopping"] = true;
                teleop_status_["audio_starting"] = false;
              } else {
                teleop_status_["audio_stopping"] = false;
                teleop_status_["audio_starting"] = true;
              }
            }
            start = teleop_status_["audio_starting"];
          }
          AINFO << "ToggleAudio: " << start;
          SendAudioStreamCmd(start);
        }
      });
  // Mute/Unmute local microphone
  websocket_->RegisterMessageHandler(
      "ToggleMic",
      [this](const Json &json, WebSocketHandler::Connection *conn) {
        bool start = false;
        {
          boost::unique_lock<boost::shared_mutex> writer_lock(mutex_);
          // toggle depending on current state change
          if (teleop_status_["mic_starting"]) {
            teleop_status_["mic_starting"] = false;
            teleop_status_["mic_stopping"] = true;
          } else if (teleop_status_["mic_stopping"]) {
            teleop_status_["mic_starting"] = true;
            teleop_status_["mic_stopping"] = false;
          }
          // not currently starting or stopping video
          else {
            // toggle depending on current state
            if (teleop_status_["mic"]) {
              teleop_status_["mic_stopping"] = true;
              teleop_status_["mic_starting"] = false;
            } else {
              teleop_status_["mic_stopping"] = false;
              teleop_status_["mic_starting"] = true;
            }
          }
          start = teleop_status_["mic_starting"];
        }
        AINFO << "ToggleMic: " << start;
        SendMicStreamCmd(start);
      });
  // Start/stop local decoder and viewer, start/stop remote encoder and
  // compositor
  websocket_->RegisterMessageHandler(
      "ToggleVideo",
      [this](const Json &json, WebSocketHandler::Connection *conn) {
        bool start = false;  // false means stop
        // create a scope for the mutex lock
        {
          boost::shared_lock<boost::shared_mutex> writer_lock(mutex_);
          // toggle depending on current state change
          if (teleop_status_["video_starting"]) {
            teleop_status_["video_starting"] = false;
            teleop_status_["video_stopping"] = true;
          } else if (teleop_status_["video_stopping"]) {
            teleop_status_["video_starting"] = true;
            teleop_status_["video_stopping"] = false;
          }
          // not currently starting or stopping video
          else {
            // toggle depending on current state
            if (teleop_status_["video"]) {
              teleop_status_["video_stopping"] = true;
              teleop_status_["video_starting"] = false;
            } else {
              teleop_status_["video_stopping"] = false;
              teleop_status_["video_starting"] = true;
            }
          }
          start = teleop_status_["video_starting"];
        }
        // send a start or stop message to the video encoders
        AINFO << "ToggleVideo: " << start;
        SendVideoStreamCmd(start);
      });
  // Issue pull-over command to remote
  websocket_->RegisterMessageHandler(
      "PullOver", [this](const Json &json, WebSocketHandler::Connection *conn) {
        boost::shared_lock<boost::shared_mutex> reader_lock(mutex_);
        SendPullOverCmd();
      });
  // Issue emergency-stop command to remote
  websocket_->RegisterMessageHandler(
      "EStop", [this](const Json &json, WebSocketHandler::Connection *conn) {
        boost::shared_lock<boost::shared_mutex> reader_lock(mutex_);
        SendEstopCmd();
      });
  // Issue resume-cruise command to remote
  websocket_->RegisterMessageHandler(
      "ResumeCruise",
      [this](const Json &json, WebSocketHandler::Connection *conn) {
        boost::shared_lock<boost::shared_mutex> reader_lock(mutex_);
        SendResumeCruiseCmd();
      });
  // Request to get updated modem info for client display
  websocket_->RegisterMessageHandler(
      "RequestTeleopStatus",
      [this](const Json &json, WebSocketHandler::Connection *conn) {
        SendStatus(conn);
      });
}

void TeleopService::SendStatus(WebSocketHandler::Connection *conn) {
  std::string to_send;
  {
    boost::shared_lock<boost::shared_mutex> reader_lock(mutex_);
    to_send = teleop_status_.dump();
  }
  websocket_->SendData(conn, to_send);
}

void TeleopService::UpdateModem(const std::string &modem_id,
                                const std::shared_ptr<ModemInfo> &modem_info) {
  // TODO simplify data and only send necessary info for display
  // update modem_info_
  if (modem_info->has_technology()) {
    // teleop_status_["modems"][modem_info->provider()] =
    //  modem_info->technology();
    boost::unique_lock<boost::shared_mutex> writer_lock(mutex_);
    std::string str;
    std::stringstream ss(str);
    double rx = 1.0 * modem_info->rx() / (1024 * 1024);
    double tx = 1.0 * modem_info->tx() / (1024 * 1024);

    ss << modem_info->technology();
    ss << std::fixed << std::setw(6) << std::setprecision(2)
       << std::setfill('0');
    ss << " rank: " << modem_info->rank();
    ss << " sig: " << modem_info->signal();
    ss << " q: " << modem_info->quality();
    ss << " rx: " << rx << " MB";
    ss << " tx: " << tx << " MB";
    teleop_status_["modems"][modem_id] = ss.str();
  }
}

// callback for messages that originate from the remote computer
void TeleopService::UpdateCarDaemonRpt(
    const std::shared_ptr<DaemonRpt> &daemon_rpt) {
  {
    bool videoIsRunning = false;
    bool voipIsRunning = false;
    unsigned int runningEncoders = 0;
    for (int i = 0; i < daemon_rpt->services_size(); i++) {
      // look for voip_encoder or encoder0..1.2
      // check 'voip_encoder' first because it contains 'encoder'
      std::string service = daemon_rpt->services(i);
      if (service.find("voip_encoder") != std::string::npos) {
        voipIsRunning = true;
      } else if (service.find("encoder") != std::string::npos) {
        runningEncoders++;
      }
    }

    // all  video encoders are running.
    videoIsRunning = runningEncoders >= kEncoderCount;

    // we may need to write commands to start/stop the video stream
    bool sendStartVideo = false;
    bool sendStopVideo = false;

    bool sendStartAudio = false;
    bool sendStopAudio = false;
    // scope for the lock
    {
      boost::unique_lock<boost::shared_mutex> writer_lock(mutex_);
      teleop_status_["video"] = videoIsRunning;
      teleop_status_["audio"] = voipIsRunning;

      // video currently running
      if (teleop_status_["video"]) {
        if (teleop_status_["video_starting"]) {
          // video has started
          teleop_status_["video_starting"] = false;
        } else if (teleop_status_["video_stopping"]) {
          // not stopped yet
          sendStopVideo = true;
        }
      }
      // video not running
      else {
        if (teleop_status_["video_starting"]) {
          // not started yet
          sendStartVideo = true;
        } else if (teleop_status_["video_stopping"]) {
          // video is stopped
          teleop_status_["video_stopping"] = false;
        }
      }
      // audio currently running
      if (teleop_status_["audio"]) {
        if (teleop_status_["audio_starting"]) {
          // audio has started
          teleop_status_["audio_starting"] = false;
        } else if (teleop_status_["audio_stopping"]) {
          sendStopAudio = true;
        }
      }
      // audio not running
      else {
        if (teleop_status_["audio_starting"]) {
          // not started yet
          sendStartAudio = true;
        } else if (teleop_status_["audio_stopping"]) {
          // video is stopped
          teleop_status_["audio_stopping"] = false;
        }
      }
    }
    if (sendStartVideo || sendStopVideo) {
      SendVideoStreamCmd(sendStartVideo);
    }
    if (sendStartAudio || sendStopAudio) {
      SendAudioStreamCmd(sendStartAudio);
    }
  }
}

// callback for messages that originate from this computer
void TeleopService::UpdateOperatorDaemonRpt(
    const std::shared_ptr<DaemonRpt> &daemon_rpt) {
  {
    bool voipIsRunning = false;
    for (int i = 0; i < daemon_rpt->services_size(); i++) {
      std::string service = daemon_rpt->services(i);
      if (service.find("voip_encoder") != std::string::npos) {
        voipIsRunning = true;
        break;
      }
    }
    bool sendStartMic = false;
    bool sendStopMic = false;
    // scope for the lock
    {
      boost::unique_lock<boost::shared_mutex> writer_lock(mutex_);
      teleop_status_["mic"] = voipIsRunning;
      // mic currently running
      if (teleop_status_["mic"]) {
        if (teleop_status_["mic_starting"]) {
          // mic has started
          teleop_status_["mic_starting"] = false;
        } else if (teleop_status_["mic_stopping"]) {
          sendStopMic = true;
        }
      }
      // mic not running
      else {
        if (teleop_status_["mic_starting"]) {
          // not started yet
          sendStartMic = true;
        } else if (teleop_status_["mic_stopping"]) {
          // video is stopped
          teleop_status_["mic_stopping"] = false;
        }
      }
    }
    if (sendStartMic || sendStopMic) {
      SendMicStreamCmd(sendStartMic);
    }
  }
}

void TeleopService::SendVideoStreamCmd(bool start_stop) {
  DaemonCmd msg;
  if (start_stop) {
    msg.set_cmd(start_cmd);
  } else {
    msg.set_cmd(stop_cmd);
  }
  // we send a message to each encoder.
  for (unsigned int i = 0; i < kEncoderCount; i++) {
    if (i > 0) {
      // delay between sending 2 messages to ensure they are received
      std::this_thread::sleep_for(std::chrono::milliseconds(kWriteWaitMs));
    }
    char encoderName[20];
    snprintf(encoderName, 20, "encoder%u", i);
    msg.set_service(encoderName);
    common::util::FillHeader("dreamview", &msg);
    remote_daemon_cmd_writer_->Write(msg);
    AINFO << encoderName << " " << msg.cmd();
  }
}

void TeleopService::SendAudioStreamCmd(bool start_stop) {
  DaemonCmd msg;
  if (start_stop) {
    msg.set_cmd(start_cmd);
  } else {
    msg.set_cmd(stop_cmd);
  }
  msg.set_service("voip_encoder");
  common::util::FillHeader("dreamview", &msg);
  remote_daemon_cmd_writer_->Write(msg);
  AINFO << "audio " << msg.cmd();
  // audio start / stop implies mic start/stop
  SendMicStreamCmd(start_stop);
}

void TeleopService::SendMicStreamCmd(bool start_stop) {
  // by switching on or off the voip_encoder in the local console
  // we are controlling the mic
  DaemonCmd msg;
  if (start_stop) {
    msg.set_cmd(start_cmd);
  } else {
    msg.set_cmd(stop_cmd);
  }
  msg.set_service("voip_encoder");
  common::util::FillHeader("dreamview", &msg);
  local_daemon_cmd_writer_->Write(msg);
  AINFO << "mic " << msg.cmd();
}

void TeleopService::SendResumeCruiseCmd() {
  AINFO << "Resume cruise";
  PadMessage pad_msg;
  pad_msg.set_action(DrivingAction::RESUME_CRUISE);
  pad_message_writer_->Write(pad_msg);
}

void TeleopService::SendPullOverCmd() {
  AINFO << "Pull over";
  PadMessage pad_msg;
  pad_msg.set_action(DrivingAction::PULL_OVER);
  pad_message_writer_->Write(pad_msg);
}

void TeleopService::SendEstopCmd() {
  AINFO << "EStop";
  PadMessage pad_msg;
  pad_msg.set_action(DrivingAction::STOP);
  pad_message_writer_->Write(pad_msg);
}

void TeleopService::UpdatePlanning(const std::shared_ptr<ADCTrajectory> &msg) {
  static int count = 0;
  ++count;

  if (count % 10 == 0) {
    AINFO << "Update Planning";
  }
  auto scenario_type = msg->debug().planning_data().scenario().scenario_type();

  bool pulled_over = scenario_type == ScenarioConfig::PULL_OVER;
  bool autonomy_resumed = scenario_type == ScenarioConfig::PARK_AND_GO;
  bool e_stopped = scenario_type == ScenarioConfig::EMERGENCY_PULL_OVER;

  bool sendPullOver = false;
  bool sendStop = false;
  bool sendResume = false;
  {
    boost::unique_lock<boost::shared_mutex> writer_lock(mutex_);
    if (pulled_over) {
      if (teleop_status_["pulling_over"]) {
        // pulled over confirmed
        teleop_status_["pulling_over"] = false;
      }
    }
    // not pulled over
    else {
      if (teleop_status_["pulling_over"]) {
        sendPullOver = true;
      }
    }

    if (e_stopped) {
      if (teleop_status_["e_stopping"]) {
        // e stop over confirmed
        teleop_status_["e_stopping"] = false;
      }
    }
    // not e stopped
    else {
      if (teleop_status_["e_stopping"]) {
        sendStop = true;
      }
    }

    if (autonomy_resumed) {
      if (teleop_status_["resuming_autonomy"]) {
        teleop_status_["resuming_autonomy"] = false;
      }
    } else {
      if (teleop_status_["resuming_autonomy"]) {
        sendResume = true;
      }
    }
  }  // writer lock scope

  if (sendResume) {
    SendResumeCruiseCmd();
  }
  if (sendStop) {
    SendEstopCmd();
  }
  if (sendPullOver) {
    SendPullOverCmd();
  }
}

}  // namespace dreamview
}  // namespace apollo


text: psql -U postgres -c "CREATE USER bluesky WITH password 'password' CREATEDB"


text:
using System;
using Arch.CMessaging.Client.Core.Bo;
using Arch.CMessaging.Client.Net.Core.Buffer;
using Arch.CMessaging.Client.Core.Utils;

namespace Arch.CMessaging.Client.Transport.Command
{
    public class QueryOffsetResultCommand : AbstractCommand
    {
        public Offset Offset { get; private set; }

        public QueryOffsetResultCommand()
            : this(null)
        {
        }

        public QueryOffsetResultCommand(Offset offset)
            : base(CommandType.ResultQueryOffset, 1)
        {
            Offset = offset;
        }

        protected override void Parse0(IoBuffer buf)
        {
            HermesPrimitiveCodec codec = new HermesPrimitiveCodec(buf);
            Offset = codec.ReadOffset();
        }

        protected override void ToBytes0(IoBuffer buf)
        {
            HermesPrimitiveCodec codec = new HermesPrimitiveCodec(buf);
            codec.WriteOffset(Offset);
        }
    }
}


text:
// $OpenLDAP: pkg/ldap/contrib/ldapc++/src/LDAPSearchResult.h,v 1.4.10.1 2008/04/14 23:09:26 quanah Exp $

#ifndef LDAP_SEARCH_RESULT_H
#define LDAP_SEARCH_RESULT_H

#include <LDAPMessage.h>
#include <LDAPEntry.h>

class LDAPRequest;

/**
 * This class is used to represent the result entries of a
 * SEARCH-operation.
 */
class LDAPSearchResult : public LDAPMsg{
    public:
        /**
         * Constructor that create an object from the C-API structures
         */
        LDAPSearchResult(const LDAPRequest *req, LDAPMessage *msg);

        /**
         * Copy-Constructor
         */
        LDAPSearchResult(const LDAPSearchResult& res);

        /**
         * The Destructor
         */
        virtual ~LDAPSearchResult();

        /**
         * @returns The entry that has been sent with this result message.
         */
        const LDAPEntry* getEntry() const;

    private:
        LDAPEntry *entry;
};
#endif //LDAP_SEARCH_RESULT_H


text:
var Object = {};
Object.keys = function (object) {};
Object.__proto__ = {};
Object.hasOwnProperty = function () {};
var Array = {};
Array.length = 0;
Array.isArray = function () {};

var SqliteStatic = {};

/**
 * @param {Object} options
 * @return {Promise.<Sqlite>}
 */
SqliteStatic.openConnection = function (options) {}

var Sqlite = {}

/**
 * @param {string} sql
 * @param {Array} bindings
 * @return {Promise}
 */
Sqlite.execute = function (sql, bindings) {}

/**
 * @return {Promise}
 */
Sqlite.close = function() {}

var StorageRow = {};

/**
 * @param {string} index
 */
StorageRow.getResultByIndex = function (index) {}

/**
 * @param {string} name
 */
StorageRow.getResultByName = function (name) {}


text:
<?xml version="1.0" encoding="utf-8"?>
<android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:id="@+id/drawer"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:fitsSystemWindows="true">

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical">

        <include
            android:id="@+id/toolbar_actionbar"
            layout="@layout/toolbar_default"
            android:layout_width="match_parent"
            android:layout_height="wrap_content" />

        <FrameLayout
            android:id="@+id/container"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:clickable="true" />
    </LinearLayout>
    <!-- android:layout_marginTop="?android:attr/actionBarSize"-->
    <com.codeitsuisse.team28.expensetracker.drawermenu.ScrimInsetsFrameLayout
        android:id="@+id/scrimInsetsFrameLayout"
        android:layout_width="@dimen/navigation_drawer_width"
        android:layout_height="wrap_content"
        android:layout_gravity="start"
        android:elevation="10dp"
        android:fitsSystemWindows="true"
        app:insetForeground="#4000">

        <fragment
            android:id="@+id/fragment_drawer"
            android:name="com.codeitsuisse.team28.expensetracker.drawermenu.NavigationDrawerFragment"
            android:layout_width="@dimen/navigation_drawer_width"
            android:layout_height="match_parent"
            android:fitsSystemWindows="true"
            app:layout="@layout/fragment_navigation_drawer"
            tools:layout="@layout/fragment_navigation_drawer" />
    </com.codeitsuisse.team28.expensetracker.drawermenu.ScrimInsetsFrameLayout>

</android.support.v4.widget.DrawerLayout>