text:
/*	$NetBSD: edit_file.c,v 1.1.1.2 2013/01/02 18:59:12 tron Exp $	*/

/*++
/* NAME
/*	edit_file 3
/* SUMMARY
/*	simple cooperative file updating protocol
/* SYNOPSIS
/*	#include <edit_file.h>
/*
/*	typedef struct {
/* .in +4
/*		char	*tmp_path;	/* temp. pathname */
/*		VSTREAM *tmp_fp;	/* temp. stream */
/*		/* private members... */
/* .in -4
/*	} EDIT_FILE;
/*
/*	EDIT_FILE *edit_file_open(original_path, output_flags, output_mode)
/*	const char *original_path;
/*	int	output_flags;
/*	mode_t	output_mode;
/*
/*	int	edit_file_close(edit_file)
/*	EDIT_FILE *edit_file;
/*
/*	void	edit_file_cleanup(edit_file)
/*	EDIT_FILE *edit_file;
/* DESCRIPTION
/*	This module implements a simple protocol for cooperative
/*	processes to update one file. The idea is to 1) create a
/*	new file under a deterministic temporary pathname, 2)
/*	populate the new file with updated information, and 3)
/*	rename the new file into the place of the original file.
/*	This module provides 1) and 3), and leaves 2) to the
/*	application. The temporary pathname is deterministic to
/*	avoid accumulation of thrash after program crashes.
/*
/*	edit_file_open() implements the first phase of the protocol.
/*	It creates or opens an output file with a deterministic
/*	temporary pathname, obtained by appending the suffix defined
/*	with EDIT_FILE_SUFFIX to the specified original file pathname.
/*	The original file itself is not opened.  edit_file_open()
/*	then locks the output file for exclusive access, and verifies
/*	that the file still exists under the temporary pathname.
/*	At this point in the protocol, the current process controls
/*	both the output file content and its temporary pathname.
/*
/*	In the second phase, the application opens the original
/*	file if needed, and updates the output file via the
/*	\fBtmp_fp\fR member of the EDIT_FILE data structure.  This
/*	phase is not implemented by the edit_file() module.
/*
/*	edit_file_close() implements the third and final phase of
/*	the protocol.  It flushes the output file to persistent
/*	storage, and renames the output file from its temporary
/*	pathname into the place of the original file. When any of
/*	these operations fails, edit_file_close() behaves as if
/*	edit_file_cleanup() was called. Regardless of whether these
/*	operations suceed, edit_file_close() releases the exclusive
/*	lock, closes the output file, and frees up memory that was
/*	allocated by edit_file_open().
/*
/*	edit_file_cleanup() aborts the protocol. It discards the
/*	output file, releases the exclusive lock, closes the output
/*	file, and frees up memory that was allocated by edit_file_open().
/*
/*	Arguments:
/* .IP original_path
/*	The pathname of the original file that will be replaced by
/*	the output file. The temporary pathname for the output file
/*	is obtained by appending the suffix defined with EDIT_FILE_SUFFIX
/*	to a copy of the specified original file pathname, and is
/*	made available via the \fBtmp_path\fR member of the EDIT_FILE
/*	data structure.
/* .IP output_flags
/*	Flags for opening the output file. These are as with open(2),
/*	except that the O_TRUNC flag is ignored.  edit_file_open()
/*	always truncates the output file after it has obtained
/*	exclusive control over the output file content and temporary
/*	pathname.
/* .IP output_mode
/*	Permissions for the output file. These are as with open(2),
/*	except that the output file is initially created with no
/*	group or other access permissions. The specified output
/*	file permissions are applied by edit_file_close().
/* .IP edit_file
/*	Pointer to data structure that is returned upon successful
/*	completion by edit_file_open(), and that must be passed to
/*	edit_file_close() or edit_file_cleanup().
/* DIAGNOSTICS
/*	Fatal errors: memory allocation failure, fstat() failure,
/*	unlink() failure, lock failure, ftruncate() failure.
/*
/*	edit_file_open() immediately returns a null pointer when
/*	it cannot open the output file.
/*
/*	edit_file_close() returns zero on success, VSTREAM_EOF on
/*	failure.
/*
/*	With both functions, the global errno variable indicates
/*	the nature of the problem.  All errors are relative to the
/*	temporary output's pathname. With both functions, this
/*	pathname is not available via the EDIT_FILE data structure,
/*	because that structure was already destroyed, or not created.
/* BUGS
/*	In the non-error case, edit_file_open() will not return
/*	until it obtains exclusive control over the output file
/*	content and temporary pathname.  Applications that are
/*	concerned about deadlock should protect the edit_file_open()
/*	call with a watchdog timer.
/*
/*	When interrupted, edit_file_close() may leave behind a
/*	world-readable output file under the temporary pathname.
/*	On some systems this can be used to inflict a shared-lock
/*	DOS on the protocol.  Applications that are concerned about
/*	maximal safety should protect the edit_file_close() call
/*	with sigdelay() and sigresume() calls, but this introduces
/*	the risk that the program will get stuck forever.
/* LICENSE
/* .ad
/* .fi
/*	The Secure Mailer license must be distributed with this software.
/* AUTHOR(S)
/*	Based on code originally by:
/*	Victor Duchovni
/*	Morgan Stanley
/*
/*	Packaged into one module with minor improvements by:
/*	Wietse Venema
/*	IBM T.J. Watson Research
/*	P.O. Box 704
/*	Yorktown Heights, NY 10598, USA
/*--*/

/* System library. */

#include <sys_defs.h>
#include <sys/stat.h>
#include <stdio.h>			/* rename(2) */
#include <errno.h>

 /*
  * This mask selects all permission bits in the st_mode stat data. There is
  * no portable definition (unlike S_IFMT, which is defined for the file type
  * bits). For example, BSD / Linux have ALLPERMS, while Solaris has S_IAMB.
  */
#define FILE_PERM_MASK \
	(S_ISUID | S_ISGID | S_ISVTX | S_IRWXU | S_IRWXG | S_IRWXO)

/* Utility Library. */

#include <msg.h>
#include <vstream.h>
#include <mymalloc.h>
#include <stringops.h>
#include <myflock.h>
#include <edit_file.h>
#include <warn_stat.h>

 /*
  * Do we reuse and truncate an output file that persists after a crash, or
  * do we unlink it and create a new file?
  */
#define EDIT_FILE_REUSE_AFTER_CRASH

 /*
  * Protocol internals: the temporary file permissions.
  */
#define EDIT_FILE_MODE	(S_IRUSR | S_IWUSR)	/* temp file mode */

 /*
  * Make complex operations more readable. We could use functions, instead.
  * The main thing is that we keep the _alloc and _free code together.
  */
#define EDIT_FILE_ALLOC(ep, path, mode) do { \
	(ep) = (EDIT_FILE *) mymalloc(sizeof(EDIT_FILE)); \
	(ep)->final_path = mystrdup(path); \
	(ep)->final_mode = (mode); \
	(ep)->tmp_path = concatenate((path), EDIT_FILE_SUFFIX, (char *) 0); \
	(ep)->tmp_fp = 0; \
    } while (0)

#define EDIT_FILE_FREE(ep) do { \
	myfree((ep)->final_path); \
	myfree((ep)->tmp_path); \
	myfree((char *) (ep)); \
    } while (0)

/* edit_file_open - open and lock file with deterministic temporary pathname */

EDIT_FILE *edit_file_open(const char *path, int flags, mode_t mode)
{
    struct stat before_lock;
    struct stat after_lock;
    int     saved_errno;
    EDIT_FILE *ep;

    /*
     * Initialize. Do not bother to optimize for the error case.
     */
    EDIT_FILE_ALLOC(ep, path, mode);

    /*
     * As long as the output file can be opened under the temporary pathname,
     * this code can loop or block forever.
     *
     * Applications that are concerned about deadlock should protect the
     * edit_file_open() call with a watchdog timer.
     */
    for ( /* void */ ; /* void */ ; (void) vstream_fclose(ep->tmp_fp)) {

	/*
	 * Try to open the output file under the temporary pathname. This
	 * succeeds or fails immediately. To avoid creating a shared-lock DOS
	 * opportunity after we crash, we create the output file with no
	 * group or other permissions, and set the final permissions at the
	 * end (this is one reason why we try to get exclusive control over
	 * the output file instead of the original file). We postpone file
	 * truncation until we have obtained exclusive control over the file
	 * content and temporary pathname. If the open operation fails, we
	 * give up immediately. The caller can retry the call if desirable.
	 *
	 * XXX If we replace the vstream_fopen() call by safe_open(), then we
	 * should replace the stat() call below by lstat().
	 */
	if ((ep->tmp_fp = vstream_fopen(ep->tmp_path, flags & ~(O_TRUNC),
				    EDIT_FILE_MODE)) == 0) {
	    saved_errno = errno;
	    EDIT_FILE_FREE(ep);
	    errno = saved_errno;
	    return (0);
	}

	/*
	 * At this point we may have opened an existing output file that was
	 * already locked. Try to lock the open file exclusively. This may
	 * take some time.
	 */
	if (myflock(vstream_fileno(ep->tmp_fp), INTERNAL_LOCK,
		    MYFLOCK_OP_EXCLUSIVE) < 0)
	    msg_fatal("lock %s: %m", ep->tmp_path);

	/*
	 * At this point we have an exclusive lock, but some other process
	 * may have renamed or removed the output file while we were waiting
	 * for the lock. If that is the case, back out and try again.
	 */
	if (fstat(vstream_fileno(ep->tmp_fp), &before_lock) < 0)
	    msg_fatal("open %s: %m", ep->tmp_path);
	if (stat(ep->tmp_path, &after_lock) < 0
	    || before_lock.st_dev != after_lock.st_dev
	    || before_lock.st_ino != after_lock.st_ino
#ifdef HAS_ST_GEN
	    || before_lock.st_gen != after_lock.st_gen
#endif
	/* No need to compare st_rdev or st_nlink here. */
	    ) {
	    continue;
	}

	/*
	 * At this point we have exclusive control over the output file
	 * content and its temporary pathname (within the rules of the
	 * cooperative protocol). But wait, there is more.
	 *
	 * There are many opportunies for trouble when opening a pre-existing
	 * output file. Here are just a few.
	 *
	 * - Victor observes that a system crash in the middle of the
	 * final-phase rename() operation may result in the output file
	 * having both the temporary pathname and the final pathname. In that
	 * case we must not write to the output file.
	 *
	 * - Wietse observes that crashes may also leave the output file in
	 * other inconsistent states. To avoid permission-related trouble, we
	 * simply refuse to work with an output file that has the wrong
	 * temporary permissions. This won't stop the shared-lock DOS if we
	 * crash after changing the file permissions, though.
	 *
	 * To work around these crash-related problems, remove the temporary
	 * pathname, back out, and try again.
	 */
	if (!S_ISREG(after_lock.st_mode)
#ifndef EDIT_FILE_REUSE_AFTER_CRASH
	    || after_lock.st_size > 0
#endif
	    || after_lock.st_nlink > 1
	    || (after_lock.st_mode & FILE_PERM_MASK) != EDIT_FILE_MODE) {
	    if (unlink(ep->tmp_path) < 0 && errno != ENOENT)
		msg_fatal("unlink %s: %m", ep->tmp_path);
	    continue;
	}

	/*
	 * Settle the final details.
	 */
#ifdef EDIT_FILE_REUSE_AFTER_CRASH
	if (ftruncate(vstream_fileno(ep->tmp_fp), 0) < 0)
	    msg_fatal("truncate %s: %m", ep->tmp_path);
#endif
	return (ep);
    }
}

/* edit_file_cleanup - clean up without completing the protocol */

void    edit_file_cleanup(EDIT_FILE *ep)
{

    /*
     * Don't touch the file after we lose the exclusive lock!
     */
    if (unlink(ep->tmp_path) < 0 && errno != ENOENT)
	msg_fatal("unlink %s: %m", ep->tmp_path);
    (void) vstream_fclose(ep->tmp_fp);
    EDIT_FILE_FREE(ep);
}

/* edit_file_close - rename the file into place and and close the file */

int     edit_file_close(EDIT_FILE *ep)
{
    VSTREAM *fp = ep->tmp_fp;
    int     fd = vstream_fileno(fp);
    int     saved_errno;

    /*
     * The rename/unlock portion of the protocol is relatively simple. The
     * only things that really matter here are that we change permissions as
     * late as possible, and that we rename the file to its final pathname
     * before we lose the exclusive lock.
     *
     * Applications that are concerned about maximal safety should protect the
     * edit_file_close() call with sigdelay() and sigresume() calls. It is
     * not safe for us to call these functions directly, because the calls do
     * not nest. It is also not nice to force every caller to run with
     * interrupts turned off.
     */
    if (vstream_fflush(fp) < 0
	|| fchmod(fd, ep->final_mode) < 0
#ifdef HAS_FSYNC
	|| fsync(fd) < 0
#endif
	|| rename(ep->tmp_path, ep->final_path) < 0) {
	saved_errno = errno;
	edit_file_cleanup(ep);
	errno = saved_errno;
	return (VSTREAM_EOF);
    } else {
	(void) vstream_fclose(ep->tmp_fp);
	EDIT_FILE_FREE(ep);
	return (0);
    }
}


text:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<title>R: Plant Species Traits Data</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link rel="stylesheet" type="text/css" href="R.css">

plantTraits	R Documentation

Plant Species Traits Data

Description

This dataset constitutes a description of 136 plant species
according to biological attributes (morphological or reproductive)

Usage

data(plantTraits)

Format

A data frame with 136 observations on the following 31 variables.

pdias

Diaspore mass (mg)

longindex

Seed bank longevity

durflow

Flowering duration

height

Plant height, an ordered factor with levels
1 < 2 < ... < 8.

begflow

Time of first flowering, an ordered factor with levels 1 < 2 < 3 < 4 < 5 < 6 < 7 < 8 < 9

mycor

Mycorrhizas, an ordered factor with levels 0never < 1 sometimes< 2always

vegaer

aerial vegetative propagation, an ordered
factor with levels 0never < 1 present but limited< 2important.

vegsout

underground vegetative propagation, an ordered
factor with 3 levels identical to vegaer above.

autopoll

selfing pollination, an ordered factor with
levels 0never < 1rare < 2 often< the rule3

insects

insect pollination, an ordered factor with 5 levels 0 < ... < 4.

wind

wind pollination, an ordered factor with 5 levels 0 < ... < 4.

lign

a binary factor with levels 0:1,
indicating if plant is woody.

piq

a binary factor indicating if plant is thorny.

ros

a binary factor indicating if plant is rosette.

semiros

semi-rosette plant, a binary factor (0:
no; 1: yes).

leafy

leafy plant, a binary factor.

suman

summer annual, a binary factor.

winan

winter annual, a binary factor.

monocarp

monocarpic perennial, a binary factor.

polycarp

polycarpic perennial, a binary factor.

seasaes

seasonal aestival leaves, a binary factor.

seashiv

seasonal hibernal leaves, a binary factor.

seasver

seasonal vernal leaves, a binary factor.

everalw

leaves always evergreen, a binary factor.

everparti

leaves partially evergreen, a binary factor.

elaio

fruits with an elaiosome (dispersed by ants), a binary factor.

endozoo

endozoochorous fruits, a binary factor.

epizoo

epizoochorous fruits, a binary factor.

aquat

aquatic dispersal fruits, a binary factor.

windgl

wind dispersed fruits,  a binary factor.

unsp

unspecialized mechanism of seed dispersal, a binary factor.

Details

Most of factor attributes are not disjunctive. For example, a plant can be usually
pollinated by insects but sometimes self-pollination can occured.

Source

Vallet, Jeanne (2005)
Structuration de communautés végétales et analyse comparative de
traits biologiques le long d'un gradient d'urbanisation.
Mémoire de Master 2 'Ecologie-Biodiversité-Evolution';
Université Paris Sud XI, 30p.+ annexes (in french)

Examples

data(plantTraits)

## Calculation of a dissimilarity matrix
library(cluster)
dai.b <- daisy(plantTraits,
               type = list(ordratio = 4:11, symm = 12:13, asymm = 14:31))

## Hierarchical classification
agn.trts <- agnes(dai.b, method="ward")
plot(agn.trts, which.plots = 2, cex= 0.6)
plot(agn.trts, which.plots = 1)
cutree6 <- cutree(agn.trts, k=6)
cutree6

## Principal Coordinate Analysis
cmdsdai.b <- cmdscale(dai.b, k=6)
plot(cmdsdai.b[, 1:2], asp = 1, col = cutree6)

redpajama_set_name: RedPajamaGithub


text:
<?php

class mahasiswaController extends CI_Controller {

    function __construct() {
        parent::__construct();
        $this->load->model('mahasiswaModel');
        $this->mahasiswaModel->getAll();
    }

    function functionName($param) {

    }

}
/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */


text:
#include "core/html/parser/TextDocumentParser.h"

#include "core/HTMLNames.h"
#include "core/html/parser/HTMLTreeBuilder.h"
#include "core/html/parser/ParserSynchronizationPolicy.h"

namespace blink {

using namespace HTMLNames;

TextDocumentParser::TextDocumentParser(HTMLDocument& document, ParserSynchronizationPolicy syncPolicy)
    : HTMLDocumentParser(document, false, syncPolicy)
    , m_haveInsertedFakePreElement(false)
{
}

TextDocumentParser::~TextDocumentParser()
{
}

void TextDocumentParser::appendBytes(const char* data, size_t length)
{
    if (!m_haveInsertedFakePreElement)
        insertFakePreElement();
    HTMLDocumentParser::appendBytes(data, length);
}

void TextDocumentParser::insertFakePreElement()
{
    // In principle, we should create a specialized tree builder for
    // TextDocuments, but instead we re-use the existing HTMLTreeBuilder.
    // We create a fake token and give it to the tree builder rather than
    // sending fake bytes through the front-end of the parser to avoid
    // distrubing the line/column number calculations.
    Vector<Attribute> attributes;
    attributes.append(Attribute(styleAttr, "word-wrap: break-word; white-space: pre-wrap;"));
    AtomicHTMLToken fakePre(HTMLToken::StartTag, preTag.localName(), attributes);
    treeBuilder()->constructTree(&fakePre);
    if (isStopped())
        return; // The document could have been detached by an extension while the tree was being constructed.

    // Normally we would skip the first \n after a <pre> element, but we don't
    // want to skip the first \n for text documents!
    treeBuilder()->setShouldSkipLeadingNewline(false);

    // Although Text Documents expose a "pre" element in their DOM, they
    // act like a <plaintext> tag, so we have to force plaintext mode.
    forcePlaintextForTextDocument();

    m_haveInsertedFakePreElement = true;
}

} // namespace blink


text:
AutofillInternalsUI::AutofillInternalsUI(content::WebUI* web_ui)
    : WebUIController(web_ui) {
  Profile* profile = Profile::FromWebUI(web_ui);
  content::WebUIDataSource::Add(profile,
                                autofill::CreateInternalsHTMLSource(
                                    chrome::kChromeUIAutofillInternalsHost));
  web_ui->AddMessageHandler(std::make_unique<autofill::InternalsUIHandler>(
      "setup-autofill-internals",
      base::BindRepeating(
          &autofill::AutofillLogRouterFactory::GetForBrowserContext)));
}

AutofillInternalsUI::~AutofillInternalsUI() = default;


text:
<?php

/**
 * sfValidatorPropelChoice validates that the value is one of the rows of a table.
 *
 * @package    symfony
 * @subpackage validator
 * @author     Fabien Potencier <fabien.potencier@symfony-project.com>
 * @version    SVN: $Id$
 */
class sfValidatorPropelChoice extends sfValidatorBase
{
  /**
   * Configures the current validator.
   *
   * Available options:
   *
   *  * model:      The model class (required)
   *  * criteria:   A criteria to use when retrieving objects
   *  * column:     The column name (null by default which means we use the primary key)
   *                must be in PhpName format
   *  * connection: The Propel connection to use (null by default)
   *
   * @see sfValidatorBase
   */
  protected function configure($options = array(), $messages = array())
  {
    $this->addRequiredOption('model');
    $this->addOption('criteria', null);
    $this->addOption('column', null);
    $this->addOption('connection', null);
  }

  /**
   * @see sfValidatorBase
   */
  protected function doClean($value)
  {
    $criteria = is_null($this->getOption('criteria')) ? new Criteria() : $this->getOption('criteria');
    $criteria->add($this->getColumn(), $value);

    $object = call_user_func(array($this->getOption('model').'Peer', 'doSelectOne'), $criteria, $this->getOption('connection'));

    if (is_null($object))
    {
      throw new sfValidatorError($this, 'invalid', array('value' => $value));
    }

    return $value;
  }

  /**
   * Returns the column to use for comparison.
   *
   * The primary key is used by default.
   *
   * @return string The column name
   */
  protected function getColumn()
  {
    if ($this->getOption('column'))
    {
      $phpName = $this->getOption('column');
    }
    else
    {
      $map = call_user_func(array($this->getOption('model').'Peer', 'getTableMap'));
      foreach ($map->getColumns() as $column)
      {
        if ($column->isPrimaryKey())
        {
          $phpName = $column->getPhpName();
          break;
        }
      }
    }

    return call_user_func(array($this->getOption('model').'Peer', 'translateFieldName'), $phpName, BasePeer::TYPE_PHPNAME, BasePeer::TYPE_COLNAME);
  }
}


text:
namespace Microsoft.Protocols.TestSuites.MS_OXCMAPIHTTP
{
    using System;
    using System.Collections.Generic;
    using System.Text;
    using Microsoft.Protocols.TestSuites.Common;

    /// <summary>
    /// A class indicates the GetTemplateInfo request type.
    /// </summary>
    public class GetTemplateInfoRequestBody : AddressBookRequestBodyBase
    {
        /// <summary>
        /// Gets or sets a set of bit flags that specify options to the server.
        /// </summary>
        public uint Flags { get; set; }

        /// <summary>
        /// Gets or sets an unsigned integer that specifies the display type of the template for which information is requested.
        /// </summary>
        public uint DisplayType { get; set; }

        /// <summary>
        /// Gets or sets a value indicating whether the TemplateDN field is present.
        /// </summary>
        public bool HasTemplateDn { get; set; }

        /// <summary>
        /// Gets or sets a string that specifies the distinguished name of the template requested.
        /// </summary>
        public string TemplateDn { get; set; }

        /// <summary>
        /// Gets or sets an unsigned integer that specifies the code page of template for which information is requested.
        /// </summary>
        public uint CodePage { get; set; }

        /// <summary>
        /// Gets or sets an unsigned integer that specifies the language code identifier(LCID) of the template for which information is requested.
        /// </summary>
        public uint LocaleId { get; set; }

        /// <summary>
        /// Serialize the instance to byte array.
        /// </summary>
        /// <returns>An array byte of the request body.</returns>
        public override byte[] Serialize()
        {
            List<byte> listByte = new List<byte>();

            listByte.AddRange(BitConverter.GetBytes(this.Flags));
            listByte.AddRange(BitConverter.GetBytes(this.DisplayType));
            listByte.AddRange(BitConverter.GetBytes(this.HasTemplateDn));
            if (this.HasTemplateDn == true)
            {
                StringBuilder rgbTemplatDNStringBuilder = new StringBuilder(this.TemplateDn);
                rgbTemplatDNStringBuilder.Append("\0");
                listByte.AddRange(
                    System.Text.Encoding.ASCII.GetBytes(rgbTemplatDNStringBuilder.ToString()));
            }

            listByte.AddRange(BitConverter.GetBytes(this.CodePage));
            listByte.AddRange(BitConverter.GetBytes(this.LocaleId));

            listByte.AddRange(BitConverter.GetBytes(this.AuxiliaryBufferSize));
            listByte.AddRange(this.AuxiliaryBuffer);

            return listByte.ToArray();
        }
    }
}


text: ![](NonARCToARC.png)


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

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Uses of Package psidev.psi.mi.jami.binary.impl (PSI :: JAMI - Java framework for molecular interactions 3.2.12 API)</title>
<meta name="date" content="2021-08-20">
<link rel="stylesheet" type="text/css" href="../../../../../../stylesheet.css" title="Style">

JavaScript is disabled on your browser.

Skip navigation links

Overview

Package

Class

Use

Tree

Deprecated

Index

Help

Prev

Next

Frames

No Frames

All Classes

Uses of Package
psidev.psi.mi.jami.binary.impl

Packages that use psidev.psi.mi.jami.binary.impl

Package
Description

psidev.psi.mi.jami.binary.impl

psidev.psi.mi.jami.crosslink.extension

psidev.psi.mi.jami.tab.extension

psidev.psi.mi.jami.xml.model.extension.binary

psidev.psi.mi.jami.xml.model.extension.binary.xml25

Classes in psidev.psi.mi.jami.binary.impl used by psidev.psi.mi.jami.binary.impl

Class and Description

AbstractBinaryInteraction

Abstract class for BinaryInteraction.

AbstractBinaryInteractionWrapper

Abstract class for binary interactions that wrap an Interaction.

DefaultBinaryInteraction

Default implementation for BinaryInteraction

 Note: the methods equals and hashCode have not been overridden.

DefaultBinaryInteractionEvidence

Default implementation for BinaryInteractionEvidence

DefaultModelledBinaryInteraction

Default implementation for ModelledBinaryInteraction

Classes in psidev.psi.mi.jami.binary.impl used by psidev.psi.mi.jami.crosslink.extension

Class and Description

AbstractBinaryInteraction

Abstract class for BinaryInteraction.

DefaultBinaryInteractionEvidence

Default implementation for BinaryInteractionEvidence

Classes in psidev.psi.mi.jami.binary.impl used by psidev.psi.mi.jami.tab.extension

Class and Description

AbstractBinaryInteraction

Abstract class for BinaryInteraction.

DefaultBinaryInteraction

Default implementation for BinaryInteraction

 Note: the methods equals and hashCode have not been overridden.

DefaultBinaryInteractionEvidence

Default implementation for BinaryInteractionEvidence

DefaultModelledBinaryInteraction

Default implementation for ModelledBinaryInteraction

Classes in psidev.psi.mi.jami.binary.impl used by psidev.psi.mi.jami.xml.model.extension.binary

Class and Description

AbstractBinaryInteraction

Abstract class for BinaryInteraction.

Classes in psidev.psi.mi.jami.binary.impl used by psidev.psi.mi.jami.xml.model.extension.binary.xml25

Class and Description

AbstractBinaryInteraction

Abstract class for BinaryInteraction.

Skip navigation links

Overview

Package

Class

Use

Tree

Deprecated

Index

Help

Prev

Next

Frames

No Frames

All Classes

Copyright © 2021. All rights reserved.


text:
package model;

import java.io.Serializable;

public class Data implements Serializable{

    private Document doc;

    public Data(){
        this.doc = new Document();
    }

    public void setDocument(Document doc){
        this.doc = doc;
    }

    public Document getDocument(){
        return doc;
    }
}


text:
// Generated by xsd compiler for ios/objective-c
// DO NOT CHANGE!

#import <Foundation/Foundation.h>
#import "PicoClassSchema.h"
#import "PicoPropertySchema.h"
#import "PicoConstants.h"
#import "PicoBindable.h"

/**

 A name and corresponding value (a name/value pair).

 @ingroup ShoppingInterface
*/
@interface Shopping_NameValueListType : NSObject <PicoBindable> {

@private
    NSString *_name;
    NSMutableArray *_value;
    NSMutableArray *_any;

}

/**

 The name of the item specific.

 This field is returned only in responses if the seller included an item specific
 Name in the listing. However, if the seller didn't also include a corresponding
 value for the item specific, it is best to not display the name to name to avoid
 confusing users.

 For the item condition, this usually includes the word "Condition" for eBay US,
 UK, Australia, and India listings; and "Artikelzustand" for eBay Germany, Austria,
 and Switzerland listings.

 Note:
 Ignore item specifics with SIFFTAS in the name. These are for internal use by
 eBay and aren't meaningful to users.

 type : NSString, wrapper for primitive string
*/
@property (nonatomic, strong) NSString *name;

/**

 A value for the item specific.

 This field is only returned in responses if the seller included a value
 for an item specific. In the GetSingleItem response, this field is always
 returned for each item specific that is returned (if any). However,
 if the seller didn't select a value for the item specific,
 this field may return empty, or it may return a value like "-",
 "Not Selected", or "Unspecified" (or the equivalent in the language
 of the site).

 For the item condition, this usually includes the
 word "New" or "Used" for eBay US, UK, Australia, and India listings;
 and "Neu" or "Gebraucht" for eBay Germany, Austria, and Switzerland
 listings.

 entry type : NSString, wrapper for primitive string
*/

@property (nonatomic, strong) NSMutableArray *value;

/**
 (public property)

 entry type : PicoAnyElement, wrapper for primitive anyelement
*/

@property (nonatomic, strong) NSMutableArray *any;

@end


text:
namespace WebAPI.Models
{
    using System;
    using System.Data.Entity;
    using System.ComponentModel.DataAnnotations.Schema;
    using System.Linq;
    using Entities;

    public partial class ModelDB : DbContext
    {
        public ModelDB()
            : base("SelfMessage")
        {
        }

        public virtual DbSet<AspNetRoles> AspNetRoles { get; set; }
        public virtual DbSet<AspNetUserClaims> AspNetUserClaims { get; set; }
        public virtual DbSet<AspNetUserLogins> AspNetUserLogins { get; set; }
        public virtual DbSet<AspNetUsers> AspNetUsers { get; set; }
        public virtual DbSet<Image> Images { get; set; }
        public virtual DbSet<Importance> Importances { get; set; }
        public virtual DbSet<Note> Notes { get; set; }
        public virtual DbSet<Tag> Tags { get; set; }
        public virtual DbSet<Task> Tasks { get; set; }
        public virtual DbSet<TaskTheme> TaskThemes { get; set; }

        protected override void OnModelCreating(DbModelBuilder modelBuilder)
        {
            modelBuilder.Entity<AspNetRoles>()
                .HasMany(e => e.AspNetUsers)
                .WithMany(e => e.AspNetRoles)
                .Map(m => m.ToTable("AspNetUserRoles").MapLeftKey("RoleId").MapRightKey("UserId"));

            modelBuilder.Entity<AspNetUsers>()
                .HasMany(e => e.AspNetUserClaims)
                .WithRequired(e => e.AspNetUsers)
                .HasForeignKey(e => e.UserId);

            modelBuilder.Entity<AspNetUsers>()
                .HasMany(e => e.AspNetUserLogins)
                .WithRequired(e => e.AspNetUsers)
                .HasForeignKey(e => e.UserId);
        }
    }
}


text:
package at.medunigraz.imi.bst.trec.search;

import static org.junit.Assert.assertFalse;

import java.io.File;
import java.util.List;

import org.apache.commons.io.FileUtils;
import org.json.JSONObject;
import org.junit.Assume;
import org.junit.Test;

import at.medunigraz.imi.bst.trec.model.Result;
import at.medunigraz.imi.bst.trec.utils.ConnectionUtils;

public class ElasticSearchTest {

	public ElasticSearchTest() {
		// There must be an available server
		Assume.assumeTrue(ConnectionUtils.checkElasticOpenPort());
	}

	@Test
	public void testJsonQuery() throws Exception {
		ElasticSearch es = new ElasticSearch();

		File simple = new File(getClass().getResource("/templates/match-title-thyroid.json").getFile());
		String jsonQuery = FileUtils.readFileToString(simple, "UTF-8");

		List<Result> results = es.query(new JSONObject(jsonQuery));

		assertFalse(results.isEmpty());
	}

}


text:
Testing Forms
*************

.. highlight:: python

`Tests for the django-registration application`_.

For unit testing forms::

  data = {
      'email': 'user@net.com',
      'name': 'Sam',
      'password': 'pass',
  }
  form = RegistrationForm(data=data)
  self.assertTrue(form.is_valid(), form.errors)
  self.assertEquals(form.cleaned_data['name'], 'Sam')

Model forms::

  @pytest.mark.django_db
  def test_mapping_form():
      mapping = MappingFactory()
      data = {
          'data_download': True,
          'mapping_type': Mapping.LIST_KEY,
      }
      form = MappingForm(
          data=data,
          instance=mapping,
      )
      assert form.is_valid(), form.errors
      assert {
          'data_download': True,
          'mapping_type': 'list_key',
      } == form.cleaned_data

Sample
======

::

  self.assertEquals(form.errors['email'], [u'This field is required.',])
  self.assertEquals(len(form.errors), 1,
      'expecting the form to have only one error %s' % form.errors)

::

  form = ArticleForm(data=data)
  self.assertFalse(form.is_valid(), form.errors)
  self.assertIn('PJK', form.errors[NON_FIELD_ERRORS][0])

Attributes
----------

::

  def _attributes_for_widget(self, form, widget_name):
      """
      Return the HTML attributes for the widget as a dictionary.

      :param form:
          Django form containing the widget.
      :param widget_name:
          Name of the widget.
      :returns:
          (dict) HTML attributes for the widget.
      """
      widgets = {}
      for i in form:
          widgets[i.name] = i.as_widget()
      html = widgets[widget_name]
      soup = BeautifulSoup(html)
      # html will contain a single widget.
      element = soup.contents[0]
      attributes = {}
      for i in element.attrs:
          attributes[i[0]] = i[1]
      return attributes

View
----

To test a form within a view::

  response = self.client.get(url)
  form = response.context_data['form']
  self.assertEqual('test@pkimber.net', form.initial['email'])

.. _`Tests for the django-registration application`: http://bitbucket.org/ubernostrum/django-registration/src/tip/registration/tests/forms.py


text:
// This file has been auto-generated by code_generator_v8.py. DO NOT MODIFY!

#include "config.h"
#include "V8FontFace.h"

#include "bindings/core/v8/ExceptionState.h"
#include "bindings/core/v8/ScriptPromise.h"
#include "bindings/core/v8/ScriptState.h"
#include "bindings/core/v8/UnionTypesCore.h"
#include "bindings/core/v8/V8ArrayBuffer.h"
#include "bindings/core/v8/V8ArrayBufferView.h"
#include "bindings/core/v8/V8DOMConfiguration.h"
#include "bindings/core/v8/V8FontFaceDescriptors.h"
#include "bindings/core/v8/V8ObjectConstructor.h"
#include "core/dom/ContextFeatures.h"
#include "core/dom/Document.h"
#include "core/frame/LocalDOMWindow.h"
#include "core/inspector/ConsoleMessage.h"
#include "platform/RuntimeEnabledFeatures.h"
#include "platform/TraceEvent.h"
#include "wtf/GetPtr.h"
#include "wtf/RefPtr.h"

namespace blink {

// Suppress warning: global constructors, because struct WrapperTypeInfo is trivial
// and does not depend on another global objects.
#if defined(COMPONENT_BUILD) && defined(WIN32) && COMPILER(CLANG)
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wglobal-constructors"
#endif
const WrapperTypeInfo V8FontFace::wrapperTypeInfo = { gin::kEmbedderBlink, V8FontFace::domTemplate, V8FontFace::refObject, V8FontFace::derefObject, V8FontFace::trace, V8FontFace::toActiveDOMObject, 0, V8FontFace::preparePrototypeObject, V8FontFace::installConditionallyEnabledProperties, "FontFace", 0, WrapperTypeInfo::WrapperTypeObjectPrototype, WrapperTypeInfo::ObjectClassId, WrapperTypeInfo::NotInheritFromEventTarget, WrapperTypeInfo::Dependent, WrapperTypeInfo::WillBeGarbageCollectedObject };
#if defined(COMPONENT_BUILD) && defined(WIN32) && COMPILER(CLANG)
#pragma clang diagnostic pop
#endif

// This static member must be declared by DEFINE_WRAPPERTYPEINFO in FontFace.h.
// For details, see the comment of DEFINE_WRAPPERTYPEINFO in
// bindings/core/v8/ScriptWrappable.h.
const WrapperTypeInfo& FontFace::s_wrapperTypeInfo = V8FontFace::wrapperTypeInfo;

namespace FontFaceV8Internal {

static void familyAttributeGetter(const v8::FunctionCallbackInfo<v8::Value>& info)
{
    v8::Local<v8::Object> holder = info.Holder();
    FontFace* impl = V8FontFace::toImpl(holder);
    v8SetReturnValueString(info, impl->family(), info.GetIsolate());
}

static void familyAttributeGetterCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
{
    TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMGetter");
    FontFaceV8Internal::familyAttributeGetter(info);
    TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
}

static void familyAttributeSetter(v8::Local<v8::Value> v8Value, const v8::FunctionCallbackInfo<v8::Value>& info)
{
    v8::Local<v8::Object> holder = info.Holder();
    ExceptionState exceptionState(ExceptionState::SetterContext, "family", "FontFace", holder, info.GetIsolate());
    FontFace* impl = V8FontFace::toImpl(holder);
    V8StringResource<> cppValue = v8Value;
    if (!cppValue.prepare())
        return;
    ExecutionContext* executionContext = currentExecutionContext(info.GetIsolate());
    impl->setFamily(executionContext, cppValue, exceptionState);
    exceptionState.throwIfNeeded();
}

static void familyAttributeSetterCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
{
    v8::Local<v8::Value> v8Value = info[0];
    TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMSetter");
    FontFaceV8Internal::familyAttributeSetter(v8Value, info);
    TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
}

static void styleAttributeGetter(const v8::FunctionCallbackInfo<v8::Value>& info)
{
    v8::Local<v8::Object> holder = info.Holder();
    FontFace* impl = V8FontFace::toImpl(holder);
    v8SetReturnValueString(info, impl->style(), info.GetIsolate());
}

static void styleAttributeGetterCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
{
    TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMGetter");
    FontFaceV8Internal::styleAttributeGetter(info);
    TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
}

static void styleAttributeSetter(v8::Local<v8::Value> v8Value, const v8::FunctionCallbackInfo<v8::Value>& info)
{
    v8::Local<v8::Object> holder = info.Holder();
    ExceptionState exceptionState(ExceptionState::SetterContext, "style", "FontFace", holder, info.GetIsolate());
    FontFace* impl = V8FontFace::toImpl(holder);
    V8StringResource<> cppValue = v8Value;
    if (!cppValue.prepare())
        return;
    ExecutionContext* executionContext = currentExecutionContext(info.GetIsolate());
    impl->setStyle(executionContext, cppValue, exceptionState);
    exceptionState.throwIfNeeded();
}

static void styleAttributeSetterCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
{
    v8::Local<v8::Value> v8Value = info[0];
    TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMSetter");
    FontFaceV8Internal::styleAttributeSetter(v8Value, info);
    TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
}

static void weightAttributeGetter(const v8::FunctionCallbackInfo<v8::Value>& info)
{
    v8::Local<v8::Object> holder = info.Holder();
    FontFace* impl = V8FontFace::toImpl(holder);
    v8SetReturnValueString(info, impl->weight(), info.GetIsolate());
}

static void weightAttributeGetterCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
{
    TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMGetter");
    FontFaceV8Internal::weightAttributeGetter(info);
    TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
}

static void weightAttributeSetter(v8::Local<v8::Value> v8Value, const v8::FunctionCallbackInfo<v8::Value>& info)
{
    v8::Local<v8::Object> holder = info.Holder();
    ExceptionState exceptionState(ExceptionState::SetterContext, "weight", "FontFace", holder, info.GetIsolate());
    FontFace* impl = V8FontFace::toImpl(holder);
    V8StringResource<> cppValue = v8Value;
    if (!cppValue.prepare())
        return;
    ExecutionContext* executionContext = currentExecutionContext(info.GetIsolate());
    impl->setWeight(executionContext, cppValue, exceptionState);
    exceptionState.throwIfNeeded();
}

static void weightAttributeSetterCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
{
    v8::Local<v8::Value> v8Value = info[0];
    TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMSetter");
    FontFaceV8Internal::weightAttributeSetter(v8Value, info);
    TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
}

static void stretchAttributeGetter(const v8::FunctionCallbackInfo<v8::Value>& info)
{
    v8::Local<v8::Object> holder = info.Holder();
    FontFace* impl = V8FontFace::toImpl(holder);
    v8SetReturnValueString(info, impl->stretch(), info.GetIsolate());
}

static void stretchAttributeGetterCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
{
    TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMGetter");
    FontFaceV8Internal::stretchAttributeGetter(info);
    TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
}

static void stretchAttributeSetter(v8::Local<v8::Value> v8Value, const v8::FunctionCallbackInfo<v8::Value>& info)
{
    v8::Local<v8::Object> holder = info.Holder();
    ExceptionState exceptionState(ExceptionState::SetterContext, "stretch", "FontFace", holder, info.GetIsolate());
    FontFace* impl = V8FontFace::toImpl(holder);
    V8StringResource<> cppValue = v8Value;
    if (!cppValue.prepare())
        return;
    ExecutionContext* executionContext = currentExecutionContext(info.GetIsolate());
    impl->setStretch(executionContext, cppValue, exceptionState);
    exceptionState.throwIfNeeded();
}

static void stretchAttributeSetterCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
{
    v8::Local<v8::Value> v8Value = info[0];
    TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMSetter");
    FontFaceV8Internal::stretchAttributeSetter(v8Value, info);
    TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
}

static void unicodeRangeAttributeGetter(const v8::FunctionCallbackInfo<v8::Value>& info)
{
    v8::Local<v8::Object> holder = info.Holder();
    FontFace* impl = V8FontFace::toImpl(holder);
    v8SetReturnValueString(info, impl->unicodeRange(), info.GetIsolate());
}

static void unicodeRangeAttributeGetterCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
{
    TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMGetter");
    FontFaceV8Internal::unicodeRangeAttributeGetter(info);
    TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
}

static void unicodeRangeAttributeSetter(v8::Local<v8::Value> v8Value, const v8::FunctionCallbackInfo<v8::Value>& info)
{
    v8::Local<v8::Object> holder = info.Holder();
    ExceptionState exceptionState(ExceptionState::SetterContext, "unicodeRange", "FontFace", holder, info.GetIsolate());
    FontFace* impl = V8FontFace::toImpl(holder);
    V8StringResource<> cppValue = v8Value;
    if (!cppValue.prepare())
        return;
    ExecutionContext* executionContext = currentExecutionContext(info.GetIsolate());
    impl->setUnicodeRange(executionContext, cppValue, exceptionState);
    exceptionState.throwIfNeeded();
}

static void unicodeRangeAttributeSetterCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
{
    v8::Local<v8::Value> v8Value = info[0];
    TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMSetter");
    FontFaceV8Internal::unicodeRangeAttributeSetter(v8Value, info);
    TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
}

static void variantAttributeGetter(const v8::FunctionCallbackInfo<v8::Value>& info)
{
    v8::Local<v8::Object> holder = info.Holder();
    FontFace* impl = V8FontFace::toImpl(holder);
    v8SetReturnValueString(info, impl->variant(), info.GetIsolate());
}

static void variantAttributeGetterCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
{
    TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMGetter");
    FontFaceV8Internal::variantAttributeGetter(info);
    TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
}

static void variantAttributeSetter(v8::Local<v8::Value> v8Value, const v8::FunctionCallbackInfo<v8::Value>& info)
{
    v8::Local<v8::Object> holder = info.Holder();
    ExceptionState exceptionState(ExceptionState::SetterContext, "variant", "FontFace", holder, info.GetIsolate());
    FontFace* impl = V8FontFace::toImpl(holder);
    V8StringResource<> cppValue = v8Value;
    if (!cppValue.prepare())
        return;
    ExecutionContext* executionContext = currentExecutionContext(info.GetIsolate());
    impl->setVariant(executionContext, cppValue, exceptionState);
    exceptionState.throwIfNeeded();
}

static void variantAttributeSetterCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
{
    v8::Local<v8::Value> v8Value = info[0];
    TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMSetter");
    FontFaceV8Internal::variantAttributeSetter(v8Value, info);
    TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
}

static void featureSettingsAttributeGetter(const v8::FunctionCallbackInfo<v8::Value>& info)
{
    v8::Local<v8::Object> holder = info.Holder();
    FontFace* impl = V8FontFace::toImpl(holder);
    v8SetReturnValueString(info, impl->featureSettings(), info.GetIsolate());
}

static void featureSettingsAttributeGetterCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
{
    TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMGetter");
    FontFaceV8Internal::featureSettingsAttributeGetter(info);
    TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
}

static void featureSettingsAttributeSetter(v8::Local<v8::Value> v8Value, const v8::FunctionCallbackInfo<v8::Value>& info)
{
    v8::Local<v8::Object> holder = info.Holder();
    ExceptionState exceptionState(ExceptionState::SetterContext, "featureSettings", "FontFace", holder, info.GetIsolate());
    FontFace* impl = V8FontFace::toImpl(holder);
    V8StringResource<> cppValue = v8Value;
    if (!cppValue.prepare())
        return;
    ExecutionContext* executionContext = currentExecutionContext(info.GetIsolate());
    impl->setFeatureSettings(executionContext, cppValue, exceptionState);
    exceptionState.throwIfNeeded();
}

static void featureSettingsAttributeSetterCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
{
    v8::Local<v8::Value> v8Value = info[0];
    TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMSetter");
    FontFaceV8Internal::featureSettingsAttributeSetter(v8Value, info);
    TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
}

static void statusAttributeGetter(const v8::FunctionCallbackInfo<v8::Value>& info)
{
    v8::Local<v8::Object> holder = info.Holder();
    FontFace* impl = V8FontFace::toImpl(holder);
    v8SetReturnValueString(info, impl->status(), info.GetIsolate());
}

static void statusAttributeGetterCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
{
    TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMGetter");
    FontFaceV8Internal::statusAttributeGetter(info);
    TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
}

static void loadedAttributeGetter(const v8::FunctionCallbackInfo<v8::Value>& info)
{
    v8::Local<v8::Object> holder = info.Holder();
    FontFace* impl = V8FontFace::toImpl(holder);
    ScriptState* scriptState = ScriptState::current(info.GetIsolate());
    v8SetReturnValue(info, impl->loaded(scriptState).v8Value());
}

static void loadedAttributeGetterCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
{
    TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMGetter");
    FontFaceV8Internal::loadedAttributeGetter(info);
    TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
}

static void loadMethod(const v8::FunctionCallbackInfo<v8::Value>& info)
{
    FontFace* impl = V8FontFace::toImpl(info.Holder());
    ScriptState* scriptState = ScriptState::current(info.GetIsolate());
    ScriptPromise result = impl->load(scriptState);
    v8SetReturnValue(info, result.v8Value());
}

static void loadMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
{
    TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod");
    FontFaceV8Internal::loadMethod(info);
    TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
}

static void constructor(const v8::FunctionCallbackInfo<v8::Value>& info)
{
    ExceptionState exceptionState(ExceptionState::ConstructionContext, "FontFace", info.Holder(), info.GetIsolate());
    if (UNLIKELY(info.Length() < 2)) {
        setMinimumArityTypeError(exceptionState, 2, info.Length());
        exceptionState.throwIfNeeded();
        return;
    }
    V8StringResource<> family;
    StringOrArrayBufferOrArrayBufferView source;
    FontFaceDescriptors descriptors;
    {
        family = info[0];
        if (!family.prepare())
            return;
        V8StringOrArrayBufferOrArrayBufferView::toImpl(info.GetIsolate(), info[1], source, exceptionState);
        if (exceptionState.throwIfNeeded())
            return;
        if (!isUndefinedOrNull(info[2]) && !info[2]->IsObject()) {
            exceptionState.throwTypeError("parameter 3 ('descriptors') is not an object.");
            exceptionState.throwIfNeeded();
            return;
        }
        V8FontFaceDescriptors::toImpl(info.GetIsolate(), info[2], descriptors, exceptionState);
        if (exceptionState.throwIfNeeded())
            return;
    }
    ExecutionContext* executionContext = currentExecutionContext(info.GetIsolate());
    RefPtrWillBeRawPtr<FontFace> impl = FontFace::create(executionContext, family, source, descriptors);
    v8::Local<v8::Object> wrapper = info.Holder();
    wrapper = impl->associateWithWrapper(info.GetIsolate(), &V8FontFace::wrapperTypeInfo, wrapper);
    v8SetReturnValue(info, wrapper);
}

} // namespace FontFaceV8Internal

static const V8DOMConfiguration::AccessorConfiguration V8FontFaceAccessors[] = {
    {"family", FontFaceV8Internal::familyAttributeGetterCallback, FontFaceV8Internal::familyAttributeSetterCallback, 0, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnPrototype, V8DOMConfiguration::CheckHolder},
    {"style", FontFaceV8Internal::styleAttributeGetterCallback, FontFaceV8Internal::styleAttributeSetterCallback, 0, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnPrototype, V8DOMConfiguration::CheckHolder},
    {"weight", FontFaceV8Internal::weightAttributeGetterCallback, FontFaceV8Internal::weightAttributeSetterCallback, 0, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnPrototype, V8DOMConfiguration::CheckHolder},
    {"stretch", FontFaceV8Internal::stretchAttributeGetterCallback, FontFaceV8Internal::stretchAttributeSetterCallback, 0, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnPrototype, V8DOMConfiguration::CheckHolder},
    {"unicodeRange", FontFaceV8Internal::unicodeRangeAttributeGetterCallback, FontFaceV8Internal::unicodeRangeAttributeSetterCallback, 0, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnPrototype, V8DOMConfiguration::CheckHolder},
    {"variant", FontFaceV8Internal::variantAttributeGetterCallback, FontFaceV8Internal::variantAttributeSetterCallback, 0, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnPrototype, V8DOMConfiguration::CheckHolder},
    {"featureSettings", FontFaceV8Internal::featureSettingsAttributeGetterCallback, FontFaceV8Internal::featureSettingsAttributeSetterCallback, 0, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnPrototype, V8DOMConfiguration::CheckHolder},
    {"status", FontFaceV8Internal::statusAttributeGetterCallback, 0, 0, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnPrototype, V8DOMConfiguration::CheckHolder},
    {"loaded", FontFaceV8Internal::loadedAttributeGetterCallback, 0, 0, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnPrototype, V8DOMConfiguration::CheckHolder},
};

static const V8DOMConfiguration::MethodConfiguration V8FontFaceMethods[] = {
    {"load", FontFaceV8Internal::loadMethodCallback, 0, 0, V8DOMConfiguration::ExposedToAllScripts},
};

void V8FontFace::constructorCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
{
    TRACE_EVENT_SCOPED_SAMPLING_STATE("blink", "DOMConstructor");
    if (!info.IsConstructCall()) {
        V8ThrowException::throwTypeError(info.GetIsolate(), ExceptionMessages::constructorNotCallableAsFunction("FontFace"));
        return;
    }

    if (ConstructorMode::current(info.GetIsolate()) == ConstructorMode::WrapExistingObject) {
        v8SetReturnValue(info, info.Holder());
        return;
    }

    FontFaceV8Internal::constructor(info);
}

static void installV8FontFaceTemplate(v8::Local<v8::FunctionTemplate> functionTemplate, v8::Isolate* isolate)
{
    functionTemplate->ReadOnlyPrototype();

    v8::Local<v8::Signature> defaultSignature;
    defaultSignature = V8DOMConfiguration::installDOMClassTemplate(isolate, functionTemplate, "FontFace", v8::Local<v8::FunctionTemplate>(), V8FontFace::internalFieldCount,
        0, 0,
        V8FontFaceAccessors, WTF_ARRAY_LENGTH(V8FontFaceAccessors),
        V8FontFaceMethods, WTF_ARRAY_LENGTH(V8FontFaceMethods));
    functionTemplate->SetCallHandler(V8FontFace::constructorCallback);
    functionTemplate->SetLength(2);
    v8::Local<v8::ObjectTemplate> instanceTemplate = functionTemplate->InstanceTemplate();
    ALLOW_UNUSED_LOCAL(instanceTemplate);
    v8::Local<v8::ObjectTemplate> prototypeTemplate = functionTemplate->PrototypeTemplate();
    ALLOW_UNUSED_LOCAL(prototypeTemplate);

    // Custom toString template
    functionTemplate->Set(v8AtomicString(isolate, "toString"), V8PerIsolateData::from(isolate)->toStringTemplate());
}

v8::Local<v8::FunctionTemplate> V8FontFace::domTemplate(v8::Isolate* isolate)
{
    return V8DOMConfiguration::domClassTemplate(isolate, const_cast<WrapperTypeInfo*>(&wrapperTypeInfo), installV8FontFaceTemplate);
}

bool V8FontFace::hasInstance(v8::Local<v8::Value> v8Value, v8::Isolate* isolate)
{
    return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, v8Value);
}

v8::Local<v8::Object> V8FontFace::findInstanceInPrototypeChain(v8::Local<v8::Value> v8Value, v8::Isolate* isolate)
{
    return V8PerIsolateData::from(isolate)->findInstanceInPrototypeChain(&wrapperTypeInfo, v8Value);
}

FontFace* V8FontFace::toImplWithTypeCheck(v8::Isolate* isolate, v8::Local<v8::Value> value)
{
    return hasInstance(value, isolate) ? toImpl(v8::Local<v8::Object>::Cast(value)) : 0;
}

ActiveDOMObject* V8FontFace::toActiveDOMObject(v8::Local<v8::Object> wrapper)
{
    return toImpl(wrapper);
}

void V8FontFace::refObject(ScriptWrappable* scriptWrappable)
{
#if !ENABLE(OILPAN)
    scriptWrappable->toImpl<FontFace>()->ref();
#endif
}

void V8FontFace::derefObject(ScriptWrappable* scriptWrappable)
{
#if !ENABLE(OILPAN)
    scriptWrappable->toImpl<FontFace>()->deref();
#endif
}

} // namespace blink


text:
@OnModule({
    @Set(types = { Single.class })
})
package br.com.objectos.way.it.on.single;

import br.com.objectos.way.on.OnModule;
import br.com.objectos.way.on.OnModule.Set;


text:
using System;
using System.Collections.Generic;
using System.IO;
using System.Reflection;
using System.Xml.Linq;

using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.Graphics;
using TiledSharp;

namespace Tesserae
{
    public class Mosaic
    {
        public Dictionary<TmxTileset, Texture2D> spriteSheet;
        public Dictionary<int, Rectangle> tileRect;
        public Dictionary<int, TmxTileset> idSheet;
        public List<int[,]> layerID;     // layerID[x,y]

        public int tMapWidth, tMapHeight;

        // Temporary
        public TmxMap map;          // TMX data (try to remove this)
        public Canvas canvas;       // Viewport details

        public Game game;
        public RenderTarget2D renderTarget;
        public SpriteBatch batch;

        public Mosaic(Game gameInput, string mapName)
        {
            // Temporary code
            game = gameInput;
            map = new TmxMap(mapName);
            tMapWidth = map.Width;
            tMapHeight = map.Height;

            // Initialize graphics buffers
            canvas = new Canvas(game);
            renderTarget = new RenderTarget2D(game.GraphicsDevice,
                                              game.GraphicsDevice.Viewport.Width,
                                              game.GraphicsDevice.Viewport.Height);

            // Load spritesheets
            spriteSheet = new Dictionary<TmxTileset, Texture2D>();
            tileRect = new Dictionary<int, Rectangle>();
            idSheet = new Dictionary<int, TmxTileset>();

            foreach (TmxTileset ts in map.Tilesets)
            {
                var newSheet = GetSpriteSheet(ts.Image.Source);
                spriteSheet.Add(ts, newSheet);

                // Loop hoisting
                var wStart = ts.Margin;
                var wInc = ts.TileWidth + ts.Spacing;
                var wEnd = newSheet.Width;

                var hStart = ts.Margin;
                var hInc = ts.TileHeight + ts.Spacing;
                var hEnd = newSheet.Height;

                // Pre-compute tileset rectangles
                var id = ts.FirstGid;
                for (var h = hStart; h < hEnd; h += hInc)
                {
                    for (var w = wStart; w < wEnd; w += wInc)
                    {
                        var rect = new Rectangle(w, h,
                                                 ts.TileWidth, ts.TileHeight);
                        idSheet.Add(id, ts);
                        tileRect.Add(id, rect);
                        id += 1;
                    }
                }

                // Ignore properties for now
            }

            // Load id maps
            layerID = new List<int[,]>();
            foreach (TmxLayer layer in map.Layers)
            {
                var idMap = new int[tMapWidth, tMapHeight];
                foreach (TmxLayerTile t in layer.Tiles)
                {
                    idMap[t.X, t.Y] = t.Gid;
                }
                layerID.Add(idMap);

                // Ignore properties for now
            }
        }

        public void DrawCanvas(SpriteBatch batch)
        {
            // Loop hoisting (Determined from Canvas)
            var iStart = Math.Max(0, canvas.tStartX);
            var iEnd = Math.Min(tMapWidth, canvas.tEndX);

            var jStart = Math.Max(0, canvas.tStartY);
            var jEnd = Math.Min(tMapHeight, canvas.tEndY);

            // Initialize the renderTarget spriteBatch
            game.GraphicsDevice.SetRenderTarget(renderTarget);
            game.GraphicsDevice.Clear(Color.CornflowerBlue);

            batch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend,
                              SamplerState.PointClamp, null, null);
            // Draw tiles inside canvas
            foreach (var idMap in layerID)
            {
                for (var i = iStart; i < iEnd; i++)
                {
                    for (var j = jStart; j < jEnd; j++)
                    {
                        var id = idMap[i,j];

                        // Skip unmapped cells
                        if (id == 0) continue;

                        // Pre-calculate? (not with tileScale in there...)
                        var position = new Vector2(
                                        map.TileWidth * canvas.tileScale * i,
                                        map.TileHeight * canvas.tileScale * j);

                        batch.Draw(spriteSheet[idSheet[id]], position,
                                tileRect[id], Color.White, 0.0f, canvas.origin,
                                canvas.tileScale, SpriteEffects.None, 0);
                    }
                }
            }
            batch.End();

            // Close render target
            game.GraphicsDevice.SetRenderTarget(null);

        }

        public Texture2D GetSpriteSheet(string filepath)
        {
            Texture2D newSheet;
            Stream imgStream;

            var asm = Assembly.GetEntryAssembly();
            var manifest = asm.GetManifestResourceNames();

            var fileResPath = filepath.Replace(
                                Path.DirectorySeparatorChar.ToString(), ".");
            var fileRes = Array.Find(manifest, s => s.EndsWith(fileResPath));
            if (fileRes != null)
                imgStream = asm.GetManifestResourceStream(fileRes);
            else
                imgStream = File.OpenRead(filepath);

            newSheet = Texture2D.FromStream(game.GraphicsDevice, imgStream);
            return newSheet;
        }
    }
}


text:
#include "libxml.h"
#ifdef LIBXML_AUTOMATA_ENABLED
#include <string.h>

#include <libxml/tree.h>
#include <libxml/xmlautomata.h>

static int scanNumber(char **ptr) {
    int ret = 0;
    char *cur;

    cur = *ptr;
    while ((*cur >= '0') && (*cur <= '9')) {
	ret = ret * 10 + (*cur - '0');
	cur++;
    }
    *ptr = cur;
    return(ret);
}

static void
testRegexpFile(const char *filename) {
    FILE *input;
    char expr[5000];
    int len;
    int ret;
    int i;
    xmlAutomataPtr am;
    xmlAutomataStatePtr states[1000];
    xmlRegexpPtr regexp = NULL;
    xmlRegExecCtxtPtr exec = NULL;

    for (i = 0;i<1000;i++)
	states[i] = NULL;

    input = fopen(filename, "r");
    if (input == NULL) {
        xmlGenericError(xmlGenericErrorContext,
		"Cannot open %s for reading\n", filename);
	return;
    }

    am = xmlNewAutomata();
    if (am == NULL) {
        xmlGenericError(xmlGenericErrorContext,
		"Cannot create automata\n");
	fclose(input);
	return;
    }
    states[0] = xmlAutomataGetInitState(am);
    if (states[0] == NULL) {
        xmlGenericError(xmlGenericErrorContext,
		"Cannot get start state\n");
	xmlFreeAutomata(am);
	fclose(input);
	return;
    }
    ret = 0;

    while (fgets(expr, 4500, input) != NULL) {
	if (expr[0] == '#')
	    continue;
	len = strlen(expr);
	len--;
	while ((len >= 0) &&
	       ((expr[len] == '\n') || (expr[len] == '\t') ||
		(expr[len] == '\r') || (expr[len] == ' '))) len--;
	expr[len + 1] = 0;
	if (len >= 0) {
	    if ((am != NULL) && (expr[0] == 't') && (expr[1] == ' ')) {
		char *ptr = &expr[2];
		int from, to;

		from = scanNumber(&ptr);
		if (*ptr != ' ') {
		    xmlGenericError(xmlGenericErrorContext,
			    "Bad line %s\n", expr);
		    break;
		}
		if (states[from] == NULL)
		    states[from] = xmlAutomataNewState(am);
		ptr++;
		to = scanNumber(&ptr);
		if (*ptr != ' ') {
		    xmlGenericError(xmlGenericErrorContext,
			    "Bad line %s\n", expr);
		    break;
		}
		if (states[to] == NULL)
		    states[to] = xmlAutomataNewState(am);
		ptr++;
		xmlAutomataNewTransition(am, states[from], states[to],
			                 BAD_CAST ptr, NULL);
	    } else if ((am != NULL) && (expr[0] == 'e') && (expr[1] == ' ')) {
		char *ptr = &expr[2];
		int from, to;

		from = scanNumber(&ptr);
		if (*ptr != ' ') {
		    xmlGenericError(xmlGenericErrorContext,
			    "Bad line %s\n", expr);
		    break;
		}
		if (states[from] == NULL)
		    states[from] = xmlAutomataNewState(am);
		ptr++;
		to = scanNumber(&ptr);
		if (states[to] == NULL)
		    states[to] = xmlAutomataNewState(am);
		xmlAutomataNewEpsilon(am, states[from], states[to]);
	    } else if ((am != NULL) && (expr[0] == 'f') && (expr[1] == ' ')) {
		char *ptr = &expr[2];
		int state;

		state = scanNumber(&ptr);
		if (states[state] == NULL) {
		    xmlGenericError(xmlGenericErrorContext,
			    "Bad state %d : %s\n", state, expr);
		    break;
		}
		xmlAutomataSetFinalState(am, states[state]);
	    } else if ((am != NULL) && (expr[0] == 'c') && (expr[1] == ' ')) {
		char *ptr = &expr[2];
		int from, to;
		int min, max;

		from = scanNumber(&ptr);
		if (*ptr != ' ') {
		    xmlGenericError(xmlGenericErrorContext,
			    "Bad line %s\n", expr);
		    break;
		}
		if (states[from] == NULL)
		    states[from] = xmlAutomataNewState(am);
		ptr++;
		to = scanNumber(&ptr);
		if (*ptr != ' ') {
		    xmlGenericError(xmlGenericErrorContext,
			    "Bad line %s\n", expr);
		    break;
		}
		if (states[to] == NULL)
		    states[to] = xmlAutomataNewState(am);
		ptr++;
		min = scanNumber(&ptr);
		if (*ptr != ' ') {
		    xmlGenericError(xmlGenericErrorContext,
			    "Bad line %s\n", expr);
		    break;
		}
		ptr++;
		max = scanNumber(&ptr);
		if (*ptr != ' ') {
		    xmlGenericError(xmlGenericErrorContext,
			    "Bad line %s\n", expr);
		    break;
		}
		ptr++;
		xmlAutomataNewCountTrans(am, states[from], states[to],
			                 BAD_CAST ptr, min, max, NULL);
	    } else if ((am != NULL) && (expr[0] == '-') && (expr[1] == '-')) {
		/* end of the automata */
		regexp = xmlAutomataCompile(am);
		xmlFreeAutomata(am);
		am = NULL;
		if (regexp == NULL) {
		    xmlGenericError(xmlGenericErrorContext,
			    "Failed to compile the automata");
		    break;
		}
	    } else if ((expr[0] == '=') && (expr[1] == '>')) {
		if (regexp == NULL) {
		    printf("=> failed not compiled\n");
		} else {
		    if (exec == NULL)
			exec = xmlRegNewExecCtxt(regexp, NULL, NULL);
		    if (ret == 0) {
			ret = xmlRegExecPushString(exec, NULL, NULL);
		    }
		    if (ret == 1)
			printf("=> Passed\n");
		    else if ((ret == 0) || (ret == -1))
			printf("=> Failed\n");
		    else if (ret < 0)
			printf("=> Error\n");
		    xmlRegFreeExecCtxt(exec);
		    exec = NULL;
		}
		ret = 0;
	    } else if (regexp != NULL) {
		if (exec == NULL)
		    exec = xmlRegNewExecCtxt(regexp, NULL, NULL);
		ret = xmlRegExecPushString(exec, BAD_CAST expr, NULL);
	    } else {
		xmlGenericError(xmlGenericErrorContext,
			"Unexpected line %s\n", expr);
	    }
	}
    }
    fclose(input);
    if (regexp != NULL)
	xmlRegFreeRegexp(regexp);
    if (exec != NULL)
	xmlRegFreeExecCtxt(exec);
    if (am != NULL)
	xmlFreeAutomata(am);
}

int main(int argc, char **argv) {

    xmlInitMemory();

    if (argc == 1) {
	int ret;
	xmlAutomataPtr am;
	xmlAutomataStatePtr start, cur;
	xmlRegexpPtr regexp;
	xmlRegExecCtxtPtr exec;

	am = xmlNewAutomata();
	start = xmlAutomataGetInitState(am);

	/* generate a[ba]*a */
	cur = xmlAutomataNewTransition(am, start, NULL, BAD_CAST"a", NULL);
	xmlAutomataNewTransition(am, cur, cur, BAD_CAST"b", NULL);
	xmlAutomataNewTransition(am, cur, cur, BAD_CAST"a", NULL);
	cur = xmlAutomataNewCountTrans(am, cur, NULL, BAD_CAST"a", 2, 3, NULL);
	xmlAutomataSetFinalState(am, cur);

	/* compile it in a regexp and free the automata */
	regexp = xmlAutomataCompile(am);
	xmlFreeAutomata(am);

	/* test the regexp */
	xmlRegexpPrint(stdout, regexp);
	exec = xmlRegNewExecCtxt(regexp, NULL, NULL);
	ret = xmlRegExecPushString(exec, BAD_CAST"a", NULL);
	if (ret == 1)
	    printf("final\n");
	else if (ret < 0)
	    printf("error\n");
	ret =xmlRegExecPushString(exec, BAD_CAST"a", NULL);
	if (ret == 1)
	    printf("final\n");
	else if (ret < 0)
	    printf("error\n");
	ret =xmlRegExecPushString(exec, BAD_CAST"b", NULL);
	if (ret == 1)
	    printf("final\n");
	else if (ret < 0)
	    printf("error\n");
	ret =xmlRegExecPushString(exec, BAD_CAST"a", NULL);
	if (ret == 1)
	    printf("final\n");
	else if (ret < 0)
	    printf("error\n");
	ret =xmlRegExecPushString(exec, BAD_CAST"a", NULL);
	if (ret == 1)
	    printf("final\n");
	else if (ret < 0)
	    printf("error\n");
	ret =xmlRegExecPushString(exec, BAD_CAST"a", NULL);
	if (ret == 1)
	    printf("final\n");
	else if (ret < 0)
	    printf("error\n");
	ret =xmlRegExecPushString(exec, BAD_CAST"a", NULL);
	if (ret == 1)
	    printf("final\n");
	else if (ret < 0)
	    printf("error\n");
	if (ret == 0) {
	    ret = xmlRegExecPushString(exec, NULL, NULL);
	    if (ret == 1)
		printf("final\n");
	    else if (ret < 0)
		printf("error\n");
	}
	xmlRegFreeExecCtxt(exec);

	/* free the regexp */
	xmlRegFreeRegexp(regexp);
    } else {
	int i;

	for (i = 1;i < argc;i++)
	    testRegexpFile(argv[i]);
    }

    xmlCleanupParser();
    xmlMemoryDump();
    return(0);
}

#else
#include <stdio.h>
int main(int argc ATTRIBUTE_UNUSED, char **argv ATTRIBUTE_UNUSED) {
    printf("%s : Automata support not compiled in\n", argv[0]);
    return(0);
}
#endif /* LIBXML_AUTOMATA_ENABLED */


text:
While doing C and C++ development, finding appropriate header files may result in tedious web queries.
To avoid this silliness, the following commands may be used to search the web for headers.

## Locating within which Ubuntu package a header lives

```sh
# obtain and update cache
sudo apt install apt-file
apt-file update

# search for the header "Python.h"
apt-file -x search "/Python.h$"

# search for header "boost/filesystem.hpp"
apt-file -x search "/boost/filesystem.hpp$"

# show information about an Ubuntu package
apt-cache show libboost1.58-dev

# when installed, show all files in a package
dpkg -L libpython3.5-dev
```


text:
package org.hope6537.controller;

import com.alibaba.fastjson.JSONException;
import com.alibaba.fastjson.JSONObject;
import org.hope6537.annotation.WatchedAuthRequest;
import org.hope6537.annotation.WatchedNoAuthRequest;
import org.hope6537.dto.FeedbackDto;
import org.hope6537.entity.Response;
import org.hope6537.entity.ResultSupport;
import org.hope6537.page.PageMapUtil;
import org.hope6537.rest.utils.ResponseDict;
import org.hope6537.service.FeedbackService;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.util.List;

import static com.google.common.base.Preconditions.checkNotNull;

/**
 * 默认RESTFul API实现类
 * Created by hope6537 by Code Generator
 */
@CrossOrigin(maxAge = 3600)
@Controller
@RequestMapping("/feedback/")
@EnableAutoConfiguration
public class FeedbackController {

    @Resource(name = "feedbackService")
    private FeedbackService feedbackService;

    @WatchedAuthRequest
    @RequestMapping(value = "post", method = RequestMethod.POST)
    @ResponseBody
    public Response postFeedbackData(HttpServletRequest request, @RequestBody String receiveData) {
        //获取设备信息
        try {
            checkNotNull(receiveData, ResponseDict.ILLEGAL_PARAM);
            JSONObject dataMap = (JSONObject) request.getAttribute("dataMap");
            if (dataMap == null) {
                Object errorResponse = request.getAttribute("errorResponse");
                return errorResponse != null ? (Response) errorResponse : Response.getInstance(false).setReturnMsg(ResponseDict.UNKNOWN_ERROR);
            }
            //--公共部分完成--
            FeedbackDto feedbackDto = dataMap.getObject("postObject", FeedbackDto.class);
            //判断feedbackDto是否合法,还需要校验其他字段
            checkNotNull(feedbackDto, ResponseDict.ILLEGAL_REQUEST);
            ResultSupport<Integer> operationResult = feedbackService.addFeedback(feedbackDto);
            return Response.getInstance(operationResult.isSuccess()).addAttribute("result", operationResult.getModule());
        } catch (JSONException jsonException) {
            return Response.getInstance(false).setReturnMsg(ResponseDict.ILLEGAL_PARAM);
        } catch (Exception e) {
            e.printStackTrace();
            return Response.getInstance(false).setReturnMsg(e.getMessage());
        }
    }

    @WatchedAuthRequest
    @RequestMapping(value = "put", method = RequestMethod.PUT)
    @ResponseBody
    public Response putFeedbackData(HttpServletRequest request, @RequestBody String receiveData) {
        try {
            checkNotNull(receiveData, ResponseDict.ILLEGAL_PARAM);
            JSONObject dataMap = (JSONObject) request.getAttribute("dataMap");
            if (dataMap == null) {
                Object errorResponse = request.getAttribute("errorResponse");
                return errorResponse != null ? (Response) errorResponse : Response.getInstance(false).setReturnMsg(ResponseDict.UNKNOWN_ERROR);
            }
            FeedbackDto feedbackDto = dataMap.getObject("putObject", FeedbackDto.class);
            //判断feedbackDto是否合法,还需要校验其他字段
            checkNotNull(feedbackDto, ResponseDict.ILLEGAL_REQUEST);
            checkNotNull(feedbackDto.getId(), ResponseDict.ILLEGAL_REQUEST);
            ResultSupport<Integer> operationResult = feedbackService.modifyFeedback(feedbackDto);
            return Response.getInstance(operationResult.isSuccess()).addAttribute("result", operationResult.getModule());
        } catch (JSONException jsonException) {
            return Response.getInstance(false).setReturnMsg(ResponseDict.ILLEGAL_PARAM);
        } catch (Exception e) {
            e.printStackTrace();
            return Response.getInstance(false).setReturnMsg(e.getMessage());
        }

    }

    @WatchedAuthRequest
    @RequestMapping(value = "delete", method = RequestMethod.DELETE)
    @ResponseBody
    public Response deleteFeedbackData(HttpServletRequest request, @RequestBody String receiveData) {
        try {
            checkNotNull(receiveData, ResponseDict.ILLEGAL_PARAM);
            JSONObject dataMap = (JSONObject) request.getAttribute("dataMap");
            if (dataMap == null) {
                Object errorResponse = request.getAttribute("errorResponse");
                return errorResponse != null ? (Response) errorResponse : Response.getInstance(false).setReturnMsg(ResponseDict.UNKNOWN_ERROR);
            }
            FeedbackDto feedbackDto = dataMap.getObject("deleteObject", FeedbackDto.class);
            //判断feedbackDto是否合法,还需要校验其他字段
            checkNotNull(feedbackDto, ResponseDict.ILLEGAL_REQUEST);
            checkNotNull(feedbackDto.getId(), ResponseDict.ILLEGAL_REQUEST);
            ResultSupport<Integer> operationResult = feedbackService.removeFeedback(feedbackDto.getId());
            return Response.getInstance(operationResult.isSuccess()).addAttribute("result", operationResult.getModule());
        } catch (JSONException jsonException) {
            return Response.getInstance(false).setReturnMsg(ResponseDict.ILLEGAL_PARAM);
        } catch (Exception e) {
            e.printStackTrace();
            return Response.getInstance(false).setReturnMsg(e.getMessage());
        }

    }

    @WatchedNoAuthRequest
    @RequestMapping(value = "get", method = RequestMethod.GET)
    @ResponseBody
    public Response getFeedbackData(HttpServletRequest request) {
        try {
            JSONObject dataMap = (JSONObject) request.getAttribute("dataMap");
            if (dataMap == null) {
                Object errorResponse = request.getAttribute("errorResponse");
                return errorResponse != null ? (Response) errorResponse : Response.getInstance(false).setReturnMsg(ResponseDict.UNKNOWN_ERROR);
            }
            FeedbackDto feedbackDto = dataMap.getObject("feedback", FeedbackDto.class);
            //判断feedbackDto是否合法,还需要校验其他字段
            checkNotNull(feedbackDto, ResponseDict.ILLEGAL_REQUEST);
            checkNotNull(feedbackDto.getId(), ResponseDict.ILLEGAL_REQUEST);
            ResultSupport<FeedbackDto> result = feedbackService.getFeedbackById(feedbackDto.getId());
            return Response.getInstance(result.isSuccess()).addAttribute("result", result.getModule());
        } catch (JSONException jsonException) {
            return Response.getInstance(false).setReturnMsg(ResponseDict.ILLEGAL_PARAM);
        } catch (Exception e) {
            e.printStackTrace();
            return Response.getInstance(false).setReturnMsg(e.getMessage());
        }

    }

    @WatchedNoAuthRequest
    @RequestMapping(value = "fetch", method = RequestMethod.GET)
    @ResponseBody
    public Response fetchFeedbackData(HttpServletRequest request) {
        try {
            JSONObject dataMap = (JSONObject) request.getAttribute("dataMap");
            if (dataMap == null) {
                Object errorResponse = request.getAttribute("errorResponse");
                return errorResponse != null ? (Response) errorResponse : Response.getInstance(false).setReturnMsg(ResponseDict.UNKNOWN_ERROR);
            }
            //验证完成,开始查询
            FeedbackDto query = PageMapUtil.getQuery(dataMap.getString("fetchObject"), dataMap.getString("pageMap"), FeedbackDto.class);
            ResultSupport<List<FeedbackDto>> feedbackListByQuery = feedbackService.getFeedbackListByQuery(query);
            return Response.getInstance(feedbackListByQuery.isSuccess())
                    .addAttribute("result", feedbackListByQuery.getModule())
                    .addAttribute("isEnd", feedbackListByQuery.getTotalCount() < query.getPageSize() * query.getCurrentPage())
                    .addAttribute("pageMap", PageMapUtil.sendNextPage(query));
        } catch (JSONException e) {
            return Response.getInstance(false).setReturnMsg(ResponseDict.ILLEGAL_PARAM);
        } catch (Exception e) {
            e.printStackTrace();
            return Response.getInstance(false).setReturnMsg(e.getMessage());
        }
    }

}


text:
<?php

namespace Core\Entity;

use Doctrine\ORM\Mapping as ORM;

/**
 * AclActions
 *
 * @ORM\Table(name="saa.acl_actions", uniqueConstraints={@ORM\UniqueConstraint(name="acl_actions_action_key", columns={"action"})})
 * @ORM\Entity
 */
class AclActions
{
    /**
     * @var integer
     *
     * @ORM\Column(name="id", type="integer", nullable=false)
     * @ORM\Id
     * @ORM\GeneratedValue(strategy="SEQUENCE")
     * @ORM\SequenceGenerator(sequenceName="acl_actions_id_seq", allocationSize=1, initialValue=1)
     */
    private $id;

    /**
     * @var string
     *
     * @ORM\Column(name="action", type="string", length=50, nullable=false)
     */
    private $action;

    /**
     * Get id
     *
     * @return integer
     */
    public function getId()
    {
        return $this->id;
    }

    /**
     * Set action
     *
     * @param string $action
     * @return AclActions
     */
    public function setAction($action)
    {
        $this->action = $action;

        return $this;
    }

    /**
     * Get action
     *
     * @return string
     */
    public function getAction()
    {
        return $this->action;
    }
}


text:
<?xml version="1.0"?>
<!DOCTYPE sect2 SYSTEM "/src/Docs/DocBookManuals/docbookx.dtd">
<sect2>
	 <sect2info><date>Friday, April 02, 2004 09:30:52</date>
	 </sect2info>
	 <title>iBitwiseOr</title>
	 <para></para>
	 <bridgehead renderas="sect3">Remarks</bridgehead>
	 <para><symbol>|</symbol> is the parser recognized symbol for this operator.
		  <symbol>|</symbol> is the vertical bar, also known as the pipe. <symbol>Bitwise
		  Or</symbol> matches bit for bit, and compares the corresponding bits for two
		  values. If both are 0, then the corresponding bit in the resulting value will
		  be 0, otherwise it will be 1.</para>
	 <example>
		  <title>Example</title>
		  <programlisting>create table BitwiseOr { One : Integer, Two : Integer, Three : Integer };
begin
	var LInteger1 : Integer;
	var LInteger2 : Integer;
	var LInteger3 : Integer;
	LInteger1 := 314159265; // this has a bit value of 00010010 10111001 10110000 10100001
	LInteger2 := 271828182; // this has a bit value of 00010000 00110011 11000100 11010110
	LInteger3 := LInteger1 | LInteger2; // 314307831   00010010 10111011 11110100 11110111
	insert table { row { LInteger1 One, LInteger2 Two, LInteger3 Three }} into BitwiseOr;
end;
select BitwiseOr;</programlisting>
		  <programlisting>Statement Executed Successfully!

Statement Executed Successfully!

One       Two       Three
--------- --------- ---------
314159265 271828182 314307831</programlisting>
	 </example>
	 <formalpara>
		  <title>See Also</title>
		  <para>
				<literallayout><ulink url="D4LGOperatorPrecedence.html">Operator Precedence</ulink>
<ulink url="SLRiOr.html">iOr (<symbol>or</symbol>)</ulink></literallayout></para>
	 </formalpara>
</sect2>


text:
r"""
This code was generated by
\ / _    _  _|   _  _
 | (_)\/(_)(_|\/| |(/_  v1.0.0
      /       /
"""

from tests import IntegrationTestCase
from tests.holodeck import Request
from twilio.base.exceptions import TwilioException
from twilio.http.response import Response

class DialogueTestCase(IntegrationTestCase):

    def test_fetch_request(self):
        self.holodeck.mock(Response(500, ''))

        with self.assertRaises(TwilioException):
            self.client.preview.understand.assistants("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX") \
                                          .dialogues("UKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()

        self.holodeck.assert_has_request(Request(
            'get',
            'https://preview.twilio.com/understand/Assistants/UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Dialogues/UKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX',
        ))

    def test_fetch_response(self):
        self.holodeck.mock(Response(
            200,
            '''
            {
                "account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
                "assistant_sid": "UAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
                "sid": "UKkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk",
                "url": "https://preview.twilio.com/understand/Assistants/UAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Dialogues/UKkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk",
                "data": {}
            }
            '''
        ))

        actual = self.client.preview.understand.assistants("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX") \
                                               .dialogues("UKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()

        self.assertIsNotNone(actual)


text:
<!DOCTYPE animal [
<!ELEMENT animal ANY>
<?ᅤ an only legal per 5th edition char #x1164
 in PITarget ?>
]>
<animal/>


text:
package org.onosproject.net.resource;

import com.google.common.annotations.Beta;

/**
 * Factory class for continuous-type resource related instances.
 */
@Beta
public final class ContinuousFactory {
    private final ContinuousResourceId id;

    /**
     * Creates an instance with the specified resource ID.
     *
     * @param id resource ID that is associated with the resource related instances
     *           which will be created from this instance
     */
    ContinuousFactory(ContinuousResourceId id) {
        this.id = id;
    }

    /**
     * Returns the resource ID for continuous-type.
     *
     * @return continuous-type resource ID
     */
    public ContinuousResourceId id() {
        return id;
    }

    /**
     * Returns the resource for continuous-type specified by the given value.
     *
     * @param volume volume of the returned resource
     * @return continuous-type resource
     */
    public ContinuousResource resource(double volume) {
        return new ContinuousResource(id(), volume);
    }
}


text:
package org.onceatime.cl;

import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.Arrays;
import java.util.HashSet;
import java.util.Set;

public class Cl extends ClassLoader {
    private Set<String> l;

    public Cl(ClassLoader p, String... strings) {
        super(p);

        this.l = new HashSet<String>(Arrays.asList(strings));
    }

    @Override
    public Class<?> loadClass(String name) throws ClassNotFoundException {
        System.out.println("Load class:" + name);

        if (!l.contains(name))
            return super.loadClass(name);

        byte[] data = readData(this.getResourceAsStream(name.replace('.', '/') + ".class"));
        return this.defineClass(null, data, 0, data.length);
    }

    private static byte[] readData(InputStream is) {
        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        byte[] buf = new byte[1000];
        try {
            int c;
            while ((c = is.read(buf)) != -1) {
                baos.write(buf, 0, c);
            }
        } catch (IOException e) {
            throw new RuntimeException(e);
        }

        return baos.toByteArray();
    }

}


text:
export PATH=$HOME/.local/bin:/usr/local/bin:$HOME/prefix/bin:$HOME/APM/px4/gcc-arm-none-eabi-4_6-2012q2/bin:$PATH
export PYTHONUNBUFFERED=1
export PYTHONPATH=$HOME/APM

cd $HOME/APM || exit 1

test -n "$FORCEBUILD" || {
(cd APM && git fetch > /dev/null 2>&1)

newtags=$(cd APM && git fetch --tags | wc -l)
oldhash=$(cd APM && git rev-parse origin/master)
newhash=$(cd APM && git rev-parse HEAD)

newtagspx4=$(cd PX4Firmware && git fetch --tags | wc -l)
oldhashpx4=$(cd PX4Firmware && git rev-parse origin/master)
newhashpx4=$(cd PX4Firmware && git rev-parse HEAD)

newtagsnuttx=$(cd PX4NuttX && git fetch --tags | wc -l)
oldhashnuttx=$(cd PX4NuttX && git rev-parse origin/master)
newhashnuttx=$(cd PX4NuttX && git rev-parse HEAD)

if [ "$oldhash" = "$newhash" -a "$newtags" = "0" -a "$oldhashpx4" = "$newhashpx4" -a "$newtagspx4" = "0" -a "$oldhashnuttx" = "$newhashnuttx" -a "$newtagsnuttx" = "0" ]; then
    echo "no change $oldhash $newhash `date`" >> build.log
    exit 0
fi
}

############################
# grab a lock file. Not atomic, but close :)
# tries to cope with NFS
lock_file() {
        lck="$1"
        pid=`cat "$lck" 2> /dev/null`

        if test -f "$lck" && kill -0 $pid 2> /dev/null; then
	    LOCKAGE=$(($(date +%s) - $(stat -c '%Y' "build.lck")))
	    test $LOCKAGE -gt 7200 && {
                echo "old lock file $lck is valid for $pid with age $LOCKAGE seconds"
	    }
            return 1
        fi
        /bin/rm -f "$lck"
        echo "$$" > "$lck"
        return 0
}

lock_file build.lck || {
    exit 1
}

#ulimit -m 500000
#ulimit -s 500000
#ulimit -t 1800
#ulimit -v 500000

(
date

report() {
    d="$1"
    old="$2"
    new="$3"
    cat <<EOF | mail -s 'build failed' drones-discuss@googlegroups.com
A build of $d failed at `date`

You can view the build logs at http://autotest.diydrones.com/

A log of the commits since the last attempted build is below

`git log $old $new`
EOF
}

report_pull_failure() {
    d="$1"
    git show origin/master | mail -s 'APM pull failed' drones-discuss@googlegroups.com
    exit 1
}

oldhash=$(cd APM && git rev-parse HEAD)

pushd APM
git pull || report_pull_failure
git clean -f -f -x -d -d
git tag autotest-$(date '+%Y-%m-%d-%H%M%S') -m "test tag `date`"
cp ../config.mk .
popd

rsync -a APM/Tools/autotest/web-firmware/ buildlogs/binaries/

pushd PX4Firmware
git fetch origin
git reset --hard origin/master
for v in ArduPlane ArduCopter APMrover2; do
    git tag -d $v-beta || true
    git tag -d $v-stable || true
done
git fetch origin --tags
git show
popd

pushd PX4NuttX
git fetch origin
git reset --hard origin/master
for v in ArduPlane ArduCopter APMrover2; do
    git tag -d $v-beta || true
    git tag -d $v-stable || true
done
git fetch origin --tags
git show
popd

echo "Updating pymavlink"
pushd mavlink/pymavlink
git fetch origin
git reset --hard origin/master
git show
python setup.py build install --user
popd

echo "Updating MAVProxy"
pushd MAVProxy
git fetch origin
git reset --hard origin/master
git show
python setup.py build install --user
popd

githash=$(cd APM && git rev-parse HEAD)
hdate=$(date +"%Y-%m-%d-%H:%m")

for d in ArduPlane ArduCopter APMrover2; do
    pushd APM/$d
    rm -rf ../../buildlogs/$d.build
    (date && TMPDIR=../../buildlogs make) > ../../buildlogs/$d.txt 2>&1
    status=$?
    if [ $status != 0 ]; then
	report $d $oldhash $newhash
    fi
    popd
    APM/Tools/scripts/frame_sizes.py buildlogs/$d.build > buildlogs/$d.framesizes.txt
    (
	avr-size buildlogs/$d.build/$d.elf
	avr-nm --size-sort --print-size -C buildlogs/$d.build/$d.elf
    ) > buildlogs/$d.sizes.txt
done

mkdir -p "buildlogs/history/$hdate"
(cd buildlogs && cp -f *.txt *.flashlog *.tlog *.km[lz] *.gpx *.html *.png "history/$hdate/")
echo $githash > "buildlogs/history/$hdate/githash.txt"

(cd APM && Tools/scripts/build_parameters.sh)

(cd APM && Tools/scripts/build_docs.sh)

killall -9 JSBSim || /bin/true

timelimit 7500 APM/Tools/autotest/autotest.py --timeout=7000 > buildlogs/autotest-output.txt 2>&1

) >> build.log 2>&1


text:
layout: post
title: "About"
distance-from-core: 1
quadrant: 3
record-url:
- https://docs.google.com/document/d/1o6b0DAx-7Z6-kwlKv_u2_z1v3ktfkCwlKoGZAloxr60
analytics-url:
- to-come
constituent-pages:
- /about
- /about/leadership
- /about/funding
- /about/background
- /about/our-impact
- /about/women-in-science
goals:
- 1. Encourage exploration of /about and all EMBL-EBI pages
- 2. Elevate EBI's reputation
- 3. Communicate and enhance confidence in management and value of EMBL-EBI
- 4. Understand what EBI is and how it works
audience:
- General visitor to EMBL-EBI
- Visitor familiar with EMBL-EBI
- Scientist new to EMBL-EBI
- Scientist familiar with EMBL-EBI
- Funder or industry partner
paths-in:
- Direct traffic/bookmark
- Web search (Google)
- Social media
- Press releases
- E-mail
- www.ebi.ac.uk/
paths-out:
- www.ebi.ac.uk/research
- www.ebi.ac.uk/industry
- www.ebi.ac.uk/services
- www.ebi.ac.uk/about/our-impact
- Explore the website
outside: 7
emotional: 5
---

To educate on what EMBL-EBI is, its mission areas, and sell EMBL-EBI as " international, innovative and interdisciplinary, and a champion of open data in the life sciences".


text:
package org.apache.arrow.flight.example.integration;

import java.io.File;
import java.io.IOException;
import java.util.Collections;
import java.util.List;

import org.apache.arrow.flight.FlightClient;
import org.apache.arrow.flight.FlightDescriptor;
import org.apache.arrow.flight.FlightEndpoint;
import org.apache.arrow.flight.FlightInfo;
import org.apache.arrow.flight.FlightStream;
import org.apache.arrow.flight.Location;
import org.apache.arrow.memory.BufferAllocator;
import org.apache.arrow.memory.RootAllocator;
import org.apache.arrow.vector.VectorLoader;
import org.apache.arrow.vector.VectorSchemaRoot;
import org.apache.arrow.vector.VectorUnloader;
import org.apache.arrow.vector.ipc.JsonFileReader;
import org.apache.arrow.vector.util.Validator;
import org.apache.commons.cli.CommandLine;
import org.apache.commons.cli.CommandLineParser;
import org.apache.commons.cli.DefaultParser;
import org.apache.commons.cli.Options;
import org.apache.commons.cli.ParseException;

/**
 * An Example Flight Server that provides access to the InMemoryStore.
 */
class IntegrationTestClient {
  private static final org.slf4j.Logger LOGGER = org.slf4j.LoggerFactory.getLogger(IntegrationTestClient.class);
  private final Options options;

  private IntegrationTestClient() {
    options = new Options();
    options.addOption("j", "json", true, "json file");
    options.addOption("host", true, "The host to connect to.");
    options.addOption("port", true, "The port to connect to.");
  }

  public static void main(String[] args) {
    try {
      new IntegrationTestClient().run(args);
    } catch (ParseException e) {
      fatalError("Invalid parameters", e);
    } catch (IOException e) {
      fatalError("Error accessing files", e);
    }
  }

  private static void fatalError(String message, Throwable e) {
    System.err.println(message);
    System.err.println(e.getMessage());
    LOGGER.error(message, e);
    System.exit(1);
  }

  private void run(String[] args) throws ParseException, IOException {
    final CommandLineParser parser = new DefaultParser();
    final CommandLine cmd = parser.parse(options, args, false);

    final String host = cmd.getOptionValue("host", "localhost");
    final int port = Integer.parseInt(cmd.getOptionValue("port", "31337"));

    final BufferAllocator allocator = new RootAllocator(Integer.MAX_VALUE);
    final FlightClient client = new FlightClient(allocator, new Location(host, port));

    final String inputPath = cmd.getOptionValue("j");

    // 1. Read data from JSON and upload to server.
    FlightDescriptor descriptor = FlightDescriptor.path(inputPath);
    VectorSchemaRoot jsonRoot;
    try (JsonFileReader reader = new JsonFileReader(new File(inputPath), allocator);
         VectorSchemaRoot root = VectorSchemaRoot.create(reader.start(), allocator)) {
      jsonRoot = VectorSchemaRoot.create(root.getSchema(), allocator);
      VectorUnloader unloader = new VectorUnloader(root);
      VectorLoader jsonLoader = new VectorLoader(jsonRoot);
      FlightClient.ClientStreamListener stream = client.startPut(descriptor, root);
      while (reader.read(root)) {
        stream.putNext();
        jsonLoader.load(unloader.getRecordBatch());
        root.clear();
      }
      stream.completed();
      // Need to call this, or exceptions from the server get swallowed
      stream.getResult();
    }

    // 2. Get the ticket for the data.
    FlightInfo info = client.getInfo(descriptor);
    List<FlightEndpoint> endpoints = info.getEndpoints();
    if (endpoints.isEmpty()) {
      throw new RuntimeException("No endpoints returned from Flight server.");
    }

    for (FlightEndpoint endpoint : info.getEndpoints()) {
      // 3. Download the data from the server.
      List<Location> locations = endpoint.getLocations();
      if (locations.size() == 0) {
        locations = Collections.singletonList(new Location(host, port));
      }
      for (Location location : locations) {
        System.out.println("Verifying location " + location.getHost() + ":" + location.getPort());
        FlightClient readClient = new FlightClient(allocator, location);
        FlightStream stream = readClient.getStream(endpoint.getTicket());
        VectorSchemaRoot downloadedRoot;
        try (VectorSchemaRoot root = stream.getRoot()) {
          downloadedRoot = VectorSchemaRoot.create(root.getSchema(), allocator);
          VectorLoader loader = new VectorLoader(downloadedRoot);
          VectorUnloader unloader = new VectorUnloader(root);
          while (stream.next()) {
            loader.load(unloader.getRecordBatch());
          }
        }

        // 4. Validate the data.
        Validator.compareVectorSchemaRoot(jsonRoot, downloadedRoot);
      }
    }
  }
}