text:
<!DOCTYPE html>

	<meta charset="utf-8">

	<title>NOZUnzipper Class Reference</title>

	<link rel="stylesheet" href="../css/style.css">
	<meta name="viewport" content="initial-scale=1, maximum-scale=1.4">
	<meta name="generator" content="appledoc 2.2.1 (build 1333)">

				ZipUtilities

				Nolan O'Brien

Index

Hierarchy

							On This Page

							<select id="jump-to">
	<option value="top">Jump To…</option>

	<option value="overview">Overview</option>

	<option value="tasks">Tasks</option>

	<optgroup label="Properties">

		<option value="//api/name/zipFilePath">zipFilePath</option>

		<option value="//api/name/centralDirectory">centralDirectory</option>

	</optgroup>

	<optgroup label="Class Methods">

		<option value="//api/name/new">+ new</option>

	</optgroup>

	<optgroup label="Instance Methods">

		<option value="//api/name/initWithZipFile:">- initWithZipFile:</option>

		<option value="//api/name/init">- init</option>

		<option value="//api/name/openAndReturnError:">- openAndReturnError:</option>

		<option value="//api/name/closeAndReturnError:">- closeAndReturnError:</option>

		<option value="//api/name/readCentralDirectoryAndReturnError:">- readCentralDirectoryAndReturnError:</option>

		<option value="//api/name/readRecordAtIndex:error:">- readRecordAtIndex:error:</option>

		<option value="//api/name/indexForRecordWithName:">- indexForRecordWithName:</option>

		<option value="//api/name/enumerateManifestEntriesUsingBlock:">- enumerateManifestEntriesUsingBlock:</option>

		<option value="//api/name/readDataFromRecord:progressBlock:error:">- readDataFromRecord:progressBlock:error:</option>

		<option value="//api/name/enumerateByteRangesOfRecord:progressBlock:usingBlock:">- enumerateByteRangesOfRecord:progressBlock:usingBlock:</option>

		<option value="//api/name/saveRecord:toDirectory:shouldOverwrite:progressBlock:error:">- saveRecord:toDirectory:shouldOverwrite:progressBlock:error:</option>

	</optgroup>

</select>

NOZUnzipper Class Reference

	Inherits from
	NSObject

	Declared in
	NOZUnzipper.h

Overview

NOZUnzipper unzips an archive.

  Uses zlib to decompress and therefore only supports deflate compressed entries/record.

  zipFilePath

The path to the zip archive

@property (nonatomic, readonly, nonnull) NSString *zipFilePath

Declared In

NOZUnzipper.h

  centralDirectory

The central directory object.  nil if it hasn’t been parsed (or failed to be read).

@property (nonatomic, readonly, nullable) NOZCentralDirectory *centralDirectory

Declared In

NOZUnzipper.h

– initWithZipFile:

Designated initializer

- (nonnull instancetype)initWithZipFile:(nonnull NSString *)zipFilePath

Declared In

NOZUnzipper.h

– init

Unavailable

- (nullable instancetype)init

Declared In

NOZUnzipper.h

+ new

Unavailable

+ (nullable instancetype)new

Declared In

NOZUnzipper.h

– openAndReturnError:

Open the zip archive.
Must open before performing another action.
Should be balanced with a closeAndReturnError: call

- (BOOL)openAndReturnError:(out NSError *__nullable *__nullable)error

Declared In

NOZUnzipper.h

– closeAndReturnError:

Close the open archive.
Harmless to call redundantly.

- (BOOL)closeAndReturnError:(out NSError *__nullable *__nullable)error

Declared In

NOZUnzipper.h

– readCentralDirectoryAndReturnError:

Read the central directory.
Must read the central directory before doing anything with specific entries.
If successful, [NOZUnzipper centralDirectory] will be populated (and no longer nil).

- (nullable NOZCentralDirectory *)readCentralDirectoryAndReturnError:(out NSError *__nullable *__nullable)error

Declared In

NOZUnzipper.h

– readRecordAtIndex:error:

Read a central directory record at a specific index.

- (nullable NOZCentralDirectoryRecord *)readRecordAtIndex:(NSUInteger)index error:(out NSError *__nullable *__nullable)error

Declared In

NOZUnzipper.h

– indexForRecordWithName:

Find the index for a record matching the name provided.  NSNotFound if no match was found.

- (NSUInteger)indexForRecordWithName:(nonnull NSString *)name

Declared In

NOZUnzipper.h

– enumerateManifestEntriesUsingBlock:

Enumerate all the records.

- (void)enumerateManifestEntriesUsingBlock:(__attribute__ ( ( noescape ) ) NOZUnzipRecordEnumerationBlock __nonnull)block

Declared In

NOZUnzipper.h

– readDataFromRecord:progressBlock:error:

Read a record as NSData.

- (nullable NSData *)readDataFromRecord:(nonnull NOZCentralDirectoryRecord *)record progressBlock:(nullable NOZProgressBlock)progressBlock error:(out NSError *__autoreleasing __nullable *__nullable)error

Declared In

NOZUnzipper.h

– enumerateByteRangesOfRecord:progressBlock:usingBlock:

Stream a record’s data to block.

- (nullable NSError *)enumerateByteRangesOfRecord:(nonnull NOZCentralDirectoryRecord *)record progressBlock:(nullable NOZProgressBlock)progressBlock usingBlock:(nonnull NOZUnzipByteRangeEnumerationBlock)block

Declared In

NOZUnzipper.h

– saveRecord:toDirectory:shouldOverwrite:progressBlock:error:

Save a record to disk.

- (BOOL)saveRecord:(nonnull NOZCentralDirectoryRecord *)record toDirectory:(nonnull NSString *)destinationRootDirectory shouldOverwrite:(BOOL)overwrite progressBlock:(nullable NOZProgressBlock)progressBlock error:(out NSError *__autoreleasing __nullable *__nullable)error

Declared In

NOZUnzipper.h

Copyright © 2015 Nolan O'Brien. All rights reserved. Updated: 2015-08-23

Generated by appledoc 2.2.1 (build 1333).


text:
package com.facebook.buck.rules;

import com.facebook.buck.android.AndroidDirectoryResolver;
import com.facebook.buck.apple.AppleConfig;
import com.facebook.buck.apple.AppleCxxPlatforms;
import com.facebook.buck.apple.AppleSdk;
import com.facebook.buck.apple.AppleSdkDiscovery;
import com.facebook.buck.apple.AppleSdkPaths;
import com.facebook.buck.apple.AppleToolchain;
import com.facebook.buck.apple.AppleToolchainDiscovery;
import com.facebook.buck.cli.BuckConfig;
import com.facebook.buck.io.ProjectFilesystem;
import com.facebook.buck.log.Logger;
import com.facebook.buck.util.ProcessExecutor;
import com.google.common.collect.ImmutableMap;
import java.io.IOException;
import java.nio.file.Path;
import java.util.Optional;

/**
 * Contain items used to construct a {@link KnownBuildRuleTypes} that are shared between all {@link
 * Cell} instances.
 */
public class KnownBuildRuleTypesFactory {

  private static final Logger LOG = Logger.get(KnownBuildRuleTypesFactory.class);

  private final ProcessExecutor executor;
  private final AndroidDirectoryResolver directoryResolver;

  public KnownBuildRuleTypesFactory(
      ProcessExecutor executor, AndroidDirectoryResolver directoryResolver) {
    this.executor = executor;
    this.directoryResolver = directoryResolver;
  }

  public KnownBuildRuleTypes create(
      BuckConfig config, ProjectFilesystem filesystem, SdkEnvironment sdkEnvironment)
      throws IOException, InterruptedException {
    return KnownBuildRuleTypes.createInstance(
        config, filesystem, executor, directoryResolver, sdkEnvironment);
  }

  public SdkEnvironment createSdkEnvironment(BuckConfig config) {
    Optional<Path> appleDeveloperDir =
        AppleCxxPlatforms.getAppleDeveloperDirectory(config, this.executor);

    AppleConfig appleConfig = config.getView(AppleConfig.class);
    Optional<ImmutableMap<String, AppleToolchain>> appleToolchains = Optional.empty();
    try {
      appleToolchains =
          Optional.of(
              AppleToolchainDiscovery.discoverAppleToolchains(
                  appleDeveloperDir, appleConfig.getExtraToolchainPaths()));
    } catch (IOException e) {
      LOG.error(
          e,
          "Couldn't find the Apple build toolchain.\nPlease check that the SDK is installed properly.");
    }

    Optional<ImmutableMap<AppleSdk, AppleSdkPaths>> appleSdkPaths = Optional.empty();
    if (appleToolchains.isPresent()) {
      try {
        appleSdkPaths =
            Optional.of(
                AppleSdkDiscovery.discoverAppleSdkPaths(
                    appleDeveloperDir,
                    appleConfig.getExtraPlatformPaths(),
                    appleToolchains.get(),
                    appleConfig));
      } catch (IOException e) {
        LOG.error(
            e, "Couldn't find the Apple SDK.\nPlease check that the SDK is installed properly.");
      }
    }

    return SdkEnvironment.of(
        appleSdkPaths,
        appleToolchains,
        directoryResolver.getSdkOrAbsent(),
        directoryResolver.getNdkOrAbsent(),
        directoryResolver.getNdkVersion());
  }
}

redpajama_set_name: RedPajamaGithub


text:
#ifndef org_mitk_gui_qt_classificationregiongrow_Activator_h
#define org_mitk_gui_qt_classificationregiongrow_Activator_h

#include <ctkPluginActivator.h>

namespace mitk {

class org_mitk_gui_qt_classificationregiongrow_Activator :
  public QObject, public ctkPluginActivator
{
  Q_OBJECT
  Q_PLUGIN_METADATA(IID "org_mitk_gui_qt_classificationregiongrow")
  Q_INTERFACES(ctkPluginActivator)

public:

  void start(ctkPluginContext* context);
  void stop(ctkPluginContext* context);

}; // org_mitk_gui_qt_classificationregiongrow_Activator

}

#endif // org_mitk_gui_qt_classificationregiongrow_Activator_h


text:
  Laval-sur-Doulon est
       un village
       géographiquement positionné dans le département de Haute-Loire en Auvergne. Elle totalisait 61 habitants en 2008.

Si vous envisagez de demenager à Laval-sur-Doulon, vous pourrez aisément trouver une maison à acheter.

Le parc de logements, à Laval-sur-Doulon, se décomposait en 2011 en deux appartements et 109 maisons soit
 un marché plutôt équilibré.

À proximité de Laval-sur-Doulon sont situées les communes de
Cistrières à 5 km, 141 habitants,
Saint-Alyre-d'Arlanc localisée à 6 km, 185 habitants,
La Chapelle-Geneste localisée à 8 km, 141 habitants,
Connangles à 8 km, 138 habitants,
Saint-Vert localisée à 3 km, 103 habitants,
Saint-Didier-sur-Doulon à 5 km, 228 habitants,
 entre autres. De plus, Laval-sur-Doulon est située à seulement 26 km de Ambert.


text:
import { ImageGalleryService } from './ImageGalleryService'

export {
    ImageGalleryService
}


text:
package org.apache.river.test.spec.javaspace.conformance;

import java.util.logging.Level;

// net.jini
import net.jini.space.JavaSpace;

// org.apache.river
import org.apache.river.qa.harness.TestException;

/**
 * ReadTest asserts that for read with timeouts other then NO_WAIT:
 * 1) If a match is found by read, a reference to a copy of the matching
 *    entry is returned.
 * 2) If no match is found, null is returned.
 * 3) Passing a null reference for the template will match any entry.
 *
 * @author Mikhail A. Markov
 */
public class ReadTest extends AbstractReadTestBase {

    /**
     * This method asserts that for read with timeouts other then NO_WAIT:
     * 1) If a match is found by read, a reference to a copy of the matching
     *    entry is returned.
     * 2) If no match is found, null is returned.
     * 3) Passing a null reference for the template will match any entry.
     *
     *
Notes:
For more information see the JavaSpaces specification
     * section 2.4.

     */
    public void run() throws Exception {
        SimpleEntry sampleEntry1 = new SimpleEntry("TestEntry #1", 1);
        SimpleEntry sampleEntry2 = new SimpleEntry("TestEntry #2", 2);
        SimpleEntry sampleEntry3 = new SimpleEntry("TestEntry #1", 2);
        SimpleEntry template;
        String msg;

        // first check that space is empty
        if (!checkSpace(space)) {
            throw new TestException("Space is not empty in the beginning.");
        }

        // write three sample entries twice to the space
        space.write(sampleEntry1, null, leaseForeverTime);
        space.write(sampleEntry1, null, leaseForeverTime);
        space.write(sampleEntry2, null, leaseForeverTime);
        space.write(sampleEntry2, null, leaseForeverTime);
        space.write(sampleEntry3, null, leaseForeverTime);
        space.write(sampleEntry3, null, leaseForeverTime);

        // read 1-st entry from the space using the same one as a template
        msg = testTemplate(sampleEntry1, null, Long.MAX_VALUE, 0, false);

        if (msg != null) {
            throw new TestException(msg);
        }

        /*
         * read sample entry from the space using
         * wrong template entries
         */
        template = new SimpleEntry("TestEntry #3", 1);
        msg = testWrongTemplate(template, null, checkTime, 0, false);

        if (msg != null) {
            throw new TestException(msg);
        }

        // 2-nd wrong template
        template = new SimpleEntry("TestEntry #1", 3);
        msg = testWrongTemplate(template, null, timeout1, 0, false);

        if (msg != null) {
            throw new TestException(msg);
        }

        // 3-rd wrong template
        template = new SimpleEntry("TestEntry #3", 3);
        msg = testWrongTemplate(template, null, timeout2, 0, false);

        if (msg != null) {
            throw new TestException(msg);
        }

        // 4-th wrong template
        template = new SimpleEntry(null, 3);
        msg = testWrongTemplate(template, null, checkTime, 0, false);

        if (msg != null) {
            throw new TestException(msg);
        }

        // 5-th wrong template
        template = new SimpleEntry("TestEntry #3", null);
        msg = testWrongTemplate(template, null, timeout2, 0, false);

        if (msg != null) {
            throw new TestException(msg);
        }

        /*
         * read entry from the space using null as a template
         */
        msg = testTemplate(null, null, timeout1, 0, false);

        if (msg != null) {
            throw new TestException(msg);
        }

        /*
         * read sample entries from the space using templates with
         * null as a wildcard for different fields
         */
        template = new SimpleEntry("TestEntry #1", null);
        msg = testTemplate(template, null, timeout1, 0, false);

        if (msg != null) {
            throw new TestException(msg);
        }

        // try 2-nd template
        template = new SimpleEntry(null, 2);
        msg = testTemplate(template, null, timeout2, 0, false);

        if (msg != null) {
            throw new TestException(msg);
        }

        // 3-rd template
        template = new SimpleEntry(null, null);
        msg = testTemplate(template, null, checkTime, 0, false);

        if (msg != null) {
            throw new TestException(msg);
        }
    }
}


text:
$imported = {} if $imported == nil
$imported["IEX_Party_Shift"] = true

#==============================================================================#
# ** IEX::PARTY_SHIFT
#------------------------------------------------------------------------------#
#==============================================================================#
module IEX
  module PARTY_SHIFT
#==============================================================================
#                           Start Customization
#------------------------------------------------------------------------------
#==============================================================================
    SHIFT_ANIMATION_ID = 381 # Animation played when shifting, set to nil if unused
    SHIFT_WAIT = 120         # Time between party shifts in frames
    SHIFT_IF_DEAD = true     # If first member is dead, should a shift occur
    SKIP_DEAD = true         # If shifting and a dead member is set, should it skip?
    MOVE_ON_SHIFT = true     # Should the player move when shifting, if true a step is down

    RECOVER_SHIFT  = true    # Should members of the party recover slowly
    RECOVER_ACTIVE = true    # Should the first member recover also
    RECOVER_HP     = true    # Should Hp Be recovered
    RECOVER_MP     = true    # Should Mp Be recovered
    RECOVER_DEAD   = false   # If dead, should they recover, this is not reccommended for ABS
    NO_RECOVER_MOVE= true    # If moving, the party will not recover
    RECOVER_PERCENT= 1       # Percentage to recover each time
    RECOVER_TIME   = 20      # In frames

    SHIFT_BUTTON_L = Input::L
    SHIFT_BUTTON_R = Input::R
#==============================================================================
#                           End Customization
#------------------------------------------------------------------------------
#==============================================================================
  end
end

#==============================================================================#
# ** Game_System
#------------------------------------------------------------------------------#
#==============================================================================#
class Game_System

  attr_accessor :shift_recover_time

  alias iex_party_shift_gs_initialize initialize unless $@
  def initialize(*args)
    iex_party_shift_gs_initialize(*args)
    @shift_recover_time = 0
  end

end

#==============================================================================#
# ** Game_Party
#------------------------------------------------------------------------------#
#==============================================================================#
class Game_Party < Game_Unit

  def iex_party_shift
    @actors.push(@actors.shift)
  end

  def iex_party_unshift
    @actors.unshift(@actors.pop)
  end

  def iex_party_swap(actor_id)
  end

  def iex_party_shift_party_recover_percent(active_rec = false, percent = 0, hp_recover = true, mp_recover = false, dead_recover = true)
    for act in members
      unless active_rec
        next if act == members[0]
      end
      next if act.dead? and dead_recover == false
      if hp_recover
        act.hp += [(percent * act.maxhp / 100).to_i, 1].max
      end
      if mp_recover
        act.mp += [(percent * act.maxmp / 100).to_i, 1].max
      end
    end
  end

end

#==============================================================================#
# ** Game_Player
#------------------------------------------------------------------------------#
#==============================================================================#
class Game_Player < Game_Character

  attr_accessor :iex_shift_wait

  alias iex_party_shift_initialize initialize unless $@
  def initialize(*args)
    iex_party_shift_initialize(*args)
    @iex_shift_wait = 0
  end

  def can_perform_shift?
    return false if $game_map.interpreter.running?
    return false if $game_message.visible
    return true
  end

  alias iex_party_shift_update update unless $@
  def update(*args)
    iex_party_shift_update(*args)
    if $game_party.members[0] != nil
      if can_perform_shift?
        iex_perform_shift
      end
      if IEX::PARTY_SHIFT::SHIFT_IF_DEAD
        if $game_party.members[0].dead? and not $game_party.all_dead?
          iex_party_shift
        end
      end
    end
  end

  def iex_perform_shift
    @iex_shift_wait -= 1 unless @iex_shift_wait == 0
    return unless @iex_shift_wait <= 0
    if Input.trigger?(IEX::PARTY_SHIFT::SHIFT_BUTTON_R)
      iex_party_shift
      @iex_shift_wait = IEX::PARTY_SHIFT::SHIFT_WAIT
    elsif Input.trigger?(IEX::PARTY_SHIFT::SHIFT_BUTTON_L)
      iex_party_unshift
      @iex_shift_wait = IEX::PARTY_SHIFT::SHIFT_WAIT
    end

  end

  def iex_party_shift
    Sound.play_cursor
    if IEX::PARTY_SHIFT::SHIFT_ANIMATION_ID != nil
      @animation_id = IEX::PARTY_SHIFT::SHIFT_ANIMATION_ID
    end
    iex_half_backward if IEX::PARTY_SHIFT::MOVE_ON_SHIFT
    $game_party.iex_party_shift
    refresh
    iex_half_forward if IEX::PARTY_SHIFT::MOVE_ON_SHIFT
  end

  def iex_party_unshift
    Sound.play_cursor
    if IEX::PARTY_SHIFT::SHIFT_ANIMATION_ID != nil
      @animation_id = IEX::PARTY_SHIFT::SHIFT_ANIMATION_ID
    end
    iex_half_backward if IEX::PARTY_SHIFT::MOVE_ON_SHIFT
    $game_party.iex_party_unshift
    refresh
    iex_half_forward if IEX::PARTY_SHIFT::MOVE_ON_SHIFT
  end

  #--------------------------------------------------------------------------
  # * Half Down
  #--------------------------------------------------------------------------
  def iex_half_down(turn_ok = true)
    turn_down if turn_ok
    @y = $game_map.round_y(@y + 0.5)
    @real_y = ((@y - 0.5)*256)
    @move_failed = false
  end

  #--------------------------------------------------------------------------
  # * Half Left
  #--------------------------------------------------------------------------
  def iex_half_left(turn_ok = true)
    turn_left if turn_ok
    @x = $game_map.round_x(@x-0.5)
    @real_x = ((@x+0.5)*256)
    @move_failed = false
  end

  #--------------------------------------------------------------------------
  # * Half Right
  #--------------------------------------------------------------------------
  def iex_half_right(turn_ok = true)
    turn_right if turn_ok
    @x = $game_map.round_x(@x+0.5)
    @real_x = ((@x-0.5)*256)
    @move_failed = false
  end

  #--------------------------------------------------------------------------
  # * Half Up
  #--------------------------------------------------------------------------
  def iex_half_up(turn_ok = true)
    turn_up if turn_ok
    @y = $game_map.round_y(@y-0.5)
    @real_y = ((@y+0.5)*256)
    @move_failed = false
  end

  #--------------------------------------------------------------------------
  # * Half Forward
  #--------------------------------------------------------------------------
  def iex_half_forward
    case @direction
    when 2;  iex_half_down
    when 4;  iex_half_left
    when 6;  iex_half_right
    when 8;  iex_half_up
    end
  end
  #--------------------------------------------------------------------------
  # * Half Backward
  #--------------------------------------------------------------------------
  def iex_half_backward
    last_direction_fix = @direction_fix
    @direction_fix = true
    case @direction
    when 2;  iex_half_up
    when 4;  iex_half_right
    when 6;  iex_half_left
    when 8;  iex_half_down
    end
    @direction_fix = last_direction_fix
  end

end

#==============================================================================#
# ** Scene_Map
#------------------------------------------------------------------------------#
#==============================================================================#
class Scene_Map < Scene_Base

  alias iex_party_shift_anim_scm_update update unless $@
  def update(*args)
    iex_party_shift_anim_scm_update(*args)
    if IEX::PARTY_SHIFT::RECOVER_SHIFT
      $game_system.shift_recover_time -= 1 unless $game_system.shift_recover_time == 0
      if $game_system.shift_recover_time == 0
        unless $game_message.visible
          if $game_player.moving? and IEX::PARTY_SHIFT::NO_RECOVER_MOVE
            can_rec = false
          else
            can_rec = true
          end
          if can_rec
            $game_party.iex_party_shift_party_recover_percent(IEX::PARTY_SHIFT::RECOVER_ACTIVE, IEX::PARTY_SHIFT::RECOVER_PERCENT, IEX::PARTY_SHIFT::RECOVER_HP, IEX::PARTY_SHIFT::RECOVER_MP, IEX::PARTY_SHIFT::RECOVER_DEAD)
            $game_system.shift_recover_time = IEX::PARTY_SHIFT::RECOVER_TIME
          end
        end
      end
    end
  end

end


text:
module ApiV1
  module Security
    class AuthConfigsRepresenter < BaseRepresenter
      alias_method :profiles, :represented
      link :self do |opts|
        opts[:url_builder].apiv1_admin_security_auth_configs_url
      end

      link :doc do |opts|
        'https://api.gocd.org/#authorization-configuration'
      end

      link :find do |opts|
        opts[:url_builder].apiv1_admin_security_auth_config_url(auth_config_id: '__auth_config_id__').gsub('__auth_config_id__', ':auth_config_id')
      end

      collection :profiles, as: :auth_configs, embedded: true, exec_context: :decorator, decorator: AuthConfigRepresenter

    end
  end
end


text:
// Copyright 2015 The rkt Authors
//
// 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.

// +build !fly

package main

import (
	"crypto/sha1"
	"fmt"
	"io/ioutil"
	"os"
	"path/filepath"
	"strings"
	"testing"
	"time"

	"github.com/coreos/gexpect"
	"github.com/coreos/rkt/tests/testutils"
)

// stage1/prepare-app will populate /etc/hosts with a 127.0.0.1 entry when absent,
// or leave it alone when present.  These tests verify that behavior.

/*
	The stage0 can create an etc hosts

	prepare-app will overwrite the app's /etc/hosts if the stage0 created one
	Otherwise, it will create a fallback /etc/hosts if the stage2 does not have one
*/
func TestEtcHosts(t *testing.T) {
	ctx := testutils.NewRktRunCtx()
	defer ctx.Cleanup()

	tmpdir := createTempDirOrPanic("rkt-tests.")
	defer os.RemoveAll(tmpdir)
	tmpetc := createTempDirOrPanic("rkt-tests-etc.")
	defer os.RemoveAll(tmpetc)

	tmpfile := filepath.Join(tmpetc, "hosts")
	if err := ioutil.WriteFile(tmpfile, []byte(`<<<preexisting etc>>>`), 0600); err != nil {
		t.Fatalf("Cannot create etc/hosts file: %v", err)
	}

	dat, err := ioutil.ReadFile("/etc/hosts")
	if err != nil {
		t.Fatal("Could not read host's /etc/hosts", err)
	}

	sum := fmt.Sprintf("%x", sha1.Sum(dat))

	tests := []struct {
		rktArgs     string
		inspectArgs string
		expectRegEx string
	}{
		{
			fmt.Sprintf("--volume hosts,kind=host,source=%s", tmpfile),
			"--mount volume=hosts,target=/etc/hosts --exec=/inspect -- -file-name=/etc/hosts -read-file",
			"<<<preexisting etc>>>",
		},
		{ // Test that with no /etc/hosts, the fallback is created
			"",
			"--exec=/inspect -- -file-name=/etc/hosts -hash-file",
			"192f716fb0db669de1c537b845b632f03c9aeb40",
		},
		{ // Test that with --hosts-entry=host, the host's is copied
			"--hosts-entry=host",
			"--exec=/inspect -- -file-name=/etc/hosts -hash-file",
			sum,
		},
		{ // test that we create our own
			"--hosts-entry=128.66.0.99=host1",
			"--exec=/inspect -- -file-name=/etc/hosts -read-file",
			"128.66.0.99 host1",
		},
	}

	for i, tt := range tests {
		cmd := fmt.Sprintf(
			"%s run --insecure-options=image %s %s %s",
			ctx.Cmd(),
			tt.rktArgs,
			getInspectImagePath(),
			tt.inspectArgs)

		t.Logf("Running test #%v: %v", i, cmd)

		child, err := gexpect.Spawn(cmd)
		if err != nil {
			t.Fatalf("Cannot exec rkt #%v: %v", i, err)
		}

		_, out, err := expectRegexTimeoutWithOutput(child, tt.expectRegEx, 30*time.Second)
		if err != nil {
			t.Fatalf("Test %d %v %v", i, err, out)
		}

		err = child.Wait()
		if err != nil {
			t.Fatalf("rkt didn't terminate correctly: %v", err)
		}
	}
}

// stage1/prepare-app will bind mount /proc/sys/kernel/hostname on /etc/hostname,
// see https://github.com/coreos/rkt/issues/2657
var etcHostnameTests = []struct {
	aciBuildArgs   []string
	runArgs        []string
	expectedOutput string
	expectErr      bool
}{
	{
		[]string{"--exec=/inspect -file-name /etc/hostname -stat-file"},
		nil,
		`/etc/hostname: mode: -rw-r--r--`,
		false,
	},
	{
		[]string{"--exec=/inspect -file-name /etc/hostname -read-file"},
		[]string{"--hostname custom_hostname_setting"},
		`<<<custom_hostname_setting`,
		false,
	},
	{
		[]string{"--exec=/inspect -file-name /etc/hostname -read-file"},
		nil,
		`<<<rkt-`,
		false,
	},
}

func TestPrepareAppCheckEtcHostname(t *testing.T) {
	ctx := testutils.NewRktRunCtx()
	defer ctx.Cleanup()

	for i, ti := range etcHostnameTests {

		aciFileName := patchTestACI(fmt.Sprintf("rkt-inspect-hostname-%d.aci", i), ti.aciBuildArgs...)
		defer os.Remove(aciFileName)

		rktCmd := fmt.Sprintf("%s --insecure-options=image run %s %s", ctx.Cmd(), aciFileName, strings.Join(ti.runArgs, " "))
		runRktAndCheckOutput(t, rktCmd, ti.expectedOutput, ti.expectErr)
	}
}


text:
<?php
declare(strict_types=1);

use Phinx\Migration\AbstractMigration;

final class CreateForumsReactionsTable extends AbstractMigration
{
    public function change(): void
    {
        $table = $this->table('nl2_forums_reactions');

        $table
            ->addColumn('post_id', 'integer', ['length' => 11])
            ->addColumn('user_received', 'integer', ['length' => 11])
            ->addColumn('user_given', 'integer', ['length' => 11])
            ->addColumn('reaction_id', 'integer', ['length' => 11])
            ->addColumn('time', 'integer', ['length' => 11]);

        $table
            ->addForeignKey('post_id', 'nl2_posts', 'id', ['delete' => 'CASCADE', 'update' => 'CASCADE'])
            ->addForeignKey('user_received', 'nl2_users', 'id', ['delete' => 'CASCADE', 'update' => 'CASCADE'])
            ->addForeignKey('user_given', 'nl2_users', 'id', ['delete' => 'CASCADE', 'update' => 'CASCADE'])
            ->addForeignKey('reaction_id', 'nl2_reactions', 'id', ['delete' => 'CASCADE', 'update' => 'CASCADE']);

        $table->create();
    }
}


text:
#include "unicode/utypes.h"

#if !UCONFIG_NO_NORMALIZATION

#include "unicode/caniter.h"
#include "unicode/normalizer2.h"
#include "unicode/uchar.h"
#include "unicode/uniset.h"
#include "unicode/usetiter.h"
#include "unicode/ustring.h"
#include "unicode/utf16.h"
#include "cmemory.h"
#include "hash.h"
#include "normalizer2impl.h"

/**
 * This class allows one to iterate through all the strings that are canonically equivalent to a given
 * string. For example, here are some sample results:
Results for: {LATIN CAPITAL LETTER A WITH RING ABOVE}{LATIN SMALL LETTER D}{COMBINING DOT ABOVE}{COMBINING CEDILLA}
1: \u0041\u030A\u0064\u0307\u0327
 = {LATIN CAPITAL LETTER A}{COMBINING RING ABOVE}{LATIN SMALL LETTER D}{COMBINING DOT ABOVE}{COMBINING CEDILLA}
2: \u0041\u030A\u0064\u0327\u0307
 = {LATIN CAPITAL LETTER A}{COMBINING RING ABOVE}{LATIN SMALL LETTER D}{COMBINING CEDILLA}{COMBINING DOT ABOVE}
3: \u0041\u030A\u1E0B\u0327
 = {LATIN CAPITAL LETTER A}{COMBINING RING ABOVE}{LATIN SMALL LETTER D WITH DOT ABOVE}{COMBINING CEDILLA}
4: \u0041\u030A\u1E11\u0307
 = {LATIN CAPITAL LETTER A}{COMBINING RING ABOVE}{LATIN SMALL LETTER D WITH CEDILLA}{COMBINING DOT ABOVE}
5: \u00C5\u0064\u0307\u0327
 = {LATIN CAPITAL LETTER A WITH RING ABOVE}{LATIN SMALL LETTER D}{COMBINING DOT ABOVE}{COMBINING CEDILLA}
6: \u00C5\u0064\u0327\u0307
 = {LATIN CAPITAL LETTER A WITH RING ABOVE}{LATIN SMALL LETTER D}{COMBINING CEDILLA}{COMBINING DOT ABOVE}
7: \u00C5\u1E0B\u0327
 = {LATIN CAPITAL LETTER A WITH RING ABOVE}{LATIN SMALL LETTER D WITH DOT ABOVE}{COMBINING CEDILLA}
8: \u00C5\u1E11\u0307
 = {LATIN CAPITAL LETTER A WITH RING ABOVE}{LATIN SMALL LETTER D WITH CEDILLA}{COMBINING DOT ABOVE}
9: \u212B\u0064\u0307\u0327
 = {ANGSTROM SIGN}{LATIN SMALL LETTER D}{COMBINING DOT ABOVE}{COMBINING CEDILLA}
10: \u212B\u0064\u0327\u0307
 = {ANGSTROM SIGN}{LATIN SMALL LETTER D}{COMBINING CEDILLA}{COMBINING DOT ABOVE}
11: \u212B\u1E0B\u0327
 = {ANGSTROM SIGN}{LATIN SMALL LETTER D WITH DOT ABOVE}{COMBINING CEDILLA}
12: \u212B\u1E11\u0307
 = {ANGSTROM SIGN}{LATIN SMALL LETTER D WITH CEDILLA}{COMBINING DOT ABOVE}
 *<br>Note: the code is intended for use with small strings, and is not suitable for larger ones,
 * since it has not been optimized for that situation.
 *@author M. Davis
 *@draft
 */

// public

U_NAMESPACE_BEGIN

// TODO: add boilerplate methods.

UOBJECT_DEFINE_RTTI_IMPLEMENTATION(CanonicalIterator)

/**
 *@param source string to get results for
 */
CanonicalIterator::CanonicalIterator(const UnicodeString &sourceStr, UErrorCode &status) :
    pieces(NULL),
    pieces_length(0),
    pieces_lengths(NULL),
    current(NULL),
    current_length(0),
    nfd(*Normalizer2::getNFDInstance(status)),
    nfcImpl(*Normalizer2Factory::getNFCImpl(status))
{
    if(U_SUCCESS(status) && nfcImpl.ensureCanonIterData(status)) {
      setSource(sourceStr, status);
    }
}

CanonicalIterator::~CanonicalIterator() {
  cleanPieces();
}

void CanonicalIterator::cleanPieces() {
    int32_t i = 0;
    if(pieces != NULL) {
        for(i = 0; i < pieces_length; i++) {
            if(pieces[i] != NULL) {
                delete[] pieces[i];
            }
        }
        uprv_free(pieces);
        pieces = NULL;
        pieces_length = 0;
    }
    if(pieces_lengths != NULL) {
        uprv_free(pieces_lengths);
        pieces_lengths = NULL;
    }
    if(current != NULL) {
        uprv_free(current);
        current = NULL;
        current_length = 0;
    }
}

/**
 *@return gets the source: NOTE: it is the NFD form of source
 */
UnicodeString CanonicalIterator::getSource() {
  return source;
}

/**
 * Resets the iterator so that one can start again from the beginning.
 */
void CanonicalIterator::reset() {
    done = FALSE;
    for (int i = 0; i < current_length; ++i) {
        current[i] = 0;
    }
}

/**
 *@return the next string that is canonically equivalent. The value null is returned when
 * the iteration is done.
 */
UnicodeString CanonicalIterator::next() {
    int32_t i = 0;

    if (done) {
      buffer.setToBogus();
      return buffer;
    }

    // delete old contents
    buffer.remove();

    // construct return value

    for (i = 0; i < pieces_length; ++i) {
        buffer.append(pieces[i][current[i]]);
    }
    //String result = buffer.toString(); // not needed

    // find next value for next time

    for (i = current_length - 1; ; --i) {
        if (i < 0) {
            done = TRUE;
            break;
        }
        current[i]++;
        if (current[i] < pieces_lengths[i]) break; // got sequence
        current[i] = 0;
    }
    return buffer;
}

/**
 *@param set the source string to iterate against. This allows the same iterator to be used
 * while changing the source string, saving object creation.
 */
void CanonicalIterator::setSource(const UnicodeString &newSource, UErrorCode &status) {
    int32_t list_length = 0;
    UChar32 cp = 0;
    int32_t start = 0;
    int32_t i = 0;
    UnicodeString *list = NULL;

    nfd.normalize(newSource, source, status);
    if(U_FAILURE(status)) {
      return;
    }
    done = FALSE;

    cleanPieces();

    // catch degenerate case
    if (newSource.length() == 0) {
        pieces = (UnicodeString **)uprv_malloc(sizeof(UnicodeString *));
        pieces_lengths = (int32_t*)uprv_malloc(1 * sizeof(int32_t));
        pieces_length = 1;
        current = (int32_t*)uprv_malloc(1 * sizeof(int32_t));
        current_length = 1;
        if (pieces == NULL || pieces_lengths == NULL || current == NULL) {
            status = U_MEMORY_ALLOCATION_ERROR;
            goto CleanPartialInitialization;
        }
        current[0] = 0;
        pieces[0] = new UnicodeString[1];
        pieces_lengths[0] = 1;
        if (pieces[0] == 0) {
            status = U_MEMORY_ALLOCATION_ERROR;
            goto CleanPartialInitialization;
        }
        return;
    }

    list = new UnicodeString[source.length()];
    if (list == 0) {
        status = U_MEMORY_ALLOCATION_ERROR;
        goto CleanPartialInitialization;
    }

    // i should initialy be the number of code units at the
    // start of the string
    i = U16_LENGTH(source.char32At(0));
    //int32_t i = 1;
    // find the segments
    // This code iterates through the source string and
    // extracts segments that end up on a codepoint that
    // doesn't start any decompositions. (Analysis is done
    // on the NFD form - see above).
    for (; i < source.length(); i += U16_LENGTH(cp)) {
        cp = source.char32At(i);
        if (nfcImpl.isCanonSegmentStarter(cp)) {
            source.extract(start, i-start, list[list_length++]); // add up to i
            start = i;
        }
    }
    source.extract(start, i-start, list[list_length++]); // add last one

    // allocate the arrays, and find the strings that are CE to each segment
    pieces = (UnicodeString **)uprv_malloc(list_length * sizeof(UnicodeString *));
    pieces_length = list_length;
    pieces_lengths = (int32_t*)uprv_malloc(list_length * sizeof(int32_t));
    current = (int32_t*)uprv_malloc(list_length * sizeof(int32_t));
    current_length = list_length;
    if (pieces == NULL || pieces_lengths == NULL || current == NULL) {
        status = U_MEMORY_ALLOCATION_ERROR;
        goto CleanPartialInitialization;
    }

    for (i = 0; i < current_length; i++) {
        current[i] = 0;
    }
    // for each segment, get all the combinations that can produce
    // it after NFD normalization
    for (i = 0; i < pieces_length; ++i) {
        //if (PROGRESS) printf("SEGMENT\n");
        pieces[i] = getEquivalents(list[i], pieces_lengths[i], status);
    }

    delete[] list;
    return;
// Common section to cleanup all local variables and reset object variables.
CleanPartialInitialization:
    if (list != NULL) {
        delete[] list;
    }
    cleanPieces();
}

/**
 * Dumb recursive implementation of permutation.
 * TODO: optimize
 * @param source the string to find permutations for
 * @return the results in a set.
 */
void U_EXPORT2 CanonicalIterator::permute(UnicodeString &source, UBool skipZeros, Hashtable *result, UErrorCode &status) {
    if(U_FAILURE(status)) {
        return;
    }
    //if (PROGRESS) printf("Permute: %s\n", UToS(Tr(source)));
    int32_t i = 0;

    // optimization:
    // if zero or one character, just return a set with it
    // we check for length < 2 to keep from counting code points all the time
    if (source.length() <= 2 && source.countChar32() <= 1) {
        UnicodeString *toPut = new UnicodeString(source);
        /* test for NULL */
        if (toPut == 0) {
            status = U_MEMORY_ALLOCATION_ERROR;
            return;
        }
        result->put(source, toPut, status);
        return;
    }

    // otherwise iterate through the string, and recursively permute all the other characters
    UChar32 cp;
    Hashtable subpermute(status);
    if(U_FAILURE(status)) {
        return;
    }
    subpermute.setValueDeleter(uprv_deleteUObject);

    for (i = 0; i < source.length(); i += U16_LENGTH(cp)) {
        cp = source.char32At(i);
        const UHashElement *ne = NULL;
        int32_t el = -1;
        UnicodeString subPermuteString = source;

        // optimization:
        // if the character is canonical combining class zero,
        // don't permute it
        if (skipZeros && i != 0 && u_getCombiningClass(cp) == 0) {
            //System.out.println("Skipping " + Utility.hex(UTF16.valueOf(source, i)));
            continue;
        }

        subpermute.removeAll();

        // see what the permutations of the characters before and after this one are
        //Hashtable *subpermute = permute(source.substring(0,i) + source.substring(i + UTF16.getCharCount(cp)));
        permute(subPermuteString.replace(i, U16_LENGTH(cp), NULL, 0), skipZeros, &subpermute, status);
        /* Test for buffer overflows */
        if(U_FAILURE(status)) {
            return;
        }
        // The upper replace is destructive. The question is do we have to make a copy, or we don't care about the contents
        // of source at this point.

        // prefix this character to all of them
        ne = subpermute.nextElement(el);
        while (ne != NULL) {
            UnicodeString *permRes = (UnicodeString *)(ne->value.pointer);
            UnicodeString *chStr = new UnicodeString(cp);
            //test for  NULL
            if (chStr == NULL) {
                status = U_MEMORY_ALLOCATION_ERROR;
                return;
            }
            chStr->append(*permRes); //*((UnicodeString *)(ne->value.pointer));
            //if (PROGRESS) printf("  Piece: %s\n", UToS(*chStr));
            result->put(*chStr, chStr, status);
            ne = subpermute.nextElement(el);
        }
    }
    //return result;
}

// privates

// we have a segment, in NFD. Find all the strings that are canonically equivalent to it.
UnicodeString* CanonicalIterator::getEquivalents(const UnicodeString &segment, int32_t &result_len, UErrorCode &status) {
    Hashtable result(status);
    Hashtable permutations(status);
    Hashtable basic(status);
    if (U_FAILURE(status)) {
        return 0;
    }
    result.setValueDeleter(uprv_deleteUObject);
    permutations.setValueDeleter(uprv_deleteUObject);
    basic.setValueDeleter(uprv_deleteUObject);

    UChar USeg[256];
    int32_t segLen = segment.extract(USeg, 256, status);
    getEquivalents2(&basic, USeg, segLen, status);

    // now get all the permutations
    // add only the ones that are canonically equivalent
    // TODO: optimize by not permuting any class zero.

    const UHashElement *ne = NULL;
    int32_t el = -1;
    //Iterator it = basic.iterator();
    ne = basic.nextElement(el);
    //while (it.hasNext())
    while (ne != NULL) {
        //String item = (String) it.next();
        UnicodeString item = *((UnicodeString *)(ne->value.pointer));

        permutations.removeAll();
        permute(item, CANITER_SKIP_ZEROES, &permutations, status);
        const UHashElement *ne2 = NULL;
        int32_t el2 = -1;
        //Iterator it2 = permutations.iterator();
        ne2 = permutations.nextElement(el2);
        //while (it2.hasNext())
        while (ne2 != NULL) {
            //String possible = (String) it2.next();
            //UnicodeString *possible = new UnicodeString(*((UnicodeString *)(ne2->value.pointer)));
            UnicodeString possible(*((UnicodeString *)(ne2->value.pointer)));
            UnicodeString attempt;
            nfd.normalize(possible, attempt, status);

            // TODO: check if operator == is semanticaly the same as attempt.equals(segment)
            if (attempt==segment) {
                //if (PROGRESS) printf("Adding Permutation: %s\n", UToS(Tr(*possible)));
                // TODO: use the hashtable just to catch duplicates - store strings directly (somehow).
                result.put(possible, new UnicodeString(possible), status); //add(possible);
            } else {
                //if (PROGRESS) printf("-Skipping Permutation: %s\n", UToS(Tr(*possible)));
            }

            ne2 = permutations.nextElement(el2);
        }
        ne = basic.nextElement(el);
    }

    /* Test for buffer overflows */
    if(U_FAILURE(status)) {
        return 0;
    }
    // convert into a String[] to clean up storage
    //String[] finalResult = new String[result.size()];
    UnicodeString *finalResult = NULL;
    int32_t resultCount;
    if((resultCount = result.count())) {
        finalResult = new UnicodeString[resultCount];
        if (finalResult == 0) {
            status = U_MEMORY_ALLOCATION_ERROR;
            return NULL;
        }
    }
    else {
        status = U_ILLEGAL_ARGUMENT_ERROR;
        return NULL;
    }
    //result.toArray(finalResult);
    result_len = 0;
    el = -1;
    ne = result.nextElement(el);
    while(ne != NULL) {
        finalResult[result_len++] = *((UnicodeString *)(ne->value.pointer));
        ne = result.nextElement(el);
    }

    return finalResult;
}

Hashtable *CanonicalIterator::getEquivalents2(Hashtable *fillinResult, const UChar *segment, int32_t segLen, UErrorCode &status) {

    if (U_FAILURE(status)) {
        return NULL;
    }

    //if (PROGRESS) printf("Adding: %s\n", UToS(Tr(segment)));

    UnicodeString toPut(segment, segLen);

    fillinResult->put(toPut, new UnicodeString(toPut), status);

    UnicodeSet starts;

    // cycle through all the characters
    UChar32 cp;
    for (int32_t i = 0; i < segLen; i += U16_LENGTH(cp)) {
        // see if any character is at the start of some decomposition
        U16_GET(segment, 0, i, segLen, cp);
        if (!nfcImpl.getCanonStartSet(cp, starts)) {
            continue;
        }
        // if so, see which decompositions match
        UnicodeSetIterator iter(starts);
        while (iter.next()) {
            UChar32 cp2 = iter.getCodepoint();
            Hashtable remainder(status);
            remainder.setValueDeleter(uprv_deleteUObject);
            if (extract(&remainder, cp2, segment, segLen, i, status) == NULL) {
                continue;
            }

            // there were some matches, so add all the possibilities to the set.
            UnicodeString prefix(segment, i);
            prefix += cp2;

            int32_t el = -1;
            const UHashElement *ne = remainder.nextElement(el);
            while (ne != NULL) {
                UnicodeString item = *((UnicodeString *)(ne->value.pointer));
                UnicodeString *toAdd = new UnicodeString(prefix);
                /* test for NULL */
                if (toAdd == 0) {
                    status = U_MEMORY_ALLOCATION_ERROR;
                    return NULL;
                }
                *toAdd += item;
                fillinResult->put(*toAdd, toAdd, status);

                //if (PROGRESS) printf("Adding: %s\n", UToS(Tr(*toAdd)));

                ne = remainder.nextElement(el);
            }
        }
    }

    /* Test for buffer overflows */
    if(U_FAILURE(status)) {
        return NULL;
    }
    return fillinResult;
}

/**
 * See if the decomposition of cp2 is at segment starting at segmentPos
 * (with canonical rearrangment!)
 * If so, take the remainder, and return the equivalents
 */
Hashtable *CanonicalIterator::extract(Hashtable *fillinResult, UChar32 comp, const UChar *segment, int32_t segLen, int32_t segmentPos, UErrorCode &status) {
//Hashtable *CanonicalIterator::extract(UChar32 comp, const UnicodeString &segment, int32_t segLen, int32_t segmentPos, UErrorCode &status) {
    //if (PROGRESS) printf(" extract: %s, ", UToS(Tr(UnicodeString(comp))));
    //if (PROGRESS) printf("%s, %i\n", UToS(Tr(segment)), segmentPos);

    if (U_FAILURE(status)) {
        return NULL;
    }

    UnicodeString temp(comp);
    int32_t inputLen=temp.length();
    UnicodeString decompString;
    nfd.normalize(temp, decompString, status);
    const UChar *decomp=decompString.getBuffer();
    int32_t decompLen=decompString.length();

    // See if it matches the start of segment (at segmentPos)
    UBool ok = FALSE;
    UChar32 cp;
    int32_t decompPos = 0;
    UChar32 decompCp;
    U16_NEXT(decomp, decompPos, decompLen, decompCp);

    int32_t i = segmentPos;
    while(i < segLen) {
        U16_NEXT(segment, i, segLen, cp);

        if (cp == decompCp) { // if equal, eat another cp from decomp

            //if (PROGRESS) printf("  matches: %s\n", UToS(Tr(UnicodeString(cp))));

            if (decompPos == decompLen) { // done, have all decomp characters!
                temp.append(segment+i, segLen-i);
                ok = TRUE;
                break;
            }
            U16_NEXT(decomp, decompPos, decompLen, decompCp);
        } else {
            //if (PROGRESS) printf("  buffer: %s\n", UToS(Tr(UnicodeString(cp))));

            // brute force approach
            temp.append(cp);

            /* TODO: optimize
            // since we know that the classes are monotonically increasing, after zero
            // e.g. 0 5 7 9 0 3
            // we can do an optimization
            // there are only a few cases that work: zero, less, same, greater
            // if both classes are the same, we fail
            // if the decomp class < the segment class, we fail

            segClass = getClass(cp);
            if (decompClass <= segClass) return null;
            */
        }
    }
    if (!ok)
        return NULL; // we failed, characters left over

    //if (PROGRESS) printf("Matches\n");

    if (inputLen == temp.length()) {
        fillinResult->put(UnicodeString(), new UnicodeString(), status);
        return fillinResult; // succeed, but no remainder
    }

    // brute force approach
    // check to make sure result is canonically equivalent
    UnicodeString trial;
    nfd.normalize(temp, trial, status);
    if(U_FAILURE(status) || trial.compare(segment+segmentPos, segLen - segmentPos) != 0) {
        return NULL;
    }

    return getEquivalents2(fillinResult, temp.getBuffer()+inputLen, temp.length()-inputLen, status);
}

U_NAMESPACE_END

#endif /* #if !UCONFIG_NO_NORMALIZATION */


text:
#pragma once
#include <aws/rds/RDS_EXPORTS.h>
#include <aws/rds/RDSRequest.h>
#include <aws/core/utils/memory/stl/AWSString.h>
#include <utility>

namespace Aws
{
namespace RDS
{
namespace Model
{

  /**
   */
  class AWS_RDS_API AddRoleToDBClusterRequest : public RDSRequest
  {
  public:
    AddRoleToDBClusterRequest();

    // Service request name is the Operation name which will send this request out,
    // each operation should has unique request name, so that we can get operation's name from this request.
    // Note: this is not true for response, multiple operations may have the same response name,
    // so we can not get operation's name from response.
    inline virtual const char* GetServiceRequestName() const override { return "AddRoleToDBCluster"; }

    Aws::String SerializePayload() const override;

  protected:
    void DumpBodyToUrl(Aws::Http::URI& uri ) const override;

  public:

    /**
     *
The name of the DB cluster to associate the IAM role with.

     */
    inline const Aws::String& GetDBClusterIdentifier() const{ return m_dBClusterIdentifier; }

    /**
     *
The name of the DB cluster to associate the IAM role with.

     */
    inline bool DBClusterIdentifierHasBeenSet() const { return m_dBClusterIdentifierHasBeenSet; }

    /**
     *
The name of the DB cluster to associate the IAM role with.

     */
    inline void SetDBClusterIdentifier(const Aws::String& value) { m_dBClusterIdentifierHasBeenSet = true; m_dBClusterIdentifier = value; }

    /**
     *
The name of the DB cluster to associate the IAM role with.

     */
    inline void SetDBClusterIdentifier(Aws::String&& value) { m_dBClusterIdentifierHasBeenSet = true; m_dBClusterIdentifier = std::move(value); }

    /**
     *
The name of the DB cluster to associate the IAM role with.

     */
    inline void SetDBClusterIdentifier(const char* value) { m_dBClusterIdentifierHasBeenSet = true; m_dBClusterIdentifier.assign(value); }

    /**
     *
The name of the DB cluster to associate the IAM role with.

     */
    inline AddRoleToDBClusterRequest& WithDBClusterIdentifier(const Aws::String& value) { SetDBClusterIdentifier(value); return *this;}

    /**
     *
The name of the DB cluster to associate the IAM role with.

     */
    inline AddRoleToDBClusterRequest& WithDBClusterIdentifier(Aws::String&& value) { SetDBClusterIdentifier(std::move(value)); return *this;}

    /**
     *
The name of the DB cluster to associate the IAM role with.

     */
    inline AddRoleToDBClusterRequest& WithDBClusterIdentifier(const char* value) { SetDBClusterIdentifier(value); return *this;}

    /**
     *
The Amazon Resource Name (ARN) of the IAM role to associate with the Aurora
     * DB cluster, for example
     * arn:aws:iam::123456789012:role/AuroraAccessRole.

     */
    inline const Aws::String& GetRoleArn() const{ return m_roleArn; }

    /**
     *
The Amazon Resource Name (ARN) of the IAM role to associate with the Aurora
     * DB cluster, for example
     * arn:aws:iam::123456789012:role/AuroraAccessRole.

     */
    inline bool RoleArnHasBeenSet() const { return m_roleArnHasBeenSet; }

    /**
     *
The Amazon Resource Name (ARN) of the IAM role to associate with the Aurora
     * DB cluster, for example
     * arn:aws:iam::123456789012:role/AuroraAccessRole.

     */
    inline void SetRoleArn(const Aws::String& value) { m_roleArnHasBeenSet = true; m_roleArn = value; }

    /**
     *
The Amazon Resource Name (ARN) of the IAM role to associate with the Aurora
     * DB cluster, for example
     * arn:aws:iam::123456789012:role/AuroraAccessRole.

     */
    inline void SetRoleArn(Aws::String&& value) { m_roleArnHasBeenSet = true; m_roleArn = std::move(value); }

    /**
     *
The Amazon Resource Name (ARN) of the IAM role to associate with the Aurora
     * DB cluster, for example
     * arn:aws:iam::123456789012:role/AuroraAccessRole.

     */
    inline void SetRoleArn(const char* value) { m_roleArnHasBeenSet = true; m_roleArn.assign(value); }

    /**
     *
The Amazon Resource Name (ARN) of the IAM role to associate with the Aurora
     * DB cluster, for example
     * arn:aws:iam::123456789012:role/AuroraAccessRole.

     */
    inline AddRoleToDBClusterRequest& WithRoleArn(const Aws::String& value) { SetRoleArn(value); return *this;}

    /**
     *
The Amazon Resource Name (ARN) of the IAM role to associate with the Aurora
     * DB cluster, for example
     * arn:aws:iam::123456789012:role/AuroraAccessRole.

     */
    inline AddRoleToDBClusterRequest& WithRoleArn(Aws::String&& value) { SetRoleArn(std::move(value)); return *this;}

    /**
     *
The Amazon Resource Name (ARN) of the IAM role to associate with the Aurora
     * DB cluster, for example
     * arn:aws:iam::123456789012:role/AuroraAccessRole.

     */
    inline AddRoleToDBClusterRequest& WithRoleArn(const char* value) { SetRoleArn(value); return *this;}

    /**
     *
The name of the feature for the DB cluster that the IAM role is to be
     * associated with. For information about supported feature names, see
     * DBEngineVersion.

     */
    inline const Aws::String& GetFeatureName() const{ return m_featureName; }

    /**
     *
The name of the feature for the DB cluster that the IAM role is to be
     * associated with. For information about supported feature names, see
     * DBEngineVersion.

     */
    inline bool FeatureNameHasBeenSet() const { return m_featureNameHasBeenSet; }

    /**
     *
The name of the feature for the DB cluster that the IAM role is to be
     * associated with. For information about supported feature names, see
     * DBEngineVersion.

     */
    inline void SetFeatureName(const Aws::String& value) { m_featureNameHasBeenSet = true; m_featureName = value; }

    /**
     *
The name of the feature for the DB cluster that the IAM role is to be
     * associated with. For information about supported feature names, see
     * DBEngineVersion.

     */
    inline void SetFeatureName(Aws::String&& value) { m_featureNameHasBeenSet = true; m_featureName = std::move(value); }

    /**
     *
The name of the feature for the DB cluster that the IAM role is to be
     * associated with. For information about supported feature names, see
     * DBEngineVersion.

     */
    inline void SetFeatureName(const char* value) { m_featureNameHasBeenSet = true; m_featureName.assign(value); }

    /**
     *
The name of the feature for the DB cluster that the IAM role is to be
     * associated with. For information about supported feature names, see
     * DBEngineVersion.

     */
    inline AddRoleToDBClusterRequest& WithFeatureName(const Aws::String& value) { SetFeatureName(value); return *this;}

    /**
     *
The name of the feature for the DB cluster that the IAM role is to be
     * associated with. For information about supported feature names, see
     * DBEngineVersion.

     */
    inline AddRoleToDBClusterRequest& WithFeatureName(Aws::String&& value) { SetFeatureName(std::move(value)); return *this;}

    /**
     *
The name of the feature for the DB cluster that the IAM role is to be
     * associated with. For information about supported feature names, see
     * DBEngineVersion.

     */
    inline AddRoleToDBClusterRequest& WithFeatureName(const char* value) { SetFeatureName(value); return *this;}

  private:

    Aws::String m_dBClusterIdentifier;
    bool m_dBClusterIdentifierHasBeenSet;

    Aws::String m_roleArn;
    bool m_roleArnHasBeenSet;

    Aws::String m_featureName;
    bool m_featureNameHasBeenSet;
  };

} // namespace Model
} // namespace RDS
} // namespace Aws


text:
"""
A simple test case with basic options.
"""

import base
import opiter

class test00(base.admin, base.meshing, base.simulation, base.cg):
    # inherit a load of base options - that's it
    pass

# Make an array called 'case_name' with test00 as its only node.  This
# gives us a starting dictionary which contains the entry
# {'case_name': 'test00'} in addition to the contents of test01.*
root = opiter.OptionsArray('case_name', [test00])

# just have one mesh and simulation at this stage
mesh_tree = root
sim_tree = root

# *Alternatively, we could have made an orphan node:
# opiter.OptionsNode(test00, node_key='case_name')


text:
package com.sillelien.dollar.api.collections;

import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

import java.util.*;
import java.util.function.Consumer;
import java.util.stream.Stream;

public final class ImmutableList<V> implements Iterable<V> {

    private List<V> list = new ArrayList<>();

    public ImmutableList(List<V> list) {
        this.list = list;
    }

    @NotNull public static <V> ImmutableList<V> of(V... objects) {
        return new ImmutableList<>(Arrays.asList(objects));
    }

    @NotNull public static <V> ImmutableList<V> copyOf(@NotNull List<V>... lists) {
        List<V> list = new ArrayList<>();
        for (List<V> vList : lists) {
            list.addAll(vList);
        }
        return new ImmutableList<>(list);
    }

    @NotNull public static <V> ImmutableList<V> copyOf(@NotNull ImmutableList<V>... lists) {
        List<V> list = new ArrayList<>();
        for (ImmutableList<V> vList : lists) {
            list.addAll(vList.list);
        }
        return new ImmutableList<>(list);
    }

    public boolean contains(Object o) {return list.contains(o);}

    public boolean containsAll(@NotNull Collection<?> c) {return list.containsAll(c);}

    @NotNull public V get(int index) {return list.get(index);}

    @Override
    public int hashCode() {
        return list.hashCode();
    }

    @Override
    public boolean equals(@Nullable Object o) {
        if (this == o) { return true; }
        if (o == null || getClass() != o.getClass()) { return false; }

        ImmutableList that = (ImmutableList) o;

        return list.equals(that.list);

    }

    @Override public String toString() {
        return list.toString();
    }

    public int indexOf(Object o) {return list.indexOf(o);}

    public boolean isEmpty() {return list.isEmpty();}

    @NotNull public Iterator<V> iterator() {return list.iterator();}

    public void forEach(@NotNull Consumer<? super V> action) {list.forEach(action);}

    public Spliterator<V> spliterator() {return list.spliterator();}

    public int lastIndexOf(Object o) {return list.lastIndexOf(o);}

    @NotNull public ListIterator<V> listIterator() {return list.listIterator();}

    @NotNull public ListIterator<V> listIterator(int index) {return list.listIterator(index);}

    @NotNull public List<V> mutable() {
        return new ArrayList<>(list);
    }

    public Stream<V> parallelStream() {return list.parallelStream();}

    public int size() {return list.size();}

    public Stream<V> stream() {return list.stream();}

    @NotNull public List<V> subList(int fromIndex, int toIndex) {return list.subList(fromIndex, toIndex);}

    @NotNull public Object[] toArray() {return list.toArray();}

    @NotNull public <T> T[] toArray(@NotNull T[] a) {return list.toArray(a);}
}


text:
package com.example;

public class Vehicle {

	private String manufacturer;
	private int year;
	private String color;

	public Vehicle(String manufacturer, int year, String color) {
		super();
		this.manufacturer = manufacturer;
		this.year = year;
		this.color = color;
	}

	public String getManufacturer() {
		return manufacturer;
	}
	public void setManufacturer(String manufacturer) {
		this.manufacturer = manufacturer;
	}
	public int getYear() {
		return year;
	}
	public void setYear(int year) {
		this.year = year;
	}
	public String getColor() {
		return color;
	}
	public void setColor(String color) {
		this.color = color;
	}

}


text:
struct addrinfo;
class FilePath;
class GURL;

namespace base {
class Time;
}

namespace url_canon {
struct CanonHostInfo;
}

namespace url_parse {
struct Parsed;
}

namespace net {

// Used by FormatUrl to specify handling of certain parts of the url.
typedef uint32 FormatUrlType;
typedef uint32 FormatUrlTypes;

// Used by GetHeaderParamValue to determine how to handle quotes in the value.
class QuoteRule {
 public:
  enum Type {
    KEEP_OUTER_QUOTES,
    REMOVE_OUTER_QUOTES,
  };

 private:
  QuoteRule();
};

// Nothing is ommitted.
extern const FormatUrlType kFormatUrlOmitNothing;

// If set, any username and password are removed.
extern const FormatUrlType kFormatUrlOmitUsernamePassword;

// If the scheme is 'http://', it's removed.
extern const FormatUrlType kFormatUrlOmitHTTP;

// Omits the path if it is just a slash and there is no query or ref.  This is
// meaningful for non-file "standard" URLs.
extern const FormatUrlType kFormatUrlOmitTrailingSlashOnBareHostname;

// Convenience for omitting all unecessary types.
extern const FormatUrlType kFormatUrlOmitAll;

// Holds a list of ports that should be accepted despite bans.
extern std::multiset<int> explicitly_allowed_ports;

// Given the full path to a file name, creates a file: URL. The returned URL
// may not be valid if the input is malformed.
GURL FilePathToFileURL(const FilePath& path);

// Converts a file: URL back to a filename that can be passed to the OS. The
// file URL must be well-formed (GURL::is_valid() must return true); we don't
// handle degenerate cases here. Returns true on success, false if it isn't a
// valid file URL. On failure, *file_path will be empty.
bool FileURLToFilePath(const GURL& url, FilePath* file_path);

// Splits an input of the form <host>[":"<port>] into its consitituent parts.
// Saves the result into |*host| and |*port|. If the input did not have
// the optional port, sets |*port| to -1.
// Returns true if the parsing was successful, false otherwise.
// The returned host is NOT canonicalized, and may be invalid. If <host> is
// an IPv6 literal address, the returned host includes the square brackets.
bool ParseHostAndPort(std::string::const_iterator host_and_port_begin,
                      std::string::const_iterator host_and_port_end,
                      std::string* host,
                      int* port);
bool ParseHostAndPort(const std::string& host_and_port,
                      std::string* host,
                      int* port);

// Returns a host:port string for the given URL.
std::string GetHostAndPort(const GURL& url);

// Returns a host[:port] string for the given URL, where the port is omitted
// if it is the default for the URL's scheme.
std::string GetHostAndOptionalPort(const GURL& url);

// Returns the string representation of an address, like "192.168.0.1".
// Returns empty string on failure.
std::string NetAddressToString(const struct addrinfo* net_address);
std::string NetAddressToString(const struct sockaddr* net_address,
                               socklen_t address_len);

// Same as NetAddressToString, but additionally includes the port number. For
// example: "192.168.0.1:99" or "[::1]:80".
std::string NetAddressToStringWithPort(const struct addrinfo* net_address);
std::string NetAddressToStringWithPort(const struct sockaddr* net_address,
                                       socklen_t address_len);

// Returns the hostname of the current system. Returns empty string on failure.
std::string GetHostName();

// Extracts the unescaped username/password from |url|, saving the results
// into |*username| and |*password|.
void GetIdentityFromURL(const GURL& url,
                        string16* username,
                        string16* password);

// Returns either the host from |url|, or, if the host is empty, the full spec.
std::string GetHostOrSpecFromURL(const GURL& url);

// Return the value of the HTTP response header with name 'name'.  'headers'
// should be in the format that URLRequest::GetResponseHeaders() returns.
// Returns the empty string if the header is not found.
std::wstring GetSpecificHeader(const std::wstring& headers,
                               const std::wstring& name);
std::string GetSpecificHeader(const std::string& headers,
                              const std::string& name);

// Return the value of the HTTP response header field's parameter named
// 'param_name'.  Returns the empty string if the parameter is not found or is
// improperly formatted.
std::wstring GetHeaderParamValue(const std::wstring& field,
                                 const std::wstring& param_name,
                                 QuoteRule::Type quote_rule);
std::string GetHeaderParamValue(const std::string& field,
                                const std::string& param_name,
                                QuoteRule::Type quote_rule);

// Return the filename extracted from Content-Disposition header. The following
// formats are tried in order listed below:
//
// 1. RFC 5987
// 2. RFC 2047
// 3. Raw-8bit-characters :
//    a. UTF-8, b. referrer_charset, c. default os codepage.
// 4. %-escaped UTF-8.
//
// In step 3, if referrer_charset is empty(i.e. unknown), 3b is skipped.
// In step 4, the fallback charsets tried in step 3 are not tried. We
// can consider doing that later.
//
// When a param value is ASCII, but is not in format #2 or format #4 above,
// it is returned as it is unless it's pretty close to two supported
// formats but not well-formed. In that case, an empty string is returned.
//
// In any case, a caller must check for the empty return value and resort to
// another means to get a filename (e.g. url).
//
// This function does not do any escaping and callers are responsible for
// escaping 'unsafe' characters (e.g. (back)slash, colon) as they see fit.
//
// TODO(jungshik): revisit this issue. At the moment, the only caller
// net_util::GetSuggestedFilename and it calls ReplaceIllegalCharacters.  The
// other caller is a unit test. Need to figure out expose this function only to
// net_util_unittest.
//
std::string GetFileNameFromCD(const std::string& header,
                              const std::string& referrer_charset);

// Converts the given host name to unicode characters. This can be called for
// any host name, if the input is not IDN or is invalid in some way, we'll just
// return the ASCII source so it is still usable.
//
// The input should be the canonicalized ASCII host name from GURL. This
// function does NOT accept UTF-8! Its length must also be given (this is
// designed to work on the substring of the host out of a URL spec).
//
// |languages| is a comma separated list of ISO 639 language codes. It
// is used to determine whether a hostname is 'comprehensible' to a user
// who understands languages listed. |host| will be converted to a
// human-readable form (Unicode) ONLY when each component of |host| is
// regarded as 'comprehensible'. Scipt-mixing is not allowed except that
// Latin letters in the ASCII range can be mixed with a limited set of
// script-language pairs (currently Han, Kana and Hangul for zh,ja and ko).
// When |languages| is empty, even that mixing is not allowed.
//
// (|offset[s]_for_adjustment|) specifies one or more offsets into the original
// |url|'s spec(); each offset will be adjusted to point at the same logical
// place in the result strings during decoding.  If this isn't possible because
// an offset points past the end of |host| or into the middle of a punycode
// sequence, the offending offset will be set to std::wstring::npos.
// |offset[s]_for_adjustment| may be NULL.
std::wstring IDNToUnicode(const char* host,
                          size_t host_len,
                          const std::wstring& languages,
                          size_t* offset_for_adjustment);
std::wstring IDNToUnicodeWithOffsets(
    const char* host,
    size_t host_len,
    const std::wstring& languages,
    std::vector<size_t>* offsets_for_adjustment);

// Canonicalizes |host| and returns it.  Also fills |host_info| with
// IP address information.  |host_info| must not be NULL.
std::string CanonicalizeHost(const std::string& host,
                             url_canon::CanonHostInfo* host_info);
std::string CanonicalizeHost(const std::wstring& host,
                             url_canon::CanonHostInfo* host_info);

// Returns true if |host| is not an IP address and is compliant with a set of
// rules based on RFC 1738 and tweaked to be compatible with the real world.
// The rules are:
//   * One or more components separated by '.'
//   * Each component begins and ends with an alphanumeric character
//   * Each component contains only alphanumeric characters and '-' or '_'
//   * The last component does not begin with a digit
//   * Optional trailing dot after last component (means "treat as FQDN")
// If |desired_tld| is non-NULL, the host will only be considered invalid if
// appending it as a trailing component still results in an invalid host.  This
// helps us avoid marking as "invalid" user attempts to open "www.401k.com" by
// typing 4-0-1-k-<ctrl>+<enter>.
//
// NOTE: You should only pass in hosts that have been returned from
// CanonicalizeHost(), or you may not get accurate results.
bool IsCanonicalizedHostCompliant(const std::string& host,
                                  const std::string& desired_tld);

// Call these functions to get the html snippet for a directory listing.
// The return values of both functions are in UTF-8.
std::string GetDirectoryListingHeader(const string16& title);

// Given the name of a file in a directory (ftp or local) and
// other information (is_dir, size, modification time), it returns
// the html snippet to add the entry for the file to the directory listing.
// Currently, it's a script tag containing a call to a Javascript function
// |addRow|.
//
// |name| is the file name to be displayed. |raw_bytes| will be used
// as the actual target of the link (so for example, ftp links should use
// server's encoding). If |raw_bytes| is an empty string, UTF-8 encoded |name|
// will be used.
//
// Both |name| and |raw_bytes| are escaped internally.
std::string GetDirectoryListingEntry(const string16& name,
                                     const std::string& raw_bytes,
                                     bool is_dir, int64 size,
                                     base::Time modified);

// If text starts with "www." it is removed, otherwise text is returned
// unmodified.
string16 StripWWW(const string16& text);

// Gets the filename from the raw Content-Disposition header (as read from the
// network).  Otherwise uses the last path component name or hostname from
// |url|. If there is no filename or it can't be used, the given |default_name|,
// will be used unless it is empty.

// Note: it's possible for the suggested filename to be empty (e.g.,
// file:///). referrer_charset is used as one of charsets
// to interpret a raw 8bit string in C-D header (after interpreting
// as UTF-8 fails). See the comment for GetFilenameFromCD for more details.
string16 GetSuggestedFilename(const GURL& url,
                              const std::string& content_disposition,
                              const std::string& referrer_charset,
                              const string16& default_name);

// Checks the given port against a list of ports which are restricted by
// default.  Returns true if the port is allowed, false if it is restricted.
bool IsPortAllowedByDefault(int port);

// Checks the given port against a list of ports which are restricted by the
// FTP protocol.  Returns true if the port is allowed, false if it is
// restricted.
bool IsPortAllowedByFtp(int port);

// Check if banned |port| has been overriden by an entry in
// |explicitly_allowed_ports_|.
bool IsPortAllowedByOverride(int port);

// Set socket to non-blocking mode
int SetNonBlocking(int fd);

// Appends the given part of the original URL to the output string formatted for
// the user. The given parsed structure will be updated. The host name formatter
// also takes the same accept languages component as ElideURL. |new_parsed| may
// be null.
//
// (|offset[s]_for_adjustment|) specifies one or more offsets into the original
// |url|'s spec(); each offset will be adjusted to point at the same logical
// place in the result strings after reformatting of the host.  If this isn't
// possible because an offset points past the end of the host or into the middle
// of a multi-character sequence, the offending offset will be set to
// std::wstring::npos. |offset[s]_for_adjustment| may be NULL.
void AppendFormattedHost(const GURL& url,
                         const std::wstring& languages,
                         std::wstring* output,
                         url_parse::Parsed* new_parsed,
                         size_t* offset_for_adjustment);
void AppendFormattedHostWithOffsets(
    const GURL& url,
    const std::wstring& languages,
    std::wstring* output,
    url_parse::Parsed* new_parsed,
    std::vector<size_t>* offsets_for_adjustment);

// Creates a string representation of |url|. The IDN host name may be in Unicode
// if |languages| accepts the Unicode representation. |format_type| is a bitmask
// of FormatUrlTypes, see it for details. |unescape_rules| defines how to clean
// the URL for human readability. You will generally want |UnescapeRule::SPACES|
// for display to the user if you can handle spaces, or |UnescapeRule::NORMAL|
// if not. If the path part and the query part seem to be encoded in %-encoded
// UTF-8, decodes %-encoding and UTF-8.
//
// The last three parameters may be NULL.
// |new_parsed| will be set to the parsing parameters of the resultant URL.
// |prefix_end| will be the length before the hostname of the resultant URL.
//
// (|offset[s]_for_adjustment|) specifies one or more offsets into the original
// |url|'s spec(); each offset will be modified to reflect changes this function
// makes to the output string. For example, if |url| is "http://a:b@c.com/",
// |omit_username_password| is true, and an offset is 12 (the offset of '.'),
// then on return the output string will be "http://c.com/" and the offset will
// be 8.  If an offset cannot be successfully adjusted (e.g. because it points
// into the middle of a component that was entirely removed, past the end of the
// string, or into the middle of an encoding sequence), it will be set to
// string16::npos.
string16 FormatUrl(const GURL& url,
                   const std::string& languages,
                   FormatUrlTypes format_types,
                   UnescapeRule::Type unescape_rules,
                   url_parse::Parsed* new_parsed,
                   size_t* prefix_end,
                   size_t* offset_for_adjustment);
string16 FormatUrlWithOffsets(const GURL& url,
                              const std::string& languages,
                              FormatUrlTypes format_types,
                              UnescapeRule::Type unescape_rules,
                              url_parse::Parsed* new_parsed,
                              size_t* prefix_end,
                              std::vector<size_t>* offsets_for_adjustment);

// This is a convenience function for FormatUrl() with
// format_types = kFormatUrlOmitAll and unescape = SPACES.  This is the typical
// set of flags for "URLs to display to the user".  You should be cautious about
// using this for URLs which will be parsed or sent to other applications.
inline string16 FormatUrl(const GURL& url, const std::string& languages) {
  return FormatUrl(url, languages, kFormatUrlOmitAll, UnescapeRule::SPACES,
                   NULL, NULL, NULL);
}

// Returns whether FormatUrl() would strip a trailing slash from |url|, given a
// format flag including kFormatUrlOmitTrailingSlashOnBareHostname.
bool CanStripTrailingSlash(const GURL& url);

// Strip the portions of |url| that aren't core to the network request.
//   - user name / password
//   - reference section
GURL SimplifyUrlForRequest(const GURL& url);

void SetExplicitlyAllowedPorts(const std::string& allowed_ports);

class ScopedPortException {
 public:
  ScopedPortException(int port);
  ~ScopedPortException();

 private:
  int port_;

  DISALLOW_COPY_AND_ASSIGN(ScopedPortException);
};

// Perform a simplistic test to see if IPv6 is supported by trying to create an
// IPv6 socket.
// TODO(jar): Make test more in-depth as needed.
bool IPv6Supported();

// Returns true if it can determine that only loopback addresses are configured.
// i.e. if only 127.0.0.1 and ::1 are routable.
bool HaveOnlyLoopbackAddresses();

// IPAddressNumber is used to represent an IP address's numeric value as an
// array of bytes, from most significant to least significant. This is the
// network byte ordering.
//
// IPv4 addresses will have length 4, whereas IPv6 address will have length 16.
typedef std::vector<unsigned char> IPAddressNumber;

static const size_t kIPv4AddressSize = 4;
static const size_t kIPv6AddressSize = 16;

// Parses an IP address literal (either IPv4 or IPv6) to its numeric value.
// Returns true on success and fills |ip_number| with the numeric value.
bool ParseIPLiteralToNumber(const std::string& ip_literal,
                            IPAddressNumber* ip_number);

// Converts an IPv4 address to an IPv4-mapped IPv6 address.
// For example 192.168.0.1 would be converted to ::ffff:192.168.0.1.
IPAddressNumber ConvertIPv4NumberToIPv6Number(
    const IPAddressNumber& ipv4_number);

// Parses an IP block specifier from CIDR notation to an
// (IP address, prefix length) pair. Returns true on success and fills
// |*ip_number| with the numeric value of the IP address and sets
// |*prefix_length_in_bits| with the length of the prefix.
//
// CIDR notation literals can use either IPv4 or IPv6 literals. Some examples:
//
//    10.10.3.1/20
//    a:b:c::/46
//    ::1/128
bool ParseCIDRBlock(const std::string& cidr_literal,
                    IPAddressNumber* ip_number,
                    size_t* prefix_length_in_bits);

// Compares an IP address to see if it falls within the specified IP block.
// Returns true if it does, false otherwise.
//
// The IP block is given by (|ip_prefix|, |prefix_length_in_bits|) -- any
// IP address whose |prefix_length_in_bits| most significant bits match
// |ip_prefix| will be matched.
//
// In cases when an IPv4 address is being compared to an IPv6 address prefix
// and vice versa, the IPv4 addresses will be converted to IPv4-mapped
// (IPv6) addresses.
bool IPNumberMatchesPrefix(const IPAddressNumber& ip_number,
                           const IPAddressNumber& ip_prefix,
                           size_t prefix_length_in_bits);

// Makes a copy of |info|. The dynamically-allocated parts are copied as well.
// If |recursive| is true, chained entries via ai_next are copied too.
// The copy returned by this function should be freed using
// FreeCopyOfAddrinfo(), and NOT freeaddrinfo().
struct addrinfo* CreateCopyOfAddrinfo(const struct addrinfo* info,
                                      bool recursive);

// Frees an addrinfo that was created by CreateCopyOfAddrinfo().
void FreeCopyOfAddrinfo(struct addrinfo* info);

// Returns the port field of the sockaddr in |info|.
const uint16* GetPortFieldFromAddrinfo(const struct addrinfo* info);
uint16* GetPortFieldFromAddrinfo(struct addrinfo* info);

// Returns the value of |info's| port (in host byte ordering).
int GetPortFromAddrinfo(const struct addrinfo* info);

// Same except for struct sockaddr.
const uint16* GetPortFieldFromSockaddr(const struct sockaddr* address,
                                       socklen_t address_len);
int GetPortFromSockaddr(const struct sockaddr* address,
                        socklen_t address_len);

// Returns true if |host| is one of the names (e.g. "localhost") or IP
// addresses (IPv4 127.0.0.0/8 or IPv6 ::1) that indicate a loopback.
//
// Note that this function does not check for IP addresses other than
// the above, although other IP addresses may point to the local
// machine.
bool IsLocalhost(const std::string& host);

// struct that is used by GetNetworkList() to represent a network
// interface.
struct NetworkInterface {
  NetworkInterface();
  NetworkInterface(const std::string& name, const IPAddressNumber& address);
  ~NetworkInterface();

  std::string name;
  IPAddressNumber address;
};

typedef std::list<NetworkInterface> NetworkInterfaceList;

// Returns list of network interfaces except loopback interface. If an
// interface has more than one address, a separate entry is added to
// the list for each address.
// Can be called only on a thread that allows IO.
bool GetNetworkList(NetworkInterfaceList* networks);

// Private adjustment function called by std::transform which sets the offset
// to npos if the offset occurs at or before |component_start|, otherwise don't
// alter the offset. Exposed here for unit testing.
struct ClampComponentOffset {
  explicit ClampComponentOffset(size_t component_start);
  size_t operator()(size_t offset);

  const size_t component_start;
};

}  // namespace net

#endif  // NET_BASE_NET_UTIL_H_


text:
require 'socket'
require 'json'

port = 2005
server = TCPServer.open(port)

loop do
  # For threading use `Thread.start(server.accept) do |client|; end`
  puts 'Server initialized, waiting for incoming requests.'
  client = server.accept
  request = client.recvfrom(1024)
  puts request

  unless request.nil?
    request = request.join.strip.split
    method = request[0]
    path = request[1][1..-1]
    protocol = request[2]

    if method == 'GET' && File.file?(path)
      file = File.open(path).read
      content_length = file.length
      response = "#{protocol} 200 OK\n"\
                 "Server: ruby-server\n"\
                 "Content-Type: text/html; charset=utf-8\n"\
                 "Content-Length: #{content_length}\n"\
                 "Date: #{Time.now.ctime}\r\n\r\n"\
                 "#{file}"
      client.print response
    elsif method == 'POST' && File.file?(path)
      file = File.open(path).read
      params = JSON.parse(request.last)
      data = "
Name: #{params['user']['name']}
"\
             "
Email: #{params['user']['email']}
"
      content_length = file.gsub('<%= yield %>', data).length
      response = "#{protocol} 200 OK\n"\
                 "Content-Length: #{content_length}\n"\
                 "Date: #{Time.now.ctime}\r\n\r\n"\
                 "#{file.gsub('<%= yield %>', data)}"
      client.print response
    else
      response = "#{protocol} 404 NOT FOUND\r\n\r\n"
      client.print response
    end
  end
  client.close
end


text:
title: Tomas Mulder's Resume
---
{% if page.url == "/" %}
    {% include modules/timeline/global.html %}
{% endif %}


text:
using System.Text.Json;
using Azure.Core;

namespace Azure.ResourceManager.Compute.Models
{
    public partial class DedicatedHostUpdate : IUtf8JsonSerializable
    {
        void IUtf8JsonSerializable.Write(Utf8JsonWriter writer)
        {
            writer.WriteStartObject();
            if (Optional.IsCollectionDefined(Tags))
            {
                writer.WritePropertyName("tags");
                writer.WriteStartObject();
                foreach (var item in Tags)
                {
                    writer.WritePropertyName(item.Key);
                    writer.WriteStringValue(item.Value);
                }
                writer.WriteEndObject();
            }
            writer.WritePropertyName("properties");
            writer.WriteStartObject();
            if (Optional.IsDefined(PlatformFaultDomain))
            {
                writer.WritePropertyName("platformFaultDomain");
                writer.WriteNumberValue(PlatformFaultDomain.Value);
            }
            if (Optional.IsDefined(AutoReplaceOnFailure))
            {
                writer.WritePropertyName("autoReplaceOnFailure");
                writer.WriteBooleanValue(AutoReplaceOnFailure.Value);
            }
            if (Optional.IsDefined(LicenseType))
            {
                writer.WritePropertyName("licenseType");
                writer.WriteStringValue(LicenseType.Value.ToSerialString());
            }
            writer.WriteEndObject();
            writer.WriteEndObject();
        }
    }
}


text:
require 'active_record/connection_adapters/abstract/schema_definitions'

module ActiveRecord
  module ConnectionAdapters
    class ColumnDefinition
      attr_accessor :unsigned
    end

    class TableDefinition
      def primary_key(name, type = :primary_key, options = {})
        column(name, type, options.merge(primary_key: true).reverse_merge(unsigned: false))
      end

      alias_method :new_column_definition_without_unsigned, :new_column_definition
      def new_column_definition(name, type, options)
        column = new_column_definition_without_unsigned(name, type, options)
        column.unsigned = options[:unsigned]
        column
      end
    end
  end
end


text:
package seedu.taskmanager.model.util;

import java.util.Optional;

import seedu.taskmanager.commons.exceptions.IllegalValueException;
import seedu.taskmanager.model.ReadOnlyTaskManager;
import seedu.taskmanager.model.TaskManager;
import seedu.taskmanager.model.tag.UniqueTagList;
import seedu.taskmanager.model.task.Description;
import seedu.taskmanager.model.task.EndDate;
import seedu.taskmanager.model.task.Repeat;
import seedu.taskmanager.model.task.StartDate;
import seedu.taskmanager.model.task.Task;
import seedu.taskmanager.model.task.Title;
import seedu.taskmanager.model.task.UniqueTaskList.DuplicateTaskException;

public class SampleDataUtil {
    public static Task[] getSampleTasks() {
        try {
            // @@author A0140032E
            return new Task[] {
                new Task(new Title("Visit Alex Yeoh"), Optional.ofNullable(new StartDate("01/11/2017")),
                        Optional.ofNullable(new EndDate("02/11/2017")),
                        Optional.ofNullable(new Description("His address is Blk 30 Geylang Street 29, #06-40")),
                        Optional.ofNullable(new Repeat("DAY")),
                        new UniqueTagList("social")),
                new Task(new Title("Collect files from boss"), Optional.ofNullable(new StartDate("05/11/2017")),
                        Optional.ofNullable(new EndDate("08/11/2017")),
                        Optional.ofNullable(new Description("Important business files")),
                        Optional.ofNullable(null),
                        new UniqueTagList("colleagues", "business")),
                new Task(new Title("Visit Charlotte Oliveiro"), Optional.ofNullable(new StartDate("20/12/2017")),
                        Optional.ofNullable(new EndDate("20/12/2017")),
                        Optional.ofNullable(new Description("Her address is Blk 11 Ang Mo Kio Street 74, #11-04")),
                        Optional.ofNullable(new Repeat("MONTH")),
                        new UniqueTagList("social")),
                new Task(new Title("Call David Li"), Optional.ofNullable(new StartDate("08/08/2017")),
                        Optional.ofNullable(new EndDate("10/08/2017")),
                        Optional.ofNullable(new Description("his number is 12345678")),
                        Optional.ofNullable(new Repeat("YEAR")),
                        new UniqueTagList("schoolwork")),
                new Task(new Title("Submit project report"), Optional.ofNullable(new StartDate("20/07/2017")),
                        Optional.ofNullable(new EndDate("21/07/2017")),
                        Optional.ofNullable(new Description("Submit to tutor in class")),
                        Optional.ofNullable(null),
                        new UniqueTagList("schoolwork")) };
            // @@author
        } catch (IllegalValueException e) {
            throw new AssertionError("sample data cannot be invalid", e);
        }
    }

    public static ReadOnlyTaskManager getSampleTaskManager() {
        try {
            TaskManager sampleAB = new TaskManager();
            for (Task sampleTask : getSampleTasks()) {
                sampleAB.addTask(sampleTask);
            }
            return sampleAB;
        } catch (DuplicateTaskException e) {
            throw new AssertionError("sample data cannot contain duplicate tasks", e);
        }
    }
}


text:
/**
 * RxChangeEvents a emitted when something in the database changes
 * they can be grabbed by the observables of database, collection and document
 */
import { ChangeEvent as EventReduceChangeEvent } from 'event-reduce-js';
import type { EventBulk, RxChangeEvent } from './types';
export declare function getDocumentDataOfRxChangeEvent<T>(rxChangeEvent: RxChangeEvent<T>): T;
export declare function rxChangeEventToEventReduceChangeEvent<DocType>(rxChangeEvent: RxChangeEvent<DocType>): EventReduceChangeEvent<DocType>;
/**
 * Flattens the given events into a single array of events.
 * Used mostly in tests.
 */
export declare function flattenEvents<EventType>(input: EventBulk<EventType> | EventBulk<EventType>[] | EventType | EventType[]): EventType[];


text:
import { Component } from 'react'
import styles from './Faq.module.css'
import { countries } from 'countries-list'

class Faq extends Component {
  constructor(props) {
    super(props)

    this.state = {
      items: [
        {
          question: `Do you ship worldwide?`,
          answer: `Yes, we ship internationally.`,
          visible: false,
        },
        {
          question: `Why there are only black t-shirts?`,
          answer: `Because vampires can't stand the light.`,
          visible: false,
        },
        {
          question: `When will I get my order?`,
          answer: `Your order will ship within 2-7 business days. You'll get an e-mail with the tracking info to follow it along the way. Shipping timelines will vary based on location.`,
          visible: false,
        },
        {
          question: `Do you offer PPP or any discounts?`,
          answer: `Purchasing Parity Power (PPP) is only available to digital products like Dracula PRO and Dracula UI. Unfortunately, I can't offer discounts for physical products since they have fixed production costs and extremely low margins.`,
          visible: false,
        },
        {
          question: `Can I edit or cancel my order?`,
          answer: `You cannot edit your order once placed, but if you would like to cancel your order before it has been fulfilled and shipped, please send me an email: zeno@draculatheme.com.`,
          visible: false,
        },
        {
          question: `What about customs fees?`,
          answer: `Our shipping cost does not include import or customs taxes. This is a common thing for international orders, and unfortunately, we have no control over them.`,
          visible: false,
        },
        {
          question: `What is your return policy?`,
          answer: `We currently do not accept returns. If you get the wrong item or defective product, please email me: zeno@draculatheme.com.`,
          visible: false,
        },
        {
          question: `How do I contact support?`,
          answer: `You can contact me by e-mailing zeno@draculatheme.com.`,
          visible: false,
        },
      ],
    }
  }

  componentDidUpdate(prevProps) {
    if (this.props.ppp !== prevProps.ppp) {
      let items = this.state.items
      items[0].question = `Do you ship ${
        this.props.ppp.country
          ? `to ${countries[this.props.ppp.country].name}`
          : 'worldwide'
      }?`
      this.setState({ items })
    }
  }

  toggleVisibility(index, e) {
    e.preventDefault()

    let items = this.state.items
    items[index].visible = !items[index].visible
    this.setState(items)
  }

  renderQuestionsAndAnswers() {
    return this.state.items.map((item, index) => {
      return (

{item.question}

            {item.answer}

            {this.state.items[index].visible ? '-' : '+'}

      )
    })
  }

  render() {
    return (

{this.renderQuestionsAndAnswers()}

    )
  }
}

export default Faq