text:
package org.jetbrains.idea.maven.server;

import com.intellij.openapi.util.SystemInfo;
import org.jetbrains.annotations.NotNull;

import java.io.File;
import java.io.IOException;
import java.util.Iterator;
import java.util.Map;
import java.util.Properties;

public class MavenServerUtil {
  private static final Properties mySystemPropertiesCache;

  static {
    Properties res = new Properties();
    res.putAll((Properties)System.getProperties().clone());

    for (Iterator<Object> itr = res.keySet().iterator(); itr.hasNext(); ) {
      String propertyName = itr.next().toString();
      if (propertyName.startsWith("idea.")) {
        itr.remove();
      }
    }

    for (Map.Entry<String, String> entry : System.getenv().entrySet()) {
      String key = entry.getKey();

      if (isMagicalProperty(key)) continue;

      if (SystemInfo.isWindows) {
        key = key.toUpperCase();
      }

      res.setProperty("env." + key, entry.getValue());
    }

    mySystemPropertiesCache = res;
  }

  public static Properties collectSystemProperties() {
    return mySystemPropertiesCache;
  }

  @NotNull
  public static File findMavenBasedir(@NotNull File workingDir) {
    File baseDir = workingDir;
    File dir = workingDir;
    while ((dir = dir.getParentFile()) != null) {
      if (new File(dir, ".mvn").exists()) {
        baseDir = dir;
        break;
      }
    }
    try {
      return baseDir.getCanonicalFile();
    }
    catch (IOException e) {
      return baseDir.getAbsoluteFile();
    }
  }

  private static boolean isMagicalProperty(String key) {
    return key.startsWith("=");
  }
}


text:
<bill session="110" type="h" number="6875" updated="2009-01-09T07:00:01-05:00">
	<status><introduced date="1221105600" datetime="2008-09-11"/></status>

	<introduced date="1221105600" datetime="2008-09-11"/>
	<titles>
		<title type="short" as="introduced">Federal Death Penalty Abolition Act of 2008</title>
		<title type="official" as="introduced">To abolish the death penalty under Federal law.</title>
	</titles>
	<sponsor id="400227"/>
	<cosponsors>
		<cosponsor id="400073" joined="2008-09-11"/>
		<cosponsor id="400080" joined="2008-09-11"/>
		<cosponsor id="400295" joined="2008-09-11"/>
		<cosponsor id="412215" joined="2008-09-11"/>
		<cosponsor id="400198" joined="2008-09-22"/>
		<cosponsor id="400063" joined="2008-09-11"/>
		<cosponsor id="400423" joined="2008-09-11"/>
		<cosponsor id="400130" joined="2008-09-11"/>
		<cosponsor id="400312" joined="2008-09-11"/>
		<cosponsor id="400387" joined="2008-09-11"/>
		<cosponsor id="400259" joined="2008-09-11"/>
		<cosponsor id="400436" joined="2008-09-11"/>
		<cosponsor id="400422" joined="2008-09-11"/>
		<cosponsor id="400217" joined="2008-09-11"/>
		<cosponsor id="400360" joined="2008-09-11"/>
		<cosponsor id="400074" joined="2008-09-11"/>
		<cosponsor id="400093" joined="2008-09-11"/>
		<cosponsor id="400090" joined="2008-09-11"/>
		<cosponsor id="400215" joined="2008-09-11"/>
	</cosponsors>
	<actions>
		<action date="1221105600" datetime="2008-09-11"><text>Referred to the Committee on the Judiciary, and in addition to the Committee on Armed Services, for a period to be subsequently determined by the Speaker, in each case for consideration of such provisions as fall within the jurisdiction of the committee concerned.</text></action>
		<action date="1221105600" datetime="2008-09-11"><text>Referred to House Judiciary</text></action>
		<action date="1221105600" datetime="2008-09-11"><text>Referred to House Armed Services</text></action>
	</actions>
	<committees>

	</committees>
	<relatedbills>

	</relatedbills>
	<subjects>

	</subjects>
	<amendments>

	</amendments>

	9/11/2008--Introduced.
Federal Death Penalty Abolition Act of 2008- Repeals death penalty provisions for a wide range of homicide-related offenses under the Immigration and Nationality Act, the federal criminal code, the Controlled Substances Act, and other statutes relating to aircraft hijacking, espionage and treason, and offenses punished under the Uniform Code of Military Justice.
Prohibits the sentencing to death or execution of any person for any violation of federal law after the enactment of this Act. Commutes death penalties imposed prior to the enactment of this Act to life imprisonment without the possibility of parole.

</bill>

redpajama_set_name: RedPajamaGithub


text:
// Copyright 2016 The Bazel Authors. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//    http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package com.google.devtools.build.android;

import static com.google.common.truth.Truth.assertThat;

import com.google.common.base.Function;
import com.google.common.base.Joiner;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.Iterables;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Path;
import java.time.Instant;
import java.util.Collections;
import java.util.List;
import java.util.jar.JarInputStream;
import java.util.zip.ZipEntry;
import java.util.zip.ZipFile;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;

/**
 * Tests for {@link RClassGeneratorAction}.
 */
@RunWith(JUnit4.class)
public class RClassGeneratorActionTest {

  private Path tempDir;

  @Before
  public void setUp() throws IOException {
    tempDir = Files.createTempDirectory(toString());
  }

  /**
   * TODO(jvoung): use {@link AndroidDataBuilder} instead, once that's moved to this source tree.
   * This is a slimmed down version used to avoid dependencies.
   */
  private static class ManifestBuilder {

    private final Path root;

    private ManifestBuilder(Path root) {
      this.root = root;
    }

    public static ManifestBuilder of(Path root) {
      return new ManifestBuilder(root);
    }

    public Path createManifest(String path, String manifestPackage, String... lines)
        throws IOException {
      Path manifest = root.resolve(path);
      Files.createDirectories(root);
      Files.write(manifest,
          String.format(
              "<?xml version=\"1.0\" encoding=\"utf-8\"?>"
                  + "<manifest xmlns:android=\"http://schemas.android.com/apk/res/android\" "
                  + " package=\"%s\">"
                  + "%s</manifest>",
              manifestPackage,
              Joiner.on("\n").join(lines)).getBytes(StandardCharsets.UTF_8));
      return manifest;
    }
  }

  @Test
  public void withBinaryAndLibraries() throws Exception {
    Path binaryManifest = ManifestBuilder.of(tempDir.resolve("binary"))
        .createManifest("AndroidManifest.xml", "com.google.app",
            "<application android:name=\"com.google.app\">",
            "<activity android:name=\"com.google.bar.activityFoo\" />",
            "</application>");
    Path libFooManifest = ManifestBuilder.of(tempDir.resolve("libFoo"))
        .createManifest("AndroidManifest.xml", "com.google.foo", "");
    Path libBarManifest = ManifestBuilder.of(tempDir.resolve("libBar"))
        .createManifest("AndroidManifest.xml", "com.google.bar", "");

    Path binarySymbols = createFile("R.txt",
        "int attr agility 0x7f010000",
        "int attr dexterity 0x7f010001",
        "int drawable heart 0x7f020000",
        "int id someTextView 0x7f080000",
        "int integer maxNotifications 0x7f090000",
        "int string alphabet 0x7f100000",
        "int string ok 0x7f100001");
    Path libFooSymbols = createFile("libFoo.R.txt",
        "int attr agility 0x1",
        "int id someTextView 0x1",
        "int string ok 0x1");
    Path libBarSymbols = createFile("libBar.R.txt",
        "int attr dexterity 0x1",
        "int drawable heart 0x1");

    Path jarPath = tempDir.resolve("app_resources.jar");

    RClassGeneratorAction.main(
        ImmutableList.<String>of(
                "--primaryRTxt",
                binarySymbols.toString(),
                "--primaryManifest",
                binaryManifest.toString(),
                "--library",
                libFooSymbols + "," + libFooManifest,
                "--library",
                libBarSymbols + "," + libBarManifest,
                "--classJarOutput",
                jarPath.toString(),
                "--targetLabel",
                "//foo:foo")
            .toArray(new String[0]));

    assertThat(Files.exists(jarPath)).isTrue();

    try (ZipFile zip = new ZipFile(jarPath.toFile())) {
      List<? extends ZipEntry> zipEntries = Collections.list(zip.entries());
      Iterable<String> entries = getZipFilenames(zipEntries);
      assertThat(entries)
          .containsExactly(
              "com/google/foo/R$attr.class",
              "com/google/foo/R$id.class",
              "com/google/foo/R$string.class",
              "com/google/foo/R.class",
              "com/google/bar/R$attr.class",
              "com/google/bar/R$drawable.class",
              "com/google/bar/R.class",
              "com/google/app/R$attr.class",
              "com/google/app/R$drawable.class",
              "com/google/app/R$id.class",
              "com/google/app/R$integer.class",
              "com/google/app/R$string.class",
              "com/google/app/R.class",
              "META-INF/",
              "META-INF/MANIFEST.MF");
      ZipMtimeAsserter.assertEntries(zipEntries);
    }
    try (JarInputStream jar = new JarInputStream(Files.newInputStream(jarPath))) {
      assertThat(jar.getManifest().getMainAttributes().getValue("Target-Label"))
          .isEqualTo("//foo:foo");
    }
  }

  @Test
  public void withNoBinaryAndLibraries() throws Exception {
    Path libFooManifest =
        ManifestBuilder.of(tempDir.resolve("libFoo"))
            .createManifest("AndroidManifest.xml", "com.google.foo", "");
    Path libBarManifest =
        ManifestBuilder.of(tempDir.resolve("libBar"))
            .createManifest("AndroidManifest.xml", "com.google.bar", "");

    Path libFooSymbols =
        createFile(
            "libFoo.R.txt", "int attr agility 0x1", "int id someTextView 0x1", "int string ok 0x1");
    Path libBarSymbols =
        createFile("libBar.R.txt", "int attr dexterity 0x1", "int drawable heart 0x1");

    Path jarPath = tempDir.resolve("app_resources.jar");

    RClassGeneratorAction.main(
        ImmutableList.<String>of(
                "--library",
                libFooSymbols + "," + libFooManifest,
                "--library",
                libBarSymbols + "," + libBarManifest,
                "--classJarOutput",
                jarPath.toString())
            .toArray(new String[0]));

    assertThat(Files.exists(jarPath)).isTrue();

    try (ZipFile zip = new ZipFile(jarPath.toFile())) {
      List<? extends ZipEntry> zipEntries = Collections.list(zip.entries());
      Iterable<String> entries = getZipFilenames(zipEntries);
      assertThat(entries)
          .containsExactly(
              "com/google/foo/R$attr.class",
              "com/google/foo/R$id.class",
              "com/google/foo/R$string.class",
              "com/google/foo/R.class",
              "com/google/bar/R$attr.class",
              "com/google/bar/R$drawable.class",
              "com/google/bar/R.class",
              "META-INF/",
              "META-INF/MANIFEST.MF");
      ZipMtimeAsserter.assertEntries(zipEntries);
    }
  }

  @Test
  public void withBinaryNoLibraries() throws Exception {
    Path binaryManifest = ManifestBuilder.of(tempDir.resolve("binary"))
        .createManifest("AndroidManifest.xml", "com.google.app",
            "<application android:name=\"com.google.app\">",
            "<activity android:name=\"com.google.bar.activityFoo\" />",
            "</application>");

    Path binarySymbols = createFile("R.txt",
        "int attr agility 0x7f010000",
        "int attr dexterity 0x7f010001",
        "int drawable heart 0x7f020000",
        "int id someTextView 0x7f080000",
        "int integer maxNotifications 0x7f090000",
        "int string alphabet 0x7f100000",
        "int string ok 0x7f100001");

    Path jarPath = tempDir.resolve("app_resources.jar");

    RClassGeneratorAction.main(ImmutableList.<String>of(
        "--primaryRTxt", binarySymbols.toString(),
        "--primaryManifest", binaryManifest.toString(),
        "--classJarOutput", jarPath.toString()
    ).toArray(new String[0]));

    assertThat(Files.exists(jarPath)).isTrue();

    try (ZipFile zip = new ZipFile(jarPath.toFile())) {
      List<? extends ZipEntry> zipEntries = Collections.list(zip.entries());
      Iterable<String> entries = getZipFilenames(zipEntries);
      assertThat(entries)
          .containsExactly(
              "com/google/app/R$attr.class",
              "com/google/app/R$drawable.class",
              "com/google/app/R$id.class",
              "com/google/app/R$integer.class",
              "com/google/app/R$string.class",
              "com/google/app/R.class",
              "META-INF/",
              "META-INF/MANIFEST.MF");
      ZipMtimeAsserter.assertEntries(zipEntries);
    }
  }

  @Test
  public void noBinary() throws Exception {
    Path jarPath = tempDir.resolve("app_resources.jar");
    RClassGeneratorAction.main(ImmutableList.<String>of(
        "--classJarOutput", jarPath.toString()
    ).toArray(new String[0]));

    assertThat(Files.exists(jarPath)).isTrue();

    try (ZipFile zip = new ZipFile(jarPath.toFile())) {
      List<? extends ZipEntry> zipEntries = Collections.list(zip.entries());
      Iterable<String> entries = getZipFilenames(zipEntries);
      assertThat(entries).containsExactly("META-INF/", "META-INF/MANIFEST.MF");
      ZipMtimeAsserter.assertEntries(zipEntries);
    }
  }

  @Test
  public void customPackageForR() throws Exception {
    Path binaryManifest = ManifestBuilder.of(tempDir.resolve("binary"))
        .createManifest("AndroidManifest.xml", "com.google.app",
            "<application android:name=\"com.google.app\">",
            "<activity android:name=\"com.google.foo.activityFoo\" />",
            "</application>");
    Path libFooManifest = ManifestBuilder.of(tempDir.resolve("libFoo"))
        .createManifest("AndroidManifest.xml", "com.google.foo", "");

    Path binarySymbols = createFile("R.txt",
        "int attr agility 0x7f010000",
        "int integer maxNotifications 0x7f090000",
        "int string ok 0x7f100001");
    Path libFooSymbols = createFile("libFoo.R.txt",
        "int string ok 0x1");
    Path jarPath = tempDir.resolve("app_resources.jar");
    RClassGeneratorAction.main(
        ImmutableList.<String>of(
                "--primaryRTxt",
                binarySymbols.toString(),
                "--primaryManifest",
                binaryManifest.toString(),
                "--packageForR",
                "com.custom.er",
                "--library",
                libFooSymbols + "," + libFooManifest,
                "--classJarOutput",
                jarPath.toString())
            .toArray(new String[0]));

    assertThat(Files.exists(jarPath)).isTrue();

    try (ZipFile zip = new ZipFile(jarPath.toFile())) {
      List<? extends ZipEntry> zipEntries = Collections.list(zip.entries());
      Iterable<String> entries = getZipFilenames(zipEntries);
      assertThat(entries)
          .containsExactly(
              "com/google/foo/R$string.class",
              "com/google/foo/R.class",
              "com/custom/er/R$attr.class",
              "com/custom/er/R$integer.class",
              "com/custom/er/R$string.class",
              "com/custom/er/R.class",
              "META-INF/",
              "META-INF/MANIFEST.MF");
      ZipMtimeAsserter.assertEntries(zipEntries);
    }
  }

  @Test
  public void noSymbolsNoRClass() throws Exception {
    Path binaryManifest = ManifestBuilder.of(tempDir.resolve("binary"))
        .createManifest("AndroidManifest.xml", "com.google.app",
            "<application android:name=\"com.google.app\">",
            "<activity android:name=\"com.google.foo.activityFoo\" />",
            "</application>");

    Path binarySymbols = createFile("R.txt", "");
    Path jarPath = tempDir.resolve("app_resources.jar");
    RClassGeneratorAction.main(
        ImmutableList.<String>of(
            "--primaryRTxt",
            binarySymbols.toString(),
            "--primaryManifest",
            binaryManifest.toString(),
            "--classJarOutput",
            jarPath.toString())
            .toArray(new String[0]));

    assertThat(Files.exists(jarPath)).isTrue();

    try (ZipFile zip = new ZipFile(jarPath.toFile())) {
      List<? extends ZipEntry> zipEntries = Collections.list(zip.entries());
      Iterable<String> entries = getZipFilenames(zipEntries);
      assertThat(entries).containsExactly("META-INF/", "META-INF/MANIFEST.MF");
      ZipMtimeAsserter.assertEntries(zipEntries);
    }
  }

  private Path createFile(String name, String... contents) throws IOException {
    Path path = tempDir.resolve(name);
    Files.createDirectories(path.getParent());
    Files.newOutputStream(path).write(
        Joiner.on("\n").join(contents).getBytes(StandardCharsets.UTF_8));
    return path;
  }

  private Iterable<String> getZipFilenames(Iterable<? extends ZipEntry> entries) {
    return Iterables.transform(entries,
        new Function<ZipEntry, String>() {
          @Override
          public String apply(ZipEntry input) {
            return input.getName();
          }
        });
  }

  private static final class ZipMtimeAsserter {
    private static final long ZIP_EPOCH = Instant.parse("1980-01-01T00:00:00Z").getEpochSecond();
    private static final long ZIP_EPOCH_PLUS_ONE_DAY =
        Instant.parse("1980-01-02T00:00:00Z").getEpochSecond();

    public static void assertEntry(ZipEntry e) {
      // getLastModifiedTime().toMillis() returns milliseconds, Instant.getEpochSecond() returns
      // seconds.
      long mtime = e.getLastModifiedTime().toMillis() / 1000;
      // The ZIP epoch is the same as the MS-DOS epoch, 1980-01-01T00:00:00Z.
      // AndroidResourceOutputs.ZipBuilder sets this to most of its entries, except for .class files
      // for which the ZipBuilder increments the timestamp by 2 seconds.
      // We don't care about the details of this logic and asserting exact timestamps would couple
      // the test to the code too tightly, so here we only assert that the timestamp is on
      // 1980-01-01, ignoring the exact time.
      // AndroidResourceOutputs.ZipBuilde sets the ZIP epoch (same as the MS-DOS epoch,
      // 1980-01-01T00:00:00Z) as the timestamp for all of its entries (except .class files, for
      // which it sets a timestamp 2 seconds later than the DOS epoch).
      // We don't care about the exact timestamps though, only that they are stable, so let's just
      // assert that they are all on the day of 1980-01-01.
      if (mtime < ZIP_EPOCH || mtime > ZIP_EPOCH_PLUS_ONE_DAY) {
        Assert.fail(String.format("e=(%s) mtime=(%s)", e.getName(), e.getLastModifiedTime()));
      }
    }

    public static void assertEntries(Iterable<? extends ZipEntry> entries) throws Exception {
      for (ZipEntry e : entries) {
        assertEntry(e);
      }
    }
  }
}


text:
A Sudoku generating and solving library.

## Synopsis
Generates, validates and solves 9x9 Sudoku puzzles. It uses the [Dancing Links](http://en.wikipedia.org/wiki/Dancing_Links) implementation of Knuth's Algorithm X, which is a fancy use of doubly-linked lists to efficiently add and remove elements while preserving their original order. Given the small set of possibilities for Sudoku it is overkill compared to the naive brute-force algorithm, but nonetheless an interesting and efficient approach for the generalized NP-complete problem.

## Building
The library itself (SudokuLib/*) should be portable, but the build system (Makefiles) assumes
you're on some kind of POSIX system. The tests, especially, are only set up to build on Linux & OS X.

The typical make targets work:
- all
- test
- clean

## Output
tests: sudoku_tests
CLI interface to library: sudoku


text:
<?php

interface PHPParser_NodeVisitor
{

    /**
     * Called once before traversal.
     *
     * Return value semantics:
     *  * null:      $nodes stays as-is
     *  * otherwise: $nodes is set to the return value
     *
     * @param PHPParser_Node[] $nodes Array of nodes
     *
     * @return null|PHPParser_Node[] Array of nodes
     */
    public function beforeTraverse( array $nodes );

    /**
     * Called when entering a node.
     *
     * Return value semantics:
     *  * null:      $node stays as-is
     *  * otherwise: $node is set to the return value
     *
     * @param PHPParser_Node $node Node
     *
     * @return null|PHPParser_Node Node
     */
    public function enterNode( PHPParser_Node $node );

    /**
     * Called when leaving a node.
     *
     * Return value semantics:
     *  * null:      $node stays as-is
     *  * false:     $node is removed from the parent array
     *  * array:     The return value is merged into the parent array (at the position of the $node)
     *  * otherwise: $node is set to the return value
     *
     * @param PHPParser_Node $node Node
     *
     * @return null|PHPParser_Node|false|PHPParser_Node[] Node
     */
    public function leaveNode( PHPParser_Node $node );

    /**
     * Called once after traversal.
     *
     * Return value semantics:
     *  * null:      $nodes stays as-is
     *  * otherwise: $nodes is set to the return value
     *
     * @param PHPParser_Node[] $nodes Array of nodes
     *
     * @return null|PHPParser_Node[] Array of nodes
     */
    public function afterTraverse( array $nodes );
}


text:
require 'spec_helper'

describe 'horizon' do

  context 'Supported OS - ' do
    ['Debian', 'RedHat'].each do |osfamily|
      describe "#{osfamily} standard installation" do
        let(:params) {{ }}
        let(:facts) {{
          :osfamily => osfamily,
        }}
        it { should contain_package('horizon').with_ensure('present') }
        it { should contain_service('horizon').with_ensure('running') }
      end

      describe "#{osfamily} installation of a specific package version" do
        let(:params) { {
          :package_ensure => '1.0.42',
        } }
        let(:facts) {{
          :osfamily => osfamily,
        }}
        it { should contain_package('horizon').with_ensure('1.0.42') }
      end

      describe "#{osfamily} removal of package installation" do
        let(:params) { {
          :package_ensure => 'absent',
        } }
        let(:facts) {{
          :osfamily => osfamily,
        }}
        it 'should remove Package[horizon]' do should contain_package('horizon').with_ensure('absent') end
        it 'should stop Service[horizon]' do should contain_service('horizon').with_ensure('stopped') end
        it 'should not manage at boot Service[horizon]' do should contain_service('horizon').with_enable(nil) end
        it 'should remove horizon configuration file' do should contain_file('horizon.conf').with_ensure('absent') end
      end

      describe "#{osfamily} service disabling" do
        let(:params) { {
          :service_ensure => 'stopped',
          :service_enable => false,
        } }
        let(:facts) {{
          :osfamily => osfamily,
        }}
        it 'should stop Service[horizon]' do should contain_service('horizon').with_ensure('stopped') end
        it 'should not enable at boot Service[horizon]' do should contain_service('horizon').with_enable('false') end
      end

      describe "#{osfamily} configuration via custom template" do
        let(:params) { {
          :config_file_template     => 'horizon/spec.conf',
          :config_file_options_hash => { 'opt_a' => 'value_a' },
        } }
        let(:facts) {{
          :osfamily => osfamily,
        }}
        it { should contain_file('horizon.conf').with_content(/This is a template used only for rspec tests/) }
        it 'should generate a template that uses custom options' do
          should contain_file('horizon.conf').with_content(/value_a/)
        end
      end

      describe "#{osfamily} configuration via custom content" do
        let(:params) { {
          :config_file_content    => 'my_content',
        } }
        let(:facts) {{
          :osfamily => osfamily,
        }}
        it { should contain_file('horizon.conf').with_content(/my_content/) }
      end

      describe "#{osfamily} configuration via custom source file" do
        let(:params) { {
          :config_file_source => "puppet:///modules/horizon/spec.conf",
        } }
        let(:facts) {{
          :osfamily => osfamily,
        }}
        it { should contain_file('horizon.conf').with_source('puppet:///modules/horizon/spec.conf') }
      end

      describe "#{osfamily} configuration via custom source dir" do
        let(:params) { {
          :config_dir_source => 'puppet:///modules/horizon/tests/',
          :config_dir_purge => true
        } }
        let(:facts) {{
          :osfamily => osfamily,
        }}
        it { should contain_file('horizon.dir').with_source('puppet:///modules/horizon/tests/') }
        it { should contain_file('horizon.dir').with_purge('true') }
        it { should contain_file('horizon.dir').with_force('true') }
      end

      describe "#{osfamily} service restart on config file change (default)" do
        let(:facts) {{
          :osfamily => osfamily,
        }}
        it 'should automatically restart the service when files change' do
          should contain_file('horizon.conf').with_notify('Service[horizon]')
        end
      end

      describe "#{osfamily} service restart disabling on config file change" do
        let(:params) { {
          :config_file_notify => '',
        } }
        let(:facts) {{
          :osfamily => osfamily,
        }}
        it 'should automatically restart the service when files change' do
          should contain_file('horizon.conf').without_notify
        end
      end

    end
  end

  context 'Unsupported OS - ' do
    describe 'Not supported operating systems should throw and error' do
      let(:facts) {{
        :osfamily        => 'Solaris',
        :operatingsystem => 'Nexenta',
      }}

      it { expect { should }.to raise_error(Puppet::Error, /Nexenta not supported/) }
    end
  end

end


text:
namespace Kvasir {
//Timer/PWM Module
    namespace Tpm1Sc{    ///<Status and Control
        using Addr = Register::Address<0x40039000,0xfffffe00,0x00000000,unsigned>;
        ///Prescale Factor Selection
        enum class PsVal {
            v000=0x00000000,     ///<Divide by 1
            v001=0x00000001,     ///<Divide by 2
            v010=0x00000002,     ///<Divide by 4
            v011=0x00000003,     ///<Divide by 8
            v100=0x00000004,     ///<Divide by 16
            v101=0x00000005,     ///<Divide by 32
            v110=0x00000006,     ///<Divide by 64
            v111=0x00000007,     ///<Divide by 128
        };
        constexpr Register::FieldLocation<Addr,Register::maskFromRange(2,0),Register::ReadWriteAccess,PsVal> ps{};
        namespace PsValC{
            constexpr Register::FieldValue<decltype(ps)::Type,PsVal::v000> v000{};
            constexpr Register::FieldValue<decltype(ps)::Type,PsVal::v001> v001{};
            constexpr Register::FieldValue<decltype(ps)::Type,PsVal::v010> v010{};
            constexpr Register::FieldValue<decltype(ps)::Type,PsVal::v011> v011{};
            constexpr Register::FieldValue<decltype(ps)::Type,PsVal::v100> v100{};
            constexpr Register::FieldValue<decltype(ps)::Type,PsVal::v101> v101{};
            constexpr Register::FieldValue<decltype(ps)::Type,PsVal::v110> v110{};
            constexpr Register::FieldValue<decltype(ps)::Type,PsVal::v111> v111{};
        }
        ///Clock Mode Selection
        enum class CmodVal {
            v00=0x00000000,     ///<TPM counter is disabled
            v01=0x00000001,     ///<TPM counter increments on every TPM counter clock
            v10=0x00000002,     ///<TPM counter increments on rising edge of TPM_EXTCLK synchronized to the TPM counter clock
        };
        constexpr Register::FieldLocation<Addr,Register::maskFromRange(4,3),Register::ReadWriteAccess,CmodVal> cmod{};
        namespace CmodValC{
            constexpr Register::FieldValue<decltype(cmod)::Type,CmodVal::v00> v00{};
            constexpr Register::FieldValue<decltype(cmod)::Type,CmodVal::v01> v01{};
            constexpr Register::FieldValue<decltype(cmod)::Type,CmodVal::v10> v10{};
        }
        ///Center-Aligned PWM Select
        enum class CpwmsVal {
            v0=0x00000000,     ///<TPM counter operates in up counting mode.
            v1=0x00000001,     ///<TPM counter operates in up-down counting mode.
        };
        constexpr Register::FieldLocation<Addr,Register::maskFromRange(5,5),Register::ReadWriteAccess,CpwmsVal> cpwms{};
        namespace CpwmsValC{
            constexpr Register::FieldValue<decltype(cpwms)::Type,CpwmsVal::v0> v0{};
            constexpr Register::FieldValue<decltype(cpwms)::Type,CpwmsVal::v1> v1{};
        }
        ///Timer Overflow Interrupt Enable
        enum class ToieVal {
            v0=0x00000000,     ///<Disable TOF interrupts. Use software polling or DMA request.
            v1=0x00000001,     ///<Enable TOF interrupts. An interrupt is generated when TOF equals one.
        };
        constexpr Register::FieldLocation<Addr,Register::maskFromRange(6,6),Register::ReadWriteAccess,ToieVal> toie{};
        namespace ToieValC{
            constexpr Register::FieldValue<decltype(toie)::Type,ToieVal::v0> v0{};
            constexpr Register::FieldValue<decltype(toie)::Type,ToieVal::v1> v1{};
        }
        ///Timer Overflow Flag
        enum class TofVal {
            v0=0x00000000,     ///<TPM counter has not overflowed.
            v1=0x00000001,     ///<TPM counter has overflowed.
        };
        constexpr Register::FieldLocation<Addr,Register::maskFromRange(7,7),Register::ReadWriteAccess,TofVal> tof{};
        namespace TofValC{
            constexpr Register::FieldValue<decltype(tof)::Type,TofVal::v0> v0{};
            constexpr Register::FieldValue<decltype(tof)::Type,TofVal::v1> v1{};
        }
        ///DMA Enable
        enum class DmaVal {
            v0=0x00000000,     ///<Disables DMA transfers.
            v1=0x00000001,     ///<Enables DMA transfers.
        };
        constexpr Register::FieldLocation<Addr,Register::maskFromRange(8,8),Register::ReadWriteAccess,DmaVal> dma{};
        namespace DmaValC{
            constexpr Register::FieldValue<decltype(dma)::Type,DmaVal::v0> v0{};
            constexpr Register::FieldValue<decltype(dma)::Type,DmaVal::v1> v1{};
        }
    }
    namespace Tpm1Cnt{    ///<Counter
        using Addr = Register::Address<0x40039004,0xffff0000,0x00000000,unsigned>;
        ///Counter value
        constexpr Register::FieldLocation<Addr,Register::maskFromRange(15,0),Register::ReadWriteAccess,unsigned> count{};
    }
    namespace Tpm1Mod{    ///<Modulo
        using Addr = Register::Address<0x40039008,0xffff0000,0x00000000,unsigned>;
        ///Modulo value
        constexpr Register::FieldLocation<Addr,Register::maskFromRange(15,0),Register::ReadWriteAccess,unsigned> mod{};
    }
    namespace Tpm1Status{    ///<Capture and Compare Status
        using Addr = Register::Address<0x40039050,0xfffffec0,0x00000000,unsigned>;
        ///Channel 0 Flag
        enum class Ch0fVal {
            v0=0x00000000,     ///<No channel event has occurred.
            v1=0x00000001,     ///<A channel event has occurred.
        };
        constexpr Register::FieldLocation<Addr,Register::maskFromRange(0,0),Register::ReadWriteAccess,Ch0fVal> ch0f{};
        namespace Ch0fValC{
            constexpr Register::FieldValue<decltype(ch0f)::Type,Ch0fVal::v0> v0{};
            constexpr Register::FieldValue<decltype(ch0f)::Type,Ch0fVal::v1> v1{};
        }
        ///Channel 1 Flag
        enum class Ch1fVal {
            v0=0x00000000,     ///<No channel event has occurred.
            v1=0x00000001,     ///<A channel event has occurred.
        };
        constexpr Register::FieldLocation<Addr,Register::maskFromRange(1,1),Register::ReadWriteAccess,Ch1fVal> ch1f{};
        namespace Ch1fValC{
            constexpr Register::FieldValue<decltype(ch1f)::Type,Ch1fVal::v0> v0{};
            constexpr Register::FieldValue<decltype(ch1f)::Type,Ch1fVal::v1> v1{};
        }
        ///Channel 2 Flag
        enum class Ch2fVal {
            v0=0x00000000,     ///<No channel event has occurred.
            v1=0x00000001,     ///<A channel event has occurred.
        };
        constexpr Register::FieldLocation<Addr,Register::maskFromRange(2,2),Register::ReadWriteAccess,Ch2fVal> ch2f{};
        namespace Ch2fValC{
            constexpr Register::FieldValue<decltype(ch2f)::Type,Ch2fVal::v0> v0{};
            constexpr Register::FieldValue<decltype(ch2f)::Type,Ch2fVal::v1> v1{};
        }
        ///Channel 3 Flag
        enum class Ch3fVal {
            v0=0x00000000,     ///<No channel event has occurred.
            v1=0x00000001,     ///<A channel event has occurred.
        };
        constexpr Register::FieldLocation<Addr,Register::maskFromRange(3,3),Register::ReadWriteAccess,Ch3fVal> ch3f{};
        namespace Ch3fValC{
            constexpr Register::FieldValue<decltype(ch3f)::Type,Ch3fVal::v0> v0{};
            constexpr Register::FieldValue<decltype(ch3f)::Type,Ch3fVal::v1> v1{};
        }
        ///Channel 4 Flag
        enum class Ch4fVal {
            v0=0x00000000,     ///<No channel event has occurred.
            v1=0x00000001,     ///<A channel event has occurred.
        };
        constexpr Register::FieldLocation<Addr,Register::maskFromRange(4,4),Register::ReadWriteAccess,Ch4fVal> ch4f{};
        namespace Ch4fValC{
            constexpr Register::FieldValue<decltype(ch4f)::Type,Ch4fVal::v0> v0{};
            constexpr Register::FieldValue<decltype(ch4f)::Type,Ch4fVal::v1> v1{};
        }
        ///Channel 5 Flag
        enum class Ch5fVal {
            v0=0x00000000,     ///<No channel event has occurred.
            v1=0x00000001,     ///<A channel event has occurred.
        };
        constexpr Register::FieldLocation<Addr,Register::maskFromRange(5,5),Register::ReadWriteAccess,Ch5fVal> ch5f{};
        namespace Ch5fValC{
            constexpr Register::FieldValue<decltype(ch5f)::Type,Ch5fVal::v0> v0{};
            constexpr Register::FieldValue<decltype(ch5f)::Type,Ch5fVal::v1> v1{};
        }
        ///Timer Overflow Flag
        enum class TofVal {
            v0=0x00000000,     ///<TPM counter has not overflowed.
            v1=0x00000001,     ///<TPM counter has overflowed.
        };
        constexpr Register::FieldLocation<Addr,Register::maskFromRange(8,8),Register::ReadWriteAccess,TofVal> tof{};
        namespace TofValC{
            constexpr Register::FieldValue<decltype(tof)::Type,TofVal::v0> v0{};
            constexpr Register::FieldValue<decltype(tof)::Type,TofVal::v1> v1{};
        }
    }
    namespace Tpm1Pol{    ///<Channel Polarity
        using Addr = Register::Address<0x40039070,0xffffffc0,0x00000000,unsigned>;
        ///Channel 0 Polarity
        enum class Pol0Val {
            v0=0x00000000,     ///<The channel polarity is active high.
            v1=0x00000001,     ///<The channel polarity is active low.
        };
        constexpr Register::FieldLocation<Addr,Register::maskFromRange(0,0),Register::ReadWriteAccess,Pol0Val> pol0{};
        namespace Pol0ValC{
            constexpr Register::FieldValue<decltype(pol0)::Type,Pol0Val::v0> v0{};
            constexpr Register::FieldValue<decltype(pol0)::Type,Pol0Val::v1> v1{};
        }
        ///Channel 1 Polarity
        enum class Pol1Val {
            v0=0x00000000,     ///<The channel polarity is active high.
            v1=0x00000001,     ///<The channel polarity is active low.
        };
        constexpr Register::FieldLocation<Addr,Register::maskFromRange(1,1),Register::ReadWriteAccess,Pol1Val> pol1{};
        namespace Pol1ValC{
            constexpr Register::FieldValue<decltype(pol1)::Type,Pol1Val::v0> v0{};
            constexpr Register::FieldValue<decltype(pol1)::Type,Pol1Val::v1> v1{};
        }
        ///Channel 2 Polarity
        enum class Pol2Val {
            v0=0x00000000,     ///<The channel polarity is active high.
            v1=0x00000001,     ///<The channel polarity is active low.
        };
        constexpr Register::FieldLocation<Addr,Register::maskFromRange(2,2),Register::ReadWriteAccess,Pol2Val> pol2{};
        namespace Pol2ValC{
            constexpr Register::FieldValue<decltype(pol2)::Type,Pol2Val::v0> v0{};
            constexpr Register::FieldValue<decltype(pol2)::Type,Pol2Val::v1> v1{};
        }
        ///Channel 3 Polarity
        enum class Pol3Val {
            v0=0x00000000,     ///<The channel polarity is active high.
            v1=0x00000001,     ///<The channel polarity is active low.
        };
        constexpr Register::FieldLocation<Addr,Register::maskFromRange(3,3),Register::ReadWriteAccess,Pol3Val> pol3{};
        namespace Pol3ValC{
            constexpr Register::FieldValue<decltype(pol3)::Type,Pol3Val::v0> v0{};
            constexpr Register::FieldValue<decltype(pol3)::Type,Pol3Val::v1> v1{};
        }
        ///Channel 4 Polarity
        enum class Pol4Val {
            v0=0x00000000,     ///<The channel polarity is active high
            v1=0x00000001,     ///<The channel polarity is active low.
        };
        constexpr Register::FieldLocation<Addr,Register::maskFromRange(4,4),Register::ReadWriteAccess,Pol4Val> pol4{};
        namespace Pol4ValC{
            constexpr Register::FieldValue<decltype(pol4)::Type,Pol4Val::v0> v0{};
            constexpr Register::FieldValue<decltype(pol4)::Type,Pol4Val::v1> v1{};
        }
        ///Channel 5 Polarity
        enum class Pol5Val {
            v0=0x00000000,     ///<The channel polarity is active high.
            v1=0x00000001,     ///<The channel polarity is active low.
        };
        constexpr Register::FieldLocation<Addr,Register::maskFromRange(5,5),Register::ReadWriteAccess,Pol5Val> pol5{};
        namespace Pol5ValC{
            constexpr Register::FieldValue<decltype(pol5)::Type,Pol5Val::v0> v0{};
            constexpr Register::FieldValue<decltype(pol5)::Type,Pol5Val::v1> v1{};
        }
    }
    namespace Tpm1Conf{    ///<Configuration
        using Addr = Register::Address<0x40039084,0xf030fc1f,0x00000000,unsigned>;
        ///Doze Enable
        enum class DozeenVal {
            v0=0x00000000,     ///<Internal TPM counter continues in Doze mode.
            v1=0x00000001,     ///<Internal TPM counter is paused and does not increment during Doze mode. Trigger inputs and input capture events are also ignored.
        };
        constexpr Register::FieldLocation<Addr,Register::maskFromRange(5,5),Register::ReadWriteAccess,DozeenVal> dozeen{};
        namespace DozeenValC{
            constexpr Register::FieldValue<decltype(dozeen)::Type,DozeenVal::v0> v0{};
            constexpr Register::FieldValue<decltype(dozeen)::Type,DozeenVal::v1> v1{};
        }
        ///Debug Mode
        enum class DbgmodeVal {
            v00=0x00000000,     ///<TPM counter is paused and does not increment during debug mode. Trigger inputs and input capture events are also ignored.
            v11=0x00000003,     ///<TPM counter continues in debug mode.
        };
        constexpr Register::FieldLocation<Addr,Register::maskFromRange(7,6),Register::ReadWriteAccess,DbgmodeVal> dbgmode{};
        namespace DbgmodeValC{
            constexpr Register::FieldValue<decltype(dbgmode)::Type,DbgmodeVal::v00> v00{};
            constexpr Register::FieldValue<decltype(dbgmode)::Type,DbgmodeVal::v11> v11{};
        }
        ///Global Time Base Synchronization
        enum class GtbsyncVal {
            v0=0x00000000,     ///<Global timebase synchronization disabled.
            v1=0x00000001,     ///<Global timebase synchronization enabled.
        };
        constexpr Register::FieldLocation<Addr,Register::maskFromRange(8,8),Register::ReadWriteAccess,GtbsyncVal> gtbsync{};
        namespace GtbsyncValC{
            constexpr Register::FieldValue<decltype(gtbsync)::Type,GtbsyncVal::v0> v0{};
            constexpr Register::FieldValue<decltype(gtbsync)::Type,GtbsyncVal::v1> v1{};
        }
        ///Global time base enable
        enum class GtbeenVal {
            v0=0x00000000,     ///<All channels use the internally generated TPM counter as their timebase
            v1=0x00000001,     ///<All channels use an externally generated global timebase as their timebase
        };
        constexpr Register::FieldLocation<Addr,Register::maskFromRange(9,9),Register::ReadWriteAccess,GtbeenVal> gtbeen{};
        namespace GtbeenValC{
            constexpr Register::FieldValue<decltype(gtbeen)::Type,GtbeenVal::v0> v0{};
            constexpr Register::FieldValue<decltype(gtbeen)::Type,GtbeenVal::v1> v1{};
        }
        ///Counter Start on Trigger
        enum class CsotVal {
            v0=0x00000000,     ///<TPM counter starts to increment immediately, once it is enabled.
            v1=0x00000001,     ///<TPM counter only starts to increment when it a rising edge on the selected input trigger is detected, after it has been enabled or after it has stopped due to overflow.
        };
        constexpr Register::FieldLocation<Addr,Register::maskFromRange(16,16),Register::ReadWriteAccess,CsotVal> csot{};
        namespace CsotValC{
            constexpr Register::FieldValue<decltype(csot)::Type,CsotVal::v0> v0{};
            constexpr Register::FieldValue<decltype(csot)::Type,CsotVal::v1> v1{};
        }
        ///Counter Stop On Overflow
        enum class CsooVal {
            v0=0x00000000,     ///<TPM counter continues incrementing or decrementing after overflow
            v1=0x00000001,     ///<TPM counter stops incrementing or decrementing after overflow.
        };
        constexpr Register::FieldLocation<Addr,Register::maskFromRange(17,17),Register::ReadWriteAccess,CsooVal> csoo{};
        namespace CsooValC{
            constexpr Register::FieldValue<decltype(csoo)::Type,CsooVal::v0> v0{};
            constexpr Register::FieldValue<decltype(csoo)::Type,CsooVal::v1> v1{};
        }
        ///Counter Reload On Trigger
        enum class CrotVal {
            v0=0x00000000,     ///<Counter is not reloaded due to a rising edge on the selected input trigger
            v1=0x00000001,     ///<Counter is reloaded when a rising edge is detected on the selected input trigger
        };
        constexpr Register::FieldLocation<Addr,Register::maskFromRange(18,18),Register::ReadWriteAccess,CrotVal> crot{};
        namespace CrotValC{
            constexpr Register::FieldValue<decltype(crot)::Type,CrotVal::v0> v0{};
            constexpr Register::FieldValue<decltype(crot)::Type,CrotVal::v1> v1{};
        }
        ///Counter Pause On Trigger
        constexpr Register::FieldLocation<Addr,Register::maskFromRange(19,19),Register::ReadWriteAccess,unsigned> cpot{};
        ///Trigger Polarity
        enum class TrgpolVal {
            v0=0x00000000,     ///<Trigger is active high.
            v1=0x00000001,     ///<Trigger is active low.
        };
        constexpr Register::FieldLocation<Addr,Register::maskFromRange(22,22),Register::ReadWriteAccess,TrgpolVal> trgpol{};
        namespace TrgpolValC{
            constexpr Register::FieldValue<decltype(trgpol)::Type,TrgpolVal::v0> v0{};
            constexpr Register::FieldValue<decltype(trgpol)::Type,TrgpolVal::v1> v1{};
        }
        ///Trigger Source
        enum class TrgsrcVal {
            v0=0x00000000,     ///<Trigger source selected by TRGSEL is external.
            v1=0x00000001,     ///<Trigger source selected by TRGSEL is internal (channel pin input capture).
        };
        constexpr Register::FieldLocation<Addr,Register::maskFromRange(23,23),Register::ReadWriteAccess,TrgsrcVal> trgsrc{};
        namespace TrgsrcValC{
            constexpr Register::FieldValue<decltype(trgsrc)::Type,TrgsrcVal::v0> v0{};
            constexpr Register::FieldValue<decltype(trgsrc)::Type,TrgsrcVal::v1> v1{};
        }
        ///Trigger Select
        enum class TrgselVal {
            v0001=0x00000001,     ///<Channel 0 pin input capture
            v0010=0x00000002,     ///<Channel 1 pin input capture
            v0011=0x00000003,     ///<Channel 0 or Channel 1 pin input capture
            v0100=0x00000004,     ///<Channel 2 pin input capture
            v0101=0x00000005,     ///<Channel 0 or Channel 2 pin input capture
            v0110=0x00000006,     ///<Channel 1 or Channel 2 pin input capture
            v0111=0x00000007,     ///<Channel 0 or Channel 1 or Channel 2 pin input capture
            v1000=0x00000008,     ///<Channel 3 pin input capture
            v1001=0x00000009,     ///<Channel 0 or Channel 3 pin input capture
            v1010=0x0000000a,     ///<Channel 1 or Channel 3 pin input capture
            v1011=0x0000000b,     ///<Channel 0 or Channel 1 or Channel 3 pin input capture
            v1100=0x0000000c,     ///<Channel 2 or Channel 3 pin input capture
            v1101=0x0000000d,     ///<Channel 0 or Channel 2 or Channel 3 pin input capture
            v1110=0x0000000e,     ///<Channel 1 or Channel 2 or Channel 3 pin input capture
            v1111=0x0000000f,     ///<Channel 0 or Channel 1 or Channel 2 or Channel 3 pin input capture
        };
        constexpr Register::FieldLocation<Addr,Register::maskFromRange(27,24),Register::ReadWriteAccess,TrgselVal> trgsel{};
        namespace TrgselValC{
            constexpr Register::FieldValue<decltype(trgsel)::Type,TrgselVal::v0001> v0001{};
            constexpr Register::FieldValue<decltype(trgsel)::Type,TrgselVal::v0010> v0010{};
            constexpr Register::FieldValue<decltype(trgsel)::Type,TrgselVal::v0011> v0011{};
            constexpr Register::FieldValue<decltype(trgsel)::Type,TrgselVal::v0100> v0100{};
            constexpr Register::FieldValue<decltype(trgsel)::Type,TrgselVal::v0101> v0101{};
            constexpr Register::FieldValue<decltype(trgsel)::Type,TrgselVal::v0110> v0110{};
            constexpr Register::FieldValue<decltype(trgsel)::Type,TrgselVal::v0111> v0111{};
            constexpr Register::FieldValue<decltype(trgsel)::Type,TrgselVal::v1000> v1000{};
            constexpr Register::FieldValue<decltype(trgsel)::Type,TrgselVal::v1001> v1001{};
            constexpr Register::FieldValue<decltype(trgsel)::Type,TrgselVal::v1010> v1010{};
            constexpr Register::FieldValue<decltype(trgsel)::Type,TrgselVal::v1011> v1011{};
            constexpr Register::FieldValue<decltype(trgsel)::Type,TrgselVal::v1100> v1100{};
            constexpr Register::FieldValue<decltype(trgsel)::Type,TrgselVal::v1101> v1101{};
            constexpr Register::FieldValue<decltype(trgsel)::Type,TrgselVal::v1110> v1110{};
            constexpr Register::FieldValue<decltype(trgsel)::Type,TrgselVal::v1111> v1111{};
        }
    }
    namespace Tpm1C0sc{    ///<Channel (n) Status and Control
        using Addr = Register::Address<0x4003900c,0xffffff02,0x00000000,unsigned>;
        ///DMA Enable
        enum class DmaVal {
            v0=0x00000000,     ///<Disable DMA transfers.
            v1=0x00000001,     ///<Enable DMA transfers.
        };
        constexpr Register::FieldLocation<Addr,Register::maskFromRange(0,0),Register::ReadWriteAccess,DmaVal> dma{};
        namespace DmaValC{
            constexpr Register::FieldValue<decltype(dma)::Type,DmaVal::v0> v0{};
            constexpr Register::FieldValue<decltype(dma)::Type,DmaVal::v1> v1{};
        }
        ///Edge or Level Select
        constexpr Register::FieldLocation<Addr,Register::maskFromRange(2,2),Register::ReadWriteAccess,unsigned> elsa{};
        ///Edge or Level Select
        constexpr Register::FieldLocation<Addr,Register::maskFromRange(3,3),Register::ReadWriteAccess,unsigned> elsb{};
        ///Channel Mode Select
        constexpr Register::FieldLocation<Addr,Register::maskFromRange(4,4),Register::ReadWriteAccess,unsigned> msa{};
        ///Channel Mode Select
        constexpr Register::FieldLocation<Addr,Register::maskFromRange(5,5),Register::ReadWriteAccess,unsigned> msb{};
        ///Channel Interrupt Enable
        enum class ChieVal {
            v0=0x00000000,     ///<Disable channel interrupts.
            v1=0x00000001,     ///<Enable channel interrupts.
        };
        constexpr Register::FieldLocation<Addr,Register::maskFromRange(6,6),Register::ReadWriteAccess,ChieVal> chie{};
        namespace ChieValC{
            constexpr Register::FieldValue<decltype(chie)::Type,ChieVal::v0> v0{};
            constexpr Register::FieldValue<decltype(chie)::Type,ChieVal::v1> v1{};
        }
        ///Channel Flag
        enum class ChfVal {
            v0=0x00000000,     ///<No channel event has occurred.
            v1=0x00000001,     ///<A channel event has occurred.
        };
        constexpr Register::FieldLocation<Addr,Register::maskFromRange(7,7),Register::ReadWriteAccess,ChfVal> chf{};
        namespace ChfValC{
            constexpr Register::FieldValue<decltype(chf)::Type,ChfVal::v0> v0{};
            constexpr Register::FieldValue<decltype(chf)::Type,ChfVal::v1> v1{};
        }
    }
    namespace Tpm1C1sc{    ///<Channel (n) Status and Control
        using Addr = Register::Address<0x40039014,0xffffff02,0x00000000,unsigned>;
        ///DMA Enable
        enum class DmaVal {
            v0=0x00000000,     ///<Disable DMA transfers.
            v1=0x00000001,     ///<Enable DMA transfers.
        };
        constexpr Register::FieldLocation<Addr,Register::maskFromRange(0,0),Register::ReadWriteAccess,DmaVal> dma{};
        namespace DmaValC{
            constexpr Register::FieldValue<decltype(dma)::Type,DmaVal::v0> v0{};
            constexpr Register::FieldValue<decltype(dma)::Type,DmaVal::v1> v1{};
        }
        ///Edge or Level Select
        constexpr Register::FieldLocation<Addr,Register::maskFromRange(2,2),Register::ReadWriteAccess,unsigned> elsa{};
        ///Edge or Level Select
        constexpr Register::FieldLocation<Addr,Register::maskFromRange(3,3),Register::ReadWriteAccess,unsigned> elsb{};
        ///Channel Mode Select
        constexpr Register::FieldLocation<Addr,Register::maskFromRange(4,4),Register::ReadWriteAccess,unsigned> msa{};
        ///Channel Mode Select
        constexpr Register::FieldLocation<Addr,Register::maskFromRange(5,5),Register::ReadWriteAccess,unsigned> msb{};
        ///Channel Interrupt Enable
        enum class ChieVal {
            v0=0x00000000,     ///<Disable channel interrupts.
            v1=0x00000001,     ///<Enable channel interrupts.
        };
        constexpr Register::FieldLocation<Addr,Register::maskFromRange(6,6),Register::ReadWriteAccess,ChieVal> chie{};
        namespace ChieValC{
            constexpr Register::FieldValue<decltype(chie)::Type,ChieVal::v0> v0{};
            constexpr Register::FieldValue<decltype(chie)::Type,ChieVal::v1> v1{};
        }
        ///Channel Flag
        enum class ChfVal {
            v0=0x00000000,     ///<No channel event has occurred.
            v1=0x00000001,     ///<A channel event has occurred.
        };
        constexpr Register::FieldLocation<Addr,Register::maskFromRange(7,7),Register::ReadWriteAccess,ChfVal> chf{};
        namespace ChfValC{
            constexpr Register::FieldValue<decltype(chf)::Type,ChfVal::v0> v0{};
            constexpr Register::FieldValue<decltype(chf)::Type,ChfVal::v1> v1{};
        }
    }
    namespace Tpm1C0v{    ///<Channel (n) Value
        using Addr = Register::Address<0x40039010,0xffff0000,0x00000000,unsigned>;
        ///Channel Value
        constexpr Register::FieldLocation<Addr,Register::maskFromRange(15,0),Register::ReadWriteAccess,unsigned> val{};
    }
    namespace Tpm1C1v{    ///<Channel (n) Value
        using Addr = Register::Address<0x40039018,0xffff0000,0x00000000,unsigned>;
        ///Channel Value
        constexpr Register::FieldLocation<Addr,Register::maskFromRange(15,0),Register::ReadWriteAccess,unsigned> val{};
    }
}


text:
package org.opensaml.saml2.core.impl;

import org.opensaml.common.xml.SAMLConstants;
import org.opensaml.saml2.core.Issuer;

/**
 * A thread-safe Unmarshaller for {@link org.opensaml.saml2.core.Issuer}.
 */
public class IssuerUnmarshaller extends AbstractNameIDTypeUnmarshaller {

    /** Constructor. */
    public IssuerUnmarshaller() {
        super(SAMLConstants.SAML20_NS, Issuer.DEFAULT_ELEMENT_LOCAL_NAME);
    }

    /**
     * Constructor.
     *
     * @param namespaceURI the namespace URI of either the schema type QName or element QName of the elements this
     *            unmarshaller operates on
     * @param elementLocalName the local name of either the schema type QName or element QName of the elements this
     *            unmarshaller operates on
     */
    protected IssuerUnmarshaller(String namespaceURI, String elementLocalName) {
        super(namespaceURI, elementLocalName);
    }
}


text:
from tools.load import LoadMatrix
lm=LoadMatrix()
data=lm.load_numbers('../data/fm_train_real.dat')
label=lm.load_numbers('../data/label_train_twoclass.dat')

parameter_list=[[data,label]]

def features_io_modular (fm_train_real, label_train_twoclass):
	import numpy
	from modshogun import SparseRealFeatures, RealFeatures, MulticlassLabels
	from modshogun import GaussianKernel
	from modshogun import LibSVMFile, CSVFile, BinaryFile, HDF5File

	feats=SparseRealFeatures(fm_train_real)
	feats2=SparseRealFeatures()

	f=BinaryFile("tmp/fm_train_sparsereal.bin","w")
	feats.save(f)

	f=LibSVMFile("tmp/fm_train_sparsereal.ascii","w")
	feats.save(f)

	f=BinaryFile("tmp/fm_train_sparsereal.bin")
	feats2.load(f)

	f=LibSVMFile("tmp/fm_train_sparsereal.ascii")
	feats2.load(f)

	feats=RealFeatures(fm_train_real)
	feats2=RealFeatures()

	f=BinaryFile("tmp/fm_train_real.bin","w")
	feats.save(f)

	f=HDF5File("tmp/fm_train_real.h5","w", "/data/doubles")
	feats.save(f)

	f=CSVFile("tmp/fm_train_real.ascii","w")
	feats.save(f)

	f=BinaryFile("tmp/fm_train_real.bin")
	feats2.load(f)
	#print("diff binary", numpy.max(numpy.abs(feats2.get_feature_matrix().flatten()-fm_train_real.flatten())))

	f=CSVFile("tmp/fm_train_real.ascii")
	feats2.load(f)
	#print("diff ascii", numpy.max(numpy.abs(feats2.get_feature_matrix().flatten()-fm_train_real.flatten())))

	lab=MulticlassLabels(numpy.array([0.0,1.0,2.0,3.0]))
	lab2=MulticlassLabels()
	f=CSVFile("tmp/label_train_twoclass.ascii","w")
	lab.save(f)

	f=BinaryFile("tmp/label_train_twoclass.bin","w")
	lab.save(f)

	f=HDF5File("tmp/label_train_real.h5","w", "/data/labels")
	lab.save(f)

	f=CSVFile("tmp/label_train_twoclass.ascii")
	lab2.load(f)

	f=BinaryFile("tmp/label_train_twoclass.bin")
	lab2.load(f)

	f=HDF5File("tmp/fm_train_real.h5","r", "/data/doubles")
	feats2.load(f)
	#print(feats2.get_feature_matrix())
	f=HDF5File("tmp/label_train_real.h5","r", "/data/labels")
	lab2.load(f)
	#print(lab2.get_labels())

	#clean up
	import os
	for f in ['tmp/fm_train_sparsereal.bin','tmp/fm_train_sparsereal.ascii',
			'tmp/fm_train_real.bin','tmp/fm_train_real.h5','tmp/fm_train_real.ascii',
			'tmp/label_train_real.h5', 'tmp/label_train_twoclass.ascii','tmp/label_train_twoclass.bin']:
		os.unlink(f)
	return feats, feats2, lab, lab2

if __name__=='__main__':
	print('Features IO')
	features_io_modular(*parameter_list[0])


text:
<?php
/**
 * Created by JetBrains PhpStorm.
 * User: JanGolle
 * Date: 12.11.14
 * Time: 16:06
 * To change this template use File | Settings | File Templates.
 */

namespace app\components;

use Yii;
use app\abstracts\BaseModel;
use app\abstracts\BaseForm;
use app\abstracts\BaseComponent;
use yii\base\Exception;
use yii\image\ImageDriver;
use yii\web\UploadedFile;

class Image extends BaseComponent
{
    /**
     * @var string
     */
    public $driver = 'GD';

    /**
     * @var ImageDriver
     */
    private $_imageDriver;

    /**
     * @var string
     */
    private $_image;

    public function init()
    {
        $this->getImageDriver();
    }

    /**
     * @return ImageDriver
     */
    private function getImageDriver()
    {
        if($this->_imageDriver === null){
            $imageDriver = new ImageDriver();
            $imageDriver->driver = $this->driver;

            $this->_imageDriver = $imageDriver;
        }

        return $this->_imageDriver;
    }

    /**
     * @param BaseForm $model
     * @param string $attrName
     * @param array $params
     * @param int $hostId
     * @throws \yii\base\ErrorException
     * @return bool|string
     */
    public function upload(BaseForm $model, $attrName = 'file', $params = [], $hostId = 1){
        if(!$_FILES)
            return false;;

        $model->$attrName = UploadedFile::getInstance($model, $attrName);
        if($model->$attrName)
            $this->_image = $model->$attrName->tempName;

        $image = $this->load($this->_image);

        if(!$image)
            return false;

        if($params === null)
            $params = [];

        $width = isset($params[0]) ? $params[0] : null;
        $height = isset($params[1]) ? $params[1] : 200;

        if(!$image->resize($width, $height)->save()){
            $model->addError($attrName, Yii::t('error', 'Не удалось загрузить файл'));
            return false;
        }

        $fileName = BaseModel::randomWord().StaticData::EXTENSION_IMAGE;

        if(!Yii::$app->static->uploadImg($fileName, $image->file, $hostId)){
            $model->addError($attrName, Yii::t('error', 'Не удалось загрузить файл'));
            return false;
        }

        return Yii::$app->static->getImg($fileName, $hostId);
    }

    public function uploadImageFromSource($data, $hostId = 1)
    {
        $name = $this->uploadImageFromSourceNoHost($data, $hostId);
        return Yii::$app->static->getImg($name, $hostId);
    }

    public function uploadImageFromSourceNoHost($data, $hostId = 1)
    {
        $data = str_replace('data:image/jpeg;base64,', '', $data);
        $data = base64_decode($data);

        try{
            $im = imagecreatefromstring($data);

            if($im === false){
                $this->addError(Yii::t('error', 'Не удалось создать изображение'));
                return false;
            }

            $name = BaseModel::randomWord().StaticData::EXTENSION_IMAGE;
            $fileName = sys_get_temp_dir().DIRECTORY_SEPARATOR.$name;

            $im = imagejpeg($im, $fileName);

            if($im === false){
                $this->addError(Yii::t('error', 'Не удалось создать изображение'));
                return false;
            }

            $path = Yii::$app->static->uploadImg($name, $fileName, $hostId);

            if($path === false){
                if($im === false){
                    $this->addError(Yii::t('error', 'Не удалось сохранить изображение'));
                    return false;
                }
            }

            return $path.'/'.$name;
        }catch(Exception $e){
            $this->addError(Yii::t('error', $e->getMessage()));
            return false;
        }
    }

    /**
     * @param $file
     * @return \yii\image\drivers\ImageGD
     */
    private function load($file)
    {
        return $this->getImageDriver()->load($file);
    }
}


text:
<?xml version="1.0" encoding="UTF-8"?>
<sem:triples uri="http://www.lds.org/vrl/specific-people/general-authorities-and-area-representatives/pearson-kevin-w" xmlns:sem="http://marklogic.com/semantics">
  <sem:triple>
    <sem:subject>http://www.lds.org/vrl/specific-people/general-authorities-and-area-representatives/pearson-kevin-w</sem:subject>
    <sem:predicate>http://www.w3.org/2004/02/skos/core#prefLabel</sem:predicate>
    <sem:object datatype="xsd:string" xml:lang="eng">Pearson, Kevin W.</sem:object>
  </sem:triple>
  <sem:triple>
    <sem:subject>http://www.lds.org/vrl/specific-people/general-authorities-and-area-representatives/pearson-kevin-w</sem:subject>
    <sem:predicate>http://www.w3.org/2004/02/skos/core#inScheme</sem:predicate>
    <sem:object datatype="sem:iri">http://www.lds.org/concept-scheme/vrl</sem:object>
  </sem:triple>
  <sem:triple>
    <sem:subject>http://www.lds.org/vrl/specific-people/general-authorities-and-area-representatives/pearson-kevin-w</sem:subject>
    <sem:predicate>http://www.lds.org/core#entityType</sem:predicate>
    <sem:object datatype="sem:iri">http://www.schema.org/Place</sem:object>
  </sem:triple>
</sem:triples>


text:
//  (C) Copyright Edward Diener 2011,2012
//  Use, modification and distribution are subject to 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).

#if !defined(BOOST_TTI_STATIC_MEMBER_DATA_GEN_HPP)
#define BOOST_TTI_STATIC_MEMBER_DATA_GEN_HPP

#include <boost/preprocessor/cat.hpp>

/*

  The succeeding comments in this file are in doxygen format.

*/

/** \file
*/

/// Generates the macro metafunction name for BOOST_TTI_HAS_STATIC_MEMBER_DATA.
/**
    name  = the name of the static member data.

    returns = the generated macro metafunction name.
*/
#define BOOST_TTI_HAS_STATIC_MEMBER_DATA_GEN(name) \
  BOOST_PP_CAT(has_static_member_data_,name) \
/**/

#endif // BOOST_TTI_STATIC_MEMBER_DATA_GEN_HPP


text:
title: "2020-04-14のJS: jQuery 3.5.0(securify fix)、Firefox 75、Chrome 81"
author: "azu"
layout: post
date : 2020-04-14T00:57:37.783Z
category: JSer
tags:
- jquery
- Firefox
- Chrome

---

JSer.info #483 - jQuery 3.5.0がリリースされました。

- [jQuery 3.5.0 Released! | Official jQuery Blog](https://blog.jquery.com/2020/04/10/jquery-3-5-0-released/)

jQuery 3.5.0では、jQuery 4.0で削除される予定の非標準な`:even`と`:odd`セレクタの代わりに、`.even()`と`.odd()`メソッドが追加されています。

また3.5.0はマイナーアップデートですが、非互換な変更を含むセキュリティアップデートが含まれています。
[jQuery.htmlPrefilter](https://api.jquery.com/jQuery.htmlPrefilter/)では正規表現を使って、`$("<div />")`のようなXHTMLのself-closeなタグを`$("<div></div>")`へと展開する処理が行われていました。
この正規表現での展開を使ったXSSが見つかったため、jQuery 3.5.0ではこの正規表現による展開を削除しています。

単一の`<div />`のようなケースは特に違いはありません。

```js
$('<div/>').append(document.body);
// <div></div> が追加される
```

次のように複数のself-closedなタグを書いた場合に3.4と3.5では挙動が異なります。

```js
$( "<div/><span/>" ).append(document.body);
```

jQuery 3.4までは[jQuery.htmlPrefilter](https://api.jquery.com/jQuery.htmlPrefilter/)によって次のように展開されていました。

```html
<div></div>
<span></span>
```

jQuery 3.5ではこの展開がなくなったため、次のような結果になります。

```html
<div>
    <span></span>
</div>
```

このセキュリティアップデートによってjQueryを使ったライブラリにも一部影響が出ているようです。

- [3.5 incompatible with FullCalendar 3 · Issue #4664 · jquery/jquery](https://github.com/jquery/jquery/issues/4664)

[jQuery Migrate](https://github.com/jquery/jquery-migrate)を使ったワークアラウンドや詳細については次のマイグレーションガイドにまとめられています。

- [jQuery Core 3.5 Upgrade Guide | jQuery](https://jquery.com/upgrade-guide/3.5/)

----

Firefox 75.0がリリースされました。

- [Firefox 75: Ambitions for April - Mozilla Hacks - the Web developer blog](https://hacks.mozilla.org/2020/04/firefox-75-ambitions-for-april/)
- [Firefox 75.0, See All New Features, Updates and Fixes](https://www.mozilla.org/en-US/firefox/75.0/releasenotes/)
- [Firefox 75 サイト互換性情報 | Firefox サイト互換性情報](https://www.fxsitecompat.dev/ja/versions/75/)
- [Firefox 75 for developers - Mozilla | MDN](https://developer.mozilla.org/ja/docs/Mozilla/Firefox/Releases/75)

開発者ツールのコンソールにInstant evaluation previewsの追加、Async Stack Traceの対応などが行われています。
JavaScriptでは[Public static fields](https://developer.mozilla.org/ja/docs/Web/JavaScript/Reference/Classes/Class_fields#Public_static_fields)や[Intl.Locale](https://developer.mozilla.org/ja/docs/Web/JavaScript/Reference/Global_Objects/Locale)のサポートが追加されています。
その他には、`<img loading=lazy>`での画像の遅延ロードのサポート、CSSの`min()`/`max()`/`clamp()`のサポート、Web Animations APIの改善なども行われています。

----

リリースが延期していたChrome 81がリリースされました。

- [New in Chrome 81  |  Web  |  Google Developers](https://developers.google.com/web/updates/2020/04/nic81)

リリーススケジュールがずれたため、次のChrome 82はスキップされ83が3週間早くリリースされる予定です。
今後のリリーススケジュールについては次のページで確認できます。

- [Chrome Platform Status](https://www.chromestatus.com/features/schedule)
- [Chromium Dash](https://chromiumdash.appspot.com/schedule)

----

## [PR] JavaScript Primerが発売予定

ここ数年書いていたJavaScript PrimerというJavaScriptの入門書が2020年4月27日に発売予定です。

JavaScript Primer 迷わないための入門書 | azu, Suguru Inatomi

物理書籍版は[Amazon](https://www.amazon.co.jp/dp/4048930737/)等で予約できるので欲しい人は予約してください。電子書籍版(Kindle/epub/PDF)も後日発売されます。

書籍の内容はOSSとして公開しているウェブ版の <https://jsprimer.net/> と同じですが、
レイアウトなどは書籍として読みやすくするために最適化されています。

詳細は次の記事を参照してください。

- [JavaScript Primerの書籍版が4月27日に発売予定です! | Web Scratch](https://efcl.info/2020/04/14/pre-jsprimer/)

----

ヘッドライン

----

## Release 10.4.0 · preactjs/preact
[github.com/preactjs/preact/releases/tag/10.4.0](https://github.com/preactjs/preact/releases/tag/10.4.0 "Release 10.4.0 · preactjs/preact")

React JavaScript library ReleaseNote

Preact 10.4.0リリース。
vnodeの厳密な比較によるパフォーマンス改善、SSR時にhydrationがうまく行かなかった際のfallbackを追加など

----

## jQuery 3.5.0 Released! | Official jQuery Blog
[blog.jquery.com/2020/04/10/jquery-3-5-0-released/](https://blog.jquery.com/2020/04/10/jquery-3-5-0-released/ "jQuery 3.5.0 Released! | Official jQuery Blog")

jQuery ReleaseNote

jQuery 3.5.0リリース。
`jQuery.htmlPrefilter`の正規表現のタグ展開によってXSSが発生する問題の修正。これによって`$("<div><div/></div>")` のようなself-closedなタグと他のタグの組わせの挙動が変更される破壊的な変更も含まれる。
4.0で削除される予定の`:even`と`:odd`の代わりに`.even()`と`.odd()`を追加など

- [3.5 incompatible with FullCalendar 3 · Issue #4664 · jquery/jquery](https://github.com/jquery/jquery/issues/4664 "3.5 incompatible with FullCalendar 3 · Issue #4664 · jquery/jquery")

----

## Firefox 75: Ambitions for April - Mozilla Hacks - the Web developer blog
[hacks.mozilla.org/2020/04/firefox-75-ambitions-for-april/](https://hacks.mozilla.org/2020/04/firefox-75-ambitions-for-april/ "Firefox 75: Ambitions for April - Mozilla Hacks - the Web developer blog")

Firefox ReleaseNote

Firefox 75リリース。
開発者ツールのコンソールにInstant evaluation previewsの追加、Async Stack Traceの対応。
`<img loading=lazy>`での画像の遅延ロードのサポート、CSSの`min()`/`max()`/`clamp()`のサポート、Web Animations APIの改善など。

- [Firefox 75.0, See All New Features, Updates and Fixes](https://www.mozilla.org/en-US/firefox/75.0/releasenotes/ "Firefox 75.0, See All New Features, Updates and Fixes")
- [Firefox 75 Site Compatibility | Firefox Site Compatibility](https://www.fxsitecompat.dev/versions/75/ "Firefox 75 Site Compatibility | Firefox Site Compatibility")
- [Firefox 75 for developers - Mozilla | MDN](https://developer.mozilla.org/ja/docs/Mozilla/Firefox/Releases/75 "Firefox 75 for developers - Mozilla | MDN")

----

## New in Chrome 81  |  Web  |  Google Developers
[developers.google.com/web/updates/2020/04/nic81](https://developers.google.com/web/updates/2020/04/nic81 "New in Chrome 81  |  Web  |  Google Developers")

Chrome ReleaseNote

延期していたChrome 81リリース。
次のChrome 82はスキップされ83が3週間早くリリースされる。
Badging APIのサポート、Intl.DisplayNamesの実装、Origin TrialとしてWeb NFC APIの追加など

----

## Release Notes for Safari Technology Preview 104 | WebKit
[webkit.org/blog/10264/release-notes-for-safari-technology-preview-104/](https://webkit.org/blog/10264/release-notes-for-safari-technology-preview-104/ "Release Notes for Safari Technology Preview 104 | WebKit")

webkit safari ReleaseNote

Safari Technology Preview 104リリース。
(macOSの開発版で)HTTP3をフラグ付きでサポート、CSSの`:is()`のサポート、WebRTC HEVC(H.265)のサポートなど

- [H265 / HEVC, hardware accelerated, in #Webrtc – DONE … well, almost. | WebRTC by Dr Alex](http://webrtcbydralex.com/index.php/2020/04/03/h265-hevc-hardware-accelerated-in-webrtc-done-well-almost/ "H265 / HEVC, hardware accelerated, in #Webrtc – DONE … well, almost. | WebRTC by Dr Alex")

----

アーティクル

----

## Web Animations in Safari 13.1 | WebKit
[webkit.org/blog/10266/web-animations-in-safari-13-1/](https://webkit.org/blog/10266/web-animations-in-safari-13-1/ "Web Animations in Safari 13.1 | WebKit")

CSS safari article

Safari 13.1でサポートされたWeb Animations APIについて

----

## WebSocketStream: integrating streams with the WebSocket API
[web.dev/websocketstream/](https://web.dev/websocketstream/ "WebSocketStream: integrating streams with the WebSocket API")

WebSocket strem article

PromiseベースであるWebSocketStream APIについての記事。
`ReadableStream`や`WritableStream`などの基本的な使い方、Backpressureについて、Streamの閉じ方についてなど

----

## Digging into the Privacy Sandbox
[web.dev/digging-into-the-privacy-sandbox/](https://web.dev/digging-into-the-privacy-sandbox/ "Digging into the Privacy Sandbox")

privacy Chrome article

プライバシー保護に関するAPIセットであるPrivacy Sandboxについての紹介記事。
現在のPrivacy Sandboxに関係するProposalの概要やゴール、関連する用語の解説など

----

## Under-the-hood of web bundlers (e.g. Webpack) - ITNEXT
[itnext.io/under-the-hood-of-web-bundlers-e-g-webpack-926e868f7f5e](https://itnext.io/under-the-hood-of-web-bundlers-e-g-webpack-926e868f7f5e "Under-the-hood of web bundlers (e.g. Webpack) - ITNEXT")

JavaScript bundler article video

JavaScriptのBundlerについての発表動画の記事版。
bundlerの行っていることの解説、小さなコンパイラを作りながらbundlerの動作の解説、実際にbundlerを使ってウェブアプリを出力するところまでを解説している。

- [Under-the-hood of web bundlers (e.g. Webpack) - YouTube](https://www.youtube.com/watch?v=JAY10_75vFw "Under-the-hood of web bundlers (e.g. Webpack) - YouTube")
- [craigtaub/our-own-webpack: Our own version of Webpack in <200 lines](https://github.com/craigtaub/our-own-webpack "craigtaub/our-own-webpack: Our own version of Webpack in <200 lines")

----

スライド、動画関係

----

## 電子情報学特論:Chromiumのアーキテクチャを解き明かす - Google スライド
[docs.google.com/presentation/d/1AzBcuN-dmctk7v1IMZHivfpFAiXwCnsjyJS3wQ4sgE4/preview#slide=id.g82989a6582\_1\_134](https://docs.google.com/presentation/d/1AzBcuN-dmctk7v1IMZHivfpFAiXwCnsjyJS3wQ4sgE4/preview#slide=id.g82989a6582_1_134 "電子情報学特論:Chromiumのアーキテクチャを解き明かす - Google スライド")

Chrome slide architecture security

Chromiumのプロセスアーキテクチャについてのスライド。
マルチプロセスアーキテクチャ、埋め込みコンテンツでのSpectreのメモリ読み取り、iframeでのSite Isolation、ChromeのGCの実装についてなど。
またレンダリング処理がParsing、Style、Layering、Rasterのステージに分けていて中間データをそれぞれ扱うことで動的な変更に対応している話など

----

ソフトウェア、ツール、ライブラリ関係

----

## Hopding/pdf-lib: Create and modify PDF documents in any JavaScript environment
[github.com/Hopding/pdf-lib](https://github.com/Hopding/pdf-lib "Hopding/pdf-lib: Create and modify PDF documents in any JavaScript environment")

PDF library node.js

PDFを作成できるNode.jsライブラリ

----

書籍関係

----

## JavaScript Primer 迷わないための入門書 | azu, Suguru Inatomi |本 | 通販 | Amazon
[www.amazon.co.jp/dp/4048930737/](https://www.amazon.co.jp/dp/4048930737/ "JavaScript Primer 迷わないための入門書 | azu, Suguru Inatomi |本 | 通販 | Amazon")

JavaScript book

2020年4月27日発売
JavaScriptの入門書。
https://jsprimer.net/ の書籍版。

- [JavaScript Primerの書籍版が4月27日に発売予定です! | Web Scratch](https://efcl.info/2020/04/14/pre-jsprimer/)

----


text:
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**source_path** | **str** | SourcePath is the absolute path of the file or directory inside the image to copy to the build directory. |
**destination_dir** | **str** | DestinationDir is the relative directory within the build directory where files copied from the image are placed. |

[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)


text:
<!DOCTYPE html>

	<?php
	foreach($settings as $value1){

	?>
	<title><?php echo $value1->settings_title ?></title>
	<link rel="icon" href="<?php echo base_url(); ?><?php echo $value1->settings_icon;?>">
	<meta charset="utf-8">
	<meta name="viewport" content="width=device-width, initial-scale=1">
	<link rel="stylesheet" href="<?php echo base_url(); ?>assets/css/bootstrap.min.css" type="text/css">
	<link href="http://fonts.googleapis.com/css?family=Montserrat" rel="stylesheet" type="text/css">

	<link href="<?php echo base_url(); ?>assets/font-awesome/css/font-awesome.min.css" rel="stylesheet" type="text/css">

				<a href="<?php echo base_url();?>"><img src="<?php echo base_url(); ?><?php echo $value1->settings_logo;?>" height="70">Shimoon Logistic

						 <?php echo $value1->settings_phone ?>

						 <?php echo $value1->settings_email ?>

			<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#myNavbar">

			</button>

<a href="<?php echo base_url();?>">Home

					About Us

<a href="<?php echo base_url();?>story">Our Story

<a href="<?php echo base_url();?>team">Our Team

<a href="<?php echo base_url();?>technology">Technology

<a href="<?php echo base_url();?>services">Services

<a href="<?php echo base_url();?>customers">Our Customers

                    Supply Chain Solution

                        <?php
                        foreach($supply as $value) {
                            ?>

<a href="<?php echo base_url(); ?>supply"><?php echo $value->supply_name;?>

                            <?php
                        }
                        ?>

<a href="<?php echo base_url();?>contact"">Contact Us

<?php
    if (isset($vw_home_front)) {

        $this->load->view($vw_home_front);
    }
    else if (isset($vw_customer_front)) {

        $this->load->view($vw_customer_front);
    }
	else if (isset($vw_services_front)) {

		$this->load->view($vw_services_front);
	}
	else if (isset($vw_supply_front)) {

		$this->load->view($vw_supply_front);
	}
	else if (isset($vw_contact)) {

		$this->load->view($vw_contact);
	}
    else if (isset($vw_pages_front)) {

        $this->load->view($vw_pages_front);
    }
    else
    {
        $this->load->view($vw_home_front);
    }
?>

	Desclaimer | Policy |<a href="<?php echo base_url();?>story">About Us | Career
	| <a href="<?php echo base_url();?>contact">Contact us

<?php echo $value1->settings_address ?>

&copy SHIMOON LOGISTICS

Developed By RESOFT

<?php
}
?>


text:
#pragma once
#include <aws/appflow/Appflow_EXPORTS.h>
#include <aws/core/utils/memory/stl/AWSString.h>
#include <utility>

namespace Aws
{
namespace Utils
{
namespace Json
{
  class JsonValue;
  class JsonView;
} // namespace Json
} // namespace Utils
namespace Appflow
{
namespace Model
{

  /**
   *
 The properties that are applied when Singular is being used as a source.
   *

See Also:
   AWS
   * API Reference

   */
  class AWS_APPFLOW_API SingularSourceProperties
  {
  public:
    SingularSourceProperties();
    SingularSourceProperties(Aws::Utils::Json::JsonView jsonValue);
    SingularSourceProperties& operator=(Aws::Utils::Json::JsonView jsonValue);
    Aws::Utils::Json::JsonValue Jsonize() const;

    /**
     *
 The object specified in the Singular flow source.

     */
    inline const Aws::String& GetObject() const{ return m_object; }

    /**
     *
 The object specified in the Singular flow source.

     */
    inline bool ObjectHasBeenSet() const { return m_objectHasBeenSet; }

    /**
     *
 The object specified in the Singular flow source.

     */
    inline void SetObject(const Aws::String& value) { m_objectHasBeenSet = true; m_object = value; }

    /**
     *
 The object specified in the Singular flow source.

     */
    inline void SetObject(Aws::String&& value) { m_objectHasBeenSet = true; m_object = std::move(value); }

    /**
     *
 The object specified in the Singular flow source.

     */
    inline void SetObject(const char* value) { m_objectHasBeenSet = true; m_object.assign(value); }

    /**
     *
 The object specified in the Singular flow source.

     */
    inline SingularSourceProperties& WithObject(const Aws::String& value) { SetObject(value); return *this;}

    /**
     *
 The object specified in the Singular flow source.

     */
    inline SingularSourceProperties& WithObject(Aws::String&& value) { SetObject(std::move(value)); return *this;}

    /**
     *
 The object specified in the Singular flow source.

     */
    inline SingularSourceProperties& WithObject(const char* value) { SetObject(value); return *this;}

  private:

    Aws::String m_object;
    bool m_objectHasBeenSet = false;
  };

} // namespace Model
} // namespace Appflow
} // namespace Aws


text:
<?xml version="1.0" encoding="utf-8"?>
<resources>
    <string name="hello">Hello World, CommandlineLikeDisplayActivity!</string>
    <string name="app_name">CommandlineLikeDisplay</string>
</resources>


text:
ACCEPTED

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

#### Published in
Biblthca Lichenol. 96: 66 (2007)

#### Original name
Xanthoparmelia boyaginensis Elix

### Remarks
null


text:
@implementation Category

@synthesize term;
@synthesize scheme;
@synthesize label;

- (id)init {
	self = [super init];
	return self;
}

- (void)dealloc {
	self.term = nil;
	self.scheme = nil;
	self.label = nil;
}

- (id)copyWithZone:(NSZone *)zone {
	Category* categoryCopy = [[Category allocWithZone:zone] init];
	categoryCopy.term = [self.term copyWithZone:zone];
	categoryCopy.scheme = [self.scheme copyWithZone:zone];
	categoryCopy.label = [self.label copyWithZone:zone];
	return categoryCopy;
}

@end


text:
using namespace refract;
using namespace dsd;

const char* Boolean::name = "boolean";

static_assert(!supports_erase<Boolean>::value, "");
static_assert(!supports_empty<Boolean>::value, "");
static_assert(!supports_push_back<Boolean>::value, "");
static_assert(!supports_begin<Boolean>::value, "");
static_assert(!supports_end<Boolean>::value, "");
static_assert(!supports_size<Boolean>::value, "");
static_assert(!supports_erase<Boolean>::value, "");
static_assert(!supports_key<Boolean>::value, "");
static_assert(!supports_value<Boolean>::value, "");
static_assert(!supports_merge<Boolean>::value, "");
static_assert(!is_iterable<Boolean>::value, "");
static_assert(!is_pair<Boolean>::value, "");

bool dsd::operator==(const Boolean& l, const Boolean& r) noexcept
{
    return l.get() == r.get();
}


text:
package com.ibm.bi.dml.hops.globalopt;

public class Summary
{

	private double _costsInitial = -1;
	private double _costsOptimal = -1;
	private long _numEnumPlans = -1;
	private long _numPrunedInvalidPlans = -1;
	private long _numPrunedSuboptPlans  = -1;
	private long _numCompiledPlans = -1;
	private long _numCostedPlans = -1;
	private long _numEnumPlanMismatch = -1;
	private long _numFinalPlanMismatch = -1;
	private double _timeGDFGraph = -1;
	private double _timeOptim = -1;

	public void setCostsInitial(double costsInitial) {
		_costsInitial = costsInitial;
	}

	public void setCostsOptimal(double costsOptimal) {
		_costsOptimal = costsOptimal;
	}

	public void setNumEnumPlans(long numEnumPlans) {
		_numEnumPlans = numEnumPlans;
	}

	public void setNumPrunedInvalidPlans(long numPrunedInvalidPlans) {
		_numPrunedInvalidPlans = numPrunedInvalidPlans;
	}

	public void setNumPrunedSuboptPlans(long numPrunedSuboptPlans) {
		_numPrunedSuboptPlans = numPrunedSuboptPlans;
	}

	public void setNumCompiledPlans(long numCompiledPlans) {
		_numCompiledPlans = numCompiledPlans;
	}

	public void setNumCostedPlans(long numCostedPlans) {
		_numCostedPlans = numCostedPlans;
	}

	public void setNumEnumPlanMismatch(long numEnumPlanMismatch) {
		_numEnumPlanMismatch = numEnumPlanMismatch;
	}

	public void setNumFinalPlanMismatch(long numFinalPlanMismatch) {
		_numFinalPlanMismatch = numFinalPlanMismatch;
	}

	public void setTimeGDFGraph(double timeGDFGraph) {
		_timeGDFGraph = timeGDFGraph;
	}

	public void setTimeOptim(double timeOptim) {
		_timeOptim = timeOptim;
	}

	@Override
	public String toString()
	{
		StringBuilder sb = new StringBuilder();

		sb.append("\nGlobal Optimization Summary:\n");
		sb.append("-- costs of initial plan:  "+_costsInitial +"\n");
		sb.append("-- costs of optimal plan:  "+_costsOptimal +"\n");
		sb.append("-- # enumerated plans:     "+_numEnumPlans +"\n");
		sb.append("-- # pruned invalid plans: "+_numPrunedInvalidPlans +"\n");
		sb.append("-- # pruned subopt plans:  "+_numPrunedSuboptPlans +"\n");
		sb.append("-- # program compilations: "+_numCompiledPlans +"\n");
		sb.append("-- # program costings:     "+_numCostedPlans +"\n");
		sb.append("-- # enum plan mismatch:   "+_numEnumPlanMismatch +"\n");
		sb.append("-- # final plan mismatch:  "+_numFinalPlanMismatch +"\n");
		sb.append("-- graph creation time:    "+String.format("%.3f", _timeGDFGraph/1000)+" sec.\n");
		sb.append("-- optimization time:      "+String.format("%.3f", _timeOptim/1000)+" sec.");

		return sb.toString();
	}
}


text:
@implementation MDCAppDelegate

#pragma mark - UIApplicationDelegate Protocol Methods

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
    return YES;
}

@end


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

<title>OpenCVData</title>
<link rel="stylesheet" type="text/css" href="../../../stylesheet.css" title="Style">

JavaScript is disabled on your browser.

Overview

Package

Class

Use

Tree

Deprecated

Index

Help

Prev Class

Next Class

Frames

No Frames

All Classes

Summary:

Nested |

Field |

Constr |

Method

Detail:

Field |

Constr |

Method

org.myrobotlab.opencv

Class OpenCVData

java.lang.Object

org.myrobotlab.opencv.OpenCVData

All Implemented Interfaces:

java.io.Serializable

public class OpenCVData
extends java.lang.Object
implements java.io.Serializable

This is the data returned from a single pass of an OpenCV pipeline of
 filters. The amount of data can be changed depending on individual
 configuration of the filters. The filters had some limited ability to add a
 copy of the image and add other data structures such as arrays of point,
 bounding boxes, masks and other information.

 The default behavior is to return the data from the LAST FILTER ON THE
 PIPELINE

 Some optimizations are done by saving the results of type conversions. For
 example if a JPG is asked for it is saved back into the data map, so that if
 its asked again, the cached copy will be returned

 All data is put in with keys with the following format
 [ServiceName].[FilterName].[Format].[Data Type] - e.g.
 opencv.PyramidDown.jpg.Bytes -- lame re-work ByteArray

 choices of images are "by filter name", the "input", the display, and the
 "last filter" == "output" choices of return types are IplImage, CVMat,
 BufferedImage, ByteBuffer, ByteArrayOutputStream, byte[]

 method naming conventions (get|set) (display | input | filtername) (format -
 IplImage=image CVMat | BufferedImage | ByteBuffer | Bytes

 internal keys - there are several expected keys - they are

 input    IplImage image = [[servicename].input]
 input    IplImage image = [[servicename].input].display

 filter   IplImage image = [[servicename].[filtername]]
 display  IplImage image = [[servicename].[filtername]].display

 optional type keys
 filter   IplImage image = [[servicename].[filtername]].bufferedImage
 display  IplImage image = [[servicename].[filtername]].display.bufferedImage
 filter   IplImage image = [[servicename].[filtername]].jpg.bytes
 display  IplImage image = [[servicename].[filtername]].display.jpg.bytes

Author:

GroG

See Also:

Serialized Form

Field Summary

Fields

Modifier and Type
Field and Description

static java.lang.String
KEY_BOUNDING_BOXES

return type - an ArrayList<Rectangles>

static java.lang.String
KEY_BUFFERED_IMAGE

static java.lang.String
KEY_BYTES

static java.lang.String
KEY_DEPTH

static java.lang.String
KEY_DISPLAY

return type - IplImage - either references original filtername IplImage or a
 filter.display() processes IplImage

static java.lang.String
KEY_HEIGHT

static java.lang.String
KEY_JPG

static java.lang.String
KEY_WIDTH

static org.slf4j.Logger
log

Constructor Summary

Constructors

Constructor and Description

OpenCVData()

constructed by the 'name'd service

OpenCVData(java.lang.String serviceName,
          int frameIndex)

Method Summary

Methods

Modifier and Type
Method and Description

boolean
containsAttribute(java.lang.String name)

boolean
containsKey(java.lang.String key)

java.lang.Object
getAttribute(java.lang.String name)

java.util.ArrayList<Rectangle>
getBoundingBoxArray()

java.awt.image.BufferedImage
getBufferedImage()

java.awt.image.BufferedImage
getBufferedImage(java.lang.String filterName,
                java.lang.String subkey)

FIXME (FIX OTHERS) NEEDS TO BE ONE AND ONLY ONE TYPE PROCESSOR LIKE THIS ONE !!!!
 WITH SAME SUBKEY SIGNATURE
 lowest level - full key path always required

java.nio.ByteBuffer
getByteBufferImage(java.lang.String filtername)

com.googlecode.javacv.cpp.opencv_core.IplImage
getDepthImage()

com.googlecode.javacv.cpp.opencv_core.IplImage
getDisplay()

java.awt.image.BufferedImage
getDisplayBufferedImage()

java.lang.String
getDisplayFilterName()

com.googlecode.javacv.cpp.opencv_core.CvMat
getEncoded(java.lang.String filterName,
          java.lang.String encoding)

OpenCVFilter
getFilter(java.lang.String name)

FIXME implement

Point2Df
getFirstPoint()

int
getHeight()

com.googlecode.javacv.cpp.opencv_core.IplImage
getImage()

parameterless tries to retrieve image based on current filtername

com.googlecode.javacv.cpp.opencv_core.IplImage
getImage(java.lang.String filtername)

OpenCV VideoProcessor will set this data collection to the last
 filtername - when asked for an "image" it will give the last filter's

java.awt.image.BufferedImage
getInputBufferedImage()

com.googlecode.javacv.cpp.opencv_core.IplImage
getInputImage()

get the original "camera" image - or the image which started the pipeline

com.googlecode.javacv.cpp.opencv_core.CvMat
getJPG(java.lang.String filterName)

java.nio.ByteBuffer
getJPGByteBuffer(java.lang.String filterName)

byte[]
getJPGBytes(java.lang.String filterName)

java.util.ArrayList<Point2Df>
getPoints()

java.lang.String
getSelectedFilterName()

long
getTimestamp()

int
getWidth()

java.lang.Integer
getX()

java.lang.Integer
getY()

java.util.Set<java.lang.String>
keySet()

void
logKeySet()

java.lang.String
makeKey(java.lang.String attributeName)

void
put(java.util.ArrayList<Rectangle> bb)

void
put(Rectangle boundingBox)

void
put(java.lang.String fullkey,
   com.googlecode.javacv.cpp.opencv_core.IplImage image)

the main and typically first image data put into the OpenCVData object

void
putAll(java.util.HashMap<java.lang.String,java.lang.Object> sources)

void
set(java.util.ArrayList<Point2Df> pointsToPublish)

void
setAttribute(java.lang.String key,
            java.lang.Object value)

void
setDisplayFilterName(java.lang.String displayFilterName)

void
setFilter(OpenCVFilter inFilter)

sets the selected filter name in the OpenCVData structure provisioned
 later to save entire filter? or parts ?

void
setInputFilterName(java.lang.String inputFilterName)

void
setSelectedFilterName(java.lang.String name)

sets the key - used to access the various data of a particular filter -
 first set the filter name the access images, points, etc

void
setTimestamp(long timestamp)

void
setX(int x)

void
setY(int y)

java.lang.String
writeDisplay()

java.lang.String
writeImage()

java.lang.String
writeImage(java.lang.String filter,
          java.lang.String subkey,
          java.lang.String format)

java.lang.String
writeInput()

Methods inherited from class java.lang.Object

equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Field Detail

log

public static final org.slf4j.Logger log

KEY_DEPTH

public static final java.lang.String KEY_DEPTH

See Also:

Constant Field Values

KEY_JPG

public static final java.lang.String KEY_JPG

See Also:

Constant Field Values

KEY_BYTES

public static final java.lang.String KEY_BYTES

See Also:

Constant Field Values

KEY_WIDTH

public static final java.lang.String KEY_WIDTH

See Also:

Constant Field Values

KEY_HEIGHT

public static final java.lang.String KEY_HEIGHT

See Also:

Constant Field Values

KEY_BUFFERED_IMAGE

public static final java.lang.String KEY_BUFFERED_IMAGE

See Also:

Constant Field Values

KEY_BOUNDING_BOXES

public static final java.lang.String KEY_BOUNDING_BOXES

return type - an ArrayList<Rectangles>

See Also:

Constant Field Values

KEY_DISPLAY

public static final java.lang.String KEY_DISPLAY

return type - IplImage - either references original filtername IplImage or a
 filter.display() processes IplImage

See Also:

Constant Field Values

Constructor Detail

OpenCVData

public OpenCVData()

constructed by the 'name'd service

Parameters:

serviceName -

OpenCVData

public OpenCVData(java.lang.String serviceName,
          int frameIndex)

Method Detail

setSelectedFilterName

public void setSelectedFilterName(java.lang.String name)

sets the key - used to access the various data of a particular filter -
 first set the filter name the access images, points, etc

Parameters:

name -

setFilter

public void setFilter(OpenCVFilter inFilter)

sets the selected filter name in the OpenCVData structure provisioned
 later to save entire filter? or parts ?

Parameters:

inFilter -

getSelectedFilterName

public java.lang.String getSelectedFilterName()

getWidth

public int getWidth()

getHeight

public int getHeight()

getImage

public com.googlecode.javacv.cpp.opencv_core.IplImage getImage(java.lang.String filtername)

OpenCV VideoProcessor will set this data collection to the last
 filtername - when asked for an "image" it will give the last filter's

Returns:

the filter's IplImage

getImage

public com.googlecode.javacv.cpp.opencv_core.IplImage getImage()

parameterless tries to retrieve image based on current filtername

Returns:

getInputImage

public com.googlecode.javacv.cpp.opencv_core.IplImage getInputImage()

get the original "camera" image - or the image which started the pipeline

Returns:

getDepthImage

public com.googlecode.javacv.cpp.opencv_core.IplImage getDepthImage()

put

public void put(java.lang.String fullkey,
       com.googlecode.javacv.cpp.opencv_core.IplImage image)

the main and typically first image data put into the OpenCVData object

Parameters:

key -

image -

getDisplayBufferedImage

public java.awt.image.BufferedImage getDisplayBufferedImage()

getInputBufferedImage

public java.awt.image.BufferedImage getInputBufferedImage()

getBufferedImage

public java.awt.image.BufferedImage getBufferedImage()

getBufferedImage

public java.awt.image.BufferedImage getBufferedImage(java.lang.String filterName,
                                            java.lang.String subkey)

FIXME (FIX OTHERS) NEEDS TO BE ONE AND ONLY ONE TYPE PROCESSOR LIKE THIS ONE !!!!
 WITH SAME SUBKEY SIGNATURE
 lowest level - full key path always required

Parameters:

filterName -

Returns:

getByteBufferImage

public java.nio.ByteBuffer getByteBufferImage(java.lang.String filtername)

writeDisplay

public java.lang.String writeDisplay()

writeInput

public java.lang.String writeInput()

writeImage

public java.lang.String writeImage()

writeImage

public java.lang.String writeImage(java.lang.String filter,
                          java.lang.String subkey,
                          java.lang.String format)

getJPGBytes

public byte[] getJPGBytes(java.lang.String filterName)

getJPGByteBuffer

public java.nio.ByteBuffer getJPGByteBuffer(java.lang.String filterName)

getJPG

public com.googlecode.javacv.cpp.opencv_core.CvMat getJPG(java.lang.String filterName)

getEncoded

public com.googlecode.javacv.cpp.opencv_core.CvMat getEncoded(java.lang.String filterName,
                                                     java.lang.String encoding)

containsKey

public boolean containsKey(java.lang.String key)

keySet

public java.util.Set<java.lang.String> keySet()

put

public void put(Rectangle boundingBox)

getBoundingBoxArray

public java.util.ArrayList<Rectangle> getBoundingBoxArray()

set

public void set(java.util.ArrayList<Point2Df> pointsToPublish)

getPoints

public java.util.ArrayList<Point2Df> getPoints()

getFirstPoint

public Point2Df getFirstPoint()

containsAttribute

public boolean containsAttribute(java.lang.String name)

put

public void put(java.util.ArrayList<Rectangle> bb)

getX

public java.lang.Integer getX()

setX

public void setX(int x)

getY

public java.lang.Integer getY()

setY

public void setY(int y)

getTimestamp

public long getTimestamp()

setTimestamp

public void setTimestamp(long timestamp)

makeKey

public java.lang.String makeKey(java.lang.String attributeName)

setAttribute

public void setAttribute(java.lang.String key,
                java.lang.Object value)

getAttribute

public java.lang.Object getAttribute(java.lang.String name)

setDisplayFilterName

public void setDisplayFilterName(java.lang.String displayFilterName)

getDisplay

public com.googlecode.javacv.cpp.opencv_core.IplImage getDisplay()

getDisplayFilterName

public java.lang.String getDisplayFilterName()

putAll

public void putAll(java.util.HashMap<java.lang.String,java.lang.Object> sources)

setInputFilterName

public void setInputFilterName(java.lang.String inputFilterName)

getFilter

public OpenCVFilter getFilter(java.lang.String name)

FIXME implement

Parameters:

name -

Returns:

logKeySet

public void logKeySet()

Overview

Package

Class

Use

Tree

Deprecated

Index

Help

Prev Class

Next Class

Frames

No Frames

All Classes

Summary:

Nested |

Field |

Constr |

Method

Detail:

Field |

Constr |

Method


text:
package net.itimothy.elasticsearch.plugin.swagger.v1_2.rest;

import net.itimothy.elasticsearch.routes.defaultroutes.DefaultRoutesProvider;
import net.itimothy.elasticsearch.routes.ModelsCatalog;
import org.elasticsearch.client.Client;
import org.elasticsearch.common.inject.Inject;
import org.elasticsearch.common.settings.Settings;
import net.itimothy.elasticsearch.plugin.swagger.v1_2.SwaggerProvider;
import net.itimothy.elasticsearch.plugin.swagger.v1_2.model.SwaggerModel;
import org.elasticsearch.rest.RestController;
import org.elasticsearch.rest.RestRequest;
import net.itimothy.elasticsearch.routes.RoutesProvider;

import static net.itimothy.elasticsearch.plugin.swagger.SwaggerPlugin.API_DOCS_PATH;
import static org.elasticsearch.rest.RestRequest.Method.GET;

public class ApiDeclarationRequestHandler extends RequestHandler {
    @Inject
    public ApiDeclarationRequestHandler(Settings settings, Client client, RestController controller) {
        super(settings, controller, client);
        controller.registerHandler(GET, API_DOCS_PATH + "/v1.2/{resource}", this);
        controller.registerHandler(GET, API_DOCS_PATH + "/{indexOrAlias}/v1.2/{resource}", this);
    }

    @Override
    protected SwaggerModel handleRequest(RestRequest request, Client client, RoutesProvider routesProvider) throws Exception {
        SwaggerProvider swaggerProvider = new SwaggerProvider(
            routesProvider.getInfo(),
            routesProvider.getRoutes()
        );

        return swaggerProvider.getApiDeclaration(request.param("resource"));
    }
}


text:
package deprecated.Others; /**
 * Created by kuman514 on 2017-06-06.
 */

import java.net.*;
import java.io.*;

public class SCRoom implements Runnable {

    private SCRoomRunnable clients[] = new SCRoomRunnable[5];
    public int clientCount = 0;

    private int ePort = -1;

    public SCRoom(int port) {
        this.ePort = port;
    }

    public void run() {
        ServerSocket serverSocket = null;
        try {
            serverSocket = new ServerSocket(ePort);
            System.out.println ("Server started: socket created on " + ePort);

            while (true) {
                addClient(serverSocket);
            }
        } catch (BindException b) {
            System.out.println("Can't bind on: "+ePort);
        } catch (IOException i) {
            System.out.println(i);
        } finally {
            try {
                if (serverSocket != null) serverSocket.close();
            } catch (IOException i) {
                System.out.println(i);
            }
        }
    }

    public int whoClient(int clientID) {
        for (int i = 0; i < clientCount; i++)
            if (clients[i].getClientID() == clientID)
                return i;
        return -1;
    }

    public void putClient(int clientID, String inputLine) {
        System.out.println("Sender - Message : " + inputLine);
        String sTo = "To : ";

        for (int i = 0; i < clientCount; i++) {
            if (clients[i].getClientID() == clientID) {
                continue;
            } else {
                sTo = sTo + clients[i].getClientID() + " ";
                clients[i].out.println(inputLine);
            }
        }

        System.out.println(sTo + "\n");
    }

    public void addClient(ServerSocket serverSocket) {
        Socket clientSocket = null;

        if (clientCount < clients.length) {
            try {
                clientSocket = serverSocket.accept();
                //clientSocket.setSoTimeout(40000);         // 1000/sec
            } catch (IOException i) {
                System.out.println ("Accept() fail: "+i);
            }
            clients[clientCount] = new SCRoomRunnable(this, clientSocket);
            new Thread(clients[clientCount]).start();
            clientCount++;
            System.out.println ("Client connected: " + clientSocket.getPort()
                    +", CurrentClient: " + clientCount);
        } else {
            try {
                Socket dummySocket = serverSocket.accept();
                SCRoomRunnable dummyRunnable = new SCRoomRunnable(this, dummySocket);
                new Thread(dummyRunnable);
                dummyRunnable.out.println(dummySocket.getPort() + " < Sorry maximum user connected now");
                System.out.println("Client refused: maximum connection " + clients.length + " reached.");
                dummyRunnable.close();
            } catch (IOException i) {
                System.out.println(i);
            }
        }
    }

    public synchronized void delClient(int clientID) {
        int pos = whoClient(clientID);
        SCRoomRunnable endClient = null;
        if (pos >= 0) {
            endClient = clients[pos];
            if (pos < clientCount-1)
                for (int i = pos+1; i < clientCount; i++)
                    clients[i-1] = clients[i];
            clientCount--;
            System.out.println("Client removed: " + clientID + " at clients[" + pos +"], CurrentClient: " + clientCount);
            endClient.close();
        }
    }

    public SCRoom getRoom() {return this;}

    /*
    public static void main(String[] args) throws IOException {
        if (args.length != 1) {
            System.out.println("Usage: Classname ServerPort");
            System.exit(1);
        }
        int ePort = Integer.parseInt(args[0]);

        new Thread(new SCRoom(ePort)).start();
    }
    */
}