text:
<?hh // partial
// Because of PSR HTTP Message

namespace Titon\Http\Stream;

use Psr\Http\Message\StreamableInterface;
use Titon\Common\CacheMap;

/**
 * Defines shared functionality for an HTTP resource stream.
 *
 * @package Titon\Http\Stream
 */
abstract class AbstractStream implements StreamableInterface {

    /**
     * Cached meta data.
     *
     * @var \Titon\Common\CacheMap
     */
    protected CacheMap $cache = Map {};

    /**
     * The stream resource.
     *
     * @var resource
     */
    protected ?resource $stream;

    /**
     * Close the resource on destruction.
     */
    public function __destruct() {
        $this->close();
    }

    /**
     * {@inheritdoc}
     */
    public function __toString(): string {
        return $this->getContents();
    }

    /**
     * Build a meta cache for the current stream.
     *
     * @return $this
     */
    public function buildCache(): this {
        $cache = stream_get_meta_data($this->getStream());
        $cache['local'] = stream_is_local($this->getStream());

        $mode = str_replace('b', '', $cache['mode']);

        $cache['readable'] = !in_array($mode, ['w', 'a', 'x', 'c']);
        $cache['writable'] = ($mode !== 'r');

        $this->cache = new Map($cache);

        return $this;
    }

    /**
     * {@inheritdoc}
     */
    public function close(): bool {
        if (is_resource($this->getStream()) && fclose($this->getStream())) {
            $this->cache['readable'] = false;
            $this->cache['writable'] = false;

            return true;
        }

        return false;
    }

    /**
     * {@inheritdoc}
     */
    public function detach(): ?resource {
        $resource = $this->stream;

        $this->stream = null;

        return $resource;
    }

    /**
     * {@inheritdoc}
     */
    public function eof(): bool {
        return feof($this->getStream());
    }

    /**
     * Return the cached meta data.
     *
     * @return \Titon\Common\CacheMap
     */
    public function getCache(): CacheMap {
        return $this->cache;
    }

    /**
     * {@inheritdoc}
     */
    public function getContents($maxLength = -1): string {
        if (!$this->isReadable() || (!$this->isSeekable() && $this->eof())) {
            return '';
        }

        // Save cursor position before reading
        $tell = $this->tell();

        $buffer = stream_get_contents($this->getStream(), $maxLength, 0);

        // Reset cursor position
        $this->seek($tell);

        return ($buffer === false) ? '' : $buffer;
    }

    /**
     * {@inheritdoc}
     */
    public function getMetadata($key = null): mixed {
        if ($key === null) {
            return $this->cache;
        }

        return $this->cache->get($key);
    }

    /**
     * Return the read/write mode used on the stream.
     *
     * @return string
     */
    public function getMode(): string {
        return (string) $this->cache['mode'];
    }

    /**
     * {@inheritdoc}
     */
    public function getSize(): int {
        if ($this->isLocal()) {
            // UNSAFE
            // HHVM only has the 1st argument
            clearstatcache(true, $this->cache['uri']);
        }

        if ($this->cache['wrapper_type'] !== 'PHP') {
            $stat = fstat($this->getStream());

            if (array_key_exists('size', $stat)) {
                return (int) $stat['size'];
            }
        }

        return mb_strlen($this->getContents());
    }

    /**
     * Return the raw resource stream.
     *
     * @return resource
     */
    public function getStream(): ?resource {
        return $this->stream;
    }

    /**
     * Alias for eof().
     *
     * @return bool
     */
    public function isConsumed(): bool {
        return $this->eof();
    }

    /**
     * Return true if the stream is a local file.
     *
     * @return bool
     */
    public function isLocal(): bool {
        return (bool) $this->cache['local'];
    }

    /**
     * {@inheritdoc}
     */
    public function isReadable(): bool {
        return (bool) $this->cache['readable'];
    }

    /**
     * Return true if the stream can be re-read once the EOF has been reached.
     *
     * @return bool
     */
    public function isRepeatable(): bool {
        return $this->isReadable() && $this->isSeekable();
    }

    /**
     * {@inheritdoc}
     */
    public function isSeekable(): bool {
        return (bool) $this->cache['seekable'];
    }

    /**
     * {@inheritdoc}
     */
    public function isWritable(): bool {
        return (bool) $this->cache['writable'];
    }

    /**
     * {@inheritdoc}
     */
    public function read($length): ?string {
        if (!$this->isReadable()) {
            return null;
        }

        $buffer = fread($this->getStream(), $length);

        return ($buffer === false) ? null : $buffer;
    }

    /**
     * Rewind the pointer to the beginning.
     *
     * @return bool
     */
    public function rewind(): bool {
        return $this->seek(0);
    }

    /**
     * {@inheritdoc}
     */
    public function seek($offset, $whence = SEEK_SET): bool {
        return $this->isSeekable() ? (fseek($this->getStream(), $offset, $whence) === 0) : false;
    }

    /**
     * Set a resource as a stream and generate a new meta data cache.
     *
     * @param resource $stream
     * @return $this
     */
    public function setStream(resource $stream): this {
        $this->stream = $stream;
        $this->buildCache();

        return $this;
    }

    /**
     * {@inheritdoc}
     */
    public function tell(): ?int {
        $tell = ftell($this->getStream());

        return ($tell === false) ? null : $tell;
    }

    /**
     * {@inheritdoc}
     */
    public function write($string): ?int {
        if (!$this->isWritable()) {
            return null;
        }

        $write = fwrite($this->getStream(), $string);

        return ($write === false) ? null : $write;
    }

}


text:
from os import listdir
from os.path import dirname, realpath
from re import compile as re_compile
from re import findall, IGNORECASE, MULTILINE, UNICODE
from re import finditer
import pickle
flags = MULTILINE|UNICODE

directory_of_this_file = dirname(realpath(__file__))

# load patterns
directory_of_patterns = directory_of_this_file + "/prep/patterns"
language_pattern = {}
for filename in listdir(directory_of_patterns):
    language = filename.split(".")[0]
    with open(directory_of_patterns + "/" + language + ".txt") as f:
        pattern_as_string = (f.read().decode("utf-8").strip())
        pattern = re_compile(pattern_as_string, flags=flags)
        language_pattern[language] = pattern

def flatten(lst):
    result = []
    for element in lst:
        if hasattr(element, '__iter__'):
            result.extend(flatten(element))
        else:
            result.append(element)
    return result

def extract_organizations(text, language=None):

    if isinstance(text, str):
        text = text.decode("utf-8")

    organizations = set()
    if language:

        organizations.update(flatten(findall(language_pattern[language], text)))

    else:

        for pattern in language_pattern.values():
            organizations.update(flatten(findall(pattern, text)))

    organizations = [org for org in list(organizations) if org and org.count(" ") > 0]

    return organizations

def extract_organization(text):
    return extract_organizations(text)[0]

def get_keywords():
    directory_of_keywords = directory_of_this_file + "/prep/keywords"
    language_keywords = {}
    for filename in listdir(directory_of_keywords):
        language = filename.split(".")[0]
        with open(directory_of_keywords + "/" + language + ".txt") as f:
            language_keywords[language] = f.read().decode("utf-8").strip().splitlines()
    return language_keywords
eo=extract_organizations

redpajama_set_name: RedPajamaGithub


text:
UTLauncher is a standalone application to join UT4 servers. You will need latest raxxy's UT build to use this though.
In the future it is planned to automatically download latest UT playable releases.

Double click on a server to join. It will ask for `UnrealTournament.exe` on Windows or `UnrealTournament` on Linux or Mac.

## Installation

For compiled binaries no installation is necessary. For source, see below:

### Arch Linux

UTLauncher is available in AUR as [utlauncher-git](https://aur.archlinux.org/packages/utlauncher-git/).  Installation is as follows:

```bash
curl -O https://aur.archlinux.org/packages/ut/utlauncher-git/utlauncher-git.tar.gz
tar -xf utlauncher-git.tar.gz
cd utlauncher-git
makepkg -s
pacman -U utlauncher-git*.pkg.tar.xz
```

### Build instructions

#### Requirements
You need to install Qt5 base development package, G++ compiler and cmake.

##### Ubuntu
```
sudo apt-add-repository ppa:ubuntu-sdk-team/ppa
sudo apt-add-repository ppa:packetlost/cmake
sudo apt-get update
sudo apt-get install qtbase5-dev g++ cmake
```
##### openSUSE
`sudo zypper install libqt5-qtbase-devel gcc-c++ cmake`
##### openSUSE + Qt5 repo
`sudo zypper install libQt5Gui-devel libQt5Network-devel libQt5Widgets-devel gcc-c++ cmake`

### Build
```
git clone https://github.com/CodeCharmLtd/UTLauncher.git
mkdir UTLauncher/build
cd UTLauncher
git submodule update --init --recursive
cd build
cmake .. -DCMAKE_BUILD_TYPE=Release
make
sudo make install
```

## License
Licensed under the MIT license

Copyright (c) 2014 Damian "Rush" Kaczmarek
from Code Charm Ltd
and other contributors


text:
namespace {

std::string GetPluginInstancePosterAttribute(
    const blink::WebPluginParams& params) {
  DCHECK_EQ(params.attribute_names.size(), params.attribute_values.size());

  for (size_t i = 0; i < params.attribute_names.size(); ++i) {
    if (params.attribute_names[i].Utf8() == "poster" &&
        !params.attribute_values[i].IsEmpty()) {
      return params.attribute_values[i].Utf8();
    }
  }
  return std::string();
}

bool GetPluginPowerSaverEnabled(bool power_saver_setting_on, bool is_flash) {
  base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
  std::string override_for_testing = command_line->GetSwitchValueASCII(
      switches::kOverridePluginPowerSaverForTesting);

  // This feature has only been tested thoroughly with Flash thus far. It is
  // also enabled for the Power Saver test plugin for browser tests.
  if (override_for_testing == "always")
    return true;
  else if (override_for_testing == "never")
    return false;
  else
    return power_saver_setting_on && is_flash;
}

}  // namespace

PowerSaverInfo::PowerSaverInfo()
    : power_saver_enabled(false), blocked_for_background_tab(false) {}

PowerSaverInfo::PowerSaverInfo(const PowerSaverInfo& other) = default;

PowerSaverInfo PowerSaverInfo::Get(content::RenderFrame* render_frame,
                                   bool power_saver_setting_on,
                                   const blink::WebPluginParams& params,
                                   const content::WebPluginInfo& plugin_info,
                                   const GURL& document_url) {
  bool is_flash =
      plugin_info.name == base::ASCIIToUTF16(content::kFlashPluginName);

  PowerSaverInfo info;
  info.power_saver_enabled =
      GetPluginPowerSaverEnabled(power_saver_setting_on, is_flash);

  if (info.power_saver_enabled) {
    info.blocked_for_background_tab = render_frame->IsHidden();
    info.poster_attribute = GetPluginInstancePosterAttribute(params);
    info.base_url = document_url;
  }

  return info;
}


text:
package com.ogaclejapan.smarttablayout.demo;

import android.content.Context;
import android.content.res.ColorStateList;
import android.content.res.TypedArray;
import android.util.AttributeSet;
import android.widget.ImageView;

/**
 * https://gist.github.com/tylerchesley/5d15d859be4f3ce31213
 */
public class TintableImageView extends ImageView {

  private ColorStateList tint;

  public TintableImageView(Context context) {
    super(context);
  }

  public TintableImageView(Context context, AttributeSet attrs) {
    super(context, attrs);
    init(context, attrs, 0);
  }

  public TintableImageView(Context context, AttributeSet attrs, int defStyle) {
    super(context, attrs, defStyle);
    init(context, attrs, defStyle);
  }

  private void init(Context context, AttributeSet attrs, int defStyle) {
    TypedArray a = context.obtainStyledAttributes(
        attrs, R.styleable.TintableImageView, defStyle, 0);
    tint = a.getColorStateList(
        R.styleable.TintableImageView_tint);
    a.recycle();
  }

  @Override
  protected void drawableStateChanged() {
    super.drawableStateChanged();
    if (tint != null && tint.isStateful()) {
      updateTintColor();
    }
  }

  public void setColorFilter(ColorStateList tint) {
    this.tint = tint;
    super.setColorFilter(tint.getColorForState(getDrawableState(), 0));
  }

  private void updateTintColor() {
    int color = tint.getColorForState(getDrawableState(), 0);
    setColorFilter(color);
  }

}


text:
        <template is="dom-if" if="[[showMenu]]" restamp>
          <cr-icon-button id="menuButton" class="no-overlap"
              iron-icon="cr20:menu" on-click="onMenuTap_"
              aria-label$="[[menuLabel]]"
              title="[[menuLabel]]">
          </cr-icon-button>
        </template>
        <picture>
          <source media="(prefers-color-scheme: dark)"
              srcset="//resources/images/chrome_logo_dark.svg">

        </picture>

[[pageName]]

      <cr-toolbar-search-field id="search" narrow="[[narrow]]"
          label="[[searchPrompt]]" clear-label="[[clearLabel]]"
          spinner-active="[[spinnerActive]]"
          showing-search="{{showingSearch_}}"
          autofocus$="[[autofocus]]">
      </cr-toolbar-search-field>
      <iron-media-query query="(max-width: [[narrowThreshold]]px)"
          query-matches="{{narrow}}">
      </iron-media-query>

        <slot></slot>


text:
<md-toolbar class="md-accent">
    <div class="md-toolbar-tools">
        <md-input-container md-no-float class="minimum-space editable-title" flex="100">
            <input md-select-on-focus type="text" ng-model="selectedTable.name" placeholder="Table Name" on-enter-key="focusOnNextColumn(-1)">
        </md-input-container>
    </div>
</md-toolbar>

<md-card>
    <md-list-item ng-repeat="column in selectedTable.columns" class="md-1-line">
        <md-button class="md-icon-button" aria-label="IsPrimaryKey" ng-click="column.isPrimaryKey=!column.isPrimaryKey">
            <md-icon ng-model="column.isPrimaryKey" md-svg-icon="assets/svg/key.svg" ng-class="['nofocus', 'rotate-key', {'key-off': !column.isPrimaryKey}]"></md-icon>
        </md-button>

        <md-input-container md-no-float class="minimum-space">
            <md-select placeholder="Data Type" name="type" ng-model="column.type" required>
                <md-option value="text">Text</md-option>
                <md-option value="number">Number</md-option>
                <md-option value="date">Date</md-option>
            </md-select>
        </md-input-container>
        <md-input-container md-no-float flex class="minimum-space">
            <input required ng-model="column.name" on-enter-key="focusOnNextColumn($index)" placeholder="Column Name" class="columnName">
        </md-input-container>

        <md-button class="md-icon-button md-secondary" aria-label="Delete" ng-click="selectedTable.columns.splice($index, 1)">
            <md-icon md-svg-icon="assets/svg/delete.svg" class="delete"></md-icon>
        </md-button>

        <md-divider ng-if="!$last"></md-divider>
    </md-list-item>
</md-card>

<md-card>
    <md-list-item class="md-1-line">
        <md-button class="md-icon-button" aria-label="IsPrimaryKey" ng-click="columnEditor.isPrimaryKey=!columnEditor.isPrimaryKey">
            <md-icon ng-model="columnEditor.isPrimaryKey" md-svg-icon="assets/svg/key.svg" ng-class="['nofocus', 'rotate-key', {'key-off': !columnEditor.isPrimaryKey}]"></md-icon>
        </md-button>
        <md-input-container md-no-float class="minimum-space">
            <md-select placeholder="Data Type" name="type" ng-model="columnTypeEditor" required>
                <md-option selected value="text">Text</md-option>
                <md-option value="number">Number</md-option>
                <md-option value="date">Date</md-option>
            </md-select>
        </md-input-container>
        <md-input-container md-no-float flex class="minimum-space">
            <input ng-model="columnNameEditor" on-enter-key="addColumn(columnNameEditor)" placeholder="Column Name" id="columnNameEditor">
        </md-input-container>

        <md-button class="md-icon-button md-secondary" aria-label="Add" ng-click="addColumn(columnNameEditor)" id="addColumnButton">
            <md-icon md-svg-icon="assets/svg/add.svg"></md-icon>
        </md-button>

        <md-divider ng-if="!$last"></md-divider>
    </md-list-item>
</md-card>


text:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE topic
  PUBLIC "urn:pubid:dita4publishers.sourceforge.net:doctypes:dita:chapter" "chapter.dtd">
<topic id="d2e3106">
   <title>
      <d4pSimpleEnumerator>Chapter 11. </d4pSimpleEnumerator>
      <ph>The Nautilus
      </ph>
   </title>

         <ph outputclass="size_plus_2">CAPTAIN NEMO</ph> stood up. I followed him.
Contrived at the rear of the dining room, a double door opened, and
I entered a room whose dimensions equaled the one I had just
left.

It was a library. Tall, black–rosewood bookcases, inlaid
with copperwork, held on their wide shelves a large number of
uniformly bound books. These furnishings followed the contours of
the room, their lower parts leading to huge couches upholstered in
maroon leather and curved for maximum comfort. Light, movable
reading stands, which could be pushed away or pulled near as
desired, allowed books to be positioned on them for easy study. In
the center stood a huge table covered with pamphlets, among which
some newspapers, long out of date, were visible. Electric light
flooded this whole harmonious totality, falling from four frosted
half globes set in the scrollwork of the ceiling. I stared in
genuine wonderment at this room so ingeniously laid out, and I
couldn't believe my eyes.

"Captain Nemo," I told my host, who had just stretched out on a
couch, "this is a library that would do credit to more than one
continental palace, and I truly marvel to think it can go with you
into the deepest seas."

"Where could one find greater silence or solitude, professor?"
Captain Nemo replied. "Did your study at the museum afford you such
a perfect retreat?"

"No, sir, and I might add that it's quite a humble one next to
yours. You own 6,000 or 7,000 volumes here . . ."

"12,000, Professor Aronnax. They're my sole remaining ties with
dry land. But I was done with the shore the day my Nautilus
submerged for the first time under the waters. That day I purchased
my last volumes, my last pamphlets, my last newspapers, and ever
since I've chosen to believe that humanity no longer thinks or
writes. In any event, professor, these books are at your disposal,
and you may use them freely."

I thanked Captain Nemo and approached the shelves of this
library. Written in every language, books on science, ethics, and
literature were there in abundance, but I didn't see a single work
on economics—they seemed to be strictly banned on board. One
odd detail: all these books were shelved indiscriminately without
regard to the language in which they were written, and this jumble
proved that the Nautilus's captain could read fluently
whatever volumes he chanced to pick up.

Among these books I noted masterpieces by the greats of ancient
and modern times, in other words, all of humanity's finest
achievements in history, poetry, fiction, and science, from Homer
to Victor Hugo, from Xenophon to Michelet, from Rabelais to Madame
George Sand. But science, in particular, represented the major
investment of this library: books on mechanics, ballistics,
hydrography, meteorology, geography, geology, etc., held a place
there no less important than works on natural history, and I
realized that they made up the captain's chief reading. There I saw
the complete works of Humboldt, the complete Arago, as well as
works by Foucault, Henri Sainte–Claire Deville, Chasles,
Milne–Edwards, Quatrefages, John Tyndall, Faraday, Berthelot,
Father Secchi, Petermann, Commander Maury, Louis Agassiz, etc.,
plus the transactions of France's Academy of Sciences, bulletins
from the various geographical societies, etc., and in a prime
location, those two volumes on the great ocean depths that had
perhaps earned me this comparatively charitable welcome from
Captain Nemo. Among the works of Joseph Bertrand, his book entitled
The Founders of Astronomy even gave me a definite date; and since I
knew it had appeared in the course of 1865, I concluded that the
fitting out of the Nautilus hadn't taken place before then.
Accordingly, three years ago at the most, Captain Nemo had begun
his underwater existence. Moreover, I hoped some books even more
recent would permit me to pinpoint the date precisely; but I had
plenty of time to look for them, and I didn't want to put off any
longer our stroll through the wonders of the Nautilus.

"Sir," I told the captain, "thank you for placing this library
at my disposal. There are scientific treasures here, and I'll take
advantage of them."

"This room isn't only a library," Captain Nemo said, "it's also
a smoking room."

"A smoking room?" I exclaimed. "Then one may smoke on
board?"

"Surely."

"In that case, sir, I'm forced to believe that you've kept up
relations with Havana."

"None whatever," the captain replied. "Try this cigar, Professor
Aronnax, and even though it doesn't come from Havana, it will
satisfy you if you're a connoisseur."

I took the cigar offered me, whose shape recalled those from
Cuba; but it seemed to be made of gold leaf. I lit it at a small
brazier supported by an elegant bronze stand, and I inhaled my
first whiffs with the relish of a smoker who hasn't had a puff in
days.

"It's excellent," I said, "but it's not from the tobacco
plant."

"Right," the captain replied, "this tobacco comes from neither
Havana nor the Orient. It's a kind of nicotine–rich seaweed
that the ocean supplies me, albeit sparingly. Do you still miss
your Cubans, sir?"

"Captain, I scorn them from this day forward."

"Then smoke these cigars whenever you like, without debating
their origin. They bear no government seal of approval, but I
imagine they're none the worse for it."

"On the contrary."

Just then Captain Nemo opened a door facing the one by which I
had entered the library, and I passed into an immense, splendidly
lit lounge.

It was a huge quadrilateral with canted corners, ten meters
long, six wide, five high. A luminous ceiling, decorated with
delicate arabesques, distributed a soft, clear daylight over all
the wonders gathered in this museum. For a museum it truly was, in
which clever hands had spared no expense to amass every natural and
artistic treasure, displaying them with the helter–skelter
picturesqueness that distinguishes a painter's studio.

Some thirty pictures by the masters, uniformly framed and
separated by gleaming panoplies of arms, adorned walls on which
were stretched tapestries of austere design. There I saw canvases
of the highest value, the likes of which I had marveled at in
private European collections and art exhibitions. The various
schools of the old masters were represented by a Raphael Madonna, a
Virgin by Leonardo da Vinci, a nymph by Correggio, a woman by
Titian, an adoration of the Magi by Veronese, an assumption of the
Virgin by Murillo, a Holbein portrait, a monk by Velazquez, a
martyr by Ribera, a village fair by Rubens, two Flemish landscapes
by Teniers, three little genre paintings by Gerard Dow, Metsu, and
Paul Potter, two canvases by Gericault and Prud'hon, plus seascapes
by Backhuysen and Vernet. Among the works of modern art were
pictures signed by Delacroix, Ingres, Decamps, Troyon, Meissonier,
Daubigny, etc., and some wonderful miniature statues in marble or
bronze, modeled after antiquity's finest originals, stood on their
pedestals in the corners of this magnificent museum. As the
Nautilus's commander had predicted, my mind was already
starting to fall into that promised state of stunned amazement.

"Professor," this strange man then said, "you must excuse the
informality with which I receive you, and the disorder reigning in
this lounge."

"Sir," I replied, "without prying into who you are, might I
venture to identify you as an artist?"

"A collector, sir, nothing more. Formerly I loved acquiring
these beautiful works created by the hand of man. I sought them
greedily, ferreted them out tirelessly, and I've been able to
gather some objects of great value. They're my last mementos of
those shores that are now dead for me. In my eyes, your modern
artists are already as old as the ancients. They've existed for
2,000 or 3,000 years, and I mix them up in my mind. The masters are
ageless."

"What about these composers?" I said, pointing to sheet music by
Weber, Rossini, Mozart, Beethoven, Haydn, Meyerbeer, Hérold,
Wagner, Auber, Gounod, Victor Massé, and a number of others
scattered over a full size piano–organ, which occupied one of
the wall panels in this lounge.

"These composers," Captain Nemo answered me, "are the
contemporaries of Orpheus, because in the annals of the dead, all
chronological differences fade; and I'm dead, professor, quite as
dead as those friends of yours sleeping six feet under!"

Captain Nemo fell silent and seemed lost in reverie. I regarded
him with intense excitement, silently analyzing his strange facial
expression. Leaning his elbow on the corner of a valuable mosaic
table, he no longer saw me, he had forgotten my very presence.

I didn't disturb his meditations but continued to pass in review
the curiosities that enriched this lounge.

After the works of art, natural rarities predominated. They
consisted chiefly of plants, shells, and other exhibits from the
ocean that must have been Captain Nemo's own personal finds. In the
middle of the lounge, a jet of water, electrically lit, fell back
into a basin made from a single giant clam. The delicately
festooned rim of this shell, supplied by the biggest mollusk in the
class Acephala, measured about six meters in circumference;
so it was even bigger than those fine giant clams given to King
François I by the Republic of Venice, and which the Church
of Saint–Sulpice in Paris has made into two gigantic
holy–water fonts.

Around this basin, inside elegant glass cases fastened with
copper bands, there were classified and labeled the most valuable
marine exhibits ever put before the eyes of a naturalist. My
professorial glee may easily be imagined.

The zoophyte branch offered some very unusual specimens from its
two groups, the polyps and the echinoderms. In the first group:
organ–pipe coral, gorgonian coral arranged into fan shapes,
soft sponges from Syria, isis coral from the Molucca Islands,
sea–pen coral, wonderful coral of the genus Virgularia from
the waters of Norway, various coral of the genus Umbellularia,
alcyonarian coral, then a whole series of those madrepores that my
mentor Professor Milne–Edwards has so shrewdly classified
into divisions and among which I noted the wonderful genus
Flabellina as well as the genus Oculina from Réunion Island,
plus a Neptune's chariot from the Caribbean Sea—every
superb variety of coral, and in short, every species of these
unusual polyparies that congregate to form entire islands that will
one day turn into continents. Among the echinoderms, notable for
being covered with spines: starfish, feather stars, sea lilies,
free–swimming crinoids, brittle stars, sea urchins, sea
cucumbers, etc., represented a complete collection of the
individuals in this group.

An excitable conchologist would surely have fainted dead away
before other, more numerous glass cases in which were classified
specimens from the mollusk branch. There I saw a collection of
incalculable value that I haven't time to describe completely.
Among these exhibits I'll mention, just for the record: an elegant
royal hammer shell from the Indian Ocean, whose evenly spaced white
spots stood out sharply against a base of red and brown; an
imperial spiny oyster, brightly colored, bristling with thorns, a
specimen rare to European museums, whose value I estimated at
₣20,000; a common hammer shell from the seas near Queensland,
very hard to come by; exotic cockles from Senegal, fragile white
bivalve shells that a single breath could pop like a soap bubble;
several varieties of watering–pot shell from Java, a sort of
limestone tube fringed with leafy folds and much fought over by
collectors; a whole series of top–shell snails—greenish
yellow ones fished up from American seas, others colored reddish
brown that patronize the waters off Queensland, the former coming
from the Gulf of Mexico and notable for their overlapping shells,
the latter some sun–carrier shells found in the southernmost
seas, finally and rarest of all, the magnificent spurred–star
shell from New Zealand; then some wonderful peppery–furrow
shells; several valuable species of cythera clams and venus clams;
the trellis wentletrap snail from Tranquebar on India's eastern
shore; a marbled turban snail gleaming with
mother–of–pearl; green parrot shells from the seas of
China; the virtually unknown cone snail from the genus
Coenodullus; every variety of cowry used as money in India
and Africa; a "glory–of–the–seas," the most
valuable shell in the East Indies; finally, common periwinkles,
delphinula snails, turret snails, violet snails, European cowries,
volute snails, olive shells, miter shells, helmet shells, murex
snails, whelks, harp shells, spiky periwinkles, triton snails, horn
shells, spindle shells, conch shells, spider conchs, limpets, glass
snails, sea butterflies—every kind of delicate, fragile
seashell that science has baptized with its most delightful
names.

Aside and in special compartments, strings of supremely
beautiful pearls were spread out, the electric light flecking them
with little fiery sparks: pink pearls pulled from saltwater fan
shells in the Red Sea; green pearls from the rainbow abalone;
yellow, blue, and black pearls, the unusual handiwork of various
mollusks from every ocean and of certain mussels from rivers up
north; in short, several specimens of incalculable worth that had
been oozed by the rarest of shellfish. Some of these pearls were
bigger than a pigeon egg; they more than equaled the one that the
explorer Tavernier sold the Shah of Persia for ₣3,000,000,
and they surpassed that other pearl owned by the Imam of Muscat,
which I had believed to be unrivaled in the entire world.

Consequently, to calculate the value of this collection was, I
should say, impossible. Captain Nemo must have spent millions in
acquiring these different specimens, and I was wondering what
financial resources he tapped to satisfy his collector's fancies,
when these words interrupted me:

"You're examining my shells, professor? They're indeed able to
fascinate a naturalist; but for me they have an added charm, since
I've collected every one of them with my own two hands, and not a
sea on the globe has escaped my investigations."

"I understand, Captain, I understand your delight at strolling
in the midst of this wealth. You're a man who gathers his treasure
in person. No museum in Europe owns such a collection of exhibits
from the ocean. But if I exhaust all my wonderment on them, I'll
have nothing left for the ship that carries them! I have absolutely
no wish to probe those secrets of yours! But I confess that my
curiosity is aroused to the limit by this Nautilus, the
motor power it contains, the equipment enabling it to operate, the
ultra powerful force that brings it to life. I see some instruments
hanging on the walls of this lounge whose purposes are unknown to
me. May I learn—"

"Professor Aronnax," Captain Nemo answered me, "I've said you'd
be free aboard my vessel, so no part of the Nautilus is
off–limits to you. You may inspect it in detail, and I'll be
delighted to act as your guide."

"I don't know how to thank you, sir, but I won't abuse your good
nature. I would only ask you about the uses intended for these
instruments of physical measure—"

"Professor, these same instruments are found in my stateroom,
where I'll have the pleasure of explaining their functions to you.
But beforehand, come inspect the cabin set aside for you. You need
to learn how you'll be lodged aboard the Nautilus."

I followed Captain Nemo, who, via one of the doors cut into the
lounge's canted corners, led me back down the ship's gangways. He
took me to the bow, and there I found not just a cabin but an
elegant stateroom with a bed, a washstand, and various other
furnishings.

I could only thank my host.

"Your stateroom adjoins mine," he told me, opening a door, "and
mine leads into that lounge we've just left."

I entered the captain's stateroom. It had an austere, almost
monastic appearance. An iron bedstead, a worktable, some washstand
fixtures. Subdued lighting. No luxuries. Just the bare
necessities.

Captain Nemo showed me to a bench.

"Kindly be seated," he told me.

I sat, and he began speaking as follows:

</topic>


text:
#ifndef ANDROID_IOMX_H_

#define ANDROID_IOMX_H_

#include <binder/IInterface.h>
#include <gui/IGraphicBufferProducer.h>
#include <ui/GraphicBuffer.h>
#include <utils/List.h>
#include <utils/String8.h>

#include <OMX_Core.h>
#include <OMX_Video.h>

namespace android {

class IMemory;
class IOMXObserver;
class IOMXRenderer;
class Surface;

class IOMX : public IInterface {
public:
    DECLARE_META_INTERFACE(OMX);

    typedef void *buffer_id;
    typedef void *node_id;

    // Given a node_id and the calling process' pid, returns true iff
    // the implementation of the OMX interface lives in the same
    // process.
    virtual bool livesLocally(node_id node, pid_t pid) = 0;

    struct ComponentInfo {
        String8 mName;
        List<String8> mRoles;
    };
    virtual status_t listNodes(List<ComponentInfo> *list) = 0;

    virtual status_t allocateNode(
            const char *name, const sp<IOMXObserver> &observer,
            node_id *node) = 0;

    virtual status_t freeNode(node_id node) = 0;

    virtual status_t sendCommand(
            node_id node, OMX_COMMANDTYPE cmd, OMX_S32 param) = 0;

    virtual status_t getParameter(
            node_id node, OMX_INDEXTYPE index,
            void *params, size_t size) = 0;

    virtual status_t setParameter(
            node_id node, OMX_INDEXTYPE index,
            const void *params, size_t size) = 0;

    virtual status_t getConfig(
            node_id node, OMX_INDEXTYPE index,
            void *params, size_t size) = 0;

    virtual status_t setConfig(
            node_id node, OMX_INDEXTYPE index,
            const void *params, size_t size) = 0;

    virtual status_t getState(
            node_id node, OMX_STATETYPE* state) = 0;

    virtual status_t storeMetaDataInBuffers(
            node_id node, OMX_U32 port_index, OMX_BOOL enable) = 0;

    virtual status_t enableGraphicBuffers(
            node_id node, OMX_U32 port_index, OMX_BOOL enable) = 0;

    virtual status_t getGraphicBufferUsage(
            node_id node, OMX_U32 port_index, OMX_U32* usage) = 0;

    virtual status_t useBuffer(
            node_id node, OMX_U32 port_index, const sp<IMemory> &params,
            buffer_id *buffer) = 0;

    virtual status_t useGraphicBuffer(
            node_id node, OMX_U32 port_index,
            const sp<GraphicBuffer> &graphicBuffer, buffer_id *buffer) = 0;

    virtual status_t createInputSurface(
            node_id node, OMX_U32 port_index,
            sp<IGraphicBufferProducer> *bufferProducer) = 0;

    virtual status_t signalEndOfInputStream(node_id node) = 0;

    // This API clearly only makes sense if the caller lives in the
    // same process as the callee, i.e. is the media_server, as the
    // returned "buffer_data" pointer is just that, a pointer into local
    // address space.
    virtual status_t allocateBuffer(
            node_id node, OMX_U32 port_index, size_t size,
            buffer_id *buffer, void **buffer_data) = 0;

    virtual status_t allocateBufferWithBackup(
            node_id node, OMX_U32 port_index, const sp<IMemory> &params,
            buffer_id *buffer) = 0;

    virtual status_t freeBuffer(
            node_id node, OMX_U32 port_index, buffer_id buffer) = 0;

    virtual status_t fillBuffer(node_id node, buffer_id buffer) = 0;

    virtual status_t emptyBuffer(
            node_id node,
            buffer_id buffer,
            OMX_U32 range_offset, OMX_U32 range_length,
            OMX_U32 flags, OMX_TICKS timestamp) = 0;

    virtual status_t getExtensionIndex(
            node_id node,
            const char *parameter_name,
            OMX_INDEXTYPE *index) = 0;
};

struct omx_message {
    enum {
        EVENT,
        EMPTY_BUFFER_DONE,
        FILL_BUFFER_DONE,

    } type;

    IOMX::node_id node;

    union {
        // if type == EVENT
        struct {
            OMX_EVENTTYPE event;
            OMX_U32 data1;
            OMX_U32 data2;
        } event_data;

        // if type == EMPTY_BUFFER_DONE
        struct {
            IOMX::buffer_id buffer;
        } buffer_data;

        // if type == FILL_BUFFER_DONE
        struct {
            IOMX::buffer_id buffer;
            OMX_U32 range_offset;
            OMX_U32 range_length;
            OMX_U32 flags;
            OMX_TICKS timestamp;
            OMX_PTR platform_private;
            OMX_PTR data_ptr;
        } extended_buffer_data;

    } u;
};

class IOMXObserver : public IInterface {
public:
    DECLARE_META_INTERFACE(OMXObserver);

    virtual void onMessage(const omx_message &msg) = 0;
};

////////////////////////////////////////////////////////////////////////////////

class BnOMX : public BnInterface<IOMX> {
public:
    virtual status_t onTransact(
            uint32_t code, const Parcel &data, Parcel *reply,
            uint32_t flags = 0);
};

class BnOMXObserver : public BnInterface<IOMXObserver> {
public:
    virtual status_t onTransact(
            uint32_t code, const Parcel &data, Parcel *reply,
            uint32_t flags = 0);
};

struct CodecProfileLevel {
    OMX_U32 mProfile;
    OMX_U32 mLevel;
};

}  // namespace android

#endif  // ANDROID_IOMX_H_


text:
import unittest
import lxml
import lxml.etree
from pywps.app import Process, Service
from pywps.app.Common import Metadata
from pywps import get_ElementMakerForVersion
from pywps.tests import assert_pywps_version, client_for, assert_wps_version

WPS, OWS  = get_ElementMakerForVersion("1.0.0")

class BadRequestTest(unittest.TestCase):

    def test_bad_http_verb(self):
        client = client_for(Service())
        resp = client.put('')
        assert resp.status_code == 405  # method not allowed

    def test_bad_request_type_with_get(self):
        client = client_for(Service())
        resp = client.get('?Request=foo')
        assert resp.status_code == 400

    def test_bad_service_type_with_get(self):
        client = client_for(Service())
        resp = client.get('?service=foo')

        exception = resp.xpath('/ows:ExceptionReport'
                                '/ows:Exception')

        assert resp.status_code == 400
        assert exception[0].attrib['exceptionCode'] == 'InvalidParameterValue'

    def test_bad_request_type_with_post(self):
        client = client_for(Service())
        request_doc = WPS.Foo()
        resp = client.post_xml('', doc=request_doc)
        assert resp.status_code == 400

class CapabilitiesTest(unittest.TestCase):

    def setUp(self):
        def pr1(): pass
        def pr2(): pass
        self.client = client_for(Service(processes=[Process(pr1, 'pr1', 'Process 1', abstract='Process 1', keywords=['kw1a','kw1b'], metadata=[Metadata('pr1 metadata')]), Process(pr2, 'pr2', 'Process 2', keywords=['kw2a'], metadata=[Metadata('pr2 metadata')])]))

    def check_capabilities_response(self, resp):

        assert resp.status_code == 200
        assert resp.headers['Content-Type'] == 'text/xml'
        title = resp.xpath_text('/wps:Capabilities'
                                '/ows:ServiceIdentification'
                                '/ows:Title')
        assert title != ''
        names = resp.xpath_text('/wps:Capabilities'
                                '/wps:ProcessOfferings'
                                '/wps:Process'
                                '/ows:Identifier')
        assert sorted(names.split()) == ['pr1', 'pr2']

        keywords = resp.xpath('/wps:Capabilities'
                                  '/wps:ProcessOfferings'
                                  '/wps:Process'
                                  '/ows:Keywords'
                                  '/ows:Keyword')
        assert len(keywords) == 3

        metadatas = resp.xpath('/wps:Capabilities'
                               '/wps:ProcessOfferings'
                               '/wps:Process'
                               '/ows:Metadata')
        assert len(metadatas) == 2

    def test_get_request(self):
        resp = self.client.get('?Request=GetCapabilities&service=WpS')
        self.check_capabilities_response(resp)

        # case insesitive check
        resp = self.client.get('?request=getcapabilities&service=wps')
        self.check_capabilities_response(resp)

    def test_post_request(self):
        request_doc = WPS.GetCapabilities()
        resp = self.client.post_xml(doc=request_doc)
        self.check_capabilities_response(resp)

    def test_get_bad_version(self):
        resp = self.client.get('?request=getcapabilities&service=wps&acceptversions=2001-123')
        exception = resp.xpath('/ows:ExceptionReport'
                                '/ows:Exception')
        assert resp.status_code == 400
        assert exception[0].attrib['exceptionCode'] == 'VersionNegotiationFailed'

    def test_post_bad_version(self):
        acceptedVersions_doc = OWS.AcceptVersions(OWS.Version('2001-123'))
        request_doc = WPS.GetCapabilities(acceptedVersions_doc)
        resp = self.client.post_xml(doc=request_doc)
        exception = resp.xpath('/ows:ExceptionReport'
                                '/ows:Exception')

        assert resp.status_code == 400
        assert exception[0].attrib['exceptionCode'] == 'VersionNegotiationFailed'

    def test_version(self):
        resp = self.client.get('?service=WPS&request=GetCapabilities&version=1.0.0')
        assert_wps_version(resp)

    def test_version2(self):
        resp = self.client.get('?service=WPS&request=GetCapabilities&acceptversions=2.0.0')
        assert_wps_version(resp, version="2.0.0")

def load_tests(loader=None, tests=None, pattern=None):
    if not loader:
        loader = unittest.TestLoader()
    suite_list = [
        loader.loadTestsFromTestCase(BadRequestTest),
        loader.loadTestsFromTestCase(CapabilitiesTest),
    ]
    return unittest.TestSuite(suite_list)


text:
package org.wycliffeassociates.translationrecorder.project;

import android.content.Context;
import android.content.SharedPreferences;
import android.os.Parcel;
import android.os.Parcelable;
import android.preference.PreferenceManager;

import org.wycliffeassociates.translationrecorder.SettingsPage.Settings;
import org.wycliffeassociates.translationrecorder.chunkplugin.ChunkPlugin;
import org.wycliffeassociates.translationrecorder.database.ProjectDatabaseHelper;
import org.wycliffeassociates.translationrecorder.project.components.Anthology;
import org.wycliffeassociates.translationrecorder.project.components.Book;
import org.wycliffeassociates.translationrecorder.project.components.Language;
import org.wycliffeassociates.translationrecorder.project.components.Mode;
import org.wycliffeassociates.translationrecorder.project.components.Version;

import java.io.IOException;
import java.io.InputStream;

/**
 * Created by sarabiaj on 5/10/2016.
 */
public class Project implements Parcelable {

    public static final String PROJECT_EXTRA = "project_extra";

    public Language mTargetLanguage;
    public Language mSourceLanguage;
    public Anthology mAnthology;
    public Book mBook;
    public Version mVersion;
    public Mode mMode;
    public FileName mFileName;

    String mContributors;
    String mSourceAudioPath;

    public interface ProjectPluginLoader {
        ChunkPlugin loadChunkPlugin(Anthology anthology, Book book, ChunkPlugin.TYPE type);
        InputStream chunksInputStream(Anthology anthology, Book book);
    }

    public Project() {
    }

    public Project(Language target, Anthology anthology, Book book, Version version, Mode mode) {
        mTargetLanguage = target;
        mAnthology = anthology;
        mBook = book;
        mVersion = version;
        mMode = mode;
        mFileName = new FileName(target, anthology, version, book);
    }

    public Project(Language target, Anthology anthology, Book book, Version version, Mode mode, String sourceAudioPath) {
        this(target, anthology, book, version, mode);
        mSourceAudioPath = sourceAudioPath;
    }

    public boolean equals(Project p) {
        if (p != null) {
            if (mTargetLanguage != null  && mTargetLanguage.getSlug() != null && mTargetLanguage.getSlug().equals(p.getTargetLanguageSlug())
                    && mBook != null && mBook.getSlug() != null && mBook.getSlug().equals(p.getBookSlug())
                    && mVersion != null && mVersion.getSlug() != null && mVersion.getSlug().equals(p.getVersionSlug())
                    && mMode != null && mMode.getSlug() != null && mMode.getSlug().equals(p.getModeSlug())) {
                return true;
            }
        }
        return false;
    }

    public ChunkPlugin getChunkPlugin(ProjectPluginLoader pluginLoader) throws IOException {
        return pluginLoader.loadChunkPlugin(mAnthology, mBook, getModeType());
    }

    public static Project getProjectFromPreferences(Context ctx, ProjectDatabaseHelper db) {
        SharedPreferences pref = PreferenceManager.getDefaultSharedPreferences(ctx);
        int projectId = pref.getInt(Settings.KEY_RECENT_PROJECT_ID, -1);
        Project project = db.getProject(projectId);
        return project;
    }

    public void loadProjectIntoPreferences(Context ctx, ProjectDatabaseHelper db) {
        SharedPreferences pref = PreferenceManager.getDefaultSharedPreferences(ctx);
        if(db.projectExists(this)) {
            int projectId = db.getProjectId(this);
            pref.edit().putInt(Settings.KEY_RECENT_PROJECT_ID, projectId).commit();
        }
    }

    public boolean isOBS() {
        if (getAnthologySlug().compareTo("obs") == 0) {
            return true;
        } else {
            return false;
        }
    }

    public String getChapterFileName(int chapter) {
        String chapterFileName = mTargetLanguage.getSlug() +
                "_" + mAnthology.getSlug() +
                "_" + mVersion.getSlug() +
                "_" + mBook.getSlug() +
                "_c" + String.format("%02d", chapter) +
                ".wav";
        return chapterFileName;
    }

    public String getFileName(int chapter, int ... verses){
        if(mFileName == null) {
            mFileName = new FileName(mTargetLanguage, mAnthology, mVersion, mBook);
        }
        return mFileName.getFileName(chapter, verses);
    }

    public ProjectSlugs getProjectSlugs(){
        return new ProjectSlugs(getTargetLanguageSlug(), getVersionSlug(), Integer.parseInt(getBookNumber()), getBookSlug());
    }

    public String getTargetLanguageSlug() {
        return (mTargetLanguage == null) ? "" : mTargetLanguage.getSlug();
    }

    public String getSourceLanguageSlug() {
        return (mSourceLanguage == null) ? "" : mSourceLanguage.getSlug();
    }

    public String getAnthologySlug() {
        return (mAnthology == null) ? "" : mAnthology.getSlug();
    }

    public String getBookSlug() {
        return (mBook == null) ? "" : mBook.getSlug();
    }

    public String getBookName() {
        return (mBook == null) ? "" : mBook.getName();
    }

    public String getVersionSlug() {
        return (mVersion == null) ? "" : mVersion.getSlug();
    }

    public String getModeSlug() {
        return (mMode == null) ? "" : mMode.getSlug();
    }

    public ChunkPlugin.TYPE getModeType() {
        return (mMode == null) ? null : mMode.getType();
    }

    public String getModeName() {
        return (mMode == null) ? "" : mMode.getName();
    }

    public String getContributors() {
        return (mContributors == null) ? "" : mContributors;
    }

    public String getBookNumber() {
        return (mBook == null) ? "" : String.valueOf(mBook.getOrder());
    }

    public String getSourceAudioPath() {
        return (mSourceAudioPath == null) ? "" : mSourceAudioPath;
    }

    public void setTargetLanguage(Language target) {
        mTargetLanguage = target;
    }

    public void setSourceLanguage(Language source) {
        mSourceLanguage = source;
    }

    public void setBook(Book book) {
        mBook = book;
    }

    public void setVersion(Version version) {
        mVersion = version;
    }

    public void setAnthology(Anthology anthology) {
        mAnthology = anthology;
    }

    public void setMode(Mode mode) {
        mMode = mode;
    }

    public void setContributors(String contributors) {
        mContributors = contributors;
    }

    public void setSourceAudioPath(String sourceAudioPath) {
        mSourceAudioPath = sourceAudioPath;
    }

    public ProjectPatternMatcher getPatternMatcher(){
        return new ProjectPatternMatcher(mAnthology.getRegex(), mAnthology.getMatchGroups());
    }

    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeParcelable(mTargetLanguage, flags);
        if(mSourceLanguage != null) {
            dest.writeInt(1);
            dest.writeParcelable(mSourceLanguage, flags);
        } else {
            dest.writeInt(0);
        }
        dest.writeParcelable(mBook, flags);
        dest.writeParcelable(mVersion, flags);
        dest.writeParcelable(mMode, flags);
        dest.writeParcelable(mAnthology, flags);
        dest.writeString(mContributors);
        dest.writeString(mSourceAudioPath);
    }

    public static final Parcelable.Creator<Project> CREATOR = new Parcelable.Creator<Project>() {
        public Project createFromParcel(Parcel in) {
            return new Project(in);
        }

        public Project[] newArray(int size) {
            return new Project[size];
        }
    };

    public Project(Parcel in) {
        mTargetLanguage = in.readParcelable(Language.class.getClassLoader());
        int hasSourceLanguage = in.readInt();
        if(hasSourceLanguage == 1) {
            mSourceLanguage = in.readParcelable(Language.class.getClassLoader());
        }
        mBook = in.readParcelable(Book.class.getClassLoader());
        mVersion = in.readParcelable(Version.class.getClassLoader());
        mMode = in.readParcelable(Mode.class.getClassLoader());
        mAnthology = in.readParcelable(Anthology.class.getClassLoader());
        mContributors = in.readString();
        mSourceAudioPath = in.readString();
    }
}


text:
package org.libx4j.xsb.generator.processor.plan.element;

import org.libx4j.xsb.compiler.processor.model.element.MaxLengthModel;
import org.libx4j.xsb.generator.processor.plan.Plan;

public final class MaxLengthPlan extends Plan<MaxLengthModel> {
  public MaxLengthPlan(final MaxLengthModel model, final Plan<?> parent) {
    super(model, parent);
  }
}


text:
<?php

declare(strict_types=1);

namespace Sylius\Bundle\CoreBundle\Fixture\Factory;

use Sylius\Component\Core\Formatter\StringInflector;
use Sylius\Component\Resource\Factory\FactoryInterface;
use Sylius\Component\Taxation\Model\TaxCategoryInterface;
use Symfony\Component\OptionsResolver\Options;
use Symfony\Component\OptionsResolver\OptionsResolver;

/**
 * @author Kamil Kokot <kamil@kokot.me>
 */
class TaxCategoryExampleFactory extends AbstractExampleFactory implements ExampleFactoryInterface
{
    /**
     * @var FactoryInterface
     */
    private $taxCategoryFactory;

    /**
     * @var \Faker\Generator
     */
    private $faker;

    /**
     * @var OptionsResolver
     */
    private $optionsResolver;

    /**
     * @param FactoryInterface $taxCategoryFactory
     */
    public function __construct(FactoryInterface $taxCategoryFactory)
    {
        $this->taxCategoryFactory = $taxCategoryFactory;

        $this->faker = \Faker\Factory::create();
        $this->optionsResolver = new OptionsResolver();

        $this->configureOptions($this->optionsResolver);
    }

    /**
     * {@inheritdoc}
     */
    public function create(array $options = [])
    {
        $options = $this->optionsResolver->resolve($options);

        /** @var TaxCategoryInterface $taxCategory */
        $taxCategory = $this->taxCategoryFactory->createNew();

        $taxCategory->setCode($options['code']);
        $taxCategory->setName($options['name']);
        $taxCategory->setDescription($options['description']);

        return $taxCategory;
    }

    /**
     * {@inheritdoc}
     */
    protected function configureOptions(OptionsResolver $resolver)
    {
        $resolver
            ->setDefault('name', function (Options $options) {
                return $this->faker->words(3, true);
            })
            ->setDefault('code', function (Options $options) {
                return StringInflector::nameToCode($options['name']);
            })
            ->setDefault('description', function (Options $options) {
                return $this->faker->paragraph;
            })
        ;
    }
}


text:
using System;
using Aspose.Email.Exchange;
using Aspose.Email.Mail;

/*
This project uses Automatic Package Restore feature of NuGet to resolve Aspose.Email for .NET API reference
when the project is build. Please check https://Docs.nuget.org/consume/nuget-faq for more information.
If you do not wish to use NuGet, you can manually download Aspose.Email for .NET API from http://www.aspose.com/downloads,
install it and then add its reference to this project. For any issues, questions or suggestions
please feel free to contact us using http://www.aspose.com/community/forums/default.aspx
*/

namespace Aspose.Email.Examples.CSharp.Email.Exchange_EWS
{
    class DeleteMembersFromPrivateDistributionList
    {
        public static void Run()
        {
            // ExStart:DeleteMembersFromPrivateDistributionList
            IEWSClient client = EWSClient.GetEWSClient("https://outlook.office365.com/ews/exchange.asmx", "testUser", "pwd", "domain");
            ExchangeDistributionList[] distributionLists = client.ListDistributionLists();
            MailAddressCollection members = client.FetchDistributionList(distributionLists[0]);
            MailAddressCollection membersToDelete = new MailAddressCollection();
            membersToDelete.Add(members[0]);
            membersToDelete.Add(members[1]);
            client.DeleteFromDistributionList(distributionLists[0], membersToDelete);
            // ExEnd:DeleteMembersFromPrivateDistributionList
        }
    }
}


text:
package ch.hsr.servicestoolkit.editor.web.filter.gzip;

import javax.servlet.ServletException;

@SuppressWarnings("serial")
public class GzipResponseHeadersNotModifiableException extends ServletException {

	public GzipResponseHeadersNotModifiableException(final String message) {
		super(message);
	}
}


text:
<!doctype html>

  <title></title>
  <link rel="stylesheet" href="{{ urls.style }}">


text:
require_relative '../../../plugins/apache/apache-graphite'
require_relative '../../../spec_helper'

describe ApacheMetrics, 'run' do
  it 'should get valid output from mod_status' do
  end

  it 'should parse valid output into graphite metrics' do
  end

  it 'should return valid graphite metrics' do
  end
end


text:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
	<modelVersion>4.0.0</modelVersion>

	<artifactId>project-entity</artifactId>
	<packaging>jar</packaging>

	<parent>
		<groupId>com.qingbo.project</groupId>
		<artifactId>project-parent</artifactId>
		<version>1.0.0</version>
	</parent>

	<properties>
		<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
		<maven.compiler.encoding>UTF-8</maven.compiler.encoding>
		<maven.compiler.source>1.7</maven.compiler.source>
		<maven.compiler.target>1.7</maven.compiler.target>
		<maven.test.skip>true</maven.test.skip>
	</properties>

	<dependencies>
		<dependency>
			<groupId>org.hibernate.javax.persistence</groupId>
			<artifactId>hibernate-jpa-2.1-api</artifactId>
			<version>1.0.0.Final</version>
		</dependency>
	</dependencies>
</project>


text:
VCO.Media.Text = VCO.Class.extend({

	includes: [VCO.Events],

	// DOM ELEMENTS
	_el: {
		container: {},
		content_container: {},
		content: {},
		headline: {}
	},

	// Data
	data: {
		uniqueid: 			"",
		headline: 			"headline",
		text: 				"text"
	},

	// Options
	options: {
		title: 			false
	},

	/*	Constructor
	================================================== */
	initialize: function(data, options, add_to_container) {

		VCO.Util.setData(this, data);

		// Merge Options
		VCO.Util.mergeData(this.options, options);

		this._el.container = VCO.Dom.create("div", "vco-text");
		this._el.container.id = this.data.uniqueid;

		this._initLayout();

		if (add_to_container) {
			add_to_container.appendChild(this._el.container);
		};

	},

	/*	Adding, Hiding, Showing etc
	================================================== */
	show: function() {

	},

	hide: function() {

	},

	addTo: function(container) {
		container.appendChild(this._el.container);
		//this.onAdd();
	},

	removeFrom: function(container) {
		container.removeChild(this._el.container);
	},

	headlineHeight: function() {
		return this._el.headline.offsetHeight + 40;
	},

	/*	Events
	================================================== */
	onLoaded: function() {
		this.fire("loaded", this.data);
	},

	onAdd: function() {
		this.fire("added", this.data);
	},

	onRemove: function() {
		this.fire("removed", this.data);
	},

	/*	Private Methods
	================================================== */
	_initLayout: function () {

		// Create Layout
		this._el.content_container			= VCO.Dom.create("div", "vco-text-content-container", this._el.container);

		// Headline
		if (this.data.headline != "") {
			var headline_class = "vco-headline";
			if (this.options.title) {
				headline_class = "vco-headline vco-headline-title";
			}
			this._el.headline				= VCO.Dom.create("h2", headline_class, this._el.content_container);
			this._el.headline.innerHTML		= this.data.headline;
		}

		// Text
		if (this.data.text != "") {
			this._el.content				= VCO.Dom.create("div", "vco-text-content", this._el.content_container);
			this._el.content.innerHTML		= VCO.Util.htmlify(this.data.text);
		}

		// Fire event that the slide is loaded
		this.onLoaded();

	}

});


text:
@{meta('IDE for node.js', 'Code editors / IDE for node.js and total.js.', 'code, editor, IDE, node', 'social.jpg')}

IDE for node.js / total.js

Integrated development environment for node.js and total.js.

Sublime Text Editor

Sublime Text is a sophisticated text editor for code, markup and prose. You'll love the slick user interface and amazing performance. + Free trial.

Platform: OSX, Linux, Windows

→ Download

→ Download total.js highlighter

Chocolat

Native text editor for Mac. We want it to work with every programming language under the sun. Be it Ruby, C++, PHP or Haskell. + Free trial.

Platform: OSX

				→ Download

CodeRunner

With CodeRunner, it has never been easier to write and test code, run scripts, or simply experiment with a new coding or scripting language.

Platform: OSX

				→ Download

WebMatrix

WebMatrix is a free and lightweight web development tool. Create, publish, and maintain your website with ease. + Free.

Platform: Windows

				→ Download

WebStorm

The smartest JavaScript IDE. Create great web sites and applications in a great IDE. The best JavaScript IDE and HTML editor is at your fingertips. + Free trial.

Platform: OSX, Linux, Windows

→ Download

Coda 2

We made Coda 2 better at everything. You code the web. We revolutionized that process in Coda, putting everything in one place. An editor. Terminal. CSS. Files.

Platform: OSX

				→ Download

Expresso

Espresso turbo-charges your workflow with the perfect blend of features. Speed through day-to-day edits with extensive language support, ... + Free trial.

Platform: OSX

				→ Download

Komodo IDE

Komodo is the professional IDE for major web languages, including Python, PHP, Ruby, Perl, HTML, CSS and JavaScript.
+ Free trial.

Platform: OSX, Linux, Windows

				→ Download

ONLINE IDE

Cloud9 IDE

Write, run, and debug your code with our powerful and flexible cloud IDE. Collaborate on your workspaces publicly, or keep them private. + Free.

				→ c9.io


text:
package org.copperengine.monitoring.client.form.filter;

import java.net.MalformedURLException;
import java.net.URL;

import javafx.scene.Node;

public class GenericFilterController<T> extends BaseFilterController<T> {

    public static final URL EMPTY_DUMMY_URL;

    static {
        try {
            EMPTY_DUMMY_URL = new URL("http://a");
        } catch (MalformedURLException e) {
            throw new RuntimeException(e);
        }
    }

    private final T filter;
    private final long refreshInterval;

    public GenericFilterController(T filter, long refreshInterval) {
        super();
        this.filter = filter;
        this.refreshInterval = refreshInterval;
    }

    public GenericFilterController(T filter) {
        this(filter, FilterController.DEFAULT_REFRESH_INTERVAL);
    }

    public GenericFilterController(long refreshInterval) {
        this(null, refreshInterval);
    }

    @Override
    public URL getFxmlResource() {
        return EMPTY_DUMMY_URL;
    }

    @Override
    public T getFilter() {
        return filter;
    }

    @Override
    public boolean supportsFiltering() {
        return filter != null;
    }

    @Override
    public long getDefaultRefreshInterval() {
        return refreshInterval;
    }

    @Override
    public Node createDefaultFilter() {
        return null;
    }
}


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

using System.Collections.Generic;
using Newtonsoft.Json;

namespace Microsoft.Azure.Search.Models
{
    internal class SearchParametersPayload
    {
        [JsonProperty("count")]
        public bool? Count { get; set; }

        [JsonProperty("facets")]
        public IList<string> Facets { get; set; }

        [JsonProperty("filter")]
        public string Filter { get; set; }

        [JsonProperty("highlight")]
        public string Highlight { get; set; }

        [JsonProperty("highlightPostTag")]
        public string HighlightPostTag { get; set; }

        [JsonProperty("highlightPreTag")]
        public string HighlightPreTag { get; set; }

        [JsonProperty("minimumCoverage")]
        public double? MinimumCoverage { get; set; }

        [JsonProperty("orderby")]
        public string OrderBy { get; set; }

        [JsonProperty("scoringParameters")]
        public IList<string> ScoringParameters { get; set; }

        [JsonProperty("scoringProfile")]
        public string ScoringProfile { get; set; }

        [JsonProperty("search")]
        public string Search { get; set; }

        [JsonProperty("searchFields")]
        public string SearchFields { get; set; }

        [JsonProperty("searchMode")]
        public SearchMode? SearchMode { get; set; }

        [JsonProperty("select")]
        public string Select { get; set; }

        [JsonProperty("skip")]
        public int? Skip { get; set; }

        [JsonProperty("top")]
        public int? Top { get; set; }
    }
}


text:
struct BSettings {
    QString castUrl, title, description, shoutUrl, genre;
    int bitrate;
};

class BcastSettings
{
public:
    BcastSettings();
};

#endif // BCASTSETTINGS_H


text:
package appeng.api.util;

import net.minecraft.world.IBlockAccess;

/**
 * Implemented on many of AE's non Tile Entity Blocks as a way to get a IOrientable.
 */
public interface IOrientableBlock {

    /**
     * @return if this block uses metadata to store its rotation.
     */
    boolean usesMetadata();

    /**
     * @param world
     * @param x
     * @param y
     * @param z
     * @return a IOrientable if applicable
     */
    IOrientable getOrientable(IBlockAccess world, int x, int y, int z);

}


text:
#include <cybergarage/x3d/CyberX3DConfig.h>
#include <cybergarage/x3d/X3DParser.h>
#include <cybergarage/x3d/X3DParserHandlers.h>
#include <cybergarage/x3d/ParserFunc.h>

#ifdef CX3D_SUPPORT_X3D

#include <xercesc/util/PlatformUtils.hpp>
#include <xercesc/util/TransService.hpp>
#include <xercesc/sax2/SAX2XMLReader.hpp>
#include <xercesc/sax2/XMLReaderFactory.hpp>

using namespace CyberX3D;
using namespace xercesc;

////////////////////////////////////////////////
//	X3DParser
////////////////////////////////////////////////

X3DParser::X3DParser()
{
    try {
         XMLPlatformUtils::Initialize();
    }
	catch (const XMLException& e) {}

	encodingName = "LATIN1";
	expandNamespaces = false;
	//unRepFlags = XMLFormatter::UnRep_CharRef;
	valScheme = SAX2XMLReader::Val_Never;
	doValidation = false;
	doNamespaces = false;
	doSchema = false;
	schemaFullChecking = false;
	namespacePrefixes = false;
}

////////////////////////////////////////////////
//	~X3DParser
////////////////////////////////////////////////

X3DParser::~X3DParser()
{
}

////////////////////////////////////////////////
//	X3DParser::load
////////////////////////////////////////////////

bool X3DParser::load(const char *xmlFile, void (*callbackFn)(int nLine, void *info), void *callbackFnInfo)
{
    SAX2XMLReader* parser = XMLReaderFactory::createXMLReader();

    if (valScheme == SAX2XMLReader::Val_Auto)
    {
        parser->setFeature(XMLUni::fgSAX2CoreValidation, true);
        parser->setFeature(XMLUni::fgXercesDynamic, true);
    }

    if (valScheme == SAX2XMLReader::Val_Never)
    {
        parser->setFeature(XMLUni::fgSAX2CoreValidation, false);
    }

    if (valScheme == SAX2XMLReader::Val_Always)
    {
        parser->setFeature(XMLUni::fgSAX2CoreValidation, true);
        parser->setFeature(XMLUni::fgXercesDynamic, false);
    }

    parser->setFeature(XMLUni::fgSAX2CoreValidation, doValidation);
    parser->setFeature(XMLUni::fgSAX2CoreNameSpaces, doNamespaces);
    parser->setFeature(XMLUni::fgXercesSchema, doSchema);
    parser->setFeature(XMLUni::fgXercesSchemaFullChecking, schemaFullChecking);
    parser->setFeature(XMLUni::fgSAX2CoreNameSpacePrefixes, namespacePrefixes);

	beginParse();

    int errorCount = 0;
    try
    {
        X3DParserHandlers handler;
        parser->setContentHandler(&handler);
        parser->setErrorHandler(&handler);
        parser->parse(xmlFile);
        errorCount = parser->getErrorCount();
    } catch (const XMLException& e) {
        XMLPlatformUtils::Terminate();
		endParse();
        return false;
    }

    delete parser;

    XMLPlatformUtils::Terminate();
	endParse();

	if (0 < errorCount)
		return false;

	return true;
}

#endif


text:
package com.anttoolkit.documentum.common;

import com.documentum.fc.client.*;
import com.documentum.fc.common.*;

public class DqlHelper
{
	/**
	 * Executes read(SELECT) DQL query
	 * @param session DFC session wrapper
	 * @param dqlStatement statement
	 * @return collection
	 * @throws com.documentum.fc.common.DfException if any server errors occured
	 */
	public static IDfCollection executeReadQuery(DocbaseSession session, String dqlStatement)
			throws DfException
	{
		return executeDfQuery(session, dqlStatement, IDfQuery.DF_EXECREAD_QUERY);
	}

	/**
	 * The same as "executeQuery" function but doesn't return any results.
	 * Use this method only for delete, update and insert queries
	 * @param session DFC session wrapper
	 * @param dqlStatement statement
	 * @throws DfException if any server errors occured
	 */
	public static void executeQuery(DocbaseSession session, String dqlStatement)
			throws DfException
	{
		IDfCollection coll = null;

		try
		{
			coll = executeDfQuery(session, dqlStatement, IDfQuery.EXEC_QUERY);
		}
		finally
		{
			closeCollection(coll);
		}
	}

	/**
	 * Verifies if query returns any results
	 * @param session DFC session wrapper
	 * @param dqlStatement statement
	 * @return true if any results exist otherwise false
	 * @throws DfException if any server error occured
	 */
	public static boolean exist(DocbaseSession session, String dqlStatement)
			throws DfException
	{
		IDfCollection coll = null;
		try
		{
			coll = executeReadQuery(session, dqlStatement);
			return coll != null && coll.next();
		}
		finally
		{
			closeCollection(coll);
		}
	}

	/**
	 * Closes opened collection
	 * @param coll collection
	 */
	public static void closeCollection(IDfCollection coll)
	{
		try
		{
			if (coll != null &&
				(coll.getState() == IDfCollection.DF_READY_STATE ||
				coll.getState() == IDfCollection.DF_NO_MORE_ROWS_STATE))
			{
				coll.close();
			}
		}
		catch (DfException e)
		{
			System.out.println("DqlHelper:closeCollection Failed to close collection\r\n\r\n" + e.toString());
		}
	}

	/**
	 * Retrieves first string from DQL query
	 * @param session DFC session wrapper
	 * @param dqlStatement DQL statement
	 * @return typed object
	 * @throws com.documentum.fc.common.DfEndOfCollectionException if collection is empty
	 * @throws DfException if any server errors occured
	 */
	public static IDfTypedObject getFirstString(DocbaseSession session, String dqlStatement)
			throws DfEndOfCollectionException, DfException
	{
		IDfCollection coll = null;

		try
		{
			coll = executeReadQuery(session, dqlStatement);
			if (coll == null || !coll.next())
			{
				throw new DfEndOfCollectionException();
			}

			return coll.getTypedObject();
		}
		finally
		{
			closeCollection(coll);
		}
	}

	/**
	 * Executes DQL query, retrieves parameter from the first record in collection and closes it
	 * @param session DFC session wrapper
	 * @param dqlStatement DQL statement
	 * @param parameterName parameter name
	 * @return parameter value
	 * @throws DfEndOfCollectionException if collection is empty
	 * @throws DfException if any server errors occured
	 */
	public static IDfValue getParamFromFirstString(DocbaseSession session, String dqlStatement, String parameterName)
			throws DfEndOfCollectionException, DfException
	{
		IDfCollection coll = null;

		try
		{
			coll = executeReadQuery(session, dqlStatement);
			if (coll == null || !coll.next())
			{
				throw new DfEndOfCollectionException();
			}

			return coll.getTypedObject().getValue(parameterName);
		}
		finally
		{
			closeCollection(coll);
		}
	}

	/**
	 * Executes DQL query, retrieves parameter from the first record in collection and closes it
	 * @param session DFC session wrapper
	 * @param dqlStatement DQL statement
	 * @param parameterPosition parameter position in the record
	 * @return parameter value
	 * @throws DfEndOfCollectionException if collection is empty
	 * @throws DfException if any server errors occured
	 */
	public static IDfValue getParamFromFirstString(DocbaseSession session, String dqlStatement, int parameterPosition)
			throws DfEndOfCollectionException, DfException
	{
		IDfCollection coll = null;

		try
		{
			coll = executeReadQuery(session, dqlStatement);
			if (coll == null || !coll.next())
			{
				throw new DfEndOfCollectionException();
			}

			return coll.getTypedObject().getValueAt(parameterPosition);
		}
		finally
		{
			closeCollection(coll);
		}
	}

	/**
	 * Executes DQL query, retrieves first parameter from the first record in collection and closes it
	 * @param session DFC session wrapper
	 * @param dqlStatement DQL statement
	 * @return parameter value
	 * @throws DfEndOfCollectionException if collection is empty
	 * @throws DfException if any server errors occured
	 */
	public static IDfValue getParamFromFirstString(DocbaseSession session, String dqlStatement)
			throws DfEndOfCollectionException, DfException
	{
		return getParamFromFirstString(session, dqlStatement, 0);
	}

	/**
	 * Executes DQL query, retrieves String parameter from the first record in collection and closes it
	 * @param session DFC session wrapper
	 * @param dqlStatement DQL statement
	 * @param parameterName parameter name
	 * @return parameter value
	 * @throws DfEndOfCollectionException if collection is empty
	 * @throws DfException if any server errors occured
	 */
	public static String getStringParamFromFirstString(DocbaseSession session, String dqlStatement, String parameterName)
			throws DfEndOfCollectionException, DfException
	{
		return getParamFromFirstString(session, dqlStatement, parameterName).asString();
	}

	/**
	 * Executes DQL query, retrieves String parameter from the first record in collection and closes it
	 * @param session DFC session wrapper
	 * @param dqlStatement DQL statement
	 * @param parameterPosition parameter position in the record
	 * @return parameter value
	 * @throws DfEndOfCollectionException if collection is empty
	 * @throws DfException if any server errors occured
	 */
	public static String getStringParamFromFirstString(DocbaseSession session, String dqlStatement, int parameterPosition)
			throws DfEndOfCollectionException, DfException
	{
		return getParamFromFirstString(session, dqlStatement, parameterPosition).asString();
	}

	/**
	 * Executes DQL query, retrieves first parameter as "String" from the first record in collection and closes it
	 * @param session DFC session wrapper
	 * @param dqlStatement DQL statement
	 * @return parameter value
	 * @throws DfEndOfCollectionException if collection is empty
	 * @throws DfException if any server errors occured
	 */
	public static String getStringParamFromFirstString(DocbaseSession session, String dqlStatement)
			throws DfEndOfCollectionException, DfException
	{
		return getParamFromFirstString(session, dqlStatement, 0).asString();
	}

	static String getStringParamFromFirstString(IDfSession session, String dqlStatement)
			throws DfEndOfCollectionException, DfException
	{
		return getParamFromFirstString(session, dqlStatement, 0).asString();
	}

	/**
	 * Executes DQL query, retrieves int parameter from the first record in collection and closes it
	 * @param session DFC session wrapper
	 * @param dqlStatement DQL statement
	 * @param parameterName parameter name
	 * @return parameter value
	 * @throws DfEndOfCollectionException if collection is empty
	 * @throws DfException if any server errors occured
	 */
	public static int getIntegerParamFromFirstString(DocbaseSession session, String dqlStatement, String parameterName)
			throws DfEndOfCollectionException, DfException
	{
		return getParamFromFirstString(session, dqlStatement, parameterName).asInteger();
	}

	/**
	 * Executes DQL query, retrieves int parameter from the first record in collection and closes it
	 * @param session DFC session wrapper
	 * @param dqlStatement DQL statement
	 * @param parameterPosition parameter position in the record
	 * @return parameter value
	 * @throws DfEndOfCollectionException if collection is empty
	 * @throws DfException if any server errors occured
	 */
	public static int getIntegerParamFromFirstString(DocbaseSession session, String dqlStatement, int parameterPosition)
			throws DfEndOfCollectionException, DfException
	{
		return getParamFromFirstString(session, dqlStatement, parameterPosition).asInteger();
	}

	/**
	 * Executes DQL query, retrieves first parameter as "int" from the first record in collection and closes it
	 * @param session DFC session wrapper
	 * @param dqlStatement DQL statement
	 * @return parameter value
	 * @throws DfEndOfCollectionException if collection is empty
	 * @throws DfException if any server errors occured
	 */
	public static int getIntegerParamFromFirstString(DocbaseSession session, String dqlStatement)
			throws DfEndOfCollectionException, DfException
	{
		return getParamFromFirstString(session, dqlStatement, 0).asInteger();
	}

	/**
	 * Executes DQL query, retrieves double parameter from the first record in collection and closes it
	 * @param session DFC session wrapper
	 * @param dqlStatement DQL statement
	 * @param parameterName parameter name
	 * @return parameter value
	 * @throws DfEndOfCollectionException if collection is empty
	 * @throws DfException if any server errors occured
	 */
	public static double getDoubleParamFromFirstString(DocbaseSession session, String dqlStatement, String parameterName)
			throws DfEndOfCollectionException, DfException
	{
		return getParamFromFirstString(session, dqlStatement, parameterName).asDouble();
	}

	/**
	 * Executes DQL query, retrieves double parameter from the first record in collection and closes it
	 * @param session DFC session wrapper
	 * @param dqlStatement DQL statement
	 * @param parameterPosition parameter position in the record
	 * @return parameter value
	 * @throws DfEndOfCollectionException if collection is empty
	 * @throws DfException if any server errors occured
	 */
	public static double getDoubleParamFromFirstString(DocbaseSession session, String dqlStatement, int parameterPosition)
			throws DfEndOfCollectionException, DfException
	{
		return getParamFromFirstString(session, dqlStatement, parameterPosition).asDouble();
	}

	/**
	 * Executes DQL query, retrieves first parameter as "double" from the first record in collection and closes it
	 * @param session DFC session wrapper
	 * @param dqlStatement DQL statement
	 * @return parameter value
	 * @throws DfEndOfCollectionException if collection is empty
	 * @throws DfException if any server errors occured
	 */
	public static double getDoubleParamFromFirstString(DocbaseSession session, String dqlStatement)
			throws DfEndOfCollectionException, DfException
	{
		return getParamFromFirstString(session, dqlStatement, 0).asDouble();
	}

	/**
	 * Executes DQL query, retrieves boolean parameter from the first record in collection and closes it
	 * @param session DFC session wrapper
	 * @param dqlStatement DQL statement
	 * @param parameterName parameter name
	 * @return parameter value
	 * @throws DfEndOfCollectionException if collection is empty
	 * @throws DfException if any server errors occured
	 */
	public static boolean getBooleanParamFromFirstString(DocbaseSession session, String dqlStatement, String parameterName)
			throws DfEndOfCollectionException, DfException
	{
		return getParamFromFirstString(session, dqlStatement, parameterName).asBoolean();
	}

	/**
	 * Executes DQL query, retrieves boolean parameter from the first record in collection and closes it
	 * @param session DFC session wrapper
	 * @param dqlStatement DQL statement
	 * @param parameterPosition parameter position in the record
	 * @return parameter value
	 * @throws DfEndOfCollectionException if collection is empty
	 * @throws DfException if any server errors occured
	 */
	public static boolean getBooleanParamFromFirstString(DocbaseSession session, String dqlStatement, int parameterPosition)
			throws DfEndOfCollectionException, DfException
	{
		return getParamFromFirstString(session, dqlStatement, parameterPosition).asBoolean();
	}

	/**
	 * Executes DQL query, retrieves first parameter as "boolean" from the first record in collection and closes it
	 * @param session DFC session wrapper
	 * @param dqlStatement DQL statement
	 * @return parameter value
	 * @throws DfEndOfCollectionException if collection is empty
	 * @throws DfException if any server errors occured
	 */
	public static boolean getBooleanParamFromFirstString(DocbaseSession session, String dqlStatement)
			throws DfEndOfCollectionException, DfException
	{
		return getParamFromFirstString(session, dqlStatement, 0).asBoolean();
	}

	/**
	 * Executes DQL query, retrieves IDfId parameter from the first record in collection and closes it
	 * @param session DFC session wrapper
	 * @param dqlStatement DQL statement
	 * @param parameterName parameter name
	 * @return parameter value
	 * @throws DfEndOfCollectionException if collection is empty
	 * @throws DfException if any server errors occured
	 */
	public static IDfId getIdParamFromFirstString(DocbaseSession session, String dqlStatement, String parameterName)
			throws DfEndOfCollectionException, DfException
	{
		return getParamFromFirstString(session, dqlStatement, parameterName).asId();
	}

	/**
	 * Executes DQL query, retrieves IDfId parameter from the first record in collection and closes it
	 * @param session DFC session wrapper
	 * @param dqlStatement DQL statement
	 * @param parameterPosition parameter position in the record
	 * @return parameter value
	 * @throws DfEndOfCollectionException if collection is empty
	 * @throws DfException if any server errors occured
	 */
	public static IDfId getIdParamFromFirstString(DocbaseSession session, String dqlStatement, int parameterPosition)
			throws DfEndOfCollectionException, DfException
	{
		return getParamFromFirstString(session, dqlStatement, parameterPosition).asId();
	}

	/**
	 * Executes DQL query, retrieves first parameter as "IDfId" from the first record in collection and closes it
	 * @param session DFC session wrapper
	 * @param dqlStatement DQL statement
	 * @return parameter value
	 * @throws DfEndOfCollectionException if collection is empty
	 * @throws DfException if any server errors occured
	 */
	public static IDfId getIdParamFromFirstString(DocbaseSession session, String dqlStatement)
			throws DfEndOfCollectionException, DfException
	{
		return getParamFromFirstString(session, dqlStatement, 0).asId();
	}

	/**
	 * Executes DQL query, retrieves IDfTime parameter from the first record in collection and closes it
	 * @param session DFC session wrapper
	 * @param dqlStatement DQL statement
	 * @param parameterName parameter name
	 * @return parameter value
	 * @throws DfEndOfCollectionException if collection is empty
	 * @throws DfException if any server errors occured
	 */
	public static IDfTime getTimeParamFromFirstString(DocbaseSession session, String dqlStatement, String parameterName)
			throws DfEndOfCollectionException, DfException
	{
		return getParamFromFirstString(session, dqlStatement, parameterName).asTime();
	}

	/**
	 * Executes DQL query, retrieves IDfTime parameter from the first record in collection and closes it
	 * @param session DFC session wrapper
	 * @param dqlStatement DQL statement
	 * @param parameterPosition parameter position in the record
	 * @return parameter value
	 * @throws DfEndOfCollectionException if collection is empty
	 * @throws DfException if any server errors occured
	 */
	public static IDfTime getTimeParamFromFirstString(DocbaseSession session, String dqlStatement, int parameterPosition)
			throws DfEndOfCollectionException, DfException
	{
		return getParamFromFirstString(session, dqlStatement, parameterPosition).asTime();
	}

	/**
	 * Executes DQL query, retrieves first parameter as "IDfTime" from the first record in collection and closes it
	 * @param session DFC session wrapper
	 * @param dqlStatement DQL statement
	 * @return parameter value
	 * @throws DfEndOfCollectionException if collection is empty
	 * @throws DfException if any server errors occured
	 */
	public static IDfTime getTimeParamFromFirstString(DocbaseSession session, String dqlStatement)
			throws DfEndOfCollectionException, DfException
	{
		return getParamFromFirstString(session, dqlStatement, 0).asTime();
	}

//// PRIVATE MEMBERS ////

	static IDfCollection executeReadQuery(IDfSession session, String dqlStatement)
			throws DfException
	{
		return executeDfQuery(session, dqlStatement, IDfQuery.DF_EXECREAD_QUERY);
	}

	static IDfValue getParamFromFirstString(IDfSession session, String dqlStatement, int parameterPosition)
			throws DfEndOfCollectionException, DfException
	{
		IDfCollection coll = null;

		try
		{
			coll = executeReadQuery(session, dqlStatement);
			if (coll == null || !coll.next())
			{
				throw new DfEndOfCollectionException();
			}

			return coll.getTypedObject().getValueAt(parameterPosition);
		}
		finally
		{
			closeCollection(coll);
		}
	}

	static IDfValue getParamFromFirstString(IDfSession session, String dqlStatement)
			throws DfEndOfCollectionException, DfException
	{
		return getParamFromFirstString(session, dqlStatement, 0);
	}

	static IDfCollection executeDfQuery(DocbaseSession session,
												String dqlStatement,
												int queryType)
			throws DfException
	{
		IDfQuery query = new DfQuery();
		query.setDQL(removeFormattingCharacters(dqlStatement));
		return query.execute(session.getDfSession(), queryType);
	}

	static IDfCollection executeDfQuery(IDfSession session,
												String dqlStatement,
												int queryType)
			throws DfException
	{
		IDfQuery query = new DfQuery();
		query.setDQL(removeFormattingCharacters(dqlStatement));
		return query.execute(session, queryType);
	}

	private static String removeFormattingCharacters(String text)
	{
		if (text == null)
		{
			return null;
		}

		String temp = text.replace("\r", " ");
		temp = temp.replace("\n", " ");
		temp = temp.replace("\t", " ");

		return temp.trim();
	}
}


text:
module(..., package.seeall)

local ffi = require("ffi")
local shm = require("core.shm")

-- SHM object type for gauges (double precision float values).

type = shm.register('gauge', getfenv())

local gauge_t = ffi.typeof("struct { double g; }")

function create (name, initval)
   local gauge = shm.create(name, gauge_t)
   set(gauge, initval or 0)
   return gauge
end

function open (name)
   return shm.open(name, gauge_t, 'readonly')
end

function set  (gauge, value) gauge.g = value end
function read (gauge) return gauge.g         end

ffi.metatype(gauge_t,
             {__tostring =
              function (gauge) return ("%f"):format(read(gauge)) end})

function selftest ()
   print('selftest: lib.gauge')
   local a = create("lib.gauge/gauge/a", 1.42)
   local a2 = open("lib.gauge/gauge/a")
   local b = create("lib.gauge/gauge/b")
   assert(read(a) == 1.42)
   assert(read(a2) == read(a))
   assert(read(b) == 0)
   assert(read(a) ~=  read(b))
   set(a, 0.1234)
   assert(read(a) == 0.1234)
   assert(read(a2) == read(a))
   shm.unmap(a)
   shm.unmap(a2)
   shm.unmap(b)
   shm.unlink("link.gauge")
   print('selftest: ok')
end