text:
"""Update version of TensorFlow script."""

# pylint: disable=superfluous-parens

import argparse
import os
import re
import subprocess
import time

# File parameters.
TF_SRC_DIR = "tensorflow"
VERSION_H = "%s/core/public/version.h" % TF_SRC_DIR
SETUP_PY = "%s/tools/pip_package/setup.py" % TF_SRC_DIR
README_MD = "./README.md"
DEVEL_DOCKERFILE = "%s/tools/docker/Dockerfile.devel" % TF_SRC_DIR
GPU_DEVEL_DOCKERFILE = "%s/tools/docker/Dockerfile.devel-gpu" % TF_SRC_DIR
CPU_MKL_DEVEL_DOCKERFILE = "%s/tools/docker/Dockerfile.devel-cpu-mkl" % TF_SRC_DIR
RELEVANT_FILES = [TF_SRC_DIR,
                  VERSION_H,
                  SETUP_PY,
                  README_MD,
                  DEVEL_DOCKERFILE,
                  GPU_DEVEL_DOCKERFILE]

# Version type parameters.
NIGHTLY_VERSION = 1
REGULAR_VERSION = 0

def check_existence(filename):
  """Check the existence of file or dir."""
  if not os.path.exists(filename):
    raise RuntimeError("%s not found. Are you under the TensorFlow source root"
                       " directory?")

def check_all_files():
  """Check all relevant files necessary for upgrade."""
  for file_name in RELEVANT_FILES:
    check_existence(file_name)

def replace_string_in_line(search, replace, filename):
  """Replace with sed when regex is required."""
  with open(filename, "r") as source:
    content = source.read()
  with open(filename, "w") as source:
    source.write(re.sub(search, replace, content))

class Version(object):
  """Version class object that stores SemVer version information."""

  def __init__(self, major, minor, patch, identifier_string, version_type):
    """Constructor.

    Args:
      major: major string eg. (1)
      minor: minor string eg. (3)
      patch: patch string eg. (1)
      identifier_string: extension string eg. (-rc0)
      version_type: version parameter ((REGULAR|NIGHTLY)_VERSION)
    """
    self.string = "%s.%s.%s%s" % (major,
                                  minor,
                                  patch,
                                  identifier_string)
    self.major = major
    self.minor = minor
    self.patch = patch
    self.identifier_string = identifier_string
    self.version_type = version_type

  def __str__(self):
    return self.string

  @property
  def pep_440_str(self):
    if self.version_type == REGULAR_VERSION:
      return_string = "%s.%s.%s%s" % (self.major,
                                      self.minor,
                                      self.patch,
                                      self.identifier_string)
      return return_string.replace("-", "")
    else:
      return_string = "%s.%s.%s" % (self.major,
                                    self.minor,
                                    self.identifier_string)
      return return_string.replace("-", "")

  @staticmethod
  def parse_from_string(string, version_type):
    """Returns version object from Semver string.

    Args:
      string: version string
      version_type: version parameter

    Raises:
      RuntimeError: If the version string is not valid.
    """
    # Check validity of new version string.
    if not re.search(r"[0-9]+\.[0-9]+\.[a-zA-Z0-9]+", string):
      raise RuntimeError("Invalid version string: %s" % string)

    major, minor, extension = string.split(".", 2)

    # Isolate patch and identifier string if identifier string exists.
    extension_split = extension.split("-", 1)
    patch = extension_split[0]
    if len(extension_split) == 2:
      identifier_string = "-" + extension_split[1]
    else:
      identifier_string = ""

    return Version(major,
                   minor,
                   patch,
                   identifier_string,
                   version_type)

def get_current_semver_version():
  """Returns a Version object of current version.

  Returns:
    version: Version object of current SemVer string based on information from
    core/public/version.h
  """

  # Get current version information.
  version_file = open(VERSION_H, "r")
  for line in version_file:
    major_match = re.search("^#define TF_MAJOR_VERSION ([0-9]+)", line)
    minor_match = re.search("^#define TF_MINOR_VERSION ([0-9]+)", line)
    patch_match = re.search("^#define TF_PATCH_VERSION ([0-9]+)", line)
    extension_match = re.search("^#define TF_VERSION_SUFFIX \"(.*)\"", line)
    if major_match:
      old_major = major_match.group(1)
    if minor_match:
      old_minor = minor_match.group(1)
    if patch_match:
      old_patch_num = patch_match.group(1)
    if extension_match:
      old_extension = extension_match.group(1)
      break

  if "dev" in old_extension:
    version_type = NIGHTLY_VERSION
  else:
    version_type = REGULAR_VERSION

  return Version(old_major,
                 old_minor,
                 old_patch_num,
                 old_extension,
                 version_type)

def update_version_h(old_version, new_version):
  """Update tensorflow/core/public/version.h."""
  replace_string_in_line("#define TF_MAJOR_VERSION %s" % old_version.major,
                         "#define TF_MAJOR_VERSION %s" % new_version.major,
                         VERSION_H)
  replace_string_in_line("#define TF_MINOR_VERSION %s" % old_version.minor,
                         "#define TF_MINOR_VERSION %s" % new_version.minor,
                         VERSION_H)
  replace_string_in_line("#define TF_PATCH_VERSION %s" % old_version.patch,
                         "#define TF_PATCH_VERSION %s" % new_version.patch,
                         VERSION_H)
  replace_string_in_line(
      "#define TF_VERSION_SUFFIX \"%s\"" % old_version.identifier_string,
      "#define TF_VERSION_SUFFIX \"%s\"" % new_version.identifier_string,
      VERSION_H)

def update_setup_dot_py(old_version, new_version):
  """Update setup.py."""
  replace_string_in_line("_VERSION = '%s'" % old_version.string,
                         "_VERSION = '%s'" % new_version.string, SETUP_PY)

def update_readme(old_version, new_version):
  """Update README."""
  pep_440_str = new_version.pep_440_str
  replace_string_in_line(r"%s\.%s\.([[:alnum:]]+)-" % (old_version.major,
                                                       old_version.minor),
                         "%s-" % pep_440_str, README_MD)

def update_md_files(old_version, new_version):
  """Update the md doc files.

  Args:
    old_version: Version object of current version
    new_version: Version object of new version
  """

  old_pep_version = old_version.pep_440_str
  new_pep_version = new_version.pep_440_str
  for filename in ["linux", "mac", "windows", "sources"]:
    filepath = "%s/docs_src/install/install_%s.md" % (TF_SRC_DIR,
                                                      filename)

    if filename == "sources" and "rc0" in new_pep_version:
      replace_string_in_line("(?<!<td>)tensorflow-%s" % old_pep_version,
                             "tensorflow-%s" % new_pep_version, filepath)
      replace_string_in_line("(?<!<td>)tensorflow_gpu-%s" % old_pep_version,
                             "tensorflow_gpu-%s" % new_pep_version, filepath)
    else:
      replace_string_in_line("tensorflow-%s" % old_pep_version,
                             "tensorflow-%s" % new_pep_version, filepath)
      replace_string_in_line("tensorflow_gpu-%s" % old_pep_version,
                             "tensorflow_gpu-%s" % new_pep_version, filepath)
    replace_string_in_line("TensorFlow %s" % old_pep_version,
                           "TensorFlow %s" % new_pep_version, filepath)

  for filename in ["java", "go", "c"]:
    filepath = "%s/docs_src/install/install_%s.md" % (TF_SRC_DIR,
                                                      filename)
    replace_string_in_line(r"x86_64-%s" % old_version,
                           "x86_64-%s" % new_version, filepath)
    replace_string_in_line(r"libtensorflow-%s.jar" % old_version,
                           "libtensorflow-%s.jar" % new_version, filepath)
    replace_string_in_line(r"<version>%s<\/version>" % old_version,
                           "<version>%s</version>" % new_version, filepath)

  # Update any links to colab notebooks.
  def colab_url(version):
    version_string = "%s.%s.%s" % (version.major, version.minor, version.patch)
    prefix = "https://colab.research.google.com/github/tensorflow/models/blob/r"
    return prefix + version_string + "/"

  replace_string_in_line(
      colab_url(old_version), colab_url(new_version),
      "%s/docs_src/get_started/eager.md" % TF_SRC_DIR)

def major_minor_change(old_version, new_version):
  """Check if a major or minor change occurred."""
  major_mismatch = old_version.major != new_version.major
  minor_mismatch = old_version.minor != new_version.minor
  if major_mismatch or minor_mismatch:
    return True
  return False

def update_dockerfiles(old_version, new_version):
  """Update dockerfiles if there was a major change."""
  if major_minor_change(old_version, new_version):
    old_r_major_minor = "r%s.%s" % (old_version.major, old_version.minor)
    r_major_minor = "r%s.%s" % (new_version.major, new_version.minor)

    print("Detected Major.Minor change.")
    print("Updating pattern %s to %s in additional files"
          % (old_r_major_minor, r_major_minor))

    # Update dockerfiles
    replace_string_in_line(old_r_major_minor, r_major_minor, DEVEL_DOCKERFILE)
    replace_string_in_line(old_r_major_minor, r_major_minor,
                           GPU_DEVEL_DOCKERFILE)
    replace_string_in_line(old_r_major_minor, r_major_minor,
                           CPU_MKL_DEVEL_DOCKERFILE)

def check_for_lingering_string(lingering_string):
  """Check for given lingering strings."""
  formatted_string = lingering_string.replace(".", r"\.")
  try:
    linger_str_output = subprocess.check_output(
        ["grep", "-rnoH", formatted_string, TF_SRC_DIR])
    linger_strs = linger_str_output.decode("utf8").split("\n")
  except subprocess.CalledProcessError:
    linger_strs = []

  if linger_strs:
    print("WARNING: Below are potentially instances of lingering old version "
          "string \"%s\" in source directory \"%s/\" that are not "
          "updated by this script. Please check them manually!"
          % (lingering_string, TF_SRC_DIR))
    for linger_str in linger_strs:
      print(linger_str)
  else:
    print("No lingering old version strings \"%s\" found in source directory"
          " \"%s/\". Good." % (lingering_string, TF_SRC_DIR))

def check_for_old_version(old_version, new_version):
  """Check for old version references."""
  for old_ver in [old_version.string, old_version.pep_440_str]:
    check_for_lingering_string(old_ver)

  if major_minor_change(old_version, new_version):
    old_r_major_minor = "r%s.%s" % (old_version.major, old_version.minor)
    check_for_lingering_string(old_r_major_minor)

def main():
  """This script updates all instances of version in the tensorflow directory.

  Requirements:
    version: The version tag
    OR
    nightly: Create a nightly tag with current date

  Raises:
    RuntimeError: If the script is not being run from tf source dir
  """

  parser = argparse.ArgumentParser(description="Cherry picking automation.")
  group = parser.add_mutually_exclusive_group(required=True)

  # Arg information
  group.add_argument("--version",
                     help="<new_major_ver>.<new_minor_ver>.<new_patch_ver>",
                     default="")
  group.add_argument("--nightly",
                     help="disable the service provisioning step",
                     action="store_true")

  args = parser.parse_args()

  check_all_files()
  old_version = get_current_semver_version()

  if args.nightly:
    # Dev minor version is one ahead of official.
    nightly_minor_ver = int(old_version.minor) + 1
    new_version = Version(old_version.major,
                          str(nightly_minor_ver),
                          old_version.patch,
                          "-dev" + time.strftime("%Y%m%d"),
                          NIGHTLY_VERSION)
  else:
    new_version = Version.parse_from_string(args.version, REGULAR_VERSION)

  update_version_h(old_version, new_version)
  update_setup_dot_py(old_version, new_version)
  update_readme(old_version, new_version)
  update_md_files(old_version, new_version)
  update_dockerfiles(old_version, new_version)

  # Print transition details.
  print("Major: %s -> %s" % (old_version.major, new_version.major))
  print("Minor: %s -> %s" % (old_version.minor, new_version.minor))
  print("Patch: %s -> %s\n" % (old_version.patch, new_version.patch))

  check_for_old_version(old_version, new_version)
  if "rc0" in str(new_version):
    print("\n\n\033[93mNOTE: Please update the tensorflow/docs_src/install/"
          "install_sources.md and add a line for tensorflow-%s and "
          "tensorflow_gpu-%s in the tested source configurations "
          "table.\033[0m\n" % (new_version.pep_440_str,
                               new_version.pep_440_str))

if __name__ == "__main__":
  main()


text:
..
    **************************************************
    *                                                *
    *   Automatically generated file, do not edit!   *
    *                                                *
    **************************************************

.. _amdgpu_synid9_offset_smem_plain:

soffset
===========================

An offset added to the base address to get memory address.

* If offset is specified as a register, it supplies an unsigned byte offset.
* If offset is specified as a 21-bit immediate, it supplies a signed byte offset.

.. WARNING:: Assembler currently supports 20-bit unsigned offsets only. Use :ref:`uimm20<amdgpu_synid_uimm20>` instead of :ref:`simm21<amdgpu_synid_simm21>`.

*Size:* 1 dword.

*Operands:* :ref:`s<amdgpu_synid_s>`, :ref:`flat_scratch<amdgpu_synid_flat_scratch>`, :ref:`xnack<amdgpu_synid_xnack>`, :ref:`vcc<amdgpu_synid_vcc>`, :ref:`ttmp<amdgpu_synid_ttmp>`, :ref:`m0<amdgpu_synid_m0>`, :ref:`simm21<amdgpu_synid_simm21>`

redpajama_set_name: RedPajamaGithub


text:
package node

import (
	"bytes"
	"crypto/tls"
	"errors"
	"expvar"
	"io/ioutil"
	"net/http"
	"os"
	"path"
	"sync"
	"syscall"
	"time"

	ginexpvar "github.com/gin-contrib/expvar"
	"github.com/gin-gonic/gin"
	hclog "github.com/hashicorp/go-hclog"
	"github.com/hashicorp/raft"
	raftboltdb "github.com/hashicorp/raft-boltdb/v2"

	"github.com/gansoi/gansoi/ca"
	"github.com/gansoi/gansoi/database"
	"github.com/gansoi/gansoi/logger"
)

type (
	// Node represents a single gansoi node.
	Node struct {
		db               database.Reader
		raft             *raft.Raft
		leader           bool
		leadersChansLock sync.RWMutex
		leadersChans     []chan bool
		basePath         string
		listenersLock    sync.RWMutex
		listeners        []database.Listener
		client           *http.Client
		self             string
	}

	nodeInfo struct {
		Name    string            `json:"name" storm:"id"`
		Started time.Time         `json:"started"`
		Updated time.Time         `json:"updated"`
		Raft    map[string]string `json:"raft"`
	}
)

var (
	applyNoleader = expvar.NewInt("apply_noleader")
	applyProxy    = expvar.NewInt("apply_proxy")
	applyDirect   = expvar.NewInt("apply_direct")
	nodeSave      = expvar.NewInt("node_save")
	nodeOne       = expvar.NewInt("node_one")
	nodeAll       = expvar.NewInt("node_all")
	nodeFind      = expvar.NewInt("node_find")
	nodeDelete    = expvar.NewInt("node_delete")

	// ErrNoLeader will be returned if an operation requires a leader - but
	// we have none.
	ErrNoLeader = errors.New("no leader")
)

func init() {
	database.RegisterType(nodeInfo{})
}

// NewNode will initialize a new node.
func NewNode(stream raft.StreamLayer, datadir string, db database.Reader, fsm raft.FSM, self string, pair []tls.Certificate, coreCA *ca.CA) (*Node, func() error, error) {
	tr := &http.Transport{
		TLSClientConfig: &tls.Config{
			Certificates:       pair,
			RootCAs:            coreCA.CertPool(),
			InsecureSkipVerify: false,
		},
	}

	var err error
	n := &Node{
		db:     db,
		client: &http.Client{Transport: tr},
		self:   self,
	}

	// Raft config.
	conf := raft.DefaultConfig()
	conf.HeartbeatTimeout = 1000 * time.Millisecond
	conf.ElectionTimeout = 1000 * time.Millisecond
	conf.LeaderLeaseTimeout = 500 * time.Millisecond
	conf.CommitTimeout = 200 * time.Millisecond
	conf.Logger = hclog.New(nil)
	conf.SnapshotInterval = time.Second * 60
	conf.SnapshotThreshold = 100
	conf.LocalID = raft.ServerID(n.self)
	conf.ProtocolVersion = 3

	transport := raft.NewNetworkTransportWithLogger(stream, 1, 0, nil)

	ss, err := raft.NewFileSnapshotStoreWithLogger(datadir, 2, nil)
	if err != nil {
		return nil, nil, err
	}

	raftDBPath := path.Join(datadir, "/raft.db")
	store, err := raftboltdb.NewBoltStore(raftDBPath)
	if err != nil {
		return nil, nil, err
	}

	var st syscall.Stat_t

	if syscall.Stat(path.Dir(raftDBPath), &st) == nil {
		// Try to fix ownership, fail silently.
		os.Chown(raftDBPath, int(st.Uid), int(st.Gid))

		// "snapshots" is raft.snapPath.
		os.Chown(path.Join(datadir, "snapshots"), int(st.Uid), int(st.Gid))
	}

	n.raft, err = raft.NewRaft(
		conf,      // raft.Config
		fsm,       // raft.FSM
		store,     // raft.LogStore
		store,     // raft.StableStore
		ss,        // raft.SnapshotStore
		transport, // raft.Transport
	)
	if err != nil {
		return nil, nil, err
	}

	return n, func() error {
		err := n.raft.Shutdown().Error()
		if err != nil {
			return err
		}

		err = store.Close()
		if err != nil {
			return err
		}

		return transport.Close()
	}, nil
}

// Run will start a few background tasks needed for the node.
func (n *Node) Run() {
	started := time.Now()

	lch := n.raft.LeaderCh()

	// Let the cluster know how we're doing in two second intervals.
	tickChannel := time.NewTicker(time.Second * 2).C

	go func() {
		for {
			select {
			case leader := <-lch:
				n.leaderChange(leader)
			case <-tickChannel:
				// Only try to save if we have a leader
				if n.raft.Leader() == "" {
					break
				}

				var ni nodeInfo
				ni.Started = started
				ni.Updated = time.Now()
				ni.Name = n.self
				ni.Raft = n.raft.Stats()

				err := n.Save(&ni)
				if err != nil {
					logger.Info("node", "Error from cluster save: %s", err.Error())
				}
			}
		}
	}()
}

// Bootstrap will start a new Gansoi cluster. This should only be called for
// new clusters. Not new nodes in a existing cluster.
func (n *Node) Bootstrap() error {
	configuration := raft.Configuration{
		Servers: []raft.Server{{
			ID:       raft.ServerID(n.self),
			Address:  raft.ServerAddress(n.self),
			Suffrage: raft.Voter,
		}},
	}

	return n.raft.BootstrapCluster(configuration).Error()
}

func (n *Node) leaderChange(leader bool) {
	n.leader = leader

	n.leadersChansLock.RLock()
	for _, ch := range n.leadersChans {
		ch <- leader
	}
	n.leadersChansLock.RUnlock()
}

// applyHandler can be used by other nodes to apply a log entry to the leader.
// The POST body should consists of the complete output from LogEntry.Byte().
func (n *Node) applyHandler(c *gin.Context) {
	if !n.leader {
		c.AbortWithStatus(http.StatusGone)
		return
	}

	defer c.Request.Body.Close()
	b, err := ioutil.ReadAll(c.Request.Body)
	if err != nil {
		c.AbortWithError(http.StatusBadRequest, err)
		return
	}

	n.raft.Apply(b, time.Minute)
}

// nodesHandler will return stats for all nodes in the cluster.
func (n *Node) nodesHandler(c *gin.Context) {
	var all []nodeInfo

	err := n.db.All(&all, -1, 0, false)
	if err != nil {
		c.AbortWithError(http.StatusInternalServerError, err)
		return
	}

	c.JSON(http.StatusOK, all)
}

// apply will apply the log entry to the local Raft node if it's leader, will
// forward to leader otherwise.
func (n *Node) apply(entry *database.LogEntry) error {
	// Only attempt this if the cluster is stable with a leader.
	if n.raft.Leader() == "" {
		applyNoleader.Add(1)

		return ErrNoLeader
	}

	if !n.leader {
		applyProxy.Add(1)

		r := bytes.NewReader(entry.Byte())
		l := n.raft.Leader()
		u := "https://" + string(l) + n.basePath + "/apply"

		_, err := n.client.Post(u, "gansoi/entry", r)

		// FIXME: Implement some kind of retry logic here.

		return err
	}

	applyDirect.Add(1)

	n.raft.Apply(entry.Byte(), time.Minute)

	return nil
}

// Save will save an object to the cluster database.
func (n *Node) Save(data interface{}) error {
	nodeSave.Add(1)

	idsetter, ok := data.(database.IDSetter)
	if ok {
		idsetter.SetID()
	}

	entry := database.NewLogEntry(database.CommandSave, data)

	return n.apply(entry)
}

// One will retrieve one record from the cluster database.
func (n *Node) One(fieldName string, value interface{}, to interface{}) error {
	nodeOne.Add(1)

	return n.db.One(fieldName, value, to)
}

// All lists all kinds of a type.
func (n *Node) All(to interface{}, limit int, skip int, reverse bool) error {
	nodeAll.Add(1)

	return n.db.All(to, limit, skip, reverse)
}

// Find find objects of type.
func (n *Node) Find(field string, value interface{}, to interface{}, limit int, skip int, reverse bool) error {
	nodeFind.Add(1)

	return n.db.Find(field, value, to, limit, skip, reverse)
}

// Delete deletes one record.
func (n *Node) Delete(data interface{}) error {
	nodeDelete.Add(1)

	entry := database.NewLogEntry(database.CommandDelete, data)

	return n.apply(entry)
}

// RegisterListener will register a listener for new changes to the database.
func (n *Node) RegisterListener(listener database.Listener) {
	n.listenersLock.Lock()
	defer n.listenersLock.Unlock()

	n.listeners = append(n.listeners, listener)
}

// PostApply satisfies the database.Listener interface.
func (n *Node) PostApply(_ bool, command database.Command, data interface{}) {
	n.listenersLock.RLock()
	defer n.listenersLock.RUnlock()

	for _, listener := range n.listeners {
		// We ignore the leader argument from caller. The caller is most likely
		// a local database that is unaware of raft leadership.
		go listener.PostApply(n.leader, command, data)
	}
}

// Router can be used to assign a Gin routergroup.
func (n *Node) Router(router *gin.RouterGroup) {
	n.basePath = router.BasePath()

	router.GET("/stats", ginexpvar.Handler())
	router.GET("/nodes", n.nodesHandler)
	router.POST("/apply", n.applyHandler)
}

// AddPeer adds a new cluster/raft peer.
func (n *Node) AddPeer(name string) error {
	return n.raft.AddVoter(raft.ServerID(name), raft.ServerAddress(name), 0, 0).Error()
}

// LeaderCh is used to get a channel which delivers signals on acquiring or
// losing leadership. It sends true if we become the leader, and false if we
// lose it.
func (n *Node) LeaderCh() <-chan bool {
	ch := make(chan bool)

	n.leadersChansLock.Lock()
	n.leadersChans = append(n.leadersChans, ch)
	n.leadersChansLock.Unlock()

	return ch
}

// LastIndex returns the last Raft index in stable storage, either from the
// last log or from the last snapshot.
func (n *Node) LastIndex() uint64 {
	return n.raft.LastIndex()
}


text:
set -e

: ${TRAVIS:?'This should only be run on Travis CI'}
TAG=${1:?'Must provide tag'}

# Setup this repo to publish the docs
git fetch origin gh-pages
git checkout -b gh-pages FETCH_HEAD

# Move the built docs into versioned folder
mv target/doc docs/$TAG

# Update the index to point to the versioned docs
sed -i'' -e '//a\

'"$TAG"'

' index.html

# Add the changes
git add docs/$TAG
git add index.html

# Commit and push
git commit -m "Add API docs for $TAG"
git push origin gh-pages:gh-pages


text:
@interface JQTableView : UITableView

@end


text:
package com.jagex.runescape.scene.tile;

import com.jagex.runescape.InteractiveObject;
import com.jagex.runescape.collection.Linkable;
import com.jagex.runescape.scene.object.GroundDecoration;
import com.jagex.runescape.scene.object.GroundItemTile;
import com.jagex.runescape.scene.object.Wall;
import com.jagex.runescape.scene.object.WallDecoration;

public final class Tile extends Linkable {

    public int z;

    public final int x;
    public final int y;
    public final int anInt1310;
    public PlainTile plainTile;
    public ShapedTile shapedTile;
    public Wall wall;
    public WallDecoration wallDecoration;
    public GroundDecoration groundDecoration;
    public GroundItemTile groundItemTile;
    public int entityCount;
    public final InteractiveObject[] interactiveObjects;
    public final int[] interactiveObjectsSize;
    public int interactiveObjectsSizeOR;
    public int logicHeight;
    public boolean draw;
    public boolean visible;
    public boolean drawEntities;
    public int wallCullDirection;
    public int anInt1326;
    public int anInt1327;
    public int anInt1328;
    public Tile tileBelow;

    public Tile(final int i, final int j, final int k) {
        this.interactiveObjects = new InteractiveObject[5];
        this.interactiveObjectsSize = new int[5];
        this.anInt1310 = this.z = i;
        this.x = j;
        this.y = k;
    }
}


text:
require 'set'
require 'lotus/utils/class'
require 'lotus/utils/kernel'
require 'lotus/utils/string'
require 'lotus/utils/load_paths'
require 'lotus/view/rendering/layout_finder'

module Lotus
  module View
    # Configuration for the framework, controllers and actions.
    #
    # Lotus::Controller has its own global configuration that can be manipulated
    # via `Lotus::View.configure`.
    #
    # Every time that `Lotus::View` and `Lotus::Layout` are included, that
    # global configuration is being copied to the recipient. The copy will
    # inherit all the settings from the original, but all the subsequent changes
    # aren't reflected from the parent to the children, and viceversa.
    #
    # This architecture allows to have a global configuration that capture the
    # most common cases for an application, and let views and layouts
    # layouts to specify exceptions.
    #
    # @since 0.2.0
    class Configuration
      # Default root
      #
      # @since 0.2.0
      # @api private
      DEFAULT_ROOT = '.'.freeze

      attr_reader :load_paths
      attr_reader :views
      attr_reader :layouts
      attr_reader :modules

      # Return the original configuration of the framework instance associated
      # with the given class.
      #
      # When multiple instances of Lotus::View are used in the same application,
      # we want to make sure that a controller or an action will  receive the
      # expected configuration.
      #
      # @param base [Class] a view or a layout
      #
      # @return [Lotus::Controller::Configuration] the configuration associated
      #   to the given class.
      #
      # @since 0.2.0
      # @api private
      #
      # @example Direct usage of the framework
      #   require 'lotus/view'
      #
      #   class Show
      #     include Lotus::View
      #   end
      #
      #   Lotus::View::Configuration.for(Show)
      #     # => will return from Lotus::View
      #
      # @example Multiple instances of the framework
      #   require 'lotus/view'
      #
      #   module MyApp
      #     View = Lotus::View.duplicate(self)
      #
      #     module Views::Dashboard
      #       class Index
      #         include MyApp::View
      #       end
      #     end
      #   end
      #
      #   class Show
      #     include Lotus::Action
      #   end
      #
      #   Lotus::View::Configuration.for(Show)
      #     # => will return from Lotus::View
      #
      #   Lotus::View::Configuration.for(MyApp::Views::Dashboard::Index)
      #     # => will return from MyApp::View
      def self.for(base)
        # TODO this implementation is similar to Lotus::Controller::Configuration consider to extract it into Lotus::Utils
        namespace = Utils::String.new(base).namespace
        framework = Utils::Class.load_from_pattern!("(#{namespace}|Lotus)::View")
        framework.configuration
      end

      # Initialize a configuration instance
      #
      # @return [Lotus::View::Configuration] a new configuration's instance
      #
      # @since 0.2.0
      def initialize
        @namespace = Object
        reset!
      end

      # Set the Ruby namespace where to lookup for views.
      #
      # When multiple instances of the framework are used, we want to make sure
      # that if a `MyApp` wants a `Dashboard::Index` view, we are loading the
      # right one.
      #
      # If not set, this value defaults to `Object`.
      #
      # This is part of a DSL, for this reason when this method is called with
      # an argument, it will set the corresponding instance variable. When
      # called without, it will return the already set value, or the default.
      #
      # @overload namespace(value)
      #   Sets the given value
      #   @param value [Class, Module, String] a valid Ruby namespace identifier
      #
      # @overload namespace
      #   Gets the value
      #   @return [Class, Module, String]
      #
      # @since 0.2.0
      #
      # @example Getting the value
      #   require 'lotus/view'
      #
      #   Lotus::View.configuration.namespace # => Object
      #
      # @example Setting the value
      #   require 'lotus/view'
      #
      #   Lotus::View.configure do
      #     namespace 'MyApp::Views'
      #   end
      def namespace(value = nil)
        if value
          @namespace = value
        else
          @namespace
        end
      end

      # Set the root path where to search for templates
      #
      # If not set, this value defaults to the current directory.
      #
      # This is part of a DSL, for this reason when this method is called with
      # an argument, it will set the corresponding instance variable. When
      # called without, it will return the already set value, or the default.
      #
      # @overload root(value)
      #   Sets the given value
      #   @param value [String,Pathname,#to_pathname] an object that can be
      #     coerced to Pathname
      #   @raise [Errno::ENOENT] if the given path doesn't exist
      #
      # @overload root
      #   Gets the value
      #   @return [Pathname]
      #
      # @since 0.2.0
      #
      # @see Lotus::View::Dsl#root
      # @see http://www.ruby-doc.org/stdlib-2.1.2/libdoc/pathname/rdoc/Pathname.html
      # @see http://rdoc.info/gems/lotus-utils/Lotus/Utils/Kernel#Pathname-class_method
      #
      # @example Getting the value
      #   require 'lotus/view'
      #
      #   Lotus::View.configuration.root # => #<Pathname:.>
      #
      # @example Setting the value
      #   require 'lotus/view'
      #
      #   Lotus::View.configure do
      #     root '/path/to/templates'
      #   end
      #
      #   Lotus::View.configuration.root # => #<Pathname:/path/to/templates>
      def root(value = nil)
        if value
          @root = Utils::Kernel.Pathname(value).realpath
        else
          @root
        end
      end

      # Set the global layout
      #
      # If not set, this value defaults to `nil`, while at the rendering time
      # it will use `Lotus::View::Rendering::NullLayout`.
      #
      # This is part of a DSL, for this reason when this method is called with
      # an argument, it will set the corresponding instance variable. When
      # called without, it will return the already set value, or the default.
      #
      # @overload layout(value)
      #   Sets the given value
      #   @param value [Symbol] the name of the layout
      #
      # @overload layout
      #   Gets the value
      #   @return [Class]
      #
      # @since 0.2.0
      #
      # @see Lotus::View::Dsl#layout
      #
      # @example Getting the value
      #   require 'lotus/view'
      #
      #   Lotus::View.configuration.layout # => nil
      #
      # @example Setting the value
      #   require 'lotus/view'
      #
      #   Lotus::View.configure do
      #     layout :application
      #   end
      #
      #   Lotus::View.configuration.layout # => ApplicationLayout
      #
      # @example Setting the value in a namespaced app
      #   require 'lotus/view'
      #
      #   module MyApp
      #     View = Lotus::View.duplicate(self) do
      #       layout :application
      #     end
      #   end
      #
      #   MyApp::View.configuration.layout # => MyApp::ApplicationLayout
      def layout(value = nil)
        if value.nil?
          Rendering::LayoutFinder.find(@layout, @namespace)
        else
          @layout = value
        end
      end

      # Prepare the views.
      #
      # The given block will be yielded when `Lotus::View` will be included by
      # a view.
      #
      # This method can be called multiple times.
      #
      # @param blk [Proc] the code block
      #
      # @return [void]
      #
      # @raise [ArgumentError] if called without passing a block
      #
      # @since 0.3.0
      #
      # @see Lotus::View.configure
      # @see Lotus::View.duplicate
      #
      # @example Including shared utilities
      #   require 'lotus/view'
      #
      #   module UrlHelpers
      #     def comments_path
      #       '/'
      #     end
      #   end
      #
      #   Lotus::View.configure do
      #     prepare do
      #       include UrlHelpers
      #     end
      #   end
      #
      #   Lotus::View.load!
      #
      #   module Comments
      #     class New
      #       # The following include will cause UrlHelpers to be included too.
      #       # This makes `comments_path` available in the view context
      #       include Lotus::View
      #
      #       def form
      #         %(<form action="#{ comments_path }" method="POST"></form>)
      #       end
      #     end
      #   end
      #
      # @example Preparing multiple times
      #   require 'lotus/view'
      #
      #   Lotus::View.configure do
      #     prepare do
      #       include UrlHelpers
      #     end
      #
      #     prepare do
      #       format :json
      #     end
      #   end
      #
      #   Lotus::View.configure do
      #     prepare do
      #       include FormattingHelpers
      #     end
      #   end
      #
      #   Lotus::View.load!
      #
      #   module Articles
      #     class Index
      #       # The following include will cause the inclusion of:
      #       #   * UrlHelpers
      #       #   * FormattingHelpers
      #       #
      #       # It also sets the view to render only JSON
      #       include Lotus::View
      #     end
      #   end
      def prepare(&blk)
        if block_given?
          @modules.push(blk)
        else
          raise ArgumentError.new('Please provide a block')
        end
      end

      # Add a view to the registry
      #
      # @since 0.2.0
      # @api private
      def add_view(view)
        @views.add(view)
      end

      # Add a layout to the registry
      #
      # @since 0.2.0
      # @api private
      def add_layout(layout)
        @layouts.add(layout)
      end

      # Duplicate by copying the settings in a new instance.
      #
      # @return [Lotus::View::Configuration] a copy of the configuration
      #
      # @since 0.2.0
      # @api private
      def duplicate
        Configuration.new.tap do |c|
          c.namespace  = namespace
          c.root       = root
          c.layout     = @layout # lazy loading of the class
          c.load_paths = load_paths.dup
          c.modules    = modules.dup
        end
      end

      # Load the configuration for the current framework
      #
      # @since 0.2.0
      # @api private
      def load!
        views.each   { |v| v.__send__(:load!) }
        layouts.each { |l| l.__send__(:load!) }
        freeze
      end

      # Reset all the values to the defaults
      #
      # @since 0.2.0
      # @api private
      def reset!
        root(DEFAULT_ROOT)

        @views      = Set.new
        @layouts    = Set.new
        @load_paths = Utils::LoadPaths.new(root)
        @layout     = nil
        @modules    = []
      end

      # Copy the configuration for the given action
      #
      # @param base [Class] the target action
      #
      # @return void
      #
      # @since 0.3.0
      # @api private
      def copy!(base)
        modules.each do |mod|
          base.class_eval(&mod)
        end
      end

      alias_method :unload!, :reset!

      protected
      attr_writer :namespace
      attr_writer :root
      attr_writer :load_paths
      attr_writer :layout
      attr_writer :modules
    end
  end
end


text:
module Watchman
  class UserNotSet < RuntimeError; end

  class Proxy
    # An accessor to the winning strategy
    # :api: private
    attr_accessor :winning_strategy

    # An accessor to the rack env hash, the proxy owner and its config
    # :api: public
    attr_reader :env, :manager, :config, :winning_strategies

    extend ::Forwardable
    include ::Watchman::Mixins::Common

    ENV_WATCHMAN_ERRORS = 'watchman.errors'.freeze
    ENV_SESSION_OPTIONS = 'rack.session.options'.freeze

    # :api: private
    def_delegators :winning_strategy, :headers, :status, :custom_response

    # :api: public
    def_delegators :config, :default_strategies

    def initialize(env, manager) #:nodoc:
      @env, @permissions, @winning_strategies, @locked = env, {}, {}, false
      @manager, @config = manager, manager.config.dup
      @strategies = Hash.new { |h,k| h[k] = {} }
      manager._run_callbacks(:on_request, self)
    end

     # Lazily initiate errors object in session.
    # :api: public
    def errors
      @env[ENV_WARDEN_ERRORS] ||= Errors.new
    end

    # Points to a SessionSerializer instance responsible for handling
    # everything related with storing, fetching and removing the permissions
    # session.
    # :api: public
    def session_serializer
      @session_serializer ||= Watchman::SessionSerializer.new(@env)
    end

    # Clear the cache of performed strategies so far. Warden runs each
    # strategy just once during the request lifecycle. You can clear the
    # strategies cache if you want to allow a strategy to be run more than
    # once.
    #
    # This method has the same API as authenticate, allowing you to clear
    # specific strategies for given scope:
    #
    # Parameters:
    # args - a list of symbols (labels) that name the strategies to attempt
    # opts - an options hash that contains the :scope of the permissions to check
    #
    # Example:
    # # Clear all strategies for the configured default_scope
    # env['warden'].clear_strategies_cache!
    #
    # # Clear all strategies for the :admin scope
    # env['warden'].clear_strategies_cache!(:scope => :admin)
    #
    # # Clear password strategy for the :admin scope
    # env['warden'].clear_strategies_cache!(:password, :scope => :admin)
    #
    # :api: public
    def clear_strategies_cache!(*args)
      scope, _opts = _retrieve_scope_and_opts(args)

      @winning_strategies.delete(scope)
      @strategies[scope].each do |k, v|
        v.clear! if args.empty? || args.include?(k)
      end
    end

    # Locks the proxy so new users cannot authorize during the
    # request lifecycle. This is useful when the request cannot
    # be verified (for example, using a CSRF verification token).
    # Notice that already authorized users are kept as so.
    #
    # :api: public
    def lock!
      @locked = true
    end

    # Run the authorization strategies for the given strategies.
    # If there are already permisions for a given scope, the strategies are not run
    # This does not halt the flow of control and is a passive attempt to authorize only
    # When scope is not specified, the default_scope is assumed.
    #
    # Parameters:
    #   args - a list of symbols (labels) that name the strategies to attempt
    #   opts - an options hash that contains the :scope of the permissions to check
    #
    # Example:
    #   env['watchman'].authorize(:warden, :scope => :anonymous)
    #
    # :api: public
    def authorize(*args)
      permissions, _opts = _perform_authorization(*args)
      permissions
    end

    # Same API as authorized, but returns a boolean instead of a user.
    # The difference between this method (authorize?) and authorize?
    # is that the former will run strategies if the user has not yet been
    # authorized, and the second relies on already performed ones.
    # :api: public
    def authorize?(*args)
      result = !!authorize(*args)
      yield if result && block_given?
      result
    end

    # The same as +authorize+ except on failure it will throw an :watchman symbol causing the request to be halted
    # and rendered through the +failure_app+
    #
    # Example
    # env['watchman'].authorize!(:warden, :scope => :anonymous) # throws if it cannot authorize
    #
    # :api: public
    def authorize!(*args)
      permissions, opts = _perform_authorization(*args)
      throw(:watchman, opts) unless permissions
      permissions
    end

    # Check to see if there are permissions for the given scope.
    # This brings the permissions from the session, but does not run strategies before doing so.
    # If you want strategies to be run, please check authorize?.
    #
    # Parameters:
    # scope - the scope to check for authorization. Defaults to default_scope
    #
    # Example:
    # env['watchman'].authorized?(:admin)
    #
    # :api: public
    def authorized?(scope = @config.default_scope)
      result = !!permissions(scope)
      yield if block_given? && result
      result
    end

    # Same API as authorized?, but returns false when authorized.
    # :api: public
    def unauthorized?(scope = @config.default_scope)
      result = !authorized?(scope)
      yield if block_given? && result
      result
    end

    # :api: public
    def ensure!(permission, subject=nil, scope = @config.default_scope)
      _check_permissions(permission, :ensure!, subject, scope)
    end

    # :api: public
    def permitted(permission, subject=nil, scope = @config.default_scope)
      _check_permissions(permission, :permitted, subject, scope)
    end

    # :api: public
    def permitted?(permission, subject=nil, scope = @config.default_scope)
      _check_permissions(permission, :permitted?, subject, scope)
    end

    # Manually set the permissions into the session and auth proxy
    #
    # Parameters:
    # permissions - An object that has been setup to serialize into and out of the session.
    # opts - An options hash. Use the :scope option to set the scope of the permissions, set the :store option to false to skip serializing into the session, set the :run_callbacks to false to skip running the callbacks (the default is true).
    #
    # :api: public
    def set_permissions(permissions, opts = {})
      scope = (opts[:scope] ||= @config.default_scope)

      # Get the default options from the master configuration for the given scope
      opts = (@config[:scope_defaults][scope] || {}).merge(opts)
      opts[:event] ||= :set_permissions
      @permissions[scope] = permissions

      if opts[:store] != false && opts[:event] != :fetch
        options = env[ENV_SESSION_OPTIONS]
        options[:renew] = true if options
        session_serializer.store(permissions, scope)
      end

      run_callbacks = opts.fetch(:run_callbacks, true)
      manager._run_callbacks(:after_set_permissions, permissions, self, opts) if run_callbacks

      @permissions[scope]
    end

    # Provides acccess to the permissions object in a given scope for a request.
    # Will be nil if not logged in. Please notice that this method does not
    # perform strategies.
    #
    # Example:
    # # without scope (default user)
    # env['watchman'].permissions
    #
    # # with scope
    # env['watchman'].permissions(:admin)
    #
    # # as a Hash
    # env['watchman'].permissions(:scope => :admin)
    #
    # # with default scope and run_callbacks option
    # env['watchman'].permissions(:run_callbacks => false)
    #
    # # with a scope and run_callbacks option
    # env['watchman'].permissions(:scope => :admin, :run_callbacks => true)
    #
    # :api: public
    def permissions(argument = {})
      opts = argument.is_a?(Hash) ? argument : { :scope => argument }
      scope = (opts[:scope] ||= @config.default_scope)

      if @permissions.has_key?(scope)
        @permissions[scope]
      else
        unless permissions = session_serializer.fetch(scope)
          run_callbacks = opts.fetch(:run_callbacks, true)
          manager._run_callbacks(:after_failed_fetch, permissions, self, :scope => scope) if run_callbacks
        end

        @permissions[scope] = permissions ? set_permissions(permissions, opts.merge(:event => :fetch)) : nil
      end
    end

    # proxy methods through to the winning strategy
    # :api: private
    def result # :nodoc:
      winning_strategy && winning_strategy.result
    end

    # Proxy through to the authorization strategy to find out the message that was generated.
    # :api: public
    def message
      winning_strategy && winning_strategy.message
    end

    # Provides a way to return a 403 without warden defering to the failure app
    # The result is a direct passthrough of your own response
    # :api: public
    def custom_failure!
      @custom_failure = true
    end

    # Check to see if the custom failure flag has been set
    # :api: public
    def custom_failure?
      if instance_variable_defined?(:@custom_failure)
        !!@custom_failure
      else
        false
      end
    end

    # Check to see if this is an asset request
    # :api: public
    def asset_request?
      ::Watchman::asset_paths.any? { |r| env['PATH_INFO'].to_s.match(r) }
    end

    def inspect(*args)
      "Watchman::Proxy:#{object_id} @config=#{@config.inspect}"
    end

    def to_s(*args)
      inspect(*args)
    end

    private

    def _perform_authorization(*args)
      scope, opts = _retrieve_scope_and_opts(args)
      permissions = nil

      # Look for existing permissions in the session for this scope.
      # If there ware no permissions in the session. See if we can get one from the request.
      return permissions, opts if permissions = permissions(opts.merge(:scope => scope))
      _run_strategies_for(scope, args)

      if winning_strategy && winning_strategy.permissions
        opts[:store] = opts.fetch(:store, winning_strategy.store?)
        set_permissions(winning_strategy.permissions, opts.merge!(:event => :authorization))
      end

      [@permissions[scope], opts]
    end

    def _retrieve_scope_and_opts(args) #:nodoc:
      opts = args.last.is_a?(Hash) ? args.pop : {}
      scope = opts[:scope] || @config.default_scope
      opts = (@config[:scope_defaults][scope] || {}).merge(opts)
      [scope, opts]
    end

    # Run the strategies for a given scope
    def _run_strategies_for(scope, args) #:nodoc:
      self.winning_strategy = @winning_strategies[scope]
      return if winning_strategy && winning_strategy.halted?

      # Do not run any strategy if locked
      return if @locked

      if args.empty?
        defaults = @config[:default_strategies]
        strategies = defaults[scope] || defaults[:_all]
      end

      (strategies || args).each do |name|
        strategy = _fetch_strategy(name, scope)
        next unless strategy && !strategy.performed? && strategy.valid?

        self.winning_strategy = @winning_strategies[scope] = strategy
        strategy._run!
        break if strategy.halted?
      end
    end

    # Fetchs strategies and keep them in a hash cache.
    def _fetch_strategy(name, scope)
      @strategies[scope][name] ||= if klass = Watchman::Strategies[name]
        klass.new(@env, scope)
      elsif @config.silence_missing_strategies?
        nil
      else
        raise "Invalid strategy #{name}"
      end
    end

    def _normalize_subject_and_scope(subject, scope) #:nodoc:
      if @winning_strategies.has_key?(subject)
        [nil, subject]
      else
        [subject, scope]
      end
    end

    def _check_permissions(permission, check, subject, scope)
      subject, scope = _normalize_subject_and_scope(subject, scope)

      permissions(scope)[permission].send(check, subject)
    end
  end
end


text:
<resources>
    <string name="app_name">NetLibrary</string>
</resources>


text:
package ve.com.abicelis.chefbuddy.model.edamam;

/**
 * Created by abicelis on 21/7/2017.
 */

public class EdamamHit {

    private EdamamRecipe recipe;

    public EdamamRecipe getRecipe() {
        return recipe;
    }
}


text:
import firebase from 'firebase'
import firebaseApp from './firebase'

const database = firebaseApp.database()
const messagesRef = database.ref('messages')
const visibleMessagesRef = database.ref('messages').orderByChild('timestamp').limitToLast(100)
const usersRef = database.ref('users')

export const messageTypes = {
    TEXT: 'TEXT',
    FILE: 'FILE',
    NOTIFICATION: 'NOTIFICATION'
}

export const addMessage = async (type, content, senderId) => {
    if (!content) return // if message is an empty string
    if (!/\S/.test(content)) return // if message contains only whitespaces

    const key = messagesRef.push().key
    const timestamp = firebase.database.ServerValue.TIMESTAMP
    messagesRef.update({
        [key]: {
            id: key,
            type,
            content,
            senderId,
            timestamp
        }
    })
}

export const onMessagesDataChange = (handler) => {
    visibleMessagesRef.on('value', snapshot => {
        const messages = []
        snapshot.forEach(messageSnapshot => { messages.push(messageSnapshot.val()) })
        handler(messages)
    })
}

export const onNewMessage = (handler) => {
    messagesRef.on('child_added', snapshot => handler(snapshot.val()))
}

export const updateUser = (user) => {
    usersRef.update({
        [user.id]: user
    })
}

export const getUser = async (id) => {
    const snapshot = await usersRef.child(id).once('value')
    return snapshot.val()
}

export const onUsersDataChange = (handler) => {
    usersRef.on('value', snapshot =>
        handler(snapshot.val())
    )
}


text:
int main(int argc, char * argv[])
{
    @autoreleasepool {
        return UIApplicationMain(argc, argv, nil, NSStringFromClass([CForAppDelegate class]));
    }
}


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

namespace MOD.Web.Element
{
	/// <summary>
	/// INode interface. Usefull for polymorphism
	/// </summary>
	public interface INode
	{
		/// <summary>
		/// Converts the node to a string.
		/// </summary>
		/// <param name="sb"></param>
		void ToString(StringBuilder sb);
	}
}


text:
import com.teamdev.jxbrowser.chromium.Browser;
import com.teamdev.jxbrowser.chromium.swing.BrowserView;

import javax.swing.*;
import java.awt.*;

/**
 * This sample loads a web page with Silverlight examples, so you
 * can see how JxBrowser displays Silverlight content.
 */
public class SilverlightSample {
    public static void main(String[] args) {
        Browser browser = new Browser();
        BrowserView browserView = new BrowserView(browser);

        JFrame frame = new JFrame("Silverlight Sample");
        frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
        frame.add(browserView, BorderLayout.CENTER);
        frame.setSize(800, 600);
        frame.setLocationRelativeTo(null);
        frame.setVisible(true);

        browser.loadURL("http://demos.telerik.com/silverlight/");
    }
}


text:
goog.provide('ol.test.geom.flat.deflate');

describe('ol.geom.flat.deflate', function() {

  describe('ol.geom.flat.deflate.coordinates', function() {

    var flatCoordinates;
    beforeEach(function() {
      flatCoordinates = [];
    });

    it('flattens coordinates', function() {
      var offset = ol.geom.flat.deflate.coordinates(
          flatCoordinates, 0, [[1, 2], [3, 4]], 2);
      expect(offset).to.be(4);
      expect(flatCoordinates).to.eql([1, 2, 3, 4]);
    });

  });

  describe('ol.geom.flat.deflate.coordinatess', function() {

    var flatCoordinates;
    beforeEach(function() {
      flatCoordinates = [];
    });

    it('flattens arrays of coordinates', function() {
      var ends = ol.geom.flat.deflate.coordinatess(flatCoordinates, 0,
          [[[1, 2], [3, 4]], [[5, 6], [7, 8]]], 2);
      expect(ends).to.eql([4, 8]);
      expect(flatCoordinates).to.eql([1, 2, 3, 4, 5, 6, 7, 8]);
    });

  });

});

goog.require('ol.geom.flat.deflate');


text:
package org.dasein.cloud.network;

import org.dasein.cloud.AccessControlledService;
import org.dasein.cloud.CloudException;
import org.dasein.cloud.InternalException;
import org.dasein.cloud.OperationNotSupportedException;
import org.dasein.cloud.Requirement;
import org.dasein.cloud.ResourceStatus;
import org.dasein.cloud.Tag;
import org.dasein.cloud.identity.ServiceAction;

import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import java.util.Collection;
import java.util.Locale;
import java.util.Map;

/**
 * Prescribes support network firewalls. Network firewalls are like regular firewalls, except they are associated with
 * networks or subnets instead of virtual machines.
 *
Created by George Reese: 2/4/13 8:40 AM

 * @author George Reese
 * @since 2013.04
 * @version 2013.04 initial version (issue greese/dasein-cloud-aws/#8)
 * @version 2014.03 added support for constraints (issue #99)
 */
public interface NetworkFirewallSupport extends AccessControlledService {
    static public final ServiceAction ANY                  = new ServiceAction("NFW:ANY");

    static public final ServiceAction ASSOCIATE            = new ServiceAction("NFW:ASSOCIATE");
    static public final ServiceAction AUTHORIZE            = new ServiceAction("NFW:AUTHORIZE");
    static public final ServiceAction CREATE_FIREWALL      = new ServiceAction("NFW:CREATE_FIREWALL");
    static public final ServiceAction GET_FIREWALL         = new ServiceAction("NFW:GET_FIREWALL");
    static public final ServiceAction LIST_FIREWALL        = new ServiceAction("NFW:LIST_FIREWALL");
    static public final ServiceAction REMOVE_FIREWALL      = new ServiceAction("NFW:REMOVE_FIREWALL");
    static public final ServiceAction REVOKE               = new ServiceAction("NFW:REVOKE");

    /**
     * Associates the specified firewall with the specified subnet.
     * @param firewallId the firewall to be associated
     * @param withSubnetId the subnet with which the firewall is to be associated
     * @throws CloudException an error occurred with the cloud provider while performing the operation
     * @throws InternalException an error occurred locally independent of any events in the cloud
     * @throws OperationNotSupportedException you cannot associate network firewalls at the subnet level
     */
    public void associateWithSubnet(@Nonnull String firewallId, @Nonnull String withSubnetId) throws CloudException, InternalException;

    /**
     * Provides positive authorization for the specified firewall rule with the specified precedence. Any call to this method should
     * result in an override of any previous authorizations. For this method, the source endpoint is the source for the traffic and
     * the destination endpoint is where the traffic terminates. For INGRESS rules, the destination endpoint will thus be
     * resources protected by this firewall and for EGRESS rules the destination endpoint is one or more external resources.
     * @param firewallId the unique, cloud-specific ID for the firewall being targeted by the new rule
     * @param direction the direction of the traffic governing the rule
     * @param permission ALLOW or DENY
     * @param sourceEndpoint the source endpoint for this rule
     * @param protocol the protocol (tcp/udp/icmp) supported by this rule
     * @param destinationEndpoint the destination endpoint to specify for this rule
     * @param beginPort the beginning of the port range to be allowed, inclusive
     * @param endPort the end of the port range to be allowed, inclusive
     * @param precedence the precedence of this rule with respect to others (-1 means the default rule)
     * @return the provider ID of the new rule
     * @throws CloudException an error occurred with the cloud provider establishing the rule
     * @throws InternalException an error occurred locally trying to establish the rule
     * @throws OperationNotSupportedException the specified direction, target, or permission are not supported
     */
    public @Nonnull String authorize(@Nonnull String firewallId, @Nonnull Direction direction, @Nonnull Permission permission, @Nonnull RuleTarget sourceEndpoint, @Nonnull Protocol protocol, @Nonnull RuleTarget destinationEndpoint, int beginPort, int endPort, int precedence) throws CloudException, InternalException;

    /**
     * Provides positive authorization for the specified firewall rule with the specified precedence. Any call to this method should
     * result in an override of any previous authorizations. For this method, the source endpoint is the source for the traffic and
     * the destination endpoint is where the traffic terminates. For INGRESS rules, the destination endpoint will thus be
     * resources protected by this firewall and for EGRESS rules the destination endpoint is one or more external resources.
     * @param firewallId the unique, cloud-specific ID for the firewall being targeted by the new rule
     * @param options the firewall create options that define how the rule should be created
     * @return the provider ID of the new rule
     * @throws CloudException an error occurred with the cloud provider establishing the rule
     * @throws InternalException an error occurred locally trying to establish the rule
     * @throws OperationNotSupportedException the specified direction, target, or permission are not supported
     */
    public @Nonnull String authorize(@Nonnull String firewallId, @Nonnull FirewallRuleCreateOptions options) throws CloudException, InternalException;

    /**
     * Creates a new firewall based on the specified creation options.
     * @param options the options to be used in creating the firewall
     * @return the unique provider ID identifying the newly created firewall
     * @throws CloudException an error occurred with the cloud provider while performing the operation
     * @throws InternalException an error occurred locally independent of any events in the cloud
     * @throws UnsupportedOperationException this cloud doesn't support firewall creation using the specified options
     */
    public @Nonnull String createFirewall(@Nonnull FirewallCreateOptions options) throws InternalException, CloudException;

    /**
     * Identifies the constraints and values currently active for the specified firewall. The constrained fields
     * should match the fields defined as being constrained in {@link #getFirewallConstraintsForCloud()}.
     * @param firewallId the ID for which you are seeking active constraints
     * @return a map of constraints to the value on which a given rule value is constrained
     * @throws InternalException an error occurred inside Dasein Cloud processing the request
     * @throws CloudException an error occurred communicating with the cloud provider in assembling the list
     */
    public @Nullable Map<FirewallConstraints.Constraint, Object> getActiveConstraintsForFirewall(@Nonnull String firewallId) throws InternalException, CloudException;

    /**
     * Provides access to meta-data about load balancer capabilities in the current region of this cloud.
     * @return a description of the features supported by this region of this cloud
     * @throws InternalException an error occurred within the Dasein Cloud API implementation
     * @throws CloudException an error occurred within the cloud provider
     */
    public @Nonnull NetworkFirewallCapabilities getCapabilities() throws CloudException, InternalException;

    /**
     * Provides the full firewall data for the specified firewall.
     * @param firewallId the unique ID of the desired firewall
     * @return the firewall state for the specified firewall instance
     * @throws InternalException an error occurred locally independent of any events in the cloud
     * @throws CloudException an error occurred with the cloud provider while performing the operation
     */
    public @Nullable Firewall getFirewall(@Nonnull String firewallId) throws InternalException, CloudException;

    /**
     * Fetches the constraints for firewalls in this cloud. A constraint is a field that all rules
     * associated with a firewall must share. For example, a firewall constrained on
     * {@link FirewallConstraints.Constraint#PROTOCOL} requires all rules associated with it to share
     * the same protocol.
     * @return the firewall constraints for this cloud
     * @throws InternalException an internal error occurred assembling the cloud firewall constraints
     * @throws CloudException an error occurred fetching constraint data from the cloud
     * @deprecated use {@link NetworkFirewallCapabilities#getFirewallConstraintsForCloud()}
     */
    @Deprecated
    public @Nonnull FirewallConstraints getFirewallConstraintsForCloud() throws InternalException, CloudException;

    /**
     * Provides the cloud-specific terminology for the concept of a network firewall. For example, AWS calls a
     * network firewall a "network ACL".
     * @param locale the locale for which you should translate the firewall term
     * @return the translated term for network firewall with the target cloud provider
     * @deprecated use {@link NetworkFirewallCapabilities#getProviderTermForNetworkFirewall(java.util.Locale)}
     */
    @Deprecated
    public @Nonnull String getProviderTermForNetworkFirewall(@Nonnull Locale locale);

    /**
     * Indicates the degree to which authorizations expect precedence of rules to be established.
     * @return the degree to which precedence is required
     * @throws InternalException an error occurred locally independent of any events in the cloud
     * @throws CloudException an error occurred with the cloud provider while performing the operation
     * @deprecated use {@link NetworkFirewallCapabilities#identifyPrecedenceRequirement()}
     */
    @Deprecated
    public @Nonnull Requirement identifyPrecedenceRequirement() throws InternalException, CloudException;

    /**
     * Identifies whether or not the current account is subscribed to network firewall services in the current region.
     * @return true if the current account is subscribed to network firewall services for the current region
     * @throws CloudException an error occurred with the cloud provider while determining subscription status
     * @throws InternalException an error occurred in the Dasein Cloud implementation while determining subscription status
     */
    public boolean isSubscribed() throws CloudException, InternalException;

    /**
     * Indicates whether the highest precedence comes from low numbers. If true, 0 is the highest precedence a rule
     * can have. If false, 0 is the lowest precedence.
     * @return true if 0 is the highest precedence for a rule
     * @throws InternalException an error occurred locally independent of any events in the cloud
     * @throws CloudException an error occurred with the cloud provider while performing the operation
     * @deprecated use {@link NetworkFirewallCapabilities#isZeroPrecedenceHighest()}
     */
    @Deprecated
    public boolean isZeroPrecedenceHighest() throws InternalException, CloudException;

    /**
     * Lists the status for all network firewalls in the current provider context.
     * @return the status for all network firewalls in the current account
     * @throws InternalException an error occurred locally independent of any events in the cloud
     * @throws CloudException an error occurred with the cloud provider while performing the operation
     */
    public @Nonnull Iterable<ResourceStatus> listFirewallStatus() throws InternalException, CloudException;

    /**
     * Lists all network firewalls in the current provider context.
     * @return a list of all network firewalls in the current provider context
     * @throws InternalException an error occurred locally independent of any events in the cloud
     * @throws CloudException an error occurred with the cloud provider while performing the operation
     */
    public @Nonnull Collection<Firewall> listFirewalls() throws InternalException, CloudException;

    /**
     * Provides the rules supported by the named firewall ordered in order of precedence with the most
     * important rule first. Implementation note: natural sorting order for {@link FirewallRule} is low to
     * high. If this cloud has 0 as a low priority, you should reverse the natural sort!
     * @param firewallId the unique ID of the firewall being queried
     * @return all rules supported by the target firewall
     * @throws InternalException an error occurred locally independent of any events in the cloud
     * @throws CloudException an error occurred with the cloud provider while performing the operation
     */
    public @Nonnull Iterable<FirewallRule> listRules(@Nonnull String firewallId) throws InternalException, CloudException;

    /**
     * Describes what kinds of destinations may be named. A cloud must support at least one, but may support more
     * than one.
     * @return a list of supported destinations
     * @throws InternalException an error occurred locally independent of any events in the cloud
     * @throws CloudException an error occurred with the cloud provider while performing the operation
     * @deprecated use {@link NetworkFirewallCapabilities#listSupportedDestinationTypes()}
     */
    @Deprecated
    public @Nonnull Iterable<RuleTargetType> listSupportedDestinationTypes() throws InternalException, CloudException;

    /**
     * Lists the supported traffic directions for rules for network firewalls.
     * @return a list of supported directions
     * @throws InternalException an error occurred locally independent of any events in the cloud
     * @throws CloudException an error occurred with the cloud provider while performing the operation
     * @deprecated use {@link NetworkFirewallCapabilities#listSupportedDirections()}
     */
    @Deprecated
    public @Nonnull Iterable<Direction> listSupportedDirections() throws InternalException, CloudException;

    /**
     * Lists the types of permissions that one may authorize for a network firewall rule.
     * @return a list of supported permissions
     * @throws InternalException an error occurred locally independent of any events in the cloud
     * @throws CloudException an error occurred with the cloud provider while performing the operation
     * @deprecated use {@link org.dasein.cloud.network.NetworkFirewallCapabilities#listSupportedPermissions()}
     */
    @Deprecated
    public @Nonnull Iterable<Permission> listSupportedPermissions() throws InternalException, CloudException;

    /**
     * Describes what kinds of source endpoints may be named. A cloud must support at least one, but may support more
     * than one.
     * @return a list of supported source endpoints
     * @throws InternalException an error occurred locally independent of any events in the cloud
     * @throws CloudException an error occurred with the cloud provider while performing the operation
     * @deprecated use {@link NetworkFirewallCapabilities#listSupportedSourceTypes()}
     */
    @Deprecated
    public @Nonnull Iterable<RuleTargetType> listSupportedSourceTypes() throws InternalException, CloudException;

    /**
     * Removes one or more network firewalls from the system.
     * @param firewallIds the unique IDs of the firewalls to be deleted
     * @throws InternalException an error occurred locally independent of any events in the cloud
     * @throws CloudException an error occurred with the cloud provider while performing the operation
     */
    public void removeFirewall(@Nonnull String ... firewallIds) throws InternalException, CloudException;

    /**
     * Removes meta-data from a network firewall. If tag values are set, their removal is dependent on underlying cloud
     * provider behavior. They may be removed only if the tag value matches or they may be removed regardless of the
     * value.
     * @param firewallId the firewall to update
     * @param tags the meta-data tags to remove
     * @throws CloudException    an error occurred within the cloud provider
     * @throws InternalException an error occurred within the Dasein Cloud API implementation
     */
    public void removeTags(@Nonnull String firewallId, @Nonnull Tag... tags) throws CloudException, InternalException;

    /**
     * Removes meta-data from multiple network firewalls. If tag values are set, their removal is dependent on underlying cloud
     * provider behavior. They may be removed only if the tag value matches or they may be removed regardless of the
     * value.
     * @param firewallIds the network firewalls to update
     * @param tags  the meta-data tags to remove
     * @throws CloudException    an error occurred within the cloud provider
     * @throws InternalException an error occurred within the Dasein Cloud API implementation
     */
    public void removeTags(@Nonnull String[] firewallIds, @Nonnull Tag ... tags) throws CloudException, InternalException;

    /**
     * Revokes the uniquely identified firewall rule.
     * @param providerFirewallRuleId the unique ID of the firewall rule
     * @throws InternalException an error occurred locally independent of any events in the cloud
     * @throws CloudException an error occurred with the cloud provider while performing the operation
     */
    public void revoke(@Nonnull String providerFirewallRuleId) throws InternalException, CloudException;

    /**
     * Indicates whether or not you can create new network firewalls or whether you just have to live with what the cloud provider gave you.
     * @return true if you can call {@link #createFirewall(FirewallCreateOptions)}
     * @throws CloudException an error occurred with the cloud provider while checking for support
     * @throws InternalException a local error occurred while checking for support
     * @deprecated use {@link NetworkFirewallCapabilities#supportsNetworkFirewallCreation()}
     */
    @Deprecated
    public boolean supportsNetworkFirewallCreation() throws CloudException, InternalException;

    /**
     * Updates meta-data for a network firewall with the new values. It will not overwrite any value that currently
     * exists unless it appears in the tags you submit.
     * @param firewallId the network firewall to update
     * @param tags the meta-data tags to set
     * @throws CloudException    an error occurred within the cloud provider
     * @throws InternalException an error occurred within the Dasein Cloud API implementation
     */
    public void updateTags(@Nonnull String firewallId, @Nonnull Tag... tags) throws CloudException, InternalException;

    /**
     * Updates meta-data for multiple network firewalls with the new values. It will not overwrite any value that currently
     * exists unless it appears in the tags you submit.
     * @param firewallIds the network firewalls to update
     * @param tags  the meta-data tags to set
     * @throws CloudException    an error occurred within the cloud provider
     * @throws InternalException an error occurred within the Dasein Cloud API implementation
     */
    public void updateTags(@Nonnull String[] firewallIds, @Nonnull Tag... tags) throws CloudException, InternalException;

    /**
     * Set meta-data for a network firewall. Remove any tags that were not provided by the incoming tags, and add or
     * overwrite any new or pre-existing tags.
     *
     * @param firewallId the network firewalls to set
     * @param tags       the meta-data tags to set
     * @throws CloudException    an error occurred within the cloud provider
     * @throws InternalException an error occurred within the Dasein Cloud API implementation
     */
    public void setTags( @Nonnull String firewallId, @Nonnull Tag... tags ) throws CloudException, InternalException;

    /**
     * Set meta-data for multiple network firewalls. Remove any tags that were not provided by the incoming tags, and add or
     * overwrite any new or pre-existing tags.
     *
     * @param firewallIds the networks firewalls to set
     * @param tags        the meta-data tags to set
     * @throws CloudException    an error occurred within the cloud provider
     * @throws InternalException an error occurred within the Dasein Cloud API implementation
     */
    public void setTags( @Nonnull String[] firewallIds, @Nonnull Tag... tags ) throws CloudException, InternalException;

}


text:
local Sock = require "lnet.cosocket"
local req = http.req

http.resp.headers["Content-Type"] = "text/plain"

local tcp = Sock:tcp()

-- connect self
local ret, err = tcp:connect("127.0.0.1", 1234)
if ret < 0 then
	http.resp.content = "connect fail: "..err
	tcp:close()
	return
end

-- get '/' page
local sndlen, err = tcp:send("GET / HTTP/1.0\r\n\r\n")
if sndlen < 0 then
	http.resp.content = "send fail: "..err
	tcp:close()
	return
end

-- recv response until '\r\n\r\n'
local rcvlen, data = tcp:recv("\r\n\r\n")
if rcvlen < 0 then
	http.resp.content = "recv fail: "..data
	tcp:close()
	return
end

-- show data
http.resp.content = data

tcp:close()


text:
package it.infn.ct.security.actions;

import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionSupport;
import com.opensymphony.xwork2.validator.annotations.RequiredFieldValidator;
import com.opensymphony.xwork2.validator.annotations.StringLengthFieldValidator;
import it.infn.ct.security.utilities.LDAPUser;
import it.infn.ct.security.utilities.LDAPUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

/**
 *
 * @author Marco Fargetta <marco.fargetta@ct.infn.it>
 */
public class PassReset extends ActionSupport{
    private Log _log= LogFactory.getLog(PassReset.class);

    private String code;
    private String password;
    private String password2;

    public String getCode() {
        return code;
    }

    @RequiredFieldValidator(message = "Please enter the code")
    public void setCode(String code) {
        this.code = code;
    }

    public String getPassword() {
        return password;
    }

    @StringLengthFieldValidator(message = "Minimum password lenght is 8 characters", minLength = "8")
    public void setPassword(String password) {
        this.password = password;
    }

    public String getPassword2() {
        return password2;
    }

    public void setPassword2(String password2) {
        this.password2 = password2;
    }

    @Override
    public void validate() {
        if(!code.equals((String) ActionContext.getContext().getSession().get("passResetCode"))){
            addFieldError("code", "The code is not correct");
        }

        if(!password.equals(password2)){
            addFieldError("password", "Passwords do not match");
        }
    }

    @Override
    public String execute() throws Exception {
        LDAPUser user= (LDAPUser) ActionContext.getContext().getSession().get("user");
        if(LDAPUtils.resetPassword(user.getUsername(), password)){
            return SUCCESS;
        }
        else{
            return ERROR;
        }

    }

}


text:
from django.conf.urls import url
from django.views.generic import TemplateView

import views

urlpatterns = [  # pylint:disable=invalid-name
    url(r'^content/display$', TemplateView.as_view(template_name="main/display.html")),
    url(r'^content/kitchen$', TemplateView.as_view(template_name='main/kitchen.html')),
    url(r'^content/door$', TemplateView.as_view(template_name='main/door.html')),
    url(r'^content/computer$', TemplateView.as_view(template_name='main/computer.html')),

    url(r'^content/wrapped/(?P<view>([a-zA-Z0-9-_]+))$',
        views.Wrapped.as_view()),
]


text:
'use strict';

var $ = require('jquery');
var $osf = require('js/osfHelpers');

var ComponentActions = {};

ComponentActions.deleteNode = function(childExists, nodeType, isPreprint, nodeApiUrl) {

    if(childExists){
        $osf.growl(
            'Error',
            'Any child components must be deleted prior to deleting this component.',
            'danger',
            30000
        );
    } else {

        var preprint_message = '
This ' + nodeType + ' contains a preprint. Deleting this ' +
        nodeType + ' will also delete your preprint. This action is irreversible.
';

        // It's possible that the XHR request for contributors has not finished before getting to this
        // point; only construct the HTML for the list of contributors if the contribs list is populated
        var message = '
It will no longer be available to other contributors on the project.' +
        (isPreprint ? preprint_message : '');

        $osf.confirmDangerousAction({
            title: 'Are you sure you want to delete this ' + nodeType + '?',
            message: message,
            callback: function () {
                var request = $.ajax({
                    type: 'DELETE',
                    dataType: 'json',
                    url: nodeApiUrl
                });
                request.done(function(response) {
                    // Redirect to either the parent project or the dashboard
                    window.location.href = response.url;
                });
                request.fail($osf.handleJSONError);
            },
            buttons: {
                success: {
                    label: 'Delete'
                }
            }
        });
    }
};

window.ComponentActions = ComponentActions;
module.exports = ComponentActions;


text:
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;

[assembly: AssemblyTitle("CsvLINQPadDriverTest")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyProduct("CsvLINQPadDriverTest")]
[assembly: AssemblyCompany("Martin Dobroucký (dobrou@gmail.com)")]
[assembly: AssemblyCopyright("Copyright © Martin Dobroucký 2013-2014")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

[assembly: ComVisible(false)]

[assembly: Guid("4ab6058f-ae41-46f0-b5dd-cd0d03f6a2b3")]

[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]


text:
({
	'bold': 'Gras',
	'copy': 'Copier',
	'cut': 'Couper',
	'delete': 'Supprimer',
	'indent': 'Retrait',
	'insertHorizontalRule': 'Règle horizontale',
	'insertOrderedList': 'Liste numérotée',
	'insertUnorderedList': 'Liste à puces',
	'italic': 'Italique',
	'justifyCenter': 'Aligner au centre',
	'justifyFull': 'Justifier',
	'justifyLeft': 'Aligner à gauche',
	'justifyRight': 'Aligner à droite',
	'outdent': 'Retrait négatif',
	'paste': 'Coller',
	'redo': 'Rétablir',
	'removeFormat': 'Supprimer la mise en forme',
	'selectAll': 'Sélectionner tout',
	'strikethrough': 'Barrer',
	'subscript': 'Indice',
	'superscript': 'Exposant',
	'underline': 'Souligner',
	'undo': 'Annuler',
	'unlink': 'Supprimer le lien',
	'createLink': 'Créer un lien',
	'toggleDir': 'Changer de sens',
	'insertImage': 'Insérer une image',
	'insertTable': 'Insérer/Modifier un tableau',
	'toggleTableBorder': 'Afficher/Masquer la bordure du tableau',
	'deleteTable': 'Supprimer le tableau',
	'tableProp': 'Propriété du tableau',
	'htmlToggle': 'Source HTML',
	'foreColor': 'Couleur d\'avant-plan',
	'hiliteColor': 'Couleur d\'arrière-plan',
	'plainFormatBlock': 'Style de paragraphe',
	'formatBlock': 'Style de paragraphe',
	'fontSize': 'Taille de police',
	'fontName': 'Nom de police',
	'tabIndent': 'Retrait de tabulation',
	"fullScreen": "Basculer en plein écran",
	"viewSource": "Afficher la source HTML",
	"print": "Imprimer",
	"newPage": "Nouvelle page",
	/* Error messages */
	'systemShortcut': 'L\'action "${0}" est disponible dans votre navigateur uniquement, par le biais d\'un raccourci-clavier. Utilisez ${1}.'
})


text:
package com.hp.application.automation.tools.octane.client;

import com.google.inject.Inject;
import com.hp.application.automation.tools.octane.configuration.ConfigurationListener;
import com.hp.application.automation.tools.octane.configuration.ServerConfiguration;
import hudson.Extension;
import hudson.util.TimeUnit2;

@Extension
public class RetryModel implements ConfigurationListener {

    private static final long[] QUIET_PERIOD = { // TODO: janotav: verify against our Saas policy
            TimeUnit2.MINUTES.toMillis(1),
            TimeUnit2.MINUTES.toMillis(10),
            TimeUnit2.MINUTES.toMillis(60)
    };

    private long boundary;
    private int periodIndex;

    private TimeProvider timeProvider = new SystemTimeProvider();
    private EventPublisher eventPublisher;

    @Inject
    public RetryModel() {
        doSuccess();
    }

    public RetryModel(EventPublisher eventPublisher) {
        this();
        this.eventPublisher = eventPublisher;
    }

    public synchronized boolean isQuietPeriod() {
        return timeProvider.getTime() < boundary;
    }

    public synchronized void failure() {
        if (periodIndex < QUIET_PERIOD.length - 1) {
            periodIndex++;
        }
        boundary = timeProvider.getTime() + QUIET_PERIOD[periodIndex];
    }

    public void success() {
        doSuccess();
        eventPublisher.resume();
    }

    private synchronized void doSuccess() {
        periodIndex = -1;
        boundary = 0;
    }

    @Override
    public void onChanged(ServerConfiguration conf, ServerConfiguration oldConf) {
        doSuccess();
    }

    @Inject
    public void setEventPublisher(JenkinsInsightEventPublisher eventPublisher) {
        this.eventPublisher = eventPublisher;
    }

    void setTimeProvider(TimeProvider timeProvider) {
        this.timeProvider = timeProvider;
    }

    private static class SystemTimeProvider implements TimeProvider {

        @Override
        public long getTime() {
            return System.currentTimeMillis();
        }
    }

    interface TimeProvider {

        long getTime();

    }

}


text:
package org.apache.accumulo.shell.format;

import static java.nio.charset.StandardCharsets.UTF_8;
import static org.easymock.EasyMock.anyObject;
import static org.easymock.EasyMock.createMock;
import static org.easymock.EasyMock.createNiceMock;
import static org.easymock.EasyMock.expect;
import static org.easymock.EasyMock.expectLastCall;
import static org.easymock.EasyMock.replay;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;

import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Collections;
import java.util.Map;
import java.util.TreeMap;

import org.apache.accumulo.core.client.BatchWriter;
import org.apache.accumulo.core.client.MutationsRejectedException;
import org.apache.accumulo.core.data.Key;
import org.apache.accumulo.core.data.Mutation;
import org.apache.accumulo.core.data.Value;
import org.apache.accumulo.core.util.format.FormatterConfig;
import org.apache.accumulo.shell.Shell;
import org.jline.reader.LineReader;
import org.jline.reader.LineReaderBuilder;
import org.jline.terminal.Size;
import org.jline.terminal.Terminal;
import org.jline.terminal.impl.DumbTerminal;
import org.junit.Before;
import org.junit.Test;

public class DeleterFormatterTest {
  DeleterFormatter formatter;
  Map<Key,Value> data;
  BatchWriter writer;
  BatchWriter exceptionWriter;
  Shell shellState;
  LineReader reader;
  Terminal terminal;
  PrintWriter pw;

  ByteArrayOutputStream baos;

  SettableInputStream input;

  class SettableInputStream extends InputStream {
    ByteArrayInputStream bais;

    @Override
    public int read() throws IOException {
      return bais.read();
    }

    public void set(String in) {
      bais = new ByteArrayInputStream(in.getBytes(UTF_8));
    }
  }

  @Before
  public void setUp() throws IOException, MutationsRejectedException {
    input = new SettableInputStream();
    baos = new ByteArrayOutputStream();

    MutationsRejectedException mre = createMock(MutationsRejectedException.class);

    writer = createNiceMock(BatchWriter.class);
    exceptionWriter = createNiceMock(BatchWriter.class);
    exceptionWriter.close();
    expectLastCall().andThrow(mre);
    exceptionWriter.addMutation(anyObject(Mutation.class));
    expectLastCall().andThrow(mre);

    shellState = createNiceMock(Shell.class);

    terminal = new DumbTerminal(input, baos);
    terminal.setSize(new Size(80, 24));
    reader = LineReaderBuilder.builder().terminal(terminal).build();
    pw = terminal.writer();

    expect(shellState.getReader()).andReturn(reader).anyTimes();
    expect(shellState.getWriter()).andReturn(pw).anyTimes();

    replay(writer, exceptionWriter, shellState);

    data = new TreeMap<>();
    data.put(new Key("r", "cf", "cq"), new Value("value"));
  }

  @Test
  public void testEmpty() {
    formatter = new DeleterFormatter(writer, Collections.<Key,Value>emptyMap().entrySet(),
        new FormatterConfig().setPrintTimestamps(true), shellState, true);
    assertFalse(formatter.hasNext());
  }

  @Test
  public void testSingle() throws IOException {
    formatter = new DeleterFormatter(writer, data.entrySet(),
        new FormatterConfig().setPrintTimestamps(true), shellState, true);

    assertTrue(formatter.hasNext());
    assertNull(formatter.next());

    verify("[DELETED]", " r ", "cf", "cq", "value");
  }

  @Test
  public void testNo() throws IOException {
    input.set("no\n");
    data.put(new Key("z"), new Value("v2"));
    formatter = new DeleterFormatter(writer, data.entrySet(),
        new FormatterConfig().setPrintTimestamps(true), shellState, false);

    assertTrue(formatter.hasNext());
    assertNull(formatter.next());

    verify("[SKIPPED]", " r ", "cf", "cq", "value");

    assertTrue(formatter.hasNext());
  }

  @Test
  public void testNoConfirmation() throws IOException {
    input.set("");
    data.put(new Key("z"), new Value("v2"));
    formatter = new DeleterFormatter(writer, data.entrySet(),
        new FormatterConfig().setPrintTimestamps(true), shellState, false);

    assertTrue(formatter.hasNext());
    assertNull(formatter.next());

    verify("[SKIPPED]", " r ", "cf", "cq", "value");

    assertFalse(formatter.hasNext());
  }

  @Test
  public void testYes() throws IOException {
    input.set("y\nyes\n");
    data.put(new Key("z"), new Value("v2"));
    formatter = new DeleterFormatter(writer, data.entrySet(),
        new FormatterConfig().setPrintTimestamps(true), shellState, false);

    assertTrue(formatter.hasNext());
    assertNull(formatter.next());
    verify("[DELETED]", " r ", "cf", "cq", "value");

    assertTrue(formatter.hasNext());
    assertNull(formatter.next());
    verify("[DELETED]", " z ", "v2");
  }

  @Test
  public void testMutationException() {
    formatter = new DeleterFormatter(exceptionWriter, data.entrySet(),
        new FormatterConfig().setPrintTimestamps(true), shellState, true);

    assertTrue(formatter.hasNext());
    assertNull(formatter.next());
    assertFalse(formatter.hasNext());
  }

  private void verify(String... chunks) throws IOException {
    reader.getTerminal().writer().flush();

    String output = baos.toString();
    for (String chunk : chunks) {
      assertTrue(output.contains(chunk));
    }
  }
}


text:
<?php

namespace Symfony\Component\Form\Tests\Extension\Core\DataTransformer;

use PHPUnit\Framework\TestCase;
use Symfony\Component\Form\Exception\TransformationFailedException;
use Symfony\Component\Form\Extension\Core\DataTransformer\IntegerToLocalizedStringTransformer;
use Symfony\Component\Intl\Util\IntlTestHelper;

class IntegerToLocalizedStringTransformerTest extends TestCase
{
    private $defaultLocale;

    protected function setUp(): void
    {
        $this->defaultLocale = \Locale::getDefault();
        \Locale::setDefault('en');
    }

    protected function tearDown(): void
    {
        \Locale::setDefault($this->defaultLocale);
    }

    public function transformWithRoundingProvider()
    {
        return [
            // towards positive infinity (1.6 -> 2, -1.6 -> -1)
            [1234.5, '1235', \NumberFormatter::ROUND_CEILING],
            [1234.4, '1235', \NumberFormatter::ROUND_CEILING],
            [-1234.5, '-1234', \NumberFormatter::ROUND_CEILING],
            [-1234.4, '-1234', \NumberFormatter::ROUND_CEILING],
            // towards negative infinity (1.6 -> 1, -1.6 -> -2)
            [1234.5, '1234', \NumberFormatter::ROUND_FLOOR],
            [1234.4, '1234', \NumberFormatter::ROUND_FLOOR],
            [-1234.5, '-1235', \NumberFormatter::ROUND_FLOOR],
            [-1234.4, '-1235', \NumberFormatter::ROUND_FLOOR],
            // away from zero (1.6 -> 2, -1.6 -> 2)
            [1234.5, '1235', \NumberFormatter::ROUND_UP],
            [1234.4, '1235', \NumberFormatter::ROUND_UP],
            [-1234.5, '-1235', \NumberFormatter::ROUND_UP],
            [-1234.4, '-1235', \NumberFormatter::ROUND_UP],
            // towards zero (1.6 -> 1, -1.6 -> -1)
            [1234.5, '1234', \NumberFormatter::ROUND_DOWN],
            [1234.4, '1234', \NumberFormatter::ROUND_DOWN],
            [-1234.5, '-1234', \NumberFormatter::ROUND_DOWN],
            [-1234.4, '-1234', \NumberFormatter::ROUND_DOWN],
            // round halves (.5) to the next even number
            [1234.6, '1235', \NumberFormatter::ROUND_HALFEVEN],
            [1234.5, '1234', \NumberFormatter::ROUND_HALFEVEN],
            [1234.4, '1234', \NumberFormatter::ROUND_HALFEVEN],
            [1233.5, '1234', \NumberFormatter::ROUND_HALFEVEN],
            [1232.5, '1232', \NumberFormatter::ROUND_HALFEVEN],
            [-1234.6, '-1235', \NumberFormatter::ROUND_HALFEVEN],
            [-1234.5, '-1234', \NumberFormatter::ROUND_HALFEVEN],
            [-1234.4, '-1234', \NumberFormatter::ROUND_HALFEVEN],
            [-1233.5, '-1234', \NumberFormatter::ROUND_HALFEVEN],
            [-1232.5, '-1232', \NumberFormatter::ROUND_HALFEVEN],
            // round halves (.5) away from zero
            [1234.6, '1235', \NumberFormatter::ROUND_HALFUP],
            [1234.5, '1235', \NumberFormatter::ROUND_HALFUP],
            [1234.4, '1234', \NumberFormatter::ROUND_HALFUP],
            [-1234.6, '-1235', \NumberFormatter::ROUND_HALFUP],
            [-1234.5, '-1235', \NumberFormatter::ROUND_HALFUP],
            [-1234.4, '-1234', \NumberFormatter::ROUND_HALFUP],
            // round halves (.5) towards zero
            [1234.6, '1235', \NumberFormatter::ROUND_HALFDOWN],
            [1234.5, '1234', \NumberFormatter::ROUND_HALFDOWN],
            [1234.4, '1234', \NumberFormatter::ROUND_HALFDOWN],
            [-1234.6, '-1235', \NumberFormatter::ROUND_HALFDOWN],
            [-1234.5, '-1234', \NumberFormatter::ROUND_HALFDOWN],
            [-1234.4, '-1234', \NumberFormatter::ROUND_HALFDOWN],
        ];
    }

    /**
     * @dataProvider transformWithRoundingProvider
     */
    public function testTransformWithRounding($input, $output, $roundingMode)
    {
        $transformer = new IntegerToLocalizedStringTransformer(null, $roundingMode);

        $this->assertEquals($output, $transformer->transform($input));
    }

    public function testReverseTransform()
    {
        // Since we test against "de_AT", we need the full implementation
        IntlTestHelper::requireFullIntl($this, false);

        \Locale::setDefault('de_AT');

        $transformer = new IntegerToLocalizedStringTransformer();

        $this->assertEquals(1, $transformer->reverseTransform('1'));
        $this->assertEquals(12345, $transformer->reverseTransform('12345'));
    }

    public function testReverseTransformEmpty()
    {
        $transformer = new IntegerToLocalizedStringTransformer();

        $this->assertNull($transformer->reverseTransform(''));
    }

    public function testReverseTransformWithGrouping()
    {
        // Since we test against "de_DE", we need the full implementation
        IntlTestHelper::requireFullIntl($this, false);

        \Locale::setDefault('de_DE');

        $transformer = new IntegerToLocalizedStringTransformer(true);

        $this->assertEquals(1234, $transformer->reverseTransform('1.234'));
        $this->assertEquals(12345, $transformer->reverseTransform('12.345'));
        $this->assertEquals(1234, $transformer->reverseTransform('1234'));
        $this->assertEquals(12345, $transformer->reverseTransform('12345'));
    }

    public function reverseTransformWithRoundingProvider()
    {
        return [
            // towards positive infinity (1.6 -> 2, -1.6 -> -1)
            ['1234,5', 1235, \NumberFormatter::ROUND_CEILING],
            ['1234,4', 1235, \NumberFormatter::ROUND_CEILING],
            ['-1234,5', -1234, \NumberFormatter::ROUND_CEILING],
            ['-1234,4', -1234, \NumberFormatter::ROUND_CEILING],
            // towards negative infinity (1.6 -> 1, -1.6 -> -2)
            ['1234,5', 1234, \NumberFormatter::ROUND_FLOOR],
            ['1234,4', 1234, \NumberFormatter::ROUND_FLOOR],
            ['-1234,5', -1235, \NumberFormatter::ROUND_FLOOR],
            ['-1234,4', -1235, \NumberFormatter::ROUND_FLOOR],
            // away from zero (1.6 -> 2, -1.6 -> 2)
            ['1234,5', 1235, \NumberFormatter::ROUND_UP],
            ['1234,4', 1235, \NumberFormatter::ROUND_UP],
            ['-1234,5', -1235, \NumberFormatter::ROUND_UP],
            ['-1234,4', -1235, \NumberFormatter::ROUND_UP],
            // towards zero (1.6 -> 1, -1.6 -> -1)
            ['1234,5', 1234, \NumberFormatter::ROUND_DOWN],
            ['1234,4', 1234, \NumberFormatter::ROUND_DOWN],
            ['-1234,5', -1234, \NumberFormatter::ROUND_DOWN],
            ['-1234,4', -1234, \NumberFormatter::ROUND_DOWN],
            // round halves (.5) to the next even number
            ['1234,6', 1235, \NumberFormatter::ROUND_HALFEVEN],
            ['1234,5', 1234, \NumberFormatter::ROUND_HALFEVEN],
            ['1234,4', 1234, \NumberFormatter::ROUND_HALFEVEN],
            ['1233,5', 1234, \NumberFormatter::ROUND_HALFEVEN],
            ['1232,5', 1232, \NumberFormatter::ROUND_HALFEVEN],
            ['-1234,6', -1235, \NumberFormatter::ROUND_HALFEVEN],
            ['-1234,5', -1234, \NumberFormatter::ROUND_HALFEVEN],
            ['-1234,4', -1234, \NumberFormatter::ROUND_HALFEVEN],
            ['-1233,5', -1234, \NumberFormatter::ROUND_HALFEVEN],
            ['-1232,5', -1232, \NumberFormatter::ROUND_HALFEVEN],
            // round halves (.5) away from zero
            ['1234,6', 1235, \NumberFormatter::ROUND_HALFUP],
            ['1234,5', 1235, \NumberFormatter::ROUND_HALFUP],
            ['1234,4', 1234, \NumberFormatter::ROUND_HALFUP],
            ['-1234,6', -1235, \NumberFormatter::ROUND_HALFUP],
            ['-1234,5', -1235, \NumberFormatter::ROUND_HALFUP],
            ['-1234,4', -1234, \NumberFormatter::ROUND_HALFUP],
            // round halves (.5) towards zero
            ['1234,6', 1235, \NumberFormatter::ROUND_HALFDOWN],
            ['1234,5', 1234, \NumberFormatter::ROUND_HALFDOWN],
            ['1234,4', 1234, \NumberFormatter::ROUND_HALFDOWN],
            ['-1234,6', -1235, \NumberFormatter::ROUND_HALFDOWN],
            ['-1234,5', -1234, \NumberFormatter::ROUND_HALFDOWN],
            ['-1234,4', -1234, \NumberFormatter::ROUND_HALFDOWN],
        ];
    }

    /**
     * @dataProvider reverseTransformWithRoundingProvider
     */
    public function testReverseTransformWithRounding($input, $output, $roundingMode)
    {
        $transformer = new IntegerToLocalizedStringTransformer(null, $roundingMode);

        $this->assertEquals($output, $transformer->reverseTransform($input));
    }

    public function testReverseTransformExpectsString()
    {
        $this->expectException(TransformationFailedException::class);
        $transformer = new IntegerToLocalizedStringTransformer();

        $transformer->reverseTransform(1);
    }

    public function testReverseTransformExpectsValidNumber()
    {
        $this->expectException(TransformationFailedException::class);
        $transformer = new IntegerToLocalizedStringTransformer();

        $transformer->reverseTransform('foo');
    }

    /**
     * @dataProvider floatNumberProvider
     */
    public function testReverseTransformExpectsInteger($number, $locale)
    {
        $this->expectException(TransformationFailedException::class);
        IntlTestHelper::requireFullIntl($this, false);

        \Locale::setDefault($locale);

        $transformer = new IntegerToLocalizedStringTransformer();

        $transformer->reverseTransform($number);
    }

    public function floatNumberProvider()
    {
        return [
            ['12345.912', 'en'],
            ['1.234,5', 'de_DE'],
        ];
    }

    public function testReverseTransformDisallowsNaN()
    {
        $this->expectException(TransformationFailedException::class);
        $transformer = new IntegerToLocalizedStringTransformer();

        $transformer->reverseTransform('NaN');
    }

    public function testReverseTransformDisallowsNaN2()
    {
        $this->expectException(TransformationFailedException::class);
        $transformer = new IntegerToLocalizedStringTransformer();

        $transformer->reverseTransform('nan');
    }

    public function testReverseTransformDisallowsInfinity()
    {
        $this->expectException(TransformationFailedException::class);
        $transformer = new IntegerToLocalizedStringTransformer();

        $transformer->reverseTransform('∞');
    }

    public function testReverseTransformDisallowsNegativeInfinity()
    {
        $this->expectException(TransformationFailedException::class);
        $transformer = new IntegerToLocalizedStringTransformer();

        $transformer->reverseTransform('-∞');
    }
}