text:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
	<modelVersion>4.0.0</modelVersion>
	<groupId>org.vaadin.highcharts</groupId>
	<artifactId>highcharts</artifactId>
	<version>2.1-SNAPSHOT</version>
	<packaging>${packaging.type}</packaging>
	<name>Highcharts for Vaadin 7</name>

	<organization>
		<name>Vaadin Community</name>
	</organization>

	<properties>
		<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
		<vaadin.version>8.0.5</vaadin.version>
		<vaadin.plugin.version>${vaadin.version}</vaadin.plugin.version>

		<!-- ZIP Manifest fields -->
		<Implementation-Version>${project.version}</Implementation-Version>
		<!-- Must not change this because of the Directory -->
		<Implementation-Title>${project.name}</Implementation-Title>
		<Implementation-Vendor>${project.organization.name}</Implementation-Vendor>
		<Vaadin-License-Title>Apache License 2.0</Vaadin-License-Title>
		<Vaadin-Addon>${project.artifactId}-${project.version}.jar</Vaadin-Addon>
	</properties>

	<url>https://github.com/xylo/highcharts-vaadin7</url>

	<developers>
		<developer>
			<id>stefan_endrullis</id>
			<name>Stefan Endrullis</name>
			<email>stefan@endrullis.de</email>
			<url>stefan.endrullis.de</url>
		</developer>
	</developers>

	<scm>
		<url>https://github.com/xylo/highcharts-vaadin7</url>
		<connection>scm:git:git://github.com/xylo/highcharts-vaadin7.git</connection>
		<developerConnection>scm:git:ssh://git@github.com/xylo/highcharts-vaadin7.git</developerConnection>
		<tag>HEAD</tag>
	</scm>

	<issueManagement>
		<system>GitHub</system>
		<url>https://github.com/xylo/highcharts-vaadin7</url>
	</issueManagement>

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

	<dependencies>
		<dependency>
			<groupId>com.vaadin</groupId>
			<artifactId>vaadin-server</artifactId>
			<version>${vaadin.version}</version>
		</dependency>
		<dependency>
			<groupId>org.vaadin</groupId>
			<artifactId>addon-test-helpers</artifactId>
			<version>2.0.alpha5</version>
			<scope>${demo.dependency.scope}</scope>
		</dependency>
		<dependency>
			<groupId>com.vaadin</groupId>
			<artifactId>vaadin-themes</artifactId>
			<version>${vaadin.version}</version>
			<scope>${demo.dependency.scope}</scope>
		</dependency>
		<dependency>
			<groupId>com.vaadin</groupId>
			<artifactId>vaadin-client-compiled</artifactId>
			<version>${vaadin.version}</version>
			<scope>${demo.dependency.scope}</scope>
		</dependency>

		<!-- AceEditor add-on. -->
		<dependency>
			<groupId>org.vaadin.addons</groupId>
			<artifactId>aceeditor</artifactId>
			<version>0.8.15</version>
			<scope>${demo.dependency.scope}</scope>
		</dependency>

		<!-- compiler module contains GWT compiler, run manually with exec plugin -->
		<dependency>
			<groupId>com.vaadin</groupId>
			<artifactId>vaadin-client-compiler</artifactId>
			<version>${vaadin.version}</version>
			<scope>${demo.dependency.scope}</scope>
			<exclusions>
				<!-- Exclude Jetty stuff that we don't use and which will conflict
						with other test dependencies -->
				<exclusion>
					<groupId>org.eclipse.jetty</groupId>
					<artifactId>jetty-annotations</artifactId>
				</exclusion>
				<exclusion>
					<groupId>org.eclipse.jetty</groupId>
					<artifactId>jetty-servlets</artifactId>
				</exclusion>
				<exclusion>
					<groupId>org.eclipse.jetty</groupId>
					<artifactId>jetty-util</artifactId>
				</exclusion>
			</exclusions>
		</dependency>
	</dependencies>

	<repositories>
		<repository>
			<id>vaadin-addons</id>
			<url>http://maven.vaadin.com/vaadin-addons</url>
		</repository>
	</repositories>

	<build>
		<plugins>
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-compiler-plugin</artifactId>
				<version>3.5.1</version>
				<configuration>
					<source>1.8</source>
					<target>1.8</target>
				</configuration>
			</plugin>
		</plugins>
	</build>

	<profiles>
		<profile>
			<id>default</id>
			<activation>
				<activeByDefault>true</activeByDefault>
			</activation>
			<properties>
				<packaging.type>bundle</packaging.type>
				<demo.dependency.scope>test</demo.dependency.scope>
			</properties>
			<build>
				<plugins>
					<!-- add proper OGSI entries to manifest -->
					<plugin>
						<groupId>org.apache.felix</groupId>
						<artifactId>maven-bundle-plugin</artifactId>
						<version>3.2.0</version>
						<extensions>true</extensions>
						<configuration>
							<instructions>
								<Export-Package>org.vaadin.highcharts.*</Export-Package>
							</instructions>
						</configuration>
						<executions>
							<execution>
								<id>manifest</id>
								<phase>process-classes</phase>
								<goals>
									<goal>manifest</goal>
								</goals>
							</execution>
						</executions>
					</plugin>

					<!-- Skip deployment as we expect the artifact to be manually
					deployed to vaadin.com/directory -->
					<plugin>
						<artifactId>maven-deploy-plugin</artifactId>
						<version>2.8.2</version>
						<configuration>
							<skip>true</skip>
						</configuration>
					</plugin>

					<plugin>
						<groupId>org.apache.maven.plugins</groupId>
						<artifactId>maven-jar-plugin</artifactId>
						<version>3.0.2</version>
						<configuration>
							<archive>
								<index>true</index>
								<manifest>
									<addClasspath>true</addClasspath>
									<addDefaultImplementationEntries>true</addDefaultImplementationEntries>
								</manifest>
								<manifestEntries>
									<!-- Package format version - do not change -->
									<Vaadin-Package-Version>1</Vaadin-Package-Version>
									<Vaadin-License-Title>${Vaadin-License-Title}</Vaadin-License-Title>
								</manifestEntries>
							</archive>
						</configuration>
					</plugin>
					<plugin>
						<groupId>org.apache.maven.plugins</groupId>
						<artifactId>maven-release-plugin</artifactId>
						<version>2.5.3</version>
						<configuration>
							<releaseProfiles>default,directorypackage</releaseProfiles>
						</configuration>
					</plugin>

					<!-- Use GWT compiler with exec plugin -->
					<plugin>
						<groupId>org.codehaus.mojo</groupId>
						<artifactId>exec-maven-plugin</artifactId>
						<version>1.5.0</version>
						<executions>
							<execution>
								<goals>
									<goal>exec</goal>
								</goals>
								<phase>test-compile</phase>
								<configuration>
									<executable>java</executable>
									<classpathScope>test</classpathScope>
									<arguments>
										<argument>-Xmx2g</argument>
										<argument>-classpath</argument>
										<classpath />
										<argument>com.google.gwt.dev.Compiler</argument>
										<argument>-war</argument>
										<argument>target/testwebapp/VAADIN/widgetsets</argument>
										<argument>org.vaadin.highcharts.DemoWidgetset</argument>
									</arguments>
								</configuration>
							</execution>
						</executions>
					</plugin>
				</plugins>
			</build>
		</profile>

		<profile>
			<id>directorypackage</id>
			<build>
				<plugins>
					<plugin>
						<groupId>org.apache.maven.plugins</groupId>
						<artifactId>maven-assembly-plugin</artifactId>
						<version>2.6</version>
						<configuration>
							<appendAssemblyId>false</appendAssemblyId>
							<descriptors>
								<descriptor>assembly/assembly.xml</descriptor>
							</descriptors>
						</configuration>
						<executions>
							<execution>
								<goals>
									<goal>single</goal>
								</goals>
								<phase>install</phase>
							</execution>
						</executions>
					</plugin>
					<!-- build javadocs during development builds as well to
					 show javadoc syntax issues before release. Remove this
					 to speed up the build a bit.
					-->
					<plugin>
						<groupId>org.apache.maven.plugins</groupId>
						<artifactId>maven-javadoc-plugin</artifactId>
						<version>2.10.4</version>
						<executions>
							<execution>
								<phase>package</phase>
								<goals>
									<goal>javadoc</goal>
								</goals>
							</execution>
						</executions>
					</plugin>
					<plugin>
						<groupId>org.apache.maven.plugins</groupId>
						<artifactId>maven-surefire-plugin</artifactId>
						<version>2.19.1</version>
					</plugin>
				</plugins>
			</build>
		</profile>

		<profile>
			<id>browsertests</id>
			<build>
				<plugins>
					<plugin>
						<groupId>org.apache.maven.plugins</groupId>
						<artifactId>maven-failsafe-plugin</artifactId>
						<version>2.19.1</version>
						<executions>
							<execution>
								<goals>
									<goal>integration-test</goal>
									<goal>verify</goal>
								</goals>
							</execution>
						</executions>
					</plugin>
				</plugins>
			</build>
			<activation>
				<!-- Change to run browser tests on each build -->
				<activeByDefault>false</activeByDefault>
			</activation>
		</profile>

		<profile>
			<id>demo</id>
			<build>
				<plugins>
					<!-- Run test webapp in jetty. -->
					<plugin>
						<groupId>org.codehaus.mojo</groupId>
						<artifactId>exec-maven-plugin</artifactId>
						<version>1.5.0</version>
						<executions>
							<execution>
								<goals>
									<goal>java</goal>
								</goals>
							</execution>
						</executions>
						<configuration>
							<mainClass>org.vaadin.highcharts.uiserver.Server</mainClass>
							<classpathScope>test</classpathScope>
						</configuration>
					</plugin>
				</plugins>
			</build>
		</profile>

		<profile>
			<id>demo-war</id>
			<properties>
				<packaging.type>war</packaging.type>
				<demo.dependency.scope>compile</demo.dependency.scope>
			</properties>
			<build>
				<resources>
					<resource>
						<directory>src/main/resources</directory>
					</resource>
					<resource>
						<directory>src/test/resources</directory>
					</resource>
				</resources>
				<plugins>
					<plugin>
						<artifactId>maven-clean-plugin</artifactId>
						<version>2.4.1</version>
						<configuration>
							<filesets>
								<fileset>
									<!-- Clean-up widgetset required for "inplace" compilation -->
									<directory>${basedir}/src/test/webapp/VAADIN/widgetsets</directory>
								</fileset>
								<fileset>
									<!-- Clean-up gwt cache -->
									<directory>${basedir}/src/test/webapp/VAADIN/gwt-unitCache</directory>
								</fileset>
							</filesets>
						</configuration>
					</plugin>

					<plugin>
						<artifactId>maven-war-plugin</artifactId>
						<version>2.3</version>
						<configuration>
							<packagingExcludes>
								**/VAADIN/gwt-unitCache/**,
								**/VAADIN/widgetsets/WEB-INF/**,
								**/WEB-INF/lib/servlet-api-*.jar,
								**/WEB-INF/lib/vaadin-client-*.jar,
								**/WEB-INF/lib/jetty-*.jar,
								**/WEB-INF/lib/ant-*.jar,
								**/WEB-INF/classes/gwt-unitCache/**,
								**/WEB-INF/classes/themes/**,
								**/WEB-INF/classes/widgetsets/**
							</packagingExcludes>
							<failOnMissingWebXml>false</failOnMissingWebXml>
						</configuration>
					</plugin>

					<plugin>
						<groupId>com.vaadin</groupId>
						<artifactId>vaadin-maven-plugin</artifactId>
						<version>${vaadin.plugin.version}</version>
						<configuration>
							<extraJvmArgs>-Xmx1G -Xss1024k</extraJvmArgs>
							<webappDirectory>${basedir}/src/test/webapp/VAADIN/widgetsets</webappDirectory>
							<hostedWebapp>${basedir}/src/test/webapp/VAADIN/widgetsets</hostedWebapp>
							<noServer>true</noServer>
							<persistentunitcachedir>${basedir}/target/tmp/gwt-unitCache</persistentunitcachedir>
							<compileReport>true</compileReport>
							<strict>true</strict>
							<runTarget>http://localhost:8080/</runTarget>
						</configuration>
						<executions>
							<!-- You are free to mark this as permanently ignored in Eclipse -->
							<execution>
								<configuration>
									<!-- if you don't specify any modules, the plugin will find them -->
								</configuration>
								<goals>
									<goal>resources</goal>
									<goal>update-widgetset</goal>
									<goal>compile</goal>
								</goals>
							</execution>
						</executions>
					</plugin>
				</plugins>
			</build>
		</profile>
	</profiles>

</project>


text:
Jenkins Master->Slave Example
=============================
This sample walks through the process of starting up an OpenShift cluster and deploying a Jenkins Pod in it.
It also leverage the [kubernetes-plugin](https://wiki.jenkins-ci.org/display/JENKINS/Kubernetes+Plugin) to manage
the Jenkins slaves that run as on-demand Pods.

The sample job that this Jenkins example contains will execute an unit test for
a simple Ruby application. The unit test will be executed in a pod managed by
the kubernetes plugin.

Because the Jenkins Slave pod needs a Docker image that connects to Jenkins
when it starts, this sample also provides a template that allows you to convert
any OpenShift S2I image to a valid Jenkins Slave image.

This template is not required if you already have Docker image that has the
script that launches the [slave
agent](https://wiki.jenkins-ci.org/display/JENKINS/Distributed+builds#Distributedbuilds-Launchslaveagentheadlessly)
as an entrypoint. In that case, you have to create the image stream for this
image and set the image stream label `role` to `jenkins-slave`.

The [Jenkins image](https://github.com/openshift/jenkins) includes the
Kubernetes plugin, so it can manage slave pods by default. This tutorial
includes a template which further customizes the Jenkins image by adding the Git
plugin and define the sample job used by the tutorial.

Steps
------
Before you begin, ensure you have created the [default imagestreams](https://docs.openshift.org/latest/install_config/imagestreams_templates.html#creating-image-streams-for-openshift-images) in the openshift namespace.

1. Create new OpenShift project, where the Jenkins server will run:
  ```
  $ oc new-project ci
  ```

2. Give the Jenkins Pod [service account](https://docs.openshift.org/latest/admin_guide/service_accounts.html)
   rights to do API calls to OpenShift.  This allows us to do the Jenkins Slave
   image discovery automatically.
  ```
  $ oc policy add-role-to-user edit system:serviceaccount:ci:default -n ci
  ```

3. Create the sample application:
  ```bash
  # Ruby application template
  $ oc new-app https://raw.githubusercontent.com/openshift/origin/master/examples/jenkins/application-template.json
  ```

4. Install the provided OpenShift templates:
  ```
  # Slave converter (optional):
  $ oc create -f https://raw.githubusercontent.com/openshift/origin/master/examples/jenkins/master-slave/jenkins-slave-template.json

  # Jenkins master template:
  $ oc create -f https://raw.githubusercontent.com/openshift/origin/master/examples/jenkins/master-slave/jenkins-master-template.json
  ```

5. Now navigate to the OpenShift Web Console and switch to the `ci` project.

6. Click on *Add to project* a select the `jenkins-slave-builder` template. Here
   you can customize the image stream name for the builder image or use
   alternative repository with your own custom entry point script.

7. Click *Create* and navigate to *Browse/Builds*. You should see the build
   running. Once this build finishes, you should have the Jenkins Slave image
   ready to be used.

8. Now click on *Add to project* again and select the `jenkins-master` template.
   Here you can pick an alternative Docker image (by default the OpenShift Jenkins
   Image will be used) or the custom S2I repository with your configuration. For this
   sample, you don't need to change these values.

9. Click *Create* and navigate to the *Overview* page. You should see the
   Jenkins route and the link to a `jenkins-master #1 build`. Once the build
   finish, you can follow the link and navigate to your new Jenkins server.

10. In the Jenkins, you should see the `ruby-hello-world-test` job. When you
   start this job, the [Kubernetes plugin](https://wiki.jenkins-ci.org/display/JENKINS/Kubernetes+Plugin)
   will provision a new Pod and attach it to Jenkins as a slave machine. The
   `ruby-hello-world-test` job has the field *Restrict where this project can be
   run* set to `ruby-22-centos7` which is the label of the pre-configured slave
   image.
```

More details
------------

* To manually tweak the Kubernetes Plugin configuration, go to 'Manage Jenkins'
  screen and then 'Configure System'. The Kubernetes settings should be under
  'Cloud/Kubernetes'.

* **NOTE**: This sample uses ephemeral storage. For production use, consider
  adding a persistent volume for the `/var/lib/jenkins` folder.

* If you already have a Jenkins Slave image, you can simply push the image to
  the OpenShift internal registry, under the `ci/` repository and create the image
  stream for it. Then you just need to set `"role": "jenkins-slave"` label for
  the image stream and re-deploy the Jenkins server.

redpajama_set_name: RedPajamaGithub


text:
package org.apache.ivy.osgi.p2;

import java.io.File;

import org.apache.ivy.Ivy;
import org.apache.ivy.core.cache.RepositoryCacheManager;
import org.apache.ivy.core.module.descriptor.Artifact;
import org.apache.ivy.core.module.descriptor.DefaultDependencyDescriptor;
import org.apache.ivy.core.module.id.ModuleRevisionId;
import org.apache.ivy.core.report.ArtifactDownloadReport;
import org.apache.ivy.core.report.DownloadReport;
import org.apache.ivy.core.report.DownloadStatus;
import org.apache.ivy.core.resolve.DownloadOptions;
import org.apache.ivy.core.resolve.ResolveData;
import org.apache.ivy.core.resolve.ResolveOptions;
import org.apache.ivy.core.resolve.ResolvedModuleRevision;
import org.apache.ivy.core.settings.IvySettings;
import org.apache.ivy.osgi.core.BundleInfo;
import org.apache.ivy.osgi.updatesite.UpdateSiteResolver;
import org.apache.tools.ant.taskdefs.condition.JavaVersion;
import org.junit.After;
import org.junit.Assume;
import org.junit.Before;
import org.junit.Test;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;

public class P2DescriptorTest {

    private File cache;

    private IvySettings settings;

    private UpdateSiteResolver p2SourceResolver;

    private UpdateSiteResolver p2ZippedResolver;

    private UpdateSiteResolver p2WithPackedResolver;

    private Ivy ivy;

    private ResolveData data;

    @Before
    public void setUp() throws Exception {
        settings = new IvySettings();

        p2SourceResolver = new UpdateSiteResolver();
        p2SourceResolver.setName("p2-sources");
        p2SourceResolver.setUrl(new File("test/test-p2/sources").toURI().toURL().toExternalForm());
        p2SourceResolver.setSettings(settings);
        settings.addResolver(p2SourceResolver);

        p2ZippedResolver = new UpdateSiteResolver();
        p2ZippedResolver.setName("p2-zipped");
        p2ZippedResolver.setUrl(new File("test/test-p2/zipped").toURI().toURL().toExternalForm());
        p2ZippedResolver.setSettings(settings);
        settings.addResolver(p2ZippedResolver);

        p2WithPackedResolver = new UpdateSiteResolver();
        p2WithPackedResolver.setName("p2-with-packed");
        p2WithPackedResolver.setUrl(new File("test/test-p2/packed").toURI().toURL()
                .toExternalForm());
        p2WithPackedResolver.setSettings(settings);
        settings.addResolver(p2WithPackedResolver);

        cache = new File("build/cache");
        cache.mkdirs();
        settings.setDefaultCache(cache);

        ivy = new Ivy();
        ivy.setSettings(settings);
        ivy.bind();

        ivy.getResolutionCacheManager().clean();
        RepositoryCacheManager[] caches = settings.getRepositoryCacheManagers();
        for (RepositoryCacheManager cache : caches) {
            cache.clean();
        }

        data = new ResolveData(ivy.getResolveEngine(), new ResolveOptions());
    }

    @After
    public void tearDown() {
        ivy.getLoggerEngine().sumupProblems();
    }

    @Test
    public void testResolveSource() throws Exception {
        settings.setDefaultResolver("p2-sources");

        ModuleRevisionId mrid = ModuleRevisionId.newInstance(BundleInfo.BUNDLE_TYPE,
            "org.apache.ivy", "2.2.0.final_20100923230623");

        ResolvedModuleRevision rmr = p2SourceResolver.getDependency(
            new DefaultDependencyDescriptor(mrid, false), data);
        assertNotNull(rmr);
        assertEquals(mrid, rmr.getId());

        assertEquals(2, rmr.getDescriptor().getAllArtifacts().length);

        DownloadReport report = p2SourceResolver.download(rmr.getDescriptor().getAllArtifacts(),
            new DownloadOptions());
        assertNotNull(report);

        assertEquals(2, report.getArtifactsReports().length);

        for (int i = 0; i < 2; i++) {
            Artifact artifact = rmr.getDescriptor().getAllArtifacts()[i];
            ArtifactDownloadReport ar = report.getArtifactReport(artifact);
            assertNotNull(ar);

            assertEquals(artifact, ar.getArtifact());
            assertEquals(DownloadStatus.SUCCESSFUL, ar.getDownloadStatus());

            // test to ask to download again, should use cache
            DownloadReport report2 = p2SourceResolver.download(new Artifact[] {artifact},
                new DownloadOptions());
            assertNotNull(report2);

            assertEquals(1, report2.getArtifactsReports().length);

            ar = report2.getArtifactReport(artifact);
            assertNotNull(ar);

            assertEquals(artifact, ar.getArtifact());
            assertEquals(DownloadStatus.NO, ar.getDownloadStatus());
        }
    }

    @Test
    public void testResolveNotZipped() throws Exception {
        settings.setDefaultResolver("p2-zipped");

        ModuleRevisionId mrid = ModuleRevisionId.newInstance(BundleInfo.BUNDLE_TYPE,
            "org.eclipse.e4.core.services", "1.0.0.v20120521-2346");

        ResolvedModuleRevision rmr = p2ZippedResolver.getDependency(
            new DefaultDependencyDescriptor(mrid, false), data);
        assertNotNull(rmr);
        assertEquals(mrid, rmr.getId());

        assertEquals(1, rmr.getDescriptor().getAllArtifacts().length);

        DownloadOptions options = new DownloadOptions();
        DownloadReport report = p2ZippedResolver.download(rmr.getDescriptor().getAllArtifacts(),
            options);
        assertNotNull(report);

        assertEquals(1, report.getArtifactsReports().length);

        Artifact artifact = rmr.getDescriptor().getAllArtifacts()[0];
        ArtifactDownloadReport ar = report.getArtifactReport(artifact);
        assertNotNull(ar);

        assertEquals(artifact, ar.getArtifact());
        assertEquals(DownloadStatus.SUCCESSFUL, ar.getDownloadStatus());
        assertNull(ar.getUnpackedLocalFile());
    }

    @Test
    public void testResolveZipped() throws Exception {
        settings.setDefaultResolver("p2-zipped");

        ModuleRevisionId mrid = ModuleRevisionId.newInstance(BundleInfo.BUNDLE_TYPE,
            "org.apache.ant", "1.8.3.v20120321-1730");

        ResolvedModuleRevision rmr = p2ZippedResolver.getDependency(
            new DefaultDependencyDescriptor(mrid, false), data);
        assertNotNull(rmr);
        assertEquals(mrid, rmr.getId());

        assertEquals(2, rmr.getDescriptor().getAllArtifacts().length);

        DownloadOptions options = new DownloadOptions();
        DownloadReport report = p2ZippedResolver.download(rmr.getDescriptor().getAllArtifacts(),
            options);
        assertNotNull(report);

        assertEquals(2, report.getArtifactsReports().length);

        for (int i = 0; i < 2; i++) {
            Artifact artifact = rmr.getDescriptor().getAllArtifacts()[i];
            ArtifactDownloadReport ar = report.getArtifactReport(artifact);
            assertNotNull(ar);

            assertEquals(artifact, ar.getArtifact());
            assertEquals(DownloadStatus.SUCCESSFUL, ar.getDownloadStatus());
            // only the binary get unpacked
            if (ar.getArtifact().getType().equals("source")) {
                assertNull(ar.getUnpackedLocalFile());
            } else {
                assertNotNull(ar.getUnpackedLocalFile());
            }
        }
    }

    @Test
    public void testResolvePacked() throws Exception {
        final JavaVersion java14OrHigher = new JavaVersion();
        java14OrHigher.setAtLeast("14");
        Assume.assumeFalse("Pack200 tools and API have been removed since JDK 14", java14OrHigher.eval());

        settings.setDefaultResolver("p2-with-packed");

        ModuleRevisionId mrid = ModuleRevisionId.newInstance(BundleInfo.BUNDLE_TYPE, "org.junit",
            "4.10.0.v4_10_0_v20120426-0900");

        ResolvedModuleRevision rmr = p2WithPackedResolver.getDependency(
            new DefaultDependencyDescriptor(mrid, false), data);
        assertNotNull(rmr);
        assertEquals(mrid, rmr.getId());

        assertEquals(1, rmr.getDescriptor().getAllArtifacts().length);

        DownloadOptions options = new DownloadOptions();
        DownloadReport report = p2WithPackedResolver.download(
            rmr.getDescriptor().getAllArtifacts(), options);
        assertNotNull(report);

        assertEquals(1, report.getArtifactsReports().length);

        Artifact artifact = rmr.getDescriptor().getAllArtifacts()[0];
        ArtifactDownloadReport ar = report.getArtifactReport(artifact);
        assertNotNull(ar);

        assertEquals(artifact, ar.getArtifact());
        assertEquals(DownloadStatus.SUCCESSFUL, ar.getDownloadStatus());
        assertNotNull(ar.getUnpackedLocalFile());
    }
}


text:
using System;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Media.Imaging;

namespace HelloImageCode
{
    public sealed partial class MainPage : Page
    {
        public MainPage()
        {
            this.InitializeComponent();

            Uri uri = new Uri("http://www.charlespetzold.com/pw6/PetzoldJersey.jpg");
            BitmapImage bitmap = new BitmapImage(uri);
            Image image = new Image();
            image.Source = bitmap;
            contentGrid.Children.Add(image);
        }
    }
}


text:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>AdminTheme - Ultimate Admin Panel Solution</title>
	<meta name="description" content="" />
    <meta name="keywords" content="" />
    <meta name="robots" content="index,follow" />

    <link rel="stylesheet" type="text/css" media="all" href="css/style.css" />
	<link rel="Stylesheet" type="text/css" href="css/smoothness/jquery-ui-1.7.1.custom.css"  />

	<link rel="stylesheet" type="text/css" href="markitup/skins/markitup/style.css" />
	<link rel="stylesheet" type="text/css" href="markitup/sets/default/style.css" />
	<link rel="stylesheet" type="text/css" href="css/superfish.css" media="screen">

Welcome James Ogle. Log out?

System messages: 3. Read?

Last login: 21:03 12.05.2009

AdmintTheme

			Visit site

Dashboard

Overview

Total Email Records: 1556

Total Funding Transactions: 340

Total Funded Amount: $134,45

Panel shortcuts

Themes

Statistics

FTP

Users

Comments

Gallery

Security

Sidebar

					Manage Left Panel

Edit Left Panel Title

Edit Left Panel Description

					Manage Sweepstakes Panel

Edit Sweepstakes Title

Edit Sweepstakes description

Edit Sweepstakes Prize Awarded

					Manage Causes

Add a Cause

Delete Cause

Edit Cause

					Manage Testimonials

Add Testimonial

Delete Testimonial

edit Testimonial

					Manage Email Records

View Email Records

View Shipping Records

Search Users

Send Mass Emails

Edit Left Panel

			<form action="post">

<input id="post_title" type="text" tabindex="1" value="Type title" style="width:600px; font-size:20px;" />

<textarea id="markItUp" cols="80" rows="10"></textarea>

			</form>

Yeah! Success!

Ups, there was an error

Ups, you miss something

© 2013 Prize Banker Admin Panel


text:
var profile = require('../../../lib/util/profile');

exports.getMockedProfile = function () {
  var newProfile = new profile.Profile();

  newProfile.addSubscription(new profile.Subscription({
    id: '5e7d1bb6-4953-44fe-8a54-43fbdb53b989',
    managementCertificate: {
      key: 'mockedKey',
      cert: 'mockedCert'
    },
    name: 'Mobilytics Test1',
    registeredProviders: ['website', 'mobileservice'],
    registeredResourceNamespaces: [],
    isDefault: true
  }, newProfile.environments['AzureCloud']));

  return newProfile;
};

exports.setEnvironment = function() {
};

exports.scopes = [[function (nock) {
var result =
nock('https://management.core.windows.net:443')
  .get('/5e7d1bb6-4953-44fe-8a54-43fbdb53b989/services/mobileservices/mobileservices/clitestnode1232/apis/testapi')
  .reply(200, "{\"name\":\"testapi\",\"get\":\"application\",\"put\":\"application\",\"post\":\"application\",\"patch\":\"application\",\"delete\":\"application\"}", { 'cache-control': 'no-cache',
  pragma: 'no-cache',
  'content-length': '124',
  'content-type': 'application/json; charset=utf-8',
  expires: '-1',
  server: '1.0.6198.213 (rd_rdfe_stable.150402-1703) Microsoft-HTTPAPI/2.0',
  'x-ms-servedbyregion': 'ussouth3',
  'strict-transport-security': 'max-age=31536000; includeSubDomains',
  'x-powered-by': 'ASP.NET',
  'x-ms-request-id': 'c3b6d9923a4d8ad49482809337b1c05e',
  date: 'Wed, 08 Apr 2015 23:38:42 GMT' });
 return result; },
function (nock) {
var result =
nock('https://management.core.windows.net:443')
  .filteringRequestBody(function (path) { return '*';})
.put('/5e7d1bb6-4953-44fe-8a54-43fbdb53b989/services/mobileservices/mobileservices/clitestnode1232/apis/testapi', '*')
  .reply(200, "", { 'cache-control': 'no-cache',
  pragma: 'no-cache',
  'transfer-encoding': 'chunked',
  expires: '-1',
  server: '1.0.6198.213 (rd_rdfe_stable.150402-1703) Microsoft-HTTPAPI/2.0',
  'x-ms-servedbyregion': 'ussouth3',
  'strict-transport-security': 'max-age=31536000; includeSubDomains',
  'x-powered-by': 'ASP.NET',
  'x-ms-request-id': 'b307cfe8fc5c825183ad605b791174e1',
  date: 'Wed, 08 Apr 2015 23:38:49 GMT' });
 return result; }]];


text:
namespace Cofoundry.Core.Time.Mocks;

/// <summary>
/// IDateTimeService implementation with a detemanistic time value
/// that can be altered as needed.
/// </summary>
public class MockDateTimeService : IDateTimeService
{
    public MockDateTimeService() { }
    public MockDateTimeService(DateTimeOffset mockDateTime)
    {
        MockDateTime = mockDateTime;
    }
    public DateTimeOffset? MockDateTime { get; set; }

    public DateTimeOffset OffsetUtcNow()
    {
        return MockDateTime ?? DateTimeOffset.UtcNow;
    }

    public DateTime UtcNow()
    {
        return OffsetUtcNow().UtcDateTime;
    }
}


text:
package index

import (
	"fmt"
	"reflect"

	"github.com/golang/mock/gomock"
)

// BatchMatcher matches a `Batch`.
type BatchMatcher interface {
	gomock.Matcher
}

// NewBatchMatcher returns a new BatchMatcher.
func NewBatchMatcher(b Batch) BatchMatcher {
	return batchMatcher{b}
}

type batchMatcher struct {
	b Batch
}

func (bm batchMatcher) Matches(x interface{}) bool {
	return reflect.DeepEqual(bm.b, x)
}

func (bm batchMatcher) String() string {
	return fmt.Sprintf("BatchMatcher: %v", bm.b)
}


text:
from django.core.paginator import Paginator

def paginate(queue, per_page):
    paginator = Paginator(queue, per_page)

    for num in paginator.page_range:
        yield paginator.page(num)


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace DScript.Context.Variables
{
    [Serializable]
    public class VariableAlreadyDefinedException : Exception
    {
        public VariableAlreadyDefinedException()
            : base()
        {
        }

        public VariableAlreadyDefinedException(string message)
            : base(message)
        {
        }

        public VariableAlreadyDefinedException(string message, Exception inner)
            : base(message, inner)
        {
        }
    }
}


text:
namespace Analysis {

namespace Flat {

  // Given a flat profile file, correlate metrics for the events contained
  // therein with the object code instructions
  void
  correlateWithObject(const Prof::Metric::Mgr& metricMgr,
		      // ----------------------------------------------
		      std::ostream& os,
		      // show source code lines
		      bool srcCode,
		      // show procs that match one of the globs
		      const std::vector<std::string>& procPruneGlobs,
		      // show procs with at least one metric total >= threshold
		      uint64_t procPruneThreshold);

} // namespace Flat

} // namespace Analysis

//****************************************************************************

#endif // Analysis_Flat_ObjCorrelation_hpp


text:
WAMR Go binding: Embedding WAMR in Go guideline
===============================================

This Go library uses CGO to consume the runtime APIs of the WAMR project which are defined in [core/iwasm/include/wasm_export.h](../../core/iwasm/include/wasm_export.h). The API details are available in the header files.

## Installation

### Installing from the source code

Installing from local source tree is in _development mode_.

Run `./build.sh` in this folder to build the package, which builds the WAMR runtime library firstly and then builds the Go binding library.

Run `./build.sh` under `samples` folder to build and test the sample.

```bash
cd samples
./build.sh
```

## Supported APIs

All the embedding APIs supported are defined under folder [wamr](./wamr).

### Runtime APIs

```Go
func Runtime() *_Runtime
func (self *_Runtime) FullInit(alloc_with_pool bool, heap_buf []byte,
                               max_thread_num uint) error
func (self *_Runtime) Init() error
func (self *_Runtime) Destroy()
func (self *_Runtime) SetLogLevel(level LogLevel)
func (self *_Runtime) Malloc(size uint32) *uint8
func (self *_Runtime) Free(ptr *uint8)
```

### Module APIs

```Go
func NewModule(wasmBytes []byte) (*Module, error)
func (self *Module) Destroy()
func (self *Module) SetWasiArgs(dirList [][]byte, mapDirList [][]byte,
                                env [][]byte, argv[][]byte)
func (self *Module) SetWasiArgsEx(dirList [][]byte, mapDirList [][]byte,
                                env [][]byte, argv[][]byte,
                                stdinfd int, stdoutfd int, stderrfd int)
func (self *Module) SetWasiAddrPool(addrPool [][]byte)
```

### Instance APIs

```Go
func NewInstance(module *Module,
                 stackSize uint, heapSize uint) (*Instance, error)
func (self *Instance) Destroy()
func (self *Instance) CallFunc(funcName string,
                               argc uint32, args []uint32) error
func (self *Instance) CallFuncV(funcName string,
                                num_results uint32, results []interface{},
                                args ... interface{}) error
func (self *Instance) GetException() string
func (self Instance) ModuleMalloc(size uint32) (uint32, *uint8)
func (self Instance) ModuleFree(offset uint32)
func (self Instance) ValidateAppAddr(app_offset uint32, size uint32) bool
func (self Instance) ValidateNativeAddr(native_ptr *uint8, size uint32) bool
func (self Instance) AddrAppToNative(app_offset uint32) *uint8
func (self Instance) AddrNativeToApp(native_ptr *uint8) uint32
func (self Instance) GetAppAddrRange(app_offset uint32) (bool, uint32, uint32)
func (self Instance) GetNativeAddrRange(native_ptr *uint8) (bool, *uint8, *uint8)
func (self Instance) DumpMemoryConsumption()
func (self Instance) DumpCallStack()
```

## Sample codes

```Go
    var module *wamr.Module
    var instance *wamr.Instance
    var results []interface{}
    var err error

    /* Runtime initialization */
    err = wamr.Runtime().FullInit(false, nil, 1)

    /* Read WASM/AOT file into a memory buffer */
    wasmBytes := read_wasm_binary_to_buffer(...)

    /* Load WASM/AOT module from the memory buffer */
    module, err = wamr.NewModule(wasmBytes)

    /* Create WASM/AOT instance from the module */
    instance, err = wamr.NewInstance(module, 16384, 16384)

    /* Call the `fib` function */
    results = make([]interface{}, 1, 1)
    err = instance.CallFuncV("fib", 1, results, (int32)32)
    fmt.Printf("fib(32) return: %d\n", results[0].(int32));

    /* Destroy runtime */
    wamr.Runtime().Destroy()
```

More samples can be found in [test.go](./samples/test.go)


text:
module.exports = {
    ignores: ["subdir/subsubdir"]
};


text:
@class DVTObservingToken, IDEProvisioningProfileDisplayGroup, IDEProvisioningProfileDownloaderWindowViewController, IDEProvisioningSliceConfiguration, NSButton, NSLayoutConstraint, NSOperationQueue, NSOrderedSet, NSPopUpButton, NSPopover, NSString, NSTextField;
@protocol IDESigningEditorProfileDataSource;

@interface IDEProvisioningProfileSelectionViewController : IDEViewController <NSPopoverDelegate, NSMenuDelegate>
{
    id <IDESigningEditorProfileDataSource> _dataSource;
    NSPopUpButton *_profilePopUpButton;
    NSTextField *_profileLabel;
    NSTextField *_profileLabelLabel;
    NSButton *_profileInfoButton;
    NSLayoutConstraint *_infoButtonProfilePopUpButtonHorizontalSpaceConstraint;
    NSLayoutConstraint *_infoButtonProfileLabelHorizontalSpaceConstraint;
    NSLayoutConstraint *_profilePopUpLeadingConstraint;
    NSLayoutConstraint *_profilePopUpWidthConstraint;
    NSLayoutConstraint *_profileLabelLeadingConstraint;
    NSLayoutConstraint *_viewTopConstraint;
    NSLayoutConstraint *_sliceHeightConstraint;
    NSPopover *_infoPopover;
    NSOperationQueue *_locateProfilesQueue;
    NSOrderedSet *_provisioningProfiles;
    NSOrderedSet *_ineligibleProvisioningProfiles;
    IDEProvisioningProfileDisplayGroup *_displayGroup;
    DVTObservingToken *_repairBusyObserver;
    IDEProvisioningSliceConfiguration *_configuration;
    IDEProvisioningProfileDownloaderWindowViewController *_downloaderWindowViewController;
}

- (void).cxx_destruct;
@property(retain, nonatomic) IDEProvisioningProfileDownloaderWindowViewController *downloaderWindowViewController; // @synthesize downloaderWindowViewController=_downloaderWindowViewController;
@property(retain, nonatomic) IDEProvisioningSliceConfiguration *configuration; // @synthesize configuration=_configuration;
@property(retain, nonatomic) DVTObservingToken *repairBusyObserver; // @synthesize repairBusyObserver=_repairBusyObserver;
@property(retain, nonatomic) IDEProvisioningProfileDisplayGroup *displayGroup; // @synthesize displayGroup=_displayGroup;
@property(retain, nonatomic) NSOrderedSet *ineligibleProvisioningProfiles; // @synthesize ineligibleProvisioningProfiles=_ineligibleProvisioningProfiles;
@property(retain, nonatomic) NSOrderedSet *provisioningProfiles; // @synthesize provisioningProfiles=_provisioningProfiles;
@property(retain, nonatomic) NSOperationQueue *locateProfilesQueue; // @synthesize locateProfilesQueue=_locateProfilesQueue;
@property(retain, nonatomic) NSPopover *infoPopover; // @synthesize infoPopover=_infoPopover;
@property(retain) NSLayoutConstraint *sliceHeightConstraint; // @synthesize sliceHeightConstraint=_sliceHeightConstraint;
@property(retain) NSLayoutConstraint *viewTopConstraint; // @synthesize viewTopConstraint=_viewTopConstraint;
@property(retain) NSLayoutConstraint *profileLabelLeadingConstraint; // @synthesize profileLabelLeadingConstraint=_profileLabelLeadingConstraint;
@property(retain) NSLayoutConstraint *profilePopUpWidthConstraint; // @synthesize profilePopUpWidthConstraint=_profilePopUpWidthConstraint;
@property(retain) NSLayoutConstraint *profilePopUpLeadingConstraint; // @synthesize profilePopUpLeadingConstraint=_profilePopUpLeadingConstraint;
@property(retain) NSLayoutConstraint *infoButtonProfileLabelHorizontalSpaceConstraint; // @synthesize infoButtonProfileLabelHorizontalSpaceConstraint=_infoButtonProfileLabelHorizontalSpaceConstraint;
@property(retain) NSLayoutConstraint *infoButtonProfilePopUpButtonHorizontalSpaceConstraint; // @synthesize infoButtonProfilePopUpButtonHorizontalSpaceConstraint=_infoButtonProfilePopUpButtonHorizontalSpaceConstraint;
@property(retain) NSButton *profileInfoButton; // @synthesize profileInfoButton=_profileInfoButton;
@property(retain) NSTextField *profileLabelLabel; // @synthesize profileLabelLabel=_profileLabelLabel;
@property(retain) NSTextField *profileLabel; // @synthesize profileLabel=_profileLabel;
@property(retain) NSPopUpButton *profilePopUpButton; // @synthesize profilePopUpButton=_profilePopUpButton;
@property(retain, nonatomic) id <IDESigningEditorProfileDataSource> dataSource; // @synthesize dataSource=_dataSource;
- (void)primitiveInvalidate;
- (void)menuNeedsUpdate:(id)arg1;
- (void)clickedImportProfileButton:(id)arg1;
- (void)clickedProfileInfoButton:(id)arg1;
- (void)profileSelectionDidChangeOnPopUpButton:(id)arg1;
- (void)downloadProfile;
- (void)importProfile;
- (void)displayImportProfileAlertForError:(id)arg1;
- (void)updateProvisioningProfileSelection;
- (void)selectUnknownProvisioningItemForDisplayName:(id)arg1 showWithRedText:(BOOL)arg2;
- (void)updateProvisioningProfiles;
- (void)updateElementVisibility;
- (void)startObservations;
- (void)viewDidLoad;
- (id)initWithDataSource:(id)arg1 configuration:(id)arg2;

// Remaining properties
@property(readonly, copy) NSString *debugDescription;
@property(readonly, copy) NSString *description;
@property(readonly) unsigned long long hash;
@property(readonly) Class superclass;

@end


text:
layout: recipe
time: 30 minutes
from: Our kitchen
title: Asparagus, Chicken and Parmesan cream
category: Pasta
---

Ingredients:
------------
* 1 chicken breast of reasonable size, chopped into 1 cubic inch chunks
* 1 bunch asparagus of reasonable size, also chopped
* Some olive oil
* 1 1/2 tbsp garlic
* 2 tsp salt
* 1 tbsp pepper
* 1 tsp thyme
* 1 package (15 oz?) penne pasta
* 2/3 cup cream
* 1 cup shredded parmesan

<br>

Directions:
-----------

1. First, chop chicken and asparagus
2. Fry chicken and asparagus in olive oil with spices (we use a wok, cause there's a lot of chicken). They take roughly the same time to cook, so we put them in together.
3. Meanwhile, bring about 5 quarts of water to boil, and cook pasta
4. Drain pasta, and add chicken-asparagus mixture once finished.
5. Stir in cream and parmesan
6. Enjoy


text:
if [ -z "$1" ]
then
    echo "Please provide a lunch option."
    return
fi

PRODUCTS=$1

for product in $PRODUCTS
do
    echo $product
done

echo $(echo $PRODUCTS | wc -w) Products

unset PUBLISHED_RECOVERIES

MCP=$(which mcp)
if [ -z "$MCP" ]
then
    NO_UPLOAD=true
fi

function mcpguard () {
    if [ -z $NO_UPLOAD ]
    then
        mcp $1 $2
        md5sum $1 > $1.md5sum.txt
        mcp $1.md5sum.txt $2.md5sum.txt
    fi
}

VERSION=$(cat bootable/recovery/Android.mk | grep RECOVERY_VERSION | grep RECOVERY_NAME | awk '{ print $4 }' | sed s/v//g)
echo Recovery Version: $VERSION

for lunchoption in $PRODUCTS
do
    lunch $lunchoption
    if [ -z $NO_CLEAN ]
    then
        rm -rf $OUT/obj/EXECUTABLES/recovery_intermediates
        rm -rf $OUT/recovery*
        rm -rf $OUT/root*
    fi
    DEVICE_NAME=$(echo $TARGET_PRODUCT | sed s/samsung_// | sed s/koush_// | sed s/aosp_// |  sed s/motorola// | sed s/huawei_// | sed s/htc_// | sed s/_us// | sed s/cyanogen_// | sed s/generic_// | sed s/full_//)
    PRODUCT_NAME=$(basename $OUT)
    make -j16 recoveryzip
    RESULT=$?
    if [ $RESULT != "0" ]
    then
        echo build error!
        break
    fi
    mcpguard $OUT/recovery.img recoveries/recovery-clockwork-$VERSION-$DEVICE_NAME.img
    mcpguard $OUT/utilities/update.zip recoveries/recovery-clockwork-$VERSION-$DEVICE_NAME.zip

    if [ -f "ROMManagerManifest/devices.rb" ]
    then
        pushd ROMManagerManifest
        ruby devices.rb $DEVICE_NAME $VERSION $lunchoption
        popd
    fi
done

for published_recovery in $PUBLISHED_RECOVERIES
do
    echo $published_recovery
done


text:
package io.hosuaby.cakemold;

import static org.assertj.core.api.Assertions.assertThat;

import io.hosuaby.cakemold.pojos.Being;
import io.hosuaby.cakemold.pojos.Fool;
import io.hosuaby.cakemold.pojos.Hermit;
import io.hosuaby.cakemold.pojos.Person;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;

public class PojoBuilderTest {

  @Rule
  public ExpectedException expectedException = ExpectedException.none();

  @Test
  public void testNominalScenario() {
    Person person = CakeMold.of(Person.class)
        .set("firstName", "Bob")
        .set("lastName", "SquarePants")
        .set("email", "sponge.bob@bikinibottom.io")
        .set("age", 22)
        .cook();

    assertThat(person)
        .hasFieldOrPropertyWithValue("firstName", "Bob")
        .hasFieldOrPropertyWithValue("lastName", "SquarePants")
        .hasFieldOrPropertyWithValue("email", "sponge.bob@bikinibottom.io")
        .hasFieldOrPropertyWithValue("age", 22);
  }

  @Test
  public void testBuildClassWithNoPublicConstructor() {
    expectedException.expect(RecipeException.class);
    expectedException.expectMessage(String.format(
        RecipeException.NO_PUBLIC_NULLARY_CONSTRUCTOR,
        Hermit.class.getName()));

    CakeMold.of(Hermit.class)
        .set("nickname", "Tudor")
        .cook();
  }

  @Test
  public void testBuildAbstractClass() {
    expectedException.expect(RecipeException.class);
    expectedException.expectMessage(String.format(
        RecipeException.ABSTRACT_CLASS_INSTANTIATION,
        Being.class.getName()));

    CakeMold.of(Being.class)
        .set("members", 4)
        .cook();
  }

  @Test
  public void testBuildClassWithExceptionInConstructor() {
    expectedException.expect(RecipeException.class);
    expectedException.expectMessage(String.format(
        RecipeException.EXCEPTION_IN_CONSTRUCTOR,
        Fool.class.getName()));

    CakeMold.of(Fool.class)
        .set("favoriteToy", "ball")
        .cook();
  }

  @Test
  public void testBuildClass_noSetterFound() {
    expectedException.expect(RecipeException.class);
    expectedException.expectMessage(String.format(
        RecipeException.NO_PUBLIC_SETTER, "setNickname"));

    Person person = CakeMold.of(Person.class)
        .set("firstName", "Bob")
        .set("lastName", "SquarePants")
        .set("email", "sponge.bob@bikinibottom.io")
        .set("age", 22)
        .set("nickname", "Crazy sponge")
        .cook();
  }

  @Test
  public void testBuildClass_setterNotPublic() {
    expectedException.expect(RecipeException.class);
    expectedException.expectMessage(String.format(
        RecipeException.NO_PUBLIC_SETTER, "setHappiness"));

    Person person = CakeMold.of(Person.class)
        .set("firstName", "Bob")
        .set("lastName", "SquarePants")
        .set("email", "sponge.bob@bikinibottom.io")
        .set("age", 22)
        .set("happiness", true)
        .cook();
  }

  @Test
  public void testBuildClass_exceptionInSetter() {
    expectedException.expect(RecipeException.class);
    expectedException.expectMessage(String.format(
        RecipeException.EXCEPTION_IN_SETTER, "setFavoriteToy"));

    Person person = CakeMold.of(Person.class)
        .set("firstName", "Bob")
        .set("lastName", "SquarePants")
        .set("email", "sponge.bob@bikinibottom.io")
        .set("age", 22)
        .set("favoriteToy", "Soap bubbles")
        .cook();
  }

}


text:
<!DOCTYPE html>

  <meta charset="utf-8">
  <base data-ice="baseUrl" href="../../">
  <title data-ice="title">src/Civ5SaveProperty.js | civ5save</title>
  <link type="text/css" rel="stylesheet" href="css/style.css">
  <link type="text/css" rel="stylesheet" href="css/prettify-tomorrow.css">

<meta name="description" content="Library for working with Civilization V save files"><meta property="twitter:card" content="summary"><meta property="twitter:title" content="civ5save"><meta property="twitter:description" content="Library for working with Civilization V save files">

  Home

  Reference
  Source

    <input class="search-input">

CCiv5Save

CInvalidSignatureError

CParseError

src/Civ5SaveProperty.js

/**
 * @ignore
 */
export default class Civ5SaveProperty {
  /**
   * @ignore
   */
  constructor(byteOffset, length) {
    /**
     * @ignore
     */
    this.byteOffset = byteOffset;
    /**
     * @ignore
     */
    this.length = length;
  }
}

  Generated by ESDoc(1.1.0)


text:
package com.hazelcast.client.cache.impl.nearcache;

import com.hazelcast.cache.ICache;
import com.hazelcast.client.impl.protocol.ClientMessage;
import com.hazelcast.client.impl.protocol.codec.CacheAddNearCacheInvalidationListenerCodec;
import com.hazelcast.client.impl.spi.EventHandler;
import com.hazelcast.internal.serialization.Data;

import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.UUID;
import java.util.concurrent.atomic.AtomicLong;

class ClientCacheInvalidationListener
        extends CacheAddNearCacheInvalidationListenerCodec.AbstractEventHandler
        implements EventHandler<ClientMessage> {

    private final AtomicLong invalidationCount = new AtomicLong();
    private final List<String> singleInvalidationEventsLog = new ArrayList<>();

    public long getInvalidationCount() {
        return invalidationCount.get();
    }

    public void resetInvalidationCount() {
        synchronized (singleInvalidationEventsLog) {
            singleInvalidationEventsLog.clear();
        }
        invalidationCount.set(0);
    }

    static ClientCacheInvalidationListener createInvalidationEventHandler(ICache clientCache) {
        ClientCacheInvalidationListener invalidationListener = new ClientCacheInvalidationListener();
        ((NearCachedClientCacheProxy) clientCache).addNearCacheInvalidationListener(invalidationListener);

        return invalidationListener;
    }

    @Override
    public void handleCacheInvalidationEvent(String name, Data key, UUID sourceUuid, UUID partitionUuid, long sequence) {
        synchronized (singleInvalidationEventsLog) {
            singleInvalidationEventsLog.add(name + ":" + sourceUuid + ":" + partitionUuid + ":" + sequence);
        }
        invalidationCount.incrementAndGet();
    }

    @Override
    public void handleCacheBatchInvalidationEvent(String name, Collection<Data> keys, Collection<UUID> sourceUuids,
                                                  Collection<UUID> partitionUuids, Collection<Long> sequences) {
        invalidationCount.addAndGet(keys.size());
    }

    // used in tests
    List<String> getSingleInvalidationEventsLog() {
        synchronized (singleInvalidationEventsLog) {
            return new ArrayList<>(singleInvalidationEventsLog);
        }
    }
}


text:
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
<title>Incomplete Beta Functions</title>
<link rel="stylesheet" href="../../math.css" type="text/css">
<meta name="generator" content="DocBook XSL Stylesheets V1.77.1">
<link rel="home" href="../../index.html" title="Math Toolkit 2.3.0">
<link rel="up" href="../sf_beta.html" title="Beta Functions">
<link rel="prev" href="beta_function.html" title="Beta">
<link rel="next" href="ibeta_inv_function.html" title="The Incomplete Beta Function Inverses">

Home
Libraries
People
FAQ
More

Incomplete Beta
      Functions

        Synopsis

#include <boost/math/special_functions/beta.hpp>

namespace boost{ namespace math{

template <class T1, class T2, class T3>
calculated-result-type ibeta(T1 a, T2 b, T3 x);

template <class T1, class T2, class T3, class Policy>
calculated-result-type ibeta(T1 a, T2 b, T3 x, const Policy&);

template <class T1, class T2, class T3>
calculated-result-type ibetac(T1 a, T2 b, T3 x);

template <class T1, class T2, class T3, class Policy>
calculated-result-type ibetac(T1 a, T2 b, T3 x, const Policy&);

template <class T1, class T2, class T3>
calculated-result-type beta(T1 a, T2 b, T3 x);

template <class T1, class T2, class T3, class Policy>
calculated-result-type beta(T1 a, T2 b, T3 x, const Policy&);

template <class T1, class T2, class T3>
calculated-result-type betac(T1 a, T2 b, T3 x);

template <class T1, class T2, class T3, class Policy>
calculated-result-type betac(T1 a, T2 b, T3 x, const Policy&);

}} // namespaces

        Description

        There are four incomplete
        beta functions : two are normalised versions (also known as regularized
        beta functions) that return values in the range [0, 1], and two are non-normalised
        and return values in the range [0, beta(a,
        b)]. Users interested in statistical applications should use the normalised
        (or regularized
        ) versions (ibeta and ibetac).

        All of these functions require 0 <= x <= 1.

        The normalized functions ibeta
        and ibetac require
        a,b >= 0, and in addition that not both a
        and b are zero.

        The functions beta
        and betac require
        a,b > 0.

        The return type of these functions is computed using the result
        type calculation rules when T1, T2 and T3 are different
        types.

        The final Policy argument is optional and can
        be used to control the behaviour of the function: how it handles errors,
        what level of precision to use etc. Refer to the policy
        documentation for more details.

template <class T1, class T2, class T3>
calculated-result-type ibeta(T1 a, T2 b, T3 x);

template <class T1, class T2, class T3, class Policy>
calculated-result-type ibeta(T1 a, T2 b, T3 x, const Policy&);

        Returns the normalised incomplete beta function of a, b and x:

template <class T1, class T2, class T3>
calculated-result-type ibetac(T1 a, T2 b, T3 x);

template <class T1, class T2, class T3, class Policy>
calculated-result-type ibetac(T1 a, T2 b, T3 x, const Policy&);

        Returns the normalised complement of the incomplete beta function of a, b
        and x:

template <class T1, class T2, class T3>
calculated-result-type beta(T1 a, T2 b, T3 x);

template <class T1, class T2, class T3, class Policy>
calculated-result-type beta(T1 a, T2 b, T3 x, const Policy&);

        Returns the full (non-normalised) incomplete beta function of a, b and x:

template <class T1, class T2, class T3>
calculated-result-type betac(T1 a, T2 b, T3 x);

template <class T1, class T2, class T3, class Policy>
calculated-result-type betac(T1 a, T2 b, T3 x, const Policy&);

        Returns the full (non-normalised) complement of the incomplete beta function
        of a, b and x:

        Accuracy

        The following tables give peak and mean relative errors in over various domains
        of a, b and x, along with comparisons to the GSL-1.9
        and Cephes libraries.
        Note that only results for the widest floating-point type on the system are
        given as narrower types have effectively
        zero error.

        Note that the results for 80 and 128-bit long doubles are noticeably higher
        than for doubles: this is because the wider exponent range of these types
        allow more extreme test cases to be tested. For example expected results
        that are zero at double precision, may be finite but exceptionally small
        with the wider exponent range of the long double types.

Table 6.18. Error rates for ibeta

<colgroup>
<col>
<col>
<col>
<col>
<col>
</colgroup>

                  Microsoft Visual C++ version 12.0
 Win32
 double

                  GNU C++ version 5.1.0
 linux
 double

                  GNU C++ version 5.1.0
 linux
 long double

                  Sun compiler version 0x5130
 Sun Solaris
 long double

                  Incomplete Beta Function: Small Values

                  Max = 9.42ε (Mean = 2.24ε)

                  Max = 0ε (Mean = 0ε)

 (GSL
                  1.16: Max = 682ε (Mean = 32.6ε))
 (Rmath
                  3.0.2: Max = 22.9ε (Mean = 3.35ε))
 (Cephes:
                  Max = 22.7ε (Mean = 1.69ε))

                  Max = 6.27ε (Mean = 1.7ε)

                  Max = 21.3ε (Mean = 2.74ε)

                  Incomplete Beta Function: Medium Values

                  Max = 108ε (Mean = 16.3ε)

                  Max = 0ε (Mean = 0ε)

 (GSL
                  1.16: Max = 690ε (Mean = 151ε))
 (Rmath
                  3.0.2: Max = 232ε (Mean = 27.9ε))
 (Cephes:
                  Max = 1.55e+03ε (Mean = 121ε))

                  Max = 51.4ε (Mean = 12ε)

                  Max = 124ε (Mean = 18.4ε)

                  Incomplete Beta Function: Large and Diverse Values

                  Max = 1.19e+003ε (Mean = 59.5ε)

                  Max = 1.26ε (Mean = 0.063ε)

                  (GSL 1.16: Max = 3.9e+05ε (Mean = 1.82e+04ε)
                  And
                  other failures.)
 (Rmath 3.0.2:
                  Max = 574ε (Mean = 49.4ε))
 (Cephes: Max
                  = 5.92e+05ε (Mean = 2.17e+04ε))

                  Max = 1.96e+04ε (Mean = 997ε)

                  Max = 4.98e+04ε (Mean = 2.07e+03ε)

                  Incomplete Beta Function: Small Integer Values

                  Max = 3.69ε (Mean = 0.765ε)

                  Max = 0ε (Mean = 0ε)

 (GSL
                  1.16: Max = 254ε (Mean = 50.9ε))
 (Rmath
                  3.0.2: Max = 62.2ε (Mean = 8.95ε))
 (Cephes:
                  Max = 7.96ε (Mean = 1.3ε))

                  Max = 4.45ε (Mean = 0.814ε)

                  Max = 44.5ε (Mean = 10.1ε)

Table 6.19. Error rates for ibetac

<colgroup>
<col>
<col>
<col>
<col>
<col>
</colgroup>

                  Microsoft Visual C++ version 12.0
 Win32
 double

                  GNU C++ version 5.1.0
 linux
 double

                  GNU C++ version 5.1.0
 linux
 long double

                  Sun compiler version 0x5130
 Sun Solaris
 long double

                  Incomplete Beta Function: Small Values

                  Max = 6.56ε (Mean = 1.88ε)

                  Max = 0ε (Mean = 0ε)

 (Rmath
                  3.0.2: Max = 22.4ε (Mean = 3.67ε))

                  Max = 8.47ε (Mean = 1.68ε)

                  Max = 13.8ε (Mean = 2.69ε)

                  Incomplete Beta Function: Medium Values

                  Max = 56.2ε (Mean = 14.1ε)

                  Max = 0ε (Mean = 0ε)

 (Rmath
                  3.0.2: Max = 204ε (Mean = 25.8ε))

                  Max = 75.3ε (Mean = 11.3ε)

                  Max = 132ε (Mean = 19.8ε)

                  Incomplete Beta Function: Large and Diverse Values

                  Max = 1.87e+003ε (Mean = 93.8ε)

                  Max = 0.981ε (Mean = 0.0638ε)

 (Rmath 3.0.2: Max = 889ε (Mean = 68.4ε))

                  Max = 3.45e+04ε (Mean = 1.32e+03ε)

                  Max = 4.26e+04ε (Mean = 1.54e+03ε)

                  Incomplete Beta Function: Small Integer Values

                  Max = 6.37ε (Mean = 1.03ε)

                  Max = 0ε (Mean = 0ε)

 (Rmath
                  3.0.2: Max = 84.6ε (Mean = 18ε))

                  Max = 5.34ε (Mean = 1.11ε)

                  Max = 107ε (Mean = 17.1ε)

Table 6.20. Error rates for beta (incomplete)

<colgroup>
<col>
<col>
<col>
<col>
<col>
</colgroup>

                  Microsoft Visual C++ version 12.0
 Win32
 double

                  GNU C++ version 5.1.0
 linux
 double

                  GNU C++ version 5.1.0
 linux
 long double

                  Sun compiler version 0x5130
 Sun Solaris
 long double

                  Incomplete Beta Function: Small Values

                  Max = 11.1ε (Mean = 2.28ε)

                  Max = 0ε (Mean = 0ε)

                  Max = 12.5ε (Mean = 2.01ε)

                  Max = 18.7ε (Mean = 3.19ε)

                  Incomplete Beta Function: Medium Values

                  Max = 91.1ε (Mean = 12.7ε)

                  Max = 0.568ε (Mean = 0.0342ε)

                  Max = 67.1ε (Mean = 13.3ε)

                  Max = 174ε (Mean = 25ε)

                  Incomplete Beta Function: Large and Diverse Values

                  Max = 635ε (Mean = 29.5ε)

                  Max = 0.999ε (Mean = 0.0399ε)

                  Max = 6.84e+04ε (Mean = 2.76e+03ε)

                  Max = 6.86e+04ε (Mean = 2.79e+03ε)

                  Incomplete Beta Function: Small Integer Values

                  Max = 26.8ε (Mean = 6.61ε)

                  Max = 0.786ε (Mean = 0.0248ε)

                  Max = 10.2ε (Mean = 3.49ε)

                  Max = 51.8ε (Mean = 11ε)

Table 6.21. Error rates for betac

<colgroup>
<col>
<col>
<col>
<col>
<col>
</colgroup>

                  Microsoft Visual C++ version 12.0
 Win32
 double

                  GNU C++ version 5.1.0
 linux
 double

                  GNU C++ version 5.1.0
 linux
 long double

                  Sun compiler version 0x5130
 Sun Solaris
 long double

                  Incomplete Beta Function: Small Values

                  Max = 12ε (Mean = 2.43ε)

                  Max = 0.676ε (Mean = 0.0302ε)

                  Max = 7.75ε (Mean = 1.91ε)

                  Max = 12.6ε (Mean = 3.02ε)

                  Incomplete Beta Function: Medium Values

                  Max = 91.3ε (Mean = 14.8ε)

                  Max = 0.949ε (Mean = 0.0944ε)

                  Max = 63.5ε (Mean = 13.4ε)

                  Max = 97.6ε (Mean = 24.3ε)

                  Incomplete Beta Function: Large and Diverse Values

                  Max = 3.72e+003ε (Mean = 113ε)

                  Max = 1.12ε (Mean = 0.0458ε)

                  Max = 1.05e+05ε (Mean = 5.45e+03ε)

                  Max = 1.04e+05ε (Mean = 5.46e+03ε)

                  Incomplete Beta Function: Small Integer Values

                  Max = 26.7ε (Mean = 6.67ε)

                  Max = 0.586ε (Mean = 0.0314ε)

                  Max = 10.4ε (Mean = 3.54ε)

                  Max = 103ε (Mean = 17.4ε)

        Testing

        There are two sets of tests: spot tests compare values taken from Mathworld's
        online function evaluator with this implementation: they provide
        a basic "sanity check" for the implementation, with one spot-test
        in each implementation-domain (see implementation notes below).

        Accuracy tests use data generated at very high precision (with NTL
        RR class set at 1000-bit precision), using the "textbook"
        continued fraction representation (refer to the first continued fraction
        in the implementation discussion below). Note that this continued fraction
        is not used in the implementation, and therefore we
        have test data that is fully independent of the code.

        Implementation

        This implementation is closely based upon "Algorithm
        708; Significant digit computation of the incomplete beta function ratios",
        DiDonato and Morris, ACM, 1992.

        All four of these functions share a common implementation: this is passed
        both x and y, and can return either p or q where these are related by:

        so at any point we can swap a for b, x for y and p for q if this results
        in a more favourable position. Generally such swaps are performed so that
        we always compute a value less than 0.9: when required this can then be subtracted
        from 1 without undue cancellation error.

        The following continued fraction representation is found in many textbooks
        but is not used in this implementation - it's both slower and less accurate
        than the alternatives - however it is used to generate test data:

        The following continued fraction is due to Didonato
        and Morris, and is used in this implementation when a and b are both
        greater than 1:

        For smallish b and x then a series representation can be used:

        When b << a then the transition from 0 to 1 occurs very close to x
        = 1 and some care has to be taken over the method of computation, in that
        case the following series representation is used:

        Where Q(a,x) is an incomplete
        gamma function. Note that this method relies on keeping a table of
        all the pn  previously computed, which does limit the precision of the method,
        depending upon the size of the table used.

        When a and b are both small integers,
        then we can relate the incomplete beta to the binomial distribution and use
        the following finite sum:

        Finally we can sidestep difficult areas, or move to an area with a more efficient
        means of computation, by using the duplication formulae:

        The domains of a, b and x for which the various methods are used are identical
        to those described in the Didonato
        and Morris TOMS 708 paper.

Copyright © 2006-2010, 2012-2014 Nikhar Agrawal,
      Anton Bikineev, Paul A. Bristow, Marco Guazzone, Christopher Kormanyos, Hubert
      Holin, Bruno Lalande, John Maddock, Johan Råde, Gautam Sewani, Benjamin Sobotta,
      Thijs van den Berg, Daryle Walker and Xiaogang Zhang

        Distributed under the Boost Software License, Version 1.0. (See accompanying
        file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)


text:
#include "vice.h"

#include <assert.h>
#include <stdlib.h>
#include <string.h>

#include "cmdline.h"
#include "lib.h"
#include "log.h"
#include "monitor.h"
#include "monitor_network.h"
#include "montypes.h"
#include "resources.h"
#include "translate.h"
#include "ui.h"
#include "uiapi.h"
#include "util.h"
#include "vicesocket.h"

#ifdef HAVE_NETWORK

#define ADDR_LIMIT(x) ((WORD)(addr_mask(x)))

static vice_network_socket_t * listen_socket = NULL;
static vice_network_socket_t * connected_socket = NULL;

static char * monitor_server_address = NULL;
static int monitor_enabled = 0;

static int monitor_binary_input = 0;

int monitor_network_transmit(const char * buffer, size_t buffer_length)
{
    int error = 0;

    if (connected_socket) {
        size_t len = vice_network_send(connected_socket, buffer, buffer_length, 0);

        if (len != buffer_length) {
            error = 1;
        }
    }

    return error;
}

static void monitor_network_quit(void)
{
    vice_network_socket_close(connected_socket);
    connected_socket = NULL;
}

int monitor_network_receive(char * buffer, size_t buffer_length)
{
    int count = 0;

    do {
        if ( ! connected_socket ) {
            break;
        }

        count = vice_network_receive(connected_socket, buffer, buffer_length, 0);

        if (count < 0) {
            log_message(LOG_DEFAULT, "monitor_network_receive(): vice_network_receive() returned -1, breaking connection");
            monitor_network_quit();
        }

    } while (0);

    return count;
}

static int monitor_network_data_available(void)
{
    int available = 0;

    if (connected_socket != NULL) {
        available = vice_network_select_poll_one(connected_socket);
    }
    else if (listen_socket!= NULL) {
        /* we have no connection yet, allow for connection */

        if (vice_network_select_poll_one(listen_socket)) {
            connected_socket = vice_network_accept(listen_socket);
        }
    }

    return available;
}

void monitor_check_remote(void)
{
    if (monitor_network_data_available())
    {
        monitor_startup_trap();
    }
}

static char * monitor_network_extract_text_command_line(char * pbuffer, int buffer_size, int * pbuffer_pos)
{
    char * cr_start = NULL;
    char * cr_end = NULL;
    char * p = NULL;

    do {
        cr_start = strchr(pbuffer, '\n');
        cr_end   = strchr(pbuffer, '\r');

        if (cr_start || cr_end) {
            if (cr_start == NULL) {
                cr_start = cr_end;
            }
            else if (cr_end == NULL) {
                cr_end = cr_start;
            }
            else if (cr_end < cr_start) {
                char * cr_temp = cr_end;
                cr_end = cr_start;
                cr_start = cr_temp;
            }

            assert(cr_start != NULL);
            assert(cr_end != NULL);
        }

        if (cr_start) {
            assert(cr_end != NULL);

            *cr_start = 0;
            p = lib_stralloc(pbuffer);

            memmove(pbuffer, cr_end + 1, strlen(cr_end + 1) );

            *pbuffer_pos -= (int)(strlen(p) + (cr_end - cr_start) + 1);
            pbuffer[*pbuffer_pos] = 0;
            break;
        }
        else if (*pbuffer_pos >= buffer_size) {
            /* we have a command that is too large:
             * process it anyway, so the sender knows something is wrong
             */
            p = lib_stralloc(pbuffer);
            *pbuffer_pos = 0;
            pbuffer[0] = 0;
            break;
        }

    } while (0);

    return p;
}

/*
    The binary remote monitor commands are injected into the "normal" commands.
    The remote monitor detects a binary command because it starts with ASCII STX
    (0x02). After this, there is one byte telling the length of the command. The
    next byte describes the command. Currently, only 0x01 is implemented which
    is "memdump".

    Note that the command length byte (the one after STX) does *not* count the
    STX, the command length nor the command byte.

    Also note that there is no termination character. The command length acts as
    synchronisation point.

    For the memdump command, the next bytes are as follows:
    1. start address low
    2. start address high
    3. end address low
    4. end address high
    5. memspace

    The memspace describes which part of the computer you want to read:
    0 --> the computer (C64)
    1 --> drive 8, 2 --> drive 9, 3 --> drive 10, 4 --> drive 11

    So, for a memdump of 0xa0fe to 0xa123, you have to issue the bytes
    (in this order):

    0x02 (STX), 0x05 (command length), 0x01 (command: memdump), 0xfe (SA low),
    0xa0 (SA high), 0x23 (EA low), 0xa1 (EA high), 0x00 (computer memspace)

    The answer looks as follows:

    byte 0: STX (0x02)
    byte 1: answer length low
    byte 2: answer length (bits 8-15)
    byte 3: answer length (bits 16-23)
    byte 4: answer length (bits 24-31, that is, high)
    byte 5: error code
    byte 6 - (answer length+6): the binary answer
    [...]

    Error codes are currently:
    0x00: ok, everything worked
    0x80: command length is not long enough for this specific command
    0x81: an invalid parameter occurred

    If an error stats but "ok" occurs, then VICE will output more details for
    the reason into its log. [...]
*/

#define ASC_STX 0x02
#define MON_CMD_MEMDUMP 1

#define MON_ERR_OK            0
#define MON_ERR_CMD_TOO_SHORT 0x80  /* command length is not enough for this command */
#define MON_ERR_INVALID_PARAMETER 0x81  /* command has invalid parameters */

static void monitor_network_binary_answer(unsigned int length, unsigned char errorcode, unsigned char * answer)
{
    unsigned char binlength[6];

    binlength[0] = ASC_STX;
    binlength[1] =  length        & 0xFFu;
    binlength[2] = (length >>  8) & 0xFFu;
    binlength[3] = (length >> 16) & 0xFFu;
    binlength[4] = (length >> 24) & 0xFFu;
    binlength[5] = errorcode;

    monitor_network_transmit((char*)binlength, sizeof binlength);

    if (answer != NULL) {
        monitor_network_transmit((char*)answer, length);
    }
}

static void monitor_network_binary_error(unsigned char errorcode)
{
    monitor_network_binary_answer(0, errorcode, NULL);
}

static void monitor_network_process_binary_command(unsigned char * pbuffer, int buffer_size, int * pbuffer_pos, unsigned int command_length)
{
    int command = pbuffer[2];
    int ok = 1;

    switch (command) {
    case MON_CMD_MEMDUMP:
        if (command_length < 5) {
            monitor_network_binary_error(MON_ERR_CMD_TOO_SHORT);
        }
        else {
            unsigned int startaddress = pbuffer[3] | (pbuffer[4] << 8);
            unsigned int endaddress = pbuffer[4] | (pbuffer[5] << 8);

            MEMSPACE memspace = e_default_space;

            switch (pbuffer[5])
            {
            case 0: memspace = e_comp_space;   break;
            case 1: memspace = e_disk8_space;  break;
            case 2: memspace = e_disk9_space;  break;
            case 3: memspace = e_disk10_space; break;
            case 4: memspace = e_disk11_space; break;
            default:
                monitor_network_binary_error(MON_ERR_INVALID_PARAMETER);
                log_message(LOG_DEFAULT, "monitor_network binary memdump: Unknown memspace %u", pbuffer[5]);
                ok = 0;
            }

            if (startaddress >= endaddress) {
                monitor_network_binary_error(MON_ERR_INVALID_PARAMETER);
                log_message(LOG_DEFAULT, "monitor_network binary memdump: wrong start and/or end address %04x - %04x",
                    startaddress, endaddress);

                ok = 0;
            }

            if (ok) {
                unsigned int length = endaddress - startaddress + 1;
                unsigned int i;

                unsigned char * p = lib_malloc(length);

                for (i = 0; i < length; i++) {
                    p[i] = mon_get_mem_val(memspace, (WORD)ADDR_LIMIT(startaddress + i));
                }

                monitor_network_binary_answer(length, MON_ERR_OK, p);
                lib_free(p);
            }
        }
        break;

    default:
        log_message(LOG_DEFAULT, "monitor_network binary command: unknown command %u, skipping command length of %u", command, command_length);
        break;
    }

    *pbuffer_pos = 0;
    pbuffer[0] = 0;
}

char * monitor_network_get_command_line(void)
{
    static char buffer[260] = { 0 };
    static int bufferpos = 0;

    char * p = NULL;

    do {
        int n = monitor_network_receive(buffer + bufferpos, sizeof buffer - bufferpos - 1);

        if (n > 0) {
            bufferpos += n;
        }
        else if (n <= 0) {
            monitor_network_quit();
            break;
        }

        /* check if we got a binary command */
        if (bufferpos == n)
        {
            if (buffer[0] == ASC_STX) {
                monitor_binary_input = 1;
            }
        }

        if (monitor_binary_input) {
            if (bufferpos > 2) {
                /* we already got the length, get it */
                unsigned int command_length = buffer[1];

                if (3 + command_length <= (unsigned int)bufferpos) {
                    monitor_network_process_binary_command((unsigned char*)buffer, sizeof buffer, &bufferpos, command_length);
                    monitor_binary_input = 0;
                }
            }
        }
        else {
            p = monitor_network_extract_text_command_line(buffer, sizeof buffer, &bufferpos);
            if (p) {
                break;
            }
        }

        ui_dispatch_events();

    } while (1);

    return p;
}

static int monitor_network_activate(void)
{
    vice_network_socket_address_t * server_addr = NULL;
    int error = 1;

    do {
        if ( ! monitor_server_address ) {
            break;
        }

        server_addr = vice_network_address_generate(monitor_server_address, 0);
        if ( ! server_addr ) {
            break;
        }

        listen_socket = vice_network_server(server_addr);
        if ( ! listen_socket ) {
            break;
        }

        error = 0;

    } while (0);

   if (server_addr) {
       vice_network_address_close(server_addr);
   }

   return error;
}

static int monitor_network_deactivate(void)
{
    if (listen_socket) {
        vice_network_socket_close(listen_socket);
        listen_socket = NULL;
    }

    return 0;
}

/* ------------------------------------------------------------------------- */

/*! \internal \brief set the network monitor to the enabled or disabled state

 \param val
   if 0, disable the network monitor; else, enable it.

 \param param
   unused

 \return
   0 on success. else -1.
*/
static int set_monitor_enabled(int val, void *param)
{
    if (!val) {
        if (monitor_enabled) {
            if (monitor_network_deactivate() < 0) {
                return -1;
            }
        }
        monitor_enabled = 0;
        return 0;
    } else {
        if (!monitor_enabled) {
            if (monitor_network_activate() < 0) {
                return -1;
            }
        }

        monitor_enabled = 1;
        return 0;
    }
}

/*! \internal \brief set the network address of the network monitor

 \param name
   pointer to a buffer which holds the network server addresss.

 \param param
   unused

 \return
   0 on success, else -1.
*/
static int set_server_address(const char *name, void *param)
{
    if (monitor_server_address != NULL && name != NULL
        && strcmp(name, monitor_server_address) == 0)
        return 0;

    if (monitor_enabled) {
        monitor_network_deactivate();
    }
    util_string_set(&monitor_server_address, name);

    if (monitor_enabled) {
        monitor_network_activate();
    }

    return 0;
}

/*! \brief string resources used by the network monitor module */
static const resource_string_t resources_string[] = {
    { "MonitorServerAddress", "ip4://127.0.0.1:6510", RES_EVENT_NO, NULL,
      &monitor_server_address, set_server_address, NULL },
    { NULL }
};

/*! \brief integer resources used by the network monitor module */
static const resource_int_t resources_int[] = {
    { "MonitorServer", 0, RES_EVENT_STRICT, (resource_value_t)0,
      &monitor_enabled, set_monitor_enabled, NULL },
    { NULL }
};

/*! \brief initialize the network monitor resources
 \return
   0 on success, else -1.

 \remark
   Registers the string and the integer resources
*/
int monitor_network_resources_init(void)
{
    if (resources_register_string(resources_string) < 0)
        return -1;

    return resources_register_int(resources_int);
}

/*! \brief uninitialize the network monitor resources */
void monitor_network_resources_shutdown(void)
{
    monitor_network_deactivate();
    monitor_network_quit();

    lib_free(monitor_server_address);
}

/* ------------------------------------------------------------------------- */

static const cmdline_option_t cmdline_options[] =
{
    { "-remotemonitor", SET_RESOURCE, 0,
      NULL, NULL, "MonitorServer", (resource_value_t)1,
      USE_PARAM_STRING, USE_DESCRIPTION_ID,
      IDCLS_UNUSED, IDCLS_ENABLE_REMOTE_MONITOR,
      NULL, NULL },
    { "+remotemonitor", SET_RESOURCE, 0,
      NULL, NULL, "MonitorServer", (resource_value_t)0,
      USE_PARAM_STRING, USE_DESCRIPTION_ID,
      IDCLS_UNUSED, IDCLS_DISABLE_REMOTE_MONITOR,
      NULL, NULL },
    { "-remotemonitoraddress", SET_RESOURCE, 1,
      NULL, NULL, "MonitorServerAddress", NULL,
      USE_PARAM_ID, USE_DESCRIPTION_ID,
      IDCLS_P_NAME, IDCLS_REMOTE_MONITOR_ADDRESS,
      NULL, NULL },
    { NULL }
};

/*! \brief initialize the command-line options'
 \return
   0 on success, else -1.

 \remark
   Registers the command-line options
*/
int monitor_network_cmdline_options_init(void)
{
    return cmdline_register_options(cmdline_options);
}

int monitor_is_remote(void)
{
    return connected_socket != NULL;
}

ui_jam_action_t monitor_network_ui_jam_dialog(const char *format, ...)
{
    char * txt;

    char init_string[] = "An error occurred: ";
    char end_string[] = "\n";

    va_list ap;
    va_start(ap, format);
    txt = lib_mvsprintf(format, ap);
    va_end(ap);

    monitor_network_transmit(init_string, sizeof init_string - 1);
    monitor_network_transmit(txt, strlen(txt));
    monitor_network_transmit(end_string, sizeof end_string - 1);

    lib_free(txt);

    return UI_JAM_HARD_RESET;
}

#else

int monitor_network_resources_init(void)
{
    return 0;
}

void monitor_network_resources_shutdown(void)
{
}

int monitor_network_cmdline_options_init(void)
{
    return 0;
}

void monitor_check_remote(void)
{
}

int monitor_network_transmit(const char * buffer, size_t buffer_length)
{
    return 0;
}

char * monitor_network_get_command_line(void)
{
    return 0;
}

int monitor_is_remote(void)
{
    return 0;
}

ui_jam_action_t monitor_network_ui_jam_dialog(const char *format, ...)
{
    return UI_JAM_HARD_RESET;
}

#endif


text:
'use strict';

exports.__esModule = true;

var _extends2 = require('babel-runtime/helpers/extends');

var _extends3 = _interopRequireDefault(_extends2);

var _objectWithoutProperties2 = require('babel-runtime/helpers/objectWithoutProperties');

var _objectWithoutProperties3 = _interopRequireDefault(_objectWithoutProperties2);

var _classCallCheck2 = require('babel-runtime/helpers/classCallCheck');

var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);

var _possibleConstructorReturn2 = require('babel-runtime/helpers/possibleConstructorReturn');

var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2);

var _inherits2 = require('babel-runtime/helpers/inherits');

var _inherits3 = _interopRequireDefault(_inherits2);

var _react = require('react');

var _react2 = _interopRequireDefault(_react);

var _propTypes = require('prop-types');

var _propTypes2 = _interopRequireDefault(_propTypes);

var _isRequiredForA11y = require('prop-types-extra/lib/isRequiredForA11y');

var _isRequiredForA11y2 = _interopRequireDefault(_isRequiredForA11y);

var _uncontrollable = require('uncontrollable');

var _uncontrollable2 = _interopRequireDefault(_uncontrollable);

var _Nav = require('./Nav');

var _Nav2 = _interopRequireDefault(_Nav);

var _NavItem = require('./NavItem');

var _NavItem2 = _interopRequireDefault(_NavItem);

var _TabContainer = require('./TabContainer');

var _TabContainer2 = _interopRequireDefault(_TabContainer);

var _TabContent = require('./TabContent');

var _TabContent2 = _interopRequireDefault(_TabContent);

var _bootstrapUtils = require('./utils/bootstrapUtils');

var _ValidComponentChildren = require('./utils/ValidComponentChildren');

var _ValidComponentChildren2 = _interopRequireDefault(_ValidComponentChildren);

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }

var TabContainer = _TabContainer2['default'].ControlledComponent;

var propTypes = {
  /**
   * Mark the Tab with a matching `eventKey` as active.
   *
   * @controllable onSelect
   */
  activeKey: _propTypes2['default'].any,

  /**
   * Navigation style
   */
  bsStyle: _propTypes2['default'].oneOf(['tabs', 'pills']),

  animation: _propTypes2['default'].bool,

  id: (0, _isRequiredForA11y2['default'])(_propTypes2['default'].oneOfType([_propTypes2['default'].string, _propTypes2['default'].number])),

  /**
   * Callback fired when a Tab is selected.
   *
   * ```js
   * function (
   * 	Any eventKey,
   * 	SyntheticEvent event?
   * )
   * ```
   *
   * @controllable activeKey
   */
  onSelect: _propTypes2['default'].func,

  /**
   * Wait until the first "enter" transition to mount tabs (add them to the DOM)
   */
  mountOnEnter: _propTypes2['default'].bool,

  /**
   * Unmount tabs (remove it from the DOM) when it is no longer visible
   */
  unmountOnExit: _propTypes2['default'].bool
};

var defaultProps = {
  bsStyle: 'tabs',
  animation: true,
  mountOnEnter: false,
  unmountOnExit: false
};

function getDefaultActiveKey(children) {
  var defaultActiveKey = void 0;
  _ValidComponentChildren2['default'].forEach(children, function (child) {
    if (defaultActiveKey == null) {
      defaultActiveKey = child.props.eventKey;
    }
  });

  return defaultActiveKey;
}

var Tabs = function (_React$Component) {
  (0, _inherits3['default'])(Tabs, _React$Component);

  function Tabs() {
    (0, _classCallCheck3['default'])(this, Tabs);
    return (0, _possibleConstructorReturn3['default'])(this, _React$Component.apply(this, arguments));
  }

  Tabs.prototype.renderTab = function renderTab(child) {
    var _child$props = child.props,
        title = _child$props.title,
        eventKey = _child$props.eventKey,
        disabled = _child$props.disabled,
        tabClassName = _child$props.tabClassName;

    if (title == null) {
      return null;
    }

    return _react2['default'].createElement(
      _NavItem2['default'],
      {
        eventKey: eventKey,
        disabled: disabled,
        className: tabClassName
      },
      title
    );
  };

  Tabs.prototype.render = function render() {
    var _props = this.props,
        id = _props.id,
        onSelect = _props.onSelect,
        animation = _props.animation,
        mountOnEnter = _props.mountOnEnter,
        unmountOnExit = _props.unmountOnExit,
        bsClass = _props.bsClass,
        className = _props.className,
        style = _props.style,
        children = _props.children,
        _props$activeKey = _props.activeKey,
        activeKey = _props$activeKey === undefined ? getDefaultActiveKey(children) : _props$activeKey,
        props = (0, _objectWithoutProperties3['default'])(_props, ['id', 'onSelect', 'animation', 'mountOnEnter', 'unmountOnExit', 'bsClass', 'className', 'style', 'children', 'activeKey']);

    return _react2['default'].createElement(
      TabContainer,
      {
        id: id,
        activeKey: activeKey,
        onSelect: onSelect,
        className: className,
        style: style
      },
      _react2['default'].createElement(
        'div',
        null,
        _react2['default'].createElement(
          _Nav2['default'],
          (0, _extends3['default'])({}, props, {
            role: 'tablist'
          }),
          _ValidComponentChildren2['default'].map(children, this.renderTab)
        ),
        _react2['default'].createElement(
          _TabContent2['default'],
          {
            bsClass: bsClass,
            animation: animation,
            mountOnEnter: mountOnEnter,
            unmountOnExit: unmountOnExit
          },
          children
        )
      )
    );
  };

  return Tabs;
}(_react2['default'].Component);

Tabs.propTypes = propTypes;
Tabs.defaultProps = defaultProps;

(0, _bootstrapUtils.bsClass)('tab', Tabs);

exports['default'] = (0, _uncontrollable2['default'])(Tabs, { activeKey: 'onSelect' });
module.exports = exports['default'];


text:
@implementation BoatLocation
@synthesize theCoordinate;
@synthesize theHeading;
- (BoatLocation *)initBoatLocation
{
    BoatLocation *boatLocation = [[BoatLocation alloc] init];
    return boatLocation;
}

- (BoatLocation *)initBoatLocationWithCoordinate:(CLLocationCoordinate2D *)boatCoordinate
{
    BoatLocation *boatLocation = [self initBoatLocation];
    boatLocation.theCoordinate->latitude = boatCoordinate->latitude;
    boatLocation.theCoordinate->longitude = boatCoordinate->longitude;
    boatLocation.theHeading = [NSNumber numberWithInt:-1]; // Don't need to consider the heading direction of this boatLocation
    return boatLocation;
}

- (BoatLocation *)initWithCoordinate:(CLLocationCoordinate2D *)boatCoordinate andHeading:(NSNumber *)boatHeading
{
    BoatLocation *boatLocation = [self initBoatLocation];
    boatLocation.theHeading = boatHeading;
    boatLocation.theCoordinate->latitude = boatCoordinate->latitude;
    boatLocation.theCoordinate->longitude = boatCoordinate->longitude;

    return boatLocation;
}
@end


text:
<?php function getBlogData($sort = "n", $id = null, $edit = false) { ?>

	<?php
		include_once 'classes/ParsedownExtra.php';
		$parsedown = new ParsedownExtra();

		if ($edit) {
			$pagesToDisplay = NUM_POSTS_PER_PAGE_EDIT;
		} else {
			$pagesToDisplay = NUM_POSTS_PER_PAGE;
		}

		$skip = isset($_GET['skip']) ? $_GET['skip'] : 0;
		$start = $skip * $pagesToDisplay;
		if ($sort == "b") {
			$results['blogPosts'] = array(Post::getById($id));
			$results['totalPosts'] = 1;
		} elseif ($sort == "t") {
			$results = Post::getByTag($id, $start, $pagesToDisplay);
		} elseif ($sort == "u") {
			$results = Post::getByAuthor($id, $start, $pagesToDisplay);
		} else {
			$results = Post::getList($start, $pagesToDisplay);
		}
		$blogPosts = $results['blogPosts'];
		$totalPosts = $results['totalPosts'];
		foreach ($blogPosts AS $blog) {
			$author = User::getById($blog->user_id);
			$timeString = getTimeString($blog->date_posted);
			$alteredDate = getAlteredTime($blog->date_posted);
	?>

						<a class="editButton" href="?page=edit_blog&action=editpost&id=<?php echo $blog->id; ?>">Edit
						<form action="/actions/editpost.php" method="post">
						<input type="hidden" name="delete" value="Yes">
						<input type="hidden" name="id" value="<?php echo $blog->id; ?>">
						<input type="submit" class="deleteButton" value="Delete">
						</form>

					<?php
					include_once 'appreciation.php';
					getAppreciation($blog->lovable_id, $author->id);
					?>
					<div class="date" title="<?php echo date("j M Y - g:i A", $alteredDate); ?>"><?php echo $timeString; ?>

					<a class="avatar" href="?page=user&u=<?php echo $author->id; ?>">
						<?php
						$user = $author;
						include 'pages/templates/avatar.php';
						?>

<a href="?page=blog_page&b=<?php echo $blog->id; ?>"><?php echo $blog->title; ?>

						◊ Posted by: <?php echo $author->getUsernameBox(); ?>

Tags:
						<?php
							$tags = Tag::getByPostId($blog->id);
							foreach($tags AS $tag) {
						?>
						<a class="tag" href="?page=blog&t=<?php echo $tag->id; ?>"><?php echo $tag->name; ?>
						<?php if(end($tags) != $tag) echo "•"; ?>
						<?php } ?>

						<?php echo $parsedown->text($blog->markdown); ?>

					<?php $totalComments = Comment::getByRoot($blog->commentroot_id)['totalComments']; ?>
					<a class="comments" href="?page=blog_page&b=<?php echo $blog->id; ?>"><?php echo $totalComments; ?> Comment<?php echo ($totalComments != 1) ? "s" : ""; ?>

	<?php
		}
	?>

<?php
return $totalPosts;
} ?>


text:
module Ikra
    module Translator
        class CommandTranslator < Symbolic::Visitor
            def visit_array_stencil_command(command)
                Log.info("Translating ArrayStencilCommand [#{command.unique_id}]")

                super

                num_dims = command.dimensions.size

                # Process dependent computation (receiver), returns [InputTranslationResult]
                input = translate_entire_input(command)

                # Count number of parameters
                num_parameters = command.offsets.size

                # All variables accessed by this block should be prefixed with the unique ID
                # of the command in the environment.
                env_builder = @environment_builder[command.unique_id]

                block_translation_result = Translator.translate_block(
                    block_def_node: command.block_def_node,
                    environment_builder: env_builder,
                    lexical_variables: command.lexical_externals,
                    command_id: command.unique_id,
                    entire_input_translation: input)

                kernel_builder.add_methods(block_translation_result.aux_methods)
                kernel_builder.add_block(block_translation_result.block_source)

                # Compute indices in all dimensions
                index_generators = (0...num_dims).map do |dim_index|
                    index_div = command.dimensions.drop(dim_index + 1).reduce(1, :*)
                    index_mod = command.dimensions[dim_index]

                    if dim_index > 0
                         "(_tid_ / #{index_div}) % #{index_mod}"
                    else
                        # No modulo required for first dimension
                        "_tid_ / #{index_div}"
                    end
                end

                compute_indices = index_generators.map.with_index do |gen, dim_index|
                    "int temp_stencil_dim_#{dim_index} = #{gen};"
                end.join("\n")

                # Check if an index is out of bounds in any dimension
                out_of_bounds_check = Array.new(num_dims) do |dim_index|
                    min_in_dim = command.offsets.map do |offset|
                        offset[dim_index]
                    end.min
                    max_in_dim = command.offsets.map do |offset|
                        offset[dim_index]
                    end.max

                    dim_size = command.dimensions[dim_index]

                    if dim_size.is_a?(String)
                        # This is not a compile-time constant. Pass dimension size as argument
                        # to the kernel.

                        dim_size_expr = "dim_size_#{dim_index}"
                        kernel_builder.add_additional_parameters("int #{dim_size_expr}")
                        kernel_launcher.add_additional_arguments(dim_size)
                    else
                        dim_size_expr = dim_size
                    end

                    "temp_stencil_dim_#{dim_index} + #{min_in_dim} >= 0 && temp_stencil_dim_#{dim_index} + #{max_in_dim} < #{dim_size_expr}"
                end.join(" && ")

                # `previous_result` should be an expression returning the array containing the
                # result of the previous computation.
                previous_result = input.result(0)

                arguments = ["_env_"]

                # Pass values from previous computation that are required by this thread.
                # Reconstruct actual indices from indices for each dimension.
                for i in 0...num_parameters
                    multiplier = 1
                    global_index = []

                    for dim_index in (num_dims - 1).downto(0)
                        global_index.push("(temp_stencil_dim_#{dim_index} + #{command.offsets[i][dim_index]}) * #{multiplier}")

                        next_dim_size = command.dimensions[dim_index]

                        if next_dim_size.is_a?(String)
                            Log.warn("Cannot handle multi-dimensional stencil computations in host sections yet.")
                        else
                            multiplier = multiplier * next_dim_size
                        end
                    end

                    arguments.push("#{previous_result}[#{global_index.join(" + ")}]")
                end

                # Push additional arguments (e.g., index)
                arguments.push(*input.result(1..-1))
                argument_str = arguments.join(", ")
                stencil_computation = block_translation_result.function_name + "(#{argument_str})"

                temp_var_name = "temp_stencil_#{CommandTranslator.next_unique_id}"

                # The following template checks if there is at least one index out of bounds. If
                # so, the fallback value is used. Otherwise, the block is executed.
                command_execution = Translator.read_file(file_name: "stencil_body.cpp", replacements: {
                    "execution" => input.execution,
                    "temp_var" => temp_var_name,
                    "result_type" => command.result_type.to_c_type,
                    "compute_indices" => compute_indices,
                    "out_of_bounds_check" => out_of_bounds_check,
                    "out_of_bounds_fallback" => command.out_of_range_value.to_s,
                    "stencil_computation" => stencil_computation})

                command_translation = build_command_translation_result(
                    execution: command_execution,
                    result: temp_var_name,
                    command: command)

                Log.info("DONE translating ArrayStencilCommand [#{command.unique_id}]")

                return command_translation
            end
        end
    end
end


text:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<title>venice.lib.networkRSB</title>
<meta name="date" content="2015-01-09">
<link rel="stylesheet" type="text/css" href="../../../stylesheet.css" title="Style">

venice.lib.networkRSB

Classes

ClassMatcher

NamedPair

NamedPairList

RSBHandler

RSBNamespaceBuilder

ValueParser