text:
/**
 * @author Mat Groves http://matgroves.com/ @Doormat23
 */

/**
 * Creates a Canvas element of the given size.
 *
 * @class CanvasBuffer
 * @constructor
 * @param width {Number} the width for the newly created canvas
 * @param height {Number} the height for the newly created canvas
 */
PIXI.CanvasBuffer = function(width, height)
{
    /**
     * The width of the Canvas in pixels.
     *
     * @property width
     * @type Number
     */
    this.width = width;

    /**
     * The height of the Canvas in pixels.
     *
     * @property height
     * @type Number
     */
    this.height = height;

    /**
     * The Canvas object that belongs to this CanvasBuffer.
     *
     * @property canvas
     * @type HTMLCanvasElement
     */
    this.canvas = PIXI.CanvasPool.create(this, this.width, this.height);

    /**
     * A CanvasRenderingContext2D object representing a two-dimensional rendering context.
     *
     * @property context
     * @type CanvasRenderingContext2D
     */
    this.context = this.canvas.getContext("2d");

    this.canvas.width = width;
    this.canvas.height = height;
};

PIXI.CanvasBuffer.prototype.constructor = PIXI.CanvasBuffer;

/**
 * Clears the canvas that was created by the CanvasBuffer class.
 *
 * @method clear
 * @private
 */
PIXI.CanvasBuffer.prototype.clear = function()
{
    this.context.setTransform(1, 0, 0, 1, 0, 0);
    this.context.clearRect(0,0, this.width, this.height);
};

/**
 * Resizes the canvas to the specified width and height.
 *
 * @method resize
 * @param width {Number} the new width of the canvas
 * @param height {Number} the new height of the canvas
 */
PIXI.CanvasBuffer.prototype.resize = function(width, height)
{
    this.width = this.canvas.width = width;
    this.height = this.canvas.height = height;
};

/**
 * Frees the canvas up for use again.
 *
 * @method destroy
 */
PIXI.CanvasBuffer.prototype.destroy = function()
{
    PIXI.CanvasPool.remove(this);
};


text:
<!DOCTYPE html>

    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="renderer" content="webkit">
    <meta name="viewport" content="width=device-width, initial-scale=1">

recently

recommander

favor

download

Search

redpajama_set_name: RedPajamaGithub


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

namespace Dependator.CommandLine
{
    public class EmptyVerb : BaseOptions
    {
        public override void Run()
        {
            /* does npothing */
        }
    }
}


text:
package pro.consultit.userside.api.items;

import com.fasterxml.jackson.annotation.JsonProperty;

public class InventoryCatalogItem {
	@JsonProperty("id")
	int id;
	@JsonProperty("name")
	String name;
	@JsonProperty("inventory_section_catalog_id")
	int inventorySectionCatalog;

	protected InventoryCatalogItem() {
	}

	public InventoryCatalogItem(int id, String name, int inventorySectionCatalog) {
		this.id = id;
		this.name = name;
		this.inventorySectionCatalog = inventorySectionCatalog;
	}

	public int getId() {
		return id;
	}

	public InventoryCatalogItem setId(int id) {
		this.id = id;
		return this;
	}

	public String getName() {
		return name;
	}

	public InventoryCatalogItem setName(String name) {
		this.name = name;
		return this;
	}

	public int getInventorySectionCatalog() {
		return inventorySectionCatalog;
	}

	public InventoryCatalogItem setInventorySectionCatalog(int inventorySectionCatalog) {
		this.inventorySectionCatalog = inventorySectionCatalog;
		return this;
	}
}


text:
layout: post
title: Ruby on Rails problems & solutions - Dec 17, 2010
categories:
- web development
tags: []
status: publish
published: true
meta: {}
---

send_file and Zero byte files

[http://stackoverflow.com/questions/3724853/rails-sends-0-byte-files-using-send-file](http://stackoverflow.com/questions/3724853/rails-sends-0-byte-files-using-send-file)

Turns out, a default behaviour changed in Rails 3, with
:x_sendfile now defaulting to true.  This will give you zero byte file downloads in production with send_file.  :-p  So, remember to configure mod_xsendfile on your Apache, or specify
:x_sendfile as false (not recommended) or use send_data.

Handy Snippet - one liner to dump data to a file

[http://snippets.dzone.com/posts/show/5051](http://snippets.dzone.com/posts/show/5051)

Note.  Don't try to dump a set of ActiveRecords with to_yaml this way.  Doesn't quite work, but I recommend you use
rails console and try it, just to see why.  It'll be educational.

Dump ActiveRecords to YAML

This is what you need, to dump some ActiveRecords to YAML, assuming you want to do something like what I did, and get some quick and easy fixtures to use in your tests/specs:

[http://snipplr.com/view.php?codeview&id=5970](http://snipplr.com/view.php?codeview&id=5970)

Sorry I didn't have much this week.  We delivered a production release on one project, then spent time nailing down requirement details for the next sprint's stories.  On my Rails 2.x project, I was mostly trawling the warehouse database for new data, and updating the database we use for development, to mimic the warehouse.


text:
namespace arrow {
namespace io {

#define CHECK_FAILURE(RETURN_VALUE, WHAT)  \
  do {                                     \
    if (RETURN_VALUE == -1) {              \
      std::stringstream ss;                \
      ss << "HDFS: " << WHAT << " failed"; \
      return Status::IOError(ss.str());    \
    }                                      \
  } while (0)

static Status CheckReadResult(int ret) {
  // Check for error on -1 (possibly errno set)

  // ret == 0 at end of file, which is OK
  if (ret == -1) {
    // EOF
    std::stringstream ss;
    ss << "HDFS read failed, errno: " << errno;
    return Status::IOError(ss.str());
  }
  return Status::OK();
}

static constexpr int kDefaultHdfsBufferSize = 1 << 16;

// ----------------------------------------------------------------------
// File reading

class HdfsAnyFileImpl {
 public:
  void set_members(
      const std::string& path, LibHdfsShim* driver, hdfsFS fs, hdfsFile handle) {
    path_ = path;
    driver_ = driver;
    fs_ = fs;
    file_ = handle;
    is_open_ = true;
  }

  Status Seek(int64_t position) {
    int ret = driver_->Seek(fs_, file_, position);
    CHECK_FAILURE(ret, "seek");
    return Status::OK();
  }

  Status Tell(int64_t* offset) {
    int64_t ret = driver_->Tell(fs_, file_);
    CHECK_FAILURE(ret, "tell");
    *offset = ret;
    return Status::OK();
  }

  bool is_open() const { return is_open_; }

 protected:
  std::string path_;

  LibHdfsShim* driver_;

  // These are pointers in libhdfs, so OK to copy
  hdfsFS fs_;
  hdfsFile file_;

  bool is_open_;
};

// Private implementation for read-only files
class HdfsReadableFile::HdfsReadableFileImpl : public HdfsAnyFileImpl {
 public:
  explicit HdfsReadableFileImpl(MemoryPool* pool) : pool_(pool) {}

  Status Close() {
    if (is_open_) {
      int ret = driver_->CloseFile(fs_, file_);
      CHECK_FAILURE(ret, "CloseFile");
      is_open_ = false;
    }
    return Status::OK();
  }

  Status ReadAt(int64_t position, int64_t nbytes, int64_t* bytes_read, uint8_t* buffer) {
    tSize ret;
    if (driver_->HasPread()) {
      ret = driver_->Pread(fs_, file_, static_cast<tOffset>(position),
          reinterpret_cast<void*>(buffer), static_cast<tSize>(nbytes));
    } else {
      RETURN_NOT_OK(Seek(position));
      return Read(nbytes, bytes_read, buffer);
    }
    RETURN_NOT_OK(CheckReadResult(ret));
    *bytes_read = ret;
    return Status::OK();
  }

  Status ReadAt(int64_t position, int64_t nbytes, std::shared_ptr<Buffer>* out) {
    std::shared_ptr<ResizableBuffer> buffer;
    RETURN_NOT_OK(AllocateResizableBuffer(pool_, nbytes, &buffer));

    int64_t bytes_read = 0;
    RETURN_NOT_OK(ReadAt(position, nbytes, &bytes_read, buffer->mutable_data()));

    if (bytes_read < nbytes) { RETURN_NOT_OK(buffer->Resize(bytes_read)); }

    *out = buffer;
    return Status::OK();
  }

  Status Read(int64_t nbytes, int64_t* bytes_read, uint8_t* buffer) {
    int64_t total_bytes = 0;
    while (total_bytes < nbytes) {
      tSize ret = driver_->Read(fs_, file_, reinterpret_cast<void*>(buffer + total_bytes),
          static_cast<tSize>(std::min<int64_t>(buffer_size_, nbytes - total_bytes)));
      RETURN_NOT_OK(CheckReadResult(ret));
      total_bytes += ret;
      if (ret == 0) { break; }
    }

    *bytes_read = total_bytes;
    return Status::OK();
  }

  Status Read(int64_t nbytes, std::shared_ptr<Buffer>* out) {
    std::shared_ptr<ResizableBuffer> buffer;
    RETURN_NOT_OK(AllocateResizableBuffer(pool_, nbytes, &buffer));

    int64_t bytes_read = 0;
    RETURN_NOT_OK(Read(nbytes, &bytes_read, buffer->mutable_data()));
    if (bytes_read < nbytes) { RETURN_NOT_OK(buffer->Resize(bytes_read)); }

    *out = buffer;
    return Status::OK();
  }

  Status GetSize(int64_t* size) {
    hdfsFileInfo* entry = driver_->GetPathInfo(fs_, path_.c_str());
    if (entry == nullptr) { return Status::IOError("HDFS: GetPathInfo failed"); }

    *size = entry->mSize;
    driver_->FreeFileInfo(entry, 1);
    return Status::OK();
  }

  void set_memory_pool(MemoryPool* pool) { pool_ = pool; }

  void set_buffer_size(int32_t buffer_size) { buffer_size_ = buffer_size; }

 private:
  MemoryPool* pool_;
  int32_t buffer_size_;
};

HdfsReadableFile::HdfsReadableFile(MemoryPool* pool) {
  if (pool == nullptr) { pool = default_memory_pool(); }
  impl_.reset(new HdfsReadableFileImpl(pool));
}

HdfsReadableFile::~HdfsReadableFile() {
  impl_->Close();
}

Status HdfsReadableFile::Close() {
  return impl_->Close();
}

Status HdfsReadableFile::ReadAt(
    int64_t position, int64_t nbytes, int64_t* bytes_read, uint8_t* buffer) {
  return impl_->ReadAt(position, nbytes, bytes_read, buffer);
}

Status HdfsReadableFile::ReadAt(
    int64_t position, int64_t nbytes, std::shared_ptr<Buffer>* out) {
  return impl_->ReadAt(position, nbytes, out);
}

bool HdfsReadableFile::supports_zero_copy() const {
  return false;
}

Status HdfsReadableFile::Read(int64_t nbytes, int64_t* bytes_read, uint8_t* buffer) {
  return impl_->Read(nbytes, bytes_read, buffer);
}

Status HdfsReadableFile::Read(int64_t nbytes, std::shared_ptr<Buffer>* buffer) {
  return impl_->Read(nbytes, buffer);
}

Status HdfsReadableFile::GetSize(int64_t* size) {
  return impl_->GetSize(size);
}

Status HdfsReadableFile::Seek(int64_t position) {
  return impl_->Seek(position);
}

Status HdfsReadableFile::Tell(int64_t* position) {
  return impl_->Tell(position);
}

// ----------------------------------------------------------------------
// File writing

// Private implementation for writeable-only files
class HdfsOutputStream::HdfsOutputStreamImpl : public HdfsAnyFileImpl {
 public:
  HdfsOutputStreamImpl() {}

  Status Close() {
    if (is_open_) {
      RETURN_NOT_OK(Flush());
      int ret = driver_->CloseFile(fs_, file_);
      CHECK_FAILURE(ret, "CloseFile");
      is_open_ = false;
    }
    return Status::OK();
  }

  Status Flush() {
    int ret = driver_->Flush(fs_, file_);
    CHECK_FAILURE(ret, "Flush");
    return Status::OK();
  }

  Status Write(const uint8_t* buffer, int64_t nbytes, int64_t* bytes_written) {
    tSize ret = driver_->Write(
        fs_, file_, reinterpret_cast<const void*>(buffer), static_cast<tSize>(nbytes));
    CHECK_FAILURE(ret, "Write");
    *bytes_written = ret;
    return Status::OK();
  }
};

HdfsOutputStream::HdfsOutputStream() {
  impl_.reset(new HdfsOutputStreamImpl());
}

HdfsOutputStream::~HdfsOutputStream() {
  impl_->Close();
}

Status HdfsOutputStream::Close() {
  return impl_->Close();
}

Status HdfsOutputStream::Write(
    const uint8_t* buffer, int64_t nbytes, int64_t* bytes_read) {
  return impl_->Write(buffer, nbytes, bytes_read);
}

Status HdfsOutputStream::Write(const uint8_t* buffer, int64_t nbytes) {
  int64_t bytes_written_dummy = 0;
  return Write(buffer, nbytes, &bytes_written_dummy);
}

Status HdfsOutputStream::Flush() {
  return impl_->Flush();
}

Status HdfsOutputStream::Tell(int64_t* position) {
  return impl_->Tell(position);
}

// ----------------------------------------------------------------------
// HDFS client

// TODO(wesm): this could throw std::bad_alloc in the course of copying strings
// into the path info object
static void SetPathInfo(const hdfsFileInfo* input, HdfsPathInfo* out) {
  out->kind = input->mKind == kObjectKindFile ? ObjectType::FILE : ObjectType::DIRECTORY;
  out->name = std::string(input->mName);
  out->owner = std::string(input->mOwner);
  out->group = std::string(input->mGroup);

  out->last_access_time = static_cast<int32_t>(input->mLastAccess);
  out->last_modified_time = static_cast<int32_t>(input->mLastMod);
  out->size = static_cast<int64_t>(input->mSize);

  out->replication = input->mReplication;
  out->block_size = input->mBlockSize;

  out->permissions = input->mPermissions;
}

// Private implementation
class HdfsClient::HdfsClientImpl {
 public:
  HdfsClientImpl() {}

  Status Connect(const HdfsConnectionConfig* config) {
    if (config->driver == HdfsDriver::LIBHDFS3) {
      RETURN_NOT_OK(ConnectLibHdfs3(&driver_));
    } else {
      RETURN_NOT_OK(ConnectLibHdfs(&driver_));
    }

    // connect to HDFS with the builder object
    hdfsBuilder* builder = driver_->NewBuilder();
    if (!config->host.empty()) {
      driver_->BuilderSetNameNode(builder, config->host.c_str());
    }
    driver_->BuilderSetNameNodePort(builder, static_cast<tPort>(config->port));
    if (!config->user.empty()) {
      driver_->BuilderSetUserName(builder, config->user.c_str());
    }
    if (!config->kerb_ticket.empty()) {
      driver_->BuilderSetKerbTicketCachePath(builder, config->kerb_ticket.c_str());
    }
    fs_ = driver_->BuilderConnect(builder);

    if (fs_ == nullptr) { return Status::IOError("HDFS connection failed"); }
    namenode_host_ = config->host;
    port_ = config->port;
    user_ = config->user;
    kerb_ticket_ = config->kerb_ticket;

    return Status::OK();
  }

  Status CreateDirectory(const std::string& path) {
    int ret = driver_->CreateDirectory(fs_, path.c_str());
    CHECK_FAILURE(ret, "create directory");
    return Status::OK();
  }

  Status Delete(const std::string& path, bool recursive) {
    int ret = driver_->Delete(fs_, path.c_str(), static_cast<int>(recursive));
    CHECK_FAILURE(ret, "delete");
    return Status::OK();
  }

  Status Disconnect() {
    int ret = driver_->Disconnect(fs_);
    CHECK_FAILURE(ret, "hdfsFS::Disconnect");
    return Status::OK();
  }

  bool Exists(const std::string& path) {
    // hdfsExists does not distinguish between RPC failure and the file not
    // existing
    int ret = driver_->Exists(fs_, path.c_str());
    return ret == 0;
  }

  Status GetCapacity(int64_t* nbytes) {
    tOffset ret = driver_->GetCapacity(fs_);
    CHECK_FAILURE(ret, "GetCapacity");
    *nbytes = ret;
    return Status::OK();
  }

  Status GetUsed(int64_t* nbytes) {
    tOffset ret = driver_->GetUsed(fs_);
    CHECK_FAILURE(ret, "GetUsed");
    *nbytes = ret;
    return Status::OK();
  }

  Status GetPathInfo(const std::string& path, HdfsPathInfo* info) {
    hdfsFileInfo* entry = driver_->GetPathInfo(fs_, path.c_str());

    if (entry == nullptr) { return Status::IOError("HDFS: GetPathInfo failed"); }

    SetPathInfo(entry, info);
    driver_->FreeFileInfo(entry, 1);

    return Status::OK();
  }

  Status ListDirectory(const std::string& path, std::vector<HdfsPathInfo>* listing) {
    int num_entries = 0;
    hdfsFileInfo* entries = driver_->ListDirectory(fs_, path.c_str(), &num_entries);

    if (entries == nullptr) {
      // If the directory is empty, entries is NULL but errno is 0. Non-zero
      // errno indicates error
      //
      // Note: errno is thread-locala
      if (errno == 0) { num_entries = 0; }
      { return Status::IOError("HDFS: list directory failed"); }
    }

    // Allocate additional space for elements

    int vec_offset = static_cast<int>(listing->size());
    listing->resize(vec_offset + num_entries);

    for (int i = 0; i < num_entries; ++i) {
      SetPathInfo(entries + i, &(*listing)[vec_offset + i]);
    }

    // Free libhdfs file info
    driver_->FreeFileInfo(entries, num_entries);

    return Status::OK();
  }

  Status OpenReadable(const std::string& path, int32_t buffer_size,
      std::shared_ptr<HdfsReadableFile>* file) {
    hdfsFile handle = driver_->OpenFile(fs_, path.c_str(), O_RDONLY, buffer_size, 0, 0);

    if (handle == nullptr) {
      // TODO(wesm): determine cause of failure
      std::stringstream ss;
      ss << "Unable to open file " << path;
      return Status::IOError(ss.str());
    }

    // std::make_shared does not work with private ctors
    *file = std::shared_ptr<HdfsReadableFile>(new HdfsReadableFile());
    (*file)->impl_->set_members(path, driver_, fs_, handle);
    (*file)->impl_->set_buffer_size(buffer_size);

    return Status::OK();
  }

  Status OpenWriteable(const std::string& path, bool append, int32_t buffer_size,
      int16_t replication, int64_t default_block_size,
      std::shared_ptr<HdfsOutputStream>* file) {
    int flags = O_WRONLY;
    if (append) flags |= O_APPEND;

    hdfsFile handle = driver_->OpenFile(fs_, path.c_str(), flags, buffer_size,
        replication, static_cast<tSize>(default_block_size));

    if (handle == nullptr) {
      // TODO(wesm): determine cause of failure
      std::stringstream ss;
      ss << "Unable to open file " << path;
      return Status::IOError(ss.str());
    }

    // std::make_shared does not work with private ctors
    *file = std::shared_ptr<HdfsOutputStream>(new HdfsOutputStream());
    (*file)->impl_->set_members(path, driver_, fs_, handle);

    return Status::OK();
  }

  Status Rename(const std::string& src, const std::string& dst) {
    int ret = driver_->Rename(fs_, src.c_str(), dst.c_str());
    CHECK_FAILURE(ret, "Rename");
    return Status::OK();
  }

 private:
  LibHdfsShim* driver_;

  std::string namenode_host_;
  std::string user_;
  int port_;
  std::string kerb_ticket_;

  hdfsFS fs_;
};

// ----------------------------------------------------------------------
// Public API for HDFSClient

HdfsClient::HdfsClient() {
  impl_.reset(new HdfsClientImpl());
}

HdfsClient::~HdfsClient() {}

Status HdfsClient::Connect(
    const HdfsConnectionConfig* config, std::shared_ptr<HdfsClient>* fs) {
  // ctor is private, make_shared will not work
  *fs = std::shared_ptr<HdfsClient>(new HdfsClient());

  RETURN_NOT_OK((*fs)->impl_->Connect(config));
  return Status::OK();
}

Status HdfsClient::CreateDirectory(const std::string& path) {
  return impl_->CreateDirectory(path);
}

Status HdfsClient::Delete(const std::string& path, bool recursive) {
  return impl_->Delete(path, recursive);
}

Status HdfsClient::Disconnect() {
  return impl_->Disconnect();
}

bool HdfsClient::Exists(const std::string& path) {
  return impl_->Exists(path);
}

Status HdfsClient::GetPathInfo(const std::string& path, HdfsPathInfo* info) {
  return impl_->GetPathInfo(path, info);
}

Status HdfsClient::GetCapacity(int64_t* nbytes) {
  return impl_->GetCapacity(nbytes);
}

Status HdfsClient::GetUsed(int64_t* nbytes) {
  return impl_->GetUsed(nbytes);
}

Status HdfsClient::ListDirectory(
    const std::string& path, std::vector<HdfsPathInfo>* listing) {
  return impl_->ListDirectory(path, listing);
}

Status HdfsClient::OpenReadable(const std::string& path, int32_t buffer_size,
    std::shared_ptr<HdfsReadableFile>* file) {
  return impl_->OpenReadable(path, buffer_size, file);
}

Status HdfsClient::OpenReadable(
    const std::string& path, std::shared_ptr<HdfsReadableFile>* file) {
  return OpenReadable(path, kDefaultHdfsBufferSize, file);
}

Status HdfsClient::OpenWriteable(const std::string& path, bool append,
    int32_t buffer_size, int16_t replication, int64_t default_block_size,
    std::shared_ptr<HdfsOutputStream>* file) {
  return impl_->OpenWriteable(
      path, append, buffer_size, replication, default_block_size, file);
}

Status HdfsClient::OpenWriteable(
    const std::string& path, bool append, std::shared_ptr<HdfsOutputStream>* file) {
  return OpenWriteable(path, append, 0, 0, 0, file);
}

Status HdfsClient::Rename(const std::string& src, const std::string& dst) {
  return impl_->Rename(src, dst);
}

// ----------------------------------------------------------------------
// Allow public API users to check whether we are set up correctly

Status HaveLibHdfs() {
  LibHdfsShim* driver;
  return ConnectLibHdfs(&driver);
}

Status HaveLibHdfs3() {
  LibHdfsShim* driver;
  return ConnectLibHdfs3(&driver);
}

}  // namespace io
}  // namespace arrow


text:
package callback

import (
	"encoding/xml"
	"io"
	"log"
	"net/http"
)

func DebugPrintRequest(r *http.Request) {
	log.Println("[WECHAT_DEBUG] [CALLBACK]", r.Method, r.RequestURI)
}

func DebugPrintPlainRequestMessage(msg []byte) {
	log.Printf("[WECHAT_DEBUG] [CALLBACK] plain request message:\n%s\n", msg)
}

func XmlMarshalResponseMessage(msg interface{}) ([]byte, error) {
	bs, err := xml.MarshalIndent(msg, "", "    ")
	if err != nil {
		return nil, err
	}
	log.Printf("[WECHAT_DEBUG] [CALLBACK] plain response message:\n%s\n", bs)
	return bs, nil
}

func XmlEncodeResponseMessage(w io.Writer, msg interface{}) error {
	bs, err := xml.MarshalIndent(msg, "", "    ")
	if err != nil {
		return err
	}
	log.Printf("[WECHAT_DEBUG] [CALLBACK] plain response message:\n%s\n", bs)

	_, err = w.Write(bs)
	return err
}


text: /* @providesModule Foo */


text:
package hudson.remoting;

import com.google.common.hash.HashCode;
import com.google.common.hash.Hashing;
import com.google.common.io.Files;
import org.jenkinsci.remoting.util.Charsets;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.TemporaryFolder;

import java.io.ByteArrayInputStream;
import java.io.DataInputStream;
import java.io.File;
import java.nio.charset.Charset;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotEquals;

/**
 * Tests for {@link Checksum}.
 *
 * @author Akshay Dayal
 */
public class ChecksumTest {

    private static final String FILE_CONTENTS1 = "These are the file contents";
    private static final String FILE_CONTENTS2 = "These are some other file contents";

    @Rule public TemporaryFolder tmp = new TemporaryFolder();

    @Test
    public void testForFileAndURL() throws Exception {
        File tmpFile1 = createTmpFile("file1.txt", FILE_CONTENTS1);
        File tmpFile2 = createTmpFile("file2.txt", FILE_CONTENTS2);
        HashCode hash1 = Files.hash(tmpFile1, Hashing.sha256());
        HashCode hash2 = Files.hash(tmpFile2, Hashing.sha256());

        assertEquals(createdExpectedChecksum(hash1), Checksum.forFile(tmpFile1));
        assertEquals(createdExpectedChecksum(hash1), Checksum.forURL(tmpFile1.toURI().toURL()));

        assertEquals(createdExpectedChecksum(hash2), Checksum.forFile(tmpFile2));
        assertEquals(createdExpectedChecksum(hash2), Checksum.forURL(tmpFile2.toURI().toURL()));

        assertNotEquals(Checksum.forFile(tmpFile1), Checksum.forFile(tmpFile2));
    }

    private File createTmpFile(String name, String contents) throws Exception {
        File tmpFile = tmp.newFile(name);
        Files.append(contents, tmpFile, Charsets.UTF_8);
        return tmpFile;
    }

    static Checksum createdExpectedChecksum(HashCode hashCode) throws Exception {
        DataInputStream in = new DataInputStream(new ByteArrayInputStream(hashCode.asBytes()));
        long sum1 = 0;
        long sum2 = 0;
        for (int i = 0; i < hashCode.asBytes().length / 8; i++) {
            long nextLong = in.readLong();
            if (i % 2 == 0) {
                sum1 ^= nextLong;
            }
            else {
                sum2 ^= nextLong;
            }
        }
        return new Checksum(sum1, sum2);
    }
}


text:
package org.ovirt.engine.core.common.action;

import org.ovirt.engine.core.compat.*;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlType;

import java.util.ArrayList;

@XmlAccessorType(XmlAccessType.NONE)
@XmlType(name = "AttachVdsToTagParameters")
public class AttachVdsToTagParameters extends TagsActionParametersBase {
    private static final long serialVersionUID = -6599471346607548452L;
    @XmlElement
    private java.util.ArrayList<Guid> _entitiesId;

    public AttachVdsToTagParameters(Guid tagId, java.util.ArrayList<Guid> entitiesId) {
        super(tagId);
        _entitiesId = entitiesId;
    }

    public java.util.ArrayList<Guid> getEntitiesId() {
        return _entitiesId == null ? new ArrayList<Guid>() : _entitiesId;
    }

    public AttachVdsToTagParameters() {
    }
}


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

namespace App\Astro;

use App\DTO\AstroChannel;
use App\DTO\ChannelEvent;
use App\Services\ContentEventProvider;
use App\Services\ContentProvider;
use GuzzleHttp\Client as GuzzleClient;
use GuzzleHttp\Psr7\Request;

class Client implements ContentProvider, ContentEventProvider
{
    const ASTRO_SERVICE = 'ASTRO';
    /**
     * @var string
     */
    private $endpoint;

    const GET_CHANNELS = '/ams/v3/getChannelList';

    const GET_CHANNEL = '/ams/v3/getEvents';

    /**
     * @var GuzzleClient
     */
    protected $client;

    /**
     * @var RequestBuilder
     */
    protected $requestBuilder;

    /**
     * @var ResponseHandler
     */
    protected $handler;

    /**
     * Client constructor.
     *
     * @param GuzzleClient $client
     * @param string       $endpoint
     */
    public function __construct(GuzzleClient $client, string $endpoint)
    {
        $this->client   = $client;
        $this->endpoint = $endpoint;
    }

    /**
     * @param Request $request
     *
     * @return array
     */
    private function send(Request $request): array
    {
        $response = $this->client->send($request);
        $channels = \GuzzleHttp\json_decode($response->getBody(), true);

        return $channels;
    }

    /**
     * @return AtroChannel[]
     */
    public function getChannels(): array
    {
        $request = new Request('get', sprintf('%s%s', $this->endpoint, static::GET_CHANNELS));

        $channels = $this->send($request);

        $channelObjects = [];
        foreach ($channels['channels'] as $channel) {
            $channel          = new AstroChannel($channel);
            $channelObjects[] = $channel;
        }

        return $channelObjects;
    }

    /**
     * @param int $channelId
     *
     * @return array
     */
    public function getChannelEvents(int $channelId): array
    {
        $start = new \DateTime();

        $end     = new \DateTime('+1day');
        $request = new Request(
            'get',
            sprintf('%s%s', $this->endpoint, static::GET_CHANNEL).'?'.
            http_build_query(
                [
                    'channelId'   => $channelId,
                    'periodStart' => $start->format('Y-m-d 00:00'),
                    'periodEnd'   => $end->format('Y-m-d 23:59'),
                ]
            ),
            []
        );

        $result = $this->send($request);

        $events = [];
        foreach ($result['getevent'] as $event) {
            $events[] = new ChannelEvent($event);
        }

        return $events;
    }

    /**
     * @return string
     */
    public function getServiceName(): string
    {
        return static::ASTRO_SERVICE;
    }
}


text:
/*	$NetBSD: xkbfile-xkbmisc.c,v 1.1 2009/02/03 05:08:39 dbj Exp $	*/

/* This file exists to differentiate between
 * lib/xkbfile/xkbmisc.c and lib/X11/XKBMisc.c
 * which causes objdir conflicts on case-insensitive filesystems
 */

#include <../../../libxkbfile/dist/src/xkbmisc.c>


text:
package child

import (
	"fmt"

	"golang.org/x/sys/unix"
)

func threadCapsetZero() error {
	var (
		hdr  = unix.CapUserHeader{Version: unix.LINUX_CAPABILITY_VERSION_3}
		data = [2]unix.CapUserData{}
	)

	if err := unix.Capset(&hdr, &data[0]); err != nil {
		return fmt.Errorf("clearing all capabilities (capset): %w", err)
	}

	return nil
}


text:
module.exports = selectionDriver;

function selectionDriver(selections$) {
  selections$.observe((node) => node ?
    selectTextInNode(node) : clearSelection()
  );
}

function clearSelection() {
  window.getSelection().removeAllRanges();
}

function selectTextInNode(node) {
  if (document.selection) {
    const range = document.body.createTextRange();
    range.moveToElementText(node);
    range.select();
  } else if (window.getSelection) {
    const range = document.createRange();
    range.selectNodeContents(node);
    window.getSelection().removeAllRanges();
    window.getSelection().addRange(range);
  }
}


text:
angular.module('list',['iWalletService'])

//Template of a list, updated from iWalletService
.directive('list',['iWalletService', function (iWalletService) {
    return {

        template:function(elem,attrs) {
            return '
' +
                '
Amount '+attrs.listType+'
' +
                '
' +
                '
' + "{{amount.value}}" +
                '' +
                '
' + '{{amount.date |' + attrs.listFilter + ' }}' + '
' +
                '
' +
                '
' +
                '
';
        },
        scope : {
            listType : '=listType'
        },
        controller: function($scope,$element, $attrs){

            //Get list type
            if($attrs.listType=="added"){

                //Get the list
                $scope.list=iWalletService.getAddList();

                //Watch update
                $scope.$watchCollection(function(){return iWalletService.getAddList();}, function(newVal,oldVal){
                    $scope.list=newVal;
                });
            }else if($attrs.listType=="removed"){

                //Get the list
                $scope.list=iWalletService.getRemoveList();

                //Watch update
                $scope.$watchCollection(function(){return iWalletService.getRemoveList();}, function(newVal,oldVal){
                    $scope.list=newVal;
                });
            }

        }

    };
}]);


text:
	<meta charset="UTF-8">
	<title>Vertretungsplan heute</title>


text:
README
=========================
[![Build Status](https://secure.travis-ci.org/eriknyk/phpalchemy.png?branch=master)](http://travis-ci.org/eriknyk/phpalchemy)

PHP Alchemy Framework
------------

Phpalchemy is a PHP 5.3 full-stack web framework. It is a lightweight, faster and flexibility framework written in php. It allows you build better and easy to maintain your php applications.

Requirements
------------

Phpalchemy is only supported on PHP 5.3.3 and up.

- Status -
------------
It is under development yet, please wait for the final release 1.0 that is comming soon.


text:
<?php

namespace PHPExiftool\Driver\Tag\Samsung;

use JMS\Serializer\Annotation\ExclusionPolicy;
use PHPExiftool\Driver\AbstractTag;

/**
 * @ExclusionPolicy("all")
 */
class CbCrMatrix extends AbstractTag
{

    protected $Id = 41012;

    protected $Name = 'CbCrMatrix';

    protected $FullName = 'Samsung::Type2';

    protected $GroupName = 'Samsung';

    protected $g0 = 'MakerNotes';

    protected $g1 = 'Samsung';

    protected $g2 = 'Image';

    protected $Type = 'int32s';

    protected $Writable = true;

    protected $Description = 'Cb Cr Matrix';

    protected $flag_Permanent = true;

    protected $MaxLength = 4;

}


text:
<?php
require_once 'PHPUnit/Autoload.php';


text:
// Copyright (c) 2014 hugula
// direct https://github.com/Hugulor/Hugula
//
using UnityEngine;
using System.Collections;

#region 事件行动节点
/// <summary>
/// 事件行动节点
/// 接受到时间通知后才完成
/// </summary>
public class ActionEventNode : ActionNode
{
    /// <summary>
    ///  事件行动节点
    /// </summary>
    /// <param name="action">委托<![CDATA[ System.Action<object, object, ActionNode>]]></param>
    public ActionEventNode(ActionDelegate action)
        : base(action)
    {

    }

    /// <summary>
    ///  事件行动节点
    /// </summary>
    /// <param name="action">委托<![CDATA[ System.Action<object, object, ActionNode>]]></param>
    public ActionEventNode(ActionDelegate action, string name)
        : base(action, name)
    {
    }

    public override void Visit(BTInput input, BTOutput output)
    {
        //Debug.Log(string.Format("ActionEventNode status={0}", status));
        if (status == BehaviourStatus.Ready)
        {
            status = BehaviourStatus.Running;
            output.leafNode = this;
            action(input, output);
        }
    }

    public void OnEvent(Actor actor, object data)
    {
        status = BehaviourStatus.Success;

        if (data is Actor)
        {
            //RoleActor actor = data as RoleActor;
            //actor.brain.RemoveEvent(OnEvent);

            //Debug.Log(string.Format(" {0} {1} Success",this.name ,actor));
        }
    }

    /// <summary>
    /// clone
    /// </summary>
    /// <returns></returns>
    public IBehaviourNode Clone()
    {
        var behaviourNode = new ActionEventNode(this.action);
        base.CopyTo(behaviourNode);
        return behaviourNode;
    }

}

#endregion

#region 事件节点

/// <summary>
/// 某个事件触发,只能有一个子节点
/// </summary>
public class EventNode : CompositeNode
{
    /// <summary>
    /// 事件节点
    /// </summary>
    /// <param name="eventType">事件类型ID</param>
    public EventNode(int eventType, string name)
        : base(name)
    {
        this.eventType = eventType;
        triggered = false;
        isInit = false;
    }

    /// <summary>
    /// 事件节点
    /// </summary>
    /// <param name="eventType">事件类型ID</param>
    public EventNode(int eventType)
        : base()
    {
        this.eventType = eventType;
        triggered = false;
        isInit = false;
    }

    private bool isInit = false;

    public int eventType { private set; get; }
    public bool triggered { private set; get; }
    public object data { private set; get; }

    private void OnEvent(Actor actor, object data)
    {
        if (status == BehaviourStatus.Running && children.Count >= 1)
        {
            children[0].Reset();
        }
        this.data = data;
        //actor.brain.bTree.Reset();
        triggered = true;

        //if (eventType == (int)BrainEventEnum.SkillAttack)
        //Debug.Log(string.Format("trigger EventNode {0} data {1} status ={2} ,actor ={3}  ", this.name + (BrainEventEnum)eventType, data, status, actor));
    }

    public override void Visit(BTInput input, BTOutput output)
    {
        if (status == BehaviourStatus.Ready && !isInit)
        {
            isInit = true;
            //Debug.Log(string.Format("AddEventHandler {0} status ={1} ,actor ={2} ", this.name + (BrainEventEnum)eventType, status, input.actor));
            //input.actor.brain.AddEventHandler(eventType, OnEvent);
        }

        if (status == BehaviourStatus.Ready && triggered)
        {
            triggered = false;
            status = BehaviourStatus.Running;
            //Debug.Log(string.Format("BeginRunning  EventNode {0} data {1} status ={2}", this.name + (BrainEventEnum)eventType, data, status));
        }
        //Debug.Log(string.Format("Visit  EventNode {0} data {1} status ={2} triggered ={3}", this.name + (BrainEventEnum)eventType, data, status, triggered));

        if (status == BehaviourStatus.Running)
        {
            if (children.Count >= 1)
            {
                BTOutput oup = output;
                oup.eventData = data;
                var child = children[0];
                child.Visit(input, output);
                status = child.status;
                oup.eventData = null;
                //if (status != BehaviourStatus.Running)
                //{
                //Debug.Log(string.Format(" EventNode {0} Complete {1} ", this.name, status));
                //MyDebug.StackTrace();
                //}
            }
            else
            {
                status = BehaviourStatus.Failed;
            }
        }
    }

    //public override void Step()
    //{
    //    base.Step();
    //    //triggered = false;
    //}

    //public override void Reset()
    //{
    //    //Debug.Log(string.Format("Reset  EventNode {0} data {1} status ={2} ,triggered ={3}", this.name + (BrainEventEnum)eventType, data, status, triggered));
    //    triggered = false;
    //    base.Reset();
    //}

    /// <summary>
    /// clone
    /// </summary>
    /// <returns></returns>
    public IBehaviourNode Clone()
    {
        var behaviourNode = new EventNode(this.eventType);
        base.CopyToCompositeNode(behaviourNode);
        return behaviourNode;
    }
}

#endregion

#region trigger node

/// <summary>
/// 触发事件
/// </summary>
public class TriggerNode : BehaviourNode
{

    public TriggerNode(int eventType)
        : base()
    {
        this.eventType = eventType;
    }

    public TriggerNode(int eventType, string name)
        : base(name)
    {
        this.eventType = eventType;
    }

    protected int eventType = 0;

    public override void Visit(BTInput input, BTOutput output)
    {
        Actor actor = input.actor;
        object data = output.eventData;

        if (data != null)
        {
            //Debug.Log("触发事件" + actor + "=>" + (BrainEventEnum)eventType + " data= " + data);
            //actor.brain.DispatchEvent(eventType, data);
            status = BehaviourStatus.Success;
        }
        else
        {
            status = BehaviourStatus.Failed;
        }
    }

    /// <summary>
    /// clone
    /// </summary>
    /// <returns></returns>
    public IBehaviourNode Clone()
    {
        var behaviourNode = new TriggerNode(this.eventType);
        base.CopyTo(behaviourNode);
        return behaviourNode;
    }
}

#endregion


text:
@implementation RRJSONDataConverter

- (NSString*) contentType {
    return @"application/json";
}

- (NSObject*) objectFromData:(NSData*)data withError:(NSError**)error {
    return [NSJSONSerialization JSONObjectWithData:data options:0 error:error];
}

- (NSData*) dataFromObject:(NSObject*)object withError:(NSError**)error {
    return [NSJSONSerialization dataWithJSONObject:object options:0 error:error];
}

@end


text:
shared_examples 'a named property' do
  it 'has name' do
    expect(subject.name).to eq :my_property
  end
end

shared_examples 'a valued property' do
  it 'has value' do
    expect(subject.value).to eq value
  end
end


text:
var Backbone = require('backbone');
var Poller = require('../../../../../javascripts/cartodb3/data/background-importer/poller.js');

describe('background-importer/poller', function () {
  var model, originalSync, originalFetch;

  beforeEach(function () {
    var Model = Backbone.Model.extend({
      url: '/hello'
    });
    model = new Model();
    originalSync = model.sync;
    model.sync = function (a, b, opts) {
      opts.success();
    };

    jasmine.clock().install();
    originalFetch = model.fetch;
    spyOn(model, 'fetch').and.callThrough();
  });

  afterEach(function () {
    jasmine.clock().uninstall();
  });

  describe('.start', function () {
    it('should start fetching periodically after the specified number of seconds', function () {
      var poller = new Poller(model, { interval: 100 });
      poller.start();

      expect(model.fetch).not.toHaveBeenCalled();

      jasmine.clock().tick(100);

      expect(model.fetch.calls.count()).toEqual(1);

      jasmine.clock().tick(100);

      expect(model.fetch.calls.count()).toEqual(2);
    });

    it('should not trigger new requests if previous request haven\'t succeeded', function () {
      model.sync = originalSync;

      var poller = new Poller(model, { interval: 100 });
      poller.start();

      jasmine.clock().tick(100);

      expect(model.fetch.calls.count()).toEqual(1);

      // First request has been received
      model.fetch.calls.mostRecent().args[0].success();

      // 2000 more millisecs are gone
      jasmine.clock().tick(2000);

      // Only one more request has been triggered
      expect(model.fetch.calls.count()).toEqual(2);
    });

    it('should not try to poll if already polling', function () {
      var poller = new Poller(model, { interval: 100 });
      poller.start();
      poller.start();

      expect(model.fetch).not.toHaveBeenCalled();

      jasmine.clock().tick(100);

      expect(model.fetch.calls.count()).toEqual(1);
    });

    it('should stop polling when the condition is satisfied', function () {
      // This satisfies the condition
      model.set({ 'something': 'wadus' });

      var poller = new Poller(model, {
        interval: 100,
        stopWhen: function (model) {
          return model.get('something') === 'wadus';
        }
      });

      poller.start();

      expect(model.fetch).not.toHaveBeenCalled();

      jasmine.clock().tick(100);

      // Fetch has been called
      expect(model.fetch.calls.count()).toEqual(1);

      jasmine.clock().tick(100);

      // Fetch was only called the first time (condition was met afterwards)
      expect(model.fetch.calls.count()).toEqual(1);
    });

    it('should invoke the error callback if the request fails', function () {
      model.fetch = originalFetch;
      spyOn(model, 'fetch');

      var errorCallback = jasmine.createSpy('error');

      var poller = new Poller(model, {
        interval: 100,
        error: errorCallback
      });

      poller.start();

      jasmine.clock().tick(100);

      model.fetch.calls.mostRecent().args[0].error();

      expect(errorCallback).toHaveBeenCalledWith(model);
    });
  });

  describe('.stop', function () {
    it('should stop polling', function () {
      var poller = new Poller(model, { interval: 100 });
      poller.start();
      poller.stop();

      expect(model.fetch).not.toHaveBeenCalled();

      jasmine.clock().tick(1000);

      expect(model.fetch).not.toHaveBeenCalled();
    });
  });
});


text:
package org.apache.servicecomb.config.archaius.sources;

import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;

import org.apache.servicecomb.config.YAMLUtil;

import com.netflix.config.PollResult;
import com.netflix.config.PolledConfigurationSource;

public class MicroserviceConfigurationSource implements PolledConfigurationSource {
  private final List<ConfigModel> configModels;

  public MicroserviceConfigurationSource(List<ConfigModel> configModels) {
    this.configModels = configModels;
  }

  public List<ConfigModel> getConfigModels() {
    return configModels;
  }

  public PollResult poll(boolean b, Object o) throws Exception {
    Map<String, Object> configurations = new LinkedHashMap<>();

    for (ConfigModel configModel : configModels) {
      configurations.putAll(YAMLUtil.retrieveItems("", configModel.getConfig()));
    }

    return PollResult.createFull(configurations);
  }
}


text:
//------------------------------------------------------------------------------
// <auto-generated>
//     This code was generated by a tool.
//     Runtime Version:4.0.30319.18408
//
//     Changes to this file may cause incorrect behavior and will be lost if
//     the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------

namespace MetroUiTest.Properties {

    [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
    [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "12.0.0.0")]
    internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {

        private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));

        public static Settings Default {
            get {
                return defaultInstance;
            }
        }

        [global::System.Configuration.UserScopedSettingAttribute()]
        [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
        [global::System.Configuration.DefaultSettingValueAttribute("")]
        [global::System.Configuration.SettingsManageabilityAttribute(global::System.Configuration.SettingsManageability.Roaming)]
        public string TwitterAccessToken {
            get {
                return ((string)(this["TwitterAccessToken"]));
            }
            set {
                this["TwitterAccessToken"] = value;
            }
        }

        [global::System.Configuration.UserScopedSettingAttribute()]
        [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
        [global::System.Configuration.DefaultSettingValueAttribute("")]
        [global::System.Configuration.SettingsManageabilityAttribute(global::System.Configuration.SettingsManageability.Roaming)]
        public string TwitterAccessTokenSecret {
            get {
                return ((string)(this["TwitterAccessTokenSecret"]));
            }
            set {
                this["TwitterAccessTokenSecret"] = value;
            }
        }
    }
}


text:
#include <iostream>

/// Abstract base class
class Matrix {
public:
  virtual int rows() const = 0;
  virtual int columns() const = 0;
  virtual double operator()(int i,int j) const = 0;
  virtual double& operator()(int i,int j) = 0;
  /* ... */
};

// Base class must be declared "virtual in order to allow multiple inheritance from classes derived from the class Matrix.
class SquareMatrix : public virtual Matrix {
public:
  double determinant() const;
  /* ... */
};

// Base class must be declared "virtual in order to allow multiple inheritance from classes derived from the class Matrix.
class DenseMatrix : public virtual Matrix {
private:
  int     r;    ///< number of rows
  int     c;    ///< number of columns
  double* d;    ///< array of doubles for matrix contents
public:
  DenseMatrix(int nrows,int ncols,double ini = 0.0);
  DenseMatrix(const DenseMatrix& mat);
  DenseMatrix(const Matrix& mat);
  DenseMatrix& operator=(const Matrix& mat);
  inline DenseMatrix& operator=(const DenseMatrix& mat) { return operator=((const Matrix&)mat); };
  virtual ~DenseMatrix();
  virtual int rows() const;
  virtual int columns() const;
  virtual double operator()(int i,int j) const;
  virtual double& operator()(int i,int j);
  /* ... */
};

class DenseSquareMatrix : public DenseMatrix, public SquareMatrix {
public:
  inline DenseSquareMatrix(int nrows,double ini = 0.0) : DenseMatrix(nrows,nrows,ini) { };
  /* ... */
};

class DiagonalMatrix : public SquareMatrix {
private:
  int     r;    ///< number of rows and columns
  double* d;    ///< array of doubles for matrix contents
public:
  DiagonalMatrix(int nrows,double ini = 0.0);
  virtual ~DiagonalMatrix();
  virtual int rows() const;
  virtual int columns() const;
  virtual double operator()(int i,int j) const;
  virtual double& operator()(int i,int j);
  /* ... */
};

DenseMatrix operator+(const Matrix& A,const Matrix& B);
std::ostream& operator<<(std::ostream& os,const Matrix& A);


text:
package skuber.examples.guestbook

import skuber._

package object model {

  case class GuestbookServiceSpecification(
      serviceName: String,
      containerName: String,
      image: String,
      containerPort: Int,
      replicas: Int,
      serviceType: Service.Type.ServiceType = Service.Type.ClusterIP,
      nodePort: Int = 0, // nodePort is only relevant if serviceType == NodePort
      customSelectors: Map[String, String] = Map(), // additional labels that should be selectors
      customLabels: Map[String, String] = Map(), // additional labels (but not selectors)
      customAnnotations: Map[String, String] = Map() )
  {

      def buildKubernetesResources =  {
         // build out k8s controller and service resources from this spec using a standard pattern

        val nameLabel = "name" -> serviceName

        val coreLabels=Map(nameLabel)
        val labels = coreLabels ++ customLabels
        val selector=coreLabels ++ customSelectors

        val container=Container(containerName, image=image).exposePort(containerPort)

        val template = Pod.Template.Spec.named(serviceName).
                             addLabels(labels).
                             addAnnotations(customAnnotations).
                             addContainer(container)

        val controller = ReplicationController(serviceName).
                             addLabels(labels).
                             addAnnotations(customAnnotations).
                             withReplicas(replicas).
                             withSelector(selector).
                             withTemplate(template)

        val servicePort = Service.Port(port=containerPort, nodePort = nodePort)
        val service = Service(metadata=ObjectMeta(name=serviceName, labels=labels),
                              spec=Some(Service.Spec(ports=List(servicePort),_type=serviceType).withSelector(selector)))

        GuestbookServiceResources(controller, service)
      }
  }

  case class GuestbookServiceResources(
      rc: ReplicationController,
      service: Service
  )
}


text:
<!DOCTYPE html>

<link type="text/css" rel="stylesheet" href="/dashboard/static/base.css">
<link rel="import" href="/components/paper-button/paper-button.html">
<link rel="import" href="/components/paper-item/paper-item.html">
<link rel="import" href="/components/polymer/polymer.html">
<link rel="import" href="/dashboard/static/simple_xhr.html">
<link rel="import" href="/dashboard/static/uri.html">

<link rel="import" href="/tracing/base/unit.html">

<dom-module id="bad-bisect-page">
  <template>

    <template is="dom-if" if="{{loading}}">

    </template>
    <template is="dom-if" if="{{!loading}}">
      <template is="dom-if" if="{{error}}">

{{error}}

      </template>
      <template is="dom-if" if="{{computeIsFormShowing(error, headline)}}">

        <form action="/bad_bisect" id="bisect_form" method="POST">
          <input type="hidden" name="try_job_id" value="{{try_job_id}}">

            <paper-button id="confirm" on-click="onConfirm">Confirm</paper-button>
            that bisect job {{try_job_id}} is incorrect.

        </form>

      </template>
      <template is="dom-if" if="{{computeIsHeadlineShowing(error, headline)}}">

{{headline}}

      </template>
    </template>
  </template>

</dom-module>


text:
import {proxyLoad} from './common/js/proxyLoad'

// 客管路由
import client from './module/clientmanage/route'
import details from './module/details/route'
// 360路由
import agentview from './module/agentView/route'

// const menu = r => require.ensure([], () => r(require('module/clientmanage/menu')), 'menu')

// const test = proxyLoad('demo/test/test', 'test')

// const tabel = r => require.ensure([], () => r(require('demo/test/table1')), 'test')
// const dynamicForm = r => require.ensure([], () => r(require('demo/test/dynamicForm')), 'test')
// const droptree = r => require.ensure([], () => r(require('demo/portal/components/droptree.vue')), 'test')
// const checkBoxTree = r => require.ensure([], () => r(require('demo/portal/components/checkBoxTree.vue')), 'test')
export default[
  {
    path : '/',
    component : require('./module/container.vue'),
    children : [
      {
        name: 'Home',
        path: '',
        component: require('./module/index/home.vue')
      }
    ]
  }, {
    name : 'Login',
    path : '/login',
    component : require('./module/login/login.vue')
  },
  ...client,
  ...agentview,
  ...details,
  {
    path : '*',
    component : {
      template: '
not found
'
    }
  }
]


text:
/*
 * $Id$
 */

/*

Copyright (c) 2007 Board of Trustees of Leland Stanford Jr. University,
all rights reserved.

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
STANFORD UNIVERSITY BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Except as contained in this notice, the name of Stanford University shall not
be used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from Stanford University.

*/

package org.lockss.plugin.simulated;

import java.io.*;
import java.util.*;
import java.util.zip.*;
import java.util.concurrent.atomic.*;
import java.net.*;
import java.text.*;
import org.lockss.util.*;
import org.lockss.test.*;
import org.lockss.plugin.base.*;
import org.lockss.crawler.*;
import org.lockss.daemon.*;

/**
 * A convenience class which takes care of handling the content
 * tree itself for the case where the content is in a ZIP file.
 *
 * @author  David S. H. Rosenthal
 * @version 0.0
 */

public class ActualZipContentGenerator extends SimulatedContentGenerator {
  private static Logger logger = Logger.getLogger("ActualZipContentGenerator");
  String zipFilePrefix = "SimulatedCrawl";
  AtomicInteger serialNo = new AtomicInteger(0);
  int maxSize = 100000000;
  String[] suffix = {
    ".txt",
    ".html",
    ".pdf",
    ".jpg",
    ".bin",
  };
  String[] mimeType = {
    "text/plain",
    "text/html",
    "application/pdf",
    "image/jpg",
    "application/octet-stream",
  };
  String stem = "http://www.content.org/";

  public ActualZipContentGenerator(String rootPath) {
    super(rootPath);
    logger.debug3("Created instance for " + rootPath);
  }

  public String generateContentTree() {
    String ret = super.generateContentTree();
    String zipName = "SpringerSample.zip";

    //  There should now be a suitable hierarchy at contentRoot,
    //  except that we need to copy the ZIP file into place and
    //  create a link to it.
    InputStream in = null;
    OutputStream os = null;
    try {
      in = this.getClass().getResourceAsStream(zipName);
      if (in == null) {
	throw new IOException(zipName + " missing");
      }
      File of = new File(contentRoot + File.separator + zipName);
      os = new FileOutputStream(of);
      byte[] buffer = new byte[4096];
      int i = 0;
      while ((i = in.read(buffer)) > 0) {
	os.write(buffer, 0, i);
	logger.debug2("Wrote " + i + " bytes of ZIP");
      }
      linkToZipFiles();
    } catch (IOException ex) {
      logger.error("copy threw " + ex);
      return null;
    } finally {
      IOUtil.safeClose(os);
      IOUtil.safeClose(in);
    }
    printZipFiles(0);
    return ret;
  }

  private void linkToZipFiles() {
    File dir = new File(contentRoot);
    if (dir.isDirectory()) {
      File index = new File(dir, INDEX_NAME);
      if (index.exists() && index.isFile()) try {
    FileOutputStream fos = new FileOutputStream(index);
    PrintWriter pw = new PrintWriter(fos);
    logger.debug3("Re-creating index file at " + index.getAbsolutePath());
    String file_content =
      getIndexContent(dir, INDEX_NAME, LockssPermission.LOCKSS_PERMISSION_STRING);
    pw.print(file_content);
    pw.flush();
    pw.close();
    fos.close();
      } catch (IOException ex) {
    logger.error("linkToZipFiles() threw " + ex);
      } else {
    logger.error("index.html missing");
      }
    } else {
      logger.error("Directory " + contentRoot + " missing");
    }
  }

  private void printZipFiles(long startPosition) {
    File dir = new File(contentRoot);
    if (dir.isDirectory()) try {
      String[] fileNames = dir.list();

      for (int i = 0; i < fileNames.length; i++) {
	if (fileNames[i].endsWith(".zip")) {
	  logger.debug3(fileNames[i] + " headers offset" + startPosition);

	  File aFile = new File(dir, fileNames[i]);
	  ZipFile zFile = new ZipFile(aFile);
	  for (Enumeration e = zFile.entries(); e.hasMoreElements(); ) {
	    ZipEntry ze = (ZipEntry)e.nextElement();
	    if (ze.isDirectory()) {
	      logger.debug3("Dir: " + ze.getName());
	    } else {
	      logger.debug3("File: " + ze.getName() + " size " + ze.getSize());
	    }
	  }
	}
      }
    } catch (IOException ex) {
      logger.error("printZipFiles() threw " + ex);
    } else {
      logger.error("Directory " + contentRoot + " missing");
    }
  }
}


text:
title: "New Bees"
layout: "ceilidh"
caller: "Jane Bird"
eventUrl: "https://www.tickettailor.com/events/oxfolkceilidhs/"
---

Please book ticket via our [booking system](https://www.tickettailor.com/events/oxfolkceilidhs/).


text:
import AppDispatcher from '../dispatcher/AppDispatcher';
import ActionTypes from '../constants/ActionTypes';
import MissionLoader from '../data/MissionLoader';
import ValidationLoader from '../data/ValidationLoader';

function _onMissionsLoaded(missions) {
  AppDispatcher.dispatch({
    actionType: ActionTypes.MISSIONS_LOAD,
    data: missions,
  });
}

function _onValidationsLoaded(validations) {
  AppDispatcher.dispatch({
    actionType: ActionTypes.VALIDATIONS_LOAD,
    data: validations,
  });
}

function _onTasksLoaded(tasks) {
  AppDispatcher.dispatch({
    actionType: ActionTypes.TASKS_LOAD,
    data: tasks,
  });
}

export default class TaskActions {

  /**
   * Loads all tasks for the given coordinates.
   * @param {number} latitude The latitude of the coordinates.
   * @param {number} longitude The longitude of the coordinates.
   * @returns {void}
   */
  static loadTasks(latitude, longitude) {
    let tasks = [];
    let missionsLoaded = false;
    let validationsLoaded = false;

    MissionLoader.getMissions(
      latitude,
      longitude,
      (missions) => {
        _onMissionsLoaded(missions);

        tasks = tasks.concat(missions);
        missionsLoaded = true;
        if (validationsLoaded) {
          _onTasksLoaded(tasks);
        }
      },
      (error) => {
        AppDispatcher.dispatch({
          actionType: ActionTypes.MISSIONS_ERROR_LOAD,
          data: error,
        });
      }
    );
    ValidationLoader.getValidations(latitude, longitude,
      (validations) => {
        _onValidationsLoaded(validations);
        tasks = tasks.concat(validations);
        validationsLoaded = true;
        if (missionsLoaded) {
          _onTasksLoaded(tasks);
        }
      },
      (error) => {
        AppDispatcher.dispatch({
          actionType: ActionTypes.VALIDATIONS_ERROR_LOAD,
          data: error,
        });
      }
    );
  }

  static clearLoadError() {
    AppDispatcher.dispatch({ actionType: ActionTypes.TASKS_CLEAR_LOAD_ERROR });
  }

  static clearSendError() {
    AppDispatcher.dispatch({ actionType: ActionTypes.TASKS_CLEAR_SEND_ERROR });
  }
}


text:
<!DOCTYPE html>

   <title>Season 7: Tech Criticism… and Hope ◦ Winning Slowly</title>
   <meta
      name="description"
      content="Taking the long view on technology, religion, ethics, and art."
   />

   <meta charset="UTF-8" />
   <meta name="viewport" content="width=device-width,initial-scale=1" />
   <link rel="author" href="humans.txt" />
<meta name="twitter:card" content="summary" />
<meta name="twitter:site" content="@winningslowly" />
<meta name="twitter:creator" content="@winningslowly" />

      <meta property="og:url" content="https://winningslowly.org" />
      <meta property="og:type" content="website" />
      <meta property="og:title" content="Winning Slowly" />
      <meta name="twitter:title" content="Winning Slowly" />
      <meta property="og:description" content="Taking the long view on technology, religion, ethics, and art." />
      <meta name="twitter:description" content="Taking the long view on technology, religion, ethics, and art." />

      <meta property="og:image" content="https://winningslowly.org/images/logotype.png" />
   <meta property="og:image:type" content="image/png" />
   <meta property="og:image:width" content="3000" />
   <meta property="og:image:height" content="3000" />
   <meta
      property="og:image:alt"
      content="The word 'Winning' in dark gray and the word 'slowly' in a brilliant sea blue."
   />
   <meta name="twitter:image" content="https://winningslowly.org/images/logotype.png" />

   <link href="/style.min.css" type="text/css" rel="stylesheet" />
   <link
      href="//netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.css"
      rel="stylesheet"
   />
   <link
      href="/feed.xml"
      type="application/rss+xml"
      rel="alternate"
      title="Winning Slowly RSS Feed"
   />

   <link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png">
   <link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png">
   <link rel="icon" type="image/png" sizes="16x16" href="/favicon-16x16.png">
   <link rel="manifest" href="/site.webmanifest">
   <link rel="mask-icon" href="/safari-pinned-tab.svg" color="#2369af">
   <meta name="msapplication-TileColor" content="#2369af">
   <meta name="theme-color" content="#2369af">

                   Season 6

                  Season 8

            Winning
            Slowly

            Taking the long view on
            technology, religion, ethics, and art.

         Season 7
      Tech Criticism… and Hope

                           Episode 7.01

                           Do We Really Need to Keep the Internet Around?

                           March 27, 2019

                           Season 7's charter—by way of a rollicking argument about Alan Jacobs' The Year of Our Lord 1943 and Tolkien's idea of eucatastrophe.

                           Episode 7.02

                           People Who Don't Want To Do Things

                           April 10, 2019

                           Personal and community liturgies as ways to address a positive vision of the future to people who like the current way of doing things.

                           Episode 7.03

                           Ari Wallach

                           April 24, 2019

                           An interview with the founder of Longpath about his vision for the future and trans-generational ethics.

                           Episode 7.04

                           Not Better Enough

                           May 08, 2019

                           Rejecting solutionism, the problems of the humane, and wise change.

                           Episode 7.05

                           Chattanooga, China, and Subsidiarity

                           May 22, 2019

                           Localism is great! …but it is no panacea.

                           Episode 7.06

                           The ERLC AI Statement, Part 1

                           July 03, 2019

                           People reflecting proactively on ethics? Sold! …mostly. Mostly!

                           Episode 7.07

                           The ERLC AI Statement, Part 2

                           July 18, 2019

                           Data privacy, just war, the sovereignty of God… there's a lot here!

                           Episode 7.08

                           Literally Metaphorically Listen for Earthquakes

                           August 07, 2019

                           Trying to pull together the threads of the season so far toward our ethic of technology.

                           Episode 7.09

                           Frictioneers

                           August 28, 2019

                           Can adding a little friction back to user interfaces save us?

                           Episode 7.10

                           An Experiment in Moral Imagination, Pt. 1

                           September 11, 2019

                           Press pause on the dystopias. Set aside interventions. Dream a little of a non-technocratic world.

                           Episode 7.11

                           An Experiment in Moral Imagination, Pt. 2

                           October 05, 2019

                           "Go Do Earth Things", or, How 80 Years of Non-Technocratic Thinking Might Improve Phoenix, AZ

                           Episode 7.12

                           An Experiment in Moral Imagination, Pt. 3

                           October 22, 2019

                           Sustainable long-distance transportation, or really great virtual reality? Fight!

                           Episode 7.13

                           A Healthy Tension

                           November 20, 2019

                           Wrestling with the limits of what we have managed to say this season.

About

The Hosts

      Chris Krycho is a
      software engineer,
      podcaster,
      writer, and
      occasional composer. He lives with his family in Colorado.

      Stephen Carradini is a
      digital media scholar and professor,
      writer,
      editor, and
      songwriter. He lives with his family in Arizona.

Privacy

      We collect zero data about your use of this website. We use Podtrac to gather very limited aggregate statistics about our listenership—the total number of downloads per episode, and the countries of our listenership. That's it, and it always will be.

License

      ©2013–2021 Stephen Carradini and Chris Krycho.

      Design by Chris Krycho, using Tiempos Headline and Tiempos Text, by Klim Type Foundry.

      Source code available on GitHub.

      All content licensed under a Creative Commons Attribution 4.0 International License.
      (Translation: please don't just copy and paste; please do copy and modify for any use, giving credit where due.)
      Read more on our licenses.


text:
<?php
namespace Mw\Metamorph\View;

use TYPO3\Flow\Error\Result;

class ValidationResultRenderer {

	public function renderValidationResult(Result $result, $message = NULL) {
		$output = $message ?: 'The following validation errors have occurred:';
		$output .= "\n\n";

		foreach ($result->getFlattenedErrors() as $property => $errors) {
			$output .= "<comment>$property</comment>:\n";
			foreach ($errors as $error) {
				$output .= "  " . $error->getMessage() . "\n";
			}
		}
		return $output;
	}

}


text:
<?php
/**
 *
 *
 * @author Sam Schmidt <samuel@dersam.net>
 * @since 2015-12-09
 * @company Linus Shops
 */

namespace LinusShops\CanadaPost\Exceptions;

class RequestException extends CanadaPostException
{

}


text:
- [Fix] Readme correction

## v1.2.2
- [Fix] Fix UMD support

## v1.2.1
- [Fix] Bump version to publish to npm

## v1.2.0
- [Feature] Add UMD support
- [Feature] Allow to select either the top or bottom of the offset element
- [Feature] Update the offset position on browser resize
- Publish to npm
- Add license file
- [Fix] Make the clone version lower z-index than original. Prevents visual overlap of both when scrolling quickly

## v1.1.1
- [Fix] Fix class naming

## v1.1.0
- [Feature] Call the init method interally on instance creation
- [Fix] Destroy method to only destroy it's instance

## v1.0.0
- Inital


text:
module.exports = {
    noStrip: 'No strip was provided.',
    wrongStrip: 'The strip provided was not the one expected.'
};


text:
<?php

require_once dirname(__FILE__) . '/../../../bootstrap.php';

class Elastica_Filter_NumericRangeTest extends PHPUnit_Framework_TestCase
{
    public function testAddField()
    {
        $rangeFilter = new Elastica_Filter_NumericRange();
        $returnValue = $rangeFilter->addField('fieldName', array('to' => 'value'));
        $this->assertInstanceOf('Elastica_Filter_NumericRange', $returnValue);
    }

    public function testToArray()
    {
        $filter = new Elastica_Filter_NumericRange();

        $fromTo = array('from' => 'ra', 'to' => 'ru');
        $filter->addField('name', $fromTo);

        $expectedArray = array(
            'numeric_range' => array(
                'name' => $fromTo
            )
        );

        $this->assertEquals($expectedArray, $filter->toArray());
    }
}


text:
package com.yahoo.ml.jcaffe;

import org.testng.annotations.Test;
import static org.testng.Assert.*;
import java.util.Random;
import java.util.Arrays;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeMethod;

import java.io.ByteArrayOutputStream;
import java.io.DataInputStream;
import java.io.FileInputStream;
import java.io.FileReader;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.List;

public class PerfTest {
    String rootPath, imagePath;

    List<String> file_list;

    @BeforeMethod
    public void setUp() throws Exception {
        String fullPath = getClass().getClassLoader().getResource("log4j.properties").getPath();
        rootPath = fullPath.substring(0, fullPath.indexOf("caffe-distri/"));
        imagePath = rootPath + "data/images";

        file_list = Files.readAllLines(Paths.get(imagePath + "/labels.txt"), StandardCharsets.UTF_8);
    }

    //LEAKTEST: uncomment to test leak for set_cpu_data()
    //    @Test
    public void testLeak() {
	FloatBlob blob = new FloatBlob();
        boolean res = blob.reshape(1, 1, 2, 2);
	float[] input = { 1.0f, 2.0f, 3.0f, 4.0f };
        blob.set_cpu_data(input);
        for(int j=0; j < 1000000; j++){
            System.out.print("+");
	    blob.cpu_data();
	}
	blob.deallocate();
    }

    private byte[] getDataFromFile(int pos) throws Exception{
        byte[] buf = new byte[1024 * 1024];
        String line = file_list.get(pos);
        String[] line_splits = line.split(" ");
        String filename = line_splits[0];
        int label = Integer.parseInt(line_splits[1]);

        ByteArrayOutputStream out = new ByteArrayOutputStream();
        DataInputStream in = new DataInputStream(new FileInputStream(imagePath + "/" + filename));
        int len = in.read(buf, 0, buf.length);
        while (len > 0) {
            out.write(buf, 0, len);
            len = in.read(buf, 0, buf.length);
        }
        in.close();
        byte[] b = out.toByteArray();
        out.close();
        return b;
    }
    //Perf test for Mat and MatVector
    //@Test
    private void perfMatVecTest() throws Exception {
        int iter = 100000;
        int arraysize = 1000;
        MatVector matVec = new MatVector(arraysize);
        for (int i=0; i < iter; i++) {
            System.out.print("+");
	    byte[] data0 = getDataFromFile(0);
            for (int j=0; j < arraysize; j++){
		Mat mat = new Mat(data0);
                Mat oldmat = matVec.put(j, mat);
                if(oldmat != null)
                    oldmat.deallocate();

                if ( j == 50)
                    data0 = getDataFromFile(1);
            }

	    //What we wrote is what we get
            data0=getDataFromFile(0);
            for(int j=0; j < arraysize; j++){
                assertTrue(Arrays.equals(data0,matVec.data(j)));
                if(j == 50)
                    data0 = getDataFromFile(1);
            }
	}
	matVec.deallocate();
        System.out.println();
        System.out.println("DONE");
    }

    //@Test
    private void perfMatTest() throws Exception {
	int iter = 100000;
	int arraysize = 1000;
	MatVector matVec = new MatVector(arraysize);
	byte[] data0 = getDataFromFile(0);
	for (int i=0; i < iter; i++) {
	    System.out.print("+");
	    for (int j=0; j < arraysize; j++){
		Mat mat = new Mat(data0);
		mat.decode(Mat.CV_LOAD_IMAGE_COLOR);
		mat.resize(227,227);
		Mat oldmat = matVec.put(j, mat);
		if(oldmat != null)
		  oldmat.deallocate();
	    }
	}
    }
}


text:
module Discordrb
  # The current version of discordrb.
  VERSION = '3.4.2'
end


text:
import {EnvConfig} from './env-config.interface';

const BaseConfig: EnvConfig = {
  // Sample API url
  API: 'https://demo.com'
};

export = BaseConfig;


text:
"""CLI controller for the analyzer"""

import smalisca.core.smalisca_config as config
from smalisca.core.smalisca_logging import log
from smalisca.core.smalisca_app import App
from smalisca.analysis.analysis_shell import AnalyzerShell

from cement.core import controller
from cement.core.controller import CementBaseController

from pprint import pprint

class AnalyzerController(CementBaseController):
    """ Controller for analyzing previously parsed Smali files

    You can interact with the results in an interactive way or
    run commands in batch style. Several commands are provided
    which can:

        * search for data
        * draw data

    """

    class Meta:
        label = 'analyzer'
        stacked_on = 'base'
        stacked_type = 'nested'
        description = config.HelpMessage.ANALYZER_HELP

        arguments = config.COMMON_ARGS + [
            (['--config'],
                dict(
                    dest="config_file",
                    help="Specify config file")),
            (['-i', '--input'],
                dict(
                    dest="filename", help="Specify results file to read from",
                    required=True)),
            (['-f', '--format'],
                dict(
                    dest="fileformat", help="Files format",
                    choices=config.ANALYZER_INPUT_CHOICES,
                    required=True)),
            (['-c'],
                dict(
                    dest="commands_file",
                    help="Read commands from file instead of interactive prompt")),
        ]

    @controller.expose(hide=True, aliases=['run'])
    def default(self):
        """Default command"""

        if (self.app.pargs.filename) and (self.app.pargs.fileformat):
            # Create new app
            app = App(__name__)

            # Analysis obj
            analysis = None

            # Check for config file
            if self.app.pargs.config_file:
                config.smalisca_conf.read(self.app.pargs.config_file)
            else:
                log.info("Using default conf (%s)" % config.PROJECT_CONF)
                config.smalisca_conf.read(config.PROJECT_CONF)

            config.smalisca_conf.parse()

            # Read SQLite data
            if self.app.pargs.fileformat == "sqlite":
                from smalisca.analysis.analysis_sqlite import AnalyzerSQLite
                from smalisca.modules.module_sql_models import AppSQLModel

                # Read SQLite data
                appSQL = AppSQLModel(self.app.pargs.filename)
                log.info("Successfully opened SQLite DB")

                # Create analysis framework
                log.info("Creating analyzer framework ...")
                analysis = AnalyzerSQLite(appSQL.get_session())

            # Where to read commands from?
            if self.app.pargs.commands_file:
                commands = open(self.app.pargs.commands_file, "rt")
                try:
                    log.info("Reading commands from %s" % self.app.pargs.commands_file)
                    cmd_shell = AnalyzerShell(analysis)
                    cmd_shell.use_rawinput = False
                    cmd_shell.stdin = commands
                    cmd_shell.prompt = ''
                    cmd_shell.cmdloop()
                finally:
                    commands.close()
            else:
                # Start new shell
                log.info("Starting new analysis shell")
                cmd_shell = AnalyzerShell(analysis)
                cmd_shell.cmdloop()


text:
package org.jboss.migration.wfly10.config.task.paths;

import org.jboss.migration.core.jboss.XmlConfigurationMigration;

import java.util.Set;
import java.util.stream.Collectors;
import java.util.stream.Stream;

/**
 * Migration of properties files referenced by Elytron subsystem XML configurations.
 * @author emmartins
 */
public class ElytronSubsystemPropertiesPathsMigration extends ResolvablePathsMigration {

    /**
     *
     */
    public static class Factory implements XmlConfigurationMigration.ComponentFactory {
        @Override
        public XmlConfigurationMigration.Component newComponent() {
            return new ElytronSubsystemPropertiesPathsMigration();
        }
    }

    public static final Set<String> ELEMENT_LOCAL_NAMES = Stream.of("users-properties", "groups-properties").collect(Collectors.toSet());

    protected ElytronSubsystemPropertiesPathsMigration() {
        super("subsystem.elytron.properties", ELEMENT_LOCAL_NAMES, "urn:wildfly:elytron:");
    }
}